From 41a18f490e382087c9ac7c2d00b59f3f0fbbb6fd Mon Sep 17 00:00:00 2001 From: patty21 Date: Sun, 1 Jun 2003 22:51:57 +0000 Subject: [PATCH] Special usage is now limeted --- src/basic.h | 9 +++++---- src/bomberclone.h | 7 +++++-- src/game.c | 10 ++++++---- src/player.c | 11 +++++------ src/special.c | 35 ++++++++++++++++++++++++++++++----- 5 files changed, 51 insertions(+), 21 deletions(-) diff --git a/src/basic.h b/src/basic.h index 39d1edd..b8b2817 100644 --- a/src/basic.h +++ b/src/basic.h @@ -19,11 +19,12 @@ #define EXPLOSION_SAVE_DISTANCE 64 #define SPECIAL_TRIGGER_TIMEOUT 15 #define SPECIAL_TRIGGER_NUMUSE 5 // 0=unlimited -#define SPECIAL_ROW_TIME 100 -#define SPECIAL_PUSH_TIME 100 -#define SPECIAL_KICK_NUMUSE 5 -#define SPECIAL_LIQUID_NUMUSE 5 +#define SPECIAL_ROW_TIME 30 +#define SPECIAL_PUSH_TIME 50 +#define SPECIAL_KICK_NUMUSE 8 +#define SPECIAL_LIQUID_NUMUSE 8 #define SPECIAL_DESTROY_NUMUSE 5 +#define SPECIAL_8WAY_NUMUSE 10 #define START_BOMBS 1 #define START_RANGE 2 diff --git a/src/bomberclone.h b/src/bomberclone.h index 491fc43..ec53b5b 100644 --- a/src/bomberclone.h +++ b/src/bomberclone.h @@ -1,4 +1,4 @@ -/* $Id: bomberclone.h,v 1.32 2003/06/01 20:34:47 stpohle Exp $ */ +/* $Id: bomberclone.h,v 1.33 2003/06/01 22:51:58 patty21 Exp $ */ /* bomberclone.h */ #ifndef _BOMBERCLONE_H_ @@ -216,7 +216,7 @@ extern void player_calcpos (); extern void player_set_ilness (_player *p, int t); extern void player_clear_ilness (_player *p, int type); extern void player_ilness_loop (int pl_nr); -extern void player_check_powerup (_player * p); +extern void player_check_powerup (int p_nr); extern void player_set_gfx (_player *p, signed char gfx_nr); // for the bomb.. @@ -279,5 +279,8 @@ extern void init_map_tileset(); // special.c extern void special_use (int p_nr); +extern void special_pickup (int p_nr, int s_type); +extern void special_loop (int p_nr); +extern void special_clear (int p_nr); #endif diff --git a/src/game.c b/src/game.c index 1574329..b958d8a 100644 --- a/src/game.c +++ b/src/game.c @@ -80,9 +80,11 @@ game_draw_info () draw_text (x, 0, text, 1); sprintf (text, "Range: %2d", bman.players[bman.p_nr].range); draw_text (x, 16, text, 1); - sprintf (text, "SP: %d Speed: %2d", bman.players[bman.p_nr].special.type, - bman.players[bman.p_nr].speed); - draw_text (x - 90, 32, text, 1); + sprintf (text, "SP: %d/%d/%d Speed: %2d", bman.players[bman.p_nr].special.type, + bman.players[bman.p_nr].special.numuse, + bman.players[bman.p_nr].special.to/TIME_FACTOR, + bman.players[bman.p_nr].speed); + draw_text (x - 140, 32, text, 1); if (bman.state == GS_ready && GT_MP_PTPM) draw_text (100, 32, "Press F4 to start the game", 1); @@ -197,7 +199,7 @@ game_loop () restore_players_screen (); dead_playerani (); player_ilness_loop (bman.p_nr); - + special_loop(bman.p_nr); if ((bman.players[bman.p_nr].state & PSFM_alife) == PSFM_alife) move_player (bman.p_nr); diff --git a/src/player.c b/src/player.c index 1054342..a3b373e 100644 --- a/src/player.c +++ b/src/player.c @@ -98,8 +98,9 @@ restore_players_screen () void -player_check_powerup (_player * p) +player_check_powerup (int p_nr) { + _player *p = &bman.players[p_nr]; int fx = p->pos.x >> 8; int fy = p->pos.y >> 8; int _x = p->pos.x & 255; @@ -178,10 +179,8 @@ player_check_powerup (_player * p) case FT_sp_row: case FT_sp_push: case FT_sp_kick: - if (p->special.type == SP_nothing) { - p->special.type = ft - FT_sp_trigger + 1; - bman.updatestatusbar = 1; - } + special_pickup(p_nr,ft-FT_sp_trigger+1); + bman.updatestatusbar = 1; field_clear (fx, fy); break; } @@ -273,7 +272,7 @@ stepmove_player (int pl_nr) p->pos.x = p->pos.x + dx; p->pos.y = p->pos.y + dy; - player_check_powerup (p); + player_check_powerup (pl_nr); } if (dx == 0 && dy == 0) diff --git a/src/special.c b/src/special.c index 8b38257..3a700d1 100644 --- a/src/special.c +++ b/src/special.c @@ -25,8 +25,11 @@ special_trigger (int p_nr) net_game_send_special (p_nr, ex_nr); - if (z) - bman.last_ex_nr = ex_nr + 6; + if (z) { + bman.last_ex_nr = ex_nr + 6; + p->special.numuse--; + if (!p->special.numuse) special_clear(p_nr); + } } @@ -139,16 +142,38 @@ special_push (int p_nr) void special_pickup (int p_nr, int s_nr) { - + _special *s = &bman.players[p_nr].special; + s->to=0; + s->numuse=0; + s->type=s_nr; + switch(s_nr) { + case SP_trigger: + s->numuse=SPECIAL_TRIGGER_NUMUSE; + break; + case SP_row : + s->to=SPECIAL_ROW_TIME*TIME_FACTOR; + break; + case SP_push : + s->to=SPECIAL_PUSH_TIME*TIME_FACTOR; + break; + } } + void special_clear (int p_nr) { - + bman.players[p_nr].special.type=0; + bman.updatestatusbar=1; } void special_loop (int p_nr) { - + _special *s = &bman.players[p_nr].special; + if (!s->type) return; + bman.updatestatusbar=1; + if (s->to) { + s->to--; + if (!s->to) special_clear (p_nr); + } }