some std::strings changed to const char*; fixed bug with current equips on tunic+boots

This commit is contained in:
stratomaster64 2022-05-08 21:37:16 -04:00
commit 9535b30c15

View file

@ -416,7 +416,7 @@ void DrawInfoTab() {
ImGui::InputScalar("Timer 2 Value", ImGuiDataType_S16, &gSaveContext.timer2Value, &one, NULL); ImGui::InputScalar("Timer 2 Value", ImGuiDataType_S16, &gSaveContext.timer2Value, &one, NULL);
InsertHelpHoverText("Time, in seconds"); InsertHelpHoverText("Time, in seconds");
std::string audioName; const char* audioName;
switch (gSaveContext.audioSetting) { switch (gSaveContext.audioSetting) {
case 0: case 0:
audioName = "Stereo"; audioName = "Stereo";
@ -433,7 +433,7 @@ void DrawInfoTab() {
default: default:
audioName = "?"; audioName = "?";
} }
if (ImGui::BeginCombo("Audio", audioName.c_str())) { if (ImGui::BeginCombo("Audio", audioName)) {
if (ImGui::Selectable("Stereo")) { if (ImGui::Selectable("Stereo")) {
gSaveContext.audioSetting = 0; gSaveContext.audioSetting = 0;
} }
@ -470,10 +470,13 @@ void DrawInfoTab() {
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 15); ImGui::SetNextItemWidth(ImGui::GetFontSize() * 15);
std::vector<std::string> minigameHS = { "Horseback Archery", "Big Poe Points", std::array<const char*, 7> minigameHS = { "Horseback Archery",
"Fishing", "Malon's Obstacle Course", "Big Poe Points",
"Running Man Race", "?", "Fishing",
"Dampe's Race" }; "Malon's Obstacle Course",
"Running Man Race",
"?",
"Dampe's Race" };
if (ImGui::TreeNode("Minigames")) { if (ImGui::TreeNode("Minigames")) {
for (int i = 0; i < 7; i++) { for (int i = 0; i < 7; i++) {
@ -1290,11 +1293,13 @@ void DrawQuestStatusTab() {
} }
void DrawPlayerTab() { void DrawPlayerTab() {
if (gGlobalCtx) { if (gGlobalCtx != nullptr) {
Player* player = GET_PLAYER(gGlobalCtx); Player* player = GET_PLAYER(gGlobalCtx);
std::string curSword, curShield, curTunic, curBoots; const char* curSword;
const char* curShield;
const char* curTunic;
const char* curBoots;
switch (player->currentSwordItem) { switch (player->currentSwordItem) {
case ITEM_SWORD_KOKIRI: case ITEM_SWORD_KOKIRI:
curSword = "Kokiri Sword"; curSword = "Kokiri Sword";
break; break;
@ -1308,6 +1313,7 @@ void DrawPlayerTab() {
curSword = "None"; curSword = "None";
break; break;
default: default:
curSword = "None";
break; break;
} }
switch (player->currentShield) { switch (player->currentShield) {
@ -1406,7 +1412,7 @@ void DrawPlayerTab() {
ImGui::Text("Link's Current Equipment"); ImGui::Text("Link's Current Equipment");
ImGui::PushItemWidth(ImGui::GetFontSize() * 15); ImGui::PushItemWidth(ImGui::GetFontSize() * 15);
if (ImGui::BeginCombo("Sword", curSword.c_str())) { if (ImGui::BeginCombo("Sword", curSword)) {
if (ImGui::Selectable("None")) { if (ImGui::Selectable("None")) {
player->currentSwordItem = ITEM_NONE; player->currentSwordItem = ITEM_NONE;
gSaveContext.equips.buttonItems[0] = ITEM_NONE; gSaveContext.equips.buttonItems[0] = ITEM_NONE;
@ -1442,7 +1448,7 @@ void DrawPlayerTab() {
ImGui::EndCombo(); ImGui::EndCombo();
} }
if (ImGui::BeginCombo("Shield", curShield.c_str())) { if (ImGui::BeginCombo("Shield", curShield)) {
if (ImGui::Selectable("None")) { if (ImGui::Selectable("None")) {
player->currentShield = PLAYER_SHIELD_NONE; player->currentShield = PLAYER_SHIELD_NONE;
Inventory_ChangeEquipment(EQUIP_SHIELD, PLAYER_SHIELD_NONE); Inventory_ChangeEquipment(EQUIP_SHIELD, PLAYER_SHIELD_NONE);
@ -1461,22 +1467,22 @@ void DrawPlayerTab() {
} }
ImGui::EndCombo(); ImGui::EndCombo();
} }
if (ImGui::BeginCombo("Tunic", curTunic.c_str())) { if (ImGui::BeginCombo("Tunic", curTunic)) {
if (ImGui::Selectable("Kokiri Tunic")) { if (ImGui::Selectable("Kokiri Tunic")) {
player->currentTunic = PLAYER_TUNIC_KOKIRI; player->currentTunic = PLAYER_TUNIC_KOKIRI;
Inventory_ChangeEquipment(EQUIP_TUNIC, PLAYER_TUNIC_KOKIRI); Inventory_ChangeEquipment(EQUIP_TUNIC, PLAYER_TUNIC_KOKIRI + 1);
} }
if (ImGui::Selectable("Goron Tunic")) { if (ImGui::Selectable("Goron Tunic")) {
player->currentTunic = PLAYER_TUNIC_GORON; player->currentTunic = PLAYER_TUNIC_GORON;
Inventory_ChangeEquipment(EQUIP_TUNIC, PLAYER_TUNIC_GORON); Inventory_ChangeEquipment(EQUIP_TUNIC, PLAYER_TUNIC_GORON + 1);
} }
if (ImGui::Selectable("Zora Tunic")) { if (ImGui::Selectable("Zora Tunic")) {
player->currentTunic = PLAYER_TUNIC_ZORA; player->currentTunic = PLAYER_TUNIC_ZORA;
Inventory_ChangeEquipment(EQUIP_TUNIC, PLAYER_TUNIC_ZORA); Inventory_ChangeEquipment(EQUIP_TUNIC, PLAYER_TUNIC_ZORA + 1);
} }
ImGui::EndCombo(); ImGui::EndCombo();
} }
if (ImGui::BeginCombo("Boots", curBoots.c_str())) { if (ImGui::BeginCombo("Boots", curBoots)) {
if (ImGui::Selectable("Kokiri Boots")) { if (ImGui::Selectable("Kokiri Boots")) {
player->currentBoots = PLAYER_BOOTS_KOKIRI; player->currentBoots = PLAYER_BOOTS_KOKIRI;
Inventory_ChangeEquipment(EQUIP_BOOTS, PLAYER_BOOTS_KOKIRI + 1); Inventory_ChangeEquipment(EQUIP_BOOTS, PLAYER_BOOTS_KOKIRI + 1);
@ -1503,8 +1509,6 @@ void DrawPlayerTab() {
ImGui::InputScalar("C Right", ImGuiDataType_U8, &gSaveContext.equips.buttonItems[3], &one, NULL); ImGui::InputScalar("C Right", ImGuiDataType_U8, &gSaveContext.equips.buttonItems[3], &one, NULL);
}); });
} else { } else {
ImGui::Text("Global Context needed for player info!"); ImGui::Text("Global Context needed for player info!");
} }