tags 441528 +patch
thanks

Here's a patch which removes the confirmation at program exit.  It also
maps escape in menus to "exit" instead of "hide menu".

I'm still not too happy about escape for "popup menu", I'd rather have
some other button, with escape for a direct "exit" from stage, and also
from menu (back to stage).

Anyway, this is what I currently came up with. :-)

Thanks,
Bas

-- 
I encourage people to send encrypted e-mail (see http://www.gnupg.org).
If you have problems reading my e-mail, use a better reader.
Please send the central message of e-mails as plain text
   in the message body, not as HTML and definitely not as MS Word.
Please do not use the MS Word format for attachments either.
For more information, see http://pcbcn10.phys.rug.nl/e-mail.html
Index: hex-a-hop-0.0.20070315/menus.h
===================================================================
--- hex-a-hop-0.0.20070315.orig/menus.h	2008-04-22 17:40:39.000000000 +0200
+++ hex-a-hop-0.0.20070315/menus.h	2008-04-22 17:45:15.000000000 +0200
@@ -70,7 +70,7 @@
 	virtual void Mouse(int /*x*/, int /*y*/, int /*dx*/, int /*dy*/, int buttons_pressed, int /*buttons_released*/, int /*buttons*/) 
 	{
 		if (buttons_pressed==4 || buttons_pressed==2)
-			Cancel();
+			Pop();
 	}
 	
 	virtual void Move(int /*dir*/) {}
@@ -310,7 +310,7 @@
 					HintMessage::GetOuterWindowRect().h)
 				Move(1);
 			else
-				Cancel();
+				Pop();
 		}
 		else if (buttons_pressed==8)
 			Move(-1);
@@ -399,8 +399,6 @@
 	OPT_FULLSCREEN,
 	OPT_OPTIONS,
 	OPT_QUIT,
-	OPT_QUIT_CONFIRM,
-	OPT_QUIT_CANCEL,
 	OPT_QUIT_MENU_CONFIRM,
 	OPT_HELP,
 	OPT_GAMESLOT_NEW,
@@ -432,8 +430,6 @@
 	_("Toggle Fullscreen"),
 	_("Options"),
 	_("Quit"),
-	_("Yes"),
-	_("No"),
 	_("Return to Title"),
 	_("Help"),
 	_("Start New Game"),
@@ -1014,20 +1010,7 @@
 #endif
 	}
 	bool KeyPressed(int key, int mod);
-};
-
-struct QuitConfirmMenu : public OptMenuTitle
-{
-	QuitConfirmMenu() : OptMenuTitle(_("Quit: Are you sure?"))
-	{
-		opt[num_opt++] = OPT_QUIT_CONFIRM;
-		opt[select=num_opt++] = OPT_QUIT_CANCEL;
-		Init();
-
-		r.y += FONT_SPACING*1;
-		r2.y += FONT_SPACING*2;
-	}
-
+	void Cancel ();
 };
 
 struct DeleteConfirmMenu : public OptMenuTitle
@@ -1061,25 +1044,12 @@
 	}
 };
 
-bool TitleMenu::KeyPressed(int key, int mod)
-{
-	if (key==SDLK_DELETE || key==SDLK_BACKSPACE || key==SDLK_F2)
-	{
-		if (select<0 || select>=num_opt || opt[select]<OPT_GAMESLOT_0 || opt[select]>OPT_GAMESLOT_LAST)
-			return true;
-		int i = opt[select] - OPT_GAMESLOT_0;
-
-		new DeleteConfirmMenu(i);
-
-		return true;
-	}
-	return OptMenu::KeyPressed(key, mod);
-}
-
 struct PauseMenu : public OptMenu
 {
+	bool escape_to_map;
 	PauseMenu(bool isMap, bool allowGotoMap, int allowEnd, int allowEnd2) : OptMenu(_("Paused"))
 	{
+		escape_to_map = !isMap && allowGotoMap;
 		opt[num_opt++] = OPT_RESUME;
 		if (!isMap)
 			opt[num_opt++] = OPT_RESTART;
@@ -1087,18 +1057,19 @@
 		opt[num_opt++] = OPT_HELP;
 		if (allowEnd || allowEnd2)
 			opt[num_opt++] = allowEnd2 ? OPT_END2 : OPT_END;
-		opt[num_opt++] = (isMap || !allowGotoMap) ? OPT_QUIT_MENU_CONFIRM : OPT_GOTO_MAP;
+		opt[num_opt++] = escape_to_map ? OPT_GOTO_MAP : OPT_QUIT_MENU_CONFIRM;
 		Init();
 	}
 	virtual bool KeyPressed(int key, int mod)
 	{
 		if (key=='p' || key==SDLK_PAUSE)
 		{
-			Cancel();
+			Pop();
 			return true;
 		}
 		return Menu::KeyPressed(key, mod);
 	}
+	void Cancel ();
 	
 };
 
@@ -1182,12 +1153,38 @@
 	}
 };
 
+bool TitleMenu::KeyPressed(int key, int mod)
+{
+	if (key==SDLK_DELETE || key==SDLK_BACKSPACE || key==SDLK_F2)
+	{
+		if (select<0 || select>=num_opt || opt[select]<OPT_GAMESLOT_0 || opt[select]>OPT_GAMESLOT_LAST)
+			return true;
+		int i = opt[select] - OPT_GAMESLOT_0;
+
+		new DeleteConfirmMenu(i);
+
+		return true;
+	}
+	return OptMenu::KeyPressed(key, mod);
+}
+
+void TitleMenu::Cancel ()
+{
+	new Fader (-1, -2);
+}
+
 void Ending::Cancel()
 {
 	new Fader(-1, -6, 0.3);
 //	Pop();
 }
 
+void PauseMenu::Cancel ()
+{
+	opt[select] = escape_to_map ? OPT_GOTO_MAP : OPT_QUIT_MENU_CONFIRM;
+	Select ();
+}
+
 void ToggleFullscreen();
 
 void OptMenu::Select()
@@ -1197,11 +1194,11 @@
 	switch(opt[select])
 	{
 		case OPT_RESUME:
-			Cancel();
+			Pop();
 			break;
 
 		case OPT_RESTART:
-			Cancel();
+			Pop();
 			HackKeyPress('r', KMOD_CTRL);
 			break;
 
@@ -1211,15 +1208,11 @@
 			HackKeyPress(SDLK_ESCAPE, KMOD_CTRL);
 			break;
 
-		case OPT_QUIT:
-			new QuitConfirmMenu();
-			break;
-
 		case OPT_FULLSCREEN:
 			ToggleFullscreen();
 			break;
 
-		case OPT_QUIT_CONFIRM:
+		case OPT_QUIT:
 			new Fader(-1, -2);
 			break;
 
@@ -1236,7 +1229,6 @@
 			new HintReview();
 			break;
 
-		case OPT_QUIT_CANCEL:
 		case OPT_BACK:
 			Pop();
 			break;

Attachment: signature.asc
Description: Digital signature

Reply via email to