mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 01:59:43 +01:00
Put screen effects render handling inside a function
This de-duplicates the screen effects rendering code by putting it inside a function, Graphics::renderwithscreeneffects(), and using that instead of copy-pasted code.
This commit is contained in:
parent
0e082551b1
commit
857937326e
5 changed files with 26 additions and 104 deletions
|
@ -2667,6 +2667,23 @@ void Graphics::render()
|
|||
}
|
||||
}
|
||||
|
||||
void Graphics::renderwithscreeneffects()
|
||||
{
|
||||
if (game.flashlight > 0 && !game.noflashingmode)
|
||||
{
|
||||
graphics.flashlight();
|
||||
}
|
||||
|
||||
if (game.screenshake > 0 && !game.noflashingmode)
|
||||
{
|
||||
graphics.screenshake();
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.render();
|
||||
}
|
||||
}
|
||||
|
||||
void Graphics::bigrprint(int x, int y, std::string& t, int r, int g, int b, bool cen, float sc)
|
||||
{
|
||||
if (r < 0) r = 0;
|
||||
|
|
|
@ -131,6 +131,7 @@ public:
|
|||
void screenshake();
|
||||
|
||||
void render();
|
||||
void renderwithscreeneffects();
|
||||
|
||||
bool Hitest(SDL_Surface* surface1, point p1, SDL_Surface* surface2, point p2);
|
||||
|
||||
|
|
|
@ -1124,19 +1124,7 @@ void titlerender()
|
|||
|
||||
graphics.drawfade();
|
||||
|
||||
if (game.flashlight > 0 && !game.noflashingmode)
|
||||
{
|
||||
graphics.flashlight();
|
||||
}
|
||||
|
||||
if (game.screenshake > 0 && !game.noflashingmode)
|
||||
{
|
||||
graphics.screenshake();
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.render();
|
||||
}
|
||||
graphics.renderwithscreeneffects();
|
||||
}
|
||||
|
||||
void gamecompleterender()
|
||||
|
@ -1287,19 +1275,7 @@ void gamecompleterender()
|
|||
|
||||
graphics.drawfade();
|
||||
|
||||
if (game.flashlight > 0 && !game.noflashingmode)
|
||||
{
|
||||
graphics.flashlight();
|
||||
}
|
||||
|
||||
if (game.screenshake > 0 && !game.noflashingmode)
|
||||
{
|
||||
graphics.screenshake();
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.render();
|
||||
}
|
||||
graphics.renderwithscreeneffects();
|
||||
}
|
||||
|
||||
void gamecompleterender2()
|
||||
|
@ -1329,19 +1305,7 @@ void gamecompleterender2()
|
|||
|
||||
graphics.drawfade();
|
||||
|
||||
if (game.flashlight > 0 && !game.noflashingmode)
|
||||
{
|
||||
graphics.flashlight();
|
||||
}
|
||||
|
||||
if (game.screenshake > 0 && !game.noflashingmode)
|
||||
{
|
||||
graphics.screenshake();
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.render();
|
||||
}
|
||||
graphics.renderwithscreeneffects();
|
||||
}
|
||||
|
||||
void gamerender()
|
||||
|
@ -1697,19 +1661,7 @@ void gamerender()
|
|||
}
|
||||
|
||||
|
||||
if (game.flashlight > 0 && !game.noflashingmode)
|
||||
{
|
||||
graphics.flashlight();
|
||||
}
|
||||
|
||||
if (game.screenshake > 0 && !game.noflashingmode)
|
||||
{
|
||||
graphics.screenshake();
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.render();
|
||||
}
|
||||
graphics.renderwithscreeneffects();
|
||||
}
|
||||
|
||||
void maprender()
|
||||
|
@ -2510,11 +2462,6 @@ void maprender()
|
|||
|
||||
graphics.drawfade();
|
||||
|
||||
if (game.flashlight > 0 && !game.noflashingmode)
|
||||
{
|
||||
graphics.flashlight();
|
||||
}
|
||||
|
||||
if (graphics.resumegamemode)
|
||||
{
|
||||
graphics.menuoffset += 25;
|
||||
|
@ -2548,14 +2495,7 @@ void maprender()
|
|||
}
|
||||
else
|
||||
{
|
||||
if (game.screenshake > 0 && !game.noflashingmode)
|
||||
{
|
||||
graphics.screenshake();
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.render();
|
||||
}
|
||||
graphics.renderwithscreeneffects();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2685,11 +2625,6 @@ void teleporterrender()
|
|||
}
|
||||
|
||||
|
||||
if (game.flashlight > 0 && !game.noflashingmode)
|
||||
{
|
||||
graphics.flashlight();
|
||||
}
|
||||
|
||||
if (graphics.resumegamemode)
|
||||
{
|
||||
graphics.menuoffset += 25;
|
||||
|
@ -2723,13 +2658,6 @@ void teleporterrender()
|
|||
}
|
||||
else
|
||||
{
|
||||
if (game.screenshake > 0 && !game.noflashingmode)
|
||||
{
|
||||
graphics.screenshake();
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.render();
|
||||
}
|
||||
graphics.renderwithscreeneffects();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3422,19 +3422,7 @@ void editorrender()
|
|||
|
||||
graphics.drawfade();
|
||||
|
||||
if (game.flashlight > 0 && !game.noflashingmode)
|
||||
{
|
||||
graphics.flashlight();
|
||||
}
|
||||
|
||||
if (game.screenshake > 0 && !game.noflashingmode)
|
||||
{
|
||||
graphics.screenshake();
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.render();
|
||||
}
|
||||
graphics.renderwithscreeneffects();
|
||||
}
|
||||
|
||||
void editorlogic()
|
||||
|
|
|
@ -95,17 +95,5 @@ void preloaderrender()
|
|||
|
||||
graphics.drawfade();
|
||||
|
||||
if (game.flashlight > 0 && !game.noflashingmode)
|
||||
{
|
||||
graphics.flashlight();
|
||||
}
|
||||
|
||||
if (game.screenshake > 0 && !game.noflashingmode)
|
||||
{
|
||||
graphics.screenshake();
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.render();
|
||||
}
|
||||
graphics.renderwithscreeneffects();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue