BGS first attempt

This commit is contained in:
superzambezi
2024-09-19 23:37:33 -07:00
parent fbe20325c2
commit c2ed9ac6f3
3 changed files with 92 additions and 92 deletions

View File

@@ -3,7 +3,7 @@
#include "variables.h"
void timed_exitStaticCamera(f32);
void BGS_func_803888E4(Actor *this, s32 arg1);
void chTiptup_setState(Actor *this, s32 arg1);
typedef struct{
u32 unk0;
@@ -17,15 +17,15 @@ typedef struct ch_bgs_2270_s{
u8 unkA;
u8 unkB;
f32 unkC;
} ActorLocal_BGS_2270;
} ActorLocal_Tiptup;
void func_80389080(Actor *this);
void chTiptup_update(Actor *this);
Actor *actor_draw(ActorMarker *, Gfx **, Mtx **, Vtx **);
ActorInfo D_80390830 = {
ActorInfo chTiptup = {
MARKER_19A_TIPTUP, ACTOR_27A_TIPTUP, ASSET_3F8_MODEL_TIPTUP,
0, NULL,
func_80389080, NULL, actor_draw,
chTiptup_update, NULL, actor_draw,
0, 0, 2.5f, 0
};
s16 D_80390854[] = {0, 0xC78, 0xC7A, 0xC7C}; //see again texts
@@ -34,20 +34,20 @@ u8 D_80390864[] = {3, 3, 5, 7}; //chchoirgame_sequence_length
f32 D_80390868[3] = {0.0f, 100.0f, -1020.0f}; //chchoirgame_jiggy_position
void BGS_func_80388660(ActorMarker *this){
BGS_func_803888E4(marker_getActor(this), 6);
chTiptup_setState(marker_getActor(this), 6);
}
void BGS_func_8038868C(void){
jiggy_spawn(JIGGY_27_BGS_TIPTUP, D_80390868);
void chTiptup_jiggySpawn(void){
jiggy_spawn(JIGGY_27_BGS_TIPTUP, D_80390868); //spawn jiggy after minigame
}
void func_803886B4(ActorMarker *this, s32 arg1){
void chTiptup_activatePattern(ActorMarker *this, s32 arg1){
Actor *thisActor;
ActorLocal_BGS_2270 *actLocalPtr;
ActorLocal_Tiptup *actLocalPtr;
Struct_BGS_2270_0s *tmpPtr;
thisActor = marker_getActor(this);
actLocalPtr = (ActorLocal_BGS_2270 *)&thisActor->local;
actLocalPtr = (ActorLocal_Tiptup *)&thisActor->local;
actLocalPtr->unkB = arg1;
if(arg1){
tmpPtr = vector_pushBackNew(&actLocalPtr->unk4);
@@ -55,59 +55,59 @@ void func_803886B4(ActorMarker *this, s32 arg1){
}
}
void func_803886F4(ActorMarker *this){
void chTiptup_activateTimer(ActorMarker *this){
Actor *thisActor;
thisActor = marker_getActor(this);
item_set(ITEM_6_HOURGLASS, 1);
item_set(ITEM_0_HOURGLASS_TIMER, 30*60-1);
BGS_func_803888E4(thisActor, 5);
chTiptup_setState(thisActor, 5);
}
void func_8038873C(void){
void chTiptup_sfxCorrectHit(void){
func_8025A6EC(COMUSIC_2B_DING_B, 28000);
}
void BGS_func_80388760(void){
void chTiptup_sfxIncorrectHit(void){
func_8025A6EC(COMUSIC_2C_BUZZER, 28000);
}
void func_80388784(ActorMarker *this, enum asset_e text_id, s32 arg2){
void chTiptup_textEvent(ActorMarker *this, enum asset_e text_id, s32 arg2){
Actor *thisActor;
thisActor = marker_getActor(this);
switch(text_id){
case 0xc72:
case 0xc74:
BGS_func_803888E4(thisActor, 3);
chTiptup_setState(thisActor, 3);
break;
case 0xc78:
case 0xc7a:
case 0xc7c:
BGS_func_803888E4(thisActor, 4);
chTiptup_setState(thisActor, 4);
break;
case 0xc77:
case 0xc79:
func_80324E38(0.0f, 0);
BGS_func_803888E4(thisActor, 3);
chTiptup_setState(thisActor, 3);
break;
case 0xc7b:
timedFunc_set_0(0.0f, BGS_func_8038868C);
timedFunc_set_0(0.0f, chTiptup_jiggySpawn);
timed_exitStaticCamera(2.5f);
func_80324E38(2.5f, 0);
break;
}
}
void func_80388848(ActorMarker *this){
void chTiptup_correctHit(ActorMarker *this){
Actor *thisActor;
ActorLocal_BGS_2270 *unqPtr;
ActorLocal_Tiptup *unqPtr;
s32 sp1C;
thisActor = marker_getActor(this);
unqPtr = (ActorLocal_BGS_2270 *)&thisActor->local;
unqPtr = (ActorLocal_Tiptup *)&thisActor->local;
sp1C = vector_size(unqPtr->unk4);
func_8038873C();
chTiptup_sfxCorrectHit();
if(sp1C != ++unqPtr->unk0)
return;
@@ -121,8 +121,8 @@ void func_80388848(ActorMarker *this){
}
}
void BGS_func_803888E4(Actor *this, s32 arg1){
ActorLocal_BGS_2270 *unqPtr;
void chTiptup_setState(Actor *this, s32 arg1){
ActorLocal_Tiptup *unqPtr;
f32 sp54;
f32 tmpf;
@@ -132,7 +132,7 @@ void BGS_func_803888E4(Actor *this, s32 arg1){
s32 rand2;
Struct_BGS_2270_0s *s1;
unqPtr = (ActorLocal_BGS_2270 *)&this->local;
unqPtr = (ActorLocal_Tiptup *)&this->local;
this->state = arg1;
unqPtr->unkC = 0.0f;
if(this->state == 1){
@@ -145,14 +145,14 @@ void BGS_func_803888E4(Actor *this, s32 arg1){
if(!this->is_first_encounter){
this->is_first_encounter = TRUE;
if(unqPtr->unkA == 0){
func_80311480(0xc72, 0xe, this->position, this->marker, func_80388784, 0);
func_80311480(0xc72, 0xe, this->position, this->marker, chTiptup_textEvent, 0);
}else{
func_80311480(0xc74, 0xf, this->position, this->marker, func_80388784, 0);
func_80311480(0xc74, 0xf, this->position, this->marker, chTiptup_textEvent, 0);
}
}
else{
func_80311480(D_80390854[unqPtr->unkA], 0xf, this->position, this->marker, func_80388784, 0);
func_80311480(D_80390854[unqPtr->unkA], 0xf, this->position, this->marker, chTiptup_textEvent, 0);
}
}
if(this->state == 3){
@@ -167,19 +167,19 @@ void BGS_func_803888E4(Actor *this, s32 arg1){
for(; i < D_80390864[unqPtr->unkA]; i++){
tmpf += randf2(1.0f, 1.5f);
while((rand2 = randi2(1,7)) == prev_member);
timedFunc_set_2(tmpf, (GenFunction_2) func_803886B4, reinterpret_cast(s32, this->marker), rand2);
timedFunc_set_2(tmpf + 0.1, (GenFunction_2)func_803886B4, reinterpret_cast(s32, this->marker), 0);
timedFunc_set_2(tmpf, (GenFunction_2) chTiptup_activatePattern, reinterpret_cast(s32, this->marker), rand2);
timedFunc_set_2(tmpf + 0.1, (GenFunction_2)chTiptup_activatePattern, reinterpret_cast(s32, this->marker), 0);
prev_member = rand2;
}//L80388B7C
timed_exitStaticCamera(tmpf += 2.5);
if(!unqPtr->unkA && !volatileFlag_get(VOLATILE_FLAG_2_FF_IN_MINIGAME)){
func_80324DBC(tmpf + 0.5, 0xc73, 0xe, this->position, this->marker, func_80388784, 0);
func_80324DBC(tmpf + 0.5, 0xc73, 0xe, this->position, this->marker, chTiptup_textEvent, 0);
unqPtr->unkA = 1;
}
func_80324E38(sp54 = tmpf + 0.6, 0);
if(volatileFlag_get(VOLATILE_FLAG_2_FF_IN_MINIGAME)){
timedFunc_set_1(sp54, (GenFunction_1)func_803886F4, reinterpret_cast(s32, this->marker));
timedFunc_set_1(sp54, (GenFunction_1)chTiptup_activateTimer, reinterpret_cast(s32, this->marker));
}else{
this->state = 0x05;
}
@@ -194,8 +194,8 @@ void BGS_func_803888E4(Actor *this, s32 arg1){
for(j = 0; j < vector_size(unqPtr->unk4); j++){
s1 = (Struct_BGS_2270_0s *)vector_at(unqPtr->unk4,j);
tmpf += randf2(1.0f, 1.5f);
timedFunc_set_2(tmpf, (GenFunction_2)func_803886B4, reinterpret_cast(s32, this->marker), s1->unk0);
timedFunc_set_2(tmpf + 0.1, (GenFunction_2)func_803886B4, reinterpret_cast(s32, this->marker), 0);
timedFunc_set_2(tmpf, (GenFunction_2)chTiptup_activatePattern, reinterpret_cast(s32, this->marker), s1->unk0);
timedFunc_set_2(tmpf + 0.1, (GenFunction_2)chTiptup_activatePattern, reinterpret_cast(s32, this->marker), 0);
}
timed_exitStaticCamera(tmpf += 2.5);
func_80324E38(tmpf + 0.6,0);
@@ -208,7 +208,7 @@ void BGS_func_803888E4(Actor *this, s32 arg1){
}
func_80324E38(0.5f, 3);
timed_setStaticCameraToNode(1.5f, 1);
func_80324DBC(2.0f, D_8039085C[unqPtr->unkA++], 0xF, this->position, this->marker, func_80388784, 0);
func_80324DBC(2.0f, D_8039085C[unqPtr->unkA++], 0xF, this->position, this->marker, chTiptup_textEvent, 0);
}
}
@@ -218,31 +218,31 @@ void func_80388E44(ActorMarker *arg0, ActorMarker *arg1){
s32 func_80388E70(ActorMarker *this){
Actor *ptr;
ActorLocal_BGS_2270 *local;
ActorLocal_Tiptup *local;
ptr = marker_getActor(this);
local = (ActorLocal_BGS_2270 *)&ptr->local;
local = (ActorLocal_Tiptup *)&ptr->local;
return local->unkB;
}
void func_80388E94(ActorMarker *this, s32 arg1){
void chTiptup_choirHitReaction(ActorMarker *this, s32 arg1){
Actor * thisActor;
ActorLocal_BGS_2270 *unqPtr;
ActorLocal_Tiptup *unqPtr;
Struct_BGS_2270_0s * tmp;
thisActor = marker_getActor(this);
unqPtr = (ActorLocal_BGS_2270 *)&thisActor->local;
unqPtr = (ActorLocal_Tiptup *)&thisActor->local;
if((s32)unqPtr->unk0 >= (s32) vector_size(unqPtr->unk4)){
if(!mapSpecificFlags_get(0) && func_80311480(0xc76, 0, 0, 0, 0, 0))
mapSpecificFlags_set(0,1);
}else{
tmp = (Struct_BGS_2270_0s *)vector_at(unqPtr->unk4, unqPtr->unk0);
if(arg1 == tmp->unk0){
timedFunc_set_1(0.5f, (GenFunction_1)func_80388848, reinterpret_cast(s32, thisActor->marker));
timedFunc_set_1(0.5f, (GenFunction_1)chTiptup_correctHit, reinterpret_cast(s32, thisActor->marker));
}
else{
func_8028F55C(1, thisActor->marker);
timedFunc_set_0(0.5f, BGS_func_80388760);
timedFunc_set_0(0.5f, chTiptup_sfxIncorrectHit);
if(!mapSpecificFlags_get(1) && !volatileFlag_get(VOLATILE_FLAG_2_FF_IN_MINIGAME) && func_80311480(0xc75, 0, NULL, NULL, NULL, NULL))
mapSpecificFlags_set(1,TRUE);
}
@@ -250,19 +250,19 @@ void func_80388E94(ActorMarker *this, s32 arg1){
}
void func_80388FC0(Actor *this){
ActorLocal_BGS_2270 *local;
ActorLocal_Tiptup *local;
local = (ActorLocal_BGS_2270 *)&this->local;
local = (ActorLocal_Tiptup *)&this->local;
fileProgressFlag_setN(0, local->unkA, 2);
vector_free(local->unk4);
}
void func_80388FFC(ActorMarker *this, s32 *arg1, f32* arg2){
Actor *thisActor;
ActorLocal_BGS_2270 *localPtr;
ActorLocal_Tiptup *localPtr;
thisActor = marker_getActor(this);
localPtr = (ActorLocal_BGS_2270 *)&thisActor->local;
localPtr = (ActorLocal_Tiptup *)&thisActor->local;
*arg2 = 0.52 + (f64)localPtr->unk9 * 0.12;
localPtr->unk9++;
@@ -270,15 +270,15 @@ void func_80388FFC(ActorMarker *this, s32 *arg1, f32* arg2){
}
void func_80389080(Actor *this){
void chTiptup_update(Actor *this){
f32 player_position[3];
ActorLocal_BGS_2270 *unqPtr;
ActorLocal_Tiptup *unqPtr;
f32 sp3C;
f32 sp38;
f32 sp34;
f32 sp30;
unqPtr = (ActorLocal_BGS_2270 *)&this->local;
unqPtr = (ActorLocal_Tiptup *)&this->local;
sp3C = time_getDelta();
if(!this->volatile_initialized){
this->volatile_initialized = TRUE;
@@ -296,7 +296,7 @@ void func_80389080(Actor *this){
unqPtr->unkA = 3;
this->position_y = this->position_y - 300.0f;
}
BGS_func_803888E4(this, 1);
chTiptup_setState(this, 1);
if(jiggyscore_isSpawned(JIGGY_27_BGS_TIPTUP) && !volatileFlag_get(VOLATILE_FLAG_2_FF_IN_MINIGAME) && !volatileFlag_get(VOLATILE_FLAG_1))
marker_despawn(this->marker);
}
@@ -315,12 +315,12 @@ void func_80389080(Actor *this){
if(volatileFlag_get(VOLATILE_FLAG_2_FF_IN_MINIGAME)){
if(volatileFlag_get(VOLATILE_FLAG_3)){
func_80324E38(0.0f,0);
BGS_func_803888E4(this, 3);
chTiptup_setState(this, 3);
}
}
else{
if(ml_distance_vec3f(this->position, player_position) < 300.0f && player_getTransformation() == TRANSFORM_1_BANJO && !jiggyscore_isSpawned(JIGGY_27_BGS_TIPTUP)){
BGS_func_803888E4(this, 2);
chTiptup_setState(this, 2);
}
}
}
@@ -334,7 +334,7 @@ void func_80389080(Actor *this){
} //L80389370
else{
if(ml_distance_vec3f(this->position, player_position) >= 300.0f)
BGS_func_803888E4(this, 1);
chTiptup_setState(this, 1);
}
}//L803893A0
if(this->state == 6){