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