2 Copyright (C) 1996-1997 Id Software, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 // refresh.h -- public interface to refresh functions
23 #define MAXCLIPPLANES 11
25 #define TOP_RANGE 16 // soldier uniform colors
26 #define BOTTOM_RANGE 96
28 //=============================================================================
30 typedef struct efrag_s
33 struct efrag_s *leafnext;
34 struct entity_s *entity;
35 struct efrag_s *entnext;
39 typedef struct entity_s
41 qboolean forcelink; // model changed
45 entity_state_t baseline; // to fill in defaults in updates
46 entity_state_t deltabaseline; // LordHavoc: previous frame
48 double msgtime; // time of last update
49 vec3_t msg_origins[2]; // last two updates (0 is newest)
51 vec3_t msg_angles[2]; // last two updates (0 is newest)
54 // LordHavoc: added support for alpha transprency and other effects
55 float alpha; // opacity (alpha) of the model
56 float colormod[3]; // color tint for model
57 float scale; // size the model is shown
58 int draw_lastpose, draw_pose; // for interpolation
59 float draw_lerpstart; // for interpolation
60 struct model_s *draw_lastmodel; // for interpolation
62 float glowsize; // how big the glow is
63 byte glowcolor; // color of glow and particle trail (paletted)
64 byte glowtrail; // leaves a trail of particles
65 byte isviewmodel; // attached to view
67 struct model_s *model; // NULL = no model
68 struct efrag_s *efrag; // linked list of efrags
70 float syncbase; // for client-side animations
72 int effects; // light, particals, etc
73 int skinnum; // for Alias models
74 int visframe; // last frame this entity was
75 // found in an active leaf
77 int dlightframe; // dynamic lighting
80 // FIXME: could turn these into a union
82 struct mnode_s *topnode; // for bmodels, first world node
83 // that splits bmodel, or NULL if
87 // !!! if this is changed, it must be changed in asm_draw.h too !!!
90 vrect_t vrect; // subwindow in video for refresh
91 // FIXME: not need vrect next field here?
92 vrect_t aliasvrect; // scaled Alias version
93 int vrectright, vrectbottom; // right & bottom screen coords
94 int aliasvrectright, aliasvrectbottom; // scaled Alias versions
95 float vrectrightedge; // rightmost right edge we care about,
96 // for use in edge list
97 float fvrectx, fvrecty; // for floating-point compares
98 float fvrectx_adj, fvrecty_adj; // left and top edges, for clamping
99 int vrect_x_adj_shift20; // (vrect.x + 0.5 - epsilon) << 20
100 int vrectright_adj_shift20; // (vrectright + 0.5 - epsilon) << 20
101 float fvrectright_adj, fvrectbottom_adj;
102 // right and bottom edges, for clamping
103 float fvrectright; // rightmost edge, for Alias clamping
104 float fvrectbottom; // bottommost edge, for Alias clamping
105 float horizontalFieldOfView; // at Z = 1.0, this many X is visible
107 float xOrigin; // should probably allways be 0.5
108 float yOrigin; // between be around 0.3 to 0.5
124 extern refdef_t r_refdef;
125 extern vec3_t r_origin, vpn, vright, vup;
127 extern struct texture_s *r_notexture_mip;
129 // LordHavoc: generic image loader
130 byte* loadimagepixels (char* filename, qboolean complain, int matchwidth, int matchheight);
131 int loadtextureimage (char* filename, int matchwidth, int matchheight, qboolean complain, qboolean mipmap);
134 void R_InitTextures (void);
135 void R_InitEfrags (void);
136 void R_RenderView (void); // must set r_refdef first
137 void R_ViewChanged (vrect_t *pvrect, int lineadj, float aspect);
138 // called whenever r_refdef or vid change
139 // LordHavoc: changed this for sake of GLQuake
140 void R_InitSky (byte *src, int bytesperpixel); // called at level load
141 //void R_InitSky (struct texture_s *mt); // called at level load
143 void R_AddEfrags (entity_t *ent);
144 void R_RemoveEfrags (entity_t *ent);
146 void R_NewMap (void);
149 void R_ParseParticleEffect (void);
150 void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count);
151 void R_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent);
152 void R_RocketTrail2 (vec3_t start, vec3_t end, int type, entity_t *ent);
153 void R_SparkShower (vec3_t org, vec3_t dir, int count);
154 void R_BloodPuff (vec3_t org);
156 void R_EntityParticles (entity_t *ent);
157 void R_BlobExplosion (vec3_t org);
158 void R_ParticleExplosion (vec3_t org, int smoke);
159 void R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength);
160 void R_LavaSplash (vec3_t org);
161 void R_TeleportSplash (vec3_t org);
163 void R_PushDlights (void);