diff --git a/include/enums.h b/include/enums.h index 826bd9e1..cd16d0b1 100644 --- a/include/enums.h +++ b/include/enums.h @@ -4039,7 +4039,13 @@ enum asset_e ASSET_A84_DIALOG_TURBOTRAINERS_LEARN, ASSET_A85_DIALOG_TURBOTRAINERS_REFRESHER, - ASSET_ADE_TEXT_LOGGO_AS_BEAR = 0xade, + ASSET_AD3_TEXT_UNKNOWN = 0xad3, + ASSET_AD4_TEXT_UNKNOWN, + ASSET_AD5_TEXT_UNKNOWN, + ASSET_AD6_TEXT_UNKNOWN, + + ASSET_ADD_TEXT_UNKNOWN = 0xadd, + ASSET_ADE_TEXT_LOGGO_AS_BEAR, ASSET_ADF_TEXT_ENTER_LOGGO, ASSET_AE0_TEXT_EXIT_LOGGO, diff --git a/include/structs.h b/include/structs.h index 9cc3ce23..d78dc03a 100644 --- a/include/structs.h +++ b/include/structs.h @@ -593,7 +593,7 @@ typedef struct struct_68_s{ Struct68DrawMethod unk8; BKModelBin *unkC; u8 pad10[0x4]; - f32 unk14[3]; //position + f32 position[3]; f32 unk20[3]; //rotation f32 unk2C; //scale u8 unk30; diff --git a/src/MMM/ch/motzhand.c b/src/MMM/ch/motzhand.c index 667195a3..94becdb5 100644 --- a/src/MMM/ch/motzhand.c +++ b/src/MMM/ch/motzhand.c @@ -2,22 +2,32 @@ #include "functions.h" #include "variables.h" -typedef struct{ +typedef struct { f32 alpha; //motzhand_alpha u8 *pattern_ptr; u8 unk8; //pattern_id u8 unk9; //end_current seq? f32 unkC[3]; -}ActorLocal_Motzhand; +} ActorLocal_Motzhand; -void chmotzhand_update(Actor *this); +/* public functions */ +void chMotzhand_update(Actor *this); Actor *chMotzhand_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); /* .data */ +enum chMotzhand_state_e { + MOTZHAND_STATE_0_INIT, + MOTZHAND_STATE_1_UNKNOWN, + MOTZHAND_STATE_2_UNKNOWN, + MOTZHAND_STATE_3_UNKNOWN, + MOTZHAND_STATE_4_UNKNOWN, + MOTZHAND_STATE_5_UNKNOWN +}; + ActorInfo chMotzhand = { MARKER_49_MOTZHAND, ACTOR_3A_MOTZHAND, ASSET_88C_MODEL_MOTZHAND, 0x0, NULL, - chmotzhand_update, func_80326224, chMotzhand_draw, + chMotzhand_update, func_80326224, chMotzhand_draw, 0, 0, 0.0f, 0 }; @@ -25,53 +35,54 @@ u8 sMotzhandPattern1[] = {7, 14, 13, 9, 17, 0xFF}; u8 sMotzhandPattern2[] = {10, 18, 15, 9, 14, 13, 9, 17, 11, 15, 0xFF}; /* .code */ -void func_80387410(f32 dst[3]){ +void func_80387410(f32 dst[3]) { dst[0] = 0.0f; dst[1] = 1500.0f; dst[2] = -2400.0f; } -void chMotzhand_setState(Actor *this, s32 next_state){ - ActorLocal_Motzhand * local = (ActorLocal_Motzhand *) &this->local; +void chMotzhand_setState(Actor *this, s32 next_state) { + ActorLocal_Motzhand *local = (ActorLocal_Motzhand *) &this->local; - if(next_state == 1 && this->state == 0){ + if (next_state == MOTZHAND_STATE_1_UNKNOWN && this->state == MOTZHAND_STATE_0_INIT) { skeletalAnim_set(this->unk148, ASSET_A7_ANIM_MOTZHAND_IDLE, 0.0f, 1.8f); func_80387410(this->position); } - if(next_state == 2){ + if (next_state == MOTZHAND_STATE_2_UNKNOWN) { skeletalAnim_set(this->unk148, ASSET_A7_ANIM_MOTZHAND_IDLE, 0.9f, 1.8f); } - if(next_state == 3){ + if (next_state == MOTZHAND_STATE_3_UNKNOWN) { skeletalAnim_set(this->unk148, ASSET_A8_ANIM_MOTZHAND_PLAY, 0.9f, 1.8f); } - if(next_state == 4){ + if (next_state == MOTZHAND_STATE_4_UNKNOWN) { local->alpha = 1.0f; } - if(next_state == 5){ + if (next_state == MOTZHAND_STATE_5_UNKNOWN) { marker_despawn(this->marker); } this->state = next_state; } -Actor *chMotzhand_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ +Actor *chMotzhand_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { Actor *this = marker_getActor(marker); - ActorLocal_Motzhand * local = (ActorLocal_Motzhand *) &this->local; + ActorLocal_Motzhand *local = (ActorLocal_Motzhand *) &this->local; f32 sp3C[3]; - if(this->state == 0 || this->state == 5) + if (this->state == MOTZHAND_STATE_0_INIT || this->state == MOTZHAND_STATE_5_UNKNOWN) { return this; - - modelRender_setBoneTransformList(skeletalAnim_getBoneTransformList(this->unk148)); - - if(this->state == 4){ - modelRender_setAlpha((s32) (local->alpha * 255.0f)); } - else{ + + modelRender_setBoneTransformList(skeletalAnim_getBoneTransformList(this->unk148)); + + if (this->state == MOTZHAND_STATE_4_UNKNOWN) { + modelRender_setAlpha((s32)(local->alpha * 255.0f)); + } + else { modelRender_setAlpha((s32) 255); } @@ -84,119 +95,124 @@ Actor *chMotzhand_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ } -void func_80387654(ActorMarker* marker) { - Actor* actor = marker_getActor(marker); +void func_80387654(ActorMarker *marker) { + Actor *actor = marker_getActor(marker); - if ((actor->state != 4) && (actor->state != 5)) { - chMotzhand_setState(actor, 4); + if ((actor->state != MOTZHAND_STATE_4_UNKNOWN) && (actor->state != MOTZHAND_STATE_5_UNKNOWN)) { + chMotzhand_setState(actor, MOTZHAND_STATE_4_UNKNOWN); } } bool func_8038769C(ActorMarker *marker) { - return marker_getActor(marker)->state == 1; + return marker_getActor(marker)->state == MOTZHAND_STATE_1_UNKNOWN; } // chMotzhand_startPattern -void func_803876C8(ActorMarker *marker, s32 arg1){ +void func_803876C8(ActorMarker *marker, s32 arg1) { Actor *this = marker_getActor(marker); - ActorLocal_Motzhand * local = (ActorLocal_Motzhand *) &this->local; - + ActorLocal_Motzhand *local = (ActorLocal_Motzhand *) &this->local; + local->unk8 = arg1; - if(arg1 == TRUE){ + if (arg1 == TRUE) { local->pattern_ptr = sMotzhandPattern1; } - else{ + else { local->pattern_ptr = sMotzhandPattern2; } - chMotzhand_setState(this, 2); + chMotzhand_setState(this, MOTZHAND_STATE_2_UNKNOWN); } void func_80387720(ActorMarker *marker) { - Actor * this = marker_getActor(marker); - ActorLocal_Motzhand * local = (ActorLocal_Motzhand *) &this->local; + Actor *this = marker_getActor(marker); + ActorLocal_Motzhand *local = (ActorLocal_Motzhand *) &this->local; local->unk9 = TRUE; } -void chmotzhand_update(Actor *this){ - ActorLocal_Motzhand * local = (ActorLocal_Motzhand *) &this->local; - f32 sp48; - f32 sp3C[3]; +void chMotzhand_update(Actor *this) { + ActorLocal_Motzhand *local = (ActorLocal_Motzhand *) &this->local; + f32 tick; + f32 diff[3]; f32 sp30[3]; - sp48 = time_getDelta(); + tick = time_getDelta(); - if(!this->volatile_initialized){ + if (!this->volatile_initialized) { this->volatile_initialized = TRUE; - if(jiggyscore_isSpawned(JIGGY_60_MMM_MOTZHAND)){ + + if (jiggyscore_isSpawned(JIGGY_60_MMM_MOTZHAND)) { marker_despawn(this->marker); return; } + local->unk8 = FALSE; local->unk9 = FALSE; local->unkC[0] = this->position_x; local->unkC[1] = this->position_y; local->unkC[2] = this->position_z; - chMotzhand_setState(this, 1); + + chMotzhand_setState(this, MOTZHAND_STATE_1_UNKNOWN); }//L803877CC - if(this->state == 2){ - if(local->unk9){ - while(*local->pattern_ptr != 0xff){ + if (this->state == MOTZHAND_STATE_2_UNKNOWN) { + if (local->unk9) { + while (*local->pattern_ptr != 0xff) { *local->pattern_ptr++; //find_seq end } local->unk9 = FALSE; }//L80387820 - if(0xff == *local->pattern_ptr){ + if (0xff == *local->pattern_ptr) { func_80387410(sp30); } - else{ + else { organMinigame_getKeyPosition(*local->pattern_ptr, sp30); - sp30[0] += local->unkC[0]; - sp30[1] += local->unkC[1]; - sp30[2] += local->unkC[2]; + TUPLE_ADD(sp30, local->unkC) }//L80387880 - sp3C[0] = sp30[0] - this->position_x; - sp3C[1] = sp30[1] - this->position_y; - sp3C[2] = sp30[2] - this->position_z; - if(LENGTH_VEC3F(sp3C) < 5.0f){ - if(*local->pattern_ptr == 0xff){ - chMotzhand_setState(this, 1); + diff[0] = sp30[0] - this->position_x; + diff[1] = sp30[1] - this->position_y; + diff[2] = sp30[2] - this->position_z; + + if (LENGTH_VEC3F(diff) < 5.0f) { + if (*local->pattern_ptr == 0xff) { + chMotzhand_setState(this, MOTZHAND_STATE_1_UNKNOWN); } - else{ - chMotzhand_setState(this, 3); + else { + chMotzhand_setState(this, MOTZHAND_STATE_3_UNKNOWN); } } - else{//L80387930 - ml_vec3f_set_length(sp3C, ((local->unk8 == TRUE) ? 150.0f : 225.0f)*sp48); - this->position_x = sp3C[0] + this->position_x; - this->position_y = sp3C[1] + this->position_y; - this->position_z = sp3C[2] + this->position_z; + else {//L80387930 + ml_vec3f_set_length(diff, ((local->unk8 == TRUE) ? 150.0f : 225.0f) * tick); + this->position_x = diff[0] + this->position_x; + this->position_y = diff[1] + this->position_y; + this->position_z = diff[2] + this->position_z; } }//L803879A4 - if(this->state == 3){ - if(skeletalAnim_getLoopCount(this->unk148) > 0){ + if (this->state == MOTZHAND_STATE_3_UNKNOWN) { + if (skeletalAnim_getLoopCount(this->unk148) > 0) { func_80389D9C(*local->pattern_ptr); - if(local->unk9){ - while(*local->pattern_ptr != 0xff){ + + if (local->unk9) { + while (*local->pattern_ptr != 0xff) { *local->pattern_ptr++; //find_seq end } local->unk9 = FALSE; } - else{//L80387A18 + else {//L80387A18 *local->pattern_ptr++; } - chMotzhand_setState(this, 2); + + chMotzhand_setState(this, MOTZHAND_STATE_2_UNKNOWN); } }//L80387A2C - if(this->state == 4){ - local->alpha -= 0.25*sp48; - if(local->alpha <= 0.0f){ - chMotzhand_setState(this, 5); + if (this->state == MOTZHAND_STATE_4_UNKNOWN) { + local->alpha -= 0.25 * tick; + + if (local->alpha <= 0.0f) { + chMotzhand_setState(this, MOTZHAND_STATE_5_UNKNOWN); } } } diff --git a/src/MMM/code_3420.c b/src/MMM/code_3420.c index 9abbb008..2a15e7f9 100644 --- a/src/MMM/code_3420.c +++ b/src/MMM/code_3420.c @@ -2,6 +2,7 @@ #include "functions.h" #include "variables.h" +/* extern functions */ extern void MMM_func_8038B6D4(f32* arg0, s32 arg1); /* internal definitions */ @@ -15,6 +16,7 @@ typedef struct { u8 unk1; } Struct_MMM_3420_1; +/* public functions */ void organMinigame_setState(s32 arg0); /* .data */ @@ -175,7 +177,7 @@ void func_803898EC() { } void func_80389910() { - gcdialog_showText(0xAD5, 0xE, NULL, NULL, MMM_func_80389810, NULL); + gcdialog_showText(ASSET_AD5_TEXT_UNKNOWN, 0xE, NULL, NULL, MMM_func_80389810, NULL); timedFunc_set_2(0.0f, func_8025A6EC, COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7FFF); timed_setStaticCameraToNode(2.0f, 0); timedFunc_set_0(2.1f, MMM_func_803898A0); @@ -192,13 +194,14 @@ void func_803899BC(void){ void organMinigame_setState(s32 next_state){ func_8028F8F8(1, FALSE); - if(next_state == 2){ - if(D_8038C4F0.pattern == 0){ + + if (next_state == 2) { + if (D_8038C4F0.pattern == 0) { D_8038C4F0.pattern = 1; - gcdialog_showText(0xad3, 4, NULL, NULL, MMM_func_80389810, NULL); + gcdialog_showText(ASSET_AD3_TEXT_UNKNOWN, 4, NULL, NULL, MMM_func_80389810, NULL); } - else{//L80389A84 - gcdialog_showText(0xad6, 4, NULL, NULL, MMM_func_80389810, NULL); + else {//L80389A84 + gcdialog_showText(ASSET_AD6_TEXT_UNKNOWN, 4, NULL, NULL, MMM_func_80389810, NULL); } }//L80389A9C @@ -215,13 +218,13 @@ void organMinigame_setState(s32 next_state){ }//L80389AF4 if(next_state == 4){ - gcdialog_showText(0xadd, 4, NULL, NULL, MMM_func_80389810, NULL); + gcdialog_showText(ASSET_ADD_TEXT_UNKNOWN, 4, NULL, NULL, MMM_func_80389810, NULL); func_80387720(D_8038C4F0.motzhand_marker); } if(next_state == 5){ D_8038C4F0.pattern++; - gcdialog_showText(0xad4, 4, NULL, NULL, MMM_func_80389810, NULL); + gcdialog_showText(ASSET_AD4_TEXT_UNKNOWN, 4, NULL, NULL, MMM_func_80389810, NULL); func_80387720(D_8038C4F0.motzhand_marker); } @@ -246,17 +249,22 @@ void organMinigame_getKeyPosition(s32 key_indx, f32 position[3]) { position[0] = -145.0f; position[1] = 0.0f; position[2] = 0.0f; + for (iPtr = &D_8038C198[0]; iPtr <= &D_8038C198[key_indx]; iPtr++) { is_black_key = (iPtr->unk0 == 2 || iPtr->unk0 == 4); + if (is_black_key != 0) { position[0] += 67.0f; position[1] += 12.5; position[2] += -230.0f; - } else { + } + else { position[0] += 170.0f; } - if (iPtr == &D_8038C198[key_indx]) + + if (iPtr == &D_8038C198[key_indx]) { break; + } if (is_black_key != 0) { position[0] -= 67.0f; @@ -309,30 +317,39 @@ void code3420_handleOrganGame(s32 arg0, s32 arg1) { D_8038C4F0.unk8 = &D_8038BF20; func_80250170(0, 0x6A, 0); D_8038C4F0.state = 0; + if ((map_get() == MAP_1C_MMM_CHURCH) && (arg1 == 2)) { D_8038C4F0.motzhand_marker = NULL; D_8038C4F0.pattern = 0; + key_position[0] = -1345.0f; key_position[1] = 1150.0f; key_position[2] = -2300.0f; - for(iPtr = &D_8038C198[0]; iPtr->unk0; iPtr++){ - is_black_key = (iPtr->unk0 == 2 || iPtr->unk0 == 4); - if (is_black_key) { - key_position[0] += 122.0f; - key_position[1] += 12.5; - } else { - key_position[0] += 170.0f; - } - iPtr->unk1 = func_80351838(key_position, iPtr->unk0, iPtr - &D_8038C198[0]); - if (is_black_key) { - key_position[0] -= 122.0f; - key_position[1] -= 12.5; - } + + for (iPtr = &D_8038C198[0]; iPtr->unk0; iPtr++) { + is_black_key = iPtr->unk0 == 2 || iPtr->unk0 == 4; + + if (is_black_key) { + key_position[0] += 122.0f; + key_position[1] += 12.5; + } + else { + key_position[0] += 170.0f; + } + + iPtr->unk1 = func_80351838(key_position, iPtr->unk0, iPtr - &D_8038C198[0]); + + if (is_black_key) { + key_position[0] -= 122.0f; + key_position[1] -= 12.5; + } } + if (jiggyscore_isSpawned(JIGGY_60_MMM_MOTZHAND)) { organMinigame_setState(7); return; } + organMinigame_setState(1); } } @@ -346,8 +363,9 @@ void organMinigame_update(void){ f32 plyr_pos[3]; Actor *motzhand_2; - - if(D_8038C4F0.state == 0) return; + if (D_8038C4F0.state == 0) { + return; + } if(func_802501A0(0, 0x6A, &sp4C)){ func_80250170(0, 0x6A, 0); diff --git a/src/core2/code_C9F00.c b/src/core2/code_C9F00.c index 823e770e..d2561800 100644 --- a/src/core2/code_C9F00.c +++ b/src/core2/code_C9F00.c @@ -100,17 +100,20 @@ Actor *func_80350E90(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { temp_s0 = &D_803861B0.unk4[marker->actrArrayIdx]; temp_v0 = temp_s0->unkC; + if (temp_v0 == NULL) { - return 0; - } else { - if (temp_s0->unk8 != NULL) { - temp_s0->unk8(&temp_s0->local, temp_s0, temp_s0->unk14, temp_s0->unk20, temp_s0->unk2C, temp_v0, gfx, mtx, vtx); - } else { - modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); - modelRender_draw(gfx, mtx, temp_s0->unk14, temp_s0->unk20, temp_s0->unk2C, NULL, temp_s0->unkC); - } + return NULL; } - return 0; + + if (temp_s0->unk8 != NULL) { + temp_s0->unk8(&temp_s0->local, temp_s0, temp_s0->position, temp_s0->unk20, temp_s0->unk2C, temp_v0, gfx, mtx, vtx); + } + else { + modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); + modelRender_draw(gfx, mtx, temp_s0->position, temp_s0->unk20, temp_s0->unk2C, NULL, temp_s0->unkC); + } + + return NULL; } s32 func_80350F7C(ActorMarker *marker, s32 arg1, f32 arg2[3], s32 arg3, s32 arg4) { @@ -126,7 +129,7 @@ s32 func_80350F7C(ActorMarker *marker, s32 arg1, f32 arg2[3], s32 arg3, s32 arg4 colision_list = model_getCollisionList(temp_s0->unkC); vtx_list = model_getVtxList(temp_s0->unkC); - sp4C = func_802E805C(colision_list, vtx_list, temp_s0->unk14, temp_s0->unk20, temp_s0->unk2C, arg1, arg2, arg3, arg4); + sp4C = func_802E805C(colision_list, vtx_list, temp_s0->position, temp_s0->unk20, temp_s0->unk2C, arg1, arg2, arg3, arg4); if (sp4C != 0) { if (func_8029453C()) { D_80386180.unk20[0] = (s32) arg2[0]; @@ -150,7 +153,7 @@ s32 func_803510B4(ActorMarker *marker, s32 arg1, f32 arg2[3], f32 arg3, s32 arg4 } collision_list = model_getCollisionList(sp40->unkC); vertex_list = model_getVtxList(sp40->unkC); - return func_802E9118(collision_list, vertex_list, sp40->unk14, sp40->unk20, sp40->unk2C, arg1, arg2, arg3, arg4, arg5, flagFliter); + return func_802E9118(collision_list, vertex_list, sp40->position, sp40->unk20, sp40->unk2C, arg1, arg2, arg3, arg4, arg5, flagFliter); } s32 func_80351198(ActorMarker *marker, s32 arg1, f32 arg2, s32 arg3, s32 arg4) { @@ -165,11 +168,11 @@ s32 func_80351198(ActorMarker *marker, s32 arg1, f32 arg2, s32 arg3, s32 arg4) { } collision_list = model_getCollisionList(sp38->unkC); vtx_list = model_getVtxList(sp38->unkC); - return func_802E9DD8(collision_list, vtx_list, sp38->unk14, sp38->unk20, sp38->unk2C, arg1, arg2, arg3, arg4); + return func_802E9DD8(collision_list, vtx_list, sp38->position, sp38->unk20, sp38->unk2C, arg1, arg2, arg3, arg4); } -Struct68s * func_8035126C(f32 arg0[3], f32 arg1[3], f32 arg2, s32 arg3, enum asset_e arg4) { +Struct68s * func_8035126C(f32 position[3], f32 arg1[3], f32 arg2, s32 arg3, enum asset_e arg4) { s32 sp2C; s32 sp1C; @@ -177,22 +180,20 @@ Struct68s * func_8035126C(f32 arg0[3], f32 arg1[3], f32 arg2, s32 arg3, enum ass if (D_803861B0.unk8 == D_803861B0.unkC) { sp2C = D_803861B0.unk8 - D_803861B0.unk4; sp1C = sp2C * 2; - D_803861B0.unk4 = (Struct68s *)realloc(D_803861B0.unk4, sp1C * sizeof(Struct68s)); + D_803861B0.unk4 = (Struct68s *) realloc(D_803861B0.unk4, sp1C * sizeof(Struct68s)); D_803861B0.unk8 = D_803861B0.unk4 + sp2C; D_803861B0.unkC = D_803861B0.unk4 + sp1C; } + D_803861B0.unk8->unk0 = 0; D_803861B0.unk8->unk30 = 0; D_803861B0.unk8->unk8 = NULL; D_803861B0.unk8->unkC = NULL; D_803861B0.unk8->unk2C = arg2; D_803861B0.unk8->unk31 = arg3; - D_803861B0.unk8->unk14[0] = arg0[0]; - D_803861B0.unk8->unk14[1] = arg0[1]; - D_803861B0.unk8->unk14[2] = arg0[2]; - D_803861B0.unk8->unk20[0] = arg1[0]; - D_803861B0.unk8->unk20[1] = arg1[1]; - D_803861B0.unk8->unk20[2] = arg1[2]; + + TUPLE_COPY(D_803861B0.unk8->position, position) + TUPLE_COPY(D_803861B0.unk8->unk20, arg1) func_80351AD0(D_803861B0.unk8, arg4); return D_803861B0.unk8++; @@ -224,7 +225,7 @@ void func_803514F4(Struct68s *arg0){ } void func_80351538(Struct68s *arg0){ - arg0->unk4 = (ActorMarker *)func_8032FBE4(arg0->unk14, func_80350E90, 1, 0x47); + arg0->unk4 = (ActorMarker *)func_8032FBE4(arg0->position, func_80350E90, 1, 0x47); ((ActorMarker *)arg0->unk4)->collidable = FALSE; ((ActorMarker *)arg0->unk4)->actrArrayIdx = (arg0 - D_803861B0.unk4); ((ActorMarker *)arg0->unk4)->unk18 = &D_80386180.unk4; @@ -291,9 +292,7 @@ ActorMarker *func_80351794(Struct68s *arg0){ } void func_8035179C(Struct68s* arg0, f32 arg1[3]) { - arg1[0] = arg0->unk14[0]; - arg1[1] = arg0->unk14[1]; - arg1[2] = arg0->unk14[2]; + TUPLE_COPY(arg1, arg0->position) } void * func_803517B8(s32 arg0){ @@ -305,9 +304,7 @@ Struct68s * func_803517E8(s32 arg0){ } void func_80351814(Struct68s *arg0, f32 arg1[3]) { - arg1[0] = arg0->unk20[0]; - arg1[1] = arg0->unk20[1]; - arg1[2] = arg0->unk20[2]; + TUPLE_COPY(arg1, arg0->unk20) } f32 func_80351830(Struct68s *arg0) { @@ -315,14 +312,14 @@ f32 func_80351830(Struct68s *arg0) { } -s32 func_80351838(f32 arg0[3], s32 arg1, s32 arg2) { - f32 sp2C[3]; +s32 func_80351838(f32 position[3], s32 key_flag, s32 arg2) { + f32 rotation[3]; Struct68s *sp28; - sp2C[0] = sp2C[1] = sp2C[2] = 0.0f; - sp28 = func_8035126C(arg0, &sp2C, 1.0f, 4, arg1 + 0x884); + rotation[0] = rotation[1] = rotation[2] = 0.0f; + sp28 = func_8035126C(position, &rotation, 1.0f, 4, key_flag + 0x884); func_80351538(sp28); - func_8038B5D8(&sp28->local, sp28, arg1, arg2); + func_8038B5D8(&sp28->local, sp28, key_flag, arg2); return sp28 - D_803861B0.unk4; } @@ -416,7 +413,7 @@ void func_80351B28(Struct68s *arg0, f32 arg1[3]) { if(arg0->unkC != NULL){ sp34 = func_8033A12C(arg0->unkC); if(sp34 != NULL){ - if(func_802EA760(sp34, 0, arg0->unk14, arg0->unk20, arg0->unk2C, 0, &sp48, &sp38)){ + if(func_802EA760(sp34, 0, arg0->position, arg0->unk20, arg0->unk2C, 0, &sp48, &sp38)){ func_802EA760(sp34, 0, arg1, arg0->unk20, arg0->unk2C, 0, &sp3C, &sp38); if(func_80309DBC(&sp48, &sp3C, sp38, &sp54, 3, 0)){ return; @@ -424,17 +421,13 @@ void func_80351B28(Struct68s *arg0, f32 arg1[3]) { } } } - arg0->unk14[0] = arg1[0]; - arg0->unk14[1] = arg1[1]; - arg0->unk14[2] = arg1[2]; - func_8032F64C(arg0->unk14, arg0->unk4); + + TUPLE_COPY(arg0->position, arg1) + func_8032F64C(arg0->position, arg0->unk4); } - void func_80351C2C(Struct68s *arg0, f32 arg1[3]){ - arg0->unk20[0] = arg1[0]; - arg0->unk20[1] = arg1[1]; - arg0->unk20[2] = arg1[2]; + TUPLE_COPY(arg0->unk20, arg1) } void func_80351C48(void) { @@ -450,7 +443,7 @@ void func_80351C48(void) { if ((sp38[0] == D_80386180.unk20[0]) && (sp38[1] == D_80386180.unk20[1]) && (sp38[2] == D_80386180.unk20[2])) { player_getPosition(sp4C); mlMtxIdent(); - func_80252CC4(D_80386180.unk2C->unk14, D_80386180.unk2C->unk20, D_80386180.unk2C->unk2C, 0); + func_80252CC4(D_80386180.unk2C->position, D_80386180.unk2C->unk20, D_80386180.unk2C->unk2C, 0); mlMtx_apply_vec3f(D_80386180.unk14, sp4C); if (func_8029FC4C() != 0) { D_80386180.unk0 = D_80386180.unk2C; @@ -469,7 +462,7 @@ void func_80351C48(void) { } if (D_80386180.unk2C != NULL) { mlMtxIdent(); - func_80252C08(D_80386180.unk2C->unk14, D_80386180.unk2C->unk20, D_80386180.unk2C->unk2C, NULL); + func_80252C08(D_80386180.unk2C->position, D_80386180.unk2C->unk20, D_80386180.unk2C->unk2C, NULL); mlMtx_apply_vec3f(&sp4C, &D_80386180.unk14); func_8028FAB0(&sp4C); } @@ -492,12 +485,10 @@ void func_80351E60(Struct6Bs *arg0, Struct68s *arg1, f32 arg2) { arg0->unk10[1] = sinf(((arg0->unk34 * arg0->unk0) / 180.0) * BAD_PI) * 20.0f; arg0->unk4[0] = cosf(((arg0->unk34 * arg0->unk0) / 180.0) * BAD_PI) * 7.5; arg0->unk4[1] = sinf(((arg0->unk34 * arg0->unk0) / 180.0) * BAD_PI) * 3.0f; - sp24[0] = arg0->unk1C[0] + arg0->unk10[0]; - sp24[1] = arg0->unk1C[1] + arg0->unk10[1]; - sp24[2] = arg0->unk1C[2] + arg0->unk10[2]; + + TUPLE_ADD_COPY(sp24, arg0->unk1C, arg0->unk10) func_80351B28(arg1, &sp24); - sp24[0] = arg0->unk28[0] + arg0->unk4[0]; - sp24[1] = arg0->unk28[1] + arg0->unk4[1]; - sp24[2] = arg0->unk28[2] + arg0->unk4[2]; + + TUPLE_ADD_COPY(sp24, arg0->unk28, arg0->unk4) func_80351C2C(arg1, &sp24); }