diff --git a/engines/asylum/actionlist.cpp b/engines/asylum/actionlist.cpp index f72a8655754..c4be079b7b0 100644 --- a/engines/asylum/actionlist.cpp +++ b/engines/asylum/actionlist.cpp @@ -53,6 +53,9 @@ struct AsylumFunction { #define MAPFUNC(name, func) {name, func} +// TODO I don't know that we're clearing this out +// when the engine is disposed. Need to look into this +// as a possible memory leak. static const AsylumFunction function_map[] = { /*0x00*/ MAPFUNC("kReturn0", kReturn0), /*0x01*/ MAPFUNC("kSetGameFlag", kSetGameFlag), @@ -587,6 +590,7 @@ int kDisableActor(ActionCommand *cmd, Scene *scn) { actorIndex = cmd->param1; // TODO Finish implementing this function + //scn->getActor()->update_4072A0(actorIndex); return -1; diff --git a/engines/asylum/actionlist.h b/engines/asylum/actionlist.h index 822487335bf..d5f771f0a8f 100644 --- a/engines/asylum/actionlist.h +++ b/engines/asylum/actionlist.h @@ -40,15 +40,15 @@ class Scene; typedef struct ActionCommand { uint32 numLines; // Only set on the first line of each script uint32 opcode; - uint32 param1; - uint32 param2; - uint32 param3; - uint32 param4; - uint32 param5; - uint32 param6; - uint32 param7; - uint32 param8; - uint32 param9; + int param1; + int param2; + int param3; + int param4; + int param5; + int param6; + int param7; + int param8; + int param9; } ActionCommand; diff --git a/engines/asylum/actor.cpp b/engines/asylum/actor.cpp index b1162ccc53b..a763cb0f7a3 100644 --- a/engines/asylum/actor.cpp +++ b/engines/asylum/actor.cpp @@ -280,7 +280,6 @@ void Actor::update_4072A0(int param) { int newDir = 0; switch (param) { - case 4: case 6: case 14: @@ -298,7 +297,9 @@ void Actor::update_4072A0(int param) { setAction(newDir + 5); break; - + default: + warning ("[update_4072A0] unimplemented case: %d", param); + break; } this->grResId = newGrId; @@ -308,6 +309,11 @@ void Actor::update_4072A0(int param) { this->frameNum = 0; delete gra; + // TODO + // The update type can be different than the provided parameter + // depending on the switch case. Change this once a case handler + // is implemented that requires this ... namely: + // if (!v34) v3 = 4; // so updateType = 4 this->updateType = param; } diff --git a/engines/asylum/asylum.cpp b/engines/asylum/asylum.cpp index 4a70ac4818e..84649617f55 100644 --- a/engines/asylum/asylum.cpp +++ b/engines/asylum/asylum.cpp @@ -52,6 +52,8 @@ AsylumEngine::AsylumEngine(OSystem *system, Common::Language language) SearchMan.addSubDirectoryMatching(_gameDataDir, "vids"); SearchMan.addSubDirectoryMatching(_gameDataDir, "music"); + Common::enableDebugChannel("Scripts"); + g_eventRec.registerRandomSource(_rnd, "asylum"); memset(_gameFlags, 0, 1512); diff --git a/engines/asylum/asylum.h b/engines/asylum/asylum.h index cb797bb7ecf..962d4cfcd29 100644 --- a/engines/asylum/asylum.h +++ b/engines/asylum/asylum.h @@ -44,7 +44,7 @@ namespace Asylum { // progress before the scene is entered. This is // just a convenience, as there's no need for the type // of pre-loading that was performed in the original -#define SHOW_SCENE_LOADING +//#define SHOW_SCENE_LOADING // XXX // I'm not sure if system endian-ness would have any diff --git a/engines/asylum/scene.cpp b/engines/asylum/scene.cpp index 9ea28b8d7dd..da8079819e7 100644 --- a/engines/asylum/scene.cpp +++ b/engines/asylum/scene.cpp @@ -85,7 +85,7 @@ Scene::Scene(uint8 sceneIdx, AsylumEngine *vm): _vm(vm) { _vm->text()->loadFont(_resPack, _ws->commonRes.font1); char musPackFileName[10]; - sprintf(musPackFileName, "mus.%03d", sceneIdx); + sprintf(musPackFileName, MUSIC_FILE_MASK, sceneIdx); _musPack = new ResourcePack(musPackFileName); _bgResource = new GraphicResource(_resPack, _ws->commonRes.backgroundImage); @@ -299,7 +299,7 @@ int Scene::updateScene() { // Barriers startTick = _vm->_system->getMillis(); - updateBarriers2(); + updateBarriers(); debugC(kDebugLevelScene, "UpdateBarriers Time: %d", _vm->_system->getMillis() - startTick); // Ambient Sounds @@ -560,38 +560,7 @@ void Scene::updateActor(uint32 actorIdx) { } } -// XXX WIP void Scene::updateBarriers() { - int v1, v0, v32, v33, v34, tickVal, tickVal05, tickVal06; - v1 = v0 = v32 = v33 = v34 = tickVal = tickVal05 = tickVal06 = 0; - - uint32 start, v2, v31; - bool done = false; - //if (_ws->barriers.size() > 0); - - v2 = _ws->barriers[0].tickCount2; - for (uint32 idx = 0; idx < _ws->numBarriers; idx++) { - //Barrier *b = &_ws->barriers[idx]; - start = _vm->_system->getMillis(); - - if (v2 - 32 != 4) - done = true; - - if (!done && !_ws->checkBarrierFlagsCondition(idx)) { - v31 = _vm->_system->getMillis(); - } - - /* - * TODO - */ - - v2 += 426; - v1 = 0; - done = false; - } -} - -void Scene::updateBarriers2() { //Screen *screen = _vm->screen(); uint barriersCount = _ws->barriers.size(); @@ -732,6 +701,7 @@ void Scene::updateBarriers2() { } void Scene::updateAmbientSounds() { + // TODO // if (cfgGameQualityValue > 3) int v2 = 1; @@ -742,15 +712,13 @@ void Scene::updateAmbientSounds() { for (uint32 i = 0; i < _ws->numAmbientSound; i++) { AmbientSoundItem *snd = &_ws->ambientSounds[i]; for (uint32 f = 0; f < 6; f++) { - uint gameFlag = snd->flagNum[f]; + int gameFlag = snd->flagNum[f]; if (gameFlag >= 0) { if (_vm->isGameFlagNotSet(gameFlag)) { v2 = 0; break; } } else { - // FIXME: Applying the minus operator to an unsigned type results - // in an unsigned type again. Casting gameFlag to int for now if (_vm->isGameFlagSet(-(int)gameFlag)) { // XXX Looks like this just jumps back to // the top of the loop, so not sure if this diff --git a/engines/asylum/scene.h b/engines/asylum/scene.h index b7ed497f1f0..821a7d31b57 100644 --- a/engines/asylum/scene.h +++ b/engines/asylum/scene.h @@ -38,6 +38,7 @@ #include "asylum/cursor.h" #define SCENE_FILE_MASK "scn.%03d" +#define MUSIC_FILE_MASK "mus.%03d" namespace Asylum { @@ -161,7 +162,6 @@ private: void updateMouse(); void updateActor(uint32 actorIdx); void updateBarriers(); - void updateBarriers2(); // XXX Alexandre's version void updateAmbientSounds(); void updateMusic(); void updateAdjustScreen(); diff --git a/engines/asylum/sound.h b/engines/asylum/sound.h index d84439b2903..4281252f921 100644 --- a/engines/asylum/sound.h +++ b/engines/asylum/sound.h @@ -57,7 +57,7 @@ typedef struct AmbientSoundItem { uint32 field_C; uint32 field_10; uint32 field_14; - uint32 flagNum[6]; + int flagNum[6]; uint32 x; uint32 y;