adding respawn

origin
stpohle 22 years ago
parent 1b6eb9d627
commit dc0198efbd

@ -1,4 +1,4 @@
/* $Id: basic.h,v 1.17 2004/01/25 19:36:44 stpohle Exp $ */ /* $Id: basic.h,v 1.18 2004/01/27 20:44:02 stpohle Exp $ */
/* basic types which we need everywhere */ /* basic types which we need everywhere */
#ifndef _BC_BASIC_H_ #ifndef _BC_BASIC_H_
@ -193,12 +193,14 @@ enum _playerstateflags { // not Set | Set
PSF_net = 2, // Local Player | Network Player PSF_net = 2, // Local Player | Network Player
PSF_alife = 4, // Player is Dead | Player is Alife PSF_alife = 4, // Player is Dead | Player is Alife
PSF_playing = 8, // Watching Player| Playing Player -- as long as one don't delete PSF_playing = 8, // Watching Player| Playing Player -- as long as one don't delete
PSF_ai = 16 // | AI Player PSF_ai = 16, // | AI Player
PSF_respawn = 32 // | Player is Respawning
}; };
#define PSFM_used (PSF_used + PSF_playing) #define PSFM_used (PSF_used + PSF_playing)
#define PSFM_alife (PSF_used + PSF_alife + PSF_playing) #define PSFM_alife (PSF_used + PSF_alife + PSF_playing)
#define PS_IS_dead(__ps) (((__ps) & (PSFM_alife)) == (PSFM_used)) #define PS_IS_dead(__ps) (((__ps) & (PSFM_alife + PSF_respawn)) == (PSFM_used))
#define PS_IS_respawn(__ps) ((PSFM_alife + PSF_respawn) == (PSFM_used + PSF_respawn))
#define PS_IS_alife(__ps) (((__ps) & (PSFM_alife)) == (PSFM_alife)) #define PS_IS_alife(__ps) (((__ps) & (PSFM_alife)) == (PSFM_alife))
#define PS_IS_netplayer(__ps) (((__ps) & (PSF_net)) != 0) #define PS_IS_netplayer(__ps) (((__ps) & (PSF_net)) != 0)
#define PS_IS_playing(__ps) (((__ps) & (PSFM_used)) == (PSFM_used)) #define PS_IS_playing(__ps) (((__ps) & (PSFM_used)) == (PSFM_used))

@ -1,4 +1,4 @@
/* $Id: gfx.h,v 1.5 2004/01/06 19:52:02 stpohle Exp $ */ /* $Id: gfx.h,v 1.6 2004/01/27 20:44:02 stpohle Exp $ */
#ifndef _GFX_H_ #ifndef _GFX_H_
#define _GFX_H_ #define _GFX_H_
@ -58,6 +58,7 @@ struct __gfx {
_gfxani bomb; // bomb animation _gfxani bomb; // bomb animation
_gfxani ill; // sick animation above the player _gfxani ill; // sick animation above the player
_gfxani dead; // load the dead player animation _gfxani dead; // load the dead player animation
_gfxani respawn; // respawn image
_gfxani menuselect; // The Menu Select GFX (the bomb ?) _gfxani menuselect; // The Menu Select GFX (the bomb ?)

@ -1,4 +1,4 @@
/* $Id: game.c,v 1.71 2004/01/25 20:32:45 stpohle Exp $ /* $Id: game.c,v 1.72 2004/01/27 20:44:03 stpohle Exp $
game.c - procedures for the game. */ game.c - procedures for the game. */
#include <string.h> #include <string.h>
@ -250,9 +250,9 @@ game_loop ()
if (((bman.players_nr < 2 if (((bman.players_nr < 2
&& (GT_MP || (GT_SP && bman.ai_players > 0))) && (GT_MP || (GT_SP && bman.ai_players > 0)))
|| (GT_SP && bman.ai_players == 0 && bman.players_nr < 1)) || (GT_SP && bman.ai_players == 0 && bman.players_nr < 1))
&& bman.timeout >= 0.0) && bman.timeout >= 0.0 && bman.gametype == GT_bomberman)
bman.timeout = 0.0f; bman.timeout = 0.0f;
if (bman.timeout < -GAME_OVERTIMEOUT) { if (bman.timeout < -GAME_OVERTIMEOUT) {
d_printf ("GAME: Game Over\n"); d_printf ("GAME: Game Over\n");
done = 1; done = 1;

@ -1,4 +1,4 @@
/* $Id: player.c,v 1.67 2004/01/25 19:37:05 stpohle Exp $ /* $Id: player.c,v 1.68 2004/01/27 20:44:03 stpohle Exp $
* player.c - everything what have to do with the player */ * player.c - everything what have to do with the player */
#include <SDL.h> #include <SDL.h>
@ -56,6 +56,37 @@ draw_player (_player * player)
} }
} }
else if (PS_IS_respawn (player->state)) {
/* player is respawning
* first: draw the star */
dest.w = src.w = gfx.respawn.image->w;
dest.h = src.h = player->gfx->ani.h;
dest.x = gfx.offset.x + ((player->pos.x-0.5f) * gfx.block.x);
dest.y = gfx.offset.y + ((player->pos.y - 1.0f) * gfx.block.y);
src.x = 0;
src.y = (2 * gfx.block.y) * (int)player->frame;
gfx_blit (gfx.respawn.image, &src, gfx.screen, &dest, 0xFFFF);
if (player->frame > (player->gfx->ani.frames/2)) {
/* second: draw the player behind the star */
dest.x =
gfx.offset.x + player->gfx->offset.x + player->pos.x * gfx.block.x;
dest.y =
gfx.offset.y + player->gfx->offset.y + player->pos.y * gfx.block.y;
dest.w = src.w = player->gfx->ani.w;
dest.h = src.h = player->gfx->ani.h;
src.x = 0;
src.y = 0;
gfx_blit (player->gfx->ani.image, &src, gfx.screen, &dest, 0xE000);
}
}
else { else {
/* player is dead */ /* player is dead */
dest.w = src.w = gfx.dead.image->w; dest.w = src.w = gfx.dead.image->w;
@ -71,6 +102,7 @@ draw_player (_player * player)
gfx_blit (gfx.dead.image, &src, gfx.screen, &dest, 0xFFFF); gfx_blit (gfx.dead.image, &src, gfx.screen, &dest, 0xFFFF);
} }
player->old = player->pos; // save this position player->old = player->pos; // save this position
}; };

Loading…
Cancel
Save