diff options
author | Filippos Karapetis | 2007-08-02 01:04:44 +0000 |
---|---|---|
committer | Filippos Karapetis | 2007-08-02 01:04:44 +0000 |
commit | 63f3d5b253fb38e810480d786369eeb1bed5f49e (patch) | |
tree | 7ef8b0245f381e4558c191985428b8489ee47990 /engines | |
parent | 6a82a3fbfcfda201655b55aea5fec13762e3cd95 (diff) | |
download | scummvm-rg350-63f3d5b253fb38e810480d786369eeb1bed5f49e.tar.gz scummvm-rg350-63f3d5b253fb38e810480d786369eeb1bed5f49e.tar.bz2 scummvm-rg350-63f3d5b253fb38e810480d786369eeb1bed5f49e.zip |
Partially implemented opcodes 87, 88 and 89, used in the help system of the IHNM demo. It's still buggy, though
svn-id: r28398
Diffstat (limited to 'engines')
-rw-r--r-- | engines/saga/interface.cpp | 45 | ||||
-rw-r--r-- | engines/saga/scene.cpp | 93 | ||||
-rw-r--r-- | engines/saga/scene.h | 1 | ||||
-rw-r--r-- | engines/saga/script.h | 6 | ||||
-rw-r--r-- | engines/saga/sfuncs.cpp | 143 |
5 files changed, 173 insertions, 115 deletions
diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp index 941262e10e..6811f5ecd0 100644 --- a/engines/saga/interface.cpp +++ b/engines/saga/interface.cpp @@ -463,12 +463,18 @@ void Interface::setMode(int mode) { _vm->_render->setFlag(RF_DEMO_SUBST); break; case kPanelProtect: - _protectPanel.currentButton = NULL; - _textInputMaxWidth = _protectEdit->width - 10; - _textInput = true; - _textInputString[0] = 0; - _textInputStringLength = 0; - _textInputPos = _textInputStringLength + 1; + if (_vm->getGameType() == GType_ITE) { + // This is used as the copy protection panel in ITE + _protectPanel.currentButton = NULL; + _textInputMaxWidth = _protectEdit->width - 10; + _textInput = true; + _textInputString[0] = 0; + _textInputStringLength = 0; + _textInputPos = _textInputStringLength + 1; + } else { + // In the IHNM demo, this panel mode is set by the scripts + // to flip through the pages of the help system + } break; } @@ -671,18 +677,25 @@ bool Interface::processAscii(uint16 ascii) { keyBossExit(); break; case kPanelProtect: - if (_textInput && processTextInput(ascii)) { - return true; - } + if (_vm->getGameType() == GType_ITE) { + if (_textInput && processTextInput(ascii)) { + return true; + } - if (ascii == 27 || ascii == 13) { // Esc or Enter - _vm->_script->wakeUpThreads(kWaitTypeRequest); - _vm->_interface->setMode(kPanelMain); - - _protectHash = 0; + if (ascii == 27 || ascii == 13) { // Esc or Enter + _vm->_script->wakeUpThreads(kWaitTypeRequest); + _vm->_interface->setMode(kPanelMain); + + _protectHash = 0; - for (char *p = _textInputString; *p; p++) - _protectHash = (_protectHash << 1) + toupper(*p); + for (char *p = _textInputString; *p; p++) + _protectHash = (_protectHash << 1) + toupper(*p); + } + } else { + // In the IHNM demo, this panel mode is set by the scripts + // to flip through the pages of the help system + // Any keypress here returns the user back to the game + _vm->_scene->clearPsychicProfile(); } break; case kPanelPlacard: diff --git a/engines/saga/scene.cpp b/engines/saga/scene.cpp index 3c98421361..4510bcc24c 100644 --- a/engines/saga/scene.cpp +++ b/engines/saga/scene.cpp @@ -1360,6 +1360,99 @@ void Scene::clearPlacard() { q_event = _vm->_events->chain(q_event, &event); } +void Scene::showPsychicProfile(const char *text) { + int textHeight; + static PalEntry cur_pal[PAL_ENTRIES]; + PalEntry *pal; + TextListEntry textEntry; + Event event; + Event *q_event; + + if (_vm->_interface->getMode() == kPanelPlacard) + return; + + _vm->_interface->rememberMode(); + _vm->_interface->setMode(kPanelPlacard); + _vm->_gfx->savePalette(); + + event.type = kEvTOneshot; + event.code = kCursorEvent; + event.op = kEventHide; + + q_event = _vm->_events->queue(&event); + + _vm->_gfx->getCurrentPal(cur_pal); + + event.type = kEvTImmediate; + event.code = kPalEvent; + event.op = kEventPalToBlack; + event.time = 0; + event.duration = kNormalFadeDuration; + event.data = cur_pal; + + q_event = _vm->_events->chain(q_event, &event); + + event.type = kEvTOneshot; + event.code = kInterfaceEvent; + event.op = kEventClearStatus; + + q_event = _vm->_events->chain(q_event, &event); + + event.type = kEvTOneshot; + event.code = kGraphicsEvent; + event.op = kEventSetFlag; + event.param = RF_PLACARD; + + q_event = _vm->_events->chain(q_event, &event); + + // Set the background and palette for the psychic profile + event.type = kEvTOneshot; + event.code = kPsychicProfileBgEvent; + + q_event = _vm->_events->chain(q_event, &event); + + if (text != NULL) { + textHeight = _vm->_font->getHeight(kKnownFontVerb, text, 226, kFontCentered); + + textEntry.knownColor = kKnownColorBlack; + textEntry.useRect = true; + textEntry.rect.left = 245; + textEntry.rect.setHeight(210 + 76); + textEntry.rect.setWidth(226); + textEntry.rect.top = 210 - textHeight; + textEntry.font = kKnownFontVerb; + textEntry.flags = (FontEffectFlags)(kFontCentered); + textEntry.text = text; + + TextListEntry *_psychicProfileTextEntry = _vm->_scene->_textList.addEntry(textEntry); + + event.type = kEvTOneshot; + event.code = kTextEvent; + event.op = kEventDisplay; + event.data = _psychicProfileTextEntry; + + q_event = _vm->_events->chain(q_event, &event); + } + + _vm->_scene->getBGPal(pal); + + event.type = kEvTImmediate; + event.code = kPalEvent; + event.op = kEventBlackToPal; + event.time = 0; + event.duration = kNormalFadeDuration; + event.data = pal; + + q_event = _vm->_events->chain(q_event, &event); + + event.type = kEvTOneshot; + event.code = kScriptEvent; + event.op = kEventThreadWake; + event.param = kWaitTypePlacard; + + q_event = _vm->_events->chain(q_event, &event); +} + void Scene::clearPsychicProfile() { if (_vm->_interface->getMode() == kPanelPlacard) { _vm->_scene->clearPlacard(); diff --git a/engines/saga/scene.h b/engines/saga/scene.h index 9666a6a6e8..da97bddff5 100644 --- a/engines/saga/scene.h +++ b/engines/saga/scene.h @@ -341,6 +341,7 @@ class Scene { } void clearPlacard(); + void showPsychicProfile(const char *text); void clearPsychicProfile(); void showIHNMDemoSpecialScreen(); diff --git a/engines/saga/script.h b/engines/saga/script.h index 04181ae7d2..74f26142bd 100644 --- a/engines/saga/script.h +++ b/engines/saga/script.h @@ -591,9 +591,9 @@ private: void sfScriptStartVideo(SCRIPTFUNC_PARAMS); void sfScriptReturnFromVideo(SCRIPTFUNC_PARAMS); void sfScriptEndVideo(SCRIPTFUNC_PARAMS); - void sf87(SCRIPTFUNC_PARAMS); - void sf88(SCRIPTFUNC_PARAMS); - void sf89(SCRIPTFUNC_PARAMS); + void sfShowIHNMDemoHelp(SCRIPTFUNC_PARAMS); + void sfShowIHNMDemoHelpText(SCRIPTFUNC_PARAMS); + void sfClearIHNMDemoHelpText(SCRIPTFUNC_PARAMS); void sfGetPoints(SCRIPTFUNC_PARAMS); void sfSetGlobalFlag(SCRIPTFUNC_PARAMS); void sf92(SCRIPTFUNC_PARAMS); diff --git a/engines/saga/sfuncs.cpp b/engines/saga/sfuncs.cpp index a41ecfa6e8..8a5b52fd25 100644 --- a/engines/saga/sfuncs.cpp +++ b/engines/saga/sfuncs.cpp @@ -225,9 +225,9 @@ static const ScriptFunctionDescription IHNMscriptFunctionsList[IHNM_SCRIPT_FUNCT OPCODE(sfScriptReturnFromVideo), OPCODE(sfScriptEndVideo), OPCODE(sfSetActorZ), - OPCODE(sf87), - OPCODE(sf88), - OPCODE(sf89), + OPCODE(sfShowIHNMDemoHelp), + OPCODE(sfShowIHNMDemoHelpText), + OPCODE(sfClearIHNMDemoHelpText), OPCODE(sfVstopFX), OPCODE(sfVstopLoopedFX), OPCODE(sf92), // only used in the demo version of IHNM @@ -1417,95 +1417,10 @@ void Script::sfPlacardOff(SCRIPTFUNC_PARAMS) { } void Script::sfPsychicProfile(SCRIPTFUNC_PARAMS) { - int stringId, textHeight; - static PalEntry cur_pal[PAL_ENTRIES]; - PalEntry *pal; - TextListEntry textEntry; - Event event; - Event *q_event; - thread->wait(kWaitTypePlacard); - _vm->_interface->rememberMode(); - _vm->_interface->setMode(kPanelPlacard); - _vm->_gfx->savePalette(); - - stringId = thread->pop(); - - event.type = kEvTOneshot; - event.code = kCursorEvent; - event.op = kEventHide; - - q_event = _vm->_events->queue(&event); - - _vm->_gfx->getCurrentPal(cur_pal); - - event.type = kEvTImmediate; - event.code = kPalEvent; - event.op = kEventPalToBlack; - event.time = 0; - event.duration = kNormalFadeDuration; - event.data = cur_pal; - - q_event = _vm->_events->chain(q_event, &event); - - event.type = kEvTOneshot; - event.code = kInterfaceEvent; - event.op = kEventClearStatus; - - q_event = _vm->_events->chain(q_event, &event); - - event.type = kEvTOneshot; - event.code = kGraphicsEvent; - event.op = kEventSetFlag; - event.param = RF_PLACARD; - - q_event = _vm->_events->chain(q_event, &event); - - // Set the background and palette for the psychic profile - event.type = kEvTOneshot; - event.code = kPsychicProfileBgEvent; - - q_event = _vm->_events->chain(q_event, &event); - - textHeight = _vm->_font->getHeight(kKnownFontVerb, thread->_strings->getString(stringId), 226, kFontCentered); - - textEntry.knownColor = kKnownColorBlack; - textEntry.useRect = true; - textEntry.rect.left = 245; - textEntry.rect.setHeight(210 + 76); - textEntry.rect.setWidth(226); - textEntry.rect.top = 210 - textHeight; - textEntry.font = kKnownFontVerb; - textEntry.flags = (FontEffectFlags)(kFontCentered); - textEntry.text = thread->_strings->getString(stringId); - - _placardTextEntry = _vm->_scene->_textList.addEntry(textEntry); - - event.type = kEvTOneshot; - event.code = kTextEvent; - event.op = kEventDisplay; - event.data = _placardTextEntry; - - q_event = _vm->_events->chain(q_event, &event); - - _vm->_scene->getBGPal(pal); - - event.type = kEvTImmediate; - event.code = kPalEvent; - event.op = kEventBlackToPal; - event.time = 0; - event.duration = kNormalFadeDuration; - event.data = pal; - - q_event = _vm->_events->chain(q_event, &event); - - event.type = kEvTOneshot; - event.code = kScriptEvent; - event.op = kEventThreadWake; - event.param = kWaitTypePlacard; - - q_event = _vm->_events->chain(q_event, &event); + int stringId = thread->pop(); + _vm->_scene->showPsychicProfile(thread->_strings->getString(stringId)); } void Script::sfPsychicProfileOff(SCRIPTFUNC_PARAMS) { @@ -2083,16 +1998,52 @@ void Script::sfScriptEndVideo(SCRIPTFUNC_PARAMS) { _vm->_anim->endVideo(); } -void Script::sf87(SCRIPTFUNC_PARAMS) { - SF_stub("sf87", thread, nArgs); +void Script::sfShowIHNMDemoHelp(SCRIPTFUNC_PARAMS) { + thread->wait(kWaitTypePlacard); + + _vm->_scene->showPsychicProfile(NULL); } -void Script::sf88(SCRIPTFUNC_PARAMS) { - SF_stub("sf88", thread, nArgs); +void Script::sfShowIHNMDemoHelpText(SCRIPTFUNC_PARAMS) { + int stringId, textHeight; + TextListEntry textEntry; + Event event; + + stringId = thread->pop(); + + // FIXME: This is called multiple times in a row, one for each page of the help screens. We should wait + // somehow before showing the next page + + textHeight = _vm->_font->getHeight(kKnownFontVerb, thread->_strings->getString(stringId), 226, kFontCentered); + + textEntry.knownColor = kKnownColorBlack; + textEntry.useRect = true; + textEntry.rect.left = 245; + textEntry.rect.setHeight(210 + 76); + textEntry.rect.setWidth(226); + textEntry.rect.top = 210 - textHeight; + textEntry.font = kKnownFontVerb; + textEntry.flags = (FontEffectFlags)(kFontCentered); + textEntry.text = thread->_strings->getString(stringId); + + TextListEntry *_psychicProfileTextEntry = _vm->_scene->_textList.addEntry(textEntry); + + event.type = kEvTOneshot; + event.code = kTextEvent; + event.op = kEventDisplay; + event.data = _psychicProfileTextEntry; + + _vm->_events->queue(&event); } -void Script::sf89(SCRIPTFUNC_PARAMS) { - SF_stub("sf89", thread, nArgs); +void Script::sfClearIHNMDemoHelpText(SCRIPTFUNC_PARAMS) { + thread->wait(kWaitTypePlacard); + + // This is called a while after the psychic profile is + // opened in the IHNM demo, to flip through the help system pages + _vm->_scene->clearPsychicProfile(); + // FIXME: The demo uses mode 8 when changing pages + //_vm->_interface->setMode(8); } void Script::sfVstopFX(SCRIPTFUNC_PARAMS) { |