fixed menus so it's now able to show them up in the multiplayer game

origin
stpohle 23 years ago
parent 05882d4c42
commit 5ac7684d32

@ -106,7 +106,8 @@ module.source.files=\
chat.h\
keybinput.c\
keybinput.h\
single.c
single.c\
sysfunc.h
module.pixmap.name=pixmaps
module.pixmap.type=

@ -43,7 +43,8 @@
#define LEN_SERVERNAME 41
#define LEN_PORT 6
#define LEN_GAMENAME 32
#define LEN_PATHFILENAME 512
#define LEN_FILENAME 256
#define DEFAULT_UDPPORT 11000
#define DEFAULT_GMUDPPORT "11100"

@ -32,6 +32,7 @@ game_init ()
bman.maxplayer = MAX_PLAYERS;
bman.net_ai_family = PF_INET;
bman.sock = -1;
bman.gamename[0] = 0;
sprintf (bman.port, "%d", DEFAULT_UDPPORT);
sprintf (bman.gamemaster, DEFAULT_GAMEMASTER);

@ -1,4 +1,4 @@
/* $Id: menu.c,v 1.5 2003/05/04 21:00:30 ob1kenewb Exp $ */
/* $Id: menu.c,v 1.6 2003/05/06 12:25:30 stpohle Exp $ */
/* menu's for the game */
#include <SDL.h>
@ -115,19 +115,20 @@ menu_loop (char *menutitle, _menu menu[], int lastselect)
by;
draw_logo ();
draw_menu (menutitle, menu, &bx, &by);
SDL_Flip (gfx.screen);
for (lastentry = 0; menu[lastentry].index != -1; lastentry++);
while ((!done || keypressed == 1) && bman.state != GS_quit) {
draw_select (menuselect, menu, bx, by);
SDL_Flip (gfx.screen);
if (SDL_WaitEvent (&event) != 0)
/* do the network loop if we have to */
if (bman.gametype == GT_multi && bman.sock != -1)
network_loop ();
if (SDL_PollEvent (&event) != 0)
switch (event.type) {
case (SDL_QUIT):
menuselect = -1;
@ -137,19 +138,22 @@ menu_loop (char *menutitle, _menu menu[], int lastselect)
/* keyboard handling */
keys = SDL_GetKeyState (NULL);
if (keys[SDLK_DOWN] && event.type == SDL_KEYDOWN) {
if (keys[SDLK_DOWN] && event.type == SDL_KEYDOWN && keypressed == 0) {
keypressed = 1;
menuselect++;
if (menuselect >= lastentry)
menuselect = 0;
}
if (keys[SDLK_UP] && event.type == SDL_KEYDOWN) {
if (keys[SDLK_UP] && event.type == SDL_KEYDOWN && keypressed == 0) {
keypressed = 1;
menuselect--;
if (menuselect < 0)
menuselect = lastentry - 1;
}
if (keys[SDLK_ESCAPE] && event.type == SDL_KEYDOWN) {
keypressed = 1;
return -1;
}
if (!keys[SDLK_ESCAPE] && event.type == SDL_KEYUP)
@ -162,6 +166,7 @@ menu_loop (char *menutitle, _menu menu[], int lastselect)
if (!keys[SDLK_RETURN] && event.type == SDL_KEYUP)
keypressed = 0;
s_delay (100);
};
return menuselect;
};
@ -207,12 +212,14 @@ menu_get_text (char *title, char *text, int len)
redraw_logo_shaded (x, y, (gfx.font.size.x - 4) * len_, gfx.font.size.y, MENU_BG_SHADE_DARK);
draw_text (x, y, t, 1);
draw_text (x + (gfx.font.size.x - 4) * curpos, y, "_", 1);
SDL_Flip (gfx.screen);
if (SDL_WaitEvent (&event) != 0)
/* do the network loop if we have to */
if (bman.gametype == GT_multi && bman.sock != -1)
network_loop ();
if (SDL_PollEvent (&event) != 0)
switch (event.type) {
case (SDL_QUIT):
bman.state = GS_quit;
@ -263,6 +270,7 @@ menu_get_text (char *title, char *text, int len)
if (event.type == SDL_KEYUP)
keypressed = 0;
s_delay (100);
}
};
@ -313,7 +321,11 @@ menu_displaymessage (char *title, char *text)
menu_displaytext (title, text, 64, 0, 0);
while (done == 0 || (done == 1 && keypressed == 1)) {
if (SDL_WaitEvent (&event) != 0)
/* do the network loop if we have to */
if (bman.gametype == GT_multi && bman.sock != -1)
network_loop ();
if (SDL_PollEvent (&event) != 0)
switch (event.type) {
case (SDL_QUIT):
done = 1;
@ -333,6 +345,8 @@ menu_displaymessage (char *title, char *text)
if (event.type == SDL_KEYUP)
keypressed = 0;
s_delay (100);
}
};

@ -359,7 +359,6 @@ wait_for_players ()
else if (event.type == SDL_KEYDOWN)
keypressed = 1;
/* calculate time sync. */
s_delay (50);
}

@ -13,20 +13,20 @@ void
networkmenu_joingame ()
{
int i;
gamesrv_getserver();
gamesrv_getserver ();
for (i = 0; bman.servername[i] != 0; i++)
if (bman.servername[i] == ' ')
bman.servername[i] = ':';
/* connect if we have an Servername */
if (bman.servername[0] != 0) {
if (bman.servername[0] != 0) {
bman.sock = -1;
bman.gametype = GT_multi;
bman.multitype = MT_ptps;
join_multiplayer_game ();
bman.servername[0] = 0;
}
}
};
void

@ -1,4 +1,4 @@
/* $Id: network.c,v 1.12 2003/05/05 15:53:27 stpohle Exp $ */
/* $Id: network.c,v 1.13 2003/05/06 12:25:30 stpohle Exp $ */
/*
network routines.
*/
@ -193,7 +193,7 @@ network_shutdown ()
resend_cache.fill = -1;
bman.p_nr = -1;
bman.sock = -1;
#ifdef _WIN32
WSACleanup ();
#endif

Loading…
Cancel
Save