From: Holger Z. <hz...@us...> - 2004-08-23 20:49:24
|
Update of /cvsroot/jake2/jake2/src/jake2/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32547/src/jake2/client Modified Files: VID.java Log Message: - better vid mode selection when switching between window and fullscreen - new configurable window mode 11 vid_wdth x vid_height (CAVE!) Index: VID.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/VID.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** VID.java 16 Jul 2004 10:11:36 -0000 1.8 --- VID.java 23 Aug 2004 20:49:12 -0000 1.9 *************** *** 64,67 **** --- 64,69 ---- static cvar_t vid_xpos; // X coordinate of window position static cvar_t vid_ypos; // Y coordinate of window position + static cvar_t vid_width; + static cvar_t vid_height; static cvar_t vid_fullscreen; *************** *** 102,107 **** ============ */ ! static void Restart_f() ! { vid_ref.modified = true; } --- 104,111 ---- ============ */ ! static void Restart_f() { ! vid_modes[11].width = (int) vid_width.value; ! vid_modes[11].height = (int) vid_height.value; ! vid_ref.modified = true; } *************** *** 110,114 **** ** VID_GetModeInfo */ ! static final vidmode_t vid_modes[] = { new vidmode_t("Mode 0: 320x240", 320, 240, 0), --- 114,118 ---- ** VID_GetModeInfo */ ! static vidmode_t vid_modes[] = { new vidmode_t("Mode 0: 320x240", 320, 240, 0), *************** *** 122,126 **** new vidmode_t("Mode 8: 1280x1024", 1280, 1024, 8), new vidmode_t("Mode 9: 1600x1200", 1600, 1200, 9), ! new vidmode_t("Mode 10: 2048x1536", 2048, 1536, 10)}; static vidmode_t fs_modes[]; --- 126,131 ---- new vidmode_t("Mode 8: 1280x1024", 1280, 1024, 8), new vidmode_t("Mode 9: 1600x1200", 1600, 1200, 9), ! new vidmode_t("Mode 10: 2048x1536", 2048, 1536, 10), ! new vidmode_t("Mode 11: user", 640, 480, 11)}; static vidmode_t fs_modes[]; *************** *** 131,139 **** if (vid_fullscreen.value != 0.0f) modes = fs_modes; ! if (mode < 0 || mode >= modes.length) return false; ! dim.width = modes[mode].width; dim.height = modes[mode].height; return true; } --- 136,145 ---- if (vid_fullscreen.value != 0.0f) modes = fs_modes; ! if (mode < 0 || mode >= modes.length) return false; ! dim.width = modes[mode].width; dim.height = modes[mode].height; + return true; } *************** *** 293,299 **** --- 299,310 ---- vid_xpos = Cvar.Get("vid_xpos", "3", CVAR_ARCHIVE); vid_ypos = Cvar.Get("vid_ypos", "22", CVAR_ARCHIVE); + vid_width = Cvar.Get("vid_width", "640", CVAR_ARCHIVE); + vid_height = Cvar.Get("vid_height", "480", CVAR_ARCHIVE); vid_fullscreen = Cvar.Get("vid_fullscreen", "0", CVAR_ARCHIVE); vid_gamma = Cvar.Get( "vid_gamma", "1", CVAR_ARCHIVE ); + vid_modes[11].width = (int)vid_width.value; + vid_modes[11].height = (int)vid_height.value; + /* Add some console commands that we want to handle */ Cmd.AddCommand ("vid_restart", new xcommand_t() { *************** *** 539,547 **** "[1600 1200]", "[2048 1536]", null }; static String[] fs_resolutions; ! static int last_fs; ! static int last_win; static final String[] refs = --- 550,558 ---- "[1600 1200]", "[2048 1536]", + "user mode", null }; static String[] fs_resolutions; ! static int mode_x; static final String[] refs = *************** *** 618,622 **** s_mode_list[OPENGL_MENU].curvalue = 0; } ! last_fs = s_mode_list[OPENGL_MENU].curvalue; } else { s_mode_list[OPENGL_MENU].itemnames = resolutions; --- 629,633 ---- s_mode_list[OPENGL_MENU].curvalue = 0; } ! mode_x = fs_modes[s_mode_list[OPENGL_MENU].curvalue].width; } else { s_mode_list[OPENGL_MENU].itemnames = resolutions; *************** *** 624,628 **** s_mode_list[OPENGL_MENU].curvalue = 0; } ! last_win = s_mode_list[OPENGL_MENU].curvalue; } --- 635,639 ---- s_mode_list[OPENGL_MENU].curvalue = 0; } ! mode_x = vid_modes[s_mode_list[OPENGL_MENU].curvalue].width; } *************** *** 728,735 **** if (fs == 0) { s_mode_list[1].itemnames = resolutions; ! s_mode_list[1].curvalue = last_win; } else { s_mode_list[1].itemnames = fs_resolutions; ! s_mode_list[1].curvalue = last_fs; } } --- 739,750 ---- if (fs == 0) { s_mode_list[1].itemnames = resolutions; ! int i = vid_modes.length - 2; ! while (i > 0 && vid_modes[i].width > mode_x) i--; ! s_mode_list[1].curvalue = i; } else { s_mode_list[1].itemnames = fs_resolutions; ! int i = fs_modes.length - 1; ! while (i > 0 && fs_modes[i].width > mode_x) i--; ! s_mode_list[1].curvalue = i; } } |