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

123
src/MMM/ch/loggo.c Normal file
View File

@@ -0,0 +1,123 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern void ml_vec3f_assign(f32[3], f32, f32, f32);
void chLoggo_update(Actor *this);
/* .data */
ActorAnimationInfo chLoggoAnimations[] = {
{0, 0.0f},
{ASSET_238_ANIM_LOGGO_IDLE, 0.8f},
{ASSET_240_ANIM_LOGGO_FLUSH, 3.0f}
};
ActorInfo chLoggo = {
MARKER_252_LOGGO, ACTOR_37F_LOGGO, ASSET_519_MODEL_LOGGO,
0x1, chLoggoAnimations,
chLoggo_update, func_80326224, func_80325888,
1000, 0, 0.0f, 0
};
/* .code */
void __chLoggo_flush(ActorMarker* marker) {
Actor* sp1C = marker_getActor(marker);
func_8028F918(2);
func_80328B8C(sp1C, 2, 0.01, 1);
actor_playAnimationOnce(sp1C);
sp1C->unk60 = 3.2f;
}
void __chLoggo_textCallback(ActorMarker* caller, enum asset_e text_id, s32 arg3) {
__chLoggo_flush(caller);
}
void __chLoggo_collide(ActorMarker* this_marker, ActorMarker *other_marker) {
Actor *this = marker_getActor(this_marker);
if ((player_getTransformation() == TRANSFORM_3_PUMPKIN) && !func_8031FF1C(BKPROG_89_ENTERED_LOGGO_AS_PUMPKIN)) {
if (func_80311480(ASSET_ADF_TEXT_ENTER_LOGGO, 0x2B, this->position, this->marker, &__chLoggo_textCallback, 0) != 0) {
actor_collisionOff(this);
func_80320004(BKPROG_89_ENTERED_LOGGO_AS_PUMPKIN, TRUE);
}
return;
}
if ((player_getTransformation() == TRANSFORM_3_PUMPKIN) && func_8031FF1C(BKPROG_89_ENTERED_LOGGO_AS_PUMPKIN)) {
actor_collisionOff(this);
__chLoggo_flush(this_marker);
return;
}
if ((player_getTransformation() == TRANSFORM_1_BANJO) && !func_8031FF1C(BKPROG_88_TRIED_LOGGO_AS_BEAR)){
if(func_80311480(ASSET_ADE_TEXT_LOGGO_AS_BEAR, 0x2A, this->position, NULL, NULL, NULL)) {
func_80320004(BKPROG_88_TRIED_LOGGO_AS_BEAR, TRUE);
}
}
}
void chLoggo_update(Actor *this){
f32 sp44;
f32 sp38[3];
s32 sp34;
sp44 = time_getDelta();
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
this->marker->propPtr->unk8_3 = TRUE;
actor_collisionOn(this);
marker_setCollisionScripts(this->marker, __chLoggo_collide, NULL, NULL);
func_80328B8C(this, 1, 0.01f, 1);
actor_loopAnimation(this);
this->unk60 = 0.0f;
if(!func_8031FF1C(BKPROG_8A_EXITED_LOGGO) && levelSpecificFlags_get(0x33)){
if(func_80311480(ASSET_AE0_TEXT_EXIT_LOGGO, 4, NULL, NULL, NULL, NULL)){
func_80320004(BKPROG_8A_EXITED_LOGGO, TRUE);
}
}
}
switch(this->state){
case 1:
sp34 = func_803114B0() ? 12000 : 0;
if(actor_animationIsAt(this, 0.09f)){
func_8030E878(SFX_109_LOGGO_LID_CLAP, randf2(0.975f, 1.025f), MAX(0, 22000 - sp34), this->position, 400.0f, 1000.0f);
break;
}
if(actor_animationIsAt(this, 0.37f)){
func_8030E878(SFX_20_METAL_CLANK_1, randf2(1.675f, 1.725f), MAX(0, 12000 - sp34), this->position, 400.0f, 1000.0f);
break;
}
if(actor_animationIsAt(this, 0.6f)){
func_8030E878(SFX_3F_CAULDRON_SQEAK_1, randf2(0.975f, 1.025f), MAX(0, 7000 - sp34), this->position, 400.0f, 1000.0f);
break;
}
if(actor_animationIsAt(this, 0.16f)){
func_8030E878(SFX_40_CAULDRON_SQEAK_2, randf2(0.975f, 1.025f), MAX(0, 7000 - sp34), this->position, 400.0f, 1000.0f);
break;
}
break;
case 2:
if(actor_animationIsAt(this, 0.46f)){
this->marker->propPtr->unk8_3 = FALSE;
FUNC_8030E8B4(SFX_92_TOILET_FLUSH, 1.0f, 32000, this->position, 600, 1500);
levelSpecificFlags_set(0x33, TRUE);
ml_vec3f_assign(sp38, this->position_x - 50.0f, this->position_y + 50.0f, this->position_z);
func_8028F6E4(0x2F, sp38);
}
if(0.0 < this->unk60){
this->unk60 -= sp44;
}
else{
func_8031F7D4(0, 0);
}
break;
}
}

202
src/MMM/ch/motzhand.c Normal file
View File

@@ -0,0 +1,202 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
typedef struct{
f32 alpha; //motzhand_alpha
u8 *pattern_ptr;
u8 unk8; //pattern_id
u8 unk9; //end_current seq?
f32 unkC[3];
}ActorLocal_Motzhand;
void chmotzhand_update(Actor *this);
Actor *chMotzhand_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
/* .data */
ActorInfo chMotzhand = {
MARKER_49_MOTZHAND, ACTOR_3A_MOTZHAND, ASSET_88C_MODEL_MOTZHAND,
0x0, NULL,
chmotzhand_update, func_80326224, chMotzhand_draw,
0, 0, 0.0f, 0
};
u8 sMotzhandPattern1[] = {7, 14, 13, 9, 17, 0xFF};
u8 sMotzhandPattern2[] = {10, 18, 15, 9, 14, 13, 9, 17, 11, 15, 0xFF};
/* .code */
void func_80387410(f32 dst[3]){
dst[0] = 0.0f;
dst[1] = 1500.0f;
dst[2] = -2400.0f;
}
void chMotzhand_setState(Actor *this, s32 next_state){
ActorLocal_Motzhand * local = (ActorLocal_Motzhand *) &this->local;
if(next_state == 1 && this->state == 0){
func_80335924(this->unk148, 0xa7, 0.0f, 1.8f);
func_80387410(this->position);
}
if(next_state == 2){
func_80335924(this->unk148, 0xA7, 0.9f, 1.8f);
}
if(next_state == 3){
func_80335924(this->unk148, 0xA8, 0.9f, 1.8f);
}
if(next_state == 4){
local->alpha = 1.0f;
}
if(next_state == 5){
marker_despawn(this->marker);
}
this->state = next_state;
}
Actor *chMotzhand_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
Actor *this = marker_getActor(marker);
ActorLocal_Motzhand * local = (ActorLocal_Motzhand *) &this->local;
f32 sp3C[3];
if(this->state == 0 || this->state == 5)
return this;
func_8033A238(func_803356A0(this->unk148));
if(this->state == 4){
func_8033A410((s32) (local->alpha * 255.0f));
}
else{
func_8033A410((s32) 255);
}
sp3C[0] = sp3C[1] = sp3C[2] = 0.0f;
sp3C[1] = 180.0f;
set_model_render_mode(1);
func_803391A4(gfx, mtx, this->position, sp3C, 1.0f, NULL, func_80330B1C(marker));
this->marker->unk14_21 = func_8033A170();
return this;
}
void func_80387654(ActorMarker* marker) {
Actor* actor = marker_getActor(marker);
if ((actor->state != 4) && (actor->state != 5)) {
chMotzhand_setState(actor, 4);
}
}
bool func_8038769C(ActorMarker *marker) {
return marker_getActor(marker)->state == 1;
}
// chMotzhand_startPattern
void func_803876C8(ActorMarker *marker, s32 arg1){
Actor *this = marker_getActor(marker);
ActorLocal_Motzhand * local = (ActorLocal_Motzhand *) &this->local;
local->unk8 = arg1;
if(arg1 == TRUE){
local->pattern_ptr = sMotzhandPattern1;
}
else{
local->pattern_ptr = sMotzhandPattern2;
}
chMotzhand_setState(this, 2);
}
void func_80387720(ActorMarker *marker) {
Actor * this = marker_getActor(marker);
ActorLocal_Motzhand * local = (ActorLocal_Motzhand *) &this->local;
local->unk9 = TRUE;
}
void chmotzhand_update(Actor *this){
ActorLocal_Motzhand * local = (ActorLocal_Motzhand *) &this->local;
f32 sp48;
f32 sp3C[3];
f32 sp30[3];
sp48 = time_getDelta();
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
if(jiggyscore_isSpawned(JIGGY_60_MMM_MOTZHAND)){
marker_despawn(this->marker);
return;
}
local->unk8 = FALSE;
local->unk9 = FALSE;
local->unkC[0] = this->position_x;
local->unkC[1] = this->position_y;
local->unkC[2] = this->position_z;
chMotzhand_setState(this, 1);
}//L803877CC
if(this->state == 2){
if(local->unk9){
while(*local->pattern_ptr != 0xff){
*local->pattern_ptr++; //find_seq end
}
local->unk9 = FALSE;
}//L80387820
if(0xff == *local->pattern_ptr){
func_80387410(sp30);
}
else{
func_80389BCC(*local->pattern_ptr, sp30);
sp30[0] += local->unkC[0];
sp30[1] += local->unkC[1];
sp30[2] += local->unkC[2];
}//L80387880
sp3C[0] = sp30[0] - this->position_x;
sp3C[1] = sp30[1] - this->position_y;
sp3C[2] = sp30[2] - this->position_z;
if(gu_sqrtf(sp3C[0]*sp3C[0] + sp3C[1]*sp3C[1] + sp3C[2]*sp3C[2]) < 5.0f){
if(*local->pattern_ptr == 0xff){
chMotzhand_setState(this, 1);
}
else{
chMotzhand_setState(this, 3);
}
}
else{//L80387930
ml_vec3f_set_length(sp3C, ((local->unk8 == TRUE) ? 150.0f : 225.0f)*sp48);
this->position_x = sp3C[0] + this->position_x;
this->position_y = sp3C[1] + this->position_y;
this->position_z = sp3C[2] + this->position_z;
}
}//L803879A4
if(this->state == 3){
if(func_80335794(this->unk148) > 0){
func_80389D9C(*local->pattern_ptr);
if(local->unk9){
while(*local->pattern_ptr != 0xff){
*local->pattern_ptr++; //find_seq end
}
local->unk9 = FALSE;
}
else{//L80387A18
*local->pattern_ptr++;
}
chMotzhand_setState(this, 2);
}
}//L80387A2C
if(this->state == 4){
local->alpha -= 0.25*sp48;
if(local->alpha <= 0.0f){
chMotzhand_setState(this, 5);
}
}
}

225
src/MMM/ch/napper.c Normal file
View File

@@ -0,0 +1,225 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
typedef struct{
ActorMarker *jiggy_marker;
f32 unk4;
f32 unk8;
f32 unkC;
u8 unk10;
} ActorLocal_Napper;
void chnapper_update(Actor *this);
Actor *chnapper_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
/* .data */
ActorInfo chNapper = {
MARKER_48_NAPPER, ACTOR_39_NAPPER, ASSET_55E_MODEL_NAPPER,
0x0, NULL,
chnapper_update, chnapper_update, chnapper_draw,
0, 0, 0.0f, 0
};
/* .code */
void __chnapper_setState(Actor *this, s32 next_state){
ActorLocal_Napper *local = (ActorLocal_Napper *)&this->local;
local->jiggy_marker->collidable = TRUE;
local->unk4 = 0.0f;
actor_collisionOff(this);
if(next_state == 1)
func_80335924(this->unk148, ASSET_A3_ANIM_NAPPER_SLEEPING, 0.2f, 2.5f);
if(next_state == 2){
func_80335924(this->unk148, ASSET_A4_ANIM_NAPPER_AWAKE, 0.2f, 5.0f);
actor_collisionOn(this);
local->jiggy_marker->collidable = FALSE;
local->unk8 = randf2(2.0f, 6.0f);
}
if(next_state == 3){
func_80335924(this->unk148, 0xA5, 0.2f, 1.5f);
func_80335A8C(this->unk148, 2);
func_8030E484(SFX_41_MUMBO_ERGHHH);
}
if(next_state == 4){
func_8030E484(SFX_C_TAKING_FLIGHT_LIFTOFF);
func_803895B0(0);
}
if(next_state == 5){
func_80335924(this->unk148, 0xA6, 2.0f, 4.0f);
actor_collisionOn(this);
local->jiggy_marker->collidable = FALSE;
}
this->state = next_state;
}
void func_80386ACC(ActorMarker *this_marker, ActorMarker *other_marker){
Actor *this = marker_getActor(this_marker);
if(!this->unk138_24){
if(func_80311480(0xad8, 0, NULL, NULL, NULL, NULL)){
this->unk138_24 = TRUE;
}
}
}
Actor *chnapper_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
Actor *this = marker_getActor(marker);
ActorLocal_Napper *local = (ActorLocal_Napper *)&this->local;
if(this->state == 1){
func_8033A45C(1, TRUE);
func_8033A45C(2, FALSE);
func_8033A45C(3, FALSE);
}
else {
func_8033A45C(1, FALSE);
func_8033A45C(2, (local->unk10) ? TRUE : FALSE);
func_8033A45C(3, (local->unk10) ? FALSE : TRUE);
}
if(this->state == 1){ //set model alpha
func_8033A410(0x80);
}
else{
func_8033A410(0xdc);
}
return func_80325888(marker, gfx, mtx, vtx);
}
void chnapper_update(Actor *this){
f32 sp74;
f32 sp70;
ActorLocal_Napper *local = (ActorLocal_Napper *)&this->local;
f32 sp68;
Actor *jiggy;
f32 sp58[3];
f32 sp4C[3];
s32 pad;
f32 player_position[3];
f32 sp30[3];
sp68 = time_getDelta();
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
this->scale = 0.5f;
marker_setCollisionScripts(this->marker, func_80386ACC, NULL, NULL);
local->unk10 = TRUE;
local->jiggy_marker = NULL;
local->unk4 = 0.0f;
local->unk8 = 0.0f;
local->unkC = 1.0f;
return;
}//L80386CBC
if(this->state == 0){
jiggy = func_80326EEC(ACTOR_46_JIGGY);
if(jiggy){
local->jiggy_marker = jiggy->marker;
this->position_x = jiggy->position_x;\
this->position_y = jiggy->position_y;\
this->position_z = jiggy->position_z;
this->position_y -= 50.0f;
__chnapper_setState(this, 1);
}
else{
marker_despawn(this->marker);
}
return;
}
func_8033568C(this->unk148, &sp70, &sp74);
local->unk4 += sp68;
if(this->state != 1){
local->unkC -= sp68;
if(local->unkC <= 0.0f){
local->unk10 = 1 - local->unk10;
if(local->unk10 == 0){
local->unkC = randf2(0.1f, 0.2f);
}
else{
local->unkC = randf2(1.5f, 5.0f);
}
}
}//L80386DF4
if(this->state != 4){
func_8024C5CC(sp58);
sp4C[0] = this->position_x - sp58[0];
sp4C[1] = this->position_y - sp58[1];
sp4C[2] = this->position_z - sp58[2];
ml_vec3f_set_length(sp4C, 5.0f);
jiggy = marker_getActor(local->jiggy_marker);
jiggy->position_x = sp4C[0] + this->position_x;
jiggy->position_y = sp4C[1] + this->position_y;
jiggy->position_z = sp4C[2] + this->position_z;
}//L80386E98
if(this->state == 1){
if(sp74 < sp70)
FUNC_8030E624(SFX_5E_BANJO_PHEWWW, 0.8f, 11000);
if(sp70 < 0.5 && 0.5 <= sp74)
FUNC_8030E624(SFX_5D_BANJO_RAAOWW, 0.8f, 11000);
if(!func_80389510()){
__chnapper_setState(this, 2);
}
if(func_80389530() || func_803203FC(0x1f)){
__chnapper_setState(this, 3);
}
}//L80386F74
if(this->state == 2 && func_8025773C(&local->unk8, sp68)){
player_getPosition(player_position);
sp30[0] = player_position[0] - this->position_x;
sp30[1] = player_position[1] - this->position_y;
sp30[2] = player_position[2] - this->position_z;
if( 0.0f < sp30[2]
&& gu_sqrtf(sp30[0]*sp30[0] + sp30[1]*sp30[1] + sp30[2]*sp30[2]) < 600.0f
){
__chnapper_setState(this, 5);
}
else{//L8038703C
local->unk8 = randf2(1.0f, 2.0f);
}
}//L80387058
if(this->state == 5){
if(4.0f <= local->unk4){
__chnapper_setState(this, 2);
}
if(sp70 < 0.35 && 0.35 <= sp74){
if(!func_803114B0()){
func_8030E6A4(SFX_3F5_UNKNOWN, randf2(0.9f, 1.1f), 0x7fff);
}
}
}//L803870F8
if(this->state == 3){
if(func_80335794(this->unk148) > 0){
func_80335924(this->unk148, ASSET_A4_ANIM_NAPPER_AWAKE, 1.0f, 5.0f);
func_80335A8C(this->unk148, 1);
}
if(func_80389524())
__chnapper_setState(this, 4);
}//L80387154
if(this->state == 4){
func_80326224(this);
if(0.99 <= this->unk48)
marker_despawn(this->marker);
}
}

246
src/MMM/code_16B0.c Normal file
View File

@@ -0,0 +1,246 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern void func_80389484(ActorMarker *, f32);
typedef struct {
f32 unk0;
}ActorLocal_PortraitChompa;
void func_80388028(Actor *this);
Actor *func_80387AA0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
/* .data */
extern ActorInfo D_8038BAD0 = {
MARKER_254_PORTRAIT_CHOMPA, ACTOR_381_PORTRAIT_CHOMPA, ASSET_521_MODEL_PORTRAIT_CHOMPA,
0x0, NULL,
func_80388028, NULL, func_80387AA0,
0, 0, 0.0f, 0
};
extern s32 D_8038BAF4[3];
extern struct31s D_8038BB00;
extern struct43s D_8038BB28;
extern struct31s D_8038BB70;
extern struct43s D_8038BB98;
/* .code */
Actor *func_80387AA0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) {
Actor* actor = marker_getActor(marker);
if ((actor->state == 0) || (actor->state == 1) || (actor->state == 6) || (actor->state == 2)) {
return actor;
}
return func_80325888(marker, gfx, mtx, vtx);
}
void func_80387B14(Actor *this, s32 next_state){
ActorLocal_PortraitChompa *local = (ActorLocal_PortraitChompa *) &this->local;
f32 tmp = 2.5f;
this->marker->unk14_20 = 0x1d1;
if(next_state == 1 || next_state == 2){
func_80335924(this->unk148, 0x23e, 0.0f, 2.5f);
func_80335A74(this->unk148, 0.99f);
func_80335A8C(this->unk148, 4);
if(this->state == 4){
local->unk0 = randf2(0.5f, 1.0f);
}
else{
local->unk0 = 0.0f;
}
}//L80387BD0
if(this->state == 1 && next_state == 2){
FUNC_8030E624(SFX_3EF, 0.9f, 32675);
}
if(next_state == 3){
local->unk0 = 0.2f;
}
if(next_state == 4){
this->marker->unk14_20 = 0x254;
func_80335924(this->unk148, 0x23e, 0.0f, 2.5f);
func_80335A8C(this->unk148, 2);
if(this->unk100){
func_80389484(this->unk100, tmp + 0.55);
}
FUNC_8030E624(SFX_3EF, 1.1f, 25000);
FUNC_8030E624(SFX_3EF, 1.1f, 25000);
}//L80387CAC
if(next_state == 5){
func_8030E6D4(SFX_1E_HITTING_AN_ENEMY_2);
actor_collisionOff(this);
}
this->state = next_state;
}
void func_80387CF4(ActorMarker *this_marker, ActorMarker *other_marker) {
func_8030E6D4(0x1E);
}
void func_80387D1C(ActorMarker* this_marker, ActorMarker *other_marker) {
Actor *this = marker_getActor(this_marker);
func_80387B14(this, 5);
}
void func_80387D48(ActorMarker *marker){
Actor *this = marker_getActor(reinterpret_cast(ActorMarker *, marker));
enum asset_e portrait_id;
Actor *portrait;
switch(this->unkF4_8){
case 0x32:
portrait_id = ACTOR_382_PORTRAIT_OF_GRUNTY;
break;
case 0x33:
portrait_id = ACTOR_384_PORTRAIT_OF_BLACKEYE;
break;
case 0x34:
portrait_id = ACTOR_385_PORTRAIT_OF_TOWER;
break;
case 0x35:
portrait_id = ACTOR_386_PORTRAIT_OF_TREE_AND_MOON;
break;
case 0x36:
portrait_id = ACTOR_387_PORTRAIT_OF_TEEHEE;
break;
case 0x37:
portrait_id = ACTOR_388_PORTRAIT_OF_MINION;
break;
default:
portrait_id = ACTOR_382_PORTRAIT_OF_GRUNTY;
break;
}
portrait = spawn_child_actor(portrait_id, &this);
portrait->yaw = this->yaw;
this->unk100 = portrait->marker;
portrait->unk10_1 = FALSE;
}
void func_80387DF8(f32 position[3], s32 count, enum asset_e sprite_id) {
ParticleEmitter *pCtrl;
pCtrl = partEmitList_pushNew(count);
func_802EFFA8(pCtrl, &D_8038BAF4);
particleEmitter_setSprite(pCtrl, sprite_id);
particleEmitter_setPosition(pCtrl, position);
particleEmitter_setPositionVelocityAndAccelerationRanges(pCtrl, &D_8038BB28);
func_802EFB98(pCtrl, &D_8038BB00);
particleEmitter_emitN(pCtrl, count);
}
void func_80387E84(f32 position[3], s32 count, enum asset_e model_id) {
ParticleEmitter *pCtrl;
pCtrl = partEmitList_pushNew(count);
particleEmitter_setModel(pCtrl, model_id);
particleEmitter_setPosition(pCtrl, position);
particleEmitter_setPositionVelocityAndAccelerationRanges(pCtrl, &D_8038BB98);
func_802EFE24(pCtrl, -600.0f, -600.0f, -600.0f, 600.0f, 600.0f, 600.0f);
func_802EF9F8(pCtrl, 0.4f);
func_802EFA18(pCtrl, 3);
func_802EFA20(pCtrl, 1.0f, 1.3f);
func_802EF9EC(pCtrl, 0x2F, 0x3E80);
func_802EFA70(pCtrl, 2);
func_802EFB98(pCtrl, &D_8038BB70);
particleEmitter_emitN(pCtrl, count);
}
void func_80387F7C(Actor *this){
f32 sp2C[3];
f32 sp20[3];
if(!this->marker->unk14_21) return;
func_8034A174(this->marker->unk44, 5, sp2C);
func_8034A174(this->marker->unk44, 6, sp20);
func_80387E84(sp2C, 1, ASSET_523_MODEL_PORTRAIT_CHOMPA_TEETH);
func_80387E84(sp2C, 1, ASSET_524_MODEL_PORTRAIT_CHOMPA_HEAD);
func_80387E84(sp20, 6, ASSET_525_MODEL_PORTRAIT_CHOMPA_PART);
func_80387DF8(sp2C, 2, ASSET_700_SPRITE_DUST);
func_80387DF8(sp20, 2, ASSET_700_SPRITE_DUST);
}
void func_80388028(Actor *this){
ActorLocal_PortraitChompa *local = (ActorLocal_PortraitChompa *) &this->local;
f32 sp58 = time_getDelta();
f32 plyr_position[3];
f32 plyr_dist;
f32 sp44;
f32 sp40;
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
this->unk16C_0 = TRUE;
marker_setCollisionScripts(this->marker, NULL, func_80387CF4, func_80387D1C);
func_802C3C88(func_80387D48, this->marker);
func_80387B14(this, (this->state < 5) ? 1 : 6);
}//L803880B4
player_getPosition(plyr_position);
plyr_dist = ml_vec3f_distance(this->position, plyr_position);
if(this->state == 4)
actor_collisionOn(this);
else
actor_collisionOff(this);
if(this->state == 1 && plyr_dist < this->scale*400.0f){
func_80387B14(this, 2);
}
if(this->state == 2){
if(0.0f < local->unk0){
local->unk0 -= sp58;
}
else if(plyr_dist < this->scale*300.0f){
func_80387B14(this, 3);
}
else if(this->scale*500.0f < plyr_dist){
func_80387B14(this, 1);
}
}//L80388204
if(this->state == 3){
if(func_8025773C(&local->unk0, sp58)){
func_80387B14(this, 4);
}
}
if(this->state == 4){
func_8033568C(this->unk148, &sp44, &sp40);
if(sp44 < 0.56 && 0.56 <= sp40){
this->marker->unk14_20 = 0x1d1;
}
if(sp44 < 0.5 && 0.5 <= sp40){
FUNC_8030E624(SFX_2_CLAW_SWIPE, 0.9f, 32000);
}
if( (sp44 < 0.11 && 0.11 <= sp40)
|| (sp44 < 0.32 && 0.32 <= sp40)
|| (sp44 < 0.53 && 0.53 <= sp40)
){
func_8030E6A4(SFX_6D_CROC_BITE, randf2(0.95f, 1.05f), 32000);
}
if(sp44 < 0.9 && 0.9 <= sp40){
func_8030E6D4(SFX_2_CLAW_SWIPE);
}
if(func_80335794(this->unk148) > 0){
func_80387B14(this, 2);
}
}
if(this->state == 5){
func_8030E6D4(SFX_D7_GRABBA_DEATH);
func_80387F7C(this);
func_80387B14(this, 6);
}
}

421
src/MMM/code_2040.c Normal file
View File

@@ -0,0 +1,421 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include "SnS.h"
extern ActorInfo D_8038BC28;
extern ActorInfo D_8038BCDC;
extern ActorInfo D_8038BC4C;
extern ActorInfo D_8038BDB4;
extern ActorInfo D_8038BDD8;
extern ActorInfo D_8038BDFC;
extern ActorInfo D_8038BC94;
extern ActorInfo D_8038BC70;
extern ActorInfo D_8038BD00;
extern ActorInfo D_8038BD24;
extern ActorInfo D_8038BD48;
extern ActorInfo D_8038BD6C;
extern ActorInfo D_8038BCB8;
extern ActorInfo D_8038BD90;
extern ActorInfo chNapper;
extern ActorInfo D_8038BA68;
extern ActorInfo chMotzhand;
extern ActorInfo chLoggo;
extern ActorInfo D_8038BAD0;
extern ActorInfo D_8038BE48;
extern ActorInfo D_8038BE6C;
extern ActorInfo D_8038BE90;
extern ActorInfo D_8038BEB4;
extern ActorInfo D_8038BED8;
extern ActorInfo D_8038BEFC;
extern ActorInfo D_80367E70;
extern ActorInfo D_80372C3C;
extern void func_80244BB0(s32, s32, s32, f32);
extern void func_8025AE0C(s32, f32);
extern void func_802EE6CC(f32[3], f32[3], s32[4], s32, f32, f32, s32, s32, s32);
extern void *func_80309B48(f32[3], f32[3], f32[3], u32);
void func_802D3D54(Actor *this);
void func_803888B8(Actor *this);
Actor *func_80388994(ActorMarker *marker, Gfx ** gfx, Mtx **mtx, Vtx **vtx);
void func_80388BDC(Actor *this);
void func_80388FE4(Actor *this);
void func_80389004(Actor *this);
void func_80389060(Actor *this);
void func_803890B8(Actor *this);
/* .data */
ActorAnimationInfo D_8038BBE0[] = {
{0x00, 0.0f},
{0x00, 0.0f},
{0xD4, 0.15f},
{0xD5, 0.5f},
{0x00, 0.0f},
{0x00, 0.0f},
{0x00, 0.0f},
{0x00, 0.0f},
{0x00, 0.0f}
};
ActorInfo D_8038BC28 = {
0x9C, 0x109, 0x3CD,
0x1, NULL,
func_802D3D54, func_80326224, func_80325E78,
0, 0, 0.0f, 0
};
ActorInfo D_8038BC4C = {
0x9E, 0x10B, 0x3CF,
0x1, NULL,
func_802D3D54, func_80326224, func_80325E78,
0, 0, 0.0f, 0
};
ActorInfo D_8038BC70 = {
0x9A, 0xCB, 0x3CC,
0x1, NULL,
func_802D3D54, func_80326224, func_80325E78,
0, 0, 0.0f, 0
};
ActorInfo D_8038BC94 = {
0xA2, 0x114, 0x3D3,
0x1, NULL,
func_80388BDC, func_80326224, func_80325E78,
0, 0, 0.0f, 0
};
ActorInfo D_8038BCB8 = {
0xE7, 0x265, 0x4DA,
0x1, NULL,
func_80389004, func_80326224, func_80325E78,
0, 0, 0.0f, 0
};
ActorInfo D_8038BCDC = {
0x9D, 0x10A, 0x3CE,
0x1, NULL,
func_80389004, func_80326224, func_80325E78,
0, 0, 0.0f, 0
};
ActorInfo D_8038BD00 = {
0xD3, 0x191, 0x50B,
0x1, NULL,
func_80389060, func_80326224, func_80325E78,
0, 0, 0.0f, 0
};
ActorInfo D_8038BD24 = {
0x123, 0x2E8, 0x4C0,
0x1, NULL,
func_803890B8, func_80326224, func_80325E78,
0, 0, 0.0f, 0
};
ActorInfo D_8038BD48 = {
0x1F2, 0x2E9, 0x4C1,
0x1, NULL,
func_803890B8, func_80326224, func_80325E78,
0, 0, 0.0f, 0
};
ActorInfo D_8038BD6C = {
0x1F3, 0x2EA, 0x4C2,
0x1, NULL,
func_803890B8, func_80326224, func_80325E78,
0, 0, 0.0f, 0
};
ActorInfo D_8038BD90 = {
0xFE, 0x1FD, 0x43D,
0x1, D_8038BBE0,
func_80388FE4, func_80326224, func_80325888,
0, 0, 0.0f, 0
};
ActorInfo D_8038BDB4 = {
0x9F, 0x10C, 0x3D0,
0x1, NULL,
func_803888B8, func_80326224, func_80388994,
0, 0, 0.0f, 0
};
ActorInfo D_8038BDD8 = {
0xA0, 0x10D, 0x3D1,
0x1, NULL,
func_803888B8, func_80326224, func_80388994,
0, 0, 0.0f, 0
};
ActorInfo D_8038BDFC = {
0xFF, 0x1FE, 0x43E,
0x1, NULL,
func_803888B8, func_80326224, func_80388994,
0, 0, 0.0f, 0
};
s32 D_8038BE20[4] = {0x87, 0x87, 0x87, 0xB4};
/* .code */
f32 func_80388430(Actor *this, s32 arg1, s32 arg2, f32 arg3) {
f32 sp4C[3];
f32 sp40[3];
f32 sp34[3];
if (this->unk38_31 == 0) {
this->unk38_31 = 1;
this->unk1C[1] = 71.0f;
}
this->position[arg1] += (f32) (arg2 * 0x13);
sp34[0] = sp4C[0] = this->position[0];
sp4C[1] = this->position[1];
sp34[2] = sp4C[2] = this->position[2];
this->position[1] += this->unk1C[1];
this->unk1C[1] -= 8.0;
sp34[1] = this->position[1] - 400.0f;
if (this->unk1C[1] < 0.0f) {
if (func_80309B48(sp4C, sp34, sp40, 0) && (this->position[1] <= sp34[1])) {
this->position[1] = sp34[1] + 6.0f;
switch (this->unk38_31) {
case 1:
this->unk38_31 = 2;
this->unk1C[1] = 38.0f;
break;
case 2:
this->unk38_31 = 3;
this->unk1C[1] = 11.0f;
break;
case 3:
func_80328A84(this, 5);
break;
}
func_8030E878(SFX_82_METAL_BREAK, randf2(0.93f, 1.07f), 0x7FF8, this->position, 100.0f, 900.0f);
this->unk60 = 1.0f;
}
}
arg3 += 4.5;
return (arg3 >= 90.0f) ? 90.0f : arg3;
}
bool func_80388670(ActorMarker * this_marker, ActorMarker * other_marker){
Actor *this = marker_getActor(this_marker);
f32 sp20[3];
player_getPosition(sp20);
switch(this->marker->unk14_20){
case 0x9f: //L803886D0
return (-335.0f < sp20[0] && sp20[0] < -200.0f) && (-2730.0f < sp20[2] && sp20[2] < -2400.0f);
case 0xa0: //L80388770
return (-2915.0f < sp20[0] && sp20[0] < -2584.0f) && ( -500.0f < sp20[2] && sp20[2] < -355.0f);
case 0xFF: //L80388810
return (5470.0f < sp20[0] && sp20[0] < 5920.0f) && ( -850.0f < sp20[2] && sp20[2] < -780.0f);
default:
return FALSE;
}
}
void func_803888B8(Actor *this){
func_803300C0(this->marker, func_80388670);
func_802D3CE8(this);
this->unk60 = 0.0f;
switch(this->state){
case 4:
switch(this->marker->unk14_20){
case 0x9F:
this->roll = func_80388430(this, 0, -1, this->roll);
break;
case 0xa0:
case 0xff:
this->pitch = func_80388430(this, 2, 1, this->pitch);
break;
}
break;
case 5:
func_80326310(this);
break;
}
}
Actor *func_80388994(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) {
static u8 pad[0x10];
static s32 i;
Actor *this;
f32 sp90[3];
f32 sp84[3];
f32 sp78[3];
f32 sp6C[3];
this = func_80325E78(marker, gfx, mtx, vtx);
if (marker->unk14_21 && (this->unk60 != 0.0f)) {
func_8034A174((struct5Bs *) marker->unk44, 5, &sp84);
func_8034A174((struct5Bs *) marker->unk44, 6, &sp78);
for(i = 0; i < 8; i++){
sp6C[0] = sp6C[2] = 0.0f;
sp6C[1] = randf2(5.0f, 20.0f);
sp90[0] = sp84[0] + (sp78[0] - sp84[0]) * randf();
sp90[1] = sp84[1];
sp90[2] = sp84[2] + (sp78[2] - sp84[2]) * randf();
func_802EE6CC(sp90, sp6C, D_8038BE20, 1, 0.3f, 50.0f, 0xB4, randi2(0x82, 0xC8), 0);
}
}
return this;
}
void func_80388B2C(Actor *this, f32 arg1) {
this->yaw += arg1;
while ((arg1 > 0.0f) && (this->yaw >= 360.0f)) {
this->yaw -= 360.0f;
}
while ((arg1 < 0.0f) && (this->yaw < 0.0f)) {
this->yaw += 360.0f;
}
}
void func_80388BDC(Actor *this) {
f64 phi_f0;
func_802D3D74(this);
mapSpecificFlags_set(1, ((this->yaw > 260.0f) && (this->yaw < 330.0f)) ? TRUE : FALSE);
if (!this->unk16C_4) {
if (this->yaw != 0.0f) {
this->unk60 = 0.5f;
func_80328A84(this, 7);
this->unk38_31 = 1;
this->yaw = 270.0f;
} else {
this->unk38_31 = 0;
this->unk60 = 0.0f;
}
this->unk16C_4 = TRUE;
}
switch (this->state) {
case 1:
this->yaw = 0.0f;
if(mapSpecificFlags_get(0)) {
func_802BAFE4(0x21);
func_80328A84(this, 6);
func_80244BB0(0, 0x6A, 0x7FF8, 0.3f);
mapSpecificFlags_set(2, 0);
func_8025A6EC(COMUSIC_4_MMM_CLOCK_VERSION, -1);
func_8025AE0C(2000, 3.0f);
}
break;
case 6:
func_80388B2C(this, - (((this->yaw == 0.0f) || (359.0 < this->yaw)) ? 0.023 : 1.09));
if ((this->yaw <= 270.0f) && (this->yaw > 260.0f)) {
func_80328A84(this, 7U);
this->yaw = 270.0f;
func_8030E540(0x7F);
func_80244C78(0);
func_802D68F0(0xE);
item_set(6, 1);
}
break;
case 7:
if (this->unk38_31) {
this->unk60 -= time_getDelta();
if (this->unk60 < 0.0f) {
this->unk60 = 0.0f;
}
}
if( (!this->unk38_31 && item_empty(ITEM_0_HOURGLASS_TIMER))
|| ((this->unk38_31) && (this->unk60 == 0.0f))
) {
if (!this->unk38_31) {
func_802BAFE4(0x22);
} else {
func_802BAFE4(0x23);
}
func_80328A84(this, 8);
func_80244BB0(0, 0x6A, 0x7FF8, 0.3f);
}
break;
case 8:
func_80388B2C(this, 1.3f);
if ((this->yaw >= 0.0f) && (this->yaw < 10.0f)) {
func_80328A84(this, 1U);
this->yaw = 0.0f;
func_8030E540(SFX_7F_HEAVYDOOR_SLAM);
mapSpecificFlags_set(0, 0);
func_80244C78(0);
if (!this->unk38_31) {
func_8025A6EC(COMUSIC_3C_MINIGAME_LOSS, 0x7FF8);
func_8025AE0C(0x7D0, 2.5f);
}
this->unk38_31 = 0;
this->unk60 = 0.0f;
func_80356520(0xAD);
}
break;
}
}
void func_80388FE4(Actor *this) {
func_802D4A9C(this,0);
}
void func_80389004(Actor *this){
func_802D3CE8(this);
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
if(levelSpecificFlags_get(0x2e))
marker_despawn(this->marker);
}
}
void func_80389060(Actor *this){
if(!this->initialized && sns_get_item_state(SNS_ITEM_EGG_CYAN, TRUE)){
marker_despawn(this->marker);
}
else{
func_802D3CE8(this);
}
}
void func_803890B8(Actor *this) {
func_802D3D54(this);
func_8038AC04();
}
void func_803890E0(void){
spawnableActorList_add(&D_8038BC28, actor_new, 0);
spawnableActorList_add(&D_8038BCDC, actor_new, 0);
spawnableActorList_add(&D_8038BC4C, actor_new, 0);
spawnableActorList_add(&D_8038BDB4, actor_new, 0x40);
spawnableActorList_add(&D_8038BDD8, actor_new, 0x40);
spawnableActorList_add(&D_8038BDFC, actor_new, 0x440);
spawnableActorList_add(&D_8038BC94, actor_new, 0);
spawnableActorList_add(&D_8038BC70, actor_new, 0);
spawnableActorList_add(&D_8038BD00, actor_new, 0);
spawnableActorList_add(&D_8038BD24, actor_new, 0x8600);
spawnableActorList_add(&D_8038BD48, actor_new, 0x8600);
spawnableActorList_add(&D_8038BD6C, actor_new, 0x8600);
spawnableActorList_add(&D_8038BCB8, actor_new, 0x8600);
spawnableActorList_add(&D_8038BD90, actor_new, 8);
spawnableActorList_add(&chNapper, actor_new, 0x18A0);
spawnableActorList_add(&D_8038BA68, actor_new, 0x100);
spawnableActorList_add(&chMotzhand, actor_new, 0x20880);
spawnableActorList_add(&D_80367E70, actor_new, 0);
spawnableActorList_add(&chLoggo, actor_new, 0x108);
spawnableActorList_add(&D_8038BAD0, actor_new, 0x2800960);
spawnableActorList_add(&D_8038BE48, actor_new, 0x800040);
spawnableActorList_add(&D_8038BE6C, actor_new, 0x800040);
spawnableActorList_add(&D_8038BE90, actor_new, 0x800040);
spawnableActorList_add(&D_8038BEB4, actor_new, 0x800040);
spawnableActorList_add(&D_8038BED8, actor_new, 0x800040);
spawnableActorList_add(&D_8038BEFC, actor_new, 0x800040);
spawnableActorList_add(&D_80372C3C, actor_new, 0xA11A9);
}

94
src/MMM/code_2F60.c Normal file
View File

@@ -0,0 +1,94 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
Actor *func_80389350(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
void func_803893A4(Actor *this);
/* .data */
ActorAnimationInfo D_8038BE30[] ={
{0x000, 0.0f},
{0x23F, 10000000.0f},
{0x23F, 2.0f},
};
ActorInfo D_8038BE48 = {
MARKER_255_PORTRAIT_OF_GRUNTY, ACTOR_382_PORTRAIT_OF_GRUNTY, ASSET_522_MODEL_PORTRAIT_OF_GRUNTY,
0x1, D_8038BE30,
func_803893A4, func_80326224, func_80389350,
0, 0, 0.0f, 0
};
ActorInfo D_8038BE6C = {
MARKER_257_PORTRAIT_OF_BLACKEYE, ACTOR_384_PORTRAIT_OF_BLACKEYE, ASSET_527_MODEL_PORTRAIT_OF_BLACKEYE,
0x1, D_8038BE30,
func_803893A4, func_80326224, func_80389350,
0, 0, 0.0f, 0
};
ActorInfo D_8038BE90 = {
MARKER_258_PORTRAIT_OF_TOWER, ACTOR_385_PORTRAIT_OF_TOWER, ASSET_528_MODEL_PORTRAIT_OF_TOWER,
0x1, D_8038BE30,
func_803893A4, func_80326224, func_80389350,
0, 0, 0.0f, 0
};
ActorInfo D_8038BEB4 = {
MARKER_259_PORTRAIT_OF_TREE_AND_MOON, ACTOR_386_PORTRAIT_OF_TREE_AND_MOON, ASSET_529_MODEL_PORTRAIT_OF_TREE_AND_MOON,
0x1, D_8038BE30,
func_803893A4, func_80326224, func_80389350,
0, 0, 0.0f, 0
};
ActorInfo D_8038BED8 = {
MARKER_25A_PORTRAIT_OF_TEEHEE, ACTOR_387_PORTRAIT_OF_TEEHEE, ASSET_52A_MODEL_PORTRAIT_OF_TEEHEE,
0x1, D_8038BE30,
func_803893A4, func_80326224, func_80389350,
0, 0, 0.0f, 0
};
ActorInfo D_8038BEFC = {
MARKER_25B_PORTRAIT_OF_MINION, ACTOR_388_PORTRAIT_OF_MINION, ASSET_52B_MODEL_PORTRAIT_OF_MINION,
0x1, D_8038BE30,
func_803893A4, func_80326224, func_80389350,
0, 0, 0.0f, 0
};
/* .code */
Actor *func_80389350(ActorMarker* marker, Gfx** graphics, Mtx** matrix, Vtx** vertex) {
func_8033A45C(3, marker_getActor(marker)->unk38_31);
return func_80325888(marker, graphics, matrix, vertex);
}
void func_803893A4(Actor *this){
if(!this->unk16C_4){
this->unk16C_4 = TRUE;
this->marker->propPtr->unk8_3 = TRUE;
actor_collisionOff(this);
this->unk38_31 = 2;
}
switch(this->state){
case 1:
animctrl_setAnimTimer(this->animctrl, 0.0f);
break;
case 2:
if(actor_animationIsAt(this, 0.999f)){
func_80328B8C(this, 1, 0.001f, 0);
actor_playAnimationOnce(this);
this->unk38_31 = 2;
}
break;
}
}
void func_80389484(ActorMarker * marker, f32 anim_duration){
Actor *this = marker_getActor(marker);
func_80328B8C(this, 2, 0.001f, 1);
actor_playAnimationOnce(this);
animctrl_setDuration(this->animctrl, anim_duration);
this->unk38_31 = 1;
FUNC_8030E8B4(SFX_129_SWOOSH, 1.0f, 32000, this->position, 1000, 2000);
}

115
src/MMM/code_3120.c Normal file
View File

@@ -0,0 +1,115 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
Struct5Es * func_80309B48(f32[3], f32[3], f32[3], u32);
/* .bss */
extern struct{
u8 unk0;
u8 unk1;
u8 unk2;
} D_8038C4E0;
/* .code */
s32 func_80389510() {
return D_8038C4E0.unk1 == 1;
}
u8 func_80389524() {
return D_8038C4E0.unk0;
}
u8 func_80389530() {
return D_8038C4E0.unk2;
}
void func_8038953C() {
return;
}
void func_80389544(void){
D_8038C4E0.unk0 = 0;
D_8038C4E0.unk2 = 0;
if(map_get() == MAP_26_MMM_NAPPERS_ROOM){
if(jiggyscore_isCollected(JIGGY_5D_MMM_NAPPER)){
D_8038C4E0.unk1 = 2;
}
else{
D_8038C4E0.unk1 = 1;
}
}
else{
D_8038C4E0.unk1 = 0;
}
}
void func_803895B0(s32 arg0) {
if (arg0 != 0) {
D_8038C4E0.unk1 = 1;
return;
}
D_8038C4E0.unk1 = 2;
}
void func_803895D8(ActorMarker *caller, enum asset_e text_id, s32 arg2) {
if (text_id == 0xAD7) {
timed_playSfx(0.1f, SFX_3F5_UNKNOWN, 1.0f, 30000);
func_80324E88(1.5f);
func_80324E38(1.5f, 0);
return;
}
D_8038C4E0.unk0 = 1;
func_80324E88(1.5f);
func_80324E38(1.5f, 0);
}
void func_8038966C(void){
f32 sp54[3];
f32 sp48[3];
f32 sp3C[3];
f32 sp30[3];
BKCollisionTri *tmp_v0;
if(D_8038C4E0.unk1 == 0) return;
if( !D_8038C4E0.unk2
&& D_8038C4E0.unk1 == 1
&& jiggyscore_isCollected(JIGGY_5D_MMM_NAPPER)
){
D_8038C4E0.unk2 = TRUE;
func_80324E38(0.0f, 3);
timed_setCameraToNode(0.2f, 1);
func_80324DBC(0.2f, 0xad9, 6, NULL, NULL, func_803895D8, NULL);
}//L80389700
if(D_8038C4E0.unk1 != 1)
return;
player_getPosition(sp54);
sp48[0] = sp54[0];
sp3C[0] = sp54[0];
sp48[1] = sp54[1] + 10.0f;
sp3C[1] = sp54[1] - 10.0f;
sp48[2] = sp54[2];
sp3C[2] = sp54[2];
tmp_v0 = func_80309B48(sp48, sp3C, sp30, 0);
if(tmp_v0 != NULL){
if((s32)(tmp_v0->flags << 4) < 0){
FUNC_8030E624(SFX_6B_LOCKUP_OPENING, 1.4f, 32750);
D_8038C4E0.unk1 = 2;
if(!levelSpecificFlags_get(0x1b)){
func_80324E38(0.0f, 3);
timed_setCameraToNode(0.0f, 0);
func_80324DBC(0.0f, 0xad7, 6, NULL, NULL, func_803895D8, NULL);
levelSpecificFlags_set(0x1b, TRUE);
}
}
}
}

380
src/MMM/code_3420.c Normal file
View File

@@ -0,0 +1,380 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern void func_8038B6D4(f32* arg0, s32 arg1);
/* internal definitions */
typedef struct {
s32 unk0;
s32 unk4;
} Struct_MMM_3420_0;
typedef struct {
u8 unk0;
u8 unk1;
} Struct_MMM_3420_1;
void func_80389A0C(s32 arg0);
/* .data */
Struct_MMM_3420_0 D_8038BF20[] = {
{ 0, 11},
{ 0xC05, 0},
{ 0x1E00, 8},
{ 0x2400, 3},
{ 0x2A00, 1},
{ 0x3000, 0},
{ 0x3600, 8},
{ 0x3C00, 7},
{ 0x3F00, 7},
{ 0x4200, 0},
{ 0x49D0, 0},
{ 0x4E00, 8},
{ 0x5400, 3},
{ 0x5A00, 6},
{ 0x6000, 7},
{ 0x6600, 8},
{ 0x6C00, 0},
{ 0x6F00, 7},
{ 0x7200, 0},
{ 0x7800, 10},
{ 0x7E00, 3},
{ 0x8400, 8},
{ 0x8A00, 1},
{ 0x9000, 2},
{ 0x9600, 3},
{ 0x9C00, 8},
{ 0xA200, 7},
{ 0xA800, 0},
{ 0xAE00, 8},
{ 0xB400, 3},
{ 0xBA00, 6},
{ 0xC000, 7},
{ 0xC600, 8},
{ 0xCC00, 0},
{ 0xCF00, 7},
{ 0xD200, 3},
{ 0xD800, 1},
{ 0xDB00, 7},
{ 0xDE00, 1},
{ 0xE100, 0},
{ 0xE400, 1},
{ 0xE700, 7},
{ 0xEA00, 1},
{ 0xED00, 2},
{ 0xF000, 1},
{ 0xF600, 9},
{ 0xFC00, 1},
{0x10200, 7},
{0x10800, 1},
{0x10E00, 9},
{0x11400, 1},
{0x11700, 8},
{0x11A00, 1},
{0x12000, 11},
{0x12600, 4},
{0x12C00, 9},
{0x13200, 2},
{0x13800, 11},
{0x13E00, 4},
{0x14400, 9},
{0x14A00, 8},
{0x15000, 1},
{0x15600, 9},
{0x15C00, 1},
{0x16200, 7},
{0x16800, 1},
{0x16E00, 9},
{0x17400, 1},
{0x17700, 8},
{0x17A00, 1},
{0x18000, 0},
{0x18300, 6},
{0x18600, 3},
{0x18900, 11},
{0x18C00, 7},
{0x18F60, 6},
{0x19260, 0},
{0x19500, 11},
{0x19802, -1}
};
Struct_MMM_3420_1 D_8038C198[] = {
{01, 00},
{02, 00},
{03, 00},
{04, 00},
{05, 00},
{06, 00},
{04, 00},
{07, 00},
{04, 00},
{07, 00},
{04, 00},
{05, 00},
{06, 00},
{04, 00},
{07, 00},
{04, 00},
{05, 00},
{06, 00},
{04, 00},
{07, 00},
{04, 00},
{07, 00},
{04, 00},
{05, 00},
{00, 00},
{00, 00},
};
u8 D_8038C1CC[] = {0x7, 0xE, 0xD, 0x9, 0x11, 0, 0, 0};
u8 D_8038C1D4[] = {0xA, 0x12, 0xF, 0x9, 0xE, 0xD, 0x9, 0x11, 0xB, 0xF, 0, 0};
f32 D_8038C1E0[3] = {0.0f, 3250.0f, -3200.0f}; //jiggy spawn position
/* .bss */
extern struct {
s32 unk0;
ActorMarker *unk4; //motzhand_marker
Struct_MMM_3420_0 *unk8;
u8 unkC; //state
u8 unkD; //pattern id
//u8 padE[2];
u8 *unk10;
}D_8038C4F0;
/* .code */
void func_80389810(ActorMarker *caller, enum asset_e text_id, s32 arg2) {
switch (D_8038C4F0.unkC) {
case 2:
func_80389A0C(3);
return;
case 4:
func_80389A0C(1);
return;
case 5:
func_80389A0C(3);
return;
case 6:
func_80389A0C(7);
return;
}
}
void func_803898A0() {
jiggySpawn(JIGGY_60_MMM_MOTZHAND, D_8038C1E0);
}
void func_803898C8() {
func_8025A58C(0, 450);
}
void func_803898EC() {
func_8025A58C(-1, 300);
}
void func_80389910() {
func_80311480(0xAD5, 0xE, NULL, NULL, func_80389810, NULL);
timedFunc_set_2(0.0f, func_8025A6EC, COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7FFF);
timed_setCameraToNode(2.0f, 0);
timedFunc_set_0(2.1f, func_803898A0);
timedFunc_set_0(6.0f, func_803898EC);
func_80324E88(6.0f);
func_80324E38(6.0f, 0);
}
void func_803899BC(void){
func_80324E38(0.0f, 3);
timedFunc_set_2(0.0f, (TFQM2)func_8025A6EC, COMUSIC_38_MOTZAND_BEATEN, 0x7fff);
timedFunc_set_0(2.25f, func_80389910);
}
void func_80389A0C(s32 next_state){
func_8028F8F8(1, FALSE);
if(next_state == 2){
if(D_8038C4F0.unkD == 0){
D_8038C4F0.unkD = 1;
func_80311480(0xad3, 4, NULL, NULL, func_80389810, NULL);
}
else{//L80389A84
func_80311480(0xad6, 4, NULL, NULL, func_80389810, NULL);
}
}//L80389A9C
if(next_state == 3){
D_8038C4F0.unk0 = 0;
if(D_8038C4F0.unkD == 1){
D_8038C4F0.unk10 = D_8038C1CC;
}
else{
D_8038C4F0.unk10 = D_8038C1D4;
}
func_8028F8F8(1, TRUE);
func_803876C8(D_8038C4F0.unk4, D_8038C4F0.unkD);
}//L80389AF4
if(next_state == 4){
func_80311480(0xadd, 4, NULL, NULL, func_80389810, NULL);
func_80387720(D_8038C4F0.unk4);
}
if(next_state == 5){
D_8038C4F0.unkD++;
func_80311480(0xad4, 4, NULL, NULL, func_80389810, NULL);
func_80387720(D_8038C4F0.unk4);
}
if(next_state == 6){
func_803898C8();
timedFunc_set_0(1.25f, func_803899BC);
func_80387654(D_8038C4F0.unk4);
}
D_8038C4F0.unkC = next_state;
}
s32 func_80389BBC(void){
return D_8038C4F0.unk8->unk4;
}
//organCtrl_getKeyPosition
void func_80389BCC(s32 key_indx, f32 position[3]) {
Struct_MMM_3420_1 *iPtr;
s32 is_black_key;
position[0] = -145.0f;
position[1] = 0.0f;
position[2] = 0.0f;
for (iPtr = &D_8038C198[0]; iPtr <= &D_8038C198[key_indx]; iPtr++) {
is_black_key = (iPtr->unk0 == 2 || iPtr->unk0 == 4);
if (is_black_key != 0) {
position[0] += 67.0f;
position[1] += 12.5;
position[2] += -230.0f;
} else {
position[0] += 170.0f;
}
if (iPtr == &D_8038C198[key_indx])
break;
if (is_black_key != 0) {
position[0] -= 67.0f;
position[1] -= 12.5;
position[2] -= -230.0f;
}
}
}
void func_80389CD8() {}
void func_80389CE0() {}
int func_80389CE8(s32 arg0, s32 arg1, s32 arg2){
if(D_8038C4F0.unkC == 3){
if(*D_8038C4F0.unk10 == arg2){
D_8038C4F0.unk0--;
D_8038C4F0.unk10++;
if(*D_8038C4F0.unk10 == 0){
if(D_8038C4F0.unkD == 1){
func_80389A0C(5);
}
else{
func_80389A0C(6);
}
}
return 1;
}//L80389D6C
else{
func_8028F55C(0xD, func_80351794(arg1));
return 2;
}
}
return 0;
}
void func_80389D9C(s32 key_id){
s32 sp24;
sp24 = D_8038C198[key_id].unk1;
func_8038B6D4(func_803517B8(sp24), func_803517E8(sp24));
D_8038C4F0.unk0++;
}
void func_80389DF4(s32 arg0, s32 arg1) {
Struct_MMM_3420_1 *iPtr;
f32 key_position[3];
bool is_black_key;
D_8038C4F0.unk8 = &D_8038BF20;
func_80250170(0, 0x6A, 0);
D_8038C4F0.unkC = 0;
if ((map_get() == MAP_1C_MMM_CHURCH) && (arg1 == 2)) {
D_8038C4F0.unk4 = NULL;
D_8038C4F0.unkD = 0;
key_position[0] = -1345.0f;
key_position[1] = 1150.0f;
key_position[2] = -2300.0f;
for(iPtr = &D_8038C198[0]; iPtr->unk0; iPtr++){
is_black_key = (iPtr->unk0 == 2 || iPtr->unk0 == 4);
if (is_black_key) {
key_position[0] += 122.0f;
key_position[1] += 12.5;
} else {
key_position[0] += 170.0f;
}
iPtr->unk1 = func_80351838(key_position, iPtr->unk0, iPtr - &D_8038C198[0]);
if (is_black_key) {
key_position[0] -= 122.0f;
key_position[1] -= 12.5;
}
}
if (jiggyscore_isSpawned(JIGGY_60_MMM_MOTZHAND)) {
func_80389A0C(7);
return;
}
func_80389A0C(1);
}
}
void func_80389FC0(void){
UNK_TYPE(u32) sp4C;
f32 sp48;
Actor *motzhand;
f32 sp38[3];
f32 plyr_pos[3];
Actor *motzhand_2;
if(D_8038C4F0.unkC == 0) return;
if(func_802501A0(0, 0x6A, &sp4C)){
func_80250170(0, 0x6A, 0);
D_8038C4F0.unk8++;
if(D_8038C4F0.unk8->unk4 == -1){
D_8038C4F0.unk8 = &D_8038BF20[10];
}
}//L8038A02C
if(D_8038C4F0.unkC == 1 && D_8038C4F0.unk4 == NULL){
sp38[0] = sp38[1] = sp38[2] = 0.0f;
motzhand = func_80326D68(sp38, ACTOR_3A_MOTZHAND, -1, &sp48);
D_8038C4F0.unk4 = motzhand->marker;
}//L8038A078
if(D_8038C4F0.unkC == 1 || D_8038C4F0.unkC == 3){
if(func_8038769C(D_8038C4F0.unk4)){
player_getPosition(plyr_pos);
motzhand_2 = marker_getActor(D_8038C4F0.unk4);
if( ml_vec3f_distance(motzhand_2->position, plyr_pos) < 400.0f
&& motzhand_2->position_y - 50.0f <= plyr_pos[1]
){
func_80389A0C(2);
}
}
}//L8038A104
if(D_8038C4F0.unkC == 3 && D_8038C4F0.unk0 >= 3){
func_80389A0C(4);
}
}

293
src/MMM/code_3D50.c Normal file
View File

@@ -0,0 +1,293 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
typedef struct {
s16 unk0;
u8 unk2;
u8 unk3;
f32 unk4;
}Struct_MMM_3D50_0;
extern void func_8028F620(Struct_MMM_3D50_0 *, f32, f32);
typedef struct {
u8 *unk0;
u8 unk4;
}Struct_MMM_3D50_1;
/* .data */
Struct_MMM_3D50_0 D_8038C1F0[] = {
{0x01, 'X', 0, 0.0f},
{0x02, 'J', 0, 0.0f},
{0x03, 'X', 0, 0.0f},
{0x04, 'X', 0, 0.0f},
{0x05, 'X', 0, 0.0f},
{0x06, 'A', 0, 0.0f},
{0x07, 'X', 0, 0.0f},
{0x08, 'N', 0, 0.0f},
{0x09, 'X', 0, 0.0f},
{0x0A, 'O', 0, 0.0f},
{0x0B, 'X', 0, 0.0f},
{0x0C, 'X', 0, 0.0f},
{0x0D, 'X', 0, 0.0f},
{0x0E, 'K', 0, 0.0f},
{0x0F, 'X', 0, 0.0f},
{0x10, 'B', 0, 0.0f},
{0x11, 'X', 0, 0.0f},
{0x12, 'A', 0, 0.0f},
{0x13, 'X', 0, 0.0f},
{0x14, 'X', 0, 0.0f},
{0x15, 'Z', 0, 0.0f},
{0x16, 'X', 0, 0.0f},
{0x17, 'E', 0, 0.0f},
{0x18, 'X', 0, 0.0f},
{0x19, 'O', 0, 0.0f},
{0x1A, 'X', 0, 0.0f},
{0x1B, 'I', 0, 0.0f},
{0x1C, 'X', 0, 0.0f},
{0x1D, 'X', 0, 0.0f},
{0x1E, 'O', 0, 0.0f},
{0x1F, 'X', 0, 0.0f},
{0x00, 0x00, 0, 0.0f}
};
Struct_MMM_3D50_1 D_8038C2F0[] = {
{"BANJOKAZOOIE", 0},
{0},
};
/* .bss */
struct {
BKModel *unk0;
Struct_MMM_3D50_0 *unk4;
u8 unk8;
BKModel *unkC;
s32 unk10;
} D_8038C510;
/* .code */
void func_8038A140(UNK_TYPE(s32) arg0) {
if (arg0 == 2) {
func_80324E38(0.3f, 3);
timed_setCameraToNode(0.3f, 1);
timedFunc_set_2(0.3f, mapSpecificFlags_set, 3, 1);
func_80324E38(3.0f, 0);
func_80324E88(3.0f);
timedFunc_set_1(3.0f, func_8038A140, 3);
}
if (arg0 == 3) {
if (D_8038C510.unk8 == 1) {
mapSpecificFlags_set(3, 1);
}
item_set(ITEM_0_HOURGLASS_TIMER, 75*60 - 1);
item_set(6, 1);
}
if (D_8038C510.unk8 == 3) {
item_set(6, 0);
mapSpecificFlags_set(4, 1);
}
if (arg0 == 4) {
func_8028F66C(0xF);
}
D_8038C510.unk8 = arg0;
}
Struct_MMM_3D50_0 *func_8038A26C(s32 arg0){
Struct_MMM_3D50_0 *v1;
s32 v0;
for(v1 = &D_8038C1F0[0]; v1->unk0 != 0; v1++){
if(arg0 == v1->unk0){
return v1;
}
}
return NULL;
}
void func_8038A2B8(void){
Struct_MMM_3D50_0 *v1;
for(v1 = &D_8038C1F0[0]; v1->unk0 != 0; v1++){
v1->unk3 = 2;
v1->unk4 = 0.0f;
}
}
void func_8038A2F0(s32 mesh_id, BKVtxRef *ref_vert, Vtx* vert, Struct_MMM_3D50_0 *arg3) {
f32 temp_f2;
if (arg3->unk4 < 0.5) {
temp_f2 = arg3->unk4 / 0.5;
vert->v.cn[0] = 255.0f + (ref_vert->v.v.cn[0] - 0xFF) * temp_f2;
vert->v.cn[1] = ref_vert->v.v.cn[1] * temp_f2;
vert->v.cn[2] = ref_vert->v.v.cn[2] * temp_f2;
}
else{
vert->v.cn[0] = ref_vert->v.v.cn[0];
vert->v.cn[1] = ref_vert->v.v.cn[1];
vert->v.cn[2] = ref_vert->v.v.cn[2];
arg3->unk3 = 2;
}
}
void func_8038A54C(Struct_MMM_3D50_0 *arg0, s32 arg1){
s32 v0 = arg0->unk3;
arg0->unk3 = arg1;
arg0->unk4 = 0.0f;
if(arg1 == 1 && v0 != arg1){
func_8025A6EC(COMUSIC_2C_BUZZER, 32000);
}
}
void func_8038A58C(s32 mesh_id, BKVtxRef *ref_vert, Vtx* vert, Struct_MMM_3D50_0 *arg3){
f32 temp_f12;
if (arg3->unk4 <= 0.5) {
temp_f12 = (arg3->unk4 / 0.5);
vert->v.cn[0] = ref_vert->v.v.cn[0] * (1 - temp_f12);
vert->v.cn[1] = 255.0f;
vert->v.cn[2] = ref_vert->v.v.cn[2] * (1 - temp_f12);
}
if (arg3->unk4 >= 0.5) {
arg3->unk3 = 4;
}
}
void func_8038A750(void){
Struct_MMM_3D50_0 *v1;
f32 f20;
f20 = time_getDelta();
for(v1 = &D_8038C1F0[0]; v1->unk0 != 0; v1++){
v1->unk4 += f20;
if(v1->unk3 == 1){
func_8033F120(D_8038C510.unk0, v1->unk0, func_8038A2F0, v1);
}
else if(v1->unk3 == 3){
func_8033F120(D_8038C510.unk0, v1->unk0, func_8038A58C, v1);
}
}
}
void func_8038A82C(Struct_MMM_3D50_0 * arg0){
f32 sp44[3];
f32 sp38[3];
Struct_MMM_3D50_1 *iPtr;
if(arg0->unk2 == 'X'){
func_8038A54C(arg0, 1);
player_getPosition(sp44);
func_8038AD10(D_8038C510.unkC, D_8038C510.unk10, sp38);
sp38[1] = sp44[1];
func_8028F620(sp38, 300.0f, -1500.0f);
return;
}
for(iPtr = &D_8038C2F0[0]; iPtr->unk0 != 0; iPtr++){//L8038A8C8
if(arg0->unk2 == iPtr->unk0[iPtr->unk4]){
iPtr->unk4++;
func_8038A54C(arg0, 3);
if( iPtr->unk0[iPtr->unk4] == 0){
func_8038A140(5);
func_8038AF3C(D_8038C510.unkC, D_8038C510.unk10);
func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 32000);
}
else{
func_8025A6EC(COMUSIC_2B_DING_B, 28000);
}
}
}
}
void func_8038A964(void){
Struct_MMM_3D50_1 *v0;
for(v0 = &D_8038C2F0[0]; v0->unk0 != 0; v0++){
v0->unk4 = 0;
}
}
void func_8038A994() {
func_8038A140(0);
}
void func_8038A9B4(void){
D_8038C510.unk8 = 0;
if(map_get() == MAP_24_MMM_TUMBLARS_SHED){
D_8038C510.unkC = NULL;
D_8038C510.unk0 = func_80309744(0);
D_8038C510.unk4 = NULL;
func_8038A2B8();
func_8038A964();
if(jiggyscore_isCollected(JIGGY_62_MMM_TUMBLAR)){
func_8038A140(6);
}
else{
func_8038A140(1);
}
}
}
void func_8038AA30(BKModel *arg0, s32 arg1){
D_8038C510.unkC = arg0;
D_8038C510.unk10 = arg1;
}
void func_8038AA44(void){
s32 tmp_v0;
f32 sp28[3];
Struct_MMM_3D50_0 *sp24;
if(D_8038C510.unk8 == 0) return;
func_8038A750();
if( D_8038C510.unk8 == 1
&& D_8038C510.unkC != NULL
&& func_8038AD4C(D_8038C510.unkC, D_8038C510.unk10)
){
if(!levelSpecificFlags_get(0x2f)){
levelSpecificFlags_set(0x2f, TRUE);
func_8038A140(2);
}
else{
func_8038A140(3);
}
}
if(D_8038C510.unk8 == 3){
if(item_empty(ITEM_6_HOURGLASS)){
func_8038A140(4);
}
else if( D_8038C510.unkC != NULL
&& func_8038AD4C(D_8038C510.unkC, D_8038C510.unk10)
){
func_8038AD10(D_8038C510.unkC, D_8038C510.unk10, sp28);
tmp_v0 = func_8033F3C0(D_8038C510.unk0, sp28);
if(tmp_v0){
sp24 = func_8038A26C(tmp_v0);
if( sp24
&& sp24->unk3 == 2
&& sp24 != D_8038C510.unk4
){
func_8038A82C(sp24);
D_8038C510.unk4 = sp24;
}
}
else{
D_8038C510.unk4 = 0;
}
}
}//L8038AB7C
if( D_8038C510.unk8 == 5
&& func_8038AD38(D_8038C510.unkC, D_8038C510.unk10)
){
func_8038A140(6);
}
}

191
src/MMM/code_47D0.c Normal file
View File

@@ -0,0 +1,191 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern void sfxsource_setSampleRate(u8, s32);
extern f32 func_80258640(f32[3], f32[3]);
typedef struct {
ActorMarker *unk0;
u8 unk4;
u8 pad5[3];
f32 unk8;
f32 unkC[3];
}Struct_MMM_47D0_0;
/* .code */
void func_8038ABC0(s32 arg0) {
if (getGameMode() != 7) {
func_80295864(func_802957F0() & ~arg0);
}
}
void func_8038AC04(void){
if((*(u32*)PHYS_TO_K1(0x1D0)) - 0x356BAAAE){
func_8038ABC0(0x820);
}
}
//BREAK???==========
void func_8038AC40(Struct_MMM_47D0_0 *arg0, struct struct_68_s *arg1, f32 position[3], f32 rotation[3], f32 scale, BKModelBin *model_bin, Gfx **gfx, Mtx **mtx, Vtx **vtx){
u8 temp_v0;
if (arg0->unk4 != 3) {
if ((arg0->unk4 == 0) || (arg0->unk4 == 1)) {
func_8033A410(0xFF, arg0);
} else if (arg0->unk4 == 2) {
func_8033A410((s32)((1 - ((f64)arg0->unk8 * 1)) * 255.0), arg0);
}
set_model_render_mode(1);
func_803391A4(gfx, mtx, position, rotation, scale, NULL, model_bin);
}
}
void func_8038AD10(s32 arg0, s32 arg1, f32 arg2[3]) {
func_8035179C(arg1, arg2);
}
bool func_8038AD38(Struct_MMM_47D0_0 *arg0, s32 arg1){
return arg0->unk4 == 3;
}
bool func_8038AD4C(s32 arg0, s32 arg1) {
f32 plyr_pos[3];
f32 sp18[3];
player_getPosition(plyr_pos);
func_8035179C(arg1, sp18);
return func_803518D4(arg1)
&& (func_80258640(sp18, plyr_pos) < 40.0f)
&& (player_getTransformation() == TRANSFORM_1_BANJO)
&& (func_8028ECAC() == 0);
}
void func_8038ADF0(Struct_MMM_47D0_0 *arg0, Struct68s *arg1) {
u8 sp3F;
f32 sp38;
Actor *jiggy;
f32 sp28[3];
arg0->unk4 = 0;
arg0->unk8 = 0.0f;
arg0->unkC[0] = 0.0f;
arg0->unkC[1] = 0.0f;
arg0->unkC[2] = 0.0f;
func_8038AA30(arg0, arg1);
func_80351A14(arg1, (Struct68DrawMethod)func_8038AC40);
sp3F = func_80351758(arg1);
sfxsource_setSfxId(sp3F, SFX_3EC_CCW_DOOR_OPENING);
func_8030DD14(sp3F, 3);
func_8030DBB4(sp3F, 0.6f);
sfxsource_setSampleRate(sp3F, 0);
func_8030E2C4(sp3F);
func_8035179C(arg1, sp28);
sp38 = 500.0f;
jiggy = func_80326D68(sp28, ACTOR_46_JIGGY, -1, &sp38);
if (jiggy != NULL) {
arg0->unk0 = jiggy->marker;
} else {
arg0->unk0 = NULL;
}
if (arg0->unk0 != NULL) {
arg0->unk0->collidable = FALSE;
}
if (jiggyscore_isCollected(JIGGY_62_MMM_TUMBLAR)) {
func_80351A04(arg1, 1);
arg0->unk4 = 3;
}
}
void func_8038AF0C(ActorMarker *marker, enum asset_e text_id, s32 arg2) {
mapSpecificFlags_set(1, 1);
}
void func_8038AF3C(Struct_MMM_47D0_0 *arg0, s32 arg1) {
func_80311480(0xADB, 4, NULL, arg0->unk0, func_8038AF0C, NULL);
arg0->unk4 = 1;
}
void func_8038AF90(Struct_MMM_47D0_0 *arg0, Struct68s *arg1, f32 arg2) {
f32 sp7C[3];
f32 sp70[3];
f32 sp64[3];
Actor *temp_v0_2;
f32 sp54[3];
f32 sp48[3];
f32 sp40[2];
s32 sp3C;
u8 sp38;
arg0->unk8 += arg2;
if (arg0->unk4 == 0) {
func_8035179C(arg1, sp54);
func_8024E71C(0, sp40);
sp3C = func_8038AD4C(arg0, arg1);
if (sp3C) {
func_8028F66C(0xD);
}
if (sp3C && ((sp40[0] != 0.0f) || (sp40[1] != 0.0f))) {
func_8024C764(sp70);
sp64[0] = sp40[0];
sp64[1] = 0.0f;
sp64[2] = -sp40[1];
ml_vec3f_yaw_rotate_copy(sp64, sp64, sp70[1]);
arg0->unkC[0] += sp64[0] * 2500.0f * arg2;
arg0->unkC[2] += sp64[2] * 2500.0f * arg2;
} else {
arg0->unkC[0] *= 0.7;
arg0->unkC[2] *= 0.7;
}
if (gu_sqrtf(arg0->unkC[0]*arg0->unkC[0] + arg0->unkC[1]*arg0->unkC[1] + arg0->unkC[2]*arg0->unkC[2]) > 400.0f) {
ml_vec3f_set_length(arg0->unkC, 400.0f);
}
sp54[0] += arg0->unkC[0] * arg2;
sp54[2] += arg0->unkC[2] * arg2;
func_80351B28(arg1, sp54);
func_8035179C(arg1, sp54);
if (arg0->unk0 != NULL) {
func_8024C5CC(sp7C);
sp64[0] = sp54[0] - sp7C[0];
sp64[2] = sp54[2] - sp7C[2];
sp64[1] = 0.0f;
ml_vec3f_normalize(sp64);
temp_v0_2 = marker_getActor(arg0->unk0);
temp_v0_2->position[0] = sp54[0] + (sp64[0] * 20.0f);
temp_v0_2->position[2] = sp54[2] + (sp64[2] * 20.0f);
}
} else if (arg0->unk4 == 2) {
if (arg0->unk8 >= 1.0f) {
arg0->unk4 = 3U;
if (arg0->unk0 != NULL) {
arg0->unk0->collidable = TRUE;
}
func_80351A04(arg1, 1);
}
arg0->unkC[0] *= 0.7;
arg0->unkC[2] *= 0.7;
}
if (arg0->unk4 == 1) {
sp38 = func_80351758(arg1);
sfxsource_setSampleRate(sp38, 0);
} else {
sp38 = func_80351758(arg1);
sfxsource_setSampleRate(sp38, (s32) ((gu_sqrtf(arg0->unkC[0]*arg0->unkC[0] + arg0->unkC[1]*arg0->unkC[1] + arg0->unkC[2]*arg0->unkC[2]) / 400.0) * 15000.0));
}
player_getPosition(sp48);
func_8035179C(arg1, sp54);
if (!mapSpecificFlags_get(0) && (arg0->unk4 == 0) && (func_80258640(sp54, sp48) < 250.0f)){
if(func_80311480(0xADA, 0, NULL, NULL, NULL, NULL)) {
mapSpecificFlags_set(0, TRUE);
}
}
if ((arg0->unk4 == 1) && mapSpecificFlags_get(1)) {
arg0->unk4 = 2U;
arg0->unk8 = 0.0f;
mapSpecificFlags_set(1, 0);
FUNC_8030E8B4(SFX_11B_TUMBLAR_DISAPPEARING_1, 1.0f, 30000, sp54, 500, 2500);
}
}

161
src/MMM/code_5000.c Normal file
View File

@@ -0,0 +1,161 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern void sfxsource_setSampleRate(u8, s32);
void func_8038B6FC(Struct5Fs *arg0, Struct68s *arg1);
s32 __mmm_5000_red[4] = {0xFF, 0, 0, 0xFF};
s32 __mmm_5000_green[4] = {0, 0xFF, 0, 0xFF};
s32 __mmm_5000_blue[4] = {0, 0, 0xFF, 0xFF};
/* .code */
void func_8038B3F0(Struct5Fs *arg0, struct struct_68_s *arg1, f32 position[3], f32 rotation[3], f32 scale, BKModelBin *model_bin, Gfx **gfx, Mtx **mtx, Vtx **vtx) {
s32 sp58[4];
s32 temp_f4;
s32 sp44[4];
s32 temp_f6;
s32 sp30[4];
s32 temp_f8;
if (arg0->unkC > 0.0f) {
temp_f4 = (s32) (((1.0f - arg0->unkC) * 223.0f) + 32.0f);
sp58[0] = temp_f4;
sp58[1] = temp_f4;
sp58[2] = temp_f4;
sp58[3] = 0xFF;
func_8033A334(sp58, __mmm_5000_red);
} else if (arg0->unk4 > 0.0f) {
temp_f6 = (s32) (((1.0f - arg0->unk4) * 223.0f) + 32.0f);
sp44[0] = temp_f6;
sp44[1] = temp_f6;
sp44[2] = temp_f6;
sp44[3] = 0xFF;
func_8033A334(sp44, __mmm_5000_green);
} else if (arg0->unk0 > 0.0f) {
temp_f8 = (s32) (((1.0f - arg0->unk0) * 223.0f) + 32.0f);
sp30[0] = temp_f8;
sp30[1] = temp_f8;
sp30[2] = temp_f8;
sp30[3] = 0xFF;
func_8033A334(sp30, __mmm_5000_blue);
}
set_model_render_mode(1);
func_803391A4(gfx, mtx, position, rotation, scale, NULL, model_bin);
}
void func_8038B590(Struct5Fs *arg0, Struct68s *arg1){
f32 sp1C[3];
arg0->unkA = 1;
arg0->unk10 = 0.0f;
sp1C[2] = sp1C[1] = arg0->unk10;
sp1C[0] = 5.0f;
func_80351C2C(arg1, sp1C);
}
void func_8038B5D8(Struct5Fs *arg0, Struct68s *arg1, s32 arg2, s32 arg3){
arg0->unk8 = arg3;
arg0->unk9 = arg2;
arg0->unkA = 0;
arg0->unk0 = 0.0f;
arg0->unk4 = 0.0f;
arg0->unkC = 0.0f;
arg0->unk10 = 0.0f;
arg0->unk14 = 0.0f;
func_80351A14(arg1, (Struct68DrawMethod)func_8038B3F0);
}
void func_8038B630(Struct5Fs *arg0, Struct68s *arg1){
u8 phi_s0;
u32 pad;
u32 pad1;
f32 sp20;
sp20 = alCents2Ratio(func_80389BBC()*100);
phi_s0 = func_80351758(arg1);
func_8030E394(phi_s0);
func_8030DBB4(phi_s0, sp20);
sfxsource_setSfxId(phi_s0, 0x3f3);
func_8030DD14(phi_s0, 3);
sfxsource_setSampleRate(phi_s0, 0x7fff);
func_8030E2C4(phi_s0);
arg0->unk14 = 1.5f;
if(pad);
}
void func_8038B6D4(Struct5Fs * arg0, Struct68s *arg1) {
arg0->unk0 = 1.0f;
func_8038B6FC(arg0, arg1);
}
void func_8038B6FC(Struct5Fs *arg0, Struct68s *arg1){
func_8038B590(arg0, arg1);
func_8038B630(arg0, arg1);
}
void func_8038B72C(Struct5Fs *arg0, Struct68s * arg1) {
arg0->unk4 = 1.0f;
func_8038B6FC(arg0, arg1);
}
void func_8038B754(Struct5Fs *arg0, Struct68s * arg1){
func_8038B590(arg0, arg1);
arg0->unkC = 1.0f;
func_8025A6EC(COMUSIC_2C_BUZZER, 28000);
}
void func_8038B790(Struct5Fs *arg0, Struct68s *arg1, f32 arg2) {
f32 sp2C[3];
f32 temp_f0_6;
s32 temp_v0;
arg0->unk10 += arg2;
if (arg0->unk14 > 0.0f) {
arg0->unk14 -= arg2;
if (arg0->unk14 <= 0.0f) {
func_80351954(arg1);
} else if (arg0->unk14 <= 1.0f) {
sfxsource_setSampleRate(func_80351758(arg1), (s32)(arg0->unk14 * 32767.0f));
}
}
if (arg0->unkC > 0.0f) {
arg0->unkC -= 1 * arg2;
}
if (arg0->unk4 > 0.0f) {
arg0->unk4 -= 1 * arg2;
}
if (arg0->unk0 > 0.0f) {
arg0->unk0 -= 1 * arg2;
}
func_80351814(arg1, sp2C);
if (func_803518C0(arg1) != 0) {
temp_v0 = func_80389CE8(arg0, arg1, arg0->unk8);
if (temp_v0 == 0) {
func_8038B6FC(arg0, arg1);
}
else if (temp_v0 == 1) {
func_8038B72C(arg0, arg1);
}
else if (temp_v0 == 2) {
func_8038B754(arg0, arg1);
}
} else {
if (arg0->unkA == 1) {
temp_f0_6 = arg0->unk10 / 0.3;
if (temp_f0_6 >= 1.0f) {
sp2C[0] = 0.0f;
arg0->unkA = 0U;
} else {
sp2C[0] = (1 - temp_f0_6) * 5.0f;
}
}
func_80351C2C(arg1, sp2C);
}
}

94
src/MMM/code_DC0.c Normal file
View File

@@ -0,0 +1,94 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
void func_80387280(Actor *this);
/* .data */
ActorAnimationInfo D_8038BA50[] = {
{0x00, 0.0f},
{ASSET_A9_ANIM_FLOWER_POT, 2.0f},
{ASSET_A9_ANIM_FLOWER_POT, 2.0f}
};
ActorInfo D_8038BA68 = {
MARKER_34_CEMETARY_POT, ACTOR_25_CEMETARY_POT, ASSET_3AE_MODEL_GRAVE_FLOWER_POT,
0x1, D_8038BA50,
func_80387280, func_80326224, func_80325888,
0, 0, 0.0f, 0
};
/* .code */
//chflowerpots_getRemaining
s32 func_803871B0(void) {
return levelSpecificFlags_getN(0x39, 3);
}
//chflowerpots_setRemaining
void func_803871D4(s32 arg0) {
levelSpecificFlags_setN(0x39, arg0, 3);
}
void func_803871FC(Actor *this){
switch(this->state){
case 1:
func_8033A45C(3, FALSE);
break;
case 2:
func_8033A45C(3, TRUE);
break;
}
func_803255FC(this);
}
void func_80387260() {
func_803871D4(5);
}
//chflowerpots_update
void func_80387280(Actor *this){
this->marker->propPtr->unk8_3 = TRUE;
if(!this->initialized){
this->initialized = TRUE;
this->unk130 = func_803871FC;
}
switch(this->state){
case 1:
animctrl_setPlaybackType(this->animctrl, ANIMCTRL_STOPPED);
break;
case 2:
if(actor_animationIsAt(this, 0.2f)){
FUNC_8030E8B4(SFX_12F_FUUUCK_YOUUU, 1.0f, 30000, this->position, 300, 2000);
}
break;
}
}
bool func_80387340(ActorMarker *marker){
Actor *actor = marker_getActor(marker);
f32 sp20[3];
s32 sp1C;
if(actor->state == 2)
return FALSE;
func_80328A84(actor, 2);
animctrl_setPlaybackType(actor->animctrl, ANIMCTRL_ONCE);
sp1C = func_803871B0();
if(sp1C != 0){
sp1C--;
if(sp1C == 0){
ml_vec3f_copy(sp20, actor->position);
sp20[1] += 80.0f;
func_8025A70C(COMUSIC_2D_PUZZLE_SOLVED_FANFARE);
jiggySpawn(JIGGY_63_MMM_FLOWER_POTS, sp20);
}
else{
func_8025A70C(COMUSIC_2B_DING_B);
}
}
func_803871D4(sp1C);
return TRUE;
}