1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-06 06:10:21 +00:00

Bg_Haka_Gate (#557)

* Darkmeiro decompilation

Bg_Gnd_Darkmeiro decompiled, matched, and documented.

* give this a shot

* fix conflict

* one more try

* could be useful

* whoops

* ZAP2 stuff

* ZAP why

* ZAP again

* match

* sfx fix

* should be good to go

* comments and such

* Matrix macros escape me

* format

* fix bubble

* remove comments

Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: fig <fig02srl@gmail.com>
This commit is contained in:
petrie911 2020-12-29 18:39:30 -06:00 committed by GitHub
parent 22758f06d7
commit c71b8183ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 366 additions and 1214 deletions

View file

@ -10,31 +10,56 @@
#define THIS ((BgHakaGate*)thisx)
// general purpose timer
#define vTimer actionVar1
// variables for turning the statue. Deg10 rotations are in tenths of a degree
#define vTurnDirection actionVar1
#define vTurnRateDeg10 actionVar2
#define vTurnAngleDeg10 actionVar3
#define vRotYDeg10 actionVar4
#define vInitTurnAngle actionVar5
// opening angle for floor
#define vOpenAngle actionVar2
// variables for the skull flames
#define vFlameScale actionVar3
#define vIsSkullOfTruth actionVar4
#define vScrollTimer actionVar5
#define SKULL_OF_TRUTH_FOUND 100
void BgHakaGate_Init(Actor* thisx, GlobalContext* globalCtx);
void BgHakaGate_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgHakaGate_Update(Actor* thisx, GlobalContext* globalCtx);
void BgHakaGate_Draw(Actor* thisx, GlobalContext* globalCtx);
void BgHakaGate_Draw(Actor* this, GlobalContext* globalCtx);
void func_8087C114(BgHakaGate* this, GlobalContext* globalCtx);
void func_8087C120(BgHakaGate* this, GlobalContext* globalCtx);
void func_8087C158(BgHakaGate* this, GlobalContext* globalCtx);
void func_8087C270(BgHakaGate* this, GlobalContext* globalCtx);
void func_8087C454(BgHakaGate* this, GlobalContext* globalCtx);
void func_8087C5D0(BgHakaGate* this, GlobalContext* globalCtx);
void func_8087C65C(BgHakaGate* this, GlobalContext* globalCtx);
void func_8087C6AC(BgHakaGate* this, GlobalContext* globalCtx);
void func_8087C73C(BgHakaGate* this, GlobalContext* globalCtx);
void func_8087C794(BgHakaGate* this, GlobalContext* globalCtx);
void func_8087C85C(BgHakaGate* this, GlobalContext* globalCtx);
void BgHakaGate_DoNothing(BgHakaGate* this, GlobalContext* globalCtx);
void BgHakaGate_StatueInactive(BgHakaGate* this, GlobalContext* globalCtx);
void BgHakaGate_StatueIdle(BgHakaGate* this, GlobalContext* globalCtx);
void BgHakaGate_StatueTurn(BgHakaGate* this, GlobalContext* globalCtx);
void BgHakaGate_FloorClosed(BgHakaGate* this, GlobalContext* globalCtx);
void BgHakaGate_FloorOpen(BgHakaGate* this, GlobalContext* globalCtx);
void BgHakaGate_GateWait(BgHakaGate* this, GlobalContext* globalCtx);
void BgHakaGate_GateOpen(BgHakaGate* this, GlobalContext* globalCtx);
void BgHakaGate_SkullOfTruth(BgHakaGate* this, GlobalContext* globalCtx);
void BgHakaGate_FalseSkull(BgHakaGate* this, GlobalContext* globalCtx);
extern UNK_TYPE D_0404D4E0;
extern UNK_TYPE D_0600F1B0;
extern UNK_TYPE D_06010A10;
extern UNK_TYPE D_06010C10;
extern UNK_TYPE D_06010E10;
extern UNK_TYPE D_060131C4;
extern Gfx D_0404D4E0[];
extern ColHeader D_0600A938;
extern Gfx D_0600F1B0[];
extern Gfx D_06010A10[];
extern Gfx D_06010C10[];
extern ColHeader D_06010E10;
extern ColHeader D_060131C4;
static s16 sSkullOfTruthRotY = 0x100;
static u8 sPuzzleState = 1;
static f32 sStatueDistFromLink = 0;
static s16 sStatueRotY;
/*
const ActorInit Bg_Haka_Gate_InitVars = {
ACTOR_BG_HAKA_GATE,
ACTORTYPE_PROP,
@ -46,33 +71,309 @@ const ActorInit Bg_Haka_Gate_InitVars = {
(ActorFunc)BgHakaGate_Update,
(ActorFunc)BgHakaGate_Draw,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Gate/BgHakaGate_Init.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Gate/BgHakaGate_Destroy.s")
static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Gate/func_8087C114.s")
void BgHakaGate_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
BgHakaGate* this = THIS;
ColHeader* colHeader = NULL;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Gate/func_8087C120.s")
Actor_ProcessInitChain(thisx, sInitChain);
this->switchFlag = (thisx->params >> 8) & 0xFF;
thisx->params &= 0xFF;
DynaPolyInfo_SetActorMove(&this->dyna, 0);
if (thisx->params == BGHAKAGATE_SKULL) {
if (sSkullOfTruthRotY != 0x100) {
this->actionFunc = BgHakaGate_FalseSkull;
} else if (ABS(thisx->shape.rot.y) < 0x4000) {
if ((Rand_ZeroOne() * 3.0f) < sPuzzleState) {
this->vIsSkullOfTruth = true;
sSkullOfTruthRotY = thisx->shape.rot.y + 0x8000;
if (Flags_GetSwitch(globalCtx, this->switchFlag)) {
this->actionFunc = BgHakaGate_DoNothing;
} else {
this->actionFunc = BgHakaGate_SkullOfTruth;
}
} else {
sPuzzleState++;
this->actionFunc = BgHakaGate_FalseSkull;
}
} else {
this->actionFunc = BgHakaGate_FalseSkull;
}
this->vScrollTimer = Rand_ZeroOne() * 20.0f;
thisx->flags |= 0x10;
if (Flags_GetSwitch(globalCtx, this->switchFlag)) {
this->vFlameScale = 350;
}
} else {
if (thisx->params == BGHAKAGATE_STATUE) {
DynaPolyInfo_Alloc(&D_060131C4, &colHeader);
this->vTimer = 0;
sStatueDistFromLink = 0.0f;
if (Flags_GetSwitch(globalCtx, this->switchFlag)) {
this->actionFunc = BgHakaGate_StatueInactive;
} else {
this->actionFunc = BgHakaGate_StatueIdle;
}
} else if (thisx->params == BGHAKAGATE_FLOOR) {
DynaPolyInfo_Alloc(&D_06010E10, &colHeader);
if (Flags_GetSwitch(globalCtx, this->switchFlag)) {
this->actionFunc = BgHakaGate_DoNothing;
} else {
this->actionFunc = BgHakaGate_FloorClosed;
}
} else { // BGHAKAGATE_GATE
DynaPolyInfo_Alloc(&D_0600A938, &colHeader);
if (Flags_GetSwitch(globalCtx, this->switchFlag)) {
this->actionFunc = BgHakaGate_DoNothing;
thisx->posRot.pos.y += 80.0f;
} else {
thisx->flags |= 0x10;
Actor_SetHeight(thisx, 30.0f);
this->actionFunc = BgHakaGate_GateWait;
}
}
this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Gate/func_8087C158.s")
void BgHakaGate_Destroy(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
BgHakaGate* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Gate/func_8087C270.s")
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
if (this->dyna.actor.params == BGHAKAGATE_STATUE) {
sSkullOfTruthRotY = 0x100;
sPuzzleState = 1;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Gate/func_8087C454.s")
void BgHakaGate_DoNothing(BgHakaGate* this, GlobalContext* globalCtx) {
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Gate/func_8087C5D0.s")
void BgHakaGate_StatueInactive(BgHakaGate* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Gate/func_8087C65C.s")
if (this->dyna.unk_150 != 0.0f) {
player->stateFlags2 &= ~0x10;
this->dyna.unk_150 = 0.0f;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Gate/func_8087C6AC.s")
void BgHakaGate_StatueIdle(BgHakaGate* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
s32 linkDirection;
f32 forceDirection;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Gate/func_8087C73C.s")
if (this->dyna.unk_150 != 0.0f) {
if (this->vTimer == 0) {
this->vInitTurnAngle = this->dyna.actor.shape.rot.y - this->dyna.actor.yawTowardsLink;
sStatueDistFromLink = this->dyna.actor.xzDistFromLink;
forceDirection = (this->dyna.unk_150 >= 0.0f) ? 1.0f : -1.0f;
linkDirection = ((s16)(this->dyna.actor.yawTowardsLink - player->actor.shape.rot.y) > 0) ? -1 : 1;
this->vTurnDirection = linkDirection * forceDirection;
this->actionFunc = BgHakaGate_StatueTurn;
} else {
player->stateFlags2 &= ~0x10;
this->dyna.unk_150 = 0.0f;
if (this->vTimer != 0) {
this->vTimer--;
}
}
} else {
if (sPuzzleState == SKULL_OF_TRUTH_FOUND) {
this->actionFunc = BgHakaGate_StatueInactive;
} else {
this->vTimer = 0;
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Gate/func_8087C794.s")
void BgHakaGate_StatueTurn(BgHakaGate* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
s32 turnFinished;
s16 turnAngle;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Gate/BgHakaGate_Update.s")
this->vTurnRateDeg10++;
this->vTurnRateDeg10 = CLAMP_MAX(this->vTurnRateDeg10, 5);
turnFinished = Math_StepToS(&this->vTurnAngleDeg10, 600, this->vTurnRateDeg10);
turnAngle = this->vTurnAngleDeg10 * this->vTurnDirection;
this->dyna.actor.shape.rot.y = (this->vRotYDeg10 + turnAngle) * 0.1f * (0x10000 / 360.0f);
if ((player->stateFlags2 & 0x10) && (sStatueDistFromLink > 0.0f)) {
player->actor.posRot.pos.x =
this->dyna.actor.initPosRot.pos.x +
(Math_SinS(this->dyna.actor.shape.rot.y - this->vInitTurnAngle) * sStatueDistFromLink);
player->actor.posRot.pos.z =
this->dyna.actor.initPosRot.pos.z +
(Math_CosS(this->dyna.actor.shape.rot.y - this->vInitTurnAngle) * sStatueDistFromLink);
} else {
sStatueDistFromLink = 0.0f;
}
sStatueRotY = this->dyna.actor.shape.rot.y;
if (turnFinished) {
player->stateFlags2 &= ~0x10;
this->vRotYDeg10 = (this->vRotYDeg10 + turnAngle) % 3600;
this->vTurnRateDeg10 = 0;
this->vTurnAngleDeg10 = 0;
this->vTimer = 5;
this->actionFunc = BgHakaGate_StatueIdle;
this->dyna.unk_150 = 0.0f;
}
func_8002F974(&this->dyna.actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Gate/func_8087C85C.s")
void BgHakaGate_FloorClosed(BgHakaGate* this, GlobalContext* globalCtx) {
if ((sStatueDistFromLink > 1.0f) && (sStatueRotY != 0)) {
Player* player = PLAYER;
f32 radialDist;
f32 angDist;
f32 cos = Math_CosS(sStatueRotY);
f32 sin = Math_SinS(sStatueRotY);
f32 dx = player->actor.posRot.pos.x - this->dyna.actor.posRot.pos.x;
f32 dz = player->actor.posRot.pos.z - this->dyna.actor.posRot.pos.z;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Gate/BgHakaGate_Draw.s")
radialDist = dx * cos - dz * sin;
angDist = dx * sin + dz * cos;
if ((radialDist > 110.0f) || (fabsf(angDist) > 40.0f)) {
s16 yawDiff = sSkullOfTruthRotY - sStatueRotY;
sStatueDistFromLink = 0.0f;
if (ABS(yawDiff) < 0x80) {
Flags_SetSwitch(globalCtx, this->switchFlag);
sPuzzleState = SKULL_OF_TRUTH_FOUND;
this->actionFunc = BgHakaGate_DoNothing;
} else {
func_80078884(NA_SE_SY_ERROR);
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_GROUND_GATE_OPEN);
func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
this->vTimer = 60;
this->actionFunc = BgHakaGate_FloorOpen;
}
}
}
}
void BgHakaGate_FloorOpen(BgHakaGate* this, GlobalContext* globalCtx) {
if (this->vTimer != 0) {
this->vTimer--;
}
if (this->vTimer == 0) {
if (Math_ScaledStepToS(&this->vOpenAngle, 0, 0x800)) {
func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
this->actionFunc = BgHakaGate_FloorClosed;
}
} else {
Math_ScaledStepToS(&this->vOpenAngle, 0x3000, 0x800);
}
}
void BgHakaGate_GateWait(BgHakaGate* this, GlobalContext* globalCtx) {
if (Flags_GetSwitch(globalCtx, this->switchFlag)) {
func_80080480(globalCtx, &this->dyna.actor);
this->actionFunc = BgHakaGate_GateOpen;
}
}
void BgHakaGate_GateOpen(BgHakaGate* this, GlobalContext* globalCtx) {
if (Math_StepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y + 80.0f, 1.0f)) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_METALDOOR_STOP);
this->dyna.actor.flags &= ~0x10;
this->actionFunc = BgHakaGate_DoNothing;
} else {
func_8002F974(&this->dyna.actor, NA_SE_EV_METALDOOR_SLIDE - SFX_FLAG);
}
}
void BgHakaGate_SkullOfTruth(BgHakaGate* this, GlobalContext* globalCtx) {
if (Flags_GetSwitch(globalCtx, this->switchFlag) && Math_StepToS(&this->vFlameScale, 350, 20)) {
this->actionFunc = BgHakaGate_DoNothing;
}
}
void BgHakaGate_FalseSkull(BgHakaGate* this, GlobalContext* globalCtx) {
if (Flags_GetSwitch(globalCtx, this->switchFlag)) {
Math_StepToS(&this->vFlameScale, 350, 20);
}
if (globalCtx->actorCtx.unk_03) {
this->dyna.actor.flags |= 0x80;
} else {
this->dyna.actor.flags &= ~0x80;
}
}
void BgHakaGate_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
BgHakaGate* this = THIS;
this->actionFunc(this, globalCtx);
if (this->dyna.actor.params == BGHAKAGATE_SKULL) {
this->vScrollTimer++;
}
}
void BgHakaGate_DrawFlame(BgHakaGate* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor;
f32 scale;
if (this->vFlameScale > 0) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_haka_gate.c", 716);
if (1) {}
func_80093D84(globalCtx->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0,
(this->vScrollTimer * -20) & 0x1FF, 0x20, 0x80));
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, 255);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0);
Matrix_Translate(thisx->posRot.pos.x, thisx->posRot.pos.y + 15.0f, thisx->posRot.pos.z, MTXMODE_NEW);
Matrix_RotateY(Camera_GetCamDirYaw(ACTIVE_CAM) * (M_PI / 0x8000), MTXMODE_APPLY);
scale = this->vFlameScale * 0.00001f;
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_haka_gate.c", 744),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, D_0404D4E0);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_haka_gate.c", 749);
}
}
void BgHakaGate_Draw(Actor* thisx, GlobalContext* globalCtx) {
static Gfx* displayLists[] = { 0x06012270, 0x06010A10, 0x0600A860, 0x0600F1B0 };
BgHakaGate* this = THIS;
MtxF currentMtxF;
if ((thisx->flags & 0x80) == 0x80) {
Gfx_DrawDListXlu(globalCtx, D_0600F1B0);
} else {
func_80093D18(globalCtx->state.gfxCtx);
if (thisx->params == BGHAKAGATE_FLOOR) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_haka_gate.c", 781);
Matrix_Get(&currentMtxF);
Matrix_Translate(0.0f, 0.0f, -2000.0f, MTXMODE_APPLY);
Matrix_RotateX(this->vOpenAngle * (M_PI / 0x8000), MTXMODE_APPLY);
Matrix_Translate(0.0f, 0.0f, 2000.0f, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_haka_gate.c", 788),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_06010A10);
Matrix_Put(&currentMtxF);
Matrix_Translate(0.0f, 0.0f, 2000.0f, MTXMODE_APPLY);
Matrix_RotateX(-this->vOpenAngle * (M_PI / 0x8000), MTXMODE_APPLY);
Matrix_Translate(0.0f, 0.0f, -2000.0f, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_haka_gate.c", 796),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_06010C10);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_haka_gate.c", 800);
} else {
Gfx_DrawDListOpa(globalCtx, displayLists[thisx->params]);
}
}
if (thisx->params == BGHAKAGATE_SKULL) {
BgHakaGate_DrawFlame(this, globalCtx);
}
}

View file

@ -11,9 +11,21 @@ typedef void (*BgHakaGateActionFunc)(struct BgHakaGate*, GlobalContext*);
typedef struct BgHakaGate {
/* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ BgHakaGateActionFunc actionFunc;
/* 0x0168 */ char unk_168[0xC];
/* 0x0168 */ u8 switchFlag;
/* 0x016A */ s16 actionVar1;
/* 0x016C */ s16 actionVar2;
/* 0x016E */ s16 actionVar3;
/* 0x0170 */ s16 actionVar4;
/* 0x0172 */ s16 actionVar5;
} BgHakaGate; // size = 0x0174
typedef enum {
BGHAKAGATE_STATUE,
BGHAKAGATE_FLOOR,
BGHAKAGATE_GATE,
BGHAKAGATE_SKULL
} BgHakaGateType;
extern const ActorInit Bg_Haka_Gate_InitVars;
#endif

View file

@ -56,7 +56,8 @@ extern Gfx D_0600E2D0[];
void BgJyaBigmirror_SetRoomFlag(Actor* thisx, GlobalContext* globalCtx) {
BgJyaBigmirror* this = THIS;
this->puzzleFlags &= ~(BIGMIR_PUZZLE_IN_STATUE_ROOM | BIGMIR_PUZZLE_IN_1ST_TOP_ROOM | BIGMIR_PUZZLE_IN_2ND_TOP_ROOM);
this->puzzleFlags &=
~(BIGMIR_PUZZLE_IN_STATUE_ROOM | BIGMIR_PUZZLE_IN_1ST_TOP_ROOM | BIGMIR_PUZZLE_IN_2ND_TOP_ROOM);
if (globalCtx->roomCtx.curRoom.num == 5) {
this->puzzleFlags |= BIGMIR_PUZZLE_IN_STATUE_ROOM;
} else if (globalCtx->roomCtx.curRoom.num == 0x19) {

View file

@ -52,7 +52,8 @@ void BgJyaLift_InitDynapoly(BgJyaLift* this, GlobalContext* globalCtx, u32 arg2,
DynaPolyInfo_SetActorMove(&this->dyna, moveFlag);
DynaPolyInfo_Alloc(arg2, &localConst);
this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, localConst);
this->dyna.dynaPolyId =
DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, localConst);
}
void BgJyaLift_Init(Actor* thisx, GlobalContext* globalCtx) {

View file

@ -212,8 +212,7 @@ void EnBb_Init(Actor* thisx, GlobalContext* globalCtx) {
EnBb* this = THIS;
Actor_ProcessInitChain(thisx, sInitChain);
SkelAnime_Init(globalCtx, &this->skelAnime, &D_06001A30, &D_06000444, this->limbDrawTbl, this->transitionDrawTbl,
16);
SkelAnime_Init(globalCtx, &this->skelAnime, &D_06001A30, &D_06000444, this->jointTable, this->morphTable, 16);
this->unk_254 = 0;
thisx->colChkInfo.health = 4;
Collider_InitJntSph(globalCtx, &this->collider);
@ -829,8 +828,7 @@ void EnBb_White(EnBb* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_BUBLE_LAUGH);
}
if ((this->maxSpeed != 0.0f) &&
(((s32)this->skelAnime.curFrame == 0) || ((s32)this->skelAnime.curFrame == 5))) {
if ((this->maxSpeed != 0.0f) && (((s32)this->skelAnime.curFrame == 0) || ((s32)this->skelAnime.curFrame == 5))) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_BUBLE_MOUTH);
} else if (((s32)this->skelAnime.curFrame == 2) || ((s32)this->skelAnime.curFrame == 7)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_BUBLE_WING);

View file

@ -11,8 +11,8 @@ typedef void (*EnBbActionFunc)(struct EnBb*, GlobalContext*);
typedef struct EnBb {
/* 0x0000 */ Actor actor;
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ Vec3s limbDrawTbl[16];
/* 0x01F0 */ Vec3s transitionDrawTbl[16];
/* 0x0190 */ Vec3s jointTable[16];
/* 0x01F0 */ Vec3s morphTable[16];
/* 0x0250 */ s32 action;
/* 0x0254 */ s32 unk_254; // unused
/* 0x0258 */ EnBbActionFunc actionFunc;

View file

@ -80,8 +80,7 @@ void EnBw_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_SetScale(&this->actor, 0.012999999f);
this->actor.naviEnemyId = 0x23;
this->actor.gravity = -2.0f;
SkelAnime_Init(globalCtx, &this->skelAnime, &D_060020F0, &D_06000228, this->jointTable, this->morphTable,
12);
SkelAnime_Init(globalCtx, &this->skelAnime, &D_060020F0, &D_06000228, this->jointTable, this->morphTable, 12);
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 40.0f);
this->actor.colChkInfo.damageTable = &sDamageTable;
this->actor.colChkInfo.health = 6;
@ -284,14 +283,14 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) {
func_809CF72C(this);
} else {
Math_SmoothStepToS(&this->actor.posRot.rot.y, this->unk_236 + this->unk_238, 1,
this->actor.speedXZ * 1000.0f, 0);
this->actor.speedXZ * 1000.0f, 0);
}
break;
case 0:
Math_SmoothStepToF(&this->unk_248, 0.6f, 1.0f, 0.05f, 0.0f);
if (sp64 == 0) {
Math_SmoothStepToS(&this->actor.posRot.rot.y, this->actor.yawTowardsLink, 1,
this->actor.speedXZ * 1000.0f, 0);
this->actor.speedXZ * 1000.0f, 0);
if ((this->actor.xzDistFromLink < 90.0f) && (this->actor.yDistFromLink < 50.0f) &&
func_8002E084(&this->actor, 0x1554) &&
func_800339B8(&this->actor, globalCtx, 71.24802f, this->actor.yawTowardsLink)) {
@ -299,7 +298,7 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) {
}
} else {
Math_SmoothStepToS(&this->actor.posRot.rot.y, this->unk_236 + this->unk_238, 1,
this->actor.speedXZ * 1000.0f, 0);
this->actor.speedXZ * 1000.0f, 0);
}
if ((this->unk_224 == 0) || (ABS(this->actor.yDistFromLink) > 60.0f) || (player2->stateFlags1 & 0x6000)) {
this->unk_221 = 3;
@ -313,10 +312,10 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) {
this->unk_238 = -this->unk_238;
}
Math_SmoothStepToS(&this->actor.posRot.rot.y, this->actor.yawTowardsLink - 0x8000, 1,
this->actor.speedXZ * 1000.0f, 0);
this->actor.speedXZ * 1000.0f, 0);
} else {
Math_SmoothStepToS(&this->actor.posRot.rot.y, this->unk_236 + this->unk_238, 1,
this->actor.speedXZ * 1000.0f, 0);
this->actor.speedXZ * 1000.0f, 0);
}
if (this->unk_224 <= 200) {
sp60 = Math_SinS(this->unk_224 * (0x960 - this->unk_224)) * 55.0f;