aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorFlorian Kagerer2009-09-19 23:51:19 +0000
committerFlorian Kagerer2009-09-19 23:51:19 +0000
commit5acbc3c4828c5e7cbf048caf17383e8c7db03a78 (patch)
tree967a40f86aedc9a3ce25838a599209f20c831e43 /engines/kyra
parentea2b6d12dca199eece9b9a8e9ecc9d877d5b5aa4 (diff)
downloadscummvm-rg350-5acbc3c4828c5e7cbf048caf17383e8c7db03a78.tar.gz
scummvm-rg350-5acbc3c4828c5e7cbf048caf17383e8c7db03a78.tar.bz2
scummvm-rg350-5acbc3c4828c5e7cbf048caf17383e8c7db03a78.zip
LOL/PC-98: fixed block drawing (colors are still wrong)
svn-id: r44198
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/lol.cpp7
-rw-r--r--engines/kyra/lol.h1
-rw-r--r--engines/kyra/scene_lol.cpp35
-rw-r--r--engines/kyra/script_lol.cpp61
4 files changed, 66 insertions, 38 deletions
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 74fce1e8fa..449610d382 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -158,6 +158,7 @@ LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(sy
_lampEffect = _brightness = _lampOilStatus = 0;
_lampStatusSuspended = false;
+ _blockBrightness = 0;
_tempBuffer5120 = 0;
_flyingObjects = 0;
_monsters = 0;
@@ -799,8 +800,8 @@ void LoLEngine::startup() {
static const uint8 colTable3[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF };
for (int i = 0; i < 16; i++) {
- _screen->_paletteOverlay2[colTable3[i]] = colTable1[i];
- _screen->_paletteOverlay1[colTable3[i]] = colTable2[i];
+ _screen->_paletteOverlay1[colTable3[i]] = colTable1[i];
+ _screen->_paletteOverlay2[colTable3[i]] = colTable2[i];
}
} else {
@@ -1709,7 +1710,7 @@ void LoLEngine::generateBrightnessPalette(const Palette &src, Palette &dst, int
modifier >>= 1;
if (modifier)
modifier--;
- brightness = 16 * modifier;
+ _blockBrightness = 16 * modifier;
} else {
_screen->loadSpecialColors(dst);
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index d67d61788a..f1da207e57 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -974,6 +974,7 @@ private:
int _lampOilStatus;
uint32 _lampStatusTimer;
bool _lampStatusSuspended;
+ uint8 _blockBrightness;
// level
void loadLevel(int index);
diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp
index 89d9b7be64..50d00fbf2a 100644
--- a/engines/kyra/scene_lol.cpp
+++ b/engines/kyra/scene_lol.cpp
@@ -400,13 +400,6 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight
delete[] _vcnBlocks;
_vcnBlocks = new uint8[vcnLen];
- if (_vcnShift)
- delete[] _vcnShift;
- _vcnShift = new uint8[tlen];
-
- memcpy(_vcnShift, v, tlen);
- v += tlen;
-
if (_flags.use16ColorMode) {
_screen->getPalette(0).fill(0, 16, 0xff);
_screen->loadPalette("LOL.NOL", _screen->getPalette(0));
@@ -416,8 +409,14 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight
for (int i = 15; i >= 0; i--)
pl.copy(pl, i, 1, colTable[i]);*/
- v += 128;
} else {
+ if (_vcnShift)
+ delete[] _vcnShift;
+ _vcnShift = new uint8[tlen];
+
+ memcpy(_vcnShift, v, tlen);
+ v += tlen;
+
memcpy(_vcnExpTable, v, 128);
v += 128;
@@ -426,9 +425,9 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight
} else {
_screen->getPalette(0).copy(v, 0, 128);
}
- }
- v += 384;
+ v += 384;
+ }
if (_currentLevel == 11) {
_screen->loadPalette("SWAMPICE.COL", _screen->getPalette(2));
@@ -488,12 +487,12 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight
for (int i = 0; i < 7; i++)
memcpy(_screen->getLevelOverlay(i), _screen->getLevelOverlay(i + 1), 256);
- //static const uint8 colTable[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF };
+ static const uint8 colTable[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF };
for (int i = 0; i < 8; i++) {
uint8 *pl = _screen->getLevelOverlay(7 - i);
for (int ii = 15; ii >= 0; ii--)
- _vcnExpTable[((7 - i) << 4) + ii] = pl[/*colTable[*/ii/*]*/];
+ _vcnExpTable[((7 - i) << 4) + ii] = pl[colTable[ii]];
}
}
@@ -1821,17 +1820,21 @@ void LoLEngine::drawVcnBlocks() {
vcnOffset &= 0x3fff;
}
- if (!vcnOffset) {
+ uint8 *src = 0;
+ if (vcnOffset) {
+ src = &_vcnBlocks[vcnOffset << 5];
+ } else {
// floor/ceiling blocks
vcnOffset = bdb[329];
if (vcnOffset & 0x4000) {
horizontalFlip = true;
vcnOffset &= 0x3fff;
}
+
+ src = (_vcfBlocks ? _vcfBlocks : _vcnBlocks) + (vcnOffset << 5);
}
- uint8 shift = _vcnShift[vcnOffset];
- uint8 *src = &_vcnBlocks[vcnOffset << 5];
+ uint8 shift = _vcnShift ? _vcnShift[vcnOffset] : _blockBrightness;
if (horizontalFlip) {
for (int blockY = 0; blockY < 8; blockY++) {
@@ -1865,7 +1868,7 @@ void LoLEngine::drawVcnBlocks() {
horizontalFlip = true;
}
- shift = _vcnShift[remainder];
+ shift = _vcnShift? _vcnShift[remainder] : _blockBrightness;
src = &_vcnBlocks[remainder << 5];
if (horizontalFlip) {
diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp
index 6d17218f67..c731425791 100644
--- a/engines/kyra/script_lol.cpp
+++ b/engines/kyra/script_lol.cpp
@@ -2137,32 +2137,55 @@ int LoLEngine::olol_increaseSkill(EMCState *script) {
int LoLEngine::olol_paletteFlash(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_paletteFlash(%p) (%d)", (const void *)script, stackPos(0));
Palette &p1 = _screen->getPalette(1);
- Palette &p2 = _screen->getPalette(3);
- uint8 ovl[256];
- generateFlashPalette(p1, p2, stackPos(0));
- _screen->loadSpecialColors(p1);
- _screen->loadSpecialColors(p2);
+ if (_flags.use16ColorMode) {
+ Palette p2(16);
+ p2.copy(p1);
+ uint8 *d = p2.getData();
- if (_smoothScrollModeNormal) {
- for (int i = 0; i < 256; i++)
- ovl[i] = i;
- ovl[1] = 6;
+ for (int i = 0; i < 16; i++)
+ d[i * 3] = 0x3f;
- _screen->copyRegion(112, 0, 112, 0, 176, 120, 0, 2);
- _screen->applyOverlay(112, 0, 176, 120, 0, ovl);
- }
+ _screen->setScreenPalette(p2);
+ _screen->updateScreen();
- _screen->setScreenPalette(p2);
- _screen->updateScreen();
+ delay(4 * _tickLength);
- delay(2 * _tickLength);
+ _screen->setScreenPalette(p1);
+ if (_smoothScrollModeNormal)
+ _screen->copyRegion(112, 0, 112, 0, 176, 120, 2, 0);
- _screen->setScreenPalette(p1);
- if (_smoothScrollModeNormal)
- _screen->copyRegion(112, 0, 112, 0, 176, 120, 2, 0);
+ _screen->updateScreen();
+
+ } else {
+ Palette &p2 = _screen->getPalette(3);
+
+ uint8 ovl[256];
+ generateFlashPalette(p1, p2, stackPos(0));
+ _screen->loadSpecialColors(p1);
+ _screen->loadSpecialColors(p2);
+
+ 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(p2);
+ _screen->updateScreen();
+
+ delay(2 * _tickLength);
+
+ _screen->setScreenPalette(p1);
+ if (_smoothScrollModeNormal)
+ _screen->copyRegion(112, 0, 112, 0, 176, 120, 2, 0);
+
+ _screen->updateScreen();
+ }
- _screen->updateScreen();
return 0;
}