From bedd22fc408c880e8877c839a068367e11a06623 Mon Sep 17 00:00:00 2001 From: Bl00D4NGEL Date: Sun, 29 Sep 2024 00:27:02 +0200 Subject: [PATCH] document: Nipper from TTC --- include/enums.h | 3 + src/TTC/ch/blubber.c | 2 +- src/TTC/ch/lockup.c | 6 +- src/TTC/ch/nipper.c | 149 +++++++++++++++++++++++-------------------- src/TTC/code_26D0.c | 20 +++--- 5 files changed, 96 insertions(+), 84 deletions(-) diff --git a/include/enums.h b/include/enums.h index 9d144a0b..d1233827 100644 --- a/include/enums.h +++ b/include/enums.h @@ -3990,6 +3990,9 @@ enum asset_e ASSET_A0B_FIRST_MEET_BLUBBER = 0xA0B, ASSET_A0C_BLUBBER_HALF_GOLD = 0xA0C, ASSET_A0D_BLUBBER_COMPLETE = 0xA0D, + ASSET_A0E_NIPPER_SPAWNED = 0xA0E, + + ASSET_A10_TEXT_TTC_NIPPER_HURT = 0xA10, ASSET_A14_TEXT_UNKNOWN = 0xA14, ASSET_A15_TEXT_TTC_LOCKUP_SPAWNED = 0xA15, diff --git a/src/TTC/ch/blubber.c b/src/TTC/ch/blubber.c index 0aeb7c01..06f534b3 100644 --- a/src/TTC/ch/blubber.c +++ b/src/TTC/ch/blubber.c @@ -44,7 +44,7 @@ ActorAnimationInfo TTC_BLUBBER_ACTOR_ANIMATIONS[6] = { {ASSET_B8_ANIM_BLUBBER_RUN, 0.8f} }; -ActorInfo TTC_BLUBBER_ACTOR_INFO = { +ActorInfo TTC_BLUBBER_ACTOR = { MARKER_A3_BLUBBER, ACTOR_115_BLUBBER, ASSET_370_MODEL_BLUBBER, 0x1, TTC_BLUBBER_ACTOR_ANIMATIONS, TTC_Blubber_updateFunc, TTC_Blubber_update2Func, TTC_Blubber_drawFunc, diff --git a/src/TTC/ch/lockup.c b/src/TTC/ch/lockup.c index 0b39655c..2f097e25 100644 --- a/src/TTC/ch/lockup.c +++ b/src/TTC/ch/lockup.c @@ -22,21 +22,21 @@ ActorAnimationInfo TTC_LOCKUP_ANIMATIONS[6] ={ {ASSET_BC_ANIM_LOCKUP, 8000000.0f} }; -ActorInfo TTC_LOCKUP_ACTOR_LOCKUP_SLOW = { +ActorInfo TTC_LOCKUP_ACTOR_SLOW = { MARKER_A4_LOCKUP_SLOW, ACTOR_151_LOCKUP_SLOW, ASSET_3D4_MODEL_LOCKUP, 1, TTC_LOCKUP_ANIMATIONS, TTC_Lockup_updateFunc, func_80326224, TTC_Lockup_drawFunc, 2500, 0x366, 0.0f, 0 }; -ActorInfo TTC_LOCKUP_ACTOR_LOCKUP_MEDIUM = { +ActorInfo TTC_LOCKUP_ACTOR_MEDIUM = { MARKER_F6_LOCKUP_MEDIUM, ACTOR_152_LOCKUP_MEDIUM, ASSET_3D4_MODEL_LOCKUP, 1, TTC_LOCKUP_ANIMATIONS, TTC_Lockup_updateFunc, func_80326224, TTC_Lockup_drawFunc, 2500, 0x366, 0.0f, 0 }; -ActorInfo TTC_LOCKUP_ACTOR_LOCKUP_FAST = { +ActorInfo TTC_LOCKUP_ACTOR_FAST = { MARKER_F7_LOCKUP_FAST, ACTOR_153_LOCKUP_FAST, ASSET_3D4_MODEL_LOCKUP, 1, TTC_LOCKUP_ANIMATIONS, TTC_Lockup_updateFunc, func_80326224, TTC_Lockup_drawFunc, diff --git a/src/TTC/ch/nipper.c b/src/TTC/ch/nipper.c index 279c44c9..8351d1a9 100644 --- a/src/TTC/ch/nipper.c +++ b/src/TTC/ch/nipper.c @@ -2,12 +2,12 @@ #include "functions.h" #include "variables.h" -void func_80388434(Actor *this); -Actor *func_80387EB0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); +void TTC_Nipper_updateFunc(Actor *this); +Actor *TTC_Nipper_animFunc(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); /* .data */ -ActorAnimationInfo D_8038C540[] = { +ActorAnimationInfo TTC_NIPPER_ANIMATIONS[8] = { {0x00, 0.0f}, {ASSET_C0_ANIM_NIPPER_IDLE, 2.0f}, {ASSET_BD_ANIM_NIPPER_VULNERABLE, 1.5f}, @@ -18,17 +18,25 @@ ActorAnimationInfo D_8038C540[] = { {0x00, 0.0f} }; -ActorInfo D_8038C580 = { +ActorInfo TTC_NIPPER_ACTOR = { MARKER_A5_NIPPER, ACTOR_117_NIPPER, ASSET_3D5_MODEL_NIPPER, - 0x1, D_8038C540, - func_80388434, func_80326224, func_80387EB0, + 0x1, TTC_NIPPER_ANIMATIONS, + TTC_Nipper_updateFunc, func_80326224, TTC_Nipper_animFunc, 0, 0x299, 10.0f, 0 }; - +enum ttc_lockup_states_e { + TTC_NIPPER_STATE_1_UNKNOWN = 1, // L80388578 + TTC_NIPPER_STATE_2_UNKNOWN = 2, // L8038872C + TTC_NIPPER_STATE_3_UNKNOWN = 3, // L803887B4 + TTC_NIPPER_STATE_DIEING = 4, // L80388910 + TTC_NIPPER_STATE_SPAWNED = 5, // L80388938 + TTC_NIPPER_STATE_DEAD = 6, // L803889A8 + TTC_NIPPER_STATE_7_UNKNOWN = 7 // already dead? L80388A20 +}; /* .code */ -void func_80387DC0(f32 *position, s32 count) { +void TTC_Nipper_drawParticlesAtPosition(f32 *position, s32 count) { static s32 D_8038C5A4[3] = {180, 180, 180}; static ParticleScaleAndLifetimeRanges D_8038C5B0 = { {0.1f, 0.5f}, @@ -57,7 +65,7 @@ void func_80387DC0(f32 *position, s32 count) { particleEmitter_emitN(pCtrl, count); } -Actor *func_80387EB0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { +Actor *TTC_Nipper_animFunc(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { Actor *this; this = marker_getActor(marker); @@ -65,42 +73,44 @@ Actor *func_80387EB0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { return actor_draw(marker, gfx, mtx, vtx); } -void TTC_func_80387F18(Actor *this) { - subaddie_set_state_looped(this, 3); +void TTC_Nipper_setAnimationDuration(Actor *this) { + subaddie_set_state_looped(this, TTC_NIPPER_STATE_3_UNKNOWN); this->unk1C[0] = 0.0f; switch((s32)this->lifetime_value){ - case 0x78: + case 120: animctrl_setDuration(this->animctrl, 1.2f); break; - case 0x50: + case 80: animctrl_setDuration(this->animctrl, 1.05f); break; - case 0x28: + case 40: animctrl_setDuration(this->animctrl, 0.9f); break; } } -void TTC_func_80387FB0(ActorMarker *caller, enum asset_e text_id, s32 arg2){ +void TTC_Nipper_spawnedShowTextCallback(ActorMarker *caller, enum asset_e text_id, s32 arg2){ Actor *this; this = marker_getActor(caller); - TTC_func_80387F18(this); + TTC_Nipper_setAnimationDuration(this); ncStaticCamera_exit(); comusic_8025AB44(COMUSIC_12_TTC_NIPPER, -1, 300); } -void TTC_func_80387FF4(Actor *this) { +void TTC_Nipper_playDeathAnimation(Actor *this) { s32 i; - subaddie_set_state_with_direction(this, 4, 0.01f, 1); + subaddie_set_state_with_direction(this, TTC_NIPPER_STATE_DIEING, 0.01f, 1); actor_playAnimationOnce(this); for(i = 0; i < 3; i ++){ FUNC_8030E8B4(SFX_79_TICKER_DEATH, 0.5f, 17000, this->position, 1500, 3000); }; } +// if player too far away -> false +// otherwise return whether sp2C is within -35 and 35? bool func_80388088(Actor *this){ f32 sp2C; f32 sp20[3]; @@ -115,11 +125,11 @@ bool func_80388088(Actor *this){ return BOOL(-35.0f < sp2C && sp2C < 35.0f); } -bool func_8038812C(Actor *this){ +bool TTC_Nipper_shouldShowActor(Actor *this){ return BOOL(func_80329530(this, 1300) && func_80388088(this)); } -void func_80388178(ActorMarker *this_marker, ActorMarker *other_marker) { +void TTC_Nipper_dieFunc(ActorMarker *this_marker, ActorMarker *other_marker) { Actor *this; s32 i; @@ -127,31 +137,31 @@ void func_80388178(ActorMarker *this_marker, ActorMarker *other_marker) { func_8032B4DC(this, other_marker, 7); if (this->lifetime_value == 40.0f) { - subaddie_set_state_with_direction(this, 6, 0.01f, 1); + subaddie_set_state_with_direction(this, TTC_NIPPER_STATE_DEAD, 0.01f, 1); actor_playAnimationOnce(this); for(i = 0; i < 3; i++){ FUNC_8030E8B4(SFX_78_EAGLECRY, 0.7f, 20000, this->position, 1500, 3000); }; comusic_8025AB44(COMUSIC_12_TTC_NIPPER, 0, 300); - func_8025AABC(0x12); + func_8025AABC(COMUSIC_12_TTC_NIPPER); func_8032BB88(this, -1, 300); func_802BAFE4(0x1C); return; } if (this->lifetime_value == 80.0f) { - TTC_func_80387FF4(this); + TTC_Nipper_playDeathAnimation(this); this->lifetime_value = 40.0f; return; } - TTC_func_80387FF4(this); + TTC_Nipper_playDeathAnimation(this); this->lifetime_value = 80.0f; - gcdialog_showText(0xA10, 4, NULL, NULL, NULL, NULL); + gcdialog_showText(ASSET_A10_TEXT_TTC_NIPPER_HURT, 4, NULL, NULL, NULL, NULL); return; } -bool func_803882E4(ActorMarker * this_marker, ActorMarker * other_marker){ +bool TTC_Nipper_determineMarkeId(ActorMarker * this_marker, ActorMarker * other_marker){ if(this_marker->unk40_31 == 1){ this_marker->id = 0x16C; } @@ -161,7 +171,7 @@ bool func_803882E4(ActorMarker * this_marker, ActorMarker * other_marker){ return TRUE; } -void func_80388344(ActorMarker * this_marker, ActorMarker *other_marker){ +void TTC_Nipper_ow2Func(ActorMarker * this_marker, ActorMarker *other_marker){ Actor *this; if(other_marker->id == 1){ @@ -175,7 +185,7 @@ void func_80388344(ActorMarker * this_marker, ActorMarker *other_marker){ } } -void func_803883C8(ActorMarker * this_marker, ActorMarker *other_marker){ +void TTC_Nipper_owFunc(ActorMarker * this_marker, ActorMarker *other_marker){ Actor *this = marker_getActor(this_marker); if( !this->unk138_23 && this->has_met_before @@ -185,68 +195,67 @@ void func_803883C8(ActorMarker * this_marker, ActorMarker *other_marker){ } } -void func_80388434(Actor *this){ - f32 sp4C[3]; +void TTC_Nipper_updateFunc(Actor *this){ + f32 particlePosition[3]; s32 sp48; - s32 sp44; - f32 sp38[3]; + s32 xVelocity; + f32 playerPosition[3]; s32 temp_v0; - player_getPosition(sp38); - sp44 = func_80309D58(sp38, 1); + player_getPosition(playerPosition); + xVelocity = func_80309D58(playerPosition, 1); if(!this->volatile_initialized){ this->volatile_initialized = TRUE; - this->velocity_x = sp44; + this->velocity_x = xVelocity; func_8032BC18(this); } - if(this->state != 7){ - // sp30 = sp44; - if(0.0f == this->velocity_x && sp44){ + if(this->state != TTC_NIPPER_STATE_7_UNKNOWN){ + if(0.0f == this->velocity_x && xVelocity){ comusic_8025AB44(COMUSIC_12_TTC_NIPPER, -1, 5000); func_8032BB88(this, 0, 4000); func_8024BD08(0); } - else if(!sp44 && 0.0f != this->velocity_x){ + else if(!xVelocity && 0.0f != this->velocity_x){ comusic_8025AB44(COMUSIC_12_TTC_NIPPER, 0, 300); func_8025AABC(COMUSIC_12_TTC_NIPPER); func_8032BB88(this, -1, 300); func_8024BD08(1); } - this->velocity_x = sp44; - }//L80388554 + this->velocity_x = xVelocity; + } switch(this->state){ - case 1:// L80388578 + case TTC_NIPPER_STATE_1_UNKNOWN: if(!this->initialized){ animctrl_setTransitionDuration(this->animctrl, 0.35f); - subaddie_set_state_with_direction(this, 1, 0.01f, 1); + subaddie_set_state_with_direction(this, TTC_NIPPER_STATE_1_UNKNOWN, 0.01f, 1); this->lifetime_value = 120.0f; this->marker->propPtr->unk8_3 = TRUE; - marker_setCollisionScripts(this->marker, func_803883C8, func_80388344, func_80388178); - func_803300C0(this->marker, func_803882E4); + marker_setCollisionScripts(this->marker, TTC_Nipper_owFunc, TTC_Nipper_ow2Func, TTC_Nipper_dieFunc); + func_803300C0(this->marker, TTC_Nipper_determineMarkeId); this->initialized = TRUE; - }//L8038860C - if(func_8038812C(this)){ + } + + if(TTC_Nipper_shouldShowActor(this)){ temp_v0 = func_8028ECAC(); if( !this->has_met_before && temp_v0 != 1 && temp_v0 != 10 ){ - subaddie_set_state_with_direction(this, 5, 0.01f, 1); - if(gcdialog_showText(0xa0e, 0xf, this->position, this->marker, TTC_func_80387FB0, NULL)){ + subaddie_set_state_with_direction(this, TTC_NIPPER_STATE_SPAWNED, 0.01f, 1); + if(gcdialog_showText(ASSET_A0E_NIPPER_SPAWNED, 0xf, this->position, this->marker, TTC_Nipper_spawnedShowTextCallback, NULL)){ this->has_met_before = TRUE; } comusic_8025AB44(COMUSIC_12_TTC_NIPPER, 5000, 300); ncStaticCamera_setToNode(11); } - else{//L803886B0 - TTC_func_80387F18(this); + else{ + TTC_Nipper_setAnimationDuration(this); } break; } - //L803886C0 if( actor_animationIsAt(this, 0.2f) || actor_animationIsAt(this, 0.2f) || actor_animationIsAt(this, 0.6f) @@ -256,35 +265,35 @@ void func_80388434(Actor *this){ } break; - case 2:// L8038872C - if(!func_8038812C(this)){ - subaddie_set_state_looped(this, 1); + case TTC_NIPPER_STATE_2_UNKNOWN: + if(!TTC_Nipper_shouldShowActor(this)){ + subaddie_set_state_looped(this, TTC_NIPPER_STATE_1_UNKNOWN); break; } if(this->lifetime_value <= this->unk38_31){ - TTC_func_80387F18(this); + TTC_Nipper_setAnimationDuration(this); break; } this->unk38_31++; break; - case 3:// L803887B4 + case TTC_NIPPER_STATE_3_UNKNOWN: if(actor_animationIsAt(this, 0.5f) && this->marker->unk14_21){ - func_8034A174(this->marker->unk44, 6, sp4C); - func_80387DC0(sp4C, 2); + func_8034A174(this->marker->unk44, 6, particlePosition); + TTC_Nipper_drawParticlesAtPosition(particlePosition, 2); } else if(actor_animationIsAt(this, 0.95f) && this->marker->unk14_21){//L80388800 - func_8034A174(this->marker->unk44, 5, sp4C); - func_80387DC0(sp4C, 2); - }//L80388848 + func_8034A174(this->marker->unk44, 5, particlePosition); + TTC_Nipper_drawParticlesAtPosition(particlePosition, 2); + } if(actor_animationIsAt(this, 0.99f)){ this->unk1C[0] += 1.0f; } if(2.0f <= this->unk1C[0]){ - subaddie_set_state_looped(this, 2); + subaddie_set_state_looped(this, TTC_NIPPER_STATE_2_UNKNOWN); this->unk38_31 = 0; break; } @@ -298,13 +307,13 @@ void func_80388434(Actor *this){ } break; - case 4:// L80388910 + case TTC_NIPPER_STATE_DIEING: if(actor_animationIsAt(this, 0.99f)){ - TTC_func_80387F18(this); + TTC_Nipper_setAnimationDuration(this); } break; - case 5:// L80388938 + case TTC_NIPPER_STATE_SPAWNED: if( actor_animationIsAt(this, 0.2f) || actor_animationIsAt(this, 0.2f) || actor_animationIsAt(this, 0.6f) @@ -314,7 +323,7 @@ void func_80388434(Actor *this){ } break; - case 6:// L803889A8 + case TTC_NIPPER_STATE_DEAD: this->marker->collidable = FALSE; if(actor_animationIsAt(this, 0.6f)){ FUNC_8030E8B4(SFX_7C_CHEBOOF, 0.9f, 20000, this->position, 1500, 3000); @@ -322,11 +331,11 @@ void func_80388434(Actor *this){ } if(actor_animationIsAt(this, 0.99f)){ - subaddie_set_state_with_direction(this, 7, 0.01f, 1); + subaddie_set_state_with_direction(this, TTC_NIPPER_STATE_7_UNKNOWN, 0.01f, 1); } break; - case 7:// L80388A20 + case TTC_NIPPER_STATE_7_UNKNOWN: this->marker->collidable = FALSE; break; @@ -342,5 +351,5 @@ bool func_80388A44(s16 arg0[3]){ sp1C[2] = (f32) arg0[2]; nipper = actorArray_findClosestActorFromActorId(sp1C, ACTOR_117_NIPPER, -1, NULL); - return nipper->state == 7; + return nipper->state == TTC_NIPPER_STATE_7_UNKNOWN; } diff --git a/src/TTC/code_26D0.c b/src/TTC/code_26D0.c index 5f535acd..4e625588 100644 --- a/src/TTC/code_26D0.c +++ b/src/TTC/code_26D0.c @@ -6,8 +6,8 @@ #include "actor.h" extern ActorInfo chClam; -extern ActorInfo TTC_BLUBBER_ACTOR_INFO; -extern ActorInfo D_8038C580; +extern ActorInfo TTC_BLUBBER_ACTOR; +extern ActorInfo TTC_NIPPER_ACTOR; extern ActorInfo D_8038C5E0; extern ActorInfo D_8038C604; extern ActorInfo D_8038C628; @@ -17,9 +17,9 @@ extern ActorInfo D_8038C694; extern ActorInfo D_8038C6B8; extern ActorInfo D_8038C6DC; extern ActorInfo D_8038C718; -extern ActorInfo TTC_LOCKUP_ACTOR_LOCKUP_SLOW; -extern ActorInfo TTC_LOCKUP_ACTOR_LOCKUP_MEDIUM; -extern ActorInfo TTC_LOCKUP_ACTOR_LOCKUP_FAST; +extern ActorInfo TTC_LOCKUP_ACTOR_SLOW; +extern ActorInfo TTC_LOCKUP_ACTOR_MEDIUM; +extern ActorInfo TTC_LOCKUP_ACTOR_FAST; extern ActorInfo D_8038C8B0; extern ActorInfo D_8038C8D4; extern ActorInfo D_8038C8F8; @@ -93,12 +93,12 @@ void TTC_func_80388AC0(void) { spawnableActorList_add(&D_8038C5E0, actor_new, ACTOR_FLAG_NONE); spawnableActorList_add(&D_8038C604, actor_new, ACTOR_FLAG_NONE); - 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(&TTC_NIPPER_ACTOR, 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, 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(&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(&TTC_LOCKUP_ACTOR_SLOW, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_8); + spawnableActorList_add(&TTC_LOCKUP_ACTOR_MEDIUM, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_8); + spawnableActorList_add(&TTC_LOCKUP_ACTOR_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);