core2/code_6A4B0.c progress

This commit is contained in:
Banjo Kazooie
2022-09-19 23:23:17 -05:00
parent f60c4b5fc9
commit ee6cd85a97
8 changed files with 568 additions and 44 deletions

View File

@@ -9,7 +9,7 @@
</mask> </mask>
<g mask="url(#anybadge_1)"> <g mask="url(#anybadge_1)">
<path fill="#555" d="M0 0h44v20H0z"/> <path fill="#555" d="M0 0h44v20H0z"/>
<path fill="#40e000" d="M44 0h67v20H44z"/> <path fill="#3fe000" d="M44 0h67v20H44z"/>
<path fill="url(#b)" d="M0 0h111v20H0z"/> <path fill="url(#b)" d="M0 0h111v20H0z"/>
</g> </g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"> <g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
@@ -17,7 +17,7 @@
<text x="22.0" y="14">core2</text> <text x="22.0" y="14">core2</text>
</g> </g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"> <g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<text x="78.5" y="15" fill="#010101" fill-opacity=".3">85.7709%</text> <text x="78.5" y="15" fill="#010101" fill-opacity=".3">85.9898%</text>
<text x="77.5" y="14">85.7709%</text> <text x="77.5" y="14">85.9898%</text>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -17,7 +17,7 @@
<text x="75.0" y="14">Banjo-Kazooie (us.v10)</text> <text x="75.0" y="14">Banjo-Kazooie (us.v10)</text>
</g> </g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"> <g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<text x="184.5" y="15" fill="#010101" fill-opacity=".3">87.0074%</text> <text x="184.5" y="15" fill="#010101" fill-opacity=".3">87.1330%</text>
<text x="183.5" y="14">87.0074%</text> <text x="183.5" y="14">87.1330%</text>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -579,7 +579,7 @@ s32 func_802E48D8(void){
if( !level_get() ) if( !level_get() )
return NULL; return NULL;
func_80343F3C(); glspline_defrag();
func_80288470(); func_80288470();
func_802F1320(); func_802F1320();
func_802BA128(); func_802BA128();

View File

@@ -2,23 +2,194 @@
#include "functions.h" #include "functions.h"
#include "variables.h" #include "variables.h"
extern s16 D_803A5D00[2][0xF660];
typedef struct {
void *unk0;
void *unk4;
s32 unk8;
void (*unkC)(void);
s32 unk10;
}Struct_Core2_6A4B0_2;
typedef struct {
s16 unk0[3];
}Struct_Core2_6A4B0_1;
typedef struct {
u8 pad0[0x8];
u16 *unk8;
u8 padC[4];
s32 unk10;
}Struct_Core2_6A4B0_0;
s32 func_802F1804(s32 *arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4);
void func_802F18B8(Struct_Core2_6A4B0_2 *arg0);
/* .data */
extern Gfx D_803689D0[];
extern s32 D_80368A10[2][3];
extern s32 D_80368A28[2][3];
#ifndef NONMATCHING
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_6A4B0/func_802F1440.s") #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_6A4B0/func_802F1440.s")
#else
void func_802F1440(Struct_Core2_6A4B0_0 *arg0, Gfx **gfx, Mtx **mtx, Vtx **vtx) {
Vtx *sp9C;
s32 sp54;
s32 sp50;
s32 sp4C;
Struct_Core2_6A4B0_1 *temp_v0_2;
s32 var_s3;
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_6A4B0/func_802F1804.s") if (arg0->unk10 == 0) {
func_8024C7B8(gfx, mtx);
}
gSPDisplayList((*gfx)++, D_803689D0);
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_6A4B0/func_802F1858.s") sp9C = *vtx;
for(sp4C = 0; sp4C < 6; sp4C++){
for(sp50 = 0; sp50 < 9; sp50++){
for(sp54 = 0; sp54 < 2; sp54++){
for(var_s3 = 0; var_s3 < 3; var_s3++){
temp_v0_2 = func_802F1804(arg0, sp50, sp4C, sp54, var_s3);
sp9C->v.ob[0] = temp_v0_2->unk0[0];
sp9C->v.ob[1] = temp_v0_2->unk0[1];
sp9C->v.ob[2] = temp_v0_2->unk0[2];
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_6A4B0/func_802F1884.s") sp9C->v.flag = 0;
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_6A4B0/func_802F18B8.s") sp9C->v.tc[0] = D_80368A10[sp54][var_s3];
sp9C->v.tc[1] = D_80368A28[sp54][var_s3];
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_6A4B0/func_802F18F0.s") sp9C->n.n[0] = -1;
sp9C->n.n[1] = -1;
sp9C->n.n[2] = -1;
sp9C->n.a = 0xFF;
sp9C++;
}
}
}
}
*vtx = sp9C;
var_s3 = 0;
gSPVertex((*gfx)++, osVirtualToPhysical(sp9C), 16, 0);
for(sp4C = 0; sp4C < 6; sp4C++){
for(sp50 = 0; sp50 < 9; sp50++){
gDPLoadTextureTile((*gfx)++, osVirtualToPhysical(&arg0->unk8[(sp4C*0x20 + 0xC) * D_80276588 + (sp50*0x20 + 1)]), G_IM_FMT_RGBA, G_IM_SIZ_16b, D_80276588, 0, 0, 0, 33, 33, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
for(sp54 = 0; sp54 < 2; sp54++){
gSP1Triangle((*gfx)++, var_s3, var_s3 + 1, var_s3 + 2, 0);
var_s3 += 3;
if (var_s3 == 0xF) {
sp9C += 0xF;
var_s3 = 0;
gSPVertex((*gfx)++, osVirtualToPhysical(sp9C), 16, 0);
}
}
}
}
if (arg0->unk10 == 0) {
func_8024C904(gfx, mtx);
}
}
#endif
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_6A4B0/func_802F1934.s") s32 func_802F1804(s32 *arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) {
return *arg0 + (arg1 * 0x24) + (arg2 * 0x144) + (arg3 * 0x12) + (arg4 * 6);
}
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_6A4B0/func_802F1A08.s") void func_802F1858(Struct_Core2_6A4B0_2 *arg0){
if(arg0->unkC != NULL){
arg0->unkC();
}
}
void func_802F1884(Struct_Core2_6A4B0_2 *arg0){
func_802F18B8(arg0);
free(arg0->unk0);
free(arg0);
}
void func_802F18B8(Struct_Core2_6A4B0_2 *arg0){
if(arg0->unk4 != NULL){
free(arg0->unk4);
arg0->unk4 = NULL;
}
}
Struct_Core2_6A4B0_2 *func_802F18F0(void){
Struct_Core2_6A4B0_2 *self;
self = (Struct_Core2_6A4B0_2 *) malloc(sizeof(Struct_Core2_6A4B0_2));
self->unk0 = malloc(0x798);
self->unk4 = 0;
self->unkC = 0;
self->unk10 = 0;
return self;
}
void func_802F1934(Struct_Core2_6A4B0_2 * arg0, s32 arg1){
func_802F18B8(arg0);
arg0->unk4 = malloc(D_80276588*D_8027658C*sizeof(u16) + 0x10);
arg0->unk8 = arg0->unk4;
while((arg0->unk8 & 0x10) == 0){
(arg0->unk8)++;
}
func_80253010(arg0->unk8, D_803A5D00[arg1], D_80276588*D_8027658C*sizeof(u16));
osWriteBackDCacheAll();
}
void func_802F1A08(s32 arg0) { }
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_6A4B0/func_802F1A10.s") #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_6A4B0/func_802F1A10.s")
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_6A4B0/func_802F1CAC.s") #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_6A4B0/func_802F1CAC.s")
// void func_802F1CAC(void *arg0) {
// s32 sp84[3];
// f32 sp78[3];
// s32 sp60;
// s32 *var_s1;
// s32 temp_lo;
// s32 temp_v0;
// s32 var_fp;
// s32 var_s0;
// s32 var_s4;
// s32 var_s5;
// s32 var_s6;
// s32 var_s7;
// void *temp_v0_2;
// void *var_s2;
// func_8024C5CC(sp78);
// var_fp = 0;
// sp84[0] = (s32) ((1000.0f - sp78[0]) - 200.0f);
// sp84[0] = (s32) ((0.0f - sp78[1]) + 300.0f);
// sp84[2] = (s32) ((2000.0f - sp78[2]) + 0.0f);
// for(var_s7 = 0; var_s7 < 6; var_s7++){
// var_s6 = 0;
// for(var_s5 = 0; var_s5 < 9; var_s5++){
// sp60 = 0;
// for(var_s4 = 0; var_s4 < 2; var_s4++){
// temp_v0 = sp60 * 4;
// var_s1 = temp_v0 + &D_80368A70;
// var_s2 = temp_v0 + &D_80368A88;
// var_s0 = 0;
// for(var_s0 = 0; var_s0 < 2; var_s0++){
// temp_v0_2 = func_802F1804(arg0, var_s5, var_s7, var_s4, var_s0);
// temp_lo = *var_s1 * 0x32;
// var_s1 += 4;
// var_s2 += 4;
// temp_v0_2->unk0 = (s16) (temp_lo + sp84 + var_s6);
// temp_v0_2->unk2 = (s16) ((sp88 - var_fp) - (var_s2->unk-4 * 0x32));
// temp_v0_2->unk4 = (s16) sp8C;
// }
// sp60 += 3;
// }
// var_s6 += 0x32;
// }
// var_fp += 0x32;
// }
// arg0->unkC = &func_802F1440;
// arg0->unk10 = 1;
// }

View File

@@ -10,6 +10,8 @@ extern f32 func_802EC920(BKVertexList *);
extern void func_802C39D4(void); extern void func_802C39D4(void);
extern bool func_80340020(s32, f32[3], f32[3], f32, s32, BKVertexList *, f32[3], f32[3]); extern bool func_80340020(s32, f32[3], f32[3], f32, s32, BKVertexList *, f32[3], f32[3]);
extern void func_80340200(s32, f32[3], f32[3], f32, s32, s32, BKVertexList *, s32); extern void func_80340200(s32, f32[3], f32[3], f32, s32, s32, BKVertexList *, s32);
extern s32 func_802E9DD8(BKCollisionList *collisionList, BKVertexList *vtxList, f32 arg2[3], f32 *arg3, f32 arg4, f32 arg5[3], f32 arg6, f32 arg7[3], s32 arg8);
extern f32 func_8030A590(void); extern f32 func_8030A590(void);
@@ -942,7 +944,11 @@ void func_8032EE80(Cube *cube) {
} }
} }
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_A5BC0/func_8032F170.s") s32 func_8032F170(Cube **arg0, void **arg1){
*arg0 = D_80383404;
*arg1 = D_80383408;
return D_8038340C;
}
#ifndef NONMATCHING #ifndef NONMATCHING
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_A5BC0/func_8032F194.s") #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_A5BC0/func_8032F194.s")
@@ -963,7 +969,7 @@ void func_8032F194(ActorMarker *marker, s32 position[3], Cube *cube) {
#ifndef NONMATCHING #ifndef NONMATCHING
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_A5BC0/func_8032F21C.s") #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_A5BC0/func_8032F21C.s")
#else #else
void func_8032F21C(Cube *cube, s32 position[3], ActorMarker *marker, bool arg3) { s32 func_8032F21C(Cube *cube, s32 position[3], ActorMarker *marker, bool arg3) {
ActorProp *sp1C; ActorProp *sp1C;
u8 temp_t0; u8 temp_t0;
u8 temp_t2; u8 temp_t2;
@@ -1776,7 +1782,91 @@ s32 func_80331638(Cube *cube, f32 arg1[3], f32 arg2[3], f32 arg3, f32 arg4[3], s
} }
#endif #endif
#ifndef NONMATCHING
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_A5BC0/func_803319C0.s") #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_A5BC0/func_803319C0.s")
#else
Struct66s *func_803319C0(Cube *arg0, f32 arg1[3], f32 arg2, s32 arg3, f32 arg4[3], u32 arg5) {
Struct66s *var_s7;
Struct66s *var_v0;
s32 var_s3;
Prop *var_s0;
var_s7 = NULL;
var_s0 = arg0->prop2Ptr;\
for (var_s3 = arg0->prop2Cnt; var_s3 != 0; var_s3--, var_s0++) {
if (!var_s0->markerFlag && var_s0->unk8_1 && var_s0->unk8_4) {
ModelProp *mProp = &var_s0->modelProp;
BKModelBin *temp_v0_2;
BKCollisionList *temp_v0_3;
temp_v0_2 = func_8030A4B4(mProp->unk0_31);
if (temp_v0_2 != NULL) {
temp_v0_3 = func_8033A084(temp_v0_2);
if (temp_v0_3 != NULL) {
f32 spAC[3];
f32 spA0[3];
spAC[0] = (f32) mProp->unk4[0];
spAC[1] = (f32) mProp->unk4[1];
spAC[2] = (f32) mProp->unk4[2];
spA0[0] = 0.0f;
spA0[1] = (f32) (mProp->unk0_15 * 2);
spA0[2] = (f32) (mProp->unk0_7 * 2);
var_v0 = func_802E9DD8(temp_v0_3, func_8033A148(temp_v0_2), spAC, spA0, ((f32) mProp->unkA) / 100.0, arg1, arg2, arg3, arg4);
if (var_v0 != NULL) {
var_s7 = var_v0;
}
}
}
} else if (var_s0->markerFlag && var_s0->unk8_3 && var_s0->unk8_4) {
ActorProp *aProp = &var_s0->actorProp;
BKModelBin *temp_v0_2;
BKCollisionList *temp_v0_3;
Actor *temp_v0_6;
BKVertexList *temp_a1;
temp_v0_2 = func_80330DE4(aProp->marker);
if (temp_v0_2 != NULL) {
temp_v0_3 = func_8033A084(temp_v0_2);
if (temp_v0_3 != NULL) {
f32 sp88[3];
f32 sp7C[3];
temp_v0_6 = marker_getActor(aProp->marker);
temp_a1 = func_80330C74(temp_v0_6);
sp88[0] = (f32) aProp->x;
sp88[1] = (f32) aProp->y;
sp88[2] = (f32) aProp->z;
sp7C[0] = aProp->marker->pitch;
sp7C[1] = aProp->marker->yaw;
sp7C[2] = aProp->marker->roll;
var_v0 = func_802E9DD8(temp_v0_3, temp_a1, sp88, sp7C, temp_v0_6->scale, arg1, arg2, arg3, arg4);
if (var_v0 != 0) {
var_s7 = var_v0;
}
}
}
} else if (var_s0->markerFlag) {
ActorProp *aProp = &var_s0->actorProp;
Struct6Cs *temp_v0_7;
temp_v0_7 = aProp->marker->unk18;
if (temp_v0_7 != NULL) {
if (temp_v0_7->unk8 != NULL) {
var_v0 = temp_v0_7->unk8(aProp->marker, arg1, arg2, arg3, arg4);
if (var_v0 != 0) {
var_s7 = var_v0;
}
}
}
}
}
return var_s7;
}
#endif
f32 func_80331D20(BKSprite *sprite) { f32 func_80331D20(BKSprite *sprite) {
BKSpriteFrame *frame; BKSpriteFrame *frame;

View File

@@ -67,16 +67,15 @@ BKMeshList *func_8033F2AC(BKModel *arg0){
return arg0->meshList_0; return arg0->meshList_0;
} }
#ifndef NONMATCHING
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B8080/func_8033F2B4.s")
#else
void func_8033F2B4(BKModel *model, s32 mesh_id, s16 arg2[3], s16 arg3[3]) { void func_8033F2B4(BKModel *model, s32 mesh_id, s16 arg2[3], s16 arg3[3]) {
s32 pad2C;
s32 pad28;
BKMesh *mesh; BKMesh *mesh;
Vtx *vtx_pool;
Vtx *i_vtx;
s16 *mesh_begin; s16 *mesh_begin;
s16 *mesh_end; s16 *mesh_end;
s16 *phi_t4; s16 *phi_t4;
Vtx *i_vtx;
Vtx *vtx_pool;
s32 i; s32 i;
mesh = func_802E9F9C(model->meshList_0, mesh_id); mesh = func_802E9F9C(model->meshList_0, mesh_id);
@@ -97,7 +96,6 @@ void func_8033F2B4(BKModel *model, s32 mesh_id, s16 arg2[3], s16 arg3[3]) {
} }
} }
} }
#endif
//return mesh id "position" is over/under //return mesh id "position" is over/under
s32 func_8033F3C0(BKModel *model, f32 position[3]){ s32 func_8033F3C0(BKModel *model, f32 position[3]){

View File

@@ -9,16 +9,13 @@ extern bool func_80323240(struct56s *, f32, f32[3]);
extern f32 func_803234FC(struct56s *, f32, f32); extern f32 func_803234FC(struct56s *, f32, f32);
extern f32 func_80323540(struct56s *, f32, f32, f32); extern f32 func_80323540(struct56s *, f32, f32, f32);
extern f32 func_803237E8(struct56s *); extern f32 func_803237E8(struct56s *);
extern f32 func_80323F74(struct56s *, f32, f32);
extern f32 func_80323FDC(struct56s *, f32, f32, s32 *); extern f32 func_80323FDC(struct56s *, f32, f32, s32 *);
extern f32 func_803240E0(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_8032417C(struct56s *, f32, f32[3], f32[3]);
extern void func_80328FF0(Actor *, f32); extern void func_80328FF0(Actor *, f32);
extern struct56s **D_80371E70;
extern void **D_80371E74;
extern s32 D_80371E78;
extern s32 D_80371E7C;
extern s32 D_80371E80;
typedef struct { typedef struct {
@@ -208,6 +205,24 @@ typedef struct{
Union_glspline spline[]; Union_glspline spline[];
}glspline_list; }glspline_list;
typedef struct {
s16 unk0;
s16 unk2[3];
u16 unk8_15:1;
u16 unk8_14:1;
u16 unk8_13:1;
u16 pad8_12:13;
}Struct_glspline_803411B0;
s32 func_80341BC8(struct56s *arg0, glspline_list * arg1);
/* .data */
extern struct56s **D_80371E70;
extern glspline_list **D_80371E74;
extern s32 D_80371E78;
extern s32 D_80371E7C;
extern s32 D_80371E80;
/* .rodata */ /* .rodata */
extern char D_80378FF0[]; extern char D_80378FF0[];
extern f32 D_8037901C; extern f32 D_8037901C;
@@ -257,20 +272,237 @@ f32 func_80340A4C(f32 arg0, s32 arg1, f32 *arg2) {
void func_80340BE4(f32 arg0, s32 arg1, s32 arg2, s32 arg3, f32 * arg4, f32 arg5[3]); 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") #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B9770/func_80340BE4.s")
void func_80341180(f32 arg0, s32 arg1, s32 arg2, f32 * arg3, f32 arg4[3]){ void func_80341180(f32 arg0, s32 arg1, s32 arg2, f32 arg3[3], f32 arg4[3]){
func_80340BE4(arg0, arg1, arg2, arg2, arg3, arg4); func_80340BE4(arg0, arg1, arg2, arg2, arg3, arg4);
} }
#ifndef NONMATCHING
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B9770/func_803411B0.s") #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B9770/func_803411B0.s")
#else
void func_803411B0(void) {
s32 spE4;
s32 spE0;
Struct_glspline_803411B0 *spD8;
s32 spCC[3];
s32 spC8;
s32 spC4;
struct56s *spB4;
glspline_list *spA8;
struct56s *spA4;
Union_glspline *sp80;
Struct_glspline_803411B0 *sp50;
Union_glspline *temp_s6;
Union_glspline *var_s0_2;
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;
s32 var_s5;
s32 var_s7;
s32 var_v1;
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;
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B9770/func_80341A54.s") 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;
}
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;
}
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B9770/func_80341BA0.s")
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B9770/func_80341BC8.s") 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);
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B9770/func_80341C78.s") for(spE0 = 1; spE0 < spE4; spE0++) {
spD8[spE0].unk8_15 = 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].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].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;
}
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];
}
spB4 = (struct56s *) malloc(sizeof(struct56s) + (var_s7 * 3* sizeof(f32)));
spB4->unk0 = var_s7;
spB4->unk4 = 0;
spA8 = (glspline_list *)malloc(sizeof(glspline_list) + 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);
}
}
}
}
free(spD8);
}
}
#endif
//glspline_free
void func_80341A54(void) {
s32 var_s0;
for(var_s0 = 0; var_s0 < 0x40; var_s0++){
if (D_803858A0[var_s0] != 0) {
func_8030DA44(D_803858A0[var_s0]);
}
}
for(var_s0 = 0x40; var_s0 < 0x80; var_s0++){
if (D_803858A0[var_s0] != 0) {
func_8025A7DC(func_80255D30(D_803858A0[var_s0]));
}
}
for(var_s0 = 0; var_s0 < D_80371E78; var_s0++){
free(D_80371E70[var_s0]);
free(D_80371E74[var_s0]);
}
free(D_80371E70);
free(D_80371E74);
free(D_803858A0);
D_80371E70 = NULL;
D_80371E74 = NULL;
D_80371E78 = 0;
D_803858A0 = NULL;
}
void func_80341BA0(void){
func_80341A54();
func_803411B0();
}
s32 func_80341BC8(struct56s *arg0, glspline_list * arg1) {
s32 temp_t7;
void *temp_v0;
void *temp_v0_2;
D_80371E78++;
D_80371E70 = (struct56s **)realloc(D_80371E70, D_80371E78 * sizeof(struct56s *));
D_80371E70[D_80371E78 - 1] = arg0;
D_80371E74 = (glspline_list **)realloc(D_80371E74, D_80371E78 * sizeof(glspline_list *));
D_80371E74[D_80371E78 - 1] = arg1;
return D_80371E78 - 1;
}
s32 func_80341C78(s32 arg0[3]) {
struct56s *temp_a0;
s32 var_a3;
s32 var_v1;
f32 *var_a2;
f32 sp4[3];
sp4[0] = (f32) arg0[0];
sp4[1] = (f32) arg0[1];
sp4[2] = (f32) arg0[2];
for(var_v1 = 0; var_v1 < D_80371E78; var_v1++){
temp_a0 = D_80371E70[var_v1];
var_a2 = temp_a0->unk8;
for (var_a3 = 0; var_a3 < temp_a0->unk0; var_a3++) {
if( (sp4[0] == var_a2[0]) && (sp4[1] == var_a2[1]) && (sp4[2] == var_a2[2])) {
return var_v1;
}
var_a2+=3;
}
}
return -1;
}
#ifndef NONMATCHING #ifndef NONMATCHING
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B9770/func_80341D5C.s") #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B9770/func_80341D5C.s")
@@ -308,15 +540,46 @@ s32 func_80341D5C(s32 arg0[3], s32 arg1[3]){
} }
#endif #endif
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B9770/func_80341EC4.s") s32 func_80341EC4(f32 arg0[3]){
s32 sp1C[3];
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B9770/func_80341EF0.s") ml_vec3f_to_vec3w(sp1C, arg0);
return func_80341C78(sp1C);
}
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B9770/func_80341F2C.s") struct56s *func_80341EF0(f32 arg0[3]){
s32 sp1C[3];
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B9770/func_80341F64.s") ml_vec3f_to_vec3w(sp1C, arg0);
return D_80371E70[func_80341C78(sp1C)];
}
#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B9770/func_80341FB0.s") s32 func_80341F2C(s32 arg0){
s32 sp1C[3];
if(!func_80304DD0(arg0, sp1C)){
return -1;
}
return func_80341C78(sp1C);
}
struct56s *func_80341F64(s32 arg0){
s32 sp1C[3];
if(!func_80304DD0(arg0, sp1C)){
return NULL;
}
return D_80371E70[func_80341C78(sp1C)];
}
f32 func_80341FB0(s32 arg0, f32 arg1, s32 arg2, f32 arg3) {
f32 sp1C;
if (arg0 == -1) {
return arg1;
}
sp1C = func_80323F74(D_80371E70[arg0], arg1, arg3);
func_80323240(D_80371E70[arg0], sp1C, arg2);
return sp1C;
}
struct56s *func_80342038(s32 indx){ struct56s *func_80342038(s32 indx){
if(indx == -1) if(indx == -1)
@@ -952,22 +1215,22 @@ struct56s *func_80343F00(s32 indx, f32 arg1[3]){
return out; return out;
} }
void func_80343F3C(void) { void glspline_defrag(void) {
s32 i; s32 i;
if (D_80371E70 != 0) { if (D_80371E70 != 0) {
D_80371E70 = (struct56s *)defrag(D_80371E70); D_80371E70 = (struct56s **) defrag(D_80371E70);
} }
if (D_80371E74 != 0) { if (D_80371E74 != 0) {
D_80371E74 = defrag(D_80371E74); D_80371E74 = (glspline_list **) defrag(D_80371E74);
} }
if (D_803858A0 != 0) { if (D_803858A0 != 0) {
D_803858A0 = defrag(D_803858A0); D_803858A0 = (s16 *) defrag(D_803858A0);
} }
for(i = 0; i < D_80371E78; i++){ for(i = 0; i < D_80371E78; i++){
D_80371E74[i] = defrag(D_80371E74[i]); D_80371E74[i] = (glspline_list *) defrag(D_80371E74[i]);
D_80371E70[i] = defrag(D_80371E70[i]); D_80371E70[i] = (struct56s *) defrag(D_80371E70[i]);
} }
} }

View File

@@ -21,6 +21,7 @@ u8 D_80385FF0[0xB];
f32 D_80386000[0xE]; //timescores f32 D_80386000[0xE]; //timescores
s32 D_80386038; s32 D_80386038;
/* .code */
void func_80345EB0(enum item_e item){ void func_80345EB0(enum item_e item){
if(func_802FAFE8(item)){ if(func_802FAFE8(item)){
func_803463D4(item, (s32)(-time_getDelta()*60.0f * 1.1)); func_803463D4(item, (s32)(-time_getDelta()*60.0f * 1.1));
@@ -60,6 +61,7 @@ s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){\
s32 sp24; //without this var newVal is too high, but sp1C is correct s32 sp24; //without this var newVal is too high, but sp1C is correct
s32 newVal; s32 newVal;
oldVal = D_80385F30[item]; oldVal = D_80385F30[item];
if(func_80255D04()) if(func_80255D04())
@@ -127,7 +129,7 @@ s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){\
bs_checkInterrupt(BS_INTR_11_DROWN); bs_checkInterrupt(BS_INTR_11_DROWN);
D_80385FE4 = 1; D_80385FE4 = 1;
} }
if(sp2C && sp30 != sp2C ){ if(sp2C != 0 && sp30 != sp2C ){
if(sp2C < sp30){ if(sp2C < sp30){
func_8025A6EC(SFX_AIR_METER_DROPPING, 28000); func_8025A6EC(SFX_AIR_METER_DROPPING, 28000);
} }