aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/jake2/client/Menu.java35
-rw-r--r--src/jake2/client/VID.java136
2 files changed, 44 insertions, 127 deletions
diff --git a/src/jake2/client/Menu.java b/src/jake2/client/Menu.java
index 6759559..d520e22 100644
--- a/src/jake2/client/Menu.java
+++ b/src/jake2/client/Menu.java
@@ -2,7 +2,7 @@
* Menu.java
* Copyright (C) 2004
*
- * $Id: Menu.java,v 1.14 2005-01-11 14:24:59 hzi Exp $
+ * $Id: Menu.java,v 1.15 2005-01-12 08:36:21 hzi Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -1430,16 +1430,14 @@ public final class Menu extends Key {
}
}
- static String cd_music_items[] = { "disabled", "enabled", null };
-
- static String soundstate_items[] = { "on", "off", null };
+ static String cd_music_items[] = { "disabled", "enabled" };
static String compatibility_items[] = { "max compatibility",
- "max performance", null };
+ "max performance" };
- static String yesno_names[] = { "no", "yes", null };
+ static String yesno_names[] = { "no", "yes" };
- static String crosshair_names[] = { "none", "cross", "dot", "angle", null };
+ static String crosshair_names[] = { "none", "cross", "dot", "angle" };
static void Options_MenuInit() {
@@ -2021,7 +2019,7 @@ public final class Menu extends Key {
}
static String difficulty_names[] = { "easy", "medium",
- "fuckin shitty hard", null };
+ "fuckin shitty hard" };
static void Game_MenuInit() {
@@ -2696,11 +2694,9 @@ public final class Menu extends Key {
ForceMenuOff();
}
- static String dm_coop_names[] = { "deathmatch", "cooperative", null };
+ static String dm_coop_names[] = { "deathmatch", "cooperative" };
- static String dm_coop_names_rogue[] = { "deathmatch", "cooperative", "tag",
- // "deathball",
- null };
+ static String dm_coop_names_rogue[] = { "deathmatch", "cooperative", "tag" };
static void StartServer_MenuInit() {
@@ -2743,7 +2739,7 @@ public final class Menu extends Key {
if (nummaps == 0)
Com.Error(ERR_DROP, "no maps in maps.lst\n");
- mapnames = new String[nummaps + 1];
+ mapnames = new String[nummaps];
for (i = 0; i < nummaps; i++) {
String shortname, longname, scratch;
@@ -2755,7 +2751,6 @@ public final class Menu extends Key {
scratch = longname + "\n" + shortname;
mapnames[i] = scratch;
}
- mapnames[nummaps] = null;
if (fp != null) {
Lib.fclose(fp);
@@ -3094,7 +3089,7 @@ public final class Menu extends Key {
}
//static String yes_no_names[] = { "no", "yes", 0 };
- static String teamplay_names[] = { "disabled", "by skin", "by model", null };
+ static String teamplay_names[] = { "disabled", "by skin", "by model" };
static void DMOptions_MenuInit() {
@@ -3449,7 +3444,7 @@ public final class Menu extends Key {
}
}
- static String yes_no_names[] = { "no", "yes", null };
+ static String yes_no_names[] = { "no", "yes" };
static void DownloadOptions_MenuInit() {
@@ -3719,7 +3714,7 @@ public final class Menu extends Key {
static int rate_tbl[] = { 2500, 3200, 5000, 10000, 25000, 0 };
static String rate_names[] = { "28.8 Modem", "33.6 Modem", "Single ISDN",
- "Dual ISDN/Cable", "T1/LAN", "User defined", null };
+ "Dual ISDN/Cable", "T1/LAN", "User defined" };
static void DownloadOptionsFunc(Object self) {
Menu_DownloadOptions_f();
@@ -3925,7 +3920,7 @@ public final class Menu extends Key {
return a.directory.compareTo(b.directory);
}
- static String handedness[] = { "right", "left", "center", null };
+ static String handedness[] = { "right", "left", "center" };
static boolean PlayerConfig_MenuInit() {
/*
@@ -4899,8 +4894,8 @@ public final class Menu extends Key {
if (s.curvalue < 0)
s.curvalue = 0;
- else if (s.curvalue >= s.itemnames.length)
- s.curvalue = s.itemnames.length - 1;
+ else if (s.curvalue >= s.itemnames.length || s.itemnames[s.curvalue] == null)
+ s.curvalue--;
if (s.callback != null)
s.callback.execute(s);
diff --git a/src/jake2/client/VID.java b/src/jake2/client/VID.java
index dccf1de..4241411 100644
--- a/src/jake2/client/VID.java
+++ b/src/jake2/client/VID.java
@@ -2,7 +2,7 @@
* VID.java
* Copyright (C) 2003
*
- * $Id: VID.java,v 1.13 2005-01-12 00:40:14 cawe Exp $
+ * $Id: VID.java,v 1.14 2005-01-12 08:36:21 hzi Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -435,62 +435,11 @@ public class VID extends Globals {
Cvar.SetValue( "gl_mode", s_mode_list.curvalue );
Cvar.SetValue( "_windowed_mouse", s_windowed_mouse.curvalue);
- switch ( s_ref_list.curvalue )
- {
-// case REF_SOFT:
-// Cvar_Set( "vid_ref", "soft" );
-// break;
-// case REF_SOFTX11:
-// Cvar_Set( "vid_ref", "softx" );
-// break;
-//
-// case REF_MESA3D :
-// Cvar_Set( "vid_ref", "gl" );
-// Cvar_Set( "gl_driver", "libMesaGL.so.2" );
-// if (gl_driver->modified)
-// vid_ref->modified = true;
-// break;
-//
-// case REF_OPENGLX :
-// Cvar_Set( "vid_ref", "glx" );
-// Cvar_Set( "gl_driver", "libGL.so" );
-// if (gl_driver->modified)
-// vid_ref->modified = true;
-// break;
-//
-// case REF_MESA3DGLX :
-// Cvar_Set( "vid_ref", "glx" );
-// Cvar_Set( "gl_driver", "libMesaGL.so.2" );
-// if (gl_driver->modified)
-// vid_ref->modified = true;
-// break;
-//
-// case REF_3DFXGL :
-// Cvar_Set( "vid_ref", "gl" );
-// Cvar_Set( "gl_driver", "lib3dfxgl.so" );
-// if (gl_driver->modified)
-// vid_ref->modified = true;
-// break;
- case REF_OPENGL_JOGL :
- Cvar.Set( "vid_ref", "jogl" );
- Cvar.Set( "gl_driver", "jogl" );
- if (gl_driver.modified)
- vid_ref.modified = true;
- break;
- case REF_OPENGL_FASTJOGL :
- Cvar.Set( "vid_ref", "fastjogl" );
- Cvar.Set( "gl_driver", "fastjogl" );
- if (gl_driver.modified)
- vid_ref.modified = true;
- break;
- case REF_OPENGL_LWJGL :
- Cvar.Set( "vid_ref", "lwjgl" );
- Cvar.Set( "gl_driver", "lwjgl" );
- if (gl_driver.modified)
- vid_ref.modified = true;
- break;
- }
-
+ Cvar.Set( "vid_ref", drivers[s_ref_list.curvalue] );
+ Cvar.Set( "gl_driver", drivers[s_ref_list.curvalue] );
+ if (gl_driver.modified)
+ vid_ref.modified = true;
+
Menu.ForceMenuOff();
}
@@ -512,18 +461,9 @@ public class VID extends Globals {
static String[] fs_resolutions;
static int mode_x;
- static final String[] refs =
- {
- // "[software ]",
- // "[software X11 ]",
- // "[Mesa 3-D 3DFX ]",
- // "[3DFXGL Miniport]",
- // "[OpenGL glX ]",
- // "[Mesa 3-D glX ]",
- "[OpenGL jogl ]",
- "[OpenGL fastjogl]",
- "[OpenGL lwjgl ]",
- };
+ static String[] refs;
+ static String[] drivers;
+
static final String[] yesno_names =
{
"no",
@@ -555,11 +495,26 @@ public class VID extends Globals {
}
}
+ private static void initRefs() {
+ drivers = Renderer.getDriverNames();
+ refs = new String[drivers.length];
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < drivers.length; i++) {
+ sb.setLength(0);
+ sb.append("[OpenGL ").append(drivers[i]);
+ while (sb.length() < 16) sb.append(" ");
+ sb.append("]");
+ refs[i] = sb.toString();
+ }
+ }
+
/*
** VID_MenuInit
*/
public static void MenuInit() {
+ initRefs();
+
if ( gl_driver == null )
gl_driver = Cvar.Get( "gl_driver", Renderer.getPreferedName(), 0 );
if ( gl_picmip == null )
@@ -597,45 +552,12 @@ public class VID extends Globals {
s_screensize_slider.curvalue = (int)(SCR.scr_viewsize.value/10);
-// if ( strcmp( vid_ref->string, "soft" ) == 0)
-// {
-// s_current_menu_index = SOFTWARE_MENU;
-// s_ref_list[0].curvalue = s_ref_list[1].curvalue = REF_SOFT;
-// }
- if ( vid_ref.string.equalsIgnoreCase("jogl"))
- {
- s_ref_list.curvalue = REF_OPENGL_JOGL;
- }
- else if ( vid_ref.string.equalsIgnoreCase("fastjogl"))
- {
- s_ref_list.curvalue = REF_OPENGL_FASTJOGL;
- }
- else if ( vid_ref.string.equalsIgnoreCase("lwjgl"))
- {
- s_ref_list.curvalue = REF_OPENGL_LWJGL;
+ for (int i = 0; i < drivers.length; i++) {
+ if (vid_ref.string.equals(drivers[i])) {
+ s_ref_list.curvalue = i;
+ }
}
-// else if (strcmp( vid_ref->string, "softx" ) == 0 )
-// {
-// s_current_menu_index = SOFTWARE_MENU;
-// s_ref_list[0].curvalue = s_ref_list[1].curvalue = REF_SOFTX11;
-// }
-// else if ( strcmp( vid_ref->string, "gl" ) == 0 )
-// {
-// s_current_menu_index = OPENGL_MENU;
-// if ( strcmp( gl_driver->string, "lib3dfxgl.so" ) == 0 )
-// s_ref_list[s_current_menu_index].curvalue = REF_3DFXGL;
-// else
-// s_ref_list[s_current_menu_index].curvalue = REF_MESA3D;
-// }
-// else if ( strcmp( vid_ref->string, "glx" ) == 0 )
-// {
-// s_current_menu_index = OPENGL_MENU;
-// if ( strcmp( gl_driver->string, "libMesaGL.so.2" ) == 0 )
-// s_ref_list[s_current_menu_index].curvalue = REF_MESA3DGLX;
-// else
-// s_ref_list[s_current_menu_index].curvalue = REF_OPENGLX;
-// }
-//
+
s_opengl_menu.x = (int)(viddef.width * 0.50f);
s_opengl_menu.nitems = 0;