The first commit

This commit is contained in:
Banjo Kazooie
2022-07-15 17:09:41 -05:00
commit dd13d34074
1087 changed files with 391897 additions and 0 deletions

7
src/CC/CC.h Normal file
View File

@@ -0,0 +1,7 @@
#ifndef CC_H
#define CC_H
s32 func_80388010(void);
void func_8038803C(s32 arg0);
#endif

162
src/CC/ch/sawblade.c Normal file
View File

@@ -0,0 +1,162 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
typedef struct {
f32 unk0;
f32 unk4;
}Struct_CC_3130_0;
typedef struct {
Struct_CC_3130_0 *unk0;
s32 unk4;
}ActorLocal_CC_3130;
void chSawblade_update(Actor *this);
/* .data */
Struct_CC_3130_0 D_80389C30[] = {
{ -80.0f, 0.4f},
{-160.0f, 0.6f},
{-240.0f, 0.8f},
{ 80.0f, 0.4f},
{ 160.0f, 0.6f},
{ 240.0f, 0.8f},
{ -80.0f, 0.4f},
{-160.0f, 0.6f},
{-240.0f, 0.8f},
{ 80.0f, 0.4f},
{ 160.0f, 0.6f},
{ 240.0f, 0.8f}
};
ActorInfo D_80389C90 = {
0x28, ACTOR_3D_CLANKER_SAWBLADE_PROPELLOR_1, ASSET_43A_MODEL_CLANKER_SAWBLADE_PROPELLOR,
0, NULL,
chSawblade_update, NULL, func_80325888,
0, 0, 0.0f, 0
};
ActorInfo D_80389CB4 = {
0x28, ACTOR_3E_CLANKER_SAWBLADE_PROPELLOR_2, ASSET_43A_MODEL_CLANKER_SAWBLADE_PROPELLOR,
0, NULL,
chSawblade_update, NULL, func_80325888,
0, 0, 0.0f, 0
};
ActorInfo D_80389CD8 = {
0x28, ACTOR_3F_CLANKER_SAWBLADE_PROPELLOR_3, ASSET_43A_MODEL_CLANKER_SAWBLADE_PROPELLOR,
0, NULL,
chSawblade_update, NULL, func_80325888,
0, 0, 0.0f, 0
};
ActorInfo D_80389CFC = {
0x28, ACTOR_40_CLANKER_SAWBLADE_PROPELLOR_4, ASSET_43A_MODEL_CLANKER_SAWBLADE_PROPELLOR,
0, NULL,
chSawblade_update, NULL, func_80325888,
0, 0, 0.0f, 0
};
ActorInfo D_80389D20 = {
0x28, ACTOR_41_CLANKER_SAWBLADE_PROPELLOR_5, ASSET_43A_MODEL_CLANKER_SAWBLADE_PROPELLOR,
0, NULL,
chSawblade_update, NULL, func_80325888,
0, 0, 0.0f, 0
};
ActorInfo D_80389D44 = {
0x28, ACTOR_42_CLANKER_SAWBLADE_PROPELLOR_6, ASSET_43A_MODEL_CLANKER_SAWBLADE_PROPELLOR,
0, NULL,
chSawblade_update, NULL, func_80325888,
0, 0, 0.0f, 0
};
ActorInfo D_80389D68 = {
0x28, ACTOR_290_CLANKER_SAWBLADE_PROPELLOR_7, ASSET_43A_MODEL_CLANKER_SAWBLADE_PROPELLOR,
0, NULL,
chSawblade_update, NULL, func_80325888,
0, 0, 0.0f, 0
};
ActorInfo D_80389D8C = {
0x28, ACTOR_291_CLANKER_SAWBLADE_PROPELLOR_8, ASSET_43A_MODEL_CLANKER_SAWBLADE_PROPELLOR,
0, NULL,
chSawblade_update, NULL, func_80325888,
0, 0, 0.0f, 0
};
ActorInfo D_80389DB0 = {
0x28, ACTOR_292_CLANKER_SAWBLADE_PROPELLOR_9, ASSET_43A_MODEL_CLANKER_SAWBLADE_PROPELLOR,
0, NULL,
chSawblade_update, NULL, func_80325888,
0, 0, 0.0f, 0
};
ActorInfo D_80389DD4 = {
0x28, ACTOR_293_CLANKER_SAWBLADE_PROPELLOR_10, ASSET_43A_MODEL_CLANKER_SAWBLADE_PROPELLOR,
0, NULL,
chSawblade_update, NULL, func_80325888,
0, 0, 0.0f, 0
};
ActorInfo D_80389DF8 = {
0x28, ACTOR_294_CLANKER_SAWBLADE_PROPELLOR_11, ASSET_43A_MODEL_CLANKER_SAWBLADE_PROPELLOR,
0, NULL,
chSawblade_update, NULL, func_80325888,
0, 0, 0.0f, 0
};
ActorInfo D_80389E1C = {
0x28, ACTOR_295_CLANKER_SAWBLADE_PROPELLOR_12, ASSET_43A_MODEL_CLANKER_SAWBLADE_PROPELLOR,
0, NULL,
chSawblade_update, NULL, func_80325888,
0, 0, 0.0f, 0
};
/* .code */
void func_80389520(ActorMarker *marker, ActorMarker *otherMarker){
FUNC_8030E624(SFX_65_METALLIC_SCRATCH, 1.0f, 30000);
}
void func_8038954C(ActorMarker *marker, ActorMarker *otherMarker){
Actor *actor = marker_getActor(marker);
ActorLocal_CC_3130 *local = (ActorLocal_CC_3130 *) &actor->local;
if(local->unk4 == 0){
FUNC_8030E624(SFX_20_METAL_CLANK_1, 1.0f, 30000);
}
local->unk4 = 2;
}
void chSawblade_update(Actor *this){
ActorLocal_CC_3130 *local = (ActorLocal_CC_3130 *)&this->local;
f32 tmp_f2;
f32 sp34 = time_getDelta();
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
this->roll = this->yaw;
this->yaw = 0.0f;
marker_setCollisionScripts(this->marker, func_80389520, NULL, func_8038954C);
local->unk0 = &D_80389C30[(this->modelCacheIndex < 0x43) ? this->modelCacheIndex - 0x3D : this->modelCacheIndex - 0x28A];
local->unk4 = 0;
func_80256C60(this->position, 100);
if(map_get() == MAP_21_CC_WITCH_SWITCH_ROOM){
this->position_z += 64.0f;
}
}//L80389660
tmp_f2 = this->roll;
this->roll += local->unk0->unk0 * sp34;
this->roll += (this->roll < 0.0f)? 360 : 0;
this->roll -= (this->roll >= 360.0f)? 360 : 0;
if( ( tmp_f2 < 90.0f && this->roll >= 90.0f )
|| ( tmp_f2 < 270.0f && this->roll >= 270.0f )
|| ( 90.0f < tmp_f2 && this->roll <= 90.0f )
|| ( 270.0f < tmp_f2 && this->roll <= 270.0f )
){//L80389790
func_8030E878(SFX_2_CLAW_SWIPE, local->unk0->unk4, 30000, this->position, 500.0f, 1000.0f);
}//L803897C8
if(local->unk4 > 0)
local->unk4--;
}

100
src/CC/ch/tooth.c Normal file
View File

@@ -0,0 +1,100 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern void func_80333334(enum jiggy_e arg0);
typedef struct {
f32 position[3];//position
u8 level_flag;
u8 jiggy_id;
s16 open_model;
s16 closed_model;
//u8 pad12[0x2];
f32 jiggy_position[3];
} Struct_CC_1120_0;
typedef struct {
Struct_CC_1120_0 *unk0;
} ActorLocal_CC_1120;
void chTooth_update(Actor *);
/* .data */
Struct_CC_1120_0 D_80389B50[] = {
{ { 522.9976f, 1135.8192f, 5503.4833f}, LEVEL_FLAG_0_CC_TOKEN_TOOTH_OPEN, 0x00, ASSET_891_MODEL_CLANKER_TOKEN_TOOTH_OPEN, ASSET_892_MODEL_CLANKER_TOKEN_TOOTH_CLOSED, { 540.0f, 1627.0f, 6641.0f}},
{ {-713.4896f, 1135.8192f, 5152.913f}, LEVEL_FLAG_1_CC_JIGGY_TOOTH_OPEN, JIGGY_1B_CC_TOOTH, ASSET_893_MODEL_CLANKER_JIGGY_TOOTH_OPEN, ASSET_894_MODEL_CLANKER_JIGGY_TOOTH_CLOSED, {-700.0f, 1536.0f, 6268.0f}}
};
ActorInfo D_80389B90 = {
0x4E, ACTOR_101_CLANKER_TOKEN_TOOTH, ASSET_891_MODEL_CLANKER_TOKEN_TOOTH_OPEN,
0, NULL,
chTooth_update, func_80326224, func_80325888,
0, 0, 0.0f, 0
};
ActorInfo D_80389BB4 = {
0x4F, ACTOR_102_CLANKER_JIGGY_TOOTH, ASSET_893_MODEL_CLANKER_JIGGY_TOOTH_OPEN,
0, NULL,
chTooth_update, func_80326224, func_80325888,
0, 0, 0.0f, 0
};
/* .code */
extern void __chTooth_setState(Actor *this, s32 next_state){
ActorMarker *marker = this->marker;
ActorLocal_CC_1120 * local = (ActorLocal_CC_1120 *) &this->local;
this->state = next_state;
if(next_state == 2){
marker->modelId = local->unk0->open_model;
}
if(next_state == 1){
marker->modelId = local->unk0->closed_model;
}
}
extern void chTooth_update(Actor * this){
ActorMarker *marker = this->marker;
ActorLocal_CC_1120 * local = (ActorLocal_CC_1120 *) &this->local;
f32 sp24[3];
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
marker->propPtr->unk8_3 = 1;
local->unk0 = &D_80389B50[(this->modelCacheIndex == ACTOR_101_CLANKER_TOKEN_TOOTH) ? 0 : 1];
this->position[0] = local->unk0->position[0];
this->position[1] = local->unk0->position[1];
this->position[2] = local->unk0->position[2];
this->position[0] *= 1.25;
this->position[1] *= 1.25;
this->position[2] *= 1.25;
}//L80387660
if(this->state == 0){
if(levelSpecificFlags_get(local->unk0->level_flag)){
__chTooth_setState(this, 2);
}
else{
__chTooth_setState(this, 1);
}
}
else if(this->state == 2){//L803876B4
if(local->unk0->jiggy_id && !jiggyscore_isSpawned(local->unk0->jiggy_id)){
player_getPosition(sp24);
if(sp24[0] < 0.0f && 5400.0f < sp24[2]){
func_80333334(local->unk0->jiggy_id);
jiggySpawn(local->unk0->jiggy_id, local->unk0->jiggy_position);
}
else{//L8038774C
sp24[0] = local->unk0->jiggy_position[0];
sp24[1] = local->unk0->jiggy_position[1];
sp24[2] = local->unk0->jiggy_position[2];
sp24[1] = 1470.0f;
func_80333388(local->unk0->jiggy_id);
func_803331D8(local->unk0->jiggy_id, sp24);
}
}
}
}

142
src/CC/code_0.c Normal file
View File

@@ -0,0 +1,142 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
typedef struct {
f32 unk0;
f32 unk4;
f32 unk8;
u8 unkC;
} ActorLocal_CC_0;
void func_803864D4(Actor *this);
/* .data */
ActorInfo D_80389AA0 = {
0x4B, 0x43, 0x890, 0, NULL,
func_803864D4, func_80326224 , func_80325888,
0, 0, 0.0f, 0
};
/* .rodata */
extern f32 D_80389EB0;
extern f32 D_80389EB4;
extern f64 D_80389EB8;
extern f64 D_80389EC0;
extern f64 D_80389EC8;
extern f64 D_80389ED0;
extern f64 D_80389ED8;
extern f64 D_80389EE0;
extern f64 D_80389EE8;
extern f64 D_80389EF0;
// 0000 3AC0: 45B1F800 3D4CCCCD 3FE3333333333333
// 0000 3AD0: 4056800000000000 4066800000000000
// 0000 3AE0: 400921FB54524550 3FB999999999999A
// 0000 3AF0: 4056800000000000 4066800000000000
// 0000 3B00: 400921FB54524550 0000000000000000
/* .code */
void func_803863F0(Actor *this, s32 next_state){
ActorLocal_CC_0 * local = (ActorLocal_CC_0 *)this->local;
if(this->state == 4){
func_80388ED4(0);
}
this->state = next_state;
local->unkC = 1;
local->unk0 = 0.0f;
local->unk4 = 0.0f;
local->unk8 = 0.0f;
if(1 == this->state){
local->unk4 = 2.0f;
}
if(this->state == 2){
func_80388ED4(1);
}
if(this->state == 3){
local->unk0 = 1.0f;
}
}
#ifndef NONMATCHING
#pragma GLOBAL_ASM("asm/nonmatchings/CC/code_0/func_803864D4.s")
#else
void func_803864D4(Actor *this){
ActorMarker *marker = this->marker;//sp5C;
ActorLocal_CC_0 * local = (ActorLocal_CC_0 *)this->local;
f32 sp4C[3];
f32 sp40[3];
f32 sp3C = time_getDelta();
f32 sp30[3];
f32 sp2C;
f32 sin_result;
if(!this->unk16C_4){
this->unk16C_4 = 1;
marker->propPtr->unk8_3 = 1;
func_803863F0(this, 1);
}//L80386530
func_80388B4C(&sp4C);
TUPLE_ASSIGN(sp40, 2640.0f, 5695.0f, -10.0f);
local->unk8 += sp3C;
if(func_8025773C(&local->unk4, sp3C)){
sp30[0] = sp4C[0] - sp40[0];
sp30[1] = 0.0f;
sp30[2] = sp4C[2] - sp40[2];
if(!func_80388CA0()){
local->unk4 = 2.0f;
}
else if(60.0f < gu_sqrtf(sp30[0]*sp30[0] + sp30[1]*sp30[1] + sp30[2]*sp30[2])){
local->unk4 = 0.05f;
}
else{
func_803863F0(this, 2);
}
}//L80386634
if(func_8025773C(&local->unk0, sp3C)){
func_803863F0(this, 4);
}
if(this->state == 2){
if(1.0 <= local->unk8)
func_803863F0(this, 3);
}//L803866B4
if(this->state == 4){
if(1.0 <= local->unk8)
func_803863F0(this, 1);
}//L80386714
if(this->state == 1){
TUPLE_COPY(this->position, sp4C);
}
else if(this->state == 2)
{//L80386734
sp2C = local->unk8*(f64)1;
if(local->unkC && 0.6 < sp2C){
FUNC_8030E8B4(SFX_91_METALLIC_SOUND, 1.0f, 32000, this->position, 100, 6000);
local->unkC = 0;
}//L80386798
sin_result = sinf(((sp2C*90.0)/180.0)*M_PI);
this->position_x = (sp40[0] - sp4C[0])*sin_result + sp4C[0];
this->position_y = (sp40[1] - sp4C[1])*sin_result + sp4C[1];
this->position_z = (sp40[2] - sp4C[2])*sin_result + sp4C[2];
}//L80386818
else if(this->state == 3){
TUPLE_COPY(this->position, sp40);
}
else if(this->state == 4){
sp2C = 1 - local->unk8*(f64)1;
if(local->unkC && sp2C < 0.1){
local->unkC = 0;
}//L8038688C
sin_result = sinf(((sp2C*90.0)/180.0)*M_PI);
this->position_x = (sp40[0] - sp4C[0])*sin_result + sp4C[0];
this->position_y = (sp40[1] - sp4C[1])*sin_result + sp4C[1];
this->position_z = (sp40[2] - sp4C[2])*sin_result + sp4C[2];
}//L80386904
}
#endif

172
src/CC/code_13C0.c Normal file
View File

@@ -0,0 +1,172 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include "CC.h"
typedef struct{
void (*unk0)(s32 arg0);
u8 pad4[0x14];
s32 unk10;
u8 pad14[0x4];
f32 unk18[3];
u8 unk24[8];
}Struct_CC_13C0_0;
typedef struct{
s32 unk0;
s32 unk4;
s32 unk8;
f32 unkC;
}Struct_CC_13C0_1;
extern Struct_CC_13C0_0 D_8036E834[];
extern s32 D_80383568;
// Struct5Fs *, struct struct_68_s *, f32[3], f32[3], f32, BKModelBin*, Gfx**, Mtx**, Vtx**);
void func_803877B0(Struct_CC_13C0_1* arg0, void* arg1, f32 position[3], f32 rotation[3], f32 arg4, BKModelBin* modeL_ptr, Gfx** gfx, Mtx** mtx, Vtx **vtx) {
s32 temp_v0 = arg0->unk4;
if (temp_v0 == 3)
return;
if (temp_v0 == 0) {
func_8033A45C(1, 1);
} else if (temp_v0 == 1) {
func_8033A45C(1, 2);
} else if (temp_v0 == 2) {
func_8033A45C(1, 2);
rotation[2] += (arg0->unkC * 20.0f);
arg4 = arg4*(1.0f - arg0->unkC);
}
func_8033A45C(2, 0);
set_model_render_mode(1);
func_803391A4(gfx, mtx, position, rotation, arg4, NULL, modeL_ptr);
}
void func_803878AC(Struct_CC_13C0_1 *arg0, Struct68s *arg1, s32 arg2) {
arg0->unk4 = arg2;
arg0->unkC = 0.0f;
if ((arg2 == 2) || (arg2 == 3)) {
func_80351A04(arg1, 1);
}
}
void func_803878F0(Struct_CC_13C0_1 *arg0, Struct68s *arg1, s32 arg2) {
arg0->unk0 = arg2;
arg0->unk4 = 0;
arg0->unk8 = 0;
arg0 = arg0;
func_80351A14(arg1, (s32) func_803877B0);
func_803878AC(arg0, arg1, 0);
}
void func_80387940(Struct_CC_13C0_1 *arg0, Struct68s *arg1) {
func_803878F0(arg0, arg1, 1);
}
void func_80387960(Struct_CC_13C0_1 *arg0, Struct68s *arg1) {
func_803878F0(arg0, arg1, 2);
}
void func_80387980(Struct_CC_13C0_1 *arg0, Struct68s *arg1) {
func_803878F0(arg0, arg1, 3);
}
void func_803879A0(Struct_CC_13C0_1 *arg0, Struct68s *arg1) {
func_803878F0(arg0, arg1, 4);
}
void func_803879C0(Struct_CC_13C0_1 *arg0, Struct68s *arg1) {
func_803878F0(arg0, arg1, 5);
}
void func_803879E0(Struct_CC_13C0_1 *arg0, Struct68s *arg1) {
func_803878F0(arg0, arg1, 6);
}
void func_80387A00(Struct_CC_13C0_1 *arg0, Struct68s *arg1) {
func_803878F0(arg0, arg1, 7);
}
void func_80387A20(Struct_CC_13C0_1 *arg0, Struct68s *arg1) {
func_803878F0(arg0, arg1, 8);
}
void func_80387A40(Struct_CC_13C0_1* arg0, Struct68s* arg1, f32 arg2) {
s32 temp_v0;
f32 sp50[3];
f32 sp44[3];
f32 sp38[3];
f32 sp2C[3];
s32 sp28;
arg0->unkC += arg2;
temp_v0 = func_80388010();
if (temp_v0 == 0) {
func_803878AC(arg0, arg1, 3);
} else {
if (temp_v0 < arg0->unk0) {
func_803878AC(arg0, arg1, 0);
} else if (temp_v0 == arg0->unk0) {
func_803878AC(arg0, arg1, 1);
} else if ((arg0->unk0 < temp_v0) && ((arg0->unk4 != 2)) && (arg0->unk4 != 3)) {
func_803878AC(arg0, arg1, 2);
} else if ((arg0->unk4 == 2) && (arg0->unkC >= 1.0f)) {
func_803878AC(arg0, arg1, 3);
}
}
if ((arg0->unk4 == 0) || (arg0->unk4 == 1)) {
func_8035179C(arg1, sp38);
func_80351814(arg1, sp2C);
sp44[0] = 0.0f;
sp44[1] = 0.0f;
sp44[2] = 1.0f;
mlMtxIdent();
func_80252C08(NULL, sp2C, 1.0f, NULL);
func_8025235C(sp44, sp44);
player_getPosition(sp50);
sp50[1] += 50.0f;
sp50[0] -= sp38[0];
sp50[1] -= sp38[1];
sp50[2] -= sp38[2];
sp28 = ((sp50[0]*sp44[0] + sp50[1]*sp44[1] + sp50[2]*sp44[2]) >= 0.0f) ? 1 : -1;
if (sp28 == -arg0->unk8) {
if (gu_sqrtf(sp50[0]*sp50[0] + sp50[1]*sp50[1] + sp50[2] * sp50[2]) < (func_80351830(arg1) * 250.0f)) {
func_8038803C(arg0->unk0);
}
}
arg0->unk8 = sp28;
}
}
void func_80387CC0(void){
f32 sp1C[3];
s32 tmp_v0;
if(getGameMode() == GAME_MODE_7_ATTRACT_DEMO)
return;
func_8024C764(sp1C);
tmp_v0 = func_8023DB4C(0x7F);
if(tmp_v0 >= 0x40){
tmp_v0 = 0x7F - tmp_v0;
}
sp1C[2] += tmp_v0 + 0x94;
if(360.0f <= sp1C[2]){
sp1C[2] -= 360.0f;
}
func_8024CE18(sp1C);
}
void func_80387D4C(void){
u32 sp1C;
u32 tmp_v0;
osPiReadIo(0x504, &sp1C);
sp1C = (sp1C & 0xffff) + 0xffff5BA0;
if(sp1C){
func_80387CC0();
}
}

51
src/CC/code_19B0.c Normal file
View File

@@ -0,0 +1,51 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern ActorInfo D_80389AA0;
extern ActorInfo D_80389AD0;
extern ActorInfo D_80389B00;
extern ActorInfo D_80389B24;
extern ActorInfo D_80389B90;
extern ActorInfo D_80389BB4;
extern ActorInfo D_80389C90;
extern ActorInfo D_80389CB4;
extern ActorInfo D_80389CD8;
extern ActorInfo D_80389CFC;
extern ActorInfo D_80389D20;
extern ActorInfo D_80389D44;
extern ActorInfo D_80389D68;
extern ActorInfo D_80389D8C;
extern ActorInfo D_80389DB0;
extern ActorInfo D_80389DD4;
extern ActorInfo D_80389DF8;
extern ActorInfo D_80389E1C;
extern ActorInfo D_80389E44;
extern ActorInfo D_80389E68;
extern ActorInfo D_80389E8C;
void func_80387DA0(void)
{
spawnableActorList_add(&D_80389AA0, actor_new, 0X4080);
spawnableActorList_add(&D_80389E44, actor_new, 0X10080);
spawnableActorList_add(&D_80389E68, actor_new, 0X10080);
spawnableActorList_add(&D_80389E8C, actor_new, 0X10080);
spawnableActorList_add(&D_80389AD0, actor_new, 0X80);
spawnableActorList_add(&D_80389B00, actor_new, 0X80);
spawnableActorList_add(&D_80389B24, actor_new, 0X80);
spawnableActorList_add(&D_80389B90, actor_new, 0X80);
spawnableActorList_add(&D_80389BB4, actor_new, 0X80);
spawnableActorList_add(&D_80389C90, actor_new, 0X2488);
spawnableActorList_add(&D_80389CB4, actor_new, 0X2488);
spawnableActorList_add(&D_80389CD8, actor_new, 0X2488);
spawnableActorList_add(&D_80389CFC, actor_new, 0X2488);
spawnableActorList_add(&D_80389D20, actor_new, 0X2488);
spawnableActorList_add(&D_80389D44, actor_new, 0X2488);
spawnableActorList_add(&D_80389D68, actor_new, 0X2488);
spawnableActorList_add(&D_80389D8C, actor_new, 0X2488);
spawnableActorList_add(&D_80389DB0, actor_new, 0X2488);
spawnableActorList_add(&D_80389DD4, actor_new, 0X2488);
spawnableActorList_add(&D_80389DF8, actor_new, 0X2488);
spawnableActorList_add(&D_80389E1C, actor_new, 0X2488);
}

115
src/CC/code_1B90.c Normal file
View File

@@ -0,0 +1,115 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include "CC.h"
/* .data */
f32 D_80389BF0[3] = {0.0f, 1300.0f, -2800.0f};
/* .bss */
extern struct {
u8 unk0;
u8 unk1;
//u8 pad2[2];
f32 unk4;
f32 unk8;
} D_80389F90;
/* .code */
void func_80387F80(void){
func_8034E71C(func_8034C5AC(0x131), 0x190, 0.0f);
}
void func_80387FB0(void){
item_set(ITEM_0_HOURGLASS_TIMER, 48*60 - 1);
item_set(ITEM_6_HOURGLASS, 1);
D_80389F90.unk1 = 1;
}
void func_80387FE8(void){
item_set(ITEM_6_HOURGLASS, 0);
D_80389F90.unk1 = 0;
}
s32 func_80388010(void){
if(D_80389F90.unk0 > 0 && D_80389F90.unk0 < 0xA){
return D_80389F90.unk0;
}
return 0;
}
void func_8038803C(s32 arg0){
if(arg0 == D_80389F90.unk0){
if(arg0 == 1){
func_80387FB0();
}
D_80389F90.unk0++;
if(D_80389F90.unk0 >= 9){
func_80387FE8();
D_80389F90.unk8 = 1.0f;
}
func_8025A6EC(COMUSIC_2B_DING_B, 28000);
}
else{//L803880BC
func_8025A6EC(COMUSIC_2C_BUZZER, 28000);
}
}
void func_803880D4(void){
if(D_80389F90.unk0 != 0){
func_80387FE8();
}
}
void func_80388104(void){
D_80389F90.unk0 = 0;
if(map_get() == MAP_22_CC_INSIDE_CLANKER){
if(jiggyscore_isSpawned(JIGGY_1C_CC_RINGS)){
timedFunc_set_0(0.0f, func_80387F80);
}
else{
D_80389F90.unk0 = 1;
D_80389F90.unk1 = 0;
D_80389F90.unk8 = 0.0f;
D_80389F90.unk4 = 0.0f;
}
}
}
void func_8038817C(void){
f32 sp24[3];
f32 sp20 = time_getDelta();
s32 tmp_v0;
if(D_80389F90.unk0 != 0){
D_80389F90.unk4 += sp20;
player_getPosition(sp24);
if(func_8025773C(&D_80389F90.unk8, sp20)){
func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000);
func_80324E38(0.0f, 3);
timed_setCameraToNode(2.0f, 0);
timedJiggySpawn(2.1f, JIGGY_1C_CC_RINGS, D_80389BF0);
func_80324E38(5.0f, 0);
func_80324E88(5.0f);
tmp_v0 = func_8034C5AC(0x131);
if(tmp_v0){
func_8034E78C(tmp_v0, 0x190, 12.0f);
}
D_80389F90.unk4 = 0.0f;
}//L80388264
if(!(D_80389F90.unk0 < 2) && D_80389F90.unk1 != 0){
if( (sp24[0] < -1100.0f && sp24[1] < -40.0f)
|| (1560.0f < sp24[0])
|| (2850.0f < sp24[2])
|| (sp24[2] < -3000.0f)
|| (D_80389F90.unk0 < 9 && item_empty(ITEM_6_HOURGLASS))
){
func_80387FE8();
func_8025A6EC(COMUSIC_3C_MINIGAME_LOSS, 28000);
func_803880D4();
func_80388104();
}
}//L8038834C
}//L8038834C
}

440
src/CC/code_1F70.c Normal file
View File

@@ -0,0 +1,440 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern Struct60s *func_8028EF48(void);
extern void func_8030E9FC(enum sfx_e uid, f32 arg1, f32 arg2, u32 arg3, f32 arg4[3], f32 arg5, f32 arg6);
extern void func_8030EA54(enum sfx_e uid, f32 arg1, f32 arg2, u32 arg3, f32 arg4[3], f32 arg5, f32 arg6);
extern void func_8031CE28(s32, s32, f32);
void func_80324E88(f32);
extern int func_802E805C(BKCollisionList *, BKVertexList *, f32[3], s32, f32, s32, s32, s32, s32);
extern void func_80340200(s32, f32[3], s32, f32, s32, s32, BKVertexList *, s32);
extern void func_802E9118(BKCollisionList *, BKVertexList *, f32[3], s32, f32, s32, s32, f32, s32, s32, s32);
extern void func_802E9DD8(BKCollisionList *, BKVertexList *, f32[3], s32, f32, s32, f32, s32, s32);
extern int func_80340020(s32, f32[3], s32, f32, s32, BKVertexList *, f32[3], f32[3]);
extern void func_8033A670(s32, s32, f32[3]);
extern void func_8033A928(s32, s32, f32[3]);
extern void func_8033A9A8(s32, s32, f32[3]);
extern void func_8024C5CC(f32[3]);
extern void ml_vec3f_normalize(f32[3]);
extern void func_8033A45C(s32, s32);
extern void func_8033A238(s32);
extern void func_8033A450(s32);
extern void func_8028FAB0(f32[3]);
extern void func_802921D4(f32[3]);
/* .data */
f32 D_80389C00[3] = {5700.0f, 4300.0f, 0.0f};
f32 D_80389C0C[3] = {0.0f, 27.0f, 0.0f};
f32 D_80389C18[3] = {0.0f, -27.0f, 0.0f};
f32 D_80389C24[3] = {4000.0f, 3500.0f, 0.0f};
/* .bss */
struct {
s32 unk0;
u8 unk4;
//u8 pad5[0x3];
f32 unk8;
f32 unkC[3];
s32 unk18;
BKCollisionList *unk1C;
u8 unk20;
u8 unk21;
//u8 pad22[0x2];
BKModelBin * unk24;
f32 unk28[3];
s32 unk34;
f32 unk38;
f32 unk3C;
BKVertexList *unk40;
BKVertexList *unk44;
u8 unk48;
u8 unk49;
//u8 pad4A[2];
f32 unk4C;
s32 unk50;
f32 unk54;
}D_80389FA0;
s32 func_80388360(s32 arg0, s32 arg1, s32 arg2, s32 arg3){
s32 out_v0;
out_v0 = func_802E805C(D_80389FA0.unk1C, D_80389FA0.unk40, D_80389FA0.unk28, 0, 1.0f, arg0, arg1, arg2, arg3);
if(out_v0 && func_8029453C()){
func_80340200(D_80389FA0.unk18, D_80389FA0.unk28, 0, 1.0f, 0, out_v0, D_80389FA0.unk40, arg1);
}
return out_v0;
}
void func_80388428(s32 arg0, s32 arg1, f32 arg2, s32 arg3, s32 arg4, s32 arg5){
func_802E9118(D_80389FA0.unk1C, D_80389FA0.unk40, D_80389FA0.unk28, 0, 1.0f, arg0, arg1, arg2, arg3, arg4, arg5);
}
void func_803884A8(s32 arg0, f32 arg1, s32 arg2, s32 arg3){
func_802E9DD8(D_80389FA0.unk1C, D_80389FA0.unk40, D_80389FA0.unk28, 0, 1.0f, arg0, arg1, arg2, arg3);
}
void func_80388518(s32 arg0){
s32 sp24;
if(D_80389FA0.unk21 == 2){
func_8030E394(D_80389FA0.unk4);
func_8030E760(SFX_7F_HEAVYDOOR_SLAM, 0.6f, 20000);
func_8030E760(SFX_7F_HEAVYDOOR_SLAM, 0.8f, 20000);
func_8030E760(SFX_7F_HEAVYDOOR_SLAM, 0.9f, 20000);
func_8030E760(SFX_7F_HEAVYDOOR_SLAM, 1.0f, 20000);
}//L80388594
sp24 = D_80389FA0.unk21;
D_80389FA0.unk21 = arg0;
D_80389FA0.unk38 = 0.0f;
if(D_80389FA0.unk21 == 1){
func_80335924(D_80389FA0.unk0, ASSET_C3_ANIM_CLANKER_IDLE, 0.0f, 10.0f);
}
if(D_80389FA0.unk21 == 2){
func_8030DD90(D_80389FA0.unk4, 0);
func_8030DBB4(D_80389FA0.unk4, 1.0f);
sfxsource_setSfxId(D_80389FA0.unk4, SFX_7D_ANCHOR_LIFTING);
func_8030DD14(D_80389FA0.unk4, 3);
sfxsource_setSampleRate(D_80389FA0.unk4, 27000);
func_8030E2C4(D_80389FA0.unk4);
}
if(D_80389FA0.unk21 == 3){
if(sp24 != 2){
func_80335924(D_80389FA0.unk0, ASSET_C3_ANIM_CLANKER_IDLE, 0.0f, 10.0f);
}
D_80389FA0.unk28[1] = 1100.0f;
}
}
void func_80388664(void) {
jiggySpawn(JIGGY_17_CC_CLANKER_RAISED, D_80389C00);
}
void func_8038868C(void) {
func_80324E38(0, 3);
timed_setCameraToNode(0, 0);
timed_setCameraToNode(5.5f, 1);
timed_setCameraToNode(7.0f, 2);
timed_setCameraToNode(12.5f, 3);
timedFunc_set_0(13.0f, &func_80388664);
timed_setCameraToNode(16.0f, 1);
if (jiggyscore_isCollected(JIGGY_17_CC_CLANKER_RAISED) == 0) {
func_80324DBC(18.0f, 0xD2C, 4, NULL, NULL, NULL, 0);
}
func_80324E88(18.0f);
func_80324E38(18.0f, 0);
}
void func_80388760(Gfx **gfx, Mtx **mtx, Vtx **vtx){
BKVertexList *tmp_v0;
s32 s1;
f32 spA4[3];
f32 sp98[3];
int i;
s32 tmp_s0;
f32 sp84[3];
s32 pad80;
f32 sp74[3];
f32 sp68[3];
f32 sp5C[3];
if(D_80389FA0.unk21 == 0)
return;
func_8024C5CC(sp98);
if(sp98[0] < -2600.0f || 11600.0f < sp98[0])
return;
s1 = func_803356A0(D_80389FA0.unk0);
func_8033A670(s1, 0x40, sp84);
for( i = 0; i < 3; i++){
sp84[i] = sp84[i] + (1.3 - sp84[i])*D_80389FA0.unk8;
}
func_8033A928(s1, 0x40, sp84);
if(D_80389FA0.unk21 == 1){
func_8033A9A8(s1, 0x44, D_80389C0C);
func_8033A9A8(s1, 0x45, D_80389C0C);
func_8033A9A8(s1, 0x46, D_80389C0C);
func_8033A9A8(s1, 0x47, D_80389C18);
func_8033A9A8(s1, 0x48, D_80389C18);
func_8033A9A8(s1, 0x49, D_80389C18);
}
player_getPosition(spA4);
for(i = 0; i < 2; i++){//L803888FC
func_8034A174(D_80389FA0.unk34, (i == 0) ? 0x10 : 0xf, sp74);
sp68[0] = spA4[0] - sp74[0];
sp68[1] = spA4[1] - sp74[1];
sp68[2] = spA4[2] - sp74[2];
ml_vec3f_normalize(sp68);
sp5C[0] = 0.0f;
sp5C[1] = sp68[2]*45.0f;
sp5C[2] = -sp68[1]*45.0f;
func_8033A9A8(s1, (i == 0)?0x42:0x43, sp5C);
}
tmp_v0 = D_80389FA0.unk40;
D_80389FA0.unk40 = D_80389FA0.unk44;
D_80389FA0.unk44 = tmp_v0;
func_8033A45C(1, (D_80389FA0.unk21 == 3) ? 1 : 0);
tmp_s0 = (sp98[0] < 100.0f)? 0 : 1;
func_8033A45C(2, 1);
func_8033A45C(3, 1);
func_8033A45C(4, tmp_s0);
func_8033A45C(5, tmp_s0);
func_8033A45C(6, tmp_s0);
func_8033A45C(7, tmp_s0);
func_8033A45C(8, tmp_s0);
if(tmp_s0){
tmp_s0 = (s32)(D_80389FA0.unk4C*3.99 + 1.0);
func_8033A45C(2, tmp_s0);
func_8033A45C(3, tmp_s0);
}
func_8033A238(s1);
func_8033A450(D_80389FA0.unk34);
func_8033A4C0(D_80389FA0.unk40);
set_model_render_mode(1);
func_803391A4(gfx, mtx, D_80389FA0.unk28, NULL, 1.0f, NULL, D_80389FA0.unk24);
if(func_80340020(D_80389FA0.unk18, D_80389FA0.unk28, 0, 1.0f, 0, D_80389FA0.unk40, spA4, spA4)){
func_8028FAB0(spA4);
func_802921D4(spA4);
}
}
void func_80388B4C(s32 arg0) {
func_8034A174(D_80389FA0.unk34, 5, arg0);
}
void func_80388B78(f32 arg0[3], f32 arg1[3]){
func_8034A174(D_80389FA0.unk34, 7, arg0);
func_8034A174(D_80389FA0.unk34, 8, arg1);
}
void func_80388BBC(f32 arg0[3], f32 arg1[3]){
func_8034A174(D_80389FA0.unk34, 9, arg0);
func_8034A174(D_80389FA0.unk34, 10, arg1);
}
void func_80388C00(s32 arg0, s32 arg1){
func_8031CD20(arg0, 0xb, 3);
}
void func_80388C28(s32 arg0, s32 arg1){
func_8031CD20(arg0, 0xb, 4);
}
void func_80388C50(s32 arg0, s32 arg1){
func_8031CD20(arg0, 0xb, 1);
}
void func_80388C78(s32 arg0, s32 arg1){
func_8031CD20(arg0, 0xb, 2);
}
int func_80388CA0(void){
return D_80389FA0.unk21 == 3;
}
void func_80388CB4(void){
if(D_80389FA0.unk21){
func_80335874(D_80389FA0.unk0);
func_8030DA44(D_80389FA0.unk4);
func_80340690(D_80389FA0.unk18);
func_8034A2A8(D_80389FA0.unk34);
if(func_8033A148(D_80389FA0.unk24) != D_80389FA0.unk40)
vtxList_free(D_80389FA0.unk40);
if(func_8033A148(D_80389FA0.unk24) != D_80389FA0.unk44)
vtxList_free(D_80389FA0.unk44);
assetcache_release((void *)D_80389FA0.unk24);
D_80389FA0.unk34 = NULL;
D_80389FA0.unk0 = NULL;
D_80389FA0.unk18 = NULL;
}
}
void func_80388D54(void){
D_80389FA0.unk21 = 0;
if(map_get() == MAP_B_CC_CLANKERS_CAVERN){
D_80389FA0.unk0 = func_803358B4();
D_80389FA0.unk4 = func_8030D90C();
D_80389FA0.unk8 = 1.0f;
D_80389FA0.unk18 = func_803406B0();
D_80389FA0.unk21 = 0;
D_80389FA0.unk24 = assetcache_get(ASSET_88E_MODEL_CLANKER_CHAIN);
D_80389FA0.unk1C = func_8033A084(D_80389FA0.unk24);
D_80389FA0.unk34 = func_8034A2C8();
D_80389FA0.unk3C = 1.0f;
D_80389FA0.unk40 = func_8033A148(D_80389FA0.unk24);
D_80389FA0.unk44 = vtxList_clone(D_80389FA0.unk40);
D_80389FA0.unk48 = 0;
D_80389FA0.unk49 = 0;
D_80389FA0.unk50 = 0;
D_80389FA0.unk4C = 0.0f;
D_80389FA0.unk54 = 1.0f;
D_80389FA0.unk28[0] = 5500.0f;
D_80389FA0.unk28[2] = 0.0f;
D_80389FA0.unk28[1] = 0.0f;
func_80320B24(func_80388360, func_80388428, func_803884A8);
if(!func_80304E24(0x3B, D_80389FA0.unkC)){
D_80389FA0.unkC[0] = 0.0f;
D_80389FA0.unkC[1] =-1e+06f;
D_80389FA0.unkC[2] = 0.0f;
}
if(jiggyscore_isSpawned(JIGGY_17_CC_CLANKER_RAISED)){
func_80388518(3);
}
else{
func_80388518(1);
}
}
}
void func_80388EA4(void){
if(D_80389FA0.unk21 == 1){
func_80388518(2);
}
}
void func_80388ED4(s32 arg0){
f32 sp1C[3];
func_8034A174(D_80389FA0.unk34, 5, sp1C);
if(arg0 != 0){
FUNC_8030E8B4(SFX_91_METALLIC_SOUND, 0.7f, 32675, sp1C, 100, 6000);
}
else{
FUNC_8030E8B4(SFX_82_METAL_BREAK, 0.9f, 24000, sp1C, 100, 6000);
}
D_80389FA0.unk8 = 1.0f;
}
void func_80388F4C(void){
f32 sp6C[3];
f32 sp68 = time_getDelta();
f32 sp64;
f32 sp60;
f32 sp54[3];
f32 sp48[3];
Struct60s *tmp_v0;
f32 pad[3];
func_80387D4C();
if(D_80389FA0.unk21 != 0 && func_80334904() == 2){
player_getPosition(sp6C);
D_80389FA0.unk20 = (ml_vec3f_distance(sp6C, D_80389FA0.unkC) < 200.0f);
D_80389FA0.unk38 += sp68;
sp64 = func_80335684(D_80389FA0.unk0);
func_80335A94(D_80389FA0.unk0, sp68, 1);
sp60 = func_80335684(D_80389FA0.unk0);
if(D_80389FA0.unk21 == 3){
func_8034A174(D_80389FA0.unk34, 5, sp54);
if(sp60 < sp64){
FUNC_8030E8B4(SFX_7E_CREAKY_DOOR_OPENING, 0.6f, 32300, sp54, 1000, 5000);
}//L80389058
if(sp64 < 0.3 && 0.3 <= sp60){
FUNC_8030E8B4(SFX_7E_CREAKY_DOOR_OPENING, 0.5f, 32300, sp54, 1000, 5000);
}
}//L8038909C
if(D_80389FA0.unk21 == 2){
D_80389FA0.unk28[1] += 100.0f*sp68;
}
if(0.0f < D_80389FA0.unk8){
D_80389FA0.unk8 -= sp68/2;
if(D_80389FA0.unk8 <= 0.0f)
D_80389FA0.unk8 = 0.0f;
}
if(D_80389FA0.unk21 == 1){
if(D_80389FA0.unk20 && func_8033567C(D_80389FA0.unk0) != ASSET_C4_ANIM_CLANKER_BITE){
func_80335924(D_80389FA0.unk0, ASSET_C4_ANIM_CLANKER_BITE, 1.0f, 10.0f);
if(!D_80389FA0.unk48){
func_80311480(0xd2b, 0xE, D_80389FA0.unk28, NULL, NULL, NULL);
D_80389FA0.unk48 = TRUE;
}
}//L8038918C
if(!D_80389FA0.unk20 && func_8033567C(D_80389FA0.unk0) == ASSET_C4_ANIM_CLANKER_BITE){
func_80335924(D_80389FA0.unk0, ASSET_C3_ANIM_CLANKER_IDLE, 1.0f, 10.0f);
}
}//L803891BC
if(D_80389FA0.unk21 == 2){
func_803114D0();
if(1100.0f <= D_80389FA0.unk28[1]){
func_80388518(3);
}
}//L803891F8
if(D_80389FA0.unk21 == 3){
func_8034A174(D_80389FA0.unk34, 6, sp48);
if(ml_vec3f_distance(sp48, sp6C) <= 130.0f && sp6C[1] - sp48[1] < 50.0f){
func_8031D04C(0x21, 1);
}
}//L80389260
if( D_80389FA0.unk21 == 3){
tmp_v0 = func_8028EF48();
if( tmp_v0 && !D_80389FA0.unk49
){
if(tmp_v0->unk8 & 2){
func_8031CE28(0x22, 5, 180.0f);
D_80389FA0.unk49++;
}
else if(tmp_v0->unk8 & 4){
func_8031CE28(0x22, 4, 0.0f);
D_80389FA0.unk49++;
}
}
}//L803892DC
if(func_8025773C(&D_80389FA0.unk3C, sp68)){
if(D_80389FA0.unk21 == 3){
func_8030E9FC(SFX_D0_GRIMLET_SQUEAK, 0.5f, 0.7f, 20000, D_80389C24, 2000.0f, 4000.0f);
}else{
func_8030EA54(SFX_D0_GRIMLET_SQUEAK, 0.5f, 0.7f, 20000, D_80389C24, 2000.0f, 4000.0f);
}//L80389384
D_80389FA0.unk3C = randf2(3.0f, 6.0f);
}//L803893A0
if(D_80389FA0.unk50 == 0){
if(func_8025773C(&D_80389FA0.unk54, sp68))
D_80389FA0.unk50 = 1;
}
if(D_80389FA0.unk50){
D_80389FA0.unk4C += D_80389FA0.unk50 * ((sp68 * 30.0)/4);
if(1.0f < D_80389FA0.unk4C){
D_80389FA0.unk50 = -1;
D_80389FA0.unk4C = 1.0f;
}
else if(D_80389FA0.unk4C < 0.0f){
D_80389FA0.unk50 = 0;
D_80389FA0.unk4C = 0.0f;
D_80389FA0.unk54 = randf2(0.1f, 7.0f);
}
}
}//L80389490
}
void func_803894A0(void){
if(D_80389FA0.unk34)
D_80389FA0.unk34 = func_8034A348(D_80389FA0.unk34);
if(D_80389FA0.unk0)
D_80389FA0.unk0 = defrag(D_80389FA0.unk0);
if(D_80389FA0.unk18)
D_80389FA0.unk18 = func_803406D4(D_80389FA0.unk18);
}

104
src/CC/code_3400.c Normal file
View File

@@ -0,0 +1,104 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
typedef struct {
u8 *unk0;
f32 unk4;
s32 unk8;
} ActorLocal_CC_3400;
void func_80389900(Actor *this);
/* .data */
u8 D_80389E40[] = {3, 3, 2, 0};
ActorInfo D_80389E44 = {
0x1A9, 0x28C, 0x435,
0, NULL,
func_80389900, NULL, func_80325888,
0, 0, 0.0f, 0
};
ActorInfo D_80389E68 = {
0x1A9, 0x28D, 0x436,
0, NULL,
func_80389900, NULL, func_80325888,
0, 0, 0.0f, 0
};
ActorInfo D_80389E8C = {
0x1A9, 0x28E, 0x437,
0, NULL,
func_80389900, NULL, func_80325888,
0, 0, 0.0f, 0
};
/* .code */
void func_803897F0(Actor *this, s32 next_state){
ActorLocal_CC_3400 *local = (ActorLocal_CC_3400 *) &this->local;
if(next_state == 3)
FUNC_8030E624(SFX_1E_HITTING_AN_ENEMY_2, 1.0f, 25000);
if(next_state == 2){
func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, -1);
FUNC_8030E624(SFX_3F6_UNKNOWN, 0.9f, 29000);
local->unk4 = 0.0f;
}
if(next_state == 4){
marker_despawn(this->marker);
}
this->state = next_state;
}
void func_80389890(ActorMarker *marker, ActorMarker *other_marker){
func_8025A6EC(COMUSIC_2B_DING_B, -1);
}
void func_803898BC(ActorMarker *marker, ActorMarker *other_marker){
Actor *actor = marker_getActor(marker);
ActorLocal_CC_3400 *local = (ActorLocal_CC_3400 *) &actor->local;
if(actor->state == 1){
func_803897F0(actor, *local->unk0);
}
}
void func_80389900(Actor * this){
ActorLocal_CC_3400 *local = (ActorLocal_CC_3400 *) &this->local;
f32 sp20 = time_getDelta();
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
this->marker->propPtr->unk8_3 = 1;
local->unk0 = &D_80389E40[this->modelCacheIndex - 0x28C];
local->unk8 = 0;
marker_setCollisionScripts(this->marker, NULL, func_80389890, func_803898BC);
func_803897F0(this, 1);
if(this->modelCacheIndex == 0x28E && jiggyscore_isSpawned(JIGGY_18_CC_BOLT)){
marker_despawn(this->marker);
}
return;
}//L803899D4
if(this->state == 1){
if(local->unk8){
func_803897F0(this, *local->unk0);
}
}//L80389A10
if(this->state == 3){
func_803897F0(this, 4);
}
if(this->state == 2){
local->unk4 += 250.0f*sp20;
this->position_y += 250.0f*sp20;
if(250.0f <= local->unk4){
func_803897F0(this, 4);
}
}
}

200
src/CC/code_530.c Normal file
View File

@@ -0,0 +1,200 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern void func_8030E730(s32, f32, s32);
void func_80388EA4(void);
typedef struct {
u8 unk0;
u8 unk1;
u8 unk2;
u8 unk3;
f32 unk4[3];
s16 unk10;
u8 pad12[2];
f32 unk14;
} ActorLocal_CC_530;
void func_80386B28(Actor* this);
/* .data */
ActorInfo D_80389AD0 = {
0x4A, 0x3C, 0x429, 0, NULL,
func_80386B28, func_80326224, func_80325888,
0, 0, 0.0f, 0
};
f32 D_80389AF4[3] = {6200.0f, -2600.0f, 0.0f};
/* .code */
void func_80386920(Actor *this, s32 next_state){
ActorLocal_CC_530 *local = (ActorLocal_CC_530 *)&this->local;
f32 sp28[3];
s16 sp20[3];
local->unk14 = 0.0f;
if(this->state == 2 || this->state == 3 || this->state == 4){
func_8030E394(local->unk0);
}
if(next_state == 2 || next_state == 3 || next_state == 4){
func_8030DD90(local->unk0, 1);
func_8030DBB4(local->unk0, 0.3f);
sfxsource_setSfxId(local->unk0, 0x3ec);
func_8030DD14(local->unk0, 3);
sfxsource_setSampleRate(local->unk0, 28000);
func_8030E2C4(local->unk0);
}
if(next_state == 2 || next_state == 4){
func_8025A6EC(COMUSIC_2B_DING_B, 0x7fff);
player_getPosition(&sp28);
TUPLE_COPY(sp20, sp28);
func_802F3A60(&sp20);
}
if(next_state == 4){
func_8038868C();
func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7FFF);
}
if(this->state == 4)
func_8030E730(0x7f, 0.7f, 0x7FFF);
this->state = next_state;
}
void func_80386AD0(ActorMarker *arg0, s32 arg1) {
Actor *actor = marker_getActor(arg0);
ActorLocal_CC_530 *local = (ActorLocal_CC_530 *)&actor->local;
local-> unk1 = 1;
}
void func_80386AF8(Actor *arg0) {
ActorLocal_CC_530 *local = (ActorLocal_CC_530 *)&arg0->local;
func_80386920(arg0, 0);
func_8030DA44(local->unk0);
}
void func_80386B28(Actor *this){
ActorMarker *marker = this->marker;
f32 sp58[3];
ActorLocal_CC_530 * local = (ActorLocal_CC_530 *)&this->local;
int temp_v0;
f32 sp44[3];
f32 sp38[3];
int temp_a0;
f32 tick = time_getDelta();
if(!this->unk16C_4){
this->unk16C_4 = 1;
marker_setCollisionScripts(this->marker, NULL, func_80386AD0, NULL);
local->unk0 = func_8030D90C();
local->unk1 = 0;
local->unk2 = 0;
local->unk10 = this->pitch;
local->unk14 = 0.0f;
player_getPosition(&local->unk4);
local->unk3 = 3;
marker->unk30 = func_80386AF8;
marker->propPtr->unk8_3 = 1;
this->position_x = 5700.0f;
this->position_y = -2620.0f;
this->position_z = -20.0f;
if(jiggyscore_isSpawned(JIGGY_17_CC_CLANKER_RAISED)){
func_80386920(this, 5);
}
else{
func_80386920(this, 1);
}
}
else{//L80386C40
local->unk14 += tick;
player_getPosition(&sp58);
if(local->unk1 && ! local->unk2){
sp38[0] = 0.0f;
sp38[1] = 0.0f;
sp38[2] = -200.0f;
ml_vec3f_pitch_rotate_copy(&sp38, &sp38, this->pitch);
sp44[0] = local->unk4[0] - D_80389AF4[0];
sp44[1] = local->unk4[1] - D_80389AF4[1];
sp44[2] = local->unk4[2] - D_80389AF4[2];
temp_a0 = (0.0f <= sp44[0]*sp38[0] + sp44[1]*sp38[1] + sp44[2]*sp38[2]) ? 1 : -1;
TUPLE_ASSIGN(sp44,
sp58[0] - D_80389AF4[0],
sp58[1] - D_80389AF4[1],
sp58[2] - D_80389AF4[2]
);
temp_v0 = (0.0f <= sp44[0]*sp38[0] + sp44[1]*sp38[1] + sp44[2]*sp38[2]) ? 1 : -1;
if(temp_a0 != temp_v0){
local->unk2 = 1;
}
else{
local->unk2 = 0;
}
}
else{//L80386DA0
if(local->unk1){
local->unk2 = 2;
}
else{
local->unk2 = 0;
}
}//L80386DB4
local->unk1 = 0;
local->unk4[0] = sp58[0];
local->unk4[1] = sp58[1];
local->unk4[2] = sp58[2];
if(this->state == 0x1 && local->unk2 == 1){
if(--local->unk3 == 0){
func_80386920(this, 4);
}
else{
func_80386920(this, 2);
}
}//L80386E4C
if(this->state == 2){
if(1.0f <= local->unk14){
local->unk14 = 1.0f;
}
this->pitch = (f32)local->unk10 + 30.0f*local->unk14;
if(1.0f <= local->unk14){
func_80386920(this, 3);
}
}//L80386EC0
if(this->state == 3){
if(1.0f <= local->unk14){
local->unk14 = 1.0f;
}
this->pitch = (f32)local->unk10 + 30.0f*(1.0f - local->unk14);
if(1.0f <= local->unk14){
func_80386920(this, 1);
}
}//L80386F44
if(this->state == 4){
if(5.0f <= local->unk14){
local->unk14 = 5.0f;
}
this->pitch = (f32)local->unk10 + 180.0f*(local->unk14/5.0f);
if(5.0f <= local->unk14){
func_80386920(this, 5);
func_80388EA4();
}
}//L80386FC0
}
}

145
src/CC/code_BF0.c Normal file
View File

@@ -0,0 +1,145 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
typedef struct{
s32 unk0;
s32 egg_count;
f32 unk8;
}ActorLocal_CC_BF0;
void func_803870F8(Actor *this);
/* .data */
extern ActorInfo D_80389B00 = {
MARKER_4C_CLANKER_TOKEN_TOOTH_EXT, ACTOR_44_CLANKER_TOKEN_TOOTH_EXTERIOR, ASSET_309_MODEL_CLANKER_TOKEN_TOOTH_EXTERIOR,
0, NULL,
func_803870F8, func_80326224, func_80325888,
0, 0, 0.0f, 0
};
extern ActorInfo D_80389B24 = {
MARKER_4D_CLANKER_JIGGY_TOOTH_EXT, ACTOR_45_CLANKER_JIGGY_TOOTH_EXTERIOR, ASSET_30A_MODEL_CLANKER_JIGGY_TOOTH_EXTERIOR,
0, NULL,
func_803870F8, func_80326224, func_80325888,
0, 0, 0.0f, 0
};
/* .bss */
u8 D_80389F80;
/* .code */
void func_80386FE0(Actor *this, s32 next_state){
ActorLocal_CC_BF0 *local = (ActorLocal_CC_BF0 *)&this->local;
s32 prev_state = this->state;
this->state = next_state;
local->unk8 = 0.0f;
if(this->state == 2){
func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000);
}
else if(this->state == 3){
if(prev_state == 2){
levelSpecificFlags_set((local->unk0 == 1) ? 0 : 1, TRUE);
}
if(local->unk0 == 1){
this->yaw = -30.0f;
this->pitch = -90.0f;
this->roll = -5.0f;
}
else{
this->yaw = 30.0f;
this->pitch = 90.0f;
this->roll = 5.0f;
}
}
}
void func_803870E0(void) {
D_80389F80 = 0;
}
void func_803870EC(s32 arg0) {
D_80389F80 = arg0;
}
void func_803870F8(Actor *this){
ActorMarker *marker = this->marker;
f32 sp70[3];
ActorLocal_CC_BF0 *local = (ActorLocal_CC_BF0 *)&this->local;
f32 sp68 = time_getDelta();
f32 sp5C[3];
f32 sp50[3];
f32 temp_f2;
s32 flagCnt;
f32 sp3C[3];
if(!this->unk16C_4){
this->unk16C_4 = 1;
marker->propPtr->unk8_3 = 1;
this->pitch = 0.0f;
this->yaw = 0.0f;
this->roll = 0.0f;
local->unk0 = (marker->modelId == 0x309) ? 1 : 2;
local->egg_count = 0;
func_80386FE0(this, 1);
if(levelSpecificFlags_get((local->unk0 == 1)? LEVEL_FLAG_0_CC_TOKEN_TOOTH_OPEN: LEVEL_FLAG_1_CC_JIGGY_TOOTH_OPEN)){
func_80386FE0(this, 3);
}
}//L803871D8
player_getPosition(&sp70);
local->unk8 += sp68;
if(this->state == 2){
temp_f2 = local->unk8/1;
if(local->unk0 == 1){
this->yaw = -temp_f2*30.0f;
this->pitch = -temp_f2*90.0f;
this->roll = -temp_f2*5.0f;
}//L8038726C
else{
this->yaw = temp_f2*30.0f;
this->pitch = temp_f2*90.0f;
this->roll = temp_f2*5.0f;
}
}//L803872A0
if(local->unk0 == 1){
func_80388B78(&sp5C, &sp50);
}
else{
func_80388BBC(&sp5C, &sp50);
}//L803872D4
TUPLE_COPY(this->position, sp5C);
if(this->state == 1)
func_8028E668(&this->position, 290.0f, -10.0f, 150.0f);
if(this->state == 1 && D_80389F80 == local->unk0){
D_80389F80 = 0;
local->egg_count++;
if(local->egg_count == 3){
func_80386FE0(this, 2);
}else{
func_8025A6EC(COMUSIC_2B_DING_B, 28000);
}
}
else if(this->state == 2 && 1.0f <= local->unk8){
flagCnt = levelSpecificFlags_get(LEVEL_FLAG_0_CC_TOKEN_TOOTH_OPEN) + levelSpecificFlags_get(LEVEL_FLAG_1_CC_JIGGY_TOOTH_OPEN);
if(!jiggyscore_isCollected(JIGGY_1B_CC_TOOTH)){
func_80311480((local->unk0 == 1)?
((flagCnt == 0)? 0xd30 : 0xd31) :
((flagCnt == 0)? 0xd2e : 0xd2f), 4, NULL, NULL, NULL, NULL);
}
func_80386FE0(this, 3);
}//L80387474
if(this->state == 3){
sp3C[0] = this->position_x;
sp3C[1] = this->position_y + 100;
sp3C[2] = this->position_z;
if(ml_vec3f_distance(&sp3C, &sp70) < 120.0f){
func_8031D04C(0x22, (local->unk0 == 1)? 7 : 6);
}
}//L80387500
}