Corrupt map fixes

Specifically seems to fix ebase.map by msandt


git-svn-id: https://svn.eduke32.com/eduke32@1510 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2009-10-01 00:28:40 +00:00
parent dcd7c3c9fe
commit ecb3e90817
3 changed files with 10 additions and 10 deletions

View File

@ -10260,7 +10260,7 @@ int32_t sectorofwall(int16_t theline)
int32_t i, gap;
if ((theline < 0) || (theline >= numwalls)) return(-1);
i = wall[theline].nextwall; if (i >= 0) return(wall[i].nextsector);
i = wall[theline].nextwall; if (i >= 0 && i < MAXWALLS) return(wall[i].nextsector);
gap = (numsectors>>1); i = gap;
while (gap > 1)
@ -10999,7 +10999,7 @@ void draw2dscreen(int32_t posxe, int32_t posye, int16_t ange, int32_t zoome, int
{
col = 33;
if ((wal->cstat&1) != 0) col = 5;
if (wal->nextwall!=-1&&((wal->cstat^wall[wal->nextwall].cstat)&1)) col = 2;
if (wal->nextwall >= 0 && wal->nextwall < MAXWALLS && ((wal->cstat^wall[wal->nextwall].cstat)&1)) col = 2;
if ((i == linehighlight) || ((linehighlight >= 0) && (i == wall[linehighlight].nextwall)))
if (totalclock & 16) col += (2<<2);
}

View File

@ -2934,7 +2934,7 @@ static void polymer_updatewall(int16_t wallnum)
wal = &wall[wallnum];
nwallnum = wal->nextwall;
if (sectofwall == -1)
if (sectofwall < 0 || sectofwall > numsectors || wallnum < 0 || wallnum > numwalls)
return; // yay, corrupt map
sec = &sector[sectofwall];
if (sec->wallptr > wallnum)
@ -2942,7 +2942,7 @@ static void polymer_updatewall(int16_t wallnum)
w = prwalls[wallnum];
s = prsectors[sectofwall];
invalid = s->invalidid;
if (nwallnum != -1)
if (nwallnum >= 0 && nwallnum < MAXWALLS)
{
ns = prsectors[wal->nextsector];
invalid += ns->invalidid;
@ -2963,7 +2963,7 @@ static void polymer_updatewall(int16_t wallnum)
if (picanm[wallpicnum]&192) wallpicnum += animateoffs(wallpicnum,wallnum+16384);
walloverpicnum = wal->overpicnum;
if (picanm[walloverpicnum]&192) walloverpicnum += animateoffs(walloverpicnum,wallnum+16384);
if (nwallnum != -1)
if (nwallnum >= 0 && nwallnum < MAXWALLS)
{
nwallpicnum = wall[nwallnum].picnum;
if (picanm[nwallpicnum]&192) nwallpicnum += animateoffs(nwallpicnum,wallnum+16384);
@ -3006,7 +3006,7 @@ static void polymer_updatewall(int16_t wallnum)
w->yrepeat = wal->yrepeat;
w->overpicnum = walloverpicnum;
w->shade = wal->shade;
if (nwallnum != -1)
if (nwallnum >= 0 && nwallnum < MAXWALLS)
{
w->nwallpicnum = nwallpicnum;
w->nwallxpanning = wall[nwallnum].xpanning;
@ -3022,7 +3022,7 @@ static void polymer_updatewall(int16_t wallnum)
else
xref = 0;
if (wal->nextsector == -1)
if (wal->nextsector < 0 || wal->nextsector > numsectors)
{
Bmemcpy(w->wall.buffer, &s->floor.buffer[(wallnum - sec->wallptr) * 5], sizeof(GLfloat) * 3);
Bmemcpy(&w->wall.buffer[5], &s->floor.buffer[(wal->point2 - sec->wallptr) * 5], sizeof(GLfloat) * 3);

View File

@ -58,7 +58,6 @@ static BOOL window_class_registered = FALSE;
static HANDLE instanceflag = NULL;
int32_t backgroundidle = 1;
int32_t is_vista = 0;
static WORD sysgamma[3][256];
extern int32_t curbrightness, gammabrightness;
@ -500,7 +499,6 @@ static void print_os_version(void)
if (osv.dwMajorVersion == 6)
{
is_vista = 1;
switch (osv.dwMinorVersion)
{
case 0:
@ -509,6 +507,9 @@ static void print_os_version(void)
case 1:
ver = "7";
break;
default:
ver = "Unknown Post-2010 Product";
break;
}
break;
}
@ -524,7 +525,6 @@ static void print_os_version(void)
break;
default:
ver = "Unknown";
initprintf("OS: Unknown OS\n");
return;
}