From 2c6435377ac7b53d8bfae5e32705b7d75602fc42 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Tue, 20 Sep 2022 10:36:32 +1000 Subject: [PATCH] - Duke: Change clamping of ceilz/floorz in draw code. * Also repair potential bug between actor's cz/fz vs. player's truecz/truecz introduced in "- Duke: Floatify `displayrooms()` and flatten smoothratio back out to float.". --- source/games/duke/src/render.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index c2b716284..ee484351c 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -364,13 +364,13 @@ void displayrooms(int snum, double interpfrac, bool sceneonly) else if (p->spritebridge == 0 && p->newOwner == nullptr) { - cpos.Z = clamp(cpos.Z, cz + 4, fz - 4); + cpos.Z = min(max(cpos.Z, p->truecz + 4), p->truefz - 4); } if (sect) { getzsofslopeptr(sect, cpos, &cz, &fz); - cpos.Z = clamp(cpos.Z, cz + 4, fz - 4); + cpos.Z = min(max(cpos.Z, cz + 4), fz - 4); } choriz = clamp(choriz, q16horiz(gi->playerHorizMin()), q16horiz(gi->playerHorizMax()));