Document ch Bottles

This commit is contained in:
Owlenuff
2024-10-02 13:58:41 +02:00
parent 82cc8de206
commit c9d8cc4a56
4 changed files with 380 additions and 335 deletions

View File

@@ -2147,6 +2147,8 @@ enum actor_e
ACTOR_33F_WOZZA_IN_CAVE = 0x33F,
ACTOR_349_UNKNOWN = 0x349,
ACTOR_34D_BEE_SWARM = 0x34D,
ACTOR_34E_LIMBO,
ACTOR_34F_MUMMUM,
@@ -2441,7 +2443,7 @@ enum bs_e
};
enum sm_specific_flags {
SM_SPECIFIC_FLAG_1 = 0x1,
SM_SPECIFIC_FLAG_1_TALKED_TO_BOTTLES = 0x1,
SM_SPECIFIC_FLAG_2,
SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED,
SM_SPECIFIC_FLAG_4,
@@ -4418,9 +4420,9 @@ enum asset_e
ASSET_E03_TEXT_BOTTLES_CLIMB_REFRESHER,
ASSET_E04_TEXT_BOTTLES_BEAK_BARGE_LEARN,
ASSET_E05_TEXT_UNKNOWN,
ASSET_E06_TEXT_BOTTLES_BEAK_BARGE_REFRESHER = 0xE06,
ASSET_E08_TEXT_BOTTLES_FIND_ANOTHER_MOLEHILL = 0xE08,
ASSET_E06_TEXT_BOTTLES_BEAK_BARGE_REFRESHER,
ASSET_E07_TEXT_BOTTLES_UNKNOWN,
ASSET_E08_TEXT_BOTTLES_FIND_ANOTHER_MOLEHILL,
ASSET_E09_TEXT_BOTTLES_SKIPPED_TUTORIAL,
ASSET_E0A_TEXT_BOTTLES_REFUSE_HELP_1,
ASSET_E0B_TEXT_BOTTLES_REFUSE_HELP_2,

View File

@@ -2,7 +2,7 @@
#include "functions.h"
#include "variables.h"
//external
/* extern functions */
Actor *func_802D94B4(ActorMarker *, Gfx **, Mtx **, Vtx **);
void func_8028E668(f32 *, f32, f32, f32);
void func_80328FB0(Actor *, f32);
@@ -10,21 +10,29 @@ void func_8030DA44(u8);
void timed_exitStaticCamera(f32);
void subaddie_set_state_with_direction(Actor *, s32, f32, s32);
//static types
/* typedefs and declarations */
enum chBottles_state_e {
BOTTLES_STATE_1_UNKNOWN = 1,
BOTTLES_STATE_2_UNKNOWN,
BOTTLES_STATE_3_UNKNOWN,
BOTTLES_STATE_4_UNKNOWN,
BOTTLES_STATE_5_UNKNOWN
};
typedef struct {
s16 learn_text;
s16 teach_text_id;
s16 refresher_text;
s8 camera_node;
s8 ability;
} ChSmMoleDescription;
//public
void chsmmole_Update(Actor * this);
void chsmmole_80389610(Actor * this);
/* public functions */
void chBottles_update(Actor *this);
void __chBottles_talk(Actor *this);
/* .data */
ActorAnimationInfo smMoleAnimations[6] = {
{0, 0.0f},
ActorAnimationInfo chBottlesAnimations[6] = {
{NULL, 0.0f},
{ASSET_13A_ANIM_BOTTLES_ENTER, 2000000000.0f},
{ASSET_13A_ANIM_BOTTLES_ENTER, 4.5f},
{ASSET_13B_ANIM_BOTTLES_IDLE, 7.0f},
@@ -32,49 +40,47 @@ ActorAnimationInfo smMoleAnimations[6] = {
{ASSET_13A_ANIM_BOTTLES_ENTER, 2000000000.0f}
};
ActorInfo chSmMole = {
MARKER_B7_TUTORIAL_BOTTLES, ACTOR_12B_TUTORIAL_BOTTLES, ASSET_387_MODEL_BOTTLES,
1, smMoleAnimations,
chsmmole_Update, actor_update_func_80326224, func_802D94B4,
ActorInfo chBottles = {
MARKER_B7_TUTORIAL_BOTTLES, ACTOR_12B_TUTORIAL_BOTTLES, ASSET_387_MODEL_BOTTLES, 1, chBottlesAnimations,
chBottles_update, actor_update_func_80326224, func_802D94B4,
0, 0, 0.0f, 0
};
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_FLAP_FLIP},
{ASSET_E01_TEXT_BOTTLES_CLIMB_LEARN, ASSET_E03_TEXT_BOTTLES_CLIMB_REFRESHER, 7, ABILITY_5_CLIMB},
ChSmMoleDescription chBottlesDialogTable[8] = {
{ASSET_DF3_TEXT_BOTTLES_INTRODUCTION, ASSET_E08_TEXT_BOTTLES_FIND_ANOTHER_MOLEHILL, 0x1, -1},
{ASSET_DF4_TEXT_BOTTLES_CAMERA_CONTROL_LEARN, ASSET_DF5_TEXT_BOTTLES_CAMERA_CONTROL_REFRESHER, 0x3, ABILITY_3_CAMERA_CONTROL},
{ASSET_DFB_TEXT_BOTTLES_DIVE_LEARN, ASSET_DFE_TEXT_BOTTLES_DIVE_REFRESHER, 0x5, ABILITY_F_DIVE},
{-1, ASSET_E00_TEXT_BOTTLES_ATTACK_REFRESHER, 0x6, ABILITY_B_RATATAT_RAP},
{ASSET_E04_TEXT_BOTTLES_BEAK_BARGE_LEARN, ASSET_E06_TEXT_BOTTLES_BEAK_BARGE_REFRESHER, 0x8, ABILITY_0_BARGE},
{-1, ASSET_DFA_TEXT_BOTTLES_JUMP_REFRESHER, 0x4, ABILITY_8_FLAP_FLIP},
{ASSET_E01_TEXT_BOTTLES_CLIMB_LEARN, ASSET_E03_TEXT_BOTTLES_CLIMB_REFRESHER, 0x7, ABILITY_5_CLIMB},
{ASSET_E10_TEXT_BOTTLES_BRIDGE_BROKEN, ASSET_E11_TEXT_BOTTLES_BRIDGE_STILL_BROKEN, 0x11, -1},
};
s32 D_8038AFE4 = 0;
s32 gDialogIndex = 0;
/* .code */
/**
* @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)
|| ability_isUnlocked(ABILITY_B_RATATAT_RAP)
|| ability_isUnlocked(ABILITY_0_BARGE)
|| ability_isUnlocked(ABILITY_A_HOLD_A_JUMP_HIGHER)
|| ability_isUnlocked(ABILITY_7_FEATHERY_FLAP)
|| ability_isUnlocked(ABILITY_8_FLAP_FLIP)
|| ability_isUnlocked(ABILITY_5_CLIMB);
bool __chBottles_isAnySpiralMountainAbilityLearned(void) {
return ability_isUnlocked(ABILITY_F_DIVE) ||
ability_isUnlocked(ABILITY_4_CLAW_SWIPE) ||
ability_isUnlocked(ABILITY_C_ROLL) ||
ability_isUnlocked(ABILITY_B_RATATAT_RAP) ||
ability_isUnlocked(ABILITY_0_BARGE) ||
ability_isUnlocked(ABILITY_A_HOLD_A_JUMP_HIGHER) ||
ability_isUnlocked(ABILITY_7_FEATHERY_FLAP) ||
ability_isUnlocked(ABILITY_8_FLAP_FLIP) ||
ability_isUnlocked(ABILITY_5_CLIMB);
}
/**
* @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){
void __chBottles_setHasUsedSpiralMountainAbilities(void) {
ability_unlock(ABILITY_3_CAMERA_CONTROL);
ability_setHasUsed(ABILITY_0_BARGE);
ability_setHasUsed(ABILITY_1_BEAK_BOMB);
@@ -90,7 +96,7 @@ void chsmmole_setSpiralMountainAbilitiesAsUsed(void){
/**
* @brief Unlocks all of the Spiral Mountain moves.
*/
void chsmmole_skipIntroTutorial(void){
void __chBottles_skipIntroTutorial(void) {
ability_unlock(ABILITY_F_DIVE);
ability_unlock(ABILITY_4_CLAW_SWIPE);
ability_unlock(ABILITY_C_ROLL);
@@ -100,136 +106,157 @@ void chsmmole_skipIntroTutorial(void){
ability_unlock(ABILITY_7_FEATHERY_FLAP);
ability_unlock(ABILITY_8_FLAP_FLIP);
ability_unlock(ABILITY_5_CLIMB);
chsmmole_setSpiralMountainAbilitiesAsUsed();
__chBottles_setHasUsedSpiralMountainAbilities();
mapSpecificFlags_set(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED, TRUE);
}
/**
* @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){
if(this->unkF4_8 == 1 && !mapSpecificFlags_get(SM_SPECIFIC_FLAG_1)){
void __chBottles_setStaticCameraToNode(Actor *this) {
if (this->unkF4_8 == 1 && !mapSpecificFlags_get(SM_SPECIFIC_FLAG_1_TALKED_TO_BOTTLES)) {
timed_setStaticCameraToNode(0.0f, 0x12);
}
else { //L80388F68
timed_setStaticCameraToNode(0.0f, smMoleTable[this->unkF4_8 -1].camera_node);
timed_setStaticCameraToNode(0.0f, chBottlesDialogTable[this->unkF4_8 - 1].camera_node);
}
}
void func_80388FA0(Actor *this, s32 arg1){
void __chBottles_setState(Actor *this, s32 next_state) {
Actor *other;
ActorMarker *myOther;
ActorMarker *molehillMarker;
switch (this->state) {
case 1://L80388FE8
case BOTTLES_STATE_1_UNKNOWN://L80388FE8
this->unk138_23 = 1;
break;
case 4://L80388FF8
case BOTTLES_STATE_4_UNKNOWN://L80388FF8
this->unk138_23 = 0;
case 2://L80389004
case BOTTLES_STATE_2_UNKNOWN://L80389004
func_8030DA44(this->unk44_31);
this->unk44_31 = 0;
break;
case 5://L80389018
case BOTTLES_STATE_5_UNKNOWN://L80389018
this->unk138_23 = 0;
func_8028F918(0);
break;
}//L8038902C
switch(arg1){
case 4:
switch (next_state) {
case BOTTLES_STATE_4_UNKNOWN:
other = subaddie_getLinkedActor(this);
myOther = this->unk100;
if(myOther && other && myOther->id == 0xB8)
molehillMarker = this->unk100;
if (molehillMarker && other && molehillMarker->id == 0xB8) {
subaddie_set_state_with_direction(other, 3, 0.0001f, 1);
}
actor_playAnimationOnce(this);
this->unk44_31 = sfxsource_createSfxsourceAndReturnIndex();
sfxsource_setSfxId(this->unk44_31, 0x3f9);
func_8030DD14(this->unk44_31, 2);
sfxsource_playSfxAtVolume(this->unk44_31, 1.4f);
sfxsource_setSampleRate(this->unk44_31, 0x6590);
func_8028F918(0);
break;
case 1:
case BOTTLES_STATE_1_UNKNOWN:
animctrl_setSmoothTransition(this->animctrl, 0);
break;
case 5:
chsmmole_setSpiralMountainStaticCamera(this);
case BOTTLES_STATE_5_UNKNOWN:
__chBottles_setStaticCameraToNode(this);
func_8028F94C(2, this->position);
chsmmole_80389610(this);
__chBottles_talk(this);
break;
case 3:
case BOTTLES_STATE_3_UNKNOWN:
actor_loopAnimation(this);
break;
case 2:
case BOTTLES_STATE_2_UNKNOWN:
other = subaddie_getLinkedActor(this);
myOther = this->unk100;
if(myOther && other && myOther->id == 0xB8)
molehillMarker = this->unk100;
if (molehillMarker && other && molehillMarker->id == 0xB8) {
subaddie_set_state_with_direction(other, 2, 0.0001f, 1);
}
animctrl_setSmoothTransition(this->animctrl, 1);
actor_playAnimationOnce(this);
this->unk44_31 = sfxsource_createSfxsourceAndReturnIndex();
sfxsource_setSfxId(this->unk44_31, 0x3f9);
func_8030DD14(this->unk44_31, 2);
sfxsource_playSfxAtVolume(this->unk44_31, 1.4f);
sfxsource_setSampleRate(this->unk44_31, 0x6590);
chsmmole_setSpiralMountainStaticCamera(this);
__chBottles_setStaticCameraToNode(this);
func_8028F94C(2, this->position);
break;
}
subaddie_set_state_with_direction(this, arg1, 0.0001f, 1);
subaddie_set_state_with_direction(this, next_state, 0.0001f, 1);
}
/**
* @brief Performs actions depending on what move is being learned
*
*/
static void __chsmmole_additionalAbilityLearnActions(ActorMarker *marker, enum asset_e text_id, s32 arg2){
static void __chBottles_textActions(ActorMarker *marker, enum asset_e text_id, s32 arg2) {
Actor *actor = marker_getActor(marker);
switch (arg2) {
case 3:
timed_setStaticCameraToNode(0.0f, 2);
break;
case 4:
mapSpecificFlags_set(SM_SPECIFIC_FLAG_4, TRUE);
break;
case 5:
timed_setStaticCameraToNode(0.0f, 0x12);
break;
case 6:
comusic_playTrack(COMUSIC_2B_DING_B);
break;
case 0xff:
chsmmole_setSpiralMountainStaticCamera(actor);
__chBottles_setStaticCameraToNode(actor);
break;
}
}
void func_803892C8(ActorMarker *marker, enum asset_e text_id, s32 arg2){
Actor *actor;
void __chBottles_textCallback(ActorMarker *marker, enum asset_e text_id, s32 arg2) {
Actor *actor = marker_getActor(marker);
actor = marker_getActor(marker);
if (!mapSpecificFlags_get(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED) && chmole_learnedAllSpiralMountainAbilities()) {
mapSpecificFlags_set(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED, TRUE);
gcdialog_showText(ASSET_E12_TEXT_BOTTLES_LEARNED_TUTORIAL_MOVES, 0xe, actor->position, actor->marker, func_803892C8, NULL);
gcdialog_showText(ASSET_E12_TEXT_BOTTLES_LEARNED_TUTORIAL_MOVES, 0xe, actor->position, actor->marker, __chBottles_textCallback, NULL);
}//L8038933C
else {
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)){
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 ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED:
break;
case ASSET_DF3_TEXT_BOTTLES_INTRODUCTION: /* 2FB8 803893A8 3C188039 */
gcdialog_showText(ASSET_E1F_TEXT_BOTTLES_TUTORIAL_OFFER, 0x8e, actor->position, actor->marker, func_803892C8, __chsmmole_additionalAbilityLearnActions);
gcdialog_showText(ASSET_E1F_TEXT_BOTTLES_TUTORIAL_OFFER, 0x8e, actor->position, actor->marker, __chBottles_textCallback, __chBottles_textActions);
break;
case ASSET_E1F_TEXT_BOTTLES_TUTORIAL_OFFER: /* 2FEC 803893DC 9209003B */
actor->unk38_0 = 1;
actor->unk38_0 = TRUE;
break;
case ASSET_E1D_TEXT_BOTTLES_TUTORIAL_OFFER_WAIT: /* 2FFC 803893EC 920B0138 */
@@ -244,189 +271,198 @@ void func_803892C8(ActorMarker *marker, enum asset_e text_id, s32 arg2){
case ASSET_E09_TEXT_BOTTLES_SKIPPED_TUTORIAL:
case ASSET_E12_TEXT_BOTTLES_LEARNED_TUTORIAL_MOVES:
func_80388FA0(actor,4);
__chBottles_setState(actor, BOTTLES_STATE_4_UNKNOWN);
break;
default:
if(actor->state != 5)
gcdialog_showText(ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED, 4, NULL, NULL, NULL, NULL);
if (actor->state != BOTTLES_STATE_5_UNKNOWN) {
gcdialog_showText(ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED, 0x4, NULL, NULL, NULL, NULL);
}
func_80388FA0(actor, actor->state == 5 ? 1:4);
__chBottles_setState(actor, actor->state == BOTTLES_STATE_5_UNKNOWN ? BOTTLES_STATE_1_UNKNOWN : BOTTLES_STATE_4_UNKNOWN);
break;
}
}
}
void chsmmole_learnAbility(Actor * this, s32* arg1, s32 *arg2){
void __chBottles_getReteachDialog(Actor *this, s32 *text_id, s32 *text_flags) {
// Selects the learn and refresh dialogs.
// Gives the player the ability if not learned.
if(ability_isUnlocked(smMoleTable[this->unkF4_8 -1].ability)){
if (ability_isUnlocked(chBottlesDialogTable[this->unkF4_8 - 1].ability)) {
if (fileProgressFlag_get(FILEPROG_DB_SKIPPED_TUTORIAL)) {
*arg1 = D_8038AFE4 + ASSET_E0A_TEXT_BOTTLES_REFUSE_HELP_1;
D_8038AFE4++;
D_8038AFE4 = MIN(D_8038AFE4, 5);
if(*arg1 != ASSET_E0E_TEXT_BOTTLES_REFUSE_HELP_5){
*arg2 |= 1;
}
}else{//L8038956C
*arg2 |= 1;
*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;
*text_id = gDialogIndex + ASSET_E0A_TEXT_BOTTLES_REFUSE_HELP_1;
gDialogIndex++;
gDialogIndex = MIN(gDialogIndex, 5);
if (*text_id != ASSET_E0E_TEXT_BOTTLES_REFUSE_HELP_5) {
*text_flags |= 1;
}
}
}else{//L803895C0
*arg1 = smMoleTable[this->unkF4_8 -1].learn_text;
ability_unlock(smMoleTable[this->unkF4_8 -1].ability);
else {//L8038956C
*text_flags |= 1;
*text_id = chBottlesDialogTable[this->unkF4_8 - 1].refresher_text;
if (*text_id == ASSET_DFE_TEXT_BOTTLES_DIVE_REFRESHER && !ability_hasUsed(ABILITY_3_CAMERA_CONTROL)) {
*text_id = ASSET_DFD_TEXT_BOTTLES_SWIM_LEARN;
}
}
}
else {//L803895C0
*text_id = chBottlesDialogTable[this->unkF4_8 - 1].teach_text_id;
ability_unlock(chBottlesDialogTable[this->unkF4_8 - 1].ability);
}
}
void chsmmole_80389610(Actor * this){
s32 sp2C;
s32 sp28;
void __chBottles_talk(Actor *this) {
s32 text_id;
s32 text_flags;
sp28 = 0xe;
sp2C = 0;
text_flags = 0xe;
text_id = 0;
switch (this->unkF4_8) {
case 1://L8038965C
if(mapSpecificFlags_get(SM_SPECIFIC_FLAG_1)){
sp28 |= 1;
if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_1_TALKED_TO_BOTTLES)) {
text_flags |= 1;
if (fileProgressFlag_get(FILEPROG_DB_SKIPPED_TUTORIAL)) {
sp2C = D_8038AFE4 + 0xE0A; //dialog index
D_8038AFE4++;
D_8038AFE4 = MIN(D_8038AFE4, 5);
}else{//L803896C0
sp2C = smMoleTable[this->unkF4_8 -1].refresher_text;
text_id = gDialogIndex + ASSET_E0A_TEXT_BOTTLES_REFUSE_HELP_1;
gDialogIndex++;
gDialogIndex = MIN(gDialogIndex, 5);
}
else {//L803896C0
text_id = chBottlesDialogTable[this->unkF4_8 - 1].refresher_text;
}
}
else {//L803896E8
sp2C = smMoleTable[this->unkF4_8 -1].learn_text;
mapSpecificFlags_set(SM_SPECIFIC_FLAG_1, TRUE);
text_id = chBottlesDialogTable[this->unkF4_8 - 1].teach_text_id;
mapSpecificFlags_set(SM_SPECIFIC_FLAG_1_TALKED_TO_BOTTLES, TRUE);
}
break;
case 8://L80389720
if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED)) {
if (fileProgressFlag_get(FILEPROG_A6_FURNACE_FUN_COMPLETE)) {
sp2C = ASSET_E37_TEXT_BOTTLES_STOP_WASTING_TIME_AFTER_FURNACE_FUN;
sp28 |= 1;
}else{//L80389758
if(mapSpecificFlags_get(SM_SPECIFIC_FLAG_F)){
sp2C = ASSET_E0F_TEXT_BOTTLES_STOP_WASTING_TIME_BEFORE_FURNACE_FUN;
sp28 |= 1;
}else{//L80389780
chsmmole_setSpiralMountainAbilitiesAsUsed();
sp2C = fileProgressFlag_get(FILEPROG_DB_SKIPPED_TUTORIAL) ? 0xe1e : 0xe13;
mapSpecificFlags_set(SM_SPECIFIC_FLAG_F, TRUE);
text_id = ASSET_E37_TEXT_BOTTLES_STOP_WASTING_TIME_AFTER_FURNACE_FUN;
text_flags |= 1;
}
else if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_F)) { //L80389758
text_id = ASSET_E0F_TEXT_BOTTLES_STOP_WASTING_TIME_BEFORE_FURNACE_FUN;
text_flags |= 1;
}
else {//L80389780
__chBottles_setHasUsedSpiralMountainAbilities();
text_id = fileProgressFlag_get(FILEPROG_DB_SKIPPED_TUTORIAL) ? 0xe1e : 0xe13;
mapSpecificFlags_set(SM_SPECIFIC_FLAG_F, TRUE);
} //L803897B4
mapSpecificFlags_set(SM_SPECIFIC_FLAG_2, TRUE);
}
else {//L803897C8
if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_2)) {
sp2C = smMoleTable[this->unkF4_8 -1].refresher_text;
sp28 |= 1;
text_id = chBottlesDialogTable[this->unkF4_8 - 1].refresher_text;
text_flags |= 1;
}
else {
sp2C = smMoleTable[this->unkF4_8 -1].learn_text;
text_id = chBottlesDialogTable[this->unkF4_8 - 1].teach_text_id;
mapSpecificFlags_set(SM_SPECIFIC_FLAG_2, TRUE);
}
}
break;
case 4://L80389848
if( !ability_isUnlocked(ABILITY_4_CLAW_SWIPE)
|| !ability_isUnlocked(ABILITY_C_ROLL)
|| !ability_isUnlocked(ABILITY_B_RATATAT_RAP)
){//L803898D4
if (!(ability_isUnlocked(ABILITY_4_CLAW_SWIPE) && ability_isUnlocked(ABILITY_C_ROLL) && ability_isUnlocked(ABILITY_B_RATATAT_RAP))) {//L803898D4
mapSpecificFlags_set(SM_SPECIFIC_FLAG_4, TRUE);
}
else {//L803898E4
chsmmole_learnAbility(this, &sp2C, &sp28);
__chBottles_getReteachDialog(this, &text_id, &text_flags);
}
break;
case 6://L803898A0
if( !ability_isUnlocked(ABILITY_A_HOLD_A_JUMP_HIGHER)
|| !ability_isUnlocked(ABILITY_7_FEATHERY_FLAP)
|| !ability_isUnlocked(ABILITY_8_FLAP_FLIP)
){//L803898D4
if (!(ability_isUnlocked(ABILITY_A_HOLD_A_JUMP_HIGHER) && ability_isUnlocked(ABILITY_7_FEATHERY_FLAP) && ability_isUnlocked(ABILITY_8_FLAP_FLIP))) {//L803898D4
mapSpecificFlags_set(SM_SPECIFIC_FLAG_E, TRUE);
}
else {//L803898E4
chsmmole_learnAbility(this, &sp2C, &sp28);
__chBottles_getReteachDialog(this, &text_id, &text_flags);
}
break;
default://L803898F8
chsmmole_learnAbility(this, &sp2C, &sp28);
__chBottles_getReteachDialog(this, &text_id, &text_flags);
break;
}//L80389904
if(sp2C){
gcdialog_showText(sp2C, sp28, this->position, this->marker, func_803892C8, __chsmmole_additionalAbilityLearnActions);
if (text_id) {
gcdialog_showText(text_id, text_flags, this->position, this->marker, __chBottles_textCallback, __chBottles_textActions);
}
}
/**
* @brief Spawns a molehill for the actor
*/
void chsmmole_spawnMolehill(ActorMarker * marker){
Actor *actor;
Actor *other;
void __chBottles_spawnMolehill(ActorMarker *marker) {
Actor *this;
Actor *molehill;
s32 pad;
actor = marker_getActor(marker);
other = spawn_child_actor(ACTOR_12C_MOLEHILL, &actor);
actor->unk100 = other->marker;
this = marker_getActor(marker);
molehill = spawn_child_actor(ACTOR_12C_MOLEHILL, &this);
this->unk100 = molehill->marker;
if (marker);
}
void func_80389984(Actor * this){
u8 tmp;
void __chBottles_free(Actor *this) {
u8 tmp = this->unk44_31;
tmp = this->unk44_31;
if(tmp)
if (tmp) {
func_8030DA44(tmp);
}
}
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 chBottles_update(Actor *this) {
s32 face_buttons[6];
f32 plyr_pos[3];
void *sp40;
int sp34;
int user_input;
int button_pressed;
// 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)
if (this->unkF4_8 >= 9) {
return;
}
if (!this->initialized) {
this->marker->propPtr->unk8_3 = 0;
actor_collisionOff(this);
this->initialized = TRUE;
marker_setFreeMethod(this->marker, func_80389984);
marker_setFreeMethod(this->marker, __chBottles_free);
if (this->unkF4_8 == 1 || this->unkF4_8 == 8) {//L80389A30
sp40 = nodeprop_findByActorIdAndActorPosition(0x349, this);
sp40 = nodeprop_findByActorIdAndActorPosition(ACTOR_349_UNKNOWN, this);
if (!sp40) {
this->unk1C_x = this->position_x;
this->unk1C_y = this->position_y;
this->unk1C_z = this->position_z;
this->actor_specific_1_f = 300.0f;
} else{ //L80389A68
}
else { //L80389A68
nodeprop_getPosition(sp40, this->unk1C);
this->actor_specific_1_f = nodeprop_getRadius(sp40);
}//L80389A8C
if (this->unkF4_8 == 1) {
if (volatileFlag_get(VOLATILE_FLAG_1) || volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE)) {
func_80388FA0(this, 3);
__chBottles_setState(this, BOTTLES_STATE_3_UNKNOWN);
}
}
}//L80389AC8
if(chsmmole_learnedAnySpiralMountainAbilities()){
mapSpecificFlags_set(SM_SPECIFIC_FLAG_1, TRUE);
if (__chBottles_isAnySpiralMountainAbilityLearned()) {
mapSpecificFlags_set(SM_SPECIFIC_FLAG_1_TALKED_TO_BOTTLES, TRUE);
if (chmole_learnedAllSpiralMountainAbilities()) {
mapSpecificFlags_set(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED, TRUE);
@@ -438,7 +474,7 @@ void chsmmole_Update(Actor * this){
}//L80389B20
if (!this->volatile_initialized) {
__spawnQueue_add_1((GenFunction_1)chsmmole_spawnMolehill, reinterpret_cast(s32, this->marker));
__spawnQueue_add_1((GenFunction_1) __chBottles_spawnMolehill, reinterpret_cast(s32, this->marker));
this->volatile_initialized = TRUE;
}//L80389B4C
@@ -446,148 +482,155 @@ void chsmmole_Update(Actor * this){
func_8028E668(this->position, 180.0f, -40.0f, 120.0f);
}//L80389B64
controller_copyFaceButtons(0,sp50); //get face buttons press counters
player_getPosition(sp44);
switch (this->state)
{
case 1://L80389BAC
controller_copyFaceButtons(0, face_buttons); //get face buttons press counters
player_getPosition(plyr_pos);
switch (this->state) {
case BOTTLES_STATE_1_UNKNOWN://L80389BAC
this->yaw_ideal = (f32) func_80329784(this);
func_80328FB0(this, 4.0f);
if( (this->unkF4_8 == 1 && !mapSpecificFlags_get(SM_SPECIFIC_FLAG_1))
|| (this->unkF4_8 == 8 && !mapSpecificFlags_get(SM_SPECIFIC_FLAG_2))
|| (this->unkF4_8 == 8 && mapSpecificFlags_get(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED) && !mapSpecificFlags_get(SM_SPECIFIC_FLAG_F))
){//L80389C50
if( ((ml_distance_vec3f(sp44, this->unk1C) < this->actor_specific_1_f) && func_8028F20C())
|| mapSpecificFlags_get(SM_SPECIFIC_FLAG_10)
if ((this->unkF4_8 == 1 && !mapSpecificFlags_get(SM_SPECIFIC_FLAG_1_TALKED_TO_BOTTLES)) ||
(this->unkF4_8 == 8 && !mapSpecificFlags_get(SM_SPECIFIC_FLAG_2)) ||
(this->unkF4_8 == 8 && mapSpecificFlags_get(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED) && !mapSpecificFlags_get(SM_SPECIFIC_FLAG_F))
) {//L80389C50
if (((ml_distance_vec3f(plyr_pos, this->unk1C) < this->actor_specific_1_f) && func_8028F20C()) ||
mapSpecificFlags_get(SM_SPECIFIC_FLAG_10)
) {//L80389C8C
if(func_80329530(this, 0x96))
if (func_80329530(this, 0x96)) {
func_8028F45C(9, this->position);
}
//L80389CA4
func_80388FA0(this, 2);
__chBottles_setState(this, BOTTLES_STATE_2_UNKNOWN);
}
}
else {//L80389CBC
if( !func_80329530(this, 0xfa)
|| func_8028ECAC()
|| !func_8028F20C()
|| func_8028EC04()
) break;
if (!func_80329530(this, 0xfa) || func_8028ECAC() || !func_8028F20C() || func_8028EC04()) {
break;
}
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
){
sp34 = (chBottlesDialogTable[this->unkF4_8 - 1].ability + 1) && ability_isUnlocked(chBottlesDialogTable[this->unkF4_8 - 1].ability);
if (!sp34 && this->unkF4_8 != 1 || fileProgressFlag_get(FILEPROG_DB_SKIPPED_TUTORIAL) == 0 || gDialogIndex < 6) {
if (this->unkF4_8 != 8 || !fileProgressFlag_get(FILEPROG_FC_DEFEAT_GRUNTY)) {
if( func_8028EFC8()
&& sp50[FACE_BUTTON(BUTTON_B)] == 1
){
if (func_8028EFC8() && face_buttons[FACE_BUTTON(BUTTON_B)] == 1) {
if (sp34 || this->unkF4_8 == 1 || this->unkF4_8 == 8) {
func_80388FA0(this, 5);
__chBottles_setState(this, BOTTLES_STATE_5_UNKNOWN);
}
else {
if (func_80329530(this, 0x96) && !sp34) {
func_8028F45C(9, this->position);
}
func_80388FA0(this, 2);
__chBottles_setState(this, BOTTLES_STATE_2_UNKNOWN);
}
}
}
}
}
break;
case 2://L80389E2C
case BOTTLES_STATE_2_UNKNOWN://L80389E2C
this->yaw_ideal = func_80329784(this);
func_80328FB0(this, 4.0f);
if( (f64) 0.0 < animctrl_getAnimTimer(this->animctrl)
&& animctrl_getAnimTimer(this->animctrl) < 0.16
){
if (0.0 < animctrl_getAnimTimer(this->animctrl) && animctrl_getAnimTimer(this->animctrl) < 0.16) {
func_8030E2C4(this->unk44_31);
}//L80389EA0
if (actor_animationIsAt(this, 0.9999f)) {
if(!mapSpecificFlags_get(SM_SPECIFIC_FLAG_1)){
chsmmole_80389610(this);
if (!mapSpecificFlags_get(SM_SPECIFIC_FLAG_1_TALKED_TO_BOTTLES)) {
__chBottles_talk(this);
}
func_80388FA0(this, 3);
__chBottles_setState(this, BOTTLES_STATE_3_UNKNOWN);
}//L80389EE0
else if (actor_animationIsAt(this, 0.14f)) {
FUNC_8030E8B4(SFX_C6_SHAKING_MOUTH, 1.2f, 24000, this->position, 1250, 2500);
}else if(actor_animationIsAt(this, 0.4f)){ //L80389F14
}
else if (actor_animationIsAt(this, 0.4f)) { //L80389F14
FUNC_8030E8B4(SFX_2C_PULLING_NOISE, 1.2f, 24000, this->position, 1250, 2500);
}else if(actor_animationIsAt(this, 0.75f)){//L80389F48
}
else if (actor_animationIsAt(this, 0.75f)) {//L80389F48
FUNC_8030E8B4(SFX_C5_TWINKLY_POP, 1.0f, 32000, this->position, 1250, 2500);
}else if(actor_animationIsAt(this, 0.35f)){//L80389F78
if(mapSpecificFlags_get(SM_SPECIFIC_FLAG_1)){
chsmmole_80389610(this);
}
else if (actor_animationIsAt(this, 0.35f)) {//L80389F78
if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_1_TALKED_TO_BOTTLES)) {
__chBottles_talk(this);
}
}
break;
case 3://L80389FAC
case BOTTLES_STATE_3_UNKNOWN://L80389FAC
this->yaw_ideal = func_80329784(this);
func_80328FB0(this, 4.0f);
if( ( actor_animationIsAt(this, 0.37f)
|| actor_animationIsAt(this, 0.66f)
|| actor_animationIsAt(this, 0.85f)
)
&& randf() < 0.2
if ((actor_animationIsAt(this, 0.37f) ||
actor_animationIsAt(this, 0.66f) ||
actor_animationIsAt(this, 0.85f)) && randf() < 0.2
) {
animctrl_setDirection(this->animctrl, animctrl_isPlayedForwards(this->animctrl) ^ 1);
}//L8038A088
else if( actor_animationIsAt(this, 0.25f)
|| actor_animationIsAt(this, 0.28f)
|| actor_animationIsAt(this, 0.31f)
else if (actor_animationIsAt(this, 0.25f) ||
actor_animationIsAt(this, 0.28f) ||
actor_animationIsAt(this, 0.31f)
) {
func_8030E878(SFX_6F_BANJO_HEADSCRATCH, randf2(1.4f, 1.55f), 16000, this->position, 1250.0f, 2500.0f);
} //L8038A0D8
else if( actor_animationIsAt(this, 0.45f)
|| actor_animationIsAt(this, 0.48f)
|| actor_animationIsAt(this, 0.51f)
|| actor_animationIsAt(this, 0.7f)
|| actor_animationIsAt(this, 0.73f)
|| actor_animationIsAt(this, 0.76f)
else if (actor_animationIsAt(this, 0.45f) ||
actor_animationIsAt(this, 0.48f) ||
actor_animationIsAt(this, 0.51f) ||
actor_animationIsAt(this, 0.7f) ||
actor_animationIsAt(this, 0.73f) ||
actor_animationIsAt(this, 0.76f)
) {
func_8030E878(SFX_6F_BANJO_HEADSCRATCH, randf2(1.35f, 1.5f), 6000, this->position, 1250.0f, 2500.0f);
}//L8038A194
if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_5)) {
mapSpecificFlags_set(SM_SPECIFIC_FLAG_5, FALSE);
func_80388FA0(this, 4);
__chBottles_setState(this, BOTTLES_STATE_4_UNKNOWN);
}//L8038A1B8
user_input = -1;
button_pressed = -1;
if (this->unk38_0) {
this->lifetime_value += time_getDelta();
if (func_803114C4() != 0xe1d) {
if(sp50[FACE_BUTTON(BUTTON_A)] == 1)
user_input = 1; //A button pressed
else if(sp50[FACE_BUTTON(BUTTON_B)] == 1)
user_input = 0; //B button pressed
if (face_buttons[FACE_BUTTON(BUTTON_A)] == TRUE) {
button_pressed = 1;
}
else if (face_buttons[FACE_BUTTON(BUTTON_B)] == TRUE) {
button_pressed = 0;
}
}//L8038A218
if( user_input != -1){ //button was pressed
fileProgressFlag_set(FILEPROG_DB_SKIPPED_TUTORIAL, (user_input)?0:1);
gcdialog_showText((user_input)? 0xe07 : 0xe09, 0xe, this->position, this->marker, func_803892C8, __chsmmole_additionalAbilityLearnActions);
if(!user_input){
chsmmole_skipIntroTutorial(); //give all SM moves
if (button_pressed != -1) {
fileProgressFlag_set(FILEPROG_DB_SKIPPED_TUTORIAL, button_pressed ? 0 : 1);
gcdialog_showText(button_pressed ? ASSET_E07_TEXT_BOTTLES_UNKNOWN : ASSET_E09_TEXT_BOTTLES_SKIPPED_TUTORIAL, 0xe, this->position, this->marker, __chBottles_textCallback,__chBottles_textActions);
if (!button_pressed) {
__chBottles_skipIntroTutorial();
}
this->unk38_0 = 0;
}else if(!this->has_met_before && 5.0 < this->lifetime_value){
gcdialog_showText(0xe1d, 0x86, this->position, this->marker, func_803892C8, NULL);
this->unk38_0 = FALSE;
}
else if (!this->has_met_before && 5.0 < this->lifetime_value) {
gcdialog_showText(ASSET_E1D_TEXT_BOTTLES_TUTORIAL_OFFER_WAIT, 0x86, this->position, this->marker, __chBottles_textCallback, NULL);
this->has_met_before = TRUE;
}
}
break;
case 4://L8038A31C
if( 0.35 < animctrl_getAnimTimer(this->animctrl)
&& animctrl_getAnimTimer(this->animctrl) < 0.9
){
case BOTTLES_STATE_4_UNKNOWN: //L8038A31C
if (0.35 < animctrl_getAnimTimer(this->animctrl) && animctrl_getAnimTimer(this->animctrl) < 0.9) {
func_8030E2C4(this->unk44_31);
}else{//L8038A378
if(actor_animationIsAt(this, 0.9999f)){
func_80388FA0(this, 1);
func_80386540();
}
else if (actor_animationIsAt(this, 0.9999f)) { //L8038A378
__chBottles_setState(this, BOTTLES_STATE_1_UNKNOWN);
func_80386540();
}
break;
}//L8038A3A0

View File

@@ -18,7 +18,7 @@ extern ActorInfo D_8038AD58; //ch cauliflower A
extern ActorInfo D_8038AC9C; //chCarrot FreeRange?
extern ActorInfo D_8038AD0C; //ch onion B
extern ActorInfo D_8038AD7C; //ch cauliflower B
extern ActorInfo chSmMole; //chSmMole bottles
extern ActorInfo chBottles; //chSmMole bottles
extern ActorInfo D_8038B0B0; //chJumpTutorial code_4070
extern ActorInfo D_8038B0E0;
extern ActorInfo D_8038B008; //chBanjosBed
@@ -149,7 +149,7 @@ void SM_func_80386810(void)
spawnableActorList_add(&D_8038AC9C, actor_new, ACTOR_FLAG_UNKNOWN_0 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_25);
spawnableActorList_add(&D_8038AD0C, actor_new, ACTOR_FLAG_UNKNOWN_0 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_25);
spawnableActorList_add(&D_8038AD7C, actor_new, ACTOR_FLAG_UNKNOWN_0 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_21 | ACTOR_FLAG_UNKNOWN_25);
spawnableActorList_add(&chSmMole, actor_new, ACTOR_FLAG_UNKNOWN_8);
spawnableActorList_add(&chBottles, actor_new, ACTOR_FLAG_UNKNOWN_8);
spawnableActorList_add(&D_8038B0B0, actor_new, ACTOR_FLAG_NONE);
spawnableActorList_add(&D_8038B0E0, actor_new, ACTOR_FLAG_NONE);
spawnableActorList_add(&D_8038B008, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_9 | ACTOR_FLAG_UNKNOWN_10);

View File

@@ -7,7 +7,7 @@ Actor *func_802D94B4(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
void chmole_additionalAbilityLearnActions(ActorMarker *marker, enum asset_e arg1, s32 arg2);
typedef struct{
s16 learn_text;
s16 teach_text_id;
s16 refresher_text;
s8 camera_node;
s8 ability;
@@ -154,12 +154,12 @@ void chmole_healthRefill(ActorMarker *marker, enum asset_e arg1, s32 arg2){
// Also releases the camera
Actor *actor = marker_getActor(marker);
if( arg1 == moleTable[actor->unkF4_8-9].learn_text
if( arg1 == moleTable[actor->unkF4_8-9].teach_text_id
&& item_getCount(ITEM_14_HEALTH) < item_getCount(ITEM_15_HEALTH_TOTAL)
){
gcdialog_showText(ASSET_D39_TEXT_BOTTLES_REFILL_HEALTH, 7, 0, actor->marker, chmole_healthRefill, chmole_additionalAbilityLearnActions);
}//L802D9738
else if(arg1 == moleTable[actor->unkF4_8-9].learn_text || arg1 == ASSET_D39_TEXT_BOTTLES_REFILL_HEALTH){
else if(arg1 == moleTable[actor->unkF4_8-9].teach_text_id || arg1 == ASSET_D39_TEXT_BOTTLES_REFILL_HEALTH){
gcdialog_showText(chmole_learnedAllGameAbilities()? 0xa87 : chmole_learnedAllLevelAbilitiesDialog(), 7, 0, actor->marker, chmole_healthRefill, NULL);
}
else{//L802D97BC
@@ -230,7 +230,7 @@ int chmole_learnAbility(Actor *this){
else{
func_80347A14(0);
this->has_met_before = TRUE;
sp2C = moleTable[this->unkF4_8-9].learn_text;
sp2C = moleTable[this->unkF4_8-9].teach_text_id;
ability_unlock(moleTable[this->unkF4_8-9].ability);
switch(moleTable[this->unkF4_8-9].ability){
case ABILITY_9_FLIGHT: