mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-17 13:24:45 +00:00
ovl_En_Door (#402)
* Decompiled, two non-matchings remaining * Fix merge * Cleanups * Some documentation, remove unused asm * Remove unused data.s, review suggestions * Ran formatter, further review suggestions * Make some data static * Match EnDoor_Init * Remove asm for EnDoor_Init * Changes from review Co-authored-by: petrie911 <69443847+petrie911@users.noreply.github.com> * More variables static, remove unnecessary s8 cast * PR Suggestions * review Co-authored-by: petrie911 <69443847+petrie911@users.noreply.github.com> Co-authored-by: fig <fig02srl@gmail.com>
This commit is contained in:
parent
cbb0c6da06
commit
579b87dceb
23 changed files with 388 additions and 802 deletions
|
@ -3499,7 +3499,7 @@ struct_801160DC D_801160DC[] = {
|
|||
{ 0.64000005f, 8500.0f, 8000.0f, 1.75f, 0.1f, 0x050011F0, 0x05001100 },
|
||||
};
|
||||
|
||||
void func_80033F54(GlobalContext* globalCtx, s32 arg1, s32 arg2) {
|
||||
void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type) {
|
||||
struct_801160DC* entry;
|
||||
s32 i;
|
||||
MtxF spB0;
|
||||
|
@ -3508,7 +3508,7 @@ void func_80033F54(GlobalContext* globalCtx, s32 arg1, s32 arg2) {
|
|||
f32 temp2;
|
||||
f32 temp3;
|
||||
|
||||
entry = &D_801160DC[arg2];
|
||||
entry = &D_801160DC[type];
|
||||
var = entry->unk_10;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 8265);
|
||||
|
@ -3516,8 +3516,8 @@ void func_80033F54(GlobalContext* globalCtx, s32 arg1, s32 arg2) {
|
|||
Matrix_Translate(0.0f, entry->unk_08, 500.0f, MTXMODE_APPLY);
|
||||
Matrix_Get(&spB0);
|
||||
|
||||
temp1 = sinf(entry->unk_00 - var) * -(10 - arg1) * 0.1f * entry->unk_04;
|
||||
temp2 = cosf(entry->unk_00 - var) * (10 - arg1) * 0.1f * entry->unk_04;
|
||||
temp1 = sinf(entry->unk_00 - var) * -(10 - frame) * 0.1f * entry->unk_04;
|
||||
temp2 = cosf(entry->unk_00 - var) * (10 - frame) * 0.1f * entry->unk_04;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
Matrix_Put(&spB0);
|
||||
|
@ -3542,7 +3542,7 @@ void func_80033F54(GlobalContext* globalCtx, s32 arg1, s32 arg2) {
|
|||
}
|
||||
|
||||
Matrix_Put(&spB0);
|
||||
Matrix_Scale(arg1 * 0.1f, arg1 * 0.1f, arg1 * 0.1f, MTXMODE_APPLY);
|
||||
Matrix_Scale(frame * 0.1f, frame * 0.1f, frame * 0.1f, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 8314),
|
||||
G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
|
|
|
@ -1271,8 +1271,8 @@ s32 func_800A4530(SkelAnime* skelAnime, f32 arg1) {
|
|||
return func_800A4478(skelAnime, arg1, updateRate);
|
||||
}
|
||||
|
||||
void SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg,
|
||||
AnimationHeader* animationSeg, Vec3s* limbDrawTbl, Vec3s* transitionDrawTable, s32 limbCount) {
|
||||
s32 SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg,
|
||||
AnimationHeader* animationSeg, Vec3s* limbDrawTbl, Vec3s* transitionDrawTable, s32 limbCount) {
|
||||
SkeletonHeader* skeletonHeader = SEGMENTED_TO_VIRTUAL(skeletonHeaderSeg);
|
||||
|
||||
skelAnime->limbCount = skeletonHeader->limbCount + 1;
|
||||
|
|
|
@ -159,7 +159,7 @@ void DoorGerudo_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
|||
|
||||
if (this->unk_166 != 0) {
|
||||
Matrix_Scale(0.01f, 0.01f, 0.025f, MTXMODE_APPLY);
|
||||
func_80033F54(globalCtx, this->unk_166, 0);
|
||||
Actor_DrawDoorLock(globalCtx, this->unk_166, 0);
|
||||
}
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_door_gerudo.c", 377);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* File: z_en_door.c
|
||||
* Overlay: ovl_En_Door
|
||||
* Description: Door
|
||||
* Description: Doors with handles
|
||||
*/
|
||||
|
||||
#include "z_en_door.h"
|
||||
|
@ -10,12 +10,25 @@
|
|||
|
||||
#define THIS ((EnDoor*)thisx)
|
||||
|
||||
#define DOOR_AJAR_SLAM_RANGE 120.0f
|
||||
#define DOOR_AJAR_OPEN_RANGE (2 * DOOR_AJAR_SLAM_RANGE)
|
||||
|
||||
#define DOOR_CHECK_RANGE 40.0f
|
||||
|
||||
void EnDoor_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnDoor_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnDoor_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnDoor_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
/*
|
||||
void EnDoor_SetupType(EnDoor* this, GlobalContext* globalCtx);
|
||||
void EnDoor_Idle(EnDoor* this, GlobalContext* globalCtx);
|
||||
void EnDoor_WaitForCheck(EnDoor* this, GlobalContext* globalCtx);
|
||||
void EnDoor_Check(EnDoor* this, GlobalContext* globalCtx);
|
||||
void EnDoor_AjarWait(EnDoor* this, GlobalContext* globalCtx);
|
||||
void EnDoor_AjarOpen(EnDoor* this, GlobalContext* globalCtx);
|
||||
void EnDoor_AjarClose(EnDoor* this, GlobalContext* globalCtx);
|
||||
void EnDoor_Open(EnDoor* this, GlobalContext* globalCtx);
|
||||
|
||||
const ActorInit En_Door_InitVars = {
|
||||
ACTOR_EN_DOOR,
|
||||
ACTORTYPE_DOOR,
|
||||
|
@ -27,29 +40,317 @@ const ActorInit En_Door_InitVars = {
|
|||
(ActorFunc)EnDoor_Update,
|
||||
(ActorFunc)EnDoor_Draw,
|
||||
};
|
||||
*/
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Door/EnDoor_Init.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Door/EnDoor_Destroy.s")
|
||||
/**
|
||||
* Controls which object and display lists to use in a given scene
|
||||
*/
|
||||
static EnDoorInfo sDoorInfo[] = {
|
||||
{ SCENE_HIDAN, 1, OBJECT_HIDAN_OBJECTS },
|
||||
{ SCENE_MIZUSIN, 2, OBJECT_MIZU_OBJECTS },
|
||||
{ SCENE_HAKADAN, 3, OBJECT_HAKA_DOOR },
|
||||
{ SCENE_HAKADANCH, 3, OBJECT_HAKA_DOOR },
|
||||
// KEEP objects should remain last and in this order
|
||||
{ -1, 0, OBJECT_GAMEPLAY_KEEP },
|
||||
{ -1, 4, OBJECT_GAMEPLAY_FIELD_KEEP },
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Door/func_809FC41C.s")
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_U8(unk_1F, 0, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Door/func_809FC5D0.s")
|
||||
AnimationHeader* D_809FCECC[] = { 0x0400E758, 0x0400E5B4, 0x04010038, 0x0400E6A0 };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Door/func_809FC878.s")
|
||||
static u8 sDoorAnimOpenFrames[] = { 25, 25, 25, 25 };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Door/func_809FC8C0.s")
|
||||
static u8 sDoorAnimCloseFrames[] = { 60, 70, 60, 70 };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Door/func_809FC8F4.s")
|
||||
static Gfx* D_809FCEE4[5][2] = {
|
||||
{ 0x0400ECB8, 0x0400EE00 }, { 0x0600F998, 0x0600F938 }, { 0x06004958, 0x06004A10 },
|
||||
{ 0x060013B8, 0x06001420 }, { 0x050047A0, 0x05004978 },
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Door/func_809FC928.s")
|
||||
extern Gfx D_0400ECB8[];
|
||||
extern Gfx D_0400EE00[];
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Door/func_809FC998.s")
|
||||
extern AnimationHeader D_0400E758;
|
||||
extern SkeletonHeader D_0400FF78;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Door/func_809FC9DC.s")
|
||||
void EnDoor_Init(Actor* thisx, GlobalContext* globalCtx2) {
|
||||
GlobalContext* globalCtx = globalCtx2;
|
||||
EnDoor* this = THIS;
|
||||
EnDoorInfo* objectInfo;
|
||||
s32 i;
|
||||
s32 objBankIndex;
|
||||
f32 xOffset;
|
||||
f32 zOffset;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Door/EnDoor_Update.s")
|
||||
objectInfo = &sDoorInfo[0];
|
||||
Actor_ProcessInitChain(&this->actor, sInitChain);
|
||||
SkelAnime_Init(globalCtx, &this->skelAnime, &D_0400FF78, &D_0400E758, this->limbDrawTable,
|
||||
this->transitionDrawTable, 5);
|
||||
for (i = 0; i < ARRAY_COUNT(sDoorInfo) - 2; i++, objectInfo++) {
|
||||
if (globalCtx->sceneNum == objectInfo->sceneNum) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i >= ARRAY_COUNT(sDoorInfo) - 2 && Object_GetIndex(&globalCtx->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP) >= 0) {
|
||||
objectInfo++;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Door/func_809FCC3C.s")
|
||||
this->dListIndex = objectInfo->dListIndex;
|
||||
objBankIndex = Object_GetIndex(&globalCtx->objectCtx, objectInfo->objectId);
|
||||
if (objBankIndex < 0) {
|
||||
Actor_Kill(&this->actor);
|
||||
return;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Door/EnDoor_Draw.s")
|
||||
this->requiredObjBankIndex = objBankIndex;
|
||||
this->dListIndex = objectInfo->dListIndex;
|
||||
if (this->actor.objBankIndex == this->requiredObjBankIndex) {
|
||||
EnDoor_SetupType(this, globalCtx);
|
||||
} else {
|
||||
this->actionFunc = EnDoor_SetupType;
|
||||
}
|
||||
|
||||
// Double doors
|
||||
if (this->actor.params & 0x40) {
|
||||
EnDoor* other;
|
||||
|
||||
xOffset = Math_Coss(this->actor.shape.rot.y) * 30.0f;
|
||||
zOffset = Math_Sins(this->actor.shape.rot.y) * 30.0f;
|
||||
other = (EnDoor*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_DOOR,
|
||||
this->actor.posRot.pos.x + xOffset, this->actor.posRot.pos.y,
|
||||
this->actor.posRot.pos.z - zOffset, 0, this->actor.shape.rot.y + 0x8000, 0,
|
||||
this->actor.params & ~0x40);
|
||||
if (other != NULL) {
|
||||
other->unk_192 = 1;
|
||||
}
|
||||
this->actor.posRot.pos.x -= xOffset;
|
||||
this->actor.posRot.pos.z += zOffset;
|
||||
}
|
||||
Actor_SetHeight(&this->actor, 70.0f);
|
||||
}
|
||||
|
||||
void EnDoor_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
TransitionActorEntry* transitionEntry;
|
||||
EnDoor* this = THIS;
|
||||
|
||||
transitionEntry = &globalCtx->transitionActorList[(u16)this->actor.params >> 0xA];
|
||||
if (transitionEntry->id < 0) {
|
||||
transitionEntry->id = -transitionEntry->id;
|
||||
}
|
||||
}
|
||||
|
||||
void EnDoor_SetupType(EnDoor* this, GlobalContext* globalCtx) {
|
||||
s32 doorType;
|
||||
|
||||
if (Object_IsLoaded(&globalCtx->objectCtx, this->requiredObjBankIndex)) {
|
||||
doorType = this->actor.params >> 7 & 7;
|
||||
this->actor.flags &= ~0x10;
|
||||
this->actor.objBankIndex = this->requiredObjBankIndex;
|
||||
this->actionFunc = EnDoor_Idle;
|
||||
if (doorType == DOOR_EVENING) {
|
||||
doorType =
|
||||
(gSaveContext.dayTime > 0xC000 && gSaveContext.dayTime < 0xE000) ? DOOR_SCENEEXIT : DOOR_CHECKABLE;
|
||||
}
|
||||
this->actor.posRot.rot.y = 0x0000;
|
||||
if (doorType == DOOR_LOCKED) {
|
||||
if (!Flags_GetSwitch(globalCtx, this->actor.params & 0x3F)) {
|
||||
this->lockTimer = 10;
|
||||
}
|
||||
} else if (doorType == DOOR_AJAR) {
|
||||
if (func_8002DB8C(&this->actor, &PLAYER->actor) > DOOR_AJAR_SLAM_RANGE) {
|
||||
this->actionFunc = EnDoor_AjarWait;
|
||||
this->actor.posRot.rot.y = -0x1800;
|
||||
}
|
||||
} else if (doorType == DOOR_CHECKABLE) {
|
||||
this->actor.textId = (this->actor.params & 0x3F) + 0x0200;
|
||||
if (this->actor.textId == 0x0229 && !(gSaveContext.eventChkInf[1] & 0x10)) {
|
||||
// Talon's house door. If Talon has not been woken up at Hyrule Castle
|
||||
// this door should be openable at any time of day. Note that there is no
|
||||
// check for time of day as the scene setup for Lon Lon merely initializes
|
||||
// the door with a different text id between day and night setups
|
||||
doorType = DOOR_SCENEEXIT;
|
||||
} else {
|
||||
this->actionFunc = EnDoor_WaitForCheck;
|
||||
this->actor.flags |= 0x8000009;
|
||||
}
|
||||
}
|
||||
// Replace the door type it was loaded with by the new type
|
||||
this->actor.params = (this->actor.params & ~0x380) | (doorType << 7);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// Regalloc only
|
||||
void EnDoor_Idle(EnDoor* this, GlobalContext* globalCtx) {
|
||||
Player* player = PLAYER;
|
||||
s32 doorType;
|
||||
Vec3f sp2C;
|
||||
s8 numKeys;
|
||||
s16 phi_v0;
|
||||
s16 temp_v0;
|
||||
|
||||
doorType = this->actor.params >> 7 & 7;
|
||||
func_8002DBD0(&this->actor, &sp2C, &player->actor.posRot.pos);
|
||||
if (this->unk_191 != 0) {
|
||||
this->actionFunc = EnDoor_Open;
|
||||
SkelAnime_ChangeAnimPlaybackStop(&this->skelAnime, D_809FCECC[this->unk_190],
|
||||
(player->stateFlags1 & 0x8000000) ? 0.75f : 1.5f);
|
||||
if (this->lockTimer != 0) {
|
||||
gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex]--;
|
||||
Flags_SetSwitch(globalCtx, this->actor.params & 0x3F);
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EV_CHAIN_KEY_UNLOCK);
|
||||
}
|
||||
} else if (!Player_InCsMode(globalCtx)) {
|
||||
if (fabsf(sp2C.y) < 20.0f && fabsf(sp2C.x) < 20.0f && fabsf(sp2C.z) < 50.0f) {
|
||||
phi_v0 = player->actor.shape.rot.y - this->actor.shape.rot.y;
|
||||
if (sp2C.z > 0.0f) {
|
||||
phi_v0 = 0x8000 - phi_v0;
|
||||
}
|
||||
if (ABS(phi_v0) < 0x3000) {
|
||||
if (this->lockTimer != 0) {
|
||||
numKeys = gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex];
|
||||
if (numKeys <= 0) {
|
||||
PLAYER->naviTextId = -0x203;
|
||||
return;
|
||||
} else {
|
||||
player->doorTimer = 10;
|
||||
}
|
||||
}
|
||||
player->doorType = (doorType == DOOR_AJAR) ? -1 : 1;
|
||||
player->doorDirection = (sp2C.z >= 0.0f) ? 1.0f : -1.0f;
|
||||
player->doorActor = &this->actor;
|
||||
}
|
||||
} else if (doorType == DOOR_AJAR && this->actor.xzDistFromLink > DOOR_AJAR_OPEN_RANGE) {
|
||||
this->actionFunc = EnDoor_AjarOpen;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Door/EnDoor_Idle.s")
|
||||
#endif
|
||||
|
||||
void EnDoor_WaitForCheck(EnDoor* this, GlobalContext* globalCtx) {
|
||||
if (func_8002F194(&this->actor, globalCtx)) {
|
||||
this->actionFunc = EnDoor_Check;
|
||||
} else {
|
||||
func_8002F2CC(&this->actor, globalCtx, DOOR_CHECK_RANGE);
|
||||
}
|
||||
}
|
||||
|
||||
void EnDoor_Check(EnDoor* this, GlobalContext* globalCtx) {
|
||||
if (func_8002F334(&this->actor, globalCtx)) {
|
||||
this->actionFunc = EnDoor_WaitForCheck;
|
||||
}
|
||||
}
|
||||
|
||||
void EnDoor_AjarWait(EnDoor* this, GlobalContext* globalCtx) {
|
||||
if (this->actor.xzDistFromLink < DOOR_AJAR_SLAM_RANGE) {
|
||||
this->actionFunc = EnDoor_AjarClose;
|
||||
}
|
||||
}
|
||||
|
||||
void EnDoor_AjarOpen(EnDoor* this, GlobalContext* globalCtx) {
|
||||
if (this->actor.xzDistFromLink < DOOR_AJAR_SLAM_RANGE) {
|
||||
this->actionFunc = EnDoor_AjarClose;
|
||||
} else if (Math_ApproxUpdateScaledS(&this->actor.posRot.rot.y, -0x1800, 0x100)) {
|
||||
this->actionFunc = EnDoor_AjarWait;
|
||||
}
|
||||
}
|
||||
|
||||
void EnDoor_AjarClose(EnDoor* this, GlobalContext* globalCtx) {
|
||||
if (Math_ApproxUpdateScaledS(&this->actor.posRot.rot.y, 0, 0x700)) {
|
||||
this->actionFunc = EnDoor_Idle;
|
||||
}
|
||||
}
|
||||
|
||||
void EnDoor_Open(EnDoor* this, GlobalContext* globalCtx) {
|
||||
s32 i;
|
||||
s32 numEffects;
|
||||
|
||||
if (DECR(this->lockTimer) == 0) {
|
||||
if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
|
||||
this->actionFunc = EnDoor_Idle;
|
||||
this->unk_191 = 0;
|
||||
} else if (func_800A56C8(&this->skelAnime, sDoorAnimOpenFrames[this->unk_190])) {
|
||||
Audio_PlayActorSound2(&this->actor,
|
||||
(globalCtx->sceneNum == SCENE_HAKADAN || globalCtx->sceneNum == SCENE_HAKADANCH ||
|
||||
globalCtx->sceneNum == SCENE_HIDAN)
|
||||
? NA_SE_EV_IRON_DOOR_OPEN
|
||||
: NA_SE_OC_DOOR_OPEN);
|
||||
if (this->skelAnime.animPlaybackSpeed < 1.5f) {
|
||||
numEffects = (s32)(Math_Rand_ZeroOne() * 30.0f) + 50;
|
||||
for (i = 0; i < numEffects; i++) {
|
||||
EffectSsBubble_Spawn(globalCtx, &this->actor.posRot.pos, 60.0f, 100.0f, 50.0f, 0.15f);
|
||||
}
|
||||
}
|
||||
} else if (func_800A56C8(&this->skelAnime, sDoorAnimCloseFrames[this->unk_190])) {
|
||||
Audio_PlayActorSound2(&this->actor,
|
||||
(globalCtx->sceneNum == SCENE_HAKADAN || globalCtx->sceneNum == SCENE_HAKADANCH ||
|
||||
globalCtx->sceneNum == SCENE_HIDAN)
|
||||
? NA_SE_EV_IRON_DOOR_CLOSE
|
||||
: NA_SE_EV_DOOR_CLOSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnDoor_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnDoor* this = THIS;
|
||||
this->actionFunc(this, globalCtx);
|
||||
}
|
||||
|
||||
s32 EnDoor_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
|
||||
s32 pad;
|
||||
TransitionActorEntry* transitionEntry;
|
||||
Gfx** temp_a2;
|
||||
s32 pad2;
|
||||
s16 phi_v0_2;
|
||||
s32 phi_v0;
|
||||
EnDoor* this = THIS;
|
||||
|
||||
if (limbIndex == 4) {
|
||||
temp_a2 = D_809FCEE4[this->dListIndex];
|
||||
transitionEntry = &globalCtx->transitionActorList[(u16)this->actor.params >> 0xA];
|
||||
rot->z += this->actor.posRot.rot.y;
|
||||
if ((globalCtx->roomCtx.prevRoom.num >= 0) ||
|
||||
(transitionEntry->sides[0].room == transitionEntry->sides[1].room)) {
|
||||
phi_v0_2 = ((this->actor.shape.rot.y + this->skelAnime.limbDrawTbl[3].z) + rot->z) -
|
||||
Math_Vec3f_Yaw(&globalCtx->view.eye, &this->actor.posRot.pos);
|
||||
*dList = (ABS(phi_v0_2) < 0x4000) ? temp_a2[0] : temp_a2[1];
|
||||
} else {
|
||||
phi_v0 = this->unk_192;
|
||||
if (transitionEntry->sides[0].room != this->actor.room) {
|
||||
phi_v0 ^= 1;
|
||||
}
|
||||
*dList = temp_a2[phi_v0];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void EnDoor_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnDoor* this = THIS;
|
||||
|
||||
if (this->actor.objBankIndex == this->requiredObjBankIndex) {
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_door.c", 910);
|
||||
|
||||
func_80093D18(globalCtx->state.gfxCtx);
|
||||
SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, EnDoor_OverrideLimbDraw,
|
||||
NULL, &this->actor);
|
||||
if (this->actor.posRot.rot.y != 0) {
|
||||
if (1) {}
|
||||
if (this->actor.posRot.rot.y > 0) {
|
||||
gSPDisplayList(POLY_OPA_DISP++, D_0400EE00);
|
||||
} else {
|
||||
gSPDisplayList(POLY_OPA_DISP++, D_0400ECB8);
|
||||
}
|
||||
}
|
||||
if (this->lockTimer != 0) {
|
||||
Actor_DrawDoorLock(globalCtx, this->lockTimer, 0);
|
||||
}
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_door.c", 941);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,14 +4,57 @@
|
|||
#include "ultra64.h"
|
||||
#include "global.h"
|
||||
|
||||
/**
|
||||
* Actor Parameters
|
||||
*
|
||||
* | | | |
|
||||
* | Transition Index | Type | Double Door | Switch Flag OR Text Id - 0x0200
|
||||
* |------------------|-------|-------------|---------------------------------
|
||||
* | 0 0 0 0 0 0 | 0 0 0 | 0 | 0 0 0 0 0 0
|
||||
* | 6 | 3 | 1 | 6
|
||||
* |
|
||||
*
|
||||
* Transition Index 1111110000000000 Set by the actor engine when the door is spawned
|
||||
* Type 0000001110000000
|
||||
* Double Door 0000000001000000
|
||||
* Switch Flag 0000000000111111 For use with the `DOOR_LOCKED` type
|
||||
* Text id - 0x0200 0000000000111111 For use with the `DOOR_CHECKABLE` type
|
||||
*
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s16 sceneNum;
|
||||
/* 0x02 */ u8 dListIndex;
|
||||
/* 0x04 */ s16 objectId;
|
||||
} EnDoorInfo;
|
||||
|
||||
typedef enum {
|
||||
/* 0x00 */ DOOR_ROOMLOAD, // loads rooms
|
||||
/* 0x01 */ DOOR_LOCKED, // small key locked door
|
||||
/* 0x02 */ DOOR_ROOMLOAD2, // loads rooms
|
||||
/* 0x03 */ DOOR_SCENEEXIT, // doesn't load rooms, used for doors paired with scene transition polygons
|
||||
/* 0x04 */ DOOR_AJAR, // open slightly but slams shut if Link gets too close
|
||||
/* 0x05 */ DOOR_CHECKABLE, // doors that display a textbox when interacting
|
||||
/* 0x06 */ DOOR_EVENING, // unlocked between 18:00 and 21:00, Dampé's hut
|
||||
/* 0x07 */ DOOR_ROOMLOAD7 // loads rooms
|
||||
} EnDoorType;
|
||||
|
||||
struct EnDoor;
|
||||
|
||||
typedef void (*EnDoorActionFunc)(struct EnDoor*, GlobalContext*);
|
||||
|
||||
typedef struct EnDoor {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ char unk_14C[0x44];
|
||||
/* 0x014C */ SkelAnime skelAnime;
|
||||
/* 0x0190 */ u8 unk_190;
|
||||
/* 0x0191 */ u8 unk_191;
|
||||
/* 0x0192 */ char unk_192[0x46];
|
||||
/* 0x0192 */ u8 unk_192;
|
||||
/* 0x0193 */ s8 requiredObjBankIndex;
|
||||
/* 0x0194 */ s8 dListIndex;
|
||||
/* 0x0196 */ s16 lockTimer;
|
||||
/* 0x0198 */ Vec3s limbDrawTable[5];
|
||||
/* 0x01B6 */ Vec3s transitionDrawTable[5];
|
||||
/* 0x01D4 */ EnDoorActionFunc actionFunc;
|
||||
} EnDoor; // size = 0x01D8
|
||||
|
||||
extern const ActorInit En_Door_InitVars;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue