|
|
|
@ -9,7 +9,8 @@
|
|
|
|
|
#include "packets.h"
|
|
|
|
|
#include "chat.h"
|
|
|
|
|
|
|
|
|
|
extern int blitdb_nr, blitrects_nr;
|
|
|
|
|
extern int blitdb_nr,
|
|
|
|
|
blitrects_nr;
|
|
|
|
|
|
|
|
|
|
static Uint32 timediff,
|
|
|
|
|
timediff1;
|
|
|
|
@ -26,76 +27,70 @@ game_draw_info ()
|
|
|
|
|
dest;
|
|
|
|
|
|
|
|
|
|
if (bman.updatestatusbar) {
|
|
|
|
|
redraw_logo (0, 0, gfx.res.x, 3 * 16);
|
|
|
|
|
redraw_logo (0, 0, gfx.res.x, 3 * 16);
|
|
|
|
|
bman.updatestatusbar = 0;
|
|
|
|
|
dest.x = dest.y = 0;
|
|
|
|
|
dest.h = 3*16;
|
|
|
|
|
dest.w = gfx.res.x;
|
|
|
|
|
dest.x = dest.y = 0;
|
|
|
|
|
dest.h = 3 * 16;
|
|
|
|
|
dest.w = gfx.res.x;
|
|
|
|
|
gfx_blitupdaterectadd (&dest);
|
|
|
|
|
|
|
|
|
|
bman.players_nr = 0;
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
|
|
|
|
|
|
if (bman.players[i].gfx_nr != -1 && PS_IS_used (bman.players[i].state)) {
|
|
|
|
|
src.x = 3 * bman.players[i].gfx->smal_size.x;
|
|
|
|
|
src.y = 0;
|
|
|
|
|
src.w = dest.w = bman.players[i].gfx->smal_size.x;
|
|
|
|
|
src.h = dest.h = bman.players[i].gfx->smal_size.y;
|
|
|
|
|
|
|
|
|
|
dest.x = x;
|
|
|
|
|
dest.y = j - 4;
|
|
|
|
|
|
|
|
|
|
SDL_BlitSurface (bman.players[i].gfx->smal_image, &src, gfx.screen, &dest);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sprintf (scrtext, "%10s:%2d", bman.players[i].name, bman.players[i].points);
|
|
|
|
|
if (!PS_IS_alife(bman.players[i].state)) { // Player is dead
|
|
|
|
|
if ((bman.players[i].state & PSF_used) != PSF_used)
|
|
|
|
|
font_setcolor (128,128,128,0);
|
|
|
|
|
else
|
|
|
|
|
font_setcolor (0,0,128,0);
|
|
|
|
|
}
|
|
|
|
|
else { // players is alife
|
|
|
|
|
font_setcolor (128,128,255, 0);
|
|
|
|
|
bman.players_nr++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
font_draw (x, j, scrtext, 0);
|
|
|
|
|
|
|
|
|
|
x = x + 170;
|
|
|
|
|
if (x >= gfx.res.x - (120 + 170)) {
|
|
|
|
|
x = 0;
|
|
|
|
|
j = j + font[0].size.x;
|
|
|
|
|
}
|
|
|
|
|
/* 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) {
|
|
|
|
|
|
|
|
|
|
if (bman.players[i].gfx_nr != -1 && PS_IS_used (bman.players[i].state)) {
|
|
|
|
|
src.x = 3 * bman.players[i].gfx->smal_size.x;
|
|
|
|
|
src.y = 0;
|
|
|
|
|
src.w = dest.w = bman.players[i].gfx->smal_size.x;
|
|
|
|
|
src.h = dest.h = bman.players[i].gfx->smal_size.y;
|
|
|
|
|
|
|
|
|
|
dest.x = x;
|
|
|
|
|
dest.y = j - 4;
|
|
|
|
|
|
|
|
|
|
SDL_BlitSurface (bman.players[i].gfx->smal_image, &src, gfx.screen, &dest);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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))
|
|
|
|
|
|
|
|
|
|
sprintf (scrtext, "%10s:%2d", bman.players[i].name, bman.players[i].points);
|
|
|
|
|
if (!PS_IS_alife (bman.players[i].state)) { // Player is dead
|
|
|
|
|
if ((bman.players[i].state & PSF_used) != PSF_used)
|
|
|
|
|
font_setcolor (128, 128, 128, 0);
|
|
|
|
|
else
|
|
|
|
|
font_setcolor (0, 0, 128, 0);
|
|
|
|
|
}
|
|
|
|
|
else { // players is alife
|
|
|
|
|
font_setcolor (128, 128, 255, 0);
|
|
|
|
|
bman.players_nr++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
font_draw (x, j, scrtext, 0);
|
|
|
|
|
|
|
|
|
|
font_setcolor (255,255,255, 0);
|
|
|
|
|
x = x + 170;
|
|
|
|
|
if (x >= gfx.res.x - (120 + 170)) {
|
|
|
|
|
x = 0;
|
|
|
|
|
j = j + font[0].size.x;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
font_setcolor (255, 255, 255, 0);
|
|
|
|
|
x = gfx.res.x - 120;
|
|
|
|
|
sprintf (text, "Bombs: %2d", bman.players[bman.p_nr].bombs_n);
|
|
|
|
|
font_draw (x, 0, text, 0);
|
|
|
|
|
sprintf (text, "Range: %2d", bman.players[bman.p_nr].range);
|
|
|
|
|
font_draw (x, 16, text, 0);
|
|
|
|
|
sprintf (text, "Speed: %2d", bman.players[bman.p_nr].speed);
|
|
|
|
|
font_draw (x, 32, text, 0);
|
|
|
|
|
if (bman.players[bman.p_nr].special.type != 0) {
|
|
|
|
|
dest.x = x - 32;
|
|
|
|
|
dest.y = 16;
|
|
|
|
|
dest.w = gfx.smal_special[bman.players[bman.p_nr].special.type - 1]->w;
|
|
|
|
|
dest.h = gfx.smal_special[bman.players[bman.p_nr].special.type - 1]->h;
|
|
|
|
|
|
|
|
|
|
SDL_BlitSurface (gfx.smal_special[bman.players[bman.p_nr].special.type - 1], NULL, gfx.screen, &dest);
|
|
|
|
|
}
|
|
|
|
|
sprintf (text, "Speed: %2d", bman.players[bman.p_nr].speed);
|
|
|
|
|
font_draw (x, 32, text, 0);
|
|
|
|
|
if (bman.players[bman.p_nr].special.type != 0) {
|
|
|
|
|
dest.x = x - 32;
|
|
|
|
|
dest.y = 16;
|
|
|
|
|
dest.w = gfx.smal_special[bman.players[bman.p_nr].special.type - 1]->w;
|
|
|
|
|
dest.h = gfx.smal_special[bman.players[bman.p_nr].special.type - 1]->h;
|
|
|
|
|
|
|
|
|
|
SDL_BlitSurface (gfx.smal_special[bman.players[bman.p_nr].special.type - 1], NULL,
|
|
|
|
|
gfx.screen, &dest);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bman.state == GS_ready && GT_MP_PTPM)
|
|
|
|
|
font_draw (100, 32, "Press F4 to start the game", 0);
|
|
|
|
@ -122,9 +117,9 @@ game_loop ()
|
|
|
|
|
draw_field ();
|
|
|
|
|
if (GT_MP_PTP)
|
|
|
|
|
net_game_fillsockaddr ();
|
|
|
|
|
SDL_Flip (gfx.screen);
|
|
|
|
|
SDL_Flip (gfx.screen);
|
|
|
|
|
|
|
|
|
|
bman.updatestatusbar = 1; // force an update
|
|
|
|
|
bman.updatestatusbar = 1; // force an update
|
|
|
|
|
timestamp = SDL_GetTicks (); // needed for time sync.
|
|
|
|
|
d_gamedetail ("GAME START");
|
|
|
|
|
draw_players ();
|
|
|
|
@ -174,7 +169,7 @@ game_loop ()
|
|
|
|
|
/* Server is starting the game */
|
|
|
|
|
bman.state = GS_running;
|
|
|
|
|
net_send_servermode ();
|
|
|
|
|
bman.updatestatusbar = 1; // force an update
|
|
|
|
|
bman.updatestatusbar = 1; // force an update
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (event.key.keysym.sym == SDLK_ESCAPE && event.type == SDL_KEYDOWN) {
|
|
|
|
@ -186,13 +181,13 @@ game_loop ()
|
|
|
|
|
restore_players_screen ();
|
|
|
|
|
dead_playerani ();
|
|
|
|
|
player_ilness_loop (bman.p_nr);
|
|
|
|
|
special_loop();
|
|
|
|
|
special_loop ();
|
|
|
|
|
|
|
|
|
|
if ((bman.players[bman.p_nr].state & PSFM_alife) == PSFM_alife)
|
|
|
|
|
move_player (bman.p_nr);
|
|
|
|
|
|
|
|
|
|
if (GT_MP_PTP)
|
|
|
|
|
player_calcpos ();
|
|
|
|
|
if (GT_MP_PTP)
|
|
|
|
|
player_calcpos ();
|
|
|
|
|
|
|
|
|
|
if (bman.gametype != GT_single)
|
|
|
|
|
network_loop ();
|
|
|
|
@ -202,13 +197,15 @@ 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_animation ();
|
|
|
|
|
draw_players ();
|
|
|
|
|
game_draw_info ();
|
|
|
|
|
|
|
|
|
|
/* 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 ((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))
|
|
|
|
|
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))
|
|
|
|
|
gameovertimeout--;
|
|
|
|
|
|
|
|
|
|
if (gameovertimeout <= 0) {
|
|
|
|
@ -217,8 +214,8 @@ game_loop ()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stonelist_draw ();
|
|
|
|
|
gfx_blitdraw ();
|
|
|
|
|
stonelist_draw ();
|
|
|
|
|
gfx_blitdraw ();
|
|
|
|
|
|
|
|
|
|
// calculate time sync.
|
|
|
|
|
timeloop1 = SDL_GetTicks ();
|
|
|
|
@ -249,7 +246,7 @@ game_end ()
|
|
|
|
|
menu_displaytext ("Freeing..", "Please Wait", 32, 128, 32);
|
|
|
|
|
gfx_free_players ();
|
|
|
|
|
tileset_free ();
|
|
|
|
|
snd_free ();
|
|
|
|
|
snd_free ();
|
|
|
|
|
|
|
|
|
|
/* count the points */
|
|
|
|
|
for (i = 0; i < MAX_PLAYERS; i++)
|
|
|
|
|