aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFlorian Kagerer2009-03-01 20:37:57 +0000
committerFlorian Kagerer2009-03-01 20:37:57 +0000
commitb42b7a8b40cacdd226b05fe70882a8e5c69e2b55 (patch)
tree2aec1ea8f9a8907a09ffbf4e16ed7550ddce92ee /engines
parentbf894deb06f7a26e3962031cd4e7e53c51e7d87b (diff)
downloadscummvm-rg350-b42b7a8b40cacdd226b05fe70882a8e5c69e2b55.tar.gz
scummvm-rg350-b42b7a8b40cacdd226b05fe70882a8e5c69e2b55.tar.bz2
scummvm-rg350-b42b7a8b40cacdd226b05fe70882a8e5c69e2b55.zip
LOL: implement some opcodes for dialogue sequences
svn-id: r39051
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/gui_lol.cpp2
-rw-r--r--engines/kyra/lol.cpp2
-rw-r--r--engines/kyra/lol.h10
-rw-r--r--engines/kyra/script_lol.cpp85
-rw-r--r--engines/kyra/sprites_lol.cpp3
-rw-r--r--engines/kyra/staticres.cpp2
-rw-r--r--engines/kyra/text_lol.cpp4
-rw-r--r--engines/kyra/text_lol.h4
8 files changed, 96 insertions, 16 deletions
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp
index 34ae13b000..379eb304b6 100644
--- a/engines/kyra/gui_lol.cpp
+++ b/engines/kyra/gui_lol.cpp
@@ -1342,7 +1342,7 @@ int LoLEngine::clickedWall(Button *button) {
return res;
}
-int LoLEngine::clickedScene(Button *button) {
+int LoLEngine::clickedSequenceWindow(Button *button) {
return 1;
}
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 96fddd8660..513f45fd51 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -1428,7 +1428,7 @@ bool LoLEngine::characterSays(int track, int charId, bool redraw) {
return r ? textEnabled() : 1;
}
-int LoLEngine::playCharacterScriptChat(int charId, int mode, int unk1, char *str, EMCState *script, int16 *paramList, int16 paramIndex) {
+int LoLEngine::playCharacterScriptChat(int charId, int mode, int unk1, char *str, EMCState *script, const uint16 *paramList, int16 paramIndex) {
int ch = 0;
bool skipAnim = false;
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index 23ae1831df..673dbdd9dd 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -434,7 +434,7 @@ private:
int clickedInventorySlot(Button *button);
int clickedInventoryScroll(Button *button);
int clickedWall(Button *button);
- int clickedScene(Button *button);
+ int clickedSequenceWindow(Button *button);
int clickedScroll(Button *button);
int clickedUnk23(Button *button);
int clickedUnk24(Button *button);
@@ -468,7 +468,7 @@ private:
// text
bool characterSays(int track, int charId, bool redraw);
- int playCharacterScriptChat(int charId, int y, int unk1, char *str, EMCState *script, int16 *paramList, int16 paramIndex);
+ int playCharacterScriptChat(int charId, int y, int unk1, char *str, EMCState *script, const uint16 *paramList, int16 paramIndex);
TextDisplayer_LoL *_txt;
@@ -490,6 +490,7 @@ private:
uint16 _unkEMC46[16];
// emc opcode
+ int olol_drawScene(EMCState *script);
int olol_setGameFlag(EMCState *script);
int olol_testGameFlag(EMCState *script);
int olol_loadLevelGraphics(EMCState *script);
@@ -552,6 +553,11 @@ 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_fadeClearWindow(const TIM *tim, const uint16 *param);
+ int tlol_playDialogueTalkText(const TIM *tim, const uint16 *param);
+
Common::Array<const TIMOpcode*> _timIngameOpcodes;
// translation
diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp
index 77bfba3025..c81e0e4aa2 100644
--- a/engines/kyra/script_lol.cpp
+++ b/engines/kyra/script_lol.cpp
@@ -110,6 +110,12 @@ bool LoLEngine::checkSceneUpdateNeed(int func) {
return false;
}
+int LoLEngine::olol_drawScene(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_drawScene(%p) (%d)", (const void *)script, stackPos(0));
+ drawScene(stackPos(0));
+ return 1;
+}
+
int LoLEngine::olol_setGameFlag(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_setGameFlag(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
if (stackPos(1))
@@ -883,6 +889,75 @@ 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]);
+ this->initDialogueSequence(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]);
+ return 1;
+}
+
+int LoLEngine::tlol_fadeClearWindow(const TIM *tim, const uint16 *param) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::tlol_fadeClearWindow(%p, %p) (%d)", (const void*)tim, (const void*)param, param[0]);
+ uint8 *tmp = 0;
+
+ switch (param[0]) {
+ case 0:
+ _screen->fadeClearSceneWindow(10);
+ break;
+
+ case 1:
+ tmp = _screen->getPalette(3);
+ memcpy(tmp + 0x180, _screen->_currentPalette + 0x180, 0x180);
+ _screen->loadSpecialColours(tmp);
+ _screen->fadePalette(tmp, 10);
+ _screen->_fadeFlag = 0;
+ break;
+
+ case 2:
+ _screen->fadeToBlack(10);
+ break;
+
+ case 3:
+ tmp = _screen->getPalette(3);
+ _screen->loadSpecialColours(tmp);
+ _screen->fadePalette(tmp, 10);
+ _screen->_fadeFlag = 0;
+ break;
+
+ case 4:
+ if (_screen->_fadeFlag != 2)
+ _screen->fadeClearSceneWindow(10);
+ gui_drawPlayField();
+ _screen->setPaletteBrightness(_screen->_currentPalette, _brightness, _lampOilStatus);
+ _screen->_fadeFlag = 0;
+ break;
+
+ case 5:
+ tmp = _screen->getPalette(3);
+ _screen->loadSpecialColours(tmp);
+ _screen->fadePalette(_screen->getPalette(1), 10);
+ _screen->_fadeFlag = 0;
+ break;
+
+ default:
+ break;
+ }
+
+ return 1;
+}
+
+int LoLEngine::tlol_playDialogueTalkText(const TIM *tim, const uint16 *param) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::tlol_playDialogueTalkText(%p, %p) (%d)", (const void*)tim, (const void*)param, param[0]);
+ if (!snd_playCharacterSpeech(param[0], 0, 0) || textEnabled())
+ _txt->printDialogueText(4, getLangString(param[0]), 0, param, 1);
+ return 1;
+}
+
#pragma mark -
typedef Common::Functor1Mem<EMCState*, int, LoLEngine> OpcodeV2;
@@ -902,7 +977,7 @@ void LoLEngine::setupOpcodeTable() {
// 0x00
OpcodeUnImpl();
OpcodeUnImpl();
- OpcodeUnImpl();
+ Opcode(olol_drawScene);
Opcode(o1_getRand);
// 0x04
@@ -1205,14 +1280,14 @@ void LoLEngine::setupOpcodeTable() {
SetTimOpcodeTable(_timIngameOpcodes);
// 0x00
- OpcodeTimUnImpl();
- OpcodeTimUnImpl();
+ OpcodeTim(tlol_initDialogueSequence);
+ OpcodeTim(tlol_restoreSceneAfterDialogueSequence);
OpcodeTimUnImpl();
OpcodeTimUnImpl();
// 0x04
OpcodeTimUnImpl();
- OpcodeTimUnImpl();
+ OpcodeTim(tlol_fadeClearWindow);
OpcodeTimUnImpl();
OpcodeTimUnImpl();
@@ -1224,7 +1299,7 @@ void LoLEngine::setupOpcodeTable() {
// 0x0C
OpcodeTimUnImpl();
- OpcodeTimUnImpl();
+ OpcodeTim(tlol_playDialogueTalkText);
OpcodeTimUnImpl();
OpcodeTimUnImpl();
diff --git a/engines/kyra/sprites_lol.cpp b/engines/kyra/sprites_lol.cpp
index 603a45cb93..84d4fbce87 100644
--- a/engines/kyra/sprites_lol.cpp
+++ b/engines/kyra/sprites_lol.cpp
@@ -499,6 +499,7 @@ void LoLEngine::drawMonster(uint16 id) {
if (curFrm == -1) {
////////////
// TODO
+ curFrm=curFrm;
} else {
int d = m->flags & 7;
@@ -934,8 +935,6 @@ void LoLEngine::shiftMonster(MonsterInPlay *monster) {
if (monster->properties->flags & 0x400)
return;
-
-
}
} // end of namespace Kyra
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index df14925037..a45149a1e6 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -1861,7 +1861,7 @@ void LoLEngine::assignButtonCallback(Button *button, int index) {
cb(clickedInventoryScroll),
cb(clickedWall),
cb(clickedWall),
- cb(clickedScene),
+ cb(clickedSequenceWindow),
cb(clickedUpArrow),
cb(clickedDownArrow),
cb(clickedLeftArrow),
diff --git a/engines/kyra/text_lol.cpp b/engines/kyra/text_lol.cpp
index 7e4648149d..ac7d7c4a6c 100644
--- a/engines/kyra/text_lol.cpp
+++ b/engines/kyra/text_lol.cpp
@@ -131,7 +131,7 @@ void TextDisplayer_LoL::setAnimParameters(const char *str, int x, uint8 col1, ui
}
}
-void TextDisplayer_LoL::printDialogueText(int dim, char *str, EMCState *script, int16 *paramList, int16 paramIndex) {
+void TextDisplayer_LoL::printDialogueText(int dim, char *str, EMCState *script, const uint16 *paramList, int16 paramIndex) {
_colour1prot = false;
int oldDim = _screen->curDimIndex();
@@ -213,7 +213,7 @@ void TextDisplayer_LoL::printMessage(uint16 type, char *str, ...) {
_vm->_fadeText = false;
}
-void TextDisplayer_LoL::preprocessString(char *str, EMCState *script, int16 *paramList, int16 paramIndex) {
+void TextDisplayer_LoL::preprocessString(char *str, EMCState *script, const uint16 *paramList, int16 paramIndex) {
char *dst = _dialogueBuffer;
for (char *s = str; *s;) {
diff --git a/engines/kyra/text_lol.h b/engines/kyra/text_lol.h
index cc31480e7b..82eebd862d 100644
--- a/engines/kyra/text_lol.h
+++ b/engines/kyra/text_lol.h
@@ -44,7 +44,7 @@ public:
void setupField(bool mode);
void expandField();
- void printDialogueText(int dim, char *str, EMCState *script, int16 *paramList, int16 paramIndex);
+ void printDialogueText(int dim, char *str, EMCState *script, const uint16 *paramList, int16 paramIndex);
void printMessage(uint16 type, char *str, ...);
int16 _scriptParameter;
@@ -54,7 +54,7 @@ private:
char parseCommand();
void readNextPara();
void printLine(char *str);
- void preprocessString(char *str, EMCState *script, int16 *paramList, int16 paramIndex);
+ void preprocessString(char *str, EMCState *script, const uint16 *paramList, int16 paramIndex);
//typedef void (LoLEngine::*DialogueAnimCallback)(const char *str, uint16 lineWidth, uint8 col1, uint8 col2);
//DialogueAnimCallback _dlgAnimCallback;