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

kirben at users.sourceforge.net kirben at users.sourceforge.net
Tue Apr 4 00:36:02 CEST 2006


Revision: 21586
Author:   kirben
Date:     2006-04-04 00:34:48 -0700 (Tue, 04 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21586&view=rev

Log Message:
-----------
More work on oracle in FF

Modified Paths:
--------------
    scummvm/trunk/engines/simon/charset.cpp
    scummvm/trunk/engines/simon/intern.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
Modified: scummvm/trunk/engines/simon/charset.cpp
===================================================================
--- scummvm/trunk/engines/simon/charset.cpp	2006-04-04 06:25:50 UTC (rev 21585)
+++ scummvm/trunk/engines/simon/charset.cpp	2006-04-04 07:34:48 UTC (rev 21586)
@@ -33,14 +33,41 @@
 		return;
 
 	while (len-- != 0) {
-		if (*src != 12 && _textWindow->fcs_data != NULL &&
-				_fcsData1[ind = get_fcs_ptr_3_index(_textWindow)] != 2) {
+		if (getGameType() == GType_FF) {
+			if ((_bitArray[5] & (1 << 13)) != 0) {
+				if (_curWindow == 3) {
+					if ((_newLines >= _textWindow->scrollY) && (_newLines < (_textWindow->scrollY + 3)))
+						fcs_putchar(*src);
+					if (*src == '\n')		// Do two top lines of text only
+						_newLines++;
+					src++;
+				}
+			} else {
+				if ((_bitArray[5] & (1 << 14)) != 0) {
+					if (_curWindow == 3) {
+						if (_newLines == (_textWindow->scrollY + 7))
+							fcs_putchar(*src);
+						if (*src == '\n')	// Do two top lines of text only
+							_newLines++;
+						src++;
+					}
+				} else {
+					//if ((_bitArray[5] & (1 << 12)) != 0)
+					//	while(!_nextCharacter);
+					fcs_putchar(*src++);
+					//_nextCharacter = false;
+				}
+			}
+		} else {
+			if (*src != 12 && _textWindow->fcs_data != NULL &&
+					_fcsData1[ind = get_fcs_ptr_3_index(_textWindow)] != 2) {
+	
+				_fcsData1[ind] = 2;
+				_fcsData2[ind] = 1;
+			}
 
-			_fcsData1[ind] = 2;
-			_fcsData2[ind] = 1;
+			fcs_putchar(*src++);
 		}
-
-		fcs_putchar(*src++);
 	}
 }
 
@@ -218,6 +245,22 @@
 	}
 }
 
+static const byte fontSize[208] = {
+	8, 2, 5, 7, 8, 8, 8, 2, 4, 4, 8, 8, 3, 8, 2, 9,
+	8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 2, 3, 5, 8, 5, 8,
+	8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 8, 8, 8, 8, 8, 8,
+	8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 9, 4, 4, 9,
+	4, 8, 8, 8, 8, 8, 7, 8, 8, 4, 5, 7, 3, 8, 8, 8,
+	8, 8, 8, 7, 7, 8, 8, 8, 8, 8, 8, 5, 2, 5, 8, 8,
+	8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4, 4, 8, 8,
+	8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+	8, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 2, 8, 8,
+	8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+	8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+	8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+	8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+};
+
 void SimonEngine::showMessageFormat(const char *s, ...) {
 	char buf[STRINGBUFLEN];
 	char *str;
@@ -231,8 +274,10 @@
 		showmessage_helper_2();
 		if (!_showMessageFlag) {
 			_windowArray[0] = _textWindow;
-			showmessage_helper_3(_textWindow->textLength,
-                                 _textWindow->textMaxLength);
+			if (getGameType() == GType_FF)
+				showmessage_helper_3(_textWindow->textColumn, _textWindow->width);
+			else
+				showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
 		}
 		_showMessageFlag = true;
 		_fcsData1[_curWindow] = 1;
@@ -286,21 +331,25 @@
 	if (_textWindow)
 		return;
 
-	_textWindow = openWindow(8, 0x90, 0x18, 6, 1, 0, 0xF);
+	if (getGameType() == GType_FF)
+		_textWindow = openWindow(64, 96, 384, 172, 1, 0, 15);
+	else
+		_textWindow = openWindow(8, 144, 24, 6, 1, 0, 15);
 }
 
 void SimonEngine::showmessage_helper_3(uint a, uint b) {
 	_printCharCurPos = a;
 	_printCharMaxPos = b;
 	_numLettersToPrint = 0;
+	_newLines = 0;
 }
 
 void SimonEngine::video_putchar(FillOrCopyStruct *fcs, byte c, byte b) {
 	byte width = 6;
 
-	if (c == 0xC) {
+	if (c == 12) {
 		clearWindow(fcs);
-	} else if (c == 0xD || c == 0xA) {
+	} else if (c == 13 || c == 10) {
 		video_putchar_newline(fcs);
 	} else if ((c == 1 && _language != Common::HB_ISR) || (c == 8)) {
 		if (_language == Common::HB_ISR) { //Hebrew
@@ -328,6 +377,12 @@
 			}
 		}
 	} else if (c >= 0x20) {
+		if (getGameType() == GType_FF) {
+			video_putchar_drawchar(fcs, fcs->textColumn + fcs->x, fcs->textRow + fcs->y, c);
+			fcs->textColumn += fontSize[c - 0x20];
+			return;
+		}
+
 		if (fcs->textLength == fcs->textMaxLength) {
 			video_putchar_newline(fcs);
 		} else if (fcs->textRow == fcs->height) {
@@ -343,10 +398,10 @@
 				fcs->textColumn++;
 				fcs->textColumnOffset += 8;
 			}
-			video_putchar_drawchar(fcs, fcs->width + fcs->x - fcs->textColumn, fcs->textRow * 8 + fcs->y, c);
+			video_putchar_drawchar(fcs, (fcs->width + fcs->x - fcs->textColumn) * 8, fcs->textRow * 8 + fcs->y, c);
 			fcs->textLength++;
 		} else {
-			video_putchar_drawchar(fcs, fcs->textColumn + fcs->x, fcs->textRow * 8 + fcs->y, c);
+			video_putchar_drawchar(fcs, (fcs->textColumn + fcs->x) * 8, fcs->textRow * 8 + fcs->y, c);
 
 			fcs->textLength++;
 			fcs->textColumnOffset += 6;
@@ -362,12 +417,39 @@
 }
 
 void SimonEngine::video_putchar_newline(FillOrCopyStruct *fcs) {
+	if (getGameType() == GType_FF) {
+		if (_noOracleScroll == 0) {
+			if (fcs->textRow + 30 > fcs->height) {
+				if (vcGetBit(94) == false) {
+					_noOracleScroll = 1;
+					if (vcGetBit(92) == true) {
+						_noOracleScroll = 0;
+						checkLinkBox();
+						scrollOracle();
+						linksUp();
+						fcs->scrollY++;
+						_oracleMaxScrollY++;
+					} else {
+						_oracleMaxScrollY++;
+						checkLinkBox();
+					}
+				}
+			} else {
+				fcs->textRow += 15;
+				checkLinkBox();
+			}
+		} else {
+			_oracleMaxScrollY++;
+			checkLinkBox();
+		}
+	} else {
+		if (fcs->textRow != fcs->height)
+			fcs->textRow++;
+	}
+
 	fcs->textColumnOffset = 0;
 	fcs->textLength = 0;
 	fcs->textColumn = 0;
-
-	if (fcs->textRow != fcs->height)
-		fcs->textRow++;
 }
 
 #ifdef PALMOS_68K
@@ -1197,7 +1279,7 @@
 	_lockWord |= 0x8000;
 
 	dst = getFrontBuf();
-	dst += y * _dxSurfacePitch + x * 8 + fcs->textColumnOffset;
+	dst += y * _dxSurfacePitch + x + fcs->textColumnOffset;
 
 	switch(_language) {
 	case Common::RU_RUS:

Modified: scummvm/trunk/engines/simon/intern.h
===================================================================
--- scummvm/trunk/engines/simon/intern.h	2006-04-04 06:25:50 UTC (rev 21585)
+++ scummvm/trunk/engines/simon/intern.h	2006-04-04 07:34:48 UTC (rev 21586)
@@ -91,6 +91,7 @@
 	uint16 width, height;
 	uint16 textColumn, textRow;
 	uint16 textColumnOffset, textLength, textMaxLength;
+	uint16 scrollY;
 	uint8 fill_color, text_color, unk5;
 	FillOrCopyData *fcs_data;
 	FillOrCopyStruct() { memset(this, 0, sizeof(*this)); }

Modified: scummvm/trunk/engines/simon/items.cpp
===================================================================
--- scummvm/trunk/engines/simon/items.cpp	2006-04-04 06:25:50 UTC (rev 21585)
+++ scummvm/trunk/engines/simon/items.cpp	2006-04-04 07:34:48 UTC (rev 21586)
@@ -569,14 +569,14 @@
 			break;
 
 		case 101:{
-				uint a = getVarOrByte();
-				uint b = getVarOrWord();
-				uint c = getVarOrWord();
-				uint d = getVarOrWord();
-				uint e = getVarOrWord();
-				uint f = getVarOrWord();
-				uint g = getVarOrWord();
-				o_defineWindow(a, b, c, d, e, f, g, 0);
+				uint num = getVarOrByte();
+				uint x = getVarOrWord();
+				uint y = getVarOrWord();
+				uint w = getVarOrWord();
+				uint h = getVarOrWord();
+				uint flags = getVarOrWord();
+				uint fill_color = getVarOrWord();
+				o_defineWindow(num, x, y, w, h, flags, fill_color, 0);
 			}
 			break;
 
@@ -1713,17 +1713,20 @@
 }
 
 /* OK */
-void SimonEngine::o_defineWindow(uint a, uint b, uint c, uint d, uint e, uint f, uint g, uint h) {
-	a &= 7;
+void SimonEngine::o_defineWindow(uint num, uint x, uint y, uint w, uint h, uint flags, uint fill_color, uint text_color) {
+	num &= 7;
 
-	if (_windowArray[a])
-		closeWindow(a);
+	if (_windowArray[num])
+		closeWindow(num);
 
-	_windowArray[a] = openWindow(b, c, d, e, f, g, h);
+	_windowArray[num] = openWindow(x, y, w, h, flags, fill_color, text_color);
 
-	if (a == _curWindow) {
-		_textWindow = _windowArray[a];
-		showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
+	if (num == _curWindow) {
+		_textWindow = _windowArray[num];
+		if (getGameType() == GType_FF)
+			showmessage_helper_3(_textWindow->textColumn, _textWindow->width);
+		else
+			showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
 	}
 }
 

Modified: scummvm/trunk/engines/simon/oracle.cpp
===================================================================
--- scummvm/trunk/engines/simon/oracle.cpp	2006-04-04 06:25:50 UTC (rev 21585)
+++ scummvm/trunk/engines/simon/oracle.cpp	2006-04-04 07:34:48 UTC (rev 21586)
@@ -32,14 +32,25 @@
 
 namespace Simon {
 
+void SimonEngine::checkLinkBox() {	// Check for boxes spilling over to next row of text
+	if (_hyperLink != 0) {
+		_variableArray[52] = _textWindow->x + _textWindow->textColumn - _variableArray[50];
+		if (_variableArray[52] != 0) {
+			addNewHitArea(_variableArray[53], _variableArray[50], _variableArray[51], _variableArray[52], 15, 145, 208, _dummyItem1);
+			_variableArray[53]++;
+		}
+		_variableArray[50] = _textWindow->x;
+		_variableArray[51] = _textWindow->textRow + _textWindow->y + (_oracleMaxScrollY-_textWindow->scrollY) * 15;
+	}
+}
+
 void SimonEngine::hyperLinkOn(uint16 x) {
 	if ((_bitArray[3] & (1 << 3)) == 0)
 		return;
 
 	_hyperLink = x;
 	_variableArray[50] = _textWindow->textColumn+_textWindow->x;
-	_variableArray[51] = _textWindow->textRow+_textWindow->y+
-						(_oracleMaxScrollY - _textWindow->textColumnOffset) * 15;
+	_variableArray[51] = _textWindow->textRow+_textWindow->y + (_oracleMaxScrollY - _textWindow->scrollY) * 15;
 }
 
 
@@ -53,33 +64,57 @@
 	_hyperLink = 0;
 }
 
-void SimonEngine::oracleTextDown() {
+void SimonEngine::linksUp() {	// Scroll Oracle Links
+	uint16 j;
+	for (j = 700; j < _variableArray[53]; j++) {
+		moveBox(j, 0, -15);
+	}
+}
+
+void SimonEngine::linksDown() {
+	uint16 i;
+	for (i = 700; i < _variableArray[53]; i++) {
+		moveBox(i,0, 15);
+	}
+}
+
+void SimonEngine::scrollOracle() {
+	int i;
+
+	for (i = 0; i < 5; i++) {
+		scrollOracleUp();
+		bltOracleText();
+	}
+}
+
+void SimonEngine::oracleTextUp() {
 	Subroutine *sub;
 	int i = 0;
 	changeWindow(3);
 	_noOracleScroll = 0;
 
-	if(_textWindow->textColumnOffset > _oracleMaxScrollY) 		// For scroll up
-		_oracleMaxScrollY = _textWindow->textColumnOffset;
+	if(_textWindow->scrollY > _oracleMaxScrollY) 		// For scroll up
+		_oracleMaxScrollY = _textWindow->scrollY;
 
 	while(1) {
-		if(_textWindow->textColumnOffset == 0)
+		if(_textWindow->scrollY == _oracleMaxScrollY)
 			break;
+		_textWindow->textRow = 105;
 		for (i = 0; i < 5; i++) {
 			_newLines = 0;
 			_textWindow->textColumn = 0;
-			_textWindow->textRow = (i + 1) * 3;
-			if(i == 4) {
-				_textWindow->textColumnOffset -= 1;
-				_textWindow->textRow = 0;
-				linksDown();
+			_textWindow->textRow -= 3;
+			if(i == 2) {
+				_textWindow->scrollY += 1;
+				_textWindow->textRow += 15;
+				linksUp();
 			}
-			scrollOracleDown();
-			_bitArray[5] |= (1 << 13);
+			scrollOracleUp();
+			_bitArray[5] |= (1 << 14);
 			sub = getSubroutineByID(_variableArray[104]);
-			if (sub)
+			if(sub)
 				startSubroutineEx(sub);
-			_bitArray[5] &= ~(1 << 13);
+			_bitArray[5] &= ~(1 << 14);
 			bltOracleText();
 		}
 		if (_currentBoxNumber != 600 || _leftButtonDown)
@@ -87,34 +122,33 @@
 	}
 }
 
-void SimonEngine::oracleTextUp() {
+void SimonEngine::oracleTextDown() {
 	Subroutine *sub;
 	int i = 0;
 	changeWindow(3);
 	_noOracleScroll = 0;
 
-	if(_textWindow->textColumnOffset > _oracleMaxScrollY) 		// For scroll up
-		_oracleMaxScrollY = _textWindow->textColumnOffset;
+	if(_textWindow->scrollY > _oracleMaxScrollY) 		// For scroll up
+		_oracleMaxScrollY = _textWindow->scrollY;
 
 	while(1) {
-		if(_textWindow->textColumnOffset == _oracleMaxScrollY)
+		if(_textWindow->scrollY == 0)
 			break;
-		_textWindow->textRow = 105;
 		for (i = 0; i < 5; i++) {
 			_newLines = 0;
 			_textWindow->textColumn = 0;
-			_textWindow->textRow -= 3;
-			if(i == 2) {
-				_textWindow->textColumnOffset += 1;
-				_textWindow->textRow += 15;
-				linksUp();
+			_textWindow->textRow = (i + 1) * 3;
+			if(i == 4) {
+				_textWindow->scrollY -= 1;
+				_textWindow->textRow = 0;
+				linksDown();
 			}
-			scrollOracleUp();
-			_bitArray[5] |= (1 << 14);
+			scrollOracleDown();
+			_bitArray[5] |= (1 << 13);
 			sub = getSubroutineByID(_variableArray[104]);
-			if(sub)
+			if (sub)
 				startSubroutineEx(sub);
-			_bitArray[5] &= ~(1 << 14);
+			_bitArray[5] &= ~(1 << 13);
 			bltOracleText();
 		}
 		if (_currentBoxNumber != 600 || _leftButtonDown)
@@ -122,20 +156,6 @@
 	}
 }
 
-void SimonEngine::linksUp() {	// Scroll Oracle Links
-	uint16 j;
-	for (j = 700; j < _variableArray[53]; j++) {
-		moveBox(j, 0, -15);
-	}
-}
-
-void SimonEngine::linksDown() {
-	uint16 i;
-	for (i = 700; i < _variableArray[53]; i++) {
-		moveBox(i,0, 15);
-	}
-}
-
 void SimonEngine::listSaveGames(int n) {
 	char b[108];
 	Common::InSaveFile *in;
@@ -161,13 +181,13 @@
 		}
 
 		if ((_bitArray[5] & (1 << 13)) != 0) {
-			if (((_newLines + 1) >= _textWindow->textColumnOffset) && (
-						(_newLines + 1) < (_textWindow->textColumnOffset + 3)))
+			if (((_newLines + 1) >= _textWindow->scrollY) && (
+						(_newLines + 1) < (_textWindow->scrollY + 3)))
 				OK = 1;
 		}
 
 		if ((_bitArray[5] & (1 << 14)) != 0) {
-			if ((_newLines + 1) == (_textWindow->textColumnOffset + 7))
+			if ((_newLines + 1) == (_textWindow->scrollY + 7))
 				OK = 1;
 		}
 

Modified: scummvm/trunk/engines/simon/simon.cpp
===================================================================
--- scummvm/trunk/engines/simon/simon.cpp	2006-04-04 06:25:50 UTC (rev 21585)
+++ scummvm/trunk/engines/simon/simon.cpp	2006-04-04 07:34:48 UTC (rev 21586)
@@ -2138,7 +2138,10 @@
 		_curWindow = 0;
 		if (_windowArray[0] != 0) {
 			_textWindow = _windowArray[0];
-			showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
+			if (getGameType() == GType_FF)
+				showmessage_helper_3(_textWindow->textColumn, _textWindow->width);
+			else
+				showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
 		}
 		_mortalFlag = false;
 	}
@@ -2950,7 +2953,10 @@
 	showmessage_print_char(0);
 	_textWindow = _windowArray[a];
 
-	showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
+	if (getGameType() == GType_FF)
+		showmessage_helper_3(_textWindow->textColumn, _textWindow->width);
+	else
+		showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
 }
 
 // OK
@@ -2973,6 +2979,7 @@
 	fcs->textRow = 0;
 	fcs->textColumnOffset = 0;
 	fcs->textMaxLength = fcs->width * 8 / 6; // characters are 6 pixels
+	fcs->scrollY = 0;
 	return fcs;
 }
 

Modified: scummvm/trunk/engines/simon/simon.h
===================================================================
--- scummvm/trunk/engines/simon/simon.h	2006-04-04 06:25:50 UTC (rev 21585)
+++ scummvm/trunk/engines/simon/simon.h	2006-04-04 07:34:48 UTC (rev 21586)
@@ -588,6 +588,7 @@
 
 	void o_inventory_descriptions();
 
+	void checkLinkBox();
  	void hyperLinkOn(uint16 x);
  	void hyperLinkOff();
 	void linksUp();
@@ -598,6 +599,7 @@
 
 	void bltOracleText();
 	void oracleLogo();
+	void scrollOracle();
 	void scrollOracleUp();
 	void scrollOracleDown();
 	void swapCharacterLogo();


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