Merge branch banjo-kazooie:master into documentation

This commit is contained in:
Cyrus Kashef
2024-08-31 05:56:33 +00:00
52 changed files with 553 additions and 1036 deletions

View File

@@ -12,6 +12,7 @@ struct {
f32 unkC;
f32 unk10;
}D_8037D450;
u32 pad_8037D464;
u8 D_8037D468;
/* .code */

View File

@@ -7,7 +7,7 @@
#endif
extern s16 D_803A5D00[2][0xF660]; //framebuffer
extern u8 D_8037DCC8[]; //bottels bonus flags???
extern u8 D_8037DCC8; //bottles bonus flags???
extern void ml_vec3f_assign(f32[3], f32, f32, f32);
@@ -61,9 +61,8 @@ ActorInfo D_80368418 = {
/* .bss */
ActorMarker *chBottlesBonusCursorMarker;
f32 D_8037E068[20][2];
f32 D_8037E068[60][2];
Struct_core2_584D0_0 D_8037E248[20]; //puzzle pieces
u8 pad_8037E478[0x140];
s32 D_8037E5B8;
struct {
s32 unk0;

View File

@@ -2,6 +2,7 @@
#include "functions.h"
#include "variables.h"
#include "core2/code_C9E70.h"
#include "core2/modelRender.h"
#ifndef ABS
@@ -77,10 +78,21 @@ ActorInfo D_80365F00 = { 0xE6, 0x197, 0x532, 0x1, D_80365ED0, func_802C4C14, fun
/* .bss */
// Remove this when this memory region is properly symbolized
u8 unk_8037DCB0[0x8037DCE0 - 0x8037DCB0];
extern u8 D_8037DCCE[0x12];
s32 D_8037DCB0;
u32 D_8037DCB4;
struct FF_StorageStruct* D_8037DCB8;
s32 D_8037DCBC;
u8 D_8037DCC0[7];
u8 D_8037DCC7;
u8 D_8037DCC8;
u8 D_8037DCC9;
u8 D_8037DCCA;
u8 D_8037DCCB;
u8 D_8037DCCC;
u8 D_8037DCCD;
u8 D_8037DCCE[3];
s32 pad_8037DCD4;
s32 pad_8037DCD8;
struct {
u8 *unk0;

View File

@@ -93,14 +93,14 @@ struct {
D_8037C6F0;
/*.code */
#ifndef NONMATCHING
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_12F30/func_80299EC0.s")
#else
void func_80299EC0(f32 arg0[3]) {
f32 spEC[3]; //player_pos
f32 spE0[3];
f32 spD4[3];
f32 a;
f32 f0;
BKModelBin *spC8;
f32 f2;
f32 spB8[3];
f32 spAC[3];
f32 spA0[3];
@@ -110,17 +110,14 @@ void func_80299EC0(f32 arg0[3]) {
f32 sp70;
BKCollisionTri *sp6C; //floor_vtx_list
f32 sp48[3][3]; //tri_vtx_coord
f32 temp_f0_2;
f32 temp_f2_2;
f32 temp_f2_4;
Vtx *vtx_buffer;
Vtx *temp_v1;
f32 phi_f18;
f32 f18;
arg0[2] =
arg0[1] =
arg0[0] = 255;
arg0[0] = 255.0f;\
arg0[1] = 255.0f;\
arg0[2] = 255.0f;
if (D_8037C6F0.unk0 == 1) {
sp78 = 50;
} else if (func_8028EE84() == BSWATERGROUP_0_NONE) {
@@ -134,77 +131,89 @@ void func_80299EC0(f32 arg0[3]) {
if (spC8 == NULL) {
sp6C = NULL;
}
if ((spEC[1] - func_80294438()) > 100.0f) {
if ((spEC[1] - func_80294438()) > 100) {
sp6C = NULL;
}
if (sp6C == NULL) return;
if (sp6C->unk6 &2) return;
vtx_buffer = vtxList_getVertices(model_getVtxList(spC8));
for(i = 0; i<3; i++){
temp_v1 = vtx_buffer + sp6C->unk0[i];
sp48[i][0] = (f32) temp_v1->v.ob[0];
sp48[i][1] = (f32) temp_v1->v.ob[1];
sp48[i][2] = (f32) temp_v1->v.ob[2];
sp48[i][1] = 0.0f;
sp48[i][1] = 0;
sp7C[i][0] = (f32) temp_v1->v.cn[0];
sp7C[i][1] = (f32) temp_v1->v.cn[1];
sp7C[i][2] = (f32) temp_v1->v.cn[2];
}
// spEC[1] = 0.0f;
spEC[1] = 0;
spE0[0] = spEC[0] - sp48[0][0];
spE0[1] = 0;
spE0[2] = spEC[2] - sp48[0][2];
spE0[1] = 0.0f;
spAC[0] = sp48[0][0] - sp48[1][0];
spAC[1] = 0;
spAC[2] = sp48[0][2] - sp48[1][2];
spAC[1] = 0.0f;
spB8[0] = -(sp48[2][2] - sp48[1][2]);
spB8[2] = sp48[2][0] - sp48[1][0];
spB8[1] = 0.0f;
phi_f18 = (spE0[0] * spB8[0]) + (spE0[1] * spB8[1]) + (spB8[2] * spE0[2]);
phi_f18 = (phi_f18 == 0.0f)? 0.1f : phi_f18;
temp_f0_2 = -((spB8[2] * spAC[2]) + ((spAC[0] * spB8[0]) + 0.0f)) / phi_f18;
spA0[0] = (spE0[0] * temp_f0_2) + sp48[0][0];
spA0[1] = 0.0f;
spA0[2] = (spE0[2] * temp_f0_2) + sp48[0][2];
spB8[0] = sp48[2][0] - sp48[1][0];
spB8[1] = 0;
spB8[2] = sp48[2][2] - sp48[1][2];
//swap
sp70 = spB8[0];
spB8[0] = -spB8[2];
spB8[2] = sp70;
f18 = spE0[0]*spB8[0] + spE0[1]*spB8[1] + spE0[2]*spB8[2];
if (f18 == 0) {
f18 = 0.1;
}
f0 = -(spAC[0]*spB8[0] + spAC[1]*spB8[1] + spAC[2]*spB8[2]) / f18;
spA0[0] = sp48[0][0] + (spE0[0] * f0);
spA0[1] = 0;
spA0[2] = sp48[0][2] + (spE0[2] * f0);
spD4[0] = spA0[0] - sp48[1][0];
spD4[1] = spA0[1] - sp48[1][1];
spD4[2] = spA0[2] - sp48[1][2];
temp_f2_2 = gu_sqrtf(spD4[0]*spD4[0] + spD4[1]*spD4[1] + spD4[2]*spD4[2]) / (gu_sqrtf(spB8[0] * spB8[0] + spB8[1] * spB8[1] + spB8[2] * spB8[2]) + 0.01);
f2 = gu_sqrtf(spD4[0]*spD4[0] + spD4[1]*spD4[1] + spD4[2]*spD4[2])
/ (gu_sqrtf(spB8[0]*spB8[0] + spB8[1]*spB8[1] + spB8[2]*spB8[2]) + 0.01);
for(i = 0; i < 3; i++){
arg0[i] = sp7C[1][i] + (sp7C[2][i] - sp7C[1][i])*temp_f2_2;
arg0[i] = sp7C[1][i] + (sp7C[2][i] - sp7C[1][i]) * f2;
}
spD4[0] = spA0[0] - sp48[0][0];
spD4[1] = spA0[1] - sp48[0][1];
spD4[2] = spA0[2] - sp48[0][2];
temp_f2_4 = (1.0 - (gu_sqrtf(spE0[0]*spE0[0] + spE0[1]*spE0[1] + spE0[2]*spE0[2]) / (gu_sqrtf(spD4[0]*spD4[0] + spD4[1]*spD4[1] + spD4[2]*spD4[2]) + 0.01)));
f2 = 1 - (gu_sqrtf(spE0[0]*spE0[0] + spE0[1]*spE0[1] + spE0[2]*spE0[2])
/ (gu_sqrtf(spD4[0]*spD4[0] + spD4[1]*spD4[1] + spD4[2]*spD4[2]) + 0.01));
for(i = 0; i < 3; i++){
arg0[i] += (sp7C[0][i] - arg0[i])*temp_f2_4;
arg0[i] = arg0[i] + (sp7C[0][i] - arg0[i]) * f2;
}
f2 = func_80294404() / 100;
for(i = 0; i < 3; i++){
arg0[i] = arg0[i] + (255 - arg0[i]) * f2;
}
for(i = 0; i < 3; i++){
arg0[i] += (255.0f - arg0[i]) * (func_80294404() / 100.0f);
if(arg0[i] > 255){ arg0[i] = 255; }
if(arg0[i] < 0) { arg0[i] = 0; }
}
for(i = 0; i < 3; i++){
if(arg0[i] > 255.0f){ arg0[i] = 255.0f; }
if(arg0[i] < 0.0f) { arg0[i] = 0.0f; }
}
arg0[0] = ((arg0[0] + arg0[1] + arg0[2]) * (f32) (0xFF - sp78)) / 765.0f + sp78;
arg0[0] = ((arg0[0] + arg0[1] + arg0[2]) * (255 - sp78)) / 765 + sp78;
arg0[1] = arg0[0];
arg0[2] = arg0[0];
}
#endif
void func_8029A47C(s32 arg0[3]){
arg0[0] = (s32)(D_8037C6F0.unk4[0] + 0.5);

View File

@@ -2,6 +2,7 @@
#include "functions.h"
#include "variables.h"
#include "core2/code_C9E70.h"
extern void func_8030DBFC(u32, f32, f32, f32);
extern bool func_80309DBC(f32[3], f32[3], f32, f32 sp54[3], s32, s32);
@@ -45,8 +46,6 @@ ActorInfo D_80367310 = {MARKER_217_BEE_SWARM, ACTOR_34D_BEE_SWARM, ASSET_49E_SPR
0, 0, 1.0f, 0
};
/* .bss */
extern s32 D_8037DCBC;
/* .code */

View File

@@ -39,6 +39,7 @@ ActorInfo D_80368620 = {
/* .bss */
ActorMarker *D_8037E620;
f32 D_8037E624;
f32 D_8037E628;
s32 D_8037E62C;
s32 D_8037E630;
@@ -292,7 +293,6 @@ void chsnacker_update(Actor *this) {
this->depth_mode = (255.0 == local->unk4) ? MODEL_RENDER_DEPTH_FULL : MODEL_RENDER_DEPTH_COMPARE;
}
extern f32 D_8037E624;
void func_802E1790(void){
D_8037E624 = 0.0f;
D_8037E628 = 1.0f;

View File

@@ -9,7 +9,6 @@ typedef struct map_savestate_s{
/* .bss */
s32 D_8037E650[0x9A];
u8 pad_8037E8A8[0x18];
/* public functions */
void func_802E3BD0(s32 frame_buffer_indx);

View File

@@ -117,9 +117,6 @@ struct {
s32 unk44;
} D_80381FA0;
u8 D_80381FE8[0x50];
/* .code */
void func_80301F10(Cube *cube, Gfx **gfx, Mtx **mtx, Vtx **vtx){
func_80308F0C(cube);
@@ -252,6 +249,7 @@ void func_80301F50(Gfx **gfx, Mtx **mtx, Vtx **vtx, s32 arg3[3], s32 arg4[3], s3
sp44 -= D_80381FA0.stride[0];
}
}
u8 D_80381FE8[0x50];
void func_80302634(Gfx **gfx, Mtx **mtx, Vtx **vtx, s32 arg3[3], s32 arg4[3], s32 arg5[3]) {
s32 sp54;
@@ -541,6 +539,7 @@ Cube *func_8030364C(void){
return D_80381FA0.unk40;
}
s32 D_803820A8[3];
Cube *func_80303658(void){
return D_80381FA0.unk3C;
}
@@ -637,6 +636,11 @@ BKCollisionTri * func_80303960(f32 volume_p1[3], f32 volume_p2[3], f32 radius, f
return var_s5;
}
s32 D_803820B8[0x20]; //ActorProp *, (maybe Prop *)
u8 pad_80382138[4];
s32 D_8038213C;
extern Cube *D_80382144;
//BKCollisionTri *
BKCollisionTri * func_80303AF0(f32 position[3], f32 radius, f32 arg2[3], u32 arg3) {
s32 cube_indx[3];
@@ -664,7 +668,6 @@ BKCollisionTri * func_80303AF0(f32 position[3], f32 radius, f32 arg2[3], u32 arg
return var_s5;
}
s32 D_803820B8[0x20]; //ActorProp *, (maybe Prop *)
void func_80303C54(Cube *cube, ActorMarker *marker, f32 arg2, s32 arg3, s32 *arg4, s32 *arg5) {
ActorProp *phi_s0;
@@ -676,7 +679,7 @@ void func_80303C54(Cube *cube, ActorMarker *marker, f32 arg2, s32 arg3, s32 *arg
phi_s0 = func_803322F0(cube, marker, arg2, arg3, arg4);
if (phi_s0 != NULL) {
if (phi_s0->unk8_0 && phi_s0->marker->unk58 != NULL) {
if (phi_s0->marker->unk58(phi_s0->marker, marker) == 0) {
if (phi_s0->marker->unk58(phi_s0->marker, marker) == 0) {
phi_s0 = NULL;
}
}
@@ -688,7 +691,10 @@ void func_80303C54(Cube *cube, ActorMarker *marker, f32 arg2, s32 arg3, s32 *arg
};
}
s32 D_8038213C;
Cube *D_80382144;
s32 D_80382148;
s16 D_80382150[0x48];
u32 D_803821E0[0x5B];
void func_80303D78(ActorMarker *arg0, f32 arg1, UNK_TYPE(s32) arg2) {
s32 sp6C[3];
s32 sp60[3];
@@ -727,17 +733,19 @@ void func_80303F6C(s32 indx, s32 arg1){
ActorProp *func_80303F7C(ActorMarker *arg0, f32 arg1, s32 arg2, s32 arg3) {
s32 temp_v1;
s32 phi_a0;
static s32 D_80382148;
// This matches without a pointer by using a function static, but
// triggers tricky bss reordering.
s32* D_80382148_ptr = &D_80382148;
if (arg3 == 0) {
func_80303D78(arg0, arg1, arg2);
D_80382148 = 0;
*D_80382148_ptr = 0;
return 0;
}
else{
temp_v1 = D_803820B8[D_80382148];
temp_v1 = D_803820B8[*D_80382148_ptr];
if (temp_v1 != 0) {
D_80382148++;
(*D_80382148_ptr)++;
}
return temp_v1;
}
@@ -2042,10 +2050,8 @@ u32 func_80307EA8(s32 arg0, s32 arg1[3], s32 *arg2, s32 *arg3) {
u32 var_s4;
NodeProp *temp_a0;
Cube *temp_v0;
static s32 D_803820A8[3];
static s32 D_803820B4;
var_s4 = 0;
if (arg0 == 0) {
D_803820A8[0] = (s32) D_80381FA0.min[0];
@@ -2154,11 +2160,9 @@ bool func_803082D8(Cube *arg0, s32 *arg1, bool arg2, bool arg3) {
return var_a0;
}
Cube *D_80382144;
s32 func_803083B0(s32 arg0) {
s32 var_v0;
Cube *var_s0;
static u8 a;
static s32 D_80382140;
if (arg0 == -1) {
@@ -2323,9 +2327,6 @@ bool func_803088C8(s32 arg0) {
return (D_8036ABAC[i] == -1) ? FALSE : TRUE;
}
/* .bss */ //must be defined AFTER func_80303F7C for local static alignment
s16 D_80382150[0x48];
/* .code */
void func_8030895C(s32 arg0){
D_80382150[D_8036ABD4] = arg0;
@@ -2416,9 +2417,6 @@ void func_80308D2C(Gfx **gfx, Mtx **mtx, Vtx **vtx) {
func_8032F464(0);
}
/* .bss */
u32 D_803821E0[0x5B];
/* .code */
void func_80308EC8(void){
s32 i;

View File

@@ -5,8 +5,9 @@
extern ALBank *music_get_sound_bank(void);
extern u8 D_D846C0;
extern u8 D_D954B0;
extern u8 soundfont1ctl_ROM_START[];
extern u8 soundfont1ctl_ROM_END[];
extern u8 soundfont1tbl_ROM_START[];
struct {
s32 unk0; //sound state cnt
@@ -25,12 +26,12 @@ void sfxInstruments_init(void){
ALBankFile * bnkf;
size = &D_D954B0 - &D_D846C0;
size = soundfont1ctl_ROM_END - soundfont1ctl_ROM_START;
bnkf = (ALBankFile *)malloc(size);
osWritebackDCache(bnkf, size);
osPiStartDma(func_802405D0(), 0, 0, &D_D846C0, bnkf, size, func_802405C4());
osPiStartDma(func_802405D0(), 0, 0, (u32)soundfont1ctl_ROM_START, bnkf, size, func_802405C4());
osRecvMesg(func_802405C4(), NULL, 1);
alBnkfNew(bnkf, &D_D954B0);
alBnkfNew(bnkf, soundfont1tbl_ROM_START);
bnk = bnkf->bankArray[0];
inst = bnk->instArray[0];
D_803835F0.unk0 = inst->soundCount;

View File

@@ -437,7 +437,7 @@ void assetCache_init(void){
assetCacheAssetIdList = (s16 *)malloc(150*sizeof(s16));
assetCacheLength = 0;
assetSectionRomHeader = (AssetROMHead *)malloc(sizeof(AssetROMHead));
D_80383CC8 = (u32) &D_5E90;
D_80383CC8 = (u32)assets_ROM_START;
func_802405F0(assetSectionRomHeader, D_80383CC8, sizeof(AssetROMHead));
assetSectionRomMetaList = (AssetFileMeta *)malloc(assetSectionRomHeader->count*sizeof(AssetFileMeta));
func_802405F0(assetSectionRomMetaList, D_80383CC8 + sizeof(AssetROMHead),assetSectionRomHeader->count*sizeof(AssetFileMeta));

View File

@@ -14,9 +14,7 @@ extern f32 func_80323FDC(struct56s *, f32, f32, s32 *);
extern f32 func_803240E0(struct56s *, f32, f32, s32 *);
extern void func_8032417C(struct56s *, f32, f32[3], f32[3]);
extern void func_80328FF0(Actor *, f32);
extern void func_8032DC70(s32);
typedef struct {
f32 unk0;
@@ -153,6 +151,7 @@ typedef struct {
u16 pad8_12:13;
}Struct_glspline_803411B0;
s32 func_80341BC8(struct56s *arg0, SplineList * arg1);
/* .data */
@@ -260,239 +259,268 @@ f32 glspline_catmull_rom_interpolate(f32 x, s32 knotCount, f32 *knotList) {
return (((((sp24[2] * x) + sp24[1]) * x) + sp24[0]) * x) + (1.0*knotList[1]);
}
#ifndef NONMATCHING
void func_80340BE4(f32 arg0, s32 arg1, s32 arg2, s32 arg3, f32 * arg4, f32 arg5[3]);
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B9770/func_80340BE4.s")
#else
void func_80340BE4(f32 x, s32 length, s32 stride, s32 width, f32 *arg4, f32 *dst){
s32 spD0;
void func_80340BE4(f32 x, s32 length, s32 stride, s32 width, f32 *arg4, f32 dst[3]){
s32 padding;
s32 max_interval;
s32 i;
s32 var_a3;
s32 a3;
f32 temp_f2;
f32 f3;
f32 f1;
f32 f2;
f32 *t0;
f32 sp94[3][3];
max_interval = length - 1;
if (length < 4) {
/* not enough points in spline to perform catmull-rom interpolation*/
ml_vec3f_copy(sp94[0], arg4);
ml_vec3f_copy(sp94[1], arg4);
ml_vec3f_copy(sp94[2], arg4 + stride);
ml_vec3f_copy(sp94[2], &arg4[stride]);
if (length - 1 == 1) {
ml_vec3f_copy(sp94[3], arg4 + stride);
ml_vec3f_copy(sp94[3], &arg4[stride]);
} else {
ml_vec3f_copy(sp94[3], arg4 + 2*stride);
ml_vec3f_copy(sp94[3], &arg4[stride*2]);
}
func_80340BE4(x, 4, 3, 3, sp94, dst);
func_80340BE4(x, 4, 3, 3, (f32 *) sp94, dst);
return;
}
temp_f2 = func_80340700(x, 0.0f, 1.0f) * max_interval;
var_a3 = (s32)temp_f2;
var_a3 = ((length - 1) < var_a3) ? (length - 1) : var_a3;
x = temp_f2 - (f32) var_a3;
if (0 == var_a3) {
/* desired point in interval[0,1], duplicate P0 to left */
arg4 = arg4 + 0;
for(var_a3 = var_a3; var_a3 < width; var_a3++){
f3 = -0.5*arg4[var_a3] + 1.5*arg4[var_a3] + -1.5*arg4[stride + var_a3] + 0.5*arg4[2*stride + var_a3];
f1 = 1.0*arg4[var_a3] + -2.5*arg4[var_a3] + 2.0*arg4[stride + var_a3] + -0.5*arg4[2*stride + var_a3];
f2 = -0.5*arg4[var_a3] + 0.0*arg4[var_a3] + 0.5*arg4[stride + var_a3] + 0.0*arg4[2*stride + var_a3];
dst[var_a3] = ((((f3 * x) + f1)* x + f2) * x) + (1.0*arg4[var_a3]);
}
return;
a3 = temp_f2;
if (a3 > (length - 1)) {
a3 = (length - 1);
}
spD0 = var_a3 - 1;
if (length == (var_a3 + 1)) {
arg4 = arg4 + spD0*stride;
for(var_a3 = 0; var_a3 < width; var_a3++){
/* desired point in interval[n, inf], linearly interpret */
dst[var_a3] = arg4[var_a3];
}
} else if (length == (spD0 + 2)) {
/* desired point in interval[n-1, n], duplicate Pn to right */
for(var_a3 = 0; var_a3 < width; var_a3++){
f3 = -0.5*arg4[spD0*stride + var_a3] + 1.5*arg4[(spD0 + 1)* stride + var_a3] + -1.5*arg4[(spD0 + 2)* stride + var_a3] + 0.5*arg4[(spD0 + 2)* stride + var_a3];
f1 = 1.0*arg4[spD0*stride + var_a3] + -2.5*arg4[(spD0 + 1)* stride + var_a3] + 2.0*arg4[(spD0 + 2)* stride + var_a3] + -0.5*arg4[(spD0 + 2)* stride + var_a3];
f2 = -0.5*arg4[spD0*stride + var_a3] + 0.0*arg4[(spD0 + 1)* stride + var_a3] + 0.5*arg4[(spD0 + 2)* stride + var_a3] + 0.0*arg4[(spD0 + 2)* stride + var_a3];
dst[var_a3] = ((((f3 * x) + f1)* x + f2) * x) + (1.0*arg4[((spD0 + 1) * stride) + var_a3]);
x = temp_f2 - a3;
if (a3 == 0) {
/* desired point in interval[0,1], duplicate P0 to left */
t0 = arg4;
t0 += (stride * 2);
for (; a3 < width; a3++) {
f3 = -0.5*arg4[a3] + 1.5*arg4[a3] + -1.5*arg4[stride + a3] + 0.5*t0[a3];
f1 = 1.0*arg4[a3] + -2.5*arg4[a3] + 2.0*arg4[stride + a3] + -0.5*t0[a3];
if (1);
f2 = -0.5*arg4[a3] + 0.0*arg4[a3] + 0.5*arg4[stride + a3] + 0.0*t0[a3];
dst[a3] = (1.0*arg4[a3]) + (((f3 * x + f1) * x + f2) * x);
}
} else {
/* normal conditions */
for(var_a3 = 0; var_a3 < width; var_a3++){
f3 = -0.5*arg4[spD0*stride + var_a3] + 1.5*arg4[(spD0 + 1)*stride + var_a3] + -1.5*arg4[(spD0 + 2)* stride + var_a3] + 0.5*arg4[(spD0 + 3)* stride + var_a3];
f1 = 1.0*arg4[spD0*stride + var_a3] + -2.5*arg4[(spD0 + 1)*stride + var_a3] + 2.0*arg4[(spD0 + 2)* stride + var_a3] + -0.5*arg4[(spD0 + 3)* stride + var_a3];
f2 = -0.5*arg4[spD0*stride + var_a3] + 0.0*arg4[(spD0 + 1)*stride + var_a3] + 0.5*arg4[(spD0 + 2)* stride + var_a3] + 0.0*arg4[(spD0 + 3)* stride + var_a3];
// var_f8 =
dst[var_a3] = ((((f3 * x) + f1)* x + f2) * x) + (1.0*arg4[(spD0 + 1)*stride + var_a3]);
a3--;
if (a3 == length - 2) {
arg4 += stride * (length - 1);
for (a3 = 0; a3 < width; a3++) {
/* desired point in interval[n, inf], linearly interpret */
dst[a3] = arg4[a3];
}
} else if (a3 == length - 3) {
/* desired point in interval[n-1, n], duplicate Pn to right */
arg4 += a3 * stride;
t0 = arg4;
t0 += (stride * 2);
for (a3 = 0; a3 < width; a3++) {
f3 = -0.5*arg4[a3] + 1.5*arg4[stride + a3] + -1.5*t0[a3] + 0.5*t0[a3];
f1 = 1.0*arg4[a3] + -2.5*arg4[stride + a3] + 2.0*t0[a3] + -0.5*t0[a3];
f2 = -0.5*arg4[a3] + 0.0*arg4[stride + a3] + 0.5*t0[a3] + 0.0*t0[a3];
dst[a3] = (1.0*arg4[stride + a3]) + (((f3 * x + f1) * x + f2) * x);
}
} else {
/* normal conditions */
arg4 += a3 * stride;
t0 = arg4;
t0 += (stride * 2);
for (a3 = 0; a3 < width; a3++) {
f3 = -0.5*arg4[a3] + 1.5*arg4[stride + a3] + -1.5*t0[a3] + 0.5*arg4[stride*3 + a3];
f1 = 1.0*arg4[a3] + -2.5*arg4[stride + a3] + 2.0*t0[a3] + -0.5*arg4[stride*3 + a3];
f2 = -0.5*arg4[a3] + 0.0*arg4[stride + a3] + 0.5*t0[a3] + 0.0*arg4[stride*3 + a3];
dst[a3] = (1.0*arg4[stride + a3]) + (((f3 * x + f1) * x + f2) * x);
}
}
}
}
#endif
void func_80341180(f32 arg0, s32 arg1, s32 arg2, f32 arg3[3], f32 arg4[3]){
func_80340BE4(arg0, arg1, arg2, arg2, arg3, arg4);
}
#ifndef NONMATCHING
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B9770/func_803411B0.s")
#else
void func_803411B0(void) {
void func_803411B0(void){
s32 spE4;
s32 spE0;
s32 a0;
Struct_glspline_803411B0 *spD8;
s32 spCC[3];
s32 spC8;
s32 spC4;
s32 padding[3];
struct56s *spB4;
SplineList *spA8;
struct56s *spA4;
Union_glspline *sp80;
Struct_glspline_803411B0 *sp50;
Union_glspline *temp_s6;
Struct_glspline_803411B0 *spline;
Union_glspline *var_s0_2;
SplineList *spA8;
f32 *spA4;
Union_glspline *var_s1_2;
s32 temp_v0_2;
s32 var_a0;
s32 var_a0_3;
s32 var_a0_4;
s32 var_a0_5;
s32 var_fp;
s32 var_s0;
s32 var_s2;
s32 var_s2_2;
Union_glspline sp80;
s32 var_s5;
s32 var_s7;
s32 var_v1;
u32 var_s7;
Union_glspline *temp_s3_2;
Union_glspline *temp_v0_16;
Struct_glspline_803411B0 *temp_v0_17;
Struct_glspline_803411B0 *var_v0_4;
s16 *i_ptr;
s32 tmp;
D_80371E80 = 0;
D_80371E70 = malloc(0);
D_80371E74 = malloc(0);
D_80371E78 = 0;
D_803858A0 = (s16 *) malloc(0x80*sizeof(s16));
for(var_v1 = 0; var_v1 < 0x80; var_v1++){
D_803858A0[var_v1] = 0;
D_803858A0 = malloc(128 * sizeof(s16));
for (spE0 = 0; spE0 < 128; spE0++) {
D_803858A0[spE0] = 0;
}
spE4 = func_80307E1C(D_803858A0) + 1;
if (spE4 > 1) {
spD8 = (Struct_glspline_803411B0 *)malloc(spE4 * sizeof(Struct_glspline_803411B0));
for(var_a0 = 0; var_a0 < spE4; var_a0++){
spD8[var_a0].unk0 = -1;
spE4 = func_80307E1C() + 1;
if (spE4 <= 1) {
return;
}
spD8 = (Struct_glspline_803411B0 *) malloc(spE4 * sizeof(Struct_glspline_803411B0));
for (spE0 = 0; spE0 < spE4; spE0++) {
(spD8 + spE0)->unk0 = -1;
}
func_80307EA8(0, spCC, &spC8, &spC4);
do {
spE0 = func_80307EA8(1, spCC, &spC8, &spC4);
if (spE0 >= 0) {
(spD8+spE0)->unk0 = spC8;
(spD8+spE0)->unk8_13 = spC4;
(spD8+spE0)->unk2[0] = spCC[0];
(spD8+spE0)->unk2[1] = spCC[1];
(spD8+spE0)->unk2[2] = spCC[2];
}
} while (spE0 >= 0);
for (spE0 = 1; spE0 < spE4; spE0++) {
(spD8+spE0)->unk8_15 = 0;
func_80307EA8(0, spCC, &spC8, &spC4);
do {
temp_v0_2 = func_80307EA8(1, spCC, &spC8, &spC4);
if (temp_v0_2 >= 0) {
spD8[temp_v0_2].unk0 = (s16) spC8;
spD8[temp_v0_2].unk2[0] = (s16) spCC[0];
spD8[temp_v0_2].unk2[1] = (s16) spCC[1];
spD8[temp_v0_2].unk2[2] = (s16) spCC[2];
spD8[temp_v0_2].unk8_13 = spC4;
}
} while (temp_v0_2 >= 0);
for(spE0 = 1; spE0 < spE4; spE0++) {
spD8[spE0].unk8_15 = 0;
if ((spD8[spE0].unk0 >= spE4) || (spD8[spE0].unk0 == -1)) {
spD8[spE0].unk0 = 0;
}
if ((spD8+spE0)->unk0 >= spE4 || (spD8+spE0)->unk0 == -1) {
(spD8+spE0)->unk0 = 0;
}
}
for(spE0 = 1; spE0 < spE4; spE0++) {
if (spD8[spE0].unk0 > 0) {
spD8[spD8[spE0].unk0].unk8_15 = 1;
}
for (spE0 = 1; spE0 < spE4; spE0++) {
if ((spD8+spE0)->unk0 > 0) {
(spD8+(spD8+spE0)->unk0)->unk8_15 = 1;
}
}
for(spE0 = 1; spE0 < spE4; spE0++) {
if( (spD8[spE0].unk8_13 == 1)
&& ((spD8[spE0].unk8_15 != 0) || (spD8[spE0].unk0 <= 0))
&& ((spD8[spE0].unk8_15 != 1) || (spD8[spE0].unk0 <= 0))
&& ((spD8[spE0].unk8_15 != 1) || (spD8[spE0].unk0 != 0))
) {
func_8032DC70();
spD8[spE0].unk0 = -1;
spD8[spE0].unk8_13 = 0;
for (spE0 = 1; spE0 < spE4; spE0++) {
if ((spD8+spE0)->unk8_13 == 1
&& ((spD8+spE0)->unk8_15 != 0 || (spD8+spE0)->unk0 <= 0)
&& ((spD8+spE0)->unk8_15 != 1 || (spD8+spE0)->unk0 <= 0)
&& ((spD8+spE0)->unk8_15 != 1 || (spD8+spE0)->unk0 != 0)) {
func_8032DC70(spE0);
(spD8+spE0)->unk0 = -1;
(spD8+spE0)->unk8_13 = 0;
}
}
for (spE0 = 1; spE0 < spE4; spE0++) {
if ((spD8+spE0)->unk0 > 0 && (spD8+spE0)->unk8_15 == 0 && (spD8+spE0)->unk8_13 == 0) {
var_s5 = 1;
var_s7 = 1;
var_s0 = 0;
var_fp = 0;
for (; var_s5 < spE4; var_s5++) {
(spD8+var_s5)->unk8_14 = 0;
}
for (var_s5 = spE0; (spD8+var_s5)->unk0 != 0 && !(spD8+var_s5)->unk8_14; var_s5 = (spD8+var_s5)->unk0) {
(spD8+var_s5)->unk8_14 = 1;
tmp = (spD8+var_s5)->unk8_13 == 0 ? 1 : 0;
var_s7 += tmp;
var_s0 += ((spD8+var_s5)->unk8_13 == 0) ? 0 : 1;
}
tmp = var_s7 * 3;
spB4 = (struct56s *) malloc(8 + tmp * sizeof(f32));
spA4 = (f32 *) spB4;
spB4->unk0 = var_s7;
spB4->unk4 = 0;
spA8 = (SplineList *) malloc(4 + var_s0 * sizeof(Union_glspline));
spA8->unk0 = var_s0;
var_s1_2 = &spA8->spline[0];
a0 = spE0;
var_s2 = spA8->unk0;
for (; var_s2 != 0; a0 = (spD8+a0)->unk0) {
if (0);
if ((spD8+a0)->unk8_13 == 1) {
temp_v0_16 = func_803080C8(a0);
temp_v0_16->t1.unk8.pad_bit7 = D_80371E78;
memcpy(var_s1_2, temp_v0_16, sizeof(Union_glspline));
var_s1_2++;
var_s2--;
}
}
}
for(spE0 = 1; spE0 < spE4; spE0++) {
if (spD8[spE0].unk0 > 0) {
if (spD8[spE0].unk8_15 == 0) {
if (!spD8[spE0].unk8_13) {
var_s7 = 1;
var_s0 = 0;
var_fp = 0;
for(var_s5 = 1; var_s5 < spE4; var_s5++){
spD8[var_s5].unk8_14 = 0;
}
temp_s3_2 = spA8->unk0 - 1 + spA8->spline;
var_v0_4 = &spD8[spE0];
while ((var_v0_4->unk0 != 0) && !(var_v0_4->unk8_14)) {
var_v0_4->unk8_14 = 1;
var_s7 += (var_v0_4->unk8_13 == 0) ? 1 : 0;
var_s0 += (var_v0_4->unk8_13 == 0) ? 0 : 1;
var_v0_4 = &spD8[var_v0_4->unk0];
}
do {
var_s2 = 0;
spB4 = (struct56s *) malloc(sizeof(struct56s) + (var_s7 * 3* sizeof(f32)));
spB4->unk0 = var_s7;
spB4->unk4 = 0;
spA8 = (SplineList *)malloc(sizeof(SplineList) + var_s0*sizeof(Union_glspline));
spA8->unk0 = var_s0;
var_s1_2 = &spA8->spline[0];
var_s2 = var_s0;
for(var_a0_4 = spE0; (var_s2 != 0); var_a0_4 = spD8[var_a0_4].unk0){
if (spD8[var_a0_4].unk8_13 == 1) {
temp_v0_16 = func_803080C8();
temp_v0_16->t1.unk8.pad_bit7 = (s8) D_80371E78;
memcpy(var_s1_2, temp_v0_16, 0x14);
var_s1_2++;
var_s2--;
}
}
temp_s6 = &spA8->spline[0];
temp_s3_2 = &spA8->spline[spA8->unk0];
var_s2_2 = 0;
do {
for(var_s0_2 = temp_s6; var_s0_2 < temp_s3_2; var_s0_2++){
if ((var_s0_2 + 1)->common.unk0 < var_s0_2->common.unk0) {
memcpy(sp80, var_s0_2, sizeof(Union_glspline));
memcpy(var_s0_2, var_s0_2 + 1, sizeof(Union_glspline));
memcpy(var_s0_2 + 1, sp80, sizeof(Union_glspline));
var_s2_2++;
}
}
} while (var_s2_2 != 0);
while(var_s7 != 0){
temp_v0_17 = &spD8[spE0];
if (!(temp_v0_17->unk8_13)) {
spB4->unk8[var_fp][0] = (f32) temp_v0_17->unk2[0];
spB4->unk8[var_fp][1] = (f32) temp_v0_17->unk2[1];
spB4->unk8[var_fp][2] = (f32) temp_v0_17->unk2[2];
var_s7--;
}
}
func_80341BC8(spB4, spA8);
for (var_s0_2 = &spA8->spline[0]; var_s0_2 < temp_s3_2; var_s0_2++) {
var_s1_2 = var_s0_2 + 1;
if (var_s0_2->common.unk0 > var_s1_2->common.unk0) {
memcpy(&sp80, var_s0_2, sizeof(Union_glspline));
memcpy(var_s0_2, var_s1_2, sizeof(Union_glspline));
memcpy(var_s1_2, &sp80, sizeof(Union_glspline));
var_s2++;
}
}
} while (var_s2);
a0 = var_s7;
for (var_s5 = spE0; a0 != 0; var_s5 = (spD8 + var_s5)->unk0) {
if (!(spD8 + var_s5)->unk8_13) {
spA4[var_fp + 2] = (spD8 + var_s5)->unk2[0];
spA4[var_fp + 3] = (spD8 + var_s5)->unk2[1];
spA4[var_fp + 4] = (spD8 + var_s5)->unk2[2];
var_fp += 3;
a0--;
}
}
func_80341BC8(spB4, spA8);
}
free(spD8);
}
free(spD8);
}
#endif
//glspline_free
void func_80341A54(void) {

View File

@@ -4,7 +4,7 @@
#include "core2/code_C9E70.h"
struct FF_StorageStruct *D_8037DCB8;
extern struct FF_StorageStruct *D_8037DCB8;
void func_80350E00(void){
quizQuestionAskedBitfield_defrag();

View File

@@ -15,7 +15,7 @@ extern u8 crc_ROM_START[];
// bk_boot segment crc next word
s32 D_803727F0 = 0;
s32 core2_D_803727F4 = CORE2_CODE_CRC2;
s32 D_803727F4 = CORE2_CODE_CRC2;
s32 D_803727F8 = 0;
s32 D_803727FC = 0;

View File

@@ -14,8 +14,8 @@ enum transformation_e D_8037C2D0;
f32 D_8037C2D8[3];
f32 D_8037C2E4;
enum asset_e D_8037C2E8;
u8 D_8037C2ED;
u8 D_8037C2EC;
u8 D_8037C2ED;
struct{
f32 unk0;

View File

@@ -41,7 +41,6 @@ s32 D_8037D940;
f32 D_8037D948[3];
f32 cameraPosition[3];
f32 cameraRotation[3];
f32 D_8037D96C;
f32 D_8037D974;
f32 D_8037D978;
f32 D_8037D97C;
@@ -188,7 +187,7 @@ void func_802BCA58(void) {
player_getPosition(player_position);
ml_vec3f_diff_copy(sp34, player_position, cameraPosition);
sp4C = player_getYaw();
sp48 = ml_map_f(mlAbsF((f32) (mlNormalizeAngle(D_8037D96C - sp4C) - 180.0)), 0.0f, 180.0f, D_8037D97C, D_8037D980);
sp48 = ml_map_f(mlAbsF((f32) (mlNormalizeAngle(cameraRotation[1] - sp4C) - 180.0)), 0.0f, 180.0f, D_8037D97C, D_8037D980);
func_80256E24(D_8037D9A8, 0.0f, sp4C, 0.0f, 0.0f, ml_map_f(gu_sqrtf(sp34[0]*sp34[0] + sp34[2]*sp34[2]), 300.0f, 450.0f, 0.0f, sp48));
ml_vec3f_diff_copy(sp34, D_8037D9A8, D_8037D9B8);
if (func_802BC428()) {