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_ITEMDEATH 25
#define GAME_SPECIAL_ITEMMIXED 10
#define GAME_SPECIAL_ITEMSTRIGGER 10
#define GAME_SPECIAL_ITEMSROW 0
#define GAME_SPECIAL_ITEMSPUSH 0
#define GAME_SPECIAL_ITEMSTRIGGER 2
#define GAME_SPECIAL_ITEMSROW 2
#define GAME_SPECIAL_ITEMSPUSH 2
#define GAME_SPECIAL_ITEMSKICK 0
#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;
}
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;

@ -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 */
#ifndef _BOMBERCLONE_H_
@ -175,6 +175,7 @@ extern void game_set_playerposition();
extern void draw_field ();
extern void draw_stone (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_set_playerposition (int usermap);
extern void tileset_random ();

@ -135,6 +135,9 @@ ReadConfig ()
if (!strcmp (keyword, "resolutiony")) {
gfx.res.y = atoi (value);
}
if (!strcmp (keyword, "tileset")) {
strcpy (gfx.tileset, value);
}
if (!strcmp (keyword, "fieldpath")) {
if (strlen (value) > 510) {
d_printf
@ -207,6 +210,7 @@ WriteConfig ()
fprintf (config, "resolutionx=%d\n", gfx.res.x);
fprintf (config, "resolutiony=%d\n", gfx.res.y);
fprintf (config, "fullscreen=%d\n", gfx.fullscreen);
fprintf (config, "tileset=%s\n", gfx.tileset);
fprintf (config, "fieldpath=%s\n", bman.fieldpath);
fprintf (config, "fieldsizex=%d\n", bman.fieldsize.x);
fprintf (config, "fieldsizey=%d\n", bman.fieldsize.y);
@ -221,7 +225,6 @@ WriteConfig ()
fprintf (config, "askplayername=%d\n", bman.askplayername);
fprintf (config, "playername=%s\n", bman.playername);
fprintf (config, "bitsperpixel=%d\n", gfx.bpp);
fprintf (config, "fieldpath=%s\n", bman.fieldpath);
fprintf (config, "randomtileset=%d\n", gfx.random_tileset);
fprintf (config, "randommap=%d\n", bman.random_map);
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 */
#include <stdlib.h>
@ -274,6 +274,14 @@ field_clear(int x, int 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
void
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
&& b_dat->state != BS_exploding)
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.y = b_dat->y;
if (bomb->state != BS_ticking)

@ -178,9 +178,11 @@ player_check_powerup (_player * p)
case FT_sp_row:
case FT_sp_push:
case FT_sp_kick:
if (p->special == SP_nothing) {
p->special = ft - FT_sp_trigger + 1;
field_clear(fx,fy);
bman.updatestatusbar = 1;
}
field_clear (fx, fy);
break;
}
};
@ -358,7 +360,8 @@ player_drop_bomb (int pl_nr)
bomb->r = player->range;
if (player->special == SP_trigger)
bomb->state = BS_trigger;
else bomb->state = BS_ticking;
else
bomb->state = BS_ticking;
bomb->ex_nr = -1;
bomb->to = BOMB_TIMEOUT * TIME_FACTOR; // 5 Secs * 200
@ -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 (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;
i++;
}

@ -13,12 +13,12 @@ special_trigger (int 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++)
if (p->bombs[i].state == BS_trigger) {
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.
z++;
z++; // count the bombs which will explode
}
if (p_nr == bman.p_nr && GT_MP_PTP && z)
@ -28,32 +28,128 @@ special_trigger (int p_nr)
bman.last_ex_nr = ex_nr + 6;
}
void
special_row (int p_nr)
{
_bomb *b = NULL;
_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
special_use (int p_nr)
{
special_use (int p_nr) {
switch (bman.players[p_nr].special) {
case SP_trigger:
special_trigger (p_nr);
break;
case SP_row:
if (bman.players[p_nr].m)
case SP_row:if (bman.players[p_nr].m)
special_row (p_nr);
break;
case SP_push:
case SP_push:if (bman.players[p_nr].m)
special_push (p_nr);
break;
case SP_kick:
break;
}
}
case SP_kick:break;
}}

Loading…
Cancel
Save