diff options
author | Kari Salminen | 2008-08-08 13:30:01 +0000 |
---|---|---|
committer | Kari Salminen | 2008-08-08 13:30:01 +0000 |
commit | 5cb08bd1e5aca23f685caee0544a77d4824cec15 (patch) | |
tree | 70ef78d30271e1d32ed7611f2ff7775686995992 /engines/cine/various.cpp | |
parent | f68d52ce4df7630cb86f2ff7e392fa91217d7fe1 (diff) | |
download | scummvm-rg350-5cb08bd1e5aca23f685caee0544a77d4824cec15.tar.gz scummvm-rg350-5cb08bd1e5aca23f685caee0544a77d4824cec15.tar.bz2 scummvm-rg350-5cb08bd1e5aca23f685caee0544a77d4824cec15.zip |
Added basic moving using keyboard (Only works in Operation Stealth at the moment):
- Should make it possible to complete the first arcade sequence legitimately
Renamed input variables (Their names were mixed up between Future Wars and Operation Stealth):
- Future Wars's inputVar1 -> egoMovedWithKeyboard
- Future Wars's inputVar2 -> xMoveKeyb
- Future Wars's inputVar3 -> yMoveKeyb
- Operation Stealth's inputVar0 -> xMoveKeyb
- Operation Stealth's inputVar1 -> yMoveKeyb
svn-id: r33698
Diffstat (limited to 'engines/cine/various.cpp')
-rw-r--r-- | engines/cine/various.cpp | 67 |
1 files changed, 52 insertions, 15 deletions
diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp index 371f1bcbee..01039a30a4 100644 --- a/engines/cine/various.cpp +++ b/engines/cine/various.cpp @@ -95,11 +95,23 @@ int16 saveVar2; byte isInPause = 0; -// TODO: Implement inputVar0's changes in the program -// Currently inputVar0 isn't updated anywhere even though it's used at least in processSeqListElement. -uint16 inputVar0 = 0; -byte inputVar1 = 0; -uint16 inputVar2 = 0, inputVar3 = 0; +/*! \brief Values used by the xMoveKeyb variable */ +enum xMoveKeybEnums { + kKeybMoveCenterX = 0, + kKeybMoveRight = 1, + kKeybMoveLeft = 2 +}; + +/*! \brief Values used by the yMoveKeyb variable */ +enum yMoveKeybEnums { + kKeybMoveCenterY = 0, + kKeybMoveDown = 1, + kKeybMoveUp = 2 +}; + +uint16 xMoveKeyb = kKeybMoveCenterX; +bool egoMovedWithKeyboard = false; +uint16 yMoveKeyb = kKeybMoveCenterY; SelectedObjStruct currentSelectedObject; @@ -117,6 +129,31 @@ uint16 exitEngine; uint16 zoneData[NUM_MAX_ZONE]; uint16 zoneQuery[NUM_MAX_ZONE]; //!< Only exists in Operation Stealth +/*! \brief Move the player character using the keyboard + * \param x Negative values move left, positive right, zero not at all + * \param y Negative values move down, positive up, zero not at all + * NOTE: If both x and y are zero then the character stops + * FIXME: This seems to only work in Operation Stealth. May need code changes somewhere else... + */ +void moveUsingKeyboard(int x, int y) { + if (x > 0) { + xMoveKeyb = kKeybMoveRight; + } else if (x < 0) { + xMoveKeyb = kKeybMoveLeft; + } else { + xMoveKeyb = kKeybMoveCenterX; + } + + if (y > 0) { + yMoveKeyb = kKeybMoveUp; + } else if (y < 0) { + yMoveKeyb = kKeybMoveDown; + } else { + yMoveKeyb = kKeybMoveCenterY; + } + + egoMovedWithKeyboard = x || y; +} void stopMusicAfterFadeOut(void) { // if (g_sfxPlayer->_fadeOutCounter != 0 && g_sfxPlayer->_fadeOutCounter < 100) { @@ -1875,8 +1912,8 @@ uint16 executePlayerInput(void) { var_2 = 0; } - if (inputVar1 && allowPlayerInput) { // use keyboard - inputVar1 = 0; + if (egoMovedWithKeyboard && allowPlayerInput) { // use keyboard + egoMovedWithKeyboard = false; switch (globalVars[VAR_MOUSE_X_MODE]) { case 1: @@ -1908,8 +1945,8 @@ uint16 executePlayerInput(void) { globalVars[VAR_MOUSE_X_POS] = mouseX; globalVars[VAR_MOUSE_Y_POS] = mouseY; } else { - if (inputVar2) { - if (inputVar2 == 2) { + if (xMoveKeyb) { + if (xMoveKeyb == kKeybMoveLeft) { globalVars[VAR_MOUSE_X_POS] = 1; } else { globalVars[VAR_MOUSE_X_POS] = 320; @@ -1918,8 +1955,8 @@ uint16 executePlayerInput(void) { globalVars[VAR_MOUSE_X_POS] = mouseX; } - if (inputVar3) { - if (inputVar3 == 2) { + if (yMoveKeyb) { + if (yMoveKeyb == kKeybMoveUp) { globalVars[VAR_MOUSE_Y_POS] = 1; } else { globalVars[VAR_MOUSE_Y_POS] = 200; @@ -2357,9 +2394,9 @@ void processSeqListElement(SeqListElement &element) { } computeMove1(element, ptr1[4] + x, ptr1[5] + y, param1, param2, x2, y2); } else { - if (inputVar0 && allowPlayerInput) { + if (xMoveKeyb && allowPlayerInput) { int16 adder = param1 + 1; - if (inputVar0 != 1) { + if (xMoveKeyb != kKeybMoveRight) { adder = -adder; } // FIXME: In Operation Stealth's disassembly global variable 251 is used here @@ -2368,9 +2405,9 @@ void processSeqListElement(SeqListElement &element) { globalVars[VAR_MOUSE_X_POS] = globalVars[251] = ptr1[4] + x + adder; } - if (inputVar1 && allowPlayerInput) { + if (yMoveKeyb && allowPlayerInput) { int16 adder = param2 + 1; - if (inputVar1 != 1) { + if (yMoveKeyb != kKeybMoveDown) { adder = -adder; } // TODO: Name currently unnamed global variable 252 |