Documented ch Flowerpot

This commit is contained in:
Owlenuff
2024-10-01 09:21:23 +02:00
parent da234765d7
commit ecac4dde39
6 changed files with 82 additions and 70 deletions

View File

@@ -1191,7 +1191,7 @@ enum sfx_e
SFX_12C_FF_QUESTION_START, SFX_12C_FF_QUESTION_START,
SFX_12D_CAMERA_ZOOM_CLOSEST, SFX_12D_CAMERA_ZOOM_CLOSEST,
SFX_12E_CAMERA_ZOOM_MEDIUM, SFX_12E_CAMERA_ZOOM_MEDIUM,
SFX_12F_FUUUCK_YOUUU, SFX_12F_THAAANK_YOOOUUU,
// from her final fall // from her final fall
SFX_130_GRUNTY_ECHOING_CRY = 0x0130, SFX_130_GRUNTY_ECHOING_CRY = 0x0130,
SFX_131_GRUNTY_WEEEGH, SFX_131_GRUNTY_WEEEGH,
@@ -4553,8 +4553,8 @@ enum marker_e{
MARKER_AB_RUBEES_EGG_POT, MARKER_AB_RUBEES_EGG_POT,
MARKER_AD_SLAPPA = 0xAD, MARKER_AD_SLAPPA = 0xAD,
MARKER_AE_UNKNOWN,
MARKER_AF_MAGIC_CARPET_SHADOW = 0xAF, MARKER_AF_MAGIC_CARPET_SHADOW,
MARKER_B0_MAGIC_CARPET_2, MARKER_B0_MAGIC_CARPET_2,
MARKER_B1_SIR_SLUSH, MARKER_B1_SIR_SLUSH,
MARKER_B2_SNOWBALL, MARKER_B2_SNOWBALL,
@@ -4566,8 +4566,8 @@ enum marker_e{
MARKER_B9_FP_SNOWMAN_BUTTON = 0xB9, MARKER_B9_FP_SNOWMAN_BUTTON = 0xB9,
MARKER_BA_XMAS_TREE, MARKER_BA_XMAS_TREE,
MARKER_BB_UNKNOWN,
MARKER_BC_GOBI_1 = 0xBC, MARKER_BC_GOBI_1,
MARKER_BD_GOBI_ROPE, MARKER_BD_GOBI_ROPE,
MARKER_BE_GOBI_ROCK, MARKER_BE_GOBI_ROCK,
MARKER_BF_GOBI_2, MARKER_BF_GOBI_2,

View File

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

View File

@@ -2,7 +2,7 @@
#include "functions.h" #include "functions.h"
#include "variables.h" #include "variables.h"
int func_802458E0(f32 arg0[3], Actor *arg1, s32 arg2); int collisionTri_isHitFromAbove_actor(f32 arg0[3], Actor *arg1, s32 arg2);
extern bool func_80320DB0(f32[3], f32, f32[3], u32); extern bool func_80320DB0(f32[3], f32, f32[3], u32);
extern bool func_80323240(struct56s *, f32, f32[3]); extern bool func_80323240(struct56s *, f32, f32[3]);
extern f32 ml_dotProduct_vec3f(f32[3], f32[3]); extern f32 ml_dotProduct_vec3f(f32[3], f32[3]);
@@ -308,31 +308,32 @@ BKCollisionTri *func_802457C4(f32 arg0[3], f32 arg1[3], f32 arg2, f32 arg3, f32
return var_v1; return var_v1;
} }
void collisionTri_copy(BKCollisionTri *dst, BKCollisionTri *src){ void collisionTri_copy(BKCollisionTri *dst, BKCollisionTri *src) {
dst->unk0[0] = src->unk0[0]; TUPLE_COPY(dst->unk0, src->unk0)
dst->unk0[1] = src->unk0[1];
dst->unk0[2] = src->unk0[2];
dst->flags = src->flags; dst->flags = src->flags;
dst->unk6 = src->unk6; dst->unk6 = src->unk6;
} }
int func_802458A8(f32 arg0[3], ActorMarker *arg1, s32 arg2){ int collisionTri_isHitFromAbove_marker(f32 position[3], ActorMarker *marker, s32 verticalOffset) {
return func_802458E0(arg0, marker_getActor(arg1), arg2); return collisionTri_isHitFromAbove_actor(position, marker_getActor(marker), verticalOffset);
} }
int func_802458E0(f32 arg0[3], Actor *arg1, s32 arg2){ int collisionTri_isHitFromAbove_actor(f32 position[3], Actor *actor, s32 verticalOffset) {
f32 sp34[3]; f32 sp34[3];
f32 sp28[3]; f32 tmp_position[3];
f32 sp1C[3]; f32 adjusted_actor_position[3];
ml_vec3f_copy(sp28, arg0); ml_vec3f_copy(tmp_position, position);
ml_vec3f_copy(sp1C, arg1->position); ml_vec3f_copy(adjusted_actor_position, actor->position);
sp1C[1] += (f32)arg2; adjusted_actor_position[1] += (f32) verticalOffset;
if(sp1C[1] < sp28[1])
return FALSE;
if(func_80320B98(sp28, sp1C, sp34, 0x25e0000)){ if (adjusted_actor_position[1] < tmp_position[1]) {
return FALSE; return FALSE;
} }
if (func_80320B98(tmp_position, adjusted_actor_position, sp34, 0x25e0000)) {
return FALSE;
}
return TRUE; return TRUE;
} }

View File

@@ -388,7 +388,7 @@ void __baMarker_resolveCollision(Prop *other_prop){
return; return;
player_getPosition(spAC); player_getPosition(spAC);
spAC[1] += 40.0f; spAC[1] += 40.0f;
if(func_802458E0(spAC, actor, 0x87) == 0) if(collisionTri_isHitFromAbove_actor(spAC, actor, 0x87) == 0)
return; return;
volatileFlag_set(VOLATILE_FLAG_1E, 1); volatileFlag_set(VOLATILE_FLAG_1E, 1);
if(fileProgressFlag_get(((actor->unkF4_8 - 1) ^ 1) + 0x49)){ if(fileProgressFlag_get(((actor->unkF4_8 - 1) ^ 1) + 0x49)){

View File

@@ -57,7 +57,7 @@ void func_803216D0(enum map_e map){
ttc_resetTresureHunt(); ttc_resetTresureHunt();
break; break;
case MAP_1B_MMM_MAD_MONSTER_MANSION: case MAP_1B_MMM_MAD_MONSTER_MANSION:
mmm_resetFlowerPots(); chFlowerpot_reset();
break; break;
} }
} }

View File

@@ -51,7 +51,7 @@ void fxegg_shatter(u8 projectile_indx){
s32 func_803531C8(u8 projectile_indx, s32 arg1){ s32 func_803531C8(u8 projectile_indx, s32 arg1){
ActorProp *prop; ActorProp *prop;
f32 sp40[3]; f32 egg_position[3];
ActorMarker * marker; ActorMarker * marker;
ActorMarker * other_marker; ActorMarker * other_marker;
s32 sp34; s32 sp34;
@@ -63,7 +63,7 @@ s32 func_803531C8(u8 projectile_indx, s32 arg1){
marker = func_8033E840(); marker = func_8033E840();
sp34 = 0; sp34 = 0;
projectile_getPosition(projectile_indx, sp40); projectile_getPosition(projectile_indx, egg_position);
marker->unk38[1] = 0x1E; marker->unk38[1] = 0x1E;
prop = func_80320EB0(marker, 30.0f, 1); prop = func_80320EB0(marker, 30.0f, 1);
if(prop != NULL && prop->unk8_0){ if(prop != NULL && prop->unk8_0){
@@ -84,7 +84,7 @@ s32 func_803531C8(u8 projectile_indx, s32 arg1){
break; break;
case MARKER_33_LEAKY: //L80353350 case MARKER_33_LEAKY: //L80353350
if(func_802458A8(sp40, other_marker, 0x32) && chLeaky_eggCollision(other_marker)){ if (collisionTri_isHitFromAbove_marker(egg_position, other_marker, 0x32) && chLeaky_eggCollision(other_marker)) {
func_8033E984(); func_8033E984();
} }
break; break;
@@ -94,7 +94,7 @@ s32 func_803531C8(u8 projectile_indx, s32 arg1){
func_803870EC(1); func_803870EC(1);
break; break;
case 0x1ae: //L8035339C //zubba? case MARKER_1AE_ZUBBA: //L8035339C //zubba?
func_8033E984(); func_8033E984();
fxegg_shatter(projectile_indx); fxegg_shatter(projectile_indx);
break; break;
@@ -109,26 +109,26 @@ s32 func_803531C8(u8 projectile_indx, s32 arg1){
func_8038685C(other_marker); func_8038685C(other_marker);
break; break;
case 0xbb: //L803533E4 //"BIG_JINXYHEAD" case MARKER_BB_UNKNOWN: //L803533E4 //"BIG_JINXYHEAD"
other_actor = marker_getActor(other_marker); other_actor = marker_getActor(other_marker);
*(s32 *)&other_actor->local = 1; *(s32 *)&other_actor->local = 1;
func_8033E984(); func_8033E984();
break; break;
case MARKER_34_CEMETARY_POT: //L80353400 case MARKER_34_CEMETARY_POT: //L80353400
if(func_802458A8(sp40, other_marker, 0x3C) && MMM_func_80387340(other_marker)){ if (collisionTri_isHitFromAbove_marker(egg_position, other_marker, 0x3C) && chFlowerpot_eggCollision(other_marker)) {
func_8033E984(); func_8033E984();
} }
break; break;
case MARKER_AB_RUBEES_EGG_POT: //L80353434 case MARKER_AB_RUBEES_EGG_POT: //L80353434
if(func_802458A8(sp40, other_marker, 0x1E) && (func_8038E178() < func_8038E184())){ if (collisionTri_isHitFromAbove_marker(egg_position, other_marker, 0x1E) && (func_8038E178() < func_8038E184())) {
func_8033E984(); func_8033E984();
func_8038E140(); func_8038E140();
} }
break; break;
case 0xae: //L80353480 //big_jynxy_head case MARKER_AE_UNKNOWN: //L80353480 //big_jynxy_head
if(func_8038E344(other_marker)){ if(func_8038E344(other_marker)){
func_8033E984(); func_8033E984();
func_8038E2FC(other_marker); func_8038E2FC(other_marker);