- SW: added validation checks to WallSetup.

This code wrote to array index -1.
With this change the level finally gets rendered, although it still doesn't work.
This commit is contained in:
Christoph Oelckers 2019-11-19 23:04:22 +01:00
parent fd31d4fa6a
commit 234283ca8a

View file

@ -185,7 +185,8 @@ WallSetup(void)
// set first wall // set first wall
SET(wp->extra, WALLFX_LOOP_DONT_SPIN); SET(wp->extra, WALLFX_LOOP_DONT_SPIN);
SET(wall[wp->nextwall].extra, WALLFX_LOOP_DONT_SPIN); if (wp->nextwall >= 0)
SET(wall[wp->nextwall].extra, WALLFX_LOOP_DONT_SPIN);
// move the the next wall // move the the next wall
start_wall = wp->point2; start_wall = wp->point2;
@ -196,7 +197,8 @@ WallSetup(void)
wall_num = wall[wall_num].point2) wall_num = wall[wall_num].point2)
{ {
SET(wall[wall_num].extra, WALLFX_LOOP_DONT_SPIN); SET(wall[wall_num].extra, WALLFX_LOOP_DONT_SPIN);
SET(wall[wall[wall_num].nextwall].extra, WALLFX_LOOP_DONT_SPIN); if (wall[wall_num].nextwall >= 0)
SET(wall[wall[wall_num].nextwall].extra, WALLFX_LOOP_DONT_SPIN);
} }
break; break;
@ -208,7 +210,8 @@ WallSetup(void)
// set first wall // set first wall
SET(wp->extra, WALLFX_DONT_SCALE); SET(wp->extra, WALLFX_DONT_SCALE);
SET(wall[wp->nextwall].extra, WALLFX_DONT_SCALE); if (wp->nextwall >= 0)
SET(wall[wp->nextwall].extra, WALLFX_DONT_SCALE);
// move the the next wall // move the the next wall
start_wall = wp->point2; start_wall = wp->point2;
@ -237,7 +240,8 @@ WallSetup(void)
// set first wall // set first wall
SET(wp->extra, WALLFX_LOOP_OUTER|WALLFX_LOOP_OUTER_SECONDARY); SET(wp->extra, WALLFX_LOOP_OUTER|WALLFX_LOOP_OUTER_SECONDARY);
SET(wall[wp->nextwall].extra, WALLFX_LOOP_OUTER|WALLFX_LOOP_OUTER_SECONDARY); if (wp->nextwall >= 0)
SET(wall[wp->nextwall].extra, WALLFX_LOOP_OUTER|WALLFX_LOOP_OUTER_SECONDARY);
// move the the next wall // move the the next wall
start_wall = wp->point2; start_wall = wp->point2;
@ -248,7 +252,8 @@ WallSetup(void)
wall_num = wall[wall_num].point2) wall_num = wall[wall_num].point2)
{ {
SET(wall[wall_num].extra, WALLFX_LOOP_OUTER|WALLFX_LOOP_OUTER_SECONDARY); SET(wall[wall_num].extra, WALLFX_LOOP_OUTER|WALLFX_LOOP_OUTER_SECONDARY);
SET(wall[wall[wall_num].nextwall].extra, WALLFX_LOOP_OUTER|WALLFX_LOOP_OUTER_SECONDARY); if (wall[wall_num].nextwall >= 0)
SET(wall[wall[wall_num].nextwall].extra, WALLFX_LOOP_OUTER|WALLFX_LOOP_OUTER_SECONDARY);
} }
break; break;
@ -263,7 +268,8 @@ WallSetup(void)
// set first wall // set first wall
SET(wp->extra, WALLFX_LOOP_OUTER); SET(wp->extra, WALLFX_LOOP_OUTER);
SET(wall[wp->nextwall].extra, WALLFX_LOOP_OUTER); if (wp->nextwall >= 0)
SET(wall[wp->nextwall].extra, WALLFX_LOOP_OUTER);
// move the the next wall // move the the next wall
start_wall = wp->point2; start_wall = wp->point2;
@ -274,7 +280,8 @@ WallSetup(void)
wall_num = wall[wall_num].point2) wall_num = wall[wall_num].point2)
{ {
SET(wall[wall_num].extra, WALLFX_LOOP_OUTER); SET(wall[wall_num].extra, WALLFX_LOOP_OUTER);
SET(wall[wall[wall_num].nextwall].extra, WALLFX_LOOP_OUTER); if (wall[wall_num].nextwall >= 0)
SET(wall[wall[wall_num].nextwall].extra, WALLFX_LOOP_OUTER);
} }
wp->lotag = 0; wp->lotag = 0;
@ -295,7 +302,8 @@ WallSetup(void)
// set first wall // set first wall
SET(wp->extra, WALLFX_LOOP_SPIN_2X); SET(wp->extra, WALLFX_LOOP_SPIN_2X);
SET(wall[wp->nextwall].extra, WALLFX_LOOP_SPIN_2X); if (wp->nextwall >= 0)
SET(wall[wp->nextwall].extra, WALLFX_LOOP_SPIN_2X);
// move the the next wall // move the the next wall
start_wall = wp->point2; start_wall = wp->point2;
@ -306,7 +314,8 @@ WallSetup(void)
wall_num = wall[wall_num].point2) wall_num = wall[wall_num].point2)
{ {
SET(wall[wall_num].extra, WALLFX_LOOP_SPIN_2X); SET(wall[wall_num].extra, WALLFX_LOOP_SPIN_2X);
SET(wall[wall[wall_num].nextwall].extra, WALLFX_LOOP_SPIN_2X); if (wall[wall_num].nextwall >= 0)
SET(wall[wall[wall_num].nextwall].extra, WALLFX_LOOP_SPIN_2X);
} }
break; break;
@ -318,7 +327,8 @@ WallSetup(void)
// set first wall // set first wall
SET(wp->extra, WALLFX_LOOP_SPIN_4X); SET(wp->extra, WALLFX_LOOP_SPIN_4X);
SET(wall[wp->nextwall].extra, WALLFX_LOOP_SPIN_4X); if (wp->nextwall >= 0)
SET(wall[wp->nextwall].extra, WALLFX_LOOP_SPIN_4X);
// move the the next wall // move the the next wall
start_wall = wp->point2; start_wall = wp->point2;
@ -329,7 +339,8 @@ WallSetup(void)
wall_num = wall[wall_num].point2) wall_num = wall[wall_num].point2)
{ {
SET(wall[wall_num].extra, WALLFX_LOOP_SPIN_4X); SET(wall[wall_num].extra, WALLFX_LOOP_SPIN_4X);
SET(wall[wall[wall_num].nextwall].extra, WALLFX_LOOP_SPIN_4X); if (wall[wall_num].nextwall >= 0)
SET(wall[wall[wall_num].nextwall].extra, WALLFX_LOOP_SPIN_4X);
} }
break; break;
@ -341,7 +352,8 @@ WallSetup(void)
// set first wall // set first wall
SET(wp->extra, WALLFX_LOOP_REVERSE_SPIN); SET(wp->extra, WALLFX_LOOP_REVERSE_SPIN);
SET(wall[wp->nextwall].extra, WALLFX_LOOP_REVERSE_SPIN); if (wp->nextwall >= 0)
SET(wall[wp->nextwall].extra, WALLFX_LOOP_REVERSE_SPIN);
// move the the next wall // move the the next wall
start_wall = wp->point2; start_wall = wp->point2;
@ -352,7 +364,8 @@ WallSetup(void)
wall_num = wall[wall_num].point2) wall_num = wall[wall_num].point2)
{ {
SET(wall[wall_num].extra, WALLFX_LOOP_REVERSE_SPIN); SET(wall[wall_num].extra, WALLFX_LOOP_REVERSE_SPIN);
SET(wall[wall[wall_num].nextwall].extra, WALLFX_LOOP_REVERSE_SPIN); if (wall[wall_num].nextwall >= 0)
SET(wall[wall[wall_num].nextwall].extra, WALLFX_LOOP_REVERSE_SPIN);
} }
break; break;