Docuement FP/ma/snowbutton.c (based on XBox debug strings).

This commit is contained in:
banjo.decomp
2024-10-20 11:40:42 -05:00
parent 88082f3236
commit 9048ada585
8 changed files with 849 additions and 841 deletions

View File

@@ -54,7 +54,7 @@ void FP_func_80386BEC(Actor *this){
actor_collisionOff(this);
func_8025A6EC(COMUSIC_2B_DING_B, 28000);
FUNC_8030E624(SFX_90_SWITCH_PRESS, 1.0f, 32000);
fp_snowmanButtonGame_decRemaining();
maSnowButton_decRemaining();
particleEmitter_setRGB(pCtrl, D_80391B44);
particleEmitter_setSprite(pCtrl, ASSET_700_SPRITE_DUST);
particleEmitter_setPosition(pCtrl, plyr_pos);
@@ -84,7 +84,7 @@ void FP_func_80386CF8(Actor *this){
if(!this->volatile_initialized){
this->volatile_initialized = TRUE;
if(this->state == 3){
fp_snowmanButtonGame_decRemaining();
maSnowButton_decRemaining();
}
}

View File

@@ -44,10 +44,10 @@ f32 D_80391F2C[3] = {-4454.0f, 1920.0f, -6898.0f};
f32 D_80391F38[3] = {-4451.0f, 1920.0f, -6685.0f};
/* .bss */
MaSlalomGate meActiveFlags[NUM_GATES];
MaSlalomGate meDummyFlags[NUM_GATES];
ActorMarker *meBridgeLinks[NUM_BRIDGES];
struct {
static MaSlalomGate meActiveFlags[NUM_GATES];
static MaSlalomGate meDummyFlags[NUM_GATES];
static ActorMarker *meBridgeLinks[NUM_BRIDGES];
static struct {
u8 state;
s32 flagCount;
s32 playerGate;

83
src/FP/ma/snowbutton.c Normal file
View File

@@ -0,0 +1,83 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
typedef enum {
MA_SNOW_BUTTON_STATE_0_NONE,
MA_SNOW_BUTTON_STATE_1_ACTIVE,
MA_SNOW_BUTTON_STATE_2_WIN,
MA_SNOW_BUTTON_STATE_3_DONE
} MaSnowButtonState;
/* .data */
f32 D_80391EC0[3] ={-625.0f, 466.0f, -111.0f};
/* .bss */
static struct {
u8 state;
// u8 pad1[3];
s32 remainingButtonCount;
s32 delay;
f32 spawn_pos[3];
u8 jiggySpawnerExists;
} Me;
/* .code */
void maSnowButton_init(void){
if( map_get() != MAP_27_FP_FREEZEEZY_PEAK
|| jiggyscore_isCollected(JIGGY_2D_FP_SNOWMAN_BUTTONS)
|| jiggyscore_isSpawned(JIGGY_2D_FP_SNOWMAN_BUTTONS)
){
Me.state = MA_SNOW_BUTTON_STATE_0_NONE;
return;
}
Me.jiggySpawnerExists = 0;
if(nodeProp_findPositionFromActorId(0x15E, Me.spawn_pos)){
Me.jiggySpawnerExists = 1;
}
Me.state = MA_SNOW_BUTTON_STATE_1_ACTIVE;
Me.remainingButtonCount = 3;
}
void maSnowButton_end(void){}
void maSnowButton_update(void){
switch(Me.state){
case MA_SNOW_BUTTON_STATE_1_ACTIVE:
if(Me.remainingButtonCount <= 0){
Me.state = MA_SNOW_BUTTON_STATE_2_WIN;
func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000);
Me.delay = 0;
}
break;
case MA_SNOW_BUTTON_STATE_2_WIN:
if(!(Me.delay < 30)){
if(Me.jiggySpawnerExists){
func_802BAFE4(0x11);
jiggy_spawn(JIGGY_2D_FP_SNOWMAN_BUTTONS, Me.spawn_pos);
__spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, ACTOR_4C_STEAM,
reinterpret_cast(s32, Me.spawn_pos[0]),
reinterpret_cast(s32, Me.spawn_pos[1]),
reinterpret_cast(s32, Me.spawn_pos[2])
);
}
// * WARNING * :maSnowButton.c: Jigsaw 45 CANNOT find it's bootup marker point
Me.state = MA_SNOW_BUTTON_STATE_3_DONE;
}
else{
Me.delay++;
}
break;
case MA_SNOW_BUTTON_STATE_0_NONE:
case MA_SNOW_BUTTON_STATE_3_DONE:
break;
}
}
void maSnowButton_decRemaining(void){
Me.remainingButtonCount--;
}

View File

@@ -1,75 +0,0 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
typedef struct {
u8 unk0;
// u8 pad1[3];
s32 unk4;
s32 unk8;
f32 spawn_pos[3];
u8 unk18;
} Struct_FP_45D0_0;
f32 D_80391EC0[3] ={-625.0f, 466.0f, -111.0f};
/* .bss */
Struct_FP_45D0_0 D_80392F50;
/* .code */
void fp_snowmanButtonGame_init(void){
if( map_get() != MAP_27_FP_FREEZEEZY_PEAK
|| jiggyscore_isCollected(JIGGY_2D_FP_SNOWMAN_BUTTONS)
|| jiggyscore_isSpawned(JIGGY_2D_FP_SNOWMAN_BUTTONS)
){
D_80392F50.unk0 = 0;
return;
}
D_80392F50.unk18 = 0;
if(nodeProp_findPositionFromActorId(0x15E, D_80392F50.spawn_pos)){
D_80392F50.unk18 = 1;
}
D_80392F50.unk0 = 1;
D_80392F50.unk4 = 3;
}
void fp_snowmanButtonGame_end(void){}
void fp_snowmanButtonGame_update(void){
switch(D_80392F50.unk0){
case 1:
if(D_80392F50.unk4 <= 0){
D_80392F50.unk0 = 2;
func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000);
D_80392F50.unk8 = 0;
}
break;
case 2://L8038A8F4
if(D_80392F50.unk8 >= 0x1e){
if(D_80392F50.unk18){
func_802BAFE4(0x11);
jiggy_spawn(JIGGY_2D_FP_SNOWMAN_BUTTONS, D_80392F50.spawn_pos);
__spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, ACTOR_4C_STEAM,
reinterpret_cast(s32, D_80392F50.spawn_pos[0]),
reinterpret_cast(s32, D_80392F50.spawn_pos[1]),
reinterpret_cast(s32, D_80392F50.spawn_pos[2])
);
}
D_80392F50.unk0 = 3;
}
else{
D_80392F50.unk8++;
}
break;
case 0:
case 3://L8038A96C
break;
}
}
void fp_snowmanButtonGame_decRemaining(void){
D_80392F50.unk4--;
}

View File

@@ -18,16 +18,16 @@ s32 D_80367C84[3] = {255, 100, 100};
/* .code */
void func_802D8730(Actor *this) {
f32 sp3C;
f32 dt;
f32 sp38;
ParticleEmitter *pCtrl;
sp3C = time_getDelta();
dt = time_getDelta();
if (!func_8032BBE8(this)) {
this->velocity_y = 0.0f;
this->velocity_x = 1.0f;
} else {
this->velocity_x -= sp3C;
this->velocity_x -= dt;
}
if (this->velocity_x < 0.0f) {
marker_despawn(this->marker);
@@ -41,7 +41,7 @@ void func_802D8730(Actor *this) {
viewport_adjustPointDistance(this->position, 40.0f);
this->position_y = sp38;
this->velocity_y -= sp3C;
this->velocity_y -= dt;
if (this->velocity_y < 0.0f) {
this->velocity_y = 0.07f;
pCtrl = func_802F4094(this->position, 40.0f);

View File

@@ -301,21 +301,21 @@ void __overlay_fp_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){ return; }
void __overlay_fp_release(void){
fp_sirslushgame_end();
fp_snowmanButtonGame_end();
maSnowButton_end();
maSlalom_end();
func_8039195C();
}
void overlay_fp_init(void){
fp_sirslushgame_init();
fp_snowmanButtonGame_init();
maSnowButton_init();
maSlalom_init();
func_803918C0();
}
void __overlay_fp_update(void){
fp_sirslushgame_update();
fp_snowmanButtonGame_update();
maSnowButton_update();
maSlalom_update();
func_80391994();
}