|
|
@ -18,18 +18,16 @@ game_draw_info ()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int i,
|
|
|
|
int i,
|
|
|
|
x,
|
|
|
|
x,
|
|
|
|
j,
|
|
|
|
j;
|
|
|
|
gfx_oldRects;
|
|
|
|
|
|
|
|
char text[255];
|
|
|
|
char text[255];
|
|
|
|
char scrtext[255];
|
|
|
|
char scrtext[255];
|
|
|
|
SDL_Rect src, dest;
|
|
|
|
SDL_Rect src, dest;
|
|
|
|
|
|
|
|
|
|
|
|
redraw_logo (0, 0, gfx.res.x, 3*16);
|
|
|
|
redraw_logo (0, 0, gfx.res.x, 3*16);
|
|
|
|
gfx_AddUpdateRect (0,0, gfx.res.x, 3*16);
|
|
|
|
if (bman.updatestatusbar) {gfx_AddUpdateRect (0,0, gfx.res.x, 3*16);bman.updatestatusbar=0;}
|
|
|
|
gfx_oldRects = UpdateRects_nr;
|
|
|
|
|
|
|
|
bman.players_nr = 0;
|
|
|
|
bman.players_nr = 0;
|
|
|
|
|
|
|
|
|
|
|
|
/* draw Player names */
|
|
|
|
/* draw Player names */
|
|
|
|
if (GT_MP_PTP) {
|
|
|
|
if (GT_MP_PTP) {
|
|
|
|
for (x = 0, j = 0, i = 0; i < MAX_PLAYERS; i++)
|
|
|
|
for (x = 0, j = 0, i = 0; i < MAX_PLAYERS; i++)
|
|
|
|
if ((bman.players[i].state & PSFM_used) != 0) {
|
|
|
|
if ((bman.players[i].state & PSFM_used) != 0) {
|
|
|
@ -78,28 +76,29 @@ game_draw_info ()
|
|
|
|
draw_text (100, 32, "Press F4 to start the game", 1);
|
|
|
|
draw_text (100, 32, "Press F4 to start the game", 1);
|
|
|
|
else if (bman.state == GS_ready)
|
|
|
|
else if (bman.state == GS_ready)
|
|
|
|
draw_text (100, 32, "Waiting for the Server to Start", 1);
|
|
|
|
draw_text (100, 32, "Waiting for the Server to Start", 1);
|
|
|
|
gfx_AddUpdateRect (100, 32, gfx.res.x - 100, 16);
|
|
|
|
// 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);
|
|
|
|
redraw_logo (0, gfx.res.y - gfx.font.size.y, gfx.res.x, gfx.res.y);
|
|
|
|
for (x = 0; x < bman.fieldsize.x; x++)
|
|
|
|
|
|
|
|
draw_stone (x, bman.fieldsize.y-1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (debug) { /* do some debug informations on the screen */
|
|
|
|
if (debug) { /* do some debug informations on the screen */
|
|
|
|
|
|
|
|
for (x = 0; x < bman.fieldsize.x; x++)
|
|
|
|
|
|
|
|
draw_stone (x, bman.fieldsize.y-1);
|
|
|
|
|
|
|
|
if (GT_MP_PTP) {
|
|
|
|
sprintf (text, "NET_STAT: [");
|
|
|
|
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);
|
|
|
|
sprintf (text, "%s%3d ", text, bman.players[i].net.pkgopt.send_set);
|
|
|
|
text[strlen(text)+1] = 0;
|
|
|
|
text[strlen(text)+1] = 0;
|
|
|
|
text[strlen(text)] = ']';
|
|
|
|
text[strlen(text)] = ']';
|
|
|
|
sprintf (text, "%s GFX_RECTS:%d", text, UpdateRects_nr);
|
|
|
|
|
|
|
|
draw_text (0, gfx.res.y - (gfx.font.size.y << 1), text, 1);
|
|
|
|
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 Timediff: %d", gfx.tileset, timediff);
|
|
|
|
|
|
|
|
sprintf (text, "%s GFX_RECTS:%d", text, UpdateRects_nr);
|
|
|
|
draw_text (0, gfx.res.y - gfx.font.size.y, text, 1);
|
|
|
|
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);
|
|
|
|
gfx_AddUpdateRect (0, gfx.res.y - (gfx.font.size.y << 1), gfx.res.x, gfx.font.size.y << 1);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (chat.visible == 0) {
|
|
|
|
if (chat.visible == 0 && GT_MP_PTP) {
|
|
|
|
SDL_Flip (gfx.screen);
|
|
|
|
|
|
|
|
chat_show (4, 3*16, gfx.res.x - 4, gfx.offset.y);
|
|
|
|
chat_show (4, 3*16, gfx.res.x - 4, gfx.offset.y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -112,7 +111,8 @@ game_loop ()
|
|
|
|
Uint8 *keys;
|
|
|
|
Uint8 *keys;
|
|
|
|
int done = 0;
|
|
|
|
int done = 0;
|
|
|
|
Uint32 timeloop1;
|
|
|
|
Uint32 timeloop1;
|
|
|
|
int gameovertimeout = TIME_FACTOR * 5; // gameovertimeout
|
|
|
|
int move=0;
|
|
|
|
|
|
|
|
int gameovertimeout = TIME_FACTOR * 5; // gameovertimeout
|
|
|
|
unsigned char key_bomb = 0; // last state of the bomb key
|
|
|
|
unsigned char key_bomb = 0; // last state of the bomb key
|
|
|
|
|
|
|
|
|
|
|
|
draw_logo ();
|
|
|
|
draw_logo ();
|
|
|
@ -125,7 +125,7 @@ game_loop ()
|
|
|
|
timestamp = SDL_GetTicks (); // needed for time sync.
|
|
|
|
timestamp = SDL_GetTicks (); // needed for time sync.
|
|
|
|
|
|
|
|
|
|
|
|
d_gamedetail ("GAME START");
|
|
|
|
d_gamedetail ("GAME START");
|
|
|
|
|
|
|
|
draw_players();
|
|
|
|
while (!done && (bman.state == GS_running || bman.state == GS_ready)) {
|
|
|
|
while (!done && (bman.state == GS_running || bman.state == GS_ready)) {
|
|
|
|
if (SDL_PollEvent (&event) != 0)
|
|
|
|
if (SDL_PollEvent (&event) != 0)
|
|
|
|
switch (event.type) {
|
|
|
|
switch (event.type) {
|
|
|
@ -176,18 +176,15 @@ game_loop ()
|
|
|
|
bman.state = GS_startup;
|
|
|
|
bman.state = GS_startup;
|
|
|
|
done = 1;
|
|
|
|
done = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
move=bman.players[bman.p_nr].m;
|
|
|
|
chat_loop (&event);
|
|
|
|
chat_loop (&event);
|
|
|
|
|
|
|
|
if (move ||dead_playerani () || GT_MP_PTP) restore_players_screen ();
|
|
|
|
restore_players_screen ();
|
|
|
|
|
|
|
|
restore_bomb_screen ();
|
|
|
|
|
|
|
|
player_ilness_loop ();
|
|
|
|
player_ilness_loop ();
|
|
|
|
if ((bman.players[bman.p_nr].state & PSFM_alife) == PSFM_alife)
|
|
|
|
if ((bman.players[bman.p_nr].state & PSFM_alife) == PSFM_alife)
|
|
|
|
move_player ();
|
|
|
|
move_player ();
|
|
|
|
|
|
|
|
|
|
|
|
player_calcpos ();
|
|
|
|
player_calcpos ();
|
|
|
|
dead_playerani (); /* we need it to draw dead players */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bman.gametype != GT_single)
|
|
|
|
if (bman.gametype != GT_single)
|
|
|
|
network_loop ();
|
|
|
|
network_loop ();
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -195,11 +192,10 @@ game_loop ()
|
|
|
|
|
|
|
|
|
|
|
|
/* this will even set the variable "bman.player_nr"
|
|
|
|
/* this will even set the variable "bman.player_nr"
|
|
|
|
to let us know how much Players are still left */
|
|
|
|
to let us know how much Players are still left */
|
|
|
|
game_draw_info ();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bomb_loop ();
|
|
|
|
if (bomb_loop () || move || GT_MP_PTP) draw_players ();
|
|
|
|
draw_players ();
|
|
|
|
move=0;
|
|
|
|
|
|
|
|
game_draw_info ();
|
|
|
|
gfx_UpdateRects ();
|
|
|
|
gfx_UpdateRects ();
|
|
|
|
|
|
|
|
|
|
|
|
/* 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
|
|
|
@ -212,7 +208,7 @@ game_loop ()
|
|
|
|
gameovertimeout--;
|
|
|
|
gameovertimeout--;
|
|
|
|
|
|
|
|
|
|
|
|
if (gameovertimeout <= 0) {
|
|
|
|
if (gameovertimeout <= 0) {
|
|
|
|
d_printf ("GAME: Game Over 'Cause only one or noone anymore alife\n");
|
|
|
|
d_printf ("GAME: Game Over 'Cause only one or none anymore alife\n");
|
|
|
|
done = 1;
|
|
|
|
done = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|