document: SM/codeF0, SM/codeBF0

This commit is contained in:
Dominik Peters 2024-11-03 17:23:50 +00:00 committed by Banjo Kazooie
parent 819ba6b9ce
commit d65dc78f42
9 changed files with 83 additions and 71 deletions

View File

@ -1993,6 +1993,10 @@ enum actor_e
ACTOR_181_SCARF_SLED = 0x181,
ACTOR_182_RACE_SLED = 0x182,
ACTOR_198_BANJOS_BED = 0x198,
ACTOR_199_BANJOS_CHAIR,
ACTOR_19A_BANJOS_STOVE,
ACTOR_1BB_ENGINE_ROOM_PROPELLOR_1 = 0x1bb,
ACTOR_1BC_ENGINE_ROOM_PROPELLOR_2,
ACTOR_1BD_ENGINE_ROOM_PROPELLOR_3,
@ -2223,6 +2227,8 @@ enum actor_e
ACTOR_3B9_JUMP_TUTORIAL = 0x3B9,
ACTOR_3BD_SM_UNKNOWN = 0x3BD,
ACTOR_3BF_GRUNTLING_BLUE = 0x3BF,
ACTOR_3C0_GRUNTLING_BLACK,
ACTOR_3C1_PURPLE_TEEHEE,
@ -3095,7 +3101,7 @@ enum asset_e
// 334 Palm Tree
// 335 BGS Cattail
// 336 Banjo's Drawers
// 337 Banjo's Kitchen
ASSET_337_BANJOS_STOVE = 0x337,
// 338 Table And Radio
// 339 Winter Tree
// 33a Wall Torch
@ -3602,8 +3608,8 @@ enum asset_e
ASSET_52C_MODEL_GRUBLIN_HOOD,
ASSET_52D_MODEL_GRUBLIN_HOOD_HAT,
// 52e (CCW Season Door?)
// 52f Banjo's Chair (Secret Spring)
// 530 Banjo's Bed (Secret Spring?)
ASSET_52F_BANJOS_CHAIR = 0x52F,
ASSET_530_BANJOS_BED,
// 531 Gnawty's Den
// 532 Banjo & Kazooie (Gameboy/Beer/Sunglasses/Chair)
// 533 CCW Nabnut's Door
@ -5061,6 +5067,10 @@ enum marker_e{
MARKER_DD_BLACK_SNIPPET,
MARKER_DE_BLACK_SNIPPET_UPSIDEDOWN,
MARKER_E1_BANJOS_BED = 0xE1,
MARKER_E2_BANJOS_CHAIR,
MARKER_E3_BANJOS_STOVE,
MARKER_EA_LIGHTHOUSE_DOOR = 0xEA,
MARKER_EB_GV_BANJO_DOOR,
MARKER_EC_GV_SUN_SWITCH,
@ -5181,7 +5191,9 @@ enum marker_e{
MARKER_1EA_GRUNTLING_RED,
MARKER_1ED_JUMP_TUTORIAL = 0x1ED,
MARKER_1F1_GRUNTLING_BLACK = 0x1F1,
MARKER_1F0_SM_UNKNOWN = 0x1F0,
MARKER_1F1_GRUNTLING_BLACK,
MARKER_1F4_TOOTS = 0x1F4,

View File

@ -1,4 +1,4 @@
sm_func_80386810 = 0x80386810;
SM_resetSpawnableActors = 0x80386810;
mm_func_803888B0 = 0x803888B0;
code26D0_resetSpawnableActorsForTTC = 0x80388AC0;
code_3E30_isSecretCheatCodeRelatedValueEqualToScrambledAddressValue = 0x8038BF8C;

View File

@ -631,7 +631,7 @@ void chSmBottles_update(Actor *this) {
}
else if (actor_animationIsAt(this, 0.9999f)) { //L8038A378
__chSmBottles_setState(this, SM_BOTTLES_STATE_1_UNKNOWN);
func_80386540();
codeF0_func_80386540();
}
break;
}//L8038A3A0

View File

@ -8,40 +8,40 @@ extern f32 D_80365E04[3][3];
void func_8038A3B0(Actor *this);
/* .data */
ActorAnimationInfo D_8038AFF0[] = {
ActorAnimationInfo D_8038AFF0[3] = {
{0, 0.0f},
{0x248, 1.816f},
{0x248, 9e+09f},
};//chBanjosBedAnimations
};
ActorInfo D_8038B008 = {
0xE1, 0x198, 0x530,
ActorInfo gBanjosBed = {
MARKER_E1_BANJOS_BED, ACTOR_198_BANJOS_BED, ASSET_530_BANJOS_BED,
2, D_8038AFF0,
func_8038A3B0, actor_update_func_80326224, actor_draw,
0, 0, 0.0f, 0
};//chBanjosBed
ActorAnimationInfo D_8038B02C[] = {
ActorAnimationInfo D_8038B02C[3] = {
{0, 0.0f},
{0x247, 3.0f},
{0x247, 9e+09f},
};//chBanjosChairAnimations
ActorInfo D_8038B044 ={
0xE2, 0x199, 0x52F,
ActorInfo gBanjosChair ={
MARKER_E2_BANJOS_CHAIR, ACTOR_199_BANJOS_CHAIR, ASSET_52F_BANJOS_CHAIR,
2, D_8038B02C,
func_8038A3B0, actor_update_func_80326224, actor_draw,
0, 0, 0.0f, 0
};//chBanjosChair
};
ActorAnimationInfo D_8038B068[] = {
ActorAnimationInfo D_8038B068[3] = {
{0, 0.0f},
{0x249, 1.0f},
{0x249, 9e+09f},
};//chBanjosStoveAnimations
ActorInfo D_8038B080 ={
0xE3, 0x19A, 0x337,
ActorInfo gBanjosStove ={
MARKER_E3_BANJOS_STOVE, ACTOR_19A_BANJOS_STOVE, ASSET_337_BANJOS_STOVE,
2, D_8038B068,
func_8038A3B0, actor_update_func_80326224, actor_draw,
0, 0, 0.0f, 0

View File

@ -10,8 +10,9 @@ void func_8028F3D8(f32 *, f32, void(*)(ActorMarker *), ActorMarker *);
void func_8038A8F8(Actor *this);
/* .data */
ActorInfo D_8038B0E0 = { 0x1F0, 0x3BD, 0, 0, NULL,
func_8038A8F8, actor_update_func_80326224, func_80325340,
ActorInfo gCode44D0 = {
MARKER_1F0_SM_UNKNOWN, ACTOR_3BD_SM_UNKNOWN, NULL,
0, NULL, func_8038A8F8, actor_update_func_80326224, func_80325340,
0, 0, 0.0f, 0
};

View File

@ -15,14 +15,14 @@ ActorAnimationInfo D_8038AAF0[] = {
{0x2B9, 5.0f}
};
ActorInfo D_8038AB00 = {
ActorInfo gQuarrie = {
MARKER_135_QUARRIE, ACTOR_16F_QUARRIE, ASSET_42D_MODEL_QUARRIE,
1, NULL,
SM_func_80386EF4, actor_update_func_80326224, actor_drawFullDepth,
2000, 0, 5.0f, 0
};
ActorInfo D_8038AB24 = {
ActorInfo gRockTrappingGrunty = {
MARKER_29D_ROCK_TRAPPING_GRUNTY, ACTOR_3CA_ROCK_TRAPPING_GRUNTY, ASSET_47B_MODEL_ROCK,
1, D_8038AAF0,
SM_func_80386A00, actor_update_func_80326224, actor_drawFullDepth,
@ -111,7 +111,7 @@ void SM_func_80386D68(Actor *this){
func_80386B04(partEmitMgr_newEmitter(0xA), this->position, 0xA, this->scale);
func_80386C2C(partEmitMgr_newEmitter(0x10), this->position, 0x10, this->scale);
if (this->unk100 && func_803870E8(this->unk100)) {
if (this->unk100 && codeBF0_shouldSpawnQuarrieHoneyComb(this->unk100)) {
func_802CA1CC(HONEYCOMB_18_SM_QUARRIES);
__spawnQueue_add_4((GenFunction_4) spawnQueue_bundle_f32, BUNDLE_1F_SM_EMPTY_HONEYCOMB, reinterpret_cast(s32, this->position[0]), reinterpret_cast(s32, this->position[1]), reinterpret_cast(s32, this->position[2]));
}

View File

@ -2,18 +2,18 @@
#include "functions.h"
#include "variables.h"
void SM_func_80386FE0(Actor *this);
void __codeBF0_draw(Actor *this);
/* .data */
ActorInfo D_8038ABF0 = {
ActorInfo gCodeBF0 = {
MARKER_134_UNKNOWN, ACTOR_16E_UNKNOWN, NULL,
1, NULL,
SM_func_80386FE0, actor_update_func_80326224, func_80325340,
__codeBF0_draw, actor_update_func_80326224, func_80325340,
2000, 0, 0.0f, 0
};
/* .code */
void SM_func_80386FE0(Actor *this){
static void __codeBF0_draw(Actor *this){
if(!this->volatile_initialized){
this->unk10_12 = 0;
this->unk38_31 = this->unk10_12;
@ -22,22 +22,21 @@ void SM_func_80386FE0(Actor *this){
}
switch(this->state){
case 1://L80387064
case 1:
if(this->unk38_31++ == 2){
this->unk10_12 = actorArray_actorCount(ACTOR_16F_QUARRIE);
subaddie_set_state(this, 2);
}
break;
case 2://L803870C4
case 2:
if(this->unk10_12 == 0)
marker_despawn(this->marker);
break;
}//L803870DC
}
}
int func_803870E8(ActorMarker * arg0){
Actor *actor = marker_getActor(arg0);
bool codeBF0_shouldSpawnQuarrieHoneyComb(ActorMarker *marker){
Actor *actor = marker_getActor(marker);
return (--actor->unk10_12)==0 ? 1 : 0;
return (--actor->unk10_12) == 0 ? TRUE : FALSE;
}

View File

@ -9,8 +9,8 @@ int ability_hasLearned(s32);
extern s32 D_80275650;
extern ActorInfo D_8038AB00;
extern ActorInfo D_8038ABF0;
extern ActorInfo gQuarrie;
extern ActorInfo gCodeBF0;
extern ActorInfo gChAttackTutorial;
extern ActorInfo gChVegetablesTopperA;
extern ActorInfo gChVegetablesBawlA;
@ -20,11 +20,11 @@ extern ActorInfo gChVegetablesBawlB;
extern ActorInfo gChVegetablesCollywobbleB;
extern ActorInfo gChBottles;
extern ActorInfo gChJumpTutorial;
extern ActorInfo D_8038B0E0;
extern ActorInfo D_8038B008; //chBanjosBed
extern ActorInfo D_8038B044; //chBanjosChair
extern ActorInfo D_8038B080; //chBanjosStove
extern ActorInfo D_8038AB24;
extern ActorInfo gCode44D0;
extern ActorInfo gBanjosBed;
extern ActorInfo gBanjosChair;
extern ActorInfo gBanjosStove;
extern ActorInfo gRockTrappingGrunty;
extern u32 D_803FFE00[4];
@ -47,29 +47,28 @@ struct {
/* .code */
//dynamically gets learned ability bitfield address
u32 *func_803864E0(void){
static u32 *__codeF0_getLearnedAbilitiesAddress(){
s16 *addr;
addr = (s16*)ability_hasLearned;
return (u32 *)((addr[1] << 0x10) + addr[3]);
}
void func_803864FC(enum ability_e arg0){
static void __codeF0_learnAbility(enum ability_e ability){
u32 *addr;
if(getGameMode() != GAME_MODE_7_ATTRACT_DEMO){
addr = func_803864E0();
*addr = 1 << arg0;
addr = __codeF0_getLearnedAbilitiesAddress();
*addr = 1 << ability;
}
}
void func_80386540(void){
u32 *sp2C;
void codeF0_func_80386540(){
u32 *learned_abilities_address;
s32 sp28;
u32 *addr;
u32 sp20;
sp2C = func_803864E0();
sp28 = *sp2C;
*sp2C = 0;
learned_abilities_address = __codeF0_getLearnedAbilitiesAddress();
sp28 = *learned_abilities_address;
*learned_abilities_address = 0;
if(ability_hasLearned(ABILITY_1_BEAK_BOMB)){
addr = (u32*)ability_hasLearned;
addr[2] = 0x03E00008; //jr $ra
@ -78,20 +77,20 @@ void func_80386540(void){
osInvalICache(addr, 0x10);
}
*sp2C = sp28;
*learned_abilities_address = sp28;
osPiReadIo(0x574, &sp20);
if((sp20 = (sp20 & 0xffff)) != 0x6c07)
func_803864FC(ABILITY_A_HOLD_A_JUMP_HIGHER);
if((sp20 = (sp20 & 0xffff)) != 0x6c07)
__codeF0_learnAbility(ABILITY_A_HOLD_A_JUMP_HIGHER);
if(!SM_CRCs_are_valid())
func_803864FC(ABILITY_10_TALON_TROT);
if(!__codeF0_areCrcsValid())
__codeF0_learnAbility(ABILITY_10_TALON_TROT);
if(!func_803866CC())
func_803864FC(ABILITY_C_ROLL);
if(!__codeF0_areRomCrcsCorrect())
__codeF0_learnAbility(ABILITY_C_ROLL);
}
void func_80386614(u8 *arg0, u8 *arg1, s32 *arg2, s32 *arg3){
void __codeF0_pad_func_80386614(u8 *arg0, u8 *arg1, s32 *arg2, s32 *arg3){
s32 temp_v0 = 0;
s32 temp_v1 = -1;
s32 i;
@ -114,7 +113,7 @@ void func_80386614(u8 *arg0, u8 *arg1, s32 *arg2, s32 *arg3){
extern u8 crc_ROM_START[];
int func_803866CC(void){
static bool __codeF0_areRomCrcsCorrect(){
u32 sp24;
if( (osPiReadIo((u32)crc_ROM_START + 8, &sp24), sp24 == D_803FFE00[0])
@ -122,12 +121,13 @@ int func_803866CC(void){
&& (osPiReadIo((u32)crc_ROM_START + 16, &sp24), sp24 == D_803FFE00[2])
&& (osPiReadIo((u32)crc_ROM_START + 20, &sp24), sp24 == D_803FFE00[3])
){
return 1;
return TRUE;
}
return 0;
return FALSE;
}
bool SM_CRCs_are_valid(void){
static bool __codeF0_areCrcsValid(){
if( D_8038B320.unk0 == D_8038AAE0
&& D_8038B320.unk4 == D_8038AAE4
&& D_8038B320.unkC == D_80275650
@ -138,10 +138,10 @@ bool SM_CRCs_are_valid(void){
return FALSE;
}
void SM_func_80386810(void)
void SM_resetSpawnableActors()
{
spawnableActorList_add(&D_8038AB00, actor_new, ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_25);
spawnableActorList_add(&D_8038ABF0, actor_new, ACTOR_FLAG_UNKNOWN_7);
spawnableActorList_add(&gQuarrie, actor_new, ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_25);
spawnableActorList_add(&gCodeBF0, actor_new, ACTOR_FLAG_UNKNOWN_7);
spawnableActorList_add(&gChAttackTutorial, actor_new, ACTOR_FLAG_NONE);
spawnableActorList_add(&gChVegetablesTopperA, actor_new, ACTOR_FLAG_UNKNOWN_0 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_25);
spawnableActorList_add(&gChVegetablesBawlA, actor_new, ACTOR_FLAG_UNKNOWN_0 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_25);
@ -151,9 +151,9 @@ void SM_func_80386810(void)
spawnableActorList_add(&gChVegetablesCollywobbleB, actor_new, ACTOR_FLAG_UNKNOWN_0 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_21 | ACTOR_FLAG_UNKNOWN_25);
spawnableActorList_add(&gChBottles, actor_new, ACTOR_FLAG_UNKNOWN_8);
spawnableActorList_add(&gChJumpTutorial, 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);
spawnableActorList_add(&D_8038B044, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_9 | ACTOR_FLAG_UNKNOWN_10);
spawnableActorList_add(&D_8038B080, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_9 | ACTOR_FLAG_UNKNOWN_10);
spawnableActorList_add(&D_8038AB24, actor_new, ACTOR_FLAG_UNKNOWN_10);
spawnableActorList_add(&gCode44D0 , actor_new, ACTOR_FLAG_NONE);
spawnableActorList_add(&gBanjosBed, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_9 | ACTOR_FLAG_UNKNOWN_10);
spawnableActorList_add(&gBanjosChair, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_9 | ACTOR_FLAG_UNKNOWN_10);
spawnableActorList_add(&gBanjosStove, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_9 | ACTOR_FLAG_UNKNOWN_10);
spawnableActorList_add(&gRockTrappingGrunty, actor_new, ACTOR_FLAG_UNKNOWN_10);
}

View File

@ -362,7 +362,7 @@ void spawnQueue_reset(void){
cutscene_func_8038C4E0();
break;
case OVERLAY_B_TRAINING:
SM_func_80386810();
SM_resetSpawnableActors();
break;
case OVERLAY_3_HAUNTED:
MMM_func_803890E0();