diff options
| author | Prakxo <87568477+Prakxo@users.noreply.github.com> | 2023-12-04 18:54:21 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-04 10:54:21 -0700 |
| commit | 2de3373647fb4d0cc14ec6a485dac3aec5c0f561 (patch) | |
| tree | dd996fa1c1b0f3c066b4c02177f96bae025e98db /src | |
| parent | 18b20e709c278f791f137518e0262ffd104e1243 (diff) | |
ac_train_door OK (#122)
* ac_train_door OK
* review
Diffstat (limited to 'src')
| -rw-r--r-- | src/overlays/actors/ovl_TrainDoor/ac_train_door.c | 67 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_TrainDoor/ac_train_door.h | 16 |
2 files changed, 69 insertions, 14 deletions
diff --git a/src/overlays/actors/ovl_TrainDoor/ac_train_door.c b/src/overlays/actors/ovl_TrainDoor/ac_train_door.c index f7d7105..c1419be 100644 --- a/src/overlays/actors/ovl_TrainDoor/ac_train_door.c +++ b/src/overlays/actors/ovl_TrainDoor/ac_train_door.c @@ -1,6 +1,8 @@ #include "ac_train_door.h" #include "m_actor_dlftbls.h" #include "m_object.h" +#include "m_rcp.h" +#include "6F5550.h" #include "overlays/gamestates/ovl_play/m_play.h" void aTRD_actor_ct(Actor* thisx, Game_Play* game_play); @@ -8,7 +10,6 @@ void aTRD_actor_dt(Actor* thisx, Game_Play* game_play); void aTRD_actor_move(Actor* thisx, Game_Play* game_play); void aTRD_actor_draw(Actor* thisx, Game_Play* game_play); -#if 0 ActorProfile TrainDoor_Profile = { /* */ ACTOR_TRAIN_DOOR, /* */ ACTOR_PART_4, @@ -22,14 +23,66 @@ ActorProfile TrainDoor_Profile = { /* */ aTRD_actor_draw, /* */ NULL, }; -#endif -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_TrainDoor/ac_train_door/aTRD_actor_ct.s") +extern BaseSkeletonR cKF_bs_r_obj_romtrain_door; +extern BaseAnimationR cKF_ba_r_obj_romtrain_door; -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_TrainDoor/ac_train_door/aTRD_actor_dt.s") +void aTRD_actor_ct(Actor* thisx, UNUSED Game_Play* game_play) { + TrainDoor* this = (TrainDoor*)thisx; -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_TrainDoor/ac_train_door/func_80972AB0_jp.s") + cKF_SkeletonInfo_R_ct(&this->skeletonInfo, &cKF_bs_r_obj_romtrain_door, NULL, this->work, this->target); + cKF_SkeletonInfo_R_init(&this->skeletonInfo, this->skeletonInfo.skeleton, &cKF_ba_r_obj_romtrain_door, 1.0f, 51.0f, + 1.0f, 0.0f, 0.0f, 0, NULL); + this->skeletonInfo.morphCounter = 0.0f; + cKF_SkeletonInfo_R_play(&this->skeletonInfo); +} -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_TrainDoor/ac_train_door/aTRD_actor_move.s") +void aTRD_actor_dt(Actor* thisx, UNUSED Game_Play* game_play) { + TrainDoor* this = (TrainDoor*)thisx; -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_TrainDoor/ac_train_door/aTRD_actor_draw.s") + cKF_SkeletonInfo_R_dt(&this->skeletonInfo); +} + +void aTRD_set_door_SE(Actor* thisx) { + static s32 chk_pat[] = { 2, 27 }; + static u16 se_no[] = { 1042, 1043 }; + TrainDoor* this = (TrainDoor*)thisx; + s32 i; + + for (i = 0; i < 2; i++) { + if ((s32)this->skeletonInfo.frameControl.currentFrame == chk_pat[i]) { + sAdo_OngenTrgStart(se_no[i], &this->actor.world.pos); + return; + } + } +} + +void aTRD_actor_move(Actor* thisx, UNUSED Game_Play* game_play) { + TrainDoor* this = (TrainDoor*)thisx; + SkeletonInfoR* skeletonInfo = &this->skeletonInfo; + + if (this->idle == 1) { + this->idle = 0; + this->skeletonInfo.frameControl.speed = 1.0f; + } + + if (cKF_SkeletonInfo_R_play(&this->skeletonInfo) == 1) { + skeletonInfo->frameControl.currentFrame = skeletonInfo->frameControl.start; + skeletonInfo->frameControl.speed = 0.0f; + } + aTRD_set_door_SE(thisx); +} + +void aTRD_actor_draw(Actor* thisx, Game_Play* game_play) { + TrainDoor* this = (TrainDoor*)thisx; + Gfx* mtx; + Mtx* mtxp; + + mtx = GRAPH_ALLOC_NO_ALIGN(game_play->state.gfxCtx, this->skeletonInfo.skeleton->unk01 * sizeof(Mtx)); + + mtxp = (Mtx*)mtx; + if (mtxp != NULL) { + _texture_z_light_fog_prim(game_play->state.gfxCtx); + cKF_Si3_draw_R_SV(game_play, &this->skeletonInfo, mtxp, NULL, NULL, NULL); + } +} diff --git a/src/overlays/actors/ovl_TrainDoor/ac_train_door.h b/src/overlays/actors/ovl_TrainDoor/ac_train_door.h index b85a00c..5e2a149 100644 --- a/src/overlays/actors/ovl_TrainDoor/ac_train_door.h +++ b/src/overlays/actors/ovl_TrainDoor/ac_train_door.h @@ -3,16 +3,18 @@ #include "ultra64.h" #include "m_actor.h" +#include "c_keyframe.h" #include "unk.h" -struct Game_Play; -struct TrainDoor; - -typedef void (*TrainDoorActionFunc)(struct TrainDoor*, struct Game_Play*); - typedef struct TrainDoor { /* 0x000 */ Actor actor; - /* 0x174 */ UNK_TYPE1 unk_174[0xD0]; -} TrainDoor; // size = 0x244 + /* 0x174 */ UNK_TYPE1 unk_174 [0x17C - 0x174]; + /* 0x17C */ SkeletonInfoR skeletonInfo; + /* 0x1EC */ UNK_TYPE1 unk_1EC [0x210 - 0x1EC]; + /* 0x210 */ s_xyz work[4]; + /* 0x228 */ s_xyz target[4]; + /* 0x240 */ s32 idle; +}TrainDoor; // size = 0x244 + #endif |
