Merge branch 'master' into 'document/code_91E10'

This commit is contained in:
Banjo Kazooie
2024-10-14 21:30:27 +00:00
33 changed files with 1651 additions and 1246 deletions

View File

@@ -658,7 +658,7 @@ void chvilegame_update(Actor *this) {
}
if (this->state == 5) {
if (local->unkC == 7) {
func_8024E55C(0, sp30);
controller_copyFaceButtons(0, sp30);
if ((sp30[FACE_BUTTON(BUTTON_B)] > 0) && func_8038C2A8(local->vile_marker)) {
func_8038A068(this, 0xA);
}

View File

@@ -403,7 +403,7 @@ void func_803896FC(Actor *this){
sp58 = func_8038BE20(this->position);
sp54 = time_getDelta();
func_8024E55C(0, sp3C);
controller_copyFaceButtons(0, sp3C);
if(!this->volatile_initialized){
this->volatile_initialized = TRUE;

View File

@@ -2,219 +2,249 @@
#include "functions.h"
#include "variables.h"
/* chAttackTutorial - controls bottle teaching moves in spiral*/
//external
/* extern functions */
void timed_exitStaticCamera(f32);
void func_8028F918(s32);
//public
void func_80387764(ActorMarker *);
void chAttackTutorial_setState(Actor * this, s32 arg1);
/* public functions */
void chAttackTutorial_talk(ActorMarker *);
void chAttackTutorial_setState(Actor *this, s32 state);
void chAttackTutorial_update(Actor *);
/* .data */
ActorInfo D_8038AC20 = { MARKER_12B_ATTACK_TUTORIAL, ACTOR_167_ATTACK_TUTORIAL, 0,
enum chAttackTutorial_state_e {
ATTACK_TUTORIAL_STATE_1_UNKNOWN = 1,
ATTACK_TUTORIAL_STATE_2_UNKNOWN,
ATTACK_TUTORIAL_STATE_3_UNKNOWN,
ATTACK_TUTORIAL_STATE_4_UNKNOWN,
ATTACK_TUTORIAL_STATE_5_UNKNOWN
};
ActorInfo D_8038AC20 = {
MARKER_12B_ATTACK_TUTORIAL, ACTOR_167_ATTACK_TUTORIAL, NULL,
1, NULL,
chAttackTutorial_update, actor_update_func_80326224, func_80325340,
0, 0, 0.0f, 0
};
/* .code */
void __chAttackTutorial_spawnEnemy(ActorMarker *marker, s32 enemy_id){
void __chAttackTutorial_enemy(ActorMarker *marker, enum actor_e enemy_id) {
Actor *actor = marker_getActor(marker);
s32 pad;
Actor *other = spawn_child_actor(enemy_id, &actor);
Actor *enemy = spawn_child_actor(enemy_id, &actor);
actor->unk100 = other->marker;
other->unk100 = actor->marker;
if(actor->unk10_12 == 3 && actor->unk38_31 == 1){
other->unk38_31 = 1;
}else{//L803871D4
other->unk38_31 = 0;
actor->unk100 = enemy->marker;
enemy->unk100 = actor->marker;
if (actor->unk10_12 == VEGETABLE_3_COLLY_WOBBLE && actor->unk38_31 == 1) {
enemy->unk38_31 = 1;
}
other->unk10_12 = 1;
if(marker);
else {//L803871D4
enemy->unk38_31 = 0;
}
enemy->unk10_12 = VEGETABLE_1_TOPPER;
if (marker);
}
s32 SM_func_803871FC(Actor *this, s32 arg1){
volatile s32 sp1C;
s32 tmp_v0;
sp1C = (arg1 == 1)? ACTOR_166_TOPPER_A : (tmp_v0 = (arg1 == 2)? ACTOR_165_BAWL_A : ACTOR_164_COLLYWOBBLE_A);
__spawnQueue_add_2(__chAttackTutorial_spawnEnemy, this->marker, sp1C);
s32 __chAttackTutorial_spawnEnemy(Actor *this, enum vegetable_e vegetable_id) {
volatile enum actor_e enemy_id;
enemy_id = vegetable_id == VEGETABLE_1_TOPPER ? ACTOR_166_TOPPER_A :
vegetable_id == VEGETABLE_2_BAWL ? ACTOR_165_BAWL_A : ACTOR_164_COLLYWOBBLE_A;
__spawnQueue_add_2(__chAttackTutorial_enemy, this->marker, enemy_id);
}
void func_80387258(ActorMarker *marker, enum asset_e text_id, s32 arg2){
chAttackTutorial_setState(marker_getActor(marker), 2);
void __chAttackTutorial_learnedTextActions(ActorMarker *marker, enum asset_e text_id, s32 arg2) {
chAttackTutorial_setState(marker_getActor(marker), ATTACK_TUTORIAL_STATE_2_UNKNOWN);
}
void func_80387288(ActorMarker *marker, enum asset_e text_id, s32 arg2){
void __chAttackTutorial_learnedTextCallback(ActorMarker *marker, enum asset_e text_id, s32 arg2) {
Actor *actor = marker_getActor(marker);
func_8028F918(0);
switch(text_id){
case 0xe15://L803872C8
switch (text_id) {
case ASSET_E15_TEXT_UNKNOWN://L803872C8
ability_unlock(ABILITY_C_ROLL);
chAttackTutorial_setState(actor, 2);
chAttackTutorial_setState(actor, ATTACK_TUTORIAL_STATE_2_UNKNOWN);
break;
case 0xe17://L803872E4
case ASSET_E17_TEXT_UNKNOWN://L803872E4
ability_unlock(ABILITY_B_RATATAT_RAP);
chAttackTutorial_setState(actor, 2);
chAttackTutorial_setState(actor, ATTACK_TUTORIAL_STATE_2_UNKNOWN);
break;
}//L803872FC
timed_exitStaticCamera(0.0f);
}
void chAttackTutorial_setState(Actor * this, s32 arg1){
switch (arg1)
{
case 5:
if(this->unk10_12 == 0){
ability_unlock(ABILITY_4_CLAW_SWIPE);
gcdialog_showText(ASSET_DFF_TEXT_BOTTLES_CLAW_SWIPE_LEARN, 0xE, this->unk1C, this->marker, func_80387288, func_80387258);
}
else{
gcdialog_showText((this->unk10_12 == 1) ? ASSET_E15_TEXT_UNKNOWN : ASSET_E17_TEXT_UNKNOWN, 0xE, this->unk1C, this->marker, func_80387288, NULL);
}
break;
case 2://L803873E0
this->unk38_31 = 0;
SM_func_803871FC(this, ++this->unk10_12);
break;
case 3://L8038742C
mapSpecificFlags_set(5,1);
mapSpecificFlags_set(0xC, 1);
marker_despawn(this->marker);
break;
case 4://L80387454
mapSpecificFlags_set(0xC, 1);
if(!honeycombscore_get(HONEYCOMB_17_SM_COLIWOBBLE)){
this->unk10_12 = 3;
this->unk38_31 = 1;
SM_func_803871FC(this, this->unk10_12);
}
break;
void chAttackTutorial_setState(Actor *this, s32 state) {
switch (state) {
case ATTACK_TUTORIAL_STATE_5_UNKNOWN:
if (this->unk10_12 == NULL) {
ability_unlock(ABILITY_4_CLAW_SWIPE);
gcdialog_showText(ASSET_DFF_TEXT_BOTTLES_CLAW_SWIPE_LEARN, 0xE, this->unk1C, this->marker, __chAttackTutorial_learnedTextCallback, __chAttackTutorial_learnedTextActions);
}
else {
gcdialog_showText(this->unk10_12 == VEGETABLE_1_TOPPER ? ASSET_E15_TEXT_UNKNOWN : ASSET_E17_TEXT_UNKNOWN, 0xE, this->unk1C, this->marker, __chAttackTutorial_learnedTextCallback, NULL);
}
break;
case ATTACK_TUTORIAL_STATE_2_UNKNOWN://L803873E0
this->unk38_31 = 0;
__chAttackTutorial_spawnEnemy(this, ++this->unk10_12);
break;
case ATTACK_TUTORIAL_STATE_3_UNKNOWN://L8038742C
mapSpecificFlags_set(SM_SPECIFIC_FLAG_5, TRUE);
mapSpecificFlags_set(SM_SPECIFIC_FLAG_C, TRUE);
marker_despawn(this->marker);
break;
case ATTACK_TUTORIAL_STATE_4_UNKNOWN://L80387454
mapSpecificFlags_set(SM_SPECIFIC_FLAG_C, TRUE);
if (!honeycombscore_get(HONEYCOMB_17_SM_COLIWOBBLE)) {
this->unk10_12 = VEGETABLE_3_COLLY_WOBBLE;
this->unk38_31 = 1;
__chAttackTutorial_spawnEnemy(this, this->unk10_12);
}
break;
}//L803874A8
subaddie_set_state(this, arg1);
subaddie_set_state(this, state);
}
int func_803874C4(void){
return ability_isUnlocked(ABILITY_4_CLAW_SWIPE)
&& ability_isUnlocked(ABILITY_C_ROLL)
&& ability_isUnlocked(ABILITY_B_RATATAT_RAP);
int __chAttackTutorial_isEveryAbilitiesUnlocked(void) {
return ability_isUnlocked(ABILITY_4_CLAW_SWIPE) &&
ability_isUnlocked(ABILITY_C_ROLL) &&
ability_isUnlocked(ABILITY_B_RATATAT_RAP);
}
void chAttackTutorial_update(Actor *this){
f32 sp2C;
Actor *bottles;
if(!this->initialized){
//find closest tutorial bottles
bottles = actorArray_findClosestActorFromActorId(this->position, ACTOR_12B_TUTORIAL_BOTTLES, -1, &sp2C);
if(bottles != NULL){
this->unk1C_x = bottles->position_x;
this->unk1C_y = bottles->position_y;
this->unk1C_z = bottles->position_z;
}else{
{this->unk1C_x = this->position_x;
this->unk1C_y = this->position_y;
this->unk1C_z = this->position_z;}
void chAttackTutorial_update(Actor *this) {
f32 distance_to_bottles;
Actor *bottles_ptr;
if (!this->initialized) {
bottles_ptr = actorArray_findClosestActorFromActorId(this->position, ACTOR_12B_TUTORIAL_BOTTLES, -1, &distance_to_bottles);
if (bottles_ptr != NULL) {
this->unk1C_x = bottles_ptr->position_x;
this->unk1C_y = bottles_ptr->position_y;
this->unk1C_z = bottles_ptr->position_z;
}
this->unk10_12 = (ability_isUnlocked(ABILITY_C_ROLL))? 2 : (ability_isUnlocked(ABILITY_4_CLAW_SWIPE)? 1:0);
else {
this->unk1C_x = this->position_x;
this->unk1C_y = this->position_y;
this->unk1C_z = this->position_z;
}
this->unk10_12 = ability_isUnlocked(ABILITY_C_ROLL) ? VEGETABLE_2_BAWL :
ability_isUnlocked(ABILITY_4_CLAW_SWIPE) ? VEGETABLE_1_TOPPER : NULL;
this->initialized = TRUE;
}
switch(this->state){
case 1://L80387610
if(mapSpecificFlags_get(4))
chAttackTutorial_setState(this, 5);
if(func_803874C4() || volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE))
chAttackTutorial_setState(this, 4);
break;
case 2://L80387658
if(mapSpecificFlags_get(7)){
func_80387764(this->marker);
mapSpecificFlags_set(7,0);
switch (this->state) {
case ATTACK_TUTORIAL_STATE_1_UNKNOWN://L80387610
if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_4)) {
chAttackTutorial_setState(this, ATTACK_TUTORIAL_STATE_5_UNKNOWN);
}
if (__chAttackTutorial_isEveryAbilitiesUnlocked() || volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE)) {
chAttackTutorial_setState(this, ATTACK_TUTORIAL_STATE_4_UNKNOWN);
}
break;
case 5://L80387680
case ATTACK_TUTORIAL_STATE_2_UNKNOWN://L80387658
if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_7)) {
chAttackTutorial_talk(this->marker);
mapSpecificFlags_set(SM_SPECIFIC_FLAG_7, FALSE);
}
break;
case ATTACK_TUTORIAL_STATE_5_UNKNOWN://L80387680
break;
}////L80387680
}
void func_80387690(ActorMarker *marker, enum asset_e text_id, s32 arg2){
void __chAttackTutorial_attackTextCallback(ActorMarker *marker, enum asset_e text_id, s32 arg2) {
Actor *actor = marker_getActor(marker);
switch(text_id){
case 0xDFF:
switch (text_id) {
case ASSET_DFF_TEXT_BOTTLES_CLAW_SWIPE_LEARN:
func_8028F918(0);
break;
case 0xE14:
case 0xE16:
case 0xE18:
SM_func_803871FC(actor, actor->unk10_12);
case ASSET_E14_TEXT_UNKNOWN:
case ASSET_E16_TEXT_UNKNOWN:
case ASSET_E18_TEXT_UNKNOWN:
__chAttackTutorial_spawnEnemy(actor, actor->unk10_12);
break;
case 0xE15:
case ASSET_E15_TEXT_UNKNOWN:
ability_unlock(ABILITY_C_ROLL);
chAttackTutorial_setState(actor, 2);
chAttackTutorial_setState(actor, ATTACK_TUTORIAL_STATE_2_UNKNOWN);
break;
case 0xE17:
case ASSET_E17_TEXT_UNKNOWN:
ability_unlock(ABILITY_B_RATATAT_RAP);
chAttackTutorial_setState(actor, 2);
chAttackTutorial_setState(actor, ATTACK_TUTORIAL_STATE_2_UNKNOWN);
break;
case 0xE12:
case 0xE19:
chAttackTutorial_setState(actor, 3);
case ASSET_E12_TEXT_BOTTLES_LEARNED_TUTORIAL_MOVES:
case ASSET_E19_TEXT_UNKNOWN:
chAttackTutorial_setState(actor, ATTACK_TUTORIAL_STATE_3_UNKNOWN);
break;
}
timed_exitStaticCamera(0.0f);
}//*/
void func_80387764(ActorMarker * marker){
s32 sp34;
int temp_a2;
s32 sp2C = 4;
timed_exitStaticCamera(0.0f);
}
void chAttackTutorial_talk(ActorMarker *marker) {
s32 text_id;
int try_count;
s32 text_flags = 4;
Actor *actor = marker_getActor(marker);
temp_a2 = actor->unk38_31 ? 1 : 0 ;
if( temp_a2 ){
sp2C = 0xE;
try_count = BOOL(actor->unk38_31);
if (try_count) {
text_flags = 0xE;
}
switch (actor->unk10_12) {
case 0x1: //L803877D8
sp34 = temp_a2 ? ASSET_E15_TEXT_UNKNOWN : ASSET_E14_TEXT_UNKNOWN; //dialog enums
case VEGETABLE_1_TOPPER: //L803877D8
text_id = try_count ? ASSET_E15_TEXT_UNKNOWN : ASSET_E14_TEXT_UNKNOWN;
break;
case 0x2: //L803877F4
sp34 = temp_a2 ? ASSET_E17_TEXT_UNKNOWN : ASSET_E16_TEXT_UNKNOWN; //dialog enums
case VEGETABLE_2_BAWL: //L803877F4
text_id = try_count ? ASSET_E17_TEXT_UNKNOWN : ASSET_E16_TEXT_UNKNOWN;
break;
case 3: //L80387810
sp34 = temp_a2 ? ASSET_E19_TEXT_UNKNOWN : ASSET_E18_TEXT_UNKNOWN; //dialog enums
case VEGETABLE_3_COLLY_WOBBLE: //L80387810
text_id = try_count ? ASSET_E19_TEXT_UNKNOWN : ASSET_E18_TEXT_UNKNOWN;
break;
default:
//sp34 = actor->unk38_31;
break;
}//L8038782C
if (sp34 == ASSET_E19_TEXT_UNKNOWN) {
if (text_id == ASSET_E19_TEXT_UNKNOWN) {
func_8028F94C(2, actor->unk1C);
}
//L80387848
if (!mapSpecificFlags_get(3) && chmole_learnedAllSpiralMountainAbilities() && temp_a2) {
mapSpecificFlags_set(3, 1);
sp34 = ASSET_E12_TEXT_BOTTLES_LEARNED_TUTORIAL_MOVES;
}//L80387848
if (!mapSpecificFlags_get(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED) && chmole_learnedAllSpiralMountainAbilities() && try_count) {
mapSpecificFlags_set(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED, TRUE);
text_id = ASSET_E12_TEXT_BOTTLES_LEARNED_TUTORIAL_MOVES;
}//L80387898
if (temp_a2) {
if (try_count) {
timed_setStaticCameraToNode(0.0f, 6);
}//L803878B0
gcdialog_showText(sp34, sp2C, actor->unk1C, actor->marker, func_80387690, NULL);
gcdialog_showText(text_id, text_flags, actor->unk1C, actor->marker, __chAttackTutorial_attackTextCallback, NULL);
actor->unk38_31++;
}

163
src/SM/ch/jumptutorial.c Normal file
View File

@@ -0,0 +1,163 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
/* extern functions */
Actor *func_802D94B4(ActorMarker *, Gfx **, Mtx **, Vtx **);
void timed_exitStaticCamera(f32);
/* public functions */
void chJumpTutorial_update(Actor *this);
void chJumpTutorial_setState(Actor *this, s32 state);
/* .data */
enum chJumpTutorial_state_e {
JUMP_TUTORIAL_STATE_1_IDLE = 1,
JUMP_TUTORIAL_STATE_2_TEACHING,
JUMP_TUTORIAL_STATE_3_DISAPPEARED
};
ActorInfo D_8038B0B0 = {
MARKER_1ED_JUMP_TUTORIAL, ACTOR_3B9_JUMP_TUTORIAL, NULL,
1, NULL,
chJumpTutorial_update, actor_update_func_80326224, func_80325340,
0, 0, 0.0f, 0
};
/* .code */
void __chJumpTutorial_setStaticCameraToNode4(Actor *this) {
timed_setStaticCameraToNode(0.0f, 4);
}
void __chJumpTutorial_textCallback(ActorMarker *caller, enum asset_e text_id, s32 arg2) {
Actor *actor = marker_getActor(caller);
if (text_id == ASSET_DF9_TEXT_BOTTLES_UNKNOWN || text_id == ASSET_E12_TEXT_BOTTLES_LEARNED_TUTORIAL_MOVES) {
chJumpTutorial_setState(actor, JUMP_TUTORIAL_STATE_3_DISAPPEARED);
}
timed_exitStaticCamera(0.0f);
}
void chJumpTutorial_setState(Actor *this, s32 state) {
switch (state) {
case JUMP_TUTORIAL_STATE_2_TEACHING://L8038A50C
this->sm_4070.dialog_id = NULL;
player_getPosition(this->velocity);
func_8028F918(0);
if (ability_isUnlocked(ABILITY_7_FEATHERY_FLAP)) {
mapSpecificFlags_set(SM_SPECIFIC_FLAG_9_ABILITY_FEATHERY_UNLOCKED, TRUE);
}
else if (ability_isUnlocked(ABILITY_A_HOLD_A_JUMP_HIGHER)) {//L8038A540
mapSpecificFlags_set(SM_SPECIFIC_FLAG_8_ABILITY_HOLD_A_JUMP_HIGHER_UNLOCKED, TRUE);
}
else {//L8038A560
__chJumpTutorial_setStaticCameraToNode4(this);
ability_unlock(ABILITY_A_HOLD_A_JUMP_HIGHER);
gcdialog_showText(ASSET_DF6_TEXT_BOTTLES_HIGH_JUMP_LEARN, 0xe, this->unk1C, this->marker, __chJumpTutorial_textCallback, NULL);
this->sm_4070.dialog_id = ASSET_E1A_TEXT_BOTTLES_UNKNOWN;
mapSpecificFlags_set(SM_SPECIFIC_FLAG_8_ABILITY_HOLD_A_JUMP_HIGHER_UNLOCKED, FALSE);
}
break;
case JUMP_TUTORIAL_STATE_3_DISAPPEARED://L8038A5B0
mapSpecificFlags_set(SM_SPECIFIC_FLAG_5, TRUE);
break;
}//L8038A5BC
subaddie_set_state(this, state);
}
void chJumpTutorial_update(Actor *this) {
f32 plyr_pos[3];
s32 face_buttons[6];
f32 distance_to_bottles;
Actor *bottles_ptr;
s32 dialog_id;
if (!this->initialized) {
bottles_ptr = actorArray_findClosestActorFromActorId(this->position, ACTOR_12B_TUTORIAL_BOTTLES, -1, &distance_to_bottles);
if (bottles_ptr) {
this->unk1C_x = bottles_ptr->position_x;
this->unk1C_y = bottles_ptr->position_y;
this->unk1C_z = bottles_ptr->position_z;
}
else {//L8038A630
this->unk1C_x = this->position_x;
this->unk1C_y = this->position_y;
this->unk1C_z = this->position_z;
}//L8038A644
this->initialized = TRUE;
}//L8038A650
controller_copyFaceButtons(0, face_buttons);
switch (this->state) {
case JUMP_TUTORIAL_STATE_1_IDLE://L8038A688
if (fileProgressFlag_get(FILEPROG_DB_SKIPPED_TUTORIAL)) {
marker_despawn(this->marker);
}
else if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_E)) {
chJumpTutorial_setState(this, JUMP_TUTORIAL_STATE_2_TEACHING);
}
break;
case JUMP_TUTORIAL_STATE_2_TEACHING://L8038A6C8
if (!func_803114B0()) {
if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_8_ABILITY_HOLD_A_JUMP_HIGHER_UNLOCKED)) {
__chJumpTutorial_setStaticCameraToNode4(this);
ability_unlock(ABILITY_7_FEATHERY_FLAP);
gcdialog_showText(ASSET_DF7_TEXT_BOTTLES_FEATHERY_FLAP_LEARN, 0xa, this->unk1C, this->marker, __chJumpTutorial_textCallback, NULL);
this->sm_4070.dialog_id = ASSET_E1B_TEXT_BOTTLES_UNKNOWN;
mapSpecificFlags_set(SM_SPECIFIC_FLAG_8_ABILITY_HOLD_A_JUMP_HIGHER_UNLOCKED, FALSE);
}//L8038A730
if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_9_ABILITY_FEATHERY_UNLOCKED)) {
__chJumpTutorial_setStaticCameraToNode4(this);
ability_unlock(ABILITY_8_FLAP_FLIP);
gcdialog_showText(ASSET_DF8_TEXT_BOTTLES_FLAP_FLIP_LEARN, 0xa, this->unk1C, this->marker, __chJumpTutorial_textCallback, NULL);
this->sm_4070.dialog_id = ASSET_E1C_TEXT_BOTTLES_UNKNOWN;
mapSpecificFlags_set(SM_SPECIFIC_FLAG_9_ABILITY_FEATHERY_UNLOCKED, FALSE);
}//L8038A794
if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_A)) {
__chJumpTutorial_setStaticCameraToNode4(this);
func_8028F94C(2, this->unk1C);
if (!mapSpecificFlags_get(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED) && chmole_learnedAllSpiralMountainAbilities()) {
mapSpecificFlags_set(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED, TRUE);
dialog_id = ASSET_E12_TEXT_BOTTLES_LEARNED_TUTORIAL_MOVES;
}
else {
dialog_id = ASSET_DF9_TEXT_BOTTLES_UNKNOWN;
}
gcdialog_showText(dialog_id, 0xe, this->unk1C, this->marker, __chJumpTutorial_textCallback, NULL);
mapSpecificFlags_set(SM_SPECIFIC_FLAG_A, FALSE);
this->sm_4070.dialog_id = NULL;
}
}//L8038A828
player_getPosition(plyr_pos);
plyr_pos[0] = this->velocity_x;
plyr_pos[2] = this->velocity_z;
func_8028FAB0(plyr_pos);
if (func_8028EFC8() && face_buttons[FACE_BUTTON(BUTTON_B)] == TRUE && func_8028F20C()) {
if (this->sm_4070.dialog_id) {
gcdialog_showText(dialog_id = this->sm_4070.dialog_id, 0, NULL, NULL, NULL, NULL);
}
}
break;
case JUMP_TUTORIAL_STATE_3_DISAPPEARED://L8038A8A0
marker_despawn(this->marker);
break;
}//L8038A8AC
}

638
src/SM/ch/smbottles.c Normal file
View File

@@ -0,0 +1,638 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
/* extern functions */
Actor *func_802D94B4(ActorMarker *, Gfx **, Mtx **, Vtx **);
void func_8028E668(f32 *, f32, f32, f32);
void func_80328FB0(Actor *, f32);
void func_8030DA44(u8);
void timed_exitStaticCamera(f32);
void subaddie_set_state_with_direction(Actor *, s32, f32, s32);
/* typedefs and declarations */
enum chSmBottles_state_e {
SM_BOTTLES_STATE_1_UNKNOWN = 1,
SM_BOTTLES_STATE_2_UNKNOWN,
SM_BOTTLES_STATE_3_UNKNOWN,
SM_BOTTLES_STATE_4_UNKNOWN,
SM_BOTTLES_STATE_5_UNKNOWN
};
typedef struct {
s16 teach_text_id;
s16 refresher_text_id;
s8 camera_node;
s8 ability;
} ChSmBottlesDialog;
/* public functions */
void chSmBottles_update(Actor *this);
void __chSmBottles_talk(Actor *this);
/* .data */
ActorAnimationInfo chSmBottlesAnimations[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},
{ASSET_139_ANIM_BOTTLES_EXIT, 1.7f},
{ASSET_13A_ANIM_BOTTLES_ENTER, 2000000000.0f}
};
ActorInfo chBottles = {
MARKER_B7_TUTORIAL_BOTTLES, ACTOR_12B_TUTORIAL_BOTTLES, ASSET_387_MODEL_BOTTLES,
1, chSmBottlesAnimations,
chSmBottles_update, actor_update_func_80326224, func_802D94B4,
0, 0, 0.0f, 0
};
ChSmBottlesDialog chSmBottlesDialogTable[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 chSmBottlesDialogIndex = 0;
/* .code */
/**
* @brief Checks if any Spiral Mountain abilities have been learned
*/
bool __chSmBottles_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 __chSmBottles_setHasUsedSpiralMountainAbilities(void) {
ability_unlock(ABILITY_3_CAMERA_CONTROL);
ability_setHasUsed(ABILITY_0_BARGE);
ability_setHasUsed(ABILITY_1_BEAK_BOMB);
ability_setHasUsed(ABILITY_2_BEAK_BUSTER);
ability_setHasUsed(ABILITY_3_CAMERA_CONTROL);
ability_setHasUsed(ABILITY_4_CLAW_SWIPE);
ability_setHasUsed(ABILITY_5_CLIMB);
ability_setHasUsed(ABILITY_B_RATATAT_RAP);
ability_setHasUsed(ABILITY_C_ROLL);
ability_setHasUsed(ABILITY_A_HOLD_A_JUMP_HIGHER);
}
/**
* @brief Unlocks all of the Spiral Mountain moves.
*/
void __chSmBottles_skipIntroTutorial(void) {
ability_unlock(ABILITY_F_DIVE);
ability_unlock(ABILITY_4_CLAW_SWIPE);
ability_unlock(ABILITY_C_ROLL);
ability_unlock(ABILITY_B_RATATAT_RAP);
ability_unlock(ABILITY_0_BARGE);
ability_unlock(ABILITY_A_HOLD_A_JUMP_HIGHER);
ability_unlock(ABILITY_7_FEATHERY_FLAP);
ability_unlock(ABILITY_8_FLAP_FLIP);
ability_unlock(ABILITY_5_CLIMB);
__chSmBottles_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 __chSmBottles_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, chSmBottlesDialogTable[this->unkF4_8 - 1].camera_node);
}
}
void __chSmBottles_setState(Actor *this, s32 next_state) {
Actor *other;
ActorMarker *molehillMarker;
switch (this->state) {
case SM_BOTTLES_STATE_1_UNKNOWN://L80388FE8
this->unk138_23 = 1;
break;
case SM_BOTTLES_STATE_4_UNKNOWN://L80388FF8
this->unk138_23 = 0;
case SM_BOTTLES_STATE_2_UNKNOWN://L80389004
func_8030DA44(this->unk44_31);
this->unk44_31 = 0;
break;
case SM_BOTTLES_STATE_5_UNKNOWN://L80389018
this->unk138_23 = 0;
func_8028F918(0);
break;
}//L8038902C
switch (next_state) {
case SM_BOTTLES_STATE_4_UNKNOWN:
other = subaddie_getLinkedActor(this);
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 SM_BOTTLES_STATE_1_UNKNOWN:
animctrl_setSmoothTransition(this->animctrl, 0);
break;
case SM_BOTTLES_STATE_5_UNKNOWN:
__chSmBottles_setStaticCameraToNode(this);
func_8028F94C(2, this->position);
__chSmBottles_talk(this);
break;
case SM_BOTTLES_STATE_3_UNKNOWN:
actor_loopAnimation(this);
break;
case SM_BOTTLES_STATE_2_UNKNOWN:
other = subaddie_getLinkedActor(this);
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);
__chSmBottles_setStaticCameraToNode(this);
func_8028F94C(2, this->position);
break;
}
subaddie_set_state_with_direction(this, next_state, 0.0001f, 1);
}
/**
* @brief Performs actions depending on what move is being learned
*
*/
static void __chSmBottles_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:
__chSmBottles_setStaticCameraToNode(actor);
break;
}
}
void __chSmBottles_textCallback(ActorMarker *marker, enum asset_e text_id, s32 arg2) {
Actor *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, __chSmBottles_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)) {
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, __chSmBottles_textCallback, __chSmBottles_textActions);
break;
case ASSET_E1F_TEXT_BOTTLES_TUTORIAL_OFFER: /* 2FEC 803893DC 9209003B */
actor->unk38_0 = TRUE;
break;
case ASSET_E1D_TEXT_BOTTLES_TUTORIAL_OFFER_WAIT: /* 2FFC 803893EC 920B0138 */
actor->has_met_before = FALSE;
actor->lifetime_value = 0.0f;
break;
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 ASSET_E09_TEXT_BOTTLES_SKIPPED_TUTORIAL:
case ASSET_E12_TEXT_BOTTLES_LEARNED_TUTORIAL_MOVES:
__chSmBottles_setState(actor, SM_BOTTLES_STATE_4_UNKNOWN);
break;
default:
if (actor->state != SM_BOTTLES_STATE_5_UNKNOWN) {
gcdialog_showText(ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED, 0x4, NULL, NULL, NULL, NULL);
}
__chSmBottles_setState(actor, actor->state == SM_BOTTLES_STATE_5_UNKNOWN ? SM_BOTTLES_STATE_1_UNKNOWN : SM_BOTTLES_STATE_4_UNKNOWN);
break;
}
}
}
void __chSmBottles_getRefresherDialog(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(chSmBottlesDialogTable[this->unkF4_8 - 1].ability)) {
if (fileProgressFlag_get(FILEPROG_DB_SKIPPED_TUTORIAL)) {
*text_id = chSmBottlesDialogIndex + ASSET_E0A_TEXT_BOTTLES_REFUSE_HELP_1;
chSmBottlesDialogIndex++;
chSmBottlesDialogIndex = MIN(chSmBottlesDialogIndex, 5);
if (*text_id != ASSET_E0E_TEXT_BOTTLES_REFUSE_HELP_5) {
*text_flags |= 1;
}
}
else {//L8038956C
*text_flags |= 1;
*text_id = chSmBottlesDialogTable[this->unkF4_8 - 1].refresher_text_id;
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 = chSmBottlesDialogTable[this->unkF4_8 - 1].teach_text_id;
ability_unlock(chSmBottlesDialogTable[this->unkF4_8 - 1].ability);
}
}
void __chSmBottles_talk(Actor *this) {
s32 text_id;
s32 text_flags;
text_flags = 0xe;
text_id = 0;
switch (this->unkF4_8) {
case 1://L8038965C
if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_1_TALKED_TO_BOTTLES)) {
text_flags |= 1;
if (fileProgressFlag_get(FILEPROG_DB_SKIPPED_TUTORIAL)) {
text_id = chSmBottlesDialogIndex + ASSET_E0A_TEXT_BOTTLES_REFUSE_HELP_1;
chSmBottlesDialogIndex++;
chSmBottlesDialogIndex = MIN(chSmBottlesDialogIndex, 5);
}
else {//L803896C0
text_id = chSmBottlesDialogTable[this->unkF4_8 - 1].refresher_text_id;
}
}
else {//L803896E8
text_id = chSmBottlesDialogTable[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)) {
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
__chSmBottles_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)) {
text_id = chSmBottlesDialogTable[this->unkF4_8 - 1].refresher_text_id;
text_flags |= 1;
}
else {
text_id = chSmBottlesDialogTable[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
mapSpecificFlags_set(SM_SPECIFIC_FLAG_4, TRUE);
}
else {//L803898E4
__chSmBottles_getRefresherDialog(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
mapSpecificFlags_set(SM_SPECIFIC_FLAG_E, TRUE);
}
else {//L803898E4
__chSmBottles_getRefresherDialog(this, &text_id, &text_flags);
}
break;
default://L803898F8
__chSmBottles_getRefresherDialog(this, &text_id, &text_flags);
break;
}//L80389904
if (text_id) {
gcdialog_showText(text_id, text_flags, this->position, this->marker, __chSmBottles_textCallback, __chSmBottles_textActions);
}
}
/**
* @brief Spawns a molehill for the actor
*/
void __chSmBottles_spawnMolehill(ActorMarker *marker) {
Actor *this;
Actor *molehill;
s32 pad;
this = marker_getActor(marker);
molehill = spawn_child_actor(ACTOR_12C_MOLEHILL, &this);
this->unk100 = molehill->marker;
if (marker);
}
void __chSmBottles_free(Actor *this) {
u8 tmp = this->unk44_31;
if (tmp) {
func_8030DA44(tmp);
}
}
void chSmBottles_update(Actor *this) {
s32 face_buttons[6];
f32 plyr_pos[3];
void *sp40;
int sp34;
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) {
return;
}
if (!this->initialized) {
this->marker->propPtr->unk8_3 = 0;
actor_collisionOff(this);
this->initialized = TRUE;
marker_setFreeMethod(this->marker, __chSmBottles_free);
if (this->unkF4_8 == 1 || this->unkF4_8 == 8) {//L80389A30
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
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)) {
__chSmBottles_setState(this, SM_BOTTLES_STATE_3_UNKNOWN);
}
}
}//L80389AC8
if (__chSmBottles_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);
mapSpecificFlags_set(SM_SPECIFIC_FLAG_2, TRUE);
mapSpecificFlags_set(SM_SPECIFIC_FLAG_C, TRUE);
mapSpecificFlags_set(SM_SPECIFIC_FLAG_F, TRUE);
}
}
}//L80389B20
if (!this->volatile_initialized) {
__spawnQueue_add_1((GenFunction_1) __chSmBottles_spawnMolehill, reinterpret_cast(s32, this->marker));
this->volatile_initialized = TRUE;
}//L80389B4C
if (this->unk138_23) {
func_8028E668(this->position, 180.0f, -40.0f, 120.0f);
}//L80389B64
controller_copyFaceButtons(0, face_buttons); //get face buttons press counters
player_getPosition(plyr_pos);
switch (this->state) {
case SM_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_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)) {
func_8028F45C(9, this->position);
}
//L80389CA4
__chSmBottles_setState(this, SM_BOTTLES_STATE_2_UNKNOWN);
}
}
else {//L80389CBC
if (!func_80329530(this, 0xfa) || func_8028ECAC() || !func_8028F20C() || func_8028EC04()) {
break;
}
sp34 = (chSmBottlesDialogTable[this->unkF4_8 - 1].ability + 1) && ability_isUnlocked(chSmBottlesDialogTable[this->unkF4_8 - 1].ability);
if (!sp34 && this->unkF4_8 != 1 || fileProgressFlag_get(FILEPROG_DB_SKIPPED_TUTORIAL) == 0 || chSmBottlesDialogIndex < 6) {
if (this->unkF4_8 != 8 || !fileProgressFlag_get(FILEPROG_FC_DEFEAT_GRUNTY)) {
if (func_8028EFC8() && face_buttons[FACE_BUTTON(BUTTON_B)] == 1) {
if (sp34 || this->unkF4_8 == 1 || this->unkF4_8 == 8) {
__chSmBottles_setState(this, SM_BOTTLES_STATE_5_UNKNOWN);
}
else {
if (func_80329530(this, 0x96) && !sp34) {
func_8028F45C(9, this->position);
}
__chSmBottles_setState(this, SM_BOTTLES_STATE_2_UNKNOWN);
}
}
}
}
}
break;
case SM_BOTTLES_STATE_2_UNKNOWN://L80389E2C
this->yaw_ideal = func_80329784(this);
func_80328FB0(this, 4.0f);
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_TALKED_TO_BOTTLES)) {
__chSmBottles_talk(this);
}
__chSmBottles_setState(this, SM_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
FUNC_8030E8B4(SFX_2C_PULLING_NOISE, 1.2f, 24000, this->position, 1250, 2500);
}
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_TALKED_TO_BOTTLES)) {
__chSmBottles_talk(this);
}
}
break;
case SM_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
) {
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)
) {
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)
) {
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);
__chSmBottles_setState(this, SM_BOTTLES_STATE_4_UNKNOWN);
}//L8038A1B8
button_pressed = -1;
if (this->unk38_0) {
this->lifetime_value += time_getDelta();
if (func_803114C4() != 0xe1d) {
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 (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, __chSmBottles_textCallback,__chSmBottles_textActions);
if (!button_pressed) {
__chSmBottles_skipIntroTutorial();
}
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, __chSmBottles_textCallback, NULL);
this->has_met_before = TRUE;
}
}
break;
case SM_BOTTLES_STATE_4_UNKNOWN: //L8038A31C
if (0.35 < animctrl_getAnimTimer(this->animctrl) && animctrl_getAnimTimer(this->animctrl) < 0.9) {
func_8030E2C4(this->unk44_31);
}
else if (actor_animationIsAt(this, 0.9999f)) { //L8038A378
__chSmBottles_setState(this, SM_BOTTLES_STATE_1_UNKNOWN);
func_80386540();
}
break;
}//L8038A3A0
}

View File

@@ -2,203 +2,223 @@
#include "functions.h"
#include "variables.h"
//external
f32 mapModel_getFloorY(f32*);
/* extern functions */
f32 mapModel_getFloorY(f32 *);
void spawnQueue_bundle_f32(s32, f32, f32, f32);
void timed_mapSpecificFlags_setTrue(f32, s32);
void subaddie_set_state_with_direction(Actor *, s32, f32, s32);
//typedefs
typedef struct ch_vegatable{
/* typedefs and declarations */
enum chVegetables_state_e {
VEGETABLES_STATE_1_UNKNOWN = 1,
VEGETABLES_STATE_2_UNKNOWN,
VEGETABLES_STATE_3_UNKNOWN,
VEGETABLES_STATE_4_UNKNOWN
};
typedef struct ch_vegetable {
TUPLE(f32, unk0);
s32 unkC;
s32 vegetable_id;
u32 pad10_31: 19;
u32 unk10_12: 4;
u32 pad10_8: 9;
} ChVeg;
//public
Actor *func_80387DF4(ActorMarker *, Gfx**, Mtx**, Vtx **);
void func_80388080(Actor *);
/* public functions */
Actor *chVegetablesDraw(ActorMarker *, Gfx **, Mtx **, Vtx **);
void chVegetablesUpdate(Actor *);
/* .data */
ActorAnimationInfo chCarrotAnimations[5] = {
{0, 0.0f},
{0x223, 1000000.0f},
{0x223, 1.0f},
{0x224, 0.75f},
{0x223, 1.0f}
ActorAnimationInfo chTopperAnimations[5] = {
{NULL, 0.0f},
{ASSET_223_ANIM_TOPPER_UNKNOWN, 1000000.0f},
{ASSET_223_ANIM_TOPPER_UNKNOWN, 1.0f},
{ASSET_224_ANIM_TOPPER_UNKNOWN, 0.75f},
{ASSET_223_ANIM_TOPPER_UNKNOWN, 1.0f}
};
ActorInfo D_8038AC78 = { MARKER_12A_TOPPER_A, ACTOR_166_TOPPER_A, MODEL_TOPPER, 1, chCarrotAnimations,
func_80388080, actor_update_func_80326224, func_80387DF4,
ActorInfo D_8038AC78 = {
MARKER_12A_TOPPER_A, ACTOR_166_TOPPER_A, ASSET_4ED_MODEL_TOPPER,
1, chTopperAnimations,
chVegetablesUpdate, actor_update_func_80326224, chVegetablesDraw,
2000, 0, 1.0f, 0
};
ActorInfo D_8038AC9C = { MARKER_1E6_TOPPER_B, ACTOR_TOPPER_B, MODEL_TOPPER, 1, chCarrotAnimations,
func_80388080, actor_update_func_80326224, func_80387DF4,
ActorInfo D_8038AC9C = {
MARKER_1E6_TOPPER_B, ACTOR_TOPPER_B, ASSET_4ED_MODEL_TOPPER,
1, chTopperAnimations,
chVegetablesUpdate, actor_update_func_80326224, chVegetablesDraw,
2000, 0, 1.0f, 0
};
ActorAnimationInfo chOnionAnimations[5] = {
{0, 0.0f},
{0x226, 1000000.0f},
{0x226, 1.0f},
{0x227, 0.75f},
{0x226, 1.0f}
ActorAnimationInfo chBawlAnimations[5] = {
{NULL, 0.0f},
{ASSET_226_ANIM_BAWL_UNKNOWN, 1000000.0f},
{ASSET_226_ANIM_BAWL_UNKNOWN, 1.0f},
{ASSET_227_ANIM_BAWL_UNKNOWN, 0.75f},
{ASSET_226_ANIM_BAWL_UNKNOWN, 1.0f}
};
ActorInfo D_8038ACE8 = { MARKER_129_BAWL_A, ACTOR_165_BAWL_A, MODEL_BAWL, 1, chOnionAnimations,
func_80388080, actor_update_func_80326224, func_80387DF4,
ActorInfo D_8038ACE8 = {
MARKER_129_BAWL_A, ACTOR_165_BAWL_A, ASSET_4EF_MODEL_BAWL,
1, chBawlAnimations,
chVegetablesUpdate, actor_update_func_80326224, chVegetablesDraw,
0, 0, 1.0f, 0
};
ActorInfo D_8038AD0C = { MARKER_1E7_BAWL_B, ACTOR_BAWL_B, MODEL_BAWL, 1, chOnionAnimations,
func_80388080, actor_update_func_80326224, func_80387DF4,
ActorInfo D_8038AD0C = {
MARKER_1E7_BAWL_B, ACTOR_BAWL_B, ASSET_4EF_MODEL_BAWL,
1, chBawlAnimations,
chVegetablesUpdate, actor_update_func_80326224, chVegetablesDraw,
0, 0, 1.0f, 0
};
ActorAnimationInfo chCauliflowerAnimations[5] = {
{0, 0.0f},
{0x225, 10000000.0f},
{0x225, 1.0f},
{0x225, 10000000.0f},
{0x225, 1.0f}
ActorAnimationInfo chCollywobbleAnimations[5] = {
{NULL, 0.0f},
{ASSET_225_ANIM_COLLYWOBBLE_UNKNOWN, 10000000.0f},
{ASSET_225_ANIM_COLLYWOBBLE_UNKNOWN, 1.0f},
{ASSET_225_ANIM_COLLYWOBBLE_UNKNOWN, 10000000.0f},
{ASSET_225_ANIM_COLLYWOBBLE_UNKNOWN, 1.0f}
};
ActorInfo D_8038AD58 = { MARKER_128_COLLYWOBBLE_A, ACTOR_164_COLLYWOBBLE_A, MODEL_COLLYWOBBLE, 1, chCauliflowerAnimations,
func_80388080, actor_update_func_80326224, func_80387DF4,
ActorInfo D_8038AD58 = {
MARKER_128_COLLYWOBBLE_A, ACTOR_164_COLLYWOBBLE_A, ASSET_4EE_MODEL_COLLYWOBBLE,
1, chCollywobbleAnimations,
chVegetablesUpdate, actor_update_func_80326224, chVegetablesDraw,
0, 0, 2.0f, 0
};
ActorInfo D_8038AD7C = { MARKER_1E8_COLLYWOBBLE_B, ACTOR_COLLYWOBBLE_B, MODEL_COLLYWOBBLE, 1, chCauliflowerAnimations,
func_80388080, actor_update_func_80326224, func_80387DF4,
ActorInfo D_8038AD7C = {
MARKER_1E8_COLLYWOBBLE_B, ACTOR_COLLYWOBBLE_B, ASSET_4EE_MODEL_COLLYWOBBLE,
1, chCollywobbleAnimations,
chVegetablesUpdate, actor_update_func_80326224, chVegetablesDraw,
0, 0, 2.0f, 0
};
s32 D_8038ADA0[3] = {0xFF, 0xFF, 0xFF};
s32 D_8038ADA0[3] = {0xFF, 0xFF, 0xFF};
ParticleScaleAndLifetimeRanges D_8038ADAC = {
{0.1f, 0.5f},
{1.5f, 3.0f},
{0.0f, 0.01f},
{1.0f, 1.5f},
{0.1f, 0.5f},
{1.5f, 3.0f},
{0.0f, 0.01f},
{1.0f, 1.5f},
0.0f, 0.01f,
};
ParticleSettingsVelocityPosition D_8038ADD4 = {
{{-100.0f, -100.0f, -100.0f}, {100.0f, 100.0f, 100.0f}},
{{-40.0f, -40.0f, -40.0f}, {40.0f, 40.0f, 40.0f}}
{{-40.0f, -40.0f, -40.0f}, {40.0f, 40.0f, 40.0f}}
};
ParticleScaleAndLifetimeRanges D_8038AE04 = {
{0.5f, 0.75f},
{0.4f, 0.6f},
{0.4f, 0.6f},
{0.0f, 0.01f},
{4.0f, 4.0f},
{4.0f, 4.0f},
0.0f, 0.2f
};
ParticleSettingsVelocityAccelerationPosition D_8038AE2C = {
{{-100.0f, 200.0f, -100.0f}, {100.0f, 400.0f, 100.0f}},
{{0.0f, -600.0f, 0.0f}, {0.0f, -600.0f, 0.0f}},
{{-80.0f, -80.0f, -80.0f}, {80.0f, 80.0f, 80.0f}}
{{-100.0f, 200.0f, -100.0f}, {100.0f, 400.0f, 100.0f}},
{{0.0f, -600.0f, 0.0f}, {0.0f, -600.0f, 0.0f}},
{{-80.0f, -80.0f, -80.0f}, {80.0f, 80.0f, 80.0f}}
};
ParticleScaleAndLifetimeRanges D_8038AE74 = {
{1.0f, 1.0f},
{1.0f, 1.0f},
{0.0f, 0.01f},
{2.0f, 2.0f},
{1.0f, 1.0f},
{1.0f, 1.0f},
{0.0f, 0.01f},
{2.0f, 2.0f},
0.0f, 0.5f
};
ParticleSettingsVelocityAccelerationPosition D_8038AE9C = {
{{-100.0f, 400.0f, -100.0f}, {100.0f, 600.0f, 100.0f}},
{{0.0f, -600.0f, 0.0f}, {0.0f, -600.0f, 0.0f}},
{{-20.0f, -20.0f, -20.0f}, {20.0f, 20.0f, 20.0f}}
{{-100.0f, 400.0f, -100.0f}, {100.0f, 600.0f, 100.0f}},
{{0.0f, -600.0f, 0.0f}, {0.0f, -600.0f, 0.0f}},
{{-20.0f, -20.0f, -20.0f}, {20.0f, 20.0f, 20.0f}}
};
ParticleScaleAndLifetimeRanges D_8038AEE4 = {
{0.6f, 0.8f},
{0.5f, 0.7f},
{0.0f, 0.01f},
{4.0f, 4.0f},
{0.6f, 0.8f},
{0.5f, 0.7f},
{0.0f, 0.01f},
{4.0f, 4.0f},
0.0f, 0.5f
};
ParticleSettingsVelocityAccelerationPosition D_8038AF0C ={
{{-200.0f, 200.0f, -200.0f}, {200.0f, 600.0f, 200.0f}},
{{0.0f, -900.0f, 0.0f}, {0.0f, -900.0f, 0.0f}},
{{-100.0f, -100.0f, -100.0f}, {100.0f, 100.0f, 100.0f}},
ParticleSettingsVelocityAccelerationPosition D_8038AF0C = {
{{-200.0f, 200.0f, -200.0f}, {200.0f, 600.0f, 200.0f}},
{{ 0.0f, -900.0f, 0.0f}, { 0.0f, -900.0f, 0.0f}},
{{-100.0f, -100.0f, -100.0f}, {100.0f, 100.0f, 100.0f}},
};
/* .code */
void func_80387910(ParticleEmitter *arg0, f32 *arg1, s32 arg2){
void __chVegetables_emitDust(ParticleEmitter *pCtrl, f32 *pos, s32 n) {
s32 sp24[3] = D_8038ADA0;
particleEmitter_setRGB(arg0, sp24);
particleEmitter_setSprite(arg0, ASSET_700_SPRITE_DUST);
particleEmitter_setStartingFrameRange(arg0, 0, 7);
particleEmitter_setPosition(arg0, arg1);
particleEmitter_setScaleAndLifetimeRanges(arg0, &D_8038ADAC);
particleEmitter_setPositionAndVelocityRanges(arg0, &D_8038ADD4);
particleEmitter_emitN(arg0, arg2);
particleEmitter_setRGB(pCtrl, sp24);
particleEmitter_setSprite(pCtrl, ASSET_700_SPRITE_DUST);
particleEmitter_setStartingFrameRange(pCtrl, 0, 7);
particleEmitter_setPosition(pCtrl, pos);
particleEmitter_setScaleAndLifetimeRanges(pCtrl, &D_8038ADAC);
particleEmitter_setPositionAndVelocityRanges(pCtrl, &D_8038ADD4);
particleEmitter_emitN(pCtrl, n);
}
void func_803879B8(ParticleEmitter *arg0, f32 *arg1, s32 arg2, enum asset_e model_id){
particleEmitter_func_802EF9F8(arg0, 0.6f);
particleEmitter_func_802EFA18(arg0, 2);
particleEmitter_setModel(arg0, model_id);
particleEmitter_setPosition(arg0, arg1);
particleEmitter_setDrawMode(arg0, 2);
particleEmitter_setAngularVelocityRange(arg0, -300.0f, -300.0f, -300.0f, 300.0f, 300.0f, 300.0f);
particleEmitter_setScaleAndLifetimeRanges(arg0, &D_8038AE04);
particleEmitter_setVelocityAccelerationAndPositionRanges(arg0, &D_8038AE2C);
particleEmitter_emitN(arg0, arg2);
void func_803879B8(ParticleEmitter *pCtrl, f32 *pos, s32 n, enum asset_e model_id) {
particleEmitter_func_802EF9F8(pCtrl, 0.6f);
particleEmitter_func_802EFA18(pCtrl, 2);
particleEmitter_setModel(pCtrl, model_id);
particleEmitter_setPosition(pCtrl, pos);
particleEmitter_setDrawMode(pCtrl, 2);
particleEmitter_setAngularVelocityRange(pCtrl, -300.0f, -300.0f, -300.0f, 300.0f, 300.0f, 300.0f);
particleEmitter_setScaleAndLifetimeRanges(pCtrl, &D_8038AE04);
particleEmitter_setVelocityAccelerationAndPositionRanges(pCtrl, &D_8038AE2C);
particleEmitter_emitN(pCtrl, n);
}
void func_80387A80(ParticleEmitter *arg0, f32 *arg1, s32 arg2, enum asset_e model_id){
particleEmitter_func_802EF9F8(arg0, 0.6f);
particleEmitter_func_802EFA18(arg0, 3);
particleEmitter_setModel(arg0, model_id);
particleEmitter_setPosition(arg0, arg1);
particleEmitter_setDrawMode(arg0, 2);
particleEmitter_setAngularVelocityRange(arg0, -300.0f, -300.0f, -300.0f, 300.0f, 300.0f, 300.0f);
particleEmitter_setScaleAndLifetimeRanges(arg0, &D_8038AE74);
particleEmitter_setVelocityAccelerationAndPositionRanges(arg0, &D_8038AE9C);
particleEmitter_emitN(arg0, arg2);
void func_80387A80(ParticleEmitter *pCtrl, f32 *pos, s32 n, enum asset_e model_id) {
particleEmitter_func_802EF9F8(pCtrl, 0.6f);
particleEmitter_func_802EFA18(pCtrl, 3);
particleEmitter_setModel(pCtrl, model_id);
particleEmitter_setPosition(pCtrl, pos);
particleEmitter_setDrawMode(pCtrl, 2);
particleEmitter_setAngularVelocityRange(pCtrl, -300.0f, -300.0f, -300.0f, 300.0f, 300.0f, 300.0f);
particleEmitter_setScaleAndLifetimeRanges(pCtrl, &D_8038AE74);
particleEmitter_setVelocityAccelerationAndPositionRanges(pCtrl, &D_8038AE9C);
particleEmitter_emitN(pCtrl, n);
}
void func_80387B48(ParticleEmitter *arg0, f32 arg1[3], s32 arg2, enum asset_e model_id){
particleEmitter_func_802EF9F8(arg0, 0.7f);
particleEmitter_func_802EFA18(arg0, 4);
particleEmitter_setModel(arg0, model_id);
particleEmitter_setPosition(arg0, arg1);
particleEmitter_setDrawMode(arg0, 2);
particleEmitter_setAngularVelocityRange(arg0, 150.0f, -300.0f, -300.0f, 300.0f, 300.0f, -150.0f);
particleEmitter_setSfx(arg0, SFX_1F_HITTING_AN_ENEMY_3, 8000);
particleEmitter_setScaleAndLifetimeRanges(arg0, &D_8038AEE4);
particleEmitter_setVelocityAccelerationAndPositionRanges(arg0, &D_8038AF0C);
particleEmitter_emitN(arg0, arg2);
void func_80387B48(ParticleEmitter *pCtrl, f32 pos[3], s32 n, enum asset_e model_id) {
particleEmitter_func_802EF9F8(pCtrl, 0.7f);
particleEmitter_func_802EFA18(pCtrl, 4);
particleEmitter_setModel(pCtrl, model_id);
particleEmitter_setPosition(pCtrl, pos);
particleEmitter_setDrawMode(pCtrl, 2);
particleEmitter_setAngularVelocityRange(pCtrl, 150.0f, -300.0f, -300.0f, 300.0f, 300.0f, -150.0f);
particleEmitter_setSfx(pCtrl, SFX_1F_HITTING_AN_ENEMY_3, 8000);
particleEmitter_setScaleAndLifetimeRanges(pCtrl, &D_8038AEE4);
particleEmitter_setVelocityAccelerationAndPositionRanges(pCtrl, &D_8038AF0C);
particleEmitter_emitN(pCtrl, n);
}
void func_80387C28(Actor * this){
ChVeg * local = (ChVeg *)&this->local;
f32 sp30[3];
void __chVegetables_dieActor(Actor *this) {
ChVeg *local = (ChVeg *) &this->local;
f32 pos[3];
FUNC_8030E8B4(SFX_111_WHIPCRACK_DEATH, 1.0f, 32000, this->position, 1000, 2000);
if(local->unkC == 3){
sp30[0] = this->position_x;
sp30[1] = this->position_y;
sp30[2] = this->position_z;
sp30[1] += 50.0f;
func_80387B48(partEmitMgr_newEmitter(0xC), sp30, 0xC, 0x4F4);
func_803879B8(partEmitMgr_newEmitter(4), sp30, 0x4, 0x4F2);
func_803879B8(partEmitMgr_newEmitter(4), sp30, 0x4, 0x4F3);
sp30[1] += 50.0f;
func_80387910(partEmitMgr_newEmitter(8), sp30, 8);
if (local->vegetable_id == VEGETABLE_3_COLLY_WOBBLE) {
pos[0] = this->position_x;
pos[1] = this->position_y;
pos[2] = this->position_z;
pos[1] += 50.0f;
func_80387B48(partEmitMgr_newEmitter(12), pos, 0xC, ASSET_4F4_MODEL_UNKNOWN);
func_803879B8(partEmitMgr_newEmitter(4), pos, 0x4, ASSET_4F2_MODEL_UNKNOWN);
func_803879B8(partEmitMgr_newEmitter(4), pos, 0x4, ASSET_4F3_MODEL_UNKNOWN);
pos[1] += 50.0f;
__chVegetables_emitDust(partEmitMgr_newEmitter(8), pos, 8);
}//L80387D18
if (this->unk38_31) {
@@ -207,34 +227,37 @@ void func_80387C28(Actor * this){
__spawnQueue_add_4((GenFunction_4) spawnQueue_bundle_f32, BUNDLE_1F_SM_EMPTY_HONEYCOMB, reinterpret_cast(s32, this->position_x), reinterpret_cast(s32, this->position_y), reinterpret_cast(s32, this->position_z));
}//L80387D64
timed_mapSpecificFlags_setTrue(1.5f, 7);
timed_mapSpecificFlags_setTrue(1.5f, SM_SPECIFIC_FLAG_7);
actor_collisionOff(this);
if(local->unkC != 3){
subaddie_set_state_with_direction(this, 3, 0.0f, 1);
if (local->vegetable_id != VEGETABLE_3_COLLY_WOBBLE) {
subaddie_set_state_with_direction(this, VEGETABLES_STATE_3_UNKNOWN, 0.0f, 1);
actor_playAnimationOnce(this);
}
else{
else {
marker_despawn(this->marker);
}
}
void func_80387DCC(ActorMarker *marker, ActorMarker *other_marker){
func_80387C28(marker_getActor(marker));
void __chVegetables_die(ActorMarker *marker, ActorMarker *other_marker) {
__chVegetables_dieActor(marker_getActor(marker));
}
Actor *func_80387DF4(ActorMarker *marker, Gfx **gdl, Mtx **mptr, Vtx **arg3){
Actor *chVegetablesDraw(ActorMarker *marker, Gfx **gdl, Mtx **mptr, Vtx **arg3) {
Actor *actor = marker_getActor(marker);
if(actor->has_met_before)
if (actor->has_met_before) {
func_8033A470(3, 7);
else
}
else {
func_8033A45C(3, 0);
}
return actor_draw(marker, gdl, mptr, arg3);
}
void func_80387E64(Actor *this){
ChVeg *local = (ChVeg *)&this->local;
void func_80387E64(Actor *this) {
ChVeg *local = (ChVeg *) &this->local;
this->unk1C_x = randf2(-50.0f, 50.0f);
this->unk1C_y = randf2(-50.0f, 50.0f);
@@ -245,252 +268,293 @@ void func_80387E64(Actor *this){
this->unk1C_z = local->unk0_z + this->unk1C_z;
}
void func_80387F00(Actor *this){
ChVeg *local = (ChVeg *)&this->local;
this->position_y += (mapSpecificFlags_get(0xC) || volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE)) ? 120.0 : 180.0;
void func_80387F00(Actor *this) {
ChVeg *local = (ChVeg *) &this->local;
this->position_y += mapSpecificFlags_get(SM_SPECIFIC_FLAG_C) || volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE) ? 120.0 : 180.0;
local->unk0_x = this->position_x;
local->unk0_y = this->position_y;
local->unk0_z = this->position_z;
this->velocity_x = 0.0f;
this->velocity_y = 0.0f;
this->velocity_z = 0.0f;
func_80387E64(this);
}
int func_80387FA8(Actor *this, ChVeg *local, s32 yaw, s32 arg3){
int func_80387FA8(Actor *this, ChVeg *local, s32 yaw, s32 arg3) {
f32 sp24[3];
f32 sp18[3];
sp18[0] = arg3;
sp18[1] = 0.0f;
sp18[2] = 0.0f;
ml_vec3f_yaw_rotate_copy(sp18, sp18, yaw - 90.0);
sp24[0] = sp18[0] + local->unk0_x;
sp24[1] = sp18[1] + local->unk0_y;
sp24[2] = sp18[2] + local->unk0_z;
if(func_80307258(sp24, this->unk10_25 - 1, this->unk10_18 - 1) == -1)
if (func_80307258(sp24, this->unk10_25 - 1, this->unk10_18 - 1) == -1) {
return 0;
else
}
else {
return 1;
}
}
void func_80388080(Actor *this){
void chVegetablesUpdate(Actor *this) {
f32 temp_velZ;
f32 temp_velX;
f32 temp_f0;
f32 sp78;
f32 tick;
f32 sp6C[3];
f32 sp60[3];
f32 sp54[3];
ChVeg *local = (ChVeg *)&this->local; //sp38
f32 sp30;
f32 position[3];
ChVeg *local = (ChVeg *) &this->local; //sp38
f32 unused;
if(!this->initialized){
switch(this->marker->id){
if (!this->initialized) {
switch (this->marker->id) {
default:
local->unkC = 3; //cauliflower
local->vegetable_id = VEGETABLE_3_COLLY_WOBBLE; //cauliflower
break;
case 0x12A: //L803880F0
case 0x1E6: //L803880F0
local->unkC = 1; //carrot
case MARKER_12A_TOPPER_A: //L803880F0
case MARKER_1E6_TOPPER_B: //L803880F0
local->vegetable_id = VEGETABLE_1_TOPPER; //carrot
break;
case 0x129: //L80388100
case 0x1E7: //L80388100
local->unkC = 2; //onion
case MARKER_129_BAWL_A: //L80388100
case MARKER_1E7_BAWL_B: //L80388100
local->vegetable_id = VEGETABLE_2_BAWL; //onion
break;
}
actor_collisionOff(this);
marker_setCollisionScripts(this->marker, NULL, NULL, func_80387DCC);
marker_setCollisionScripts(this->marker, NULL, NULL, __chVegetables_die);
this->unk1C_x = this->position_x;
this->unk1C_y = this->position_y;
this->unk1C_z = this->position_z;
this->position_y -= 200.f;
do{//L80388154
do {//L80388154
temp_velX = randf2(-10.0f, 10.0f);
temp_f0 =(0.0f <= temp_velX) ? temp_velX : -temp_velX;
}while(temp_f0 < 5.0);
temp_f0 = 0.0f <= temp_velX ? temp_velX : -temp_velX;
} while (temp_f0 < 5.0);
do{//L803881AC
do {//L803881AC
temp_velZ = randf2(-10.0f, 10.0f);
temp_f0 =(0.0f <= temp_velZ) ? temp_velZ : -temp_velZ;
}while(temp_f0 < 5.0);
temp_f0 = 0.0f <= temp_velZ ? temp_velZ : -temp_velZ;
} while (temp_f0 < 5.0);
this->velocity_x = temp_velX;
this->velocity_y = (local->unkC == 3) ? 90.0f : 70.0f;
this->velocity_y = local->vegetable_id == VEGETABLE_3_COLLY_WOBBLE ? 90.0f : 70.0f;
this->velocity_z = temp_velZ;
this->has_met_before = TRUE;
this->unk138_23 = 0;
this->unk38_0 = 0;
this->initialized = TRUE;
this->scale = 0.5;
}//L80388278
switch (this->state)
{
case 1: //L803882B0
if(mapSpecificFlags_get(0xC) || volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE) || this->unk10_12){
//L803882E4
if(mapSpecificFlags_get(0xC) || volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE)){ //L8038830C
this->unk1C_y += (local->unkC == 3)? 120.0 : 0.0;
}else{//L80388350
this->unk1C_y += (local->unkC == 3)? 270.0 : 85.0;
}
//L80388384
subaddie_set_state(this, 4);
}
break;
case 4: //L8038839C
this->position_x = this->velocity_x + this->position_x;
this->position_y = this->velocity_y + this->position_y;
this->position_z = this->velocity_z + this->position_z;
this->velocity_y -= 5.0f;
this->scale = MIN(this->scale + 0.05, 1.0);
if(this->velocity_y < 0.0f && this->position_y < this->unk1C_y){
this->position_y = mapModel_getFloorY(this->position);
if(local->unkC == 3)
func_80387F00(this);
actor_collisionOn(this);
subaddie_set_state(this, 2);
}//L80388494
switch (this->state) {
case VEGETABLES_STATE_1_UNKNOWN: //L803882B0
if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_C) || volatileFlag_get(
VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE) || this->unk10_12) {//L803882E4
if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_C) || volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE)) { //L8038830C
this->unk1C_y += local->vegetable_id == VEGETABLE_3_COLLY_WOBBLE ? 120.0 : 0.0;
}
else {//L80388350
this->unk1C_y += local->vegetable_id == VEGETABLE_3_COLLY_WOBBLE ? 270.0 : 85.0;
}
//L80388384
subaddie_set_state(this, VEGETABLES_STATE_4_UNKNOWN);
}
break;
if(!this->unk138_23){
if(0.0f < this->position_y){
FUNC_8030E8B4(SFX_C5_TWINKLY_POP, 1.0f, 32000, this->position, 1000, 2000);
this->unk138_23 = 1;
this->scale = 1.0f;
}
}
case VEGETABLES_STATE_4_UNKNOWN: //L8038839C
this->position_x = this->velocity_x + this->position_x;
this->position_y = this->velocity_y + this->position_y;
this->position_z = this->velocity_z + this->position_z;
break;
case 2: //L803884E4
if(this->unk38_0){
if(func_80329480(this)){
this->unk38_0 = 0;
}
}else{//L80388520
if(local->unkC == 1){
this->actor_specific_1_f = 3.0f;
if(mapSpecificFlags_get(0xC) || volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE)){//L80388554
if(!func_80329030(this, 0) && func_80329480(this)){
func_80328CEC(this, (s32)this->yaw, 0x78, 0xb4);
this->unk38_0 = 1;
}//L803885A0
if(func_803292E0(this)){
this->yaw_ideal = func_80329784(this);
}
else{//L803885CC
if(randf() < 0.02){
func_80328CEC(this, (s32)this->yaw, 0x1E, 0x5A);
}
}//L80388B68
this->velocity_y -= 5.0f;
this->scale = MIN(this->scale + 0.05, 1.0);
if (this->velocity_y < 0.0f && this->position_y < this->unk1C_y) {
this->position_y = mapModel_getFloorY(this->position);
if (local->vegetable_id == VEGETABLE_3_COLLY_WOBBLE) {
func_80387F00(this);
}
else{//L80388618
this->yaw_ideal = func_80329784(this);
actor_collisionOn(this);
subaddie_set_state(this, VEGETABLES_STATE_2_UNKNOWN);
}//L80388494
if (!this->unk138_23) {
if (0.0f < this->position_y) {
FUNC_8030E8B4(SFX_C5_TWINKLY_POP, 1.0f, 32000, this->position, 1000, 2000);
this->unk138_23 = 1;
this->scale = 1.0f;
}
}
else if(local->unkC == 2){//L80388634
this->actor_specific_1_f = 4.0f;
if(!func_80329030(this, 0) && func_80329480(this)){
func_80328CEC(this, (s32)this->yaw, 0x78, 0xB4);
this->unk38_0 = 1;
}//L80388698
if(mapSpecificFlags_get(0xC) || (volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE) && func_803292E0(this))){
this->yaw_ideal = func_80329784(this);
}else{//L803886E4
if(randf() < 0.02){//D_8038B1D0){
func_80328CEC(this, (s32)this->yaw, 0x1E, 0x5A);
}
break;
case VEGETABLES_STATE_2_UNKNOWN: //L803884E4
if (this->unk38_0) {
if (func_80329480(this)) {
this->unk38_0 = 0;
}
}else{//L80388730
sp78 = time_getDelta();
sp6C[0] = this->unk1C_x - this->position_x;
sp6C[1] = this->unk1C_y - this->position_y;
sp6C[2] = this->unk1C_z - this->position_z;
if( LENGTH_VEC3F(sp6C) < 40.0f){
ml_vec3f_set_length(sp6C, 400.0f);
}
else{
ml_vec3f_set_length(sp6C, 100.0f);
}
this->position_x += this->velocity_x*sp78 + sp6C[0]*sp78*sp78;
this->position_y += this->velocity_y*sp78 + sp6C[1]*sp78*sp78;
this->position_z += this->velocity_z*sp78 + sp6C[2]*sp78*sp78;
this->velocity_x += sp6C[0]*sp78;
this->velocity_y += sp6C[1]*sp78;
this->velocity_z += sp6C[2]*sp78;
if(gu_sqrtf(this->velocity_z*this->velocity_z + (this->velocity_x*this->velocity_x + this->velocity_y*this->velocity_y)) > 50.0f){
ml_vec3f_set_length(this->velocity, 50.0f);
}
if(ml_distance_vec3f(this->position, this->unk1C) < 20.0f){
func_80387E64(this);
}
this->actor_specific_1_f = 5.0f;
if(mapSpecificFlags_get(0xC) || (volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE))){ //L8038892C
if(!func_80387FA8(this, local, (s32)this->yaw, (s32)this->actor_specific_1_f)){
if(func_80329480(this)){
func_80328CEC(this, (s32)this->yaw, 0x78, 0xb4);
}
else {//L80388520
if (local->vegetable_id == VEGETABLE_1_TOPPER) {
this->actor_specific_1_f = 3.0f;
if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_C) || volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE)) {//L80388554
if (!func_80329030(this, 0) && func_80329480(this)) {
func_80328CEC(this, (s32) this->yaw, 0x78, 0xb4);
this->unk38_0 = 1;
}//L80388994
}else{ //L803889A0
}//L803885A0
this->position_x -= local->unk0_x;
this->position_y -= local->unk0_y;
this->position_z -= local->unk0_z;
this->unk1C_x -= local->unk0_x;
this->unk1C_y -= local->unk0_y;
this->unk1C_z -= local->unk0_z;
TUPLE_ASSIGN(sp60, this->actor_specific_1_f, 0.0f, 0.0f);
ml_vec3f_yaw_rotate_copy(sp60, sp60, this->yaw - 90.0);
local->unk0_x = sp60[0] + local->unk0_x;
local->unk0_y = sp60[1] + local->unk0_y;
local->unk0_z = sp60[2] + local->unk0_z;
this->position_x = local->unk0_x + this->position_x;
this->position_y = local->unk0_y + this->position_y;
this->position_z = local->unk0_z + this->position_z;
this->unk1C_x = local->unk0_x + this->unk1C_x;
this->unk1C_y = local->unk0_y + this->unk1C_y;
this->unk1C_z = local->unk0_z + this->unk1C_z;
}//L80388AD8
if(func_803292E0(this)){
if (func_803292E0(this)) {
this->yaw_ideal = func_80329784(this);
}//L803885CC
else if (randf() < 0.02) {
func_80328CEC(this, (s32) this->yaw, 0x1E, 0x5A);
}//L80388B68
}
else {//L80388618
this->yaw_ideal = func_80329784(this);
}else{//L80388B04
if(randf() < 0.01){
func_80328CEC(this, (s32)this->yaw, 0x1e, 0x5A);
}
}
else if (local->vegetable_id == VEGETABLE_2_BAWL) {//L80388634
this->actor_specific_1_f = 4.0f;
if (!func_80329030(this, 0) && func_80329480(this)) {
func_80328CEC(this, (s32) this->yaw, 0x78, 0xB4);
this->unk38_0 = 1;
}//L80388698
if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_C) || (volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE) && func_803292E0(
this))) {
this->yaw_ideal = func_80329784(this);
}//L803886E4
else if (randf() < 0.02) {//D_8038B1D0){
func_80328CEC(this, (s32) this->yaw, 0x1E, 0x5A);
}
}
else {//L80388730
tick = time_getDelta();
sp6C[0] = this->unk1C_x - this->position_x;
sp6C[1] = this->unk1C_y - this->position_y;
sp6C[2] = this->unk1C_z - this->position_z;
if (LENGTH_VEC3F(sp6C) < 40.0f) {
ml_vec3f_set_length(sp6C, 400.0f);
}
else {
ml_vec3f_set_length(sp6C, 100.0f);
}
this->position_x += this->velocity_x * tick + sp6C[0] * tick * tick;
this->position_y += this->velocity_y * tick + sp6C[1] * tick * tick;
this->position_z += this->velocity_z * tick + sp6C[2] * tick * tick;
this->velocity_x += sp6C[0] * tick;
this->velocity_y += sp6C[1] * tick;
this->velocity_z += sp6C[2] * tick;
if (gu_sqrtf(SQ(this->velocity_z) + (SQ(this->velocity_x) + SQ(this->velocity_y))) > 50.0f) {
ml_vec3f_set_length(this->velocity, 50.0f);
}
if (ml_distance_vec3f(this->position, this->unk1C) < 20.0f) {
func_80387E64(this);
}
this->actor_specific_1_f = 5.0f;
if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_C) || (volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE))) { //L8038892C
if (!func_80387FA8(this, local, (s32) this->yaw, (s32) this->actor_specific_1_f)) {
if (func_80329480(this)) {
func_80328CEC(this, (s32) this->yaw, 0x78, 0xb4);
this->unk38_0 = 1;
}//L80388994
}
else { //L803889A0
this->position_x -= local->unk0_x;
this->position_y -= local->unk0_y;
this->position_z -= local->unk0_z;
this->unk1C_x -= local->unk0_x;
this->unk1C_y -= local->unk0_y;
this->unk1C_z -= local->unk0_z;
TUPLE_ASSIGN(sp60, this->actor_specific_1_f, 0.0f, 0.0f)
ml_vec3f_yaw_rotate_copy(sp60, sp60, this->yaw - 90.0);
local->unk0_x = sp60[0] + local->unk0_x;
local->unk0_y = sp60[1] + local->unk0_y;
local->unk0_z = sp60[2] + local->unk0_z;
this->position_x = local->unk0_x + this->position_x;
this->position_y = local->unk0_y + this->position_y;
this->position_z = local->unk0_z + this->position_z;
this->unk1C_x = local->unk0_x + this->unk1C_x;
this->unk1C_y = local->unk0_y + this->unk1C_y;
this->unk1C_z = local->unk0_z + this->unk1C_z;
}//L80388AD8
if (func_803292E0(this)) {
this->yaw_ideal = func_80329784(this);
}//L80388B04
else if (randf() < 0.01) {
func_80328CEC(this, (s32) this->yaw, 0x1e, 0x5A);
}
}
}else{
//L80388B50
this->yaw_ideal = func_80329784(this);
else { //L80388B50
this->yaw_ideal = func_80329784(this);
}
}
}//L80388B68
func_80328FB0(this, 2.0f);
if (local->vegetable_id != VEGETABLE_3_COLLY_WOBBLE && actor_animationIsAt(this, 0.3f)) {
FUNC_8030E8B4(SFX_3F2_UNKNOWN, 1.0f, 22000, this->position, 1000, 2000);
}
if (local->vegetable_id == VEGETABLE_3_COLLY_WOBBLE && actor_animationIsAt(this, 0.4f)) {
FUNC_8030E8B4(SFX_2_CLAW_SWIPE, 0.9f, 8000, this->position, 1000, 2000);
}
break;
case VEGETABLES_STATE_3_UNKNOWN: //L80388BFC
if (actor_animationIsAt(this, local->vegetable_id == VEGETABLE_2_BAWL ? 0.4 : 0.05)) {
position[0] = this->position_x;
position[1] = this->position_y;
position[2] = this->position_z;
if (local->vegetable_id == VEGETABLE_1_TOPPER) {
position[1] += 150.0f;
}
this->has_met_before = FALSE;
func_80387A80(partEmitMgr_newEmitter(3), position, 3,
local->vegetable_id == VEGETABLE_1_TOPPER ? ASSET_4F0_MODEL_UNKNOWN : ASSET_4F1_MODEL_UNKNOWN);
}//L80388CC4
if (actor_animationIsAt(this, 0.75f)) {
func_80326310(this);
}
}//L80388B68
func_80328FB0(this, 2.0f);
if(local->unkC != 3 && actor_animationIsAt(this, 0.3f))
FUNC_8030E8B4(SFX_3F2_UNKNOWN, 1.0f, 22000, this->position, 1000, 2000);
if(local->unkC == 3 && actor_animationIsAt(this, 0.4f)){
FUNC_8030E8B4(SFX_2_CLAW_SWIPE, 0.9f, 8000, this->position, 1000, 2000);
}
break;
case 3: //L80388BFC
if(actor_animationIsAt(this, (local->unkC == 2) ? 0.4 : 0.05)){
sp54[0] = this->position_x;
sp54[1] = this->position_y;
sp54[2] = this->position_z;
if(local->unkC == 1)
sp54[1] += 150.0f;
this->has_met_before = FALSE;
func_80387A80(partEmitMgr_newEmitter(3), sp54, 3, (local->unkC == 1)? 0x4f0: 0x4f1);
}//L80388CC4
if(actor_animationIsAt(this, 0.75f))
func_80326310(this);
break;
break;
}//L80388CE0
}//*/

View File

@@ -1,594 +0,0 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
//external
Actor *func_802D94B4(ActorMarker*, Gfx**, Mtx**, Vtx**);
void func_8028E668(f32*, f32, f32, f32);
void func_80328FB0(Actor *, f32);
void func_8030DA44(u8);
void timed_exitStaticCamera(f32);
void subaddie_set_state_with_direction(Actor *, s32, f32, s32);
//static types
typedef struct {
s16 learn_text;
s16 refresher_text;
s8 camera_node;
s8 ability;
} ChSmMoleDescription;
//public
void chsmmole_Update(Actor * this);
void chsmmole_80389610(Actor * this);
/* .data */
ActorAnimationInfo smMoleAnimations[6] = {
{0, 0.0f},
{ASSET_13A_ANIM_BOTTLES_ENTER, 2000000000.0f},
{ASSET_13A_ANIM_BOTTLES_ENTER, 4.5f},
{ASSET_13B_ANIM_BOTTLES_IDLE, 7.0f},
{ASSET_139_ANIM_BOTTLES_EXIT, 1.7f},
{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,
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},
{ASSET_E10_TEXT_BOTTLES_BRIDGE_BROKEN, ASSET_E11_TEXT_BOTTLES_BRIDGE_STILL_BROKEN, 0x11, -1},
};
s32 D_8038AFE4 = 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);
}
/**
* @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);
ability_setHasUsed(ABILITY_2_BEAK_BUSTER);
ability_setHasUsed(ABILITY_3_CAMERA_CONTROL);
ability_setHasUsed(ABILITY_4_CLAW_SWIPE);
ability_setHasUsed(ABILITY_5_CLIMB);
ability_setHasUsed(ABILITY_B_RATATAT_RAP);
ability_setHasUsed(ABILITY_C_ROLL);
ability_setHasUsed(ABILITY_A_HOLD_A_JUMP_HIGHER);
}
/**
* @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);
ability_unlock(ABILITY_B_RATATAT_RAP);
ability_unlock(ABILITY_0_BARGE);
ability_unlock(ABILITY_A_HOLD_A_JUMP_HIGHER);
ability_unlock(ABILITY_7_FEATHERY_FLAP);
ability_unlock(ABILITY_8_FLAP_FLIP);
ability_unlock(ABILITY_5_CLIMB);
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){
if(this->unkF4_8 == 1 && !mapSpecificFlags_get(1)){
timed_setStaticCameraToNode(0.0f, 0x12);
}
else{ //L80388F68
timed_setStaticCameraToNode(0.0f, smMoleTable[this->unkF4_8 -1].camera_node);
}
}
void func_80388FA0(Actor *this, s32 arg1){
Actor *other;
ActorMarker *myOther;
switch(this->state){
case 1://L80388FE8
this->unk138_23 = 1;
break;
case 4://L80388FF8
this->unk138_23 = 0;
case 2://L80389004
func_8030DA44(this->unk44_31);
this->unk44_31 = 0;
break;
case 5://L80389018
this->unk138_23 = 0;
func_8028F918(0);
break;
}//L8038902C
switch(arg1){
case 4:
other = subaddie_getLinkedActor(this);
myOther = this->unk100;
if(myOther && other && myOther->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:
animctrl_setSmoothTransition(this->animctrl, 0);
break;
case 5:
chsmmole_setSpiralMountainStaticCamera(this);
func_8028F94C(2,this->position);
chsmmole_80389610(this);
break;
case 3:
actor_loopAnimation(this);
break;
case 2:
other = subaddie_getLinkedActor(this);
myOther = this->unk100;
if(myOther && other && myOther->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);
func_8028F94C(2, this->position);
break;
}
subaddie_set_state_with_direction(this, arg1, 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){
Actor *actor = marker_getActor(marker);
switch(arg2){
case 3:
timed_setStaticCameraToNode(0.0f, 2);
break;
case 4:
mapSpecificFlags_set(4,1);
break;
case 5:
timed_setStaticCameraToNode(0.0f, 0x12);
break;
case 6:
comusic_playTrack(COMUSIC_2B_DING_B);
break;
case 0xff:
chsmmole_setSpiralMountainStaticCamera(actor);
break;
}
}
void func_803892C8(ActorMarker *marker, enum asset_e text_id, s32 arg2){
Actor *actor;
actor = marker_getActor(marker);
if(!mapSpecificFlags_get(3) && chmole_learnedAllSpiralMountainAbilities()){
mapSpecificFlags_set(3, 1);
gcdialog_showText(ASSET_E12_TEXT_BOTTLES_LEARNED_TUTORIAL_MOVES, 0xe, actor->position, actor->marker, func_803892C8, 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)){
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);
break;
case ASSET_E1F_TEXT_BOTTLES_TUTORIAL_OFFER: /* 2FEC 803893DC 9209003B */
actor->unk38_0 = 1;
break;
case ASSET_E1D_TEXT_BOTTLES_TUTORIAL_OFFER_WAIT: /* 2FFC 803893EC 920B0138 */
actor->has_met_before = FALSE;
actor->lifetime_value = 0.0f;
break;
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 ASSET_E09_TEXT_BOTTLES_SKIPPED_TUTORIAL:
case ASSET_E12_TEXT_BOTTLES_LEARNED_TUTORIAL_MOVES:
func_80388FA0(actor,4);
break;
default:
if(actor->state != 5)
gcdialog_showText(ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED, 4, NULL, NULL, NULL, NULL);
func_80388FA0(actor, actor->state == 5 ? 1:4);
break;
}
}
}
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 + 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;
}
}
}else{//L803895C0
*arg1 = smMoleTable[this->unkF4_8 -1].learn_text;
ability_unlock(smMoleTable[this->unkF4_8 -1].ability);
}
}
void chsmmole_80389610(Actor * this){
s32 sp2C;
s32 sp28;
sp28 = 0xe;
sp2C = 0;
switch(this->unkF4_8){
case 1://L8038965C
if(mapSpecificFlags_get(1)){
sp28 |= 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;
}
}
else{//L803896E8
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 = ASSET_E37_TEXT_BOTTLES_STOP_WASTING_TIME_AFTER_FURNACE_FUN;
sp28 |= 1;
}else{//L80389758
if(mapSpecificFlags_get(0xf)){
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(0xf, 1);
}
} //L803897B4
mapSpecificFlags_set(2, 1);
}
else{//L803897C8
if(mapSpecificFlags_get(2)){
sp2C = smMoleTable[this->unkF4_8 -1].refresher_text;
sp28 |= 1;
}
else{
sp2C = smMoleTable[this->unkF4_8 -1].learn_text;
mapSpecificFlags_set(2, 1);
}
}
break;
case 4://L80389848
if( !ability_isUnlocked(ABILITY_4_CLAW_SWIPE)
|| !ability_isUnlocked(ABILITY_C_ROLL)
|| !ability_isUnlocked(ABILITY_B_RATATAT_RAP)
){//L803898D4
mapSpecificFlags_set(4, 1);
}
else{//L803898E4
chsmmole_learnAbility(this, &sp2C, &sp28);
}
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
mapSpecificFlags_set(0xE, 1);
}
else{//L803898E4
chsmmole_learnAbility(this, &sp2C, &sp28);
}
break;
default://L803898F8
chsmmole_learnAbility(this, &sp2C, &sp28);
break;
}//L80389904
if(sp2C){
gcdialog_showText(sp2C, sp28, this->position, this->marker, func_803892C8, __chsmmole_additionalAbilityLearnActions);
}
}
/**
* @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(ACTOR_12C_MOLEHILL, &actor);
actor->unk100 = other->marker;
if(marker);
}
void func_80389984(Actor * this){
u8 tmp;
tmp = this->unk44_31;
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 *sp40;
int sp34;
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;
if(!this->initialized){
this->marker->propPtr->unk8_3 = 0;
actor_collisionOff(this);
this->initialized = TRUE;
marker_setFreeMethod(this->marker, func_80389984);
if(this->unkF4_8 == 1 || this->unkF4_8 == 8){//L80389A30
sp40 = nodeprop_findByActorIdAndActorPosition(0x349, 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
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);
}
}
}//L80389AC8
if(chsmmole_learnedAnySpiralMountainAbilities()){
mapSpecificFlags_set(1,1);
if(chmole_learnedAllSpiralMountainAbilities()){
mapSpecificFlags_set(3, 1);
mapSpecificFlags_set(2, 1);
mapSpecificFlags_set(0xC, 1);
mapSpecificFlags_set(0xF, 1);
}
}
}//L80389B20
if(!this->volatile_initialized){
__spawnQueue_add_1((GenFunction_1)chsmmole_spawnMolehill, reinterpret_cast(s32, this->marker));
this->volatile_initialized = TRUE;
}//L80389B4C
if(this->unk138_23){
func_8028E668(this->position, 180.0f, -40.0f, 120.0f);
}//L80389B64
func_8024E55C(0,sp50); //get face buttons press counters
player_getPosition(sp44);
switch (this->state)
{
case 1://L80389BAC
this->yaw_ideal = (f32)func_80329784(this);
func_80328FB0(this, 4.0f);
if( (this->unkF4_8 == 1 && !mapSpecificFlags_get(1))
|| (this->unkF4_8 == 8 && !mapSpecificFlags_get(2))
|| (this->unkF4_8 == 8 && mapSpecificFlags_get(3) && !mapSpecificFlags_get(0xF))
){//L80389C50
if( ((ml_distance_vec3f(sp44, this->unk1C) < this->actor_specific_1_f) && func_8028F20C())
|| mapSpecificFlags_get(0x10)
){//L80389C8C
if(func_80329530(this, 0x96))
func_8028F45C(9, this->position);
//L80389CA4
func_80388FA0(this, 2);
}
}
else{//L80389CBC
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
){
if(this->unkF4_8 != 8 || !fileProgressFlag_get(FILEPROG_FC_DEFEAT_GRUNTY)){
if( func_8028EFC8()
&& sp50[FACE_BUTTON(BUTTON_B)] == 1
){
if(sp34 || this->unkF4_8 == 1 || this->unkF4_8 == 8){
func_80388FA0(this, 5);
}
else{
if(func_80329530(this, 0x96) && !sp34){
func_8028F45C(9, this->position);
}
func_80388FA0(this, 2);
}
}
}
}
}
break;
case 2://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
){
func_8030E2C4(this->unk44_31);
}//L80389EA0
if(actor_animationIsAt(this, 0.9999f)){
if(!mapSpecificFlags_get(1)){
chsmmole_80389610(this);
}
func_80388FA0(this, 3);
}//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
FUNC_8030E8B4(SFX_2C_PULLING_NOISE, 1.2f, 24000, this->position, 1250, 2500);
}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(1)){
chsmmole_80389610(this);
}
}
break;
case 3://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
){
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)
){
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)
){
func_8030E878(SFX_6F_BANJO_HEADSCRATCH, randf2(1.35f, 1.5f), 6000, this->position, 1250.0f, 2500.0f);
}//L8038A194
if(mapSpecificFlags_get(5)){
mapSpecificFlags_set(5,0);
func_80388FA0(this, 4);
}//L8038A1B8
user_input = -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
}//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
}
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->has_met_before = TRUE;
}
}
break;
case 4://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();
}
}
break;
}//L8038A3A0
}

View File

@@ -1,144 +0,0 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
//extern
Actor *func_802D94B4(ActorMarker *, Gfx **, Mtx **, Vtx**);
void timed_exitStaticCamera(f32);
//public
void SM_func_8038A5D8(Actor *this);
void func_8038A4DC(Actor *this, s32 arg1);
/* .data */
ActorInfo D_8038B0B0 = { 0x1ED, 0x3B9, 0, 1, NULL,
SM_func_8038A5D8, actor_update_func_80326224, func_80325340,
0, 0, 0.0f, 0
};
/* .code */
void func_8038A460(Actor *this){
timed_setStaticCameraToNode(0.0f,4);
}
void func_8038A488(ActorMarker *caller, enum asset_e text_id, s32 arg2){
Actor *actor = marker_getActor(caller);
if(text_id == 0xdf9 || text_id == 0xe12){
func_8038A4DC(actor, 3);
}
timed_exitStaticCamera(0.0f);
}
void func_8038A4DC(Actor *this, s32 arg1){
switch(arg1){
case 2://L8038A50C
this->sm_4070.unk0 = 0;
player_getPosition(this->velocity);
func_8028F918(0);
if(ability_isUnlocked(ABILITY_7_FEATHERY_FLAP)){
mapSpecificFlags_set(9,1);
}else if(ability_isUnlocked(ABILITY_A_HOLD_A_JUMP_HIGHER)){//L8038A540
mapSpecificFlags_set(8,1);
}else{//L8038A560
func_8038A460(this);
ability_unlock(ABILITY_A_HOLD_A_JUMP_HIGHER);
gcdialog_showText(0xdf6, 0xe, this->unk1C, this->marker, func_8038A488, NULL);
this->sm_4070.unk0 = 0xe1a;
mapSpecificFlags_set(8, 0);
}
break;
case 3://L8038A5B0
mapSpecificFlags_set(5, 1);
break;
}//L8038A5BC
subaddie_set_state(this, arg1);
}
void SM_func_8038A5D8(Actor *this){
f32 sp5C[3];
s32 sp44[6];
f32 sp40;
Actor *temp_v0;
s32 temp_a0;
if(!this->initialized){
temp_v0 = actorArray_findClosestActorFromActorId(this->position, ACTOR_12B_TUTORIAL_BOTTLES, -1, &sp40);
if(temp_v0){
this->unk1C_x = temp_v0->position_x;
this->unk1C_y = temp_v0->position_y;
this->unk1C_z = temp_v0->position_z;
}
else{//L8038A630
this->unk1C_x = this->position_x;
this->unk1C_y = this->position_y;
this->unk1C_z = this->position_z;
}//L8038A644
this->initialized = TRUE;
}//L8038A650
func_8024E55C(0, sp44);
switch (this->state)
{
case 1://L8038A688
if(fileProgressFlag_get(FILEPROG_DB_SKIPPED_TUTORIAL)){
marker_despawn(this->marker);
}else{
if(mapSpecificFlags_get(0xe)){
func_8038A4DC(this, 2);
}
}
break;
case 2://L8038A6C8
if(!func_803114B0()){
if(mapSpecificFlags_get(8)){
func_8038A460(this);
ability_unlock(ABILITY_7_FEATHERY_FLAP);
gcdialog_showText(0xdf7, 0xa, this->unk1C, this->marker, func_8038A488, NULL);
this->sm_4070.unk0 = 0xe1b;
mapSpecificFlags_set(8,0);
}//L8038A730
if(mapSpecificFlags_get(9)){
func_8038A460(this);
ability_unlock(ABILITY_8_FLAP_FLIP);
gcdialog_showText(0xdf8, 0xa, this->unk1C, this->marker, func_8038A488, NULL);
this->sm_4070.unk0 = 0xe1c;
mapSpecificFlags_set(9,0);
}//L8038A794
if(mapSpecificFlags_get(0xa)){
func_8038A460(this);
func_8028F94C(2, this->unk1C);
if(!mapSpecificFlags_get(3) && chmole_learnedAllSpiralMountainAbilities()){
mapSpecificFlags_set(3,1);
temp_a0 = 0xe12;
}else{
temp_a0 = 0xdf9;
}
gcdialog_showText(temp_a0, 0xe, this->unk1C, this->marker, func_8038A488, NULL);
mapSpecificFlags_set(0xa,0);
this->sm_4070.unk0 = 0;
}
}//L8038A828
player_getPosition(sp5C);
sp5C[0] = this->velocity_x;
sp5C[2] = this->velocity_z;
func_8028FAB0(sp5C);
if( func_8028EFC8()
&& sp44[FACE_BUTTON(BUTTON_B)] == 1
&& func_8028F20C()
){
if(this->sm_4070.unk0)
gcdialog_showText(temp_a0 = this->sm_4070.unk0, 0, NULL, NULL, NULL, NULL);
}
break;
case 3://L8038A8A0
marker_despawn(this->marker);
break;
}//L8038A8AC
}

View File

@@ -18,7 +18,7 @@ ActorInfo D_8038B0E0 = { 0x1F0, 0x3BD, 0, 0, NULL,
/* .code */
void func_8038A8C0(ActorMarker *arg0){
mapSpecificFlags_set(0x10, 0);
mapSpecificFlags_set(SM_SPECIFIC_FLAG_10, FALSE);
func_8028E6EC(2);
func_8028F918(0);
}
@@ -44,13 +44,13 @@ void func_8038A8F8(Actor *this){
if(sp2C < (f32) this->unkF4_8)
func_80388D48();
if( !mapSpecificFlags_get(0x10) && sp2C < (f32) this->unkF4_8 && 1780.0f < func_8028E82C()){
if( !mapSpecificFlags_get(2)
|| (mapSpecificFlags_get(3) && !mapSpecificFlags_get(0xf))
if( !mapSpecificFlags_get(SM_SPECIFIC_FLAG_10) && sp2C < (f32) this->unkF4_8 && 1780.0f < func_8028E82C()){
if( !mapSpecificFlags_get(SM_SPECIFIC_FLAG_2)
|| (mapSpecificFlags_get(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED) && !mapSpecificFlags_get(SM_SPECIFIC_FLAG_F))
){ //L8038AA54
this->yaw_ideal = ml_distance_vec3f(this->velocity, this->unk1C) / 150.0;
func_8028F3D8(this->unk1C, this->yaw_ideal, func_8038A8C0, this->marker);
mapSpecificFlags_set(0x10, 1);
mapSpecificFlags_set(SM_SPECIFIC_FLAG_10, TRUE);
}
}
}

View File

@@ -6,7 +6,7 @@ void SM_func_80386FE0(Actor *this);
/* .data */
ActorInfo D_8038ABF0 = {
0x134, 0x16E, 0,
MARKER_134_UNKNOWN, ACTOR_16E_UNKNOWN, NULL,
1, NULL,
SM_func_80386FE0, actor_update_func_80326224, func_80325340,
2000, 0, 0.0f, 0

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

@@ -92,7 +92,7 @@ f32 func_8024E420(s32 arg0, s32 arg1, s32 arg2) {
return phi_f2 *= arg0;
}
void func_8024E55C(s32 controller_index, s32 dst[6]){
void controller_copyFaceButtons(s32 controller_index, s32 dst[6]){
dst[FACE_BUTTON(BUTTON_A)] = D_80281138[controller_index].face_button[FACE_BUTTON(BUTTON_A)];
dst[FACE_BUTTON(BUTTON_B)] = D_80281138[controller_index].face_button[FACE_BUTTON(BUTTON_B)];
dst[FACE_BUTTON(BUTTON_C_LEFT)] = D_80281138[controller_index].face_button[FACE_BUTTON(BUTTON_C_LEFT)];

View File

@@ -333,7 +333,7 @@ void func_802C4C14(Actor *this){
}
else{//L802C4D24
func_8024E60C(0, sp74);
func_8024E55C(0, sp5C);
controller_copyFaceButtons(0, sp5C);
controller_getJoystick(0, &sp54);
switch(this->state){
case 2:

View File

@@ -7,8 +7,8 @@ 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 refresher_text;
s16 teach_text_id;
s16 refresher_text_id;
s8 camera_node;
s8 ability;
} ChMoleDescription;
@@ -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
@@ -224,13 +224,13 @@ int chmole_learnAbility(Actor *this){
// Known Ability: Refresher Dialog
if(ability_isUnlocked(moleTable[this->unkF4_8-9].ability)){
sp28 = 0xf;
sp2C = moleTable[this->unkF4_8-9].refresher_text;
sp2C = moleTable[this->unkF4_8-9].refresher_text_id;
}//L802D99EC
// New Ability: Learn Dialog & Misc Actions
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:
@@ -376,7 +376,7 @@ void chmole_update(Actor *this){
}
}
}//L802D9F34
func_8024E55C(0, sp50); // get face buttons press counters
controller_copyFaceButtons(0, sp50); // get face buttons press counters
switch(this->state){
case 1://L802D9F70
this->yaw_ideal = func_80329784(this);

View File

@@ -314,7 +314,7 @@ void chMumbo_update(Actor *this) {
&& func_8028F20C()
&& func_8028EFC8()
){
func_8024E55C(0, face_buttons);
controller_copyFaceButtons(0, face_buttons);
if(face_buttons[FACE_BUTTON(BUTTON_B)] == 1){
if (D_8037DDF0 == TRANSFORM_7_WISHWASHY) {
this->unk38_31 = 0;

View File

@@ -1013,7 +1013,7 @@ void func_802D5628(void){
D_8037DE08 -= time_getDelta();
}
else{//L802D5B24
func_8024E55C(0, sp50); //get button inputs
controller_copyFaceButtons(0, sp50); //get button inputs
if(sp50[FACE_BUTTON(BUTTON_B)] == 1){
func_80324C58();
func_802D6114();

View File

@@ -138,7 +138,7 @@ void func_802E35D8(void ) {
}
} else if (D_8037E8C0.unk14 == 3) {
sp38 = 0;
func_8024E55C(0, &sp40);
controller_copyFaceButtons(0, &sp40);
for(i = 0; i < 6; i++){
if (sp40[i] == 1) {
sp38++;

View File

@@ -506,7 +506,7 @@ void gcquiz_func_80319EA4(void) {
if(sD_803830E0 == NULL)
return;
func_8024E55C(0, face_button_states);
controller_copyFaceButtons(0, face_button_states);
controller_getJoystick(0, joystick_states);
for(phi_s0 = 0; phi_s0 < 4; phi_s0++){
gczoombox_update(sD_803830E0->zoomboxes[phi_s0]);

View File

@@ -6,7 +6,7 @@ void func_80363500(Actor *this);
/* .data */
ActorInfo D_80373DC0= {
0x1EE, ACTOR_3BA_UNKOWN, 0,
0x1EE, ACTOR_3BA_UNKNOWN, 0,
0, NULL,
func_80363500, actor_update_func_80326224, func_80325340,
0, 0, 0.0f, 0

View File

@@ -27,7 +27,7 @@ void func_80295448(void){
D_8037C310.unk0[0] = controller_getStartButton(0);
func_8024E60C(0, &D_8037C310.unk0[1]);
func_8024E6E0(0, &D_8037C310.unk0[4]);
func_8024E55C(0, &D_8037C310.unk0[8]);
controller_copyFaceButtons(0, &D_8037C310.unk0[8]);
for(i=0; i<0xE; i++){//L802954A8
D_8037C310.unk7E[i] = D_8037C310.unk70[i];
if(D_8037C310.unk70[i]){

View File

@@ -376,7 +376,7 @@ void gcdialog_update(void) {
func_8024E5A8(0, controller_face_buttons);
func_8024E640(0, controller_side_buttons);
} else {
func_8024E55C(0, controller_face_buttons);
controller_copyFaceButtons(0, controller_face_buttons);
func_8024E60C(0, controller_side_buttons);
}

View File

@@ -936,7 +936,7 @@ s32 gcPauseMenu_update(void) {
return 0;
}
func_8024E55C(0, face_button);
controller_copyFaceButtons(0, face_button);
controller_getJoystick(0, joystick);
func_8024E60C(0, sp60);
func_8024E6E0(0, sp50);

View File

@@ -881,7 +881,7 @@ void func_80316764(GcZoombox *this, s32 arg1) {
f32 pad0;
if (!this->unk1A4_10 ) {
func_8024E55C(0, sp38);
controller_copyFaceButtons(0, sp38);
func_8024E60C(0, sp2C);
phi_f0 = time_getDelta();
} else {
@@ -1067,7 +1067,7 @@ void gczoombox_update(GcZoombox *this){
return;
if( !this->unk1A4_10 ){
func_8024E55C(0, sp58);
controller_copyFaceButtons(0, sp58);
func_8024E60C(0, sp4C);
tmp_f0 = time_getDelta();
}

View File

@@ -120,7 +120,7 @@ void chBrentilda_update(Actor *this) {
func_8028E668(this->position, 280.0f, -40.0f, 160.0f);
this->yaw_ideal = (f32) func_80329784(this);
func_80328FB0(this, 3.0f);
func_8024E55C(0, sp78);
controller_copyFaceButtons(0, sp78);
player_getPosition(sp64);
temp_f0 = sp64[1] - this->position[1];
if ((temp_f0 > -100.0f) && (temp_f0 < 350.0f)) {

View File

@@ -1158,7 +1158,7 @@ void lair_func_8038E0B0(void) {
){
gcquiz_func_80319EA4();
func_8038C9D0();
func_8024E55C(0, sp48);
controller_copyFaceButtons(0, sp48);
func_8024E60C(0, sp3C);
if (D_8037DCB8->currFfMode < 3) {
player_getPosition(D_8037DCB8->playerPosition);

View File

@@ -468,7 +468,7 @@ void lair_func_8038F924(Actor *this) {
particleEmitter_emitN(sp54, 6);
}
}
func_8024E55C(0, sp7C);
controller_copyFaceButtons(0, sp7C);
func_8024E60C(0, sp6C);
func_8038EDBC(this);
switch(this->state){

View File

@@ -108,7 +108,7 @@ void func_803902B8(Actor *this) {
this->unk38_0 = sp58;
sp58 = ml_vec3f_within_distance(this->position, sp5C, 400.0f);
if (fileProgressFlag_get(sp54 + FILEPROG_AD_CHEATO_BLUEEGGS_UNLOCKED)) {
func_8024E55C(0, sp3C);
controller_copyFaceButtons(0, sp3C);
sp58 &= (sp3C[FACE_BUTTON(BUTTON_B)] == 1) || func_8028EC04();
}
if (sp58 && !*(s32 *)&this->local) {