diff options
author | Torbjörn Andersson | 2004-10-21 06:49:11 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2004-10-21 06:49:11 +0000 |
commit | 1e062a6d8980d845f058b2782798d4c6e608c54f (patch) | |
tree | eccfe2f4cac40b97f45521598cba83f5278b0854 /saga | |
parent | ed089f7f389e64ddccd751d1d4e30f81c445497e (diff) | |
download | scummvm-rg350-1e062a6d8980d845f058b2782798d4c6e608c54f.tar.gz scummvm-rg350-1e062a6d8980d845f058b2782798d4c6e608c54f.tar.bz2 scummvm-rg350-1e062a6d8980d845f058b2782798d4c6e608c54f.zip |
A bunch of mostly panel-related fixes for the ITE intro. Apart from the
numerous animation glitches, it's looking almost like the real thing now.
It's no longer possible to walk away during the intro. This should provide
a great incentive to implement the "Escape" feature. ;-)
svn-id: r15626
Diffstat (limited to 'saga')
-rw-r--r-- | saga/actor.cpp | 5 | ||||
-rw-r--r-- | saga/interface.cpp | 79 | ||||
-rw-r--r-- | saga/interface.h | 14 | ||||
-rw-r--r-- | saga/scene.cpp | 3 | ||||
-rw-r--r-- | saga/script.cpp | 1 | ||||
-rw-r--r-- | saga/script.h | 4 | ||||
-rw-r--r-- | saga/sfuncs.cpp | 29 | ||||
-rw-r--r-- | saga/sthread.cpp | 2 |
8 files changed, 100 insertions, 37 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp index 950f23c958..5001151f47 100644 --- a/saga/actor.cpp +++ b/saga/actor.cpp @@ -928,7 +928,10 @@ int Actor::handleWalkIntent(R_ACTOR *actor, R_WALKINTENT *a_walkint, int *comple endpoint.x = (int)new_a_x / R_ACTOR_LMULT; endpoint.y = (int)new_a_y / R_ACTOR_LMULT; if ((exitNum = _vm->_scene->_actionMap->hitTest(endpoint)) != -1) { - _vm->_scene->changeScene(_vm->_scene->_actionMap->getExitScene(exitNum)); + // WORKAROUND: Only change room if the actor is Rif + // himself. We need to fix this properly later. + if (actor->id == 0) + _vm->_scene->changeScene(_vm->_scene->_actionMap->getExitScene(exitNum)); } *complete_p = 1; return R_FAILURE; diff --git a/saga/interface.cpp b/saga/interface.cpp index 942264ceca..fc633353c5 100644 --- a/saga/interface.cpp +++ b/saga/interface.cpp @@ -67,7 +67,9 @@ static R_INTERFACE_DESC ITE_interface = { COMMAND_DEFAULT_BUTTON, ITE_LPORTRAIT_X, - ITE_LPORTRAIT_Y + ITE_LPORTRAIT_Y, + ITE_RPORTRAIT_X, + ITE_RPORTRAIT_Y }; static R_INTERFACE_BUTTON ITE_c_buttons[] = { @@ -109,7 +111,9 @@ static R_INTERFACE_DESC IHNM_interface = { COMMAND_DEFAULT_BUTTON, IHNM_LPORTRAIT_X, - IHNM_LPORTRAIT_Y + IHNM_LPORTRAIT_Y, + IHNM_RPORTRAIT_X, + IHNM_RPORTRAIT_Y }; static R_INTERFACE_BUTTON IHNM_c_buttons[] = { @@ -207,7 +211,9 @@ Interface::Interface(SagaEngine *vm) : _vm(vm), _initialized(false) { _dPanel.y = 149; _cPanel.set_button = COMMAND_DEFAULT_BUTTON; - _activePortrait = 0; + _scenePortraits = 0; + _leftPortrait = 0; + _rightPortrait = 0; _activeVerb = I_VERB_WALKTO; @@ -235,6 +241,15 @@ int Interface::deactivate() { return R_SUCCESS; } +int Interface::setMode(R_PANEL_MODES mode) { + // TODO: Is this where we should hide/show the mouse cursor? + + _panelMode = mode; + draw(); + + return R_SUCCESS; +} + int Interface::setStatusText(const char *new_txt) { assert(new_txt != NULL); @@ -243,6 +258,27 @@ int Interface::setStatusText(const char *new_txt) { return R_SUCCESS; } +int Interface::loadScenePortraits(int res) { + if (_scenePortraits) + _vm->_sprite->freeSprite(_scenePortraits); + + return _vm->_sprite->loadList(res, &_scenePortraits); +} + +int Interface::setLeftPortrait(int portrait) { + _leftPortrait = portrait; + draw(); + + return R_SUCCESS; +} + +int Interface::setRightPortrait(int portrait) { + _rightPortrait = portrait; + draw(); + + return R_SUCCESS; +} + int Interface::draw() { R_GAME_DISPLAYINFO g_di; R_SURFACE *back_buf; @@ -251,6 +287,8 @@ int Interface::draw() { int ybase; int lportrait_x; int lportrait_y; + int rportrait_x; + int rportrait_y; Rect rect; Point origin; @@ -298,7 +336,14 @@ int Interface::draw() { lportrait_x = xbase + _iDesc.lportrait_x; lportrait_y = ybase + _iDesc.lportrait_y; - _vm->_sprite->draw(back_buf, _defPortraits, _activePortrait, lportrait_x, lportrait_y); + _vm->_sprite->draw(back_buf, _defPortraits, _leftPortrait, lportrait_x, lportrait_y); + + if (_panelMode == PANEL_DIALOGUE && _iDesc.rportrait_x >= 0) { + rportrait_x = xbase + _iDesc.rportrait_x; + rportrait_y = ybase + _iDesc.rportrait_y; + + _vm->_sprite->draw(back_buf, _scenePortraits, _rightPortrait, rportrait_x, rportrait_y); + } return R_SUCCESS; } @@ -322,23 +367,25 @@ int Interface::update(const Point& imousePt, int update_flag) { // Get game display info GAME_GetDisplayInfo(&g_di); - // Update playfield space ( only if cursor is inside ) - if (imouse_y < g_di.scene_h) { - // Mouse is in playfield space + if (_panelMode == PANEL_COMMAND) { + // Update playfield space ( only if cursor is inside ) + if (imouse_y < g_di.scene_h) { + // Mouse is in playfield space + if (update_flag == UPDATE_MOUSEMOVE) { + handlePlayfieldUpdate(back_buf, imousePt); + } else if (update_flag == UPDATE_MOUSECLICK) { + handlePlayfieldClick(back_buf, imousePt); + } + } + + // Update command space if (update_flag == UPDATE_MOUSEMOVE) { - handlePlayfieldUpdate(back_buf, imousePt); + handleCommandUpdate(back_buf, imousePt); } else if (update_flag == UPDATE_MOUSECLICK) { - handlePlayfieldClick(back_buf, imousePt); + handleCommandClick(back_buf, imousePt); } } - // Update command space - if (update_flag == UPDATE_MOUSEMOVE) { - handleCommandUpdate(back_buf, imousePt); - } else if (update_flag == UPDATE_MOUSECLICK) { - handleCommandClick(back_buf, imousePt); - } - drawStatusBar(back_buf); return R_SUCCESS; diff --git a/saga/interface.h b/saga/interface.h index 16ef258615..4b87bfbdd6 100644 --- a/saga/interface.h +++ b/saga/interface.h @@ -56,6 +56,8 @@ enum INTERFACE_UPDATE_FLAGS { #define ITE_LPORTRAIT_X 5 #define ITE_LPORTRAIT_Y 4 +#define ITE_RPORTRAIT_X 274 +#define ITE_RPORTRAIT_Y 4 // IHNMAIMS interface values #define IHNM_STATUS_Y 304 @@ -71,6 +73,8 @@ enum INTERFACE_UPDATE_FLAGS { #define IHNM_LPORTRAIT_X 5 #define IHNM_LPORTRAIT_Y 4 +#define IHNM_RPORTRAIT_X -1 +#define IHNM_RPORTRAIT_Y -1 enum R_PANEL_MODES { PANEL_COMMAND, @@ -127,6 +131,8 @@ struct R_INTERFACE_DESC { int cmd_defaultbutton; int lportrait_x; int lportrait_y; + int rportrait_x; + int rportrait_y; }; struct R_INTERFACE_MODULE { @@ -158,7 +164,11 @@ class Interface { int registerLang(); int activate(); int deactivate(); + int setMode(R_PANEL_MODES mode); int setStatusText(const char *new_txt); + int loadScenePortraits(int res); + int setLeftPortrait(int portrait); + int setRightPortrait(int portrait); int draw(); int update(const Point& imousePt, int update_flag); @@ -182,8 +192,10 @@ class Interface { R_INTERFACE_PANEL _cPanel; R_INTERFACE_PANEL _dPanel; char _statusText[R_STATUS_TEXT_LEN]; - int _activePortrait; + int _leftPortrait; + int _rightPortrait; R_SPRITELIST *_defPortraits; + R_SPRITELIST *_scenePortraits; int _activeVerb; R_SCRIPT_THREAD *_iThread; }; diff --git a/saga/scene.cpp b/saga/scene.cpp index e104b8e7f4..cd581d055f 100644 --- a/saga/scene.cpp +++ b/saga/scene.cpp @@ -30,6 +30,7 @@ #include "saga/animation.h" #include "saga/console.h" #include "saga/cvar_mod.h" +#include "saga/interface.h" #include "saga/events.h" #include "saga/actionmap.h" #include "saga/isomap.h" @@ -789,7 +790,7 @@ int Scene::processSceneResources() { warning("Scene::ProcessSceneResources(): Loading scene entries is not implemented"); break; case SAGA_FACES: - warning("Scene::ProcessSceneResources(): Loading scene faces is not implemented"); + _vm->_interface->loadScenePortraits(_resList[i].res_number); break; default: warning("Scene::ProcessSceneResources(): Encountered unknown resource type: %d", _resList[i].res_type); diff --git a/saga/script.cpp b/saga/script.cpp index 6d4f11f6b8..1f6731bd48 100644 --- a/saga/script.cpp +++ b/saga/script.cpp @@ -58,6 +58,7 @@ Script::Script() { int i, j; //initialize member variables + _dbg_thread = 0; _scriptContext = 0; _voiceLUTPresent = false; _scriptLUTEntryLen = 0; diff --git a/saga/script.h b/saga/script.h index c5b666339e..5bbde08f4d 100644 --- a/saga/script.h +++ b/saga/script.h @@ -236,8 +236,8 @@ private: int SF_sleep(R_SCRIPTFUNC_PARAMS); int SF_takeObject(R_SCRIPTFUNC_PARAMS); int SF_objectIsCarried(R_SCRIPTFUNC_PARAMS); - int SF_setCommandText(R_SCRIPTFUNC_PARAMS); - int SF_mainMode(R_SCRIPTFUNC_PARAMS); + int SF_setStatusText(R_SCRIPTFUNC_PARAMS); + int SF_commandMode(R_SCRIPTFUNC_PARAMS); int SF_actorWalkTo(R_SCRIPTFUNC_PARAMS); int SF_setFacing(R_SCRIPTFUNC_PARAMS); int SF_startBgdAnim(R_SCRIPTFUNC_PARAMS); diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp index 84daf5b547..bb8f462c0f 100644 --- a/saga/sfuncs.cpp +++ b/saga/sfuncs.cpp @@ -47,8 +47,8 @@ void Script::setupScriptFuncList(void) { {1, 1, OPCODE(SF_sleep)}, {2, 1, OPCODE(SF_takeObject)}, {3, 1, OPCODE(SF_objectIsCarried)}, - {4, 1, OPCODE(SF_setCommandText)}, - {5, 0, OPCODE(SF_mainMode)}, + {4, 1, OPCODE(SF_setStatusText)}, + {5, 0, OPCODE(SF_commandMode)}, {6, 3, OPCODE(SF_actorWalkTo)}, {7, 4, OPCODE(SF_doAction)}, {8, 2, OPCODE(SF_setFacing)}, @@ -163,18 +163,15 @@ int Script::SF_objectIsCarried(R_SCRIPTFUNC_PARAMS) { // Script function #4 (0x04) nonblocking // Set the command display to the specified text string // Param1: dialogue index of string -int Script::SF_setCommandText(R_SCRIPTFUNC_PARAMS) { - SDataWord_T s_idx_parm; +int Script::SF_setStatusText(R_SCRIPTFUNC_PARAMS) { + SDataWord_T param = thread->pop(); - s_idx_parm = thread->pop(); - // INCOMPLETE - - return R_SUCCESS; + return _vm->_interface->setStatusText(currentScript()->diag->str[param]); } // Script function #5 (0x05) -int Script::SF_mainMode(R_SCRIPTFUNC_PARAMS) { - return R_SUCCESS; +int Script::SF_commandMode(R_SCRIPTFUNC_PARAMS) { + return _vm->_interface->setMode(PANEL_COMMAND); } // Script function #6 (0x06) blocking @@ -279,7 +276,7 @@ int Script::SF_freezeInterface(R_SCRIPTFUNC_PARAMS) { // Script function #12 (0x0C) // Disables mouse input, etc. int Script::SF_dialogMode(R_SCRIPTFUNC_PARAMS) { - return R_SUCCESS; + return _vm->_interface->setMode(PANEL_DIALOGUE); } // Script function #14 (0x0E) @@ -533,15 +530,17 @@ int Script::SF_setFrame(R_SCRIPTFUNC_PARAMS) { // Script function #39 (0x27) // Sets the right-hand portrait int Script::SF_setRightPortrait(R_SCRIPTFUNC_PARAMS) { - thread->pop(); - return R_SUCCESS; + SDataWord_T param = thread->pop(); + + return _vm->_interface->setRightPortrait(param); } // Script function #40 (0x28) // Sets the left-hand portrait int Script::SF_setLeftPortrait(R_SCRIPTFUNC_PARAMS) { - thread->pop(); - return R_SUCCESS; + SDataWord_T param = thread->pop(); + + return _vm->_interface->setLeftPortrait(param); } // Script function #41 (0x29) nonblocking diff --git a/saga/sthread.cpp b/saga/sthread.cpp index 5bfe1e22b4..5e9cc785bf 100644 --- a/saga/sthread.cpp +++ b/saga/sthread.cpp @@ -726,7 +726,7 @@ int Script::SThreadRun(R_SCRIPT_THREAD *thread, int instr_limit, int msec) { } else { voice_rn = currentScript()->voice->voices[data]; } - _vm->_actor->speak(a_index, currentScript()->diag-> str[data], voice_rn, &thread->sem); + _vm->_actor->speak(a_index, currentScript()->diag->str[data], voice_rn, &thread->sem); } } break; |