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

kirben at users.sourceforge.net kirben at users.sourceforge.net
Sat Apr 8 05:08:00 CEST 2006


Revision: 21690
Author:   kirben
Date:     2006-04-08 05:06:52 -0700 (Sat, 08 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21690&view=rev

Log Message:
-----------
Add FF difference in addTextBox() and minor cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/simon/debug.h
    scummvm/trunk/engines/simon/icons.cpp
    scummvm/trunk/engines/simon/items.cpp
    scummvm/trunk/engines/simon/oracle.cpp
    scummvm/trunk/engines/simon/simon.h
    scummvm/trunk/engines/simon/verb.cpp
Modified: scummvm/trunk/engines/simon/debug.h
===================================================================
--- scummvm/trunk/engines/simon/debug.h	2006-04-08 12:06:07 UTC (rev 21689)
+++ scummvm/trunk/engines/simon/debug.h	2006-04-08 12:06:52 UTC (rev 21690)
@@ -1197,11 +1197,11 @@
 	"BJ|IS_BIT2_CLEAR",
 	"BJ|IS_BIT2_SET",
 	NULL,
-	NULL,
+	"W|HYPERLINK_ON",
 	/* 172 */
+	"|HYPERLINK_OFF",
+	"|CHECK_PATHS",
 	NULL,
-	NULL,
-	NULL,
 	"|VGA_POINTER_OP_1",
 	/* 176 */
 	"|VGA_POINTER_OP_2",

Modified: scummvm/trunk/engines/simon/icons.cpp
===================================================================
--- scummvm/trunk/engines/simon/icons.cpp	2006-04-08 12:06:07 UTC (rev 21689)
+++ scummvm/trunk/engines/simon/icons.cpp	2006-04-08 12:06:52 UTC (rev 21690)
@@ -223,19 +223,20 @@
 void SimonEngine::drawIconArray_Simon(uint num, Item *itemRef, int line, int classMask) {
 	Item *item_ptr_org = itemRef;
 	WindowBlock *window;
-	uint width_div_3, height_div_3;
-	uint j, k, i, num_sibs_with_flag;
-	bool item_again;
+	uint width, height;
+	uint k, i, curWidth;
+	bool item_again, showArrows;
 	uint x_pos, y_pos;
+	const int iconSize = (getGameType() == GType_SIMON1) ? 1 : 20;
 
 	window = _windowArray[num & 7];
 
 	if (getGameType() == GType_SIMON1) {
-		width_div_3 = window->width / 3;
-		height_div_3 = window->height / 3;
+		width = window->width / 3;
+		height = window->height / 3;
 	} else {
-		width_div_3 = 100;
-		height_div_3 = 40;
+		width = 100;
+		height = 40;
 	}
 
 	i = 0;
@@ -256,14 +257,10 @@
 	itemRef = derefItem(itemRef->child);
 
 	while (itemRef && line-- != 0) {
-		num_sibs_with_flag = 0;
-		while (itemRef && width_div_3 > num_sibs_with_flag) {
+		curWidth = 0;
+		while (itemRef && width > curWidth) {
 			if ((classMask == 0 || itemRef->classFlags & classMask) && has_item_childflag_0x10(itemRef))
-				if (getGameType() == GType_SIMON1) {
-					num_sibs_with_flag++;
-				} else {
-					num_sibs_with_flag += 20;
-				}
+				curWidth += iconSize;
 			itemRef = derefItem(itemRef->sibling);
 		}
 	}
@@ -275,9 +272,9 @@
 
 	x_pos = 0;
 	y_pos = 0;
-	item_again = false;
 	k = 0;
-	j = 0;
+	item_again = false;
+	showArrows = false;
 
 	while (itemRef) {
 		if ((classMask == 0 || itemRef->classFlags & classMask) && has_item_childflag_0x10(itemRef)) {
@@ -295,15 +292,14 @@
 				k++;
 			} else {
 				window->iconPtr->iconArray[k].item = NULL;
-				j = 1;
+				showArrows = 1;
 			}
-			x_pos += (getGameType() == GType_SIMON1) ? 1 : 20;
 
-			if (x_pos >= width_div_3) {
+			x_pos += iconSize;
+			if (x_pos >= width) {
 				x_pos = 0;
-
-				y_pos += (getGameType() == GType_SIMON1) ? 1 : 20;
-				if (y_pos >= height_div_3)
+				y_pos += iconSize;
+				if (y_pos >= height)
 					item_again = true;
 			}
 		}
@@ -312,8 +308,11 @@
 
 	window->iconPtr->iconArray[k].item = NULL;
 
-	if (j != 0 || window->iconPtr->line != 0) {
-		addArrows(window, num);
+	if (showArrows != 0 || window->iconPtr->line != 0) {
+		/* Plot arrows and add their boxes */
+		window->iconPtr->upArrow = _scrollUpHitArea;
+		window->iconPtr->downArrow = _scrollDownHitArea;
+		defineArrowBoxes(window);		
 	}
 }
 
@@ -414,17 +413,14 @@
 		if ((xp == 188) && (yp == 358))
 			_variableArray[31] = 0;
 	}
-	addArrows(window, num);		/* Plot arrows and add their boxes */
-}
 
-void SimonEngine::addArrows(WindowBlock *window, uint num) {
-	setArrowHitAreas(window, num);
-
+	/* Plot arrows and add their boxes */
 	window->iconPtr->upArrow = _scrollUpHitArea;
 	window->iconPtr->downArrow = _scrollDownHitArea;
+	defineArrowBoxes(window);		
 }
 
-void SimonEngine::setArrowHitAreas(WindowBlock *window, uint num) {
+void SimonEngine::defineArrowBoxes(WindowBlock *window) {
 	HitArea *ha;
 
 	ha = findEmptyHitArea();

Modified: scummvm/trunk/engines/simon/items.cpp
===================================================================
--- scummvm/trunk/engines/simon/items.cpp	2006-04-08 12:06:07 UTC (rev 21689)
+++ scummvm/trunk/engines/simon/items.cpp	2006-04-08 12:06:52 UTC (rev 21690)
@@ -302,6 +302,7 @@
 		break;
 	case GType_FF:
 		opcode_table[37] = &SimonEngine::o3_jumpOut;
+		opcode_table[65] = &SimonEngine::o3_addTextBox;
 		opcode_table[70] = &SimonEngine::o3_printLongText;
 		opcode_table[83] = &SimonEngine::o2_rescan;
 		opcode_table[98] = &SimonEngine::o2_animate;
@@ -661,7 +662,7 @@
 	int h = getVarOrWord();
 	int number = getVarOrByte();
 	if (number < 20)
-		addNewHitArea(id, x, y, w, h, (number << 8) + 129, 0xD0, _dummyItem2);
+		defineBox(id, x, y, w, h, (number << 8) + 129, 208, _dummyItem2);
 }
 
 void SimonEngine::o1_setShortText() {
@@ -901,7 +902,7 @@
 		verb += 0x4000;
 		x -= 1000;
 	}
-	addNewHitArea(id, x, y, w, h, flags, verb, item);
+	defineBox(id, x, y, w, h, flags, verb, item);
 }
 
 void SimonEngine::o1_delBox() {
@@ -1404,6 +1405,27 @@
 	setScriptReturn(1);
 }
 
+void SimonEngine::o3_addTextBox() {
+	// 65: add hit area
+	uint flags = kBFTextBox | kBFBoxItem;
+	uint id = getVarOrWord();
+	uint params = id / 1000;
+	uint x, y, w, h, num;
+
+	id %= 1000;
+
+	if (params & 1)
+		flags |= kBFInvertTouch;
+
+	x = getVarOrWord();
+	y = getVarOrWord();
+	w = getVarOrWord();
+	h = getVarOrWord();
+	num = getVarOrByte();
+	if (num < 20)
+		defineBox(id, x, y, w, h, flags + (num << 8), 208, _dummyItem1);
+}
+
 void SimonEngine::o3_printLongText() {
 	// 70: show string from array
 	int num = getVarOrByte();

Modified: scummvm/trunk/engines/simon/oracle.cpp
===================================================================
--- scummvm/trunk/engines/simon/oracle.cpp	2006-04-08 12:06:07 UTC (rev 21689)
+++ scummvm/trunk/engines/simon/oracle.cpp	2006-04-08 12:06:52 UTC (rev 21690)
@@ -34,7 +34,7 @@
 	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);
+			defineBox(_variableArray[53], _variableArray[50], _variableArray[51], _variableArray[52], 15, 145, 208, _dummyItem1);
 			_variableArray[53]++;
 		}
 		_variableArray[50] = _textWindow->x;
@@ -57,7 +57,7 @@
 		return;
 
 	_variableArray[52] = _textWindow->x + _textWindow->textColumn - _variableArray[50];
-	addNewHitArea(_variableArray[53], _variableArray[50], _variableArray[51], _variableArray[52], 15, 145, 208, _dummyItem1);
+	defineBox(_variableArray[53], _variableArray[50], _variableArray[51], _variableArray[52], 15, 145, 208, _dummyItem1);
 	_variableArray[53]++;
 	_hyperLink = 0;
 }

Modified: scummvm/trunk/engines/simon/simon.h
===================================================================
--- scummvm/trunk/engines/simon/simon.h	2006-04-08 12:06:07 UTC (rev 21689)
+++ scummvm/trunk/engines/simon/simon.h	2006-04-08 12:06:52 UTC (rev 21690)
@@ -565,7 +565,7 @@
 	void moveBox(uint hitarea, int x, int y);
 	bool is_hitarea_0x40_clear(uint hitarea);
 	void delete_hitarea(uint hitarea);
-	void addNewHitArea(int id, int x, int y, int width, int height, int flags, int unk3, Item *item_ptr);
+	void defineBox(int id, int x, int y, int width, int height, int flags, int verb, Item *item_ptr);
 	HitArea *findEmptyHitArea();
 	void resetVerbs();
 	void setVerb(HitArea * ha);
@@ -623,10 +623,6 @@
 	void mouseOff();
 	void mouseOn();
 
-	void drawIconArray(uint i, Item *item_ptr, int line, int classMask);
-	void drawIconArray_FF(uint i, Item *item_ptr, int line, int classMask);
-	void drawIconArray_Simon(uint i, Item *item_ptr, int line, int classMask);
-
 	void loadTextIntoMem(uint stringId);
 	void loadTablesIntoMem(uint subr_id);
 
@@ -646,10 +642,12 @@
 	void clearName();
 	void endCutscene();
 	void runSubroutine101();
+
 	void checkUp(WindowBlock *window);
 	void checkDown(WindowBlock *window);
 	void inventoryUp(WindowBlock *window);
 	void inventoryDown(WindowBlock *window);
+
 	void resetNameWindow();
 	void printVerbOf(uint hitarea_id);
 	HitArea *findHitAreaByID(uint hitarea_id);
@@ -672,12 +670,17 @@
 	void pollMouseXY();
 	void drawMousePointer();
 
-	void removeIconArray(uint num);
+	void defineArrowBoxes(WindowBlock *window);
+	void removeArrows(WindowBlock *window, uint num);
+
 	void draw_icon_c(WindowBlock *window, uint icon, uint x, uint y);
 	bool has_item_childflag_0x10(Item *item);
 	uint itemGetIconNumber(Item *item);
 	uint setupIconHitArea(WindowBlock *window, uint num, uint x, uint y, Item *item_ptr);
-	void addArrows(WindowBlock *window, uint num);
+	void drawIconArray(uint i, Item *item_ptr, int line, int classMask);
+	void drawIconArray_FF(uint i, Item *item_ptr, int line, int classMask);
+	void drawIconArray_Simon(uint i, Item *item_ptr, int line, int classMask);
+	void removeIconArray(uint num);
 
 	void loadIconData();	
 	void loadIconFile();
@@ -709,8 +712,6 @@
 	void renderStringAmiga(uint vga_sprite_id, uint color, uint width, uint height, const char *txt);
 	void renderString(uint vga_sprite_id, uint color, uint width, uint height, const char *txt);
 
-	void setArrowHitAreas(WindowBlock *window, uint num);
-
 	byte *setup_vga_destination(uint32 size);
 	void vga_buf_unk_proc3(byte *end);
 	void vga_buf_unk_proc1(byte *end);
@@ -967,6 +968,7 @@
 
 	// Opcodes, Feeble Files
 	void o3_jumpOut();
+	void o3_addTextBox();
 	void o3_printLongText();
 	void o3_oracleTextDown();
 	void o3_oracleTextUp();
@@ -1001,7 +1003,6 @@
 	void horizontalScroll(VC10_state *state);
 	void verticalScroll(VC10_state *state);
 
-
 	void delete_vga_timer(VgaTimerEntry * vte);
 	void vcResumeSprite(const byte *code_ptr, uint16 cur_file, uint16 cur_sprite);
 	int vcReadVarOrWord();
@@ -1032,7 +1033,6 @@
 	void video_copy_if_flag_0x8_c(WindowBlock *window);
 	void delete_hitarea_by_index(uint index);
 
-	void removeArrows(WindowBlock *window, uint num);
 	void windowPutChar(uint a);
 
 	void restoreWindow(WindowBlock *window);

Modified: scummvm/trunk/engines/simon/verb.cpp
===================================================================
--- scummvm/trunk/engines/simon/verb.cpp	2006-04-08 12:06:07 UTC (rev 21689)
+++ scummvm/trunk/engines/simon/verb.cpp	2006-04-08 12:06:52 UTC (rev 21690)
@@ -381,7 +381,7 @@
 	return (ha->flags & kBFBoxDead) == 0;
 }
 
-void SimonEngine::addNewHitArea(int id, int x, int y, int width, int height, int flags, int verb, Item *item_ptr) {
+void SimonEngine::defineBox(int id, int x, int y, int width, int height, int flags, int verb, Item *item_ptr) {
 	HitArea *ha;
 	delete_hitarea(id);
 
@@ -395,6 +395,11 @@
 	ha->verb = verb;
 	ha->item_ptr = item_ptr;
 
+	if (getGameType() == GType_FF && (ha->flags & kBFHyperBox)) {
+		// TODO
+		ha->priority = 50;
+	}
+
 	_needHitAreaRecalc++;
 }
 


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