]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_main.c
eliminated model->meshlist, replaced with an embedded model->surfmesh to cut down...
[xonotic/darkplaces.git] / cl_main.c
index aea2bbde938107ad051c84a933ac2bc8a83c3040..8c41941d31afc609eecec93b01c38b07d2a6c943 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -49,6 +49,9 @@ cvar_t m_side = {CVAR_SAVE, "m_side","0.8","mouse side speed multiplier"};
 
 cvar_t freelook = {CVAR_SAVE, "freelook", "1","mouse controls pitch instead of forward/back"};
 
+cvar_t cl_autodemo = {0, "cl_autodemo", "0", "records every game played, using the date/time and map name to name the demo file" };
+cvar_t cl_autodemo_nameformat = {0, "cl_autodemo_nameformat", "%Y-%m-%d_%H-%M", "The format of the cl_autodemo filename, followed by the map name" };
+
 cvar_t r_draweffects = {0, "r_draweffects", "1","renders temporary sprite effects"};
 
 cvar_t cl_explosions_alpha_start = {CVAR_SAVE, "cl_explosions_alpha_start", "1.5","starting alpha of an explosion shell"};
@@ -402,44 +405,45 @@ static void CL_PrintEntities_f(void)
 //static const vec3_t nomodelmaxs = {16, 16, 16};
 void CL_BoundingBoxForEntity(entity_render_t *ent)
 {
-       if (ent->model)
+       model_t *model = ent->model;
+       if (model)
        {
                //if (ent->angles[0] || ent->angles[2])
                if (ent->matrix.m[2][0] != 0 || ent->matrix.m[2][1] != 0)
                {
                        // pitch or roll
-                       ent->mins[0] = ent->matrix.m[0][3] + ent->model->rotatedmins[0];
-                       ent->mins[1] = ent->matrix.m[1][3] + ent->model->rotatedmins[1];
-                       ent->mins[2] = ent->matrix.m[2][3] + ent->model->rotatedmins[2];
-                       ent->maxs[0] = ent->matrix.m[0][3] + ent->model->rotatedmaxs[0];
-                       ent->maxs[1] = ent->matrix.m[1][3] + ent->model->rotatedmaxs[1];
-                       ent->maxs[2] = ent->matrix.m[2][3] + ent->model->rotatedmaxs[2];
-                       //VectorAdd(ent->origin, ent->model->rotatedmins, ent->mins);
-                       //VectorAdd(ent->origin, ent->model->rotatedmaxs, ent->maxs);
+                       ent->mins[0] = ent->matrix.m[0][3] + model->rotatedmins[0];
+                       ent->mins[1] = ent->matrix.m[1][3] + model->rotatedmins[1];
+                       ent->mins[2] = ent->matrix.m[2][3] + model->rotatedmins[2];
+                       ent->maxs[0] = ent->matrix.m[0][3] + model->rotatedmaxs[0];
+                       ent->maxs[1] = ent->matrix.m[1][3] + model->rotatedmaxs[1];
+                       ent->maxs[2] = ent->matrix.m[2][3] + model->rotatedmaxs[2];
+                       //VectorAdd(ent->origin, model->rotatedmins, ent->mins);
+                       //VectorAdd(ent->origin, model->rotatedmaxs, ent->maxs);
                }
                //else if (ent->angles[1])
                else if (ent->matrix.m[0][1] != 0 || ent->matrix.m[1][0] != 0)
                {
                        // yaw
-                       ent->mins[0] = ent->matrix.m[0][3] + ent->model->yawmins[0];
-                       ent->mins[1] = ent->matrix.m[1][3] + ent->model->yawmins[1];
-                       ent->mins[2] = ent->matrix.m[2][3] + ent->model->yawmins[2];
-                       ent->maxs[0] = ent->matrix.m[0][3] + ent->model->yawmaxs[0];
-                       ent->maxs[1] = ent->matrix.m[1][3] + ent->model->yawmaxs[1];
-                       ent->maxs[2] = ent->matrix.m[2][3] + ent->model->yawmaxs[2];
-                       //VectorAdd(ent->origin, ent->model->yawmins, ent->mins);
-                       //VectorAdd(ent->origin, ent->model->yawmaxs, ent->maxs);
+                       ent->mins[0] = ent->matrix.m[0][3] + model->yawmins[0];
+                       ent->mins[1] = ent->matrix.m[1][3] + model->yawmins[1];
+                       ent->mins[2] = ent->matrix.m[2][3] + model->yawmins[2];
+                       ent->maxs[0] = ent->matrix.m[0][3] + model->yawmaxs[0];
+                       ent->maxs[1] = ent->matrix.m[1][3] + model->yawmaxs[1];
+                       ent->maxs[2] = ent->matrix.m[2][3] + model->yawmaxs[2];
+                       //VectorAdd(ent->origin, model->yawmins, ent->mins);
+                       //VectorAdd(ent->origin, model->yawmaxs, ent->maxs);
                }
                else
                {
-                       ent->mins[0] = ent->matrix.m[0][3] + ent->model->normalmins[0];
-                       ent->mins[1] = ent->matrix.m[1][3] + ent->model->normalmins[1];
-                       ent->mins[2] = ent->matrix.m[2][3] + ent->model->normalmins[2];
-                       ent->maxs[0] = ent->matrix.m[0][3] + ent->model->normalmaxs[0];
-                       ent->maxs[1] = ent->matrix.m[1][3] + ent->model->normalmaxs[1];
-                       ent->maxs[2] = ent->matrix.m[2][3] + ent->model->normalmaxs[2];
-                       //VectorAdd(ent->origin, ent->model->normalmins, ent->mins);
-                       //VectorAdd(ent->origin, ent->model->normalmaxs, ent->maxs);
+                       ent->mins[0] = ent->matrix.m[0][3] + model->normalmins[0];
+                       ent->mins[1] = ent->matrix.m[1][3] + model->normalmins[1];
+                       ent->mins[2] = ent->matrix.m[2][3] + model->normalmins[2];
+                       ent->maxs[0] = ent->matrix.m[0][3] + model->normalmaxs[0];
+                       ent->maxs[1] = ent->matrix.m[1][3] + model->normalmaxs[1];
+                       ent->maxs[2] = ent->matrix.m[2][3] + model->normalmaxs[2];
+                       //VectorAdd(ent->origin, model->normalmins, ent->mins);
+                       //VectorAdd(ent->origin, model->normalmaxs, ent->maxs);
                }
        }
        else
@@ -892,7 +896,7 @@ void CL_LinkNetworkEntity(entity_t *e)
                if (e->render.model)
                {
                        // if model is alias or this is a tenebrae-like dlight, reverse pitch direction
-                       if (e->render.model->type == mod_alias || (e->state_current.lightpflags & PFLAGS_FULLDYNAMIC))
+                       if (e->render.model->type == mod_alias)
                                angles[0] = -angles[0];
                        if ((e->render.model->flags & EF_ROTATE) && (!e->state_current.tagentity && !(e->render.flags & RENDER_VIEWMODEL)))
                        {
@@ -902,9 +906,12 @@ void CL_LinkNetworkEntity(entity_t *e)
                        }
                        // transfer certain model flags to effects
                        e->render.effects |= e->render.model->flags2 & (EF_FULLBRIGHT | EF_ADDITIVE);
-                       if (cl_prydoncursor.integer && (e->render.effects & EF_SELECTABLE) && cl.cmd.cursor_entitynumber == e->state_current.number)
+                       if ((e->render.effects & EF_SELECTABLE) && cl.cmd.cursor_entitynumber == e->state_current.number)
                                VectorScale(e->render.colormod, 2, e->render.colormod);
                }
+               // if model is alias or this is a tenebrae-like dlight, reverse pitch direction
+               else if (e->state_current.lightpflags & PFLAGS_FULLDYNAMIC)
+                       angles[0] = -angles[0];
 
                // animation lerp
                if (e->render.frame2 == e->state_current.frame)
@@ -1741,6 +1748,9 @@ void CL_Init (void)
        Cmd_AddCommand ("playdemo", CL_PlayDemo_f, "watch a demo file");
        Cmd_AddCommand ("timedemo", CL_TimeDemo_f, "play back a demo as fast as possible and save statistics to benchmark.log");
 
+       Cvar_RegisterVariable (&cl_autodemo);
+       Cvar_RegisterVariable (&cl_autodemo_nameformat);
+
        Cmd_AddCommand ("fog", CL_Fog_f, "set global fog parameters (density red green blue)");
 
        // LordHavoc: added pausedemo