mirror of
https://github.com/zeldaret/mm.git
synced 2026-09-12 20:26:02 -04:00
z_en_box.c, z_demo_tre_lgt.c OK, some object_box documentation (#703)
* All functions attempted, 2 NON_MATCHINGs
* z_en_box OK, more documentation
* format
* en_box cleanups, fix GI item table
* z_demo_tre_lgt OK
* format.sh
* pr suggestions 1
* object_box improvements
* Merge remote-tracking branch 'origin/master' into z_en_box
* Revert "Merge remote-tracking branch 'origin/master' into z_en_box"
This reverts commit 5aacdf26e4.
* more suggested changes
* fix comment
This commit is contained in:
+8
-7
@@ -2003,11 +2003,11 @@ s32 Actor_PickUp(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzRa
|
||||
|
||||
if (!(player->stateFlags1 & 0x3C7080) && Player_GetExplosiveHeld(player) < 0) {
|
||||
if ((actor->xzDistToPlayer <= xzRange) && (fabsf(actor->playerHeightRel) <= fabsf(yRange))) {
|
||||
if (((getItemId == GI_MASK_CIRCUS_LEADER) || (getItemId == GI_PENDANT_OF_MEMORIES) ||
|
||||
(getItemId == GI_DEED_LAND) ||
|
||||
(((player->heldActor != NULL) || (actor == player->targetActor)) &&
|
||||
if ((getItemId == GI_MASK_CIRCUS_LEADER || getItemId == GI_PENDANT_OF_MEMORIES ||
|
||||
getItemId == GI_DEED_LAND ||
|
||||
((player->heldActor != NULL || actor == player->targetActor) &&
|
||||
(getItemId > GI_NONE && getItemId < GI_MAX))) ||
|
||||
(!(player->stateFlags1 & 0x20000800))) {
|
||||
!(player->stateFlags1 & 0x20000800)) {
|
||||
s16 yawDiff = actor->yawTowardsPlayer - player->actor.shape.rot.y;
|
||||
s32 absYawDiff = ABS_ALT(yawDiff);
|
||||
|
||||
@@ -4482,9 +4482,10 @@ void func_800BE5CC(Actor* actor, ColliderJntSph* collider, s32 colliderIndex) {
|
||||
}
|
||||
}
|
||||
|
||||
s32 func_800BE63C(struct EnBox* chest) {
|
||||
if ((chest->unk_1F1 == 5) || (chest->unk_1F1 == 6) || (chest->unk_1F1 == 7) || (chest->unk_1F1 == 8) ||
|
||||
(chest->unk_1F1 == 0xC)) {
|
||||
s32 Actor_IsSmallChest(struct EnBox* chest) {
|
||||
if (chest->type == ENBOX_TYPE_SMALL || chest->type == ENBOX_TYPE_SMALL_INVISIBLE ||
|
||||
chest->type == ENBOX_TYPE_SMALL_ROOM_CLEAR || chest->type == ENBOX_TYPE_SMALL_SWITCH_FLAG_FALL ||
|
||||
chest->type == ENBOX_TYPE_SMALL_SWITCH_FLAG) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
*/
|
||||
|
||||
#include "z_demo_tre_lgt.h"
|
||||
#include "overlays/actors/ovl_En_Box/z_en_box.h"
|
||||
#include "objects/object_box/object_box.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_10)
|
||||
|
||||
@@ -15,7 +17,24 @@ void DemoTreLgt_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void DemoTreLgt_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void DemoTreLgt_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
#if 0
|
||||
void DemoTreLgt_SetupWait(DemoTreLgt* this);
|
||||
|
||||
void DemoTreLgt_Wait(DemoTreLgt* this, GlobalContext* globalCtx);
|
||||
void DemoTreLgt_SetupAnimate(DemoTreLgt* this, GlobalContext* globalCtx, f32 frame);
|
||||
void DemoTreLgt_Animate(DemoTreLgt* this, GlobalContext* globalCtx);
|
||||
|
||||
typedef struct {
|
||||
f32 unk0;
|
||||
f32 unk4;
|
||||
f32 unk8;
|
||||
f32 unkC;
|
||||
} DemoTreLgtInfo;
|
||||
|
||||
static DemoTreLgtInfo D_808E1490[2] = {
|
||||
{ 1.0f, 136.0f, 190.0f, 40.0f },
|
||||
{ 1.0f, 136.0f, 220.0f, 50.0f },
|
||||
};
|
||||
|
||||
const ActorInit Demo_Tre_Lgt_InitVars = {
|
||||
ACTOR_DEMO_TRE_LGT,
|
||||
ACTORCAT_ITEMACTION,
|
||||
@@ -28,24 +47,126 @@ const ActorInit Demo_Tre_Lgt_InitVars = {
|
||||
(ActorFunc)DemoTreLgt_Draw,
|
||||
};
|
||||
|
||||
#endif
|
||||
static TransformUpdateIndex* sBoxLightAnimations[] = {
|
||||
&gBoxLightAdultCurveAnim,
|
||||
&gBoxLightChildCurveAnim,
|
||||
};
|
||||
|
||||
extern UNK_TYPE D_06007D78;
|
||||
static DemoTreLgtActionFunc sActionFuncs[] = {
|
||||
DemoTreLgt_Wait,
|
||||
DemoTreLgt_Animate,
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Tre_Lgt/DemoTreLgt_Init.s")
|
||||
void DemoTreLgt_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
DemoTreLgt* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Tre_Lgt/DemoTreLgt_Destroy.s")
|
||||
SkelCurve_Init(globalCtx, &this->skelCurve, &gBoxLightCurveSkel, sBoxLightAnimations[0]);
|
||||
this->colorAlpha1 = 255;
|
||||
this->colorAlpha2 = 255;
|
||||
this->status = 0;
|
||||
//! @bug Zora Link should also use animationType 0
|
||||
if (gSaveContext.save.playerForm == PLAYER_FORM_FIERCE_DEITY) {
|
||||
this->animationType = 0;
|
||||
} else {
|
||||
this->animationType = 1;
|
||||
}
|
||||
DemoTreLgt_SetupWait(this);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Tre_Lgt/func_808E0EE8.s")
|
||||
void DemoTreLgt_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
DemoTreLgt* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Tre_Lgt/func_808E0EF4.s")
|
||||
SkelCurve_Destroy(globalCtx, &this->skelCurve);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Tre_Lgt/func_808E0F4C.s")
|
||||
void DemoTreLgt_SetupWait(DemoTreLgt* this) {
|
||||
this->action = DEMO_TRE_LGT_ACTION_WAIT;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Tre_Lgt/func_808E0FE0.s")
|
||||
void DemoTreLgt_Wait(DemoTreLgt* this, GlobalContext* globalCtx) {
|
||||
EnBox* chest = (EnBox*)this->actor.parent;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Tre_Lgt/DemoTreLgt_Update.s")
|
||||
if (chest != NULL) {
|
||||
if (Animation_OnFrame(&chest->skelAnime, 10.0f)) {
|
||||
DemoTreLgt_SetupAnimate(this, globalCtx, chest->skelAnime.curFrame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Tre_Lgt/func_808E12A4.s")
|
||||
void DemoTreLgt_SetupAnimate(DemoTreLgt* this, GlobalContext* globalCtx, f32 frame) {
|
||||
this->action = DEMO_TRE_LGT_ACTION_ANIMATE;
|
||||
SkelCurve_SetAnim(&this->skelCurve, sBoxLightAnimations[this->animationType], 1.0f,
|
||||
D_808E1490[this->animationType].unk4 + D_808E1490[this->animationType].unk8, frame, 1.0f);
|
||||
SkelCurve_Update(globalCtx, &this->skelCurve);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Tre_Lgt/DemoTreLgt_Draw.s")
|
||||
void DemoTreLgt_Animate(DemoTreLgt* this, GlobalContext* globalCtx) {
|
||||
f32 curFrame = this->skelCurve.animCurFrame;
|
||||
|
||||
if (curFrame < D_808E1490[this->animationType].unk4) {
|
||||
this->colorAlpha1 = 255;
|
||||
} else if (curFrame <= (D_808E1490[this->animationType].unk4 + D_808E1490[this->animationType].unk8)) {
|
||||
this->colorAlpha1 =
|
||||
((D_808E1490[this->animationType].unk4 - curFrame) / D_808E1490[this->animationType].unk8) * 255 + 255;
|
||||
} else {
|
||||
this->colorAlpha1 = 0;
|
||||
}
|
||||
|
||||
if (curFrame < D_808E1490[this->animationType].unkC) {
|
||||
this->colorAlpha2 = 255;
|
||||
} else if (curFrame < (D_808E1490[this->animationType].unkC + 10.0f)) {
|
||||
this->colorAlpha2 = ((D_808E1490[this->animationType].unkC - curFrame) / 10.0f) * 255 + 255;
|
||||
} else {
|
||||
this->colorAlpha2 = 0;
|
||||
}
|
||||
if (curFrame > 30.0f) {
|
||||
if (!(this->status & 1)) {
|
||||
this->status |= 1;
|
||||
Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_TRE_BOX_FLASH);
|
||||
}
|
||||
}
|
||||
if (SkelCurve_Update(globalCtx, &this->skelCurve)) {
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
}
|
||||
}
|
||||
|
||||
void DemoTreLgt_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
DemoTreLgt* this = THIS;
|
||||
|
||||
sActionFuncs[this->action](this, globalCtx);
|
||||
}
|
||||
|
||||
s32 DemoTreLgt_OverrideLimbDraw(GlobalContext* globalCtx, SkelAnimeCurve* skelCuve, s32 limbIndex, Actor* thisx) {
|
||||
s32 pad;
|
||||
DemoTreLgt* this = THIS;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08,
|
||||
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (globalCtx->state.frames * 2) % 256, 0, 64, 32, 1,
|
||||
(globalCtx->state.frames * -2) % 256, 0, 64, 32));
|
||||
|
||||
if (limbIndex == OBJECT_BOX_LIGHT_LIMB_01) {
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 180, this->colorAlpha1);
|
||||
} else if (limbIndex == OBJECT_BOX_LIGHT_LIMB_13 || limbIndex == OBJECT_BOX_LIGHT_LIMB_07 ||
|
||||
limbIndex == OBJECT_BOX_LIGHT_LIMB_04 || limbIndex == OBJECT_BOX_LIGHT_LIMB_10) {
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 180, this->colorAlpha2);
|
||||
}
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void DemoTreLgt_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
|
||||
DemoTreLgt* this = THIS;
|
||||
|
||||
OPEN_DISPS(gfxCtx);
|
||||
if (this->action == DEMO_TRE_LGT_ACTION_ANIMATE) {
|
||||
func_8012C2DC(gfxCtx);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 200, 255, 0, 0);
|
||||
SkelCurve_Draw(&this->actor, globalCtx, &this->skelCurve, DemoTreLgt_OverrideLimbDraw, NULL, 1, &this->actor);
|
||||
}
|
||||
CLOSE_DISPS(gfxCtx);
|
||||
}
|
||||
|
||||
@@ -5,11 +5,23 @@
|
||||
|
||||
struct DemoTreLgt;
|
||||
|
||||
typedef void (*DemoTreLgtActionFunc)(struct DemoTreLgt* this, GlobalContext* globalCtx);
|
||||
|
||||
typedef struct DemoTreLgt {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ char unk_144[0x34];
|
||||
/* 0x144 */ SkelAnimeCurve skelCurve;
|
||||
/* 0x164 */ s32 action;
|
||||
/* 0x168 */ u32 colorAlpha1;
|
||||
/* 0x16C */ u32 colorAlpha2;
|
||||
/* 0x170 */ u8 status;
|
||||
/* 0x174 */ s32 animationType;
|
||||
} DemoTreLgt; // size = 0x178
|
||||
|
||||
typedef enum {
|
||||
/* 0x00 */ DEMO_TRE_LGT_ACTION_WAIT, // wait until animation is needed
|
||||
/* 0x01 */ DEMO_TRE_LGT_ACTION_ANIMATE
|
||||
} DemoTreLgtAction;
|
||||
|
||||
extern const ActorInit Demo_Tre_Lgt_InitVars;
|
||||
|
||||
#endif // Z_DEMO_TRE_LGT_H
|
||||
|
||||
@@ -5,9 +5,39 @@
|
||||
*/
|
||||
|
||||
#include "z_en_box.h"
|
||||
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||
#include "objects/object_box/object_box.h"
|
||||
#include "overlays/actors/ovl_En_Elforg/z_en_elforg.h"
|
||||
|
||||
#define FLAGS 0x00000000
|
||||
|
||||
/*
|
||||
set on init unless treasure flag is set
|
||||
if clear, chest moves (Actor_MoveForward) (falls, likely)
|
||||
ends up cleared from SWITCH_FLAG_FALL types when switch flag is set
|
||||
*/
|
||||
#define ENBOX_MOVE_IMMOBILE (1 << 0)
|
||||
/*
|
||||
set in the logic for SWITCH_FLAG_FALL types
|
||||
otherwise unused
|
||||
*/
|
||||
#define ENBOX_MOVE_UNUSED (1 << 1)
|
||||
/*
|
||||
set with 50% chance on init for SWITCH_FLAG_FALL types
|
||||
only used for SWITCH_FLAG_FALL types
|
||||
ends up "blinking" (set/clear every frame) once switch flag is set,
|
||||
if some collision-related condition (?) is met
|
||||
only used for signum of z rotation
|
||||
*/
|
||||
#define ENBOX_MOVE_FALL_ANGLE_SIDE (1 << 2)
|
||||
/*
|
||||
when set, gets cleared next EnBox_Update call and clip to the floor
|
||||
*/
|
||||
#define ENBOX_MOVE_STICK_TO_GROUND (1 << 4)
|
||||
#define ENBOX_MOVE_0x20 (1 << 5)
|
||||
#define ENBOX_MOVE_0x40 (1 << 6)
|
||||
#define ENBOX_MOVE_0x80 (1 << 7)
|
||||
|
||||
#define THIS ((EnBox*)thisx)
|
||||
|
||||
void EnBox_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
@@ -15,7 +45,17 @@ void EnBox_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnBox_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnBox_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
#if 0
|
||||
void EnBox_FallOnSwitchFlag(EnBox* this, GlobalContext* globalCtx);
|
||||
void EnBox_AppearSwitchFlag(EnBox* this, GlobalContext* globalCtx);
|
||||
void EnBox_AppearOnRoomClear(EnBox* this, GlobalContext* globalCtx);
|
||||
void func_80868AFC(EnBox* this, GlobalContext* globalCtx);
|
||||
void func_80868B74(EnBox* this, GlobalContext* globalCtx);
|
||||
void EnBox_WaitOpen(EnBox* this, GlobalContext* globalCtx);
|
||||
void EnBox_Open(EnBox* this, GlobalContext* globalCtx);
|
||||
|
||||
void func_80867FBC(func_80867BDC_a0* arg0, GlobalContext* globalCtx, s32 arg2);
|
||||
void func_80867FE4(func_80867BDC_a0* arg0, GlobalContext* globalCtx);
|
||||
|
||||
const ActorInit En_Box_InitVars = {
|
||||
ACTOR_EN_BOX,
|
||||
ACTORCAT_CHEST,
|
||||
@@ -28,66 +68,653 @@ const ActorInit En_Box_InitVars = {
|
||||
(ActorFunc)EnBox_Draw,
|
||||
};
|
||||
|
||||
// static InitChainEntry sInitChain[] = {
|
||||
static InitChainEntry D_80869B50[] = {
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_U8(targetMode, 0, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
#endif
|
||||
typedef struct {
|
||||
f32 data[5];
|
||||
} EnBox_PlaybackSpeed; // 0x14
|
||||
|
||||
extern InitChainEntry D_80869B50[];
|
||||
static EnBox_PlaybackSpeed sPlaybackSpeed = { { 1.5f, 1.0f, 1.5f, 1.0f, 1.5f } };
|
||||
|
||||
extern UNK_TYPE D_0600043C;
|
||||
extern UNK_TYPE D_06000DB0;
|
||||
static AnimationHeader* sBigChestAnimations[5] = {
|
||||
&gBoxBigChestOpenAdultAnim, &gBoxBigChestOpenGoronAnim, &gBoxBigChestOpenAdultAnim,
|
||||
&gBoxBigChestOpenDekuAnim, &gBoxBigChestOpenChildAnim,
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/func_80867BD0.s")
|
||||
void EnBox_SetupAction(EnBox* this, EnBoxActionFunc func) {
|
||||
this->actionFunc = func;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/func_80867BDC.s")
|
||||
void func_80867BDC(func_80867BDC_a0* arg0, GlobalContext* globalCtx, Vec3f* pos) {
|
||||
arg0->pos = *pos;
|
||||
arg0->unk_0C = NULL;
|
||||
arg0->unk_10 = NULL;
|
||||
arg0->unk_14 = 0;
|
||||
arg0->unk_18 = 0;
|
||||
arg0->unk_1C = 0;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/func_80867C14.s")
|
||||
void func_80867C14(func_80867BDC_a0* arg0, GlobalContext* globalCtx) {
|
||||
arg0->unk_18++;
|
||||
if (arg0->unk_18 > 85) {
|
||||
arg0->unk_18 = 85;
|
||||
}
|
||||
if (arg0->unk_18 != 85) {
|
||||
arg0->unk_1C = arg0->unk_18 - 28;
|
||||
if (arg0->unk_18 - 28 < 0) {
|
||||
arg0->unk_1C = 0;
|
||||
}
|
||||
} else {
|
||||
arg0->unk_1C++;
|
||||
if (arg0->unk_1C > 85) {
|
||||
func_80867FE4(arg0, globalCtx);
|
||||
}
|
||||
}
|
||||
arg0->unk_14++;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/func_80867C8C.s")
|
||||
void func_80867C8C(func_80867BDC_a0* arg0, GlobalContext* globalCtx) {
|
||||
s32 temp_s6 = arg0->unk_18 - arg0->unk_1C;
|
||||
s32 i;
|
||||
f32 pad;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/func_80867FBC.s")
|
||||
if (temp_s6 > 0) {
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
Matrix_Push();
|
||||
for (i = 0; i < temp_s6; i++) {
|
||||
f32 temp_f0 = (f32)i / temp_s6;
|
||||
s16 temp_s0 = ((f32)arg0->unk_18 - arg0->unk_1C) * temp_f0 + arg0->unk_1C;
|
||||
f32 temp_f24 = 1.0f - (temp_s0 * 0.011764706f);
|
||||
f32 temp_f26 = Rand_ZeroOne() * 0.03f * temp_f0 * temp_f24;
|
||||
f32 temp_f28;
|
||||
f32 temp_f30 = Math_SinS(temp_s0 * 0x9A6) * 45.0f + arg0->pos.x;
|
||||
f32 phi_f24;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/func_80867FE4.s")
|
||||
if (arg0->unk_20 != 0) {
|
||||
phi_f24 = arg0->pos.y - (0.03f * temp_s0) - (0.01f * temp_s0 * temp_s0);
|
||||
} else {
|
||||
phi_f24 = arg0->pos.y + (0.03f * temp_s0) + (0.01f * temp_s0 * temp_s0);
|
||||
}
|
||||
temp_f28 = (Math_CosS(temp_s0 * 0x9A6) * 45.0f) + arg0->pos.z;
|
||||
Matrix_Translate(2.0f * Rand_Centered() + temp_f30, 2.0f * Rand_Centered() + phi_f24,
|
||||
2.0f * Rand_Centered() + temp_f28, MTXMODE_NEW);
|
||||
Matrix_Scale(temp_f26, temp_f26, temp_f26, MTXMODE_APPLY);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, 255);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 255, 150, 0, 255);
|
||||
func_8012C2DC(globalCtx->state.gfxCtx);
|
||||
Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gOwlStatueWhiteFlashDL);
|
||||
}
|
||||
Matrix_Pop();
|
||||
gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/func_8086800C.s")
|
||||
void func_80867FBC(func_80867BDC_a0* arg0, GlobalContext* globalCtx, s32 arg2) {
|
||||
arg0->unk_0C = func_80867C14;
|
||||
arg0->unk_10 = func_80867C8C;
|
||||
arg0->unk_20 = arg2;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/EnBox_Init.s")
|
||||
void func_80867FE4(func_80867BDC_a0* arg0, GlobalContext* globalCtx) {
|
||||
arg0->unk_0C = NULL;
|
||||
arg0->unk_10 = NULL;
|
||||
func_80867BDC(arg0, globalCtx, &arg0->pos);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/EnBox_Destroy.s")
|
||||
void EnBox_ClipToGround(EnBox* this, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
CollisionPoly* poly;
|
||||
s32 bgId;
|
||||
Vec3f pos;
|
||||
f32 floorHeight;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/func_80868630.s")
|
||||
if (!(this->movementFlags & ENBOX_MOVE_0x80)) {
|
||||
pos = this->dyna.actor.world.pos;
|
||||
pos.y += 1.0f;
|
||||
floorHeight = BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &poly, &bgId, &this->dyna.actor, &pos);
|
||||
if (floorHeight != BGCHECK_Y_MIN) {
|
||||
this->dyna.actor.world.pos.y = floorHeight;
|
||||
this->dyna.actor.floorHeight = floorHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/func_80868734.s")
|
||||
void EnBox_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s16 cutsceneIdx;
|
||||
EnBox* this = (EnBox*)thisx;
|
||||
s32 pad;
|
||||
CollisionHeader* colHeader;
|
||||
f32 animFrame;
|
||||
f32 animFrameEnd;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/func_808687E8.s")
|
||||
colHeader = NULL;
|
||||
animFrame = 0.0f;
|
||||
animFrameEnd = Animation_GetLastFrame(&gBoxChestOpenAnim);
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
DynaPolyActor_Init(&this->dyna, 0);
|
||||
CollisionHeader_GetVirtual(&gBoxChestCol, &colHeader);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/func_80868944.s")
|
||||
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
|
||||
this->movementFlags = 0;
|
||||
this->type = ENBOX_GET_TYPE(&this->dyna.actor);
|
||||
this->iceSmokeTimer = 0;
|
||||
this->unk_1F3 = 0;
|
||||
this->dyna.actor.gravity = -5.5f;
|
||||
this->dyna.actor.terminalVelocity = -50.0f;
|
||||
this->switchFlag = ENBOX_GET_SWITCH_FLAG(&this->dyna.actor);
|
||||
this->dyna.actor.floorHeight = this->dyna.actor.world.pos.y;
|
||||
if (this->dyna.actor.world.rot.x == 180) {
|
||||
this->movementFlags |= ENBOX_MOVE_0x80;
|
||||
this->dyna.actor.world.rot.x = 0x7FFF;
|
||||
this->collectableFlag = 0;
|
||||
} else {
|
||||
func_800C636C(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
this->collectableFlag = (this->dyna.actor.world.rot.x & 0x7F);
|
||||
this->dyna.actor.world.rot.x = 0;
|
||||
}
|
||||
thisx->shape.rot.x = this->dyna.actor.world.rot.x;
|
||||
this->getItem = ENBOX_GET_ITEM(thisx);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/func_808689E8.s")
|
||||
if (Flags_GetTreasure(globalCtx, ENBOX_GET_CHEST_FLAG(&this->dyna.actor)) || this->getItem == GI_NONE) {
|
||||
this->alpha = 255;
|
||||
this->iceSmokeTimer = 100;
|
||||
EnBox_SetupAction(this, EnBox_Open);
|
||||
this->movementFlags |= ENBOX_MOVE_STICK_TO_GROUND;
|
||||
animFrame = animFrameEnd;
|
||||
} else if ((this->type == ENBOX_TYPE_BIG_SWITCH_FLAG_FALL || this->type == ENBOX_TYPE_SMALL_SWITCH_FLAG_FALL) &&
|
||||
!Flags_GetSwitch(globalCtx, this->switchFlag)) {
|
||||
func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
if (Rand_ZeroOne() < 0.5f) {
|
||||
this->movementFlags |= ENBOX_MOVE_FALL_ANGLE_SIDE;
|
||||
}
|
||||
this->unk_1A0 = -12;
|
||||
EnBox_SetupAction(this, EnBox_FallOnSwitchFlag);
|
||||
this->alpha = 0;
|
||||
this->movementFlags |= ENBOX_MOVE_IMMOBILE;
|
||||
this->dyna.actor.flags |= ACTOR_FLAG_10;
|
||||
} else if ((this->type == ENBOX_TYPE_BIG_ROOM_CLEAR || this->type == ENBOX_TYPE_SMALL_ROOM_CLEAR) &&
|
||||
!Flags_GetClear(globalCtx, this->dyna.actor.room)) {
|
||||
EnBox_SetupAction(this, EnBox_AppearOnRoomClear);
|
||||
func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
if (this->movementFlags & ENBOX_MOVE_0x80) {
|
||||
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 50.0f;
|
||||
} else {
|
||||
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 50.0f;
|
||||
}
|
||||
this->alpha = 0;
|
||||
this->movementFlags |= ENBOX_MOVE_IMMOBILE;
|
||||
this->dyna.actor.flags |= ACTOR_FLAG_10;
|
||||
} else if (this->type == ENBOX_TYPE_BIG_SONG_ZELDAS_LULLABY || this->type == ENBOX_TYPE_BIG_SONG_SUNS) {
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/func_80868A6C.s")
|
||||
} else if ((this->type == ENBOX_TYPE_BIG_SWITCH_FLAG || this->type == ENBOX_TYPE_SMALL_SWITCH_FLAG) &&
|
||||
!Flags_GetSwitch(globalCtx, this->switchFlag)) {
|
||||
EnBox_SetupAction(this, EnBox_AppearSwitchFlag);
|
||||
func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
if (this->movementFlags & ENBOX_MOVE_0x80) {
|
||||
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 50.0f;
|
||||
} else {
|
||||
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 50.0f;
|
||||
}
|
||||
this->alpha = 0;
|
||||
this->movementFlags |= ENBOX_MOVE_IMMOBILE;
|
||||
this->dyna.actor.flags |= ACTOR_FLAG_10;
|
||||
} else {
|
||||
if (this->type == ENBOX_TYPE_BIG_INVISIBLE || this->type == ENBOX_TYPE_SMALL_INVISIBLE) {
|
||||
this->dyna.actor.flags |= ACTOR_FLAG_80;
|
||||
}
|
||||
EnBox_SetupAction(this, EnBox_WaitOpen);
|
||||
this->movementFlags |= ENBOX_MOVE_IMMOBILE;
|
||||
this->movementFlags |= ENBOX_MOVE_STICK_TO_GROUND;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/func_80868AFC.s")
|
||||
if (this->getItem == GI_STRAY_FAIRY && !Flags_GetTreasure(globalCtx, ENBOX_GET_CHEST_FLAG(&this->dyna.actor))) {
|
||||
this->dyna.actor.flags |= ACTOR_FLAG_10;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/func_80868B74.s")
|
||||
this->dyna.actor.shape.rot.y += 0x8000;
|
||||
this->dyna.actor.home.rot.z = this->dyna.actor.world.rot.z = this->dyna.actor.shape.rot.z = 0;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/func_80868CC8.s")
|
||||
SkelAnime_Init(globalCtx, &this->skelAnime, &gBoxChestSkel, &gBoxChestOpenAnim, this->jointTable, this->morphTable,
|
||||
OBJECT_BOX_CHEST_LIMB_MAX);
|
||||
Animation_Change(&this->skelAnime, &gBoxChestOpenAnim, 1.5f, animFrame, animFrameEnd, ANIMMODE_ONCE, 0.0f);
|
||||
if (Actor_IsSmallChest(this)) {
|
||||
Actor_SetScale(&this->dyna.actor, 0.0075f);
|
||||
Actor_SetFocus(&this->dyna.actor, 20.0f);
|
||||
} else {
|
||||
Actor_SetScale(&this->dyna.actor, 0.01f);
|
||||
Actor_SetFocus(&this->dyna.actor, 40.0f);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/func_80869020.s")
|
||||
this->cutsceneIdxA = -1;
|
||||
this->cutsceneIdxB = -1;
|
||||
cutsceneIdx = this->dyna.actor.cutscene;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/func_808692E0.s")
|
||||
while (cutsceneIdx != -1) {
|
||||
if (func_800F2178(cutsceneIdx) == 1) {
|
||||
this->cutsceneIdxB = cutsceneIdx;
|
||||
} else {
|
||||
this->cutsceneIdxA = cutsceneIdx;
|
||||
}
|
||||
cutsceneIdx = ActorCutscene_GetAdditionalCutscene(cutsceneIdx);
|
||||
}
|
||||
func_80867BDC(&this->unk_1F4, globalCtx, &this->dyna.actor.home.pos);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/EnBox_Update.s")
|
||||
void EnBox_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnBox* this = (EnBox*)thisx;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/func_80869600.s")
|
||||
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/func_80869850.s")
|
||||
void EnBox_RandomDustKinematic(EnBox* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
|
||||
f32 randomRadius = Rand_ZeroOne() * 25.0f;
|
||||
s16 randomAngle = Rand_ZeroOne() * 0x10000;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/func_80869874.s")
|
||||
*pos = this->dyna.actor.world.pos;
|
||||
pos->x += Math_SinS(randomAngle) * randomRadius;
|
||||
pos->z += Math_CosS(randomAngle) * randomRadius;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/func_808698B4.s")
|
||||
velocity->y = 1.0f;
|
||||
velocity->x = Math_SinS(randomAngle);
|
||||
velocity->z = Math_CosS(randomAngle);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Box/EnBox_Draw.s")
|
||||
accel->x = 0.0f;
|
||||
accel->y = 0.0f;
|
||||
accel->z = 0.0f;
|
||||
}
|
||||
|
||||
void EnBox_SpawnDust(EnBox* this, GlobalContext* globalCtx) {
|
||||
s32 i;
|
||||
Vec3f pos;
|
||||
Vec3f velocity;
|
||||
Vec3f accel;
|
||||
|
||||
for (i = 0; i < 20; i++) {
|
||||
EnBox_RandomDustKinematic(this, &pos, &velocity, &accel);
|
||||
func_800B1280(globalCtx, &pos, &velocity, &accel, 100, 30, 15);
|
||||
}
|
||||
}
|
||||
|
||||
void EnBox_Fall(EnBox* this, GlobalContext* globalCtx) {
|
||||
f32 yDiff;
|
||||
|
||||
this->alpha = 255;
|
||||
this->movementFlags &= ~ENBOX_MOVE_IMMOBILE;
|
||||
if (this->dyna.actor.bgCheckFlags & 1) {
|
||||
this->movementFlags |= ENBOX_MOVE_UNUSED;
|
||||
if (this->movementFlags & ENBOX_MOVE_FALL_ANGLE_SIDE) {
|
||||
this->movementFlags &= ~ENBOX_MOVE_FALL_ANGLE_SIDE;
|
||||
} else {
|
||||
this->movementFlags |= ENBOX_MOVE_FALL_ANGLE_SIDE;
|
||||
}
|
||||
if (this->type == ENBOX_TYPE_BIG_SWITCH_FLAG_FALL) {
|
||||
this->dyna.actor.velocity.y = -this->dyna.actor.velocity.y * 0.55f;
|
||||
} else {
|
||||
this->dyna.actor.velocity.y = -this->dyna.actor.velocity.y * 0.65f;
|
||||
}
|
||||
if (this->dyna.actor.velocity.y < 5.5f) {
|
||||
this->dyna.actor.shape.rot.z = 0;
|
||||
this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight;
|
||||
EnBox_SetupAction(this, EnBox_WaitOpen);
|
||||
}
|
||||
Audio_PlaySfxAtPos(&this->dyna.actor.projectedPos, NA_SE_EV_TRE_BOX_BOUND);
|
||||
EnBox_SpawnDust(this, globalCtx);
|
||||
}
|
||||
yDiff = this->dyna.actor.world.pos.y - this->dyna.actor.floorHeight;
|
||||
if (this->movementFlags & ENBOX_MOVE_FALL_ANGLE_SIDE) {
|
||||
this->dyna.actor.shape.rot.z = yDiff * 50.0f;
|
||||
} else {
|
||||
this->dyna.actor.shape.rot.z = -yDiff * 50.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void EnBox_FallOnSwitchFlag(EnBox* this, GlobalContext* globalCtx) {
|
||||
func_800B8C50(&this->dyna.actor, globalCtx);
|
||||
if (this->unk_1A0 >= 0) {
|
||||
EnBox_SetupAction(this, EnBox_Fall);
|
||||
func_800C6314(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
} else if (this->unk_1A0 >= -11) {
|
||||
this->unk_1A0++;
|
||||
} else if (Flags_GetSwitch(globalCtx, this->switchFlag)) {
|
||||
this->unk_1A0++;
|
||||
}
|
||||
}
|
||||
|
||||
void EnBox_AppearSwitchFlag(EnBox* this, GlobalContext* globalCtx) {
|
||||
func_800B8C50(&this->dyna.actor, globalCtx);
|
||||
if (Flags_GetSwitch(globalCtx, this->switchFlag)) {
|
||||
if (ActorCutscene_GetCanPlayNext(this->cutsceneIdxA)) {
|
||||
ActorCutscene_StartAndSetUnkLinkFields(this->cutsceneIdxA, &this->dyna.actor);
|
||||
EnBox_SetupAction(this, func_80868AFC);
|
||||
this->unk_1A0 = -30;
|
||||
} else {
|
||||
ActorCutscene_SetIntentToPlay(this->cutsceneIdxA);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnBox_AppearOnRoomClear(EnBox* this, GlobalContext* globalCtx) {
|
||||
func_800B8C50(&this->dyna.actor, globalCtx);
|
||||
if (Flags_GetClearTemp(globalCtx, this->dyna.actor.room)) {
|
||||
if (ActorCutscene_GetCanPlayNext(this->cutsceneIdxA)) {
|
||||
ActorCutscene_StartAndSetUnkLinkFields(this->cutsceneIdxA, &this->dyna.actor);
|
||||
Flags_SetClear(globalCtx, this->dyna.actor.room);
|
||||
EnBox_SetupAction(this, func_80868AFC);
|
||||
this->unk_1A0 = -30;
|
||||
} else {
|
||||
ActorCutscene_SetIntentToPlay(this->cutsceneIdxA);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_80868AFC(EnBox* this, GlobalContext* globalCtx) {
|
||||
if (func_800F22C4(this->cutsceneIdxA, &this->dyna.actor) != 0 || this->unk_1A0 != 0) {
|
||||
EnBox_SetupAction(this, func_80868B74);
|
||||
this->unk_1A0 = 0;
|
||||
func_80867FBC(&this->unk_1F4, globalCtx, (this->movementFlags & ENBOX_MOVE_0x80) != 0);
|
||||
Audio_PlaySfxAtPos(&this->dyna.actor.projectedPos, NA_SE_EV_TRE_BOX_APPEAR);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80868B74(EnBox* this, GlobalContext* globalCtx) {
|
||||
func_800C6314(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
if (this->unk_1A0 < 0) {
|
||||
this->unk_1A0++;
|
||||
} else if (this->unk_1A0 < 40) {
|
||||
if (this->movementFlags & ENBOX_MOVE_0x80) {
|
||||
this->dyna.actor.world.pos.y -= 1.25f;
|
||||
} else {
|
||||
this->dyna.actor.world.pos.y += 1.25f;
|
||||
}
|
||||
this->unk_1A0++;
|
||||
if (this->cutsceneIdxA != -1 && ActorCutscene_GetCurrentIndex() == this->cutsceneIdxA) {
|
||||
if (this->unk_1A0 == 2) {
|
||||
func_800B724C(globalCtx, &this->dyna.actor, 4);
|
||||
} else if (this->unk_1A0 == 22) {
|
||||
func_800B724C(globalCtx, &this->dyna.actor, 1);
|
||||
}
|
||||
}
|
||||
} else if (this->unk_1A0 < 60) {
|
||||
this->alpha += 12;
|
||||
this->unk_1A0++;
|
||||
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y;
|
||||
} else {
|
||||
EnBox_SetupAction(this, EnBox_WaitOpen);
|
||||
ActorCutscene_Stop(this->dyna.actor.cutscene);
|
||||
}
|
||||
}
|
||||
|
||||
void EnBox_WaitOpen(EnBox* this, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
AnimationHeader* animHeader;
|
||||
f32 frameCount;
|
||||
f32 playbackSpeed;
|
||||
EnBox_PlaybackSpeed playbackSpeedTable;
|
||||
Player* player;
|
||||
Vec3f offset;
|
||||
|
||||
this->alpha = 255;
|
||||
this->movementFlags |= ENBOX_MOVE_IMMOBILE;
|
||||
if (this->unk_1EC != 0 && (this->cutsceneIdxB < 0 || ActorCutscene_GetCurrentIndex() == this->cutsceneIdxB ||
|
||||
ActorCutscene_GetCurrentIndex() == -1)) {
|
||||
if (this->unk_1EC < 0) {
|
||||
animHeader = &gBoxChestOpenAnim;
|
||||
playbackSpeed = 1.5f;
|
||||
} else {
|
||||
u8 playerForm;
|
||||
|
||||
playbackSpeedTable = sPlaybackSpeed;
|
||||
playerForm = gSaveContext.save.playerForm;
|
||||
animHeader = sBigChestAnimations[playerForm];
|
||||
playbackSpeed = playbackSpeedTable.data[playerForm];
|
||||
}
|
||||
|
||||
frameCount = Animation_GetLastFrame(animHeader);
|
||||
Animation_Change(&this->skelAnime, animHeader, playbackSpeed, 0.0f, frameCount, ANIMMODE_ONCE, 0.0f);
|
||||
EnBox_SetupAction(this, EnBox_Open);
|
||||
if (this->unk_1EC > 0) {
|
||||
Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_DEMO_TRE_LGT,
|
||||
this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z,
|
||||
this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z,
|
||||
-1);
|
||||
func_801A3098(0x2B | 0x900);
|
||||
}
|
||||
|
||||
if (this->getItem == GI_STRAY_FAIRY) {
|
||||
this->movementFlags |= ENBOX_MOVE_0x20;
|
||||
} else {
|
||||
if (this->getItem == GI_HEART_PIECE || this->getItem == GI_BOTTLE) {
|
||||
Flags_SetCollectible(globalCtx, this->collectableFlag);
|
||||
}
|
||||
Flags_SetTreasure(globalCtx, ENBOX_GET_CHEST_FLAG(&this->dyna.actor));
|
||||
}
|
||||
} else {
|
||||
player = GET_PLAYER(globalCtx);
|
||||
Actor_OffsetOfPointInActorCoords(&this->dyna.actor, &offset, &player->actor.world.pos);
|
||||
if (offset.z > -50.0f && offset.z < 0.0f && fabsf(offset.y) < 10.0f && fabsf(offset.x) < 20.0f &&
|
||||
Player_IsFacingActor(&this->dyna.actor, 0x3000, globalCtx)) {
|
||||
if ((this->getItem == GI_HEART_PIECE || this->getItem == GI_BOTTLE) &&
|
||||
Flags_GetCollectible(globalCtx, this->collectableFlag)) {
|
||||
this->getItem = GI_RECOVERY_HEART;
|
||||
}
|
||||
if (this->getItem == GI_MASK_CAPTAIN && INV_CONTENT(ITEM_MASK_CAPTAIN) == ITEM_MASK_CAPTAIN) {
|
||||
this->getItem = GI_RECOVERY_HEART;
|
||||
}
|
||||
if (this->getItem == GI_MASK_GIANT && INV_CONTENT(ITEM_MASK_GIANT) == ITEM_MASK_GIANT) {
|
||||
this->getItem = GI_RECOVERY_HEART;
|
||||
}
|
||||
Actor_PickUpNearby(&this->dyna.actor, globalCtx, -this->getItem);
|
||||
}
|
||||
if (Flags_GetTreasure(globalCtx, ENBOX_GET_CHEST_FLAG(&this->dyna.actor))) {
|
||||
EnBox_SetupAction(this, EnBox_Open);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnBox_Open(EnBox* this, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
|
||||
this->dyna.actor.flags &= ~ACTOR_FLAG_80;
|
||||
|
||||
if (SkelAnime_Update(&this->skelAnime)) {
|
||||
if (this->unk_1EC > 0) {
|
||||
if (this->unk_1EC < 120) {
|
||||
this->unk_1EC++;
|
||||
} else {
|
||||
Math_StepToF(&this->unk_1A8, 0.0f, 0.05f);
|
||||
}
|
||||
} else if (this->unk_1EC > -120) {
|
||||
this->unk_1EC--;
|
||||
} else {
|
||||
Math_StepToF(&this->unk_1A8, 0.0f, 0.05f);
|
||||
}
|
||||
if (this->movementFlags & ENBOX_MOVE_0x20) {
|
||||
this->movementFlags &= ~ENBOX_MOVE_0x20;
|
||||
Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_ELFORG,
|
||||
this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z,
|
||||
this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z,
|
||||
((ENBOX_GET_CHEST_FLAG(&this->dyna.actor) & 0x7F) << 9) | STRAY_FAIRY_TYPE_CHEST);
|
||||
} else if (this->movementFlags & ENBOX_MOVE_0x40) {
|
||||
this->movementFlags &= ~ENBOX_MOVE_0x40;
|
||||
}
|
||||
} else {
|
||||
f32 waterSurface;
|
||||
WaterBox* waterBox;
|
||||
s32 bgId;
|
||||
u16 sfxId = 0;
|
||||
|
||||
if (Animation_OnFrame(&this->skelAnime, gSaveContext.save.playerForm == PLAYER_FORM_DEKU ? 14.0f : 30.0f)) {
|
||||
sfxId = NA_SE_EV_TBOX_UNLOCK;
|
||||
} else if (Animation_OnFrame(&this->skelAnime,
|
||||
gSaveContext.save.playerForm == PLAYER_FORM_DEKU ? 15.0f : 90.0f)) {
|
||||
sfxId = NA_SE_EV_TBOX_OPEN;
|
||||
}
|
||||
if (sfxId != 0) {
|
||||
Audio_PlaySfxAtPos(&this->dyna.actor.projectedPos, sfxId);
|
||||
}
|
||||
if (this->skelAnime.jointTable[3].z > 0) {
|
||||
this->unk_1A8 = (0x7D00 - this->skelAnime.jointTable[3].z) * 0.00006f;
|
||||
if (this->unk_1A8 < 0.0f) {
|
||||
this->unk_1A8 = 0.0f;
|
||||
} else if (this->unk_1A8 > 1.0f) {
|
||||
this->unk_1A8 = 1.0f;
|
||||
}
|
||||
}
|
||||
if (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->dyna.actor.world.pos.x,
|
||||
this->dyna.actor.world.pos.z, &waterSurface, &waterBox, &bgId) &&
|
||||
this->dyna.actor.floorHeight < waterSurface) {
|
||||
EffectSsBubble_Spawn(globalCtx, &this->dyna.actor.world.pos, 5.0f, 2.0f, 20.0f, 0.3f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnBox_SpawnIceSmoke(EnBox* this, GlobalContext* globalCtx) {
|
||||
Vec3f pos;
|
||||
Vec3f velocity = { 0, 1.0f, 0 };
|
||||
Vec3f accel = { 0, 0, 0 };
|
||||
f32 randomf;
|
||||
|
||||
this->iceSmokeTimer++;
|
||||
//! @bug sfxId should be NA_SE_EN_MIMICK_BREATH, but uses OoT's sfxId value
|
||||
func_800B9010(&this->dyna.actor, NA_SE_EN_LAST3_COIL_ATTACK_OLD - SFX_FLAG);
|
||||
if (Rand_ZeroOne() < 0.3f) {
|
||||
randomf = 2.0f * Rand_ZeroOne() - 1.0f;
|
||||
pos = this->dyna.actor.world.pos;
|
||||
pos.x += randomf * 20.0f * Math_SinS(this->dyna.actor.world.rot.y + 0x4000);
|
||||
pos.z += randomf * 20.0f * Math_CosS(this->dyna.actor.world.rot.y + 0x4000);
|
||||
|
||||
randomf = 2.0f * Rand_ZeroOne() - 1.0f;
|
||||
velocity.x = randomf * 1.6f * Math_SinS(this->dyna.actor.world.rot.y);
|
||||
velocity.y = 1.8f;
|
||||
velocity.z = randomf * 1.6f * Math_CosS(this->dyna.actor.world.rot.y);
|
||||
EffectSsIceSmoke_Spawn(globalCtx, &pos, &velocity, &accel, 150);
|
||||
}
|
||||
}
|
||||
|
||||
void EnBox_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnBox* this = (EnBox*)thisx;
|
||||
|
||||
if (this->movementFlags & ENBOX_MOVE_STICK_TO_GROUND) {
|
||||
this->movementFlags &= ~ENBOX_MOVE_STICK_TO_GROUND;
|
||||
EnBox_ClipToGround(this, globalCtx);
|
||||
}
|
||||
if (this->getItem == GI_STRAY_FAIRY && !Flags_GetTreasure(globalCtx, ENBOX_GET_CHEST_FLAG(&this->dyna.actor))) {
|
||||
globalCtx->actorCtx.unk5 |= 8;
|
||||
}
|
||||
this->actionFunc(this, globalCtx);
|
||||
if (this->movementFlags & ENBOX_MOVE_0x80) {
|
||||
this->movementFlags |= ENBOX_MOVE_IMMOBILE;
|
||||
}
|
||||
if (!(this->movementFlags & ENBOX_MOVE_IMMOBILE)) {
|
||||
Actor_MoveWithGravity(&this->dyna.actor);
|
||||
Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 0x1C);
|
||||
}
|
||||
Actor_SetFocus(&this->dyna.actor, 40.0f);
|
||||
if (this->getItem == GI_ICE_TRAP && this->actionFunc == EnBox_Open && this->skelAnime.curFrame > 45.0f &&
|
||||
this->iceSmokeTimer < 100) {
|
||||
EnBox_SpawnIceSmoke(this, globalCtx);
|
||||
}
|
||||
if (this->unk_1F4.unk_0C != NULL) {
|
||||
this->unk_1F4.unk_0C(&this->unk_1F4, globalCtx);
|
||||
}
|
||||
}
|
||||
|
||||
void EnBox_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) {
|
||||
EnBox* this = THIS;
|
||||
s32 pad;
|
||||
|
||||
if (limbIndex == OBJECT_BOX_CHEST_LIMB_01) {
|
||||
gSPMatrix((*gfx)++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
if (this->type == ENBOX_TYPE_BIG_ORNATE) {
|
||||
gSPDisplayList((*gfx)++, &gBoxChestBaseOrnateDL);
|
||||
} else if (Actor_IsSmallChest(this)) {
|
||||
if (this->getItem == GI_KEY_SMALL) {
|
||||
gSPDisplayList((*gfx)++, &gBoxChestBaseGildedDL);
|
||||
} else {
|
||||
gSPDisplayList((*gfx)++, &gBoxChestBaseDL);
|
||||
}
|
||||
} else {
|
||||
gSPDisplayList((*gfx)++, &gBoxChestBaseGildedDL);
|
||||
}
|
||||
} else if (limbIndex == OBJECT_BOX_CHEST_LIMB_03) {
|
||||
gSPMatrix((*gfx)++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
if (this->type == ENBOX_TYPE_BIG_ORNATE) {
|
||||
gSPDisplayList((*gfx)++, &gBoxChestLidOrnateDL);
|
||||
} else if (Actor_IsSmallChest(this)) {
|
||||
if (this->getItem == GI_KEY_SMALL) {
|
||||
gSPDisplayList((*gfx)++, &gBoxChestLidGildedDL);
|
||||
} else {
|
||||
gSPDisplayList((*gfx)++, &gBoxChestLidDL);
|
||||
}
|
||||
} else {
|
||||
gSPDisplayList((*gfx)++, &gBoxChestLidGildedDL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Gfx* EnBox_SetRenderMode1(GraphicsContext* gfxCtx) {
|
||||
Gfx* dl = GRAPH_ALLOC(gfxCtx, sizeof(Gfx) * 2);
|
||||
|
||||
gSPEndDisplayList(dl);
|
||||
return dl;
|
||||
}
|
||||
|
||||
Gfx* EnBox_SetRenderMode2(GraphicsContext* gfxCtx) {
|
||||
Gfx* dl = GRAPH_ALLOC(gfxCtx, sizeof(Gfx) * 2);
|
||||
Gfx* cur = dl;
|
||||
|
||||
gDPSetRenderMode(
|
||||
cur++, AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL | G_RM_FOG_SHADE_A,
|
||||
AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL |
|
||||
GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA));
|
||||
|
||||
gSPEndDisplayList(cur++);
|
||||
return dl;
|
||||
}
|
||||
|
||||
Gfx* EnBox_SetRenderMode3(GraphicsContext* gfxCtx) {
|
||||
Gfx* dl = GRAPH_ALLOC(gfxCtx, sizeof(Gfx) * 2);
|
||||
Gfx* cur = dl;
|
||||
|
||||
gDPSetRenderMode(cur++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2);
|
||||
gSPEndDisplayList(cur++);
|
||||
return dl;
|
||||
}
|
||||
|
||||
void EnBox_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnBox* this = (EnBox*)thisx;
|
||||
s32 pad;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
if (this->unk_1F4.unk_10 != NULL) {
|
||||
this->unk_1F4.unk_10(&this->unk_1F4, globalCtx);
|
||||
}
|
||||
if ((this->alpha == 255 && this->type != ENBOX_TYPE_BIG_INVISIBLE && this->type != ENBOX_TYPE_SMALL_INVISIBLE) ||
|
||||
(!CHECK_FLAG_ALL(this->dyna.actor.flags, ACTOR_FLAG_80) &&
|
||||
(this->type == ENBOX_TYPE_BIG_INVISIBLE || this->type == ENBOX_TYPE_SMALL_INVISIBLE))) {
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, EnBox_SetRenderMode1(globalCtx->state.gfxCtx));
|
||||
func_8012C28C(globalCtx->state.gfxCtx);
|
||||
POLY_OPA_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL,
|
||||
EnBox_PostLimbDraw, &this->dyna.actor, POLY_OPA_DISP);
|
||||
} else if (this->alpha != 0) {
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
func_8012C2DC(globalCtx->state.gfxCtx);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha);
|
||||
if (this->type == ENBOX_TYPE_BIG_INVISIBLE || this->type == ENBOX_TYPE_SMALL_INVISIBLE) {
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08, EnBox_SetRenderMode3(globalCtx->state.gfxCtx));
|
||||
} else {
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08, EnBox_SetRenderMode2(globalCtx->state.gfxCtx));
|
||||
}
|
||||
POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL,
|
||||
EnBox_PostLimbDraw, &this->dyna.actor, POLY_XLU_DISP);
|
||||
}
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx);
|
||||
}
|
||||
|
||||
@@ -2,22 +2,68 @@
|
||||
#define Z_EN_BOX_H
|
||||
|
||||
#include "global.h"
|
||||
#include "objects/object_box/object_box.h"
|
||||
|
||||
struct EnBox;
|
||||
struct func_80867BDC_a0;
|
||||
|
||||
typedef void (*EnBoxActionFunc)(struct EnBox*, GlobalContext*);
|
||||
typedef void (*EnBoxUnkFunc)(struct func_80867BDC_a0* arg0, GlobalContext* globalCtx);
|
||||
|
||||
typedef struct func_80867BDC_a0 {
|
||||
/* 0x00 */ Vec3f pos;
|
||||
/* 0x0C */ EnBoxUnkFunc unk_0C;
|
||||
/* 0x10 */ EnBoxUnkFunc unk_10;
|
||||
/* 0x14 */ s32 unk_14;
|
||||
/* 0x18 */ s32 unk_18;
|
||||
/* 0x1C */ s32 unk_1C;
|
||||
/* 0x20 */ s32 unk_20;
|
||||
} func_80867BDC_a0; //size 0x24
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ ENBOX_TYPE_BIG, // big
|
||||
/* 1 */ ENBOX_TYPE_BIG_ROOM_CLEAR, // appear on room clear, store temp clear as permanent clear
|
||||
/* 2 */ ENBOX_TYPE_BIG_ORNATE, // boss key chest
|
||||
/* 3 */ ENBOX_TYPE_BIG_SWITCH_FLAG_FALL, // falling, appear on switch flag set
|
||||
/* 4 */ ENBOX_TYPE_BIG_INVISIBLE, // big, revealed with lens of truth or when opened
|
||||
/* 5 */ ENBOX_TYPE_SMALL, // small
|
||||
/* 6 */ ENBOX_TYPE_SMALL_INVISIBLE, // small, revealed with lens of truth or when opened
|
||||
/* 7 */ ENBOX_TYPE_SMALL_ROOM_CLEAR, // use room clear, store temp clear as perm clear
|
||||
/* 8 */ ENBOX_TYPE_SMALL_SWITCH_FLAG_FALL, // falling, appear on switch flag set
|
||||
/* 9 */ ENBOX_TYPE_BIG_SONG_ZELDAS_LULLABY,// NOT IMPLEMENTED, behaves like big chest
|
||||
/* 10 */ ENBOX_TYPE_BIG_SONG_SUNS, // NOT IMPLEMENTED, behaves like big chest
|
||||
/* 11 */ ENBOX_TYPE_BIG_SWITCH_FLAG, // big, appear on switch flag set
|
||||
/* 12 */ ENBOX_TYPE_SMALL_SWITCH_FLAG // small, appear on switch flag set
|
||||
} EnBoxType;
|
||||
|
||||
typedef struct EnBox {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x0144 */ char unk_144[0xAC];
|
||||
/* 0x01F0 */ char unk_1F0[0x01];
|
||||
/* 0x01F1 */ u8 unk_1F1;
|
||||
/* 0x01F2 */ char unk_1F2[0x02];
|
||||
/* 0x01F4 */ char unk_1F4[0x0C];
|
||||
/* 0x0200 */ EnBoxActionFunc actionFunc;
|
||||
/* 0x0204 */ char unk_204[0x20];
|
||||
/* 0x0000 */ DynaPolyActor dyna;
|
||||
/* 0x015C */ SkelAnime skelAnime;
|
||||
/* 0x01A0 */ s32 unk_1A0;
|
||||
/* 0x01A4 */ UNK_TYPE1 unk_1A4[0x04];
|
||||
/* 0x01A8 */ f32 unk_1A8;
|
||||
/* 0x01AC */ EnBoxActionFunc actionFunc;
|
||||
/* 0x01B0 */ Vec3s jointTable[OBJECT_BOX_CHEST_LIMB_MAX];
|
||||
/* 0x01CE */ Vec3s morphTable[OBJECT_BOX_CHEST_LIMB_MAX];
|
||||
/* 0x01EC */ s16 unk_1EC;
|
||||
/* 0x01EE */ u8 movementFlags;
|
||||
/* 0x01EF */ u8 alpha;
|
||||
/* 0x01F0 */ u8 switchFlag;
|
||||
/* 0x01F1 */ u8 type;
|
||||
/* 0x01F2 */ u8 iceSmokeTimer;
|
||||
/* 0x01F3 */ s8 unk_1F3;
|
||||
/* 0x01F4 */ func_80867BDC_a0 unk_1F4;
|
||||
/* 0x0218 */ s16 cutsceneIdxA;
|
||||
/* 0x021A */ s16 cutsceneIdxB;
|
||||
/* 0x021C */ s32 getItem;
|
||||
/* 0x0220 */ s32 collectableFlag;
|
||||
} EnBox; // size = 0x224
|
||||
|
||||
extern const ActorInit En_Box_InitVars;
|
||||
|
||||
#define ENBOX_GET_TYPE(thisx) (((thisx)->params >> 12) & 0xF)
|
||||
#define ENBOX_GET_ITEM(thisx) (((thisx)->params >> 5) & 0x7F)
|
||||
#define ENBOX_GET_CHEST_FLAG(thisx) ((thisx)->params & 0x1F)
|
||||
#define ENBOX_GET_SWITCH_FLAG(thisx) ((thisx)->world.rot.z)
|
||||
|
||||
#endif // Z_EN_BOX_H
|
||||
|
||||
@@ -31,7 +31,7 @@ s32 EnGirlA_CanBuyBombBag20BombShop(GlobalContext* globalCtx, EnGirlA* this);
|
||||
s32 EnGirlA_CanBuyBombBag30BombShop(GlobalContext* globalCtx, EnGirlA* this);
|
||||
s32 EnGirlA_CanBuyBombchus(GlobalContext* globalCtx, EnGirlA* this);
|
||||
s32 EnGirlA_CanBuyBombs(GlobalContext* globalCtx, EnGirlA* this);
|
||||
s32 EnGirlA_CanBuyBottle(GlobalContext* globalCtx, EnGirlA* this);
|
||||
s32 EnGirlA_CanBuyBottleStolen(GlobalContext* globalCtx, EnGirlA* this);
|
||||
s32 EnGirlA_CanBuySword(GlobalContext* globalCtx, EnGirlA* this);
|
||||
s32 EnGirlA_CanBuyShieldMirror(GlobalContext* globalCtx, EnGirlA* this);
|
||||
s32 EnGirlA_CanBuyFairy(GlobalContext* globalCtx, EnGirlA* this);
|
||||
@@ -64,91 +64,91 @@ const ActorInit En_GirlA_InitVars = {
|
||||
};
|
||||
|
||||
static ShopItemEntry sShopItemEntries[] = {
|
||||
{ OBJECT_GI_LIQUID, GID_POTION_RED, func_800B8050, 1, 0X083F, 0X0840, GI_POTION_RED, EnGirlA_CanBuyPotionRed,
|
||||
{ OBJECT_GI_LIQUID, GID_POTION_RED, func_800B8050, 1, 0x083F, 0x0840, GI_POTION_RED, EnGirlA_CanBuyPotionRed,
|
||||
EnGirlA_BuyBottleItem, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_LIQUID, GID_POTION_GREEN, func_800B8050, 1, 0X0841, 0X0842, GI_POTION_GREEN, EnGirlA_CanBuyPotionGreen,
|
||||
{ OBJECT_GI_LIQUID, GID_POTION_GREEN, func_800B8050, 1, 0x0841, 0x0842, GI_POTION_GREEN, EnGirlA_CanBuyPotionGreen,
|
||||
EnGirlA_BuyBottleItem, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_LIQUID, GID_POTION_BLUE, func_800B8050, 1, 0X0843, 0X0844, GI_POTION_BLUE, EnGirlA_CanBuyPotionBlue,
|
||||
{ OBJECT_GI_LIQUID, GID_POTION_BLUE, func_800B8050, 1, 0x0843, 0x0844, GI_POTION_BLUE, EnGirlA_CanBuyPotionBlue,
|
||||
EnGirlA_BuyBottleItem, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_BOTTLE_04, GID_FAIRY, func_800B8050, 1, 0X06B6, 0X06B7, GI_FAIRY, EnGirlA_CanBuyFairy,
|
||||
{ OBJECT_GI_BOTTLE_04, GID_FAIRY, func_800B8050, 1, 0x06B6, 0x06B7, GI_FAIRY, EnGirlA_CanBuyFairy,
|
||||
EnGirlA_BuyBottleItem, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_ARROW, GID_ARROWS_LARGE, func_800B8050, 50, 0X06BA, 0X06BB, GI_ARROWS_40, EnGirlA_CanBuyArrows,
|
||||
{ OBJECT_GI_ARROW, GID_ARROWS_LARGE, func_800B8050, 50, 0x06BA, 0x06BB, GI_ARROWS_40, EnGirlA_CanBuyArrows,
|
||||
EnGirlA_BuyArrows, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_LIQUID, GID_POTION_GREEN, func_800B8050, 1, 0X06B2, 0X06B3, GI_POTION_GREEN, EnGirlA_CanBuyPotionGreen,
|
||||
{ OBJECT_GI_LIQUID, GID_POTION_GREEN, func_800B8050, 1, 0x06B2, 0x06B3, GI_POTION_GREEN, EnGirlA_CanBuyPotionGreen,
|
||||
EnGirlA_BuyBottleItem, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_SHIELD_2, GID_SHIELD_HERO, func_800B8050, 1, 0X06AE, 0X06AF, GI_SHIELD_HERO, EnGirlA_CanBuyShieldHero,
|
||||
{ OBJECT_GI_SHIELD_2, GID_SHIELD_HERO, func_800B8050, 1, 0x06AE, 0x06AF, GI_SHIELD_HERO, EnGirlA_CanBuyShieldHero,
|
||||
EnGirlA_BuyShieldHero, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_STICK, GID_STICK, NULL, 1, 0X06B4, 0X06B5, GI_STICKS_1, EnGirlA_CanBuyStick, EnGirlA_BuyStick,
|
||||
{ OBJECT_GI_STICK, GID_STICK, NULL, 1, 0x06B4, 0x06B5, GI_STICKS_1, EnGirlA_CanBuyStick, EnGirlA_BuyStick,
|
||||
EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_ARROW, GID_ARROWS_MEDIUM, func_800B8050, 30, 0X06B8, 0X06B9, GI_ARROWS_30, EnGirlA_CanBuyArrows,
|
||||
{ OBJECT_GI_ARROW, GID_ARROWS_MEDIUM, func_800B8050, 30, 0x06B8, 0x06B9, GI_ARROWS_30, EnGirlA_CanBuyArrows,
|
||||
EnGirlA_BuyArrows, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_NUTS, GID_NUTS, func_800B8118, 10, 0X06B0, 0X06B1, GI_NUTS_10, EnGirlA_CanBuyNuts, EnGirlA_BuyNuts,
|
||||
{ OBJECT_GI_NUTS, GID_NUTS, func_800B8118, 10, 0x06B0, 0x06B1, GI_NUTS_10, EnGirlA_CanBuyNuts, EnGirlA_BuyNuts,
|
||||
EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_LIQUID, GID_POTION_RED, func_800B8050, 1, 0X06AC, 0X06AD, GI_POTION_RED, EnGirlA_CanBuyPotionRed,
|
||||
{ OBJECT_GI_LIQUID, GID_POTION_RED, func_800B8050, 1, 0x06AC, 0x06AD, GI_POTION_RED, EnGirlA_CanBuyPotionRed,
|
||||
EnGirlA_BuyBottleItem, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_BOTTLE_04, GID_FAIRY, func_800B8050, 1, 0X06D3, 0X06D4, GI_FAIRY, EnGirlA_CanBuyFairy,
|
||||
{ OBJECT_GI_BOTTLE_04, GID_FAIRY, func_800B8050, 1, 0x06D3, 0x06D4, GI_FAIRY, EnGirlA_CanBuyFairy,
|
||||
EnGirlA_BuyBottleItem, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_ARROW, GID_ARROWS_MEDIUM, func_800B8050, 30, 0X06D5, 0X06D6, GI_ARROWS_30, EnGirlA_CanBuyArrows,
|
||||
{ OBJECT_GI_ARROW, GID_ARROWS_MEDIUM, func_800B8050, 30, 0x06D5, 0x06D6, GI_ARROWS_30, EnGirlA_CanBuyArrows,
|
||||
EnGirlA_BuyArrows, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_ARROW, GID_ARROWS_LARGE, func_800B8050, 50, 0X06D7, 0X06D8, GI_ARROWS_40, EnGirlA_CanBuyArrows,
|
||||
{ OBJECT_GI_ARROW, GID_ARROWS_LARGE, func_800B8050, 50, 0x06D7, 0x06D8, GI_ARROWS_40, EnGirlA_CanBuyArrows,
|
||||
EnGirlA_BuyArrows, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_LIQUID, GID_POTION_GREEN, func_800B8050, 1, 0X06CF, 0X06D0, GI_POTION_GREEN, EnGirlA_CanBuyPotionGreen,
|
||||
{ OBJECT_GI_LIQUID, GID_POTION_GREEN, func_800B8050, 1, 0x06CF, 0x06D0, GI_POTION_GREEN, EnGirlA_CanBuyPotionGreen,
|
||||
EnGirlA_BuyBottleItem, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_NUTS, GID_NUTS, func_800B8118, 10, 0X06CD, 0X06CE, GI_NUTS_10, EnGirlA_CanBuyNuts, EnGirlA_BuyNuts,
|
||||
{ OBJECT_GI_NUTS, GID_NUTS, func_800B8118, 10, 0x06CD, 0x06CE, GI_NUTS_10, EnGirlA_CanBuyNuts, EnGirlA_BuyNuts,
|
||||
EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_STICK, GID_STICK, NULL, 1, 0X06D1, 0X06D2, GI_STICKS_1, EnGirlA_CanBuyStick, EnGirlA_BuyStick,
|
||||
{ OBJECT_GI_STICK, GID_STICK, NULL, 1, 0x06D1, 0x06D2, GI_STICKS_1, EnGirlA_CanBuyStick, EnGirlA_BuyStick,
|
||||
EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_SHIELD_2, GID_SHIELD_HERO, func_800B8050, 1, 0X06CB, 0X06CC, GI_SHIELD_HERO, EnGirlA_CanBuyShieldHero,
|
||||
{ OBJECT_GI_SHIELD_2, GID_SHIELD_HERO, func_800B8050, 1, 0x06CB, 0x06CC, GI_SHIELD_HERO, EnGirlA_CanBuyShieldHero,
|
||||
EnGirlA_BuyShieldHero, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_LIQUID, GID_POTION_RED, func_800B8050, 1, 0X06C9, 0X06CA, GI_POTION_RED, EnGirlA_CanBuyPotionRed,
|
||||
{ OBJECT_GI_LIQUID, GID_POTION_RED, func_800B8050, 1, 0x06C9, 0x06CA, GI_POTION_RED, EnGirlA_CanBuyPotionRed,
|
||||
EnGirlA_BuyBottleItem, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_MASK06, GID_MASK_ALL_NIGHT, func_800B8050, 1, 0X29D9, 0X29DA, GI_MASK_ALL_NIGHT,
|
||||
{ OBJECT_GI_MASK06, GID_MASK_ALL_NIGHT, func_800B8050, 1, 0x29D9, 0x29DA, GI_MASK_ALL_NIGHT,
|
||||
EnGirlA_CanBuyMaskAllNight, EnGirlA_BuyMaskAllNight, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_BOMBPOUCH, GID_BOMB_BAG_20, func_800B8050, 1, 0X29DB, 0X29DC, GI_BOMB_BAG_20,
|
||||
{ OBJECT_GI_BOMBPOUCH, GID_BOMB_BAG_20, func_800B8050, 1, 0x29DB, 0x29DC, GI_BOMB_BAG_20,
|
||||
EnGirlA_CanBuyBombBagCuriosityShop, EnGirlA_BuyBombBag, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_BOMBPOUCH, GID_BOMB_BAG_30, func_800B8050, 2, 0X29DB, 0X29DC, GI_BOMB_BAG_30,
|
||||
{ OBJECT_GI_BOMBPOUCH, GID_BOMB_BAG_30, func_800B8050, 2, 0x29DB, 0x29DC, GI_BOMB_BAG_30,
|
||||
EnGirlA_CanBuyBombBagCuriosityShop, EnGirlA_BuyBombBag, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_BOMBPOUCH, GID_BOMB_BAG_40, func_800B8050, 3, 0X29DB, 0X29DC, GI_BOMB_BAG_40,
|
||||
{ OBJECT_GI_BOMBPOUCH, GID_BOMB_BAG_40, func_800B8050, 3, 0x29DB, 0x29DC, GI_BOMB_BAG_40,
|
||||
EnGirlA_CanBuyBombBagCuriosityShop, EnGirlA_BuyBombBag, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_BOMBPOUCH, GID_BOMB_BAG_20, func_800B8050, 1, 0X0654, 0X0655, GI_BOMB_BAG_20,
|
||||
{ OBJECT_GI_BOMBPOUCH, GID_BOMB_BAG_20, func_800B8050, 1, 0x0654, 0x0655, GI_BOMB_BAG_20,
|
||||
EnGirlA_CanBuyBombBag20BombShop, EnGirlA_BuyBombBag, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_BOMBPOUCH, GID_BOMB_BAG_30, func_800B8050, 2, 0X0656, 0X0657, GI_BOMB_BAG_30,
|
||||
{ OBJECT_GI_BOMBPOUCH, GID_BOMB_BAG_30, func_800B8050, 2, 0x0656, 0x0657, GI_BOMB_BAG_30,
|
||||
EnGirlA_CanBuyBombBag30BombShop, EnGirlA_BuyBombBag, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_BOMB_2, GID_BOMBCHU, func_800B8050, 10, 0X0652, 0X0653, GI_BOMBCHUS_10, EnGirlA_CanBuyBombchus,
|
||||
{ OBJECT_GI_BOMB_2, GID_BOMBCHU, func_800B8050, 10, 0x0652, 0x0653, GI_BOMBCHUS_10, EnGirlA_CanBuyBombchus,
|
||||
EnGirlA_BuyBombchus, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_BOMB_1, GID_BOMB, func_800B8050, 10, 0X0650, 0X0651, GI_BOMBS_10, EnGirlA_CanBuyBombs, EnGirlA_BuyBombs,
|
||||
{ OBJECT_GI_BOMB_1, GID_BOMB, func_800B8050, 10, 0x0650, 0x0651, GI_BOMBS_10, EnGirlA_CanBuyBombs, EnGirlA_BuyBombs,
|
||||
EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_SHIELD_2, GID_SHIELD_HERO, func_800B8050, 1, 0X12DB, 0X12DC, GI_SHIELD_HERO, EnGirlA_CanBuyShieldHero,
|
||||
{ OBJECT_GI_SHIELD_2, GID_SHIELD_HERO, func_800B8050, 1, 0x12DB, 0x12DC, GI_SHIELD_HERO, EnGirlA_CanBuyShieldHero,
|
||||
EnGirlA_BuyShieldHero, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_ARROW, GID_ARROWS_SMALL, func_800B8050, 10, 0X12DD, 0X12DE, GI_ARROWS_10, EnGirlA_CanBuyArrows,
|
||||
{ OBJECT_GI_ARROW, GID_ARROWS_SMALL, func_800B8050, 10, 0x12DD, 0x12DE, GI_ARROWS_10, EnGirlA_CanBuyArrows,
|
||||
EnGirlA_BuyArrows, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_LIQUID, GID_POTION_RED, func_800B8050, 1, 0X12DF, 0X12E0, GI_POTION_RED, EnGirlA_CanBuyPotionRed,
|
||||
{ OBJECT_GI_LIQUID, GID_POTION_RED, func_800B8050, 1, 0x12DF, 0x12E0, GI_POTION_RED, EnGirlA_CanBuyPotionRed,
|
||||
EnGirlA_BuyBottleItem, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_BOMB_1, GID_BOMB, func_800B8050, 10, 0X0BC5, 0X0BC6, GI_BOMBS_10, EnGirlA_CanBuyBombs, EnGirlA_BuyBombs,
|
||||
{ OBJECT_GI_BOMB_1, GID_BOMB, func_800B8050, 10, 0x0BC5, 0x0BC6, GI_BOMBS_10, EnGirlA_CanBuyBombs, EnGirlA_BuyBombs,
|
||||
EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_ARROW, GID_ARROWS_SMALL, func_800B8050, 10, 0X0BC7, 0X0BC8, GI_ARROWS_10, EnGirlA_CanBuyArrows,
|
||||
{ OBJECT_GI_ARROW, GID_ARROWS_SMALL, func_800B8050, 10, 0x0BC7, 0x0BC8, GI_ARROWS_10, EnGirlA_CanBuyArrows,
|
||||
EnGirlA_BuyArrows, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_LIQUID, GID_POTION_RED, func_800B8050, 1, 0X0BC9, 0X0BCA, GI_POTION_RED, EnGirlA_CanBuyPotionRed,
|
||||
{ OBJECT_GI_LIQUID, GID_POTION_RED, func_800B8050, 1, 0x0BC9, 0x0BCA, GI_POTION_RED, EnGirlA_CanBuyPotionRed,
|
||||
EnGirlA_BuyBottleItem, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_BOMB_1, GID_BOMB, func_800B8050, 10, 0X0BCB, 0X0BCC, GI_BOMBS_10, EnGirlA_CanBuyBombs, EnGirlA_BuyBombs,
|
||||
{ OBJECT_GI_BOMB_1, GID_BOMB, func_800B8050, 10, 0x0BCB, 0x0BCC, GI_BOMBS_10, EnGirlA_CanBuyBombs, EnGirlA_BuyBombs,
|
||||
EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_ARROW, GID_ARROWS_SMALL, func_800B8050, 10, 0X0BCD, 0X0BCE, GI_ARROWS_10, EnGirlA_CanBuyArrows,
|
||||
{ OBJECT_GI_ARROW, GID_ARROWS_SMALL, func_800B8050, 10, 0x0BCD, 0x0BCE, GI_ARROWS_10, EnGirlA_CanBuyArrows,
|
||||
EnGirlA_BuyArrows, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_LIQUID, GID_POTION_RED, func_800B8050, 1, 0X0BCF, 0X0BD0, GI_POTION_RED, EnGirlA_CanBuyPotionRed,
|
||||
{ OBJECT_GI_LIQUID, GID_POTION_RED, func_800B8050, 1, 0x0BCF, 0x0BD0, GI_POTION_RED, EnGirlA_CanBuyPotionRed,
|
||||
EnGirlA_BuyBottleItem, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_BOTTLE, GID_BOTTLE, func_800B8050, 1, 0X29F8, 0X29F9, GI_BOTTLE, EnGirlA_CanBuyBottle,
|
||||
{ OBJECT_GI_BOTTLE, GID_BOTTLE, func_800B8050, 1, 0x29F8, 0x29F9, GI_BOTTLE_STOLEN, EnGirlA_CanBuyBottleStolen,
|
||||
EnGirlA_BuyBottle, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_SWORD_4, GID_SWORD_GREAT_FAIRY, func_800B8050, 4, 0X29F2, 0X29F3, GI_SWORD_GREAT_FAIRY,
|
||||
{ OBJECT_GI_SWORD_4, GID_SWORD_GREAT_FAIRY, func_800B8050, 4, 0x29F2, 0x29F3, GI_SWORD_GREAT_FAIRY,
|
||||
EnGirlA_CanBuySword, EnGirlA_BuySword, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_SWORD_1, GID_SWORD_KOKIRI, func_800B8050, 1, 0X29F4, 0X29F5, GI_SWORD_KOKIRI, EnGirlA_CanBuySword,
|
||||
{ OBJECT_GI_SWORD_1, GID_SWORD_KOKIRI, func_800B8050, 1, 0x29F4, 0x29F5, GI_SWORD_KOKIRI, EnGirlA_CanBuySword,
|
||||
EnGirlA_BuySword, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_SWORD_2, GID_SWORD_RAZOR, func_800B8050, 2, 0X29F4, 0X29F5, GI_SWORD_RAZOR, EnGirlA_CanBuySword,
|
||||
{ OBJECT_GI_SWORD_2, GID_SWORD_RAZOR, func_800B8050, 2, 0x29F4, 0x29F5, GI_SWORD_RAZOR, EnGirlA_CanBuySword,
|
||||
EnGirlA_BuySword, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_SWORD_3, GID_SWORD_GILDED, func_800B8050, 3, 0X29F4, 0X29F5, GI_SWORD_GILDED, EnGirlA_CanBuySword,
|
||||
{ OBJECT_GI_SWORD_3, GID_SWORD_GILDED, func_800B8050, 3, 0x29F4, 0x29F5, GI_SWORD_GILDED, EnGirlA_CanBuySword,
|
||||
EnGirlA_BuySword, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_SHIELD_2, GID_SHIELD_HERO, func_800B8050, 1, 0X29F6, 0X29F7, GI_SHIELD_HERO_2, EnGirlA_CanBuyShieldHero,
|
||||
{ OBJECT_GI_SHIELD_2, GID_SHIELD_HERO, func_800B8050, 1, 0x29F6, 0x29F7, GI_SHIELD_HERO_2, EnGirlA_CanBuyShieldHero,
|
||||
EnGirlA_BuyShieldHero, EnGirlA_BuyFanfare },
|
||||
{ OBJECT_GI_SHIELD_3, GID_SHIELD_MIRROR, func_800B8050, 1, 0X29F6, 0X29F7, GI_SHIELD_MIRROR,
|
||||
{ OBJECT_GI_SHIELD_3, GID_SHIELD_MIRROR, func_800B8050, 1, 0x29F6, 0x29F7, GI_SHIELD_MIRROR,
|
||||
EnGirlA_CanBuyShieldMirror, EnGirlA_BuyShieldMirror, EnGirlA_BuyFanfare },
|
||||
};
|
||||
|
||||
@@ -341,7 +341,7 @@ s32 EnGirlA_CanBuyBombs(GlobalContext* globalCtx, EnGirlA* this) {
|
||||
return CANBUY_RESULT_SUCCESS_2;
|
||||
}
|
||||
|
||||
s32 EnGirlA_CanBuyBottle(GlobalContext* globalCtx, EnGirlA* this) {
|
||||
s32 EnGirlA_CanBuyBottleStolen(GlobalContext* globalCtx, EnGirlA* this) {
|
||||
if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) {
|
||||
return CANBUY_RESULT_NEED_RUPEES;
|
||||
}
|
||||
|
||||
@@ -486,7 +486,7 @@ void func_80B67B50(EnSth* this, GlobalContext* globalCtx) {
|
||||
} else {
|
||||
this->unk_29C &= ~1;
|
||||
gSaveContext.save.weekEventReg[34] |= 8;
|
||||
Actor_PickUp(&this->actor, globalCtx, GI_MASK_CAPTAIN, 10000.0f, 50.0f);
|
||||
Actor_PickUp(&this->actor, globalCtx, GI_MASK_TRUTH, 10000.0f, 50.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -299,7 +299,7 @@ void func_80AE0460(EnTsn* this, GlobalContext* globalCtx) {
|
||||
ENTSN_SET_Z(&this->unk_1D8->actor, false);
|
||||
this->actionFunc = func_80AE0418;
|
||||
} else {
|
||||
Actor_PickUp(&this->actor, globalCtx, GI_95, 2000.0f, 1000.0f);
|
||||
Actor_PickUp(&this->actor, globalCtx, GI_SEAHORSE, 2000.0f, 1000.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -333,7 +333,7 @@ void EnZow_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
Collider_DestroyCylinder(globalCtx, &this->collider);
|
||||
}
|
||||
|
||||
AnimationHeader* sAnimations[] = { &object_zo_Anim_004168, &gZoraSurfacingAnim, &gZoraSurfacingAnim };
|
||||
static AnimationHeader* sAnimations[] = { &object_zo_Anim_004168, &gZoraSurfacingAnim, &gZoraSurfacingAnim };
|
||||
|
||||
void func_80BDD04C(EnZow* this, s16 arg1, u8 arg2) {
|
||||
if ((arg1 >= 0) && (arg1 < 3)) {
|
||||
|
||||
Reference in New Issue
Block a user