Partially implemented opcodes 87, 88 and 89, used in the help system of the IHNM demo. It's still buggy, though
svn-id: r28398
This commit is contained in:
parent
6a82a3fbfc
commit
63f3d5b253
5 changed files with 173 additions and 115 deletions
|
@ -463,12 +463,18 @@ void Interface::setMode(int mode) {
|
|||
_vm->_render->setFlag(RF_DEMO_SUBST);
|
||||
break;
|
||||
case kPanelProtect:
|
||||
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,6 +677,7 @@ bool Interface::processAscii(uint16 ascii) {
|
|||
keyBossExit();
|
||||
break;
|
||||
case kPanelProtect:
|
||||
if (_vm->getGameType() == GType_ITE) {
|
||||
if (_textInput && processTextInput(ascii)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -684,6 +691,12 @@ bool Interface::processAscii(uint16 ascii) {
|
|||
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:
|
||||
if (_vm->getGameType() == GType_IHNM) {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -341,6 +341,7 @@ class Scene {
|
|||
}
|
||||
|
||||
void clearPlacard();
|
||||
void showPsychicProfile(const char *text);
|
||||
void clearPsychicProfile();
|
||||
void showIHNMDemoSpecialScreen();
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue