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

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