1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2025-03-15 10:15:11 +01:00

Fix brace style and spacing in custom loadlevel()

I don't know who wrote this code originally, but it's extremely obvious
that it was a different person than who wrote the rest of the code.
Anyway, I fixed the spacing and braces so everything is smushed together
less.
This commit is contained in:
Misa 2020-07-09 03:29:53 -07:00 committed by Ethan Lee
parent ccb3d6e974
commit 78faea87ba

View file

@ -1628,7 +1628,9 @@ void mapclass::loadlevel(int rx, int ry)
game.customcol = ed.getlevelcol(curlevel) + 1;
obj.customplatformtile = game.customcol * 12;
switch(room.tileset){
switch (room.tileset)
{
case 0: // Space Station
tileset = 0;
background = 1;
@ -1658,9 +1660,11 @@ void mapclass::loadlevel(int rx, int ry)
// If screen warping, then override all that:
bool redrawbg = game.roomx != game.prevroomx || game.roomy != game.prevroomy;
if(redrawbg){
if (redrawbg)
{
graphics.backgrounddrawn = false;
}
switch (room.warpdir)
{
case 1:
@ -1674,7 +1678,8 @@ void mapclass::loadlevel(int rx, int ry)
graphics.rcol = ed.getwarpbackground(rx - 100, ry - 100);
break;
case 3:
warpx=true; warpy=true;
warpx = true;
warpy = true;
background = 5;
graphics.rcol = ed.getwarpbackground(rx - 100, ry - 100);
break;
@ -1692,15 +1697,18 @@ void mapclass::loadlevel(int rx, int ry)
// Entities have to be created HERE, akwardly
int tempcheckpoints = 0;
int tempscriptbox = 0;
for(size_t edi=0; edi<edentity.size(); edi++){
for (size_t edi = 0; edi < edentity.size(); edi++)
{
// If entity is in this room, create it
const edentities& ent = edentity[edi];
const int tsx = ent.x / 40;
const int tsy = ent.y / 30;
if (tsx != rx-100 || tsy != ry-100)
{
continue;
}
const int ex = (ent.x % 40) * 8;
const int ey = (ent.y % 30) * 8;
@ -1727,19 +1735,20 @@ void mapclass::loadlevel(int rx, int ry)
}
}
switch(ent.t){
switch (ent.t)
{
case 1: // Enemies
obj.customenemy = room.enemytype;
obj.createentity(ex, ey, 56,
ent.p1, 4, bx1, by1, bx2, by2);
obj.createentity(ex, ey, 56, ent.p1, 4, bx1, by1, bx2, by2);
break;
case 2: // Platforms and conveyors
if(ent.p1<=4){
obj.createentity(ex, ey, 2,
ent.p1, room.platv, bx1, by1, bx2, by2);
}else if(ent.p1 >= 5 && ent.p1 <= 8){ // Conveyor
obj.createentity(ex, ey, 2,
ent.p1 + 3, 4);
if (ent.p1 <= 4)
{
obj.createentity(ex, ey, 2, ent.p1, room.platv, bx1, by1, bx2, by2);
}
else if (ent.p1 >= 5 && ent.p1 <= 8) // Conveyor
{
obj.createentity(ex, ey, 2, ent.p1 + 3, 4);
}
break;
case 3: // Disappearing platforms
@ -1749,14 +1758,16 @@ void mapclass::loadlevel(int rx, int ry)
obj.createentity(ex, ey, 9, ed.findtrinket(edi));
break;
case 10: // Checkpoints
obj.createentity(ex, ey, 10,
ent.p1, ((rx+(ry*100))*20)+tempcheckpoints);
obj.createentity(ex, ey, 10, ent.p1, (rx + ry*100) * 20 + tempcheckpoints);
tempcheckpoints++;
break;
case 11: // Gravity Lines
if(ent.p1==0){ //Horizontal
if (ent.p1 == 0) //Horizontal
{
obj.createentity(ent.p2 * 8, ey + 4, 11, ent.p3);
}else{ //Vertical
}
else //Vertical
{
obj.createentity(ex + 3, ent.p2 * 8, 12, ent.p3);
}
break;
@ -1803,8 +1814,7 @@ void mapclass::loadlevel(int rx, int ry)
{
game.customscript[tempscriptbox] = ent.scriptname;
}
obj.createblock(TRIGGER, ex, ey,
ent.p1*8, ent.p2*8, 300+tempscriptbox, "custom_" + ent.scriptname);
obj.createblock(TRIGGER, ex, ey, ent.p1 * 8, ent.p2 * 8, 300 + tempscriptbox, "custom_" + ent.scriptname);
tempscriptbox++;
break;
case 50: // Warp Lines