kicked bomb fixed... flying bomb drawing issues fixed.. last special item use over network bug fixed..

origin
stpohle 19 years ago
parent 111e53867b
commit 2c8b6618df

@ -1,8 +1,15 @@
$Id: ChangeLog,v 1.117 2007/01/12 11:15:42 stpohle Exp $ $Id: ChangeLog,v 1.118 2007/01/12 22:42:30 stpohle Exp $
Version 0.11.7.1 (still in progress) Version 0.11.7.1 (still in progress)
================ ================
- Fixed some drawing issues with flying bombs.
- The last special item use was lost on clients in a network game.
special.use (was reset during special_clean)
special.clean variable added to save the cleaning state.
tested and works.
- Fixed: kicked bombs can travel in time. (map.bfield was set too early) - Fixed: kicked bombs can travel in time. (map.bfield was set too early)
rewrote full bomb kicked system. rewrote full bomb kicked system.

@ -1,5 +1,3 @@
$Id: TODO,v 1.45 2006/08/19 23:41:47 stpohle Exp $ $Id: TODO,v 1.46 2007/01/12 22:42:30 stpohle Exp $
- kicking bombs.. maybe bombs will have to get floated points.. to make this better.
- explosions.. sometimes bombs can explode more times, slow networks (very slow) - explosions.. sometimes bombs can explode more times, slow networks (very slow)

@ -1,4 +1,4 @@
/* $Id: player.h,v 1.10 2005/02/20 19:11:20 stpohle Exp $ /* $Id: player.h,v 1.11 2007/01/12 22:42:31 stpohle Exp $
* playerinclude file * playerinclude file
*/ */
@ -67,6 +67,7 @@ struct {
int numuse; // num of uses left int numuse; // num of uses left
int use; /* currently used set by special_use int use; /* currently used set by special_use
and deleted in special_loop */ and deleted in special_loop */
int clear; // do we need to clear this special
} typedef _special; } typedef _special;

@ -1,4 +1,4 @@
/* $Id: bomb.c,v 1.66 2007/01/12 11:15:44 stpohle Exp $ */ /* $Id: bomb.c,v 1.67 2007/01/12 22:42:31 stpohle Exp $ */
/* everything what have to do with the bombs */ /* everything what have to do with the bombs */
#include "bomberclone.h" #include "bomberclone.h"
@ -6,9 +6,7 @@
#include "bomb.h" #include "bomb.h"
#include <math.h> #include <math.h>
void void draw_bomb (_bomb * bomb) {
draw_bomb (_bomb * bomb)
{
SDL_Rect src, dest; SDL_Rect src, dest;
int x = floorf (bomb->oldpos.x), y = floorf (bomb->oldpos.y); int x = floorf (bomb->oldpos.x), y = floorf (bomb->oldpos.y);
@ -50,6 +48,7 @@ draw_bomb (_bomb * bomb)
/* save the current position */ /* save the current position */
bomb->oldpos = bomb->pos; bomb->oldpos = bomb->pos;
if (bomb->mode == BM_kicked) y++;
gfx_blit (gfx.bomb.image, &src, gfx.screen, &dest, (y * 256) + 2); gfx_blit (gfx.bomb.image, &src, gfx.screen, &dest, (y * 256) + 2);
}; };
@ -61,9 +60,7 @@ draw_bomb (_bomb * bomb)
* to - timeout * to - timeout
* firer[d] - range of the bomb. * firer[d] - range of the bomb.
*/ */
void void bomb_explode (_bomb *bomb, int net) {
bomb_explode (_bomb *bomb, int net)
{
int d; int d;
d_printf ("Bomb Explode p:%d, b:%d [%f,%f]\n", bomb->id.p, bomb->id.b, bomb->pos.x, bomb->pos.y); d_printf ("Bomb Explode p:%d, b:%d [%f,%f]\n", bomb->id.p, bomb->id.b, bomb->pos.x, bomb->pos.y);
@ -97,9 +94,7 @@ bomb_explode (_bomb *bomb, int net)
/* moves the bomb with it's speed, /* moves the bomb with it's speed,
dest.x|y = dx, dy of the current move */ dest.x|y = dx, dy of the current move */
void void bomb_move (_bomb * bomb) {
bomb_move (_bomb * bomb)
{
int keepdir = 0; int keepdir = 0;
_pointf fpos, _pointf fpos,
rpos; rpos;
@ -203,9 +198,7 @@ bomb_move (_bomb * bomb)
} }
void void bomb_loop () {
bomb_loop ()
{
int p, int p,
i; i;
_player *player; _player *player;
@ -265,8 +258,10 @@ bomb_loop ()
}; };
/* check if on the givin place is a bomb /*
bombs[].x = player, bombs[].y = bombnumber */ * check if on the givin place is a bomb
* bombs[].x = player, bombs[].y = bombnumber
*/
void get_bomb_on (float x, float y, _point bombs[]) { void get_bomb_on (float x, float y, _point bombs[]) {
int p, int p,
b, b,
@ -362,9 +357,7 @@ void explosion_restore (_bomb *bomb) {
/* /*
* draw the explosion as far as she got * draw the explosion as far as she got
*/ */
void void explosion_draw (_bomb * bomb) {
explosion_draw (_bomb * bomb)
{
int d, int d,
r; r;
_point p; _point p;

@ -1,4 +1,4 @@
/* $Id: game.c,v 1.117 2007/01/12 11:15:44 stpohle Exp $ /* $Id: game.c,v 1.118 2007/01/12 22:42:31 stpohle Exp $
game.c - procedures for the game. */ game.c - procedures for the game. */
#include <string.h> #include <string.h>
@ -520,6 +520,8 @@ game_start ()
players[p].speed = bman.start_speed; players[p].speed = bman.start_speed;
players[p].collect_shoes = 0; players[p].collect_shoes = 0;
players[p].special.type = SP_nothing; players[p].special.type = SP_nothing;
players[p].special.use = 0;
players[p].special.clear = 0;
players[p].m = 0; players[p].m = 0;
players[p].old.x = 0; players[p].old.x = 0;
players[p].old.y = 0; players[p].old.y = 0;

@ -1,4 +1,4 @@
/* $Id: network.c,v 1.78 2006/08/19 23:07:13 stpohle Exp $ */ /* $Id: network.c,v 1.79 2007/01/12 22:42:31 stpohle Exp $ */
/* /*
network routines. network routines.
*/ */
@ -874,9 +874,7 @@ net_game_send_dropitems (int pl_nr, _flyingitem ** fiptr, int cnt)
this routine will set up some things for the network game this routine will set up some things for the network game
after this the data should be transfered to the other clients. after this the data should be transfered to the other clients.
*/ */
void void net_new_game () {
net_new_game ()
{
int p; int p;
/* set all multiplayer depending datas */ /* set all multiplayer depending datas */
@ -899,12 +897,10 @@ net_new_game ()
/* send special use elements into the network, /* send special use elements into the network,
to make sure nothing bad happens with explosions to make sure nothing bad happens with explosions
we send the ex_nr number too */ we send the ex_nr number too */
void void net_game_send_special (int pl_nr, int ex_nr, int type) {
net_game_send_special (int pl_nr, int ex_nr, int type)
{
int pl; int pl;
d_printf ("Send Special Data %d\n", pl_nr); d_printf ("Send Special Data pl_nr:%d ex_nr:%d type:%d\n", pl_nr, ex_nr, type);
if (pl_nr < 0 || pl_nr >= MAX_PLAYERS) if (pl_nr < 0 || pl_nr >= MAX_PLAYERS)
return; return;

@ -21,14 +21,12 @@ struct _inpkg_index inpkg_index[PKG_IN_INDEX_NUM];
int inpkg_index_pos = 0; int inpkg_index_pos = 0;
/*** /*
*** help function to get the playernumber from the address. * help function to get the playernumber from the address.
*** this function does not indicate which player it is, this function only checks * this function does not indicate which player it is, this function only checks
*** if the packet comed from a known player * if the packet comed from a known player
***/ */
int int get_player_nr (char *host, char *port) {
get_player_nr (char *host, char *port)
{
int i, int i,
res; res;
@ -42,12 +40,10 @@ get_player_nr (char *host, char *port)
} }
/*** /*
*** Packettype: error * Packettype: error
***/ */
void void send_error (_net_addr * addr, char *text) {
send_error (_net_addr * addr, char *text)
{
struct pkg_error p_err; struct pkg_error p_err;
d_printf ("Send Network Error : %s\n", text); d_printf ("Send Network Error : %s\n", text);
@ -61,9 +57,7 @@ send_error (_net_addr * addr, char *text)
}; };
void void do_error (struct pkg_error *data, _net_addr * addr) {
do_error (struct pkg_error *data, _net_addr * addr)
{
d_printf ("Network Error from %s:%s : '%s'\n", addr->host, addr->port, data->text); d_printf ("Network Error from %s:%s : '%s'\n", addr->host, addr->port, data->text);
/* check if the packet comes from the server, the server /* check if the packet comes from the server, the server
@ -78,19 +72,17 @@ do_error (struct pkg_error *data, _net_addr * addr)
/*** /*
*** Packettype: joingame * Packettype: joingame
*** client sends this to the server if he want's to join * client sends this to the server if he want's to join
*** *
*** 1) check if this package comes from a already joined and known player * 1) check if this package comes from a already joined and known player
*** if so: just send the current playerlist back. * if so: just send the current playerlist back.
*** else: * else:
*** 2) find free playerslot and add the player there * 2) find free playerslot and add the player there
*** 3) send to all players the new playerid * 3) send to all players the new playerid
***/ */
void void do_joingame (struct pkg_joingame *p_jg, _net_addr * addr) {
do_joingame (struct pkg_joingame *p_jg, _net_addr * addr)
{
_player *pl; _player *pl;
int i, int i,
vma, vma,
@ -208,9 +200,7 @@ do_joingame (struct pkg_joingame *p_jg, _net_addr * addr)
}; };
void void send_joingame (_net_addr * addr, char *name, int secondplayer) {
send_joingame (_net_addr * addr, char *name, int secondplayer)
{
struct pkg_joingame p_jg; struct pkg_joingame p_jg;
int vmi, int vmi,
vma, vma,
@ -999,12 +989,10 @@ do_playermove (struct pkg_playermove *p_dat, _net_addr * addr)
} }
/*** /*
*** Packettype: bombdata * Packettype: bombdata
***/ */
void void do_bombdata (struct pkg_bombdata *b_dat, _net_addr * addr) {
do_bombdata (struct pkg_bombdata *b_dat, _net_addr * addr)
{
_bomb *bomb; _bomb *bomb;
if (addr->pl_nr == -1) if (addr->pl_nr == -1)
@ -1057,6 +1045,11 @@ do_bombdata (struct pkg_bombdata *b_dat, _net_addr * addr)
bomb->r = b_dat->r; bomb->r = b_dat->r;
bomb->ex_nr = NTOH32 (b_dat->ex_nr); bomb->ex_nr = NTOH32 (b_dat->ex_nr);
bomb->state = b_dat->state & 0x0F; bomb->state = b_dat->state & 0x0F;
if (bomb->mode != b_dat->state >> 4) { // bombmode changed set source to current position
bomb->source.x = bomb->pos.x;
bomb->source.y = bomb->pos.y;
}
bomb->mode = b_dat->state >> 4; bomb->mode = b_dat->state >> 4;
bomb->fdata = I16TOF (NTOH16 (b_dat->fdata)); bomb->fdata = I16TOF (NTOH16 (b_dat->fdata));
bomb->dest.x = NTOH16 (b_dat->destx); bomb->dest.x = NTOH16 (b_dat->destx);
@ -1535,9 +1528,7 @@ do_dropitems (struct pkg_dropitem *di_pkg, _net_addr * addr)
*** Packettype: special *** Packettype: special
*** moves/bombs... whatever will be send as we use it *** moves/bombs... whatever will be send as we use it
***/ ***/
void void do_special (struct pkg_special *sp_pkg, _net_addr * addr) {
do_special (struct pkg_special *sp_pkg, _net_addr * addr)
{
d_printf ("do_special (addr %d, pl_nr %d, typ %d)\n", addr->pl_nr, sp_pkg->pl_nr, sp_pkg->typ); d_printf ("do_special (addr %d, pl_nr %d, typ %d)\n", addr->pl_nr, sp_pkg->pl_nr, sp_pkg->typ);
if (addr->pl_nr == -1 || sp_pkg->pl_nr == -1 || sp_pkg->pl_nr == bman.p_nr if (addr->pl_nr == -1 || sp_pkg->pl_nr == -1 || sp_pkg->pl_nr == bman.p_nr
|| sp_pkg->pl_nr == bman.p2_nr) || sp_pkg->pl_nr == bman.p2_nr)
@ -1550,9 +1541,9 @@ do_special (struct pkg_special *sp_pkg, _net_addr * addr)
special_use (sp_pkg->pl_nr); special_use (sp_pkg->pl_nr);
} }
/* cleas special */ /* clear special */
else if (sp_pkg->typ == SP_clear) else if (sp_pkg->typ == SP_clear)
special_clear (sp_pkg->pl_nr); players[sp_pkg->pl_nr].special.clear = 1;
}; };

@ -1,4 +1,4 @@
/* $Id: special.c,v 1.38 2007/01/12 11:15:44 stpohle Exp $ */ /* $Id: special.c,v 1.39 2007/01/12 22:42:31 stpohle Exp $ */
/* special.c - procedues to control the specials */ /* special.c - procedues to control the specials */
#include "bomberclone.h" #include "bomberclone.h"
@ -6,9 +6,7 @@
#include "player.h" #include "player.h"
#include "bomb.h" #include "bomb.h"
void 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;
@ -35,9 +33,7 @@ special_trigger (int p_nr)
} }
void void special_row (int p_nr) {
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,
@ -80,9 +76,7 @@ special_row (int p_nr)
} }
void void special_liquidmoved (int p_nr) {
special_liquidmoved (int p_nr)
{
_bomb *b = NULL; _bomb *b = NULL;
_player *p = &players[p_nr]; _player *p = &players[p_nr];
_point bombs[MAX_PLAYERS * MAX_BOMBS]; _point bombs[MAX_PLAYERS * MAX_BOMBS];
@ -226,8 +220,7 @@ void special_kick (int p_nr) {
/* calculate a new destination for the bomb /* calculate a new destination for the bomb
(the new dest has to be in the direction of that bomb (the new dest has to be in the direction of that bomb
with max angle of 45 degree and distance SPECIAL_KICK_MAXDIST with max angle of 45 degree and distance SPECIAL_KICK_MAXDIST
if the bomb kickt to the border of maze, nothing happens.) if the bomb kickt to the border of maze, nothing happens.) */
*/
do { do {
trycnt--; trycnt--;
r = s_random (SPECIAL_KICK_MAXDIST) + 1; r = s_random (SPECIAL_KICK_MAXDIST) + 1;
@ -301,9 +294,7 @@ special_pickup (int p_nr, int s_nr)
} }
void void special_clear (int p_nr) {
special_clear (int p_nr)
{
if (players[p_nr].special.type == SP_trigger) { if (players[p_nr].special.type == SP_trigger) {
_bomb *bomb; _bomb *bomb;
int i; int i;
@ -311,7 +302,7 @@ special_clear (int p_nr)
set it to normal */ set it to normal */
for (i = 0; i < MAX_BOMBS; i++) { for (i = 0; i < MAX_BOMBS; i++) {
bomb = &players[p_nr].bombs[i]; bomb = &players[p_nr].bombs[i];
if (bomb->state == BS_trigger) { if (bomb->state == BS_trigger && !players[p_nr].special.use) {
bomb->state = BS_ticking; bomb->state = BS_ticking;
if (bomb->to > bman.bomb_tickingtime) if (bomb->to > bman.bomb_tickingtime)
bomb->to = bman.bomb_tickingtime; bomb->to = bman.bomb_tickingtime;
@ -326,9 +317,7 @@ special_clear (int p_nr)
} }
void void special_loop () {
special_loop ()
{
_special *s; _special *s;
int p_nr; int p_nr;
@ -358,21 +347,22 @@ special_loop ()
special_kick (p_nr); special_kick (p_nr);
break; break;
} }
s->use = 0; s->use = 0;
} }
if (s->type && (s->to > 0.0f)) { if (s->type && (s->to > 0.0f)) {
s->to -= timediff; s->to -= timediff;
if (s->to <= 0.0f) if (s->to <= 0.0f) s->clear = 1;
}
if (s->clear) {
s->clear = 0;
special_clear (p_nr); special_clear (p_nr);
} }
} }
} }
void void special_use (int p_nr) {
special_use (int p_nr)
{
players[p_nr].special.use = 1; players[p_nr].special.use = 1;
} }

Loading…
Cancel
Save