]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_main.c
Added "ctype.h" to the list of standard headers in "quakedef.h". Cleaned up the todo...
[xonotic/darkplaces.git] / cl_main.c
index 6ecfefb19011d58f9a9295bab213fb9feaba0dce..c90bec3ac9dd5c2368803745442f09488a4ca23b 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -61,6 +61,8 @@ cvar_t cl_beams_lightatend = {CVAR_SAVE, "cl_beams_lightatend", "0"};
 
 cvar_t cl_noplayershadow = {CVAR_SAVE, "cl_noplayershadow", "0"};
 
+cvar_t cl_prydoncursor = {0, "cl_prydoncursor", "0"};
+
 mempool_t *cl_refdef_mempool;
 mempool_t *cl_entities_mempool;
 
@@ -390,6 +392,7 @@ entity_t *CL_NewTempEntity(void)
        ent->render.colormap = -1; // no special coloring
        ent->render.scale = 1;
        ent->render.alpha = 1;
+       VectorSet(ent->render.colormod, 1, 1, 1);
        return ent;
 }
 
@@ -530,6 +533,7 @@ void CL_LinkNetworkEntity(entity_t *e)
                else
                        e->render.colormap = -1; // no special coloring
                e->render.skinnum = e->state_current.skin;
+               VectorScale(e->state_current.colormod, (1.0f / 32.0f), e->render.colormod);
                if (e->render.flags & RENDER_VIEWMODEL)
                {
                        if (!r_drawviewmodel.integer || chase_active.integer || envmap)
@@ -610,6 +614,8 @@ void CL_LinkNetworkEntity(entity_t *e)
                        // transfer certain model flags to effects
                        if (e->render.model->flags2 & EF_FULLBRIGHT)
                                e->render.effects |= EF_FULLBRIGHT;
+                       if (cl_prydoncursor.integer && (e->render.effects & EF_SELECTABLE) && cl.cmd.cursor_entitynumber == e - cl_entities)
+                               VectorScale(e->render.colormod, 2, e->render.colormod);
                }
 
                // animation lerp
@@ -745,7 +751,7 @@ void CL_LinkNetworkEntity(entity_t *e)
                        tempmatrix.m[0][3] = v[0];
                        tempmatrix.m[1][3] = v[1];
                        tempmatrix.m[2][3] = v[2];
-                       CL_AllocDlight(NULL, &tempmatrix, 100, e->persistent.muzzleflash, e->persistent.muzzleflash, e->persistent.muzzleflash, 0, 0, 0, 0, true, 0, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
+                       CL_AllocDlight(NULL, &tempmatrix, 100, e->persistent.muzzleflash, e->persistent.muzzleflash, e->persistent.muzzleflash, 0, 0, 0, -1, true, 0, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
                        e->persistent.muzzleflash -= cl.frametime * 10;
                }
                // LordHavoc: if the model has no flags, don't check each
@@ -818,7 +824,7 @@ void CL_LinkNetworkEntity(entity_t *e)
                        // hack to make glowing player light shine on their gun
                        //if ((e - cl_entities) == cl.viewentity/* && !chase_active.integer*/)
                        //      dlightmatrix.m[2][3] += 30;
-                       CL_AllocDlight(&e->render, &e->render.matrix, dlightradius, dlightcolor[0], dlightcolor[1], dlightcolor[2], 0, 0, 0, 0, true, 1, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
+                       CL_AllocDlight(&e->render, &e->render.matrix, dlightradius, dlightcolor[0], dlightcolor[1], dlightcolor[2], 0, 0, 0, -1, true, 1, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
                }
                // custom rtlight
                if (e->state_current.lightpflags & PFLAGS_FULLDYNAMIC)
@@ -886,6 +892,7 @@ void CL_RelinkWorld(void)
        ent->render.flags = RENDER_SHADOW;
        if (!r_fullbright.integer)
                ent->render.flags |= RENDER_LIGHT;
+       VectorSet(ent->render.colormod, 1, 1, 1);
 }
 
 static void CL_RelinkStaticEntities(void)
@@ -905,6 +912,7 @@ static void CL_RelinkStaticEntities(void)
                // hide player shadow during intermission or nehahra movie
                if (!(e->render.effects & EF_NOSHADOW) && !(e->render.flags & RENDER_TRANSPARENT))
                        e->render.flags |= RENDER_SHADOW;
+               VectorSet(e->render.colormod, 1, 1, 1);
                R_LerpAnimation(&e->render);
                r_refdef.entities[r_refdef.numentities++] = &e->render;
        }
@@ -931,7 +939,7 @@ static void CL_RelinkNetworkEntities(void)
        ent->state_current.flags = RENDER_VIEWMODEL;
        if (cl.stats[STAT_HEALTH] <= 0 || cl.intermission)
                ent->state_current.modelindex = 0;
-       else if (cl.items & IT_INVISIBILITY)
+       else if (cl.stats[STAT_ITEMS] & IT_INVISIBILITY)
        {
                if (gamemode == GAME_TRANSFUSION)
                        ent->state_current.alpha = 128;
@@ -939,6 +947,14 @@ static void CL_RelinkNetworkEntities(void)
                        ent->state_current.modelindex = 0;
        }
 
+       // reset animation interpolation on weaponmodel if model changed
+       if (ent->state_previous.modelindex != ent->state_current.modelindex)
+       {
+               ent->render.frame = ent->render.frame1 = ent->render.frame2 = ent->state_current.frame;
+               ent->render.frame1time = ent->render.frame2time = cl.time;
+               ent->render.framelerp = 1;
+       }
+
        // start on the entity after the world
        entitylinkframenumber++;
        for (i = 1, ent = cl_entities + 1;i < MAX_EDICTS;i++, ent++)
@@ -998,6 +1014,7 @@ static void CL_RelinkEffects(void)
                                ent->render.frame = ent->render.frame2;
                                ent->render.colormap = -1; // no special coloring
                                ent->render.alpha = 1;
+                               VectorSet(ent->render.colormod, 1, 1, 1);
 
                                Matrix4x4_CreateFromQuakeEntity(&ent->render.matrix, e->origin[0], e->origin[1], e->origin[2], 0, 0, 0, 1);
                                Matrix4x4_Invert_Simple(&ent->render.inversematrix, &ent->render.matrix);
@@ -1068,7 +1085,7 @@ void CL_RelinkBeams(void)
                        {
                                // FIXME: create a matrix from the beam start/end orientation
                                Matrix4x4_CreateTranslate(&tempmatrix, b->end[0], b->end[1], b->end[2]);
-                               CL_AllocDlight (NULL, &tempmatrix, 200, 0.3, 0.7, 1, 0, 0, 0, 0, true, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
+                               CL_AllocDlight (NULL, &tempmatrix, 200, 0.3, 0.7, 1, 0, 0, 0, -1, true, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
                        }
                        if (cl_beams_polygons.integer)
                                continue;
@@ -1198,10 +1215,10 @@ int CL_ReadFromServer(void)
 CL_SendCmd
 =================
 */
-void CL_SendCmd(usercmd_t *cmd)
+void CL_SendCmd(void)
 {
        if (cls.signon == SIGNONS)
-               CL_SendMove(cmd);
+               CL_SendMove();
 
        if (cls.demoplayback)
        {
@@ -1257,7 +1274,7 @@ CL_Init
 =================
 */
 //VorteX: cvars for GAME_NETHERWORLD
-cvar_t cl_playermodel = {CVAR_SAVE, "cl_playermodel", "ranger"}; 
+cvar_t __cl_playermodel = {CVAR_SAVE, "cl_playermodel", "ranger"}; 
 cvar_t cl_footsteps = {CVAR_SAVE, "cl_footsteps", "1"}; 
 cvar_t cl_weapon_ofs = {CVAR_SAVE, "cl_weapon_ofs", "0 0 0"}; 
 cvar_t cl_weapon_bstep = {CVAR_SAVE, "cl_weapon_bstep", "100 0 0"}; 
@@ -1298,7 +1315,6 @@ void CL_Init (void)
        SZ_Alloc (&cls.message, 1024, "cls.message");
 
        CL_InitInput ();
-       CL_InitTEnts ();
 
 //
 // register our commands
@@ -1351,9 +1367,11 @@ void CL_Init (void)
        Cvar_RegisterVariable(&cl_beams_lightatend);
        Cvar_RegisterVariable(&cl_noplayershadow);
 
+       Cvar_RegisterVariable(&cl_prydoncursor);
+
        if (gamemode == GAME_NETHERWORLD)
        {
-               Cvar_RegisterVariable (&cl_playermodel); 
+               Cvar_RegisterVariable (&__cl_playermodel); 
                Cvar_RegisterVariable (&cl_footsteps); 
                Cvar_RegisterVariable (&cl_weapon_ofs); 
                Cvar_RegisterVariable (&cl_weapon_bstep);