aboutsummaryrefslogtreecommitdiff
path: root/engines/agi
diff options
context:
space:
mode:
authorMatthew Hoops2011-05-07 15:25:55 -0400
committerMatthew Hoops2011-05-07 15:25:55 -0400
commit8dd17a2ae11db5033d732d3f625ec48ab556f2f3 (patch)
tree0a5ed5819193f1824efd2a86230afa0df62d736a /engines/agi
parentbfecb37501b6fdc35f2802216db5fb2b0e54b8ee (diff)
downloadscummvm-rg350-8dd17a2ae11db5033d732d3f625ec48ab556f2f3.tar.gz
scummvm-rg350-8dd17a2ae11db5033d732d3f625ec48ab556f2f3.tar.bz2
scummvm-rg350-8dd17a2ae11db5033d732d3f625ec48ab556f2f3.zip
AGI: Replace Winnie macros with functions
From patch #3298149
Diffstat (limited to 'engines/agi')
-rw-r--r--engines/agi/preagi_winnie.cpp51
-rw-r--r--engines/agi/preagi_winnie.h2
2 files changed, 24 insertions, 29 deletions
diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp
index c92434c15f..ef35a0b4e0 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 5a5472feb0..0187d80326 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();