1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-29 07:58:30 +02:00

Use case-switch for warpdir checking

Also, there's no need to put the entire warpdir checking in an
'if(room.warpdir>0)' statement. If any of the cases is jumped to, then
you already know that's true.
This commit is contained in:
Misa 2020-07-09 03:21:18 -07:00 committed by Ethan Lee
parent 2938db057b
commit ccb3d6e974

View File

@ -1661,20 +1661,23 @@ void mapclass::loadlevel(int rx, int ry)
if(redrawbg){ if(redrawbg){
graphics.backgrounddrawn = false; graphics.backgrounddrawn = false;
} }
if(room.warpdir>0){ switch (room.warpdir)
if(room.warpdir==1){ {
case 1:
warpx=true; warpx=true;
background=3; background=3;
graphics.rcol = ed.getwarpbackground(rx-100,ry-100); graphics.rcol = ed.getwarpbackground(rx-100,ry-100);
}else if(room.warpdir==2){ break;
case 2:
warpy=true; warpy=true;
background=4; background=4;
graphics.rcol = ed.getwarpbackground(rx-100,ry-100); graphics.rcol = ed.getwarpbackground(rx-100,ry-100);
}else if(room.warpdir==3){ break;
case 3:
warpx=true; warpy=true; warpx=true; warpy=true;
background = 5; background = 5;
graphics.rcol = ed.getwarpbackground(rx-100,ry-100); graphics.rcol = ed.getwarpbackground(rx-100,ry-100);
} break;
} }
roomname = room.roomname; roomname = room.roomname;