Classic: fix underallocation of TILE_TILT and tilting at very small resolutions.

Since TILE_TILT is only allocated once, it must be done with the maximum
possible size.

git-svn-id: https://svn.eduke32.com/eduke32@4965 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2015-02-07 17:29:15 +00:00
parent 1a7816065c
commit a7bea4f6bc
2 changed files with 16 additions and 8 deletions

View File

@ -11619,6 +11619,8 @@ int32_t saveboard(const char *filename, const vec3_t *dapos, int16_t daang, int1
static void initsmost(void)
{
int32_t i;
// Needed for the game's TILT_SETVIEWTOTILE_320.
const int32_t clamped_ydim = max(ydim, 320);
struct
{
@ -11641,9 +11643,9 @@ static void initsmost(void)
{ (void **)&swall, xdim * sizeof(int32_t) },
{ (void **)&lwall, (xdim + 4) * sizeof(int32_t) },
{ (void **)&radarang2, xdim * sizeof(int16_t) },
{ (void **)&dotp1, ydim * sizeof(intptr_t) },
{ (void **)&dotp2, ydim * sizeof(intptr_t) },
{ (void **)&lastx, ydim * sizeof(int32_t) },
{ (void **)&dotp1, clamped_ydim * sizeof(intptr_t) },
{ (void **)&dotp2, clamped_ydim * sizeof(intptr_t) },
{ (void **)&lastx, clamped_ydim * sizeof(int32_t) },
};
for (i = 0; i < (signed)ARRAY_SIZE(dynarray); i++)

View File

@ -4510,6 +4510,13 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
}
else
{
// Maximum possible allocation size passed to allocache() below
// since there is no equivalent of free() for allocache().
#if MAXYDIM >= 640
const int maxtiltallocsiz = 640*640;
#else
const int maxtileallocsiz = 320*320;
#endif
// To render a tilted screen in high quality, we need at least
// 640 pixels of *Y* dimension.
#if MAXYDIM >= 640
@ -4536,10 +4543,9 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
tiltcs = 1;
// NOTE: The same reflections as above apply here, too.
// XXX: Looking sideways at resolutions like 320x200 will
// render only a squarish portion.
tiltcx = min(320, ydim);
tiltcy = 200*tiltcx/320;
// TILT_SETVIEWTOTILE_320.
tiltcx = 320;
tiltcy = 200;
}
{
@ -4551,7 +4557,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
walock[TILE_TILT] = 255;
if (waloff[TILE_TILT] == 0)
allocache(&waloff[TILE_TILT], viewtilexsiz*viewtileysiz, &walock[TILE_TILT]);
allocache(&waloff[TILE_TILT], maxtiltallocsiz, &walock[TILE_TILT]);
setviewtotile(TILE_TILT, viewtilexsiz, viewtileysiz);
}