From: Holger Schemel Date: Fri, 21 Feb 2020 15:14:37 +0000 (+0100) Subject: changed type of some variables X-Git-Tag: 4.2.0.0~74 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=e1015ff65ebebc0362ba23172acef6f35dc69f51;p=rocksndiamonds.git changed type of some variables --- diff --git a/src/game_em/convert.c b/src/game_em/convert.c index 03dacc4e..50914804 100644 --- a/src/game_em/convert.c +++ b/src/game_em/convert.c @@ -425,22 +425,26 @@ void prepare_em_level(void) for (i = 0; i < MAX_PLAYERS; i++) { ply[i].num = i; - ply[i].dynamite = 0; - ply[i].dynamite_cnt = 0; - ply[i].keys = 0; ply[i].anim = PLY_still; + ply[i].x = cav.player_x[i] + lev.left; ply[i].y = cav.player_y[i] + lev.top; ply[i].prev_x = ply[i].x; ply[i].prev_y = ply[i].y; + + ply[i].dynamite = 0; + ply[i].dynamite_cnt = 0; + ply[i].keys = 0; + ply[i].last_move_dir = MV_NONE; - ply[i].joy_n = 0; - ply[i].joy_e = 0; - ply[i].joy_s = 0; - ply[i].joy_w = 0; - ply[i].joy_snap = 0; - ply[i].joy_drop = 0; - ply[i].joy_stick = 0; + + ply[i].joy_n = FALSE; + ply[i].joy_e = FALSE; + ply[i].joy_s = FALSE; + ply[i].joy_w = FALSE; + ply[i].joy_snap = FALSE; + ply[i].joy_drop = FALSE; + ply[i].joy_stick = FALSE; } // the following engine variables are initialized to version-specific values diff --git a/src/game_em/emerald.h b/src/game_em/emerald.h index 8b5e05f2..63009f63 100644 --- a/src/game_em/emerald.h +++ b/src/game_em/emerald.h @@ -620,14 +620,14 @@ enum struct PLAYER { + int num; /* player number */ int anim; + int x; int y; int prev_x; int prev_y; - int num; /* player number */ - boolean exists; /* flag if player exists in cave */ boolean alive; /* flag if player is alive */ @@ -637,13 +637,13 @@ struct PLAYER int last_move_dir; - int joy_n:1; - int joy_e:1; - int joy_s:1; - int joy_w:1; - int joy_snap:1; - int joy_drop:1; - int joy_stick:1; + boolean joy_n; + boolean joy_e; + boolean joy_s; + boolean joy_w; + boolean joy_snap; + boolean joy_drop; + boolean joy_stick; }; struct LOGIC diff --git a/src/game_em/game.c b/src/game_em/game.c index 7842a89c..2d11170d 100644 --- a/src/game_em/game.c +++ b/src/game_em/game.c @@ -16,29 +16,33 @@ struct EngineSnapshotInfo_EM engine_snapshot_em; static void readjoy(byte action, struct PLAYER *ply) { - int north = 0, east = 0, south = 0, west = 0; - int snap = 0, drop = 0; + boolean north = FALSE; + boolean east = FALSE; + boolean south = FALSE; + boolean west = FALSE; + boolean snap = FALSE; + boolean drop = FALSE; if (game_em.use_single_button && action & (JOY_BUTTON_1 | JOY_BUTTON_2)) action |= JOY_BUTTON_1 | JOY_BUTTON_2; if (action & JOY_LEFT) - west = 1; + west = TRUE; if (action & JOY_RIGHT) - east = 1; + east = TRUE; if (action & JOY_UP) - north = 1; + north = TRUE; if (action & JOY_DOWN) - south = 1; + south = TRUE; if (action & JOY_BUTTON_1) - snap = 1; + snap = TRUE; if (action & JOY_BUTTON_2) - drop = 1; + drop = TRUE; /* always update drop action */ ply->joy_drop = drop; diff --git a/src/game_em/logic.c b/src/game_em/logic.c index be2bed34..9376c558 100644 --- a/src/game_em/logic.c +++ b/src/game_em/logic.c @@ -501,7 +501,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) if (dx && dy && ply->joy_snap) /* more than one direction specified */ return FALSE; - if (ply->joy_snap == 0) /* player wants to move */ + if (!ply->joy_snap) /* player wants to move */ { int element = cave[x][y]; @@ -1357,7 +1357,10 @@ static void check_player(struct PLAYER *ply) if (!can_move) { - ply->joy_n = ply->joy_e = ply->joy_s = ply->joy_w = 0; + ply->joy_n = FALSE; + ply->joy_e = FALSE; + ply->joy_s = FALSE; + ply->joy_w = FALSE; return; } @@ -1365,7 +1368,7 @@ static void check_player(struct PLAYER *ply) if (dx == 0 && dy == 0) { - ply->joy_stick = 0; + ply->joy_stick = FALSE; if (ply->joy_drop) { @@ -1387,11 +1390,15 @@ static void check_player(struct PLAYER *ply) return; } - ply->joy_stick = 1; - ply->joy_n = ply->joy_e = ply->joy_s = ply->joy_w = 0; + ply->joy_stick = TRUE; + ply->joy_n = FALSE; + ply->joy_e = FALSE; + ply->joy_s = FALSE; + ply->joy_w = FALSE; + ply->dynamite_cnt = 0; /* reset dynamite timer if we move */ - if (ply->joy_snap == 0) /* player wants to move */ + if (!ply->joy_snap) /* player wants to move */ { boolean moved = FALSE;