Merge branch 'mr-origin-89'

This commit is contained in:
banjo.decomp
2024-10-08 02:06:56 -05:00
40 changed files with 709 additions and 585 deletions

View File

@@ -2,11 +2,18 @@
#include "functions.h"
#include "variables.h"
/* extern functions */
extern void ml_vec3f_assign(f32[3], f32, f32, f32);
/* public functions */
void chLoggo_update(Actor *this);
/* .data */
enum chLoggo_state_e {
LOGGO_STATE_1_IDLE = 1,
LOGGO_STATE_2_FLUSHING
};
ActorAnimationInfo chLoggoAnimations[] = {
{0, 0.0f},
{ASSET_238_ANIM_LOGGO_IDLE, 0.8f},
@@ -14,61 +21,66 @@ ActorAnimationInfo chLoggoAnimations[] = {
};
ActorInfo chLoggo = {
MARKER_252_LOGGO, ACTOR_37F_LOGGO, ASSET_519_MODEL_LOGGO,
0x1, chLoggoAnimations,
chLoggo_update, actor_update_func_80326224, actor_draw,
MARKER_252_LOGGO, ACTOR_37F_LOGGO, ASSET_519_MODEL_LOGGO,
0x1, chLoggoAnimations,
chLoggo_update, actor_update_func_80326224, actor_draw,
1000, 0, 0.0f, 0
};
/* .code */
void __chLoggo_flush(ActorMarker* marker) {
Actor* actor = marker_getActor(marker);
void __chLoggo_flush(ActorMarker *marker) {
Actor *actor = marker_getActor(marker);
func_8028F918(2);
subaddie_set_state_with_direction(actor, 2, 0.01, 1);
subaddie_set_state_with_direction(actor, LOGGO_STATE_2_FLUSHING, 0.01, 1);
actor_playAnimationOnce(actor);
actor->lifetime_value = 3.2f;
}
void __chLoggo_textCallback(ActorMarker* caller, enum asset_e text_id, s32 arg3) {
void __chLoggo_textCallback(ActorMarker *caller, enum asset_e text_id, s32 arg3) {
__chLoggo_flush(caller);
}
void __chLoggo_collide(ActorMarker* this_marker, ActorMarker *other_marker) {
void __chLoggo_collide(ActorMarker *this_marker, ActorMarker *other_marker) {
Actor *this = marker_getActor(this_marker);
if ((player_getTransformation() == TRANSFORM_3_PUMPKIN) && !fileProgressFlag_get(FILEPROG_89_ENTERED_LOGGO_AS_PUMPKIN)) {
if (gcdialog_showText(ASSET_ADF_TEXT_ENTER_LOGGO, 0x2B, this->position, this->marker, &__chLoggo_textCallback, 0) != 0) {
actor_collisionOff(this);
fileProgressFlag_set(FILEPROG_89_ENTERED_LOGGO_AS_PUMPKIN, TRUE);
}
return;
}
if ((player_getTransformation() == TRANSFORM_3_PUMPKIN) && fileProgressFlag_get(FILEPROG_89_ENTERED_LOGGO_AS_PUMPKIN)) {
actor_collisionOff(this);
__chLoggo_flush(this_marker);
return;
}
if ((player_getTransformation() == TRANSFORM_1_BANJO) && !fileProgressFlag_get(FILEPROG_88_TRIED_LOGGO_AS_BEAR)){
if(gcdialog_showText(ASSET_ADE_TEXT_LOGGO_AS_BEAR, 0x2A, this->position, NULL, NULL, NULL)) {
if ((player_getTransformation() == TRANSFORM_1_BANJO) && !fileProgressFlag_get(FILEPROG_88_TRIED_LOGGO_AS_BEAR)) {
if (gcdialog_showText(ASSET_ADE_TEXT_LOGGO_AS_BEAR, 0x2A, this->position, NULL, NULL, NULL)) {
fileProgressFlag_set(FILEPROG_88_TRIED_LOGGO_AS_BEAR, TRUE);
}
}
}
void chLoggo_update(Actor *this){
f32 sp44;
f32 sp38[3];
void chLoggo_update(Actor *this) {
f32 tick;
f32 position[3];
s32 sp34;
sp44 = time_getDelta();
if(!this->volatile_initialized){
tick = time_getDelta();
if (!this->volatile_initialized) {
this->volatile_initialized = TRUE;
this->marker->propPtr->unk8_3 = TRUE;
actor_collisionOn(this);
marker_setCollisionScripts(this->marker, __chLoggo_collide, NULL, NULL);
subaddie_set_state_with_direction(this, 1, 0.01f, 1);
subaddie_set_state_with_direction(this, LOGGO_STATE_1_IDLE, 0.01f, 1);
actor_loopAnimation(this);
this->lifetime_value = 0.0f;
if (!fileProgressFlag_get(FILEPROG_8A_EXITED_LOGGO) && levelSpecificFlags_get(LEVEL_FLAG_33_MMM_UNKNOWN)) {
@@ -78,45 +90,44 @@ void chLoggo_update(Actor *this){
}
}
switch(this->state){
case 1:
switch (this->state) {
case LOGGO_STATE_1_IDLE:
sp34 = func_803114B0() ? 12000 : 0;
if(actor_animationIsAt(this, 0.09f)){
if (actor_animationIsAt(this, 0.09f)) {
func_8030E878(SFX_109_LOGGO_LID_CLAP, randf2(0.975f, 1.025f), MAX(0, 22000 - sp34), this->position, 400.0f, 1000.0f);
break;
}
if(actor_animationIsAt(this, 0.37f)){
if (actor_animationIsAt(this, 0.37f)) {
func_8030E878(SFX_20_METAL_CLANK_1, randf2(1.675f, 1.725f), MAX(0, 12000 - sp34), this->position, 400.0f, 1000.0f);
break;
}
if(actor_animationIsAt(this, 0.6f)){
if (actor_animationIsAt(this, 0.6f)) {
func_8030E878(SFX_3F_CAULDRON_SQEAK_1, randf2(0.975f, 1.025f), MAX(0, 7000 - sp34), this->position, 400.0f, 1000.0f);
break;
}
if(actor_animationIsAt(this, 0.16f)){
if (actor_animationIsAt(this, 0.16f)) {
func_8030E878(SFX_40_CAULDRON_SQEAK_2, randf2(0.975f, 1.025f), MAX(0, 7000 - sp34), this->position, 400.0f, 1000.0f);
break;
}
break;
case 2:
if(actor_animationIsAt(this, 0.46f)){
case LOGGO_STATE_2_FLUSHING:
if (actor_animationIsAt(this, 0.46f)) {
this->marker->propPtr->unk8_3 = FALSE;
FUNC_8030E8B4(SFX_92_TOILET_FLUSH, 1.0f, 32000, this->position, 600, 1500);
levelSpecificFlags_set(LEVEL_FLAG_33_MMM_UNKNOWN, TRUE);
ml_vec3f_assign(sp38, this->position_x - 50.0f, this->position_y + 50.0f, this->position_z);
func_8028F6E4(BS_INTR_2F_LOGGO, sp38);
ml_vec3f_assign(position, this->position_x - 50.0f, this->position_y + 50.0f, this->position_z);
func_8028F6E4(BS_INTR_2F_LOGGO, position);
}
if(0.0 < this->lifetime_value){
this->lifetime_value -= sp44;
if (0.0 < this->lifetime_value) {
this->lifetime_value -= tick;
}
else{
else {
warp_mmmEnterLoggo(0, 0);
}
break;

View File

@@ -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, actor_update_func_80326224, chMotzhand_draw,
chMotzhand_update, actor_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);
}
}
}

View File

@@ -2,91 +2,109 @@
#include "functions.h"
#include "variables.h"
extern void func_80389484(ActorMarker *, f32);
/* extern functions */
extern void chPortrait_break(ActorMarker *, f32);
typedef struct {
f32 unk0;
}ActorLocal_PortraitChompa;
f32 timer;
} ActorLocal_PortraitChompa;
void func_80388028(Actor *this);
Actor *func_80387AA0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
/* public functions */
void chChompa_update(Actor *this);
Actor *chChompa_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
/* .data */
ActorInfo D_8038BAD0 = {
MARKER_254_PORTRAIT_CHOMPA_A, ACTOR_381_PORTRAIT_CHOMPA, ASSET_521_MODEL_PORTRAIT_CHOMPA,
enum chChompa_state_e {
CHOMPA_STATE_0_INIT,
CHOMPA_STATE_1_IDLE,
CHOMPA_STATE_2_GROWLING,
CHOMPA_STATE_3_WAITING_TO_BITE,
CHOMPA_STATE_4_BITING,
CHOMPA_STATE_5_DYING,
CHOMPA_STATE_6_DEAD
};
ActorInfo D_8038BAD0 = {
MARKER_254_PORTRAIT_CHOMPA_A, ACTOR_381_PORTRAIT_CHOMPA, ASSET_521_MODEL_PORTRAIT_CHOMPA,
0x0, NULL,
func_80388028, NULL, func_80387AA0,
chChompa_update, NULL, chChompa_draw,
0, 0, 0.0f, 0
};
/* .code */
Actor *func_80387AA0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) {
Actor* actor = marker_getActor(marker);
if ((actor->state == 0) || (actor->state == 1) || (actor->state == 6) || (actor->state == 2)) {
Actor *chChompa_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) {
Actor *actor = marker_getActor(marker);
if (actor->state == CHOMPA_STATE_0_INIT || actor->state == CHOMPA_STATE_1_IDLE || actor->state == CHOMPA_STATE_6_DEAD || actor->state == CHOMPA_STATE_2_GROWLING) {
return actor;
}
return actor_draw(marker, gfx, mtx, vtx);
}
void func_80387B14(Actor *this, s32 next_state){
void chChompa_setState(Actor *this, s32 next_state) {
ActorLocal_PortraitChompa *local = (ActorLocal_PortraitChompa *) &this->local;
f32 tmp = 2.5f;
this->marker->id = 0x1d1;
if(next_state == 1 || next_state == 2){
if (next_state == CHOMPA_STATE_1_IDLE || next_state == CHOMPA_STATE_2_GROWLING) {
skeletalAnim_set(this->unk148, 0x23e, 0.0f, 2.5f);
skeletalAnim_setProgress(this->unk148, 0.99f);
skeletalAnim_setBehavior(this->unk148, SKELETAL_ANIM_4_STOPPED);
if(this->state == 4){
local->unk0 = randf2(0.5f, 1.0f);
if (this->state == CHOMPA_STATE_4_BITING) {
local->timer = randf2(0.5f, 1.0f);
}
else{
local->unk0 = 0.0f;
else {
local->timer = 0.0f;
}
}//L80387BD0
if(this->state == 1 && next_state == 2){
if (this->state == CHOMPA_STATE_1_IDLE && next_state == CHOMPA_STATE_2_GROWLING) {
FUNC_8030E624(SFX_3EF, 0.9f, 32675);
}
if(next_state == 3){
local->unk0 = 0.2f;
if (next_state == CHOMPA_STATE_3_WAITING_TO_BITE) {
local->timer = 0.2f;
}
if(next_state == 4){
if (next_state == CHOMPA_STATE_4_BITING) {
this->marker->id = MARKER_254_PORTRAIT_CHOMPA_A;
skeletalAnim_set(this->unk148, 0x23e, 0.0f, 2.5f);
skeletalAnim_setBehavior(this->unk148, SKELETAL_ANIM_2_ONCE);
if(this->unk100){
func_80389484(this->unk100, tmp + 0.55);
if (this->unk100) {
chPortrait_break(this->unk100, tmp + 0.55);
}
FUNC_8030E624(SFX_3EF, 1.1f, 25000);
FUNC_8030E624(SFX_3EF, 1.1f, 25000);
}//L80387CAC
if(next_state == 5){
if (next_state == CHOMPA_STATE_5_DYING) {
func_8030E6D4(SFX_1E_HITTING_AN_ENEMY_2);
actor_collisionOff(this);
}
this->state = next_state;
}
void MMM_func_80387CF4(ActorMarker *this_marker, ActorMarker *other_marker) {
func_8030E6D4(0x1E);
void __chChompa_hit(ActorMarker *this_marker, ActorMarker *other_marker) {
func_8030E6D4(SFX_1E_HITTING_AN_ENEMY_2);
}
void func_80387D1C(ActorMarker* this_marker, ActorMarker *other_marker) {
void __chChompa_die(ActorMarker *this_marker, ActorMarker *other_marker) {
Actor *this = marker_getActor(this_marker);
func_80387B14(this, 5);
chChompa_setState(this, CHOMPA_STATE_5_DYING);
}
void func_80387D48(ActorMarker *marker){
void __chChompa_spwanPortrait(ActorMarker *marker) {
Actor *this = marker_getActor(reinterpret_cast(ActorMarker *, marker));
enum asset_e portrait_id;
Actor *portrait;
switch(this->unkF4_8){
switch (this->unkF4_8) {
case 0x32:
portrait_id = ACTOR_382_PORTRAIT_OF_GRUNTY;
break;
@@ -109,13 +127,14 @@ void func_80387D48(ActorMarker *marker){
portrait_id = ACTOR_382_PORTRAIT_OF_GRUNTY;
break;
}
portrait = spawn_child_actor(portrait_id, &this);
portrait->yaw = this->yaw;
this->unk100 = portrait->marker;
portrait->unk10_1 = FALSE;
}
void func_80387DF8(f32 position[3], s32 count, enum asset_e sprite_id) {
void __chChompa_emitDust(f32 position[3], s32 count, enum asset_e sprite_id) {
static s32 D_8038BAF4[3] = {0xB4, 0xFF, 0x8C};
static ParticleScaleAndLifetimeRanges D_8038BB00 = {{0.2f, 0.4f}, {1.8f, 2.8f}, {0.0f, 0.15f}, {0.7f, 1.2f}, 0.0f, 0.01f};
static ParticleSettingsVelocityAccelerationPosition D_8038BB28 = {
@@ -123,9 +142,8 @@ void func_80387DF8(f32 position[3], s32 count, enum asset_e sprite_id) {
{{ 0.0f, -600.0f, 0.0f}, { 0.0f, -600.0f, 0.0f}},
{{ -50.0f, -50.0f, -50.0f}, { 50.0f, 50.0f, 50.0f}}
};
ParticleEmitter *pCtrl;
pCtrl = partEmitMgr_newEmitter(count);
ParticleEmitter *pCtrl = partEmitMgr_newEmitter(count);
particleEmitter_setRGB(pCtrl, D_8038BAF4);
particleEmitter_setSprite(pCtrl, sprite_id);
particleEmitter_setPosition(pCtrl, position);
@@ -134,16 +152,15 @@ void func_80387DF8(f32 position[3], s32 count, enum asset_e sprite_id) {
particleEmitter_emitN(pCtrl, count);
}
void func_80387E84(f32 position[3], s32 count, enum asset_e model_id) {
void __chChompa_emitBones(f32 position[3], s32 count, enum asset_e model_id) {
static ParticleScaleAndLifetimeRanges D_8038BB70 = {{1.0f, 1.0f}, {1.0f, 1.0f}, {0.0f, 0.0f}, {3.2f, 3.2f}, 0.0f, 0.45f};
static ParticleSettingsVelocityAccelerationPosition D_8038BB98 = {
{{-90.0f, 300.0f, -90.0f}, {90.0f, 660.0f, 90.0f}},
{{ 0.0f, -1200.0f, 0.0f}, { 0.0f, -1200.0f, 0.0f}},
{{-50.0f, 0.0f, -50.0f}, {50.0f, 50.0f, 50.0f}}
};
ParticleEmitter *pCtrl;
pCtrl = partEmitMgr_newEmitter(count);
ParticleEmitter *pCtrl = partEmitMgr_newEmitter(count);
particleEmitter_setModel(pCtrl, model_id);
particleEmitter_setPosition(pCtrl, position);
particleEmitter_setVelocityAccelerationAndPositionRanges(pCtrl, &D_8038BB98);
@@ -157,97 +174,103 @@ void func_80387E84(f32 position[3], s32 count, enum asset_e model_id) {
particleEmitter_emitN(pCtrl, count);
}
void func_80387F7C(Actor *this){
void __chChompa_emitDeathEffects(Actor *this) {
f32 sp2C[3];
f32 sp20[3];
if(!this->marker->unk14_21) return;
if (!this->marker->unk14_21) {
return;
}
func_8034A174(this->marker->unk44, 5, sp2C);
func_8034A174(this->marker->unk44, 6, sp20);
func_80387E84(sp2C, 1, ASSET_523_MODEL_PORTRAIT_CHOMPA_TEETH);
func_80387E84(sp2C, 1, ASSET_524_MODEL_PORTRAIT_CHOMPA_HEAD);
func_80387E84(sp20, 6, ASSET_525_MODEL_PORTRAIT_CHOMPA_PART);
func_80387DF8(sp2C, 2, ASSET_700_SPRITE_DUST);
func_80387DF8(sp20, 2, ASSET_700_SPRITE_DUST);
__chChompa_emitBones(sp2C, 1, ASSET_523_MODEL_PORTRAIT_CHOMPA_TEETH);
__chChompa_emitBones(sp2C, 1, ASSET_524_MODEL_PORTRAIT_CHOMPA_HEAD);
__chChompa_emitBones(sp20, 6, ASSET_525_MODEL_PORTRAIT_CHOMPA_PART);
__chChompa_emitDust(sp2C, 2, ASSET_700_SPRITE_DUST);
__chChompa_emitDust(sp20, 2, ASSET_700_SPRITE_DUST);
}
void func_80388028(Actor *this){
void chChompa_update(Actor *this) {
ActorLocal_PortraitChompa *local = (ActorLocal_PortraitChompa *) &this->local;
f32 sp58 = time_getDelta();
f32 tick = time_getDelta();
f32 plyr_position[3];
f32 plyr_dist;
f32 sp44;
f32 sp40;
f32 anim_prev_progress;
f32 anim_progress;
if(!this->volatile_initialized){
if (!this->volatile_initialized) {
this->volatile_initialized = TRUE;
this->unk16C_0 = TRUE;
marker_setCollisionScripts(this->marker, NULL, MMM_func_80387CF4, func_80387D1C);
__spawnQueue_add_1((GenFunction_1)func_80387D48, reinterpret_cast(s32, this->marker));
func_80387B14(this, (this->state < 5) ? 1 : 6);
marker_setCollisionScripts(this->marker, NULL, __chChompa_hit, __chChompa_die);
__spawnQueue_add_1((GenFunction_1) __chChompa_spwanPortrait, reinterpret_cast(s32, this->marker));
chChompa_setState(this, this->state < CHOMPA_STATE_5_DYING ? CHOMPA_STATE_1_IDLE : CHOMPA_STATE_6_DEAD);
}//L803880B4
player_getPosition(plyr_position);
plyr_dist = ml_distance_vec3f(this->position, plyr_position);
if(this->state == 4)
if (this->state == CHOMPA_STATE_4_BITING) {
actor_collisionOn(this);
else
}
else {
actor_collisionOff(this);
if(this->state == 1 && plyr_dist < this->scale*400.0f){
func_80387B14(this, 2);
}
if(this->state == 2){
if(0.0f < local->unk0){
local->unk0 -= sp58;
if (this->state == CHOMPA_STATE_1_IDLE && plyr_dist < this->scale * 400.0f) {
chChompa_setState(this, CHOMPA_STATE_2_GROWLING);
}
if (this->state == CHOMPA_STATE_2_GROWLING) {
if (0.0f < local->timer) {
local->timer -= tick;
}
else if(plyr_dist < this->scale*300.0f){
func_80387B14(this, 3);
else if (plyr_dist < this->scale * 300.0f) {
chChompa_setState(this, CHOMPA_STATE_3_WAITING_TO_BITE);
}
else if(this->scale*500.0f < plyr_dist){
func_80387B14(this, 1);
else if (this->scale * 500.0f < plyr_dist) {
chChompa_setState(this, CHOMPA_STATE_1_IDLE);
}
}//L80388204
if(this->state == 3){
if(ml_timer_update(&local->unk0, sp58)){
func_80387B14(this, 4);
if (this->state == CHOMPA_STATE_3_WAITING_TO_BITE) {
if (ml_timer_update(&local->timer, tick)) {
chChompa_setState(this, CHOMPA_STATE_4_BITING);
}
}
if(this->state == 4){
skeletalAnim_getProgressRange(this->unk148, &sp44, &sp40);
if(sp44 < 0.56 && 0.56 <= sp40){
if (this->state == CHOMPA_STATE_4_BITING) {
skeletalAnim_getProgressRange(this->unk148, &anim_prev_progress, &anim_progress);
if (anim_prev_progress < 0.56 && 0.56 <= anim_progress) {
this->marker->id = 0x1d1;
}
if(sp44 < 0.5 && 0.5 <= sp40){
if (anim_prev_progress < 0.5 && 0.5 <= anim_progress) {
FUNC_8030E624(SFX_2_CLAW_SWIPE, 0.9f, 32000);
}
if( (sp44 < 0.11 && 0.11 <= sp40)
|| (sp44 < 0.32 && 0.32 <= sp40)
|| (sp44 < 0.53 && 0.53 <= sp40)
){
if ((anim_prev_progress < 0.11 && 0.11 <= anim_progress) ||
(anim_prev_progress < 0.32 && 0.32 <= anim_progress) ||
(anim_prev_progress < 0.53 && 0.53 <= anim_progress)
) {
func_8030E6A4(SFX_6D_CROC_BITE, randf2(0.95f, 1.05f), 32000);
}
if(sp44 < 0.9 && 0.9 <= sp40){
if (anim_prev_progress < 0.9 && 0.9 <= anim_progress) {
func_8030E6D4(SFX_2_CLAW_SWIPE);
}
if(skeletalAnim_getLoopCount(this->unk148) > 0){
func_80387B14(this, 2);
if (skeletalAnim_getLoopCount(this->unk148) > 0) {
chChompa_setState(this, CHOMPA_STATE_2_GROWLING);
}
}
if(this->state == 5){
if (this->state == CHOMPA_STATE_5_DYING) {
func_8030E6D4(SFX_D7_GRABBA_DEATH);
func_80387F7C(this);
func_80387B14(this, 6);
__chChompa_emitDeathEffects(this);
chChompa_setState(this, CHOMPA_STATE_6_DEAD);
}
}

View File

@@ -287,7 +287,7 @@ void func_80388BDC(Actor *this) {
f64 phi_f0;
func_802D3D74(this);
mapSpecificFlags_set(1, BOOL((this->yaw > 260.0f) && (this->yaw < 330.0f)));
mapSpecificFlags_set(MMM_SPECIFIC_FLAG_TUMBLAR_BROKEN, BOOL((this->yaw > 260.0f) && (this->yaw < 330.0f)));
if (!this->volatile_initialized) {
if (this->yaw != 0.0f) {
this->lifetime_value = 0.5f;
@@ -304,11 +304,11 @@ void func_80388BDC(Actor *this) {
switch (this->state) {
case 1:
this->yaw = 0.0f;
if(mapSpecificFlags_get(0)) {
if(mapSpecificFlags_get(MMM_SPECIFIC_FLAG_0_UNKNOWN)) {
func_802BAFE4(0x21);
subaddie_set_state(this, 6);
func_80244BB0(0, 0x6A, 0x7FF8, 0.3f);
mapSpecificFlags_set(2, 0);
mapSpecificFlags_set(MMM_SPECIFIC_FLAG_2_UNKNOWN, FALSE);
func_8025A6EC(COMUSIC_4_MMM_CLOCK_VERSION, -1);
func_8025AE0C(2000, 3.0f);
}
@@ -350,7 +350,7 @@ void func_80388BDC(Actor *this) {
subaddie_set_state(this, 1U);
this->yaw = 0.0f;
func_8030E540(SFX_7F_HEAVYDOOR_SLAM);
mapSpecificFlags_set(0, 0);
mapSpecificFlags_set(MMM_SPECIFIC_FLAG_0_UNKNOWN, FALSE);
func_80244C78(0);
if (!this->unk38_31) {
func_8025A6EC(COMUSIC_3C_MINIGAME_LOSS, 0x7FF8);

View File

@@ -2,11 +2,17 @@
#include "functions.h"
#include "variables.h"
Actor *func_80389350(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
void func_803893A4(Actor *this);
/* public functions */
Actor *chPortrait_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
void chPortrait_update(Actor *this);
/* .data */
ActorAnimationInfo D_8038BE30[] ={
enum chPortrait_state_e {
PORTRAIT_STATE_1_IDLE = 1,
PORTRAIT_STATE_2_BROKEN
};
ActorAnimationInfo D_8038BE30[] = {
{0x000, 0.0f},
{0x23F, 10000000.0f},
{0x23F, 2.0f},
@@ -14,68 +20,69 @@ ActorAnimationInfo D_8038BE30[] ={
ActorInfo D_8038BE48 = {
MARKER_255_PORTRAIT_OF_GRUNTY, ACTOR_382_PORTRAIT_OF_GRUNTY, ASSET_522_MODEL_PORTRAIT_OF_GRUNTY,
0x1, D_8038BE30,
func_803893A4, actor_update_func_80326224, func_80389350,
0x1, D_8038BE30,
chPortrait_update, actor_update_func_80326224, chPortrait_draw,
0, 0, 0.0f, 0
};
ActorInfo D_8038BE6C = {
MARKER_257_PORTRAIT_OF_BLACKEYE, ACTOR_384_PORTRAIT_OF_BLACKEYE, ASSET_527_MODEL_PORTRAIT_OF_BLACKEYE,
0x1, D_8038BE30,
func_803893A4, actor_update_func_80326224, func_80389350,
0x1, D_8038BE30,
chPortrait_update, actor_update_func_80326224, chPortrait_draw,
0, 0, 0.0f, 0
};
ActorInfo D_8038BE90 = {
MARKER_258_PORTRAIT_OF_TOWER, ACTOR_385_PORTRAIT_OF_TOWER, ASSET_528_MODEL_PORTRAIT_OF_TOWER,
0x1, D_8038BE30,
func_803893A4, actor_update_func_80326224, func_80389350,
0x1, D_8038BE30,
chPortrait_update, actor_update_func_80326224, chPortrait_draw,
0, 0, 0.0f, 0
};
ActorInfo D_8038BEB4 = {
MARKER_259_PORTRAIT_OF_TREE_AND_MOON, ACTOR_386_PORTRAIT_OF_TREE_AND_MOON, ASSET_529_MODEL_PORTRAIT_OF_TREE_AND_MOON,
0x1, D_8038BE30,
func_803893A4, actor_update_func_80326224, func_80389350,
0x1, D_8038BE30,
chPortrait_update, actor_update_func_80326224, chPortrait_draw,
0, 0, 0.0f, 0
};
ActorInfo D_8038BED8 = {
MARKER_25A_PORTRAIT_OF_TEEHEE, ACTOR_387_PORTRAIT_OF_TEEHEE, ASSET_52A_MODEL_PORTRAIT_OF_TEEHEE,
0x1, D_8038BE30,
func_803893A4, actor_update_func_80326224, func_80389350,
0x1, D_8038BE30,
chPortrait_update, actor_update_func_80326224, chPortrait_draw,
0, 0, 0.0f, 0
};
ActorInfo D_8038BEFC = {
MARKER_25B_PORTRAIT_OF_MINION, ACTOR_388_PORTRAIT_OF_MINION, ASSET_52B_MODEL_PORTRAIT_OF_MINION,
0x1, D_8038BE30,
func_803893A4, actor_update_func_80326224, func_80389350,
0x1, D_8038BE30,
chPortrait_update, actor_update_func_80326224, chPortrait_draw,
0, 0, 0.0f, 0
};
/* .code */
Actor *func_80389350(ActorMarker* marker, Gfx** graphics, Mtx** matrix, Vtx** vertex) {
Actor *chPortrait_draw(ActorMarker *marker, Gfx **graphics, Mtx **matrix, Vtx **vertex) {
func_8033A45C(3, marker_getActor(marker)->unk38_31);
return actor_draw(marker, graphics, matrix, vertex);
}
void func_803893A4(Actor *this){
if(!this->volatile_initialized){
void chPortrait_update(Actor *this) {
if (!this->volatile_initialized) {
this->volatile_initialized = TRUE;
this->marker->propPtr->unk8_3 = TRUE;
actor_collisionOff(this);
this->unk38_31 = 2;
}
switch(this->state){
case 1:
switch (this->state) {
case PORTRAIT_STATE_1_IDLE:
animctrl_setAnimTimer(this->animctrl, 0.0f);
break;
case 2:
if(actor_animationIsAt(this, 0.999f)){
subaddie_set_state_with_direction(this, 1, 0.001f, 0);
case PORTRAIT_STATE_2_BROKEN:
if (actor_animationIsAt(this, 0.999f)) {
subaddie_set_state_with_direction(this, PORTRAIT_STATE_1_IDLE, 0.001f, 0);
actor_playAnimationOnce(this);
this->unk38_31 = 2;
}
@@ -83,10 +90,10 @@ void func_803893A4(Actor *this){
}
}
void func_80389484(ActorMarker * marker, f32 anim_duration){
void chPortrait_break(ActorMarker *marker, f32 anim_duration) {
Actor *this = marker_getActor(marker);
subaddie_set_state_with_direction(this, 2, 0.001f, 1);
subaddie_set_state_with_direction(this, PORTRAIT_STATE_2_BROKEN, 0.001f, 1);
actor_playAnimationOnce(this);
animctrl_setDuration(this->animctrl, anim_duration);
this->unk38_31 = 1;

View File

@@ -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);

View File

@@ -72,21 +72,21 @@ void func_8038A140(UNK_TYPE(s32) arg0) {
if (arg0 == 2) {
func_80324E38(0.3f, 3);
timed_setStaticCameraToNode(0.3f, 1);
timedFunc_set_2(0.3f, mapSpecificFlags_set, 3, 1);
timedFunc_set_2(0.3f, mapSpecificFlags_set, MMM_SPECIFIC_FLAG_3_UNKNOWN, TRUE);
func_80324E38(3.0f, 0);
timed_exitStaticCamera(3.0f);
timedFunc_set_1(3.0f, func_8038A140, 3);
}
if (arg0 == 3) {
if (MMM_D_8038C510.unk8 == 1) {
mapSpecificFlags_set(3, 1);
mapSpecificFlags_set(MMM_SPECIFIC_FLAG_3_UNKNOWN, 1);
}
item_set(ITEM_0_HOURGLASS_TIMER, 75*60 - 1);
item_set(6, 1);
}
if (MMM_D_8038C510.unk8 == 3) {
item_set(6, 0);
mapSpecificFlags_set(4, 1);
mapSpecificFlags_set(MMM_SPECIFIC_FLAG_4_UNKNOWN, 1);
}
if (arg0 == 4) {
func_8028F66C(BS_INTR_F);
@@ -181,7 +181,7 @@ void func_8038A82C(Struct_MMM_3D50_0 * arg0){
if(arg0->unk2 == 'X'){
MMM_func_8038A54C(arg0, 1);
player_getPosition(sp44);
func_8038AD10(MMM_D_8038C510.unkC, MMM_D_8038C510.unk10, sp38);
chTumblar_copyPosition(MMM_D_8038C510.unkC, MMM_D_8038C510.unk10, sp38);
sp38[1] = sp44[1];
func_8028F620(sp38, 300.0f, -1500.0f);
return;
@@ -192,7 +192,7 @@ void func_8038A82C(Struct_MMM_3D50_0 * arg0){
MMM_func_8038A54C(arg0, 3);
if( iPtr->unk0[iPtr->unk4] == 0){
func_8038A140(5);
func_8038AF3C(MMM_D_8038C510.unkC, MMM_D_8038C510.unk10);
chTumblar_congratulate(MMM_D_8038C510.unkC, MMM_D_8038C510.unk10);
func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 32000);
}
else{
@@ -249,7 +249,7 @@ void func_8038AA44(void){
func_8038A750();
if( MMM_D_8038C510.unk8 == 1
&& MMM_D_8038C510.unkC != NULL
&& func_8038AD4C(MMM_D_8038C510.unkC, MMM_D_8038C510.unk10)
&& chTumblar_isBanjoAbove(MMM_D_8038C510.unkC, MMM_D_8038C510.unk10)
){
if (!levelSpecificFlags_get(LEVEL_FLAG_2F_MMM_UNKNOWN)) {
levelSpecificFlags_set(LEVEL_FLAG_2F_MMM_UNKNOWN, TRUE);
@@ -265,9 +265,9 @@ void func_8038AA44(void){
func_8038A140(4);
}
else if( MMM_D_8038C510.unkC != NULL
&& func_8038AD4C(MMM_D_8038C510.unkC, MMM_D_8038C510.unk10)
&& chTumblar_isBanjoAbove(MMM_D_8038C510.unkC, MMM_D_8038C510.unk10)
){
func_8038AD10(MMM_D_8038C510.unkC, MMM_D_8038C510.unk10, sp28);
chTumblar_copyPosition(MMM_D_8038C510.unkC, MMM_D_8038C510.unk10, sp28);
tmp_v0 = func_8033F3C0(MMM_D_8038C510.unk0, sp28);
if(tmp_v0){
sp24 = func_8038A26C(tmp_v0);
@@ -286,7 +286,7 @@ void func_8038AA44(void){
}//L8038AB7C
if( MMM_D_8038C510.unk8 == 5
&& func_8038AD38(MMM_D_8038C510.unkC, MMM_D_8038C510.unk10)
&& chTumblar_isDisappeared(MMM_D_8038C510.unkC, MMM_D_8038C510.unk10)
){
func_8038A140(6);
}

View File

@@ -3,16 +3,25 @@
#include "variables.h"
#include <core1/viewport.h>
/* extern functions */
extern void sfxsource_setSampleRate(u8, s32);
extern f32 func_80258640(f32[3], f32[3]);
extern f32 ml_vec3f_horizontal_distance_zero_likely(f32[3], f32[3]);
/* data */
enum chTumblar_state_e {
TUMBLAR_STATE_0_IDLE,
TUMBLAR_STATE_1_CONGRATULATING,
TUMBLAR_STATE_2_BREAKING,
TUMBLAR_STATE_3_DISAPPEARED
};
typedef struct {
ActorMarker *unk0;
u8 unk4;
u8 pad5[3];
f32 unk8;
f32 unkC[3];
}Struct_MMM_47D0_0;
ActorMarker *jiggy_marker;
u8 state;
u8 unused[3];
f32 timer;
f32 velocity[3];
} Struct_MMM_47D0_0;
/* .code */
void MMM_func_8038ABC0(s32 arg0) {
@@ -21,172 +30,198 @@ void MMM_func_8038ABC0(s32 arg0) {
}
}
void func_8038AC04(void){
if((*(u32*)PHYS_TO_K1(0x1D0)) - 0x356BAAAE){
void func_8038AC04(void) {
if ((*(u32 *) PHYS_TO_K1(0x1D0)) - 0x356BAAAE) {
MMM_func_8038ABC0(0x820);
}
}
//BREAK???==========
void func_8038AC40(Struct_MMM_47D0_0 *arg0, struct struct_68_s *arg1, f32 position[3], f32 rotation[3], f32 scale, BKModelBin *model_bin, Gfx **gfx, Mtx **mtx, Vtx **vtx){
u8 temp_v0;
if (arg0->unk4 != 3) {
if ((arg0->unk4 == 0) || (arg0->unk4 == 1)) {
void chTumblar_draw(Struct_MMM_47D0_0 *arg0, struct struct_68_s *arg1, f32 position[3], f32 rotation[3], f32 scale, BKModelBin *model_bin, Gfx **gfx, Mtx **mtx, Vtx **vtx) {
if (arg0->state != TUMBLAR_STATE_3_DISAPPEARED) {
if (arg0->state == TUMBLAR_STATE_0_IDLE || arg0->state == TUMBLAR_STATE_1_CONGRATULATING) {
modelRender_setAlpha(0xFF);
} else if (arg0->unk4 == 2) {
modelRender_setAlpha((s32)((1 - ((f64)arg0->unk8 * 1)) * 255.0));
}
else if (arg0->state == TUMBLAR_STATE_2_BREAKING) {
modelRender_setAlpha((s32)((1 - ((f64) arg0->timer * 1)) * 255.0));
}
modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL);
modelRender_draw(gfx, mtx, position, rotation, scale, NULL, model_bin);
}
}
void func_8038AD10(s32 arg0, s32 arg1, f32 arg2[3]) {
func_8035179C(arg1, arg2);
void chTumblar_copyPosition(s32 arg0, s32 arg1, f32 arg2[3]) {
func_8035179C_copyPosition(arg1, arg2);
}
bool func_8038AD38(Struct_MMM_47D0_0 *arg0, s32 arg1){
return arg0->unk4 == 3;
bool chTumblar_isDisappeared(Struct_MMM_47D0_0 *arg0, s32 arg1) {
return arg0->state == TUMBLAR_STATE_3_DISAPPEARED;
}
bool func_8038AD4C(s32 arg0, s32 arg1) {
bool chTumblar_isBanjoAbove(s32 arg0, s32 arg1) {
f32 plyr_pos[3];
f32 sp18[3];
f32 position[3];
player_getPosition(plyr_pos);
func_8035179C(arg1, sp18);
return func_803518D4(arg1)
&& (func_80258640(sp18, plyr_pos) < 40.0f)
&& (player_getTransformation() == TRANSFORM_1_BANJO)
&& (func_8028ECAC() == 0);
func_8035179C_copyPosition(arg1, position);
return func_803518D4(arg1) &&
ml_vec3f_horizontal_distance_zero_likely(position, plyr_pos) < 40.0f &&
player_getTransformation() == TRANSFORM_1_BANJO &&
func_8028ECAC() == 0;
}
void MMM_func_8038ADF0(Struct_MMM_47D0_0 *arg0, Struct68s *arg1) {
u8 sp3F;
f32 sp38;
void chTumblar_init(Struct_MMM_47D0_0 *arg0, Struct68s *arg1) {
u8 sfxsource_index;
f32 distance_to_jiggy;
Actor *jiggy;
f32 sp28[3];
f32 position[3];
arg0->state = TUMBLAR_STATE_0_IDLE;
arg0->timer = 0.0f;
arg0->velocity[0] = 0.0f;
arg0->velocity[1] = 0.0f;
arg0->velocity[2] = 0.0f;
arg0->unk4 = 0;
arg0->unk8 = 0.0f;
arg0->unkC[0] = 0.0f;
arg0->unkC[1] = 0.0f;
arg0->unkC[2] = 0.0f;
func_8038AA30(arg0, arg1);
func_80351A14(arg1, (Struct68DrawMethod)func_8038AC40);
sp3F = func_80351758(arg1);
sfxsource_setSfxId(sp3F, SFX_3EC_CCW_DOOR_OPENING);
func_8030DD14(sp3F, 3);
sfxsource_playSfxAtVolume(sp3F, 0.6f);
sfxsource_setSampleRate(sp3F, 0);
func_8030E2C4(sp3F);
func_8035179C(arg1, sp28);
sp38 = 500.0f;
jiggy = actorArray_findClosestActorFromActorId(sp28, ACTOR_46_JIGGY, -1, &sp38);
func_80351A14(arg1, (Struct68DrawMethod) chTumblar_draw);
sfxsource_index = func_80351758_getSfxsourceIndex(arg1);
sfxsource_setSfxId(sfxsource_index, SFX_3EC_CCW_DOOR_OPENING);
func_8030DD14(sfxsource_index, 3);
sfxsource_playSfxAtVolume(sfxsource_index, 0.6f);
sfxsource_setSampleRate(sfxsource_index, 0);
func_8030E2C4(sfxsource_index);
func_8035179C_copyPosition(arg1, position);
distance_to_jiggy = 500.0f;
jiggy = actorArray_findClosestActorFromActorId(position, ACTOR_46_JIGGY, -1, &distance_to_jiggy);
if (jiggy != NULL) {
arg0->unk0 = jiggy->marker;
} else {
arg0->unk0 = NULL;
arg0->jiggy_marker = jiggy->marker;
}
else {
arg0->jiggy_marker = NULL;
}
if (arg0->unk0 != NULL) {
arg0->unk0->collidable = FALSE;
if (arg0->jiggy_marker != NULL) {
arg0->jiggy_marker->collidable = FALSE;
}
if (jiggyscore_isCollected(JIGGY_62_MMM_TUMBLAR)) {
func_80351A04(arg1, 1);
arg0->unk4 = 3;
arg0->state = TUMBLAR_STATE_3_DISAPPEARED;
}
}
void func_8038AF0C(ActorMarker *marker, enum asset_e text_id, s32 arg2) {
mapSpecificFlags_set(1, 1);
void __chTumblar_congratulationTextCallback(ActorMarker *marker, enum asset_e text_id, s32 arg2) {
mapSpecificFlags_set(MMM_SPECIFIC_FLAG_TUMBLAR_BROKEN, TRUE);
}
void func_8038AF3C(Struct_MMM_47D0_0 *arg0, s32 arg1) {
gcdialog_showText(0xADB, 4, NULL, arg0->unk0, func_8038AF0C, NULL);
arg0->unk4 = 1;
void chTumblar_congratulate(Struct_MMM_47D0_0 *arg0, s32 arg1) {
gcdialog_showText(ASSET_ADB_TEXT_UNKNOWN, 4, NULL, arg0->jiggy_marker, __chTumblar_congratulationTextCallback, NULL);
arg0->state = TUMBLAR_STATE_1_CONGRATULATING;
}
void func_8038AF90(Struct_MMM_47D0_0 *arg0, Struct68s *arg1, f32 arg2) {
f32 sp7C[3];
f32 sp70[3];
f32 sp64[3];
Actor *temp_v0_2;
f32 sp54[3];
f32 sp48[3];
f32 sp40[2];
s32 sp3C;
u8 sp38;
void chTumblar_update(Struct_MMM_47D0_0 *arg0, Struct68s *arg1, f32 tick) {
f32 viewport_position[3];
f32 viewport_rotation[3];
f32 direction[3];
Actor *jiggy;
f32 position[3];
f32 plyr_pos[3];
f32 joystick[2];
s32 is_banjo_above;
u8 sfxsource_index;
arg0->timer += tick;
arg0->unk8 += arg2;
if (arg0->unk4 == 0) {
func_8035179C(arg1, sp54);
func_8024E71C(0, sp40);
sp3C = func_8038AD4C(arg0, arg1);
if (sp3C) {
if (arg0->state == TUMBLAR_STATE_0_IDLE) {
func_8035179C_copyPosition(arg1, position);
controller_getJoystick(0, joystick);
is_banjo_above = chTumblar_isBanjoAbove(arg0, arg1);
if (is_banjo_above) {
func_8028F66C(BS_INTR_D_SURF);
}
if (sp3C && ((sp40[0] != 0.0f) || (sp40[1] != 0.0f))) {
viewport_getRotation_vec3f(sp70);
sp64[0] = sp40[0];
sp64[1] = 0.0f;
sp64[2] = -sp40[1];
ml_vec3f_yaw_rotate_copy(sp64, sp64, sp70[1]);
arg0->unkC[0] += sp64[0] * 2500.0f * arg2;
arg0->unkC[2] += sp64[2] * 2500.0f * arg2;
} else {
arg0->unkC[0] *= 0.7;
arg0->unkC[2] *= 0.7;
if (is_banjo_above && (joystick[0] != 0.0f || joystick[1] != 0.0f)) {
viewport_getRotation_vec3f(viewport_rotation);
direction[0] = joystick[0];
direction[1] = 0.0f;
direction[2] = -joystick[1];
ml_vec3f_yaw_rotate_copy(direction, direction, viewport_rotation[1]);
arg0->velocity[0] += direction[0] * 2500.0f * tick;
arg0->velocity[2] += direction[2] * 2500.0f * tick;
}
if (LENGTH_VEC3F(arg0->unkC) > 400.0f) {
ml_vec3f_set_length(arg0->unkC, 400.0f);
else {
arg0->velocity[0] *= 0.7;
arg0->velocity[2] *= 0.7;
}
sp54[0] += arg0->unkC[0] * arg2;
sp54[2] += arg0->unkC[2] * arg2;
func_80351B28(arg1, sp54);
func_8035179C(arg1, sp54);
if (arg0->unk0 != NULL) {
viewport_getPosition_vec3f(sp7C);
sp64[0] = sp54[0] - sp7C[0];
sp64[2] = sp54[2] - sp7C[2];
sp64[1] = 0.0f;
ml_vec3f_normalize(sp64);
temp_v0_2 = marker_getActor(arg0->unk0);
temp_v0_2->position[0] = sp54[0] + (sp64[0] * 20.0f);
temp_v0_2->position[2] = sp54[2] + (sp64[2] * 20.0f);
if (LENGTH_VEC3F(arg0->velocity) > 400.0f) {
ml_vec3f_set_length(arg0->velocity, 400.0f);
}
} else if (arg0->unk4 == 2) {
if (arg0->unk8 >= 1.0f) {
arg0->unk4 = 3U;
if (arg0->unk0 != NULL) {
arg0->unk0->collidable = TRUE;
position[0] += arg0->velocity[0] * tick;
position[2] += arg0->velocity[2] * tick;
func_80351B28(arg1, position);
func_8035179C_copyPosition(arg1, position);
if (arg0->jiggy_marker != NULL) {
viewport_getPosition_vec3f(viewport_position);
direction[0] = position[0] - viewport_position[0];
direction[2] = position[2] - viewport_position[2];
direction[1] = 0.0f;
ml_vec3f_normalize(direction);
jiggy = marker_getActor(arg0->jiggy_marker);
jiggy->position[0] = position[0] + (direction[0] * 20.0f);
jiggy->position[2] = position[2] + (direction[2] * 20.0f);
}
}
else if (arg0->state == TUMBLAR_STATE_2_BREAKING) {
if (arg0->timer >= 1.0f) {
arg0->state = TUMBLAR_STATE_3_DISAPPEARED;
if (arg0->jiggy_marker != NULL) {
arg0->jiggy_marker->collidable = TRUE;
}
func_80351A04(arg1, 1);
}
arg0->unkC[0] *= 0.7;
arg0->unkC[2] *= 0.7;
arg0->velocity[0] *= 0.7;
arg0->velocity[2] *= 0.7;
}
if (arg0->unk4 == 1) {
sp38 = func_80351758(arg1);
sfxsource_setSampleRate(sp38, 0);
} else {
sp38 = func_80351758(arg1);
sfxsource_setSampleRate(sp38, (s32) ((LENGTH_VEC3F(arg0->unkC) / 400.0) * 15000.0));
if (arg0->state == TUMBLAR_STATE_1_CONGRATULATING) {
sfxsource_index = func_80351758_getSfxsourceIndex(arg1);
sfxsource_setSampleRate(sfxsource_index, 0);
}
player_getPosition(sp48);
func_8035179C(arg1, sp54);
if (!mapSpecificFlags_get(0) && (arg0->unk4 == 0) && (func_80258640(sp54, sp48) < 250.0f)){
if(gcdialog_showText(0xADA, 0, NULL, NULL, NULL, NULL)) {
else {
sfxsource_index = func_80351758_getSfxsourceIndex(arg1);
sfxsource_setSampleRate(sfxsource_index, (s32)((LENGTH_VEC3F(arg0->velocity) / 400.0) * 15000.0));
}
player_getPosition(plyr_pos);
func_8035179C_copyPosition(arg1, position);
if (!mapSpecificFlags_get(MMM_SPECIFIC_FLAG_0_UNKNOWN) && arg0->state == TUMBLAR_STATE_0_IDLE && ml_vec3f_horizontal_distance_zero_likely(position, plyr_pos) < 250.0f) {
if (gcdialog_showText(ASSET_ADA_TEXT_UNKNOWN, 0, NULL, NULL, NULL, NULL)) {
mapSpecificFlags_set(0, TRUE);
}
}
if ((arg0->unk4 == 1) && mapSpecificFlags_get(1)) {
arg0->unk4 = 2U;
arg0->unk8 = 0.0f;
mapSpecificFlags_set(1, 0);
FUNC_8030E8B4(SFX_11B_TUMBLAR_DISAPPEARING_1, 1.0f, 30000, sp54, 500, 2500);
if (arg0->state == TUMBLAR_STATE_1_CONGRATULATING && mapSpecificFlags_get(MMM_SPECIFIC_FLAG_TUMBLAR_BROKEN)) {
arg0->state = TUMBLAR_STATE_2_BREAKING;
arg0->timer = 0.0f;
mapSpecificFlags_set(MMM_SPECIFIC_FLAG_TUMBLAR_BROKEN, FALSE);
FUNC_8030E8B4(SFX_11B_TUMBLAR_DISAPPEARING_1, 1.0f, 30000, position, 500, 2500);
}
}

View File

@@ -74,7 +74,7 @@ void func_8038B630(Struct5Fs *arg0, Struct68s *arg1){
f32 sp20;
sp20 = alCents2Ratio(func_80389BBC()*100);
phi_s0 = func_80351758(arg1);
phi_s0 = func_80351758_getSfxsourceIndex(arg1);
func_8030E394(phi_s0);
sfxsource_playSfxAtVolume(phi_s0, sp20);
sfxsource_setSfxId(phi_s0, 0x3f3);
@@ -118,7 +118,7 @@ void func_8038B790(Struct5Fs *arg0, Struct68s *arg1, f32 arg2) {
if (arg0->unk14 <= 0.0f) {
func_80351954(arg1);
} else if (arg0->unk14 <= 1.0f) {
sfxsource_setSampleRate(func_80351758(arg1), (s32)(arg0->unk14 * 32767.0f));
sfxsource_setSampleRate(func_80351758_getSfxsourceIndex(arg1), (s32)(arg0->unk14 * 32767.0f));
}
}

View File

@@ -2,93 +2,104 @@
#include "functions.h"
#include "variables.h"
void func_80387280(Actor *this);
/* public functions */
void chFlowerpot_update(Actor *this);
/* .data */
enum chFlowerpot_state_e {
FLOWER_POT_STATE_1_IDLE = 1,
FLOWER_POT_STATE_2_FLOWERED
};
ActorAnimationInfo D_8038BA50[] = {
{0x00, 0.0f},
{0x00, 0.0f},
{ASSET_A9_ANIM_FLOWER_POT, 2.0f},
{ASSET_A9_ANIM_FLOWER_POT, 2.0f}
};
ActorInfo D_8038BA68 = {
MARKER_34_CEMETARY_POT, ACTOR_25_CEMETARY_POT, ASSET_3AE_MODEL_GRAVE_FLOWER_POT,
0x1, D_8038BA50,
func_80387280, actor_update_func_80326224, actor_draw,
MARKER_34_CEMETARY_POT, ACTOR_25_CEMETARY_POT, ASSET_3AE_MODEL_GRAVE_FLOWER_POT,
0x1, D_8038BA50,
chFlowerpot_update, actor_update_func_80326224, actor_draw,
0, 0, 0.0f, 0
};
/* .code */
//chflowerpots_getRemaining
s32 func_803871B0(void) {
s32 chFlowerpot_getRemaining(void) {
return levelSpecificFlags_getN(0x39, 3);
}
//chflowerpots_setRemaining
void func_803871D4(s32 arg0) {
void chFlowerpot_setRemaining(s32 arg0) {
levelSpecificFlags_setN(0x39, arg0, 3);
}
void MMM_func_803871FC(Actor *this){
switch(this->state){
case 1:
void MMM_func_803871FC(Actor *this) {
switch (this->state) {
case FLOWER_POT_STATE_1_IDLE:
func_8033A45C(3, FALSE);
break;
case 2:
case FLOWER_POT_STATE_2_FLOWERED:
func_8033A45C(3, TRUE);
break;
}
func_803255FC(this);
}
void mmm_resetFlowerPots() {
func_803871D4(5);
void chFlowerpot_reset() {
chFlowerpot_setRemaining(5);
}
//chflowerpots_update
void func_80387280(Actor *this){
void chFlowerpot_update(Actor *this) {
this->marker->propPtr->unk8_3 = TRUE;
if(!this->initialized){
if (!this->initialized) {
this->initialized = TRUE;
this->unk130 = MMM_func_803871FC;
}
switch(this->state){
case 1:
switch (this->state) {
case FLOWER_POT_STATE_1_IDLE:
animctrl_setPlaybackType(this->animctrl, ANIMCTRL_STOPPED);
break;
case 2:
if(actor_animationIsAt(this, 0.2f)){
FUNC_8030E8B4(SFX_12F_FUUUCK_YOUUU, 1.0f, 30000, this->position, 300, 2000);
case FLOWER_POT_STATE_2_FLOWERED:
if (actor_animationIsAt(this, 0.2f)) {
FUNC_8030E8B4(SFX_12F_THAAANK_YOOOUUU, 1.0f, 30000, this->position, 300, 2000);
}
break;
}
}
bool MMM_func_80387340(ActorMarker *marker){
bool chFlowerpot_eggCollision(ActorMarker *marker) {
Actor *actor = marker_getActor(marker);
f32 sp20[3];
s32 sp1C;
if(actor->state == 2)
return FALSE;
f32 position[3];
s32 remaining;
subaddie_set_state(actor, 2);
if (actor->state == FLOWER_POT_STATE_2_FLOWERED) {
return FALSE;
}
subaddie_set_state(actor, FLOWER_POT_STATE_2_FLOWERED);
animctrl_setPlaybackType(actor->animctrl, ANIMCTRL_ONCE);
sp1C = func_803871B0();
if(sp1C != 0){
sp1C--;
if(sp1C == 0){
ml_vec3f_copy(sp20, actor->position);
sp20[1] += 80.0f;
remaining = chFlowerpot_getRemaining();
if (remaining != 0) {
remaining--;
if (remaining == 0) {
ml_vec3f_copy(position, actor->position);
position[1] += 80.0f;
comusic_playTrack(COMUSIC_2D_PUZZLE_SOLVED_FANFARE);
jiggy_spawn(JIGGY_63_MMM_FLOWER_POTS, sp20);
jiggy_spawn(JIGGY_63_MMM_FLOWER_POTS, position);
}
else{
else {
comusic_playTrack(COMUSIC_2B_DING_B);
}
}
func_803871D4(sp1C);
chFlowerpot_setRemaining(remaining);
return TRUE;
}