1
0
Fork 0
forked from fte/fteqw

fix some q2+q3 gamecode bugs.

fix q3bsp optimisation that was making too much invisible.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4840 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2015-02-09 03:37:41 +00:00
parent 8d81ed4a49
commit 02ab57490e
8 changed files with 41 additions and 36 deletions

View file

@ -146,9 +146,7 @@ void CLQ2_ClipMoveToEntities ( vec3_t start, vec3_t mins, vec3_t maxs, vec3_t en
if (tr->allsolid) if (tr->allsolid)
return; return;
trace = CM_TransformedBoxTrace (cmodel, start, end, World_TransformedTrace (cmodel, 0, 0, start, end, mins, maxs, false, &trace, ent->origin, angles, MASK_PLAYERSOLID);
mins, maxs, MASK_PLAYERSOLID,
ent->origin, angles);
if (trace.allsolid || trace.startsolid || trace.fraction < tr->fraction) if (trace.allsolid || trace.startsolid || trace.fraction < tr->fraction)
{ {

View file

@ -1862,7 +1862,10 @@ qboolean Media_Roq_DecodeFrame (cin_t *cin, qboolean nosound)
qbyte *framedata; qbyte *framedata;
cin->filmpercentage = cin->roq.roqfilm->frame_num / cin->roq.roqfilm->num_frames; if (cin->roq.roqfilm->num_frames)
cin->filmpercentage = cin->roq.roqfilm->frame_num / cin->roq.roqfilm->num_frames;
else
cin->filmpercentage = 0;
cin->filmlasttime = (float)realtime; cin->filmlasttime = (float)realtime;

View file

@ -951,6 +951,8 @@ void R_ShutdownRenderer(qboolean videotoo)
CL_AllowIndependantSendCmd(false); //FIXME: figure out exactly which parts are going to affect the model loading. CL_AllowIndependantSendCmd(false); //FIXME: figure out exactly which parts are going to affect the model loading.
Skin_FlushAll();
P_Shutdown(); P_Shutdown();
Mod_Shutdown(false); Mod_Shutdown(false);
@ -976,7 +978,6 @@ void R_ShutdownRenderer(qboolean videotoo)
COM_FlushTempoaryPacks(); COM_FlushTempoaryPacks();
Skin_FlushAll();
W_Shutdown(); W_Shutdown();
if (h2playertranslations) if (h2playertranslations)
BZ_Free(h2playertranslations); BZ_Free(h2playertranslations);
@ -1376,7 +1377,8 @@ TRACE(("dbg: R_ApplyRenderer: Surf_NewMap\n"));
Surf_NewMap(); Surf_NewMap();
TRACE(("dbg: R_ApplyRenderer: efrags\n")); TRACE(("dbg: R_ApplyRenderer: efrags\n"));
Skin_FlushAll(); // Skin_FlushAll();
Skin_FlushPlayers();
#ifdef CSQC_DAT #ifdef CSQC_DAT
CSQC_RendererRestarted(); CSQC_RendererRestarted();
@ -1936,10 +1938,10 @@ qbyte *R_MarkLeaves_Q3 (void)
// mark everything // mark everything
for (i=0,leaf=cl.worldmodel->leafs ; i<cl.worldmodel->numleafs ; i++, leaf++) for (i=0,leaf=cl.worldmodel->leafs ; i<cl.worldmodel->numleafs ; i++, leaf++)
{ {
if (!leaf->nummarksurfaces) // if (!leaf->nummarksurfaces)
{ // {
continue; // continue;
} // }
#if 1 #if 1
for (node = (mnode_t*)leaf; node; node = node->parent) for (node = (mnode_t*)leaf; node; node = node->parent)
@ -1961,7 +1963,7 @@ qbyte *R_MarkLeaves_Q3 (void)
for (i=0,leaf=cl.worldmodel->leafs ; i<cl.worldmodel->numleafs ; i++, leaf++) for (i=0,leaf=cl.worldmodel->leafs ; i<cl.worldmodel->numleafs ; i++, leaf++)
{ {
cluster = leaf->cluster; cluster = leaf->cluster;
if (cluster == -1 || !leaf->nummarksurfaces) if (cluster == -1)// || !leaf->nummarksurfaces)
{ {
continue; continue;
} }

View file

@ -519,13 +519,14 @@ void Skin_NextDownload (void)
void Skin_FlushPlayers(void) void Skin_FlushPlayers(void)
{ //wipe the skin info { //wipe the skin info
int i; int i;
for (i = 0; i < cl.allocated_client_slots; i++) for (i = 0; i < MAX_CLIENTS; i++)
cl.players[i].qwskin = NULL; cl.players[i].qwskin = NULL;
for (i = 0; i < cl.allocated_client_slots; i++) for (i = 0; i < cl.allocated_client_slots; i++)
CL_NewTranslation(i); CL_NewTranslation(i);
} }
//call on shutdown. does not refresh any skins at all.
void Skin_FlushAll(void) void Skin_FlushAll(void)
{ //wipe the skin info { //wipe the skin info
int i; int i;
@ -538,9 +539,10 @@ void Skin_FlushAll(void)
} }
numskins = 0; numskins = 0;
for (i = 0; i < MAX_CLIENTS; i++) for (i = 0; i < MAX_CLIENTS; i++)
{
cl.players[i].qwskin = NULL;
cl.players[i].lastskin = NULL; cl.players[i].lastskin = NULL;
}
Skin_FlushPlayers();
} }
/* /*

View file

@ -5777,6 +5777,13 @@ static qboolean BM_NativeTrace(model_t *model, int forcehullnum, int frame, vec3
if (contents & FTECONTENTS_BODY) if (contents & FTECONTENTS_BODY)
{ {
if (trace_mins[0] == 0 && trace_mins[1] == 0 && trace_mins[2] == 0 && trace_maxs[0] == 0 && trace_maxs[1] == 0 && trace_maxs[2] == 0)
trace_shape = shape_ispoint;
else if (capsule)
trace_shape = shape_iscapsule;
else
trace_shape = shape_isbox;
trace_contents = contents; trace_contents = contents;
VectorCopy (start, trace_start); VectorCopy (start, trace_start);
VectorCopy (end, trace_end); VectorCopy (end, trace_end);
@ -5788,16 +5795,17 @@ static qboolean BM_NativeTrace(model_t *model, int forcehullnum, int frame, vec3
if (trace_nearfraction == 1) if (trace_nearfraction == 1)
{ {
trace_trace.fraction = 1; trace->fraction = 1;
VectorCopy (trace_end, trace_trace.endpos); VectorCopy (trace_end, trace->endpos);
} }
else else
{ {
if (trace_nearfraction<0) if (trace_nearfraction<0)
trace_nearfraction=0; trace_nearfraction=0;
trace_trace.fraction = trace_nearfraction; trace->fraction = trace_nearfraction;
trace->truefraction = trace_truefraction;
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
trace_trace.endpos[i] = trace_start[i] + trace_trace.fraction * (trace_end[i] - trace_start[i]); trace->endpos[i] = trace_start[i] + trace->fraction * (trace_end[i] - trace_start[i]);
} }
return trace->fraction != 1; return trace->fraction != 1;
} }

View file

@ -75,7 +75,7 @@ unsigned int SV_Q2BSP_FatPVS (model_t *mod, vec3_t org, qbyte *resultbuf, unsig
if (count < 1) if (count < 1)
Sys_Error ("SV_Q2FatPVS: count < 1"); Sys_Error ("SV_Q2FatPVS: count < 1");
if (sv.world.worldmodel->fromgame == fg_quake3) if (mod->fromgame == fg_quake3)
longs = CM_ClusterSize(mod); longs = CM_ClusterSize(mod);
else else
longs = (CM_NumClusters(mod)+7)/8; longs = (CM_NumClusters(mod)+7)/8;

View file

@ -481,7 +481,7 @@ static void SVQ3_Trace(q3trace_t *result, vec3_t start, vec3_t mins, vec3_t maxs
mod = Q3G_GetCModel(es->s.modelindex); mod = Q3G_GetCModel(es->s.modelindex);
if (!mod) if (!mod)
continue; continue;
tr = CM_TransformedBoxTrace(mod, start, end, mins, maxs, contentmask, es->r.currentOrigin, vec3_origin); World_TransformedTrace(mod, 0, 0, start, end, mins, maxs, capsule, &tr, es->r.currentOrigin, es->r.currentAngles, contentmask);
} }
else else
{ {
@ -489,7 +489,7 @@ static void SVQ3_Trace(q3trace_t *result, vec3_t start, vec3_t mins, vec3_t maxs
mod = CM_TempBoxModel(es->r.mins, es->r.maxs); mod = CM_TempBoxModel(es->r.mins, es->r.maxs);
else else
mod = CM_TempBoxModel(es->r.mins, es->r.maxs); mod = CM_TempBoxModel(es->r.mins, es->r.maxs);
tr = CM_TransformedBoxTrace(mod, start, end, mins, maxs, contentmask, es->r.currentOrigin, es->r.currentAngles); World_TransformedTrace(mod, 0, 0, start, end, mins, maxs, capsule, &tr, es->r.currentOrigin, vec3_origin, contentmask);
} }
if (tr.fraction < result->fraction) if (tr.fraction < result->fraction)
{ {
@ -557,13 +557,12 @@ static int SVQ3_PointContents(vec3_t pos, int entnum)
mod = Q3G_GetCModel(es->s.modelindex); mod = Q3G_GetCModel(es->s.modelindex);
if (!mod) if (!mod)
continue; continue;
tr = CM_TransformedBoxTrace(mod, pos, pos, vec3_origin, vec3_origin, 0xffffffff, es->r.currentOrigin, vec3_origin); World_TransformedTrace(mod, 0, 0, pos, pos, vec3_origin, vec3_origin, false, &tr, es->r.currentOrigin, es->r.currentAngles, 0xffffffff);
} }
else else
{ {
mod = CM_TempBoxModel(es->r.mins, es->r.maxs); mod = CM_TempBoxModel(es->r.mins, es->r.maxs);
tr = CM_TransformedBoxTrace(mod, pos, pos, vec3_origin, vec3_origin, 0xffffffff, es->r.currentOrigin, es->r.currentAngles); World_TransformedTrace(mod, 0, 0, pos, pos, vec3_origin, vec3_origin, false, &tr, es->r.currentOrigin, vec3_origin, 0xffffffff);
// mod->funcs.Trace(mod, 0, 0, start, end, mins, maxs, &tr);
} }
cont |= tr.contents; cont |= tr.contents;

View file

@ -406,7 +406,7 @@ void Q2BSP_FindTouchedLeafs(model_t *model, struct pvscache_s *ent, float *mins,
if (area != nullarea) if (area != nullarea)
{ // doors may legally straggle two areas, { // doors may legally straggle two areas,
// but nothing should ever need more than that // but nothing should ever need more than that
if (ent->areanum && ent->areanum != area) if (ent->areanum != nullarea && ent->areanum != area)
ent->areanum2 = area; ent->areanum2 = area;
else else
ent->areanum = area; ent->areanum = area;
@ -1029,14 +1029,10 @@ qboolean World_TransformedTrace (struct model_s *model, int hulloverride, int fr
VectorAdd (trace->endpos, origin, trace->endpos); VectorAdd (trace->endpos, origin, trace->endpos);
} }
else else if (hitcontentsmask & FTECONTENTS_BODY)
{ {
hull_t *hull = &box_hull; hull_t *hull = &box_hull;
memset (trace, 0, sizeof(trace_t));
trace->fraction = 1;
trace->allsolid = true;
VectorSubtract (start, origin, start_l); VectorSubtract (start, origin, start_l);
VectorSubtract (end, origin, end_l); VectorSubtract (end, origin, end_l);
VectorCopy (end_l, trace->endpos); VectorCopy (end_l, trace->endpos);
@ -1383,13 +1379,9 @@ void WorldQ2_ClipMoveToEntities (world_t *w, moveclip_t *clip )
angles = vec3_origin; // boxes don't rotate angles = vec3_origin; // boxes don't rotate
if (touch->svflags & SVF_MONSTER) if (touch->svflags & SVF_MONSTER)
trace = CM_TransformedBoxTrace (model, clip->start, clip->end, World_TransformedTrace (model, 0, 0, clip->start, clip->end, clip->mins2, clip->maxs2, false, &trace, touch->s.origin, angles, clip->hitcontentsmask);
clip->mins2, clip->maxs2, clip->hitcontentsmask,
touch->s.origin, angles);
else else
trace = CM_TransformedBoxTrace (model, clip->start, clip->end, World_TransformedTrace (model, 0, 0, clip->start, clip->end, clip->mins, clip->maxs, false, &trace, touch->s.origin, angles, clip->hitcontentsmask);
clip->mins, clip->maxs, clip->hitcontentsmask,
touch->s.origin, angles);
if (trace.allsolid || trace.startsolid || if (trace.allsolid || trace.startsolid ||
trace.fraction < clip->trace.fraction) trace.fraction < clip->trace.fraction)
@ -2066,6 +2058,7 @@ trace_t WorldQ2_Move (world_t *w, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t
VectorCopy (maxs, clip.maxs2); VectorCopy (maxs, clip.maxs2);
// create the bounding box of the entire move // create the bounding box of the entire move
//FIXME: should we use clip.trace.endpos here?
World_MoveBounds ( start, clip.mins2, clip.maxs2, end, clip.boxmins, clip.boxmaxs ); World_MoveBounds ( start, clip.mins2, clip.maxs2, end, clip.boxmins, clip.boxmaxs );
// clip to entities // clip to entities