Single Player much more fixed. Teamwork will work next.

origin
stpohle 21 years ago
parent db71d25050
commit 4724128738

@ -1,4 +1,4 @@
/* $Id: basic.h,v 1.26 2004/09/25 10:57:50 stpohle Exp $ */ /* $Id: basic.h,v 1.27 2004/09/26 02:28:05 stpohle Exp $ */
/* basic types which we need everywhere */ /* basic types which we need everywhere */
#ifndef _BC_BASIC_H_ #ifndef _BC_BASIC_H_
@ -35,7 +35,7 @@
#define START_SPEED 0.07 #define START_SPEED 0.07
#define SPEEDMUL 1.2 #define SPEEDMUL 1.2
#define MAX_PLAYERS 8 #define MAX_PLAYERS 16
#define MAX_TEAMS 4 #define MAX_TEAMS 4
#define MAX_BOMBS 12 #define MAX_BOMBS 12
#define MAX_RANGE 10 #define MAX_RANGE 10

@ -1,4 +1,4 @@
/* $Id: bomberclone.h,v 1.28 2004/09/12 20:54:24 stpohle Exp $ */ /* $Id: bomberclone.h,v 1.29 2004/09/26 02:28:05 stpohle Exp $ */
/* bomberclone.h */ /* bomberclone.h */
#ifndef _BOMBERCLONE_H_ #ifndef _BOMBERCLONE_H_
@ -118,6 +118,7 @@ extern void game_loop ();
extern void game_end (); extern void game_end ();
extern void game_start(); extern void game_start();
extern void game_showresult (); extern void game_showresult ();
extern int game_check_endgame ();
extern void game_menu_create (); extern void game_menu_create ();
extern void game_menu_loop (SDL_Event *event, int eventstate); extern void game_menu_loop (SDL_Event *event, int eventstate);
@ -173,6 +174,6 @@ extern void tileset_free ();
// help // help
extern void help (); extern void help (int showpage);
#endif #endif

@ -1,4 +1,4 @@
/* $Id: gfx.h,v 1.7 2004/09/25 10:57:50 stpohle Exp $ */ /* $Id: gfx.h,v 1.8 2004/09/26 02:28:05 stpohle Exp $ */
#ifndef _GFX_H_ #ifndef _GFX_H_
#define _GFX_H_ #define _GFX_H_
@ -10,10 +10,10 @@
#define GFX_PLAYERIMGSIZE_Y 128 #define GFX_PLAYERIMGSIZE_Y 128
#define GFX_SMALLPLAYERIMGSIZE_X 12 #define GFX_SMALLPLAYERIMGSIZE_X 12
#define GFX_MENUPLAYERIMGSIZE_X 32 #define GFX_MENUPLAYERIMGSIZE_X 32
#define GFX_MENUFIELDIMGSIZE 24
#include "basic.h" #include "basic.h"
struct __gfxblit { struct __gfxblit {
SDL_Rect srcr; SDL_Rect srcr;
SDL_Surface *srci; SDL_Surface *srci;

@ -1,4 +1,4 @@
/* $Id: player.h,v 1.4 2004/09/23 14:06:45 stpohle Exp $ /* $Id: player.h,v 1.5 2004/09/26 02:28:05 stpohle Exp $
* playerinclude file * playerinclude file
*/ */
@ -115,6 +115,7 @@ struct __team {
_player *players[MAX_PLAYERS]; _player *players[MAX_PLAYERS];
char name[LEN_PLAYERNAME]; char name[LEN_PLAYERNAME];
int active; int active;
int wins;
} typedef _team; } typedef _team;

@ -106,6 +106,6 @@ void debug_ingameinfo() {
} }
font_gfxdraw (0, gfx.res.y-font[0].size.y*2, text, 0, 0, (map.size.y*256)+10); font_gfxdraw (0, gfx.res.y-font[0].size.y*2, text, 0, 0, (map.size.y*256)+10);
sprintf (text, "Move: %d | %d", players[bman.p_nr].m, players[bman.p2_nr].m); sprintf (text, "Pl_nr: %d TO: %3.2f", bman.players_nr, bman.timeout);
font_gfxdraw (350, gfx.res.y-font[0].size.y, text, 0, 0, (map.size.y*256)+10); font_gfxdraw (350, gfx.res.y-font[0].size.y, text, 0, 0, (map.size.y*256)+10);
}; };

@ -1,4 +1,4 @@
/* $Id: game.c,v 1.92 2004/09/25 11:16:14 stpohle Exp $ /* $Id: game.c,v 1.93 2004/09/26 02:28:06 stpohle Exp $
game.c - procedures for the game. */ game.c - procedures for the game. */
#include <string.h> #include <string.h>
@ -46,8 +46,6 @@ game_draw_info ()
dest.w = gfx.res.x; dest.w = gfx.res.x;
gfx_blitupdaterectadd (&dest); gfx_blitupdaterectadd (&dest);
bman.players_nr = 0;
/* In Multiplayer mode draw Player names and /* In Multiplayer mode draw Player names and
count the players who are still alife. */ count the players who are still alife. */
for (x = 0, j = 0, i = 0; i < MAX_PLAYERS; i++) for (x = 0, j = 0, i = 0; i < MAX_PLAYERS; i++)
@ -72,9 +70,8 @@ game_draw_info ()
else else
col = 3; col = 3;
} }
else { // players is alife else { // player is alife
col = 0; col = 0;
bman.players_nr++;
} }
font_draw (x, j, scrtext, 0, col); font_draw (x, j, scrtext, 0, col);
@ -94,13 +91,13 @@ game_draw_info ()
sprintf (text, "Speed: %1.1f", players[bman.p_nr].speed*10); sprintf (text, "Speed: %1.1f", players[bman.p_nr].speed*10);
font_draw (x, 32, text, 0, 0); font_draw (x, 32, text, 0, 0);
if (players[bman.p_nr].special.type != 0) { if (players[bman.p_nr].special.type != 0) {
col = players[bman.p_nr].special.type + FT_sp_trigger - 1;
dest.x = x - 32; dest.x = x - 32;
dest.y = 16; dest.y = 16;
dest.w = gfx.menu_field[players[bman.p_nr].special.type - 1]->w; dest.w = gfx.menu_field[col]->w;
dest.h = gfx.menu_field[players[bman.p_nr].special.type - 1]->h; dest.h = gfx.menu_field[col]->h;
SDL_BlitSurface (gfx.menu_field[players[bman.p_nr].special.type - 1], NULL, SDL_BlitSurface (gfx.menu_field[col], NULL, gfx.screen, &dest);
gfx.screen, &dest);
} }
if (bman.state == GS_ready && GT_MP_PTPM) if (bman.state == GS_ready && GT_MP_PTPM)
@ -206,7 +203,7 @@ void
game_loop () game_loop ()
{ {
SDL_Event event; SDL_Event event;
int done = 0, i, eventstate; int done = 0, eventstate;
gfx_blitupdaterectclear (); gfx_blitupdaterectclear ();
@ -271,16 +268,8 @@ game_loop ()
/* check if there is only one player left and the game is in multiplayer mode /* check if there is only one player left and the game is in multiplayer mode
and if there the last dieing animation is done */ and if there the last dieing animation is done */
for (i = 0; (i < MAX_PLAYERS && (!PS_IS_used (players[i].state) if (game_check_endgame () && bman.timeout >= 0.0f)
|| PS_IS_aiplayer (players[i].state) bman.timeout = 0.0f;
|| (PS_IS_used (players[i].state) && !PS_IS_alife (players[i].state)))); i++);
if (i == MAX_PLAYERS) /* only AI Players alife, make sure the game is going to an end */
bman.players_nr = 1;
if (((bman.players_nr < 2
&& (GT_MP || (GT_SP && bman.ai_players > 0)))
|| (GT_SP && bman.ai_players == 0 && bman.players_nr < 1))
&& bman.timeout >= 0.0 && (bman.gametype == GT_bomberman || map.state != MS_normal))
bman.timeout = 0.0f;
if ((GT_SP || GT_MP_PTPM) && bman.timeout < -GAME_OVERTIMEOUT) { if ((GT_SP || GT_MP_PTPM) && bman.timeout < -GAME_OVERTIMEOUT) {
d_printf ("GAME: Game Over\n"); d_printf ("GAME: Game Over\n");
@ -312,6 +301,59 @@ game_loop ()
}; };
/*
* check if we only one player left or only ai players are left.
* check also if we there is only one team alife
*/
int game_check_endgame () {
int res = 0;
if (bman.gametype == GT_team) {
/*
* Team Mode Calculation
*/
int t_nr; // teamnumber
int p_nr; // playernumber
int h_team = 0; // how many human teams are alife
int h_team_last = -1; // last human team which was alife
_player *p;
for (t_nr = 0; t_nr < MAX_TEAMS; t_nr++)
for (p_nr = 0; p_nr < MAX_PLAYERS; p_nr++) {
if (teams[t_nr].players[p_nr] != NULL) {
p = teams[t_nr].players[p_nr];
if (PS_IS_used (p->state) && PS_IS_alife (p->state) && (!PS_IS_aiplayer (p->state)) && h_team_last != t_nr) {
h_team++;
h_team_last = t_nr;
}
}
}
if (h_team_last < 1)
res = 1;
}
else if (bman.gametype == GT_bomberman) {
int p_nr; // playernumber
int h_alife = 0; // human players who are alife
int alife = 0; // ai players who are alife
_player *p;
for (p = &players[0], p_nr = 0; p_nr < MAX_PLAYERS; p_nr++, p++) {
if (PS_IS_used (p->state) && PS_IS_alife (p->state)) {
alife++;
if (!PS_IS_aiplayer (p->state))
h_alife++;
}
}
if ((h_alife < 1) || (alife < 2))
res = 1;
}
return res;
};
/* check which player won and free all unnneded data */ /* check which player won and free all unnneded data */
void void
game_end () game_end ()
@ -415,21 +457,105 @@ game_start ()
}; };
/* show result of the game */ /*
* Show results of the game
* show the diffrent screens one for players and one for teams
*/
/* Teamplay */
static void game_showresultteam () {
}
#define SHOWRESULT_WIDTH 150
#define SHOWRESULT_HEIGHT 80
/* Bomberman/Deathmatch Version Play */
static void game_showresultnormal () {
char text[255];
int i, p, x, y, pl_cnt = 0,
pl_x, pl_y, // player in a row/col
dx, dy, // distance
sx, sy, px; // start view and position
SDL_Rect dest, src;
_player *pl[MAX_PLAYERS];
/* Sort the playerlist */
for (p = 0, pl_cnt = 0; p < MAX_PLAYERS; p++)
if (PS_IS_used (players[p].state)) {
pl[pl_cnt] = &players[p];
i = pl_cnt;
while (i > 0 && pl[i-1]->wins < players[p].wins) {
pl[i] = pl[i-1];
i--;
pl[i] = &players[p];
}
pl_cnt++;
}
/* calc the best view and start point */
pl_x = 0;
do {
pl_x++;
pl_y = ceil ((float)(((float) pl_cnt) / ((float)pl_x)));
dy = (gfx.res.y - 100) / pl_y;
} while (dy < SHOWRESULT_HEIGHT);
dx = (gfx.res.x - 40) / pl_x;
x = sx = 20 + (dx - SHOWRESULT_WIDTH)/2;
y = sy = 60 + (dy - SHOWRESULT_HEIGHT)/2;
px = 0;
d_printf ("game_showresultnormal: pl_x:%d, pl_y:%d, dx:%d, dy:%d\n", pl_x, pl_y, dx, dy);
/* draw the playerlist */
for (i = 1, p = 0; p < pl_cnt; p++) {
if (PS_IS_used (pl[p]->state)) {
if (PS_IS_alife (pl[p]->state)) {
font_drawbold (x + GFX_MENUPLAYERIMGSIZE_X, y - 10, pl[p]->name, 0, COLOR_brown, 1);
font_draw (x + GFX_MENUPLAYERIMGSIZE_X, y - 10, pl[p]->name, 0, COLOR_yellow);
}
else
font_draw (x + GFX_MENUPLAYERIMGSIZE_X, y - 10, pl[p]->name, 0, COLOR_gray);
sprintf (text, "%3d (%3d)", pl[p]->wins, pl[p]->points);
font_draw (x + GFX_MENUPLAYERIMGSIZE_X, y + 6, text, 0, 0);
dest.x = x;
dest.y = y - 16;
src.w = dest.w = pl[p]->gfx->menu_image->w;
src.h = dest.h = pl[p]->gfx->menu_image->h;
src.x = 0;
src.y = 0;
gfx_blit (pl[p]->gfx->menu_image, &src, gfx.screen, &dest, 1);
/* setup the new position */
y += (dy / pl_x);
x += dx;
px++;
if (px >= pl_x) {
px = 0;
x = sx;
}
}
}
}
#undef SHOWRESULT_HEIGHT
#undef SHOWRESULT_WIDTH
void game_showresult () { void game_showresult () {
SDL_Rect dest,
src;
char text[255]; char text[255];
SDL_Event event; SDL_Event event;
Uint8 *keys; Uint8 *keys;
int done = 0, keypressed = 0, x, y, i, p; int done = 0, keypressed = 0, x, y;
menu_displaytext ("Loading..", "Please Wait"); gfx_blitdraw ();
dest.x = dest.y = 0;
dest.w = gfx.res.x;
dest.h = gfx.res.y;
draw_logo (); draw_logo ();
strcpy (text, "Game Result"); strcpy (text, "Game Result");
x = (gfx.res.x - (font[2].size.x * strlen (text)) - 64) / 2; x = (gfx.res.x - (font[2].size.x * strlen (text)) - 64) / 2;
y = 0; y = 0;
@ -437,20 +563,6 @@ void game_showresult () {
font_draw (x, y, text, 2, 5); font_draw (x, y, text, 2, 5);
y += font[2].size.x; y += font[2].size.x;
for (i = 0, p = 0; p < MAX_PLAYERS; p++)
if (PS_IS_alife (players[p].state))
i++;
if (i == 1)
strcpy (text, "Game Over");
else
strcpy (text, "Draw Game");
x = (gfx.res.x - (font[2].size.x * strlen (text)) - 64) / 2;
font_drawbold (x, y, text, 2, 6, 2);
font_draw (x, y, text, 2, 5);
y += font[2].size.x + 8;
strcpy (text, "[CTRL],[RETURN] or [STRG] for another game"); strcpy (text, "[CTRL],[RETURN] or [STRG] for another game");
x = (gfx.res.x - (font[1].size.x * strlen (text)) - 64) / 2; x = (gfx.res.x - (font[1].size.x * strlen (text)) - 64) / 2;
font_drawbold (x, gfx.res.y - (2*font[0].size.y) - 2, text, 0, COLOR_brown, 1); font_drawbold (x, gfx.res.y - (2*font[0].size.y) - 2, text, 0, COLOR_brown, 1);
@ -461,39 +573,10 @@ void game_showresult () {
font_drawbold (x, gfx.res.y - font[0].size.y - 2, text, 0, COLOR_brown, 1); font_drawbold (x, gfx.res.y - font[0].size.y - 2, text, 0, COLOR_brown, 1);
font_draw (x, gfx.res.y - font[0].size.y - 2, text, 0, COLOR_yellow); font_draw (x, gfx.res.y - font[0].size.y - 2, text, 0, COLOR_yellow);
for (i = 1, p = 0; p < MAX_PLAYERS; p++) { if (bman.gametype == GT_team)
if (PS_IS_used (players[p].state)) { game_showresultteam ();
if (!i) { else
i = 1; game_showresultnormal ();
x = (gfx.res.x / 2) + 16;
}
else if (i) {
i = 0;
y = y + 80;
x = 16;
}
if (PS_IS_alife (players[p].state)) {
font_drawbold (x + 80, y + 4, players[p].name, 0, COLOR_brown, 1);
font_draw (x + 80, y + 4, players[p].name, 0, COLOR_yellow);
}
else
font_draw (x + 80, y + 4, players[p].name, 0, COLOR_gray);
sprintf (text, "%3d", players[p].wins);
font_draw (x + 80 + (LEN_PLAYERNAME+2) * font[0].size.x, y + 4, text, 0, 0);
sprintf (text, "%3d", players[p].points);
font_draw (x + 80 + (LEN_PLAYERNAME+5) * font[0].size.x, y + 4, text, 0, 0);
dest.x = x;
dest.y = y - 32;
src.w = dest.w = players[p].gfx->menu_image->w;
src.h = dest.h = players[p].gfx->menu_image->h;
src.x = 0;
src.y = 0;
gfx_blit (players[p].gfx->menu_image, &src, gfx.screen, &dest, 1);
}
}
gfx_blitdraw (); gfx_blitdraw ();
SDL_Flip (gfx.screen); SDL_Flip (gfx.screen);

@ -1,4 +1,4 @@
/* $Id: gfx.c,v 1.37 2004/09/25 10:57:51 stpohle Exp $ */ /* $Id: gfx.c,v 1.38 2004/09/26 02:28:06 stpohle Exp $ */
/* gfx.c */ /* gfx.c */
#include "bomberclone.h" #include "bomberclone.h"
@ -371,7 +371,7 @@ static void gfx_load_fieldtype_menu () {
tmpimg = gfx_copyfrom (orgimg, &rect); tmpimg = gfx_copyfrom (orgimg, &rect);
SDL_FreeSurface (orgimg); SDL_FreeSurface (orgimg);
orgimg = scale_image (tmpimg, GFX_IMGSIZE/2, GFX_IMGSIZE/2); orgimg = scale_image (tmpimg, GFX_MENUFIELDIMGSIZE, GFX_MENUFIELDIMGSIZE);
SDL_FreeSurface (tmpimg); SDL_FreeSurface (tmpimg);
background = SDL_DisplayFormat (orgimg); background = SDL_DisplayFormat (orgimg);
SDL_FreeSurface (orgimg); SDL_FreeSurface (orgimg);
@ -388,7 +388,7 @@ static void gfx_load_fieldtype_menu () {
tmpimg = gfx_copyfrom (orgimg, &rect); tmpimg = gfx_copyfrom (orgimg, &rect);
SDL_FreeSurface (orgimg); SDL_FreeSurface (orgimg);
orgimg = scale_image (tmpimg, GFX_IMGSIZE/2, GFX_IMGSIZE/2); orgimg = scale_image (tmpimg, GFX_MENUFIELDIMGSIZE, GFX_MENUFIELDIMGSIZE);
SDL_FreeSurface (tmpimg); SDL_FreeSurface (tmpimg);
background = SDL_DisplayFormat (orgimg); background = SDL_DisplayFormat (orgimg);
SDL_FreeSurface (orgimg); SDL_FreeSurface (orgimg);
@ -405,7 +405,7 @@ static void gfx_load_fieldtype_menu () {
tmpimg = gfx_copyfrom (orgimg, &rect); tmpimg = gfx_copyfrom (orgimg, &rect);
SDL_FreeSurface (orgimg); SDL_FreeSurface (orgimg);
orgimg = scale_image (tmpimg, GFX_IMGSIZE/2, GFX_IMGSIZE/2); orgimg = scale_image (tmpimg, GFX_MENUFIELDIMGSIZE, GFX_MENUFIELDIMGSIZE);
SDL_FreeSurface (tmpimg); SDL_FreeSurface (tmpimg);
background = SDL_DisplayFormat (orgimg); background = SDL_DisplayFormat (orgimg);
SDL_FreeSurface (orgimg); SDL_FreeSurface (orgimg);
@ -422,7 +422,7 @@ static void gfx_load_fieldtype_menu () {
tmpimg = gfx_copyfrom (orgimg, &rect); tmpimg = gfx_copyfrom (orgimg, &rect);
SDL_FreeSurface (orgimg); SDL_FreeSurface (orgimg);
orgimg = scale_image (tmpimg, GFX_IMGSIZE/2, GFX_IMGSIZE/2); orgimg = scale_image (tmpimg, GFX_MENUFIELDIMGSIZE, GFX_MENUFIELDIMGSIZE);
SDL_FreeSurface (tmpimg); SDL_FreeSurface (tmpimg);
background = SDL_DisplayFormat (orgimg); background = SDL_DisplayFormat (orgimg);
SDL_FreeSurface (orgimg); SDL_FreeSurface (orgimg);
@ -431,7 +431,7 @@ static void gfx_load_fieldtype_menu () {
/* /*
* load fieldgfx for the menu * load fieldgfx for the menu
*/ */
gfx.menu_field[ft] = gfx_copyfrom (background, &rect); gfx.menu_field[ft] = gfx_copyfrom (background, NULL);
sprintf (filename, "%s/tileset/default/%s.png", bman.datapath, ft_filenames[ft]); sprintf (filename, "%s/tileset/default/%s.png", bman.datapath, ft_filenames[ft]);
orgimg = IMG_Load (filename); orgimg = IMG_Load (filename);
@ -442,7 +442,7 @@ static void gfx_load_fieldtype_menu () {
tmpimg = gfx_copyfrom (orgimg, &rect); tmpimg = gfx_copyfrom (orgimg, &rect);
SDL_FreeSurface (orgimg); SDL_FreeSurface (orgimg);
orgimg = scale_image (tmpimg, GFX_IMGSIZE/2, GFX_IMGSIZE/2); orgimg = scale_image (tmpimg, GFX_MENUFIELDIMGSIZE, GFX_MENUFIELDIMGSIZE);
SDL_FreeSurface (tmpimg); SDL_FreeSurface (tmpimg);
getRGBpixel (orgimg, 0, 0, &r, &g, &b); getRGBpixel (orgimg, 0, 0, &r, &g, &b);
SDL_SetColorKey (orgimg, SDL_SRCCOLORKEY, SDL_MapRGB (orgimg->format, r, g, b)); SDL_SetColorKey (orgimg, SDL_SRCCOLORKEY, SDL_MapRGB (orgimg->format, r, g, b));

@ -1,4 +1,4 @@
/* $Id: gfxpixelimage.c,v 1.11 2004/09/25 10:57:51 stpohle Exp $ */ /* $Id: gfxpixelimage.c,v 1.12 2004/09/26 02:28:06 stpohle Exp $ */
/* gfx pixel manipulation and image manipulation */ /* gfx pixel manipulation and image manipulation */
#include "bomberclone.h" #include "bomberclone.h"
@ -486,19 +486,31 @@ gfx_quater_image (SDL_Surface * org1, SDL_Surface * org2, SDL_Surface * org3, SD
/* /*
* part of a surface from one to another with the same format * part of a surface from one to another with the same format
* if rect = NULL, copy the whole image
*/ */
SDL_Surface *gfx_copyfrom (SDL_Surface *img, SDL_Rect *wnd) { SDL_Surface *gfx_copyfrom (SDL_Surface *img, SDL_Rect *rect) {
SDL_Surface *res; SDL_Surface *res;
SDL_Rect dest; SDL_Rect src, dest;
if (rect == NULL) {
src.x = 0;
src.y = 0;
src.h = img->h;
src.w = img->w;
}
else
src = *rect;
res = res =
SDL_CreateRGBSurface (SDL_HWSURFACE, wnd->w, wnd->h, img->format->BitsPerPixel, SDL_CreateRGBSurface (SDL_HWSURFACE, src.w, src.h, img->format->BitsPerPixel,
img->format->Rmask, img->format->Gmask, img->format->Rmask, img->format->Gmask,
img->format->Bmask, img->format->Amask); img->format->Bmask, img->format->Amask);
dest.x = 0; dest.x = 0;
dest.y = 0; dest.y = 0;
dest.w = wnd->w; dest.w = src.w;
dest.h = wnd->h; dest.h = src.h;
SDL_BlitSurface (img, wnd, res, &dest); SDL_BlitSurface (img, &src, res, &dest);
return res; return res;
}; };

@ -1,4 +1,4 @@
/* $Id: help.c,v 1.12 2004/08/30 20:48:36 stpohle Exp $ /* $Id: help.c,v 1.13 2004/09/26 02:28:06 stpohle Exp $
* Display complex help text and information screen about the game * Display complex help text and information screen about the game
*/ */
@ -18,15 +18,18 @@ enum _help_page {
}; };
void help () { /*
int page = 0, menuselect = 2, y = 0; * show the manual pages
*/
void help (int showpage) {
int page = showpage, menuselect = 2, y = 0;
char title[255]; char title[255];
SDL_Rect rect;
_menu *menu; _menu *menu;
menu_displaytext ("Please Wait", "Loading GFX Data"); menu_displaytext ("Please Wait", "Loading GFX Data");
tileset_load ("default", 32, 32);
gfx_load_players (gfx.block.x, gfx.block.y); if (page < 0 || page >= HP_max)
page = 0;
while (menuselect != -1 && menuselect != 1 && bman.state != GS_quit) { while (menuselect != -1 && menuselect != 1 && bman.state != GS_quit) {
if (page == HP_howto0) { if (page == HP_howto0) {
@ -42,11 +45,7 @@ void help () {
"running faster than your opponent and you have many bombs, you can catch " "running faster than your opponent and you have many bombs, you can catch "
"him within lots of bombs and he has no chance to escape."); "him within lots of bombs and he has no chance to escape.");
rect.x = 0; menu_create_image (menu, "img", 450, 255, 0, gfx.players[0].menu_image, NULL);
rect.y = 15*gfx.players[0].ani.h;
rect.w = gfx.players[0].ani.w;
rect.h = gfx.players[0].ani.h;
menu_create_image (menu, "img", 450, 255, 0, gfx.players[0].ani.image, &rect);
menu_create_text (menu, "help", 5, 255, 45, 10, COLOR_brown, menu_create_text (menu, "help", 5, 255, 45, 10, COLOR_brown,
"You will get points for every player you have killed. " "You will get points for every player you have killed. "
@ -59,11 +58,6 @@ void help () {
y = 50; y = 50;
rect.x = rect.y = 0;
rect.w = gfx.block.x;
rect.h = gfx.block.y;
menu_create_text (menu, "help", 5, y, 53, 10, COLOR_brown, menu_create_text (menu, "help", 5, y, 53, 10, COLOR_brown,
"In the game you will find some diffend kind of powerups. " "In the game you will find some diffend kind of powerups. "
"There are the powerups who give you more power for the whole game " "There are the powerups who give you more power for the whole game "
@ -73,20 +67,17 @@ void help () {
menu_create_label (menu, "Permanent Powerups", -1, y, 2, COLOR_yellow); menu_create_label (menu, "Permanent Powerups", -1, y, 2, COLOR_yellow);
y += (5 + font[2].size.y); y += (5 + font[2].size.y);
menu_create_image (menu, "pwback", 5, y, 0, gfx.powerup[0].image, &rect); menu_create_image (menu, "bomb", 5, y, 0, gfx.menu_field[FT_bomb], NULL);
menu_create_image (menu, "bomb", 5, y, 1, gfx.field[FT_bomb].image, &rect);
menu_create_text (menu, "help", 55, y, 45, 10, COLOR_brown, menu_create_text (menu, "help", 55, y, 45, 10, COLOR_brown,
"Give you another bomb to drop. Maximum number of bombs is %d.", MAX_BOMBS); "Give you another bomb to drop. Maximum number of bombs is %d.", MAX_BOMBS);
y += 40; y += 40;
menu_create_image (menu, "pwback", 5, y, 0, gfx.powerup[0].image, &rect); menu_create_image (menu, "fire", 5, y, 1, gfx.menu_field[FT_fire], NULL);
menu_create_image (menu, "fire", 5, y, 1, gfx.field[FT_fire].image, &rect);
menu_create_text (menu, "help", 55, y, 45, 10, COLOR_brown, menu_create_text (menu, "help", 55, y, 45, 10, COLOR_brown,
"The range of your bombs will be increased. Maximum range is %d.", MAX_RANGE); "The range of your bombs will be increased. Maximum range is %d.", MAX_RANGE);
y += 40; y += 40;
menu_create_image (menu, "pwback", 5, y, 0, gfx.powerup[0].image, &rect); menu_create_image (menu, "shoe", 5, y, 1, gfx.menu_field[FT_shoe], NULL);
menu_create_image (menu, "shoe", 5, y, 1, gfx.field[FT_shoe].image, &rect);
menu_create_text (menu, "help", 55, y, 45, 10, COLOR_brown, menu_create_text (menu, "help", 55, y, 45, 10, COLOR_brown,
"This will make your player run faster. The maximum speed will be %1.2f.", MAX_SPEED); "This will make your player run faster. The maximum speed will be %1.2f.", MAX_SPEED);
y += 40; y += 40;
@ -104,47 +95,37 @@ void help () {
y = 45; y = 45;
rect.x = rect.y = 0;
rect.w = gfx.block.x;
rect.h = gfx.block.y;
menu_create_label (menu, "Special Powerups", -1, y, 2, COLOR_yellow); menu_create_label (menu, "Special Powerups", -1, y, 2, COLOR_yellow);
y += (5 + font[2].size.y); y += (5 + font[2].size.y);
menu_create_image (menu, "pwback", 5, y, 0, gfx.powerup[2].image, &rect); menu_create_image (menu, "kick", 5, y, 1, gfx.menu_field[FT_sp_kick], NULL);
menu_create_image (menu, "kick", 5, y, 1, gfx.field[FT_sp_kick].image, &rect);
menu_create_text (menu, "help", 55, y, 48, 10, COLOR_brown, menu_create_text (menu, "help", 55, y, 48, 10, COLOR_brown,
"Allowes you to kick some bombs around the level. This will hold " "Allowes you to kick some bombs around the level. This will hold "
"just a short time of %d seconds. The maximum distance you can " "just a short time of %d seconds. The maximum distance you can "
"kick the bombs is %d fields.", SPECIAL_KICK_TIME, SPECIAL_KICK_MAXDIST); "kick the bombs is %d fields.", SPECIAL_KICK_TIME, SPECIAL_KICK_MAXDIST);
y += 70; y += 70;
menu_create_image (menu, "pwback", 5, y, 0, gfx.powerup[2].image, &rect); menu_create_image (menu, "push", 5, y, 1, gfx.menu_field[FT_sp_push], NULL);
menu_create_image (menu, "push", 5, y, 1, gfx.field[FT_sp_push].image, &rect);
menu_create_text (menu, "help", 55, y, 48, 10, COLOR_brown, menu_create_text (menu, "help", 55, y, 48, 10, COLOR_brown,
"Push bombs one field, as long as nothing is behind this bomb."); "Push bombs one field, as long as nothing is behind this bomb.");
y += 40; y += 40;
menu_create_image (menu, "pwback", 5, y, 0, gfx.powerup[2].image, &rect); menu_create_image (menu, "droprow", 5, y, 1, gfx.menu_field[FT_sp_row], NULL);
menu_create_image (menu, "droprow", 5, y, 1, gfx.field[FT_sp_row].image, &rect);
menu_create_text (menu, "help", 55, y, 48, 10, COLOR_brown, menu_create_text (menu, "help", 55, y, 48, 10, COLOR_brown,
"You can drop a row of that many bombs you have still left to drop."); "You can drop a row of that many bombs you have still left to drop.");
y += 40; y += 40;
menu_create_image (menu, "pwback", 5, y, 0, gfx.powerup[2].image, &rect); menu_create_image (menu, "dropliquid", 5, y, 1, gfx.menu_field[FT_sp_liquid], NULL);
menu_create_image (menu, "dropliquid", 5, y, 1, gfx.field[FT_sp_liquid].image, &rect);
menu_create_text (menu, "help", 55, y, 48, 10, COLOR_brown, menu_create_text (menu, "help", 55, y, 48, 10, COLOR_brown,
"The bomb you push now won't stop moving untill they explode."); "The bomb you push now won't stop moving untill they explode.");
y += 40; y += 40;
menu_create_image (menu, "pwback", 5, y, 0, gfx.powerup[2].image, &rect); menu_create_image (menu, "dropliquid", 5, y, 1, gfx.menu_field[FT_sp_moved], NULL);
menu_create_image (menu, "dropliquid", 5, y, 1, gfx.field[FT_sp_moved].image, &rect);
menu_create_text (menu, "help", 55, y, 45, 10, COLOR_brown, menu_create_text (menu, "help", 55, y, 45, 10, COLOR_brown,
"The bomb you push will stop moving on the next border or bomb."); "The bomb you push will stop moving on the next border or bomb.");
y += 40; y += 40;
menu_create_image (menu, "pwback", 5, y, 0, gfx.powerup[2].image, &rect); menu_create_image (menu, "dropltrigger", 5, y, 1, gfx.menu_field[FT_sp_trigger], NULL);
menu_create_image (menu, "dropltrigger", 5, y, 1, gfx.field[FT_sp_trigger].image, &rect);
menu_create_text (menu, "help", 55, y, 45, 10, COLOR_brown, menu_create_text (menu, "help", 55, y, 45, 10, COLOR_brown,
"You will be able to drop triggered bombs. Use " "You will be able to drop triggered bombs. Use "
"the special key to let all your bombs explode. " "the special key to let all your bombs explode. "
@ -157,10 +138,6 @@ void help () {
y = 45; y = 45;
rect.x = rect.y = 0;
rect.w = gfx.block.x;
rect.h = gfx.block.y;
menu_create_label (menu, "Death Item", -1, y, 2, COLOR_yellow); menu_create_label (menu, "Death Item", -1, y, 2, COLOR_yellow);
y += (5 + font[2].size.y); y += (5 + font[2].size.y);
@ -172,8 +149,7 @@ void help () {
"get all the illnesses you have too.", ILL_TIMEOUT); "get all the illnesses you have too.", ILL_TIMEOUT);
y += 110; y += 110;
menu_create_image (menu, "pwback", 12, y+8, 0, gfx.powerup[1].image, &rect); menu_create_image (menu, "pwdeath", 12, y+8, 1, gfx.menu_field[FT_death], NULL);
menu_create_image (menu, "pwdeath", 12, y+8, 1, gfx.field[FT_death].image, &rect);
menu_create_text (menu, "help", 55, y, 45, 10, COLOR_brown, menu_create_text (menu, "help", 55, y, 45, 10, COLOR_brown,
"This will make your player ill. We have at the moment %d diffrent " "This will make your player ill. We have at the moment %d diffrent "
"types of illnesses for you to collect. To make the game more", PI_max); "types of illnesses for you to collect. To make the game more", PI_max);
@ -190,11 +166,7 @@ void help () {
menu_create_label (menu, "During a Game", -1, y, 2, COLOR_yellow); menu_create_label (menu, "During a Game", -1, y, 2, COLOR_yellow);
y += font[2].size.y; y += font[2].size.y;
rect.x = 3*gfx.players[7].ani.w; menu_create_image (menu, "img", 450, 100, 0, gfx.players[7].menu_image, NULL);
rect.y = 10*gfx.players[7].ani.h;
rect.h = gfx.players[7].ani.h;
rect.w = gfx.players[7].ani.w;
menu_create_image (menu, "img", 450, 100, 0, gfx.players[7].ani.image, &rect);
menu_create_text (menu, "help", 5, y, 53, 10, COLOR_brown, menu_create_text (menu, "help", 5, y, 53, 10, COLOR_brown,
"Arrow Keys - Moving of the Player\n" "Arrow Keys - Moving of the Player\n"
@ -223,11 +195,7 @@ void help () {
sprintf (title, "About BomberClone (%d/%d)", page + 1, HP_max); sprintf (title, "About BomberClone (%d/%d)", page + 1, HP_max);
menu = menu_new (title, 500, 400); menu = menu_new (title, 500, 400);
rect.x = 1*gfx.players[4].ani.w; menu_create_image (menu, "img", 15, 60, 0, gfx.players[4].menu_image, NULL);
rect.y = 5*gfx.players[4].ani.h;
rect.h = gfx.players[4].ani.h;
rect.w = gfx.players[4].ani.w;
menu_create_image (menu, "img", 15, 60, 0, gfx.players[4].ani.image, &rect);
menu_create_text (menu, "help", 75, 50, 45, 10, COLOR_brown, menu_create_text (menu, "help", 75, 50, 45, 10, COLOR_brown,
"If you have any problems or questions with the game you can send your questions " "If you have any problems or questions with the game you can send your questions "
"to the mailinglist or directly to me. Bugfixes should be send to the SourceForge " "to the mailinglist or directly to me. Bugfixes should be send to the SourceForge "
@ -246,11 +214,7 @@ void help () {
sprintf (title, "People (%d/%d)", page + 1, HP_max); sprintf (title, "People (%d/%d)", page + 1, HP_max);
menu = menu_new (title, 500, 400); menu = menu_new (title, 500, 400);
rect.x = 3*gfx.players[6].ani.w; menu_create_image (menu, "img", 250, 100, 0, gfx.players[6].menu_image, NULL);
rect.y = 10*gfx.players[6].ani.h;
rect.h = gfx.players[6].ani.h;
rect.w = gfx.players[6].ani.w;
menu_create_image (menu, "img", 250, 100, 0, gfx.players[6].ani.image, &rect);
y = 50; y = 50;
menu_create_label (menu, "Coding:", 5, y, 2, COLOR_yellow); menu_create_label (menu, "Coding:", 5, y, 2, COLOR_yellow);
@ -301,6 +265,4 @@ void help () {
page++; page++;
menu_delete (menu); menu_delete (menu);
} }
gfx_free_players ();
tileset_free ();
}; };

@ -1,4 +1,4 @@
/* $Id: main.c,v 1.28 2004/09/25 10:57:51 stpohle Exp $ */ /* $Id: main.c,v 1.29 2004/09/26 02:28:06 stpohle Exp $ */
#include "basic.h" #include "basic.h"
#include "bomberclone.h" #include "bomberclone.h"
@ -57,7 +57,7 @@ main (int argc, char **argv)
config_menu (); config_menu ();
break; break;
case (3) : // Manual case (3) : // Manual
help (); help (0);
break; break;
case (4) : // Quit case (4) : // Quit
bman.state = GS_quit; bman.state = GS_quit;

@ -1,4 +1,4 @@
/* $Id: menuimages.c,v 1.2 2004/05/20 16:55:30 stpohle Exp $ /* $Id: menuimages.c,v 1.3 2004/09/26 02:28:06 stpohle Exp $
* Menuhandling: labels */ * Menuhandling: labels */
#include "basic.h" #include "basic.h"
@ -48,7 +48,15 @@ _menuitem *menu_create_image (_menu *menu, char *name, int x, int y, int layer,
menuitems->pos.w = layer; menuitems->pos.w = layer;
menuitems->type = MENU_image; menuitems->type = MENU_image;
menuitems->ptrdata = (char *) img; menuitems->ptrdata = (char *) img;
menuitems->rect = *rect;
if (rect == NULL) {
menuitems->rect.x = 0;
menuitems->rect.y = 0;
menuitems->rect.w = img->w;
menuitems->rect.h = img->h;
} else
menuitems->rect = *rect;
strncpy (menuitems->label, name, MENU_TITLELEN); strncpy (menuitems->label, name, MENU_TITLELEN);
return menuitems; return menuitems;

@ -1,4 +1,4 @@
/* $Id: playermenu.c,v 1.7 2004/09/25 10:57:51 stpohle Exp $ /* $Id: playermenu.c,v 1.8 2004/09/26 02:28:06 stpohle Exp $
* *
*/ */
@ -17,6 +17,8 @@
*/ */
// static int playermenu_gfxaviable (int gfx); // static int playermenu_gfxaviable (int gfx);
static void playermenu_selgfx_drawplayer (int selgfx, _menu *menu); static void playermenu_selgfx_drawplayer (int selgfx, _menu *menu);
static void teammenu_ai_choosegfx ();
#define PLAYERMENU_GFXSEL_Y 130 #define PLAYERMENU_GFXSEL_Y 130
@ -471,6 +473,8 @@ void teammenu () {
last_id = menu->focus->id; last_id = menu->focus->id;
} while ((done == 0 || menu->focus->id != 0) && done != -1); } while ((done == 0 || menu->focus->id != 0) && done != -1);
menu_delete (menu); menu_delete (menu);
teammenu_ai_choosegfx ();
} }
@ -605,3 +609,49 @@ static void teammenu_set_selteam (_menu *menu, struct __teammenu *tm, int teamnr
tm->teamlist->changed = 1; tm->teamlist->changed = 1;
menu_draw_menuitem (tm->teamlist); menu_draw_menuitem (tm->teamlist);
}; };
/*
* the ai player will choose diffrent gfx for every
* team another gfx, but not one which is selected by
* human player.
*/
static void teammenu_ai_choosegfx () {
struct _team_tmpdata_ {
// int ai_player;
// int hu_player;
int ai_gfx;
} teamdat[MAX_TEAMS];
int tm_nr;
int pl_nr;
int i, used;
_player *pl;
/* find a ai player gfx for every team */
for (i = 0, tm_nr = 0; (i < gfx.player_gfx_count && tm_nr < MAX_TEAMS); i++) {
used = 0;
for (pl_nr = 0; pl_nr < MAX_PLAYERS; pl_nr++) {
if ((!PS_IS_aiplayer(players[pl_nr].state))
&& (PS_IS_used (players[pl_nr].state))
&& i == players[pl_nr].gfx_nr)
used = 1;
}
if (!used && tm_nr < MAX_TEAMS) {
teamdat[tm_nr].ai_gfx = i;
tm_nr++;
}
}
/*
* give all ai players in the teams the right gfx
*/
for (tm_nr = 0; tm_nr < MAX_TEAMS; tm_nr++) for (pl_nr = 0; pl_nr < MAX_PLAYERS; pl_nr++) {
pl = teams[tm_nr].players[pl_nr];
if (pl) {
if (PS_IS_used(pl->state) && PS_IS_aiplayer(pl->state))
player_set_gfx (pl, teamdat[tm_nr].ai_gfx);
}
}
};

@ -1,4 +1,4 @@
/* $Id: single.c,v 1.71 2004/09/25 10:57:51 stpohle Exp $ */ /* $Id: single.c,v 1.72 2004/09/26 02:28:06 stpohle Exp $ */
/* single player */ /* single player */
#include "basic.h" #include "basic.h"
@ -559,6 +559,7 @@ single_create_ai (int num_players)
{ {
int p, int p,
count, count,
try,
gfx_sel, gfx_sel,
i = 0; i = 0;
_player *pl; _player *pl;
@ -573,10 +574,12 @@ single_create_ai (int num_players)
pl->net.flags = NETF_firewall; pl->net.flags = NETF_firewall;
sprintf (pl->net.addr.host, "localhost"); sprintf (pl->net.addr.host, "localhost");
sprintf (pl->net.addr.port, "11000"); sprintf (pl->net.addr.port, "11000");
try = 0;
do { do {
gfx_sel = s_random (MAX_PLAYERS); gfx_sel = s_random (gfx.player_gfx_count);
MW_IS_GFX_SELECT (gfx_sel, i); MW_IS_GFX_SELECT (gfx_sel, i);
} while (i != -1); try++;
} while (try < 100 && i != -1);
player_set_gfx (pl, gfx_sel); player_set_gfx (pl, gfx_sel);
pl->wins = 0; pl->wins = 0;
pl->points = 0; pl->points = 0;
@ -641,6 +644,10 @@ single_playergame (int second_player, int ai_players)
return; return;
single_create_ai (ai_players); single_create_ai (ai_players);
if (bman.gametype == GT_team)
teammenu ();
bman.state = GS_ready; bman.state = GS_ready;
while (!done && bman.state != GS_quit && bman.state != GS_startup) { while (!done && bman.state != GS_quit && bman.state != GS_startup) {
@ -771,8 +778,8 @@ single_menu ()
menu_create_bool (menu, "Use Second Player", 160, 90, 210, &second_player, 5); menu_create_bool (menu, "Use Second Player", 160, 90, 210, &second_player, 5);
menu_create_button (menu, "Map Options", 180, 160, 150, 7); menu_create_button (menu, "Game Options", 180, 130, 150, 6);
menu_create_button (menu, "Map Options", 180, 170, 150, 7);
menu_create_button (menu, "Main Menu", 30, 220, 150, 1); menu_create_button (menu, "Main Menu", 30, 220, 150, 1);
menu_create_button (menu, "Start", 220, 220, 150, 2); menu_create_button (menu, "Start", 220, 220, 150, 2);
@ -799,6 +806,11 @@ single_menu ()
done = menu_event_loop (menu, &event, eventstate); done = menu_event_loop (menu, &event, eventstate);
if (done > 0 && menu->focus->id == 6) {
done = 0;
mapgamesetting ();
}
if (done > 0 && menu->focus->id == 7) { if (done > 0 && menu->focus->id == 7) {
done = 0; done = 0;
mapmenu (); mapmenu ();

@ -1,4 +1,4 @@
/* $Id: tileset.c,v 1.15 2004/09/25 10:57:51 stpohle Exp $ */ /* $Id: tileset.c,v 1.16 2004/09/26 02:28:07 stpohle Exp $ */
/* load and select tilesets */ /* load and select tilesets */
#include "bomberclone.h" #include "bomberclone.h"
@ -11,8 +11,8 @@ const char *ft_filenames[] = {
"block", "block",
"tunnel" , "tunnel" ,
"pwdeath", "pwdeath",
"pwbomb",
"pwfire", "pwfire",
"pwbomb",
"pwshoe", "pwshoe",
NULL, NULL,
"sptrigger", "sptrigger",

Loading…
Cancel
Save