[Scummvm-cvs-logs] SF.net SVN: scummvm: [21680] scummvm/trunk/engines/simon

kirben at users.sourceforge.net kirben at users.sourceforge.net
Sat Apr 8 00:14:01 CEST 2006


Revision: 21680
Author:   kirben
Date:     2006-04-08 00:13:07 -0700 (Sat, 08 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21680&view=rev

Log Message:
-----------
Fixes for oracle in FF and cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/simon/charset.cpp
    scummvm/trunk/engines/simon/cursor.cpp
    scummvm/trunk/engines/simon/debug.h
    scummvm/trunk/engines/simon/items.cpp
    scummvm/trunk/engines/simon/oracle.cpp
    scummvm/trunk/engines/simon/simon.cpp
    scummvm/trunk/engines/simon/simon.h
    scummvm/trunk/engines/simon/verb.cpp
Modified: scummvm/trunk/engines/simon/charset.cpp
===================================================================
--- scummvm/trunk/engines/simon/charset.cpp	2006-04-08 06:47:58 UTC (rev 21679)
+++ scummvm/trunk/engines/simon/charset.cpp	2006-04-08 07:13:07 UTC (rev 21680)
@@ -27,7 +27,7 @@
 namespace Simon {
 
 void SimonEngine::print_char_helper_1(const byte *src, uint len) {
-	uint ind;
+	uint idx;
 
 	if (_textWindow == NULL)
 		return;
@@ -52,18 +52,17 @@
 						src++;
 					}
 				} else {
-					//if (getBitFlag(92))
-					//	while(!_nextCharacter);
+					if (getBitFlag(92))
+						delay(50);
 					windowPutChar(*src++);
-					//_nextCharacter = false;
 				}
 			}
 		} else {
 			if (*src != 12 && _textWindow->iconPtr != NULL &&
-					_fcsData1[ind = get_fcs_ptr_3_index(_textWindow)] != 2) {
+					_fcsData1[idx = getWindowNum(_textWindow)] != 2) {
 	
-				_fcsData1[ind] = 2;
-				_fcsData2[ind] = 1;
+				_fcsData1[idx] = 2;
+				_fcsData2[idx] = 1;
 			}
 
 			windowPutChar(*src++);
@@ -72,12 +71,12 @@
 }
 
 void SimonEngine::print_char_helper_5(WindowBlock *window) {
-	uint index = get_fcs_ptr_3_index(window);
-	print_char_helper_6(index);
+	uint index = getWindowNum(window);
+	tidyIconArray(index);
 	_fcsData1[index] = 0;
 }
 
-void SimonEngine::print_char_helper_6(uint i) {
+void SimonEngine::tidyIconArray(uint i) {
 	WindowBlock *window;
 
 	if (_fcsData2[i]) {
@@ -287,7 +286,7 @@
 	va_end(va);
 
 	if (!_fcsData1[_curWindow]) {
-		showmessage_helper_2();
+		openTextWindow();
 		if (!_showMessageFlag) {
 			_windowArray[0] = _textWindow;
 			if (getGameType() == GType_FF)
@@ -307,11 +306,14 @@
 	if (chr == 12) {
 		_numLettersToPrint = 0;
 		_printCharCurPos = 0;
+		_printCharPixelCount = 0;
 		print_char_helper_1(&chr, 1);
 		print_char_helper_5(_textWindow);
 	} else if (chr == 0 || chr == ' ' || chr == 10) {
-		if (_printCharMaxPos - _printCharCurPos >= _numLettersToPrint) {
-			_printCharCurPos += _numLettersToPrint;
+		uint count = (getGameType() == GType_FF) ? _printCharPixelCount : _numLettersToPrint;
+
+		if (_printCharMaxPos - _printCharCurPos >= count) {
+			_printCharCurPos += count;
 			print_char_helper_1(_lettersToPrintBuf, _numLettersToPrint);
 
 			if (_printCharCurPos == _printCharMaxPos) {
@@ -326,7 +328,7 @@
 			}
 		} else {
 			const byte newline_character = 10;
-			_printCharCurPos = _numLettersToPrint;
+			_printCharCurPos = count;
 			print_char_helper_1(&newline_character, 1);
 			print_char_helper_1(_lettersToPrintBuf, _numLettersToPrint);
 			if (chr == ' ') {
@@ -338,14 +340,15 @@
 			}
 		}
 		_numLettersToPrint = 0;
+		_printCharPixelCount = 0;
 	} else {
+		_lettersToPrintBuf[_numLettersToPrint++] = chr;
 		if (getGameType() == GType_FF)
-			_printCharCurPos += feebleFontSize[chr - 32];
-		_lettersToPrintBuf[_numLettersToPrint++] = chr;
+			_printCharPixelCount += feebleFontSize[chr - 32];
 	}
 }
 
-void SimonEngine::showmessage_helper_2() {
+void SimonEngine::openTextWindow() {
 	if (_textWindow)
 		return;
 
@@ -358,6 +361,7 @@
 void SimonEngine::showmessage_helper_3(uint a, uint b) {
 	_printCharCurPos = a;
 	_printCharMaxPos = b;
+	_printCharPixelCount = 0;
 	_numLettersToPrint = 0;
 	_newLines = 0;
 }
@@ -437,10 +441,10 @@
 void SimonEngine::video_putchar_newline(WindowBlock *window) {
 	if (getGameType() == GType_FF) {
 		if (_noOracleScroll == 0) {
-			if (window->textRow + 30 > window->height) {
-				if (getBitFlag(94) == false) {
+			if (window->height < window->textRow + 30) {
+				if (!getBitFlag(94)) {
 					_noOracleScroll = 1;
-					if (getBitFlag(92) == true) {
+					if (getBitFlag(92)) {
 						_noOracleScroll = 0;
 						checkLinkBox();
 						scrollOracle();
@@ -465,9 +469,9 @@
 			window->textRow++;
 	}
 
+	window->textColumn = 0;
 	window->textColumnOffset = 0;
 	window->textLength = 0;
-	window->textColumn = 0;
 }
 
 #ifdef PALMOS_68K
@@ -1294,6 +1298,10 @@
 	byte color, *dst;
 	uint h, i;
 
+	// FIXME
+	//if (_noOracleScroll)
+	//	return;
+
 	_lockWord |= 0x8000;
 
 	dst = getFrontBuf();

Modified: scummvm/trunk/engines/simon/cursor.cpp
===================================================================
--- scummvm/trunk/engines/simon/cursor.cpp	2006-04-08 06:47:58 UTC (rev 21679)
+++ scummvm/trunk/engines/simon/cursor.cpp	2006-04-08 07:13:07 UTC (rev 21680)
@@ -224,7 +224,7 @@
 };
 
 void SimonEngine::drawMousePointer() {
-	debug(0, "Mouse %d Anim %d Max %d", _mouseCursor, _mouseAnim, _mouseAnimMax);
+	//debug(0, "Mouse %d Anim %d Max %d", _mouseCursor, _mouseAnim, _mouseAnimMax);
 
 	if (getGameType() == GType_SIMON2)
 		_system->setMouseCursor(_simon2_cursors[_mouseCursor], 16, 16, 7, 7);

Modified: scummvm/trunk/engines/simon/debug.h
===================================================================
--- scummvm/trunk/engines/simon/debug.h	2006-04-08 06:47:58 UTC (rev 21679)
+++ scummvm/trunk/engines/simon/debug.h	2006-04-08 07:13:07 UTC (rev 21680)
@@ -224,7 +224,7 @@
 	"IBW|SET_ITEM_PROP",
 	NULL,
 	/* 160 */
-	"B|UNK_160",
+	"B|SET_INK",
 	"BWBW|SETUP_TEXT",
 	"BBT|PRINT_STR",
 	"W|SOUND_1",
@@ -462,7 +462,7 @@
 	"IBW|SET_ITEM_PROP",
 	NULL,
 	/* 160 */
-	"B|UNK_160",
+	"B|SET_INK",
 	"BWBW|SETUP_TEXT",
 	"BBTW|PRINT_STR",
 	"W|SOUND_1",
@@ -700,7 +700,7 @@
 	"IBW|SET_ITEM_PROP",
 	NULL,
 	/* 160 */
-	"B|UNK_160",
+	"B|SET_INK",
 	"BWBW|SETUP_TEXT",
 	"BBT|PRINT_STR",
 	"W|SOUND_1",
@@ -942,7 +942,7 @@
 	"IBW|SET_ITEM_PROP",
 	NULL,
 	/* 160 */
-	"B|UNK_160",
+	"B|SET_INK",
 	"BWBW|SETUP_TEXT",
 	"BBTW|PRINT_STR",
 	"W|SOUND_1",
@@ -1184,7 +1184,7 @@
 	"IBW|SET_ITEM_PROP",
 	NULL,
 	/* 160 */
-	"B|UNK_160",
+	"B|SET_INK",
 	"BWWW|SETUP_TEXT",
 	"BBTW|PRINT_STR",
 	"W|SOUND_1",

Modified: scummvm/trunk/engines/simon/items.cpp
===================================================================
--- scummvm/trunk/engines/simon/items.cpp	2006-04-08 06:47:58 UTC (rev 21679)
+++ scummvm/trunk/engines/simon/items.cpp	2006-04-08 07:13:07 UTC (rev 21680)
@@ -1936,6 +1936,8 @@
 		showMessageFormat("\x0E");
 	else
 		showMessageFormat("\x0C");
+	_oracleMaxScrollY = 0;
+	_noOracleScroll = 0;
 	mouseOn();
 }
 

Modified: scummvm/trunk/engines/simon/oracle.cpp
===================================================================
--- scummvm/trunk/engines/simon/oracle.cpp	2006-04-08 06:47:58 UTC (rev 21679)
+++ scummvm/trunk/engines/simon/oracle.cpp	2006-04-08 07:13:07 UTC (rev 21680)
@@ -47,8 +47,8 @@
 		return;
 
 	_hyperLink = x;
-	_variableArray[50] = _textWindow->textColumn+_textWindow->x;
-	_variableArray[51] = _textWindow->textRow+_textWindow->y + (_oracleMaxScrollY - _textWindow->scrollY) * 15;
+	_variableArray[50] = _textWindow->textColumn + _textWindow->x;
+	_variableArray[51] = _textWindow->textRow + _textWindow->y + (_oracleMaxScrollY - _textWindow->scrollY) * 15;
 }
 
 

Modified: scummvm/trunk/engines/simon/simon.cpp
===================================================================
--- scummvm/trunk/engines/simon/simon.cpp	2006-04-08 06:47:58 UTC (rev 21679)
+++ scummvm/trunk/engines/simon/simon.cpp	2006-04-08 07:13:07 UTC (rev 21680)
@@ -268,7 +268,7 @@
 	_scrollHeight = 0;
 	_scrollWidth = 0;
 	_scrollImage = 0;
-	_vgaVar8 = 0;
+	_boxStarHeight = 0;
 
 	_scriptVerb = 0;
 	_scriptNoun1 = 0;
@@ -289,7 +289,6 @@
 	_lastHitArea = 0;
 	_lastNameOn = 0;
 	_lastHitArea3 = 0;
-	_leftButtonDown = 0;
 	_hitAreaSubjectItem = 0;
 	_currentVerbBox = 0;
 	_lastVerbOn = 0;
@@ -302,6 +301,7 @@
 
 	_printCharCurPos = 0;
 	_printCharMaxPos = 0;
+	_printCharPixelCount = 0;
 	_numLettersToPrint = 0;
 
 	_lastTime = 0;
@@ -316,6 +316,8 @@
 	_mouseXOld = 0;
 	_mouseYOld = 0;
 
+	_leftButtonDown = 0;
+	_rightButtonDown = 0;
 	_noRightClick = false;
 
 	_dummyItem1 = new Item();
@@ -1667,14 +1669,14 @@
 	_runScriptReturn1 = true;
 }
 
-uint SimonEngine::get_fcs_ptr_3_index(WindowBlock *window) {
+uint SimonEngine::getWindowNum(WindowBlock *window) {
 	uint i;
 
 	for (i = 0; i != ARRAYSIZE(_windowArray); i++)
 		if (_windowArray[i] == window)
 			return i;
 
-	error("get_fcs_ptr_3_index: not found");
+	error("getWindowNum: not found");
 	return 0;
 }
 
@@ -1843,7 +1845,7 @@
 						continue;
 				}
 
-				if (ha->y >= limit || ((getGameType() == GType_SIMON2) && ha->y >= _vgaVar8))
+				if (ha->y >= limit || ((getGameType() == GType_SIMON2) && ha->y >= _boxStarHeight))
 					continue;
 
 				y_ = (ha->height / 2) - 4 + ha->y;
@@ -2405,7 +2407,7 @@
 			else
 				num_lines = _windowNum == 4 ? 134 : 200;
 
-			_vgaVar8 = num_lines;
+			_boxStarHeight = num_lines;
 			dx_copy_from_attached_to_2(0, 0, _screenWidth, num_lines);
 			dx_copy_from_attached_to_3(num_lines);
 			_syncFlag2 = 1;
@@ -3021,23 +3023,23 @@
 	window->textRow = 0;
 	window->textColumnOffset = 0;
 	window->textLength = 0;
+	window->scrollY = 0;
 }
 
 void SimonEngine::restoreWindow(WindowBlock *window) {
 	_lockWord |= 0x8000;
 
-	if (getGameType() == GType_SIMON1) {
-		restoreBlock(window->y + window->height * 8 + ((window == _windowArray[2]) ? 1 : 0), (window->x + window->width) * 8, window->y, window->x * 8);
-	} else {
+	if (getGameType() == GType_FF) {
+		restoreBlock(window->y + window->height, window->x + window->width, window->y, window->x);
+	} else if (getGameType() == GType_SIMON2) {
 		if (_restoreWindow6 && _windowArray[2] == window) {
 			window = _windowArray[6];
 			_restoreWindow6 = 0;
 		}
 
-		if (getGameType() == GType_FF)
-			restoreBlock(window->y + window->height, window->x + window->width, window->y, window->x);
-		else
-			restoreBlock(window->y + window->height * 8, (window->x + window->width) * 8, window->y, window->x * 8);
+		restoreBlock(window->y + window->height * 8, (window->x + window->width) * 8, window->y, window->x * 8);
+	} else {
+		restoreBlock(window->y + window->height * 8 + ((window == _windowArray[2]) ? 1 : 0), (window->x + window->width) * 8, window->y, window->x * 8);
 	}
 
 	_lockWord &= ~0x8000;
@@ -3053,19 +3055,25 @@
 
 	if (getGameType() == GType_FF) {
 		dst += _dxSurfacePitch * window->y + window->x;
-		h = window->height;
-		w = window->width;
+
+		for (h = 0; h < window->height; h++) {
+			for (w = 0; w < window->width; w++) {
+				if (dst[w] == 113  || dst[w] == 116 || dst[w] == 252)
+					dst[w] = window->fill_color;
+			}
+			dst += _screenWidth;
+		}
 	} else {
 		dst += _dxSurfacePitch * window->y + window->x * 8;
 		h = window->height * 8;
 		w = window->width * 8;
+
+		do {
+			memset(dst, window->fill_color, w);
+			dst += _dxSurfacePitch;
+		} while (--h);
 	}
 
-	do {
-		memset(dst, window->fill_color, w);
-		dst += _dxSurfacePitch;
-	} while (--h);
-
 	_lockWord &= ~0x8000;
 }
 
@@ -3695,7 +3703,7 @@
 	permitInput();
 }
 
-void SimonEngine::restoreBlock(uint b, uint r, uint y, uint x) {
+void SimonEngine::restoreBlock(uint h, uint w, uint y, uint x) {
 	byte *dst, *src;
 	uint i;
 
@@ -3705,8 +3713,8 @@
 	dst += y * _dxSurfacePitch;
 	src += y * _dxSurfacePitch;
 
-	while (y < b) {
-		for (i = x; i < r; i++)
+	while (y < h) {
+		for (i = x; i < w; i++)
 			dst[i] = src[i];
 		y++;
 		dst += _dxSurfacePitch;

Modified: scummvm/trunk/engines/simon/simon.h
===================================================================
--- scummvm/trunk/engines/simon/simon.h	2006-04-08 06:47:58 UTC (rev 21679)
+++ scummvm/trunk/engines/simon/simon.h	2006-04-08 07:13:07 UTC (rev 21680)
@@ -272,7 +272,7 @@
 	int _scrollY, _scrollYMax, _scrollHeight;
 	int _scrollCount, _scrollFlag;
 	const byte *_scrollImage;
-	byte _vgaVar8;
+	byte _boxStarHeight;
 
  	uint16 _hyperLink, _newLines;
  	uint16 _oracleMaxScrollY, _noOracleScroll;
@@ -291,8 +291,6 @@
 	HitArea *_lastHitArea;
 	HitArea *_lastNameOn;
 	HitArea *_lastHitArea3;
-	byte _leftButtonDown;
-	byte _rightButtonDown;
 	Item *_hitAreaSubjectItem;
 	HitArea *_currentVerbBox, *_lastVerbOn;
 	uint _needHitAreaRecalc;
@@ -304,7 +302,7 @@
 
 	uint16 _windowNum;
 
-	uint _printCharCurPos, _printCharMaxPos;
+	uint _printCharCurPos, _printCharMaxPos, _printCharPixelCount;
 	uint _numLettersToPrint;
 
 	uint _lastTime;
@@ -316,6 +314,10 @@
 	int _mouseX, _mouseY;
 	int _mouseXOld, _mouseYOld;
 
+	byte _leftButtonDown;
+	byte _rightButtonDown;
+	bool _noRightClick;
+
 	Item *_dummyItem1;
 	Item *_dummyItem2;
 	Item *_dummyItem3;
@@ -334,7 +336,6 @@
 	bool _fastFadeOutFlag;
 	bool _unkPalFlag;
 	bool _exitCutscene;
-	bool _noRightClick;
 	byte _paletteFlag;
 
 	uint _soundFileId;
@@ -660,7 +661,7 @@
 
 	void read_vga_from_datfile_1(uint vga_id);
 
-	uint get_fcs_ptr_3_index(WindowBlock *window);
+	uint getWindowNum(WindowBlock *window);
 
 	void setup_hitarea_from_pos(uint x, uint y, uint mode);
 	void displayName(HitArea * ha);
@@ -1037,7 +1038,7 @@
 	void restoreWindow(WindowBlock *window);
 	void colorWindow(WindowBlock *window);
 
-	void restoreBlock(uint b, uint r, uint y, uint x);
+	void restoreBlock(uint h, uint w, uint y, uint x);
 
 	byte *getFrontBuf();
 	byte *getBackBuf();
@@ -1087,8 +1088,8 @@
 	bool saveGame(uint slot, char *caption);
 	bool loadGame(uint slot);
 
-	void showmessage_helper_2();
-	void print_char_helper_6(uint i);
+	void openTextWindow();
+	void tidyIconArray(uint i);
 
 	void video_putchar_newline(WindowBlock *window);
 	void video_putchar_drawchar(WindowBlock *window, uint x, uint y, byte chr);

Modified: scummvm/trunk/engines/simon/verb.cpp
===================================================================
--- scummvm/trunk/engines/simon/verb.cpp	2006-04-08 06:47:58 UTC (rev 21679)
+++ scummvm/trunk/engines/simon/verb.cpp	2006-04-08 07:13:07 UTC (rev 21680)
@@ -526,7 +526,7 @@
 		k = (((_variableArray[31] / 52) - 2) % 3);
 		j = k * 6;
 		if (!is_hitarea_0x40_clear(j + 201)) {
-			uint index = get_fcs_ptr_3_index(window);
+			uint index = getWindowNum(window);
 			drawIconArray(index, window->iconPtr->itemRef, 0, window->iconPtr->classMask);
 			loadSprite(4, 9, k + 34, 0, 0, 0);	
 		}
@@ -552,7 +552,7 @@
 	uint16 j, k;
 
 	if (((_variableArray[31] - _variableArray[30]) == 24) && (_iOverflow == 1)) {
-		uint index = get_fcs_ptr_3_index(window);
+		uint index = getWindowNum(window);
 		drawIconArray(index, window->iconPtr->itemRef, 0, window->iconPtr->classMask);
 		k = ((_variableArray[31] / 52) % 3);
 		loadSprite(4, 9, k + 25, 0, 0, 0);	
@@ -593,7 +593,7 @@
 			return;
 
 		mouseOff();
-		uint index = get_fcs_ptr_3_index(window);
+		uint index = getWindowNum(window);
 		drawIconArray(index, window->iconPtr->itemRef, window->iconPtr->line - 1, window->iconPtr->classMask);
 		mouseOn();
 	}
@@ -616,7 +616,7 @@
 		checkDown(window);
 	} else {
 		mouseOff();
-		uint index = get_fcs_ptr_3_index(window);
+		uint index = getWindowNum(window);
 		drawIconArray(index, window->iconPtr->itemRef, window->iconPtr->line + 1, window->iconPtr->classMask);
 		mouseOn();
 	}


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