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

Add in-game timer option (#790)

This commit is contained in:
lsaa 2021-08-05 18:31:20 -03:00 committed by GitHub
parent 6c6d347ccf
commit 6c66f7248d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 0 deletions

View file

@ -12,6 +12,7 @@ Contributors
* Dav999 (Dav999-v)
* Allison Fleischer (AllisonFleischer)
* Malte Grimm (@trelbutate)
* KyoZM (@lsaa)
* Daniel Lee (@ddm999)
* Fredrik Ljungdahl (@FredrIQ)
* Nichole Mattera (@NicholeMattera)

View file

@ -380,6 +380,7 @@ void Game::init(void)
fadetolabdelay = 0;
over30mode = true;
showingametimer = false;
ingame_titlemode = false;
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
@ -4212,6 +4213,11 @@ void Game::deserializesettings(tinyxml2::XMLElement* dataNode, ScreenSettings* s
GlitchrunnerMode_set(GlitchrunnerMode_string_to_enum(pText));
}
if (SDL_strcmp(pKey, "showingametimer") == 0)
{
showingametimer = help.Int(pText);
}
if (SDL_strcmp(pKey, "vsync") == 0)
{
screen_settings->useVsync = help.Int(pText);
@ -4477,6 +4483,8 @@ void Game::serializesettings(tinyxml2::XMLElement* dataNode, const ScreenSetting
GlitchrunnerMode_enum_to_string(GlitchrunnerMode_get())
);
xml::update_tag(dataNode, "showingametimer", (int) showingametimer);
xml::update_tag(dataNode, "vsync", (int) screen_settings->useVsync);
xml::update_tag(dataNode, "musicvolume", music.user_music_volume);
@ -6091,6 +6099,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
option("input delay");
option("interact button");
option("fake load screen");
option("toggle in game timer");
option("return");
menuyoff = 0;
maxspacing = 15;
@ -6896,3 +6905,8 @@ bool Game::nocompetitive(void)
{
return slowdown < 30 || map.invincibility;
}
bool Game::isingamecompletescreen()
{
return (state >= 3501 && state <= 3518) || (state >= 3520 && state <= 3522);
}

View file

@ -229,6 +229,7 @@ public:
bool hascontrol, jumpheld;
int jumppressed;
int gravitycontrol;
bool isingamecompletescreen();
bool muted;
int mutebutton;
@ -460,6 +461,7 @@ public:
bool nocompetitive(void);
bool over30mode;
bool showingametimer;
bool ingame_titlemode;
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)

View file

@ -684,6 +684,12 @@ static void menuactionpress(void)
game.savestatsandsettings_menu();
music.playef(11);
break;
case 4:
// toggle in game timer
game.showingametimer = !game.showingametimer;
game.savestatsandsettings_menu();
music.playef(11);
break;
default:
//back
music.playef(11);

View file

@ -648,6 +648,17 @@ static void menurender(void)
else
graphics.Print(-1, 65, "Fake loading screen is ON", tr, tg, tb, true);
break;
case 4:
graphics.bigprint(-1, 30, "In Game Timer", tr, tg, tb, true);
if (game.showingametimer)
{
graphics.Print(-1, 65, "In Game Timer is ON", tr, tg, tb, true);
}
else
{
graphics.Print(-1, 65, "In Game Timer is OFF", tr / 2, tg / 2, tb / 2, true);
}
break;
}
break;
case Menu::setglitchrunner:
@ -1675,6 +1686,12 @@ void gamerender(void)
}
}
if (graphics.fademode==0 && !game.intimetrial && !game.isingamecompletescreen() && game.swngame != 1 && game.showingametimer)
{
graphics.bprint(6, 6, "TIME:", 255,255,255);
graphics.bprint(46, 6, game.timestring(), 196, 196, 196);
}
if(map.extrarow==0 || (map.custommode && map.roomname!=""))
{
graphics.footerrect.y = 230;