GV/ch documentation

This commit is contained in:
Banjo Kazooie
2023-01-22 23:34:04 -06:00
parent caf02e0232
commit da9a0109b5
19 changed files with 469 additions and 466 deletions

267
src/GV/ch/ancientone.c Normal file
View File

@@ -0,0 +1,267 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern void func_80244BB0(s32, s32, s32, f32);
typedef struct {
f32 unk0[3];
u32 unk4_31:1;
u32 unk4_30:31;
f32 unk10[3];
f32 unk1C;
}ActorLocal_chAncientOne;
#define LOCAL_CH_ANCIENT_ONE(s) ((ActorLocal_chAncientOne *)&s->local)
void chAncientOne_update(Actor *this);
Actor *chAncientOne_draw(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
/* .data */
s16 GV_D_80390C20[4] = {5, 6, 7, 8};
ActorMarker *D_80390C28[5] = {NULL};
ActorAnimationInfo chAncientOneAnimations[] = {
{0, 0.0f},
{0, 0.0f},
{ASSET_ED_ANIM_ANCIENT_ONE, 2.0f},
{ASSET_ED_ANIM_ANCIENT_ONE, 33000000.f}
};
ActorInfo chAncientOne = { MARKER_F4_ANCIENT_ONE, ACTOR_147_ANCIENT_ONE, ASSET_3E8_MODEL_ANCIENT_ONE,
0x1, chAncientOneAnimations,
chAncientOne_update, func_80326224, chAncientOne_draw,
0, 0x100, 0.0f, 0
};
/* .code */
void func_80386620(Actor *this){
int i;
s32 *temp_v0;
ActorMarker *temp_a0;
s32 temp_a1;
Actor *temp_v0_3;
s32 phi_s2;
s32 phi_s1;
s32 phi_s3;
for(i = 0; i <5; i++){
if(D_80390C28[i] == NULL)
return;
}
GV_D_80390C20[0] = 5;
GV_D_80390C20[1] = 6;
GV_D_80390C20[2] = 7;
GV_D_80390C20[3] = 8;
phi_s3 = (randf() * 1.0737418e9f);
phi_s2 = 1;
phi_s1 = 0;
while(phi_s2 != 0x40000000){
if ((phi_s3 & phi_s2) != 0) {
temp_a1 = GV_D_80390C20[phi_s1];
GV_D_80390C20[phi_s1] = GV_D_80390C20[phi_s1 + 1];
GV_D_80390C20[phi_s1 + 1] = temp_a1;
temp_a0 = D_80390C28[phi_s1 + 1];
D_80390C28[phi_s1 + 1] = D_80390C28[phi_s1 + 2];
D_80390C28[phi_s1 + 2] = temp_a0;
temp_v0_3 = marker_getActor(D_80390C28[phi_s1 + 1]);
temp_v0_3->unkF4_8 = phi_s1 + 2;
temp_v0_3 = marker_getActor(D_80390C28[phi_s1 + 2]);
temp_v0_3->unkF4_8 = phi_s1 + 3;
}
phi_s1 = (phi_s1 == 2) ? 0 : phi_s1 + 1;
phi_s2 <<= 1;
};
}
void func_8038678C(void){
func_80244BB0(3, 0x85, 0x7ff8, 1.0f);
func_80244BB0(4, 0x85, 0x7ff8, 1.0f);
}
void func_803867CC(void){
func_80244C78(3);
func_80244C78(4);
}
void func_803867F4(void){
f32 sp24[3];
func_802BAFE4(4);
if(nodeProp_findPositionFromActorId(0x148, sp24)){
jiggySpawn(JIGGY_46_GV_ANCIENT_ONES, sp24);
__spawnQueue_add_4((GenMethod_4)func_802C4140, 0x4C, reinterpret_cast(s32, sp24[0]), reinterpret_cast(s32, sp24[1]), reinterpret_cast(s32, sp24[2]));
}
}
void func_80386850(ActorMarker *caller_marker, enum asset_e text_id, s32 arg2){
Actor *caller = marker_getActor(caller_marker);
if(text_id == 0xA80){
func_80328B8C(caller, 2, 0.0f, 1);
actor_playAnimationOnce(caller);
func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7fff);
timedFunc_set_0(1.0f, func_803867F4);
}
}
void chAncientOne_update(Actor *this){
f32 sp44[3];
s32 sp40;
s32 sp38;
s32 pad;
f32 sp34;
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
if(jiggyscore_isSpawned(JIGGY_46_GV_ANCIENT_ONES)){
marker_despawn(this->marker);
return;
}
}
if(!this->initialized){
if(D_80390C28[this->unkF4_8 - 1])
return;
LOCAL_CH_ANCIENT_ONE(this)->unk1C = this->position_y;
this->position_y -= 1100.0f;
D_80390C28[this->unkF4_8 - 1] = this->marker;
if(this->unkF4_8 != 1){
this->marker->propPtr->unk8_4 = FALSE;
}
this->marker->propPtr->unk8_3 = TRUE;
actor_collisionOff(this);
func_80386620(this);
}
else{//L803869B4
switch(this->state){
case 1: //L803869E4
player_getPosition(sp44);
sp44[0] -= LOCAL_CH_ANCIENT_ONE(this)->unk10[0];
sp44[1] -= LOCAL_CH_ANCIENT_ONE(this)->unk10[1];
sp44[2] -= LOCAL_CH_ANCIENT_ONE(this)->unk10[2];
sp40 = (0.0f <= sp44[0]*LOCAL_CH_ANCIENT_ONE(this)->unk0[0] + sp44[1]*LOCAL_CH_ANCIENT_ONE(this)->unk0[1] + sp44[2]*LOCAL_CH_ANCIENT_ONE(this)->unk0[2]) ? 0 : 1;
if(LOCAL_CH_ANCIENT_ONE(this)->unk1C <= this->position_y){
this->position_y = LOCAL_CH_ANCIENT_ONE(this)->unk1C;
if( sp40 == (LOCAL_CH_ANCIENT_ONE(this)->unk4_31 ^ 1)){
if((sp44[0]*sp44[0] + sp44[1]*sp44[1] + sp44[2]*sp44[2]) < (f32)LOCAL_CH_ANCIENT_ONE(this)->unk4_30){
func_8025A6EC(COMUSIC_2B_DING_B, 28000);
for(sp38= 7; sp38< 0xC && mapSpecificFlags_get(sp38);sp38++);
mapSpecificFlags_set(sp38, TRUE);
if(sp38== 0xB){
if(!jiggyscore_isCollected(JIGGY_46_GV_ANCIENT_ONES)){
func_80311480(ASSET_A80_TEXT_ANICIENT_ONES_DONE, 0xE, NULL, this->marker, func_80386850, NULL);
}
else{
func_80386850(this->marker, 0xA80, -1);
}
}//L80386B98
else {
if(sp38== 7){
if(!jiggyscore_isCollected(JIGGY_46_GV_ANCIENT_ONES)){
func_80311480(ASSET_A7F_TEXT_ANICIENT_ONES_MEET, 0x4, NULL, NULL, NULL, NULL);
}
}
func_80328B8C(this, 2, 0.0f, 1);
actor_playAnimationOnce(this);
if(this->unkF4_8 < 5){
D_80390C28[this->unkF4_8]->propPtr->unk8_4 = TRUE;
func_802BAFE4(GV_D_80390C20[this->unkF4_8 - 1]);
func_80244BB0(2, 0x86, 0x7ff8, 0.3f);
timedFunc_set_0(0.45f, func_8038678C);
}//L80386DB0
}
}
}
}
else{//L80386C64
sp38 = func_8023DB5C() & 0xF;
sp34 = LOCAL_CH_ANCIENT_ONE(this)->unk1C + 40.0f;
this->position_y += 18.0;
this->position_x += (sp38 & 1) ? 0x17 : -0x17;
this->position_z += (sp38 & 2) ? 0xC : -0xC;
if(this->unkF4_8 != 1){
if(sp38 == 6){
__spawnQueue_add_4((GenMethod_4)func_802C4140, 0x4C, reinterpret_cast(s32, this->position_x), reinterpret_cast(s32, sp34), reinterpret_cast(s32, this->position_z));
}
if(sp38 == 4 && this->position_y < LOCAL_CH_ANCIENT_ONE(this)->unk1C - 600.0f){
__spawnQueue_add_4((GenMethod_4)func_802C4140, 0x11f, reinterpret_cast(s32, this->position_x), reinterpret_cast(s32, sp34), reinterpret_cast(s32, this->position_z));
}//L80386D80
}
if(LOCAL_CH_ANCIENT_ONE(this)->unk1C <= this->position_y){
func_80244C78(2);
timedFunc_set_0(0.5f, func_803867CC);
}
}//L80386DB0
LOCAL_CH_ANCIENT_ONE(this)->unk4_31 = sp40;
break;
case 2: //L80386DCC
if(actor_animationIsAt(this, 0.999f)){
func_80328B8C(this, 3, 0.9999f, 1);
actor_playAnimationOnce(this);
}
break;
case 3: //L80386E04
if(LOCAL_CH_ANCIENT_ONE(this)->unk1C - 1100.0f < this->position_y){
this->position_y -= 10.0;
}
else{
this->marker->propPtr->unk8_4 = FALSE;
}
break;
}//L80386E60
}//L80386E60
}
Actor *chAncientOne_draw(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
Actor *this = marker_getActor(this_marker);
int sp58;
s32 sp4C[3];
s32 sp40[3];
s32 sp34[3];
f32 sp28[3];
s32 tmp_v0;
sp58 = (this->state == 3) ? 0 : 1;
func_8033A45C(3, sp58);
func_8033A45C(4, sp58);
func_80325888(this_marker, gfx, mtx, vtx);
if( !this->initialized && this_marker->unk14_21){
func_8034A1B4(func_80329934(), 5, sp4C);
func_8034A1B4(func_80329934(), 6, sp40);
func_8034A1B4(func_80329934(), 7, sp34);
sp4C[1] += 1100;
sp40[1] += 1100;
sp34[1] += 1100;
LOCAL_CH_ANCIENT_ONE(this)->unk0[0] = (sp4C[0] - sp40[0]);
LOCAL_CH_ANCIENT_ONE(this)->unk0[1] = (sp4C[1] - sp40[1]);
LOCAL_CH_ANCIENT_ONE(this)->unk0[2] = (sp4C[2] - sp40[2]);
player_getPosition(sp28);
sp28[0] -= sp40[0];
sp28[1] -= sp40[1];
sp28[2] -= sp40[2];
if(0.0f <= sp28[0] *LOCAL_CH_ANCIENT_ONE(this)->unk0[0] + sp28[1]*LOCAL_CH_ANCIENT_ONE(this)->unk0[1] + sp28[2]*LOCAL_CH_ANCIENT_ONE(this)->unk0[2])
LOCAL_CH_ANCIENT_ONE(this)->unk4_31 = FALSE;
else
LOCAL_CH_ANCIENT_ONE(this)->unk4_31 = TRUE;
LOCAL_CH_ANCIENT_ONE(this)->unk10[0] = (f32)sp40[0];
LOCAL_CH_ANCIENT_ONE(this)->unk10[1] = (f32)sp40[1];
LOCAL_CH_ANCIENT_ONE(this)->unk10[2] = (f32)sp40[2];
tmp_v0 = (sp34[1]- sp40[1]);
LOCAL_CH_ANCIENT_ONE(this)->unk4_30 = (s32)(0.95*(f32)(tmp_v0*tmp_v0));
this->initialized = TRUE;
}
return this;
}
void GV_func_80387118(void){
int i;
for(i = 0; i < 5; i++){
D_80390C28[i] = NULL;
}
}

80
src/GV/ch/buriedpyramid.c Normal file
View File

@@ -0,0 +1,80 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
typedef struct{
f32 transistion_timer;
s32 raised_state;
}ActorLocal_chBuriedPyramid;
void chBuriedPyramid_update(Actor *this);
Actor *chBuriedPyramid_draw(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
/* .data */
ActorInfo chBuriedPyramid = { MARKER_1D4_SANDYBUTT_PYRAMID, ACTOR_31D_SANDYBUTT_PYRAMID, ASSET_56B_MODEL_SANDYBUTT_PYRAMID,
0, NULL,
chBuriedPyramid_update, NULL, chBuriedPyramid_draw,
0, 0, 0.0f, 0
};
/* .code */
void __chBuriedPyramid_setState(Actor *this, s32 next_state){
s32 sp1C;
if(next_state == 2){
sp1C = func_802F9AA8(SFX_3EC_CCW_DOOR_OPENING);
func_802F9DB8(sp1C, 0.7f, 0.9f, 0.03f);
func_802F9F80(sp1C, 0.3f, 2.4f, 0.3f);
func_802FA060(sp1C, 32000, 32000, 0.0f);
}
this->state = next_state;
}
Actor *chBuriedPyramid_draw(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
Actor *this = marker_getActor(this_marker);
ActorLocal_chBuriedPyramid *local = (ActorLocal_chBuriedPyramid *)&this->local;
if(local->raised_state == 0){
return func_80325340(this_marker, gfx, mtx, vtx);
}
else{
return func_80325888(this_marker, gfx, mtx, vtx);
}
}
void chBuriedPyramid_setRaisedAmount(ActorMarker *this_marker, s32 arg1){
Actor *this = marker_getActor(this_marker);
ActorLocal_chBuriedPyramid *local = (ActorLocal_chBuriedPyramid *)&this->local;
local->transistion_timer = 0.0f;
local->raised_state = arg1;
__chBuriedPyramid_setState(this, 2);
}
void chBuriedPyramid_update(Actor *this){
ActorLocal_chBuriedPyramid *local = (ActorLocal_chBuriedPyramid *)&this->local;
f32 max;
f32 min;
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
this->marker->propPtr->unk8_3 = TRUE;
local->raised_state = func_8031FF44(BKPROG_F8_KING_SANDYBUTT_PYRAMID_STATE, 2);
this->position_x = 67.0f;
this->position_y = (local->raised_state/3.0)*1050.0 + 1375.0;
this->position_z = 400.0f;
__chBuriedPyramid_setState(this, 1);
}//L8038FE48
if(this->state == 2){
local->transistion_timer += time_getDelta()/3.0f;
if(1.0f < local->transistion_timer)
local->transistion_timer = 1.0f;
min = ((local->raised_state - 1)/3.0)*1050.0 + 1375.0;
max = (local->raised_state/3.0)*1050.0 + 1375.0;
this->position_y = local->transistion_timer*(max - min) + min;
if(1.0f == local->transistion_timer)
__chBuriedPyramid_setState(this, 1);
}//L8038FF48
}

233
src/GV/ch/gobi1.c Normal file
View File

@@ -0,0 +1,233 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern func_802EBA98(s32, f32[3], s32, f32, s32, f32[3], f32, f32[3]);
typedef struct {
u8 unk0[2];
//u8 pad2[2];
f32 unk4;
f32 unk8;
f32 unkC;
f32 unk10;
f32 unk14;
}ActorLocal_chGobi1;
void chGobi1_update(Actor *this);
Actor *chgobi1_draw(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
/* .data */
ActorInfo Gobi1 = { MARKER_BC_GOBI_1, ACTOR_12E_GOBI_1, ASSET_3E0_MODEL_GOBI,
0, NULL,
NULL, chGobi1_update, chgobi1_draw,
0, 0x533, 0.0f, 0
};
/* .bss */
struct {
u8 unk0;
u8 unk1;
}GV_D_80391A40;
/* .code */
void chGobi1_setState(Actor *this, s32 next_state){
ActorLocal_chGobi1 *local = (ActorLocal_chGobi1 *)&this->local;
this->state = next_state;
GV_D_80391A40.unk0 = FALSE;
GV_D_80391A40.unk1 = FALSE;
if(this->state == 1){
func_80335924(this->unk148, 0xd9, 0.5f, 4.0f);
local->unk4 = randf2(2.0f, 10.0f);
}
if(this->state == 2){
func_80335924(this->unk148, 0xda, 1.0f, 5.0f);
local->unkC = 0.9f;
GV_D_80391A40.unk0 = TRUE;
}
if(this->state == 3){
func_8028F918(2);
func_80335924(this->unk148, 0xf7, 1.0f, 5.33f);
local->unk14 = 0.01f;
GV_D_80391A40.unk1 = TRUE;
}
if(this->state == 4){
func_80335924(this->unk148, 0xf8, 0.7f, 0.71f);
}
if(this->state == 6){
FUNC_8030E8B4(SFX_84_GOBI_CRYING, 0.9f, 20000, this->position, 1500, 2500);
func_80335924(this->unk148, 0x241, 0.2f, 0.5f);
}
}
Actor *chgobi1_draw(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
Actor *this = marker_getActor(this_marker);
if(this->state == 0 || this->state == 5){
return this;
}
else{
return func_80325888(this_marker, gfx, mtx, vtx);
}
}
s32 func_80387354(void){
return GV_D_80391A40.unk0;
}
s32 func_80387360(void){
return GV_D_80391A40.unk1;
}
void func_8038736C(Actor *this){
ActorLocal_chGobi1 *local = (ActorLocal_chGobi1 *)&this->local;
chGobi1_setState(this, 0);
func_8030DA44(local->unk0[0]);
func_8030DA44(local->unk0[1]);
}
void func_803873B0(ActorMarker *this_marker, ActorMarker *other_marker){
Actor *this = marker_getActor(this_marker);
if( player_getActiveHitbox(NULL) == HITBOX_A_FAST_FALLING
|| player_getActiveHitbox(NULL) == HITBOX_1_BEAK_BUSTER
){
this->unk1C[0] = 1.0f;
}
}
void chGobi1_update(Actor *this){
ActorMarker *marker = this->marker;
ActorLocal_chGobi1 *local = (ActorLocal_chGobi1 *)&this->local;
s32 sp6C = 0;
f32 tick; //sp68;
int i;
s32 tmp_s1;
f32 sp54[3];
f32 sp48[3];
tick = time_getDelta();
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
marker_setCollisionScripts(this->marker, func_803873B0, NULL, NULL);
marker->unk30 = func_8038736C;
marker->propPtr->unk8_3 = TRUE;
marker->collidable = TRUE;
GV_D_80391A40.unk0 = 0;
GV_D_80391A40.unk1 = 0;
local->unk0[0] = func_8030D90C();
local->unk0[1] = func_8030D90C();
local->unk8 = 0.0f;
local->unkC = 0.0f;
local->unk10 = 0.0f;
local->unk14 = 0.0f;
this->unk1C[0] = 0.0f;
this->unk1C[1] = 0.0f;
chGobi1_setState(this, 1);
if(jiggyscore_isSpawned(JIGGY_44_GV_GOBI_1) && ! func_803203FC(1)){
marker_despawn(this->marker);
}
return;
}//L80387514
if(func_8025773C(&local->unk8, tick))
sp6C = 5;
if(func_8025773C(&local->unkC, tick))
FUNC_8030E8B4(SFX_84_GOBI_CRYING, 0.9f, 32000, this->position, 1500, 2500);
if(func_8025773C(&local->unk10, tick)){
for(i = 0; i < 2; i++){
sfxsource_setSfxId(local->unk0[i], SFX_3F9_UNKNOWN);
func_8030DD14(local->unk0[i], 3);
sfxsource_setSampleRate(local->unk0[i], 32000);
func_8030E2C4(local->unk0[i]);
}
}
if(func_8025773C(&local->unk14, tick)){
local->unk10 = 0.75f;
local->unk8 = 7.5f;
timed_setCameraToNode(0.5f, 0xa);
timed_playSfx(1.0f, SFX_84_GOBI_CRYING, 1.1f, 30000);
timed_playSfx(2.0f, SFX_84_GOBI_CRYING, 1.3f, 30000);
timed_playSfx(2.5f, SFX_74_WALKING_NOISE_5, 0.5f, 30000);
func_80324DBC(3.0f, ASSET_A74_TEXT_GOBI_HELPED, 0x2a, this->position, NULL, NULL, NULL);
timed_playSfx(5.0f, SFX_2E_BIGBUTT_RUNNING, 1.0f, 20000);
timed_playSfx(5.6f, SFX_2E_BIGBUTT_RUNNING, 1.0f, 20000);
timed_playSfx(6.5f, SFX_2E_BIGBUTT_RUNNING, 1.0f, 20000);
func_80324E88(7.6f);
}
if(this->state == 1 || this->state == 2){
if(chGobiRock_isDestroyed())
sp6C = 3;
}
if(this->state == 2){
if(func_80335794(this->unk148) > 0)
sp6C = 1;
}
if(this->state == 1 || this->state == 2){
if( !this->unk138_24
&& func_80329530(this, 250)
&& !func_80329530(this, 80)
&& func_8028F2A0()
&& func_80311480(0xa73, 0, NULL, NULL, NULL, NULL)
){
this->unk138_24 = 1;
}
}//L803877A4
if(this->state == 1){
if(this->unk1C[0] != 0.0f && this->unk1C[1] == 0.0f ){
sp6C = 6;
}//L803877F0
else{
if(func_8025773C(&local->unk4, tick))
sp6C = 2;
}
}//L80387808
if(this->state == 3){
if(func_80335794(this->unk148) > 0)
sp6C = 4;
}//L80387830
if(this->state == 4){
func_80326224(this);
tmp_s1 = func_8033A12C(func_80330B1C(this->marker));
if(tmp_s1){
player_getPosition(sp54);
sp54[1] += 50.0f;
if(func_802EBA98(tmp_s1, this->position, 0, 1.0f, 0, sp54, 40.0f, sp48)){
func_8028F428(2, this->marker);
}
}
}
if(this->state == 5){
if(timedFuncQueue_is_empty()){
func_8028F918(0);
marker_despawn(this->marker);
}
}
if(this->state == 6){
if(func_80335794(this->unk148) > 0)
sp6C = 1;
}
this->unk1C[1] = this->unk1C[0];
this->unk1C[0] = 0.0f;
if(sp6C)
chGobi1_setState(this, sp6C);
}

238
src/GV/ch/gobi2.c Normal file
View File

@@ -0,0 +1,238 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
typedef struct {
u8 pad0[4];
Struct80s *unk4;
BKModelBin *unk8;
}ActorLocal_Gobi2;
void chGobi2_setState(Actor *this, s32 next_state);
void chGobi2_update(Actor *this);
Actor *chGobi2_draw(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
/* .data */
ActorInfo chGobi2 = { MARKER_BF_GOBI_2, ACTOR_131_GOBI_2, ASSET_3E0_MODEL_GOBI,
0x0, NULL,
NULL, chGobi2_update, chGobi2_draw,
0, 0x533, 0.0f, 0
};
/* .bss */
u8 D_80391A50;
/* .code */
void GV_func_80387960(void){
static f32 D_80390CD4[3] = {1475.0f, 442.0f, 8870.0f};
func_8028F490(D_80390CD4);
}
void func_80387984(ActorMarker *this){
mapSpecificFlags_set(0xC, 1);
}
void __chGobi2_spawnJIggy(void){
static f32 jiggy_position[3] = {1150.0f, 1150.0f, 9200.0f};
jiggySpawn(JIGGY_45_GV_GOBI_2, jiggy_position);
}
void func_803879D4(ActorMarker *this_marker){
Actor *this = marker_getActor(reinterpret_cast(ActorMarker *, this_marker));
chGobi2_setState(this, 4);
}
void GV_func_80387A00(ActorMarker *this_marker){
Actor *this = marker_getActor(reinterpret_cast(ActorMarker *, this_marker));
chGobi2_setState(this, 7);
}
void func_80387A2C(ActorMarker *caller, enum asset_e text_id, s32 arg2){
timed_setCameraToNode(0.0f, 0xC);
timedFunc_set_1(0.5f, (GenMethod_1) func_80387984, reinterpret_cast(s32, caller));
timed_playSfx(0.5f, SFX_2C_PULLING_NOISE, 0.9f, 32000);
timed_playSfx(1.8f, SFX_2C_PULLING_NOISE, 1.0f, 32000);
timed_playSfx(2.5f, SFX_2C_PULLING_NOISE, 1.1f, 32000);
timed_setCameraToNode(3.0f, 0xd);
timedFunc_set_0(3.5f, __chGobi2_spawnJIggy);
func_80324E88(6.0f);
timedFunc_set_1(6.0f, (GenMethod_1) GV_func_80387A00, reinterpret_cast(s32, caller));
func_80324E38(6.0f, 0);
}
void chGobi2_setState(Actor *this, s32 next_state){
static f32 D_80390CEC[3] = {1145.0f, 443.0f, 9197.0f};
ActorLocal_Gobi2 *local = (ActorLocal_Gobi2 *)&this->local;
if(next_state == 1)
actor_collisionOff(this);
if(this->state == 1)
actor_collisionOn(this);
if(next_state == 2){
this->marker->propPtr->unk8_3 = TRUE;
func_80335924(this->unk148, ASSET_F4_ANIM_GOBI_IDLE, 0.5f, 12.0f);
}
if(next_state == 3){
timedFunc_set_0(0.05f, GV_func_80387960);
timed_playSfx(0.05f, SFX_84_GOBI_CRYING, 1.1f, 32000);
func_80324E38(0.051f, 1);
timedFunc_set_1(0.06f, (GenMethod_1)func_803879D4, reinterpret_cast(s32, this->marker));
timed_setCameraToNode(0.86f, 0xb);
timed_playSfx(0.8f, SFX_4B_GULPING, 0.8f, 28000);
timed_playSfx(1.4f, SFX_4B_GULPING, 0.8f, 28000);
timed_playSfx(2.0f, SFX_4B_GULPING, 0.8f, 28000);
func_80324DBC(3.0f, ASSET_A72_TEXT_TRUNKER_HELPED, 0x2A, D_80390CEC, this->marker, func_80387A2C, NULL);
}//L80387C94
if(next_state == 4){
func_80335924(this->unk148, ASSET_FC_ANIM_GOBI_SPITTING, 0.2f, 3.0f);
func_80335924(local->unk4, ASSET_100_ANIM_GOBI_SPIT, 0.0f, 3.0f);
}
if(next_state == 5){
func_80335924(this->unk148, ASSET_FD_ANIM_GOBI2_GETTING_UP, 0.43f, 0.5f);
func_80335A8C(this->unk148, 2);
}
if(next_state == 6){
func_80335924(this->unk148, ASSET_F8_ANIM_GOBI_RUNNING, 0.4f, 0.71f);
func_80335A8C(this->unk148, 1);
}
if(next_state == 7){
marker_despawn(this->marker);
}
if(next_state == 8){
FUNC_8030E8B4(SFX_84_GOBI_CRYING, 0.9f, 20000, this->position, 1500, 2500);
func_80335924(this->unk148, ASSET_242_ANIM_GOBI_RELAXING, 0.2f, 0.5f);
}
this->state = next_state;
}
Actor *chGobi2_draw(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
Actor *this = marker_getActor(this_marker);
ActorLocal_Gobi2 *local = (ActorLocal_Gobi2 *)&this->local;
f32 sp3C[3];
if(this->state == 0 || this->state == 1){
return this;
}
if(this->state == 6)
func_8033A280(2.0f);
sp3C[0] = this->pitch;
sp3C[1] = this->yaw;
sp3C[2] = this->roll;
func_8033A238(func_803356A0(this->unk148));
modelRender_preDraw((GenMethod_1)func_803253A0, (s32)this);
modelRender_draw(gfx, mtx, this->position, sp3C, 1.0f, NULL, func_80330B1C(this_marker));
if(this->state == 4){
func_8033A238(func_803356A0(local->unk4));
modelRender_setDepthMode(MODEL_RENDER_DEPTH_COMPARE);
modelRender_draw(gfx, mtx, this->position, sp3C, 1.0f, NULL, local->unk8);
}
return this;
}
void __chGobi2_80387EFC(Actor *this){
ActorLocal_Gobi2 *local = (ActorLocal_Gobi2 *)&this->local;
chGobi2_setState(this, 0);
func_80335874(local->unk4);
assetcache_release(local->unk8);
}
void __chGobi2_ow(ActorMarker *this_marker, ActorMarker *other_marker){
Actor *this = marker_getActor(this_marker);
enum hitbox_e hitbox;
hitbox = player_getActiveHitbox(NULL);
if(hitbox == HITBOX_1_BEAK_BUSTER)
D_80391A50 = TRUE;
else if(hitbox == HITBOX_A_FAST_FALLING){
this->unk1C[0] = 1.0f;
}
}
void chGobi2_update(Actor *this){
ActorMarker *sp34;
ActorLocal_Gobi2 *local = (ActorLocal_Gobi2 *)&this->local;
f32 sp2C;
sp34 = this->marker;
sp2C = time_getDelta();
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
marker_setCollisionScripts(this->marker, __chGobi2_ow, NULL, NULL);
sp34->unk30 = __chGobi2_80387EFC;
local->unk4 = func_803358B4();
local->unk8 = (BKModelBin*) assetcache_get(ASSET_3F3_MODEL_GOBI_SPIT);
D_80391A50 = 0;
this->unk1C[0] = 0.0f;
this->unk1C[1] = 0.0f;
chGobi2_setState(this, 1);
if(jiggyscore_isSpawned(JIGGY_45_GV_GOBI_2))
marker_despawn(this->marker);
return;
}//L80388060
if(this->state == 1){
if(jiggyscore_isCollected(JIGGY_44_GV_GOBI_1))
chGobi2_setState(this, 2);
}
if(this->state == 2){
if(this->unk1C[0] != 0.0f && this->unk1C[1] == 0){
chGobi2_setState(this, 8);
}
else if(D_80391A50){
chGobi2_setState(this, 3);
}
}//L80388114
if(this->state == 2){
if(!this->unk138_24){
if(func_80329530(this, 0xFA) && !func_80329530(this, 0x50)){
if(func_8028F2A0()){
if(func_80311480(ASSET_A75_TEXT_GOBI2_MEET, 0, this->position, NULL, NULL, NULL))
this->unk138_24 = TRUE;
}
}
}
}//L80388194
if(this->state == 4){
func_80335A94(local->unk4, sp2C, 1);
if(func_80335794(this->unk148) > 0){
chGobi2_setState(this, 5);
}
}
if(this->state == 5){
if(func_80335794(this->unk148) > 0){
chGobi2_setState(this, 6);
}
}
if(this->state == 6){
func_80326224(this);
}
if(this->state == 8){
if(func_80335794(this->unk148) > 0){
chGobi2_setState(this, 2);
}
}
D_80391A50 = FALSE;
this->unk1C[1] = this->unk1C[0];
this->unk1C[0] = 0.0f;
}

158
src/GV/ch/gobi3.c Normal file
View File

@@ -0,0 +1,158 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
void chGobi3_setState(Actor *this, s32 next_state);
void chGobi3_update(Actor *this);
Actor *chGobi3_draw(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
/* .data */
ActorInfo chGobi3 = { MARKER_C3_GOBI_3, ACTOR_135_GOBI_3, ASSET_3E0_MODEL_GOBI,
0, NULL,
NULL, chGobi3_update, chGobi3_draw,
0, 0, 0.0f, 0
};
/* .code */
void __chGobi3_func_80388270(Actor *this){
func_8028F428(2, this->marker);
}
void __chGobi3_spawnHoneyComb(Actor *this){
s32 pad24;
f32 sp18[3];
TUPLE_ASSIGN(sp18, -6885.0f, 2383.0f, 1335.0f);
func_802C8F70(this->yaw);
func_802CA1CC(HONEYCOMB_C_GV_GOBI_3);
func_802C937C(0xd, sp18);
}
void __chGobi3_runaway(ActorMarker *caller, enum asset_e text_id, s32 arg2){
Actor *this = marker_getActor(caller);
chGobi3_setState(this, 4);
timed_playSfx(0.0f, SFX_2E_BIGBUTT_RUNNING, 1.0f, 20000);
timed_playSfx(0.0f, SFX_2E_BIGBUTT_RUNNING, 1.0f, 20000);
timed_playSfx(0.65f, SFX_2E_BIGBUTT_RUNNING, 1.0f, 20000);
timed_playSfx(0.65f, SFX_2E_BIGBUTT_RUNNING, 1.0f, 20000);
timed_playSfx(1.25f, SFX_2E_BIGBUTT_RUNNING, 1.0f, 15000);
timed_playSfx(1.25f, SFX_2E_BIGBUTT_RUNNING, 1.0f, 15000);
timed_playSfx(1.81f, SFX_2E_BIGBUTT_RUNNING, 1.0f, 10000);
timed_playSfx(1.81f, SFX_2E_BIGBUTT_RUNNING, 1.0f, 10000);
timed_playSfx(2.6f, SFX_2E_BIGBUTT_RUNNING, 1.0f, 5000);
timed_playSfx(2.6f, SFX_2E_BIGBUTT_RUNNING, 1.0f, 5000);
func_80324E88(3.0f);
func_80324E38(3.0f, 0);
}
void chGobi3_setState(Actor *this, s32 next_state){
if(next_state == 1)
actor_collisionOff(this);
if(this->state == 1)
actor_collisionOn(this);
if(next_state == 2){
this->marker->propPtr->unk8_3 = TRUE;
func_80335924(this->unk148, ASSET_F4_ANIM_GOBI_IDLE, 0.5f, 12.0f);
}
if(next_state == 3){
func_80324E38(0.0f, 3);
timedFunc_set_1(0.02f, (GenMethod_1)__chGobi3_func_80388270, (s32)this);
timed_setCameraToNode(0.1f, 0x12);
timed_playSfx(0.2f, SFX_4C_LIP_SMACK, 1.0f, 32000);
timedFunc_set_1(0.2f, (GenMethod_1)__chGobi3_spawnHoneyComb, (s32)this);
func_80335924(this->unk148, ASSET_FC_ANIM_GOBI_SPITTING, 0.2f, 1.0f);
}
if(next_state == 5){
func_80335924(this->unk148, 0xd9, 0.5f, 4.0f);
func_80311480(ASSET_A77_TEXT_GOBI3_DONE, 0xe, this->position, this->marker, __chGobi3_runaway, NULL);
}
if(next_state == 4){
this->marker->propPtr->unk8_3 = FALSE;
func_80335924(this->unk148, ASSET_F8_ANIM_GOBI_RUNNING, 0.3f, 0.71f);
}
if(next_state == 6){
marker_despawn(this->marker);
}
if(next_state == 7){
FUNC_8030E8B4(SFX_84_GOBI_CRYING, 0.9f, 20000, this->position, 1500, 2500);
func_80335924(this->unk148, ASSET_242_ANIM_GOBI_RELAXING, 0.2f, 0.5f);
}
this->state = next_state;
}
Actor *chGobi3_draw(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
Actor *this = marker_getActor(this_marker);
if(this->state == 0 || this->state == 1) return this;
return func_80325888(this_marker, gfx, mtx, vtx);
}
void chGobi3_ow(ActorMarker *this_marker, ActorMarker *other_marker){
Actor *this = marker_getActor(this_marker);
enum hitbox_e hitbox;
hitbox = player_getActiveHitbox(NULL);
if(hitbox == HITBOX_1_BEAK_BUSTER){
if(this->state == 2)
chGobi3_setState(this, 3);
}
else if(hitbox == HITBOX_A_FAST_FALLING){
this->unk1C[0] = 1.0f;
}
}
void chGobi3_update(Actor *this){
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
marker_setCollisionScripts(this->marker, chGobi3_ow, NULL, NULL);
this->unk1C[0] = 0.0f;
this->unk1C[1] = 0.0f;
chGobi3_setState(this, 1);
if(honeycombscore_get(HONEYCOMB_C_GV_GOBI_3))
marker_despawn(this->marker);
return;
}
if(this->state == 1){
if(jiggyscore_isSpawned(JIGGY_45_GV_GOBI_2))
chGobi3_setState(this, 2);
}
if(this->state == 2){
if(this->unk1C[0] != 0.0f && this->unk1C[1] == 0){
chGobi3_setState(this, 7);
}
}
if(this->state == 3){
if(func_80335794(this->unk148) > 0)
chGobi3_setState(this, 5);
}
if(this->state == 4){
func_80326224(this);
if(timedFuncQueue_is_empty())
chGobi3_setState(this, 6);
}
if(this->state == 7){
if(func_80335794(this->unk148) > 0)
chGobi3_setState(this, 2);
}
this->unk1C[1] = this->unk1C[0];
this->unk1C[0] = 0.0f;
}

132
src/GV/ch/gobirock.c Normal file
View File

@@ -0,0 +1,132 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern void func_802EF3A8(ParticleEmitter *, Gfx **, Mtx **, Vtx**);
typedef struct {
f32 unk0[3];
ParticleEmitter *unkC;
ParticleEmitter *unk10;
f32 unk14;
}ActorLocal_chGobiRock;
void chGobiRock_update(Actor *this);
Actor *chGobiRock_draw(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
/* .data */
ActorInfo chGobiRock = { MARKER_BE_GOBI_ROCK, ACTOR_130_GOBI_ROCK, ASSET_3E4_MODEL_GOBI_ROCK,
0, NULL,
chGobiRock_update, func_80326224, chGobiRock_draw,
0, 0x533, 0.0f, 0
};
/*.bss */
u8 chGobiRockDestroyed;
/* .code */
void __chGobiRock_setState(Actor *this, s32 next_state){
ActorLocal_chGobiRock *local = (ActorLocal_chGobiRock *)&this->local;
this->state = next_state;
local->unk14 = 0.0f;
chGobiRockDestroyed = FALSE;
if(this->state == 2){
this->marker->propPtr->unk8_3 = FALSE;
local->unk14 = 2.6f;
chGobiRockDestroyed = TRUE;
func_8028F428(2, this->marker);
FUNC_8030E624(SFX_9B_BOULDER_BREAKING_1, 0.3f, 9000);
FUNC_8030E624(SFX_9B_BOULDER_BREAKING_1, 0.5f, 9000);
FUNC_8030E624(SFX_9B_BOULDER_BREAKING_1, 0.7f, 9000);
FUNC_8030E624(SFX_9B_BOULDER_BREAKING_1, 0.9f, 9000);
func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000);
func_802F066C(local->unkC, local->unk0);
particleEmitter_emitN(local->unkC, 10);
func_802F053C(local->unk10, local->unk0);
particleEmitter_emitN(local->unk10, 10);
}
}
void __chGobiRock_destroy(ActorMarker *this_marker, ActorMarker *other_marker){
Actor *this = marker_getActor(this_marker);
if(this->state == 1)
__chGobiRock_setState(this, 2);
}
Actor *chGobiRock_draw(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
Actor *this = marker_getActor(this_marker);
ActorLocal_chGobiRock *local = (ActorLocal_chGobiRock *)&this->local;
f32 sp3C[3];
func_802EF3A8(local->unkC, gfx, mtx, vtx);
func_802EF3A8(local->unk10, gfx, mtx, vtx);
if(this->state == 0 || this->state == 2)
return this;
sp3C[0] = this->pitch;
sp3C[1] = this->yaw;
sp3C[2] = this->roll;
modelRender_preDraw((GenMethod_1)func_803253A0, (s32) this);
func_8033A450(func_80329934());
modelRender_draw(gfx, mtx, this->position, sp3C, 1.0f, NULL,func_80330B1C(this_marker));
func_8034A174(func_80329934(), 5, local->unk0);
return this;
}
bool chGobiRock_isDestroyed(void){
return chGobiRockDestroyed;
}
void chGobiRock_free(Actor *this){
ActorLocal_chGobiRock *local = (ActorLocal_chGobiRock *)&this->local;
__chGobiRock_setState(this, 0);
func_802EF684(local->unkC);
func_802EF684(local->unk10);
}
void chGobiRock_update(Actor *this){
static f32 jiggy_position[3] = {5644.0f, 2930.0f, -3258.0f};
ActorMarker *sp34 = this->marker;
ActorLocal_chGobiRock *local = (ActorLocal_chGobiRock *)&this->local;
f32 sp2C;
Actor *sp28;
f32 sp24 = time_getDelta();
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
sp34->unk30 = chGobiRock_free;
sp34->propPtr->unk8_3 = TRUE;
marker_setCollisionScripts(this->marker, NULL, NULL, __chGobiRock_destroy);
local->unkC = particleEmitter_new(20);
local->unk10 = particleEmitter_new(30);
chGobiRockDestroyed = FALSE;
sp28 = actorArray_findClosestActorFromActorId(this->position, ACTOR_12E_GOBI_1, -1, &sp2C);
if(sp28){
this->position_x = sp28->position_x;
this->position_y = sp28->position_y;
this->position_z = sp28->position_z;
}
__chGobiRock_setState(this, 1);
if(jiggyscore_isSpawned(JIGGY_44_GV_GOBI_1) && !func_803203FC(1)){
marker_despawn(this->marker);
}
}
else{//L80388ED0
particleEmitter_update(local->unkC);
particleEmitter_update(local->unk10);
if(func_8025773C(&local->unk14, sp24)){
jiggySpawn(JIGGY_44_GV_GOBI_1, jiggy_position);
func_802BB3DC(0, 60.0f, 0.65f);
}
if(this->state == 2){
if(func_802EF648(local->unkC) && func_802EF648(local->unk10)){
marker_despawn(sp34);
}
}
}
}

76
src/GV/ch/gobirope.c Normal file
View File

@@ -0,0 +1,76 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
void chGobiRope_update(Actor *this);
/* .data */
ActorInfo chGobiRope = { MARKER_BD_GOBI_ROPE, ACTOR_12F_GOBI_ROPE, ASSET_3E3_MODEL_GOBI_ROPE,
0, NULL,
chGobiRope_update, func_80326224, func_80325888,
0, 0x533, 0.0f, 0
};
/* .code */
void chGobiRope_setState(Actor *this, s32 next_state){
this->state = next_state;
if(this->state == 1){
func_80335924(this->unk148, ASSET_DD_ANIM_GOBI_ROPE, 0.5f, 4.0f);
}
if(this->state == 2){
func_80335924(this->unk148, ASSET_DC_ANIM_GOBI_ROPE_PULLING, 1.0f, 5.0f);
}
if(this->state == 3){
func_80335924(this->unk148, 0xF5, 0.1f, 1.0f);
func_80335A8C(this->unk148, 2);
}
if(this->state == 4){
marker_despawn(this->marker);
}
}
void chGobiRope_update(Actor *this){
Actor *sp2C;
f32 sp28;
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
this->marker->propPtr->unk8_3 = TRUE;
actor_collisionOff(this);
sp2C = actorArray_findClosestActorFromActorId(this->position, ACTOR_12E_GOBI_1, -1, &sp28);
if(sp2C){
this->position_x = sp2C->position_x;
this->position_y = sp2C->position_y;
this->position_z = sp2C->position_z;
}
chGobiRope_setState(this, 1);
if( jiggyscore_isSpawned(JIGGY_44_GV_GOBI_1)
&& !func_803203FC(1)
){
marker_despawn(this->marker);
}
}
else{
if(this->state == 1 || this->state == 2){
if(this->state == 1 && func_80387354()){
chGobiRope_setState(this, 2);
}
else{
if(func_80387360())
chGobiRope_setState(this, 4);
}
}//L80388AB4
if(this->state == 2){
if(func_80335794(this->unk148) > 0)
chGobiRope_setState(this, 1);
}
if(this->state == 3){
if(func_80335794(this->unk148) > 0)
chGobiRope_setState(this, 4);
}
}
}

208
src/GV/ch/mazectrl.c Normal file
View File

@@ -0,0 +1,208 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern void func_80324CD8(f32);
typedef struct {
u8 pad0[4];
s16 unk4;
//u8 pad6[2];
f32 unk8;
} ActorLocal_GVMazeCtrl;
void __chMazeCtrl_setState(Actor *this, s32 next_state);
void chMazeCtrl_update(Actor *this);
/* .data */
ActorInfo chMazeCtrl = { MARKER_1CD_GV_MAZE_CTRL, ACTOR_319_GV_MAZE_CTRL, 0x0,
0, NULL,
chMazeCtrl_update, 0x0, func_80325340,
0, 0, 0.0f, 0
};
/* .code */
void func_8038F520(f32 arg0){
static f32 D_803915E4[3] = {460.0f, 1400.0f, 0.0f};
static f32 D_803915F0[3] = {0.0f, 0.0f, 0.0f};
Struct6Ds *tmp_v0 = func_8034C528(0x19A);
if(tmp_v0 != NULL){
func_8034DDF0(tmp_v0, D_803915E4, D_803915F0, arg0, 1);
}
}
void func_8038F56C(f32 arg0){
static f32 D_803915FC[3] = {0.0f, 0.0f, 0.0f};
static f32 D_80391608[3] = {460.0f, 1400.0f, 0.0f};
Struct6Ds *tmp_v0 = func_8034C528(0x19A);
if(tmp_v0 != NULL){
func_8034DDF0(tmp_v0, D_803915FC, D_80391608, arg0, 1);
}
}
void __chMazeCtrl_markerSetState(ActorMarker *this_marker, s32 arg1){
Actor *this = marker_getActor(this_marker);
__chMazeCtrl_setState(this, arg1);
}
void __chMazeCtrl_8038F5E4(Actor *this){
if(this->state == 2){
comusic_8025AB44(COMUSIC_26_GV_SANDYBUTT_DANGER, 0, 30000);
item_set(ITEM_6_HOURGLASS, FALSE);
}
}
void __chMazeCtrl_setState(Actor *this, s32 next_state){
f32 plyr_pos[3];
Struct6Ds *tmp_v0;
ActorLocal_GVMazeCtrl *local;
f32 sp28[3];
local = (ActorLocal_GVMazeCtrl *)&this->local;
player_getPosition(plyr_pos);
local->unk8 = 0.0f;
if(next_state == 2){
func_8025A58C(0, 4000);
func_8025A6EC(COMUSIC_26_GV_SANDYBUTT_DANGER, 30000);
item_set(ITEM_0_HOURGLASS_TIMER, 0xdd3);
item_set(ITEM_6_HOURGLASS, TRUE);
func_8038F520(1.0f);
FUNC_8030E624(SFX_3F6_UNKNOWN, 0.8f, 25000);
FUNC_8030E624(SFX_3F6_UNKNOWN, 0.7f, 25000);
FUNC_8030E624(SFX_3F6_UNKNOWN, 0.5f, 25000);
if(1500.0f < plyr_pos[0]){
func_80324E38(0.0f, 3);
timed_setCameraToNode(0.0f, 8);
timed_playSfx(1.0f, SFX_7F_HEAVYDOOR_SLAM, 1.0f, 32000);
func_80324CD8(1.2f);
func_80324E88(1.2f);
func_80324E38(1.2f, 0);
}
else{//L8038F754
timed_playSfx(1.0f, SFX_7F_HEAVYDOOR_SLAM, 1.0f, 32000);
}
if(!levelSpecificFlags_get(0x16)){
func_80311480(ASSET_A82_TEXT_SANDYBUTT_START_MAZE, 4, NULL, NULL, NULL, NULL);
levelSpecificFlags_set(0x16, TRUE);
}
}//L8038F794
if(this->state == 2){
func_8025A58C(-1, 400);
comusic_8025AB44(COMUSIC_26_GV_SANDYBUTT_DANGER, 0, 0x190);
func_8025AABC(COMUSIC_26_GV_SANDYBUTT_DANGER);
item_set(ITEM_6_HOURGLASS, FALSE);
}
if(next_state == 3){
func_80324E38(0.0f, 3);
timedFunc_set_2(0.0f, (GenMethod_2)func_8025A6EC, COMUSIC_3E_SANDYBUTT_FAILURE, 0x7FFF);
timedFunc_set_2(1.0f, (GenMethod_2)__chMazeCtrl_markerSetState, reinterpret_cast(s32, this->marker), 6);
timedFunc_set_2(2.0f, (GenMethod_2)__chMazeCtrl_markerSetState, reinterpret_cast(s32, this->marker), 4);
}//L8038F850
if(next_state == 4){
FUNC_8030E624(SFX_3F6_UNKNOWN, 1.0f, 30000);
FUNC_8030E624(SFX_3F6_UNKNOWN, 0.8f, 29000);
FUNC_8030E624(SFX_3F6_UNKNOWN, 0.7f, 28000);
FUNC_8030E624(SFX_3F6_UNKNOWN, 0.5f, 31000);
func_8030E6D4(SFX_52_BANJO_YAH_OH);
tmp_v0 = func_8034C528(400);
if(tmp_v0){
func_8034DE60(tmp_v0, 0.0f, -1700.0f, 1.0f, 1);
}
}//L8038F8C4
if(this->state == 4){
FUNC_8030E624(SFX_7F_HEAVYDOOR_SLAM, 0.6f, 32750);
FUNC_8030E624(SFX_7F_HEAVYDOOR_SLAM, 0.8f, 32725);
func_8030E6D4(SFX_7F_HEAVYDOOR_SLAM);
func_8028F66C(BS_INTR_26);
}
if(next_state == 6){
player_getPosition(sp28);
sp28[1] = 2000.0f;
func_8028F94C(4, sp28);
}
if(next_state == 5){
func_8038F56C(0.0f);
if(++local->unk4 == 1)
func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7fff);
if(!levelSpecificFlags_get(0x17)){
func_80311480(ASSET_A83_TEXT_SANDYBUTT_DONE, 4, NULL, NULL, NULL, NULL);
levelSpecificFlags_set(0x17, TRUE);
}
}
this->state = next_state;
}
void chMazeCtrl_update(Actor *this){
f32 sp3C[3];
Struct6Ds *sp38;
f32 sp34;
Struct6Ds *sp30;
ActorLocal_GVMazeCtrl *local = (ActorLocal_GVMazeCtrl *)&this->local;
sp34 = time_getDelta();
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
this->marker->unk30 = __chMazeCtrl_8038F5E4;
if(this->state == 2){
comusic_8025AB44(COMUSIC_26_GV_SANDYBUTT_DANGER, 30000, 30000);
item_set(ITEM_6_HOURGLASS, TRUE);
}
else{
func_8038F56C(0.0f);
local->unk4 = 0;
this->state = 0;
__chMazeCtrl_setState(this, 1);
local->unk8 = 1.0f;
}//L8038FA8C
if(jiggyscore_isCollected(JIGGY_41_GV_MAZE))
levelSpecificFlags_set(0x17, TRUE);
}//L8038FAA4
player_getPosition(sp3C);
if(this->state == 1){
sp38 = func_8034C528(0x191);
if(sp38 != NULL && func_8034DC80(sp38, sp3C)){
__chMazeCtrl_setState(this, 2);
}
if( !levelSpecificFlags_get(0x15)
&& func_8025773C(&local->unk8, sp34)
&& func_80311480(ASSET_A81_TEXT_SANDYBUTT_ENTER, 0, NULL, NULL, NULL, NULL)
){
levelSpecificFlags_set(0x15, TRUE);
}
}//L8038FB34
if(this->state == 2){
if( sp3C[0] <= -1750.0f && 80.0f <= sp3C[2] && sp3C[2] <= 350.0f){
__chMazeCtrl_setState(this, 5);
}
else{
if(item_empty(ITEM_6_HOURGLASS)){
__chMazeCtrl_setState(this, 3);
}
}
}//L8038FBBC
if(this->state == 5){
if(-1700.0f < sp3C[0]){
__chMazeCtrl_setState(this, 2);
}
}
if(this->state == 4){
sp30 = func_8034C528(0x190);
if(sp30 != NULL && func_8034DC78(sp30)){
__chMazeCtrl_setState(this, 0);
}
}
}

87
src/GV/ch/toots.c Normal file
View File

@@ -0,0 +1,87 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
void chtoots_update(Actor *this);
/* .data */
ActorAnimationInfo chTootsAnimations[] = {
{0x000, 0.0f},
{ASSET_162_ANIM_TOOTS_IDLE, 5.0f},
{ASSET_162_ANIM_TOOTS_IDLE, 2.5f},
{ASSET_164_ANIM_TOOTS_SING, 1.0f}
};
ActorInfo chToots = { MARKER_1F4_TOOTS, ACTOR_1E4_TOOTS, ASSET_434_MODEL_TOOTS,
0x1, chTootsAnimations,
chtoots_update, func_80326224, func_80325888,
2000, 0, 0.5f, 0
};
/*.bss */
s32 D_80391A30;
s32 D_80391A34;
/* .code */
void GV_func_803863F0(Actor *this){
func_80328B8C(this, 1, 0.0001f, 1);
D_80391A30 = FALSE;
}
void GV_func_80386420(Actor *this){
func_80328B8C(this, 2, 0.0001f, 1);
this->unk38_31 = 0x23;
}
void func_80386464(Actor *this){
func_80328B8C(this, 3, 0.0001f, 1);
}
void chtoots_update(Actor *this){
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
D_80391A30 = 0;
D_80391A34 = 0;
}
switch(this->state){
case 1://L80386500
if(D_80391A34){
func_80386464(this);
}
else if(D_80391A30 == TRUE){
GV_func_80386420(this);
}
break;
case 2://L80386540
if(D_80391A34){
func_80386464(this);
}
else if(this->unk38_31 != 0){
this->unk38_31--;
if(this->unk38_31 == 6){
FUNC_8030E8B4(SFX_DD_JINJO_TALKING, 1.0f, 20000, this->position, 1500, 4500);
}
}
else{
GV_func_803863F0(this);
}
break;
case 3://L803865C8
if(!D_80391A34)
GV_func_803863F0(this);
break;
}//L803865DC
}
void func_803865E8(void){
D_80391A30 = TRUE;
}
void func_803865F8(void){
D_80391A34 = TRUE;
}
void func_80386608(void){
D_80391A34 = FALSE;
}

91
src/GV/ch/trunker.c Normal file
View File

@@ -0,0 +1,91 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
void chTrucker_update(Actor *this);
Actor *chTrucker_draw(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
/* .data */
ActorInfo chTrunker = {
MARKER_C0_TRUNKER, ACTOR_132_TRUNKER, ASSET_3DF_MODEL_TRUNKER,
0, NULL,
chTrucker_update, NULL, chTrucker_draw,
0, 0x599, 2.0f, 0
};
/* .code */
void __chTrucker_setState(Actor *this, s32 next_state){
this->state = next_state;
if(this->state == 1){
func_80335924(this->unk148, ASSET_FE_ANIM_TRUCKER_SHORT, 0.1f, 2.5f);
}
if(this->state == 2){
func_80335924(this->unk148, ASSET_FF_ANIM_TRUCKER_GROW, 0.1f, 2.5f);
func_80335A8C(this->unk148, 2);
}
if(this->state == 3){
func_80335924(this->unk148, ASSET_FF_ANIM_TRUCKER_GROW, 0.0f, 2.5f);
func_80335A74(this->unk148, 0.999f);
func_80335A8C(this->unk148, 2);
}
}
Actor *chTrucker_draw(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
Actor *this = marker_getActor(this_marker);
f32 sp38[3];
f32 sp2C[3];
if(this->state == 0) return this;
this = func_80325888(this_marker, gfx, mtx, vtx);
sp38[0] = this->position_x - 150.0f;
sp38[1] = this->position_y + 2.0f;
sp38[2] = this->position_z - 170.0f;
sp2C[0] = this->pitch;
sp2C[1] = this->yaw + 220.0f;
sp2C[2] = this->roll;
modelRender_setDepthMode(MODEL_RENDER_DEPTH_COMPARE);
modelRender_draw(gfx, mtx, sp38, sp2C, 1.0f, NULL, func_8030A428(3));
return this;
}
void chTrucker_update(Actor *this){
ActorMarker *marker = this->marker;
s32 sp28 = 0;
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
marker->propPtr->unk8_3 = TRUE;
actor_collisionOff(this);
mapSpecificFlags_set(0xC, FALSE);
if(jiggyscore_isSpawned(JIGGY_45_GV_GOBI_2) && !func_803203FC(1)){
__chTrucker_setState(this, 3);
}
else{//L803891CC
__chTrucker_setState(this, 1);
}
}//L803891D8
if( this->state == 1
&& !this->unk138_24
&& func_80329530(this, 250)
&& !func_80329530(this, 80)
&& func_8028F2A0()
){
func_80311480(ASSET_A71_TEXT_TRUNKER_MEET, 0xe, this->position, NULL, NULL, NULL);
this->unk138_24 = 1;
}//L80389254
if(this->state == 1 && mapSpecificFlags_get(0xC)){
sp28 = 2;
}
if(this->state == 2 && func_80335794(this->unk148) > 0){
sp28 = 3;
}
if(sp28)
__chTrucker_setState(this, sp28);
}