for (i = 0; i < MAX_PLAYERS; i++)
{
- ply[i].exists = 0;
- ply[i].alive_initial = FALSE;
+ ply[i].exists = FALSE;
+ ply[i].alive = FALSE;
if (cav.player_x[i] != -1 &&
cav.player_y[i] != -1)
{
- ply[i].exists = 1;
+ ply[i].exists = TRUE;
lev.home_initial++;
}
{
if (players_left)
{
- ply[i].alive_initial = TRUE;
+ ply[i].alive = TRUE;
players_left--;
}
else
for (i = 0; i < MAX_PLAYERS; i++)
{
ply[i].num = i;
- ply[i].alive = ply[i].alive_initial;
ply[i].dynamite = 0;
ply[i].dynamite_cnt = 0;
ply[i].keys = 0;
ply[i].anim = 0;
- ply[i].oldx = ply[i].x = cav.player_x[i] + lev.left;
- ply[i].oldy = ply[i].y = cav.player_y[i] + lev.top;
+ ply[i].prev_x = ply[i].x = cav.player_x[i] + lev.left;
+ ply[i].prev_y = ply[i].y = cav.player_y[i] + lev.top;
ply[i].last_move_dir = MV_NONE;
ply[i].joy_n = ply[i].joy_e = ply[i].joy_s = ply[i].joy_w = 0;
- ply[i].joy_snap = ply[i].joy_drop = 0;
- ply[i].joy_stick = ply[i].joy_spin = 0;
+ ply[i].joy_snap = 0;
+ ply[i].joy_drop = 0;
+ ply[i].joy_stick = 0;
}
// the following engine variables are initialized to version-specific values
struct PLAYER
{
- int num;
- int exists;
- int alive_initial;
- int alive;
-
- int dynamite;
- int dynamite_cnt;
- int keys;
int anim;
-
int x;
int y;
- int oldx;
- int oldy;
+ 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 */
+
+ int dynamite; /* number of pieces of collected dynamite */
+ int dynamite_cnt; /* how long the player has held down fire */
+ int keys; /* keys the player has collected */
int last_move_dir;
int joy_snap:1;
int joy_drop:1;
int joy_stick:1;
- int joy_spin:1;
};
struct LOGIC
#define VALID_SCREEN_Y(y) ((y) < MIN_SCREEN_Y ? MIN_SCREEN_Y : \
(y) > MAX_SCREEN_Y ? MAX_SCREEN_Y : (y))
-#define PLAYER_POS_X(nr) (((7 - frame) * ply[nr].oldx + \
+#define PLAYER_POS_X(nr) (((7 - frame) * ply[nr].prev_x + \
(1 + frame) * ply[nr].x) * TILEX / 8)
-#define PLAYER_POS_Y(nr) (((7 - frame) * ply[nr].oldy + \
+#define PLAYER_POS_Y(nr) (((7 - frame) * ply[nr].prev_y + \
(1 + frame) * ply[nr].y) * TILEY / 8)
#define PLAYER_SCREEN_X(nr) (PLAYER_POS_X(nr) - \
(int)(y2 - screen_y) < ((MAX_BUF_YSIZE - 1) * TILEY - 1))
{
/* some casts to "int" are needed because of negative calculation values */
- int dx = (int)ply[nr].x - (int)ply[nr].oldx;
- int dy = (int)ply[nr].y - (int)ply[nr].oldy;
- int old_x = (int)ply[nr].oldx + (int)frame * dx / 8;
- int old_y = (int)ply[nr].oldy + (int)frame * dy / 8;
+ int dx = (int)ply[nr].x - (int)ply[nr].prev_x;
+ int dy = (int)ply[nr].y - (int)ply[nr].prev_y;
+ int old_x = (int)ply[nr].prev_x + (int)frame * dx / 8;
+ int old_y = (int)ply[nr].prev_y + (int)frame * dy / 8;
int new_x = old_x + SIGN(dx);
int new_y = old_y + SIGN(dy);
int old_sx = old_x % MAX_BUF_XSIZE;
int x = ply->x;
int y = ply->y;
- ply->alive = 0;
+ ply->alive = FALSE;
switch (cave[x][y-1])
{
ply->joy_stick = 1;
ply->joy_n = ply->joy_e = ply->joy_s = ply->joy_w = 0;
ply->dynamite_cnt = 0; /* reset dynamite timer if we move */
- ply->joy_spin = !ply->joy_spin;
if (ply->joy_snap == 0) /* player wants to move */
{
game.set_centered_player_wrap = TRUE;
}
- ply[i].oldx = ply[i].x;
- ply[i].oldy = ply[i].y;
+ ply[i].prev_x = ply[i].x;
+ ply[i].prev_y = ply[i].y;
ply[i].anim = PLY_still;
}
if (!ply[i].alive)
continue;
- if (cave[ply[i].oldx][ply[i].oldy] == Zplayer)
+ if (cave[ply[i].prev_x][ply[i].prev_y] == Zplayer)
{
- cave[ply[i].oldx][ply[i].oldy] = Xblank;
- next[ply[i].oldx][ply[i].oldy] = Xblank;
+ cave[ply[i].prev_x][ply[i].prev_y] = Xblank;
+ next[ply[i].prev_x][ply[i].prev_y] = Xblank;
}
if (cave[ply[i].x][ply[i].y] == Xblank)