Player Selection CPU Usage Bug fixed

origin
stpohle 23 years ago
parent 5e870aa465
commit 832a292f0a

@ -14,7 +14,8 @@
extern int UpdateRects_nr; extern int UpdateRects_nr;
static int mw_y = 0, static int mw_player = 0,
mw_chat = 0,
mw_frame = 0, mw_frame = 0,
mw_frameto = 0; mw_frameto = 0;
static SDL_Surface *mw_plgfx[MAX_PLAYERS]; static SDL_Surface *mw_plgfx[MAX_PLAYERS];
@ -41,6 +42,8 @@ mw_init ()
SDL_FreeSurface (tmp); SDL_FreeSurface (tmp);
network_loop (); network_loop ();
} }
bman.updatestatusbar = 1;
}; };
@ -124,7 +127,7 @@ mw_draw_status ()
y += 32; y += 32;
} }
mw_y = y; mw_player = y;
}; };
@ -146,7 +149,7 @@ mw_draw_gfxselect (int selgfx)
dest.h = src.h = gfx.players[i].size.y; dest.h = src.h = gfx.players[i].size.y;
dest.x = i * xstep + (xstep >> 1) - (gfx.players[i].size.x >> 1); dest.x = i * xstep + (xstep >> 1) - (gfx.players[i].size.x >> 1);
dest.y = mw_y + 8; dest.y = mw_player + 8;
redraw_logo (dest.x, dest.y, dest.w, dest.h); redraw_logo (dest.x, dest.y, dest.w, dest.h);
@ -187,7 +190,7 @@ mw_draw_gfxselect (int selgfx)
dest.h = src.h = gfx.players[i].size.y; dest.h = src.h = gfx.players[i].size.y;
dest.x = i * xstep + (xstep >> 1) - (gfx.players[i].size.x >> 1); dest.x = i * xstep + (xstep >> 1) - (gfx.players[i].size.x >> 1);
dest.y = mw_y + 8; dest.y = mw_player + 8;
redraw_logo (dest.x, dest.y, dest.w, dest.h); redraw_logo (dest.x, dest.y, dest.w, dest.h);
@ -209,7 +212,7 @@ mw_draw_gfxselect (int selgfx)
} }
} }
mw_y += 8 + gfx.players[0].size.y; mw_chat = mw_player + 8 + gfx.players[0].size.y;
} }
@ -217,7 +220,7 @@ void
mw_draw_chat () mw_draw_chat ()
{ {
if (chat.visible == 0) { if (chat.visible == 0) {
chat_show (16, mw_y + 16, gfx.res.x - 16, gfx.res.y - 32); chat_show (16, mw_chat + 16, gfx.res.x - 16, gfx.res.y - 32);
chat_addline ("Press [STRG] or [CTRL] - to select a player"); chat_addline ("Press [STRG] or [CTRL] - to select a player");
if (GT_MP_PTPM) if (GT_MP_PTPM)
chat_addline ("F4 - to start the game"); chat_addline ("F4 - to start the game");
@ -266,9 +269,13 @@ wait_for_players ()
SDL_Flip (gfx.screen); SDL_Flip (gfx.screen);
} }
else { /* we have a connect so draw status */ else { /* we have a connect so draw status */
if (bman.updatestatusbar) {
mw_draw_status (); mw_draw_status ();
gfx_AddUpdateRect (0, 0, gfx.res.x, mw_player);
bman.updatestatusbar = 0;
}
mw_draw_gfxselect (selgfx); mw_draw_gfxselect (selgfx);
gfx_AddUpdateRect (0, 0, gfx.res.x, mw_y); gfx_AddUpdateRect (0, mw_player, gfx.res.x, mw_chat);
mw_draw_chat (); mw_draw_chat ();
} }
@ -336,19 +343,22 @@ wait_for_players ()
bman.players[bman.p_nr].gfx_nr = -1; bman.players[bman.p_nr].gfx_nr = -1;
} }
net_change_playerid (bman.p_nr, 1); net_change_playerid (bman.p_nr, 1);
bman.updatestatusbar = 1;
} }
if ((GT_MP_PTPM) && ready && keys[SDLK_F4] && (!keypressed)) { if ((GT_MP_PTPM) && ready && keys[SDLK_F4] && (!keypressed)) {
done = 1; done = 1;
bman.updatestatusbar = 1;
} }
if ((GT_MP_PTPM) && keys[SDLK_F5] && (!keypressed)) { if ((GT_MP_PTPM) && keys[SDLK_F5] && (!keypressed)) {
/* Map modification */ /* Map modification */
mapmenu (); mapmenu ();
draw_logo();
mw_draw_status (); mw_draw_status ();
mw_draw_gfxselect (selgfx); mw_draw_gfxselect (selgfx);
UpdateRects_nr = 0; UpdateRects_nr = 0;
gfx_AddUpdateRect (0, 0, gfx.res.x, mw_y); gfx_AddUpdateRect (0, 0, gfx.res.x, gfx.res.y);
chat.changed = 1; chat.changed = 1;
chat.lineschanged = 1; chat.lineschanged = 1;
chat_drawbox (); chat_drawbox ();

@ -171,7 +171,6 @@ do_playerid (struct pkg_playerid *p_id, _net_addr * addr)
for (j = 0, i = 0; i < bman.maxplayer; i++) for (j = 0, i = 0; i < bman.maxplayer; i++)
if (PS_IS_used (bman.players[i].state)) if (PS_IS_used (bman.players[i].state))
j++; j++;
bman.updatestatusbar = 1;
if (bman.notifygamemaster) if (bman.notifygamemaster)
gamesrv_sendmode (bman.maxplayer, j); gamesrv_sendmode (bman.maxplayer, j);
} }
@ -192,6 +191,8 @@ do_playerid (struct pkg_playerid *p_id, _net_addr * addr)
net_change_playerid (addr->pl_nr, (GT_MP_PTPM)); net_change_playerid (addr->pl_nr, (GT_MP_PTPM));
d_playerdetail ("*** PLAYER List ***"); d_playerdetail ("*** PLAYER List ***");
bman.updatestatusbar = 1;
}; };

Loading…
Cancel
Save