Renaming LMonkey

This commit is contained in:
Nabnut
2024-09-19 12:32:08 +02:00
parent 6cf31d1df0
commit 3127ba4a68
13 changed files with 123 additions and 87 deletions

View File

@@ -2,19 +2,28 @@
#include "functions.h"
#include "variables.h"
/* external function declarations */
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 timed_setStaticCameraToNode(f32, s32);
s32 func_8028F31C(f32 *, f32, s32, Actor **);
s32 player_setCarryObjectPoseInHorizontalRadius(f32 *, f32, s32, Actor **);
void func_8028FA34(s32, Actor *);
void chLMonkey_update(Actor *);
/* public function declarations */
void chlmonkey_update(Actor *);
/* .data */
enum chlmonkey_state_e {
LMONKEY_STATE_1_IDLE = 1,
LMONKEY_STATE_2_JUMPING,
LMONKEY_STATE_3_WALKING,
LMONKEY_STATE_4_LEAVING
};
ActorAnimationInfo chlmonkeyAnimations[5] = {
{0, 0.0f},
{ASSET_5C_ANIM_CHIMPY_IDLE, 2.3f},
@@ -26,28 +35,28 @@ ActorAnimationInfo chlmonkeyAnimations[5] = {
ActorInfo chlmonkeyInfo = {
MARKER_A_CHIMPY, ACTOR_F_CHIMPY, ASSET_35D_MODEL_CHIMPY,
1, chlmonkeyAnimations,
NULL, chLMonkey_update, actor_draw,
NULL, chlmonkey_update, actor_draw,
2500, 0, 0.8f, 0
};
/* .code */
void func_80388300(Actor **arg0) {
func_8028F31C((*arg0)->position, 800.0f, ACTOR_29_ORANGE_COLLECTIBLE, arg0);
void __chlmonkey_updateBringOrange(Actor **this_ptr) {
player_setCarryObjectPoseInHorizontalRadius((*this_ptr)->position, 800.0f, ACTOR_29_ORANGE_COLLECTIBLE, this_ptr);
if (func_80329530(*arg0, 345)
&& bacarry_get_markerId() == MARKER_36_ORANGE_COLLECTIBLE
&& func_8028FC34()) {
if (func_80329530(*this_ptr, 345) &&
bacarry_get_markerId() == MARKER_36_ORANGE_COLLECTIBLE &&
player_throwCarriedObject()) {
func_8028FA34(0xc6, *arg0);
(*arg0)->is_first_encounter = TRUE;
func_8028FA34(0xc6, *this_ptr);
(*this_ptr)->is_first_encounter = TRUE;
timed_setStaticCameraToNode(1.2f, 0xF);
func_80324E38(1.2f, 3);
}
if (arg0);
if (this_ptr);
}
void __chLMonkey_playRandomNoise(Actor *this) {
void __chlmonkey_playRandomNoise(Actor *this) {
f32 scaled_noise_volume;
f32 random_noise;
static sNoiseCooldown = 0;
@@ -56,85 +65,97 @@ void __chLMonkey_playRandomNoise(Actor *this) {
random_noise = randf();
sNoiseCooldown--;
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);
}
if (sNoiseCooldown < 0 && 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);
}
}
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_spawnJiggy(s32 x, s32 y, s32 z) {
f32 pos[3];
TUPLE_ASSIGN(pos, x, y, z)
jiggy_spawn(JIGGY_9_MM_CHIMPY, pos);
}
void __chLMonkey_complete(ActorMarker *marker, enum asset_e arg1, s32 arg2) {
void __chlmonkey_complete(ActorMarker *marker, enum asset_e unused_1, s32 unused_2) {
Actor *actor = marker_getActor(marker);
mapSpecificFlags_set(MM_SPECIFIC_FLAG_4_SHAKE, TRUE);
subaddie_set_state(actor, 3);
subaddie_set_state(actor, LMONKEY_STATE_3_WALKING);
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);
}
void chLMonkey_update(Actor *this){
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) {
func_80343DEC(this);
}
else {//L80388630
if (func_80329530(this, 700) && !func_803114B0()) {
__chLMonkey_playRandomNoise(this);
__chlmonkey_playRandomNoise(this);
}//L8038865C
switch (this->state) {
case 1://L80388690
if (mapSpecificFlags_get(MM_SPECIFIC_FLAG_2_UNKNOWN)) {
subaddie_set_state(this, 4);
case LMONKEY_STATE_1_IDLE://L80388690
if (mapSpecificFlags_get(MM_SPECIFIC_FLAG_2_ORANGE_HAS_BEEN_RETURNED)) {
subaddie_set_state(this, LMONKEY_STATE_4_LEAVING);
if (!jiggyscore_isCollected(JIGGY_9_MM_CHIMPY)) {
gcdialog_showText(ASSET_B40_DIALOG_CHIMPY_COMPLETE, 0xE, this->position, this->marker, __chLMonkey_complete, NULL);
gcdialog_showText(ASSET_B40_DIALOG_CHIMPY_COMPLETE, 0xE, this->position, this->marker, __chlmonkey_complete, NULL);
}
else {//L803886E8
__chLMonkey_complete(this->marker, ASSET_B40_DIALOG_CHIMPY_COMPLETE, -1);
__chlmonkey_complete(this->marker, ASSET_B40_DIALOG_CHIMPY_COMPLETE, -1);
}//L80388898
}
else {
func_80388300(&this);
if (func_80329530(this, 345)
&& !func_80329530(this, 150)
&& !item_getCount(ITEM_19_ORANGE)
&& !this->is_first_encounter
) {
__chlmonkey_updateBringOrange(&this);
if (func_80329530(this, 345) &&
!func_80329530(this, 150) &&
!item_getCount(ITEM_19_ORANGE) &&
!this->is_first_encounter) {
gcdialog_showText(ASSET_B3F_DIALOG_CHIMPY_MEET, 0xe, this->position, NULL, NULL, NULL);
this->is_first_encounter = TRUE;
}//L80388774
actor_loopAnimation(this);
subaddie_maybe_set_state_position_direction(this, 2, 0.0f, -1, 0.02f);
subaddie_maybe_set_state_position_direction(this, LMONKEY_STATE_2_JUMPING, 0.0f, -1, 0.02f);
}
break;
case 2: //L803887A4
func_80388300(&this);
case LMONKEY_STATE_2_JUMPING: //L803887A4
__chlmonkey_updateBringOrange(&this);
actor_playAnimationOnce(this);
if (actor_animationIsAt(this, 0.99f)) {
subaddie_set_state_with_direction(this, 1, 0.0f, -1);
subaddie_set_state_with_direction(this, LMONKEY_STATE_1_IDLE, 0.0f, -1);
}
break;
case 4: //L803887E4
case LMONKEY_STATE_4_LEAVING: //L803887E4
actor_loopAnimation(this);
break;
case 3: //L803887F4
case LMONKEY_STATE_3_WALKING: //L803887F4
func_80343DEC(this);
actor_loopAnimation(this);
if (0.19 <= this->unk48) {
mapSpecificFlags_set(MM_SPECIFIC_FLAG_0_CHIMPY_STUMP_RAISED, TRUE);
}
if (0.24 <= this->unk48) {
mapSpecificFlags_set(MM_SPECIFIC_FLAG_3_UNKNOWN, TRUE);
mapSpecificFlags_set(MM_SPECIFIC_FLAG_3_CHIMPY_HAS_LEAVED, TRUE);
}
if (0.99 <= this->unk48) {
marker_despawn(this->marker);
}