R_IssueEntityDefCallback() fix bounds check

in the "Work around false positive GCC -W(maybe-)uninitialized warnings"
commit I changed that code.. but my change made it nonsensical,
of course we must get oldBounds before calling the callback which
changes the bounds, otherwise comparing the "oldbounds" with the
current bounds just compares them with themselves..
This commit is contained in:
Daniel Gibson 2023-03-28 19:18:55 +02:00
parent 6f35ce045d
commit 03fccc6220

View file

@ -1062,6 +1062,12 @@ R_IssueEntityDefCallback
*/
bool R_IssueEntityDefCallback( idRenderEntityLocal *def ) {
bool update;
idBounds oldBounds;
const bool checkBounds = r_checkBounds.GetBool();
if ( checkBounds ) {
oldBounds = def->referenceBounds;
}
def->archived = false; // will need to be written to the demo file
tr.pc.c_entityDefCallbacks++;
@ -1076,10 +1082,7 @@ bool R_IssueEntityDefCallback( idRenderEntityLocal *def ) {
return false;
}
// DG: moved some code down here so all the boundchecking stuff is in the same if (because why not)
// (also works around yet another GCC maybe-uninitialized false positive)
if ( r_checkBounds.GetBool() ) {
idBounds oldBounds = def->referenceBounds;
if ( checkBounds ) {
if ( oldBounds[0][0] > def->referenceBounds[0][0] + CHECK_BOUNDS_EPSILON ||
oldBounds[0][1] > def->referenceBounds[0][1] + CHECK_BOUNDS_EPSILON ||
oldBounds[0][2] > def->referenceBounds[0][2] + CHECK_BOUNDS_EPSILON ||