Added quit options to ingame menu, from Paxtez

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1043 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
gewlitys
2003-07-09 18:54:59 +00:00
parent f7d6333240
commit 6c351b380f
5 changed files with 105 additions and 1 deletions
+1
View File
@@ -1,4 +1,5 @@
Changes towards version 0.3: Changes towards version 0.3:
- Added quit options to ingame menu (bug #409), from Paxtez
- Fix position of blinking save/load in melee, from Paxtez - Fix position of blinking save/load in melee, from Paxtez
- New packaging/io system. - SvdB - New packaging/io system. - SvdB
- Exit confirmation dialog is prettier and safer, from Paxtez - Exit confirmation dialog is prettier and safer, from Paxtez
+3
View File
@@ -13,6 +13,7 @@ playmenu.11.png 0 0 0 10
playmenu.12.png 0 0 0 10 playmenu.12.png 0 0 0 10
playmenu.13.png 0 0 0 10 playmenu.13.png 0 0 0 10
playmenu.14.png 0 0 0 10 playmenu.14.png 0 0 0 10
playmenu.64.png 0 0 0 10
playmenu.15.png 0 0 0 10 playmenu.15.png 0 0 0 10
playmenu.16.png 0 0 1 10 playmenu.16.png 0 0 1 10
playmenu.17.png 0 0 0 10 playmenu.17.png 0 0 0 10
@@ -36,6 +37,8 @@ playmenu.34.png 0 0 0 10
playmenu.35.png 0 0 0 10 playmenu.35.png 0 0 0 10
playmenu.36.png 0 0 0 10 playmenu.36.png 0 0 0 10
playmenu.37.png 0 0 1 10 playmenu.37.png 0 0 1 10
playmenu.65.png 0 0 1 10
playmenu.66.png 0 0 1 10
playmenu.38.png 0 0 -10 -177 playmenu.38.png 0 0 -10 -177
playmenu.39.png 0 0 -27 -177 playmenu.39.png 0 0 -27 -177
playmenu.40.png 0 0 -48 -177 playmenu.40.png 0 0 -48 -177
+77 -1
View File
@@ -86,6 +86,7 @@ enum
{ {
SAVE_GAME = 0, SAVE_GAME = 0,
LOAD_GAME, LOAD_GAME,
QUIT_GAME,
SETTINGS SETTINGS
}; };
@@ -106,6 +107,12 @@ enum
EXIT_MENU_SETTING EXIT_MENU_SETTING
}; };
enum
{
NO_QUIT_MENU,
YES_QUIT_MENU
};
static void static void
FeedbackSetting (BYTE which_setting) FeedbackSetting (BYTE which_setting)
{ {
@@ -158,6 +165,25 @@ FeedbackSetting (BYTE which_setting)
DrawStatusMessage (buf); DrawStatusMessage (buf);
ClearSemaphore (GraphicsSem); ClearSemaphore (GraphicsSem);
} }
static void
FeedbackQuit (BYTE which_setting)
{
UNICODE buf[20];
buf[0] = '\0';
switch (which_setting)
{
case NO_QUIT_MENU:
wsprintf (buf, "Don't Quit");
break;
case YES_QUIT_MENU:
wsprintf (buf, "Quit Game");
break;
}
SetSemaphore (GraphicsSem);
DrawStatusMessage (buf);
ClearSemaphore (GraphicsSem);
}
static BOOLEAN DoSettings (PMENU_STATE pMS); static BOOLEAN DoSettings (PMENU_STATE pMS);
@@ -537,6 +563,51 @@ DoSettings (PMENU_STATE pMS)
return (TRUE); return (TRUE);
} }
static BOOLEAN
DoQuitMenu (PMENU_STATE pMS)
{
if (GLOBAL (CurrentActivity) & CHECK_ABORT)
return (FALSE);
if (!pMS->Initialized)
{
DrawMenuStateStrings (PM_NO_QUIT, pMS->CurState);
FeedbackQuit (pMS->CurState);
pMS->Initialized = TRUE;
pMS->InputFunc = DoQuitMenu;
}
else if (CurrentMenuState.cancel
|| (CurrentMenuState.select
&& pMS->CurState == NO_QUIT_MENU))
{
SetSemaphore (GraphicsSem);
DrawStatusMessage (NULL_PTR);
ClearSemaphore (GraphicsSem);
pMS->CurState = QUIT_GAME;
pMS->InputFunc = DoGameOptions;
pMS->Initialized = 0;
}
else if (CurrentMenuState.select)
{
switch (pMS->CurState)
{
case NO_QUIT_MENU:
break;
case YES_QUIT_MENU:
GLOBAL (CurrentActivity) |= CHECK_ABORT;
ExitRequested = FALSE;
GameExiting = TRUE;
break;
}
FeedbackQuit (pMS->CurState);
}
else if (DoMenuChooser (pMS, PM_NO_QUIT))
FeedbackQuit (pMS->CurState);
return (TRUE);
}
static void static void
DrawCargo (COUNT redraw_state) DrawCargo (COUNT redraw_state)
{ {
@@ -931,7 +1002,7 @@ DoPickGame (PMENU_STATE pMS)
{ {
extern FRAME PlayFrame; extern FRAME PlayFrame;
pMS->ModuleFrame = SetAbsFrameIndex (PlayFrame, 38); pMS->ModuleFrame = SetAbsFrameIndex (PlayFrame, 41);
} }
SetSemaphore (GraphicsSem); SetSemaphore (GraphicsSem);
@@ -1247,6 +1318,11 @@ DoGameOptions (PMENU_STATE pMS)
case LOAD_GAME: case LOAD_GAME:
pMS->CurFrame = (FRAME)FadeMusic (0, ONE_SECOND >> 1); pMS->CurFrame = (FRAME)FadeMusic (0, ONE_SECOND >> 1);
return (PickGame (pMS)); return (PickGame (pMS));
case QUIT_GAME:
pMS->Initialized = FALSE;
pMS->CurState = NO_QUIT_MENU;
pMS->InputFunc = DoQuitMenu;
break;
case SETTINGS: case SETTINGS:
pMS->Initialized = FALSE; pMS->Initialized = FALSE;
pMS->InputFunc = DoSettings; pMS->InputFunc = DoSettings;
+20
View File
@@ -66,6 +66,7 @@ static char menu_string[][11] = {
"save game", "save game",
"load game", "load game",
"quit game",
"settings", "settings",
"exit menu", "exit menu",
@@ -93,6 +94,9 @@ static char menu_string[][11] = {
"", "",
"", "",
"", "",
//PM_QUIT
"No, Play",
"Yes, Quit",
//PM_ALTSCAN //PM_ALTSCAN
"scan", "scan",
"starmap", "starmap",
@@ -192,6 +196,9 @@ GetEndMenuState (BYTE BaseState)
case PM_SOUND_ON: case PM_SOUND_ON:
return PM_EXIT_MENU4; return PM_EXIT_MENU4;
break; break;
case PM_NO_QUIT:
return PM_YES_QUIT;
break;
case PM_ALT_SCAN: case PM_ALT_SCAN:
case PM_ALT_STARMAP: case PM_ALT_STARMAP:
return PM_ALT_NAVIGATE; return PM_ALT_NAVIGATE;
@@ -555,6 +562,19 @@ DrawMenuStateStrings (BYTE beg_index, SWORD NewState)
break; break;
} }
} }
if (beg_index == PM_NO_QUIT)
{
end_index = beg_index + 1;
switch (beg_index + NewState)
{
case PM_NO_QUIT:
NewState = 0;
break;
case PM_YES_QUIT:
NewState = 1;
break;
}
}
r.extent.height = RADAR_HEIGHT + 11; r.extent.height = RADAR_HEIGHT + 11;
DrawPCMenu (beg_index, end_index, (BYTE)NewState, hilite, &r); DrawPCMenu (beg_index, end_index, (BYTE)NewState, hilite, &r);
s.frame = 0; s.frame = 0;
+4
View File
@@ -22,6 +22,7 @@ enum
PM_SAVE_GAME, PM_SAVE_GAME,
PM_LOAD_GAME, PM_LOAD_GAME,
PM_QUIT_GAME,
PM_CHANGE_SETTINGS, PM_CHANGE_SETTINGS,
PM_EXIT_MENU1, PM_EXIT_MENU1,
@@ -50,6 +51,9 @@ enum
PM_CHANGE_SHIP, PM_CHANGE_SHIP,
PM_EXIT_MENU4, PM_EXIT_MENU4,
PM_NO_QUIT,
PM_YES_QUIT,
PM_ALT_SCAN, PM_ALT_SCAN,
PM_ALT_STARMAP, PM_ALT_STARMAP,
PM_ALT_MANIFEST, PM_ALT_MANIFEST,