From ba25d9a67853630dc144e304c2ba15937f3fba28 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Thu, 19 Jan 2012 23:17:03 +0000 Subject: [PATCH] Fix a problem in G_DrawRooms where an sectnum updated to -1 may be used as index. git-svn-id: https://svn.eduke32.com/eduke32@2269 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/game.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 4bb67899b..3c9a5b620 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -3563,14 +3563,19 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio) else if (ud.camera.z > (p->truefz - (4<<8))) ud.camera.z = fz - (4<<8); } - if (ud.camerasect >= 0) + while (ud.camerasect >= 0) // if, really { getzsofslope(ud.camerasect,ud.camera.x,ud.camera.y,&cz,&fz); #ifdef YAX_ENABLE if (yax_getbunch(ud.camerasect, YAX_CEILING) >= 0) { if (ud.camera.z < cz) + { updatesectorz(ud.camera.x, ud.camera.y, ud.camera.z, &ud.camerasect); + break; // since ud.camerasect might have been updated to -1 + // NOTE: fist discovered in WGR2 SVN r134, til' death level 1 + // (Lochwood Hollow). A problem REMAINS with Polymost, maybe classic! + } } else #endif @@ -3585,6 +3590,8 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio) else #endif if (ud.camera.z > fz-(4<<8)) ud.camera.z = fz-(4<<8); + + break; } if (ud.camerahoriz > HORIZ_MAX) ud.camerahoriz = HORIZ_MAX;