1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

Remove global args from Logic.cpp

This commit removes the passing around of global args in the logic
functions. Additionally, all 'dwgfx' has been replaced with 'graphics'
in Logic.cpp.
This commit is contained in:
Misa 2020-04-01 14:48:11 -07:00 committed by Ethan Lee
parent 9bc45c586e
commit 2c138a4a60
3 changed files with 55 additions and 55 deletions

View file

@ -5,7 +5,7 @@
extern int temp; extern int temp;
extern scriptclass script; extern scriptclass script;
void titlelogic( Graphics& dwgfx, Game& game, entityclass& obj, UtilityClass& help, musicclass& music, mapclass& map) void titlelogic()
{ {
//Misc //Misc
//map.updatetowerglow(); //map.updatetowerglow();
@ -38,19 +38,19 @@ void titlelogic( Graphics& dwgfx, Game& game, entityclass& obj, UtilityClass& he
} }
} }
void maplogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music, mapclass& map, UtilityClass& help) void maplogic()
{ {
//Misc //Misc
help.updateglow(); help.updateglow();
} }
void gamecompletelogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music, mapclass& map, UtilityClass& help) void gamecompletelogic()
{ {
//Misc //Misc
map.updatetowerglow(); map.updatetowerglow();
help.updateglow(); help.updateglow();
dwgfx.crewframe = 0; graphics.crewframe = 0;
map.tdrawback = true; map.tdrawback = true;
@ -66,18 +66,18 @@ void gamecompletelogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclas
map.bscroll = +1; map.bscroll = +1;
} }
if (dwgfx.fademode == 1) if (graphics.fademode == 1)
{ {
//Fix some graphical things //Fix some graphical things
dwgfx.showcutscenebars = false; graphics.showcutscenebars = false;
dwgfx.cutscenebarspos = 0; graphics.cutscenebarspos = 0;
//Return to game //Return to game
game.gamestate = 7; game.gamestate = 7;
dwgfx.fademode = 4; graphics.fademode = 4;
} }
} }
void gamecompletelogic2(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music, mapclass& map, UtilityClass& help) void gamecompletelogic2()
{ {
//Misc //Misc
map.updatetowerglow(); map.updatetowerglow();
@ -105,11 +105,11 @@ void gamecompletelogic2(Graphics& dwgfx, Game& game, entityclass& obj, musiccla
} }
*/ */
if (dwgfx.fademode == 1) if (graphics.fademode == 1)
{ {
//Fix some graphical things //Fix some graphical things
dwgfx.showcutscenebars = false; graphics.showcutscenebars = false;
dwgfx.cutscenebarspos = 0; graphics.cutscenebarspos = 0;
//Fix the save thingy //Fix the save thingy
game.deletequick(); game.deletequick();
int tmp=music.currentsong; int tmp=music.currentsong;
@ -120,7 +120,7 @@ void gamecompletelogic2(Graphics& dwgfx, Game& game, entityclass& obj, musiccla
//Return to game //Return to game
map.colstate = 10; map.colstate = 10;
game.gamestate = 1; game.gamestate = 1;
dwgfx.fademode = 4; graphics.fademode = 4;
music.playef(18, 10); music.playef(18, 10);
game.createmenu("gamecompletecontinue"); game.createmenu("gamecompletecontinue");
map.nexttowercolour(); map.nexttowercolour();
@ -128,7 +128,7 @@ void gamecompletelogic2(Graphics& dwgfx, Game& game, entityclass& obj, musiccla
} }
void towerlogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music, mapclass& map, UtilityClass& help) void towerlogic()
{ {
//Logic for the tower level //Logic for the tower level
map.updatetowerglow(); map.updatetowerglow();
@ -277,8 +277,8 @@ void towerlogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& musi
game.deathseq = 1; game.deathseq = 1;
game.gethardestroom(); game.gethardestroom();
//start depressing sequence here... //start depressing sequence here...
if (game.gameoverdelay <= -10 && dwgfx.fademode==0) dwgfx.fademode = 2; if (game.gameoverdelay <= -10 && graphics.fademode==0) graphics.fademode = 2;
if (dwgfx.fademode == 1) script.resetgametomenu(); if (graphics.fademode == 1) script.resetgametomenu();
} }
else else
{ {
@ -289,7 +289,7 @@ void towerlogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& musi
} }
game.gravitycontrol = game.savegc; game.gravitycontrol = game.savegc;
dwgfx.textboxremove(); graphics.textboxremove();
map.resetplayer(); map.resetplayer();
} }
} }
@ -376,7 +376,7 @@ void towerlogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& musi
obj.entitycollisioncheck(); // Check ent v ent collisions, update states obj.entitycollisioncheck(); // Check ent v ent collisions, update states
//special for tower: is the player touching any spike blocks? //special for tower: is the player touching any spike blocks?
int player = obj.getplayer(); int player = obj.getplayer();
if(obj.checktowerspikes(player) && dwgfx.fademode==0) if(obj.checktowerspikes(player) && graphics.fademode==0)
{ {
game.deathseq = 30; game.deathseq = 30;
} }
@ -526,7 +526,7 @@ void towerlogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& musi
if (game.teleport_to_new_area) script.teleport(); if (game.teleport_to_new_area) script.teleport();
} }
void gamelogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music, mapclass& map, UtilityClass& help) void gamelogic()
{ {
//Misc //Misc
help.updateglow(); help.updateglow();
@ -656,8 +656,8 @@ void gamelogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music
game.deathseq = 1; game.deathseq = 1;
game.gethardestroom(); game.gethardestroom();
//start depressing sequence here... //start depressing sequence here...
if (game.gameoverdelay <= -10 && dwgfx.fademode==0) dwgfx.fademode = 2; if (game.gameoverdelay <= -10 && graphics.fademode==0) graphics.fademode = 2;
if (dwgfx.fademode == 1) script.resetgametomenu(); if (graphics.fademode == 1) script.resetgametomenu();
} }
else else
{ {
@ -677,7 +677,7 @@ void gamelogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music
game.gravitycontrol = game.savegc; game.gravitycontrol = game.savegc;
dwgfx.textboxremove(); graphics.textboxremove();
map.resetplayer(); map.resetplayer();
} }
} }
@ -832,7 +832,7 @@ void gamelogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music
{ {
game.swncolstate = (game.swncolstate+1)%6; game.swncolstate = (game.swncolstate+1)%6;
game.swncoldelay = 30; game.swncoldelay = 30;
dwgfx.rcol = game.swncolstate; graphics.rcol = game.swncolstate;
obj.swnenemiescol(game.swncolstate); obj.swnenemiescol(game.swncolstate);
} }
} }
@ -1422,7 +1422,7 @@ void gamelogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music
{ {
if (obj.flags[59] == 0) if (obj.flags[59] == 0)
{ {
obj.createentity(225.0f, 169.0f, 18, dwgfx.crewcolour(game.lastsaved), 0, 10); obj.createentity(225.0f, 169.0f, 18, graphics.crewcolour(game.lastsaved), 0, 10);
j = obj.getcompanion(10); j = obj.getcompanion(10);
obj.entities[j].vx = obj.entities[i].vx; obj.entities[j].vx = obj.entities[i].vx;
obj.entities[j].dir = obj.entities[i].dir; obj.entities[j].dir = obj.entities[i].dir;
@ -1432,7 +1432,7 @@ void gamelogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music
{ {
if (obj.flags[59] == 1) if (obj.flags[59] == 1)
{ {
obj.createentity(160.0f, 177.0f, 18, dwgfx.crewcolour(game.lastsaved), 0, 18, 1); obj.createentity(160.0f, 177.0f, 18, graphics.crewcolour(game.lastsaved), 0, 18, 1);
j = obj.getcompanion(10); j = obj.getcompanion(10);
obj.entities[j].vx = obj.entities[i].vx; obj.entities[j].vx = obj.entities[i].vx;
obj.entities[j].dir = obj.entities[i].dir; obj.entities[j].dir = obj.entities[i].dir;
@ -1440,7 +1440,7 @@ void gamelogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music
else else
{ {
obj.flags[59] = 1; obj.flags[59] = 1;
obj.createentity(obj.entities[i].xp, -20.0f, 18.0f, dwgfx.crewcolour(game.lastsaved), 0, 10, 0); obj.createentity(obj.entities[i].xp, -20.0f, 18.0f, graphics.crewcolour(game.lastsaved), 0, 10, 0);
j = obj.getcompanion(10); j = obj.getcompanion(10);
obj.entities[j].vx = obj.entities[i].vx; obj.entities[j].vx = obj.entities[i].vx;
obj.entities[j].dir = obj.entities[i].dir; obj.entities[j].dir = obj.entities[i].dir;
@ -1449,60 +1449,60 @@ void gamelogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music
break; break;
case 11: case 11:
//Intermission 1: We're using the SuperCrewMate instead! //Intermission 1: We're using the SuperCrewMate instead!
//obj.createentity(obj.entities[i].xp, obj.entities[i].yp, 24, dwgfx.crewcolour(game.lastsaved)); //obj.createentity(obj.entities[i].xp, obj.entities[i].yp, 24, graphics.crewcolour(game.lastsaved));
if(game.roomx-41==game.scmprogress) if(game.roomx-41==game.scmprogress)
{ {
switch(game.scmprogress) switch(game.scmprogress)
{ {
case 0: case 0:
obj.createentity(76, 161, 24, dwgfx.crewcolour(game.lastsaved), 2); obj.createentity(76, 161, 24, graphics.crewcolour(game.lastsaved), 2);
break; break;
case 1: case 1:
obj.createentity(10, 169, 24, dwgfx.crewcolour(game.lastsaved), 2); obj.createentity(10, 169, 24, graphics.crewcolour(game.lastsaved), 2);
break; break;
case 2: case 2:
obj.createentity(10, 177, 24, dwgfx.crewcolour(game.lastsaved), 2); obj.createentity(10, 177, 24, graphics.crewcolour(game.lastsaved), 2);
break; break;
case 3: case 3:
if (game.scmmoveme) if (game.scmmoveme)
{ {
obj.createentity(obj.entities[obj.getplayer()].xp, 185, 24, dwgfx.crewcolour(game.lastsaved), 2); obj.createentity(obj.entities[obj.getplayer()].xp, 185, 24, graphics.crewcolour(game.lastsaved), 2);
game.scmmoveme = false; game.scmmoveme = false;
} }
else else
{ {
obj.createentity(10, 177, 24, dwgfx.crewcolour(game.lastsaved), 2); obj.createentity(10, 177, 24, graphics.crewcolour(game.lastsaved), 2);
} }
break; break;
case 4: case 4:
obj.createentity(10, 185, 24, dwgfx.crewcolour(game.lastsaved), 2); obj.createentity(10, 185, 24, graphics.crewcolour(game.lastsaved), 2);
break; break;
case 5: case 5:
obj.createentity(10, 185, 24, dwgfx.crewcolour(game.lastsaved), 2); obj.createentity(10, 185, 24, graphics.crewcolour(game.lastsaved), 2);
break; break;
case 6: case 6:
obj.createentity(10, 185, 24, dwgfx.crewcolour(game.lastsaved), 2); obj.createentity(10, 185, 24, graphics.crewcolour(game.lastsaved), 2);
break; break;
case 7: case 7:
obj.createentity(10, 41, 24, dwgfx.crewcolour(game.lastsaved), 2); obj.createentity(10, 41, 24, graphics.crewcolour(game.lastsaved), 2);
break; break;
case 8: case 8:
obj.createentity(10, 169, 24, dwgfx.crewcolour(game.lastsaved), 2); obj.createentity(10, 169, 24, graphics.crewcolour(game.lastsaved), 2);
break; break;
case 9: case 9:
obj.createentity(10, 169, 24, dwgfx.crewcolour(game.lastsaved), 2); obj.createentity(10, 169, 24, graphics.crewcolour(game.lastsaved), 2);
break; break;
case 10: case 10:
obj.createentity(10, 129, 24, dwgfx.crewcolour(game.lastsaved), 2); obj.createentity(10, 129, 24, graphics.crewcolour(game.lastsaved), 2);
break; break;
case 11: case 11:
obj.createentity(10, 129, 24, dwgfx.crewcolour(game.lastsaved), 2); obj.createentity(10, 129, 24, graphics.crewcolour(game.lastsaved), 2);
break; break;
case 12: case 12:
obj.createentity(10, 65, 24, dwgfx.crewcolour(game.lastsaved), 2); obj.createentity(10, 65, 24, graphics.crewcolour(game.lastsaved), 2);
break; break;
case 13: case 13:
obj.createentity(10, 177, 24, dwgfx.crewcolour(game.lastsaved)); obj.createentity(10, 177, 24, graphics.crewcolour(game.lastsaved));
break; break;
} }
} }

View file

@ -8,16 +8,16 @@
#include "Music.h" #include "Music.h"
#include "Map.h" #include "Map.h"
void titlelogic(Graphics& dwgfx, Game& game, entityclass& obj, UtilityClass& help, musicclass& music, mapclass& map); void titlelogic();
void maplogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music, mapclass& map, UtilityClass& help); void maplogic();
void gamecompletelogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music, mapclass& map, UtilityClass& help); void gamecompletelogic();
void gamecompletelogic2(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music, mapclass& map, UtilityClass& help); void gamecompletelogic2();
void towerlogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music, mapclass& map, UtilityClass& help); void towerlogic();
void gamelogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music, mapclass& map, UtilityClass& help); void gamelogic();
#endif /* LOGIC_H */ #endif /* LOGIC_H */

View file

@ -376,7 +376,7 @@ int main(int argc, char *argv[])
//Render //Render
titlerender(graphics, map, game, obj, help, music); titlerender(graphics, map, game, obj, help, music);
////Logic ////Logic
titlelogic(graphics, game, obj, help, music, map); titlelogic();
break; break;
case GAMEMODE: case GAMEMODE:
if (map.towermode) if (map.towermode)
@ -391,7 +391,7 @@ int main(int argc, char *argv[])
//{ //{
//} //}
towerrender(graphics, game, map, obj, help); towerrender(graphics, game, map, obj, help);
towerlogic(graphics, game, obj, music, map, help); towerlogic();
} }
else else
@ -411,7 +411,7 @@ int main(int argc, char *argv[])
gameinput(key, graphics, game, map, obj, help, music); gameinput(key, graphics, game, map, obj, help, music);
//} //}
gamerender(graphics,map, game, obj, help); gamerender(graphics,map, game, obj, help);
gamelogic(graphics, game,obj, music, map, help); gamelogic();
} }
@ -426,7 +426,7 @@ int main(int argc, char *argv[])
{ {
mapinput(key, graphics, game, map, obj, help, music); mapinput(key, graphics, game, map, obj, help, music);
} }
maplogic(graphics, game, obj ,music , map, help ); maplogic();
break; break;
case TELEPORTERMODE: case TELEPORTERMODE:
teleporterrender(graphics, game, map, obj, help); teleporterrender(graphics, game, map, obj, help);
@ -449,21 +449,21 @@ int main(int argc, char *argv[])
gameinput(key, graphics, game, map, obj, help, music); gameinput(key, graphics, game, map, obj, help, music);
} }
} }
maplogic(graphics, game, obj, music, map, help); maplogic();
break; break;
case GAMECOMPLETE: case GAMECOMPLETE:
gamecompleterender(graphics, game, obj, help, map); gamecompleterender(graphics, game, obj, help, map);
//Input //Input
gamecompleteinput(key, graphics, game, map, obj, help, music); gamecompleteinput(key, graphics, game, map, obj, help, music);
//Logic //Logic
gamecompletelogic(graphics, game, obj, music, map, help); gamecompletelogic();
break; break;
case GAMECOMPLETE2: case GAMECOMPLETE2:
gamecompleterender2(graphics, game, obj, help); gamecompleterender2(graphics, game, obj, help);
//Input //Input
gamecompleteinput2(key, graphics, game, map, obj, help, music); gamecompleteinput2(key, graphics, game, map, obj, help, music);
//Logic //Logic
gamecompletelogic2(graphics, game, obj, music, map, help); gamecompletelogic2();
break; break;
case CLICKTOSTART: case CLICKTOSTART: