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

@ -2292,9 +2292,9 @@ enum bs_e
enum mm_specific_flags {
MM_SPECIFIC_FLAG_0_CHIMPY_STUMP_RAISED,
MM_SPECIFIC_FLAG_2_UNKNOWN = 0x2,
MM_SPECIFIC_FLAG_3_UNKNOWN,
MM_SPECIFIC_FLAG_1_ORANGE_HAS_BEEN_COLLECTED,
MM_SPECIFIC_FLAG_2_ORANGE_HAS_BEEN_RETURNED,
MM_SPECIFIC_FLAG_3_CHIMPY_HAS_LEAVED,
MM_SPECIFIC_FLAG_4_SHAKE,
MM_SPECIFIC_FLAG_6_UNKNOWN = 0x6,

View File

@ -432,7 +432,7 @@ void subaddie_set_state(Actor *, u32);
ActorMarker *func_8032B16C(enum jiggy_e jiggy_id);
int subaddie_maybe_set_state(Actor *, s32, f32);
void subaddie_set_state_with_direction(Actor * this, s32 myAnimId, f32 arg2, s32 direction);
int subaddie_maybe_set_state_position_direction(Actor *, s32, f32, s32, f32 );
bool subaddie_maybe_set_state_position_direction(Actor *, s32, f32, s32, f32 );
void func_80328CEC(Actor *, s32, s32, s32);
void func_80328FB0(Actor *, f32);
int func_80329030(Actor *, s32);

View File

@ -271,7 +271,7 @@ void CCW_func_80389BFC(Actor *this) {
}
if ((local->unk0->map_id != MAP_43_CCW_SPRING) && ((this->position[0] + 500.0f) < sp4C[0])) {
func_8028F364(this->position, 1110.0f, 200.0f, ACTOR_2A2_CATERPILLAR, &this);
if ((local->unk0->unkE != 0) && (carriedObj_getActorId() == ACTOR_2A2_CATERPILLAR) && (ml_distance_vec3f(this->position, sp4C) < 1010.0f) && (func_8028FC34() != 0)) {
if ((local->unk0->unkE != 0) && (carriedObj_getActorId() == ACTOR_2A2_CATERPILLAR) && (ml_distance_vec3f(this->position, sp4C) < 1010.0f) && (player_throwCarriedObject() != 0)) {
func_8028FA54(D_8038FDE0);
if ((local->unk0->map_id == MAP_44_CCW_SUMMER) && (local->unk4 == 0)) {
gcdialog_showText(0xCD8, 4, NULL, NULL, NULL, NULL);

View File

@ -143,7 +143,7 @@ void chnabnut_update(Actor *this) {
}
if (this->is_first_encounter && !func_803114B0()) {
func_8028F364(this->position, 500.0f, 200.0f, ACTOR_2A9_ACORN, &this);
if ((carriedObj_getActorId() == ACTOR_2A9_ACORN) && (ml_distance_vec3f(this->position, sp30) < 300.0f) && func_8028FC34()) {
if ((carriedObj_getActorId() == ACTOR_2A9_ACORN) && (ml_distance_vec3f(this->position, sp30) < 300.0f) && player_throwCarriedObject()) {
func_8028FA54(D_8038F350);
local->returned_acorn_count++;
if (local->returned_acorn_count == 6) {

View File

@ -3,7 +3,7 @@
#include "variables.h"
extern void func_8028E668(f32[3], f32, f32, f32);
extern s32 func_8028F31C(f32[3], f32, s32, Actor **);
extern s32 player_setCarryObjectPoseInHorizontalRadius(f32[3], f32, s32, Actor **);
typedef struct {
s32 unk0;
@ -48,11 +48,19 @@ Struct_FP_3E00 D_80391E80[] ={
/* .code */
void func_8038A1F0(Actor **this_ptr, enum marker_e carried_obj_marker_id, enum actor_e actor_id, enum actor_e arg3){
func_8028F31C((*this_ptr)->position, 600.0f, actor_id, this_ptr);
player_setCarryObjectPoseInHorizontalRadius((*this_ptr)->position, 600.0f, actor_id, this_ptr);
if(!func_80329530(*this_ptr, 400)) return;
if(bacarry_get_markerId() != carried_obj_marker_id) return;
if(!func_8028FC34()) return;
if (!func_80329530(*this_ptr, 400)) {
return;
}
if (bacarry_get_markerId() != carried_obj_marker_id) {
return;
}
if (!player_throwCarriedObject()) {
return;
}
func_8028FA34(arg3, *this_ptr);
}

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);
}

View File

@ -7,7 +7,7 @@
//external
f32 mapModel_getFloorY(f32*);
void func_802C4218(s32, f32, f32, f32);
void func_803252D0(f32, s32);
void timed_mapSpecificFlags_setTrue(f32, s32);
void subaddie_set_state_with_direction(Actor *, s32, f32, s32);
//typedefs
@ -205,7 +205,7 @@ void func_80387C28(Actor * this){
func_802CA1CC(HONEYCOMB_17_SM_COLIWOBBLE);
__spawnQueue_add_4((GenFunction_4)func_802C4218, 0x1f, reinterpret_cast(s32, this->position_x), reinterpret_cast(s32, this->position_y), reinterpret_cast(s32, this->position_z));
}//L80387D64
func_803252D0(1.5f, 7);
timed_mapSpecificFlags_setTrue(1.5f, 7);
actor_collisionOff(this);
if(local->unkC != 3){
subaddie_set_state_with_direction(this, 3, 0.0f, 1);

View File

@ -114,7 +114,7 @@ void func_80387774(Actor **this_ptr){
func_8028F364(local->throw_target_position, local->throw_target_radius, 100.0f, ACTOR_2A_GOLD_BULLION, this_ptr);
if( func_80329530(*this_ptr, 200)
&& bacarry_get_markerId() == MARKER_37_GOLD_BULLION
&& func_8028FC34()
&& player_throwCarriedObject()
){
func_8028FA34(!mapSpecificFlags_get(0)? 0x149 : 0x14a, *this_ptr);
(*this_ptr)->is_first_encounter = TRUE;

View File

@ -6,7 +6,7 @@ extern void func_8028F7D4(f32, f32);
void chLevelCollectible_update(Actor *this);
extern void func_80329904(ActorMarker *, s32, f32*);
extern ActorMarker *func_8028E86C(void);
extern void func_803252D0(f32, s32);
extern void timed_mapSpecificFlags_setTrue(f32, s32);
extern void func_8035646C(s32);
ActorAnimationInfo D_80367B50[] = {
@ -107,8 +107,10 @@ void __chLevelCollectible_collide(ActorMarker *marker, ActorMarker *other_marker
sp18[2] = this->position[2];
switch (marker->id) {
case MARKER_36_ORANGE_COLLECTIBLE:
if (mapSpecificFlags_get(1))
if (mapSpecificFlags_get(MM_SPECIFIC_FLAG_1_ORANGE_HAS_BEEN_COLLECTED)) {
return;
}
func_8035646C(FILEPROG_8_ORANGE_TEXT);
func_8030E6D4(SFX_B3_ORANGE_TALKING);
dialog_id = 0;
@ -234,7 +236,7 @@ void __chLevelCollectible_returnObj(Actor *this) {
case MARKER_37_GOLD_BULLION:
break;
case MARKER_36_ORANGE_COLLECTIBLE:
func_803252D0(1.7f, 2);
timed_mapSpecificFlags_setTrue(1.7f, MM_SPECIFIC_FLAG_2_ORANGE_HAS_BEEN_RETURNED);
func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7FFF);
break;
case MARKER_1FD_BLUE_PRESENT_COLLECTIBLE:
@ -363,7 +365,7 @@ void chLevelCollectible_update(Actor *this){
func_802D83EC(this);
break;
case MARKER_36_ORANGE_COLLECTIBLE: //L802D86DC
if(mapSpecificFlags_get(3) && map_get() == MAP_2_MM_MUMBOS_MOUNTAIN){
if (mapSpecificFlags_get(MM_SPECIFIC_FLAG_3_CHIMPY_HAS_LEAVED) && map_get() == MAP_2_MM_MUMBOS_MOUNTAIN) {
marker_despawn(this->marker);
}
break;

View File

@ -89,7 +89,7 @@ enum hitbox_e hitbox_getHitboxForActor(ActorMarker *arg0){
}
// break ?? //
bool func_8028DD60(enum actor_e actor_id, Actor **arg1){
bool player_setCarryObjectPose(enum actor_e actor_id, Actor **arg1){
ActorMarker *m1;
ActorMarker *m2;
Actor *actor;

View File

@ -660,9 +660,9 @@ bool func_8028F2FC(void){
}
//sets carry actor if player is within a horizantal radius around a point
bool func_8028F31C(f32 position[3], f32 radius, enum actor_e actor_id, Actor **arg3){
if(player_isInHorizontalRadius(position, radius)){
return func_8028DD60(actor_id, arg3);
bool player_setCarryObjectPoseInHorizontalRadius(f32 position[3], f32 radius, enum actor_e actor_id, Actor **arg3){
if (player_isInHorizontalRadius(position, radius)) {
return player_setCarryObjectPose(actor_id, arg3);
}
return FALSE;
}
@ -670,7 +670,7 @@ bool func_8028F31C(f32 position[3], f32 radius, enum actor_e actor_id, Actor **a
//sets carry actor if player is within a cylinder around a point
bool func_8028F364(f32 position[3], f32 radius, f32 vert_range, enum actor_e actor_id, Actor **arg4) {
if (player_isInVerticalRange(position, vert_range)) {
return func_8028F31C(position, radius, actor_id, arg4);
return player_setCarryObjectPoseInHorizontalRadius(position, radius, actor_id, arg4);
}
return FALSE;
}
@ -933,9 +933,11 @@ bool func_8028FBD4(f32 arg0[3]) {
return bs_checkInterrupt(BS_INTR_8) == 2;
}
bool func_8028FC34(void){
if (func_8028E86C() && bscarry_inSet(bs_getState()))
bool player_throwCarriedObject(void){
if (func_8028E86C() && bscarry_inSet(bs_getState())) {
return bs_checkInterrupt(BS_INTR_16_THROW_CARRIED_OBJ) == 2;
}
return FALSE;
}

View File

@ -1318,15 +1318,15 @@ void subaddie_set_state_with_direction(Actor * this, s32 myAnimId, f32 arg2, s32
func_803289EC(this, arg2, direction);
}
int subaddie_maybe_set_state_position_direction(Actor * this, s32 myAnimId, f32 start_position, s32 direction, f32 probability){
if(randf() < probability){
if(__subaddie_set_state(this, myAnimId) && this->animctrl){
bool subaddie_maybe_set_state_position_direction(Actor *this, s32 myAnimId, f32 start_position, s32 direction, f32 probability) {
if (randf() < probability) {
if (__subaddie_set_state(this, myAnimId) && this->animctrl) {
func_803285E8(this, start_position, direction);
animctrl_start(this->animctrl, "subaddie.c", 0x705);
}
return 1;
return TRUE;
}
return 0;
return FALSE;
}
void subaddie_set_ideal_yaw(Actor * this, int arg1){

View File

@ -135,17 +135,20 @@ void func_80324AEC(DelayedTextCallback *arg0) {
}
void func_80324BA0(s32 arg0){
if(arg0 == 1)
if (arg0 == 1) {
func_8028F918(1);
else if(arg0 == 2)
}
else if (arg0 == 2) {
func_8028F918(3);
else if(arg0 == 3)
}
else if (arg0 == 3) {
func_8028F918(2);
else{
if(arg0 == 0)
func_8028F918(0);
else if (arg0 == 4)
func_802D6114();
}
else if (arg0 == 0) {
func_8028F918(0);
}
else if (arg0 == 4) {
func_802D6114();
}
}
@ -319,10 +322,10 @@ void timedFuncQueue_defrag(void){
D_80383380.ptr = vector_defrag(D_80383380.ptr);
}
void func_803252B0(s32 arg0){
mapSpecificFlags_set(arg0, 1);
void mapSpecificFlags_setTrue(s32 flag){
mapSpecificFlags_set(flag, TRUE);
}
void func_803252D0(f32 time, s32 arg0){
timedFunc_set_1(time, func_803252B0, arg0);
void timed_mapSpecificFlags_setTrue(f32 time, s32 flag){
timedFunc_set_1(time, mapSpecificFlags_setTrue, flag);
}