mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
gl1: make currententity local
This commit is contained in:
parent
2d1a090feb
commit
083cfca305
5 changed files with 75 additions and 83 deletions
|
@ -326,7 +326,7 @@ R_RecursiveLightPoint(mnode_t *node, vec3_t start, vec3_t end)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
R_LightPoint(vec3_t p, vec3_t color)
|
R_LightPoint(entity_t *currententity, vec3_t p, vec3_t color)
|
||||||
{
|
{
|
||||||
vec3_t end;
|
vec3_t end;
|
||||||
float r;
|
float r;
|
||||||
|
|
|
@ -39,8 +39,6 @@ glstate_t gl_state;
|
||||||
image_t *r_notexture; /* use for bad textures */
|
image_t *r_notexture; /* use for bad textures */
|
||||||
image_t *r_particletexture; /* little dot for particles */
|
image_t *r_particletexture; /* little dot for particles */
|
||||||
|
|
||||||
entity_t *currententity;
|
|
||||||
|
|
||||||
cplane_t frustum[4];
|
cplane_t frustum[4];
|
||||||
|
|
||||||
int r_visframecount; /* bumped when going to a new PVS */
|
int r_visframecount; /* bumped when going to a new PVS */
|
||||||
|
@ -175,7 +173,7 @@ R_RotateForEntity(entity_t *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
R_DrawSpriteModel(entity_t *e, const model_t *currentmodel)
|
R_DrawSpriteModel(entity_t *currententity, const model_t *currentmodel)
|
||||||
{
|
{
|
||||||
float alpha = 1.0F;
|
float alpha = 1.0F;
|
||||||
vec3_t point[4];
|
vec3_t point[4];
|
||||||
|
@ -187,16 +185,16 @@ R_DrawSpriteModel(entity_t *e, const model_t *currentmodel)
|
||||||
a single polygon without a surface cache */
|
a single polygon without a surface cache */
|
||||||
psprite = (dsprite_t *)currentmodel->extradata;
|
psprite = (dsprite_t *)currentmodel->extradata;
|
||||||
|
|
||||||
e->frame %= psprite->numframes;
|
currententity->frame %= psprite->numframes;
|
||||||
frame = &psprite->frames[e->frame];
|
frame = &psprite->frames[currententity->frame];
|
||||||
|
|
||||||
/* normal sprite */
|
/* normal sprite */
|
||||||
up = vup;
|
up = vup;
|
||||||
right = vright;
|
right = vright;
|
||||||
|
|
||||||
if (e->flags & RF_TRANSLUCENT)
|
if (currententity->flags & RF_TRANSLUCENT)
|
||||||
{
|
{
|
||||||
alpha = e->alpha;
|
alpha = currententity->alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alpha != 1.0F)
|
if (alpha != 1.0F)
|
||||||
|
@ -206,7 +204,7 @@ R_DrawSpriteModel(entity_t *e, const model_t *currentmodel)
|
||||||
|
|
||||||
glColor4f(1, 1, 1, alpha);
|
glColor4f(1, 1, 1, alpha);
|
||||||
|
|
||||||
R_Bind(currentmodel->skins[e->frame]->texnum);
|
R_Bind(currentmodel->skins[currententity->frame]->texnum);
|
||||||
|
|
||||||
R_TexEnv(GL_MODULATE);
|
R_TexEnv(GL_MODULATE);
|
||||||
|
|
||||||
|
@ -226,16 +224,16 @@ R_DrawSpriteModel(entity_t *e, const model_t *currentmodel)
|
||||||
1, 1
|
1, 1
|
||||||
};
|
};
|
||||||
|
|
||||||
VectorMA( e->origin, -frame->origin_y, up, point[0] );
|
VectorMA( currententity->origin, -frame->origin_y, up, point[0] );
|
||||||
VectorMA( point[0], -frame->origin_x, right, point[0] );
|
VectorMA( point[0], -frame->origin_x, right, point[0] );
|
||||||
|
|
||||||
VectorMA( e->origin, frame->height - frame->origin_y, up, point[1] );
|
VectorMA( currententity->origin, frame->height - frame->origin_y, up, point[1] );
|
||||||
VectorMA( point[1], -frame->origin_x, right, point[1] );
|
VectorMA( point[1], -frame->origin_x, right, point[1] );
|
||||||
|
|
||||||
VectorMA( e->origin, frame->height - frame->origin_y, up, point[2] );
|
VectorMA( currententity->origin, frame->height - frame->origin_y, up, point[2] );
|
||||||
VectorMA( point[2], frame->width - frame->origin_x, right, point[2] );
|
VectorMA( point[2], frame->width - frame->origin_x, right, point[2] );
|
||||||
|
|
||||||
VectorMA( e->origin, -frame->origin_y, up, point[3] );
|
VectorMA( currententity->origin, -frame->origin_y, up, point[3] );
|
||||||
VectorMA( point[3], frame->width - frame->origin_x, right, point[3] );
|
VectorMA( point[3], frame->width - frame->origin_x, right, point[3] );
|
||||||
|
|
||||||
glEnableClientState( GL_VERTEX_ARRAY );
|
glEnableClientState( GL_VERTEX_ARRAY );
|
||||||
|
@ -260,7 +258,7 @@ R_DrawSpriteModel(entity_t *e, const model_t *currentmodel)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
R_DrawNullModel(void)
|
R_DrawNullModel(entity_t *currententity)
|
||||||
{
|
{
|
||||||
vec3_t shadelight;
|
vec3_t shadelight;
|
||||||
|
|
||||||
|
@ -270,7 +268,7 @@ R_DrawNullModel(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
R_LightPoint(currententity->origin, shadelight);
|
R_LightPoint(currententity, currententity->origin, shadelight);
|
||||||
}
|
}
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
@ -329,7 +327,7 @@ R_DrawEntitiesOnList(void)
|
||||||
/* draw non-transparent first */
|
/* draw non-transparent first */
|
||||||
for (i = 0; i < r_newrefdef.num_entities; i++)
|
for (i = 0; i < r_newrefdef.num_entities; i++)
|
||||||
{
|
{
|
||||||
currententity = &r_newrefdef.entities[i];
|
entity_t *currententity = &r_newrefdef.entities[i];
|
||||||
|
|
||||||
if (currententity->flags & RF_TRANSLUCENT)
|
if (currententity->flags & RF_TRANSLUCENT)
|
||||||
{
|
{
|
||||||
|
@ -346,7 +344,7 @@ R_DrawEntitiesOnList(void)
|
||||||
|
|
||||||
if (!currentmodel)
|
if (!currentmodel)
|
||||||
{
|
{
|
||||||
R_DrawNullModel();
|
R_DrawNullModel(currententity);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,7 +373,7 @@ R_DrawEntitiesOnList(void)
|
||||||
|
|
||||||
for (i = 0; i < r_newrefdef.num_entities; i++)
|
for (i = 0; i < r_newrefdef.num_entities; i++)
|
||||||
{
|
{
|
||||||
currententity = &r_newrefdef.entities[i];
|
entity_t *currententity = &r_newrefdef.entities[i];
|
||||||
|
|
||||||
if (!(currententity->flags & RF_TRANSLUCENT))
|
if (!(currententity->flags & RF_TRANSLUCENT))
|
||||||
{
|
{
|
||||||
|
@ -392,7 +390,7 @@ R_DrawEntitiesOnList(void)
|
||||||
|
|
||||||
if (!currentmodel)
|
if (!currentmodel)
|
||||||
{
|
{
|
||||||
R_DrawNullModel();
|
R_DrawNullModel(currententity);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -951,7 +949,7 @@ R_SetGL2D(void)
|
||||||
/*
|
/*
|
||||||
* r_newrefdef must be set before the first call
|
* r_newrefdef must be set before the first call
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
R_RenderView(refdef_t *fd)
|
R_RenderView(refdef_t *fd)
|
||||||
{
|
{
|
||||||
if ((gl_state.stereo_mode != STEREO_MODE_NONE) && gl_state.camera_separation) {
|
if ((gl_state.stereo_mode != STEREO_MODE_NONE) && gl_state.camera_separation) {
|
||||||
|
@ -1072,7 +1070,7 @@ R_RenderView(refdef_t *fd)
|
||||||
|
|
||||||
if (!r_worldmodel && !(r_newrefdef.rdflags & RDF_NOWORLDMODEL))
|
if (!r_worldmodel && !(r_newrefdef.rdflags & RDF_NOWORLDMODEL))
|
||||||
{
|
{
|
||||||
ri.Sys_Error(ERR_DROP, "R_RenderView: NULL worldmodel");
|
ri.Sys_Error(ERR_DROP, "%s: NULL worldmodel", __func__);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r_speeds->value)
|
if (r_speeds->value)
|
||||||
|
@ -1149,8 +1147,8 @@ GL_GetSpecialBufferModeForStereoMode(enum stereo_modes stereo_mode) {
|
||||||
return OPENGL_SPECIAL_BUFFER_MODE_NONE;
|
return OPENGL_SPECIAL_BUFFER_MODE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
R_SetLightLevel(void)
|
R_SetLightLevel(entity_t *currententity)
|
||||||
{
|
{
|
||||||
vec3_t shadelight;
|
vec3_t shadelight;
|
||||||
|
|
||||||
|
@ -1160,7 +1158,7 @@ R_SetLightLevel(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* save off light value for server to look at */
|
/* save off light value for server to look at */
|
||||||
R_LightPoint(r_newrefdef.vieworg, shadelight);
|
R_LightPoint(currententity, r_newrefdef.vieworg, shadelight);
|
||||||
|
|
||||||
/* pick the greatest component, which should be the
|
/* pick the greatest component, which should be the
|
||||||
* same as the mono value returned by software */
|
* same as the mono value returned by software */
|
||||||
|
@ -1188,11 +1186,11 @@ R_SetLightLevel(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
RI_RenderFrame(refdef_t *fd)
|
RI_RenderFrame(refdef_t *fd)
|
||||||
{
|
{
|
||||||
R_RenderView(fd);
|
R_RenderView(fd);
|
||||||
R_SetLightLevel();
|
R_SetLightLevel (NULL);
|
||||||
R_SetGL2D();
|
R_SetGL2D();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,8 @@ float shadelight[3];
|
||||||
float *shadedots = r_avertexnormal_dots[0];
|
float *shadedots = r_avertexnormal_dots[0];
|
||||||
extern vec3_t lightspot;
|
extern vec3_t lightspot;
|
||||||
|
|
||||||
void
|
static void
|
||||||
R_LerpVerts(int nverts, dtrivertx_t *v, dtrivertx_t *ov,
|
R_LerpVerts(entity_t *currententity, int nverts, dtrivertx_t *v, dtrivertx_t *ov,
|
||||||
dtrivertx_t *verts, float *lerp, float move[3],
|
dtrivertx_t *verts, float *lerp, float move[3],
|
||||||
float frontv[3], float backv[3])
|
float frontv[3], float backv[3])
|
||||||
{
|
{
|
||||||
|
@ -83,8 +83,8 @@ R_LerpVerts(int nverts, dtrivertx_t *v, dtrivertx_t *ov,
|
||||||
/*
|
/*
|
||||||
* Interpolates between two frames and origins
|
* Interpolates between two frames and origins
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
R_DrawAliasFrameLerp(dmdl_t *paliashdr, float backlerp)
|
R_DrawAliasFrameLerp(entity_t *currententity, dmdl_t *paliashdr, float backlerp)
|
||||||
{
|
{
|
||||||
unsigned short total;
|
unsigned short total;
|
||||||
GLenum type;
|
GLenum type;
|
||||||
|
@ -152,7 +152,7 @@ R_DrawAliasFrameLerp(dmdl_t *paliashdr, float backlerp)
|
||||||
|
|
||||||
lerp = s_lerped[0];
|
lerp = s_lerped[0];
|
||||||
|
|
||||||
R_LerpVerts(paliashdr->num_xyz, v, ov, verts, lerp, move, frontv, backv);
|
R_LerpVerts(currententity, paliashdr->num_xyz, v, ov, verts, lerp, move, frontv, backv);
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
@ -250,8 +250,8 @@ R_DrawAliasFrameLerp(dmdl_t *paliashdr, float backlerp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
R_DrawAliasShadow(dmdl_t *paliashdr, int posenum)
|
R_DrawAliasShadow(entity_t *currententity, dmdl_t *paliashdr, int posenum)
|
||||||
{
|
{
|
||||||
unsigned short total;
|
unsigned short total;
|
||||||
GLenum type;
|
GLenum type;
|
||||||
|
@ -482,7 +482,7 @@ R_CullAliasModel(const model_t *currentmodel, vec3_t bbox[8], entity_t *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
R_DrawAliasModel(entity_t *e, const model_t *currentmodel)
|
R_DrawAliasModel(entity_t *currententity, const model_t *currentmodel)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
dmdl_t *paliashdr;
|
dmdl_t *paliashdr;
|
||||||
|
@ -490,15 +490,15 @@ R_DrawAliasModel(entity_t *e, const model_t *currentmodel)
|
||||||
vec3_t bbox[8];
|
vec3_t bbox[8];
|
||||||
image_t *skin;
|
image_t *skin;
|
||||||
|
|
||||||
if (!(e->flags & RF_WEAPONMODEL))
|
if (!(currententity->flags & RF_WEAPONMODEL))
|
||||||
{
|
{
|
||||||
if (R_CullAliasModel(currentmodel, bbox, e))
|
if (R_CullAliasModel(currentmodel, bbox, currententity))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e->flags & RF_WEAPONMODEL)
|
if (currententity->flags & RF_WEAPONMODEL)
|
||||||
{
|
{
|
||||||
if (gl_lefthand->value == 2)
|
if (gl_lefthand->value == 2)
|
||||||
{
|
{
|
||||||
|
@ -552,7 +552,7 @@ R_DrawAliasModel(entity_t *e, const model_t *currentmodel)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
R_LightPoint(currententity->origin, shadelight);
|
R_LightPoint(currententity, currententity->origin, shadelight);
|
||||||
|
|
||||||
/* player lighting hack for communication back to server */
|
/* player lighting hack for communication back to server */
|
||||||
if (currententity->flags & RF_WEAPONMODEL)
|
if (currententity->flags & RF_WEAPONMODEL)
|
||||||
|
@ -695,9 +695,9 @@ R_DrawAliasModel(entity_t *e, const model_t *currentmodel)
|
||||||
}
|
}
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
e->angles[PITCH] = -e->angles[PITCH];
|
currententity->angles[PITCH] = -currententity->angles[PITCH];
|
||||||
R_RotateForEntity(e);
|
R_RotateForEntity(currententity);
|
||||||
e->angles[PITCH] = -e->angles[PITCH];
|
currententity->angles[PITCH] = -currententity->angles[PITCH];
|
||||||
|
|
||||||
/* select skin */
|
/* select skin */
|
||||||
if (currententity->skin)
|
if (currententity->skin)
|
||||||
|
@ -761,7 +761,7 @@ R_DrawAliasModel(entity_t *e, const model_t *currentmodel)
|
||||||
currententity->backlerp = 0;
|
currententity->backlerp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
R_DrawAliasFrameLerp(paliashdr, currententity->backlerp);
|
R_DrawAliasFrameLerp(currententity, paliashdr, currententity->backlerp);
|
||||||
|
|
||||||
R_TexEnv(GL_REPLACE);
|
R_TexEnv(GL_REPLACE);
|
||||||
glShadeModel(GL_FLAT);
|
glShadeModel(GL_FLAT);
|
||||||
|
@ -811,13 +811,13 @@ R_DrawAliasModel(entity_t *e, const model_t *currentmodel)
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
||||||
/* don't rotate shadows on ungodly axes */
|
/* don't rotate shadows on ungodly axes */
|
||||||
glTranslatef(e->origin[0], e->origin[1], e->origin[2]);
|
glTranslatef(currententity->origin[0], currententity->origin[1], currententity->origin[2]);
|
||||||
glRotatef(e->angles[1], 0, 0, 1);
|
glRotatef(currententity->angles[1], 0, 0, 1);
|
||||||
|
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glColor4f(0, 0, 0, 0.5f);
|
glColor4f(0, 0, 0, 0.5f);
|
||||||
R_DrawAliasShadow(paliashdr, currententity->frame);
|
R_DrawAliasShadow(currententity, paliashdr, currententity->frame);
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
|
@ -46,7 +46,7 @@ void R_BuildLightMap(msurface_t *surf, byte *dest, int stride);
|
||||||
* Returns the proper texture for a given time and base texture
|
* Returns the proper texture for a given time and base texture
|
||||||
*/
|
*/
|
||||||
static image_t *
|
static image_t *
|
||||||
R_TextureAnimation(mtexinfo_t *tex)
|
R_TextureAnimation(entity_t *currententity, mtexinfo_t *tex)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ R_BlendLightmaps(const model_t *currentmodel)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
R_RenderBrushPoly(msurface_t *fa)
|
R_RenderBrushPoly(entity_t *currententity, msurface_t *fa)
|
||||||
{
|
{
|
||||||
int maps;
|
int maps;
|
||||||
image_t *image;
|
image_t *image;
|
||||||
|
@ -429,7 +429,7 @@ R_RenderBrushPoly(msurface_t *fa)
|
||||||
|
|
||||||
c_brush_polys++;
|
c_brush_polys++;
|
||||||
|
|
||||||
image = R_TextureAnimation(fa->texinfo);
|
image = R_TextureAnimation(currententity, fa->texinfo);
|
||||||
|
|
||||||
if (fa->flags & SURF_DRAWTURB)
|
if (fa->flags & SURF_DRAWTURB)
|
||||||
{
|
{
|
||||||
|
@ -605,7 +605,7 @@ R_DrawAlphaSurfaces(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
R_DrawTextureChains(void)
|
R_DrawTextureChains(entity_t *currententity)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
msurface_t *s;
|
msurface_t *s;
|
||||||
|
@ -631,7 +631,7 @@ R_DrawTextureChains(void)
|
||||||
|
|
||||||
for ( ; s; s = s->texturechain)
|
for ( ; s; s = s->texturechain)
|
||||||
{
|
{
|
||||||
R_RenderBrushPoly(s);
|
R_RenderBrushPoly(currententity, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
image->texturechain = NULL;
|
image->texturechain = NULL;
|
||||||
|
@ -641,7 +641,7 @@ R_DrawTextureChains(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
R_DrawInlineBModel(const model_t *currentmodel)
|
R_DrawInlineBModel(entity_t *currententity, const model_t *currentmodel)
|
||||||
{
|
{
|
||||||
int i, k;
|
int i, k;
|
||||||
cplane_t *pplane;
|
cplane_t *pplane;
|
||||||
|
@ -689,7 +689,7 @@ R_DrawInlineBModel(const model_t *currentmodel)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
R_RenderBrushPoly(psurf);
|
R_RenderBrushPoly(currententity, psurf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -708,7 +708,7 @@ R_DrawInlineBModel(const model_t *currentmodel)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
R_DrawBrushModel(entity_t *e, const model_t *currentmodel)
|
R_DrawBrushModel(entity_t *currententity, const model_t *currentmodel)
|
||||||
{
|
{
|
||||||
vec3_t mins, maxs;
|
vec3_t mins, maxs;
|
||||||
int i;
|
int i;
|
||||||
|
@ -719,24 +719,23 @@ R_DrawBrushModel(entity_t *e, const model_t *currentmodel)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
currententity = e;
|
|
||||||
gl_state.currenttextures[0] = gl_state.currenttextures[1] = -1;
|
gl_state.currenttextures[0] = gl_state.currenttextures[1] = -1;
|
||||||
|
|
||||||
if (e->angles[0] || e->angles[1] || e->angles[2])
|
if (currententity->angles[0] || currententity->angles[1] || currententity->angles[2])
|
||||||
{
|
{
|
||||||
rotated = true;
|
rotated = true;
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
mins[i] = e->origin[i] - currentmodel->radius;
|
mins[i] = currententity->origin[i] - currentmodel->radius;
|
||||||
maxs[i] = e->origin[i] + currentmodel->radius;
|
maxs[i] = currententity->origin[i] + currentmodel->radius;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rotated = false;
|
rotated = false;
|
||||||
VectorAdd(e->origin, currentmodel->mins, mins);
|
VectorAdd(currententity->origin, currentmodel->mins, mins);
|
||||||
VectorAdd(e->origin, currentmodel->maxs, maxs);
|
VectorAdd(currententity->origin, currentmodel->maxs, maxs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (R_CullBox(mins, maxs))
|
if (R_CullBox(mins, maxs))
|
||||||
|
@ -752,7 +751,7 @@ R_DrawBrushModel(entity_t *e, const model_t *currentmodel)
|
||||||
glColor4f(1, 1, 1, 1);
|
glColor4f(1, 1, 1, 1);
|
||||||
memset(gl_lms.lightmap_surfaces, 0, sizeof(gl_lms.lightmap_surfaces));
|
memset(gl_lms.lightmap_surfaces, 0, sizeof(gl_lms.lightmap_surfaces));
|
||||||
|
|
||||||
VectorSubtract(r_newrefdef.vieworg, e->origin, modelorg);
|
VectorSubtract(r_newrefdef.vieworg, currententity->origin, modelorg);
|
||||||
|
|
||||||
if (rotated)
|
if (rotated)
|
||||||
{
|
{
|
||||||
|
@ -760,18 +759,18 @@ R_DrawBrushModel(entity_t *e, const model_t *currentmodel)
|
||||||
vec3_t forward, right, up;
|
vec3_t forward, right, up;
|
||||||
|
|
||||||
VectorCopy(modelorg, temp);
|
VectorCopy(modelorg, temp);
|
||||||
AngleVectors(e->angles, forward, right, up);
|
AngleVectors(currententity->angles, forward, right, up);
|
||||||
modelorg[0] = DotProduct(temp, forward);
|
modelorg[0] = DotProduct(temp, forward);
|
||||||
modelorg[1] = -DotProduct(temp, right);
|
modelorg[1] = -DotProduct(temp, right);
|
||||||
modelorg[2] = DotProduct(temp, up);
|
modelorg[2] = DotProduct(temp, up);
|
||||||
}
|
}
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
e->angles[0] = -e->angles[0];
|
currententity->angles[0] = -currententity->angles[0];
|
||||||
e->angles[2] = -e->angles[2];
|
currententity->angles[2] = -currententity->angles[2];
|
||||||
R_RotateForEntity(e);
|
R_RotateForEntity(currententity);
|
||||||
e->angles[0] = -e->angles[0];
|
currententity->angles[0] = -currententity->angles[0];
|
||||||
e->angles[2] = -e->angles[2];
|
currententity->angles[2] = -currententity->angles[2];
|
||||||
|
|
||||||
R_TexEnv(GL_REPLACE);
|
R_TexEnv(GL_REPLACE);
|
||||||
|
|
||||||
|
@ -784,7 +783,7 @@ R_DrawBrushModel(entity_t *e, const model_t *currentmodel)
|
||||||
R_TexEnv(GL_MODULATE);
|
R_TexEnv(GL_MODULATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
R_DrawInlineBModel(currentmodel);
|
R_DrawInlineBModel(currententity, currentmodel);
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
|
@ -795,7 +794,7 @@ R_DrawBrushModel(entity_t *e, const model_t *currentmodel)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
R_RecursiveWorldNode(mnode_t *node)
|
R_RecursiveWorldNode(entity_t *currententity, mnode_t *node)
|
||||||
{
|
{
|
||||||
int c, side, sidebit;
|
int c, side, sidebit;
|
||||||
cplane_t *plane;
|
cplane_t *plane;
|
||||||
|
@ -881,7 +880,7 @@ R_RecursiveWorldNode(mnode_t *node)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* recurse down the children, front side first */
|
/* recurse down the children, front side first */
|
||||||
R_RecursiveWorldNode(node->children[side]);
|
R_RecursiveWorldNode(currententity, node->children[side]);
|
||||||
|
|
||||||
/* draw stuff */
|
/* draw stuff */
|
||||||
for (c = node->numsurfaces,
|
for (c = node->numsurfaces,
|
||||||
|
@ -908,19 +907,19 @@ R_RecursiveWorldNode(mnode_t *node)
|
||||||
/* add to the translucent chain */
|
/* add to the translucent chain */
|
||||||
surf->texturechain = r_alpha_surfaces;
|
surf->texturechain = r_alpha_surfaces;
|
||||||
r_alpha_surfaces = surf;
|
r_alpha_surfaces = surf;
|
||||||
r_alpha_surfaces->texinfo->image = R_TextureAnimation(surf->texinfo);
|
r_alpha_surfaces->texinfo->image = R_TextureAnimation(currententity, surf->texinfo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* the polygon is visible, so add it to the texture sorted chain */
|
/* the polygon is visible, so add it to the texture sorted chain */
|
||||||
image = R_TextureAnimation(surf->texinfo);
|
image = R_TextureAnimation(currententity, surf->texinfo);
|
||||||
surf->texturechain = image->texturechain;
|
surf->texturechain = image->texturechain;
|
||||||
image->texturechain = surf;
|
image->texturechain = surf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* recurse down the back side */
|
/* recurse down the back side */
|
||||||
R_RecursiveWorldNode(node->children[!side]);
|
R_RecursiveWorldNode(currententity, node->children[!side]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -946,7 +945,6 @@ R_DrawWorld(void)
|
||||||
/* auto cycle the world frame for texture animation */
|
/* auto cycle the world frame for texture animation */
|
||||||
memset(&ent, 0, sizeof(ent));
|
memset(&ent, 0, sizeof(ent));
|
||||||
ent.frame = (int)(r_newrefdef.time * 2);
|
ent.frame = (int)(r_newrefdef.time * 2);
|
||||||
currententity = &ent;
|
|
||||||
|
|
||||||
gl_state.currenttextures[0] = gl_state.currenttextures[1] = -1;
|
gl_state.currenttextures[0] = gl_state.currenttextures[1] = -1;
|
||||||
|
|
||||||
|
@ -954,13 +952,11 @@ R_DrawWorld(void)
|
||||||
memset(gl_lms.lightmap_surfaces, 0, sizeof(gl_lms.lightmap_surfaces));
|
memset(gl_lms.lightmap_surfaces, 0, sizeof(gl_lms.lightmap_surfaces));
|
||||||
|
|
||||||
R_ClearSkyBox();
|
R_ClearSkyBox();
|
||||||
R_RecursiveWorldNode(r_worldmodel->nodes);
|
R_RecursiveWorldNode(&ent, r_worldmodel->nodes);
|
||||||
R_DrawTextureChains();
|
R_DrawTextureChains(&ent);
|
||||||
R_BlendLightmaps(currentmodel);
|
R_BlendLightmaps(currentmodel);
|
||||||
R_DrawSkyBox();
|
R_DrawSkyBox();
|
||||||
R_DrawTriangleOutlines();
|
R_DrawTriangleOutlines();
|
||||||
|
|
||||||
currententity = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -145,7 +145,6 @@ extern int numgltextures;
|
||||||
|
|
||||||
extern image_t *r_notexture;
|
extern image_t *r_notexture;
|
||||||
extern image_t *r_particletexture;
|
extern image_t *r_particletexture;
|
||||||
extern entity_t *currententity;
|
|
||||||
extern int r_visframecount;
|
extern int r_visframecount;
|
||||||
extern int r_framecount;
|
extern int r_framecount;
|
||||||
extern cplane_t frustum[4];
|
extern cplane_t frustum[4];
|
||||||
|
@ -243,7 +242,7 @@ void R_Bind(int texnum);
|
||||||
|
|
||||||
void R_TexEnv(GLenum value);
|
void R_TexEnv(GLenum value);
|
||||||
|
|
||||||
void R_LightPoint(vec3_t p, vec3_t color);
|
void R_LightPoint(entity_t *currententity, vec3_t p, vec3_t color);
|
||||||
void R_PushDlights(void);
|
void R_PushDlights(void);
|
||||||
|
|
||||||
extern model_t *r_worldmodel;
|
extern model_t *r_worldmodel;
|
||||||
|
@ -252,11 +251,10 @@ extern int registration_sequence;
|
||||||
|
|
||||||
void V_AddBlend(float r, float g, float b, float a, float *v_blend);
|
void V_AddBlend(float r, float g, float b, float a, float *v_blend);
|
||||||
|
|
||||||
void R_RenderView(refdef_t *fd);
|
|
||||||
void R_ScreenShot(void);
|
void R_ScreenShot(void);
|
||||||
void R_DrawAliasModel(entity_t *e, const model_t *currentmodel);
|
void R_DrawAliasModel(entity_t *currententity, const model_t *currentmodel);
|
||||||
void R_DrawBrushModel(entity_t *e, const model_t *currentmodel);
|
void R_DrawBrushModel(entity_t *currententity, const model_t *currentmodel);
|
||||||
void R_DrawSpriteModel(entity_t *e, const model_t *currentmodel);
|
void R_DrawSpriteModel(entity_t *currententity, const model_t *currentmodel);
|
||||||
void R_DrawBeam(entity_t *e);
|
void R_DrawBeam(entity_t *e);
|
||||||
void R_DrawWorld(void);
|
void R_DrawWorld(void);
|
||||||
void R_RenderDlights(void);
|
void R_RenderDlights(void);
|
||||||
|
|
Loading…
Reference in a new issue