Skip to content

Commit

Permalink
initial commit of relevant files
Browse files Browse the repository at this point in the history
  • Loading branch information
Mothstery committed May 31, 2024
1 parent e484e0b commit ff8082e
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 1 deletion.
7 changes: 7 additions & 0 deletions mm/2s2h/BenGui/BenMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,13 @@ void DrawEnhancementsMenu() {
ImGui::EndMenu();
}

if (UIWidgets::BeginMenu("Songs/Playback")) {
UIWidgets::CVarSliderInt("Zora Eggs For Bossa Nova", "gEnhancements.Songs.ZoraEggCount", 1, 7, 7,
{ .tooltip = "The number of eggs required to unlock new wave bossa nova." });

ImGui::EndMenu();
}

if (mHudEditorWindow) {
UIWidgets::WindowButton("Hud Editor", "gWindows.HudEditor", mHudEditorWindow,
{ .tooltip = "Enables the Hud Editor window, allowing you to edit your hud" });
Expand Down
1 change: 1 addition & 0 deletions mm/2s2h/Enhancements/Enhancements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ void InitEnhancements() {

// Songs
RegisterEnableSunsSong();
RegisterZoraEggCount();

// Restorations
RegisterPowerCrouchStab();
Expand Down
1 change: 1 addition & 0 deletions mm/2s2h/Enhancements/Enhancements.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "Graphics/PlayAsKafei.h"
#include "PlayerMovement/ClimbSpeed.h"
#include "Songs/EnableSunsSong.h"
#include "Songs/ZoraEggCount.h"
#include "Saving/SavingEnhancements.h"

enum AlwaysWinDoggyRaceOptions {
Expand Down
1 change: 1 addition & 0 deletions mm/2s2h/Enhancements/GameInteractor/GameInteractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ typedef enum {
GI_VB_TATL_INTERUPT_MSG6,
GI_VB_ITEM_BE_RESTRICTED,
GI_VB_FLIP_HOP_VARIABLE,
GI_VB_SET_ZORA_EGG_COUNT,
} GIVanillaBehavior;

typedef enum {
Expand Down
14 changes: 14 additions & 0 deletions mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "ZoraEggCount.h"
#include <libultraship/bridge.h>
#include "Enhancements/GameInteractor/GameInteractor.h"

void RegisterZoraEggCount() {
REGISTER_VB_SHOULD(GI_VB_SET_ZORA_EGG_COUNT, {
if (CVarGetInteger("gEnhancements.Songs.ZoraEggCount", 7) > 7 ||
CVarGetInteger("gEnhancements.Songs.ZoraEggCount", 7) < 1) {
CVarSetInteger("gEnhancements.Songs.ZoraEggCount", 7);
}
s32* count = static_cast<int*>(opt);
*count = CVarGetInteger("gEnhancements.Songs.ZoraEggCount", 7);
});
}
6 changes: 6 additions & 0 deletions mm/2s2h/Enhancements/Songs/ZoraEggCount.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef VARIABLE_ZORA_EGG_COUNT_H
#define VARIABLE_ZORA_EGG_COUNT_H

void RegisterZoraEggCount();

#endif // VARIABLE_ZORA_EGG_COUNT_H
9 changes: 8 additions & 1 deletion mm/src/overlays/actors/ovl_En_Mk/z_en_mk.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include "z_en_mk.h"

#include "2s2h/Enhancements/GameInteractor/GameInteractor.h"

#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10)

#define THIS ((EnMk*)thisx)
Expand Down Expand Up @@ -120,7 +122,12 @@ void EnMk_Destroy(Actor* thisx, PlayState* play) {
}

s32 func_80959524(PlayState* play) {
return gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 & 7;
s32 eggcount;
if (GameInteractor_Should(GI_VB_SET_ZORA_EGG_COUNT, true, &eggcount)) {
return gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 + (7 - eggcount) & 7;
} else {
return gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 & 7;
}
}

void func_8095954C(EnMk* this, PlayState* play) {
Expand Down
9 changes: 9 additions & 0 deletions mm/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "z_en_zoraegg.h"
#include "objects/gameplay_keep/gameplay_keep.h"

#include "2s2h/Enhancements/GameInteractor/GameInteractor.h"

#define FLAGS (ACTOR_FLAG_10)

#define THIS ((EnZoraegg*)thisx)
Expand Down Expand Up @@ -400,6 +402,7 @@ void func_80B322BC(EnZoraegg* this, PlayState* play) {

void func_80B32390(EnZoraegg* this, PlayState* play) {
s32 pad;
s32 eggcount;
Player* player = GET_PLAYER(play);

if (CutsceneManager_IsNext(this->actor.csId)) {
Expand All @@ -410,6 +413,12 @@ void func_80B32390(EnZoraegg* this, PlayState* play) {
SET_EVENTINF(EVENTINF_33);
Actor_Kill(&this->actor);
}
} else if (GameInteractor_Should(GI_VB_SET_ZORA_EGG_COUNT, true, &eggcount) &&
(func_80B319A8(play) >= eggcount) &&
(fabsf(player->actor.world.pos.x - this->actor.world.pos.x) < (100.0f * this->actor.scale.x)) &&
(fabsf(player->actor.world.pos.z - this->actor.world.pos.z) < (100.0f * this->actor.scale.z)) &&
(fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 30.0f)) {
CutsceneManager_Queue(this->actor.csId);
} else if ((func_80B319A8(play) >= 7) &&
(fabsf(player->actor.world.pos.x - this->actor.world.pos.x) < (100.0f * this->actor.scale.x)) &&
(fabsf(player->actor.world.pos.z - this->actor.world.pos.z) < (100.0f * this->actor.scale.z)) &&
Expand Down

0 comments on commit ff8082e

Please sign in to comment.