From: Holger Schemel Date: Wed, 14 Nov 2018 20:10:38 +0000 (+0100) Subject: moved (and renamed) global variables to game structure (ZX/ZY) X-Git-Tag: 4.1.2.0~103 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=4666f6614557b1a47fda7442da7523519a4a1ac6;p=rocksndiamonds.git moved (and renamed) global variables to game structure (ZX/ZY) --- diff --git a/src/game.c b/src/game.c index c1846d6a..fd774e84 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; } } @@ -13448,8 +13452,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 +14076,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 +15245,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)); diff --git a/src/game.h b/src/game.h index bba270cd..195f4202 100644 --- a/src/game.h +++ b/src/game.h @@ -204,6 +204,7 @@ struct GameInfo int players_still_needed; int friends_still_needed; + int robot_wheel_x, robot_wheel_y; int exit_x, exit_y; boolean all_players_gone; diff --git a/src/game_mm/mm_main.h b/src/game_mm/mm_main.h index 94825661..946afd1a 100644 --- a/src/game_mm/mm_main.h +++ b/src/game_mm/mm_main.h @@ -234,7 +234,6 @@ extern int FfwdFrameDelay; extern int BX1, BY1, BX2, BY2; extern int SBX_Left, SBX_Right; extern int SBY_Upper, SBY_Lower; -extern int ZX, ZY; extern int TimeFrames, TimePlayed, TimeLeft; extern boolean SiebAktiv; extern int SiebCount; diff --git a/src/main.c b/src/main.c index 1805b6e0..109e88d0 100644 --- a/src/main.c +++ b/src/main.c @@ -126,7 +126,6 @@ int BX1, BY1; int BX2, BY2; int SBX_Left, SBX_Right; int SBY_Upper, SBY_Lower; -int ZX, ZY; int TimeFrames, TimePlayed, TimeLeft, TapeTime; diff --git a/src/main.h b/src/main.h index 45d46969..5a6268d9 100644 --- a/src/main.h +++ b/src/main.h @@ -3628,7 +3628,6 @@ extern int BX1, BY1; extern int BX2, BY2; extern int SBX_Left, SBX_Right; extern int SBY_Upper, SBY_Lower; -extern int ZX, ZY; extern int TimeFrames, TimePlayed, TimeLeft, TapeTime;