summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-07-28 14:41:14 +1000
committerquou <quou@disroot.org>2024-07-28 14:41:14 +1000
commite4dc6fb9870e81679695f0ecf179bb2b58f03937 (patch)
tree97e53f3400a1da2f3ad897f9f9c7874b72c6572b
parent8313dc2387e35bd69b01a23fbbc12fc0e6946993 (diff)
fix raycasting aspect ratio.
-rw-r--r--render.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/render.c b/render.c
index f6dc018..a63dfe4 100644
--- a/render.c
+++ b/render.c
@@ -730,7 +730,7 @@ void ren_map(
const Texture* texture = get_texture(asset_id_brick_texture);
w = r->vp[0] << fbits;
h = r->vp[1] << fbits;
- hh = h / 2;
+ hh = (h / 4) * r->asp;
for (x = r->clip[0]; x < r->clip[2]; x++) {
int ray = ((2 * x) << (fbits * 2)) / w - f1;
int d[2];
@@ -775,8 +775,8 @@ void ren_map(
if (mp[1] >= map->h) break;
if (data[mp[0] + mp[1] * map->w]) {
int y;
- int sy = (r->vp[1] / 2) - (((hh << fbits) / dist) >> fbits);
- int ey = (r->vp[1] / 2) + (((hh << fbits) / dist) >> fbits);
+ int sy = (r->vp[1] / 2) - ((hh / dist) >> fbits);
+ int ey = (r->vp[1] / 2) + ((hh / dist) >> fbits);
sy = maxi(sy, r->clip[1]);
ey = mini(ey, r->clip[3]);
for (y = sy; y < ey; y++) {