document: Level setup related code

This commit is contained in:
Bl00D4NGEL 2024-10-19 01:30:21 +02:00
parent d1b41e109d
commit c9e87f0363
9 changed files with 192 additions and 171 deletions

View File

@ -81,7 +81,7 @@ typedef struct actorMarker_s{
u32 yaw:9;
u32 unk14_22:1;
u32 unk14_21:1;
u32 id:10; // marker_id
u32 id:10; // marker id of type marker enum_e
u32 unk14_10:11; //used in ch/jiggy
Struct6Cs *unk18;
MarkerCollisionFunc dieFunc;
@ -343,11 +343,9 @@ typedef struct {
s16 x;
s16 y;
s16 z;
struct {
u16 radius: 9; //selector_value //volume??? diameter
u16 bit6: 6; //category
u16 bit0: 1;
}unk6;
u16 radius: 9; // selector / volume / diameter?
u16 bit6: 6; // category?
u16 bit0: 1;
u16 unk8; //actor_id?
u8 unkA; //marker_id
struct {

View File

@ -128,34 +128,34 @@ static void __chTreasurehunt_checkStepProgress(s32 currentStep){
}
}
void chTreasurehunt_checkStepProgress0(ActorMarker *this, ActorMarker *arg1){\
void chTreasurehunt_checkStepProgress0(NodeProp *this, ActorMarker *arg1){\
__chTreasurehunt_checkStepProgress(0);
}
void chTreasurehunt_checkStepProgress1(ActorMarker *this, ActorMarker *arg1){\
void chTreasurehunt_checkStepProgress1(NodeProp *this, ActorMarker *arg1){\
__chTreasurehunt_checkStepProgress(1);
}
void chTreasurehunt_checkStepProgress2(ActorMarker *this, ActorMarker *arg1){\
void chTreasurehunt_checkStepProgress2(NodeProp *this, ActorMarker *arg1){\
__chTreasurehunt_checkStepProgress(2);
}
void chTreasurehunt_checkStepProgress3(ActorMarker *this, ActorMarker *arg1){\
void chTreasurehunt_checkStepProgress3(NodeProp *this, ActorMarker *arg1){\
__chTreasurehunt_checkStepProgress(3);
}
void chTreasurehunt_checkStepProgress4(ActorMarker *this, ActorMarker *arg1){\
void chTreasurehunt_checkStepProgress4(NodeProp *this, ActorMarker *arg1){\
__chTreasurehunt_checkStepProgress(4);
}
void chTreasurehunt_checkStepProgress5(s16 arg0[3], s32 arg1){
void chTreasurehunt_checkStepProgress5(NodeProp *this, ActorMarker *arg1){
static ParticleEmitter *particleEmitter;
static f32 particleTargetPosition[3];
if(CH_TREASUREHUNT_PUZZLE_CURRENT_STEP == 5 && __chTreasurehunt_isActiveHitboxBeakBusterHitbox()){
particleTargetPosition[0] = (f32)arg0[0];
particleTargetPosition[1] = (f32)arg0[1];
particleTargetPosition[2] = (f32)arg0[2];
particleTargetPosition[0] = (f32)this->x;
particleTargetPosition[1] = (f32)this->y;
particleTargetPosition[2] = (f32)this->z;
particleTargetPosition[1] = mapModel_getFloorY(particleTargetPosition);
__spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, 0xF4, reinterpret_cast(s32, particleTargetPosition[0]), reinterpret_cast(s32, particleTargetPosition[1]), reinterpret_cast(s32, particleTargetPosition[2]));
particleEmitter = partEmitMgr_newEmitter(3);

View File

@ -38,7 +38,7 @@ s32 D_8036751C[4] = {100, 100, 30, 100};
/* .bss */
u8 D_8037DDF0;
u8 D_8037DDF1;
u8 D_8037DDF2;
u8 sHasWarnedBanjoAboutDetransform;
u8 D_8037DDF3;
/* .code */
@ -502,20 +502,20 @@ Actor *chMumbo_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) {
return out;
}
void chMumbo_detransformWarn(s32 this, s32 arg1){
void chMumbo_detransformWarn(NodeProp *arg0, ActorMarker *arg1){
s32 xform;
xform = player_getTransformation();
if(xform == TRANSFORM_1_BANJO || xform == TRANSFORM_7_WISHWASHY || D_8037DDF2)
if(xform == TRANSFORM_1_BANJO || xform == TRANSFORM_7_WISHWASHY || sHasWarnedBanjoAboutDetransform)
return;
D_8037DDF2++;
sHasWarnedBanjoAboutDetransform++;
if(D_8037DDF3)
return;
gcdialog_showText(fileProgressFlag_getAndSet(FILEPROG_83_MAGIC_GET_WEAK_TEXT, TRUE) ? ASSET_F5C_DIALOG_MUMBO_MAGIC_GET_WEAK_ABREV : ASSET_F5B_DIALOG_MUMBO_MAGIC_GET_WEAK_FULL, 0xe, NULL, NULL, NULL, NULL);
}
void chMumbo_detransformTrigger(s32 this, s32 arg1){
void chMumbo_detransformTrigger(NodeProp *arg0, ActorMarker *arg1){
s32 xform;
xform = player_getTransformation();
if(xform == TRANSFORM_1_BANJO || xform == TRANSFORM_7_WISHWASHY || D_8037DDF1)
@ -526,10 +526,10 @@ void chMumbo_detransformTrigger(s32 this, s32 arg1){
}
void func_802D2CB8(void){
D_8037DDF2 = D_8037DDF3 = D_8037DDF1 = 0;
sHasWarnedBanjoAboutDetransform = D_8037DDF3 = D_8037DDF1 = 0;
}
void func_802D2CDC(void){
D_8037DDF3 = D_8037DDF2;
D_8037DDF2 = 0;
D_8037DDF3 = sHasWarnedBanjoAboutDetransform;
sHasWarnedBanjoAboutDetransform = 0;
}

View File

@ -27,8 +27,8 @@ typedef struct{
} Struct_core2_7AF80_2;
typedef struct {
s32 count; //count
s32 unk4;
s32 count;
s32 unk4; // some sort of id or type?
Struct_core2_7AF80_2 *unk8;
} Struct_core2_7AF80_1;
@ -48,14 +48,19 @@ extern ActorInfo D_80367838;
s32 sSpawnableActorSize = 0; //0x8036A9B0
ActorSpawn *sSpawnableActorList = NULL; //0x8036A9B4
// count / index of D_8036A9BC
s32 D_8036A9B8 = 0;
Struct_core2_7AF80_1 *D_8036A9BC = NULL;
// pointer to cube(?) where bit6 == 7
Struct_core2_7AF80_1 *D_8036A9C0 = NULL;
// count / index of D_8036A9C8
s32 D_8036A9C4 = 0;
Struct_core2_7AF80_1 *D_8036A9C8 = NULL;
// pointer to cube(?) where bit6 == 9
Struct_core2_7AF80_1 *D_8036A9CC = NULL;
// count / index of D_8036A9D4
s32 D_8036A9D0 = 0;
Struct_core2_7AF80_1 *D_8036A9D4 = NULL;
Struct_core2_7AF80_1 *D_8036A9D8 = NULL;
@ -63,9 +68,9 @@ Struct_core2_7AF80_1 *D_8036A9D8 = NULL;
UNK_TYPE(s32) D_8036A9DC = 0;
UNK_TYPE(void *) D_8036A9E0 = NULL;
u8 D_8036A9E4[] = {
0, 9, 2, 3, 4, 5, 6, 7, -1, 8, 0xA, 0xB,
0xC, 0xD, 0xE, 0xF, 0x10, 0x11, 1, 0x13, 0x14, 0x15, 0x16, 0x64, 0x65, 0x66, 0x67, 0x68,
u8 sMarkerToBitfield[] = {
0, 9, 2, 3, 4, 5, 6, 7, -1, 8, 0xA, 0xB,
0xC, 0xD, 0xE, 0xF, 0x10, 0x11, 1, 0x13, 0x14, 0x15, 0x16, 0x64, 0x65, 0x66, 0x67, 0x68,
0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@ -911,7 +916,7 @@ void cubeList_fromFile(File *file_ptr) {
cube = cube_atIndices(sp5C);
if (cube->unk0_4) {
for(iPtr = cube->prop1Ptr; iPtr < &cube->prop1Ptr[cube->unk0_4] ;iPtr++){
if (!iPtr->unk6.bit0) {
if (!iPtr->bit0) {
bitfield_setBit(D_8036A9E0, iPtr->unkA, 1);
}
}
@ -937,7 +942,7 @@ s32 func_80304984(s32 arg0, u32 *arg1) {
temp_v0 = cubeList_findNodePropByActorId(arg0, 0);
if (temp_v0 != 0) {
*arg1 = temp_v0->unk6.radius;
*arg1 = temp_v0->radius;
return 1;
}
return 0;
@ -1034,7 +1039,7 @@ NodeProp *func_80304D04(s32 arg0, s16 *arg1) {
}
s32 nodeprop_getRadius(NodeProp *arg0) {
return arg0->unk6.radius;
return arg0->radius;
}
void nodeprop_getPosition_s32(NodeProp *nodeProp, s32 dst[3]) {
@ -1229,12 +1234,12 @@ NodeProp *func_80305510(s32 arg0) {
var_v0 = func_803080C8(arg0);
sp20 = 1;
while ((var_v0 != NULL) && ((sp20 == 1) || (var_v0->unk6.bit0 == 1)) && (var_v0->unk10_19 != 0)) {
while ((var_v0 != NULL) && ((sp20 == 1) || (var_v0->bit0 == 1)) && (var_v0->unk10_19 != 0)) {
var_v1 = var_v0->unk10_19;
var_v0 = func_803080C8(var_v1);
sp20 = 0;
}
return ((sp20 == 1) || (var_v0 == NULL) || (var_v0->unk6.bit0 == 1)) ? NULL : var_v0;
return ((sp20 == 1) || (var_v0 == NULL) || (var_v0->bit0 == 1)) ? NULL : var_v0;
}
Actor * func_803055E0(enum actor_e arg0, s32 arg1[3], s32 arg2, s32 arg3, s32 arg4){
@ -1434,7 +1439,7 @@ void func_80305D94(void){
}
}
void func_80305F04(s32 *arg0, Struct_core2_7AF80_1 **arg1) {
void __code7AF80_concatElementsAndRemoveEmpty(s32 *count, Struct_core2_7AF80_1 **arg1) {
bool continue_loop;
Struct_core2_7AF80_2 *b_elem;
Struct_core2_7AF80_1 *b_list;
@ -1442,15 +1447,19 @@ void func_80305F04(s32 *arg0, Struct_core2_7AF80_1 **arg1) {
Struct_core2_7AF80_1 *a_list;
if ((D_8036A9BC != NULL) && (D_8036A9B8 != 0)) {
for(a_list = *arg1; a_list < *arg1 + *arg0; a_list++){
for(b_list = a_list + 1; b_list < *arg1 + *arg0; b_list++) {
for(a_list = *arg1; a_list < *arg1 + *count; a_list++){
for(b_list = a_list + 1; b_list < *arg1 + *count; b_list++) {
//same types and neither A or B are empty
if ((a_list->unk4 == b_list->unk4) && (a_list->count != 0) && (b_list->count != 0)) {
continue_loop = TRUE;
for(a_elem = a_list->unk8; (a_elem < a_list->unk8 + a_list->count) && continue_loop; a_elem++){
for(b_elem = b_list->unk8; (b_elem < b_list->unk8 + b_list->count) && continue_loop; b_elem++) {
if ((((a_elem->position[0] - b_elem->position[0]) * (a_elem->position[0] - b_elem->position[0])) + ((a_elem->position[2] - b_elem->position[2]) * (a_elem->position[2] - b_elem->position[2]))) < ((a_elem->radius + b_elem->radius) * (a_elem->radius + b_elem->radius))) {
if ((
((a_elem->position[0] - b_elem->position[0]) * (a_elem->position[0] - b_elem->position[0])) +
((a_elem->position[2] - b_elem->position[2]) * (a_elem->position[2] - b_elem->position[2]))
) < (
(a_elem->radius + b_elem->radius) * (a_elem->radius + b_elem->radius)
)) {
//concat b_list to end of a_list
a_list->unk8 = (Struct_core2_7AF80_2 *) realloc(a_list->unk8, (a_list->count + b_list->count)*sizeof(Struct_core2_7AF80_2));
memcpy(a_list->unk8 + a_list->count, b_list->unk8, b_list->count * sizeof(Struct_core2_7AF80_2));
@ -1470,10 +1479,10 @@ void func_80305F04(s32 *arg0, Struct_core2_7AF80_1 **arg1) {
}
//remove empty lists
for(a_list = *arg1; a_list < *arg1 + *arg0; a_list++){
for(a_list = *arg1; a_list < *arg1 + *count; a_list++){
if (a_list->count == 0) { //A is empty
continue_loop = TRUE;
for(b_list = a_list + 1; (b_list < *arg1 + *arg0) && continue_loop; b_list++){
for(b_list = a_list + 1; (b_list < *arg1 + *count) && continue_loop; b_list++){
if (b_list->count != 0) { //B is not empty
//swap A an B
memcpy(a_list, b_list, sizeof(Struct_core2_7AF80_1));
@ -1487,10 +1496,10 @@ void func_80305F04(s32 *arg0, Struct_core2_7AF80_1 **arg1) {
}
//find first empty list (end)
for(a_list = *arg1; (a_list < *arg1 + *arg0) && (a_list->count != 0); a_list++) { }
for(a_list = *arg1; (a_list < *arg1 + *count) && (a_list->count != 0); a_list++) { }
*arg0 = (a_list - *arg1); //count
*arg1 = (Struct_core2_7AF80_1 *)realloc((void *) *arg1, *arg0 * sizeof(Struct_core2_7AF80_1)); //ptr
*count = (a_list - *arg1); //count
*arg1 = (Struct_core2_7AF80_1 *)realloc((void *) *arg1, *count * sizeof(Struct_core2_7AF80_1)); //ptr
}
}
@ -1501,12 +1510,12 @@ void func_803062D0(void) {
for (var_s0 = D_80381FA0.cube_list; var_s0 < (D_80381FA0.cube_list + D_80381FA0.cubeCnt); var_s0++) {
func_803303B8(var_s0);
}
func_80305F04(&D_8036A9B8, &D_8036A9BC);
func_80305F04(&D_8036A9C4, &D_8036A9C8);
func_80305F04(&D_8036A9D0, &D_8036A9D4);
__code7AF80_concatElementsAndRemoveEmpty(&D_8036A9B8, &D_8036A9BC);
__code7AF80_concatElementsAndRemoveEmpty(&D_8036A9C4, &D_8036A9C8);
__code7AF80_concatElementsAndRemoveEmpty(&D_8036A9D0, &D_8036A9D4);
}
void func_80306390(void){
void __code7AF90_assignDecrementedD_8036A9BCToD_8036A9C0(void){
D_8036A9C0 = D_8036A9BC - 1;
}
@ -1560,21 +1569,28 @@ Struct_core2_7AF80_1 *func_803064C0(s32 arg0) {
return NULL;
}
bool func_80306534(Struct_core2_7AF80_1 *arg0, s32 arg1, s32 arg2[3], s32 arg3) {
// is within radius?
bool func_80306534(Struct_core2_7AF80_1 *arg0, s32 arg1, s32 position[3], s32 radius) {
Struct_core2_7AF80_2 *iPtr;
for(iPtr = arg0->unk8; iPtr < &arg0->unk8[arg0->count]; iPtr++){
if(((arg2[0] - iPtr->position[0])*(arg2[0] - iPtr->position[0]) + (arg2[2] - iPtr->position[2])*(arg2[2] - iPtr->position[2])) < ((arg3 + iPtr->radius) * (arg3 + iPtr->radius))) {
if((
(position[0] - iPtr->position[0]) * (position[0] - iPtr->position[0]) +
(position[2] - iPtr->position[2]) * (position[2] - iPtr->position[2])
) < (
(radius + iPtr->radius) * (radius + iPtr->radius)
)) {
return TRUE;
}
}
return FALSE;
}
// some sort of init function if bit6 == 7
void func_803065E4(s32 arg0, s32 position[3], s32 radius, s32 arg3, s32 arg4) {
Struct_core2_7AF80_2 *temp_v1;
func_80306390();
__code7AF90_assignDecrementedD_8036A9BCToD_8036A9C0();
while(func_803063D8(arg0) != NULL){
if (func_80306534(D_8036A9C0, arg0, position, radius)) {
D_8036A9C0->count++;
@ -1615,6 +1631,7 @@ s32 func_80306840(s32 arg0){
return 7;
}
// some sort of init function if bit6 == 9
void func_8030688C(s32 arg0, s32 position[3], s32 radius, s32 arg3){
Struct_core2_7AF80_2 *temp_v1;
@ -1930,7 +1947,7 @@ bool func_803077FC(f32 arg0[3], s32 *arg1, s32 *arg2, s32 arg3, u32 arg4) {
return FALSE;
}
Cube **func_80307948(int* arg0) {
Cube **func_80307948(s32 arg0[3]) {
int sp34[3];
s32 cubeCount;
int sp24[3];
@ -1992,27 +2009,27 @@ Cube **func_80307948(int* arg0) {
void func_80307CA0(ActorMarker *marker) {
s32 temp_s4;
s32 sp58[3];
s32 marker_bitfield;
s32 marker_position[3];
s32 i;
Cube **cubePtrList;
NodeProp *node;
s32 sp40[3];
s32 temp_v0_3;
s32 var_s0;
s32 node_position[3];
s32 node_radius;
s32 node_idx;
temp_s4 = D_8036A9E4[marker->id];
if ((temp_s4 != 0xFF) && (bitfield_isBitSet(D_8036A9E0, temp_s4) == 1)) {
func_8032E010(marker->propPtr, sp58);
cubePtrList = func_80307948(sp58);
marker_bitfield = sMarkerToBitfield[marker->id];
if ((marker_bitfield != 0xFF) && (bitfield_isBitSet(D_8036A9E0, marker_bitfield) == 1)) {
codeA5BC0_getActorPosition(marker->propPtr, marker_position);
cubePtrList = func_80307948(marker_position);
for(i = 0; cubePtrList[i] != NULL; i++) {
for(var_s0 = 0; var_s0 < cubePtrList[i]->unk0_4; var_s0++){
node = func_8032E02C(cubePtrList[i], var_s0);
if (func_80330F74(node) == temp_s4) {
temp_v0_3 = func_80330F94(node, sp40);
if( ((sp40[0] - temp_v0_3) < sp58[0]) && (sp58[0] < (sp40[0] + temp_v0_3))
&& ((sp40[1] - temp_v0_3) < sp58[1]) && (sp58[1] < (sp40[1] + temp_v0_3))
&& ((sp40[2] - temp_v0_3) < sp58[2]) && (sp58[2] < (sp40[2] + temp_v0_3))
for(node_idx = 0; node_idx < cubePtrList[i]->unk0_4; node_idx++){
node = codeA5BC0_getPropNodeAtIndex(cubePtrList[i], node_idx);
if (codeA5BC0_getNodePropUnkA(node) == marker_bitfield) {
node_radius = codeA5BC0_getPositionAndReturnRadius(node, node_position);
if( ((node_position[0] - node_radius) < marker_position[0]) && (marker_position[0] < (node_position[0] + node_radius))
&& ((node_position[1] - node_radius) < marker_position[1]) && (marker_position[1] < (node_position[1] + node_radius))
&& ((node_position[2] - node_radius) < marker_position[2]) && (marker_position[2] < (node_position[2] + node_radius))
) {
func_80334448(node, marker);
}
@ -2070,7 +2087,7 @@ u32 func_80307EA8(s32 arg0, s32 arg1[3], s32 *arg2, s32 *arg3) {
if ((temp_v0 != NULL) && (temp_v0->prop1Cnt != 0)) {
var_s4 = temp_v0->prop1Ptr[D_803820B4].unk10_31;
*arg2 = temp_v0->prop1Ptr[D_803820B4].unk10_19;
*arg3 = temp_v0->prop1Ptr[D_803820B4].unk6.bit0;
*arg3 = temp_v0->prop1Ptr[D_803820B4].bit0;
arg1[0] = temp_v0->prop1Ptr[D_803820B4].x;
arg1[1] = temp_v0->prop1Ptr[D_803820B4].y;
arg1[2] = temp_v0->prop1Ptr[D_803820B4].z;
@ -2361,7 +2378,7 @@ void func_80308984(void) {
for(iCube = D_80381FA0.cube_list; iCube < D_80381FA0.cube_list + D_80381FA0.cubeCnt; iCube++){
for(iNode = iCube->prop1Ptr; iNode < iCube->prop1Ptr + iCube->prop1Cnt; iNode++){
if (iNode->unk6.bit6 == 6 && iNode->unk6.bit0 == 0){
if (iNode->bit6 == 6 && iNode->bit0 == 0){
u32 tmp = iNode->unk8;
if(tmp >= sp54 && tmp <= sp50) {
@ -2375,7 +2392,7 @@ void func_80308984(void) {
for(jCube = D_80381FA0.cube_list; jCube < D_80381FA0.cube_list + D_80381FA0.cubeCnt; jCube++){
for(jNode = jCube->prop1Ptr; jNode < jCube->prop1Ptr + jCube->prop1Cnt; jNode++){
if (jNode->unk6.bit6 == 6 && jNode->unk6.bit0 == 0 && jNode->unk8 == D_8036ABC0[i]) {
if (jNode->bit6 == 6 && jNode->bit0 == 0 && jNode->unk8 == D_8036ABC0[i]) {
func_8030895C(jCube - D_80381FA0.cube_list);
D_80382150[temp_s4 + 1]++;
jNode = jCube->prop1Ptr + jCube->prop1Cnt;

View File

@ -602,13 +602,13 @@ void func_8032DFF4(Prop *prop, s32 src[3]){
prop->unk4[2] = src[2];
}
void func_8032E010(ActorProp *prop, s32 dst[3]){
void codeA5BC0_getActorPosition(ActorProp *prop, s32 dst[3]){
dst[0] = prop->x;
dst[1] = prop->y;
dst[2] = prop->z;
}
NodeProp *func_8032E02C(Cube *cube, s32 prop_index) {
NodeProp *codeA5BC0_getPropNodeAtIndex(Cube *cube, s32 prop_index) {
if ((prop_index < 0) || (prop_index >= cube->prop1Cnt)) {
return NULL;
}
@ -640,24 +640,24 @@ void cube_free(Cube *cube){
cube->unk0_4 = 0;
}
bool func_8032E178(Cube *arg0, s32 *arg1, s32 arg2) {
NodeProp * temp_a2;
NodeProp *var_v1;
bool __codeA5BC0_pad_func_8032E178(Cube *arg0, s32 *arg1, s32 arg2) {
NodeProp *last_node_ptr;
NodeProp *node_ptr;
if ((arg0 != NULL) && (arg0->prop1Cnt != 0)) {
var_v1 = arg0->prop1Ptr;
temp_a2 = arg0->prop1Ptr + arg0->prop1Cnt;
while (var_v1 < temp_a2) {
if( ((var_v1->unk6.bit0 == 1)
|| ((var_v1->unk6.bit0 == 0) && (var_v1->unk10_6 == 1))
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))
)
&& (var_v1->unk6.bit6 == 6)
&& (arg2 == var_v1->unk8)
&& (node_ptr->bit6 == 6)
&& (arg2 == node_ptr->unk8)
) {
*arg1 = var_v1->unk6.radius;
*arg1 = node_ptr->radius;
return TRUE;
}
var_v1++;
node_ptr++;
}
}
return FALSE;
@ -668,10 +668,10 @@ NodeProp *cube_findNodePropByActorId(Cube *cube, s32 arg1) {
if (cube != NULL && cube->prop1Cnt != 0){
for(i_ptr = cube->prop1Ptr; i_ptr < cube->prop1Ptr + cube->prop1Cnt; i_ptr++){
if( ( (i_ptr->unk6.bit0 == 1)
|| ( (i_ptr->unk6.bit0 == 0) && (i_ptr->unk10_6 == 1))
if( ( (i_ptr->bit0 == 1)
|| ( (i_ptr->bit0 == 0) && (i_ptr->unk10_6 == 1))
)
&& (i_ptr->unk6.bit6 == 6)
&& (i_ptr->bit6 == 6)
&& (arg1 == i_ptr->unk8)
) {
return i_ptr;
@ -689,10 +689,10 @@ 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->unk6.bit0 == 1)
|| ((var_v1->unk6.bit0 == 0) && (var_v1->unk10_6 == 1))
if( ((var_v1->bit0 == 1)
|| ((var_v1->bit0 == 0) && (var_v1->unk10_6 == 1))
)
&& (var_v1->unk6.bit6 == 6)
&& (var_v1->bit6 == 6)
&& (arg2 == var_v1->unk8)
) {
arg1[0] = var_v1->x;
@ -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->unk6.bit0 == 1) || ((i_node->unk6.bit0 == 0) && (i_node->unk10_6 == 1))) && (i_node->unk6.bit6 == 6)) {
if (((i_node->bit0 == 1) || ((i_node->bit0 == 0) && (i_node->unk10_6 == 1))) && (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,10 +778,10 @@ 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->unk6.bit0 == 1)
|| ((i_node->unk6.bit0 == 0) && (i_node->unk10_6 == 1))
if( ( (i_node->bit0 == 1)
|| ((i_node->bit0 == 0) && (i_node->unk10_6 == 1))
)
&& (i_node->unk6.bit6 == 6) && (arg1 == i_node->unk8)
&& (i_node->bit6 == 6) && (arg1 == i_node->unk8)
) {
arg2[count][0] = (f32) i_node->x;
arg2[count][1] = (f32) i_node->y;
@ -804,10 +804,10 @@ 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->unk6.bit0 == 1)
|| ((i_node->unk6.bit0 == 0) && (i_node->unk10_6 == 1))
if( ( (i_node->bit0 == 1)
|| ((i_node->bit0 == 0) && (i_node->unk10_6 == 1))
)
&& (i_node->unk6.bit6 == 6) && (arg2 == i_node->unk8)
&& (i_node->bit6 == 6) && (arg2 == i_node->unk8)
) {
*arg1 = i_node->unkC_31;
return TRUE;
@ -836,12 +836,12 @@ void func_8032E7E8(NodeProp *node, Cube *cube, s32 cnt) {
phi_s3 = cnt - 1;
for(i = 0; i < cnt; i++){
iPtr = node + i;
if( (iPtr->unk6.bit6 == 6)
|| (iPtr->unk6.bit6 == 8)
|| (iPtr->unk6.bit6 == 7)
|| (iPtr->unk6.bit6 == 9)
|| (iPtr->unk6.bit6 == 0xA)
|| (iPtr->unk6.bit0 == 1)
if( (iPtr->bit6 == 6)
|| (iPtr->bit6 == 8)
|| (iPtr->bit6 == 7)
|| (iPtr->bit6 == 9)
|| (iPtr->bit6 == 0xA)
|| (iPtr->bit0 == 1)
){
memcpy(&cube->prop1Ptr[phi_s3], &node[i], sizeof(NodeProp));
phi_s3--;
@ -854,7 +854,7 @@ void func_8032E7E8(NodeProp *node, Cube *cube, s32 cnt) {
for(i = 0; i < cnt; i++){
iPtr = &cube->prop1Ptr[i];
if(!iPtr->unk6.bit0){
if(!iPtr->bit0){
iPtr->unk10_6 = TRUE;
}
}
@ -1316,14 +1316,14 @@ void func_80330208(Cube *cube) {
end_prop = cube->prop1Ptr + cube->prop1Cnt;
func_80326C24(1);
while(i_prop < end_prop){
if (i_prop->unk6.bit6 == 6) {
if (i_prop->bit6 == 6) {
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);
if (actor != NULL) {
actor->unk78_13 = i_prop->unk10_31;
actor->unkF4_8 = i_prop->unk6.radius;
actor->unkF4_8 = i_prop->radius;
func_8032AA58(actor, (i_prop->unkC_22 != 0) ? ((f32)i_prop->unkC_22 * 0.01) : 1.0);
}
}
@ -1333,32 +1333,33 @@ void func_80330208(Cube *cube) {
}
}
// init "special" cubes?
void func_803303B8(Cube *cube) {
s32 sp4C[3];
NodeProp *temp_s2;
NodeProp *var_s0;
s32 position[3];
NodeProp *last_node_prop_ptr;
NodeProp *current_node_ptr;
if ((cube != NULL) && (cube->prop1Cnt != 0)){
var_s0 = cube->prop1Ptr;
temp_s2 = cube->prop1Ptr + cube->prop1Cnt;
while (var_s0 < temp_s2) {
if (var_s0->unk6.bit6 == 7) {
sp4C[0] = (s32) var_s0->x;
sp4C[1] = (s32) var_s0->y;
sp4C[2] = (s32) var_s0->z;
func_803065E4(var_s0->unk8, sp4C, var_s0->unk6.radius, var_s0->unk10_31, var_s0->unk10_7);
} else if (var_s0->unk6.bit6 == 9) {
sp4C[0] = (s32) var_s0->x;
sp4C[1] = (s32) var_s0->y;
sp4C[2] = (s32) var_s0->z;
func_8030688C(var_s0->unk8, sp4C, var_s0->unk6.radius, var_s0->unk10_0);
} else if (var_s0->unk6.bit6 == 0xA) {
sp4C[0] = (s32) var_s0->x;
sp4C[1] = (s32) var_s0->y;
sp4C[2] = (s32) var_s0->z;
func_80306AA8(var_s0->unk8, sp4C, var_s0->unk6.radius);
current_node_ptr = cube->prop1Ptr;
last_node_prop_ptr = cube->prop1Ptr + cube->prop1Cnt;
while (current_node_ptr < last_node_prop_ptr) {
if (current_node_ptr->bit6 == 7) {
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);
} else if (current_node_ptr->bit6 == 9) {
position[0] = (s32) current_node_ptr->x;
position[1] = (s32) current_node_ptr->y;
position[2] = (s32) current_node_ptr->z;
func_8030688C(current_node_ptr->unk8, position, current_node_ptr->radius, current_node_ptr->unk10_0);
} else if (current_node_ptr->bit6 == 0xA) {
position[0] = (s32) current_node_ptr->x;
position[1] = (s32) current_node_ptr->y;
position[2] = (s32) current_node_ptr->z;
func_80306AA8(current_node_ptr->unk8, position, current_node_ptr->radius);
}
var_s0++;
current_node_ptr++;
}
}
}
@ -1598,30 +1599,34 @@ BKSprite *func_80330F50(ActorMarker * marker){
return sp1C;
}
s32 func_80330F74(NodeProp *arg0){
s32 codeA5BC0_getNodePropUnkA(NodeProp *arg0){
return arg0->unkA; //marker_id
}
s32 func_80330F7C(NodeProp *arg0){
return arg0->unk6.bit6;
s32 codeA5BC0_getNodePropBit6(NodeProp *arg0){
return arg0->bit6;
}
s32 func_80330F8C(NodeProp *arg0){
s32 codeA5BC0_getNodePropUnk8(NodeProp *arg0){
return arg0->unk8;
}
s32 func_80330F94(NodeProp *arg0, s32 arg1[3]){
s32 codeA5BC0_getPositionAndReturnRadius(NodeProp *arg0, s32 arg1[3]){
arg1[0] = arg0->x;
arg1[1] = arg0->y;
arg1[2] = arg0->z;
return arg0->unk6.radius;
return arg0->radius;
}
void func_80330FBC(UNK_TYPE(void *)arg0, s32 arg1){
// is used to set global timer time?
void codeA5BC0_setNodePropUnkC(NodeProp *arg0, s32 arg1){
// writes unkC_31 / unkC_22
*(s32*)((s32)arg0 + 0xC) = arg1;
}
s32 func_80330FC4(UNK_TYPE(void *)arg0){
// is used to retrieve global timer time?
s32 codeA5BC0_getNodePropUnkC(NodeProp *arg0){
// reads unkC_31 / unkC_22
return *(s32*)((s32)arg0 + 0xC);
}

View File

@ -299,7 +299,7 @@ extern void chTreasurehunt_checkStepProgress4(s32, s32);
extern void chTreasurehunt_checkStepProgress5(s32, s32);
extern void chMumbo_detransformWarn(s32, s32);
extern void chMumbo_detransformTrigger(s32, s32);
extern void func_8033443C(s32, s32);
extern void func_8033443C(NodeProp *arg0, ActorMarker *arg1);
typedef struct {
@ -310,10 +310,10 @@ typedef struct {
u8 pad1D[3];
}Struct_core2_AD110_0;
typedef void (*Method_core2_AD110)(s32, s32);
typedef void (*CodeAD110Callback)(NodeProp *arg0, ActorMarker *arg1);
/* .data */
Method_core2_AD110 D_8036F980[] = {
CodeAD110Callback sWarpFunctions[] = {
func_80388BEC, func_80334430, func_80386744, func_80386744,
func_80386744, warp_gvEnterJinxy, warp_gvExitJinxy, func_8038F10C,
func_8038F130, warp_bgsEnterMumbosHut, warp_bgsExitMumbosHut, warp_ttcExitNipper,
@ -394,7 +394,7 @@ Method_core2_AD110 D_8036F980[] = {
func_80334430, func_80334430, func_80334430,
};
Method_core2_AD110 D_8036FE5C[] ={
CodeAD110Callback sRadiusTriggers[] ={
func_8033443C,
func_8033443C, func_8033443C, func_8033443C, func_8033443C,
func_8033443C, func_8033443C, func_8033443C, func_8033443C,
@ -547,22 +547,22 @@ void func_80334428(void){}
void func_80334430(s32 arg0, s32 arg1){}
void func_8033443C(s32 arg0, s32 arg1){}
void func_8033443C(NodeProp *arg0, ActorMarker *arg1){}
void func_80334448(NodeProp *arg0, ActorMarker *arg1) {
s32 sp24;
s32 global_timer_time;
switch(func_80330F7C(arg0)) {
case 3: //L80334480
sp24 = globalTimer_getTime();
if ((func_80330FC4(arg0) + 1) != sp24) {
D_8036F980[func_80330F8C(arg0)](arg0, arg1);
switch(codeA5BC0_getNodePropBit6(arg0)) {
case 3: // warp (L80334480)
global_timer_time = globalTimer_getTime();
if ((codeA5BC0_getNodePropUnkC(arg0) + 1) != global_timer_time) {
sWarpFunctions[codeA5BC0_getNodePropUnk8(arg0)](arg0, arg1);
}
func_80330FBC(arg0, sp24);
codeA5BC0_setNodePropUnkC(arg0, global_timer_time);
break;
case 4: //L803344E0
D_8036FE5C[func_80330F8C(arg0)](arg0, arg1);
case 4: // radius trigger like camera (L803344E0)
sRadiusTriggers[codeA5BC0_getNodePropUnk8(arg0)](arg0, arg1);
break;
case 0: //L80334508

View File

@ -243,8 +243,8 @@ bool func_803515EC(NodeProp *arg0) {
s16 phi_v0;
if (arg0->unk6.bit6 != 6) {
return 1;
if (arg0->bit6 != 6) {
return TRUE;
} else {
for(phi_s0 = D_803725C0; phi_s0->unk0 != 0; phi_s0++){
if( (arg0->unk8 == phi_s0->unk0)
@ -263,7 +263,7 @@ bool func_803515EC(NodeProp *arg0) {
return TRUE;
}
bool func_80351700(void * arg0){
bool func_80351700(Prop * arg0){
if (((*(u16*)((s32)arg0 + 0xA) << 0x1E) >> 0x1F)) {
return TRUE;
}

View File

@ -587,7 +587,7 @@ void func_80363330(Actor *this){
void func_80363388(struct_core2_DB010 *arg0, s32 arg1){
f32 sp2C[3];
s32 sp20[3];
s32 tmp_v0 = func_80330F94(arg0, sp20);
s32 tmp_v0 = codeA5BC0_getPositionAndReturnRadius(arg0, sp20);
sp2C[0] = (f32)sp20[0];
sp2C[1] = (f32)sp20[1];
sp2C[2] = (f32)sp20[2];

View File

@ -22,10 +22,10 @@ void func_802C16CC(s32 arg0);
/* .bss */
struct {
s32 unk0;
s32 unk0; // some sort of index?
f32 unk4;
f32 unk8;
f32 unkC[3];
f32 unkC[3]; // copy of camera position
f32 unk18;
f32 unk1C[3];
s32 unk28;
@ -208,20 +208,21 @@ void ncDynamicCam12_update(void) {
}
}
void func_802C1674(s32 arg0, s32 arg1){
void func_802C1674(NodeProp *arg0, ActorMarker *arg1){
if(D_8037DBE0.unk28){
D_8037DBE0.unk28 = -1;
}
}
void func_802C169C(void *arg0, s32 arg1){
func_802C16CC(func_8033451C(*((u16 *)((s32)arg0 + 8))));
void func_802C169C(NodeProp *arg0, ActorMarker *arg1){
func_802C16CC(func_8033451C(arg0->unk8));
}
// sets up dynamic camera for cubes in "area" of arg0
void func_802C16CC(s32 arg0) {
f32 sp54[3];
f32 sp48[3];
f32 sp3C[3];
f32 player_or_node_position[3];
f32 player_position_copy[3];
f32 camera_position[3];
s32 sp38;
s32 sp34;
s16 *sp30;
@ -229,11 +230,11 @@ void func_802C16CC(s32 arg0) {
if ((func_8028ECAC() != BSGROUP_4_LOOK) && !__is_flying_in_FP()){
sp38 = func_80334524(arg0);
if(sp38 != D_8037DBE0.unk28 && D_8037DBE0.unk28 != -1){
player_getPosition(sp54);
ml_vec3f_to_vec3w(sp48, sp54);
sp30 = cubeList_findNodePropByActorId(sp38, sp48);
player_getPosition(player_or_node_position);
ml_vec3f_to_vec3w(player_position_copy, player_or_node_position);
sp30 = cubeList_findNodePropByActorId(sp38, player_position_copy);
if(sp30 != NULL) {
nodeprop_getPosition(sp30, sp54);
nodeprop_getPosition(sp30, player_or_node_position);
switch (func_80304DB8(sp30)) { /* irregular */
default:
D_8037DBE0.unk2E = 0;
@ -253,13 +254,13 @@ void func_802C16CC(s32 arg0) {
break;
}
D_8037DBE0.unk2D = ncDynamicCamera_getState();
ncDynamicCamera_getPosition(sp3C);
ml_vec3f_copy(D_8037DBE0.unkC, sp3C);
ncDynamicCamera_getPosition(camera_position);
ml_vec3f_copy(D_8037DBE0.unkC, camera_position);
D_8037DBE0.unk18 = 0.0f;
D_8037DBE0.unk28 = sp38;
D_8037DBE0.unk0 = func_80341EC4(sp54);
D_8037DBE0.unk8 = func_803243D0(func_802C0EC0(), sp3C);
D_8037DBE0.unk8 = func_802453DC(func_802C0EC0(), D_8037DBE0.unk8, sp3C, baMarker_8028D694() | 0x1E0000);
D_8037DBE0.unk0 = func_80341EC4(player_or_node_position);
D_8037DBE0.unk8 = func_803243D0(func_802C0EC0(), camera_position);
D_8037DBE0.unk8 = func_802453DC(func_802C0EC0(), D_8037DBE0.unk8, camera_position, baMarker_8028D694() | 0x1E0000);
D_8037DBE0.unk2C = 1;
func_80323240(func_802C0EC0(), D_8037DBE0.unk8, D_8037DBE0.unk1C);
if (func_802C11C8(D_8037DBE0.unk1C) == 1) {