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