diff --git a/src/multiwait.c b/src/multiwait.c index 133839c..c654e59 100644 --- a/src/multiwait.c +++ b/src/multiwait.c @@ -1,4 +1,4 @@ -/* $Id: multiwait.c,v 1.47 2004/09/25 11:48:36 patty21 Exp $ +/* $Id: multiwait.c,v 1.48 2004/09/26 20:34:57 patty21 Exp $ multiwait.c - this manages only the network screen where everyone have to select it's players and where even the basic chat is inside */ @@ -21,8 +21,8 @@ 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_Y 64 +#define MW_PLAYERSCR_X 310 +#define MW_PLAYERSCR_Y 50 #define MW_TITLE_Y 50 /* Calcs the position of all items on the screen */ @@ -35,7 +35,7 @@ int mw_calc_screen() { if (PS_IS_used (players[i].state)) plnum++; } - if (plnum!=mw_num_players) { + if (plnum!=mw_num_players || bman.updatestatusbar) { mw_num_players=plnum; if (bman.gametype==GT_team) { mw_num_players_x=2; @@ -46,24 +46,25 @@ int mw_calc_screen() { { if (mw_num_players*2>MAX_PLAYERS) { mw_num_players_x=2; + mw_num_players_y=floorf(mw_num_players/2)+mw_num_players%2; } else { mw_num_players_x=1; + mw_num_players_y=mw_num_players; } - mw_num_players_y=ceil(mw_num_players/mw_num_players_x); for(i=0;igfx_nr >= 0 && player->gfx_nr < MAX_PLAYERS) { + if (player->gfx_nr >= 0 && player->gfx_nr < gfx.player_gfx_count) { /* player is used and selected a gfx */ dest.x = p.x; - dest.y = p.y + (MW_PLAYERSCR_Y - GFX_IMGSIZE) / 2; - src.w = dest.w = gfx.players[player->gfx_nr].menu_image->w; - src.h = dest.h = gfx.players[player->gfx_nr].menu_image->h; src.x = 0; src.y = 0; + + if (p_nr==bman.p_nr) { + /* player 1 */ + dest.y = p.y; + src.w = dest.w = gfx.players[player->gfx_nr].menu_image->w; + src.h = dest.h = gfx.players[player->gfx_nr].menu_image->h; gfx_blit (gfx.players[player->gfx_nr].menu_image, &src, gfx.screen, &dest, 10001); + + } else if (p_nr==bman.p2_nr) { + /* player 2 */ + dest.x=p.x+MW_PLAYERSCR_X-64; + dest.y = p.y; + src.w = dest.w = gfx.players[player->gfx_nr].menu_image->w; + src.h = dest.h = gfx.players[player->gfx_nr].menu_image->h; + gfx_blit (gfx.players[player->gfx_nr].menu_image, &src, gfx.screen, &dest, 10001); + } else { + /* net-player */ + dest.x=p.x+35; + dest.y = p.y + 15; + src.w = dest.w = gfx.players[player->gfx_nr].small_image->w; + src.h = dest.h = gfx.players[player->gfx_nr].small_image->h; + gfx_blit (gfx.players[player->gfx_nr].small_image, &src, gfx.screen, &dest, 10001); + } } - font_gfxdraw (p.x + GFX_IMGSIZE, p.y, player->name, 2, COLOR_yellow, 10002); + font_gfxdraw (p.x + GFX_IMGSIZE, p.y, player->name, 1, COLOR_yellow, 10002); sprintf (text,"Victorys:%2d(%d)", player->wins, player->points); font_gfxdraw (p.x + GFX_IMGSIZE, p.y + font[2].size.y - 4, text, 0, COLOR_white, 10002); if (debug && PS_IS_used (player->state)) { sprintf (text, "%s:%s [%d]", player->net.addr.host, player->net.addr.port, player->state); if (player->net.flags & NETF_firewall) - sprintf (text,"%s Firewall", text); + sprintf (text,"%s FW", text); font_gfxdraw (p.x + GFX_IMGSIZE, p.y + font[0].size.y + font[2].size.y - 4, text, 0, COLOR_white, 10002); } } @@ -188,18 +209,20 @@ void mw_clear_playerscreen () { void mw_draw_all_player () { int i,j,h; int n[MAX_PLAYERS]; - mw_clear_playerscreen (); for(i=0;iplayers[j].wins) { - h=n[i];n[i]=n[j];n[j]=h; - } + for(i=0;iplayers[j].wins) { + h=n[i];n[i]=n[j];n[j]=h; + } + j=0; for (i = 0; i < MAX_PLAYERS; i++) { /* we do not sort the players */ - if (PS_IS_used (players[i].state)) { - mw_draw_player (&players[i], n[i]); + if (PS_IS_used (players[n[i]].state)) { + mw_draw_player (n[i], j); + j++; } } + gfx_blitdraw(); };