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

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Mon Apr 10 02:19:03 CEST 2006


Revision: 21760
Author:   eriktorbjorn
Date:     2006-04-10 02:18:07 -0700 (Mon, 10 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21760&view=rev

Log Message:
-----------
By now, it should be obvious that I'm trying to get rid of the o_ functions.
This is in preparation for the next stage of the cleanup.

By now, I have merged most of the o_ opcode functions into the corresponding
o1_ opcode function. There are a few pure o_ opcode functions left, but it
makes sense to keep them separate functions since they are part of groups of
other functions. Now, to get rid of the remaining o_ functions I have:

Dropped the "o_" prefix from the following functions: o_kill_sprite_simon1(),
o_kill_sprite_simon2(), o_waitForSync(), o_freezeBottom(), o_setTextColor(),
o_fadeToBlack(), o_waitForMark(), o_unk_132_helper_3(), o_unk_132_helper(),
o_clearCharacter(), o_fileError().

Renamed o_sync() to sendSync().
Renamed o_mouseOn() to scriptMouseOn(), and moved it to items.cpp
Renamed o_mouseOff() to scriptMouseOff(), and moved it to items.cpp

Modified Paths:
--------------
    scummvm/trunk/engines/simon/icons.cpp
    scummvm/trunk/engines/simon/items.cpp
    scummvm/trunk/engines/simon/oracle.cpp
    scummvm/trunk/engines/simon/saveload.cpp
    scummvm/trunk/engines/simon/simon.cpp
    scummvm/trunk/engines/simon/simon.h
    scummvm/trunk/engines/simon/string.cpp
    scummvm/trunk/engines/simon/verb.cpp
Modified: scummvm/trunk/engines/simon/icons.cpp
===================================================================
--- scummvm/trunk/engines/simon/icons.cpp	2006-04-10 08:49:28 UTC (rev 21759)
+++ scummvm/trunk/engines/simon/icons.cpp	2006-04-10 09:18:07 UTC (rev 21760)
@@ -68,7 +68,7 @@
 		error("Out of icon memory");
 
 	memcpy(_iconFilePtr, src, 43 * 336);
-	o_unfreezeBottom();
+	unfreezeBottom();
 }
 
 // Thanks to Stuart Caie for providing the original
@@ -491,7 +491,7 @@
 		ha->window = window;
 		ha->verb = 1;
 
-		o_kill_sprite_simon1(128);
+		kill_sprite_simon1(128);
 		loadSprite(0, 1, 128, 0, 0, 14);
 	}
 }
@@ -575,7 +575,7 @@
 }
 
 void SimonEngine::removeArrows(WindowBlock *window, uint num) {
-	o_kill_sprite_simon1(128);
+	kill_sprite_simon1(128);
 }
 
 } // End of namespace Simon

Modified: scummvm/trunk/engines/simon/items.cpp
===================================================================
--- scummvm/trunk/engines/simon/items.cpp	2006-04-10 08:49:28 UTC (rev 21759)
+++ scummvm/trunk/engines/simon/items.cpp	2006-04-10 09:18:07 UTC (rev 21760)
@@ -877,7 +877,7 @@
 
 void SimonEngine::o1_stopAnimate() {
 	// 99: kill sprite
-	o_kill_sprite_simon1(getVarOrWord());
+	kill_sprite_simon1(getVarOrWord());
 }
 
 void SimonEngine::o1_killAnimate() {
@@ -1024,13 +1024,13 @@
 	_scriptVar2 = (var == 200);
 
 	if (var != 200 || !_skipVgaWait)
-		o_waitForSync(var);
+		waitForSync(var);
 	_skipVgaWait = false;
 }
 
 void SimonEngine::o1_sync() {
 	// 120: sync
-	o_sync(getVarOrWord());
+	sendSync(getVarOrWord());
 }
 
 void SimonEngine::o1_defObj() {
@@ -1198,7 +1198,7 @@
 
 void SimonEngine::o1_freezeZones() {
 	// 138: vga pointer op 4
-	o_freezeBottom();
+	freezeBottom();
 }
 
 void SimonEngine::o1_placeNoIcons() {
@@ -1315,7 +1315,7 @@
 
 void SimonEngine::o1_ink() {
 	// 160
-	o_setTextColor(getVarOrByte());
+	setTextColor(getVarOrByte());
 }
 
 void SimonEngine::o1_screenTextBox() {
@@ -1349,7 +1349,7 @@
 	if (_speech && speech_id != 0)
 		playSpeech(speech_id, vgaSpriteId);
 	if ((getGameType() == GType_SIMON2) && (getFeatures() & GF_TALKIE) && speech_id == 0)
-		o_kill_sprite_simon2(2, vgaSpriteId + 2);
+		kill_sprite_simon2(2, vgaSpriteId + 2);
 
 	if (string_ptr != NULL && (speech_id == 0 || _subtitles))
 		printScreenText(vgaSpriteId, color, (const char *)string_ptr, tl->x, tl->y, tl->width);
@@ -1594,12 +1594,12 @@
 
 void SimonEngine::o1_mouseOn() {
 	// 180: force mouseOn
-	o_mouseOn();
+	scriptMouseOn();
 }
 
 void SimonEngine::o1_mouseOff() {
 	// 181: force mouseOff
-	o_mouseOff();
+	scriptMouseOff();
 }
 
 void SimonEngine::o1_loadBeard() {
@@ -1646,12 +1646,12 @@
 
 void SimonEngine::o1_unfreezeZones() {
 	// 186: vga pointer op 3
-	o_unfreezeBottom();
+	unfreezeBottom();
 }
 
 void SimonEngine::o1_specialFade() {
 	// 187: fade to black
-	o_fadeToBlack();
+	fadeToBlack();
 }
 
 // -----------------------------------------------------------------------
@@ -1694,12 +1694,12 @@
 	// 99: kill sprite
 	uint a = getVarOrWord();
 	uint b = getVarOrWord();
-	o_kill_sprite_simon2(a, b);
+	kill_sprite_simon2(a, b);
 }
 
 void SimonEngine::o2_mouseOff() {
 	// 181: force mouseOff
-	o_mouseOff();
+	scriptMouseOff();
 	changeWindow(1);
 	showMessageFormat("\xC");
 }
@@ -1720,7 +1720,7 @@
 	// 190
 	uint i = getVarOrByte();
 	if (!(_marks & (1 << i)))
-		o_waitForMark(i);
+		waitForMark(i);
 }
 
 // -----------------------------------------------------------------------
@@ -1832,7 +1832,7 @@
 
 void SimonEngine::o3_mouseOff() {
 	// 181: force mouseOff
-	o_mouseOff();
+	scriptMouseOff();
 	clearName();
 }
 
@@ -2029,7 +2029,19 @@
 	return true;
 }
 
-void SimonEngine::o_waitForMark(uint i) {
+void SimonEngine::scriptMouseOn() {
+	if (getGameType() == GType_SIMON2 && getBitFlag(79))
+		_mouseCursor = 0;
+	_mouseHideCount = 0;
+}
+
+void SimonEngine::scriptMouseOff() {
+	_lockWord |= 0x8000;
+	vc34_setMouseOff();
+	_lockWord &= ~0x8000;
+}
+
+void SimonEngine::waitForMark(uint i) {
 	_exitCutscene = false;
 	while (!(_marks & (1 << i))) {
 		if (_exitCutscene) {
@@ -2045,18 +2057,18 @@
 	}
 }
 
-void SimonEngine::o_freezeBottom() {
+void SimonEngine::freezeBottom() {
 	_vgaBufStart = _vgaBufFreeStart;
 	_vgaFileBufOrg = _vgaBufFreeStart;
 }
 
-void SimonEngine::o_unfreezeBottom() {
+void SimonEngine::unfreezeBottom() {
 	_vgaBufFreeStart = _vgaFileBufOrg2;
 	_vgaBufStart = _vgaFileBufOrg2;
 	_vgaFileBufOrg = _vgaFileBufOrg2;
 }
 
-void SimonEngine::o_sync(uint a) {
+void SimonEngine::sendSync(uint a) {
 	uint16 id = to16Wrapper(a);
 	_lockWord |= 0x8000;
 	_vcPtr = (byte *)&id;
@@ -2064,14 +2076,14 @@
 	_lockWord &= ~0x8000;
 }
 
-void SimonEngine::o_setTextColor(uint color) {
+void SimonEngine::setTextColor(uint color) {
 	WindowBlock *window;
 
 	window = _windowArray[_curWindow];
 	window->text_color = color;
 }
 
-void SimonEngine::o_kill_sprite_simon1(uint a) {
+void SimonEngine::kill_sprite_simon1(uint a) {
 	uint16 b = to16Wrapper(a);
 	_lockWord |= 0x8000;
 	_vcPtr = (byte *)&b;
@@ -2079,7 +2091,7 @@
 	_lockWord &= ~0x8000;
 }
 
-void SimonEngine::o_kill_sprite_simon2(uint a, uint b) {
+void SimonEngine::kill_sprite_simon2(uint a, uint b) {
 	uint16 items[2];
 
 	items[0] = to16Wrapper(a);

Modified: scummvm/trunk/engines/simon/oracle.cpp
===================================================================
--- scummvm/trunk/engines/simon/oracle.cpp	2006-04-10 08:49:28 UTC (rev 21759)
+++ scummvm/trunk/engines/simon/oracle.cpp	2006-04-10 09:18:07 UTC (rev 21760)
@@ -193,10 +193,10 @@
 			if (j == maxFiles + 1) {
 				showMessageFormat("\n");
 				hyperLinkOn(j + 400);
-				o_setTextColor(116);
+				setTextColor(116);
 	    			showMessageFormat(" %d. ",1);
 				hyperLinkOff();
-				o_setTextColor(113);
+				setTextColor(113);
 				k++;
 				j--;
 			}
@@ -209,11 +209,11 @@
 
 		showMessageFormat("\n");
 		hyperLinkOn(j + 400);
-		o_setTextColor(116);
+		setTextColor(116);
 		if (k < 10)
 			showMessageFormat(" ");
 		showMessageFormat("%d. ",k);
-		o_setTextColor(113);
+		setTextColor(113);
 		showMessageFormat("%s ",b);
 		hyperLinkOff();
 		j--;

Modified: scummvm/trunk/engines/simon/saveload.cpp
===================================================================
--- scummvm/trunk/engines/simon/saveload.cpp	2006-04-10 08:49:28 UTC (rev 21759)
+++ scummvm/trunk/engines/simon/saveload.cpp	2006-04-10 09:18:07 UTC (rev 21760)
@@ -146,7 +146,7 @@
 void SimonEngine::saveGameDialog(char *buf) {
 	int i;
 
-	o_unk_132_helper_3();
+	unk_132_helper_3();
 
 	i = displaySaveGameList(_saveLoadRowCurPos, _saveOrLoad, buf);
 
@@ -201,7 +201,7 @@
 
 restart:;
 	do {
-		i = o_unk_132_helper(&b, buf);
+		i = unk_132_helper(&b, buf);
 	} while (!b);
 
 	if (i == 205)
@@ -269,14 +269,14 @@
 
 			// do_2
 			do {
-				i = o_unk_132_helper(&b, buf);
+				i = unk_132_helper(&b, buf);
 
 				if (b) {
 					if (i == 205)
 						goto get_out;
 					clear_hitarea_bit_0x40(0xd0 + unk132_result);
 					if (_saveLoadFlag) {
-						o_clearCharacter(_windowArray[5], 8);
+						clearCharacter(_windowArray[5], 8);
 						// move code
 					}
 					goto if_1;
@@ -290,7 +290,7 @@
 			} while (i >= 0x80 || i == 0);
 
 			// after_do_2
-			o_clearCharacter(_windowArray[5], 8);
+			clearCharacter(_windowArray[5], 8);
 			if (i == 10 || i == 13)
 				break;
 			if (i == 8) {
@@ -309,7 +309,7 @@
 
 					name[name_len] = 0;
 
-					o_clearCharacter(_windowArray[5], x, m);
+					clearCharacter(_windowArray[5], x, m);
 				}
 			} else if (i >= 32 && name_len != 17) {
 				name[name_len++] = i;
@@ -320,14 +320,14 @@
 
 		// do_save
 		if (!saveGame(_saveLoadRowCurPos + unk132_result, buf + unk132_result * 18))
-			o_fileError(_windowArray[5], true);
+			fileError(_windowArray[5], true);
 	} else {
 		if (!loadGame(_saveLoadRowCurPos + i))
-			o_fileError(_windowArray[5], false);
+			fileError(_windowArray[5], false);
 	}
 
 get_out:;
-	o_unk_132_helper_3();
+	unk_132_helper_3();
 
 	_base_time = time(NULL) - save_time + _base_time;
 	_copyPartialMode = 0;
@@ -342,7 +342,7 @@
 	g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
 }
 
-int SimonEngine::o_unk_132_helper(bool *b, char *buf) {
+int SimonEngine::unk_132_helper(bool *b, char *buf) {
 	HitArea *ha;
 	*b = true;
 
@@ -402,12 +402,12 @@
 	return ha->id - 208;
 }
 
-void SimonEngine::o_unk_132_helper_3() {
+void SimonEngine::unk_132_helper_3() {
 	for (int i = 208; i != 208 + 6; i++)
 		set_hitarea_bit_0x40(i);
 }
 
-void SimonEngine::o_clearCharacter(WindowBlock *window, int x, byte b) {
+void SimonEngine::clearCharacter(WindowBlock *window, int x, byte b) {
 	byte old_text;
 
 	videoPutchar(window, x, b);
@@ -429,7 +429,7 @@
 	videoPutchar(window, 8);
 }
 
-void SimonEngine::o_fileError(WindowBlock *window, bool save_error) {
+void SimonEngine::fileError(WindowBlock *window, bool save_error) {
 	HitArea *ha;
 	const char *string, *string2;
 

Modified: scummvm/trunk/engines/simon/simon.cpp
===================================================================
--- scummvm/trunk/engines/simon/simon.cpp	2006-04-10 08:49:28 UTC (rev 21759)
+++ scummvm/trunk/engines/simon/simon.cpp	2006-04-10 09:18:07 UTC (rev 21760)
@@ -2366,7 +2366,7 @@
 	}
 }
 
-void SimonEngine::o_fadeToBlack() {
+void SimonEngine::fadeToBlack() {
 	uint i;
 
 	memcpy(_videoBuf1, _paletteBackup, 1024);
@@ -2509,19 +2509,7 @@
 	_lockWord &= ~1;
 }
 
-void SimonEngine::o_mouseOn() {
-	if (getGameType() == GType_SIMON2 && getBitFlag(79))
-		_mouseCursor = 0;
-	_mouseHideCount = 0;
-}
-
-void SimonEngine::o_mouseOff() {
-	_lockWord |= 0x8000;
-	vc34_setMouseOff();
-	_lockWord &= ~0x8000;
-}
-
-void SimonEngine::o_waitForSync(uint a) {
+void SimonEngine::waitForSync(uint a) {
 	_vgaWaitFor = a;
 	_syncCount = 0;
 	_exitCutscene = false;
@@ -2563,13 +2551,13 @@
 		if (getGameType() == GType_FF) {
 			_variableArray[103] = 5;
 			loadSprite(4, 2, 13, 0, 0, 0);
-			o_waitForSync(213);
-			o_kill_sprite_simon2(2, 1);
+			waitForSync(213);
+			kill_sprite_simon2(2, 1);
 		} else {
 			_variableArray[100] = 5;
 			loadSprite(4, 1, 30, 0, 0, 0);
-			o_waitForSync(130);
-			o_kill_sprite_simon2(2, 1);
+			waitForSync(130);
+			kill_sprite_simon2(2, 1);
 		}
 	}
 }
@@ -3239,16 +3227,16 @@
 				setBitFlag(14, true);
 				_variableArray[100] = 15;
 				loadSprite(4, 1, 130, 0, 0, 0);
-				o_waitForSync(130);
+				waitForSync(130);
 			}
 			_skipVgaWait = true;
 		} else {
 			if (_subtitles && _scriptVar2) {
 				loadSprite(4, 2, 204, 0, 0, 0);
-				o_waitForSync(204);
-				o_kill_sprite_simon1(204);
+				waitForSync(204);
+				kill_sprite_simon1(204);
 			}
-			o_kill_sprite_simon1(vgaSpriteId + 201);
+			kill_sprite_simon1(vgaSpriteId + 201);
 			_sound->playVoice(speech_id);
 			loadSprite(4, 2, vgaSpriteId + 201, 0, 0, 0);
 		}
@@ -3260,7 +3248,7 @@
 				setBitFlag(14, true);
 				_variableArray[100] = 5;
 				loadSprite(4, 1, 30, 0, 0, 0);
-				o_waitForSync(130);
+				waitForSync(130);
 			}
 			_skipVgaWait = true;
 		} else {
@@ -3269,11 +3257,11 @@
 				return;
 			} else if (_subtitles && _scriptVar2) {
 				loadSprite(4, 2, 5, 0, 0, 0);
-				o_waitForSync(205);
-				o_kill_sprite_simon2(2,5);
+				waitForSync(205);
+				kill_sprite_simon2(2,5);
 			}
 
-			o_kill_sprite_simon2(2, vgaSpriteId + 2);
+			kill_sprite_simon2(2, vgaSpriteId + 2);
 			_sound->playVoice(speech_id);
 			loadSprite(4, 2, vgaSpriteId + 2, 0, 0, 0);
 		}

Modified: scummvm/trunk/engines/simon/simon.h
===================================================================
--- scummvm/trunk/engines/simon/simon.h	2006-04-10 08:49:28 UTC (rev 21759)
+++ scummvm/trunk/engines/simon/simon.h	2006-04-10 09:18:07 UTC (rev 21760)
@@ -554,8 +554,8 @@
 	void unlinkItem(Item *item);
 	void linkItem(Item *item, Item *parent);
 
-	void o_kill_sprite_simon1(uint a);
-	void o_kill_sprite_simon2(uint a, uint b);
+	void kill_sprite_simon1(uint a);
+	void kill_sprite_simon2(uint a, uint b);
 
 	void changeWindow(uint a);
 	void closeWindow(uint a);
@@ -571,18 +571,18 @@
 	void hitarea_leave(HitArea * ha);
 	void leaveHitAreaById(uint hitarea_id);
 
-	void o_waitForSync(uint a);
+	void waitForSync(uint a);
 	void skipSpeech();
-	void o_sync(uint a);
-	void o_freezeBottom();
+	void sendSync(uint a);
+	void freezeBottom();
 	void killAllTimers();
 
 	uint getOffsetOfChild2Param(SubObject *child, uint prop);
-	void o_setTextColor(uint color);
-	void o_mouseOn();
-	void o_mouseOff();
-	void o_unfreezeBottom();
-	void o_fadeToBlack();
+	void setTextColor(uint color);
+	void scriptMouseOn();
+	void scriptMouseOff();
+	void unfreezeBottom();
+	void fadeToBlack();
 
 	TextLocation *getTextLocation(uint a);
 	void setup_cond_c_helper();
@@ -1080,7 +1080,7 @@
 	void delay(uint delay);
 	void pause();
 
-	void o_waitForMark(uint i);
+	void waitForMark(uint i);
 	void scrollEvent();
 
 	void decodeColumn(byte *dst, const byte *src, int height);
@@ -1097,11 +1097,11 @@
 	void set_volume(int volume);
 
 	void saveOrLoadDialog(bool load);
-	void o_unk_132_helper_3();
-	int o_unk_132_helper(bool *b, char *buf);
-	void o_clearCharacter(WindowBlock *window, int x, byte b = 0);
+	void unk_132_helper_3();
+	int unk_132_helper(bool *b, char *buf);
+	void clearCharacter(WindowBlock *window, int x, byte b = 0);
 	void saveGameDialog(char *buf);
-	void o_fileError(WindowBlock *window, bool save_error);
+	void fileError(WindowBlock *window, bool save_error);
 
 	int countSaveGames();
 	int displaySaveGameList(int curpos, bool load, char *dst);

Modified: scummvm/trunk/engines/simon/string.cpp
===================================================================
--- scummvm/trunk/engines/simon/string.cpp	2006-04-10 08:49:28 UTC (rev 21759)
+++ scummvm/trunk/engines/simon/string.cpp	2006-04-10 09:18:07 UTC (rev 21760)
@@ -168,7 +168,7 @@
 	_variableArray[53] = w;
 	_variableArray[54] = height;
 
-	o_kill_sprite_simon2(2, num + 6);
+	kill_sprite_simon2(2, num + 6);
 	renderString(num, 0, w, height, convertedString);
 	loadSprite(4, 2, num + 6, x, _interactY, 12);
 
@@ -279,9 +279,9 @@
 	}
 
 	if (getGameType() == GType_SIMON1)
-		o_kill_sprite_simon1(vgaSpriteId + 199);
+		kill_sprite_simon1(vgaSpriteId + 199);
 	else
-		o_kill_sprite_simon2(2, vgaSpriteId);
+		kill_sprite_simon2(2, vgaSpriteId);
 
 	if (getGameType() == GType_FF) {
 		renderString(1, color, width, height, convertedString);

Modified: scummvm/trunk/engines/simon/verb.cpp
===================================================================
--- scummvm/trunk/engines/simon/verb.cpp	2006-04-10 08:49:28 UTC (rev 21759)
+++ scummvm/trunk/engines/simon/verb.cpp	2006-04-10 09:18:07 UTC (rev 21760)
@@ -193,7 +193,7 @@
 	HitArea *ha;
 
 	if (getGameType() == GType_FF) {
-		o_kill_sprite_simon2(2, 6);
+		kill_sprite_simon2(2, 6);
 		_lastNameOn = NULL;
 		_animatePointer = 0;
 		_mouseAnim = 1;
@@ -202,7 +202,7 @@
 
 	if (getGameType() == GType_SIMON2) {
 		if (getBitFlag(79)) {
-			o_sync(202);
+			sendSync(202);
 			_lastNameOn = NULL;
 			return;
 		}
@@ -593,10 +593,10 @@
 				break;
 			checkUp(window);
 		}
-		o_waitForMark(2);
+		waitForMark(2);
 		checkUp(window);
-		o_sync(922);
-		o_waitForMark(1);
+		sendSync(922);
+		waitForMark(1);
 		checkUp(window);
 	} else {
 		if (window->iconPtr->line == 0)
@@ -619,10 +619,10 @@
 				break;
 			checkDown(window);
 		}
-		o_waitForMark(2);
+		waitForMark(2);
 		checkDown(window);
-		o_sync(924);
-		o_waitForMark(1);
+		sendSync(924);
+		waitForMark(1);
 		checkDown(window);
 	} else {
 		mouseOff();


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