Remove global args from Game

I've decided to call dwgfx/game/map/obj/key/help/music the "global args".
Because they're essentially global variables that are being passed
around in args.

This commit removes global args from all functions on the Game class,
and deals with updating the callsites of said functions accordingly. It
also renames all usages of 'dwgfx' in Game.cpp to 'graphics', since the
global variable is called 'graphics' now.

Interesting to note, I was removing the class defines from Game.h, but
it turns out that Graphics.h depends on the mapclass and entityclass
defines from Game.h. And also Graphics.h spelled mapclass wrong (it
forgot the "class") so I just decided to use that existing line instead.
This is only temporary and after all is said and done, at the end of
this pull request those class defines will be gone.
This commit is contained in:
Misa
2020-03-30 17:16:02 -07:00
committed by Ethan Lee
parent 1be398319c
commit 0e561f23f8
8 changed files with 586 additions and 593 deletions

View File

@@ -114,7 +114,7 @@ void gamecompletelogic2(Graphics& dwgfx, Game& game, entityclass& obj, musiccla
game.deletequick();
int tmp=music.currentsong;
music.currentsong=4;
game.savetele(map,obj,music);
game.savetele();
music.currentsong=tmp;
game.telegotoship();
//Return to game
@@ -254,7 +254,7 @@ void towerlogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& musi
{
if (map.resumedelay <= 0)
{
game.lifesequence(obj);
game.lifesequence();
if (game.lifeseq == 0) map.cameramode = 1;
}
else
@@ -268,14 +268,14 @@ void towerlogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& musi
{
map.colsuperstate = 1;
map.cameramode = 2;
game.deathsequence(map, obj, music);
game.deathsequence();
game.deathseq--;
if (game.deathseq <= 0)
{
if (game.nodeathmode)
{
game.deathseq = 1;
game.gethardestroom(map);
game.gethardestroom();
//start depressing sequence here...
if (game.gameoverdelay <= -10 && dwgfx.fademode==0) dwgfx.fademode = 2;
if (dwgfx.fademode == 1) script.resetgametomenu(dwgfx, game, map, obj, help, music);
@@ -297,7 +297,7 @@ void towerlogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& musi
else
{
//State machine for game logic
game.updatestate(dwgfx, map, obj, help, music);
game.updatestate();
//Time trial stuff
@@ -571,7 +571,7 @@ void gamelogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music
obj.upset = 0;
}
game.lifesequence(obj);
game.lifesequence();
if (game.deathseq != -1)
@@ -647,14 +647,14 @@ void gamelogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music
}
}
game.deathsequence(map, obj, music);
game.deathsequence();
game.deathseq--;
if (game.deathseq <= 0)
{
if (game.nodeathmode)
{
game.deathseq = 1;
game.gethardestroom(map);
game.gethardestroom();
//start depressing sequence here...
if (game.gameoverdelay <= -10 && dwgfx.fademode==0) dwgfx.fademode = 2;
if (dwgfx.fademode == 1) script.resetgametomenu(dwgfx, game, map, obj, help, music);
@@ -672,7 +672,7 @@ void gamelogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music
}
}
game.gethardestroom(map);
game.gethardestroom();
game.hascontrol = true;
@@ -715,7 +715,7 @@ void gamelogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music
}
}
//State machine for game logic
game.updatestate(dwgfx, map, obj, help, music);
game.updatestate();
if (game.startscript)
{
script.load(game.newscript);