diff options
| author | Anghelo Carvajal <angheloalf95@gmail.com> | 2022-12-08 16:47:03 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-08 16:47:03 -0300 |
| commit | a5425e4ffc87b6cdc65200c703b6ce94383cfa90 (patch) | |
| tree | ffe4bcabf81316710de8fa76d3e43495ebd5dd13 /src/code | |
| parent | bbbe0b1821febc653233c48e47fd492f95e5bc0d (diff) | |
Import `EnAObj`'s data and a few cleanups (#1111)
* try to import data
* bss
* spec
* name actionfuncs
* macros for params
* review
Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>
Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>
Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>
Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/z_en_a_keep.c | 75 |
1 files changed, 62 insertions, 13 deletions
diff --git a/src/code/z_en_a_keep.c b/src/code/z_en_a_keep.c index 267da4e40..a9bd49f6f 100644 --- a/src/code/z_en_a_keep.c +++ b/src/code/z_en_a_keep.c @@ -1,21 +1,65 @@ #include "global.h" +#include "assets/objects/gameplay_keep/gameplay_keep.h" + +#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) #define THIS ((EnAObj*)thisx) -void EnAObj_Update1(EnAObj* this, PlayState* play); -void EnAObj_Update2(EnAObj* this, PlayState* play); +void EnAObj_Init(Actor* thisx, PlayState* play); +void EnAObj_Destroy(Actor* thisx, PlayState* play); +void EnAObj_Update(Actor* thisx, PlayState* play); +void EnAObj_Draw(Actor* thisx, PlayState* play); + +void EnAObj_Idle(EnAObj* this, PlayState* play); +void EnAObj_Talk(EnAObj* this, PlayState* play); + +ActorInit En_A_Obj_InitVars = { + ACTOR_EN_A_OBJ, + ACTORCAT_PROP, + FLAGS, + GAMEPLAY_KEEP, + sizeof(EnAObj), + (ActorFunc)EnAObj_Init, + (ActorFunc)EnAObj_Destroy, + (ActorFunc)EnAObj_Update, + (ActorFunc)EnAObj_Draw, +}; + +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_NONE, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE, + BUMP_NONE, + OCELEM_ON, + }, + { 25, 60, 0, { 0, 0, 0 } }, +}; + +static InitChainEntry sInitChain[] = { + ICHAIN_U8(targetMode, 0, ICHAIN_STOP), +}; void EnAObj_Init(Actor* thisx, PlayState* play) { EnAObj* this = THIS; - this->actor.textId = ((this->actor.params >> 8) & 0xFF) | 0x300; - this->actor.params = (this->actor.params & 0xFF) - 9; - Actor_ProcessInitChain(&this->actor, &enAObjInitVar); + this->actor.textId = AOBJ_GET_TEXTID(&this->actor); + this->actor.params = AOBJ_GET_TYPE(&this->actor); + Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 12); - Collider_InitAndSetCylinder(play, &this->collision, &this->actor, &enAObjCylinderInit); + Collider_InitAndSetCylinder(play, &this->collision, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collision); this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->actionFunc = EnAObj_Update1; + this->actionFunc = EnAObj_Idle; } void EnAObj_Destroy(Actor* thisx, PlayState* play) { @@ -24,23 +68,23 @@ void EnAObj_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collision); } -void EnAObj_Update1(EnAObj* this, PlayState* play) { +void EnAObj_Idle(EnAObj* this, PlayState* play) { s32 yawDiff; if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - this->actionFunc = EnAObj_Update2; + this->actionFunc = EnAObj_Talk; } else { yawDiff = ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)); - if ((yawDiff < 0x2800) || ((this->actor.params == 1) && (yawDiff > 0x5800))) { + if ((yawDiff < 0x2800) || ((this->actor.params == AOBJ_SIGNPOST_ARROW) && (yawDiff > 0x5800))) { func_800B863C(&this->actor, play); } } } -void EnAObj_Update2(EnAObj* this, PlayState* play) { +void EnAObj_Talk(EnAObj* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { - this->actionFunc = EnAObj_Update1; + this->actionFunc = EnAObj_Idle; } } @@ -52,6 +96,11 @@ void EnAObj_Update(Actor* thisx, PlayState* play) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collision.base); } +static Gfx* sDLists[] = { + gSignRectangularDL, // AOBJ_SIGNPOST_OBLONG + gSignDirectionalDL, // AOBJ_SIGNPOST_ARROW +}; + void EnAObj_Draw(Actor* thisx, PlayState* play) { - Gfx_DrawDListOpa(play, enAObjDisplayLists[thisx->params]); + Gfx_DrawDListOpa(play, sDLists[thisx->params]); } |
