diff --git a/include/client.h b/include/client.h index cb35d27..3221bca 100644 --- a/include/client.h +++ b/include/client.h @@ -100,6 +100,8 @@ typedef struct float decay; // drop this each second float minlight; // don't add when contributing less int key; + float _color[3]; + float *color; #ifdef QUAKE2 qboolean dark; // subtracts light instead of adding #endif diff --git a/include/glquake.h b/include/glquake.h index 5f14bab..9a19ad5 100644 --- a/include/glquake.h +++ b/include/glquake.h @@ -198,6 +198,7 @@ extern cvar_t *gl_ztrick; extern cvar_t *gl_finish; extern cvar_t *gl_clear; extern cvar_t *gl_subdivide_size; +extern cvar_t *gl_particles; extern int gl_lightmap_format; extern int gl_solid_format; @@ -212,6 +213,8 @@ extern mplane_t *mirror_plane; extern float r_world_matrix[16]; +extern float bubble_sintable[], bubble_costable[]; + extern const char *gl_vendor; extern const char *gl_renderer; extern const char *gl_version; @@ -237,6 +240,9 @@ extern lpSelTexFUNC qglSelectTexture; extern qboolean gl_mtexable; +void GL_SubdivideSurface (msurface_t *fa); +void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr); + void GL_DisableMultitexture(void); void GL_EnableMultitexture(void); void GL_BuildLightmaps (void); @@ -251,4 +257,22 @@ void R_DrawSkyChain (msurface_t *s); qboolean R_CullBox (vec3_t mins, vec3_t maxs); void R_RotateForEntity (entity_t *e); +void AddLightBlend (float, float, float, float); + +typedef struct { + int key; // allows reusability + vec3_t origin, owner; + float size; + float die, decay; // duration settings + float minlight; // lighting threshold + float _color[3]; // RGBA + float *color; +} fire_t; + +void R_AddFire (vec3_t, vec3_t, entity_t *ent); +fire_t *R_AllocFire (int); +void R_DrawFire (fire_t *); +void R_UpdateFires (void); + + #endif // __glquake_h diff --git a/include/render.h b/include/render.h index 04537af..bc2f77b 100644 --- a/include/render.h +++ b/include/render.h @@ -143,7 +143,7 @@ void R_NewMap (void); void R_ParseParticleEffect (void); void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count); -void R_RocketTrail (vec3_t start, vec3_t end, int type); +void R_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent); #ifdef QUAKE2 void R_DarkFieldParticles (entity_t *ent); diff --git a/source/Makefile.am b/source/Makefile.am index b604126..7b06a16 100644 --- a/source/Makefile.am +++ b/source/Makefile.am @@ -186,7 +186,8 @@ nuq_x11_DEPENDENCIES=libqfsys.a libqfsnd.a libqfcd.a libqfnet.a # ... Common stuff # ogl_SOURCES= gl_draw.c gl_mesh.c gl_part.c gl_refrag.c gl_rlight.c \ - gl_rmain.c gl_rmisc.c gl_rsurf.c gl_screen.c gl_view.c gl_warp.c + gl_rmain.c gl_rmisc.c gl_rsurf.c gl_screen.c gl_view.c \ + gl_warp.c gl_model.c # # ... 3Dfx Voodoo 1 and 2 SVGAlib-based console GL diff --git a/source/cl_main.c b/source/cl_main.c index f9c215d..a02c61f 100644 --- a/source/cl_main.c +++ b/source/cl_main.c @@ -355,6 +355,7 @@ dlight_t *CL_AllocDlight (int key) { memset (dl, 0, sizeof(*dl)); dl->key = key; + dl->color = dl->_color; return dl; } } @@ -368,6 +369,7 @@ dlight_t *CL_AllocDlight (int key) { memset (dl, 0, sizeof(*dl)); dl->key = key; + dl->color = dl->_color; return dl; } } @@ -375,6 +377,7 @@ dlight_t *CL_AllocDlight (int key) dl = &cl_dlights[0]; memset (dl, 0, sizeof(*dl)); dl->key = key; + dl->color = dl->_color; return dl; } @@ -611,25 +614,25 @@ void CL_RelinkEntities (void) #endif if (ent->model->flags & EF_GIB) - R_RocketTrail (oldorg, ent->origin, 2); + R_RocketTrail (oldorg, ent->origin, 2, ent); else if (ent->model->flags & EF_ZOMGIB) - R_RocketTrail (oldorg, ent->origin, 4); + R_RocketTrail (oldorg, ent->origin, 4, ent); else if (ent->model->flags & EF_TRACER) - R_RocketTrail (oldorg, ent->origin, 3); + R_RocketTrail (oldorg, ent->origin, 3, ent); else if (ent->model->flags & EF_TRACER2) - R_RocketTrail (oldorg, ent->origin, 5); + R_RocketTrail (oldorg, ent->origin, 5, ent); else if (ent->model->flags & EF_ROCKET) { - R_RocketTrail (oldorg, ent->origin, 0); + R_RocketTrail (oldorg, ent->origin, 0, ent); dl = CL_AllocDlight (i); VectorCopy (ent->origin, dl->origin); dl->radius = 200; dl->die = cl.time + 0.01; } else if (ent->model->flags & EF_GRENADE) - R_RocketTrail (oldorg, ent->origin, 1); + R_RocketTrail (oldorg, ent->origin, 1, ent); else if (ent->model->flags & EF_TRACER3) - R_RocketTrail (oldorg, ent->origin, 6); + R_RocketTrail (oldorg, ent->origin, 6, ent); ent->forcelink = false; diff --git a/source/gl_model.c b/source/gl_model.c index d667db9..0d815ad 100644 --- a/source/gl_model.c +++ b/source/gl_model.c @@ -30,6 +30,14 @@ # include "config.h" #endif +#include + +#include "model.h" +#include "sys.h" +#include "qendian.h" +#include "quakefs.h" +#include "glquake.h" +#include "console.h" model_t *loadmodel; char loadname[32]; // for hunk tags @@ -390,7 +398,7 @@ void Mod_LoadTextures (lump_t *l) memcpy ( tx+1, mt+1, pixels); - if (!Q_strncmp(mt->name,"sky",3)) + if (!strncmp(mt->name,"sky",3)) R_InitSky (tx); else { @@ -806,7 +814,7 @@ void Mod_LoadFaces (lump_t *l) // set the drawing flags flag - if (!Q_strncmp(out->texinfo->texture->name,"sky",3)) // sky + if (!strncmp(out->texinfo->texture->name,"sky",3)) // sky { out->flags |= (SURF_DRAWSKY | SURF_DRAWTILED); #ifndef QUAKE2 @@ -815,7 +823,7 @@ void Mod_LoadFaces (lump_t *l) continue; } - if (!Q_strncmp(out->texinfo->texture->name,"*",1)) // turbulent + if (!strncmp(out->texinfo->texture->name,"*",1)) // turbulent { out->flags |= (SURF_DRAWTURB | SURF_DRAWTILED); for (i=0 ; i<2 ; i++) @@ -1258,8 +1266,8 @@ Mod_LoadAliasFrame */ void * Mod_LoadAliasFrame (void * pin, maliasframedesc_t *frame) { - trivertx_t *pframe, *pinframe; - int i, j; + trivertx_t *pinframe; + int i; daliasframe_t *pdaliasframe; pdaliasframe = (daliasframe_t *)pin; @@ -1420,7 +1428,6 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype) int i, j, k; char name[32]; int s; - byte *copy; byte *skin; byte *texels; daliasskingroup_t *pinskingroup; @@ -1499,7 +1506,7 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer) mdl_t *pinmodel; stvert_t *pinstverts; dtriangle_t *pintriangles; - int version, numframes, numskins; + int version, numframes; int size; daliasframetype_t *pframetype; daliasskintype_t *pskintype; @@ -1663,9 +1670,7 @@ void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum) { dspriteframe_t *pinframe; mspriteframe_t *pspriteframe; - int i, width, height, size, origin[2]; - unsigned short *ppixout; - byte *ppixin; + int width, height, size, origin[2]; char name[64]; pinframe = (dspriteframe_t *)pin; @@ -1676,7 +1681,7 @@ void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum) pspriteframe = Hunk_AllocName (sizeof (mspriteframe_t),loadname); - Q_memset (pspriteframe, 0, sizeof (mspriteframe_t)); + memset (pspriteframe, 0, sizeof (mspriteframe_t)); *ppframe = pspriteframe; diff --git a/source/gl_part.c b/source/gl_part.c index 112fbdc..87b5c9c 100644 --- a/source/gl_part.c +++ b/source/gl_part.c @@ -35,6 +35,7 @@ #include "vid.h" #include "sys.h" #include "mathlib.h" // needed by: protocol.h, render.h, client.h, +#include "host.h" // modelgen.h, glmodel.h #include "wad.h" #include "draw.h" @@ -678,7 +679,7 @@ R_AddFire (vec3_t start, vec3_t end, entity_t *ent) VectorSubtract (end, start, vec); len = VectorNormalize (vec); - key = ent-cl_visedicts+1; + key = ent-cl_entities+1; if (len) { diff --git a/source/gl_view.c b/source/gl_view.c index 8c9321a..eab9022 100644 --- a/source/gl_view.c +++ b/source/gl_view.c @@ -32,13 +32,12 @@ #include #include -#include "bothdefs.h" // needed by: common.h, net.h, client.h - #include "bspfile.h" // needed by: glquake.h #include "vid.h" #include "sys.h" #include "mathlib.h" // needed by: protocol.h, render.h, client.h, // modelgen.h, glmodel.h +#include "compat.h" #include "wad.h" #include "draw.h" #include "cvar.h" diff --git a/source/r_part.c b/source/r_part.c index 54abaaa..e066958 100644 --- a/source/r_part.c +++ b/source/r_part.c @@ -549,7 +549,7 @@ void R_TeleportSplash (vec3_t org) } } -void R_RocketTrail (vec3_t start, vec3_t end, int type) +void R_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent) { vec3_t vec; float len;