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

Invert and use continue in room wrap for-loops

This saves one indentation level. I also fixed the comments a bit
(multiline instead of single-line, "gravitron squares" instead of "SWN
enemies", also commented the player exclusion from horizontal wrapping
in vertically-wrapping rooms).
This commit is contained in:
Misa 2021-04-22 15:36:16 -07:00 committed by Ethan Lee
parent 285fc24513
commit 29ff47cacb

View File

@ -961,9 +961,12 @@ void gamelogic(void)
size_t i; size_t i;
for (i = 0; i < obj.entities.size(); ++i) for (i = 0; i < obj.entities.size(); ++i)
{ {
if(obj.entities[i].type<50 //Don't warp warp lines if (obj.entities[i].type >= 50 /* Don't warp warp lines */
&& obj.entities[i].size < 12) //Don't wrap SWN enemies || obj.entities[i].size >= 12) /* Don't warp gravitron squares */
{ {
continue;
}
if (game.roomx == 118 && game.roomy == 102 && obj.entities[i].rule==1 && !map.custommode) if (game.roomx == 118 && game.roomy == 102 && obj.entities[i].rule==1 && !map.custommode)
{ {
//ascii snakes //ascii snakes
@ -1009,14 +1012,17 @@ void gamelogic(void)
} }
} }
} }
}
if (map.warpy && !map.towermode) if (map.warpy && !map.towermode)
{ {
size_t i; size_t i;
for (i = 0; i < obj.entities.size(); ++i) for (i = 0; i < obj.entities.size(); ++i)
{ {
if(obj.entities[i].type<50){ //Don't warp warp lines if (obj.entities[i].type >= 50) /* Don't warp warp lines */
{
continue;
}
if (obj.entities[i].yp <= -12) if (obj.entities[i].yp <= -12)
{ {
if (obj.entities[i].isplatform) if (obj.entities[i].isplatform)
@ -1037,17 +1043,18 @@ void gamelogic(void)
} }
} }
} }
}
if (map.warpy && !map.warpx && !map.towermode) if (map.warpy && !map.warpx && !map.towermode)
{ {
size_t i; size_t i;
for (i = 0; i < obj.entities.size(); ++i) for (i = 0; i < obj.entities.size(); ++i)
{ {
if (obj.entities[i].type >= 50 /* Don't warp warp lines */
if(obj.entities[i].type<50 //Don't warp warp lines || obj.entities[i].rule == 0) /* Don't warp the player */
&&obj.entities[i].rule!=0)
{ {
continue;
}
if (obj.entities[i].xp <= -30) if (obj.entities[i].xp <= -30)
{ {
if (obj.entities[i].isplatform) if (obj.entities[i].isplatform)
@ -1068,7 +1075,6 @@ void gamelogic(void)
} }
} }
} }
}
bool screen_transition = false; bool screen_transition = false;