First part of new multi selection screen

origin
patty21 21 years ago
parent c5234efcce
commit 8dd337ba74

@ -1,4 +1,4 @@
/* $Id: multiwait.c,v 1.45 2004/09/25 10:57:51 stpohle Exp $ /* $Id: multiwait.c,v 1.46 2004/09/25 11:17:38 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
*/ */
@ -18,15 +18,62 @@ extern int blitdb_nr;
static int mw_num_readyplayers; // number of players who are ready static int mw_num_readyplayers; // number of players who are ready
static int mw_num_players_x; // number of players in the x static int mw_num_players_x; // number of players in the x
static int mw_num_players_y; // number of players in the y static int mw_num_players_y; // number of players in the y
static int mw_num_players;
_point mw_pos[MAX_PLAYERS];
#define MW_PLAYERSCR_X 250 #define MW_PLAYERSCR_X 250
#define MW_PLAYERSCR_Y 64 #define MW_PLAYERSCR_Y 64
#define MW_TITLE_Y 50 #define MW_TITLE_Y 50
/* Calcs the position of all items on the screen */
int mw_calc_screen() {
int i,cy,
plnum=0;
for (i = 0; i < MAX_PLAYERS; i++) {
if (PS_IS_used (players[i].state)) plnum++;
}
if (plnum!=mw_num_players) {
if (bman.gametype==GT_team) {
mw_num_players_x=2;
mw_num_players_y=2; // needs to be fixed (calculated separately)
cy=gfx.res.y/2;
}
else
{
if (mw_num_players*2>MAX_PLAYERS) {
mw_num_players_x=2;
}
else
{
mw_num_players_x=1;
}
mw_num_players_y=ceil(mw_num_players/mw_num_players_x);
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].y=floorf(i/mw_num_players_x)*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);
draw_logo ();
chat_show (8, cy, gfx.res.x - 16, gfx.res.y - (8 + cy));
chat.active = 1;
return 1;
}
return 0;
}
/* this will load some graphics and so other stuff */ /* this will load some graphics and so other stuff */
void void
mw_init () mw_init ()
{ {
int i;
draw_logo (); draw_logo ();
menu_displaytext ("Please Wait", "Loading GFX Data"); menu_displaytext ("Please Wait", "Loading GFX Data");
@ -36,18 +83,8 @@ mw_init ()
bman.updatestatusbar = 1; bman.updatestatusbar = 1;
gfx_blitdraw (); gfx_blitdraw ();
draw_logo (); mw_num_players=-1;
mw_calc_screen();
/*
* do some calculations to setup everything on the screen
*/
mw_num_players_x = gfx.res.x / MW_PLAYERSCR_X;
mw_num_players_y = ceil ((float)MAX_PLAYERS / (float)mw_num_players_x);
d_printf ("mw_num_players_x : %d, mw_num_players_y : %d\n", mw_num_players_x, mw_num_players_y);
chat_show (8, MW_TITLE_Y + MW_PLAYERSCR_Y * mw_num_players_y, gfx.res.x - 16, gfx.res.y - (8 + MW_TITLE_Y + MW_PLAYERSCR_Y * mw_num_players_y));
chat.active = 1;
}; };
@ -81,7 +118,7 @@ void mw_check_players () {
/* /*
* draw only the givin player * draw only the given player
*/ */
void mw_draw_player (_player *player, int pos) { void mw_draw_player (_player *player, int pos) {
_point p; _point p;
@ -89,8 +126,8 @@ void mw_draw_player (_player *player, int pos) {
SDL_Rect src; SDL_Rect src;
SDL_Rect dest; SDL_Rect dest;
p.x = ((pos % mw_num_players_x) * MW_PLAYERSCR_X) + (gfx.res.x - mw_num_players_x * MW_PLAYERSCR_X) / 2; p.x = mw_pos[pos].x;
p.y = (pos / mw_num_players_x) * MW_PLAYERSCR_Y + MW_TITLE_Y; p.y = mw_pos[pos].y;
if (PS_IS_used (player->state)) { if (PS_IS_used (player->state)) {
/* /*

Loading…
Cancel
Save