ObjBlockStop OK and documented (#788)

* init and func_809466F0 matching

* fully matching

* renamed functions

* added include and used oshihiki macro

* fixed spec to use correct reloc

* ran format

* cleaned up comments

* addressed the suggestions and used macro in ObjBlockstop_Update

* fixed one more cast

* ran format.sh

* EllipticEllipsis changes

* ran format

* renamed CheckCollision to CheckForBlock
This commit is contained in:
nckwntzl
2022-04-22 03:45:16 +01:00
committed by GitHub
parent 81efaf8551
commit bb784413b9
3 changed files with 46 additions and 11 deletions
+1 -2
View File
@@ -1547,8 +1547,7 @@ beginseg
name "ovl_Obj_Blockstop"
compress
include "build/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.o"
include "build/data/ovl_Obj_Blockstop/ovl_Obj_Blockstop.data.o"
include "build/data/ovl_Obj_Blockstop/ovl_Obj_Blockstop.reloc.o"
include "build/src/overlays/actors/ovl_Obj_Blockstop/ovl_Obj_Blockstop_reloc.o"
endseg
beginseg
@@ -5,6 +5,7 @@
*/
#include "z_obj_blockstop.h"
#include "overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h"
#define FLAGS (ACTOR_FLAG_10)
@@ -13,9 +14,9 @@
void ObjBlockstop_Init(Actor* thisx, GlobalContext* globalCtx);
void ObjBlockstop_Update(Actor* thisx, GlobalContext* globalCtx);
void func_809466F0(ObjBlockstop* this, GlobalContext* globalCtx);
void ObjBlockstop_CheckForBlock(ObjBlockstop* this, GlobalContext* globalCtx);
void ObjBlockstop_TryPlayCutscene(ObjBlockstop* this, GlobalContext* globalCtx);
#if 0
const ActorInit Obj_Blockstop_InitVars = {
ACTOR_OBJ_BLOCKSTOP,
ACTORCAT_PROP,
@@ -28,12 +29,47 @@ const ActorInit Obj_Blockstop_InitVars = {
(ActorFunc)NULL,
};
#endif
void ObjBlockstop_Init(Actor* thisx, GlobalContext* globalCtx) {
ObjBlockstop* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Blockstop/ObjBlockstop_Init.s")
if (Flags_GetSwitch(globalCtx, this->actor.params)) {
Actor_MarkForDeath(&this->actor);
}
this->actionFunc = ObjBlockstop_CheckForBlock;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Blockstop/func_809466F0.s")
void ObjBlockstop_CheckForBlock(ObjBlockstop* this, GlobalContext* globalCtx) {
Actor* prop = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].first;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Blockstop/func_809467E8.s")
while (prop != NULL) {
if ((prop->id == ACTOR_OBJ_OSHIHIKI) && (fabsf(prop->world.pos.x - this->actor.world.pos.x) < 20.0f) &&
(fabsf(prop->world.pos.z - this->actor.world.pos.z) < 20.0f) &&
(fabsf(prop->world.pos.y - this->actor.world.pos.y) < 20.0f)) {
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Blockstop/ObjBlockstop_Update.s")
s32 params = OBJOSHIHIKI_GET_F(prop);
if (params < 3) {
ActorCutscene_SetIntentToPlay(this->actor.cutscene);
this->actionFunc = ObjBlockstop_TryPlayCutscene;
}
}
prop = prop->next;
}
}
void ObjBlockstop_TryPlayCutscene(ObjBlockstop* this, GlobalContext* globalCtx) {
if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) {
Flags_SetSwitch(globalCtx, this->actor.params);
if (ActorCutscene_GetLength(this->actor.cutscene) != -1) {
ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor);
}
Actor_MarkForDeath(&this->actor);
return;
}
ActorCutscene_SetIntentToPlay(this->actor.cutscene);
}
void ObjBlockstop_Update(Actor* thisx, GlobalContext* globalCtx) {
ObjBlockstop* this = THIS;
this->actionFunc(this, globalCtx);
}
+2 -2
View File
@@ -7553,8 +7553,8 @@
0x80946368:("func_80946368",),
0x80946400:("EnGe1_Draw",),
0x809466A0:("ObjBlockstop_Init",),
0x809466F0:("func_809466F0",),
0x809467E8:("func_809467E8",),
0x809466F0:("ObjBlockstop_CheckForBlock",),
0x809467E8:("ObjBlockstop_TryPlayCutscene",),
0x8094685C:("ObjBlockstop_Update",),
0x809468D0:("EnSda_Init",),
0x809468E0:("EnSda_Destroy",),