]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - client.h
DP code cleanup, stage one - all headers that can be protected by ifdef
[xonotic/darkplaces.git] / client.h
index 6f436a420d1b8ff82715a4e91f5bba65236f1ec9..3edc6f9898b79623a409757041550fa6f0d32517 100644 (file)
--- a/client.h
+++ b/client.h
@@ -19,6 +19,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
 // client.h
 
+#ifndef CLIENT_H
+#define CLIENT_H
+
 typedef struct frameblend_s
 {
        int frame;
@@ -29,57 +32,96 @@ frameblend_t;
 // LordHavoc: nothing in this structure is persistant, it may be overwritten by the client every frame, for persistant data use entity_lerp_t.
 typedef struct entity_render_s
 {
-       vec3_t  origin;                 // location
-       vec3_t  angles;                 // orientation
-       float   alpha;                  // opacity (alpha) of the model
-       float   scale;                  // size the model is shown
-
-       model_t *model;                 // NULL = no model
-       int             frame;                  // current uninterpolated animation frame (for things which do not use interpolation)
-       int             colormap;               // entity shirt and pants colors
-       int             effects;                // light, particles, etc
-       int             skinnum;                // for Alias models
-       int             flags;                  // render flags
+       // location
+       vec3_t origin;
+       // orientation
+       vec3_t angles;
+       // opacity (alpha) of the model
+       float alpha;
+       // size the model is shown
+       float scale;
+
+       // NULL = no model
+       model_t *model;
+       // current uninterpolated animation frame (for things which do not use interpolation)
+       int frame;
+       // entity shirt and pants colors
+       int colormap;
+       // light, particles, etc
+       int effects;
+       // for Alias models
+       int skinnum;
+       // render flags
+       int flags;
 
        // these are copied from the persistent data
-       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 frame2time
-       double  frame1time;             // time frame1 began playing (for framegroup animations)
-       double  frame2time;             // time frame2 began playing (for framegroup animations)
+
+       // frame that the model is interpolating from
+       int frame1;
+       // frame that the model is interpolating to
+       int frame2;
+       // interpolation factor, usually computed from frame2time
+       double framelerp;
+       // time frame1 began playing (for framegroup animations)
+       double frame1time;
+       // time frame2 began playing (for framegroup animations)
+       double frame2time;
 
        // calculated by the renderer (but not persistent)
-       int             visframe;               // if visframe == r_framecount, it is visible
-       vec3_t  mins, maxs;             // calculated during R_AddModelEntities
-       frameblend_t    frameblend[4]; // 4 frame numbers (-1 if not used) and their blending scalers (0-1), if interpolation is not desired, use frame instead
+
+       // if visframe == r_framecount, it is visible
+       int visframe;
+       // calculated during R_AddModelEntities
+       vec3_t mins, maxs;
+       // 4 frame numbers (-1 if not used) and their blending scalers (0-1), if interpolation is not desired, use frame instead
+       frameblend_t frameblend[4];
 }
 entity_render_t;
 
 typedef struct entity_persistent_s
 {
        // particles
-       vec3_t  trail_origin;   // trail rendering
-       float   trail_time;             // trail rendering
+
+       // trail rendering
+       vec3_t trail_origin;
+       float trail_time;
+
+       // effects
+
+       // muzzleflash fading
+       float muzzleflash;
 
        // interpolated animation
-       int             modelindex;             // lerp resets when model changes
-       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 frame2time
-       double  frame1time;             // time frame1 began playing (for framegroup animations)
-       double  frame2time;             // time frame2 began playing (for framegroup animations)
+
+       // lerp resets when model changes
+       int modelindex;
+       // frame that the model is interpolating from
+       int frame1;
+       // frame that the model is interpolating to
+       int frame2;
+       // interpolation factor, usually computed from frame2time
+       double framelerp;
+       // time frame1 began playing (for framegroup animations)
+       double frame1time;
+       // time frame2 began playing (for framegroup animations)
+       double frame2time;
 }
 entity_persistent_t;
 
 typedef struct entity_s
 {
-       entity_state_t state_baseline;  // baseline state (default values)
-       entity_state_t state_previous;  // previous state (interpolating from this)
-       entity_state_t state_current;   // current state (interpolating to this)
-
-       entity_persistent_t persistent; // used for regenerating parts of render
-
-       entity_render_t render; // the only data the renderer should know about
+       // baseline state (default values)
+       entity_state_t state_baseline;
+       // previous state (interpolating from this)
+       entity_state_t state_previous;
+       // current state (interpolating to this)
+       entity_state_t state_current;
+
+       // used for regenerating parts of render
+       entity_persistent_t persistent;
+
+       // the only data the renderer should know about
+       entity_render_t render;
 }
 entity_t;
 
@@ -198,6 +240,7 @@ typedef struct
                                                                // throw out the first couple, so the player
                                                                // doesn't accidentally do something the
                                                                // first frame
+       float           sendnoptime;    // send a clc_nop periodically until connected
        usercmd_t       cmd;                    // last command sent to the server
 
 // information for local display
@@ -266,7 +309,6 @@ typedef struct
 
 // refresh related state
        struct model_s  *worldmodel;    // cl_entitites[0].model
-//     int                     num_entities;   // held in cl_entities array
        int                     num_statics;    // held in cl_staticentities array
        entity_t        viewent;                        // the gun model
 
@@ -274,6 +316,14 @@ typedef struct
 
 // frag scoreboard
        scoreboard_t    *scores;                // [cl.maxclients]
+
+       vec3_t          viewentorigin;
+       float           viewzoom;                       // LordHavoc: sniping zoom, QC controlled
+       float           viewzoomold, viewzoomnew; // for interpolation
+
+       // entity database stuff
+       vec3_t          viewentoriginold, viewentoriginnew;
+       entity_database_t entitydatabase;
 }
 client_state_t;
 
@@ -344,12 +394,6 @@ void CL_EstablishConnection (char *host);
 void CL_Disconnect (void);
 void CL_Disconnect_f (void);
 
-// LordHavoc: fixme: move this to r_refdef?
-// LordHavoc: raised this from 256 to the maximum possible number of entities visible
-#define MAX_VISEDICTS (MAX_EDICTS + MAX_STATIC_ENTITIES + MAX_TEMP_ENTITIES)
-extern int                     cl_numvisedicts;
-extern entity_t        *cl_visedicts[MAX_VISEDICTS];
-
 //
 // cl_input
 //
@@ -368,7 +412,7 @@ void CL_InitInput (void);
 void CL_SendCmd (void);
 void CL_SendMove (usercmd_t *cmd);
 
-void CL_LerpUpdate(entity_t *e, int frame, int modelindex);
+void CL_LerpUpdate(entity_t *e);
 void CL_ParseTEnt (void);
 void CL_UpdateTEnts (void);
 
@@ -412,11 +456,10 @@ void CL_BitProfile_f(void);
 void V_StartPitchDrift (void);
 void V_StopPitchDrift (void);
 
-void V_RenderView (void);
+void V_Init (void);
+float V_CalcRoll (vec3_t angles, vec3_t velocity);
 void V_UpdateBlends (void);
-void V_Register (void);
 void V_ParseDamage (void);
-void V_SetContentsColor (int contents);
 
 
 //
@@ -433,19 +476,6 @@ void CL_InitTEnts (void);
 #define PARTICLE_UPRIGHT_FACING 2
 #define PARTICLE_ORIENTED_DOUBLESIDED 3
 
-typedef struct renderparticle_s
-{
-       int                     tex;
-       int                     orientation;
-       int                     dynlight;
-       float           scalex;
-       float           scaley;
-       float           org[3];
-       float           dir[3];
-       float           color[4];
-}
-renderparticle_t;
-
 void CL_Particles_Clear(void);
 void CL_Particles_Init(void);
 
@@ -454,7 +484,9 @@ void CL_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count);
 void CL_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent);
 void CL_RocketTrail2 (vec3_t start, vec3_t end, int color, entity_t *ent);
 void CL_SparkShower (vec3_t org, vec3_t dir, int count);
+void CL_PlasmaBurn (vec3_t org);
 void CL_BloodPuff (vec3_t org, vec3_t vel, int count);
+void CL_Stardust (vec3_t mins, vec3_t maxs, int count);
 void CL_FlameCube (vec3_t mins, vec3_t maxs, int count);
 void CL_Flames (vec3_t org, vec3_t vel, int count);
 void CL_BloodShower (vec3_t mins, vec3_t maxs, float velspeed, int count);
@@ -467,32 +499,42 @@ void CL_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength);
 void CL_LavaSplash (vec3_t org);
 void CL_TeleportSplash (vec3_t org);
 void CL_MoveParticles(void);
-void CL_UpdateDecals(void);
 void R_MoveExplosions(void);
 void R_NewExplosion(vec3_t org);
 
-//
-// cl_decal
-//
+#include "cl_screen.h"
+
+#define MAX_VISEDICTS (MAX_EDICTS + MAX_STATIC_ENTITIES + MAX_TEMP_ENTITIES)
 
-typedef struct renderdecal_s
+typedef struct
 {
-       entity_render_t *ent;
-       int tex;
-       int surface;
-       float scale;
-       vec3_t org;
-       vec3_t dir;
-       float color[4];
+       // area to render in
+       int x, y, width, height;
+       float fov_x, fov_y;
+
+       // view point
+       vec3_t vieworg;
+       vec3_t viewangles;
+
+       // fullscreen color blend
+       float viewblend[4];
+
+       // weapon model
+       entity_render_t viewent;
+
+       int numentities;
+       entity_render_t **entities;
+
+       qbyte drawqueue[MAX_DRAWQUEUE];
+       int drawqueuesize;
 }
-renderdecal_t;
+refdef_t;
+
+refdef_t r_refdef;
+
+extern mempool_t *cl_refdef_mempool;
 
-void CL_Decals_Clear(void);
-void CL_Decals_Init(void);
-void CL_Decal(vec3_t origin, int tex, float scale, float red, float green, float blue, float alpha);
+#include "cgamevm.h"
 
-// if contents is not zero, it will impact on content changes
-// (leafs matching contents are considered empty, others are solid)
-extern int traceline_endcontents; // set by TraceLine
-float TraceLine (vec3_t start, vec3_t end, vec3_t impact, vec3_t normal, int contents);
+#endif