Make newmenu_do3 and newmenu_dotiny return as soon as the newmenu is created, which will allow the main menu (and others) to persist
This commit is contained in:
parent
beb39df2d4
commit
0c8c99fd13
|
@ -1,6 +1,10 @@
|
||||||
D2X-Rebirth Changelog
|
D2X-Rebirth Changelog
|
||||||
|
|
||||||
20100401
|
20100403
|
||||||
|
--------
|
||||||
|
arch/sdl/mouse.c, main/game.c, main/net_ipx.c, main/newmenu.c, main/newmenu.h, main/state.c: Make newmenu_do3 and newmenu_dotiny return as soon as the newmenu is created, which will allow the main menu (and others) to persist
|
||||||
|
|
||||||
|
20100402
|
||||||
--------
|
--------
|
||||||
arch/include/event.h, arch/sdl/event.c, arch/sdl/key.c, arch/sdl/mouse.c, main/automap.c, main/credits.c, main/escort.c, main/game.c, main/gamecntl.c, main/inferno.c, main/kconfig.c, main/kmatrix.c, main/movie.c, main/net_ipx.c, main/net_udp.c, main/newmenu.c, main/scores.c, main/titles.c: Add a default event handler for screenshots, entering debugger, Redbook repeating etc
|
arch/include/event.h, arch/sdl/event.c, arch/sdl/key.c, arch/sdl/mouse.c, main/automap.c, main/credits.c, main/escort.c, main/game.c, main/gamecntl.c, main/inferno.c, main/kconfig.c, main/kmatrix.c, main/movie.c, main/net_ipx.c, main/net_udp.c, main/newmenu.c, main/scores.c, main/titles.c: Add a default event handler for screenshots, entering debugger, Redbook repeating etc
|
||||||
main/menu.c, main/newmenu.c: Keep demo selector just after playing one, for convenience
|
main/menu.c, main/newmenu.c: Keep demo selector just after playing one, for convenience
|
||||||
|
|
|
@ -129,7 +129,7 @@ void mouse_flush() // clears all mice events...
|
||||||
//========================================================================
|
//========================================================================
|
||||||
void mouse_get_pos( int *x, int *y, int *z )
|
void mouse_get_pos( int *x, int *y, int *z )
|
||||||
{
|
{
|
||||||
event_poll();
|
//event_poll(); // Have to assume this is called in event_process, because event_poll can cause a window to close (depending on what the user does)
|
||||||
*x=Mouse.x;
|
*x=Mouse.x;
|
||||||
*y=Mouse.y;
|
*y=Mouse.y;
|
||||||
*z=Mouse.z;
|
*z=Mouse.z;
|
||||||
|
|
40
main/game.c
40
main/game.c
|
@ -607,7 +607,7 @@ void do_cloak_stuff(void)
|
||||||
if (Game_mode & GM_MULTI)
|
if (Game_mode & GM_MULTI)
|
||||||
multi_send_play_sound(SOUND_CLOAK_OFF, F1_0);
|
multi_send_play_sound(SOUND_CLOAK_OFF, F1_0);
|
||||||
maybe_drop_net_powerup(POW_CLOAK);
|
maybe_drop_net_powerup(POW_CLOAK);
|
||||||
if ( Newdemo_state == ND_STATE_PLAYBACK )
|
if ( Newdemo_state != ND_STATE_PLAYBACK )
|
||||||
multi_send_decloak(); // For demo recording
|
multi_send_decloak(); // For demo recording
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -884,10 +884,27 @@ extern int Death_sequence_aborted;
|
||||||
#define EXT_MUSIC_TEXT "Audio CD"
|
#define EXT_MUSIC_TEXT "Audio CD"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static int free_help(newmenu *menu, d_event *event, void *userdata)
|
||||||
|
{
|
||||||
|
userdata = userdata;
|
||||||
|
|
||||||
|
if (event->type == EVENT_WINDOW_CLOSE)
|
||||||
|
{
|
||||||
|
newmenu_item *items = newmenu_get_items(menu);
|
||||||
|
d_free(items);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void show_help()
|
void show_help()
|
||||||
{
|
{
|
||||||
int nitems = 0;
|
int nitems = 0;
|
||||||
newmenu_item m[26];
|
newmenu_item *m;
|
||||||
|
|
||||||
|
MALLOC(m, newmenu_item, 26);
|
||||||
|
if (!m)
|
||||||
|
return;
|
||||||
|
|
||||||
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = TXT_HELP_ESC;
|
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = TXT_HELP_ESC;
|
||||||
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "SHIFT-ESC\t SHOW GAME LOG";
|
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "SHIFT-ESC\t SHOW GAME LOG";
|
||||||
|
@ -931,14 +948,18 @@ void show_help()
|
||||||
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "(Use \x85-# for F#. e.g. \x85-1 for F1)";
|
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "(Use \x85-# for F#. e.g. \x85-1 for F1)";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
newmenu_dotiny( NULL, TXT_KEYS, nitems, m, NULL, NULL );
|
newmenu_dotiny( NULL, TXT_KEYS, nitems, m, free_help, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
void show_netgame_help()
|
void show_netgame_help()
|
||||||
{
|
{
|
||||||
int nitems = 0;
|
int nitems = 0;
|
||||||
newmenu_item m[17];
|
newmenu_item *m;
|
||||||
|
|
||||||
|
MALLOC(m, newmenu_item, 17);
|
||||||
|
if (!m)
|
||||||
|
return;
|
||||||
|
|
||||||
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "F1\t THIS SCREEN";
|
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "F1\t THIS SCREEN";
|
||||||
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "ALT-0\t DROP FLAG";
|
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "ALT-0\t DROP FLAG";
|
||||||
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "ALT-F4\t SHOW RETICLE NAMES";
|
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "ALT-F4\t SHOW RETICLE NAMES";
|
||||||
|
@ -960,14 +981,18 @@ void show_netgame_help()
|
||||||
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "kick: (*)\t KICK PLAYER (*) FROM GAME (Host-only)";
|
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "kick: (*)\t KICK PLAYER (*) FROM GAME (Host-only)";
|
||||||
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "KillReactor\t BLOW UP THE MINE (Host-only)";
|
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "KillReactor\t BLOW UP THE MINE (Host-only)";
|
||||||
|
|
||||||
newmenu_dotiny( NULL, TXT_KEYS, nitems, m, NULL, NULL );
|
newmenu_dotiny( NULL, TXT_KEYS, nitems, m, free_help, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
void show_newdemo_help()
|
void show_newdemo_help()
|
||||||
{
|
{
|
||||||
newmenu_item m[15];
|
newmenu_item *m;
|
||||||
int nitems = 0;
|
int nitems = 0;
|
||||||
|
|
||||||
|
MALLOC(m, newmenu_item, 15);
|
||||||
|
if (!m)
|
||||||
|
return;
|
||||||
|
|
||||||
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "ESC\t QUIT DEMO PLAYBACK";
|
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "ESC\t QUIT DEMO PLAYBACK";
|
||||||
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "F1\t THIS SCREEN";
|
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "F1\t THIS SCREEN";
|
||||||
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = TXT_HELP_F2;
|
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = TXT_HELP_F2;
|
||||||
|
@ -985,7 +1010,8 @@ void show_newdemo_help()
|
||||||
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "";
|
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "";
|
||||||
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "(Use \x85-# for F#. e.g. \x85-1 for F1)";
|
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "(Use \x85-# for F#. e.g. \x85-1 for F1)";
|
||||||
#endif
|
#endif
|
||||||
newmenu_dotiny( NULL, "DEMO PLAYBACK CONTROLS", nitems, m, NULL, NULL );
|
|
||||||
|
newmenu_dotiny( NULL, "DEMO PLAYBACK CONTROLS", nitems, m, free_help, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
//temp function until Matt cleans up game sequencing
|
//temp function until Matt cleans up game sequencing
|
||||||
|
|
238
main/net_ipx.c
238
main/net_ipx.c
|
@ -3694,68 +3694,30 @@ void restart_net_searching(newmenu_item * m)
|
||||||
|
|
||||||
char *ModeLetters[]={"ANRCHY","TEAM","ROBO","COOP","FLAG","HOARD","TMHOARD"};
|
char *ModeLetters[]={"ANRCHY","TEAM","ROBO","COOP","FLAG","HOARD","TMHOARD"};
|
||||||
|
|
||||||
int net_ipx_join_poll( newmenu *menu, d_event *event, void *userdata )
|
void net_ipx_join_listen(newmenu *menu)
|
||||||
{
|
{
|
||||||
// Polling loop for Join Game menu
|
|
||||||
newmenu_item *menus = newmenu_get_items(menu);
|
newmenu_item *menus = newmenu_get_items(menu);
|
||||||
static fix t1 = 0;
|
static fix t1 = 0;
|
||||||
int i, osocket,join_status,temp;
|
int i,join_status,temp;
|
||||||
int key = 0;
|
|
||||||
int rval = 0;
|
|
||||||
|
|
||||||
if (event->type == EVENT_KEY_COMMAND)
|
|
||||||
key = ((d_event_keycommand *)event)->keycode;
|
|
||||||
else if (event->type != EVENT_IDLE)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
userdata = userdata;
|
|
||||||
|
|
||||||
if ( IPX_allow_socket_changes ) {
|
|
||||||
osocket = IPX_Socket;
|
|
||||||
|
|
||||||
if ( key==KEY_PAGEDOWN ) { IPX_Socket--; rval = 1; }
|
|
||||||
if ( key==KEY_PAGEUP ) { IPX_Socket++; rval = 1; }
|
|
||||||
|
|
||||||
if (IPX_Socket>99)
|
|
||||||
IPX_Socket=99;
|
|
||||||
if (IPX_Socket<-99)
|
|
||||||
IPX_Socket=-99;
|
|
||||||
|
|
||||||
if ( IPX_Socket+IPX_DEFAULT_SOCKET > 0x8000 )
|
|
||||||
IPX_Socket = 0x8000 - IPX_DEFAULT_SOCKET;
|
|
||||||
|
|
||||||
if ( IPX_Socket+IPX_DEFAULT_SOCKET < 0 )
|
|
||||||
IPX_Socket = IPX_DEFAULT_SOCKET;
|
|
||||||
|
|
||||||
if (IPX_Socket != osocket ) {
|
|
||||||
sprintf( menus[0].text, "\t%s %+d (PgUp/PgDn to change)", TXT_CURRENT_IPX_SOCKET, IPX_Socket );
|
|
||||||
net_ipx_listen();
|
|
||||||
ipxdrv_change_default_socket( IPX_DEFAULT_SOCKET + IPX_Socket );
|
|
||||||
restart_net_searching(menus);
|
|
||||||
net_ipx_send_game_list_request();
|
|
||||||
return rval;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// send a request for game info every 3 seconds
|
// send a request for game info every 3 seconds
|
||||||
|
|
||||||
if (timer_get_fixed_seconds() > t1+F1_0*3) {
|
if (timer_get_fixed_seconds() > t1+F1_0*3) {
|
||||||
t1 = timer_get_fixed_seconds();
|
t1 = timer_get_fixed_seconds();
|
||||||
net_ipx_send_game_list_request();
|
net_ipx_send_game_list_request();
|
||||||
}
|
}
|
||||||
|
|
||||||
temp=num_active_ipx_games;
|
temp=num_active_ipx_games;
|
||||||
|
|
||||||
net_ipx_listen();
|
net_ipx_listen();
|
||||||
|
|
||||||
if (!num_active_ipx_changed)
|
if (!num_active_ipx_changed)
|
||||||
return rval;
|
return;
|
||||||
|
|
||||||
if (temp!=num_active_ipx_games)
|
if (temp!=num_active_ipx_games)
|
||||||
digi_play_sample (SOUND_HUD_MESSAGE,F1_0);
|
digi_play_sample (SOUND_HUD_MESSAGE,F1_0);
|
||||||
|
|
||||||
num_active_ipx_changed = 0;
|
num_active_ipx_changed = 0;
|
||||||
|
|
||||||
// Copy the active games data into the menu options
|
// Copy the active games data into the menu options
|
||||||
for (i = 0; i < num_active_ipx_games; i++)
|
for (i = 0; i < num_active_ipx_games; i++)
|
||||||
{
|
{
|
||||||
|
@ -3763,35 +3725,35 @@ int net_ipx_join_poll( newmenu *menu, d_event *event, void *userdata )
|
||||||
int j,x, k,tx,ty,ta,nplayers = 0;
|
int j,x, k,tx,ty,ta,nplayers = 0;
|
||||||
char levelname[8],MissName[25],GameName[25],thold[2];
|
char levelname[8],MissName[25],GameName[25],thold[2];
|
||||||
thold[1]=0;
|
thold[1]=0;
|
||||||
|
|
||||||
// These next two loops protect against menu skewing
|
// These next two loops protect against menu skewing
|
||||||
// if missiontitle or gamename contain a tab
|
// if missiontitle or gamename contain a tab
|
||||||
|
|
||||||
for (x=0,tx=0,k=0,j=0;j<15;j++)
|
for (x=0,tx=0,k=0,j=0;j<15;j++)
|
||||||
{
|
{
|
||||||
if (Active_ipx_games[i].mission_title[j]=='\t')
|
if (Active_ipx_games[i].mission_title[j]=='\t')
|
||||||
continue;
|
continue;
|
||||||
thold[0]=Active_ipx_games[i].mission_title[j];
|
thold[0]=Active_ipx_games[i].mission_title[j];
|
||||||
gr_get_string_size (thold,&tx,&ty,&ta);
|
gr_get_string_size (thold,&tx,&ty,&ta);
|
||||||
|
|
||||||
if ((x+=tx)>=FSPACX(55))
|
if ((x+=tx)>=FSPACX(55))
|
||||||
{
|
{
|
||||||
MissName[k]=MissName[k+1]=MissName[k+2]='.';
|
MissName[k]=MissName[k+1]=MissName[k+2]='.';
|
||||||
k+=3;
|
k+=3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
MissName[k++]=Active_ipx_games[i].mission_title[j];
|
MissName[k++]=Active_ipx_games[i].mission_title[j];
|
||||||
}
|
}
|
||||||
MissName[k]=0;
|
MissName[k]=0;
|
||||||
|
|
||||||
for (x=0,tx=0,k=0,j=0;j<15;j++)
|
for (x=0,tx=0,k=0,j=0;j<15;j++)
|
||||||
{
|
{
|
||||||
if (Active_ipx_games[i].game_name[j]=='\t')
|
if (Active_ipx_games[i].game_name[j]=='\t')
|
||||||
continue;
|
continue;
|
||||||
thold[0]=Active_ipx_games[i].game_name[j];
|
thold[0]=Active_ipx_games[i].game_name[j];
|
||||||
gr_get_string_size (thold,&tx,&ty,&ta);
|
gr_get_string_size (thold,&tx,&ty,&ta);
|
||||||
|
|
||||||
if ((x+=tx)>=FSPACX(55))
|
if ((x+=tx)>=FSPACX(55))
|
||||||
{
|
{
|
||||||
GameName[k]=GameName[k+1]=GameName[k+2]='.';
|
GameName[k]=GameName[k+1]=GameName[k+2]='.';
|
||||||
|
@ -3801,15 +3763,15 @@ int net_ipx_join_poll( newmenu *menu, d_event *event, void *userdata )
|
||||||
GameName[k++]=Active_ipx_games[i].game_name[j];
|
GameName[k++]=Active_ipx_games[i].game_name[j];
|
||||||
}
|
}
|
||||||
GameName[k]=0;
|
GameName[k]=0;
|
||||||
|
|
||||||
|
|
||||||
nplayers=Active_ipx_games[i].numconnected;
|
nplayers=Active_ipx_games[i].numconnected;
|
||||||
|
|
||||||
if (Active_ipx_games[i].levelnum < 0)
|
if (Active_ipx_games[i].levelnum < 0)
|
||||||
sprintf(levelname, "S%d", -Active_ipx_games[i].levelnum);
|
sprintf(levelname, "S%d", -Active_ipx_games[i].levelnum);
|
||||||
else
|
else
|
||||||
sprintf(levelname, "%d", Active_ipx_games[i].levelnum);
|
sprintf(levelname, "%d", Active_ipx_games[i].levelnum);
|
||||||
|
|
||||||
if (game_status == NETSTAT_STARTING)
|
if (game_status == NETSTAT_STARTING)
|
||||||
{
|
{
|
||||||
sprintf (menus[i+2].text,"%d.\t%s \t%s \t %d/%d \t%s \t %s \t%s",
|
sprintf (menus[i+2].text,"%d.\t%s \t%s \t %d/%d \t%s \t %s \t%s",
|
||||||
|
@ -3819,7 +3781,7 @@ int net_ipx_join_poll( newmenu *menu, d_event *event, void *userdata )
|
||||||
else if (game_status == NETSTAT_PLAYING)
|
else if (game_status == NETSTAT_PLAYING)
|
||||||
{
|
{
|
||||||
join_status=net_ipx_can_join_netgame(&Active_ipx_games[i]);
|
join_status=net_ipx_can_join_netgame(&Active_ipx_games[i]);
|
||||||
|
|
||||||
if (join_status==1)
|
if (join_status==1)
|
||||||
sprintf (menus[i+2].text,"%d.\t%s \t%s \t %d/%d \t%s \t %s \t%s",
|
sprintf (menus[i+2].text,"%d.\t%s \t%s \t %d/%d \t%s \t %s \t%s",
|
||||||
i+1,GameName,ModeLetters[Active_ipx_games[i].gamemode],nplayers,
|
i+1,GameName,ModeLetters[Active_ipx_games[i].gamemode],nplayers,
|
||||||
|
@ -3836,23 +3798,105 @@ int net_ipx_join_poll( newmenu *menu, d_event *event, void *userdata )
|
||||||
sprintf (menus[i+2].text,"%d.\t%s \t%s \t %d/%d \t%s \t %s \t%s",
|
sprintf (menus[i+2].text,"%d.\t%s \t%s \t %d/%d \t%s \t %s \t%s",
|
||||||
i+1,GameName,ModeLetters[Active_ipx_games[i].gamemode],nplayers,
|
i+1,GameName,ModeLetters[Active_ipx_games[i].gamemode],nplayers,
|
||||||
Active_ipx_games[i].max_numplayers,MissName,levelname,"Closed");
|
Active_ipx_games[i].max_numplayers,MissName,levelname,"Closed");
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sprintf (menus[i+2].text,"%d.\t%s \t%s \t %d/%d \t%s \t %s \t%s",
|
sprintf (menus[i+2].text,"%d.\t%s \t%s \t %d/%d \t%s \t %s \t%s",
|
||||||
i+1,GameName,ModeLetters[Active_ipx_games[i].gamemode],nplayers,
|
i+1,GameName,ModeLetters[Active_ipx_games[i].gamemode],nplayers,
|
||||||
Active_ipx_games[i].max_numplayers,MissName,levelname,"Between");
|
Active_ipx_games[i].max_numplayers,MissName,levelname,"Between");
|
||||||
|
|
||||||
|
|
||||||
Assert(strlen(menus[i+2].text) < 100);
|
Assert(strlen(menus[i+2].text) < 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = num_active_ipx_games; i < IPX_MAX_NETGAMES; i++)
|
for (i = num_active_ipx_games; i < IPX_MAX_NETGAMES; i++)
|
||||||
{
|
{
|
||||||
sprintf(menus[i+2].text, "%d. ",i+1);
|
sprintf(menus[i+2].text, "%d. ",i+1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return rval;
|
|
||||||
|
int net_ipx_do_join_game(int choice);
|
||||||
|
|
||||||
|
int net_ipx_join_poll( newmenu *menu, d_event *event, void *menu_text )
|
||||||
|
{
|
||||||
|
// Polling loop for Join Game menu
|
||||||
|
newmenu_item *menus = newmenu_get_items(menu);
|
||||||
|
int citem = newmenu_get_citem(menu);
|
||||||
|
int key = 0;
|
||||||
|
|
||||||
|
switch (event->type)
|
||||||
|
{
|
||||||
|
case EVENT_KEY_COMMAND:
|
||||||
|
key = ((d_event_keycommand *)event)->keycode;
|
||||||
|
|
||||||
|
if ( IPX_allow_socket_changes ) {
|
||||||
|
int osocket;
|
||||||
|
int rval = 0;
|
||||||
|
|
||||||
|
osocket = IPX_Socket;
|
||||||
|
|
||||||
|
if ( key==KEY_PAGEDOWN ) { IPX_Socket--; rval = 1; }
|
||||||
|
if ( key==KEY_PAGEUP ) { IPX_Socket++; rval = 1; }
|
||||||
|
|
||||||
|
if (IPX_Socket>99)
|
||||||
|
IPX_Socket=99;
|
||||||
|
if (IPX_Socket<-99)
|
||||||
|
IPX_Socket=-99;
|
||||||
|
|
||||||
|
if ( IPX_Socket+IPX_DEFAULT_SOCKET > 0x8000 )
|
||||||
|
IPX_Socket = 0x8000 - IPX_DEFAULT_SOCKET;
|
||||||
|
|
||||||
|
if ( IPX_Socket+IPX_DEFAULT_SOCKET < 0 )
|
||||||
|
IPX_Socket = IPX_DEFAULT_SOCKET;
|
||||||
|
|
||||||
|
if (IPX_Socket != osocket ) {
|
||||||
|
sprintf( menus[0].text, "\t%s %+d (PgUp/PgDn to change)", TXT_CURRENT_IPX_SOCKET, IPX_Socket );
|
||||||
|
net_ipx_listen();
|
||||||
|
ipxdrv_change_default_socket( IPX_DEFAULT_SOCKET + IPX_Socket );
|
||||||
|
restart_net_searching(menus);
|
||||||
|
net_ipx_send_game_list_request();
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EVENT_IDLE:
|
||||||
|
net_ipx_join_listen(menu);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EVENT_NEWMENU_SELECTED:
|
||||||
|
citem-=2;
|
||||||
|
|
||||||
|
if (citem >=num_active_ipx_games)
|
||||||
|
{
|
||||||
|
nm_messagebox(TXT_SORRY, 1, TXT_OK, TXT_INVALID_CHOICE);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (net_ipx_show_game_stats(citem)==0)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
// Choice has been made and looks legit
|
||||||
|
if (net_ipx_do_join_game(citem)==0)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
// look ma, we're in a game!!!
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EVENT_WINDOW_CLOSE:
|
||||||
|
SurfingNet=0;
|
||||||
|
d_free(menu_text);
|
||||||
|
d_free(menu);
|
||||||
|
|
||||||
|
if (!Game_wind)
|
||||||
|
Network_status = NETSTAT_MENU; // they cancelled
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -4109,16 +4153,25 @@ int net_ipx_do_join_game(int choice);
|
||||||
|
|
||||||
void net_ipx_join_game()
|
void net_ipx_join_game()
|
||||||
{
|
{
|
||||||
int choice, i;
|
int i;
|
||||||
char menu_text[IPX_MAX_NETGAMES+2][200];
|
char *menu_text;
|
||||||
|
newmenu_item *m;
|
||||||
newmenu_item m[IPX_MAX_NETGAMES+2];
|
|
||||||
|
|
||||||
if ( !IPX_active )
|
if ( !IPX_active )
|
||||||
{
|
{
|
||||||
nm_messagebox(NULL, 1, TXT_OK, TXT_IPX_NOT_FOUND);
|
nm_messagebox(NULL, 1, TXT_OK, TXT_IPX_NOT_FOUND);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MALLOC(m, newmenu_item, ((IPX_MAX_NETGAMES)*2)+1);
|
||||||
|
if (!m)
|
||||||
|
return;
|
||||||
|
MALLOC(menu_text, char, (((IPX_MAX_NETGAMES)*2)+1)*200);
|
||||||
|
if (!menu_text)
|
||||||
|
{
|
||||||
|
d_free(m);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
net_ipx_init();
|
net_ipx_init();
|
||||||
|
|
||||||
|
@ -4126,13 +4179,13 @@ void net_ipx_join_game()
|
||||||
|
|
||||||
// FIXME: Keep browsing window to go back to
|
// FIXME: Keep browsing window to go back to
|
||||||
//setjmp(LeaveGame);
|
//setjmp(LeaveGame);
|
||||||
|
|
||||||
Network_send_objects = 0;
|
Network_send_objects = 0;
|
||||||
Network_sending_extras=0;
|
Network_sending_extras=0;
|
||||||
Network_rejoined=0;
|
Network_rejoined=0;
|
||||||
|
|
||||||
Network_status = NETSTAT_BROWSING; // We are looking at a game menu
|
Network_status = NETSTAT_BROWSING; // We are looking at a game menu
|
||||||
|
|
||||||
net_ipx_flush();
|
net_ipx_flush();
|
||||||
net_ipx_listen(); // Throw out old info
|
net_ipx_listen(); // Throw out old info
|
||||||
|
|
||||||
|
@ -4142,54 +4195,29 @@ void net_ipx_join_game()
|
||||||
|
|
||||||
memset(m, 0, sizeof(newmenu_item)*IPX_MAX_NETGAMES);
|
memset(m, 0, sizeof(newmenu_item)*IPX_MAX_NETGAMES);
|
||||||
memset(Active_ipx_games, 0, sizeof(netgame_info)*IPX_MAX_NETGAMES);
|
memset(Active_ipx_games, 0, sizeof(netgame_info)*IPX_MAX_NETGAMES);
|
||||||
|
|
||||||
gr_set_fontcolor(BM_XRGB(15,15,23),-1);
|
gr_set_fontcolor(BM_XRGB(15,15,23),-1);
|
||||||
|
|
||||||
m[0].text = menu_text[0];
|
m[0].text = menu_text;
|
||||||
m[0].type = NM_TYPE_TEXT;
|
m[0].type = NM_TYPE_TEXT;
|
||||||
if (IPX_allow_socket_changes)
|
if (IPX_allow_socket_changes)
|
||||||
sprintf( m[0].text, "\tCurrent IPX Socket is default %+d (PgUp/PgDn to change)", IPX_Socket );
|
sprintf( m[0].text, "\tCurrent IPX Socket is default %+d (PgUp/PgDn to change)", IPX_Socket );
|
||||||
else
|
else
|
||||||
strcpy( m[0].text, "" ); //sprintf( m[0].text, "" );
|
strcpy( m[0].text, "" ); //sprintf( m[0].text, "" );
|
||||||
|
|
||||||
m[1].text=menu_text[1];
|
m[1].text=menu_text + 200*1;
|
||||||
m[1].type=NM_TYPE_TEXT;
|
m[1].type=NM_TYPE_TEXT;
|
||||||
sprintf (m[1].text,"\tGAME \tMODE \t#PLYRS \tMISSION \tLEV \tSTATUS");
|
sprintf (m[1].text,"\tGAME \tMODE \t#PLYRS \tMISSION \tLEV \tSTATUS");
|
||||||
|
|
||||||
for (i = 0; i < IPX_MAX_NETGAMES; i++) {
|
for (i = 0; i < IPX_MAX_NETGAMES; i++) {
|
||||||
m[i+2].text = menu_text[i+2];
|
m[i+2].text = menu_text + 200*(i+2);
|
||||||
m[i+2].type = NM_TYPE_MENU;
|
m[i+2].type = NM_TYPE_MENU;
|
||||||
sprintf(m[i+2].text, "%d. ", i+1);
|
sprintf(m[i+2].text, "%d. ", i+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
num_active_ipx_changed = 1;
|
num_active_ipx_changed = 1;
|
||||||
remenu:
|
|
||||||
SurfingNet=1;
|
SurfingNet=1;
|
||||||
nm_draw_background1(Menu_pcx_name); //load this here so if we abort after loading level, we restore the palette
|
newmenu_dotiny("NETGAMES", NULL,IPX_MAX_NETGAMES+2, m, net_ipx_join_poll, menu_text);
|
||||||
gr_palette_load(gr_palette);
|
|
||||||
choice=newmenu_dotiny("NETGAMES", NULL,IPX_MAX_NETGAMES+2, m, net_ipx_join_poll, NULL);
|
|
||||||
SurfingNet=0;
|
|
||||||
|
|
||||||
if (choice==-1) {
|
|
||||||
Network_status = NETSTAT_MENU;
|
|
||||||
return; // they cancelled
|
|
||||||
}
|
|
||||||
choice-=2;
|
|
||||||
|
|
||||||
if (choice >=num_active_ipx_games)
|
|
||||||
{
|
|
||||||
nm_messagebox(TXT_SORRY, 1, TXT_OK, TXT_INVALID_CHOICE);
|
|
||||||
goto remenu;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (net_ipx_show_game_stats(choice)==0)
|
|
||||||
goto remenu;
|
|
||||||
|
|
||||||
// Choice has been made and looks legit
|
|
||||||
if (net_ipx_do_join_game(choice)==0)
|
|
||||||
goto remenu;
|
|
||||||
|
|
||||||
return; // look ma, we're in a game!!!
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fix StartWaitAllTime=0;
|
fix StartWaitAllTime=0;
|
||||||
|
@ -5503,6 +5531,8 @@ void net_ipx_request_player_names (int n)
|
||||||
|
|
||||||
void net_ipx_process_names_return (ubyte *data)
|
void net_ipx_process_names_return (ubyte *data)
|
||||||
{
|
{
|
||||||
|
newmenu *menu;
|
||||||
|
window *wind;
|
||||||
newmenu_item m[15];
|
newmenu_item m[15];
|
||||||
char mtext[15][50],temp[50];
|
char mtext[15][50],temp[50];
|
||||||
int i,t,l,gnum,num=0,count=5,numplayers;
|
int i,t,l,gnum,num=0,count=5,numplayers;
|
||||||
|
@ -5571,7 +5601,11 @@ void net_ipx_process_names_return (ubyte *data)
|
||||||
sprintf (mtext[num++],"Packets Per Second: %d",data[count+2]);
|
sprintf (mtext[num++],"Packets Per Second: %d",data[count+2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
newmenu_dotiny( NULL, NULL, num, m, NULL, NULL);
|
menu = newmenu_dotiny( NULL, NULL, num, m, NULL, NULL);
|
||||||
|
|
||||||
|
wind = newmenu_get_window(menu);
|
||||||
|
while (window_exists(wind))
|
||||||
|
event_process();
|
||||||
}
|
}
|
||||||
|
|
||||||
char NameReturning=1;
|
char NameReturning=1;
|
||||||
|
|
110
main/newmenu.c
110
main/newmenu.c
|
@ -73,6 +73,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
||||||
|
|
||||||
struct newmenu
|
struct newmenu
|
||||||
{
|
{
|
||||||
|
window *wind;
|
||||||
int x,y,w,h;
|
int x,y,w,h;
|
||||||
char *title;
|
char *title;
|
||||||
char *subtitle;
|
char *subtitle;
|
||||||
|
@ -87,7 +88,7 @@ struct newmenu
|
||||||
int is_scroll_box; // Is this a scrolling box? Set to false at init
|
int is_scroll_box; // Is this a scrolling box? Set to false at init
|
||||||
int max_on_menu;
|
int max_on_menu;
|
||||||
int mouse_state, dblclick_flag;
|
int mouse_state, dblclick_flag;
|
||||||
int done;
|
int leave; // Leave newmenu_doX function
|
||||||
void *userdata; // For whatever - like with window system
|
void *userdata; // For whatever - like with window system
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -98,7 +99,7 @@ ubyte SurfingNet=0;
|
||||||
static int draw_copyright=0;
|
static int draw_copyright=0;
|
||||||
extern ubyte Version_major,Version_minor;
|
extern ubyte Version_major,Version_minor;
|
||||||
|
|
||||||
int newmenu_do4( char * title, char * subtitle, int nitems, newmenu_item * item, int (*subfunction)(newmenu *menu, d_event *event, void *userdata), void *userdata, int citem, char * filename, int width, int height, int TinyMode );
|
newmenu *newmenu_do4( char * title, char * subtitle, int nitems, newmenu_item * item, int (*subfunction)(newmenu *menu, d_event *event, void *userdata), void *userdata, int citem, char * filename, int width, int height, int TinyMode );
|
||||||
|
|
||||||
void newmenu_close() {
|
void newmenu_close() {
|
||||||
if (nm_background.bm_data)
|
if (nm_background.bm_data)
|
||||||
|
@ -512,10 +513,10 @@ void strip_end_whitespace( char * text )
|
||||||
|
|
||||||
int newmenu_do( char * title, char * subtitle, int nitems, newmenu_item * item, int (*subfunction)(newmenu *menu, d_event *event, void *userdata), void *userdata )
|
int newmenu_do( char * title, char * subtitle, int nitems, newmenu_item * item, int (*subfunction)(newmenu *menu, d_event *event, void *userdata), void *userdata )
|
||||||
{
|
{
|
||||||
return newmenu_do3( title, subtitle, nitems, item, subfunction, userdata, 0, NULL, -1, -1 );
|
return newmenu_do2( title, subtitle, nitems, item, subfunction, userdata, 0, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
int newmenu_dotiny( char * title, char * subtitle, int nitems, newmenu_item * item, int (*subfunction)(newmenu *menu, d_event *event, void *userdata), void *userdata )
|
newmenu *newmenu_dotiny( char * title, char * subtitle, int nitems, newmenu_item * item, int (*subfunction)(newmenu *menu, d_event *event, void *userdata), void *userdata )
|
||||||
{
|
{
|
||||||
return newmenu_do4( title, subtitle, nitems, item, subfunction, userdata, 0, NULL, -1, -1, 1 );
|
return newmenu_do4( title, subtitle, nitems, item, subfunction, userdata, 0, NULL, -1, -1, 1 );
|
||||||
}
|
}
|
||||||
|
@ -523,21 +524,44 @@ int newmenu_dotiny( char * title, char * subtitle, int nitems, newmenu_item * it
|
||||||
|
|
||||||
int newmenu_do1( char * title, char * subtitle, int nitems, newmenu_item * item, int (*subfunction)(newmenu *menu, d_event *event, void *userdata), void *userdata, int citem )
|
int newmenu_do1( char * title, char * subtitle, int nitems, newmenu_item * item, int (*subfunction)(newmenu *menu, d_event *event, void *userdata), void *userdata, int citem )
|
||||||
{
|
{
|
||||||
return newmenu_do3( title, subtitle, nitems, item, subfunction, userdata, citem, NULL, -1, -1 );
|
return newmenu_do2( title, subtitle, nitems, item, subfunction, userdata, citem, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int newmenu_do2( char * title, char * subtitle, int nitems, newmenu_item * item, int (*subfunction)(newmenu *menu, d_event *event, void *userdata), void *userdata, int citem, char * filename )
|
int newmenu_do2( char * title, char * subtitle, int nitems, newmenu_item * item, int (*subfunction)(newmenu *menu, d_event *event, void *userdata), void *userdata, int citem, char * filename )
|
||||||
{
|
{
|
||||||
return newmenu_do3( title, subtitle, nitems, item, subfunction, userdata, citem, filename, -1, -1 );
|
newmenu *menu;
|
||||||
|
int rval = -1;
|
||||||
|
|
||||||
|
menu = newmenu_do3( title, subtitle, nitems, item, subfunction, userdata, citem, filename, -1, -1 );
|
||||||
|
|
||||||
|
if (!menu)
|
||||||
|
return -1;
|
||||||
|
menu->leave = 0; // no leaving this function until we're finished
|
||||||
|
|
||||||
|
// newmenu_do2 and simpler get their own event loop
|
||||||
|
// This is so the caller doesn't have to provide a callback that responds to EVENT_NEWMENU_SELECTED
|
||||||
|
while (window_exists(menu->wind))
|
||||||
|
{
|
||||||
|
event_process();
|
||||||
|
|
||||||
|
if (menu->leave)
|
||||||
|
{
|
||||||
|
rval = menu->citem;
|
||||||
|
if (!window_close(menu->wind))
|
||||||
|
menu->leave = 0; // user aborted close
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rval;
|
||||||
}
|
}
|
||||||
int newmenu_do3( char * title, char * subtitle, int nitems, newmenu_item * item, int (*subfunction)(newmenu *menu, d_event *event, void *userdata), void *userdata, int citem, char * filename, int width, int height )
|
newmenu *newmenu_do3( char * title, char * subtitle, int nitems, newmenu_item * item, int (*subfunction)(newmenu *menu, d_event *event, void *userdata), void *userdata, int citem, char * filename, int width, int height )
|
||||||
{
|
{
|
||||||
set_screen_mode(SCREEN_MENU);//hafta set the screen mode before calling or fonts might get changed/freed up if screen res changes
|
set_screen_mode(SCREEN_MENU);//hafta set the screen mode before calling or fonts might get changed/freed up if screen res changes
|
||||||
return newmenu_do4( title, subtitle, nitems, item, subfunction, userdata, citem, filename, width, height, 0 );
|
return newmenu_do4( title, subtitle, nitems, item, subfunction, userdata, citem, filename, width, height, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
int newmenu_do_fixedfont( char * title, char * subtitle, int nitems, newmenu_item * item, int (*subfunction)(newmenu *menu, d_event *event, void *userdata), void *userdata, int citem, char * filename, int width, int height){
|
newmenu *newmenu_do_fixedfont( char * title, char * subtitle, int nitems, newmenu_item * item, int (*subfunction)(newmenu *menu, d_event *event, void *userdata), void *userdata, int citem, char * filename, int width, int height){
|
||||||
set_screen_mode(SCREEN_MENU);//hafta set the screen mode before calling or fonts might get changed/freed up if screen res changes
|
set_screen_mode(SCREEN_MENU);//hafta set the screen mode before calling or fonts might get changed/freed up if screen res changes
|
||||||
return newmenu_do4( title, subtitle, nitems, item, subfunction, userdata, citem, filename, width, height, 0);
|
return newmenu_do4( title, subtitle, nitems, item, subfunction, userdata, citem, filename, width, height, 0);
|
||||||
}
|
}
|
||||||
|
@ -562,6 +586,24 @@ int newmenu_get_citem(newmenu *menu)
|
||||||
return menu->citem;
|
return menu->citem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window *newmenu_get_window(newmenu *menu)
|
||||||
|
{
|
||||||
|
return menu->wind;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The 'softer' version of window_close,
|
||||||
|
// this leaves citem alone
|
||||||
|
int newmenu_close_window(newmenu *menu)
|
||||||
|
{
|
||||||
|
if (!menu->leave)
|
||||||
|
{
|
||||||
|
menu->leave = 1;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return window_close(newmenu_get_window(menu));
|
||||||
|
}
|
||||||
|
|
||||||
int newmenu_mouse(window *wind, d_event *event, newmenu *menu)
|
int newmenu_mouse(window *wind, d_event *event, newmenu *menu)
|
||||||
{
|
{
|
||||||
int old_choice, i;
|
int old_choice, i;
|
||||||
|
@ -620,7 +662,7 @@ int newmenu_mouse(window *wind, d_event *event, newmenu *menu)
|
||||||
|
|
||||||
if (menu->mouse_state && menu->all_text)
|
if (menu->mouse_state && menu->all_text)
|
||||||
{
|
{
|
||||||
menu->done = 1;
|
newmenu_close_window(menu);
|
||||||
gr_set_current_canvas(save_canvas);
|
gr_set_current_canvas(save_canvas);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -752,7 +794,7 @@ int newmenu_mouse(window *wind, d_event *event, newmenu *menu)
|
||||||
if (menu->subfunction && (*menu->subfunction)(menu, event, menu->userdata))
|
if (menu->subfunction && (*menu->subfunction)(menu, event, menu->userdata))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
menu->done = 1;
|
newmenu_close_window(menu);
|
||||||
gr_set_current_canvas(save_canvas);
|
gr_set_current_canvas(save_canvas);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -765,7 +807,7 @@ int newmenu_mouse(window *wind, d_event *event, newmenu *menu)
|
||||||
if (menu->subfunction && (*menu->subfunction)(menu, event, menu->userdata))
|
if (menu->subfunction && (*menu->subfunction)(menu, event, menu->userdata))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
menu->done = 1;
|
newmenu_close_window(menu);
|
||||||
gr_set_current_canvas(save_canvas);
|
gr_set_current_canvas(save_canvas);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -981,7 +1023,7 @@ int newmenu_key_command(window *wind, d_event *event, newmenu *menu)
|
||||||
if (menu->subfunction && (*menu->subfunction)(menu, event, menu->userdata))
|
if (menu->subfunction && (*menu->subfunction)(menu, event, menu->userdata))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
menu->done = 1;
|
newmenu_close_window(menu);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -992,8 +1034,8 @@ int newmenu_key_command(window *wind, d_event *event, newmenu *menu)
|
||||||
strcpy(item->text, item->saved_text );
|
strcpy(item->text, item->saved_text );
|
||||||
item->value = -1;
|
item->value = -1;
|
||||||
} else {
|
} else {
|
||||||
menu->done = 1;
|
|
||||||
menu->citem = -1;
|
menu->citem = -1;
|
||||||
|
newmenu_close_window(menu);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1243,7 +1285,7 @@ int newmenu_handler(window *wind, d_event *event, newmenu *menu)
|
||||||
if (rval < -1)
|
if (rval < -1)
|
||||||
{
|
{
|
||||||
menu->citem = rval;
|
menu->citem = rval;
|
||||||
menu->done = 1;
|
newmenu_close_window(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1; // event handled
|
return 1; // event handled
|
||||||
|
@ -1285,11 +1327,11 @@ int newmenu_handler(window *wind, d_event *event, newmenu *menu)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVENT_WINDOW_CLOSE:
|
case EVENT_WINDOW_CLOSE:
|
||||||
if (!menu->done)
|
if (!menu->leave)
|
||||||
{
|
{
|
||||||
menu->citem = -1;
|
menu->citem = -1;
|
||||||
menu->done = 1;
|
menu->leave = 1;
|
||||||
return 1; // cancel close and do it in newmenu_do4 instead
|
return 1; // cancel close and do it in newmenu_do2 instead
|
||||||
}
|
}
|
||||||
|
|
||||||
d_free(menu);
|
d_free(menu);
|
||||||
|
@ -1302,7 +1344,7 @@ int newmenu_handler(window *wind, d_event *event, newmenu *menu)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int newmenu_do4( char * title, char * subtitle, int nitems, newmenu_item * item, int (*subfunction)(newmenu *menu, d_event *event, void *userdata), void *userdata, int citem, char * filename, int width, int height, int TinyMode )
|
newmenu *newmenu_do4( char * title, char * subtitle, int nitems, newmenu_item * item, int (*subfunction)(newmenu *menu, d_event *event, void *userdata), void *userdata, int citem, char * filename, int width, int height, int TinyMode )
|
||||||
{
|
{
|
||||||
window *wind = NULL;
|
window *wind = NULL;
|
||||||
newmenu *menu;
|
newmenu *menu;
|
||||||
|
@ -1311,13 +1353,11 @@ int newmenu_do4( char * title, char * subtitle, int nitems, newmenu_item * item,
|
||||||
grs_font * save_font;
|
grs_font * save_font;
|
||||||
int string_width, string_height, average_width;
|
int string_width, string_height, average_width;
|
||||||
grs_canvas *menu_canvas, *save_canvas;
|
grs_canvas *menu_canvas, *save_canvas;
|
||||||
int rval = -1;
|
|
||||||
int done = 0;
|
|
||||||
|
|
||||||
MALLOC(menu, newmenu, 1);
|
MALLOC(menu, newmenu, 1);
|
||||||
|
|
||||||
if (!menu)
|
if (!menu)
|
||||||
return -1;
|
return NULL;
|
||||||
|
|
||||||
memset(menu, 0, sizeof(newmenu));
|
memset(menu, 0, sizeof(newmenu));
|
||||||
menu->citem = citem;
|
menu->citem = citem;
|
||||||
|
@ -1334,7 +1374,7 @@ int newmenu_do4( char * title, char * subtitle, int nitems, newmenu_item * item,
|
||||||
menu->items = item;
|
menu->items = item;
|
||||||
menu->filename = filename;
|
menu->filename = filename;
|
||||||
menu->tiny_mode = TinyMode;
|
menu->tiny_mode = TinyMode;
|
||||||
menu->done = 0;
|
menu->leave = 1; // Default to leaving newmenu_doX function
|
||||||
menu->userdata = userdata;
|
menu->userdata = userdata;
|
||||||
|
|
||||||
newmenu_close();
|
newmenu_close();
|
||||||
|
@ -1342,7 +1382,7 @@ int newmenu_do4( char * title, char * subtitle, int nitems, newmenu_item * item,
|
||||||
if (nitems < 1 )
|
if (nitems < 1 )
|
||||||
{
|
{
|
||||||
d_free(menu);
|
d_free(menu);
|
||||||
return -1;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
menu->max_displayable=nitems;
|
menu->max_displayable=nitems;
|
||||||
|
@ -1525,9 +1565,10 @@ int newmenu_do4( char * title, char * subtitle, int nitems, newmenu_item * item,
|
||||||
{
|
{
|
||||||
d_free(menu);
|
d_free(menu);
|
||||||
|
|
||||||
return -1;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
menu->wind = wind;
|
||||||
menu_canvas = window_get_canvas(wind);
|
menu_canvas = window_get_canvas(wind);
|
||||||
gr_set_curfont(save_font);
|
gr_set_curfont(save_font);
|
||||||
gr_set_current_canvas(menu_canvas);
|
gr_set_current_canvas(menu_canvas);
|
||||||
|
@ -1579,23 +1620,8 @@ int newmenu_do4( char * title, char * subtitle, int nitems, newmenu_item * item,
|
||||||
menu->mouse_state = 0;
|
menu->mouse_state = 0;
|
||||||
|
|
||||||
gr_set_current_canvas(save_canvas);
|
gr_set_current_canvas(save_canvas);
|
||||||
|
|
||||||
// All newmenus get their own event loop, for now.
|
return menu;
|
||||||
while (!done)
|
|
||||||
{
|
|
||||||
event_process();
|
|
||||||
|
|
||||||
if (menu->done)
|
|
||||||
{
|
|
||||||
rval = menu->citem;
|
|
||||||
if (!window_close(wind))
|
|
||||||
menu->done = 0; // user aborted close
|
|
||||||
else
|
|
||||||
done = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return rval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2048,7 +2074,7 @@ listbox *newmenu_listbox1( char * title, int nitems, char * items[], int allow_a
|
||||||
}
|
}
|
||||||
|
|
||||||
//added on 10/14/98 by Victor Rachels to attempt a fixedwidth font messagebox
|
//added on 10/14/98 by Victor Rachels to attempt a fixedwidth font messagebox
|
||||||
int nm_messagebox_fixedfont( char *title, int nchoices, ... )
|
newmenu *nm_messagebox_fixedfont( char *title, int nchoices, ... )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char * format;
|
char * format;
|
||||||
|
|
|
@ -76,10 +76,10 @@ extern int newmenu_do1(char *title, char *subtitle, int nitems, newmenu_item *it
|
||||||
extern int newmenu_do2(char *title, char *subtitle, int nitems, newmenu_item *item, int (*subfunction)(newmenu *menu, d_event *event, void *userdata), void *userdata, int citem, char *filename);
|
extern int newmenu_do2(char *title, char *subtitle, int nitems, newmenu_item *item, int (*subfunction)(newmenu *menu, d_event *event, void *userdata), void *userdata, int citem, char *filename);
|
||||||
|
|
||||||
// Same as above, only you can pass through the width and height
|
// Same as above, only you can pass through the width and height
|
||||||
extern int newmenu_do3(char *title, char *subtitle, int nitems, newmenu_item *item, int (*subfunction)(newmenu *menu, d_event *event, void *userdata), void *userdata, int citem, char *filename, int width, int height);
|
extern newmenu *newmenu_do3(char *title, char *subtitle, int nitems, newmenu_item *item, int (*subfunction)(newmenu *menu, d_event *event, void *userdata), void *userdata, int citem, char *filename, int width, int height);
|
||||||
|
|
||||||
// Tiny menu with GAME_FONT
|
// Tiny menu with GAME_FONT
|
||||||
extern int newmenu_dotiny(char * title, char * subtitle, int nitems, newmenu_item * item, int (*subfunction)(newmenu *menu, d_event *event, void *userdata), void *userdata);
|
extern newmenu *newmenu_dotiny(char * title, char * subtitle, int nitems, newmenu_item * item, int (*subfunction)(newmenu *menu, d_event *event, void *userdata), void *userdata);
|
||||||
|
|
||||||
// Sample Code:
|
// Sample Code:
|
||||||
/*
|
/*
|
||||||
|
@ -115,6 +115,7 @@ int nm_messagebox1(char *title, int (*subfunction)(newmenu *menu, d_event *event
|
||||||
newmenu_item *newmenu_get_items(newmenu *menu);
|
newmenu_item *newmenu_get_items(newmenu *menu);
|
||||||
int newmenu_get_nitems(newmenu *menu);
|
int newmenu_get_nitems(newmenu *menu);
|
||||||
int newmenu_get_citem(newmenu *menu);
|
int newmenu_get_citem(newmenu *menu);
|
||||||
|
struct window *newmenu_get_window(newmenu *menu);
|
||||||
void nm_draw_background(int x1, int y1, int x2, int y2);
|
void nm_draw_background(int x1, int y1, int x2, int y2);
|
||||||
void nm_restore_background(int x, int y, int w, int h);
|
void nm_restore_background(int x, int y, int w, int h);
|
||||||
|
|
||||||
|
@ -150,7 +151,7 @@ extern listbox *newmenu_listbox(char *title, int nitems, char *items[], int allo
|
||||||
extern listbox *newmenu_listbox1(char *title, int nitems, char *items[], int allow_abort_flag, int default_item, int (*listbox_callback)(listbox *lb, d_event *event, void *userdata), void *userdata);
|
extern listbox *newmenu_listbox1(char *title, int nitems, char *items[], int allow_abort_flag, int default_item, int (*listbox_callback)(listbox *lb, d_event *event, void *userdata), void *userdata);
|
||||||
|
|
||||||
//added on 10/14/98 by Victor Rachels to attempt a fixedwidth font messagebox
|
//added on 10/14/98 by Victor Rachels to attempt a fixedwidth font messagebox
|
||||||
int nm_messagebox_fixedfont(char *title, int nchoices, ...);
|
newmenu *nm_messagebox_fixedfont(char *title, int nchoices, ...);
|
||||||
//end this section addition
|
//end this section addition
|
||||||
|
|
||||||
//should be called whenever the palette changes
|
//should be called whenever the palette changes
|
||||||
|
|
|
@ -244,7 +244,7 @@ int state_get_savegame_filename(char * fname, char * dsc, char * caption, int bl
|
||||||
if (blind_save)
|
if (blind_save)
|
||||||
choice = state_default_item + 1;
|
choice = state_default_item + 1;
|
||||||
else
|
else
|
||||||
choice = newmenu_do3( NULL, caption, NUM_SAVES+1, m, (int (*)(newmenu *, d_event *, void *))state_callback, sc_bmp, state_default_item + 1, NULL, -1, -1 );
|
choice = newmenu_do2( NULL, caption, NUM_SAVES+1, m, (int (*)(newmenu *, d_event *, void *))state_callback, sc_bmp, state_default_item + 1, NULL );
|
||||||
|
|
||||||
for (i=0; i<NUM_SAVES; i++ ) {
|
for (i=0; i<NUM_SAVES; i++ ) {
|
||||||
if ( sc_bmp[i] )
|
if ( sc_bmp[i] )
|
||||||
|
|
Loading…
Reference in a new issue