src/core1: renamed and documented file

neue Datei:     include/core1/lookup.h
        umbenannt:      src/core1/code_18310.c -> src/core1/lookup.c
This commit is contained in:
mariob92
2024-10-13 21:01:13 +02:00
parent 0cee3c6697
commit e125d3c1be
9 changed files with 38 additions and 32 deletions

View File

@@ -179,7 +179,7 @@ segments:
- [0xF53420, c, memory] - [0xF53420, c, memory]
- [0xF54AE0, c, eeprom] - [0xF54AE0, c, eeprom]
- [0xF54BE0, c, ucode] - [0xF54BE0, c, ucode]
- [0xF54CE0, c, code_18310] - [0xF54CE0, c, lookup]
- [0xF54D20, c, code_18350] - [0xF54D20, c, code_18350]
- [0xF58860, c, code_1BE90] - [0xF58860, c, code_1BE90]
- [0xF59F60, c, stub_1D590] - [0xF59F60, c, stub_1D590]
@@ -383,7 +383,7 @@ segments:
- [0xF75620, .data, code_13990] - [0xF75620, .data, code_13990]
- [0xF75630, .data, code_15B30] - [0xF75630, .data, code_15B30]
- [0xF75640, .data, memory] - [0xF75640, .data, memory]
- [0xF75670, .data, code_18310] - [0xF75670, .data, lookup]
- [0xF75D60, .data, code_18350] - [0xF75D60, .data, code_18350]
- [0xF75EE0, .data, code_1BE90] - [0xF75EE0, .data, code_1BE90]
- [0xF75EF0, .data, code_1D5D0] - [0xF75EF0, .data, code_1D5D0]

View File

@@ -180,7 +180,7 @@ segments:
- [0xF2FCA0, c, memory] #DONE - [0xF2FCA0, c, memory] #DONE
- [0xF31360, c, eeprom] #DONE - [0xF31360, c, eeprom] #DONE
- [0xF31460, c, ucode] #DONE - [0xF31460, c, ucode] #DONE
- [0xF31560, c, code_18310] #DONE - [0xF31560, c, lookup] #DONE
- [0xF315A0, c, code_18350] #DONE - [0xF315A0, c, code_18350] #DONE
- [0xF350E0, c, code_1BE90] #DONE - [0xF350E0, c, code_1BE90] #DONE
- [0xF367E0, c, stub_1D590] #DONE - [0xF367E0, c, stub_1D590] #DONE
@@ -384,7 +384,7 @@ segments:
- [0xF51DA0, .data, code_13990] - [0xF51DA0, .data, code_13990]
- [0xF51DB0, .data, code_15B30] - [0xF51DB0, .data, code_15B30]
- [0xF51DC0, .data, memory] - [0xF51DC0, .data, memory]
- [0xF51DF0, .data, code_18310] - [0xF51DF0, .data, lookup]
- [0xF524E0, .data, code_18350] - [0xF524E0, .data, code_18350]
- [0xF52660, .data, code_1BE90] - [0xF52660, .data, code_1BE90]
- [0xF52670, .data, code_1D5D0] - [0xF52670, .data, code_1D5D0]

View File

@@ -6,6 +6,7 @@
#include "enums.h" #include "enums.h"
#include "core1/eeprom.h" #include "core1/eeprom.h"
#include "core1/lookup.h"
#include "core1/main.h" #include "core1/main.h"
#include "core1/mem.h" #include "core1/mem.h"
#include "core1/pfsmanager.h" #include "core1/pfsmanager.h"

8
include/core1/lookup.h Normal file
View File

@@ -0,0 +1,8 @@
#ifndef BANJO_KAZOOIE_CORE1_LOOKUP_H
#define BANJO_KAZOOIE_CORE1_LOOKUP_H
enum comusic_e lookup_getCoMusicId(s32 idx);
enum sfx_e lookup_getSfxId(s32 idx);
enum asset_e lookup_getAnimAssetId(s32 idx);
#endif

View File

@@ -186,7 +186,7 @@ typedef struct actor_s{
f32 unk4C; f32 unk4C;
/* 0x50 */ f32 yaw; //0x50 /* 0x50 */ f32 yaw; //0x50
f32 unk54; //0x54 f32 unk54; //0x54
u32 unk58_31: 15; u32 animctrl_asset_id: 15; // animation asset id (enum asset_id)
u32 stored_animctrl_index: 14; //animctrlAnimIndex; u32 stored_animctrl_index: 14; //animctrlAnimIndex;
u32 unk58_2: 1; u32 unk58_2: 1;
u32 unk58_1: 1; u32 unk58_1: 1;

View File

@@ -46,11 +46,11 @@ void func_80244B3C(void){
void func_80244BB0(s32 arg0, s32 arg1, s32 arg2, f32 arg3){ void func_80244BB0(s32 arg0, s32 arg1, s32 arg2, f32 arg3){
s32 i; s32 i;
u8 indx; u8 indx;
if(func_8030ED70(func_80255D44(arg1))){ if(func_8030ED70(lookup_getSfxId(arg1))){
i = sfxsource_createSfxsourceAndReturnIndex(); i = sfxsource_createSfxsourceAndReturnIndex();
indx = i; indx = i;
if(i){ if(i){
sfxsource_setSfxId(indx, func_80255D44(arg1)); sfxsource_setSfxId(indx, lookup_getSfxId(arg1));
sfxsource_playSfxAtVolume(indx, arg3); sfxsource_playSfxAtVolume(indx, arg3);
sfxsource_setSampleRate(indx, arg2); sfxsource_setSampleRate(indx, arg2);
func_8030E2C4(indx); func_8030E2C4(indx);
@@ -59,7 +59,7 @@ void func_80244BB0(s32 arg0, s32 arg1, s32 arg2, f32 arg3){
} }
} }
else{ else{
func_8030E6A4(func_80255D44(arg1), arg3, arg2); func_8030E6A4(lookup_getSfxId(arg1), arg3, arg2);
} }
} }

View File

@@ -1,9 +1,7 @@
#include <ultra64.h> #include <ultra64.h>
#include "core1/core1.h" #include "core1/core1.h"
#include "functions.h"
#include "variables.h"
s16 D_802765C0[] ={ static s16 sAnimAssetIds[] = {
0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008,
0x0009, 0x000A, 0x029E, 0x000C, 0x000D, 0x000E, 0x029F, 0x0010, 0x0009, 0x000A, 0x029E, 0x000C, 0x000D, 0x000E, 0x029F, 0x0010,
0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018,
@@ -69,7 +67,7 @@ s16 D_802765C0[] ={
0x012B, 0x012C, 0x012D, 0x012E, 0x012F, 0xFFFF 0x012B, 0x012C, 0x012D, 0x012E, 0x012F, 0xFFFF
}; };
s16 D_802769AC[] = { static s16 sSfxIds[] = {
0x0000, 0x0001, 0x0000, 0x0001,
0x0002, 0x0003, 0x018F, 0x0005, 0x008C, 0x0007, 0x0008, 0xFFFE, 0x0002, 0x0003, 0x018F, 0x0005, 0x008C, 0x0007, 0x0008, 0xFFFE,
0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0063, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0063,
@@ -104,7 +102,7 @@ s16 D_802769AC[] = {
0x00A8, 0x00A9, 0xFFFF, 0x0000 0x00A8, 0x00A9, 0xFFFF, 0x0000
}; };
s16 D_80276B98[] = { static s16 sCoMusicIds[] = {
0x002F, 0x0030, 0x0099, 0x005F, 0x002F, 0x0030, 0x0099, 0x005F,
0x0002, 0x0003, 0xFFFE, 0x0005, 0x0006, 0xFFFE, 0x0008, 0x0009, 0x0002, 0x0003, 0xFFFE, 0x0005, 0x0006, 0xFFFE, 0x0008, 0x0009,
0x000A, 0x000B, 0x000C, 0x000D, 0xFFFE, 0x000F, 0x0010, 0xFFFE, 0x000A, 0x000B, 0x000C, 0x000D, 0xFFFE, 0x000F, 0x0010, 0xFFFE,
@@ -125,14 +123,14 @@ s16 D_80276B98[] = {
0xFFFE, 0xFFFE, 0xFFFE, 0x0044, 0xFFFF, 0x0000, 0x0000, 0x0000, 0xFFFE, 0xFFFE, 0xFFFE, 0x0044, 0xFFFF, 0x0000, 0x0000, 0x0000,
}; };
s32 func_80255D30(s32 arg0){ enum comusic_e lookup_getCoMusicId(s32 idx) {
return D_80276B98[arg0]; return sCoMusicIds[idx];
} }
s32 func_80255D44(s32 arg0){ enum sfx_e lookup_getSfxId(s32 idx) {
return D_802769AC[arg0]; return sSfxIds[idx];
} }
s32 func_80255D58(s32 arg0){ enum asset_e lookup_getAnimAssetId(s32 idx) {
return D_802765C0[arg0]; return sAnimAssetIds[idx];
} }

View File

@@ -819,7 +819,7 @@ Actor *actor_new(s32 position[3], s32 yaw, ActorInfo* actorInfo, u32 flags){
suLastBaddie->unk10_7 = 0; suLastBaddie->unk10_7 = 0;
suLastBaddie->unk10_6 = 0; suLastBaddie->unk10_6 = 0;
suLastBaddie->unk54 = 0.0f; suLastBaddie->unk54 = 0.0f;
suLastBaddie->unk58_31 = 0; suLastBaddie->animctrl_asset_id = 0;
suLastBaddie->unk5C = 0.0f; suLastBaddie->unk5C = 0.0f;
suLastBaddie->unkF4_31 = 0; suLastBaddie->unkF4_31 = 0;
suLastBaddie->unk138_30 = 0; suLastBaddie->unk138_30 = 0;

View File

@@ -3,7 +3,6 @@
#include "variables.h" #include "variables.h"
extern void func_80250530(s32, u16, f32); extern void func_80250530(s32, u16, f32);
extern s32 func_80255D44(s32);
extern void sfxsource_setSampleRate(u8, s32); extern void sfxsource_setSampleRate(u8, s32);
extern bool func_80323240(struct56s *, f32, f32[3]); extern bool func_80323240(struct56s *, f32, f32[3]);
extern f32 func_803234FC(struct56s *, f32, f32); extern f32 func_803234FC(struct56s *, f32, f32);
@@ -534,7 +533,7 @@ void func_80341A54(void) {
for(var_s0 = 0x40; var_s0 < 0x80; var_s0++){ for(var_s0 = 0x40; var_s0 < 0x80; var_s0++){
if (D_803858A0[var_s0] != 0) { if (D_803858A0[var_s0] != 0) {
func_8025A7DC(func_80255D30(D_803858A0[var_s0])); func_8025A7DC(lookup_getCoMusicId(D_803858A0[var_s0]));
} }
} }
@@ -783,7 +782,7 @@ s32 func_803422D4(Actor *arg0, Union_glspline *arg1, SplineList *arg2){
case 2: case 2:
D_803858A0[arg1->t0.unk10.common.bit7] = arg1->t0.unk4.common.bit31; D_803858A0[arg1->t0.unk10.common.bit7] = arg1->t0.unk4.common.bit31;
func_8025A6EC(func_80255D30(arg1->t0.unk4.common.bit31), arg1->t0.unk4.common.bit15 * 8); func_8025A6EC(lookup_getCoMusicId(arg1->t0.unk4.common.bit31), arg1->t0.unk4.common.bit15 * 8);
break; break;
case 3: case 3:
@@ -791,12 +790,12 @@ s32 func_803422D4(Actor *arg0, Union_glspline *arg1, SplineList *arg2){
sp7C = arg1->t0.unk8.bit31 / 8.388608e6f; sp7C = arg1->t0.unk8.bit31 / 8.388608e6f;
sp74 = arg1->t0.unk4.common.bit15 * 8; sp74 = arg1->t0.unk4.common.bit15 * 8;
sp70 = arg1->t0.unk10.common.bit7; sp70 = arg1->t0.unk10.common.bit7;
if (func_8030ED70(func_80255D44(sp78))){ if (func_8030ED70(lookup_getSfxId(sp78))){
sfxsourceIdx = sfxsource_createSfxsourceAndReturnIndex(); sfxsourceIdx = sfxsource_createSfxsourceAndReturnIndex();
if (sfxsourceIdx == 0){ if (sfxsourceIdx == 0){
return sp84; return sp84;
} }
sfxsource_setSfxId(sfxsourceIdx, func_80255D44(sp78)); sfxsource_setSfxId(sfxsourceIdx, lookup_getSfxId(sp78));
sfxsource_playSfxAtVolume(sfxsourceIdx, sp7C); sfxsource_playSfxAtVolume(sfxsourceIdx, sp7C);
sfxsource_setSampleRate(sfxsourceIdx, sp74); sfxsource_setSampleRate(sfxsourceIdx, sp74);
func_8030E2C4(sfxsourceIdx); func_8030E2C4(sfxsourceIdx);
@@ -805,7 +804,7 @@ s32 func_803422D4(Actor *arg0, Union_glspline *arg1, SplineList *arg2){
} }
D_803858A0[sp70] = sfxsourceIdx; D_803858A0[sp70] = sfxsourceIdx;
} else { } else {
func_8030E6A4(func_80255D44(sp78), sp7C, sp74); func_8030E6A4(lookup_getSfxId(sp78), sp7C, sp74);
} }
break; break;
@@ -829,7 +828,7 @@ s32 func_803422D4(Actor *arg0, Union_glspline *arg1, SplineList *arg2){
case 4: case 4:
if (D_803858A0[arg1->t0.unk10.common.bit7] != 0){ if (D_803858A0[arg1->t0.unk10.common.bit7] != 0){
func_8025A7DC(func_80255D30(D_803858A0[arg1->t0.unk10.common.bit7])); func_8025A7DC(lookup_getCoMusicId(D_803858A0[arg1->t0.unk10.common.bit7]));
D_803858A0[arg1->t0.unk10.common.bit7] = 0; D_803858A0[arg1->t0.unk10.common.bit7] = 0;
} }
break; break;
@@ -885,12 +884,12 @@ s32 func_803422D4(Actor *arg0, Union_glspline *arg1, SplineList *arg2){
} }
if (arg1->t1.unk8.bit10){ if (arg1->t1.unk8.bit10){
arg0->unk5C = ((f32) arg1->t1.unk8.bit21) / 4; arg0->unk5C = ((f32) arg1->t1.unk8.bit21) / 4;
arg0->unk58_31 = func_80255D58(arg1->t1.unk8.bit31); arg0->animctrl_asset_id = lookup_getAnimAssetId(arg1->t1.unk8.bit31);
if (arg0->animctrl == 0) { if (arg0->animctrl == 0) {
arg0->animctrl = animctrl_new(0); arg0->animctrl = animctrl_new(0);
animctrl_reset(arg0->animctrl); animctrl_reset(arg0->animctrl);
} }
animctrl_setIndex(arg0->animctrl, arg0->unk58_31); animctrl_setIndex(arg0->animctrl, arg0->animctrl_asset_id);
animctrl_setDuration(arg0->animctrl, arg0->unk5C); animctrl_setDuration(arg0->animctrl, arg0->unk5C);
animctrl_setDirection(arg0->animctrl, 1); animctrl_setDirection(arg0->animctrl, 1);
if (arg0->animctrl != 0) { if (arg0->animctrl != 0) {
@@ -1266,10 +1265,10 @@ void func_80343DEC(Actor *this){
void func_80343E20(s32 arg0, s32 arg1, f32 arg2, s32 arg3) { void func_80343E20(s32 arg0, s32 arg1, f32 arg2, s32 arg3) {
u8 temp_v0; u8 temp_v0;
if (func_8030ED70(func_80255D44(arg0)) != 0) { if (func_8030ED70(lookup_getSfxId(arg0)) != 0) {
temp_v0 = sfxsource_createSfxsourceAndReturnIndex(); temp_v0 = sfxsource_createSfxsourceAndReturnIndex();
if (temp_v0 != 0) { if (temp_v0 != 0) {
sfxsource_setSfxId(temp_v0, func_80255D44(arg0)); sfxsource_setSfxId(temp_v0, lookup_getSfxId(arg0));
sfxsource_playSfxAtVolume(temp_v0, arg2); sfxsource_playSfxAtVolume(temp_v0, arg2);
sfxsource_setSampleRate(temp_v0, arg1); sfxsource_setSampleRate(temp_v0, arg1);
func_8030E2C4(temp_v0); func_8030E2C4(temp_v0);
@@ -1279,7 +1278,7 @@ void func_80343E20(s32 arg0, s32 arg1, f32 arg2, s32 arg3) {
D_803858A0[arg3] = temp_v0; D_803858A0[arg3] = temp_v0;
} }
} else { } else {
func_8030E6A4(func_80255D44(arg0), arg2, arg1); func_8030E6A4(lookup_getSfxId(arg0), arg2, arg1);
} }
} }