Document: load level from file related code

This commit is contained in:
Dominik Peters 2024-11-03 17:11:18 +00:00 committed by Banjo Kazooie
parent 819ba6b9ce
commit d842151114
22 changed files with 527 additions and 523 deletions

View File

@ -326,7 +326,7 @@ typedef union prop_s
SpriteProp spriteProp;
ModelProp modelProp;
struct{
u8 pad0[4];
u32 pad0;
s16 unk4[3];
// s16 unk6;
s16 pad8_15: 10;
@ -348,38 +348,31 @@ typedef struct {
u16 bit0: 1;
u16 unk8; //actor_id?
u8 unkA; //marker_id
struct {
u8 pad_bit7: 2;
u8 bit5: 1;
u8 bit4: 1;
u8 pad_bit3: 3;
u8 bit0: 1;
}unkB;
// u8 padB[1];
u32 unkC_31:9; //yaw???
u32 unkC_22:23;
u32 unk10_31 : 12;
u32 unk10_19 : 12;
u32 unk10_7 : 1;
u32 unk10_6 : 1;
u32 pad10_5 : 4;
u32 unk10_0 : 2;
} NodeProp;
u8 padB;
u32 yaw: 9; // unkC_31
u32 scale: 23; // unkC_22
u32 unk10_31: 12; // unk10_31 and unk10_19 seem to be related
u32 unk10_19: 12; // unk10_31 and unk10_19 seem to be related
u32 pad10_7: 1;
u32 unk10_6: 1; // isInitialized flag?
u32 pad10_5: 4;
u32 unk10_0: 2; // is only for used in func_803303B8
} NodeProp; // size = 20 (0x14) bytes
typedef struct {
u8 pad0[0x4];
u32 pad4_31:14;
u32 unk4_17:2;
u32 unk4_17:2; // only ever gets 0 written to it
u32 pad4_15:8;
u32 pad4_7:7;
u32 unk4_0:1;
u32 unk4_0:1; // if this and unkC_0 is false then unk10_4 and unk4_17 are set to 0
u8 pad8[0x4];
u32 padC_31:31;
u32 unkC_0:1;
u32 unkC_0:1; // if this and unk4_0 is false then unk10_4 and unk4_17 are set to 0
u32 pad10_31:27;
u32 unk10_4:4;
u32 unk10_4:4; // only ever gets 0 written to it
u32 pad10_0:1;
} OtherNode; //can be inplace of NodeProp (see cube_fromFile)
} OtherNode; //can be inplace of NodeProp (see code7AF80_initCubeFromFile) size: 12 (0xC) bytes
typedef struct cude_s{
s32 x:5;

View File

@ -264,7 +264,7 @@ nodeprop_findByActorIdAndActorPosition = 0x80304dd8;
nodeprop_findByActorIdAndPosition_f32 = 0x80304e4c;
nodeprop_getPosition_s32 = 0x80304eec;
nodeprop_getPosition = 0x80304f08;
_nodeProp_findPositionFromActorId = 0x80304f70;
nodeprop_findPositionFromActorId = 0x80304f70;
func_80305248 = 0x803053e8;
func_80305344 = 0x803054e4;
func_803084F0 = 0x80308690;

View File

@ -10,7 +10,7 @@ extern void func_8030E9FC(enum sfx_e uid, f32 arg1, f32 arg2, u32 arg3, f32 arg4
extern void func_8030EA54(enum sfx_e uid, f32 arg1, f32 arg2, u32 arg3, f32 arg4[3], f32 arg5, f32 arg6);
extern void func_8031CE28(s32, s32, f32);
void timed_exitStaticCamera(f32);
extern int func_802E805C(BKCollisionList *, BKVertexList *, f32[3], s32, f32, s32, s32, s32, s32);
extern BKCollisionTri *func_802E805C(BKCollisionList *, BKVertexList *, f32[3], s32, f32, s32, s32, s32, s32);
extern void func_80340200(s32, f32[3], s32, f32, s32, s32, BKVertexList *, s32);
extern void func_802E9118(BKCollisionList *, BKVertexList *, f32[3], s32, f32, s32, s32, f32, s32, s32, s32);
extern void func_802E9DD8(BKCollisionList *, BKVertexList *, f32[3], s32, f32, s32, f32, s32, s32);
@ -57,18 +57,17 @@ struct {
f32 unk54;
}D_80389FA0;
s32 func_80388360(s32 arg0, s32 arg1, s32 arg2, s32 arg3){
s32 out_v0;
BKCollisionTri *__code1F70_func_80388360(s32 arg0, s32 arg1, s32 arg2, s32 arg3){
BKCollisionTri *out_v0;
out_v0 = func_802E805C(D_80389FA0.unk1C, D_80389FA0.unk40, D_80389FA0.unk28, 0, 1.0f, arg0, arg1, arg2, arg3);
if(out_v0 && func_8029453C()){
func_80340200(D_80389FA0.unk18, D_80389FA0.unk28, 0, 1.0f, 0, out_v0, D_80389FA0.unk40, arg1);
}
return out_v0;
}
void func_80388428(s32 arg0, s32 arg1, f32 arg2, s32 arg3, s32 arg4, s32 arg5){
void __code1F70_func_80388428(s32 arg0, s32 arg1, f32 arg2, s32 arg3, s32 arg4, s32 arg5){
func_802E9118(D_80389FA0.unk1C, D_80389FA0.unk40, D_80389FA0.unk28, 0, 1.0f, arg0, arg1, arg2, arg3, arg4, arg5);
}
@ -284,7 +283,7 @@ void func_80388D54(void){
D_80389FA0.unk28[0] = 5500.0f;
D_80389FA0.unk28[2] = 0.0f;
D_80389FA0.unk28[1] = 0.0f;
func_80320B24(func_80388360, func_80388428, func_803884A8);
func_80320B24(__code1F70_func_80388360, __code1F70_func_80388428, func_803884A8);
if(!nodeProp_findPositionFromActorId(0x3B, D_80389FA0.unkC)){
D_80389FA0.unkC[0] = 0.0f;
D_80389FA0.unkC[1] =-1e+06f;

View File

@ -387,8 +387,8 @@ void func_803895E0(void){
: cubeList_findNodePropByActorIdAndPosition_s32(D_80391DB8[i].unk0, D_80391DAC);
nodeprop_getPosition(s0, sp64);
f20 = (f32)func_80304DA8(s0);
f8 = (f32)func_80304DB8(s0);
f20 = (f32)nodeprop_getYaw(s0);
f8 = (f32)nodeprop_getScale(s0);
f22 = f8*0.01;
actor = actor_spawnWithYaw_f32(D_80391DB8[i].actor_id, sp64, (s32)f20);
actor->scale = f22;

View File

@ -212,7 +212,7 @@ void func_80391744(Actor *this, Actor* other){
f32 tmp_f0;
sp24 = nodeprop_findByActorIdAndActorPosition(0x22A, this);
tmp_f0 = (f32)func_80304DA8(sp24);
tmp_f0 = (f32)nodeprop_getYaw(sp24);
other->yaw = tmp_f0;
this->yaw = tmp_f0;
ml_vec3f_yaw_rotate_copy(sp28, sp34, tmp_f0);

View File

@ -26,6 +26,7 @@ static void __code336F0_func_802BA680(CameraNodeType1 *this, s32 arg1, s32 arg2)
static bool __code336F0_func_802BA6B0(CameraNodeType1 *this, s32 arg1) {
if (this->unknownFlag & arg1)
return TRUE;
return FALSE;
}
@ -123,6 +124,6 @@ void cameraNodeType1_fromFile(File *file_ptr, CameraNodeType1 *this) {
else if(!file_getNFloats_ifExpected(file_ptr, 4, this->pitchYawRoll, 3)) {
file_getWord_ifExpected(file_ptr, 5, &this->unknownFlag);
}
}//L802BAA0C
}
}
}

View File

@ -63,8 +63,8 @@ bool func_802BB720(s32 arg0, f32 arg1[3], f32 arg2[3], s32 *arg3) {
temp_v0 = cubeList_findNodePropByActorIdAndPosition_s32(D_803657E0[arg0], NULL);
if (temp_v0 != NULL) {
nodeprop_getPosition(temp_v0, arg1);
*arg3 = func_80304DB8(temp_v0);
temp_f6 = (f32) func_80304DA8(temp_v0) - 180.0f;
*arg3 = nodeprop_getScale(temp_v0);
temp_f6 = (f32) nodeprop_getYaw(temp_v0) - 180.0f;
arg2[0] = 0.0f;\
arg2[1] = mlNormalizeAngle(temp_f6);\
arg2[2] = 0.0f;

View File

@ -593,7 +593,7 @@ s32 game_defrag(void){
func_8028FB68();
partEmitMgr_defrag();
mapModel_defrag();
func_803086B4();
cubeList_defrag();
actorArray_defrag();
spawnQueue_defrag();
func_802F3300();

View File

@ -405,7 +405,7 @@ BKCollisionTri *func_802E76B0(BKCollisionList *collisionList, BKVertexList *vert
return result_collision;
}
int func_802E805C(BKCollisionList *collision_list, BKVertexList *vtxList, f32 arg2[3], f32 arg3[3], f32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8){
BKCollisionTri *func_802E805C(BKCollisionList *collision_list, BKVertexList *vtxList, f32 arg2[3], f32 arg3[3], f32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8){
f32 sp44[3];
f32 sp38[3];
int sp34;
@ -421,7 +421,7 @@ int func_802E805C(BKCollisionList *collision_list, BKVertexList *vtxList, f32 ar
mlMtx_apply_vec3f(sp38, arg6);
sp34 = func_802E76B0(collision_list, vtxList, sp44, sp38, arg7, arg8);
if(!sp34){
return 0;
return NULL;
}
else{
mlMtxIdent();
@ -736,10 +736,10 @@ BKCollisionTri *func_802E8E88(BKCollisionList *collision_list, BKVertexList *vtx
return phi_s5->tri_ptr;
}
s32 func_802E9118(BKCollisionList * collision_list, BKVertexList *vtx_list, f32 arg2[3], s32 arg3, f32 arg4, f32 arg5[3], f32 arg6[3], f32 arg7, f32 arg8[3], s32 arg9, s32 flagFilter) {
BKCollisionTri *func_802E9118(BKCollisionList * collision_list, BKVertexList *vtx_list, f32 arg2[3], s32 arg3, f32 arg4, f32 arg5[3], f32 arg6[3], f32 arg7, f32 arg8[3], s32 arg9, s32 flagFilter) {
f32 sp4C[3];
f32 sp40[3];
s32 sp3C;
BKCollisionTri *sp3C;
s32 i;
if (((f32)vtx_list->global_norm * arg4) <= (ml_vec3f_distance(arg6, arg2) - arg7)) {
@ -750,8 +750,8 @@ s32 func_802E9118(BKCollisionList * collision_list, BKVertexList *vtx_list, f32
mlMtx_apply_vec3f(&sp4C, arg5);
mlMtx_apply_vec3f(&sp40, arg6);
sp3C = func_802E8E88(collision_list, vtx_list, &sp4C, &sp40, arg7 / arg4, arg8, arg9, flagFilter);
if (sp3C == 0) {
return 0;
if (sp3C == NULL) {
return NULL;
}
mlMtxIdent();
func_80252C08(arg2, arg3, arg4, 0);
@ -973,21 +973,21 @@ BKCollisionTri *func_802E92AC(BKCollisionList *collisionList, BKVertexList *vert
return spD0;
}
s32 func_802E9DD8(BKCollisionList *collisionList, BKVertexList *vtxList, f32 posA[3], f32 *rotA, f32 scaleA, f32 posB[3], f32 radB, f32 arg7[3], s32 arg8) {
BKCollisionTri *func_802E9DD8(BKCollisionList *collisionList, BKVertexList *vtxList, f32 posA[3], f32 *rotA, f32 scaleA, f32 posB[3], f32 radB, f32 arg7[3], s32 arg8) {
f32 sp34[3];
s32 sp30;
BKCollisionTri *sp30;
s32 i;
// check if (sphere around vtx's) <= ((distance between origins) - (radius of B))
if ((vtxList->global_norm * scaleA) <= (ml_vec3f_distance(posB, posA) - radB)) {
return 0;
return NULL;
}
mlMtxIdent();
func_80252CC4(posA, rotA, scaleA, NULL);
mlMtx_apply_vec3f(sp34, posB);
sp30 = func_802E92AC(collisionList, vtxList, &sp34, radB / scaleA, arg7, arg8);
if (sp30 == 0) {
return 0;
return NULL;
}
mlMtxIdent();
func_80252C08(posA, rotA, scaleA, NULL);

View File

@ -54,7 +54,7 @@ bool func_8028DFF0(s32 arg0, s32 position[3]) {
return TRUE;
}
else{
return _nodeProp_findPositionFromActorId(func_803084F0(arg0), position);
return nodeprop_findPositionFromActorId(func_803084F0(arg0), position);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@ s32 D_80382460;
void func_8030C740(void){
f32 sp1C[3];
D_80382460 = 1;
if(_nodeProp_findPositionFromActorId(0x16, sp1C)){
if(nodeprop_findPositionFromActorId(0x16, sp1C)){
D_80382460 = 0;
}
}

View File

@ -168,13 +168,13 @@ void func_8031CD20(s32 arg0, s32 arg1, s32 arg2) {
func_8031CC8C(arg0, (arg1 << 8) + arg2);
}
void func_8031CD44(enum map_e arg0, s32 arg1, f32 arg2, f32 arg3, s32 arg4) {
void func_8031CD44(enum map_e arg0, s32 arg1, f32 arg2, f32 yaw, s32 arg4) {
f32 sp3C[3];
f32 sp30[3];
f32 sp24[3];
player_getPosition((f32 *) &sp3C);
func_80256E24(sp24, 0.0f, arg3, 0.0f, 0.0f, ml_map_f((f32) arg4, 0.0f, 200.0f, 10.0f, 800.0f));
func_80256E24(sp24, 0.0f, yaw, 0.0f, 0.0f, ml_map_f((f32) arg4, 0.0f, 200.0f, 10.0f, 800.0f));
sp24[0] = sp3C[0] + sp24[0];
sp24[1] = sp3C[1] + sp24[1];
sp24[2] = sp3C[2] + sp24[2];
@ -218,9 +218,9 @@ void func_8031CE70(f32 *arg0, enum map_e arg1, s32 arg2) {
func_8031CB50(arg1, arg2, 1);
func_8028F3D8(sp38, 1.0f, NULL, NULL);
} else if (phi_s0->unk8 == 0x185) {
func_8031CD44(arg1, arg2, sp38[1], (f32) phi_s0->unkC_31, phi_s0->unkC_22);
func_8031CD44(arg1, arg2, sp38[1], (f32) phi_s0->yaw, phi_s0->scale);
} else {
func_8031CD44(arg1, arg2, playerPos[1], (f32) phi_s0->unkC_31, phi_s0->unkC_22);
func_8031CD44(arg1, arg2, playerPos[1], (f32) phi_s0->yaw, phi_s0->scale);
}
return;
}

View File

@ -1935,7 +1935,7 @@ void func_8032A82C(Actor *arg0, s32 arg1) {
sp1C = &arg0->local;
sp24 = nodeprop_findByActorIdAndActorPosition(arg1, arg0);
if (sp24 != NULL) {
sp1C->unkC = func_80304DA8(sp24);
sp1C->unkC = nodeprop_getYaw(sp24);
nodeprop_getPosition(sp24, sp1C->unk0);
sp1C->unkE = func_80341EC4(sp1C);
}
@ -1973,8 +1973,8 @@ bool func_8032A9E4(s32 arg0, s32 arg1, s32 arg2) {
}
//actor_setScale
void func_8032AA58(Actor *this, f32 arg1){
this->scale = arg1;
void func_8032AA58(Actor *this, f32 scale){
this->scale = scale;
this->marker->unk14_10 = 0;
}

View File

@ -16,7 +16,7 @@ extern bool func_80340020(s32, f32[3], f32[3], f32, s32, BKVertexList *, f32[3],
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 void *func_802EBAE0(UNK_TYPE(s32), f32 position[3], f32 rotation[3], f32 scale, UNK_TYPE(s32), UNK_TYPE(s32), UNK_TYPE(s32), f32, UNK_TYPE(s32));
extern int func_802E805C(BKCollisionList *, BKVertexList *, f32[3], f32[3], f32, f32[3], f32[3], f32[3], u32);
extern BKCollisionTri *func_802E805C(BKCollisionList *, BKVertexList *, f32[3], f32[3], f32, f32[3], f32[3], f32[3], u32);
extern f32 func_8030A590(void);
extern void func_8030A5EC(Prop *, f32);
@ -24,7 +24,7 @@ extern void func_8030A5EC(Prop *, f32);
Prop *func_80303F7C(s32, f32, s32, s32);
s32 func_803058C0(f32);
void func_80305CD8(s32, s32);
void func_80330104(Cube*);
void code_A5BC0_initCubePropActorProp(Cube*);
ActorMarker * func_80332A60(void);
extern void func_8032F3D4(s32 [3], ActorMarker *, s32);
extern void func_8030A350(Gfx **, Mtx **, Vtx **, f32[3], f32, s32, Cube*,s32 ,s32, s32, s32, s32);
@ -161,7 +161,7 @@ void func_8032CB50(Cube *cube, bool global) {
i++;
}
} while (start_prop != NULL);
func_80330104(cube);
code_A5BC0_initCubePropActorProp(cube);
}
}
@ -266,7 +266,7 @@ void func_8032D158(Cube *cube){
func_8032CB50(cube, 0);
}
void __marker_draw(ActorMarker *this, Gfx **gfx, Mtx **mtx, Vtx **vtx){
static void __marker_draw(ActorMarker *this, Gfx **gfx, Mtx **mtx, Vtx **vtx){
Actor *actor;
u32 draw_dist;
f32 draw_dist_f;
@ -299,7 +299,7 @@ void __marker_draw(ActorMarker *this, Gfx **gfx, Mtx **mtx, Vtx **vtx){
func_8033A280(1.0f);
}
void func_8032D330(void){
void func_8032D330(){
D_80383550 = vector_new(sizeof(ActorMarker *),2);
D_80383554 = vector_new(sizeof(ActorMarker *),2);
}
@ -344,7 +344,7 @@ void func_8032D510(Cube *cube, Gfx **gfx, Mtx **mtx, Vtx **vtx){
func_8032CB50(cube, 0);
iOffset = 0;
for(i = 0; i < cube->prop2Cnt; i++){//L8032D5A0
iOffset = i*0xC;
iOffset = i * 0xC;
iProp = ((s32)cube->prop2Ptr + iOffset);
tmp_v0.word = *(u32 *)((s32)iProp + 0x8);
if(!tmp_v0.unk4){
@ -393,7 +393,7 @@ void func_8032D510(Cube *cube, Gfx **gfx, Mtx **mtx, Vtx **vtx){
}//L8032D7D4
}
Prop *func_8032D80C(Cube *cube) {
Prop *__codeA5BC0_initProp2Ptr(Cube *cube) {
Prop *sp1C;
if (cube->prop2Ptr != NULL) {
@ -405,11 +405,11 @@ Prop *func_8032D80C(Cube *cube) {
}
sp1C = &cube->prop2Ptr[cube->prop2Cnt-1];
sp1C->markerFlag = FALSE;
func_80330104(cube);
code_A5BC0_initCubePropActorProp(cube);
return sp1C;
}
NodeProp *func_8032D8F0(Cube *cube) {
NodeProp *__codeA5BC0_pad_func_8032D8F0(Cube *cube) {
if (cube->prop1Ptr != 0) {
cube->prop1Cnt++;
cube->prop1Ptr = realloc(cube->prop1Ptr, cube->prop1Cnt * sizeof(NodeProp));
@ -437,7 +437,7 @@ s32 func_8032D9C0(Cube *cube, Prop* prop){
cube->prop2Cnt--;
if(cube->prop2Cnt){
cube->prop2Ptr = realloc(cube->prop2Ptr, cube->prop2Cnt*sizeof(Prop));
func_80330104(cube);
code_A5BC0_initCubePropActorProp(cube);
}else{
free(cube->prop2Ptr);
cube->prop2Ptr = NULL;
@ -489,7 +489,7 @@ ActorMarker *func_8032DCAC(void){
SpriteProp *func_8032DCB8(Cube *cube) {
SpriteProp *sp1C;
sp1C = func_8032D80C(cube);
sp1C = __codeA5BC0_initProp2Ptr(cube);
sp1C->unk8_0 = FALSE;
sp1C->unk8_1 = FALSE;
sp1C->unk8_15 = 0;
@ -504,7 +504,7 @@ SpriteProp *func_8032DCB8(Cube *cube) {
void func_8032DDD8(Cube *cube) {
Prop *temp_v0;
temp_v0 = func_8032D80C(cube);
temp_v0 = __codeA5BC0_initProp2Ptr(cube);
temp_v0->markerFlag = FALSE;
temp_v0->unk8_1 = TRUE;
temp_v0->unk8_5 = FALSE;
@ -648,8 +648,8 @@ bool __codeA5BC0_pad_func_8032E178(Cube *arg0, s32 *arg1, s32 arg2) {
node_ptr = arg0->prop1Ptr;
last_node_ptr = arg0->prop1Ptr + arg0->prop1Cnt;
while (node_ptr < last_node_ptr) {
if( ((node_ptr->bit0 == 1)
|| ((node_ptr->bit0 == 0) && (node_ptr->unk10_6 == 1))
if( ((node_ptr->bit0 == TRUE)
|| ((node_ptr->bit0 == FALSE) && (node_ptr->unk10_6 == TRUE))
)
&& (node_ptr->bit6 == 6)
&& (arg2 == node_ptr->unk8)
@ -663,16 +663,16 @@ bool __codeA5BC0_pad_func_8032E178(Cube *arg0, s32 *arg1, s32 arg2) {
return FALSE;
}
NodeProp *cube_findNodePropByActorId(Cube *cube, s32 arg1) {
NodeProp *cube_findNodePropByActorId(Cube *cube, enum actor_e actor_id) {
NodeProp *i_ptr;
if (cube != NULL && cube->prop1Cnt != 0){
for(i_ptr = cube->prop1Ptr; i_ptr < cube->prop1Ptr + cube->prop1Cnt; i_ptr++){
if( ( (i_ptr->bit0 == 1)
|| ( (i_ptr->bit0 == 0) && (i_ptr->unk10_6 == 1))
if( ( (i_ptr->bit0 == TRUE)
|| ( (i_ptr->bit0 == FALSE) && (i_ptr->unk10_6 == TRUE))
)
&& (i_ptr->bit6 == 6)
&& (arg1 == i_ptr->unk8)
&& (actor_id == i_ptr->unk8)
) {
return i_ptr;
}
@ -689,8 +689,8 @@ bool func_8032E2D4(Cube *arg0, s32 arg1[3], s32 arg2) {
var_v1 = arg0->prop1Ptr;
temp_a2 = arg0->prop1Ptr + arg0->prop1Cnt;
while (var_v1 < temp_a2) {
if( ((var_v1->bit0 == 1)
|| ((var_v1->bit0 == 0) && (var_v1->unk10_6 == 1))
if( ((var_v1->bit0 == TRUE)
|| ((var_v1->bit0 == FALSE) && (var_v1->unk10_6 == TRUE))
)
&& (var_v1->bit6 == 6)
&& (arg2 == var_v1->unk8)
@ -751,7 +751,7 @@ s32 func_8032E49C(Cube *cube, enum actor_e *actor_id_list, NodeProp **node_list,
i_node = cube->prop1Ptr;
end_node = cube->prop1Ptr + cube->prop1Cnt;
while((i_node < end_node) && (found_cnt < node_list_capacity)) {
if (((i_node->bit0 == 1) || ((i_node->bit0 == 0) && (i_node->unk10_6 == 1))) && (i_node->bit6 == 6)) {
if (((i_node->bit0 == TRUE) || ((i_node->bit0 == FALSE) && (i_node->unk10_6 == TRUE))) && (i_node->bit6 == 6)) {
i_actor = actor_id_list;
for(i_actor = actor_id_list; *i_actor != -1; i_actor++){
if (i_node->unk8 == *i_actor) {
@ -778,8 +778,8 @@ s32 func_8032E5A8(Cube *cube, s32 arg1, f32 (*arg2)[3], s32 capacity) {
i_node = cube->prop1Ptr;
end_node = cube->prop1Ptr + cube->prop1Cnt;
while((i_node < end_node) && (count < capacity)){
if( ( (i_node->bit0 == 1)
|| ((i_node->bit0 == 0) && (i_node->unk10_6 == 1))
if( ( (i_node->bit0 == TRUE)
|| ((i_node->bit0 == FALSE) && (i_node->unk10_6 == TRUE))
)
&& (i_node->bit6 == 6) && (arg1 == i_node->unk8)
) {
@ -804,12 +804,12 @@ bool func_8032E6CC(Cube *cube, s32 *arg1, s32 arg2) {
i_node = cube->prop1Ptr;
end_node = cube->prop1Ptr + cube->prop1Cnt;
while (i_node < end_node) {
if( ( (i_node->bit0 == 1)
|| ((i_node->bit0 == 0) && (i_node->unk10_6 == 1))
if( ( (i_node->bit0 == TRUE)
|| ((i_node->bit0 == FALSE) && (i_node->unk10_6 == TRUE))
)
&& (i_node->bit6 == 6) && (arg2 == i_node->unk8)
) {
*arg1 = i_node->unkC_31;
*arg1 = i_node->yaw;
return TRUE;
}
i_node++;
@ -819,21 +819,22 @@ bool func_8032E6CC(Cube *cube, s32 *arg1, s32 arg2) {
return FALSE;
}
void func_8032E784(Cube *cube, s32 cnt){
static void __codeA5BC0_freeCube1Pointer(Cube *cube, s32 cnt){
if(cube->prop1Ptr != NULL){
free(cube->prop1Ptr);
}
cube->prop1Cnt = cnt;
cube->unk0_4 = 0;
}
void func_8032E7E8(NodeProp *node, Cube *cube, s32 cnt) {
static void __codeA5BC0_initPropPointerForCube(NodeProp *node, Cube *cube, s32 cnt) {
NodeProp *iPtr;
s32 phi_s3;
s32 cube_ptr_idx;
s32 i;
cube->unk0_4 = 0;
phi_s3 = cnt - 1;
cube_ptr_idx = cnt - 1;
for(i = 0; i < cnt; i++){
iPtr = node + i;
if( (iPtr->bit6 == 6)
@ -843,13 +844,14 @@ void func_8032E7E8(NodeProp *node, Cube *cube, s32 cnt) {
|| (iPtr->bit6 == 0xA)
|| (iPtr->bit0 == 1)
){
memcpy(&cube->prop1Ptr[phi_s3], &node[i], sizeof(NodeProp));
phi_s3--;
memcpy(&cube->prop1Ptr[cube_ptr_idx], &node[i], sizeof(NodeProp));
cube_ptr_idx--;
} else {
memcpy(&cube->prop1Ptr[cube->unk0_4], &node[i], sizeof(NodeProp));
cube->unk0_4++;
}
}
free(node);
for(i = 0; i < cnt; i++){
@ -860,35 +862,35 @@ void func_8032E7E8(NodeProp *node, Cube *cube, s32 cnt) {
}
}
void cube_fromFile(File *file_ptr, Cube *cube) {
void code7AF80_initCubeFromFile(File *file_ptr, Cube *cube) {
u8 sp47;
u8 sp46;
NodeProp *temp_v0;
OtherNode *var_v1_3;
u8 cube1_count;
NodeProp *node_prop_ptr;
OtherNode *other_prop_ptr;
Prop *var_v1_2;
s32 sp34;
s32 temp_v0_5;
cube_free(cube);
if (file_getByte_ifExpected(file_ptr, 0xA, &sp46)) {
func_8032E784(cube, sp46);
cube->prop1Ptr = (NodeProp*) malloc(sp46 * sizeof(NodeProp));
temp_v0 = (NodeProp*) malloc(sp46 * sizeof(NodeProp));
file_getNBytes_ifExpected(file_ptr, 0xB, temp_v0, cube->prop1Cnt * sizeof(NodeProp));
func_8032E7E8(temp_v0, cube, sp46);
if (file_getByte_ifExpected(file_ptr, 0xA, &cube1_count)) {
__codeA5BC0_freeCube1Pointer(cube, cube1_count);
cube->prop1Ptr = (NodeProp*) malloc(cube1_count * sizeof(NodeProp));
node_prop_ptr = (NodeProp*) malloc(cube1_count * sizeof(NodeProp));
file_getNBytes_ifExpected(file_ptr, 0xB, node_prop_ptr, cube->prop1Cnt * sizeof(NodeProp));
__codeA5BC0_initPropPointerForCube(node_prop_ptr, cube, cube1_count);
} else if (file_getByte_ifExpected(file_ptr, 6, &sp46)) {
func_8032E784(cube, sp46);
cube->prop1Ptr = (OtherNode*) malloc(sp46 * sizeof(OtherNode));
temp_v0 = (OtherNode*) malloc(sp46 * sizeof(OtherNode));
file_getNBytes_ifExpected(file_ptr, 7, temp_v0, cube->prop1Cnt * sizeof(OtherNode));
for(var_v1_3 = temp_v0; var_v1_3 < (OtherNode*)&temp_v0[sp46]; var_v1_3++){
if(var_v1_3->unk4_0 && !var_v1_3->unkC_0){
var_v1_3->unk4_17 = 0;
var_v1_3->unk10_4 = 0;
} else if (file_getByte_ifExpected(file_ptr, 6, &cube1_count)) {
__codeA5BC0_freeCube1Pointer(cube, cube1_count);
cube->prop1Ptr = (OtherNode*) malloc(cube1_count * sizeof(OtherNode));
node_prop_ptr = (OtherNode*) malloc(cube1_count * sizeof(OtherNode));
file_getNBytes_ifExpected(file_ptr, 7, node_prop_ptr, cube->prop1Cnt * sizeof(OtherNode));
for(other_prop_ptr = node_prop_ptr; other_prop_ptr < (OtherNode*)&node_prop_ptr[cube1_count]; other_prop_ptr++){
if(other_prop_ptr->unk4_0 && !other_prop_ptr->unkC_0){
other_prop_ptr->unk4_17 = 0;
other_prop_ptr->unk10_4 = 0;
}
}
func_8032E7E8(temp_v0, cube, sp46);
__codeA5BC0_initPropPointerForCube(node_prop_ptr, cube, cube1_count);
}
if (file_getByte_ifExpected(file_ptr, 8, &sp47)) {
@ -1021,7 +1023,7 @@ void func_8032F194(ActorMarker *marker, s32 position[3], Cube *cube) {
void func_8032F21C(Cube *cube, s32 position[3], ActorMarker *marker, bool arg3) {
ActorProp *sp1C;
sp1C = func_8032D80C(cube);
sp1C = &__codeA5BC0_initProp2Ptr(cube)->actorProp;
sp1C->unk8_0 = TRUE;
sp1C->x = (s16) position[0];
sp1C->y = (s16) position[1];
@ -1282,25 +1284,20 @@ void marker_setModelId(ActorMarker *this, enum asset_e modelIndex){
this->modelId = modelIndex;
}
void func_80330104(Cube *cube) {
s32 temp_a2;
u32 temp_t7;
u32 var_a1;
void **temp_v1_3;
void *temp_v1;
void *temp_v1_2;
ActorProp *var_v1;
void code_A5BC0_initCubePropActorProp(Cube *cube) {
u32 prop_cnt;
Prop *prop_ptr;
if (cube->prop2Cnt != 0) {
var_v1 = (ActorProp *)cube->prop2Ptr;
var_a1 = cube->prop2Cnt;
while(var_a1 != 0){
if(var_v1->unk8_0 == TRUE){
var_v1->marker->propPtr = var_v1;
var_v1->marker->cubePtr = cube;
prop_ptr = cube->prop2Ptr;
prop_cnt = cube->prop2Cnt;
while(prop_cnt != 0){
if(prop_ptr->markerFlag == TRUE){
prop_ptr->actorProp.marker->propPtr = &prop_ptr->actorProp;
prop_ptr->actorProp.marker->cubePtr = cube;
}
var_a1--;
var_v1++;
prop_cnt--;
prop_ptr++;
}
}
}
@ -1320,11 +1317,11 @@ void func_80330208(Cube *cube) {
position[0] = (s32) i_prop->x;
position[1] = (s32) i_prop->y;
position[2] = (s32) i_prop->z;
actor = func_803055E0(i_prop->unk8, position, i_prop->unkC_31, i_prop->unk10_31, i_prop->unk10_19);
actor = func_803055E0(i_prop->unk8, position, i_prop->yaw, i_prop->unk10_31, i_prop->unk10_19);
if (actor != NULL) {
actor->unk78_13 = i_prop->unk10_31;
actor->unkF4_8 = i_prop->radius;
func_8032AA58(actor, (i_prop->unkC_22 != 0) ? ((f32)i_prop->unkC_22 * 0.01) : 1.0);
func_8032AA58(actor, (i_prop->scale != 0) ? ((f32)i_prop->scale * 0.01) : 1.0);
}
}
i_prop++;
@ -1347,7 +1344,7 @@ void func_803303B8(Cube *cube) {
position[0] = (s32) current_node_ptr->x;
position[1] = (s32) current_node_ptr->y;
position[2] = (s32) current_node_ptr->z;
func_803065E4(current_node_ptr->unk8, position, current_node_ptr->radius, current_node_ptr->unk10_31, current_node_ptr->unk10_7);
func_803065E4(current_node_ptr->unk8, position, current_node_ptr->radius, current_node_ptr->unk10_31, current_node_ptr->pad10_7);
} else if (current_node_ptr->bit6 == 9) {
position[0] = (s32) current_node_ptr->x;
position[1] = (s32) current_node_ptr->y;
@ -1682,7 +1679,7 @@ bool func_80331158(ActorMarker *arg0, s32 arg1, s32 arg2) {
return FALSE;
}
s32 func_803311D4(Cube *arg0, f32 *arg1, f32 *arg2, f32 *arg3, u32 arg4) {
BKCollisionTri *func_803311D4(Cube *arg0, f32 *arg1, f32 *arg2, f32 *arg3, u32 arg4) {
Actor *temp_s2_2;
ActorMarker *temp_a0;
BKModelBin *var_a0;
@ -1692,17 +1689,17 @@ s32 func_803311D4(Cube *arg0, f32 *arg1, f32 *arg2, f32 *arg3, u32 arg4) {
f32 spAC[3];
f32 spA0[3];
BKCollisionList *temp_s0;
s32 temp_s0_2;
BKCollisionTri *temp_s0_2;
BKCollisionList *temp_s2;
f32 sp88[3];
f32 sp7C[3];
s32 var_s6;
s32 var_v0;
BKCollisionTri *var_s6;
BKCollisionTri *var_v0;
u32 var_s5;
var_s6 = 0;
var_s6 = NULL;
for(var_s1 = arg0->prop2Ptr, var_s5 = arg0->prop2Cnt; var_s5 > 0; var_s5--, var_s1++) {
if(var_s1);
@ -1718,7 +1715,7 @@ s32 func_803311D4(Cube *arg0, f32 *arg1, f32 *arg2, f32 *arg3, u32 arg4) {
spA0[1] = (f32) (var_s1->modelProp.unk0_15 * 2);
spA0[2] = (f32) (var_s1->modelProp.unk0_7 * 2);
var_v0 = func_802E805C(temp_s2, model_getVtxList(var_s0), spAC, spA0, (f32)var_s1->modelProp.unkA / 100.0, arg1, arg2, arg3, arg4);
if (var_v0 != 0) {
if (var_v0 != NULL) {
var_s6 = var_v0;
}
}
@ -1742,7 +1739,7 @@ s32 func_803311D4(Cube *arg0, f32 *arg1, f32 *arg2, f32 *arg3, u32 arg4) {
sp7C[1] = (f32) var_s1->actorProp.marker->yaw;
sp7C[2] = (f32) var_s1->actorProp.marker->roll;
temp_s0_2 = func_802E805C(temp_s0, temp_a1, &sp88, &sp7C, temp_s2_2->scale, arg1, arg2, arg3, arg4);
if ((temp_s0_2 != 0) && (func_8029453C())) {
if ((temp_s0_2 != NULL) && (func_8029453C())) {
marker_loadModelBin(var_s1->actorProp.marker);
if (var_s1->actorProp.marker->unk50 != 0) {
D_80383410[0] = arg2[0];
@ -1755,7 +1752,7 @@ s32 func_803311D4(Cube *arg0, f32 *arg1, f32 *arg2, f32 *arg3, u32 arg4) {
D_80383420 = temp_s0_2;
}
}
if (temp_s0_2 != 0) {
if (temp_s0_2 != NULL) {
var_s6 = temp_s0_2;
}
}

View File

@ -171,7 +171,7 @@ void func_80334910(void) {
func_803231E8();
func_80320B7C();
func_802BAF20();
func_80305BD4();
code7AF80_freeTotalCounts();
func_80332A38();
if (func_802E4A08() == 0) {
itemPrint_free();

View File

@ -643,7 +643,7 @@ struct56s *func_80341EF0(f32 arg0[3]){
s32 func_80341F2C(s32 arg0){
s32 sp1C[3];
if(!_nodeProp_findPositionFromActorId(arg0, sp1C)){
if(!nodeprop_findPositionFromActorId(arg0, sp1C)){
return -1;
}
return func_80341C78(sp1C);
@ -651,7 +651,7 @@ s32 func_80341F2C(s32 arg0){
struct56s *func_80341F64(s32 arg0){
s32 sp1C[3];
if(!_nodeProp_findPositionFromActorId(arg0, sp1C)){
if(!nodeprop_findPositionFromActorId(arg0, sp1C)){
return NULL;
}
return D_80371E70[func_80341C78(sp1C)];

View File

@ -37,7 +37,7 @@ s32 D_803860DC;//total_inputs
s32 func_80349EC0(s32 arg0){
s32 sp1C[3];
return _nodeProp_findPositionFromActorId(arg0 + 0x1CC, &sp1C);
return nodeprop_findPositionFromActorId(arg0 + 0x1CC, &sp1C);
}
int demo_readInput(OSContPad* arg0, s32* arg1){

View File

@ -2,7 +2,7 @@
#include "functions.h"
#include "variables.h"
extern int func_802E805C(BKCollisionList *arg0, BKVertexList *vtxList, f32 arg2[3], f32 arg3[3], f32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8);
extern BKCollisionTri *func_802E805C(BKCollisionList *arg0, BKVertexList *vtxList, f32 arg2[3], f32 arg3[3], f32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8);
extern int func_802E9118(BKCollisionList *arg0, BKVertexList *vtxList, f32 arg2[3], f32 arg3[3], f32 arg4, s32 arg5, s32 arg6, f32 arg7, s32 arg8, s32 arg9, s32 arg10);
extern int func_802E9DD8(BKCollisionList *arg0, BKVertexList *vtxList, f32 arg2[3], f32 arg3[3], f32 arg4, s32 arg5, f32 arg6, s32 arg7, s32 arg8);
extern s32 func_802EA760(BKModelUnk14List *, s32, f32[3], f32[3], f32, s32, f32*, f32*);

View File

@ -19,8 +19,8 @@ typedef struct {
s16 map_id; //enum map_e
s16 opa_model_id; //enum asset_e level_model_id
s16 xlu_model_id; //enum asset_e level2_model_id
s16 unk6[3];
s16 unkC[3];
s16 unk6[3]; // min bounds (for cubes?)
s16 unkC[3]; // max bounds (for cubes?)
// u8 pad12[0x2];
f32 scale;
}MapModelDescription;

View File

@ -234,7 +234,7 @@ void func_802C16CC(s32 arg0) {
sp30 = cubeList_findNodePropByActorIdAndPosition_s32(sp38, player_position_copy);
if(sp30 != NULL) {
nodeprop_getPosition(sp30, player_or_node_position);
switch (func_80304DB8(sp30)) { /* irregular */
switch (nodeprop_getScale(sp30)) { /* irregular */
default:
D_8037DBE0.unk2E = 0;
D_8037DBE0.unk2F = 0;

View File

@ -979,7 +979,7 @@ void func_80388450(Actor *actor1, Actor *actor2)
f32 vec1[3];
f32 vec2[3];
void *actor3 = nodeprop_findByActorIdAndActorPosition(0x22A, actor1);
s32 val = func_80304DA8(actor3);
s32 val = nodeprop_getYaw(actor3);
actor2->yaw = val;
actor1->yaw = val;