diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 3863f4072..deee5ba51 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -3110,7 +3110,8 @@ static void drawalls(int32_t bunch) } wallnum = thewall[z]; wal = &wall[wallnum]; - nextsectnum = wal->nextsector; nextsec = §or[nextsectnum]; + nextsectnum = wal->nextsector; + nextsec = nextsectnum>=0 ? §or[nextsectnum] : NULL; gotswall = 0; @@ -6490,6 +6491,14 @@ void drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, i = globalcursectnum; updatesector(globalposx,globalposy,&globalcursectnum); if (globalcursectnum < 0) globalcursectnum = i; + + // PK 20110123: I'm not sure what the line above is supposed to do, but 'i' + // *can* be negative, so let's just quit here in that case... + if (globalcursectnum<0) + { + enddrawing(); + return; + } } globparaceilclip = 1; diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 6015b3b99..729cf4bad 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -3087,7 +3087,8 @@ static void polymost_drawalls(int32_t bunch) for (z=bunchfirst[bunch]; z>=0; z=p2[z]) { wallnum = thewall[z]; wal = &wall[wallnum]; wal2 = &wall[wal->point2]; - nextsectnum = wal->nextsector; nextsec = §or[nextsectnum]; + nextsectnum = wal->nextsector; + nextsec = nextsectnum>=0 ? §or[nextsectnum] : NULL; //Offset&Rotate 3D coordinates to screen 3D space x = wal->x-globalposx; y = wal->y-globalposy; diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index e4ba8fe97..316faa10e 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -5507,7 +5507,7 @@ static void Keys3d(void) } */ - if (sector[cursectnum].lotag==2) + if (cursectnum>=0 && sector[cursectnum].lotag==2) { if (sector[cursectnum].ceilingpicnum==FLOORSLIME) SetSLIMEPalette();