mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Remove more tele/quick variables duplicating info in struct Summary
For both `tele` and `quick`, I removed these attributes of class Game: - std::string *_gametime - int *_trinkets - std::string *_currentarea - bool *_crewstats[numcrew] All this info can now be gotten from members of Game::last_telesave and Game::last_telesave. I've also cleaned up the continue menu to not have all the display code appear twice (once for telesave and once for quicksave). RIP "Error! Error!" though lol
This commit is contained in:
parent
f23ffc0457
commit
ac7fe4475c
3 changed files with 30 additions and 68 deletions
|
@ -225,8 +225,6 @@ void Game::init(void)
|
|||
|
||||
SDL_memset(crewstats, false, sizeof(crewstats));
|
||||
SDL_memset(ndmresultcrewstats, false, sizeof(ndmresultcrewstats));
|
||||
SDL_memset(tele_crewstats, false, sizeof(tele_crewstats));
|
||||
SDL_memset(quick_crewstats, false, sizeof(quick_crewstats));
|
||||
SDL_memset(besttimes, -1, sizeof(besttimes));
|
||||
SDL_memset(bestframes, -1, sizeof(bestframes));
|
||||
SDL_memset(besttrinkets, -1, sizeof(besttrinkets));
|
||||
|
@ -236,13 +234,6 @@ void Game::init(void)
|
|||
crewstats[0] = true;
|
||||
lastsaved = 0;
|
||||
|
||||
tele_gametime = "00:00";
|
||||
tele_trinkets = 0;
|
||||
tele_currentarea = "Error! Error!";
|
||||
quick_gametime = "00:00";
|
||||
quick_trinkets = 0;
|
||||
quick_currentarea = "Error! Error!";
|
||||
|
||||
//Menu stuff initiliased here:
|
||||
SDL_memset(unlock, false, sizeof(unlock));
|
||||
SDL_memset(unlocknotify, false, sizeof(unlock));
|
||||
|
@ -5629,29 +5620,11 @@ void Game::loadsummary(void)
|
|||
if (FILESYSTEM_loadTiXml2Document("saves/tsave.vvv", doc))
|
||||
{
|
||||
loadthissummary("tsave.vvv", &last_telesave, doc);
|
||||
|
||||
tele_gametime = giventimestring(
|
||||
last_telesave.hours,
|
||||
last_telesave.minutes,
|
||||
last_telesave.seconds
|
||||
);
|
||||
tele_currentarea = map.currentarea(last_telesave.saverx, last_telesave.savery);
|
||||
SDL_memcpy(tele_crewstats, last_telesave.crewstats, sizeof(tele_crewstats));
|
||||
tele_trinkets = last_telesave.trinkets;
|
||||
}
|
||||
|
||||
if (FILESYSTEM_loadTiXml2Document("saves/qsave.vvv", doc))
|
||||
{
|
||||
loadthissummary("qsave.vvv", &last_quicksave, doc);
|
||||
|
||||
quick_gametime = giventimestring(
|
||||
last_quicksave.hours,
|
||||
last_quicksave.minutes,
|
||||
last_quicksave.seconds
|
||||
);
|
||||
quick_currentarea = map.currentarea(last_quicksave.saverx, last_quicksave.savery);
|
||||
SDL_memcpy(quick_crewstats, last_quicksave.crewstats, sizeof(quick_crewstats));
|
||||
quick_trinkets = last_quicksave.trinkets;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -457,10 +457,6 @@ public:
|
|||
int alarmdelay;
|
||||
bool blackout;
|
||||
|
||||
bool tele_crewstats[numcrew];
|
||||
|
||||
bool quick_crewstats[numcrew];
|
||||
|
||||
static const int numunlock = 25;
|
||||
bool unlock[numunlock];
|
||||
bool unlocknotify[numunlock];
|
||||
|
@ -476,13 +472,6 @@ public:
|
|||
int bestlives[numtrials];
|
||||
int bestrank[numtrials];
|
||||
|
||||
std::string tele_gametime;
|
||||
int tele_trinkets;
|
||||
std::string tele_currentarea;
|
||||
std::string quick_gametime;
|
||||
int quick_trinkets;
|
||||
std::string quick_currentarea;
|
||||
|
||||
int screenshake, flashlight;
|
||||
bool advancetext, pausescript;
|
||||
|
||||
|
|
|
@ -1259,58 +1259,58 @@ static void menurender(void)
|
|||
font::print_wrap(PR_CEN, -1, 75, loc::gettext("Are you sure you want to quit?"), tr, tg, tb);
|
||||
break;
|
||||
case Menu::continuemenu:
|
||||
{
|
||||
const char* title = NULL;
|
||||
struct Game::Summary* summary = NULL;
|
||||
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
//Show teleporter save info
|
||||
graphics.drawpixeltextbox(17, 65-20, 286, 90, 65, 185, 207);
|
||||
|
||||
font::print(PR_2X | PR_CEN, -1, 20, loc::gettext("Tele Save"), tr, tg, tb);
|
||||
font::print(PR_CEN, -1, 80-20, game.tele_currentarea, 25, 255 - (help.glow / 2), 255 - (help.glow / 2));
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
graphics.drawcrewman(169-(3*42)+(i*42), 95-20, i, game.tele_crewstats[i], true);
|
||||
}
|
||||
font::print(0, 59, 132-20, game.tele_gametime, 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2));
|
||||
char buffer[SCREEN_WIDTH_CHARS + 1];
|
||||
vformat_buf(buffer, sizeof(buffer),
|
||||
loc::gettext("{savebox_n_trinkets|wordy}"),
|
||||
"savebox_n_trinkets:int",
|
||||
game.tele_trinkets
|
||||
);
|
||||
font::print(PR_RIGHT, 262, 132-20, buffer, 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2));
|
||||
|
||||
graphics.draw_sprite(34, 126-20, 50, graphics.col_clock);
|
||||
graphics.draw_sprite(270, 126-20, 22, graphics.col_trinket);
|
||||
title = loc::gettext("Tele Save");
|
||||
summary = &game.last_telesave;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
title = loc::gettext("Quick Save");
|
||||
summary = &game.last_quicksave;
|
||||
break;
|
||||
}
|
||||
|
||||
if (summary != NULL)
|
||||
{
|
||||
//Show quick save info
|
||||
graphics.drawpixeltextbox(17, 65-20, 286, 90, 65, 185, 207);
|
||||
|
||||
font::print(PR_2X | PR_CEN, -1, 20, loc::gettext("Quick Save"), tr, tg, tb);
|
||||
font::print(PR_CEN, -1, 80-20, game.quick_currentarea, 25, 255 - (help.glow / 2), 255 - (help.glow / 2));
|
||||
font::print(PR_2X | PR_CEN, -1, 20, title, tr, tg, tb);
|
||||
font::print(
|
||||
PR_CEN, -1, 80-20,
|
||||
map.currentarea(summary->saverx, summary->savery),
|
||||
25, 255 - (help.glow / 2), 255 - (help.glow / 2)
|
||||
);
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
graphics.drawcrewman(169-(3*42)+(i*42), 95-20, i, game.quick_crewstats[i], true);
|
||||
graphics.drawcrewman(169-(3*42)+(i*42), 95-20, i, summary->crewstats[i], true);
|
||||
}
|
||||
font::print(0, 59, 132-20, game.quick_gametime, 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2));
|
||||
font::print(
|
||||
0, 59, 132-20,
|
||||
game.giventimestring(
|
||||
summary->hours,
|
||||
summary->minutes,
|
||||
summary->seconds
|
||||
),
|
||||
255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2)
|
||||
);
|
||||
char buffer[SCREEN_WIDTH_CHARS + 1];
|
||||
vformat_buf(buffer, sizeof(buffer),
|
||||
loc::gettext("{savebox_n_trinkets|wordy}"),
|
||||
"savebox_n_trinkets:int",
|
||||
game.quick_trinkets
|
||||
summary->trinkets
|
||||
);
|
||||
font::print(PR_RIGHT, 262, 132-20, buffer, 255 - (help.glow / 2), 255 - (help.glow / 2), 255 - (help.glow / 2));
|
||||
|
||||
graphics.draw_sprite(34, 126-20, 50, graphics.col_clock);
|
||||
graphics.draw_sprite(270, 126-20, 22, graphics.col_trinket);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Menu::gameover:
|
||||
case Menu::gameover2:
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue