mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-09 18:39:45 +01:00
Fix Time Trial results being reset before being shown
This makes it so when a Time Trial gets completed, all the relevant variables get copied onto variables prefixed with 'timetrialresult', which never get reset by script.hardreset(). Then titlerender() will use those variables accordingly.
This commit is contained in:
parent
ee0ba8a723
commit
4d7baa9e9e
4 changed files with 19 additions and 8 deletions
|
@ -227,6 +227,10 @@ void Game::init(void)
|
||||||
timetrialpar = 0;
|
timetrialpar = 0;
|
||||||
timetrialresulttime = 0;
|
timetrialresulttime = 0;
|
||||||
timetrialresultframes = 0;
|
timetrialresultframes = 0;
|
||||||
|
timetrialresultshinytarget = 0;
|
||||||
|
timetrialresulttrinkets = 0;
|
||||||
|
timetrialresultpar = 0;
|
||||||
|
timetrialresultdeaths = 0;
|
||||||
|
|
||||||
totalflips = 0;
|
totalflips = 0;
|
||||||
hardestroom = "Welcome Aboard";
|
hardestroom = "Welcome Aboard";
|
||||||
|
@ -1296,8 +1300,14 @@ void Game::updatestate()
|
||||||
//Time Trial Complete!
|
//Time Trial Complete!
|
||||||
obj.removetrigger(82);
|
obj.removetrigger(82);
|
||||||
hascontrol = false;
|
hascontrol = false;
|
||||||
|
|
||||||
timetrialresulttime = seconds + (minutes * 60) + (hours * 60 * 60);
|
timetrialresulttime = seconds + (minutes * 60) + (hours * 60 * 60);
|
||||||
timetrialresultframes = frames;
|
timetrialresultframes = frames;
|
||||||
|
timetrialresulttrinkets = trinkets();
|
||||||
|
timetrialresultshinytarget = timetrialshinytarget;
|
||||||
|
timetrialresultpar = timetrialpar;
|
||||||
|
timetrialresultdeaths = deathcounts;
|
||||||
|
|
||||||
timetrialrank = 0;
|
timetrialrank = 0;
|
||||||
if (timetrialresulttime <= timetrialpar) timetrialrank++;
|
if (timetrialresulttime <= timetrialpar) timetrialrank++;
|
||||||
if (trinkets() >= timetrialshinytarget) timetrialrank++;
|
if (trinkets() >= timetrialshinytarget) timetrialrank++;
|
||||||
|
@ -1310,7 +1320,7 @@ void Game::updatestate()
|
||||||
besttimes[timetriallevel] = timetrialresulttime;
|
besttimes[timetriallevel] = timetrialresulttime;
|
||||||
bestframes[timetriallevel] = timetrialresultframes;
|
bestframes[timetriallevel] = timetrialresultframes;
|
||||||
}
|
}
|
||||||
if (trinkets() > besttrinkets[timetriallevel] || besttrinkets[timetriallevel]==-1)
|
if (timetrialresulttrinkets > besttrinkets[timetriallevel] || besttrinkets[timetriallevel]==-1)
|
||||||
{
|
{
|
||||||
besttrinkets[timetriallevel] = trinkets();
|
besttrinkets[timetriallevel] = trinkets();
|
||||||
}
|
}
|
||||||
|
|
|
@ -295,6 +295,8 @@ public:
|
||||||
bool intimetrial, timetrialparlost;
|
bool intimetrial, timetrialparlost;
|
||||||
int timetrialcountdown, timetrialshinytarget, timetriallevel;
|
int timetrialcountdown, timetrialshinytarget, timetriallevel;
|
||||||
int timetrialpar, timetrialresulttime, timetrialresultframes, timetrialrank;
|
int timetrialpar, timetrialresulttime, timetrialresultframes, timetrialrank;
|
||||||
|
int timetrialresultshinytarget, timetrialresulttrinkets, timetrialresultpar;
|
||||||
|
int timetrialresultdeaths;
|
||||||
|
|
||||||
int creditposition;
|
int creditposition;
|
||||||
int oldcreditposition;
|
int oldcreditposition;
|
||||||
|
|
|
@ -752,30 +752,30 @@ static void menurender()
|
||||||
{
|
{
|
||||||
graphics.bigprint( -1, 20, "Results", tr, tg, tb, true, 3);
|
graphics.bigprint( -1, 20, "Results", tr, tg, tb, true, 3);
|
||||||
|
|
||||||
std::string tempstring = game.resulttimestring() + " / " + game.partimestring() + ".99";
|
std::string tempstring = game.resulttimestring() + " / " + game.timetstring(game.timetrialresultpar) + ".99";
|
||||||
|
|
||||||
graphics.drawspritesetcol(30, 80-15, 50, 22);
|
graphics.drawspritesetcol(30, 80-15, 50, 22);
|
||||||
graphics.Print(65, 80-15, "TIME TAKEN:", 255, 255, 255);
|
graphics.Print(65, 80-15, "TIME TAKEN:", 255, 255, 255);
|
||||||
graphics.Print(65, 90-15, tempstring, tr, tg, tb);
|
graphics.Print(65, 90-15, tempstring, tr, tg, tb);
|
||||||
if (game.timetrialresulttime <= game.timetrialpar)
|
if (game.timetrialresulttime <= game.timetrialresultpar)
|
||||||
{
|
{
|
||||||
graphics.Print(220, 85-15, "+1 Rank!", 255, 255, 255);
|
graphics.Print(220, 85-15, "+1 Rank!", 255, 255, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
tempstring = help.String(game.deathcounts);
|
tempstring = help.String(game.timetrialresultdeaths);
|
||||||
graphics.drawspritesetcol(30-4, 80+20-4, 12, 22);
|
graphics.drawspritesetcol(30-4, 80+20-4, 12, 22);
|
||||||
graphics.Print(65, 80+20, "NUMBER OF DEATHS:", 255, 255, 255);
|
graphics.Print(65, 80+20, "NUMBER OF DEATHS:", 255, 255, 255);
|
||||||
graphics.Print(65, 90+20, tempstring, tr, tg, tb);
|
graphics.Print(65, 90+20, tempstring, tr, tg, tb);
|
||||||
if (game.deathcounts == 0)
|
if (game.timetrialresultdeaths == 0)
|
||||||
{
|
{
|
||||||
graphics.Print(220, 85+20, "+1 Rank!", 255, 255, 255);
|
graphics.Print(220, 85+20, "+1 Rank!", 255, 255, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
tempstring = help.String(game.trinkets()) + " of " + help.String(game.timetrialshinytarget);
|
tempstring = help.String(game.timetrialresulttrinkets) + " of " + help.String(game.timetrialresultshinytarget);
|
||||||
graphics.drawspritesetcol(30, 80+55, 22, 22);
|
graphics.drawspritesetcol(30, 80+55, 22, 22);
|
||||||
graphics.Print(65, 80+55, "SHINY TRINKETS:", 255, 255, 255);
|
graphics.Print(65, 80+55, "SHINY TRINKETS:", 255, 255, 255);
|
||||||
graphics.Print(65, 90+55, tempstring, tr, tg, tb);
|
graphics.Print(65, 90+55, tempstring, tr, tg, tb);
|
||||||
if (game.trinkets() >= game.timetrialshinytarget)
|
if (game.timetrialresulttrinkets >= game.timetrialresultshinytarget)
|
||||||
{
|
{
|
||||||
graphics.Print(220, 85+55, "+1 Rank!", 255, 255, 255);
|
graphics.Print(220, 85+55, "+1 Rank!", 255, 255, 255);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3594,7 +3594,6 @@ void scriptclass::hardreset()
|
||||||
game.timetrialshinytarget = 0;
|
game.timetrialshinytarget = 0;
|
||||||
game.timetrialparlost = false;
|
game.timetrialparlost = false;
|
||||||
game.timetrialpar = 0;
|
game.timetrialpar = 0;
|
||||||
game.timetrialresulttime = 0;
|
|
||||||
|
|
||||||
game.totalflips = 0;
|
game.totalflips = 0;
|
||||||
game.hardestroom = "Welcome Aboard";
|
game.hardestroom = "Welcome Aboard";
|
||||||
|
|
Loading…
Reference in a new issue