Merge branch 'mr-origin-53'

This commit is contained in:
Banjo Kazooie
2024-09-01 16:26:51 -05:00
32 changed files with 1082 additions and 791 deletions

View File

@@ -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;
} ChSmMoleDescription;
//public
void func_803899B0(Actor * this);
void SM_func_80389610(Actor * this);
void chsmmole_Update(Actor * this);
void chsmmole_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,33 @@ 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 chSmMole = {
MARKER_B7_TUTORIAL_BOTTLES, ACTOR_12B_TUTORIAL_BOTTLES, ASSET_387_MODEL_BOTTLES,
1, smMoleAnimations,
chsmmole_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_FLAP_FLIP},
{0xe01, 0xe03, 7, ABILITY_5_CLIMB},
{0xe10, 0xe11, 0x11, -1},
ChSmMoleDescription 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){
/**
* @brief Checks if any Spiral Mountain abilities have been learned
*/
int chsmmole_learnedAnySpiralMountainAbilities(void){
return ability_isUnlocked(ABILITY_F_DIVE)
|| ability_isUnlocked(ABILITY_4_CLAW_SWIPE)
|| ability_isUnlocked(ABILITY_C_ROLL)
@@ -64,7 +70,11 @@ int func_80388D80(void){
|| ability_isUnlocked(ABILITY_5_CLIMB);
}
void func_80388E48(void){
/**
* @brief Sets all Spiral Mountain abilities to used & disables the noise
* played when the player uses an ability for the first time.
*/
void chsmmole_setSpiralMountainAbilitiesAsUsed(void){
ability_unlock(ABILITY_3_CAMERA_CONTROL);
ability_setHasUsed(ABILITY_0_BARGE);
ability_setHasUsed(ABILITY_1_BEAK_BOMB);
@@ -77,7 +87,10 @@ void func_80388E48(void){
ability_setHasUsed(ABILITY_A_HOLD_A_JUMP_HIGHER);
}
void func_80388EB0(void){
/**
* @brief Unlocks all of the Spiral Mountain moves.
*/
void chsmmole_skipIntroTutorial(void){
ability_unlock(ABILITY_F_DIVE);
ability_unlock(ABILITY_4_CLAW_SWIPE);
ability_unlock(ABILITY_C_ROLL);
@@ -87,16 +100,20 @@ void func_80388EB0(void){
ability_unlock(ABILITY_7_FEATHERY_FLAP);
ability_unlock(ABILITY_8_FLAP_FLIP);
ability_unlock(ABILITY_5_CLIMB);
func_80388E48();
chsmmole_setSpiralMountainAbilitiesAsUsed();
mapSpecificFlags_set(3,1);
}
/**
* @brief 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.
*/
void chsmmole_setSpiralMountainStaticCamera(Actor *this){
void func_80388F24(Actor *this){
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,9 +156,9 @@ void func_80388FA0(Actor *this, s32 arg1){
animctrl_setSmoothTransition(this->animctrl, 0);
break;
case 5:
func_80388F24(this);
chsmmole_setSpiralMountainStaticCamera(this);
func_8028F94C(2,this->position);
SM_func_80389610(this);
chsmmole_80389610(this);
break;
case 3:
actor_loopAnimation(this);
@@ -158,14 +175,18 @@ 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);
chsmmole_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){
/**
* @brief Performs actions depending on what move is being learned
*
*/
static void __chsmmole_additionalAbilityLearnActions(ActorMarker *marker, enum asset_e text_id, s32 arg2){
Actor *actor = marker_getActor(marker);
switch(arg2){
case 3:
@@ -181,7 +202,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);
chsmmole_setSpiralMountainStaticCamera(actor);
break;
}
}
@@ -190,43 +211,45 @@ void func_803892C8(ActorMarker *marker, enum asset_e text_id, s32 arg2){
Actor *actor;
actor = marker_getActor(marker);
if(!mapSpecificFlags_get(3) && learnedAllTutorialAbilities()){
if(!mapSpecificFlags_get(3) && chmole_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, __chsmmole_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,29 +257,31 @@ 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)){
void chsmmole_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);
}
}
void SM_func_80389610(Actor * this){
void chsmmole_80389610(Actor * this){
s32 sp2C;
s32 sp28;
@@ -272,25 +297,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();
chsmmole_setSpiralMountainAbilitiesAsUsed();
sp2C = fileProgressFlag_get(FILEPROG_DB_SKIPPED_TUTORIAL) ? 0xe1e : 0xe13;
mapSpecificFlags_set(0xf, 1);
}
@@ -299,11 +324,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 +343,7 @@ void SM_func_80389610(Actor * this){
mapSpecificFlags_set(4, 1);
}
else{//L803898E4
func_80389494(this, &sp2C, &sp28);
chsmmole_learnAbility(this, &sp2C, &sp28);
}
break;
@@ -330,25 +355,28 @@ void SM_func_80389610(Actor * this){
mapSpecificFlags_set(0xE, 1);
}
else{//L803898E4
func_80389494(this, &sp2C, &sp28);
chsmmole_learnAbility(this, &sp2C, &sp28);
}
break;
default://L803898F8
func_80389494(this, &sp2C, &sp28);
chsmmole_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, __chsmmole_additionalAbilityLearnActions);
}
}
void func_80389948(ActorMarker * marker){
/**
* @brief Spawns a molehill for the actor
*/
void chsmmole_spawnMolehill(ActorMarker * marker){
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 +390,16 @@ void func_80389984(Actor * this){
func_8030DA44(tmp);
}
void func_803899B0(Actor * this){
s32 sp50[6]; //face buttons
f32 sp44[3]; //player position
void chsmmole_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;
int user_input;
// 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 +425,10 @@ void func_803899B0(Actor * this){
}
}
}//L80389AC8
if(func_80388D80()){
if(chsmmole_learnedAnySpiralMountainAbilities()){
mapSpecificFlags_set(1,1);
if(learnedAllTutorialAbilities()){
if(chmole_learnedAllSpiralMountainAbilities()){
mapSpecificFlags_set(3, 1);
mapSpecificFlags_set(2, 1);
mapSpecificFlags_set(0xC, 1);
@@ -407,7 +438,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)chsmmole_spawnMolehill, reinterpret_cast(s32, this->marker));
this->unk16C_4 = 1;
}//L80389B4C
@@ -443,7 +474,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
@@ -476,7 +507,7 @@ void func_803899B0(Actor * this){
}//L80389EA0
if(actor_animationIsAt(this, 0.9999f)){
if(!mapSpecificFlags_get(1)){
SM_func_80389610(this);
chsmmole_80389610(this);
}
func_80388FA0(this, 3);
}//L80389EE0
@@ -489,7 +520,7 @@ void func_803899B0(Actor * this){
}else if(actor_animationIsAt(this, 0.35f)){//L80389F78
if(mapSpecificFlags_get(1)){
SM_func_80389610(this);
chsmmole_80389610(this);
}
}
break;
@@ -524,21 +555,21 @@ void func_803899B0(Actor * this){
mapSpecificFlags_set(5,0);
func_80388FA0(this, 4);
}//L8038A1B8
sp38 = -1;
user_input = -1;
if(this->unk38_0){
this->unk60 += time_getDelta();
if(func_803114C4() != 0xe1d){
if(sp50[FACE_BUTTON(BUTTON_A)] == 1)
sp38 = 1; //A button pressed
user_input = 1; //A button pressed
else if(sp50[FACE_BUTTON(BUTTON_B)] == 1)
sp38 = 0; //B button pressed
user_input = 0; //B button pressed
}//L8038A218
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);
if(!sp38){
func_80388EB0(); //give all SM moves
if( user_input != -1){ //button was pressed
fileProgressFlag_set(FILEPROG_DB_SKIPPED_TUTORIAL, (user_input)?0:1);
func_80311480((user_input)? 0xe07 : 0xe09, 0xe, this->position, this->marker, func_803892C8, __chsmmole_additionalAbilityLearnActions);
if(!user_input){
chsmmole_skipIntroTutorial(); //give all SM moves
}
this->unk38_0 = 0;
}else if(!this->unk138_24 && 5.0 < this->unk60){