Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e270c3a
Merge pull request #26 from HarbourMasters/develop
Caladius Jan 16, 2024
2b04b58
Merge branch 'develop' of https://github.com/Caladius/Shipwright into…
Caladius Jul 18, 2024
fcea91a
Merge remote-tracking branch 'origin/develop' into develop
Caladius Aug 19, 2024
ce5306d
Merge branch 'develop' of https://github.com/HarbourMasters/Shipwrigh…
Caladius Aug 29, 2024
81522c0
v1 - No PR
Caladius Aug 31, 2024
bbf57c2
New Events fixed a lot of oddities and added in proper voting system …
Caladius Sep 8, 2024
cad5b76
Add sail integration for chaos mode
garrettjoecox Sep 13, 2024
e4654c0
Merge pull request #33 from garrettjoecox/chaos-v1
Caladius Sep 14, 2024
849a4cd
Fix Iron Knuckles, Add Mido.
Caladius Sep 15, 2024
fe53604
Guard Event
Caladius Sep 18, 2024
c46ad4b
Erasure starting point.
Caladius Sep 19, 2024
d0b9f4a
Falling Ceiling Event
Caladius Sep 21, 2024
d8fb7f2
Force Stop Hearts
Caladius Sep 22, 2024
93b5f01
Spike Trap
Caladius Sep 22, 2024
ee2bfc8
Fix Mido
Caladius Sep 24, 2024
3f9fc77
Floating Stuff Event
Caladius Sep 26, 2024
5ff7a71
Fix the floaties
Caladius Sep 26, 2024
aeb3db6
Floating Stuff Final
Caladius Sep 26, 2024
e786563
Rupee Drop Event
Caladius Sep 27, 2024
96f76ed
Fire Maze Event
Caladius Sep 27, 2024
ed5b137
Revenge Event
Caladius Sep 27, 2024
38d103e
Temp remove Erase Event, fix Voting Timer for Test
Caladius Sep 27, 2024
9983e5b
Merge remote-tracking branch 'origin/develop' into chaos-v1
Caladius Sep 27, 2024
4580e98
Fix Force Stop Hearts with Double Defense
Caladius Sep 29, 2024
9a575a3
Fix Falling Ceiling respawn activator
Caladius Sep 29, 2024
b85cb91
Fix Spike Trap Respawn
Caladius Sep 29, 2024
c5a7c01
Fix Iron Knuckle Spawns/Respawns
Caladius Sep 29, 2024
b9177da
readd Erasure (get bent KD)
Caladius Sep 29, 2024
323ec2e
Fix Floating Stuff Return
Caladius Sep 29, 2024
e0ae025
Update Force Stop to account for DD
Caladius Sep 29, 2024
121dbd3
Attempt to Spawn Solider above Collision.
Caladius Sep 29, 2024
d97869a
Window Size Default
Caladius Sep 29, 2024
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
1,551 changes: 1,551 additions & 0 deletions soh/soh/Enhancements/chaos-mode/ChaosWindow.cpp

Large diffs are not rendered by default.

103 changes: 103 additions & 0 deletions soh/soh/Enhancements/chaos-mode/ChaosWindow.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#ifndef CHAOSWINDOW_H
#define CHAOSWINDOW_H

#include "GuiWindow.h"
#include "z64.h"
#include <vector>
#include "Fonts.h"

extern void ChaosUpdateVotingInterval();

typedef enum {
COLOR_WHITE,
COLOR_GRAY,
COLOR_DARK_GRAY,
COLOR_INDIGO,
COLOR_LIGHT_RED,
COLOR_RED,
COLOR_DARK_RED,
COLOR_LIGHT_GREEN,
COLOR_GREEN,
COLOR_DARK_GREEN,
COLOR_YELLOW,
};

typedef struct {
uint32_t colorName;
ImVec4 colorCode;
} colorObject;

typedef struct {
uint32_t eventId;
const char* eventName;
const char* eventVariable;
uint32_t eventTimer;
const char* eventDescription;
} eventObject;

typedef struct {
uint32_t votingOption;
uint32_t votingCount;
} voteObject;

typedef enum {
EVENT_ACTION_REMOVE,
EVENT_ACTION_ADD,
};

typedef struct {
uint32_t eventTimer;
const char* eventVariable;
} eventTimerObject;

typedef enum {
EVENT_INVISIBILITY,
EVENT_STORMY_WEATHER,
EVENT_FORCE_IRON_BOOTS,
EVENT_FORCE_HOVER_BOOTS,
EVENT_BOMBERMAN_MODE,
EVENT_FLOOR_IS_LAVA,
EVENT_FAKE_TELEPORT,
EVENT_REAL_TELEPORT,
EVENT_ACTOR_MAGNET,
EVENT_DEATH_SWITCH,
EVENT_KNUCKLE_RING,
EVENT_MIDO_SUCKS,
EVENT_THROWN_IN_THE_PAST,
EVENT_ERASURE,
EVENT_FALLING_CEILING,
EVENT_FORCE_STOP_HEARTS,
EVENT_SPIKE_TRAP,
EVENT_FLOATING_STUFF,
EVENT_DROP_RUPEES,
EVENT_FIRE_MAZE,
EVENT_CARDINALS_REVENGE,
EVENT_MAX_CHAOS,
} ChaosEvents;

typedef enum {
VOTE_OPTION_A,
VOTE_OPTION_B,
VOTE_OPTION_C,
};

typedef enum {
BUTTON_CLEFT = 1,
BUTTON_CDOWN,
BUTTON_CRIGHT,
BUTTON_DUP,
BUTTON_DDOWN,
BUTTON_DLEFT,
BUTTON_DRIGHT,
};

class ChaosWindow : public Ship::GuiWindow {
public:
using GuiWindow::GuiWindow;

void InitElement();
void DrawElement();
void UpdateElement() override{};
};

#endif // CHAOSWINDOW_H
Original file line number Diff line number Diff line change
Expand Up @@ -640,4 +640,12 @@ namespace GameInteractionEffect {
void SlipperyFloor::_Remove() {
GameInteractor::State::SlipperyFloorActive = 0;
}

// MARK: - ChaosVote
GameInteractionEffectQueryResult ChaosVote::CanBeApplied() {
return GameInteractionEffectQueryResult::Possible;
}
void ChaosVote::_Apply() {
GameInteractor::State::ChaosVotes[this->voterName] = this->vote;
}
}
11 changes: 11 additions & 0 deletions soh/soh/Enhancements/game-interactor/GameInteractionEffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <stdint.h>

#ifdef __cplusplus
#include <string>

enum GameInteractionEffectQueryResult {
Possible = 0x00,
TemporarilyNotPossible = 0x01,
Expand Down Expand Up @@ -262,6 +264,15 @@ namespace GameInteractionEffect {
void _Apply() override;
void _Remove() override;
};

class ChaosVote: public GameInteractionEffectBase, public ParameterizedGameInteractionEffect {
GameInteractionEffectQueryResult CanBeApplied() override;
void _Apply() override;

public:
std::string voterName;
int32_t vote;
};
}

#endif /* __cplusplus */
Expand Down
3 changes: 3 additions & 0 deletions soh/soh/Enhancements/game-interactor/GameInteractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ typedef enum {
/* */ GI_TP_DEST_REQUIEM = ENTR_DESERT_COLOSSUS_5,
/* */ GI_TP_DEST_NOCTURNE = ENTR_GRAVEYARD_7,
/* */ GI_TP_DEST_PRELUDE = ENTR_TEMPLE_OF_TIME_7,
/* */ GI_TP_DEST_JAILCELL = ENTR_GERUDOS_FORTRESS_17,
} GITeleportDestinations;

#ifdef __cplusplus
Expand Down Expand Up @@ -139,6 +140,7 @@ class GameInteractor {
static uint8_t SecondCollisionUpdate;
static uint8_t TriforceHuntPieceGiven;
static uint8_t TriforceHuntCreditsWarpActive;
static std::map<std::string, uint32_t> ChaosVotes;

static void SetPacifistMode(bool active);
};
Expand Down Expand Up @@ -212,6 +214,7 @@ class GameInteractor {
DEFINE_HOOK(OnPlayerBonk, void());
DEFINE_HOOK(OnPlayDestroy, void());
DEFINE_HOOK(OnPlayDrawEnd, void());
DEFINE_HOOK(OnPlayerHealthChange, void(int16_t amount));

DEFINE_HOOK(OnSaveFile, void(int32_t fileNum));
DEFINE_HOOK(OnLoadFile, void(int32_t fileNum));
Expand Down
4 changes: 4 additions & 0 deletions soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ void GameInteractor_ExecuteOnPlayDrawEnd() {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnPlayDrawEnd>();
}

void GameInteractor_ExecuteOnPlayerHealthChange(int16_t amount) {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnPlayerHealthChange>(amount);
}

// MARK: - Save Files

void GameInteractor_ExecuteOnSaveFile(int32_t fileNum) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ void GameInteractor_ExecuteOnOcarinaSongAction();
void GameInteractor_ExecuteOnShopSlotChangeHooks(uint8_t cursorIndex, int16_t price);
void GameInteractor_ExecuteOnPlayDestroy();
void GameInteractor_ExecuteOnPlayDrawEnd();
void GameInteractor_ExecuteOnPlayerHealthChange(int16_t amount);

// MARK: - Save Files
void GameInteractor_ExecuteOnSaveFile(int32_t fileNum);
Expand Down
6 changes: 6 additions & 0 deletions soh/soh/Enhancements/game-interactor/GameInteractor_Sail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,12 @@ GameInteractionEffectBase* GameInteractorSail::EffectFromJson(nlohmann::json pay
return new GameInteractionEffect::PlayerInvincibility();
} else if (name == "SlipperyFloor") {
return new GameInteractionEffect::SlipperyFloor();
} else if (name == "ChaosVote") {
auto effect = new GameInteractionEffect::ChaosVote();
effect->vote = payload["parameters"][0].get<int32_t>();
effect->voterName = payload["parameters"][1].get<std::string>();

return effect;
} else {
SPDLOG_INFO("[GameInteractorSail] Unknown effect name: {}", name);
return nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ uint8_t GameInteractor::State::SlipperyFloorActive = 0;
uint8_t GameInteractor::State::SecondCollisionUpdate = 0;
uint8_t GameInteractor::State::TriforceHuntPieceGiven = 0;
uint8_t GameInteractor::State::TriforceHuntCreditsWarpActive = 0;
std::map<std::string, uint32_t> GameInteractor::State::ChaosVotes = {};

void GameInteractor::State::SetPacifistMode(bool active) {
PacifistModeActive = active;
Expand Down
2 changes: 2 additions & 0 deletions soh/soh/OTRGlobals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
#include "util.h"
#include <boost_custom/container_hash/hash_32.hpp>

#include "Enhancements/chaos-mode/ChaosWindow.h"

#if not defined (__SWITCH__) && not defined(__WIIU__)
#include "Extractor/Extract.h"
#endif
Expand Down
7 changes: 7 additions & 0 deletions soh/soh/SohGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ namespace SohGui {
std::shared_ptr<AdvancedResolutionSettings::AdvancedResolutionSettingsWindow> mAdvancedResolutionSettingsWindow;
std::shared_ptr<SohModalWindow> mModalWindow;

std::shared_ptr<ChaosWindow> mChaosWindow;

void SetupGuiElements() {
auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui();

Expand Down Expand Up @@ -203,6 +205,9 @@ namespace SohGui {
mModalWindow = std::make_shared<SohModalWindow>(CVAR_WINDOW("ModalWindow"), "Modal Window");
gui->AddGuiWindow(mModalWindow);
mModalWindow->Show();

mChaosWindow = std::make_shared<ChaosWindow>(CVAR_WINDOW("Chaos"), "Chaos Tracker");
gui->AddGuiWindow(mChaosWindow);
}

void Destroy() {
Expand Down Expand Up @@ -232,6 +237,8 @@ namespace SohGui {
mSohMenuBar = nullptr;
mInputViewer = nullptr;
mInputViewerSettings = nullptr;

mChaosWindow = nullptr;
}

void RegisterPopup(std::string title, std::string message, std::string button1, std::string button2, std::function<void()> button1callback, std::function<void()> button2callback) {
Expand Down
2 changes: 2 additions & 0 deletions soh/soh/SohGui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include "Enhancements/randomizer/randomizer_settings_window.h"
#include "SohModals.h"

#include "Enhancements/chaos-mode/ChaosWindow.h"

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
17 changes: 15 additions & 2 deletions soh/soh/SohMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
#include "Enhancements/randomizer/randomizer_settings_window.h"
#include "Enhancements/resolution-editor/ResolutionEditor.h"

#include "Enhancements/chaos-mode/ChaosWindow.h"

extern bool isBetaQuestEnabled;

extern "C" PlayState* gPlayState;
Expand Down Expand Up @@ -411,9 +413,10 @@ void DrawSettingsMenu() {
#else
bool matchingRefreshRate =
CVarGetInteger(CVAR_SETTING("MatchRefreshRate"), 0) && Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() != Ship::WindowBackend::FAST3D_DXGI_DX11;
UIWidgets::PaddedEnhancementSliderInt(
if (UIWidgets::PaddedEnhancementSliderInt(
(currentFps == 20) ? "Frame Rate: Original (20 fps)" : "Frame Rate: %d fps",
"##FPSInterpolation", CVAR_SETTING("InterpolationFPS"), minFps, maxFps, "", 20, true, true, false, matchingRefreshRate);
"##FPSInterpolation", CVAR_SETTING("InterpolationFPS"), minFps, maxFps, "", 20, true, true, false, matchingRefreshRate)) {
}
#endif
if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == Ship::WindowBackend::FAST3D_DXGI_DX11) {
UIWidgets::Tooltip(
Expand Down Expand Up @@ -552,6 +555,8 @@ extern std::shared_ptr<AudioEditor> mAudioEditorWindow;
extern std::shared_ptr<CosmeticsEditorWindow> mCosmeticsEditorWindow;
extern std::shared_ptr<GameplayStatsWindow> mGameplayStatsWindow;

extern std::shared_ptr<ChaosWindow> mChaosWindow;

void DrawEnhancementsMenu() {
if (ImGui::BeginMenu("Enhancements"))
{
Expand Down Expand Up @@ -1419,6 +1424,14 @@ void DrawEnhancementsMenu() {
"- Each Heart Container or full Heart Piece reduces Links hearts by 1.\n"
"- Can be enabled retroactively after a File has already started.");

if (mChaosWindow) {
if (ImGui::Button(
GetWindowButtonText("Chaos Tracker", CVarGetInteger(CVAR_WINDOW("Chaos"), 0)).c_str(),
ImVec2(-1.0f, 0.0f))) {
mChaosWindow->ToggleVisibility();
}
}

ImGui::EndMenu();
}

Expand Down
1 change: 1 addition & 0 deletions soh/src/code/z_parameter.c
Original file line number Diff line number Diff line change
Expand Up @@ -3154,6 +3154,7 @@ s32 Health_ChangeBy(PlayState* play, s16 healthChange) {
if (healthChange < 0) {
gSaveContext.sohStats.count[COUNT_DAMAGE_TAKEN] += -healthChange;
}
GameInteractor_ExecuteOnPlayerHealthChange(healthChange);

// If one-hit ko mode is on, any damage kills you and you cannot gain health.
if (GameInteractor_OneHitKOActive()) {
Expand Down
14 changes: 9 additions & 5 deletions soh/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ void func_808805C0(BgHakaTrap* this, PlayState* play) {
}

if (this->timer == 20) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_GUILLOTINE_UP);
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_GUILLOTINE_UP);
}
}

Expand Down Expand Up @@ -413,10 +413,14 @@ void func_808808F4(BgHakaTrap* this, PlayState* play) {
}

if (this->timer == 0) {
this->timer = 30;
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y;
this->dyna.actor.velocity.y = 0.5f;
this->actionFunc = func_808806BC;
if (CVarGetInteger(CVAR_ENHANCEMENT("EnableChaosMode"), 0) == 1) {
Actor_Kill(this);
} else {
this->timer = 30;
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y;
this->dyna.actor.velocity.y = 0.5f;
this->actionFunc = func_808806BC;
}
}
}

Expand Down
Loading