From: Rene S. <sa...@us...> - 2004-09-22 19:22:56
|
Update of /cvsroot/jake2/jake2/src/jake2/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11556/src/jake2/client Modified Files: CL_view.java Menu.java CL_parse.java M.java CL_ents.java CL_tent.java SCR.java CL.java CL_pred.java CL_newfx.java V.java CL_fx.java CL_inv.java Console.java CL_input.java Log Message: major refactoring in game, server and client package Index: V.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/V.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** V.java 9 Jul 2004 06:50:50 -0000 1.2 --- V.java 22 Sep 2004 19:22:08 -0000 1.3 *************** *** 6,27 **** */ /* ! Copyright (C) 1997-2001 Id Software, Inc. ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ! See the GNU General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ package jake2.client; --- 6,27 ---- */ /* ! Copyright (C) 1997-2001 Id Software, Inc. ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ! See the GNU General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ package jake2.client; *************** *** 41,418 **** */ public final class V extends Globals { - - static cvar_t cl_testblend; - static cvar_t cl_testparticles; - static cvar_t cl_testentities; - static cvar_t cl_testlights; - static cvar_t cl_stats; - - static int r_numdlights; - static dlight_t[] r_dlights = new dlight_t[MAX_DLIGHTS]; ! static int r_numentities; ! static entity_t[] r_entities = new entity_t[MAX_ENTITIES]; ! ! static int r_numparticles; ! //static particle_t[] r_particles = new particle_t[MAX_PARTICLES]; ! ! static lightstyle_t[] r_lightstyles = new lightstyle_t[MAX_LIGHTSTYLES]; ! static { ! for (int i = 0; i < r_dlights.length; i++) ! r_dlights[i] = new dlight_t(); ! for (int i = 0; i < r_entities.length; i++) ! r_entities[i] = new entity_t(); ! for (int i = 0; i < r_lightstyles.length; i++) ! r_lightstyles[i] = new lightstyle_t(); ! } ! ! /* ! ==================== ! V_ClearScene ! Specifies the model that will be used as the world ! ==================== ! */ ! static void ClearScene() { ! r_numdlights = 0; ! r_numentities = 0; ! r_numparticles = 0; ! } ! /* ! ===================== ! V_AddEntity ! ===================== ! */ ! static void AddEntity(entity_t ent) { ! if (r_numentities >= MAX_ENTITIES) ! return; ! r_entities[r_numentities++].set(ent); ! } ! /* ! ===================== ! V_AddParticle ! ===================== ! */ ! static void AddParticle(float[] org, int color, float alpha) { ! if (r_numparticles >= MAX_PARTICLES) ! return; ! int i = r_numparticles++; ! int c = particle_t.colorTable[color]; ! c |= (int)(alpha * 255) << 24; ! particle_t.colorArray.put(i, c); ! ! i *= 3; ! FloatBuffer vertexBuf = particle_t.vertexArray; ! vertexBuf.put(i++, org[0]); ! vertexBuf.put(i++, org[1]); ! vertexBuf.put(i++, org[2]); ! } ! /* ! ===================== ! V_AddLight ! ===================== ! */ ! static void AddLight(float[] org, float intensity, float r, float g, float b) { ! dlight_t dl; ! if (r_numdlights >= MAX_DLIGHTS) ! return; ! dl = r_dlights[r_numdlights++]; ! VectorCopy(org, dl.origin); ! dl.intensity = intensity; ! dl.color[0] = r; ! dl.color[1] = g; ! dl.color[2] = b; ! } ! /* ! ===================== ! V_AddLightStyle ! ===================== ! */ ! static void AddLightStyle(int style, float r, float g, float b) { ! lightstyle_t ls; ! if (style < 0 || style > MAX_LIGHTSTYLES) ! Com.Error(ERR_DROP, "Bad light style " + style); ! ls = r_lightstyles[style]; ! ls.white = r + g + b; ! ls.rgb[0] = r; ! ls.rgb[1] = g; ! ls.rgb[2] = b; ! } ! /* ! ================ ! V_TestParticles ! If cl_testparticles is set, create 4096 particles in the view ! ================ ! */ ! static void TestParticles() { ! int i, j; ! float d, r, u; ! float[] origin = {0,0,0}; ! r_numparticles = 0; ! for (i = 0; i < MAX_PARTICLES; i++) { ! d = i * 0.25f; ! r = 4 * ((i & 7) - 3.5f); ! u = 4 * (((i >> 3) & 7) - 3.5f); ! for (j = 0; j < 3; j++) ! origin[j] = ! cl.refdef.vieworg[j] ! + cl.v_forward[j] * d ! + cl.v_right[j] * r ! + cl.v_up[j] * u; ! AddParticle(origin, 8, cl_testparticles.value); ! } ! } ! /* ! ================ ! V_TestEntities ! If cl_testentities is set, create 32 player models ! ================ ! */ ! static void TestEntities() { ! int i, j; ! float f, r; ! entity_t ent; ! r_numentities = 32; ! //memset (r_entities, 0, sizeof(r_entities)); ! for (i = 0; i < r_entities.length; i++) ! r_entities[i] = new entity_t(); ! for (i=0 ; i<r_numentities ; i++) ! { ! ent = r_entities[i]; ! r = 64 * ( (i%4) - 1.5f ); ! f = 64 * (i/4) + 128; ! for (j=0 ; j<3 ; j++) ! ent.origin[j] = cl.refdef.vieworg[j] + cl.v_forward[j]*f + ! cl.v_right[j]*r; ! ent.model = cl.baseclientinfo.model; ! ent.skin = cl.baseclientinfo.skin; ! } ! } ! ! /* ! ================ ! V_TestLights ! If cl_testlights is set, create 32 lights models ! ================ ! */ ! static void TestLights() { ! int i, j; ! float f, r; ! dlight_t dl; ! r_numdlights = 32; ! //memset (r_dlights, 0, sizeof(r_dlights)); ! for (i = 0; i < r_dlights.length; i++) ! r_dlights[i] = new dlight_t(); ! for (i=0 ; i<r_numdlights ; i++) ! { ! dl = r_dlights[i]; ! r = 64 * ( (i%4) - 1.5f ); ! f = 64 * (i/4) + 128; ! for (j=0 ; j<3 ; j++) ! dl.origin[j] = cl.refdef.vieworg[j] + cl.v_forward[j]*f + ! cl.v_right[j]*r; ! dl.color[0] = ((i%6)+1) & 1; ! dl.color[1] = (((i%6)+1) & 2)>>1; ! dl.color[2] = (((i%6)+1) & 4)>>2; ! dl.intensity = 200; ! } ! } ! static xcommand_t Gun_Next_f = new xcommand_t() { ! public void execute() { ! gun_frame++; ! Com.Printf("frame " + gun_frame + "\n"); ! } ! }; ! static xcommand_t Gun_Prev_f = new xcommand_t() { ! public void execute() { ! gun_frame--; ! if (gun_frame < 0) ! gun_frame = 0; ! Com.Printf("frame " + gun_frame + "\n"); ! } ! }; ! static xcommand_t Gun_Model_f = new xcommand_t() { ! public void execute() { ! if (Cmd.Argc() != 2) { ! gun_model = null; ! return; ! } ! String name = "models/" + Cmd.Argv(1) + "/tris.md2"; ! gun_model = re.RegisterModel(name); ! } ! }; ! /* ! ================== ! V_RenderView ! ! ================== ! */ ! static void RenderView(float stereo_separation) { ! // extern int entitycmpfnc( const entity_t *, const entity_t * ); ! // ! if (cls.state != ca_active) return; ! if (!cl.refresh_prepped) return; // still loading ! if (cl_timedemo.value != 0.0f) { ! if (cl.timedemo_start == 0) ! cl.timedemo_start = Sys.Milliseconds(); ! cl.timedemo_frames++; ! } ! // an invalid frame will just use the exact previous refdef ! // we can't use the old frame if the video mode has changed, though... ! if ( cl.frame.valid && (cl.force_refdef || cl_paused.value == 0.0f) ) { ! cl.force_refdef = false; ! V.ClearScene(); ! // build a refresh entity list and calc cl.sim* ! // this also calls CL_CalcViewValues which loads ! // v_forward, etc. ! CL.AddEntities(); ! if (cl_testparticles.value != 0.0f) ! TestParticles(); ! if (cl_testentities.value != 0.0f) ! TestEntities(); ! if (cl_testlights.value != 0.0f) ! TestLights(); ! if (cl_testblend.value != 0.0f) { ! cl.refdef.blend[0] = 1.0f; ! cl.refdef.blend[1] = 0.5f; ! cl.refdef.blend[2] = 0.25f; ! cl.refdef.blend[3] = 0.5f; ! } ! // offset vieworg appropriately if we're doing stereo separation ! if ( stereo_separation != 0 ) { ! float[] tmp = new float[3]; ! Math3D.VectorScale( cl.v_right, stereo_separation, tmp ); ! Math3D.VectorAdd( cl.refdef.vieworg, tmp, cl.refdef.vieworg ); ! } ! // never let it sit exactly on a node line, because a water plane can ! // dissapear when viewed with the eye exactly on it. ! // the server protocol only specifies to 1/8 pixel, so add 1/16 in each axis ! cl.refdef.vieworg[0] += 1.0/16; ! cl.refdef.vieworg[1] += 1.0/16; ! cl.refdef.vieworg[2] += 1.0/16; ! cl.refdef.x = scr_vrect.x; ! cl.refdef.y = scr_vrect.y; ! cl.refdef.width = scr_vrect.width; ! cl.refdef.height = scr_vrect.height; ! cl.refdef.fov_y = Math3D.CalcFov(cl.refdef.fov_x, cl.refdef.width, cl.refdef.height); ! cl.refdef.time = cl.time*0.001f; ! cl.refdef.areabits = cl.frame.areabits; ! if (cl_add_entities.value == 0.0f) ! r_numentities = 0; ! if (cl_add_particles.value == 0.0f) ! r_numparticles = 0; ! if (cl_add_lights.value == 0.0f) ! r_numdlights = 0; ! if (cl_add_blend.value == 0) { ! Math3D.VectorClear(cl.refdef.blend); ! } ! cl.refdef.num_entities = r_numentities; ! cl.refdef.entities = r_entities; ! cl.refdef.num_particles = r_numparticles; ! cl.refdef.num_dlights = r_numdlights; ! cl.refdef.dlights = r_dlights; ! cl.refdef.lightstyles = r_lightstyles; ! cl.refdef.rdflags = cl.frame.playerstate.rdflags; ! // sort entities for better cache locality ! // !!! useless in Java !!! ! //Arrays.sort(cl.refdef.entities, entitycmpfnc); ! } ! re.RenderFrame(cl.refdef); ! if (cl_stats.value != 0.0f) ! Com.Printf("ent:%i lt:%i part:%i\n", new Vargs(3).add(r_numentities).add( ! r_numdlights).add(r_numparticles)); ! if ( log_stats.value != 0.0f && ( log_stats_file != null ) ) ! try { ! log_stats_file.write(r_numentities + "," + r_numdlights + "," + r_numparticles); ! } catch (IOException e) {} ! SCR.AddDirtyPoint(scr_vrect.x, scr_vrect.y); ! SCR.AddDirtyPoint(scr_vrect.x+scr_vrect.width-1, scr_vrect.y+scr_vrect.height-1); ! SCR.DrawCrosshair(); ! } ! ! /* ! ============= ! V_Viewpos_f ! ============= ! */ ! static xcommand_t Viewpos_f = new xcommand_t() { ! public void execute() { ! Com.Printf("(%i %i %i) : %i\n", ! new Vargs(4).add((int)cl.refdef.vieworg[0]).add( ! (int)cl.refdef.vieworg[1]).add( ! (int)cl.refdef.vieworg[2]).add( ! (int)cl.refdef.viewangles[YAW])); ! } ! }; ! ! public static void Init() { ! Cmd.AddCommand("gun_next", Gun_Next_f); ! Cmd.AddCommand("gun_prev", Gun_Prev_f); ! Cmd.AddCommand("gun_model", Gun_Model_f); ! Cmd.AddCommand("viewpos", Viewpos_f); ! crosshair = Cvar.Get("crosshair", "0", CVAR_ARCHIVE); ! cl_testblend = Cvar.Get("cl_testblend", "0", 0); ! cl_testparticles = Cvar.Get("cl_testparticles", "0", 0); ! cl_testentities = Cvar.Get("cl_testentities", "0", 0); ! cl_testlights = Cvar.Get("cl_testlights", "0", 0); ! cl_stats = Cvar.Get("cl_stats", "0", 0); ! } ! } --- 41,412 ---- */ public final class V extends Globals { ! static cvar_t cl_testblend; ! static cvar_t cl_testparticles; ! static cvar_t cl_testentities; ! static cvar_t cl_testlights; ! static cvar_t cl_stats; ! static int r_numdlights; ! static dlight_t[] r_dlights = new dlight_t[MAX_DLIGHTS]; ! static int r_numentities; ! static entity_t[] r_entities = new entity_t[MAX_ENTITIES]; ! static int r_numparticles; ! //static particle_t[] r_particles = new particle_t[MAX_PARTICLES]; + static lightstyle_t[] r_lightstyles = new lightstyle_t[MAX_LIGHTSTYLES]; + static { + for (int i = 0; i < r_dlights.length; i++) + r_dlights[i] = new dlight_t(); + for (int i = 0; i < r_entities.length; i++) + r_entities[i] = new entity_t(); + for (int i = 0; i < r_lightstyles.length; i++) + r_lightstyles[i] = new lightstyle_t(); + } ! /* ! * ==================== V_ClearScene ! * ! * Specifies the model that will be used as the world ==================== ! */ ! static void ClearScene() { ! r_numdlights = 0; ! r_numentities = 0; ! r_numparticles = 0; ! } ! /* ! * ===================== V_AddEntity ! * ! * ===================== ! */ ! static void AddEntity(entity_t ent) { ! if (r_numentities >= MAX_ENTITIES) ! return; ! r_entities[r_numentities++].set(ent); ! } ! /* ! * ===================== V_AddParticle ! * ! * ===================== ! */ ! static void AddParticle(float[] org, int color, float alpha) { ! if (r_numparticles >= MAX_PARTICLES) ! return; ! int i = r_numparticles++; ! int c = particle_t.colorTable[color]; ! c |= (int) (alpha * 255) << 24; ! particle_t.colorArray.put(i, c); ! i *= 3; ! FloatBuffer vertexBuf = particle_t.vertexArray; ! vertexBuf.put(i++, org[0]); ! vertexBuf.put(i++, org[1]); ! vertexBuf.put(i++, org[2]); ! } ! /* ! * ===================== V_AddLight ! * ! * ===================== ! */ ! static void AddLight(float[] org, float intensity, float r, float g, float b) { ! dlight_t dl; ! if (r_numdlights >= MAX_DLIGHTS) ! return; ! dl = r_dlights[r_numdlights++]; ! Math3D.VectorCopy(org, dl.origin); ! dl.intensity = intensity; ! dl.color[0] = r; ! dl.color[1] = g; ! dl.color[2] = b; ! } ! /* ! * ===================== V_AddLightStyle ! * ! * ===================== ! */ ! static void AddLightStyle(int style, float r, float g, float b) { ! lightstyle_t ls; ! if (style < 0 || style > MAX_LIGHTSTYLES) ! Com.Error(ERR_DROP, "Bad light style " + style); ! ls = r_lightstyles[style]; ! ls.white = r + g + b; ! ls.rgb[0] = r; ! ls.rgb[1] = g; ! ls.rgb[2] = b; ! } ! /* ! * ================ V_TestParticles ! * ! * If cl_testparticles is set, create 4096 particles in the view ! * ================ ! */ ! static void TestParticles() { ! int i, j; ! float d, r, u; ! float[] origin = { 0, 0, 0 }; ! r_numparticles = 0; ! for (i = 0; i < MAX_PARTICLES; i++) { ! d = i * 0.25f; ! r = 4 * ((i & 7) - 3.5f); ! u = 4 * (((i >> 3) & 7) - 3.5f); ! for (j = 0; j < 3; j++) ! origin[j] = cl.refdef.vieworg[j] + cl.v_forward[j] * d ! + cl.v_right[j] * r + cl.v_up[j] * u; ! AddParticle(origin, 8, cl_testparticles.value); ! } ! } ! /* ! * ================ V_TestEntities ! * ! * If cl_testentities is set, create 32 player models ================ ! */ ! static void TestEntities() { ! int i, j; ! float f, r; ! entity_t ent; ! r_numentities = 32; ! //memset (r_entities, 0, sizeof(r_entities)); ! for (i = 0; i < r_entities.length; i++) ! r_entities[i] = new entity_t(); ! for (i = 0; i < r_numentities; i++) { ! ent = r_entities[i]; ! r = 64 * ((i % 4) - 1.5f); ! f = 64 * (i / 4) + 128; ! for (j = 0; j < 3; j++) ! ent.origin[j] = cl.refdef.vieworg[j] + cl.v_forward[j] * f ! + cl.v_right[j] * r; ! ent.model = cl.baseclientinfo.model; ! ent.skin = cl.baseclientinfo.skin; ! } ! } ! /* ! * ================ V_TestLights ! * ! * If cl_testlights is set, create 32 lights models ================ ! */ ! static void TestLights() { ! int i, j; ! float f, r; ! dlight_t dl; ! r_numdlights = 32; ! //memset (r_dlights, 0, sizeof(r_dlights)); ! for (i = 0; i < r_dlights.length; i++) ! r_dlights[i] = new dlight_t(); ! for (i = 0; i < r_numdlights; i++) { ! dl = r_dlights[i]; ! r = 64 * ((i % 4) - 1.5f); ! f = 64 * (i / 4) + 128; ! for (j = 0; j < 3; j++) ! dl.origin[j] = cl.refdef.vieworg[j] + cl.v_forward[j] * f ! + cl.v_right[j] * r; ! dl.color[0] = ((i % 6) + 1) & 1; ! dl.color[1] = (((i % 6) + 1) & 2) >> 1; ! dl.color[2] = (((i % 6) + 1) & 4) >> 2; ! dl.intensity = 200; ! } ! } ! static xcommand_t Gun_Next_f = new xcommand_t() { ! public void execute() { ! gun_frame++; ! Com.Printf("frame " + gun_frame + "\n"); ! } ! }; ! static xcommand_t Gun_Prev_f = new xcommand_t() { ! public void execute() { ! gun_frame--; ! if (gun_frame < 0) ! gun_frame = 0; ! Com.Printf("frame " + gun_frame + "\n"); ! } ! }; ! static xcommand_t Gun_Model_f = new xcommand_t() { ! public void execute() { ! if (Cmd.Argc() != 2) { ! gun_model = null; ! return; ! } ! String name = "models/" + Cmd.Argv(1) + "/tris.md2"; ! gun_model = re.RegisterModel(name); ! } ! }; ! /* ! * ================== V_RenderView ! * ! * ================== ! */ ! static void RenderView(float stereo_separation) { ! // extern int entitycmpfnc( const entity_t *, const entity_t * ); ! // ! if (cls.state != ca_active) ! return; ! if (!cl.refresh_prepped) ! return; // still loading ! if (cl_timedemo.value != 0.0f) { ! if (cl.timedemo_start == 0) ! cl.timedemo_start = Sys.Milliseconds(); ! cl.timedemo_frames++; ! } ! // an invalid frame will just use the exact previous refdef ! // we can't use the old frame if the video mode has changed, though... ! if (cl.frame.valid && (cl.force_refdef || cl_paused.value == 0.0f)) { ! cl.force_refdef = false; ! V.ClearScene(); ! // build a refresh entity list and calc cl.sim* ! // this also calls CL_CalcViewValues which loads ! // v_forward, etc. ! CL_ents.AddEntities(); ! if (cl_testparticles.value != 0.0f) ! TestParticles(); ! if (cl_testentities.value != 0.0f) ! TestEntities(); ! if (cl_testlights.value != 0.0f) ! TestLights(); ! if (cl_testblend.value != 0.0f) { ! cl.refdef.blend[0] = 1.0f; ! cl.refdef.blend[1] = 0.5f; ! cl.refdef.blend[2] = 0.25f; ! cl.refdef.blend[3] = 0.5f; ! } ! // offset vieworg appropriately if we're doing stereo separation ! if (stereo_separation != 0) { ! float[] tmp = new float[3]; ! Math3D.VectorScale(cl.v_right, stereo_separation, tmp); ! Math3D.VectorAdd(cl.refdef.vieworg, tmp, cl.refdef.vieworg); ! } ! // never let it sit exactly on a node line, because a water plane ! // can ! // dissapear when viewed with the eye exactly on it. ! // the server protocol only specifies to 1/8 pixel, so add 1/16 in ! // each axis ! cl.refdef.vieworg[0] += 1.0 / 16; ! cl.refdef.vieworg[1] += 1.0 / 16; ! cl.refdef.vieworg[2] += 1.0 / 16; ! cl.refdef.x = scr_vrect.x; ! cl.refdef.y = scr_vrect.y; ! cl.refdef.width = scr_vrect.width; ! cl.refdef.height = scr_vrect.height; ! cl.refdef.fov_y = Math3D.CalcFov(cl.refdef.fov_x, cl.refdef.width, ! cl.refdef.height); ! cl.refdef.time = cl.time * 0.001f; ! cl.refdef.areabits = cl.frame.areabits; ! if (cl_add_entities.value == 0.0f) ! r_numentities = 0; ! if (cl_add_particles.value == 0.0f) ! r_numparticles = 0; ! if (cl_add_lights.value == 0.0f) ! r_numdlights = 0; ! if (cl_add_blend.value == 0) { ! Math3D.VectorClear(cl.refdef.blend); ! } ! cl.refdef.num_entities = r_numentities; ! cl.refdef.entities = r_entities; ! cl.refdef.num_particles = r_numparticles; ! cl.refdef.num_dlights = r_numdlights; ! cl.refdef.dlights = r_dlights; ! cl.refdef.lightstyles = r_lightstyles; ! cl.refdef.rdflags = cl.frame.playerstate.rdflags; ! // sort entities for better cache locality ! // !!! useless in Java !!! ! //Arrays.sort(cl.refdef.entities, entitycmpfnc); ! } ! re.RenderFrame(cl.refdef); ! if (cl_stats.value != 0.0f) ! Com.Printf("ent:%i lt:%i part:%i\n", new Vargs(3).add( ! r_numentities).add(r_numdlights).add(r_numparticles)); ! if (log_stats.value != 0.0f && (log_stats_file != null)) ! try { ! log_stats_file.write(r_numentities + "," + r_numdlights + "," ! + r_numparticles); ! } catch (IOException e) { ! } ! SCR.AddDirtyPoint(scr_vrect.x, scr_vrect.y); ! SCR.AddDirtyPoint(scr_vrect.x + scr_vrect.width - 1, scr_vrect.y ! + scr_vrect.height - 1); ! ! SCR.DrawCrosshair(); ! } ! ! /* ! * ============= V_Viewpos_f ============= ! */ ! static xcommand_t Viewpos_f = new xcommand_t() { ! public void execute() { ! Com.Printf("(%i %i %i) : %i\n", new Vargs(4).add( ! (int) cl.refdef.vieworg[0]).add((int) cl.refdef.vieworg[1]) ! .add((int) cl.refdef.vieworg[2]).add( ! (int) cl.refdef.viewangles[YAW])); ! } ! }; ! ! public static void Init() { ! Cmd.AddCommand("gun_next", Gun_Next_f); ! Cmd.AddCommand("gun_prev", Gun_Prev_f); ! Cmd.AddCommand("gun_model", Gun_Model_f); ! ! Cmd.AddCommand("viewpos", Viewpos_f); ! ! crosshair = Cvar.Get("crosshair", "0", CVAR_ARCHIVE); ! ! cl_testblend = Cvar.Get("cl_testblend", "0", 0); ! cl_testparticles = Cvar.Get("cl_testparticles", "0", 0); ! cl_testentities = Cvar.Get("cl_testentities", "0", 0); ! cl_testlights = Cvar.Get("cl_testlights", "0", 0); ! ! cl_stats = Cvar.Get("cl_stats", "0", 0); ! } ! } \ No newline at end of file Index: CL_newfx.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/CL_newfx.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CL_newfx.java 8 Jul 2004 20:24:29 -0000 1.3 --- CL_newfx.java 22 Sep 2004 19:22:08 -0000 1.4 *************** *** 6,1029 **** */ /* ! Copyright (C) 1997-2001 Id Software, Inc. ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! This program is distributed in the hope that it will be useful, [...2002 lines suppressed...] ! p.next = CL_fx.active_particles; ! CL_fx.active_particles = p; ! Math3D.VectorClear(p.accel); ! p.time = Globals.cl.time; ! p.alpha = 1.0f; ! p.alphavel = -1.0f / (0.3f + Globals.rnd.nextFloat() * 0.2f); ! p.color = 0xd0; ! for (j = 0; j < 3; j++) { ! p.org[j] = move[j] + Lib.crand(); ! p.vel[j] = Lib.crand() * 5; ! p.accel[j] = 0; ! } ! Math3D.VectorAdd(move, vec, move); ! } ! } ! } \ No newline at end of file Index: CL_parse.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/CL_parse.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CL_parse.java 30 Jul 2004 06:03:40 -0000 1.8 --- CL_parse.java 22 Sep 2004 19:22:07 -0000 1.9 *************** *** 6,27 **** */ /* ! Copyright (C) 1997-2001 Id Software, Inc. ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! This program is distributed in the hope that it will be useful, [...1520 lines suppressed...] ! ! case Defines.svc_playerinfo: ! case Defines.svc_packetentities: ! case Defines.svc_deltapacketentities: ! Com.Error(Defines.ERR_DROP, "Out of place frame data"); ! break; ! } ! } ! ! CL_view.AddNetgraph(); ! ! // ! // we don't know if it is ok to save a demo message until ! // after we have parsed the frame ! // ! if (Globals.cls.demorecording && !Globals.cls.demowaiting) ! CL.WriteDemoMessage(); ! } ! } \ No newline at end of file Index: M.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/M.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** M.java 8 Jul 2004 20:56:50 -0000 1.4 --- M.java 22 Sep 2004 19:22:07 -0000 1.5 *************** *** 6,27 **** */ /* ! Copyright (C) 1997-2001 Id Software, Inc. ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! This program is distributed in the hope that it will be useful, [...1152 lines suppressed...] ! }; ! /** Adds some flies after a random time */ ! public static EntThinkAdapter M_FlyCheck = new EntThinkAdapter() { ! public boolean think(edict_t self) { ! ! if (self.waterlevel != 0) ! return true; ! ! if (Globals.rnd.nextFloat() > 0.5) ! return true; ! ! self.think = M_FliesOn; ! self.nextthink = GameBase.level.time + 5 + 10 ! * Globals.rnd.nextFloat(); ! return true; ! } ! }; ! } \ No newline at end of file Index: Menu.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/Menu.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Menu.java 12 Sep 2004 19:52:58 -0000 1.8 --- Menu.java 22 Sep 2004 19:22:07 -0000 1.9 *************** *** 6,27 **** */ /* ! Copyright (C) 1997-2001 Id Software, Inc. ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! This program is distributed in the hope that it will be useful, [...9867 lines suppressed...] ! Menu_DrawString(RCOLUMN_OFFSET + s.x + s.parent.x, ! s.y + s.parent.y, s.itemnames[s.curvalue]); ! } 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); ! } ! } ! } \ No newline at end of file Index: CL_fx.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/CL_fx.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CL_fx.java 13 Jul 2004 11:09:55 -0000 1.5 --- CL_fx.java 22 Sep 2004 19:22:08 -0000 1.6 *************** *** 1,4 **** /* ! * CL_fx.java * Copyright (C) 2004 * --- 1,4 ---- /* ! * java * Copyright (C) 2004 * *************** [...3796 lines suppressed...] ! * ============================================================== ! * ! * PARTICLE MANAGEMENT ! * ! * ============================================================== ! */ ! ! static final int PARTICLE_GRAVITY = 40; ! ! static cparticle_t active_particles, free_particles; ! ! /* ! * =============== CL_BigTeleportParticles =============== ! */ ! private static int[] colortable = { 2 * 8, 13 * 8, 21 * 8, 18 * 8 }; ! ! private static final int BEAMLENGTH = 16; ! ! } \ No newline at end of file Index: Console.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/Console.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Console.java 30 Jul 2004 06:03:40 -0000 1.4 --- Console.java 22 Sep 2004 19:22:08 -0000 1.5 *************** *** 6,27 **** */ /* ! Copyright (C) 1997-2001 Id Software, Inc. ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! This program is distributed in the hope that it will be useful, [...1168 lines suppressed...] ! sb.append((char) 0x81); ! } ! sb.append((char) 0x82); ! ! dlbar = sb.toString(); ! dlbar += Com.sprintf(" %02d%%", new Vargs(1) ! .add(cls.downloadpercent)); ! ! // draw it ! y = con.vislines - 12; ! for (i = 0; i < dlbar.length(); i++) ! re.DrawChar((i + 1) << 3, y, dlbar.charAt(i)); ! } ! //ZOID ! ! // draw the input prompt, user text, and cursor if desired ! DrawInput(); ! } ! } \ No newline at end of file Index: CL.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/CL.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** CL.java 8 Sep 2004 09:37:39 -0000 1.10 --- CL.java 22 Sep 2004 19:22:08 -0000 1.11 *************** *** 6,27 **** */ /* ! Copyright (C) 1997-2001 Id Software, Inc. ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! This program is distributed in the hope that it will be useful, [...3250 lines suppressed...] ! Cbuf.Execute(); ! } ! ! /** ! * Called after an ERR_DROP was thrown. ! */ ! public static void Drop() { ! if (Globals.cls.state == Defines.ca_uninitialized) ! return; ! if (Globals.cls.state == Defines.ca_disconnected) ! return; ! ! Disconnect(); ! ! // drop loading plaque unless this is the initial game start ! if (Globals.cls.disable_servercount != -1) ! SCR.EndLoadingPlaque(); // get rid of loading plaque ! } ! } \ No newline at end of file Index: CL_input.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/CL_input.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CL_input.java 9 Jul 2004 06:50:50 -0000 1.3 --- CL_input.java 22 Sep 2004 19:22:08 -0000 1.4 *************** *** 1,4 **** /* ! * CL_input.java * Copyright (C) 2004 * --- 1,4 ---- /* ! * java * Copyright (C) 2004 * *************** [...1214 lines suppressed...] ! MSG.WriteDeltaUsercmd(buf, oldcmd, cmd); oldcmd = cmd; ! i = (Globals.cls.netchan.outgoing_sequence) & (Defines.CMD_BACKUP - 1); ! cmd = Globals.cl.cmds[i]; MSG.WriteDeltaUsercmd(buf, oldcmd, cmd); // calculate a checksum over the move commands ! buf.data[checksumIndex] = Com.BlockSequenceCRCByte(buf.data, checksumIndex + 1, buf.cursize - checksumIndex - 1, ! Globals.cls.netchan.outgoing_sequence); // // deliver the message // ! Netchan.Transmit(Globals.cls.netchan, buf.cursize, buf.data); } ! } \ No newline at end of file Index: CL_view.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/CL_view.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CL_view.java 9 Jul 2004 06:50:50 -0000 1.3 --- CL_view.java 22 Sep 2004 19:22:07 -0000 1.4 *************** *** 1,29 **** /* ! * CL_view.java ! * Copyright (C) 2004 * * $Id$ */ /* ! Copyright (C) 1997-2001 Id Software, Inc. ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ! ! See the GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! ! */ package jake2.client; import jake2.qcommon.CM; import jake2.qcommon.Com; --- 1,30 ---- /* ! * CL_view.java Copyright (C) 2004 * * $Id$ */ /* ! * Copyright (C) 1997-2001 Id Software, Inc. ! * ! * This program is free software; you can redistribute it and/or modify it under ! * the terms of the GNU General Public License as published by the Free Software ! * Foundation; either version 2 of the License, or (at your option) any later ! * version. ! * ! * This program is distributed in the hope that it will be useful, but WITHOUT ! * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ! * FOR A PARTICULAR PURPOSE. ! * ! * See the GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License along with ! * this program; if not, write to the Free Software Foundation, Inc., 59 Temple ! * Place - Suite 330, Boston, MA 02111-1307, USA. ! * ! */ package jake2.client; + import jake2.Defines; + import jake2.Globals; import jake2.qcommon.CM; import jake2.qcommon.Com; *************** *** 32,174 **** import java.util.StringTokenizer; ! public class CL_view extends CL_input { ! ! static int num_cl_weaponmodels; ! static String[] cl_weaponmodels = new String[MAX_CLIENTWEAPONMODELS]; ! /* ! ================= ! CL_PrepRefresh ! Call before entering a new level, or after changing dlls ! ================= ! */ ! static void PrepRefresh() { ! String mapname; ! int i; ! String name; ! float rotate; ! float[] axis = new float[3]; ! if ((i=cl.configstrings[CS_MODELS+1].length()) == 0) ! return; // no map loaded ! SCR.AddDirtyPoint(0, 0); ! SCR.AddDirtyPoint(viddef.width-1, viddef.height-1); ! // let the render dll load the map ! mapname = cl.configstrings[CS_MODELS+1].substring(5, i - 4); // skip "maps/" ! // cut off ".bsp" ! // register models, pics, and skins ! Com.Printf("Map: " + mapname + "\r"); ! SCR.UpdateScreen(); ! re.BeginRegistration(mapname); ! Com.Printf(" \r"); ! // precache status bar pics ! Com.Printf("pics\r"); ! SCR.UpdateScreen(); ! SCR.TouchPics(); ! Com.Printf(" \r"); ! CL.RegisterTEntModels(); ! num_cl_weaponmodels = 1; ! cl_weaponmodels[0] = "weapon.md2"; ! for (i=1 ; i<MAX_MODELS && cl.configstrings[CS_MODELS+i].length() != 0 ; i++) { ! name = new String(cl.configstrings[CS_MODELS+i]); ! if (name.length() > 37) name = name.substring(0, 36); ! ! if (name.charAt(0) != '*') ! Com.Printf(name + "\r"); ! ! SCR.UpdateScreen(); ! Sys.SendKeyEvents(); // pump message loop ! if (name.charAt(0) == '#') { ! // special player weapon model ! if (num_cl_weaponmodels < MAX_CLIENTWEAPONMODELS) { ! cl_weaponmodels[num_cl_weaponmodels] = cl.configstrings[CS_MODELS+i].substring(1); ! num_cl_weaponmodels++; ! } ! } else { ! cl.model_draw[i] = re.RegisterModel(cl.configstrings[CS_MODELS+i]); ! if (name.charAt(0) == '*') ! cl.model_clip[i] = CM.InlineModel(cl.configstrings[CS_MODELS+i]); ! else ! cl.model_clip[i] = null; ! } ! if (name.charAt(0) != '*') ! Com.Printf(" \r"); ! } ! Com.Printf("images\r"); ! SCR.UpdateScreen(); ! for (i=1 ; i<MAX_IMAGES && cl.configstrings[CS_IMAGES+i].length() > 0 ; i++) { ! cl.image_precache[i] = re.RegisterPic(cl.configstrings[CS_IMAGES+i]); ! Sys.SendKeyEvents(); // pump message loop ! } ! Com.Printf(" \r"); ! for (i=0 ; i<MAX_CLIENTS ; i++) { ! if (cl.configstrings[CS_PLAYERSKINS+i].length() == 0) ! continue; ! Com.Printf("client " + i + '\r'); ! SCR.UpdateScreen(); ! Sys.SendKeyEvents(); // pump message loop ! CL.ParseClientinfo(i); ! Com.Printf(" \r"); ! } ! CL_parse.LoadClientinfo(cl.baseclientinfo, "unnamed\\male/grunt"); ! // set sky textures and speed ! Com.Printf("sky\r"); ! SCR.UpdateScreen(); ! rotate = Float.parseFloat(cl.configstrings[CS_SKYROTATE]); ! StringTokenizer st = new StringTokenizer(cl.configstrings[CS_SKYAXIS]); ! axis[0] = Float.parseFloat(st.nextToken()); ! axis[1] = Float.parseFloat(st.nextToken()); ! axis[2] = Float.parseFloat(st.nextToken()); ! re.SetSky(cl.configstrings[CS_SKY], rotate, axis); ! Com.Printf(" \r"); ! // the renderer can now free unneeded stuff ! re.EndRegistration (); ! // clear any lines of console text ! Console.ClearNotify(); ! SCR.UpdateScreen(); ! cl.refresh_prepped = true; ! cl.force_refdef = true; // make sure we have a valid refdef ! } ! ! public static void AddNetgraph() { ! int i; ! int in; ! int ping; ! // if using the debuggraph for something else, don't ! // add the net lines ! if (SCR.scr_debuggraph.value == 0.0f || SCR.scr_timegraph.value == 0.0f) ! return; ! for (i=0 ; i<cls.netchan.dropped ; i++) ! SCR.DebugGraph(30, 0x40); ! for (i=0 ; i<cl.surpressCount ; i++) ! SCR.DebugGraph(30, 0xdf); ! // see what the latency was on this packet ! in = cls.netchan.incoming_acknowledged & (CMD_BACKUP-1); ! ping = (int)(cls.realtime - cl.cmd_time[in]); ! ping /= 30; ! if (ping > 30) ! ping = 30; ! SCR.DebugGraph (ping, 0xd0); ! } ! } --- 33,190 ---- import java.util.StringTokenizer; ! public class CL_view { + static int num_cl_weaponmodels; ! static String[] cl_weaponmodels = new String[Defines.MAX_CLIENTWEAPONMODELS]; ! /* ! * ================= ! * ! * CL_PrepRefresh ! * ! * Call before entering a new level, or after changing dlls ! * ================= ! */ ! static void PrepRefresh() { ! String mapname; ! int i; ! String name; ! float rotate; ! float[] axis = new float[3]; ! if ((i = Globals.cl.configstrings[Defines.CS_MODELS + 1].length()) == 0) ! return; // no map loaded ! SCR.AddDirtyPoint(0, 0); ! SCR.AddDirtyPoint(Globals.viddef.width - 1, Globals.viddef.height - 1); ! // let the render dll load the map ! mapname = Globals.cl.configstrings[Defines.CS_MODELS + 1].substring(5, ! i - 4); // skip "maps/" ! // cut off ".bsp" ! // register models, pics, and skins ! Com.Printf("Map: " + mapname + "\r"); ! SCR.UpdateScreen(); ! Globals.re.BeginRegistration(mapname); ! Com.Printf(" \r"); ! // precache status bar pics ! Com.Printf("pics\r"); ! SCR.UpdateScreen(); ! SCR.TouchPics(); ! Com.Printf(" \r"); ! CL_tent.RegisterTEntModels(); ! num_cl_weaponmodels = 1; ! cl_weaponmodels[0] = "weapon.md2"; ! for (i = 1; i < Defines.MAX_MODELS ! && Globals.cl.configstrings[Defines.CS_MODELS + i].length() != 0; i++) { ! name = new String(Globals.cl.configstrings[Defines.CS_MODELS + i]); ! if (name.length() > 37) ! name = name.substring(0, 36); ! if (name.charAt(0) != '*') ! Com.Printf(name + "\r"); ! SCR.UpdateScreen(); ! Sys.SendKeyEvents(); // pump message loop ! if (name.charAt(0) == '#') { ! // special player weapon model ! if (num_cl_weaponmodels < Defines.MAX_CLIENTWEAPONMODELS) { ! cl_weaponmodels[num_cl_weaponmodels] = Globals.cl.configstrings[Defines.CS_MODELS ! + i].substring(1); ! num_cl_weaponmodels++; ! } ! } else { ! Globals.cl.model_draw[i] = Globals.re ! .RegisterModel(Globals.cl.configstrings[Defines.CS_MODELS ! + i]); ! if (name.charAt(0) == '*') ! Globals.cl.model_clip[i] = CM ! .InlineModel(Globals.cl.configstrings[Defines.CS_MODELS ! + i]); ! else ! Globals.cl.model_clip[i] = null; ! } ! if (name.charAt(0) != '*') ! Com.Printf(" \r"); ! } ! Com.Printf("images\r"); ! SCR.UpdateScreen(); ! for (i = 1; i < Defines.MAX_IMAGES ! && Globals.cl.configstrings[Defines.CS_IMAGES + i].length() > 0; i++) { ! Globals.cl.image_precache[i] = Globals.re ! .RegisterPic(Globals.cl.configstrings[Defines.CS_IMAGES + i]); ! Sys.SendKeyEvents(); // pump message loop ! } ! Com.Printf(" \r"); ! for (i = 0; i < Defines.MAX_CLIENTS; i++) { ! if (Globals.cl.configstrings[Defines.CS_PLAYERSKINS + i].length() == 0) ! continue; ! Com.Printf("client " + i + '\r'); ! SCR.UpdateScreen(); ! Sys.SendKeyEvents(); // pump message loop ! CL_parse.ParseClientinfo(i); ! Com.Printf(" \r"); ! } ! CL_parse.LoadClientinfo(Globals.cl.baseclientinfo, ! "unnamed\\male/grunt"); ! // set sky textures and speed ! Com.Printf("sky\r"); ! SCR.UpdateScreen(); ! rotate = Float ! .parseFloat(Globals.cl.configstrings[Defines.CS_SKYROTATE]); ! StringTokenizer st = new StringTokenizer( ! Globals.cl.configstrings[Defines.CS_SKYAXIS]); ! axis[0] = Float.parseFloat(st.nextToken()); ! axis[1] = Float.parseFloat(st.nextToken()); ! axis[2] = Float.parseFloat(st.nextToken()); ! Globals.re.SetSky(Globals.cl.configstrings[Defines.CS_SKY], rotate, ! axis); ! Com.Printf(" \r"); ! // the renderer can now free unneeded stuff ! Globals.re.EndRegistration(); ! // clear any lines of console text ! Console.ClearNotify(); ! SCR.UpdateScreen(); ! Globals.cl.refresh_prepped = true; ! Globals.cl.force_refdef = true; // make sure we have a valid refdef ! } ! public static void AddNetgraph() { ! int i; ! int in; ! int ping; ! // if using the debuggraph for something else, don't ! // add the net lines ! if (SCR.scr_debuggraph.value == 0.0f || SCR.scr_timegraph.value == 0.0f) ! return; ! for (i = 0; i < Globals.cls.netchan.dropped; i++) ! SCR.DebugGraph(30, 0x40); ! ! for (i = 0; i < Globals.cl.surpressCount; i++) ! SCR.DebugGraph(30, 0xdf); ! ! // see what the latency was on this packet ! in = Globals.cls.netchan.incoming_acknowledged ! & (Defines.CMD_BACKUP - 1); ! ping = (int) (Globals.cls.realtime - Globals.cl.cmd_time[in]); ! ping /= 30; ! if (ping > 30) ! ping = 30; ! SCR.DebugGraph(ping, 0xd0); ! } ! } \ No newline at end of file Index: CL_ents.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/CL_ents.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CL_ents.java 12 Jul 2004 20:47:01 -0000 1.5 --- CL_ents.java 22 Sep 2004 19:22:07 -0000 1.6 *************** *** 1,4 **** /* ! * CL_ents.java * Copyright (C) 2004 * --- 1,4 ---- /* ! * java * Copyright (C) 2004 * *************** [...2441 lines suppressed...] ! CL_fx.AddLightStyles(); } /* ! * =============== CL_GetEntitySoundOrigin ! * ! * Called to get the sound spatialization origin =============== ! */ public static void GetEntitySoundOrigin(int ent, float[] org) { centity_t old; ! if (ent < 0 || ent >= Defines.MAX_EDICTS) ! Com.Error(Defines.ERR_DROP, "CL_GetEntitySoundOrigin: bad ent"); ! old = Globals.cl_entities[ent]; ! Math3D.VectorCopy(old.lerp_origin, org); // FIXME: bmodel issues... } ! } \ No newline at end of file Index: SCR.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/SCR.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SCR.java 27 Aug 2004 21:07:01 -0000 1.7 --- SCR.java 22 Sep 2004 19:22:08 -0000 1.8 *************** *** 6,27 **** */ /* ! Copyright (C) 1997-2001 Id Software, Inc. ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! This program is distributed in the hope that it will be useful, [...3951 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_tent.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/CL_tent.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CL_tent.java 9 Jul 2004 10:19:57 -0000 1.4 --- CL_tent.java 22 Sep 2004 19:22:08 -0000 1.5 *************** *** 1,4 **** /* ! * CL_tent.java * Copyright (C) 2004 * --- 1,4 ---- /* ! * java * Copyright (C) 2004 * *************** [...3500 lines suppressed...] ! s[i].think.think(s[i]); ! } else if (s[i].endtime < Globals.cl.time) ! s[i].id = 0; ! } ! } ! ! /* ! * ================= CL_AddTEnts ================= ! */ ! static void AddTEnts() { ! AddBeams(); ! // PMM - draw plasma beams ! AddPlayerBeams(); ! AddExplosions(); ! AddLasers(); ! // PMM - set up sustain ! ProcessSustain(); ! } ! } \ 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.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CL_pred.java 19 Jul 2004 19:20:22 -0000 1.4 --- CL_pred.java 22 Sep 2004 19:22:08 -0000 1.5 *************** *** 6,287 **** */ /* ! Copyright (C) 1997-2001 Id Software, Inc. ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ! See the GNU General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ package jake2.client; import jake2.game.*; import jake2.qcommon.*; /** * CL_pred */ ! public class CL_pred extends CL_parse { ! /* ! =================== ! CL_CheckPredictionError ! =================== ! */ ! static void CheckPredictionError() { ! int frame; ! int[] delta = new int[3]; ! int i; ! int len; ! if (cl_predict.value == 0.0f || (cl.frame.playerstate.pmove.pm_flags & PMF_NO_PREDICTION) != 0) ! return; ! // calculate the last usercmd_t we sent that the server has processed ! frame = cls.netchan.incoming_acknowledged; ! frame &= (CMD_BACKUP - 1); ! // compare what the server returned with what we had predicted it to be ! VectorSubtract(cl.frame.playerstate.pmove.origin, cl.predicted_origins[frame], delta); ! // save the prediction error for interpolation ! len = Math.abs(delta[0]) + Math.abs(delta[1]) + Math.abs(delta[2]); ! if (len > 640) // 80 world units ! { // a teleport or something ! VectorClear(cl.prediction_error); ! } ! else { ! if (cl_showmiss.value != 0.0f && (delta[0] != 0 || delta[1] != 0 || delta[2] != 0)) ! Com.Printf("prediction miss on " + cl.frame.serverframe + ": " + (delta[0] + delta[1] + delta[2]) + "\n"); ! VectorCopy(cl.frame.playerstate.pmove.origin, cl.predicted_origins[frame]); ! // save for error itnerpolation ! for (i = 0; i < 3; i++) ! cl.prediction_error[i] = delta[i] * 0.125f; ! } ! } ! /* ! ==================== ! CL_ClipMoveToEntities ! ! ==================== ! */ ! static void ClipMoveToEntities(float[] start, float[] mins, float[] maxs, float[] end, trace_t tr) { ! int i, x, zd, zu; ! trace_t trace; ! int headnode; ! float[] angles; ! entity_state_t ent; ! int num; ! cmodel_t cmodel; ! float[] bmins = new float[3]; ! float[] bmaxs = new float[3]; ! for (i = 0; i < cl.frame.num_entities; i++) { ! num = (cl.frame.parse_entities + i) & (MAX_PARSE_ENTITIES - 1); ! ent = cl_parse_entities[num]; ! if (ent.solid == 0) ! continue; ! if (ent.number == cl.playernum + 1) ! continue; ! if (ent.solid == 31) { // special value for bmodel ! cmodel = cl.model_clip[ent.modelindex]; ! if (cmodel == null) ! continue; ! headnode = cmodel.headnode; ! angles = ent.angles; ! } ! else { // encoded bbox ! x = 8 * (ent.solid & 31); ! zd = 8 * ((ent.solid >>> 5) & 31); ! zu = 8 * ((ent.solid >>> 10) & 63) - 32; ! bmins[0] = bmins[1] = -x; ! bmaxs[0] = bmaxs[1] = x; ! bmins[2] = -zd; ! bmaxs[2] = zu; ! headnode = CM.HeadnodeForBox(bmins, bmaxs); ! angles = vec3_origin; // boxes don't rotate ! } ! if (tr.allsolid) ! return; ! trace = CM.TransformedBoxTrace(start, end, mins, maxs, headnode, MASK_PLAYERSOLID, ent.origin, angles); ! if (trace.allsolid || trace.startsolid || trace.fraction < tr.fraction) { ! trace.ent = ent.surrounding_ent; ! if (tr.startsolid) { ! tr.set(trace); // rst: solved the Z U P P E L - P R O B L E M ! tr.startsolid = true; ! } ! else ! tr.set(trace); // rst: solved the Z U P P E L - P R O B L E M ! } ! else if (trace.startsolid) ! tr.startsolid = true; ! } ! } ! /* ! ================ ! CL_PMTrace ! ================ ! */ ! public static edict_t DUMMY_ENT = new edict_t(-1); ! static trace_t PMTrace(float[] start, float[] mins, float[] maxs, float[] end) { ! trace_t t; ! // check against world ! t = CM.BoxTrace(start, end, mins, maxs, 0, MASK_PLAYERSOLID); ! if (t.fraction < 1.0f) { ! t.ent = DUMMY_ENT; ! } ! // check all other solid models ! CL.ClipMoveToEntities(start, mins, maxs, end, t); ! return t; ! } ! /* ! ================= ! PMpointcontents ! ! Returns the content identificator of the point. ! ================= ! */ ! static int PMpointcontents(float[] point) { ! int i; ! entity_state_t ent; ! int num; ! cmodel_t cmodel; ! int contents; ! contents = CM.PointContents(point, 0); ! for (i = 0; i < cl.frame.num_entities; i++) { ! num = (cl.frame.parse_entities + i) & (MAX_PARSE_ENTITIES - 1); ! ent = cl_parse_entities[num]; ! if (ent.solid != 31) // special value for bmodel ! continue; ! cmodel = cl.model_clip[ent.modelindex]; ! if (cmodel == null) ! continue; ! contents |= CM.TransformedPointContents(point, cmodel.headnode, ent.origin, ent.angles); ! } ! return contents; ! } ! /* ! ================= ! CL_PredictMovement ! ! Sets cl.predicted_origin and cl.predicted_angles ! ================= ! */ ! static void PredictMovement() { ! if (cls.state != ca_active) ! return; ! if (cl_paused.value != 0.0f) ! return; ! if (cl_predict.value == 0.0f || (cl.frame.playerstate.pmove.pm_flags & PMF_NO_PREDICTION) != 0) { ! // just set angles ! for (int i = 0; i < 3; i++) { ! cl.predicted_angles[i] = cl.viewangles[i] + SHORT2ANGLE(cl.frame.playerstate.pmove.delta_angles[i]); ! } ! return; ! } ! int ack = cls.netchan.incoming_acknowledged; ! int current = cls.netchan.outgoing_sequence; ! // if we are too far out of date, just freeze ! if (current - ack >= CMD_BACKUP) { ! if (cl_showmiss.value != 0.0f) ! Com.Printf("exceeded CMD_BACKUP\n"); ! return; ! } ! // copy current state to pmove ! //memset (pm, 0, sizeof(pm)); ! pmove_t pm = new pmove_t(); ! pm.trace = new pmove_t.TraceAdapter() { ! public trace_t trace(float[] start, float[] mins, float[] maxs, float[] end) { ! return CL.PMTrace(start, mins, maxs, end); ! } ! }; ! pm.pointcontents = new pmove_t.PointContentsAdapter() { ! public int pointcontents(float[] point) { ! return CL.PMpointcontents(point); ! } ! }; ! 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. ! pm.s.set(cl.frame.playerstate.pmove); ! // SCR_DebugGraph (current - ack - 1, 0); ! int frame = 0; ! // run frames ! usercmd_t cmd; ! while (++ack < current) { ! frame = ack & (CMD_BACKUP - 1); ! cmd = cl.cmds[frame]; ! pm.cmd.set(cmd); ! PMove.Pmove(pm); ! // save for debug checking ! VectorCopy(pm.s.origin, cl.predicted_origins[frame]); ! } ! int oldframe = (ack - 2) & (CMD_BACKUP - 1); ! int oldz = cl.predicted_origins[oldframe][2]; ! int step = pm.s.origin[2] - oldz; ! if (step > 63 && step < 160 && (pm.s.pm_flags & PMF_ON_GROUND) != 0) { ! cl.predicted_step = step * 0.125f; ! cl.predicted_step_time = (int) (cls.realtime - cls.frametime * 500); ! } ! // copy results out for rendering ! cl.predicted_origin[0] = pm.s.origin[0] * 0.125f; ! cl.predicted_origin[1] = pm.s.origin[1] * 0.125f; ! cl.predicted_origin[2] = pm.s.origin[2] * 0.125f; ! VectorCopy(pm.viewangles, cl.predicted_angles); ! } ! } --- 6,303 ---- */ /* ! Copyright (C) 1997-2001 Id Software, Inc. ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ! See the GNU General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ package jake2.client; + import jake2.Defines; + import jake2.Globals; + import jake2.Defines; + import jake2.game.pmove_t.PointContentsAdapter; + import jake2.game.pmove_t.TraceAdapter; + + import jake2.Globals; import jake2.game.*; import jake2.qcommon.*; + import jake2.util.Math3D; /** * CL_pred */ ! public class CL_pred { ! /* ! * =================== CL_CheckPredictionError =================== ! */ ! static void CheckPredictionError() { ! int frame; ! int[] delta = new int[3]; ! int i; ! int len; ! if (Globals.cl_predict.value == 0.0f ! || (Globals.cl.frame.playerstate.pmove.pm_flags & pmove_t.PMF_NO_PREDICTION) != 0) ! return; ! // calculate the last usercmd_t we sent that the server has processed ! frame = Globals.cls.netchan.incoming_acknowledged; ! frame &= (Defines.CMD_BACKUP - 1); ! // compare what the server returned with what we had pre... [truncated message content] |