aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFlorian Kagerer2009-05-11 20:44:43 +0000
committerFlorian Kagerer2009-05-11 20:44:43 +0000
commit0561caa447857445b585327a6e2b087019af8eac (patch)
treee644366e8d52c3e61c019e9d8a0644ba299758a3 /engines
parentd5b9437fb315292292ffa21c04b1003e656a2838 (diff)
downloadscummvm-rg350-0561caa447857445b585327a6e2b087019af8eac.tar.gz
scummvm-rg350-0561caa447857445b585327a6e2b087019af8eac.tar.bz2
scummvm-rg350-0561caa447857445b585327a6e2b087019af8eac.zip
LOL: - implemented olol_paletteFlash()
svn-id: r40466
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/lol.cpp24
-rw-r--r--engines/kyra/lol.h2
-rw-r--r--engines/kyra/script_lol.cpp35
3 files changed, 59 insertions, 2 deletions
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 00753a5bf6..f29499d67e 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -1611,6 +1611,28 @@ void LoLEngine::generateBrightnessPalette(uint8 *src, uint8 *dst, int brightness
}
}
+void LoLEngine::generateFlashPalette(uint8 *src, uint8 *dst, int colorFlags) {
+ if (!src || !dst)
+ return;
+
+ memcpy(dst, src, 6);
+
+ uint8 *s = src + 6;
+ uint8 *d = dst + 6;
+
+ for (int i = 2; i < 128; i++) {
+ for (int ii = 0; ii < 3; ii++) {
+ uint8 t = *s++ & 0x3f;
+ if (colorFlags & (1 << ii))
+ t += ((0x3f - t) >> 1);
+ else
+ t -= (t >> 1);
+ *d++ = t;
+ }
+ }
+ memcpy(d, s, 384);
+}
+
void LoLEngine::updateSequenceBackgroundAnimations() {
if (_updateFlags & 8)
return;
@@ -2111,7 +2133,7 @@ int LoLEngine::castSpell(int charNum, int spellType, int spellLevel) {
if (_activeSpell.p->hpRequired[spellLevel] >= _characters[charNum].hitPointsCur)
return 0;
- setCharacterMagicOrHitPoints(charNum, 1, -_activeSpell.p->mpRequired[spellLevel], 1);
+ //setCharacterMagicOrHitPoints(charNum, 1, -_activeSpell.p->mpRequired[spellLevel], 1);
setCharacterMagicOrHitPoints(charNum, 0, -_activeSpell.p[1].hpRequired[spellLevel], 1);
gui_drawCharPortraitWithStats(charNum);
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index 581007d4b0..a842c573ef 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -694,6 +694,7 @@ private:
int olol_enableSysTimer(EMCState *script);
int olol_checkNeedSceneRestore(EMCState *script);
int olol_castSpell(EMCState *script);
+ int olol_paletteFlash(EMCState *script);
int olol_disableControls(EMCState *script);
int olol_enableControls(EMCState *script);
int olol_characterSays(EMCState *script);
@@ -759,6 +760,7 @@ private:
void fadeText();
void setPaletteBrightness(uint8 *palette, int brightness, int modifier);
void generateBrightnessPalette(uint8 *src, uint8 *dst, int brightness, int modifier);
+ void generateFlashPalette(uint8 *src, uint8 *dst, int colorFlags);
void updateSequenceBackgroundAnimations();
void savePage5();
void restorePage5();
diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp
index 0a42fffc76..8a44e3c0d3 100644
--- a/engines/kyra/script_lol.cpp
+++ b/engines/kyra/script_lol.cpp
@@ -1663,6 +1663,39 @@ int LoLEngine::olol_castSpell(EMCState *script) {
return castSpell(stackPos(0), stackPos(1), stackPos(2));
}
+int LoLEngine::olol_paletteFlash(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_paletteFlash(%p) (%d)", (const void *)script, stackPos(0));
+ uint8 *s = _screen->getPalette(1);
+ uint8 *d = _screen->getPalette(3);
+ uint8 ovl[256];
+ generateFlashPalette(s, d, stackPos(0));
+ _screen->loadSpecialColors(s);
+ _screen->loadSpecialColors(d);
+
+ if (_smoothScrollModeNormal) {
+ for (int i = 0; i < 256; i++)
+ ovl[i] = i;
+ ovl[1] = 6;
+ _screen->copyRegion(112, 0, 112, 0, 176, 120, 0, 2);
+ _screen->applyOverlay(112, 0, 176, 120, 0, ovl);
+ }
+
+ _screen->setScreenPalette(d);
+ _screen->updateScreen();
+
+ delay(2 * _tickLength);
+
+ _screen->setScreenPalette(s);
+ _screen->updateScreen();
+
+ if (_smoothScrollModeNormal) {
+ _screen->copyRegion(112, 0, 112, 0, 176, 120, 2, 0);
+ _screen->updateScreen();
+ }
+
+ return 0;
+}
+
int LoLEngine::olol_disableControls(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_disableControls(%p) (%d)", (const void *)script, stackPos(0));
return gui_disableControls(stackPos(0));
@@ -2218,7 +2251,7 @@ void LoLEngine::setupOpcodeTable() {
OpcodeUnImpl();
// 0xB0
- OpcodeUnImpl();
+ Opcode(olol_paletteFlash);
OpcodeUnImpl();
Opcode(olol_dummy1); // anim buffer select?
Opcode(olol_disableControls);