mirror of
https://github.com/libretro/libretro-tyrquake.git
synced 2024-11-23 08:00:17 +00:00
Merge branch 'master' of git://disenchant.net/tyrquake
This commit is contained in:
commit
f9a1271e81
36
Makefile
36
Makefile
@ -1258,11 +1258,39 @@ $(DIST_DIR)/tyrquake-$(TYR_VERSION_NUM)-win32.zip: $(DIST_FILES_WIN32)
|
|||||||
$(call do_zip,$(DIST_DIR)/win32)
|
$(call do_zip,$(DIST_DIR)/win32)
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
# Source tarball creation
|
||||||
|
|
||||||
.PHONY: bundles snapshot
|
quiet_cmd_git_archive = ' GIT-ARCV $@'
|
||||||
|
cmd_git_archive = \
|
||||||
|
git archive --format=tar --prefix=tyrutils-$(TYR_VERSION_NUM)/ HEAD \
|
||||||
|
> $(@D)/.$(@F).tmp && \
|
||||||
|
mv $(@D)/.$(@F).tmp $@
|
||||||
|
|
||||||
|
define do_git_archive
|
||||||
|
$(do_mkdir)
|
||||||
|
@echo $(if $(quiet),$(quiet_cmd_git_archive),"$(cmd_git_archive)");
|
||||||
|
@$(cmd_git_archive)
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(DIST_DIR)/tyrquake-$(TYR_VERSION_NUM).tar:
|
||||||
|
$(do_git_archive)
|
||||||
|
|
||||||
|
quiet_cmd_gzip = ' GZIP $@'
|
||||||
|
cmd_gzip = gzip -S .gz $<
|
||||||
|
|
||||||
|
define do_gzip
|
||||||
|
$(do_mkdir)
|
||||||
|
@echo $($(quiet)cmd_gzip)
|
||||||
|
@$(cmd_gzip)
|
||||||
|
endef
|
||||||
|
|
||||||
|
%.gz: %
|
||||||
|
$(do_gzip)
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.PHONY: bundles tarball snapshot
|
||||||
|
|
||||||
#
|
|
||||||
# To test, do 'make bundles' or 'make snapshot'
|
|
||||||
#
|
|
||||||
bundles: $(ALL_BUNDLE_FILES)
|
bundles: $(ALL_BUNDLE_FILES)
|
||||||
snapshot: $(SNAPSHOT_TARGET)
|
snapshot: $(SNAPSHOT_TARGET)
|
||||||
|
tarball: $(DIST_DIR)/tyrquake-$(TYR_VERSION_NUM).tar.gz
|
||||||
|
@ -901,8 +901,13 @@ CL_SetSolidEntities(physent_stack_t *pestack)
|
|||||||
physent_t *physent;
|
physent_t *physent;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
physent = pestack->physents;
|
if (!cl.worldmodel) {
|
||||||
|
/* FIXME - Shouldn't be getting called without a world? */
|
||||||
|
pestack->numphysent = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
physent = pestack->physents;
|
||||||
physent->brushmodel = ConstBrushModel(&cl.worldmodel->model);
|
physent->brushmodel = ConstBrushModel(&cl.worldmodel->model);
|
||||||
VectorCopy(vec3_origin, physent->origin);
|
VectorCopy(vec3_origin, physent->origin);
|
||||||
physent++;
|
physent++;
|
||||||
|
@ -266,7 +266,7 @@ static mplane_t *lightplane;
|
|||||||
vec3_t lightspot;
|
vec3_t lightspot;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
RecursiveLightPoint(mnode_t *node, vec3_t start, vec3_t end)
|
RecursiveLightPoint(const mnode_t *node, const vec3_t start, const vec3_t end)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
float front, back, frac;
|
float front, back, frac;
|
||||||
@ -366,7 +366,7 @@ RecursiveLightPoint(mnode_t *node, vec3_t start, vec3_t end)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
R_LightPoint(vec3_t p)
|
R_LightPoint(const vec3_t point)
|
||||||
{
|
{
|
||||||
vec3_t end;
|
vec3_t end;
|
||||||
int r;
|
int r;
|
||||||
@ -374,11 +374,11 @@ R_LightPoint(vec3_t p)
|
|||||||
if (!cl.worldmodel->lightdata)
|
if (!cl.worldmodel->lightdata)
|
||||||
return 255;
|
return 255;
|
||||||
|
|
||||||
end[0] = p[0];
|
end[0] = point[0];
|
||||||
end[1] = p[1];
|
end[1] = point[1];
|
||||||
end[2] = p[2] - (8192 + 2); /* Max distance + error margin */
|
end[2] = point[2] - (8192 + 2); /* Max distance + error margin */
|
||||||
|
|
||||||
r = RecursiveLightPoint(cl.worldmodel->nodes, p, end);
|
r = RecursiveLightPoint(cl.worldmodel->nodes, point, end);
|
||||||
|
|
||||||
if (r == -1)
|
if (r == -1)
|
||||||
r = 0;
|
r = 0;
|
||||||
|
@ -420,86 +420,88 @@ GL_AliasDrawModel
|
|||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
GL_AliasDrawModel(const entity_t *e, float blend)
|
GL_AliasDrawModel(const entity_t *entity, float blend)
|
||||||
{
|
{
|
||||||
float l;
|
aliashdr_t *aliashdr;
|
||||||
aliashdr_t *pahdr;
|
const trivertx_t *vertbase, *verts1;
|
||||||
trivertx_t *vertbase, *verts1;
|
const int *order;
|
||||||
int *order;
|
float light;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
lastposenum = e->currentpose;
|
lastposenum = entity->currentpose;
|
||||||
|
|
||||||
pahdr = Mod_Extradata(e->model);
|
aliashdr = Mod_Extradata(entity->model);
|
||||||
vertbase = (trivertx_t *)((byte *)pahdr + pahdr->posedata);
|
vertbase = (trivertx_t *)((byte *)aliashdr + aliashdr->posedata);
|
||||||
verts1 = vertbase + e->currentpose * pahdr->numverts;
|
verts1 = vertbase + entity->currentpose * aliashdr->numverts;
|
||||||
order = (int *)((byte *)pahdr + GL_Aliashdr(pahdr)->commands);
|
order = (int *)((byte *)aliashdr + GL_Aliashdr(aliashdr)->commands);
|
||||||
|
|
||||||
#ifdef NQ_HACK
|
#ifdef NQ_HACK
|
||||||
if (r_lerpmodels.value && blend != 1.0f) {
|
if (r_lerpmodels.value && blend != 1.0f) {
|
||||||
trivertx_t *light;
|
const trivertx_t *lightvert;
|
||||||
trivertx_t *verts0 = vertbase + e->previouspose * pahdr->numverts;
|
const trivertx_t *verts0;
|
||||||
float blend0 = 1.0f - blend;
|
const float blend0 = 1.0f - blend;
|
||||||
light = (blend < 0.5f) ? verts0 : verts1;
|
|
||||||
|
verts0 = vertbase + entity->previouspose * aliashdr->numverts;
|
||||||
|
lightvert = (blend < 0.5f) ? verts0 : verts1;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
// get the vertex count and primitive type
|
/* get the vertex count and primitive type */
|
||||||
count = *order++;
|
count = *order++;
|
||||||
if (!count)
|
if (!count)
|
||||||
break; // done
|
break;
|
||||||
if (count < 0) {
|
if (count < 0) {
|
||||||
count = -count;
|
count = -count;
|
||||||
glBegin(GL_TRIANGLE_FAN);
|
glBegin(GL_TRIANGLE_FAN);
|
||||||
} else
|
} else {
|
||||||
glBegin(GL_TRIANGLE_STRIP);
|
glBegin(GL_TRIANGLE_STRIP);
|
||||||
|
}
|
||||||
|
|
||||||
do {
|
while (count--) {
|
||||||
vec3_t glv;
|
vec3_t glvertex;
|
||||||
|
|
||||||
// texture coordinates come from the draw list
|
/* texture coordinates come from the draw list */
|
||||||
glTexCoord2f(((float *)order)[0], ((float *)order)[1]);
|
glTexCoord2f(((float *)order)[0], ((float *)order)[1]);
|
||||||
order += 2;
|
order += 2;
|
||||||
|
|
||||||
// normals and vertexes come from the frame list
|
/* normals and vertexes come from the frame list */
|
||||||
if (r_fullbright.value) {
|
if (r_fullbright.value) {
|
||||||
glColor3f(255.0f, 255.0f, 255.0f);
|
glColor3f(255.0f, 255.0f, 255.0f);
|
||||||
} else {
|
} else {
|
||||||
l = shadedots[light->lightnormalindex] * shadelight;
|
light = shadedots[lightvert->lightnormalindex] * shadelight;
|
||||||
glColor3f(l, l, l);
|
glColor3f(light, light, light);
|
||||||
}
|
}
|
||||||
glv[0] = verts0->v[0] * blend0 + verts1->v[0] * blend;
|
glvertex[0] = verts0->v[0] * blend0 + verts1->v[0] * blend;
|
||||||
glv[1] = verts0->v[1] * blend0 + verts1->v[1] * blend;
|
glvertex[1] = verts0->v[1] * blend0 + verts1->v[1] * blend;
|
||||||
glv[2] = verts0->v[2] * blend0 + verts1->v[2] * blend;
|
glvertex[2] = verts0->v[2] * blend0 + verts1->v[2] * blend;
|
||||||
glVertex3f(glv[0], glv[1], glv[2]);
|
glVertex3f(glvertex[0], glvertex[1], glvertex[2]);
|
||||||
verts0++;
|
verts0++;
|
||||||
verts1++;
|
verts1++;
|
||||||
light++;
|
light++;
|
||||||
} while (--count);
|
}
|
||||||
|
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
while (1) {
|
while (1) {
|
||||||
// get the vertex count and primitive type
|
/* get the vertex count and primitive type */
|
||||||
count = *order++;
|
count = *order++;
|
||||||
if (!count)
|
if (!count)
|
||||||
break; // done
|
break;
|
||||||
if (count < 0) {
|
if (count < 0) {
|
||||||
count = -count;
|
count = -count;
|
||||||
glBegin(GL_TRIANGLE_FAN);
|
glBegin(GL_TRIANGLE_FAN);
|
||||||
} else
|
} else {
|
||||||
glBegin(GL_TRIANGLE_STRIP);
|
glBegin(GL_TRIANGLE_STRIP);
|
||||||
|
}
|
||||||
do {
|
do {
|
||||||
// texture coordinates come from the draw list
|
/* texture coordinates come from the draw list */
|
||||||
glTexCoord2f(((float *)order)[0], ((float *)order)[1]);
|
glTexCoord2f(((float *)order)[0], ((float *)order)[1]);
|
||||||
order += 2;
|
order += 2;
|
||||||
|
|
||||||
// normals and vertexes come from the frame list
|
/* normals and vertexes come from the frame list */
|
||||||
l = shadedots[verts1->lightnormalindex] * shadelight;
|
light = shadedots[verts1->lightnormalindex] * shadelight;
|
||||||
glColor3f(l, l, l);
|
glColor3f(light, light, light);
|
||||||
glVertex3f(verts1->v[0], verts1->v[1], verts1->v[2]);
|
glVertex3f(verts1->v[0], verts1->v[1], verts1->v[2]);
|
||||||
verts1++;
|
verts1++;
|
||||||
} while (--count);
|
} while (--count);
|
||||||
@ -510,11 +512,11 @@ GL_AliasDrawModel(const entity_t *e, float blend)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
GL_DrawAliasShadow
|
GL_AliasDrawShadow
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
GL_DrawAliasShadow(const entity_t *e, aliashdr_t *paliashdr, int posenum)
|
GL_AliasDrawShadow(const entity_t *entity, aliashdr_t *paliashdr, int posenum)
|
||||||
{
|
{
|
||||||
trivertx_t *verts;
|
trivertx_t *verts;
|
||||||
int *order;
|
int *order;
|
||||||
@ -522,7 +524,7 @@ GL_DrawAliasShadow(const entity_t *e, aliashdr_t *paliashdr, int posenum)
|
|||||||
float height, lheight;
|
float height, lheight;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
lheight = e->origin[2] - lightspot[2];
|
lheight = entity->origin[2] - lightspot[2];
|
||||||
height = -lheight + 1.0;
|
height = -lheight + 1.0;
|
||||||
|
|
||||||
verts = (trivertx_t *)((byte *)paliashdr + paliashdr->posedata);
|
verts = (trivertx_t *)((byte *)paliashdr + paliashdr->posedata);
|
||||||
@ -576,31 +578,31 @@ R_AliasSetupSkin
|
|||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
R_AliasSetupSkin(const entity_t *e, aliashdr_t *pahdr)
|
R_AliasSetupSkin(const entity_t *entity, aliashdr_t *aliashdr)
|
||||||
{
|
{
|
||||||
int skinnum;
|
const maliasskindesc_t *skindesc;
|
||||||
int frame, numframes;
|
const float *intervals;
|
||||||
maliasskindesc_t *pskindesc;
|
int skinnum, numframes, frame;
|
||||||
float *intervals;
|
|
||||||
GLuint *glt;
|
GLuint *glt;
|
||||||
|
|
||||||
skinnum = e->skinnum;
|
skinnum = entity->skinnum;
|
||||||
if ((skinnum >= pahdr->numskins) || (skinnum < 0)) {
|
if ((skinnum >= aliashdr->numskins) || (skinnum < 0)) {
|
||||||
Con_DPrintf("%s: no such skin # %d\n", __func__, skinnum);
|
Con_DPrintf("%s: no such skin # %d\n", __func__, skinnum);
|
||||||
skinnum = 0;
|
skinnum = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pskindesc = ((maliasskindesc_t *)((byte *)pahdr + pahdr->skindesc));
|
skindesc = (maliasskindesc_t *)((byte *)aliashdr + aliashdr->skindesc);
|
||||||
pskindesc += skinnum;
|
skindesc += skinnum;
|
||||||
frame = pskindesc->firstframe;
|
frame = skindesc->firstframe;
|
||||||
numframes = pskindesc->numframes;
|
numframes = skindesc->numframes;
|
||||||
|
|
||||||
if (numframes > 1) {
|
if (numframes > 1) {
|
||||||
intervals = (float *)((byte *)pahdr + pahdr->skinintervals) + frame;
|
const float frametime = cl.time + entity->syncbase;
|
||||||
frame += Mod_FindInterval(intervals, numframes, cl.time + e->syncbase);
|
intervals = (float *)((byte *)aliashdr + aliashdr->skinintervals);
|
||||||
|
frame += Mod_FindInterval(intervals + frame, numframes, frametime);
|
||||||
}
|
}
|
||||||
|
|
||||||
glt = (GLuint *)((byte *)pahdr + pahdr->skindata);
|
glt = (GLuint *)((byte *)aliashdr + aliashdr->skindata);
|
||||||
GL_Bind(glt[frame]);
|
GL_Bind(glt[frame]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -611,174 +613,170 @@ R_AliasSetupFrame
|
|||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
R_AliasSetupFrame(entity_t *e, aliashdr_t *pahdr)
|
R_AliasSetupFrame(entity_t *entity, aliashdr_t *aliashdr)
|
||||||
{
|
{
|
||||||
int frame, pose, numposes;
|
int framenum, pose, numposes;
|
||||||
float *intervals;
|
const float *intervals;
|
||||||
|
|
||||||
frame = e->frame;
|
framenum = entity->frame;
|
||||||
if ((frame >= pahdr->numframes) || (frame < 0)) {
|
if ((framenum >= aliashdr->numframes) || (framenum < 0)) {
|
||||||
Con_DPrintf("%s: no such frame %d\n", __func__, frame);
|
Con_DPrintf("%s: no such frame %d\n", __func__, framenum);
|
||||||
frame = 0;
|
framenum = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pose = pahdr->frames[frame].firstpose;
|
pose = aliashdr->frames[framenum].firstpose;
|
||||||
numposes = pahdr->frames[frame].numposes;
|
numposes = aliashdr->frames[framenum].numposes;
|
||||||
|
|
||||||
if (numposes > 1) {
|
if (numposes > 1) {
|
||||||
intervals = (float *)((byte *)pahdr + pahdr->poseintervals) + pose;
|
const float frametime = cl.time + entity->syncbase;
|
||||||
pose += Mod_FindInterval(intervals, numposes, cl.time + e->syncbase);
|
intervals = (float *)((byte *)aliashdr + aliashdr->poseintervals);
|
||||||
|
pose += Mod_FindInterval(intervals + pose, numposes, frametime);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NQ_HACK
|
#ifdef NQ_HACK
|
||||||
if (r_lerpmodels.value) {
|
if (r_lerpmodels.value) {
|
||||||
|
const maliasframedesc_t *currentframe, *previousframe;
|
||||||
float delta, time, blend;
|
float delta, time, blend;
|
||||||
|
|
||||||
/* A few quick sanity checks to abort lerping */
|
/* A few quick sanity checks to abort lerping */
|
||||||
if (e->currentframetime < e->previousframetime)
|
if (entity->currentframetime < entity->previousframetime)
|
||||||
goto nolerp;
|
goto nolerp;
|
||||||
if (e->currentframetime - e->previousframetime > 1.0f)
|
if (entity->currentframetime - entity->previousframetime > 1.0f)
|
||||||
goto nolerp;
|
goto nolerp;
|
||||||
/* FIXME - hack to skip the viewent (weapon) */
|
/* FIXME - hack to skip the viewent (weapon) */
|
||||||
if (e == &cl.viewent)
|
if (entity == &cl.viewent)
|
||||||
goto nolerp;
|
goto nolerp;
|
||||||
|
|
||||||
|
currentframe = &aliashdr->frames[entity->currentframe];
|
||||||
if (numposes > 1) {
|
if (numposes > 1) {
|
||||||
/* FIXME - merge with Mod_FindInterval? */
|
/* FIXME - merge with Mod_FindInterval? */
|
||||||
int i;
|
int i;
|
||||||
float fullinterval, targettime;
|
float fullinterval, targettime;
|
||||||
fullinterval = intervals[numposes - 1];
|
fullinterval = intervals[numposes - 1];
|
||||||
time = cl.time + e->syncbase;
|
time = cl.time + entity->syncbase;
|
||||||
targettime = time - (int)(time / fullinterval) * fullinterval;
|
targettime = time - (int)(time / fullinterval) * fullinterval;
|
||||||
for (i = 0; i < numposes - 1; i++)
|
for (i = 0; i < numposes - 1; i++)
|
||||||
if (intervals[i] > targettime)
|
if (intervals[i] > targettime)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
e->currentpose = pahdr->frames[e->currentframe].firstpose + i;
|
entity->currentpose = currentframe->firstpose + i;
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
e->previouspose = pahdr->frames[e->currentframe].firstpose;
|
entity->previouspose = currentframe->firstpose + numposes - 1;
|
||||||
e->previouspose += numposes - 1;
|
|
||||||
time = targettime;
|
time = targettime;
|
||||||
delta = intervals[0];
|
delta = intervals[0];
|
||||||
} else {
|
} else {
|
||||||
e->previouspose = e->currentpose - 1;
|
entity->previouspose = entity->currentpose - 1;
|
||||||
time = targettime - intervals[i - 1];
|
time = targettime - intervals[i - 1];
|
||||||
delta = intervals[i] - intervals[i - 1];
|
delta = intervals[i] - intervals[i - 1];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
e->currentpose = pahdr->frames[e->currentframe].firstpose;
|
previousframe = &aliashdr->frames[entity->previousframe];
|
||||||
e->previouspose = pahdr->frames[e->previousframe].firstpose;
|
entity->currentpose = currentframe->firstpose;
|
||||||
time = cl.time - e->currentframetime;
|
entity->previouspose = previousframe->firstpose;
|
||||||
delta = e->currentframetime - e->previousframetime;
|
time = cl.time - entity->currentframetime;
|
||||||
|
delta = entity->currentframetime - entity->previousframetime;
|
||||||
}
|
}
|
||||||
blend = qclamp(time / delta, 0.0f, 1.0f);
|
blend = qclamp(time / delta, 0.0f, 1.0f);
|
||||||
|
|
||||||
GL_AliasDrawModel(e, blend);
|
GL_AliasDrawModel(entity, blend);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
nolerp:
|
nolerp:
|
||||||
#endif
|
#endif
|
||||||
e->currentpose = pose;
|
entity->currentpose = pose;
|
||||||
e->previouspose = pose;
|
entity->previouspose = pose;
|
||||||
|
|
||||||
GL_AliasDrawModel(e, 1.0f);
|
GL_AliasDrawModel(entity, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
R_AliasDrawModel
|
R_AliasCalcLerp
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
R_AliasDrawModel(entity_t *e)
|
R_AliasCalcLerp(entity_t *entity, vec3_t origin, vec3_t angles)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
int lnum, shadequant;
|
|
||||||
vec3_t dist;
|
|
||||||
float add;
|
|
||||||
model_t *clmodel;
|
|
||||||
vec3_t mins, maxs;
|
|
||||||
aliashdr_t *paliashdr;
|
|
||||||
float an;
|
|
||||||
vec3_t lerp_origin, lerp_angles;
|
|
||||||
|
|
||||||
#ifdef NQ_HACK
|
#ifdef NQ_HACK
|
||||||
|
/* FIXME - hack to skip viewent (weapon) lerp */
|
||||||
|
if (entity == &cl.viewent)
|
||||||
|
goto nolerp_origin;
|
||||||
|
|
||||||
/* Origin LERP */
|
/* Origin LERP */
|
||||||
if (r_lerpmove.value) {
|
if (r_lerpmove.value) {
|
||||||
float delta = e->currentorigintime - e->previousorigintime;
|
float delta, frac;
|
||||||
float frac = qclamp((cl.time - e->currentorigintime) / delta, 0.0, 1.0);
|
|
||||||
vec3_t lerpvec;
|
vec3_t lerpvec;
|
||||||
|
|
||||||
/* FIXME - hack to skip the viewent (weapon) */
|
delta = entity->currentorigintime - entity->previousorigintime;
|
||||||
if (e == &cl.viewent)
|
frac = qclamp((cl.time - entity->currentorigintime) / delta, 0.0, 1.0);
|
||||||
goto nolerp_origin;
|
VectorSubtract(entity->currentorigin, entity->previousorigin, lerpvec);
|
||||||
|
VectorMA(entity->previousorigin, frac, lerpvec, origin);
|
||||||
VectorSubtract(e->currentorigin, e->previousorigin, lerpvec);
|
|
||||||
VectorMA(e->previousorigin, frac, lerpvec, lerp_origin);
|
|
||||||
} else {
|
} else {
|
||||||
nolerp_origin:
|
nolerp_origin:
|
||||||
VectorCopy(e->origin, lerp_origin);
|
VectorCopy(entity->origin, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME - hack to skip the viewent (weapon) */
|
||||||
|
if (entity == &cl.viewent)
|
||||||
|
goto nolerp_angles;
|
||||||
|
|
||||||
/* Angles lerp */
|
/* Angles lerp */
|
||||||
if (r_lerpmove.value && e->previousanglestime != e->currentanglestime) {
|
if (entity->previousanglestime == entity->currentanglestime)
|
||||||
float delta = e->currentanglestime - e->previousanglestime;
|
goto nolerp_angles;
|
||||||
float frac = qclamp((cl.time - e->currentanglestime) / delta, 0.0, 1.0);
|
if (r_lerpmove.value) {
|
||||||
|
float delta, frac;
|
||||||
vec3_t lerpvec;
|
vec3_t lerpvec;
|
||||||
|
int i;
|
||||||
|
|
||||||
/* FIXME - hack to skip the viewent (weapon) */
|
delta = entity->currentanglestime - entity->previousanglestime;
|
||||||
if (e == &cl.viewent)
|
frac = qclamp((cl.time - entity->currentanglestime) / delta, 0.0, 1.0);
|
||||||
goto nolerp_angles;
|
VectorSubtract(entity->currentangles, entity->previousangles, lerpvec);
|
||||||
|
|
||||||
VectorSubtract(e->currentangles, e->previousangles, lerpvec);
|
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
if (lerpvec[i] > 180.0f)
|
if (lerpvec[i] > 180.0f)
|
||||||
lerpvec[i] -= 360.0f;
|
lerpvec[i] -= 360.0f;
|
||||||
else if (lerpvec[i] < -180.0f)
|
else if (lerpvec[i] < -180.0f)
|
||||||
lerpvec[i] += 360.0f;
|
lerpvec[i] += 360.0f;
|
||||||
}
|
}
|
||||||
VectorMA(e->previousangles, frac, lerpvec, lerp_angles);
|
VectorMA(entity->previousangles, frac, lerpvec, angles);
|
||||||
//angles[PITCH] = -angles[PITCH];
|
//angles[PITCH] = -angles[PITCH];
|
||||||
} else {
|
} else {
|
||||||
nolerp_angles:
|
nolerp_angles:
|
||||||
VectorCopy(e->angles, lerp_angles);
|
VectorCopy(entity->angles, angles);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef QW_HACK
|
#ifdef QW_HACK
|
||||||
VectorCopy(e->origin, lerp_origin);
|
VectorCopy(entity->origin, origin);
|
||||||
VectorCopy(e->angles, lerp_angles);
|
VectorCopy(entity->angles, angles);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
clmodel = e->model;
|
static void
|
||||||
|
R_AliasCalcLight(const entity_t *entity,
|
||||||
|
const vec3_t origin, const vec3_t angles)
|
||||||
|
{
|
||||||
|
const model_t *model = entity->model;
|
||||||
|
const dlight_t *dlight;
|
||||||
|
int i, shadequant;
|
||||||
|
float angle;
|
||||||
|
|
||||||
VectorAdd(lerp_origin, clmodel->mins, mins);
|
ambientlight = shadelight = R_LightPoint(origin);
|
||||||
VectorAdd(lerp_origin, clmodel->maxs, maxs);
|
|
||||||
|
|
||||||
if (R_CullBox(mins, maxs))
|
/* always give the viewmodel some light */
|
||||||
return;
|
if (entity == &cl.viewent && ambientlight < 24)
|
||||||
|
|
||||||
VectorCopy(lerp_origin, r_entorigin);
|
|
||||||
|
|
||||||
//
|
|
||||||
// get lighting information
|
|
||||||
//
|
|
||||||
ambientlight = shadelight = R_LightPoint(lerp_origin);
|
|
||||||
|
|
||||||
// allways give the gun some light
|
|
||||||
if (e == &cl.viewent && ambientlight < 24)
|
|
||||||
ambientlight = shadelight = 24;
|
ambientlight = shadelight = 24;
|
||||||
|
|
||||||
for (lnum = 0; lnum < MAX_DLIGHTS; lnum++) {
|
dlight = cl_dlights;
|
||||||
if (cl_dlights[lnum].die >= cl.time) {
|
for (i = 0; i < MAX_DLIGHTS; i++, dlight++) {
|
||||||
VectorSubtract(lerp_origin, cl_dlights[lnum].origin, dist);
|
if (dlight->die >= cl.time) {
|
||||||
add = cl_dlights[lnum].radius - Length(dist);
|
vec3_t lightvec;
|
||||||
|
vec_t add;
|
||||||
|
|
||||||
|
VectorSubtract(origin, dlight->origin, lightvec);
|
||||||
|
add = dlight->radius - Length(lightvec);
|
||||||
if (add > 0) {
|
if (add > 0) {
|
||||||
ambientlight += add;
|
ambientlight += add;
|
||||||
/* ZOID: models should be affected by dlights as well */
|
|
||||||
shadelight += add;
|
shadelight += add;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -792,81 +790,104 @@ R_AliasDrawModel(entity_t *e)
|
|||||||
|
|
||||||
// ZOID: never allow players to go totally black
|
// ZOID: never allow players to go totally black
|
||||||
#ifdef NQ_HACK
|
#ifdef NQ_HACK
|
||||||
if (CL_PlayerEntity(e)) {
|
if (CL_PlayerEntity(entity)) {
|
||||||
#endif
|
#endif
|
||||||
#ifdef QW_HACK
|
#ifdef QW_HACK
|
||||||
if (!strcmp(clmodel->name, "progs/player.mdl")) {
|
if (!strcmp(model->name, "progs/player.mdl")) {
|
||||||
#endif
|
#endif
|
||||||
if (ambientlight < 8)
|
if (ambientlight < 8)
|
||||||
ambientlight = shadelight = 8;
|
ambientlight = shadelight = 8;
|
||||||
} else if (!strcmp(clmodel->name, "progs/flame.mdl")
|
} else if (!strcmp(model->name, "progs/flame.mdl")
|
||||||
|| !strcmp(clmodel->name, "progs/flame2.mdl")) {
|
|| !strcmp(model->name, "progs/flame2.mdl")) {
|
||||||
// HACK HACK HACK -- no fullbright colors, so make torches full light
|
// HACK HACK HACK -- no fullbright colors, so make torches full light
|
||||||
ambientlight = shadelight = 256;
|
ambientlight = shadelight = 256;
|
||||||
}
|
}
|
||||||
|
|
||||||
shadequant = (int)(lerp_angles[1] * (SHADEDOT_QUANT / 360.0));
|
shadequant = (int)(angles[1] * (SHADEDOT_QUANT / 360.0));
|
||||||
shadedots = r_avertexnormal_dots[shadequant & (SHADEDOT_QUANT - 1)];
|
shadedots = r_avertexnormal_dots[shadequant & (SHADEDOT_QUANT - 1)];
|
||||||
shadelight /= 200.0;
|
shadelight /= 200.0;
|
||||||
|
|
||||||
an = lerp_angles[1] / 180 * M_PI;
|
angle = angles[1] / 180 * M_PI;
|
||||||
shadevector[0] = cos(-an);
|
shadevector[0] = cos(-angle);
|
||||||
shadevector[1] = sin(-an);
|
shadevector[1] = sin(-angle);
|
||||||
shadevector[2] = 1;
|
shadevector[2] = 1;
|
||||||
VectorNormalize(shadevector);
|
VectorNormalize(shadevector);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// locate the proper data
|
=================
|
||||||
//
|
R_AliasDrawModel
|
||||||
paliashdr = Mod_Extradata(e->model);
|
=================
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
R_AliasDrawModel(entity_t *entity)
|
||||||
|
{
|
||||||
|
const model_t *model = entity->model;
|
||||||
|
vec3_t origin, angles, mins, maxs;
|
||||||
|
aliashdr_t *aliashdr;
|
||||||
|
|
||||||
c_alias_polys += paliashdr->numtris;
|
/* Calculate position and cull if out of view */
|
||||||
|
R_AliasCalcLerp(entity, origin, angles);
|
||||||
|
VectorAdd(origin, model->mins, mins);
|
||||||
|
VectorAdd(origin, model->maxs, maxs);
|
||||||
|
if (R_CullBox(mins, maxs))
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Calculate lighting at the lerp origin */
|
||||||
|
R_AliasCalcLight(entity, origin, angles);
|
||||||
|
|
||||||
|
/* locate the proper data */
|
||||||
|
aliashdr = Mod_Extradata(entity->model);
|
||||||
|
|
||||||
|
/* draw all the triangles */
|
||||||
|
c_alias_polys += aliashdr->numtris;
|
||||||
|
VectorCopy(origin, r_entorigin);
|
||||||
|
|
||||||
//
|
|
||||||
// draw all the triangles
|
|
||||||
//
|
|
||||||
GL_DisableMultitexture();
|
GL_DisableMultitexture();
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
R_RotateForEntity(lerp_origin, lerp_angles);
|
R_RotateForEntity(origin, angles);
|
||||||
|
|
||||||
|
/* double size of eyes, since they are really hard to see in gl */
|
||||||
#ifdef NQ_HACK
|
#ifdef NQ_HACK
|
||||||
if (!strcmp(clmodel->name, "progs/eyes.mdl") && gl_doubleeyes.value) {
|
if (!strcmp(model->name, "progs/eyes.mdl") && gl_doubleeyes.value) {
|
||||||
#endif
|
#endif
|
||||||
#ifdef QW_HACK
|
#ifdef QW_HACK
|
||||||
if (!strcmp(clmodel->name, "progs/eyes.mdl")) {
|
if (!strcmp(model->name, "progs/eyes.mdl")) {
|
||||||
#endif
|
#endif
|
||||||
glTranslatef(paliashdr->scale_origin[0], paliashdr->scale_origin[1],
|
glTranslatef(aliashdr->scale_origin[0], aliashdr->scale_origin[1],
|
||||||
paliashdr->scale_origin[2] - (22 + 8));
|
aliashdr->scale_origin[2] - (22 + 8));
|
||||||
// double size of eyes, since they are really hard to see in gl
|
glScalef(aliashdr->scale[0] * 2, aliashdr->scale[1] * 2,
|
||||||
glScalef(paliashdr->scale[0] * 2, paliashdr->scale[1] * 2,
|
aliashdr->scale[2] * 2);
|
||||||
paliashdr->scale[2] * 2);
|
|
||||||
} else {
|
} else {
|
||||||
glTranslatef(paliashdr->scale_origin[0], paliashdr->scale_origin[1],
|
glTranslatef(aliashdr->scale_origin[0], aliashdr->scale_origin[1],
|
||||||
paliashdr->scale_origin[2]);
|
aliashdr->scale_origin[2]);
|
||||||
glScalef(paliashdr->scale[0], paliashdr->scale[1],
|
glScalef(aliashdr->scale[0], aliashdr->scale[1],
|
||||||
paliashdr->scale[2]);
|
aliashdr->scale[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
R_AliasSetupSkin(e, paliashdr);
|
R_AliasSetupSkin(entity, aliashdr);
|
||||||
|
|
||||||
// we can't dynamically colormap textures, so they are cached
|
/*
|
||||||
// seperately for the players. Heads are just uncolored.
|
* We can't dynamically colormap textures, so they are cached
|
||||||
|
* seperately for the players. Heads are just uncolored.
|
||||||
|
*/
|
||||||
#ifdef NQ_HACK
|
#ifdef NQ_HACK
|
||||||
if (e->colormap != vid.colormap && !gl_nocolors.value) {
|
if (entity->colormap != vid.colormap && !gl_nocolors.value) {
|
||||||
i = CL_PlayerEntity(e);
|
const int playernum = CL_PlayerEntity(entity);
|
||||||
if (i)
|
if (playernum)
|
||||||
GL_Bind(playertextures[i - 1]);
|
GL_Bind(playertextures[playernum - 1]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef QW_HACK
|
#ifdef QW_HACK
|
||||||
if (e->scoreboard && !gl_nocolors.value) {
|
if (entity->scoreboard && !gl_nocolors.value) {
|
||||||
i = e->scoreboard - cl.players;
|
const int playernum = entity->scoreboard - cl.players;
|
||||||
if (!e->scoreboard->skin) {
|
if (!entity->scoreboard->skin) {
|
||||||
Skin_Find(e->scoreboard);
|
Skin_Find(entity->scoreboard);
|
||||||
R_TranslatePlayerSkin(i);
|
R_TranslatePlayerSkin(playernum);
|
||||||
}
|
}
|
||||||
if (i >= 0 && i < MAX_CLIENTS)
|
if (playernum >= 0 && playernum < MAX_CLIENTS)
|
||||||
GL_Bind(playertextures[i]);
|
GL_Bind(playertextures[playernum]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -877,7 +898,7 @@ R_AliasDrawModel(entity_t *e)
|
|||||||
if (gl_affinemodels.value)
|
if (gl_affinemodels.value)
|
||||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
|
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
|
||||||
|
|
||||||
R_AliasSetupFrame(e, paliashdr);
|
R_AliasSetupFrame(entity, aliashdr);
|
||||||
|
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||||
|
|
||||||
@ -889,11 +910,11 @@ R_AliasDrawModel(entity_t *e)
|
|||||||
|
|
||||||
if (r_shadows.value) {
|
if (r_shadows.value) {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
R_RotateForEntity(lerp_origin, lerp_angles);
|
R_RotateForEntity(origin, angles);
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glColor4f(0, 0, 0, 0.5);
|
glColor4f(0, 0, 0, 0.5);
|
||||||
GL_DrawAliasShadow(e, paliashdr, lastposenum);
|
GL_AliasDrawShadow(entity, aliashdr, lastposenum);
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glColor4f(1, 1, 1, 1);
|
glColor4f(1, 1, 1, 1);
|
||||||
|
@ -156,6 +156,10 @@ keyname_t keynames[] = {
|
|||||||
|
|
||||||
{"PAUSE", K_PAUSE},
|
{"PAUSE", K_PAUSE},
|
||||||
|
|
||||||
|
{"SHIFT", K_SHIFT},
|
||||||
|
{"CTRL", K_CTRL},
|
||||||
|
{"ALT", K_ALT},
|
||||||
|
|
||||||
{"MWHEELUP", K_MWHEELUP},
|
{"MWHEELUP", K_MWHEELUP},
|
||||||
{"MWHEELDOWN", K_MWHEELDOWN},
|
{"MWHEELDOWN", K_MWHEELDOWN},
|
||||||
|
|
||||||
|
@ -378,7 +378,15 @@ Mod_FindName(const char *name)
|
|||||||
model = brushmodel ? &brushmodel->model : NULL;
|
model = brushmodel ? &brushmodel->model : NULL;
|
||||||
|
|
||||||
#ifndef SERVERONLY
|
#ifndef SERVERONLY
|
||||||
/* Otherwise, search the alias cache */
|
/* Search the sprite and alias lists */
|
||||||
|
if (!model) {
|
||||||
|
model = loaded_sprites;
|
||||||
|
while (model) {
|
||||||
|
if (!strcmp(model->name, name))
|
||||||
|
break;
|
||||||
|
model = model->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!model)
|
if (!model)
|
||||||
model = Mod_FindAliasName(name);
|
model = Mod_FindAliasName(name);
|
||||||
#endif
|
#endif
|
||||||
|
@ -134,7 +134,7 @@ LIGHT SAMPLING
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
RecursiveLightPoint(mnode_t *node, vec3_t start, vec3_t end)
|
RecursiveLightPoint(const mnode_t *node, const vec3_t start, const vec3_t end)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
float front, back, frac;
|
float front, back, frac;
|
||||||
@ -242,7 +242,7 @@ RecursiveLightPoint(mnode_t *node, vec3_t start, vec3_t end)
|
|||||||
* a func_plat or similar...
|
* a func_plat or similar...
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
R_LightPoint(vec3_t p)
|
R_LightPoint(const vec3_t point)
|
||||||
{
|
{
|
||||||
vec3_t end;
|
vec3_t end;
|
||||||
int r;
|
int r;
|
||||||
@ -250,11 +250,11 @@ R_LightPoint(vec3_t p)
|
|||||||
if (!cl.worldmodel->lightdata)
|
if (!cl.worldmodel->lightdata)
|
||||||
return 255;
|
return 255;
|
||||||
|
|
||||||
end[0] = p[0];
|
end[0] = point[0];
|
||||||
end[1] = p[1];
|
end[1] = point[1];
|
||||||
end[2] = p[2] - (8192 + 2); /* Max distance + error margin */
|
end[2] = point[2] - (8192 + 2); /* Max distance + error margin */
|
||||||
|
|
||||||
r = RecursiveLightPoint(cl.worldmodel->nodes, p, end);
|
r = RecursiveLightPoint(cl.worldmodel->nodes, point, end);
|
||||||
|
|
||||||
if (r == -1)
|
if (r == -1)
|
||||||
r = 0;
|
r = 0;
|
||||||
|
@ -1372,6 +1372,8 @@ SCR_UpdateScreen(void)
|
|||||||
|
|
||||||
if (scr_drawdialog) {
|
if (scr_drawdialog) {
|
||||||
Sbar_Draw();
|
Sbar_Draw();
|
||||||
|
if (con_forcedup)
|
||||||
|
Draw_ConsoleBackground(vid.height);
|
||||||
Draw_FadeScreen();
|
Draw_FadeScreen();
|
||||||
SCR_DrawNotifyString();
|
SCR_DrawNotifyString();
|
||||||
scr_copyeverything = true;
|
scr_copyeverything = true;
|
||||||
|
@ -269,7 +269,7 @@ const model_loader_t *R_ModelLoader(void);
|
|||||||
void R_MarkLights(dlight_t *light, int bit, mnode_t *node);
|
void R_MarkLights(dlight_t *light, int bit, mnode_t *node);
|
||||||
void R_AnimateLight(void);
|
void R_AnimateLight(void);
|
||||||
void R_RenderDlights(void);
|
void R_RenderDlights(void);
|
||||||
int R_LightPoint(vec3_t p);
|
int R_LightPoint(const vec3_t point);
|
||||||
|
|
||||||
//
|
//
|
||||||
// gl_refrag.c
|
// gl_refrag.c
|
||||||
|
@ -204,8 +204,6 @@ typedef enum {
|
|||||||
K_MOUSE3,
|
K_MOUSE3,
|
||||||
K_MOUSE4,
|
K_MOUSE4,
|
||||||
K_MOUSE5,
|
K_MOUSE5,
|
||||||
#define K_MWHEELUP K_MOUSE4
|
|
||||||
#define K_MWHEELDOWN K_MOUSE5
|
|
||||||
K_MOUSE6,
|
K_MOUSE6,
|
||||||
K_MOUSE7,
|
K_MOUSE7,
|
||||||
K_MOUSE8,
|
K_MOUSE8,
|
||||||
@ -257,6 +255,15 @@ typedef enum {
|
|||||||
K_LAST
|
K_LAST
|
||||||
} knum_t;
|
} knum_t;
|
||||||
|
|
||||||
|
/* Backward compatibility */
|
||||||
|
|
||||||
|
#define K_SHIFT K_LSHIFT
|
||||||
|
#define K_CTRL K_LCTRL
|
||||||
|
#define K_ALT K_LALT
|
||||||
|
|
||||||
|
#define K_MWHEELUP K_MOUSE4
|
||||||
|
#define K_MWHEELDOWN K_MOUSE5
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
key_game,
|
key_game,
|
||||||
key_console,
|
key_console,
|
||||||
|
@ -259,7 +259,7 @@ void R_PrintAliasStats(void);
|
|||||||
void R_PrintTimes(void);
|
void R_PrintTimes(void);
|
||||||
void R_PrintDSpeeds(void);
|
void R_PrintDSpeeds(void);
|
||||||
void R_AnimateLight(void);
|
void R_AnimateLight(void);
|
||||||
int R_LightPoint(vec3_t p);
|
int R_LightPoint(const vec3_t point);
|
||||||
void R_SetupFrame(void);
|
void R_SetupFrame(void);
|
||||||
void R_cshift_f(void);
|
void R_cshift_f(void);
|
||||||
void R_EmitEdge(mvertex_t *pv0, mvertex_t *pv1);
|
void R_EmitEdge(mvertex_t *pv0, mvertex_t *pv1);
|
||||||
|
Loading…
Reference in New Issue
Block a user