+ }
+ break;
+ default:
+ case MenuItem::NONE:
+ break;
+ }
+ }
+}
+
+void Menu::updateSettingsMenu()
+{
+ 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)");
+ 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()
+{
+ 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()
+{
+ 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 (devtools) {
+ setText(9, (string)"Console: " + (keyselect == 9 ? "_" : Input::keyToChar(consolekey)));
+ }
+}
+
+/*
+Values of mainmenu :
+1 Main menu
+2 Menu pause (resume/end game)
+3 Option menu
+4 Controls configuration menu
+5 Main game menu (choose level or challenge)
+6 Deleting user menu
+7 User managment menu (select/add)
+8 Choose difficulty menu
+9 Challenge level selection menu
+10 End of the campaign congratulation (is that really a menu?)
+11 Same that 9 ??? => unused
+18 stereo configuration
+*/
+
+void Menu::Load()
+{
+ clearMenu();
+ switch (mainmenu) {
+ case 1:
+ case 2:
+ 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:
+ addButton( 0, "", 10 + 20, 440);
+ addButton(14, "", 10 + 400, 440);
+ addButton( 1, "", 10 + 60, 405);
+ addButton( 2, "", 10 + 70, 370);
+ 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:
+ 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 (devtools) {
+ addButton(9, "", 10 + 10, 40);
+ }
+ addButton(devtools ? 10 : 9, "Back", 10, 10);
+ updateControlsMenu();
+ break;
+ case 5: {
+ LoadCampaign();
+ 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 : " + 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 = 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 >= Account::active().getCampaignChoicesMade());
+ if (!active) {
+ itemsize /= 2;
+ }
+
+ if (i >= 1) {
+ XYZ start = campaignlevels[i - 1].getCenter();
+ 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);
+ }
+ 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) {
+ addMapLabel(-2, campaignlevels[i].description,
+ campaignlevels[i].getStartX() + 10,
+ campaignlevels[i].getStartY() - 4);
+ }