|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
/* $Id: game.c,v 1.98 2004/10/06 18:16:14 stpohle Exp $
|
|
|
|
|
/* $Id: game.c,v 1.99 2004/10/18 20:20:22 stpohle Exp $
|
|
|
|
|
game.c - procedures for the game. */
|
|
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
@ -159,8 +159,20 @@ 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]) {
|
|
|
|
|
/* Server is starting the game */
|
|
|
|
|
bman.state = GS_running;
|
|
|
|
|
/* Server is starting the game
|
|
|
|
|
* check in multiplayer if all players are ready for the game
|
|
|
|
|
*/
|
|
|
|
|
int i, ready = 1;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_PLAYERS; i++)
|
|
|
|
|
if (NET_CANSEND (i) && !players[i].ready)
|
|
|
|
|
ready = 0;
|
|
|
|
|
|
|
|
|
|
if (ready)
|
|
|
|
|
bman.state = GS_running;
|
|
|
|
|
else
|
|
|
|
|
d_printf ("game_keys_loop: not all players are ready\n");
|
|
|
|
|
|
|
|
|
|
net_send_servermode ();
|
|
|
|
|
bman.updatestatusbar = 1; // force an update
|
|
|
|
|
}
|
|
|
|
@ -220,6 +232,18 @@ game_loop ()
|
|
|
|
|
d_gamedetail ("GAME START");
|
|
|
|
|
draw_players ();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bman.p_nr >= 0 && bman.p_nr < MAX_PLAYERS) {
|
|
|
|
|
players[bman.p_nr].ready = 1;
|
|
|
|
|
if (GT_MP_PTPS)
|
|
|
|
|
send_playerdata (&players[bman.p_servnr].net.addr, bman.p_nr, &players[bman.p_nr]);
|
|
|
|
|
}
|
|
|
|
|
if (bman.p2_nr >= 0 && bman.p2_nr < MAX_PLAYERS) {
|
|
|
|
|
players[bman.p2_nr].ready = 1;
|
|
|
|
|
if (GT_MP_PTPS)
|
|
|
|
|
send_playerdata (&players[bman.p_servnr].net.addr, bman.p2_nr, &players[bman.p2_nr]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (!done && (bman.state == GS_running || bman.state == GS_ready)) {
|
|
|
|
|
if ((eventstate = SDL_PollEvent (&event)) != 0)
|
|
|
|
|
switch (event.type) {
|
|
|
|
@ -474,6 +498,7 @@ game_start ()
|
|
|
|
|
players[p].pos.x = -1;
|
|
|
|
|
players[p].pos.y = -1;
|
|
|
|
|
players[p].tunnelto = 0.0f;
|
|
|
|
|
players[p].ready = 0;
|
|
|
|
|
|
|
|
|
|
/* all types of illnes turn them off */
|
|
|
|
|
for (i = 0; i < PI_max; i++)
|
|
|
|
|