bugfix with more as 8 different playergraphics. Dedicated server mode removed

origin
stpohle 21 years ago
parent a98791b800
commit 473a92c692

@ -1,4 +1,13 @@
$Id: ChangeLog,v 1.103 2005/04/11 22:21:11 stpohle Exp $
$Id: ChangeLog,v 1.104 2005/07/06 13:11:51 stpohle Exp $
- Fixed: Bug with more as 8 diffrent player graphics.
The window size hasen't changed if there where more as
8 different player graphics to choose from.
- Removed the Dedicated Server Support from the game.
The whole bomberclone game is not desinged for a dedicated
server. The test shown that the whole game would have to
be rewritten. Also that the host can leave the game would
not work no more.
Version 0.11.6.2
- Client network player could die two times in a game.

@ -1,4 +1,4 @@
# Anjuta Version 1.2.2
# Anjuta Version 1.2.3
Compatibility Level: 1
<PROJECT_DESCRIPTION_START>
@ -39,7 +39,7 @@ echo "T $target H $host B $buid" >cross-target.txt
props.file.type=project
anjuta.version=1.2.2
anjuta.version=1.2.3
anjuta.compatibility.level=1
project.name=bomberclone

@ -1,4 +1,4 @@
/* $Id: basic.h,v 1.32 2005/04/10 00:22:16 stpohle Exp $ */
/* $Id: basic.h,v 1.33 2005/07/06 13:11:55 stpohle Exp $ */
/* basic types which we need everywhere */
#ifndef _BC_BASIC_H_
@ -80,7 +80,7 @@
#define UDP_TIMEOUT 15000
#define BUF_SIZE 1024
#define AUTOSTART 20 /* dedicated server autostart */
#define AUTOSTART 20 /* server autostart */
#define MW_IS_GFX_SELECT(__gfx_nr,__result) for (__result = (MAX_PLAYERS-1); (__result >= 0) && (players[__result].gfx_nr != __gfx_nr); __result--);

@ -1,4 +1,4 @@
/* $Id: bomberclone.h,v 1.33 2005/04/09 18:22:40 stpohle Exp $ */
/* $Id: bomberclone.h,v 1.34 2005/07/06 13:11:55 stpohle Exp $ */
/* bomberclone.h */
#ifndef _BOMBERCLONE_H_
@ -85,7 +85,6 @@ struct {
int firewall;
int notifygamemaster;
int broadcast;
int dedicated; // if started as dedicated server
int autostart; // time for an autostart of the game
int minplayers; // minimal number of players

@ -1,4 +1,4 @@
/* $Id: bomb.c,v 1.63 2005/04/09 18:22:40 stpohle Exp $ */
/* $Id: bomb.c,v 1.64 2005/07/06 13:11:55 stpohle Exp $ */
/* everything what have to do with the bombs */
#include "bomberclone.h"
@ -19,8 +19,6 @@ draw_bomb (_bomb * bomb)
y1,
y2;
if (bman.dedicated)
return;
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);

@ -1,4 +1,4 @@
/* $Id: configuration.c,v 1.75 2005/04/10 00:22:17 stpohle Exp $
/* $Id: configuration.c,v 1.76 2005/07/06 13:11:55 stpohle Exp $
* configuration */
#include <SDL.h>
@ -21,7 +21,9 @@
* 2) ./data
* 3) ../data
*/
void config_get_datapath () {
void
config_get_datapath ()
{
FILE *f;
char filename[255];
@ -54,8 +56,10 @@ void
config_init (int argc, char **argv)
{
SDL_Surface *icon_img;
char text[255], icon[255];
int i, j;
char text[255],
icon[255];
int i,
j;
config_get_datapath ();
@ -63,7 +67,7 @@ config_init (int argc, char **argv)
for (i = 0; i < MAX_TEAMS; i++) {
teams[i].col = i;
sprintf (teams[i].name, "Team %d", i+1);
sprintf (teams[i].name, "Team %d", i + 1);
for (j = 0; j < MAX_PLAYERS; j++)
teams[i].players[j] = NULL;
}
@ -93,7 +97,6 @@ config_init (int argc, char **argv)
resend_cache.fill = -1;
bman.notifygamemaster = 1;
bman.broadcast = 1;
bman.dedicated = 0;
bman.autostart = AUTOSTART;
bman.askplayername = 0;
debug = 0;
@ -148,13 +151,12 @@ config_init (int argc, char **argv)
snd_init ();
gfx_blitdraw ();
if (!bman.dedicated)
SDL_Flip (gfx.screen);
sprintf (text,"Bomberclone %s", VERSION);
sprintf (icon,"%s/pixmaps/bomberclone.png", bman.datapath);
SDL_WM_SetCaption(text , NULL);
icon_img = IMG_Load(icon);
sprintf (text, "Bomberclone %s", VERSION);
sprintf (icon, "%s/pixmaps/bomberclone.png", bman.datapath);
SDL_WM_SetCaption (text, NULL);
icon_img = IMG_Load (icon);
if (icon_img == NULL)
d_printf ("could not load icon. (%s)\n", icon);
@ -174,7 +176,8 @@ config_init (int argc, char **argv)
/* read the configuration file
* return -1 if something went wrong and 0 if no problem */
int
config_read () {
config_read ()
{
FILE *config;
char buf[1024];
char *findit,
@ -375,13 +378,13 @@ config_read () {
for (i = 0; i < MAX_TEAMS; i++) {
char txt[255];
sprintf (txt,"teamcol%d", i);
sprintf (txt, "teamcol%d", i);
if (!strcmp (keyword, txt)) {
teams[i].col = atoi (value);
}
sprintf (txt,"teamname%d", i);
sprintf (txt, "teamname%d", i);
if (!strcmp (keyword, txt)) {
strncpy (teams[i].name,value, LEN_PLAYERNAME);
strncpy (teams[i].name, value, LEN_PLAYERNAME);
}
}
@ -675,7 +678,6 @@ ReadPrgArgs (int argc, char **argv)
printf (" -join - go into the join menu\n");
printf (" -connect ADDRESS - connect to a server\n");
printf (" -debug 0/1 - enable/disable debug\n");
printf (" -dedicated - run as dedicated server\n");
printf (" -autostart SECONDS - time before a game starts\n");
exit (0);
}
@ -695,12 +697,6 @@ ReadPrgArgs (int argc, char **argv)
bman.broadcast = atoi (argv[++i]);
if (!strcmp (argv[i], "-debug"))
debug = atoi (argv[++i]);
if (!strcmp (argv[i], "-dedicated")) {
if (bman.minplayers <= 1)
bman.minplayers = 2;
bman.dedicated = 1;
printf ("\nDedicated Bomberclone Server - Version " VERSION "\n\n");
}
if (!strcmp (argv[i], "-autostart"))
bman.autostart = atoi (argv[++i]);
}
@ -727,15 +723,17 @@ ReadPrgArgs_Jump (int argc, char **argv)
join_multiplayer_game ();
}
}
if (bman.dedicated > 0)
host_multiplayer_game ();
};
/* check the version number, return [ 0 =] [-1 <] [ 1 >] */
int check_version (int ma, int mi, int su, char *ver) {
int v1, v2, v3, res = 0;
int
check_version (int ma, int mi, int su, char *ver)
{
int v1,
v2,
v3,
res = 0;
sscanf (ver, "%d.%d.%d", &v1, &v2, &v3);
if (v1 < ma)

@ -1,4 +1,4 @@
/* $Id: font.c,v 1.15 2005/04/09 18:22:40 stpohle Exp $ */
/* $Id: font.c,v 1.16 2005/07/06 13:11:55 stpohle Exp $ */
// Using Fonts in SDL
#include <string.h>
@ -127,21 +127,16 @@ void font_load () {
break;
}
if (!bman.dedicated) {
font[i].image[c] = SDL_DisplayFormat (tmp);
SDL_SetColorKey (font[i].image[c] , SDL_SRCCOLORKEY, SDL_MapRGB (font[i].image[c]->format, 0,0,0));
SDL_FillRect (font[i].image[c], NULL, SDL_MapRGB (font[i].image[c]->format, r,g,b));
SDL_BlitSurface (raw, NULL, font[i].image[c], NULL);
}
else
font[i].image[c] = tmp;
}
font[i].size.x = tmp->w / 16;
font[i].size.y = tmp->h / 16;
SDL_FreeSurface (raw);
if (!bman.dedicated)
SDL_FreeSurface (tmp);
}
};

@ -1,4 +1,4 @@
/* $Id: game.c,v 1.111 2005/04/10 00:22:17 stpohle Exp $
/* $Id: game.c,v 1.112 2005/07/06 13:11:55 stpohle Exp $
game.c - procedures for the game. */
#include <string.h>
@ -17,7 +17,8 @@
extern int blitdb_nr,
blitrects_nr;
Uint32 game_timediff, game_timediff1;
Uint32 game_timediff,
game_timediff1;
static float hurrywarn_to;
static int hurrywarn_state;
static _menu *menu;
@ -34,15 +35,15 @@ game_draw_info ()
SDL_Rect src,
dest;
if (GT_MP && (chat.oldscreen == NULL || chat.window.x != 4 || chat.window.y != 4.5*16)) {
chat_show (4, 4.5*16, gfx.res.x - 8, gfx.offset.y - 4.5*16);
if (GT_MP && (chat.oldscreen == NULL || chat.window.x != 4 || chat.window.y != 4.5 * 16)) {
chat_show (4, 4.5 * 16, gfx.res.x - 8, gfx.offset.y - 4.5 * 16);
chat_setactive (0, 0);
}
if (bman.updatestatusbar) {
redraw_logo (0, 0, gfx.res.x, (4.5 * 16));
dest.x = dest.y = 0;
dest.h = 4.5 *16;
dest.h = 4.5 * 16;
dest.w = gfx.res.x;
gfx_blitupdaterectadd (&dest);
@ -91,12 +92,13 @@ game_draw_info ()
font_draw (x, 0, text, 0, 0);
sprintf (text, "Range: %2d", players[bman.p_nr].range);
font_draw (x, 16, text, 0, 0);
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);
if (players[bman.p_nr].special.type != 0) {
col = players[bman.p_nr].special.type + FT_sp_trigger - 1;
dest.x = x - 32;
dest.y = 16;
dest.w = gfx.menu_field[col]->w;
dest.h = gfx.menu_field[col]->h;
@ -119,22 +121,26 @@ game_draw_info ()
hurrywarn_state = !hurrywarn_state;
if (hurrywarn_state) {
font_drawbold ((gfx.res.x - strlen ("HURRY HURRY")*font[1].size.x)/2, 40, "HURRY HURRY", 1, 0, 2);
font_draw ((gfx.res.x - strlen ("HURRY HURRY")*font[1].size.x)/2, 40, "HURRY HURRY", 1, 1);
font_drawbold ((gfx.res.x - strlen ("HURRY HURRY") * font[1].size.x) / 2, 40,
"HURRY HURRY", 1, 0, 2);
font_draw ((gfx.res.x - strlen ("HURRY HURRY") * font[1].size.x) / 2, 40,
"HURRY HURRY", 1, 1);
}
else {
font_drawbold ((gfx.res.x - strlen ("HURRY HURRY")*font[1].size.x)/2, 40, "HURRY HURRY", 1, 1, 2);
font_draw ((gfx.res.x - strlen ("HURRY HURRY")*font[1].size.x)/2, 40, "HURRY HURRY", 1, 0);
font_drawbold ((gfx.res.x - strlen ("HURRY HURRY") * font[1].size.x) / 2, 40,
"HURRY HURRY", 1, 1, 2);
font_draw ((gfx.res.x - strlen ("HURRY HURRY") * font[1].size.x) / 2, 40,
"HURRY HURRY", 1, 0);
}
dest.x = dest.y = 0;
dest.h = 4.5 *16;
dest.h = 4.5 * 16;
dest.w = gfx.res.x;
gfx_blitupdaterectadd (&dest);
}
}
if (debug)
debug_ingameinfo();
debug_ingameinfo ();
bman.updatestatusbar = 0;
};
@ -147,10 +153,11 @@ game_draw_info ()
* chat mode: the chatmode should only be disabled in the game mode
* in the GS_wait mode the chat will always be active.
*/
void game_keys_loop () {
void
game_keys_loop ()
{
if (menu != NULL) {
/* delete all movement keys */
int i;
@ -161,11 +168,13 @@ void game_keys_loop () {
/* don't go into the game_keys if there is no menu displayed */
if (GT_MP_PTPM && bman.state == GS_ready && keyb_gamekeys.state[BCK_pause] && !keyb_gamekeys.old[BCK_pause]) {
if (GT_MP_PTPM && bman.state == GS_ready && keyb_gamekeys.state[BCK_pause]
&& !keyb_gamekeys.old[BCK_pause]) {
/* Server is starting the game
* check in multiplayer if all players are ready for the game
*/
int i, ready = 1;
int i,
ready = 1;
for (i = 0; i < MAX_PLAYERS; i++)
if (NET_CANSEND (i) && !players[i].ready)
@ -182,7 +191,7 @@ void game_keys_loop () {
if (keyb_gamekeys.state[BCK_fullscreen] && !keyb_gamekeys.old[BCK_fullscreen]) {
/* Switch Fullscreen */
SDL_WM_ToggleFullScreen(gfx.screen);
SDL_WM_ToggleFullScreen (gfx.screen);
gfx.fullscreen = !gfx.fullscreen;
bman.updatestatusbar = 1; // force an update
}
@ -204,7 +213,8 @@ void game_keys_loop () {
game_menu_create ();
}
if ((GT_MP_PTPM || GT_MP_PTPS) && keyb_gamekeys.state[BCK_chat] && !keyb_gamekeys.old[BCK_chat]) {
if ((GT_MP_PTPM || GT_MP_PTPS) && keyb_gamekeys.state[BCK_chat]
&& !keyb_gamekeys.old[BCK_chat]) {
chat_setactive (1, 0);
chat.changed = 1;
d_printf ("Chatmode Enabled\n");
@ -218,8 +228,8 @@ void
game_loop ()
{
SDL_Event event;
int done = 0, eventstate;
int ready_timestamp = 0;
int done = 0,
eventstate;
if (GT_MP)
net_game_fillsockaddr ();
@ -229,13 +239,11 @@ game_loop ()
timestamp = SDL_GetTicks (); // needed for time sync.
d_gamedetail ("GAME START");
if (!bman.dedicated) {
gfx_blitupdaterectclear ();
draw_logo ();
draw_field ();
SDL_Flip (gfx.screen);
draw_players ();
}
if (bman.p_nr >= 0 && bman.p_nr < MAX_PLAYERS) {
players[bman.p_nr].ready = 1;
@ -249,8 +257,6 @@ game_loop ()
}
while (!done && (bman.state == GS_running || bman.state == GS_ready)) {
if (!bman.dedicated) {
if ((eventstate = SDL_PollEvent (&event)) != 0)
switch (event.type) {
case (SDL_QUIT):
@ -272,31 +278,11 @@ game_loop ()
chat_setactive (1, 1);
restore_players_screen ();
}
/* check if we have a dedicated server */
if (bman.dedicated && bman.state == GS_ready) {
int i, ready = 1;
for (i = 0; i < MAX_PLAYERS; i++)
if (NET_CANSEND (i) && !players[i].ready)
ready = 0;
if (ready && ready_timestamp == 0)
ready_timestamp = timestamp;
if (ready && (timestamp - ready_timestamp) > 2500) {
bman.state = GS_running;
net_send_servermode ();
}
}
player_check (bman.p_nr);
if (IS_LPLAYER2)
player_check (bman.p2_nr);
if (!bman.dedicated)
dead_playerani ();
special_loop ();
@ -317,10 +303,8 @@ game_loop ()
field_loop ();
flitems_loop ();
if (!bman.dedicated) {
draw_players ();
game_draw_info (); // will set the var bman.player_nr
}
/* check if there is only one player left and the game is in multiplayer mode
and if there the last dieing animation is done */
@ -332,7 +316,6 @@ game_loop ()
done = 1;
}
if (!bman.dedicated) {
stonelist_draw ();
/* if there is any menu displayed do so */
@ -340,23 +323,23 @@ game_loop ()
game_menu_loop (&event, eventstate);
gfx_blitdraw ();
}
s_calctimesync ();
bman.timeout -= timediff;
}
if (menu != NULL)
if (menu != NULL) {
menu_delete (menu);
menu = NULL;
}
if (!bman.dedicated) {
gfx_blitdraw ();
chat_show (-1, -1, -1, -1);
draw_logo ();
gfx_blitupdaterectclear ();
SDL_Flip (gfx.screen);
}
d_gamedetail ("GAME END");
d_printf ("done = %d\n", done);
@ -368,13 +351,16 @@ game_loop ()
* check also if we there is only one team alife
*/
#define ENDGAME_CHECK_AGAIN 1.0f
int game_check_endgame () {
int
game_check_endgame ()
{
int res = 0;
static float loop;
loop -= timediff;
if (loop > 0.0f && loop < ENDGAME_CHECK_AGAIN) return 0;
if (loop > 0.0f && loop < ENDGAME_CHECK_AGAIN)
return 0;
loop = ENDGAME_CHECK_AGAIN;
if (bman.gametype == GT_team) {
@ -389,7 +375,8 @@ int game_check_endgame () {
int team_last = -1; // last teams which was alift
_player *p;
for (t_nr = 0; t_nr < MAX_TEAMS; t_nr++) for (p_nr = 0; p_nr < MAX_PLAYERS; p_nr++)
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)) {
@ -407,7 +394,8 @@ int game_check_endgame () {
if (h_team < 1 || ateam < 2)
res = 1;
}
else if ((bman.gametype == GT_bomberman) || (map.state != MS_normal && bman.gametype == GT_deathmatch)) {
else if ((bman.gametype == GT_bomberman)
|| (map.state != MS_normal && bman.gametype == GT_deathmatch)) {
int p_nr; // playernumber
int h_alife = 0; // human players who are alife
int alife = 0; // ai players who are alife
@ -427,6 +415,7 @@ int game_check_endgame () {
return res;
};
#undef ENDGAME_CHECK_AGAIN
/* check which player won and free all unnneded data */
@ -454,7 +443,8 @@ game_end ()
}
if (cnt_left == 1)
players[bman.lastwinner].points += bman.players_nr_s;
else bman.lastwinner = -1;
else
bman.lastwinner = -1;
/* check which team was alife */
if (bman.gametype == GT_team) {
@ -463,9 +453,10 @@ game_end ()
bman.lastwinner = -1;
cnt_left = 0;
for (t_nr = 0; t_nr < MAX_TEAMS; t_nr++) for (i = 0; i < MAX_PLAYERS; i++) {
for (t_nr = 0; t_nr < MAX_TEAMS; t_nr++)
for (i = 0; i < MAX_PLAYERS; i++) {
if (teams[t_nr].players[i] != NULL)
if (PS_IS_alife(teams[t_nr].players[i]->state)) {
if (PS_IS_alife (teams[t_nr].players[i]->state)) {
if (bman.lastwinner != t_nr) {
teams[t_nr].wins++;
cnt_left++;
@ -502,9 +493,10 @@ game_end ()
void
game_start ()
{
int p, i;
int p,
i;
if (!bman.dedicated) menu_displaytext ("Loading..", "Please Wait");
menu_displaytext ("Loading..", "Please Wait");
bman.players_nr_s = 0;
@ -531,7 +523,7 @@ game_start ()
players[p].m = 0;
players[p].old.x = 0;
players[p].old.y = 0;
bman.updatestatusbar=1;
bman.updatestatusbar = 1;
players[p].frame = 0.0f;
players[p].d = 0;
players[p].pos.x = 0.0;
@ -561,15 +553,12 @@ game_start ()
flitems_reset ();
init_map_tileset ();
if (!bman.dedicated)
tileset_load (map.tileset, -1, -1);
gfx_load_players (gfx.block.x, gfx.block.y);
if (!bman.dedicated) {
snd_load (map.tileset);
snd_music_start ();
}
map.state = MS_normal;
bman.timeout = bman.init_timeout;
@ -588,16 +577,30 @@ game_start ()
#define SHOWRESULT_TEAMHEAD 24
#define SHOWRESULT_TEAMPLAYER 16
#define SHOWRESULT_TEAMPLAYERWIDTH 150
void game_showresultteam (int pos_x, int pos_y, int pos_w, int pos_h) {
int i, t_nr, p_nr; // counter for teams and players
void
game_showresultteam (int pos_x, int pos_y, int pos_w, int pos_h)
{
int i,
t_nr,
p_nr; // counter for teams and players
struct {
_team *team; // pointer to the team
_player *pl[MAX_PLAYERS]; // players in the team (sorted)
int cnt;
} tdata[MAX_TEAMS]; // hold some team informations (sorted)
int t_count = 0, p_maxcount = 0, p_sumcount = 0;
int sx, sy, p_y, p_x , dx, dy, col, x;
SDL_Rect dest, src;
int t_count = 0,
p_maxcount = 0,
p_sumcount = 0;
int sx,
sy,
p_y,
p_x,
dx,
dy,
col,
x;
SDL_Rect dest,
src;
char text[255];
/* sort all teams */
@ -613,10 +616,10 @@ void game_showresultteam (int pos_x, int pos_y, int pos_w, int pos_h) {
tdata[t_count].team = &teams[t_nr];
i = t_count;
while (i > 0 && (tdata[i-1].team->wins < teams[t_nr].wins
|| (tdata[i-1].team->wins == teams[t_nr].wins
&& tdata[i-1].team->points < teams[t_nr].points))) {
tdata[i].team = tdata[i-1].team;
while (i > 0 && (tdata[i - 1].team->wins < teams[t_nr].wins
|| (tdata[i - 1].team->wins == teams[t_nr].wins
&& tdata[i - 1].team->points < teams[t_nr].points))) {
tdata[i].team = tdata[i - 1].team;
i--;
tdata[i].team = &teams[t_nr];
}
@ -625,16 +628,21 @@ void game_showresultteam (int pos_x, int pos_y, int pos_w, int pos_h) {
}
/* sort all players dependsing on the number of wins they have */
for (t_nr = 0; t_nr < t_count; t_nr++) for (p_nr = 0, tdata[t_nr].cnt = 0; p_nr < MAX_PLAYERS; p_nr++) {
for (t_nr = 0; t_nr < t_count; t_nr++)
for (p_nr = 0, tdata[t_nr].cnt = 0; p_nr < MAX_PLAYERS; p_nr++) {
if (t_nr < t_count) {
if (tdata[t_nr].team->players[p_nr] != NULL && PS_IS_used (tdata[t_nr].team->players[p_nr]->state)) {
if (tdata[t_nr].team->players[p_nr] != NULL
&& PS_IS_used (tdata[t_nr].team->players[p_nr]->state)) {
tdata[t_nr].pl[tdata[t_nr].cnt] = tdata[t_nr].team->players[p_nr];
i = tdata[t_nr].cnt;
while (i > 0 && (tdata[t_nr].pl[i-1]->wins < tdata[t_nr].team->players[p_nr]->wins
|| (tdata[t_nr].pl[i-1]->wins == tdata[t_nr].team->players[p_nr]->wins
&& tdata[t_nr].pl[i-1]->points < tdata[t_nr].team->players[p_nr]->points))) {
tdata[t_nr].pl[i] = tdata[t_nr].pl[i-1];
while (i > 0
&& (tdata[t_nr].pl[i - 1]->wins < tdata[t_nr].team->players[p_nr]->wins
|| (tdata[t_nr].pl[i - 1]->wins ==
tdata[t_nr].team->players[p_nr]->wins
&& tdata[t_nr].pl[i - 1]->points <
tdata[t_nr].team->players[p_nr]->points))) {
tdata[t_nr].pl[i] = tdata[t_nr].pl[i - 1];
i--;
tdata[t_nr].pl[i] = tdata[t_nr].team->players[p_nr];
}
@ -645,10 +653,12 @@ void game_showresultteam (int pos_x, int pos_y, int pos_w, int pos_h) {
/* check the max number of players in one team and number of all players */
for (t_nr = 0, p_maxcount = 0; t_nr < t_count; t_nr++) /* t_count + 1 */
if (p_maxcount < tdata[t_nr].cnt) p_maxcount = tdata[t_nr].cnt;
if (p_maxcount < tdata[t_nr].cnt)
p_maxcount = tdata[t_nr].cnt;
for (p_sumcount = 0, p_nr = 0; p_nr < MAX_PLAYERS; p_nr++)
if (PS_IS_used (players[p_nr].state)) p_sumcount++;
if (PS_IS_used (players[p_nr].state))
p_sumcount++;
/* calculate the best view */
p_x = dx = dy = 0;
@ -656,28 +666,32 @@ void game_showresultteam (int pos_x, int pos_y, int pos_w, int pos_h) {
p_x++;
p_y = 0; // calc. again for this setting
for (t_nr = 0; t_nr < t_count; t_nr++) {
p_y += ceil ((float)(((float) tdata[t_nr].cnt) / ((float)p_x)));
p_y += ceil ((float) (((float) tdata[t_nr].cnt) / ((float) p_x)));
}
if (p_y == 0) p_y = 1;
if (p_y == 0)
p_y = 1;
dy = (pos_h - (SHOWRESULT_TEAMHEAD * t_count)) / p_y;
} while (dy < SHOWRESULT_TEAMPLAYER);
if (dy > 2*SHOWRESULT_TEAMPLAYER) dy = 2*SHOWRESULT_TEAMPLAYER;
if (dy > 2 * SHOWRESULT_TEAMPLAYER)
dy = 2 * SHOWRESULT_TEAMPLAYER;
/* draw everything */
sy = (pos_h - (SHOWRESULT_TEAMHEAD * t_count + dy * p_y)) / 2;
for (t_nr = 0; t_nr < t_count; t_nr++) {
sprintf (text, "%s Victorys %d (%d)", tdata[t_nr].team->name, tdata[t_nr].team->wins, tdata[t_nr].team->points);
sprintf (text, "%s Victorys %d (%d)", tdata[t_nr].team->name, tdata[t_nr].team->wins,
tdata[t_nr].team->points);
sx = (pos_w - strlen (text) * font[0].size.x) / 2;
font_gfxdrawbold (10+ pos_x + sx, pos_y + sy+3, text, 0, COLOR_brown, 1, 1);
font_gfxdraw (10+ pos_x + sx, pos_y + sy+3, text, 0, COLOR_yellow, 2);
font_gfxdrawbold (10 + pos_x + sx, pos_y + sy + 3, text, 0, COLOR_brown, 1, 1);
font_gfxdraw (10 + pos_x + sx, pos_y + sy + 3, text, 0, COLOR_yellow, 2);
sy += SHOWRESULT_TEAMHEAD;
dx = pos_w / p_x;
sx = (dx - SHOWRESULT_TEAMPLAYERWIDTH)/2;
sx = (dx - SHOWRESULT_TEAMPLAYERWIDTH) / 2;
for (col = 0, p_nr = 0; p_nr < tdata[t_nr].cnt; p_nr++) {
if (col == 0 || col >= p_x) {
if (col >= p_x) sy += dy;
if (col >= p_x)
sy += dy;
col = 0;
x = sx;
}
@ -700,14 +714,17 @@ void game_showresultteam (int pos_x, int pos_y, int pos_w, int pos_h) {
src.y = 0;
gfx_blit (gfx.ghost_small, &src, gfx.screen, &dest, 1);
}
sprintf (text, "%s(%d/%d)", tdata[t_nr].pl[p_nr]->name, tdata[t_nr].pl[p_nr]->wins, tdata[t_nr].pl[p_nr]->points);
font_gfxdraw (10+ pos_x + x + GFX_SMALLPLAYERIMGSIZE_X*2, pos_y + sy + 2, text, 0, 0, 2);
sprintf (text, "%s(%d/%d)", tdata[t_nr].pl[p_nr]->name, tdata[t_nr].pl[p_nr]->wins,
tdata[t_nr].pl[p_nr]->points);
font_gfxdraw (10 + pos_x + x + GFX_SMALLPLAYERIMGSIZE_X * 2, pos_y + sy + 2, text, 0, 0,
2);
x += dx;
col++;
}
sy += dy;
}
}
#undef SHOWRESULT_TEAMHEAD
#undef SHOWRESULT_TEAMPLAYER
#undef SHOWRESULT_TEAMPLAYERWIDTH
@ -716,14 +733,25 @@ void game_showresultteam (int pos_x, int pos_y, int pos_w, int pos_h) {
/* Bomberman/Deathmatch Version Play */
#define SHOWRESULT_WIDTH 150
#define SHOWRESULT_HEIGHT 60
void game_showresultnormal (int pos_x, int pos_y, int pos_w, int pos_h) {
void
game_showresultnormal (int pos_x, int pos_y, int pos_w, int pos_h)
{
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;
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];
@ -733,10 +761,10 @@ void game_showresultnormal (int pos_x, int pos_y, int pos_w, int pos_h) {
pl[pl_cnt] = &players[p];
i = pl_cnt;
while (i > 0 && (pl[i-1]->wins < players[p].wins
|| (pl[i-1]->wins == players[p].wins
&& pl[i-1]->points < players[p].points))) {
pl[i] = pl[i-1];
while (i > 0 && (pl[i - 1]->wins < players[p].wins
|| (pl[i - 1]->wins == players[p].wins
&& pl[i - 1]->points < players[p].points))) {
pl[i] = pl[i - 1];
i--;
pl[i] = &players[p];
}
@ -751,14 +779,15 @@ void game_showresultnormal (int pos_x, int pos_y, int pos_w, int pos_h) {
pl_x = 0;
do {
pl_x++;
pl_y = ceil ((float)(((float) pl_cnt) / ((float)pl_x)));
if (pl_y == 0) pl_y++;
pl_y = ceil ((float) (((float) pl_cnt) / ((float) pl_x)));
if (pl_y == 0)
pl_y++;
dy = pos_h / pl_y;
} while (dy < SHOWRESULT_HEIGHT);
dx = pos_w / pl_x;
x = sx = (dx - SHOWRESULT_WIDTH)/2;
y = sy = (dy - SHOWRESULT_HEIGHT)/2;
x = sx = (dx - SHOWRESULT_WIDTH) / 2;
y = sy = (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);
@ -767,14 +796,17 @@ void game_showresultnormal (int pos_x, int pos_y, int pos_w, int pos_h) {
for (i = 1, p = 0; p < pl_cnt; p++) {
if (PS_IS_used (pl[p]->state)) {
if (PS_IS_alife (pl[p]->state)) {
font_gfxdrawbold (10+ pos_x + x + GFX_MENUPLAYERIMGSIZE_X + 8, pos_y + y - 10, pl[p]->name, 0, COLOR_brown, 1, 1);
font_gfxdraw (10+ pos_x + x + GFX_MENUPLAYERIMGSIZE_X + 8,pos_y + y - 10, pl[p]->name, 0, COLOR_yellow, 1);
font_gfxdrawbold (10 + pos_x + x + GFX_MENUPLAYERIMGSIZE_X + 8, pos_y + y - 10,
pl[p]->name, 0, COLOR_brown, 1, 1);
font_gfxdraw (10 + pos_x + x + GFX_MENUPLAYERIMGSIZE_X + 8, pos_y + y - 10,
pl[p]->name, 0, COLOR_yellow, 1);
}
else
font_gfxdraw (10+ pos_x + x + GFX_MENUPLAYERIMGSIZE_X,pos_y + y - 10, pl[p]->name, 0, COLOR_gray, 1);
font_gfxdraw (10 + pos_x + x + GFX_MENUPLAYERIMGSIZE_X, pos_y + y - 10, pl[p]->name,
0, COLOR_gray, 1);
sprintf (text, "%3d (%3d)", pl[p]->wins, pl[p]->points);
font_gfxdraw (10+ pos_x + x + GFX_MENUPLAYERIMGSIZE_X, pos_y + y + 6, text, 0, 0, 1);
font_gfxdraw (10 + pos_x + x + GFX_MENUPLAYERIMGSIZE_X, pos_y + y + 6, text, 0, 0, 1);
if (pl[p]->gfx != NULL) {
dest.x = pos_x + x;
@ -805,15 +837,21 @@ void game_showresultnormal (int pos_x, int pos_y, int pos_w, int pos_h) {
}
}
}
#undef SHOWRESULT_HEIGHT
#undef SHOWRESULT_WIDTH
void game_showresult () {
void
game_showresult ()
{
char text[255];
SDL_Event event;
Uint8 *keys;
int done = 0, keypressed = 0, x, y;
int done = 0,
keypressed = 0,
x,
y;
gfx_blitdraw ();
@ -828,8 +866,8 @@ void game_showresult () {
strcpy (text, "[CTRL],[RETURN] or [STRG] for another game");
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_draw (x, gfx.res.y - (2*font[0].size.y) - 2, text, 0, COLOR_yellow);
font_drawbold (x, gfx.res.y - (2 * font[0].size.y) - 2, text, 0, COLOR_brown, 1);
font_draw (x, gfx.res.y - (2 * font[0].size.y) - 2, text, 0, COLOR_yellow);
strcpy (text, "or [ESC] to leave the game.");
x = (gfx.res.x - (font[1].size.x * strlen (text)) - 64) / 2;
@ -837,9 +875,9 @@ void game_showresult () {
font_draw (x, gfx.res.y - font[0].size.y - 2, text, 0, COLOR_yellow);
if (bman.gametype == GT_team)
game_showresultteam (10,50,gfx.res.x-20,gfx.res.y-100);
game_showresultteam (10, 50, gfx.res.x - 20, gfx.res.y - 100);
else
game_showresultnormal (10,50,gfx.res.x-20,gfx.res.y-100);
game_showresultnormal (10, 50, gfx.res.x - 20, gfx.res.y - 100);
gfx_blitdraw ();
SDL_Flip (gfx.screen);
@ -864,14 +902,15 @@ void game_showresult () {
bman.state = GS_startup;
}
if ((keys[SDLK_RETURN] || keys[SDLK_LCTRL] || keys[SDLK_RCTRL]) && (!keypressed) && (event.type = SDL_KEYDOWN)) {
if ((keys[SDLK_RETURN] || keys[SDLK_LCTRL] || keys[SDLK_RCTRL]) && (!keypressed)
&& (event.type = SDL_KEYDOWN)) {
done = 1;
keypressed = 1;
}
if (keys[SDLK_F8] && event.type == SDL_KEYDOWN) {
/* Switch Fullscreen */
SDL_WM_ToggleFullScreen(gfx.screen);
SDL_WM_ToggleFullScreen (gfx.screen);
gfx.fullscreen = !gfx.fullscreen;
bman.updatestatusbar = 1; // force an update
}
@ -892,7 +931,9 @@ void game_showresult () {
/*
* create the in game menu
*/
void game_menu_create () {
void
game_menu_create ()
{
if (menu != NULL)
return;
@ -917,7 +958,9 @@ void game_menu_create () {
*
* Pressing ESC will bring you back to the game.
*/
void game_menu_loop (SDL_Event *event, int eventstate) {
void
game_menu_loop (SDL_Event * event, int eventstate)
{
int done;
if (menu == NULL)
@ -937,7 +980,8 @@ void game_menu_loop (SDL_Event *event, int eventstate) {
else if (menu->focus->id == 3) { /* End Game */
/* send network update */
if (GT_MP) net_game_send_delplayer (bman.p_nr);
if (GT_MP)
net_game_send_delplayer (bman.p_nr);
bman.state = GS_quit;
}

@ -1,4 +1,4 @@
/* $Id: gfx.c,v 1.40 2005/04/09 18:22:40 stpohle Exp $ */
/* $Id: gfx.c,v 1.41 2005/07/06 13:11:55 stpohle Exp $ */
/* gfx.c */
#include "bomberclone.h"
@ -66,10 +66,7 @@ gfx_load_players (int sx, int sy)
gfx.players[i].ani.w = (tmpimage->w / 4) * sfkt;
gfx.players[i].ani.frames = tmpimage->h / GFX_PLAYERIMGSIZE_Y;
if (!bman.dedicated) {
tmpimage1 =
scale_image (tmpimage, gfx.players[i].ani.w * 4,
gfx.players[i].ani.frames * gfx.players[i].ani.h);
tmpimage1 = scale_image (tmpimage, gfx.players[i].ani.w * 4, gfx.players[i].ani.frames * gfx.players[i].ani.h);
getRGBpixel (tmpimage1, 0, 0, &r, &g, &b);
SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY, SDL_MapRGB (tmpimage1->format, r, g, b));
gfx.players[i].ani.image = SDL_DisplayFormat (tmpimage1);
@ -78,10 +75,6 @@ gfx_load_players (int sx, int sy)
/* calculate the numbers of images for the animation */
gfx.players[i].offset.x = (sx - gfx.players[i].ani.w) / 2;
gfx.players[i].offset.y = -sy;
}
else
gfx.players[i].ani.image = NULL;
SDL_FreeSurface (tmpimage);
}
}
@ -96,10 +89,7 @@ gfx_load_players (int sx, int sy)
}
gfx.dead.frames = tmpimage->h / (2* GFX_IMGSIZE);
if (!bman.dedicated) {
tmpimage1 =
scale_image (tmpimage, ((2 * sx * tmpimage->w) / (2 * GFX_IMGSIZE)),
gfx.dead.frames * (2 * sy));
tmpimage1 = scale_image (tmpimage, ((2 * sx * tmpimage->w) / (2 * GFX_IMGSIZE)), gfx.dead.frames * (2 * sy));
getRGBpixel (tmpimage1, 0, 0, &r, &g, &b);
SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY, SDL_MapRGB (tmpimage1->format, r, g, b));
gfx.dead.image = SDL_DisplayFormat (tmpimage1);
@ -114,9 +104,7 @@ gfx_load_players (int sx, int sy)
exit (1);
}
gfx.ill.frames = tmpimage->h / (2 * GFX_IMGSIZE);
tmpimage1 =
scale_image (tmpimage, (2 * sx * tmpimage->w) / (2 * GFX_IMGSIZE),
gfx.ill.frames * (2 * sy));
tmpimage1 = scale_image (tmpimage, (2 * sx * tmpimage->w) / (2 * GFX_IMGSIZE), gfx.ill.frames * (2 * sy));
getRGBpixel (tmpimage1, 0, 0, &r, &g, &b);
SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY, SDL_MapRGB (tmpimage1->format, r, g, b));
gfx.ill.image = SDL_DisplayFormat (tmpimage1);
@ -131,12 +119,7 @@ gfx_load_players (int sx, int sy)
exit (1);
}
gfx.respawn.frames = tmpimage->h / (2 * GFX_IMGSIZE);
gfx.respawn.image =
scale_image (tmpimage, (2 * sx * tmpimage->w) / (2 * GFX_IMGSIZE),
gfx.respawn.frames * (2 * sy));
SDL_FreeSurface (tmpimage);
}
else
gfx.respawn.image = scale_image (tmpimage, (2 * sx * tmpimage->w) / (2 * GFX_IMGSIZE), gfx.respawn.frames * (2 * sy));
SDL_FreeSurface (tmpimage);
};
@ -170,22 +153,15 @@ gfx_init ()
{
int i;
if (gfx.fullscreen && !bman.dedicated)
gfx.screen =
SDL_SetVideoMode (gfx.res.x, gfx.res.y, gfx.bpp,
SDL_SWSURFACE | SDL_DOUBLEBUF | SDL_HWACCEL | SDL_FULLSCREEN);
if (gfx.fullscreen)
gfx.screen = SDL_SetVideoMode (gfx.res.x, gfx.res.y, gfx.bpp, SDL_SWSURFACE | SDL_DOUBLEBUF | SDL_HWACCEL | SDL_FULLSCREEN);
else if (!bman.dedicated)
gfx.screen =
SDL_SetVideoMode (gfx.res.x, gfx.res.y, gfx.bpp,
SDL_SWSURFACE | SDL_DOUBLEBUF | SDL_HWACCEL);
if (!bman.dedicated && gfx.screen == NULL) {
else
gfx.screen = SDL_SetVideoMode (gfx.res.x, gfx.res.y, gfx.bpp, SDL_SWSURFACE | SDL_DOUBLEBUF | SDL_HWACCEL);
if (gfx.screen == NULL) {
d_printf ("Unable to set video mode: %s\n", SDL_GetError ());
return;
}
else if (bman.dedicated) {
gfx.screen = NULL;
}
SDL_ShowCursor (SDL_DISABLE);
/* delete small gfx und the menu player gfx */
@ -532,7 +508,6 @@ draw_logo ()
{
SDL_Rect dest;
if (bman.dedicated) return;
dest.x = dest.y = 0;
dest.w = gfx.res.x;

@ -1,4 +1,4 @@
/* $Id: gfxengine.c,v 1.6 2005/04/09 18:22:41 stpohle Exp $ */
/* $Id: gfxengine.c,v 1.7 2005/07/06 13:11:55 stpohle Exp $ */
/* GFX Game Engine */
#include "bomberclone.h"
@ -103,7 +103,7 @@ gfx_blitdraw ()
{
int i;
if (blitdb_nr < 0 || bman.dedicated) {
if (blitdb_nr < 0) {
blitdb_nr = 0;
return;
}

@ -1,4 +1,4 @@
/* $Id: main.c,v 1.31 2005/04/09 18:22:41 stpohle Exp $ */
/* $Id: main.c,v 1.32 2005/07/06 13:11:55 stpohle Exp $ */
#include "basic.h"
#include "bomberclone.h"
@ -42,7 +42,7 @@ main (int argc, char **argv)
config_init (argc, argv);
while (menuselect != -1 && bman.state != GS_quit && bman.dedicated == 0) {
while (menuselect != -1 && bman.state != GS_quit) {
menu = menu_new ("Bomberclone", 400, 250); // y=230
menu_create_button (menu, "Single Game", -1, 70, 200, 0);

@ -1,4 +1,4 @@
/* $Id: multiwait.c,v 1.55 2005/04/09 18:22:41 stpohle Exp $
/* $Id: multiwait.c,v 1.56 2005/07/06 13:11:55 stpohle Exp $
multiwait.c - this manages only the network screen where
everyone have to select it's players and where even the basic chat is inside
*/
@ -33,30 +33,24 @@ extern int blitdb_nr;
static void mw_init ()
{
team_update ();
if (!bman.dedicated) {
gfx_blitdraw ();
draw_logo ();
gfx_blitdraw ();
}
bman.updatestatusbar = 1;
d_playerdetail ("mw_init:\n");
if (!bman.dedicated) {
SDL_Flip (gfx.screen);
chat_show (10, gfx.res.y / 2, gfx.res.x - 20, gfx.res.y / 2 - 10);
chat_setactive (1, 1);
}
};
/* free all graphics */
static void mw_shutdown () {
if (!bman.dedicated) {
chat_show (-1, -1, -1, -1);
gfx_blitdraw ();
draw_logo ();
SDL_Flip (gfx.screen);
}
};
@ -241,7 +235,6 @@ void wait_for_players () {
/*
* the drawing stuff
*/
if (!bman.dedicated) {
if (mw_check_screenredraw()) {
d_printf ("Draw Status\n");
gfx_blitdraw ();
@ -259,32 +252,8 @@ void wait_for_players () {
chat_loop (&event);
chat.active = 1;
}
else {
/* check for the minimum of players */
for (humanpl_cnt = 0, i = 0, cnt = 0, aipl = -1; i < MAX_PLAYERS; i++) {
if (PS_IS_used (players[i].state)) {
cnt++;
if (PS_IS_aiplayer (players[i].state))
aipl = i;
else if (players[i].gfx_nr >= 0)
humanpl_cnt++;
}
}
if (cnt < (bman.minplayers+1))
single_create_ai (1);
if (cnt > (bman.minplayers+1) && aipl >= 0)
player_delete (aipl);
}
s_calctimesync ();
if ((bman.autostart > 0) && (timestamp > timeout_timestamp) && bman.dedicated && humanpl_cnt > 0)
bman.state = GS_ready;
} while (bman.state == GS_wait && bman.sock != -1);
mw_shutdown ();

@ -1,4 +1,4 @@
/* $Id: network.c,v 1.74 2005/04/10 00:22:17 stpohle Exp $ */
/* $Id: network.c,v 1.75 2005/07/06 13:11:56 stpohle Exp $ */
/*
network routines.
*/
@ -477,14 +477,12 @@ net_transmit_gamedata ()
Uint8 *keys;
Uint32 downtimestamp = 0;
if (!bman.dedicated) {
draw_logo ();
if (GT_MP_PTPM)
font_draw (100, 0, "Waiting for the Clients", 1, 0);
else
font_draw (100, 0, "Downloading Data", 1, 0);
}
/*
prepare everything for the loop
@ -505,10 +503,8 @@ net_transmit_gamedata ()
else
net_istep = 3;
if (!bman.dedicated) {
draw_netupdatestate (1);
SDL_Flip (gfx.screen);
}
downtimestamp = timestamp;
while (!done && (bman.state == GS_update || (GT_MP_PTPS && net_istep != 0))) {
@ -617,7 +613,6 @@ net_transmit_gamedata ()
}
/* do the grafik work */
if (!bman.dedicated) {
draw_netupdatestate (0);
if (SDL_PollEvent (&event) != 0)
@ -646,12 +641,10 @@ net_transmit_gamedata ()
/* player is only watching so just go after we have got everything
go to show the field */
if (GT_MP_PTPS && bman.state == GS_update && net_istep == 0
&& players[bman.p_nr].gfx_nr == -1) {
if (GT_MP_PTPS && bman.state == GS_update && net_istep == 0 && players[bman.p_nr].gfx_nr == -1) {
done = 1;
bman.state = GS_running;
}
}
};

@ -1,4 +1,4 @@
/* $Id: player.c,v 1.101 2005/04/11 22:21:14 stpohle Exp $
/* $Id: player.c,v 1.102 2005/07/06 13:11:56 stpohle Exp $
* player.c - everything what have to do with the player */
#include <SDL.h>
@ -18,9 +18,6 @@ draw_player (_player * player)
dest;
int i;
if (bman.dedicated)
return;
if ((int)player->pos.x < 0 || (int)player->pos.x >= map.size.x ||
(int)player->pos.y < 0 || (int)player->pos.y >= map.size.y) {
d_printf ("FATAL: Draw Player out of range : [%f,%f]\n", player->pos.x,
@ -582,8 +579,6 @@ draw_players ()
{
int p;
if (bman.dedicated) return;
for (p = 0; p < MAX_PLAYERS; p++) {
if (PS_IS_playing (players[p].state) && players[p].tunnelto <= 0)
draw_player (&players[p]);

@ -1,4 +1,4 @@
/* $Id: playermenu.c,v 1.16 2004/12/26 04:19:20 stpohle Exp $
/* $Id: playermenu.c,v 1.17 2005/07/06 13:11:56 stpohle Exp $
*/
#include "bomberclone.h"
@ -28,6 +28,8 @@ static void playermenu_selgfx_drawplayer (int selgfx, _menu *menu) {
static int changed = 0;
SDL_Rect rect, srcrect;
int i;
int i_start;
int i_end;
/*
* delete old state, to force an update of all playergfx
@ -50,26 +52,36 @@ static void playermenu_selgfx_drawplayer (int selgfx, _menu *menu) {
rect.h = 4 * GFX_IMGSIZE;
menu_draw_background (menu, &rect);
for (i = 0; i < gfx.player_gfx_count; i++) {
srcrect.h = rect.h = gfx.players[i].menu_image->h;
srcrect.w = rect.w = gfx.players[i].menu_image->w;
/* calculate the first element on the screen */
if (gfx.player_gfx_count < 12 || selgfx < 4) i_start = 0;
else {
i_start = (((selgfx / 4)-1) * 4);
if (i_start < 0) i_start = 0;
}
if ((i_end = i_start + 12) > gfx.player_gfx_count)
i_end = gfx.player_gfx_count;
for (i = 0; i < i_end - i_start; i++) {
srcrect.h = rect.h = gfx.players[i + i_start].menu_image->h;
srcrect.w = rect.w = gfx.players[i + i_start].menu_image->w;
rect.x = (2 * GFX_MENUPLAYERIMGSIZE_X) * (i % 4) + ((menu->oldscreenpos.w - 2 * menuimages[0]->w) - (8 * GFX_MENUPLAYERIMGSIZE_X)) / 2;
rect.y = (GFX_MENUPLAYERIMGSIZE_X * 2) * (i / 4) + PLAYERMENU_GFXSEL_Y;
srcrect.x = 0;
srcrect.y = 0;
rect.x += menu->oldscreenpos.x + menuimages[0]->w;
rect.y += menu->oldscreenpos.y + menuimages[0]->h;
gfx_blit (gfx.players[i].menu_image, &srcrect, gfx.screen, &rect, 10002);
gfx_blit (gfx.players[i + i_start].menu_image, &srcrect, gfx.screen, &rect, 10002);
/* draw the select border */
if (i == selgfx) {
if ((i + i_start) == selgfx) {
srcrect.x = 0;
srcrect.y = 0;
srcrect.h = rect.h = GFX_IMGSIZE;
srcrect.w = rect.w = GFX_IMGSIZE;
rect.x = GFX_IMGSIZE * (i % 4) + ((menu->oldscreenpos.w - 2 * menuimages[0]->w) -(4 * GFX_IMGSIZE)) / 2;
rect.y = GFX_IMGSIZE * (i / 4) + PLAYERMENU_GFXSEL_Y;
rect.x += (gfx.players[i].menu_image->w - gfx.menuselect.image->w) / 2; // center the playergfx
rect.x += (gfx.players[i + i_start].menu_image->w - gfx.menuselect.image->w) / 2; // center the playergfx
rect.x += menu->oldscreenpos.x + menuimages[0]->w;
rect.y += menu->oldscreenpos.y + menuimages[0]->h;
gfx_blit (gfx.menuselect.image, &srcrect, gfx.screen, &rect, 10001);
@ -98,6 +110,9 @@ int playermenu_selgfx (int pl_nr) {
playermenu_selgfx_drawplayer (-1, NULL);
player_set_gfx (&players[pl_nr], -1);
if (gfx.player_gfx_count > 8)
menu = menu_new ("Player Selection", 400, 330);
else
menu = menu_new ("Player Selection", 400, 270);
menu_create_text (menu, "playergfxsel", -1, 50, 40, 5, COLOR_yellow, "%s, please select your Player and press ENTER/RETURN or press ESCAPE for no player (that means you will only watch the next game).", players[pl_nr].name);

@ -1,4 +1,4 @@
/* $Id: sound.c,v 1.7 2005/04/09 18:22:41 stpohle Exp $ */
/* $Id: sound.c,v 1.8 2005/07/06 13:11:56 stpohle Exp $ */
/* sound */
#include "sound.h"
@ -80,11 +80,6 @@ void
snd_init ()
{
#if HAVE_SDL_MIXER
if (bman.dedicated) {
snd.inited = 0;
return;
}
if (Mix_OpenAudio (snd.audio_rate, snd.audio_format, snd.audio_channels, 1024) < 0) {
d_printf ("Couldn't open audio mixer: %s\n", SDL_GetError ());
snd.inited = 0;

Loading…
Cancel
Save