1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01: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;
for (i = 0; i < obj.entities.size(); ++i)
{
if(obj.entities[i].type<50 //Don't warp warp lines
&& obj.entities[i].size < 12) //Don't wrap SWN enemies
if (obj.entities[i].type >= 50 /* Don't warp warp lines */
|| 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)
{
//ascii snakes
@ -1007,7 +1010,6 @@ void gamelogic(void)
obj.entities[i].lerpoldxp -= 320;
}
}
}
}
}
@ -1016,7 +1018,11 @@ void gamelogic(void)
size_t 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].isplatform)
@ -1035,7 +1041,6 @@ void gamelogic(void)
obj.entities[i].yp -= 232;
obj.entities[i].lerpoldyp -= 232;
}
}
}
}
@ -1044,10 +1049,12 @@ void gamelogic(void)
size_t i;
for (i = 0; i < obj.entities.size(); ++i)
{
if(obj.entities[i].type<50 //Don't warp warp lines
&&obj.entities[i].rule!=0)
if (obj.entities[i].type >= 50 /* Don't warp warp lines */
|| obj.entities[i].rule == 0) /* Don't warp the player */
{
continue;
}
if (obj.entities[i].xp <= -30)
{
if (obj.entities[i].isplatform)
@ -1066,7 +1073,6 @@ void gamelogic(void)
obj.entities[i].xp -= 350;
obj.entities[i].lerpoldxp -= 350;
}
}
}
}