Classic: fix "windowed" modes (r_size >= 12) by reverting r4920; adapt.

In setview(), we now assert windowx2 < xdim. The only calling places where its
non-violation is non-trivial to ascertain are (1) showview from CON and
(2) draw-to-tile for look-sideways in game.c. AFAICS case 1 should be fine.
Case 2 is adapted; see comments there.


git-svn-id: https://svn.eduke32.com/eduke32@4935 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2015-01-18 23:16:37 +00:00
parent 451dcfa073
commit ace6087f7b
2 changed files with 33 additions and 13 deletions

View file

@ -84,7 +84,6 @@ float debug1, debug2;
int32_t mapversion=7; // JBF 20040211: default mapversion to 7
int32_t g_loadedMapVersion = -1; // -1: none (e.g. started new)
usermaphack_t g_loadedMapHack; // used only for the MD4 part
uint8_t g_loadedMapMD4[16];
int32_t compare_usermaphacks(const void *a, const void *b)
{
@ -3716,8 +3715,7 @@ static void setup_blend(int32_t blend, int32_t doreverse)
static void ceilscan(int32_t x1, int32_t x2, int32_t sectnum)
{
int32_t x, y1, y2;
int32_t twall, bwall;
const sectortype *sec = &sector[sectnum];
const sectortype *const sec = &sector[sectnum];
if (setup_globals_cf1(sec, sec->ceilingpal, sec->ceilingz-globalposz,
sec->ceilingpicnum, sec->ceilingshade, sec->ceilingstat,
@ -3729,7 +3727,9 @@ static void ceilscan(int32_t x1, int32_t x2, int32_t sectnum)
y1 = umost[x1]; y2 = y1;
for (x=x1; x<=x2; x++)
{
twall = umost[x]-1; bwall = min(uplc[x],dmost[x]);
const int32_t twall = umost[x]-1;
const int32_t bwall = min(uplc[x],dmost[x]);
if (twall < bwall-1)
{
if (twall >= y2)
@ -3776,7 +3776,9 @@ static void ceilscan(int32_t x1, int32_t x2, int32_t sectnum)
y1 = umost[x1]; y2 = y1;
for (x=x1; x<=x2; x++)
{
twall = umost[x]-1; bwall = min(uplc[x],dmost[x]);
const int32_t twall = umost[x]-1;
const int32_t bwall = min(uplc[x],dmost[x]);
if (twall < bwall-1)
{
if (twall >= y2)
@ -3811,8 +3813,7 @@ static void ceilscan(int32_t x1, int32_t x2, int32_t sectnum)
static void florscan(int32_t x1, int32_t x2, int32_t sectnum)
{
int32_t x, y1, y2;
int32_t twall, bwall;
const sectortype *sec = &sector[sectnum];
const sectortype *const sec = &sector[sectnum];
if (setup_globals_cf1(sec, sec->floorpal, globalposz-sec->floorz,
sec->floorpicnum, sec->floorshade, sec->floorstat,
@ -3824,7 +3825,9 @@ static void florscan(int32_t x1, int32_t x2, int32_t sectnum)
y1 = max(dplc[x1],umost[x1]); y2 = y1;
for (x=x1; x<=x2; x++)
{
twall = max(dplc[x],umost[x])-1; bwall = dmost[x];
const int32_t twall = max(dplc[x],umost[x])-1;
const int32_t bwall = dmost[x];
if (twall < bwall-1)
{
if (twall >= y2)
@ -3871,7 +3874,9 @@ static void florscan(int32_t x1, int32_t x2, int32_t sectnum)
y1 = max(dplc[x1],umost[x1]); y2 = y1;
for (x=x1; x<=x2; x++)
{
twall = max(dplc[x],umost[x])-1; bwall = dmost[x];
const int32_t twall = max(dplc[x],umost[x])-1;
const int32_t bwall = dmost[x];
if (twall < bwall-1)
{
if (twall >= y2)
@ -15109,7 +15114,8 @@ void setview(int32_t x1, int32_t y1, int32_t x2, int32_t y2)
setaspect_new();
for (i=0; i<windowx1; i++) { startumost[i] = 1, startdmost[i] = 0; }
for (i=windowx1; i<windowx2; i++)
Bassert(windowx2 < xdim); // xdim is the number of alloc'd elements in start*most[].
for (i=windowx1; i<=windowx2; i++)
{ startumost[i] = windowy1, startdmost[i] = windowy2+1; }
for (i=windowx2+1; i<xdim; i++) { startumost[i] = 1, startdmost[i] = 0; }
}

View file

@ -4513,7 +4513,17 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
// To render a tilted screen in high quality, we need at least
// 640 pixels of *Y* dimension.
#if MAXYDIM >= 640
if (xres > 320 || yres > 240)
// We also need
// * xdim >= 640 since tiltcx will be passed as setview()'s x2
// which must be less than xdim.
// * ydim >= 640 (sic!) since the tile-to-draw-to will be set
// up with dimension 400x640, but the engine's arrays like
// lastx[] are alloc'd with *xdim* elements! (This point is
// the dynamic counterpart of the #if above since we now
// allocate these engine arrays tightly.)
// XXX: The engine should be in charge of setting up everything
// so that no oob access occur.
if (xdim >= 640 && ydim >= 640)
{
tiltcs = 2;
tiltcx = 640;
@ -4524,8 +4534,12 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
{
// JBF 20030807: Increased tilted-screen quality
tiltcs = 1;
tiltcx = 320;
tiltcy = 200;
// 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;
}
{