ovl_En_Talk OK (#484)

* Implement EnTalk_Init

* Implement EnTalk_Destroy

* Implement func_80BDE058

* Implement func_80BDE090

* Clean up code

* Apply suggestions from code review

Co-authored-by: Parker Burnett <burnettparker@gmail.com>

* Remove whitespace

* Update src/overlays/actors/ovl_En_Talk/z_en_talk.h

Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com>

* Use renamed macro

* Apply feedback

Co-authored-by: Parker Burnett <burnettparker@gmail.com>
Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com>
This commit is contained in:
Nick Sturgeon 2021-12-26 21:21:01 -05:00 committed by GitHub
parent 5b7fb5bfde
commit 2d15fd4a41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 10 deletions

3
spec
View File

@ -4897,8 +4897,7 @@ beginseg
name "ovl_En_Talk"
compress
include "build/src/overlays/actors/ovl_En_Talk/z_en_talk.o"
include "build/data/ovl_En_Talk/ovl_En_Talk.data.o"
include "build/data/ovl_En_Talk/ovl_En_Talk.reloc.o"
include "build/src/overlays/actors/ovl_En_Talk/ovl_En_Talk_reloc.o"
endseg
beginseg

View File

@ -13,11 +13,9 @@
void EnTalk_Init(Actor* thisx, GlobalContext* globalCtx);
void EnTalk_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnTalk_Update(Actor* thisx, GlobalContext* globalCtx);
void func_80BDE058(EnTalk* this, GlobalContext* globalCtx);
void func_80BDE090(EnTalk* this, GlobalContext* globalCtx);
#if 0
const ActorInit En_Talk_InitVars = {
ACTOR_EN_TALK,
ACTORCAT_ITEMACTION,
@ -30,14 +28,42 @@ const ActorInit En_Talk_InitVars = {
(ActorFunc)NULL,
};
#endif
void EnTalk_Init(Actor* thisx, GlobalContext* globalCtx) {
EnTalk* this = THIS;
s8 targetMode = this->actor.home.rot.x - 0x1;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Talk/EnTalk_Init.s")
if (targetMode >= 0 && targetMode < 7) {
this->actor.targetMode = targetMode;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Talk/EnTalk_Destroy.s")
Actor_SetScale(&this->actor, 1.0f);
this->actionFunc = func_80BDE090;
this->actor.textId = ENTALK_GET_TEXT_ID(&this->actor);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Talk/func_80BDE058.s")
void EnTalk_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Talk/func_80BDE090.s")
void func_80BDE058(EnTalk* this, GlobalContext* globalCtx) {
if (func_800B867C(&this->actor, globalCtx)) {
this->actionFunc = func_80BDE090;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Talk/EnTalk_Update.s")
void func_80BDE090(EnTalk* this, GlobalContext* globalCtx) {
if (func_800B84D0(&this->actor, globalCtx)) {
this->actionFunc = func_80BDE058;
return;
}
if ((this->actor.xzDistToPlayer < 40.0f && Actor_IsLinkFacingActor(&this->actor, 0x3000, globalCtx)) ||
this->actor.isTargeted) {
func_800B8614(&this->actor, globalCtx, 120.0f);
}
}
void EnTalk_Update(Actor* thisx, GlobalContext* globalCtx) {
EnTalk* this = THIS;
this->actionFunc(this, globalCtx);
}

View File

@ -3,6 +3,8 @@
#include "global.h"
#define ENTALK_GET_TEXT_ID(thisx) (((thisx)->params & 0x3F) + 0x1C00)
struct EnTalk;
typedef void (*EnTalkActionFunc)(struct EnTalk*, GlobalContext*);