ovl_Dm_Ravine (Link Riding Through Lost Woods Cutscene - Tree Trunk) (#120)

* ovl_Dm_Ravine OK (Link Riding Through Lost Woods Cutscene - Tree Trunk)

* ovl_Dm_Ravine: respond to PR comments

* Rename/retype DmRavine_Action -> DmRavine_DoNothing

* ovl_Dm_Ravine: incorporate PR feedback from kyleburnette

* ovl_Dm_Ravine: rename fields; use enum for state
This commit is contained in:
Zach Banks 2021-05-04 22:58:47 -04:00 committed by GitHub
parent d61d236a04
commit fcc87b3ae2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 67 additions and 12 deletions

View File

@ -4345,9 +4345,9 @@ SECTIONS
ovl_Dm_Ravine : AT(RomLocation)
{
build/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.o(.text)
build/asm/overlays/ovl_Dm_Ravine_data.o(.data)
build/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.o(.data)
build/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.o(.rodata)
build/asm/overlays/ovl_Dm_Ravine_rodata.o(.rodata)
build/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine_overlay.o(.ovl)
}
SegmentEnd = .;
SegmentSize = SegmentEnd - SegmentStart;

View File

@ -1,3 +1,9 @@
/*
* File: z_dm_ravine.c
* Overlay: ovl_Dm_Ravine
* Description: Lost Woods Cutscene - Tree Trunk
*/
#include "z_dm_ravine.h"
#define FLAGS 0x00000030
@ -6,10 +12,10 @@
void DmRavine_Init(Actor* thisx, GlobalContext* globalCtx);
void DmRavine_Destroy(Actor* thisx, GlobalContext* globalCtx);
void DmRavine_DoNothing(DmRavine* this, GlobalContext* globalCtx);
void DmRavine_Update(Actor* thisx, GlobalContext* globalCtx);
void DmRavine_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
const ActorInit Dm_Ravine_InitVars = {
ACTOR_DM_RAVINE,
ACTORCAT_ITEMACTION,
@ -19,16 +25,55 @@ const ActorInit Dm_Ravine_InitVars = {
(ActorFunc)DmRavine_Init,
(ActorFunc)DmRavine_Destroy,
(ActorFunc)DmRavine_Update,
(ActorFunc)DmRavine_Draw
(ActorFunc)DmRavine_Draw,
};
*/
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Ravine_0x80A2E7A0/DmRavine_Init.asm")
void DmRavine_Init(Actor* thisx, GlobalContext* globalCtx) {
DmRavine* this = THIS;
u8 flag = gSaveContext.perm.weekEventReg[0];
if (((flag & 0x10) | cREG(0)) != 0) {
Actor_MarkForDeath(&this->actor);
return;
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Ravine_0x80A2E7A0/DmRavine_Destroy.asm")
this->isActive = false;
globalCtx->roomContext.unk7A[0] = 1;
globalCtx->roomContext.unk7A[1] = 0;
this->state = 0;
Actor_SetScale(&this->actor, 1.0f);
this->actionFunc = DmRavine_DoNothing;
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Ravine_0x80A2E7A0/func_80A2E838.asm")
void DmRavine_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Ravine_0x80A2E7A0/DmRavine_Update.asm")
void DmRavine_DoNothing(DmRavine* this, GlobalContext* globalCtx) {
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Dm_Ravine_0x80A2E7A0/DmRavine_Draw.asm")
void DmRavine_Update(Actor* thisx, GlobalContext* globalCtx) {
DmRavine* this = THIS;
RoomContext* roomCtx;
switch ((DmRavineState) this->state) {
case DM_RAVINE_STATE_INITIALIZED:
return;
case DM_RAVINE_STATE_ACTIVE:
this->isActive = true;
globalCtx->roomContext.unk7A[1]++;
if (globalCtx->roomContext.unk7A[1] > 254) {
globalCtx->roomContext.unk7A[1] = 254;
if (globalCtx->csCtx.frames > 700) {
globalCtx->roomContext.unk7A[1] = 255;
globalCtx->roomContext.unk7A[0] = 0;
this->state++; // -> DM_RAVINE_STATE_PENDING_DEATH
}
}
break;
case DM_RAVINE_STATE_PENDING_DEATH:
Actor_MarkForDeath(&this->actor);
break;
}
}
void DmRavine_Draw(Actor* thisx, GlobalContext* globalCtx) {
}

View File

@ -5,9 +5,19 @@
struct DmRavine;
typedef void (*DmRavineActionFunc)(struct DmRavine*, GlobalContext*);
typedef enum {
/* 0 */ DM_RAVINE_STATE_INITIALIZED,
/* 1 */ DM_RAVINE_STATE_ACTIVE,
/* 2 */ DM_RAVINE_STATE_PENDING_DEATH,
} DmRavineState;
typedef struct DmRavine {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x8];
/* 0x144 */ DmRavineActionFunc actionFunc;
/* 0x148 */ u8 state;
/* 0x149 */ u8 isActive;
} DmRavine; // size = 0x14C
extern const ActorInit Dm_Ravine_InitVars;

View File

@ -10123,7 +10123,7 @@
0x80A2E268:("func_80A2E268",),
0x80A2E7A0:("DmRavine_Init",),
0x80A2E828:("DmRavine_Destroy",),
0x80A2E838:("func_80A2E838",),
0x80A2E838:("DmRavine_DoNothing",),
0x80A2E848:("DmRavine_Update",),
0x80A2E8F4:("DmRavine_Draw",),
0x80A2E960:("func_80A2E960",),