X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FMenu.cpp;h=d3c9b0d35c3d1dbb2b02c98e027c7e4dca84d507;hb=3de67c0db8c3c74f5fb487579936a07770d253a1;hp=8ed62b466c759a473fdbced994350bd1657d6eba;hpb=5030327d977d2232e0892e36661f509e68295635;p=lugaru.git diff --git a/Source/Menu.cpp b/Source/Menu.cpp index 8ed62b4..d3c9b0d 100644 --- a/Source/Menu.cpp +++ b/Source/Menu.cpp @@ -329,7 +329,7 @@ void Menu::updateControlsMenu() setText(6, (string)"Draw: " + (keyselect == 6 ? "_" : Input::keyToChar(drawkey))); setText(7, (string)"Throw: " + (keyselect == 7 ? "_" : Input::keyToChar(throwkey))); setText(8, (string)"Attack: " + (keyselect == 8 ? "_" : Input::keyToChar(attackkey))); - if (debugmode) { + if (devtools) { setText(9, (string)"Console: " + (keyselect == 9 ? "_" : Input::keyToChar(consolekey))); } } @@ -389,32 +389,32 @@ void Menu::Load() addButton(6, "", 10 + 40, 160); addButton(7, "", 10 + 30, 120); addButton(8, "", 10 + 20, 80); - if (debugmode) { + if (devtools) { addButton(9, "", 10 + 10, 40); } - addButton(debugmode ? 10 : 9, "Back", 10, 10); + addButton(devtools ? 10 : 9, "Back", 10, 10); updateControlsMenu(); break; case 5: { LoadCampaign(); - addLabel(-1, accountactive->getName(), 5, 400); + addLabel(-1, Account::active->getName(), 5, 400); addButton(1, "Tutorial", 5, 300); addButton(2, "Challenge", 5, 240); addButton(3, "Delete User", 400, 10); addButton(4, "Main Menu", 5, 10); addButton(5, "Change User", 5, 180); - addButton(6, "Campaign : " + accountactive->getCurrentCampaign(), 200, 420); + addButton(6, "Campaign : " + Account::active->getCurrentCampaign(), 200, 420); //show campaign map //with (2,-5) offset from old code addImage(-1, Mainmenuitems[7], 150 + 2, 60 - 5, 400, 400); //show levels - int numlevels = accountactive->getCampaignChoicesMade(); + int numlevels = Account::active->getCampaignChoicesMade(); numlevels += numlevels > 0 ? campaignlevels[numlevels - 1].nextlevel.size() : 1; for (int i = 0; i < numlevels; i++) { XYZ midpoint = campaignlevels[i].getCenter(); float itemsize = campaignlevels[i].getWidth(); - const bool active = i >= accountactive->getCampaignChoicesMade(); + const bool active = i >= Account::active->getCampaignChoicesMade(); if (!active) itemsize /= 2; @@ -460,17 +460,18 @@ void Menu::Load() if (name.size() < 17) { name.append((17 - name.size()), ' '); } - name += to_string(int(accountactive->getHighScore(i))); + name += to_string(int(Account::active->getHighScore(i))); if (name.size() < 32) { name.append((32 - name.size()), ' '); } - name += to_string(int((int(accountactive->getFastTime(i)) - int(accountactive->getFastTime(i)) % 60) / 60)); + int fasttime = (int)round(Account::active->getFastTime(i)); + name += to_string(int((fasttime - fasttime % 60) / 60)); name += ":"; - if ((int)(accountactive->getFastTime(i)) % 60 < 10) + if (fasttime % 60 < 10) name += "0"; - name += to_string((int)(accountactive->getFastTime(i)) % 60); + name += to_string(fasttime % 60); - addButton(i, name, 10, 400 - i * 25, i > accountactive->getProgress() ? 0.5 : 1, 0, 0); + addButton(i, name, 10, 400 - i * 25, i > Account::active->getProgress() ? 0.5 : 1, 0, 0); } addButton(-1, " High Score Best Time", 10, 440); @@ -481,8 +482,8 @@ void Menu::Load() addLabel(1, "You have avenged your family and", 140, 300); addLabel(2, "restored peace to the island of Lugaru.", 110, 270); addButton(3, "Back", 10, 10); - addLabel(4, string("Your score: ") + to_string((int)accountactive->getCampaignScore()), 190, 200); - addLabel(5, string("Highest score: ") + to_string((int)accountactive->getCampaignHighScore()), 190, 180); + addLabel(4, string("Your score: ") + to_string((int)Account::active->getCampaignScore()), 190, 200); + addLabel(5, string("Highest score: ") + to_string((int)Account::active->getCampaignHighScore()), 190, 180); } break; case 18: @@ -534,7 +535,7 @@ void Menu::Tick() // some specific case where we do something even if the left mouse button is not pressed. if ((mainmenu == 5) && (endgame == 2)) { - accountactive->endGame(); + Account::active->endGame(); endgame = 0; } if (mainmenu == 10) @@ -560,7 +561,7 @@ void Menu::Tick() } else { //new game fireSound(firestartsound); flash(); - mainmenu = (accountactive ? 5 : 7); + mainmenu = (Account::active ? 5 : 7); selected = -1; } break; @@ -687,11 +688,11 @@ void Menu::Tick() case 4: if (!waiting) { fireSound(); - if (selected < (debugmode ? 10 : 9) && keyselect == -1) + if (selected < (devtools ? 10 : 9) && keyselect == -1) keyselect = selected; if (keyselect != -1) setKeySelected(); - if (selected == (debugmode ? 10 : 9)) { + if (selected == (devtools ? 10 : 9)) { flash(); mainmenu = 3; } @@ -701,7 +702,7 @@ void Menu::Tick() case 5: fireSound(); flash(); - if ((selected - NB_CAMPAIGN_MENU_ITEM >= accountactive->getCampaignChoicesMade())) { + if ((selected - NB_CAMPAIGN_MENU_ITEM >= Account::active->getCampaignChoicesMade())) { startbonustotal = 0; loading = 2; @@ -711,8 +712,8 @@ void Menu::Tick() TickOnceAfter(); else LoadStuff(); - whichchoice = selected - NB_CAMPAIGN_MENU_ITEM - accountactive->getCampaignChoicesMade(); - actuallevel = (accountactive->getCampaignChoicesMade() > 0 ? campaignlevels[accountactive->getCampaignChoicesMade() - 1].nextlevel[whichchoice] : 0); + whichchoice = selected - NB_CAMPAIGN_MENU_ITEM - Account::active->getCampaignChoicesMade(); + actuallevel = (Account::active->getCampaignChoicesMade() > 0 ? campaignlevels[Account::active->getCampaignChoicesMade() - 1].nextlevel[whichchoice] : 0); visibleloading = 1; stillloading = 1; Loadlevel(campaignlevels[actuallevel].mapname.c_str()); @@ -753,14 +754,14 @@ void Menu::Tick() case 6: vector campaigns = ListCampaigns(); vector::iterator c; - if ((c = find(campaigns.begin(), campaigns.end(), accountactive->getCurrentCampaign())) == campaigns.end()) { + if ((c = find(campaigns.begin(), campaigns.end(), Account::active->getCurrentCampaign())) == campaigns.end()) { if (!campaigns.empty()) - accountactive->setCurrentCampaign(campaigns.front()); + Account::active->setCurrentCampaign(campaigns.front()); } else { c++; if (c == campaigns.end()) c = campaigns.begin(); - accountactive->setCurrentCampaign(*c); + Account::active->setCurrentCampaign(*c); } Load(); break; @@ -770,7 +771,7 @@ void Menu::Tick() fireSound(); if (selected == 1) { flash(); - accountactive = Account::destroy(accountactive); + Account::active = Account::destroy(Account::active); mainmenu = 7; } else if (selected == 2) { flash(); @@ -784,10 +785,10 @@ void Menu::Tick() } else if (selected < Account::getNbAccounts() + 1) { flash(); mainmenu = 5; - accountactive = Account::get(selected - 1); + Account::active = Account::get(selected - 1); } else if (selected == Account::getNbAccounts() + 1) { flash(); - if (accountactive) + if (Account::active) mainmenu = 5; else mainmenu = 1; @@ -800,11 +801,11 @@ void Menu::Tick() fireSound(); flash(); if (selected <= 2) - accountactive->setDifficulty(selected); + Account::active->setDifficulty(selected); mainmenu = 5; break; case 9: - if (selected < numchallengelevels && selected <= accountactive->getProgress()) { + if (selected < numchallengelevels && selected <= Account::active->getProgress()) { fireSound(); flash(); @@ -871,7 +872,7 @@ void Menu::Tick() inputText(displaytext[0], &displayselected); if (!waiting) { // the input as finished if (!displaytext[0].empty()) { // with enter - accountactive = Account::add(string(displaytext[0])); + Account::active = Account::add(string(displaytext[0])); mainmenu = 8;