[Scummvm-cvs-logs] SF.net SVN: scummvm:[44198] scummvm/trunk/engines/kyra

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Sun Sep 20 01:51:21 CEST 2009


Revision: 44198
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44198&view=rev
Author:   athrxx
Date:     2009-09-19 23:51:19 +0000 (Sat, 19 Sep 2009)

Log Message:
-----------
LOL/PC-98: fixed block drawing (colors are still wrong)

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/script_lol.cpp

Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp	2009-09-19 17:39:31 UTC (rev 44197)
+++ scummvm/trunk/engines/kyra/lol.cpp	2009-09-19 23:51:19 UTC (rev 44198)
@@ -158,6 +158,7 @@
 
 	_lampEffect = _brightness = _lampOilStatus = 0;
 	_lampStatusSuspended = false;
+	_blockBrightness = 0;
 	_tempBuffer5120 = 0;
 	_flyingObjects = 0;
 	_monsters = 0;
@@ -799,8 +800,8 @@
 		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 @@
 		modifier >>= 1;
 		if (modifier)
 			modifier--;
-		brightness = 16 * modifier;
+		_blockBrightness = 16 * modifier;
 
 	} else {
 		_screen->loadSpecialColors(dst);

Modified: scummvm/trunk/engines/kyra/lol.h
===================================================================
--- scummvm/trunk/engines/kyra/lol.h	2009-09-19 17:39:31 UTC (rev 44197)
+++ scummvm/trunk/engines/kyra/lol.h	2009-09-19 23:51:19 UTC (rev 44198)
@@ -974,6 +974,7 @@
 	int _lampOilStatus;
 	uint32 _lampStatusTimer;
 	bool _lampStatusSuspended;
+	uint8 _blockBrightness;
 
 	// level
 	void loadLevel(int index);

Modified: scummvm/trunk/engines/kyra/scene_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/scene_lol.cpp	2009-09-19 17:39:31 UTC (rev 44197)
+++ scummvm/trunk/engines/kyra/scene_lol.cpp	2009-09-19 23:51:19 UTC (rev 44198)
@@ -400,13 +400,6 @@
 		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 @@
 		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 @@
 		} 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 @@
 		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 @@
 				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 @@
 					horizontalFlip = true;
 				}
 
-				shift = _vcnShift[remainder];
+				shift = _vcnShift? _vcnShift[remainder] : _blockBrightness;
 				src = &_vcnBlocks[remainder << 5];
 
 				if (horizontalFlip) {

Modified: scummvm/trunk/engines/kyra/script_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_lol.cpp	2009-09-19 17:39:31 UTC (rev 44197)
+++ scummvm/trunk/engines/kyra/script_lol.cpp	2009-09-19 23:51:19 UTC (rev 44198)
@@ -2137,32 +2137,55 @@
 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();
 
-	_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();
+	}
+
 	return 0;
 }
 


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