From 50375fcff2993ccd565947cef4608626ce23b7c8 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 4 Mar 2012 20:14:48 +0000 Subject: [PATCH] Fix apparent horizon not being independent of viewingrange (classic/Polymost). The apparent horizon (in units proportional to pixels by a constant factor) was being calculated without normalizing to viewingrange, resulting a discrepancy between the drawn and actual up/down angle with non-default viewingranges (e.g. with r_usenewaspect=1, or when setting it from setaspect). This also means that the center-of-aim will now be the same regardless of the aspect. This fixes many derived bugs: * inconsistency w/ crosshair when shooting a gun and aiming up/down (obviously) * bugs resulting from being able to look up/down too far (garbage non-slope texture-mapping and viewing BIGORBIT skies above the borders in classic). Note: mods that had workaround logic for this bug will have to remove it... git-svn-id: https://svn.eduke32.com/eduke32@2414 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/engine.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 8657b76fa..2e03e27c0 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -8060,7 +8060,9 @@ void drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, globalposx = daposx; globalposy = daposy; globalposz = daposz; globalang = (daang&2047); - globalhoriz = mulscale16(dahoriz-100,xdimenscale)+(ydimen>>1); + // xdimenscale is scale(xdimen,yxaspect,320); + // normalization by viewingrange so that center-of-aim doesn't depend on it + globalhoriz = mulscale16(dahoriz-100,divscale16(xdimenscale,viewingrange))+(ydimen>>1); globaluclip = (0-globalhoriz)*xdimscale; globaldclip = (ydimen-globalhoriz)*xdimscale;