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
AC_INIT(configure.in)
AM_INIT_AUTOMAKE(bomberclone, 0.11.0)
AM_INIT_AUTOMAKE(bomberclone, 0.11.1)
AM_CONFIG_HEADER(config.h)
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 */
#ifndef _BC_BASIC_H_
@ -13,6 +13,7 @@
#define GAME_SPECIAL_ITEMSTRIGGER 3
#define GAME_SPECIAL_ITEMSROW 3
#define GAME_SPECIAL_ITEMSPUSH 3
#define GAME_SPECIAL_ITEMSKICK 3
#define GAME_MAX_TUNNELS 4 // number of tunnel entrys
#define GAME_TIMEOUT 600.0 // game timeout 10min)
#define GAME_OVERTIMEOUT 5.0 // second of remaining the last player
@ -25,6 +26,8 @@
#define SPECIAL_TRIGGER_TIME 25
#define SPECIAL_ROW_TIME 30
#define SPECIAL_PUSH_TIME 50
#define SPECIAL_KICK_TIME 30
#define SPECIAL_KICK_MAXDIST 8 // maximum distance allowed
#define START_BOMBS 1
#define START_RANGE 2
@ -123,6 +126,7 @@ enum _fieldtype {
FT_sp_push, // The push-boms special
FT_sp_moved, // The moved-boms 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
};
@ -142,6 +146,7 @@ enum _specials {
SP_push, // push bombs
SP_moved, // moved bombs
SP_liquid, // liquid bombs
SP_kick, // kick bombs
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 */
#ifndef _MAP_H_
@ -51,6 +51,7 @@ struct __map {
int sp_trigger;
int sp_push;
int sp_row;
int sp_kick;
unsigned char state; // state of the 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 */
#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 charlist_fillarraypointer (_charlist *list, int c);
extern _charlist *charlist_findtext (_charlist *list, char *text);
extern float absol(float f);
#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 */
#include "bomberclone.h"
@ -10,35 +10,79 @@ draw_bomb (_bomb * bomb)
SDL_Rect src,
dest;
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) {
d_printf ("FATAL: Draw Bomb out of range [%f,%f]\n", x, y);
return;
}
if (bomb->state != BS_trigger
|| ((bomb->state == BS_trigger) && (bomb->to < BOMB_TIMEOUT))) {
if (bomb->state != BS_trigger || ((bomb->state == BS_trigger) && (bomb->to < BOMB_TIMEOUT))) {
/* check the framenumber */
bomb->frame += (timefactor/3.0);
bomb->frame += (timefactor / 3.0);
if (bomb->frame < 0 || bomb->frame >= gfx.bomb.frames)
bomb->frame = 0.0f;
}
dest.w = src.w = gfx.bomb.image->w;
dest.h = src.h = 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;
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.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.y = src.h * (int)bomb->frame;
src.y = src.h * (int) bomb->frame;
stonelist_add (x, y);
if (bomb->mode != BM_normal) {
stonelist_add (x+1, y);
stonelist_add (x, y+1);
stonelist_add (x+1, y+1);
}
if (bomb->mode != BM_normal) {
stonelist_add (x + 1, y);
stonelist_add (x, 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);
};
@ -53,7 +97,7 @@ bomb_explode (int p, int b, int net)
if (bomb->ex_nr == -1)
bomb->ex_nr = bman.last_ex_nr++; // set bomb explosion id
players[p].bomb_lastex = b;
players[p].bomb_lastex = b;
bomb->to = EXPLOSIONTIMEOUT; /* set the timeout for the fireexplosion */
bomb->state = BS_exploding;
@ -74,99 +118,106 @@ bomb_explode (int p, int b, int net)
void
bomb_move (_bomb * bomb)
{
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);
/* do this once, and again if the direction is still ok */
do {
/* get the current position of the bomb */
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) {
step = 1.0f - rpos.x;
fpos.x += 1.0f;
}
else if (bomb->dest.y < 0)
step = rpos.y;
else if (bomb->dest.y > 0) {
step = 1.0f - rpos.y;
fpos.y += 1.0f;
}
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;
else if (bomb->dest.x > 0)
bomb->pos.x += step;
else if (bomb->dest.y < 0)
bomb->pos.y -= step;
else if (bomb->dest.y > 0)
bomb->pos.y += step;
/* if we are on a complete field, check if we
can move to the next one */
if ((CUTINT(bomb->pos.x) == 0.0f) && (CUTINT(bomb->pos.y) == 0.0f)) {
if (bomb->mode == BM_pushed)
bomb->mode = BM_normal;
else if (bomb->mode == BM_moving || bomb->mode == BM_liquid) {
/* it is a moving liquid bomb so check for another field */
_point b, d;
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;
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 */
keepdir = 1;
else if (bomb->mode == BM_liquid) {
/* liquid bomb so move to the other side */
keepdir = 0;
bomb->dest.x = -bomb->dest.x;
bomb->dest.y = -bomb->dest.y;
}
else {
/* stop moving this bomb */
keepdir = 0;
bomb->mode = BM_normal;
}
/* if a network game is running send bomb data with the
current information */
if (GT_MP) {
int b = -1, i = 0;
do {
if (&players[bman.p_nr].bombs[i] == bomb)
b = i;
i++;
} while (b == -1 && i < MAX_BOMBS);
if (b != -1)
net_game_send_bomb (bman.p_nr, b);
}
}
}
dist += step;
} 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 */
stonelist_add (bomb->pos.x, bomb->pos.y);
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);
/* do this once, and again if the direction is still ok */
do {
/* get the current position of the bomb */
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) {
step = 1.0f - rpos.x;
fpos.x += 1.0f;
}
else if (bomb->dest.y < 0)
step = rpos.y;
else if (bomb->dest.y > 0) {
step = 1.0f - rpos.y;
fpos.y += 1.0f;
}
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;
else if (bomb->dest.x > 0)
bomb->pos.x += step;
else if (bomb->dest.y < 0)
bomb->pos.y -= step;
else if (bomb->dest.y > 0)
bomb->pos.y += step;
/* if we are on a complete field, check if we
can move to the next one */
if ((CUTINT (bomb->pos.x) == 0.0f) && (CUTINT (bomb->pos.y) == 0.0f)) {
if (bomb->mode == BM_pushed)
bomb->mode = BM_normal;
else if (bomb->mode == BM_moving || bomb->mode == BM_liquid) {
/* it is a moving liquid bomb so check for another field */
_point b,
d;
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;
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 */
keepdir = 1;
else if (bomb->mode == BM_liquid) {
/* liquid bomb so move to the other side */
keepdir = 0;
bomb->dest.x = -bomb->dest.x;
bomb->dest.y = -bomb->dest.y;
}
else {
/* stop moving this bomb */
keepdir = 0;
bomb->mode = BM_normal;
}
/* if a network game is running send bomb data with the
current information */
if (GT_MP) {
int b = -1,
i = 0;
do {
if (&players[bman.p_nr].bombs[i] == bomb)
b = i;
i++;
} while (b == -1 && i < MAX_BOMBS);
if (b != -1)
net_game_send_bomb (bman.p_nr, b);
}
}
}
dist += step;
} 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 */
stonelist_add (bomb->pos.x, bomb->pos.y);
}
@ -188,14 +239,14 @@ bomb_loop ()
case BS_ticking:
case BS_trigger:
if (GT_MP_PTPM || GT_SP) {
bomb->to -= timediff;
bomb->to -= timediff;
if (bomb->to <= 0.0f) // bomb will have to explode in the next loop
bomb_explode (p, i, 1);
else
draw_bomb (bomb);
}
else {
bomb->to -= timediff;
bomb->to -= timediff;
if (bomb->to <= 0.0f) { // bomb did not explode -> resend bombdata
if (bomb->state == BS_ticking)
bomb->to = BOMB_TIMEOUT;
@ -207,11 +258,11 @@ bomb_loop ()
draw_bomb (bomb);
}
if (bomb->mode != BM_normal)
bomb_action (bomb);
if (bomb->mode != BM_normal)
bomb_action (bomb);
b++; // Count ticking Bombs for Return value
break;
b++; // Count ticking Bombs for Return value
break;
case BS_exploding:
if (bomb->to > 0.0f) {
@ -248,7 +299,8 @@ get_bomb_on (float x, float y, _point bombs[])
for (b = 0; b < MAX_BOMBS; b++) {
bomb = &players[p].bombs[b];
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].y = b;
i++;
@ -287,10 +339,13 @@ draw_fire (int x, int y, int d, int frame)
void
restore_explosion (_bomb * bomb)
{
int i, j,
d, dx = 0,
dy = 0, _x,
_y;
int i,
j,
d,
dx = 0,
dy = 0,
_x,
_y;
for (d = 0; d < 4; d++) {
switch (d) {
@ -319,10 +374,10 @@ restore_explosion (_bomb * bomb)
if (--map.field[_x][_y].ex[d].count == 0) // there was only one explosion so
map.field[_x][_y].ex[d].frame = 0; // reset the framenumber
for (j = 0; j >= 0 && j < 4; j++)
if (map.field[_x][_y].ex[j].count > 0 && j != d)
j = -4;
if (j > 0)
for (j = 0; j >= 0 && j < 4; j++)
if (map.field[_x][_y].ex[j].count > 0 && j != d)
j = -4;
if (j > 0)
stonelist_add (_x, _y);
_x = _x + dx;
@ -331,8 +386,7 @@ restore_explosion (_bomb * bomb)
// delete the stone completly if there was any in the way
if (bomb->firer[d] <= bomb->r && map.field[_x][_y].type != FT_block
&& map.field[_x][_y].type != FT_tunnel
&& bomb->ex_nr != map.field[_x][_y].ex_nr) {
&& map.field[_x][_y].type != FT_tunnel && bomb->ex_nr != map.field[_x][_y].ex_nr) {
map.field[_x][_y].ex_nr = bomb->ex_nr;
map.field[_x][_y].frame = 0.0f;
@ -354,10 +408,10 @@ restore_explosion (_bomb * bomb)
_y = bomb->pos.y;
/* delete field from the bfield map */
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;
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][(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++) {
tmpplayer = &players[pl[i]];
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);
}
@ -446,7 +501,7 @@ draw_explosion (_bomb * bomb)
map.field[p.x][p.y].ex[d].frame += timefactor;
if (map.field[p.x][p.y].ex[d].frame >= gfx.fire.frames)
map.field[p.x][p.y].ex[d].frame = 0.0f;
stonelist_add (p.x, p.y);
stonelist_add (p.x, p.y);
draw_fire (p.x, p.y, d, -1);
p.x += dx;
p.y += dy;
@ -460,8 +515,8 @@ do_explosion (int p, int b)
{
_bomb *bomb = &players[p].bombs[b];
int dx = 0,
dy = 0,
d;
dy = 0,
d;
for (d = 0; d < 4; d++) {
switch (d) {
@ -484,20 +539,21 @@ do_explosion (int p, int b)
}
if (bomb->firer[d] <= bomb->r) {
int checkfield;
int checkfield;
dx = bomb->firer[d] * dx;
dy = bomb->firer[d] * dy;
checkfield = explosion_check_field (bomb->pos.x + dx, bomb->pos.y + dy, p, b);
checkfield = explosion_check_field (bomb->pos.x + dx, bomb->pos.y + dy, p, b);
if ((checkfield == FT_nothing || checkfield == FT_tunnel)
&& bomb->firerst[d] == -1) {
&& bomb->firerst[d] == -1) {
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].frame = 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].frame =
bomb->firer[d];
/* 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);
}
}
else {
bomb->firerst[d] = bomb->firer[d];
stonelist_add (bomb->pos.x + dx, bomb->pos.y + dy);
@ -511,15 +567,19 @@ do_explosion (int p, int b)
};
inline void bomb_action (_bomb *bomb) {
switch (bomb->mode) {
case (BM_moving):
case (BM_liquid):
case (BM_pushed):
bomb_move (bomb);
break;
default:
bomb->mode = BM_normal;
break;
}
inline void
bomb_action (_bomb * bomb)
{
switch (bomb->mode) {
case (BM_moving):
case (BM_liquid):
case (BM_pushed):
bomb_move (bomb);
break;
case (BM_kicked):
break;
default:
bomb->mode = BM_normal;
break;
}
};

@ -73,6 +73,7 @@ config_init (int argc, char **argv)
map.sp_trigger = GAME_SPECIAL_ITEMSTRIGGER;
map.sp_row = GAME_SPECIAL_ITEMSROW;
map.sp_push = GAME_SPECIAL_ITEMSPUSH;
map.sp_kick = GAME_SPECIAL_ITEMSKICK;
d_printf ("\n\n ***** Bomberclone Version %s \n\n", VERSION);
if (config_read ()) { /* error on reading the config file */
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 "bomberclone.h"
@ -60,8 +60,8 @@ main (int argc, char **argv)
}
}
network_init ();
network_shutdown ();
// network_init ();
// network_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. */
#include "bomberclone.h"
@ -118,6 +118,8 @@ map_new (char *filename)
map_fillitems (FT_sp_push, map.sp_push);
map_fillitems (FT_sp_liquid, 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;
}

@ -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 */
#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 ("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 ("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);

@ -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)
keypressed = 1;
s_delay (50);
s_delay (25);
}
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 */
#include <SDL.h>
@ -202,6 +202,7 @@ player_check_powerup (int p_nr)
case FT_sp_push:
case FT_sp_moved:
case FT_sp_liquid:
case FT_sp_kick:
special_pickup (p_nr, ft - FT_sp_trigger + 1);
bman.updatestatusbar = 1;
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 */
#include "bomberclone.h"
@ -9,7 +9,7 @@ special_trigger (int p_nr)
{
int i,
z = 0,
ex_nr = bman.last_ex_nr;
ex_nr = bman.last_ex_nr;
_player *p = &players[p_nr];
@ -38,12 +38,12 @@ special_row (int p_nr)
{
_bomb *b = NULL;
_player *p = &players[p_nr];
int x = (int)p->pos.x,
y = (int)p->pos.y,
dx = 0,
dy = 0,
t = 0,
i;
int x = (int) p->pos.x,
y = (int) p->pos.y,
dx = 0,
dy = 0,
t = 0,
i;
switch (p->d) {
case left:
dx = -1;
@ -95,13 +95,13 @@ special_liquidmoved (int p_nr)
_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;
int x = (int) p->pos.x,
y = (int) p->pos.y,
dx = 0,
dy = 0,
x1,
y1,
i;
if ((CUTINT (p->pos.x) != 0.0f) || (CUTINT (p->pos.y) != 0.0f))
return;
@ -135,7 +135,7 @@ special_liquidmoved (int p_nr)
|| (map.field[x1][y1].type != FT_nothing && map.field[x1][y1].type != FT_tunnel))
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)
for (i = 0; (bombs[i].x != -1) && (i < MAX_PLAYERS * MAX_BOMBS); i++) {
b = &players[bombs[i].x].bombs[bombs[i].y];
@ -143,10 +143,10 @@ special_liquidmoved (int p_nr)
b->dest.x = dx;
b->dest.y = dy;
b->speed = p->speed;
if (p->special.type == SP_liquid)
b->mode = BM_liquid;
else
b->mode = BM_moving;
if (p->special.type == SP_liquid)
b->mode = BM_liquid;
else
b->mode = BM_moving;
map.bfield[x][y] = 0;
map.bfield[x1][y1] = 1;
stonelist_add (x, y);
@ -165,13 +165,13 @@ special_push (int p_nr)
_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;
int x = (int) p->pos.x,
y = (int) p->pos.y,
dx = 0,
dy = 0,
x1,
y1,
i;
if ((CUTINT (p->pos.x) != 0.0f) || (CUTINT (p->pos.y) != 0.0f))
return;
@ -205,7 +205,7 @@ special_push (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 (x, y, bombs);
// move all bombs on that field (there should be only 1)
for (i = 0; bombs[i].x != -1; i++) {
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
special_pickup (int p_nr, int s_nr)
{
@ -242,10 +328,13 @@ special_pickup (int p_nr, int s_nr)
s->to = SPECIAL_ROW_TIME;
break;
case SP_push:
case SP_moved:
case SP_moved:
case SP_liquid:
s->to = SPECIAL_PUSH_TIME;
break;
case SP_kick:
s->to = SPECIAL_KICK_TIME;
break;
}
bman.updatestatusbar = 1;
@ -302,16 +391,21 @@ special_loop ()
if (players[p_nr].m)
special_liquidmoved (p_nr);
break;
case SP_kick:
if (players[p_nr].m)
special_kick (p_nr);
break;
}
s->use = 0;
}
if (s->type && (s->to > 0.0f)) {
s->to -= timediff;
if (s->to <= 0.0f)
special_clear (p_nr);
}
s->use = 0;
}
if (s->type && (s->to > 0.0f)) {
s->to -= timediff;
if (s->to <= 0.0f)
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..
like d_delay
*/
@ -314,3 +314,8 @@ _charlist *charlist_findtext (_charlist *list, char *text) {
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 */
#include "bomberclone.h"
@ -195,6 +195,9 @@ tileset_load (char *tilesetname)
case (FT_sp_liquid):
sprintf (filename, "spliquid");
break;
case (FT_sp_kick):
sprintf (filename, "spkick");
break;
}
if (i != FT_mixed) {
sprintf (fullname, "%s/tileset/%s/%s.bmp", bman.datapath, tileset, filename);

Loading…
Cancel
Save