2 new specials finished and some bugs fixed

origin
patty21 23 years ago
parent e994c1895e
commit 7c39c7ea3c

@ -9,9 +9,9 @@
#define GAME_SPECIAL_ITEMSHOE 10 #define GAME_SPECIAL_ITEMSHOE 10
#define GAME_SPECIAL_ITEMDEATH 25 #define GAME_SPECIAL_ITEMDEATH 25
#define GAME_SPECIAL_ITEMMIXED 10 #define GAME_SPECIAL_ITEMMIXED 10
#define GAME_SPECIAL_ITEMSTRIGGER 10 #define GAME_SPECIAL_ITEMSTRIGGER 2
#define GAME_SPECIAL_ITEMSROW 0 #define GAME_SPECIAL_ITEMSROW 2
#define GAME_SPECIAL_ITEMSPUSH 0 #define GAME_SPECIAL_ITEMSPUSH 2
#define GAME_SPECIAL_ITEMSKICK 0 #define GAME_SPECIAL_ITEMSKICK 0
#define EXPLOSION_SAVE_DISTANCE 64 #define EXPLOSION_SAVE_DISTANCE 64

@ -289,7 +289,7 @@ explosion_check_field (int x, int y, int p, int b)
bman.field[x][y].frame = 1; bman.field[x][y].frame = 1;
} }
draw_stone (x, y); draw_stone (x, y);
gfx_AddUpdateRect (x * gfx.block.x + gfx.offset.x,y * gfx.block.y + gfx.offset.y, gfx.block.x, gfx.block.y); field_update(x,y);
} }
return bman.field[x][y].type; return bman.field[x][y].type;

@ -1,4 +1,4 @@
/* $Id: bomberclone.h,v 1.23 2003/05/15 00:27:00 patty21 Exp $ */ /* $Id: bomberclone.h,v 1.24 2003/05/18 14:06:29 patty21 Exp $ */
/* bomberclone.h */ /* bomberclone.h */
#ifndef _BOMBERCLONE_H_ #ifndef _BOMBERCLONE_H_
@ -175,6 +175,7 @@ extern void game_set_playerposition();
extern void draw_field (); extern void draw_field ();
extern void draw_stone (int x, int y); extern void draw_stone (int x, int y);
extern void field_clear(int x, int y); extern void field_clear(int x, int y);
extern void field_update(int x,int y);
extern void field_new (char *filename); extern void field_new (char *filename);
extern void field_set_playerposition (int usermap); extern void field_set_playerposition (int usermap);
extern void tileset_random (); extern void tileset_random ();

@ -135,6 +135,9 @@ ReadConfig ()
if (!strcmp (keyword, "resolutiony")) { if (!strcmp (keyword, "resolutiony")) {
gfx.res.y = atoi (value); gfx.res.y = atoi (value);
} }
if (!strcmp (keyword, "tileset")) {
strcpy (gfx.tileset, value);
}
if (!strcmp (keyword, "fieldpath")) { if (!strcmp (keyword, "fieldpath")) {
if (strlen (value) > 510) { if (strlen (value) > 510) {
d_printf d_printf
@ -207,6 +210,7 @@ WriteConfig ()
fprintf (config, "resolutionx=%d\n", gfx.res.x); fprintf (config, "resolutionx=%d\n", gfx.res.x);
fprintf (config, "resolutiony=%d\n", gfx.res.y); fprintf (config, "resolutiony=%d\n", gfx.res.y);
fprintf (config, "fullscreen=%d\n", gfx.fullscreen); fprintf (config, "fullscreen=%d\n", gfx.fullscreen);
fprintf (config, "tileset=%s\n", gfx.tileset);
fprintf (config, "fieldpath=%s\n", bman.fieldpath); fprintf (config, "fieldpath=%s\n", bman.fieldpath);
fprintf (config, "fieldsizex=%d\n", bman.fieldsize.x); fprintf (config, "fieldsizex=%d\n", bman.fieldsize.x);
fprintf (config, "fieldsizey=%d\n", bman.fieldsize.y); fprintf (config, "fieldsizey=%d\n", bman.fieldsize.y);
@ -221,7 +225,6 @@ WriteConfig ()
fprintf (config, "askplayername=%d\n", bman.askplayername); fprintf (config, "askplayername=%d\n", bman.askplayername);
fprintf (config, "playername=%s\n", bman.playername); fprintf (config, "playername=%s\n", bman.playername);
fprintf (config, "bitsperpixel=%d\n", gfx.bpp); fprintf (config, "bitsperpixel=%d\n", gfx.bpp);
fprintf (config, "fieldpath=%s\n", bman.fieldpath);
fprintf (config, "randomtileset=%d\n", gfx.random_tileset); fprintf (config, "randomtileset=%d\n", gfx.random_tileset);
fprintf (config, "randommap=%d\n", bman.random_map); fprintf (config, "randommap=%d\n", bman.random_map);
fclose (config); fclose (config);

@ -1,4 +1,4 @@
/* $Id: field.c,v 1.20 2003/05/14 04:59:17 stpohle Exp $ */ /* $Id: field.c,v 1.21 2003/05/18 14:06:29 patty21 Exp $ */
/* field.c - procedures which are needed to control the field */ /* field.c - procedures which are needed to control the field */
#include <stdlib.h> #include <stdlib.h>
@ -274,6 +274,14 @@ field_clear(int x, int y)
net_game_send_field (x, y); net_game_send_field (x, y);
} }
void
field_update(int x, int y)
{
gfx_AddUpdateRect (x * gfx.block.x + gfx.offset.x, y * gfx.block.y + gfx.offset.y,
gfx.block.x, gfx.block.y);
}
// put items into the field // put items into the field
void void
field_fillitems (int fieldtype, int num) field_fillitems (int fieldtype, int num)

@ -591,7 +591,11 @@ do_bombdata (struct pkg_bombdata *b_dat, _net_addr * addr)
if ((bomb->pos.x != b_dat->x || bomb->pos.y != b_dat->y) && bomb->state == BS_exploding if ((bomb->pos.x != b_dat->x || bomb->pos.y != b_dat->y) && bomb->state == BS_exploding
&& b_dat->state != BS_exploding) && b_dat->state != BS_exploding)
d_printf ("do_bombdata WARNING : bomb explosion haven't finished\n"); d_printf ("do_bombdata WARNING : bomb explosion haven't finished\n");
if (bomb->state==BS_ticking && b_dat->state==BS_ticking) { // handle push & kick special
bman.bfield[bomb->pos.x][bomb->pos.y] = 0; //remove bomb at old location
draw_stone(bomb->pos.x,bomb->pos.y);
field_update(bomb->pos.x,bomb->pos.y);
}
bomb->pos.x = b_dat->x; bomb->pos.x = b_dat->x;
bomb->pos.y = b_dat->y; bomb->pos.y = b_dat->y;
if (bomb->state != BS_ticking) if (bomb->state != BS_ticking)

@ -143,7 +143,7 @@ player_check_powerup (_player * p)
p->bombs_n++; p->bombs_n++;
bman.updatestatusbar = 1; bman.updatestatusbar = 1;
} }
field_clear(fx,fy); field_clear (fx, fy);
break; break;
/* we found a fire powerup */ /* we found a fire powerup */
@ -152,7 +152,7 @@ player_check_powerup (_player * p)
p->range++; p->range++;
bman.updatestatusbar = 1; bman.updatestatusbar = 1;
} }
field_clear(fx,fy); field_clear (fx, fy);
break; break;
/* we found a shoe powerup */ /* we found a shoe powerup */
@ -161,7 +161,7 @@ player_check_powerup (_player * p)
p->speed *= SPEEDMUL; p->speed *= SPEEDMUL;
bman.updatestatusbar = 1; bman.updatestatusbar = 1;
} }
field_clear(fx,fy); field_clear (fx, fy);
break; break;
/* we found a death ?powerup? */ /* we found a death ?powerup? */
@ -170,18 +170,20 @@ player_check_powerup (_player * p)
bman.updatestatusbar = 1; bman.updatestatusbar = 1;
if (bman.gametype != GT_single) if (bman.gametype != GT_single)
net_game_send_ill (bman.p_nr); net_game_send_ill (bman.p_nr);
field_clear(fx,fy); field_clear (fx, fy);
break; break;
/* we found a special */ /* we found a special */
case FT_sp_trigger: case FT_sp_trigger:
case FT_sp_row: case FT_sp_row:
case FT_sp_push: case FT_sp_push:
case FT_sp_kick: case FT_sp_kick:
p->special=ft-FT_sp_trigger+1; if (p->special == SP_nothing) {
field_clear(fx,fy); p->special = ft - FT_sp_trigger + 1;
bman.updatestatusbar=1; bman.updatestatusbar = 1;
break; }
field_clear (fx, fy);
break;
} }
}; };
@ -356,13 +358,14 @@ player_drop_bomb (int pl_nr)
d_printf ("Player %d Dropped Bomb %d\n", bman.p_nr, i); d_printf ("Player %d Dropped Bomb %d\n", bman.p_nr, i);
bomb->r = player->range; bomb->r = player->range;
if (player->special== SP_trigger) if (player->special == SP_trigger)
bomb->state = BS_trigger; bomb->state = BS_trigger;
else bomb->state = BS_ticking; else
bomb->state = BS_ticking;
bomb->ex_nr = -1; bomb->ex_nr = -1;
bomb->to = BOMB_TIMEOUT * TIME_FACTOR; // 5 Secs * 200 bomb->to = BOMB_TIMEOUT * TIME_FACTOR; // 5 Secs * 200
bman.bfield [bomb->pos.x][bomb->pos.y] = 1; bman.bfield[bomb->pos.x][bomb->pos.y] = 1;
if (bman.gametype != GT_single) { if (bman.gametype != GT_single) {
net_game_send_bomb (pl_nr, i); net_game_send_bomb (pl_nr, i);
if (GT_MP_PTPS) if (GT_MP_PTPS)
@ -385,7 +388,8 @@ get_player_on (short int x, short int y, int pl_nr[])
if (PS_IS_alife (bman.players[p].state)) { if (PS_IS_alife (bman.players[p].state)) {
if (bman.players[p].pos.x - EXPLOSION_SAVE_DISTANCE > x - 256 if (bman.players[p].pos.x - EXPLOSION_SAVE_DISTANCE > x - 256
&& bman.players[p].pos.x + EXPLOSION_SAVE_DISTANCE < x + 256 && bman.players[p].pos.x + EXPLOSION_SAVE_DISTANCE < x + 256
&& bman.players[p].pos.y - EXPLOSION_SAVE_DISTANCE > y - 256 && bman.players[p].pos.y + EXPLOSION_SAVE_DISTANCE < y + 256) { && bman.players[p].pos.y - EXPLOSION_SAVE_DISTANCE > y - 256
&& bman.players[p].pos.y + EXPLOSION_SAVE_DISTANCE < y + 256) {
pl_nr[i] = p; pl_nr[i] = p;
i++; i++;
} }
@ -400,8 +404,8 @@ player_died (_player * player, signed char dead_by)
// player die ! // player die !
d_printf ("player_died (%10s)\n", player->name); d_printf ("player_died (%10s)\n", player->name);
bman.updatestatusbar = 1; // force an update bman.updatestatusbar = 1; // force an update
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++;

@ -8,52 +8,148 @@ void
special_trigger (int p_nr) special_trigger (int p_nr)
{ {
int i, int i,
z=0, z = 0,
ex_nr = bman.last_ex_nr; ex_nr = bman.last_ex_nr;
_player *p = &bman.players[p_nr]; _player *p = &bman.players[p_nr];
// all ticking bombs will explode // all triggered bombs will explode
for (i = 0; i < MAX_BOMBS; i++) for (i = 0; i < MAX_BOMBS; i++)
if (p->bombs[i].state == BS_trigger) { if (p->bombs[i].state == BS_trigger) {
p->bombs[i].ex_nr = ex_nr + 5; // we take the next 5 number to be shure p->bombs[i].ex_nr = ex_nr + 5; // we take the next 5 number to be shure
bomb_explode (p_nr, i,0); // no other explosion interfear with it. bomb_explode (p_nr, i, 0); // no other explosion interfear with it.
z++; z++; // count the bombs which will explode
} }
if (p_nr == bman.p_nr && GT_MP_PTP && z) if (p_nr == bman.p_nr && GT_MP_PTP && z)
net_game_send_special (p_nr, ex_nr); net_game_send_special (p_nr, ex_nr);
if (z) if (z)
bman.last_ex_nr = ex_nr + 6; bman.last_ex_nr = ex_nr + 6;
} }
void void
special_row (int p_nr) special_row (int p_nr)
{ {
_bomb *b = NULL;
_player *p = &bman.players[p_nr]; _player *p = &bman.players[p_nr];
int x = p->pos.x >> 8,
y = p->pos.y >> 8,
dx = 0,
dy = 0,
t = 0,
i;
switch (p->d) {
case left:
dx = -1;
break;
case right:
dx = 1;
break;
case up:
dy = -1;
break;
case down:
dy = +1;
break;
}
x += dx;
y += dy;
while (bman.bfield[x][y]) {
x += dx;
y += dy;
/* add one time tick to each bomb found to ensure that the explosion is infacted by the previous bomb
otherwise powerups will disappear due to explosion of previous bomb */
t++;
}
if (bman.field[x][y].type == FT_nothing) {
for (i = 0; ((i < p->bombs_n) && (p->bombs[i].state != BS_off)); i++);
if (i < p->bombs_n) {
b = &p->bombs[i];
b->state = BS_ticking;
b->r = p->range;
b->ex_nr = -1;
b->pos.x = x;
b->pos.y = y;
b->to = BOMB_TIMEOUT * TIME_FACTOR + t; // 5 Secs * 200
bman.bfield[x][y] = 1;
if (bman.gametype != GT_single) {
net_game_send_bomb (p_nr, i);
if (GT_MP_PTPS)
b->to = b->to + ((2 * RESENDCACHE_RETRY) / TIME_FACTOR);
}
}
}
}
void
special_push (int p_nr)
{
_bomb *b = NULL;
_player *p = &bman.players[p_nr];
_point bombs[MAX_PLAYERS * MAX_BOMBS];
int x = p->pos.x >> 8,
y = p->pos.y >> 8,
dx = 0,
dy = 0,
x1,
y1,
i;
switch (p->d) {
case left:
dx = -1;
break;
case right:
dx = 1;
break;
case up:
dy = -1;
break;
case down:
dy = +1;
break;
}
x += dx;
y += dy;
if (!bman.bfield[x][y])
return;
x1 = x + dx;
y1 = y + dy;
if (bman.bfield[x1][y1] || bman.field[x1][y1].type != FT_nothing)
return;
get_bomb_on (x, y, bombs);
for (i = 0; bombs[i].x != -1; i++) {
b = &bman.players[bombs[i].x].bombs[bombs[i].y];
if (b->state != BS_exploding) {
b->pos.x = x1;
b->pos.y = y1;
bman.bfield[x][y]=0;
bman.bfield[x1][y1]=1;
draw_stone(x,y);
field_update(x,y);
if (bman.gametype != GT_single) {
net_game_send_bomb (bombs[i].x, bombs[i].y);}
}
}
;
} }
void void
special_use (int p_nr) special_use (int p_nr) {
{
switch (bman.players[p_nr].special) { switch (bman.players[p_nr].special) {
case SP_trigger: case SP_trigger:
special_trigger (p_nr); special_trigger (p_nr);
break; break;
case SP_row: case SP_row:if (bman.players[p_nr].m)
if (bman.players[p_nr].m)
special_row (p_nr); special_row (p_nr);
break; break;
case SP_push: case SP_push:if (bman.players[p_nr].m)
special_push (p_nr);
break; break;
case SP_kick: case SP_kick:break;
break; }}
}
}

Loading…
Cancel
Save