From 729f24d7322402bf89b80ddfd9adc8f545e14441 Mon Sep 17 00:00:00 2001 From: Misa Date: Thu, 9 Jul 2020 02:40:18 -0700 Subject: [PATCH] De-duplicate reference to edentity 'edentity[edi]' is a bit long-winded when you really just want to access the attributes of the edentity. How about just 'ent'? --- desktop_version/src/Map.cpp | 59 +++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/desktop_version/src/Map.cpp b/desktop_version/src/Map.cpp index 6e00d9a3..1e04db63 100644 --- a/desktop_version/src/Map.cpp +++ b/desktop_version/src/Map.cpp @@ -1680,15 +1680,16 @@ void mapclass::loadlevel(int rx, int ry) int tempscriptbox=0; for(size_t edi=0; edi=5 && edentity[edi].p1<=8){ //Threadmill + ent.p1, ed.level[rx-100+((ry-100)*ed.mapwidth)].platv, bx1, by1, bx2, by2); + }else if(ent.p1 >= 5 && ent.p1 <= 8){ //Threadmill obj.createentity(ex, ey, 2, - edentity[edi].p1+3, 4); + ent.p1 + 3, 4); } break; case 3: //Disappearing platforms @@ -1729,21 +1730,21 @@ void mapclass::loadlevel(int rx, int ry) break; case 10: //Checkpoints obj.createentity(ex, ey, 10, - edentity[edi].p1,((rx+(ry*100))*20)+tempcheckpoints); + ent.p1, ((rx+(ry*100))*20)+tempcheckpoints); tempcheckpoints++; break; case 11: //Gravity Lines - if(edentity[edi].p1==0){ //Horizontal - obj.createentity((edentity[edi].p2*8), ey + 4, 11, edentity[edi].p3); + if(ent.p1==0){ //Horizontal + obj.createentity(ent.p2 * 8, ey + 4, 11, ent.p3); }else{ //Vertical - obj.createentity(ex + 3,(edentity[edi].p2*8), 12, edentity[edi].p3); + obj.createentity(ex + 3, ent.p2 * 8, 12, ent.p3); } break; case 13: //Warp Tokens - obj.createentity(ex, ey, 13, edentity[edi].p1, edentity[edi].p2); + obj.createentity(ex, ey, 13, ent.p1, ent.p2); break; case 15: //Collectable crewmate - obj.createentity(ex - 4, ey + 1, 55, ed.findcrewmate(edi), edentity[edi].p1, edentity[edi].p2); + obj.createentity(ex - 4, ey + 1, 55, ed.findcrewmate(edi), ent.p1, ent.p2); break; case 17: //Roomtext! { @@ -1751,15 +1752,15 @@ void mapclass::loadlevel(int rx, int ry) Roomtext text; text.x = ex / 8; text.y = ey / 8; - text.text = edentity[edi].scriptname; + text.text = ent.scriptname; roomtext.push_back(text); break; } case 18: //Terminals { - obj.customscript=edentity[edi].scriptname; + obj.customscript = ent.scriptname; - int usethistile = edentity[edi].p1; + int usethistile = ent.p1; int usethisy = ey; // This isn't a boolean: we just swap 0 and 1 around and leave the rest alone @@ -1780,22 +1781,22 @@ void mapclass::loadlevel(int rx, int ry) case 19: //Script Box if (INBOUNDS_ARR(tempscriptbox, game.customscript)) { - game.customscript[tempscriptbox]=edentity[edi].scriptname; + game.customscript[tempscriptbox]=ent.scriptname; } obj.createblock(1, ex, ey, - edentity[edi].p1*8, edentity[edi].p2*8, 300+tempscriptbox, "custom_" + edentity[edi].scriptname); + ent.p1*8, ent.p2*8, 300+tempscriptbox, "custom_" + ent.scriptname); tempscriptbox++; break; case 50: //Warp Lines obj.customwarpmode=true; - if(edentity[edi].p1==0){ // - obj.createentity(ex + 4,(edentity[edi].p2*8), 51, edentity[edi].p3); - }else if(edentity[edi].p1==1){ //Horizontal, right - obj.createentity(ex + 4,(edentity[edi].p2*8), 52, edentity[edi].p3); - }else if(edentity[edi].p1==2){ //Vertical, top - obj.createentity((edentity[edi].p2*8), ey + 7, 53, edentity[edi].p3); - }else if(edentity[edi].p1==3){ - obj.createentity((edentity[edi].p2*8), ey, 54, edentity[edi].p3); + if(ent.p1==0){ // + obj.createentity(ex + 4, ent.p2 * 8, 51, ent.p3); + }else if(ent.p1==1){ //Horizontal, right + obj.createentity(ex + 4, ent.p2 * 8, 52, ent.p3); + }else if(ent.p1==2){ //Vertical, top + obj.createentity(ent.p2 * 8, ey + 7, 53, ent.p3); + }else if(ent.p1==3){ + obj.createentity(ent.p2 * 8, ey, 54, ent.p3); } break; }