From 19b01cf810701a417ee02e26150cede780935dc0 Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Wed, 27 Jul 2022 19:34:05 -0500 Subject: [PATCH] code_9E370.c progress --- include/functions.h | 2 +- progress/progress_core2.svg | 4 +- progress/progress_total.svg | 4 +- src/CCW/code_7BF0.c | 2 +- src/FP/ch/wozzasjig.c | 2 +- src/FP/code_2350.c | 2 +- src/FP/code_8E20.c | 2 +- src/FP/code_ABD0.c | 2 +- src/GV/code_3D90.c | 2 +- src/GV/code_43B0.c | 4 +- src/GV/code_4740.c | 2 +- src/GV/code_5570.c | 4 +- src/SM/code_2990.c | 4 +- src/TTC/ch/lockup.c | 2 +- src/core2/ch/beehive.c | 2 +- src/core2/ch/code_5AB30.c | 2 +- src/core2/ch/firefx.c | 2 +- src/core2/ch/icecube.c | 2 +- src/core2/ch/mole.c | 6 +-- src/core2/code_45310.c | 2 +- src/core2/code_47BD0.c | 6 +-- src/core2/code_9E370.c | 70 +++++++++++++++++++++++++++++------ src/core2/code_D0CA0.c | 2 +- src/lair/code_42A0.c | 4 +- src/lair/code_AD70.c | 2 +- symbol_addrs.core2.us.v10.txt | 5 ++- 26 files changed, 95 insertions(+), 48 deletions(-) diff --git a/include/functions.h b/include/functions.h index a5d832e4..694dfda1 100644 --- a/include/functions.h +++ b/include/functions.h @@ -520,7 +520,7 @@ void player_setYPosition(f32); NodeProp *func_80304C38(enum actor_e arg0, Actor *arg1); NodeProp *func_80304CAC(s32 arg0, f32 position[3]); Actor *func_80326D68(f32 position[3], enum actor_e actor_id, s32 arg2, f32 *min_distance_ptr); -Actor *func_80329980(Actor *); +Actor *subaddie_getLinkedActor(Actor *); /* used in RBB */ void ml_vec3f_pitch_rotate_copy(f32 dst[3], f32 src[3], f32 pitch); diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index 49d37720..3f93d712 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -17,7 +17,7 @@ core2 - 74.5205% - 74.5205% + 74.5839% + 74.5839% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 859ef43e..a1e80ca4 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 80.1729% - 80.1729% + 80.2093% + 80.2093% \ No newline at end of file diff --git a/src/CCW/code_7BF0.c b/src/CCW/code_7BF0.c index 68dec012..9f4ad745 100644 --- a/src/CCW/code_7BF0.c +++ b/src/CCW/code_7BF0.c @@ -53,7 +53,7 @@ void func_8038E0C8(Actor *this) { sp34 = time_getDelta(); - if(!actor_playerIsWithinDist(this, 3000)) return; + if(!subaddie_playerIsWithinSphere(this, 3000)) return; if (!this->unk16C_4) { this->unk16C_4 = TRUE; diff --git a/src/FP/ch/wozzasjig.c b/src/FP/ch/wozzasjig.c index 17ff4cef..a57c88b3 100644 --- a/src/FP/ch/wozzasjig.c +++ b/src/FP/ch/wozzasjig.c @@ -30,7 +30,7 @@ void func_8038FF54(Actor *this){ ParticleEmitter *sp3C; if( func_8038BFA0() ) return; - if( !actor_playerIsWithinDist(this, 4500) ) return; + if( !subaddie_playerIsWithinSphere(this, 4500) ) return; this->marker->propPtr->unk8_3 = FALSE; actor_collisionOff(this); diff --git a/src/FP/code_2350.c b/src/FP/code_2350.c index c212949e..54900db0 100644 --- a/src/FP/code_2350.c +++ b/src/FP/code_2350.c @@ -577,7 +577,7 @@ void func_803896FC(Actor *this){ case 11:// L80389F20 func_803890DC(this, local->unk19); - if(!actor_playerIsWithinDist(this, 2000) + if(!subaddie_playerIsWithinSphere(this, 2000) && !this->marker->unk14_21 ){ switch(local->unk19){ diff --git a/src/FP/code_8E20.c b/src/FP/code_8E20.c index 043dbe66..54d26b92 100644 --- a/src/FP/code_8E20.c +++ b/src/FP/code_8E20.c @@ -195,7 +195,7 @@ void func_8038F7AC(Actor *this){ } }//L8038F910 - if(func_8038BFA0() || this->unk38_31 || !actor_playerIsWithinDist(this, 3000)){ + if(func_8038BFA0() || this->unk38_31 || !subaddie_playerIsWithinSphere(this, 3000)){ actor_collisionOff(this); return; } diff --git a/src/FP/code_ABD0.c b/src/FP/code_ABD0.c index 047533a8..3ace32af 100644 --- a/src/FP/code_ABD0.c +++ b/src/FP/code_ABD0.c @@ -127,7 +127,7 @@ void func_80391180(Actor *this){ this->unk58_0 = func_8038DD14() ? 0 : 1; if(this->marker->unk14_20 == 0x21F){ - this->marker->unk40_22 = actor_playerIsWithinDist(this, 2000) ? 1 : 0; + this->marker->unk40_22 = subaddie_playerIsWithinSphere(this, 2000) ? 1 : 0; } } diff --git a/src/GV/code_3D90.c b/src/GV/code_3D90.c index 52c42b36..0dd7c77d 100644 --- a/src/GV/code_3D90.c +++ b/src/GV/code_3D90.c @@ -75,7 +75,7 @@ void func_8038A31C(Actor *this){ } if(this->unk100) - sp24 = func_80329980(this); + sp24 = subaddie_getLinkedActor(this); this->unk1C[1] = this->unk48; ; diff --git a/src/GV/code_43B0.c b/src/GV/code_43B0.c index c5fd3d01..ef94b0f5 100644 --- a/src/GV/code_43B0.c +++ b/src/GV/code_43B0.c @@ -85,14 +85,14 @@ void func_8038A9C0(Actor *this){ this->marker->propPtr->unk8_3 = TRUE; actor_collisionOff(this); func_802C3C88((GenMethod_1)func_8038A8CC, (s32)this->marker); - sp24 = func_80329980(this); + sp24 = subaddie_getLinkedActor(this); this->unk1C[1] = this->unk48; this->pitch = 0.0f; this->yaw = 90.0f; } if(this->unk100) - sp24 = func_80329980(this); + sp24 = subaddie_getLinkedActor(this); if(this->velocity_y != 0.0f){ func_80343DEC(this); diff --git a/src/GV/code_4740.c b/src/GV/code_4740.c index 7ec147f5..8b4923e3 100644 --- a/src/GV/code_4740.c +++ b/src/GV/code_4740.c @@ -174,7 +174,7 @@ void func_8038B124(Actor *this){ } }//L8038B25C - if(!actor_playerIsWithinDist(this, 4500)) return; + if(!subaddie_playerIsWithinSphere(this, 4500)) return; this->unk58_0 = TRUE; switch(this->state){ diff --git a/src/GV/code_5570.c b/src/GV/code_5570.c index 5b234675..4d37e7af 100644 --- a/src/GV/code_5570.c +++ b/src/GV/code_5570.c @@ -185,7 +185,7 @@ void func_8038BEA0(Actor *this){ this->marker->propPtr->unk8_3 = FALSE; }//L8038BFF4 - if(actor_playerIsWithinDist(this, 4000) || this->state == 5){ + if(subaddie_playerIsWithinSphere(this, 4000) || this->state == 5){ this->unk58_0 = TRUE; this->marker->propPtr->unk8_3 = TRUE; switch(this->state){ @@ -304,7 +304,7 @@ void func_8038BEA0(Actor *this){ }//L8038C528 if(this->unk100 && this->unk100->unk5C == local->unk0){ Actor *tmp_v0; - tmp_v0 = func_80329980(this); + tmp_v0 = subaddie_getLinkedActor(this); if(this->marker->unk14_21){ func_8034A174(this->marker->unk44, 5, tmp_v0->position); } diff --git a/src/SM/code_2990.c b/src/SM/code_2990.c index b8c65257..731b917f 100644 --- a/src/SM/code_2990.c +++ b/src/SM/code_2990.c @@ -123,7 +123,7 @@ void func_80388FA0(Actor *this, s32 arg1){ switch(arg1){ case 4: - other = func_80329980(this); + other = subaddie_getLinkedActor(this); myOther = this->unk100; if(myOther && other && myOther->unk14_20 == 0xB8) func_80328B8C(other, 3, 0.0001f, 1); @@ -147,7 +147,7 @@ void func_80388FA0(Actor *this, s32 arg1){ actor_loopAnimation(this); break; case 2: - other = func_80329980(this); + other = subaddie_getLinkedActor(this); myOther = this->unk100; if(myOther && other && myOther->unk14_20 == 0xB8) func_80328B8C(other, 2, 0.0001f, 1); diff --git a/src/TTC/ch/lockup.c b/src/TTC/ch/lockup.c index 979ea614..cc65449c 100644 --- a/src/TTC/ch/lockup.c +++ b/src/TTC/ch/lockup.c @@ -114,7 +114,7 @@ void func_80389600(Actor *this){ break; case 2: //L803897DC - if(actor_playerIsWithinDist(this, 400) && func_8028FB48(0x8000000)){ + if(subaddie_playerIsWithinSphere(this, 400) && func_8028FB48(0x8000000)){ func_8028F428(0xA, this->marker); } diff --git a/src/core2/ch/beehive.c b/src/core2/ch/beehive.c index db2c57c0..6bba151c 100644 --- a/src/core2/ch/beehive.c +++ b/src/core2/ch/beehive.c @@ -53,7 +53,7 @@ void func_802CE8D4(Actor *this){ { case 1://L802CE9C4 if( !func_8031FF1C(BKPROG_D_BEEHIVE_TEXT) - && func_803296B8(this, 250, 300) + && subaddie_playerIsWithinCylinder(this, 250, 300) ){ if(func_8028ECAC() == 0 || func_8028ECAC() == BSGROUP_8_TROT){ if( player_getTransformation() == TRANSFORM_1_BANJO diff --git a/src/core2/ch/code_5AB30.c b/src/core2/ch/code_5AB30.c index 25600501..766b7cd0 100644 --- a/src/core2/ch/code_5AB30.c +++ b/src/core2/ch/code_5AB30.c @@ -237,7 +237,7 @@ void func_802E20E8(Actor *this){ } }//L802E223C - if(!actor_playerIsWithinDist(this, 4000)) + if(!subaddie_playerIsWithinSphere(this, 4000)) return; if(!local->unkB && this->marker->unk14_21){ diff --git a/src/core2/ch/firefx.c b/src/core2/ch/firefx.c index 2965281e..58499cf4 100644 --- a/src/core2/ch/firefx.c +++ b/src/core2/ch/firefx.c @@ -74,7 +74,7 @@ void chfirefx_update(Actor *this){ this->unk1C[0] = 0.0f; } }//L80359934 - if(actor_playerIsWithinDist(this, 2000)){ + if(subaddie_playerIsWithinSphere(this, 2000)){ if( func_8024DB50(this->position, 50.0f) && this->unk38_31 ){ if(!(func_8023DB5C() & 3) && randf() < 0.1){ __chfirefx_spawnSmoke(this->position, this->scale); diff --git a/src/core2/ch/icecube.c b/src/core2/ch/icecube.c index 8ac0a721..6ae5a770 100644 --- a/src/core2/ch/icecube.c +++ b/src/core2/ch/icecube.c @@ -262,7 +262,7 @@ void chicecube_update(Actor *this){ this->unk58_0 = TRUE; }//L8035AAF4 - if(!actor_playerIsWithinDist(this, 3000)) + if(!subaddie_playerIsWithinSphere(this, 3000)) return; func_802D729C(this, 3.4 * this->scale); diff --git a/src/core2/ch/mole.c b/src/core2/ch/mole.c index b1c79dc7..25a74e3b 100644 --- a/src/core2/ch/mole.c +++ b/src/core2/ch/mole.c @@ -114,7 +114,7 @@ Actor *func_802D94B4(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ } void func_802D9530(Actor *this){ - Actor *other = func_80329980(this); + Actor *other = subaddie_getLinkedActor(this); if(this->unk100 && other){ if(this->unk100->unk14_20 == 0xB8) func_80328B8C(other, 3, 0.0001f, 1); @@ -230,7 +230,7 @@ int func_802D997C(Actor *this){ } void func_802D9ADC(Actor *this){ - Actor *other = func_80329980(this); + Actor *other = subaddie_getLinkedActor(this); if(this->unk100 && other && this->unk100->unk14_20 == 0xB8){ func_80328B8C(other, 2, 0.0001f, 1); } @@ -307,7 +307,7 @@ void func_802D9D60(Actor *this){ other = func_80326D68(this->position, ACTOR_12C_MOLEHILL, -1, &sp4C); this->unk100 = (other) ? other->marker : NULL; if(this->unk100){ - other = func_80329980(this); + other = subaddie_getLinkedActor(this); if(other && this->unk100->unk14_20 == 0xB8){ func_80328A84(other, 1); } diff --git a/src/core2/code_45310.c b/src/core2/code_45310.c index 7ca7d7ba..9174f646 100644 --- a/src/core2/code_45310.c +++ b/src/core2/code_45310.c @@ -322,7 +322,7 @@ void func_802CCC5C(Actor *this) { local->unk0 = 0; func_802CC640(this, 1); } - if (!actor_playerIsWithinDist(this, 4000)) { + if (!subaddie_playerIsWithinSphere(this, 4000)) { if (local->unk0 != 0) { func_8030DA44(local->unk0); local->unk0 = 0; diff --git a/src/core2/code_47BD0.c b/src/core2/code_47BD0.c index e9996db1..28eb3010 100644 --- a/src/core2/code_47BD0.c +++ b/src/core2/code_47BD0.c @@ -418,8 +418,8 @@ void func_802CF83C(Actor *this) { this->unk38_0 = func_803203FC(1) | func_803203FC(0x1F); } - if (actor_playerIsWithinDist(this, 0xFA0)) { - if (!actor_playerIsWithinDist(this, 0x5DC) == 0) { + if (subaddie_playerIsWithinSphere(this, 0xFA0)) { + if (!subaddie_playerIsWithinSphere(this, 0x5DC) == 0) { if (this->unk44_31 != 0) { func_8030DA44(this->unk44_31); this->unk44_31 = 0; @@ -483,7 +483,7 @@ block_40: switch(this->state){ case 1: if( !func_8031FF1C(0x8F) - && func_803296B8(this, 0xFA, 0x12C) + && subaddie_playerIsWithinCylinder(this, 0xFA, 0x12C) && ((func_8028ECAC() == 0) || (func_8028ECAC() == BSGROUP_8_TROT)) && (player_getTransformation() == TRANSFORM_1_BANJO) && func_80311480(0xDA6, 0, NULL, NULL, NULL, NULL) diff --git a/src/core2/code_9E370.c b/src/core2/code_9E370.c index a6b889bf..34ecb990 100644 --- a/src/core2/code_9E370.c +++ b/src/core2/code_9E370.c @@ -29,7 +29,7 @@ void func_8032ACA8(Actor *arg0); void func_8032B5C0(ActorMarker *arg0, ActorMarker *arg1, struct5Cs *arg2); void func_80328B8C(Actor * this, s32 arg1, f32 arg2, s32 arg3); void func_8032BB88(Actor *this, s32 arg1, s32 arg2); -int actor_playerIsWithinDist(Actor *this, s32 dist); +int subaddie_playerIsWithinSphere(Actor *this, s32 dist); extern void func_8033A4A0(enum asset_e mode_id, f32, f32); extern void func_80338338(s32, s32, s32); extern void func_803382FC(s32); @@ -1325,15 +1325,43 @@ int func_80329210(Actor * arg0, f32 (* arg1)[3]){ || func_80307258(arg1, arg0->unk10_25 - 1, arg0->unk10_18-1) != -1; } -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_9E370/func_80329260.s") +bool func_80329260(Actor *this, f32 p1[3]){ + s32 var_v0; + var_v0 = func_80309D58(p1, this->unk10_18); + if(this->unk10_18 == 0){ + this->unk10_18 = var_v0; + } + if(var_v0 == 0 && this->unk10_18 != 0){ + return FALSE; + } + return TRUE; +} -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_9E370/func_803292E0.s") +bool func_803292E0(Actor *this){ + f32 player_position[3]; + if(this->unk10_25 == 0){ + return 1; + } -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_9E370/func_80329354.s") + _player_getPosition(player_position); + return func_80307258(player_position, this->unk10_25 - 1, this->unk10_18 - 1) != -1; +} + +bool func_80329354(Actor *this){ + f32 sp1C[3]; + + _player_getPosition(sp1C); + return func_80329260(this, sp1C); +} #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_9E370/func_80329384.s") -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_9E370/func_8032944C.s") +bool func_8032944C(Actor *this){ + s32 v1; + + v1 = this->pitch - this->unk6C; + return ((-3 <= v1) && (v1 <= 3)); +} bool func_80329480(Actor *this){ s32 v1; @@ -1359,14 +1387,14 @@ bool func_803294F0(Actor *this, s32 arg1, s32 arg2){ bool func_80329530(Actor *this, s32 dist){ if( func_8028F098() && !func_803203FC(0xBF) - && actor_playerIsWithinDist(this, dist) + && subaddie_playerIsWithinSphere(this, dist) ){ return TRUE; } return FALSE; } -bool actor_playerIsWithinDist(Actor *this, s32 dist){ +bool subaddie_playerIsWithinSphere(Actor *this, s32 dist){ f32 sp24[3]; f32 sp18[3]; @@ -1383,11 +1411,30 @@ bool actor_playerIsWithinDist(Actor *this, s32 dist){ return FALSE; } -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_9E370/func_80329628.s") +bool subaddie_playerIsWithinAsymmetricCylinder(Actor *this, s32 radius, s32 d_upper, s32 d_lower){ + f32 sp1C[3]; -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_9E370/func_803296B8.s") + player_getPosition(sp1C); -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_9E370/func_803296D8.s") + if(((this->position[1] + d_upper) < sp1C[1]) || (sp1C[1] < (this->position[1] - d_lower))){ + return FALSE; + } + return subaddie_playerIsWithinSphere(this, radius); + +} + +bool subaddie_playerIsWithinCylinder(Actor *this, s32 radius, s32 d_y){ + return subaddie_playerIsWithinAsymmetricCylinder(this, radius, d_y, d_y); +} + +bool func_803296D8(Actor *this, s32 dist){ + if(!this->unk124_7){ + return TRUE; + } + else{ + return func_80329530(this, dist); + } +} #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_9E370/func_8032970C.s") @@ -1453,8 +1500,7 @@ Actor *marker_getActor(ActorMarker *this){ return &(D_8036E560->data[this->actrArrayIdx]); } -//actor_getChild -Actor *func_80329980(Actor *this){ +Actor *subaddie_getLinkedActor(Actor *this){ if(this->unk100 == NULL) return NULL; return marker_getActor(this->unk100); diff --git a/src/core2/code_D0CA0.c b/src/core2/code_D0CA0.c index e82dacf5..385b2d47 100644 --- a/src/core2/code_D0CA0.c +++ b/src/core2/code_D0CA0.c @@ -344,7 +344,7 @@ void func_80358684(Actor *this) { func_80357F0C(this, 1); } - if (!actor_playerIsWithinDist(this, 4000)) { + if (!subaddie_playerIsWithinSphere(this, 4000)) { if (local->unk0 != 0) { func_8030DA44(local->unk0); local->unk0 = 0U; diff --git a/src/lair/code_42A0.c b/src/lair/code_42A0.c index eeb8cdac..ddd67213 100644 --- a/src/lair/code_42A0.c +++ b/src/lair/code_42A0.c @@ -36,10 +36,10 @@ extern f32 D_803936E4[]; /* .code */ bool func_8038A690(Actor *this) { if (this->unkF4_8 != 3) { - return func_803296B8(this, 0x190, 0x5A); + return subaddie_playerIsWithinCylinder(this, 400, 90); } else{ - return func_80329628(this, 0x1F4, 0x104, 0x5A); + return subaddie_playerIsWithinAsymmetricCylinder(this, 500, 260, 90); } } diff --git a/src/lair/code_AD70.c b/src/lair/code_AD70.c index 4d84bbf7..16429884 100644 --- a/src/lair/code_AD70.c +++ b/src/lair/code_AD70.c @@ -151,7 +151,7 @@ void func_803916BC(f32 position[3], s32 cnt){ void func_803917B0(Actor *actor) { - Actor *unk = func_80329980(actor); + Actor *unk = subaddie_getLinkedActor(actor); unk->unk38_0 = TRUE; } diff --git a/symbol_addrs.core2.us.v10.txt b/symbol_addrs.core2.us.v10.txt index 4d7ffdd0..8ff585f5 100644 --- a/symbol_addrs.core2.us.v10.txt +++ b/symbol_addrs.core2.us.v10.txt @@ -80,6 +80,8 @@ ability_use = 0x80295610; ability_hasUsed = 0x802957A0; ability_setHasUsed = 0x802957B8; ability_hasLearned = 0x802957D8; +subaddie_playerIsWithinAsymmetricCylinder = 0x80329628; +subaddie_playerIsWithinCylinder = 0x803296B8; player_setYVelocity = 0x802979A0; _get_velocity = 0x80297A88; gravity_reset = 0x80297B70; @@ -339,7 +341,7 @@ actor_new = 0x803272F8; spawn_child_actor = 0x8032818C; marker_despawn = 0x803282F4; actor_animationIsAt = 0x8032886C; -actor_playerIsWithinDist = 0x80329588; +subaddie_playerIsWithinSphere = 0x80329588; actor_playAnimationOnce = 0x803298AC; actor_loopAnimation = 0x803298D8; marker_getActor = 0x80329958; @@ -477,7 +479,6 @@ _gcbound_green = 0x80380901; _gcbound_blue = 0x80380902; func_80320044 = 0x80320044; D_80370600 = 0x80370600; -D_803837D0 = 0x803837D0; D_80374388 = 0x80374388; D_80374CD8 = 0x80374CD8; D_80374CF0 = 0x80374CF0;