void Menu::updateSettingsMenu()
{
- char sbuf[256];
- if ((float)newscreenwidth > (float)newscreenheight * 1.61 || (float)newscreenwidth < (float)newscreenheight * 1.59)
- sprintf (sbuf, "Resolution: %d*%d", (int)newscreenwidth, (int)newscreenheight);
- else
- sprintf (sbuf, "Resolution: %d*%d (widescreen)", (int)newscreenwidth, (int)newscreenheight);
- Menu::setText(0, sbuf);
- Menu::setText(14, fullscreen ? "Fullscreen: On" : "Fullscreen: Off");
- if (newdetail == 0) Menu::setText(1, "Detail: Low");
- if (newdetail == 1) Menu::setText(1, "Detail: Medium");
- if (newdetail == 2) Menu::setText(1, "Detail: High");
- if (bloodtoggle == 0) Menu::setText(2, "Blood: Off");
- if (bloodtoggle == 1) Menu::setText(2, "Blood: On, low detail");
- if (bloodtoggle == 2) Menu::setText(2, "Blood: On, high detail (slower)");
- if (difficulty == 0) Menu::setText(3, "Difficulty: Easier");
- if (difficulty == 1) Menu::setText(3, "Difficulty: Difficult");
- if (difficulty == 2) Menu::setText(3, "Difficulty: Insane");
- Menu::setText(4, ismotionblur ? "Blur Effects: Enabled (less compatible)" : "Blur Effects: Disabled (more compatible)");
- Menu::setText(5, decals ? "Decals: Enabled (slower)" : "Decals: Disabled");
- Menu::setText(6, musictoggle ? "Music: Enabled" : "Music: Disabled");
- Menu::setText(9, invertmouse ? "Invert mouse: Yes" : "Invert mouse: No");
- sprintf (sbuf, "Mouse Speed: %d", (int)(usermousesensitivity * 5));
- Menu::setText(10, sbuf);
- sprintf (sbuf, "Volume: %d%%", (int)(volume * 100));
- Menu::setText(11, sbuf);
- Menu::setText(13, showdamagebar ? "Damage Bar: On" : "Damage Bar: Off");
- if (newdetail == detail && newscreenheight == (int)screenheight && newscreenwidth == (int)screenwidth)
- sprintf (sbuf, "Back");
- else
- sprintf (sbuf, "Back (some changes take effect next time Lugaru is opened)");
- Menu::setText(8, sbuf);
+ std::string sbuf = std::string("Resolution: ") + to_string(newscreenwidth) + "*" + to_string(newscreenheight);
+ if (((float)newscreenwidth <= (float)newscreenheight * 1.61) && ((float)newscreenwidth >= (float)newscreenheight * 1.59)) {
+ sbuf += " (widescreen)";
+ }
+ setText(0, sbuf);
+ setText(14, fullscreen ? "Fullscreen: On" : "Fullscreen: Off");
+ if (newdetail == 0) setText(1, "Detail: Low");
+ if (newdetail == 1) setText(1, "Detail: Medium");
+ if (newdetail == 2) setText(1, "Detail: High");
+ if (bloodtoggle == 0) setText(2, "Blood: Off");
+ if (bloodtoggle == 1) setText(2, "Blood: On, low detail");
+ if (bloodtoggle == 2) setText(2, "Blood: On, high detail (slower)");
+ if (difficulty == 0) setText(3, "Difficulty: Easier");
+ if (difficulty == 1) setText(3, "Difficulty: Difficult");
+ if (difficulty == 2) setText(3, "Difficulty: Insane");
+ setText(4, ismotionblur ? "Blur Effects: Enabled (less compatible)" : "Blur Effects: Disabled (more compatible)");
+ setText(5, decals ? "Decals: Enabled (slower)" : "Decals: Disabled");
+ setText(6, musictoggle ? "Music: Enabled" : "Music: Disabled");
+ setText(9, invertmouse ? "Invert mouse: Yes" : "Invert mouse: No");
+ setText(10, std::string("Mouse Speed: ") + to_string(int(usermousesensitivity * 5)));
+ setText(11, std::string("Volume: ") + to_string(int(volume * 100)) + "%");
+ setText(13, showdamagebar ? "Damage Bar: On" : "Damage Bar: Off");
+ if ((newdetail == detail) && (newscreenheight == (int)screenheight) && (newscreenwidth == (int)screenwidth)) {
+ setText(8, "Back");
+ } else {
+ setText(8, "Back (some changes take effect next time Lugaru is opened)");
+ }
}
void Menu::updateStereoConfigMenu()
{
- char sbuf[256];
- sprintf(sbuf, "Stereo mode: %s", StereoModeName(newstereomode).c_str());
- Menu::setText(0, sbuf);
- sprintf(sbuf, "Stereo separation: %.3f", stereoseparation);
- Menu::setText(1, sbuf);
- sprintf(sbuf, "Reverse stereo: %s", stereoreverse ? "Yes" : "No");
- Menu::setText(2, sbuf);
+ setText(0, std::string("Stereo mode: ") + StereoModeName(newstereomode));
+ setText(1, std::string("Stereo separation: ") + to_string(stereoseparation));
+ setText(2, std::string("Reverse stereo: ") + (stereoreverse ? "Yes" : "No"));
}
void Menu::updateControlsMenu()
{
- Menu::setText(0, (string)"Forwards: " + (keyselect == 0 ? "_" : Input::keyToChar(forwardkey)));
- Menu::setText(1, (string)"Back: " + (keyselect == 1 ? "_" : Input::keyToChar(backkey)));
- Menu::setText(2, (string)"Left: " + (keyselect == 2 ? "_" : Input::keyToChar(leftkey)));
- Menu::setText(3, (string)"Right: " + (keyselect == 3 ? "_" : Input::keyToChar(rightkey)));
- Menu::setText(4, (string)"Crouch: " + (keyselect == 4 ? "_" : Input::keyToChar(crouchkey)));
- Menu::setText(5, (string)"Jump: " + (keyselect == 5 ? "_" : Input::keyToChar(jumpkey)));
- Menu::setText(6, (string)"Draw: " + (keyselect == 6 ? "_" : Input::keyToChar(drawkey)));
- Menu::setText(7, (string)"Throw: " + (keyselect == 7 ? "_" : Input::keyToChar(throwkey)));
- Menu::setText(8, (string)"Attack: " + (keyselect == 8 ? "_" : Input::keyToChar(attackkey)));
+ setText(0, (string)"Forwards: " + (keyselect == 0 ? "_" : Input::keyToChar(forwardkey)));
+ setText(1, (string)"Back: " + (keyselect == 1 ? "_" : Input::keyToChar(backkey)));
+ setText(2, (string)"Left: " + (keyselect == 2 ? "_" : Input::keyToChar(leftkey)));
+ setText(3, (string)"Right: " + (keyselect == 3 ? "_" : Input::keyToChar(rightkey)));
+ setText(4, (string)"Crouch: " + (keyselect == 4 ? "_" : Input::keyToChar(crouchkey)));
+ setText(5, (string)"Jump: " + (keyselect == 5 ? "_" : Input::keyToChar(jumpkey)));
+ 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) {
- Menu::setText(9, (string)"Console: " + (keyselect == 9 ? "_" : Input::keyToChar(consolekey)));
+ setText(9, (string)"Console: " + (keyselect == 9 ? "_" : Input::keyToChar(consolekey)));
}
}
void Menu::Load()
{
- Menu::clearMenu();
+ clearMenu();
switch (mainmenu) {
case 1:
case 2:
- Menu::addImage(0, Mainmenuitems[0], 150, 480 - 128, 256, 128);
- Menu::addButtonImage(1, Mainmenuitems[mainmenu == 1 ? 1 : 5], 18, 480 - 152 - 32, 128, 32);
- Menu::addButtonImage(2, Mainmenuitems[2], 18, 480 - 228 - 32, 112, 32);
- Menu::addButtonImage(3, Mainmenuitems[mainmenu == 1 ? 3 : 6], 18, 480 - 306 - 32, mainmenu == 1 ? 68 : 132, 32);
+ addImage(0, Mainmenuitems[0], 150, 480 - 128, 256, 128);
+ addButtonImage(1, Mainmenuitems[mainmenu == 1 ? 1 : 5], 18, 480 - 152 - 32, 128, 32);
+ addButtonImage(2, Mainmenuitems[2], 18, 480 - 228 - 32, 112, 32);
+ addButtonImage(3, Mainmenuitems[mainmenu == 1 ? 3 : 6], 18, 480 - 306 - 32, mainmenu == 1 ? 68 : 132, 32);
break;
case 3:
- Menu::addButton( 0, "", 10 + 20, 440);
- Menu::addButton(14, "", 10 + 400, 440);
- Menu::addButton( 1, "", 10 + 60, 405);
- Menu::addButton( 2, "", 10 + 70, 370);
- Menu::addButton( 3, "", 10 + 20 - 1000, 335 - 1000);
- Menu::addButton( 4, "", 10 , 335);
- Menu::addButton( 5, "", 10 + 60, 300);
- Menu::addButton( 6, "", 10 + 70, 265);
- Menu::addButton( 9, "", 10 , 230);
- Menu::addButton(10, "", 20 , 195);
- Menu::addButton(11, "", 10 + 60, 160);
- Menu::addButton(13, "", 30 , 125);
- Menu::addButton( 7, "-Configure Controls-", 10 + 15, 90);
- Menu::addButton(12, "-Configure Stereo -", 10 + 15, 55);
- Menu::addButton(8, "Back", 10, 10);
+ addButton( 0, "", 10 + 20, 440);
+ addButton(14, "", 10 + 400, 440);
+ addButton( 1, "", 10 + 60, 405);
+ addButton( 2, "", 10 + 70, 370);
+ addButton( 3, "", 10 + 20 - 1000, 335 - 1000);
+ addButton( 4, "", 10 , 335);
+ addButton( 5, "", 10 + 60, 300);
+ addButton( 6, "", 10 + 70, 265);
+ addButton( 9, "", 10 , 230);
+ addButton(10, "", 20 , 195);
+ addButton(11, "", 10 + 60, 160);
+ addButton(13, "", 30 , 125);
+ addButton( 7, "-Configure Controls-", 10 + 15, 90);
+ addButton(12, "-Configure Stereo -", 10 + 15, 55);
+ addButton(8, "Back", 10, 10);
updateSettingsMenu();
break;
case 4:
- Menu::addButton(0, "", 10 , 400);
- Menu::addButton(1, "", 10 + 40, 360);
- Menu::addButton(2, "", 10 + 40, 320);
- Menu::addButton(3, "", 10 + 30, 280);
- Menu::addButton(4, "", 10 + 20, 240);
- Menu::addButton(5, "", 10 + 40, 200);
- Menu::addButton(6, "", 10 + 40, 160);
- Menu::addButton(7, "", 10 + 30, 120);
- Menu::addButton(8, "", 10 + 20, 80);
+ addButton(0, "", 10 , 400);
+ addButton(1, "", 10 + 40, 360);
+ addButton(2, "", 10 + 40, 320);
+ addButton(3, "", 10 + 30, 280);
+ addButton(4, "", 10 + 20, 240);
+ addButton(5, "", 10 + 40, 200);
+ addButton(6, "", 10 + 40, 160);
+ addButton(7, "", 10 + 30, 120);
+ addButton(8, "", 10 + 20, 80);
if (debugmode) {
- Menu::addButton(9, "", 10 + 10, 40);
+ addButton(9, "", 10 + 10, 40);
}
- Menu::addButton(debugmode ? 10 : 9, "Back", 10, 10);
+ addButton(debugmode ? 10 : 9, "Back", 10, 10);
updateControlsMenu();
break;
case 5: {
LoadCampaign();
- Menu::addLabel(-1, accountactive->getName(), 5, 400);
- Menu::addButton(1, "Tutorial", 5, 300);
- Menu::addButton(2, "Challenge", 5, 240);
- Menu::addButton(3, "Delete User", 400, 10);
- Menu::addButton(4, "Main Menu", 5, 10);
- Menu::addButton(5, "Change User", 5, 180);
- Menu::addButton(6, "Campaign : " + accountactive->getCurrentCampaign(), 200, 420);
+ addLabel(-1, accountactive->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);
//show campaign map
//with (2,-5) offset from old code
- Menu::addImage(-1, Mainmenuitems[7], 150 + 2, 60 - 5, 400, 400);
+ addImage(-1, Mainmenuitems[7], 150 + 2, 60 - 5, 400, 400);
//show levels
int numlevels = accountactive->getCampaignChoicesMade();
numlevels += numlevels > 0 ? campaignlevels[numlevels - 1].nextlevel.size() : 1;
if (i >= 1) {
XYZ start = campaignlevels[i - 1].getCenter();
- Menu::addMapLine(start.x, start.y, midpoint.x - start.x, midpoint.y - start.y, 0.5, active ? 1 : 0.5, active ? 1 : 0.5, 0, 0);
+ addMapLine(start.x, start.y, midpoint.x - start.x, midpoint.y - start.y, 0.5, active ? 1 : 0.5, active ? 1 : 0.5, 0, 0);
}
- Menu::addMapMarker(NB_CAMPAIGN_MENU_ITEM + i, Mapcircletexture,
+ addMapMarker(NB_CAMPAIGN_MENU_ITEM + i, Mapcircletexture,
midpoint.x - itemsize / 2, midpoint.y - itemsize / 2, itemsize, itemsize, active ? 1 : 0.5, 0, 0);
if (active) {
- Menu::addMapLabel(-2, campaignlevels[i].description,
+ addMapLabel(-2, campaignlevels[i].description,
campaignlevels[i].getStartX() + 10,
campaignlevels[i].getStartY() - 4);
}
}
break;
case 6:
- Menu::addLabel(-1, "Are you sure you want to delete this user?", 10, 400);
- Menu::addButton(1, "Yes", 10, 360);
- Menu::addButton(2, "No", 10, 320);
+ addLabel(-1, "Are you sure you want to delete this user?", 10, 400);
+ addButton(1, "Yes", 10, 360);
+ addButton(2, "No", 10, 320);
break;
case 7:
if (Account::getNbAccounts() < 8)
- Menu::addButton(0, "New User", 10, 400);
+ addButton(0, "New User", 10, 400);
else
- Menu::addLabel(0, "No More Users", 10, 400);
- Menu::addLabel(-2, "", 20, 400);
- Menu::addButton(Account::getNbAccounts() + 1, "Back", 10, 10);
+ addLabel(0, "No More Users", 10, 400);
+ addLabel(-2, "", 20, 400);
+ addButton(Account::getNbAccounts() + 1, "Back", 10, 10);
for (int i = 0; i < Account::getNbAccounts(); i++)
- Menu::addButton(i + 1, Account::get(i)->getName(), 10, 340 - 20 * (i + 1));
+ addButton(i + 1, Account::get(i)->getName(), 10, 340 - 20 * (i + 1));
break;
case 8:
- Menu::addButton(0, "Easier", 10, 400);
- Menu::addButton(1, "Difficult", 10, 360);
- Menu::addButton(2, "Insane", 10, 320);
+ addButton(0, "Easier", 10, 400);
+ addButton(1, "Difficult", 10, 360);
+ addButton(2, "Insane", 10, 320);
break;
case 9:
for (int i = 0; i < numchallengelevels; i++) {
- char temp[255];
- string name = "";
- sprintf (temp, "Level %d", i + 1);
- for (int j = strlen(temp); j < 17; j++)
- strcat(temp, " ");
- name += temp;
- sprintf (temp, "%d", (int)accountactive->getHighScore(i));
- for (int j = strlen(temp); j < (32 - 17); j++)
- strcat(temp, " ");
- name += temp;
- sprintf (temp, "%d:", (int)(((int)accountactive->getFastTime(i) - (int)(accountactive->getFastTime(i)) % 60) / 60));
+ string name = "Level ";
+ name += to_string(i + 1);
+ if (name.size() < 17) {
+ name.append((17 - name.size()), ' ');
+ }
+ name += to_string(int(accountactive->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));
+ name += ":";
if ((int)(accountactive->getFastTime(i)) % 60 < 10)
- strcat(temp, "0");
- name += temp;
- sprintf (temp, "%d", (int)(accountactive->getFastTime(i)) % 60);
- name += temp;
+ name += "0";
+ name += to_string((int)(accountactive->getFastTime(i)) % 60);
- Menu::addButton(i, name, 10, 400 - i * 25, i > accountactive->getProgress() ? 0.5 : 1, 0, 0);
+ addButton(i, name, 10, 400 - i * 25, i > accountactive->getProgress() ? 0.5 : 1, 0, 0);
}
- Menu::addButton(-1, " High Score Best Time", 10, 440);
- Menu::addButton(numchallengelevels, "Back", 10, 10);
+ addButton(-1, " High Score Best Time", 10, 440);
+ addButton(numchallengelevels, "Back", 10, 10);
break;
case 10: {
- Menu::addLabel(0, "Congratulations!", 220, 330);
- Menu::addLabel(1, "You have avenged your family and", 140, 300);
- Menu::addLabel(2, "restored peace to the island of Lugaru.", 110, 270);
- Menu::addButton(3, "Back", 10, 10);
- char sbuf[256];
- sprintf(sbuf, "Your score: %d", (int)accountactive->getCampaignScore());
- Menu::addLabel(4, sbuf, 190, 200);
- sprintf(sbuf, "Highest score: %d", (int)accountactive->getCampaignHighScore());
- Menu::addLabel(5, sbuf, 190, 180);
+ addLabel(0, "Congratulations!", 220, 330);
+ 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);
}
break;
case 18:
- Menu::addButton(0, "", 70, 400);
- Menu::addButton(1, "", 10, 360);
- Menu::addButton(2, "", 40, 320);
- Menu::addButton(3, "Back", 10, 10);
+ addButton(0, "", 70, 400);
+ addButton(1, "", 10, 360);
+ addButton(2, "", 40, 320);
+ addButton(3, "Back", 10, 10);
updateStereoConfigMenu();
break;
}
}
//menu buttons
- selected = Menu::getSelected(mousecoordh * 640 / screenwidth, 480 - mousecoordv * 480 / screenheight);
+ selected = getSelected(mousecoordh * 640 / screenwidth, 480 - mousecoordv * 480 / screenheight);
// some specific case where we do something even if the left mouse button is not pressed.
if ((mainmenu == 5) && (endgame == 2)) {
c = campaigns.begin();
accountactive->setCurrentCampaign(*c);
}
- Menu::Load();
+ Load();
break;
}
break;
displayselected = 0;
}
entername = 0;
- Menu::Load();
+ Load();
}
displayblinkdelay -= multiplier;
}
if (entername) {
- Menu::setText(0, displaytext[0], 20, 400, -1, -1);
- Menu::setText(-2, displayblink ? "_" : "", 20 + displayselected * 10, 400, -1, -1);
+ setText(0, displaytext[0], 20, 400, -1, -1);
+ setText(-2, displayblink ? "_" : "", 20 + displayselected * 10, 400, -1, -1);
}
if (oldmainmenu != mainmenu)
- Menu::Load();
+ Load();
oldmainmenu = mainmenu;
}