[Scummvm-cvs-logs] scummvm master -> 8dd17a2ae11db5033d732d3f625ec48ab556f2f3

clone2727 clone2727 at gmail.com
Sat May 7 21:29:48 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
8dd17a2ae1 AGI: Replace Winnie macros with functions


Commit: 8dd17a2ae11db5033d732d3f625ec48ab556f2f3
    https://github.com/scummvm/scummvm/commit/8dd17a2ae11db5033d732d3f625ec48ab556f2f3
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-05-07T12:25:55-07:00

Commit Message:
AGI: Replace Winnie macros with functions

>From patch #3298149

Changed paths:
    engines/agi/preagi_winnie.cpp
    engines/agi/preagi_winnie.h



diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp
index c92434c..ef35a0b 100644
--- a/engines/agi/preagi_winnie.cpp
+++ b/engines/agi/preagi_winnie.cpp
@@ -217,15 +217,9 @@ int Winnie::getObjInRoom(int iRoom) {
 	return 0;
 }
 
-#define setTakeDrop() {\
-	if (getObjInRoom(_room))\
-		fCanSel[IDI_WTP_SEL_TAKE] = true;\
-	else\
-		fCanSel[IDI_WTP_SEL_TAKE] = false;\
-	if (_game.iObjHave)\
-		fCanSel[IDI_WTP_SEL_DROP] = true;\
-	else\
-		fCanSel[IDI_WTP_SEL_DROP] = false;\
+void Winnie::setTakeDrop(int fCanSel[]) {
+	fCanSel[IDI_WTP_SEL_TAKE] = getObjInRoom(_room);
+	fCanSel[IDI_WTP_SEL_DROP] = _game.iObjHave;
 }
 
 void Winnie::setFlag(int iFlag) {
@@ -281,7 +275,7 @@ int Winnie::parser(int pc, int index, uint8 *buffer) {
 				fCanSel[IDI_WTP_SEL_EAST] = fCanSel[IDI_WTP_SEL_WEST] = true;
 
 			// check if object in room or player carrying one
-			setTakeDrop();
+			setTakeDrop(fCanSel);
 
 			// check which rows have a menu option
 			for (iSel = 0; iSel < IDI_WTP_MAX_OPTION; iSel++) {
@@ -367,11 +361,11 @@ int Winnie::parser(int pc, int index, uint8 *buffer) {
 				break;
 			case IDI_WTP_SEL_TAKE:
 				takeObj(_room);
-				setTakeDrop();
+				setTakeDrop(fCanSel);
 				break;
 			case IDI_WTP_SEL_DROP:
 				dropObj(_room);
-				setTakeDrop();
+				setTakeDrop(fCanSel);
 				break;
 			}
 		}
@@ -796,13 +790,12 @@ void Winnie::getMenuMouseSel(int *iSel, int fCanSel[], int x, int y) {
 	}
 }
 
-#define makeSel() {\
-	if (fCanSel[*iSel]) {\
-		return;\
-	} else {\
-		keyHelp();\
-		clrMenuSel(iSel, fCanSel);\
-	}\
+void Winnie::makeSel(int *iSel, int fCanSel[]) {
+	if (fCanSel[*iSel])
+		return;
+
+	keyHelp();
+	clrMenuSel(iSel, fCanSel);
 }
 
 void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) {
@@ -844,22 +837,22 @@ void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) {
 				// Click to move
 				if (fCanSel[IDI_WTP_SEL_NORTH] && hotspotNorth.contains(event.mouse.x, event.mouse.y)) {
 					*iSel = IDI_WTP_SEL_NORTH;
-					makeSel();
+					makeSel(iSel, fCanSel);
 					_vm->_gfx->setCursorPalette(false);
 					return;
 				} else if (fCanSel[IDI_WTP_SEL_SOUTH] && hotspotSouth.contains(event.mouse.x, event.mouse.y)) {
 					*iSel = IDI_WTP_SEL_SOUTH;
-					makeSel();
+					makeSel(iSel, fCanSel);
 					_vm->_gfx->setCursorPalette(false);
 					return;
 				} else if (fCanSel[IDI_WTP_SEL_WEST] && hotspotWest.contains(event.mouse.x, event.mouse.y)) {
 					*iSel = IDI_WTP_SEL_WEST;
-					makeSel();
+					makeSel(iSel, fCanSel);
 					_vm->_gfx->setCursorPalette(false);
 					return;
 				} else if (fCanSel[IDI_WTP_SEL_EAST] && hotspotEast.contains(event.mouse.x, event.mouse.y)) {
 					*iSel = IDI_WTP_SEL_EAST;
-					makeSel();
+					makeSel(iSel, fCanSel);
 					_vm->_gfx->setCursorPalette(false);
 					return;
 				} else {
@@ -944,31 +937,31 @@ void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) {
 					break;
 				case Common::KEYCODE_n:
 					*iSel = IDI_WTP_SEL_NORTH;
-					makeSel();
+					makeSel(iSel, fCanSel);
 					break;
 				case Common::KEYCODE_s:
 					if (event.kbd.flags & Common::KBD_CTRL) {
 						_vm->flipflag(fSoundOn);
 					} else {
 						*iSel = IDI_WTP_SEL_SOUTH;
-						makeSel();
+						makeSel(iSel, fCanSel);
 					}
 					break;
 				case Common::KEYCODE_e:
 					*iSel = IDI_WTP_SEL_EAST;
-					makeSel();
+					makeSel(iSel, fCanSel);
 					break;
 				case Common::KEYCODE_w:
 					*iSel = IDI_WTP_SEL_WEST;
-					makeSel();
+					makeSel(iSel, fCanSel);
 					break;
 				case Common::KEYCODE_t:
 					*iSel = IDI_WTP_SEL_TAKE;
-					makeSel();
+					makeSel(iSel, fCanSel);
 					break;
 				case Common::KEYCODE_d:
 					*iSel = IDI_WTP_SEL_DROP;
-					makeSel();
+					makeSel(iSel, fCanSel);
 					break;
 				case Common::KEYCODE_RETURN:
 					switch (*iSel) {
diff --git a/engines/agi/preagi_winnie.h b/engines/agi/preagi_winnie.h
index 5a5472f..0187d80 100644
--- a/engines/agi/preagi_winnie.h
+++ b/engines/agi/preagi_winnie.h
@@ -342,6 +342,8 @@ private:
 	void saveGame();
 	void loadGame();
 	void dropObjRnd();
+	void setTakeDrop(int[]);
+	void makeSel(int*, int[]);
 
 	void wind();
 	void mist();






More information about the Scummvm-git-logs mailing list