core2/code_78E50.c done, misc documentation

This commit is contained in:
Banjo Kazooie
2022-12-05 13:37:58 -06:00
parent 1c063c781c
commit 612636992f
94 changed files with 899 additions and 970 deletions

608
src/core2/ch/bottlesbonus.c Normal file
View File

@@ -0,0 +1,608 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern void func_8025982C(f32[3], f32[3], f32[3], f32);
extern void func_8025A6CC(enum comusic_e arg0, s32 arg1);
extern void chBottlesBonusCursor_func_802DF99C(void);
extern f32 *chBottlesBonusCursor_func_802E05AC(s32);
extern f32 func_802E4B38(void);
extern void func_8033A8F0(s32, s32, f32[4]);
extern f32 func_8033DDB8(void);
BKAnimationList *model_getAnimationList(BKModelBin *arg0);
extern void func_8034BB08(s32);
extern void func_803458E4(f32[4], f32[4], f32[4], f32);
/* .extern symbols??? */
extern u8 D_8037DCC0[7];
extern u8 D_8037DCC7;
extern u8 D_8037DCC8;
extern u8 D_8037DCC9;
extern u8 D_8037DCCA;
extern u8 D_8037DCCB;
extern u8 D_8037DCCC;
typedef struct {
f32 unk0;
}ActorLocal_core2_560F0;
typedef struct{
s32 time_seconds;
s32 text_id; //text_id
s32 unk8;
s32 anim_id;
}Struct_core2_560F0_0;
typedef struct{
f32 unk0[3];
f32 unkC[4];
f32 unk1C[3];
}Struct_core2_560F0_1;
typedef struct{
s32 unk0;
u8 pad4[4];
}Struct_core2_560F0_2;
extern void item_set(enum item_e, s32);
extern void func_80325794(ActorMarker *);
extern void func_8024CE60(f32, f32);
Actor *chBottlesBonus_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
void chBottlesBonus_update(Actor *this);
/* .data */
Struct_core2_560F0_0 D_803681A0[] = {
{ 0, 0x000, 0, 0x211},
{99, 0xE27, 0, 0x2C1},
{99, 0xE29, 0, 0x2C2},
{99, 0xE2B, 0, 0x2C9},
{99, 0xE2D, 0, 0x2C3},
{99, 0xE2F, 0, 0x2C4},
{99, 0xE31, 0, 0x2C5},
{75, 0xE34, 0, 0x007}
};
ActorAnimationInfo chBottlesBonusAnimations[] ={
{0x000, 0.0f},
{0x211, 9000000000.0f},
{0x211, 2.0f},
{0x211, 9000000000.0f},
{0x211, 9000000000.0f},
{0x211, 9000000000.0f},
};
f32 D_80368250 = 0.999388993f;
s32 D_80368254[20] = {
0x3C, 0x3D, 0x3F, 0x40,
0x42, 0x41, 0x43, 0x3A,
0x32, 0x30, 0x2E, 0x3E,
0x2A, 0x33, 0x2F, 0x31,
0x2D, 0x34, 0x3B, 0x39
};
s32 D_803682A4[4] = {0xD8, 0xD8, 0xD8, 0xFF};
s32 D_803682B4[4] = {0xFF, 0x60, 0x50, 0xFF};
f32 D_803682C4[3] = {0.0f, 0.0f, 0.0f};
ActorInfo chBottlesBonusDescription = {
0x179, 0x1E0, 0x46C,
0x1, chBottlesBonusAnimations,
chBottlesBonus_update, func_80326224, chBottlesBonus_draw,
0, 0, 0.0f, 0
};
/* .bss */
ActorMarker *chBottlesBonusMarker;
BKModelBin *chBottleBonusBookselfModelBin;
BKModelBin *D_8037DEA8;
BKModel *D_8037DEAC;
s32 D_8037DEB0;
s32 D_8037DEB4;
Struct_core2_560F0_1 *D_8037DEB8;
Struct_core2_560F0_1 *D_8037DEBC;
Struct_core2_560F0_1 *D_8037DEC0;
Struct_core2_560F0_1 *D_8037DEC4;
f32 D_8037DEC8[20];
f32 D_8037DF18[20];
s32 chBottleBonusPuzzleIndex;
f32 D_8037DF70[3];
f32 D_8037DF80[3];
s32 D_8037DF90[20];
/* .code */
void chBottlesBonus_func_802DD080(Gfx **gfx, Mtx **mtx) {
f32 sp24[3];
f32 sp18[3];
func_8024E258();
func_8024CE60(50.0f, 2000.0f);
if (getGameMode() == GAME_MODE_A_SNS_PICTURE) {
sp18[0] = 0.0f;
sp18[1] = 0.0f;
sp18[2] = 0.0f;
sp24[0] = 0.0f;
sp24[1] = 0.0f;
sp24[2] = 400.0f;
} else {
sp24[0] = 248.4125;
sp24[1] = 328.9;
sp24[2] = -186.4;
sp18[0] = 0.0f;
sp18[1] = 270.0f;
sp18[2] = 0.0f;
}
func_8024CD88(sp24);
func_8024CE18(sp18);
func_8024CFD4();
func_8024C904(gfx, mtx);
}
void chBottlesBonus_func_802DD158(Gfx **gfx, Mtx** mtx){
func_8024E2FC();
func_8024C904(gfx, mtx);
}
Actor *chBottlesBonus_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) {
Actor *sp6C;
f32 sp60[3];
f32 sp54[3];
void *sp50;
sp6C = marker_getActor(marker);
sp50 = func_8030C704();
if ((sp50 == NULL) || (getGameMode() != GAME_MODE_8_BOTTLES_BONUS))
return sp6C;
chBottlesBonus_func_802DD080(gfx, mtx);
{sp60[0] = 0.0f; sp60[1] = 0.0f; sp60[2] = 0.0f;};
{sp54[0] = 0.0f; sp54[1] = 0.0f; sp54[2] = 0.0f;};
modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL);
modelRender_draw(gfx, mtx, sp60, NULL, 1.0f, sp54, chBottleBonusBookselfModelBin);
modelRender_draw(gfx, mtx, sp60, NULL, 1.0f, sp54, D_8037DEA8);
gDPSetTextureFilter((*gfx)++, G_TF_POINT);
gDPSetColorDither((*gfx)++, G_CD_DISABLE);
func_802DF160(gfx, mtx, vtx);
func_80253190(gfx);
gDPSetTextureFilter((*gfx)++, G_TF_POINT);
gSPSegment((*gfx)++, 0x04, osVirtualToPhysical(sp50));
modelRender_preDraw((GenMethod_1)func_803253A0, (s32)sp6C);
modelRender_postDraw((GenMethod_1)func_80325794, (s32)marker);
modelRender_draw(gfx, mtx, sp60, NULL, D_80368250, sp54, func_80330B1C(marker));
gDPSetTextureFilter((*gfx)++, G_TF_BILERP);
gDPSetColorDither((*gfx)++, G_CD_MAGICSQ);
chBottlesBonusCursor_draw(gfx, mtx, vtx);
chBottlesBonus_func_802DD158(gfx, mtx);
return sp6C;
}
void chBottlesBonus_free(Actor *this) {
ActorLocal_core2_560F0 * local;
local = (ActorLocal_core2_560F0 *) &this->local;
chBottlesBonusMarker = 0;
if (D_8037DEAC != 0) {
func_8034CF6C(&local->unk0);
model_free(D_8037DEAC);
D_8037DEAC = 0;
}
if (chBottleBonusBookselfModelBin != 0) {
assetcache_release(chBottleBonusBookselfModelBin);
chBottleBonusBookselfModelBin = 0;
}
if (D_8037DEA8 != 0) {
assetcache_release(D_8037DEA8);
D_8037DEA8 = 0;
}
free(D_8037DEB8);
free(D_8037DEBC);
free(D_8037DEC0);
free(D_8037DEC4);
}
void chBottlesBonus_func_802DD484(f32 dst[3], f32 arg1, f32 avg, f32 range) {
s32 i;
for(i = 0; i < 3; i++){
dst[i] = avg + range * (0.5 + 0.5 * sinf( (2.0*BAD_PI) * func_80257A44((arg1 + 2.0 * ((f32)i / 3.0)), 2.0f)));
}
}
f32 *chBottlesBonus_func_802DD584(s32 arg0){
f64 temp_f0;
BKAnimation *temp_v1;
// temp_f0 = D_80376F48;
sizeof(BKAnimationList);
temp_v1 = (BKAnimation*)(model_getAnimationList(func_80330B1C(chBottlesBonusMarker)) + 1);
D_8037DF70[0] = temp_v1[5 + arg0].unk0[0] * 0.01;
D_8037DF70[1] = temp_v1[5 + arg0].unk0[1] * 0.01;
D_8037DF70[2] = temp_v1[5 + arg0].unk0[2] * 0.01;
return &D_8037DF70;
}
f32 *chBottlesBonus_func_802DD60C(s32 arg0) {
s32 temp_v0;
temp_v0 = chBottlesBonusCursor_func_802E0538();
if ((temp_v0 != 0) && (temp_v0 != 3)) {
D_8037DF80[0] = chBottlesBonusCursor_func_802E05AC(arg0)[0] * 0.01;
D_8037DF80[1] = chBottlesBonusCursor_func_802E05AC(arg0)[1] * 0.01;
D_8037DF80[2] = chBottlesBonusCursor_func_802E05AC(arg0)[2] * 0.01;
} else {
D_8037DF80[0] = 0.0f;
D_8037DF80[1] = 0.0f;
D_8037DF80[2] = 0.0f;
}
return &D_8037DF80;
}
void chBottlesBonus_func_802DD6E0(s32 arg0, s32 arg1, f32 arg2[3]) {
f32 sp1C[3];
sp1C[0] = arg2[0] - chBottlesBonus_func_802DD584(arg1)[0];
sp1C[1] = arg2[1] - chBottlesBonus_func_802DD584(arg1)[1];
sp1C[2] = arg2[2] - chBottlesBonus_func_802DD584(arg1)[2];
func_8033A968(arg0, D_80368254[arg1], sp1C);
}
void chBottlesBonus_func_802DD778(s32 arg0, s32 arg1, f32 arg2[3]) {
f32 sp1C[3];
func_8033A6B0(arg0, D_80368254[arg1], sp1C);
arg2[0] = sp1C[0] + chBottlesBonus_func_802DD584(arg1)[0];
arg2[1] = sp1C[1] + chBottlesBonus_func_802DD584(arg1)[1];
arg2[2] = sp1C[2] + chBottlesBonus_func_802DD584(arg1)[2];
}
f32 chBottlesBonus_func_802DD804(f32 arg0) {
arg0 = MAX(0.0, MIN(1.0, arg0));
return sinf(M_PI * arg0 / 2);
}
void chBottlesBonus_func_802DD8AC(s32 arg0, s32 arg1) {
s32 i;
f32 spD8[3];
f32 spD4;
f32 spD0;
Actor *actor;
f32 spBC[4];
f32 spAC[4];
f32 sp9C[4];
f32 sp8C[4];
f32 sp7C[4];
actor = marker_getActor(chBottlesBonusMarker);
spD4 = func_802E4B38();
spD0 = func_8033DDB8();
if (D_8037DEB0 == 0) {
D_8037DEB0 = 1;
for(i = 0; i < 20; i++){
func_8033A57C(arg0, D_80368254[i], D_8037DEC4[i].unkC);
func_8033A670(arg0, D_80368254[i], D_8037DEC4[i].unk1C);
chBottlesBonus_func_802DD778(arg0, i, D_8037DEC4[i].unk0);
chBottlesBonusCursor_func_802DF460(i + 20, chBottlesBonusMarker, D_8037DEC4[i].unk0);
}
}
if((actor->state == 4 || actor->state == 5)){
if (D_8037DEB4 == 0) {
D_8037DEB4 = 1;
for(i = 0; i < 20; i++){
func_8033A57C(arg0, D_80368254[i], D_8037DEB8[i].unkC);
func_8033A670(arg0, D_80368254[i], D_8037DEB8[i].unk1C);
chBottlesBonus_func_802DD778(arg0, i, D_8037DEB8[i].unk0);
func_80345250(D_8037DEC0[i].unkC, D_8037DEB8[i].unkC);
D_8037DEC0[i].unk0[0] = D_8037DEB8[i].unk0[0];
D_8037DEC0[i].unk0[1] = D_8037DEB8[i].unk0[1];
D_8037DEC0[i].unk0[2] = D_8037DEB8[i].unk0[2];
D_8037DEC0[i].unk1C[0] = D_8037DEB8[i].unk1C[0];
D_8037DEC0[i].unk1C[1] = D_8037DEB8[i].unk1C[1];
D_8037DEC0[i].unk1C[2] = D_8037DEB8[i].unk1C[2];
chBottlesBonusCursor_func_802DF460(i, chBottlesBonusMarker, D_8037DEB8[i].unk0);
}
}
for(i = 0; i < 20; i++){
spD8[0] = 1.0f;
spD8[1] = 1.0f;
spD8[2] = 1.0f;
switch(chBottlesBonusCursor_func_802E0538(i)){
case 1://L802DDBB4
chBottlesBonus_func_802DD484(spD8, spD4, 1.0f, 0.2);
func_8025982C(D_8037DEBC[i].unk0, D_8037DEB8[i].unk0, chBottlesBonus_func_802DD60C(i), chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.2));
func_8025982C(D_8037DEBC[i].unk1C, D_8037DEB8[i].unk1C, D_8037DEC4[i].unk1C, chBottlesBonus_func_802DD804(D_8037DEC8[i]/ 0.2));
func_80345D30(spAC, chBottlesBonusCursor_func_802E068C(i), D_8037DEB8[i].unkC);
func_803458E4(spBC, D_8037DEB8[i].unkC, spAC, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4));
func_80345D30(spAC, chBottlesBonusCursor_func_802E0664(i), D_8037DEB8[i].unkC);
func_803458E4(D_8037DEBC[i].unkC, spBC, spAC, chBottlesBonus_func_802DD804(D_8037DF18[i] / 0.2));
D_8037DEC0[i].unk0[0] = D_8037DEBC[i].unk0[0];
D_8037DEC0[i].unk0[1] = D_8037DEBC[i].unk0[1];
D_8037DEC0[i].unk0[2] = D_8037DEBC[i].unk0[2];
D_8037DEC0[i].unk1C[0] = D_8037DEBC[i].unk1C[0];
D_8037DEC0[i].unk1C[1] = D_8037DEBC[i].unk1C[1];
D_8037DEC0[i].unk1C[2] = D_8037DEBC[i].unk1C[2];
func_80345250(D_8037DEC0[i].unkC, D_8037DEBC[i].unkC);
break;
case 2://L802DDD9C
chBottlesBonus_func_802DD484(spD8, spD4, 1.0f, 0.2);
func_8025982C(D_8037DEBC[i].unk0, D_8037DEC4[chBottlesBonusCursor_func_802E0588(i)].unk0, chBottlesBonus_func_802DD60C(i), chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.2));
func_80345D30(sp9C, chBottlesBonusCursor_func_802E068C(i), D_8037DEB8[i].unkC);
func_80345D30(sp8C, chBottlesBonusCursor_func_802E0664(i), D_8037DEB8[i].unkC);
func_803458E4(D_8037DEBC[i].unkC, sp9C, sp8C, chBottlesBonus_func_802DD804(D_8037DF18[i] / 0.2));
D_8037DEC0[i].unk0[0] = D_8037DEBC[i].unk0[0];
D_8037DEC0[i].unk0[1] = D_8037DEBC[i].unk0[1];
D_8037DEC0[i].unk0[2] = D_8037DEBC[i].unk0[2];
D_8037DEC0[i].unk1C[0] = D_8037DEBC[i].unk1C[0];
D_8037DEC0[i].unk1C[1] = D_8037DEBC[i].unk1C[1];
D_8037DEC0[i].unk1C[2] = D_8037DEBC[i].unk1C[2];
func_80345250(D_8037DEC0[i].unkC, D_8037DEBC[i].unkC);
chBottlesBonusCursor_func_802DF460(40 + i, chBottlesBonusMarker, D_803681A0);
break;
case 3://L802DDF48
chBottlesBonusCursor_func_802DF460(40 + i, chBottlesBonusMarker, D_8037DEC4[chBottlesBonusCursor_func_802E0588(i)].unk0);
func_8025982C(D_8037DEBC[i].unk0, D_8037DEC0[i].unk0, D_8037DEC4[chBottlesBonusCursor_func_802E0588(i)].unk0, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4));
func_8025982C(D_8037DEBC[i].unk1C, D_8037DEC0[i].unk1C, D_8037DEC4[chBottlesBonusCursor_func_802E0588(i)].unk1C, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4));
func_80345D30(sp7C, chBottlesBonusCursor_func_802E0664(i), D_8037DEB8[i].unkC);
func_803458E4(D_8037DEBC[i].unkC, D_8037DEC0[i].unkC, sp7C, chBottlesBonus_func_802DD804(D_8037DF18[i] / 0.2));
break;
case 0://L802DE084
func_8025982C(D_8037DEBC[i].unk0, D_8037DEC0[i].unk0, D_8037DEB8[i].unk0, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4));
func_8025982C(D_8037DEBC[i].unk1C, D_8037DEC0[i].unk1C, D_8037DEB8[i].unk1C, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4));
func_803458E4(D_8037DEBC[i].unkC, D_8037DEC0[i].unkC, D_8037DEB8[i].unkC, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4));
break;
}
func_8033A8F0(arg0, D_80368254[i], D_8037DEBC[i].unkC);
spD8[0] = spD8[0] * D_8037DEBC[i].unk1C[0];
spD8[1] = spD8[1] * D_8037DEBC[i].unk1C[1];
spD8[2] = spD8[2] * D_8037DEBC[i].unk1C[2];
func_8033A928(arg0, D_80368254[i], spD8);
chBottlesBonus_func_802DD6E0(arg0, i, D_8037DEBC[i].unk0);
D_8037DEC8[i] += spD0;
D_8037DF18[i] += spD0;
}
}
}
void chBottlesBonus_func_802DE224(ActorMarker *caller, enum asset_e text_id, s32 arg2){
func_8034BB08(0);
}
void chBottlesBonus_lose(u8 *arg0, enum asset_e text_id) {
Actor *actor;
actor = marker_getActor(chBottlesBonusMarker);
chBottlesBonusCursor_lose();
func_8025A6CC(COMUSIC_3C_MINIGAME_LOSS, 28000);
actor->state = 5;
item_set(ITEM_6_HOURGLASS, FALSE);
func_802FAD64(0);
if (*arg0 == 0) {
*arg0 = 1;
timedFunc_set_0(2.0f, chBottlesBonusCursor_func_802DF99C);
func_80311714(0);
func_80311480(text_id, 0x86, actor->position, chBottlesBonusMarker, chBottlesBonus_func_802DE224, NULL);
func_80311714(1);
}
else{
timedFunc_set_1(1.25f, func_8034BB08, 0);
}
}
void chBottlesBonus_IncrementPuzzle(ActorMarker *caller, enum asset_e text_id, s32 arg2){
timedFunc_set_1(0.5f, func_8034BB08, 1);
chBottleBonusPuzzleIndex++;
}
void chBottlesBonus_completedPuzzle(void) {
Actor *actor;
actor = marker_getActor(chBottlesBonusMarker);
D_8037DCC0[chBottleBonusPuzzleIndex] = TRUE;
func_80311714(0);
func_80311480(D_803681A0[chBottleBonusPuzzleIndex + 1].text_id, 0x86, actor->position, chBottlesBonusMarker, chBottlesBonus_IncrementPuzzle, NULL);
func_80311714(1);
}
s32 chBottlesBonus_getPuzzleIndex(void){
return chBottleBonusPuzzleIndex;
}
void chBottlesBonus_startTimer(s32 arg0, s32 arg1, s32 arg2) {
Actor *actor;
actor = marker_getActor(chBottlesBonusMarker);
actor->state = 4;
actor->unk60 = 0.0f;
timedFunc_set_2(0.25f, item_set, ITEM_6_HOURGLASS, TRUE);
timedFunc_set_2(0.25f, item_set, ITEM_0_HOURGLASS_TIMER, D_803681A0[chBottleBonusPuzzleIndex + 1].time_seconds * 60 - 1);
}
void chBottlesBonus_update(Actor *this) {
ActorLocal_core2_560F0 *local;
f32 sp50;
s32 temp_v0_2;
s32 sp48;
s32 cursor_state;
s32 sp40;
s32 phi_s0;
s32 phi_s0_2;
local = (ActorLocal_core2_560F0 *) &this->local;
sp50 = func_8033DDB8();
if (!this->unk16C_4) {
this->unk16C_4 = TRUE;
actor_collisionOff(this);
this->unk60 = 0.0f;
D_8037DEB4 = D_8037DEB0 = 0;
marker_setFreeMethod(this->marker, chBottlesBonus_free);
if (chBottleBonusBookselfModelBin == 0) {
chBottleBonusBookselfModelBin = assetcache_get(0x470);
}
if (D_8037DEA8 == 0) {
D_8037DEA8 = assetcache_get(0x471);
}
if (D_8037DEAC == NULL) {
D_8037DEAC = func_8033F5F8(func_8033A0B0(chBottleBonusBookselfModelBin), func_8033A148(chBottleBonusBookselfModelBin));
func_8034CF74(local, 0, D_8037DEAC, 0xF0);
}
func_8028746C(this->animctrl, chBottlesBonus_func_802DD8AC);
for(phi_s0 = 0; phi_s0 < 0x14; phi_s0++){
func_8034DFB0(func_8034C2C4(this->marker, phi_s0 + 0x190), D_803682B4, D_803682A4, 0.0f);
}
D_8037DEB8 = (Struct_core2_560F0_1 *) malloc(0x14*sizeof(Struct_core2_560F0_1));
D_8037DEBC = (Struct_core2_560F0_1 *) malloc(0x14*sizeof(Struct_core2_560F0_1));
D_8037DEC0 = (Struct_core2_560F0_1 *) malloc(0x14*sizeof(Struct_core2_560F0_1));
D_8037DEC4 = (Struct_core2_560F0_1 *) malloc(0x14*sizeof(Struct_core2_560F0_1));
}
func_8034CF90(local, D_8037DEAC, 0xF0);
sp48 = chBottlesBonusCursor_func_802E06B4() - 1;
cursor_state = chBottlesBonusCursor_getState();
for(phi_s0_2 = 0; phi_s0_2 < 0x14; phi_s0_2++){
sp40 = D_8037DF90[phi_s0_2];
temp_v0_2 = func_8034C2C4(this->marker, phi_s0_2 + 0x190);
if ((phi_s0_2 == sp48) && (cursor_state == 1) && !chBottlesBonusCursor_func_802E0538(phi_s0_2)) {
D_8037DF90[phi_s0_2] = TRUE;
} else {
D_8037DF90[phi_s0_2] = FALSE;
}
if (sp40 != D_8037DF90[phi_s0_2]) {
switch(D_8037DF90[phi_s0_2]){
case TRUE:
func_8034DFB0(temp_v0_2, D_803682A4, D_803682B4, 0.1f);
break;
case FALSE:
func_8034DFB0(temp_v0_2, D_803682B4, D_803682A4, 0.3f);
break;
}
}
}
this->unk60 += sp50;
switch(this->state){
case 1:
if ((this->unk60 > 2.0) && gctransition_8030BD98()) {
this->unk60 = 0.0f;
func_8025A6EC(COMUSIC_98_BBONUS_PIECES_SHUFFLE, -1);
comusic_8025AB44(COMUSIC_95_BBONUS_A, 0, 2000);
func_8025AABC(COMUSIC_95_BBONUS_A);
func_80328B8C(this, 2, 0.0f, 1);
actor_playAnimationOnce(this);
}
break;
case 2:
if(animctrl_isStopped(this->animctrl)) {
this->state = 3;
func_8025A7DC(COMUSIC_98_BBONUS_PIECES_SHUFFLE);
if (D_8037DCC7 == 0) {
func_80311714(0);
func_80311480(0xE24, 0x87, this->position, chBottlesBonusMarker, chBottlesBonus_startTimer, NULL);
func_80311714(1);
D_8037DCC7 = 1;
}
else{
chBottlesBonus_startTimer(NULL, 0, 0);
}
}
break;
case 3:
break;
case 4:
if (this->unk60 > 2.0) {
func_8025AEA0(COMUSIC_94_BBONUS, ((item_getCount(ITEM_0_HOURGLASS_TIMER) * 0x201D2) / (s32) ((D_803681A0[chBottleBonusPuzzleIndex + 1].time_seconds * 60) - 1)) + 330000);
if ((item_getCount(ITEM_6_HOURGLASS) == 0) && (chBottlesBonusCursor_isPuzzleCompleted() == 0)) {
chBottlesBonus_lose(&D_8037DCC9, 0xE26);
}
}
break;
case 5:
break;
}//L802DE9A0
}
void __chBottlesBonus_spawn(void){
Actor *actor;
if(chBottlesBonusMarker == NULL){
actor = func_8032813C(0x1E0, D_803682C4, 0);
chBottlesBonusMarker = actor->marker;
chBottlesBonusCursor_spawn();
func_802DF270();
}
}
void chBottlesBonus_Spawn(s32 arg0, s32 arg1){
if(chBottlesBonusMarker == NULL){
__spawnQueue_add_0(__chBottlesBonus_spawn);
}
}
void chBottlesBonus_func_802DEA50(s32 arg0){
D_8037DEC8[arg0] = 0.0f;
D_8037DF18[arg0] = 0.0f;
}
void chBottlesBonus_func_802DEA74(s32 arg0){
D_8037DF18[arg0] = 0.0f;
}
void chBottlesBonus_func_802DEA8C(s32 arg0, s32 arg1) {
ActorMarker *temp_a0;
temp_a0 = chBottlesBonusMarker;
if (temp_a0 != 0) {
func_80326310(marker_getActor(temp_a0));
}
}
s32 chBottlesBonus_getState(void){
Actor *actor = marker_getActor(chBottlesBonusMarker);
return actor->state;
}
f32 *chBottlesBonus_func_802DEAF8(s32 arg0){
return D_8037DEBC[arg0].unkC;
}
Actor *chBottlesBonus_new(s32 position[3], s32 yaw, ActorInfo *actor_info, u32 flags){
int i;
for(i = 1; i < 6; i++){
chBottlesBonusAnimations[i].index = D_803681A0[chBottleBonusPuzzleIndex].anim_id;
}
return actor_new(position, yaw, actor_info, flags);
}
void chBottlesBonus_func_802DEB80(void) {
int i;
for(i = 0; i < 7; i++){
D_8037DCC0[i] = 0;
}
D_8037DCC7 = 0;
D_8037DCC8 = 0;
D_8037DCC9 = 0;
D_8037DCCA = 0;
D_8037DCCB = 0;
D_8037DCCC = 0;
chBottleBonusPuzzleIndex = 0;
}

View File

@@ -0,0 +1,457 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#ifndef ABS
#define ABS(d) ((d) >= 0) ? (d) : -(d)
#endif
extern s16 D_803A5D00[2][0xF660]; //framebuffer
extern u8 D_8037DCC8[]; //bottels bonus flags???
extern void ml_vec3f_assign(f32[3], f32, f32, f32);
extern void func_8025AABC(enum comusic_e);
extern f32 func_8024E420(s32, s32, s32);
extern f32 func_8033DDB8(void);
extern void chBottlesBonus_func_802DEA50(s32);
extern void func_80325794(ActorMarker *);
extern void chBottlesBonus_completedPuzzle(void);
typedef struct {
s32 state; //state
s32 piece_id; //piece_id
f32 rotation; //rotation;
f32 unkC[4];
f32 unk1C[4];
}Struct_core2_584D0_0;
typedef struct {
f32 unk0;
f32 unk4;
}Struct_core2_584D0_1;
void chBottlesBonusCursor_func_802DF99C(void);
void chBottlesBonusCursor_update(Actor *this);
/* .data */
ActorAnimationInfo D_803683B0[] = {
{0x000, 0.0f},
{0x2A2, 1.0f},
{0x2A5, 1.0f},
{0x2A4, 0.4f},
{0x2A3, 0.4f},
{0x2A1, 0.3f},
{0x2A7, 0.4f},
{0x2A1, 0.3f},
{0x2A6, 2.6f},
{0x2A8, 2.6f}
};
f32 D_80368400[3] = {570.0f, 328.9f, -186.4f};
f32 D_8036840C[3] = {-11.28f, 3.92f, -52.96f};
ActorInfo D_80368418 = {
0x17A, 0x2B4, 0x565,
0x1, D_803683B0,
chBottlesBonusCursor_update, func_80326224, func_80325340,
0, 0, 0.0f, 0
};
/* .bss */
ActorMarker *chBottlesBonusSursorMarker;
f32 D_8037E068[20][2];
Struct_core2_584D0_0 D_8037E248[20];
u8 pad_8037E478[0x140];
s32 D_8037E5B8;
struct {
s32 unk0;
u8 pad4[0xC];
f32 unk10[2];
f32 unk18[2];
u16 prev_button; //buttons
//u8 pad22;
s32 is_completed;
f32 unk28;
f32 unk2C;
} D_8037E5C0;
f32 D_8037E5F0;
f32 D_8037E5F4;
f32 D_8037E5F8[3];
/* .code */
void chBottlesBonusCursor_func_802DF460(s32 indx, ActorMarker *caller, f32 arg2[3]) {
f32 sp1C[3];
sp1C[0] = arg2[0] * 100.0f;
sp1C[1] = arg2[1] * 100.0f;
sp1C[2] = arg2[2] * 100.0f;
if (func_8024E030(sp1C, D_8037E068[indx]) == 0) {
D_8037E068[indx][0] = D_8037E068[indx][1] = 0.0f;
}
}
static f32 __XY_dist_square(f32 arg0[2], f32 arg1[2]){
return (arg0[0] - arg1[0])*(arg0[0] - arg1[0]) + (arg0[1] - arg1[1])*(arg0[1] - arg1[1]);
}
s32 chBottlesBonusCursor_func_802DF50C(void) {
s32 i;
f32 min;
f32 temp_f0;
s32 min_index;
min = 1000.0f;
min_index = -1;
for(i = 0; i < 60; i++){
temp_f0 = __XY_dist_square(D_8037E5C0.unk10, D_8037E068[i]);
if (temp_f0 < ((f32)min + (f32)i)) {
min_index = i;
min = temp_f0;
}
}
if(min < 1000.0f)
return min_index;
return -1;
}
bool chBottlesBonusCursor_checkPuzzleCompletion(void) {
s32 i;
D_8037E5C0.is_completed = TRUE;
for(i = 0; i < 20 && D_8037E5C0.is_completed != 0; i++){
if((D_8037E248[i].state != 3)
|| (i != D_8037E248[i].piece_id)
|| !func_803454D0(chBottlesBonus_func_802DEAF8(i))
) {
D_8037E5C0.is_completed = FALSE;
}
}
if (D_8037E5C0.is_completed) {
item_set(ITEM_6_HOURGLASS, FALSE);
timedFunc_set_3(0.25f, comusic_8025AB44, COMUSIC_94_BBONUS, 0, 2000);
timedFunc_set_2(0.3f, func_8025A6EC, COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 22000);
timedFunc_set_0(1.5f, chBottlesBonusCursor_func_802DF99C);
timedFunc_set_0(1.0f, chBottlesBonus_completedPuzzle);
}
return D_8037E5C0.is_completed;
}
void chBottlesBonusCursor_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) {
f32 rotation[3];
Actor *this;
f32 sp3C;
this = marker_getActorAndRotation(chBottlesBonusSursorMarker, &rotation);
modelRender_preDraw((GenMethod_1)func_803253A0, (s32)this);
modelRender_postDraw((GenMethod_1)func_80325794, (s32)chBottlesBonusSursorMarker);
modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL);
actor_setOpacity(this, 0xB9);
func_8024E030(this->position, D_8037E5C0.unk18);
sp3C = (this->scale * 650.0f);
func_80253208(gfx,
(s32)(D_8037E5C0.unk18[0] - sp3C/2), (s32)(D_8037E5C0.unk18[1] - sp3C/2),
(s32)sp3C, (s32)sp3C,
D_803A5D00[func_8024BDA0()]
);
modelRender_draw(gfx, mtx, this->position, rotation, this->scale, NULL, func_80330B1C(chBottlesBonusSursorMarker));
func_8024E030(this->position, D_8037E5C0.unk10);
if (this->state == 1) {
D_8037E5C0.unk10[0] -= 24.0f;
D_8037E5C0.unk10[1] -= 8.0f;
} else {
D_8037E5C0.unk10[0] -= 44.0f;
D_8037E5C0.unk10[1] -= 8.0f;
}
}
ActorMarker *chBottlesBonusCursor_spawn(void){
Actor *this = func_8032813C(0x2B4, D_80368400, 0);
chBottlesBonusSursorMarker = this->marker;
return chBottlesBonusSursorMarker;
}
void chBottlesBonusCursor_func_802DF928(s32 indx) {
f32 rotation_3d[3];
func_80345250(D_8037E248[indx].unk1C, D_8037E248[indx].unkC);
rotation_3d[0] = D_8037E248[indx].rotation;
rotation_3d[1] = 0.0f;
rotation_3d[2] = 0.0f;
func_80345C78(D_8037E248[indx].unkC, rotation_3d);
}
void chBottlesBonusCursor_func_802DF99C(void){
func_803228D8();
func_8025A55C(-1, 2000, 7);
}
void chBottlesBonusCursor_freeMethod(Actor *this) {
func_8031FBF8();
func_8031FBA0();
if (func_8034BAFC() != -1) {
func_802C5A3C(func_8034BAFC());
func_8033D13C(func_8034BAFC());
func_80347AA8();
}
chBottlesBonusSursorMarker = 0;
}
void chBottlesBonusCursor_update(Actor *this) {
OSContPad *sp5C;
f32 sp58;
f32 sp54;
f32 sp50;
Struct_core2_584D0_0 *held_piece;
s32 i;
s32 sp44;
sp5C = func_8024F3F4();
sp58 = func_8033DDB8();
held_piece = &D_8037E248[D_8037E5C0.unk0];
if (!this->initialized) {
this->initialized = TRUE;
this->scale = 0.18f;
this->pitch = 59.0f;
this->roll = 63.0f;
this->yaw = -6.0f;
D_8037E5C0.unk28 = D_8037E5C0.unk2C = 1.0f;
D_8037E5F4 = 0.0f;
D_8037E5F0 = 0.0f;
D_8037E5C0.unk0 = -1;
D_8037E5B8 = -1;
D_8037E5C0.prev_button = sp5C->button;
D_8037E5C0.is_completed = 0;
timedFunc_set_2(3.0f, func_8025A6EC, COMUSIC_94_BBONUS, 0x5DC0);
timedFunc_set_1(3.0f, func_8025AABC, COMUSIC_94_BBONUS);
for(i = 0; i < 20; i++){
bzero(&D_8037E248[i], sizeof(Struct_core2_584D0_0));
D_8037E068[40 + i][0] = D_8037E068[40 + i][1] = 0.0f;
}
marker_setFreeMethod(this->marker, chBottlesBonusCursor_freeMethod);
}
if (this->state != 8 && this->state != 9 && chBottlesBonus_getState() == 4) {
if (this->state != 6) {
sp54 = func_8024E420(sp5C->stick_x, 7, 0x3B);
sp50 = func_8024E420(sp5C->stick_y, 7, 0x3D);
if ((sp54 == 0.0f) || (D_8037E5F0 * sp54 < 0.0f)) {
D_8037E5C0.unk28 = 1.0f;
} else {
D_8037E5C0.unk28 *= 1 + (ABS(sp54 * 0.1));
}
if ((sp50 == 0.0f) || (D_8037E5F4 * sp50 < 0.0f)) {
D_8037E5C0.unk2C = 1.0f;
} else {
D_8037E5C0.unk2C *= 1 + (ABS(sp50 * 0.1));
}
D_8037E5F0 = sp54;
D_8037E5F4 = sp50;
this->unk1C[1] += (((sp50 * sp58) * 150.0) * D_8037E5C0.unk2C);
this->unk1C[2] += (((sp54 * sp58) * 150.0) * D_8037E5C0.unk28);
this->unk1C[1] = MAX(-100.0f, MIN(this->unk1C[1], 110.0f));
this->unk1C[2] = MAX(-135.0f, MIN(this->unk1C[2], 180.0f));
this->position[0] = D_80368400[0] + this->unk1C[0];
this->position[1] = D_80368400[1] + this->unk1C[1];
this->position[2] = D_80368400[2] + this->unk1C[2];
}
if ( (sp5C->button & START_BUTTON) && !(D_8037E5C0.prev_button & START_BUTTON)
&& chBottlesBonus_getState() == 4
) {
chBottlesBonus_lose(&D_8037DCC8, 0xE25);
}
if(this->state == 2 || this->state == 3 || this->state == 4){
if((sp5C->button & L_CBUTTONS) && !(D_8037E5C0.prev_button & L_CBUTTONS)){
held_piece->rotation = mlNormalizeAngle(held_piece->rotation - 90.0);
chBottlesBonusCursor_func_802DF928(D_8037E5C0.unk0);
chBottlesBonus_func_802DEA74(D_8037E5C0.unk0);
func_8030E58C(SFX_12D_CAMERA_ZOOM_CLOSEST, 0.9f);
func_80328B8C(this, 3, 0.0f, 1);
actor_playAnimationOnce(this);
}
if((sp5C->button & R_CBUTTONS) && !(D_8037E5C0.prev_button & R_CBUTTONS)){
held_piece->rotation = mlNormalizeAngle(held_piece->rotation + 90.0);
chBottlesBonusCursor_func_802DF928(D_8037E5C0.unk0);
chBottlesBonus_func_802DEA74(D_8037E5C0.unk0);
func_8030E58C(SFX_12D_CAMERA_ZOOM_CLOSEST, 1.0f);
func_80328B8C(this, 4, 0.0f, 1);
actor_playAnimationOnce(this);
}
}
D_8037E5B8 = chBottlesBonusCursor_func_802DF50C() + 1;
switch(this->state){
case 1://L802E00AC //no piece in hand
if( (D_8037E5B8 > 0) && (D_8037E5B8 < 0x15)
&& ((sp5C->button & A_BUTTON) && !(D_8037E5C0.prev_button & A_BUTTON))
){
if(D_8037E248[D_8037E5B8 - 1].state == 0) {
D_8037E5C0.unk0 = D_8037E5B8 - 1;
chBottlesBonus_func_802DEA50(D_8037E5C0.unk0);
held_piece = &D_8037E248[D_8037E5C0.unk0];
held_piece->state = 1;
held_piece->rotation = 0.0f;
chBottlesBonusCursor_func_802DF928(D_8037E5C0.unk0);
chBottlesBonusCursor_func_802DF928(D_8037E5C0.unk0);
func_8025A6EC(COMUSIC_96_BBONUS_PICKUP_PIECE, -1);
func_80328B8C(this, 2, 0.0f, 1);
}
}
if( ((D_8037E5B8 >= 0x29) && (D_8037E5B8 < 0x3D))
&& ((sp5C->button & A_BUTTON) && !(D_8037E5C0.prev_button & A_BUTTON))
) {
if (D_8037E248[D_8037E5B8 - 41].state == 3) {
if( D_8037E5B8 - 41 != D_8037E248[D_8037E5B8 - 41].piece_id
|| !func_803454D0(chBottlesBonus_func_802DEAF8(D_8037E5B8 - 41))
) {
D_8037E5C0.unk0 = D_8037E5B8 - 41;
chBottlesBonus_func_802DEA50(D_8037E5C0.unk0);
held_piece = &D_8037E248[D_8037E5C0.unk0];
held_piece->state = 2;
chBottlesBonusCursor_func_802DF928(D_8037E5C0.unk0);
func_8030E484(SFX_112_TINKER_ATTENTION);
func_80328B8C(this, 2, 0.0f, 1);
}
}
}
break;
//holding piece
case 2://L802E029C
if((sp5C->button & B_BUTTON) && !(D_8037E5C0.prev_button & B_BUTTON)){
held_piece->state = 0;
func_80328B8C(this, 5, 0.0f, 1);
func_8025A6EC(COMUISC_97_BBONUS_DROP_PIECE, -1);
chBottlesBonus_func_802DEA50(D_8037E5C0.unk0);
D_8037E5C0.unk0 = -1;
break;
}
if((sp5C->button & A_BUTTON) && !(D_8037E5C0.prev_button & A_BUTTON)){
if ((D_8037E5B8 >= 21) && (D_8037E5B8 < 41)) {
held_piece->state = 3;
held_piece->piece_id = D_8037E5B8 - 21;
if ((D_8037E5C0.unk0 == held_piece->piece_id) && func_803454D0(chBottlesBonus_func_802DEAF8(D_8037E5C0.unk0))) {
sp44 = COMUSIC_2B_DING_B;
func_80328B8C(this, 6, 0.0f, 1);
actor_playAnimationOnce(this);
} else {
sp44 = COMUSIC_2C_BUZZER;
func_80328B8C(this, 1, 0.0f, 1);
}
if (chBottlesBonusCursor_checkPuzzleCompletion()) {
func_80328B8C(this, 8, 0.0f, 1);
actor_playAnimationOnce(this);
}
timedFunc_set_2(0.25f, func_8025A6EC, sp44, 26000);
chBottlesBonus_func_802DEA50(D_8037E5C0.unk0);
D_8037E5C0.unk0 = -1;
}
}
break;
case 3://L802E0420
if (animctrl_isStopped(this->animctrl) ) {
func_80328B8C(this, 2, 0.0f, 1);
actor_loopAnimation(this);
}
break;
case 4://L802E0450
if (animctrl_isStopped(this->animctrl) ) {
func_80328B8C(this, 2, 0.0f, 1);
actor_loopAnimation(this);
}
break;
case 7://L802E0480
if (animctrl_isStopped(this->animctrl) ) {
func_80328B8C(this, 2, 0.0f, 1);
actor_loopAnimation(this);
}
break;
case 5://L802E04B0
func_80328B8C(this, 1, 0.0f, 1);
break;
case 6://L802E04CC
if (actor_animationIsAt(this, 0.5f) != 0) {
FUNC_8030E624(SFX_6C_LOCKUP_CLOSING, 1.0f, 24000);
}
if (animctrl_isStopped(this->animctrl) != 0) {
func_80328B8C(this, 1, 0.0f, 1);
actor_loopAnimation(this);
}
break;
case 8://L802E0510
break;
case 9://L802E0510
break;
}
D_8037E5C0.prev_button = sp5C->button;
}
}
s32 chBottlesBonusCursor_func_802E0538(s32 indx){
return D_8037E248[indx].state;
}
s32 chBottlesBonusCursor_getState(void){
Actor *this;
this = marker_getActor(chBottlesBonusSursorMarker);
return this->state;
}
s32 chBottlesBonusCursor_func_802E0588(s32 indx){
return D_8037E248[indx].piece_id;
}
f32 *chBottlesBonusCursor_func_802E05AC(s32 indx) {
if (indx == D_8037E5C0.unk0) {
D_8037E5F8[0] = D_8036840C[0] + marker_getActor(chBottlesBonusSursorMarker)->position[0];
D_8037E5F8[1] = D_8036840C[1] + marker_getActor(chBottlesBonusSursorMarker)->position[1];
D_8037E5F8[2] = D_8036840C[2] + marker_getActor(chBottlesBonusSursorMarker)->position[2];
} else {
ml_vec3f_assign(&D_8037E5F8, 0, 0, 0);
}
return &D_8037E5F8;
}
f32 *chBottlesBonusCursor_func_802E0664(s32 indx){
return D_8037E248[indx].unkC;
}
f32 *chBottlesBonusCursor_func_802E068C(s32 indx){
return D_8037E248[indx].unk1C;
}
s32 chBottlesBonusCursor_func_802E06B4(void){
return D_8037E5B8;
}
bool chBottlesBonusCursor_isPuzzleCompleted(void){
return D_8037E5C0.is_completed;
}
void chBottlesBonusCursor_lose(void){
Actor *this;
this = marker_getActor(chBottlesBonusSursorMarker);
func_80328B8C(this, 9, 0.0f, 1);
actor_playAnimationOnce(this);
}

180
src/core2/ch/collectable.c Normal file
View File

@@ -0,0 +1,180 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern void actor_setOpacity(Actor*,s32);
extern void func_8035644C(u32);
bool chcollectable_collectItem(Actor*, u32, enum asset_e, enum comusic_e, enum item_e, f32);
Actor *chCollectable_draw(ActorMarker *this, Gfx **gdl, Mtx **mptr, Vtx **arg3);
void chCollectable_update(Actor *this);
/* .data */
extern ActorInfo D_80367D00 = {
MARKER_60_BLUE_EGG_COLLECTABLE, ACTOR_52_BLUE_EGG, ASSET_36D_SPRITE_BLUE_EGG,
0, NULL,
chCollectable_update, func_80326224, chCollectable_draw,
0, 0, 0.7f, 0
};
extern ActorInfo D_80367D24 = {
MARKER_B5_RED_FEATHER_COLLECTABLE, ACTOR_129_RED_FEATHER, ASSET_580_SPRITE_RED_FEATHER,
0, NULL,
chCollectable_update, func_80326224, chCollectable_draw,
0, 0, 0.5f, 0
};
extern ActorInfo D_80367D48 = {
MARKER_1E5_GOLD_FEATHER, ACTOR_370_GOLD_FEATHER, ASSET_6D1_SPRITE_GOLDFEATHTER,
0, NULL,
chCollectable_update, func_80326224, chCollectable_draw,
0, 0, 0.5f, 0
};
/* .code */
void chcollectable_setState(Actor *arg0, s32 next_state){
switch(next_state){
default:
break;
case 1:
arg0->unk28 = 0.0f;
//fall-through
case 3:
actor_collisionOff(arg0);
break;
case 2:
actor_collisionOn(arg0);
break;
}
func_80328A84(arg0, next_state);
}
void func_802D8C98(Actor *this, s32 arg1) {
s32 phi_v0;
switch (this->marker->unk14_20)
{
case MARKER_60_BLUE_EGG_COLLECTABLE:
phi_v0 = TRUE;
break;
case MARKER_B5_RED_FEATHER_COLLECTABLE:
phi_v0 = (arg1 == 1) || (arg1 == 2) || (arg1 == 3);
break;
case MARKER_1E5_GOLD_FEATHER:
phi_v0 = TRUE;
break;
default:
phi_v0 = FALSE;
break;
}
this->unk10_12 = arg1;
chcollectable_setState(this, (phi_v0 ) ? 2 : 3);
}
bool chcollectable_collectItem(Actor* actor, u32 arg1, enum asset_e dialogId, enum comusic_e sfxId, enum item_e itemId, f32 arg5){
func_8025A6EC(sfxId,32000);
timedFunc_set_1(0.75f, (GenMethod_1)func_8035644C, arg1);
if(!func_802FADD4(0x1b)){
item_inc(itemId);
} else {
func_803463F4(itemId,1);
}
if(!actor || !actor->unk38_0)
return TRUE;
actor->unk60 = arg5;
chcollectable_setState(actor, 1);
return FALSE;
}
s32 chcollectable_collectEgg(ActorProp *arg0){
Actor *actPtr = NULL;
if(arg0 != NULL){
func_802F3808(&arg0->x);
if(arg0->unk8_0)
actPtr = marker_getActor(arg0->marker);
}
chcollectable_collectItem(actPtr, 5, 0xD9E, COMUSIC_C_EGG_COLLECTED, 0xD, 2.0f);
}
void chcollectable_collectRedFeather(ActorProp *arg0){
Actor *actPtr = NULL;
func_802F38F0(&arg0->x);
if(arg0->unk8_0)
actPtr = marker_getActor(arg0->marker);
chcollectable_collectItem(actPtr, 6, 0xD9F, COMUSIC_B_RED_FEATHER_COLLECTED, 0xF, 4.0f);
}
void chcollectable_collectGoldFeather(ActorProp *arg0){
Actor *actPtr = NULL;
func_802F39D8(&arg0->x);
if(arg0->unk8_0)
actPtr = marker_getActor(arg0->marker);
chcollectable_collectItem(actPtr, 7, 0xDA0, COMUSIC_14_GOLD_FEATHER_COLLECTED, ITEM_10_GOLD_FEATHER, 6.0f);
}
Actor *chCollectable_draw(ActorMarker *this, Gfx **gdl, Mtx **mptr, Vtx **arg3){
Actor *thisActor = marker_getActor(this);
if(thisActor->unk28 != 0.0f){
if(thisActor->unk38_0){
func_80344C2C(1);
if(thisActor->unk28 == 255.0f){
func_803262B8(thisActor);
} else{
actor_setOpacity(thisActor, thisActor->unk28);
}
}
return func_80325934(this, gdl, mptr, arg3);
}
return thisActor;
}
void chCollectable_update(Actor *this) {
f32 temp_f0;
f32 temp_f0_2;
f32 temp_f2;
u32 temp_v0;
if (!this->initialized) {
if (this->marker->unk14_20 != 0x60) {
func_8032AA58(this, 0.56f);
}
this->unk10_12 = -1;
this->unk38_0 = (map_get() == MAP_90_GL_BATTLEMENTS);
this->unk28 = this->unk38_0 ? 0.0f: 255.0f;
this->initialized = TRUE;
}
if(!this->unk38_0)
return;
if (func_80320424(0x23, 3) != this->unk10_12) {
func_802D8C98(this, func_80320424(0x23, 3));
}
switch (this->state) {
case 1:
if (this->unk60 > 0.0) {
this->unk60 -= time_getDelta();
} else {
chcollectable_setState(this, 2);
}
/* fallthrough */
case 3:
if (this->unk28 > 0) {
this->unk28 = MAX(this->unk28 - 8, 0);
}
break;
case 2:
if (this->unk28 < 255) {
this->unk28 = MIN(this->unk28 + 8, 255);
}
break;
}
}

View File

@@ -2,6 +2,8 @@
#include "functions.h"
#include "variables.h"
#include "core2/modelRender.h"
#ifndef ABS
#define ABS(d) ((d) >= 0) ? (d) : -(d)
#endif
@@ -86,8 +88,8 @@ struct {
} D_8037DCE0;
s32 D_8037DCE8;
s32 D_8037DCEC;
gczoombox_t *D_8037DCF0;
gczoombox_t *D_8037DCF4;
gczoombox_t *chGameSelectTopZoombox;
gczoombox_t *chGameSelectBottomZoombox;
f32 D_8037DCF8[2][3];
f32 D_8037DD10[2][3];
s32 D_8037DD28;
@@ -98,7 +100,7 @@ f32 D_8037DD34;
/* .code */
Actor *func_802C4360(ActorMarker *marker, Gfx **arg1, Mtx **arg2, Vtx **arg3){
Actor *func_802C4360(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
s32 sp1C = marker->unk14_20 - 0xe4;
func_8033A45C(3, sp1C);
func_8033A45C(1, 1);
@@ -116,15 +118,15 @@ Actor *func_802C4360(ActorMarker *marker, Gfx **arg1, Mtx **arg2, Vtx **arg3){
else{
modelRender_setEnvColor(0x64, 0x64, 0x64, 0xFF);
}
return func_80325888(marker, arg1, arg2, arg3);
return func_80325888(marker, gfx, mtx, vtx);
}
Actor *func_802C4464(ActorMarker *marker, Gfx **arg1, Mtx **arg2, Vtx **arg3){
Actor *ret_val = func_802C4360(marker, arg1, arg2, arg3);
if(D_8037DCF4)
gczoombox_draw(D_8037DCF4, arg1, arg2, arg3);
if(D_8037DCF0)
gczoombox_draw(D_8037DCF0, arg1, arg2, arg3);
Actor *func_802C4464(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
Actor *ret_val = func_802C4360(marker, gfx, mtx, vtx);
if(chGameSelectBottomZoombox)
gczoombox_draw(chGameSelectBottomZoombox, gfx, mtx, vtx);
if(chGameSelectTopZoombox)
gczoombox_draw(chGameSelectTopZoombox, gfx, mtx, vtx);
return ret_val;
}
@@ -226,10 +228,10 @@ void func_802C4768(s32 gamenum){
}//L802C4A68
sp20[0] = D_8037DD48;\
sp20[1] = D_8037DD68;
func_8031877C(D_8037DCF4);
func_80318284(D_8037DCF4, 2, sp20);
gczoombox_maximize(D_8037DCF4);
gczoombox_resolve_minimize(D_8037DCF4);
func_8031877C(chGameSelectBottomZoombox);
func_80318284(chGameSelectBottomZoombox, 2, sp20);
gczoombox_maximize(chGameSelectBottomZoombox);
gczoombox_resolve_minimize(chGameSelectBottomZoombox);
}
void func_802C4AC8(s32 arg0){
@@ -240,14 +242,14 @@ void func_802C4AC8(s32 arg0){
void func_802C4AF0(Actor * this){
int i;
if(D_8037DCF0){
gczoombox_free(D_8037DCF0);
D_8037DCF0 = NULL;
if(chGameSelectTopZoombox){
gczoombox_free(chGameSelectTopZoombox);
chGameSelectTopZoombox = NULL;
}
if(D_8037DCF4){
gczoombox_free(D_8037DCF4);
D_8037DCF4 = NULL;
if(chGameSelectBottomZoombox){
gczoombox_free(chGameSelectBottomZoombox);
chGameSelectBottomZoombox = NULL;
}
for(i = 0; i < 3; i++){
@@ -296,7 +298,7 @@ void func_802C4C14(Actor *this){
sp84 = this->marker->unk14_20 - 0xe4;
sp80 = (sp84 == D_80365E00);
sp50 = time_getDelta();
if(!D_8037DCF4)
if(chGameSelectBottomZoombox == NULL)
return;
if(!this->initialized){
@@ -382,15 +384,15 @@ void func_802C4C14(Actor *this){
func_8025A6EC(COMUSIC_2B_DING_B, 22000);
}
func_80328A84(this, 2);
func_8031877C(D_8037DCF0);
func_80318284(D_8037DCF0, 2, &D_8037DCE0);
func_8031877C(chGameSelectTopZoombox);
func_80318284(chGameSelectTopZoombox, 2, &D_8037DCE0);
D_8037DD34 = 0.0f;
}
break;
case 3://L802C50C8
case 4://L802C50C8
if(animctrl_isStopped(this->animctrl)){
func_802DEB80();
chBottlesBonus_func_802DEB80();
if(!func_8033D1BC(sp84)){
timedFunc_set_3(0.0f, (GenMethod_3)func_802E4078, MAP_85_CS_SPIRAL_MOUNTAIN_3, 0, 1);
}
@@ -412,8 +414,8 @@ void func_802C4C14(Actor *this){
case 2://L802C51CC
if(sp74[0] == 1){
if(func_8033D1BC(sp84)){
func_8031877C(D_8037DCF0);
func_803183A4(D_8037DCF0, (&D_80365DFC)[func_8031B5B0()]);
func_8031877C(chGameSelectTopZoombox);
func_803183A4(chGameSelectTopZoombox, (&D_80365DFC)[func_8031B5B0()]);
D_8037DD2C = 1;
func_80328A84(this, 5);
}
@@ -508,8 +510,8 @@ void func_802C4C14(Actor *this){
if(D_8037DD2C == 0){
D_8037DD34 += sp50;
if(20.0 < D_8037DD34){
func_8031877C(D_8037DCF0);
func_80318284(D_8037DCF0, 2, &D_8037DCE0);
func_8031877C(chGameSelectTopZoombox);
func_80318284(chGameSelectTopZoombox, 2, &D_8037DCE0);
D_8037DD34 = 0.0f;
}
}
@@ -542,20 +544,20 @@ void func_802C5740(Actor * this){
if(!this->initialized){
func_8033CE40();
if(D_8037DCF4 == NULL){
D_8037DCF4 = gczoombox_new(0xA0, TALK_PIC_C_BANJO_2, 2, 0, NULL);
gczoombox_open(D_8037DCF4);
func_803184C8(D_8037DCF4, 30.0f, 5, 2, 0.4f, 0, 0);
if(chGameSelectBottomZoombox == NULL){
chGameSelectBottomZoombox = gczoombox_new(0xA0, TALK_PIC_C_BANJO_2, 2, 0, NULL);
gczoombox_open(chGameSelectBottomZoombox);
func_803184C8(chGameSelectBottomZoombox, 30.0f, 5, 2, 0.4f, 0, 0);
}//L802C57FC
if(D_8037DCF0 == NULL){
D_8037DCF0 = gczoombox_new(0xA, TALK_PIC_D_KAZOOIE_1, 2, 1, func_802C44D0);
func_80318284(D_8037DCF0, 2, &D_8037DCE0);
gczoombox_open(D_8037DCF0);
gczoombox_maximize(D_8037DCF0);
if(chGameSelectTopZoombox == NULL){
chGameSelectTopZoombox = gczoombox_new(0xA, TALK_PIC_D_KAZOOIE_1, 2, 1, func_802C44D0);
func_80318284(chGameSelectTopZoombox, 2, &D_8037DCE0);
gczoombox_open(chGameSelectTopZoombox);
gczoombox_maximize(chGameSelectTopZoombox);
}//L802C5860
func_803300D8(this->marker, func_802C4AF0);
marker_setFreeMethod(this->marker, func_802C4AF0);
D_8037DCEC = 0;
func_8031FBF8();
func_8031FBA0();
@@ -574,10 +576,10 @@ void func_802C5740(Actor * this){
func_8025A6EC(COMUSIC_73_GAMEBOY, 0);
}//L802C5940
if(!func_8038AAB0()){
if(D_8037DCF4)
gczoombox_update(D_8037DCF4);
if(D_8037DCF0)
gczoombox_update(D_8037DCF0);
if(chGameSelectBottomZoombox)
gczoombox_update(chGameSelectBottomZoombox);
if(chGameSelectTopZoombox)
gczoombox_update(chGameSelectTopZoombox);
}
func_802C4C14(this);
}

View File

@@ -162,10 +162,10 @@ void chjiggy_update(Actor *this){
this->unk124_6 = 0;
break;
case JIGGY_41_GV_MAZE:// L802C7F7C
this->marker->unk14_10 = 0x1E;
this->marker->unk14_10 = 30;
break;
case JIGGY_13_TTC_LOCKUP: //L802C7F94
this->marker->unk14_10 = 0x28;
this->marker->unk14_10 = 40;
break;
}
}

View File

@@ -115,7 +115,7 @@ void func_802CDD78(Actor * this){
local->unk4 = 0;
local->unk8 = (this->position_y < func_80309B24(this->position));
this->marker->unkC = func_802CDBA8;
func_803300D8(this->marker, func_802CDD3C);
marker_setFreeMethod(this->marker, func_802CDD3C);
if(func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE)){
marker_despawn(this->marker);
}

View File

@@ -303,7 +303,7 @@ void func_802D9D60(Actor *this){
if(!this->unk16C_4){
this->unk16C_4 = 1;
func_803300D8(this->marker, func_802D9C90);
marker_setFreeMethod(this->marker, func_802D9C90);
if(this->initialized){
other = actorArray_findClosestActorFromActorId(this->position, ACTOR_12C_MOLEHILL, -1, &sp4C);
this->unk100 = (other) ? other->marker : NULL;

View File

@@ -0,0 +1,55 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
void chOverlayCopyright_update(Actor *this);
/* .data */
f32 D_803680D0[3] = {0.0f, 0.0f, 0.0f};
ActorInfo chOverlayCopyrightDescription = {
MARKER_176_COPYRIGHT_OVERLAY, ACTOR_1DD_COPYRIGHT_OVERLAY, ASSET_54E_MODEL_COPYRIGHT_OVERLAY,
0x1, NULL,
chOverlayCopyright_update, func_80326224, func_802DC7E0,
0, 0, 0.0f, 0
};
/* .bss */
ActorMarker *chOverlayCopyrightMarker;
/* .code */
void chOverlayCopyright_freeMethod(Actor *this){
chOverlayCopyrightMarker = NULL;
}
void chOverlayCopyright_update(Actor *this){
if(!this->initialized){
this->initialized = TRUE;
this->depth_mode = MODEL_RENDER_DEPTH_NONE;
actor_collisionOff(this);
marker_setFreeMethod(this->marker, chOverlayCopyright_freeMethod);
}
}
void __chOverlayCopyright_spawn(void) {
Actor *actor;
if (chOverlayCopyrightMarker == 0) {
actor = func_8032813C(ACTOR_1DD_COPYRIGHT_OVERLAY, D_803680D0, 0);
chOverlayCopyrightMarker = actor->marker;
}
}
void chOverlayCopyright_spawn(s32 arg0, s32 arg1){
if(chOverlayCopyrightMarker == NULL){
__spawnQueue_add_0(__chOverlayCopyright_spawn);
}
}
void chOverlayCopyright_func_802DCB0C(s32 arg0, s32 arg1) {
ActorMarker *temp_a0;
temp_a0 = chOverlayCopyrightMarker;
if (temp_a0 != 0) {
func_80326310(marker_getActor(temp_a0));
}
}

View File

@@ -0,0 +1,93 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern Actor *func_8032813C(enum actor_e, f32[3], s32);
extern void func_80325794(ActorMarker *marker);
Actor *chOverlayNoController_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
void chOverlayNoController_update(Actor *this);
/* .data */
ActorAnimationInfo D_80368150[] ={
{0, 0.0f},
{0x286, 1.1f},
{0x287, 1.6f}
};
f32 D_80368168[3] = {0.0f, 0.0f, 0.0f};
ActorInfo D_80368174 = {
MARKER_178_NO_CONTROLLER_OVERLAY, ACTOR_1DF_NO_CONTROLLER_OVERLAY, ASSET_55D_MODEL_NO_CONTROLLER_OVERLAY,
0x0, D_80368150,
chOverlayNoController_update, func_80326224, chOverlayNoController_draw,
0, 0, 0.0f, 0
};
/* .bss */
ActorMarker *D_8037DE90;
/* .code */
Actor *chOverlayNoController_draw(ActorMarker *marker, Gfx **gdl, Mtx **mptr, Vtx **vptr){
Actor * actor;
f32 sp58[3];
f32 sp4C[3];
f32 sp40[3];
f32 sp34[3];
actor = marker_getActor(marker);
modelRender_preDraw((GenMethod_1)func_803253A0, (s32)actor);
modelRender_postDraw((GenMethod_1)func_80325794, (s32)marker);
func_8024E258();
{sp58[0] = 0.0f; sp58[1] = 0.0f; sp58[2] = 1312.5f;};
{sp4C[0] = 0.0f; sp4C[1] = 0.0f; sp4C[2] = 0.0f;};
func_8024CD88(sp58);
func_8024CE18(sp4C);
func_8024CFD4();
func_8024C904(gdl, mptr);
{sp40[0] = 0.0f; sp40[1] = 0.0f; sp40[2] = 0.0f;};
{sp34[0] = 0.0f; sp34[1] = 165.0f; sp34[2] = 0.0f;};
modelRender_draw(gdl, mptr, sp40, 0, 1.0f, sp34, func_80330B1C(marker));
func_8024E2FC();
func_8024C904(gdl, mptr);
return actor;
}
void chOverlayNoController_freeMethod(Actor *this){
D_8037DE90 = NULL;
}
void chOverlayNoController_update(Actor *this) {
if (!this->initialized) {
this->initialized = TRUE;
this->depth_mode = MODEL_RENDER_DEPTH_NONE;
actor_collisionOff(this);
func_80328B8C(this, 1, 0.0f, 1);
actor_playAnimationOnce(this);
marker_setFreeMethod(this->marker, chOverlayNoController_freeMethod);
}
if (animctrl_isStopped(this->animctrl) != 0) {
func_80328B8C(this, 2, 0.0f, 1);
actor_loopAnimation(this);
}
}
void __chOverlayNoController_spawn(void){
if(D_8037DE90 == NULL){
D_8037DE90 = func_8032813C(ACTOR_1DF_NO_CONTROLLER_OVERLAY, D_80368168, 0)->marker;
}
}
void chOverlayNoController_spawn(s32 arg0, s32 arg1){
if(D_8037DE90 == NULL){
__spawnQueue_add_0(__chOverlayNoController_spawn);
}
}
void chOverlayNoController_func_802DD040(s32 arg0, s32 arg1) {
ActorMarker *temp_a0;
temp_a0 = D_8037DE90;
if (temp_a0 != 0) {
func_80326310(marker_getActor(temp_a0));
}
}

View File

@@ -0,0 +1,109 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern void func_80328B8C(Actor *, s32, f32, s32);
extern void func_803253A0(Actor *);
extern void func_80325794(ActorMarker *);
extern Actor *func_8032813C(enum actor_e id, f32[3], s32);
Actor *chOverlayPressStart_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
void chOverlayPressStart_update(Actor *this);
/* .data */
ActorAnimationInfo D_80368100[] = {
{0, 0.0f},
{0x284, 1.6f},
{0x285, 1.6f}
};
f32 D_80368118[3] = {0.0f, 0.0f, 0.0f};
ActorInfo D_80368124 = {
MARKER_177_PRESS_START_OVERLAY, ACTOR_1DE_PRESS_START_OVERLAY, ASSET_55C_MODEL_PRESS_START_OVERLAY,
0x0, D_80368100,
chOverlayPressStart_update, func_80326224, chOverlayPressStart_draw,
0, 0, 0.0f, 0
};
/* .bss */
ActorMarker *D_8037DE80;
bool D_8037DE84;
/* .code */
Actor *chOverlayPressStart_draw(ActorMarker *marker, Gfx **gdl, Mtx **mptr, Vtx **vptr){
Actor * actor;
f32 sp58[3];
f32 sp4C[3];
f32 sp40[3];
f32 sp34[3];
actor = marker_getActor(marker);
if(D_8037DE84)
return actor;
modelRender_preDraw((GenMethod_1)func_803253A0, (s32)actor);
modelRender_postDraw((GenMethod_1)func_80325794, (s32)marker);
func_8024E258();
{sp58[0] = 0.0f; sp58[1] = 0.0f; sp58[2] = 1312.5f;};
{sp4C[0] = 0.0f; sp4C[1] = 0.0f; sp4C[2] = 0.0f;};
func_8024CD88(sp58);
func_8024CE18(sp4C);
func_8024CFD4();
func_8024C904(gdl, mptr);
{sp40[0] = 0.0f; sp40[1] = 0.0f; sp40[2] = 0.0f;};
{sp34[0] = 0.0f; sp34[1] = 400.0f; sp34[2] = 0.0f;};
modelRender_draw(gdl, mptr, sp40, 0, 1.0f, sp34, func_80330B1C(marker));
func_8024E2FC();
func_8024C904(gdl, mptr);
return actor;
}
void chOverlayPressStart_func_802DCC78(ActorMarker *this){
D_8037DE80 = 0;
D_8037DE84 = 0;
}
void chOverlayPressStart_update(Actor *this){
if(!this->initialized){
this->initialized = 1;
this->depth_mode = MODEL_RENDER_DEPTH_NONE;
actor_collisionOff(this);
func_80328B8C(this, 1, 0.0f, 1);
actor_playAnimationOnce(this);
marker_setFreeMethod(this->marker, chOverlayPressStart_func_802DCC78);
}
if(animctrl_isStopped(this->animctrl)){
func_80328B8C(this, 2, 0.0f, 1);
actor_loopAnimation(this);
}
}
void __chOverlayPressStart_spawn(void){
if(D_8037DE80 == NULL){
D_8037DE80 = func_8032813C(ACTOR_1DE_PRESS_START_OVERLAY, D_80368118, 0)->marker;
}
}
void chOverlayPressStart_spawn(s32 arg0, s32 arg1){
if(D_8037DE80 == NULL){
__spawnQueue_add_0(__chOverlayPressStart_spawn);
}
}
void chOverlayPressStart_func_802DCDB0(void){
D_8037DE84 = TRUE;
}
void chOverlayPressStart_func_802DCDC0(s32 arg0, s32 arg1) {
ActorMarker *temp_a0;
temp_a0 = D_8037DE80;
if (temp_a0 != 0) {
func_80326310(marker_getActor(temp_a0));
}
}