Map command can now be called from anywhere in the main menu UI

This commit is contained in:
Justin Marshall
2020-06-12 14:03:10 -07:00
parent f261a00a0a
commit 712a5e519d
5 changed files with 18 additions and 2 deletions
+4
View File
@@ -1096,6 +1096,10 @@ void Console_Tick(void);
typedef void (*xcommand_t) (void);
void Cmd_AddCommand(char* cmd_name, xcommand_t function);
#include <setjmp.h>
extern jmp_buf select_game_jump;
/*
** Achievement event. ST - 11/11/2019 11:39AM
*/
+10
View File
@@ -446,6 +446,9 @@ bool Init_Game(int , char * [])
extern bool Get_Broadcast_Addresses (void);
#endif
jmp_buf select_game_jump;
/***********************************************************************************************
* Select_Game -- The game's main menu *
* *
@@ -515,6 +518,13 @@ bool Select_Game(bool fade)
int cdcheck = 0;
bool cs = Is_Counterstrike_Installed();
#endif
setjmp(select_game_jump);
if (Scen.warpIntoMap) {
Scen.warpIntoMap = false;
return true;
}
// #ifndef DVD // Denzil - We want the menu screen ajw No we don't
// if (Special.IsFromInstall) {
-1
View File
@@ -734,7 +734,6 @@ int Main_Menu(unsigned long )
bool display = true;
bool process = true;
while (process) {
#ifdef WIN32
/*
** If we have just received input focus again after running in the background then
+3 -1
View File
@@ -186,6 +186,7 @@ ScenarioClass::ScenarioClass(void) :
memset(GlobalFlags, '\0', sizeof(GlobalFlags));
memset(Views, '\0', sizeof(Views));
// jmarshall
warpIntoMap = false;
Cmd_AddCommand("map", Cmd_Map);
// jmarshall end
}
@@ -3759,6 +3760,7 @@ void Cmd_Map(void) {
Console_Printf("usage: map <map_name>\n");
return;
}
Scen.warpIntoMap = true;
Start_Scenario(Cmd_Argv(1));
longjmp(select_game_jump, 1);
}
+1
View File
@@ -327,6 +327,7 @@ class ScenarioClass {
bool bOtherProposesDraw; // True if the other player in a 2-player game has a draw offer extended.
#endif
bool warpIntoMap;
};