FULLPIPE: Fix memory leaks and unnecessary indirect allocations in Motion and Sc2
This commit is contained in:
parent
ca5a86e703
commit
bb26bf7994
20 changed files with 259 additions and 362 deletions
|
@ -283,7 +283,7 @@ public:
|
||||||
int getObjectEnumState(const Common::String &name, const char *state);
|
int getObjectEnumState(const Common::String &name, const char *state);
|
||||||
|
|
||||||
void sceneAutoScrolling();
|
void sceneAutoScrolling();
|
||||||
bool sceneSwitcher(EntranceInfo *entrance);
|
bool sceneSwitcher(const EntranceInfo &entrance);
|
||||||
Scene *accessScene(int sceneId);
|
Scene *accessScene(int sceneId);
|
||||||
void setSceneMusicParameters(GameVar *var);
|
void setSceneMusicParameters(GameVar *var);
|
||||||
int convertScene(int scene);
|
int convertScene(int scene);
|
||||||
|
|
|
@ -97,28 +97,7 @@ GameLoader::GameLoader() {
|
||||||
GameLoader::~GameLoader() {
|
GameLoader::~GameLoader() {
|
||||||
delete _interactionController;
|
delete _interactionController;
|
||||||
delete _inputController;
|
delete _inputController;
|
||||||
|
|
||||||
for (uint i = 0; i < _sc2array.size(); i++) {
|
|
||||||
if (_sc2array[i]._defPicAniInfos)
|
|
||||||
free(_sc2array[i]._defPicAniInfos);
|
|
||||||
|
|
||||||
if (_sc2array[i]._picAniInfos)
|
|
||||||
free(_sc2array[i]._picAniInfos);
|
|
||||||
|
|
||||||
if (_sc2array[i]._motionController)
|
|
||||||
delete _sc2array[i]._motionController;
|
|
||||||
|
|
||||||
if (_sc2array[i]._data1)
|
|
||||||
free(_sc2array[i]._data1);
|
|
||||||
|
|
||||||
if (_sc2array[i]._entranceData)
|
|
||||||
free(_sc2array[i]._entranceData);
|
|
||||||
}
|
|
||||||
|
|
||||||
delete _gameVar;
|
delete _gameVar;
|
||||||
_gameVar = 0;
|
|
||||||
|
|
||||||
_sc2array.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameLoader::load(MfcArchive &file) {
|
bool GameLoader::load(MfcArchive &file) {
|
||||||
|
@ -185,11 +164,11 @@ bool GameLoader::loadScene(int sceneId) {
|
||||||
if (st->_scene) {
|
if (st->_scene) {
|
||||||
st->_scene->init();
|
st->_scene->init();
|
||||||
|
|
||||||
applyPicAniInfos(st->_scene, _sc2array[idx]._defPicAniInfos, _sc2array[idx]._defPicAniInfosCount);
|
applyPicAniInfos(st->_scene, _sc2array[idx]._defPicAniInfos);
|
||||||
applyPicAniInfos(st->_scene, _sc2array[idx]._picAniInfos, _sc2array[idx]._picAniInfosCount);
|
applyPicAniInfos(st->_scene, _sc2array[idx]._picAniInfos);
|
||||||
|
|
||||||
_sc2array[idx]._scene = st->_scene;
|
_sc2array[idx]._scene = st->_scene;
|
||||||
_sc2array[idx]._isLoaded = 1;
|
_sc2array[idx]._isLoaded = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -208,18 +187,18 @@ bool GameLoader::gotoScene(int sceneId, int entranceId) {
|
||||||
if (!_sc2array[sc2idx]._isLoaded)
|
if (!_sc2array[sc2idx]._isLoaded)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (_sc2array[sc2idx]._entranceDataCount < 1) {
|
if (_sc2array[sc2idx]._entranceData.size() < 1) {
|
||||||
g_fp->_currentScene = st->_scene;
|
g_fp->_currentScene = st->_scene;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_sc2array[sc2idx]._entranceDataCount <= 0)
|
if (!_sc2array[sc2idx]._entranceData.size())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int entranceIdx = 0;
|
uint entranceIdx = 0;
|
||||||
if (sceneId != 726) // WORKAROUND
|
if (sceneId != 726) // WORKAROUND
|
||||||
for (entranceIdx = 0; _sc2array[sc2idx]._entranceData[entranceIdx]->_field_4 != entranceId; entranceIdx++) {
|
for (entranceIdx = 0; _sc2array[sc2idx]._entranceData[entranceIdx]._field_4 != entranceId; entranceIdx++) {
|
||||||
if (entranceIdx >= _sc2array[sc2idx]._entranceDataCount)
|
if (entranceIdx >= _sc2array[sc2idx]._entranceData.size())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +216,7 @@ bool GameLoader::gotoScene(int sceneId, int entranceId) {
|
||||||
|
|
||||||
g_fp->_currentScene = st->_scene;
|
g_fp->_currentScene = st->_scene;
|
||||||
|
|
||||||
MessageQueue *mq1 = g_fp->_currentScene->getMessageQueueById(_sc2array[sc2idx]._entranceData[entranceIdx]->_messageQueueId);
|
MessageQueue *mq1 = g_fp->_currentScene->getMessageQueueById(_sc2array[sc2idx]._entranceData[entranceIdx]._messageQueueId);
|
||||||
if (mq1) {
|
if (mq1) {
|
||||||
MessageQueue *mq = new MessageQueue(mq1, 0, 0);
|
MessageQueue *mq = new MessageQueue(mq1, 0, 0);
|
||||||
|
|
||||||
|
@ -442,8 +421,8 @@ bool GameLoader::unloadScene(int sceneId) {
|
||||||
delete tag->_scene;
|
delete tag->_scene;
|
||||||
tag->_scene = nullptr;
|
tag->_scene = nullptr;
|
||||||
|
|
||||||
_sc2array[sceneTag]._isLoaded = 0;
|
_sc2array[sceneTag]._isLoaded = false;
|
||||||
_sc2array[sceneTag]._scene = 0;
|
_sc2array[sceneTag]._scene = nullptr;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -467,46 +446,47 @@ int GameLoader::getSceneTagBySceneId(int sceneId, SceneTag **st) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameLoader::applyPicAniInfos(Scene *sc, PicAniInfo **picAniInfo, int picAniInfoCount) {
|
void GameLoader::applyPicAniInfos(Scene *sc, const PicAniInfoList &picAniInfo) {
|
||||||
if (picAniInfoCount <= 0)
|
if (!picAniInfo.size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
debugC(0, kDebugAnimation, "GameLoader::applyPicAniInfos(sc, ptr, %d)", picAniInfoCount);
|
debugC(0, kDebugAnimation, "GameLoader::applyPicAniInfos(sc, ptr, %d)", picAniInfo.size());
|
||||||
|
|
||||||
PictureObject *pict;
|
PictureObject *pict;
|
||||||
StaticANIObject *ani;
|
StaticANIObject *ani;
|
||||||
|
|
||||||
for (int i = 0; i < picAniInfoCount; i++) {
|
for (uint i = 0; i < picAniInfo.size(); i++) {
|
||||||
debugC(7, kDebugAnimation, "PicAniInfo: id: %d type: %d", picAniInfo[i]->objectId, picAniInfo[i]->type);
|
const PicAniInfo &info = picAniInfo[i];
|
||||||
if (picAniInfo[i]->type & 2) {
|
debugC(7, kDebugAnimation, "PicAniInfo: id: %d type: %d", info.objectId, info.type);
|
||||||
pict = sc->getPictureObjectById(picAniInfo[i]->objectId, picAniInfo[i]->field_8);
|
if (info.type & 2) {
|
||||||
|
pict = sc->getPictureObjectById(info.objectId, info.field_8);
|
||||||
if (pict) {
|
if (pict) {
|
||||||
pict->setPicAniInfo(picAniInfo[i]);
|
pict->setPicAniInfo(info);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
pict = sc->getPictureObjectById(picAniInfo[i]->objectId, 0);
|
pict = sc->getPictureObjectById(info.objectId, 0);
|
||||||
if (pict) {
|
if (pict) {
|
||||||
PictureObject *pictNew = new PictureObject(pict);
|
PictureObject *pictNew = new PictureObject(pict);
|
||||||
|
|
||||||
sc->_picObjList.push_back(pictNew);
|
sc->_picObjList.push_back(pictNew);
|
||||||
pictNew->setPicAniInfo(picAniInfo[i]);
|
pictNew->setPicAniInfo(info);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!(picAniInfo[i]->type & 1))
|
if (!(info.type & 1))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Scene *scNew = g_fp->accessScene(picAniInfo[i]->sceneId);
|
Scene *scNew = g_fp->accessScene(info.sceneId);
|
||||||
if (!scNew)
|
if (!scNew)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ani = sc->getStaticANIObject1ById(picAniInfo[i]->objectId, picAniInfo[i]->field_8);
|
ani = sc->getStaticANIObject1ById(info.objectId, info.field_8);
|
||||||
if (ani) {
|
if (ani) {
|
||||||
ani->setPicAniInfo(picAniInfo[i]);
|
ani->setPicAniInfo(picAniInfo[i]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ani = scNew->getStaticANIObject1ById(picAniInfo[i]->objectId, 0);
|
ani = scNew->getStaticANIObject1ById(info.objectId, 0);
|
||||||
if (ani) {
|
if (ani) {
|
||||||
StaticANIObject *aniNew = new StaticANIObject(ani);
|
StaticANIObject *aniNew = new StaticANIObject(ani);
|
||||||
|
|
||||||
|
@ -533,42 +513,29 @@ void GameLoader::saveScenePicAniInfos(int sceneId) {
|
||||||
if (!st->_scene)
|
if (!st->_scene)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int picAniInfosCount;
|
_sc2array[idx]._picAniInfos = savePicAniInfos(st->_scene, 0, 128);
|
||||||
|
|
||||||
PicAniInfo **pic = savePicAniInfos(st->_scene, 0, 128, &picAniInfosCount);
|
|
||||||
|
|
||||||
if (_sc2array[idx]._picAniInfos)
|
|
||||||
free(_sc2array[idx]._picAniInfos);
|
|
||||||
|
|
||||||
_sc2array[idx]._picAniInfos = pic;
|
|
||||||
_sc2array[idx]._picAniInfosCount = picAniInfosCount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PicAniInfo **GameLoader::savePicAniInfos(Scene *sc, int flag1, int flag2, int *picAniInfoCount) {
|
PicAniInfoList GameLoader::savePicAniInfos(Scene *sc, int flag1, int flag2) {
|
||||||
PicAniInfo **res;
|
|
||||||
|
|
||||||
*picAniInfoCount = 0;
|
|
||||||
if (!sc)
|
if (!sc)
|
||||||
return NULL;
|
return PicAniInfoList();
|
||||||
|
|
||||||
if (!sc->_picObjList.size())
|
if (!sc->_picObjList.size())
|
||||||
return NULL;
|
return PicAniInfoList();
|
||||||
|
|
||||||
int numInfos = sc->_staticANIObjectList1.size() + sc->_picObjList.size() - 1;
|
int numInfos = sc->_staticANIObjectList1.size() + sc->_picObjList.size() - 1;
|
||||||
if (numInfos < 1)
|
if (numInfos < 1)
|
||||||
return NULL;
|
return PicAniInfoList();
|
||||||
|
|
||||||
res = (PicAniInfo **)malloc(sizeof(PicAniInfo *) * numInfos);
|
PicAniInfoList res;
|
||||||
|
res.reserve(numInfos);
|
||||||
int idx = 0;
|
|
||||||
|
|
||||||
for (uint i = 0; i < sc->_picObjList.size(); i++) {
|
for (uint i = 0; i < sc->_picObjList.size(); i++) {
|
||||||
PictureObject *obj = sc->_picObjList[i];
|
PictureObject *obj = sc->_picObjList[i];
|
||||||
|
|
||||||
if (obj && ((obj->_flags & flag1) == flag1) && ((obj->_field_8 & flag2) == flag2)) {
|
if (obj && ((obj->_flags & flag1) == flag1) && ((obj->_field_8 & flag2) == flag2)) {
|
||||||
res[idx] = new PicAniInfo();
|
res.push_back(PicAniInfo());
|
||||||
obj->getPicAniInfo(res[idx]);
|
obj->getPicAniInfo(res.back());
|
||||||
idx++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -576,21 +543,13 @@ PicAniInfo **GameLoader::savePicAniInfos(Scene *sc, int flag1, int flag2, int *p
|
||||||
StaticANIObject *obj = sc->_staticANIObjectList1[i];
|
StaticANIObject *obj = sc->_staticANIObjectList1[i];
|
||||||
|
|
||||||
if (obj && ((obj->_flags & flag1) == flag1) && ((obj->_field_8 & flag2) == flag2)) {
|
if (obj && ((obj->_flags & flag1) == flag1) && ((obj->_field_8 & flag2) == flag2)) {
|
||||||
res[idx] = new PicAniInfo();
|
res.push_back(PicAniInfo());
|
||||||
obj->getPicAniInfo(res[idx]);
|
obj->getPicAniInfo(res.back());
|
||||||
res[idx]->type &= 0xFFFF;
|
res.back().type &= 0xFFFF;
|
||||||
idx++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*picAniInfoCount = idx;
|
debugC(4, kDebugBehavior | kDebugAnimation, "savePicAniInfos: Stored %d infos", res.size());
|
||||||
|
|
||||||
debugC(4, kDebugBehavior | kDebugAnimation, "savePicAniInfos: Stored %d infos", idx);
|
|
||||||
|
|
||||||
if (!idx) {
|
|
||||||
free(res);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -614,20 +573,15 @@ void GameLoader::updateSystems(int counterdiff) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Sc2::Sc2() {
|
Sc2::Sc2() :
|
||||||
_sceneId = 0;
|
_sceneId(0),
|
||||||
_field_2 = 0;
|
_field_2(0),
|
||||||
_scene = 0;
|
_scene(nullptr),
|
||||||
_motionController = 0;
|
_isLoaded(false),
|
||||||
_data1 = 0;
|
_motionController(nullptr) {}
|
||||||
_count1 = 0;
|
|
||||||
_defPicAniInfos = 0;
|
Sc2::~Sc2() {
|
||||||
_defPicAniInfosCount = 0;
|
delete _motionController;
|
||||||
_picAniInfos = 0;
|
|
||||||
_picAniInfosCount = 0;
|
|
||||||
_isLoaded = 0;
|
|
||||||
_entranceData = 0;
|
|
||||||
_entranceDataCount = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sc2::load(MfcArchive &file) {
|
bool Sc2::load(MfcArchive &file) {
|
||||||
|
@ -635,49 +589,35 @@ bool Sc2::load(MfcArchive &file) {
|
||||||
|
|
||||||
_sceneId = file.readUint16LE();
|
_sceneId = file.readUint16LE();
|
||||||
|
|
||||||
|
delete _motionController;
|
||||||
_motionController = file.readClass<MotionController>();
|
_motionController = file.readClass<MotionController>();
|
||||||
|
|
||||||
_count1 = file.readUint32LE();
|
const uint count1 = file.readUint32LE();
|
||||||
debugC(4, kDebugLoading, "count1: %d", _count1);
|
debugC(4, kDebugLoading, "count1: %d", count1);
|
||||||
if (_count1 > 0) {
|
if (count1) {
|
||||||
_data1 = (int32 *)malloc(_count1 * sizeof(int32));
|
_data1.reserve(count1);
|
||||||
|
for (uint i = 0; i < count1; i++) {
|
||||||
for (int i = 0; i < _count1; i++) {
|
_data1.push_back(file.readUint32LE());
|
||||||
_data1[i] = file.readUint32LE();
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
_data1 = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_defPicAniInfosCount = file.readUint32LE();
|
const uint defPicAniInfosCount = file.readUint32LE();
|
||||||
debugC(4, kDebugLoading, "defPicAniInfos: %d", _defPicAniInfosCount);
|
debugC(4, kDebugLoading, "defPicAniInfos: %d", defPicAniInfosCount);
|
||||||
if (_defPicAniInfosCount > 0) {
|
if (defPicAniInfosCount) {
|
||||||
_defPicAniInfos = (PicAniInfo **)malloc(_defPicAniInfosCount * sizeof(PicAniInfo *));
|
_defPicAniInfos.resize(defPicAniInfosCount);
|
||||||
|
for (uint i = 0; i < defPicAniInfosCount; i++) {
|
||||||
for (int i = 0; i < _defPicAniInfosCount; i++) {
|
_defPicAniInfos[i].load(file);
|
||||||
_defPicAniInfos[i] = new PicAniInfo();
|
|
||||||
|
|
||||||
_defPicAniInfos[i]->load(file);
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
_defPicAniInfos = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_picAniInfos = 0;
|
const uint entranceDataCount = file.readUint32LE();
|
||||||
_picAniInfosCount = 0;
|
debugC(4, kDebugLoading, "_entranceData: %d", entranceDataCount);
|
||||||
|
|
||||||
_entranceDataCount = file.readUint32LE();
|
if (entranceDataCount) {
|
||||||
debugC(4, kDebugLoading, "_entranceData: %d", _entranceDataCount);
|
_entranceData.resize(entranceDataCount);
|
||||||
|
for (uint i = 0; i < entranceDataCount; i++) {
|
||||||
if (_entranceDataCount > 0) {
|
_entranceData[i].load(file);
|
||||||
_entranceData = (EntranceInfo **)malloc(_entranceDataCount * sizeof(EntranceInfo *));
|
|
||||||
|
|
||||||
for (int i = 0; i < _entranceDataCount; i++) {
|
|
||||||
_entranceData[i] = new EntranceInfo();
|
|
||||||
_entranceData[i]->load(file);
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
_entranceData = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file.size() - file.pos() > 0)
|
if (file.size() - file.pos() > 0)
|
||||||
|
@ -714,14 +654,8 @@ const char *getSavegameFile(int saveGameIdx) {
|
||||||
|
|
||||||
void GameLoader::restoreDefPicAniInfos() {
|
void GameLoader::restoreDefPicAniInfos() {
|
||||||
for (uint i = 0; i < _sc2array.size(); i++) {
|
for (uint i = 0; i < _sc2array.size(); i++) {
|
||||||
if (_sc2array[i]._picAniInfos) {
|
|
||||||
free(_sc2array[i]._picAniInfos);
|
|
||||||
_sc2array[i]._picAniInfos = 0;
|
|
||||||
_sc2array[i]._picAniInfosCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_sc2array[i]._scene)
|
if (_sc2array[i]._scene)
|
||||||
applyPicAniInfos(_sc2array[i]._scene, _sc2array[i]._defPicAniInfos, _sc2array[i]._defPicAniInfosCount);
|
applyPicAniInfos(_sc2array[i]._scene, _sc2array[i]._defPicAniInfos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,19 +46,17 @@ class Sc2 : public CObject {
|
||||||
int16 _sceneId;
|
int16 _sceneId;
|
||||||
int16 _field_2;
|
int16 _field_2;
|
||||||
Scene *_scene;
|
Scene *_scene;
|
||||||
|
/** owned */
|
||||||
MotionController *_motionController;
|
MotionController *_motionController;
|
||||||
int32 *_data1; // FIXME, could be a struct
|
Common::Array<int32> _data1; // FIXME, could be a struct
|
||||||
int _count1;
|
PicAniInfoList _defPicAniInfos;
|
||||||
PicAniInfo **_defPicAniInfos;
|
PicAniInfoList _picAniInfos;
|
||||||
int _defPicAniInfosCount;
|
bool _isLoaded;
|
||||||
PicAniInfo **_picAniInfos;
|
Common::Array<EntranceInfo> _entranceData;
|
||||||
int _picAniInfosCount;
|
|
||||||
int _isLoaded;
|
|
||||||
EntranceInfo **_entranceData;
|
|
||||||
int _entranceDataCount;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Sc2();
|
Sc2();
|
||||||
|
virtual ~Sc2();
|
||||||
virtual bool load(MfcArchive &file);
|
virtual bool load(MfcArchive &file);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -112,9 +110,9 @@ class GameLoader : public CObject {
|
||||||
void updateSystems(int counterdiff);
|
void updateSystems(int counterdiff);
|
||||||
|
|
||||||
int getSceneTagBySceneId(int sceneId, SceneTag **st);
|
int getSceneTagBySceneId(int sceneId, SceneTag **st);
|
||||||
void applyPicAniInfos(Scene *sc, PicAniInfo **picAniInfo, int picAniInfoCount);
|
void applyPicAniInfos(Scene *sc, const PicAniInfoList &picAniInfo);
|
||||||
void saveScenePicAniInfos(int sceneId);
|
void saveScenePicAniInfos(int sceneId);
|
||||||
PicAniInfo **savePicAniInfos(Scene *sc, int flag1, int flag2, int *picAniInfoCount);
|
PicAniInfoList savePicAniInfos(Scene *sc, int flag1, int flag2);
|
||||||
|
|
||||||
bool readSavegame(const char *fname);
|
bool readSavegame(const char *fname);
|
||||||
bool writeSavegame(Scene *sc, const char *fname);
|
bool writeSavegame(Scene *sc, const char *fname);
|
||||||
|
|
|
@ -189,19 +189,17 @@ void PictureObject::drawAt(int x, int y) {
|
||||||
_picture->draw(x, y, 0, 0);
|
_picture->draw(x, y, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PictureObject::setPicAniInfo(PicAniInfo *picAniInfo) {
|
bool PictureObject::setPicAniInfo(const PicAniInfo &picAniInfo) {
|
||||||
if (!(picAniInfo->type & 2) || (picAniInfo->type & 1)) {
|
if (!(picAniInfo.type & 2) || (picAniInfo.type & 1)) {
|
||||||
error("PictureObject::setPicAniInfo(): Wrong type: %d", picAniInfo->type);
|
error("PictureObject::setPicAniInfo(): Wrong type: %d", picAniInfo.type);
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (picAniInfo->type & 2) {
|
if (picAniInfo.type & 2) {
|
||||||
setOXY(picAniInfo->ox, picAniInfo->oy);
|
setOXY(picAniInfo.ox, picAniInfo.oy);
|
||||||
_priority = picAniInfo->priority;
|
_priority = picAniInfo.priority;
|
||||||
_odelay = picAniInfo->field_8;
|
_odelay = picAniInfo.field_8;
|
||||||
setFlags(picAniInfo->flags);
|
setFlags(picAniInfo.flags);
|
||||||
_field_8 = picAniInfo->field_24;
|
_field_8 = picAniInfo.field_24;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -332,17 +330,17 @@ void GameObject::renumPictures(Common::Array<PictureObject *> *lst) {
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameObject::getPicAniInfo(PicAniInfo *info) {
|
bool GameObject::getPicAniInfo(PicAniInfo &info) {
|
||||||
if (_objtype == kObjTypePictureObject) {
|
if (_objtype == kObjTypePictureObject) {
|
||||||
info->type = 2;
|
info.type = 2;
|
||||||
info->objectId = _id;
|
info.objectId = _id;
|
||||||
info->sceneId = 0;
|
info.sceneId = 0;
|
||||||
info->field_8 = _odelay;
|
info.field_8 = _odelay;
|
||||||
info->flags = _flags;
|
info.flags = _flags;
|
||||||
info->field_24 = _field_8;
|
info.field_24 = _field_8;
|
||||||
info->ox = _ox;
|
info.ox = _ox;
|
||||||
info->oy = _oy;
|
info.oy = _oy;
|
||||||
info->priority = _priority;
|
info.priority = _priority;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -350,30 +348,30 @@ bool GameObject::getPicAniInfo(PicAniInfo *info) {
|
||||||
if (_objtype == kObjTypeStaticANIObject) {
|
if (_objtype == kObjTypeStaticANIObject) {
|
||||||
StaticANIObject *ani = static_cast<StaticANIObject *>(this);
|
StaticANIObject *ani = static_cast<StaticANIObject *>(this);
|
||||||
|
|
||||||
info->type = (ani->_messageQueueId << 16) | 1;
|
info.type = (ani->_messageQueueId << 16) | 1;
|
||||||
info->objectId = ani->_id;
|
info.objectId = ani->_id;
|
||||||
info->field_8 = ani->_odelay;
|
info.field_8 = ani->_odelay;
|
||||||
info->sceneId = ani->_sceneId;
|
info.sceneId = ani->_sceneId;
|
||||||
info->flags = ani->_flags;
|
info.flags = ani->_flags;
|
||||||
info->field_24 = ani->_field_8;
|
info.field_24 = ani->_field_8;
|
||||||
if (ani->_movement) {
|
if (ani->_movement) {
|
||||||
info->ox = ani->_movement->_ox;
|
info.ox = ani->_movement->_ox;
|
||||||
info->oy = ani->_movement->_oy;
|
info.oy = ani->_movement->_oy;
|
||||||
} else {
|
} else {
|
||||||
info->ox = ani->_ox;
|
info.ox = ani->_ox;
|
||||||
info->oy = ani->_oy;
|
info.oy = ani->_oy;
|
||||||
}
|
}
|
||||||
info->priority = ani->_priority;
|
info.priority = ani->_priority;
|
||||||
|
|
||||||
if (ani->_statics)
|
if (ani->_statics)
|
||||||
info->staticsId = ani->_statics->_staticsId;
|
info.staticsId = ani->_statics->_staticsId;
|
||||||
|
|
||||||
if (ani->_movement) {
|
if (ani->_movement) {
|
||||||
info->movementId = ani->_movement->_id;
|
info.movementId = ani->_movement->_id;
|
||||||
info->dynamicPhaseIndex = ani->_movement->_currDynamicPhaseIndex;
|
info.dynamicPhaseIndex = ani->_movement->_currDynamicPhaseIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
info->someDynamicPhaseIndex = ani->_someDynamicPhaseIndex;
|
info.someDynamicPhaseIndex = ani->_someDynamicPhaseIndex;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -381,49 +379,49 @@ bool GameObject::getPicAniInfo(PicAniInfo *info) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameObject::setPicAniInfo(PicAniInfo *picAniInfo) {
|
bool GameObject::setPicAniInfo(const PicAniInfo &picAniInfo) {
|
||||||
if (!(picAniInfo->type & 3)) {
|
if (!(picAniInfo.type & 3)) {
|
||||||
warning("StaticANIObject::setPicAniInfo(): Wrong type: %d", picAniInfo->type);
|
warning("StaticANIObject::setPicAniInfo(): Wrong type: %d", picAniInfo.type);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (picAniInfo->type & 2) {
|
if (picAniInfo.type & 2) {
|
||||||
setOXY(picAniInfo->ox, picAniInfo->oy);
|
setOXY(picAniInfo.ox, picAniInfo.oy);
|
||||||
_priority = picAniInfo->priority;
|
_priority = picAniInfo.priority;
|
||||||
_odelay = picAniInfo->field_8;
|
_odelay = picAniInfo.field_8;
|
||||||
setFlags(picAniInfo->flags);
|
setFlags(picAniInfo.flags);
|
||||||
_field_8 = picAniInfo->field_24;
|
_field_8 = picAniInfo.field_24;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (picAniInfo->type & 1 && _objtype == kObjTypeStaticANIObject) {
|
if (picAniInfo.type & 1 && _objtype == kObjTypeStaticANIObject) {
|
||||||
StaticANIObject *ani = static_cast<StaticANIObject *>(this);
|
StaticANIObject *ani = static_cast<StaticANIObject *>(this);
|
||||||
|
|
||||||
ani->_messageQueueId = (picAniInfo->type >> 16) & 0xffff;
|
ani->_messageQueueId = (picAniInfo.type >> 16) & 0xffff;
|
||||||
ani->_odelay = picAniInfo->field_8;
|
ani->_odelay = picAniInfo.field_8;
|
||||||
ani->setFlags(picAniInfo->flags);
|
ani->setFlags(picAniInfo.flags);
|
||||||
ani->_field_8 = picAniInfo->field_24;
|
ani->_field_8 = picAniInfo.field_24;
|
||||||
|
|
||||||
if (picAniInfo->staticsId) {
|
if (picAniInfo.staticsId) {
|
||||||
ani->_statics = ani->getStaticsById(picAniInfo->staticsId);
|
ani->_statics = ani->getStaticsById(picAniInfo.staticsId);
|
||||||
} else {
|
} else {
|
||||||
ani->_statics = 0;
|
ani->_statics = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (picAniInfo->movementId) {
|
if (picAniInfo.movementId) {
|
||||||
ani->_movement = ani->getMovementById(picAniInfo->movementId);
|
ani->_movement = ani->getMovementById(picAniInfo.movementId);
|
||||||
if (ani->_movement)
|
if (ani->_movement)
|
||||||
ani->_movement->setDynamicPhaseIndex(picAniInfo->dynamicPhaseIndex);
|
ani->_movement->setDynamicPhaseIndex(picAniInfo.dynamicPhaseIndex);
|
||||||
} else {
|
} else {
|
||||||
ani->_movement = 0;
|
ani->_movement = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ani->setOXY(picAniInfo->ox, picAniInfo->oy);
|
ani->setOXY(picAniInfo.ox, picAniInfo.oy);
|
||||||
ani->_priority = picAniInfo->priority;
|
ani->_priority = picAniInfo.priority;
|
||||||
|
|
||||||
ani->setSomeDynamicPhaseIndex(picAniInfo->someDynamicPhaseIndex);
|
ani->setSomeDynamicPhaseIndex(picAniInfo.someDynamicPhaseIndex);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,8 +163,8 @@ class GameObject : public CObject {
|
||||||
void clearFlags() { _flags = 0; }
|
void clearFlags() { _flags = 0; }
|
||||||
Common::String getName() { return _objectName; }
|
Common::String getName() { return _objectName; }
|
||||||
|
|
||||||
bool getPicAniInfo(PicAniInfo *info);
|
bool getPicAniInfo(PicAniInfo &info);
|
||||||
bool setPicAniInfo(PicAniInfo *info);
|
bool setPicAniInfo(const PicAniInfo &info);
|
||||||
};
|
};
|
||||||
|
|
||||||
class PictureObject : public GameObject {
|
class PictureObject : public GameObject {
|
||||||
|
@ -187,7 +187,7 @@ class PictureObject : public GameObject {
|
||||||
void draw();
|
void draw();
|
||||||
void drawAt(int x, int y);
|
void drawAt(int x, int y);
|
||||||
|
|
||||||
bool setPicAniInfo(PicAniInfo *picAniInfo);
|
bool setPicAniInfo(const PicAniInfo &picAniInfo);
|
||||||
bool isPointInside(int x, int y);
|
bool isPointInside(int x, int y);
|
||||||
bool isPixelHitAtPos(int x, int y);
|
bool isPixelHitAtPos(int x, int y);
|
||||||
void setOXY2();
|
void setOXY2();
|
||||||
|
|
|
@ -129,7 +129,7 @@ bool InteractionController::handleInteraction(StaticANIObject *subj, GameObject
|
||||||
|
|
||||||
PicAniInfo aniInfo;
|
PicAniInfo aniInfo;
|
||||||
|
|
||||||
obj->getPicAniInfo(&aniInfo);
|
obj->getPicAniInfo(aniInfo);
|
||||||
|
|
||||||
if (cinter->_staticsId1 && obj->_objtype == kObjTypeStaticANIObject) {
|
if (cinter->_staticsId1 && obj->_objtype == kObjTypeStaticANIObject) {
|
||||||
StaticANIObject *ani = static_cast<StaticANIObject *>(obj);
|
StaticANIObject *ani = static_cast<StaticANIObject *>(obj);
|
||||||
|
@ -139,7 +139,7 @@ bool InteractionController::handleInteraction(StaticANIObject *subj, GameObject
|
||||||
int xpos = cinter->_xOffs + obj->_ox;
|
int xpos = cinter->_xOffs + obj->_ox;
|
||||||
int ypos = cinter->_yOffs + obj->_oy;
|
int ypos = cinter->_yOffs + obj->_oy;
|
||||||
|
|
||||||
obj->setPicAniInfo(&aniInfo);
|
obj->setPicAniInfo(aniInfo);
|
||||||
|
|
||||||
if (abs(xpos - subj->_ox) > 1 || abs(ypos - subj->_oy) > 1) {
|
if (abs(xpos - subj->_ox) > 1 || abs(ypos - subj->_oy) > 1) {
|
||||||
debugC(0, kDebugPathfinding, "Calling makeQueue() at [%d, %d]", xpos, ypos);
|
debugC(0, kDebugPathfinding, "Calling makeQueue() at [%d, %d]", xpos, ypos);
|
||||||
|
@ -298,7 +298,7 @@ LABEL_38:
|
||||||
bool someFlag = false;
|
bool someFlag = false;
|
||||||
PicAniInfo aniInfo;
|
PicAniInfo aniInfo;
|
||||||
|
|
||||||
obj->getPicAniInfo(&aniInfo);
|
obj->getPicAniInfo(aniInfo);
|
||||||
|
|
||||||
if (obj->_objtype == kObjTypeStaticANIObject && inter->_staticsId1) {
|
if (obj->_objtype == kObjTypeStaticANIObject && inter->_staticsId1) {
|
||||||
StaticANIObject *ani = static_cast<StaticANIObject *>(obj);
|
StaticANIObject *ani = static_cast<StaticANIObject *>(obj);
|
||||||
|
@ -310,7 +310,7 @@ LABEL_38:
|
||||||
int xpos = inter->_xOffs + obj->_ox;
|
int xpos = inter->_xOffs + obj->_ox;
|
||||||
int ypos = inter->_yOffs + obj->_oy;
|
int ypos = inter->_yOffs + obj->_oy;
|
||||||
|
|
||||||
obj->setPicAniInfo(&aniInfo);
|
obj->setPicAniInfo(aniInfo);
|
||||||
|
|
||||||
if (abs(xpos - subj->_ox) > 1 || abs(ypos - subj->_oy) > 1
|
if (abs(xpos - subj->_ox) > 1 || abs(ypos - subj->_oy) > 1
|
||||||
|| (inter->_staticsId2 != 0 && (subj->_statics == 0 || subj->_statics->_staticsId != inter->_staticsId2))) {
|
|| (inter->_staticsId2 != 0 && (subj->_statics == 0 || subj->_statics->_staticsId != inter->_staticsId2))) {
|
||||||
|
|
|
@ -204,9 +204,9 @@ int global_messageHandler1(ExCommand *cmd) {
|
||||||
case '8':
|
case '8':
|
||||||
{
|
{
|
||||||
int num = 32;
|
int num = 32;
|
||||||
for (int i = 0; i < g_fp->_gameLoader->_sc2array[num]._picAniInfosCount; i++) {
|
for (uint i = 0; i < g_fp->_gameLoader->_sc2array[num]._picAniInfos.size(); i++) {
|
||||||
debug("pic %d, %d:", num, i);
|
debug("pic %d, %d:", num, i);
|
||||||
g_fp->_gameLoader->_sc2array[num]._picAniInfos[i]->print();
|
g_fp->_gameLoader->_sc2array[num]._picAniInfos[i].print();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2156,10 +2156,10 @@ bool ModalSaveGame::getFileInfo(int slot, FileInfo *fileinfo) {
|
||||||
|
|
||||||
Fullpipe::parseSavegameHeader(header, desc);
|
Fullpipe::parseSavegameHeader(header, desc);
|
||||||
|
|
||||||
snprintf(res, 17, "%s %s", desc.getSaveDate().c_str(), desc.getSaveTime().c_str());
|
snprintf(res, sizeof(res), "%s %s", desc.getSaveDate().c_str(), desc.getSaveTime().c_str());
|
||||||
|
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
switch(res[i]) {
|
switch (res[i]) {
|
||||||
case '.':
|
case '.':
|
||||||
fileinfo->date[i] = 11;
|
fileinfo->date[i] = 11;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -116,7 +116,7 @@ bool MctlCompound::load(MfcArchive &file) {
|
||||||
debugC(6, kDebugLoading, "CompoundArray[%d]", i);
|
debugC(6, kDebugLoading, "CompoundArray[%d]", i);
|
||||||
MctlItem *obj = new MctlItem();
|
MctlItem *obj = new MctlItem();
|
||||||
|
|
||||||
obj->_motionControllerObj = file.readClass<MotionController>();
|
obj->_motionControllerObj.reset(file.readClass<MotionController>());
|
||||||
|
|
||||||
int count1 = file.readUint32LE();
|
int count1 = file.readUint32LE();
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ bool MctlCompound::load(MfcArchive &file) {
|
||||||
obj->_field_24 = file.readUint32LE();
|
obj->_field_24 = file.readUint32LE();
|
||||||
|
|
||||||
debugC(6, kDebugLoading, "graphReact");
|
debugC(6, kDebugLoading, "graphReact");
|
||||||
obj->_movGraphReactObj = file.readClass<MovGraphReact>();
|
obj->_movGraphReactObj.reset(file.readClass<MovGraphReact>());
|
||||||
|
|
||||||
_motionControllers.push_back(obj);
|
_motionControllers.push_back(obj);
|
||||||
}
|
}
|
||||||
|
@ -166,19 +166,14 @@ void MctlCompound::initMctlGraph() {
|
||||||
if (_motionControllers[i]->_motionControllerObj->_objtype != kObjTypeMovGraph)
|
if (_motionControllers[i]->_motionControllerObj->_objtype != kObjTypeMovGraph)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
MovGraph *gr = static_cast<MovGraph *>(_motionControllers[i]->_motionControllerObj);
|
MovGraph *gr = static_cast<MovGraph *>(_motionControllers[i]->_motionControllerObj.get());
|
||||||
|
|
||||||
MctlGraph *newgr = new MctlGraph();
|
MctlGraph *newgr = new MctlGraph();
|
||||||
|
|
||||||
newgr->_links = gr->_links;
|
newgr->_links = gr->_links;
|
||||||
newgr->_nodes = gr->_nodes;
|
newgr->_nodes = gr->_nodes;
|
||||||
|
|
||||||
gr->_links.clear();
|
_motionControllers[i]->_motionControllerObj.reset(newgr);
|
||||||
gr->_nodes.clear();
|
|
||||||
|
|
||||||
delete gr;
|
|
||||||
|
|
||||||
_motionControllers[i]->_motionControllerObj = newgr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,11 +321,6 @@ MessageQueue *MctlCompound::makeQueue(StaticANIObject *subj, int xpos, int ypos,
|
||||||
return mq;
|
return mq;
|
||||||
}
|
}
|
||||||
|
|
||||||
MctlItem::~MctlItem() {
|
|
||||||
delete _movGraphReactObj;
|
|
||||||
delete _motionControllerObj;
|
|
||||||
}
|
|
||||||
|
|
||||||
MctlLadder::MctlLadder() {
|
MctlLadder::MctlLadder() {
|
||||||
_width = 0;
|
_width = 0;
|
||||||
_ladderX = 0;
|
_ladderX = 0;
|
||||||
|
@ -490,7 +480,7 @@ MessageQueue *MctlLadder::makeQueue(StaticANIObject *ani, int xpos, int ypos, in
|
||||||
Common::Point point;
|
Common::Point point;
|
||||||
|
|
||||||
if (ani->_movement) {
|
if (ani->_movement) {
|
||||||
ani->getPicAniInfo(&picinfo);
|
ani->getPicAniInfo(picinfo);
|
||||||
|
|
||||||
int ox = ani->_ox;
|
int ox = ani->_ox;
|
||||||
int oy = ani->_oy;
|
int oy = ani->_oy;
|
||||||
|
@ -502,7 +492,7 @@ MessageQueue *MctlLadder::makeQueue(StaticANIObject *ani, int xpos, int ypos, in
|
||||||
|
|
||||||
mq = makeQueue(ani, normx, normy, fuzzyMatch, staticsId);
|
mq = makeQueue(ani, normx, normy, fuzzyMatch, staticsId);
|
||||||
|
|
||||||
ani->setPicAniInfo(&picinfo);
|
ani->setPicAniInfo(picinfo);
|
||||||
|
|
||||||
return mq;
|
return mq;
|
||||||
}
|
}
|
||||||
|
@ -588,7 +578,7 @@ MessageQueue *MctlLadder::makeQueue(StaticANIObject *ani, int xpos, int ypos, in
|
||||||
nx += point.x;
|
nx += point.x;
|
||||||
ny += point.y;
|
ny += point.y;
|
||||||
|
|
||||||
ani->getPicAniInfo(&picinfo);
|
ani->getPicAniInfo(picinfo);
|
||||||
|
|
||||||
ani->_statics = ani->getStaticsById(_ladmovements[pos]->staticIds[0]);
|
ani->_statics = ani->getStaticsById(_ladmovements[pos]->staticIds[0]);
|
||||||
ani->_movement = 0;
|
ani->_movement = 0;
|
||||||
|
@ -600,7 +590,7 @@ MessageQueue *MctlLadder::makeQueue(StaticANIObject *ani, int xpos, int ypos, in
|
||||||
|
|
||||||
delete newmq;
|
delete newmq;
|
||||||
|
|
||||||
ani->setPicAniInfo(&picinfo);
|
ani->setPicAniInfo(picinfo);
|
||||||
|
|
||||||
return mq;
|
return mq;
|
||||||
}
|
}
|
||||||
|
@ -701,7 +691,7 @@ MctlConnectionPoint *MctlCompound::findClosestConnectionPoint(int ox, int oy, in
|
||||||
void MctlCompound::replaceNodeX(int from, int to) {
|
void MctlCompound::replaceNodeX(int from, int to) {
|
||||||
for (uint i = 0; i < _motionControllers.size(); i++) {
|
for (uint i = 0; i < _motionControllers.size(); i++) {
|
||||||
if (_motionControllers[i]->_motionControllerObj->_objtype == kObjTypeMovGraph) {
|
if (_motionControllers[i]->_motionControllerObj->_objtype == kObjTypeMovGraph) {
|
||||||
MovGraph *gr = static_cast<MovGraph *>(_motionControllers[i]->_motionControllerObj);
|
MovGraph *gr = static_cast<MovGraph *>(_motionControllers[i]->_motionControllerObj.get());
|
||||||
|
|
||||||
for (MovGraph::NodeList::iterator n = gr->_nodes.begin(); n != gr->_nodes.end(); ++n) {
|
for (MovGraph::NodeList::iterator n = gr->_nodes.begin(); n != gr->_nodes.end(); ++n) {
|
||||||
MovGraphNode *node = static_cast<MovGraphNode *>(*n);
|
MovGraphNode *node = static_cast<MovGraphNode *>(*n);
|
||||||
|
@ -721,12 +711,6 @@ MctlConnectionPoint::MctlConnectionPoint() {
|
||||||
_mctlflags = 0;
|
_mctlflags = 0;
|
||||||
_mctlstatic = 0;
|
_mctlstatic = 0;
|
||||||
_mctlmirror = 0;
|
_mctlmirror = 0;
|
||||||
_messageQueueObj = 0;
|
|
||||||
_motionControllerObj = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
MctlConnectionPoint::~MctlConnectionPoint() {
|
|
||||||
delete _messageQueueObj;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MctlMQ::MctlMQ(MctlMQ *src) {
|
MctlMQ::MctlMQ(MctlMQ *src) {
|
||||||
|
@ -755,6 +739,10 @@ void MctlMQ::clear() {
|
||||||
flags = 0;
|
flags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MctlItem::~MctlItem() {
|
||||||
|
Common::for_each(_connectionPoints.begin(), _connectionPoints.end(), Common::DefaultDeleter<MctlConnectionPoint>());
|
||||||
|
}
|
||||||
|
|
||||||
bool MctlCompoundArray::load(MfcArchive &file) {
|
bool MctlCompoundArray::load(MfcArchive &file) {
|
||||||
debugC(5, kDebugLoading, "MctlCompoundArray::load()");
|
debugC(5, kDebugLoading, "MctlCompoundArray::load()");
|
||||||
|
|
||||||
|
@ -1089,7 +1077,7 @@ MessageQueue *MovGraph::makeQueue(StaticANIObject *subj, int xpos, int ypos, int
|
||||||
|
|
||||||
Common::Array<MovItem *> *movitem = getPaths(subj, xpos, ypos, fuzzyMatch, &ss);
|
Common::Array<MovItem *> *movitem = getPaths(subj, xpos, ypos, fuzzyMatch, &ss);
|
||||||
|
|
||||||
subj->getPicAniInfo(&picAniInfo);
|
subj->getPicAniInfo(picAniInfo);
|
||||||
|
|
||||||
if (movitem) {
|
if (movitem) {
|
||||||
MovArr *goal = _callback1(subj, movitem, ss);
|
MovArr *goal = _callback1(subj, movitem, ss);
|
||||||
|
@ -1130,7 +1118,7 @@ MessageQueue *MovGraph::makeQueue(StaticANIObject *subj, int xpos, int ypos, int
|
||||||
arridx++;
|
arridx++;
|
||||||
|
|
||||||
if (arridx >= _items[idx].count) {
|
if (arridx >= _items[idx].count) {
|
||||||
subj->setPicAniInfo(&picAniInfo);
|
subj->setPicAniInfo(picAniInfo);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1150,13 +1138,13 @@ MessageQueue *MovGraph::makeQueue(StaticANIObject *subj, int xpos, int ypos, int
|
||||||
ex->_field_3C = 1;
|
ex->_field_3C = 1;
|
||||||
mq->addExCommandToEnd(ex);
|
mq->addExCommandToEnd(ex);
|
||||||
}
|
}
|
||||||
subj->setPicAniInfo(&picAniInfo);
|
subj->setPicAniInfo(picAniInfo);
|
||||||
|
|
||||||
return mq;
|
return mq;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subj->setPicAniInfo(&picAniInfo);
|
subj->setPicAniInfo(picAniInfo);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1166,7 +1154,7 @@ MessageQueue *MovGraph::sub1(StaticANIObject *ani, int x, int y, int stid, int x
|
||||||
|
|
||||||
PicAniInfo picinfo;
|
PicAniInfo picinfo;
|
||||||
|
|
||||||
ani->getPicAniInfo(&picinfo);
|
ani->getPicAniInfo(picinfo);
|
||||||
|
|
||||||
ani->_statics = ani->getStaticsById(stid);
|
ani->_statics = ani->getStaticsById(stid);
|
||||||
ani->_movement = 0;
|
ani->_movement = 0;
|
||||||
|
@ -1177,7 +1165,7 @@ MessageQueue *MovGraph::sub1(StaticANIObject *ani, int x, int y, int stid, int x
|
||||||
Common::Array<MovItem *> *movitems = getPaths(ani, x1, y1, flag1, &rescount);
|
Common::Array<MovItem *> *movitems = getPaths(ani, x1, y1, flag1, &rescount);
|
||||||
|
|
||||||
if (!movitems) {
|
if (!movitems) {
|
||||||
ani->setPicAniInfo(&picinfo);
|
ani->setPicAniInfo(picinfo);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1204,7 +1192,7 @@ MessageQueue *MovGraph::sub1(StaticANIObject *ani, int x, int y, int stid, int x
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ani->setPicAniInfo(&picinfo);
|
ani->setPicAniInfo(picinfo);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -2162,11 +2150,11 @@ MessageQueue *MctlGraph::startMove(StaticANIObject *ani, int xpos, int ypos, int
|
||||||
if (mq->getCount() <= 1 || mq->getExCommandByIndex(0)->_messageKind != 22) {
|
if (mq->getCount() <= 1 || mq->getExCommandByIndex(0)->_messageKind != 22) {
|
||||||
PicAniInfo picAniInfo;
|
PicAniInfo picAniInfo;
|
||||||
|
|
||||||
ani->getPicAniInfo(&picAniInfo);
|
ani->getPicAniInfo(picAniInfo);
|
||||||
ani->updateStepPos();
|
ani->updateStepPos();
|
||||||
MessageQueue *mq1 = makeQueue(ani, xpos, ypos, fuzzyMatch, staticsId);
|
MessageQueue *mq1 = makeQueue(ani, xpos, ypos, fuzzyMatch, staticsId);
|
||||||
|
|
||||||
ani->setPicAniInfo(&picAniInfo);
|
ani->setPicAniInfo(picAniInfo);
|
||||||
|
|
||||||
if (mq1) {
|
if (mq1) {
|
||||||
delete mq;
|
delete mq;
|
||||||
|
@ -2209,7 +2197,7 @@ MessageQueue *MctlGraph::makeQueue(StaticANIObject *obj, int xpos, int ypos, int
|
||||||
|
|
||||||
point.x = 0;
|
point.x = 0;
|
||||||
|
|
||||||
obj->getPicAniInfo(&picAniInfo);
|
obj->getPicAniInfo(picAniInfo);
|
||||||
|
|
||||||
int idxsub;
|
int idxsub;
|
||||||
|
|
||||||
|
@ -2260,7 +2248,7 @@ MessageQueue *MctlGraph::makeQueue(StaticANIObject *obj, int xpos, int ypos, int
|
||||||
if (staticsId && obj->_statics->_staticsId != staticsId) {
|
if (staticsId && obj->_statics->_staticsId != staticsId) {
|
||||||
int idxwalk = getDirByStatics(idx, staticsId);
|
int idxwalk = getDirByStatics(idx, staticsId);
|
||||||
if (idxwalk == -1) {
|
if (idxwalk == -1) {
|
||||||
obj->setPicAniInfo(&picAniInfo);
|
obj->setPicAniInfo(picAniInfo);
|
||||||
|
|
||||||
delete mq;
|
delete mq;
|
||||||
|
|
||||||
|
@ -2289,7 +2277,7 @@ MessageQueue *MctlGraph::makeQueue(StaticANIObject *obj, int xpos, int ypos, int
|
||||||
mq->addExCommandToEnd(ex);
|
mq->addExCommandToEnd(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
obj->setPicAniInfo(&picAniInfo);
|
obj->setPicAniInfo(picAniInfo);
|
||||||
|
|
||||||
return mq;
|
return mq;
|
||||||
}
|
}
|
||||||
|
@ -2303,7 +2291,7 @@ MessageQueue *MctlGraph::makeQueue(StaticANIObject *obj, int xpos, int ypos, int
|
||||||
linkInfoSource.link = getNearestLink(obj->_ox, obj->_oy);
|
linkInfoSource.link = getNearestLink(obj->_ox, obj->_oy);
|
||||||
|
|
||||||
if (!linkInfoSource.link) {
|
if (!linkInfoSource.link) {
|
||||||
obj->setPicAniInfo(&picAniInfo);
|
obj->setPicAniInfo(picAniInfo);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2316,7 +2304,7 @@ MessageQueue *MctlGraph::makeQueue(StaticANIObject *obj, int xpos, int ypos, int
|
||||||
linkInfoDest.link = getHitLink(xpos, ypos, idxsub, fuzzyMatch);
|
linkInfoDest.link = getHitLink(xpos, ypos, idxsub, fuzzyMatch);
|
||||||
|
|
||||||
if (!linkInfoDest.link) {
|
if (!linkInfoDest.link) {
|
||||||
obj->setPicAniInfo(&picAniInfo);
|
obj->setPicAniInfo(picAniInfo);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2424,7 +2412,7 @@ MessageQueue *MctlGraph::makeQueue(StaticANIObject *obj, int xpos, int ypos, int
|
||||||
mq = 0;
|
mq = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj->setPicAniInfo(&picAniInfo);
|
obj->setPicAniInfo(picAniInfo);
|
||||||
|
|
||||||
return mq;
|
return mq;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,15 +84,15 @@ public:
|
||||||
|
|
||||||
class MctlItem : public CObject {
|
class MctlItem : public CObject {
|
||||||
public:
|
public:
|
||||||
MotionController *_motionControllerObj;
|
Common::ScopedPtr<MotionController> _motionControllerObj;
|
||||||
MovGraphReact *_movGraphReactObj;
|
Common::ScopedPtr<MovGraphReact> _movGraphReactObj;
|
||||||
Common::Array<MctlConnectionPoint *> _connectionPoints;
|
Common::Array<MctlConnectionPoint *> _connectionPoints;
|
||||||
int _field_20;
|
int _field_20;
|
||||||
int _field_24;
|
int _field_24;
|
||||||
int _field_28;
|
int _field_28;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MctlItem() : _movGraphReactObj(0), _motionControllerObj(0), _field_20(0), _field_24(0), _field_28(0) {}
|
MctlItem() : _field_20(0), _field_24(0), _field_28(0) {}
|
||||||
~MctlItem();
|
~MctlItem();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ public:
|
||||||
void replaceNodeX(int from, int to);
|
void replaceNodeX(int from, int to);
|
||||||
|
|
||||||
uint getMotionControllerCount() { return _motionControllers.size(); }
|
uint getMotionControllerCount() { return _motionControllers.size(); }
|
||||||
MotionController *getMotionController(int num) { return _motionControllers[num]->_motionControllerObj; }
|
MotionController *getMotionController(int num) { return _motionControllers[num]->_motionControllerObj.get(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MctlLadderMovementVars {
|
struct MctlLadderMovementVars {
|
||||||
|
@ -414,11 +414,10 @@ public:
|
||||||
int _mctlflags;
|
int _mctlflags;
|
||||||
int _mctlstatic;
|
int _mctlstatic;
|
||||||
int16 _mctlmirror;
|
int16 _mctlmirror;
|
||||||
MessageQueue *_messageQueueObj;
|
Common::ScopedPtr<MessageQueue> _messageQueueObj;
|
||||||
int _motionControllerObj;
|
int _motionControllerObj;
|
||||||
|
|
||||||
MctlConnectionPoint();
|
MctlConnectionPoint();
|
||||||
~MctlConnectionPoint();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End of namespace Fullpipe
|
} // End of namespace Fullpipe
|
||||||
|
|
|
@ -66,6 +66,7 @@ struct PicAniInfo {
|
||||||
|
|
||||||
PicAniInfo() { memset(this, 0, sizeof(PicAniInfo)); }
|
PicAniInfo() { memset(this, 0, sizeof(PicAniInfo)); }
|
||||||
};
|
};
|
||||||
|
typedef Common::Array<PicAniInfo> PicAniInfoList;
|
||||||
|
|
||||||
union VarValue {
|
union VarValue {
|
||||||
float floatValue;
|
float floatValue;
|
||||||
|
|
|
@ -530,11 +530,11 @@ void FullpipeEngine::sceneAutoScrolling() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
|
bool FullpipeEngine::sceneSwitcher(const EntranceInfo &entrance) {
|
||||||
GameVar *sceneVar;
|
GameVar *sceneVar;
|
||||||
Common::Point sceneDim;
|
Common::Point sceneDim;
|
||||||
|
|
||||||
Scene *scene = accessScene(entrance->_sceneId);
|
Scene *scene = accessScene(entrance._sceneId);
|
||||||
|
|
||||||
if (!scene)
|
if (!scene)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -563,7 +563,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
|
||||||
_updateFlag = true;
|
_updateFlag = true;
|
||||||
_flgCanOpenMap = true;
|
_flgCanOpenMap = true;
|
||||||
|
|
||||||
if (entrance->_sceneId == SC_DBGMENU) {
|
if (entrance._sceneId == SC_DBGMENU) {
|
||||||
_inventoryScene = 0;
|
_inventoryScene = 0;
|
||||||
} else {
|
} else {
|
||||||
_gameLoader->loadScene(SC_INV);
|
_gameLoader->loadScene(SC_INV);
|
||||||
|
@ -594,7 +594,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
|
||||||
_aniMan->setOXY(0, 0);
|
_aniMan->setOXY(0, 0);
|
||||||
|
|
||||||
_aniMan2 = _aniMan;
|
_aniMan2 = _aniMan;
|
||||||
MctlCompound *cmp = getSc2MctlCompoundBySceneId(entrance->_sceneId);
|
MctlCompound *cmp = getSc2MctlCompoundBySceneId(entrance._sceneId);
|
||||||
cmp->initMctlGraph();
|
cmp->initMctlGraph();
|
||||||
cmp->attachObject(_aniMan);
|
cmp->attachObject(_aniMan);
|
||||||
cmp->activate();
|
cmp->activate();
|
||||||
|
@ -612,7 +612,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
|
||||||
removeMessageHandler(2, -1);
|
removeMessageHandler(2, -1);
|
||||||
_updateScreenCallback = 0;
|
_updateScreenCallback = 0;
|
||||||
|
|
||||||
switch (entrance->_sceneId) {
|
switch (entrance._sceneId) {
|
||||||
case SC_INTRO1:
|
case SC_INTRO1:
|
||||||
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_INTRO1");
|
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_INTRO1");
|
||||||
scene->preloadMovements(sceneVar);
|
scene->preloadMovements(sceneVar);
|
||||||
|
@ -639,7 +639,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
|
||||||
scene01_fixEntrance();
|
scene01_fixEntrance();
|
||||||
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_1");
|
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_1");
|
||||||
scene->preloadMovements(sceneVar);
|
scene->preloadMovements(sceneVar);
|
||||||
scene01_initScene(scene, entrance->_field_4);
|
scene01_initScene(scene, entrance._field_4);
|
||||||
_behaviorManager->initBehavior(scene, sceneVar);
|
_behaviorManager->initBehavior(scene, sceneVar);
|
||||||
scene->initObjectCursors("SC_1");
|
scene->initObjectCursors("SC_1");
|
||||||
setSceneMusicParameters(sceneVar);
|
setSceneMusicParameters(sceneVar);
|
||||||
|
@ -854,7 +854,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
|
||||||
|
|
||||||
scene18_initScene2(g_fp->_scene3);
|
scene18_initScene2(g_fp->_scene3);
|
||||||
scene18_preload();
|
scene18_preload();
|
||||||
scene19_setMovements(g_fp->_scene3, entrance->_field_4);
|
scene19_setMovements(g_fp->_scene3, entrance._field_4);
|
||||||
|
|
||||||
g_vars->scene18_inScene18p1 = true;
|
g_vars->scene18_inScene18p1 = true;
|
||||||
}
|
}
|
||||||
|
@ -938,12 +938,12 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
|
||||||
case SC_25:
|
case SC_25:
|
||||||
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_25");
|
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_25");
|
||||||
scene->preloadMovements(sceneVar);
|
scene->preloadMovements(sceneVar);
|
||||||
scene25_initScene(scene, entrance->_field_4);
|
scene25_initScene(scene, entrance._field_4);
|
||||||
_behaviorManager->initBehavior(scene, sceneVar);
|
_behaviorManager->initBehavior(scene, sceneVar);
|
||||||
scene->initObjectCursors("SC_25");
|
scene->initObjectCursors("SC_25");
|
||||||
setSceneMusicParameters(sceneVar);
|
setSceneMusicParameters(sceneVar);
|
||||||
addMessageHandler(sceneHandler25, 2);
|
addMessageHandler(sceneHandler25, 2);
|
||||||
scene25_setupWater(scene, entrance->_field_4);
|
scene25_setupWater(scene, entrance._field_4);
|
||||||
_updateCursorCallback = scene25_updateCursor;
|
_updateCursorCallback = scene25_updateCursor;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -995,7 +995,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
|
||||||
case SC_30:
|
case SC_30:
|
||||||
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_30");
|
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_30");
|
||||||
scene->preloadMovements(sceneVar);
|
scene->preloadMovements(sceneVar);
|
||||||
scene30_initScene(scene, entrance->_field_4);
|
scene30_initScene(scene, entrance._field_4);
|
||||||
_behaviorManager->initBehavior(scene, sceneVar);
|
_behaviorManager->initBehavior(scene, sceneVar);
|
||||||
scene->initObjectCursors("SC_30");
|
scene->initObjectCursors("SC_30");
|
||||||
setSceneMusicParameters(sceneVar);
|
setSceneMusicParameters(sceneVar);
|
||||||
|
@ -1115,7 +1115,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
error("Unknown scene %d", entrance->_sceneId);
|
error("Unknown scene %d", entrance._sceneId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,8 +97,8 @@ void scene04_initScene(Scene *sc) {
|
||||||
for (uint i = 0; i < kozsize; i++) {
|
for (uint i = 0; i < kozsize; i++) {
|
||||||
kozmov->setDynamicPhaseIndex(i);
|
kozmov->setDynamicPhaseIndex(i);
|
||||||
|
|
||||||
if (kozmov->_framePosOffsets) {
|
if (kozmov->_framePosOffsets.size()) {
|
||||||
g_vars->scene04_jumpingKozyawki[i] = *kozmov->_framePosOffsets[kozmov->_currDynamicPhaseIndex];
|
g_vars->scene04_jumpingKozyawki[i] = kozmov->_framePosOffsets[kozmov->_currDynamicPhaseIndex];
|
||||||
} else {
|
} else {
|
||||||
kozmov->_somePoint.x = 0;
|
kozmov->_somePoint.x = 0;
|
||||||
kozmov->_somePoint.y = 0;
|
kozmov->_somePoint.y = 0;
|
||||||
|
@ -114,8 +114,8 @@ void scene04_initScene(Scene *sc) {
|
||||||
for (uint i = 0; i < kozsize; i++) {
|
for (uint i = 0; i < kozsize; i++) {
|
||||||
kozmov->setDynamicPhaseIndex(i);
|
kozmov->setDynamicPhaseIndex(i);
|
||||||
|
|
||||||
if (kozmov->_framePosOffsets) {
|
if (kozmov->_framePosOffsets.size()) {
|
||||||
g_vars->scene04_jumpRotateKozyawki[i] = *kozmov->_framePosOffsets[kozmov->_currDynamicPhaseIndex];
|
g_vars->scene04_jumpRotateKozyawki[i] = kozmov->_framePosOffsets[kozmov->_currDynamicPhaseIndex];
|
||||||
} else {
|
} else {
|
||||||
kozmov->_somePoint.x = 0;
|
kozmov->_somePoint.x = 0;
|
||||||
kozmov->_somePoint.y = 0;
|
kozmov->_somePoint.y = 0;
|
||||||
|
@ -747,8 +747,8 @@ void sceneHandler04_kozMove(Movement *mov, int from, int to, Common::Point *poin
|
||||||
mov->setDynamicPhaseIndex(i);
|
mov->setDynamicPhaseIndex(i);
|
||||||
|
|
||||||
Common::Point *p;
|
Common::Point *p;
|
||||||
if (mov->_framePosOffsets) {
|
if (mov->_framePosOffsets.size()) {
|
||||||
p = mov->_framePosOffsets[mov->_currDynamicPhaseIndex];
|
p = &mov->_framePosOffsets[mov->_currDynamicPhaseIndex];
|
||||||
} else {
|
} else {
|
||||||
p = &mov->_somePoint;
|
p = &mov->_somePoint;
|
||||||
p->x = 0;
|
p->x = 0;
|
||||||
|
|
|
@ -190,14 +190,14 @@ void sceneHandler09_spitterClick() {
|
||||||
if (g_vars->scene09_spitter->_flags & 4) {
|
if (g_vars->scene09_spitter->_flags & 4) {
|
||||||
PicAniInfo info;
|
PicAniInfo info;
|
||||||
|
|
||||||
g_vars->scene09_spitter->getPicAniInfo(&info);
|
g_vars->scene09_spitter->getPicAniInfo(info);
|
||||||
g_vars->scene09_spitter->_messageQueueId = 0;
|
g_vars->scene09_spitter->_messageQueueId = 0;
|
||||||
g_vars->scene09_spitter->changeStatics2(ST_PLV_SIT);
|
g_vars->scene09_spitter->changeStatics2(ST_PLV_SIT);
|
||||||
|
|
||||||
int x = g_vars->scene09_spitter->_ox - 10;
|
int x = g_vars->scene09_spitter->_ox - 10;
|
||||||
int y = g_vars->scene09_spitter->_oy + 145;
|
int y = g_vars->scene09_spitter->_oy + 145;
|
||||||
|
|
||||||
g_vars->scene09_spitter->setPicAniInfo(&info);
|
g_vars->scene09_spitter->setPicAniInfo(info);
|
||||||
|
|
||||||
if (ABS(x - g_fp->_aniMan->_ox) > 1 || ABS(y - g_fp->_aniMan->_oy) > 1) {
|
if (ABS(x - g_fp->_aniMan->_ox) > 1 || ABS(y - g_fp->_aniMan->_oy) > 1) {
|
||||||
MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_fp->_aniMan, x, y, 1, ST_MAN_UP);
|
MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_fp->_aniMan, x, y, 1, ST_MAN_UP);
|
||||||
|
|
|
@ -217,9 +217,9 @@ void scene18_initScene1(Scene *sc) {
|
||||||
g_vars->scene18_girlJumpY += newy;
|
g_vars->scene18_girlJumpY += newy;
|
||||||
|
|
||||||
for (uint i = 0; i < g_vars->scene18_swingers.size(); i++) {
|
for (uint i = 0; i < g_vars->scene18_swingers.size(); i++) {
|
||||||
g_vars->scene18_swingers[i]->ani->getPicAniInfo(&info);
|
g_vars->scene18_swingers[i]->ani->getPicAniInfo(info);
|
||||||
sc->addStaticANIObject(g_vars->scene18_swingers[i]->ani, 1);
|
sc->addStaticANIObject(g_vars->scene18_swingers[i]->ani, 1);
|
||||||
g_vars->scene18_swingers[i]->ani->setPicAniInfo(&info);
|
g_vars->scene18_swingers[i]->ani->setPicAniInfo(info);
|
||||||
|
|
||||||
g_vars->scene18_swingers[i]->sx += newx;
|
g_vars->scene18_swingers[i]->sx += newx;
|
||||||
g_vars->scene18_swingers[i]->sy += newy;
|
g_vars->scene18_swingers[i]->sy += newy;
|
||||||
|
@ -257,9 +257,9 @@ void scene18_initScene1(Scene *sc) {
|
||||||
|
|
||||||
g_fp->playSound(sndid, 1);
|
g_fp->playSound(sndid, 1);
|
||||||
|
|
||||||
g_vars->scene18_boy->getPicAniInfo(&info);
|
g_vars->scene18_boy->getPicAniInfo(info);
|
||||||
sc->addStaticANIObject(g_vars->scene18_boy, 1);
|
sc->addStaticANIObject(g_vars->scene18_boy, 1);
|
||||||
g_vars->scene18_boy->setPicAniInfo(&info);
|
g_vars->scene18_boy->setPicAniInfo(info);
|
||||||
|
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
|
@ -273,9 +273,9 @@ void scene18_initScene1(Scene *sc) {
|
||||||
|
|
||||||
g_vars->scene18_boy->setOXY(newx + x, newy + y);
|
g_vars->scene18_boy->setOXY(newx + x, newy + y);
|
||||||
|
|
||||||
g_vars->scene18_girl->getPicAniInfo(&info);
|
g_vars->scene18_girl->getPicAniInfo(info);
|
||||||
sc->addStaticANIObject(g_vars->scene18_girl, 1);
|
sc->addStaticANIObject(g_vars->scene18_girl, 1);
|
||||||
g_vars->scene18_girl->setPicAniInfo(&info);
|
g_vars->scene18_girl->setPicAniInfo(info);
|
||||||
|
|
||||||
if (g_vars->scene18_girl->_movement) {
|
if (g_vars->scene18_girl->_movement) {
|
||||||
x = g_vars->scene18_girl->_movement->_ox;
|
x = g_vars->scene18_girl->_movement->_ox;
|
||||||
|
|
|
@ -161,14 +161,14 @@ void sceneHandler25_enterMan() {
|
||||||
void sceneHandler25_enterTruba() {
|
void sceneHandler25_enterTruba() {
|
||||||
PicAniInfo info;
|
PicAniInfo info;
|
||||||
|
|
||||||
g_fp->_aniMan->getPicAniInfo(&info);
|
g_fp->_aniMan->getPicAniInfo(info);
|
||||||
g_fp->_aniMan->_messageQueueId = 0;
|
g_fp->_aniMan->_messageQueueId = 0;
|
||||||
g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_statics->_staticsId);
|
g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_statics->_staticsId);
|
||||||
|
|
||||||
int x = g_fp->_aniMan->_ox;
|
int x = g_fp->_aniMan->_ox;
|
||||||
int y = g_fp->_aniMan->_oy;
|
int y = g_fp->_aniMan->_oy;
|
||||||
|
|
||||||
g_fp->_aniMan->setPicAniInfo(&info);
|
g_fp->_aniMan->setPicAniInfo(info);
|
||||||
|
|
||||||
int id = g_fp->_aniMan->_statics->_staticsId;
|
int id = g_fp->_aniMan->_statics->_staticsId;
|
||||||
int qid = 0;
|
int qid = 0;
|
||||||
|
@ -196,14 +196,14 @@ void sceneHandler25_saveEntrance(int value) {
|
||||||
void sceneHandler25_toLadder() {
|
void sceneHandler25_toLadder() {
|
||||||
PicAniInfo info;
|
PicAniInfo info;
|
||||||
|
|
||||||
g_fp->_aniMan->getPicAniInfo(&info);
|
g_fp->_aniMan->getPicAniInfo(info);
|
||||||
g_fp->_aniMan->_messageQueueId = 0;
|
g_fp->_aniMan->_messageQueueId = 0;
|
||||||
g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_statics->_staticsId);
|
g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_statics->_staticsId);
|
||||||
|
|
||||||
int x = g_fp->_aniMan->_ox;
|
int x = g_fp->_aniMan->_ox;
|
||||||
int y = g_fp->_aniMan->_oy;
|
int y = g_fp->_aniMan->_oy;
|
||||||
|
|
||||||
g_fp->_aniMan->setPicAniInfo(&info);
|
g_fp->_aniMan->setPicAniInfo(info);
|
||||||
|
|
||||||
int id = g_fp->_aniMan->_statics->_staticsId;
|
int id = g_fp->_aniMan->_statics->_staticsId;
|
||||||
int qid = 0;
|
int qid = 0;
|
||||||
|
@ -275,14 +275,14 @@ void sceneHandler25_sneeze() {
|
||||||
void sceneHandler25_rowShovel() {
|
void sceneHandler25_rowShovel() {
|
||||||
PicAniInfo info;
|
PicAniInfo info;
|
||||||
|
|
||||||
g_fp->_aniMan->getPicAniInfo(&info);
|
g_fp->_aniMan->getPicAniInfo(info);
|
||||||
g_fp->_aniMan->_messageQueueId = 0;
|
g_fp->_aniMan->_messageQueueId = 0;
|
||||||
g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_statics->_staticsId);
|
g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_statics->_staticsId);
|
||||||
|
|
||||||
int x = g_fp->_aniMan->_ox;
|
int x = g_fp->_aniMan->_ox;
|
||||||
int y = g_fp->_aniMan->_oy;
|
int y = g_fp->_aniMan->_oy;
|
||||||
|
|
||||||
g_fp->_aniMan->setPicAniInfo(&info);
|
g_fp->_aniMan->setPicAniInfo(info);
|
||||||
|
|
||||||
int id = g_fp->_aniMan->_statics->_staticsId;
|
int id = g_fp->_aniMan->_statics->_staticsId;
|
||||||
int qid = 0;
|
int qid = 0;
|
||||||
|
@ -309,14 +309,14 @@ void sceneHandler25_rowShovel() {
|
||||||
void sceneHandler25_rowHand() {
|
void sceneHandler25_rowHand() {
|
||||||
PicAniInfo info;
|
PicAniInfo info;
|
||||||
|
|
||||||
g_fp->_aniMan->getPicAniInfo(&info);
|
g_fp->_aniMan->getPicAniInfo(info);
|
||||||
g_fp->_aniMan->_messageQueueId = 0;
|
g_fp->_aniMan->_messageQueueId = 0;
|
||||||
g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_statics->_staticsId);
|
g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_statics->_staticsId);
|
||||||
|
|
||||||
int x = g_fp->_aniMan->_ox;
|
int x = g_fp->_aniMan->_ox;
|
||||||
int y = g_fp->_aniMan->_oy;
|
int y = g_fp->_aniMan->_oy;
|
||||||
|
|
||||||
g_fp->_aniMan->setPicAniInfo(&info);
|
g_fp->_aniMan->setPicAniInfo(info);
|
||||||
|
|
||||||
int id = g_fp->_aniMan->_statics->_staticsId;
|
int id = g_fp->_aniMan->_statics->_staticsId;
|
||||||
int qid = 0;
|
int qid = 0;
|
||||||
|
@ -363,14 +363,14 @@ void sceneHandler25_tryWater() {
|
||||||
void sceneHandler25_tryRow(int obj) {
|
void sceneHandler25_tryRow(int obj) {
|
||||||
PicAniInfo info;
|
PicAniInfo info;
|
||||||
|
|
||||||
g_fp->_aniMan->getPicAniInfo(&info);
|
g_fp->_aniMan->getPicAniInfo(info);
|
||||||
g_fp->_aniMan->_messageQueueId = 0;
|
g_fp->_aniMan->_messageQueueId = 0;
|
||||||
g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT | 0x4000);
|
g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT | 0x4000);
|
||||||
|
|
||||||
int x = g_fp->_aniMan->_ox;
|
int x = g_fp->_aniMan->_ox;
|
||||||
int y = g_fp->_aniMan->_oy;
|
int y = g_fp->_aniMan->_oy;
|
||||||
|
|
||||||
g_fp->_aniMan->setPicAniInfo(&info);
|
g_fp->_aniMan->setPicAniInfo(info);
|
||||||
|
|
||||||
int qid = 0;
|
int qid = 0;
|
||||||
|
|
||||||
|
|
|
@ -109,20 +109,19 @@ bool GameLoader::readSavegame(const char *fname) {
|
||||||
debugC(3, kDebugLoading, "Reading %d infos", arrSize);
|
debugC(3, kDebugLoading, "Reading %d infos", arrSize);
|
||||||
|
|
||||||
for (uint i = 0; i < arrSize; i++) {
|
for (uint i = 0; i < arrSize; i++) {
|
||||||
_sc2array[i]._picAniInfosCount = archive->readUint32LE();
|
|
||||||
|
|
||||||
if (_sc2array[i]._picAniInfosCount)
|
const uint picAniInfosCount = archive->readUint32LE();
|
||||||
debugC(3, kDebugLoading, "Count %d: %d", i, _sc2array[i]._picAniInfosCount);
|
if (picAniInfosCount)
|
||||||
|
debugC(3, kDebugLoading, "Count %d: %d", i, picAniInfosCount);
|
||||||
|
|
||||||
free(_sc2array[i]._picAniInfos);
|
_sc2array[i]._picAniInfos.clear();
|
||||||
_sc2array[i]._picAniInfos = (PicAniInfo **)malloc(sizeof(PicAniInfo *) * _sc2array[i]._picAniInfosCount);
|
_sc2array[i]._picAniInfos.resize(picAniInfosCount);
|
||||||
|
|
||||||
for (int j = 0; j < _sc2array[i]._picAniInfosCount; j++) {
|
for (uint j = 0; j < picAniInfosCount; j++) {
|
||||||
_sc2array[i]._picAniInfos[j] = new PicAniInfo();
|
_sc2array[i]._picAniInfos[j].load(*archive);
|
||||||
_sc2array[i]._picAniInfos[j]->load(*archive);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_sc2array[i]._isLoaded = 0;
|
_sc2array[i]._isLoaded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete archiveStream;
|
delete archiveStream;
|
||||||
|
|
|
@ -88,13 +88,13 @@ bool GameLoader::writeSavegame(Scene *sc, const char *fname) {
|
||||||
debugC(3, kDebugLoading, "Saving %d infos", _sc2array.size());
|
debugC(3, kDebugLoading, "Saving %d infos", _sc2array.size());
|
||||||
|
|
||||||
for (uint i = 0; i < _sc2array.size(); i++) {
|
for (uint i = 0; i < _sc2array.size(); i++) {
|
||||||
archive->writeUint32LE(_sc2array[i]._picAniInfosCount);
|
archive->writeUint32LE(_sc2array[i]._picAniInfos.size());
|
||||||
|
|
||||||
if (_sc2array[i]._picAniInfosCount)
|
if (_sc2array[i]._picAniInfos.size())
|
||||||
debugC(3, kDebugLoading, "Count %d: %d", i, _sc2array[i]._picAniInfosCount);
|
debugC(3, kDebugLoading, "Count %d: %d", i, _sc2array[i]._picAniInfos.size());
|
||||||
|
|
||||||
for (int j = 0; j < _sc2array[i]._picAniInfosCount; j++) {
|
for (uint j = 0; j < _sc2array[i]._picAniInfos.size(); j++) {
|
||||||
_sc2array[i]._picAniInfos[j]->save(*archive);
|
_sc2array[i]._picAniInfos[j].save(*archive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1457,7 +1457,6 @@ Movement::Movement() {
|
||||||
_m2y = 0;
|
_m2y = 0;
|
||||||
_field_50 = 1;
|
_field_50 = 1;
|
||||||
_field_78 = 0;
|
_field_78 = 0;
|
||||||
_framePosOffsets = 0;
|
|
||||||
_field_84 = 0;
|
_field_84 = 0;
|
||||||
_currDynamicPhase = 0;
|
_currDynamicPhase = 0;
|
||||||
_field_8C = 0;
|
_field_8C = 0;
|
||||||
|
@ -1466,15 +1465,9 @@ Movement::Movement() {
|
||||||
_currMovement = 0;
|
_currMovement = 0;
|
||||||
_counter = 0;
|
_counter = 0;
|
||||||
_counterMax = 83;
|
_counterMax = 83;
|
||||||
|
|
||||||
_somePoint.x = 0;
|
|
||||||
_somePoint.y = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Movement::~Movement() {
|
Movement::~Movement() {
|
||||||
for (uint i = 0; i < _dynamicPhases.size(); i++)
|
|
||||||
delete _framePosOffsets[i];
|
|
||||||
|
|
||||||
if (!_currMovement) {
|
if (!_currMovement) {
|
||||||
if (_updateFlag1) {
|
if (_updateFlag1) {
|
||||||
_dynamicPhases[0]->freePixelData();
|
_dynamicPhases[0]->freePixelData();
|
||||||
|
@ -1487,8 +1480,6 @@ Movement::~Movement() {
|
||||||
|
|
||||||
_dynamicPhases.clear();
|
_dynamicPhases.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
free(_framePosOffsets);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Movement::Movement(Movement *src, StaticANIObject *ani) {
|
Movement::Movement(Movement *src, StaticANIObject *ani) {
|
||||||
|
@ -1503,7 +1494,6 @@ Movement::Movement(Movement *src, StaticANIObject *ani) {
|
||||||
_m2y = 0;
|
_m2y = 0;
|
||||||
|
|
||||||
_field_78 = 0;
|
_field_78 = 0;
|
||||||
_framePosOffsets = 0;
|
|
||||||
_field_84 = 0;
|
_field_84 = 0;
|
||||||
_currDynamicPhase = 0;
|
_currDynamicPhase = 0;
|
||||||
_field_8C = 0;
|
_field_8C = 0;
|
||||||
|
@ -1540,7 +1530,6 @@ Movement::Movement(Movement *src, int *oldIdxs, int newSize, StaticANIObject *an
|
||||||
_counterMax = 0;
|
_counterMax = 0;
|
||||||
|
|
||||||
_field_78 = 0;
|
_field_78 = 0;
|
||||||
_framePosOffsets = 0;
|
|
||||||
_field_84 = 0;
|
_field_84 = 0;
|
||||||
_currDynamicPhase = 0;
|
_currDynamicPhase = 0;
|
||||||
_field_8C = 0;
|
_field_8C = 0;
|
||||||
|
@ -1571,25 +1560,19 @@ Movement::Movement(Movement *src, int *oldIdxs, int newSize, StaticANIObject *an
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_framePosOffsets = (Common::Point **)calloc(newSize, sizeof(Common::Point *));
|
_framePosOffsets.resize(newSize);
|
||||||
|
|
||||||
for (int i = 0; i < newSize; i++)
|
|
||||||
_framePosOffsets[i] = new Common::Point();
|
|
||||||
|
|
||||||
if (oldIdxs) {
|
if (oldIdxs) {
|
||||||
for (int i = 0; i < newSize - 1; i++, oldIdxs++) {
|
for (int i = 0; i < newSize - 1; i++, oldIdxs++) {
|
||||||
if (oldIdxs[i] == -1) {
|
if (oldIdxs[i] == -1) {
|
||||||
_dynamicPhases.push_back(src->_staticsObj1);
|
_dynamicPhases.push_back(src->_staticsObj1);
|
||||||
|
|
||||||
_framePosOffsets[i]->x = 0;
|
|
||||||
_framePosOffsets[i]->y = 0;
|
|
||||||
} else {
|
} else {
|
||||||
src->setDynamicPhaseIndex(oldIdxs[i]);
|
src->setDynamicPhaseIndex(oldIdxs[i]);
|
||||||
|
|
||||||
_dynamicPhases.push_back(src->_currDynamicPhase);
|
_dynamicPhases.push_back(src->_currDynamicPhase);
|
||||||
|
|
||||||
_framePosOffsets[i]->x = src->_framePosOffsets[oldIdxs[i]]->x;
|
_framePosOffsets[i].x = src->_framePosOffsets[oldIdxs[i]].x;
|
||||||
_framePosOffsets[i]->y = src->_framePosOffsets[oldIdxs[i]]->y;
|
_framePosOffsets[i].y = src->_framePosOffsets[oldIdxs[i]].y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_staticsObj1 = dynamic_cast<Statics *>(_dynamicPhases.front());
|
_staticsObj1 = dynamic_cast<Statics *>(_dynamicPhases.front());
|
||||||
|
@ -1601,8 +1584,8 @@ Movement::Movement(Movement *src, int *oldIdxs, int newSize, StaticANIObject *an
|
||||||
if (i < newSize - 1)
|
if (i < newSize - 1)
|
||||||
_dynamicPhases.push_back(new DynamicPhase(*src->_currDynamicPhase, 0));
|
_dynamicPhases.push_back(new DynamicPhase(*src->_currDynamicPhase, 0));
|
||||||
|
|
||||||
_framePosOffsets[i]->x = src->_framePosOffsets[i]->x;
|
_framePosOffsets[i].x = src->_framePosOffsets[i].x;
|
||||||
_framePosOffsets[i]->y = src->_framePosOffsets[i]->y;
|
_framePosOffsets[i].y = src->_framePosOffsets[i].y;
|
||||||
}
|
}
|
||||||
|
|
||||||
_staticsObj1 = ani->getStaticsById(src->_staticsObj1->_staticsId);
|
_staticsObj1 = ani->getStaticsById(src->_staticsObj1->_staticsId);
|
||||||
|
@ -1632,10 +1615,7 @@ bool Movement::load(MfcArchive &file, StaticANIObject *ani) {
|
||||||
|
|
||||||
debugC(7, kDebugLoading, "dynCount: %d _id: %d", dynCount, _id);
|
debugC(7, kDebugLoading, "dynCount: %d _id: %d", dynCount, _id);
|
||||||
if (dynCount != 0xffff || _id == MV_MAN_TURN_LU) {
|
if (dynCount != 0xffff || _id == MV_MAN_TURN_LU) {
|
||||||
_framePosOffsets = (Common::Point **)calloc(dynCount + 2, sizeof(Common::Point *));
|
_framePosOffsets.resize(dynCount + 2);
|
||||||
|
|
||||||
for (int i = 0; i < dynCount + 2; i++)
|
|
||||||
_framePosOffsets[i] = new Common::Point();
|
|
||||||
|
|
||||||
for (int i = 0; i < dynCount; i++) {
|
for (int i = 0; i < dynCount; i++) {
|
||||||
DynamicPhase *ph = new DynamicPhase();
|
DynamicPhase *ph = new DynamicPhase();
|
||||||
|
@ -1643,8 +1623,8 @@ bool Movement::load(MfcArchive &file, StaticANIObject *ani) {
|
||||||
|
|
||||||
_dynamicPhases.push_back(ph);
|
_dynamicPhases.push_back(ph);
|
||||||
|
|
||||||
_framePosOffsets[i]->x = ph->_x;
|
_framePosOffsets[i].x = ph->_x;
|
||||||
_framePosOffsets[i]->y = ph->_y;
|
_framePosOffsets[i].y = ph->_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
int staticsid = file.readUint16LE();
|
int staticsid = file.readUint16LE();
|
||||||
|
@ -1674,8 +1654,8 @@ bool Movement::load(MfcArchive &file, StaticANIObject *ani) {
|
||||||
if (_staticsObj2) {
|
if (_staticsObj2) {
|
||||||
_dynamicPhases.push_back(_staticsObj2);
|
_dynamicPhases.push_back(_staticsObj2);
|
||||||
|
|
||||||
_framePosOffsets[_dynamicPhases.size() - 1]->x = _m2x;
|
_framePosOffsets[_dynamicPhases.size() - 1].x = _m2x;
|
||||||
_framePosOffsets[_dynamicPhases.size() - 1]->y = _m2y;
|
_framePosOffsets[_dynamicPhases.size() - 1].y = _m2y;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -1909,8 +1889,8 @@ void Movement::removeFirstPhase() {
|
||||||
_dynamicPhases.remove_at(0);
|
_dynamicPhases.remove_at(0);
|
||||||
|
|
||||||
for (uint i = 0; i < _dynamicPhases.size(); i++) {
|
for (uint i = 0; i < _dynamicPhases.size(); i++) {
|
||||||
_framePosOffsets[i]->x = _framePosOffsets[i + 1]->x;
|
_framePosOffsets[i].x = _framePosOffsets[i + 1].x;
|
||||||
_framePosOffsets[i]->y = _framePosOffsets[i + 1]->y;
|
_framePosOffsets[i].y = _framePosOffsets[i + 1].y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_currDynamicPhaseIndex--;
|
_currDynamicPhaseIndex--;
|
||||||
|
@ -1967,9 +1947,9 @@ bool Movement::gotoNextFrame(void (*callback1)(int, Common::Point *point, int, i
|
||||||
_currDynamicPhaseIndex = 0;
|
_currDynamicPhaseIndex = 0;
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
if (_currMovement->_framePosOffsets) {
|
if (_currMovement->_framePosOffsets.size()) {
|
||||||
if (callback1) {
|
if (callback1) {
|
||||||
point = *_currMovement->_framePosOffsets[_currDynamicPhaseIndex];
|
point = _currMovement->_framePosOffsets[_currDynamicPhaseIndex];
|
||||||
callback1(_currDynamicPhaseIndex, &point, _ox, _oy);
|
callback1(_currDynamicPhaseIndex, &point, _ox, _oy);
|
||||||
|
|
||||||
_ox += deltax - point.x;
|
_ox += deltax - point.x;
|
||||||
|
@ -1981,8 +1961,8 @@ bool Movement::gotoNextFrame(void (*callback1)(int, Common::Point *point, int, i
|
||||||
_ox += deltax;
|
_ox += deltax;
|
||||||
deltax = _currMovement->getDimensionsOfPhase(oldDynIndex).x;
|
deltax = _currMovement->getDimensionsOfPhase(oldDynIndex).x;
|
||||||
|
|
||||||
_ox += _currMovement->_framePosOffsets[oldDynIndex]->x;
|
_ox += _currMovement->_framePosOffsets[oldDynIndex].x;
|
||||||
_oy -= _currMovement->_framePosOffsets[oldDynIndex]->y;
|
_oy -= _currMovement->_framePosOffsets[oldDynIndex].y;
|
||||||
oldDynIndex--;
|
oldDynIndex--;
|
||||||
|
|
||||||
_ox -= _currMovement->getDimensionsOfPhase(oldDynIndex).x;
|
_ox -= _currMovement->getDimensionsOfPhase(oldDynIndex).x;
|
||||||
|
@ -1991,8 +1971,8 @@ bool Movement::gotoNextFrame(void (*callback1)(int, Common::Point *point, int, i
|
||||||
for (int i = oldDynIndex + 1; i <= _currDynamicPhaseIndex; i++) {
|
for (int i = oldDynIndex + 1; i <= _currDynamicPhaseIndex; i++) {
|
||||||
_ox += deltax;
|
_ox += deltax;
|
||||||
deltax = _currMovement->getDimensionsOfPhase(i).x;
|
deltax = _currMovement->getDimensionsOfPhase(i).x;
|
||||||
_ox -= _currMovement->_framePosOffsets[i]->x;
|
_ox -= _currMovement->_framePosOffsets[i].x;
|
||||||
_oy += _currMovement->_framePosOffsets[i]->y;
|
_oy += _currMovement->_framePosOffsets[i].y;
|
||||||
_ox -= _currMovement->getDimensionsOfPhase(i).x;
|
_ox -= _currMovement->getDimensionsOfPhase(i).x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2007,23 +1987,23 @@ bool Movement::gotoNextFrame(void (*callback1)(int, Common::Point *point, int, i
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_framePosOffsets) {
|
if (_framePosOffsets.size()) {
|
||||||
if (callback1) {
|
if (callback1) {
|
||||||
point.x = _framePosOffsets[_currDynamicPhaseIndex]->x;
|
point.x = _framePosOffsets[_currDynamicPhaseIndex].x;
|
||||||
point.y = _framePosOffsets[_currDynamicPhaseIndex]->y;
|
point.y = _framePosOffsets[_currDynamicPhaseIndex].y;
|
||||||
|
|
||||||
callback1(_currDynamicPhaseIndex, &point, _ox, _oy);
|
callback1(_currDynamicPhaseIndex, &point, _ox, _oy);
|
||||||
_ox += point.x;
|
_ox += point.x;
|
||||||
_oy += point.y;
|
_oy += point.y;
|
||||||
} else if (oldDynIndex >= _currDynamicPhaseIndex) {
|
} else if (oldDynIndex >= _currDynamicPhaseIndex) {
|
||||||
for (int i = oldDynIndex; i > _currDynamicPhaseIndex; i--) {
|
for (int i = oldDynIndex; i > _currDynamicPhaseIndex; i--) {
|
||||||
_ox -= _framePosOffsets[i]->x;
|
_ox -= _framePosOffsets[i].x;
|
||||||
_oy -= _framePosOffsets[i]->y;
|
_oy -= _framePosOffsets[i].y;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = oldDynIndex + 1; i <= _currDynamicPhaseIndex; i++) {
|
for (int i = oldDynIndex + 1; i <= _currDynamicPhaseIndex; i++) {
|
||||||
_ox += _framePosOffsets[i]->x;
|
_ox += _framePosOffsets[i].x;
|
||||||
_oy += _framePosOffsets[i]->y;
|
_oy += _framePosOffsets[i].y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2053,10 +2033,10 @@ bool Movement::gotoPrevFrame() {
|
||||||
_oy -= point.y;
|
_oy -= point.y;
|
||||||
|
|
||||||
if (_currMovement) {
|
if (_currMovement) {
|
||||||
if (_currMovement->_framePosOffsets) {
|
if (_currMovement->_framePosOffsets.size()) {
|
||||||
_ox += _currMovement->getDimensionsOfPhase(_currDynamicPhaseIndex).x;
|
_ox += _currMovement->getDimensionsOfPhase(_currDynamicPhaseIndex).x;
|
||||||
_ox += _currMovement->_framePosOffsets[_currDynamicPhaseIndex]->x;
|
_ox += _currMovement->_framePosOffsets[_currDynamicPhaseIndex].x;
|
||||||
_oy -= _currMovement->_framePosOffsets[_currDynamicPhaseIndex]->y;
|
_oy -= _currMovement->_framePosOffsets[_currDynamicPhaseIndex].y;
|
||||||
}
|
}
|
||||||
|
|
||||||
_currDynamicPhaseIndex--;
|
_currDynamicPhaseIndex--;
|
||||||
|
@ -2065,9 +2045,9 @@ bool Movement::gotoPrevFrame() {
|
||||||
|
|
||||||
_ox -= _currMovement->getDimensionsOfPhase(_currDynamicPhaseIndex).x;
|
_ox -= _currMovement->getDimensionsOfPhase(_currDynamicPhaseIndex).x;
|
||||||
} else {
|
} else {
|
||||||
if (_framePosOffsets) {
|
if (_framePosOffsets.size()) {
|
||||||
_ox -= _framePosOffsets[_currDynamicPhaseIndex]->x;
|
_ox -= _framePosOffsets[_currDynamicPhaseIndex].x;
|
||||||
_oy -= _framePosOffsets[_currDynamicPhaseIndex]->y;
|
_oy -= _framePosOffsets[_currDynamicPhaseIndex].y;
|
||||||
}
|
}
|
||||||
|
|
||||||
_currDynamicPhaseIndex--;
|
_currDynamicPhaseIndex--;
|
||||||
|
|
|
@ -122,7 +122,7 @@ class Movement : public GameObject {
|
||||||
int _counter;
|
int _counter;
|
||||||
Common::Array<DynamicPhase *> _dynamicPhases;
|
Common::Array<DynamicPhase *> _dynamicPhases;
|
||||||
int _field_78;
|
int _field_78;
|
||||||
Common::Point **_framePosOffsets;
|
Common::Array<Common::Point> _framePosOffsets;
|
||||||
Movement *_currMovement;
|
Movement *_currMovement;
|
||||||
int _field_84;
|
int _field_84;
|
||||||
DynamicPhase *_currDynamicPhase;
|
DynamicPhase *_currDynamicPhase;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue