|
|
@ -1,4 +1,5 @@
|
|
|
|
/* game.c - procedures for the game. */
|
|
|
|
/* $Id: game.c,v 1.44 2003/07/25 23:46:25 stpohle Exp $
|
|
|
|
|
|
|
|
game.c - procedures for the game. */
|
|
|
|
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <SDL.h>
|
|
|
|
#include <SDL.h>
|
|
|
@ -287,24 +288,85 @@ void game_showresult () {
|
|
|
|
char text[255];
|
|
|
|
char text[255];
|
|
|
|
SDL_Event event;
|
|
|
|
SDL_Event event;
|
|
|
|
Uint8 *keys;
|
|
|
|
Uint8 *keys;
|
|
|
|
int done = 0, keypressed = 0, x, y;
|
|
|
|
int done = 0, keypressed = 0, x, y, i, p;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
menu_displaytext ("Loading..", "Please Wait", 32, 128, 32);
|
|
|
|
|
|
|
|
dest.x = dest.y = 0;
|
|
|
|
|
|
|
|
dest.w = gfx.res.x;
|
|
|
|
|
|
|
|
dest.h = gfx.res.y;
|
|
|
|
|
|
|
|
gfx_load_players (64, 64);
|
|
|
|
|
|
|
|
|
|
|
|
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 = 64;
|
|
|
|
y = 0;
|
|
|
|
|
|
|
|
font_setcolor (128, 128, 0, 2);
|
|
|
|
|
|
|
|
font_drawbold (x, y, text, 2, 2);
|
|
|
|
|
|
|
|
font_setcolor (255, 255, 128, 2);
|
|
|
|
|
|
|
|
font_draw (x, y, text, 2);
|
|
|
|
|
|
|
|
y += font[2].size.x;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 1, p = 0; p < MAX_PLAYERS; p++)
|
|
|
|
|
|
|
|
if (PS_IS_alife (bman.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_setcolor (128, 128, 0, 2);
|
|
|
|
font_setcolor (128, 128, 0, 2);
|
|
|
|
font_draw (x - 2, y, text, 2);
|
|
|
|
font_drawbold (x, y, text, 2, 2);
|
|
|
|
font_draw (x + 2, y, text, 2);
|
|
|
|
|
|
|
|
font_draw (x, y - 2, text, 2);
|
|
|
|
|
|
|
|
font_draw (x, y + 2, text, 2);
|
|
|
|
|
|
|
|
font_setcolor (255, 255, 128, 2);
|
|
|
|
font_setcolor (255, 255, 128, 2);
|
|
|
|
font_draw (x, y, text, 2);
|
|
|
|
font_draw (x, y, text, 2);
|
|
|
|
|
|
|
|
y += font[2].size.x + 8;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strcpy (text, "Hit [CTRL], [RETURN] or [STRG]");
|
|
|
|
|
|
|
|
x = (gfx.res.x - (font[1].size.x * strlen (text)) - 64) / 2;
|
|
|
|
|
|
|
|
font_setcolor (128, 128, 0, 1);
|
|
|
|
|
|
|
|
font_drawbold (x, gfx.res.y - font[1].size.y - 2, text, 1, 1);
|
|
|
|
|
|
|
|
font_setcolor (255, 255, 128, 1);
|
|
|
|
|
|
|
|
font_draw (x, gfx.res.y - font[1].size.y - 2, text, 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 1, p = 0; p < MAX_PLAYERS; p++) {
|
|
|
|
|
|
|
|
if (PS_IS_used (bman.players[p].state)) {
|
|
|
|
|
|
|
|
if (!i) {
|
|
|
|
|
|
|
|
i = 1;
|
|
|
|
|
|
|
|
x = (gfx.res.x / 2) + 16;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (i) {
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
|
|
|
|
y = y + 80;
|
|
|
|
|
|
|
|
x = 16;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
font_setcolor (128, 128, 128, 0);
|
|
|
|
|
|
|
|
font_drawbold (x + 80, y + 4, bman.players[p].name, 0, 2);
|
|
|
|
|
|
|
|
if (PS_IS_alife (bman.players[p].state))
|
|
|
|
|
|
|
|
font_setcolor (255, 255, 0, 0);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
font_setcolor (196, 196, 196, 0);
|
|
|
|
|
|
|
|
font_draw (x + 80, y + 4, bman.players[p].name, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sprintf (text, "%3d", bman.players[p].wins);
|
|
|
|
|
|
|
|
font_draw (x + 80 + (LEN_PLAYERNAME+2) * font[0].size.x, y + 4, text, 0);
|
|
|
|
|
|
|
|
sprintf (text, "%3d", bman.players[p].points);
|
|
|
|
|
|
|
|
font_draw (x + 80 + (LEN_PLAYERNAME+5) * font[0].size.x, y + 4, text, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dest.x = x;
|
|
|
|
|
|
|
|
dest.y = y;
|
|
|
|
|
|
|
|
src.w = dest.w = bman.players[p].gfx->ani.w;
|
|
|
|
|
|
|
|
src.h = dest.h = bman.players[p].gfx->ani.h;
|
|
|
|
|
|
|
|
src.x = bman.players[p].gfx->ani.w * down;
|
|
|
|
|
|
|
|
src.y = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
gfx_blitdraw ();
|
|
|
|
gfx_blitdraw ();
|
|
|
|
SDL_Flip (gfx.screen);
|
|
|
|
SDL_Flip (gfx.screen);
|
|
|
|
|
|
|
|
gfx_free_players ();
|
|
|
|
|
|
|
|
|
|
|
|
while (!done) {
|
|
|
|
while (!done) {
|
|
|
|
/* do the keyboard handling */
|
|
|
|
/* do the keyboard handling */
|
|
|
|
if (SDL_PollEvent (&event) != 0)
|
|
|
|
if (SDL_PollEvent (&event) != 0)
|
|
|
|