diff --git a/include/basic.h b/include/basic.h index 0680472..30b70e9 100644 --- a/include/basic.h +++ b/include/basic.h @@ -1,4 +1,4 @@ -/* $Id: basic.h,v 1.6 2003/11/08 06:27:58 stpohle Exp $ */ +/* $Id: basic.h,v 1.7 2003/11/08 19:53:06 stpohle Exp $ */ /* basic types which we need everywhere */ #ifndef _BC_BASIC_H_ @@ -12,12 +12,11 @@ #define GAME_SPECIAL_ITEMMIXED 20 #define GAME_SPECIAL_ITEMSTRIGGER 3 #define GAME_SPECIAL_ITEMSROW 3 -#define GAME_SPECIAL_ITEMSPUSH 2 -#define GAME_MAX_TUNNELS 4 // number of tunnel entrys +#define GAME_SPECIAL_ITEMSPUSH 3 +#define GAME_MAX_TUNNELS 4 // number of tunnel entrys #define GAME_TIMEOUT 30000 // game timeout 10min) #define GAME_TIMEOUTHURRY 3000 // game timeout for hurry and dropping mode (1min) -#define GAME_TUNNEL_TO 50 /* wait 5 game cycls before move and show - player again */ +#define GAME_TUNNEL_TO 0.5 // wait 0.5 seconds #define EXPLOSION_SAVE_DISTANCE 0.25 #define SPECIAL_TRIGGER_TIMEOUT 15 @@ -28,13 +27,13 @@ #define START_BOMBS 1 #define START_RANGE 2 -#define START_SPEED 0.05 +#define START_SPEED 0.07 #define SPEEDMUL 1.2 #define MAX_PLAYERS 8 #define MAX_BOMBS 12 #define MAX_RANGE 10 -#define MAX_SPEED 40 +#define MAX_SPEED 2 #define MAX_BLITRECTS 4096 #define MAX_STONESTODRAW 2048 #define MAX_SERVERENTRYS 8 /* number of entrys in the server tab */ diff --git a/include/bomberclone.h b/include/bomberclone.h index c2637c6..901fffa 100644 --- a/include/bomberclone.h +++ b/include/bomberclone.h @@ -1,4 +1,4 @@ -/* $Id: bomberclone.h,v 1.6 2003/11/08 06:27:58 stpohle Exp $ */ +/* $Id: bomberclone.h,v 1.7 2003/11/08 19:53:06 stpohle Exp $ */ /* bomberclone.h */ #ifndef _BOMBERCLONE_H_ @@ -50,7 +50,8 @@ struct { float to; // if (to > 0) the ilness is still working - int data; + int datai; // hold a integer data (like number of something..) + float dataf; // hold a float data (speed and so on) } typedef _playerilness; diff --git a/src/bomb.c b/src/bomb.c index 053b1b1..1b21e06 100644 --- a/src/bomb.c +++ b/src/bomb.c @@ -1,4 +1,4 @@ -/* $Id: bomb.c,v 1.48 2003/11/08 06:27:58 stpohle Exp $ */ +/* $Id: bomb.c,v 1.49 2003/11/08 19:53:07 stpohle Exp $ */ /* everything what have to do with the bombs */ #include "bomberclone.h" @@ -27,8 +27,8 @@ draw_bomb (_bomb * bomb) dest.w = src.w = gfx.bomb.image->w; dest.h = src.h = gfx.block.y; - dest.x = gfx.offset.x + x * gfx.block.x; - dest.y = gfx.offset.y + y * gfx.block.y; + dest.x = gfx.offset.x + bomb->pos.x * gfx.block.x; + dest.y = gfx.offset.y + bomb->pos.y * gfx.block.y; src.x = 0; src.y = src.h * (int)bomb->frame; stonelist_add (x, y); @@ -74,8 +74,9 @@ bomb_explode (int p, int b, int net) void bomb_move (_bomb * bomb) { - int step = 0, dist = 0, keepdir = 0; + int keepdir = 0; _pointf fpos, rpos; + float dist = 0.0f, step = 0.0f; map.bfield[(int)bomb->pos.x][(int)bomb->pos.y] = 0; /* delete bfield */ stonelist_add (bomb->pos.x, bomb->pos.y); @@ -83,27 +84,29 @@ bomb_move (_bomb * bomb) /* do this once, and again if the direction is still ok */ do { /* get the current position of the bomb */ - fpos.x = rintf (bomb->pos.x); - fpos.y = rintf (bomb->pos.y); - rpos.x = fpos.x - bomb->pos.x; - rpos.y = fpos.y - bomb->pos.y; - if (rpos.x < 0) rpos.x = -rpos.x; // only positive values - if (rpos.y < 0) rpos.y = -rpos.y; // only positive values + fpos.x = (int) bomb->pos.x; + fpos.y = (int) bomb->pos.y; + rpos.x = CUTINT(bomb->pos.x); + rpos.y = CUTINT (bomb->pos.y); /* calculate the next step speed or next full field.. depend on what is the smaler one */ if (bomb->dest.x < 0) step = rpos.x; - else if (bomb->dest.x > 0) + else if (bomb->dest.x > 0) { step = 1.0f - rpos.x; + fpos.x += 1.0f; + } else if (bomb->dest.y < 0) step = rpos.y; - else if (bomb->dest.y > 0) + else if (bomb->dest.y > 0) { step = 1.0f - rpos.y; + fpos.y += 1.0f; + } - if (step > (timefactor * bomb->speed) || step == 0) + if (step > (timefactor * bomb->speed) || step == 0.0f) step = (timefactor * bomb->speed); - + /* move the bomb to the new position */ if (bomb->dest.x < 0) bomb->pos.x -= step; @@ -123,8 +126,8 @@ bomb_move (_bomb * bomb) /* it is a moving liquid bomb so check for another field */ _point b, d; - b.x = bomb->pos.x; - b.y = bomb->pos.y; + b.x = (int)bomb->pos.x; + b.y = (int)bomb->pos.y; d.x = b.x + bomb->dest.x; d.y = b.y + bomb->dest.y; diff --git a/src/debug.c b/src/debug.c index b357a51..cb0f6c7 100644 --- a/src/debug.c +++ b/src/debug.c @@ -71,4 +71,9 @@ void debug_ingameinfo() { redraw_logo (0, gfx.res.y-font[0].size.y, gfx.res.y, gfx.res.x); sprintf (text, "TDiff: %2.3f TFactor: %2.3f", timediff, timefactor); font_gfxdraw (0, gfx.res.y-font[0].size.y, text, 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, (map.size.y*256)+10); + } }; diff --git a/src/field.c b/src/field.c index 08c5b1a..8dad960 100644 --- a/src/field.c +++ b/src/field.c @@ -1,4 +1,4 @@ -/* $Id: field.c,v 1.48 2003/11/08 06:27:58 stpohle Exp $ */ +/* $Id: field.c,v 1.49 2003/11/08 19:53:07 stpohle Exp $ */ /* field.c - procedures which are needed to control the field */ #include "bomberclone.h" @@ -189,8 +189,8 @@ draw_stone (int x, int y) draw_fire (x, y, d, -1); } -// if (debug) -// font_gfxdraw (dest.x, dest.y, (map.bfield[x][y] == 0) ? "0" : "1", 0, (y*256) + 10); + if (debug) + font_gfxdraw (dest.x, dest.y, (map.bfield[x][y] == 0) ? "0" : "1", 0, (y*256) + 10); return; }; diff --git a/src/player.c b/src/player.c index e6759ea..120445a 100644 --- a/src/player.c +++ b/src/player.c @@ -311,7 +311,7 @@ stepmove_player (int pl_nr) /* check if we can go though a tunnel */ if (_pos.x == 0.0f && _pos.y == 0.0f && map.field[(int)p->pos.x][(int)p->pos.y].type == FT_tunnel - && p->tunnelto == -1) { + && p->tunnelto <= 0.0f) { d_printf ("Tunnel [%d] Player %s is going to (%d,%d)\n", map.field[(int)p->pos.x][(int)p->pos.y].special, p->name, map.tunnel[map.field[(int)p->pos.x][(int)p->pos.y].special].x, @@ -322,8 +322,8 @@ stepmove_player (int pl_nr) [map.tunnel[map.field[(int)p->pos.x][(int)p->pos.y].special].y]) d_printf (" *** End of tunnel is with an bomb.\n"); else { - p->pos.x = map.tunnel[map.field[(int)p->pos.x][(int)p->pos.y].special].x << 8; - p->pos.y = map.tunnel[map.field[(int)p->pos.x][(int)p->pos.y].special].y << 8; + p->pos.x = map.tunnel[map.field[(int)p->pos.x][(int)p->pos.y].special].x; + p->pos.y = map.tunnel[map.field[(int)p->pos.x][(int)p->pos.y].special].y; p->tunnelto = GAME_TUNNEL_TO; speed = p->speed * timefactor; } @@ -370,9 +370,9 @@ move_player (int pl_nr) oldd = p->d; if (p->tunnelto > 0) { - p->tunnelto--; + p->tunnelto -= timediff; p->m = 0; - if (p->tunnelto <= 0 && GT_MP) + if (p->tunnelto <= 0.0f && GT_MP) net_game_send_playermove (bman.p_nr, 1); } else { @@ -608,8 +608,8 @@ player_ilness_loop (int pl_nr) int type, pnr, i, - tmp, send; + float tmpf; int pl[MAX_PLAYERS + 1]; /* do the illness for the network players */ @@ -618,7 +618,7 @@ player_ilness_loop (int pl_nr) if (pnr != pl_nr && PS_IS_alife (players[pnr].state)) { p = &players[pnr]; for (type = 0; type < PI_max; type++) - if (p->ill[type].to > 0) { + if (p->ill[type].to > 0.0f) { p->ill[type].to -= timediff; p->illframe += timefactor; if (p->illframe < 0 || p->illframe >= gfx.ill.frames) @@ -635,10 +635,10 @@ player_ilness_loop (int pl_nr) send = 0; for (type = 0; type < PI_max; type++) { if (players[pl[i]].ill[type].to > p->ill[type].to) { - tmp = p->ill[type].to; + tmpf = p->ill[type].to; player_set_ilness (p, type); p->ill[type].to = players[pl[i]].ill[type].to; - if (tmp <= 0) + if (tmpf <= 0.0f) send = 1; } } @@ -648,14 +648,14 @@ player_ilness_loop (int pl_nr) /* do the illness for the givin player */ for (type = 0; type < PI_max; type++) - if (p->ill[type].to > 0) { - p->ill[type].to--; - if (p->ill[type].to == 0) + if (p->ill[type].to > 0.0f) { + p->ill[type].to -= timediff; + if (p->ill[type].to <= 0.0f) player_clear_ilness (p, type); else { p->illframe += timediff; if (p->illframe < 0 || p->illframe >= gfx.ill.frames) - p->illframe = 0; + p->illframe = 0.0f; if (type == PI_keys) { /* switch direction for player key illness */ @@ -697,36 +697,36 @@ player_set_ilness (_player * p, int t) d_printf ("Ilness : %d\n", type); switch (type) { case PI_slow: - if (p->ill[type].to == 0) { - if (p->ill[PI_fast].to > 0) { - p->ill[type].data = p->ill[PI_fast].data; - p->ill[PI_fast].to = 0; + if (p->ill[type].to <= 0.0f) { + if (p->ill[PI_fast].to > 0.0f) { + p->ill[type].dataf = p->ill[PI_fast].dataf; + p->ill[PI_fast].to = 0.0f; } else - p->ill[type].data = p->speed; + p->ill[type].dataf = p->speed; } p->speed = ILL_SLOWSPEED; break; case PI_fast: - if (p->ill[type].to == 0) { - if (p->ill[PI_slow].to > 0) { - p->ill[type].data = p->ill[PI_slow].data; - p->ill[PI_slow].to = 0; + if (p->ill[type].to <= 0.0f) { + if (p->ill[PI_slow].to > 0.0f) { + p->ill[type].dataf = p->ill[PI_slow].dataf; + p->ill[PI_slow].to = 0.0f; } else - p->ill[type].data = p->speed; + p->ill[type].dataf = p->speed; } p->speed = ILL_FASTSPEED; break; case PI_range: if (p->ill[type].to == 0) - p->ill[type].data = p->range; + p->ill[type].datai = p->range; p->range = 1; break; case PI_nobomb: if (p->ill[type].to == 0) - p->ill[type].data = p->bombs_n; + p->ill[type].datai = p->bombs_n; p->bombs_n = s_random (2); break; } @@ -744,13 +744,13 @@ player_clear_ilness (_player * p, int type) switch (type) { case PI_slow: case PI_fast: - p->speed = p->ill[type].data; + p->speed = p->ill[type].dataf; break; case PI_range: - p->range = p->ill[type].data; + p->range = p->ill[type].datai; break; case PI_nobomb: - p->bombs_n = p->ill[type].data; + p->bombs_n = p->ill[type].datai; break; } p->ill[type].to = 0; diff --git a/src/special.c b/src/special.c index b5bade9..8da19b0 100644 --- a/src/special.c +++ b/src/special.c @@ -1,4 +1,4 @@ -/* $Id: special.c,v 1.28 2003/11/08 06:27:59 stpohle Exp $ */ +/* $Id: special.c,v 1.29 2003/11/08 19:53:07 stpohle Exp $ */ /* special.c - procedues to control the specials */ #include "bomberclone.h" @@ -135,9 +135,9 @@ special_liquidmoved (int p_nr) || (map.field[x1][y1].type != FT_nothing && map.field[x1][y1].type != FT_tunnel)) return; - get_bomb_on (x, y, bombs); + get_bomb_on ((float)x, (float)y, bombs); // move all bombs on that field (there should be only 1) - for (i = 0; bombs[i].x != -1; i++) { + for (i = 0; (bombs[i].x != -1) && (i < MAX_PLAYERS * MAX_BOMBS); i++) { b = &players[bombs[i].x].bombs[bombs[i].y]; if (b->state != BS_exploding) { b->dest.x = dx;