From: Holger Z. <hz...@us...> - 2004-09-06 19:39:56
|
Update of /cvsroot/jake2/jake2/src/jake2/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2637/src/jake2/client Modified Files: Tag: r_0_9 CL_pred.java CL_tent.java CL_ents.java Menu.java SCR.java VID.java CL.java Console.java CL_fx.java refexport_t.java CL_parse.java Key.java Removed Files: Tag: r_0_9 refimport_t.java Log Message: merge changes for 0.9.3 --- refimport_t.java DELETED --- Index: CL_parse.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/CL_parse.java,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -C2 -d -r1.4.2.1 -r1.4.2.2 *** CL_parse.java 9 Jul 2004 08:38:23 -0000 1.4.2.1 --- CL_parse.java 6 Sep 2004 19:39:13 -0000 1.4.2.2 *************** *** 27,30 **** --- 27,31 ---- import jake2.Defines; + import jake2.Globals; import jake2.game.Cmd; import jake2.game.entity_state_t; *************** *** 104,108 **** // to the real name when done, so if interrupted // a runt file wont be left ! Com.StripExtension(cls.downloadname, cls.downloadtempname); cls.downloadtempname += ".tmp"; --- 105,109 ---- // to the real name when done, so if interrupted // a runt file wont be left ! cls.downloadtempname = Com.StripExtension(cls.downloadname); cls.downloadtempname += ".tmp"; *************** *** 176,180 **** // to the real name when done, so if interrupted // a runt file wont be left ! Com.StripExtension(cls.downloadname, cls.downloadtempname); cls.downloadtempname += ".tmp"; --- 177,181 ---- // to the real name when done, so if interrupted // a runt file wont be left ! cls.downloadtempname = Com.StripExtension(cls.downloadname); cls.downloadtempname += ".tmp"; *************** *** 219,223 **** if (cls.download != null) { // if here, we tried to resume a file but the server said no ! fclose(cls.download); cls.download = null; } --- 220,226 ---- if (cls.download != null) { // if here, we tried to resume a file but the server said no ! try { ! cls.download.close(); ! } catch (IOException e) {} cls.download = null; } *************** *** 263,267 **** // Com.Printf ("100%%\n"); ! fclose(cls.download); // rename the temp file to it's final name --- 266,272 ---- // Com.Printf ("100%%\n"); ! try { ! cls.download.close(); ! } catch (IOException e) {} // rename the temp file to it's final name *************** *** 312,316 **** // BIG HACK to let demos from release work with the 3.0x patch!!! ! if (Com.ServerState() != 0 && PROTOCOL_VERSION == 34) { } else if (i != PROTOCOL_VERSION) --- 317,321 ---- // BIG HACK to let demos from release work with the 3.0x patch!!! ! if (Globals.server_state != 0 && PROTOCOL_VERSION == 34) { } else if (i != PROTOCOL_VERSION) *************** *** 694,698 **** if (cls.download != null) { //ZOID, close download ! fclose(cls.download); cls.download = null; } --- 699,705 ---- if (cls.download != null) { //ZOID, close download ! try { ! cls.download.close(); ! } catch (IOException e) {} cls.download = null; } Index: VID.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/VID.java,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -C2 -d -r1.4.2.1 -r1.4.2.2 *** VID.java 9 Jul 2004 08:38:24 -0000 1.4.2.1 --- VID.java 6 Sep 2004 19:39:13 -0000 1.4.2.2 *************** *** 32,36 **** import jake2.qcommon.*; import jake2.render.Renderer; ! import jake2.sound.*; import jake2.sys.IN; import jake2.sys.KBD; --- 32,36 ---- import jake2.qcommon.*; import jake2.render.Renderer; ! import jake2.sound.S; import jake2.sys.IN; import jake2.sys.KBD; *************** *** 38,41 **** --- 38,42 ---- import java.awt.Dimension; + import java.awt.DisplayMode; /** *************** *** 63,66 **** --- 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; *************** *** 78,81 **** --- 81,88 ---- */ + public static void Printf(int print_level, String fmt) { + Printf(print_level, fmt, null); + } + public static void Printf(int print_level, String fmt, Vargs vargs) { // static qboolean inupdate; *************** *** 86,95 **** } - public static void Error(int err_level, String fmt, Vargs vargs) - { - //static qboolean inupdate; - Com.Error(err_level, fmt, vargs); - } - // ========================================================================== --- 93,96 ---- *************** *** 103,108 **** ============ */ ! 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; } *************** *** 111,115 **** ** 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), *************** *** 123,136 **** 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 final int NUM_MODES = vid_modes.length; public static boolean GetModeInfo(Dimension dim, int mode) { ! if (mode < 0 || mode >= NUM_MODES) ! return false; ! dim.width = vid_modes[mode].width; ! dim.height = vid_modes[mode].height; return true; } --- 126,145 ---- 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[]; public static boolean GetModeInfo(Dimension dim, int mode) { ! if (fs_modes == null) initModeList(); ! vidmode_t[] modes = vid_modes; ! 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; } *************** *** 190,272 **** Com.Printf( "LoadLibrary(\"" + name +"\")\n" ); ! refimport_t ri = new refimport_t() { ! public void Sys_Error(int err_level, String str) { ! VID.Error(err_level, str, null); ! } ! ! public void Sys_Error(int err_level, String str, Vargs vargs) { ! VID.Error(err_level, str, vargs); ! } ! ! public void Cmd_AddCommand(String name, xcommand_t cmd) { ! Cmd.AddCommand(name, cmd); ! } ! ! public void Cmd_RemoveCommand(String name) { ! Cmd.RemoveCommand(name); ! } ! ! public int Cmd_Argc() { ! return Cmd.Argc(); ! } ! ! public String Cmd_Argv(int i) { ! return Cmd.Argv(i); ! } ! ! public void Cmd_ExecuteText(int exec_when, String text) { ! Cbuf.ExecuteText(exec_when, text); ! } ! ! public void Con_Printf(int print_level, String str) { ! VID.Printf(print_level, str, null); ! } ! ! public void Con_Printf(int print_level, String str, Vargs vargs) { ! VID.Printf(print_level, str, vargs); ! } ! ! public byte[] FS_LoadFile(String name) { ! return FS.LoadFile(name); ! } ! ! public int FS_FileLength(String name) { ! return FS.FileLength(name); ! } ! ! public void FS_FreeFile(byte[] buf) { ! FS.FreeFile(buf); ! } ! ! public String FS_Gamedir() { ! return FS.Gamedir(); ! } ! ! public cvar_t Cvar_Get(String name, String value, int flags) { ! return Cvar.Get(name, value, flags); ! } ! ! public cvar_t Cvar_Set(String name, String value) { ! return Cvar.Set(name, value); ! } ! ! public void Cvar_SetValue(String name, float value) { ! Cvar.SetValue(name, value); ! } ! ! public boolean Vid_GetModeInfo(Dimension dim, int mode) { ! return VID.GetModeInfo(dim, mode); ! } ! ! public void Vid_MenuInit() { ! VID.MenuInit(); ! } ! ! public void Vid_NewWindow(int width, int height) { ! VID.NewWindow(width, height); ! } ! }; ! ! Globals.re = Renderer.getDriver( name, ri ); if (Globals.re == null) --- 199,203 ---- Com.Printf( "LoadLibrary(\"" + name +"\")\n" ); ! Globals.re = Renderer.getDriver(name); if (Globals.re == null) *************** *** 281,290 **** } - /* Init IN (Mouse) */ - // in_state.IN_CenterView_fp = IN_CenterView; - // in_state.Key_Event_fp = Do_Key_Event; - // in_state.viewangles = cl.viewangles; - // in_state.in_strafe_state = &in_strafe.state; - IN.Real_IN_Init(); --- 212,215 ---- *************** *** 374,380 **** --- 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() { *************** *** 414,430 **** // ========================================================================== - // #define REF_SOFT 0 - // #define REF_SOFTX11 1 - // #define REF_MESA3D 2 - // #define REF_3DFXGL 3 - // #define REF_OPENGLX 4 static final int REF_OPENGL_JOGL = 0; static final int REF_OPENGL_FASTJOGL =1; - // #define REF_MESA3DGLX 5 - - // extern cvar_t *vid_ref; - // extern cvar_t *vid_fullscreen; - // extern cvar_t *vid_gamma; - // extern cvar_t *scr_viewsize; static cvar_t gl_mode; --- 344,349 ---- *************** *** 631,636 **** --- 550,559 ---- "[1600 1200]", "[2048 1536]", + "user mode", null }; + static String[] fs_resolutions; + static int mode_x; + static final String[] refs = { *************** *** 652,662 **** }; /* ** VID_MenuInit */ ! public static void MenuInit() ! { ! int i; ! if ( gl_driver == null ) gl_driver = Cvar.Get( "gl_driver", "jogl", 0 ); --- 575,608 ---- }; + static void initModeList() { + DisplayMode[] modes = re.getModeList(); + fs_resolutions = new String[modes.length + 1]; + fs_modes = new vidmode_t[modes.length]; + for (int i = 0; i < modes.length; i++) { + DisplayMode m = modes[i]; + StringBuffer sb = new StringBuffer(18); + sb.append('['); + sb.append(m.getWidth()); + sb.append(' '); + sb.append(m.getHeight()); + while (sb.length() < 10) sb.append(' '); + sb.append(']'); + fs_resolutions[i] = sb.toString(); + sb.setLength(0); + sb.append("Mode "); + sb.append(i); + sb.append(':'); + sb.append(m.getWidth()); + sb.append('x'); + sb.append(m.getHeight()); + fs_modes[i] = new vidmode_t(sb.toString(), m.getWidth(), m.getHeight(), i); + } + } + /* ** VID_MenuInit */ ! public static void MenuInit() { ! if ( gl_driver == null ) gl_driver = Cvar.Get( "gl_driver", "jogl", 0 ); *************** *** 678,681 **** --- 624,640 ---- s_mode_list[SOFTWARE_MENU].curvalue = (int)sw_mode.value; s_mode_list[OPENGL_MENU].curvalue = (int)gl_mode.value; + if (vid_fullscreen.value != 0.0f) { + s_mode_list[OPENGL_MENU].itemnames = fs_resolutions; + if (s_mode_list[OPENGL_MENU].curvalue >= fs_resolutions.length - 1) { + 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; + if (s_mode_list[OPENGL_MENU].curvalue >= resolutions.length - 1) { + s_mode_list[OPENGL_MENU].curvalue = 0; + } + mode_x = vid_modes[s_mode_list[OPENGL_MENU].curvalue].width; + } if ( SCR.scr_viewsize == null ) *************** *** 727,731 **** s_opengl_menu.nitems = 0; ! for ( i = 0; i < 2; i++ ) { s_ref_list[i].type = MTYPE_SPINCONTROL; --- 686,690 ---- s_opengl_menu.nitems = 0; ! for (int i = 0; i < 2; i++ ) { s_ref_list[i].type = MTYPE_SPINCONTROL; *************** *** 744,748 **** s_mode_list[i].x = 0; s_mode_list[i].y = 10; - s_mode_list[i].itemnames = resolutions; s_screensize_slider[i].type = MTYPE_SLIDER; --- 703,706 ---- *************** *** 776,779 **** --- 734,753 ---- s_fs_box[i].itemnames = yesno_names; s_fs_box[i].curvalue = (int)vid_fullscreen.value; + s_fs_box[i].callback = new Menu.mcallback() { + public void execute(Object o) { + int fs = ((Menu.menulist_s)o).curvalue; + 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; + } + } + }; s_defaults_action[i].type = MTYPE_ACTION; Index: Menu.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/Menu.java,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -d -r1.3.2.1 -r1.3.2.2 *** Menu.java 9 Jul 2004 08:38:24 -0000 1.3.2.1 --- Menu.java 6 Sep 2004 19:39:13 -0000 1.3.2.2 *************** *** 35,40 **** --- 35,42 ---- import jake2.util.Lib; import jake2.util.Math3D; + import jake2.util.QuakeFile; import java.awt.Dimension; + import java.io.IOException; import java.io.RandomAccessFile; import java.util.Arrays; *************** [...6312 lines suppressed...] ! line2 = Lib.rightFrom(s.itemnames[s.curvalue], '\n'); ! int pos = line2.indexOf('\n'); if (pos != -1) ! line2 = line2.substring(0, pos); Menu_DrawString(RCOLUMN_OFFSET + s.x + s.parent.x, s.y + s.parent.y + 10, line2); --- 4998,5009 ---- else { String line1, line2; ! line1= Lib.leftFrom(s.itemnames[s.curvalue], '\n'); Menu_DrawString(RCOLUMN_OFFSET + s.x + s.parent.x, s.y + s.parent.y, line1); ! line2= Lib.rightFrom(s.itemnames[s.curvalue], '\n'); ! int pos= line2.indexOf('\n'); if (pos != -1) ! line2= line2.substring(0, pos); Menu_DrawString(RCOLUMN_OFFSET + s.x + s.parent.x, s.y + s.parent.y + 10, line2); Index: CL_fx.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/CL_fx.java,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** CL_fx.java 8 Jul 2004 20:56:50 -0000 1.4 --- CL_fx.java 6 Sep 2004 19:39:13 -0000 1.4.2.1 *************** *** 46,54 **** float radius; float die; // stop lighting after this time ! float decay; // drop this each second float minlight; // don't add when contributing less void clear() { ! radius = ! decay = die = minlight = color[0] = color[1] = color[2] = origin[0] = origin[1] = origin[2] = key = 0; } } --- 46,53 ---- float radius; float die; // stop lighting after this time ! //float decay; // drop this each second float minlight; // don't add when contributing less void clear() { ! radius = minlight = color[0] = color[1] = color[2] = 0; } } *************** *** 101,122 **** */ static void RunLightStyles() { ! int ofs; ! int i; ! clightstyle_t[] ls; ! ofs = cl.time / 100; if (ofs == lastofs) return; lastofs = ofs; ! ls = cl_lightstyle; ! for (i = 0; i < ls.length; i++) { ! if (ls[i].length == 0) { ! ls[i].value[0] = ls[i].value[1] = ls[i].value[2] = 1.0f; continue; } if (ls.length == 1) ! ls[i].value[0] = ls[i].value[1] = ls[i].value[2] = ls[i].map[0]; else ! ls[i].value[0] = ls[i].value[1] = ls[i].value[2] = ls[i].map[ofs % ls[i].length]; } } --- 100,120 ---- */ static void RunLightStyles() { ! clightstyle_t ls; ! int ofs = cl.time / 100; if (ofs == lastofs) return; lastofs = ofs; ! ! for (int i = 0; i < cl_lightstyle.length; i++) { ! ls = cl_lightstyle[i]; ! if (ls.length == 0) { ! ls.value[0] = ls.value[1] = ls.value[2] = 1.0f; continue; } if (ls.length == 1) ! ls.value[0] = ls.value[1] = ls.value[2] = ls.map[0]; else ! ls.value[0] = ls.value[1] = ls.value[2] = ls.map[ofs % ls.length]; } } *************** *** 144,153 **** */ static void AddLightStyles() { ! int i; ! clightstyle_t[] ls; ! ls = cl_lightstyle; ! for (i = 0; i < ls.length; i++) ! V.AddLightStyle(i, ls[i].value[0], ls[i].value[1], ls[i].value[2]); } --- 142,151 ---- */ static void AddLightStyles() { ! clightstyle_t ls; ! for (int i = 0; i < cl_lightstyle.length; i++) { ! ls = cl_lightstyle[i]; ! V.AddLightStyle(i, ls.value[0], ls.value[1], ls.value[2]); ! } } *************** *** 186,200 **** static cdlight_t AllocDlight(int key) { int i; ! cdlight_t[] dl; // first look for an exact key match ! if (key != 0) { ! dl = cl_dlights; for (i = 0; i < MAX_DLIGHTS; i++) { ! if (dl[i].key == key) { //memset (dl, 0, sizeof(*dl)); ! dl[i].clear(); ! dl[i].key = key; ! return dl[i]; } } --- 184,198 ---- static cdlight_t AllocDlight(int key) { int i; ! cdlight_t dl; // first look for an exact key match ! if (key != 0) { for (i = 0; i < MAX_DLIGHTS; i++) { ! dl = cl_dlights[i]; ! if (dl.key == key) { //memset (dl, 0, sizeof(*dl)); ! dl.clear(); ! dl.key = key; ! return dl; } } *************** *** 202,212 **** // then look for anything else - dl = cl_dlights; for (i = 0; i < MAX_DLIGHTS; i++) { ! if (dl[i].die < cl.time) { //memset (dl, 0, sizeof(*dl)); ! dl[i].clear(); ! dl[i].key = key; ! return dl[i]; } } --- 200,210 ---- // then look for anything else for (i = 0; i < MAX_DLIGHTS; i++) { ! dl = cl_dlights[i]; ! if (dl.die < cl.time) { //memset (dl, 0, sizeof(*dl)); ! dl.clear(); ! dl.key = key; ! return dl; } } *************** *** 214,220 **** //dl = &cl_dlights[0]; //memset (dl, 0, sizeof(*dl)); ! dl[0].clear(); ! dl[0].key = key; ! return dl[0]; } --- 212,219 ---- //dl = &cl_dlights[0]; //memset (dl, 0, sizeof(*dl)); ! dl = cl_dlights[0]; ! dl.clear(); ! dl.key = key; ! return dl; } *************** *** 242,259 **** */ static void RunDLights() { ! cdlight_t[] dl; - dl = cl_dlights; for (int i = 0; i < MAX_DLIGHTS; i++) { ! if (dl[i].radius == 0.0f) continue; ! if (dl[i].die < cl.time) { ! dl[i].radius = 0; return; } ! dl[i].radius -= cls.frametime * dl[i].decay; ! if (dl[i].radius < 0) ! dl[i].radius = 0; } } --- 241,258 ---- */ static void RunDLights() { ! cdlight_t dl; for (int i = 0; i < MAX_DLIGHTS; i++) { ! dl = cl_dlights[i]; ! if (dl.radius == 0.0f) continue; ! if (dl.die < cl.time) { ! dl.radius = 0.0f; return; } ! //dl[i].radius -= cls.frametime * dl[i].decay; ! //if (dl[i].radius < 0) ! // dl[i].radius = 0; } } *************** *** 954,982 **** */ static void AddDLights() { ! int i; ! ! cdlight_t[] dl = cl_dlights; // ===== // PGM if (vidref_val == VIDREF_GL) { ! for (i = 0; i < MAX_DLIGHTS; i++) { ! if (dl[i].radius == 0.0f) continue; ! V.AddLight(dl[i].origin, dl[i].radius, dl[i].color[0], dl[i].color[1], dl[i].color[2]); } } else { ! for (i = 0; i < MAX_DLIGHTS; i++) { ! if (dl[i].radius == 0.0f) continue; // negative light in software. only black allowed ! if ((dl[i].color[0] < 0) || (dl[i].color[1] < 0) || (dl[i].color[2] < 0)) { ! dl[i].radius = - (dl[i].radius); ! dl[i].color[0] = 1; ! dl[i].color[1] = 1; ! dl[i].color[2] = 1; } ! V.AddLight(dl[i].origin, dl[i].radius, dl[i].color[0], dl[i].color[1], dl[i].color[2]); } } --- 953,981 ---- */ static void AddDLights() { ! cdlight_t dl; // ===== // PGM if (vidref_val == VIDREF_GL) { ! for (int i = 0; i < MAX_DLIGHTS; i++) { ! dl = cl_dlights[i]; ! if (dl.radius == 0.0f) continue; ! V.AddLight(dl.origin, dl.radius, dl.color[0], dl.color[1], dl.color[2]); } } else { ! for (int i = 0; i < MAX_DLIGHTS; i++) { ! dl = cl_dlights[i]; ! if (dl.radius == 0.0f) continue; // negative light in software. only black allowed ! if ((dl.color[0] < 0) || (dl.color[1] < 0) || (dl.color[2] < 0)) { ! dl.radius = - (dl.radius); ! dl.color[0] = 1; ! dl.color[1] = 1; ! dl.color[2] = 1; } ! V.AddLight(dl.origin, dl.radius, dl.color[0], dl.color[1], dl.color[2]); } } *************** *** 1508,1515 **** float[] move = new float[3]; float[] vec = new float[3]; - float len; - int j; cparticle_t p; - float dec; float orgscale; float velscale; --- 1507,1511 ---- *************** *** 1517,1523 **** VectorCopy(start, move); VectorSubtract(end, start, vec); ! len = VectorNormalize(vec); ! dec = 0.5f; VectorScale(vec, dec, vec); --- 1513,1519 ---- VectorCopy(start, move); VectorSubtract(end, start, vec); ! float len = VectorNormalize(vec); ! float dec = 0.5f; VectorScale(vec, dec, vec); *************** *** 1553,1557 **** p.alphavel = -1.0f / (1.0f + Globals.rnd.nextFloat() * 0.4f); p.color = 0xe8 + (rand() & 7); ! for (j = 0; j < 3; j++) { p.org[j] = move[j] + crand() * orgscale; p.vel[j] = crand() * velscale; --- 1549,1553 ---- p.alphavel = -1.0f / (1.0f + Globals.rnd.nextFloat() * 0.4f); p.color = 0xe8 + (rand() & 7); ! for (int j = 0; j < 3; j++) { p.org[j] = move[j] + crand() * orgscale; p.vel[j] = crand() * velscale; *************** *** 1563,1567 **** p.alphavel = -1.0f / (1.0f + Globals.rnd.nextFloat() * 0.4f); p.color = 0xdb + (rand() & 7); ! for (j = 0; j < 3; j++) { p.org[j] = move[j] + crand() * orgscale; p.vel[j] = crand() * velscale; --- 1559,1563 ---- p.alphavel = -1.0f / (1.0f + Globals.rnd.nextFloat() * 0.4f); p.color = 0xdb + (rand() & 7); ! for (int j = 0; j < 3; j++) { p.org[j] = move[j] + crand() * orgscale; p.vel[j] = crand() * velscale; *************** *** 1573,1577 **** p.alphavel = -1.0f / (1.0f + Globals.rnd.nextFloat() * 0.2f); p.color = 4 + (rand() & 7); ! for (j = 0; j < 3; j++) { p.org[j] = move[j] + crand() * orgscale; p.vel[j] = crand() * velscale; --- 1569,1573 ---- p.alphavel = -1.0f / (1.0f + Globals.rnd.nextFloat() * 0.2f); p.color = 4 + (rand() & 7); ! for (int j = 0; j < 3; j++) { p.org[j] = move[j] + crand() * orgscale; p.vel[j] = crand() * velscale; Index: Console.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/Console.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** Console.java 8 Jul 2004 15:58:42 -0000 1.2 --- Console.java 6 Sep 2004 19:39:13 -0000 1.2.2.1 *************** *** 67,71 **** Globals.cls.key_dest = Defines.key_console; ! if (Cvar.VariableValue("maxclients") == 1 && Com.ServerState()!= 0) Cvar.Set("paused", "1"); } --- 67,71 ---- Globals.cls.key_dest = Defines.key_console; ! if (Cvar.VariableValue("maxclients") == 1 && Globals.server_state!= 0) Cvar.Set("paused", "1"); } *************** *** 168,175 **** */ public static void CheckResize() { ! int i, j, width, oldwidth, oldtotallines, numlines, numchars; ! byte[] tbuf = new byte[Defines.CON_TEXTSIZE]; ! ! width = (Globals.viddef.width >> 3) - 2; if (width == Globals.con.linewidth) --- 168,173 ---- */ public static void CheckResize() { ! ! int width = (Globals.viddef.width >> 3) - 2; if (width == Globals.con.linewidth) *************** *** 183,205 **** } else { ! oldwidth = Globals.con.linewidth; Globals.con.linewidth = width; ! oldtotallines = Globals.con.totallines; Globals.con.totallines = Defines.CON_TEXTSIZE / Globals.con.linewidth; ! numlines = oldtotallines; if (Globals.con.totallines < numlines) numlines = Globals.con.totallines; ! numchars = oldwidth; if (Globals.con.linewidth < numchars) numchars = Globals.con.linewidth; ! System.arraycopy(Globals.con.text, 0, tbuf, 0, Defines.CON_TEXTSIZE); Arrays.fill(Globals.con.text, (byte)' '); ! for (i=0 ; i<numlines ; i++) { ! for (j=0 ; j<numchars ; j++) { Globals.con.text[(Globals.con.totallines - 1 - i) * Globals.con.linewidth + j] = tbuf[((Globals.con.current - i + oldtotallines) % oldtotallines) * oldwidth + j]; --- 181,204 ---- } else { ! int oldwidth = Globals.con.linewidth; Globals.con.linewidth = width; ! int oldtotallines = Globals.con.totallines; Globals.con.totallines = Defines.CON_TEXTSIZE / Globals.con.linewidth; ! int numlines = oldtotallines; if (Globals.con.totallines < numlines) numlines = Globals.con.totallines; ! int numchars = oldwidth; if (Globals.con.linewidth < numchars) numchars = Globals.con.linewidth; ! ! byte[] tbuf = new byte[Defines.CON_TEXTSIZE]; System.arraycopy(Globals.con.text, 0, tbuf, 0, Defines.CON_TEXTSIZE); Arrays.fill(Globals.con.text, (byte)' '); ! for (int i=0 ; i<numlines ; i++) { ! for (int j=0 ; j<numchars ; j++) { Globals.con.text[(Globals.con.totallines - 1 - i) * Globals.con.linewidth + j] = tbuf[((Globals.con.current - i + oldtotallines) % oldtotallines) * oldwidth + j]; Index: CL.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/CL.java,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -C2 -d -r1.4.2.1 -r1.4.2.2 *** CL.java 9 Jul 2004 08:38:24 -0000 1.4.2.1 --- CL.java 6 Sep 2004 19:39:13 -0000 1.4.2.2 *************** *** 38,41 **** --- 38,42 ---- import java.io.RandomAccessFile; import java.nio.ByteBuffer; + import java.nio.ByteOrder; /** *************** *** 250,254 **** // never pause in multiplayer ! if (Cvar.VariableValue("maxclients") > 1 || Com.ServerState() == 0) { Cvar.SetValue("paused", 0); return; --- 251,255 ---- // never pause in multiplayer ! if (Cvar.VariableValue("maxclients") > 1 || Globals.server_state == 0) { Cvar.SetValue("paused", 0); return; *************** *** 313,317 **** // if the local server is running and we aren't // then connect ! if (cls.state == ca_disconnected && Com.ServerState() != 0) { cls.state = ca_connecting; cls.servername = "localhost"; --- 314,318 ---- // if the local server is running and we aren't // then connect ! if (cls.state == ca_disconnected && Globals.server_state != 0) { cls.state = ca_connecting; cls.servername = "localhost"; *************** *** 359,363 **** } ! if (Com.ServerState() != 0) { // if running a local server, kill it and reissue SV_MAIN.SV_Shutdown("Server quit\n", false); --- 360,364 ---- } ! if (Globals.server_state != 0) { // if running a local server, kill it and reissue SV_MAIN.SV_Shutdown("Server quit\n", false); *************** *** 949,953 **** } ByteBuffer bb = ByteBuffer.wrap(precache_model); ! int header = Globals.endian.LittleLong(bb.getInt()); if (header != qfiles.IDALIASHEADER) { --- 950,956 ---- } ByteBuffer bb = ByteBuffer.wrap(precache_model); ! bb.order(ByteOrder.LITTLE_ENDIAN); ! ! int header = bb.getInt(); if (header != qfiles.IDALIASHEADER) { *************** *** 959,964 **** continue; } ! pheader = new qfiles.dmdl_t(ByteBuffer.wrap(precache_model)); ! if (Globals.endian.LittleLong(pheader.version) != ALIAS_VERSION) { precache_check++; precache_model_skin = 0; --- 962,967 ---- continue; } ! pheader = new qfiles.dmdl_t(ByteBuffer.wrap(precache_model).order(ByteOrder.LITTLE_ENDIAN)); ! if (pheader.version != ALIAS_VERSION) { precache_check++; precache_model_skin = 0; *************** *** 967,981 **** } ! pheader = new qfiles.dmdl_t(ByteBuffer.wrap(precache_model)); ! int num_skins = Globals.endian.LittleLong(pheader.num_skins); while (precache_model_skin - 1 < num_skins) { ! Com.Printf("critical code section because of endian mess!"); String name = new String( precache_model, ! Globals.endian.LittleLong(pheader.ofs_skins) + (precache_model_skin - 1) * MAX_SKINNAME, MAX_SKINNAME * num_skins); --- 970,984 ---- } ! pheader = new qfiles.dmdl_t(ByteBuffer.wrap(precache_model).order(ByteOrder.LITTLE_ENDIAN)); ! int num_skins = pheader.num_skins; while (precache_model_skin - 1 < num_skins) { ! //Com.Printf("critical code section because of endian mess!\n"); String name = new String( precache_model, ! pheader.ofs_skins + (precache_model_skin - 1) * MAX_SKINNAME, MAX_SKINNAME * num_skins); *************** *** 1547,1550 **** --- 1550,1558 ---- cls.framecount++; + if (cls.state != ca_active || cls.key_dest != key_game) { + try { + Thread.sleep(20); + } catch (InterruptedException e) {} + } } Index: Key.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/Key.java,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -d -r1.3.2.1 -r1.3.2.2 *** Key.java 9 Jul 2004 08:38:24 -0000 1.3.2.1 --- Key.java 6 Sep 2004 19:39:13 -0000 1.3.2.2 *************** *** 26,40 **** package jake2.client; - import java.io.IOException; - import java.io.RandomAccessFile; - import jake2.Defines; import jake2.Globals; import jake2.game.Cmd; import jake2.qcommon.*; - import jake2.qcommon.Cbuf; - import jake2.qcommon.Com; import jake2.util.Lib; /** * Key --- 26,39 ---- package jake2.client; import jake2.Defines; import jake2.Globals; import jake2.game.Cmd; import jake2.qcommon.*; import jake2.util.Lib; + import java.io.IOException; + import java.io.RandomAccessFile; + import java.util.Vector; + /** * Key *************** *** 616,620 **** if (history_line == Globals.edit_line) history_line = (Globals.edit_line + 1) & 31; ! Lib.strcpy(Globals.key_lines[Globals.edit_line], Globals.key_lines[history_line]); Globals.key_linepos = Lib.strlen(Globals.key_lines[Globals.edit_line]); return; --- 615,620 ---- if (history_line == Globals.edit_line) history_line = (Globals.edit_line + 1) & 31; ! //Lib.strcpy(Globals.key_lines[Globals.edit_line], Globals.key_lines[history_line]); ! System.arraycopy(Globals.key_lines[history_line], 0, Globals.key_lines[Globals.edit_line], 0, Globals.key_lines[Globals.edit_line].length); Globals.key_linepos = Lib.strlen(Globals.key_lines[Globals.edit_line]); return; *************** *** 633,637 **** } else { ! Lib.strcpy(Globals.key_lines[Globals.edit_line], Globals.key_lines[history_line]); Globals.key_linepos = Lib.strlen(Globals.key_lines[Globals.edit_line]); } --- 633,638 ---- } else { ! //Lib.strcpy(Globals.key_lines[Globals.edit_line], Globals.key_lines[history_line]); ! System.arraycopy(Globals.key_lines[history_line], 0, Globals.key_lines[Globals.edit_line], 0, Globals.key_lines[Globals.edit_line].length); Globals.key_linepos = Lib.strlen(Globals.key_lines[Globals.edit_line]); } *************** *** 672,695 **** } static void CompleteCommand() { ! // 00166 char *cmd, *s; ! // 00167 ! // 00168 s = key_lines[edit_line]+1; ! // 00169 if (*s == '\\' || *s == '/') ! // 00170 s++; ! // 00171 ! // 00172 cmd = Cmd_CompleteCommand (s); ! // 00173 if (!cmd) ! // 00174 cmd = Cvar_CompleteVariable (s); ! // 00175 if (cmd) ! // 00176 { ! // 00177 key_lines[edit_line][1] = '/'; ! // 00178 strcpy (key_lines[edit_line]+2, cmd); ! // 00179 key_linepos = strlen(cmd)+2; ! // 00180 key_lines[edit_line][key_linepos] = ' '; ! // 00181 key_linepos++; ! // 00182 key_lines[edit_line][key_linepos] = 0; ! // 00183 return; ! // 00184 } } --- 673,719 ---- } + private static void printCompletions(String type, Vector compl) { + Com.Printf(type); + for (int i = 0; i < compl.size(); i++) { + Com.Printf((String)compl.get(i) + " "); + } + Com.Printf("\n"); + } + static void CompleteCommand() { ! ! int start = 1; ! if (key_lines[edit_line][start] == '\\' || key_lines[edit_line][start] == '/') ! start++; ! ! int end = start; ! while (key_lines[edit_line][end] != 0) end++; ! ! String s = new String(key_lines[edit_line], start, end-start); ! ! Vector cmds = Cmd.CompleteCommand(s); ! Vector vars = Cvar.CompleteVariable(s); ! ! int c = cmds.size(); ! int v = vars.size(); ! ! if ((c + v) > 1) { ! if (c > 0) printCompletions("\nCommands:\n", cmds); ! if (v > 0) printCompletions("\nVariables:\n", vars); ! return; ! } else if (c == 1) { ! s = (String)cmds.get(0); ! } else if (v == 1) { ! s = (String)vars.get(0); ! } else return; ! ! key_lines[edit_line][1] = '/'; ! byte[] bytes = s.getBytes(); ! System.arraycopy(bytes, 0, key_lines[edit_line], 2, bytes.length); ! key_linepos = bytes.length + 2; ! key_lines[edit_line][key_linepos++] = ' '; ! key_lines[edit_line][key_linepos] = 0; ! ! return; } Index: CL_tent.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/CL_tent.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** CL_tent.java 8 Jul 2004 20:56:50 -0000 1.3 --- CL_tent.java 6 Sep 2004 19:39:13 -0000 1.3.2.1 *************** *** 1359,1364 **** */ static void AddPlayerBeams() { - int i, j; - beam_t[] b; float[] dist = new float[3]; float[] org = new float[3]; --- 1359,1362 ---- *************** *** 1389,1397 **** // update beams ! b = cl_playerbeams; ! for (i = 0; i < MAX_BEAMS; i++) { ! float[] f = new float[3]; ! float[] u = new float[3]; ! float[] r = new float[3]; if (b[i].model == null || b[i].endtime < cl.time) continue; --- 1387,1396 ---- // update beams ! beam_t[] b = cl_playerbeams; ! float[] f = new float[3]; ! float[] u = new float[3]; ! float[] r = new float[3]; ! for (int i = 0; i < MAX_BEAMS; i++) { ! if (b[i].model == null || b[i].endtime < cl.time) continue; *************** *** 1405,1409 **** // code straight out of CL_AddViewWeapon ps = cl.frame.playerstate; ! j = (cl.frame.serverframe - 1) & UPDATE_MASK; oldframe = cl.frames[j]; --- 1404,1408 ---- // code straight out of CL_AddViewWeapon ps = cl.frame.playerstate; ! int j = (cl.frame.serverframe - 1) & UPDATE_MASK; oldframe = cl.frames[j]; *************** *** 1514,1518 **** //memset (&ent, 0, sizeof(ent)); ! ent = new entity_t(); if (b[i].model == cl_mod_heatbeam) { model_length = 32.0f; --- 1513,1519 ---- //memset (&ent, 0, sizeof(ent)); ! //ent = new entity_t(); ! // this is not required. hoz ! if (b[i].model == cl_mod_heatbeam) { model_length = 32.0f; *************** *** 1570,1574 **** V.AddEntity(ent); ! for (j = 0; j < 3; j++) org[j] += dist[j] * len; d -= model_length; --- 1571,1575 ---- V.AddEntity(ent); ! for (int j = 0; j < 3; j++) org[j] += dist[j] * len; d -= model_length; Index: refexport_t.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/refexport_t.java,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.2.1 diff -C2 -d -r1.1.1.1 -r1.1.1.1.2.1 *** refexport_t.java 7 Jul 2004 19:58:52 -0000 1.1.1.1 --- refexport_t.java 6 Sep 2004 19:39:13 -0000 1.1.1.1.2.1 *************** *** 32,35 **** --- 32,36 ---- import java.awt.Dimension; + import java.awt.DisplayMode; /** *************** *** 105,107 **** --- 106,110 ---- int apiVersion(); + + DisplayMode[] getModeList(); } Index: CL_ents.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/CL_ents.java,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -d -r1.3.2.1 -r1.3.2.2 *** CL_ents.java 9 Jul 2004 08:38:24 -0000 1.3.2.1 --- CL_ents.java 6 Sep 2004 19:39:13 -0000 1.3.2.2 *************** *** 235,239 **** entity_state_t oldstate=null; ! int oldindex, oldnum; newframe.parse_entities = cl.parse_entities; --- 235,239 ---- entity_state_t oldstate=null; ! int oldnum; newframe.parse_entities = cl.parse_entities; *************** *** 241,254 **** // delta from the entities present in oldframe ! oldindex = 0; if (oldframe == null) oldnum = 99999; else { ! if (oldindex >= oldframe.num_entities) ! oldnum = 99999; ! else { oldstate = cl_parse_entities[(oldframe.parse_entities + oldindex) & (MAX_PARSE_ENTITIES - 1)]; oldnum = oldstate.number; ! } } --- 241,255 ---- // delta from the entities present in oldframe ! int oldindex = 0; if (oldframe == null) oldnum = 99999; else { ! // oldindex == 0. hoz ! // if (oldindex >= oldframe.num_entities) ! // oldnum = 99999; ! // else { oldstate = cl_parse_entities[(oldframe.parse_entities + oldindex) & (MAX_PARSE_ENTITIES - 1)]; oldnum = oldstate.number; ! // } } Index: SCR.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/SCR.java,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -C2 -d -r1.4.2.1 -r1.4.2.2 *** SCR.java 9 Jul 2004 08:38:24 -0000 1.4.2.1 --- SCR.java 6 Sep 2004 19:39:13 -0000 1.4.2.2 *************** *** 40,49 **** * SCR */ ! public final class SCR extends Globals ! { // cl_scrn.c -- master for refresh, status bar, console, chat, notify, etc ! static String[][] sb_nums = { { "num_0", "num_1", "num_2", "num_3", "num_4", "num_5", "num_6", "num_7", "num_8", "num_9", "num_minus" }, { "anum_0", "anum_1", "anum_2", "anum_3", "anum_4", "anum_5", "anum_6", "anum_7", "anum_8", "anum_9", "anum_minus" } [...3377 lines suppressed...] ! // cin.s_channels = LittleLong(cin.s_channels); ! // ! // Huff1TableInit (); ! // ! // // switch up to 22 khz sound if necessary ! // old_khz = Cvar_VariableValue ("s_khz"); ! // if (old_khz != cin.s_rate/1000) ! // { ! // cin.restart_sound = true; ! // Cvar_SetValue ("s_khz", cin.s_rate/1000); ! // CL_Snd_Restart_f (); ! // Cvar_SetValue ("s_khz", old_khz); ! // } ! // ! // cl.cinematicframe = 0; ! // cin.pic = SCR_ReadNextFrame (); ! // cl.cinematictime = Sys_Milliseconds (); } } \ No newline at end of file Index: CL_pred.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/CL_pred.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** CL_pred.java 8 Jul 2004 20:24:28 -0000 1.3 --- CL_pred.java 6 Sep 2004 19:39:13 -0000 1.3.2.1 *************** *** 244,248 **** }; ! PMove.pm_airaccelerate = atof(cl.configstrings[CS_AIRACCEL]); // bugfix (rst) yeah !!!!!!!! found the solution to the B E W E G U N G S P R O B L E M. --- 244,252 ---- }; ! try { ! PMove.pm_airaccelerate = Float.parseFloat(cl.configstrings[CS_AIRACCEL]); ! } catch (Exception e) { ! PMove.pm_airaccelerate = 0; ! } // bugfix (rst) yeah !!!!!!!! found the solution to the B E W E G U N G S P R O B L E M. |