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);
|
||||
}
|
||||
}
|
||||
}
|
105
src/BGS/code_3030.c
Normal file
105
src/BGS/code_3030.c
Normal file
@@ -0,0 +1,105 @@
|
||||
#include <ultra64.h>
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
|
||||
typedef struct{
|
||||
s32 unk0;
|
||||
ActorMarker *unk4; //tiptup_marker
|
||||
f32 unk8;
|
||||
s32 unkC;
|
||||
}ActorLocal_BGS_3030;
|
||||
|
||||
void func_80389668(Actor *this);
|
||||
Actor *func_80389610(ActorMarker *marker, Gfx **, Mtx **, Vtx**);
|
||||
|
||||
/* .data */
|
||||
ActorInfo D_80390880 = { 0x019B, 0x27B, 0x3F9, 0, NULL, func_80389668, NULL, func_80389610, 0, 0, 1.5f, 0};
|
||||
ActorInfo D_803908A4 = { 0x019C, 0x27C, 0x3F9, 0, NULL, func_80389668, NULL, func_80389610, 0, 0, 1.5f, 0};
|
||||
ActorInfo D_803908C8 = { 0x019D, 0x27D, 0x3F9, 0, NULL, func_80389668, NULL, func_80389610, 0, 0, 1.5f, 0};
|
||||
ActorInfo D_803908EC = { 0x019E, 0x27E, 0x3F9, 0, NULL, func_80389668, NULL, func_80389610, 0, 0, 1.5f, 0};
|
||||
ActorInfo D_80390910 = { 0x019F, 0x27F, 0x3F9, 0, NULL, func_80389668, NULL, func_80389610, 0, 0, 1.5f, 0};
|
||||
ActorInfo D_80390934 = { 0x01A0, 0x280, 0x3F9, 0, NULL, func_80389668, NULL, func_80389610, 0, 0, 1.5f, 0};
|
||||
|
||||
/* .code */
|
||||
void func_80389420(ActorMarker *marker) {
|
||||
Actor *this;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
func_8030E878(SFX_C5_TWINKLY_POP, randf2(1.0f, 1.2f), 25000, this->position, 500.0f, 3000.0f);
|
||||
}
|
||||
|
||||
void func_80389488(Actor *this, s32 next_state) {
|
||||
ActorLocal_BGS_3030 *local;
|
||||
|
||||
local = (ActorLocal_BGS_3030 *)&this->local;
|
||||
if (next_state == 1) {
|
||||
func_80335924(this->unk148, 0x12D, 0.2f, randf2(2.0f, 2.5f));
|
||||
func_80335A74(this->unk148, randf2(0.0f, 1.0f));
|
||||
}
|
||||
if (next_state == 2) {
|
||||
func_80335924(this->unk148, 0x12E, 0.1f, 1.6666666f);
|
||||
timed_playSfx(0.8333333, SFX_86_TIPTUP_CHORUS_AH, local->unk8, 0x7FFF);
|
||||
}
|
||||
if (next_state == 3) {
|
||||
func_8030E6A4(SFX_86_TIPTUP_CHORUS_AH, local->unk8, 0x7FFF);
|
||||
func_80335924(this->unk148, 0x12F, 0.1f, 1.75f);
|
||||
func_80335800(this->unk148, 0.9f, func_80389420, (s32)this->marker);
|
||||
if (local->unk4 != NULL) {
|
||||
func_80388E94(local->unk4, local->unk0);
|
||||
}
|
||||
}
|
||||
this->state = next_state;
|
||||
}
|
||||
|
||||
void func_803895D0(ActorMarker *marker, ActorMarker *other_marker){
|
||||
Actor *this;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
if(this->state != 3){
|
||||
func_80389488(this, 3);
|
||||
}
|
||||
}
|
||||
|
||||
Actor *func_80389610(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) {
|
||||
func_8033A45C(4, marker->unk14_20 - 0x19A);
|
||||
return func_80325888(marker, gfx, mtx, vtx);
|
||||
}
|
||||
|
||||
void func_80389668(Actor *this) {
|
||||
ActorLocal_BGS_3030 *local;
|
||||
f32 sp30;
|
||||
Actor *temp_v0_2;
|
||||
|
||||
local = (ActorLocal_BGS_3030 *)&this->local;
|
||||
if (!this->unk16C_4) {
|
||||
this->unk16C_4 = TRUE;
|
||||
this->marker->propPtr->unk8_3 = TRUE;
|
||||
marker_setCollisionScripts(this->marker, NULL, func_803895D0, NULL);
|
||||
local->unk0 = 1;
|
||||
local->unkC = 0;
|
||||
local->unk4 = NULL;
|
||||
local->unk8 = 1.0f;
|
||||
func_80389488(this, 1);
|
||||
if (jiggyscore_isSpawned(JIGGY_27_BGS_TIPTUP) && !func_803203FC(2) && !func_803203FC(1)) {
|
||||
marker_despawn(this->marker);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
local->unkC++;
|
||||
if (local->unkC == 2) {
|
||||
temp_v0_2 = func_80326D68(this->position, 0x27A, -1, &sp30);
|
||||
local->unk4 = (temp_v0_2 != NULL) ? temp_v0_2->marker : NULL;
|
||||
if (local->unk4 != NULL) {
|
||||
func_80388FFC(local->unk4, &local->unk0, &local->unk8);
|
||||
}
|
||||
}
|
||||
if (this->state == 1) {
|
||||
if (local->unk4 != NULL && (func_80388E70(local->unk4) == local->unk0)) {
|
||||
func_80389488(this, 2);
|
||||
}
|
||||
}
|
||||
if (((this->state == 2) || (this->state == 3)) && (func_80335794(this->unk148) > 0)) {
|
||||
func_80389488(this, 1);
|
||||
}
|
||||
}
|
646
src/BGS/code_3420.c
Normal file
646
src/BGS/code_3420.c
Normal file
@@ -0,0 +1,646 @@
|
||||
#include <ultra64.h>
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
|
||||
extern f32 func_80256AB4(f32, f32, f32, f32);
|
||||
extern f32 func_8025715C(f32, f32);
|
||||
extern f32 *func_8038C284(ActorMarker *);
|
||||
extern void func_802C8F7C(f32);
|
||||
extern void func_802FDCB8(s32);
|
||||
|
||||
enum chvilegame_piece_type_e {
|
||||
YUMBLIE,
|
||||
GRUMBLIE
|
||||
};
|
||||
|
||||
struct vilegame_piece{
|
||||
enum chvilegame_piece_type_e type;
|
||||
f32 position[3];
|
||||
ActorMarker *marker; //yumblie ptr;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
u8 current_type;
|
||||
// u8 pad1[3];
|
||||
vector(struct vilegame_piece) *game_pieces;
|
||||
BKModelBin *grumblie_model_bin;
|
||||
u8 unkC;
|
||||
u8 unkD;
|
||||
u8 player_score;
|
||||
u8 vile_score;
|
||||
f32 type_change_timer;
|
||||
ActorMarker *vile_marker;
|
||||
}ActorLocal_BGS_3420;
|
||||
|
||||
void func_8038A068(Actor *this, s32 next_state);
|
||||
void chvilegame_update(Actor *this);
|
||||
|
||||
/* .data */
|
||||
ActorInfo D_80390960 = {0xC6, 0x138, 0, 0, NULL, chvilegame_update, NULL, func_80325340, 0, 0, 0.0f, 0};
|
||||
enum asset_e D_80390984[] = { 0, 0xC66, 0xC68, 0xC6A, 0xC92, 0xC93, 0xC94, 0};
|
||||
enum asset_e D_803909A4[] = { 0, 0xC67, 0xC69, 0, 0xC95, 0xC96, 0xC97};
|
||||
enum asset_e D_803909C0[] = { 0, 0xC6E, 0xC6F, 0, 0xC95, 0xC96, 0xC97};
|
||||
enum asset_e D_803909DC[] = {0xC65, 0xC65, 0xC65, 0xC8F, 0, 0, 0};
|
||||
enum asset_e D_803909F8[] = {0xC64, 0, 0, 0xC8E, 0, 0, 0, 0};
|
||||
enum asset_e D_80390A18[] = {0xC6D, 0xC70, 0xC71, 0xC8E, 0, 0, 0, 0};
|
||||
|
||||
/* .code */
|
||||
bool func_80389810(f32 arg0[3]) {
|
||||
if (func_8028ECAC() != BSGROUP_7_CROC_ATTACK) {
|
||||
return FALSE;
|
||||
}
|
||||
func_8028E9C4(2, arg0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void func_80389850(Actor *this, s32 arg1) {
|
||||
ActorLocal_BGS_3420 *local;
|
||||
Actor *vile;
|
||||
f32 sp94[3];
|
||||
f32 sp88[3];
|
||||
f32 sp7C[3];
|
||||
s32 var_s0;
|
||||
s32 var_v0;
|
||||
|
||||
local = (ActorLocal_BGS_3420 *)&this->local;
|
||||
vile = marker_getActor(local->vile_marker);
|
||||
if (arg1 != 0) {
|
||||
if (gu_sqrtf(this->position[0]*this->position[0] + this->position[1]*this->position[1] + this->position[2]*this->position[2]) < 800.0f) {
|
||||
sp7C[0] = 0.0f;
|
||||
sp7C[1] = 150.0f;
|
||||
sp7C[2] = 300.0f;
|
||||
ml_vec3f_yaw_rotate_copy(sp7C, sp7C, vile->yaw);
|
||||
sp94[0] = vile->position[0] + sp7C[0];
|
||||
sp94[1] = vile->position[1] + sp7C[1];
|
||||
sp94[2] = vile->position[2] + sp7C[2];
|
||||
func_802C8F70(vile->yaw);
|
||||
jiggySpawn(JIGGY_28_BGS_MR_VILE, sp94);
|
||||
} else {
|
||||
sp7C[0] = 0.0f - vile->position[0];
|
||||
sp7C[1] = 0.0f;
|
||||
sp7C[2] = 0.0f - vile->position[2];
|
||||
ml_vec3f_set_length(sp7C, 150.0f);
|
||||
sp7C[1] = 75.0f;
|
||||
sp94[0] = vile->position[0] + sp7C[0];
|
||||
sp94[1] = vile->position[1] + sp7C[1];
|
||||
sp94[2] = vile->position[2] + sp7C[2];
|
||||
func_802C8F70(func_8025715C(sp7C[0], sp7C[2]));
|
||||
jiggySpawn(JIGGY_28_BGS_MR_VILE, sp94);
|
||||
}
|
||||
}
|
||||
for(var_s0 = 2; var_s0 != 0x3C; var_s0++){
|
||||
var_v0 = ((var_s0 & 1)) ? -(var_s0 / 2) * 0xA : (var_s0 / 2) * 0xA;
|
||||
sp7C[0] = 0.0f;
|
||||
sp7C[1] = 600.0f;
|
||||
sp7C[2] = 1200.0f;
|
||||
ml_vec3f_yaw_rotate_copy(sp7C, sp7C, vile->yaw + var_v0);
|
||||
|
||||
sp94[0] = vile->position[0] + sp7C[0];
|
||||
sp94[1] = vile->position[1] + sp7C[1];
|
||||
sp94[2] = vile->position[2] + sp7C[2];
|
||||
|
||||
|
||||
sp88[0] = -30.0f;
|
||||
sp88[1] = vile->yaw + var_v0;
|
||||
sp88[2] = 0.0f;
|
||||
|
||||
sp7C[2] = 0.0f;
|
||||
sp7C[1] = sp94[1];
|
||||
sp7C[0] = 0.0f;
|
||||
if(ml_vec3f_distance(sp94, sp7C) <= 1000.0f){
|
||||
break;
|
||||
}
|
||||
}
|
||||
func_802BAE6C(sp94, sp88);
|
||||
}
|
||||
|
||||
void func_80389B48(ActorMarker *marker, enum asset_e text_id, s32 arg2){
|
||||
Actor *this;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
if(arg2 == 1){
|
||||
func_8038A068(this, 4);
|
||||
}
|
||||
else{
|
||||
func_8038A068(this, 3);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80389B98(ActorMarker *marker, enum asset_e text_id, s32 arg2){
|
||||
Actor *this;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
func_8038A068(this, 1);
|
||||
}
|
||||
|
||||
void func_80389BC8(ActorMarker *marker, enum asset_e text_id, s32 arg2){
|
||||
Actor *this;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
func_8038A068(this, 5);
|
||||
}
|
||||
|
||||
void func_80389BF8(ActorMarker *marker, enum asset_e text_id, s32 arg2) {
|
||||
Actor *this;
|
||||
ActorLocal_BGS_3420 *local;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
local = (ActorLocal_BGS_3420 *)&this->local;
|
||||
func_80324E88(0.0f);
|
||||
func_80324E38(0.0f, 0);
|
||||
local->unkC--;
|
||||
func_8038A068(this, 7);
|
||||
}
|
||||
|
||||
void func_80389C58(ActorMarker *marker) {
|
||||
Actor *this;
|
||||
ActorLocal_BGS_3420 *local;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
local = (ActorLocal_BGS_3420 *)&this->local;
|
||||
func_80389850(this, 0);
|
||||
func_80311480(D_80390984[local->unkC], 0xF, func_8038C284(local->vile_marker), this->marker, func_80389BF8, NULL);
|
||||
}
|
||||
|
||||
void func_80389CD8(ActorMarker *marker, enum asset_e text_id, s32 arg2){
|
||||
Actor *this;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
func_80324E88(0.0f);
|
||||
func_80324E38(0.0f, 0);
|
||||
func_8038A068(this, 5);
|
||||
}
|
||||
|
||||
void func_80389D20(ActorMarker *marker) {
|
||||
Actor *this;
|
||||
ActorLocal_BGS_3420 *local;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
local = (ActorLocal_BGS_3420 *)&this->local;
|
||||
func_80389850(this, 0);
|
||||
if (local->unkC == local->unkD) {
|
||||
func_80311480(D_803909A4[local->unkC], 0xF, func_8038C284(local->vile_marker), this->marker, func_80389CD8, NULL);
|
||||
} else {
|
||||
func_80311480(D_803909C0[local->unkC], 0xF, func_8038C284(local->vile_marker), this->marker, func_80389CD8, NULL);
|
||||
}
|
||||
func_80347A14(0);
|
||||
}
|
||||
|
||||
void func_80389DF8(ActorMarker *marker, enum asset_e text_id, s32 arg2){
|
||||
Actor *this;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
func_80324E88(0.0f);
|
||||
func_80324E38(0.0f, 0);
|
||||
func_8038A068(this, 1);
|
||||
}
|
||||
|
||||
void func_80389E40(ActorMarker *marker) {
|
||||
Actor *this;
|
||||
ActorLocal_BGS_3420 *local;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
local = (ActorLocal_BGS_3420 *)&this->local;
|
||||
|
||||
func_80389850(this, 1);
|
||||
func_80311480(0xC6B, 0xF, func_8038C284(local->vile_marker), this->marker, func_80389DF8, NULL);
|
||||
}
|
||||
|
||||
void func_80389EAC(ActorMarker *marker, enum asset_e text_id, s32 arg2){
|
||||
Actor *this;
|
||||
ActorLocal_BGS_3420 *local;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
local = (ActorLocal_BGS_3420 *)&this->local;
|
||||
func_80324E88(0.0f);
|
||||
func_80324E38(0.0f, 0);
|
||||
local->unkC = 3;
|
||||
func_8038A068(this, 1);
|
||||
}
|
||||
|
||||
void func_80389F08(ActorMarker *marker) {
|
||||
Actor *vile;
|
||||
Actor *this;
|
||||
ActorLocal_BGS_3420 *local;
|
||||
s32 i;
|
||||
s32 var_s2;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
local = (ActorLocal_BGS_3420 *)&this->local;
|
||||
func_80389850(this, 0);
|
||||
var_s2 = func_80326F58(0x49);
|
||||
vile = marker_getActor(local->vile_marker);
|
||||
if (var_s2 > 0) {
|
||||
func_8025A6EC(COMUSIC_15_EXTRA_LIFE_COLLECTED, 0x7FF8);
|
||||
}
|
||||
for(i = 0; i < 3; i++){
|
||||
if (var_s2 < 3) {
|
||||
func_802C8F70(vile->yaw + (f32) (i * 30));
|
||||
func_802C8F7C(2.0f);
|
||||
func_802C937C(6, vile->position);
|
||||
var_s2 += 1;
|
||||
} else {
|
||||
item_inc(ITEM_16_LIFE);
|
||||
}
|
||||
}
|
||||
func_80311480(0xC98, 0xF, func_8038C284(local->vile_marker), this->marker, func_80389EAC, NULL);
|
||||
}
|
||||
|
||||
|
||||
void func_8038A044(void){
|
||||
func_8025A58C(-1, 400);
|
||||
}
|
||||
|
||||
void func_8038A068(Actor *this, s32 next_state) {
|
||||
ActorLocal_BGS_3420 *local;
|
||||
|
||||
local = (ActorLocal_BGS_3420 *)&this->local;
|
||||
mapSpecificFlags_set(6, FALSE);
|
||||
if (next_state == 1) {
|
||||
if (local->vile_marker != NULL) {
|
||||
func_8038C408(local->vile_marker);
|
||||
}
|
||||
}
|
||||
if (next_state == 2) {
|
||||
func_8038C3B0(local->vile_marker);
|
||||
if (local->unkC == 3) {
|
||||
if (local->unkD >= 4) {
|
||||
func_80311480(0xC91, 0xE, func_8038C284(local->vile_marker), this->marker, func_80389B48, NULL);
|
||||
} else {
|
||||
func_80311480((local->unkC == local->unkD) ? 0xC8D : 0xC90, 0xE, func_8038C284(local->vile_marker), this->marker, func_80389B48, NULL);
|
||||
}
|
||||
} else {
|
||||
func_80311480((local->unkC == local->unkD) ? 0xC63 : 0xC6C, 0xE, func_8038C284(local->vile_marker), this->marker, func_80389B48, NULL);
|
||||
}
|
||||
}
|
||||
if (next_state == 3) {
|
||||
func_80311480(D_803909DC[local->unkC], 4, func_8038C284(local->vile_marker), this->marker, func_80389B98, NULL);
|
||||
}
|
||||
if (next_state == 4) {
|
||||
if (local->unkC == local->unkD) {
|
||||
func_80311480(D_803909F8[local->unkC], 0xE | ((D_803909F8[local->unkC] == 0xC8E) ? 1 : 0) | 0xE, func_8038C284(local->vile_marker), this->marker, func_80389BC8, NULL);
|
||||
} else {
|
||||
func_80311480(D_80390A18[local->unkC], 0xF , func_8038C284(local->vile_marker), this->marker, func_80389BC8, NULL);
|
||||
}
|
||||
func_80347A14(0);
|
||||
}
|
||||
if (next_state == 5) {
|
||||
local->unkC++;
|
||||
if (local->unkD < local->unkC) {
|
||||
local->unkD = local->unkC;
|
||||
}
|
||||
if (local->unkC == 7) {
|
||||
func_8038C434(local->vile_marker);
|
||||
} else {
|
||||
local->current_type = YUMBLIE;
|
||||
local->player_score = 0;
|
||||
local->vile_score = 0;
|
||||
if (func_803203FC(2) != 0) {
|
||||
local->type_change_timer = 5.0f;
|
||||
} else {
|
||||
local->type_change_timer = 10.0f;
|
||||
}
|
||||
item_set(ITEM_0_HOURGLASS_TIMER, 3600-1);
|
||||
item_set(ITEM_6_HOURGLASS, TRUE);
|
||||
mapSpecificFlags_set(6, TRUE);
|
||||
func_8038C3DC(local->vile_marker);
|
||||
func_8025A58C(0, 4000);
|
||||
timedFunc_set_2(1.0f, func_8025A6EC, COMUSIC_55_BGS_MR_VILE, 28000);
|
||||
}
|
||||
}
|
||||
if (this->state == 5) {
|
||||
if (local->unkC != 7) {
|
||||
item_set(ITEM_6_HOURGLASS, FALSE);
|
||||
if ((next_state != 6) && (next_state != 8) && (next_state != 9)) {
|
||||
func_8038A044();
|
||||
}
|
||||
}
|
||||
func_8038C460(local->vile_marker);
|
||||
func_80347A14(1);
|
||||
}
|
||||
if (next_state == 6) {
|
||||
func_8038C3B0(local->vile_marker);
|
||||
func_80324E38(0.0f, 3);
|
||||
timedFunc_set_2(1.0f, func_8025A6EC, COMUSIC_3C_MINIGAME_LOSS, 28000);
|
||||
timedFunc_set_0(4.0f, func_8038A044);
|
||||
timedFunc_set_1(4.0f, func_80389C58, (s32) this->marker);
|
||||
}
|
||||
if (next_state == 8) {
|
||||
func_8038C3B0(local->vile_marker);
|
||||
func_80324E38(0.0f, 3);
|
||||
timedFunc_set_2(1.0f, func_8025A6EC, COMUSIC_3B_MINIGAME_VICTORY, 28000);
|
||||
timedFunc_set_0(3.0f, func_8038A044);
|
||||
timedFunc_set_1(3.0f, func_80389D20, (s32) this->marker);
|
||||
}
|
||||
if (next_state == 9) {
|
||||
func_8038C3B0(local->vile_marker);
|
||||
func_80324E38(0.0f, 3);
|
||||
timedFunc_set_2(1.0f, func_8025A6EC, COMUSIC_3B_MINIGAME_VICTORY, 28000);
|
||||
timedFunc_set_0(3.0f, func_8038A044);
|
||||
timedFunc_set_1(3.0f, func_80389E40, (s32) this->marker);
|
||||
}
|
||||
if (next_state == 0xA) {
|
||||
func_8038C3B0(local->vile_marker);
|
||||
func_80324E38(0.5f, 3);
|
||||
timedFunc_set_2(1.0f, func_8025A6EC, COMUSIC_3B_MINIGAME_VICTORY, 28000);
|
||||
timedFunc_set_1(3.0f, func_80389F08, (s32) this->marker);
|
||||
}
|
||||
if (next_state == 7) {
|
||||
func_8038C384(local->vile_marker);
|
||||
}
|
||||
this->state = next_state;
|
||||
}
|
||||
|
||||
void chvilegame_player_consume_piece(Actor *this) {
|
||||
ActorLocal_BGS_3420 *local;
|
||||
bool is_correct_type;
|
||||
f32 sp44[3];
|
||||
struct vilegame_piece *begin;
|
||||
struct vilegame_piece *end;
|
||||
struct vilegame_piece *i_ptr;
|
||||
|
||||
local = (ActorLocal_BGS_3420 *)&this->local;
|
||||
|
||||
begin = (struct vilegame_piece *)vector_getBegin(local->game_pieces);
|
||||
end = (struct vilegame_piece *) vector_getEnd(local->game_pieces);
|
||||
if ((end != begin) && func_80389810(sp44)){
|
||||
sp44[1] = 0.0f;
|
||||
for(i_ptr = begin; i_ptr < end; i_ptr++){
|
||||
if ((ml_vec3f_distance(i_ptr->position, sp44) < 65.25) && chyumblie_is_edible(i_ptr->marker)) {
|
||||
is_correct_type = ((local->current_type != YUMBLIE) && (i_ptr->type != YUMBLIE)) || (((local->current_type == YUMBLIE) && i_ptr->type == YUMBLIE));
|
||||
if (is_correct_type) {
|
||||
local->player_score++;
|
||||
if (local->player_score == 35) {
|
||||
item_inc(ITEM_16_LIFE);
|
||||
func_8025A6EC(COMUSIC_15_EXTRA_LIFE_COLLECTED, 0x7FF8);
|
||||
}
|
||||
timedFunc_set_1(0.0f, func_802FDCB8, 0x1A);
|
||||
timedFunc_set_1(0.5f, func_802FDCB8, 0x1A);
|
||||
timedFunc_set_1(1.0f, func_802FDCB8, 0x1A);
|
||||
}
|
||||
func_8028F6B8(0x17, (i_ptr->type != YUMBLIE) ? 0x3F7 : 0x3F6);
|
||||
if (!is_correct_type) {
|
||||
func_8028F66C(0x18);
|
||||
}
|
||||
func_8038B684(i_ptr->marker);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool chvilegame_cpu_consume_piece(ActorMarker *marker, f32 position[3]) {
|
||||
Actor *this;
|
||||
ActorLocal_BGS_3420 *local;
|
||||
struct vilegame_piece *begin;
|
||||
struct vilegame_piece *end;
|
||||
struct vilegame_piece *i_ptr;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
local = (ActorLocal_BGS_3420 *)&this->local;
|
||||
if (this->state != 5){
|
||||
return FALSE;
|
||||
}
|
||||
begin = vector_getBegin(local->game_pieces);
|
||||
end = vector_getEnd(local->game_pieces);
|
||||
for(i_ptr = begin; i_ptr < end; i_ptr++){
|
||||
if ((ml_vec3f_distance(i_ptr->position, position) < 50.0f) && func_8038B684(i_ptr->marker)) {
|
||||
local->vile_score++;
|
||||
timedFunc_set_1(0.0f, func_802FDCB8, 0x1B);
|
||||
timedFunc_set_1(0.5f, func_802FDCB8, 0x1B);
|
||||
timedFunc_set_1(1.0f, func_802FDCB8, 0x1B);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BKModelBin *chvilegame_get_grumblie_model(ActorMarker *marker){
|
||||
Actor *this;
|
||||
ActorLocal_BGS_3420 *local;
|
||||
|
||||
|
||||
this = marker_getActor(marker);
|
||||
local = (ActorLocal_BGS_3420 *)&this->local;
|
||||
return local->grumblie_model_bin;
|
||||
}
|
||||
|
||||
s32 chvilegame_get_piece_count(ActorMarker *marker){
|
||||
Actor *this;
|
||||
ActorLocal_BGS_3420 *local;
|
||||
|
||||
|
||||
this = marker_getActor(marker);
|
||||
local = (ActorLocal_BGS_3420 *)&this->local;
|
||||
return vector_size(local->game_pieces);
|
||||
}
|
||||
|
||||
s32 func_8038A9E0(ActorMarker *marker){
|
||||
Actor *this;
|
||||
ActorLocal_BGS_3420 *local;
|
||||
|
||||
|
||||
this = marker_getActor(marker);
|
||||
local = (ActorLocal_BGS_3420 *)&this->local;
|
||||
return local->unkC;
|
||||
}
|
||||
|
||||
s32 chvilegame_get_score_difference(ActorMarker *marker){
|
||||
Actor *this;
|
||||
ActorLocal_BGS_3420 *local;
|
||||
|
||||
|
||||
this = marker_getActor(marker);
|
||||
local = (ActorLocal_BGS_3420 *)&this->local;
|
||||
return local->vile_score - local->player_score;
|
||||
}
|
||||
|
||||
bool chvilegame_find_closest_piece(ActorMarker *marker, f32 position[0], f32 yaw, f32 dst[3]) {
|
||||
f32 piece_direction[3];
|
||||
f32 target_direction[3];
|
||||
Actor *this;
|
||||
ActorLocal_BGS_3420 *local;
|
||||
struct vilegame_piece *closest_piece;
|
||||
struct vilegame_piece *begin;
|
||||
struct vilegame_piece *end;
|
||||
struct vilegame_piece *i_ptr;
|
||||
f32 distance;
|
||||
f32 angle_diff;
|
||||
|
||||
this = marker_getActor(marker);
|
||||
local = (ActorLocal_BGS_3420 *)&this->local;
|
||||
target_direction[0] = 0.0f;
|
||||
target_direction[1] = 0.0f;
|
||||
target_direction[2] = 100.0f;
|
||||
ml_vec3f_yaw_rotate_copy(target_direction, target_direction, yaw);
|
||||
closest_piece = NULL;
|
||||
begin = (struct vilegame_piece *) vector_getBegin(local->game_pieces);
|
||||
end = (struct vilegame_piece *) vector_getEnd(local->game_pieces);
|
||||
for(i_ptr = begin; i_ptr < end; i_ptr++){
|
||||
if( ((local->current_type != YUMBLIE) && (i_ptr->type != YUMBLIE))
|
||||
|| ((local->current_type == YUMBLIE) && (i_ptr->type == YUMBLIE))
|
||||
){
|
||||
piece_direction[0] = i_ptr->position[0] - position[0];
|
||||
piece_direction[1] = i_ptr->position[1] - position[1];
|
||||
piece_direction[2] = i_ptr->position[2] - position[2];
|
||||
distance = ml_vec3f_distance(i_ptr->position, position);
|
||||
angle_diff = func_80256AB4(target_direction[0], target_direction[2], piece_direction[0], piece_direction[2]);
|
||||
if( (distance > 300.0f)
|
||||
|| ((-0.8 < angle_diff) && (angle_diff < 0.8) && ((piece_direction[0]*target_direction[0] + piece_direction[1]*target_direction[1] + piece_direction[2]*target_direction[2]) >= 0.0f))
|
||||
) {
|
||||
if ((closest_piece == NULL) || (distance < ml_vec3f_distance(position, closest_piece->position))){
|
||||
closest_piece = i_ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (closest_piece != NULL) {
|
||||
dst[0] = closest_piece->position[0];
|
||||
dst[1] = closest_piece->position[1];
|
||||
dst[2] = closest_piece->position[2];
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void chvilegame_new_piece(ActorMarker *game_marker, ActorMarker *piece_marker, f32 position[3], enum chvilegame_piece_type_e yumblie_type){
|
||||
Actor *this;
|
||||
ActorLocal_BGS_3420 *local;
|
||||
struct vilegame_piece *temp_v0;
|
||||
|
||||
this = marker_getActor(game_marker);
|
||||
local = (ActorLocal_BGS_3420 *)&this->local;
|
||||
temp_v0 = (struct vilegame_piece *)vector_pushBackNew(&local->game_pieces);
|
||||
temp_v0->type = yumblie_type;
|
||||
temp_v0->marker = piece_marker;
|
||||
temp_v0->position[0] = position[0];
|
||||
temp_v0->position[1] = position[1];
|
||||
temp_v0->position[2] = position[2];
|
||||
temp_v0->position[1] = 0.0f;
|
||||
}
|
||||
|
||||
void chvilegame_free(Actor *this){
|
||||
ActorLocal_BGS_3420 *local;
|
||||
|
||||
local = (ActorLocal_BGS_3420 *)&this->local;
|
||||
func_8038A068(this, 0);
|
||||
vector_free(local->game_pieces);
|
||||
assetcache_release(local->grumblie_model_bin);
|
||||
}
|
||||
|
||||
void chvilegame_remove_piece(ActorMarker *game_marker, ActorMarker *piece_marker) {
|
||||
Actor *this;
|
||||
ActorLocal_BGS_3420 *local;
|
||||
struct vilegame_piece *begin;
|
||||
struct vilegame_piece *end;
|
||||
struct vilegame_piece *i_ptr;
|
||||
|
||||
this = marker_getActor(game_marker);
|
||||
local = (ActorLocal_BGS_3420 *)&this->local;
|
||||
begin = (struct vilegame_piece *)vector_getBegin(local->game_pieces);
|
||||
end = (struct vilegame_piece *)vector_getEnd(local->game_pieces);
|
||||
for(i_ptr = begin; i_ptr < end; i_ptr++){
|
||||
if (piece_marker == i_ptr->marker) {
|
||||
vector_remove(local->game_pieces, i_ptr - begin);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void chvilegame_update(Actor *this) {
|
||||
ActorLocal_BGS_3420 *local;
|
||||
f32 sp50;
|
||||
f32 sp4C;
|
||||
u8 temp_v0;
|
||||
s32 sp30[6];
|
||||
s32 sp2C;
|
||||
|
||||
sp50 = time_getDelta();
|
||||
local = (ActorLocal_BGS_3420 *)&this->local;
|
||||
if (!this->unk16C_4) {
|
||||
this->unk16C_4 = TRUE;
|
||||
this->marker->unk30 = &chvilegame_free;
|
||||
local->game_pieces = vector_new(sizeof(struct vilegame_piece), 0x20);
|
||||
local->grumblie_model_bin = assetcache_get(0x3F7);
|
||||
local->unkC = 0;
|
||||
local->vile_marker = NULL;
|
||||
if (this->state == 0) {
|
||||
local->unkD = 0;
|
||||
} else {
|
||||
this->state = 0;
|
||||
}
|
||||
if (jiggyscore_isSpawned(JIGGY_28_BGS_MR_VILE)) {
|
||||
local->unkC = 3;
|
||||
local->unkD = 3;
|
||||
}
|
||||
if (func_803203FC(2)) {
|
||||
local->unkC = 2;
|
||||
local->unkD = 3;
|
||||
}
|
||||
func_8038A068(this, 1);
|
||||
return;
|
||||
}
|
||||
if (local->vile_marker == NULL) {
|
||||
local->vile_marker = func_80326D68(this->position, 0x13A, -1, &sp4C)->marker;
|
||||
}
|
||||
if (this->state == 1) {
|
||||
if (func_803203FC(2)) {
|
||||
if (func_803203FC(3)) {
|
||||
func_8038A068(this, 5);
|
||||
}
|
||||
} else if (func_8038C2A8(local->vile_marker)) {
|
||||
func_8038A068(this, 2);
|
||||
}
|
||||
}
|
||||
if (this->state == 5) {
|
||||
if (local->unkC == 7) {
|
||||
func_8024E55C(0, sp30);
|
||||
if ((sp30[BUTTON_Z] > 0) && func_8038C2A8(local->vile_marker)) {
|
||||
func_8038A068(this, 0xA);
|
||||
}
|
||||
} else {
|
||||
chvilegame_player_consume_piece(this);
|
||||
if ((local->unkC == 3) || (local->unkC == 6)) {
|
||||
if (func_8025773C(&local->type_change_timer, sp50)) {
|
||||
local->current_type = !local->current_type;
|
||||
if (func_803203FC(2)) {
|
||||
local->type_change_timer = 5.0f;
|
||||
} else {
|
||||
local->type_change_timer = 10.0f;
|
||||
}
|
||||
}
|
||||
if (local->type_change_timer > 3.5) {
|
||||
if (local->current_type != 0) {
|
||||
func_803463D4(ITEM_1D_GRUMBLIE, FALSE);
|
||||
} else {
|
||||
func_803463D4(ITEM_1E_YUMBLIE, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
sp2C = item_getCount(ITEM_1A_PLAYER_VILE_SCORE);
|
||||
item_set(ITEM_1A_PLAYER_VILE_SCORE, local->player_score);
|
||||
item_set(ITEM_1B_VILE_VILE_SCORE, local->vile_score);
|
||||
if ((sp2C != 0) && (local->player_score == 0)) {
|
||||
func_802FA5D0();
|
||||
}
|
||||
if (item_empty(ITEM_6_HOURGLASS)) {
|
||||
if (func_803203FC(2)) {
|
||||
func_803204E4(3, 0);
|
||||
func_803204E4(5, ( local->vile_score < local->player_score) ? TRUE : FALSE);
|
||||
func_8038A068(this, 1);
|
||||
} else if (local->vile_score < local->player_score) {
|
||||
if (local->unkC == 3) {
|
||||
func_8038A068(this, 9);
|
||||
} else {
|
||||
func_8038A068(this, 8);
|
||||
}
|
||||
} else {
|
||||
func_8038A068(this, 6);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((this->state == 7) && (func_8038C338(local->vile_marker) != 0)) {
|
||||
func_8038A068(this, 1);
|
||||
}
|
||||
}
|
94
src/BGS/code_9750.c
Normal file
94
src/BGS/code_9750.c
Normal file
@@ -0,0 +1,94 @@
|
||||
#include <ultra64.h>
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
|
||||
|
||||
void func_80324E88(f32);
|
||||
void timedFunc_set_2(f32, void(*)(s32, s32), s32, s32);
|
||||
void func_8028E668(f32[3], f32, f32, f32);
|
||||
|
||||
void func_8038FBF8(Actor *);
|
||||
|
||||
|
||||
ActorAnimationInfo D_80390C70[3] = {
|
||||
{0, 0.0f},
|
||||
{0x103, 8000000.0f},
|
||||
{0x103, 0.75f}
|
||||
};
|
||||
|
||||
ActorInfo D_80390C88 = {0x6D, 0xE9, 0x3EF, 0x01, D_80390C70,
|
||||
func_8038FBF8, func_80326224, func_80325888,
|
||||
0, 0x166, 0.0f, 0
|
||||
};
|
||||
u8 pad_80390CCC[4] = {0};
|
||||
|
||||
ActorAnimationInfo D_80390CB0[3] = {
|
||||
{0, 0.0f},
|
||||
{0x104, 8000000.0f},
|
||||
{0x104, 0.75f}
|
||||
};
|
||||
|
||||
ActorInfo D_80390CC8 = {0x6D, 0xEA, 0x3F0, 0x01, D_80390CB0,
|
||||
func_8038FBF8, func_80326224, func_80325888,
|
||||
0, 0x166, 0.0f, 0
|
||||
};
|
||||
u8 pad_80390CEC[4] = {0};
|
||||
|
||||
ActorAnimationInfo D_80390CF0[3] = {
|
||||
{0, 0.0f},
|
||||
{0x105, 8000000.0f},
|
||||
{0x105, 0.75f}
|
||||
};
|
||||
|
||||
ActorInfo D_80390D08 = {0x6D, 0xEB, 0x3F1, 0x01, D_80390CF0,
|
||||
func_8038FBF8, func_80326224, func_80325888,
|
||||
0, 0x166, 0.0f, 0
|
||||
};
|
||||
u8 pad_80390C2C[4] = {0};
|
||||
|
||||
ActorAnimationInfo D_80390C30[3] = {
|
||||
{0, 0.0f},
|
||||
{0x106, 8000000.0f},
|
||||
{0x106, 0.75f}
|
||||
};
|
||||
|
||||
ActorInfo D_80390D48 = {0x6D, 0xEC, 0x3F2, 0x01, D_80390C30,
|
||||
func_8038FBF8, func_80326224, func_80325888,
|
||||
0, 0x166, 0.0f, 0
|
||||
};
|
||||
|
||||
/* .code */
|
||||
void func_8038FB40(ActorMarker *this, s32 arg1){
|
||||
Actor * thisActor;
|
||||
|
||||
thisActor = marker_getActor(this);
|
||||
func_80328A84(thisActor, 2);
|
||||
actor_playAnimationOnce(thisActor);
|
||||
FUNC_8030E624(SFX_A_BANJO_LANDING_05, 0.8f, 32750);
|
||||
}
|
||||
|
||||
void func_8038FB84(ActorMarker *this, ActorMarker *other_marker){
|
||||
Actor *thisActor;
|
||||
|
||||
thisActor = marker_getActor(this);
|
||||
FUNC_8030E8B4( SFX_87_TANKTUP_OOOHW, 1.0f, 32750, thisActor->position, 1000, 3000);
|
||||
timedFunc_set_2(0.65f, (TFQM2) func_8038FB40, (s32) this, (s32) other_marker);
|
||||
func_8038F51C(thisActor);
|
||||
this->collidable = 0;
|
||||
}
|
||||
|
||||
void func_8038FBF8(Actor *this){
|
||||
if(!this->initialized){
|
||||
this->initialized = 1;
|
||||
this->marker->propPtr->unk8_3 = 1;
|
||||
marker_setCollisionScripts(this->marker, NULL, NULL, func_8038FB84);
|
||||
}
|
||||
if(this->state == 2){
|
||||
if(animctrl_isAt(this->animctrl, 0.65f)){
|
||||
func_8030E540(SFX_7C_CHEBOOF);
|
||||
}
|
||||
if(animctrl_isStopped(this->animctrl)){
|
||||
marker_despawn(this->marker);
|
||||
}
|
||||
}
|
||||
}
|
24
src/BGS/done/ch/bigalligator.c
Normal file
24
src/BGS/done/ch/bigalligator.c
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <ultra64.h>
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void func_8038FCB0(Actor *);
|
||||
|
||||
/* .data */
|
||||
ActorInfo D_80390D70 = {0xDC, actor_bigalligator, 0x397, 0x01, NULL,
|
||||
func_8038FCB0, func_80326224, func_80325888,
|
||||
0, 0, 0.0f, 0
|
||||
};
|
||||
|
||||
/* .code */
|
||||
void func_8038FCB0(Actor *this){
|
||||
if(this->initialized)
|
||||
return;
|
||||
this->marker->propPtr->unk8_3 = 1;
|
||||
actor_collisionOff(this);
|
||||
this->initialized = 1;
|
||||
}
|
347
src/BGS/done/ch/code_2270.c
Normal file
347
src/BGS/done/ch/code_2270.c
Normal file
@@ -0,0 +1,347 @@
|
||||
#include <ultra64.h>
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
|
||||
void func_80324E88(f32);
|
||||
void func_803888E4(Actor *this, s32 arg1);
|
||||
|
||||
typedef struct{
|
||||
u32 unk0;
|
||||
}Struct_BGS_2270_0s;
|
||||
|
||||
typedef struct ch_bgs_2270_s{
|
||||
u32 unk0;
|
||||
vector(Struct_BGS_2270_0s) *unk4;
|
||||
u8 unk8;
|
||||
u8 unk9;
|
||||
u8 unkA;
|
||||
u8 unkB;
|
||||
f32 unkC;
|
||||
} ActorLocal_BGS_2270;
|
||||
|
||||
void func_80389080(Actor *this);
|
||||
Actor *func_80325888(ActorMarker *, Gfx **, Mtx **, Vtx **);
|
||||
|
||||
ActorInfo D_80390830 = {
|
||||
0x19A, 0x27A, 0x3F8,
|
||||
0, NULL,
|
||||
func_80389080, NULL, func_80325888,
|
||||
0, 0, 2.5f, 0
|
||||
};
|
||||
s16 D_80390854[] = {0, 0xC78, 0xC7A, 0xC7C}; //see again texts
|
||||
s16 D_8039085C[] = {0, 0xC77, 0xC79, 0xC7B}; //success texts
|
||||
u8 D_80390864[] = {3, 3, 5, 7}; //chchoirgame_sequence_length
|
||||
f32 D_80390868[3] = {0.0f, 100.0f, -1020.0f}; //chchoirgame_jiggy_position
|
||||
|
||||
void func_80388660(ActorMarker *this){
|
||||
func_803888E4(marker_getActor(this), 6);
|
||||
}
|
||||
|
||||
void func_8038868C(void){
|
||||
jiggySpawn(JIGGY_27_BGS_TIPTUP, D_80390868);
|
||||
}
|
||||
|
||||
void func_803886B4(ActorMarker *this, s32 arg1){
|
||||
Actor *thisActor;
|
||||
ActorLocal_BGS_2270 *actLocalPtr;
|
||||
Struct_BGS_2270_0s *tmpPtr;
|
||||
|
||||
thisActor = marker_getActor(this);
|
||||
actLocalPtr = (ActorLocal_BGS_2270 *)&thisActor->local;
|
||||
actLocalPtr->unkB = arg1;
|
||||
if(arg1){
|
||||
tmpPtr = vector_pushBackNew(&actLocalPtr->unk4);
|
||||
tmpPtr->unk0 = arg1;
|
||||
}
|
||||
}
|
||||
|
||||
void func_803886F4(ActorMarker *this){
|
||||
Actor *thisActor;
|
||||
|
||||
thisActor = marker_getActor(this);
|
||||
item_set(ITEM_6_HOURGLASS, 1);
|
||||
item_set(ITEM_0_HOURGLASS_TIMER, 30*60-1);
|
||||
func_803888E4(thisActor, 5);
|
||||
}
|
||||
|
||||
void func_8038873C(void){
|
||||
func_8025A6EC(COMUSIC_2B_DING_B, 28000);
|
||||
}
|
||||
|
||||
void func_80388760(void){
|
||||
func_8025A6EC(COMUSIC_2C_BUZZER, 28000);
|
||||
}
|
||||
|
||||
void func_80388784(ActorMarker *this, s32 arg1, s32 arg2){
|
||||
Actor *thisActor;
|
||||
|
||||
thisActor = marker_getActor(this);
|
||||
switch(arg1){
|
||||
case 0xc72:
|
||||
case 0xc74:
|
||||
func_803888E4(thisActor, 3);
|
||||
break;
|
||||
case 0xc78:
|
||||
case 0xc7a:
|
||||
case 0xc7c:
|
||||
func_803888E4(thisActor, 4);
|
||||
break;
|
||||
case 0xc77:
|
||||
case 0xc79:
|
||||
func_80324E38(0.0f, 0);
|
||||
func_803888E4(thisActor, 3);
|
||||
break;
|
||||
case 0xc7b:
|
||||
timedFunc_set_0(0.0f, func_8038868C);
|
||||
func_80324E88(2.5f);
|
||||
func_80324E38(2.5f, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void func_80388848(ActorMarker *this){
|
||||
Actor *thisActor;
|
||||
ActorLocal_BGS_2270 *unqPtr;
|
||||
s32 sp1C;
|
||||
|
||||
thisActor = marker_getActor(this);
|
||||
unqPtr = (ActorLocal_BGS_2270 *)&thisActor->local;
|
||||
sp1C = vector_size(unqPtr->unk4);
|
||||
func_8038873C();
|
||||
if(sp1C != ++unqPtr->unk0)
|
||||
return;
|
||||
|
||||
if(func_803203FC(2)){
|
||||
item_set(ITEM_6_HOURGLASS,0);
|
||||
func_803204E4(3,0);
|
||||
func_803204E4(5,1);
|
||||
}
|
||||
else{
|
||||
func_80388660(thisActor->marker);
|
||||
}
|
||||
}
|
||||
|
||||
void func_803888E4(Actor *this, s32 arg1){
|
||||
ActorLocal_BGS_2270 *unqPtr;
|
||||
f32 sp54;
|
||||
|
||||
f32 tmpf;
|
||||
s32 i;
|
||||
s32 j;
|
||||
s32 prev_member;
|
||||
s32 rand2;
|
||||
Struct_BGS_2270_0s *s1;
|
||||
|
||||
unqPtr = (ActorLocal_BGS_2270 *)&this->local;
|
||||
this->state = arg1;
|
||||
unqPtr->unkC = 0.0f;
|
||||
if(this->state == 1){
|
||||
func_80335924(this->unk148, ASSET_12B_ANIM_TIPTUP_IDLE, 1.0f, 9.0f);
|
||||
unqPtr->unkC = randf2(5.0f, 15.0f);
|
||||
}
|
||||
if(this->state == 2){
|
||||
func_80335924(this->unk148, ASSET_12B_ANIM_TIPTUP_IDLE, 1.0f, 9.0f);
|
||||
unqPtr->unkC = randf2(5.0f, 15.0f);
|
||||
if(!this->unk138_24){
|
||||
this->unk138_24 = 1;
|
||||
if(unqPtr->unkA == 0){
|
||||
func_80311480(0xc72, 0xe, this->position, this->marker, func_80388784, 0);
|
||||
}else{
|
||||
func_80311480(0xc74, 0xf, this->position, this->marker, func_80388784, 0);
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
func_80311480(D_80390854[unqPtr->unkA], 0xf, this->position, this->marker, func_80388784, 0);
|
||||
}
|
||||
}
|
||||
if(this->state == 3){
|
||||
unqPtr->unk0 = 0;
|
||||
vector_clear(unqPtr->unk4);
|
||||
func_80324E38(0.0f, 3);
|
||||
timed_setCameraToNode(0.5f, 0);
|
||||
tmpf = 0.5f;
|
||||
i = 0;
|
||||
prev_member = 0;
|
||||
|
||||
for(; i < D_80390864[unqPtr->unkA]; i++){
|
||||
tmpf += randf2(1.0f, 1.5f);
|
||||
while((rand2 = randi2(1,7)) == prev_member);
|
||||
timedFunc_set_2(tmpf, func_803886B4, this->marker, rand2);
|
||||
timedFunc_set_2(tmpf + 0.1, func_803886B4, this->marker, 0);
|
||||
prev_member = rand2;
|
||||
}//L80388B7C
|
||||
|
||||
func_80324E88(tmpf += 2.5);
|
||||
if(!unqPtr->unkA && !func_803203FC(2)){
|
||||
func_80324DBC(tmpf + 0.5, 0xc73, 0xe, this->position, this->marker, func_80388784, 0);
|
||||
unqPtr->unkA = 1;
|
||||
}
|
||||
func_80324E38(sp54 = tmpf + 0.6, 0);
|
||||
if(func_803203FC(2)){
|
||||
timedFunc_set_1(sp54, func_803886F4, this->marker);
|
||||
}else{
|
||||
this->state = 0x05;
|
||||
}
|
||||
mapSpecificFlags_set(0, 0);
|
||||
}//L80388C6C
|
||||
if(this->state == 4){
|
||||
|
||||
unqPtr->unk0 = 0;
|
||||
func_80324E38(0.0f, 3);
|
||||
timed_setCameraToNode(0.5f, 0);
|
||||
tmpf = 0.5f;
|
||||
for(j = 0; j < vector_size(unqPtr->unk4); j++){
|
||||
s1 = (Struct_BGS_2270_0s *)vector_at(unqPtr->unk4,j);
|
||||
tmpf += randf2(1.0f, 1.5f);
|
||||
timedFunc_set_2(tmpf, func_803886B4, this->marker, s1->unk0);
|
||||
timedFunc_set_2(tmpf + 0.1, func_803886B4, this->marker, 0);
|
||||
}
|
||||
func_80324E88(tmpf += 2.5);
|
||||
func_80324E38(tmpf + 0.6,0);
|
||||
vector_clear(unqPtr->unk4);
|
||||
this->state = 0x05;
|
||||
}//L80388D8C
|
||||
if(this->state == 6){
|
||||
if(unqPtr->unkA == 3){
|
||||
func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000);
|
||||
}
|
||||
func_80324E38(0.5f, 3);
|
||||
timed_setCameraToNode(1.5f, 1);
|
||||
func_80324DBC(2.0f, D_8039085C[unqPtr->unkA++], 0xF, this->position, this->marker, func_80388784, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80388E44(ActorMarker *arg0, ActorMarker *arg1){
|
||||
func_8028F428(2,arg0);
|
||||
}
|
||||
|
||||
s32 func_80388E70(ActorMarker *this){
|
||||
Actor *ptr;
|
||||
ActorLocal_BGS_2270 *local;
|
||||
|
||||
ptr = marker_getActor(this);
|
||||
local = (ActorLocal_BGS_2270 *)&ptr->local;
|
||||
return local->unkB;
|
||||
}
|
||||
|
||||
void func_80388E94(ActorMarker *this, s32 arg1){
|
||||
Actor * thisActor;
|
||||
ActorLocal_BGS_2270 *unqPtr;
|
||||
Struct_BGS_2270_0s * tmp;
|
||||
|
||||
thisActor = marker_getActor(this);
|
||||
unqPtr = (ActorLocal_BGS_2270 *)&thisActor->local;
|
||||
if((s32)unqPtr->unk0 >= (s32) vector_size(unqPtr->unk4)){
|
||||
if(!mapSpecificFlags_get(0) && func_80311480(0xc76, 0, 0, 0, 0, 0))
|
||||
mapSpecificFlags_set(0,1);
|
||||
}else{
|
||||
tmp = (Struct_BGS_2270_0s *)vector_at(unqPtr->unk4, unqPtr->unk0);
|
||||
if(arg1 == tmp->unk0){
|
||||
timedFunc_set_1(0.5f, func_80388848, thisActor->marker);
|
||||
}
|
||||
else{
|
||||
func_8028F55C(1, thisActor->marker);
|
||||
timedFunc_set_0(0.5f, func_80388760);
|
||||
if(!mapSpecificFlags_get(1) && !func_803203FC(2) && func_80311480(0xc75, 0, NULL, NULL, NULL, NULL))
|
||||
mapSpecificFlags_set(1,TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_80388FC0(Actor *this){
|
||||
ActorLocal_BGS_2270 *local;
|
||||
|
||||
local = (ActorLocal_BGS_2270 *)&this->local;
|
||||
func_80320044(0, local->unkA, 2);
|
||||
vector_free(local->unk4);
|
||||
}
|
||||
|
||||
void func_80388FFC(ActorMarker *this, s32 *arg1, f32* arg2){
|
||||
Actor *thisActor;
|
||||
ActorLocal_BGS_2270 *localPtr;
|
||||
|
||||
thisActor = marker_getActor(this);
|
||||
localPtr = (ActorLocal_BGS_2270 *)&thisActor->local;
|
||||
|
||||
*arg2 = 0.52 + (f64)localPtr->unk9 * 0.12;
|
||||
localPtr->unk9++;
|
||||
*arg1 = localPtr->unk9;
|
||||
|
||||
}
|
||||
|
||||
void func_80389080(Actor *this){
|
||||
f32 sp44[3];
|
||||
ActorLocal_BGS_2270 *unqPtr;
|
||||
f32 sp3C;
|
||||
f32 sp38;
|
||||
f32 sp34;
|
||||
f32 sp30;
|
||||
|
||||
unqPtr = (ActorLocal_BGS_2270 *)&this->local;
|
||||
sp3C = time_getDelta();
|
||||
if(!this->unk16C_4){
|
||||
this->unk16C_4 = 1;
|
||||
this->marker->unk30 = func_80388FC0;
|
||||
marker_setCollisionScripts(this->marker, func_80388E44, NULL, NULL);
|
||||
|
||||
unqPtr->unk0 = 0;
|
||||
unqPtr->unk4 = vector_new(sizeof(Struct_BGS_2270_0s), 8);
|
||||
unqPtr->unk8 = 0;
|
||||
unqPtr->unk9 = 0;
|
||||
unqPtr->unkA = func_8031FF44(0,2);
|
||||
unqPtr->unkB = 0;
|
||||
unqPtr->unkC = 0.0f;
|
||||
if(func_803203FC(2)){
|
||||
unqPtr->unkA = 3;
|
||||
this->position_y = this->position_y - 300.0f;
|
||||
}
|
||||
func_803888E4(this, 1);
|
||||
if(jiggyscore_isSpawned(JIGGY_27_BGS_TIPTUP) && !func_803203FC(2) && !func_803203FC(1))
|
||||
marker_despawn(this->marker);
|
||||
}
|
||||
else{
|
||||
player_getPosition(&sp44);
|
||||
if(func_8033567C(this->unk148) == ASSET_12C_ANIM_TIPTUP_TAPPING && func_80335794(this->unk148) > 0){
|
||||
func_80335924(this->unk148, ASSET_12B_ANIM_TIPTUP_IDLE, 1.0f, 9.0f);
|
||||
unqPtr->unkC = randf2(5.0f, 15.0f);
|
||||
}
|
||||
if(func_8025773C(&unqPtr->unkC, sp3C)){
|
||||
func_80335924(this->unk148, ASSET_12C_ANIM_TIPTUP_TAPPING, 1.0f, 4.0f);
|
||||
}
|
||||
func_80258A4C(this->position, this->yaw - 90.0f, &sp44, &sp38, &sp34, &sp30);
|
||||
this->yaw = this->yaw + 5.0f*sp30;
|
||||
if(this->state == 1){
|
||||
if(func_803203FC(2)){
|
||||
if(func_803203FC(3)){
|
||||
func_80324E38(0.0f,0);
|
||||
func_803888E4(this, 3);
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(ml_vec3f_distance(this->position, &sp44) < 300.0f && player_getTransformation() == TRANSFORM_1_BANJO && !jiggyscore_isSpawned(JIGGY_27_BGS_TIPTUP)){
|
||||
func_803888E4(this, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(this->state == 5){
|
||||
if(func_803203FC(2)){
|
||||
if(item_empty(ITEM_0_HOURGLASS_TIMER)){
|
||||
item_set(ITEM_6_HOURGLASS,1);
|
||||
func_803204E4(3,0);
|
||||
func_803204E4(5,0);
|
||||
}
|
||||
} //L80389370
|
||||
else{
|
||||
if(ml_vec3f_distance(this->position, &sp44) >= 300.0f)
|
||||
func_803888E4(this, 1);
|
||||
}
|
||||
}//L803893A0
|
||||
if(this->state == 6){
|
||||
if(ml_vec3f_distance(this->position, &sp44) < 300.0f && !unqPtr->unk8){
|
||||
unqPtr->unk8 = 1;
|
||||
func_80311480(0xc7d, 4, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
203
src/BGS/done/ch/code_6730.c
Normal file
203
src/BGS/done/ch/code_6730.c
Normal file
@@ -0,0 +1,203 @@
|
||||
#include <ultra64.h>
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
|
||||
|
||||
void func_8038CEE8(Actor *);
|
||||
void func_8038CC08(Actor * arg0, u32 arg1);
|
||||
void func_8025A58C(u32, u32);
|
||||
void func_80324E88(f32);
|
||||
|
||||
|
||||
ActorInfo D_80390AB0 = {0xC4, ACTOR_136_YELLOW_FLIBBIT_CONTROLLER, 0x00, 0x00, NULL,
|
||||
func_8038CEE8, NULL, func_80325340,
|
||||
0, 0, 0.0f, 0
|
||||
};
|
||||
|
||||
f32 D_80390AD4[3] = {1985.0f, 200.0f, -1386.0f};
|
||||
|
||||
/* .bss */
|
||||
u8 D_80391240[4];
|
||||
|
||||
/* .code */
|
||||
void func_8038CB20(void){
|
||||
jiggySpawn(JIGGY_24_BGS_FLIBBITS, D_80390AD4);
|
||||
}
|
||||
|
||||
void func_8038CB48(ActorMarker *arg0, u32 arg1, u32 arg2){
|
||||
Actor *actPtr = marker_getActor(arg0);
|
||||
mapSpecificFlags_set(0x10, 0);
|
||||
if(actPtr->state == 4){
|
||||
func_8038CC08(actPtr,5);
|
||||
}
|
||||
else{
|
||||
func_8038CC08(actPtr,3);
|
||||
}
|
||||
}
|
||||
|
||||
void func_8038CBB4(Actor * arg0){
|
||||
if(!arg0->bgs_6730.unk4)
|
||||
return;
|
||||
func_8025A58C(-1, 400);
|
||||
comusic_8025AB44(MUSIC_BGS_FLIBBIT_FIGHT,0, 400);
|
||||
func_8025AABC(MUSIC_BGS_FLIBBIT_FIGHT);
|
||||
|
||||
arg0->bgs_6730.unk4 = 0;
|
||||
}
|
||||
|
||||
void func_8038CC08(Actor * arg0, u32 arg1){
|
||||
ActorLocal_BGS_6730 *s0;
|
||||
|
||||
s0 = &arg0->bgs_6730;
|
||||
if(arg1 == 2){
|
||||
func_8028F8F8(0x12, 1);
|
||||
func_8028F8F8(0x1F, 0);
|
||||
mapSpecificFlags_set(0x10, 1);
|
||||
if(!func_8031FF1C(0x1B)){
|
||||
func_80320004(0x1B, 1);
|
||||
func_80311480(text_flibbits_meet, 0xf, arg0->position, arg0->marker, func_8038CB48, 0);
|
||||
}else{
|
||||
if(!arg0->bgs_6730.unk8){
|
||||
func_80311480(text_flibbits_return, 0x4, arg0->position, arg0->marker, func_8038CB48, 0);
|
||||
}
|
||||
else{
|
||||
func_8038CB48(arg0->marker, text_flibbits_return, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(arg1 == 3){
|
||||
s0->unk0 = 1;
|
||||
if(!s0->unk4){
|
||||
func_8025A58C(0, 400);
|
||||
func_8025A6EC(MUSIC_BGS_FLIBBIT_FIGHT, 30000);
|
||||
s0->unk4 = 1;
|
||||
}
|
||||
else{
|
||||
comusic_8025AB44(MUSIC_BGS_FLIBBIT_FIGHT, 30000, 400);
|
||||
}
|
||||
}
|
||||
|
||||
if(arg0->state == 3){
|
||||
func_8028F8F8(0x12, 0);
|
||||
func_8028F8F8(0x1F, 1);
|
||||
if(arg1 == 1){
|
||||
if(s0->unk4){
|
||||
comusic_8025AB44(MUSIC_BGS_FLIBBIT_FIGHT, 18000, 100);
|
||||
}
|
||||
}
|
||||
else{
|
||||
func_8038CBB4(arg0);
|
||||
}
|
||||
}
|
||||
|
||||
if(arg1 == 4){
|
||||
func_80311480(text_flibbits_defeat, 0xf, arg0->position, arg0->marker, func_8038CB48, 0);
|
||||
}
|
||||
if(arg1 == 5){
|
||||
func_80324E38(0.0f, 3);
|
||||
timed_setCameraToNode(0.0f, 0x27);
|
||||
timedFunc_set_0(0.2f, func_8038CB20);
|
||||
func_80324E88(3.0f);
|
||||
func_80324E38(3.0f, 0);
|
||||
arg1 = 6;
|
||||
}
|
||||
if(arg1 == 6){
|
||||
func_8028F8F8(0x12, 0);
|
||||
func_8028F8F8(0x1F, 1);
|
||||
}
|
||||
arg0->state = arg1;
|
||||
}
|
||||
|
||||
void func_8038CE88(void){
|
||||
D_80391240[0]++;
|
||||
}
|
||||
|
||||
void func_8038CEA0(void){
|
||||
D_80391240[1]++;
|
||||
}
|
||||
|
||||
void func_8038CEB8(void){
|
||||
D_80391240[2]++;
|
||||
}
|
||||
|
||||
void func_8038CED0(void){
|
||||
D_80391240[3]++;
|
||||
}
|
||||
|
||||
void func_8038CEE8(Actor *this){
|
||||
f32 sp34[3];
|
||||
u32 sp28;
|
||||
ActorLocal_BGS_6730 *bgs6730;
|
||||
|
||||
bgs6730 = &this->bgs_6730;
|
||||
if(!this->unk16C_4){
|
||||
this->unk16C_4 = 1;
|
||||
bgs6730->unk0 = 0;
|
||||
bgs6730->unk4 = 0;
|
||||
bgs6730->unk8 = 0;
|
||||
bgs6730->unkC = 0;
|
||||
D_80391240[0] = 0;
|
||||
D_80391240[1] = 0;
|
||||
D_80391240[2] = 0;
|
||||
D_80391240[3] = 0;
|
||||
mapSpecificFlags_set(0x12, 0);
|
||||
mapSpecificFlags_set(0x10, 0);
|
||||
if(jiggyscore_isSpawned(JIGGY_24_BGS_FLIBBITS)){
|
||||
func_8038CC08(this,6);
|
||||
return;
|
||||
}else{
|
||||
func_8038CC08(this,1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(D_80391240[0]>0){
|
||||
bgs6730->unk8 += D_80391240[0];
|
||||
bgs6730->unkC -= D_80391240[0];
|
||||
D_80391240[0] = 0;
|
||||
}
|
||||
if(D_80391240[1]>0){
|
||||
bgs6730->unk8 -= D_80391240[1];
|
||||
D_80391240[1] = 0;
|
||||
}
|
||||
if(D_80391240[2]>0){
|
||||
bgs6730->unk8 -= D_80391240[2];
|
||||
bgs6730->unkC += D_80391240[2];
|
||||
D_80391240[2] = 0;
|
||||
}
|
||||
if(D_80391240[3]>0){
|
||||
bgs6730->unkC += D_80391240[3];
|
||||
D_80391240[3] = 0;
|
||||
}
|
||||
player_getPosition(&sp34);
|
||||
sp28 = (sp34[1] < 500.0f) && (func_80329210(this,sp34) != 0);
|
||||
if(this->state == 1){
|
||||
if(sp28 && ((bgs6730->unk8 > 0) || (bgs6730->unkC > 0)) && !func_8028FB48(0xe000)){
|
||||
func_8038CC08(this,2);
|
||||
}
|
||||
else{
|
||||
//L8038D0E0
|
||||
if(bgs6730->unk4 && !bgs6730->unk8){
|
||||
func_8038CBB4(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(this->state == 3){
|
||||
if(!sp28){
|
||||
func_8038CC08(this, 1);
|
||||
}else{
|
||||
if(bgs6730->unk8 < 2 && bgs6730->unkC > 0){
|
||||
mapSpecificFlags_set(0x12, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(this->state == 1 || this->state == 3){
|
||||
if( (bgs6730->unk0)
|
||||
&& !jiggyscore_isSpawned(JIGGY_24_BGS_FLIBBITS)
|
||||
&& !bgs6730->unk8
|
||||
&& !bgs6730->unkC
|
||||
){
|
||||
func_8038CC08(this, 4);
|
||||
}
|
||||
}
|
||||
}
|
100
src/BGS/done/ch/code_8A60.c
Normal file
100
src/BGS/done/ch/code_8A60.c
Normal file
@@ -0,0 +1,100 @@
|
||||
#include <ultra64.h>
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
|
||||
extern void timedFunc_set_0(f32, void (*)(void));
|
||||
|
||||
void func_8038EEA4(Actor *this);
|
||||
void func_8038F06C(Actor *this);
|
||||
|
||||
ActorAnimationInfo D_80390B90[] = {
|
||||
{0x00, 0.0f},
|
||||
{0x00, 0.0f},
|
||||
{0xD4, 0.15f},
|
||||
{0xD5, 0.5f},
|
||||
{0x00, 0.0f},
|
||||
{0x00, 0.0f},
|
||||
{0xD4, 0.15f},
|
||||
{0xD5, 0.5f},
|
||||
{0xD5, 1e+8f}
|
||||
};
|
||||
ActorInfo D_80390BD8 = {0xF5, 0x14E, 0x3F5, 1, D_80390B90, func_8038EEA4, func_80326224, func_80325888, 0, 0, 0.0f, 0};
|
||||
ActorInfo D_80390BFC = {0xFD, 0x1FB, 0x3F5, 1, D_80390B90, func_8038F06C, func_80326224, func_80325888, 0, 0, 0.0f, 0};
|
||||
|
||||
void func_8038EE50(void){
|
||||
f32 sp24[3];
|
||||
|
||||
if(func_80304E24(0x14d, sp24)){
|
||||
jiggySpawn(JIGGY_20_BGS_ELEVATED_WALKWAY, sp24);
|
||||
func_802C3F04(func_802C4140, 0x4C, *((u32 *) &sp24[0]), *((u32 *) &sp24[1]), *((u32 *) &sp24[2]));
|
||||
}
|
||||
}
|
||||
|
||||
void func_8038EEA4(Actor *this){
|
||||
func_8038EA90();
|
||||
if(mapSpecificFlags_get(7)){
|
||||
mapSpecificFlags_set(7, 0);
|
||||
if(!mapSpecificFlags_get(3) || (item_getCount(0) > 0)){
|
||||
func_802D68F0(0x2D);
|
||||
}
|
||||
}
|
||||
if(!mapSpecificFlags_get(5)){
|
||||
func_802D4928(this, 1, 6, 7);
|
||||
}
|
||||
if(mapSpecificFlags_get(2)){
|
||||
this->velocity_x = 0.0f;
|
||||
mapSpecificFlags_set(3,0);
|
||||
mapSpecificFlags_set(4,0);
|
||||
mapSpecificFlags_set(1,0);
|
||||
mapSpecificFlags_set(2,0);
|
||||
}
|
||||
if( this->velocity_x == 0.0f && mapSpecificFlags_get(1)){
|
||||
this->velocity_x = 1.0f;
|
||||
func_802BAFE4(0xc);
|
||||
timedFunc_set_0(1.2f, func_8038EE50);
|
||||
} //L8038EFB4
|
||||
if( this->velocity_x != 0.0f && !mapSpecificFlags_get(3) && func_802BB270()){
|
||||
mapSpecificFlags_set(3,1);
|
||||
func_802D68F0(0x2D);
|
||||
item_set(ITEM_6_HOURGLASS,1);
|
||||
} //L8038EFB4
|
||||
}
|
||||
|
||||
void func_8038F018(void){
|
||||
f32 sp24[3];
|
||||
|
||||
if(func_80304E24(0x1fc, sp24)){
|
||||
jiggySpawn(JIGGY_25_BGS_MAZE, sp24);
|
||||
func_802C3F04(func_802C4140, 0x4C, *((u32 *) &sp24[0]), *((u32 *) &sp24[1]), *((u32 *) &sp24[2]));
|
||||
}
|
||||
}
|
||||
|
||||
void func_8038F06C(Actor *this){
|
||||
func_8038EA90();
|
||||
if(mapSpecificFlags_get(8)){
|
||||
mapSpecificFlags_set(8, 0);
|
||||
if(!mapSpecificFlags_get(0xC) || (item_getCount(0) > 0)){
|
||||
func_802D68F0(0xA);
|
||||
}
|
||||
}
|
||||
if(!mapSpecificFlags_get(9)){
|
||||
func_802D4928(this, 0xA, 6, 7);
|
||||
}
|
||||
if(mapSpecificFlags_get(0xB)){
|
||||
this->velocity_x = 0.0f;
|
||||
mapSpecificFlags_set(0xC,0);
|
||||
mapSpecificFlags_set(0xD,0);
|
||||
mapSpecificFlags_set(0xA,0);
|
||||
mapSpecificFlags_set(0xB,0);
|
||||
}
|
||||
if( this->velocity_x == 0.0f && mapSpecificFlags_get(0xA)){
|
||||
this->velocity_x = 1.0f;
|
||||
func_802BAFE4(0x1D);
|
||||
timedFunc_set_0(1.2f, func_8038F018);
|
||||
} //L8038EFB4
|
||||
if( this->velocity_x != 0.0f && !mapSpecificFlags_get(0xC) && func_802BB270()){
|
||||
mapSpecificFlags_set(0xC,1);
|
||||
func_802D68F0(0xA);
|
||||
item_set(ITEM_6_HOURGLASS,1);
|
||||
} //L8038EFB4
|
||||
}
|
125
src/BGS/done/ch/mudhut.c
Normal file
125
src/BGS/done/ch/mudhut.c
Normal file
@@ -0,0 +1,125 @@
|
||||
#include <ultra64.h>
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
|
||||
/* TODO move declarations to respective headers*/
|
||||
void func_8028F710(s32, f32);
|
||||
|
||||
void func_802C4218(u32,f32,f32,f32);
|
||||
void func_80328A84(Actor *, u32);
|
||||
|
||||
/* local declarations */
|
||||
Actor *func_8038EAD0(ActorMarker *this, Gfx** gdl, Mtx** mtx, u32 arg3);
|
||||
void func_8038EB4C(ActorMarker *);
|
||||
void func_8038EB8C(Actor *this);
|
||||
|
||||
/* .data section */
|
||||
ActorAnimationInfo D_80390B30[4] = {
|
||||
{0, 0.0f},
|
||||
{0, 0.0f},
|
||||
{anim_mudhut_smashing, 0.25f},
|
||||
{anim_mudhut_smashing, 1000000.0f}
|
||||
};
|
||||
|
||||
u32 D_80390B50[6] = {0xA, 0xA, 0xB, 0xA, 0xA, 0xC};
|
||||
|
||||
ActorInfo D_80390B68 = {0xD5, ACTOR_C_MUD_HUT, ASSET_7D8_MODEL_MM_HUT_TOP, 0x01, D_80390B30,
|
||||
func_8038EB8C, func_80326224, func_8038EAD0,
|
||||
0, 0, 0.0f, 0
|
||||
};
|
||||
|
||||
/* .code section */
|
||||
void func_8038EA30(void){
|
||||
if((getGameMode() != GAME_MODE_7_ATTRACT_DEMO) && (1.5 < func_8028E80C(2)) ){
|
||||
func_8028F710(2, 1.5);
|
||||
}
|
||||
}
|
||||
|
||||
void func_8038EA90(void){
|
||||
u32 sp1C;
|
||||
osPiReadIo(0xD10, &sp1C);
|
||||
if(sp1C = (u16)(sp1C-0x400)){
|
||||
func_8038EA30();
|
||||
}
|
||||
}
|
||||
|
||||
Actor *func_8038EAD0(ActorMarker *this, Gfx** gdl, Mtx** mtx, u32 arg3){
|
||||
Actor *thisActor;
|
||||
|
||||
thisActor = marker_getActor(this);
|
||||
func_8033A45C(1, thisActor->state == 1);
|
||||
if(thisActor->state == 3)
|
||||
return thisActor;
|
||||
|
||||
return func_80325888(this, gdl, mtx, arg3);
|
||||
}
|
||||
|
||||
void func_8038EB4C(ActorMarker *this){
|
||||
Actor *thisActor;
|
||||
|
||||
thisActor = marker_getActor(this);
|
||||
thisActor = func_8032813C(ACTOR_D_WOOD_DEMOLISHED, thisActor->position, NULL);
|
||||
thisActor = func_8032813C(ACTOR_4D_STEAM_2, thisActor->position, NULL);
|
||||
if(this);
|
||||
}
|
||||
|
||||
void func_8038EB8C(Actor *this){
|
||||
|
||||
f32 diffPos[3];
|
||||
f32 plyrPos[3];
|
||||
s32 tmp;
|
||||
|
||||
if(func_80334904() == 2){
|
||||
if(!this->initialized){
|
||||
this->marker->collidable = 0;
|
||||
this->initialized = 1;
|
||||
}
|
||||
|
||||
switch(this->state){
|
||||
case 1:
|
||||
this->marker->propPtr->unk8_3 = 1;
|
||||
player_getPosition(&plyrPos);
|
||||
diffPos[0] = plyrPos[0] - this->position_x;
|
||||
diffPos[1] = plyrPos[1] - this->position_y;
|
||||
diffPos[2] = plyrPos[2] - this->position_z;
|
||||
if( (150.0f < diffPos[1])
|
||||
&& (player_getActiveHitbox(this->marker) == HITBOX_1_BEAK_BUSTER)
|
||||
&& (func_8028F20C())
|
||||
&& (gu_sqrtf(diffPos[0]*diffPos[0] + diffPos[1]*diffPos[1] + diffPos[2]*diffPos[2]) < 350.f)
|
||||
){
|
||||
tmp = (s32)( (this->position_y - 600.f)/430.0f);
|
||||
diffPos[0] = this->position_x;
|
||||
diffPos[1] = this->position_y;
|
||||
diffPos[2] = this->position_z;
|
||||
diffPos[1] += 130.0;
|
||||
|
||||
FUNC_8030E8B4(SFX_5B_HEAVY_STUFF_FALLING, 1.0f, 28000, this->position, 0x12C, 0xBB8);
|
||||
func_80328A84(this, 2);
|
||||
this->marker->propPtr->unk8_3 = 0;
|
||||
actor_playAnimationOnce(this);
|
||||
if(tmp == 5){
|
||||
func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000);
|
||||
}
|
||||
func_802C3C88(func_8038EB4C, this->marker);
|
||||
if(tmp < 5){
|
||||
func_802C3F04(func_802C4218,D_80390B50[tmp], ((u32 *)diffPos)[0], ((u32 *)diffPos)[1], ((u32 *)diffPos)[2]);
|
||||
} else {
|
||||
jiggySpawn(JIGGY_23_BGS_HUTS, diffPos);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
this->marker->propPtr->unk8_3 = 0;
|
||||
if(0.99 < animctrl_getAnimTimer(this->animctrl)){
|
||||
this->state = 3;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
this->marker->propPtr->unk8_3 = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
||||
}
|
||||
}
|
119
src/BGS/done/ch/pinkegg.c
Normal file
119
src/BGS/done/ch/pinkegg.c
Normal file
@@ -0,0 +1,119 @@
|
||||
#include <ultra64.h>
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
|
||||
typedef struct chpinkegg_s{
|
||||
u32 unk0;
|
||||
u32 unk4;
|
||||
} ActorLocal_PinkEgg;
|
||||
|
||||
void chpinkegg_draw(ActorMarker *this, Gfx ** gdl, Mtx** mptr, u32 arg3);
|
||||
void chpinkegg_collision(ActorMarker *this, ActorMarker *other_marker);
|
||||
void chpinkegg_update(Actor *this);
|
||||
|
||||
u32 D_803906C0 = 0x5B;
|
||||
enum actor_e D_803906C4[5] = {0xED, 0xEE, 0xEF, 0xF0, 0x00};
|
||||
ActorAnimationInfo D_803906D8[4] = {
|
||||
{0, 0.0f},
|
||||
{0, 0.0f},
|
||||
{0, 0.0f},
|
||||
{0x10B, 2.0f}
|
||||
};
|
||||
|
||||
ActorInfo D_803906F8 = {0x6E, 0x5B, 0x380, 0x01, D_803906D8,
|
||||
chpinkegg_update, func_80326224, chpinkegg_draw,
|
||||
0, 0x2CC, 6.0f, 0
|
||||
};
|
||||
|
||||
ActorInfo D_8039071C = {0xD6, 0xED, 0x381, 0x01, D_803906D8,
|
||||
chpinkegg_update, func_80326224, chpinkegg_draw,
|
||||
0, 0x2CC, 5.0f, 0
|
||||
};
|
||||
|
||||
ActorInfo D_80390740 = {0xD7, 0xEE, 0x382, 0x01, D_803906D8,
|
||||
chpinkegg_update, func_80326224, chpinkegg_draw,
|
||||
0, 0x2CC, 4.0f, 0
|
||||
};
|
||||
|
||||
ActorInfo D_80390764 = {0xD8, 0xEF, 0x383, 0x01, D_803906D8,
|
||||
chpinkegg_update, func_80326224, chpinkegg_draw,
|
||||
0, 0x2CC, 3.0f, 0
|
||||
};
|
||||
|
||||
ActorInfo D_80390788 = {0xD9, 0xF0, 0x384, 0x01, D_803906D8,
|
||||
chpinkegg_update, func_80326224, chpinkegg_draw,
|
||||
0, 0x2CC, 2.0f, 0
|
||||
};
|
||||
|
||||
/* .code */
|
||||
void chpinkegg_spawn_next(ActorMarker * arg0, u32 arg1){
|
||||
ActorLocal_PinkEgg *local;
|
||||
Actor *actorPtr;
|
||||
Actor *unkActor;
|
||||
actorPtr = marker_getActor(arg0);
|
||||
local = (ActorLocal_PinkEgg *)&actorPtr->local;
|
||||
unkActor = spawn_child_actor( D_803906C4[arg1], &actorPtr);
|
||||
|
||||
((ActorLocal_PinkEgg *) &unkActor->local)->unk0 = arg1 + 1;
|
||||
((ActorLocal_PinkEgg *) &unkActor->local)->unk4 = 5;
|
||||
unkActor->marker->collidable = 0;
|
||||
|
||||
}
|
||||
|
||||
void chpinkegg_draw(ActorMarker *this, Gfx ** gdl, Mtx** mptr, u32 arg3){
|
||||
u32 sp18;
|
||||
u32 t7;
|
||||
|
||||
t7 = marker_getActor(this)->state == 3;
|
||||
func_8033A45C(1, (sp18 = t7) ^ 1);
|
||||
func_8033A45C(2, sp18);
|
||||
func_80325888(this, gdl, mptr, arg3);
|
||||
}
|
||||
|
||||
|
||||
void chpinkegg_collision(ActorMarker *this, ActorMarker *other_marker){
|
||||
Actor *thisActor;
|
||||
ActorLocal_PinkEgg *tmp;
|
||||
|
||||
thisActor = marker_getActor(this);
|
||||
this->propPtr->unk8_3 = 0;
|
||||
func_8030E510(SFX_AA_BGS_EGG_BREAKING_1, 28000);
|
||||
func_80328A84(thisActor, 3);
|
||||
actor_playAnimationOnce(thisActor);
|
||||
this->collidable = 0;
|
||||
thisActor->unk124_6 = 0;
|
||||
if(D_803906C4[(tmp = (ActorLocal_PinkEgg *) &thisActor->local)->unk0] != 0){
|
||||
func_802C3D3C(chpinkegg_spawn_next, thisActor->marker, tmp->unk0);
|
||||
} else {
|
||||
jiggySpawn(JIGGY_21_BGS_PINKEGG, thisActor->position);
|
||||
func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000);
|
||||
}
|
||||
}
|
||||
|
||||
void chpinkegg_update(Actor *this){
|
||||
if(!this->initialized){
|
||||
this->marker->propPtr->unk8_3 = 1;
|
||||
marker_setCollisionScripts(this->marker, NULL, NULL, chpinkegg_collision);
|
||||
this->initialized = 1;
|
||||
}
|
||||
|
||||
switch(this->state){
|
||||
case 1:
|
||||
if(!((ActorLocal_PinkEgg *) &this->local)->unk4){
|
||||
this->marker->collidable = 1;
|
||||
func_80328A84(this,2);
|
||||
|
||||
}else{
|
||||
((ActorLocal_PinkEgg *) &this->local)->unk4--;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if(animctrl_isStopped(this->animctrl)){
|
||||
func_80326310(this);
|
||||
if(this->alpha_124_19 < 0x60){
|
||||
this->unk124_9 = 0x2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
68
src/BGS/done/code_8DF0.c
Normal file
68
src/BGS/done/code_8DF0.c
Normal file
@@ -0,0 +1,68 @@
|
||||
#include <ultra64.h>
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
#include "prop.h"
|
||||
|
||||
extern ActorInfo D_80390804;
|
||||
extern ActorInfo D_80390690;
|
||||
extern ActorInfo D_803906F8;
|
||||
extern ActorInfo D_8039071C;
|
||||
extern ActorInfo D_80390740;
|
||||
extern ActorInfo D_80390764;
|
||||
extern ActorInfo D_80390788;
|
||||
extern ActorInfo D_80390B68;
|
||||
extern ActorInfo D_80390C40;
|
||||
extern ActorInfo D_80390C88;
|
||||
extern ActorInfo D_80390CC8;
|
||||
extern ActorInfo D_80390D08;
|
||||
extern ActorInfo D_80390D48;
|
||||
extern ActorInfo D_80390AB0;
|
||||
extern ActorInfo D_80390AE0;
|
||||
extern ActorInfo D_80390960;
|
||||
extern ActorInfo D_80390A40;
|
||||
extern ActorInfo D_80390A70;
|
||||
extern ActorInfo D_80390830;
|
||||
extern ActorInfo D_80390880;
|
||||
extern ActorInfo D_803908A4;
|
||||
extern ActorInfo D_803908C8;
|
||||
extern ActorInfo D_803908EC;
|
||||
extern ActorInfo D_80390910;
|
||||
extern ActorInfo D_80390934;
|
||||
extern ActorInfo D_80390DA8;
|
||||
extern ActorInfo D_80390D70;
|
||||
extern ActorInfo D_80390BD8;
|
||||
extern ActorInfo D_80390BFC;
|
||||
|
||||
void bgs_func_8038F1E0(void){//bgs_updateSpawnableActors
|
||||
spawnableActorList_add(&D_80390804, actor_new, 0x00000088);//croctus
|
||||
spawnableActorList_add(&D_80390690, actor_new, 0x020108A1); //flibbit
|
||||
spawnableActorList_add(&D_803906F8, actor_new, 0x400); //pink_egg_largest
|
||||
spawnableActorList_add(&D_8039071C, actor_new, 0x400); //pink_egg_large
|
||||
spawnableActorList_add(&D_80390740, actor_new, 0x400); //pink_egg_medium
|
||||
spawnableActorList_add(&D_80390764, actor_new, 0x400); //pink_egg_small
|
||||
spawnableActorList_add(&D_80390788, actor_new, 0x400); //pink_egg_smallest
|
||||
spawnableActorList_add(&D_80390B68, actor_new, 0); //mudhut_top
|
||||
spawnableActorList_add(&D_80390C40, actor_new, 0x4000548);//tanktup
|
||||
spawnableActorList_add(&D_80390C88, actor_new, 0x400042c);//tanktup_leg
|
||||
spawnableActorList_add(&D_80390CC8, actor_new, 0x400042c);//tanktup_leg
|
||||
spawnableActorList_add(&D_80390D08, actor_new, 0x400042c);//tanktup_leg
|
||||
spawnableActorList_add(&D_80390D48, actor_new, 0x400042c);//tanktup_leg
|
||||
spawnableActorList_add(&D_80390AB0, actor_new, 0x81);
|
||||
spawnableActorList_add(&D_80390AE0, actor_new, 0x20108a1); //yellow_flibbit
|
||||
spawnableActorList_add(&D_80390960, actor_new, 0);
|
||||
spawnableActorList_add(&D_80390A40, actor_new, 0x880); //yumblie
|
||||
spawnableActorList_add(&D_80390A70, actor_new, 0x9a2); //mr. vile
|
||||
spawnableActorList_add(&D_80390830, actor_new, 0x888); //tiptup
|
||||
spawnableActorList_add(&D_80390880, actor_new, 0x9a8); //tiptup_chiorMember
|
||||
spawnableActorList_add(&D_803908A4, actor_new, 0x9a8); //tiptup_chiorMember
|
||||
spawnableActorList_add(&D_803908C8, actor_new, 0x9a8); //tiptup_chiorMember
|
||||
spawnableActorList_add(&D_803908EC, actor_new, 0x9a8); //tiptup_chiorMember
|
||||
spawnableActorList_add(&D_80390910, actor_new, 0x9a8); //tiptup_chiorMember
|
||||
spawnableActorList_add(&D_80390934, actor_new, 0x9a8); //tiptup_chiorMember
|
||||
spawnableActorList_add(&D_80390DA8, actor_new, 0x4000); //leafboat
|
||||
spawnableActorList_add(&D_80390D70, actor_new, 0x580); //bigAlligator
|
||||
spawnableActorList_add(&D_80390BD8, actor_new, 8); //green_jiggy_switch
|
||||
spawnableActorList_add(&D_80390BFC, actor_new, 8); //green_jiggy_switch
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user