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

Unindent fixedloop()

If I did it in the previous commit, it would've been too noisy.
This commit is contained in:
Misa 2020-06-14 11:57:57 -07:00 committed by Ethan Lee
parent a9f07ccc8f
commit acf47bfeac

View file

@ -432,224 +432,224 @@ void deltaloop()
void fixedloop() void fixedloop()
{ {
key.Poll(); key.Poll();
if(key.toggleFullscreen) if(key.toggleFullscreen)
{
if(!gameScreen.isWindowed)
{ {
if(!gameScreen.isWindowed) SDL_ShowCursor(SDL_DISABLE);
{ SDL_ShowCursor(SDL_ENABLE);
SDL_ShowCursor(SDL_DISABLE);
SDL_ShowCursor(SDL_ENABLE);
}
else
{
SDL_ShowCursor(SDL_ENABLE);
}
if(game.gamestate == EDITORMODE)
{
SDL_ShowCursor(SDL_ENABLE);
}
gameScreen.toggleFullScreen();
game.fullscreen = !game.fullscreen;
key.toggleFullscreen = false;
key.keymap.clear(); //we lost the input due to a new window.
game.press_left = false;
game.press_right = false;
game.press_action = true;
game.press_map = false;
}
if(!game.infocus)
{
Mix_Pause(-1);
Mix_PauseMusic();
if (!game.blackout)
{
FillRect(graphics.backBuffer, 0x00000000);
graphics.bprint(5, 110, "Game paused", 196 - help.glow, 255 - help.glow, 196 - help.glow, true);
graphics.bprint(5, 120, "[click to resume]", 196 - help.glow, 255 - help.glow, 196 - help.glow, true);
graphics.bprint(5, 220, "Press M to mute in game", 164 - help.glow, 196 - help.glow, 164 - help.glow, true);
graphics.bprint(5, 230, "Press N to mute music only", 164 - help.glow, 196 - help.glow, 164 - help.glow, true);
}
graphics.render();
gameScreen.FlipScreen();
//We are minimised, so lets put a bit of a delay to save CPU
SDL_Delay(100);
} }
else else
{ {
Mix_Resume(-1); SDL_ShowCursor(SDL_ENABLE);
Mix_ResumeMusic(); }
game.gametimer++;
graphics.cutscenebarstimer();
switch(game.gamestate)
{ if(game.gamestate == EDITORMODE)
case PRELOADER: {
preloaderlogic(); SDL_ShowCursor(SDL_ENABLE);
break; }
gameScreen.toggleFullScreen();
game.fullscreen = !game.fullscreen;
key.toggleFullscreen = false;
key.keymap.clear(); //we lost the input due to a new window.
game.press_left = false;
game.press_right = false;
game.press_action = true;
game.press_map = false;
}
if(!game.infocus)
{
Mix_Pause(-1);
Mix_PauseMusic();
if (!game.blackout)
{
FillRect(graphics.backBuffer, 0x00000000);
graphics.bprint(5, 110, "Game paused", 196 - help.glow, 255 - help.glow, 196 - help.glow, true);
graphics.bprint(5, 120, "[click to resume]", 196 - help.glow, 255 - help.glow, 196 - help.glow, true);
graphics.bprint(5, 220, "Press M to mute in game", 164 - help.glow, 196 - help.glow, 164 - help.glow, true);
graphics.bprint(5, 230, "Press N to mute music only", 164 - help.glow, 196 - help.glow, 164 - help.glow, true);
}
graphics.render();
gameScreen.FlipScreen();
//We are minimised, so lets put a bit of a delay to save CPU
SDL_Delay(100);
}
else
{
Mix_Resume(-1);
Mix_ResumeMusic();
game.gametimer++;
graphics.cutscenebarstimer();
switch(game.gamestate)
{
case PRELOADER:
preloaderlogic();
break;
#if !defined(NO_CUSTOM_LEVELS) #if !defined(NO_CUSTOM_LEVELS)
case EDITORMODE: case EDITORMODE:
graphics.flipmode = false; graphics.flipmode = false;
//Input //Input
editorinput(); editorinput();
////Logic ////Logic
editorlogic(); editorlogic();
break; break;
#endif #endif
case TITLEMODE: case TITLEMODE:
//Input //Input
titleinput(); titleinput();
////Logic ////Logic
titlelogic(); titlelogic();
break; break;
case GAMEMODE: case GAMEMODE:
if (script.running)
{
script.run();
}
//Update old positions of entities - has to be done BEFORE gameinput!
for (size_t i = 0; i < obj.entities.size(); i++)
{
obj.entities[i].oldxp = obj.entities[i].xp;
obj.entities[i].oldyp = obj.entities[i].yp;
}
gameinput();
gamelogic();
break;
case MAPMODE:
mapinput();
maplogic();
break;
case TELEPORTERMODE:
if(game.useteleporter)
{
teleporterinput();
}
else
{
if (script.running) if (script.running)
{ {
script.run(); script.run();
} }
//Update old positions of entities - has to be done BEFORE gameinput!
for (size_t i = 0; i < obj.entities.size(); i++)
{
obj.entities[i].oldxp = obj.entities[i].xp;
obj.entities[i].oldyp = obj.entities[i].yp;
}
gameinput(); gameinput();
gamelogic();
break;
case MAPMODE:
mapinput();
maplogic();
break;
case TELEPORTERMODE:
if(game.useteleporter)
{
teleporterinput();
}
else
{
if (script.running)
{
script.run();
}
gameinput();
}
maplogic();
break;
case GAMECOMPLETE:
//Input
gamecompleteinput();
//Logic
gamecompletelogic();
break;
case GAMECOMPLETE2:
//Input
gamecompleteinput2();
//Logic
gamecompletelogic2();
break;
case CLICKTOSTART:
break;
default:
break;
} }
maplogic();
break;
case GAMECOMPLETE:
//Input
gamecompleteinput();
//Logic
gamecompletelogic();
break;
case GAMECOMPLETE2:
//Input
gamecompleteinput2();
//Logic
gamecompletelogic2();
break;
case CLICKTOSTART:
break;
default:
break;
} }
//Screen effects timers }
if (game.infocus && game.flashlight > 0)
{
game.flashlight--;
}
if (game.infocus && game.screenshake > 0)
{
game.screenshake--;
graphics.updatescreenshake();
}
if (graphics.screenbuffer->badSignalEffect) //Screen effects timers
{ if (game.infocus && game.flashlight > 0)
UpdateFilter(); {
} game.flashlight--;
}
if (game.infocus && game.screenshake > 0)
{
game.screenshake--;
graphics.updatescreenshake();
}
//We did editorinput, now it's safe to turn this off if (graphics.screenbuffer->badSignalEffect)
key.linealreadyemptykludge = false; {
UpdateFilter();
}
if (game.savemystats) //We did editorinput, now it's safe to turn this off
{ key.linealreadyemptykludge = false;
game.savemystats = false;
game.savestats();
}
//Mute button if (game.savemystats)
{
game.savemystats = false;
game.savestats();
}
//Mute button
#if !defined(NO_CUSTOM_LEVELS) #if !defined(NO_CUSTOM_LEVELS)
bool inEditor = ed.textentry || ed.scripthelppage == 1; bool inEditor = ed.textentry || ed.scripthelppage == 1;
#else #else
bool inEditor = false; bool inEditor = false;
#endif #endif
if (key.isDown(KEYBOARD_m) && game.mutebutton<=0 && !inEditor) if (key.isDown(KEYBOARD_m) && game.mutebutton<=0 && !inEditor)
{ {
game.mutebutton = 8; game.mutebutton = 8;
if (game.muted)
{
game.muted = false;
}
else
{
game.muted = true;
}
}
if(game.mutebutton>0)
{
game.mutebutton--;
}
if (key.isDown(KEYBOARD_n) && game.musicmutebutton <= 0 && !inEditor)
{
game.musicmutebutton = 8;
game.musicmuted = !game.musicmuted;
}
if (game.musicmutebutton > 0)
{
game.musicmutebutton--;
}
if (game.muted) if (game.muted)
{ {
Mix_VolumeMusic(0) ; game.muted = false;
Mix_Volume(-1,0);
} }
else else
{ {
Mix_Volume(-1,MIX_MAX_VOLUME); game.muted = true;
if (game.musicmuted || game.completestop)
{
Mix_VolumeMusic(0);
}
else
{
Mix_VolumeMusic(MIX_MAX_VOLUME);
}
} }
}
if(game.mutebutton>0)
{
game.mutebutton--;
}
if (key.resetWindow) if (key.isDown(KEYBOARD_n) && game.musicmutebutton <= 0 && !inEditor)
{
game.musicmutebutton = 8;
game.musicmuted = !game.musicmuted;
}
if (game.musicmutebutton > 0)
{
game.musicmutebutton--;
}
if (game.muted)
{
Mix_VolumeMusic(0) ;
Mix_Volume(-1,0);
}
else
{
Mix_Volume(-1,MIX_MAX_VOLUME);
if (game.musicmuted || game.completestop)
{ {
key.resetWindow = false; Mix_VolumeMusic(0);
gameScreen.ResizeScreen(-1, -1);
} }
else
{
Mix_VolumeMusic(MIX_MAX_VOLUME);
}
}
music.processmusic(); if (key.resetWindow)
graphics.processfade(); {
game.gameclock(); key.resetWindow = false;
gameScreen.ResizeScreen(-1, -1);
}
music.processmusic();
graphics.processfade();
game.gameclock();
} }