diff options
-rw-r--r-- | saga/actor.cpp | 10 | ||||
-rw-r--r-- | saga/interface.cpp | 16 | ||||
-rw-r--r-- | saga/interface.h | 8 | ||||
-rw-r--r-- | saga/rscfile.cpp | 4 | ||||
-rw-r--r-- | saga/saga.h | 3 | ||||
-rw-r--r-- | saga/saveload.cpp | 4 | ||||
-rw-r--r-- | saga/scene.h | 3 | ||||
-rw-r--r-- | saga/script.h | 4 | ||||
-rw-r--r-- | saga/sfuncs.cpp | 19 |
9 files changed, 45 insertions, 26 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp index f0bef2ec83..f630bb659f 100644 --- a/saga/actor.cpp +++ b/saga/actor.cpp @@ -575,10 +575,7 @@ void Actor::loadObjList(int objectCount, int objectsResourceID) { error("Actor::loadObjList frameListResourceId != 0"); } object->_scriptEntrypointNumber = objectS.readUint32LE(); - objectS.readByte(); - objectS.readByte(); - objectS.readByte(); - objectS.readByte(); + objectS.readUint32LE(); // xSprite *dSpr; objectS.readUint16LE(); //LEFT objectS.readUint16LE(); //RIGHT objectS.readUint16LE(); //TOP @@ -1080,11 +1077,6 @@ void Actor::handleActions(int msec, bool setup) { continue; } - if (_vm->getGameType() == GType_IHNM) { - if (actor->_spriteList.spriteCount == 0) - continue; - } - switch (actor->_currentAction) { case kActionWait: if (!setup && (actor->_flags & kFollower)) { diff --git a/saga/interface.cpp b/saga/interface.cpp index 63cf221f23..048ec8da99 100644 --- a/saga/interface.cpp +++ b/saga/interface.cpp @@ -202,6 +202,8 @@ Interface::Interface(SagaEngine *vm) : _vm(vm) { _textInput = false; _statusTextInput = false; _statusTextInputState = kStatusTextInputFirstRun; + + _disableAbortSpeeches = false; } Interface::~Interface(void) { @@ -338,7 +340,8 @@ bool Interface::processAscii(uint16 ascii, bool synthetic) { if (_vm->_scene->isInIntro()) { _vm->_scene->skipScene(); } else { - _vm->_actor->abortAllSpeeches(); + if (!_disableAbortSpeeches) + _vm->_actor->abortAllSpeeches(); } return true; } @@ -591,10 +594,13 @@ void Interface::draw() { } if (_vm->getGameType() == GType_IHNM) { - _vm->_gfx->setPaletteColor(254, - _portraitBgColor.red, - _portraitBgColor.green, - _portraitBgColor.blue); + if (_vm->_spiritualBarometer > 255) + _vm->_gfx->setPaletteColor(kIHNMColorPortrait, 0xff, 0xff, 0xff); + else + _vm->_gfx->setPaletteColor(kIHNMColorPortrait, + _portraitBgColor.red, + _portraitBgColor.green, + _portraitBgColor.blue); } if (_panelMode == kPanelMain || _panelMode == kPanelConverse || diff --git a/saga/interface.h b/saga/interface.h index d6cc44c263..05aca7bdae 100644 --- a/saga/interface.h +++ b/saga/interface.h @@ -176,7 +176,8 @@ enum GameColors { kITEColorLightBlue94 = 0x94, kITEColorLightBlue96 = 0x96, - kIHNMColorBlack = 0xfa + kIHNMColorBlack = 0xfa, + kIHNMColorPortrait = 0xfe }; enum StatusTextInputState { @@ -227,6 +228,7 @@ public: _portraitBgColor.green = green; _portraitBgColor.blue = blue; } + void draw(); void drawOption(); void drawQuit(); @@ -239,6 +241,8 @@ public: bool processAscii(uint16 ascii, bool synthetic = false); void processKeyUp(uint16 ascii); + void disableAbortSpeeches(bool d) { _disableAbortSpeeches = d; } + bool _textInput; bool _statusTextInput; @@ -409,6 +413,8 @@ private: InterfacePanel _savePanel; PanelButton * _saveEdit; + bool _disableAbortSpeeches; + int _saveReminderState; bool _active; int _fadeMode; diff --git a/saga/rscfile.cpp b/saga/rscfile.cpp index 238f95b19f..010173ad7b 100644 --- a/saga/rscfile.cpp +++ b/saga/rscfile.cpp @@ -29,6 +29,7 @@ #include "saga/interface.h" #include "saga/music.h" #include "saga/rscfile.h" +#include "saga/scene.h" #include "saga/sndres.h" #include "saga/stream.h" @@ -596,6 +597,9 @@ void Resource::loadGlobalResources(int chapter, int actorsEntrance) { _vm->_script->loadVoiceLUT(_vm->_script->_globalVoiceLUT, resourcePointer, resourceLength); free(resourcePointer); } + + _vm->_spiritualBarometer = 0; + _vm->_scene->setChapterNumber(chapter); } } // End of namespace Saga diff --git a/saga/saga.h b/saga/saga.h index 41f37b55f2..934d7a5bb8 100644 --- a/saga/saga.h +++ b/saga/saga.h @@ -575,7 +575,8 @@ public: int16 _framesEsc; uint32 _globalFlags; - byte _ethicsPoints[5]; // TODO: Verify that this is large enough + int16 _ethicsPoints[8]; + int _spiritualBarometer; int _soundVolume; int _musicVolume; diff --git a/saga/saveload.cpp b/saga/saveload.cpp index 8560f4f10e..402549c3b6 100644 --- a/saga/saveload.cpp +++ b/saga/saveload.cpp @@ -181,7 +181,7 @@ void SagaEngine::save(const char *fileName, const char *saveName) { if (getGameType() != GType_ITE) { out->writeUint32LE(_globalFlags); for (int i = 0; i < ARRAYSIZE(_ethicsPoints); i++) - out->writeByte(_ethicsPoints[i]); + out->writeSint16LE(_ethicsPoints[i]); } _interface->saveState(out); @@ -226,7 +226,7 @@ void SagaEngine::load(const char *fileName) { if (getGameType() != GType_ITE) { _globalFlags = in->readUint32LE(); for (int i = 0; i < ARRAYSIZE(_ethicsPoints); i++) - _ethicsPoints[i] = in->readByte(); + _ethicsPoints[i] = in->readSint16LE(); } _interface->loadState(in); diff --git a/saga/scene.h b/saga/scene.h index d446555f23..def1d1ddd2 100644 --- a/saga/scene.h +++ b/saga/scene.h @@ -261,6 +261,8 @@ class Scene { return _sceneLUT[sceneNumber]; } int currentSceneNumber() const { return _sceneNumber; } + int currentChapterNumber() const { return _chapterNumber; } + void setChapterNumber(int ch) { _chapterNumber = ch; } int getOutsetSceneNumber() const { return _outsetSceneNumber; } int currentSceneResourceId() const { return _sceneResourceId; } void cutawaySkip() { @@ -288,6 +290,7 @@ class Scene { SceneQueueList _sceneQueue; bool _sceneLoaded; int _sceneNumber; + int _chapterNumber; int _outsetSceneNumber; int _sceneResourceId; bool _inGame; diff --git a/saga/script.h b/saga/script.h index bfc817614a..1436727fd8 100644 --- a/saga/script.h +++ b/saga/script.h @@ -561,7 +561,7 @@ private: void sfPsychicProfile(SCRIPTFUNC_PARAMS); void sfPsychicProfileOff(SCRIPTFUNC_PARAMS); void sfSetSpeechBox(SCRIPTFUNC_PARAMS); - void sf74(SCRIPTFUNC_PARAMS); + void sfSetChapterPoints(SCRIPTFUNC_PARAMS); void sfSetPortraitBgColor(SCRIPTFUNC_PARAMS); void sfScriptStartVideo(SCRIPTFUNC_PARAMS); void sfScriptReturnFromVideo(SCRIPTFUNC_PARAMS); @@ -575,7 +575,7 @@ private: void sfTestGlobalFlag(SCRIPTFUNC_PARAMS); void sfSetPoints(SCRIPTFUNC_PARAMS); void sf103(SCRIPTFUNC_PARAMS); - void sf104(SCRIPTFUNC_PARAMS); + void sfDisableAbortSpeeches(SCRIPTFUNC_PARAMS); void SF_stub(const char *name, ScriptThread *thread, int nArgs); }; diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp index 9d6040c9d3..a0d955db12 100644 --- a/saga/sfuncs.cpp +++ b/saga/sfuncs.cpp @@ -209,7 +209,7 @@ static const ScriptFunctionDescription IHNMscriptFunctionsList[IHNM_SCRIPT_FUNCT OPCODE(sfRand), OPCODE(sfFadeMusic), OPCODE(sfNull), - OPCODE(sf74), + OPCODE(sfSetChapterPoints), OPCODE(sfSetPortraitBgColor), OPCODE(sfScriptStartCutAway), OPCODE(sfReturnFromCutAway), @@ -239,7 +239,7 @@ static const ScriptFunctionDescription IHNMscriptFunctionsList[IHNM_SCRIPT_FUNCT OPCODE(sfDebugShowData), OPCODE(sfWaitFramesEsc), OPCODE(sf103), - OPCODE(sf104) + OPCODE(sfDisableAbortSpeeches) }; if (_vm->getGameType() == GType_IHNM) _scriptFunctionsList = IHNMscriptFunctionsList; @@ -1840,8 +1840,13 @@ void Script::finishDialog(int replyID, int flags, int bitOffset) { wakeUpThreads(kWaitTypeDialogBegin); } -void Script::sf74(SCRIPTFUNC_PARAMS) { - SF_stub("sf74", thread, nArgs); +void Script::sfSetChapterPoints(SCRIPTFUNC_PARAMS) { + int16 ethics = thread->pop(); + int16 barometer = thread->pop(); + int chapter = _vm->_scene->currentChapterNumber(); + + _vm->_ethicsPoints[chapter] = ethics; + _vm->_spiritualBarometer = barometer; } void Script::sfSetPortraitBgColor(SCRIPTFUNC_PARAMS) { @@ -2002,8 +2007,10 @@ void Script::sf103(SCRIPTFUNC_PARAMS) { SF_stub("sf103", thread, nArgs); } -void Script::sf104(SCRIPTFUNC_PARAMS) { - SF_stub("sf104", thread, nArgs); +void Script::sfDisableAbortSpeeches(SCRIPTFUNC_PARAMS) { + int value = thread->pop(); + + _vm->_interface->disableAbortSpeeches(value != 0); } void Script::sfNull(SCRIPTFUNC_PARAMS) { |