aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFlorian Kagerer2009-09-03 21:03:10 +0000
committerFlorian Kagerer2009-09-03 21:03:10 +0000
commit1dfb5c2b30be6778a5e17ca9b5f56f9ba7702a8e (patch)
tree2790fe8573b122db50840d9feb68901368b2802f /engines
parentebe1b94eb1561b566124b7dcbb73cf3b0a659b33 (diff)
downloadscummvm-rg350-1dfb5c2b30be6778a5e17ca9b5f56f9ba7702a8e.tar.gz
scummvm-rg350-1dfb5c2b30be6778a5e17ca9b5f56f9ba7702a8e.tar.bz2
scummvm-rg350-1dfb5c2b30be6778a5e17ca9b5f56f9ba7702a8e.zip
LOL: some more work on the floppy version (drawing code is still broken)
svn-id: r43923
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/lol.cpp4
-rw-r--r--engines/kyra/lol.h1
-rw-r--r--engines/kyra/scene_lol.cpp25
-rw-r--r--engines/kyra/screen_lol.cpp41
-rw-r--r--engines/kyra/screen_lol.h2
5 files changed, 67 insertions, 6 deletions
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 6ce05b1e3d..cf42d0b2d8 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -2676,6 +2676,8 @@ int LoLEngine::processMagicFog() {
}
int LoLEngine::processMagicSwarm(int charNum, int damage) {
+ loadFxTables();
+
int cp = _screen->setCurPage(2);
_screen->copyPage(0, 12);
snd_playSoundEffect(74, -1);
@@ -2876,6 +2878,8 @@ void LoLEngine::callbackProcessMagicLightning(WSAMovie_v2 *mov, int x, int y) {
}
void LoLEngine::drinkBezelCup(int numUses, int charNum) {
+ loadFxTables();
+
int cp = _screen->setCurPage(2);
snd_playSoundEffect(73, -1);
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index 40dec5f712..775369b54c 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -982,6 +982,7 @@ private:
void loadCmzFile(const char *file);
void loadLevelShpDat(const char *shpFile, const char *datFile, bool flag);
void loadLevelGraphics(const char *file, int specialColor, int weight, int vcnLen, int vmpLen, const char *palFile);
+ void loadFxTables();
void resetItems(int flag);
void disableMonsters();
diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp
index 3dadeb91c8..bc1f11a492 100644
--- a/engines/kyra/scene_lol.cpp
+++ b/engines/kyra/scene_lol.cpp
@@ -440,21 +440,34 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight
_loadSuppFilesFlag = 0;
generateBrightnessPalette(_screen->getPalette(0), _screen->getPalette(1), _brightness, _lampEffect);
- char tname[13];
- snprintf(tname, sizeof(tname), "LEVEL%.02d.TLC", _currentLevel);
- Common::SeekableReadStream *s = _res->createReadStream(tname);
- if (s) {
+ if (_flags.isTalkie) {
+ char tname[13];
+ snprintf(tname, sizeof(tname), "LEVEL%.02d.TLC", _currentLevel);
+ Common::SeekableReadStream *s = _res->createReadStream(tname);
s->read(_trueLightTable1, 256);
s->read(_trueLightTable2, 5120);
delete s;
} else {
- memset(_trueLightTable1, 0, 256);
- memset(_trueLightTable2, 0, 5120);
+ loadFxTables();
}
_loadSuppFilesFlag = 1;
}
+void LoLEngine::loadFxTables() {
+ if (_flags.isTalkie || _loadSuppFilesFlag)
+ return;
+
+ Palette tpal(768);
+ _screen->loadPalette("fxpal.col", tpal);
+ _screen->loadBitmap("fxpal.shp", 3, 3, 0);
+ const uint8 *v = _screen->getCPagePtr(2) + 11;
+
+ _screen->generateTruelightTables(v, 20, tpal, _screen->getPalette(1), _trueLightTable1, _trueLightTable2, 70);
+
+ _loadSuppFilesFlag = 1;
+}
+
void LoLEngine::resetItems(int flag) {
for (int i = 0; i < 1024; i++) {
_levelBlockProperties[i].direction = 5;
diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp
index ce8a1bdaa4..6e855f7a7f 100644
--- a/engines/kyra/screen_lol.cpp
+++ b/engines/kyra/screen_lol.cpp
@@ -216,6 +216,47 @@ uint8 *Screen_LoL::generateLevelOverlay(const Palette &srcPal, uint8 *ovl, int o
return ovl;
}
+void Screen_LoL::generateTruelightTables(const uint8 *shp, int a, const Palette &fxPal, const Palette &screenPal, uint8 *outTable1, uint8 *outTable2, int b) {
+ memset(outTable1, 0xff, 256);
+
+ for (int i = 0; i < a; i++)
+ outTable1[shp[i]] = i;
+
+ for (int i = 0; i < a; i++) {
+ if (shp[i]) {
+ uint8 tcol[3];
+ uint16 fcol[3];
+ uint16 scol[3];
+
+ int t1 = (b << 6) / 100;
+ int t2 = 64 - t1;
+
+ uint8 c = shp[i];
+ fcol[0] = fxPal[3 * c];
+ fcol[1] = fxPal[3 * c + 1];
+ fcol[2] = fxPal[3 * c + 2];
+
+ uint8 *o = &outTable2[i << 8];
+
+ for (int ii = 0; ii < 256; ii++) {
+ scol[0] = screenPal[3 * ii];
+ scol[1] = screenPal[3 * ii + 1];
+ scol[2] = screenPal[3 * ii + 2];
+
+ tcol[0] = CLIP(((fcol[0] * t2) >> 6) + ((scol[0] * t1) >> 6), 0, 63);
+ tcol[1] = CLIP(((fcol[1] * t2) >> 6) + ((scol[1] * t1) >> 6), 0, 63);
+ tcol[2] = CLIP(((fcol[2] * t2) >> 6) + ((scol[2] * t1) >> 6), 0, 63);
+
+ o[ii] = findLeastDifferentColor(tcol, screenPal, 0, 255);
+ }
+
+ } else {
+ for (int ii = 0; ii < 256; ii++)
+ outTable2[(i << 8) + ii] = 0;
+ }
+ }
+}
+
void Screen_LoL::drawGridBox(int x, int y, int w, int h, int col) {
if (w <= 0 || x >= 320 || h <= 0 || y >= 200)
return;
diff --git a/engines/kyra/screen_lol.h b/engines/kyra/screen_lol.h
index 4980a89694..2c52213b29 100644
--- a/engines/kyra/screen_lol.h
+++ b/engines/kyra/screen_lol.h
@@ -80,6 +80,8 @@ public:
uint8 *generateLevelOverlay(const Palette &Pal, uint8 *ovl, int opColor, int weight);
uint8 *getLevelOverlay(int index) { return _levelOverlays[index]; }
+ void generateTruelightTables(const uint8 *shp, int a, const Palette &fxPal, const Palette &screenPal, uint8 *outTable1, uint8 *outTable2, int b);
+
void copyBlockAndApplyOverlay(int page1, int x1, int y1, int page2, int x2, int y2, int w, int h, int dim, uint8 *ovl);
void applyOverlaySpecial(int page1, int x1, int y1, int page2, int x2, int y2, int w, int h, int dim, int flag, uint8 *ovl);