2nd part of new multi selection screen

origin
patty21 21 years ago
parent 8dd337ba74
commit db71d25050

@ -1,4 +1,4 @@
/* $Id: multiwait.c,v 1.46 2004/09/25 11:17:38 patty21 Exp $ /* $Id: multiwait.c,v 1.47 2004/09/25 11:48:36 patty21 Exp $
multiwait.c - this manages only the network screen where multiwait.c - this manages only the network screen where
everyone have to select it's players and where even the basic chat is inside everyone have to select it's players and where even the basic chat is inside
*/ */
@ -36,6 +36,7 @@ int mw_calc_screen() {
} }
if (plnum!=mw_num_players) { if (plnum!=mw_num_players) {
mw_num_players=plnum;
if (bman.gametype==GT_team) { if (bman.gametype==GT_team) {
mw_num_players_x=2; mw_num_players_x=2;
mw_num_players_y=2; // needs to be fixed (calculated separately) mw_num_players_y=2; // needs to be fixed (calculated separately)
@ -52,13 +53,14 @@ int mw_calc_screen() {
} }
mw_num_players_y=ceil(mw_num_players/mw_num_players_x); mw_num_players_y=ceil(mw_num_players/mw_num_players_x);
for(i=0;i<mw_num_players;i++) { for(i=0;i<mw_num_players;i++) {
mw_pos[i].x=gfx.res.x/2/mw_num_players_x+(i%mw_num_players_x)*gfx.res.x/4; mw_pos[i].x=gfx.res.x/2/mw_num_players_x+(i%mw_num_players_x)*gfx.res.x/4-MW_PLAYERSCR_X/2;
mw_pos[i].y=floorf(i/mw_num_players_x)*MW_PLAYERSCR_Y; mw_pos[i].y=floorf(i/mw_num_players_x)*MW_PLAYERSCR_Y;
d_printf("mw_Position: x=%d, y=%d\n ",mw_pos[i].x,mw_pos[i].y);
} }
cy=(mw_num_players_y+1)*MW_PLAYERSCR_Y; cy=(mw_num_players_y+1)*MW_PLAYERSCR_Y;
} }
d_printf ("mw_num_players_x : %d, mw_num_players_y : %d\n", mw_num_players_x, mw_num_players_y); d_printf ("mw_num_players_x : %d, mw_num_players_y : %d mw_players:%d\n", mw_num_players_x, mw_num_players_y,mw_num_players);
draw_logo (); draw_logo ();
chat_show (8, cy, gfx.res.x - 16, gfx.res.y - (8 + cy)); chat_show (8, cy, gfx.res.x - 16, gfx.res.y - (8 + cy));
chat.active = 1; chat.active = 1;
@ -184,12 +186,19 @@ void mw_clear_playerscreen () {
* draw all player informations * draw all player informations
*/ */
void mw_draw_all_player () { void mw_draw_all_player () {
int i; int i,j,h;
int n[MAX_PLAYERS];
mw_clear_playerscreen (); mw_clear_playerscreen ();
for(i=0;i<MAX_PLAYERS;i++) n[i]=i;
for(i=0;i<MAX_PLAYERS;i++)
for(j=i;j<MAX_PLAYERS;j++)
if (players[i].wins>players[j].wins) {
h=n[i];n[i]=n[j];n[j]=h;
}
for (i = 0; i < MAX_PLAYERS; i++) { /* we do not sort the players */ for (i = 0; i < MAX_PLAYERS; i++) { /* we do not sort the players */
mw_draw_player (&players[i], i); if (PS_IS_used (players[i].state)) {
mw_draw_player (&players[i], n[i]);
}
} }
}; };
@ -210,6 +219,7 @@ void mw_keys_loop () {
SDL_WM_ToggleFullScreen(gfx.screen); SDL_WM_ToggleFullScreen(gfx.screen);
gfx.fullscreen = !gfx.fullscreen; gfx.fullscreen = !gfx.fullscreen;
bman.updatestatusbar = 1; // force an update bman.updatestatusbar = 1; // force an update
mw_num_players=-1;
} }
if (keyb_gamekeys.state[BCK_esc] && !keyb_gamekeys.old[BCK_esc]) { if (keyb_gamekeys.state[BCK_esc] && !keyb_gamekeys.old[BCK_esc]) {
@ -222,6 +232,7 @@ void mw_keys_loop () {
/* player 1 want to select a new gfx */ /* player 1 want to select a new gfx */
playermenu_selgfx (bman.p_nr); playermenu_selgfx (bman.p_nr);
net_change_playerid (bman.p_nr, 1); net_change_playerid (bman.p_nr, 1);
mw_num_players=-1;
keyb_loop (NULL); // to reload the current keys keyb_loop (NULL); // to reload the current keys
} }
@ -229,18 +240,21 @@ void mw_keys_loop () {
/* player 2 want to select a new gfx */ /* player 2 want to select a new gfx */
playermenu_selgfx (bman.p2_nr); playermenu_selgfx (bman.p2_nr);
net_change_playerid (bman.p2_nr, 1); net_change_playerid (bman.p2_nr, 1);
mw_num_players=-1;
keyb_loop (NULL); // to reload the current keys keyb_loop (NULL); // to reload the current keys
} }
if (keyb_gamekeys.state[BCK_mapmenu] && !keyb_gamekeys.old[BCK_mapmenu] && GT_MP_PTPM) { if (keyb_gamekeys.state[BCK_mapmenu] && !keyb_gamekeys.old[BCK_mapmenu] && GT_MP_PTPM) {
/* mapmenu */ /* mapmenu */
mapmenu (); mapmenu ();
mw_num_players=-1;
keyb_loop (NULL); // to reload the current keys keyb_loop (NULL); // to reload the current keys
} }
if (keyb_gamekeys.state[BCK_playermenu] && !keyb_gamekeys.old[BCK_playermenu]) { if (keyb_gamekeys.state[BCK_playermenu] && !keyb_gamekeys.old[BCK_playermenu]) {
/* playermenu */ /* playermenu */
playermenu (); playermenu ();
mw_num_players=-1;
keyb_loop (NULL); // to reload the current keys keyb_loop (NULL); // to reload the current keys
} }
}; };
@ -252,6 +266,8 @@ void wait_for_players () {
SDL_Event event; SDL_Event event;
mw_init (); mw_init ();
mw_calc_screen();
mw_draw_all_player ();
do { do {
if (SDL_PollEvent (&event) != 0) if (SDL_PollEvent (&event) != 0)
@ -270,7 +286,7 @@ void wait_for_players () {
/* /*
* the drawing stuff * the drawing stuff
*/ */
mw_draw_all_player (); if (mw_calc_screen()) {mw_draw_all_player ();}
gfx_blitdraw (); gfx_blitdraw ();
/* /*

Loading…
Cancel
Save