[Scummvm-cvs-logs] SF.net SVN: scummvm:[43923] scummvm/trunk/engines/kyra
athrxx at users.sourceforge.net
athrxx at users.sourceforge.net
Thu Sep 3 23:03:11 CEST 2009
Revision: 43923
http://scummvm.svn.sourceforge.net/scummvm/?rev=43923&view=rev
Author: athrxx
Date: 2009-09-03 21:03:10 +0000 (Thu, 03 Sep 2009)
Log Message:
-----------
LOL: some more work on the floppy version (drawing code is still broken)
Modified Paths:
--------------
scummvm/trunk/engines/kyra/lol.cpp
scummvm/trunk/engines/kyra/lol.h
scummvm/trunk/engines/kyra/scene_lol.cpp
scummvm/trunk/engines/kyra/screen_lol.cpp
scummvm/trunk/engines/kyra/screen_lol.h
Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp 2009-09-03 20:59:17 UTC (rev 43922)
+++ scummvm/trunk/engines/kyra/lol.cpp 2009-09-03 21:03:10 UTC (rev 43923)
@@ -2676,6 +2676,8 @@
}
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::drinkBezelCup(int numUses, int charNum) {
+ loadFxTables();
+
int cp = _screen->setCurPage(2);
snd_playSoundEffect(73, -1);
Modified: scummvm/trunk/engines/kyra/lol.h
===================================================================
--- scummvm/trunk/engines/kyra/lol.h 2009-09-03 20:59:17 UTC (rev 43922)
+++ scummvm/trunk/engines/kyra/lol.h 2009-09-03 21:03:10 UTC (rev 43923)
@@ -982,6 +982,7 @@
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();
Modified: scummvm/trunk/engines/kyra/scene_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/scene_lol.cpp 2009-09-03 20:59:17 UTC (rev 43922)
+++ scummvm/trunk/engines/kyra/scene_lol.cpp 2009-09-03 21:03:10 UTC (rev 43923)
@@ -440,21 +440,34 @@
_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;
Modified: scummvm/trunk/engines/kyra/screen_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen_lol.cpp 2009-09-03 20:59:17 UTC (rev 43922)
+++ scummvm/trunk/engines/kyra/screen_lol.cpp 2009-09-03 21:03:10 UTC (rev 43923)
@@ -216,6 +216,47 @@
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;
Modified: scummvm/trunk/engines/kyra/screen_lol.h
===================================================================
--- scummvm/trunk/engines/kyra/screen_lol.h 2009-09-03 20:59:17 UTC (rev 43922)
+++ scummvm/trunk/engines/kyra/screen_lol.h 2009-09-03 21:03:10 UTC (rev 43923)
@@ -80,6 +80,8 @@
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);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list