Added hotkeys to toggle fullscreen mode
authorBradley Bell <btb@icculus.org>
Thu, 14 Feb 2002 10:18:24 +0000 (10:18 +0000)
committerBradley Bell <btb@icculus.org>
Thu, 14 Feb 2002 10:18:24 +0000 (10:18 +0000)
NEWS
include/gr.h
main/game.c
main/game.h
main/gamecntl.c
main/netlist.c

diff --git a/NEWS b/NEWS
index c9bdcba..ae8f046 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+--- Version 0.1.3 ---
+- Added hotkeys to toggle fullscreen mode (same as d1x)
+
 --- Version 0.1.2 ---
 - SDL uses mouse wheel to emulate 3rd axis.
 - Player files created with descent 2 should now work with d2x.
index 49d5032..620ef95 100644 (file)
@@ -486,7 +486,4 @@ int gr_toggle_fullscreen(void);
 
 int gr_toggle_fullscreen_menu(void);//returns state after toggling (ie, same as if you had called check_fullscreen immediatly after)
 
-//make this a define, since its used in several places
-#define KEYS_GR_TOGGLE_FULLSCREEN KEY_CTRLED+KEY_SHIFTED+KEY_PADENTER: case KEY_ALTED+KEY_CTRLED+KEY_PADENTER: case KEY_ALTED+KEY_SHIFTED+KEY_PADENTER
-
 #endif
index 67403de..b36b796 100644 (file)
@@ -16,7 +16,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #endif
 
 #ifdef RCS
-char game_rcsid[] = "$Id: game.c,v 1.9 2002-02-13 10:45:05 bradleyb Exp $";
+char game_rcsid[] = "$Id: game.c,v 1.10 2002-02-14 10:18:23 bradleyb Exp $";
 #endif
 
 #ifdef WINDOWS
@@ -117,6 +117,7 @@ char game_rcsid[] = "$Id: game.c,v 1.9 2002-02-13 10:45:05 bradleyb Exp $";
 #include "playsave.h"
 #include "fix.h"
 #include "d_delay.h"
+#include "hudmsg.h"
 
 int VGA_current_mode;
 
@@ -1080,6 +1081,22 @@ WIN(static int saved_window_h);
        return 1;
 }
 
+int gr_toggle_fullscreen_game(void){
+#ifdef GR_SUPPORTS_FULLSCREEN_TOGGLE
+       int i;
+       hud_message(MSGC_GAME_FEEDBACK, "toggling fullscreen mode %s",(i=gr_toggle_fullscreen())?"on":"off" );
+       //added 2000/06/19 Matthew Mueller - hack to fix "infinite toggle" problem
+       //it seems to be that the screen mode change takes long enough that the key has already sent repeat codes, or that its unpress event gets dropped, etc.  This is a somewhat ugly fix, but it works.
+//     generic_key_handler(KEY_PADENTER,0);
+       key_flush();
+       //end addition -MM
+       return i;
+#else
+       hud_message(MSGC_GAME_FEEDBACK, "fullscreen toggle not supported by this target");
+       return -1;
+#endif
+}
+
 int arch_toggle_fullscreen_menu(void);
 
 int gr_toggle_fullscreen_menu(void){
@@ -1087,7 +1104,7 @@ int gr_toggle_fullscreen_menu(void){
        int i;
        i=arch_toggle_fullscreen_menu();
 
-       generic_key_handler(KEY_PADENTER,0);
+//     generic_key_handler(KEY_PADENTER,0);
        key_flush();
 
        return i;
index 3aef589..4804052 100644 (file)
@@ -255,5 +255,6 @@ void enable_flicker(int segnum,int sidenum);
 //returns 1 if ok, 0 if error
 int add_flicker(int segnum,int sidenum,fix delay,ulong mask);
 
-#endif
+int gr_toggle_fullscreen_game(void);
 
+#endif
index f871040..973fefa 100644 (file)
@@ -1387,7 +1387,49 @@ int HandleSystemKey(int key)
                        break;
                #endif
 
-               default:                                                                break;
+//added 8/23/99 by Matt Mueller for hot key res/fullscreen changing, and menu access
+#if 0
+               case KEY_CTRLED+KEY_SHIFTED+KEY_PADDIVIDE:
+               case KEY_ALTED+KEY_CTRLED+KEY_PADDIVIDE:
+               case KEY_ALTED+KEY_SHIFTED+KEY_PADDIVIDE:
+                       d1x_options_menu();
+                       break;
+               case KEY_CTRLED+KEY_SHIFTED+KEY_PADMULTIPLY:
+               case KEY_ALTED+KEY_CTRLED+KEY_PADMULTIPLY:
+               case KEY_ALTED+KEY_SHIFTED+KEY_PADMULTIPLY:
+                       change_res();
+                       break;
+               case KEY_CTRLED+KEY_SHIFTED+KEY_PADMINUS:
+               case KEY_ALTED+KEY_CTRLED+KEY_PADMINUS:
+               case KEY_ALTED+KEY_SHIFTED+KEY_PADMINUS:
+                       //lower res 
+                       //should we just cycle through the list that is displayed in the res change menu?
+                       // what if their card/X/etc can't handle that mode? hrm. 
+                       //well, the quick access to the menu is good enough for now.
+                       break;
+               case KEY_CTRLED+KEY_SHIFTED+KEY_PADPLUS:
+               case KEY_ALTED+KEY_CTRLED+KEY_PADPLUS:
+               case KEY_ALTED+KEY_SHIFTED+KEY_PADPLUS:
+                       //increase res
+                       break;
+#endif
+               case KEY_CTRLED+KEY_SHIFTED+KEY_PADENTER:
+               case KEY_ALTED+KEY_CTRLED+KEY_PADENTER:
+               case KEY_ALTED+KEY_SHIFTED+KEY_PADENTER:
+                       gr_toggle_fullscreen_game();
+                       break;
+//end addition -MM
+                       
+//added 11/01/98 Matt Mueller
+#if 0
+               case KEY_CTRLED+KEY_ALTED+KEY_LAPOSTRO:
+                       toggle_hud_log();
+                       break;
+#endif
+//end addition -MM
+
+               default:
+                       break;
 
        }        //switch (key)
 
index 8c279af..1d1ca9d 100644 (file)
@@ -1,13 +1,16 @@
 /*
  * $Source: /cvs/cvsroot/d2x/main/netlist.c,v $
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
  * $Author: bradleyb $
- * $Date: 2002-02-14 09:24:19 $
+ * $Date: 2002-02-14 10:18:24 $
  *
  * Descent II-a-like network game join menu
  * Arne de Bruijn, 1998
  *
  * $Log: not supported by cvs2svn $
+ * Revision 1.2  2002/02/14 09:24:19  bradleyb
+ * d1x->d2x
+ *
  * Revision 1.1  2002/02/14 09:05:33  bradleyb
  * Lotsa networking stuff from d1x
  *
@@ -699,7 +702,9 @@ int network_join_game_menu() {
                                selected_game = -1;
                                done = 1;
                                break;
-                       case KEYS_GR_TOGGLE_FULLSCREEN:
+                       case KEY_CTRLED+KEY_SHIFTED+KEY_PADENTER:
+                       case KEY_ALTED+KEY_CTRLED+KEY_PADENTER:
+                       case KEY_ALTED+KEY_SHIFTED+KEY_PADENTER:
                                gr_toggle_fullscreen_menu();
                                break;
                }