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

@@ -82,7 +82,7 @@ bool chCollectible_collectItem(Actor* actor, enum file_progress_e arg1, enum ass
if(!func_802FADD4(0x1b)){
item_inc(itemId);
} else {
func_803463F4(itemId,1);
item_adjustByDiffWithoutHud(itemId,1);
}
if(!actor || !actor->unk38_0)

View File

@@ -21,8 +21,8 @@ void func_802C5740(Actor *this);
extern void func_802C71F0(Actor *);
extern void func_802C74F4(Actor *, s32, f32 );
extern void func_8031FB14(s32, s32);
extern void func_8031F678(s32, s32);
extern void warp_lairEnterLairFromSMLevel(s32, s32);
extern void warp_smExitBanjosHouse(s32, s32);
extern void func_80335110(s32);
extern void func_8024E60C(s32, s32[3]);
@@ -413,11 +413,11 @@ void func_802C4C14(Actor *this){
sp44 = 0.0f;
if(this->state == 4 && (sp84 == 0 || sp84 == 1))
sp44 = 0.25f;
if(learnedAllTutorialAbilities() && fileProgressFlag_get(FILEPROG_BD_ENTER_LAIR_CUTSCENE)){
timedFunc_set_2(sp44, (GenFunction_2)func_8031FB14, 0, 0);
if(chmole_learnedAllSpiralMountainAbilities() && fileProgressFlag_get(FILEPROG_BD_ENTER_LAIR_CUTSCENE)){
timedFunc_set_2(sp44, (GenFunction_2)warp_lairEnterLairFromSMLevel, 0, 0);
}
else{//L802C5188
timedFunc_set_2(sp44, (GenFunction_2)func_8031F678, 0, 0);
timedFunc_set_2(sp44, (GenFunction_2)warp_smExitBanjosHouse, 0, 0);
}//L802C51A0
timedFunc_set_1(sp44, (GenFunction_1)func_80335110, 1);
}//L802C51B8

View File

@@ -51,7 +51,7 @@ void __chJinjo_802CDBA8(ActorMarker *this, ActorMarker *other){
fileProgressFlag_set(FILEPROG_E_JINJO_TEXT, 1);
}
subaddie_set_state_with_direction(actorPtr, 6, 0.0f , -1);
if(func_803463D4(ITEM_12_JINJOS, 1 << (this->unk14_20 + 6) ) == 0x1f)
if(item_adjustByDiffWithHud(ITEM_12_JINJOS, 1 << (this->unk14_20 + 6) ) == 0x1f)
localPtr->unk4 = 1;
actor_loopAnimation(actorPtr);
this->collidable = 0;

View File

@@ -2,19 +2,19 @@
#include "functions.h"
#include "variables.h"
void func_802D9D60(Actor *this);
void chmole_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 chmole_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;
} ChMoleDescription;
/* .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 gChMole = {
0x1DF, ACTOR_37A_BOTTLES, ASSET_387_MODEL_BOTTLES,
1, D_80367D70,
func_802D9D60, func_80326224, func_802D94B4,
1, moleAnimations,
chmole_update, func_80326224, func_802D94B4,
0, 0, 0.0f, 0
};
struct_core2_52290 D_80367DC4[] = {
// D_80367DC4
ChMoleDescription 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 chmole_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 chmole_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 = chmole_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 chmole_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 chmole_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 chmole_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, chmole_healthRefill, chmole_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(chmole_learnedAllGameAbilities()? 0xa87 : chmole_learnedAllLevelAbilitiesDialog(), 7, 0, actor->marker, chmole_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 chmole_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);
chmole_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);
chmole_setStaticCamera(actor);
break;
case 5:
func_803463D4(ITEM_D_EGGS, 50);
case 5: // Egg Firing
item_adjustByDiffWithHud(ITEM_D_EGGS, 50);
break;
case 6:
func_803463D4(ITEM_F_RED_FEATHER, 25);
case 6: // Flight
item_adjustByDiffWithHud(ITEM_F_RED_FEATHER, 25);
break;
case 7:
func_803463D4(ITEM_10_GOLD_FEATHER, 5);
case 7: // Wonderwing
item_adjustByDiffWithHud(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);
chmole_setStaticCamera(actor);
break;
}
}
int func_802D997C(Actor *this){
// func_802D997C
int chmole_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_FLIGHT:
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, chmole_healthRefill, chmole_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);
chmole_setStaticCamera(this);
func_8028F94C(2, this->position);
}
void func_802D9BD8(Actor *this){
// func_802D9BD8
void chmole_Refresher(Actor *this){
// Plays the scene where Bottles gives the player a refresher on the ability.
subaddie_set_state(this, 5);
func_802D9658(this);
chmole_setStaticCamera(this);
func_8028F94C(2, this->position);
func_802D997C(this);
chmole_learnAbility(this);
}
void func_802D9C1C(Actor *this){
// func_802D9C1C
void chmole_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 chmole_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 chmole_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)){
chmole_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 chmole_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)chmole_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);
chmole_startingDialog(this);
}
}
else{//L802DA054
@@ -364,7 +397,7 @@ void func_802D9D60(Actor *this){
&& func_8028EFC8()
&& sp50[FACE_BUTTON(BUTTON_B)] == 1
){
func_802D9CBC(this);
chmole_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);
chmole_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);
chmole_learnAbility(this);
}
break;
case 3://L802DA210
@@ -440,7 +473,8 @@ void func_802D9D60(Actor *this){
}//L802DA488
}
int learnedAllTutorialAbilities(void){
int chmole_learnedAllSpiralMountainAbilities(void){
// Checks if the player has learned all of the Spiral Mountain abilities.
return ability_isUnlocked(ABILITY_F_DIVE)
&& ability_isUnlocked(ABILITY_4_CLAW_SWIPE)
&& ability_isUnlocked(ABILITY_C_ROLL)