added flying items .. so dieing player can drop thier items.

origin
stpohle 22 years ago
parent aa6f0326de
commit e6d1faf92b

@ -1,4 +1,4 @@
$Id: ChangeLog,v 1.56 2004/01/25 14:10:22 stpohle Exp $
$Id: ChangeLog,v 1.57 2004/01/25 19:36:22 stpohle Exp $
- Added: Kick Bombs special
@ -27,6 +27,9 @@ $Id: ChangeLog,v 1.56 2004/01/25 14:10:22 stpohle Exp $
- Added: Game Setting start_bombs, start_range, start_bombs and
bomb_tickingtime.
- Added: Drop Items On Death element. You can collect now
your opponents items if he died.
Version 0.11.0
==============

@ -100,7 +100,8 @@ module.include.files=\
menu.h\
menugui.h\
ogcache-client.h\
udp.h
udp.h\
flyingitems.h
module.source.name=src
module.source.type=
@ -138,7 +139,8 @@ module.source.files=\
menuentrys.c\
menulists.c\
ogcache-client.c\
netsrvlist.c
netsrvlist.c\
flyingitems.c
module.pixmap.name=pixmaps
module.pixmap.type=

@ -21,6 +21,7 @@ bomberclone_include_DATA = \
sysfunc.h \
sound.h \
ogcache-client.h\
udp.h
udp.h \
flyingitems.h
EXTRA_DIST = $(bomberclone_include_DATA)

@ -1,4 +1,4 @@
/* $Id: basic.h,v 1.16 2004/01/07 23:04:31 patty21 Exp $ */
/* $Id: basic.h,v 1.17 2004/01/25 19:36:44 stpohle Exp $ */
/* basic types which we need everywhere */
#ifndef _BC_BASIC_H_
@ -92,6 +92,12 @@ enum _backgound { // to load some diffrent logos..
};
enum _gametype {
GT_bomberman = 0,
GT_deathmatch
};
enum _gamestate {
GS_startup = 0,
GS_quit,

@ -1,4 +1,4 @@
/* $Id: bomberclone.h,v 1.17 2004/01/25 14:10:28 stpohle Exp $ */
/* $Id: bomberclone.h,v 1.18 2004/01/25 19:36:44 stpohle Exp $ */
/* bomberclone.h */
#ifndef _BOMBERCLONE_H_
@ -69,7 +69,6 @@ struct {
int ex_nr; // explosion number
_point dest; // destination to move the bomb to
float speed; // bomb moving speed
} typedef _bomb;
struct {
@ -102,6 +101,7 @@ struct {
_bomb bombs[MAX_BOMBS]; // number of bombs who are ticking.
int range; // range of the bombs
float speed; // how fast we can go (0 = slow, 1 = normal... 3 = fastest)
int collect_shoes;
_playerilness ill[PI_max]; // all possible types
_special special; // special the player has
@ -128,9 +128,7 @@ struct {
int p_nr; // Playernumber 0 if you host a game or the number of the one you are.
int p_servnr; // Playernumber of the Server
int last_ex_nr; // number of the last explosion
int updatestatusbar; // 1 if statusbar has to be updated
unsigned char gametype;
unsigned char multitype;
int updatestatusbar; // 1 if statusbar has to be updated
unsigned char state;
int init_timeout; // gametimeout init value
float timeout; // game timeout
@ -155,8 +153,9 @@ struct {
int start_bombs; // start values
int start_range;
float start_speed;
float bomb_tickingtime; // time before the bomb explodes
unsigned char gametype; // GT_* values type of the Game if Deathmatch or other
int dropitemsondeath; // if a player should drop items when he die
unsigned char ai_players; // number of ai players
} typedef _bomberclone;

@ -1,5 +1,7 @@
/* network packets.. */
#include "flyingitems.h"
enum _network_data {
PKG_error = 0,
PKG_pingreq,
@ -21,7 +23,8 @@ enum _network_data {
PKG_ill,
PKG_special,
PKG_mapinfo,
PKG_tunneldata
PKG_tunneldata,
PKG_dropitem
};
@ -39,6 +42,12 @@ struct pkgheader {
};
struct pkgitem {
signed char x;
signed char y;
unsigned char typ;
};
struct pkg {
struct pkgheader h;
char data[0];
@ -71,6 +80,15 @@ struct pkg_ping {
};
struct pkg_dropitem {
struct pkgheader h;
_point from; // from where the items are coming
signed char p_nr; // playernumber -1 if the server jsut dropped something
unsigned char count; // number of elements
struct pkgitem items[0]; // elements
};
struct pkg_field {
struct pkgheader h;
unsigned char x;
@ -98,7 +116,7 @@ struct pkg_servermode {
struct pkgheader h;
unsigned char type;
unsigned char state;
unsigned char multitype;
unsigned char gametype;
unsigned char players;
unsigned char mapstate;
unsigned char maxplayer;
@ -303,6 +321,7 @@ extern void do_ill (struct pkg_ill *ill_pkg, _net_addr *addr);
extern void do_special (struct pkg_special *sp_pkg, _net_addr *addr);
extern void do_mapinfo (struct pkg_mapinfo *map_pkg, _net_addr *addr);
extern void do_tunneldata (struct pkg_tunneldata *tun_pkg, _net_addr *addr);
extern void do_dropitems (struct pkg_dropitem *di_pkg, _net_addr *addr);
extern void send_pkg (struct pkg *packet, _net_addr *addr);
extern void send_playerid (_net_addr *addr, char *name, char *pladdr, char *plport, int p_nr, int gfx_nr, signed char netflags);
@ -325,6 +344,7 @@ extern void send_ill (_net_addr *addr, int p_nr, _player *pl);
extern void send_special (_net_addr *addr, int p_nr, int typ, int ex_nr);
extern void send_mapinfo (_net_addr *addr);
extern void send_tunneldata (_net_addr *addr, int tunnelnr, int x, int y);
extern void send_dropitems (_net_addr *addr, int pl_nr, _flyingitem **fitems);
extern void fwd_pkg (struct pkg *packet, _net_addr *addr);

@ -37,6 +37,7 @@ bomberclone_SOURCES = \
single.c \
special.c \
sound.c\
ogcache-client.c
ogcache-client.c\
flyingitems.c
## bomberclone_LDADD =

@ -1,4 +1,4 @@
/* $Id: bomb.c,v 1.53 2004/01/25 14:10:29 stpohle Exp $ */
/* $Id: bomb.c,v 1.54 2004/01/25 19:36:46 stpohle Exp $ */
/* everything what have to do with the bombs */
#include "bomberclone.h"
@ -32,6 +32,7 @@ draw_bomb (_bomb * bomb)
dest.w = src.w = gfx.bomb.image->w;
dest.h = src.h = gfx.block.y;
if (bomb->mode == BM_kicked) {
/* draw the kicked bomb */
w = sqrt (bomb->speed);
w *= absol (sin (w));
x1 = bomb->dest.x - bomb->pos.x;

@ -79,7 +79,8 @@ config_init (int argc, char **argv)
bman.start_speed = START_SPEED;
bman.start_range = START_RANGE;
bman.bomb_tickingtime = BOMB_TIMEOUT;
d_printf ("\n\n ***** Bomberclone Version %s \n\n", VERSION);
bman.dropitemsondeath = 0;
d_printf ("\n\n ***** Bomberclone Version %s \n\n", VERSION);
if (config_read ()) { /* error on reading the config file */
ReadPrgArgs (argc, argv);
gfx_init ();
@ -249,6 +250,9 @@ config_read ()
if (!strcmp (keyword, "gametimeout")) {
bman.init_timeout = atoi (value);
}
if (!strcmp (keyword, "gametype")) {
bman.gametype = atoi (value);
}
if (!strcmp (keyword, "sndrate")) {
snd.audio_rate = atoi (value);
}
@ -276,6 +280,9 @@ config_read ()
if (!strcmp (keyword, "bomb_ticking")) {
sscanf (value, "%f", &bman.bomb_tickingtime);
}
if (!strcmp (keyword, "dropitemsondeath")) {
bman.dropitemsondeath = atoi (value);
}
}
fclose (config);
return 0;
@ -310,6 +317,7 @@ config_write ()
fprintf (config, "ogc_port=%s\n", bman.ogc_port);
fprintf (config, "gamename=%s\n", bman.gamename);
fprintf (config, "gametimeout=%d\n", bman.init_timeout);
fprintf (config, "gametype=%d\n", bman.gametype);
fprintf (config, "maxplayer=%d\n", bman.maxplayer);
fprintf (config, "debug=%d\n", debug);
fprintf (config, "askplayername=%d\n", bman.askplayername);
@ -322,6 +330,11 @@ config_write ()
fprintf (config, "sndformat=%d\n", snd.audio_format);
fprintf (config, "sndplaymusic=%d\n", snd.playmusic);
fprintf (config, "sndplaysound=%d\n", snd.playsound);
fprintf (config, "start_bombs=%d\n", bman.start_bombs);
fprintf (config, "start_range=%d\n", bman.start_range);
fprintf (config, "start_speed=%f\n", bman.start_speed);
fprintf (config, "bomb_tickingtime=%f\n", bman.bomb_tickingtime);
fprintf (config, "dropitemsondeath=%d\n", bman.dropitemsondeath);
fclose (config);
return 0;
}

@ -13,7 +13,6 @@ void d_gamedetail (char *head) {
d_printf ("players_nr = %d ", bman.players_nr);
d_printf ("players_nr_s = %d \n", bman.players_nr_s);
d_printf ("gametype = %d ", bman.gametype);
d_printf ("multitype = %d \n", bman.multitype);
d_printf ("state = %d\n", bman.state);
};
@ -69,7 +68,6 @@ void d_fatal (char *fmt,...) {
void debug_ingameinfo() {
int i;
float fl;
char text[255];
for (i = 0; i < map.size.x; i++)

@ -1,4 +1,4 @@
/* $Id: game.c,v 1.69 2004/01/25 14:10:30 stpohle Exp $
/* $Id: game.c,v 1.70 2004/01/25 19:36:48 stpohle Exp $
game.c - procedures for the game. */
#include <string.h>
@ -9,6 +9,7 @@
#include "network.h"
#include "packets.h"
#include "chat.h"
#include "flyingitems.h"
extern int blitdb_nr,
blitrects_nr;
@ -208,6 +209,12 @@ game_loop ()
bman.updatestatusbar = 1; // force an update
}
/* only for testing */
if (keys[SDLK_F7] && event.type == SDL_KEYDOWN) {
/* test for a random drop */
flitems_dropitems (bman.p_nr, players[bman.p_nr].pos, 1, 0, 0);
}
if (keys[SDLK_F9] && event.type == SDL_KEYDOWN) {
/* Switch Fullscreen */
debug = !debug;
@ -240,6 +247,7 @@ game_loop ()
to let us know how much Players are still left */
bomb_loop ();
field_loop ();
flitems_loop ();
draw_players ();
game_draw_info ();
@ -331,6 +339,7 @@ game_start ()
players[p].bombs_n = bman.start_bombs;
players[p].range = bman.start_range;
players[p].speed = bman.start_speed;
players[p].collect_shoes = 0;
players[p].special.type = SP_nothing;
players[p].m = 0;
players[p].old.x = 0;
@ -357,6 +366,7 @@ game_start ()
}
}
flitems_reset ();
init_map_tileset ();
tileset_load (map.tileset);
gfx_load_players (gfx.block.x, gfx.block.y);

@ -1,4 +1,4 @@
/* $Id: mapmenu.c,v 1.19 2004/01/25 14:10:44 stpohle Exp $ */
/* $Id: mapmenu.c,v 1.20 2004/01/25 19:36:50 stpohle Exp $ */
/* map/tileset selection menu */
#include "bomberclone.h"
@ -322,6 +322,13 @@ mapinfo ()
/* change start settings for the game */
void mapgamesetting () {
int menuselect = 0;
_charlist gametype [] = {
{"Bomberman", NULL},
{"Deathmatch", NULL},
};
_charlist *gametype_sel = &gametype[bman.gametype];
charlist_fillarraypointer (gametype, 2);
while (menuselect != -1 && bman.state != GS_quit) {
menu_new ("Game Options", 420, 400);
@ -336,6 +343,9 @@ void mapgamesetting () {
menu_create_label ("Game Parameter", 25, 180, 1);
menu_create_entry ("Bomb Time:", 25, 220, 200, &bman.bomb_tickingtime, 1200, MENU_entryfloat, 5);
menu_create_label ("Gametype", 25, 250, 0);
menu_create_list ("GameType", 25, 280, 150, 50, gametype, &gametype_sel, 6);
menu_create_bool ("Drop Items", 200, 280, 150, &bman.dropitemsondeath, 7);
menu_create_button ("Ok", -1, 380, 150, 0);
menuselect = menu_loop ();

@ -343,6 +343,7 @@ do_servermode (struct pkg_servermode *s_mod, _net_addr * addr)
/* do the normal update */
if (GT_MP_PTPS) {
bman.state = s_mod->state;
bman.gametype = s_mod->gametype;
map.state = s_mod->mapstate;
bman.players_nr_s = s_mod->players;
@ -372,7 +373,7 @@ send_servermode (_net_addr * addr, int pl_nr)
s_mod.state = GS_startup;
else
s_mod.state = bman.state;
s_mod.multitype = bman.multitype;
s_mod.gametype = bman.gametype;
s_mod.players = bman.players_nr_s;
s_mod.maxplayer = bman.maxplayer;
s_mod.p_nr = pl_nr;

@ -1,10 +1,11 @@
/* $Id: player.c,v 1.66 2004/01/25 14:10:45 stpohle Exp $
/* $Id: player.c,v 1.67 2004/01/25 19:37:05 stpohle Exp $
* player.c - everything what have to do with the player */
#include <SDL.h>
#include "bomberclone.h"
#include "network.h"
#include "sound.h"
#include "flyingitems.h"
void
draw_player (_player * player)
@ -185,6 +186,7 @@ player_check_powerup (int p_nr)
if (p->speed < MAX_SPEED && p->ill[PI_slow].to <= 0.0) {
p->speed *= SPEEDMUL;
bman.updatestatusbar = 1;
p->collect_shoes++;
}
field_clear (fx, fy);
break;
@ -436,7 +438,6 @@ move_player (int pl_nr)
void
player_drop_bomb (int pl_nr)
{
_player *player = &players[pl_nr];
_bomb *bomb = NULL;
int i;
@ -516,8 +517,14 @@ player_died (_player * player, signed char dead_by)
player->state &= (0xFF - PSF_alife);
player->dead_by = dead_by;
if (GT_MP)
net_game_send_player (player - &players[0]);
net_game_send_player (player - players);
snd_play (SND_dead);
if ((GT_SP || player == &players[bman.p_nr]
|| (PS_IS_aiplayer (player->state) && GT_MP_PTPM)) && bman.dropitemsondeath) {
flitems_dropitems ((player - players), player->pos, player->collect_shoes,
player->bombs_n - bman.start_bombs, player->range - bman.start_range);
}
};

Loading…
Cancel
Save