eliminated cl.csqc_entities array and related fields
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 23 Jan 2007 00:43:51 +0000 (00:43 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 23 Jan 2007 00:43:51 +0000 (00:43 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6737 d7cf8633-e32d-0410-b094-e92efae38249

cl_collision.c
cl_collision.h
cl_input.c
cl_main.c
client.h
clvm_cmds.c
csprogs.c

index ea3c666..92d5b8d 100644 (file)
@@ -178,7 +178,7 @@ trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co
        return cliptrace;
 }
 
-float CL_SelectTraceLine(const vec3_t start, const vec3_t end, vec3_t impact, vec3_t normal, int *hitent, entity_render_t *ignoreent, qboolean csqcents)
+float CL_SelectTraceLine(const vec3_t start, const vec3_t end, vec3_t impact, vec3_t normal, int *hitent, entity_render_t *ignoreent)
 {
        float maxfrac, maxrealfrac;
        int n;
@@ -209,12 +209,6 @@ float CL_SelectTraceLine(const vec3_t start, const vec3_t end, vec3_t impact, ve
        tracemins[2] = min(start[2], end[2]);
        tracemaxs[2] = max(start[2], end[2]);
 
-       if (csqcents)
-       {
-               Con_Printf("CL_SelectTraceline: csqc entity collisions in this function are broken and this function will be removed in the future (it is not part of the csqc spec).\n");
-               return maxfrac;
-       }
-
        // look for embedded bmodels
        for (n = 0;n < cl.num_entities;n++)
        {
index c405203..740ec2a 100644 (file)
@@ -3,7 +3,7 @@
 #define CL_COLLISION_H
 
 trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int hitbmodels, int *hitent, int hitsupercontentsmask, qboolean hitplayers);
-float CL_SelectTraceLine(const vec3_t start, const vec3_t end, vec3_t impact, vec3_t normal, int *hitent, entity_render_t *ignoreent, qboolean csqcents);
+float CL_SelectTraceLine(const vec3_t start, const vec3_t end, vec3_t impact, vec3_t normal, int *hitent, entity_render_t *ignoreent);
 void CL_FindNonSolidLocation(const vec3_t in, vec3_t out, vec_t radius);
 int CL_PointSuperContents(const vec3_t p);
 
index 358cb33..a6f4476 100644 (file)
@@ -556,7 +556,7 @@ void CL_UpdatePrydonCursor(void)
        VectorSet(temp, cl.cmd.cursor_screen[2] * 1000000, cl.cmd.cursor_screen[0] * -r_view.frustum_x * 1000000, cl.cmd.cursor_screen[1] * -r_view.frustum_y * 1000000);
        Matrix4x4_Transform(&r_view.matrix, temp, cl.cmd.cursor_end);
        // trace from view origin to the cursor
-       cl.cmd.cursor_fraction = CL_SelectTraceLine(cl.cmd.cursor_start, cl.cmd.cursor_end, cl.cmd.cursor_impact, cl.cmd.cursor_normal, &cl.cmd.cursor_entitynumber, (chase_active.integer || cl.intermission) ? &cl.entities[cl.playerentity].render : NULL, false);
+       cl.cmd.cursor_fraction = CL_SelectTraceLine(cl.cmd.cursor_start, cl.cmd.cursor_end, cl.cmd.cursor_impact, cl.cmd.cursor_normal, &cl.cmd.cursor_entitynumber, (chase_active.integer || cl.intermission) ? &cl.entities[cl.playerentity].render : NULL);
 }
 
 void CL_ClientMovement_InputQW(qw_usercmd_t *cmd)
index b2c4e51..7d666ed 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -107,14 +107,12 @@ void CL_ClearState(void)
        cl.mviewzoom[0] = cl.mviewzoom[1] = 1;
 
        cl.num_entities = 0;
-       cl.num_csqcentities = 0;        //[515]: csqc
        cl.num_static_entities = 0;
        cl.num_temp_entities = 0;
        cl.num_brushmodel_entities = 0;
 
        // tweak these if the game runs out
        cl.max_entities = 256;
-       cl.max_csqcentities = 256;      //[515]: csqc
        cl.max_static_entities = 256;
        cl.max_temp_entities = 512;
        cl.max_effects = 256;
@@ -138,9 +136,7 @@ void CL_ClearState(void)
        cl.num_beams = 0;
 
        cl.entities = (entity_t *)Mem_Alloc(cls.levelmempool, cl.max_entities * sizeof(entity_t));
-       cl.csqcentities = (entity_t *)Mem_Alloc(cls.levelmempool, cl.max_csqcentities * sizeof(entity_t));      //[515]: csqc
        cl.entities_active = (unsigned char *)Mem_Alloc(cls.levelmempool, cl.max_brushmodel_entities * sizeof(unsigned char));
-       cl.csqcentities_active = (unsigned char *)Mem_Alloc(cls.levelmempool, cl.max_brushmodel_entities * sizeof(unsigned char));      //[515]: csqc
        cl.static_entities = (entity_t *)Mem_Alloc(cls.levelmempool, cl.max_static_entities * sizeof(entity_t));
        cl.temp_entities = (entity_t *)Mem_Alloc(cls.levelmempool, cl.max_temp_entities * sizeof(entity_t));
        cl.effects = (cl_effect_t *)Mem_Alloc(cls.levelmempool, cl.max_effects * sizeof(cl_effect_t));
@@ -158,14 +154,6 @@ void CL_ClearState(void)
                cl.entities[i].state_current = defaultstate;
        }
 
-       for (i = 0;i < cl.max_csqcentities;i++)
-       {
-               cl.csqcentities[i].state_baseline = defaultstate;       //[515]: csqc
-               cl.csqcentities[i].state_previous = defaultstate;       //[515]: csqc
-               cl.csqcentities[i].state_current = defaultstate;        //[515]: csqc
-               cl.csqcentities[i].state_current.number = -i;
-       }
-
        if (gamemode == GAME_NEXUIZ)
        {
                VectorSet(cl.playerstandmins, -16, -16, -24);
@@ -275,32 +263,6 @@ void CL_ExpandEntities(int num)
        }
 }
 
-void CL_ExpandCSQCEntities(int num)
-{
-       int i, oldmaxentities;
-       entity_t *oldentities;
-       if (num >= cl.max_csqcentities)
-       {
-               if (!cl.csqcentities)
-                       Sys_Error("CL_ExpandCSQCEntities: cl.csqcentities not initialized\n");
-               if (num >= MAX_EDICTS)
-                       Host_Error("CL_ExpandCSQCEntities: num %i >= %i\n", num, MAX_EDICTS);
-               oldmaxentities = cl.max_csqcentities;
-               oldentities = cl.csqcentities;
-               cl.max_csqcentities = (num & ~255) + 256;
-               cl.csqcentities = (entity_t *)Mem_Alloc(cls.levelmempool, cl.max_csqcentities * sizeof(entity_t));
-               memcpy(cl.csqcentities, oldentities, oldmaxentities * sizeof(entity_t));
-               Mem_Free(oldentities);
-               for (i = oldmaxentities;i < cl.max_csqcentities;i++)
-               {
-                       cl.csqcentities[i].state_baseline = defaultstate;
-                       cl.csqcentities[i].state_previous = defaultstate;
-                       cl.csqcentities[i].state_current = defaultstate;
-                       cl.csqcentities[i].state_current.number = -i;
-               }
-       }
-}
-
 void CL_VM_ShutDown (void);
 /*
 =====================
index b83c5e9..6918501 100644 (file)
--- a/client.h
+++ b/client.h
@@ -849,7 +849,6 @@ typedef struct client_state_s
        vec3_t playercrouchmaxs;
 
        int max_entities;
-       int max_csqcentities;
        int max_static_entities;
        int max_temp_entities;
        int max_effects;
@@ -860,9 +859,7 @@ typedef struct client_state_s
        int max_particles;
 
        entity_t *entities;
-       entity_t *csqcentities; //[515]: csqc
        unsigned char *entities_active;
-       unsigned char *csqcentities_active;     //[515]: csqc
        entity_t *static_entities;
        entity_t *temp_entities;
        cl_effect_t *effects;
@@ -873,7 +870,6 @@ typedef struct client_state_s
        particle_t *particles;
 
        int num_entities;
-       int num_csqcentities;   //[515]: csqc
        int num_static_entities;
        int num_temp_entities;
        int num_brushmodel_entities;
index b90a0b0..51164f4 100644 (file)
@@ -119,7 +119,6 @@ void PF_registercvar (void);
 int Sbar_GetPlayer (int index);
 void Sbar_SortFrags (void);
 void CL_FindNonSolidLocation(const vec3_t in, vec3_t out, vec_t radius);
-void CL_ExpandCSQCEntities(int num);
 void CSQC_RelinkAllEntities (int drawmask);
 void CSQC_RelinkCSQCEntities (void);
 char *Key_GetBind (int key);
@@ -763,7 +762,6 @@ void VM_CL_getlight (void)
 //============================================================================
 //[515]: SCENE MANAGER builtins
 extern qboolean CSQC_AddRenderEdict (prvm_edict_t *ed);//csprogs.c
-extern void CSQC_ClearCSQCEntities (void);//csprogs.c
 
 matrix4x4_t csqc_listenermatrix;
 qboolean csqc_usecsqclistener = false;//[515]: per-frame
@@ -782,8 +780,6 @@ void VM_R_ClearScene (void)
 {
        VM_SAFEPARMCOUNT(0, VM_R_ClearScene);
        r_refdef.numentities = 0;
-//     CSQC_R_RecalcView();
-       CSQC_ClearCSQCEntities();
 }
 
 //#301 void(float mask) addentities (EXT_CSQC)
@@ -1112,25 +1108,16 @@ void VM_CL_particleeffectnum (void)
 // #336 void(entity ent, float effectnum, vector start, vector end[, float color]) trailparticles (EXT_CSQC)
 void VM_CL_trailparticles (void)
 {
-       int                             i, entnum;
+       int                             i;
        float                   *start, *end;
        prvm_edict_t    *t;
        VM_SAFEPARMCOUNT(4, VM_CL_trailparticles);
 
        t = PRVM_G_EDICT(OFS_PARM0);
-       entnum  = PRVM_NUM_FOR_EDICT(t);
        i               = (int)PRVM_G_FLOAT(OFS_PARM1);
        start   = PRVM_G_VECTOR(OFS_PARM2);
        end             = PRVM_G_VECTOR(OFS_PARM3);
 
-       if (entnum >= MAX_EDICTS)
-       {
-               VM_Warning("CSQC_ParseBeam: invalid entity number %i\n", entnum);
-               return;
-       }
-       if (entnum >= cl.max_csqcentities)
-               CL_ExpandCSQCEntities(entnum);
-
        CL_ParticleEffect(i, VectorDistance(start, end), start, end, t->fields.client->velocity, t->fields.client->velocity, NULL, (int)PRVM_G_FLOAT(OFS_PARM4));
 }
 
@@ -2352,16 +2339,12 @@ void VM_CL_selecttraceline (void)
        csqcents = (int)PRVM_G_FLOAT(OFS_PARM3);
        ent = 0;
 
-       if((csqcents && ignore > cl.num_csqcentities) || (!csqcents && ignore > cl.num_entities))
+       if (csqcents)
        {
-               VM_Warning("VM_CL_selecttraceline: out of entities\n");
+               VM_Warning("VM_CL_selecttraceline: csqcents flag not supported anymore, and this function is deprecated\n");
                return;
        }
-       else
-               if(csqcents)
-                       prog->globals.client->trace_fraction = CL_SelectTraceLine(v1, v2, prog->globals.client->trace_endpos, prog->globals.client->trace_plane_normal, &prog->globals.client->trace_ent, &cl.csqcentities[ignore].render, csqcents);
-               else
-                       prog->globals.client->trace_fraction = CL_SelectTraceLine(v1, v2, prog->globals.client->trace_endpos, prog->globals.client->trace_plane_normal, &ent, &cl.entities[ignore].render, csqcents);
+       prog->globals.client->trace_fraction = CL_SelectTraceLine(v1, v2, prog->globals.client->trace_endpos, prog->globals.client->trace_plane_normal, &ent, &cl.entities[ignore].render);
        PRVM_G_FLOAT(OFS_RETURN) = ent;
 }
 
index cb1c2dc..8e42b6f 100644 (file)
--- a/csprogs.c
+++ b/csprogs.c
@@ -275,14 +275,6 @@ qboolean CSQC_AddRenderEdict(prvm_edict_t *ed)
        return true;
 }
 
-void CSQC_ClearCSQCEntities (void)
-{
-       memset(cl.csqcentities_active, 0, sizeof(cl.csqcentities_active));
-       cl.num_csqcentities = 0;
-}
-
-void CL_ExpandCSQCEntities (int num);
-
 qboolean CL_VM_InputEvent (qboolean pressed, int key)
 {
        qboolean r;
@@ -307,7 +299,7 @@ qboolean CL_VM_UpdateView (void)
                //VectorCopy(cl.viewangles, oldangles);
                *prog->time = cl.time;
                CSQC_SetGlobals();
-               cl.num_csqcentities = 0;
+               r_refdef.numentities = 0;
                PRVM_ExecuteProgram (prog->globals.client->CSQC_UpdateView, CL_F_UPDATEVIEW);
                //VectorCopy(oldangles, cl.viewangles);
        CSQC_END
@@ -492,7 +484,6 @@ void CL_VM_Init (void)
        fs_offset_t csprogsdatasize;
        int csprogsdatacrc, requiredcrc;
        int requiredsize;
-       entity_t *ent;
 
        // reset csqc_progcrc after reading it, so that changing servers doesn't
        // expect csqc on the next server
@@ -598,16 +589,6 @@ void CL_VM_Init (void)
 
        cl.csqc_vidvars.drawcrosshair = false;
        cl.csqc_vidvars.drawenginesbar = false;
-
-       // local state
-       ent = &cl.csqcentities[0];
-       // entire entity array was cleared, so just fill in a few fields
-       ent->state_current.active = true;
-       ent->render.model = cl.worldmodel = cl.model_precache[1];
-       ent->render.alpha = 1;
-       ent->render.flags = RENDER_SHADOW | RENDER_LIGHT;
-       Matrix4x4_CreateFromQuakeEntity(&ent->render.matrix, 0, 0, 0, 0, 0, 0, 1);
-       CL_UpdateRenderEntity(&ent->render);
 }
 
 void CL_VM_ShutDown (void)