From f0d53d6fcd6e0bce07efca23530a1e34a559158b Mon Sep 17 00:00:00 2001 From: Nabnut Date: Thu, 19 Sep 2024 12:31:59 +0200 Subject: [PATCH] Renaming Orange Pad --- include/enums.h | 2 +- src/MM/ch/chimpystump.c | 2 +- src/MM/ch/lmonkey.c | 68 +++++++++++++++++++----------------- src/MM/ch/orangepad.c | 77 +++++++++++++++++------------------------ 4 files changed, 71 insertions(+), 78 deletions(-) diff --git a/include/enums.h b/include/enums.h index 09ceaec9..f9b7a288 100644 --- a/include/enums.h +++ b/include/enums.h @@ -2291,7 +2291,7 @@ enum bs_e }; enum mm_specific_flags { - MM_SPECIFIC_FLAG_0_UNKNOWN, + MM_SPECIFIC_FLAG_0_CHIMPY_STUMP_RAISED, MM_SPECIFIC_FLAG_2_UNKNOWN = 0x2, MM_SPECIFIC_FLAG_3_UNKNOWN, diff --git a/src/MM/ch/chimpystump.c b/src/MM/ch/chimpystump.c index 6af64942..d2b2a29c 100644 --- a/src/MM/ch/chimpystump.c +++ b/src/MM/ch/chimpystump.c @@ -52,7 +52,7 @@ void chchimpystump_update(Actor *this) { switch (this->state) { case CHIMPY_STUMP_STATE_1_LOWERED: - if (mapSpecificFlags_get(MM_SPECIFIC_FLAG_0_UNKNOWN)) { + if (mapSpecificFlags_get(MM_SPECIFIC_FLAG_0_CHIMPY_STUMP_RAISED)) { subaddie_set_state(this, CHIMPY_STUMP_STATE_2_RAISING); } diff --git a/src/MM/ch/lmonkey.c b/src/MM/ch/lmonkey.c index 76784813..fd1a583d 100644 --- a/src/MM/ch/lmonkey.c +++ b/src/MM/ch/lmonkey.c @@ -6,7 +6,7 @@ void func_8028E668(f32 *, f32, f32, f32); int actor_animationIsAt(Actor *, f32); void subaddie_set_state_with_direction(Actor *, s32, f32, s32); void timed_exitStaticCamera(f32); -void func_80324E38(f32,s32); +void func_80324E38(f32, s32); void timed_setStaticCameraToNode(f32, s32); s32 func_8028F31C(f32 *, f32, s32, Actor **); void func_8028FA34(s32, Actor *); @@ -16,35 +16,38 @@ void chLMonkey_update(Actor *); /* .data */ ActorAnimationInfo chlmonkeyAnimations[5] = { - {0, 0.0f}, + {0, 0.0f}, {ASSET_5C_ANIM_CHIMPY_IDLE, 2.3f}, {ASSET_5B_ANIM_CHIMPY_JUMP, 0.67f}, {ASSET_5D_ANIM_CHIMPY_WALK, 0.5f}, {ASSET_5C_ANIM_CHIMPY_IDLE, 2.3f} }; -ActorInfo chlmonkeyInfo = { MARKER_A_CHIMPY, ACTOR_F_CHIMPY, ASSET_35D_MODEL_CHIMPY, +ActorInfo chlmonkeyInfo = { + MARKER_A_CHIMPY, ACTOR_F_CHIMPY, ASSET_35D_MODEL_CHIMPY, 1, chlmonkeyAnimations, NULL, chLMonkey_update, actor_draw, 2500, 0, 0.8f, 0 }; /* .code */ -void func_80388300(Actor **arg0){ +void func_80388300(Actor **arg0) { func_8028F31C((*arg0)->position, 800.0f, ACTOR_29_ORANGE_COLLECTIBLE, arg0); - if( func_80329530(*arg0, 345) + + if (func_80329530(*arg0, 345) && bacarry_get_markerId() == MARKER_36_ORANGE_COLLECTIBLE - && func_8028FC34() - ){ + && func_8028FC34()) { + func_8028FA34(0xc6, *arg0); (*arg0)->is_first_encounter = TRUE; timed_setStaticCameraToNode(1.2f, 0xF); func_80324E38(1.2f, 3); } - if(arg0); + + if (arg0); } -void __chLMonkey_playRandomNoise(Actor *this){ +void __chLMonkey_playRandomNoise(Actor *this) { f32 scaled_noise_volume; f32 random_noise; static sNoiseCooldown = 0; @@ -53,26 +56,26 @@ void __chLMonkey_playRandomNoise(Actor *this){ random_noise = randf(); sNoiseCooldown--; - if(sNoiseCooldown < 0){ - if(randf() < 0.2){ + if (sNoiseCooldown < 0) { + if (randf() < 0.2) { sNoiseCooldown = 6; - func_8030E6A4(((random_noise < 0.5) ? SFX_58_CHIMPY_NOISE_1 : SFX_59_CHIMPY_NOISE_2 ), randf()*0.25 + 0.85, scaled_noise_volume); + func_8030E6A4(((random_noise < 0.5) ? SFX_58_CHIMPY_NOISE_1 : SFX_59_CHIMPY_NOISE_2), randf() * 0.25 + 0.85, scaled_noise_volume); } } } -void __chLMonkey_spawnJiggy(s32 x, s32 y, s32 z){ +void __chLMonkey_spawnJiggy(s32 x, s32 y, s32 z) { f32 sp1C[3]; TUPLE_ASSIGN(sp1C, x, y, z); jiggy_spawn(JIGGY_9_MM_CHIMPY, sp1C); } -void __chLMonkey_complete(ActorMarker *marker, enum asset_e arg1, s32 arg2){ - Actor * actor = marker_getActor(marker); +void __chLMonkey_complete(ActorMarker *marker, enum asset_e arg1, s32 arg2) { + Actor *actor = marker_getActor(marker); mapSpecificFlags_set(MM_SPECIFIC_FLAG_4_SHAKE, TRUE); subaddie_set_state(actor, 3); timed_setStaticCameraToNode(2.3f, 0x12); - timedFunc_set_3(2.9f,__chLMonkey_spawnJiggy, actor->position_x, actor->position_y + 150.0f, actor->position_z); + timedFunc_set_3(2.9f, __chLMonkey_spawnJiggy, actor->position_x, actor->position_y + 150.0f, actor->position_z); timed_exitStaticCamera(4.3f); func_80324E38(4.3f, 0); } @@ -81,28 +84,31 @@ void chLMonkey_update(Actor *this){ func_8028E668(this->position, 35.0f, 0.0f, 65.0f); actor_collisionOff(this); this->marker->propPtr->unk8_3 = 1; - if(map_get() != MAP_2_MM_MUMBOS_MOUNTAIN){ + if (map_get() != MAP_2_MM_MUMBOS_MOUNTAIN) { func_80343DEC(this); - }else{//L80388630 - if(func_80329530(this, 700) && !func_803114B0()){ + } + else {//L80388630 + if (func_80329530(this, 700) && !func_803114B0()) { __chLMonkey_playRandomNoise(this); }//L8038865C - switch(this->state){ + switch (this->state) { case 1://L80388690 if (mapSpecificFlags_get(MM_SPECIFIC_FLAG_2_UNKNOWN)) { subaddie_set_state(this, 4); - if(!jiggyscore_isCollected(JIGGY_9_MM_CHIMPY)){ + if (!jiggyscore_isCollected(JIGGY_9_MM_CHIMPY)) { func_80311480(ASSET_B40_DIALOG_CHIMPY_COMPLETE, 0xE, this->position, this->marker, __chLMonkey_complete, NULL); - }else{//L803886E8 + } + else {//L803886E8 __chLMonkey_complete(this->marker, ASSET_B40_DIALOG_CHIMPY_COMPLETE, -1); }//L80388898 - }else{ + } + else { func_80388300(&this); - if( func_80329530(this, 345) + if (func_80329530(this, 345) && !func_80329530(this, 150) && !item_getCount(ITEM_19_ORANGE) && !this->is_first_encounter - ){ + ) { func_80311480(ASSET_B3F_DIALOG_CHIMPY_MEET, 0xe, this->position, NULL, NULL, NULL); this->is_first_encounter = TRUE; }//L80388774 @@ -113,8 +119,8 @@ void chLMonkey_update(Actor *this){ case 2: //L803887A4 func_80388300(&this); actor_playAnimationOnce(this); - if(actor_animationIsAt(this, 0.99f)){ - subaddie_set_state_with_direction(this,1,0.0f,-1); + if (actor_animationIsAt(this, 0.99f)) { + subaddie_set_state_with_direction(this, 1, 0.0f, -1); } break; case 4: //L803887E4 @@ -123,13 +129,13 @@ void chLMonkey_update(Actor *this){ case 3: //L803887F4 func_80343DEC(this); actor_loopAnimation(this); - if(0.19 <= this->unk48){ - mapSpecificFlags_set(MM_SPECIFIC_FLAG_0_UNKNOWN, TRUE); + if (0.19 <= this->unk48) { + mapSpecificFlags_set(MM_SPECIFIC_FLAG_0_CHIMPY_STUMP_RAISED, TRUE); } - if(0.24 <= this->unk48){ + if (0.24 <= this->unk48) { mapSpecificFlags_set(MM_SPECIFIC_FLAG_3_UNKNOWN, TRUE); } - if(0.99 <= this->unk48){ + if (0.99 <= this->unk48) { marker_despawn(this->marker); } break; diff --git a/src/MM/ch/orangepad.c b/src/MM/ch/orangepad.c index 24970234..5453d1e7 100644 --- a/src/MM/ch/orangepad.c +++ b/src/MM/ch/orangepad.c @@ -7,27 +7,25 @@ void func_80326224(Actor *); void func_80329904(ActorMarker *, s32, void *); extern void func_802EFA20(ParticleEmitter *, f32, f32); - /* public functions */ -void func_80386768(Actor *); +void chorangepad_update(Actor *); /* .data */ -ActorInfo chorangepadInfo = { MARKER_66_ORANGE_PAD, ACTOR_57_ORANGE_PAD, ASSET_2EB_MODEL_ORANGE_PAD, +ActorInfo chorangepadInfo = { + MARKER_66_ORANGE_PAD, ACTOR_57_ORANGE_PAD, ASSET_2EB_MODEL_ORANGE_PAD, 0, NULL, - func_80386768, func_80326224, actor_draw, + chorangepad_update, func_80326224, actor_draw, 0, 0, 0.0f, 0 }; /*.code */ -void MM_func_803863F0(s32 x, s32 y, s32 z){ +void __chorangepad_spawnJiggy(s32 x, s32 y, s32 z) { f32 pos[3]; - TUPLE_ASSIGN(pos, x, y, z); - jiggy_spawn(JIGGY_8_MM_ORANGE_PADS, pos); } -void func_80386444(ActorMarker *marker){ +void func_80386444(ActorMarker *marker) { f32 distance_to_orange_pad; Actor *closest_orange_pad; f32 position[3]; @@ -39,24 +37,24 @@ void func_80386444(ActorMarker *marker){ position[2] = marker->propPtr->z; closest_orange_pad = actorArray_findClosestActorFromActorId(position, ACTOR_57_ORANGE_PAD, 1, &distance_to_orange_pad); - - if(closest_orange_pad && !(500.0f < distance_to_orange_pad)){ + if (closest_orange_pad && !(500.0f < distance_to_orange_pad)) { closest_orange_pad->state = 1; - if(actorArray_findClosestActorFromActorId(position, ACTOR_57_ORANGE_PAD, 1, &distance_to_orange_pad)){ + if (actorArray_findClosestActorFromActorId(position, ACTOR_57_ORANGE_PAD, 1, &distance_to_orange_pad)) { func_8025A6EC(COMUSIC_2B_DING_B, 22000); - }else{ + } + else { temp_a0 = (closest_orange_pad->unk78_13 == 0x106) ? 0x10 : (closest_orange_pad->unk78_13 == 0x76) ? 0xf : 0xe; func_802BAFE4(temp_a0); position[1] += 50.0f; - timedFunc_set_3(0.6f, (GenFunction_3) MM_func_803863F0, (s32)position[0], (s32)position[1], (s32)position[2]); + timedFunc_set_3(0.6f, (GenFunction_3) __chorangepad_spawnJiggy, (s32) position[0], (s32) position[1], (s32) position[2]); func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7FFF); - if(!jiggyscore_isCollected(JIGGY_8_MM_ORANGE_PADS)){ + if (!jiggyscore_isCollected(JIGGY_8_MM_ORANGE_PADS)) { func_80311480(0xB3B, 4, NULL, NULL, NULL, NULL); } }// L803865D8 @@ -67,21 +65,9 @@ void func_80386444(ActorMarker *marker){ particleEmitter_setModel(p_ctrl, 0x89f); particleEmitter_setStartingScaleRange(p_ctrl, 0.09f, 0.19f); particleEmitter_setFinalScaleRange(p_ctrl, 0.0f, 0.0f); - - particleEmitter_setParticleVelocityRange(p_ctrl, - -200.0f, 500.0f, -200.0f, - 200.0f, 700.0f, 200.0f - ); - - particleEmitter_setParticleAccelerationRange(p_ctrl, - 0.0f, -1200.0f, 0.0f, - 0.0f, -1200.0f, 0.0f - ); - - particleEmitter_setAngularVelocityRange(p_ctrl, - -600.0f, -600.0f, -600.0f, - 600.0f, 600.0f, 600.0f - ); + particleEmitter_setParticleVelocityRange(p_ctrl, -200.0f, 500.0f, -200.0f, 200.0f, 700.0f, 200.0f); + particleEmitter_setParticleAccelerationRange(p_ctrl, 0.0f, -1200.0f, 0.0f, 0.0f, -1200.0f, 0.0f); + particleEmitter_setAngularVelocityRange(p_ctrl, -600.0f, -600.0f, -600.0f, 600.0f, 600.0f, 600.0f); particleEmitter_setSpawnIntervalRange(p_ctrl, 0.0f, 0.01f); particleEmitter_setParticleLifeTimeRange(p_ctrl, 4.0f, 4.0f); func_802EF9F8(p_ctrl, 0.01f); @@ -95,49 +81,50 @@ void func_80386744(s32 arg0, ActorMarker *arg1) { func_80386444(arg1); } -void func_80386768(Actor * this){ +void chorangepad_update(Actor *this) { Actor *closest_actor; f32 unused; f32 min_distance; - - if(!this->initialized){ + if (!this->initialized) { this->marker->propPtr->unk8_3 = 1; actor_collisionOff(this); this->initialized = TRUE; }//L803867B0 - if(!this->volatile_initialized){ - this->unk100 = actorArray_findClosestActorFromActorId(this->position, 8,-1, &min_distance)->marker; + if (!this->volatile_initialized) { + this->unk100 = actorArray_findClosestActorFromActorId(this->position, 8, -1, &min_distance)->marker; this->volatile_initialized = TRUE; }//L803867E0 - if(this->unk100){ + if (this->unk100) { closest_actor = marker_getActor(this->unk100); } - if( func_80329530(this, 0x28) - && !func_8028ECAC() - && !mapSpecificFlags_get(MM_SPECIFIC_FLAG_6_UNKNOWN) - && closest_actor->state != 3 - ){ + if (func_80329530(this, 0x28) && + !func_8028ECAC() && + !mapSpecificFlags_get(MM_SPECIFIC_FLAG_6_UNKNOWN) && + closest_actor->state != 3) { + if (func_80311480(0xb3d, 0, NULL, NULL, NULL, NULL)) { mapSpecificFlags_set(MM_SPECIFIC_FLAG_6_UNKNOWN, TRUE); } } - if(this->state == 1){ - if(this->lifetime_value < 72.0f){ + if (this->state == 1) { + if (this->lifetime_value < 72.0f) { func_8033E73C(this->marker, 5, func_80329904); func_8033E3F0(9, this->marker->unk14_21); } + this->lifetime_value = MIN(255.0, this->lifetime_value + 7.0); - if(255.0 == this->lifetime_value){ + if (255.0 == this->lifetime_value) { marker_despawn(this->marker); } - }else{ + } + else { }//L80386928 - actor_setOpacity(this, 0xFF - (s32)this->lifetime_value); + actor_setOpacity(this, 0xFF - (s32) this->lifetime_value); }//*/