game will have after a timeout or no other stones on the field a end game sequence. Like putting random powerups in the field or just get the size of the field down.

origin
stpohle 22 years ago
parent 92b79d1ddd
commit abc50df9c2

@ -135,5 +135,5 @@ AC_DEFINE_UNQUOTED(PACKAGE_SOURCE_DIR, "${packagesrcdir}")
AC_OUTPUT([
Makefile
src/Makefile
data/Makefile
])

@ -1,20 +0,0 @@
% Map created by kitutou (04/05/2003)
% for testing purpose
%
#########################
#@@ @@@@@ @@#
#@@ @@@@@ @@#
# @@@@@ #
# @@@@@ #
# @@@@@ #
#@@@@@@@@@@@@@@@@@@@@@@@#
#@@@@@@@@@@ @@@@@@@@@@#
#@@@@@@@@@@ @@@@@@@@@@#
#@@@@@@@@@@ @@@@@@@@@@#
#@@@@@@@@@@@@@@@@@@@@@@@#
# @@@@@ #
# @@@@@ #
# @@@@@ #
#@@ @@@@@ @@#
#@@ @@@@@ @@#
#########################

@ -1,27 +0,0 @@
% Map created by kitutou (04/05/2003)
% for testing purpose
%
########################
# #
# #
# # # #
# #### #### #
# # # #
# ###@@@@### #
# ### #@@@@# ### #
# # # #@@@@# # # #
# # ####@@@@#### # #
# ## @@@@@@@@@@@@ ## #
# @@@@@ @@@@@ #
# @@@@@ @@@@@ #
# ## @@@@@@@@@@@@ ## #
# # ####@@@@#### # #
# # # #@@@@# # # #
# ### #@@@@# ### #
# ###@@@@### #
# # # #
# #### #### #
# # # #
# #
# #
########################

@ -1,15 +0,0 @@
%
% $Id: smalfull.map,v 1.1 2003/05/08 18:11:12 kitutou Exp $
% First Map created by stpohle
% for testing purpose
%
###########
#@@@@#@@@@#
#@#@@@@@#@#
#@#######@#
#@#@@@@#@@#
#@@@@#@@@@#
#@#######@#
#@#@@@@@#@#
#@@@@#@@@@#
###########

@ -1,4 +1,4 @@
/* $Id: basic.h,v 1.42 2003/07/24 04:18:43 stpohle Exp $ */
/* $Id: basic.h,v 1.43 2003/07/27 13:29:25 stpohle Exp $ */
/* basic types which we need everywhere */
#ifndef _BC_BASIC_H_
@ -16,6 +16,8 @@
#define GAME_SPECIAL_ITEMSKICK 0 // no use yet
#define GAME_SPECIAL_ITEMSLIQUID 0 // no use yet
#define GAME_SPECIAL_ITEMSDESTROY 0 // no use yet
#define GAME_TIMEOUT 30000 // game timeout 10min)
#define GAME_TIMEOUTHURRY 3000 // game timeout for hurry and dropping mode (1min)
#define EXPLOSION_SAVE_DISTANCE 64
#define SPECIAL_TRIGGER_TIMEOUT 15
@ -78,6 +80,11 @@
#define MENU_BG_SHADE_DARK -64
#define MENU_BG_SHADE_BRIGHT 64
#define FIELDECHECK_TIMEOUT 100 /* timeout for the field check function */
#define FIELDHURRYDROPTO 50 /* timeout when to put in some special items */
#define FIELDHURRYSIZE 5 /* timeout when to put in some special items */
#define FIELDHURRYSIZEMIN 5 /* min size for the field */
#define MW_IS_GFX_SELECT(__gfx_nr,__result) for (__result = (MAX_PLAYERS-1); (bman.players[__result].gfx_nr != __gfx_nr) && (__result >= 0); __result--);
enum _networkflags {
@ -202,6 +209,19 @@ enum _dirbitmask { // bit mask for the directions
DIRM_under = 16
};
enum _mapselection {
MAPS_select = 0,
MAPS_randmap,
MAPS_randgen
};
enum _mstatus {
MS_normal = 0,
MS_hurry, // mapsize will go down
MS_dropitems, // alot of items will be droppen randomly into the game
MS_max
};
struct __point {
short int x;

@ -1,4 +1,4 @@
/* $Id: bomberclone.h,v 1.47 2003/07/25 21:44:47 stpohle Exp $ */
/* $Id: bomberclone.h,v 1.48 2003/07/27 13:29:25 stpohle Exp $ */
/* bomberclone.h */
#ifndef _BOMBERCLONE_H_
@ -131,6 +131,7 @@ struct __bomberclone {
unsigned char gametype;
unsigned char multitype;
unsigned char state;
int timeout; // game timeout
char playername[LEN_PLAYERNAME];
int players_nr_s; // number of players at the beginning
int players_nr; // number of player who are alife
@ -184,6 +185,9 @@ extern void draw_field ();
extern void field_clear(int x, int y);
extern void field_animation_add (int x, int y);
extern void field_animation ();
extern void field_loop ();
extern void field_hurrysize ();
extern void field_hurrydropitems ();
extern void draw_stone (int x, int y);
extern void stonelist_add (int x, int y);
extern void stonelist_del ();

@ -1,4 +1,4 @@
/* $Id: field.c,v 1.38 2003/07/23 02:10:47 stpohle Exp $ */
/* $Id: field.c,v 1.39 2003/07/27 13:29:25 stpohle Exp $ */
/* field.c - procedures which are needed to control the field */
#include "bomberclone.h"
@ -6,9 +6,15 @@
static _point fieldani[MAX_FIELDANIMATION];
static _point stonelist[MAX_STONESTODRAW]; // keep all stones to draw
static int fieldcheck_to; // timeout for the next fieldcheck FIELDCHECK_TIMEOUT
static int fieldhurry_to;
static _point fieldhurrypos; // x,y for the hurry
static int fieldhurryd; // direction for the hurry
/* delete the stone entry list */
void stonelist_del () {
void
stonelist_del ()
{
register int i;
for (i = 0; i < MAX_STONESTODRAW; i++)
@ -17,7 +23,9 @@ void stonelist_del () {
/* stonelist will be draw and cleaned */
void stonelist_draw () {
void
stonelist_draw ()
{
int i;
for (i = 0; i < MAX_STONESTODRAW && stonelist[i].x != -1 && stonelist[i].y != -1; i++) {
@ -28,12 +36,15 @@ void stonelist_draw () {
/* add stone to draw */
static void _stonelist_add (int x, int y, int recursive) {
static void
_stonelist_add (int x, int y, int recursive)
{
int i;
_point *slentry = NULL;
for (i = 0, slentry = NULL; i < MAX_STONESTODRAW && slentry == NULL; i++)
if (stonelist[i].x == -1 || stonelist[i].y == -1 || (stonelist[i].x == x && stonelist[i].y == y))
if (stonelist[i].x == -1 || stonelist[i].y == -1
|| (stonelist[i].x == x && stonelist[i].y == y))
slentry = &stonelist[i];
if (slentry == NULL) // no space left
@ -47,7 +58,11 @@ static void _stonelist_add (int x, int y, int recursive) {
_stonelist_add (x, y - 1, 0);
}
};
inline void stonelist_add (int x, int y) { _stonelist_add (x, y, 1); };
inline void
stonelist_add (int x, int y)
{
_stonelist_add (x, y, 1);
};
void
@ -143,12 +158,17 @@ draw_stone (int x, int y)
/* if the current field is half hidden by the lower
field (y+1) draw this little part too */
if (y < map.size.y-1 && gfx.field[map.field[x][y+1].type].h > gfx.field[map.field[x][y+1].type].w) {
if (y < map.size.y - 1
&& gfx.field[map.field[x][y + 1].type].h > gfx.field[map.field[x][y + 1].type].w) {
src.x = 0;
src.y = map.field[x][y + 1].frame * gfx.field[map.field[x][y + 1].type].h;
dest.h = src.h = gfx.field[map.field[x][y+1].type].h - gfx.field[map.field[x][y+1].type].w;
dest.h = src.h =
gfx.field[map.field[x][y + 1].type].h - gfx.field[map.field[x][y + 1].type].w;
dest.w = src.w = gfx.field[map.field[x][y + 1].type].w;
dest.y = gfx.offset.y + ((gfx.block.y * (y+1)) - (gfx.field[map.field[x][y+1].type].h - gfx.field[map.field[x][y+1].type].w));
dest.y =
gfx.offset.y + ((gfx.block.y * (y + 1)) -
(gfx.field[map.field[x][y + 1].type].h -
gfx.field[map.field[x][y + 1].type].w));
gfx_blit (gfx.field[map.field[x][y + 1].type].image, &src, gfx.screen, &dest, (y << 8) + 5);
}
@ -189,7 +209,8 @@ field_clear (int x, int y)
void
field_animation ()
{
int i,j;
int i,
j;
_field *stone;
for (i = 0; i < MAX_FIELDANIMATION; i++)
@ -269,3 +290,165 @@ field_animation_add (int x, int y)
fieldani[j].x = x;
fieldani[j].y = y;
};
/* check the field, if everything is empty */
int
field_checkisempty ()
{
register int x,
y;
int empty = 1;
for (x = 1; (x < (map.size.x - 1) && empty); x++)
for (y = 1; (y < (map.size.y - 1) && empty); y++)
if (map.field[x][y].type == FT_stone)
empty = 0;
return empty;
}
/* will check for some gamerelated map informations
check if the map is empty, and so something like a timeout so we won't
end up in a endless game */
void
field_loop ()
{
/* single game or multiplayer master, so check field state */
if (GT_MP_PTPM || bman.gametype == GT_single) {
/* timeout for rechecking every 5 secs the field */
if (map.state == MS_normal && map.map_selection == MAPS_randgen
&& (fieldcheck_to-- > FIELDECHECK_TIMEOUT || fieldcheck_to <= 0)) {
if (field_checkisempty ())
bman.timeout = 0; // set the gametimeout to 0
}
/* gametimeout is 0 and we are still at more normal set randomly a
way to end the game */
if (bman.timeout-- <= 0 && map.state == MS_normal) {
int rndmax;
if (map.map_selection == MAPS_randgen)
rndmax = MS_max - 1; // generaged map
else
rndmax = MS_max - 2; // user defined map
map.state = 1 + s_random (rndmax);
d_printf ("Game Timeout 1 over: Random map.state = %d\n", map.state);
bman.timeout = GAME_TIMEOUTHURRY;
fieldhurrypos.x = fieldhurrypos.y = 0;
}
/* check if we need to small down the map */
if (map.state == MS_hurry)
field_hurrysize ();
if (map.state == MS_dropitems)
field_hurrydropitems ();
}
field_animation ();
};
/* hurrymode drop a item randomly */
void
field_hurrydropitems ()
{
int x = 0,
y = 0,
try = 100;
if (fieldhurry_to-- <= 0 || fieldhurry_to > FIELDHURRYDROPTO) {
fieldhurry_to = FIELDHURRYDROPTO;
while (map.field[x][y].type != FT_nothing && (try--)) {
x = s_random (map.size.x - 2) + 1;
y = s_random (map.size.y - 2) + 1;
}
if (try) {
map.field[x][y].type = s_random (FT_mixed - 2) + 3;
stonelist_add (x, y);
if (GT_MP_PTPM)
net_game_send_field (x, y);
}
}
};
/* hurrymode small down the map */
void
field_hurrysize ()
{
int i;
if (fieldhurry_to-- <= 0 || fieldhurry_to > FIELDHURRYSIZE) {
fieldhurry_to = FIELDHURRYSIZE;
if (fieldhurrypos.x == 0) {
fieldhurrypos.x = fieldhurrypos.y = 1;
fieldhurryd = right;
}
else if (fieldhurrypos.x > 0) {
bman.timeout = GAME_TIMEOUTHURRY-1;
switch (fieldhurryd) {
case (right):
if (fieldhurrypos.x + 1 >= map.size.x - fieldhurrypos.y) {
fieldhurryd = down;
fieldhurrypos.y++;
}
else
fieldhurrypos.x++;
break;
case (down):
if (fieldhurrypos.y >= map.size.y - (map.size.x - fieldhurrypos.x)) {
fieldhurryd = left;
fieldhurrypos.x--;
}
else
fieldhurrypos.y++;
break;
case (left):
if (fieldhurrypos.x <= (map.size.y - fieldhurrypos.y)-1) {
fieldhurryd = up;
fieldhurrypos.y--;
}
else
fieldhurrypos.x--;
break;
default:
if (fieldhurrypos.y-1 <= fieldhurrypos.x) {
/* check if this is the end */
i = map.size.x - (2 * fieldhurrypos.x);
if (i > FIELDHURRYSIZEMIN)
i = map.size.y - (2 * fieldhurrypos.y);
if (i <= FIELDHURRYSIZEMIN)
fieldhurrypos.x = fieldhurrypos.y = -1;
else {
fieldhurryd = right;
fieldhurrypos.x++;
}
}
else
fieldhurrypos.y--;
break;
}
}
/* check if we have finished sizing down everything */
if (fieldhurrypos.x > 0) {
/* set the block on the position */
map.field[fieldhurrypos.x][fieldhurrypos.y].type = FT_block;
stonelist_add (fieldhurrypos.x, fieldhurrypos.y);
if (GT_MP_PTPM)
net_game_send_field (fieldhurrypos.x, fieldhurrypos.y);
}
}
};

@ -1,4 +1,4 @@
/* $Id: font.c,v 1.7 2003/07/25 23:46:25 stpohle Exp $ */
/* $Id: font.c,v 1.8 2003/07/27 13:29:25 stpohle Exp $ */
// Using Fonts in SDL
#include <string.h>

@ -1,4 +1,4 @@
/* $Id: game.c,v 1.45 2003/07/26 02:43:21 stpohle Exp $
/* $Id: game.c,v 1.46 2003/07/27 13:29:25 stpohle Exp $
game.c - procedures for the game. */
#include <string.h>
@ -200,7 +200,7 @@ game_loop ()
/* this will even set the variable "bman.player_nr"
to let us know how much Players are still left */
bomb_loop ();
field_animation ();
field_loop ();
draw_players ();
game_draw_info ();
@ -208,11 +208,12 @@ game_loop ()
and if there the last dieing animation is done */
if ((bman.players_nr < 2
&& (GT_MP_PTP || (bman.gametype == GT_single && bman.ai_players > 0)))
|| (bman.gametype == GT_single && bman.ai_players == 0 && bman.players_nr < 1))
|| (bman.gametype == GT_single && bman.ai_players == 0 && bman.players_nr < 1)
|| (bman.timeout <= 0 && map.state != MS_normal))
gameovertimeout--;
if (gameovertimeout <= 0) {
d_printf ("GAME: Game Over 'Cause only one or none anymore alife\n");
d_printf ("GAME: Game Over\n");
done = 1;
}
@ -278,6 +279,9 @@ game_start ()
tileset_load (map.tileset);
gfx_load_players (gfx.block.x, gfx.block.y);
snd_load (map.tileset);
map.state = MS_normal;
bman.timeout = GAME_TIMEOUT;
};

@ -1,4 +1,4 @@
/* $Id: map.h,v 1.2 2003/07/22 18:29:08 stpohle Exp $ */
/* $Id: map.h,v 1.3 2003/07/27 13:29:25 stpohle Exp $ */
/* map.h */
#ifndef _MAP_H_
@ -40,6 +40,8 @@ struct __map {
unsigned char sp_trigger;
unsigned char sp_push;
unsigned char sp_row;
unsigned char state; // state of the map
} typedef _map;

@ -1,4 +1,4 @@
/* $Id: mapmenu.c,v 1.6 2003/07/22 18:29:08 stpohle Exp $ */
/* $Id: mapmenu.c,v 1.7 2003/07/27 13:29:25 stpohle Exp $ */
/* map/tileset selection menu */
#include "bomberclone.h"
@ -37,7 +37,7 @@ mapmenu ()
while (menuselect != -1) {
switch (map.map_selection) {
case (0): // Selected Map
case (MAPS_select): // Selected Map
if (map.map[0] == 0)
sprintf (menu[1].text, "Selected Map: < undefined >");
else
@ -49,7 +49,7 @@ mapmenu ()
menu[3].text[0] = 0;
menu[3].index = 0;
break;
case (1): // Random Map
case (MAPS_randmap): // Random Map
menu[1].text[0] = 0;
menu[1].index = 0;
sprintf (menu[0].text, "Random Map: random file");
@ -58,7 +58,7 @@ mapmenu ()
menu[3].text[0] = 0;
menu[3].index = 0;
break;
case (2): // Random Generated Map
case (MAPS_randgen): // Random Generated Map
menu[1].text[0] = 0;
menu[1].index = 0;
sprintf (menu[0].text, "Random Map: auto-generated");

@ -235,7 +235,7 @@ host_multiplayer_game ()
init_map_tileset();
net_send_servermode ();
game_start ();
net_new_gamedata ();
net_transmit_gamedata ();
if (bman.state == GS_ready || bman.state == GS_running) {
net_send_servermode ();
@ -274,7 +274,7 @@ join_multiplayer_game ()
game_start ();
bman.state = GS_update;
net_new_game ();
net_new_gamedata ();
net_transmit_gamedata ();
if (bman.state == GS_ready || bman.state == GS_running)
game_loop ();

@ -1,4 +1,4 @@
/* $Id: network.c,v 1.37 2003/07/24 01:47:48 stpohle Exp $ */
/* $Id: network.c,v 1.38 2003/07/27 13:29:25 stpohle Exp $ */
/*
network routines.
*/
@ -391,7 +391,7 @@ net_change_playerid (int pl_nr, unsigned char senddata)
within the network loop
*/
void
net_new_gamedata ()
net_transmit_gamedata ()
{
int done = 0,
keypressed = 0,

@ -73,7 +73,7 @@ extern int network_init ();
extern int network_loop ();
extern void net_change_playerid (int pl_nr, unsigned char senddata);
extern void net_new_game ();
extern void net_new_gamedata ();
extern void net_transmit_gamedata ();
extern void net_game_send_player (int p_nr);
extern void net_game_send_playermove (int p_nr, int mustsend);
extern void net_game_send_bomb (int p, int b);

@ -1,4 +1,4 @@
/* $Id: single.c,v 1.39 2003/07/25 21:44:47 stpohle Exp $ */
/* $Id: single.c,v 1.40 2003/07/27 13:29:25 stpohle Exp $ */
/* single player */
#include "basic.h"
@ -61,7 +61,8 @@ inline int
ai_checkfield (int x, int y)
{
return ((map.field[x][y].type == FT_nothing || map.field[x][y].type == FT_fire
|| map.field[x][y].type == FT_shoe || map.field[x][y].type == FT_bomb)
|| map.field[x][y].type == FT_shoe || map.field[x][y].type == FT_bomb
|| map.field[x][y].type == FT_mixed)
&& map.bfield[x][y] == 0);
}
@ -139,8 +140,7 @@ ai_easyrunaway (_point p)
/* give the run away direction
the return value:
*/
the return value: */
_airunaway
ai_runawayfrom (_point p, int nearbomb, signed char norecursive)
{

Loading…
Cancel
Save