From 2ba905cadd24c75279bf5c54413eae7d3854016f Mon Sep 17 00:00:00 2001 From: stpohle Date: Tue, 6 Jan 2004 02:19:56 +0000 Subject: [PATCH] Illness Problem again.. --- include/bomberclone.h | 4 ++-- src/debug.c | 14 ++++++++++---- src/game.c | 8 +++++++- src/player.c | 44 +++++++++++++++++++++---------------------- 4 files changed, 40 insertions(+), 30 deletions(-) diff --git a/include/bomberclone.h b/include/bomberclone.h index bb9403b..dd3df3a 100644 --- a/include/bomberclone.h +++ b/include/bomberclone.h @@ -1,4 +1,4 @@ -/* $Id: bomberclone.h,v 1.13 2004/01/06 01:24:55 stpohle Exp $ */ +/* $Id: bomberclone.h,v 1.14 2004/01/06 02:19:56 stpohle Exp $ */ /* bomberclone.h */ #ifndef _BOMBERCLONE_H_ @@ -205,7 +205,7 @@ extern int check_exfield (short int x, short int y); extern void player_calcpos (); extern void player_set_ilness (_player * p, int t, float new_to); extern void player_clear_ilness (_player *p, int type); -extern void player_ilness_loop (); +extern void player_ilness_loop (int plnr); extern void player_check_powerup (int p_nr); extern void player_set_gfx (_player *p, signed char gfx_nr); extern int player_findfreebomb (_player *player); diff --git a/src/debug.c b/src/debug.c index 3dac129..c020721 100644 --- a/src/debug.c +++ b/src/debug.c @@ -68,7 +68,8 @@ void d_fatal (char *fmt,...) { void debug_ingameinfo() { - int i; + int i, j; + float fl; char text[255]; for (i = 0; i < map.size.x; i++) @@ -81,10 +82,15 @@ void debug_ingameinfo() { sprintf (text, "P:"); for (i = 0; i < MAX_PLAYERS; i++) - if (PS_IS_playing (players[i].state)) - sprintf (text, "%s %2.2f,%2.2f[%2.2f]", text, players[i].pos.x, players[i].pos.y, players[i].frame); + if (PS_IS_playing (players[i].state)) { + for (j = 0, fl = 0.0f; j < PI_max; j++) + if (fl < players[i].ill[j].to) + fl = players[i].ill[j].to; + + sprintf (text, "%s TO:%2.2f ", text, fl); + } font_gfxdraw (0, gfx.res.y-font[0].size.y*2, text, 0, 0, (map.size.y*256)+10); - + if (bman.p_nr >= 0 && bman.p_nr < MAX_PLAYERS) { sprintf (text, "Pos: %2.3f,%2.3f", players[bman.p_nr].pos.x, players[bman.p_nr].pos.y); font_gfxdraw (350, gfx.res.y-font[0].size.y, text, 0, 0, (map.size.y*256)+10); diff --git a/src/game.c b/src/game.c index b8a3af3..1a7784c 100644 --- a/src/game.c +++ b/src/game.c @@ -1,4 +1,4 @@ -/* $Id: game.c,v 1.67 2004/01/04 01:28:34 stpohle Exp $ +/* $Id: game.c,v 1.68 2004/01/06 02:19:57 stpohle Exp $ game.c - procedures for the game. */ #include @@ -208,6 +208,12 @@ game_loop () bman.updatestatusbar = 1; // force an update } + if (keys[SDLK_F9] && event.type == SDL_KEYDOWN) { + /* Switch Fullscreen */ + debug = !debug; + bman.updatestatusbar = 1; // force an update + } + if (event.key.keysym.sym == SDLK_ESCAPE && event.type == SDL_KEYDOWN) { bman.state = GS_startup; done = 1; diff --git a/src/player.c b/src/player.c index cf318fd..fc5e9dc 100644 --- a/src/player.c +++ b/src/player.c @@ -1,4 +1,4 @@ -/* $Id: player.c,v 1.63 2004/01/06 01:24:56 stpohle Exp $ +/* $Id: player.c,v 1.64 2004/01/06 02:19:57 stpohle Exp $ * player.c - everything what have to do with the player */ #include @@ -40,13 +40,13 @@ draw_player (_player * player) for (i = PI_max - 1; (i >= 0) && (player->ill[i].to <= 0.0f); i--); if (i >= 0) { player->illframe += timefactor; - if (player->illframe > gfx.ill.frames) - player->illframe = 0.0f; + while (player->illframe >= gfx.ill.frames) + player->illframe -= gfx.ill.frames; dest.w = src.w = gfx.block.x * 2; dest.h = src.h = gfx.block.y * 2; src.x = 0; - src.y = (2 * gfx.block.y) * (int)player->illframe; + src.y = (int)player->illframe * (2 * gfx.block.y); dest.x = gfx.offset.x + ((player->pos.x-0.5f) * gfx.block.x); dest.y = @@ -597,7 +597,7 @@ player_calcpos () void -player_ilness_loop () +player_ilness_loop (int plnr) { _player *p; int type, @@ -607,26 +607,24 @@ player_ilness_loop () float tmpf; int pl[MAX_PLAYERS + 1]; - /* do the illness for the network players */ - if (GT_MP) { - for (pnr = 0; pnr < MAX_PLAYERS; pnr++) - if (pnr != bman.p_nr && PS_IS_alife (players[pnr].state) && PS_IS_netplayer (players[pnr].state)) { - p = &players[pnr]; - for (type = 0; type < PI_max; type++) - if (p->ill[type].to > 0.0f) { - p->ill[type].to -= timediff; - p->illframe += timefactor; - if (p->illframe < 0.0f || p->illframe >= gfx.ill.frames) - p->illframe = 0.0f; - } - } - } + /* do the illness for the network and ai players */ + for (pnr = 0; pnr < MAX_PLAYERS; pnr++) + if (pnr != plnr && PS_IS_alife (players[pnr].state) && PS_IS_netplayer (players[pnr].state)) { + p = &players[pnr]; + for (type = 0; type < PI_max; type++) + if (p->ill[type].to > 0.0f) { + p->ill[type].to -= timediff; + p->illframe += timefactor; + if (p->illframe < 0.0f || p->illframe >= gfx.ill.frames) + p->illframe = 0.0f; + } + } /* check if we have contact with an other ill player */ - p = &players[bman.p_nr]; + p = &players[plnr]; get_player_on (p->pos.x, p->pos.y, pl); for (i = 0; (pl[i] != -1 && i < MAX_PLAYERS); i++) - if (pl[i] != bman.p_nr) { + if (pl[i] != plnr) { send = 0; for (type = 0; type < PI_max; type++) { if (players[pl[i]].ill[type].to > p->ill[type].to) { @@ -638,7 +636,7 @@ player_ilness_loop () } } if (send != 0 && GT_MP) - net_game_send_ill (bman.p_nr); + net_game_send_ill (plnr); } /* do the illness for the givin player */ @@ -672,7 +670,7 @@ player_ilness_loop () } else if (type == PI_bomb) /* player is dropping bombs */ - player_drop_bomb (bman.p_nr); + player_drop_bomb (plnr); } } }