|
|
@ -12,6 +12,13 @@ draw_player (_player * player)
|
|
|
|
dest;
|
|
|
|
dest;
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((player->pos.x >> 8) < 0 || (player->pos.x >> 8) > bman.fieldsize.x ||
|
|
|
|
|
|
|
|
(player->pos.y >> 8) < 0 || (player->pos.y >> 8) > bman.fieldsize.y) {
|
|
|
|
|
|
|
|
d_fatal ("Draw Player out of range : [%d,%d]\n", (player->pos.x >> 8),
|
|
|
|
|
|
|
|
(player->pos.y >> 8));
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (PS_IS_alife (player->state)) {
|
|
|
|
if (PS_IS_alife (player->state)) {
|
|
|
|
/* player is alife */
|
|
|
|
/* player is alife */
|
|
|
|
dest.w = src.w = player->gfx->size.x;
|
|
|
|
dest.w = src.w = player->gfx->size.x;
|
|
|
@ -46,7 +53,7 @@ draw_player (_player * player)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
/* player is dead */
|
|
|
|
/* player is dead */
|
|
|
|
dest.w = src.w = gfx.dead.image->w;
|
|
|
|
dest.w = src.w = gfx.dead.image->w;
|
|
|
|
dest.h = src.h = player->gfx->size.y;
|
|
|
|
dest.h = src.h = player->gfx->size.y;
|
|
|
|
|
|
|
|
|
|
|
@ -78,32 +85,41 @@ restore_players_screen ()
|
|
|
|
y,
|
|
|
|
y,
|
|
|
|
ys,
|
|
|
|
ys,
|
|
|
|
ye;
|
|
|
|
ye;
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_PLAYERS; i++)
|
|
|
|
for (i = 0; i < MAX_PLAYERS; i++)
|
|
|
|
if ((PS_IS_used (bman.players[i].state)) && bman.players[i].old.x != -1) {
|
|
|
|
if ((PS_IS_used (bman.players[i].state)) && bman.players[i].old.x != -1) {
|
|
|
|
if ((bman.players[i].old.x & 0xFF) > 128) {
|
|
|
|
|
|
|
|
x = (bman.players[i].old.x >> 8);
|
|
|
|
if ((bman.players[i].old.x >> 8) < 0 || (bman.players[i].old.x >> 8) > bman.fieldsize.x
|
|
|
|
xe = (bman.players[i].old.x >> 8) + 2;
|
|
|
|
|| (bman.players[i].old.y >> 8) < 0
|
|
|
|
}
|
|
|
|
|| (bman.players[i].old.y >> 8) > bman.fieldsize.y)
|
|
|
|
|
|
|
|
d_fatal ("Restore Player out of range : playernr %d [%d,%d]\n", i,
|
|
|
|
|
|
|
|
(bman.players[i].old.x >> 8), (bman.players[i].old.y >> 8));
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
x = (bman.players[i].old.x >> 8) - 1;
|
|
|
|
if ((bman.players[i].old.x & 0xFF) > 128) {
|
|
|
|
xe = (bman.players[i].old.x >> 8) + 1;
|
|
|
|
x = (bman.players[i].old.x >> 8);
|
|
|
|
|
|
|
|
xe = (bman.players[i].old.x >> 8) + 2;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
x = (bman.players[i].old.x >> 8) - 1;
|
|
|
|
|
|
|
|
xe = (bman.players[i].old.x >> 8) + 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x < 0)
|
|
|
|
|
|
|
|
x = 0;
|
|
|
|
|
|
|
|
if (xe >= bman.fieldsize.x)
|
|
|
|
|
|
|
|
xe = bman.fieldsize.x - 1;
|
|
|
|
|
|
|
|
ys = (bman.players[i].old.y >> 8) - 1;
|
|
|
|
|
|
|
|
ye = (bman.players[i].old.y >> 8) + 1;
|
|
|
|
|
|
|
|
if (ys < 0)
|
|
|
|
|
|
|
|
ys = 0;
|
|
|
|
|
|
|
|
if (ye >= bman.fieldsize.y)
|
|
|
|
|
|
|
|
ye = bman.fieldsize.y - 1;
|
|
|
|
|
|
|
|
xs = x;
|
|
|
|
|
|
|
|
for (; x <= xe; x++)
|
|
|
|
|
|
|
|
for (y = ys; y <= ye; y++)
|
|
|
|
|
|
|
|
draw_stone (x, y);
|
|
|
|
|
|
|
|
gfx_AddUpdateRect (xs * gfx.block.x + gfx.offset.x, ys * gfx.block.y + gfx.offset.y,
|
|
|
|
|
|
|
|
gfx.block.x * 3, gfx.block.y * 3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (x < 0)
|
|
|
|
|
|
|
|
x = 0;
|
|
|
|
|
|
|
|
if (xe >= bman.fieldsize.x)
|
|
|
|
|
|
|
|
xe = bman.fieldsize.x - 1;
|
|
|
|
|
|
|
|
ys = (bman.players[i].old.y >> 8) - 1;
|
|
|
|
|
|
|
|
ye = (bman.players[i].old.y >> 8) + 1;
|
|
|
|
|
|
|
|
if (ys < 0)
|
|
|
|
|
|
|
|
ys = 0;
|
|
|
|
|
|
|
|
if (ye >= bman.fieldsize.y)
|
|
|
|
|
|
|
|
ye = bman.fieldsize.y - 1;
|
|
|
|
|
|
|
|
xs = x;
|
|
|
|
|
|
|
|
for (; x <= xe; x++)
|
|
|
|
|
|
|
|
for (y = ys; y <= ye; y++)
|
|
|
|
|
|
|
|
draw_stone (x, y);
|
|
|
|
|
|
|
|
gfx_AddUpdateRect (xs * gfx.block.x + gfx.offset.x, ys * gfx.block.y + gfx.offset.y,
|
|
|
|
|
|
|
|
gfx.block.x * 3, gfx.block.y * 3);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -405,7 +421,7 @@ player_died (_player * player, signed char dead_by)
|
|
|
|
if (PS_IS_alife (player->state) && dead_by >= 0 && dead_by < MAX_PLAYERS)
|
|
|
|
if (PS_IS_alife (player->state) && dead_by >= 0 && dead_by < MAX_PLAYERS)
|
|
|
|
if (bman.p_nr != dead_by)
|
|
|
|
if (bman.p_nr != dead_by)
|
|
|
|
bman.players[dead_by].points++;
|
|
|
|
bman.players[dead_by].points++;
|
|
|
|
player->frame = 0;
|
|
|
|
player->frame = 0;
|
|
|
|
player->state &= (0xFF - PSF_alife);
|
|
|
|
player->state &= (0xFF - PSF_alife);
|
|
|
|
player->dead_by = dead_by;
|
|
|
|
player->dead_by = dead_by;
|
|
|
|
if (GT_MP_PTP)
|
|
|
|
if (GT_MP_PTP)
|
|
|
@ -432,23 +448,23 @@ player_animation (_player * player)
|
|
|
|
if (player->gfx == NULL)
|
|
|
|
if (player->gfx == NULL)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if (PS_IS_alife (player->state)) {
|
|
|
|
if (PS_IS_alife (player->state)) {
|
|
|
|
if (player->frame < player->gfx->ani.frames
|
|
|
|
if (player->frame < player->gfx->ani.frames
|
|
|
|
&& (player->frameto <= 0 || player->frameto > ANI_PLAYERTIMEOUT)) {
|
|
|
|
&& (player->frameto <= 0 || player->frameto > ANI_PLAYERTIMEOUT)) {
|
|
|
|
player->frameto = ANI_PLAYERTIMEOUT;
|
|
|
|
player->frameto = ANI_PLAYERTIMEOUT;
|
|
|
|
player->frame++;
|
|
|
|
player->frame++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (player->frame >= player->gfx->ani.frames)
|
|
|
|
if (player->frame >= player->gfx->ani.frames)
|
|
|
|
player->frame = 0;
|
|
|
|
player->frame = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (PS_IS_dead (player->state)) {
|
|
|
|
if (PS_IS_dead (player->state)) {
|
|
|
|
if (player->frame < gfx.dead.frames
|
|
|
|
if (player->frame < gfx.dead.frames
|
|
|
|
&& (player->frameto <= 0 || player->frameto > ANI_PLAYERTIMEOUT * 2)) {
|
|
|
|
&& (player->frameto <= 0 || player->frameto > ANI_PLAYERTIMEOUT * 2)) {
|
|
|
|
player->frameto = ANI_PLAYERTIMEOUT * 2;
|
|
|
|
player->frameto = ANI_PLAYERTIMEOUT * 2;
|
|
|
|
player->frame++;
|
|
|
|
player->frame++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (player->frameto > 0)
|
|
|
|
if (player->frameto > 0)
|
|
|
|
player->frameto--;
|
|
|
|
player->frameto--;
|
|
|
|