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
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 */
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
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;
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];
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;
}
if (dx == 0 && dy == 0)
{
- ply->joy_stick = 0;
+ ply->joy_stick = FALSE;
if (ply->joy_drop)
{
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;