|
|
|
@ -11,7 +11,8 @@
|
|
|
|
|
|
|
|
|
|
extern int UpdateRects_nr;
|
|
|
|
|
|
|
|
|
|
static Uint32 timediff;
|
|
|
|
|
static Uint32 timediff,
|
|
|
|
|
timediff1;
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
game_draw_info ()
|
|
|
|
@ -21,14 +22,19 @@ game_draw_info ()
|
|
|
|
|
j;
|
|
|
|
|
char text[255];
|
|
|
|
|
char scrtext[255];
|
|
|
|
|
SDL_Rect src, dest;
|
|
|
|
|
SDL_Rect src,
|
|
|
|
|
dest;
|
|
|
|
|
|
|
|
|
|
redraw_logo (0, 0, gfx.res.x, 3*16);
|
|
|
|
|
if (bman.updatestatusbar) {gfx_AddUpdateRect (0,0, gfx.res.x, 3*16);bman.updatestatusbar=0;}
|
|
|
|
|
redraw_logo (0, 0, gfx.res.x, 3 * 16);
|
|
|
|
|
if (bman.updatestatusbar) {
|
|
|
|
|
gfx_AddUpdateRect (0, 0, gfx.res.x, 3 * 16);
|
|
|
|
|
bman.updatestatusbar = 0;
|
|
|
|
|
}
|
|
|
|
|
bman.players_nr = 0;
|
|
|
|
|
|
|
|
|
|
/* draw Player names */
|
|
|
|
|
if (GT_MP_PTP) {
|
|
|
|
|
/* In Multiplayer mode draw Player names and
|
|
|
|
|
count the players who are still alife. */
|
|
|
|
|
for (x = 0, j = 0, i = 0; i < MAX_PLAYERS; i++)
|
|
|
|
|
if ((bman.players[i].state & PSFM_used) != 0) {
|
|
|
|
|
|
|
|
|
@ -63,6 +69,12 @@ game_draw_info ()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
/* in single mode count the player's who are still alife */
|
|
|
|
|
for (i = 0; i < MAX_PLAYERS; i++)
|
|
|
|
|
if (PS_IS_alife (bman.players[i].state))
|
|
|
|
|
bman.players_nr++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
x = gfx.res.x - 120;
|
|
|
|
|
sprintf (text, "Bombs: %2d", bman.players[bman.p_nr].bombs_n);
|
|
|
|
@ -76,22 +88,21 @@ game_draw_info ()
|
|
|
|
|
draw_text (100, 32, "Press F4 to start the game", 1);
|
|
|
|
|
else if (bman.state == GS_ready)
|
|
|
|
|
draw_text (100, 32, "Waiting for the Server to Start", 1);
|
|
|
|
|
// gfx_AddUpdateRect (100, 32, gfx.res.x - 100, 16);
|
|
|
|
|
|
|
|
|
|
redraw_logo (0, gfx.res.y - gfx.font.size.y, gfx.res.x, gfx.res.y);
|
|
|
|
|
|
|
|
|
|
if (debug) { /* do some debug informations on the screen */
|
|
|
|
|
for (x = 0; x < bman.fieldsize.x; x++)
|
|
|
|
|
draw_stone (x, bman.fieldsize.y-1);
|
|
|
|
|
draw_stone (x, bman.fieldsize.y - 1);
|
|
|
|
|
if (GT_MP_PTP) {
|
|
|
|
|
sprintf (text, "NET_STAT: [");
|
|
|
|
|
for (i = 0 ; i < MAX_PLAYERS; i++)
|
|
|
|
|
for (i = 0; i < MAX_PLAYERS; i++)
|
|
|
|
|
sprintf (text, "%s%3d ", text, bman.players[i].net.pkgopt.send_set);
|
|
|
|
|
text[strlen(text)+1] = 0;
|
|
|
|
|
text[strlen(text)] = ']';
|
|
|
|
|
text[strlen (text) + 1] = 0;
|
|
|
|
|
text[strlen (text)] = ']';
|
|
|
|
|
draw_text (0, gfx.res.y - (gfx.font.size.y << 1), text, 1);
|
|
|
|
|
}
|
|
|
|
|
sprintf (text, "TILESET: %s Timediff: %d", gfx.tileset, timediff);
|
|
|
|
|
sprintf (text, "TILESET: %s Tframe: %d Tloop: %d", gfx.tileset, timediff, timediff1);
|
|
|
|
|
sprintf (text, "%s GFX_RECTS:%d", text, UpdateRects_nr);
|
|
|
|
|
draw_text (0, gfx.res.y - gfx.font.size.y, text, 1);
|
|
|
|
|
gfx_AddUpdateRect (0, gfx.res.y - (gfx.font.size.y << 1), gfx.res.x, gfx.font.size.y << 1);
|
|
|
|
@ -99,7 +110,7 @@ game_draw_info ()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (chat.visible == 0 && GT_MP_PTP) {
|
|
|
|
|
chat_show (4, 3*16, gfx.res.x - 4, gfx.offset.y);
|
|
|
|
|
chat_show (4, 3 * 16, gfx.res.x - 4, gfx.offset.y);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -111,7 +122,6 @@ game_loop ()
|
|
|
|
|
Uint8 *keys;
|
|
|
|
|
int done = 0;
|
|
|
|
|
Uint32 timeloop1;
|
|
|
|
|
int move=0;
|
|
|
|
|
int gameovertimeout = TIME_FACTOR * 5; // gameovertimeout
|
|
|
|
|
unsigned char key_bomb = 0; // last state of the bomb key
|
|
|
|
|
|
|
|
|
@ -125,7 +135,8 @@ game_loop ()
|
|
|
|
|
timestamp = SDL_GetTicks (); // needed for time sync.
|
|
|
|
|
|
|
|
|
|
d_gamedetail ("GAME START");
|
|
|
|
|
draw_players();
|
|
|
|
|
draw_players ();
|
|
|
|
|
|
|
|
|
|
while (!done && (bman.state == GS_running || bman.state == GS_ready)) {
|
|
|
|
|
if (SDL_PollEvent (&event) != 0)
|
|
|
|
|
switch (event.type) {
|
|
|
|
@ -176,10 +187,13 @@ game_loop ()
|
|
|
|
|
bman.state = GS_startup;
|
|
|
|
|
done = 1;
|
|
|
|
|
}
|
|
|
|
|
move=bman.players[bman.p_nr].m;
|
|
|
|
|
|
|
|
|
|
chat_loop (&event);
|
|
|
|
|
if (move ||dead_playerani () || GT_MP_PTP) restore_players_screen ();
|
|
|
|
|
player_ilness_loop ();
|
|
|
|
|
|
|
|
|
|
restore_players_screen ();
|
|
|
|
|
dead_playerani ();
|
|
|
|
|
player_ilness_loop (bman.p_nr);
|
|
|
|
|
|
|
|
|
|
if ((bman.players[bman.p_nr].state & PSFM_alife) == PSFM_alife)
|
|
|
|
|
move_player ();
|
|
|
|
|
|
|
|
|
@ -192,19 +206,14 @@ game_loop ()
|
|
|
|
|
|
|
|
|
|
/* this will even set the variable "bman.player_nr"
|
|
|
|
|
to let us know how much Players are still left */
|
|
|
|
|
|
|
|
|
|
if (bomb_loop () || move || GT_MP_PTP) draw_players ();
|
|
|
|
|
move=0;
|
|
|
|
|
bomb_loop ();
|
|
|
|
|
draw_players ();
|
|
|
|
|
game_draw_info ();
|
|
|
|
|
gfx_UpdateRects ();
|
|
|
|
|
|
|
|
|
|
/* check if there is only one player left and the game is in multiplayer mode
|
|
|
|
|
and if there the last dieing animation is done */
|
|
|
|
|
if ((GT_MP_PTPM) && bman.players_nr < 2)
|
|
|
|
|
gameovertimeout--;
|
|
|
|
|
|
|
|
|
|
/* check if we died and we are in single mode and the animation is done */
|
|
|
|
|
if (bman.gametype == GT_single && !PS_IS_alife(bman.players[bman.p_nr].state))
|
|
|
|
|
if (bman.players_nr < 2)
|
|
|
|
|
gameovertimeout--;
|
|
|
|
|
|
|
|
|
|
if (gameovertimeout <= 0) {
|
|
|
|
@ -221,6 +230,7 @@ game_loop ()
|
|
|
|
|
timeloop1 = SDL_GetTicks ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
timediff1 = timeloop1 - timestamp;
|
|
|
|
|
timestamp = timeloop1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -249,8 +259,6 @@ game_end ()
|
|
|
|
|
|
|
|
|
|
/* check which player is now free ,i.e. disconnected during the game and was playing */
|
|
|
|
|
for (i = 0; i < MAX_PLAYERS; i++)
|
|
|
|
|
if ((bman.players[i].state & PSF_used ) == 0)
|
|
|
|
|
if ((bman.players[i].state & PSF_used) == 0)
|
|
|
|
|
bman.players[i].state = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|