From ecb3e90817d1b21d09fed846ec55119d9d436c27 Mon Sep 17 00:00:00 2001 From: terminx Date: Thu, 1 Oct 2009 00:28:40 +0000 Subject: [PATCH] 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 --- polymer/eduke32/build/src/engine.c | 4 ++-- polymer/eduke32/build/src/polymer.c | 10 +++++----- polymer/eduke32/build/src/winlayer.c | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 3bae3614e..bed3edb64 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -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); } diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index 3b2c970fe..16be74f50 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -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 = §or[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); diff --git a/polymer/eduke32/build/src/winlayer.c b/polymer/eduke32/build/src/winlayer.c index 22b7ff549..fd13bc348 100644 --- a/polymer/eduke32/build/src/winlayer.c +++ b/polymer/eduke32/build/src/winlayer.c @@ -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; }