refac: move map flags into enums.h, mark functions static for blubber where applicable

This commit is contained in:
Bl00D4NGEL
2024-10-04 17:45:08 +02:00
parent a69ab3fdde
commit 2ff64a65bd
5 changed files with 56 additions and 51 deletions

View File

@@ -2316,6 +2316,18 @@ enum mm_specific_flags {
MM_SPECIFIC_FLAG_A_UNKNOWN MM_SPECIFIC_FLAG_A_UNKNOWN
}; };
enum ttc_specific_flags {
TTC_SPECIFIC_FLAG_0_BLUBBER_UNKNOWN,
TTC_SPECIFIC_FLAG_1_UNKNOWN, // something related to the sand castle
TTC_SPECIFIC_FLAG_2_BLUBBER_JIGGY_SPAWNED_TEXT_SHOWN,
TTC_SPECIFIC_FLAG_3_BLUBBER_SHOW_JIGGY_SPAWNED_TEXT_FLAG,
// unused
TTC_SPECIFIC_FLAG_5_CLAM_FIRST_MEET_TEXT_SHOWN = 0x5,
// unused
TTC_SPECIFIC_FLAG_7_NIPPER_FIRST_MEET_TEXT_SHOWN = 0x7
};
enum item_e enum item_e
{ {
ITEM_0_HOURGLASS_TIMER = 0x0, ITEM_0_HOURGLASS_TIMER = 0x0,

View File

@@ -2,29 +2,22 @@
#include "functions.h" #include "functions.h"
#include "variables.h" #include "variables.h"
extern void func_8028E668(f32[3], f32, f32, f32); extern void func_8028E668(f32 arg0[3], f32 arg1, f32 arg2, f32 arg3);
extern void func_8028FA34(s32, Actor*); extern void func_8028FA34(s32, Actor*);
extern s32 func_802E0970(s32, f32, f32, f32, s32, s32, f32[3]); extern s32 func_802E0970(s32, f32, f32, f32, s32, s32, f32[3]);
typedef struct { typedef struct {
u8 unk0[0xE]; u8 unk0[0xE]; // unused?
s16 unkE; s16 unkE; // some sort of index
f32 throw_target_position[3]; f32 throw_target_position[3];
s32 throw_target_radius; s32 throw_target_radius;
NodeProp* gold_bullion_throw_target_node_prop; NodeProp* gold_bullion_throw_target_node_prop;
s32 unk24; // bullions left to collect ? (changes from 4 to 0) s32 unk24; // bullions left to collect ? (changes from 4 to 0)
} ActorLocal_Blubber; } ActorLocal_Blubber;
void chBlubber_updateFunc(Actor *this); static void __chBlubber_updateFunc(Actor *this);
void chBlubber_update2Func(Actor *this); static void __chBlubber_update2Func(Actor *this);
Actor *chBlubber_drawFunc(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); static Actor *__chBlubber_drawFunc(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
enum ch_blubber_map_flags_e {
CH_BLUBBER_MAP_FLAG_0_UNKNOWN = 0,
CH_BLUBBER_MAP_FLAG_1_UNKNOWN = 1, // If this is not set some things will not run like showing the jiggy collected text
CH_BLUBBER_MAP_FLAG_2_JIGGY_SPAWNED_TEXT_SHOWN = 2, // Jiggy collected text shown
CH_BLUBBER_MAP_FLAG_3_SHOW_JIGGY_SPAWNED_TEXT_FLAG = 3
};
enum ch_blubber_states_e { enum ch_blubber_states_e {
CH_BLUBBER_STATE_1_UNKNOWN = 1, // initial state (80387A84) CH_BLUBBER_STATE_1_UNKNOWN = 1, // initial state (80387A84)
@@ -36,7 +29,7 @@ enum ch_blubber_states_e {
/* .data */ /* .data */
ActorAnimationInfo gChBlubberAnimations[6] = { ActorAnimationInfo gChBlubberAnimations[6] = {
{0x00, 0.0f}, {NULL, NULL},
{ASSET_B5_ANIM_BLUBBER_WALK, 2.0f}, {ASSET_B5_ANIM_BLUBBER_WALK, 2.0f},
{ASSET_B6_ANIM_BLUBBER_CRY, 2.0f}, {ASSET_B6_ANIM_BLUBBER_CRY, 2.0f},
{ASSET_B6_ANIM_BLUBBER_CRY, 2.0f}, {ASSET_B6_ANIM_BLUBBER_CRY, 2.0f},
@@ -47,12 +40,12 @@ ActorAnimationInfo gChBlubberAnimations[6] = {
ActorInfo gChBlubber = { ActorInfo gChBlubber = {
MARKER_A3_BLUBBER, ACTOR_115_BLUBBER, ASSET_370_MODEL_BLUBBER, MARKER_A3_BLUBBER, ACTOR_115_BLUBBER, ASSET_370_MODEL_BLUBBER,
0x1, gChBlubberAnimations, 0x1, gChBlubberAnimations,
chBlubber_updateFunc, chBlubber_update2Func, chBlubber_drawFunc, __chBlubber_updateFunc, __chBlubber_update2Func, __chBlubber_drawFunc,
0, 0x399, 1.8f, 0 0, 0x399, 1.8f, 0
}; };
/* .code */ /* .code */
void chBlubber_initiliaze(Actor *this){ static void __chBlubber_initiliaze(Actor *this){
ActorLocal_Blubber *local = (ActorLocal_Blubber *)&this->local; ActorLocal_Blubber *local = (ActorLocal_Blubber *)&this->local;
animctrl_setTransitionDuration(this->animctrl, 0.2f); animctrl_setTransitionDuration(this->animctrl, 0.2f);
@@ -66,7 +59,7 @@ void chBlubber_initiliaze(Actor *this){
func_8032A82C(this, 0x14C); func_8032A82C(this, 0x14C);
} }
void chBlubber_showTextCallback(ActorMarker *caller, enum asset_e text_id, s32 arg1){ static void __chBlubber_showTextCallback(ActorMarker *caller, enum asset_e text_id, s32 arg1){
Actor *this = marker_getActor(caller); Actor *this = marker_getActor(caller);
ActorLocal_Blubber *local = (ActorLocal_Blubber*)&this->local; ActorLocal_Blubber *local = (ActorLocal_Blubber*)&this->local;
@@ -78,7 +71,7 @@ void chBlubber_showTextCallback(ActorMarker *caller, enum asset_e text_id, s32 a
} }
} }
void chBlubber_showTextCallback2(ActorMarker *caller, enum asset_e text_id, s32 arg1){ static void __chBlubber_showTextCallback2(ActorMarker *caller, enum asset_e text_id, s32 arg1){
f32 sp24[3]; f32 sp24[3];
if(nodeProp_findPositionFromActorId(ACTOR_14B_TTC_BLUBBER_UNKNOWN, sp24)){ if(nodeProp_findPositionFromActorId(ACTOR_14B_TTC_BLUBBER_UNKNOWN, sp24)){
@@ -87,7 +80,7 @@ void chBlubber_showTextCallback2(ActorMarker *caller, enum asset_e text_id, s32
} }
} }
void chBlubber_showJiggySpawnedText(ActorMarker *marker){ static void __chBlubber_showJiggySpawnedText(ActorMarker *marker){
Actor *this = marker_getActor(reinterpret_cast(ActorMarker *, marker)); Actor *this = marker_getActor(reinterpret_cast(ActorMarker *, marker));
enum asset_e text_id; enum asset_e text_id;
@@ -95,26 +88,26 @@ void chBlubber_showJiggySpawnedText(ActorMarker *marker){
actor_loopAnimation(this); actor_loopAnimation(this);
this->actor_specific_1_f = 0.0f; this->actor_specific_1_f = 0.0f;
if(!mapSpecificFlags_get(CH_BLUBBER_MAP_FLAG_2_JIGGY_SPAWNED_TEXT_SHOWN)) { if(!mapSpecificFlags_get(TTC_SPECIFIC_FLAG_2_BLUBBER_JIGGY_SPAWNED_TEXT_SHOWN)) {
text_id = jiggyscore_isCollected(JIGGY_14_TTC_BLUBBER) ? ASSET_A2A_BLUBBER_COMPLETE_JIGGY_COLLECTED : ASSET_A0D_TEXT_BLUBBER_COMPLETE; text_id = jiggyscore_isCollected(JIGGY_14_TTC_BLUBBER) ? ASSET_A2A_BLUBBER_COMPLETE_JIGGY_COLLECTED : ASSET_A0D_TEXT_BLUBBER_COMPLETE;
gcdialog_showText(text_id, 0xf, this->position, this->marker, chBlubber_showTextCallback, chBlubber_showTextCallback2); gcdialog_showText(text_id, 0xf, this->position, this->marker, __chBlubber_showTextCallback, __chBlubber_showTextCallback2);
mapSpecificFlags_set(CH_BLUBBER_MAP_FLAG_2_JIGGY_SPAWNED_TEXT_SHOWN, TRUE); mapSpecificFlags_set(TTC_SPECIFIC_FLAG_2_BLUBBER_JIGGY_SPAWNED_TEXT_SHOWN, TRUE);
} }
} }
void chBlubber_checkJiggySpawnedTextAndAdvanceState(Actor *this){ static void __chBlubber_checkJiggySpawnedTextAndAdvanceState(Actor *this){
if( !mapSpecificFlags_get(CH_BLUBBER_MAP_FLAG_1_UNKNOWN) ) return; if( !mapSpecificFlags_get(TTC_SPECIFIC_FLAG_1_UNKNOWN) ) return;
if( mapSpecificFlags_get(CH_BLUBBER_MAP_FLAG_3_SHOW_JIGGY_SPAWNED_TEXT_FLAG) ) return; if( mapSpecificFlags_get(TTC_SPECIFIC_FLAG_3_BLUBBER_SHOW_JIGGY_SPAWNED_TEXT_FLAG) ) return;
this->yaw_ideal = (f32) func_80329784(this); this->yaw_ideal = (f32) func_80329784(this);
mapSpecificFlags_set(CH_BLUBBER_MAP_FLAG_3_SHOW_JIGGY_SPAWNED_TEXT_FLAG, TRUE); mapSpecificFlags_set(TTC_SPECIFIC_FLAG_3_BLUBBER_SHOW_JIGGY_SPAWNED_TEXT_FLAG, TRUE);
func_8028F918(2); func_8028F918(2);
timed_setStaticCameraToNode(0.0f, 4); timed_setStaticCameraToNode(0.0f, 4);
timedFunc_set_1(1.0f, (GenFunction_1)chBlubber_showJiggySpawnedText, (s32)this->marker); timedFunc_set_1(1.0f, (GenFunction_1)__chBlubber_showJiggySpawnedText, (s32)this->marker);
subaddie_set_state_with_direction(this, CH_BLUBBER_STATE_1_UNKNOWN, 0.0f, 1); subaddie_set_state_with_direction(this, CH_BLUBBER_STATE_1_UNKNOWN, 0.0f, 1);
} }
void func_8038771C(Actor *this){ static void __func_8038771C(Actor *this){
if( !func_80329030(this, 0) if( !func_80329030(this, 0)
&& func_80329480(this) && func_80329480(this)
){ ){
@@ -123,7 +116,7 @@ void func_8038771C(Actor *this){
} }
// probably something related to blubber throwing the bullions // probably something related to blubber throwing the bullions
void func_80387774(Actor **this_ptr){ static void __func_80387774(Actor **this_ptr){
ActorLocal_Blubber *local = (ActorLocal_Blubber *)&(*this_ptr)->local; ActorLocal_Blubber *local = (ActorLocal_Blubber *)&(*this_ptr)->local;
player_setCarryObjectPoseInCylinder(local->throw_target_position, local->throw_target_radius, 100.0f, ACTOR_2A_GOLD_BULLION, this_ptr); player_setCarryObjectPoseInCylinder(local->throw_target_position, local->throw_target_radius, 100.0f, ACTOR_2A_GOLD_BULLION, this_ptr);
@@ -131,13 +124,13 @@ void func_80387774(Actor **this_ptr){
&& bacarry_get_markerId() == MARKER_37_GOLD_BULLION && bacarry_get_markerId() == MARKER_37_GOLD_BULLION
&& player_throwCarriedObject() && player_throwCarriedObject()
) { ) {
func_8028FA34(!mapSpecificFlags_get(CH_BLUBBER_MAP_FLAG_0_UNKNOWN) ? ACTOR_149_TTC_BLUBBER_UNKNOWN : ACTOR_14A_TTC_BLUBBER_UNKNOWN, *this_ptr); func_8028FA34(!mapSpecificFlags_get(TTC_SPECIFIC_FLAG_0_BLUBBER_UNKNOWN) ? ACTOR_149_TTC_BLUBBER_UNKNOWN : ACTOR_14A_TTC_BLUBBER_UNKNOWN, *this_ptr);
(*this_ptr)->has_met_before = TRUE; (*this_ptr)->has_met_before = TRUE;
} }
} }
void func_80387830(Actor *this , f32 arg1, f32 arg2){ static void __func_80387830(Actor *this , f32 arg1, f32 arg2){
if( actor_animationIsAt(this, arg1) if( actor_animationIsAt(this, arg1)
|| actor_animationIsAt(this, arg2) || actor_animationIsAt(this, arg2)
){ ){
@@ -145,12 +138,12 @@ void func_80387830(Actor *this , f32 arg1, f32 arg2){
} }
} }
void chBlubber_updateFunc(Actor * this){ static void __chBlubber_updateFunc(Actor *this){
ActorLocal_Blubber *local; ActorLocal_Blubber *local;
this->marker->propPtr->unk8_3 = TRUE; this->marker->propPtr->unk8_3 = TRUE;
func_8028E668(this->position, 90.0f, -10.0f, 110.0f); func_8028E668(this->position, 90.0f, -10.0f, 110.0f);
if(!mapSpecificFlags_get(CH_BLUBBER_MAP_FLAG_1_UNKNOWN) && !func_80329530(this, 2500)) if(!mapSpecificFlags_get(TTC_SPECIFIC_FLAG_1_UNKNOWN) && !func_80329530(this, 2500))
return; return;
if(!this->volatile_initialized){ if(!this->volatile_initialized){
@@ -164,12 +157,12 @@ void chBlubber_updateFunc(Actor * this){
&& !this->has_met_before && !this->has_met_before
&& item_getCount(ITEM_18_GOLD_BULLIONS) == 0 && item_getCount(ITEM_18_GOLD_BULLIONS) == 0
){ ){
gcdialog_showText(ASSET_A0B_TEXT_BLUBBER_FIRST_MEET, 0xe, this->position, this->marker, chBlubber_showTextCallback, NULL); gcdialog_showText(ASSET_A0B_TEXT_BLUBBER_FIRST_MEET, 0xe, this->position, this->marker, __chBlubber_showTextCallback, NULL);
this->has_met_before = TRUE; this->has_met_before = TRUE;
subaddie_set_state_forward(this, CH_BLUBBER_STATE_3_UNKNOWN); subaddie_set_state_forward(this, CH_BLUBBER_STATE_3_UNKNOWN);
} }
if( mapSpecificFlags_get(CH_BLUBBER_MAP_FLAG_0_UNKNOWN) if( mapSpecificFlags_get(TTC_SPECIFIC_FLAG_0_BLUBBER_UNKNOWN)
&& !this->unk138_23 && !this->unk138_23
){ ){
if (item_getCount(ITEM_18_GOLD_BULLIONS) == 0) { if (item_getCount(ITEM_18_GOLD_BULLIONS) == 0) {
@@ -184,21 +177,21 @@ void chBlubber_updateFunc(Actor * this){
case CH_BLUBBER_STATE_1_UNKNOWN: case CH_BLUBBER_STATE_1_UNKNOWN:
if(!this->initialized){ if(!this->initialized){
actor_collisionOff(this); actor_collisionOff(this);
chBlubber_initiliaze(this); __chBlubber_initiliaze(this);
} }
func_80387774(&this); __func_80387774(&this);
if(subaddie_maybe_set_state_position_direction(this, CH_BLUBBER_STATE_2_UNKNOWN, 0.0f, 1, 0.007f)) if(subaddie_maybe_set_state_position_direction(this, CH_BLUBBER_STATE_2_UNKNOWN, 0.0f, 1, 0.007f))
break; break;
func_80328FB0(this, 3.0f); func_80328FB0(this, 3.0f);
func_8038771C(this); __func_8038771C(this);
func_80387830(this, 0.14f, 0.68f); __func_80387830(this, 0.14f, 0.68f);
chBlubber_checkJiggySpawnedTextAndAdvanceState(this); __chBlubber_checkJiggySpawnedTextAndAdvanceState(this);
break; break;
case CH_BLUBBER_STATE_2_UNKNOWN: case CH_BLUBBER_STATE_2_UNKNOWN:
func_80387774(&this); __func_80387774(&this);
if( actor_animationIsAt(this, 0.99f) if( actor_animationIsAt(this, 0.99f)
&& subaddie_maybe_set_state_position_direction(this, CH_BLUBBER_STATE_1_UNKNOWN, 0.0f, 1, 0.78f) && subaddie_maybe_set_state_position_direction(this, CH_BLUBBER_STATE_1_UNKNOWN, 0.0f, 1, 0.78f)
){ ){
@@ -218,7 +211,7 @@ void chBlubber_updateFunc(Actor * this){
FUNC_8030E8B4(SFX_83_BLUBBER_CRYING, 0.91f, 17000, this->position, 1250, 2500); FUNC_8030E8B4(SFX_83_BLUBBER_CRYING, 0.91f, 17000, this->position, 1250, 2500);
} }
chBlubber_checkJiggySpawnedTextAndAdvanceState(this); __chBlubber_checkJiggySpawnedTextAndAdvanceState(this);
break; break;
case CH_BLUBBER_STATE_3_UNKNOWN: case CH_BLUBBER_STATE_3_UNKNOWN:
@@ -252,17 +245,17 @@ void chBlubber_updateFunc(Actor * this){
} }
} }
void chBlubber_update2Func(Actor *this){ static void __chBlubber_update2Func(Actor *this){
func_80343DEC(this); func_80343DEC(this);
if(0.99 <= this->unk48){ if(0.99 <= this->unk48){
func_8028F918(0); func_8028F918(0);
timed_exitStaticCamera(0.0f); timed_exitStaticCamera(0.0f);
marker_despawn(this->marker); marker_despawn(this->marker);
} }
func_80387830(this, 0.5f, 0.97f); __func_80387830(this, 0.5f, 0.97f);
} }
Actor *chBlubber_drawFunc(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ static Actor *__chBlubber_drawFunc(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
func_8033A45C(4, 0); func_8033A45C(4, 0);
return actor_draw(marker, gfx, mtx, vtx); return actor_draw(marker, gfx, mtx, vtx);
} }

View File

@@ -245,8 +245,8 @@ void chClam_attackOther(ActorMarker *this_marker, ActorMarker *other_marker){
if(func_80297C6C() == 3) return; if(func_80297C6C() == 3) return;
if( !mapSpecificFlags_get(5) && gcdialog_showText(ASSET_A14_TEXT_CLAM_TAUNT, 0, NULL, NULL, NULL, NULL)){ if( !mapSpecificFlags_get(TTC_SPECIFIC_FLAG_5_CLAM_FIRST_MEET_TEXT_SHOWN) && gcdialog_showText(ASSET_A14_TEXT_CLAM_TAUNT, 0, NULL, NULL, NULL, NULL)){
mapSpecificFlags_set(5, TRUE); mapSpecificFlags_set(TTC_SPECIFIC_FLAG_5_CLAM_FIRST_MEET_TEXT_SHOWN, TRUE);
} }
if(item_getCount(ITEM_D_EGGS) != 0) if(item_getCount(ITEM_D_EGGS) != 0)

View File

@@ -175,11 +175,11 @@ void chNipper_ow2Func(ActorMarker * this_marker, ActorMarker *other_marker){
if(other_marker->id == 1){ if(other_marker->id == 1){
this = marker_getActor(this_marker); this = marker_getActor(this_marker);
if( !mapSpecificFlags_get(7) if( !mapSpecificFlags_get(TTC_SPECIFIC_FLAG_7_NIPPER_FIRST_MEET_TEXT_SHOWN)
&& this->has_met_before && this->has_met_before
&& gcdialog_showText(0xa0f, 0, NULL, NULL, NULL, NULL) && gcdialog_showText(0xa0f, 0, NULL, NULL, NULL, NULL)
){ ){
mapSpecificFlags_set(7, TRUE); mapSpecificFlags_set(TTC_SPECIFIC_FLAG_7_NIPPER_FIRST_MEET_TEXT_SHOWN, TRUE);
} }
} }
} }

View File

@@ -147,7 +147,7 @@ void func_8038A328(void) {
i_ptr->unk3 = 2; i_ptr->unk3 = 2;
i_ptr->unk4 = 0.0f; i_ptr->unk4 = 0.0f;
} }
mapSpecificFlags_set(1, FALSE); mapSpecificFlags_set(TTC_SPECIFIC_FLAG_1_UNKNOWN, FALSE);
} }
void func_8038A37C(s32 arg0, BKVtxRef *ref, Vtx *dst, s32 arg3) { void func_8038A37C(s32 arg0, BKVtxRef *ref, Vtx *dst, s32 arg3) {
@@ -318,7 +318,7 @@ void func_8038AC48(LetterFloorTile *arg0) {
if (var_v0 & 1) { if (var_v0 & 1) {
D_8038D720.unk8 = 2U; D_8038D720.unk8 = 2U;
D_8038D720.unkC = 0.0f; D_8038D720.unkC = 0.0f;
mapSpecificFlags_set(1, TRUE); mapSpecificFlags_set(TTC_SPECIFIC_FLAG_1_UNKNOWN, TRUE);
fileProgressFlag_set(0xFA, TRUE); fileProgressFlag_set(0xFA, TRUE);
func_8030E2C4(D_8038D720.sfxsourceIdx); func_8030E2C4(D_8038D720.sfxsourceIdx);
func_8038A258(2); func_8038A258(2);