aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFlorian Kagerer2009-03-08 03:26:21 +0000
committerFlorian Kagerer2009-03-08 03:26:21 +0000
commitedc18a22994cbbe5b497d847440d0fc3cb776ac5 (patch)
treec8455bc0a8c55feb2c9bdf5c55f1e6ea365836c2 /engines
parente23fd08dfbdac9d6eedb78813d3504eeccba31a5 (diff)
downloadscummvm-rg350-edc18a22994cbbe5b497d847440d0fc3cb776ac5.tar.gz
scummvm-rg350-edc18a22994cbbe5b497d847440d0fc3cb776ac5.tar.bz2
scummvm-rg350-edc18a22994cbbe5b497d847440d0fc3cb776ac5.zip
LOL: some opcodes for the library room (so that the game will at least not freeze when clicking one of the books)
svn-id: r39210
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/lol.cpp34
-rw-r--r--engines/kyra/lol.h20
-rw-r--r--engines/kyra/script_lol.cpp74
-rw-r--r--engines/kyra/script_tim.h9
-rw-r--r--engines/kyra/timer.cpp6
5 files changed, 107 insertions, 36 deletions
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index e1df23e6ce..66739baf58 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -196,6 +196,7 @@ LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(sy
memset(_charStatsTemp, 0, 5 * sizeof(int));
_unkBt1 = _unkBt2 = 0;
+ _dialogueField = false;
_buttonData = 0;
_activeButtons = 0;
@@ -1096,7 +1097,7 @@ void LoLEngine::setupScreenDims() {
}
}
-void LoLEngine::initDialogueSequence(int controlMode) {
+void LoLEngine::initAnimatedDialogue(int controlMode) {
resetPortraitsArea();
gui_prepareForSequence(112, 0, 176, 120, controlMode);
@@ -1140,7 +1141,7 @@ void LoLEngine::gui_prepareForSequence(int x, int y, int w, int h, int buttonFla
}
}
-void LoLEngine::restoreSceneAfterDialogueSequence(int redraw) {
+void LoLEngine::restoreAfterAnimatedDialogue(int redraw) {
gui_enableControls();
_txt->setupField(false);
_updateFlags &= 0xffdf;
@@ -1164,6 +1165,35 @@ void LoLEngine::restoreSceneAfterDialogueSequence(int redraw) {
enableSysTimer(2);
}
+void LoLEngine::initNonAnimatedDialogue(int controlMode, int pageNum) {
+
+ _dialogueField = true;
+
+}
+
+void LoLEngine::restoreAfterNonAnimatedDialogue(int controlMode) {
+ if (!_dialogueField)
+ return;
+
+ updatePortraits();
+ _hideControls = controlMode;
+ calcCharPortraitXpos();
+
+ if (_hideControls) {
+ _screen->modifyScreenDim(4, 11, 124, 28, 45);
+ _screen->modifyScreenDim(5, 85, 123, 233, 54);
+ _updateFlags &= 0xfffd;
+ } else {
+ const ScreenDim *d = _screen->getScreenDim(5);
+ _screen->fillRect(d->sx, d->sy, d->sx + d->w - 2, d->sy + d->h - 2, d->unkA);
+ _screen->clearDim(4);
+ _screen->setScreenDim(4);
+ _txt->setupField(false);
+ }
+
+ _dialogueField = false;
+}
+
void LoLEngine::resetPortraitsArea() {
_hideInventory = 1;
if (!textEnabled() || (!(_hideControls & 2)))
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index 3ffdf736f6..91883117a1 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -529,19 +529,22 @@ private:
int olol_initMonster(EMCState *script);
int olol_loadMonsterProperties(EMCState *script);
int olol_moveMonster(EMCState *script);
+ int olol_dialogueBox(EMCState *script);
int olol_setScriptTimer(EMCState *script);
int olol_loadTimScript(EMCState *script);
int olol_runTimScript(EMCState *script);
int olol_releaseTimScript(EMCState *script);
- int olol_initDialogueSequence(EMCState *script);
- int olol_restoreSceneAfterDialogueSequence(EMCState *script);
+ int olol_initAnimatedDialogue(EMCState *script);
+ int olol_restoreAfterAnimatedDialogue(EMCState *script);
int olol_getItemInHand(EMCState *script);
int olol_giveItemToMonster(EMCState *script);
int olol_loadLangFile(EMCState *script);
int olol_playSoundEffect(EMCState *script);
+ int olol_processDialogue(EMCState *script);
int olol_stopTimScript(EMCState *script);
int olol_getWallFlags(EMCState *script);
int olol_playCharacterScriptChat(EMCState *script);
+ int olol_update(EMCState *script);
int olol_loadSoundFile(EMCState *script);
int olol_stopCharacterSpeech(EMCState *script);
int olol_setPaletteBrightness(EMCState *script);
@@ -550,6 +553,8 @@ private:
int olol_checkForMonsterMode1(EMCState *script);
int olol_setNextFunc(EMCState *script);
int olol_setDoorState(EMCState *script);
+ int olol_initNonAnimatedDialogue(EMCState *script);
+ int olol_restoreAfterNonAnimatedDialogue(EMCState *script);
int olol_assignCustomSfx(EMCState *script);
int olol_resetPortraitsArea(EMCState *script);
int olol_enableSysTimer(EMCState *script);
@@ -567,8 +572,8 @@ private:
int tlol_processWsaFrame(const TIM *tim, const uint16 *param);
int tlol_displayText(const TIM *tim, const uint16 *param);
- int tlol_initDialogueSequence(const TIM *tim, const uint16 *param);
- int tlol_restoreSceneAfterDialogueSequence(const TIM *tim, const uint16 *param);
+ int tlol_initAnimatedDialogue(const TIM *tim, const uint16 *param);
+ int tlol_restoreAfterAnimatedDialogue(const TIM *tim, const uint16 *param);
int tlol_giveItem(const TIM *tim, const uint16 *param);
int tlol_setPartyPosition(const TIM *tim, const uint16 *param);
int tlol_fadeClearWindow(const TIM *tim, const uint16 *param);
@@ -596,8 +601,10 @@ private:
// graphics
void setupScreenDims();
- void initDialogueSequence(int controlMode);
- void restoreSceneAfterDialogueSequence(int redraw);
+ void initAnimatedDialogue(int controlMode);
+ void restoreAfterAnimatedDialogue(int redraw);
+ void initNonAnimatedDialogue(int controlMode, int pageNum);
+ void restoreAfterNonAnimatedDialogue(int controlMode);
void resetPortraitsArea();
void toggleSelectedCharacterFrame(bool mode);
void fadeText();
@@ -605,6 +612,7 @@ private:
void generateBrightnessPalette(uint8 *src, uint8 *dst, int brightness, int modifier);
void updateWsaAnimations();
+ bool _dialogueField;
uint8 **_itemIconShapes;
int _numItemIconShapes;
uint8 **_itemShapes;
diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp
index 670c652f01..b4127a7774 100644
--- a/engines/kyra/script_lol.cpp
+++ b/engines/kyra/script_lol.cpp
@@ -716,6 +716,13 @@ int LoLEngine::olol_moveMonster(EMCState *script) {
return 1;
}
+int LoLEngine::olol_dialogueBox(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_dialogueBox(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3));
+
+ _tim->drawDialogueBox(stackPos(0), getLangString(stackPos(1)), getLangString(stackPos(2)), getLangString(stackPos(3)));
+ return 1;
+}
+
int LoLEngine::olol_setScriptTimer(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_setScriptTimer(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
uint8 id = 0x50 + stackPos(0);
@@ -728,7 +735,7 @@ int LoLEngine::olol_setScriptTimer(EMCState *script) {
_timer->disable(id);
}
- return true;
+ return 1;
}
int LoLEngine::olol_loadTimScript(EMCState *script) {
@@ -752,15 +759,15 @@ int LoLEngine::olol_releaseTimScript(EMCState *script) {
return 1;
}
-int LoLEngine::olol_initDialogueSequence(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_initDialogueSequence(%p) (%d)", (const void *)script, stackPos(0));
- initDialogueSequence(stackPos(0));
+int LoLEngine::olol_initAnimatedDialogue(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_initAnimatedDialogue(%p) (%d)", (const void *)script, stackPos(0));
+ initAnimatedDialogue(stackPos(0));
return 1;
}
-int LoLEngine::olol_restoreSceneAfterDialogueSequence(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_restoreSceneAfterDialogueSequence(%p) (%d)", (const void *)script, stackPos(0));
- restoreSceneAfterDialogueSequence(stackPos(0));
+int LoLEngine::olol_restoreAfterAnimatedDialogue(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_restoreAfterAnimatedDialogue(%p) (%d)", (const void *)script, stackPos(0));
+ restoreAfterAnimatedDialogue(stackPos(0));
return 1;
}
@@ -793,6 +800,11 @@ int LoLEngine::olol_playSoundEffect(EMCState *script) {
return 1;
}
+int LoLEngine::olol_processDialogue(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_processDialogue(%p)", (const void *)script);
+ return _tim->processDialogue();
+}
+
int LoLEngine::olol_stopTimScript(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_stopTimScript(%p) (%d)", (const void *)script, stackPos(0));
_tim->stopAllFuncs(_activeTim[stackPos(0)]);
@@ -811,6 +823,12 @@ int LoLEngine::olol_playCharacterScriptChat(EMCState *script) {
return playCharacterScriptChat(stackPos(0), stackPos(1), 1, getLangString(stackPos(2)), script, 0, 3);
}
+int LoLEngine::olol_update(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_update(%p)", (const void *)script);
+ update();
+ 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));
@@ -877,6 +895,18 @@ int LoLEngine::olol_setDoorState(EMCState *script) {
return _emcDoorState;
}
+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));
+ return 1;
+}
+
+int LoLEngine::olol_restoreAfterNonAnimatedDialogue(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_restoreAfterNonAnimatedDialogue(%p) (%d)", (const void *)script, stackPos(0));
+ restoreAfterNonAnimatedDialogue(stackPos(0));
+ return 1;
+}
+
int LoLEngine::olol_assignCustomSfx(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_assignCustomSfx(%p) (%s, %d)", (const void *)script, stackPosString(0), stackPos(1));
const char *c = stackPosString(0);
@@ -965,15 +995,15 @@ int LoLEngine::tlol_displayText(const TIM *tim, const uint16 *param) {
return 1;
}
-int LoLEngine::tlol_initDialogueSequence(const TIM *tim, const uint16 *param) {
- debugC(3, kDebugLevelScriptFuncs, "LoLEngine::tlol_initDialogueSequence(%p, %p) (%d)", (const void*)tim, (const void*)param, param[0]);
- initDialogueSequence(param[0]);
+int LoLEngine::tlol_initAnimatedDialogue(const TIM *tim, const uint16 *param) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::tlol_initAnimatedDialogue(%p, %p) (%d)", (const void*)tim, (const void*)param, param[0]);
+ initAnimatedDialogue(param[0]);
return 1;
}
-int LoLEngine::tlol_restoreSceneAfterDialogueSequence(const TIM *tim, const uint16 *param) {
- debugC(3, kDebugLevelScriptFuncs, "LoLEngine::tlol_restoreSceneAfterDialogueSequence(%p, %p) (%d)", (const void*)tim, (const void*)param, param[0]);
- restoreSceneAfterDialogueSequence(param[0]);
+int LoLEngine::tlol_restoreAfterAnimatedDialogue(const TIM *tim, const uint16 *param) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::tlol_restoreAfterAnimatedDialogue(%p, %p) (%d)", (const void*)tim, (const void*)param, param[0]);
+ restoreAfterAnimatedDialogue(param[0]);
return 1;
}
@@ -1200,7 +1230,7 @@ void LoLEngine::setupOpcodeTable() {
// 0x44
Opcode(olol_moveMonster);
- OpcodeUnImpl();
+ Opcode(olol_dialogueBox);
OpcodeUnImpl();
OpcodeUnImpl();
@@ -1218,8 +1248,8 @@ void LoLEngine::setupOpcodeTable() {
// 0x50
Opcode(olol_releaseTimScript);
- Opcode(olol_initDialogueSequence);
- Opcode(olol_restoreSceneAfterDialogueSequence);
+ Opcode(olol_initAnimatedDialogue);
+ Opcode(olol_restoreAfterAnimatedDialogue);
Opcode(olol_getItemInHand);
// 0x54
@@ -1229,7 +1259,7 @@ void LoLEngine::setupOpcodeTable() {
Opcode(olol_playSoundEffect);
// 0x58
- OpcodeUnImpl();
+ Opcode(olol_processDialogue);
Opcode(olol_stopTimScript);
Opcode(olol_getWallFlags);
OpcodeUnImpl();
@@ -1238,7 +1268,7 @@ void LoLEngine::setupOpcodeTable() {
OpcodeUnImpl();
OpcodeUnImpl();
Opcode(olol_playCharacterScriptChat);
- OpcodeUnImpl();
+ Opcode(olol_update);
// 0x60
OpcodeUnImpl();
@@ -1307,8 +1337,8 @@ void LoLEngine::setupOpcodeTable() {
OpcodeUnImpl();
// 0x8C
- OpcodeUnImpl();
- OpcodeUnImpl();
+ Opcode(olol_initNonAnimatedDialogue);
+ Opcode(olol_restoreAfterNonAnimatedDialogue);
OpcodeUnImpl();
OpcodeUnImpl();
@@ -1402,8 +1432,8 @@ void LoLEngine::setupOpcodeTable() {
SetTimOpcodeTable(_timIngameOpcodes);
// 0x00
- OpcodeTim(tlol_initDialogueSequence);
- OpcodeTim(tlol_restoreSceneAfterDialogueSequence);
+ OpcodeTim(tlol_initAnimatedDialogue);
+ OpcodeTim(tlol_restoreAfterAnimatedDialogue);
OpcodeTimUnImpl();
OpcodeTim(tlol_giveItem);
diff --git a/engines/kyra/script_tim.h b/engines/kyra/script_tim.h
index 63339e95b5..76b4a3d90e 100644
--- a/engines/kyra/script_tim.h
+++ b/engines/kyra/script_tim.h
@@ -115,6 +115,9 @@ public:
void displayText(uint16 textId, int16 flags);
void setupTextPalette(uint index, int fadePalette);
+ virtual void drawDialogueBox(int numStr, const char *s1, const char *s2, const char *s3) {}
+ virtual uint16 processDialogue() { return 1; }
+
int _drawPage2;
int _palDelayInc, _palDiff, _palDelayAcc;
@@ -139,7 +142,6 @@ protected:
virtual void update() {}
virtual void checkSpeechProgress() {}
- virtual uint16 processDialogue() { return 1; }
char _audioFilename[32];
@@ -195,6 +197,9 @@ friend class LoLEngine;
public:
TIMInterpreter_LoL(LoLEngine *engine, Screen_v2 *screen_v2, OSystem *system);
Animation *initAnimStruct(int index, const char *filename, int x, int y, int copyPara, int, uint16 wsaFlags);
+
+ void drawDialogueBox(int numStr, const char *s1, const char *s2, const char *s3);
+ uint16 processDialogue();
private:
KyraEngine_v1 *vm();
@@ -202,12 +207,10 @@ private:
void update();
void checkSpeechProgress();
- uint16 processDialogue();
char *getTableString(int id);
void advanceToOpcode(int opcode);
- void drawDialogueBox(int numStr, const char *s1, const char *s2, const char *s3);
void drawDialogueButtons();
LoLEngine *_vm;
diff --git a/engines/kyra/timer.cpp b/engines/kyra/timer.cpp
index c3ebad852a..fb22854b94 100644
--- a/engines/kyra/timer.cpp
+++ b/engines/kyra/timer.cpp
@@ -228,10 +228,10 @@ void TimerManager::pauseSingleTimer(uint8 id, bool p) {
if (p) {
timer->pauseStartTime = _system->getMillis();
- timer->enabled ^= 2;
+ timer->enabled |= 2;
} else if (timer->pauseStartTime) {
int32 elapsedTime = _system->getMillis() - timer->pauseStartTime;
- timer->enabled ^= 2;
+ timer->enabled &= (~2);
timer->lastUpdate += elapsedTime;
timer->nextRun += elapsedTime;
resync();
@@ -265,7 +265,7 @@ void TimerManager::disable(uint8 id) {
Iterator timer = Common::find_if(_timers.begin(), _timers.end(), TimerEqual(id));
if (timer != _timers.end())
- timer->enabled &= 2;
+ timer->enabled &= (~1);
else
warning("TimerManager::disable: No timer %d", id);
}