mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Move tempstring off of Graphics, Game, and UtilityClass
Unlike, say, the scriptclass i/j/k stuff, these tempstrings are only purely visual, and there's no known glitches to manipulate them anyway. Thus I think it's safe to make this cleanup.
This commit is contained in:
parent
ff449a2c3a
commit
f7ff076074
7 changed files with 51 additions and 50 deletions
|
@ -2373,7 +2373,7 @@ void Game::updatestate()
|
|||
temp = 6 - crewrescued();
|
||||
if (temp == 1)
|
||||
{
|
||||
tempstring = " One remains ";
|
||||
std::string tempstring = " One remains ";
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
graphics.createtextbox(tempstring, -1, 72, 174, 174, 174);
|
||||
|
@ -2385,7 +2385,7 @@ void Game::updatestate()
|
|||
}
|
||||
else if (temp > 0)
|
||||
{
|
||||
tempstring = " " + help.number(temp) + " remain ";
|
||||
std::string tempstring = " " + help.number(temp) + " remain ";
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
graphics.createtextbox(tempstring, -1, 72, 174, 174, 174);
|
||||
|
@ -2488,7 +2488,7 @@ void Game::updatestate()
|
|||
temp = 6 - crewrescued();
|
||||
if (temp == 1)
|
||||
{
|
||||
tempstring = " One remains ";
|
||||
std::string tempstring = " One remains ";
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
graphics.createtextbox(tempstring, -1, 72, 174, 174, 174);
|
||||
|
@ -2500,7 +2500,7 @@ void Game::updatestate()
|
|||
}
|
||||
else if (temp > 0)
|
||||
{
|
||||
tempstring = " " + help.number(temp) + " remain ";
|
||||
std::string tempstring = " " + help.number(temp) + " remain ";
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
graphics.createtextbox(tempstring, -1, 72, 174, 174, 174);
|
||||
|
@ -2602,7 +2602,7 @@ void Game::updatestate()
|
|||
temp = 6 - crewrescued();
|
||||
if (temp == 1)
|
||||
{
|
||||
tempstring = " One remains ";
|
||||
std::string tempstring = " One remains ";
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
graphics.createtextbox(tempstring, -1, 72, 174, 174, 174);
|
||||
|
@ -2614,7 +2614,7 @@ void Game::updatestate()
|
|||
}
|
||||
else if (temp > 0)
|
||||
{
|
||||
tempstring = " " + help.number(temp) + " remain ";
|
||||
std::string tempstring = " " + help.number(temp) + " remain ";
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
graphics.createtextbox(tempstring, -1, 72, 174, 174, 174);
|
||||
|
@ -2717,7 +2717,7 @@ void Game::updatestate()
|
|||
temp = 6 - crewrescued();
|
||||
if (temp == 1)
|
||||
{
|
||||
tempstring = " One remains ";
|
||||
std::string tempstring = " One remains ";
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
graphics.createtextbox(tempstring, -1, 72, 174, 174, 174);
|
||||
|
@ -2729,7 +2729,7 @@ void Game::updatestate()
|
|||
}
|
||||
else if (temp > 0)
|
||||
{
|
||||
tempstring = " " + help.number(temp) + " remain ";
|
||||
std::string tempstring = " " + help.number(temp) + " remain ";
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
graphics.createtextbox(tempstring, -1, 72, 174, 174, 174);
|
||||
|
@ -2850,7 +2850,7 @@ void Game::updatestate()
|
|||
temp = 6 - crewrescued();
|
||||
if (temp == 1)
|
||||
{
|
||||
tempstring = " One remains ";
|
||||
std::string tempstring = " One remains ";
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
graphics.createtextbox(tempstring, -1, 72, 174, 174, 174);
|
||||
|
@ -2862,7 +2862,7 @@ void Game::updatestate()
|
|||
}
|
||||
else if (temp > 0)
|
||||
{
|
||||
tempstring = " " + help.number(temp) + " remain ";
|
||||
std::string tempstring = " " + help.number(temp) + " remain ";
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
graphics.createtextbox(tempstring, -1, 72, 174, 174, 174);
|
||||
|
@ -3127,10 +3127,11 @@ void Game::updatestate()
|
|||
savetime = timestring();
|
||||
break;
|
||||
case 3503:
|
||||
{
|
||||
state++;
|
||||
statedelay = 45;
|
||||
|
||||
tempstring = help.number(trinkets);
|
||||
std::string tempstring = help.number(trinkets);
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
graphics.createtextbox("Trinkets Found:", 48, 155-24, 0,0,0);
|
||||
|
@ -3142,11 +3143,13 @@ void Game::updatestate()
|
|||
graphics.createtextbox(tempstring, 180, 84, 0, 0, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3504:
|
||||
{
|
||||
state++;
|
||||
statedelay = 45+15;
|
||||
|
||||
tempstring = savetime;
|
||||
std::string tempstring = savetime;
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
graphics.createtextbox(" Game Time:", 64, 143-24, 0,0,0);
|
||||
|
@ -3158,6 +3161,7 @@ void Game::updatestate()
|
|||
graphics.createtextbox(tempstring, 180, 96, 0, 0, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3505:
|
||||
state++;
|
||||
statedelay = 45;
|
||||
|
@ -3189,22 +3193,24 @@ void Game::updatestate()
|
|||
}
|
||||
break;
|
||||
case 3507:
|
||||
{
|
||||
state++;
|
||||
statedelay = 45+15;
|
||||
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
tempstring = "Hardest Room (with " + help.String(hardestroomdeaths) + " deaths)";
|
||||
std::string tempstring = "Hardest Room (with " + help.String(hardestroomdeaths) + " deaths)";
|
||||
graphics.createtextbox(tempstring, -1, 81-24, 0,0,0);
|
||||
graphics.createtextbox(hardestroom, -1, 69-24, 0, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
tempstring = "Hardest Room (with " + help.String(hardestroomdeaths) + " deaths)";
|
||||
std::string tempstring = "Hardest Room (with " + help.String(hardestroomdeaths) + " deaths)";
|
||||
graphics.createtextbox(tempstring, -1, 158, 0,0,0);
|
||||
graphics.createtextbox(hardestroom, -1, 170, 0, 0, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3508:
|
||||
state++;
|
||||
statedelay = 0;
|
||||
|
@ -6683,7 +6689,7 @@ teststring = os.str();
|
|||
|
||||
std::string Game::giventimestring( int hrs, int min, int sec )
|
||||
{
|
||||
tempstring = "";
|
||||
std::string tempstring = "";
|
||||
if (hrs > 0)
|
||||
{
|
||||
tempstring += help.String(hrs) + ":";
|
||||
|
@ -6694,7 +6700,7 @@ std::string Game::giventimestring( int hrs, int min, int sec )
|
|||
|
||||
std::string Game::timestring()
|
||||
{
|
||||
tempstring = "";
|
||||
std::string tempstring = "";
|
||||
if (hours > 0)
|
||||
{
|
||||
tempstring += help.String(hours) + ":";
|
||||
|
@ -6706,7 +6712,7 @@ std::string Game::timestring()
|
|||
std::string Game::partimestring()
|
||||
{
|
||||
//given par time in seconds:
|
||||
tempstring = "";
|
||||
std::string tempstring = "";
|
||||
if (timetrialpar >= 60)
|
||||
{
|
||||
tempstring = help.twodigits(int((timetrialpar - (timetrialpar % 60)) / 60)) + ":" + help.twodigits(timetrialpar % 60);
|
||||
|
@ -6721,7 +6727,7 @@ std::string Game::partimestring()
|
|||
std::string Game::resulttimestring()
|
||||
{
|
||||
//given result time in seconds:
|
||||
tempstring = "";
|
||||
std::string tempstring = "";
|
||||
if (timetrialresulttime > 60)
|
||||
{
|
||||
tempstring = help.twodigits(int((timetrialresulttime - (timetrialresulttime % 60)) / 60)) + ":"
|
||||
|
@ -6737,7 +6743,7 @@ std::string Game::resulttimestring()
|
|||
std::string Game::timetstring( int t )
|
||||
{
|
||||
//given par time in seconds:
|
||||
tempstring = "";
|
||||
std::string tempstring = "";
|
||||
if (t >= 60)
|
||||
{
|
||||
tempstring = help.twodigits(int((t - (t % 60)) / 60)) + ":" + help.twodigits(t % 60);
|
||||
|
|
|
@ -243,7 +243,6 @@ public:
|
|||
|
||||
int mx, my;
|
||||
int screenshake, flashlight;
|
||||
std::string tempstring;
|
||||
bool advancetext, pausescript;
|
||||
|
||||
int deathseq, lifeseq;
|
||||
|
|
|
@ -1144,14 +1144,14 @@ void Graphics::drawmenu( int cr, int cg, int cb, int division /*= 30*/ )
|
|||
//Draw it highlighted
|
||||
if (game.menuoptionsactive[i])
|
||||
{
|
||||
tempstring = game.menuoptions[i];
|
||||
std::string tempstring = game.menuoptions[i];
|
||||
std::transform(tempstring.begin(), tempstring.end(),tempstring.begin(), ::toupper);
|
||||
tempstring = std::string("[ ") + tempstring + std::string(" ]");
|
||||
Print(110 + (i * division) - 16 +game.menuxoff, 140 + (i * 12) +game.menuyoff, tempstring, cr, cg, cb);
|
||||
}
|
||||
else
|
||||
{
|
||||
tempstring = game.menuoptions[i];
|
||||
std::string tempstring = game.menuoptions[i];
|
||||
tempstring = "[ " + tempstring + " ]";
|
||||
//Draw it in gray
|
||||
Print(110 + (i * division) - 16 +game.menuxoff, 140 + (i * 12)+game.menuyoff, tempstring, 128, 128, 128);
|
||||
|
@ -1183,14 +1183,14 @@ void Graphics::drawlevelmenu( int cr, int cg, int cb, int division /*= 30*/ )
|
|||
//Draw it highlighted
|
||||
if (game.menuoptionsactive[i])
|
||||
{
|
||||
tempstring = game.menuoptions[i];
|
||||
std::string tempstring = game.menuoptions[i];
|
||||
std::transform(tempstring.begin(), tempstring.end(),tempstring.begin(), ::toupper);
|
||||
tempstring = std::string("[ ") + tempstring + std::string(" ]");
|
||||
Print(110 + (i * division) - 16 +game.menuxoff, 140+8 + (i * 12) +game.menuyoff, tempstring, cr, cg, cb);
|
||||
}
|
||||
else
|
||||
{
|
||||
tempstring = game.menuoptions[i];
|
||||
std::string tempstring = game.menuoptions[i];
|
||||
tempstring = "[ " + tempstring + " ]";
|
||||
//Draw it in gray
|
||||
Print(110 + (i * division) - 16 +game.menuxoff, 140+8 + (i * 12)+game.menuyoff, tempstring, 128, 128, 128);
|
||||
|
@ -1199,14 +1199,14 @@ void Graphics::drawlevelmenu( int cr, int cg, int cb, int division /*= 30*/ )
|
|||
//Draw it highlighted
|
||||
if (game.menuoptionsactive[i])
|
||||
{
|
||||
tempstring = game.menuoptions[i];
|
||||
std::string tempstring = game.menuoptions[i];
|
||||
std::transform(tempstring.begin(), tempstring.end(),tempstring.begin(), ::toupper);
|
||||
tempstring = std::string("[ ") + tempstring + std::string(" ]");
|
||||
Print(110 + (i * division) - 16 +game.menuxoff, 140 + (i * 12) +game.menuyoff, tempstring, cr, cg, cb);
|
||||
}
|
||||
else
|
||||
{
|
||||
tempstring = game.menuoptions[i];
|
||||
std::string tempstring = game.menuoptions[i];
|
||||
tempstring = "[ " + tempstring + " ]";
|
||||
//Draw it in gray
|
||||
Print(110 + (i * division) - 16 +game.menuxoff, 140 + (i * 12)+game.menuyoff, tempstring, 128, 128, 128);
|
||||
|
|
|
@ -198,8 +198,6 @@ public:
|
|||
|
||||
colourTransform ct;
|
||||
|
||||
std::string tempstring;
|
||||
|
||||
int bcol, bcol2, rcol;
|
||||
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ std::string UtilityClass::twodigits( int t )
|
|||
std::string UtilityClass::timestring( int t )
|
||||
{
|
||||
//given a time t in frames, return a time in seconds
|
||||
tempstring = "";
|
||||
std::string tempstring = "";
|
||||
temp = (t - (t % 30)) / 30;
|
||||
if (temp < 60) //less than one minute
|
||||
{
|
||||
|
|
|
@ -39,7 +39,6 @@ public:
|
|||
int globaltemp;
|
||||
int temp;
|
||||
int temp2;
|
||||
std::string tempstring;
|
||||
std::vector<int> splitseconds;
|
||||
};
|
||||
|
||||
|
|
|
@ -18,8 +18,6 @@ int tr;
|
|||
int tg;
|
||||
int tb;
|
||||
|
||||
std::string tempstring;
|
||||
|
||||
void titlerender()
|
||||
{
|
||||
|
||||
|
@ -660,6 +658,7 @@ void titlerender()
|
|||
{
|
||||
graphics.drawcrewman(169-(3*42)+(i*42), 68, i, game.crewstats[i], true);
|
||||
}
|
||||
std::string tempstring;
|
||||
tempstring = "You rescued " + help.number(game.crewrescued()) + " crewmates";
|
||||
graphics.Print(0, 100, tempstring, tr, tg, tb, true);
|
||||
|
||||
|
@ -711,7 +710,7 @@ void titlerender()
|
|||
{
|
||||
graphics.drawcrewman(169-(3*42)+(i*42), 68, i, game.crewstats[i], true);
|
||||
}
|
||||
tempstring = "You rescued all the crewmates!";
|
||||
std::string tempstring = "You rescued all the crewmates!";
|
||||
graphics.Print(0, 100, tempstring, tr, tg, tb, true);
|
||||
|
||||
tempstring = "And you found " + help.number(game.trinkets) + " trinkets.";
|
||||
|
@ -726,7 +725,7 @@ void titlerender()
|
|||
{
|
||||
graphics.bigprint( -1, 20, "Results", tr, tg, tb, true, 3);
|
||||
|
||||
tempstring = game.resulttimestring() + " / " + game.partimestring();
|
||||
std::string tempstring = game.resulttimestring() + " / " + game.partimestring();
|
||||
|
||||
graphics.drawspritesetcol(30, 80-15, 50, 22);
|
||||
graphics.Print(65, 80-15, "TIME TAKEN:", 255, 255, 255);
|
||||
|
@ -1123,22 +1122,22 @@ void titlerender()
|
|||
graphics.Print( -1, 135, "the intermission levels.", tr, tg, tb, true);
|
||||
}else if (game.currentmenuname == "playerworlds")
|
||||
{
|
||||
graphics.tempstring = FILESYSTEM_getUserLevelDirectory();
|
||||
if(graphics.tempstring.length()>80){
|
||||
std::string tempstring = FILESYSTEM_getUserLevelDirectory();
|
||||
if(tempstring.length()>80){
|
||||
graphics.Print( -1, 160, "To install new player levels, copy", tr, tg, tb, true);
|
||||
graphics.Print( -1, 170, "the .vvvvvv files to this folder:", tr, tg, tb, true);
|
||||
graphics.Print( 320-((graphics.tempstring.length()-80)*8), 190, graphics.tempstring.substr(0,graphics.tempstring.length()-80), tr, tg, tb);
|
||||
graphics.Print( 0, 200, graphics.tempstring.substr(graphics.tempstring.length()-80,40), tr, tg, tb);
|
||||
graphics.Print( 0, 210, graphics.tempstring.substr(graphics.tempstring.length()-40,40), tr, tg, tb);
|
||||
}else if(graphics.tempstring.length()>40){
|
||||
graphics.Print( 320-((tempstring.length()-80)*8), 190, tempstring.substr(0,tempstring.length()-80), tr, tg, tb);
|
||||
graphics.Print( 0, 200, tempstring.substr(tempstring.length()-80,40), tr, tg, tb);
|
||||
graphics.Print( 0, 210, tempstring.substr(tempstring.length()-40,40), tr, tg, tb);
|
||||
}else if(tempstring.length()>40){
|
||||
graphics.Print( -1, 170, "To install new player levels, copy", tr, tg, tb, true);
|
||||
graphics.Print( -1, 180, "the .vvvvvv files to this folder:", tr, tg, tb, true);
|
||||
graphics.Print( 320-((graphics.tempstring.length()-40)*8), 200, graphics.tempstring.substr(0,graphics.tempstring.length()-40), tr, tg, tb);
|
||||
graphics.Print( 0, 210, graphics.tempstring.substr(graphics.tempstring.length()-40,40), tr, tg, tb);
|
||||
graphics.Print( 320-((tempstring.length()-40)*8), 200, tempstring.substr(0,tempstring.length()-40), tr, tg, tb);
|
||||
graphics.Print( 0, 210, tempstring.substr(tempstring.length()-40,40), tr, tg, tb);
|
||||
}else{
|
||||
graphics.Print( -1, 180, "To install new player levels, copy", tr, tg, tb, true);
|
||||
graphics.Print( -1, 190, "the .vvvvvv files to this folder:", tr, tg, tb, true);
|
||||
graphics.Print( 320-(graphics.tempstring.length()*8), 210, graphics.tempstring, tr, tg, tb);
|
||||
graphics.Print( 320-(tempstring.length()*8), 210, tempstring, tr, tg, tb);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1581,14 +1580,14 @@ void gamerender()
|
|||
{
|
||||
if (game.swngame == 0)
|
||||
{
|
||||
tempstring = help.timestring(game.swntimer);
|
||||
std::string tempstring = help.timestring(game.swntimer);
|
||||
graphics.bigprint( -1, 20, tempstring, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true, 2);
|
||||
}
|
||||
else if (game.swngame == 1)
|
||||
{
|
||||
if (game.swnmessage == 0)
|
||||
{
|
||||
tempstring = help.timestring(game.swntimer);
|
||||
std::string tempstring = help.timestring(game.swntimer);
|
||||
graphics.Print( 10, 10, "Current Time", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false);
|
||||
graphics.bigprint( 25, 24, tempstring, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false, 2);
|
||||
tempstring = help.timestring(game.swnrecord);
|
||||
|
@ -1622,7 +1621,7 @@ void gamerender()
|
|||
}
|
||||
else if (game.swnmessage == 1)
|
||||
{
|
||||
tempstring = help.timestring(game.swntimer);
|
||||
std::string tempstring = help.timestring(game.swntimer);
|
||||
graphics.Print( 10, 10, "Current Time", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false);
|
||||
graphics.bigprint( 25, 24, tempstring, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false, 2);
|
||||
tempstring = help.timestring(game.swnrecord);
|
||||
|
@ -1638,7 +1637,7 @@ void gamerender()
|
|||
{
|
||||
game.swnmessage--;
|
||||
if (game.swnmessage == 2) game.swnmessage = 0;
|
||||
tempstring = help.timestring(game.swntimer);
|
||||
std::string tempstring = help.timestring(game.swntimer);
|
||||
graphics.Print( 10, 10, "Current Time", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false);
|
||||
graphics.bigprint( 25, 24, tempstring, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false, 2);
|
||||
tempstring = help.timestring(game.swnrecord);
|
||||
|
@ -1675,7 +1674,7 @@ void gamerender()
|
|||
{
|
||||
graphics.bigprint( -1, 20, "SUPER GRAVITRON", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true, 2);
|
||||
|
||||
tempstring = help.timestring(game.swnrecord);
|
||||
std::string tempstring = help.timestring(game.swnrecord);
|
||||
graphics.Print( 240, 190, "Best Time", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true);
|
||||
graphics.bigrprint( 300, 205, tempstring, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true, 2);
|
||||
}
|
||||
|
@ -2165,7 +2164,7 @@ void maprender()
|
|||
{
|
||||
graphics.Print(0, 174, "SUPER GRAVITRON HIGHSCORE", 196, 196, 255 - help.glow, true);
|
||||
|
||||
tempstring = help.timestring(game.swnrecord);
|
||||
std::string tempstring = help.timestring(game.swnrecord);
|
||||
graphics.Print( 240, 124, "Best Time", 196, 196, 255 - help.glow, true);
|
||||
graphics.bigrprint( 300, 94, tempstring, 196, 196, 255 - help.glow, true, 2);
|
||||
|
||||
|
@ -2198,7 +2197,7 @@ void maprender()
|
|||
{
|
||||
graphics.Print(0, 40, "SUPER GRAVITRON HIGHSCORE", 196, 196, 255 - help.glow, true);
|
||||
|
||||
tempstring = help.timestring(game.swnrecord);
|
||||
std::string tempstring = help.timestring(game.swnrecord);
|
||||
graphics.Print( 240, 90, "Best Time", 196, 196, 255 - help.glow, true);
|
||||
graphics.bigrprint( 300, 104, tempstring, 196, 196, 255 - help.glow, true, 2);
|
||||
|
||||
|
|
Loading…
Reference in a new issue