Skip to content

Commit

Permalink
Merge branch 'develop' of garrettjoecox.github.com:HarbourMasters/Shi…
Browse files Browse the repository at this point in the history
…pwright into let-it-snow
  • Loading branch information
garrettjoecox committed Nov 24, 2024
2 parents 7d3b9e8 + 8926d8f commit e6db2e5
Show file tree
Hide file tree
Showing 280 changed files with 2,604 additions and 841 deletions.
1 change: 0 additions & 1 deletion .github/workflows/generate-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ jobs:
- name: Cache build folder
uses: actions/cache@v4
with:
save-always: true
key: ${{ runner.os }}-build-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-${{ github.ref }}
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/pr-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ jobs:
if: ${{ github.event.workflow_run.event == 'pull_request' }}
steps:
- id: 'pr-number'
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const {owner, repo} = context.repo;
const pullHeadSHA = '${{github.event.workflow_run.head_sha}}';
const pullUserId = ${{github.event.sender.id}};
const prNumber = await (async () => {
const pulls = await github.rest.pulls.list({owner, repo});
for await (const {data} of github.paginate.iterator(pulls)) {
for await (const { data } of github.paginate.iterator(
github.rest.pulls.list, { owner, repo }
)) {
for (const pull of data) {
if (pull.head.sha === pullHeadSHA && pull.user.id === pullUserId) {
return pull.number;
Expand All @@ -36,7 +37,7 @@ jobs:
return prNumber;
- id: 'artifacts-text'
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
result-encoding: string
script: |
Expand All @@ -47,13 +48,13 @@ jobs:
});
return allArtifacts.data.artifacts.reduce((acc, item) => {
if (item.name === "assets") return acc;
if (item.name === "soh.otr") return acc;
acc += `
- [${item.name}.zip](https://nightly.link/${context.repo.owner}/${context.repo.repo}/actions/artifacts/${item.id}.zip)`;
return acc;
}, '### Build Artifacts');
- id: 'add-to-pr'
uses: garrettjoecox/pr-section@3.1.0
uses: garrettjoecox/pr-section@4.0.0
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
pr-number: ${{ steps.pr-number.outputs.result }}
Expand Down
2 changes: 1 addition & 1 deletion soh/assets/objects/object_link_child/object_link_child.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ static const ALIGN_ASSET(2) char gLinkChildDL_18580[] = dgLinkChildDL_18580;
static const ALIGN_ASSET(2) char gLinkChildBottle2DL[] = dgLinkChildBottle2DL;

#define dgLinkChildSlinghotStringDL "__OTR__objects/object_link_child/gLinkChildSlinghotStringDL"
static const ALIGN_ASSET(2) char gLinkChildSlinghotStringDL[] = dgLinkChildSlinghotStringDL;
static const ALIGN_ASSET(2) char gLinkChildSlingshotStringDL[] = dgLinkChildSlinghotStringDL;

#define dgLinkChildDekuShieldDL "__OTR__objects/object_link_child/gLinkChildDekuShieldDL"
static const ALIGN_ASSET(2) char gLinkChildDekuShieldDL[] = dgLinkChildDekuShieldDL;
Expand Down
2 changes: 1 addition & 1 deletion soh/include/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "functions.h"
#include "variables.h"
#include "macros.h"
#include "soh/OTRGlobals.h"
#include "soh/cvar_prefixes.h"
#include "soh/Enhancements/gameconsole.h"
#include "soh/Enhancements/gameplaystats.h"
#include <libultraship/bridge.h>
Expand Down
1 change: 1 addition & 0 deletions soh/soh/Enhancements/audio/AudioCollection.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "AudioCollection.h"
#include "sequence.h"
#include "sfx.h"
#include "soh/cvar_prefixes.h"
#include <vector>
#include <utils/StringHelper.h>
#include <libultraship/bridge.h>
Expand Down
5 changes: 3 additions & 2 deletions soh/soh/Enhancements/audio/AudioEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
#include <libultraship/libultraship.h>
#include <functions.h>
#include "../randomizer/3drando/random.hpp"
#include "../../OTRGlobals.h"
#include "soh/OTRGlobals.h"
#include "soh/cvar_prefixes.h"
#include <utils/StringHelper.h>
#include "../../UIWidgets.hpp"
#include "soh/UIWidgets.hpp"
#include "AudioCollection.h"
#include "soh/Enhancements/game-interactor/GameInteractor.h"

Expand Down
1 change: 1 addition & 0 deletions soh/soh/Enhancements/bootcommands.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <stdarg.h>
#include <z64.h>
#include "soh/OTRGlobals.h"
#include "soh/cvar_prefixes.h"

uint8_t gLoadFileSelect = 0, gSkipLogoTest = 0;

Expand Down
1 change: 1 addition & 0 deletions soh/soh/Enhancements/controls/InputViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "libultraship/libultra/controller.h"
#include "Context.h"
#include "soh/OTRGlobals.h"
#include "soh/cvar_prefixes.h"
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
Expand Down
5 changes: 3 additions & 2 deletions soh/soh/Enhancements/controls/SohInputEditorWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "soh/OTRGlobals.h"
#include "../../UIWidgets.hpp"
#include "z64.h"
#include "soh/cvar_prefixes.h"
#ifndef __WIIU__
#include "controller/controldevice/controller/mapping/sdl/SDLAxisDirectionToButtonMapping.h"
#endif
Expand Down Expand Up @@ -1578,9 +1579,9 @@ void SohInputEditorWindow::DrawCameraControlPanel() {
UIWidgets::Tooltip("Inverts the Camera X Axis in:\n-First-Person/C-Up view\n-Weapon Aiming");
UIWidgets::PaddedEnhancementCheckbox("Invert Aiming Y Axis", CVAR_SETTING("Controls.InvertAimingYAxis"), true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true);
UIWidgets::Tooltip("Inverts the Camera Y Axis in:\n-First-Person/C-Up view\n-Weapon Aiming");
UIWidgets::PaddedEnhancementCheckbox("Invert Shield Aiming Y Axis", CVAR_SETTING("Controls.InvertShieldAimingYAxis"), true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true);
UIWidgets::PaddedEnhancementCheckbox("Invert Shield Aiming X Axis", CVAR_SETTING("Controls.InvertShieldAimingXAxis"), true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true);
UIWidgets::Tooltip("Inverts the Shield Aiming Y Axis");
UIWidgets::PaddedEnhancementCheckbox("Invert Shield Aiming X Axis", CVAR_SETTING("Controls.InvertShieldAimingYAxis"));
UIWidgets::PaddedEnhancementCheckbox("Invert Shield Aiming Y Axis", CVAR_SETTING("Controls.InvertShieldAimingYAxis"));
UIWidgets::Tooltip("Inverts the Shield Aiming X Axis");
UIWidgets::PaddedEnhancementCheckbox("Invert Z-Weapon Aiming Y Axis", CVAR_SETTING("Controls.InvertZAimingYAxis"), true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true);
UIWidgets::Tooltip("Inverts the Camera Y Axis in:\n-Z-Weapon Aiming");
Expand Down
6 changes: 4 additions & 2 deletions soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@

#include "soh/UIWidgets.hpp"
#include "soh/OTRGlobals.h"
#include "soh/ResourceManagerHelpers.h"

extern "C" {
#include <z64.h>
#include "macros.h"
#include "soh/cvar_prefixes.h"
extern PlayState* gPlayState;
#include "objects/object_link_boy/object_link_boy.h"
#include "objects/object_link_child/object_link_child.h"
Expand Down Expand Up @@ -877,7 +879,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) {
Color_RGBA8 color = CVarGetColor(equipmentSlingshotString.cvar, defaultColor);
PATCH_GFX(gGiSlingshotDL, "Equipment_SlingshotString1",equipmentSlingshotString.changedCvar, 75, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255));
PATCH_GFX(gGiSlingshotDL, "Equipment_SlingshotString2",equipmentSlingshotString.changedCvar, 76, gsDPSetEnvColor(color.r / 2, color.g / 2, color.b / 2, 255));
PATCH_GFX(gLinkChildSlinghotStringDL, "Equipment_SlingshotString3",equipmentSlingshotString.changedCvar, 9, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255));
PATCH_GFX(gLinkChildSlingshotStringDL, "Equipment_SlingshotString3",equipmentSlingshotString.changedCvar, 9, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255));
}

static CosmeticOption& equipmentBowTips = cosmeticOptions.at("Equipment.BowTips");
Expand Down Expand Up @@ -1419,7 +1421,7 @@ void DrawSillyTab() {
Reset_Option_Single("Reset##BunnyHood_EarLength", CVAR_COSMETIC("BunnyHood.EarLength"));
UIWidgets::EnhancementSliderFloat("Bunny Hood Spread: %f", "##BunnyHood_EarSpread", CVAR_COSMETIC("BunnyHood.EarSpread"), -300.0f, 500.0f, "", 0.0f, false);
Reset_Option_Single("Reset##BunnyHood_EarSpread", CVAR_COSMETIC("BunnyHood.EarSpread"));
UIWidgets::EnhancementSliderFloat("Goron Neck Length: %f", "##Goron_NeckLength", CVAR_COSMETIC("Goron.NeckLength"), 0.0f, 1000.0f, "", 0.0f, false);
UIWidgets::EnhancementSliderFloat("Goron Neck Length: %f", "##Goron_NeckLength", CVAR_COSMETIC("Goron.NeckLength"), 0.0f, 5000.0f, "", 0.0f, false);
Reset_Option_Single("Reset##Goron_NeckLength", CVAR_COSMETIC("Goron.NeckLength"));
UIWidgets::EnhancementCheckbox("Unfix Goron Spin", CVAR_COSMETIC("UnfixGoronSpin"));
UIWidgets::EnhancementSliderFloat("Fairies Size: %f", "##Fairies_Size", CVAR_COSMETIC("Fairies.Size"), 0.25f, 5.0f, "", 1.0f, false);
Expand Down
7 changes: 2 additions & 5 deletions soh/soh/Enhancements/cosmetics/authenticGfxPatches.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include <libultraship/bridge.h>
#include <string>
#include "soh/OTRGlobals.h"
#include "soh/cvar_prefixes.h"
#include "soh/ResourceManagerHelpers.h"

extern "C" {
#include <libultraship/libultra.h>
Expand All @@ -9,11 +11,6 @@ extern "C" {
#include "objects/object_gi_soldout/object_gi_soldout.h"
#include "objects/object_ik/object_ik.h"
#include "objects/object_link_child/object_link_child.h"

uint32_t ResourceMgr_GameHasMasterQuest();
uint32_t ResourceMgr_GameHasOriginal();
void ResourceMgr_PatchGfxByName(const char* path, const char* patchName, int index, Gfx instruction);
void ResourceMgr_UnpatchGfxByName(const char* path, const char* patchName);
}

typedef struct {
Expand Down
42 changes: 30 additions & 12 deletions soh/soh/Enhancements/custom-message/CustomMessageManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ static const std::unordered_map<std::string, std::string> percentColors = { { "w
{ "b", QM_BLUE }, { "c", QM_LBLUE }, { "p", QM_PINK },
{ "y", QM_YELLOW }, { "B", QM_BLACK } };

static const std::unordered_map<std::string, std::string> colorToPercent = { { QM_WHITE, "%w" }, { QM_RED, "%r"}, { QM_GREEN, "%g" },
{ QM_BLUE, "%b" }, { QM_LBLUE, "%c"}, { QM_PINK, "%p" },
{ QM_YELLOW, "%y" }, { QM_BLACK, "%B" } };

static const std::unordered_map<std::string, ItemID> altarIcons = {
{ "0", ITEM_KOKIRI_EMERALD },
{ "1", ITEM_GORON_RUBY },
Expand Down Expand Up @@ -153,6 +157,8 @@ void CustomMessage::ProcessMessageFormat(std::string& str, MessageFormat format)
CleanString(str);
} else if (format == MF_AUTO_FORMAT){
AutoFormatString(str);
}else if (format == MF_ENCODE){
EncodeColors(str);
}
}

Expand Down Expand Up @@ -296,6 +302,12 @@ void CustomMessage::Clean() {
}
}

void CustomMessage::Encode() {
for (std::string& str : messages) {
EncodeColors(str);
}
}

void CustomMessage::FormatString(std::string& str) const {
std::replace(str.begin(), str.end(), '&', NEWLINE()[0]);
std::replace(str.begin(), str.end(), '^', WAIT_FOR_INPUT()[0]);
Expand Down Expand Up @@ -521,7 +533,23 @@ const char* Interface_ReplaceSpecialCharacters(char text[]) {
return textChar;
}

void CustomMessage::EncodeColors(std::string& str) const {
for (std::string color: colors) {
if (const size_t firstHashtag = str.find('#'); firstHashtag != std::string::npos) {
str.replace(firstHashtag, 1, colorToPercent.at(color));
if (const size_t secondHashtag = str.find('#', firstHashtag + 1); secondHashtag != std::string::npos) {
str.replace(secondHashtag, 1, "%w");
} else {
SPDLOG_DEBUG("non-matching hashtags in string: \"%s\"", str);
}
}
}
// Remove any remaining '#' characters.
std::erase(str, '#');
}

void CustomMessage::ReplaceColors(std::string& str) const {
EncodeColors(str);
for (const auto& colorPair : percentColors) {
std::string textToReplace = "%";
textToReplace += colorPair.first;
Expand All @@ -531,18 +559,6 @@ void CustomMessage::ReplaceColors(std::string& str) const {
start_pos += textToReplace.length();
}
}
for (auto color: colors) {
if (const size_t firstHashtag = str.find('#'); firstHashtag != std::string::npos) {
str.replace(firstHashtag, 1, COLOR(color));
if (const size_t secondHashtag = str.find('#', firstHashtag + 1); secondHashtag != std::string::npos) {
str.replace(secondHashtag, 1, COLOR(QM_WHITE));
} else {
SPDLOG_DEBUG("non-matching hashtags in string: \"%s\"", str);
}
}
}
// Remove any remaining '#' characters.
std::erase(str, '#');
}

void CustomMessage::ReplaceAltarIcons(std::string& str) const {
Expand Down Expand Up @@ -634,6 +650,8 @@ CustomMessage CustomMessageManager::RetrieveMessage(std::string tableID, uint16_
message.AutoFormat();
} else if (format == MF_CLEAN){
message.Clean();
} else if (format == MF_ENCODE){
message.Encode();
}

return message;
Expand Down
13 changes: 12 additions & 1 deletion soh/soh/Enhancements/custom-message/CustomMessageManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ typedef enum {
MF_FORMATTED,
MF_CLEAN,
MF_RAW,
MF_AUTO_FORMAT
MF_AUTO_FORMAT,
MF_ENCODE,
} MessageFormat;

/**
Expand Down Expand Up @@ -111,6 +112,11 @@ class CustomMessage {
*/
void ReplaceSpecialCharacters(std::string& str) const;

/**
* @brief Replaces hashtags with stored colors.
*/
void EncodeColors(std::string& str) const;

/**
* @brief Replaces our color variable strings with the OoT control codes.
*/
Expand Down Expand Up @@ -163,6 +169,11 @@ class CustomMessage {
*/
void Clean();

/**
* @brief Replaces variable characters with fixed ones to store the sata in string form
*/
void Encode();

/**
* @brief Replaces various symbols with the control codes necessary to
* display them in OoT's textboxes for a single string
Expand Down
1 change: 1 addition & 0 deletions soh/soh/Enhancements/debugconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <vector>
#include <string>
#include "soh/OTRGlobals.h"
#include "soh/cvar_prefixes.h"
#include <soh/Enhancements/item-tables/ItemTableManager.h>
#include "soh/Enhancements/game-interactor/GameInteractor.h"
#include "soh/Enhancements/cosmetics/CosmeticsEditor.h"
Expand Down
1 change: 1 addition & 0 deletions soh/soh/Enhancements/debugger/MessageViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "../custom-message/CustomMessageManager.h"
#include "functions.h"
#include "macros.h"
#include "soh/cvar_prefixes.h"
#include "message_data_static.h"
#include "variables.h"
#include "soh/util.h"
Expand Down
1 change: 1 addition & 0 deletions soh/soh/Enhancements/debugger/actorViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <libultraship/bridge.h>
#include <libultraship/libultraship.h>
#include "soh/OTRGlobals.h"
#include "soh/cvar_prefixes.h"

extern "C" {
#include <z64.h>
Expand Down
1 change: 1 addition & 0 deletions soh/soh/Enhancements/debugger/colViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ extern "C" {
#include "variables.h"
#include "functions.h"
#include "macros.h"
#include "soh/cvar_prefixes.h"
extern PlayState* gPlayState;
}

Expand Down
3 changes: 2 additions & 1 deletion soh/soh/Enhancements/debugger/debugSaveEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ extern "C" {
#include "variables.h"
#include "functions.h"
#include "macros.h"
#include "soh/cvar_prefixes.h"
#include "soh/Enhancements/randomizer/adult_trade_shuffle.h"
extern PlayState* gPlayState;

Expand Down Expand Up @@ -1206,7 +1207,7 @@ void DrawQuestStatusTab() {
ImGui::SameLine();
DrawQuestItemButton(QUEST_GERUDO_CARD);

for (const SongMapEntry& entry : songMapping) {
for (const auto& [quest, entry] : songMapping) {
if ((entry.id != QUEST_SONG_MINUET) && (entry.id != QUEST_SONG_LULLABY)) {
ImGui::SameLine();
}
Expand Down
1 change: 1 addition & 0 deletions soh/soh/Enhancements/debugger/valueViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ extern "C" {
#include "variables.h"
#include "functions.h"
#include "macros.h"
#include "soh/cvar_prefixes.h"
extern PlayState* gPlayState;
void GfxPrint_SetColor(GfxPrint* printer, u32 r, u32 g, u32 b, u32 a);
void GfxPrint_SetPos(GfxPrint* printer, s32 x, s32 y);
Expand Down
4 changes: 2 additions & 2 deletions soh/soh/Enhancements/enemyrandomizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
#include "soh/Enhancements/enhancementTypes.h"
#include "variables.h"
#include "soh/OTRGlobals.h"
#include "soh/cvar_prefixes.h"
#include "soh/ResourceManagerHelpers.h"

extern "C" {
#include <z64.h>
}

extern "C" uint32_t ResourceMgr_IsSceneMasterQuest(s16 sceneNum);

const char* enemyCVarList[] = {
CVAR_ENHANCEMENT("RandomizedEnemyList.Armos"), CVAR_ENHANCEMENT("RandomizedEnemyList.Arwing"),
CVAR_ENHANCEMENT("RandomizedEnemyList.BabyDodongo"), CVAR_ENHANCEMENT("RandomizedEnemyList.Bari"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
extern "C" {
#include "variables.h"
#include "macros.h"
#include "soh/cvar_prefixes.h"
#include "functions.h"
extern PlayState* gPlayState;
}
Expand Down
3 changes: 1 addition & 2 deletions soh/soh/Enhancements/gameplaystats.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
extern "C" {
#include "gameplaystats.h"
}
#include "gameplaystatswindow.h"

#include "soh/SaveManager.h"
#include "functions.h"
#include "macros.h"
#include "soh/cvar_prefixes.h"
#include "../UIWidgets.hpp"
#include "soh/util.h"

Expand Down
Loading

0 comments on commit e6db2e5

Please sign in to comment.