mirror of https://github.com/zeldaret/mm.git
Decompile obj_wturn (#564)
* Decompile obj_wturn * Format * Rename struct member * Make suggestions * Format * Fix warning Co-authored-by: Elliptic Ellipsis <elliptic.ellipsis@gmail.com>
This commit is contained in:
parent
4f3202fd7e
commit
95c6ddbcc8
3
spec
3
spec
|
@ -957,8 +957,7 @@ beginseg
|
|||
name "ovl_Obj_Wturn"
|
||||
compress
|
||||
include "build/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.o"
|
||||
include "build/data/ovl_Obj_Wturn/ovl_Obj_Wturn.data.o"
|
||||
include "build/data/ovl_Obj_Wturn/ovl_Obj_Wturn.reloc.o"
|
||||
include "build/src/overlays/actors/ovl_Obj_Wturn/ovl_Obj_Wturn_reloc.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
|
|
@ -13,42 +13,116 @@
|
|||
void ObjWturn_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void ObjWturn_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
void func_808A7954(ObjWturn* this);
|
||||
void func_808A7968(ObjWturn* this, GlobalContext* globalCtx);
|
||||
void func_808A7A24(ObjWturn* this);
|
||||
void func_808A7A5C(ObjWturn* this, GlobalContext* globalCtx);
|
||||
void func_808A7AAC(ObjWturn* this, GlobalContext* globalCtx);
|
||||
void func_808A7BA0(ObjWturn* this, GlobalContext* globalCtx);
|
||||
void func_808A7C04(ObjWturn* this, GlobalContext* globalCtx);
|
||||
void func_808A7C78(ObjWturn* this, GlobalContext* globalCtx);
|
||||
|
||||
#if 0
|
||||
const ActorInit Obj_Wturn_InitVars = {
|
||||
ACTOR_OBJ_WTURN,
|
||||
ACTORCAT_ITEMACTION,
|
||||
FLAGS,
|
||||
GAMEPLAY_KEEP,
|
||||
sizeof(ObjWturn),
|
||||
(ActorFunc)ObjWturn_Init,
|
||||
(ActorFunc)Actor_Noop,
|
||||
(ActorFunc)ObjWturn_Update,
|
||||
(ActorFunc)NULL,
|
||||
ACTOR_OBJ_WTURN, ACTORCAT_ITEMACTION, FLAGS,
|
||||
GAMEPLAY_KEEP, sizeof(ObjWturn), (ActorFunc)ObjWturn_Init,
|
||||
(ActorFunc)Actor_Noop, (ActorFunc)ObjWturn_Update, (ActorFunc)NULL,
|
||||
};
|
||||
|
||||
#endif
|
||||
void ObjWturn_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ObjWturn* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Wturn/ObjWturn_Init.s")
|
||||
func_808A7954(this);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Wturn/func_808A7954.s")
|
||||
void func_808A7954(ObjWturn* this) {
|
||||
this->actionFunc = func_808A7968;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Wturn/func_808A7968.s")
|
||||
void func_808A7968(ObjWturn* this, GlobalContext* globalCtx) {
|
||||
if (globalCtx->msgCtx.ocarinaMode >= 28 && globalCtx->msgCtx.ocarinaMode < 39) {
|
||||
Flags_UnsetSwitch(globalCtx, this->actor.params);
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
} else if ((Flags_GetSwitch(globalCtx, this->actor.params) && (globalCtx->sceneNum == SCENE_F40)) ||
|
||||
(!Flags_GetSwitch(globalCtx, this->actor.params) && (globalCtx->sceneNum == SCENE_F41))) {
|
||||
func_808A7A24(this);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Wturn/func_808A7A24.s")
|
||||
void func_808A7A24(ObjWturn* this) {
|
||||
ActorCutscene_SetIntentToPlay(this->actor.cutscene);
|
||||
this->actionFunc = func_808A7A5C;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Wturn/func_808A7A5C.s")
|
||||
void func_808A7A5C(ObjWturn* this, GlobalContext* globalCtx) {
|
||||
if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) {
|
||||
func_808A7AAC(this, globalCtx);
|
||||
} else {
|
||||
ActorCutscene_SetIntentToPlay(this->actor.cutscene);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Wturn/func_808A7AAC.s")
|
||||
void func_808A7AAC(ObjWturn* this, GlobalContext* globalCtx) {
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
Vec3f eye;
|
||||
Vec3f at;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Wturn/func_808A7BA0.s")
|
||||
ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor);
|
||||
func_8016566C(140);
|
||||
this->camId = ActorCutscene_GetCurrentCamera(this->actor.cutscene);
|
||||
func_800B7298(globalCtx, &this->actor, 21);
|
||||
at.x = player->actor.focus.pos.x;
|
||||
at.z = player->actor.focus.pos.z;
|
||||
at.y = player->actor.focus.pos.y;
|
||||
eye.x = (Math_SinS(this->actor.shape.rot.y) * 150.0f) + at.x;
|
||||
eye.z = (Math_CosS(this->actor.shape.rot.y) * 150.0f) + at.z;
|
||||
eye.y = at.y + 4.0f;
|
||||
Play_CameraSetAtEye(globalCtx, this->camId, &at, &eye);
|
||||
this->actionFunc = func_808A7BA0;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Wturn/func_808A7C04.s")
|
||||
void func_808A7BA0(ObjWturn* this, GlobalContext* globalCtx) {
|
||||
if (Math_ScaledStepToS(&this->actor.shape.rot.z, -0x8000, 0x0200)) {
|
||||
func_808A7C04(this, globalCtx);
|
||||
}
|
||||
func_800B8FE8(&this->actor, NA_SE_EV_EARTHQUAKE - SFX_FLAG);
|
||||
Play_CameraSetRoll(globalCtx, this->camId, this->actor.shape.rot.z);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Wturn/func_808A7C78.s")
|
||||
void func_808A7C04(ObjWturn* this, GlobalContext* globalCtx) {
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Wturn/ObjWturn_Update.s")
|
||||
this->actor.world.pos.y += this->actor.playerHeightRel;
|
||||
player->actor.shape.shadowAlpha = 0;
|
||||
func_800B7298(globalCtx, &this->actor, 0x54);
|
||||
func_800B8E58(player, NA_SE_VO_NAVY_ENEMY);
|
||||
this->unk_14A = 0;
|
||||
func_80165690();
|
||||
this->actionFunc = func_808A7C78;
|
||||
}
|
||||
|
||||
void func_808A7C78(ObjWturn* this, GlobalContext* globalCtx) {
|
||||
static Vec3f D_808A7DC0 = { 0.0f, -1.0f, 0.0f };
|
||||
Camera* camera = Play_GetCamera(globalCtx, this->camId);
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
|
||||
this->unk_14A++;
|
||||
player->actor.world.pos.y = this->actor.world.pos.y + this->unk_14A * 4.0f;
|
||||
Play_CameraSetAtEyeUp(globalCtx, this->camId, &player->actor.focus.pos, &camera->eye, &D_808A7DC0);
|
||||
if (this->unk_14A == 1) {
|
||||
globalCtx->unk_1887F = 0x40;
|
||||
gSaveContext.nextTransition = 3;
|
||||
gSaveContext.nextCutsceneIndex = 0;
|
||||
if (globalCtx->sceneNum == 0x58) {
|
||||
globalCtx->nextEntranceIndex = 0xAC00;
|
||||
} else {
|
||||
globalCtx->nextEntranceIndex = 0xAA10;
|
||||
}
|
||||
globalCtx->sceneLoadFlag = 0x14;
|
||||
}
|
||||
}
|
||||
|
||||
void ObjWturn_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ObjWturn* this = THIS;
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@ typedef void (*ObjWturnActionFunc)(struct ObjWturn*, GlobalContext*);
|
|||
typedef struct ObjWturn {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x0144 */ ObjWturnActionFunc actionFunc;
|
||||
/* 0x0148 */ char unk_148[0x4];
|
||||
/* 0x0148 */ s16 camId;
|
||||
/* 0x014A */ s16 unk_14A;
|
||||
} ObjWturn; // size = 0x14C
|
||||
|
||||
extern const ActorInit Obj_Wturn_InitVars;
|
||||
|
|
Loading…
Reference in New Issue