diff --git a/engine/client/cl_pred.c b/engine/client/cl_pred.c index 43c10c069..64df80b74 100644 --- a/engine/client/cl_pred.c +++ b/engine/client/cl_pred.c @@ -146,9 +146,7 @@ void CLQ2_ClipMoveToEntities ( vec3_t start, vec3_t mins, vec3_t maxs, vec3_t en if (tr->allsolid) return; - trace = CM_TransformedBoxTrace (cmodel, start, end, - mins, maxs, MASK_PLAYERSOLID, - ent->origin, angles); + World_TransformedTrace (cmodel, 0, 0, start, end, mins, maxs, false, &trace, ent->origin, angles, MASK_PLAYERSOLID); if (trace.allsolid || trace.startsolid || trace.fraction < tr->fraction) { diff --git a/engine/client/m_mp3.c b/engine/client/m_mp3.c index a0669fcb7..e8fff6e5b 100644 --- a/engine/client/m_mp3.c +++ b/engine/client/m_mp3.c @@ -1862,7 +1862,10 @@ qboolean Media_Roq_DecodeFrame (cin_t *cin, qboolean nosound) 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; diff --git a/engine/client/renderer.c b/engine/client/renderer.c index 01e29a92f..0adf99c95 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -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. + Skin_FlushAll(); + P_Shutdown(); Mod_Shutdown(false); @@ -976,7 +978,6 @@ void R_ShutdownRenderer(qboolean videotoo) COM_FlushTempoaryPacks(); - Skin_FlushAll(); W_Shutdown(); if (h2playertranslations) BZ_Free(h2playertranslations); @@ -1376,7 +1377,8 @@ TRACE(("dbg: R_ApplyRenderer: Surf_NewMap\n")); Surf_NewMap(); TRACE(("dbg: R_ApplyRenderer: efrags\n")); - Skin_FlushAll(); +// Skin_FlushAll(); + Skin_FlushPlayers(); #ifdef CSQC_DAT CSQC_RendererRestarted(); @@ -1936,10 +1938,10 @@ qbyte *R_MarkLeaves_Q3 (void) // mark everything for (i=0,leaf=cl.worldmodel->leafs ; inumleafs ; i++, leaf++) { - if (!leaf->nummarksurfaces) - { - continue; - } +// if (!leaf->nummarksurfaces) +// { +// continue; +// } #if 1 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 ; inumleafs ; i++, leaf++) { cluster = leaf->cluster; - if (cluster == -1 || !leaf->nummarksurfaces) + if (cluster == -1)// || !leaf->nummarksurfaces) { continue; } diff --git a/engine/client/skin.c b/engine/client/skin.c index 4d0f56656..d766d87d3 100644 --- a/engine/client/skin.c +++ b/engine/client/skin.c @@ -519,13 +519,14 @@ void Skin_NextDownload (void) void Skin_FlushPlayers(void) { //wipe the skin info int i; - for (i = 0; i < cl.allocated_client_slots; i++) + for (i = 0; i < MAX_CLIENTS; i++) cl.players[i].qwskin = NULL; for (i = 0; i < cl.allocated_client_slots; i++) CL_NewTranslation(i); } +//call on shutdown. does not refresh any skins at all. void Skin_FlushAll(void) { //wipe the skin info int i; @@ -538,9 +539,10 @@ void Skin_FlushAll(void) } numskins = 0; for (i = 0; i < MAX_CLIENTS; i++) + { + cl.players[i].qwskin = NULL; cl.players[i].lastskin = NULL; - - Skin_FlushPlayers(); + } } /* diff --git a/engine/common/gl_q2bsp.c b/engine/common/gl_q2bsp.c index 861a4ccc4..b14bbf1b6 100644 --- a/engine/common/gl_q2bsp.c +++ b/engine/common/gl_q2bsp.c @@ -5777,6 +5777,13 @@ static qboolean BM_NativeTrace(model_t *model, int forcehullnum, int frame, vec3 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; VectorCopy (start, trace_start); VectorCopy (end, trace_end); @@ -5788,16 +5795,17 @@ static qboolean BM_NativeTrace(model_t *model, int forcehullnum, int frame, vec3 if (trace_nearfraction == 1) { - trace_trace.fraction = 1; - VectorCopy (trace_end, trace_trace.endpos); + trace->fraction = 1; + VectorCopy (trace_end, trace->endpos); } else { if (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++) - 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; } diff --git a/engine/server/sv_ents.c b/engine/server/sv_ents.c index 7b166052f..61e277da4 100644 --- a/engine/server/sv_ents.c +++ b/engine/server/sv_ents.c @@ -75,7 +75,7 @@ unsigned int SV_Q2BSP_FatPVS (model_t *mod, vec3_t org, qbyte *resultbuf, unsig if (count < 1) Sys_Error ("SV_Q2FatPVS: count < 1"); - if (sv.world.worldmodel->fromgame == fg_quake3) + if (mod->fromgame == fg_quake3) longs = CM_ClusterSize(mod); else longs = (CM_NumClusters(mod)+7)/8; diff --git a/engine/server/svq3_game.c b/engine/server/svq3_game.c index 2b2024a08..0c320c7f7 100644 --- a/engine/server/svq3_game.c +++ b/engine/server/svq3_game.c @@ -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); if (!mod) 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 { @@ -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); else 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) { @@ -557,13 +557,12 @@ static int SVQ3_PointContents(vec3_t pos, int entnum) mod = Q3G_GetCModel(es->s.modelindex); if (!mod) 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 { 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); -// mod->funcs.Trace(mod, 0, 0, start, end, mins, maxs, &tr); + World_TransformedTrace(mod, 0, 0, pos, pos, vec3_origin, vec3_origin, false, &tr, es->r.currentOrigin, vec3_origin, 0xffffffff); } cont |= tr.contents; diff --git a/engine/server/world.c b/engine/server/world.c index 3ffd93aeb..5fd3d9117 100644 --- a/engine/server/world.c +++ b/engine/server/world.c @@ -406,7 +406,7 @@ void Q2BSP_FindTouchedLeafs(model_t *model, struct pvscache_s *ent, float *mins, if (area != nullarea) { // doors may legally straggle two areas, // but nothing should ever need more than that - if (ent->areanum && ent->areanum != area) + if (ent->areanum != nullarea && ent->areanum != area) ent->areanum2 = area; else ent->areanum = area; @@ -1029,14 +1029,10 @@ qboolean World_TransformedTrace (struct model_s *model, int hulloverride, int fr VectorAdd (trace->endpos, origin, trace->endpos); } - else + else if (hitcontentsmask & FTECONTENTS_BODY) { hull_t *hull = &box_hull; - memset (trace, 0, sizeof(trace_t)); - trace->fraction = 1; - trace->allsolid = true; - VectorSubtract (start, origin, start_l); VectorSubtract (end, origin, end_l); 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 if (touch->svflags & SVF_MONSTER) - trace = CM_TransformedBoxTrace (model, clip->start, clip->end, - clip->mins2, clip->maxs2, clip->hitcontentsmask, - touch->s.origin, angles); + World_TransformedTrace (model, 0, 0, clip->start, clip->end, clip->mins2, clip->maxs2, false, &trace, touch->s.origin, angles, clip->hitcontentsmask); else - trace = CM_TransformedBoxTrace (model, clip->start, clip->end, - clip->mins, clip->maxs, clip->hitcontentsmask, - touch->s.origin, angles); + World_TransformedTrace (model, 0, 0, clip->start, clip->end, clip->mins, clip->maxs, false, &trace, touch->s.origin, angles, clip->hitcontentsmask); if (trace.allsolid || trace.startsolid || 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); // 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 ); // clip to entities