]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
split render portion of entity_t struct into entity_render_t
authorlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 29 May 2001 16:00:56 +0000 (16:00 +0000)
committerlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 29 May 2001 16:00:56 +0000 (16:00 +0000)
got rid of glowsize and glowtrail fields in entity_render_t (since they were only used inside RelinkEntities anyway)
removed some commented out struct stuff
fixed mouse hide/show code in win32 (could get stuck shown)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@208 d7cf8633-e32d-0410-b094-e92efae38249

cl_main.c
cl_parse.c
in_win.c
protocol.h
quakedef.h
render.h

index d8a353e992909e93b0029f648a7d12c2c9f17975..e44e29e735f4bcad4d0bbdad6b4756faaf680690 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -441,8 +441,8 @@ void R_RocketTrail2 (vec3_t start, vec3_t end, int color, entity_t *ent);
 void CL_RelinkEntities (void)
 {
        entity_t        *ent;
-       int                     i, j;
-       float           frac, f, d, bobjrotate/*, bobjoffset*/, dlightradius;
+       int                     i, j, glowcolor, effects;
+       float           frac, f, d, bobjrotate/*, bobjoffset*/, dlightradius, glowsize;
        vec3_t          oldorg, delta, dlightcolor;
 
 // determine partial update time       
@@ -529,7 +529,7 @@ void CL_RelinkEntities (void)
                }
 
                ent->render.flags = ent->state_current.flags;
-               ent->render.effects = ent->state_current.effects;
+               ent->render.effects = effects = ent->state_current.effects;
                ent->render.model = cl.model_precache[ent->state_current.modelindex];
                ent->render.frame = ent->state_current.frame;
                if (cl.scores == NULL || !ent->state_current.colormap)
@@ -539,8 +539,8 @@ void CL_RelinkEntities (void)
                ent->render.skinnum = ent->state_current.skin;
                ent->render.alpha = ent->state_current.alpha * (1.0f / 255.0f); // FIXME: interpolate?
                ent->render.scale = ent->state_current.scale * (1.0f / 16.0f); // FIXME: interpolate?
-               ent->render.glowsize = ent->state_current.glowsize * 4.0f; // FIXME: interpolate?
-               ent->render.glowcolor = ent->state_current.glowcolor;
+               glowsize = ent->state_current.glowsize * 4.0f; // FIXME: interpolate?
+               glowcolor = ent->state_current.glowcolor;
                ent->render.colormod[0] = (float) ((ent->state_current.colormod >> 5) & 7) * (1.0f / 7.0f);
                ent->render.colormod[1] = (float) ((ent->state_current.colormod >> 2) & 7) * (1.0f / 7.0f);
                ent->render.colormod[2] = (float) (ent->state_current.colormod & 3) * (1.0f / 3.0f);
@@ -551,11 +551,11 @@ void CL_RelinkEntities (void)
                dlightcolor[2] = 0;
 
                // LordHavoc: if the entity has no effects, don't check each
-               if (ent->render.effects)
+               if (effects)
                {
-                       if (ent->render.effects & EF_BRIGHTFIELD)
+                       if (effects & EF_BRIGHTFIELD)
                                R_EntityParticles (ent);
-                       if (ent->render.effects & EF_MUZZLEFLASH)
+                       if (effects & EF_MUZZLEFLASH)
                        {
                                vec3_t v;
 
@@ -567,32 +567,32 @@ void CL_RelinkEntities (void)
 
                                CL_AllocDlight (NULL, v, 100, 1, 1, 1, 0, 0.1);
                        }
-                       if (ent->render.effects & EF_DIMLIGHT)
+                       if (effects & EF_DIMLIGHT)
                        {
                                dlightcolor[0] += 200.0f;
                                dlightcolor[1] += 200.0f;
                                dlightcolor[2] += 200.0f;
                        }
-                       if (ent->render.effects & EF_BRIGHTLIGHT)
+                       if (effects & EF_BRIGHTLIGHT)
                        {
                                dlightcolor[0] += 400.0f;
                                dlightcolor[1] += 400.0f;
                                dlightcolor[2] += 400.0f;
                        }
                        // LordHavoc: added EF_RED and EF_BLUE
-                       if (ent->render.effects & EF_RED) // red
+                       if (effects & EF_RED) // red
                        {
                                dlightcolor[0] += 200.0f;
                                dlightcolor[1] +=  20.0f;
                                dlightcolor[2] +=  20.0f;
                        }
-                       if (ent->render.effects & EF_BLUE) // blue
+                       if (effects & EF_BLUE) // blue
                        {
                                dlightcolor[0] +=  20.0f;
                                dlightcolor[1] +=  20.0f;
                                dlightcolor[2] += 200.0f;
                        }
-                       else if (ent->render.effects & EF_FLAME)
+                       else if (effects & EF_FLAME)
                        {
                                if (ent->render.model)
                                {
@@ -649,16 +649,16 @@ void CL_RelinkEntities (void)
                        }
                }
                // LordHavoc: customizable glow
-               if (ent->render.glowsize)
+               if (glowsize)
                {
-                       byte *tempcolor = (byte *)&d_8to24table[ent->render.glowcolor];
-                       dlightcolor[0] += ent->render.glowsize * tempcolor[0] * (1.0f / 255.0f);
-                       dlightcolor[1] += ent->render.glowsize * tempcolor[1] * (1.0f / 255.0f);
-                       dlightcolor[2] += ent->render.glowsize * tempcolor[2] * (1.0f / 255.0f);
+                       byte *tempcolor = (byte *)&d_8to24table[glowcolor];
+                       dlightcolor[0] += glowsize * tempcolor[0] * (1.0f / 255.0f);
+                       dlightcolor[1] += glowsize * tempcolor[1] * (1.0f / 255.0f);
+                       dlightcolor[2] += glowsize * tempcolor[2] * (1.0f / 255.0f);
                }
                // LordHavoc: customizable trail
                if (ent->render.flags & RENDER_GLOWTRAIL)
-                       R_RocketTrail2 (oldorg, ent->render.origin, ent->render.glowcolor, ent);
+                       R_RocketTrail2 (oldorg, ent->render.origin, glowcolor, ent);
 
                if (dlightcolor[0] || dlightcolor[1] || dlightcolor[2])
                {
@@ -672,7 +672,7 @@ void CL_RelinkEntities (void)
 
                if (ent->render.model == NULL)
                        continue;
-               if (ent->render.effects & EF_NODRAW)
+               if (effects & EF_NODRAW)
                        continue;
                if (cl_numvisedicts < MAX_VISEDICTS)
                        cl_visedicts[cl_numvisedicts++] = ent;
index cf626f3211e8594b1c3ea6560268f7e12a0ed302..50c84767b4b1a36092bc848d33bc263d8c6dc22d 100644 (file)
@@ -831,8 +831,6 @@ void CL_ParseStatic (int large)
        ent->render.alpha = 1;
        ent->render.scale = 1;
        ent->render.alpha = 1;
-       ent->render.glowsize = 0;
-       ent->render.glowcolor = 254;
        ent->render.colormod[0] = ent->render.colormod[1] = ent->render.colormod[2] = 1;
 
        VectorCopy (ent->state_baseline.origin, ent->render.origin);
index 37397b6988735145216f44e162f0ca87301c315b..3114a90882dbe70bdcbd9e4b79a658ec84a9fb2a 100644 (file)
--- a/in_win.c
+++ b/in_win.c
@@ -46,7 +46,7 @@ unsigned int uiWheelMessage;
 qboolean       mouseactive;
 qboolean               mouseinitialized;
 static qboolean        mouseparmsvalid, mouseactivatetoggle;
-//static qboolean      mouseshowtoggle = 1;
+static qboolean        mouseshowtoggle = 1;
 static qboolean        dinput_acquired;
 
 static unsigned int            mstate_di;
@@ -188,11 +188,11 @@ IN_ShowMouse
 */
 void IN_ShowMouse (void)
 {
-//     if (!mouseshowtoggle)
-//     {
+       if (!mouseshowtoggle)
+       {
                ShowCursor (true);
-//             mouseshowtoggle = 1;
-//     }
+               mouseshowtoggle = 1;
+       }
 }
 
 
@@ -203,11 +203,11 @@ IN_HideMouse
 */
 void IN_HideMouse (void)
 {
-//     if (mouseshowtoggle)
-//     {
+       if (mouseshowtoggle)
+       {
                ShowCursor (false);
-//             mouseshowtoggle = 0;
-//     }
+               mouseshowtoggle = 0;
+       }
 }
 
 
index 96a03104b621e923d833cc80e738e47c0cf583b0..df79dc831028d595e32ef1d75ee1e83e12092deb 100644 (file)
@@ -273,11 +273,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 typedef struct
 {
        double  time; // time this state was updated
-       vec3_t  origin;
-       vec3_t  angles;
-       int             effects;
+       unsigned short active;
        unsigned short modelindex;
        unsigned short frame;
+       unsigned short effects;
+       vec3_t  origin;
+       vec3_t  angles;
        byte    colormap;
        byte    skin;
        byte    alpha;
@@ -286,7 +287,6 @@ typedef struct
        byte    glowcolor;
        byte    colormod;
        byte    flags;
-       byte    active;
 } entity_state_t;
 
 void ClearStateToDefault(entity_state_t *s);
index 499acbbb4ccb0bf20e8a31349455e035dc9fe337..73ad3018c04bddf7d323ec2dd338300565ef73db 100644 (file)
@@ -198,13 +198,12 @@ extern int buildnumber;
 #include "cmd.h"
 #include "sbar.h"
 #include "sound.h"
+#include "model_shared.h"
 #include "render.h"
 #include "client.h"
 #include "progs.h"
 #include "server.h"
 
-#include "model_shared.h"
-
 #include "input.h"
 #include "world.h"
 #include "keys.h"
index 56114375b905dcd000c62b4145f9324e8b2d2167..6c92a91a0df785a9559f540ed386ba399df55ba8 100644 (file)
--- a/render.h
+++ b/render.h
@@ -67,79 +67,52 @@ extern cvar_t gl_transform;
 
 //=============================================================================
 
+typedef struct entity_render_s
+{
+       vec3_t  origin;
+       vec3_t  angles;
+
+       int             visframe;               // last frame this entity was found in an active leaf
+
+       model_t *model;                 // NULL = no model
+       int             frame;                  // current desired frame (usually identical to frame2, but frame2 is not always used)
+       int             colormap;               // entity shirt and pants colors
+       int             effects;                // light, particles, etc
+       int             skinnum;                // for Alias models
+       int             flags;                  // render flags
+
+       float   alpha;                  // opacity (alpha) of the model
+       float   scale;                  // size the model is shown
+       float   trail_time;             // last time for trail rendering
+       float   colormod[3];    // color tint for model
+
+       model_t *lerp_model;    // lerp resets when model changes
+       int             frame1;                 // frame that the model is interpolating from
+       int             frame2;                 // frame that the model is interpolating to
+       double  lerp_starttime; // start of this transition
+       double  framelerp;              // interpolation factor, usually computed from lerp_starttime
+       double  frame1start;    // time frame1 began playing (for framegroup animations)
+       double  frame2start;    // time frame2 began playing (for framegroup animations)
+}
+entity_render_t;
+
 typedef struct entity_s
 {
-       entity_state_t                  state_baseline; // baseline for entity
-       entity_state_t                  state_previous; // previous state (interpolating from this)
-       entity_state_t                  state_current;  // current state (interpolating to this)
-
-       struct
-       {
-               vec3_t                                  origin;
-               vec3_t                                  angles; 
-
-               // LordHavoc: added support for alpha transprency and other effects
-               float                                   alpha;                  // opacity (alpha) of the model
-               float                                   colormod[3];    // color tint for model
-               float                                   scale;                  // size the model is shown
-               float                                   glowsize;               // how big the glow is
-               byte                                    glowcolor;              // color of glow and particle trail (paletted)
-               byte                                    flags;                  // render flags
-
-               struct model_s                  *model;                 // NULL = no model
-               int                                             frame;                  // current desired frame (usually identical to frame2, but frame2 is not always used)
-               int                                             colormap;
-               int                                             effects;                // light, particles, etc
-               int                                             skinnum;                // for Alias models
-
-               int                                             visframe;               // last frame this entity was found in an active leaf
-
-               struct model_s                  *lerp_model;    // lerp resets when model changes
-               double                                  lerp_starttime; // start of this transition
-               int                                             frame1;                 // frame that the model is interpolating from
-               int                                             frame2;                 // frame that the model is interpolating to
-               double                                  framelerp;              // interpolation factor, usually computed from lerp_starttime
-               double                                  frame1start;    // time frame1 began playing (for framegroup animations)
-               double                                  frame2start;    // time frame2 began playing (for framegroup animations)
-
-               int                                             dlightframe;    // dynamic lighting
-               int                                             dlightbits[8];
-               
-               float                                   trail_time;
-       }
-       render;
+       entity_state_t state_baseline;  // baseline for entity
+       entity_state_t state_previous;  // previous state (interpolating from this)
+       entity_state_t state_current;   // current state (interpolating to this)
+
+       entity_render_t render;
 } entity_t;
 
 typedef struct
 {
        vrect_t         vrect;                          // subwindow in video for refresh
-                                                                       // FIXME: not need vrect next field here?
-       /*
-       vrect_t         aliasvrect;                     // scaled Alias version
-       int                     vrectright, vrectbottom;        // right & bottom screen coords
-       int                     aliasvrectright, aliasvrectbottom;      // scaled Alias versions
-       float           vrectrightedge;                 // rightmost right edge we care about,
-                                                                               //  for use in edge list
-       float           fvrectx, fvrecty;               // for floating-point compares
-       float           fvrectx_adj, fvrecty_adj; // left and top edges, for clamping
-       int                     vrect_x_adj_shift20;    // (vrect.x + 0.5 - epsilon) << 20
-       int                     vrectright_adj_shift20; // (vrectright + 0.5 - epsilon) << 20
-       float           fvrectright_adj, fvrectbottom_adj;
-                                                                               // right and bottom edges, for clamping
-       float           fvrectright;                    // rightmost edge, for Alias clamping
-       float           fvrectbottom;                   // bottommost edge, for Alias clamping
-       float           horizontalFieldOfView;  // at Z = 1.0, this many X is visible 
-                                                                               // 2.0 = 90 degrees
-       float           xOrigin;                        // should probably always be 0.5
-       float           yOrigin;                        // between be around 0.3 to 0.5
-       */
 
        vec3_t          vieworg;
        vec3_t          viewangles;
-       
-       float           fov_x, fov_y;
 
-//     int                     ambientlight;
+       float           fov_x, fov_y;
 } refdef_t;