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

219
src/SM/ch/attacktutorial.c Normal file
View File

@@ -0,0 +1,219 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
/* chAttackTutorial - controls bottle teaching moves in spiral*/
//external
void func_80324E88(f32);
void func_8028F918(s32);
//public
void func_80387764(ActorMarker *);
void chAttackTutorial_setState(Actor * this, s32 arg1);
void chAttackTutorial_update(Actor *);
/* .data */
ActorInfo D_8038AC20 = { MARKER_12B_ATTACK_TUTORIAL, ACTOR_ATTACK_TUTORIAL, 0,
1, NULL,
chAttackTutorial_update, func_80326224, func_80325340,
0, 0, 0.0f, 0
};
/* .code */
void __chAttackTutorial_spawnEnemy(ActorMarker *marker, s32 enemy_id){
Actor *actor = marker_getActor(marker);
s32 pad;
Actor *other = spawn_child_actor(enemy_id, &actor);
actor->unk100 = other->marker;
other->unk100 = actor->marker;
if(actor->unk10_12 == 3 && actor->unk38_31 == 1){
other->unk38_31 = 1;
}else{//L803871D4
other->unk38_31 = 0;
}
other->unk10_12 = 1;
if(marker);
}
s32 func_803871FC(Actor *this, s32 arg1){
volatile s32 sp1C;
s32 tmp_v0;
sp1C = (arg1 == 1)? ACTOR_TOPPER_A : (tmp_v0 = (arg1 == 2)? ACTOR_BAWL_A : ACTOR_164_COLLYWOBBLE_A);
func_802C3D3C(__chAttackTutorial_spawnEnemy, this->marker, sp1C);
}
void func_80387258(ActorMarker *marker, enum asset_e text_id, s32 arg2){
chAttackTutorial_setState(marker_getActor(marker), 2);
}
void func_80387288(ActorMarker *marker, enum asset_e text_id, s32 arg2){
Actor *actor = marker_getActor(marker);
func_8028F918(0);
switch(text_id){
case 0xe15://L803872C8
ability_unlock(ABILITY_C_ROLL);
chAttackTutorial_setState(actor, 2);
break;
case 0xe17://L803872E4
ability_unlock(ABILITY_B_RATATAT_RAP);
chAttackTutorial_setState(actor, 2);
break;
}//L803872FC
func_80324E88(0.0f);
}
void chAttackTutorial_setState(Actor * this, s32 arg1){
switch (arg1)
{
case 5:
if(this->unk10_12 == 0){
ability_unlock(ABILITY_4_BEAR_PUNCH);
func_80311480(0xDFF, 0xE, this->unk1C, this->marker, func_80387288, func_80387258);
}
else{
func_80311480((this->unk10_12 == 1) ? 0xe15 : 0xe17, 0xE, this->unk1C, this->marker, func_80387288, NULL);
}
break;
case 2://L803873E0
this->unk38_31 = 0;
func_803871FC(this, ++this->unk10_12);
break;
case 3://L8038742C
mapSpecificFlags_set(5,1);
mapSpecificFlags_set(0xC, 1);
marker_despawn(this->marker);
break;
case 4://L80387454
mapSpecificFlags_set(0xC, 1);
if(!honeycombscore_get(HONEYCOMB_17_SM_COLIWOBBLE)){
this->unk10_12 = 3;
this->unk38_31 = 1;
func_803871FC(this, this->unk10_12);
}
break;
}//L803874A8
func_80328A84(this, arg1);
}
int func_803874C4(void){
return ability_isUnlocked(ABILITY_4_BEAR_PUNCH)
&& ability_isUnlocked(ABILITY_C_ROLL)
&& ability_isUnlocked(ABILITY_B_RATATAT_RAP);
}
void chAttackTutorial_update(Actor *this){
f32 sp2C;
Actor *bottles;
if(!this->initialized){
//find closest tutorial bottles
bottles = func_80326D68(this->position, ACTOR_12B_TUTORIAL_BOTTLES, -1, &sp2C);
if(bottles != NULL){
this->unk1C_x = bottles->position_x;
this->unk1C_y = bottles->position_y;
this->unk1C_z = bottles->position_z;
}else{
{this->unk1C_x = this->position_x;
this->unk1C_y = this->position_y;
this->unk1C_z = this->position_z;}
}
this->unk10_12 = (ability_isUnlocked(ABILITY_C_ROLL))? 2 : (ability_isUnlocked(ABILITY_4_BEAR_PUNCH)? 1:0);
this->initialized = 1;
}
switch(this->state){
case 1://L80387610
if(mapSpecificFlags_get(4))
chAttackTutorial_setState(this, 5);
if(func_803874C4() || func_803203FC(0xc1))
chAttackTutorial_setState(this, 4);
break;
case 2://L80387658
if(mapSpecificFlags_get(7)){
func_80387764(this->marker);
mapSpecificFlags_set(7,0);
}
break;
case 5://L80387680
break;
}////L80387680
}
void func_80387690(ActorMarker *marker, enum asset_e text_id, s32 arg2){
Actor *actor = marker_getActor(marker);
switch(text_id){
case 0xDFF:
func_8028F918(0);
break;
case 0xE14:
case 0xE16:
case 0xE18:
func_803871FC(actor, actor->unk10_12);
break;
case 0xE15:
ability_unlock(ABILITY_C_ROLL);
chAttackTutorial_setState(actor, 2);
break;
case 0xE17:
ability_unlock(ABILITY_B_RATATAT_RAP);
chAttackTutorial_setState(actor, 2);
break;
case 0xE12:
case 0xE19:
chAttackTutorial_setState(actor, 3);
break;
}
func_80324E88(0.0f);
}//*/
void func_80387764(ActorMarker * marker){
s32 sp34;
int temp_a2;
s32 sp2C = 4;
Actor *actor = marker_getActor(marker);
temp_a2 = actor->unk38_31 ? 1 : 0 ;
if( temp_a2 ){
sp2C = 0xE;
}
switch (actor->unk10_12)
{
case 0x1: //L803877D8
sp34 = temp_a2 ? 0xe15 : 0xe14; //dialog enums
break;
case 0x2: //L803877F4
sp34 = temp_a2 ? 0xe17 : 0xe16; //dialog enums
break;
case 3: //L80387810
sp34 = temp_a2 ? 0xe19 : 0xe18; //dialog enums
break;
default:
//sp34 = actor->unk38_31;
break;
}//L8038782C
if(sp34 == 0xe19){
func_8028F94C(2, actor->unk1C);
}
//L80387848
if(!mapSpecificFlags_get(3) && func_802DA498() && temp_a2){
mapSpecificFlags_set(3, 1);
sp34 = 0xE12;
}//L80387898
if(temp_a2){
timed_setCameraToNode(0.0f, 6);
}//L803878B0
func_80311480(sp34, sp2C, actor->unk1C, actor->marker, func_80387690, NULL);
actor->unk38_31++;
}

494
src/SM/ch/vegetables.c Normal file
View File

@@ -0,0 +1,494 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
//external
f32 func_80309724(f32*);
void func_802C4218(s32, f32, f32, f32);
void func_803252D0(f32, s32);
void func_80328B8C(Actor *, s32, f32, s32);
//typedefs
typedef struct ch_vegatable{
TUPLE(f32, unk0);
s32 unkC;
u32 pad10_31: 19;
u32 unk10_12: 4;
u32 pad10_8: 9;
} ChVeg;
//public
Actor *func_80387DF4(ActorMarker *, Gfx**, Mtx**, Vtx **);
void func_80388080(Actor *);
/* .data */
ActorAnimationInfo chCarrotAnimations[5] = {
{0, 0.0f},
{0x223, 1000000.0f},
{0x223, 1.0f},
{0x224, 0.75f},
{0x223, 1.0f}
};
ActorInfo D_8038AC78 = { 0x12A, ACTOR_TOPPER_A, MODEL_TOPPER, 1, chCarrotAnimations,
func_80388080, func_80326224, func_80387DF4,
2000, 0, 1.0f, 0
};
ActorInfo D_8038AC9C = { 0x1E6, ACTOR_TOPPER_B, MODEL_TOPPER, 1, chCarrotAnimations,
func_80388080, func_80326224, func_80387DF4,
2000, 0, 1.0f, 0
};
ActorAnimationInfo chOnionAnimations[5] = {
{0, 0.0f},
{0x226, 1000000.0f},
{0x226, 1.0f},
{0x227, 0.75f},
{0x226, 1.0f}
};
ActorInfo D_8038ACE8 = { 0x129, ACTOR_BAWL_A, MODEL_BAWL, 1, chOnionAnimations,
func_80388080, func_80326224, func_80387DF4,
0, 0, 1.0f, 0
};
ActorInfo D_8038AD0C = { 0x1E7, ACTOR_BAWL_B, MODEL_BAWL, 1, chOnionAnimations,
func_80388080, func_80326224, func_80387DF4,
0, 0, 1.0f, 0
};
ActorAnimationInfo chCauliflowerAnimations[5] = {
{0, 0.0f},
{0x225, 10000000.0f},
{0x225, 1.0f},
{0x225, 10000000.0f},
{0x225, 1.0f}
};
ActorInfo D_8038AD58 = { 0x128, ACTOR_164_COLLYWOBBLE_A, MODEL_COLLYWOBBLE, 1, chCauliflowerAnimations,
func_80388080, func_80326224, func_80387DF4,
0, 0, 2.0f, 0
};
ActorInfo D_8038AD7C = { 0x1E8, ACTOR_COLLYWOBBLE_B, MODEL_COLLYWOBBLE, 1, chCauliflowerAnimations,
func_80388080, func_80326224, func_80387DF4,
0, 0, 2.0f, 0
};
s32 D_8038ADA0[3] = {0xFF, 0xFF, 0xFF};
struct31s D_8038ADAC = {
{0.1f, 0.5f},
{1.5f, 3.0f},
{0.0f, 0.01f},
{1.0f, 1.5f},
0.0f, 0.01f,
};
struct42s D_8038ADD4 = {
{{-100.0f, -100.0f, -100.0f}, {100.0f, 100.0f, 100.0f}},
{{-40.0f, -40.0f, -40.0f}, {40.0f, 40.0f, 40.0f}}
};
struct31s D_8038AE04 = {
{0.5f, 0.75f},
{0.4f, 0.6f},
{0.0f, 0.01f},
{4.0f, 4.0f},
0.0f, 0.2f
};
struct43s D_8038AE2C = {
{{-100.0f, 200.0f, -100.0f}, {100.0f, 400.0f, 100.0f}},
{{0.0f, -600.0f, 0.0f}, {0.0f, -600.0f, 0.0f}},
{{-80.0f, -80.0f, -80.0f}, {80.0f, 80.0f, 80.0f}}
};
struct31s D_8038AE74 = {
{1.0f, 1.0f},
{1.0f, 1.0f},
{0.0f, 0.01f},
{2.0f, 2.0f},
0.0f, 0.5f
};
struct43s D_8038AE9C = {
{{-100.0f, 400.0f, -100.0f}, {100.0f, 600.0f, 100.0f}},
{{0.0f, -600.0f, 0.0f}, {0.0f, -600.0f, 0.0f}},
{{-20.0f, -20.0f, -20.0f}, {20.0f, 20.0f, 20.0f}}
};
struct31s D_8038AEE4 = {
{0.6f, 0.8f},
{0.5f, 0.7f},
{0.0f, 0.01f},
{4.0f, 4.0f},
0.0f, 0.5f
};
struct43s D_8038AF0C ={
{{-200.0f, 200.0f, -200.0f}, {200.0f, 600.0f, 200.0f}},
{{0.0f, -900.0f, 0.0f}, {0.0f, -900.0f, 0.0f}},
{{-100.0f, -100.0f, -100.0f}, {100.0f, 100.0f, 100.0f}},
};
/* .code */
void func_80387910(ParticleEmitter *arg0, f32 *arg1, s32 arg2){
s32 sp24[3] = D_8038ADA0;
func_802EFFA8(arg0, sp24);
particleEmitter_setSprite(arg0, ASSET_700_SPRITE_DUST);
particleEmitter_setStartingFrameRange(arg0, 0, 7);
particleEmitter_setPosition(arg0, arg1);
func_802EFB98(arg0, &D_8038ADAC);
particleEmitter_setPositionAndVelocityRanges(arg0, &D_8038ADD4);
particleEmitter_emitN(arg0, arg2);
}
void func_803879B8(ParticleEmitter *arg0, f32 *arg1, s32 arg2, enum asset_e model_id){
func_802EF9F8(arg0, 0.6f);
func_802EFA18(arg0, 2);
particleEmitter_setModel(arg0, model_id);
particleEmitter_setPosition(arg0, arg1);
func_802EFA70(arg0, 2);
func_802EFE24(arg0, -300.0f, -300.0f, -300.0f, 300.0f, 300.0f, 300.0f);
func_802EFB98(arg0, &D_8038AE04);
particleEmitter_setPositionVelocityAndAccelerationRanges(arg0, &D_8038AE2C);
particleEmitter_emitN(arg0, arg2);
}
void func_80387A80(ParticleEmitter *arg0, f32 *arg1, s32 arg2, enum asset_e model_id){
func_802EF9F8(arg0, 0.6f);
func_802EFA18(arg0, 3);
particleEmitter_setModel(arg0, model_id);
particleEmitter_setPosition(arg0, arg1);
func_802EFA70(arg0, 2);
func_802EFE24(arg0, -300.0f, -300.0f, -300.0f, 300.0f, 300.0f, 300.0f);
func_802EFB98(arg0, &D_8038AE74);
particleEmitter_setPositionVelocityAndAccelerationRanges(arg0, &D_8038AE9C);
particleEmitter_emitN(arg0, arg2);
}
void func_80387B48(ParticleEmitter *arg0, f32 arg1[3], s32 arg2, enum asset_e model_id){
func_802EF9F8(arg0, 0.7f);
func_802EFA18(arg0, 4);
particleEmitter_setModel(arg0, model_id);
particleEmitter_setPosition(arg0, arg1);
func_802EFA70(arg0, 2);
func_802EFE24(arg0, 150.0f, -300.0f, -300.0f, 300.0f, 300.0f, -150.0f);
func_802EF9EC(arg0, 0x1f, 0x1f40);
func_802EFB98(arg0, &D_8038AEE4);
particleEmitter_setPositionVelocityAndAccelerationRanges(arg0, &D_8038AF0C);
particleEmitter_emitN(arg0, arg2);
}
void func_80387C28(Actor * this){
ChVeg * local = (ChVeg *)&this->local;
f32 sp30[3];
FUNC_8030E8B4(SFX_111_WHIPCRACK_DEATH, 1.0f, 32000, this->position, 1000, 2000);
if(local->unkC == 3){
sp30[0] = this->position_x;
sp30[1] = this->position_y;
sp30[2] = this->position_z;
sp30[1] += 50.0f;
func_80387B48(partEmitList_pushNew(0xC), sp30, 0xC, 0x4F4);
func_803879B8(partEmitList_pushNew(4), sp30, 0x4, 0x4F2);
func_803879B8(partEmitList_pushNew(4), sp30, 0x4, 0x4F3);
sp30[1] += 50.0f;
func_80387910(partEmitList_pushNew(8), sp30, 8);
}//L80387D18
if(this->unk38_31){
this->position_y += 100.0f;
func_802CA1CC(HONEYCOMB_17_SM_COLIWOBBLE);
func_802C3F04((GenMethod_4)func_802C4218, 0x1f, reinterpret_cast(s32, this->position_x), reinterpret_cast(s32, this->position_y), reinterpret_cast(s32, this->position_z));
}//L80387D64
func_803252D0(1.5f, 7);
actor_collisionOff(this);
if(local->unkC != 3){
func_80328B8C(this, 3, 0.0f, 1);
actor_playAnimationOnce(this);
}
else{
marker_despawn(this->marker);
}
}
void func_80387DCC(ActorMarker *marker, ActorMarker *other_marker){
func_80387C28(marker_getActor(marker));
}
Actor *func_80387DF4(ActorMarker *marker, Gfx **gdl, Mtx **mptr, Vtx **arg3){
Actor *actor = marker_getActor(marker);
if(actor->unk138_24)
func_8033A470(3, 7);
else
func_8033A45C(3, 0);
return func_80325888(marker, gdl, mptr, arg3);
}
void func_80387E64(Actor *this){
ChVeg *local = (ChVeg *)&this->local;
this->unk1C_x = randf2(-50.0f, 50.0f);
this->unk1C_y = randf2(-50.0f, 50.0f);
this->unk1C_z = randf2(-50.0f, 50.0f);
this->unk1C_x = local->unk0_x + this->unk1C_x;
this->unk1C_y = local->unk0_y + this->unk1C_y;
this->unk1C_z = local->unk0_z + this->unk1C_z;
}
void func_80387F00(Actor *this){
ChVeg *local = (ChVeg *)&this->local;
this->position_y += (mapSpecificFlags_get(0xC) || func_803203FC(0xC1, this)) ? 120.0 : 180.0;
local->unk0_x = this->position_x;
local->unk0_y = this->position_y;
local->unk0_z = this->position_z;
this->velocity_x = 0.0f;
this->velocity_y = 0.0f;
this->velocity_z = 0.0f;
func_80387E64(this);
}
int func_80387FA8(Actor *this, ChVeg *local, s32 yaw, s32 arg3){
f32 sp24[3];
f32 sp18[3];
sp18[0] = arg3;
sp18[1] = 0.0f;
sp18[2] = 0.0f;
ml_vec3f_yaw_rotate_copy(sp18, sp18, yaw - 90.0);
sp24[0] = sp18[0] + local->unk0_x;
sp24[1] = sp18[1] + local->unk0_y;
sp24[2] = sp18[2] + local->unk0_z;
if(func_80307258(sp24, this->unk10_25 - 1, this->unk10_18 - 1) == -1)
return 0;
else
return 1;
}
void func_80388080(Actor *this){
f32 temp_velZ;
f32 temp_velX;
f32 temp_f0;
f32 sp78;
f32 sp6C[3];
f32 sp60[3];
f32 sp54[3];
ChVeg *local = (ChVeg *)&this->local; //sp38
f32 sp30;
if(!this->initialized){
switch(this->marker->unk14_20){
default:
local->unkC = 3; //cauliflower
break;
case 0x12A: //L803880F0
case 0x1E6: //L803880F0
local->unkC = 1; //carrot
break;
case 0x129: //L80388100
case 0x1E7: //L80388100
local->unkC = 2; //onion
break;
}
actor_collisionOff(this);
marker_setCollisionScripts(this->marker, NULL, NULL, func_80387DCC);
this->unk1C_x = this->position_x;
this->unk1C_y = this->position_y;
this->unk1C_z = this->position_z;
this->position_y -= 200.f;
do{//L80388154
temp_velX = randf2(-10.0f, 10.0f);
temp_f0 =(0.0f <= temp_velX) ? temp_velX : -temp_velX;
}while(temp_f0 < 5.0);
do{//L803881AC
temp_velZ = randf2(-10.0f, 10.0f);
temp_f0 =(0.0f <= temp_velZ) ? temp_velZ : -temp_velZ;
}while(temp_f0 < 5.0);
this->velocity_x = temp_velX;
this->velocity_y = (local->unkC == 3) ? 90.0f : 70.0f;
this->velocity_z = temp_velZ;
this->unk138_24 = 1;
this->unk138_23 = 0;
this->unk38_0 = 0;
this->initialized = 1;
this->scale = 0.5;
}//L80388278
switch (this->state)
{
case 1: //L803882B0
if(mapSpecificFlags_get(0xC) || func_803203FC(0xC1) || this->unk10_12){
//L803882E4
if(mapSpecificFlags_get(0xC) || func_803203FC(0xC1)){ //L8038830C
this->unk1C_y += (local->unkC == 3)? 120.0 : 0.0;
}else{//L80388350
this->unk1C_y += (local->unkC == 3)? 270.0 : 85.0;
}
//L80388384
func_80328A84(this, 4);
}
break;
case 4: //L8038839C
this->position_x = this->velocity_x + this->position_x;
this->position_y = this->velocity_y + this->position_y;
this->position_z = this->velocity_z + this->position_z;
this->velocity_y -= 5.0f;
this->scale = MIN(this->scale + 0.05, 1.0);
if(this->velocity_y < 0.0f && this->position_y < this->unk1C_y){
this->position_y = func_80309724(this->position);
if(local->unkC == 3)
func_80387F00(this);
actor_collisionOn(this);
func_80328A84(this, 2);
}//L80388494
if(!this->unk138_23){
if(0.0f < this->position_y){
FUNC_8030E8B4(SFX_C5_TWINKLY_POP, 1.0f, 32000, this->position, 1000, 2000);
this->unk138_23 = 1;
this->scale = 1.0f;
}
}
break;
case 2: //L803884E4
if(this->unk38_0){
if(func_80329480(this)){
this->unk38_0 = 0;
}
}else{//L80388520
if(local->unkC == 1){
this->unk28 = 3.0f;
if(mapSpecificFlags_get(0xC) || func_803203FC(0xC1)){//L80388554
if(!func_80329030(this, 0) && func_80329480(this)){
func_80328CEC(this, (s32)this->yaw, 0x78, 0xb4);
this->unk38_0 = 1;
}//L803885A0
if(func_803292E0(this)){
this->yaw_moving = func_80329784(this);
}
else{//L803885CC
if(randf() < 0.02){
func_80328CEC(this, (s32)this->yaw, 0x1E, 0x5A);
}
}//L80388B68
}
else{//L80388618
this->yaw_moving = func_80329784(this);
}
}
else if(local->unkC == 2){//L80388634
this->unk28 = 4.0f;
if(!func_80329030(this, 0) && func_80329480(this)){
func_80328CEC(this, (s32)this->yaw, 0x78, 0xB4);
this->unk38_0 = 1;
}//L80388698
if(mapSpecificFlags_get(0xC) || (func_803203FC(0xC1) && func_803292E0(this))){
this->yaw_moving = func_80329784(this);
}else{//L803886E4
if(randf() < 0.02){//D_8038B1D0){
func_80328CEC(this, (s32)this->yaw, 0x1E, 0x5A);
}
}
}else{//L80388730
sp78 = time_getDelta();
sp6C[0] = this->unk1C_x - this->position_x;
sp6C[1] = this->unk1C_y - this->position_y;
sp6C[2] = this->unk1C_z - this->position_z;
if( gu_sqrtf(sp6C[0]*sp6C[0] + sp6C[1]*sp6C[1] + sp6C[2]*sp6C[2] ) < 40.0f){
ml_vec3f_set_length(sp6C, 400.0f);
}
else{
ml_vec3f_set_length(sp6C, 100.0f);
}
this->position_x += this->velocity_x*sp78 + sp6C[0]*sp78*sp78;
this->position_y += this->velocity_y*sp78 + sp6C[1]*sp78*sp78;
this->position_z += this->velocity_z*sp78 + sp6C[2]*sp78*sp78;
this->velocity_x += sp6C[0]*sp78;
this->velocity_y += sp6C[1]*sp78;
this->velocity_z += sp6C[2]*sp78;
if(gu_sqrtf(this->velocity_z*this->velocity_z + (this->velocity_x*this->velocity_x + this->velocity_y*this->velocity_y)) > 50.0f){
ml_vec3f_set_length(this->velocity, 50.0f);
}
if(ml_vec3f_distance(this->position, this->unk1C) < 20.0f){
func_80387E64(this);
}
this->unk28 = 5.0f;
if(mapSpecificFlags_get(0xC) || (func_803203FC(0xc1))){ //L8038892C
if(!func_80387FA8(this, local, (s32)this->yaw, (s32)this->unk28)){
if(func_80329480(this)){
func_80328CEC(this, (s32)this->yaw, 0x78, 0xb4);
this->unk38_0 = 1;
}//L80388994
}else{ //L803889A0
this->position_x -= local->unk0_x;
this->position_y -= local->unk0_y;
this->position_z -= local->unk0_z;
this->unk1C_x -= local->unk0_x;
this->unk1C_y -= local->unk0_y;
this->unk1C_z -= local->unk0_z;
TUPLE_ASSIGN(sp60, this->unk28, 0.0f, 0.0f);
ml_vec3f_yaw_rotate_copy(sp60, sp60, this->yaw - 90.0);
local->unk0_x = sp60[0] + local->unk0_x;
local->unk0_y = sp60[1] + local->unk0_y;
local->unk0_z = sp60[2] + local->unk0_z;
this->position_x = local->unk0_x + this->position_x;
this->position_y = local->unk0_y + this->position_y;
this->position_z = local->unk0_z + this->position_z;
this->unk1C_x = local->unk0_x + this->unk1C_x;
this->unk1C_y = local->unk0_y + this->unk1C_y;
this->unk1C_z = local->unk0_z + this->unk1C_z;
}//L80388AD8
if(func_803292E0(this)){
this->yaw_moving = func_80329784(this);
}else{//L80388B04
if(randf() < 0.01){
func_80328CEC(this, (s32)this->yaw, 0x1e, 0x5A);
}
}
}else{
//L80388B50
this->yaw_moving = func_80329784(this);
}
}
}//L80388B68
func_80328FB0(this, 2.0f);
if(local->unkC != 3 && actor_animationIsAt(this, 0.3f))
FUNC_8030E8B4(SFX_3F2_UNKNOWN, 1.0f, 22000, this->position, 1000, 2000);
if(local->unkC == 3 && actor_animationIsAt(this, 0.4f)){
FUNC_8030E8B4(SFX_2_CLAW_SWIPE, 0.9f, 8000, this->position, 1000, 2000);
}
break;
case 3: //L80388BFC
if(actor_animationIsAt(this, (local->unkC == 2) ? 0.4 : 0.05)){
sp54[0] = this->position_x;
sp54[1] = this->position_y;
sp54[2] = this->position_z;
if(local->unkC == 1)
sp54[1] += 150.0f;
this->unk138_24 = 0;
func_80387A80(partEmitList_pushNew(3), sp54, 3, (local->unkC == 1)? 0x4f0: 0x4f1);
}//L80388CC4
if(actor_animationIsAt(this, 0.75f))
func_80326310(this);
break;
}//L80388CE0
}//*/

33
src/SM/code_0.c Normal file
View File

@@ -0,0 +1,33 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern void func_80288F78(Actor*, f32, s32);
typedef struct {
s16 unk0;
//u8 pad2[2];
void (*unk4)(Actor *, s32);
s32 pad8;
s32 padC;
}Struct_SM_0;
/* .code */
void func_803863F0(Actor *this, s32 arg1) {
func_80288F78(this, 0.20f, 0xF280FA);
}
void func_80386420(Actor *arg0, s32 arg1) {
func_80288F78(arg0, 0.20f, 0x3ED803E);
func_80288F78(arg0, 0.35f, 0x3ED8C3E);
func_80288F78(arg0, 0.71f, 0x21F336);
func_80288F78(arg0, 0.79f, 0x21F336);
func_80288F78(arg0, 0.80f, 0x3ED8C3E);
func_80288F78(arg0, 0.87f, 0x21F336);
}
/* .data */
Struct_SM_0 D_8038AAC0[2] = {
{0x20A, func_803863F0, 0, 0},
{0x208, func_80386420, 0, 0},
};

17
src/SM/code_2900.c Normal file
View File

@@ -0,0 +1,17 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
/* .code */
void func_80388CF0(void){
if(getGameMode() != GAME_MODE_7_ATTRACT_DEMO){
func_8034DEB4(func_8034C528(0x1F2), 0.0f);
func_8034DEB4(func_8034C528(0x1F3), -5000.0f);
}
}
void func_80388D48(void){
if(*(u32*)PHYS_TO_K1(0x200) - PHYS_TO_K1(0xC290000)){
func_80388CF0();
}
}

563
src/SM/code_2990.c Normal file
View File

@@ -0,0 +1,563 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
//external
Actor *func_802D94B4(ActorMarker*, Gfx**, Mtx**, Vtx**);
void func_8028E668(f32*, f32, f32, f32);
void func_80328FB0(Actor *, f32);
void func_8030DA44(u8);
void func_80324E88(f32);
void func_80328B8C(Actor *, s32, f32, s32);
//static types
typedef struct sm_2900_struct{
s16 unk0; //text_id
s16 unk2; //text_id
s8 unk4;
s8 unk5; //ability_id
}SM2900Struct;
//public
void func_803899B0(Actor * this);
void func_80389610(Actor * this);
/* .data */
ActorAnimationInfo D_8038AF60[6] = {
{0, 0.0f},
{ASSET_13A_ANIM_BOTTLES_ENTER, 2000000000.0f},
{ASSET_13A_ANIM_BOTTLES_ENTER, 4.5f},
{ASSET_13B_ANIM_BOTTLES_IDLE, 7.0f},
{ASSET_139_ANIM_BOTTLES_EXIT, 1.7f},
{ASSET_13A_ANIM_BOTTLES_ENTER, 2000000000.0f}
};
ActorInfo D_8038AF90 = { MARKER_B7_TUTORIAL_BOTTLES, ACTOR_12B_TUTORIAL_BOTTLES, ASSET_387_MODEL_BOTTLES, 1, D_8038AF60, //bottles
func_803899B0, func_80326224, func_802D94B4,
0, 0, 0.0f, 0
};
SM2900Struct D_8038AFB4[8] = {
{0xdf3, 0xe08, 1, -1},
{0xdf4, 0xdf5, 3, ABILITY_3_CAMERA_CONTROL},
{0xdfb, 0xdfe, 5, ABILITY_F_DIVE},
{ -1, 0xe00, 6, ABILITY_B_RATATAT_RAP},
{0xe04, 0xe06, 8, ABILITY_0_BARGE},
{ -1, 0xdfa, 4, ABILITY_8_FLIP},
{0xe01, 0xe03, 7, ABILITY_5_CLIMB},
{0xe10, 0xe11, 0x11, -1},
};
s32 D_8038AFE4 = 0;
/* .code */
int func_80388D80(void){
return ability_isUnlocked(ABILITY_F_DIVE)
|| ability_isUnlocked(ABILITY_4_BEAR_PUNCH)
|| ability_isUnlocked(ABILITY_C_ROLL)
|| ability_isUnlocked(ABILITY_B_RATATAT_RAP)
|| ability_isUnlocked(ABILITY_0_BARGE)
|| ability_isUnlocked(ABILITY_A_HOLD_A_JUMP_HIGHER)
|| ability_isUnlocked(ABILITY_7_FLAP)
|| ability_isUnlocked(ABILITY_8_FLIP)
|| ability_isUnlocked(ABILITY_5_CLIMB);
}
void func_80388E48(void){
ability_unlock(ABILITY_3_CAMERA_CONTROL);
ability_setHasUsed(ABILITY_0_BARGE);
ability_setHasUsed(ABILITY_1_BEAK_BOMB);
ability_setHasUsed(ABILITY_2_BEAK_BUSTER);
ability_setHasUsed(ABILITY_3_CAMERA_CONTROL);
ability_setHasUsed(ABILITY_4_BEAR_PUNCH);
ability_setHasUsed(ABILITY_5_CLIMB);
ability_setHasUsed(ABILITY_B_RATATAT_RAP);
ability_setHasUsed(ABILITY_C_ROLL);
ability_setHasUsed(ABILITY_A_HOLD_A_JUMP_HIGHER);
}
void func_80388EB0(void){
ability_unlock(ABILITY_F_DIVE);
ability_unlock(ABILITY_4_BEAR_PUNCH);
ability_unlock(ABILITY_C_ROLL);
ability_unlock(ABILITY_B_RATATAT_RAP);
ability_unlock(ABILITY_0_BARGE);
ability_unlock(ABILITY_A_HOLD_A_JUMP_HIGHER);
ability_unlock(ABILITY_7_FLAP);
ability_unlock(ABILITY_8_FLIP);
ability_unlock(ABILITY_5_CLIMB);
func_80388E48();
mapSpecificFlags_set(3,1);
}
void func_80388F24(Actor *this){
if(this->unkF4_8 == 1 && !mapSpecificFlags_get(1)){
timed_setCameraToNode(0.0f, 0x12);
}
else{ //L80388F68
timed_setCameraToNode(0.0f, D_8038AFB4[this->unkF4_8 -1].unk4);
}
}
void func_80388FA0(Actor *this, s32 arg1){
Actor *other;
ActorMarker *myOther;
switch(this->state){
case 1://L80388FE8
this->unk138_23 = 1;
break;
case 4://L80388FF8
this->unk138_23 = 0;
case 2://L80389004
func_8030DA44(this->unk44_31);
this->unk44_31 = 0;
break;
case 5://L80389018
this->unk138_23 = 0;
func_8028F918(0);
break;
}//L8038902C
switch(arg1){
case 4:
other = func_80329980(this);
myOther = this->unk100;
if(myOther && other && myOther->unk14_20 == 0xB8)
func_80328B8C(other, 3, 0.0001f, 1);
actor_playAnimationOnce(this);
this->unk44_31 = func_8030D90C();
sfxsource_setSfxId(this->unk44_31, 0x3f9);
func_8030DD14(this->unk44_31, 2);
func_8030DBB4(this->unk44_31, 1.4f);
sfxsource_setSampleRate(this->unk44_31, 0x6590);
func_8028F918(0);
break;
case 1:
animctrl_setSmoothTransition(this->animctrl, 0);
break;
case 5:
func_80388F24(this);
func_8028F94C(2,this->position);
func_80389610(this);
break;
case 3:
actor_loopAnimation(this);
break;
case 2:
other = func_80329980(this);
myOther = this->unk100;
if(myOther && other && myOther->unk14_20 == 0xB8)
func_80328B8C(other, 2, 0.0001f, 1);
animctrl_setSmoothTransition(this->animctrl, 1);
actor_playAnimationOnce(this);
this->unk44_31 = func_8030D90C();
sfxsource_setSfxId(this->unk44_31, 0x3f9);
func_8030DD14(this->unk44_31, 2);
func_8030DBB4(this->unk44_31, 1.4f);
sfxsource_setSampleRate(this->unk44_31, 0x6590);
func_80388F24(this);
func_8028F94C(2, this->position);
break;
}
func_80328B8C(this, arg1, 0.0001f, 1);
}
void func_80389214(ActorMarker *marker, enum asset_e text_id, s32 arg2){
Actor *actor = marker_getActor(marker);
switch(arg2){
case 3:
timed_setCameraToNode(0.0f, 2);
break;
case 4:
mapSpecificFlags_set(4,1);
break;
case 5:
timed_setCameraToNode(0.0f, 0x12);
break;
case 6:
func_8025A70C(COMUSIC_2B_DING_B);
break;
case 0xff:
func_80388F24(actor);
break;
}
}
void func_803892C8(ActorMarker *marker, enum asset_e text_id, s32 arg2){
Actor *actor;
actor = marker_getActor(marker);
if(!mapSpecificFlags_get(3) && func_802DA498()){
mapSpecificFlags_set(3, 1);
func_80311480(0xe12, 0xe, actor->position, actor->marker, func_803892C8, NULL);
}//L8038933C
else{
if( !(text_id == 0xdf3 || text_id == 0xe1f || text_id == 0xe1d) ){
func_80324E88(0.0f);
}
switch(text_id){
case 0xd38:
break;
case 0xdf3:/* 2FB8 803893A8 3C188039 */
func_80311480(0xe1f, 0x8e, actor->position, actor->marker, func_803892C8, func_80389214);
break;
case 0xe1f:/* 2FEC 803893DC 9209003B */
actor->unk38_0 = 1;
break;
case 0xe1d:/* 2FFC 803893EC 920B0138 */
actor->unk138_24 = 0;
actor->unk60 = 0.0f;
break;
case 0xdf6: /* 3014 80389404 0C0A3E46 */
case 0xdff: /* 3014 80389404 0C0A3E46 */
func_8028F918(0);
break;
case 0xe09:
case 0xe12:
func_80388FA0(actor,4);
break;
default:
if(actor->state !=5 )
func_80311480(0xd38, 4, NULL, NULL, NULL, NULL);
func_80388FA0(actor, actor->state == 5 ? 1:4);
break;
}
}
}
void func_80389494(Actor * this, s32* arg1, s32 *arg2){
if(ability_isUnlocked(D_8038AFB4[this->unkF4_8 -1].unk5)){
if(func_8031FF1C(0xDB)){
*arg1 = D_8038AFE4 + 0xE0A; //dialog index
D_8038AFE4++;
D_8038AFE4 = MIN(D_8038AFE4, 5);
if(*arg1 != 0xE0E){
*arg2 |= 1;
}
}else{//L8038956C
*arg2 |= 1;
*arg1 = D_8038AFB4[this->unkF4_8 -1].unk2;
if(*arg1 == 0xdfe && !ability_hasUsed(ABILITY_3_CAMERA_CONTROL)){
*arg1 = 0xdfd;
}
}
}else{//L803895C0
*arg1 = D_8038AFB4[this->unkF4_8 -1].unk0;
ability_unlock(D_8038AFB4[this->unkF4_8 -1].unk5);
}
}
void func_80389610(Actor * this){
s32 sp2C;
s32 sp28;
sp28 = 0xe;
sp2C = 0;
switch(this->unkF4_8){
case 1://L8038965C
if(mapSpecificFlags_get(1)){
sp28 |= 1;
if(func_8031FF1C(0xDB)){
sp2C = D_8038AFE4 + 0xE0A; //dialog index
D_8038AFE4++;
D_8038AFE4 = MIN(D_8038AFE4, 5);
}else{//L803896C0
sp2C = D_8038AFB4[this->unkF4_8 -1].unk2;
}
}
else{//L803896E8
sp2C = D_8038AFB4[this->unkF4_8 -1].unk0;
mapSpecificFlags_set(1,1);
}
break;
case 8://L80389720
if(mapSpecificFlags_get(3)){
if(func_8031FF1C(BKPROG_A6_FURNACE_FUN_COMPLETE)){
sp2C = 0xe37;
sp28 |= 1;
}else{//L80389758
if(mapSpecificFlags_get(0xf)){
sp2C = 0xe0f;
sp28 |= 1;
}else{//L80389780
func_80388E48();
sp2C = func_8031FF1C(0xdb) ? 0xe1e : 0xe13;
mapSpecificFlags_set(0xf, 1);
}
} //L803897B4
mapSpecificFlags_set(2, 1);
}
else{//L803897C8
if(mapSpecificFlags_get(2)){
sp2C = D_8038AFB4[this->unkF4_8 -1].unk2;
sp28 |= 1;
}
else{
sp2C = D_8038AFB4[this->unkF4_8 -1].unk0;
mapSpecificFlags_set(2, 1);
}
}
break;
case 4://L80389848
if( !ability_isUnlocked(ABILITY_4_BEAR_PUNCH)
|| !ability_isUnlocked(ABILITY_C_ROLL)
|| !ability_isUnlocked(ABILITY_B_RATATAT_RAP)
){//L803898D4
mapSpecificFlags_set(4, 1);
}
else{//L803898E4
func_80389494(this, &sp2C, &sp28);
}
break;
case 6://L803898A0
if( !ability_isUnlocked(ABILITY_A_HOLD_A_JUMP_HIGHER)
|| !ability_isUnlocked(ABILITY_7_FLAP)
|| !ability_isUnlocked(ABILITY_8_FLIP)
){//L803898D4
mapSpecificFlags_set(0xE, 1);
}
else{//L803898E4
func_80389494(this, &sp2C, &sp28);
}
break;
default://L803898F8
func_80389494(this, &sp2C, &sp28);
break;
}//L80389904
if(sp2C){
func_80311480(sp2C, sp28, this->position, this->marker, func_803892C8, func_80389214);
}
}
void func_80389948(ActorMarker * marker){
Actor *actor;
Actor *other;
s32 pad;
actor = marker_getActor(marker);
other = spawn_child_actor(0x12c, &actor);
actor->unk100 = other->marker;
if(marker);
}
void func_80389984(Actor * this){
u8 tmp;
tmp = this->unk44_31;
if(tmp)
func_8030DA44(tmp);
}
void func_803899B0(Actor * this){
s32 sp50[6]; //face buttons
f32 sp44[3]; //player position
void *sp40;
int sp34;
int sp38;
if(this->unkF4_8 >= 9)
return;
if(!this->initialized){
this->marker->propPtr->unk8_3 = 0;
actor_collisionOff(this);
this->initialized = 1;
func_803300D8(this->marker, func_80389984);
if(this->unkF4_8 == 1 || this->unkF4_8 == 8){//L80389A30
sp40 = func_80304C38(0x349, this);
if(!sp40){
this->unk1C_x = this->position_x;
this->unk1C_y = this->position_y;
this->unk1C_z = this->position_z;
this->unk28 = 300.0f;
} else{ //L80389A68
nodeprop_getPosition(sp40, this->unk1C);
this->unk28 = nodeprop_getRadius(sp40);
}//L80389A8C
if(this->unkF4_8 == 1){
if(func_803203FC(1) || func_803203FC(0x1F)){
func_80388FA0(this, 3);
}
}
}//L80389AC8
if(func_80388D80()){
mapSpecificFlags_set(1,1);
if(func_802DA498()){
mapSpecificFlags_set(3, 1);
mapSpecificFlags_set(2, 1);
mapSpecificFlags_set(0xC, 1);
mapSpecificFlags_set(0xF, 1);
}
}
}//L80389B20
if(!this->unk16C_4){
func_802C3C88((GenMethod_1)func_80389948, reinterpret_cast(s32, this->marker));
this->unk16C_4 = 1;
}//L80389B4C
if(this->unk138_23){
func_8028E668(this->position, 180.0f, -40.0f, 120.0f);
}//L80389B64
func_8024E55C(0,sp50); //get face buttons press counters
player_getPosition(sp44);
switch (this->state)
{
case 1://L80389BAC
this->yaw_moving = (f32)func_80329784(this);
func_80328FB0(this, 4.0f);
if( (this->unkF4_8 == 1 && !mapSpecificFlags_get(1))
|| (this->unkF4_8 == 8 && !mapSpecificFlags_get(2))
|| (this->unkF4_8 == 8 && mapSpecificFlags_get(3) && !mapSpecificFlags_get(0xF))
){//L80389C50
if( ((ml_vec3f_distance(sp44, this->unk1C) < this->unk28) && func_8028F20C())
|| mapSpecificFlags_get(0x10)
){//L80389C8C
if(func_80329530(this, 0x96))
func_8028F45C(9, this->position);
//L80389CA4
func_80388FA0(this, 2);
}
}
else{//L80389CBC
if( !func_80329530(this, 0xfa)
|| func_8028ECAC()
|| !func_8028F20C()
|| func_8028EC04()
) break;
sp34 = !((!(D_8038AFB4[this->unkF4_8-1].unk5 + 1)) || (!ability_isUnlocked( D_8038AFB4[this->unkF4_8-1].unk5)));
if( (!sp34 && this->unkF4_8 != 1)
|| func_8031FF1C(0xDB) == 0
|| D_8038AFE4 < 6
){
if(this->unkF4_8 != 8 || !func_8031FF1C(0xFC)){
if( func_8028EFC8()
&& sp50[1] == 1
){
if(sp34 || this->unkF4_8 == 1 || this->unkF4_8 == 8){
func_80388FA0(this, 5);
}
else{
if(func_80329530(this, 0x96) && !sp34){
func_8028F45C(9, this->position);
}
func_80388FA0(this, 2);
}
}
}
}
}
break;
case 2://L80389E2C
this->yaw_moving = func_80329784(this);
func_80328FB0(this, 4.0f);
if( (f64) 0.0 < animctrl_getAnimTimer(this->animctrl)
&& animctrl_getAnimTimer(this->animctrl) < 0.16
){
func_8030E2C4(this->unk44_31);
}//L80389EA0
if(actor_animationIsAt(this, 0.9999f)){
if(!mapSpecificFlags_get(1)){
func_80389610(this);
}
func_80388FA0(this, 3);
}//L80389EE0
else if(actor_animationIsAt(this, 0.14f)){
FUNC_8030E8B4(SFX_C6_SHAKING_MOUTH, 1.2f, 24000, this->position, 1250, 2500);
}else if(actor_animationIsAt(this, 0.4f)){ //L80389F14
FUNC_8030E8B4(SFX_2C_PULLING_NOISE, 1.2f, 24000, this->position, 1250, 2500);
}else if(actor_animationIsAt(this, 0.75f)){//L80389F48
FUNC_8030E8B4(SFX_C5_TWINKLY_POP, 1.0f, 32000, this->position, 1250, 2500);
}else if(actor_animationIsAt(this, 0.35f)){//L80389F78
if(mapSpecificFlags_get(1)){
func_80389610(this);
}
}
break;
case 3://L80389FAC
this->yaw_moving = func_80329784(this);
func_80328FB0(this, 4.0f);
if( ( actor_animationIsAt(this, 0.37f)
|| actor_animationIsAt(this, 0.66f)
|| actor_animationIsAt(this, 0.85f)
)
&& randf() < 0.2
){
animctrl_setDirection(this->animctrl, animctrl_isPlayedForwards(this->animctrl)^1);
}//L8038A088
else if( actor_animationIsAt(this, 0.25f)
|| actor_animationIsAt(this, 0.28f)
|| actor_animationIsAt(this, 0.31f)
){
func_8030E878(SFX_6F_BANJO_HEADSCRATCH, randf2(1.4f, 1.55f), 16000, this->position, 1250.0f, 2500.0f);
} //L8038A0D8
else if( actor_animationIsAt(this, 0.45f)
|| actor_animationIsAt(this, 0.48f)
|| actor_animationIsAt(this, 0.51f)
|| actor_animationIsAt(this, 0.7f)
|| actor_animationIsAt(this, 0.73f)
|| actor_animationIsAt(this, 0.76f)
){
func_8030E878(SFX_6F_BANJO_HEADSCRATCH, randf2(1.35f, 1.5f), 6000, this->position, 1250.0f, 2500.0f);
}//L8038A194
if(mapSpecificFlags_get(5)){
mapSpecificFlags_set(5,0);
func_80388FA0(this, 4);
}//L8038A1B8
sp38 = -1;
if(this->unk38_0){
this->unk60 += time_getDelta();
if(func_803114C4() != 0xe1d){
if(sp50[0] == 1)
sp38 = 1; //A button pressed
else if(sp50[1] == 1)
sp38 = 0; //B button pressed
}//L8038A218
if( sp38 != -1){ //button was pressed
func_80320004(0xdb, (sp38)?0:1);
func_80311480((sp38)? 0xe07 : 0xe09, 0xe, this->position, this->marker, func_803892C8, func_80389214);
if(!sp38){
func_80388EB0(); //give all SM moves
}
this->unk38_0 = 0;
}else if(!this->unk138_24 && 5.0 < this->unk60){
func_80311480(0xe1d, 0x86, this->position, this->marker, func_803892C8, NULL);
this->unk138_24 = 1;
}
}
break;
case 4://L8038A31C
if( 0.35 < animctrl_getAnimTimer(this->animctrl)
&& animctrl_getAnimTimer(this->animctrl) < 0.9
){
func_8030E2C4(this->unk44_31);
}else{//L8038A378
if(actor_animationIsAt(this, 0.9999f)){
func_80388FA0(this, 1);
func_80386540();
}
}
break;
}//L8038A3A0
}

64
src/SM/code_3FC0.c Normal file
View File

@@ -0,0 +1,64 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern f32 D_80365E04[3][3];
void func_8038A3B0(Actor *this);
/* .data */
ActorAnimationInfo D_8038AFF0[] = {
{0, 0.0f},
{0x248, 1.816f},
{0x248, 9e+09f},
};//chBanjosBedAnimations
ActorInfo D_8038B008 = {
0xE1, 0x198, 0x530,
2, D_8038AFF0,
func_8038A3B0, func_80326224, func_80325888,
0, 0, 0.0f, 0
};//chBanjosBed
ActorAnimationInfo D_8038B02C[] = {
{0, 0.0f},
{0x247, 3.0f},
{0x247, 9e+09f},
};//chBanjosChairAnimations
ActorInfo D_8038B044 ={
0xE2, 0x199, 0x52F,
2, D_8038B02C,
func_8038A3B0, func_80326224, func_80325888,
0, 0, 0.0f, 0
};//chBanjosChair
ActorAnimationInfo D_8038B068[] = {
{0, 0.0f},
{0x249, 1.0f},
{0x249, 9e+09f},
};//chBanjosStoveAnimations
ActorInfo D_8038B080 ={
0xE3, 0x19A, 0x337,
2, D_8038B068,
func_8038A3B0, func_80326224, func_80325888,
0, 0, 0.0f, 0
};//chBanjosStove
/* .code */
void func_8038A3B0(Actor *this){
s32 sp24 = this->marker->unk14_20 - 0xe1;
if(this->marker->unk14_21)
func_8034A174(this->marker->unk44, 0x1f, D_80365E04[sp24]);
actor_collisionOff(this);
if(this->state == 2 && levelSpecificFlags_get(sp24 + 0x35)){
func_80328A84(this, 1);
actor_playAnimationOnce(this);
}
}

145
src/SM/code_4070.c Normal file
View File

@@ -0,0 +1,145 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
//extern
Actor *func_802D94B4(ActorMarker *, Gfx **, Mtx **, Vtx**);
void func_8024E55C(s32, void *);
void func_80324E88(f32);
//public
void func_8038A5D8(Actor *this);
void func_8038A4DC(Actor *this, s32 arg1);
/* .data */
ActorInfo D_8038B0B0 = { 0x1ED, 0x3B9, 0, 1, NULL,
func_8038A5D8, func_80326224, func_80325340,
0, 0, 0.0f, 0
};
/* .code */
void func_8038A460(Actor *this){
timed_setCameraToNode(0.0f,4);
}
void func_8038A488(ActorMarker *caller, enum asset_e text_id, s32 arg2){
Actor *actor = marker_getActor(caller);
if(text_id == 0xdf9 || text_id == 0xe12){
func_8038A4DC(actor, 3);
}
func_80324E88(0.0f);
}
void func_8038A4DC(Actor *this, s32 arg1){
switch(arg1){
case 2://L8038A50C
this->sm_4070.unk0 = 0;
player_getPosition(this->velocity);
func_8028F918(0);
if(ability_isUnlocked(ABILITY_7_FLAP)){
mapSpecificFlags_set(9,1);
}else if(ability_isUnlocked(ABILITY_A_HOLD_A_JUMP_HIGHER)){//L8038A540
mapSpecificFlags_set(8,1);
}else{//L8038A560
func_8038A460(this);
ability_unlock(ABILITY_A_HOLD_A_JUMP_HIGHER);
func_80311480(0xdf6, 0xe, this->unk1C, this->marker, func_8038A488, NULL);
this->sm_4070.unk0 = 0xe1a;
mapSpecificFlags_set(8, 0);
}
break;
case 3://L8038A5B0
mapSpecificFlags_set(5, 1);
break;
}//L8038A5BC
func_80328A84(this, arg1);
}
void func_8038A5D8(Actor *this){
f32 sp5C[3];
s32 sp44[6];
f32 sp40;
Actor *temp_v0;
s32 temp_a0;
if(!this->initialized){
temp_v0 = func_80326D68(this->position, ACTOR_12B_TUTORIAL_BOTTLES, -1, &sp40);
if(temp_v0){
this->unk1C_x = temp_v0->position_x;
this->unk1C_y = temp_v0->position_y;
this->unk1C_z = temp_v0->position_z;
}
else{//L8038A630
this->unk1C_x = this->position_x;
this->unk1C_y = this->position_y;
this->unk1C_z = this->position_z;
}//L8038A644
this->initialized = 1;
}//L8038A650
func_8024E55C(0, sp44);
switch (this->state)
{
case 1://L8038A688
if(func_8031FF1C(0xdb)){
marker_despawn(this->marker);
}else{
if(mapSpecificFlags_get(0xe)){
func_8038A4DC(this, 2);
}
}
break;
case 2://L8038A6C8
if(!func_803114B0()){
if(mapSpecificFlags_get(8)){
func_8038A460(this);
ability_unlock(ABILITY_7_FLAP);
func_80311480(0xdf7, 0xa, this->unk1C, this->marker, func_8038A488, NULL);
this->sm_4070.unk0 = 0xe1b;
mapSpecificFlags_set(8,0);
}//L8038A730
if(mapSpecificFlags_get(9)){
func_8038A460(this);
ability_unlock(ABILITY_8_FLIP);
func_80311480(0xdf8, 0xa, this->unk1C, this->marker, func_8038A488, NULL);
this->sm_4070.unk0 = 0xe1c;
mapSpecificFlags_set(9,0);
}//L8038A794
if(mapSpecificFlags_get(0xa)){
func_8038A460(this);
func_8028F94C(2, this->unk1C);
if(!mapSpecificFlags_get(3) && func_802DA498()){
mapSpecificFlags_set(3,1);
temp_a0 = 0xe12;
}else{
temp_a0 = 0xdf9;
}
func_80311480(temp_a0, 0xe, this->unk1C, this->marker, func_8038A488, NULL);
mapSpecificFlags_set(0xa,0);
this->sm_4070.unk0 = 0;
}
}//L8038A828
player_getPosition(sp5C);
sp5C[0] = this->velocity_x;
sp5C[2] = this->velocity_z;
func_8028FAB0(sp5C);
if( func_8028EFC8()
&& sp44[1] == 1
&& func_8028F20C()
){
if(this->sm_4070.unk0)
func_80311480(temp_a0 = this->sm_4070.unk0, 0, NULL, NULL, NULL, NULL);
}
break;
case 3://L8038A8A0
marker_despawn(this->marker);
break;
}//L8038A8AC
}

57
src/SM/code_44D0.c Normal file
View File

@@ -0,0 +1,57 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
f32 func_8028E82C(void);
void func_8028F3D8(f32 *, f32, void(*)(ActorMarker *), ActorMarker *);
// prototypes
void func_8038A8F8(Actor *this);
/* .data */
ActorInfo D_8038B0E0 = { 0x1F0, 0x3BD, 0, 0, NULL,
func_8038A8F8, func_80326224, func_80325340,
0, 0, 0.0f, 0
};
/* .code */
void func_8038A8C0(ActorMarker *arg0){
mapSpecificFlags_set(0x10, 0);
func_8028E6EC(2);
func_8028F918(0);
}
void func_8038A8F8(Actor *this){
f32 sp2C;
NodeProp *other;
if(!this->unk16C_4){
other = func_80304C38(0x3be, this);
if(!other){
this->unk1C_x = this->position_x;
this->unk1C_y = this->position_y;
this->unk1C_z = this->position_z;
}else{
nodeprop_getPosition(other, this->unk1C);
}
actor_collisionOff(this);
this->unk16C_4 = 1;
}//L8038A968
player_getPosition(this->velocity);
sp2C = ml_vec3f_distance(this->velocity, this->position);
if(sp2C < (f32) this->unkF4_8)
func_80388D48();
if( !mapSpecificFlags_get(0x10) && sp2C < (f32) this->unkF4_8 && 1780.0f < func_8028E82C()){
if( !mapSpecificFlags_get(2)
|| (mapSpecificFlags_get(3) && !mapSpecificFlags_get(0xf))
){ //L8038AA54
this->yaw_moving = ml_vec3f_distance(this->velocity, this->unk1C) / 150.0;
func_8028F3D8(this->unk1C, this->yaw_moving, func_8038A8C0, this->marker);
mapSpecificFlags_set(0x10, 1);
}
}
}

64
src/SM/code_46C0.c Normal file
View File

@@ -0,0 +1,64 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#define US_1_0 0
#define PAL 1
u8 D_8038BFC2;
#if VERSION == US_1_0
int func_8038AAB0(void){return 0;}
#elif VERSION == PAL
void func_8038AAB0(s32 arg0, s32 arg1){
if(arg1 < 0){
func_8031A844();
}
else{
D_8038BFC2 = arg1;
func_8038B4D0(3);
}
}
// #pragma GLOBAL_ASM("asm/nonmatchings/SM/code_46C0/func_8038A8F0.s")
void func_8038A8F0(s32 arg0) {
u8 temp_v0;
switch (arg0) { /* irregular */
case 1:
D_8038BFC1 = 1;
func_80319400();
break;
case 2:
D_8038BFC8->unk0 = (s32) D_8038BD38;
D_8038BFC8->unk4 = (s32) D_8038BD3C;
D_8038BFC8->unk10 = (s32) D_8038BD40;
D_8038BFC8->unk20 = (s32) D_8038BD44;
D_8038BFC8->unk30 = (s32) D_8038BD48;
func_8031A5E4(&D_8038BD30, &D_8038BD34, (void *)0x8038BFC8, 0xA, &D_8038B490);
break;
case 3:
temp_v0 = *(u8 *)0x8038BFC2;
if (temp_v0 != 0) {
func_8031B9A4(temp_v0 - 1, 0x80390000);
}
func_802FAF44(0);
D_8038BFC1 = 0;
break;
}
D_8038BFC0 = (s8) arg0;
}
// #pragma GLOBAL_ASM("asm/nonmatchings/SM/code_46C0/func_8038A9E4.s")
// #pragma GLOBAL_ASM("asm/nonmatchings/SM/code_46C0/func_8038AA30.s")
// #pragma GLOBAL_ASM("asm/nonmatchings/SM/code_46C0/func_8038AA64.s")
// #pragma GLOBAL_ASM("asm/nonmatchings/SM/code_46C0/func_8038AA74.s")
// #pragma GLOBAL_ASM("asm/nonmatchings/SM/code_46C0/func_8038AAE8.s")
#endif

View File

@@ -0,0 +1,5 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
int func_8038AAB0(void){return 0;}

151
src/SM/code_5B0.c Normal file
View File

@@ -0,0 +1,151 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include "prop.h"
void func_803869A0(Actor*, f32, f32);
void func_802C4218(s32, f32, f32, f32);
void func_80386EF4(Actor *this);
void func_80386A00(Actor *this);
/*.data */
ActorAnimationInfo D_8038AAF0[] = {
{0, 0.f},
{0x2B9, 5.0f}
};
ActorInfo D_8038AB00 = {
0x135, 0x16F, 0x42D,
1, NULL,
func_80386EF4, func_80326224, func_80325E78,
2000, 0, 5.0f, 0
};
ActorInfo D_8038AB24 = {
0x29D, 0x3CA, 0x47B,
1, D_8038AAF0,
func_80386A00, func_80326224, func_80325E78,
0, 0, 0.0f, 0
};
struct43s D_8038AB48 = {
{{-200.0f, 600.0f, -200.0f}, {200.0f, 800.0f, 200.0f}},
{{0.0f, -1800.0f, 0.0f}, {0.0f, -1800.0f, 0.0f}},
{{-100.0f, -100.0f, -100.0f}, {100.0f, 100.0f, 100.0f}}
};
s32 D_8038AB90[3] = {0xFF, 0xFF, 0xFF};
struct43s D_8038AB9C = {
{{-100.0f, -100.0f, -100.0f}, {100.0f, 100.0f, 100.0f}},
{{0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}},
{{-100.0f, -100.0f, -100.0f}, {100.0f, 100.0f, 100.0f}}
};
/* .code */
void func_803869A0(Actor *this, f32 arg1, f32 arg2) {
if (actor_animationIsAt(this, arg1)) {
func_8030E878(SFX_98_DEAF_THUD, arg2, 32000, this->position, 2000.0f, 4000.0f);
}
}
void func_80386A00(Actor *this) {
if (this->unk16C_4 <= 0) {
if (func_8031FF1C(BKPROG_FC_DEFEAT_GRUNTY) == 0) {
marker_despawn(this->marker);
return;
}
actor_collisionOff(this);
if(0);
this->marker->propPtr->unk8_3 = 1;
this->unk16C_4 = 1;
}
func_803869A0(this, 0.20f, 1.00f);
func_803869A0(this, 0.27f, 1.05f);
func_803869A0(this, 0.50f, 0.95f);
func_803869A0(this, 0.65f, 1.05f);
func_803869A0(this, 0.90f, 1.00f);
func_803869A0(this, 0.95f, 0.95f);
}
void func_80386B04(ParticleEmitter *p_ctrl, f32 *arg1, s32 arg2, f32 arg3) {
func_802EF9F8(p_ctrl, 0.6f);
func_802EFA18(p_ctrl, 4);
func_802EFA5C(p_ctrl, 0.00f, 0.75f);
particleEmitter_setModel(p_ctrl, 0x42E);
particleEmitter_setPosition(p_ctrl, arg1);
func_802EFA70(p_ctrl, 2);
func_802EFB70(p_ctrl, arg3, arg3);
func_802EFB84(p_ctrl, arg3, arg3);
func_802EFE24(p_ctrl, -100.0f, -100.0f, -100.0f, 100.0f, 100.0f, 100.0f);
particleEmitter_setSpawnIntervalRange(p_ctrl, 0.00f, 0.01f);
func_802EFEC0(p_ctrl, 2.0f, 2.0f);
particleEmitter_setPositionVelocityAndAccelerationRanges(p_ctrl, &D_8038AB48);
particleEmitter_emitN(p_ctrl, arg2);
}
void func_80386C2C(ParticleEmitter *p_ctrl, f32 *arg1, s32 arg2, f32 arg3) {
func_802EFFA8(p_ctrl, D_8038AB90);
particleEmitter_setSprite(p_ctrl, ASSET_700_SPRITE_DUST);
func_802EFA5C(p_ctrl, 0.00f, 0.01f);
particleEmitter_setStartingFrameRange(p_ctrl, 0, 7);
particleEmitter_setPosition(p_ctrl, arg1);
func_802EFB70(p_ctrl, (arg3 * 0.1), (arg3 * 0.5));
func_802EFB84(p_ctrl, (arg3 * 1.5), (arg3 * 3.0));
particleEmitter_setSpawnIntervalRange(p_ctrl, 0.0f, 0.01f);
func_802EFEC0(p_ctrl, 1.5f, 2.0f);
particleEmitter_setPositionVelocityAndAccelerationRanges(p_ctrl, &D_8038AB9C);
particleEmitter_emitN(p_ctrl, arg2);
}
void func_80386D68(Actor *this){
FUNC_8030E8B4(SFX_9B_BOULDER_BREAKING_1, 1.0f, 32000, this->position, 1000, 2000);
this->unk44_31 = func_8030D90C();
sfxsource_setSfxId(this->unk44_31, 0x3F9);
func_8030DD14(this->unk44_31, 3);
sfxsource_setSampleRate(this->unk44_31, 32000);
func_8030DBB4(this->unk44_31, (0.01 < (2.0 - this->scale))? (2.0 - this->scale): 0.01);
func_8030E2C4(this->unk44_31);
func_80386B04(partEmitList_pushNew(0xA), this->position, 0xA, this->scale);
func_80386C2C(partEmitList_pushNew(0x10), this->position, 0x10, this->scale);
if(this->unk100 && func_803870E8(this->unk100)){
func_802CA1CC(HONEYCOMB_18_SM_QUARRIES);
func_802C3F04((GenMethod_4)func_802C4218, 0x1F, reinterpret_cast(s32, this->position[0]), reinterpret_cast(s32, this->position[1]), reinterpret_cast(s32, this->position[2]));
}
marker_despawn(this->marker);
}
void func_80386EB4(ActorMarker *marker, ActorMarker *other_marker) {
Actor *this;
this = marker_getActor(marker);
if ((this->state ) == 2) {
func_80386D68(this);
}
}
void func_80386EF4(Actor *this) {
u32 temp_t3;
Actor *other;
if ((this->unk16C_4) <= 0) {
this->marker->propPtr->unk8_3 = 1;
marker_setCollisionScripts(this->marker, 0, 0, func_80386EB4);
this->unk38_31 = 0;
this->unk138_31 = 1;
this->unk16C_4 = 1;
}
if ((this->state) == 1) {
temp_t3 = this->unk38_31++ ^ 2;
if ((temp_t3) == 0) {
other = func_80326EEC(0x16E);
if (other != NULL) {
this->unk100 = other->marker;
} else {
this->unk100 = NULL;
}
func_80328A84(this, 2);
}
}
}

43
src/SM/code_BF0.c Normal file
View File

@@ -0,0 +1,43 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
void func_80386FE0(Actor *this);
/* .data */
ActorInfo D_8038ABF0 = {
0x134, 0x16E, 0,
1, NULL,
func_80386FE0, func_80326224, func_80325340,
2000, 0, 0.0f, 0
};
/* .code */
void func_80386FE0(Actor *this){
if(!this->unk16C_4){
this->unk10_12 = 0;
this->unk38_31 = this->unk10_12;
this->unk16C_4 = 1;
actor_collisionOff(this);
}
switch(this->state){
case 1://L80387064
if(this->unk38_31++ == 2){
this->unk10_12 = func_80326F58(0x16f);
func_80328A84(this, 2);
}
break;
case 2://L803870C4
if(this->unk10_12 == 0)
marker_despawn(this->marker);
break;
}//L803870DC
}
int func_803870E8(ActorMarker * arg0){
Actor *actor = marker_getActor(arg0);
return (--actor->unk10_12)==0 ? 1 : 0;
}

161
src/SM/code_F0.c Normal file
View File

@@ -0,0 +1,161 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include "prop.h"
int ability_hasLearned(s32);
extern s32 D_80275650;
extern ActorInfo D_8038AB00;
extern ActorInfo D_8038ABF0;
extern ActorInfo D_8038AC20; //chAttackTutorial
extern ActorInfo D_8038AC78; //chCarrot Slave?
extern ActorInfo D_8038ACE8; //ch onion A
extern ActorInfo D_8038AD58; //ch cauliflower A
extern ActorInfo D_8038AC9C; //chCarrot FreeRange?
extern ActorInfo D_8038AD0C; //ch onion B
extern ActorInfo D_8038AD7C; //ch cauliflower B
extern ActorInfo D_8038AF90; //D_8038AF90 bottles
extern ActorInfo D_8038B0B0; //chJumpTutorial code_4070
extern ActorInfo D_8038B0E0;
extern ActorInfo D_8038B008; //chBanjosBed
extern ActorInfo D_8038B044; //chBanjosChair
extern ActorInfo D_8038B080; //chBanjosStove
extern ActorInfo D_8038AB24;
extern u32 D_803FFE00;
extern u32 D_803FFE04;
extern u32 D_803FFE08;
extern u32 D_803FFE0C;
/* .data */
s32 D_8038AAE0 = 0x000FE2C1; //compiled SM_code_crc_1
s32 D_8038AAE4 = 0x8C0992D1; //compiled SM_code_crc_2
union {
u8 byte[4];
s32 word;
} D_8038AAE8 = {0x00, 0x01, 0xEB, 0x56}; //compiled SM_data_crc_1 (with this zeroed out)
s32 D_8038AAEC = 0;
/* .bss */
struct {
s32 unk0; //calculated SM_code_crc1
s32 unk4; //calculated SM_code_crc2
s32 unk8; //calculated SM_data_crc1
s32 unkC; //calculated SM_data_crc2
} D_8038B320;
/* .code */
//dynamically gets learned ability bitfield address
u32 *func_803864E0(void){
s16 *addr;
addr = (s16*)ability_hasLearned;
return (u32 *)((addr[1] << 0x10) + addr[3]);
}
void func_803864FC(enum ability_e arg0){
u32 *addr;
if(getGameMode() != GAME_MODE_7_ATTRACT_DEMO){
addr = func_803864E0();
*addr = 1 << arg0;
}
}
void func_80386540(void){
u32 *sp2C;
s32 sp28;
u32 *addr;
u32 sp20;
sp2C = func_803864E0();
sp28 = *sp2C;
*sp2C = 0;
if(ability_hasLearned(ABILITY_1_BEAK_BOMB)){
addr = (u32*)ability_hasLearned;
addr[2] = 0x03E00008; //jr $ra
addr[3] = 0x00001025; //or $v0, $zero, $zero
osWritebackDCache(addr, 0x10);
osInvalICache(addr, 0x10);
}
*sp2C = sp28;
osPiReadIo(0x574, &sp20);
if((sp20 = (sp20 & 0xffff)) != 0x6c07)
func_803864FC(ABILITY_A_HOLD_A_JUMP_HIGHER);
if(!SM_CRCs_are_valid())
func_803864FC(ABILITY_10_TALON_TROT);
if(!func_803866CC())
func_803864FC(ABILITY_C_ROLL);
}
void func_80386614(u8 *arg0, u8 *arg1, s32 *arg2, s32 *arg3){
s32 temp_v0 = 0;
s32 temp_v1 = -1;
s32 i;
s32 val;
u8* iPtr;
iPtr = arg0;
for(i = (arg1 - arg0); i > 0 ; i--){
val = *(iPtr++);
temp_v0 += val;
temp_v1 ^= val << (temp_v0 & 0x17);
}
if(arg1); //make $a1 not used in loop
*arg2 = temp_v0;
*arg3 = temp_v1;
}
extern s32 D_00005E70;
int func_803866CC(void){
u32 sp24;
if( (osPiReadIo((u32)&D_00005E70 + 8, &sp24), sp24 == D_803FFE00)
&& (osPiReadIo((u32)&D_00005E70 + 12, &sp24), sp24 == D_803FFE04)
&& (osPiReadIo((u32)&D_00005E70 + 16, &sp24), sp24 == D_803FFE08)
&& (osPiReadIo((u32)&D_00005E70 + 20, &sp24), sp24 == D_803FFE0C)
){
return 1;
}
return 0;
}
bool SM_CRCs_are_valid(void){
if( D_8038B320.unk0 == D_8038AAE0
&& D_8038B320.unk4 == D_8038AAE4
&& D_8038B320.unkC == D_80275650
&& D_8038B320.unk8 == D_8038AAE8.word + D_8038AAE8.byte[0] + D_8038AAE8.byte[1] + D_8038AAE8.byte[2] + D_8038AAE8.byte[3]
){
return TRUE;
}
return FALSE;
}
void func_80386810(void)
{
spawnableActorList_add(&D_8038AB00, actor_new, 0X2000180);
spawnableActorList_add(&D_8038ABF0, actor_new, 0X80);
spawnableActorList_add(&D_8038AC20, actor_new, 0);
spawnableActorList_add(&D_8038AC78, actor_new, 0X2000121);
spawnableActorList_add(&D_8038ACE8, actor_new, 0X2000121);
spawnableActorList_add(&D_8038AD58, actor_new, 0X2200121);
spawnableActorList_add(&D_8038AC9C, actor_new, 0X2000121);
spawnableActorList_add(&D_8038AD0C, actor_new, 0X2000121);
spawnableActorList_add(&D_8038AD7C, actor_new, 0X2200121);
spawnableActorList_add(&D_8038AF90, actor_new, 0X100);
spawnableActorList_add(&D_8038B0B0, actor_new, 0);
spawnableActorList_add(&D_8038B0E0, actor_new, 0);
spawnableActorList_add(&D_8038B008, actor_new, 0X6C8);
spawnableActorList_add(&D_8038B044, actor_new, 0X6C8);
spawnableActorList_add(&D_8038B080, actor_new, 0X6C8);
spawnableActorList_add(&D_8038AB24, actor_new, 0X400);
}