From ae0e7f6cafc61ddec740f95744353d66bb02243f Mon Sep 17 00:00:00 2001 From: Bl00D4NGEL Date: Sat, 28 Sep 2024 23:16:52 +0200 Subject: [PATCH] document: Lockup from TTC --- include/enums.h | 1 + src/TTC/ch/lockup.c | 98 ++++++++++++++++++++++++--------------------- src/TTC/code_26D0.c | 12 +++--- 3 files changed, 59 insertions(+), 52 deletions(-) diff --git a/include/enums.h b/include/enums.h index 88800112..9d144a0b 100644 --- a/include/enums.h +++ b/include/enums.h @@ -3992,6 +3992,7 @@ enum asset_e ASSET_A0D_BLUBBER_COMPLETE = 0xA0D, ASSET_A14_TEXT_UNKNOWN = 0xA14, + ASSET_A15_TEXT_TTC_LOCKUP_SPAWNED = 0xA15, ASSET_A17_TEXT_BURIED_TREASURE_SPAWNED = 0xa17, diff --git a/src/TTC/ch/lockup.c b/src/TTC/ch/lockup.c index ae66bdde..0b39655c 100644 --- a/src/TTC/ch/lockup.c +++ b/src/TTC/ch/lockup.c @@ -5,15 +5,15 @@ extern void func_802EE6CC(f32[3], s32[4], s32[4], s32, f32, f32, s32, s32, s32); typedef struct { - s32 unk0; - s32 unk4; -}ActorLocal_Lockup; + s32 closed_ticks_counter; + s32 open_ticks_counter; +} ActorLocal_Lockup; -Actor *func_803894C0(ActorMarker *this, Gfx **gfx, Mtx **mtx, Vtx **vtx); -void func_80389600(Actor *this); +Actor *TTC_Lockup_drawFunc(ActorMarker *this, Gfx **gfx, Mtx **mtx, Vtx **vtx); +void TTC_Lockup_updateFunc(Actor *this); /* .data */ -ActorAnimationInfo D_8038C760[] ={ +ActorAnimationInfo TTC_LOCKUP_ANIMATIONS[6] ={ {0, 0.0f}, {ASSET_BC_ANIM_LOCKUP, 8000000.0f}, {ASSET_BC_ANIM_LOCKUP, 4.0f}, @@ -22,55 +22,61 @@ ActorAnimationInfo D_8038C760[] ={ {ASSET_BC_ANIM_LOCKUP, 8000000.0f} }; -ActorInfo D_8038C790 = { +ActorInfo TTC_LOCKUP_ACTOR_LOCKUP_SLOW = { MARKER_A4_LOCKUP_SLOW, ACTOR_151_LOCKUP_SLOW, ASSET_3D4_MODEL_LOCKUP, - 1, D_8038C760, - func_80389600, func_80326224, func_803894C0, + 1, TTC_LOCKUP_ANIMATIONS, + TTC_Lockup_updateFunc, func_80326224, TTC_Lockup_drawFunc, 2500, 0x366, 0.0f, 0 }; -ActorInfo D_8038C7B4 = { +ActorInfo TTC_LOCKUP_ACTOR_LOCKUP_MEDIUM = { MARKER_F6_LOCKUP_MEDIUM, ACTOR_152_LOCKUP_MEDIUM, ASSET_3D4_MODEL_LOCKUP, - 1, D_8038C760, - func_80389600, func_80326224, func_803894C0, + 1, TTC_LOCKUP_ANIMATIONS, + TTC_Lockup_updateFunc, func_80326224, TTC_Lockup_drawFunc, 2500, 0x366, 0.0f, 0 }; -ActorInfo D_8038C7D8 = { +ActorInfo TTC_LOCKUP_ACTOR_LOCKUP_FAST = { MARKER_F7_LOCKUP_FAST, ACTOR_153_LOCKUP_FAST, ASSET_3D4_MODEL_LOCKUP, - 1, D_8038C760, - func_80389600, func_80326224, func_803894C0, + 1, TTC_LOCKUP_ANIMATIONS, + TTC_Lockup_updateFunc, func_80326224, TTC_Lockup_drawFunc, 2500, 0x366, 0.0f, 0 }; -s32 D_8038C7FC[4] = {120, 120, 120, 120}; -s32 D_8038C80C[4] = {0,0,0,0}; +s32 TTC_LOCKUP_CLOSE_COLOR[4] = {120, 120, 120, 120}; +s32 TTC_LOCKUP_CLOSE_VELOCITY[3] = {0,0,0}; + +enum ttc_lockup_states_e { + TTC_LOCKUP_STATE_CLOSED = 1, // lockup closed (L803896F0) + TTC_LOCKUP_STATE_OPENING = 2, // lockup opened (L803897DC) + TTC_LOCKUP_STATE_OPEN = 3, // L80389864 + TTC_LOCKUP_STATE_CLOSING = 4, // L803898F4 + TTC_LOCKUP_STATE_CLOSING2 = 5 // L803898F4 +}; /* .code */ -Actor *func_803894C0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ +Actor *TTC_Lockup_drawFunc(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ Actor * actor = marker_getActor(marker); func_8033A45C(3, actor->unk38_31); func_8033A45C(4, actor->unk38_31); actor_draw(marker, gfx, mtx, vtx); - } -void TTC_func_80389530(Actor *this){ - subaddie_set_state_with_direction(this, 1, 0.2f, 1); +void TTC_Lockup_close(Actor *this){ + subaddie_set_state_with_direction(this, TTC_LOCKUP_STATE_CLOSED, 0.2f, 1); this->marker->collidable = FALSE; this->unk38_31 = 0; FUNC_8030E8B4(SFX_6C_LOCKUP_CLOSING, 1.0f, 32000, this->position, 1250, 2500); - } -void func_8038959C(Actor *this){ +void TTC_Lockup_open(Actor *this){ func_80389468(); - subaddie_set_state_with_direction(this, 2, 0.2f, 1); + subaddie_set_state_with_direction(this, TTC_LOCKUP_STATE_OPENING, 0.2f, 1); this->unk38_31 = 1; FUNC_8030E8B4(SFX_6B_LOCKUP_OPENING, 1.0f, 32000, this->position, 1250, 2500); } -void func_80389600(Actor *this){ +void TTC_Lockup_updateFunc(Actor *this){ ActorLocal_Lockup *local = (ActorLocal_Lockup *)&this->local; s32 tmp_v1; int i; @@ -81,25 +87,25 @@ void func_80389600(Actor *this){ && func_80329530(this, 320) && !func_80329530(this, 160) && !func_8028ECAC() - && gcdialog_showText(0xA15, 0, NULL, NULL, NULL, NULL) + && gcdialog_showText(ASSET_A15_TEXT_TTC_LOCKUP_SPAWNED, 0, NULL, NULL, NULL, NULL) ){ this->has_met_before = TRUE; - }//L803896AC + } if(!this->volatile_initialized){ this->volatile_initialized = TRUE; } switch(this->state){ - case 1: //L803896F0 + case TTC_LOCKUP_STATE_CLOSED: if(!this->initialized){ this->marker->propPtr->unk8_3 = TRUE; - subaddie_set_state_with_direction(this, 1, 0.2f, 1); + subaddie_set_state_with_direction(this, TTC_LOCKUP_STATE_CLOSED, 0.2f, 1); this->marker->collidable = FALSE; this->unk38_31 = 0; this->initialized = TRUE; - }//L80389758 - local->unk0++; + } + local->closed_ticks_counter++; tmp_v1 = (this->modelCacheIndex == ACTOR_151_LOCKUP_SLOW) ? 0x1E : (this->modelCacheIndex == ACTOR_152_LOCKUP_MEDIUM) ? 0x14 : @@ -107,47 +113,47 @@ void func_80389600(Actor *this){ 10000; - if(!(local->unk0 < tmp_v1)){ - local->unk0 = 0; - func_8038959C(this); + if(!(local->closed_ticks_counter < tmp_v1)){ + local->closed_ticks_counter = 0; + TTC_Lockup_open(this); } break; - case 2: //L803897DC + case TTC_LOCKUP_STATE_OPENING: if(subaddie_playerIsWithinSphere(this, 400) && func_8028FB48(0x8000000)){ func_8028F428(0xA, this->marker); } if(actor_animationIsAt(this, 0.5f)){ - subaddie_set_state_with_direction(this, 3, 0.5f, 1); + subaddie_set_state_with_direction(this, TTC_LOCKUP_STATE_OPEN, 0.5f, 1); } if(0.15 < animctrl_getAnimTimer(this->animctrl)){ this->marker->collidable = TRUE; } break; - case 3: //L80389864 - local->unk4++; + case TTC_LOCKUP_STATE_OPEN: + local->open_ticks_counter++; tmp_v1 = (this->modelCacheIndex == ACTOR_151_LOCKUP_SLOW) ? 0x1E : (this->modelCacheIndex == ACTOR_152_LOCKUP_MEDIUM) ? 0x14 : (this->modelCacheIndex == ACTOR_153_LOCKUP_FAST) ? 0xA : 10000; - if(!(local->unk4 < tmp_v1)){ - local->unk4 = 0; - subaddie_set_state_with_direction(this, 4, 0.5f, 1); + if(!(local->open_ticks_counter < tmp_v1)){ + local->open_ticks_counter = 0; + subaddie_set_state_with_direction(this, TTC_LOCKUP_STATE_CLOSING, 0.5f, 1); } break; - case 4: //L803898F4 - case 5: //L803898F4 + case TTC_LOCKUP_STATE_CLOSING: + case TTC_LOCKUP_STATE_CLOSING2: if(this->marker->unk14_21 && actor_animationIsAt(this, 0.99f)){ - TTC_func_80389530(this); + TTC_Lockup_close(this); for(i = 5; i < 0xe; i++){ func_8034A174(this->marker->unk44, i, this->unk1C); - func_802EE6CC(this->unk1C, D_8038C80C, D_8038C7FC, 1, 0.4f, 50.0f, 0xb4, 0xa0, 0); + func_802EE6CC(this->unk1C, TTC_LOCKUP_CLOSE_VELOCITY, TTC_LOCKUP_CLOSE_COLOR, 1, 0.4f, 50.0f, 0xb4, 0xa0, 0); } } break; - }//L8038999C + } } diff --git a/src/TTC/code_26D0.c b/src/TTC/code_26D0.c index 020e2199..5f535acd 100644 --- a/src/TTC/code_26D0.c +++ b/src/TTC/code_26D0.c @@ -17,9 +17,9 @@ extern ActorInfo D_8038C694; extern ActorInfo D_8038C6B8; extern ActorInfo D_8038C6DC; extern ActorInfo D_8038C718; -extern ActorInfo D_8038C790; -extern ActorInfo D_8038C7B4; -extern ActorInfo D_8038C7D8; +extern ActorInfo TTC_LOCKUP_ACTOR_LOCKUP_SLOW; +extern ActorInfo TTC_LOCKUP_ACTOR_LOCKUP_MEDIUM; +extern ActorInfo TTC_LOCKUP_ACTOR_LOCKUP_FAST; extern ActorInfo D_8038C8B0; extern ActorInfo D_8038C8D4; extern ActorInfo D_8038C8F8; @@ -96,9 +96,9 @@ void TTC_func_80388AC0(void) spawnableActorList_add(&D_8038C580, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_20 | ACTOR_FLAG_UNKNOWN_26); spawnableActorList_add(&TTC_BLUBBER_ACTOR_INFO, actor_new, ACTOR_FLAG_UNKNOWN_0 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_26); spawnableActorList_add(&D_8038C718, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_8); - spawnableActorList_add(&D_8038C790, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_8); - spawnableActorList_add(&D_8038C7B4, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_8); - spawnableActorList_add(&D_8038C7D8, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_8); + spawnableActorList_add(&TTC_LOCKUP_ACTOR_LOCKUP_SLOW, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_8); + spawnableActorList_add(&TTC_LOCKUP_ACTOR_LOCKUP_MEDIUM, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_8); + spawnableActorList_add(&TTC_LOCKUP_ACTOR_LOCKUP_FAST, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_8); spawnableActorList_add(&D_8038C8B0, actor_new, ACTOR_FLAG_UNKNOWN_10); spawnableActorList_add(&D_8038C8D4, actor_new, ACTOR_FLAG_UNKNOWN_10); spawnableActorList_add(&D_8038C8F8, actor_new, ACTOR_FLAG_UNKNOWN_10);