Added: Special Kick Bombs and some fixes

origin
patty21 22 years ago
parent 67f576a28b
commit 9c9051ceb7

@ -4,7 +4,7 @@ dnl If you don't want it to overwrite it,
dnl Please disable it in the Anjuta project configuration dnl Please disable it in the Anjuta project configuration
AC_INIT(configure.in) AC_INIT(configure.in)
AM_INIT_AUTOMAKE(bomberclone, 0.11.0) AM_INIT_AUTOMAKE(bomberclone, 0.11.1)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
AC_CANONICAL_HOST AC_CANONICAL_HOST

@ -1,4 +1,4 @@
/* $Id: basic.h,v 1.15 2004/01/06 19:52:02 stpohle Exp $ */ /* $Id: basic.h,v 1.16 2004/01/07 23:04:31 patty21 Exp $ */
/* basic types which we need everywhere */ /* basic types which we need everywhere */
#ifndef _BC_BASIC_H_ #ifndef _BC_BASIC_H_
@ -13,6 +13,7 @@
#define GAME_SPECIAL_ITEMSTRIGGER 3 #define GAME_SPECIAL_ITEMSTRIGGER 3
#define GAME_SPECIAL_ITEMSROW 3 #define GAME_SPECIAL_ITEMSROW 3
#define GAME_SPECIAL_ITEMSPUSH 3 #define GAME_SPECIAL_ITEMSPUSH 3
#define GAME_SPECIAL_ITEMSKICK 3
#define GAME_MAX_TUNNELS 4 // number of tunnel entrys #define GAME_MAX_TUNNELS 4 // number of tunnel entrys
#define GAME_TIMEOUT 600.0 // game timeout 10min) #define GAME_TIMEOUT 600.0 // game timeout 10min)
#define GAME_OVERTIMEOUT 5.0 // second of remaining the last player #define GAME_OVERTIMEOUT 5.0 // second of remaining the last player
@ -25,6 +26,8 @@
#define SPECIAL_TRIGGER_TIME 25 #define SPECIAL_TRIGGER_TIME 25
#define SPECIAL_ROW_TIME 30 #define SPECIAL_ROW_TIME 30
#define SPECIAL_PUSH_TIME 50 #define SPECIAL_PUSH_TIME 50
#define SPECIAL_KICK_TIME 30
#define SPECIAL_KICK_MAXDIST 8 // maximum distance allowed
#define START_BOMBS 1 #define START_BOMBS 1
#define START_RANGE 2 #define START_RANGE 2
@ -123,6 +126,7 @@ enum _fieldtype {
FT_sp_push, // The push-boms special FT_sp_push, // The push-boms special
FT_sp_moved, // The moved-boms special FT_sp_moved, // The moved-boms special
FT_sp_liquid, // The liquid-bomb special FT_sp_liquid, // The liquid-bomb special
FT_sp_kick, // The kick-bomb special
FT_max // just to know how many types there are FT_max // just to know how many types there are
}; };
@ -142,6 +146,7 @@ enum _specials {
SP_push, // push bombs SP_push, // push bombs
SP_moved, // moved bombs SP_moved, // moved bombs
SP_liquid, // liquid bombs SP_liquid, // liquid bombs
SP_kick, // kick bombs
SP_max // just to know how many types there are SP_max // just to know how many types there are
}; };

@ -1,4 +1,4 @@
/* $Id: map.h,v 1.8 2004/01/03 04:39:20 stpohle Exp $ */ /* $Id: map.h,v 1.9 2004/01/07 23:04:31 patty21 Exp $ */
/* map.h */ /* map.h */
#ifndef _MAP_H_ #ifndef _MAP_H_
@ -51,6 +51,7 @@ struct __map {
int sp_trigger; int sp_trigger;
int sp_push; int sp_push;
int sp_row; int sp_row;
int sp_kick;
unsigned char state; // state of the map unsigned char state; // state of the map
} typedef _map; } typedef _map;

@ -1,4 +1,4 @@
/* $Id: sysfunc.h,v 1.5 2003/12/24 02:38:15 stpohle Exp $ */ /* $Id: sysfunc.h,v 1.6 2004/01/07 23:04:31 patty21 Exp $ */
/* include some system near functions */ /* include some system near functions */
#ifndef _SYSFUNC_H_ #ifndef _SYSFUNC_H_
@ -57,5 +57,6 @@ extern inline void s_calctimesync ();
extern void rect_clipping (SDL_Rect *src, SDL_Rect *dest, SDL_Rect *window, SDL_Rect *csrc, SDL_Rect *cdest); extern void rect_clipping (SDL_Rect *src, SDL_Rect *dest, SDL_Rect *window, SDL_Rect *csrc, SDL_Rect *cdest);
extern void charlist_fillarraypointer (_charlist *list, int c); extern void charlist_fillarraypointer (_charlist *list, int c);
extern _charlist *charlist_findtext (_charlist *list, char *text); extern _charlist *charlist_findtext (_charlist *list, char *text);
extern float absol(float f);
#endif #endif

@ -1,4 +1,4 @@
/* $Id: bomb.c,v 1.51 2003/11/09 04:09:49 stpohle Exp $ */ /* $Id: bomb.c,v 1.52 2004/01/07 23:04:31 patty21 Exp $ */
/* everything what have to do with the bombs */ /* everything what have to do with the bombs */
#include "bomberclone.h" #include "bomberclone.h"
@ -11,34 +11,78 @@ draw_bomb (_bomb * bomb)
dest; dest;
int x = floorf (bomb->pos.x), int x = floorf (bomb->pos.x),
y = floorf (bomb->pos.y); y = floorf (bomb->pos.y);
float w,
x1,
x2,
y1,
y2;
if (x < 0 || y < 0 || x >= map.size.x || y >= map.size.y) { if (x < 0 || y < 0 || x >= map.size.x || y >= map.size.y) {
d_printf ("FATAL: Draw Bomb out of range [%f,%f]\n", x, y); d_printf ("FATAL: Draw Bomb out of range [%f,%f]\n", x, y);
return; return;
} }
if (bomb->state != BS_trigger if (bomb->state != BS_trigger || ((bomb->state == BS_trigger) && (bomb->to < BOMB_TIMEOUT))) {
|| ((bomb->state == BS_trigger) && (bomb->to < BOMB_TIMEOUT))) {
/* check the framenumber */ /* check the framenumber */
bomb->frame += (timefactor/3.0); bomb->frame += (timefactor / 3.0);
if (bomb->frame < 0 || bomb->frame >= gfx.bomb.frames) if (bomb->frame < 0 || bomb->frame >= gfx.bomb.frames)
bomb->frame = 0.0f; bomb->frame = 0.0f;
} }
dest.w = src.w = gfx.bomb.image->w; dest.w = src.w = gfx.bomb.image->w;
dest.h = src.h = gfx.block.y; dest.h = src.h = gfx.block.y;
if (bomb->mode == BM_kicked) {
w = sqrt (bomb->speed);
w *= absol (sin (w));
x1 = bomb->dest.x - bomb->pos.x;
y1 = bomb->dest.y - bomb->pos.y;
if (x1 > 0) {
x2 = bomb->pos.x + x1 * bomb->speed / 88 + y1 * w / 20;
y2 = bomb->pos.y + y1 * bomb->speed / 88 - x1 * w / 20;
}
else {
x2 = bomb->pos.x + x1 * bomb->speed / 88 - y1 * w / 20;
y2 = bomb->pos.y + y1 * bomb->speed / 88 + x1 * w / 20;
}
x = floorf (x2);
y = floorf (y2);
bomb->speed -= timediff * 100;
if (bomb->speed < 0) {
dest.x = gfx.offset.x + bomb->pos.x * gfx.block.x; dest.x = gfx.offset.x + bomb->pos.x * gfx.block.x;
dest.y = gfx.offset.y + bomb->pos.y * gfx.block.y; dest.y = gfx.offset.y + bomb->pos.y * gfx.block.y;
bomb->mode = BM_normal;
}
else {
w = sqrt (bomb->speed);
w *= absol (sin (w));
if (x1 > 0) {
x2 = bomb->pos.x + x1 * bomb->speed / 88 + y1 * w / 20;
y2 = bomb->pos.y + y1 * bomb->speed / 88 - x1 * w / 20;
}
else {
x2 = bomb->pos.x + x1 * bomb->speed / 88 - y1 * w / 20;
y2 = bomb->pos.y + y1 * bomb->speed / 88 + x1 * w / 20;
}
dest.x = gfx.offset.x + x2 * gfx.block.x;
dest.y = gfx.offset.y + y2 * gfx.block.y;
}
}
else {
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.x = 0;
src.y = src.h * (int)bomb->frame; src.y = src.h * (int) bomb->frame;
stonelist_add (x, y); stonelist_add (x, y);
if (bomb->mode != BM_normal) { if (bomb->mode != BM_normal) {
stonelist_add (x+1, y); stonelist_add (x + 1, y);
stonelist_add (x, y+1); stonelist_add (x, y + 1);
stonelist_add (x+1, y+1); stonelist_add (x + 1, y + 1);
} }
gfx_blit (gfx.bomb.image, &src, gfx.screen, &dest, (y*256) + 2); gfx_blit (gfx.bomb.image, &src, gfx.screen, &dest, (y * 256) + 2);
}; };
@ -75,10 +119,12 @@ void
bomb_move (_bomb * bomb) bomb_move (_bomb * bomb)
{ {
int keepdir = 0; int keepdir = 0;
_pointf fpos, rpos; _pointf fpos,
float dist = 0.0f, step = 0.0f; rpos;
float dist = 0.0f,
step = 0.0f;
map.bfield[(int)bomb->pos.x][(int)bomb->pos.y] = 0; /* delete bfield */ map.bfield[(int) bomb->pos.x][(int) bomb->pos.y] = 0; /* delete bfield */
stonelist_add (bomb->pos.x, bomb->pos.y); stonelist_add (bomb->pos.x, bomb->pos.y);
/* do this once, and again if the direction is still ok */ /* do this once, and again if the direction is still ok */
@ -86,7 +132,7 @@ bomb_move (_bomb * bomb)
/* get the current position of the bomb */ /* get the current position of the bomb */
fpos.x = (int) bomb->pos.x; fpos.x = (int) bomb->pos.x;
fpos.y = (int) bomb->pos.y; fpos.y = (int) bomb->pos.y;
rpos.x = CUTINT(bomb->pos.x); rpos.x = CUTINT (bomb->pos.x);
rpos.y = CUTINT (bomb->pos.y); rpos.y = CUTINT (bomb->pos.y);
/* calculate the next step speed or next full field.. /* calculate the next step speed or next full field..
@ -119,19 +165,22 @@ bomb_move (_bomb * bomb)
/* if we are on a complete field, check if we /* if we are on a complete field, check if we
can move to the next one */ can move to the next one */
if ((CUTINT(bomb->pos.x) == 0.0f) && (CUTINT(bomb->pos.y) == 0.0f)) { if ((CUTINT (bomb->pos.x) == 0.0f) && (CUTINT (bomb->pos.y) == 0.0f)) {
if (bomb->mode == BM_pushed) if (bomb->mode == BM_pushed)
bomb->mode = BM_normal; bomb->mode = BM_normal;
else if (bomb->mode == BM_moving || bomb->mode == BM_liquid) { else if (bomb->mode == BM_moving || bomb->mode == BM_liquid) {
/* it is a moving liquid bomb so check for another field */ /* it is a moving liquid bomb so check for another field */
_point b, d; _point b,
d;
b.x = (int)bomb->pos.x; b.x = (int) bomb->pos.x;
b.y = (int)bomb->pos.y; b.y = (int) bomb->pos.y;
d.x = b.x + bomb->dest.x; d.x = b.x + bomb->dest.x;
d.y = b.y + bomb->dest.y; d.y = b.y + bomb->dest.y;
if (map.bfield[d.x][d.y] == 0 && (map.field[d.x][d.y].type == FT_nothing || map.field[d.x][d.y].type == FT_tunnel)) if (map.bfield[d.x][d.y] == 0
&& (map.field[d.x][d.y].type == FT_nothing
|| map.field[d.x][d.y].type == FT_tunnel))
/* this direction is still oky */ /* this direction is still oky */
keepdir = 1; keepdir = 1;
else if (bomb->mode == BM_liquid) { else if (bomb->mode == BM_liquid) {
@ -149,7 +198,8 @@ bomb_move (_bomb * bomb)
/* if a network game is running send bomb data with the /* if a network game is running send bomb data with the
current information */ current information */
if (GT_MP) { if (GT_MP) {
int b = -1, i = 0; int b = -1,
i = 0;
do { do {
if (&players[bman.p_nr].bombs[i] == bomb) if (&players[bman.p_nr].bombs[i] == bomb)
@ -163,9 +213,10 @@ bomb_move (_bomb * bomb)
} }
} }
dist += step; dist += step;
} while (dist < (timefactor * bomb->speed) && (bomb->mode == BM_liquid || bomb->mode == BM_moving) && keepdir); } while (dist < (timefactor * bomb->speed)
&& (bomb->mode == BM_liquid || bomb->mode == BM_moving) && keepdir);
map.bfield[(int)bomb->pos.x][(int)bomb->pos.y] = 1; /* set new bfield */ map.bfield[(int) bomb->pos.x][(int) bomb->pos.y] = 1; /* set new bfield */
stonelist_add (bomb->pos.x, bomb->pos.y); stonelist_add (bomb->pos.x, bomb->pos.y);
} }
@ -248,7 +299,8 @@ get_bomb_on (float x, float y, _point bombs[])
for (b = 0; b < MAX_BOMBS; b++) { for (b = 0; b < MAX_BOMBS; b++) {
bomb = &players[p].bombs[b]; bomb = &players[p].bombs[b];
if (bomb->state == BS_ticking || bomb->state == BS_trigger) { if (bomb->state == BS_ticking || bomb->state == BS_trigger) {
if (bomb->pos.x-1.0f < x && bomb->pos.x+1.0f > x && bomb->pos.y-1.0f < y && bomb->pos.y+1.0f > y) { if (bomb->pos.x - 1.0f < x && bomb->pos.x + 1.0f > x && bomb->pos.y - 1.0f < y
&& bomb->pos.y + 1.0f > y) {
bombs[i].x = p; bombs[i].x = p;
bombs[i].y = b; bombs[i].y = b;
i++; i++;
@ -287,9 +339,12 @@ draw_fire (int x, int y, int d, int frame)
void void
restore_explosion (_bomb * bomb) restore_explosion (_bomb * bomb)
{ {
int i, j, int i,
d, dx = 0, j,
dy = 0, _x, d,
dx = 0,
dy = 0,
_x,
_y; _y;
for (d = 0; d < 4; d++) { for (d = 0; d < 4; d++) {
@ -331,8 +386,7 @@ restore_explosion (_bomb * bomb)
// delete the stone completly if there was any in the way // delete the stone completly if there was any in the way
if (bomb->firer[d] <= bomb->r && map.field[_x][_y].type != FT_block if (bomb->firer[d] <= bomb->r && map.field[_x][_y].type != FT_block
&& map.field[_x][_y].type != FT_tunnel && map.field[_x][_y].type != FT_tunnel && bomb->ex_nr != map.field[_x][_y].ex_nr) {
&& bomb->ex_nr != map.field[_x][_y].ex_nr) {
map.field[_x][_y].ex_nr = bomb->ex_nr; map.field[_x][_y].ex_nr = bomb->ex_nr;
map.field[_x][_y].frame = 0.0f; map.field[_x][_y].frame = 0.0f;
@ -355,9 +409,9 @@ restore_explosion (_bomb * bomb)
/* delete field from the bfield map */ /* delete field from the bfield map */
if (bomb->mode == BM_moving || bomb->mode == BM_pushed || bomb->mode == BM_liquid) if (bomb->mode == BM_moving || bomb->mode == BM_pushed || bomb->mode == BM_liquid)
map.bfield[(int)bomb->pos.x + bomb->dest.x][(int)bomb->pos.y + bomb->dest.y] = 0; map.bfield[(int) bomb->pos.x + bomb->dest.x][(int) bomb->pos.y + bomb->dest.y] = 0;
map.bfield[(int)bomb->pos.x][(int)bomb->pos.y] = 0; map.bfield[(int) bomb->pos.x][(int) bomb->pos.y] = 0;
}; };
@ -393,7 +447,8 @@ explosion_check_field (int x, int y, int p, int b)
for (i = 0; pl[i] != -1; i++) { for (i = 0; pl[i] != -1; i++) {
tmpplayer = &players[pl[i]]; tmpplayer = &players[pl[i]];
if (((tmpplayer->state & PSF_alife) != 0) if (((tmpplayer->state & PSF_alife) != 0)
&& (GT_SP || (GT_MP && (&players[bman.p_nr] == tmpplayer)) || (GT_MP_PTPM && PS_IS_aiplayer(tmpplayer->state)))) && (GT_SP || (GT_MP && (&players[bman.p_nr] == tmpplayer))
|| (GT_MP_PTPM && PS_IS_aiplayer (tmpplayer->state))))
player_died (tmpplayer, p); player_died (tmpplayer, p);
} }
@ -493,8 +548,9 @@ do_explosion (int p, int b)
if ((checkfield == FT_nothing || checkfield == FT_tunnel) if ((checkfield == FT_nothing || checkfield == FT_tunnel)
&& bomb->firerst[d] == -1) { && bomb->firerst[d] == -1) {
bomb->firer[d]++; bomb->firer[d]++;
map.field[(int)bomb->pos.x + dx][(int)bomb->pos.y + dy].ex[d].count++; map.field[(int) bomb->pos.x + dx][(int) bomb->pos.y + dy].ex[d].count++;
map.field[(int)bomb->pos.x + dx][(int)bomb->pos.y + dy].ex[d].frame = bomb->firer[d]; map.field[(int) bomb->pos.x + dx][(int) bomb->pos.y + dy].ex[d].frame =
bomb->firer[d];
/* if we have a slow pc we can enable this and disable the drawing animation */ /* if we have a slow pc we can enable this and disable the drawing animation */
// draw_fire (bomb->pos.x + dx, bomb->pos.y + dy, d, gfx.fire.frames>>1); // draw_fire (bomb->pos.x + dx, bomb->pos.y + dy, d, gfx.fire.frames>>1);
} }
@ -511,13 +567,17 @@ do_explosion (int p, int b)
}; };
inline void bomb_action (_bomb *bomb) { inline void
bomb_action (_bomb * bomb)
{
switch (bomb->mode) { switch (bomb->mode) {
case (BM_moving): case (BM_moving):
case (BM_liquid): case (BM_liquid):
case (BM_pushed): case (BM_pushed):
bomb_move (bomb); bomb_move (bomb);
break; break;
case (BM_kicked):
break;
default: default:
bomb->mode = BM_normal; bomb->mode = BM_normal;
break; break;

@ -73,6 +73,7 @@ config_init (int argc, char **argv)
map.sp_trigger = GAME_SPECIAL_ITEMSTRIGGER; map.sp_trigger = GAME_SPECIAL_ITEMSTRIGGER;
map.sp_row = GAME_SPECIAL_ITEMSROW; map.sp_row = GAME_SPECIAL_ITEMSROW;
map.sp_push = GAME_SPECIAL_ITEMSPUSH; map.sp_push = GAME_SPECIAL_ITEMSPUSH;
map.sp_kick = GAME_SPECIAL_ITEMSKICK;
d_printf ("\n\n ***** Bomberclone Version %s \n\n", VERSION); d_printf ("\n\n ***** Bomberclone Version %s \n\n", VERSION);
if (config_read ()) { /* error on reading the config file */ if (config_read ()) { /* error on reading the config file */
ReadPrgArgs (argc, argv); ReadPrgArgs (argc, argv);

@ -1,4 +1,4 @@
/* $Id: main.c,v 1.20 2004/01/06 19:52:02 stpohle Exp $ */ /* $Id: main.c,v 1.21 2004/01/07 23:04:32 patty21 Exp $ */
#include "basic.h" #include "basic.h"
#include "bomberclone.h" #include "bomberclone.h"
@ -60,8 +60,8 @@ main (int argc, char **argv)
} }
} }
network_init (); // network_init ();
network_shutdown (); // network_shutdown ();
gfx_shutdown (); gfx_shutdown ();

@ -1,4 +1,4 @@
/* $Id: map.c,v 1.19 2004/01/03 03:01:30 stpohle Exp $ */ /* $Id: map.c,v 1.20 2004/01/07 23:04:32 patty21 Exp $ */
/* map handling, like generate and load maps. */ /* map handling, like generate and load maps. */
#include "bomberclone.h" #include "bomberclone.h"
@ -118,6 +118,8 @@ map_new (char *filename)
map_fillitems (FT_sp_push, map.sp_push); map_fillitems (FT_sp_push, map.sp_push);
map_fillitems (FT_sp_liquid, map.sp_push); map_fillitems (FT_sp_liquid, map.sp_push);
map_fillitems (FT_sp_moved, map.sp_push); map_fillitems (FT_sp_moved, map.sp_push);
/* put the push special in the field */
map_fillitems(FT_sp_kick,map.sp_kick);
map.type = old_maptype; map.type = old_maptype;
} }

@ -1,4 +1,4 @@
/* $Id: mapmenu.c,v 1.17 2004/01/06 19:51:09 stpohle Exp $ */ /* $Id: mapmenu.c,v 1.18 2004/01/07 23:04:32 patty21 Exp $ */
/* map/tileset selection menu */ /* map/tileset selection menu */
#include "bomberclone.h" #include "bomberclone.h"
@ -95,8 +95,9 @@ mapmenu ()
menu_create_entry ("Trigger:", 280, 240, 120, &map.sp_trigger, 30, MENU_entryint32, 12); menu_create_entry ("Trigger:", 280, 240, 120, &map.sp_trigger, 30, MENU_entryint32, 12);
menu_create_entry ("Push: ", 280, 260, 120, &map.sp_push, 30, MENU_entryint32, 13); menu_create_entry ("Push: ", 280, 260, 120, &map.sp_push, 30, MENU_entryint32, 13);
menu_create_entry ("Row: ", 280, 280, 120, &map.sp_row, 30, MENU_entryint32, 14); menu_create_entry ("Row: ", 280, 280, 120, &map.sp_row, 30, MENU_entryint32, 14);
menu_create_entry ("Kick: ", 280, 300, 120, &map.sp_kick, 30, MENU_entryint32, 15);
menu_create_entry ("Game Timeout:", -1, 350, 180, &bman.init_timeout, 1200, MENU_entryint32, 15); menu_create_entry ("Game Timeout:", -1, 350, 180, &bman.init_timeout, 1200, MENU_entryint32, 16);
menu_create_button ("Ok", -1, 380, 150, 0); menu_create_button ("Ok", -1, 380, 150, 0);

@ -405,7 +405,7 @@ wait_for_players ()
else if (event.type == SDL_KEYDOWN && event.key.keysym.sym != SDLK_RSHIFT && event.key.keysym.sym != SDLK_LSHIFT) else if (event.type == SDL_KEYDOWN && event.key.keysym.sym != SDLK_RSHIFT && event.key.keysym.sym != SDLK_LSHIFT)
keypressed = 1; keypressed = 1;
s_delay (50); s_delay (25);
} }
gfx_blitdraw (); // to clean the gfx blit data gfx_blitdraw (); // to clean the gfx blit data

@ -1,4 +1,4 @@
/* $Id: player.c,v 1.64 2004/01/06 02:19:57 stpohle Exp $ /* $Id: player.c,v 1.65 2004/01/07 23:04:32 patty21 Exp $
* player.c - everything what have to do with the player */ * player.c - everything what have to do with the player */
#include <SDL.h> #include <SDL.h>
@ -202,6 +202,7 @@ player_check_powerup (int p_nr)
case FT_sp_push: case FT_sp_push:
case FT_sp_moved: case FT_sp_moved:
case FT_sp_liquid: case FT_sp_liquid:
case FT_sp_kick:
special_pickup (p_nr, ft - FT_sp_trigger + 1); special_pickup (p_nr, ft - FT_sp_trigger + 1);
bman.updatestatusbar = 1; bman.updatestatusbar = 1;
field_clear (fx, fy); field_clear (fx, fy);

@ -1,4 +1,4 @@
/* $Id: special.c,v 1.29 2003/11/08 19:53:07 stpohle Exp $ */ /* $Id: special.c,v 1.30 2004/01/07 23:04:32 patty21 Exp $ */
/* special.c - procedues to control the specials */ /* special.c - procedues to control the specials */
#include "bomberclone.h" #include "bomberclone.h"
@ -38,8 +38,8 @@ special_row (int p_nr)
{ {
_bomb *b = NULL; _bomb *b = NULL;
_player *p = &players[p_nr]; _player *p = &players[p_nr];
int x = (int)p->pos.x, int x = (int) p->pos.x,
y = (int)p->pos.y, y = (int) p->pos.y,
dx = 0, dx = 0,
dy = 0, dy = 0,
t = 0, t = 0,
@ -95,8 +95,8 @@ special_liquidmoved (int p_nr)
_player *p = &players[p_nr]; _player *p = &players[p_nr];
_point bombs[MAX_PLAYERS * MAX_BOMBS]; _point bombs[MAX_PLAYERS * MAX_BOMBS];
int x = (int)p->pos.x, int x = (int) p->pos.x,
y = (int)p->pos.y, y = (int) p->pos.y,
dx = 0, dx = 0,
dy = 0, dy = 0,
x1, x1,
@ -135,7 +135,7 @@ special_liquidmoved (int p_nr)
|| (map.field[x1][y1].type != FT_nothing && map.field[x1][y1].type != FT_tunnel)) || (map.field[x1][y1].type != FT_nothing && map.field[x1][y1].type != FT_tunnel))
return; return;
get_bomb_on ((float)x, (float)y, bombs); get_bomb_on ((float) x, (float) y, bombs);
// move all bombs on that field (there should be only 1) // move all bombs on that field (there should be only 1)
for (i = 0; (bombs[i].x != -1) && (i < MAX_PLAYERS * MAX_BOMBS); i++) { for (i = 0; (bombs[i].x != -1) && (i < MAX_PLAYERS * MAX_BOMBS); i++) {
b = &players[bombs[i].x].bombs[bombs[i].y]; b = &players[bombs[i].x].bombs[bombs[i].y];
@ -165,8 +165,8 @@ special_push (int p_nr)
_player *p = &players[p_nr]; _player *p = &players[p_nr];
_point bombs[MAX_PLAYERS * MAX_BOMBS]; _point bombs[MAX_PLAYERS * MAX_BOMBS];
int x = (int)p->pos.x, int x = (int) p->pos.x,
y = (int)p->pos.y, y = (int) p->pos.y,
dx = 0, dx = 0,
dy = 0, dy = 0,
x1, x1,
@ -205,7 +205,7 @@ special_push (int p_nr)
|| (map.field[x1][y1].type != FT_nothing && map.field[x1][y1].type != FT_tunnel)) || (map.field[x1][y1].type != FT_nothing && map.field[x1][y1].type != FT_tunnel))
return; return;
get_bomb_on (x , y , bombs); get_bomb_on (x, y, bombs);
// move all bombs on that field (there should be only 1) // 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++) {
b = &players[bombs[i].x].bombs[bombs[i].y]; b = &players[bombs[i].x].bombs[bombs[i].y];
@ -225,6 +225,92 @@ special_push (int p_nr)
} }
void
special_kick (int p_nr)
{
_bomb *b = NULL;
_player *p = &players[p_nr];
_point bombs[MAX_PLAYERS * MAX_BOMBS];
int x = (int) p->pos.x,
y = (int) p->pos.y,
dx = 0,
dy = 0,
x1,
y1,
i = 20,
r;
if ((CUTINT (p->pos.x) != 0.0f) || (CUTINT (p->pos.y) != 0.0f))
return;
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;
// check that player is beside a bomb
if (!map.bfield[x][y])
return;
/* calculate a new destination for the bomb
(the new dest has to be in the direction of that bomb
with max angle of 45 degree and distance SPECIAL_KICK_MAXDIST
if the bomb kickt to the border of maze, nothing happens.)
*/
do {
i--;
r = s_random (SPECIAL_KICK_MAXDIST) + 1;
if (dx != 0) {
x1 = x + dx * r;
y1 = y + s_random (r * 2 + 1) - r;
}
else {
y1 = y + dy * r;
x1 = x + s_random (r * 2 + 1) - r;
}
// check if within maze
if ((x1 >= 0) && (x1 < map.size.x) && (y1 >= 0) && (y1 < map.size.y)) {
// check that field is emty
if (!map.bfield[x1][y1]
&& (map.field[x1][y1].type == FT_nothing || map.field[x1][y1].type == FT_tunnel)) {
// move bomb to new destination
get_bomb_on (x, y, bombs);
for (i = 0; bombs[i].x != -1; i++) {
b = &players[bombs[i].x].bombs[bombs[i].y];
if (b->state != BS_exploding) {
b->dest.x = x;
b->dest.y = y;
b->speed = 88; //ca (3*pi)*(3*pi)
b->mode = BM_kicked;
b->pos.x = x1;
b->pos.y = y1;
map.bfield[x][y] = 0;
map.bfield[x1][y1] = 1;
stonelist_add (x, y);
if (GT_MP) {
net_game_send_bomb (bombs[i].x, bombs[i].y);
}
}
}
i = 0;
}
}
} while (i > 0);
}
void void
special_pickup (int p_nr, int s_nr) special_pickup (int p_nr, int s_nr)
{ {
@ -246,6 +332,9 @@ special_pickup (int p_nr, int s_nr)
case SP_liquid: case SP_liquid:
s->to = SPECIAL_PUSH_TIME; s->to = SPECIAL_PUSH_TIME;
break; break;
case SP_kick:
s->to = SPECIAL_KICK_TIME;
break;
} }
bman.updatestatusbar = 1; bman.updatestatusbar = 1;
@ -302,7 +391,12 @@ special_loop ()
if (players[p_nr].m) if (players[p_nr].m)
special_liquidmoved (p_nr); special_liquidmoved (p_nr);
break; break;
case SP_kick:
if (players[p_nr].m)
special_kick (p_nr);
break;
} }
s->use = 0; s->use = 0;
} }
@ -311,7 +405,7 @@ special_loop ()
if (s->to <= 0.0f) if (s->to <= 0.0f)
special_clear (p_nr); special_clear (p_nr);
} }
} }
} }

@ -1,4 +1,4 @@
/* $Id: sysfunc.c,v 1.22 2003/12/28 01:21:43 stpohle Exp $ /* $Id: sysfunc.c,v 1.23 2004/01/07 23:04:32 patty21 Exp $
sysfunc.c - this file hold some routines for the system functions.. sysfunc.c - this file hold some routines for the system functions..
like d_delay like d_delay
*/ */
@ -314,3 +314,8 @@ _charlist *charlist_findtext (_charlist *list, char *text) {
return result; return result;
}; };
float absol(float f) {
if (f<0) f*=-1;
return f;
}

@ -1,4 +1,4 @@
/* $Id: tileset.c,v 1.11 2003/11/12 00:28:04 stpohle Exp $ */ /* $Id: tileset.c,v 1.12 2004/01/07 23:04:32 patty21 Exp $ */
/* load and select tilesets */ /* load and select tilesets */
#include "bomberclone.h" #include "bomberclone.h"
@ -195,6 +195,9 @@ tileset_load (char *tilesetname)
case (FT_sp_liquid): case (FT_sp_liquid):
sprintf (filename, "spliquid"); sprintf (filename, "spliquid");
break; break;
case (FT_sp_kick):
sprintf (filename, "spkick");
break;
} }
if (i != FT_mixed) { if (i != FT_mixed) {
sprintf (fullname, "%s/tileset/%s/%s.bmp", bman.datapath, tileset, filename); sprintf (fullname, "%s/tileset/%s/%s.bmp", bman.datapath, tileset, filename);

Loading…
Cancel
Save