aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorFlorian Kagerer2009-03-10 00:32:20 +0000
committerFlorian Kagerer2009-03-10 00:32:20 +0000
commitf2a066e42fd8da2a6924e8094e680ad61e94a9b8 (patch)
tree19011301d7468c27be47b31a48fa98537f286fc0 /engines/kyra
parent2809c23fc9f70ce6542dcd2d1ee713d67965754c (diff)
downloadscummvm-rg350-f2a066e42fd8da2a6924e8094e680ad61e94a9b8.tar.gz
scummvm-rg350-f2a066e42fd8da2a6924e8094e680ad61e94a9b8.tar.bz2
scummvm-rg350-f2a066e42fd8da2a6924e8094e680ad61e94a9b8.zip
LOL: - some opcodes and interface code so that you can at least get out of the shops and Geron's room
svn-id: r39284
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/gui_lol.cpp3
-rw-r--r--engines/kyra/lol.cpp11
-rw-r--r--engines/kyra/lol.h9
-rw-r--r--engines/kyra/scene_lol.cpp5
-rw-r--r--engines/kyra/script_lol.cpp81
-rw-r--r--engines/kyra/script_tim.h5
6 files changed, 101 insertions, 13 deletions
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp
index ad4a7cc15c..4f56fa773e 100644
--- a/engines/kyra/gui_lol.cpp
+++ b/engines/kyra/gui_lol.cpp
@@ -1350,6 +1350,9 @@ int LoLEngine::clickedWall(Button *button) {
}
int LoLEngine::clickedSequenceWindow(Button *button) {
+ runLevelScript(calcNewBlockPosition(_currentBlock, _currentDirection), 0x40);
+ if (!_seqTrigger || !posWithinRect(_mouseX, _mouseY, _seqWindowX1, _seqWindowY1, _seqWindowX2, _seqWindowY2))
+ _seqTrigger = 0;
return 1;
}
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 102416c5ae..ceb756b3c7 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -152,7 +152,7 @@ LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(sy
_lastMouseRegion = 0;
_monsterLastWalkDirection = _monsterCountUnk = _monsterShiftAlt = 0;
_monsterCurBlock = 0;
- //_preSeq_X1 = _preSeq_Y1 = _preSeq_X2 = _preSeq_Y2 = 0;
+ _seqWindowX1 = _seqWindowY1 = _seqWindowX2 = _seqWindowY2 = _seqTrigger = 0;
_dscUnk1 = 0;
_dscShapeIndex = 0;
@@ -805,6 +805,7 @@ void LoLEngine::update() {
snd_characterSpeaking();
fadeText();
+ updateInput();
_screen->updateScreen();
}
@@ -1126,10 +1127,10 @@ void LoLEngine::toggleSelectedCharacterFrame(bool mode) {
void LoLEngine::gui_prepareForSequence(int x, int y, int w, int h, int buttonFlags) {
setSequenceGui(x, y, w, h, buttonFlags);
- /*_preSeq_X1 = x;
- _preSeq_Y1 = y;
- _preSeq_X2 = x + w;
- _preSeq_Y2 = y + h;*/
+ _seqWindowX1 = x;
+ _seqWindowY1 = y;
+ _seqWindowX2 = x + w;
+ _seqWindowY2 = y + h;
int mouseOffs = _itemInHand ? 10 : 0;
_screen->setMouseCursor(mouseOffs, mouseOffs, getItemIconShapePtr(_itemInHand));
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index 5e49012dab..f433de7f4c 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -519,7 +519,9 @@ private:
int olol_freeAnimStruct(EMCState *script);
int olol_getDirection(EMCState *script);
int olol_setMusicTrack(EMCState *script);
+ int olol_checkRectForMousePointer(EMCState *script);
int olol_clearDialogueField(EMCState *script);
+ int olol_loadBitmap(EMCState *script);
int olol_getGlobalScriptVar(EMCState *script);
int olol_setGlobalScriptVar(EMCState *script);
int olol_getGlobalVar(EMCState *script);
@@ -528,7 +530,9 @@ private:
int olol_updateSceneAnimations(EMCState *script);
int olol_mapShapeToBlock(EMCState *script);
int olol_resetBlockShapeAssignment(EMCState *script);
+ int olol_copyRegion(EMCState *script);
int olol_initMonster(EMCState *script);
+ int olol_fadeClearSceneWindow(EMCState *script);
int olol_loadMonsterProperties(EMCState *script);
int olol_moveMonster(EMCState *script);
int olol_dialogueBox(EMCState *script);
@@ -547,7 +551,9 @@ private:
int olol_getWallFlags(EMCState *script);
int olol_playCharacterScriptChat(EMCState *script);
int olol_update(EMCState *script);
+ int olol_drawExitButton(EMCState *script);
int olol_loadSoundFile(EMCState *script);
+ int olol_playMusicTrack(EMCState *script);
int olol_stopCharacterSpeech(EMCState *script);
int olol_setPaletteBrightness(EMCState *script);
int olol_printMessage(EMCState *script);
@@ -555,6 +561,7 @@ private:
int olol_checkForMonsterMode1(EMCState *script);
int olol_setNextFunc(EMCState *script);
int olol_setDoorState(EMCState *script);
+ int olol_processButtonClick(EMCState *script);
int olol_initNonAnimatedDialogue(EMCState *script);
int olol_restoreAfterNonAnimatedDialogue(EMCState *script);
int olol_assignCustomSfx(EMCState *script);
@@ -850,7 +857,7 @@ private:
int16 _dmScaleH;
int _lastMouseRegion;
- //int _preSeq_X1, _preSeq_Y1, _preSeq_X2, _preSeq_Y2;
+ int _seqWindowX1, _seqWindowY1, _seqWindowX2, _seqWindowY2, _seqTrigger;
uint8 _unkGameFlag;
uint8 *_tempBuffer5120;
diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp
index 2e0db82a04..994f7f817f 100644
--- a/engines/kyra/scene_lol.cpp
+++ b/engines/kyra/scene_lol.cpp
@@ -1163,6 +1163,10 @@ void LoLEngine::updateSceneWindow() {
void LoLEngine::setSequenceGui(int x, int y, int w, int h, int enableFlags) {
gui_enableSequenceButtons(x, y, w, h, enableFlags);
+ _seqWindowX1 = x;
+ _seqWindowY1 = y;
+ _seqWindowX2 = x + w;
+ _seqWindowY2 = y + h;
int offs = _itemInHand ? 10 : 0;
_screen->setMouseCursor(offs, offs, getItemIconShapePtr(_itemInHand));
setLampMode(0);
@@ -1171,6 +1175,7 @@ void LoLEngine::setSequenceGui(int x, int y, int w, int h, int enableFlags) {
void LoLEngine::restoreDefaultGui() {
gui_enableDefaultPlayfieldButtons();
+ _seqWindowX1 = _seqWindowY1 = _seqWindowX2 = _seqWindowY2 = _seqTrigger = 0;
if (_lampStatusSuspended)
resetLampStatus();
_lampStatusSuspended = false;
diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp
index d0f70d062b..2e6e9671ec 100644
--- a/engines/kyra/script_lol.cpp
+++ b/engines/kyra/script_lol.cpp
@@ -439,6 +439,11 @@ int LoLEngine::olol_setMusicTrack(EMCState *script) {
return 1;
}
+int LoLEngine::olol_checkRectForMousePointer(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_checkRectForMousePointer(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3));
+ return posWithinRect(_mouseX, _mouseY, stackPos(0), stackPos(1), stackPos(2), stackPos(3)) ? 1 : 0;
+}
+
int LoLEngine::olol_clearDialogueField(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_clearDialogueField(%p) (%d)", (const void *)script, stackPos(0));
if (_hideControls && (!textEnabled()))
@@ -452,6 +457,14 @@ int LoLEngine::olol_clearDialogueField(EMCState *script) {
return 1;
}
+int LoLEngine::olol_loadBitmap(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_clearDialogueField(%p) (%s, %d)", (const void *)script, stackPosString(0), stackPos(1));
+ _screen->loadBitmap(stackPosString(0), 3, 3, _screen->getPalette(3));
+ if (stackPos(1) != 2)
+ _screen->copyPage(3, stackPos(1));
+ return 1;
+}
+
int LoLEngine::olol_getGlobalScriptVar(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_getGlobalScriptVar(%p) (%d)", (const void *)script, stackPos(0));
assert(stackPos(0) < 16);
@@ -603,7 +616,16 @@ int LoLEngine::olol_resetBlockShapeAssignment(EMCState *script) {
return 1;
}
+int LoLEngine::olol_copyRegion(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_copyRegion(%p) (%d, %d, %d, %d, %d, %d, %d, %d)",
+ (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7));
+ _screen->copyRegion(stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7), Screen::CR_NO_P_CHECK);
+ return 1;
+}
+
int LoLEngine::olol_initMonster(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_initMonster(%p) (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)", (const void *)script,
+ stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7), stackPos(8), stackPos(9), stackPos(10));
uint16 x = 0;
uint16 y = 0;
calcCoordinates(x, y, stackPos(0), stackPos(1), stackPos(2));
@@ -653,6 +675,12 @@ int LoLEngine::olol_initMonster(EMCState *script) {
return -1;
}
+int LoLEngine::olol_fadeClearSceneWindow(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_fadeClearSceneWindow(%p)", (const void *)script);
+ _screen->fadeClearSceneWindow(10);
+ return 1;
+}
+
int LoLEngine::olol_loadMonsterProperties(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_loadMonsterProperties(%p) (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)",
(const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5),
@@ -841,12 +869,42 @@ int LoLEngine::olol_update(EMCState *script) {
return 1;
}
+int LoLEngine::olol_drawExitButton(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_drawExitButton(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
+
+ static const uint8 printPara[] = { 0x90, 0x78, 0x0C, 0x9F, 0x80, 0x1E };
+
+ int cp = _screen->setCurPage(0);
+ Screen::FontId cf = _screen->setFont(Screen::FID_6_FNT);
+ int x = printPara[3 * stackPos(0)] << 1;
+ int y = printPara[3 * stackPos(0) + 1];
+ int offs = printPara[3 * stackPos(0) + 2];
+
+ char *str = getLangString(0x4033);
+ int w = _screen->getTextWidth(str);
+
+ gui_drawBox(x - offs - w, y - 9, w + offs, 9, 136, 251, 252);
+ _screen->printText(str, x - (offs >> 1) - w, y - 7, 144, 0);
+
+ if (stackPos(1))
+ _screen->drawGridBox(x - offs - w + 1, y - 8, w + offs - 2, 7, 1);
+
+ _screen->setFont(cf);
+ _screen->setCurPage(cp);
+ return 1;
+}
+
int LoLEngine::olol_loadSoundFile(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_loadSoundFile(%p) (%d)", (const void *)script, stackPos(0));
snd_loadSoundFile(stackPos(0));
return 1;
}
+int LoLEngine::olol_playMusicTrack(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_playMusicTrack(%p) (%d)", (const void *)script, stackPos(0));
+ return snd_playTrack(stackPos(0));
+}
+
int LoLEngine::olol_stopCharacterSpeech(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_stopCharacterSpeech(%p)", (const void *)script);
snd_stopSpeech(1);
@@ -907,6 +965,15 @@ int LoLEngine::olol_setDoorState(EMCState *script) {
return _emcDoorState;
}
+int LoLEngine::olol_processButtonClick(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_processButtonClick(%p) (%d)", (const void *)script, stackPos(0));
+ int n = _tim->getNumberOfDialogueButtons();
+ _activeTim[stackPos(0)]->procFunc = 0;
+ _activeTim[stackPos(0)]->procParam = n ? n : 1;
+ _tim->setDialogueParameters(0, -1);
+ return 1;
+}
+
int LoLEngine::olol_initNonAnimatedDialogue(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_initNonAnimatedDialogue(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
initNonAnimatedDialogue(stackPos(0), stackPos(1));
@@ -1188,7 +1255,7 @@ void LoLEngine::setupOpcodeTable() {
// 0x20
OpcodeUnImpl();
- OpcodeUnImpl();
+ Opcode(olol_checkRectForMousePointer);
Opcode(olol_clearDialogueField);
OpcodeUnImpl();
@@ -1200,7 +1267,7 @@ void LoLEngine::setupOpcodeTable() {
// 0x28
OpcodeUnImpl();
- OpcodeUnImpl();
+ Opcode(olol_loadBitmap);
OpcodeUnImpl();
OpcodeUnImpl();
@@ -1220,11 +1287,11 @@ void LoLEngine::setupOpcodeTable() {
Opcode(olol_updateSceneAnimations);
Opcode(olol_mapShapeToBlock);
Opcode(olol_resetBlockShapeAssignment);
- OpcodeUnImpl();
+ Opcode(olol_copyRegion);
// 0x38
Opcode(olol_initMonster);
- OpcodeUnImpl();
+ Opcode(olol_fadeClearSceneWindow);
OpcodeUnImpl();
OpcodeUnImpl();
@@ -1285,11 +1352,11 @@ void LoLEngine::setupOpcodeTable() {
// 0x60
OpcodeUnImpl();
OpcodeUnImpl();
- OpcodeUnImpl();
+ Opcode(olol_drawExitButton);
Opcode(olol_loadSoundFile);
// 0x64
- OpcodeUnImpl();
+ Opcode(olol_playMusicTrack);
OpcodeUnImpl();
OpcodeUnImpl();
OpcodeUnImpl();
@@ -1340,7 +1407,7 @@ void LoLEngine::setupOpcodeTable() {
OpcodeUnImpl();
OpcodeUnImpl();
Opcode(olol_setDoorState);
- OpcodeUnImpl();
+ Opcode(olol_processButtonClick);
// 0x88
OpcodeUnImpl();
diff --git a/engines/kyra/script_tim.h b/engines/kyra/script_tim.h
index 76b4a3d90e..eb3d972fa2 100644
--- a/engines/kyra/script_tim.h
+++ b/engines/kyra/script_tim.h
@@ -118,6 +118,9 @@ public:
virtual void drawDialogueBox(int numStr, const char *s1, const char *s2, const char *s3) {}
virtual uint16 processDialogue() { return 1; }
+ void setDialogueParameters(int clickedButton, int dlgFunc) { _currentTim->clickedButton = clickedButton; _currentTim->dlgFunc = dlgFunc; }
+ virtual int getNumberOfDialogueButtons() { return 0; }
+
int _drawPage2;
int _palDelayInc, _palDiff, _palDelayAcc;
@@ -200,6 +203,8 @@ public:
void drawDialogueBox(int numStr, const char *s1, const char *s2, const char *s3);
uint16 processDialogue();
+
+ int getNumberOfDialogueButtons() { return _dialogueNumButtons; }
private:
KyraEngine_v1 *vm();