Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Christmas Build #2

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion soh/include/variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ extern "C"
extern s16 gSpoilingItems[3];
extern s16 gSpoilingItemReverts[3];
extern FlexSkeletonHeader* gPlayerSkelHeaders[2];
extern u8 gPlayerModelTypes[][5];
extern u8 gPlayerModelTypes[PLAYER_MODELGROUP_MAX][PLAYER_MODELGROUPENTRY_MAX];
extern Gfx* gPlayerLeftHandBgsDLs[];
extern Gfx* gPlayerLeftHandOpenDLs[];
extern Gfx* gPlayerLeftHandClosedDLs[];
Expand Down
2 changes: 2 additions & 0 deletions soh/include/z64.h
Original file line number Diff line number Diff line change
Expand Up @@ -2245,6 +2245,8 @@ typedef enum {
LED_SOURCE_TUNIC_ORIGINAL,
LED_SOURCE_TUNIC_COSMETICS,
LED_SOURCE_HEALTH,
LED_SOURCE_NAVI_ORIGINAL,
LED_SOURCE_NAVI_COSMETICS,
LED_SOURCE_CUSTOM
} LEDColorSource;

Expand Down
70 changes: 66 additions & 4 deletions soh/include/z64item.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,74 @@
#define Z64ITEM_H

typedef enum {
/* 0x00 */ EQUIP_SWORD,
/* 0x01 */ EQUIP_SHIELD,
/* 0x02 */ EQUIP_TUNIC,
/* 0x03 */ EQUIP_BOOTS
/* 0 */ EQUIP_TYPE_SWORD,
/* 1 */ EQUIP_TYPE_SHIELD,
/* 2 */ EQUIP_TYPE_TUNIC,
/* 3 */ EQUIP_TYPE_BOOTS,
/* 4 */ EQUIP_TYPE_MAX
} EquipmentType;

// `EquipInv*` enums are for Inventory.equipment (for example used in the `CHECK_OWNED_EQUIP` macro)

typedef enum {
/* 0 */ EQUIP_INV_SWORD_KOKIRI,
/* 1 */ EQUIP_INV_SWORD_MASTER,
/* 2 */ EQUIP_INV_SWORD_BIGGORON,
/* 3 */ EQUIP_INV_SWORD_BROKENGIANTKNIFE
} EquipInvSword;

typedef enum {
/* 0 */ EQUIP_INV_SHIELD_DEKU,
/* 1 */ EQUIP_INV_SHIELD_HYLIAN,
/* 2 */ EQUIP_INV_SHIELD_MIRROR
} EquipInvShield;

typedef enum {
/* 0 */ EQUIP_INV_TUNIC_KOKIRI,
/* 1 */ EQUIP_INV_TUNIC_GORON,
/* 2 */ EQUIP_INV_TUNIC_ZORA
} EquipInvTunic;

typedef enum {
/* 0 */ EQUIP_INV_BOOTS_KOKIRI,
/* 1 */ EQUIP_INV_BOOTS_IRON,
/* 2 */ EQUIP_INV_BOOTS_HOVER
} EquipInvBoots;

// `EquipValue*` enums are for ItemEquips.equipment (for example used in the `CUR_EQUIP_VALUE` macro)

typedef enum {
/* 0 */ EQUIP_VALUE_SWORD_NONE,
/* 1 */ EQUIP_VALUE_SWORD_KOKIRI,
/* 2 */ EQUIP_VALUE_SWORD_MASTER,
/* 3 */ EQUIP_VALUE_SWORD_BIGGORON,
/* 4 */ EQUIP_VALUE_SWORD_MAX
} EquipValueSword;

typedef enum {
/* 0 */ EQUIP_VALUE_SHIELD_NONE,
/* 1 */ EQUIP_VALUE_SHIELD_DEKU,
/* 2 */ EQUIP_VALUE_SHIELD_HYLIAN,
/* 3 */ EQUIP_VALUE_SHIELD_MIRROR,
/* 4 */ EQUIP_VALUE_SHIELD_MAX
} EquipValueShield;

typedef enum {
/* 0 */ EQUIP_VALUE_TUNIC_NONE,
/* 1 */ EQUIP_VALUE_TUNIC_KOKIRI,
/* 2 */ EQUIP_VALUE_TUNIC_GORON,
/* 3 */ EQUIP_VALUE_TUNIC_ZORA,
/* 4 */ EQUIP_VALUE_TUNIC_MAX
} EquipValueTunic;

typedef enum {
/* 0 */ EQUIP_VALUE_BOOTS_NONE,
/* 1 */ EQUIP_VALUE_BOOTS_KOKIRI,
/* 2 */ EQUIP_VALUE_BOOTS_IRON,
/* 3 */ EQUIP_VALUE_BOOTS_HOVER,
/* 4 */ EQUIP_VALUE_BOOTS_MAX
} EquipValueBoots;

typedef enum {
/* 0x00 */ UPG_QUIVER,
/* 0x01 */ UPG_BOMB_BAG,
Expand Down
10 changes: 5 additions & 5 deletions soh/soh/Enhancements/boss-rush/BossRush.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,18 +462,18 @@ void BossRush_SetEquipment(uint8_t linkAge) {

brCButtonSlots = { SLOT_STICK, SLOT_NUT, SLOT_BOMB, SLOT_NONE, SLOT_NONE, SLOT_NONE, SLOT_NONE };

Inventory_ChangeEquipment(EQUIP_SWORD, PLAYER_SWORD_KOKIRI);
Inventory_ChangeEquipment(EQUIP_SHIELD, PLAYER_SHIELD_DEKU);
Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_KOKIRI);
Inventory_ChangeEquipment(EQUIP_TYPE_SHIELD, EQUIP_VALUE_SHIELD_DEKU);
// Set Adult equipment.
} else {
brButtonItems = { ITEM_SWORD_MASTER, ITEM_BOW, ITEM_HAMMER, ITEM_BOMB,
ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE };

brCButtonSlots = { SLOT_BOW, SLOT_HAMMER, SLOT_BOMB, SLOT_NONE, SLOT_NONE, SLOT_NONE, SLOT_NONE };

Inventory_ChangeEquipment(EQUIP_SWORD, PLAYER_SWORD_MASTER);
Inventory_ChangeEquipment(EQUIP_SHIELD, PLAYER_SHIELD_MIRROR);
Inventory_ChangeEquipment(EQUIP_TUNIC, PLAYER_TUNIC_GORON + 1); // Game expects tunic + 1, don't ask me why.
Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_MASTER);
Inventory_ChangeEquipment(EQUIP_TYPE_SHIELD, EQUIP_VALUE_SHIELD_MIRROR);
Inventory_ChangeEquipment(EQUIP_TYPE_TUNIC, EQUIP_VALUE_TUNIC_GORON);
}

// Button Items
Expand Down
5 changes: 3 additions & 2 deletions soh/soh/Enhancements/controls/GameControlEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,14 @@ namespace GameControlEditor {

void DrawLEDControlPanel(GameControlEditorWindow* window) {
window->BeginGroupPanelPublic("LED Colors", ImGui::GetContentRegionAvail());
static const char* ledSources[4] = { "Original Tunic Colors", "Cosmetics Tunic Colors", "Health Colors", "Custom" };
static const char* ledSources[] = { "Original Tunic Colors", "Cosmetics Tunic Colors", "Health Colors",
"Original Navi Targeting Colors", "Cosmetics Navi Targeting Colors", "Custom" };
UIWidgets::PaddedText("Source");
UIWidgets::EnhancementCombobox("gLedColorSource", ledSources, LED_SOURCE_TUNIC_ORIGINAL);
DrawHelpIcon("Health\n- Red when health critical (13-20% depending on max health)\n- Yellow when health < 40%. Green otherwise.\n\n" \
"Tunics: colors will mirror currently equipped tunic, whether original or the current values in Cosmetics Editor.\n\n" \
"Custom: single, solid color");
if (CVarGetInteger("gLedColorSource", 1) == 3) {
if (CVarGetInteger("gLedColorSource", 1) == LED_SOURCE_CUSTOM) {
UIWidgets::Spacer(3);
auto port1Color = CVarGetColor24("gLedPort1Color", { 255, 255, 255 });
ImVec4 colorVec = { port1Color.r / 255.0f, port1Color.g / 255.0f, port1Color.b / 255.0f, 1.0f };
Expand Down
2 changes: 1 addition & 1 deletion soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1535,7 +1535,7 @@ void DrawSillyTab() {
CVarClear("gCosmetics.BunnyHood_EarSpread");
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
}
UIWidgets::EnhancementSliderFloat("Goron Neck Length: %f", "##Goron_NeckLength", "gCosmetics.Goron_NeckLength", 0.0f, 1000.0f, "", 0.0f, false);
UIWidgets::EnhancementSliderFloat("Goron Neck Length: %f", "##Goron_NeckLength", "gCosmetics.Goron_NeckLength", 0.0f, 5000.0f, "", 0.0f, false);
ImGui::SameLine();
if (ImGui::Button("Reset##Goron_NeckLength")) {
CVarClear("gCosmetics.Goron_NeckLength");
Expand Down
6 changes: 3 additions & 3 deletions soh/soh/Enhancements/debugconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1102,9 +1102,9 @@ static bool SpeedModifierHandler(std::shared_ptr<LUS::Console> Console, const st
}

const static std::map<std::string, uint16_t> boots {
{ "kokiri", PLAYER_BOOTS_KOKIRI },
{ "iron", PLAYER_BOOTS_IRON },
{ "hover", PLAYER_BOOTS_HOVER },
{ "kokiri", EQUIP_VALUE_BOOTS_KOKIRI },
{ "iron", EQUIP_VALUE_BOOTS_IRON },
{ "hover", EQUIP_VALUE_BOOTS_HOVER },
};

static bool BootsHandler(std::shared_ptr<LUS::Console> Console, const std::vector<std::string>& args, std::string* output) {
Expand Down
30 changes: 15 additions & 15 deletions soh/soh/Enhancements/debugger/debugSaveEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1602,17 +1602,17 @@ void DrawPlayerTab() {
if (ImGui::Selectable("None")) {
player->currentSwordItemId = ITEM_NONE;
gSaveContext.equips.buttonItems[0] = ITEM_NONE;
Inventory_ChangeEquipment(EQUIP_SWORD, PLAYER_SWORD_NONE);
Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_NONE);
}
if (ImGui::Selectable("Kokiri Sword")) {
player->currentSwordItemId = ITEM_SWORD_KOKIRI;
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KOKIRI;
Inventory_ChangeEquipment(EQUIP_SWORD, PLAYER_SWORD_KOKIRI);
Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_KOKIRI);
}
if (ImGui::Selectable("Master Sword")) {
player->currentSwordItemId = ITEM_SWORD_MASTER;
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER;
Inventory_ChangeEquipment(EQUIP_SWORD, PLAYER_SWORD_MASTER);
Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_MASTER);
}
if (ImGui::Selectable("Biggoron's Sword")) {
if (gSaveContext.bgsFlag) {
Expand All @@ -1629,64 +1629,64 @@ void DrawPlayerTab() {
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KNIFE;
}

Inventory_ChangeEquipment(EQUIP_SWORD, PLAYER_SWORD_BIGGORON);
Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_BIGGORON);
}
if (ImGui::Selectable("Fishing Pole")) {
player->currentSwordItemId = ITEM_FISHING_POLE;
gSaveContext.equips.buttonItems[0] = ITEM_FISHING_POLE;
Inventory_ChangeEquipment(EQUIP_SWORD, PLAYER_SWORD_MASTER);
Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_MASTER);
}
ImGui::EndCombo();

}
if (ImGui::BeginCombo("Shield", curShield)) {
if (ImGui::Selectable("None")) {
player->currentShield = PLAYER_SHIELD_NONE;
Inventory_ChangeEquipment(EQUIP_SHIELD, PLAYER_SHIELD_NONE);
Inventory_ChangeEquipment(EQUIP_TYPE_SHIELD, EQUIP_VALUE_SHIELD_NONE);
}
if (ImGui::Selectable("Deku Shield")) {
player->currentShield = PLAYER_SHIELD_DEKU;
Inventory_ChangeEquipment(EQUIP_SHIELD, PLAYER_SHIELD_DEKU);
Inventory_ChangeEquipment(EQUIP_TYPE_SHIELD, EQUIP_VALUE_SHIELD_DEKU);
}
if (ImGui::Selectable("Hylian Shield")) {
player->currentShield = PLAYER_SHIELD_HYLIAN;
Inventory_ChangeEquipment(EQUIP_SHIELD, PLAYER_SHIELD_HYLIAN);
Inventory_ChangeEquipment(EQUIP_TYPE_SHIELD, EQUIP_VALUE_SHIELD_HYLIAN);
}
if (ImGui::Selectable("Mirror Shield")) {
player->currentShield = PLAYER_SHIELD_MIRROR;
Inventory_ChangeEquipment(EQUIP_SHIELD, PLAYER_SHIELD_MIRROR);
Inventory_ChangeEquipment(EQUIP_TYPE_SHIELD, EQUIP_VALUE_SHIELD_MIRROR);
}
ImGui::EndCombo();
}

if (ImGui::BeginCombo("Tunic", curTunic)) {
if (ImGui::Selectable("Kokiri Tunic")) {
player->currentTunic = PLAYER_TUNIC_KOKIRI;
Inventory_ChangeEquipment(EQUIP_TUNIC, PLAYER_TUNIC_KOKIRI + 1);
Inventory_ChangeEquipment(EQUIP_TYPE_TUNIC, EQUIP_VALUE_TUNIC_KOKIRI);
}
if (ImGui::Selectable("Goron Tunic")) {
player->currentTunic = PLAYER_TUNIC_GORON;
Inventory_ChangeEquipment(EQUIP_TUNIC, PLAYER_TUNIC_GORON + 1);
Inventory_ChangeEquipment(EQUIP_TYPE_TUNIC, EQUIP_VALUE_TUNIC_GORON);
}
if (ImGui::Selectable("Zora Tunic")) {
player->currentTunic = PLAYER_TUNIC_ZORA;
Inventory_ChangeEquipment(EQUIP_TUNIC, PLAYER_TUNIC_ZORA + 1);
Inventory_ChangeEquipment(EQUIP_TYPE_TUNIC, EQUIP_VALUE_TUNIC_ZORA);
}
ImGui::EndCombo();
}

if (ImGui::BeginCombo("Boots", curBoots)) {
if (ImGui::Selectable("Kokiri Boots")) {
player->currentBoots = PLAYER_BOOTS_KOKIRI;
Inventory_ChangeEquipment(EQUIP_BOOTS, PLAYER_BOOTS_KOKIRI + 1);
Inventory_ChangeEquipment(EQUIP_TYPE_BOOTS, EQUIP_VALUE_BOOTS_KOKIRI);
}
if (ImGui::Selectable("Iron Boots")) {
player->currentBoots = PLAYER_BOOTS_IRON;
Inventory_ChangeEquipment(EQUIP_BOOTS, PLAYER_BOOTS_IRON + 1);
Inventory_ChangeEquipment(EQUIP_TYPE_BOOTS, EQUIP_VALUE_BOOTS_IRON);
}
if (ImGui::Selectable("Hover Boots")) {
player->currentBoots = PLAYER_BOOTS_HOVER;
Inventory_ChangeEquipment(EQUIP_BOOTS, PLAYER_BOOTS_HOVER + 1);
Inventory_ChangeEquipment(EQUIP_TYPE_BOOTS, EQUIP_VALUE_BOOTS_HOVER);
}
ImGui::EndCombo();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ namespace GameInteractionEffect {
GameInteractor::RawAction::ForceEquipBoots(parameters[0]);
}
void ForceEquipBoots::_Remove() {
GameInteractor::RawAction::ForceEquipBoots(PLAYER_BOOTS_KOKIRI);
GameInteractor::RawAction::ForceEquipBoots(EQUIP_VALUE_BOOTS_KOKIRI);
}

// MARK: - ModifyRunSpeedModifier
Expand Down Expand Up @@ -425,9 +425,9 @@ namespace GameInteractionEffect {
GameInteractionEffectQueryResult GiveOrTakeShield::CanBeApplied() {
if (!GameInteractor::IsSaveLoaded() || GameInteractor::IsGameplayPaused()) {
return GameInteractionEffectQueryResult::TemporarilyNotPossible;
} else if ((parameters[0] > 0 && ((gBitFlags[parameters[0] - ITEM_SHIELD_DEKU] << gEquipShifts[EQUIP_SHIELD]) &
} else if ((parameters[0] > 0 && ((gBitFlags[parameters[0] - ITEM_SHIELD_DEKU] << gEquipShifts[EQUIP_TYPE_SHIELD]) &
gSaveContext.inventory.equipment)) ||
(parameters[0] < 0 && !((gBitFlags[(parameters[0] * -1) - ITEM_SHIELD_DEKU] << gEquipShifts[EQUIP_SHIELD]) &
(parameters[0] < 0 && !((gBitFlags[(parameters[0] * -1) - ITEM_SHIELD_DEKU] << gEquipShifts[EQUIP_TYPE_SHIELD]) &
gSaveContext.inventory.equipment))) {
return GameInteractionEffectQueryResult::NotPossible;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ void GameInteractor::RawAction::SetWeatherStorm(bool active) {

void GameInteractor::RawAction::ForceEquipBoots(int8_t boots) {
Player* player = GET_PLAYER(gPlayState);
player->currentBoots = boots;
Inventory_ChangeEquipment(EQUIP_BOOTS, boots + 1);
player->currentBoots = BOOTS_EQUIP_TO_PLAYER(boots);
Inventory_ChangeEquipment(EQUIP_TYPE_BOOTS, boots);
Player_SetBootData(gPlayState, player);
}

Expand Down Expand Up @@ -274,24 +274,24 @@ void GameInteractor::RawAction::GiveOrTakeShield(int32_t shield) {
break;
}

gSaveContext.inventory.equipment &= ~(gBitFlags[shield - ITEM_SHIELD_DEKU] << gEquipShifts[EQUIP_SHIELD]);
gSaveContext.inventory.equipment &= ~(gBitFlags[shield - ITEM_SHIELD_DEKU] << gEquipShifts[EQUIP_TYPE_SHIELD]);

if (player->currentShield == shieldToCheck) {
player->currentShield = PLAYER_SHIELD_NONE;
Inventory_ChangeEquipment(EQUIP_SHIELD, PLAYER_SHIELD_NONE);
Inventory_ChangeEquipment(EQUIP_TYPE_SHIELD, EQUIP_VALUE_SHIELD_NONE);
}
} else {
Item_Give(gPlayState, shield);
if (player->currentShield == PLAYER_SHIELD_NONE) {
if (LINK_IS_CHILD && shield == ITEM_SHIELD_DEKU) {
player->currentShield = PLAYER_SHIELD_DEKU;
Inventory_ChangeEquipment(EQUIP_SHIELD, PLAYER_SHIELD_DEKU);
Inventory_ChangeEquipment(EQUIP_TYPE_SHIELD, EQUIP_VALUE_SHIELD_DEKU);
} else if (LINK_IS_ADULT && shield == ITEM_SHIELD_MIRROR) {
player->currentShield = PLAYER_SHIELD_MIRROR;
Inventory_ChangeEquipment(EQUIP_SHIELD, PLAYER_SHIELD_MIRROR);
Inventory_ChangeEquipment(EQUIP_TYPE_SHIELD, EQUIP_VALUE_SHIELD_MIRROR);
} else if (shield == ITEM_SHIELD_HYLIAN) {
player->currentShield = PLAYER_SHIELD_HYLIAN;
Inventory_ChangeEquipment(EQUIP_SHIELD, PLAYER_SHIELD_HYLIAN);
Inventory_ChangeEquipment(EQUIP_TYPE_SHIELD, EQUIP_VALUE_SHIELD_HYLIAN);
}
}
}
Expand Down
11 changes: 5 additions & 6 deletions soh/soh/Enhancements/gameplaystats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ extern "C" {
#include "functions.h"
#include "macros.h"
#include "../UIWidgets.hpp"
#include "soh/util.h"

#include <vector>
#include <string>
Expand Down Expand Up @@ -286,10 +287,8 @@ extern "C" char* GameplayStats_GetCurrentTime() {
}

void LoadStatsVersion1() {
std::string buildVersion;
SaveManager::Instance->LoadData("buildVersion", buildVersion);
strncpy(gSaveContext.sohStats.buildVersion, buildVersion.c_str(), ARRAY_COUNT(gSaveContext.sohStats.buildVersion) - 1);
gSaveContext.sohStats.buildVersion[ARRAY_COUNT(gSaveContext.sohStats.buildVersion) - 1] = 0;
SaveManager::Instance->LoadCharArray("buildVersion", gSaveContext.sohStats.buildVersion,
ARRAY_COUNT(gSaveContext.sohStats.buildVersion));
SaveManager::Instance->LoadData("buildVersionMajor", gSaveContext.sohStats.buildVersionMajor);
SaveManager::Instance->LoadData("buildVersionMinor", gSaveContext.sohStats.buildVersionMinor);
SaveManager::Instance->LoadData("buildVersionPatch", gSaveContext.sohStats.buildVersionPatch);
Expand Down Expand Up @@ -683,8 +682,8 @@ void InitStats(bool isDebug) {
gSaveContext.sohStats.entrancesDiscovered[entrancesIdx] = 0;
}

strncpy(gSaveContext.sohStats.buildVersion, (const char*) gBuildVersion, sizeof(gSaveContext.sohStats.buildVersion) - 1);
gSaveContext.sohStats.buildVersion[sizeof(gSaveContext.sohStats.buildVersion) - 1] = 0;
SohUtils::CopyStringToCharArray(gSaveContext.sohStats.buildVersion, std::string((char*)gBuildVersion),
ARRAY_COUNT(gSaveContext.sohStats.buildVersion));
gSaveContext.sohStats.buildVersionMajor = gBuildVersionMajor;
gSaveContext.sohStats.buildVersionMinor = gBuildVersionMinor;
gSaveContext.sohStats.buildVersionPatch = gBuildVersionPatch;
Expand Down
Loading