The first commit
This commit is contained in:
232
src/BGS/ch/croctus.c
Normal file
232
src/BGS/ch/croctus.c
Normal file
@@ -0,0 +1,232 @@
|
||||
#include <ultra64.h>
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
|
||||
extern void func_80328748(ActorAnimCtrl *, f32, f32);
|
||||
extern void func_8028F94C(s32, f32[3]);
|
||||
extern void func_80324CFC(f32, enum comusic_e, s32);
|
||||
extern void func_803289EC(Actor *, f32, s32);
|
||||
extern void func_80326310(Actor *);
|
||||
extern void actor_setOpacity(Actor *, s32);
|
||||
extern void func_802C3D3C(void (*)(s32, s32), s32, s32);
|
||||
extern void func_802BAFE4(s32 arg0);
|
||||
|
||||
|
||||
|
||||
void func_80387D18(ActorMarker *, u32);
|
||||
Actor *func_8038860C(ActorMarker *, Gfx**, Mtx **, Vtx**);
|
||||
void func_80387FD4(Actor *this);
|
||||
|
||||
/* .data */
|
||||
s16 D_803907B0[4] = {0x15, 0x16, 0x17, 0x18};
|
||||
ActorMarker *bgs_D_803907B8[5] = {NULL};
|
||||
ActorAnimationInfo D_803907CC[] = {
|
||||
{0x000, 0.0f},
|
||||
{0x14B, 3.3e+7f},
|
||||
{0x14B, 1.4f},
|
||||
{0x14B, 3.3e+7f},
|
||||
{0x14B, 1.4f},
|
||||
{0x14B, 2.0f},
|
||||
{0x14B, 2.0f}
|
||||
};
|
||||
ActorInfo D_80390804 ={MARKER_FC_CROCTUS, ACTOR_1FA_CROCTUS, ASSET_425_MODEL_CROCTUS,
|
||||
1, D_803907CC,
|
||||
func_80387FD4, func_80326224, func_8038860C,
|
||||
0, 0, 0.0f, 0
|
||||
};
|
||||
|
||||
/* .code */
|
||||
void func_80387C90(Actor *arg0){
|
||||
animctrl_setDuration(arg0->animctrl, 0.4 + 0.9999999999999999 * ((f32)(5 - arg0->unkF4_8) * 0.25));
|
||||
}
|
||||
|
||||
void func_80387D18(ActorMarker * arg0, u32 arg1){
|
||||
Actor* this;
|
||||
Actor* nextActPtr;
|
||||
|
||||
this = marker_getActor(arg0);
|
||||
nextActPtr = spawn_child_actor(0x6A, &this);
|
||||
nextActPtr->state = 2;
|
||||
nextActPtr->unkF4_8 = 0x8C;
|
||||
nextActPtr->unk60 = 3.0f;
|
||||
nextActPtr->unk38_31 = arg1;
|
||||
if(arg0);
|
||||
}
|
||||
|
||||
void *func_80387D90(ActorMarker * arg0){
|
||||
ActorMarker *marker;
|
||||
Actor* this;
|
||||
f32 spawnPos[3];
|
||||
|
||||
marker = reinterpret_cast(ActorMarker *, arg0);
|
||||
this = marker_getActor(marker);
|
||||
spawnPos[0] = this->position_x;
|
||||
spawnPos[1] = this->position_y;
|
||||
spawnPos[2] = this->position_z;
|
||||
marker->propPtr->unk8_3 = 0;
|
||||
func_802BAFE4(0x19);
|
||||
jiggySpawn(JIGGY_22_CROCTUS, spawnPos);
|
||||
func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7FFF);
|
||||
}
|
||||
|
||||
void func_80387E00(s32 arg0){
|
||||
ActorMarker *marker = reinterpret_cast(ActorMarker *, arg0);
|
||||
Actor * this = marker_getActor(marker);
|
||||
|
||||
func_803262E4(this);
|
||||
func_802C3D3C(func_80387D18, reinterpret_cast(s32, marker), 0x1E);
|
||||
}
|
||||
|
||||
void func_80387E40(ActorMarker * arg0){
|
||||
Actor *thisActor = marker_getActor(arg0);
|
||||
func_80326310(thisActor);
|
||||
if(arg0);
|
||||
}
|
||||
|
||||
void func_80387E68(ActorMarker *caller, enum asset_e text_id, s32 arg2){
|
||||
Actor *this;
|
||||
|
||||
if(text_id == 0xC86){
|
||||
this = marker_getActor(caller);
|
||||
timed_playSfx(0.4f, SFX_C9_PAUSEMENU_ENTER, 1.0f, 32000);
|
||||
timed_playSfx(1.4f, SFX_C9_PAUSEMENU_ENTER, 1.0f, 32000);
|
||||
func_80324CFC(0.4f, COMUSIC_43_ENTER_LEVEL_GLITTER, 22000);
|
||||
func_80324D2C(4.5f, COMUSIC_43_ENTER_LEVEL_GLITTER);
|
||||
func_80328B8C(this, 5, 0.79f, 1);
|
||||
func_80326310(this);
|
||||
bgs_D_803907B8[this->unkF4_8]->propPtr->unk8_4 = TRUE;
|
||||
timedFunc_set_1(1.1f, func_80387E00, bgs_D_803907B8[this->unkF4_8]);
|
||||
timed_setCameraToNode(0.8f, 9);
|
||||
func_80324DBC(3.4f, 0xC87, 0xE, NULL, NULL, func_80387E68, NULL);
|
||||
func_802C3D3C(&func_80387D18, this->marker, 0x46);
|
||||
}
|
||||
else{
|
||||
func_80324E88(0.0f);
|
||||
func_8028F918(0);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80387FD4(Actor *this){
|
||||
int j;
|
||||
|
||||
if(!this->unk16C_4){
|
||||
if(jiggyscore_isCollected(JIGGY_22_CROCTUS)){
|
||||
marker_despawn(this->marker);
|
||||
return;
|
||||
}
|
||||
this->unk16C_4 = TRUE;
|
||||
if(bgs_D_803907B8[this->unkF4_8 - 1] == 0){
|
||||
bgs_D_803907B8[this->unkF4_8 - 1] = this->marker;
|
||||
for(j = this->unkF4_8; j < 6; j++){
|
||||
if(bgs_D_803907B8[j] != NULL){
|
||||
bgs_D_803907B8[j]->propPtr->unk8_4 = FALSE;
|
||||
actor_setOpacity(marker_getActor(bgs_D_803907B8[j]), 0);
|
||||
}
|
||||
}//L803880C8
|
||||
|
||||
for( j = this->unkF4_8 - 2; j >= 0 && bgs_D_803907B8[j] == NULL; j--);
|
||||
|
||||
|
||||
if(j >= 0){
|
||||
this->marker->propPtr->unk8_4 = FALSE;
|
||||
actor_setOpacity(this, 0);
|
||||
}
|
||||
this->marker->propPtr->unk8_3 = TRUE;
|
||||
}//L80388144
|
||||
func_803289EC(this, 0.0f, 1);
|
||||
this->unk60 = 0.0f;
|
||||
return;
|
||||
}//L80388160
|
||||
|
||||
if(this->unk38_31){
|
||||
if ((this->state != 5) && (this->state != 6)) {
|
||||
func_8025A6EC(COMUSIC_2B_DING_B, 28000); //TODO ISSUE HERE
|
||||
if (this->unkF4_8 == 1) {
|
||||
func_8028F94C(2, this->position);
|
||||
func_80311480(0xC86, 0xE, this->position, this->marker, func_80387E68, NULL);
|
||||
func_80328B8C(this, 6, 0.79f, 1);
|
||||
} else {
|
||||
timed_playSfx(0.4f, SFX_C9_PAUSEMENU_ENTER, 1.0f, 32000); //0.4f
|
||||
timed_playSfx(1.4f, SFX_C9_PAUSEMENU_ENTER, 1.0f, 32000); //1.4f
|
||||
func_80324CFC(0.4f, COMUSIC_43_ENTER_LEVEL_GLITTER, 22000);
|
||||
func_80324D2C(4.5f, COMUSIC_43_ENTER_LEVEL_GLITTER);
|
||||
func_80328B8C(this, 5, 0.79f, 1);
|
||||
if (this->unkF4_8 == 5) {
|
||||
timedFunc_set_1(0.9f, (TFQM1) func_80387E40, (s32) this->marker);
|
||||
} else {
|
||||
func_80326310(this);
|
||||
}
|
||||
if (this->unkF4_8 < 5) {
|
||||
bgs_D_803907B8[this->unkF4_8]->propPtr->unk8_4 = TRUE;
|
||||
timedFunc_set_1(1.1f, (TFQM1)func_80387E00, bgs_D_803907B8[this->unkF4_8]);
|
||||
func_802BAFE4(D_803907B0[this->unkF4_8-1]);
|
||||
} else {
|
||||
timedFunc_set_1(0.8f, (TFQM1)func_80387D90, (s32) this->marker);
|
||||
}
|
||||
func_802C3D3C(&func_80387D18, this->marker, 0x46);
|
||||
}
|
||||
}
|
||||
}//L80388348
|
||||
|
||||
switch(this->state){
|
||||
case 1:// L80388370
|
||||
this->unk60 += time_getDelta();
|
||||
if(0.7 <= this->unk60){
|
||||
func_80328B8C(this, 2, 0.0f, 1);
|
||||
func_80387C90(this);
|
||||
this->unk60 = 0.0f;
|
||||
func_80324D54(0.1f, SFX_D0_GRIMLET_SQUEAK, 1.0f, 0x7530, this->position, 0.0f, 1800.0f);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:// L80388400
|
||||
if(actor_animationIsAt(this, 0.62f)){
|
||||
func_80328B8C(this, 3, 0.62f, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:// L80388434
|
||||
this->unk60 += time_getDelta();
|
||||
if( this->unk60 >= 0.13 + 0.7/4 * (5 - this->unkF4_8)){
|
||||
func_80328B8C(this, 4, 0.62f, 1);
|
||||
func_80387C90(this);
|
||||
this->unk60 = 0.0f;
|
||||
func_80324D54(0.3f, 0x406, 1.0f, 0x55f0, this->position, 0.0f, 1800.0f);
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:// L8038850C
|
||||
if(actor_animationIsAt(this, 0.0f)){
|
||||
func_80328B8C(this, 1, 0.0f, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 5:// L80388538
|
||||
func_80328748(this->animctrl, 0.79f, 0.97f);
|
||||
if( actor_animationIsAt(this, 0.84f)
|
||||
&& !animctrl_isPlayedForwards(this->animctrl)
|
||||
&& func_802BB270()
|
||||
){
|
||||
func_8030E6A4(SFX_C8_CRUNCH, randf2(0.93f, 1.07f), 22000);
|
||||
}
|
||||
break;
|
||||
|
||||
case 6:// L803885B0
|
||||
func_80328748(this->animctrl, 0.79f, 0.97f);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void bgs_func_803885DC(void){
|
||||
s32 i;
|
||||
for(i = 0; i<5; i++)
|
||||
bgs_D_803907B8[i] = 0;
|
||||
}
|
||||
|
||||
Actor *func_8038860C(ActorMarker *this, Gfx** gdl, Mtx ** mptr, Vtx **vtx){
|
||||
Actor *thisActor;
|
||||
thisActor = marker_getActor(this);
|
||||
func_8033A45C(1, thisActor->unkF4_8);
|
||||
return func_80325888(this, gdl, mptr, vtx);
|
||||
}
|
452
src/BGS/ch/flibbit.c
Normal file
452
src/BGS/ch/flibbit.c
Normal file
@@ -0,0 +1,452 @@
|
||||
#include <ultra64.h>
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
|
||||
typedef struct{
|
||||
u8 unk0;
|
||||
u8 unk1;
|
||||
s16 unk2[3];
|
||||
s16 unk8[3];
|
||||
s16 unkE[3];
|
||||
f32 unk14;
|
||||
f32 unk18;
|
||||
f32 unk1C[2];
|
||||
// f32 unk20;
|
||||
f32 unk24;
|
||||
}ActorLocal_Flibbit;
|
||||
|
||||
|
||||
extern f32 func_80309724(f32 *);
|
||||
extern void func_80256E24(f32 [3], f32, f32, f32, f32, f32);
|
||||
|
||||
void chflibbit_update(Actor *this);
|
||||
Actor *chflibbit_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
|
||||
|
||||
/* .data */
|
||||
ActorInfo D_80390690 = {
|
||||
0xC1, 0x133, 0x375,
|
||||
0, NULL,
|
||||
chflibbit_update, NULL, chflibbit_draw,
|
||||
0, 0, 1.0f, 0
|
||||
};
|
||||
|
||||
f32 D_803906B4[3] = {0.0f, 0.0f, 0.0f};
|
||||
|
||||
/* .code */
|
||||
bool func_803863F0(Actor *this, f32 arg1[3], s32 arg2){
|
||||
|
||||
ActorLocal_Flibbit *local = (ActorLocal_Flibbit *)&this->local;
|
||||
|
||||
local->unk1 = arg2;
|
||||
|
||||
local->unk2[0] = this->position[0];\
|
||||
local->unk2[1] = this->position[1];\
|
||||
local->unk2[2] = this->position[2];
|
||||
local->unk8[0] = arg1[0];
|
||||
local->unk8[1] = arg1[1];
|
||||
local->unk8[2] = arg1[2];
|
||||
|
||||
local->unk8[1] = func_80309724(arg1);
|
||||
func_80335924(this->unk148, 0xdb, 0.2f,(arg2) ? randf2(0.7f, 0.8f) : randf2(0.75f, 0.85f));
|
||||
func_80335A8C(this->unk148, 2);
|
||||
func_80324D54(0.2f, 0x3f2, randf2(0.7f, 1.3f), randi2(0x61A8, 0x6978), this->position, 500.0f, 2500.0f);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool func_80386564(Actor *this){
|
||||
f32 plyrPos[3]; //sp54
|
||||
f32 sp48;
|
||||
f32 sp44;
|
||||
f32 sp40;
|
||||
f32 sp3C[3]; //sp3C
|
||||
f32 sp30[3]; //sp30
|
||||
|
||||
player_getPosition(plyrPos);
|
||||
func_80258A4C(this->position, this->yaw - 90.0f, plyrPos, &sp48, &sp44, &sp40);
|
||||
if(func_80329210(this, plyrPos)){
|
||||
if((-0.7 <= sp40) && (sp40 <= 0.7)){
|
||||
sp3C[0] = plyrPos[0] - this->position_x;
|
||||
sp3C[1] = plyrPos[1] - this->position_y;
|
||||
sp3C[2] = plyrPos[2] - this->position_z;
|
||||
ml_vec3f_set_length(sp3C,180.0f);
|
||||
sp30[0] = sp3C[0] + this->position_x;
|
||||
sp30[1] = sp3C[1] + this->position_y;
|
||||
sp30[2] = sp3C[2] + this->position_z;
|
||||
if(func_80329210(this, sp30))
|
||||
return func_803863F0(this, sp30, 1);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
s32 func_803866A4(Actor *this) {
|
||||
f32 sp64[3];
|
||||
f32 sp60;
|
||||
f32 sp5C;
|
||||
f32 sp58;
|
||||
f32 sp4C[3];
|
||||
ActorLocal_Flibbit *local = (ActorLocal_Flibbit *)&this->local;
|
||||
f32 sp3C[3];
|
||||
|
||||
|
||||
sp64[0] = (f32) local->unkE[0];
|
||||
sp64[1] = (f32) local->unkE[1];
|
||||
sp64[2] = (f32) local->unkE[2];
|
||||
func_80258A4C(this->position, this->yaw - 90.0f, sp64, &sp60, &sp5C, &sp58);
|
||||
if ((-0.9 <= sp58) && (sp58 <= 0.9)) {
|
||||
if ((f64) sp60 > 216.0) {
|
||||
sp4C[0] = sp64[0] - this->position[0];
|
||||
sp4C[1] = sp64[1] - this->position[1];
|
||||
sp4C[2] = sp64[2] - this->position[2];
|
||||
ml_vec3f_set_length(sp4C, 180.0f);
|
||||
sp3C[0] = this->position[0] + sp4C[0];
|
||||
sp3C[1] = this->position[1] + sp4C[1];
|
||||
sp3C[2] = this->position[2] + sp4C[2];
|
||||
} else {
|
||||
sp3C[0] = (f32) local->unkE[0];
|
||||
sp3C[1] = (f32) local->unkE[1];
|
||||
sp3C[2] = (f32) local->unkE[2];
|
||||
}
|
||||
if (func_80329210(this, sp3C) != 0) {
|
||||
return func_803863F0(this, sp3C, 0);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool func_8038686C(Actor *this) {
|
||||
f32 sp84[3];
|
||||
f32 sp80;
|
||||
f32 sp7C;
|
||||
f32 sp78;
|
||||
f32 *temp_s2;
|
||||
f32 sp68[3];
|
||||
f32 phi_f2;
|
||||
int i;
|
||||
|
||||
player_getPosition(sp84);
|
||||
func_80258A4C(this->position, this->yaw - 90.0f, sp84, &sp80, &sp7C, &sp78);
|
||||
for(i = 0; i < 0xA; i++){
|
||||
if (i < 5) {
|
||||
if (sp78 > 0.0f) {
|
||||
phi_f2 = randf2(10.0f, 90.0f) + this->yaw;
|
||||
} else {
|
||||
phi_f2 = randf2(-90.0f, -10.0f) + this->yaw;
|
||||
}
|
||||
} else {
|
||||
phi_f2 = randf2(-110.0f, 110.0f) + this->yaw;
|
||||
}
|
||||
func_80256E24(sp68, 0.0f, phi_f2, 0.0f, 0.0f, 180.0f);
|
||||
sp68[0] += this->position[0];
|
||||
sp68[1] += this->position[1];
|
||||
sp68[2] += this->position[2];
|
||||
if (func_80329210(this, sp68)) {
|
||||
return func_803863F0(this, sp68, 0);
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
bool func_80386A34(Actor * this){
|
||||
f32 plyrPos[3];
|
||||
bool out;
|
||||
|
||||
if(func_803203FC(0xC1))
|
||||
return 0;
|
||||
|
||||
player_getPosition(plyrPos);
|
||||
if(func_80329210(this, plyrPos)){
|
||||
if(!(out = func_80386564(this)) && (0.5 < randf ())){
|
||||
return 0;
|
||||
}
|
||||
}else{
|
||||
out = func_803866A4(this);
|
||||
}
|
||||
|
||||
if(!out)
|
||||
out = func_8038686C(this);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
void func_80386AEC(Actor *this, s32 next_state) {
|
||||
ActorLocal_Flibbit *local;
|
||||
|
||||
local = (ActorLocal_Flibbit *) &this->local;
|
||||
local->unk1 = FALSE;
|
||||
local->unk18 = 0.0f;
|
||||
local->unk24 = 0.0f;
|
||||
|
||||
if (next_state == 1) {
|
||||
func_80335924(this->unk148, ASSET_FA_ANIM_FLIBBIT_IDLE, 0.2f, randf2(1.0f, 2.0f));
|
||||
func_80335A74(this->unk148, randf2(0.0f, 0.9f));
|
||||
func_80335A8C(this->unk148, 1);
|
||||
this->position[0] = (f32) local->unkE[0];
|
||||
this->position[1] = (f32) local->unkE[1];
|
||||
this->position[2] = (f32) local->unkE[2];
|
||||
local->unk24 = randf2(1.0f, 3.0f);
|
||||
}
|
||||
|
||||
if (next_state == 2){
|
||||
if(!func_80386A34(this)) {
|
||||
if (this->state != 3) {
|
||||
next_state = 3;
|
||||
func_80386AEC(this, next_state);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (next_state == 3) {
|
||||
func_80335924(this->unk148, ASSET_FB_ANIM_FLIBBIT_TURN, 0.2f, 1.0f);
|
||||
func_80335A74(this->unk148, randf2(0.0f, 1.0f));
|
||||
func_80335A8C(this->unk148, 1);
|
||||
local->unk24 = randf2(1.0f, 3.0f);
|
||||
}
|
||||
|
||||
if (next_state == 4) {
|
||||
func_80335924(this->unk148, ASSET_FA_ANIM_FLIBBIT_IDLE, 0.2f, randf2(1.0f, 2.0f));
|
||||
func_80335A74(this->unk148, randf2(0.0f, 0.9f));
|
||||
func_80335A8C(this->unk148, 1);
|
||||
this->position[1] = func_80309724(this->position);
|
||||
local->unk18 = 1.0f;
|
||||
}
|
||||
|
||||
if (next_state == 5) {
|
||||
FUNC_8030E8B4(SFX_8E_GRUNTLING_DAMAGE, 1.5f, 32200, this->position, 500, 2500);
|
||||
func_80335924(this->unk148, ASSET_288_ANIM_FLIBBIT_OW, 0.1f, 0.65f);
|
||||
func_80335A8C(this->unk148, 2);
|
||||
this->position[1] = func_80309724(this->position);
|
||||
local->unk18 = 1.0f;
|
||||
}
|
||||
|
||||
if (next_state == 6) {
|
||||
func_80335924(this->unk148, ASSET_112_ANIM_FLIBBIT_DIE, 0.2f, 0.4f);
|
||||
FUNC_8030E8B4(SFX_115_BUZZBOMB_DEATH, 1.0f, 32200, this->position, 500, 2500);
|
||||
this->marker->collidable = FALSE;
|
||||
this->unk10_1 = FALSE;
|
||||
local->unk14 = 1000.0f;
|
||||
}
|
||||
if (next_state == 7) {
|
||||
func_80335924(this->unk148, ASSET_113_ANIM_FLIBBIT_DEAD, 0.2f, 1.0f);
|
||||
func_80335A8C(this->unk148, 2);
|
||||
FUNC_8030E8B4(SFX_2F_ORANGE_SPLAT, 0.8f, 32200, this->position, 500, 2500);
|
||||
}
|
||||
if (next_state == 8) {
|
||||
func_80326310(this);
|
||||
}
|
||||
this->state = next_state;
|
||||
|
||||
}
|
||||
|
||||
void func_80386E30(ActorMarker *this, ActorMarker *other){
|
||||
Actor *thisActor = marker_getActor(this);
|
||||
if(thisActor->state < 6){
|
||||
func_80386AEC(thisActor, 4);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80386E70(ActorMarker *this, ActorMarker *other){
|
||||
Actor *thisActor = marker_getActor(this);
|
||||
if(thisActor->state < 6){
|
||||
func_80386AEC(thisActor, 5);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80386EB0(ActorMarker *this, ActorMarker *other){
|
||||
Actor *thisActor = marker_getActor(this);
|
||||
if(thisActor->state < 6){
|
||||
func_80386AEC(thisActor, 6);
|
||||
}
|
||||
}
|
||||
|
||||
Actor *chflibbit_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
|
||||
Actor *this;
|
||||
ActorLocal_Flibbit *local;
|
||||
s32 temp_a0;
|
||||
int i;
|
||||
f32 sp7C[3];
|
||||
f32 phi_f2;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
local = (ActorLocal_Flibbit *)&this->local;
|
||||
if (local->unk0){
|
||||
if(((this->state == 1)) || (this->state == 3)) {
|
||||
temp_a0 = func_803356A0(this->unk148);
|
||||
for(i = 0; i < 2; i++){
|
||||
|
||||
if (0.1 <= local->unk1C[i]) {
|
||||
phi_f2 = (f32) ((local->unk1C[i] - 0.1) / 0.1);
|
||||
} else if (local->unk1C[i] >= 0.0f) {
|
||||
phi_f2 = (f32) (1.0 - (local->unk1C[i] / 0.1));
|
||||
} else {
|
||||
phi_f2 = 1.0f;
|
||||
}
|
||||
sp7C[0] = 1.0f;
|
||||
// sp7C[1] = 1.0f;
|
||||
sp7C[2] = 1.0f;
|
||||
sp7C[1] = (f32) (((f64) phi_f2 * 0.99) + 0.01);
|
||||
|
||||
func_8033A928(temp_a0, (i != 0)?0x2D :0x2E, sp7C);
|
||||
}
|
||||
}
|
||||
}
|
||||
func_80325888(marker, gfx, mtx, vtx);
|
||||
local->unk0 = marker->unk14_21;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
void chflibbit_update(Actor *this){
|
||||
f32 player_position[3];
|
||||
f32 spB0[3];
|
||||
f32 player_distance;
|
||||
ActorLocal_Flibbit *local = (ActorLocal_Flibbit *)&this->local;
|
||||
f32 spA4 = time_getDelta();
|
||||
f32 spA0;
|
||||
f32 sp9C;
|
||||
f32 sp98;
|
||||
f32 sp94;
|
||||
f32 sp90;
|
||||
f32 sp84[3];
|
||||
f32 temp_f12;
|
||||
f32 sp7C;
|
||||
f32 sp78;
|
||||
f32 sp74;
|
||||
f32 sp68[3];
|
||||
f32 phi_f2;
|
||||
f32 sp60;
|
||||
f32 sp5C;
|
||||
f32 sp58;
|
||||
f32 sp4C[3];
|
||||
|
||||
if(!this->unk16C_4){
|
||||
this->unk16C_4 = TRUE;
|
||||
marker_setCollisionScripts(this->marker, func_80386E30, func_80386E70, func_80386EB0);
|
||||
local->unk1C[0] = randf2(-2.0f, -1.0f);
|
||||
local->unk1C[1] = randf2(-2.0f, -1.0f);
|
||||
|
||||
local->unkE[0] = (s16) this->position_x;
|
||||
local->unkE[1] = (s16) this->position_y;
|
||||
local->unkE[2] = (s16) this->position_z;
|
||||
|
||||
local->unkE[1] = func_80309724(this->position);
|
||||
func_80386AEC(this, 1);
|
||||
}
|
||||
player_getPosition(player_position);
|
||||
|
||||
spB0[0] = player_position[0] - this->position[0];
|
||||
spB0[1] = player_position[1] - this->position[1];
|
||||
spB0[2] = player_position[2] - this->position[2];
|
||||
player_distance = gu_sqrtf(spB0[0]*spB0[0] + spB0[1]*spB0[1] + spB0[2]*spB0[2]);
|
||||
|
||||
if(func_8025773C(&local->unk24, spA4)){
|
||||
func_8030E878(0x3f0, randf2(0.9f, 1.1f), randi2(12000, 19000), this->position, 500.0f, 2500.0f);
|
||||
local->unk24 = randf2(1.0f, 6.0f);
|
||||
}//L80387274
|
||||
|
||||
local->unk1C[0] += spA4;
|
||||
local->unk1C[0] = (0.2 < local->unk1C[0]) ? randf2(-3.0f, -1.0f) : local->unk1C[0];
|
||||
|
||||
local->unk1C[1] += spA4;
|
||||
local->unk1C[1] = (0.2 < local->unk1C[1]) ? randf2(-3.0f, -1.0f) : local->unk1C[1];
|
||||
|
||||
if(this->state == 1){
|
||||
if(func_80329210(this, player_position)){
|
||||
func_80386AEC(this, 2);
|
||||
return;
|
||||
}
|
||||
|
||||
if(player_distance < 2000.0f){
|
||||
func_80258A4C(this->position, this->yaw - 90.0f, player_position, &spA0, &sp9C, &sp98);
|
||||
this->yaw += (sp98*90.0f) *spA4;
|
||||
}
|
||||
}//L803873D0
|
||||
|
||||
if(this->state == 2){
|
||||
func_8033568C(this->unk148, &sp94, &sp90);
|
||||
if(sp94 < 0.8 && 0.8 <= sp90){
|
||||
func_8030E878(SFX_8_BANJO_LANDING_04, randf2(0.8f, 0.9f), randi2(25000, 27000), this->position, 100.0f, 1500.0f);
|
||||
}//L8038747C
|
||||
if(func_80335794(this->unk148) > 0){
|
||||
sp84[0] = (f32)local->unkE[0];
|
||||
sp84[1] = (f32)local->unkE[1];
|
||||
sp84[2] = (f32)local->unkE[2];
|
||||
if(ml_vec3f_distance(this->position, sp84) < 30.0f){
|
||||
func_80386AEC(this, 1);
|
||||
}
|
||||
else{
|
||||
func_80386AEC(this, 2);
|
||||
|
||||
}
|
||||
}
|
||||
else{//L80387514
|
||||
if(0.2 <= sp90 && sp90 <= 0.8){
|
||||
temp_f12 = ((sp90 - 0.2) / 0.60000000000000009);
|
||||
this->position_x = local->unk2[0] + (local->unk8[0] - local->unk2[0])*temp_f12;
|
||||
this->position_y = local->unk2[1] + (local->unk8[1] - local->unk2[1])*temp_f12;
|
||||
this->position_z = local->unk2[2] + (local->unk8[2] - local->unk2[2])*temp_f12;
|
||||
if(local->unk1){
|
||||
if(sp90 <= 0.5){
|
||||
phi_f2 = ((sp90 - 0.2)/0.3) * 70.0;
|
||||
}
|
||||
else{
|
||||
phi_f2 = (1.0 - (sp90 - 0.5)/ 0.30000000000000004) *70.0;
|
||||
}
|
||||
this->position_y += phi_f2;
|
||||
}//L80387684
|
||||
sp68[0] = (f32)(local->unk8[0] - local->unk2[0]);
|
||||
sp68[1] = (f32)(local->unk8[1] - local->unk2[1]);
|
||||
sp68[2] = (f32)(local->unk8[2] - local->unk2[2]);
|
||||
func_80258A4C(D_803906B4, this->yaw - 90.0f, sp68, &sp7C, &sp78, &sp74);
|
||||
this->yaw += (sp74 * 220.0f * spA4);
|
||||
|
||||
}
|
||||
}
|
||||
}//L80387734
|
||||
|
||||
if (this->state == 3) {
|
||||
func_80258A4C(this->position, this->yaw - 90.0f, player_position, &sp60, &sp5C, &sp58);
|
||||
this->yaw += sp58 * 90.0f * spA4;
|
||||
if ((-0.4 <= sp58) && (sp58 <= 0.4) && ((f64) randf() > 0.5)) {
|
||||
func_80386AEC(this, 2);
|
||||
}
|
||||
if ((sp5C < 0.0f) && (randf() > 0.5)) {
|
||||
func_80386AEC(this, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(this->state == 4 || this->state == 5){
|
||||
if(func_8025773C(&local->unk18, spA4)){
|
||||
func_80386AEC(this, 3);
|
||||
}
|
||||
}
|
||||
|
||||
if(this->state == 6){
|
||||
sp4C[0] = this->position[0] - player_position[0];
|
||||
sp4C[1] = this->position[1] - player_position[1];
|
||||
sp4C[2] = this->position[2] - player_position[2];
|
||||
sp4C[1] = 0.0f;
|
||||
ml_vec3f_set_length(sp4C, 400.0f * spA4);
|
||||
|
||||
this->position[0] = this->position[0] + sp4C[0];
|
||||
this->position[1] = this->position[1] + sp4C[1];
|
||||
this->position[2] = this->position[2] + sp4C[2];
|
||||
|
||||
this->position_y += local->unk14*spA4;
|
||||
local->unk14 -= 3000.0f*spA4;
|
||||
if(this->position_y < func_80309724(this->position)){
|
||||
this->position_y = func_80309724(this->position);
|
||||
func_80386AEC(this, 7);
|
||||
}
|
||||
}
|
||||
|
||||
if(this->state == 7){
|
||||
if(func_80335794(this->unk148) > 0)
|
||||
func_80386AEC(this, 8);
|
||||
}
|
||||
}
|
216
src/BGS/ch/leafboat.c
Normal file
216
src/BGS/ch/leafboat.c
Normal file
@@ -0,0 +1,216 @@
|
||||
#include <ultra64.h>
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
|
||||
typedef struct chleafboat_s{
|
||||
f32 unk0[3];
|
||||
f32 unkC[3];
|
||||
f32 unk18[3];
|
||||
f32 unk24[3];
|
||||
f32 unk30[3];
|
||||
f32 unk3C[3];
|
||||
f32 unk48[3];
|
||||
f32 unk54[3];
|
||||
f32 unk60[3];
|
||||
f32 unk6C;
|
||||
} ActorLocal_Leafboat;
|
||||
|
||||
void func_8038FD9C(Actor *this);
|
||||
Actor *func_8038FD10(ActorMarker *this, Gfx** gdl, Mtx** mtx, u32 arg3);
|
||||
|
||||
|
||||
/* .data section */
|
||||
u8 D_80390DA0[6] = {0, 0, 0, 1, 1, 1};
|
||||
|
||||
ActorInfo D_80390DA8 = {0xDA, actor_leafboat, 0x30D,
|
||||
0x01, NULL,
|
||||
func_8038FD9C, func_8038FD9C, func_8038FD10,
|
||||
0, 0, 0.0f, 0
|
||||
};
|
||||
|
||||
|
||||
/* .code section */
|
||||
Actor *func_8038FD10(ActorMarker *this, Gfx** gdl, Mtx** mtx, u32 arg3){
|
||||
Actor * thisActor;
|
||||
|
||||
thisActor = marker_getActor(this);
|
||||
if((thisActor->unk1C_x != 0.0f) && (0x80 < thisActor->alpha_124_19)){
|
||||
thisActor = func_80325888(this, gdl, mtx, arg3);
|
||||
}
|
||||
return thisActor;
|
||||
}
|
||||
|
||||
void func_8038FD88(ActorMarker *this, u32 arg1){
|
||||
this->unk3E_1 = 1;
|
||||
}
|
||||
|
||||
void func_8038FD9C(Actor *this){
|
||||
f32 sp64[3];
|
||||
f32 sp58[3];
|
||||
ActorLocal_Leafboat *local;
|
||||
u8 tmp[6] = D_80390DA0;
|
||||
f32 pad0;
|
||||
f32 sp44;
|
||||
f32 sp40;
|
||||
f32 sp3C;
|
||||
f32 sp38;
|
||||
|
||||
local = (ActorLocal_Leafboat *)&this->local;
|
||||
if(!this->initialized){
|
||||
this->initialized = TRUE;
|
||||
marker_setCollisionScripts(this->marker, func_8038FD88, NULL, NULL);
|
||||
local->unk6C = randf2(80.0f, 100.0f);
|
||||
this->unk1C[0] = this->unk1C[1] = this->unk1C[2] = 0.0f;
|
||||
local->unk0[0] = local->unk0[1] = local->unk0[2] = 0.0f;
|
||||
local->unkC[0] = local->unkC[1] = local->unkC[2] = 0.0f;
|
||||
local->unk18[0] = local->unk18[1] = local->unk18[2] = 0.0f;
|
||||
local->unk24[0] = local->unk24[1] = local->unk24[2] = 0.0f;
|
||||
local->unk30[0] = local->unk30[1] = local->unk30[2] = 0.0f;
|
||||
local->unk3C[0] = local->unk3C[1] = local->unk3C[2] = 0.0f;
|
||||
local->unk48[0] = local->unk48[1] = local->unk48[2] = 0.0f;
|
||||
local->unk54[0] = this->position_x;
|
||||
local->unk54[1] = this->position_y;
|
||||
local->unk54[2] = this->position_z;
|
||||
local->unk60[0] = this->pitch;
|
||||
local->unk60[1] = this->yaw;
|
||||
local->unk60[2] = this->roll;
|
||||
this->unk60 = 0.0f;
|
||||
this->velocity_x = 0.0f;
|
||||
this->unk10_12 = 0;
|
||||
}
|
||||
|
||||
this->position_x = local->unk54[0];
|
||||
this->position_y = local->unk54[1];
|
||||
this->position_z = local->unk54[2];
|
||||
this->pitch = local->unk60[0];
|
||||
this->yaw = local->unk60[1];
|
||||
this->roll = local->unk60[2];
|
||||
switch(this->state){
|
||||
case 1:
|
||||
if(this->marker->unk2C_2)
|
||||
func_80326224(this);
|
||||
this->marker->propPtr->unk8_3 = 1;
|
||||
this->unk1C[0] = 1.0f;
|
||||
this->alpha_124_19 = 0xff;
|
||||
if(this->unk54 != 0.0f){
|
||||
func_80328A84(this, 2);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if(this->marker->unk2C_2)
|
||||
func_80326224(this);
|
||||
|
||||
this->marker->propPtr->unk8_3 = 1;
|
||||
this->unk1C[0] = 1.0f;
|
||||
if(15.0f <= this->velocity_x){
|
||||
func_80328A84(this, 3);
|
||||
this->velocity_x = 0.0f;
|
||||
}
|
||||
else{
|
||||
if(!tmp[((s32)this->velocity_x)%6])
|
||||
this->alpha_124_19 -= 0x55;
|
||||
else
|
||||
this->alpha_124_19 += 0x55;
|
||||
this->velocity_x = this->velocity_x + 1.0f;
|
||||
}
|
||||
|
||||
break;
|
||||
case 3:
|
||||
if (this->marker->unk2C_2) {
|
||||
func_80326224(this);
|
||||
}
|
||||
this->marker->propPtr->unk8_3 = FALSE;
|
||||
this->unk1C[0] = 0.0f;
|
||||
this->alpha_124_19 = 0;
|
||||
if (this->unk54 == 0.0f) {
|
||||
func_80328A84(this, 4);
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
this->marker->propPtr->unk8_3 = 1;
|
||||
this->unk1C[0] = 1.0f;
|
||||
if (this->velocity[0] >= 15.0f) {
|
||||
func_80328A84(this, 1);
|
||||
this->velocity[0] = 0.0f;
|
||||
} else {
|
||||
if(tmp[5-(((s32)this->velocity_x)%6)]) {
|
||||
this->alpha_124_19 += 0x55;
|
||||
} else {
|
||||
this->alpha_124_19 -= 0x55;
|
||||
}
|
||||
this->velocity[0] += 1.0f;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
local->unk54[0] = this->position_x;
|
||||
local->unk54[1] = this->position_y;
|
||||
local->unk54[2] = this->position_z;
|
||||
local->unk60[0] = this->pitch;
|
||||
local->unk60[1] = this->yaw;
|
||||
local->unk60[2] = this->roll;
|
||||
this->unk60 += time_getDelta();
|
||||
_player_getPosition(&sp58);
|
||||
if( func_80294660() == 0x100
|
||||
&& func_8028F20C()
|
||||
&& this->marker->unk3E_1
|
||||
){
|
||||
sp44 = local->unk54[0] - sp58[0];
|
||||
sp40 = local->unk54[2] - sp58[2];
|
||||
sp3C = cosf((local->unk60[1] * M_PI) / 180.0);
|
||||
sp38 = sinf((local->unk60[1] * M_PI) / 180.0);
|
||||
local->unkC[0] = -((sp44 * sp38) + (sp40 * sp3C)) / 8;
|
||||
local->unkC[2] = ((sp44 * sp3C) - (sp40 * sp38)) / 8;
|
||||
if(this->unk10_12){
|
||||
if(local->unk24[1] < -20.0f){
|
||||
local->unk30[1] = -7.0f;
|
||||
}
|
||||
}
|
||||
else{
|
||||
local->unk30[1] = -32.0f;
|
||||
}
|
||||
this->unk10_12 = 1;
|
||||
} else {
|
||||
local->unkC[0] = local->unkC[1] = local->unkC[2] = 0.0f;
|
||||
if(!this->unk10_12){
|
||||
if(local->unk24[1] > 5.0f){
|
||||
local->unk30[1] = 0.0f;
|
||||
}
|
||||
}
|
||||
else{
|
||||
local->unk30[1] = 10.0f;
|
||||
}
|
||||
this->unk10_12 = 0;
|
||||
}
|
||||
this->marker->unk3E_1 = 0;
|
||||
|
||||
local->unk18[1] = 10 * sinf((((this->unk60 * local->unk6C) / 180.0) * RARE_PI));
|
||||
this->unk1C[0] = 4.5 * cosf((((this->unk60 * local->unk6C) / 180.0) * RARE_PI));
|
||||
this->unk1C[1] = 2*sinf((((this->unk60 * local->unk6C) / 180.0) * RARE_PI));
|
||||
sp64[0] = local->unk3C[0] + local->unk24[0];
|
||||
sp64[1] = local->unk3C[1] + local->unk24[1];
|
||||
sp64[2] = local->unk3C[2] + local->unk24[2];
|
||||
|
||||
sp64[0] = sp64[0] + local->unk18[0];
|
||||
sp64[1] = sp64[1] + local->unk18[1];
|
||||
sp64[2] = sp64[2] + local->unk18[2];
|
||||
|
||||
this->position[0] = this->position[0] + sp64[0];
|
||||
this->position[1] = this->position[1] + sp64[1];
|
||||
this->position[2] = this->position[2] + sp64[2];
|
||||
|
||||
local->unk0[2] += (local->unkC[2] - local->unk0[2]) * 0.075;
|
||||
local->unk0[0] += (local->unkC[0] - local->unk0[0]) * 0.075;
|
||||
local->unk24[1] += (local->unk30[1] - local->unk24[1]) * 0.2;
|
||||
sp64[0] = local->unk48[0] + this->unk1C[0];
|
||||
sp64[1] = local->unk48[1] + this->unk1C[1];
|
||||
sp64[2] = local->unk48[2] + this->unk1C[2];
|
||||
sp64[0] = sp64[0] + local->unk0[0];
|
||||
sp64[1] = sp64[1] + local->unk0[1];
|
||||
sp64[2] = sp64[2] + local->unk0[2];
|
||||
this->pitch += sp64[0];
|
||||
this->yaw += sp64[1];
|
||||
this->roll += sp64[2];
|
||||
}
|
453
src/BGS/ch/mrvile.c
Normal file
453
src/BGS/ch/mrvile.c
Normal file
@@ -0,0 +1,453 @@
|
||||
#include <ultra64.h>
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
|
||||
#include "prop.h"
|
||||
|
||||
void func_80335A24(void *, u32, f32, f32);
|
||||
void set_model_render_mode(u32);
|
||||
Actor *chvile_draw(ActorMarker*, Gfx **, Mtx **, Vtx **);
|
||||
void chvile_update(Actor *);
|
||||
void func_8038BB40(ActorMarker *);
|
||||
extern void func_80335A80(void *, f32);
|
||||
extern bool func_80320C94(f32[3], f32[3], f32, f32[3], s32, u32);
|
||||
|
||||
extern bool chvilegame_find_closest_piece(ActorMarker *, f32[3], f32, f32[3]);
|
||||
|
||||
typedef struct chmrvile_s{
|
||||
u8 unk0;
|
||||
// u8 pad1[0x3];
|
||||
BKModelBin *unk4; //yumblie_model
|
||||
ActorMarker *game_marker; //game_marker
|
||||
u8 unkC;
|
||||
// u8 padD[0x3];
|
||||
f32 unk10; //movement_speed
|
||||
f32 unk14; //yumblie_eating_timer
|
||||
f32 target_position[3]; //target_position
|
||||
f32 unk24;
|
||||
f32 unk28[3]; //target_rotation?
|
||||
} ActorLocal_MrVile;
|
||||
|
||||
/* .data */
|
||||
ActorInfo D_80390A70 = {0xC8, 0x13A, 0x373, 0x00, NULL,
|
||||
chvile_update, NULL, chvile_draw,
|
||||
0, 0, 0.0f, 0
|
||||
};
|
||||
|
||||
f32 D_80390A94[7] = {0.0f, 0.8f, 0.9f, 1.0f, 0.9f, 0.95f, 1.0f};
|
||||
|
||||
/* .code */
|
||||
void func_8038B9F0(f32 arg0[3], f32 arg1[3], f32 arg2, f32 arg3, s32 arg4) {
|
||||
f32 sp64[3];
|
||||
f32 pad60;
|
||||
f32 sp54[3];
|
||||
f32 pad50;
|
||||
f32 sp44[3];
|
||||
f32 sp38[3];
|
||||
f32 sp2C[3];
|
||||
f32 var_f0;
|
||||
|
||||
sp44[0] = arg0[0];
|
||||
sp44[1] = arg0[1] + arg2;
|
||||
sp44[2] = arg0[2];
|
||||
|
||||
sp38[0] = arg1[0];
|
||||
sp38[1] = arg1[1] + arg2;
|
||||
sp38[2] = arg1[2];
|
||||
|
||||
sp2C[0] = sp38[0];
|
||||
sp2C[1] = sp38[1];
|
||||
sp2C[2] = sp38[2];
|
||||
if (func_80320C94(sp44, sp38, arg3, sp54, 3, arg4)) {
|
||||
sp64[0] = sp38[0] - sp2C[0];
|
||||
sp64[1] = sp38[1] - sp2C[1];
|
||||
sp64[2] = sp38[2] - sp2C[2];
|
||||
var_f0 = sp54[0]*sp64[0] + sp54[1]*sp64[1] + sp54[2]*sp64[2];
|
||||
if (var_f0 < 1.0f) {
|
||||
var_f0 = 1.0f;
|
||||
}
|
||||
ml_vec3f_set_length(sp54, var_f0);
|
||||
arg1[0] = arg1[0] + sp54[0];
|
||||
arg1[1] = arg1[1] + sp54[1];
|
||||
arg1[2] = arg1[2] + sp54[2];
|
||||
}
|
||||
}
|
||||
|
||||
void func_8038BB40(ActorMarker * arg0){
|
||||
Actor *this;
|
||||
ActorLocal_MrVile *local;
|
||||
|
||||
this = marker_getActor(arg0);
|
||||
local = (ActorLocal_MrVile *)&this->local;
|
||||
if(func_8038A9E0(local->game_marker) >= 3){
|
||||
item_set(ITEM_14_HEALTH, 0);
|
||||
func_8028F66C(0xF);
|
||||
}
|
||||
else{
|
||||
item_dec(ITEM_14_HEALTH);
|
||||
func_8028F590(4, arg0);
|
||||
}
|
||||
}
|
||||
|
||||
void func_8038BBA0(Actor *this, s32 arg1){
|
||||
ActorLocal_MrVile *local;
|
||||
|
||||
local = (ActorLocal_MrVile *)&this->local;
|
||||
local->unk14 = 0.0f;
|
||||
if(arg1 == 101){
|
||||
local->unk24 = 0.0f;
|
||||
local->unk28[0] = local->unk28[1] = local->unk28[2] = 0.0f;
|
||||
func_80335924(this->unk148, 0xe1, 0.10000000149f, 1.0f); //0xe1 = croc_idle
|
||||
}
|
||||
if(arg1 == 102){
|
||||
if(local->unk24 < 100.0f){
|
||||
local->unk24 = 100.0f;
|
||||
};
|
||||
func_80335A24(this->unk148, 0xe0, 0.1f, 0.5f); //0xe1 = croc_walk
|
||||
}
|
||||
if(arg1 == 103){
|
||||
func_80335A24(this->unk148, 0x124, 0.1f, 0.5f); //0x124 = croc_munch
|
||||
if(this->state == 4){
|
||||
timed_playSfx(0.31f, SFX_4C_LIP_SMACK, 0.90f, 0x61A8);
|
||||
timedFunc_set_1(0.31f, func_8038BB40, this->marker);
|
||||
}
|
||||
else{
|
||||
timed_playSfx(0.31f, SFX_4C_LIP_SMACK, 0.90f, 0x61A8);
|
||||
timed_playSfx(0.81f, SFX_4C_LIP_SMACK, 0.93f, 0x61A8);
|
||||
timed_playSfx(1.31f, SFX_4C_LIP_SMACK, 0.91f, 0x61A8);
|
||||
}
|
||||
}
|
||||
if(arg1 == 104){
|
||||
local->unk14 = 1.0f;
|
||||
timed_playSfx(randf2(1.2f, 1.3f), SFX_97_BLUBBER_BURPS, randf2(0.8f, 1.1f), randi2(25000, 32000));
|
||||
}
|
||||
local->unkC = arg1;
|
||||
}
|
||||
|
||||
void func_8038BD84(Actor *this){
|
||||
ActorLocal_MrVile *local;
|
||||
|
||||
local = (ActorLocal_MrVile *)&this->local;
|
||||
local->unkC = 100;
|
||||
local->unk10 = 0.0f;
|
||||
local->unk14 = 0.0f;
|
||||
local->unk24 = 0.0f;
|
||||
local->target_position[0] = 0.0f;
|
||||
local->target_position[1] = 0.0f;
|
||||
local->target_position[2] = 0.0f;
|
||||
local->unk28[0] = 0.0f;
|
||||
local->unk28[1] = 0.0f;
|
||||
local->unk28[2] = 0.0f;
|
||||
func_8038BBA0(this, 101);
|
||||
}
|
||||
|
||||
void func_8038BDD4(Actor *this) {
|
||||
ActorLocal_MrVile *local;
|
||||
f32 sp60[3];
|
||||
f32 sp5C;
|
||||
f32 sp58;
|
||||
f32 sp54;
|
||||
f32 sp50;
|
||||
f32 sp44[3];
|
||||
f32 temp_f0_3;
|
||||
|
||||
local = (ActorLocal_MrVile *)&this->local;
|
||||
sp5C = time_getDelta();
|
||||
sp60[0] = this->position[0];
|
||||
sp60[1] = this->position[1];
|
||||
sp60[2] = this->position[2];
|
||||
func_8025773C(&local->unk14, sp5C);
|
||||
if ((local->unkC == 102) || (local->unkC == 103) || (local->unkC == 104)) {
|
||||
sp44[0] = 0.0f;
|
||||
sp44[1] = 0.0f;
|
||||
sp44[2] = local->unk24 * sp5C;
|
||||
ml_vec3f_yaw_rotate_copy(sp44, sp44, this->yaw);
|
||||
this->position[0] = this->position[0] + sp44[0];
|
||||
this->position[1] = this->position[1] + sp44[1];
|
||||
this->position[2] = this->position[2] + sp44[2];
|
||||
this->pitch += local->unk28[0] * sp5C;
|
||||
this->yaw += local->unk28[1] * sp5C;
|
||||
this->roll += local->unk28[2] * sp5C;
|
||||
func_80258A4C(this->position, this->yaw - 90.0f, local->target_position, &sp58, &sp54, &sp50);
|
||||
if ((sp54 > 0.0f) && (sp58 > 200.0f)) {
|
||||
local->unk24 += 100.0f * sp5C;
|
||||
}
|
||||
if ((sp54 < 0.0f) && (sp58 > 100.0f)) {
|
||||
local->unk24 -= 100.0f * sp5C;
|
||||
}
|
||||
|
||||
local->unk24 = (local->unk24 < 10.0f) ? 10.0f
|
||||
: (local->unk10 < local->unk24) ? local->unk10
|
||||
: local->unk24;
|
||||
func_80335A80(this->unk148, (200.0f / local->unk24) * 0.5);
|
||||
local->unk28[1] = sp50 * 200.0f;
|
||||
temp_f0_3 = func_80309724(this->position);
|
||||
if (temp_f0_3 > 125.0f) {
|
||||
this->position[1] = 125.0f;
|
||||
} else if (temp_f0_3 > 80.0f) {
|
||||
this->position[1] = temp_f0_3;
|
||||
} else {
|
||||
this->position[1] = 0.0f;
|
||||
}
|
||||
}
|
||||
if (this->position[1] > 100.0f) {
|
||||
func_8038B9F0(&sp60, this->position, 90.0f, 70.0f, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void func_8038C0C8(Actor * this, s32 next_state){
|
||||
ActorLocal_MrVile *local;
|
||||
|
||||
local = (ActorLocal_MrVile *)&this->local;
|
||||
if(next_state == 1)
|
||||
func_8038BBA0(this, 101);
|
||||
|
||||
if(next_state == 2)
|
||||
func_8038BBA0(this, 101);
|
||||
|
||||
if(next_state == 3)
|
||||
func_8038BBA0(this, 102);
|
||||
|
||||
if(next_state == 4)
|
||||
func_8038BBA0(this, 102);
|
||||
|
||||
if(next_state == 5){
|
||||
local->target_position[0] = local->target_position[1] = local->target_position[2] = 0.0f;
|
||||
func_8038BBA0(this, 102);
|
||||
}
|
||||
|
||||
if(next_state == 6){
|
||||
local->target_position[0] = local->target_position[1] = local->target_position[2] = 0.0f;
|
||||
local->unk24 = 300.0f;
|
||||
func_8038BBA0(this, 102);
|
||||
}
|
||||
|
||||
this->state = next_state;
|
||||
}
|
||||
|
||||
Actor *chvile_draw(ActorMarker *marker, Gfx **gfx, Mtx** mtx, Vtx **vtx){
|
||||
Actor *this;
|
||||
ActorLocal_MrVile *local;
|
||||
f32 sp34[3];
|
||||
|
||||
|
||||
this = func_80325888(marker, gfx, mtx, vtx);
|
||||
local = (ActorLocal_MrVile *)&this->local;
|
||||
if (
|
||||
(local->unkC == 104) &&
|
||||
(local->unk14 > 0.0f)
|
||||
&& (this->marker->unk14_21)
|
||||
) {
|
||||
func_8034A174(func_80329934(), 5, &sp34);
|
||||
sp34[1] -= 30.0f;
|
||||
set_model_render_mode(1);
|
||||
func_803391A4(gfx, mtx, &sp34, 0, local->unk14, 0, local->unk4);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
//chvile_get_position
|
||||
f32 *func_8038C284(ActorMarker *marker){
|
||||
Actor *this;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
return this->position;
|
||||
}
|
||||
|
||||
bool func_8038C2A8(ActorMarker *marker) {
|
||||
f32 sp24[3];
|
||||
Actor *this;
|
||||
ActorLocal_MrVile *local;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
local = (ActorLocal_MrVile *)&this->local;
|
||||
player_getPosition(&sp24);
|
||||
if (this->state == 6) {
|
||||
return ml_vec3f_distance(this->position, &sp24) < 150.0f;
|
||||
}
|
||||
return local->unk0 == 1;
|
||||
}
|
||||
|
||||
|
||||
bool func_8038C338(ActorMarker *marker){
|
||||
Actor *this;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
return this->state == 1;
|
||||
}
|
||||
|
||||
void chvile_free(Actor *this){
|
||||
ActorLocal_MrVile *local;
|
||||
|
||||
local = (ActorLocal_MrVile *)&this->local;
|
||||
assetcache_release(local->unk4);
|
||||
|
||||
}
|
||||
|
||||
void func_8038C384(ActorMarker *marker){
|
||||
Actor *this;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
func_8038C0C8(this, 4);
|
||||
}
|
||||
|
||||
void func_8038C3B0(ActorMarker *marker){
|
||||
Actor *this;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
func_8038C0C8(this, 2);
|
||||
}
|
||||
|
||||
void func_8038C3DC(ActorMarker *marker){
|
||||
Actor *this;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
func_8038C0C8(this, 3);
|
||||
}
|
||||
|
||||
void func_8038C408(ActorMarker *marker){
|
||||
Actor *this;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
func_8038C0C8(this, 5);
|
||||
}
|
||||
|
||||
void func_8038C434(ActorMarker *marker){
|
||||
Actor *this;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
func_8038C0C8(this, 6);
|
||||
}
|
||||
|
||||
void func_8038C460(ActorMarker *arg0){
|
||||
func_8038C0C8(marker_getActor(arg0), 1);
|
||||
}
|
||||
|
||||
void chvile_update(Actor *this) {
|
||||
ActorLocal_MrVile *local;
|
||||
bool var_v1;
|
||||
f32 sp94;
|
||||
f32 sp90;
|
||||
f32 temp_a0;
|
||||
f32 temp_f0;
|
||||
f32 sp84;
|
||||
f32 sp80;
|
||||
f32 sp7C;
|
||||
s32 temp_v0;
|
||||
s32 i;
|
||||
f32 sp70;
|
||||
f32 sp6C;
|
||||
f32 sp68;
|
||||
f32 sp50;
|
||||
f32 sp58[3];
|
||||
|
||||
local = (ActorLocal_MrVile *)&this->local;
|
||||
if (!this->unk16C_4) {
|
||||
this->unk16C_4 = TRUE;
|
||||
this->marker->unk30 = chvile_free;
|
||||
local->unk0 = 0;
|
||||
local->unk4 = assetcache_get(0x3F6);
|
||||
local->game_marker = NULL;
|
||||
func_8038BD84(this);
|
||||
func_8038C0C8(this, 1);
|
||||
return;
|
||||
}
|
||||
if (local->game_marker == NULL) {
|
||||
local->game_marker = func_80326D68(this->position, 0x138, -1, &sp90)->marker;
|
||||
}
|
||||
player_getPosition(&sp94);
|
||||
sp90 = ml_vec3f_distance(this->position, &sp94);
|
||||
if (sp90 <= 300.0f) {
|
||||
local->unk0 = (local->unk0 == 0) ? 1 : 2;
|
||||
} else if (sp90 > 300.0f) {
|
||||
local->unk0 = 0U;
|
||||
}
|
||||
if (this->state == 2) {
|
||||
func_80258A4C(this->position, this->yaw - 90.0f, &sp94, &sp84, &sp80, &sp7C);
|
||||
if (((sp84 > 50.0f) && (0.05 < sp7C)) || (sp7C < -0.05)) {
|
||||
this->yaw += sp7C * 20.0f;
|
||||
} else {
|
||||
func_8038C0C8(this, 1);
|
||||
}
|
||||
}
|
||||
if (this->state == 3) {
|
||||
var_v1 = chvilegame_find_closest_piece(local->game_marker, this->position, this->yaw, local->target_position) && mapSpecificFlags_get(6);
|
||||
if (!var_v1) {
|
||||
local->target_position[0] = 0.0f;
|
||||
local->target_position[1] = 0.0f;
|
||||
local->target_position[2] = 0.0f;
|
||||
}
|
||||
if (local->game_marker != NULL) {
|
||||
temp_v0 = chvilegame_get_score_difference(local->game_marker);
|
||||
if (temp_v0 >= 2) {
|
||||
local->unk10 = 200.0f;
|
||||
} else if (temp_v0 >= 0) {
|
||||
local->unk10 = 310.0f;
|
||||
} else if (temp_v0 >= -2) {
|
||||
local->unk10 = 350.0f;
|
||||
} else {
|
||||
local->unk10 = 450.0f;
|
||||
}
|
||||
local->unk10 *= D_80390A94[func_8038A9E0(local->game_marker)];
|
||||
}
|
||||
if (func_8038A9E0(local->game_marker) < 7) {
|
||||
func_80258A4C(this->position, this->yaw - 90.0f, local->target_position, &sp70, &sp6C, &sp68);
|
||||
if (local->unkC == 102) {
|
||||
if ((-0.8 < sp68) && (sp68 < 0.8) && (sp70 <= 150.0f) && var_v1) {
|
||||
func_8038BBA0(this, 103);
|
||||
}
|
||||
}
|
||||
if (local->unkC == 103) {
|
||||
if (sp70 <= 50.0f) {
|
||||
if (chvilegame_cpu_consume_piece(local->game_marker, local->target_position)) {
|
||||
func_8038BBA0(this, 104);
|
||||
} else {
|
||||
func_8038BBA0(this, 102);
|
||||
}
|
||||
} else if (func_80335794(this->unk148) >= 3) {
|
||||
func_8038BBA0(this, 102);
|
||||
}
|
||||
}
|
||||
if ((local->unkC == 104) && (func_80335794(this->unk148) >= 3)) {
|
||||
func_8038BBA0(this, 102);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this->state == 4) {
|
||||
player_getPosition(local->target_position);
|
||||
local->unk10 = 500.0f;
|
||||
if ((local->unkC == 102) && (ml_vec3f_distance(this->position, local->target_position) < 200.0f)) {
|
||||
func_8038BBA0(this, 103);
|
||||
}
|
||||
if ((local->unkC == 103) && (func_80335794(this->unk148) >= 2)) {
|
||||
func_8038C0C8(this, 1);
|
||||
}
|
||||
}
|
||||
if (this->state == 5) {
|
||||
local->unk10 = 200.0f;
|
||||
if (ml_vec3f_distance(this->position, local->target_position) < 100.0f) {
|
||||
local->target_position[0] = randf2(-500.0f, 500.0f);
|
||||
local->target_position[1] = 0.0f;
|
||||
local->target_position[2] = randf2(-500.0f, 500.0f);
|
||||
}
|
||||
}
|
||||
if ((this->state == 6)){
|
||||
local->unk10 = 400.0f;
|
||||
if((ml_vec3f_distance(this->position, local->target_position) < 100.0f) || (ml_vec3f_distance(&sp94, local->target_position) < 300.0f)) {
|
||||
for(i = 0; i < 10; i++){
|
||||
sp58[0] = randf2(-500.0f, 500.0f);
|
||||
sp58[1] = 0.0f;
|
||||
sp58[2] = randf2(-500.0f, 500.0f);
|
||||
if ((i == 0) || (ml_vec3f_distance(&sp94, &sp58) > ml_vec3f_distance(&sp94, local->target_position))) {
|
||||
local->target_position[0] = sp58[0];
|
||||
local->target_position[1] = sp58[1];
|
||||
local->target_position[2] = sp58[2];
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
func_8038BDD4(this);
|
||||
if (this->state != 4) {
|
||||
func_8028E668(this->position, 100.0f, -50.0f, 120.0f);
|
||||
}
|
||||
}
|
199
src/BGS/ch/tanktup.c
Normal file
199
src/BGS/ch/tanktup.c
Normal file
@@ -0,0 +1,199 @@
|
||||
#include <ultra64.h>
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
|
||||
#include "prop.h"
|
||||
|
||||
void func_80324E88(f32);
|
||||
|
||||
void timedFunc_set_2(f32, void(*)(s32, s32), s32, s32);
|
||||
|
||||
void func_8028E668(f32[3], f32, f32, f32);
|
||||
extern void func_802C3E10(void(*arg0)(void), ActorMarker *, s32, s32);
|
||||
|
||||
void func_8038F6A4(Actor *);
|
||||
|
||||
/* .data */
|
||||
ActorAnimationInfo D_80390C20[] = {
|
||||
{0, 0.0f},
|
||||
{0x101, 7.5f},
|
||||
{0x102, 1.75f},
|
||||
{0x107, 1.75f}
|
||||
};
|
||||
|
||||
ActorInfo D_80390C40 = {0x6C, 0xE8, 0x3EE, 0x01, D_80390C20,
|
||||
func_8038F6A4, func_80326224, func_80325888,
|
||||
0, 0x80, 0.0f, 0
|
||||
};
|
||||
|
||||
/* .code */
|
||||
void func_8038F470(ActorMarker *this, s32 arg1, s32 arg2){
|
||||
Actor* thisActor;
|
||||
f32 pad;
|
||||
Actor* sp24;
|
||||
f32 sp18[3];
|
||||
|
||||
thisActor = marker_getActor(this);
|
||||
sp18[0] = thisActor->position_x;
|
||||
sp18[1] = thisActor->position_y;
|
||||
sp18[2] = thisActor->position_z;
|
||||
sp18[1] += 50.0f;
|
||||
|
||||
sp24 = func_8032813C(arg2 + 0xe9, sp18, (s32)thisActor->yaw);
|
||||
func_80328B8C(sp24, arg1 + 1, 0, -1);
|
||||
sp24->unk10_12 = arg2;
|
||||
}
|
||||
|
||||
void func_8038F51C(Actor *this){
|
||||
Actor * spawnPtr;
|
||||
spawnPtr = func_80326D68(this->position, 0xe8, -1, 0);
|
||||
spawnPtr->tanktup.unk0[this->unk10_12] = 1;
|
||||
spawnPtr->tanktup.unk10 = 1;
|
||||
}
|
||||
|
||||
s32 func_8038F570(s16 *arg0){
|
||||
f32 pos[3];
|
||||
Actor * spawnPtr;
|
||||
|
||||
pos[0] = (f32)arg0[0];
|
||||
pos[1] = (f32)arg0[1];
|
||||
pos[2] = (f32)arg0[2];
|
||||
spawnPtr = func_80326D68(pos, 0xe8, -1, 0);
|
||||
return spawnPtr->state == 3;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void func_8038F5E4(s32 arg0, s32 arg1, s32 arg2){
|
||||
func_80324E88(0.0f);
|
||||
}
|
||||
|
||||
void func_8038F610(Actor *this) {
|
||||
f32 sp24[3];
|
||||
|
||||
func_8034A174(this->marker->unk44, 8, &sp24);
|
||||
if (func_80258368(&sp24) != 0) {
|
||||
func_8028E668(&sp24, 200.0f, -600.0f, 300.0f);
|
||||
}
|
||||
func_8034A174(this->marker->unk44, 7, &sp24);
|
||||
if (func_80258368(&sp24) != 0) {
|
||||
func_8028E668(&sp24, 200.0f, -600.0f, 200.0f);
|
||||
}
|
||||
}
|
||||
|
||||
extern f32 D_803911B0;
|
||||
extern f32 D_803911B4;
|
||||
|
||||
void func_8028F94C(s32, f32[3]);
|
||||
void func_8028F918(s32);
|
||||
|
||||
#ifndef NONMATCHING
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/BGS/ch/tanktup/func_8038F6A4.s")
|
||||
#else
|
||||
void func_8038F6A4(Actor *this) {
|
||||
f32 sp48[3];
|
||||
s32 sp44;
|
||||
f32 sp34[3];
|
||||
Prop *temp_v0;
|
||||
ActorLocal_TanktupBody * local = (ActorLocal_TanktupBody *)&this->local;
|
||||
|
||||
|
||||
if(!this->initialized){
|
||||
temp_v0 = func_80304C38(0x32B, this);
|
||||
if (temp_v0 == NULL) {
|
||||
local->unk18[0] = D_803911B0;
|
||||
local->unk18[1] = 100.0f;
|
||||
local->unk18[2] = D_803911B4;
|
||||
} else {
|
||||
nodeprop_getPosition(temp_v0, local->unk18);
|
||||
}
|
||||
this->unk138_24 = FALSE;
|
||||
this->initialized = TRUE;
|
||||
}
|
||||
|
||||
if(!this->unk16C_4){
|
||||
this->unk16C_4 = TRUE;
|
||||
this->marker->propPtr->unk8_3 = TRUE;
|
||||
actor_collisionOff(this);
|
||||
this->scale = 1.0f;
|
||||
for(sp44 = 0; sp44 < 4; sp44++){
|
||||
if (local->unk0[sp44] == 0) {
|
||||
func_802C3E10(&func_8038F470, this->marker, local->unk0[sp44], sp44);
|
||||
}
|
||||
}
|
||||
}
|
||||
switch(this->state){
|
||||
case 1:
|
||||
func_8038F610(this);
|
||||
player_getPosition(&sp48);
|
||||
if (!this->unk138_24) {
|
||||
if( ml_vec3f_distance(local->unk18, &sp48) < 250.0f
|
||||
&& ml_vec3f_distance(local->unk18, &sp48) > 80.0f
|
||||
&& !func_8028ECAC()
|
||||
&& player_getTransformation() == TRANSFORM_1_BANJO
|
||||
) {
|
||||
func_80311480(0xC7E, 0, NULL, NULL, NULL, NULL);
|
||||
this->unk138_24 = TRUE;
|
||||
}
|
||||
}
|
||||
if (local->unk10) {
|
||||
func_80328B8C(this, 2, 0.0f, -1);
|
||||
local->unk10 = 0;
|
||||
local->unk14 = TRUE;
|
||||
for(sp44 = 0; sp44 < 4; sp44++){
|
||||
if(local->unk0[sp44] == 0){
|
||||
local->unk14 = FALSE;
|
||||
}
|
||||
}
|
||||
if(!this->unk138_23 && !local->unk14){
|
||||
if(func_80311480(0xC80, 0, NULL, NULL, NULL, NULL))
|
||||
this->unk138_23 = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
func_8038F610(this);
|
||||
if (actor_animationIsAt(this, 0.6f) && local->unk14) {
|
||||
func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000);
|
||||
func_8028F94C(2, local->unk18);
|
||||
}
|
||||
if (actor_animationIsAt(this, 0.99f)) {
|
||||
if (!local->unk14) {
|
||||
func_80328B8C(this, 1, 0.0f, -1);
|
||||
}
|
||||
else{
|
||||
func_80328B8C(this, 3, 0.0f, -1);
|
||||
actor_playAnimationOnce(this);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (actor_animationIsAt(this, 0.1f) != 0) {
|
||||
timed_setCameraToNode(0.0f, 0xD);
|
||||
}
|
||||
if (actor_animationIsAt(this, 0.55f) != 0) {
|
||||
func_8030E624(0x797FF885U);
|
||||
}
|
||||
if (actor_animationIsAt(this, 0.4f) != 0) {
|
||||
func_8034A174(this->marker->unk44, 6, sp34);
|
||||
func_802C8F70(this->yaw);
|
||||
sp34[1] -= 125.0f;
|
||||
jiggySpawn(JIGGY_26_BGS_TANKTUP, sp34);
|
||||
}
|
||||
if (actor_animationIsAt(this, 0.9f) != 0) {
|
||||
func_8028F918(0);
|
||||
if (jiggyscore_isCollected(JIGGY_26_BGS_TANKTUP) == 0) {
|
||||
func_80311480(0xC7F, 0xF, this->position, this->marker, func_8038F5E4, NULL);
|
||||
}
|
||||
else{
|
||||
func_8038F5E4(this->marker, 0xC7F, -1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
496
src/BGS/ch/yellowflibbit.c
Normal file
496
src/BGS/ch/yellowflibbit.c
Normal file
@@ -0,0 +1,496 @@
|
||||
#include <ultra64.h>
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
|
||||
typedef struct {
|
||||
u8 unk0;
|
||||
u8 unk1;
|
||||
u8 unk2;
|
||||
u8 pad3[1];
|
||||
s16 unk4[3];
|
||||
s16 unkA[3];
|
||||
s16 unk10[3];
|
||||
u8 pad16[0x2];
|
||||
f32 unk18;
|
||||
f32 unk1C;
|
||||
f32 unk20[2];
|
||||
f32 unk28;
|
||||
}ActorLocal_Yellow_Flibbit;
|
||||
|
||||
Actor *func_8038DE5C(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx** vtx);
|
||||
void func_8038E034(Actor *this);
|
||||
|
||||
/* .data */
|
||||
ActorInfo D_80390AE0 = {
|
||||
0xC5, 0x137, 0x385,
|
||||
0, NULL,
|
||||
func_8038E034, NULL, func_8038DE5C,
|
||||
0, 0, 1.0f, 0
|
||||
};
|
||||
s32 D_80390B04[3] = {0xFF, 0xB3, 0};
|
||||
f32 D_80390B10[3] = {0.0f, 0.0f, 0.0f};
|
||||
|
||||
/* .code */
|
||||
void func_8038D1E0(Actor *this) {
|
||||
ParticleEmitter *temp_s0;
|
||||
|
||||
temp_s0 = partEmitList_pushNew(4U);
|
||||
particleEmitter_setSprite(temp_s0, ASSET_70E_SPRITE_SMOKE_2);
|
||||
func_802EFA5C(temp_s0, 0.01f, 0.7f);
|
||||
particleEmitter_setStartingFrameRange(temp_s0, 0, 7);
|
||||
particleEmitter_setPosition(temp_s0, this->position);
|
||||
func_802EFFA8(temp_s0, D_80390B04);
|
||||
func_802EFB70(temp_s0, 1.0f, 1.5f);
|
||||
func_802EFB84(temp_s0, 2.5f, 3.0f);
|
||||
particleEmitter_setParticleVelocityRange(temp_s0, -70.0f, 50.0f, -70.0f, 70.0f, 100.0f, 70.0f);
|
||||
func_802EFEC0(temp_s0, 3.0f, 4.0f);
|
||||
particleEmitter_emitN(temp_s0, 4);
|
||||
FUNC_8030E8B4(SFX_30_MAGIC_POOF, 1.0f, 25000, this->position, 500, 2500);
|
||||
}
|
||||
|
||||
s32 func_8038D2F4(Actor *this, f32 *arg1, bool arg2) {
|
||||
ActorLocal_Yellow_Flibbit *local;
|
||||
|
||||
local = (ActorLocal_Yellow_Flibbit *)&this->local;
|
||||
local->unk1 = arg2;
|
||||
local->unk4[0] = (s16) this->position[0];\
|
||||
local->unk4[1] = (s16) this->position[1];\
|
||||
local->unk4[2] = (s16) this->position[2];
|
||||
|
||||
local->unkA[0] = (s16) arg1[0];
|
||||
local->unkA[1] = (s16) arg1[1];
|
||||
local->unkA[2] = (s16) arg1[2];
|
||||
local->unkA[1] = (s16) (s32) func_80309724(arg1);
|
||||
func_80335924(this->unk148, ASSET_DB_ANIM_FLIBBIT_HOP, 0.2f, (arg2) ? randf2(0.7f, 0.8f) : randf2(0.7f, 0.8f));
|
||||
func_80335A8C(this->unk148, 2);
|
||||
func_80324D54(0.2f, SFX_3F2_UNKNOWN, randf2(0.7f, 1.3f), randi2(25000, 27000), this->position, 500.0f, 2500.0f);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool func_8038D468(Actor *this) {
|
||||
f32 player_position[3];
|
||||
f32 sp50;
|
||||
f32 sp4C;
|
||||
f32 sp48;
|
||||
f32 sp3C[3];
|
||||
f32 sp30[3];
|
||||
|
||||
player_getPosition(player_position);
|
||||
func_80258A4C(this->position, this->yaw - 90.0f, player_position, &sp50, &sp4C, &sp48);
|
||||
if (func_80329210(this, &player_position)) {
|
||||
if ((-0.7 <= sp48) && (sp48 <= 0.7)) {
|
||||
sp3C[0] = player_position[0] - this->position[0];
|
||||
sp3C[1] = player_position[1] - this->position[1];
|
||||
sp3C[2] = player_position[2] - this->position[2];
|
||||
ml_vec3f_set_length(sp3C, 210.0f);
|
||||
sp30[0] = this->position[0] + sp3C[0];
|
||||
sp30[1] = this->position[1] + sp3C[1];
|
||||
sp30[2] = this->position[2] + sp3C[2];
|
||||
if (func_80329210(this, sp30)) {
|
||||
return func_8038D2F4(this, sp30, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool func_8038D5A8(Actor *this) {
|
||||
f32 sp64[3];
|
||||
f32 sp60;
|
||||
f32 sp5C;
|
||||
f32 sp58;
|
||||
f32 sp4C[3];
|
||||
ActorLocal_Yellow_Flibbit *local;
|
||||
f32 sp3C[3];
|
||||
|
||||
local = (ActorLocal_Yellow_Flibbit *)&this->local;
|
||||
sp64[0] = (f32) local->unk10[0];
|
||||
sp64[1] = (f32) local->unk10[1];
|
||||
sp64[2] = (f32) local->unk10[2];
|
||||
func_80258A4C(this->position, this->yaw - 90.0f, sp64, &sp60, &sp5C, &sp58);
|
||||
if ((-0.9 <= sp58) && (sp58 <= 0.9)) {
|
||||
if (252.0 < sp60) {
|
||||
sp4C[0] = sp64[0] - this->position[0];
|
||||
sp4C[1] = sp64[1] - this->position[1];
|
||||
sp4C[2] = sp64[2] - this->position[2];
|
||||
ml_vec3f_set_length(sp4C, 210.0f);
|
||||
sp3C[0] = this->position[0] + sp4C[0];
|
||||
sp3C[1] = this->position[1] + sp4C[1];
|
||||
sp3C[2] = this->position[2] + sp4C[2];
|
||||
} else {
|
||||
sp3C[0] = (f32) local->unk10[0];
|
||||
sp3C[1] = (f32) local->unk10[1];
|
||||
sp3C[2] = (f32) local->unk10[2];
|
||||
}
|
||||
if (func_80329210(this, sp3C) != 0) {
|
||||
return func_8038D2F4(this, sp3C, 0);
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s32 func_8038D768(Actor *this) {
|
||||
f32 player_position[3];
|
||||
f32 sp80;
|
||||
f32 sp7C;
|
||||
f32 sp78;
|
||||
s32 var_s1;
|
||||
f32 sp68[3];
|
||||
f32 var_f2;
|
||||
|
||||
player_getPosition(player_position);
|
||||
func_80258A4C(this->position, this->yaw - 90.0f, player_position, &sp80, &sp7C, &sp78);
|
||||
for(var_s1 = 0; var_s1 != 10; var_s1++){
|
||||
if (var_s1 < 5) {
|
||||
if (sp78 > 0.0f) {
|
||||
var_f2 = randf2(10.0f, 90.0f) + this->yaw;
|
||||
} else {
|
||||
var_f2 = randf2(-90.0f, -10.0f) + this->yaw;
|
||||
}
|
||||
} else {
|
||||
var_f2 = randf2(-110.0f, 110.0f) + this->yaw;
|
||||
}
|
||||
func_80256E24(sp68, 0.0f, var_f2, 0.0f, 0.0f, 210.0f);
|
||||
sp68[0] = this->position[0] + sp68[0];
|
||||
sp68[1] = this->position[1] + sp68[1];
|
||||
sp68[2] = this->position[2] + sp68[2];
|
||||
if (func_80329210(this, sp68)) {
|
||||
return func_8038D2F4(this, sp68, 0);
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool func_8038D930(Actor *this) {
|
||||
f32 player_position[3];
|
||||
s32 var_v1;
|
||||
|
||||
player_getPosition(player_position);
|
||||
if (func_80329210(this, &player_position)) {
|
||||
var_v1 = func_8038D468(this);
|
||||
if (var_v1 == 0) {
|
||||
if (randf() > 0.5) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
var_v1 = func_8038D5A8(this);
|
||||
}
|
||||
|
||||
if (var_v1 == 0) {
|
||||
var_v1 = func_8038D768(this);
|
||||
}
|
||||
return var_v1;
|
||||
}
|
||||
|
||||
void func_8038D9D0(Actor *this, s32 next_state) {
|
||||
ActorLocal_Yellow_Flibbit *local;
|
||||
|
||||
local = (ActorLocal_Yellow_Flibbit *)&this->local;
|
||||
local->unk1 = 0;
|
||||
local->unk1C = 0.0f;
|
||||
local->unk28 = 0.0f;
|
||||
if (next_state == 1) {
|
||||
if (this->state != 0) {
|
||||
func_8038CEB8();
|
||||
func_8038D1E0(this);
|
||||
}
|
||||
actor_collisionOff(this);
|
||||
}
|
||||
if (next_state == 2) {
|
||||
func_8038CE88();
|
||||
func_8038D1E0(this);
|
||||
local->unk1C = 0.5f;
|
||||
}
|
||||
if (next_state == 3) {
|
||||
func_80335924(this->unk148, ASSET_FA_ANIM_FLIBBIT_IDLE, 0.2f, randf2(1.0f, 2.0f));
|
||||
func_80335A74(this->unk148, randf2(0.0f, 0.9));
|
||||
func_80335A8C(this->unk148, 1);
|
||||
actor_collisionOn(this);
|
||||
this->position[0] = (f32) local->unk10[0];
|
||||
this->position[1] = (f32) local->unk10[1];
|
||||
this->position[2] = (f32) local->unk10[2];
|
||||
local->unk28 = randf2(1.0f, 3.0f);
|
||||
}
|
||||
if (next_state == 5) {
|
||||
if (mapSpecificFlags_get(0x10)) {
|
||||
func_8038D9D0(this, 4);
|
||||
return;
|
||||
}
|
||||
if (!func_8038D930(this)){
|
||||
if ((this->state != 6)) {
|
||||
func_8038D9D0(this, 6);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (next_state == 6) {
|
||||
func_80335924(this->unk148, ASSET_FB_ANIM_FLIBBIT_TURN, 0.2f, 1.0f);
|
||||
func_80335A74(this->unk148, randf2(0.0f, 1.0f));
|
||||
func_80335A8C(this->unk148, 1);
|
||||
local->unk28 = randf2(1.0f, 3.0f);
|
||||
}
|
||||
if (next_state == 7) {
|
||||
func_80335924(this->unk148, ASSET_FA_ANIM_FLIBBIT_IDLE, 0.2f, randf2(1.0f, 2.0f));
|
||||
func_80335A74(this->unk148, randf2(0.0f, 0.9));
|
||||
func_80335A8C(this->unk148, 1);
|
||||
this->position[1] = func_80309724(this->position);
|
||||
local->unk1C = 1.0f;
|
||||
}
|
||||
if (next_state == 8) {
|
||||
FUNC_8030E8B4(SFX_8E_GRUNTLING_DAMAGE, 1.5f, 32200, this->position, 500, 2500);
|
||||
func_80335924(this->unk148, ASSET_288_ANIM_FLIBBIT_OW, 0.1f, 0.65f);
|
||||
func_80335A8C(this->unk148, 2);
|
||||
this->position[1] = func_80309724(this->position);
|
||||
local->unk1C = 1.0f;
|
||||
}
|
||||
if (next_state == 9) {
|
||||
func_80335924(this->unk148, ASSET_112_ANIM_FLIBBIT_DIE, 0.2f, 0.4f);
|
||||
FUNC_8030E8B4(SFX_115_BUZZBOMB_DEATH, 1.0f, 32200, this->position, 500, 2500);
|
||||
this->marker->collidable = FALSE;
|
||||
this->unk10_1 = FALSE;
|
||||
func_8038CEA0();
|
||||
local->unk18 = 1000.0f;
|
||||
}
|
||||
if (next_state == 0xA) {
|
||||
func_80335924(this->unk148, ASSET_113_ANIM_FLIBBIT_DEAD, 0.2f, 1.0f);
|
||||
func_80335A8C(this->unk148, 2);
|
||||
FUNC_8030E8B4(SFX_2F_ORANGE_SPLAT, 0.8f, 32200, this->position, 500, 2500);
|
||||
}
|
||||
if (next_state == 0xB) {
|
||||
func_80326310(this);
|
||||
}
|
||||
this->state = next_state;
|
||||
}
|
||||
|
||||
void func_8038DD9C(ActorMarker *marker, ActorMarker *other_marker){
|
||||
Actor *this;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
if(this->state < 9){
|
||||
func_8038D9D0(this, 7);
|
||||
}
|
||||
}
|
||||
|
||||
void func_8038DDDC(ActorMarker *marker, ActorMarker *other_marker){
|
||||
Actor *this;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
if(this->state < 9){
|
||||
func_8038D9D0(this, 8);
|
||||
}
|
||||
}
|
||||
|
||||
void func_8038DE1C(ActorMarker *marker, ActorMarker *other_marker){
|
||||
Actor *this;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
if(this->state < 9){
|
||||
func_8038D9D0(this, 9);
|
||||
}
|
||||
}
|
||||
|
||||
Actor *func_8038DE5C(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) {
|
||||
Actor *this;
|
||||
ActorLocal_Yellow_Flibbit *local;
|
||||
s32 var_s0;
|
||||
f32 var_f2;
|
||||
f32 sp7C[3];
|
||||
s32 temp_a0_2;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
local = (ActorLocal_Yellow_Flibbit *)&this->local;
|
||||
if (this->state < 3) {
|
||||
return this;
|
||||
}
|
||||
if (local->unk0 && ((this->state == 3) || (this->state == 6))) {
|
||||
temp_a0_2 = func_803356A0(this->unk148);
|
||||
for(var_s0 = 0; var_s0 < 2; var_s0++){
|
||||
if (0.1 <= local->unk20[var_s0]) {
|
||||
var_f2 = (f32) ((local->unk20[var_s0] - 0.1) / 0.1);
|
||||
} else if (local->unk20[var_s0] >= 0.0f) {
|
||||
var_f2 = (f32) (1.0 - (local->unk20[var_s0] / 0.1));
|
||||
} else {
|
||||
var_f2 = 1.0f;
|
||||
}
|
||||
sp7C[0] = 1.0f;
|
||||
sp7C[1] = var_f2 * 0.99 + 0.01;
|
||||
sp7C[2] = 1.0f;
|
||||
func_8033A928(temp_a0_2, (var_s0 != 0) ? 0x2D : 0x2E, sp7C);
|
||||
};
|
||||
}
|
||||
func_80325888(marker, gfx, mtx, vtx);
|
||||
local->unk0 = marker->unk14_21;
|
||||
return this;
|
||||
}
|
||||
|
||||
void func_8038E034(Actor *this) {
|
||||
f32 spB4[3];
|
||||
f32 spA8[3];
|
||||
f32 spA4;
|
||||
ActorLocal_Yellow_Flibbit *local = (ActorLocal_Yellow_Flibbit *)&this->local;
|
||||
f32 sp9C;
|
||||
f32 sp98;
|
||||
f32 sp94;
|
||||
f32 sp90;
|
||||
f32 sp8C;
|
||||
f32 sp88;
|
||||
f32 sp7C[3];
|
||||
f32 temp_f12;
|
||||
f32 sp74;
|
||||
f32 sp70;
|
||||
f32 sp6C;
|
||||
f32 sp60[3];
|
||||
f32 sp5C;
|
||||
f32 sp58;
|
||||
f32 sp54;
|
||||
f32 sp48[3];
|
||||
|
||||
sp9C = time_getDelta();
|
||||
if (!this->unk16C_4) {
|
||||
this->unk16C_4 = TRUE;
|
||||
marker_setCollisionScripts(this->marker, &func_8038DD9C, &func_8038DDDC, &func_8038DE1C);
|
||||
local->unk2 = 0U;
|
||||
local->unk20[0] = randf2(-2.0f, -1.0f);
|
||||
local->unk20[1] = randf2(-2.0f, -1.0f);
|
||||
local->unk10[0] = (s16) (s32) this->position[0];
|
||||
local->unk10[1] = (s16) (s32) this->position[1];
|
||||
local->unk10[2] = (s16) (s32) this->position[2];
|
||||
func_8038D9D0(this, 1);
|
||||
if (jiggyscore_isSpawned(JIGGY_24_BGS_FLIBBITS) != 0) {
|
||||
marker_despawn(this->marker);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!local->unk2) {
|
||||
local->unk2 = TRUE;
|
||||
func_8038CED0();
|
||||
}
|
||||
player_getPosition(spB4);
|
||||
spA8[0] = spB4[0] - this->position[0];
|
||||
spA8[1] = spB4[1] - this->position[1];
|
||||
spA8[2] = spB4[2] - this->position[2];
|
||||
spA4 = gu_sqrtf(spA8[0]*spA8[0] + spA8[1]*spA8[1] + spA8[2]*spA8[2]);
|
||||
if (func_8025773C(&local->unk28, sp9C) != 0) {
|
||||
func_8030E878(0x3F0, randf2(0.9f, 1.1f), randi2(12000, 19000), this->position, 500.0f, 2500.0f);
|
||||
local->unk28 = randf2(1.0f, 6.0f);
|
||||
}
|
||||
local->unk20[0] += sp9C;
|
||||
local->unk20[0] = (0.2 < (f64) local->unk20[0]) ? randf2(-3.0f, -1.0f) : local->unk20[0];
|
||||
|
||||
local->unk20[1] += sp9C;
|
||||
local->unk20[1] = (0.2 < (f64) local->unk20[1]) ? randf2(-3.0f, -1.0f) : local->unk20[1];
|
||||
|
||||
if(this->state == 1){
|
||||
if(mapSpecificFlags_getClear(0x12)){
|
||||
func_8038D9D0(this, 2);
|
||||
return;
|
||||
}
|
||||
|
||||
if(spA4 < 2000.0f){
|
||||
func_80258A4C(this->position, this->yaw - 90.0f, spB4, &sp98, &sp94, &sp90);
|
||||
this->yaw += (sp90*90.0f) *sp9C;
|
||||
}
|
||||
}
|
||||
|
||||
if(this->state == 2){
|
||||
if(func_8025773C(&local->unk1C, sp9C)){
|
||||
func_8038D9D0(this, 3);
|
||||
}
|
||||
}
|
||||
|
||||
if(this->state == 3){
|
||||
if (func_80329210(this, spB4)) {
|
||||
func_8038D9D0(this, 5);
|
||||
} else {
|
||||
func_8038D9D0(this, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(this->state == 4){
|
||||
if(!mapSpecificFlags_get(0x10))
|
||||
func_8038D9D0(this, 5);
|
||||
}
|
||||
|
||||
if (this->state == 5) {
|
||||
func_8033568C(this->unk148, &sp8C, &sp88);
|
||||
if (sp8C < 0.8 && 0.8 <= sp88) {
|
||||
func_8030E878(SFX_8_BANJO_LANDING_04, randf2(0.8f, 0.9f), randi2(0x61A8, 0x6978), this->position, 100.0f, 1500.0f);
|
||||
}
|
||||
if (func_80335794(this->unk148) > 0) {
|
||||
sp7C[0] = (f32) local->unk10[0];
|
||||
sp7C[1] = (f32) local->unk10[1];
|
||||
sp7C[2] = (f32) local->unk10[2];
|
||||
if (ml_vec3f_distance(this->position, sp7C) < 30.0f) {
|
||||
func_8038D9D0(this, 1);
|
||||
} else {
|
||||
func_8038D9D0(this, 5);
|
||||
}
|
||||
} else {
|
||||
|
||||
if ((0.2 <= sp88) && (sp88 <= 0.8)) {
|
||||
temp_f12 = ((sp88 - 0.2) / 0.60000000000000009);
|
||||
this->position_x = local->unk4[0] + (local->unkA[0] - local->unk4[0])*temp_f12;
|
||||
this->position_y = local->unk4[1] + (local->unkA[1] - local->unk4[1])*temp_f12;
|
||||
this->position_z = local->unk4[2] + (local->unkA[2] - local->unk4[2])*temp_f12;
|
||||
|
||||
if (local->unk1 != 0) {
|
||||
if (sp88 <= 0.5) {
|
||||
this->position[1] = (f32) ((f64) this->position[1] + ((sp88 / 0.5) * 70.0));
|
||||
} else {
|
||||
this->position[1] = (f32) ((f64) this->position[1] + ((1.0 - ((sp88 - 0.5) / 0.5)) * 70.0));
|
||||
}
|
||||
}
|
||||
sp60[0] = (f32) (local->unkA[0] - local->unk4[0]);
|
||||
sp60[1] = (f32) (local->unkA[1] - local->unk4[1]);
|
||||
sp60[2] = (f32) (local->unkA[2] - local->unk4[2]);
|
||||
func_80258A4C(D_80390B10, this->yaw - 90.0f, sp60, &sp74, &sp70, &sp6C);
|
||||
this->yaw += sp6C * 220.0f * sp9C;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this->state == 6) {
|
||||
func_80258A4C(this->position, this->yaw - 90.0f, spB4, &sp5C, &sp58, &sp54);
|
||||
this->yaw += sp54 * 90.0f * sp9C;
|
||||
if ((-0.4 <= sp54) && (sp54 <= 0.4) && ((f64) randf() > 0.5)) {
|
||||
func_8038D9D0(this, 5);
|
||||
}
|
||||
if ((sp58 < 0.0f) && (randf() > 0.5)) {
|
||||
func_8038D9D0(this, 5);
|
||||
}
|
||||
}
|
||||
|
||||
if(this->state == 7 || this->state == 8){
|
||||
if(func_8025773C(&local->unk1C, sp9C)){
|
||||
func_8038D9D0(this, 6);
|
||||
}
|
||||
}
|
||||
|
||||
if(this->state == 9){
|
||||
sp48[0] = this->position[0] - spB4[0];
|
||||
sp48[1] = this->position[1] - spB4[1];
|
||||
sp48[2] = this->position[2] - spB4[2];
|
||||
sp48[1] = 0.0f;
|
||||
ml_vec3f_set_length(sp48, 400.0f * sp9C);
|
||||
|
||||
this->position[0] = this->position[0] + sp48[0];
|
||||
this->position[1] = this->position[1] + sp48[1];
|
||||
this->position[2] = this->position[2] + sp48[2];
|
||||
|
||||
this->position_y += local->unk18*sp9C;
|
||||
local->unk18 -= 3000.0f*sp9C;
|
||||
if(this->position_y < func_80309724(this->position)){
|
||||
this->position_y = func_80309724(this->position);
|
||||
func_8038D9D0(this, 10);
|
||||
}
|
||||
}
|
||||
|
||||
if(this->state == 10){
|
||||
if(func_80335794(this->unk148) > 0){
|
||||
func_8038D9D0(this, 11);
|
||||
}
|
||||
}
|
||||
}
|
216
src/BGS/ch/yumblie.c
Normal file
216
src/BGS/ch/yumblie.c
Normal file
@@ -0,0 +1,216 @@
|
||||
#include <ultra64.h>
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
|
||||
#include "prop.h"
|
||||
extern void func_803253A0(Actor *);
|
||||
extern void func_80325794(ActorMarker *);
|
||||
extern f32 randf (void);
|
||||
|
||||
enum chyumblie_state_e{
|
||||
YUMBLIE_STATE_1_UNDER_GROUND = 1,
|
||||
YUMBLIE_STATE_2_APPEAR,
|
||||
YUMBLIE_STATE_3_ABOVE_GROUND,
|
||||
YUMBLIE_STATE_4_DISAPPEAR,
|
||||
YUMBLIE_STATE_5_BEING_EATEN,
|
||||
};
|
||||
|
||||
typedef struct chyumblie_s{
|
||||
f32 unk0;
|
||||
u8 unk4;
|
||||
u8 pad7[3];
|
||||
f32 unk8; //wait_timer
|
||||
ActorMarker *game_marker;
|
||||
} ActorLocal_Yumblie;
|
||||
|
||||
void chyumblie_set_state(Actor*, enum chyumblie_state_e);
|
||||
void chyumblie_update(Actor *);
|
||||
Actor *chyumblie_draw(ActorMarker *this, Gfx **gfx, Mtx** mtx, Vtx **vtx);
|
||||
|
||||
/* .data */
|
||||
ActorInfo D_80390A40 = {0xC7, actor_yumblie, 0x3F6, 0x00, NULL,
|
||||
chyumblie_update, NULL, chyumblie_draw,
|
||||
0, 0, 0.0f, 0
|
||||
};
|
||||
|
||||
/* .code */
|
||||
bool func_8038B160(Actor *this){
|
||||
ActorLocal_Yumblie *local;
|
||||
s32 temp_v0;
|
||||
|
||||
local = (ActorLocal_Yumblie *)&this->local;
|
||||
temp_v0 = func_8038A9E0(local->game_marker);
|
||||
if ((temp_v0 == 1) || (temp_v0 == 4))
|
||||
return FALSE;
|
||||
|
||||
if ((temp_v0 == 2) || (temp_v0 == 5))
|
||||
return (0.7 <= randf ()) ? TRUE : FALSE;
|
||||
|
||||
return (randf () >= 0.5)? TRUE : FALSE;
|
||||
}
|
||||
|
||||
void chyumblie_set_state(Actor* this, enum chyumblie_state_e next_state){
|
||||
|
||||
ActorLocal_Yumblie *s0;
|
||||
s0 = (ActorLocal_Yumblie *)&this->local;
|
||||
s0->unk8 = 0;
|
||||
if(next_state == 1){
|
||||
s0->unk8 = randf2(1.0f, 10.0f);
|
||||
}
|
||||
|
||||
if(next_state == 2){
|
||||
this->yaw = randf2(0.0f, 360.0f);
|
||||
s0->unk4 = func_8038B160(this);
|
||||
func_8038AC54(s0->game_marker, this->marker, this->position, s0->unk4);
|
||||
func_80335924(this->unk148, (s0->unk4)? ASSET_128_ANIM_GRUMBLIE_APPEAR : ASSET_125_ANIM_YUMBLIE_APPEAR, 0.0f, 1.5f);
|
||||
func_80335A8C(this->unk148, 2);
|
||||
}
|
||||
if(next_state == 3){
|
||||
s0->unk8 = randf2(5.0f, 10.0f);
|
||||
func_80335924(this->unk148, (s0->unk4)? ASSET_12A_ANIM_GRUMBLIE_IDLE : ASSET_127_ANIM_YUMBLIE_IDLE, 0.1f, randf2(0.5f, 1.0f));
|
||||
func_80335A8C(this->unk148, 1);
|
||||
if(s0->unk4){
|
||||
func_8030E6A4(SFX_C4_TWINKLY_MUNCHER_GRR,randf2(1.0f, 1.2), 30000);
|
||||
}else{
|
||||
func_8030E878(SFX_C3_HEGH,randf2(1.0f, 1.2), 30000, this->position, 500.0f, 3000.0f);
|
||||
}
|
||||
}
|
||||
|
||||
if(next_state == 4){
|
||||
chvilegame_remove_piece(s0->game_marker, this->marker);
|
||||
func_80335924(this->unk148, (s0->unk4)? ASSET_129_ANIM_GRUMBLIE_HIDE : ASSET_126_ANIM_YUMBLIE_HIDE, 0.1f, 0.5f);
|
||||
func_80335A8C(this->unk148, 2);
|
||||
}
|
||||
if(next_state == 5){
|
||||
s0->unk8 = randf2(10.0f, 20.0f);
|
||||
chvilegame_remove_piece(s0->game_marker, this->marker);
|
||||
func_8030E878((s0->unk4)? SFX_C4_TWINKLY_MUNCHER_GRR: SFX_C3_HEGH, 1.4f, 32000, this->position, 500.0f, 3000.0f);
|
||||
}
|
||||
this->state = next_state;
|
||||
}
|
||||
|
||||
bool chyumblie_is_edible(ActorMarker * arg0){
|
||||
volatile Actor* actPtr;
|
||||
|
||||
actPtr = marker_getActor(arg0);
|
||||
return (actPtr->state >= 2) && (actPtr->state < 5);
|
||||
}
|
||||
|
||||
Actor *chyumblie_draw(ActorMarker *this, Gfx **gfx, Mtx** mtx, Vtx **vtx){
|
||||
Actor *thisActor;
|
||||
ActorLocal_Yumblie *sp40;
|
||||
f32 sp44[3];
|
||||
f32 sp38[3];
|
||||
|
||||
thisActor = marker_getActor(this);
|
||||
sp40 = (ActorLocal_Yumblie *)&thisActor->local;
|
||||
if ( thisActor->state < 2 || thisActor->state > 4){
|
||||
thisActor->marker->unk14_21 = 0;
|
||||
return thisActor;
|
||||
}
|
||||
|
||||
func_8033A2D4(func_803253A0, thisActor, sp40);
|
||||
func_8033A2E8(func_80325794, this);
|
||||
sp44[0] = thisActor->position_x;
|
||||
sp44[1] = thisActor->position_y + sp40->unk0*75.0f;
|
||||
sp44[2] = thisActor->position_z;
|
||||
sp38[0] = thisActor->pitch;
|
||||
sp38[1] = thisActor->yaw;
|
||||
sp38[2] = thisActor->roll;
|
||||
if(sp40->unk4 && sp40->game_marker){
|
||||
func_803391A4(gfx, mtx, sp44, sp38, 1.0f, NULL, chvilegame_get_grumblie_model(sp40->game_marker));
|
||||
}
|
||||
else{
|
||||
func_803391A4(gfx, mtx, sp44, sp38, 1.0f, NULL, func_80330B1C(this));
|
||||
}
|
||||
return thisActor;
|
||||
}
|
||||
|
||||
bool func_8038B684(ActorMarker * arg0){
|
||||
Actor* actPtr = marker_getActor(arg0);
|
||||
|
||||
if( actPtr->state < 5){
|
||||
chyumblie_set_state(actPtr, YUMBLIE_STATE_5_BEING_EATEN);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void chyumblie_update(Actor *this){
|
||||
ActorLocal_Yumblie *s0;
|
||||
f32 sp50;
|
||||
f32 sp4C;
|
||||
f32 sp48;
|
||||
s32 pad44;
|
||||
f32 tmp;
|
||||
|
||||
s0 = (ActorLocal_Yumblie *)&this->local;
|
||||
sp4C = time_getDelta();
|
||||
if(!this->unk16C_4){
|
||||
this->unk16C_4 = 1;
|
||||
s0->unk0 = 0.0f;
|
||||
s0->unk4 = 0;
|
||||
s0->game_marker = NULL;
|
||||
chyumblie_set_state(this, YUMBLIE_STATE_1_UNDER_GROUND);
|
||||
return;
|
||||
}
|
||||
|
||||
if(s0->game_marker == NULL){
|
||||
s0->game_marker = func_80326D68(this->position, 0x138, -1, &sp48)->marker;
|
||||
}
|
||||
sp50 = func_80335684(this->unk148);
|
||||
if(this->state == YUMBLIE_STATE_1_UNDER_GROUND){
|
||||
if(func_8025773C(&s0->unk8, sp4C)){
|
||||
if(mapSpecificFlags_get(6) && (12 > chvilegame_get_piece_count(s0->game_marker))){
|
||||
chyumblie_set_state(this, YUMBLIE_STATE_2_APPEAR);
|
||||
}
|
||||
else{
|
||||
chyumblie_set_state(this, YUMBLIE_STATE_1_UNDER_GROUND);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(this->state == YUMBLIE_STATE_2_APPEAR){
|
||||
tmp = s0->unk0;
|
||||
if(s0->unk4){
|
||||
if(sp50 <= 0.3){
|
||||
s0->unk0 = sp50/0.3;
|
||||
}
|
||||
}else{
|
||||
if(sp50 <= 0.6){
|
||||
s0->unk0 = sp50/0.6;
|
||||
}
|
||||
}
|
||||
|
||||
if((tmp < 0.5) && (0.5 <= s0->unk0)){
|
||||
func_8030E878(SFX_C5_TWINKLY_POP, randf2(1.0f, 1.2f), 30000, this->position, 500.0f, 3000.0f);
|
||||
}
|
||||
|
||||
if( 0 < func_80335794(this->unk148)){
|
||||
s0->unk0 = 1.0f;
|
||||
chyumblie_set_state(this,YUMBLIE_STATE_3_ABOVE_GROUND);
|
||||
}
|
||||
|
||||
}
|
||||
if(this->state == YUMBLIE_STATE_3_ABOVE_GROUND){
|
||||
if( func_8025773C(&s0->unk8,sp4C) || !mapSpecificFlags_get(6) ){
|
||||
chyumblie_set_state(this,YUMBLIE_STATE_4_DISAPPEAR);
|
||||
}
|
||||
}
|
||||
|
||||
if(this->state == YUMBLIE_STATE_4_DISAPPEAR){
|
||||
if(sp50 >= 0.25 )
|
||||
s0->unk0 -= 2.0f*(f64)sp4C;
|
||||
|
||||
if(0.0f >= s0->unk0){
|
||||
s0->unk0 = 0.0f;
|
||||
chyumblie_set_state(this,YUMBLIE_STATE_1_UNDER_GROUND);
|
||||
}
|
||||
}
|
||||
|
||||
if(this->state == YUMBLIE_STATE_5_BEING_EATEN){
|
||||
if( func_8025773C(&s0->unk8,sp4C)){
|
||||
chyumblie_set_state(this,YUMBLIE_STATE_1_UNDER_GROUND);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user