label FP files

This commit is contained in:
Banjo Kazooie
2023-01-31 17:32:35 -06:00
parent 2f858b790b
commit 96317e7239
29 changed files with 297 additions and 311 deletions

179
src/FP/ch/bearcub.c Normal file
View File

@@ -0,0 +1,179 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern void func_8028E668(f32[3], f32, f32, f32);
extern s32 func_8028F31C(f32[3], f32, s32, Actor **);
typedef struct {
s32 unk0;
s32 unk4;
s32 unk8;
s32 unkC;
} Struct_FP_3E00;
void func_8038A384(Actor *this);
/* .data */
ActorAnimationInfo D_80391DF0[] = {
{0, 0.0f},
{ASSET_17E_ANIM_POLAR_BEAR_CUB_SAD, 5.5f},
{ASSET_17D_ANIM_POLAR_BEAR_CUB_HAPPY, 2.5f}
};
ActorInfo D_80391E08 = { MARKER_1FA_POLAR_BEAR_CUB_BLUE, ACTOR_1EA_POLAR_BEAR_CUB_BLUE, ASSET_44C_MODEL_POLAR_BEAR_CUB_BLUE,
0x1, D_80391DF0,
func_8038A384, func_80326224, func_80325888,
2500, 0, 1.2f, 0
};
ActorInfo FP_D_80391E2C = { MARKER_1FB_POLAR_BEAR_CUB_GREEN, ACTOR_1EB_POLAR_BEAR_CUB_GREEN, ASSET_44D_MODEL_POLAR_BEAR_CUB_GREEN,
0x1, D_80391DF0,
func_8038A384, func_80326224, func_80325888,
2500, 0, 1.2f, 0
};
ActorInfo D_80391E50 = { MARKER_1FC_POLAR_BEAR_CUB_RED, ACTOR_1EC_POLAR_BEAR_CUB_RED, ASSET_44E_MODEL_POLAR_BEAR_CUB_RED,
0x1, D_80391DF0,
func_8038A384, func_80326224, func_80325888,
2500, 0, 1.2f, 0
};
f32 FP_D_80391E74[3] = {-5.0f, 180.0f, 1.0f};
Struct_FP_3E00 D_80391E80[] ={
{0x11, MARKER_1FD_BLUE_PRESENT_COLLECTABLE, ACTOR_1ED_BLUE_PRESENT_COLLECTABLE, 0x1EE},
{0x12, MARKER_1FE_GREEN_PRESENT_COLLECTABLE, ACTOR_1EF_GREEN_PRESENT_COLLECTABLE, 0x1F0},
{0x13, MARKER_1FF_RED_PRESENT_COLLECTABLE, ACTOR_1F1_RED_PRESENT_COLLECTABLE, 0x1F2}
};
/* .code */
void func_8038A1F0(Actor **this_ptr, enum marker_e carried_obj_marker_id, enum actor_e actor_id, enum actor_e arg3){
func_8028F31C((*this_ptr)->position, 600.0f, actor_id, this_ptr);
if(!func_80329530(*this_ptr, 400)) return;
if(carriedObj_getMarkerId() != carried_obj_marker_id) return;
if(!func_8028FC34()) return;
func_8028FA34(arg3, *this_ptr);
}
void func_8038A274(Actor *this){
if(actor_animationIsAt(this, 0.4f)){
func_8030E878(SFX_B2_BOGGY_KID_HAPPY, this->unk1C[0], 32000, this->position, 100.0f, 600.0f);
return;
}
if(actor_animationIsAt(this, 0.75f)){
func_8030E878(SFX_53_BANJO_HUIII, this->unk1C[1], 32000, this->position, 100.0f, 600.0f);
}
}
void func_8038A318(ActorMarker *caller, enum asset_e text_id, s32 arg1){
if(text_id == 0xc19){
func_802BAFE4(0x25);
jiggySpawn(JIGGY_2E_FP_PRESENTS, FP_D_80391E74);
func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 32000);
func_8025A6EC(COMUSIC_5B_FP_IGLOO_HAPPY, 25000);
func_8025A58C(0, 4000);
func_8024BD08(0);
}
}
void func_8038A384(Actor *this){
s32 sp3C;
enum asset_e sp38;
s32 sp34;
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
this->marker->propPtr->unk8_3 = FALSE;
switch(this->marker->unk14_20){
case MARKER_1FA_POLAR_BEAR_CUB_BLUE://L8038A404
this->unk1C[0] = 1.0f;
this->unk1C[1] = 1.2f;
animctrl_setAnimTimer(this->animctrl, 0.0f);
break;
case MARKER_1FB_POLAR_BEAR_CUB_GREEN://L8038A438
this->unk1C[0] = 1.1f;
this->unk1C[1] = 1.3f;
animctrl_setAnimTimer(this->animctrl, 0.4f);
break;
case MARKER_1FC_POLAR_BEAR_CUB_RED://L8038A470
this->unk1C[0] = 1.2f;
this->unk1C[1] = 1.4f;
animctrl_setAnimTimer(this->animctrl, 0.7f);
break;
}//L8038A4A0
if( jiggyscore_isCollected(JIGGY_2E_FP_PRESENTS)
|| func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE)
){
func_80328B8C(this, 2, randf2(0.0f, 0.9f), 1);
}
}//L8038A4E4
sp34 = levelSpecificFlags_get(0x11) + levelSpecificFlags_get(0x12) + levelSpecificFlags_get(0x13);
sp38 = (sp34 == 1) ? 0xC17
: (sp34 == 2) ? 0xC18
: 0xC19;
this->yaw_ideal = (f32)func_80329784(this);
func_80328FB0(this, 2.0f);
func_8028E668(this->position, 100.0f, -10.0f, 100.0f);
switch(this->state){
case 1://L8038A5B0
if(!levelSpecificFlags_get(0x19) && func_80329530(this, 0xfa)){
if(func_8028ECAC() == 0 || func_8028ECAC() == BSGROUP_8_TROT){
if(sp34 == 0
&& !jiggyscore_isCollected(JIGGY_2C_FP_BOGGY_3)
&& !jiggyscore_isSpawned(JIGGY_2C_FP_BOGGY_3)
){
if(func_80311480(0xc1a, 0x2a, NULL, NULL, NULL, NULL))
levelSpecificFlags_set(0x19, TRUE);
}
}
}//L8038A648
switch(this->marker->unk14_20){
case MARKER_1FA_POLAR_BEAR_CUB_BLUE:
sp3C = 0;
break;
case MARKER_1FB_POLAR_BEAR_CUB_GREEN:
sp3C = 1;
break;
case MARKER_1FC_POLAR_BEAR_CUB_RED:
sp3C = 2;
break;
}
if(levelSpecificFlags_get(D_80391E80[sp3C].unk0)){
func_80328B8C(this, 2, 0.001f, 1);
if(sp38 == 0xc19){
func_80311480(sp38, 0x2f, this->position, this->marker, func_8038A318, NULL);
}
else{
func_80311480(sp38, 0x3, this->position, this->marker, func_8038A318, NULL);
}
}
else{//L8038A73C
func_8038A1F0(&this, D_80391E80[sp3C].unk4, D_80391E80[sp3C].unk8, D_80391E80[sp3C].unkC);
if( actor_animationIsAt(this, 0.45f)
&& !func_803114B0()
){
func_8030E878(SFX_B1_BOGGY_KID_CRYING, randf2(0.9f, 1.1f), 32000, this->position, 150.0f, 700.0f);
}
}//L8038A7DC
break;
case 2://L8038A7C0
if(!func_803114B0()){
func_8038A274(this);
}
break;
}//L8038A7DC
}

202
src/FP/ch/boggy1.c Normal file
View File

@@ -0,0 +1,202 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern void func_80324CD8(f32);
Actor *func_803875E0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
void func_8038774C(Actor *this);
void func_8038794C(Actor *this);
Actor *func_80328230(enum actor_e id, f32 pos[3], f32 rot[3]);
/* .data */
ActorAnimationInfo D_80391B80[] = {
{0x000, 0.0f},
{0x14E, 2.0f},
{0x14D, 7.0f},
{0x14C, 2.0f},
{0x14F, 0.5f},
{0x14F, 1.0f}
};
ActorInfo D_80391BB0 = {
MARKER_124_BOGGY_1, ACTOR_160_BOGGY_1, ASSET_38A_MODEL_BOGGY_1,
0x1, D_80391B80,
func_8038774C, func_8038794C, func_803875E0,
2500, 0, 1.4f, 0
};
f32 D_80391BD4[3] = {1592.0f, 673.0f, 5895.0f};
f32 D_80391BE0[3] = { 0.0f, 0.0f, 0.0f};
f32 D_80391BEC[5] = {2.0f, 2.8f, 4.3f, 5.1f, 5.7f};
/* .code */
Actor *func_803875E0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
Actor *this = marker_getActor(marker);
if(!this->unk38_31 || this->state == 5)
return this;
func_8033A45C(1, 0);
func_8033A45C(3, 1);
this = func_80325888(marker, gfx, mtx, vtx);
if(marker->unk14_21){
func_8034A174(func_80329934(), 5, this->velocity);
}
return this;
}
void func_803876A4(Actor *this){
func_80328B8C(this, 2, 0.0001f, 1);
actor_playAnimationOnce(this);
FUNC_8030E8B4(SFX_8E_GRUNTLING_DAMAGE, 1.0f, 32000, this->position, 1250, 2500);
}
void func_803876F8(Actor *this){
this->marker->propPtr->unk8_3 = FALSE;
func_80328B8C(this, 5, 0.0001f, 1);
this->unk48 = 0.0f;
func_80343DEC(this);
}
void func_8038774C(Actor *this){}
void func_80387754(ActorMarker *this_marker, ActorMarker *other_marker){}
void func_80387760(ActorMarker *marker){
Actor *other = func_80328230(ACTOR_C8_BOGGY_2, D_80391BD4, D_80391BE0);
other->unk4C = 1.0f;
func_80343DEC(other);
}
void func_803877A8(ActorMarker *caller, enum asset_e text_id, s32 arg2){
Actor *this = marker_getActor(caller);
if(arg2 == 1){
jiggySpawn(JIGGY_2A_FP_BOGGY_1, this->velocity);
}
else if(arg2 == 2){
func_80328B8C(this, 4, 0.0001f, 1);
actor_loopAnimation(this);
actor_collisionOff(this);
}
}
void func_80387828(ActorMarker *caller, enum asset_e text_id, s32 arg2){
Actor *this = marker_getActor(caller);
if(text_id == 0xc00){
func_80311480(0xc2b, 0xf, NULL, this->marker, NULL, func_803877A8);
}
}
void func_8038787C(ActorMarker *marker){
Actor *this = marker_getActor(marker);
s32 s0;
f32 sp24;
s32 sp20;
s0 = func_802F9AA8(SFX_12B_BOILING_AND_BUBBLING);
sp24 = randf2(0.9f, 1.1f);
sp20 = (s32)randf2(16000.0f, 23000.0f);
func_802F9DB8(s0, sp24, sp24, 0.0f);
func_802F9EC4(s0, this->position, 500, 1200);
func_802F9F80(s0, 0.05f, 0.2f, 0.3f);
func_802FA060(s0, sp20, sp20, 0.0f);
}
void func_8038794C(Actor *this){
int i;
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
this->marker->propPtr->unk8_3 = TRUE;
marker_setCollisionScripts(this->marker, NULL, func_80387754, NULL);
this->unk38_31 = 1;
ml_vec3f_copy(this->velocity, this->position);
if(func_803203FC(1))
return;
if(!jiggyscore_isCollected(JIGGY_2A_FP_BOGGY_1) && jiggyscore_isSpawned(JIGGY_2A_FP_BOGGY_1)){
func_803876F8(this);
actor_collisionOff(this);
}
if(jiggyscore_isCollected(JIGGY_2A_FP_BOGGY_1)){
if(!jiggyscore_isCollected(JIGGY_2C_FP_BOGGY_3) && !jiggyscore_isSpawned(JIGGY_2C_FP_BOGGY_3)){
__spawnQueue_add_1((GenMethod_1)func_80387760, reinterpret_cast(s32, this->marker));
}
this->unk38_31 = 0;
actor_collisionOff(this);
this->marker->propPtr->unk8_3 = FALSE;
}
}//L80387A68
if( !this->unk38_31 ) return;
switch(this->state){
case 1://L80387AB0
if(mapSpecificFlags_get(0xb))
this->unk138_24 = TRUE;
if(mapSpecificFlags_get(0x1)){
func_8028F94C(1, this->position);
timed_setCameraToNode(0.0f, 0x12);
func_80324DBC(1.0f, 0xc00, 0xe, NULL, this->marker, func_80387828, func_803877A8);
func_803876A4(this);
break;
}//L80387B38
if(!this->unk138_24 && func_80329530(this, 0x1f4)){
if(!func_8028ECAC() || func_8028ECAC() == BSGROUP_8_TROT){
if(func_80311480(0xbff, 0x2a, this->position, NULL, NULL, NULL)){
for(i = 0; i <5; i++ ){
timedFunc_set_1(D_80391BEC[i], (GenMethod_1)func_8038787C, (s32)this->marker);
}
this->unk138_24 = TRUE;
}
}
}
break;
case 2://L80387BEC
func_8028FC8C(this->position);
if(actor_animationIsAt(this, 0.1f)){
FUNC_8030E8B4(SFX_F6_BLUBBER_TALKING_2, 1.0f, 32000, this->position, 1250, 2500);
}
else if(actor_animationIsAt(this, 0.24f)){//L80387C2C
FUNC_8030E8B4(SFX_A0_COUGHING, 0.7f, 32000, this->position, 1250, 2500);
}
else if(actor_animationIsAt(this, 0.52f)){//L80387C60
FUNC_8030E8B4(SFX_A0_COUGHING, 0.67f, 32000, this->position, 1250, 2500);
}
else if(actor_animationIsAt(this, 0.61f)){//L80387C94
FUNC_8030E8B4(SFX_A0_COUGHING, 0.64f, 32000, this->position, 1250, 2500);
}
else if(actor_animationIsAt(this, 0.69f)){//L80387CC8
FUNC_8030E8B4(SFX_A0_COUGHING, 0.61f, 32000, this->position, 1250, 2500);
}//L80387CF4
if(actor_animationIsAt(this, 0.9999f)){
func_80328B8C(this, 3, 0.0001f, 1);
actor_loopAnimation(this);
}
break;
case 4://L80387D2C
func_80343DEC(this);
func_8028FC8C(this->position);
if(0.99 <= this->unk48){
func_8028F918(0);
func_80324CD8(0.0f);
func_80324E88(0.0f);
func_803876F8(this);
}
break;
case 5://L80387D90
if(jiggyscore_isCollected(JIGGY_2A_FP_BOGGY_1)){
this->unk38_31 = 0;
__spawnQueue_add_1((GenMethod_1)func_80387760, reinterpret_cast(s32, this->marker));
}
break;
}
}

658
src/FP/ch/boggy2.c Normal file
View File

@@ -0,0 +1,658 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern void func_8028E668(f32[3], f32, f32, f32);
extern f32 func_8038BE20(f32 arg0[3]);
typedef struct {
ParticleEmitter *unk0;
ParticleEmitter *unk4;
f32 unk8;
f32 unkC;
f32 unk10;
f32 unk14;
u8 unk18;
u8 unk19;
}ActorLocal_FP_2350;
typedef struct {
s32 unk0;
s32 actor_id;
}Struct_FP_2350;
Actor *func_80388740(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
void func_80388D70(ActorMarker *caller, enum asset_e text_id, s32 arg2);
void func_80388EE8(ParticleEmitter *pCtrl);
void FP_func_80388F4C(Actor *this);
void func_803896FC(Actor *this);
/* .data */
ActorAnimationInfo D_80391C80[] = {
{0x000, 0.0f},
{0x150, 0.6f},
{0x150, 0.6f},
{0x150, 0.6f},
{0x150, 0.6f},
{0x179, 2.3f},
{0x17A, 1.3f},
{0x17B, 2.0f},
{0x150, 1.0f},
{0x1AA, 4.3f},
{0x1AB, 4.3f},
{0x150, 1.0f},
{0x150, 0.6f}
};
ActorInfo D_80391CE8 = { MARKER_97_BOGGY_2, ACTOR_C8_BOGGY_2, ASSET_38A_MODEL_BOGGY_1,
0x1, D_80391C80,
FP_func_80388F4C, func_803896FC, func_80388740,
0, 0, 1.4f, 0
};
/* .bss */
s32 D_80392F20[3];
/* .code */
Actor *func_80388740(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
Actor *this = marker_getActor(marker);
ActorLocal_FP_2350 * local = (ActorLocal_FP_2350 *) &this->local;
f32 sp2C[3];
func_8033A45C(1, 1);
func_8033A45C(3, 1);
this = func_80325888(marker, gfx, mtx, vtx);
if(this->unk16C_4 && marker->unk14_21){
if( this->state == 4
|| this->state == 5
|| this->state == 6
|| this->state == 8
){
if(this->unk4C != 0.0f && (func_8023DB5C() & 1)){
if(-2.0 < this->roll){
func_8034A174(func_80329934(), 6, sp2C);
particleEmitter_setPosition(local->unk0, sp2C);
particleEmitter_emitN(local->unk0, 1);
}
if(this->roll < 2.0){
func_8034A174(func_80329934(), 7, sp2C);
particleEmitter_setPosition(local->unk4, sp2C);
particleEmitter_emitN(local->unk4, 1);
}
}
}//L803888D4
}
return this;
}
void FP_func_803888E4(Actor *this){
static f32 D_80391D0C[3] = {1842.0f, 658.0f, 5758.0f};
static f32 D_80391D18[3] = {1463.0f, 635.0f, 5193.0f};
func_80328B8C(this, 0xC, 0.0001f, 1);
if(!jiggyscore_isSpawned(JIGGY_30_FP_BOGGY_2)){
if(mapSpecificFlags_get(5)){
func_80324DBC(0.1f, 0xc06, 0x2a, D_80391D18, this->marker, func_80388D70, NULL);
}
else{//L80388964
func_80324DBC(0.1f, 0xc03, 0x2a, D_80391D18, this->marker, func_80388D70, NULL);
}
}
else{//L803889A0
func_8028F490(D_80391D0C);
if(mapSpecificFlags_get(6)){
func_80324DBC(0.1f, 0xc29, 0x2a, D_80391D18, this->marker, func_80388D70, NULL);
}
else{
func_80324DBC(0.1f, 0xc28, 0x2a, D_80391D18, this->marker, func_80388D70, NULL);
}
}//L80388A30
mapSpecificFlags_set(5, TRUE);
func_8038B9C8();
}
void func_80388A50(Actor *this){
ActorLocal_FP_2350 *local = (ActorLocal_FP_2350 *)&this->local;
func_80328B8C(this, 2, 0.0001f, 1);
timed_setCameraToNode(0.0f, 4);
local->unk18 = 0;
}
void func_80388A94(Actor *this){
func_80388A50(this);
if(mapSpecificFlags_get(6)){
func_80311480(0xc0a, 0xe, this->position, this->marker, func_80388D70, NULL);
}
else{
func_80311480(0xc09, 0xe, this->position, this->marker, func_80388D70, NULL);
}
}
void func_80388B18(Actor *this, u8 arg1){
if(arg1 == TRUE){
if(player_getTransformation() == TRANSFORM_4_WALRUS){
func_80388A50(this);
if(mapSpecificFlags_get(5)){
func_80311480(0xc05, 0xf, this->position, this->marker, func_80388D70, NULL);
}
else{
func_80311480(0xc02, 0xf, this->position, this->marker, func_80388D70, NULL);
}
}
else{//L80388BB8
if(!func_803203FC(0xb3)){
if(func_80311480(0xc01, 0xe, this->position, this->marker, func_80388D70, NULL)){
func_803204E4(0xb3, TRUE);
func_80388A50(this);
}
}
}
}
else{//L80388C08
if(player_getTransformation() == TRANSFORM_4_WALRUS){
if(!func_803203FC(0xb4)){
if(func_80311480(0xc08, 0xe, this->position, this->marker, func_80388D70, NULL)){
func_803204E4(0xb4, TRUE);
func_80388A50(this);
}
}
}
else{
func_80388A94(this);
}
}
}
void func_80388C88(Actor *this){
ActorLocal_FP_2350 *local = (ActorLocal_FP_2350 *)&this->local;
this->unk10_12 = 0;
local->unk18 = 1;
}
bool FP_func_80388CA0(Actor *this){
ActorLocal_FP_2350 *local = (ActorLocal_FP_2350 *)&this->local;
u32 sp20;
if(func_8028ECAC() != 0 && func_8028ECAC() != BSGROUP_8_TROT)
return FALSE;
if( !func_80329530(this, 1100) ){
local->unk18 = TRUE;
}
sp20 = this->unk10_12;
this->unk10_12 = func_80329530(this, 0x1C2);
return (sp20 == 0 && this->unk10_12 && local->unk18);
}
void func_80388D70(ActorMarker *caller, enum asset_e text_id, s32 arg2){
Actor *this = marker_getActor(caller);
ActorLocal_FP_2350 *local = (ActorLocal_FP_2350 *)&this->local;
func_80324E88(0.0f);
switch(text_id){
case 0xc03:
case 0xc06:
case 0xc28:
case 0xc29://L80388DC4
func_8025A6EC(COMUSIC_3A_FP_BOGGY_RACE, 25000);
func_8025A58C(0, 4000);
func_8024BD08(0);
func_802BE720();
local->unk0 = partEmitMgr_newEmitter(16);
local->unk4 = partEmitMgr_newEmitter(16);
func_80388EE8(local->unk0);
func_80388EE8(local->unk4);
func_80328B8C(this, 4, 0.0001f, 1);
local->unk14 = (local->unk19 == 2) ? 1.0f : 0.0f;
this->marker->unk40_23 = TRUE;
break;
default://L80388E78
switch(arg2){
case 1:
FP_func_803888E4(this);
mapSpecificFlags_set(6, TRUE);
break;
case 0:
func_80328B8C(this, 1, 0.0001f, 1);
break;
default:
func_80328B8C(this, 1, 0.0001f, 1);
break;
}
break;
}
}
void func_80388EE8(ParticleEmitter *pCtrl){
static s32 D_80391D24[3] = {0xc8, 0xc8, 0xe6};
static struct31s D_80391D30 = {
{0.2f, 0.4f},
{1.2f, 1.6f},
{0.0f, 0.001f},
{0.3f, 0.45f},
0.0f, 0.01f
};
static struct42s D_80391D58 = {
{{-10.0f, 10.0f, -10.0f}, {10.0f, 240.0f, 10.0f}}, /*position*/
{{0.0f, 0.0f, 0.0f}, {0.0f, 20.0f, 0.0f}} /*velocity*/
};
particleEmitter_setSprite(pCtrl, ASSET_700_SPRITE_DUST);
particleEmitter_setRGB(pCtrl, D_80391D24);
particleEmitter_setPositionAndVelocityRanges(pCtrl, &D_80391D58);
func_802EFB98(pCtrl, &D_80391D30);
particleEmitter_manualFree(pCtrl);
}
void FP_func_80388F4C(Actor *this){}
void func_80388F54(ActorMarker *marker){
static f32 D_80391D88[3] = { 1592.0f, 673.0f, 5895.0f};
static f32 FP_D_80391D94[3] = {0.0f, 0.0f, 0.0f};
Actor *other = func_80328230(ACTOR_C8_BOGGY_2, D_80391D88, FP_D_80391D94);
func_80343DEC(other);
}
void func_80388F90(Actor *this){
ActorLocal_FP_2350 *local = (ActorLocal_FP_2350 *)&this->local;
func_8030DB04(this->unk44_31, 32000, this->position, 1000.0f, 4000.0f);
func_8030DBB4(this->unk44_31, local->unk8);
func_8030E2C4(this->unk44_31);
}
bool func_80388FE8(Actor *this, f32 arg1, f32 arg2){
if(arg2 < 0.0f && 0.0f < arg1){
func_8030E878(SFX_8D_BOGGY_OHWW, randf2(1.04f, 1.12f), 32000, this->position, 600.0f, 1200.0f);
return TRUE;
}
else if( 0.0f < arg2 && arg1 < 0.0f){
func_8030E878(SFX_F9_GRUNTLING_NOISE_1, randf2(1.04f, 1.12f), 32000, this->position, 600.0f, 1200.0f);
return TRUE;
}
return FALSE;
}
void func_803890DC(Actor *this, u8 arg1){
ActorLocal_FP_2350 *local = (ActorLocal_FP_2350 *)&this->local;
f32 yaw_to_target;
f32 yaw;
f32 f16;
f32 prev_roll;
f32 dyaw;
yaw_to_target = (this->unk1C[0] < 180.0f) ? this->unk1C[0] : this->unk1C[0] - 360.0f;
yaw = (this->yaw < 180.0f) ? this->yaw : this->yaw - 360.0f;
prev_roll = this->roll;
f16 = (arg1 == 2) ? 1100.0f : 780.0f;
dyaw = yaw - yaw_to_target;
dyaw = (180.0f < dyaw) ? 360.0f - dyaw
: (dyaw < -180.0f) ? 360.0f + dyaw
: dyaw;
this->roll += (2.0*dyaw)*(this->unk4C / f16);
this->roll = (26.0f < this->roll) ? 26.0f
: (this->roll < -26.0f) ? -26.0f
: this->roll;
this->roll += (this->roll < 0.0f) ? 1.8
: (0.0f < this->roll) ? -1.8
: 0.0;
if(local->unk10 == 0.0){
if(this->state != 9 && this->state != 10 && this->state != 11){
if( (23.0f < this->roll && prev_roll < 23.0f)
|| (this->roll < -23.0f && -23.0f < prev_roll)
){//L8038933C
func_8030E878(SFX_8C_BOGGY_WAHEY, randf2(1.04f, 1.12f), 32000, this->position, 600.0f, 1500.0f);
local->unk10 = 1.5f;
}//L80389394
}
}//L80389398
if(this->roll <= 1.8 && -1.8 <= this->roll){
this->roll = 0.0f;
}
}
void func_803893E4(Actor *this, f32 arg1, u8 arg2){
ActorLocal_FP_2350 *local = (ActorLocal_FP_2350 *)&this->local;
f32 sp30;
f32 sp2C;
f32 sp28;
if((u8)arg2 != 2){
sp30 = 575.0f;
sp2C = 780.0f;
sp28 = 1.7f;
}
else{
sp30 = 700.0f;
sp2C = 1100.0f;
sp28 = 2.3f;
}
func_80343DEC(this);
if(this->state == 7){
this->unk4C += ((f32)D_80392F20[1] - this->position_y)*0.02;
}
else{
this->unk4C += ((f32)D_80392F20[1] - this->position_y)*0.03 + sp28*func_8038BE20(this->position);
}
if(this->unk4C < sp30){
this->unk4C = sp30;
}
if(sp2C < this->unk4C){
this->unk4C = sp2C;
}
if((u8)arg2 == 2 && func_8028ECAC() != 6){
this->unk4C = 1200.0f;
}
local->unk8 = ((this->unk4C - sp30)/(sp2C - sp30))*(0.6000000000000001) + 0.7;
func_803890DC(this, (u8)(arg2));
}
void func_803895E0(void){
static s32 D_80391DA0[3] = {0x5F5, 0x292, 0x1539};
static s32 D_80391DAC[3] = {-0x11F8, 0x637, -0x1816};
static Struct_FP_2350 D_80391DB8[7]={
{0x361, 0x35D},
{0x365, 0x35D},
{0x362, 0x360},
{0x366, 0x35D},
{0x37B, 0x35D},
{0x363, 0x35F},
{0x364, 0x35E}
};
int i;
NodeProp *s0;
f32 sp64[3];
Actor *actor;
f32 f20;
f32 f22;
f32 f8;
for (i = 0; i< 7; i++){
s0 = (i < 3)
? cubeList_findNodePropByActorId(D_80391DB8[i].unk0, D_80391DA0)
: cubeList_findNodePropByActorId(D_80391DB8[i].unk0, D_80391DAC);
nodeprop_getPosition(s0, sp64);
f20 = (f32)func_80304DA8(s0);
f8 = (f32)func_80304DB8(s0);
f22 = f8*0.01;
actor = func_8032813C(D_80391DB8[i].actor_id, sp64, (s32)f20);
actor->scale = f22;
}
}
void func_803896FC(Actor *this){
ActorLocal_FP_2350 *local = (ActorLocal_FP_2350 *)&this->local;
f32 sp58;
f32 sp54;
s32 sp3C[6];
sp58 = func_8038BE20(this->position);
sp54 = time_getDelta();
func_8024E55C(0, sp3C);
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
this->marker->unk40_23 = FALSE;
this->marker->propPtr->unk8_3 = FALSE;
this->marker->unk2C_1 = TRUE;
this->unk44_31 = func_8030ED2C(SFX_18_BIGBUTT_SLIDE, 2);
D_80392F20[0] = this->position_x;
D_80392F20[1] = this->position_y;
D_80392F20[2] = this->position_z;
this->unk1C[0] = this->yaw;
local->unk0 = NULL;
local->unk4 = NULL;
local->unk8 = 0.0f;
local->unkC = 0.0f;
local->unk10 = 0.0f;
local->unk8 = 1.0f;
func_8038B9B0(this->marker);
this->unk38_31 = 0;
func_80388C88(this);
__spawnQueue_add_0(func_803895E0);
if(jiggyscore_isCollected(JIGGY_30_FP_BOGGY_2)){
local->unk19 = 2;
this->unk4C = 900.0f;
}
else if(jiggyscore_isSpawned(JIGGY_30_FP_BOGGY_2)){
local->unk19 = 1;
this->unk38_31 = 2;
this->unk4C = 600.0f;
func_80328B8C(this, 11, 0.0001f, 1);
}
else{
local->unk19 = 1;
this->unk4C = 600.0f;
mapSpecificFlags_set(4, TRUE);
}
}//L803898CC
func_8028E668(this->position, 200.0f, -200.0f, 140.0f);
if(!func_8038A1A0(this->marker)){
switch(this->unk38_31){
case 1://L80389920
func_80328B8C(this, 9, 0.0001f, 1);
break;
case 2://L80389938
func_80328B8C(this, 10, 0.0001f, 1);
break;
}
}//L80389950
if(0.0 <local->unk10 - sp54)
local->unk10 =local->unk10 - sp54;
else
local->unk10 = 0.0f;
switch(this->state){
case 1:// L803899B8
if(FP_func_80388CA0(this)){
func_80388B18(this, local->unk19);
}//L803899DC
else if(!jiggyscore_isCollected(JIGGY_30_FP_BOGGY_2) && func_8028ECAC() == BSGROUP_C_WALRUS_SLED){
FP_func_803888E4(this);
}
else if( func_80329530(this, 0x1C2)
&& func_8028ECAC() == 0
&& func_8028F20C()
&& func_8028EFC8()
&& sp3C[FACE_BUTTON(BUTTON_B)] == 1
&& !func_803114B0()
){
if( local->unk19 == 1
&& player_getTransformation() != TRANSFORM_4_WALRUS
&& func_803203FC(0xb3)
){
func_80311480(0xC01, 0xf, this->position, this->marker, func_80388D70, NULL);
}
else if( local->unk19 == 2){
if( player_getTransformation() == TRANSFORM_4_WALRUS
&& func_803203FC(0xb4)
){
func_80311480(0xC08, 0xf, this->position, this->marker, func_80388D70, NULL);
}
else if( player_getTransformation() != TRANSFORM_4_WALRUS){
func_80388A94(this);
}
}
}
break;
case 4:// L80389B50
if(0.0 < local->unk14){
local->unk14 -= sp54;
}
else{
local->unk14 = 0.0f;
if( randf() < 0.02 && sp58 < 0.0){
if(randf() < 0.5)
func_80328B8C(this, 5, 0.0001f, 1);
else
func_80328B8C(this, 6, 0.0001f, 1);
}//L80389C18
func_803893E4(this, sp58, local->unk19);
func_80388F90(this);
if(0.0 ==local->unk10 && func_80388FE8(this, sp58,local->unkC)){
local->unk10 = 1.5f;
}
}//L80389C78
break;
case 5:// L80389C80
case 6:// L80389C80
if(actor_animationIsAt(this, 0.9999f) || sp58 >= 0.0){
func_80328B8C(this, 4, 0.0001f, 1);
}//L80389CC8
func_803893E4(this, sp58, local->unk19);
func_80388F90(this);
if(0.0 == local->unk10 && func_80388FE8(this, sp58, local->unkC)){
local->unk10 = 1.5f;
}
break;
case 7:// L80389D34
if(actor_animationIsAt(this, 0.9999f)){
func_80328B8C(this, 4, 0.0001f, 1);
}//L80389D60
func_803893E4(this, sp58, local->unk19);
func_80388F90(this);
break;
case 8:// L80389D84
func_80343DEC(this);
if(this->unk4C < 740.0f){
this->unk4C += 10.0f;
}
else if(740.0f < this->unk4C) {
this->unk4C -= 10.0f;
}
func_803890DC(this, local->unk19);
func_80388F90(this);
if(0.0 == local->unk10 && func_80388FE8(this, sp58, local->unkC)){
local->unk10 = 1.5f;
}
break;
case 9:// L80389E48
func_803893E4(this, sp58, local->unk19);
if(this->unk48 < 0.99999999999){
func_80388F90(this);
}
if(actor_animationIsAt(this, 0.9999f)){
func_80328B8C(this, 11, 0.0001f, 1);
}
break;
case 10:// L80389EB4
func_803893E4(this, sp58, local->unk19);
if(this->unk48 < 0.99999999999){
func_80388F90(this);
}
if(actor_animationIsAt(this, 0.9999f)){
func_80328B8C(this, 11, 0.0001f, 1);
}
break;
case 11:// L80389F20
func_803890DC(this, local->unk19);
if(!subaddie_playerIsWithinSphere(this, 2000)
&& !this->marker->unk14_21
){
switch(local->unk19){
case 1: //L80389F78
if(this->unk38_31 == 2){
if(jiggyscore_isCollected(JIGGY_30_FP_BOGGY_2)){
__spawnQueue_add_1((GenMethod_1)func_80388F54, reinterpret_cast(s32, this->marker));
func_8038B9BC();
marker_despawn(this->marker);
}
}
else{
func_8038B9BC();
marker_despawn(this->marker);
}
break;
case 2: //L80389FDC
if(this->unk38_31 == 2){
if(jiggyscore_isCollected(JIGGY_2C_FP_BOGGY_3)){
func_8038B9BC();
marker_despawn(this->marker);
mapSpecificFlags_set(0xC, TRUE);
}
}
else{
func_8038B9BC();
marker_despawn(this->marker);
}
break;
}
}
break;
}//L8038A034
D_80392F20[0] = (s32)this->position[0];
D_80392F20[1] = (s32)this->position[1];
D_80392F20[2] = (s32)this->position[2];
this->unk1C[0] = this->yaw;
local->unkC = sp58;
}
void func_8038A09C(f32 arg0[3]){
arg0[0] = (f32)D_80392F20[0];
arg0[1] = (f32)D_80392F20[1];
arg0[2] = (f32)D_80392F20[2];
}
void func_8038A0E4(UNK_TYPE(s32) arg0, ActorMarker *marker){
Actor *actor = marker_getActor(marker);
if(actor){
if(actor->state != 7){
func_80328B8C(actor, 7, 0.0001f, 1);
}
else{
func_80328B8C(actor, 4, 0.0001f, 1);
}
};
}
void func_8038A150(UNK_TYPE(s32) arg0, ActorMarker *marker){
Actor *actor = marker_getActor(marker);
if(actor && actor->state != 8){
func_80328B8C(actor, 8, 0.0001f, 1);
};
}
bool func_8038A1A0(ActorMarker *marker){
Actor *actor = marker_getActor(marker);
switch (actor->state){
case 9:
case 10:
case 11:
return TRUE;
default:
return FALSE;
}
}

92
src/FP/ch/boggy3.c Normal file
View File

@@ -0,0 +1,92 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
Actor *func_80390290(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
void func_80390388(Actor *this);
/* .data */
ActorAnimationInfo D_80392680[] = {
{0, 0.0f},
{0x222, 2.0f}
};
ActorInfo D_80392690 = { 0x20D, 0x33D, 0x38A,
0x1, D_80392680,
func_80390388, func_80326224, func_80390290,
2500, 0, 1.0f, 0
};
/* .code */
Actor *func_80390290(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
Actor *this = marker_getActor(marker);
s32 sp18;
sp18 = 2;
if(this->unk38_31) return this;
if(func_803114C4() == 0xC1F || func_803114C4() == 0xC1E){
sp18 = 1;
}
func_8033A45C(1, 0);
func_8033A45C(3, sp18);
func_80325888(marker, gfx, mtx, vtx);
}
int func_80390334(void){
if( levelSpecificFlags_get(0x11) && levelSpecificFlags_get(0x12) && levelSpecificFlags_get(0x13)){
return TRUE;
}
return FALSE;
}
void func_80390388(Actor *this){
actor_collisionOff(this);
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
if(jiggyscore_isSpawned(JIGGY_2E_FP_PRESENTS) || jiggyscore_isCollected(JIGGY_2E_FP_PRESENTS)){
levelSpecificFlags_set(0x11, TRUE);
levelSpecificFlags_set(0x12, TRUE);
levelSpecificFlags_set(0x13, TRUE);
}
if(jiggyscore_isCollected(JIGGY_2C_FP_BOGGY_3) || jiggyscore_isSpawned(JIGGY_2C_FP_BOGGY_3)){
this->unk38_31 = FALSE;
this->marker->propPtr->unk8_3 = TRUE;
}
else{
this->unk38_31 = TRUE;
this->marker->propPtr->unk8_3 = FALSE;
return;
}
}//L80390468
if( this->unk38_31 ) return;
if( this->state != 1 ) return;
if( jiggyscore_isSpawned(JIGGY_2E_FP_PRESENTS)
|| jiggyscore_isCollected(JIGGY_2E_FP_PRESENTS)
|| func_80390334()
){
this->unk138_24 = TRUE;
}
if( func_80329530(this, 0xFA)
&& (func_8028ECAC() == 0 || func_8028ECAC() == BSGROUP_8_TROT)
){
if(0.0f == this->unk1C[0] && func_80390334()){
if(func_80311480(0xc1f, 0xb, this->position, NULL, NULL, NULL)){
this->unk138_24 = TRUE;
this->unk1C[0] = 1.0f;
}
}
else{
if( !this->unk138_24 ){
if(func_80311480(0xc1e, 0x2b, this->position, NULL, NULL, NULL)){
this->unk138_24 = TRUE;
}
}
}
}
}

86
src/FP/ch/cavewozza.c Normal file
View File

@@ -0,0 +1,86 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern void func_8028E668(f32[3], f32, f32, f32);
void func_80390630(Actor *this);
/* .data */
extern ActorAnimationInfo D_803926F0[]= {
{0, 0.0f},
{ASSET_221_ANIM_WOZZA_IN_CAVE, 5.0f}
};
extern ActorInfo D_80392700 = { MARKER_20F_WOZZA_IN_CAVE, ACTOR_33F_WOZZA_IN_CAVE, ASSET_494_MODEL_WOZZA,
0x1, D_803926F0,
func_80390630, func_80326224, func_80325888,
2500, 0, 1.6f, 0
};
/* .code */
void func_80390630(Actor *this){
if(func_803203FC(0xC4)){
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
this->marker->propPtr->unk8_3 = FALSE;
actor_collisionOff(this);
this->unk58_0 = FALSE;
}
return;
}
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
this->marker->propPtr->unk8_3 = FALSE;
actor_collisionOn(this);
this->unk38_31 = jiggyscore_isCollected(JIGGY_32_FP_WOZZA) || levelSpecificFlags_get(0x26) ? 0 : 1;
}//L80390714
if(this->unk38_31){
this->unk58_0 = FALSE;
return;
}
this->unk58_0 = TRUE;
func_8028E668(this->position, 200.0f, -40.0f, 160.0f);
if(this->state == 1){
this->yaw_ideal = (f32)func_80329784(this);
func_80328FB0(this, 1.0f);
if(!func_803114B0()){
if( actor_animationIsAt(this, 0.09f)
|| actor_animationIsAt(this, 0.19f)
){
FUNC_8030E8B4(SFX_88_WOZZA_NOISE, 1.0f, 22000, this->position, 500, 2000);
}
if( actor_animationIsAt(this, 0.68f)
|| actor_animationIsAt(this, 0.78f)
|| actor_animationIsAt(this, 0.85f)
|| actor_animationIsAt(this, 0.92f)
){
FUNC_8030E8B4(SFX_3F2_UNKNOWN, 0.8f, 24000, this->position, 500, 2000);
}
}
if(func_80329530(this, 350)){
if(player_getTransformation() == TRANSFORM_4_WALRUS){
if(!levelSpecificFlags_get(0x31)){
if(func_80311480(0xc27, 0x23, NULL, NULL, NULL, NULL)){
levelSpecificFlags_set(0x31, TRUE);
}
}
}
else{
if(!levelSpecificFlags_get(0x32)){
if(func_80311480(0xc26, 0x23, NULL, NULL, NULL, NULL)){
levelSpecificFlags_set(0x32, TRUE);
}
}
}
}
}
}

57
src/FP/ch/present.c Normal file
View File

@@ -0,0 +1,57 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
Actor *func_8038F0F0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
void func_8038F144(Actor *this);
/* .data */
ActorAnimationInfo D_803924A0[] = {
{0, 0.0f},
{ASSET_18A_XMAS_GIFT, 1.5f}
};
ActorInfo D_803924B0 = { MARKER_208_BLUE_PRESENT, ACTOR_33A_BLUE_PRESENT, ASSET_47F_MODEL_XMAS_GIFT_BLUE,
0x1, D_803924A0,
func_8038F144, func_80326224, func_8038F0F0,
2500, 0, 1.2f, 0
};
ActorInfo D_803924D4 = { MARKER_209_GREEN_PRESENT, ACTOR_33B_GREEN_PRESENT, ASSET_480_MODEL_XMAS_GIFT_GREEN,
0x1, D_803924A0,
func_8038F144, func_80326224, func_8038F0F0,
2500, 0, 1.2f, 0
};
ActorInfo D_803924F8 = { MARKER_20A_RED_PRESENT, ACTOR_33C_RED_PRESENT, ASSET_481_MODEL_XMAS_GIFT_RED,
0x1, D_803924A0,
func_8038F144, func_80326224, func_8038F0F0,
2500, 0, 1.2f, 0
};
/* .code */
Actor *func_8038F0F0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
Actor *this = marker_getActor(marker);
if(this->unk38_31)
return this;
else
return func_80325888(marker, gfx, mtx, vtx);
}
void func_8038F144(Actor *this){
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
if(!jiggyscore_isCollected(JIGGY_2E_FP_PRESENTS)){
this->unk38_31 = TRUE;
this->marker->collidable = FALSE;
this->marker->propPtr->unk8_3 = FALSE;
}
else{
this->unk38_31 = FALSE;
this->marker->collidable = FALSE;
this->marker->propPtr->unk8_3 = TRUE;
animctrl_setAnimTimer(this->animctrl, randf());
}
}
if (this) if (this);
}

93
src/FP/ch/racesled.c Normal file
View File

@@ -0,0 +1,93 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
Actor *chRaceSled_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
void chRaceSled_update(Actor *this);
/* .data */
ActorAnimationInfo chRaceSledAnimations []= {
{ ASSET_1A1_ANIM_SLED, 1.0f},
{ ASSET_1A1_ANIM_SLED, 1.0f},
{ ASSET_1A1_ANIM_SLED, 1.0f},
{ ASSET_1A1_ANIM_SLED, 1.0f}
};
ActorInfo chRaceSled = {
MARKER_3C_RACE_SLED, ACTOR_182_RACE_SLED, ASSET_352_MODEL_SLED,
0x0, chRaceSledAnimations,
chRaceSled_update, NULL, chRaceSled_draw,
1000, 0, 0.0f, 0
};
/* .code */
Actor *chRaceSled_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
Actor *this = marker_getActor(marker);
if(this->unk10_12 == FALSE){
return func_80325888(marker, gfx, mtx, vtx);
}
return this;
}
void __chRaceSled_setState(Actor *this, s32 next_state){
if(this->state != 1 || next_state != 1){
func_80328A84(this, next_state);
switch(next_state){
case 1: //L8038697C
this->unk10_12 = TRUE;
this->marker->propPtr->unk8_3 = FALSE;
break;
case 2: //L803869A4
this->unk10_12 = FALSE;
this->marker->propPtr->unk8_3 = TRUE;
break;
case 3: //L803869CC
this->unk10_12 = TRUE;
this->marker->propPtr->unk8_3 = FALSE;
break;
}
}
}
void __chRaceSled_touch(ActorMarker *this_marker, ActorMarker *other_marker){
Actor *this = marker_getActor(this_marker);
f32 plyr_pos[3];
if(this->state == 2){
player_getPosition(plyr_pos);
if( this->position_y + 20.0f < plyr_pos[1]
&& func_8028F20C()
&& player_getTransformation() == TRANSFORM_4_WALRUS
&& func_8028F68C(BS_INTR_27_WALRUS_SLED, this->marker)
){
__chRaceSled_setState(this, 3); //start_race
}
}
}
void chRaceSled_update(Actor *this){
s32 sp24;
if(!this->initialized){
this->initialized = TRUE;
marker_setCollisionScripts(this->marker, __chRaceSled_touch, NULL, NULL);
__chRaceSled_setState(this, 1);
}
sp24 = mapSpecificFlags_get(4);
if(sp24 == 0){
__chRaceSled_setState(this, 1);
}
switch (this->state){
case 1://L80386B38
if(sp24){
__chRaceSled_setState(this, 2);
}
break;
case 3://L80386B50
if(func_8028ECAC() != BSGROUP_C_WALRUS_SLED){
__chRaceSled_setState(this, 2);
}
break;
}
}

148
src/FP/ch/scarfsled.c Normal file
View File

@@ -0,0 +1,148 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
void chScarfSled_update(Actor *this);
/* .data */
ActorAnimationInfo chScarfSledAnimations[] ={
{ASSET_1A1_ANIM_SLED, 1.0f},
{ASSET_1A1_ANIM_SLED, 1.0f},
{ASSET_1A1_ANIM_SLED, 1.0f},
{ASSET_1A1_ANIM_SLED, 1.0f}
};
ActorInfo chScarfSled = {
MARKER_3B_SCARF_SLED, ACTOR_181_SCARF_SLED, ASSET_352_MODEL_SLED,
0, chScarfSledAnimations,
NULL, chScarfSled_update, func_80325888,
1000, 0, 0.0f, 0
};
/* .code */
void __chScarfSled_setState(Actor *this, s32 next_state){
func_80328A84(this, next_state);
if(next_state == 2){
mapSpecificFlags_set(0xB, TRUE);
timed_setCameraToNode(0.0f, 0x27);
timed_playSfx(0.6f, SFX_52_BANJO_YAH_OH, 1.0f, 28000);
timed_playSfx(1.25f, SFX_31_BANJO_OHHWAAOOO, 1.0f, 28000);
timed_setCameraToNode(1.5f, 0x26);
timed_setCameraToNode(2.75f, 0x25);
timed_playSfx(3.5f, SFX_63_BANJO_UWAAAAOOH, 1.0f, 28000);
timed_setCameraToNode(3.75f, 0x24);
timed_playSfx(4.25f, SFX_A7_WOODEN_SWOSH, 1.2f, 18000);
timed_playSfx(4.45f, SFX_C1_BUZZBOMB_ATTACK, 1.0f, 0x7fff);
timed_setCameraToNode(4.75f, 0x23);
}
}
void __chScarfSled_touch(ActorMarker *this_marker, ActorMarker *other_marker){
Actor * this = marker_getActor(this_marker);
if(this->state != 1) return;
if(player_getTransformation() != TRANSFORM_1_BANJO) return;
if(func_8028F68C(BS_INTR_27_BANJO_SLED, this->marker))
__chScarfSled_setState(this, 2);
}
void __chScarfSled_func_8038655C(Actor *this){
int tmp_bool;
int tmp;
tmp_bool = (mlAbsF(this->position_y - this->velocity_y) < 100.0f);
tmp = this->unk10_12;
this->unk10_12 = FALSE;
if(!tmp_bool){
if(tmp != 0){
func_8030E6A4(SFX_19_BANJO_LANDING_08, func_8030E200(this->unk44_31), 0x55f0);
}
}
else{
if(this->unk44_31 == 0){
this->unk44_31 = func_8030ED2C(SFX_18_BIGBUTT_SLIDE, 2);
func_8030E0FC(this->unk44_31, 0.9f, 1.5f, 1.2f);
}
this->unk10_12 = TRUE;
func_8030E2C4(*((u8*)this + 0x44));
}
}
void __chScarfSled_func_80386630(Actor *this){
f32 sp7C[3];
f32 sp70[3];
f32 sp64[3];
f32 sp24[4][4];
func_80343DEC(this);
mapSpecificFlags_set(9, 1);
__chScarfSled_func_8038655C(this);
if(this->unk138_20){
this->yaw = 0.0f;
sp64[0] = this->pitch;
sp64[1] = this->yaw;
sp64[2] = this->roll;
mlMtxIdent();
mlMtxRotYaw(sp64[1]);
mlMtxRotPitch(sp64[0]);
mlMtxGet(sp24);
sp70[0] = 0.0f;
sp70[1] = 18.0f;
sp70[2] = 0.0f;
func_8025235C(sp70, sp70);
sp70[0] += this->position[0];
sp70[1] += this->position[1];
sp70[2] += this->position[2];
func_8028FAB0(sp70);
sp64[0] = this->pitch;
sp64[1] = this->yaw;
sp64[2] = this->roll;
func_8028FAEC(sp64);
}//L80386724
if(1.0 == this->unk48){
mapSpecificFlags_set(1, TRUE);
FUNC_8030E624(SFX_103_FLOTSAM_DEATH, 1.0f, 30000);
FUNC_8030E624(SFX_11_WOOD_BREAKING_1, 0.8f, 25000);
FUNC_8030E624(SFX_D_EGGSHELL_BREAKING, 1.0f, 25000);
sp7C[0] = -1000.0f;
sp7C[1] = 1727.0f;
sp7C[2] = 6218.0f;
func_8028F490(sp7C);
marker_despawn(this->marker);
}//L803867AC
}
void chScarfSled_update(Actor *this){
if(!this->initialized){
this->initialized = TRUE;
marker_setCollisionScripts(this->marker, __chScarfSled_touch, NULL, NULL);
this->marker->propPtr->unk8_3 = TRUE;
this->unk10_12 = 0;
ml_vec3f_clear(this->velocity);
__chScarfSled_setState(this, 1);
}
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
if(jiggyscore_isCollected(JIGGY_2A_FP_BOGGY_1)){
marker_despawn(this->marker);
return;
}
}
this->velocity_x = this->position_x;
this->velocity_y = func_80309724(this->position);
this->velocity_z = this->position_z;
if(this->state == 2){
__chScarfSled_func_80386630(this);
}
}

102
src/FP/ch/snowmanbutton.c Normal file
View File

@@ -0,0 +1,102 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
Actor *func_80386B80(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
void FP_func_80386CF8(Actor *this);
/* .data */
ActorAnimationInfo FP_D_80391A90[] ={
{0, 0.0},
{ASSET_143_ANIM_SNOWMAN_BUTTON, 800000.0f},
{ASSET_143_ANIM_SNOWMAN_BUTTON, 0.5f},
{ASSET_143_ANIM_SNOWMAN_BUTTON, 800000.0f}
};
ActorInfo FP_D_80391AB0 = {
MARKER_B9_FP_SNOWMAN_BUTTON, ACTOR_116_FP_SNOWMAN_BUTTON, ASSET_421_MODEL_FP_SNOWMAN_BUTTON,
0x1, FP_D_80391A90,
FP_func_80386CF8, func_80326224, func_80386B80,
0, 0x800, 0.0f, 0
};
struct31s D_80391AD4 = {
{0.4f, 0.6f},
{1.8f, 3.6f},
{0.0f, 0.01f},
{0.5f, 1.4f},
0.0f, 0.01f,
};
struct43s D_80391AFC = {
{{-300.0f, 350.0f, -300.0f}, {300.0f, 800.0f, 300.0f}},
{{0.0f, -800.0f, 0.0f}, {0.0f, -800.0f, 0.0f}},
{{-50.0f, -50.0f, -50.0f}, {50.0f, 50.0f, 50.0f}}
};
s32 D_80391B44[3] = {225, 225, 245};
/* .code */
Actor *func_80386B80(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
Actor *this = marker_getActor(marker);
func_8033A45C(1, this->state == 3);
func_8033A45C(2, func_8033A0F0(1) ^ 1);
return func_80325888(marker, gfx, mtx, vtx);
}
void FP_func_80386BEC(Actor *this){
f32 plyr_pos[3];
ParticleEmitter *pCtrl = partEmitMgr_newEmitter(12);
player_getPosition(plyr_pos);
func_80328B8C(this, 2, 0.01f, 1);
actor_collisionOff(this);
func_8025A6EC(COMUSIC_2B_DING_B, 28000);
FUNC_8030E624(SFX_90_SWITCH_PRESS, 1.0f, 32000);
fp_snowmanButtonGame_decRemaining();
particleEmitter_setRGB(pCtrl, D_80391B44);
particleEmitter_setSprite(pCtrl, ASSET_700_SPRITE_DUST);
particleEmitter_setPosition(pCtrl, plyr_pos);
particleEmitter_setPositionVelocityAndAccelerationRanges(pCtrl, &D_80391AFC);
func_802EFB98(pCtrl, &D_80391AD4);
particleEmitter_emitN(pCtrl, 12);
}
void func_80386CB8(ActorMarker *this_marker, ActorMarker *other_marker){
Actor *this = marker_getActor(this_marker);
if(this->state == 1)
FP_func_80386BEC(this);
}
void FP_func_80386CF8(Actor *this){
marker_setCollisionScripts(this->marker, NULL, NULL, func_80386CB8);
this->marker->propPtr->unk8_3 = TRUE;
actor_collisionOn(this);
if(!this->initialized){
this->initialized = TRUE;
this->pitch += (f32)(this->unkF4_8 - 1);
}
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
if(this->state == 3){
fp_snowmanButtonGame_decRemaining();
}
}
switch(this->state){
case 1:
break;
case 2:
if(actor_animationIsAt(this, 0.99f)){
func_80328B8C(this, 3, 0.99f, 0);
}
break;
case 3:
break;
}
}

367
src/FP/ch/twinkly.c Normal file
View File

@@ -0,0 +1,367 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern Actor *func_802EBAE0(UNK_TYPE(s32), f32 position[3], f32 rotation[3], f32 scale, UNK_TYPE(s32), UNK_TYPE(s32), UNK_TYPE(s32), f32, UNK_TYPE(s32));
Actor *func_8038C0B0(ActorMarker *marker, UNK_TYPE(s32) arg1, f32 arg2, UNK_TYPE(s32) arg3);
Actor *func_8038C1F8(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
void func_8038C9A0(Actor *this);
/* .data */
ActorAnimationInfo D_80391F50[] = {
{0x000, 0.0f},
{0x178, 1e+08f},
{0x17C, 1e+08f},
{0x178, 1e+08f},
{0x17C, 2.0f},
{0x17C, 1.0f},
{0x17C, 2.0f}
};
ActorInfo D_80391F88 = { MARKER_200_TWINKLY_BLUE, ACTOR_332_TWINKLY_BLUE, ASSET_448_MODEL_TWINKLY_BLUE,
0x1, D_80391F50,
func_8038C9A0, func_80326224, func_8038C1F8,
0, 0, 1.0f, 0
};
ActorInfo D_80391FAC = { MARKER_201_TWINKLY_GREEN, ACTOR_333_TWINKLY_GREEN, ASSET_449_MODEL_TWINKLY_GREEN,
0x1, D_80391F50,
func_8038C9A0, func_80326224, func_8038C1F8,
0, 0, 1.0f, 0
};
ActorInfo D_80391FD0 = { MARKER_202_TWINKLY_ORANGE, ACTOR_334_TWINKLY_ORANGE, ASSET_44A_MODEL_TWINKLY_ORANGE,
0x1, D_80391F50,
func_8038C9A0, func_80326224, func_8038C1F8,
0, 0, 1.0f, 0
};
ActorInfo D_80391FF4 = { MARKER_203_TWINKLY_RED, ACTOR_335_TWINKLY_RED, ASSET_44B_MODEL_TWINKLY_RED,
0x1, D_80391F50,
func_8038C9A0, func_80326224, func_8038C1F8,
0, 0, 1.0f, 0
};
s32 FP_D_80392018[4] = {0, 0, 0, func_8038C0B0};
struct43s D_80392028 = {
{{-200.0f, 200.0f, -200.0f}, {200.0f, 400.0f, 200.0f}},
{{ 0.0f, -800.0f, 0.0f}, { 0.0f, -800.0f, 0.0f}},
{{ -15.0f, -15.0f, -15.0f}, { 15.0f, 15.0f, 15.0f}}
};
f32 D_80392070[3] = {-4034.0f, 73.0f, 3918.0f};
f32 D_8039207C[3] = {-3946.0f, 69.0f, 3538.0f};
f32 D_80392088[3] = {-4459.0f, 176.0f, 5693.0f};
f32 D_80392094[3] = {-4578.0f, 440.0f, 6198.0f};
s32 D_803920A0[4] = {0xFF, 0xFF, 0xFF, 0xFF};
s32 D_803920B0[4] = {0xFF, 0xFF, 0xFF, 0x00};
/* .code */
Actor *func_8038C0B0(ActorMarker *marker, UNK_TYPE(s32) arg1, f32 arg2, UNK_TYPE(s32) arg3){
UNK_TYPE(s32) sp5C = func_8033A12C(func_80330B1C(marker));
Actor *this = marker_getActor(marker);
f32 sp4C[3];
f32 sp40[3];
f32 sp3C;
sp4C[0] = (f32)marker->propPtr->x;
sp4C[1] = (f32)marker->propPtr->y;
sp4C[2] = (f32)marker->propPtr->z;
sp40[0] = (f32)marker->pitch;
sp40[1] = this->unk60;
sp40[2] = (f32)marker->roll;
sp3C = this->scale;
if(func_802EA190(marker->unk20)){
return func_802EBAE0(sp5C, sp4C, sp40, sp3C, NULL, marker->unk20, arg1, arg2, arg3);
}
else{
return NULL;
}
}
Actor *func_8038C1F8(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
Actor *this = marker_getActor(marker);
func_8033A45C(2, this->unk38_31);
func_8033A45C(1, func_8033A0F0(2) ^ 1);
return func_80325888(marker, gfx, mtx, vtx);
}
void func_8038C260(f32 position[3], s32 count, enum asset_e model_id){
ParticleEmitter *pCtrl;
pCtrl = partEmitMgr_newEmitter(count);
particleEmitter_setModel(pCtrl, model_id);
particleEmitter_setPosition(pCtrl, position);
particleEmitter_setPositionVelocityAndAccelerationRanges(pCtrl, &D_80392028);
particleEmitter_setAngularVelocityRange(pCtrl,
400.0f, 400.0f, 400.0f,
800.0f, 800.0f, 800.0f
);
func_802EFB70(pCtrl, 0.1f, 0.2f);
particleEmitter_setSpawnIntervalRange(pCtrl, 0.0f, 0.02f);
particleEmitter_setParticleLifeTimeRange(pCtrl, 1.5f, 1.5f);
particleEmitter_setFade(pCtrl, 0.0f, 0.3f);
func_802EF9F8(pCtrl, 0.6f);
func_802EFA18(pCtrl, 0);
func_802EFA20(pCtrl, 1.0f, 1.3f);
particleEmitter_setSfx(pCtrl, SFX_7B_ICE_BREAKING_1, 8000);
particleEmitter_emitN(pCtrl, count);
}
void func_8038C398(f32 position[3], enum marker_e marker_id){
enum asset_e sp1C;
switch(marker_id){
case MARKER_200_TWINKLY_BLUE:
sp1C = ASSET_497_MODEL_TWINKLY_SHARD_BLUE;
break;
case MARKER_201_TWINKLY_GREEN:
sp1C = ASSET_499_MODEL_TWINKLY_SHARD_GREEN;
break;
case MARKER_202_TWINKLY_ORANGE:
sp1C = ASSET_49A_MODLE_TWINKLY_SHARD_ORANGE;
break;
case MARKER_203_TWINKLY_RED:
sp1C = ASSET_49B_MODEL_TWINKLY_SHARD_RED;
break;
}
func_8038C260(position, 12, sp1C);
func_8038C260(position, 4, ASSET_498_MODEL_TWINKLY_SHARD_YELLOW);
}
void func_8038C428(Actor *arg0, f32 arg1[3], f32 arg2)
{
u8 sp7F;
s32 sp78;
f32 sp74;
f32 sp70;
f32 temp_f14;
f32 var_f22;
f32 sp5C[3];
f32 var_f24;
f32 sp54;
f32 sp48[3];
f32 temp_f0;
sp78 = 0;
sp74 = arg2;
sp70 = arg0->position[1];
sp7F = (arg2 == 0.0f) ? (0) : (1);
var_f22 = arg1[0] - arg0->position[0];
var_f24 = arg1[2] - arg0->position[2];
sp54 = gu_sqrtf((var_f22 * var_f22) + (var_f24 * var_f24));
sp48[0] = var_f22 / sp54;
sp48[2] = var_f24 / sp54;
if (sp7F)
{
temp_f0 = randf2(130.0f, 150.0f);
sp54 = (sp54 < temp_f0) ? (sp54) : (temp_f0);
var_f22 = sp48[0] * sp54;
var_f24 = sp48[2] * sp54;
}
sp5C[0] = arg0->position[0] + var_f22;
sp5C[1] = arg0->position[1];
sp5C[2] = arg0->position[2] + var_f24;
temp_f14 = func_80309724(sp5C);
if (sp7F) {
do {
sp78 += 1;
temp_f0 = arg2 + (-3.2);
arg2 = temp_f0;
sp70 += temp_f0;
}
while ((temp_f14 < sp70) || (arg2 > 0.0f));
}
else {
sp78 = 0x1C;
temp_f0 = sp78;
sp74 = (((arg1[1] + 40.0f) - arg0->position[1]) / temp_f0) - (((-3.2) * temp_f0) / 2.0);
}
animctrl_setAnimTimer(arg0->animctrl, 0.0f);(arg0->animctrl, 0.0f);
temp_f0 = sp78;
arg0->unk1C[0] = (f32) (0.99999 / temp_f0);
arg0->velocity[1] = sp74;
arg0->velocity[0] = (f32) (var_f22 / temp_f0);
arg0->velocity[2] = (f32) (var_f24 / temp_f0);
if (sp7F) {
func_8030E878(SFX_3F2_UNKNOWN, randf2(1.2f, 1.3f), 0x7D00U, arg0->position, 1750.0f, 3500.0f);
}
else {
func_8030E878(SFX_53_BANJO_HUIII, randf2(1.4f, 1.5f), 0x7D00U, arg0->position, 1750.0f, 3500.0f);
}
}
bool func_8038C718(Actor *this, f32 arg1){
f32 tmp;
this->position[0] += this->velocity[0];
this->position_y += (this->velocity_y += -3.2);
this->position_z += this->velocity_z;
tmp = 0.9999 < animctrl_getAnimTimer(this->animctrl) + this->unk1C[0] ? 0.999999 : animctrl_getAnimTimer(this->animctrl) + this->unk1C[0];
animctrl_setAnimTimer(this->animctrl, tmp);
if(arg1 == 0.0f)
arg1 = func_80309724(this->position);
if(this->position_y <= arg1){
this->position_y = arg1;
return FALSE;
}
return TRUE;
}
bool func_8038C844(f32 arg0[3], f32 arg1[3]){
if( (arg0[0] - arg1[0] < 26.0f && -26.0f < arg0[0] - arg1[0])
&& (arg0[1] - arg1[1] < 26.0f && -26.0f < arg0[1] - arg1[1])
&& (arg0[2] - arg1[2] < 26.0f && -26.0f < arg0[2] - arg1[2])
){
return TRUE;
}
return FALSE;
}
void func_8038C8F0(ActorMarker *marker){
Actor *this;
Actor *muncher;
Actor *other;
s32 pad;
this = marker_getActor(reinterpret_cast(ActorMarker *, marker));
other = marker_getActor(this->unk100);
muncher = func_8032813C(ACTOR_337_TWINKLY_MUNCHER, D_80392070, 170);
muncher->unk100 = other->marker;
muncher->unkF4_8 = 1;
if(pad);
}
void func_8038C94C(ActorMarker *caller, enum asset_e text_id, s32 arg2){
Actor *this = marker_getActor(caller);
if(!func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE)){
func_80328A84(this, 6);
__spawnQueue_add_1((GenMethod_1)func_8038C8F0, reinterpret_cast(s32, this->marker));
}
}
void func_8038C9A0(Actor *this){
Actor *other; //sp34
void * sp30;
if(this->marker->unk14_20 == 0x200){
sp30 = func_8034C2C4(this->marker, 0x190);
}
other = marker_getActor(this->unk100);
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
this->marker->unk18 = &FP_D_80392018;
this->unk38_31 = 0;
if(0.0f != other->velocity[0]){
func_80328A84(this, 4);
this->unk1C[1] = this->position_y + 50.0f;
this->unk1C[2] = this->position_y;
}
else{
this->velocity_x = 0.0f;
this->velocity_y = 0.0f;
this->velocity_z = 0.0f;
this->unk1C[0] = 0.0f;
animctrl_setAnimTimer(this->animctrl, 0.0f);
func_8038C428(this, D_8039207C, 0);
return;
}
}//L8038CA9C
if(1.0f == other->unk1C[1]){
func_8038C398(this->position, this->marker->unk14_20);
FUNC_8030E8B4(SFX_7B_ICE_BREAKING_1, 1.0f, 32000, this->position, 0x6d6, 0xdac);\
marker_despawn(this->marker);
return;
}
switch(this->state){
case 1:// 8038CB2C
if(!func_8038C718(this, 0)){
func_80328B8C(this, 2, 0.001f, 1);
func_8038C428(this, D_80392088, randf2(20.0f, 24.0f));
this->unk60 = this->yaw;
}
break;
case 2:// 8038CB8C
this->yaw += 4.0f;
if(actor_animationIsAt(this, 0.999)){
func_8034DFB0(sp30, D_803920A0, D_803920B0, 0.14f);
}
if(actor_animationIsAt(this, 0.8f)){
func_8034DFB0(sp30, D_803920B0, D_803920A0, 0.14f);
}
if(0.8 < animctrl_getAnimTimer(this->animctrl) || animctrl_getAnimTimer(this->animctrl) < 0.2){
this->unk38_31 = TRUE;
}
else{
this->unk38_31 = FALSE;
}
if(!func_8038C718(this, 0.0f)){
if(func_8038C844(this->position, D_80392088)){
func_80328B8C(this, 3, 0.001f, 1);
func_8038C428(this, D_80392094, 0.0f);
}
else{
func_8038C428(this, D_80392088, randf2(20.0f, 24.0f));
}
}
break;
case 3:// 8038CCFC
if(!func_8038C718(this, 0.0f)){
if(other->unk38_31 != 0){
other->unk38_31--;
}
func_8025A6EC(COMUSIC_2B_DING_B, 28000);
marker_despawn(this->marker);
}
break;
case 4:// 8038CD58
this->position_y += 3.0f;
if(this->unk1C[1] <= this->position_y){
this->position_y = this->unk1C[1];
if(!func_8031FF1C(0x82)){
func_80311480(0xc12, 0x2a, this->position, this->marker, func_8038C94C, NULL);
func_80320004(0x82, TRUE);
}
else{
func_80311480(0xc25, 0x2b, this->position, this->marker, func_8038C94C, NULL);
}
func_80328A84(this, 5);
this->pitch -= 3.0f;
}
break;
case 5:// 8038CE14
this->yaw_ideal = (f32)func_80329784(this);
func_80328FB0(this, 8.0f);
if(!func_8038C718(this, this->unk1C[1])){
this->velocity[1] = randf2(14.0f, 20.0f);
}
break;
case 6:// 8038CE64
this->position_y -= 5.0f;
if(this->position_y < this->unk1C[2] - 50.0f){
other->velocity_x = 0.0f;
marker_despawn(this->marker);
}
break;
default:
break;
}//L8038CEB0
}

432
src/FP/ch/twinklybox.c Normal file
View File

@@ -0,0 +1,432 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern void func_80324CD8(f32);
extern Actor *func_8032813C(enum actor_e, f32[3], s32);
Actor *FP_func_8038CED0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
void func_8038D6C8(Actor *this);
/* .data */
ActorAnimationInfo D_803920C0[] ={
{0x000, 0.0f},
{0x16D, 10000000.0f},
{0x237, 2.0f},
{0x16D, 0.8f},
{0x16D, 0.8f}
};
ActorInfo D_803920E8 = { 0x204, 0x336, 0x442,
0x1, D_803920C0,
func_8038D6C8, func_80326224, FP_func_8038CED0,
0, 0, 0.0f, 0
};
/* .code */
Actor *FP_func_8038CED0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
Actor *this = marker_getActor(marker);
if( func_8038BFA0() || func_8031FF1C(BKPROG_13) ){
if(0.0f == this->velocity[1])
return this;
}
return func_80325888(marker, gfx, mtx, vtx);
}
void func_8038CF54(f32 position[3], s32 count, enum asset_e model_id){
static struct31s D_8039210C = {
{ 0.4f, 0.8f },
{-1.0f, -1.0f },
{ 0.0f, 0.02f},
{ 1.8f, 2.2f },
0.0f,
0.7f
};
static struct43s D_80392134 = {
{{-200.0f, 200.0f, -200.0f}, {200.0f, 400.0f, 200.0f}},
{{ 0.0f, -800.0f, 0.0f}, { 0.0f, -800.0f, 0.0f}},
{{-100.0f, 0.0f, -100.0f}, {100.0f, 100.0f, 100.0f}}
};
ParticleEmitter *pCtrl;
pCtrl = partEmitMgr_newEmitter(count);
particleEmitter_setModel(pCtrl, model_id);
particleEmitter_setPosition(pCtrl, position);
particleEmitter_setPositionVelocityAndAccelerationRanges(pCtrl, &D_80392134);
particleEmitter_setAngularVelocityRange(pCtrl,
100.0f, 100.0f, 100.0f,
200.0f, 200.0f, 200.0f
);
func_802EFB98(pCtrl, &D_8039210C);
func_802EF9F8(pCtrl, 0.6f);
func_802EFA18(pCtrl, 3);
particleEmitter_emitN(pCtrl, count);
}
void func_8038D01C(f32 position[3], s32 count, enum asset_e sprite_id){
static struct31s D_8039217C = {
{0.8f, 1.2f },
{1.4f, 2.0f },
{0.0f, 0.01f},
{1.2f, 1.8f },
0.0f,
0.01f
};
static s32 D_803921A4[3] = { 0xDC, 0xDC, 0xE6};
static struct43s D_803921B0 = {
{{-200.0f, 0.0f, -200.0f}, {200.0f, 200.0f, 200.0f}},
{{ 0.0f, -10.0f, 0.0f}, { 0.0f, -10.0f, 0.0f}},
{{-50.0f, 0.0f, -50.0f}, {50.0f, 200.0f, 50.0f}}
};
ParticleEmitter *pCtrl;
pCtrl = partEmitMgr_newEmitter(count);
particleEmitter_setRGB(pCtrl, D_803921A4);
particleEmitter_setSprite(pCtrl, sprite_id);
particleEmitter_setPosition(pCtrl, position);
particleEmitter_setPositionVelocityAndAccelerationRanges(pCtrl, &D_803921B0);
func_802EFB98(pCtrl, &D_8039217C);
particleEmitter_emitN(pCtrl, count);
}
void func_8038D0A8(f32 position[3], s32 count, enum asset_e model_id){
static struct31s D_803921F8 = {
{ 0.2f, 0.3f },
{-1.0f, -1.0f },
{ 0.0f, 0.02f},
{ 2.0f, 2.5f },
0.0f, 0.3f
};
static struct43s D_80392220 = {
{{-300.0f, 400.0f, -300.0f}, {300.0f, 800.0f, 300.0f}},
{{ 0.0f, -800.0f, 0.0f}, { 0.0f, -800.0f, 0.0f}},
{{-80.0f, 80.0f, -80.0f}, {80.0f, 80.0f, 80.0f}}
};
ParticleEmitter *pCtrl;
pCtrl = partEmitMgr_newEmitter(count);
particleEmitter_setModel(pCtrl, model_id);
particleEmitter_setPosition(pCtrl, position);
particleEmitter_setPositionVelocityAndAccelerationRanges(pCtrl, &D_80392220);
particleEmitter_setAngularVelocityRange(pCtrl,
200.0f, 200.0f, 200.0f,
300.0f, 300.0f, 300.0f
);
func_802EFB98(pCtrl, &D_803921F8);
func_802EF9F8(pCtrl, 0.2f);
func_802EFA18(pCtrl, 2);
particleEmitter_emitN(pCtrl, count);
}
void func_8038D170(f32 position[3], s32 count, enum asset_e sprite_id){
static struct31s D_80392268 ={
{ 0.4f, 0.6f },
{-1.0f, -1.0f },
{ 0.0f, 0.02f},
{ 2.0f, 2.5f },
0.0f,
0.3f
};
static struct43s D_80392290 = {
{{-300.0f, 400.0f, -300.0f}, {300.0f, 800.0f, 300.0f}},
{{ 0.0f, -800.0f, 0.0f}, { 0.0f, -800.0f, 0.0f}},
{{-80.0f, 80.0f, -80.0f}, {80.0f, 80.0f, 80.0f}}
};
ParticleEmitter *pCtrl;
pCtrl = partEmitMgr_newEmitter(count);
particleEmitter_setSprite(pCtrl, sprite_id);
particleEmitter_setPosition(pCtrl, position);
particleEmitter_setPositionVelocityAndAccelerationRanges(pCtrl, &D_80392290);
func_802EFB98(pCtrl, &D_80392268);
func_802EF9F8(pCtrl, 0.2f);
func_802EFA18(pCtrl, 2);
particleEmitter_emitN(pCtrl, count);
}
void func_8038D208(f32 position[3], s32 count, enum asset_e sprite_id){
static struct31s D_803922D8 = {
{0.5f, 0.7f },
{1.4f, 1.7f },
{0.0f, 0.01f},
{0.6f, 0.9f },
0.0f, 0.01f
};
static s32 D_80392300[3] = { 0xDC, 0xDC, 0xE6};
static struct43s D_8039230C = {
{{-100.0f, 0.0f, -100.0f}, {100.0f, 100.0f, 100.0f}},
{{0.0f, -10.0f, 0.0f}, {0.0f, -10.0f, 0.0f}},
{{-80.0f, 0.0f, -80.0f}, {50.0f, 200.0f, 80.0f}}
};
ParticleEmitter *pCtrl;
pCtrl = partEmitMgr_newEmitter(count);
particleEmitter_setRGB(pCtrl, D_80392300);
particleEmitter_setSprite(pCtrl, sprite_id);
particleEmitter_setPosition(pCtrl, position);
particleEmitter_setPositionVelocityAndAccelerationRanges(pCtrl, &D_8039230C);
func_802EFB98(pCtrl, &D_803922D8);
particleEmitter_emitN(pCtrl, count);
}
void func_8038D294(ActorMarker *marker){
Actor *this = marker_getActor(marker);
func_8038CF54(this->position, 12, ASSET_4D4_MODEL_TWINKLY_BOX_PAPER_SHARD);
func_8038D01C(this->position, 12, ASSET_700_SPRITE_DUST);
this->velocity[1] = 0.0f;
FUNC_8030E8B4(SFX_30_MAGIC_POOF, 1.0f, 32000, this->position, 1000, 3500);
func_80311480(0xc13, 0, NULL, NULL, NULL, NULL);
}
void func_8038D324(Actor *this){
int i;
func_8038D0A8(this->position, 24, ASSET_4D4_MODEL_TWINKLY_BOX_PAPER_SHARD);
for(i = 0; i < 24; i++){
func_8038D170(this->position, 1, ASSET_710_SPRITE_SPARKLE_PURPLE + randi2(0, 10));
}
func_8038D208(this->position, 8, ASSET_700_SPRITE_DUST);
FUNC_8030E624(SFX_30_MAGIC_POOF, 1.0f, 32000);
}
void func_8038D3B0(Actor *arg0){
item_set(ITEM_6_HOURGLASS, FALSE);
}
void func_8038D3D8(void){
comusic_8025AB44(COMUSIC_68_TWINKLY_MINIGAME, 0, 4000);
func_8025AABC(COMUSIC_68_TWINKLY_MINIGAME);
func_8025A58C(-1, 4000);
func_8024BD08(1);
}
void func_8038D41C(ActorMarker *marker){
static f32 D_80392354[3] = {-4165.0f, 73.0f, 4483.0f};
static f32 D_80392360[3] = {-4292.0f, 73.0f, 5054.0f};
s32 pad[2];
ActorMarker *_marker = reinterpret_cast(ActorMarker *, marker);
Actor *actor;
actor = func_8032813C(ACTOR_337_TWINKLY_MUNCHER, D_80392354, 170);
actor->unk100 = _marker;
actor = func_8032813C(ACTOR_337_TWINKLY_MUNCHER, D_80392360, 170);
actor->unk100 = _marker;
if(pad[0]);
}
void func_8038D474(ActorMarker *marker){
static enum actor_e D_8039236C[4] = {
ACTOR_332_TWINKLY_BLUE,
ACTOR_333_TWINKLY_GREEN,
ACTOR_334_TWINKLY_ORANGE,
ACTOR_335_TWINKLY_RED,
};
Actor *actor = marker_getActor(reinterpret_cast(ActorMarker*, marker));
Actor *child;
s32 pad;
if((s32)actor->unk1C[0] >= 3){
actor->unk1C[0] = -1.0f;
}
actor->unk1C[0] += 1.0;
child = spawn_child_actor(D_8039236C[(s32)actor->unk1C[0]], &actor);
child->unk100 = actor->marker;
}
void func_8038D51C(ActorMarker *marker){
Actor *this = marker_getActor(marker);
item_set(ITEM_6_HOURGLASS, FALSE);
func_80320004(BKPROG_13, TRUE);
FUNC_8030E624(SFX_416, 0.8f, 32000);
func_8028F8F8(7, 0);
this->unk1C[1] = 1.0f;
func_80324E88(1.7f);
func_80324E38(1.7f, 0);
timedFunc_set_1(2.3f, (GenMethod_1)func_8038D294, (s32)this->marker);
this->velocity[1] = 1.0f;
}
void func_8038D5C8(ActorMarker *this_marker, ActorMarker *other_marker){
static f32 D_8039237C[3] = {-3940.0f, 69.0f, 3570.0f};
Actor *this = marker_getActor(this_marker);
if(this->state == 1 || this->state == 2){
actor_collisionOff(this);
timed_setCameraToNode(0.0f, 0xa);
func_80324CD8(0.1f);
func_8028F784(1);
func_8028F490(D_8039237C);
func_8028F8F8(7, 1);
this->unk1C[1] = 0.0f;
func_8025A6EC(COMUSIC_68_TWINKLY_MINIGAME, 25000);
func_8025A58C(0, 4000);
func_8024BD08(0);
this->unk1C[2] = 428571.0f;
func_8025AEA0(0x68, (s32)this->unk1C[2]);
func_80328B8C(this, 3, 0.001f, 1);
actor_playAnimationOnce(this);
this->velocity[0] = 1.0f;
}//L8038D6B8
}
void func_8038D6C8(Actor *this){
f32 sp24;
bool sp20;
sp24 = time_getDelta();
mapSpecificFlags_set(0xd, (this->state != 1 && this->state != 2) ? TRUE : FALSE);
if(func_8038BFA0() || func_8031FF1C(BKPROG_13)){
this->marker->propPtr->unk8_3 = FALSE;
actor_collisionOff(this);
func_8028F8F8(7, FALSE);
return;
}
this->marker->propPtr->unk8_3 = TRUE;
actor_collisionOn(this);
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
marker_setFreeMethod(this->marker, func_8038D3B0);
marker_setCollisionScripts(this->marker, NULL, func_8038D5C8, NULL);
this->unk38_31 = 0;
this->unk1C[1] = 0.0f;
this->velocity[0] = 0.0f;
this->velocity[1] = 0.0f;
this->unk1C[0] = -1.0f;
func_8028F8F8(7, FALSE);
if(func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE) && gcparade_8031B4F4() == -1){
func_80328B8C(this, 3, 0.001f, 1);
actor_playAnimationOnce(this);
this->velocity[0] = 1.0f;
}
}//L8038D844
if(func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE)){
this->velocity[0] = 1.0f;
}
switch (this->state)
{
case 1: //L8038D89C
if(!func_80329530(this, 800))
break;
if(!(func_8023DB5C() & 1))
func_80328B8C(this, 2, 0.001f, 1);
else
func_80328B8C(this, 2, 0.999f, 0);
actor_playAnimationOnce(this);
this->velocity[2] = randf2(1.4f, 2.0f);
break;
case 2: //L8038D91C
sp20 = animctrl_isPlayedForwards(this->animctrl);
animctrl_setDuration(this->animctrl, this->velocity[2]);
if( ( sp20 == TRUE && actor_animationIsAt(this, 0.999f) )
|| ( sp20 == FALSE && actor_animationIsAt(this, 0.001f) )
){
func_80328B8C(this, 1, 0.001f, 0);
actor_playAnimationOnce(this);
break;
}
if( actor_animationIsAt(this, 0.02f)
|| actor_animationIsAt(this, 0.15f)
|| actor_animationIsAt(this, 0.28f)
|| actor_animationIsAt(this, 0.63f)
|| actor_animationIsAt(this, 0.81f)
){
FUNC_8030E8B4(SFX_98_DEAF_THUD, 1.0f, 32000, this->position, 400, 2000);
}
break;
case 3: //L8038DA24
if(actor_animationIsAt(this, 0.3f))
func_8038D324(this);
if(actor_animationIsAt(this, 0.999f))
__spawnQueue_add_1((GenMethod_1)func_8038D474, (s32)this->marker);
if(this->velocity[0] != 0.0f)
break;
func_80324E88(0.0f);
func_8028F784(0);
func_80328B8C(this, 4, 0.999f, 1);
actor_playAnimationOnce(this);
item_set(ITEM_0_HOURGLASS_TIMER, 80*60 - 1);
item_set(ITEM_6_HOURGLASS, TRUE);
this->unk38_31 = 0xA;
item_set(ITEM_24_TWINKLY_SCORE, this->unk38_31);
__spawnQueue_add_1((GenMethod_1)func_8038D41C, (s32)this->marker);
this->unk60 = 0.0f;
func_80347A14(0);
func_802FAD64(ITEM_14_HEALTH);
break;
case 4: //L8038DB18
this->unk1C[2] += (sp24*-195238.0f)/80.0f;
if(this->unk1C[2] < 233333.0f)
this->unk1C[2] = 233333.0f;
func_8025AEA0(COMUSIC_68_TWINKLY_MINIGAME, (s32)this->unk1C[2]);
if(item_getCount(ITEM_24_TWINKLY_SCORE) == 0){
func_80328B8C(this, 1, 0.001f, 1);
func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000);
func_8038D3D8();
func_80324E38(0.0f, 3);
timedFunc_set_1(1.3f, (GenMethod_1)func_8038D51C, (s32)this->marker);
timed_setCameraToNode(0.9f, 0xC);
item_set(ITEM_24_TWINKLY_SCORE, this->unk38_31);
func_80347A14(1);
break;
}
if(item_empty(ITEM_6_HOURGLASS)){
func_80328B8C(this, 1, 0.001f, 0);
actor_playAnimationOnce(this);
this->unk38_31 = 0;
item_set(ITEM_6_HOURGLASS, FALSE);
func_8025A6EC(COMUSIC_3C_MINIGAME_LOSS, 28000);
func_8028F8F8(7, FALSE);
this->unk1C[1] = 1.0f;
func_8038D3D8();
func_80347A14(1);
break;
}
if(0.96 < animctrl_getAnimTimer(this->animctrl)){
if(this->unk60 <= 0.0){
__spawnQueue_add_1((GenMethod_1)func_8038D474, (s32)this->marker);
this->unk60 = 2.9f;
}
else{
this->unk60 -= sp24;
}
item_set(ITEM_24_TWINKLY_SCORE, this->unk38_31);
}
break;
}
}
bool func_8038DD14(void){
return mapSpecificFlags_get(0xD);
}
bool func_8038DD34(ActorMarker *marker){
Actor *this = marker_getActor(marker);
if(func_80329530(this, 800))
return TRUE;
return FALSE;
}

236
src/FP/ch/twinklymuncher.c Normal file
View File

@@ -0,0 +1,236 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern ActorProp *func_80320EB0(ActorMarker *, f32, s32);
Actor *func_8038DD70(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
void func_8038E094(Actor *this);
/* .data */
extern ActorAnimationInfo D_80392390[] ={
{0, 0.0f},
{ASSET_1AF_ANIM_TWINKLY_MUNCHER_APPEAR, 10000000.0f},
{ASSET_1B0_ANIM_TWINKLY_MUNCHER_DIE, 1.0f},
{ASSET_1B1_ANIM_TWINKLY_MUNCHER_IDLE, 1.0f},
{ASSET_1B2_ANIM_TWINKLY_MUNCHER_ATTACK, 1.0f},
{ASSET_1AF_ANIM_TWINKLY_MUNCHER_APPEAR, 0.667f},
{ASSET_1B1_ANIM_TWINKLY_MUNCHER_IDLE, 1.0f},
{ASSET_1AF_ANIM_TWINKLY_MUNCHER_APPEAR, 0.667f}
};
extern ActorInfo D_803923D0 = { MARKER_205_TWINKLY_MUNCHER, ACTOR_337_TWINKLY_MUNCHER, ASSET_496_MODEL_TWINKLY_MUNCHER,
0x1, D_80392390,
func_8038E094, func_80326224, func_8038DD70,
2500, 0, 1.0f, 0
};
/* .code */
Actor *func_8038DD70(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
Actor *this = marker_getActor(marker);
if(this->state == 1)
return this;
return func_80325888(marker, gfx, mtx, vtx);
}
void func_8038DDC8(Actor *this){
actor_collisionOn(this);
func_80328B8C(this, 2, 0.03f, 1);
actor_playAnimationOnce(this);
}
void func_8038DE08(Actor *this){
func_80328B8C(this, 3, 0.03f, 1);
actor_loopAnimation(this);
}
void func_8038DE40(Actor *this){
func_80328B8C(this, 4, 0.03f, 1);
actor_playAnimationOnce(this);
}
void func_8038DE78(Actor *this){
actor_collisionOff(this);
func_80328B8C(this, 5, 0.03f, 1);
actor_playAnimationOnce(this);
}
void func_8038DEB8(ActorMarker *this_marker, ActorMarker *other_marker){
Actor *this = marker_getActor(this_marker);
if(this->state != 1 && this->state != 5){
func_8038DE78(this);
FUNC_8030E8B4(SFX_87_TANKTUP_OOOHW, 1.6f, 32000, this->position, 1250, 2500);
FUNC_8030E8B4(SFX_1D_HITTING_AN_ENEMY_1, 1.0f, 26000, this->position, 1250, 2500);
}
}
Actor *func_8038DF34(Actor *this){
ActorProp *prop;
Actor *other;
s32 marker_id;
f32 sp18[3];
func_8034A174(this->marker->unk44, 5, sp18);
this->marker->unk38[0] = sp18[0] - this->position[0];
this->marker->unk38[1] = sp18[1] - this->position[1];
this->marker->unk38[2] = sp18[2] - this->position[2];
prop = func_80320EB0(this->marker, 75.0f, 1);
if(prop && prop->unk8_0){
other = marker_getActor(prop->marker);
marker_id = other->marker->unk14_20;
if( marker_id == MARKER_200_TWINKLY_BLUE
|| marker_id == MARKER_201_TWINKLY_GREEN
|| marker_id == MARKER_202_TWINKLY_ORANGE
|| marker_id == MARKER_203_TWINKLY_RED
){
return other;
}
}
return NULL;
}
void func_8038E040(ActorMarker *caller, enum asset_e text_id, s32 arg2){
Actor *this = marker_getActor(caller);
func_80324E88(0.5f);
func_80328B8C(this, 7, 0.03f, 1);
actor_playAnimationOnce(this);
}
void func_8038E094(Actor *this){
s32 sp3C;
Actor *sp38;
f32 sp34 = time_getDelta();
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
marker_setCollisionScripts(this->marker, NULL, func_8038DEB8, NULL);
this->marker->propPtr->unk8_3 = TRUE;
animctrl_setAnimTimer(this->animctrl, 0.99999f);
this->unk60 = 0.0f;
if(this->unkF4_8 == 1){
func_8038DDC8(this);
}
if(this->unkF4_8 == 2){
if(func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE) && gcparade_8031B4F4() == -2){
func_8038DDC8(this);
}
else{
marker_despawn(this->marker);
return;
}
}
}//L8038E180
if(this->unk100){
sp38 = marker_getActor(this->unk100);
if(sp38->unk1C[1] == 1.0f){
if(this->unkF4_8 == 1 && !func_8031FF1C(BKPROG_13)){
if(this->state != 6 && this->state != 7 && 0.0f == this->velocity[0]){
timed_setCameraToNode(0.5f, 0xd);
func_80311480(ASSET_C15_TEXT_TWINKLIE_MINIGAME_LOST, 0x2b, this->position, this->marker, func_8038E040, NULL);
this->velocity[0] = 1.0f;
func_80328B8C(this, 6, 0.03f, 1);
actor_loopAnimation(this);
}
}
else{//L8038E274
if(this->state == 1){
marker_despawn(this->marker);
}
else if( this->state != 1 && this->state != 5){
func_8038DE78(this);
}
}
}
}//L8038E2B4
switch(this->state){
case 1: //L8038E2DC
this->marker->propPtr->unk8_3 = FALSE;
animctrl_setAnimTimer(this->animctrl, 0.99f);
if(this->unk60 < 5.0){
this->unk60 += sp34;
}
else{
if(10.0 <= this->unk60 || randf() < this->unk60/10.0){
if(!func_8038DF34(this)){
this->unk60 = 0.0f;
func_8038DDC8(this);
break;
}
}
this->unk60 += sp34;
}
break;
case 2: //L8038E3C0
this->marker->propPtr->unk8_3 = TRUE;
sp38 = func_8038DF34(this);
if(sp38){
func_8038DE40(this);
this->unk38_31 = sp38->marker->unk14_20;
break;
}
if(actor_animationIsAt(this, 0.15f))
FUNC_8030E8B4(SFX_C5_TWINKLY_POP, 1.0f, 32000, this->position, 1250, 2500);
if(actor_animationIsAt(this, 0.35f))
FUNC_8030E8B4(SFX_C4_TWINKLY_MUNCHER_GRR, 1.2f, 32000, this->position, 1250, 2500);
if(actor_animationIsAt(this, 0.97f))
func_8038DE08(this);
break;
case 3: //L8038E498
this->marker->propPtr->unk8_3 = TRUE;
sp38 = func_8038DF34(this);
if(sp38){
func_8038DE40(this);
this->unk38_31 = sp38->marker->unk14_20;
}
break;
case 4: //L8038E4F0
this->marker->propPtr->unk8_3 = TRUE;
sp38 = func_8038DF34(this);
if(sp38 && sp38->marker->unk14_20 == this->unk38_31){
if(actor_animationIsAt(this, 0.23)){
func_8038C398(sp38->position, sp38->marker->unk14_20);
FUNC_8030E8B4(SFX_110_TWINKLY_DEATH, 1.0f, 32000, this->position, 1250, 2500);
FUNC_8030E8B4(SFX_27_JINJO_HI, 1.6f, 32000, this->position, 1250, 2500);
func_80324D54(0.35f, SFX_110_TWINKLY_DEATH, 1.0f, 32000, this->position, 1250.0f, 2500.0f);
marker_despawn(sp38->marker);
if( !mapSpecificFlags_get(0xa) && func_80311480(0xc16, 0, NULL, NULL, NULL, NULL)){
mapSpecificFlags_set(0xa, TRUE);
}
}
}//L8038E620
if(actor_animationIsAt(this, 0.97f)){
func_8038DE08(this);
}
break;
case 5: //L8038E644
this->marker->propPtr->unk8_3 = TRUE;
if(actor_animationIsAt(this, 0.97f)){
func_80328B8C(this, 1, 0.97f, 0);
actor_playAnimationOnce(this);
this->unk60 = 0.0f;
}
break;
case 6: //L8038E698
this->marker->propPtr->unk8_3 = FALSE;
this->yaw_ideal = (f32)func_80329784(this);
func_80328FB0(this, 12.0f);
break;
case 7: //L8038E6D4
this->marker->propPtr->unk8_3 = FALSE;
if(actor_animationIsAt(this, 0.97f)){
marker_despawn(this->marker);
}
break;
}
}

355
src/FP/ch/wozza.c Normal file
View File

@@ -0,0 +1,355 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
typedef struct {
f32 unk0[3];
f32 unkC[3];
f32 unk18[3];
f32 unk24[3];
u8 unk30;
} ActorLocal_Wozza;
Actor *func_8038F210(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
void FP_func_8038F7AC(Actor *this);
/* .data */
ActorAnimationInfo D_80392520[] ={
{0x000, 0.0f},
{0x1AC, 3.8f},
{0x1AC, 3.8f},
{0x1AE, 0.55f},
{0x1AE, 0.55f},
{0x1B3, 0.6f},
{0x1B4, 0.8f},
{0x1AE, 0.55f},
{0x1AD, 4.4f},
{0x1B5, 1.2f},
{0x221, 5.0f},
{0x1AE, 0.55f},
{0x1AE, 0.55f}
};
ActorInfo D_80392588 = { MARKER_20B_WOZZA, ACTOR_1F3_WOZZA, ASSET_494_MODEL_WOZZA,
0x1, D_80392520,
FP_func_8038F7AC, func_80326224, func_8038F210,
0, 0, 1.6f, 0
};
f32 D_803925AC[3] = {-4026.0f, 800.0f, -4097.0f};
/* .code */
Actor *func_8038F210(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
Actor *this = marker_getActor(marker);
if(func_8038BFA0() || this->unk38_31)
return this;
return func_80325888(marker, gfx, mtx, vtx);
}
void func_8038F274(void){
UNK_TYPE(s32) v0 = func_8034C528(0x191);
if(v0){
func_8034DE60(v0, 0.0f, -500.0f, 0.2f, 1);
}
}
void func_8038F2B8(Actor *this){
func_80328B8C(this, 3, 0.02f, 1);
actor_loopAnimation(this);
}
void func_8038F2F0(Actor *this){
func_80328B8C(this, 11, 0.02f, 1);
actor_loopAnimation(this);
func_8038F274();
}
void func_8038F330(ActorMarker *caller, enum asset_e text_id, s32 arg2){
Actor *this = marker_getActor(caller);
switch(text_id){
case 0xC1B:
func_80324E88(0.0f);
break;
case 0xC1C:
func_80324E88(0.0f);
func_8038F2F0(this);
break;
}
}
void func_8038F3A0(void){
mapSpecificFlags_set(8, 1);
}
void func_8038F3C4(ActorMarker *caller, enum asset_e text_id, s32 arg2){
if(arg2 == 1){
func_8038F3A0();
}
}
void func_8038F3F4(ActorMarker *marker){
Actor *actor = marker_getActor(marker);
func_8038F2B8(actor);
}
void func_8038F41C(Actor *this){
func_80328B8C(this, 1, 0.02f, 1);
actor_loopAnimation(this);
}
void func_8038F454(Actor *this){
if(!mapSpecificFlags_get(7) && func_8028ECAC() != BSGROUP_A_FLYING && func_80329530(this, 1000) ){
mapSpecificFlags_set(7, TRUE);
func_80328A84(this, 2);
actor_loopAnimation(this);
timed_setCameraToNode(0.0f, 0x2e);
func_80324DBC(0.0f, 0xc1b, 0x2a, this->position, this->marker, func_8038F330, NULL);
timedFunc_set_1(2.5f, (GenMethod_1)func_8038F3F4, (s32)this->marker);
}
else{
func_8038F2B8(this);
}
}
void func_8038F528(Actor *this){
func_80328B8C(this, 4, 0.02f, 1);
actor_loopAnimation(this);
}
void func_8038F560(Actor *this){
func_80328B8C(this, 7, 0.02f, 1);
actor_loopAnimation(this);
}
void func_8038F598(Actor *this, f32 arg1){
this->yaw_ideal = func_80329784(this);
func_80328FB0(this, arg1);
}
bool func_8038F5D4(Actor *this, f32 arg1[3], f32 arg2, f32 arg3, s32 arg4){
f32 sp24;
sp24 = animctrl_getAnimTimer(this->animctrl);
this->yaw_ideal = (f32) func_803297C8(this, arg1);
func_80328FB0(this, arg3);
if(actor_animationIsAt(this, 0.9f)){
FUNC_8030E8B4(SFX_3F2_UNKNOWN, 0.8f, 24000, this->position, 500, 2000);
}
this->unk28 = (1.0f- sp24)*arg2;
func_80329054(this, 2);
if(ml_distance_vec3f(this->position, arg1) <= arg4)
return TRUE;
return FALSE;
}
bool FP_func_8038F6C4(Actor *this, f32 arg1[3], f32 arg2){
s32 dTheta;
func_80328C64(this, func_803297C8(this, arg1));
func_80328FB0(this, arg2);
dTheta = this->yaw - this->yaw_ideal;
if(-arg2 <= dTheta && dTheta <= arg2){
return TRUE;
}
return FALSE;
}
void FP_func_8038F758(ActorMarker *marker){
Actor *this = marker_getActor(reinterpret_cast(ActorMarker *, marker));
Actor *jiggy = spawn_child_actor(ACTOR_1F4_WOZZAS_JIGGY, &this);
s32 pad;
jiggy->yaw = this->yaw;
this->unk100 = jiggy->marker;
jiggy->unk100 = this->marker;
}
void FP_func_8038F7AC(Actor *this){
ActorLocal_Wozza * local = (ActorLocal_Wozza *)&this->local;
if(func_803203FC(0xC4)){
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
this->marker->propPtr->unk8_3 = FALSE;
actor_collisionOff(this);
this->unk58_0 = FALSE;
func_8038F274();
}
return;
}
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
this->marker->propPtr->unk8_3 = FALSE;
if(jiggyscore_isCollected(JIGGY_32_FP_WOZZA)){
func_8038F274();
marker_despawn(this->marker);
return;
}
if(levelSpecificFlags_get(0x26)){
this->unk38_31 = TRUE;
func_8038F274();
}
else{//L8038F8A0
nodeProp_findPositionFromActorId(0x359, local->unk24);
nodeProp_findPositionFromActorId(0x35A, local->unk0);
nodeProp_findPositionFromActorId(0x35B, local->unkC);
nodeProp_findPositionFromActorId(0x35C, local->unk18);
this->position[0] = local->unkC[0];\
this->position[1] = local->unkC[1];\
this->position[2] = local->unkC[2];
__spawnQueue_add_1((GenMethod_1)FP_func_8038F758, reinterpret_cast(s32, this->marker));
local->unk30 = FALSE;
}
}//L8038F910
if(func_8038BFA0() || this->unk38_31 || !subaddie_playerIsWithinSphere(this, 3000)){
actor_collisionOff(this);
return;
}
actor_collisionOn(this);
switch(this->state){
case 1: //L8038F984
if(func_8028ECAC() == BSGROUP_A_FLYING){
func_8038F454(this);
break;
}
if(func_80329530(this, 1300) && player_getTransformation() == TRANSFORM_4_WALRUS){
func_80328B8C(this, 8, 0.02f, 1);
actor_loopAnimation(this);
break;
}
if(func_80329530(this, 1000) && !func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE)){
func_8038F454(this);
break;
}
func_8038F598(this, 1.0f);
if( actor_animationIsAt(this, 0.38f) || actor_animationIsAt(this, 0.7f)){
if(randf() < 0.4)
animctrl_setDirection(this->animctrl, animctrl_isPlayedForwards(this->animctrl) ^ 1);
}
break;
case 3: //L8038FA9C
if(func_8038F5D4(this, local->unk24, 30.0f, 12.0f, 0x3C))
func_8038F528(this);
break;
case 4: //L8038FAD0
if(!func_80329530(this, 2000) && func_8028ECAC() != BSGROUP_A_FLYING){
func_8038F560(this);
break;
}
if(func_8038F5D4(this, local->unk0, 30.0f, 12.0f, 0x3C)){
func_80328B8C(this, 5, 0.02f, 1);
actor_playAnimationOnce(this);
}
break;
case 5: //L8038FB50
FP_func_8038F6C4(this, local->unk18, 1.0f);
if(0.97 < animctrl_getAnimTimer(this->animctrl)){
func_80328B8C(this, 6, 0.02f, 1);
actor_loopAnimation(this);
}
break;
case 6: //L8038FBA8
FP_func_8038F6C4(this, local->unk18, 1.0f);
if( func_80329530(this, 1700) ) break;
if( func_8028ECAC() == BSGROUP_A_FLYING ) break;
func_8038F560(this);
if(!local->unk30){
if(func_80311480(0xc1d, 0x20, NULL, NULL, NULL, NULL)){
local->unk30 = TRUE;
}
}
break;
case 7: //L8038FC30
if(!FP_func_8038F6C4(this, local->unkC, 4.5f))
break;
if(func_80329530(this, 1000) || func_8028ECAC() == BSGROUP_A_FLYING){
func_8038F528(this);
break;
}
if(func_8038F5D4(this, local->unkC, 30.0f, 12.0f, 0x3C)){
func_8038F41C(this);
}
break;
case 8: //L8038FCB0
if(player_getTransformation() != TRANSFORM_4_WALRUS){
func_8038F41C(this);
break;
}
if(func_80329530(this, 500) && !this->unk138_24){
if(func_80311480(0xc1c, 0xAA, this->position, this->marker, func_8038F330, func_8038F3C4)){
timed_setCameraToNode(0.0f, 0x2E);
this->unk138_24 = TRUE;
}
break;
}//L8038FD40
if(mapSpecificFlags_get(8)){
if(FP_func_8038F6C4(this, D_803925AC, 9.0f)){
func_80328B8C(this, 9, 0.02f, 1);
actor_playAnimationOnce(this);
}
break;
}
func_8038F598(this, 2.0f);
if(!func_803114B0()){
if( actor_animationIsAt(this, 0.02f)
|| actor_animationIsAt(this, 0.14f)
|| actor_animationIsAt(this, 0.28f)
|| actor_animationIsAt(this, 0.42f)
){
FUNC_8030E8B4(SFX_88_WOZZA_NOISE, 1.0f, 32000, this->position, 500, 2000);
}
}
break;
case 9: //L8038FE14
FP_func_8038F6C4(this, D_803925AC, 9.0f);
if(0.97 < animctrl_getAnimTimer(this->animctrl)){
func_80328B8C(this, 10, 0.02f, 1);
actor_loopAnimation(this);
}
break;
case 10: //L8038FE70
func_8038F598(this, 9.0f);
break;
case 11: //L8038FE84
if(func_8038F5D4(this, local->unk24, 30.0f, 12.0f, 0x3C)){
func_80328A84(this, 12);
}
break;
case 12: //L8038FEB8
if(func_8038F5D4(this, local->unk18, 30.0f, 12.0f, 0x3C)){
this->unk38_31 = TRUE;
}
break;
}//L8038FEEC
}

210
src/FP/ch/xmastree.c Normal file
View File

@@ -0,0 +1,210 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
Actor *chXmasTree_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
void chXmasTree_update(Actor *this);
/* .data */
ActorInfo chXmasTree = {
MARKER_BA_XMAS_TREE, ACTOR_15F_XMAS_TREE, ASSET_488_MODEL_XMAS_TREE,
0x1, NULL,
chXmasTree_update, func_80326224, chXmasTree_draw,
0, 0, 0.0f, 0
};
/* .code */
Actor *chXmasTree_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
Actor *this = marker_getActor(marker);
func_8033A45C(5, this->unk38_31);
func_8033A45C(6, func_8031FF1C(0x13) && !func_8033A0F0(5));
return func_80325888(marker, gfx, mtx, vtx);
}
void __chXmasTree_free(Actor *this){
u8 tmp_a0;
item_set(ITEM_6_HOURGLASS, FALSE);
tmp_a0 = this->unk44_31;
if(tmp_a0){
func_8030DA44(tmp_a0);
this->unk44_31 = 0;
}
}
void __chXmasTree_80386EF4(Actor *this, int arg1){
this->unk38_31 = arg1;
mapSpecificFlags_set(0, this->unk38_31);
}
void __chXmasTree_80386F3C(void){
levelSpecificFlags_set(0x29, TRUE);
func_803228D8();
func_803204E4(0xe, 1);
func_802E4078(MAP_53_FP_CHRISTMAS_TREE, 1, 0);
}
void __chXmasTree_80386F84(Actor * this){
func_80328A84(this, 2);
__chXmasTree_80386EF4(this, 0);
}
void __chXmasTree_spawnSwitch(void){
static s32 chXmasTree_switch_spawn_position[3] = {-0x1220, 0x6A, 0x1945};
func_8032811C(ACTOR_338_XMAS_TREE_SWITCH, chXmasTree_switch_spawn_position, 350);
}
void __chXmasTree_spawnStar(void *marker){
Actor *this = marker_getActor(reinterpret_cast(ActorMarker *, marker));
Actor *child = spawn_child_actor(0x339, &this);
s32 pad;
child->position_x += 20.0f;
child->position_z += 25.0f;
}
void __chXmasTree_80387038(Actor *this){
if(func_8030E3FC(this->unk44_31))
func_8030E394(this->unk44_31);
func_8030DBB4(this->unk44_31, randf2(0.9f, 1.1f));
func_8030E2C4(this->unk44_31);
}
void __chXmasTree_8038709C(Actor *this){
if(this->state == 5){
if(!mapSpecificFlags_get(0))
__chXmasTree_80387038(this);
return;
}
if(mapSpecificFlags_get(0) && !func_8030E3FC(this->unk44_31))
__chXmasTree_80387038(this);
}
void chXmasTree_update(Actor *this){
f32 sp2C = time_getDelta();
u8 tmp_a0;
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
this->marker->propPtr->unk8_3 = TRUE;
this->marker->collidable = FALSE;
marker_setFreeMethod(this->marker, __chXmasTree_free);
if(this->unk44_31 == 0){
this->unk44_31 = func_8030D90C();
sfxsource_setSfxId(this->unk44_31, SFX_415_UNKNOWN);
func_8030DD14(this->unk44_31, 3);
sfxsource_setSampleRate(this->unk44_31, 28000);
}
__spawnQueue_add_0(__chXmasTree_spawnSwitch);
__spawnQueue_add_1((GenMethod_1)__chXmasTree_spawnStar, reinterpret_cast(s32, this->marker));
if(func_8031FF1C(0x13)){
__chXmasTree_80386F84(this);
mapSpecificFlags_set(2, FALSE);
}
}
this->depth_mode = 1;
if(jiggyscore_isCollected(JIGGY_2F_FP_XMAS_TREE) || levelSpecificFlags_get(0x29)){
__chXmasTree_80386EF4(this, 1);
return;
}
switch(this->state){
case 1: // L80387268
__chXmasTree_80386EF4(this, 0);
if(func_8031FF1C(0x13)){
__chXmasTree_80386F84(this);
}
break;
case 2: // L80387294
if(!mapSpecificFlags_get(2)) break;
func_80328A84(this, 3);
this->unk60 = 2.0f;
func_8025A6EC(COMUSIC_61_XMAS_TREE_LIGHTS_UP, 28000);
func_802BAFE4(0x1A);
func_80311480(0xC14, 0, NULL, NULL, NULL, NULL);
break;
case 3: // L803872F0
if(0.0 <= this->unk60){
if( 1.8 < this->unk60){
__chXmasTree_80386EF4(this, 0);
}
else if(this->unk60 < 0.2){//L80387340
__chXmasTree_80386EF4(this, 1);
}
else{
if(randf() < 0.2){
__chXmasTree_80386EF4(this, this->unk38_31 ^ 1);
__chXmasTree_8038709C(this);
}
}//L803873AC
this->unk60 -= sp2C;
}
else{//L803873BC
if(func_802BB270()){
func_80328A84(this, 4);
__chXmasTree_80386EF4(this, 1);
item_set(ITEM_0_HOURGLASS_TIMER, 3600 - 1);
item_set(ITEM_6_HOURGLASS, TRUE);
}
}
break;
case 4: // L80387400
if(mapSpecificFlags_get(3)){
func_80328A84(this, 6);
__chXmasTree_80386EF4(this, 1);
item_set(ITEM_6_HOURGLASS, FALSE);
tmp_a0 = this->unk44_31;
if(tmp_a0){
func_8030DA44(tmp_a0);
this->unk44_31 = 0;
}
func_80324E38(0.0f, 3);
timedFunc_set_0(0.5f, __chXmasTree_80386F3C);
}
else{//L80387470
if(item_empty(ITEM_6_HOURGLASS)){
func_80328A84(this, 5);
mapSpecificFlags_set(2, FALSE);
this->unk60 = 0.1f;
if(!func_8038BFA0()){
if(!mapSpecificFlags_get(9) || mapSpecificFlags_get(1)){
func_8025A6EC(COMUSIC_3C_MINIGAME_LOSS, 28000);
func_802BAFE4(0x1a);
this->unk60 = 2.0f;
}
}
}
}
break;
case 5: // L803874EC
if(0.0 <= this->unk60){
if( 1.8 < this->unk60){
__chXmasTree_80386EF4(this, 1);
}
else if(this->unk60 < 0.2){
__chXmasTree_80386EF4(this, 0);
}
else{
if(randf() < 0.2){
__chXmasTree_80386EF4(this, this->unk38_31 ^ 1);
__chXmasTree_8038709C(this);
}
}
this->unk60 -= sp2C;
}
else{
__chXmasTree_80386F84(this);
}
break;
}
}

View File

@@ -0,0 +1,85 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern s32 func_8024DB50(f32[3], f32);
void func_80390EB0(Actor *this);
/* .data */
ActorInfo FP_D_80392840 = { MARKER_245_XMAS_TREE_EGG_TOLL, ACTOR_353_XMAS_TREE_EGG_TOLL, ASSET_402_MODEL_EGG_TOLL,
0x0, NULL,
func_80390EB0, func_80326224, func_80325340,
2000, 0, 0.0f, 0
};
/* .code */
void func_80390C70(f32 position[3]){
static struct40s FP_D_80392864 = {{{1.7f, 2.0f}, {2.4f, 2.7f}, {0.0f, 0.01f}, {4.0f, 7.0f}, 0.3f, 0.7f}, 4.0f, 1.0f};
static s32 D_80392894[3] = {0xFF, 0XFF, 0xFF};
ParticleEmitter *pCtrl = partEmitMgr_newEmitter(1);
particleEmitter_setSprite(pCtrl, ASSET_70D_SPRITE_SMOKE_1);
particleEmitter_setStartingFrameRange(pCtrl, 1, 6);
particleEmitter_setRGB(pCtrl, D_80392894);
particleEmitter_setAlpha(pCtrl, 0x41);
particleEmitter_setPosition(pCtrl, position);
particleEmitter_setParticleSpawnPositionRange(pCtrl,
-40.0f, 110.0f, -40.0f,
40.0f, 110.0f, 40.0f
);
particleEmitter_setParticleVelocityRange(pCtrl,
0.0f, 40.0f, 0.0f,
0.0f, 90.0f, 0.0f
);
func_802EFC28(pCtrl, &FP_D_80392864);
}
void func_80390D58(f32 position[3]){
static struct40s D_803928A0 = {{{0.05f, 0.1f}, {0.1f, 0.2f}, {0.0f, 0.01f}, {0.9f, 1.3f}, 0.3f, 0.7f}, 4.0f, 1.0f};
static s32 D_803928D0[3] = {0xFF, 0xFF, 0xFF};
ParticleEmitter *pCtrl = partEmitMgr_newEmitter(1);
particleEmitter_setSprite(pCtrl, ASSET_713_SPRITE_SPARKLE_YELLOW);
particleEmitter_setStartingFrameRange(pCtrl, 1, 6);
particleEmitter_setRGB(pCtrl, D_803928D0);
particleEmitter_setAlpha(pCtrl, 0xFF);
particleEmitter_setPosition(pCtrl, position);
particleEmitter_setParticleSpawnPositionRange(pCtrl,
-40.0f, 50.0,-40.0f,
40.0f, 70.0, 40.0f
);
particleEmitter_setParticleVelocityRange(pCtrl,
-40.0f, 120.0,-40.0f,
40.0f, 180.0, 40.0f
);
particleEmitter_setParticleAccelerationRange(pCtrl,
0.0f, -60.0f, 0.0f,
0.0f, -100.0f, 0.0f
);
func_802EFC28(pCtrl, &D_803928A0);
}
void func_80390E78(ActorMarker *this_marker, ActorMarker *other_marker){
Actor *this = marker_getActor(this_marker);
FUNC_8030E8B4(SFX_96_HOTSAND_EEL_HISS, 1.0f, 32000, this->position, 1000, 2000);
}
void func_80390EB0(Actor *this){
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
actor_collisionOn(this);
marker_setCollisionScripts(this->marker, func_80390E78, NULL, NULL);
}
if(func_8024DB50(this->position, 150.0f) || func_80329530(this, 1200))
{
if( !(func_8023DB5C() & 3) && randf() < 0.2){
func_80390C70(this->position);
}
if( !(func_8023DB5C() & 3) && randf() < 0.7){
func_80390D58(this->position);
}
}
}

100
src/FP/ch/xmastreeice.c Normal file
View File

@@ -0,0 +1,100 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
Actor *func_803908F0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
void func_80390BDC(Actor *this);
/* .data */
ActorInfo D_80392730 = { 0x210, 0x340, 0x4D2,
0x0, NULL,
func_80390BDC, func_80326224, func_803908F0,
0, 0, 1.0f, 0
};
/* .code */
Actor *func_803908F0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
Actor *this = marker_getActor(marker);
if(this->unk38_31 != 0) return this;
return func_80325888(marker, gfx, mtx, vtx);
}
void func_80390944(f32 position[3], s32 cnt, enum asset_e model_id){
static struct31s D_80392754 = {{0.2f, 0.4f}, {-1.0f, -1.0f}, {0.0f, 0.02f}, {2.2f, 2.2f}, 0.0f, 0.3f};
static struct43s D_8039277C = {
{{-300.0f, 350.0f, -300.0f}, {300.0f, 600.0f, 300.0f}}, /*position*/
{{ 0.0f, -1000.0f, 0.0f}, { 0.0f, -1000.0f, 0.0f}}, /*velocitcy*/
{{-100.0f, 0.0f, -100.0f}, {100.0f, 200.0f, 100.0f}} /*acceleration*/
};
ParticleEmitter *pCtrl = partEmitMgr_newEmitter(cnt);
particleEmitter_setModel(pCtrl, model_id);
particleEmitter_setPosition(pCtrl, position);
particleEmitter_setPositionVelocityAndAccelerationRanges(pCtrl, &D_8039277C);
particleEmitter_setAngularVelocityRange(pCtrl,
100.0f, 100.0f, 100.0f,
250.0f, 250.0f, 250.0f
);
func_802EFB98(pCtrl, &D_80392754);
func_802EF9F8(pCtrl, 0.6f);
func_802EFA18(pCtrl, 0);
func_802EFA20(pCtrl, 1.0f, 1.3f);
particleEmitter_setSfx(pCtrl, SFX_7B_ICE_BREAKING_1, 8000);
particleEmitter_emitN(pCtrl, cnt);
}
void func_80390A30(f32 position[3], s32 cnt, enum asset_e sprite_id){
static struct31s D_803927C4 = {{0.6f, 0.8f}, {1.0f, 1.4f}, {0.0f, 0.01f}, {1.2f, 1.8f}, 0.0f, 0.01f};
static struct43s D_803927EC = {
{{-200.0f, 0.0f, -200.0f}, {200.0f, 200.0f, 200.0f}}, /*position*/
{{ 0.0f, -10.0f, 0.0f}, { 0.0f, -10.0f, 0.0f}}, /*velocitcy*/
{{ -50.0f, 0.0f, -50.0f}, { 50.0f, 200.0f, 50.0f}} /*acceleration*/
};
static s32 D_80392834[3] = {0xDC, 0xDC, 0xE6};
ParticleEmitter *pCtrl = partEmitMgr_newEmitter(cnt);
particleEmitter_setRGB(pCtrl, D_80392834);
particleEmitter_setSprite(pCtrl, sprite_id);
particleEmitter_setPosition(pCtrl, position);
particleEmitter_setPositionVelocityAndAccelerationRanges(pCtrl, &D_803927EC);
func_802EFB98(pCtrl, &D_803927C4);
particleEmitter_emitN(pCtrl, cnt);
}
void func_80390ABC(ActorMarker *marker){
Actor *this = marker_getActor(marker);
func_80390944(this->position, 0xA, 0x4D3);
func_80390A30(this->position, 6, ASSET_700_SPRITE_DUST);
func_8030E6D4(SFX_B6_GLASS_BREAKING_1);
func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000);
this->unk38_31 = 1;
}
void func_80390B2C(ActorMarker *marker){
Actor *this = marker_getActor(marker);
func_803228D8();
func_802E4078(MAP_27_FP_FREEZEEZY_PEAK, 0xd, 0);
marker_despawn(this->marker);
}
void func_80390B70(Actor *this){
func_80324E38(0.0f, 3);
timed_setCameraToNode(0.0f, 0);
timedFunc_set_1(0.6f, (GenMethod_1)func_80390ABC, reinterpret_cast(s32, this->marker));
timedFunc_set_1(2.5f, (GenMethod_1)func_80390B2C, reinterpret_cast(s32, this->marker));
}
void func_80390BDC(Actor *this){
this->marker->propPtr->unk8_3 = TRUE;
actor_collisionOff(this);
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
if(jiggyscore_isCollected(JIGGY_2F_FP_XMAS_TREE)){
marker_despawn(this->marker);
}
else{
if(levelSpecificFlags_get(0x29)){
func_80390B70(this);
}
}
}
}

148
src/FP/ch/xmastreestar.c Normal file
View File

@@ -0,0 +1,148 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
typedef struct {
f32 unk0[3];
f32 unkC[3];
u8 unk18;
u8 unk19;
u8 unk1A;
u8 unk1B;
} ActorLocal_FP_87E0;
Actor *func_8038EBD0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
void func_8038ECD8(Actor *this);
/* .data */
ActorInfo D_80392470 = { 0x207, 0x339, 0x426,
0x1, NULL,
func_8038ECD8, func_80326224, func_8038EBD0,
0, 0, 0.0f, 0
};
/* .bss */
f32 D_803935D0[3];
/* .code */
Actor *func_8038EBD0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
func_8033A45C( 2, mapSpecificFlags_get(0));
func_8033A45C( 1, mapSpecificFlags_get(0) ^ 1);
return func_80325888(marker, gfx, mtx, vtx);
}
void func_8038EC34(ActorMarker *this_marker, ActorMarker *other_marker){
Actor *this = marker_getActor(this_marker);
ActorLocal_FP_87E0 *local = (ActorLocal_FP_87E0 *)&this->local;
local->unk1B = TRUE;
}
void func_8038EC5C(Actor *this){
if(0.0f == this->unk60){
this->unk38_31++;
this->unk60 = 0.33f;
if(this->unk38_31 < 4){
func_8025A6EC(COMUSIC_2B_DING_B, 28000);
}
}
}
void func_8038ECD8(Actor *this){
ActorLocal_FP_87E0 *local = (ActorLocal_FP_87E0 *)&this->local;
f32 sp68[3];
s32 sp64;
f32 sp58[3];
f32 sp4C[3];
f32 sp40[3];
s32 sp3C;
f32 sp30[3];
if(jiggyscore_isCollected(JIGGY_2F_FP_XMAS_TREE)){
this->marker->collidable = FALSE;
return;
}
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
marker_setCollisionScripts(this->marker, NULL, func_8038EC34, NULL);
this->marker->propPtr->unk8_3 = TRUE;
player_getPosition(D_803935D0);
local->unk1B = 0;
this->unk38_31 = 0;
local->unk1A = 0;
}
local->unk19 = 0;
if(!local->unk1A && this->marker->unk14_21){
func_8034A174(this->marker->unk44, 5, sp58);
func_8034A174(this->marker->unk44, 6, sp4C);
local->unk0[0] = sp58[0] - sp4C[0];
local->unk0[1] = sp58[1] - sp4C[1];
local->unk0[2] = sp58[2] - sp4C[2];
player_getPosition(sp40);
sp40[0] -= sp4C[0];
sp40[1] -= sp4C[1];
sp40[2] -= sp4C[2];
local->unk18 = (0.0f <= sp40[0]*local->unk0[0] + sp40[1]*local->unk0[1] + sp40[2]*local->unk0[2]) ? 0 : 1;
local->unkC[0] = sp4C[0];
local->unkC[1] = sp4C[1];
local->unkC[2] = sp4C[2];
local->unk1A = TRUE;
}//L8038EE98
if(0.0f != this->unk60){
if(time_getDelta() < this->unk60){
this->unk60 -= time_getDelta();
}else{
this->unk60 = 0.0f;
}
}//L8038EEF0
switch(this->state){
case 1: //L8038EF10
this->marker->collidable = FALSE;
if(!mapSpecificFlags_get(2)) break;
if(mapSpecificFlags_get(3)) break;
func_80328A84(this, 2);
this->unk38_31 = 0;
break;
case 2://L8038EF5C
if(!local->unk1A) return;
if(item_empty(ITEM_6_HOURGLASS)){
func_80328A84(this, 1);
}
else{
this->marker->collidable = TRUE;
player_getPosition(sp68);
sp68[0] -= local->unkC[0];
sp68[1] -= local->unkC[1];
sp68[2] -= local->unkC[2];
sp64 = (0.0f <= sp68[0]*local->unk0[0] + sp68[1]*local->unk0[1] + sp68[2]*local->unk0[2]) ? 0 : 1;
if(sp64 == (local->unk18 ^ 1)){
local->unk19 = TRUE;
if(local->unk1B){
func_8038EC5C(this);
}
else{
player_getPosition(sp68);
sp3C = func_80320B98(D_803935D0, sp68, sp30, 0);
if(sp3C){
if(*(s32 *)(sp3C + 8) << 9 < 0)
func_8038EC5C(this);
}
}
}//L8038F090
if(!(this->unk38_31 < 3)){
func_80328A84(this, 1);
mapSpecificFlags_set(3, 1);
}
}
break;
}//L8038F0BC
local->unk18 = sp64;
local->unk1B = 0;
player_getPosition(D_803935D0);
}

119
src/FP/ch/xmastreeswitch.c Normal file
View File

@@ -0,0 +1,119 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
Actor *func_8038E720(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
void func_8038E940(Actor *this);
/* .data */
ActorAnimationInfo D_80392400[] = {
{0x000, 0.f},
{0x143, 1e+08f},
{0x1EF, 0.6f},
{0x143, 1.0f},
};
ActorInfo D_80392420 = { 0x206, 0x338, 0x486,
0x1, D_80392400,
func_8038E940, func_80326224, func_8038E720,
4500, 0, 0.0f, 0
};
/* .code */
Actor *func_8038E720(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
func_8033A45C(1, 0);
func_8033A45C(2, 1);
return func_80325888(marker, gfx, mtx, vtx);
}
void func_8038E774(Actor *this){
func_80328B8C(this, 2, 0.05f, 1);
actor_playAnimationOnce(this);
this->marker->collidable = TRUE;
this->unk38_31 = 0;
}
void func_8038E7CC(ActorMarker *this_marker, ActorMarker *other_marker){
Actor *this = marker_getActor(this_marker);
if(this->state == 2){
this->unk38_31++;
if(this->unk38_31 < 4){
func_8025A6EC(COMUSIC_2B_DING_B, 28000);
}
}
}
void func_8038E840(f32 position[3], s32 cnt, enum asset_e sprite_id){
static struct31s D_80392444 = {{0.4f, 0.6f}, {0.8f, 1.8f}, {0.0f, 0.01f}, {0.5f, 1.4f}, 0.0f, 0.01f};
ParticleEmitter *pCtrl = partEmitMgr_newEmitter(cnt);
particleEmitter_setSprite(pCtrl, sprite_id);
particleEmitter_setPosition(pCtrl, position);
particleEmitter_setParticleSpawnPositionRange(pCtrl,
-100.0f, -80.0f, -70.0f,
100.0f, 100.0f, 70.0f
);
particleEmitter_setParticleAccelerationRange(pCtrl,
0.0f, -200.0f, 0.0f,
0.0f, -200.0f, 0.0f
);
particleEmitter_setParticleVelocityRange(pCtrl,
-200.0f, -100.0f, -200.0f,
200.0f, 300.0f, 200.0f
);
func_802EFB98(pCtrl, &D_80392444);
particleEmitter_emitN(pCtrl, cnt);
}
void func_8038E940(Actor *this){
if(jiggyscore_isCollected(JIGGY_2F_FP_XMAS_TREE) || levelSpecificFlags_get(0x29)){
this->marker->propPtr->unk8_3 = TRUE;
this->marker->collidable = FALSE;
func_80328B8C(this, 3, 0.95f, 0);
return;
}//L8038E9B8
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
this->marker->propPtr->unk8_3 = TRUE;
this->marker->collidable = FALSE;
marker_setCollisionScripts(this->marker, NULL, func_8038E7CC, NULL);
func_80328B8C(this, 1, 0.05f, 1);
this->unk38_31 = 0;
this->unk60 = 0.0f;
}//L8038EA3C
this->unk58_0 = (this->state == 1) ? FALSE : TRUE;
switch(this->state){
case 1: //L8038EA98
if(func_8031FF1C(BKPROG_13) && !mapSpecificFlags_get(2))
func_8038E774(this);
break;
case 2: //L8038EAC8
if(actor_animationIsAt(this, 0.2f))
func_8038E840(this->position, 0x20, ASSET_717_SPRITE_SPARKLE_YELLOW_2);
if(this->unk38_31 < 3)
break;
func_80328B8C(this, 3, 0.05f, 1);
actor_playAnimationOnce(this);
FUNC_8030E624(SFX_416, 0.8f, 32000);
this->marker->collidable = FALSE;
this->unk60 = 0.0f;
break;
case 3: //L8038EB44
if(this->unk60 == 0.0f && actor_animationIsAt(this, 0.95f)){
this->unk60 = 1.0f;
mapSpecificFlags_set(2, TRUE);
break;
}
if(this->unk60 != 0.0f && !mapSpecificFlags_get(2)){
func_8038E774(this);
}
break;
}//L8038EBC0
}