Documented ch Motzhand
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user