diff --git a/.gitignore b/.gitignore index 64efb3fa..a939a88a 100644 --- a/.gitignore +++ b/.gitignore @@ -55,6 +55,7 @@ __pycache__/ *__pycache__/ expected/ .*/ +!.gitlab/ *.ld *.map *auto.txt diff --git a/.gitlab/merge_request_templates/default.md b/.gitlab/merge_request_templates/default.md new file mode 100644 index 00000000..0cb6649d --- /dev/null +++ b/.gitlab/merge_request_templates/default.md @@ -0,0 +1,12 @@ +## What Type Of PR Is This? (Check All Applicable) +- [ ] Feature +- [ ] Bug Fix +- [ ] Documentation Update +- [ ] Revert +- [ ] Other + +## Describe Your Changes + +## Checklist Before Requesting A Review +- [ ] Running 'Make' results in 'OK' for version us.v10 +- [ ] Documentation follows the writing style found in [Style-Guide](https://gitlab.com/banjo.decomp/banjo-kazooie/-/wikis/Style-Guide) \ No newline at end of file diff --git a/include/enums.h b/include/enums.h index 18be86e6..cffdf3e5 100644 --- a/include/enums.h +++ b/include/enums.h @@ -3760,6 +3760,7 @@ enum asset_e ASSET_A22_DIALOG_FLY_REFRESHER = 0xa22, ASSET_A23_DIALOG_SHOCKJUMP_REFRESHER, + ASSET_A27_TEXT_BOTTLES_ALL_TTC_MOVES_LEARNED = 0xA27, ASSET_A28_TEXT_LEAKY_DONE = 0xA28, ASSET_A6F_TEXT_CHARMER_MEET = 0xA6F, @@ -3813,6 +3814,7 @@ enum asset_e ASSET_B4B_DIALOG_EGGS_REFRESHER, ASSET_B4C_DIALOG_BEAKBUSTER_REFRESHER, + ASSET_B4E_TEXT_BOTTLES_ALL_MM_MOVES_LEARNED = 0xB4E, ASSET_B51_TEXT_BOTTLES_HOW_TO_EXIT_LEVEL = 0xb51, @@ -3824,20 +3826,24 @@ enum asset_e ASSET_C23_DIALOG_BEAKBOMB_LEARN, ASSET_C24_DIALOG_BEAKBOMB_REFRESHER, + ASSET_C2A_TEXT_BOTTLES_ALL_FP_GV_MOVES_LEARNED = 0xC2A, + text_flibbits_meet = 0xc81, text_flibbits_defeat = 0xc82, text_flibbits_return = 0xc83, ASSET_C88_DIALOG_LONGLEG_LEARN = 0xC88, ASSET_C89_DIALOG_LONGLEG_REFRESHER, + ASSET_C8A_TEXT_BOTTLES_ALL_BGS_MOVES_LEARNED, ASSET_D32_DIALOG_MUTANT_CRAB_MEET = 0xD32, ASSET_D33_DIALOG_MUTANT_CRAB_DEFEAT, ASSET_D34_TEXT_GLOOP_MEET, ASSET_D35_DIALOG_WONDERWING_LEARN, ASSET_D36_DIALOG_WONDERWING_REFRESHER, - - ASSET_D39_TEXT_BOTTLES_REFILL_HEALTH = 0xd39, + ASSET_D37_TEXT_BOTTLES_ALL_CC_MOVES_LEARNED, + ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED, + ASSET_D39_TEXT_BOTTLES_REFILL_HEALTH, ASSET_D8F_DIALOG_MUMBO_MEET = 0xD8F, ASSET_D90_DIALOG_MUMBO_MAGIC_PAID_FOR, @@ -3868,6 +3874,45 @@ enum asset_e ASSET_DB1_DIALOG_MUMBO_MISTAKE_1, ASSET_DB2_DIALOG_MUMBO_MISTAKE_2, + ASSET_DF3_TEXT_BOTTLES_INTRODUCTION = 0xDF3, + ASSET_DF4_TEXT_BOTTLES_CAMERA_CONTROL_LEARN, + ASSET_DF5_TEXT_BOTTLES_CAMERA_CONTROL_REFRESHER, + ASSET_DF6_TEXT_BOTTLES_HIGH_JUMP_LEARN, + ASSET_DF7_TEXT_BOTTLES_FEATHERY_FLAP_LEARN, + ASSET_DF8_TEXT_BOTTLES_FLAP_FLIP_LEARN, + + ASSET_DFA_TEXT_BOTTLES_JUMP_REFRESHER = 0xDFA, + ASSET_DFB_TEXT_BOTTLES_DIVE_LEARN, + + ASSET_DFD_TEXT_BOTTLES_SWIM_LEARN = 0xDFD, + ASSET_DFE_TEXT_BOTTLES_DIVE_REFRESHER, + ASSET_DFF_TEXT_BOTTLES_CLAW_SWIPE_LEARN, + ASSET_E00_TEXT_BOTTLES_ATTACK_REFRESHER = 0xE00, + ASSET_E01_TEXT_BOTTLES_CLIMB_LEARN, + + ASSET_E03_TEXT_BOTTLES_CLIMB_REFRESHER = 0xE03, + ASSET_E04_TEXT_BOTTLES_BEAK_BARGE_LEARN, + + ASSET_E06_TEXT_BOTTLES_BEAK_BARGE_REFRESHER = 0xE06, + + ASSET_E08_TEXT_BOTTLES_FIND_ANOTHER_MOLEHILL = 0xE08, + ASSET_E09_TEXT_BOTTLES_SKIPPED_TUTORIAL, + ASSET_E0A_TEXT_BOTTLES_REFUSE_HELP_1, + ASSET_E0B_TEXT_BOTTLES_REFUSE_HELP_2, + ASSET_E0C_TEXT_BOTTLES_REFUSE_HELP_3, + ASSET_E0D_TEXT_BOTTLES_REFUSE_HELP_4, + ASSET_E0E_TEXT_BOTTLES_REFUSE_HELP_5, + ASSET_E0F_TEXT_BOTTLES_STOP_WASTING_TIME_BEFORE_FURNACE_FUN, // Skip tutorial, bother bottles, gives help, retalk to bottles + ASSET_E10_TEXT_BOTTLES_BRIDGE_BROKEN, + ASSET_E11_TEXT_BOTTLES_BRIDGE_STILL_BROKEN, + ASSET_E12_TEXT_BOTTLES_LEARNED_TUTORIAL_MOVES, + + ASSET_E1D_TEXT_BOTTLES_TUTORIAL_OFFER_WAIT = 0xE1D, + + ASSET_E1F_TEXT_BOTTLES_TUTORIAL_OFFER = 0xE1F, + + ASSET_E37_TEXT_BOTTLES_STOP_WASTING_TIME_AFTER_FURNACE_FUN = 0xE37, // Talk to bottles after beating furnace fun + ASSET_F5B_DIALOG_MUMBO_MAGIC_GET_WEAK_FULL = 0xF5b, ASSET_F5C_DIALOG_MUMBO_MAGIC_GET_WEAK_ABREV, ASSET_F5D_DIALOG_MUMBO_MAGIC_RUN_OUT_FULL, diff --git a/level_symbols.us.v10.txt b/level_symbols.us.v10.txt index 209ecfeb..d384f58f 100644 --- a/level_symbols.us.v10.txt +++ b/level_symbols.us.v10.txt @@ -19,5 +19,5 @@ lair_func_8038E0B0 = 0x8038E0B0; lair_func_8038E768 = 0x8038E768; fight_func_803863F0 = 0x803863F0; cutscene_func_8038C4E0 = 0x8038C4E0; -func_802DA498 = 0x802DA498; +mole_learnedAllSpiralMountainAbilities = 0x802DA498; diff --git a/src/SM/ch/attacktutorial.c b/src/SM/ch/attacktutorial.c index 98c7341b..1fffa395 100644 --- a/src/SM/ch/attacktutorial.c +++ b/src/SM/ch/attacktutorial.c @@ -206,7 +206,7 @@ void func_80387764(ActorMarker * marker){ func_8028F94C(2, actor->unk1C); } //L80387848 - if(!mapSpecificFlags_get(3) && func_802DA498() && temp_a2){ + if(!mapSpecificFlags_get(3) && mole_learnedAllSpiralMountainAbilities() && temp_a2){ mapSpecificFlags_set(3, 1); sp34 = 0xE12; }//L80387898 diff --git a/src/SM/code_2990.c b/src/SM/code_2990.c index 065d38ac..7d6e9e21 100644 --- a/src/SM/code_2990.c +++ b/src/SM/code_2990.c @@ -11,19 +11,19 @@ void timed_exitStaticCamera(f32); void subaddie_set_state_with_direction(Actor *, s32, f32, s32); //static types -typedef struct sm_2900_struct{ - s16 unk0; //text_id - s16 unk2; //text_id - s8 unk4; - s8 unk5; //ability_id -}SM2900Struct; +typedef struct { + s16 learn_text; + s16 refresher_text; + s8 camera_node; + s8 ability; +} struct_smMole; //public -void func_803899B0(Actor * this); +void smMole_Update(Actor * this); void SM_func_80389610(Actor * this); /* .data */ -ActorAnimationInfo D_8038AF60[6] = { +ActorAnimationInfo smMoleAnimations[6] = { {0, 0.0f}, {ASSET_13A_ANIM_BOTTLES_ENTER, 2000000000.0f}, {ASSET_13A_ANIM_BOTTLES_ENTER, 4.5f}, @@ -32,27 +32,31 @@ ActorAnimationInfo D_8038AF60[6] = { {ASSET_13A_ANIM_BOTTLES_ENTER, 2000000000.0f} }; -ActorInfo D_8038AF90 = { MARKER_B7_TUTORIAL_BOTTLES, ACTOR_12B_TUTORIAL_BOTTLES, ASSET_387_MODEL_BOTTLES, 1, D_8038AF60, //bottles - func_803899B0, func_80326224, func_802D94B4, +ActorInfo D_8038AF90 = { + MARKER_B7_TUTORIAL_BOTTLES, ACTOR_12B_TUTORIAL_BOTTLES, ASSET_387_MODEL_BOTTLES, + 1, smMoleAnimations, + smMole_Update, func_80326224, func_802D94B4, 0, 0, 0.0f, 0 }; -SM2900Struct D_8038AFB4[8] = { - {0xdf3, 0xe08, 1, -1}, - {0xdf4, 0xdf5, 3, ABILITY_3_CAMERA_CONTROL}, - {0xdfb, 0xdfe, 5, ABILITY_F_DIVE}, - { -1, 0xe00, 6, ABILITY_B_RATATAT_RAP}, - {0xe04, 0xe06, 8, ABILITY_0_BARGE}, - { -1, 0xdfa, 4, ABILITY_8_FLIP}, - {0xe01, 0xe03, 7, ABILITY_5_CLIMB}, - {0xe10, 0xe11, 0x11, -1}, +struct_smMole smMoleTable[8] = { + {ASSET_DF3_TEXT_BOTTLES_INTRODUCTION, ASSET_E08_TEXT_BOTTLES_FIND_ANOTHER_MOLEHILL, 1, -1}, + {ASSET_DF4_TEXT_BOTTLES_CAMERA_CONTROL_LEARN, ASSET_DF5_TEXT_BOTTLES_CAMERA_CONTROL_REFRESHER, 3, ABILITY_3_CAMERA_CONTROL}, + {ASSET_DFB_TEXT_BOTTLES_DIVE_LEARN, ASSET_DFE_TEXT_BOTTLES_DIVE_REFRESHER, 5, ABILITY_F_DIVE}, + { -1, ASSET_E00_TEXT_BOTTLES_ATTACK_REFRESHER, 6, ABILITY_B_RATATAT_RAP}, + {ASSET_E04_TEXT_BOTTLES_BEAK_BARGE_LEARN, ASSET_E06_TEXT_BOTTLES_BEAK_BARGE_REFRESHER, 8, ABILITY_0_BARGE}, + { -1, ASSET_DFA_TEXT_BOTTLES_JUMP_REFRESHER, 4, ABILITY_8_FLIP}, + {ASSET_E01_TEXT_BOTTLES_CLIMB_LEARN, ASSET_E03_TEXT_BOTTLES_CLIMB_REFRESHER, 7, ABILITY_5_CLIMB}, + {ASSET_E10_TEXT_BOTTLES_BRIDGE_BROKEN, ASSET_E11_TEXT_BOTTLES_BRIDGE_STILL_BROKEN, 0x11, -1}, }; s32 D_8038AFE4 = 0; /* .code */ -int func_80388D80(void){ +// func_80388D80 +int code_2990_learnedAnySpiralMountainAbilities(void){ + // Checks if any Spiral Mountain abilities have been learned return ability_isUnlocked(ABILITY_F_DIVE) || ability_isUnlocked(ABILITY_4_BEAR_PUNCH) || ability_isUnlocked(ABILITY_C_ROLL) @@ -64,7 +68,10 @@ int func_80388D80(void){ || ability_isUnlocked(ABILITY_5_CLIMB); } -void func_80388E48(void){ +// func_80388E48 +void code_2990_setSpiralMountainAbilitiesAsUsed(void){ + // Sets all Spiral Mountain abilities to used & disables the noise + // played when the player uses an ability for the first time. ability_unlock(ABILITY_3_CAMERA_CONTROL); ability_setHasUsed(ABILITY_0_BARGE); ability_setHasUsed(ABILITY_1_BEAK_BOMB); @@ -77,7 +84,9 @@ void func_80388E48(void){ ability_setHasUsed(ABILITY_A_HOLD_A_JUMP_HIGHER); } -void func_80388EB0(void){ +// func_80388EB0 +void code_2990_skipIntroTutorial(void){ + // Unlocks all of the Spiral Mountain moves. ability_unlock(ABILITY_F_DIVE); ability_unlock(ABILITY_4_BEAR_PUNCH); ability_unlock(ABILITY_C_ROLL); @@ -87,16 +96,20 @@ void func_80388EB0(void){ ability_unlock(ABILITY_7_FLAP); ability_unlock(ABILITY_8_FLIP); ability_unlock(ABILITY_5_CLIMB); - func_80388E48(); + code_2990_setSpiralMountainAbilitiesAsUsed(); mapSpecificFlags_set(3,1); } -void func_80388F24(Actor *this){ +// func_80388F24 +void code_2990_setSpiralMountainStaticCamera(Actor *this){ + // If the player is talking to Intro Bottles for the first time, + // use the camera that points to the lair. + // Otherwise, use the camera for the ability. if(this->unkF4_8 == 1 && !mapSpecificFlags_get(1)){ timed_setStaticCameraToNode(0.0f, 0x12); } else{ //L80388F68 - timed_setStaticCameraToNode(0.0f, D_8038AFB4[this->unkF4_8 -1].unk4); + timed_setStaticCameraToNode(0.0f, smMoleTable[this->unkF4_8 -1].camera_node); } } @@ -139,7 +152,7 @@ void func_80388FA0(Actor *this, s32 arg1){ animctrl_setSmoothTransition(this->animctrl, 0); break; case 5: - func_80388F24(this); + code_2990_setSpiralMountainStaticCamera(this); func_8028F94C(2,this->position); SM_func_80389610(this); break; @@ -158,14 +171,16 @@ void func_80388FA0(Actor *this, s32 arg1){ func_8030DD14(this->unk44_31, 2); func_8030DBB4(this->unk44_31, 1.4f); sfxsource_setSampleRate(this->unk44_31, 0x6590); - func_80388F24(this); + code_2990_setSpiralMountainStaticCamera(this); func_8028F94C(2, this->position); break; } subaddie_set_state_with_direction(this, arg1, 0.0001f, 1); } -void func_80389214(ActorMarker *marker, enum asset_e text_id, s32 arg2){ +// func_80389214 +void smMole_additionalAbilityLearnActions(ActorMarker *marker, enum asset_e text_id, s32 arg2){ + // Performs actions depending on what move is being learned Actor *actor = marker_getActor(marker); switch(arg2){ case 3: @@ -181,7 +196,7 @@ void func_80389214(ActorMarker *marker, enum asset_e text_id, s32 arg2){ func_8025A70C(COMUSIC_2B_DING_B); break; case 0xff: - func_80388F24(actor); + code_2990_setSpiralMountainStaticCamera(actor); break; } } @@ -190,43 +205,45 @@ void func_803892C8(ActorMarker *marker, enum asset_e text_id, s32 arg2){ Actor *actor; actor = marker_getActor(marker); - if(!mapSpecificFlags_get(3) && func_802DA498()){ + if(!mapSpecificFlags_get(3) && mole_learnedAllSpiralMountainAbilities()){ mapSpecificFlags_set(3, 1); - func_80311480(0xe12, 0xe, actor->position, actor->marker, func_803892C8, NULL); + func_80311480(ASSET_E12_TEXT_BOTTLES_LEARNED_TUTORIAL_MOVES, 0xe, actor->position, actor->marker, func_803892C8, NULL); }//L8038933C else{ - if( !(text_id == 0xdf3 || text_id == 0xe1f || text_id == 0xe1d) ){ + if(!(text_id == ASSET_DF3_TEXT_BOTTLES_INTRODUCTION + || text_id == ASSET_E1F_TEXT_BOTTLES_TUTORIAL_OFFER + || text_id == ASSET_E1D_TEXT_BOTTLES_TUTORIAL_OFFER_WAIT)){ timed_exitStaticCamera(0.0f); } switch(text_id){ - case 0xd38: + case ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED: break; - case 0xdf3:/* 2FB8 803893A8 3C188039 */ - func_80311480(0xe1f, 0x8e, actor->position, actor->marker, func_803892C8, func_80389214); + case ASSET_DF3_TEXT_BOTTLES_INTRODUCTION: /* 2FB8 803893A8 3C188039 */ + func_80311480(ASSET_E1F_TEXT_BOTTLES_TUTORIAL_OFFER, 0x8e, actor->position, actor->marker, func_803892C8, smMole_additionalAbilityLearnActions); break; - case 0xe1f:/* 2FEC 803893DC 9209003B */ + case ASSET_E1F_TEXT_BOTTLES_TUTORIAL_OFFER: /* 2FEC 803893DC 9209003B */ actor->unk38_0 = 1; break; - case 0xe1d:/* 2FFC 803893EC 920B0138 */ + case ASSET_E1D_TEXT_BOTTLES_TUTORIAL_OFFER_WAIT: /* 2FFC 803893EC 920B0138 */ actor->unk138_24 = 0; actor->unk60 = 0.0f; break; - case 0xdf6: /* 3014 80389404 0C0A3E46 */ - case 0xdff: /* 3014 80389404 0C0A3E46 */ + case ASSET_DF6_TEXT_BOTTLES_HIGH_JUMP_LEARN: /* 3014 80389404 0C0A3E46 */ + case ASSET_DFF_TEXT_BOTTLES_CLAW_SWIPE_LEARN: /* 3014 80389404 0C0A3E46 */ func_8028F918(0); break; - case 0xe09: - case 0xe12: + case ASSET_E09_TEXT_BOTTLES_SKIPPED_TUTORIAL: + case ASSET_E12_TEXT_BOTTLES_LEARNED_TUTORIAL_MOVES: func_80388FA0(actor,4); break; default: - if(actor->state !=5 ) - func_80311480(0xd38, 4, NULL, NULL, NULL, NULL); + if(actor->state != 5) + func_80311480(ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED, 4, NULL, NULL, NULL, NULL); func_80388FA0(actor, actor->state == 5 ? 1:4); break; @@ -234,25 +251,28 @@ void func_803892C8(ActorMarker *marker, enum asset_e text_id, s32 arg2){ } } -void func_80389494(Actor * this, s32* arg1, s32 *arg2){ - if(ability_isUnlocked(D_8038AFB4[this->unkF4_8 -1].unk5)){ +// func_80389494 +void smMole_learnAbility(Actor * this, s32* arg1, s32 *arg2){ + // Selects the learn and refresh dialogs. + // Gives the player the ability if not learned. + if(ability_isUnlocked(smMoleTable[this->unkF4_8 -1].ability)){ if(fileProgressFlag_get(FILEPROG_DB_SKIPPED_TUTORIAL)){ - *arg1 = D_8038AFE4 + 0xE0A; //dialog index + *arg1 = D_8038AFE4 + ASSET_E0A_TEXT_BOTTLES_REFUSE_HELP_1; D_8038AFE4++; D_8038AFE4 = MIN(D_8038AFE4, 5); - if(*arg1 != 0xE0E){ + if(*arg1 != ASSET_E0E_TEXT_BOTTLES_REFUSE_HELP_5){ *arg2 |= 1; } }else{//L8038956C *arg2 |= 1; - *arg1 = D_8038AFB4[this->unkF4_8 -1].unk2; - if(*arg1 == 0xdfe && !ability_hasUsed(ABILITY_3_CAMERA_CONTROL)){ - *arg1 = 0xdfd; + *arg1 = smMoleTable[this->unkF4_8 -1].refresher_text; + if(*arg1 == ASSET_DFE_TEXT_BOTTLES_DIVE_REFRESHER && !ability_hasUsed(ABILITY_3_CAMERA_CONTROL)){ + *arg1 = ASSET_DFD_TEXT_BOTTLES_SWIM_LEARN; } } }else{//L803895C0 - *arg1 = D_8038AFB4[this->unkF4_8 -1].unk0; - ability_unlock(D_8038AFB4[this->unkF4_8 -1].unk5); + *arg1 = smMoleTable[this->unkF4_8 -1].learn_text; + ability_unlock(smMoleTable[this->unkF4_8 -1].ability); } } @@ -272,25 +292,25 @@ void SM_func_80389610(Actor * this){ D_8038AFE4++; D_8038AFE4 = MIN(D_8038AFE4, 5); }else{//L803896C0 - sp2C = D_8038AFB4[this->unkF4_8 -1].unk2; + sp2C = smMoleTable[this->unkF4_8 -1].refresher_text; } } else{//L803896E8 - sp2C = D_8038AFB4[this->unkF4_8 -1].unk0; + sp2C = smMoleTable[this->unkF4_8 -1].learn_text; mapSpecificFlags_set(1,1); } break; case 8://L80389720 if(mapSpecificFlags_get(3)){ if(fileProgressFlag_get(FILEPROG_A6_FURNACE_FUN_COMPLETE)){ - sp2C = 0xe37; + sp2C = ASSET_E37_TEXT_BOTTLES_STOP_WASTING_TIME_AFTER_FURNACE_FUN; sp28 |= 1; }else{//L80389758 if(mapSpecificFlags_get(0xf)){ - sp2C = 0xe0f; + sp2C = ASSET_E0F_TEXT_BOTTLES_STOP_WASTING_TIME_BEFORE_FURNACE_FUN; sp28 |= 1; }else{//L80389780 - func_80388E48(); + code_2990_setSpiralMountainAbilitiesAsUsed(); sp2C = fileProgressFlag_get(FILEPROG_DB_SKIPPED_TUTORIAL) ? 0xe1e : 0xe13; mapSpecificFlags_set(0xf, 1); } @@ -299,11 +319,11 @@ void SM_func_80389610(Actor * this){ } else{//L803897C8 if(mapSpecificFlags_get(2)){ - sp2C = D_8038AFB4[this->unkF4_8 -1].unk2; + sp2C = smMoleTable[this->unkF4_8 -1].refresher_text; sp28 |= 1; } else{ - sp2C = D_8038AFB4[this->unkF4_8 -1].unk0; + sp2C = smMoleTable[this->unkF4_8 -1].learn_text; mapSpecificFlags_set(2, 1); } @@ -318,7 +338,7 @@ void SM_func_80389610(Actor * this){ mapSpecificFlags_set(4, 1); } else{//L803898E4 - func_80389494(this, &sp2C, &sp28); + smMole_learnAbility(this, &sp2C, &sp28); } break; @@ -330,25 +350,27 @@ void SM_func_80389610(Actor * this){ mapSpecificFlags_set(0xE, 1); } else{//L803898E4 - func_80389494(this, &sp2C, &sp28); + smMole_learnAbility(this, &sp2C, &sp28); } break; default://L803898F8 - func_80389494(this, &sp2C, &sp28); + smMole_learnAbility(this, &sp2C, &sp28); break; }//L80389904 if(sp2C){ - func_80311480(sp2C, sp28, this->position, this->marker, func_803892C8, func_80389214); + func_80311480(sp2C, sp28, this->position, this->marker, func_803892C8, smMole_additionalAbilityLearnActions); } } -void func_80389948(ActorMarker * marker){ +// func_80389948 +void smMole_spawnMolehill(ActorMarker * marker){ + // Spawns a molehill for the actor Actor *actor; Actor *other; s32 pad; actor = marker_getActor(marker); - other = spawn_child_actor(0x12c, &actor); + other = spawn_child_actor(ACTOR_12C_MOLEHILL, &actor); actor->unk100 = other->marker; if(marker); @@ -362,13 +384,17 @@ void func_80389984(Actor * this){ func_8030DA44(tmp); } -void func_803899B0(Actor * this){ - s32 sp50[6]; //face buttons - f32 sp44[3]; //player position +// func_803899B0 +void smMole_Update(Actor * this){ + // Sets up the initial functions and state for the actor + s32 sp50[6]; // face buttons + f32 sp44[3]; // player position void *sp40; int sp34; int sp38; + // Checks the actor's selector value is lower than 0x9 + // Anything higher is a non-Spiral Mountain ability, and should use a different actor id if(this->unkF4_8 >= 9) return; @@ -394,10 +420,10 @@ void func_803899B0(Actor * this){ } } }//L80389AC8 - if(func_80388D80()){ + if(code_2990_learnedAnySpiralMountainAbilities()){ mapSpecificFlags_set(1,1); - if(func_802DA498()){ + if(mole_learnedAllSpiralMountainAbilities()){ mapSpecificFlags_set(3, 1); mapSpecificFlags_set(2, 1); mapSpecificFlags_set(0xC, 1); @@ -407,7 +433,7 @@ void func_803899B0(Actor * this){ }//L80389B20 if(!this->unk16C_4){ - __spawnQueue_add_1((GenFunction_1)func_80389948, reinterpret_cast(s32, this->marker)); + __spawnQueue_add_1((GenFunction_1)smMole_spawnMolehill, reinterpret_cast(s32, this->marker)); this->unk16C_4 = 1; }//L80389B4C @@ -443,7 +469,7 @@ void func_803899B0(Actor * this){ || func_8028EC04() ) break; - sp34 = !((!(D_8038AFB4[this->unkF4_8-1].unk5 + 1)) || (!ability_isUnlocked( D_8038AFB4[this->unkF4_8-1].unk5))); + sp34 = !((!(smMoleTable[this->unkF4_8-1].ability + 1)) || (!ability_isUnlocked( smMoleTable[this->unkF4_8-1].ability))); if( (!sp34 && this->unkF4_8 != 1) || fileProgressFlag_get(FILEPROG_DB_SKIPPED_TUTORIAL) == 0 || D_8038AFE4 < 6 @@ -536,9 +562,9 @@ void func_803899B0(Actor * this){ if( sp38 != -1){ //button was pressed fileProgressFlag_set(FILEPROG_DB_SKIPPED_TUTORIAL, (sp38)?0:1); - func_80311480((sp38)? 0xe07 : 0xe09, 0xe, this->position, this->marker, func_803892C8, func_80389214); + func_80311480((sp38)? 0xe07 : 0xe09, 0xe, this->position, this->marker, func_803892C8, smMole_additionalAbilityLearnActions); if(!sp38){ - func_80388EB0(); //give all SM moves + code_2990_skipIntroTutorial(); //give all SM moves } this->unk38_0 = 0; }else if(!this->unk138_24 && 5.0 < this->unk60){ diff --git a/src/SM/code_4070.c b/src/SM/code_4070.c index 39347c92..005ab6ff 100644 --- a/src/SM/code_4070.c +++ b/src/SM/code_4070.c @@ -112,7 +112,7 @@ void SM_func_8038A5D8(Actor *this){ func_8038A460(this); func_8028F94C(2, this->unk1C); - if(!mapSpecificFlags_get(3) && func_802DA498()){ + if(!mapSpecificFlags_get(3) && mole_learnedAllSpiralMountainAbilities()){ mapSpecificFlags_set(3,1); temp_a0 = 0xe12; }else{ diff --git a/src/core1/code_CE60.c b/src/core1/code_CE60.c index 5055682a..f0041993 100644 --- a/src/core1/code_CE60.c +++ b/src/core1/code_CE60.c @@ -266,7 +266,7 @@ void func_8024AF48(void){ func_8024A880(0x9000); } else{ - if(func_802DA498()) + if(mole_learnedAllSpiralMountainAbilities()) func_8024A9EC(0); func_8024A880(0x6fff); } diff --git a/src/core2/ch/gameSelect.c b/src/core2/ch/gameSelect.c index caa23cf3..3c8bce1a 100644 --- a/src/core2/ch/gameSelect.c +++ b/src/core2/ch/gameSelect.c @@ -400,7 +400,7 @@ void func_802C4C14(Actor *this){ sp44 = 0.0f; if(this->state == 4 && (sp84 == 0 || sp84 == 1)) sp44 = 0.25f; - if(func_802DA498() && fileProgressFlag_get(FILEPROG_BD_ENTER_LAIR_CUTSCENE)){ + if(mole_learnedAllSpiralMountainAbilities() && fileProgressFlag_get(FILEPROG_BD_ENTER_LAIR_CUTSCENE)){ timedFunc_set_2(sp44, (GenFunction_2)func_8031FB14, 0, 0); } else{//L802C5188 diff --git a/src/core2/ch/mole.c b/src/core2/ch/mole.c index 1f06a5fd..7e030ee2 100644 --- a/src/core2/ch/mole.c +++ b/src/core2/ch/mole.c @@ -2,19 +2,19 @@ #include "functions.h" #include "variables.h" -void func_802D9D60(Actor *this); +void mole_update(Actor *this); Actor *func_802D94B4(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); -void func_802D9830(ActorMarker *marker, enum asset_e arg1, s32 arg2); +void mole_additionalAbilityLearnActions(ActorMarker *marker, enum asset_e arg1, s32 arg2); typedef struct{ s16 learn_text; s16 refresher_text; s8 camera_node; s8 ability; -} struct_core2_52290; +} struct_mole; /* .data */ -ActorAnimationInfo D_80367D70[]= { +ActorAnimationInfo moleAnimations[]= { {0, 0.0f}, {ASSET_13A_ANIM_BOTTLES_ENTER, 2000000000.0f}, {ASSET_13A_ANIM_BOTTLES_ENTER, 4.5f}, @@ -23,14 +23,15 @@ ActorAnimationInfo D_80367D70[]= { {ASSET_13A_ANIM_BOTTLES_ENTER, 2000000000.0f}, }; -ActorInfo D_80367DA0= { +ActorInfo D_80367DA0 = { 0x1DF, ACTOR_37A_BOTTLES, ASSET_387_MODEL_BOTTLES, - 1, D_80367D70, - func_802D9D60, func_80326224, func_802D94B4, + 1, moleAnimations, + mole_update, func_80326224, func_802D94B4, 0, 0, 0.0f, 0 }; -struct_core2_52290 D_80367DC4[] = { +// D_80367DC4 +struct_mole moleTable[] = { {ASSET_C23_DIALOG_BEAKBOMB_LEARN, ASSET_C24_DIALOG_BEAKBOMB_REFRESHER, 0x0F, ABILITY_1_BEAK_BOMB}, {ASSET_B47_DIALOG_EGGS_LEARN, ASSET_B4B_DIALOG_EGGS_REFRESHER, 0x16, ABILITY_6_EGGS}, {ASSET_B48_DIALOG_BEAKBUSTER_LEARN, ASSET_B4C_DIALOG_BEAKBUSTER_REFRESHER, 0x17, ABILITY_2_BEAK_BUSTER}, @@ -44,7 +45,9 @@ struct_core2_52290 D_80367DC4[] = { }; /* .code */ -int func_802D9220(enum level_e level){ +// func_802D9220 +int mole_learnedAllLevelAbilities(enum level_e level){ + // Checks if all of the level's abilities are learned. switch (level){ case LEVEL_1_MUMBOS_MOUNTAIN: return ability_isUnlocked(ABILITY_6_EGGS) @@ -66,30 +69,34 @@ int func_802D9220(enum level_e level){ } } -enum asset_e func_802D9304(void){ +// func_802D9304 +enum asset_e mole_learnedAllLevelAbilitiesDialog(void){ + // If the player has learned all game abilities, use "learned all abilities" dialog + // If the player learned all level abilities, use "learned world abilities" dialog s32 level_id = level_get(); - int learned_all_moves = func_802D9220(level_id); + int learned_all_moves = mole_learnedAllLevelAbilities(level_id); switch(level_id){ case LEVEL_1_MUMBOS_MOUNTAIN: - return learned_all_moves ? 0xb4e : 0xd38; + return learned_all_moves ? ASSET_B4E_TEXT_BOTTLES_ALL_MM_MOVES_LEARNED : ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED; case LEVEL_2_TREASURE_TROVE_COVE: - return learned_all_moves ? 0xa27 : 0xd38; + return learned_all_moves ? ASSET_A27_TEXT_BOTTLES_ALL_TTC_MOVES_LEARNED : ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED; case LEVEL_3_CLANKERS_CAVERN: - return learned_all_moves ? 0xd37 : 0xd38; + return learned_all_moves ? ASSET_D37_TEXT_BOTTLES_ALL_CC_MOVES_LEARNED : ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED; case LEVEL_4_BUBBLEGLOOP_SWAMP: - return learned_all_moves ? 0xc8a : 0xd38; + return learned_all_moves ? ASSET_C8A_TEXT_BOTTLES_ALL_BGS_MOVES_LEARNED : ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED; case LEVEL_5_FREEZEEZY_PEAK: - return learned_all_moves ? 0xc2a : 0xd38; + return learned_all_moves ? ASSET_C2A_TEXT_BOTTLES_ALL_FP_GV_MOVES_LEARNED : ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED; case LEVEL_7_GOBIS_VALLEY: - return learned_all_moves ? 0xc2a : 0xd38; + return learned_all_moves ? ASSET_C2A_TEXT_BOTTLES_ALL_FP_GV_MOVES_LEARNED : ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED; default: - return 0xd38; + return ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED; } } - -int func_802D93EC(void){ +// func_802D93EC +int mole_learnedAllGameAbilities(void){ + // Checks if the player has learned all non-Spiral Mountain abilities. return ability_isUnlocked(ABILITY_6_EGGS) && ability_isUnlocked(ABILITY_2_BEAK_BUSTER) && ability_isUnlocked(ABILITY_10_TALON_TROT) @@ -135,20 +142,25 @@ void func_802D9600(Actor * this){ this->marker->propPtr->unk8_3 = 0; } -void func_802D9658(Actor *this){ - timed_setStaticCameraToNode(0.0f, D_80367DC4[this->unkF4_8-9].camera_node); +// func_802D9658 +void mole_setStaticCamera(Actor *this){ + // Sets the camera to a static camera + timed_setStaticCameraToNode(0.0f, moleTable[this->unkF4_8-9].camera_node); } -void func_802D9698(ActorMarker *marker, enum asset_e arg1, s32 arg2){ +// func_802D9698 +void mole_healthRefill(ActorMarker *marker, enum asset_e arg1, s32 arg2){ + // Refills the player's health upon learning a new ability, if needed + // Also releases the camera Actor *actor = marker_getActor(marker); - if( arg1 == D_80367DC4[actor->unkF4_8-9].learn_text + if( arg1 == moleTable[actor->unkF4_8-9].learn_text && item_getCount(ITEM_14_HEALTH) < item_getCount(ITEM_15_HEALTH_TOTAL) ){ - func_80311480(ASSET_D39_TEXT_BOTTLES_REFILL_HEALTH, 7, 0, actor->marker, func_802D9698, func_802D9830); + func_80311480(ASSET_D39_TEXT_BOTTLES_REFILL_HEALTH, 7, 0, actor->marker, mole_healthRefill, mole_additionalAbilityLearnActions); }//L802D9738 - else if(arg1 == D_80367DC4[actor->unkF4_8-9].learn_text || arg1 == ASSET_D39_TEXT_BOTTLES_REFILL_HEALTH){ - func_80311480(func_802D93EC()? 0xa87 : func_802D9304(), 7, 0, actor->marker, func_802D9698, NULL); + else if(arg1 == moleTable[actor->unkF4_8-9].learn_text || arg1 == ASSET_D39_TEXT_BOTTLES_REFILL_HEALTH){ + func_80311480(mole_learnedAllGameAbilities()? 0xa87 : mole_learnedAllLevelAbilitiesDialog(), 7, 0, actor->marker, mole_healthRefill, NULL); } else{//L802D97BC if(actor->unk138_24){ @@ -166,56 +178,61 @@ void func_802D9698(ActorMarker *marker, enum asset_e arg1, s32 arg2){ }//L802D9820 } -void func_802D9830(ActorMarker *marker, enum asset_e arg1, s32 arg2){ +// func_802D9830 +void mole_additionalAbilityLearnActions(ActorMarker *marker, enum asset_e arg1, s32 arg2){ + // Performs actions depending on what move is being learned Actor *actor = marker_getActor(marker); switch(arg2){ - case 1: + case 1: // Stilt Stride timed_setStaticCameraToNode(0.0f, 0x11); levelSpecificFlags_set(0x1A, 1); break; case 2: levelSpecificFlags_set(0x1A, 0); - func_802D9658(actor); + mole_setStaticCamera(actor); break; - case 3: + case 3: // Turbo Talon Trainer timed_setStaticCameraToNode(0.0f, 0x29); levelSpecificFlags_set(0x1A, 1); break; case 4: levelSpecificFlags_set(0x1A, 0); - func_802D9658(actor); + mole_setStaticCamera(actor); break; - case 5: + case 5: // Egg Firing func_803463D4(ITEM_D_EGGS, 50); break; - case 6: + case 6: // Flight func_803463D4(ITEM_F_RED_FEATHER, 25); break; - case 7: + case 7: // Wonderwing func_803463D4(ITEM_10_GOLD_FEATHER, 5); break; - case 8: + case 8: // Refill Health item_set(ITEM_14_HEALTH, item_getCount(ITEM_15_HEALTH_TOTAL)); break; case 0xff: - func_802D9658(actor); + mole_setStaticCamera(actor); break; } } -int func_802D997C(Actor *this){ +// func_802D997C +int mole_learnAbility(Actor *this){ s32 sp2C; s32 sp28 = 0xe; - if(ability_isUnlocked(D_80367DC4[this->unkF4_8-9].ability)){ + // Known Ability: Refresher Dialog + if(ability_isUnlocked(moleTable[this->unkF4_8-9].ability)){ sp28 = 0xf; - sp2C = D_80367DC4[this->unkF4_8-9].refresher_text; + sp2C = moleTable[this->unkF4_8-9].refresher_text; }//L802D99EC + // New Ability: Learn Dialog & Misc Actions else{ func_80347A14(0); this->unk138_24 = 1; - sp2C = D_80367DC4[this->unkF4_8-9].learn_text; - ability_unlock(D_80367DC4[this->unkF4_8-9].ability); - switch(D_80367DC4[this->unkF4_8-9].ability){ + sp2C = moleTable[this->unkF4_8-9].learn_text; + ability_unlock(moleTable[this->unkF4_8-9].ability); + switch(moleTable[this->unkF4_8-9].ability){ case ABILITY_9_FLY: case ABILITY_D_SHOCK_JUMP: func_8030E6A4(SFX_113_PAD_APPEARS, 0.9f, 32000); @@ -225,7 +242,7 @@ int func_802D997C(Actor *this){ break; } }//L802D9A9C - func_80311480(sp2C, sp28, this->position, this->marker, func_802D9698, func_802D9830); + func_80311480(sp2C, sp28, this->position, this->marker, mole_healthRefill, mole_additionalAbilityLearnActions); return TRUE; } @@ -243,23 +260,29 @@ void func_802D9ADC(Actor *this){ func_8030DD14(this->unk44_31, 2); func_8030DBB4(this->unk44_31, 1.4f); sfxsource_setSampleRate(this->unk44_31, 26000); - func_802D9658(this); + mole_setStaticCamera(this); func_8028F94C(2, this->position); } -void func_802D9BD8(Actor *this){ +// func_802D9BD8 +void mole_Refresher(Actor *this){ + // Plays the scene where Bottles gives the player a refresher on the ability. subaddie_set_state(this, 5); - func_802D9658(this); + mole_setStaticCamera(this); func_8028F94C(2, this->position); - func_802D997C(this); + mole_learnAbility(this); } -void func_802D9C1C(Actor *this){ +// func_802D9C1C +void mole_setFacingDirection(Actor *this){ + // Sets the actor to always be facing the player subaddie_set_state_with_direction(this, 3, 0.0001f, 1); actor_loopAnimation(this); } -void func_802D9C54(ActorMarker *marker){ +// func_802D9C54 +void mole_spawnMolehill(ActorMarker *marker){ + // Spawns a molehill for the actor Actor *actor = marker_getActor(marker); Actor *other = spawn_child_actor(ACTOR_12C_MOLEHILL, &actor); f32 pad[1]; @@ -275,9 +298,12 @@ void func_802D9C90(Actor *this){ } } -void func_802D9CBC(Actor *this){ - if(ability_isUnlocked(D_80367DC4[this->unkF4_8 - 9].ability)){ - func_802D9BD8(this); +// func_802D9CBC +void mole_startingDialog(Actor *this){ + // If the player knows the ability, use refresher function + // Otherwise, set player's position and spawn mole + if(ability_isUnlocked(moleTable[this->unkF4_8 - 9].ability)){ + mole_Refresher(this); } else{ if(func_80329530(this, 150)){ @@ -290,7 +316,9 @@ void func_802D9CBC(Actor *this){ } } -void func_802D9D60(Actor *this){ +// func_802D9D60 +void mole_update(Actor *this){ + // Sets up the initial functions and state for the actor s32 sp50[6]; f32 sp4C; f32 pad44[1]; @@ -298,6 +326,8 @@ void func_802D9D60(Actor *this){ NodeProp *node_prop; f32 sp34[3]; + // Checks the actor's selector value is between 0x8 and 0x13 + // Anything lower is a Spiral Mountain ability, and should use a different actor id if(this->unkF4_8 < 8 || this->unkF4_8 >= 0x13) return; @@ -317,6 +347,8 @@ void func_802D9D60(Actor *this){ }//L802D9E34 if(!this->initialized){ + // Checks if player is within radius of a specific actor exists within the same cube + // If actor exists and player is within radius, force trigger conversation node_prop = func_80304C38(0x372, this); if(node_prop == NULL){ this->unk38_0 = FALSE; @@ -325,7 +357,8 @@ void func_802D9D60(Actor *this){ this->unk38_0 = TRUE; nodeprop_getPosition(node_prop, this->unk1C); } - __spawnQueue_add_1((GenFunction_1)func_802D9C54, reinterpret_cast(s32, this->marker)); + // Spawns molehill + __spawnQueue_add_1((GenFunction_1)mole_spawnMolehill, reinterpret_cast(s32, this->marker)); this->marker->propPtr->unk8_3 = FALSE; this->marker->collidable = FALSE; this->initialized = TRUE; @@ -343,19 +376,19 @@ void func_802D9D60(Actor *this){ } } }//L802D9F34 - func_8024E55C(0, sp50);//get face buttons press counters + func_8024E55C(0, sp50); // get face buttons press counters switch(this->state){ case 1://L802D9F70 this->yaw_ideal = func_80329784(this); func_80328FB0(this, 4.0f); if(func_8028F20C() && func_8028F0D4() && !func_8028EC04()){ if( this->unkF4_8 == 0x12 - && !ability_isUnlocked(D_80367DC4[this->unkF4_8-9].ability) + && !ability_isUnlocked(moleTable[this->unkF4_8-9].ability) && (func_8028ECAC() == 0 || func_8028ECAC() == BSGROUP_8_TROT) ){ player_getPosition(sp34); if(ml_distance_vec3f(sp34, this->velocity) < this->unk28){ - func_802D9CBC(this); + mole_startingDialog(this); } } else{//L802DA054 @@ -364,7 +397,7 @@ void func_802D9D60(Actor *this){ && func_8028EFC8() && sp50[FACE_BUTTON(BUTTON_B)] == 1 ){ - func_802D9CBC(this); + mole_startingDialog(this); } } } @@ -379,7 +412,7 @@ void func_802D9D60(Actor *this){ func_8030E2C4(this->unk44_31); }//L802DA128 if(actor_animationIsAt(this, 0.9999f)){ - func_802D9C1C(this); + mole_setFacingDirection(this); func_8030DA44(this->unk44_31); this->unk44_31 = 0; } @@ -393,7 +426,7 @@ void func_802D9D60(Actor *this){ FUNC_8030E8B4(SFX_C5_TWINKLY_POP, 1.0f, 32000, this->position, 1250, 2500); } else if(actor_animationIsAt(this, 0.35f)){//L802DA1EC - func_802D997C(this); + mole_learnAbility(this); } break; case 3://L802DA210 @@ -440,7 +473,9 @@ void func_802D9D60(Actor *this){ }//L802DA488 } -int func_802DA498(void){ +// func_802DA498 +int mole_learnedAllSpiralMountainAbilities(void){ + // Checks if the player has learned all of the Spiral Mountain abilities. return ability_isUnlocked(ABILITY_F_DIVE) && ability_isUnlocked(ABILITY_4_BEAR_PUNCH) && ability_isUnlocked(ABILITY_C_ROLL) diff --git a/src/core2/code_DA760.c b/src/core2/code_DA760.c index 745be003..c99ffc0c 100644 --- a/src/core2/code_DA760.c +++ b/src/core2/code_DA760.c @@ -16,17 +16,17 @@ ActorInfo D_803731B0 = { int func_803616F0(Actor *this){ switch(this->unkF4_8){ case 1:// L80361728 - return fileProgressFlag_get(FILEPROG_31_MM_OPEN) && !func_802D9220(LEVEL_1_MUMBOS_MOUNTAIN); + return fileProgressFlag_get(FILEPROG_31_MM_OPEN) && !mole_learnedAllLevelAbilities(LEVEL_1_MUMBOS_MOUNTAIN); case 2:// L80361750 - return fileProgressFlag_get(FILEPROG_32_TTC_OPEN) && !func_802D9220(LEVEL_2_TREASURE_TROVE_COVE); + return fileProgressFlag_get(FILEPROG_32_TTC_OPEN) && !mole_learnedAllLevelAbilities(LEVEL_2_TREASURE_TROVE_COVE); case 3:// L80361778 - return fileProgressFlag_get(FILEPROG_33_CC_OPEN) && !func_802D9220(LEVEL_3_CLANKERS_CAVERN); + return fileProgressFlag_get(FILEPROG_33_CC_OPEN) && !mole_learnedAllLevelAbilities(LEVEL_3_CLANKERS_CAVERN); case 4:// L803617A0 - return fileProgressFlag_get(FILEPROG_34_BGS_OPEN) && !func_802D9220(LEVEL_4_BUBBLEGLOOP_SWAMP); + return fileProgressFlag_get(FILEPROG_34_BGS_OPEN) && !mole_learnedAllLevelAbilities(LEVEL_4_BUBBLEGLOOP_SWAMP); case 5:// L803617C8 - return fileProgressFlag_get(FILEPROG_35_FP_OPEN) && !func_802D9220(LEVEL_5_FREEZEEZY_PEAK); + return fileProgressFlag_get(FILEPROG_35_FP_OPEN) && !mole_learnedAllLevelAbilities(LEVEL_5_FREEZEEZY_PEAK); case 6:// L803617F0 - return fileProgressFlag_get(FILEPROG_36_GV_OPEN) && !func_802D9220(LEVEL_7_GOBIS_VALLEY); + return fileProgressFlag_get(FILEPROG_36_GV_OPEN) && !mole_learnedAllLevelAbilities(LEVEL_7_GOBIS_VALLEY); default: return FALSE; } diff --git a/src/core2/code_DC4B0.c b/src/core2/code_DC4B0.c index 595e0c67..9d2c0d12 100644 --- a/src/core2/code_DC4B0.c +++ b/src/core2/code_DC4B0.c @@ -30,7 +30,7 @@ void func_803634BC(void){ void func_80363500(Actor *this){ if(!this->unk16C_4){ - if(!func_802DA498()){ + if(!mole_learnedAllSpiralMountainAbilities()){ func_803634BC(); } else{ @@ -40,7 +40,7 @@ void func_80363500(Actor *this){ this->unk16C_4 = 1; }//L8036355C - if(func_802DA498()){ + if(mole_learnedAllSpiralMountainAbilities()){ func_80363470(); marker_despawn(this->marker); }