Skip to content

Commit

Permalink
make master sword invisible and fix ms flag (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
Archez authored Oct 1, 2023
1 parent a0d897f commit c3ecfc8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
5 changes: 5 additions & 0 deletions soh/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ void BgTokiSwd_Draw(Actor* thisx, PlayState* play2) {
BgTokiSwd* this = (BgTokiSwd*)thisx;
s32 pad[3];

// Do not draw the Master Sword in the pedestal if the player has not found it yet
if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_MASTER_SWORD) && !CHECK_OWNED_EQUIP(EQUIP_SWORD, 1)) {
return;
}

OPEN_DISPS(play->state.gfxCtx);

Gfx_SetupDL_25Opa(play->state.gfxCtx);
Expand Down
27 changes: 20 additions & 7 deletions soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ void func_808FD27C(PlayState* play, Vec3f* position, Vec3f* velocity, f32 scale)
}
}

static u8 MSFlag = 0;
static u8 hasFoundMasterSword;

void BossGanon2_Init(Actor* thisx, PlayState* play) {
BossGanon2* this = (BossGanon2*)thisx;
s32 pad;
Expand All @@ -176,8 +177,10 @@ void BossGanon2_Init(Actor* thisx, PlayState* play) {
func_808FD5C4(this, play);
this->actor.naviEnemyId = 0x3E;
this->actor.gravity = 0.0f;
if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_MASTER_SWORD) && CHECK_OWNED_EQUIP(EQUIP_SWORD, 1)){
MSFlag = 1;

hasFoundMasterSword = 1;
if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_MASTER_SWORD) && !CHECK_OWNED_EQUIP(EQUIP_SWORD, 1)) {
hasFoundMasterSword = 0;
}
}

Expand Down Expand Up @@ -2899,6 +2902,11 @@ void func_80905DA8(BossGanon2* this, PlayState* play) {
effect->velocity.y += effect->accel.y;
effect->velocity.z += effect->accel.z;
if (effect->type == 1) {
// Prevent invisible master sword from making spark effect/sound when landing in the ground
// and prevent the player from picking it up if the player has not found the master sword
if (IS_RANDO && !hasFoundMasterSword) {
continue;
}
if (effect->unk_2E == 0) {
effect->unk_38.z += 1.0f;
effect->unk_38.y = (2.0f * M_PI) / 5.0f;
Expand All @@ -2915,10 +2923,10 @@ void func_80905DA8(BossGanon2* this, PlayState* play) {
}
effect->velocity.y = 0.0f;
}
if (((SQ(player->actor.world.pos.x - effect->position.x) + SQ(player->actor.world.pos.z - effect->position.z)) < SQ(25.0f)) &&
(!IS_RANDO || (IS_RANDO && !Randomizer_GetSettingValue(RSK_SHUFFLE_MASTER_SWORD)) || MSFlag )) {
effect->type = 0;
this->csState = 10;
if ((SQ(player->actor.world.pos.x - effect->position.x) +
SQ(player->actor.world.pos.z - effect->position.z)) < SQ(25.0f)) {
effect->type = 0;
this->csState = 10;
}
}
} else if (effect->type == 2) {
Expand Down Expand Up @@ -2959,6 +2967,11 @@ void func_809060E8(PlayState* play) {

for (i = 0; i < 1; i++) {
if (effect->type == 1) {
// Do not draw the master sword in the ground if the player has not found it yet
if (IS_RANDO && !hasFoundMasterSword) {
continue;
}

FrameInterpolation_RecordOpenChild("Ganon 809060E8 0", i);

Vec3f spA0;
Expand Down

0 comments on commit c3ecfc8

Please sign in to comment.