1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-18 10:38:31 +02:00

Remove global args from Input.cpp

This removes all global args from functions in Input.cpp. Additionally,
'dwgfx' has been renamed to 'graphics' in Input.cpp.
This commit is contained in:
Misa 2020-04-01 14:52:45 -07:00 committed by Ethan Lee
parent 2c138a4a60
commit a1fd4c6f02
3 changed files with 164 additions and 175 deletions

View File

@ -10,9 +10,9 @@
extern scriptclass script;
// Found in titlerender.cpp
void updategraphicsmode(Game& game, Graphics& dwgfx);
void updategraphicsmode(Game& game, Graphics& graphics);
void updatebuttonmappings(Game& game, KeyPoll& key, musicclass& music, int bind)
void updatebuttonmappings(int bind)
{
for (
SDL_GameControllerButton i = SDL_CONTROLLER_BUTTON_A;
@ -113,7 +113,7 @@ void updatebuttonmappings(Game& game, KeyPoll& key, musicclass& music, int bind)
}
}
void titleinput(KeyPoll& key, Graphics& dwgfx, mapclass& map, Game& game, entityclass& obj, UtilityClass& help, musicclass& music)
void titleinput()
{
//game.mx = (mouseX / 4);
//game.my = (mouseY / 4);
@ -126,7 +126,7 @@ void titleinput(KeyPoll& key, Graphics& dwgfx, mapclass& map, Game& game, entity
game.press_action = false;
game.press_map = false;
if (dwgfx.flipmode)
if (graphics.flipmode)
{
//GAMEPAD TODO
if (key.isDown(KEYBOARD_LEFT) || key.isDown(KEYBOARD_DOWN) || key.isDown(KEYBOARD_a) || key.isDown(KEYBOARD_s) || key.controllerWantsRight(true)) game.press_left = true;
@ -151,7 +151,7 @@ void titleinput(KeyPoll& key, Graphics& dwgfx, mapclass& map, Game& game, entity
if (!game.press_action && !game.press_left && !game.press_right) game.jumpheld = false;
if (!game.press_map) game.mapheld = false;
if (!game.jumpheld && dwgfx.fademode==0)
if (!game.jumpheld && graphics.fademode==0)
{
if (game.press_action || game.press_left || game.press_right || game.press_map)
{
@ -180,14 +180,14 @@ void titleinput(KeyPoll& key, Graphics& dwgfx, mapclass& map, Game& game, entity
game.flashlight = 5;
}else{
if(game.mainmenu==0){
dwgfx.fademode = 2;
graphics.fademode = 2;
}else if (game.mainmenu == 1) {
if (game.telesummary != "") {
dwgfx.fademode = 2;
graphics.fademode = 2;
}
}else if (game.mainmenu == 2) {
if (game.quicksummary != "") {
dwgfx.fademode = 2;
graphics.fademode = 2;
}
}
}
@ -270,7 +270,7 @@ void titleinput(KeyPoll& key, Graphics& dwgfx, mapclass& map, Game& game, entity
//bye!
music.playef(2, 10);
game.mainmenu = 100;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
}
#elif !defined(MAKEANDPLAY)
@ -282,7 +282,7 @@ void titleinput(KeyPoll& key, Graphics& dwgfx, mapclass& map, Game& game, entity
{
//No saves exist, just start a new game
game.mainmenu = 0;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else
{
@ -327,7 +327,7 @@ void titleinput(KeyPoll& key, Graphics& dwgfx, mapclass& map, Game& game, entity
//bye!
music.playef(2, 10);
game.mainmenu = 100;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
#else
if (game.currentmenuoption == 0)
@ -337,7 +337,7 @@ void titleinput(KeyPoll& key, Graphics& dwgfx, mapclass& map, Game& game, entity
{
//No saves exist, just start a new game
game.mainmenu = 0;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else
{
@ -389,7 +389,7 @@ void titleinput(KeyPoll& key, Graphics& dwgfx, mapclass& map, Game& game, entity
//bye!
music.playef(2, 10);
game.mainmenu = 100;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
#endif
}
@ -425,7 +425,7 @@ void titleinput(KeyPoll& key, Graphics& dwgfx, mapclass& map, Game& game, entity
TiXmlDocument doc;
if (!FILESYSTEM_loadTiXmlDocument(name.c_str(), &doc)){
game.mainmenu = 22;
dwgfx.fademode = 2;
graphics.fademode = 2;
}else{
game.createmenu("quickloadlevel");
map.nexttowercolour();
@ -437,10 +437,10 @@ void titleinput(KeyPoll& key, Graphics& dwgfx, mapclass& map, Game& game, entity
{
if(game.currentmenuoption==0){//continue save
game.mainmenu = 23;
dwgfx.fademode = 2;
graphics.fademode = 2;
}else if(game.currentmenuoption==1){
game.mainmenu = 22;
dwgfx.fademode = 2;
graphics.fademode = 2;
}else if(game.currentmenuoption==2){
music.playef(11, 10);
game.levelpage=0;
@ -464,7 +464,7 @@ void titleinput(KeyPoll& key, Graphics& dwgfx, mapclass& map, Game& game, entity
//LEVEL EDITOR HOOK
music.playef(11, 10);
game.mainmenu = 20;
dwgfx.fademode = 2;
graphics.fademode = 2;
ed.filename="";
}/*else if(game.currentmenuoption==2){
music.playef(11, 10);
@ -508,25 +508,25 @@ SDL_assert(0 && "Remove open level dir");
{
if (game.currentmenuoption == 0){
music.playef(11, 10);
dwgfx.screenbuffer->toggleFullScreen();
graphics.screenbuffer->toggleFullScreen();
game.fullscreen = !game.fullscreen;
updategraphicsmode(game, dwgfx);
updategraphicsmode(game, graphics);
game.savestats();
game.createmenu("graphicoptions");
game.currentmenuoption = 0;
}else if (game.currentmenuoption == 1){
music.playef(11, 10);
dwgfx.screenbuffer->toggleStretchMode();
graphics.screenbuffer->toggleStretchMode();
game.stretchMode = (game.stretchMode + 1) % 3;
updategraphicsmode(game, dwgfx);
updategraphicsmode(game, graphics);
game.savestats();
game.createmenu("graphicoptions");
game.currentmenuoption = 1;
}else if (game.currentmenuoption == 2){
music.playef(11, 10);
dwgfx.screenbuffer->toggleLinearFilter();
graphics.screenbuffer->toggleLinearFilter();
game.useLinearFilter = !game.useLinearFilter;
updategraphicsmode(game, dwgfx);
updategraphicsmode(game, graphics);
game.savestats();
game.createmenu("graphicoptions");
game.currentmenuoption = 2;
@ -535,21 +535,21 @@ SDL_assert(0 && "Remove open level dir");
music.playef(11, 10);
game.fullScreenEffect_badSignal = !game.fullScreenEffect_badSignal;
//Hook the analogue thing in here: ABCDEFG
updategraphicsmode(game, dwgfx);
dwgfx.screenbuffer->badSignalEffect= !dwgfx.screenbuffer->badSignalEffect;
updategraphicsmode(game, graphics);
graphics.screenbuffer->badSignalEffect= !graphics.screenbuffer->badSignalEffect;
game.savestats();
game.createmenu("graphicoptions");
game.currentmenuoption = 3;
}else if (game.currentmenuoption == 4) {
//toggle mouse cursor
music.playef(11, 10);
if (dwgfx.showmousecursor == true) {
if (graphics.showmousecursor == true) {
SDL_ShowCursor(SDL_DISABLE);
dwgfx.showmousecursor = false;
graphics.showmousecursor = false;
}
else {
SDL_ShowCursor(SDL_ENABLE);
dwgfx.showmousecursor = true;
graphics.showmousecursor = true;
}
}
else
@ -566,7 +566,7 @@ SDL_assert(0 && "Remove open level dir");
if (game.currentmenuoption == 0)
{
//toggle fullscreen
dwgfx.screenbuffer->toggleFullScreen();
graphics.screenbuffer->toggleFullScreen();
music.playef(11, 10);
if (game.fullscreen)
{
@ -576,7 +576,7 @@ SDL_assert(0 && "Remove open level dir");
{
game.fullscreen = true;
}
updategraphicsmode(game, dwgfx);
updategraphicsmode(game, graphics);
game.savestats();
game.createmenu("graphicoptions");
}
@ -588,10 +588,10 @@ SDL_assert(0 && "Remove open level dir");
if (game.fullscreen)
{
game.fullscreen = false;
updategraphicsmode(game, dwgfx);
updategraphicsmode(game, graphics);
game.fullscreen = true;
}
updategraphicsmode(game, dwgfx);
updategraphicsmode(game, graphics);
game.savestats();
game.createmenu("graphicoptions");
@ -602,9 +602,9 @@ SDL_assert(0 && "Remove open level dir");
//change scaling mode
music.playef(11, 10);
game.advanced_scaling = (game.advanced_scaling + 1) % 5;
dwgfx.screenbuffer->ResizeScreen(320 *game.advanced_scaling,240*game.advanced_scaling );
dwgfx.screenbuffer->SetScale(game.advanced_scaling);
updategraphicsmode(game, dwgfx);
graphics.screenbuffer->ResizeScreen(320 *game.advanced_scaling,240*game.advanced_scaling );
graphics.screenbuffer->SetScale(game.advanced_scaling);
updategraphicsmode(game, graphics);
game.savestats();
game.createmenu("graphicoptions");
@ -615,7 +615,7 @@ SDL_assert(0 && "Remove open level dir");
//change smoothing
music.playef(11, 10);
game.advanced_smoothing = !game.advanced_smoothing;
updategraphicsmode(game, dwgfx);
updategraphicsmode(game, graphics);
game.savestats();
game.createmenu("graphicoptions");
@ -633,7 +633,7 @@ SDL_assert(0 && "Remove open level dir");
{
if (game.currentmenuoption == 0)
{
dwgfx.screenbuffer->toggleFullScreen();
graphics.screenbuffer->toggleFullScreen();
//toggle fullscreen
music.playef(11, 10);
if (game.fullscreen)
@ -644,7 +644,7 @@ SDL_assert(0 && "Remove open level dir");
{
game.fullscreen = true;
}
updategraphicsmode(game, dwgfx);
updategraphicsmode(game, graphics);
game.savestats();
game.createmenu("graphicoptions");
@ -657,10 +657,10 @@ SDL_assert(0 && "Remove open level dir");
if (game.fullscreen)
{
game.fullscreen = false;
updategraphicsmode(game, dwgfx);
updategraphicsmode(game, graphics);
game.fullscreen = true;
}
updategraphicsmode(game, dwgfx);
updategraphicsmode(game, graphics);
game.savestats();
game.createmenu("graphicoptions");
@ -683,7 +683,7 @@ SDL_assert(0 && "Remove open level dir");
//bye!
music.playef(2, 10);
game.mainmenu = 100;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else
{
@ -805,7 +805,7 @@ SDL_assert(0 && "Remove open level dir");
else if (game.currentmenuoption == 2)
{
//disable text outline
dwgfx.notextoutline = !dwgfx.notextoutline;
graphics.notextoutline = !graphics.notextoutline;
game.savestats();
music.playef(11, 10);
}
@ -839,7 +839,7 @@ SDL_assert(0 && "Remove open level dir");
else if (game.currentmenuoption == 6)
{
// toggle translucent roomname BG
dwgfx.translucentroomname = !dwgfx.translucentroomname;
graphics.translucentroomname = !graphics.translucentroomname;
music.playef(11, 10);
}
else if (game.currentmenuoption == 7)
@ -1301,13 +1301,13 @@ SDL_assert(0 && "Remove open level dir");
{
//You at least have a quicksave, or you couldn't have gotten here
game.mainmenu = 2;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.quicksummary == "")
{
//You at least have a telesave, or you couldn't have gotten here
game.mainmenu = 1;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else
{
@ -1351,13 +1351,13 @@ SDL_assert(0 && "Remove open level dir");
{
//You at least have a quicksave, or you couldn't have gotten here
game.mainmenu = 2;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.quicksummary == "")
{
//You at least have a telesave, or you couldn't have gotten here
game.mainmenu = 1;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else
{
@ -1372,7 +1372,7 @@ SDL_assert(0 && "Remove open level dir");
{
if(!map.invincibility){
game.mainmenu = 11;
dwgfx.fademode = 2;
graphics.fademode = 2;
}else{
//Can't do yet! play sad sound
music.playef(2, 10);
@ -1406,7 +1406,7 @@ SDL_assert(0 && "Remove open level dir");
{
//yep
game.mainmenu = 0;
dwgfx.fademode = 2;
graphics.fademode = 2;
game.deletequick();
game.deletetele();
}
@ -1519,7 +1519,7 @@ SDL_assert(0 && "Remove open level dir");
music.playef(18, 10);
game.screenshake = 10;
game.flashlight = 5;
dwgfx.setflipmode = !dwgfx.setflipmode;
graphics.setflipmode = !graphics.setflipmode;
game.savemystats = true;
}
else if (game.currentmenuoption == 4)
@ -1540,12 +1540,12 @@ SDL_assert(0 && "Remove open level dir");
if (game.currentmenuoption == 0) //start no death mode, disabling cutscenes
{
game.mainmenu = 10;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.currentmenuoption == 1)
{
game.mainmenu = 9;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.currentmenuoption == 2)
{
@ -1560,12 +1560,12 @@ SDL_assert(0 && "Remove open level dir");
if (game.currentmenuoption == 0)
{
game.mainmenu = 1;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.currentmenuoption == 1)
{
game.mainmenu = 2;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.currentmenuoption == 2)
{
@ -1604,22 +1604,22 @@ SDL_assert(0 && "Remove open level dir");
if (game.currentmenuoption == 0)
{
game.mainmenu = 12;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.currentmenuoption == 1)
{
game.mainmenu = 13;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.currentmenuoption == 2)
{
game.mainmenu = 14;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.currentmenuoption == 3)
{
game.mainmenu = 15;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.currentmenuoption == 4)
{
@ -1634,22 +1634,22 @@ SDL_assert(0 && "Remove open level dir");
if (game.currentmenuoption == 0)
{
game.mainmenu = 16;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.currentmenuoption == 1)
{
game.mainmenu = 17;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.currentmenuoption == 2)
{
game.mainmenu = 18;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.currentmenuoption == 3)
{
game.mainmenu = 19;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.currentmenuoption == 4)
{
@ -1687,32 +1687,32 @@ SDL_assert(0 && "Remove open level dir");
if (game.currentmenuoption == 0 && game.unlock[9]) //space station 1
{
game.mainmenu = 3;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.currentmenuoption == 1 && game.unlock[10]) //lab
{
game.mainmenu = 4;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.currentmenuoption == 2 && game.unlock[11]) //tower
{
game.mainmenu = 5;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.currentmenuoption == 3 && game.unlock[12]) //station 2
{
game.mainmenu = 6;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.currentmenuoption == 4 && game.unlock[13]) //warp
{
game.mainmenu = 7;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.currentmenuoption == 5 && game.unlock[14]) //final
{
game.mainmenu = 8;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.currentmenuoption == 6) //go to the time trial menu
{
@ -1743,32 +1743,32 @@ SDL_assert(0 && "Remove open level dir");
if (game.timetriallevel == 0) //space station 1
{
game.mainmenu = 3;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.timetriallevel == 1) //lab
{
game.mainmenu = 4;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.timetriallevel == 2) //tower
{
game.mainmenu = 5;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.timetriallevel == 3) //station 2
{
game.mainmenu = 6;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.timetriallevel == 4) //warp
{
game.mainmenu = 7;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
else if (game.timetriallevel == 5) //final
{
game.mainmenu = 8;
dwgfx.fademode = 2;
graphics.fademode = 2;
}
}
}
@ -1789,17 +1789,16 @@ SDL_assert(0 && "Remove open level dir");
game.currentmenuoption < 4 &&
key.controllerButtonDown() )
{
updatebuttonmappings(game, key, music, game.currentmenuoption);
updatebuttonmappings(game.currentmenuoption);
}
}
if (dwgfx.fademode == 1)
if (graphics.fademode == 1)
script.startgamemode(game.mainmenu);
}
void gameinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
entityclass& obj, UtilityClass& help, musicclass& music)
void gameinput()
{
//TODO mouse input
//game.mx = (mouseX / 2);
@ -1924,18 +1923,18 @@ void gameinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
/*
if (key.isDown("1".charCodeAt(0))) {
dwgfx.screen.width = 640;
dwgfx.screen.height = 480;
graphics.screen.width = 640;
graphics.screen.height = 480;
setstage(640,480);
}
if (key.isDown("2".charCodeAt(0))) {
dwgfx.screen.width = 960;
dwgfx.screen.height = 720;
graphics.screen.width = 960;
graphics.screen.height = 720;
setstage(960,720);
}
if (key.isDown("3".charCodeAt(0))) {
dwgfx.screen.width = 1280;
dwgfx.screen.height = 960;
graphics.screen.width = 1280;
graphics.screen.height = 960;
setstage(1280,960);
}
*/
@ -1952,7 +1951,7 @@ void gameinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
if (key.isDown("9".charCodeAt(0))) game.inertia = 1.3;
if (key.isDown("0".charCodeAt(0))) game.inertia = 1.4;*/
if (game.intimetrial && dwgfx.fademode == 1 && game.quickrestartkludge)
if (game.intimetrial && graphics.fademode == 1 && game.quickrestartkludge)
{
//restart the time trial
game.quickrestartkludge = false;
@ -1976,14 +1975,14 @@ void gameinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
}else{
game.gamestate = EDITORMODE;
dwgfx.textboxremove();
graphics.textboxremove();
game.hascontrol = true;
game.advancetext = false;
game.completestop = false;
game.state = 0;
dwgfx.showcutscenebars = false;
graphics.showcutscenebars = false;
dwgfx.backgrounddrawn=false;
graphics.backgrounddrawn=false;
music.fadeout();
//If warpdir() is used during playtesting, we need to set it back after!
for (int j = 0; j < ed.maxheight; j++)
@ -2016,7 +2015,7 @@ void gameinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
/*
if (key.isDown(27)) {
game.state = 0;
dwgfx.textboxremove();
graphics.textboxremove();
map.tdrawback = true;
music.haltdasmusik();
@ -2030,7 +2029,7 @@ void gameinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
if (game.activetele && game.readytotele > 20 && !game.intimetrial)
{
if(!dwgfx.flipmode)
if(!graphics.flipmode)
{
obj.flags[73] = 1; //Flip mode test
}
@ -2060,15 +2059,15 @@ void gameinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
{
//Alright, normal teleporting
game.gamestate = 5;
dwgfx.menuoffset = 240; //actually this should count the roomname
if (map.extrarow) dwgfx.menuoffset -= 10;
//dwgfx.menubuffer.copyPixels(dwgfx.screenbuffer, dwgfx.screenbuffer.rect, dwgfx.tl, null, null, false);
graphics.menuoffset = 240; //actually this should count the roomname
if (map.extrarow) graphics.menuoffset -= 10;
//graphics.menubuffer.copyPixels(graphics.screenbuffer, graphics.screenbuffer.rect, graphics.tl, null, null, false);
//TODO TESTHIS
//dwgfx.screenbuffer->UpdateScreen(dwgfx.menubuffer, NULL);
BlitSurfaceStandard(dwgfx.menubuffer,NULL,dwgfx.backBuffer, NULL);
//graphics.screenbuffer->UpdateScreen(graphics.menubuffer, NULL);
BlitSurfaceStandard(graphics.menubuffer,NULL,graphics.backBuffer, NULL);
dwgfx.resumegamemode = false;
graphics.resumegamemode = false;
game.useteleporter = true;
game.initteleportermode();
@ -2110,38 +2109,38 @@ void gameinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
//Quit menu, same conditions as in game menu
game.gamestate = MAPMODE;
game.gamesaved = false;
dwgfx.resumegamemode = false;
graphics.resumegamemode = false;
game.menupage = 20; // The Map Page
//dwgfx.menubuffer.copyPixels(dwgfx.screenbuffer, dwgfx.screenbuffer.rect, dwgfx.tl, null, null, false);
//dwgfx.screenbuffer->UpdateScreen(dwgfx.menubuffer, NULL);
BlitSurfaceStandard(dwgfx.menubuffer,NULL,dwgfx.backBuffer, NULL);
dwgfx.menuoffset = 240; //actually this should count the roomname
if (map.extrarow) dwgfx.menuoffset -= 10;
//graphics.menubuffer.copyPixels(graphics.screenbuffer, graphics.screenbuffer.rect, graphics.tl, null, null, false);
//graphics.screenbuffer->UpdateScreen(graphics.menubuffer, NULL);
BlitSurfaceStandard(graphics.menubuffer,NULL,graphics.backBuffer, NULL);
graphics.menuoffset = 240; //actually this should count the roomname
if (map.extrarow) graphics.menuoffset -= 10;
}
else if (game.intimetrial && dwgfx.fademode==0)
else if (game.intimetrial && graphics.fademode==0)
{
//Quick restart of time trial
script.hardreset();
if (dwgfx.setflipmode) dwgfx.flipmode = true;
dwgfx.fademode = 2;
if (graphics.setflipmode) graphics.flipmode = true;
graphics.fademode = 2;
game.completestop = true;
music.fadeout();
game.intimetrial = true;
game.quickrestartkludge = true;
}
else if (dwgfx.fademode==0)
else if (graphics.fademode==0)
{
//Normal map screen, do transition later
game.gamestate = MAPMODE;
map.cursordelay = 0;
map.cursorstate = 0;
game.gamesaved = false;
dwgfx.resumegamemode = false;
graphics.resumegamemode = false;
game.menupage = 0; // The Map Page
BlitSurfaceStandard(dwgfx.menubuffer,NULL,dwgfx.backBuffer, NULL);
//dwgfx.screenbuffer->UpdateScreen(dwgfx.menubuffer, NULL);
dwgfx.menuoffset = 240; //actually this should count the roomname
if (map.extrarow) dwgfx.menuoffset -= 10;
BlitSurfaceStandard(graphics.menubuffer,NULL,graphics.backBuffer, NULL);
//graphics.screenbuffer->UpdateScreen(graphics.menubuffer, NULL);
graphics.menuoffset = 240; //actually this should count the roomname
if (map.extrarow) graphics.menuoffset -= 10;
}
}
@ -2151,15 +2150,15 @@ void gameinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
//Quit menu, same conditions as in game menu
game.gamestate = MAPMODE;
game.gamesaved = false;
dwgfx.resumegamemode = false;
graphics.resumegamemode = false;
game.menupage = 10; // The Map Page
//dwgfx.menubuffer.copyPixels(dwgfx.screenbuffer, dwgfx.screenbuffer.rect, dwgfx.tl, NULL, NULL, false);
//graphics.menubuffer.copyPixels(graphics.screenbuffer, graphics.screenbuffer.rect, graphics.tl, NULL, NULL, false);
//dwgfx.screenbuffer->UpdateScreen(dwgfx.menubuffer, NULL);
BlitSurfaceStandard(dwgfx.menubuffer,NULL,dwgfx.backBuffer, NULL);
dwgfx.menuoffset = 240; //actually this should count the roomname
if (map.extrarow) dwgfx.menuoffset -= 10;
//graphics.screenbuffer->UpdateScreen(graphics.menubuffer, NULL);
BlitSurfaceStandard(graphics.menubuffer,NULL,graphics.backBuffer, NULL);
graphics.menuoffset = 240; //actually this should count the roomname
if (map.extrarow) graphics.menuoffset -= 10;
}
if (key.keymap[SDLK_r] && game.deathseq<=0)// && map.custommode) //Have fun glitchrunners!
@ -2267,8 +2266,7 @@ void gameinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
}
}
void mapinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
entityclass& obj, UtilityClass& help, musicclass& music)
void mapinput()
{
//TODO Mouse Input!
//game.mx = (mouseX / 2);
@ -2279,9 +2277,9 @@ void mapinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
game.press_action = false;
game.press_map = false;
if(dwgfx.menuoffset==0)
if(graphics.menuoffset==0)
{
if (dwgfx.flipmode)
if (graphics.flipmode)
{
if (key.isDown(KEYBOARD_LEFT) || key.isDown(KEYBOARD_DOWN) || key.isDown(KEYBOARD_a) || key.isDown(KEYBOARD_s) || key.controllerWantsLeft(false) ) game.press_left = true;
if (key.isDown(KEYBOARD_RIGHT) || key.isDown(KEYBOARD_UP) || key.isDown(KEYBOARD_d) || key.isDown(KEYBOARD_w) || key.controllerWantsRight(false)) game.press_right = true;
@ -2336,14 +2334,14 @@ void mapinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
if(game.press_map && game.menupage < 10)
{
//Normal map screen, do transition later
dwgfx.resumegamemode = true;
graphics.resumegamemode = true;
}
}
if (dwgfx.fademode == 1)
if (graphics.fademode == 1)
{
FillRect(dwgfx.menubuffer, 0x000000);
dwgfx.resumegamemode = true;
FillRect(graphics.menubuffer, 0x000000);
graphics.resumegamemode = true;
obj.removeallblocks();
game.menukludge = false;
if (game.menupage >= 20)
@ -2377,7 +2375,7 @@ void mapinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
if (game.menupage == 1 && obj.flags[67] == 1 && game.press_action && !game.insecretlab && !map.custommode)
{
//Warp back to the ship
dwgfx.resumegamemode = true;
graphics.resumegamemode = true;
game.teleport_to_x = 2;
game.teleport_to_y = 11;
@ -2424,20 +2422,20 @@ void mapinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
if (game.menupage == 10 && game.press_action)
{
//return to game
dwgfx.resumegamemode = true;
graphics.resumegamemode = true;
}
if (game.menupage == 11 && game.press_action)
{
//quit to menu
if (dwgfx.fademode == 0)
if (graphics.fademode == 0)
{
//Kill contents of offset render buffer, since we do that for some reason.
//This fixes an apparent frame flicker.
FillRect(dwgfx.tempBuffer, 0x000000);
FillRect(graphics.tempBuffer, 0x000000);
if (game.intimetrial || game.insecretlab || game.nodeathmode) game.menukludge = true;
script.hardreset();
if(dwgfx.setflipmode) dwgfx.flipmode = true;
dwgfx.fademode = 2;
if(graphics.setflipmode) graphics.flipmode = true;
graphics.fademode = 2;
music.fadeout();
map.nexttowercolour();
}
@ -2446,15 +2444,15 @@ void mapinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
if (game.menupage == 20 && game.press_action)
{
//return to game
dwgfx.resumegamemode = true;
graphics.resumegamemode = true;
}
if (game.menupage == 21 && game.press_action)
{
//quit to menu
if (dwgfx.fademode == 0)
if (graphics.fademode == 0)
{
game.swnmode = false;
dwgfx.fademode = 2;
graphics.fademode = 2;
music.fadeout();
}
}
@ -2471,8 +2469,7 @@ void mapinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
}
}
void teleporterinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
entityclass& obj, UtilityClass& help, musicclass& music)
void teleporterinput()
{
//Todo Mouseinput!
//game.mx = (mouseX / 2);
@ -2485,7 +2482,7 @@ void teleporterinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
game.press_action = false;
game.press_map = false;
if(dwgfx.menuoffset==0)
if(graphics.menuoffset==0)
{
if (key.isDown(KEYBOARD_LEFT)|| key.isDown(KEYBOARD_a) || key.controllerWantsLeft(false) ) game.press_left = true;
if (key.isDown(KEYBOARD_RIGHT) || key.isDown(KEYBOARD_d)|| key.controllerWantsRight(false) ) game.press_right = true;
@ -2546,12 +2543,12 @@ void teleporterinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
if (game.roomx == tempx + 100 && game.roomy == tempy + 100)
{
//cancel!
dwgfx.resumegamemode = true;
graphics.resumegamemode = true;
}
else
{
//teleport
dwgfx.resumegamemode = true;
graphics.resumegamemode = true;
game.teleport_to_x = tempx;
game.teleport_to_y = tempy;
@ -2574,8 +2571,7 @@ void teleporterinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
}
}
void gamecompleteinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
entityclass& obj, UtilityClass& help, musicclass& music)
void gamecompleteinput()
{
//game.mx = (mouseX / 2);
//game.my = (mouseY / 2);
@ -2590,9 +2586,9 @@ void gamecompleteinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
game.creditposition -= 6;
if (game.creditposition <= -game.creditmaxposition)
{
if(dwgfx.fademode==0)
if(graphics.fademode==0)
{
dwgfx.fademode = 2;
graphics.fademode = 2;
}
game.creditposition = -game.creditmaxposition;
}
@ -2611,16 +2607,15 @@ void gamecompleteinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
if(game.press_map)
{
//Return to game
if(dwgfx.fademode==0)
if(graphics.fademode==0)
{
dwgfx.fademode = 2;
graphics.fademode = 2;
}
}
}
}
void gamecompleteinput2(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
entityclass& obj, UtilityClass& help, musicclass& music)
void gamecompleteinput2()
{
//TODO Mouse Input!
//game.mx = (mouseX / 2);
@ -2638,9 +2633,9 @@ void gamecompleteinput2(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map
game.creditposx++;
if (game.creditposy >= 30)
{
if(dwgfx.fademode==0)
if(graphics.fademode==0)
{
dwgfx.fademode = 2;
graphics.fademode = 2;
music.fadeout();
}
}
@ -2654,9 +2649,9 @@ void gamecompleteinput2(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map
if(game.press_map)
{
//Return to game
if(dwgfx.fademode==0)
if(graphics.fademode==0)
{
dwgfx.fademode = 2;
graphics.fademode = 2;
music.fadeout();
}
}

View File

@ -9,22 +9,16 @@
#include "Music.h"
#include "Map.h"
void titleinput(KeyPoll& key, Graphics& dwgfx, mapclass& map, Game& game,
entityclass& obj, UtilityClass& help, musicclass& music);
void titleinput();
void gameinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
entityclass& obj, UtilityClass& help, musicclass& music);
void gameinput();
void mapinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
entityclass& obj, UtilityClass& help, musicclass& music);
void mapinput();
void teleporterinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
entityclass& obj, UtilityClass& help, musicclass& music);
void teleporterinput();
void gamecompleteinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
entityclass& obj, UtilityClass& help, musicclass& music);
void gamecompleteinput();
void gamecompleteinput2(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
entityclass& obj, UtilityClass& help, musicclass& music);
void gamecompleteinput2();
#endif /* INPUT_H */

View File

@ -372,7 +372,7 @@ int main(int argc, char *argv[])
#endif
case TITLEMODE:
//Input
titleinput(key, graphics, map, game, obj, help, music);
titleinput();
//Render
titlerender(graphics, map, game, obj, help, music);
////Logic
@ -381,11 +381,11 @@ int main(int argc, char *argv[])
case GAMEMODE:
if (map.towermode)
{
gameinput(key, graphics, game, map, obj, help, music);
gameinput();
//if(game.recording==1)
//{
// ///recordinput(key, graphics, game, map, obj, help, music);
// ///recordinput();
//}
//else
//{
@ -399,7 +399,7 @@ int main(int argc, char *argv[])
if (game.recording == 1)
{
//recordinput(key, dwgfx, game, map, obj, help, music);
//recordinput();
}
else
{
@ -408,7 +408,7 @@ int main(int argc, char *argv[])
script.run();
}
gameinput(key, graphics, game, map, obj, help, music);
gameinput();
//}
gamerender(graphics,map, game, obj, help);
gamelogic();
@ -420,11 +420,11 @@ int main(int argc, char *argv[])
maprender(graphics, game, map, obj, help);
if (game.recording == 1)
{
//recordinput(key, dwgfx, game, map, obj, help, music); //will implement this later if it's actually needed
//recordinput(); //will implement this later if it's actually needed
}
else
{
mapinput(key, graphics, game, map, obj, help, music);
mapinput();
}
maplogic();
break;
@ -432,13 +432,13 @@ int main(int argc, char *argv[])
teleporterrender(graphics, game, map, obj, help);
if (game.recording == 1)
{
//recordinput(key, graphics, game, map, obj, help, music);
//recordinput();
}
else
{
if(game.useteleporter)
{
teleporterinput(key, graphics, game, map, obj, help, music);
teleporterinput();
}
else
{
@ -446,7 +446,7 @@ int main(int argc, char *argv[])
{
script.run();
}
gameinput(key, graphics, game, map, obj, help, music);
gameinput();
}
}
maplogic();
@ -454,14 +454,14 @@ int main(int argc, char *argv[])
case GAMECOMPLETE:
gamecompleterender(graphics, game, obj, help, map);
//Input
gamecompleteinput(key, graphics, game, map, obj, help, music);
gamecompleteinput();
//Logic
gamecompletelogic();
break;
case GAMECOMPLETE2:
gamecompleterender2(graphics, game, obj, help);
//Input
gamecompleteinput2(key, graphics, game, map, obj, help, music);
gamecompleteinput2();
//Logic
gamecompletelogic2();
break;