Fix skeleton key (#4296)

This commit is contained in:
Pepe20129 2024-08-18 05:45:10 +02:00 committed by GitHub
parent 07babaa17b
commit b6554a8409
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 11 deletions

View File

@ -32,6 +32,7 @@
#include "src/overlays/actors/ovl_Fishing/z_fishing.h"
#include "src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h"
#include "src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h"
#include "src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.h"
#include "src/overlays/actors/ovl_En_Door/z_en_door.h"
#include "objects/object_link_boy/object_link_boy.h"
#include "objects/object_link_child/object_link_child.h"
@ -1754,11 +1755,12 @@ void RegisterRandomizerCompasses() {
});
}
extern "C" void func_8099485C(DoorGerudo* gerudoDoor, PlayState* play);
void RegisterSkeletonKey() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnActorUpdate>([](void* refActor) {
Actor* actor = static_cast<Actor*>(refActor);
if (Flags_GetRandomizerInf(RAND_INF_HAS_SKELETON_KEY)) {
Actor* actor = static_cast<Actor*>(refActor);
if (actor->id == ACTOR_EN_DOOR) {
EnDoor* door = (EnDoor*)actor;
door->lockTimer = 0;
@ -1767,6 +1769,10 @@ void RegisterSkeletonKey() {
if (shutterDoor->doorType == SHUTTER_KEY_LOCKED) {
shutterDoor->unk_16E = 0;
}
} else if (actor->id == ACTOR_DOOR_GERUDO) {
DoorGerudo* gerudoDoor = (DoorGerudo*)actor;
gerudoDoor->actionFunc = func_8099485C;
gerudoDoor->dyna.actor.world.pos.y = gerudoDoor->dyna.actor.home.pos.y + 200.0f;
}
}
});

View File

@ -563,7 +563,7 @@ Color_RGBA8 GetSkeletonKeyColor() {
return color;
}
int test = 0;
int skeletonKeyRotation = 0;
extern "C" void Randomizer_DrawSkeletonKey(PlayState* play, GetItemEntry* getItemEntry) {
OPEN_DISPS(play->state.gfxCtx);
@ -572,24 +572,24 @@ extern "C" void Randomizer_DrawSkeletonKey(PlayState* play, GetItemEntry* getIte
Gfx_SetupDL_25Opa(play->state.gfxCtx);
test += 1;
skeletonKeyRotation += 1;
if (test > 40) {
test -= 80;
if (skeletonKeyRotation > 40) {
skeletonKeyRotation -= 80;
}
Matrix_RotateZ(M_PI / 40 * test, MTXMODE_APPLY);
Matrix_RotateY(M_PI / 40 * test, MTXMODE_APPLY);
Matrix_RotateZ(M_PI / 40 * skeletonKeyRotation, MTXMODE_APPLY);
Matrix_RotateY(M_PI / 40 * skeletonKeyRotation, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__),
G_MTX_MODELVIEW | G_MTX_LOAD);
gDPSetGrayscaleColor(POLY_OPA_DISP++, color.r, color.g, color.b, color.a);
gSPGrayscale(POLY_OPA_DISP++, true);
gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gGiSmallKeyDL);
gSPGrayscale(POLY_OPA_DISP++, false);
CLOSE_DISPS(play->state.gfxCtx);
}

View File

@ -382,7 +382,7 @@ void EnDaiku_Jailed(EnDaiku* this, PlayState* play) {
void EnDaiku_WaitFreedom(EnDaiku* this, PlayState* play) {
SkelAnime_Update(&this->skelAnime);
if (Flags_GetSwitch(play, this->actor.params >> 8 & 0x3F)) {
if (Flags_GetSwitch(play, this->actor.params >> 8 & 0x3F) || (IS_RANDO && Flags_GetRandomizerInf(RAND_INF_HAS_SKELETON_KEY))) {
this->actor.flags |= ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY;
EnDaiku_UpdateText(this, play);
}