From 6dc0cb8a0ff8bb50f3317c6c5e9e9d30391baa00 Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=B4me=20Chilliet?= Date: Mon, 28 Nov 2016 20:04:39 +0700 Subject: [PATCH] Cleaned a bit flashing by using a function --- Source/Game.h | 2 +- Source/GameDraw.cpp | 8 ++++---- Source/Person.cpp | 15 ++------------- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/Source/Game.h b/Source/Game.h index df174fa..102f026 100644 --- a/Source/Game.h +++ b/Source/Game.h @@ -164,7 +164,7 @@ void fireSound(int sound = fireendsound); void setKeySelected(); void inputText(std::string& str, unsigned* charselected); -void flash(); +void flash(float amount = 1, int delay = 1); } #ifndef __forceinline diff --git a/Source/GameDraw.cpp b/Source/GameDraw.cpp index 802a1e9..4994b11 100644 --- a/Source/GameDraw.cpp +++ b/Source/GameDraw.cpp @@ -107,13 +107,13 @@ enum drawmodes { realmotionblurmode, doublevisionmode, glowmode, }; -void Game::flash() // shouldn't be that way, these should be attributes and Person class should not change rendering. +void Game::flash(float amount, int delay) // shouldn't be that way, these should be attributes and Person class should not change rendering. { flashr = 1; flashg = 0; flashb = 0; - flashamount = 1; - flashdelay = 1; + flashamount = amount; + flashdelay = delay; } void DrawMenu(); @@ -890,8 +890,8 @@ int Game::DrawGLScene(StereoSide side) text->glPrint(screenwidth / 2 - 7.6 * strlen(string2)*screenwidth / 1024 * .8, 0 + screenheight * 1 / 10 - 20 * .8 * screenwidth / 1024, string2, 1, 1.5 * screenwidth / 1024 * .8, screenwidth, screenheight); text->glPrint(screenwidth / 2 - 7.6 * strlen(string3)*screenwidth / 1024 * .8, 0 + screenheight * 1 / 10 - 40 * .8 * screenwidth / 1024, string3, 1, 1.5 * screenwidth / 1024 * .8, screenwidth, screenheight); } - //Hot spots + //Hot spots if (numhotspots && (bonustime >= 1 || bonus <= 0 || bonustime < 0) && !tutoriallevel) { float closestdist = -1; float distance = 0; diff --git a/Source/Person.cpp b/Source/Person.cpp index a957945..59f3e06 100644 --- a/Source/Person.cpp +++ b/Source/Person.cpp @@ -53,8 +53,6 @@ extern bool decals; extern float fadestart; extern bool freeze; extern bool winfreeze; -extern float flashamount, flashr, flashg, flashb; -extern int flashdelay; extern bool showpoints; extern bool immediate; extern int tutoriallevel; @@ -643,12 +641,7 @@ void Person::DoBloodBig(float howmuch, int which) } if (id == 0 && howmuch > 0) { - // FIXME: manipulating attributes - flashamount = .5; - flashr = 1; - flashg = 0; - flashb = 0; - flashdelay = 0; + Game::flash(.5, 0); } if (bloodtoggle && decals && tutoriallevel != 1) { @@ -4375,11 +4368,7 @@ void Person::DoStuff() } if (id == 0) { - flashamount = .5; - flashr = 1; - flashg = 0; - flashb = 0; - flashdelay = 0; + Game::flash(.5, 0); } } -- 2.39.2