diff --git a/src/common/ui/MI_SelectField.cpp b/src/common/ui/MI_SelectField.cpp index b7046253..eb5651cd 100644 --- a/src/common/ui/MI_SelectField.cpp +++ b/src/common/ui/MI_SelectField.cpp @@ -690,10 +690,10 @@ void MI_SelectFieldDyn::updateOutput() const template -void MI_SelectFieldDyn::add(std::string name, T value, bool hidden, bool goodRandom, short iconOverride) +void MI_SelectFieldDyn::add(std::string name, T value, bool hidden, bool goodRandom) { size_t new_idx = m_items.size(); - m_items.emplace_back(std::move(name), std::move(value), hidden, iconOverride); + m_items.emplace_back(std::move(name), std::move(value), hidden, -1); m_index = 0; if (goodRandom) @@ -797,3 +797,4 @@ bool MI_SelectFieldDyn::moveRandom() // Actual typed classes template class MI_SelectFieldDyn; +template class MI_SelectFieldDyn; diff --git a/src/common/ui/MI_SelectField.h b/src/common/ui/MI_SelectField.h index 2f59e71a..2e87a493 100644 --- a/src/common/ui/MI_SelectField.h +++ b/src/common/ui/MI_SelectField.h @@ -243,7 +243,7 @@ class MI_SelectFieldDyn : public UI_Control { //! Sets the currently selected item bool setCurrentIndex(size_t index); //! Adds an item to the list - void add(std::string name, T value, bool hidden = false, bool goodRandom = true, short iconOverride = -1); + void add(std::string name, T value, bool hidden = false, bool goodRandom = true); //! Removes all items void clear(); //! Hides the items containing the specified value diff --git a/src/common/ui/MI_SliderField.cpp b/src/common/ui/MI_SliderField.cpp index 5bd68701..856a7393 100644 --- a/src/common/ui/MI_SliderField.cpp +++ b/src/common/ui/MI_SliderField.cpp @@ -10,11 +10,11 @@ extern CResourceManager* rm; * MI_SliderField Class **************************************/ -MI_SliderField::MI_SliderField(gfxSprite * nspr, gfxSprite * nsprSlider, short x, short y, const char * name, short width, short indent1, short indent2) : - MI_SelectField(nspr, x, y, name, width, indent1) +MI_SliderField::MI_SliderField(gfxSprite * nspr, gfxSprite * nsprSlider, short x, short y, const char * name, short width, short indent1, short indent2) + : MI_SelectFieldDyn(nspr, x, y, name, width, indent1) { - iIndent2 = indent2; - sprSlider = nsprSlider; + m_indent2 = indent2; + m_sprSlider = nsprSlider; SetPosition(x, y); } @@ -24,9 +24,9 @@ MI_SliderField::~MI_SliderField() void MI_SliderField::SetPosition(short x, short y) { - MI_SelectField::SetPosition(x, y); - miModifyImageLeft->SetPosition(ix + iIndent - 26, iy + 4); - miModifyImageRight->SetPosition(ix + iWidth - 16, iy + 4); + MI_SelectFieldDyn::SetPosition(x, y); + miModifyImageLeft->SetPosition(ix + m_indent - 26, iy + 4); + miModifyImageRight->SetPosition(ix + m_width - 16, iy + 4); } void MI_SliderField::Draw() @@ -34,34 +34,36 @@ void MI_SliderField::Draw() if (!fShow) return; - spr->draw(ix, iy, 0, (fSelected ? 32 : 0) + iAdjustmentY, iIndent - 16, 32); - spr->draw(ix + iIndent - 16, iy, 0, (fSelected ? 96 : 64), 32, 32); - spr->draw(ix + iIndent + 16, iy, 528 - iWidth + iIndent, (fSelected ? 32 : 0) + iAdjustmentY, iWidth - iIndent - 16, 32); + m_spr->draw(ix, iy, 0, (fSelected ? 32 : 0) + m_adjustmentY, m_indent - 16, 32); + m_spr->draw(ix + m_indent - 16, iy, 0, (fSelected ? 96 : 64), 32, 32); + m_spr->draw(ix + m_indent + 16, iy, 528 - m_width + m_indent, (fSelected ? 32 : 0) + m_adjustmentY, m_width - m_indent - 16, 32); - rm->menu_font_large.drawChopRight(ix + 16, iy + 5, iIndent - 8, szName.c_str()); + rm->menu_font_large.drawChopRight(ix + 16, iy + 5, m_indent - 8, m_name.c_str()); - if (!items.empty()) { - rm->menu_font_large.drawChopRight(ix + iIndent2 + 16, iy + 5, iWidth - iIndent2 - 24, (*current)->sName.c_str()); + if (!m_items.empty()) { + rm->menu_font_large.drawChopRight(ix + m_indent2 + 16, iy + 5, m_width - m_indent2 - 24, currentItem().name.c_str()); } - short iSpacing = (iIndent2 - iIndent - 20) / ((short)items.size() - 1); + short iSpacing = (m_indent2 - m_indent - 20) / ((short)m_items.size() - 1); short iSpot = 0; - for (unsigned int index = 0; index < items.size(); index++) { - if (index < items.size() - 1) - sprSlider->draw(ix + iIndent + iSpot + 16, iy + 10, 0, 0, iSpacing, 13); + for (unsigned int index = 0; index < m_items.size(); index++) { + if (index < m_items.size() - 1) + m_sprSlider->draw(ix + m_indent + iSpot + 16, iy + 10, 0, 0, iSpacing, 13); else - sprSlider->draw(ix + iIndent + iSpot + 16, iy + 10, 164, 0, 4, 13); + m_sprSlider->draw(ix + m_indent + iSpot + 16, iy + 10, 164, 0, 4, 13); iSpot += iSpacing; } - sprSlider->draw(ix + iIndent + (iIndex * iSpacing) + 14, iy + 8, 168, 0, 8, 16); + m_sprSlider->draw(ix + m_indent + (m_index * iSpacing) + 14, iy + 8, 168, 0, 8, 16); - if (current != items.begin() || !fNoWrap) + const bool drawLeft = m_index > 0; + if (m_wraps || drawLeft) miModifyImageLeft->Draw(); - if (current != --items.end() || !fNoWrap) + const bool drawRight = (m_index + 1) < m_items.size(); + if (m_wraps || drawRight) miModifyImageRight->Draw(); } @@ -69,14 +71,14 @@ MenuCodeEnum MI_SliderField::SendInput(CPlayerInput * playerInput) { for (int iPlayer = 0; iPlayer < 4; iPlayer++) { if (playerInput->outputControls[iPlayer].menu_scrollfast.fPressed) { - if (iIndex == 0) - while (MoveNext()); + if (m_index == 0) + while (moveNext()); else - while (MovePrev()); + while (movePrev()); return mcItemChangedCode; } } - return MI_SelectField::SendInput(playerInput); + return MI_SelectFieldDyn::SendInput(playerInput); } diff --git a/src/common/ui/MI_SliderField.h b/src/common/ui/MI_SliderField.h index 3bd745ce..652d401b 100644 --- a/src/common/ui/MI_SliderField.h +++ b/src/common/ui/MI_SliderField.h @@ -1,27 +1,21 @@ -#ifndef UI_SLIDER_FIELD_H -#define UI_SLIDER_FIELD_H +#pragma once #include "ui/MI_SelectField.h" -class MI_SliderField : public MI_SelectField -{ -public: +class MI_SliderField : public MI_SelectFieldDyn { +public: MI_SliderField(gfxSprite * nspr, gfxSprite * nsprSlider, short x, short y, const char * name, short width, short indent1, short indent2); virtual ~MI_SliderField(); void SetPosition(short x, short y); //Draws every frame - virtual void Draw(); + void Draw() override; //Sends player input to control on every frame - MenuCodeEnum SendInput(CPlayerInput * playerInput); + MenuCodeEnum SendInput(CPlayerInput * playerInput) override; protected: - - gfxSprite * sprSlider; - short iIndent2; - + gfxSprite* m_sprSlider; + short m_indent2; }; - -#endif // UI_SLIDER_FIELD_H diff --git a/src/smw/menu/ModeOptionsMenu.cpp b/src/smw/menu/ModeOptionsMenu.cpp index 8ba24f85..6df3041a 100644 --- a/src/smw/menu/ModeOptionsMenu.cpp +++ b/src/smw/menu/ModeOptionsMenu.cpp @@ -104,30 +104,30 @@ UI_ModeOptionsMenu::UI_ModeOptionsMenu() miTimeLimitModeScoringField->SetKey(game_values.gamemodemenusettings.time.scoring); miTimeLimitModePercentExtraTime = new MI_SliderField(&rm->spr_selectfield, &rm->menu_slider_bar, 120, 260, "Extra Time", 400, 150, 384); - miTimeLimitModePercentExtraTime->Add("0", 0, false, false); - miTimeLimitModePercentExtraTime->Add("5", 5, false, false); - miTimeLimitModePercentExtraTime->Add("10", 10); - miTimeLimitModePercentExtraTime->Add("15", 15); - miTimeLimitModePercentExtraTime->Add("20", 20); - miTimeLimitModePercentExtraTime->Add("25", 25); - miTimeLimitModePercentExtraTime->Add("30", 30); - miTimeLimitModePercentExtraTime->Add("35", 35); - miTimeLimitModePercentExtraTime->Add("40", 40); - miTimeLimitModePercentExtraTime->Add("45", 45); - miTimeLimitModePercentExtraTime->Add("50", 50); - miTimeLimitModePercentExtraTime->Add("55", 55, false, false); - miTimeLimitModePercentExtraTime->Add("60", 60, false, false); - miTimeLimitModePercentExtraTime->Add("65", 65, false, false); - miTimeLimitModePercentExtraTime->Add("70", 70, false, false); - miTimeLimitModePercentExtraTime->Add("75", 75, false, false); - miTimeLimitModePercentExtraTime->Add("80", 80, false, false); - miTimeLimitModePercentExtraTime->Add("85", 85, false, false); - miTimeLimitModePercentExtraTime->Add("90", 90, false, false); - miTimeLimitModePercentExtraTime->Add("95", 95, false, false); - miTimeLimitModePercentExtraTime->Add("100", 100, false, false); - miTimeLimitModePercentExtraTime->SetData(&game_values.gamemodemenusettings.time.percentextratime, NULL, NULL); - miTimeLimitModePercentExtraTime->SetKey(game_values.gamemodemenusettings.time.percentextratime); - miTimeLimitModePercentExtraTime->SetNoWrap(true); + miTimeLimitModePercentExtraTime->add("0", 0, false, false); + miTimeLimitModePercentExtraTime->add("5", 5, false, false); + miTimeLimitModePercentExtraTime->add("10", 10); + miTimeLimitModePercentExtraTime->add("15", 15); + miTimeLimitModePercentExtraTime->add("20", 20); + miTimeLimitModePercentExtraTime->add("25", 25); + miTimeLimitModePercentExtraTime->add("30", 30); + miTimeLimitModePercentExtraTime->add("35", 35); + miTimeLimitModePercentExtraTime->add("40", 40); + miTimeLimitModePercentExtraTime->add("45", 45); + miTimeLimitModePercentExtraTime->add("50", 50); + miTimeLimitModePercentExtraTime->add("55", 55, false, false); + miTimeLimitModePercentExtraTime->add("60", 60, false, false); + miTimeLimitModePercentExtraTime->add("65", 65, false, false); + miTimeLimitModePercentExtraTime->add("70", 70, false, false); + miTimeLimitModePercentExtraTime->add("75", 75, false, false); + miTimeLimitModePercentExtraTime->add("80", 80, false, false); + miTimeLimitModePercentExtraTime->add("85", 85, false, false); + miTimeLimitModePercentExtraTime->add("90", 90, false, false); + miTimeLimitModePercentExtraTime->add("95", 95, false, false); + miTimeLimitModePercentExtraTime->add("100", 100, false, false); + miTimeLimitModePercentExtraTime->setOutputPtr(&game_values.gamemodemenusettings.time.percentextratime); + miTimeLimitModePercentExtraTime->setCurrentValue(game_values.gamemodemenusettings.time.percentextratime); + miTimeLimitModePercentExtraTime->allowWrap(false); miTimeLimitModeBackButton = new MI_Button(&rm->spr_selectfield, 544, 432, "Back", 80, TextAlign::CENTER); miTimeLimitModeBackButton->SetCode(MENU_CODE_BACK_TO_GAME_SETUP_MENU_FROM_MODE_SETTINGS); @@ -185,30 +185,30 @@ UI_ModeOptionsMenu::UI_ModeOptionsMenu() miJailModeTagFreeField->setAutoAdvance(true); miJailModeJailKeyField = new MI_SliderField(&rm->spr_selectfield, &rm->menu_slider_bar, 120, 280, "Jail Key", 400, 150, 384); - miJailModeJailKeyField->Add("0", 0, false, false); - miJailModeJailKeyField->Add("5", 5, false, false); - miJailModeJailKeyField->Add("10", 10); - miJailModeJailKeyField->Add("15", 15); - miJailModeJailKeyField->Add("20", 20); - miJailModeJailKeyField->Add("25", 25); - miJailModeJailKeyField->Add("30", 30); - miJailModeJailKeyField->Add("35", 35); - miJailModeJailKeyField->Add("40", 40); - miJailModeJailKeyField->Add("45", 45); - miJailModeJailKeyField->Add("50", 50); - miJailModeJailKeyField->Add("55", 55, false, false); - miJailModeJailKeyField->Add("60", 60, false, false); - miJailModeJailKeyField->Add("65", 65, false, false); - miJailModeJailKeyField->Add("70", 70, false, false); - miJailModeJailKeyField->Add("75", 75, false, false); - miJailModeJailKeyField->Add("80", 80, false, false); - miJailModeJailKeyField->Add("85", 85, false, false); - miJailModeJailKeyField->Add("90", 90, false, false); - miJailModeJailKeyField->Add("95", 95, false, false); - miJailModeJailKeyField->Add("100", 100, false, false); - miJailModeJailKeyField->SetData(&game_values.gamemodemenusettings.jail.percentkey, NULL, NULL); - miJailModeJailKeyField->SetKey(game_values.gamemodemenusettings.jail.percentkey); - miJailModeJailKeyField->SetNoWrap(true); + miJailModeJailKeyField->add("0", 0, false, false); + miJailModeJailKeyField->add("5", 5, false, false); + miJailModeJailKeyField->add("10", 10); + miJailModeJailKeyField->add("15", 15); + miJailModeJailKeyField->add("20", 20); + miJailModeJailKeyField->add("25", 25); + miJailModeJailKeyField->add("30", 30); + miJailModeJailKeyField->add("35", 35); + miJailModeJailKeyField->add("40", 40); + miJailModeJailKeyField->add("45", 45); + miJailModeJailKeyField->add("50", 50); + miJailModeJailKeyField->add("55", 55, false, false); + miJailModeJailKeyField->add("60", 60, false, false); + miJailModeJailKeyField->add("65", 65, false, false); + miJailModeJailKeyField->add("70", 70, false, false); + miJailModeJailKeyField->add("75", 75, false, false); + miJailModeJailKeyField->add("80", 80, false, false); + miJailModeJailKeyField->add("85", 85, false, false); + miJailModeJailKeyField->add("90", 90, false, false); + miJailModeJailKeyField->add("95", 95, false, false); + miJailModeJailKeyField->add("100", 100, false, false); + miJailModeJailKeyField->setOutputPtr(&game_values.gamemodemenusettings.jail.percentkey); + miJailModeJailKeyField->setCurrentValue(game_values.gamemodemenusettings.jail.percentkey); + miJailModeJailKeyField->allowWrap(false); miJailModeBackButton = new MI_Button(&rm->spr_selectfield, 544, 432, "Back", 80, TextAlign::CENTER); miJailModeBackButton->SetCode(MENU_CODE_BACK_TO_GAME_SETUP_MENU_FROM_MODE_SETTINGS); @@ -257,30 +257,30 @@ UI_ModeOptionsMenu::UI_ModeOptionsMenu() miCoinModeQuantityField->SetKey(game_values.gamemodemenusettings.coins.quantity); miCoinModePercentExtraCoin = new MI_SliderField(&rm->spr_selectfield, &rm->menu_slider_bar, 120, 260, "Extra Coins", 400, 150, 384); - miCoinModePercentExtraCoin->Add("0", 0, false, false); - miCoinModePercentExtraCoin->Add("5", 5, false, false); - miCoinModePercentExtraCoin->Add("10", 10); - miCoinModePercentExtraCoin->Add("15", 15); - miCoinModePercentExtraCoin->Add("20", 20); - miCoinModePercentExtraCoin->Add("25", 25); - miCoinModePercentExtraCoin->Add("30", 30); - miCoinModePercentExtraCoin->Add("35", 35); - miCoinModePercentExtraCoin->Add("40", 40); - miCoinModePercentExtraCoin->Add("45", 45); - miCoinModePercentExtraCoin->Add("50", 50); - miCoinModePercentExtraCoin->Add("55", 55, false, false); - miCoinModePercentExtraCoin->Add("60", 60, false, false); - miCoinModePercentExtraCoin->Add("65", 65, false, false); - miCoinModePercentExtraCoin->Add("70", 70, false, false); - miCoinModePercentExtraCoin->Add("75", 75, false, false); - miCoinModePercentExtraCoin->Add("80", 80, false, false); - miCoinModePercentExtraCoin->Add("85", 85, false, false); - miCoinModePercentExtraCoin->Add("90", 90, false, false); - miCoinModePercentExtraCoin->Add("95", 95, false, false); - miCoinModePercentExtraCoin->Add("100", 100, false, false); - miCoinModePercentExtraCoin->SetData(&game_values.gamemodemenusettings.coins.percentextracoin, NULL, NULL); - miCoinModePercentExtraCoin->SetKey(game_values.gamemodemenusettings.coins.percentextracoin); - miCoinModePercentExtraCoin->SetNoWrap(true); + miCoinModePercentExtraCoin->add("0", 0, false, false); + miCoinModePercentExtraCoin->add("5", 5, false, false); + miCoinModePercentExtraCoin->add("10", 10); + miCoinModePercentExtraCoin->add("15", 15); + miCoinModePercentExtraCoin->add("20", 20); + miCoinModePercentExtraCoin->add("25", 25); + miCoinModePercentExtraCoin->add("30", 30); + miCoinModePercentExtraCoin->add("35", 35); + miCoinModePercentExtraCoin->add("40", 40); + miCoinModePercentExtraCoin->add("45", 45); + miCoinModePercentExtraCoin->add("50", 50); + miCoinModePercentExtraCoin->add("55", 55, false, false); + miCoinModePercentExtraCoin->add("60", 60, false, false); + miCoinModePercentExtraCoin->add("65", 65, false, false); + miCoinModePercentExtraCoin->add("70", 70, false, false); + miCoinModePercentExtraCoin->add("75", 75, false, false); + miCoinModePercentExtraCoin->add("80", 80, false, false); + miCoinModePercentExtraCoin->add("85", 85, false, false); + miCoinModePercentExtraCoin->add("90", 90, false, false); + miCoinModePercentExtraCoin->add("95", 95, false, false); + miCoinModePercentExtraCoin->add("100", 100, false, false); + miCoinModePercentExtraCoin->setOutputPtr(&game_values.gamemodemenusettings.coins.percentextracoin); + miCoinModePercentExtraCoin->setCurrentValue(game_values.gamemodemenusettings.coins.percentextracoin); + miCoinModePercentExtraCoin->allowWrap(false); miCoinModeBackButton = new MI_Button(&rm->spr_selectfield, 544, 432, "Back", 80, TextAlign::CENTER); miCoinModeBackButton->SetCode(MENU_CODE_BACK_TO_GAME_SETUP_MENU_FROM_MODE_SETTINGS); @@ -319,20 +319,20 @@ UI_ModeOptionsMenu::UI_ModeOptionsMenu() for (short iEnemy = 0; iEnemy < NUMSTOMPENEMIES; iEnemy++) { miStompModeEnemySlider[iEnemy] = new MI_PowerupSlider(&rm->spr_selectfield, &rm->menu_slider_bar, &rm->menu_stomp, 120, 80 + 40 * iEnemy, 400, iEnemy); - miStompModeEnemySlider[iEnemy]->Add("", 0, "", false, false); - miStompModeEnemySlider[iEnemy]->Add("", 1, "", false, false); - miStompModeEnemySlider[iEnemy]->Add("", 2, "", false, false); - miStompModeEnemySlider[iEnemy]->Add("", 3, "", false, false); - miStompModeEnemySlider[iEnemy]->Add("", 4, "", false, false); - miStompModeEnemySlider[iEnemy]->Add("", 5, "", false, false); - miStompModeEnemySlider[iEnemy]->Add("", 6, "", false, false); - miStompModeEnemySlider[iEnemy]->Add("", 7, "", false, false); - miStompModeEnemySlider[iEnemy]->Add("", 8, "", false, false); - miStompModeEnemySlider[iEnemy]->Add("", 9, "", false, false); - miStompModeEnemySlider[iEnemy]->Add("", 10, "", false, false); - miStompModeEnemySlider[iEnemy]->SetNoWrap(true); - miStompModeEnemySlider[iEnemy]->SetData(&game_values.gamemodemenusettings.stomp.enemyweight[iEnemy], NULL, NULL); - miStompModeEnemySlider[iEnemy]->SetKey(game_values.gamemodemenusettings.stomp.enemyweight[iEnemy]); + miStompModeEnemySlider[iEnemy]->add("", 0); + miStompModeEnemySlider[iEnemy]->add("", 1); + miStompModeEnemySlider[iEnemy]->add("", 2); + miStompModeEnemySlider[iEnemy]->add("", 3); + miStompModeEnemySlider[iEnemy]->add("", 4); + miStompModeEnemySlider[iEnemy]->add("", 5); + miStompModeEnemySlider[iEnemy]->add("", 6); + miStompModeEnemySlider[iEnemy]->add("", 7); + miStompModeEnemySlider[iEnemy]->add("", 8); + miStompModeEnemySlider[iEnemy]->add("", 9); + miStompModeEnemySlider[iEnemy]->add("", 10); + miStompModeEnemySlider[iEnemy]->allowWrap(false); + miStompModeEnemySlider[iEnemy]->setOutputPtr(&game_values.gamemodemenusettings.stomp.enemyweight[iEnemy]); + miStompModeEnemySlider[iEnemy]->setCurrentValue(game_values.gamemodemenusettings.stomp.enemyweight[iEnemy]); } miStompModeBackButton = new MI_Button(&rm->spr_selectfield, 544, 432, "Back", 80, TextAlign::CENTER); @@ -371,26 +371,26 @@ UI_ModeOptionsMenu::UI_ModeOptionsMenu() for (short iEggField = 0; iEggField < 4; iEggField++) { miEggModeEggQuantityField[iEggField] = new MI_PowerupSlider(&rm->spr_selectfield, &rm->menu_slider_bar, &rm->menu_egg, 170, 60 + 40 * iEggField, 300, iEggField); - miEggModeEggQuantityField[iEggField]->Add("0", 0, false, iEggField == 0 ? false : true); - miEggModeEggQuantityField[iEggField]->Add("1", 1, false, iEggField >= 2 ? false : true); - miEggModeEggQuantityField[iEggField]->Add("2", 2, false, iEggField >= 2 ? false : true); - miEggModeEggQuantityField[iEggField]->Add("3", 3, false, iEggField >= 1 ? false : true); - miEggModeEggQuantityField[iEggField]->Add("4", 4, false, false); - miEggModeEggQuantityField[iEggField]->SetData(&game_values.gamemodemenusettings.egg.eggs[iEggField], NULL, NULL); - miEggModeEggQuantityField[iEggField]->SetKey(game_values.gamemodemenusettings.egg.eggs[iEggField]); - miEggModeEggQuantityField[iEggField]->SetNoWrap(true); + miEggModeEggQuantityField[iEggField]->add("0", 0, false, iEggField == 0 ? false : true); + miEggModeEggQuantityField[iEggField]->add("1", 1, false, iEggField >= 2 ? false : true); + miEggModeEggQuantityField[iEggField]->add("2", 2, false, iEggField >= 2 ? false : true); + miEggModeEggQuantityField[iEggField]->add("3", 3, false, iEggField >= 1 ? false : true); + miEggModeEggQuantityField[iEggField]->add("4", 4, false, false); + miEggModeEggQuantityField[iEggField]->setOutputPtr(&game_values.gamemodemenusettings.egg.eggs[iEggField]); + miEggModeEggQuantityField[iEggField]->setCurrentValue(game_values.gamemodemenusettings.egg.eggs[iEggField]); + miEggModeEggQuantityField[iEggField]->allowWrap(false); } for (short iYoshiField = 0; iYoshiField < 4; iYoshiField++) { miEggModeYoshiQuantityField[iYoshiField] = new MI_PowerupSlider(&rm->spr_selectfield, &rm->menu_slider_bar, &rm->menu_egg, 170, 220 + 40 * iYoshiField, 300, iYoshiField + 4); - miEggModeYoshiQuantityField[iYoshiField]->Add("0", 0, false, iYoshiField == 0 ? false : true); - miEggModeYoshiQuantityField[iYoshiField]->Add("1", 1, false, iYoshiField >= 2 ? false : true); - miEggModeYoshiQuantityField[iYoshiField]->Add("2", 2, false, iYoshiField >= 1 ? false : true); - miEggModeYoshiQuantityField[iYoshiField]->Add("3", 3, false, false); - miEggModeYoshiQuantityField[iYoshiField]->Add("4", 4, false, false); - miEggModeYoshiQuantityField[iYoshiField]->SetData(&game_values.gamemodemenusettings.egg.yoshis[iYoshiField], NULL, NULL); - miEggModeYoshiQuantityField[iYoshiField]->SetKey(game_values.gamemodemenusettings.egg.yoshis[iYoshiField]); - miEggModeYoshiQuantityField[iYoshiField]->SetNoWrap(true); + miEggModeYoshiQuantityField[iYoshiField]->add("0", 0, false, iYoshiField == 0 ? false : true); + miEggModeYoshiQuantityField[iYoshiField]->add("1", 1, false, iYoshiField >= 2 ? false : true); + miEggModeYoshiQuantityField[iYoshiField]->add("2", 2, false, iYoshiField >= 1 ? false : true); + miEggModeYoshiQuantityField[iYoshiField]->add("3", 3, false, false); + miEggModeYoshiQuantityField[iYoshiField]->add("4", 4, false, false); + miEggModeYoshiQuantityField[iYoshiField]->setOutputPtr(&game_values.gamemodemenusettings.egg.yoshis[iYoshiField]); + miEggModeYoshiQuantityField[iYoshiField]->setCurrentValue(game_values.gamemodemenusettings.egg.yoshis[iYoshiField]); + miEggModeYoshiQuantityField[iYoshiField]->allowWrap(false); } miEggModeExplosionTimeField = new MI_SelectField(&rm->spr_selectfield, 120, 380, "Explosion Timer", 400, 180); @@ -437,19 +437,19 @@ UI_ModeOptionsMenu::UI_ModeOptionsMenu() //*********************** miFlagModeSpeedField = new MI_SliderField(&rm->spr_selectfield, &rm->menu_slider_bar, 120, 120, "Speed", 400, 180, 380); - miFlagModeSpeedField->Add("-", -1); - miFlagModeSpeedField->Add("0", 0); - miFlagModeSpeedField->Add("1", 1); - miFlagModeSpeedField->Add("2", 2); - miFlagModeSpeedField->Add("3", 3); - miFlagModeSpeedField->Add("4", 4); - miFlagModeSpeedField->Add("5", 5); - miFlagModeSpeedField->Add("6", 6, false, false); - miFlagModeSpeedField->Add("7", 7, false, false); - miFlagModeSpeedField->Add("8", 8, false, false); - miFlagModeSpeedField->SetData(&game_values.gamemodemenusettings.flag.speed, NULL, NULL); - miFlagModeSpeedField->SetKey(game_values.gamemodemenusettings.flag.speed); - miFlagModeSpeedField->SetNoWrap(true); + miFlagModeSpeedField->add("-", -1); + miFlagModeSpeedField->add("0", 0); + miFlagModeSpeedField->add("1", 1); + miFlagModeSpeedField->add("2", 2); + miFlagModeSpeedField->add("3", 3); + miFlagModeSpeedField->add("4", 4); + miFlagModeSpeedField->add("5", 5); + miFlagModeSpeedField->add("6", 6, false, false); + miFlagModeSpeedField->add("7", 7, false, false); + miFlagModeSpeedField->add("8", 8, false, false); + miFlagModeSpeedField->setOutputPtr(&game_values.gamemodemenusettings.flag.speed); + miFlagModeSpeedField->setCurrentValue(game_values.gamemodemenusettings.flag.speed); + miFlagModeSpeedField->allowWrap(false); miFlagModeTouchReturnField = new MI_SelectFieldDyn(&rm->spr_selectfield, 120, 160, "Touch Return", 400, 180); miFlagModeTouchReturnField->add("Off", false); @@ -617,30 +617,30 @@ UI_ModeOptionsMenu::UI_ModeOptionsMenu() miStarModeShineField->SetKey(game_values.gamemodemenusettings.star.shine); miStarModePercentExtraTime = new MI_SliderField(&rm->spr_selectfield, &rm->menu_slider_bar, 120, 260, "Extra Time", 400, 150, 384); - miStarModePercentExtraTime->Add("0", 0, false, false); - miStarModePercentExtraTime->Add("5", 5, false, false); - miStarModePercentExtraTime->Add("10", 10); - miStarModePercentExtraTime->Add("15", 15); - miStarModePercentExtraTime->Add("20", 20); - miStarModePercentExtraTime->Add("25", 25); - miStarModePercentExtraTime->Add("30", 30); - miStarModePercentExtraTime->Add("35", 35); - miStarModePercentExtraTime->Add("40", 40); - miStarModePercentExtraTime->Add("45", 45); - miStarModePercentExtraTime->Add("50", 50); - miStarModePercentExtraTime->Add("55", 55, false, false); - miStarModePercentExtraTime->Add("60", 60, false, false); - miStarModePercentExtraTime->Add("65", 65, false, false); - miStarModePercentExtraTime->Add("70", 70, false, false); - miStarModePercentExtraTime->Add("75", 75, false, false); - miStarModePercentExtraTime->Add("80", 80, false, false); - miStarModePercentExtraTime->Add("85", 85, false, false); - miStarModePercentExtraTime->Add("90", 90, false, false); - miStarModePercentExtraTime->Add("95", 95, false, false); - miStarModePercentExtraTime->Add("100", 100, false, false); - miStarModePercentExtraTime->SetData(&game_values.gamemodemenusettings.star.percentextratime, NULL, NULL); - miStarModePercentExtraTime->SetKey(game_values.gamemodemenusettings.star.percentextratime); - miStarModePercentExtraTime->SetNoWrap(true); + miStarModePercentExtraTime->add("0", 0, false, false); + miStarModePercentExtraTime->add("5", 5, false, false); + miStarModePercentExtraTime->add("10", 10); + miStarModePercentExtraTime->add("15", 15); + miStarModePercentExtraTime->add("20", 20); + miStarModePercentExtraTime->add("25", 25); + miStarModePercentExtraTime->add("30", 30); + miStarModePercentExtraTime->add("35", 35); + miStarModePercentExtraTime->add("40", 40); + miStarModePercentExtraTime->add("45", 45); + miStarModePercentExtraTime->add("50", 50); + miStarModePercentExtraTime->add("55", 55, false, false); + miStarModePercentExtraTime->add("60", 60, false, false); + miStarModePercentExtraTime->add("65", 65, false, false); + miStarModePercentExtraTime->add("70", 70, false, false); + miStarModePercentExtraTime->add("75", 75, false, false); + miStarModePercentExtraTime->add("80", 80, false, false); + miStarModePercentExtraTime->add("85", 85, false, false); + miStarModePercentExtraTime->add("90", 90, false, false); + miStarModePercentExtraTime->add("95", 95, false, false); + miStarModePercentExtraTime->add("100", 100, false, false); + miStarModePercentExtraTime->setOutputPtr(&game_values.gamemodemenusettings.star.percentextratime); + miStarModePercentExtraTime->setCurrentValue(game_values.gamemodemenusettings.star.percentextratime); + miStarModePercentExtraTime->allowWrap(false); miStarModeBackButton = new MI_Button(&rm->spr_selectfield, 544, 432, "Back", 80, TextAlign::CENTER); miStarModeBackButton->SetCode(MENU_CODE_BACK_TO_GAME_SETUP_MENU_FROM_MODE_SETTINGS); @@ -900,20 +900,20 @@ UI_ModeOptionsMenu::UI_ModeOptionsMenu() for (short iEnemy = 0; iEnemy < NUMSURVIVALENEMIES; iEnemy++) { miSurvivalModeEnemySlider[iEnemy] = new MI_PowerupSlider(&rm->spr_selectfield, &rm->menu_slider_bar, &rm->menu_survival, 120, 120 + 40 * iEnemy, 400, iEnemy); - miSurvivalModeEnemySlider[iEnemy]->Add("", 0, "", false, false); - miSurvivalModeEnemySlider[iEnemy]->Add("", 1, "", false, false); - miSurvivalModeEnemySlider[iEnemy]->Add("", 2, "", false, false); - miSurvivalModeEnemySlider[iEnemy]->Add("", 3, "", false, false); - miSurvivalModeEnemySlider[iEnemy]->Add("", 4, "", false, false); - miSurvivalModeEnemySlider[iEnemy]->Add("", 5, "", false, false); - miSurvivalModeEnemySlider[iEnemy]->Add("", 6, "", false, false); - miSurvivalModeEnemySlider[iEnemy]->Add("", 7, "", false, false); - miSurvivalModeEnemySlider[iEnemy]->Add("", 8, "", false, false); - miSurvivalModeEnemySlider[iEnemy]->Add("", 9, "", false, false); - miSurvivalModeEnemySlider[iEnemy]->Add("", 10, "", false, false); - miSurvivalModeEnemySlider[iEnemy]->SetNoWrap(true); - miSurvivalModeEnemySlider[iEnemy]->SetData(&game_values.gamemodemenusettings.survival.enemyweight[iEnemy], NULL, NULL); - miSurvivalModeEnemySlider[iEnemy]->SetKey(game_values.gamemodemenusettings.survival.enemyweight[iEnemy]); + miSurvivalModeEnemySlider[iEnemy]->add("", 0); + miSurvivalModeEnemySlider[iEnemy]->add("", 1); + miSurvivalModeEnemySlider[iEnemy]->add("", 2); + miSurvivalModeEnemySlider[iEnemy]->add("", 3); + miSurvivalModeEnemySlider[iEnemy]->add("", 4); + miSurvivalModeEnemySlider[iEnemy]->add("", 5); + miSurvivalModeEnemySlider[iEnemy]->add("", 6); + miSurvivalModeEnemySlider[iEnemy]->add("", 7); + miSurvivalModeEnemySlider[iEnemy]->add("", 8); + miSurvivalModeEnemySlider[iEnemy]->add("", 9); + miSurvivalModeEnemySlider[iEnemy]->add("", 10); + miSurvivalModeEnemySlider[iEnemy]->allowWrap(false); + miSurvivalModeEnemySlider[iEnemy]->setOutputPtr(&game_values.gamemodemenusettings.survival.enemyweight[iEnemy]); + miSurvivalModeEnemySlider[iEnemy]->setCurrentValue(game_values.gamemodemenusettings.survival.enemyweight[iEnemy]); } miSurvivalModeDensityField = new MI_SelectField(&rm->spr_selectfield, 120, 240, "Density", 400, 180); @@ -1009,30 +1009,30 @@ UI_ModeOptionsMenu::UI_ModeOptionsMenu() miGreedModeMultiplier->SetKey(game_values.gamemodemenusettings.greed.multiplier); miGreedModePercentExtraCoin = new MI_SliderField(&rm->spr_selectfield, &rm->menu_slider_bar, 120, 280, "Extra Coins", 400, 150, 384); - miGreedModePercentExtraCoin->Add("0", 0, false, false); - miGreedModePercentExtraCoin->Add("5", 5, false, false); - miGreedModePercentExtraCoin->Add("10", 10); - miGreedModePercentExtraCoin->Add("15", 15); - miGreedModePercentExtraCoin->Add("20", 20); - miGreedModePercentExtraCoin->Add("25", 25); - miGreedModePercentExtraCoin->Add("30", 30); - miGreedModePercentExtraCoin->Add("35", 35); - miGreedModePercentExtraCoin->Add("40", 40); - miGreedModePercentExtraCoin->Add("45", 45); - miGreedModePercentExtraCoin->Add("50", 50); - miGreedModePercentExtraCoin->Add("55", 55, false, false); - miGreedModePercentExtraCoin->Add("60", 60, false, false); - miGreedModePercentExtraCoin->Add("65", 65, false, false); - miGreedModePercentExtraCoin->Add("70", 70, false, false); - miGreedModePercentExtraCoin->Add("75", 75, false, false); - miGreedModePercentExtraCoin->Add("80", 80, false, false); - miGreedModePercentExtraCoin->Add("85", 85, false, false); - miGreedModePercentExtraCoin->Add("90", 90, false, false); - miGreedModePercentExtraCoin->Add("95", 95, false, false); - miGreedModePercentExtraCoin->Add("100", 100, false, false); - miGreedModePercentExtraCoin->SetData(&game_values.gamemodemenusettings.greed.percentextracoin, NULL, NULL); - miGreedModePercentExtraCoin->SetKey(game_values.gamemodemenusettings.greed.percentextracoin); - miGreedModePercentExtraCoin->SetNoWrap(true); + miGreedModePercentExtraCoin->add("0", 0, false, false); + miGreedModePercentExtraCoin->add("5", 5, false, false); + miGreedModePercentExtraCoin->add("10", 10); + miGreedModePercentExtraCoin->add("15", 15); + miGreedModePercentExtraCoin->add("20", 20); + miGreedModePercentExtraCoin->add("25", 25); + miGreedModePercentExtraCoin->add("30", 30); + miGreedModePercentExtraCoin->add("35", 35); + miGreedModePercentExtraCoin->add("40", 40); + miGreedModePercentExtraCoin->add("45", 45); + miGreedModePercentExtraCoin->add("50", 50); + miGreedModePercentExtraCoin->add("55", 55, false, false); + miGreedModePercentExtraCoin->add("60", 60, false, false); + miGreedModePercentExtraCoin->add("65", 65, false, false); + miGreedModePercentExtraCoin->add("70", 70, false, false); + miGreedModePercentExtraCoin->add("75", 75, false, false); + miGreedModePercentExtraCoin->add("80", 80, false, false); + miGreedModePercentExtraCoin->add("85", 85, false, false); + miGreedModePercentExtraCoin->add("90", 90, false, false); + miGreedModePercentExtraCoin->add("95", 95, false, false); + miGreedModePercentExtraCoin->add("100", 100, false, false); + miGreedModePercentExtraCoin->setOutputPtr(&game_values.gamemodemenusettings.greed.percentextracoin); + miGreedModePercentExtraCoin->setCurrentValue(game_values.gamemodemenusettings.greed.percentextracoin); + miGreedModePercentExtraCoin->allowWrap(false); miGreedModeBackButton = new MI_Button(&rm->spr_selectfield, 544, 432, "Back", 80, TextAlign::CENTER); miGreedModeBackButton->SetCode(MENU_CODE_BACK_TO_GAME_SETUP_MENU_FROM_MODE_SETTINGS); @@ -1090,30 +1090,30 @@ UI_ModeOptionsMenu::UI_ModeOptionsMenu() miHealthModeMaxLife->SetItemChangedCode(MENU_CODE_HEALTH_MODE_MAX_LIFE_CHANGED); miHealthModePercentExtraLife = new MI_SliderField(&rm->spr_selectfield, &rm->menu_slider_bar, 120, 260, "Extra Life", 400, 150, 384); - miHealthModePercentExtraLife->Add("0", 0, false, false); - miHealthModePercentExtraLife->Add("5", 5, false, false); - miHealthModePercentExtraLife->Add("10", 10); - miHealthModePercentExtraLife->Add("15", 15); - miHealthModePercentExtraLife->Add("20", 20); - miHealthModePercentExtraLife->Add("25", 25); - miHealthModePercentExtraLife->Add("30", 30); - miHealthModePercentExtraLife->Add("35", 35); - miHealthModePercentExtraLife->Add("40", 40); - miHealthModePercentExtraLife->Add("45", 45); - miHealthModePercentExtraLife->Add("50", 50); - miHealthModePercentExtraLife->Add("55", 55, false, false); - miHealthModePercentExtraLife->Add("60", 60, false, false); - miHealthModePercentExtraLife->Add("65", 65, false, false); - miHealthModePercentExtraLife->Add("70", 70, false, false); - miHealthModePercentExtraLife->Add("75", 75, false, false); - miHealthModePercentExtraLife->Add("80", 80, false, false); - miHealthModePercentExtraLife->Add("85", 85, false, false); - miHealthModePercentExtraLife->Add("90", 90, false, false); - miHealthModePercentExtraLife->Add("95", 95, false, false); - miHealthModePercentExtraLife->Add("100", 100, false, false); - miHealthModePercentExtraLife->SetData(&game_values.gamemodemenusettings.health.percentextralife, NULL, NULL); - miHealthModePercentExtraLife->SetKey(game_values.gamemodemenusettings.health.percentextralife); - miHealthModePercentExtraLife->SetNoWrap(true); + miHealthModePercentExtraLife->add("0", 0, false, false); + miHealthModePercentExtraLife->add("5", 5, false, false); + miHealthModePercentExtraLife->add("10", 10); + miHealthModePercentExtraLife->add("15", 15); + miHealthModePercentExtraLife->add("20", 20); + miHealthModePercentExtraLife->add("25", 25); + miHealthModePercentExtraLife->add("30", 30); + miHealthModePercentExtraLife->add("35", 35); + miHealthModePercentExtraLife->add("40", 40); + miHealthModePercentExtraLife->add("45", 45); + miHealthModePercentExtraLife->add("50", 50); + miHealthModePercentExtraLife->add("55", 55, false, false); + miHealthModePercentExtraLife->add("60", 60, false, false); + miHealthModePercentExtraLife->add("65", 65, false, false); + miHealthModePercentExtraLife->add("70", 70, false, false); + miHealthModePercentExtraLife->add("75", 75, false, false); + miHealthModePercentExtraLife->add("80", 80, false, false); + miHealthModePercentExtraLife->add("85", 85, false, false); + miHealthModePercentExtraLife->add("90", 90, false, false); + miHealthModePercentExtraLife->add("95", 95, false, false); + miHealthModePercentExtraLife->add("100", 100, false, false); + miHealthModePercentExtraLife->setOutputPtr(&game_values.gamemodemenusettings.health.percentextralife); + miHealthModePercentExtraLife->setCurrentValue(game_values.gamemodemenusettings.health.percentextralife); + miHealthModePercentExtraLife->allowWrap(false); miHealthModeBackButton = new MI_Button(&rm->spr_selectfield, 544, 432, "Back", 80, TextAlign::CENTER); miHealthModeBackButton->SetCode(MENU_CODE_BACK_TO_GAME_SETUP_MENU_FROM_MODE_SETTINGS); @@ -1239,15 +1239,15 @@ UI_ModeOptionsMenu::UI_ModeOptionsMenu() for (short iPhanto = 0; iPhanto < 3; iPhanto++) { miChaseModeQuantitySlider[iPhanto] = new MI_PowerupSlider(&rm->spr_selectfield, &rm->menu_slider_bar, &rm->spr_phanto, 120, 200 + 40 * iPhanto, 400, iPhanto); - miChaseModeQuantitySlider[iPhanto]->Add("", 0, false, iPhanto == 0 ? false : true); - miChaseModeQuantitySlider[iPhanto]->Add("", 1); - miChaseModeQuantitySlider[iPhanto]->Add("", 2); - miChaseModeQuantitySlider[iPhanto]->Add("", 3, false, false); - miChaseModeQuantitySlider[iPhanto]->Add("", 4, false, false); - miChaseModeQuantitySlider[iPhanto]->Add("", 5, false, false); - miChaseModeQuantitySlider[iPhanto]->SetNoWrap(true); - miChaseModeQuantitySlider[iPhanto]->SetData(&game_values.gamemodemenusettings.chase.phantoquantity[iPhanto], NULL, NULL); - miChaseModeQuantitySlider[iPhanto]->SetKey(game_values.gamemodemenusettings.chase.phantoquantity[iPhanto]); + miChaseModeQuantitySlider[iPhanto]->add("", 0, false, iPhanto == 0 ? false : true); + miChaseModeQuantitySlider[iPhanto]->add("", 1); + miChaseModeQuantitySlider[iPhanto]->add("", 2); + miChaseModeQuantitySlider[iPhanto]->add("", 3, false, false); + miChaseModeQuantitySlider[iPhanto]->add("", 4, false, false); + miChaseModeQuantitySlider[iPhanto]->add("", 5, false, false); + miChaseModeQuantitySlider[iPhanto]->allowWrap(false); + miChaseModeQuantitySlider[iPhanto]->setOutputPtr(&game_values.gamemodemenusettings.chase.phantoquantity[iPhanto]); + miChaseModeQuantitySlider[iPhanto]->setCurrentValue(game_values.gamemodemenusettings.chase.phantoquantity[iPhanto]); } miChaseModeBackButton = new MI_Button(&rm->spr_selectfield, 544, 432, "Back", 80, TextAlign::CENTER); @@ -1407,31 +1407,31 @@ void UI_ModeOptionsMenu::SetRandomGameModeSettings(short iMode) } else if (iMode == game_mode_timelimit) { // time game_values.gamemodesettings.time.style = miTimeLimitModeStyleField->GetRandomShortValue(); game_values.gamemodesettings.time.scoring = miTimeLimitModeScoringField->GetRandomShortValue(); - game_values.gamemodesettings.time.percentextratime = miTimeLimitModePercentExtraTime->GetRandomShortValue(); + game_values.gamemodesettings.time.percentextratime = miTimeLimitModePercentExtraTime->currentValue(); } else if (iMode == game_mode_jail) { // jail game_values.gamemodesettings.jail.style = miJailModeStyleField->GetRandomShortValue(); game_values.gamemodesettings.jail.timetofree = miJailModeTimeFreeField->GetRandomShortValue(); game_values.gamemodesettings.jail.tagfree = miJailModeTagFreeField->randomValue(); - game_values.gamemodesettings.jail.percentkey = miJailModeJailKeyField->GetRandomShortValue(); + game_values.gamemodesettings.jail.percentkey = miJailModeJailKeyField->currentValue(); } else if (iMode == game_mode_coins) { // coins game_values.gamemodesettings.coins.penalty = miCoinModePenaltyField->randomValue(); game_values.gamemodesettings.coins.quantity = miCoinModeQuantityField->GetRandomShortValue(); - game_values.gamemodesettings.coins.percentextracoin = miCoinModePercentExtraCoin->GetRandomShortValue(); + game_values.gamemodesettings.coins.percentextracoin = miCoinModePercentExtraCoin->currentValue(); } else if (iMode == game_mode_stomp) { // stomp game_values.gamemodesettings.stomp.rate = miStompModeRateField->GetRandomShortValue(); for (short iEnemy = 0; iEnemy < NUMSTOMPENEMIES; iEnemy++) - game_values.gamemodesettings.stomp.enemyweight[iEnemy] = miStompModeEnemySlider[iEnemy]->GetRandomShortValue(); + game_values.gamemodesettings.stomp.enemyweight[iEnemy] = miStompModeEnemySlider[iEnemy]->currentValue(); } else if (iMode == game_mode_eggs) { // egg for (int iEgg = 0; iEgg < 4; iEgg++) - game_values.gamemodesettings.egg.eggs[iEgg] = miEggModeEggQuantityField[iEgg]->GetRandomShortValue(); + game_values.gamemodesettings.egg.eggs[iEgg] = miEggModeEggQuantityField[iEgg]->currentValue(); for (int iYoshi = 0; iYoshi < 4; iYoshi++) - game_values.gamemodesettings.egg.yoshis[iYoshi] = miEggModeYoshiQuantityField[iYoshi]->GetRandomShortValue(); + game_values.gamemodesettings.egg.yoshis[iYoshi] = miEggModeYoshiQuantityField[iYoshi]->currentValue(); game_values.gamemodesettings.egg.explode = miEggModeExplosionTimeField->GetRandomShortValue(); } else if (iMode == game_mode_ctf) { // capture the flag - game_values.gamemodesettings.flag.speed = miFlagModeSpeedField->GetRandomShortValue(); + game_values.gamemodesettings.flag.speed = miFlagModeSpeedField->currentValue(); game_values.gamemodesettings.flag.touchreturn = miFlagModeTouchReturnField->randomValue(); game_values.gamemodesettings.flag.pointmove = miFlagModePointMoveField->randomValue(); game_values.gamemodesettings.flag.autoreturn = miFlagModeAutoReturnField->GetRandomShortValue(); @@ -1445,7 +1445,7 @@ void UI_ModeOptionsMenu::SetRandomGameModeSettings(short iMode) } else if (iMode == game_mode_star) { // star game_values.gamemodesettings.star.time = miStarModeTimeField->GetRandomShortValue(); game_values.gamemodesettings.star.shine = miStarModeShineField->GetRandomShortValue(); - game_values.gamemodesettings.star.percentextratime = miStarModePercentExtraTime->GetRandomShortValue(); + game_values.gamemodesettings.star.percentextratime = miStarModePercentExtraTime->currentValue(); } else if (iMode == game_mode_domination) { // domination game_values.gamemodesettings.domination.quantity = miDominationModeQuantityField->GetRandomShortValue(); game_values.gamemodesettings.domination.loseondeath = miDominationModeLoseOnDeathField->randomValue(); @@ -1468,16 +1468,16 @@ void UI_ModeOptionsMenu::SetRandomGameModeSettings(short iMode) game_values.gamemodesettings.survival.shield = miSurvivalModeShieldField->randomValue(); for (short iEnemy = 0; iEnemy < NUMSURVIVALENEMIES; iEnemy++) - game_values.gamemodesettings.survival.enemyweight[iEnemy] = miSurvivalModeEnemySlider[iEnemy]->GetRandomShortValue(); + game_values.gamemodesettings.survival.enemyweight[iEnemy] = miSurvivalModeEnemySlider[iEnemy]->currentValue(); } else if (iMode == game_mode_greed) { // greed game_values.gamemodesettings.greed.coinlife = miGreedModeCoinLife->GetRandomShortValue(); game_values.gamemodesettings.greed.owncoins = miGreedModeOwnCoins->randomValue(); game_values.gamemodesettings.greed.multiplier = miGreedModeMultiplier->GetRandomShortValue(); - game_values.gamemodesettings.greed.percentextracoin = miGreedModePercentExtraCoin->GetRandomShortValue(); + game_values.gamemodesettings.greed.percentextracoin = miGreedModePercentExtraCoin->currentValue(); } else if (iMode == game_mode_health) { // health game_values.gamemodesettings.health.startlife = miHealthModeStartLife->GetRandomShortValue(); game_values.gamemodesettings.health.maxlife = miHealthModeMaxLife->GetRandomShortValue(); - game_values.gamemodesettings.health.percentextralife = miHealthModePercentExtraLife->GetRandomShortValue(); + game_values.gamemodesettings.health.percentextralife = miHealthModePercentExtraLife->currentValue(); } else if (iMode == game_mode_collection) { // card collection game_values.gamemodesettings.collection.quantity = miCollectionModeQuantityField->GetRandomShortValue(); game_values.gamemodesettings.collection.rate = miCollectionModeRateField->GetRandomShortValue(); @@ -1487,7 +1487,7 @@ void UI_ModeOptionsMenu::SetRandomGameModeSettings(short iMode) game_values.gamemodesettings.chase.phantospeed = miChaseModeSpeedField->GetRandomShortValue(); for (short iPhanto = 0; iPhanto < 3; iPhanto++) - game_values.gamemodesettings.chase.phantoquantity[iPhanto] = miChaseModeQuantitySlider[iPhanto]->GetRandomShortValue(); + game_values.gamemodesettings.chase.phantoquantity[iPhanto] = miChaseModeQuantitySlider[iPhanto]->currentValue(); } else if (iMode == game_mode_shyguytag) { // shyguy tag game_values.gamemodesettings.shyguytag.tagonsuicide = miShyGuyTagModeTagOnSuicideField->randomValue(); game_values.gamemodesettings.shyguytag.tagtransfer = miShyGuyTagModeTagOnStompField->GetRandomShortValue(); diff --git a/src/smw/menu/ModeOptionsMenu.h b/src/smw/menu/ModeOptionsMenu.h index 82583306..13b2c7cd 100644 --- a/src/smw/menu/ModeOptionsMenu.h +++ b/src/smw/menu/ModeOptionsMenu.h @@ -79,7 +79,7 @@ class UI_ModeOptionsMenu : public UI_Menu { // Coins MI_SelectFieldDyn* miCoinModePenaltyField; MI_SelectField* miCoinModeQuantityField; - MI_SelectField* miCoinModePercentExtraCoin; + MI_SliderField* miCoinModePercentExtraCoin; MI_Button* miCoinModeBackButton; MI_Image* miCoinModeLeftHeaderBar; @@ -203,7 +203,7 @@ class UI_ModeOptionsMenu : public UI_Menu { MI_SelectField* miGreedModeCoinLife; MI_SelectFieldDyn* miGreedModeOwnCoins; MI_SelectField* miGreedModeMultiplier; - MI_SelectField* miGreedModePercentExtraCoin; + MI_SliderField* miGreedModePercentExtraCoin; MI_Button* miGreedModeBackButton; MI_Image* miGreedModeLeftHeaderBar; diff --git a/src/smw/menu/options/SoundOptionsMenu.cpp b/src/smw/menu/options/SoundOptionsMenu.cpp index 23b03125..cc198108 100644 --- a/src/smw/menu/options/SoundOptionsMenu.cpp +++ b/src/smw/menu/options/SoundOptionsMenu.cpp @@ -24,34 +24,34 @@ UI_SoundOptionsMenu::UI_SoundOptionsMenu() : UI_Menu() { miSoundVolumeField = new MI_SliderField(&rm->spr_selectfield, &rm->menu_slider_bar, 70, 100, "Sound Volume", 500, 220, 484); - miSoundVolumeField->Add("Off", 0); - miSoundVolumeField->Add("1", 16); - miSoundVolumeField->Add("2", 32); - miSoundVolumeField->Add("3", 48); - miSoundVolumeField->Add("4", 64); - miSoundVolumeField->Add("5", 80); - miSoundVolumeField->Add("6", 96); - miSoundVolumeField->Add("7", 112); - miSoundVolumeField->Add("Max", 128); - miSoundVolumeField->SetData(&game_values.soundvolume, NULL, NULL); - miSoundVolumeField->SetKey(game_values.soundvolume); - miSoundVolumeField->SetNoWrap(true); - miSoundVolumeField->SetItemChangedCode(MENU_CODE_SOUND_VOLUME_CHANGED); + miSoundVolumeField->add("Off", 0); + miSoundVolumeField->add("1", 16); + miSoundVolumeField->add("2", 32); + miSoundVolumeField->add("3", 48); + miSoundVolumeField->add("4", 64); + miSoundVolumeField->add("5", 80); + miSoundVolumeField->add("6", 96); + miSoundVolumeField->add("7", 112); + miSoundVolumeField->add("Max", 128); + miSoundVolumeField->setOutputPtr(&game_values.soundvolume); + miSoundVolumeField->setCurrentValue(game_values.soundvolume); + miSoundVolumeField->allowWrap(false); + miSoundVolumeField->setItemChangedCode(MENU_CODE_SOUND_VOLUME_CHANGED); miMusicVolumeField = new MI_SliderField(&rm->spr_selectfield, &rm->menu_slider_bar, 70, 140, "Music Volume", 500, 220, 484); - miMusicVolumeField->Add("Off", 0); - miMusicVolumeField->Add("1", 16); - miMusicVolumeField->Add("2", 32); - miMusicVolumeField->Add("3", 48); - miMusicVolumeField->Add("4", 64); - miMusicVolumeField->Add("5", 80); - miMusicVolumeField->Add("6", 96); - miMusicVolumeField->Add("7", 112); - miMusicVolumeField->Add("Max", 128); - miMusicVolumeField->SetData(&game_values.musicvolume, NULL, NULL); - miMusicVolumeField->SetKey(game_values.musicvolume); - miMusicVolumeField->SetNoWrap(true); - miMusicVolumeField->SetItemChangedCode(MENU_CODE_MUSIC_VOLUME_CHANGED); + miMusicVolumeField->add("Off", 0); + miMusicVolumeField->add("1", 16); + miMusicVolumeField->add("2", 32); + miMusicVolumeField->add("3", 48); + miMusicVolumeField->add("4", 64); + miMusicVolumeField->add("5", 80); + miMusicVolumeField->add("6", 96); + miMusicVolumeField->add("7", 112); + miMusicVolumeField->add("Max", 128); + miMusicVolumeField->setOutputPtr(&game_values.musicvolume); + miMusicVolumeField->setCurrentValue(game_values.musicvolume); + miMusicVolumeField->allowWrap(false); + miMusicVolumeField->setItemChangedCode(MENU_CODE_MUSIC_VOLUME_CHANGED); miPlayNextMusicField = new MI_SelectField(&rm->spr_selectfield, 70, 180, "Next Music", 500, 220); miPlayNextMusicField->Add("Off", 0); diff --git a/src/smw/ui/MI_FrenzyModeOptions.cpp b/src/smw/ui/MI_FrenzyModeOptions.cpp index 20205eb5..bb3dc95f 100644 --- a/src/smw/ui/MI_FrenzyModeOptions.cpp +++ b/src/smw/ui/MI_FrenzyModeOptions.cpp @@ -68,20 +68,20 @@ MI_FrenzyModeOptions::MI_FrenzyModeOptions(short x, short y, short width, short short iPowerupMap[] = {8, 5, 11, 17, 19, 21, 23, 24, 25, 20, 9, 16, 10, 22, 12, 13, 14, 15, 27}; for (short iPowerup = 0; iPowerup < NUMFRENZYCARDS; iPowerup++) { miPowerupSlider[iPowerup] = new MI_PowerupSlider(&rm->spr_selectfield, &rm->menu_slider_bar, &rm->spr_storedpoweruplarge, iPowerup < 10 ? 65 : 330, 0, 245, iPowerupMap[iPowerup]); - miPowerupSlider[iPowerup]->Add("", 0, "", false, false); - miPowerupSlider[iPowerup]->Add("", 1, "", false, false); - miPowerupSlider[iPowerup]->Add("", 2, "", false, false); - miPowerupSlider[iPowerup]->Add("", 3, "", false, false); - miPowerupSlider[iPowerup]->Add("", 4, "", false, false); - miPowerupSlider[iPowerup]->Add("", 5, "", false, false); - miPowerupSlider[iPowerup]->Add("", 6, "", false, false); - miPowerupSlider[iPowerup]->Add("", 7, "", false, false); - miPowerupSlider[iPowerup]->Add("", 8, "", false, false); - miPowerupSlider[iPowerup]->Add("", 9, "", false, false); - miPowerupSlider[iPowerup]->Add("", 10, "", false, false); - miPowerupSlider[iPowerup]->SetNoWrap(true); - miPowerupSlider[iPowerup]->SetData(&game_values.gamemodemenusettings.frenzy.powerupweight[iPowerup], NULL, NULL); - miPowerupSlider[iPowerup]->SetKey(game_values.gamemodemenusettings.frenzy.powerupweight[iPowerup]); + miPowerupSlider[iPowerup]->add("", 0); + miPowerupSlider[iPowerup]->add("", 1); + miPowerupSlider[iPowerup]->add("", 2); + miPowerupSlider[iPowerup]->add("", 3); + miPowerupSlider[iPowerup]->add("", 4); + miPowerupSlider[iPowerup]->add("", 5); + miPowerupSlider[iPowerup]->add("", 6); + miPowerupSlider[iPowerup]->add("", 7); + miPowerupSlider[iPowerup]->add("", 8); + miPowerupSlider[iPowerup]->add("", 9); + miPowerupSlider[iPowerup]->add("", 10); + miPowerupSlider[iPowerup]->allowWrap(false); + miPowerupSlider[iPowerup]->setOutputPtr(&game_values.gamemodemenusettings.frenzy.powerupweight[iPowerup]); + miPowerupSlider[iPowerup]->setCurrentValue(game_values.gamemodemenusettings.frenzy.powerupweight[iPowerup]); } miBackButton = new MI_Button(&rm->spr_selectfield, 544, 432, "Back", 80, TextAlign::CENTER); @@ -243,7 +243,7 @@ void MI_FrenzyModeOptions::SetRandomGameModeSettings() game_values.gamemodesettings.frenzy.storedshells = miStoredShellsField->randomValue(); for (short iPowerup = 0; iPowerup < NUMFRENZYCARDS; iPowerup++) - game_values.gamemodesettings.frenzy.powerupweight[iPowerup] = miPowerupSlider[iPowerup]->GetRandomShortValue(); + game_values.gamemodesettings.frenzy.powerupweight[iPowerup] = miPowerupSlider[iPowerup]->randomValue(); } void MI_FrenzyModeOptions::AdjustDisplayArrows() diff --git a/src/smw/ui/MI_PowerupSelection.cpp b/src/smw/ui/MI_PowerupSelection.cpp index 6efa21b4..f8d6d51b 100644 --- a/src/smw/ui/MI_PowerupSelection.cpp +++ b/src/smw/ui/MI_PowerupSelection.cpp @@ -108,21 +108,21 @@ MI_PowerupSelection::MI_PowerupSelection(short x, short y, short width, short nu for (short iPowerup = 0; iPowerup < NUM_POWERUPS; iPowerup++) { miPowerupSlider[iPowerup] = new MI_PowerupSlider(&rm->spr_selectfield, &rm->menu_slider_bar, &rm->spr_storedpoweruplarge, 0, 0, 245, iPowerupPositionMap[iPowerup]); - miPowerupSlider[iPowerup]->Add("", 0, "", false, false); - miPowerupSlider[iPowerup]->Add("", 1, "", false, false); - miPowerupSlider[iPowerup]->Add("", 2, "", false, false); - miPowerupSlider[iPowerup]->Add("", 3, "", false, false); - miPowerupSlider[iPowerup]->Add("", 4, "", false, false); - miPowerupSlider[iPowerup]->Add("", 5, "", false, false); - miPowerupSlider[iPowerup]->Add("", 6, "", false, false); - miPowerupSlider[iPowerup]->Add("", 7, "", false, false); - miPowerupSlider[iPowerup]->Add("", 8, "", false, false); - miPowerupSlider[iPowerup]->Add("", 9, "", false, false); - miPowerupSlider[iPowerup]->Add("", 10, "", false, false); - miPowerupSlider[iPowerup]->SetNoWrap(true); - miPowerupSlider[iPowerup]->SetData(&game_values.powerupweights[iPowerupPositionMap[iPowerup]], NULL, NULL); - miPowerupSlider[iPowerup]->SetKey(game_values.powerupweights[iPowerupPositionMap[iPowerup]]); - miPowerupSlider[iPowerup]->SetItemChangedCode(MENU_CODE_POWERUP_SETTING_CHANGED); + miPowerupSlider[iPowerup]->add("", 0); + miPowerupSlider[iPowerup]->add("", 1); + miPowerupSlider[iPowerup]->add("", 2); + miPowerupSlider[iPowerup]->add("", 3); + miPowerupSlider[iPowerup]->add("", 4); + miPowerupSlider[iPowerup]->add("", 5); + miPowerupSlider[iPowerup]->add("", 6); + miPowerupSlider[iPowerup]->add("", 7); + miPowerupSlider[iPowerup]->add("", 8); + miPowerupSlider[iPowerup]->add("", 9); + miPowerupSlider[iPowerup]->add("", 10); + miPowerupSlider[iPowerup]->allowWrap(false); + miPowerupSlider[iPowerup]->setOutputPtr(&game_values.powerupweights[iPowerupPositionMap[iPowerup]]); + miPowerupSlider[iPowerup]->setCurrentValue(game_values.powerupweights[iPowerupPositionMap[iPowerup]]); + miPowerupSlider[iPowerup]->setItemChangedCode(MENU_CODE_POWERUP_SETTING_CHANGED); } miRestoreDefaultsButton = new MI_Button(&rm->spr_selectfield, 160, 432, "Defaults", 150, TextAlign::CENTER); @@ -256,7 +256,7 @@ MenuCodeEnum MI_PowerupSelection::SendInput(CPlayerInput* playerInput) } else if (MENU_CODE_POWERUP_PRESET_CHANGED == ret) { for (short iPowerup = 0; iPowerup < NUM_POWERUPS; iPowerup++) { short iCurrentValue = g_iCurrentPowerupPresets[game_values.poweruppreset][iPowerupPositionMap[iPowerup]]; - miPowerupSlider[iPowerup]->SetKey(iCurrentValue); + miPowerupSlider[iPowerup]->setCurrentValue(iCurrentValue); game_values.powerupweights[iPowerupPositionMap[iPowerup]] = iCurrentValue; } @@ -300,7 +300,7 @@ MenuCodeEnum MI_PowerupSelection::SendInput(CPlayerInput* playerInput) //restore default powerup weights for powerup selection menu for (short iPowerup = 0; iPowerup < NUM_POWERUPS; iPowerup++) { short iDefaultValue = g_iDefaultPowerupPresets[game_values.poweruppreset][iPowerupPositionMap[iPowerup]]; - miPowerupSlider[iPowerup]->SetKey(iDefaultValue); + miPowerupSlider[iPowerup]->setCurrentValue(iDefaultValue); game_values.powerupweights[iPowerupPositionMap[iPowerup]] = iDefaultValue; g_iCurrentPowerupPresets[game_values.poweruppreset][iPowerupPositionMap[iPowerup]] = iDefaultValue; @@ -308,7 +308,7 @@ MenuCodeEnum MI_PowerupSelection::SendInput(CPlayerInput* playerInput) } else if (MENU_CODE_POWERUP_CLEAR_YES == ret) { //restore default powerup weights for powerup selection menu for (short iPowerup = 0; iPowerup < NUM_POWERUPS; iPowerup++) { - miPowerupSlider[iPowerup]->SetKey(0); + miPowerupSlider[iPowerup]->setCurrentValue(0); game_values.powerupweights[iPowerup] = 0; g_iCurrentPowerupPresets[game_values.poweruppreset][iPowerup] = 0; diff --git a/src/smw/ui/MI_PowerupSlider.cpp b/src/smw/ui/MI_PowerupSlider.cpp index 86f014ea..89fd43a5 100644 --- a/src/smw/ui/MI_PowerupSlider.cpp +++ b/src/smw/ui/MI_PowerupSlider.cpp @@ -5,12 +5,12 @@ MI_PowerupSlider::MI_PowerupSlider(gfxSprite* nspr, gfxSprite* nsprSlider, gfxSprite* nsprPowerup, short x, short y, short width, short powerupIndex) : MI_SliderField(nspr, nsprSlider, x, y, "", width, 0, 0) - , sprPowerup(nsprPowerup) - , iPowerupIndex(powerupIndex) - , iHalfWidth((width - 38) / 2) + , m_sprPowerup(nsprPowerup) + , m_powerupIndex(powerupIndex) + , m_halfWidth((width - 38) / 2) { miModifyImageLeft->SetPosition(ix + 25, iy + 4); - miModifyImageRight->SetPosition(ix + iWidth - 12, iy + 4); + miModifyImageRight->SetPosition(ix + m_width - 12, iy + 4); } void MI_PowerupSlider::Draw() @@ -18,30 +18,30 @@ void MI_PowerupSlider::Draw() if (!fShow) return; - spr->draw(ix + 38, iy, 0, (fSelected ? 32 : 0) + iAdjustmentY, iHalfWidth, 32); - spr->draw(ix + 38 + iHalfWidth, iy, 550 - iWidth + iHalfWidth, (fSelected ? 32 : 0) + iAdjustmentY, iWidth - iHalfWidth - 38, 32); + m_spr->draw(ix + 38, iy, 0, (fSelected ? 32 : 0) + m_adjustmentY, m_halfWidth, 32); + m_spr->draw(ix + 38 + m_halfWidth, iy, 550 - m_width + m_halfWidth, (fSelected ? 32 : 0) + m_adjustmentY, m_width - m_halfWidth - 38, 32); - short iSpacing = (iWidth - 100) / ((short)items.size() - 1); + short iSpacing = (m_width - 100) / ((short)m_items.size() - 1); short iSpot = 0; - for (unsigned int index = 0; index < items.size(); index++) { - if (index < items.size() - 1) - sprSlider->draw(ix + iSpot + 56, iy + 10, 0, 0, iSpacing, 13); + for (unsigned int index = 0; index < m_items.size(); index++) { + if (index < m_items.size() - 1) + m_sprSlider->draw(ix + iSpot + 56, iy + 10, 0, 0, iSpacing, 13); else - sprSlider->draw(ix + iSpot + 56, iy + 10, 164, 0, 4, 13); + m_sprSlider->draw(ix + iSpot + 56, iy + 10, 164, 0, 4, 13); iSpot += iSpacing; } - sprSlider->draw(ix + (iIndex * iSpacing) + 54, iy + 8, 168, 0, 8, 16); + m_sprSlider->draw(ix + (m_index * iSpacing) + 54, iy + 8, 168, 0, 8, 16); + m_sprSlider->draw(ix + m_width - 34, iy + 8, m_index * 16, 16, 16, 16); + m_sprPowerup->draw(ix, iy, m_powerupIndex * 32, 0, 32, 32); - sprSlider->draw(ix + iWidth - 34, iy + 8, iIndex * 16, 16, 16, 16); - - sprPowerup->draw(ix, iy, iPowerupIndex * 32, 0, 32, 32); - - if (current != items.begin() || !fNoWrap) + const bool drawLeft = m_index > 0; + if (m_wraps || drawLeft) miModifyImageLeft->Draw(); - if (current != --items.end() || !fNoWrap) + const bool drawRight = (m_index + 1) < m_items.size(); + if (m_wraps || drawRight) miModifyImageRight->Draw(); } diff --git a/src/smw/ui/MI_PowerupSlider.h b/src/smw/ui/MI_PowerupSlider.h index 2a5115a7..018aaf1c 100644 --- a/src/smw/ui/MI_PowerupSlider.h +++ b/src/smw/ui/MI_PowerupSlider.h @@ -13,7 +13,7 @@ class MI_PowerupSlider : public MI_SliderField { void Draw() override; protected: - gfxSprite* sprPowerup = nullptr; - short iPowerupIndex = 0; - short iHalfWidth = 0; + gfxSprite* m_sprPowerup = nullptr; + short m_powerupIndex = 0; + short m_halfWidth = 0; };