Remove global args from mapclass

This commit removes the global args being passed around from the
function args on the mapclass object, as well as updating all callers in
other files to not have those args. Furthermore, 'dwgfx' has been
renamed to 'graphics' in Map.cpp.
This commit is contained in:
Misa
2020-03-31 01:09:42 -07:00
committed by Ethan Lee
parent cac1a9e3ab
commit 35d9bcce05
4 changed files with 127 additions and 127 deletions

View File

@@ -515,7 +515,7 @@ int mapclass::maptiletoenemycol(int t)
return 11;
}
void mapclass::changefinalcol(int t, entityclass& obj, Game& game)
void mapclass::changefinalcol(int t)
{
//change the map to colour t - for the game's final stretch.
//First up, the tiles. This is just a setting:
@@ -819,12 +819,12 @@ void mapclass::showship()
explored[4 + (11 * 20)] = 1;
}
void mapclass::resetplayer(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music)
void mapclass::resetplayer()
{
bool was_in_tower = towermode;
if (game.roomx != game.saverx || game.roomy != game.savery)
{
gotoroom(game.saverx, game.savery, dwgfx, game, obj, music);
gotoroom(game.saverx, game.savery);
}
game.deathseq = -1;
@@ -876,16 +876,16 @@ void mapclass::resetplayer(Graphics& dwgfx, Game& game, entityclass& obj, musicc
}
}
void mapclass::warpto(int rx, int ry , int t, int tx, int ty, Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music)
void mapclass::warpto(int rx, int ry , int t, int tx, int ty)
{
gotoroom(rx, ry, dwgfx, game, obj, music);
gotoroom(rx, ry);
game.teleport = false;
obj.entities[t].xp = tx * 8;
obj.entities[t].yp = (ty * 8) - obj.entities[t].h;
game.gravitycontrol = 0;
}
void mapclass::gotoroom(int rx, int ry, Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music)
void mapclass::gotoroom(int rx, int ry)
{
//First, destroy the current room
obj.removeallblocks();
@@ -999,7 +999,7 @@ void mapclass::gotoroom(int rx, int ry, Graphics& dwgfx, Game& game, entityclass
if (game.roomx == 107 && game.roomy == 109) music.niceplay(4);
if (game.roomx == 108 && game.roomy == 109)
{
if (dwgfx.setflipmode)
if (graphics.setflipmode)
{
music.niceplay(9);
}
@@ -1010,7 +1010,7 @@ void mapclass::gotoroom(int rx, int ry, Graphics& dwgfx, Game& game, entityclass
}
if (game.roomx == 109)
{
if (dwgfx.setflipmode)
if (graphics.setflipmode)
{
music.niceplay(9);
}
@@ -1053,7 +1053,7 @@ void mapclass::gotoroom(int rx, int ry, Graphics& dwgfx, Game& game, entityclass
if (game.roomx == 104 && game.roomy == 112) music.niceplay(4);
}
temp = rx + (ry * 100);
loadlevel(game.roomx, game.roomy, dwgfx, game, obj, music);
loadlevel(game.roomx, game.roomy);
//Do we need to reload the background?
@@ -1061,9 +1061,9 @@ void mapclass::gotoroom(int rx, int ry, Graphics& dwgfx, Game& game, entityclass
if(redrawbg)
{
dwgfx.backgrounddrawn = false; //Used for background caching speedup
graphics.backgrounddrawn = false; //Used for background caching speedup
}
dwgfx.foregrounddrawn = false; //Used for background caching speedup
graphics.foregrounddrawn = false; //Used for background caching speedup
game.prevroomx = game.roomx;
game.prevroomy = game.roomy;
@@ -1174,7 +1174,7 @@ std::string mapclass::currentarea(int t)
return "???";
}
void mapclass::loadlevel(int rx, int ry, Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music)
void mapclass::loadlevel(int rx, int ry)
{
int t;
//t = rx + (ry * 100);
@@ -1287,13 +1287,13 @@ void mapclass::loadlevel(int rx, int ry, Graphics& dwgfx, Game& game, entityclas
{
//in the secret lab! Crazy background!
background = 2;
if (rx == 116 && ry == 105) dwgfx.rcol = 1;
if (rx == 117 && ry == 105) dwgfx.rcol = 5;
if (rx == 118 && ry == 105) dwgfx.rcol = 4;
if (rx == 117 && ry == 106) dwgfx.rcol = 2;
if (rx == 118 && ry == 106) dwgfx.rcol = 0;
if (rx == 119 && ry == 106) dwgfx.rcol = 3;
if (rx == 119 && ry == 107) dwgfx.rcol = 1;
if (rx == 116 && ry == 105) graphics.rcol = 1;
if (rx == 117 && ry == 105) graphics.rcol = 5;
if (rx == 118 && ry == 105) graphics.rcol = 4;
if (rx == 117 && ry == 106) graphics.rcol = 2;
if (rx == 118 && ry == 106) graphics.rcol = 0;
if (rx == 119 && ry == 106) graphics.rcol = 3;
if (rx == 119 && ry == 107) graphics.rcol = 1;
}
}
}
@@ -1304,7 +1304,7 @@ void mapclass::loadlevel(int rx, int ry, Graphics& dwgfx, Game& game, entityclas
if (rx == 119 && ry == 108 && !custommode)
{
background = 5;
dwgfx.rcol = 3;
graphics.rcol = 3;
warpx = true;
warpy = true;
}
@@ -1334,7 +1334,7 @@ void mapclass::loadlevel(int rx, int ry, Graphics& dwgfx, Game& game, entityclas
roomname = lablevel.roomname;
tileset = 1;
background = 2;
dwgfx.rcol = lablevel.rcol;
graphics.rcol = lablevel.rcol;
break;
case 3: //The Tower
tdrawback = true;
@@ -1380,8 +1380,8 @@ void mapclass::loadlevel(int rx, int ry, Graphics& dwgfx, Game& game, entityclas
roomname = warplevel.roomname;
tileset = 1;
background = 3;
dwgfx.rcol = warplevel.rcol;
dwgfx.backgrounddrawn = false;
graphics.rcol = warplevel.rcol;
graphics.backgrounddrawn = false;
warpx = warplevel.warpx;
warpy = warplevel.warpy;
@@ -1402,8 +1402,8 @@ void mapclass::loadlevel(int rx, int ry, Graphics& dwgfx, Game& game, entityclas
roomname = finallevel.roomname;
tileset = 1;
background = 3;
dwgfx.rcol = finallevel.rcol;
dwgfx.backgrounddrawn = false;
graphics.rcol = finallevel.rcol;
graphics.backgrounddrawn = false;
if (finalstretch)
{
@@ -1419,8 +1419,8 @@ void mapclass::loadlevel(int rx, int ry, Graphics& dwgfx, Game& game, entityclas
if (warpx && warpy) background = 5;
}
dwgfx.rcol = 6;
changefinalcol(final_mapcol, obj, game);
graphics.rcol = 6;
changefinalcol(final_mapcol);
break;
case 7: //Final Level, Tower 1
tdrawback = true;
@@ -1589,7 +1589,7 @@ void mapclass::loadlevel(int rx, int ry, Graphics& dwgfx, Game& game, entityclas
case 2: //Lab
tileset = 1;
background = 2;
dwgfx.rcol = ed.level[curlevel].tilecol;
graphics.rcol = ed.level[curlevel].tilecol;
break;
case 3: //Warp Zone/intermission
tileset = 1;
@@ -1608,21 +1608,21 @@ void mapclass::loadlevel(int rx, int ry, Graphics& dwgfx, Game& game, entityclas
//If screen warping, then override all that:
bool redrawbg = game.roomx != game.prevroomx || game.roomy != game.prevroomy;
if(redrawbg){
dwgfx.backgrounddrawn = false;
graphics.backgrounddrawn = false;
}
if(ed.level[curlevel].warpdir>0){
if(ed.level[curlevel].warpdir==1){
warpx=true;
background=3;
dwgfx.rcol = ed.getwarpbackground(rx-100,ry-100);
graphics.rcol = ed.getwarpbackground(rx-100,ry-100);
}else if(ed.level[curlevel].warpdir==2){
warpy=true;
background=4;
dwgfx.rcol = ed.getwarpbackground(rx-100,ry-100);
graphics.rcol = ed.getwarpbackground(rx-100,ry-100);
}else if(ed.level[curlevel].warpdir==3){
warpx=true; warpy=true;
background = 5;
dwgfx.rcol = ed.getwarpbackground(rx-100,ry-100);
graphics.rcol = ed.getwarpbackground(rx-100,ry-100);
}
}