From 2e635a8a305587c99bcddec14422e31dc0c0173c Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sat, 26 May 2012 21:58:29 +0000 Subject: [PATCH] In tilted-view setup code, allocate TILE_TILT storage more tightly. git-svn-id: https://svn.eduke32.com/eduke32@2700 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/game.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index fc0656a37..003400e00 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -3603,13 +3603,20 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio) tiltcy = 200; } - walock[TILE_TILT] = 255; - if (waloff[TILE_TILT] == 0) - allocache(&waloff[TILE_TILT],tiltcx*tiltcx,&walock[TILE_TILT]); - if ((tang&1023) == 0) - setviewtotile(TILE_TILT,tiltcy>>(1-ud.detail),tiltcx>>(1-ud.detail)); - else - setviewtotile(TILE_TILT,tiltcx>>(1-ud.detail),tiltcx>>(1-ud.detail)); + { + // If the view is rotated (not 0 or 180 degrees modulo 360 degrees), + // we render onto a square tile and display a portion of that + // rotated on-screen later on. + const int32_t viewtilexsiz = ((tang&1023) ? tiltcx : tiltcy)>>!ud.detail; + const int32_t viewtileysiz = tiltcx>>!ud.detail; + + walock[TILE_TILT] = 255; + if (waloff[TILE_TILT] == 0) + allocache(&waloff[TILE_TILT], viewtilexsiz*viewtileysiz, &walock[TILE_TILT]); + + setviewtotile(TILE_TILT, viewtilexsiz, viewtileysiz); + } + if ((tang&1023) == 512) { //Block off unscreen section of 90ΓΈ tilted screen