X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fgame.c;h=71740a8f4931186bbcd5a08847518cef733528d5;hp=c1846d6a147ff6abd76ec6caefe8f0e88b7f0d06;hb=b165e8970f5f3d8f9972433960785f31b9a11723;hpb=54cd73c4e6a8fc9521f0adda5501cd09eb294b4c diff --git a/src/game.c b/src/game.c index c1846d6a..71740a8f 100644 --- a/src/game.c +++ b/src/game.c @@ -3543,8 +3543,6 @@ void InitGame(void) if (network_playing) SendToServer_MovePlayer(MV_NONE); - ZX = ZY = -1; - FrameCounter = 0; TimeFrames = 0; TimePlayed = 0; @@ -3557,6 +3555,9 @@ void InitGame(void) ScrollStepSize = 0; // will be correctly initialized by ScrollScreen() + game.robot_wheel_x = -1; + game.robot_wheel_y = -1; + game.exit_x = -1; game.exit_y = -1; @@ -6846,12 +6847,14 @@ static void TurnRoundExt(int x, int y) } } - if (element == EL_ROBOT && ZX >= 0 && ZY >= 0 && - (Feld[ZX][ZY] == EL_ROBOT_WHEEL_ACTIVE || + if (element == EL_ROBOT && + game.robot_wheel_x >= 0 && + game.robot_wheel_y >= 0 && + (Feld[game.robot_wheel_x][game.robot_wheel_y] == EL_ROBOT_WHEEL_ACTIVE || game.engine_version < VERSION_IDENT(3,1,0,0))) { - attr_x = ZX; - attr_y = ZY; + attr_x = game.robot_wheel_x; + attr_y = game.robot_wheel_y; } if (element == EL_PENGUIN) @@ -9033,10 +9036,11 @@ static void RunRobotWheel(int x, int y) static void StopRobotWheel(int x, int y) { - if (ZX == x && ZY == y) + if (game.robot_wheel_x == x && + game.robot_wheel_y == y) { - ZX = ZY = -1; - + game.robot_wheel_x = -1; + game.robot_wheel_y = -1; game.robot_wheel_active = FALSE; } } @@ -11360,6 +11364,15 @@ static void GameActionsExt(void) SetVideoFrameDelay(game_frame_delay_value); + // (de)activate virtual buttons depending on current game status + if (strEqual(setup.touch.control_type, TOUCH_CONTROL_VIRTUAL_BUTTONS)) + { + if (game.all_players_gone) // if no players there to be controlled anymore + SetOverlayActive(FALSE); + else if (!tape.playing) // if game continues after tape stopped playing + SetOverlayActive(TRUE); + } + #if 0 #if 0 // ---------- main game synchronization point ---------- @@ -13448,8 +13461,8 @@ void RemovePlayer(struct PlayerInfo *player) game.GameOver = TRUE; } - game.exit_x = ZX = jx; - game.exit_y = ZY = jy; + game.exit_x = game.robot_wheel_x = jx; + game.exit_y = game.robot_wheel_y = jy; } void ExitPlayer(struct PlayerInfo *player) @@ -14072,9 +14085,9 @@ static int DigField(struct PlayerInfo *player, if (element == EL_ROBOT_WHEEL) { Feld[x][y] = EL_ROBOT_WHEEL_ACTIVE; - ZX = x; - ZY = y; + game.robot_wheel_x = x; + game.robot_wheel_y = y; game.robot_wheel_active = TRUE; TEST_DrawLevelField(x, y); @@ -15241,9 +15254,6 @@ static ListNode *SaveEngineSnapshotBuffers(void) SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(game)); SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(tape)); - SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(ZX)); - SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(ZY)); - SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(FrameCounter)); SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(TimeFrames)); SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(TimePlayed));