From 8f493432e5090aa02653a4f90ee25092491a840a Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Sat, 4 May 2024 21:37:09 -0500 Subject: [PATCH 01/38] Progress update (98.8633%) --- README.md | 2 +- progress/progress_core1.svg | 6 ++-- progress/progress_core2.svg | 4 +-- progress/progress_total.svg | 6 ++-- src/core1/code_0.c | 41 ++++++++++++-------------- src/core1/code_13990.c | 58 +++++++++++++++++++++++-------------- src/core1/code_2BD0.c | 18 +++++------- src/core2/code_BEF20.c | 31 ++++++++------------ 8 files changed, 82 insertions(+), 84 deletions(-) diff --git a/README.md b/README.md index 86eedbba..1b9e3f03 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (98.6934%) +# banjo (98.8633%) diff --git a/progress/progress_core1.svg b/progress/progress_core1.svg index 64b21518..86e5696c 100644 --- a/progress/progress_core1.svg +++ b/progress/progress_core1.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ core1 - 98.4321% - 98.4321% + 99.1399% + 99.1399% \ No newline at end of file diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index 609fff7c..7b8a9d65 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -17,7 +17,7 @@ core2 - 98.1193% - 98.1193% + 98.2363% + 98.2363% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 4f542984..6f9ee442 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 98.6934% - 98.6934% + 98.8633% + 98.8633% \ No newline at end of file diff --git a/src/core1/code_0.c b/src/core1/code_0.c index 6b8b87d3..61e7c179 100644 --- a/src/core1/code_0.c +++ b/src/core1/code_0.c @@ -129,18 +129,12 @@ void func_8023DCF4(void){ D_80275618--; } - - -#ifndef NOMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core1/code_0/mainLoop.s") -#else void mainLoop(void){ - s32 x; - s32 y; - s32 r; - s32 g; - s32 b; + s32 x, y; + s32 r, g, b, a; + u16 tmp; u16 rgba; + s32 offset; if((func_8023DB5C() & 0x7f) == 0x11) sns_write_payload_over_heap(); @@ -182,23 +176,24 @@ void mainLoop(void){ ){ s32 offset; //render weird CRC failure image - for(x= 0x1e; x< framebuffer_height - 0x1e; x++){//L8023DEB4 - g = x >> 3; - for(y = 0x14; y < 0xeb; y++){ - b = ((func_8023DB5C() << 3) + y*y + x*x) >> 3; - r = y >> 3; - rgba = _SHIFTL(b, 1, 5); - rgba |= _SHIFTL(r, 11, 5 ); - rgba |= _SHIFTL(g, 6, 5); - rgba |= _SHIFTL(1, 0, 1 ); - offset = ((framebuffer_width - 0xff)/2 + y + x*framebuffer_width); - D_803A5D00[0][offset] = rgba; - D_803A5D00[1][offset] = rgba; + for(y= 0x1e; y < framebuffer_height - 0x1e; y++){//L8023DEB4 + for(x = 0x14; x < 0xeb; x++){ + tmp = ((8 * func_8023DB5C()) + ((x*x) + (y*y))); + + r = _SHIFTL(x>>3, 11, 5); + g = _SHIFTL(y>>3, 6, 5); + b = _SHIFTL(tmp>>3, 1, 5); + a = 1; + + rgba = b | r | g | a; + + offset = ((framebuffer_width - 0xFF) / 2) + x + (y*framebuffer_width); + D_803A5D00[0][offset] = (s32) rgba; + D_803A5D00[1][offset] = (s32) rgba; } } }//L8023DF70 } -#endif void __mainMethod(void *arg0){ core1_init(); diff --git a/src/core1/code_13990.c b/src/core1/code_13990.c index 1df9f7b8..37aa7aa8 100644 --- a/src/core1/code_13990.c +++ b/src/core1/code_13990.c @@ -42,32 +42,27 @@ void mlMtxApply(Mtx *mPtr){ func_80245A7C(D_80282FD0, mPtr); } -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core1/code_13990/func_802514BC.s") -#else -void func_802514BC(Mtx *arg0) { - s32 i, j, k; - f32 tmp; - f32 sp38[4][4]; - f32 (*sp34)[4]; - f32 (*var_s0)[4]; +void func_802514BC(Mtx* arg0) { + s32 row; + s32 col; + s32 i; + f32 sum; + f32 prod[4][4]; - - sp34 = reinterpret_cast(f32 *, *D_80282FD0); - var_s0 = reinterpret_cast(f32 *, arg0); - - for(i = 0; i < 4; i++){ - for(j = 0; j < 4; j++){ - tmp = 0.0f; - for(k = 0; k < 4; k++){ - tmp += var_s0[i][k] * sp34[k][j]; + for(row = 0; row < 4; row++, arg0 = &arg0->m[1][0]) + { + for(col = 0; col < 4; col++) + { + sum = 0.0; + for(i = 0; i < 4; i++) + { + sum += reinterpret_cast(f32, arg0->m[0][i]) * reinterpret_cast(f32, D_80282FD0->m[i][col]); } - sp38[i][j] = tmp; + prod[row][col] = sum; } } - func_80253010(sp34, &sp38, sizeof(Mtx)); + func_80253010(D_80282FD0, prod, sizeof(Mtx)); } -#endif void func_802515D4(f32 arg0[3][3]) { f32 var_f0; @@ -163,7 +158,26 @@ void func_80251878(f32* arg0) { D_80282FD0 = var_a2; } -#pragma GLOBAL_ASM("asm/nonmatchings/core1/code_13990/func_802519C8.s") +void func_802519C8(Mtx * arg0, Mtx * arg1) { + s32 row; + s32 col; + Mtx * dst = (D_80282FD0 + 1); + + for (row = 0; row < 4; row++, arg1 = &arg1->m[1][0]) + { + for (col = 0; col < 4; col++) + { + reinterpret_cast(f32, dst->m[row][col]) = + ( + reinterpret_cast(f32, arg1->m[0][0]) * reinterpret_cast(f32, arg0->m[0][col]) + + reinterpret_cast(f32, arg1->m[0][1]) * reinterpret_cast(f32, arg0->m[1][col]) + + reinterpret_cast(f32, arg1->m[0][2]) * reinterpret_cast(f32, arg0->m[2][col]) + + reinterpret_cast(f32, arg1->m[0][3]) * reinterpret_cast(f32, arg0->m[3][col]) + ); + } + } + D_80282FD0 = (dst + 0); +} //mlMtx void mlMtxIdent(void){ diff --git a/src/core1/code_2BD0.c b/src/core1/code_2BD0.c index 122c0804..3f06cb29 100644 --- a/src/core1/code_2BD0.c +++ b/src/core1/code_2BD0.c @@ -8,32 +8,28 @@ OSMesgQueue D_8027E0AC; OSMesg D_8027E0C8[16]; //g_PimgrMesgBuffer OSMesgQueue D_8027E108; //g_PimgrMesgQueue - -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core1/code_2BD0/func_802405F0.s") -#else -void func_802405F0(u32 arg0, u32 arg1, s32 size){ - int i; +void func_802405F0(u32 * arg0, s32 arg1, s32 size){ s32 block_cnt; s32 block_remainder; s32 block_size = 0x20000; + int i; osWritebackDCache(arg0, size); - block_cnt = size/block_size; + block_cnt = size / block_size; + block_remainder = size % block_size; + for(i = 0; i < block_cnt; i++){ - osPiStartDma(&D_8027E090, OS_MESG_PRI_NORMAL, OS_READ, arg1, arg0, block_size, &D_8027E0AC); + osPiStartDma(&D_8027E090, OS_MESG_PRI_NORMAL, OS_READ, arg1, arg0, 0x20000, &D_8027E0AC); osRecvMesg(&D_8027E0AC, NULL, 1); - arg0 += 0x20000; arg1 += 0x20000; + arg0 += 0x8000; } - block_remainder = size%0x20000; osPiStartDma(&D_8027E090, OS_MESG_PRI_NORMAL, OS_READ, arg1, arg0, block_remainder, &D_8027E0AC); osRecvMesg(&D_8027E0AC, NULL, 1); osInvalDCache(arg0, size); } -#endif void piMgr_create(void){ osCreateMesgQueue(&D_8027E0AC, &D_8027E0A8, 1); diff --git a/src/core2/code_BEF20.c b/src/core2/code_BEF20.c index 41f8410b..78180a43 100644 --- a/src/core2/code_BEF20.c +++ b/src/core2/code_BEF20.c @@ -47,9 +47,7 @@ s32 item_getCount(enum item_e item){ return D_80385F30[item]; } - -#ifdef NONMATCHING -s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){\ +s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){ s32 oldVal; s32 sp40; s32 sp3C; @@ -58,10 +56,7 @@ s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){\ s32 sp30; s32 sp2C; s32 sp28; - s32 sp24; //without this var newVal is too high, but sp1C is correct - s32 newVal; - - + oldVal = D_80385F30[item]; if(func_80255D04()) @@ -77,8 +72,9 @@ s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){\ diff = 0; } } - newVal = MAX(0, D_80385F30[item] + diff); - D_80385F30[item] = newVal; + + sp28 = D_80385F30[item] = MAX(0, D_80385F30[item] + diff); + // sp20; sp34 = ((fileProgressFlag_get(FILEPROG_B9_DOUBLE_HEALTH))? 2 : 1); D_80385F30[ITEM_15_HEALTH_TOTAL] = MIN(sp34*8, D_80385F30[ITEM_15_HEALTH_TOTAL]); @@ -104,7 +100,7 @@ s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){\ sp38 = 0; break; } - if(sp38 != 0){ + if(sp38){ D_80385F30[item] = MIN(sp38, D_80385F30[item]); } if(!arg2){ @@ -114,8 +110,8 @@ s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){\ } sp3C = item_empty(item); - if(item < ITEM_6_HOURGLASS && sp3C) - D_80385F30[item + ITEM_6_HOURGLASS] = FALSE; + if(item < 6 && sp3C) + D_80385F30[item + ITEM_6_HOURGLASS] = 0; switch(item){ case ITEM_14_HEALTH: @@ -124,17 +120,17 @@ s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){\ break; case ITEM_17_AIR: sp30 = func_80301D24(oldVal); - sp2C = func_80301D24(newVal); + sp2C = func_80301D24(sp28); if(sp3C){ - bs_checkInterrupt(BS_INTR_11_DROWN); + bs_checkInterrupt(0x11); D_80385FE4 = 1; } - if(sp2C != 0 && sp30 != sp2C ){ + if(sp2C && sp30 != sp2C ){ if(sp2C < sp30){ func_8025A6EC(SFX_AIR_METER_DROPPING, 28000); } else{ - func_8030E760(SFX_3E9_UNKNOWN, 1.2f, 28000); + func_8030E760(0x3e9, 1.2f, 28000); } } break; @@ -152,9 +148,6 @@ s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){\ } return D_80385F30[item]; } -#else -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_BEF20/func_80345FB4.s") -#endif s32 func_803463D4(enum item_e item, s32 diff){ func_80345FB4(item, diff, 0); From 255c800b183759d87f9ddf1a84a118a38f5fcc2b Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Sat, 4 May 2024 22:26:15 -0500 Subject: [PATCH 02/38] func_8032A09C --- README.md | 2 +- progress/progress_core2.svg | 6 ++-- progress/progress_total.svg | 4 +-- src/core2/code_9E370.c | 64 ++++++++++++++++++++----------------- 4 files changed, 40 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 1b9e3f03..5385913f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (98.8633%) +# banjo (98.9505%) diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index 7b8a9d65..1947f404 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ core2 - 98.2363% - 98.2363% + 98.3883% + 98.3883% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 6f9ee442..6fe81ce3 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 98.8633% - 98.8633% + 98.9505% + 98.9505% \ No newline at end of file diff --git a/src/core2/code_9E370.c b/src/core2/code_9E370.c index 097e7ae9..cc17b814 100644 --- a/src/core2/code_9E370.c +++ b/src/core2/code_9E370.c @@ -1774,27 +1774,23 @@ typedef struct { Actor *actor_save_state[]; }ActorListSaveState; -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_9E370/func_8032A09C.s") -#else -void func_8032A09C(s32 arg0, s32 arg1) { - ActorListSaveState *var_s1 = (s32)arg1; +void func_8032A09C(s32 arg0, ActorListSaveState *arg1) { + Actor **temp_v1; + s32 pad; Actor *var_s0; - u32 var_s2; - u32 var_s3; - s32 temp_a0; + Actor *temp_v0_6; + s32 var_s2; Actor **sp60; Actor **sp5C; s32 sp50[3]; - Actor *temp_v0_6; - - + s32 var_s3; + spawnQueue_lock(); if (suBaddieActorArray != NULL) { func_803283BC(); var_s3 = 0; - var_s0 = var_s1->actor_save_state; - for(var_s2 = var_s1->cnt; var_s2 != 0; var_s2--) { + var_s0 = arg1->actor_save_state; + for(var_s2 = arg1->cnt; var_s2 != 0; var_s2--) { if ((var_s0->unk78_13 != 0) && (var_s3 < var_s0->unk78_13)) { var_s3 = var_s0->unk78_13; } @@ -1807,14 +1803,18 @@ void func_8032A09C(s32 arg0, s32 arg1) { } var_s3++; + sp60 = malloc(var_s3*sizeof(Actor *)); + pad = sp5C + var_s2; sp5C = malloc(var_s3*sizeof(Actor *)); for (var_s2 = 0; var_s2 < var_s3; var_s2++) { - sp60[var_s2] = 0; - sp5C[var_s2] = 0; + *(u32*)&sp60[var_s2] = 0; + *(u32*)&sp5C[var_s2] = 0; } - var_s0 = var_s1->actor_save_state; - for(var_s2 = var_s1->cnt; var_s2 != 0; var_s2--) { + + + var_s0 = arg1->actor_save_state; + for(var_s2 = arg1->cnt; var_s2 != 0; var_s2--) { if (var_s0->unk78_13 != 0) { sp5C[var_s0->unk78_13] = var_s0; } @@ -1824,34 +1824,39 @@ void func_8032A09C(s32 arg0, s32 arg1) { if ((var_s0->unk78_13 != 0)) { sp60[var_s0->unk78_13] = var_s0; } - var_s0++; } for(var_s2 = 1; var_s2 < var_s3; var_s2++){ - if ((sp60[var_s2] != NULL) && (sp5C[var_s2] != NULL) && !sp5C[var_s2]->unkF4_22) { - actor_copy(sp5C[var_s2], sp60[var_s2]); - func_80329B68(sp60[var_s2]); - func_803299B4(sp60[var_s2]); + pad = sp5C + var_s2; + temp_v1 = sp60 + var_s2; + if ((*temp_v1 != NULL) && (*(Actor **)pad != NULL) && !(*(Actor **)pad)->unkF4_22) { + var_s0 = *(Actor **)pad; + temp_v0_6 = *temp_v1; + actor_copy(var_s0, temp_v0_6); + func_80329B68(temp_v0_6); + func_803299B4(temp_v0_6); } } for(var_s2 = 1; var_s2 < var_s3; var_s2++){ - if ((sp60[var_s2] != NULL) && !sp60[var_s2]->unk58_1 && (sp5C[var_s2] == NULL)) { - marker_despawn(sp60[var_s2]->marker); - sp60[var_s2] = NULL; + pad = sp5C + var_s2; + temp_v1 = sp60 + var_s2; + if ((*temp_v1 != NULL) && !(*temp_v1)->unk58_1 && (*(Actor **)pad == NULL)) { + marker_despawn((*temp_v1)->marker); + *temp_v1 = NULL; } } - var_s0 = var_s1->actor_save_state; - for(var_s2 = var_s1->cnt; var_s2 != 0; var_s2--){ + var_s0 = arg1->actor_save_state; + for(var_s2 = arg1->cnt; var_s2 != 0; var_s2--){ if (var_s0->unk78_13 == 0) { sp50[0] = (s32) var_s0->position[0]; sp50[1] = (s32) var_s0->position[1]; sp50[2] = (s32) var_s0->position[2]; - temp_v0_6 = func_8032811C(var_s0->modelCacheIndex, sp50, (s32) var_s0->yaw); + pad = var_s0->yaw; + temp_v0_6 = func_8032811C(var_s0->modelCacheIndex, (sp50), pad); actor_copy(var_s0, temp_v0_6); func_80329B68(temp_v0_6); func_803299B4(temp_v0_6); - if(temp_v0_6); } var_s0++; } @@ -1861,7 +1866,6 @@ void func_8032A09C(s32 arg0, s32 arg1) { } spawnQueue_unlock(); } -#endif void func_8032A5F8(void) { Actor *var_s0; From e139aac86c720bcfc00c492dbc518126b6e9cd60 Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Sat, 4 May 2024 23:10:06 -0500 Subject: [PATCH 03/38] mapSavestate_apply() matched --- README.md | 2 +- include/prop.h | 5 ++++ progress/progress_core2.svg | 4 +-- progress/progress_total.svg | 4 +-- src/core2/code_5BEB0.c | 54 +++++++++++++++++++++---------------- src/core2/code_9E370.c | 5 +--- 6 files changed, 42 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 5385913f..89f0487b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (98.9505%) +# banjo (98.9690%) diff --git a/include/prop.h b/include/prop.h index f285d328..8759f920 100644 --- a/include/prop.h +++ b/include/prop.h @@ -393,4 +393,9 @@ typedef struct actor_array{ Actor data[]; //variable size array }ActorArray; +typedef struct { + u32 cnt; + Actor *actor_save_state[]; +}ActorListSaveState; + #endif diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index 1947f404..4b9e4c90 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -17,7 +17,7 @@ core2 - 98.3883% - 98.3883% + 98.4207% + 98.4207% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 6fe81ce3..a4567662 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 98.9505% - 98.9505% + 98.9690% + 98.9690% \ No newline at end of file diff --git a/src/core2/code_5BEB0.c b/src/core2/code_5BEB0.c index a1159ed9..6909f77d 100644 --- a/src/core2/code_5BEB0.c +++ b/src/core2/code_5BEB0.c @@ -8,7 +8,7 @@ typedef struct map_savestate_s{ }MapSavestate; /* .bss */ -MapSavestate *D_8037E650[0x9A]; +s32 D_8037E650[0x9A]; u8 pad_8037E8A8[0x18]; /* public functions */ @@ -26,8 +26,8 @@ void mapSavestate_init(void){ void mapSavestate_free_all(void){ int i; for(i = 0; i < 0x9A; i++){ - if(D_8037E650[i]){ - free(D_8037E650[i]); + if((u32*)D_8037E650[i] != NULL){ + free((void *)D_8037E650[i]); D_8037E650[i] = NULL; } } @@ -37,7 +37,7 @@ void mapSavestate_defrag_all(void){ int i; for(i = 0; i < 0x9A; i++){ if(D_8037E650[i]){ - D_8037E650[i] = (MapSavestate *)defrag(D_8037E650[i]); + D_8037E650[i] = defrag(D_8037E650[i]); } } } @@ -91,22 +91,30 @@ void mapSavestate_save(enum map_e map){ } #endif -//mapSavestate_apply -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_5BEB0/mapSavestate_apply.s") -// void mapSavestate_apply(enum map_e map){ -// u32 **mssp = D_8037E650 + map; -// int s0; -// int val; -// u8 *tmp; -// if(*mssp){ -// mapSpecificFlags_setAll(**mssp); -// func_80308230(1); -// func_803083B0(-1); -// for(s0 = 0x20; func_803083B0((((*mssp)[s0 >> 5]) & (1 << (s0 & 0x1f)))? 1 : 0) != -1; s0++); -// func_80308230(0); -// tmp = *mssp; -// func_8032A09C(tmp, (tmp + 0x10*((s0 + 0x7f) >> 7))); -// free(*mssp); -// *mssp = NULL; -// } -// } +#define AS_BOOL(expr) ((expr)? TRUE : FALSE) + +void mapSavestate_apply(enum map_e map_id) { + s32 var_s0 = 0x1F; + u32* t; + u32 aligned_index; + + if(D_8037E650[map_id] == NULL) + return; + + t = reinterpret_cast(u32*, D_8037E650[map_id]); + mapSpecificFlags_setAll(*t); + var_s0++; + func_80308230(1); + func_803083B0(-1); + + while (func_803083B0( AS_BOOL(((u32*)D_8037E650[map_id])[var_s0 >> 5] & (1 << (var_s0 & 0x1f)))) != -1) { + var_s0++; + } + func_80308230(0); + + aligned_index = ((var_s0 + ((1 << 7) - 1)) >> 7); + func_8032A09C(D_8037E650[map_id], (ActorListSaveState *)D_8037E650[map_id] + (aligned_index << 2)); + free((void *)D_8037E650[map_id] ); + D_8037E650[map_id] = NULL; +} + diff --git a/src/core2/code_9E370.c b/src/core2/code_9E370.c index cc17b814..e800f420 100644 --- a/src/core2/code_9E370.c +++ b/src/core2/code_9E370.c @@ -1769,10 +1769,7 @@ void *actors_appendToSavestate(void * begin, u32 end){ return sp3C; } -typedef struct { - u32 cnt; - Actor *actor_save_state[]; -}ActorListSaveState; + void func_8032A09C(s32 arg0, ActorListSaveState *arg1) { Actor **temp_v1; From 861e460347a1ddaec8b9a841ab567de30cc59c6b Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Sun, 5 May 2024 17:38:30 -0500 Subject: [PATCH 04/38] func_80341D5C --- README.md | 2 +- progress/progress_core2.svg | 4 +-- progress/progress_total.svg | 4 +-- src/core2/code_5BEB0.c | 29 ++++++++++------- src/core2/code_B9770.c | 65 ++++++++++++++++++------------------- 5 files changed, 54 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index 89f0487b..c1d81df7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (98.9690%) +# banjo (98.9919%) diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index 4b9e4c90..1756c95e 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -17,7 +17,7 @@ core2 - 98.4207% - 98.4207% + 98.4605% + 98.4605% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index a4567662..6888b26e 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 98.9690% - 98.9690% + 98.9919% + 98.9919% \ No newline at end of file diff --git a/src/core2/code_5BEB0.c b/src/core2/code_5BEB0.c index 6909f77d..46e756a3 100644 --- a/src/core2/code_5BEB0.c +++ b/src/core2/code_5BEB0.c @@ -94,27 +94,32 @@ void mapSavestate_save(enum map_e map){ #define AS_BOOL(expr) ((expr)? TRUE : FALSE) void mapSavestate_apply(enum map_e map_id) { - s32 var_s0 = 0x1F; - u32* t; - u32 aligned_index; + s32 iBit = 0; + u32* flag_ptr; + u32* word_ptr; + ActorListSaveState *actor_list_ptr; + u32 bit_value; if(D_8037E650[map_id] == NULL) return; - t = reinterpret_cast(u32*, D_8037E650[map_id]); - mapSpecificFlags_setAll(*t); - var_s0++; + flag_ptr = reinterpret_cast(u32*, D_8037E650[map_id]); + mapSpecificFlags_setAll(*flag_ptr); + iBit += 8 * sizeof(u32); func_80308230(1); func_803083B0(-1); - - while (func_803083B0( AS_BOOL(((u32*)D_8037E650[map_id])[var_s0 >> 5] & (1 << (var_s0 & 0x1f)))) != -1) { - var_s0++; + + while ( + bit_value = AS_BOOL((((u32*)D_8037E650[map_id])[iBit >> 5] & (1 << (iBit & 0x1f)))), + func_803083B0(bit_value) != -1 + ) { + iBit++; } func_80308230(0); - aligned_index = ((var_s0 + ((1 << 7) - 1)) >> 7); - func_8032A09C(D_8037E650[map_id], (ActorListSaveState *)D_8037E650[map_id] + (aligned_index << 2)); - free((void *)D_8037E650[map_id] ); + actor_list_ptr = (ActorListSaveState *)D_8037E650[map_id] + (((iBit + (0x80 - 1)) >> 7) * 4); + func_8032A09C(D_8037E650[map_id], actor_list_ptr); + free((void*)D_8037E650[map_id] ); D_8037E650[map_id] = NULL; } diff --git a/src/core2/code_B9770.c b/src/core2/code_B9770.c index de44c69d..7d550971 100644 --- a/src/core2/code_B9770.c +++ b/src/core2/code_B9770.c @@ -495,41 +495,40 @@ s32 func_80341C78(s32 arg0[3]) { return -1; } -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B9770/func_80341D5C.s") -#else -s32 func_80341D5C(s32 arg0[3], s32 arg1[3]){ - int i, j; - struct56s *a0; - f32 (*a2)[3]; - f32 spC[3]; - f32 sp0[3]; - - spC[0] = (f32)arg0[0]; - spC[1] = (f32)arg0[1]; - spC[2] = (f32)arg0[2]; - - sp0[0] = (f32)arg1[0]; - sp0[1] = (f32)arg1[1]; - sp0[2] = (f32)arg1[2]; - - for(i = 0; i < D_80371E78; i++){ - a2 = D_80371E70[i]->unk8; - for(j = 0; j < D_80371E70[i]->unk0; j++){ - if( spC[0] == a2[j][0] - && spC[1] == a2[j][1] - && spC[2] == a2[j][2] - && sp0[0] == a2[j +1][0] - && sp0[1] == a2[j +1][1] - && sp0[2] == a2[j +1][2] - ){ - return i; - } - } +s32 func_80341D5C(s32 arg0[3], s32 arg1[3]) +{ + int i; + int j; + struct56s *a0; + f32 (*a2)[3]; + f32 spC[3]; + f32 sp0[3]; + struct56s *new_var; + spC[0] = (f32) arg0[0]; + spC[1] = (f32) arg0[1]; + spC[2] = (f32) arg0[2]; + sp0[0] = (f32) arg1[0]; + sp0[1] = (f32) arg1[1]; + sp0[2] = (f32) arg1[2]; + for (i = 0; i < D_80371E78; i++) + { + a2 = a0 + 1; + new_var = D_80371E70[i]; + a0 = new_var; + a2 = a0 + 1; + for (j = 0; j < new_var->unk0; j++) + { + if (((spC[0] == a2[j][0]) && (spC[1] == a2[j][1]) && (spC[2] == a2[j][2])) \ + && ((sp0[0] == a2[j + 1][0]) && (sp0[1] == a2[j + 1][1]) && (sp0[2] == a2[j + 1][2]))) + { + return i; + } } - return -1; + + } + + return -1; } -#endif s32 func_80341EC4(f32 arg0[3]){ s32 sp1C[3]; From dee99f4207581a8c3bbf224e95a91bba74f3bb6f Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Mon, 6 May 2024 20:35:27 -0500 Subject: [PATCH 05/38] mapSavestate_save --- README.md | 2 +- progress/progress_core2.svg | 4 +- progress/progress_total.svg | 6 +-- src/core2/code_5BEB0.c | 87 +++++++++++++++++-------------------- src/core2/code_A5BC0.c | 4 +- 5 files changed, 48 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index c1d81df7..b2c32311 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (98.9919%) +# banjo (99.0163%) diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index 1756c95e..c1986b63 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -17,7 +17,7 @@ core2 - 98.4605% - 98.4605% + 98.5031% + 98.5031% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 6888b26e..ca4900c6 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 98.9919% - 98.9919% + 99.0163% + 99.0163% \ No newline at end of file diff --git a/src/core2/code_5BEB0.c b/src/core2/code_5BEB0.c index 46e756a3..cbc35ade 100644 --- a/src/core2/code_5BEB0.c +++ b/src/core2/code_5BEB0.c @@ -42,54 +42,47 @@ void mapSavestate_defrag_all(void){ } } -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_5BEB0/mapSavestate_save.s") -#else -void mapSavestate_save(enum map_e map){ - u32 wSize; - MapSavestate * sp38; - s32 iBit; - s32 bit_max; - s32 reg_s4; - u32* reg_v1; - u32* valPtr; - s32 i; - - - wSize = 4; - if(D_8037E650[map]) - free(D_8037E650[map]); - - D_8037E650[map] = sp38 = (MapSavestate *) malloc(4*sizeof(u32)); - - sp38->flags = mapSpecificFlags_getAll(); - - iBit = 0x20; - func_80308230(1); - func_803083B0(-1); - - for(reg_s4 = func_803083B0(-2); reg_s4 != -1; reg_s4 = func_803083B0(-2, valPtr)){ - if( !(iBit < wSize*sizeof(u32)*8)){ - wSize += 4; - D_8037E650[map] = (MapSavestate *)realloc( D_8037E650[map], wSize*sizeof(u32)); - reg_v1 = ((s32)D_8037E650[map] + wSize*sizeof(u32)); - reg_v1[-1] = 0; - reg_v1[-2] = 0; - reg_v1[-3] = 0; - reg_v1[-4] = 0; - } - valPtr = D_8037E650[map]; - valPtr[(iBit >> 5)] = (reg_s4) - ? valPtr[(iBit >> 5)] | (1 << (iBit & 0x1f)) - : valPtr[(iBit >> 5)] & ~(1 << (iBit & 0x1f)); - - iBit++; - +void mapSavestate_save(enum map_e map) +{ + u32 wSize; + s32 iBit; + s32 reg_s4; + u32 *valPtr; + int new_var; + wSize = 4; + if (D_8037E650[map] != 0) + { + free(D_8037E650[map]); + } + D_8037E650[map] = (MapSavestate *) malloc(4 * (sizeof(u32))); + valPtr = (u32 *) D_8037E650[map]; + *valPtr = mapSpecificFlags_getAll(); + iBit = 0x20; + func_80308230(1); + func_803083B0(-1); + for (reg_s4 = func_803083B0(-2); reg_s4 != (-1); reg_s4 = func_803083B0(-2)) + { + new_var = sizeof(u32); + if (!(iBit < ((wSize * (sizeof(u32))) * 8))) + { + wSize += 4; + D_8037E650[map] = (MapSavestate *) realloc(D_8037E650[map], wSize * new_var); + valPtr = ((s32) D_8037E650[map]) + (wSize * new_var); + valPtr[-1] = 0; + new_var = 1; + valPtr[-2] = 0; + valPtr[-3] = 0; + if (1) if (1) if (1) if (1) if (1) if (1) if (1) ; + valPtr[-4] = 0; } - //if(sp38); - D_8037E650[map] = actors_appendToSavestate( D_8037E650[map], (s32)D_8037E650[map] + 16*((iBit + 0x7F) >> 7)); -} -#endif + valPtr = D_8037E650[map]; + valPtr[iBit >> 5] = (reg_s4) ? (valPtr[iBit >> 5] | (1 << (iBit & 0x1f))) : (valPtr[iBit >> 5] & (~((1 ^ 0) << (iBit & 0x1f)))); + iBit++; + wSize = wSize; + } + + D_8037E650[map] = actors_appendToSavestate(D_8037E650[map], ((u32 *) D_8037E650[map]) + (4 * ((iBit + 0x7F) >> 7))); +} #define AS_BOOL(expr) ((expr)? TRUE : FALSE) diff --git a/src/core2/code_A5BC0.c b/src/core2/code_A5BC0.c index c7601348..88f06271 100644 --- a/src/core2/code_A5BC0.c +++ b/src/core2/code_A5BC0.c @@ -467,11 +467,11 @@ void func_8032DB2C(Cube *cube, NodeProp *arg1) { } } -void func_8032DC70(void) { +void func_8032DC70(s32 arg0) { NodeProp *sp1C; s32 temp_v0; - sp1C = func_803080C8(); + sp1C = func_803080C8(arg0); if (sp1C != NULL) { func_8032DB2C(func_80308224(), sp1C); } From 531e6c97b4a7c7308bdaf64731010319bcdb0bf7 Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Tue, 7 May 2024 10:36:25 -0500 Subject: [PATCH 06/38] func_803603AC --- README.md | 2 +- progress/progress_core2.svg | 4 ++-- progress/progress_total.svg | 4 ++-- src/core2/code_D89E0.c | 37 +++++++++++++++++-------------------- 4 files changed, 22 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index b2c32311..9f4f9152 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (99.0163%) +# banjo (99.0364%) diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index c1986b63..d6610507 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -17,7 +17,7 @@ core2 - 98.5031% - 98.5031% + 98.5381% + 98.5381% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index ca4900c6..bb5ab1e6 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 99.0163% - 99.0163% + 99.0364% + 99.0364% \ No newline at end of file diff --git a/src/core2/code_D89E0.c b/src/core2/code_D89E0.c index e5fef42c..f49bf696 100644 --- a/src/core2/code_D89E0.c +++ b/src/core2/code_D89E0.c @@ -6,6 +6,9 @@ extern f32 func_80309724(f32[3]); extern f32 func_80257204(f32, f32, f32, f32); +#define SQ(x) ((x) * (x)) + + typedef struct { f32 unk0; f32 unk4; @@ -274,15 +277,11 @@ bool func_80360198(Actor *this) { return TRUE; } -#ifndef NONMATCHING -f32 func_803603AC(Actor *this, s32 arg1, u8 arg2); -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_D89E0/func_803603AC.s") -#else f32 func_803603AC(Actor *this, s32 arg1, u8 arg2){ - f32 num; - f32 den; f32 phi_f2; - f32 sp2C[3]; + f32 dy; + f32 D1, D2; + f32 unused; f32 sp20[3]; switch (arg2) { @@ -297,25 +296,23 @@ f32 func_803603AC(Actor *this, s32 arg1, u8 arg2){ break; } - sp2C[0] = (this->position[0] - sp20[0]); - sp2C[1] = (this->position[1] - sp20[1]); - sp2C[2] = (this->position[2] - sp20[2]); - - den =(sp2C[0]*sp2C[0] + sp2C[2]*sp2C[2]); - // if(den); - num = (sp2C[1] - arg1); - if(num == 0.0 || den == 0.0) + D1 = SQ(this->position[0] - sp20[0]); + D2 = SQ(this->position[2] - sp20[2]); + + dy = this->position[1] - sp20[1] - arg1; + + if(dy == 0.0 || D1 + D2 == 0.0) return 0.0f; + - phi_f2 = -(this->unk28*num)/den; + phi_f2 = -(this->unk28*(dy))/(D1 + D2); if (phi_f2 >= 4.0f) { - return 4.0f; + phi_f2 = 4.0f; + } else if (phi_f2 <= -4.0f) { + phi_f2 = -4.0f; } - if(-4.0f >= phi_f2) - phi_f2 = -4.0f; return phi_f2; } -#endif int func_803604E8(Actor *this){ f32 tmp_f0; From 038e4f1050c52110ad50346bd6281498f0360608 Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Wed, 8 May 2024 21:58:37 -0500 Subject: [PATCH 07/38] func_8024E7C8 matched --- README.md | 2 +- progress/progress_core1.svg | 12 +- progress/progress_total.svg | 4 +- src/core1/code_10A00.c | 216 +++++++++++++++++------------------- 4 files changed, 109 insertions(+), 125 deletions(-) diff --git a/README.md b/README.md index 9f4f9152..0cc737e6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (99.0364%) +# banjo (99.1612%) diff --git a/progress/progress_core1.svg b/progress/progress_core1.svg index 86e5696c..deb4a51c 100644 --- a/progress/progress_core1.svg +++ b/progress/progress_core1.svg @@ -1,23 +1,23 @@ - + - + - - + + core1 core1 - 99.1399% - 99.1399% + 100.0000% + 100.0000% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index bb5ab1e6..d401656e 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 99.0364% - 99.0364% + 99.1612% + 99.1612% \ No newline at end of file diff --git a/src/core1/code_10A00.c b/src/core1/code_10A00.c index 0d8dba25..74c2ef3c 100644 --- a/src/core1/code_10A00.c +++ b/src/core1/code_10A00.c @@ -26,10 +26,9 @@ typedef struct { typedef struct { s16 unk0; s16 unk2; - s16 unk4; - s16 unk6; - f32 unk8; - f32 unkC; + u16 unk4; + u16 unk6; + f32 unk8[2]; f32 joystick[2]; }Struct_core1_10A00_1; @@ -157,145 +156,130 @@ void func_8024E71C(s32 controller_index, f32 dst[2]){ } } -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core1/code_10A00/func_8024E7C8.s") -#else -void func_8024E7C8(void){ - s32 i, j; - s32 sp5C; +void func_8024E7C8(void) { + int j; + int i; + u32 sp5C; u32 s0; - s32 temp_t6; - u16 temp_v0_3; - - - - if(func_8023E000() == 3) + u32 temp_t6; + u32 temp_v0_3; + u32 var_a2; + if (func_8023E000() == 3) { func_802E4384(); - - osSetThreadPri(NULL, 0x29); + } + osSetThreadPri(0, 0x29); D_802812D0.stick_x = pfsManagerContPadData[0].stick_x; D_802812D0.stick_y = pfsManagerContPadData[0].stick_y; D_802812D0.button = pfsManagerContPadData[0].button; - if( getGameMode() == GAME_MODE_6_FILE_PLAYBACK - || getGameMode() == GAME_MODE_7_ATTRACT_DEMO - || getGameMode() == GAME_MODE_8_BOTTLES_BONUS - || getGameMode() == GAME_MODE_A_SNS_PICTURE - || getGameMode() == GAME_MODE_9_BANJO_AND_KAZOOIE - ){ - s0 = START_BUTTON; - if(gctransition_8030BD98()){ + if ((getGameMode() == GAME_MODE_6_FILE_PLAYBACK) + || (getGameMode() == GAME_MODE_7_ATTRACT_DEMO) + || (getGameMode() == GAME_MODE_8_BOTTLES_BONUS) + || (getGameMode() == GAME_MODE_A_SNS_PICTURE) + || (getGameMode() == GAME_MODE_9_BANJO_AND_KAZOOIE) + ) { + s0 = 0x1000; + if (gctransition_8030BD98()) { D_802816E0 += time_getDelta(); } - if(D_802816E0 < 1.0 || getGameMode() == GAME_MODE_9_BANJO_AND_KAZOOIE){ + if ((D_802816E0 < 1.0) || (getGameMode() == GAME_MODE_9_BANJO_AND_KAZOOIE)) { s0 = 0; } temp_t6 = demo_readInput(&pfsManagerContPadData, &sp5C) == 0; - if(D_802812D0.button & s0 || temp_t6){ - if(D_802812D0.button & s0){ + if ((D_802812D0.button & s0) || temp_t6) { + if (D_802812D0.button & s0) { func_803204E4(0x64, 1); - } - else{ + } else { func_803204E4(0x63, 1); } - }//L8024E944 + } func_8033DD04(sp5C); - - }//L8024E94C + } sp5C = func_8033DD90(); - - randf(); -// var_s0_2 = &D_80281250; -// var_s1 = &pfsManagerContPadData - for(i = 0; i < 4; i++){ -// temp_t5 = var_s1->unk0; -// temp_t1 = temp_t5 & 0x20; + for (i = 0; i < 4; i++) { if ((pfsManagerContPadData[i].button & 0x20) && (pfsManagerContPadData[i].button & 0x10)) { - D_802810E0[i][0] = (pfsManagerContPadData[i].button & 0x0004) ? D_802810E0[i][0] + 1 : 0; - D_802810E0[i][1] = (pfsManagerContPadData[i].button & 0x2000) ? D_802810E0[i][1] + 1 : 0; - D_802810E0[i][2] = (pfsManagerContPadData[i].button & 0x8000) ? D_802810E0[i][2] + 1 : 0; - D_802810E0[i][3] = (pfsManagerContPadData[i].button & 0x4000) ? D_802810E0[i][3] + 1 : 0; - D_802810E0[i][4] = (D_802812D0.button & 0x4000) ? D_802810E0[i][4] + 1 : 0; - for(j = 0; j < 0xE; j++){ - ((s32*)&D_80281138[i])[j] = 0; + D_802810E0[i][0] = (pfsManagerContPadData[i].button & 0x0004) ? (D_802810E0[i][0] + 1) : (0); + D_802810E0[i][1] = (pfsManagerContPadData[i].button & 0x2000) ? (D_802810E0[i][1] + 1) : (0); + D_802810E0[i][2] = (pfsManagerContPadData[i].button & 0x8000) ? (D_802810E0[i][2] + 1) : (0); + D_802810E0[i][3] = (pfsManagerContPadData[i].button & 0x4000) ? (D_802810E0[i][3] + 1) : (0); + D_802810E0[i][4] = (D_802812D0.button & 0x4000) ? (D_802810E0[i][4] + 1) : (0); + for (j = 0; j < 0xE; j++) + { + ((s32 *) (&D_80281138[i]))[j] = 0; } - for(j = 0; (j < 0xE) && (i == 0); j++){ - ((s32*)&D_80281218)[j] = 0; + + for (j = 0; (j < 0xE) && (i == 0); j++) + { + ((s32 *) (&D_80281218))[j] = 0; } + D_80281250[i].unk0 = 0; D_80281250[i].unk2 = 0; D_80281250[i].unk4 = 0; D_80281250[i].unk6 = 0; D_80281250[i].joystick[0] = 0.0f; D_80281250[i].joystick[1] = 0.0f; - D_80281250[i].unk8 = 0.0f; - D_80281250[i].unkC = 0.0f; - } else { -// temp_a0 = (i * 0x14) + &D_802810E0; -// temp_a1 = (i * 0x38) + &D_80281138; -// temp_t4 = (i * 4) + &D_80281308; - - for(j = 0; j < 5; j++){ - D_802810E0[i][j] = 0; - } - - D_80281138[i].face_button[0] = (pfsManagerContPadData[i].button & 0x8000) ? D_80281138[i].face_button[0] + 1 : 0; - D_80281138[i].face_button[1] = (pfsManagerContPadData[i].button & 0x4000) ? D_80281138[i].face_button[1] + 1 : 0; - D_80281138[i].face_button[2] = (pfsManagerContPadData[i].button & 0x0002) ? D_80281138[i].face_button[2] + 1 : 0; - D_80281138[i].face_button[3] = (pfsManagerContPadData[i].button & 0x0004) ? D_80281138[i].face_button[3] + 1 : 0; - D_80281138[i].face_button[4] = (pfsManagerContPadData[i].button & 0x0008) ? D_80281138[i].face_button[4] + 1 : 0; - D_80281138[i].face_button[5] = (pfsManagerContPadData[i].button & 0x0001) ? D_80281138[i].face_button[5] + 1 : 0; - - D_80281138[i].side_button[0] = (pfsManagerContPadData[i].button & 0x2000) ? D_80281138[i].side_button[0] + 1 : 0; - D_80281138[i].side_button[1] = (pfsManagerContPadData[i].button & 0x0020) ? D_80281138[i].side_button[1] + 1 : 0; - D_80281138[i].side_button[2] = (pfsManagerContPadData[i].button & 0x0010) ? D_80281138[i].side_button[2] + 1 : 0; - - D_80281138[i].unk24[0] = (pfsManagerContPadData[i].button & 0x0800) ? D_80281138[i].unk24[0] + 1 : 0; - D_80281138[i].unk24[1] = (pfsManagerContPadData[i].button & 0x0400) ? D_80281138[i].unk24[1] + 1 : 0; - D_80281138[i].unk24[2] = (pfsManagerContPadData[i].button & 0x0200) ? D_80281138[i].unk24[2] + 1 : 0; - D_80281138[i].unk24[3] = (pfsManagerContPadData[i].button & 0x0100) ? D_80281138[i].unk24[3] + 1 : 0; - D_80281138[i].start_button = (pfsManagerContPadData[i].button & 0x1000) ? D_80281138[i].start_button + 1 : 0; - - if(i == 0){ - D_80281218.face_button[0] = (D_802812D0.button & 0x8000) ? D_80281218.face_button[0] + 1 : 0; - D_80281218.face_button[1] = (D_802812D0.button & 0x4000) ? D_80281218.face_button[1] + 1 : 0; - D_80281218.face_button[2] = (D_802812D0.button & 0x0002) ? D_80281218.face_button[2] + 1 : 0; - D_80281218.face_button[3] = (D_802812D0.button & 0x0004) ? D_80281218.face_button[3] + 1 : 0; - D_80281218.face_button[4] = (D_802812D0.button & 0x0008) ? D_80281218.face_button[4] + 1 : 0; - D_80281218.face_button[5] = (D_802812D0.button & 0x0001) ? D_80281218.face_button[5] + 1 : 0; - - D_80281218.side_button[0] = (D_802812D0.button & 0x2000) ? D_80281218.side_button[0] + 1 : 0; - D_80281218.side_button[1] = (D_802812D0.button & 0x0020) ? D_80281218.side_button[1] + 1 : 0; - D_80281218.side_button[2] = (D_802812D0.button & 0x0010) ? D_80281218.side_button[2] + 1 : 0; - - D_80281218.unk24[0] = (D_802812D0.button & 0x0800) ? D_80281218.unk24[0] + 1 : 0; - D_80281218.unk24[1] = (D_802812D0.button & 0x0400) ? D_80281218.unk24[1] + 1 : 0; - D_80281218.unk24[2] = (D_802812D0.button & 0x0200) ? D_80281218.unk24[2] + 1 : 0; - D_80281218.unk24[3] = (D_802812D0.button & 0x0100) ? D_80281218.unk24[3] + 1 : 0; - D_80281218.start_button = (D_802812D0.button & 0x1000) ? D_80281218.start_button + 1 : 0; - } - - temp_v0_3 = D_80281250[i].unk0; - D_80281250[i].unk0 = D_802812D0.button; - D_80281250[i].unk4 = ~temp_v0_3 & D_802812D0.button; //pressed buttons - D_80281250[i].unk6 = ~D_802812D0.button & temp_v0_3; //unpressed buttons - D_80281250[i].unk2 = temp_v0_3; //previous buttons - D_80281250[i].unk8 = D_80281250[i].joystick[0]; - D_80281250[i].unkC = D_80281250[i].joystick[1]; - D_80281250[i].joystick[0] = func_8024E420(pfsManagerContPadData[i].stick_x, 7, 0x3B); - D_80281250[i].joystick[1] = func_8024E420(pfsManagerContPadData[i].stick_y, 7, 0x3D); - - D_80281308[i] = ((D_80281250[i].unk4 != 0) - || (D_80281250[i].unk8 != D_80281250[i].joystick[0]) - || (D_80281250[i].unkC != D_80281250[i].joystick[1]) - ) ? 0.0f : D_80281308[i] + time_getDelta(); - + D_80281250[i].unk8[0] = 0.0f; + D_80281250[i].unk8[1] = 0.0f; + continue; } + for (j = 0; j < 5; j++) { + D_802810E0[i][j] = 0; + } + + D_80281138[i].face_button[0] = (pfsManagerContPadData[i].button & 0x8000) ? (D_80281138[i].face_button[0] + 1) : (0); + D_80281138[i].face_button[1] = (pfsManagerContPadData[i].button & 0x4000) ? (D_80281138[i].face_button[1] + 1) : (0); + D_80281138[i].face_button[2] = (pfsManagerContPadData[i].button & 0x0002) ? (D_80281138[i].face_button[2] + 1) : (0); + D_80281138[i].face_button[3] = (pfsManagerContPadData[i].button & 0x0004) ? (D_80281138[i].face_button[3] + 1) : (0); + D_80281138[i].face_button[4] = (pfsManagerContPadData[i].button & 0x0008) ? (D_80281138[i].face_button[4] + 1) : (0); + D_80281138[i].face_button[5] = (pfsManagerContPadData[i].button & 0x0001) ? (D_80281138[i].face_button[5] + 1) : (0); + D_80281138[i].side_button[0] = (pfsManagerContPadData[i].button & 0x2000) ? (D_80281138[i].side_button[0] + 1) : (0); + D_80281138[i].side_button[1] = (pfsManagerContPadData[i].button & 0x0020) ? (D_80281138[i].side_button[1] + 1) : (0); + D_80281138[i].side_button[2] = (pfsManagerContPadData[i].button & 0x0010) ? (D_80281138[i].side_button[2] + 1) : (0); + D_80281138[i].unk24[0] = (pfsManagerContPadData[i].button & 0x0800) ? (D_80281138[i].unk24[0] + 1) : (0); + D_80281138[i].unk24[1] = (pfsManagerContPadData[i].button & 0x0400) ? (D_80281138[i].unk24[1] + 1) : (0); + D_80281138[i].unk24[2] = (pfsManagerContPadData[i].button & 0x0200) ? (D_80281138[i].unk24[2] + 1) : (0); + D_80281138[i].unk24[3] = (pfsManagerContPadData[i].button & 0x0100) ? (D_80281138[i].unk24[3] + 1) : (0); + D_80281138[i].start_button = (pfsManagerContPadData[i].button & 0x1000) ? (D_80281138[i].start_button + 1) : (0); + if (i == 0) { + D_80281218.face_button[0] = (D_802812D0.button & 0x8000) ? (D_80281218.face_button[0] + 1) : (0); + D_80281218.face_button[1] = (D_802812D0.button & 0x4000) ? (D_80281218.face_button[1] + 1) : (0); + D_80281218.face_button[2] = (D_802812D0.button & 0x0002) ? (D_80281218.face_button[2] + 1) : (0); + D_80281218.face_button[3] = (D_802812D0.button & 0x0004) ? (D_80281218.face_button[3] + 1) : (0); + D_80281218.face_button[4] = (D_802812D0.button & 0x0008) ? (D_80281218.face_button[4] + 1) : (0); + D_80281218.face_button[5] = (D_802812D0.button & 0x0001) ? (D_80281218.face_button[5] + 1) : (0); + D_80281218.side_button[0] = (D_802812D0.button & 0x2000) ? (D_80281218.side_button[0] + 1) : (0); + D_80281218.side_button[1] = (D_802812D0.button & 0x0020) ? (D_80281218.side_button[1] + 1) : (0); + D_80281218.side_button[2] = (D_802812D0.button & 0x0010) ? (D_80281218.side_button[2] + 1) : (0); + D_80281218.unk24[0] = (D_802812D0.button & 0x0800) ? (D_80281218.unk24[0] + 1) : (0); + D_80281218.unk24[1] = (D_802812D0.button & 0x0400) ? (D_80281218.unk24[1] + 1) : (0); + D_80281218.unk24[2] = (D_802812D0.button & 0x0200) ? (D_80281218.unk24[2] + 1) : (0); + D_80281218.unk24[3] = (D_802812D0.button & 0x0100) ? (D_80281218.unk24[3] + 1) : (0); + D_80281218.start_button = (D_802812D0.button & 0x1000) ? ((u64)D_80281218.start_button + 1) : (0); + } + temp_v0_3 = (u16)D_80281250[i].unk0; + var_a2 = (u16)pfsManagerContPadData[i].button; + D_80281250[i].unk0 = var_a2; + D_80281250[i].unk2 = temp_v0_3; + D_80281250[i].unk4 = (~temp_v0_3) & var_a2; + D_80281250[i].unk6 = temp_v0_3 & (~var_a2); + D_80281250[i].unk8[0] = D_80281250[i].joystick[0]; + D_80281250[i].unk8[1] = D_80281250[i].joystick[1]; + D_80281250[i].joystick[0] = func_8024E420(pfsManagerContPadData[i].stick_x, 7, 0x3B); + D_80281250[i].joystick[1] = func_8024E420(pfsManagerContPadData[i].stick_y, 7, 0x3D); + if ((D_80281250[i].unk4 != 0) + || (D_80281250[i].unk8[0] != D_80281250[i].joystick[0]) + || (D_80281250[i].unk8[1] != D_80281250[i].joystick[1]) + ) { + D_80281308[i] = 0.0f; + } else { + D_80281308[i] += time_getDelta(); + } } - osSetThreadPri(NULL, 0x14); + + osSetThreadPri(0, 0x14); } -#endif void pfsManager_readData(){ func_8024F35C(0); @@ -364,8 +348,8 @@ void func_8024F224(void){ D_80281250[iCont].unk6 = 0; D_80281250[iCont].joystick[0] = 0.0f; D_80281250[iCont].joystick[1] = 0.0f; - D_80281250[iCont].unk8 = 0.0f; - D_80281250[iCont].unkC = 0.0f; + D_80281250[iCont].unk8[0] = 0.0f; + D_80281250[iCont].unk8[1] = 0.0f; for(j = 0; j < 5; j++){ D_802810E0[iCont][j] = 0; } From 8fe5c3b4d119e9b76a33f20e0da6a37781d61e6b Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Wed, 8 May 2024 22:08:18 -0500 Subject: [PATCH 08/38] Document pfsManager_update --- src/core1/code_0.c | 2 +- src/core1/code_10A00.c | 4 ++-- src/core2/code_5C870.c | 2 +- src/core2/code_E910.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core1/code_0.c b/src/core1/code_0.c index e9788141..809965f9 100644 --- a/src/core1/code_0.c +++ b/src/core1/code_0.c @@ -144,7 +144,7 @@ void mainLoop(void){ func_8023DCDC(); if(!D_8027BEEC) - func_8024E7C8(); + pfsManager_update(); D_8027BEEC = 0; rumbleManager_80250C08(); diff --git a/src/core1/code_10A00.c b/src/core1/code_10A00.c index 74c2ef3c..1df1a4e6 100644 --- a/src/core1/code_10A00.c +++ b/src/core1/code_10A00.c @@ -156,7 +156,7 @@ void func_8024E71C(s32 controller_index, f32 dst[2]){ } } -void func_8024E7C8(void) { +void pfsManager_update(void) { int j; int i; u32 sp5C; @@ -335,7 +335,7 @@ void pfsManager_getStartReadData(void){ void func_8024F1F0(void){ osRecvMesg(&pfsManagerContPollingMsqQ, NULL, 1); - func_8024E7C8(); + pfsManager_update(); } void func_8024F224(void){ diff --git a/src/core2/code_5C870.c b/src/core2/code_5C870.c index 15b277c3..ad41b168 100644 --- a/src/core2/code_5C870.c +++ b/src/core2/code_5C870.c @@ -244,7 +244,7 @@ void func_802E3BF8(enum game_mode_e next_mode, s32 arg1){ else if(next_mode == GAME_MODE_4_PAUSED){//L802E3E24 func_80335110(0); FUNC_8030E624(SFX_C9_PAUSEMENU_ENTER, 1.1f, 32750); - func_8024E7C8(); + pfsManager_update(); func_8025A430(0, 2000, 3); func_8025A23C(COMUSIC_6F_PAUSE_SCREEN); gcpausemenu_init(); diff --git a/src/core2/code_E910.c b/src/core2/code_E910.c index 822fcf71..854ac1c8 100644 --- a/src/core2/code_E910.c +++ b/src/core2/code_E910.c @@ -280,7 +280,7 @@ void func_80295C14(void){ func_80298A84(); stateTimer_update(); func_8029E100(); - func_8024E7C8();//controller_update + pfsManager_update();//controller_update func_8023E06C(); func_80295448(); func_8029B174(); From 092de6aae319ee7f0b724d05a14b9ad047ce3cd3 Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Sun, 16 Jun 2024 22:36:36 -0500 Subject: [PATCH 09/38] documentation: core2/ba/physics --- decompressed.us.v10.yaml | 8 +- include/actor.h | 33 +++ include/animation.h | 7 +- include/core1/mem.h | 15 +- include/core2/ba/physics.h | 53 ++++ include/core2/yaw.h | 2 +- include/functions.h | 35 +-- src/BGS/ch/croctus.c | 14 +- src/BGS/ch/leafboat.c | 8 +- src/BGS/ch/mudhut.c | 4 +- src/BGS/ch/pinkegg.c | 4 +- src/BGS/ch/tanktup.c | 8 +- src/BGS/code_8DF0.c | 59 ++-- src/BGS/code_9750.c | 2 +- src/CC/code_19B0.c | 43 +-- src/CCW/code_2B00.c | 10 +- src/CCW/code_7BF0.c | 4 +- src/CCW/code_8050.c | 2 +- src/FP/ch/bearcub.c | 4 +- src/FP/ch/boggy1.c | 8 +- src/FP/ch/boggy2.c | 34 +-- src/FP/ch/racesled.c | 2 +- src/FP/ch/scarfsled.c | 2 +- src/FP/ch/snowmanbutton.c | 4 +- src/FP/ch/twinkly.c | 10 +- src/FP/ch/twinklybox.c | 16 +- src/FP/ch/twinklymuncher.c | 14 +- src/FP/ch/wozza.c | 26 +- src/FP/ch/wozzasjig.c | 2 +- src/FP/ch/xmastree.c | 10 +- src/FP/ch/xmastreestar.c | 6 +- src/FP/ch/xmastreeswitch.c | 8 +- src/FP/code_19E0.c | 4 +- src/FP/code_1FF0.c | 4 +- src/GV/ch/ancientone.c | 6 +- src/GV/ch/histup.c | 14 +- src/GV/ch/sarcophagus.c | 16 +- src/GV/ch/toots.c | 6 +- src/GV/code_3630.c | 12 +- src/GV/code_3D90.c | 8 +- src/GV/code_4740.c | 20 +- src/GV/code_5570.c | 14 +- src/GV/code_61E0.c | 4 +- src/GV/code_7060.c | 10 +- src/GV/code_7DB0.c | 4 +- src/GV/code_7FF0.c | 20 +- src/MM/ch/chimpystump.c | 4 +- src/MM/ch/conga.c | 32 +-- src/MM/ch/grublin.c | 4 +- src/MM/ch/hut.c | 4 +- src/MM/ch/lmonkey.c | 10 +- src/MM/code_24C0.c | 19 +- src/MMM/ch/loggo.c | 4 +- src/MMM/code_2040.c | 12 +- src/MMM/code_2F60.c | 4 +- src/MMM/code_DC0.c | 2 +- src/SM/ch/attacktutorial.c | 2 +- src/SM/ch/vegetables.c | 8 +- src/SM/code_2990.c | 8 +- src/SM/code_3FC0.c | 2 +- src/SM/code_4070.c | 2 +- src/SM/code_5B0.c | 2 +- src/SM/code_BF0.c | 2 +- src/TTC/ch/blubber.c | 16 +- src/TTC/ch/clam.c | 6 +- src/TTC/ch/leaky.c | 2 +- src/TTC/ch/lockup.c | 10 +- src/TTC/ch/nipper.c | 16 +- src/TTC/ch/treasure.c | 2 +- src/core1/code_1D5D0.c | 8 +- src/core1/code_EAF0.c | 8 +- src/core1/memory.c | 38 ++- src/core2/ba/anim.c | 6 +- src/core2/ba/marker.c | 7 +- src/core2/ba/model.c | 3 +- src/core2/ba/physics.c | 432 +++++++++++++++++++++++++++++ src/core2/bs/ant.c | 69 ++--- src/core2/bs/bBarge.c | 30 +- src/core2/bs/bEggAss.c | 8 +- src/core2/bs/bEggHead.c | 8 +- src/core2/bs/bFlap.c | 31 ++- src/core2/bs/bFlip.c | 37 +-- src/core2/bs/bFly.c | 111 ++++---- src/core2/bs/bLongLeg.c | 53 ++-- src/core2/bs/bPeck.c | 14 +- src/core2/bs/bShock.c | 34 +-- src/core2/bs/bSwim.c | 66 ++--- src/core2/bs/bTrot.c | 101 +++---- src/core2/bs/bWhirl.c | 40 +-- src/core2/bs/bbuster.c | 38 +-- src/core2/bs/beeFly.c | 54 ++-- src/core2/bs/beeMain.c | 83 +++--- src/core2/bs/carry.c | 13 +- src/core2/bs/claw.c | 10 +- src/core2/bs/climb.c | 19 +- src/core2/bs/croc.c | 83 +++--- src/core2/bs/crouch.c | 9 +- src/core2/bs/die.c | 19 +- src/core2/bs/droneenter.c | 4 +- src/core2/bs/dronegoto.c | 17 +- src/core2/bs/dronelook.c | 11 +- src/core2/bs/dronevanish.c | 4 +- src/core2/bs/dronexform.c | 15 +- src/core2/bs/jig.c | 10 +- src/core2/bs/jump.c | 61 ++-- src/core2/bs/ow.c | 6 +- src/core2/bs/pumpkin.c | 77 ++--- src/core2/bs/rebound.c | 35 +-- src/core2/bs/rest.c | 5 +- src/core2/bs/sled.c | 6 +- src/core2/bs/slide.c | 16 +- src/core2/bs/splat.c | 8 +- src/core2/bs/stand.c | 9 +- src/core2/bs/surf.c | 6 +- src/core2/bs/swim.c | 23 +- src/core2/bs/talk.c | 5 +- src/core2/bs/throw.c | 7 +- src/core2/bs/timeout.c | 9 +- src/core2/bs/turn.c | 17 +- src/core2/bs/twirl.c | 14 +- src/core2/bs/walk.c | 51 ++-- src/core2/bs/walrus.c | 110 ++++---- src/core2/bs/washy.c | 8 +- src/core2/ch/beehive.c | 2 +- src/core2/ch/bigbutt.c | 40 +-- src/core2/ch/bottlesbonus.c | 74 ++--- src/core2/ch/bottlesbonuscursor.c | 85 +++--- src/core2/ch/climbBase.c | 2 +- src/core2/ch/collectible.c | 2 +- src/core2/ch/crab.c | 28 +- src/core2/ch/gameSelect.c | 14 +- src/core2/ch/ghost.c | 22 +- src/core2/ch/gloop.c | 4 +- src/core2/ch/gravestone.c | 14 +- src/core2/ch/icecube.c | 10 +- src/core2/ch/jiggy.c | 2 +- src/core2/ch/jigsawdance.c | 8 +- src/core2/ch/jinjo.c | 18 +- src/core2/ch/mole.c | 16 +- src/core2/ch/molehill.c | 4 +- src/core2/ch/overlaynocontroller.c | 16 +- src/core2/ch/overlaypressstart.c | 6 +- src/core2/ch/shrapnel.c | 6 +- src/core2/ch/snowball.c | 2 +- src/core2/ch/snowman.c | 8 +- src/core2/ch/snowmanhat.c | 2 +- src/core2/ch/termite.c | 8 +- src/core2/ch/trainers.c | 10 +- src/core2/ch/wadingboots.c | 10 +- src/core2/code_13A00.c | 3 +- src/core2/code_14420.c | 13 +- src/core2/code_1550.c | 93 ++++--- src/core2/code_33C30.c | 10 +- src/core2/code_379B0.c | 6 +- src/core2/code_39D0.c | 8 +- src/core2/code_47BD0.c | 22 +- src/core2/code_4A6F0.c | 36 +-- src/core2/code_4C020.c | 24 +- src/core2/code_509D0.c | 8 +- src/core2/code_53C10.c | 34 +-- src/core2/code_57C70.c | 8 +- src/core2/code_59D40.c | 18 +- src/core2/code_654C0.c | 2 +- src/core2/code_6B030.c | 4 +- src/core2/code_6B30.c | 5 +- src/core2/code_7060.c | 5 +- src/core2/code_72060.c | 2 +- src/core2/code_7AF80.c | 43 ++- src/core2/code_851D0.c | 2 +- src/core2/code_935F0.c | 2 +- src/core2/code_9E370.c | 149 +++++----- src/core2/code_A960.c | 3 +- src/core2/code_AD0.c | 2 +- src/core2/code_AD5B0.c | 2 +- src/core2/code_B850.c | 8 +- src/core2/code_BEF20.c | 4 +- src/core2/code_C0E60.c | 40 +-- src/core2/code_C4320.c | 2 +- src/core2/code_C4B0.c | 12 +- src/core2/code_D5FD0.c | 2 +- src/core2/code_D6600.c | 32 +-- src/core2/code_D89E0.c | 16 +- src/core2/code_D9B0.c | 6 +- src/core2/code_E910.c | 5 +- src/core2/code_EE40.c | 3 +- src/core2/code_EF50.c | 6 +- src/core2/code_FD60.c | 432 ----------------------------- src/core2/fx/airscore.c | 103 +++---- src/core2/fx/common2score.c | 16 +- src/core2/spawnqueue.c | 1 + src/cutscenes/code_6730.c | 2 +- src/cutscenes/code_6C90.c | 2 +- src/fight/chbossjinjo.c | 12 +- src/fight/chbossjinjobase.c | 4 +- src/fight/chfinalboss.c | 24 +- src/fight/chjinjonator.c | 24 +- src/fight/chjinjonatorbase.c | 4 +- src/fight/chspellfireball.c | 2 +- src/fight/chstonejinjo.c | 6 +- src/lair/ch/brentilda.c | 10 +- src/lair/ch/cauldron.c | 8 +- src/lair/code_0.c | 28 +- src/lair/code_86F0.c | 2 +- src/lair/code_A4A0.c | 2 +- src/lair/code_A810.c | 2 +- src/lair/code_AD70.c | 2 +- src/lair/code_BBD0.c | 20 +- src/lair/code_C1C0.c | 8 +- 208 files changed, 2342 insertions(+), 2163 deletions(-) create mode 100644 include/actor.h create mode 100644 include/core2/ba/physics.h create mode 100644 src/core2/ba/physics.c delete mode 100644 src/core2/code_FD60.c diff --git a/decompressed.us.v10.yaml b/decompressed.us.v10.yaml index ec476ca7..a80a139d 100644 --- a/decompressed.us.v10.yaml +++ b/decompressed.us.v10.yaml @@ -537,7 +537,7 @@ segments: - [0xF64270, c, code_E910] #DONE - [0xF647A0, c, code_EE40] #DONE - [0xF648B0, c, code_EF50] #DONE - - [0xF656C0, c, code_FD60] #DONE + - [0xF656C0, c, ba/physics] #DONE - [0xF66630, c, code_10CD0] #DONE - [0xF66700, c, pitch] #DONE - [0xF669A0, c, code_11040] #DONE @@ -906,7 +906,7 @@ segments: - [0x1032170, .data, eggshatter] - [0x10321C0, .data, code_C0E0] - [0x10321F0, .data, code_E910] - - [0x1032E10, .data, code_FD60] + - [0x1032E10, .data, ba/physics] - [0x1032E20, .data, code_117D0] - [0x1032F30, .data, code_126C0] - [0x1032F50, .data, code_12F30] @@ -1136,7 +1136,7 @@ segments: - [0x1043170, .rodata, code_D9B0] - [0x1043180, .rodata, code_E680] - [0x10431B0, .rodata, code_EF50] - - [0x1043350, .rodata, code_FD60] + - [0x1043350, .rodata, ba/physics] - [0x10433B0, .rodata, code_10CD0] - [0x10433C0, .rodata, pitch] - [0x10433F0, .rodata, code_11040] @@ -1399,7 +1399,7 @@ segments: - [0x1048560, .bss, code_E910] - [0x1048560, .bss, code_EE40] - [0x1048560, .bss, code_EF50] - - [0x1048560, .bss, code_FD60] + - [0x1048560, .bss, ba/physics] - [0x1048560, .bss, code_10CD0] - [0x1048560, .bss, pitch] - [0x1048560, .bss, code_11040] diff --git a/include/actor.h b/include/actor.h new file mode 100644 index 00000000..b805b435 --- /dev/null +++ b/include/actor.h @@ -0,0 +1,33 @@ +#ifndef ACTOR_H +#define ACTOR_H + +#define ACTOR_FLAG_NONE (0) +#define ACTOR_FLAG_UNKNOWN_0 (1 << 0) // 0x1 +#define ACTOR_FLAG_UNKNOWN_1 (1 << 1) // 0x2 +#define ACTOR_FLAG_UNKNOWN_2 (1 << 2) // 0x4 +#define ACTOR_FLAG_UNKNOWN_3 (1 << 3) // 0x8 +#define ACTOR_FLAG_UNKNOWN_4 (1 << 4) // 0x10 +#define ACTOR_FLAG_UNKNOWN_5 (1 << 5) // 0x20 +#define ACTOR_FLAG_UNKNOWN_6 (1 << 6) // 0x40 +#define ACTOR_FLAG_UNKNOWN_7 (1 << 7) // 0x80 +#define ACTOR_FLAG_UNKNOWN_8 (1 << 8) // 0x100 +#define ACTOR_FLAG_UNKNOWN_9 (1 << 9) // 0x200 +#define ACTOR_FLAG_UNKNOWN_10 (1 << 10) // 0x400 +#define ACTOR_FLAG_UNKNOWN_11 (1 << 11) // 0x800 +#define ACTOR_FLAG_UNKNOWN_12 (1 << 12) // 0x1000 +#define ACTOR_FLAG_UNKNOWN_13 (1 << 13) // 0x2000 +#define ACTOR_FLAG_UNKNOWN_14 (1 << 14) // 0x4000 +#define ACTOR_FLAG_UNKNOWN_15 (1 << 15) // 0x8000 +#define ACTOR_FLAG_UNKNOWN_16 (1 << 16) // 0x10000 +#define ACTOR_FLAG_UNKNOWN_17 (1 << 17) // 0x20000 +#define ACTOR_FLAG_UNKNOWN_18 (1 << 18) // 0x40000 +#define ACTOR_FLAG_UNKNOWN_19 (1 << 19) // 0x80000 +#define ACTOR_FLAG_UNKNOWN_20 (1 << 20) // 0x100000 +#define ACTOR_FLAG_UNKNOWN_21 (1 << 21) // 0x200000 +#define ACTOR_FLAG_UNKNOWN_22 (1 << 22) // 0x400000 +#define ACTOR_FLAG_UNKNOWN_23 (1 << 23) // 0x800000 +#define ACTOR_FLAG_UNKNOWN_24 (1 << 24) // 0x1000000 +#define ACTOR_FLAG_UNKNOWN_25 (1 << 25) // 0x2000000 +#define ACTOR_FLAG_UNKNOWN_26 (1 << 26) // 0x4000000 + +#endif // ACTOR_H diff --git a/include/animation.h b/include/animation.h index 7c0235e7..3ee0a63a 100644 --- a/include/animation.h +++ b/include/animation.h @@ -40,11 +40,6 @@ typedef struct animation_file_s{ u8 pad6[2]; } AnimationFile; -typedef struct animation_file_cache_s{ - AnimationFile *unk0; - u16 unk4_15:15; - u16 unk4_0:1; - u8 pad6[2]; -}AnimationFileCache; + #endif diff --git a/include/core1/mem.h b/include/core1/mem.h index 069133a4..029d7882 100644 --- a/include/core1/mem.h +++ b/include/core1/mem.h @@ -1,6 +1,19 @@ #ifndef __MEM_H__ #define __MEM_H__ +/** +* copy memory area +*/ void memcpy(void * dst, void *src, int size); -void func_80254630(void * dst, void *src, int size); //memcopy_fast + +/** +* copy an array of wide_characters +*/ +void wmemcpy(void * dst, void *src, int size); + + +/** + * copy memory area +*/ +void memmove(u8* dst, u8* src, s32 n); #endif diff --git a/include/core2/ba/physics.h b/include/core2/ba/physics.h new file mode 100644 index 00000000..23518022 --- /dev/null +++ b/include/core2/ba/physics.h @@ -0,0 +1,53 @@ +#ifndef __BA_PHYSICS_H__ +#define __BA_PHYSICS_H__ + +#include + +typedef enum ba_physics_type_e{ + BA_PHYSICS_NONE, + BA_PHYSICS_UNK1, + BA_PHYSICS_NORMAL, + BA_PHYSICS_LOCKED_ROTATION, + BA_PHYSICS_UNK4, + BA_PHYSICS_INVERTED_YAW, + BA_PHYSICS_AIRBORN, + BA_PHYSICS_FREEZE, + BA_PHYSICS_UNK8, + BA_PHYSICS_NO_GRAVITY, + BA_PHYSICS_CLIMB, + BA_PHYSICS_TRANSFORM, + BA_PHYSICS_GOTO, + BA_PHYSICS_END +}BaPhysicsType; + +void baphysics_get_position_change(f32 dst[3]); +void baphysics_init(void); +void baphysics_update(void); +void baphysics_reset_horizontal_velocity(void); +void baphysics_set_type(BaPhysicsType); +void baphysics_set_target_velocity(f32 src[3]); +void baphysics_set_target_horizontal_velocity(f32); +void baphysics_set_target_yaw(f32); +void baphysics_set_vertical_velocity(f32); +void baphysics_set_horizontal_velocity(f32, f32); +void baphysics_set_velocity(f32 src[3]); +f32 baphysics_get_gravity(void); +BaPhysicsType baphysics_get_type(void); +f32 baphysics_get_target_horizontal_velocity(void); +f32 baphysics_get_target_vertical_velocity(void); +f32 baphysics_get_target_yaw(void); +void baphysics_get_velocity(f32 dst[3]); +f32 baphysics_get_vertical_velocity(void); +f32 baphysics_get_horizontal_velocity(void); +f32 baphysics_get_horizontal_velocity_percentage(void); +void baphysics_reset(void); +void baphysics_set_acceleration(f32); +void baphysics_reset_gravity(void); +void baphysics_reset_terminal_velocity(void); +void baphysics_set_goto_duration(f32); +void baphysics_set_goto_position(f32 src[3]); +void baphysics_set_gravity(f32); +void baphysics_set_terminal_velocity(f32); +int baphysics_is_slower_than(f32); +int baphysics_goto_done(void); +#endif diff --git a/include/core2/yaw.h b/include/core2/yaw.h index 82015cab..ab1a616c 100644 --- a/include/core2/yaw.h +++ b/include/core2/yaw.h @@ -5,7 +5,7 @@ enum yaw_state_e{ YAW_STATE_0_NONE, YAW_STATE_1_DEFAULT, YAW_STATE_2_UNBOUNDED, - YAW_STATE_3_BOUNDED, + YAW_STATE_3_BOUNDED }; void yaw_init(void); diff --git a/include/functions.h b/include/functions.h index 468f7507..c51b59da 100644 --- a/include/functions.h +++ b/include/functions.h @@ -108,10 +108,6 @@ void pitch_setIdeal(f32); f32 pitch_get(void); f32 player_getYPosition(void); -void func_80297970(f32); - -f32 _get_vertVelocity(void); - void climbGetBottom(f32 dst[3]); void yaw_setIdeal(f32); @@ -155,7 +151,7 @@ void actor_collisionOff(Actor *); void *assetcache_get(enum asset_e assetId); -Actor *actor_new(s32 (*position)[3], s32 yaw, ActorInfo *actorInfo, u32 flags); +Actor *actor_new(s32 position[3], s32 yaw, ActorInfo *actorInfo, u32 flags); Actor *func_802C8A54(s32 position[3], s32 yaw, ActorInfo* actorInfo, u32 flags); Actor *func_802C8AA8(s32 position[3], s32 yaw, ActorInfo* actorInfo, u32 flags); Actor *func_802C8AF8(s32 position[3], s32 yaw, ActorInfo* actorInfo, u32 flags); @@ -209,7 +205,7 @@ void fxhealthscore_free(enum item_e, struct8s *); struct7s *fxairscore_new(s32); void fxairscore_update(enum item_e, struct7s *); void fxairscore_draw(enum item_e, struct8s *, Gfx**, Mtx**, Vtx **); -void fxairscore_free(s32, struct8s *); +void fxairscore_free(s32, struct7s *); @@ -252,9 +248,9 @@ void particleEmitter_setParticleVelocityRange(ParticleEmitter *, f32, f32, f32, void func_802EFF50(ParticleEmitter *, f32); void particleEmitter_setRGB(ParticleEmitter *this, s32 arg1[3]); void particleEmitter_setSpawnInterval(ParticleEmitter *, f32); - int func_8024DC04(f32, f32, f32); void func_8024E3A8(f32 [3], f32); +OSContPad *func_8024F3F4(void); OSMesgQueue *pfsManager_getFrameReplyQ(void); void ml_vec3f_clear(f32 dst[3]); @@ -322,20 +318,6 @@ void func_80294980(f32 arg0[3]); f32 get_slope_timer(void); f32 get_turbo_duration(void); void func_80295C08(void (* arg0)(void)); -void func_802978DC(int); -void func_80297970(f32); -void func_8029797C(f32); -void player_setYVelocity(f32); -void func_802979AC(f32, f32); -f32 func_80297A64(void); -f32 func_80297A70(void); -f32 func_80297A7C(void); -f32 _get_horzVelocity(void); -f32 func_80297AF0(void); -void gravity_set(f32); -void func_80297B64(f32); -void func_80297BF8(f32); -int func_80297C04(f32); void func_80297CCC(f32); f32 pitch_getIdeal(void); void pitch_setAngVel(f32, f32); @@ -455,11 +437,11 @@ void func_8032728C(f32[3], f32, s32, int(*)(Actor *)); Actor *func_8032813C(enum actor_e actor_id, f32 position[3], s32 yaw); int func_8032863C(AnimCtrl *, f32, f32); int func_80328A2C(Actor *, f32, s32, f32); -void func_80328A84(Actor *, u32); +void subaddie_set_state(Actor *, u32); ActorMarker *func_8032B16C(enum jiggy_e jiggy_id); -int func_80328B38(Actor *, s32, f32); -void func_80328B8C(Actor * this, s32 myAnimId, f32 arg2, s32 direction); -int func_80328BD4(Actor *, s32, f32, s32, f32 ); +int subaddie_maybe_set_state(Actor *, s32, f32); +void subaddie_set_state_with_direction(Actor * this, s32 myAnimId, f32 arg2, s32 direction); +int subaddie_maybe_set_state_position_direction(Actor *, s32, f32, s32, f32 ); void func_80328CEC(Actor *, s32, s32, s32); void func_80328FB0(Actor *, f32); int func_80329030(Actor *, s32); @@ -501,7 +483,6 @@ void func_80352CF4(f32 *, f32 *, f32, f32); AnimCtrl *baanim_getAnimCtrlPtr(void); -void _get_velocity(f32 dst[3]); void player_setYPosition(f32); NodeProp *func_80304C38(enum actor_e arg0, Actor *arg1); @@ -576,6 +557,6 @@ void ability_unlock(enum ability_e); extern void func_802EE278(Actor *, s32, s32, s32, f32, f32); extern void fxSparkle_chTreasure(s16[3]); extern void actor_collisionOn(Actor *); -extern void func_80328AC8(Actor *, s32); +extern void subaddie_set_state_forward(Actor *, s32); #endif diff --git a/src/BGS/ch/croctus.c b/src/BGS/ch/croctus.c index 238edf02..ca653add 100644 --- a/src/BGS/ch/croctus.c +++ b/src/BGS/ch/croctus.c @@ -92,7 +92,7 @@ void func_80387E68(ActorMarker *caller, enum asset_e text_id, s32 arg2){ timed_playSfx(1.4f, SFX_C9_PAUSEMENU_ENTER, 1.0f, 32000); func_80324CFC(0.4f, COMUSIC_43_ENTER_LEVEL_GLITTER, 22000); func_80324D2C(4.5f, COMUSIC_43_ENTER_LEVEL_GLITTER); - func_80328B8C(this, 5, 0.79f, 1); + subaddie_set_state_with_direction(this, 5, 0.79f, 1); func_80326310(this); bgs_D_803907B8[this->unkF4_8]->propPtr->unk8_4 = TRUE; timedFunc_set_1(1.1f, (GenFunction_1)func_80387E00, reinterpret_cast(s32, bgs_D_803907B8[this->unkF4_8])); @@ -144,13 +144,13 @@ void func_80387FD4(Actor *this){ if (this->unkF4_8 == 1) { func_8028F94C(2, this->position); func_80311480(0xC86, 0xE, this->position, this->marker, func_80387E68, NULL); - func_80328B8C(this, 6, 0.79f, 1); + subaddie_set_state_with_direction(this, 6, 0.79f, 1); } else { timed_playSfx(0.4f, SFX_C9_PAUSEMENU_ENTER, 1.0f, 32000); //0.4f timed_playSfx(1.4f, SFX_C9_PAUSEMENU_ENTER, 1.0f, 32000); //1.4f func_80324CFC(0.4f, COMUSIC_43_ENTER_LEVEL_GLITTER, 22000); func_80324D2C(4.5f, COMUSIC_43_ENTER_LEVEL_GLITTER); - func_80328B8C(this, 5, 0.79f, 1); + subaddie_set_state_with_direction(this, 5, 0.79f, 1); if (this->unkF4_8 == 5) { timedFunc_set_1(0.9f, (GenFunction_1) func_80387E40, (s32) this->marker); } else { @@ -172,7 +172,7 @@ void func_80387FD4(Actor *this){ case 1:// L80388370 this->unk60 += time_getDelta(); if(0.7 <= this->unk60){ - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); func_80387C90(this); this->unk60 = 0.0f; func_80324D54(0.1f, SFX_D0_GRIMLET_SQUEAK, 1.0f, 0x7530, this->position, 0.0f, 1800.0f); @@ -181,14 +181,14 @@ void func_80387FD4(Actor *this){ case 2:// L80388400 if(actor_animationIsAt(this, 0.62f)){ - func_80328B8C(this, 3, 0.62f, 1); + subaddie_set_state_with_direction(this, 3, 0.62f, 1); } break; case 3:// L80388434 this->unk60 += time_getDelta(); if( this->unk60 >= 0.13 + 0.7/4 * (5 - this->unkF4_8)){ - func_80328B8C(this, 4, 0.62f, 1); + subaddie_set_state_with_direction(this, 4, 0.62f, 1); func_80387C90(this); this->unk60 = 0.0f; func_80324D54(0.3f, 0x406, 1.0f, 0x55f0, this->position, 0.0f, 1800.0f); @@ -197,7 +197,7 @@ void func_80387FD4(Actor *this){ case 4:// L8038850C if(actor_animationIsAt(this, 0.0f)){ - func_80328B8C(this, 1, 0.0f, 1); + subaddie_set_state_with_direction(this, 1, 0.0f, 1); } break; diff --git a/src/BGS/ch/leafboat.c b/src/BGS/ch/leafboat.c index cda926a7..bb46af45 100644 --- a/src/BGS/ch/leafboat.c +++ b/src/BGS/ch/leafboat.c @@ -93,7 +93,7 @@ void func_8038FD9C(Actor *this){ this->unk1C[0] = 1.0f; this->alpha_124_19 = 0xff; if(this->unk54 != 0.0f){ - func_80328A84(this, 2); + subaddie_set_state(this, 2); } break; @@ -104,7 +104,7 @@ void func_8038FD9C(Actor *this){ this->marker->propPtr->unk8_3 = 1; this->unk1C[0] = 1.0f; if(15.0f <= this->velocity_x){ - func_80328A84(this, 3); + subaddie_set_state(this, 3); this->velocity_x = 0.0f; } else{ @@ -124,7 +124,7 @@ void func_8038FD9C(Actor *this){ this->unk1C[0] = 0.0f; this->alpha_124_19 = 0; if (this->unk54 == 0.0f) { - func_80328A84(this, 4); + subaddie_set_state(this, 4); } break; @@ -132,7 +132,7 @@ void func_8038FD9C(Actor *this){ this->marker->propPtr->unk8_3 = 1; this->unk1C[0] = 1.0f; if (this->velocity[0] >= 15.0f) { - func_80328A84(this, 1); + subaddie_set_state(this, 1); this->velocity[0] = 0.0f; } else { if(tmp[5-(((s32)this->velocity_x)%6)]) { diff --git a/src/BGS/ch/mudhut.c b/src/BGS/ch/mudhut.c index 775b603f..995c20db 100644 --- a/src/BGS/ch/mudhut.c +++ b/src/BGS/ch/mudhut.c @@ -9,7 +9,7 @@ extern f32 player_stateTimer_get(enum state_timer_e); void func_802C4218(u32,f32,f32,f32); -void func_80328A84(Actor *, u32); +void subaddie_set_state(Actor *, u32); /* local declarations */ Actor *chmudhut_draw(ActorMarker *this, Gfx** gdl, Mtx** mtx, Vtx **vtx); @@ -97,7 +97,7 @@ void chmudhut_update(Actor *this){ diffPos[1] += 130.0; FUNC_8030E8B4(SFX_5B_HEAVY_STUFF_FALLING, 1.0f, 28000, this->position, 0x12C, 0xBB8); - func_80328A84(this, 2); + subaddie_set_state(this, 2); this->marker->propPtr->unk8_3 = 0; actor_playAnimationOnce(this); if(tmp == 5){ diff --git a/src/BGS/ch/pinkegg.c b/src/BGS/ch/pinkegg.c index ff10853d..9e305c61 100644 --- a/src/BGS/ch/pinkegg.c +++ b/src/BGS/ch/pinkegg.c @@ -85,7 +85,7 @@ void chpinkegg_collision(ActorMarker *this, ActorMarker *other_marker){ thisActor = marker_getActor(this); this->propPtr->unk8_3 = 0; func_8030E510(SFX_AA_BGS_EGG_BREAKING_1, 28000); - func_80328A84(thisActor, 3); + subaddie_set_state(thisActor, 3); actor_playAnimationOnce(thisActor); this->collidable = 0; thisActor->unk124_6 = 0; @@ -108,7 +108,7 @@ void chpinkegg_update(Actor *this){ case 1: if(!((ActorLocal_PinkEgg *) &this->local)->unk4){ this->marker->collidable = 1; - func_80328A84(this,2); + subaddie_set_state(this,2); }else{ ((ActorLocal_PinkEgg *) &this->local)->unk4--; diff --git a/src/BGS/ch/tanktup.c b/src/BGS/ch/tanktup.c index 01eddaff..be84802e 100644 --- a/src/BGS/ch/tanktup.c +++ b/src/BGS/ch/tanktup.c @@ -47,7 +47,7 @@ void func_8038F470(ActorMarker *this, s32 arg1, enum chtanktup_leg_e leg_id){ sp18[1] += 50.0f; leg = func_8032813C(leg_id + ACTOR_E9_TANKTUP_LEG_FL, sp18, (s32)thisActor->yaw); - func_80328B8C(leg, arg1 + 1, 0, -1); + subaddie_set_state_with_direction(leg, arg1 + 1, 0, -1); leg->unk10_12 = leg_id; } @@ -148,7 +148,7 @@ void func_8038F6A4(Actor *this) } if (local->unk10) { - func_80328B8C(this, 2, 0.0f, -1); + subaddie_set_state_with_direction(this, 2, 0.0f, -1); local->unk10 = 0; sp44 = 0; if(&sp44); @@ -182,11 +182,11 @@ void func_8038F6A4(Actor *this) { if (!local->unk14) { - func_80328B8C(this, 1, 0.0f, -1); + subaddie_set_state_with_direction(this, 1, 0.0f, -1); } else { - func_80328B8C(this, 3, 0.0f, -1); + subaddie_set_state_with_direction(this, 3, 0.0f, -1); actor_playAnimationOnce(this); } } diff --git a/src/BGS/code_8DF0.c b/src/BGS/code_8DF0.c index 93cfee00..4ef56013 100644 --- a/src/BGS/code_8DF0.c +++ b/src/BGS/code_8DF0.c @@ -2,6 +2,7 @@ #include "functions.h" #include "variables.h" #include "prop.h" +#include "actor.h" extern ActorInfo D_80390804; extern ActorInfo D_80390690; @@ -34,35 +35,35 @@ extern ActorInfo D_80390BD8; extern ActorInfo D_80390BFC; void BGS_func_8038F1E0(void){//bgs_updateSpawnableActors - spawnableActorList_add(&D_80390804, actor_new, 0x00000088);//croctus - spawnableActorList_add(&D_80390690, actor_new, 0x020108A1); //flibbit - spawnableActorList_add(&D_803906F8, actor_new, 0x400); //pink_egg_largest - spawnableActorList_add(&D_8039071C, actor_new, 0x400); //pink_egg_large - spawnableActorList_add(&D_80390740, actor_new, 0x400); //pink_egg_medium - spawnableActorList_add(&D_80390764, actor_new, 0x400); //pink_egg_small - spawnableActorList_add(&D_80390788, actor_new, 0x400); //pink_egg_smallest - spawnableActorList_add(&D_80390B68, actor_new, 0); //mudhut_top - spawnableActorList_add(&D_80390C40, actor_new, 0x4000548);//tanktup - spawnableActorList_add(&D_80390C88, actor_new, 0x400042c);//tanktup_leg - spawnableActorList_add(&D_80390CC8, actor_new, 0x400042c);//tanktup_leg - spawnableActorList_add(&D_80390D08, actor_new, 0x400042c);//tanktup_leg - spawnableActorList_add(&D_80390D48, actor_new, 0x400042c);//tanktup_leg - spawnableActorList_add(&chFrogMinigame, actor_new, 0x81); - spawnableActorList_add(&BGS_D_80390AE0, actor_new, 0x20108a1); //yellow_flibbit - spawnableActorList_add(&D_80390960, actor_new, 0); - spawnableActorList_add(&D_80390A40, actor_new, 0x880); //yumblie - spawnableActorList_add(&D_80390A70, actor_new, 0x9a2); //mr. vile - spawnableActorList_add(&D_80390830, actor_new, 0x888); //tiptup - spawnableActorList_add(&D_80390880, actor_new, 0x9a8); //tiptup_chiorMember - spawnableActorList_add(&D_803908A4, actor_new, 0x9a8); //tiptup_chiorMember - spawnableActorList_add(&D_803908C8, actor_new, 0x9a8); //tiptup_chiorMember - spawnableActorList_add(&D_803908EC, actor_new, 0x9a8); //tiptup_chiorMember - spawnableActorList_add(&D_80390910, actor_new, 0x9a8); //tiptup_chiorMember - spawnableActorList_add(&D_80390934, actor_new, 0x9a8); //tiptup_chiorMember - spawnableActorList_add(&D_80390DA8, actor_new, 0x4000); //leafboat - spawnableActorList_add(&D_80390D70, actor_new, 0x580); //bigAlligator - spawnableActorList_add(&D_80390BD8, actor_new, 8); //green_jiggy_switch - spawnableActorList_add(&D_80390BFC, actor_new, 8); //green_jiggy_switch + spawnableActorList_add(&D_80390804, actor_new, ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3);//croctus + spawnableActorList_add(&D_80390690, actor_new, ACTOR_FLAG_UNKNOWN_25 | ACTOR_FLAG_UNKNOWN_16 | ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_0); //flibbit + spawnableActorList_add(&D_803906F8, actor_new, ACTOR_FLAG_UNKNOWN_10); //pink_egg_largest + spawnableActorList_add(&D_8039071C, actor_new, ACTOR_FLAG_UNKNOWN_10); //pink_egg_large + spawnableActorList_add(&D_80390740, actor_new, ACTOR_FLAG_UNKNOWN_10); //pink_egg_medium + spawnableActorList_add(&D_80390764, actor_new, ACTOR_FLAG_UNKNOWN_10); //pink_egg_small + spawnableActorList_add(&D_80390788, actor_new, ACTOR_FLAG_UNKNOWN_10); //pink_egg_smallest + spawnableActorList_add(&D_80390B68, actor_new, ACTOR_FLAG_NONE); //mudhut_top + spawnableActorList_add(&D_80390C40, actor_new, ACTOR_FLAG_UNKNOWN_26 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_3);//tanktup + spawnableActorList_add(&D_80390C88, actor_new, ACTOR_FLAG_UNKNOWN_26 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_2);//tanktup_leg + spawnableActorList_add(&D_80390CC8, actor_new, ACTOR_FLAG_UNKNOWN_26 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_2);//tanktup_leg + spawnableActorList_add(&D_80390D08, actor_new, ACTOR_FLAG_UNKNOWN_26 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_2);//tanktup_leg + spawnableActorList_add(&D_80390D48, actor_new, ACTOR_FLAG_UNKNOWN_26 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_2);//tanktup_leg + spawnableActorList_add(&chFrogMinigame, actor_new, ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_0); + spawnableActorList_add(&BGS_D_80390AE0, actor_new, ACTOR_FLAG_UNKNOWN_25 | ACTOR_FLAG_UNKNOWN_16 | ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_0); //yellow_flibbit + spawnableActorList_add(&D_80390960, actor_new, ACTOR_FLAG_NONE); + spawnableActorList_add(&D_80390A40, actor_new, ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_7); //yumblie + spawnableActorList_add(&D_80390A70, actor_new, ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_1); //mr. vile + spawnableActorList_add(&D_80390830, actor_new, ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3 ); //tiptup + spawnableActorList_add(&D_80390880, actor_new, ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_3 ); //tiptup_chiorMember + spawnableActorList_add(&D_803908A4, actor_new, ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_3 ); //tiptup_chiorMember + spawnableActorList_add(&D_803908C8, actor_new, ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_3 ); //tiptup_chiorMember + spawnableActorList_add(&D_803908EC, actor_new, ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_3 ); //tiptup_chiorMember + spawnableActorList_add(&D_80390910, actor_new, ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_3 ); //tiptup_chiorMember + spawnableActorList_add(&D_80390934, actor_new, ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_3 ); //tiptup_chiorMember + spawnableActorList_add(&D_80390DA8, actor_new, ACTOR_FLAG_UNKNOWN_14); //leafboat + spawnableActorList_add(&D_80390D70, actor_new, ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_7); //bigAlligator + spawnableActorList_add(&D_80390BD8, actor_new, ACTOR_FLAG_UNKNOWN_3); //green_jiggy_switch + spawnableActorList_add(&D_80390BFC, actor_new, ACTOR_FLAG_UNKNOWN_3); //green_jiggy_switch } diff --git a/src/BGS/code_9750.c b/src/BGS/code_9750.c index 1917e9b6..5c38e2d3 100644 --- a/src/BGS/code_9750.c +++ b/src/BGS/code_9750.c @@ -62,7 +62,7 @@ void func_8038FB40(ActorMarker *this, s32 arg1){ Actor * thisActor; thisActor = marker_getActor(this); - func_80328A84(thisActor, 2); + subaddie_set_state(thisActor, 2); actor_playAnimationOnce(thisActor); FUNC_8030E624(SFX_A_BANJO_LANDING_05, 0.8f, 32750); } diff --git a/src/CC/code_19B0.c b/src/CC/code_19B0.c index 84a25d52..a23ae3a5 100644 --- a/src/CC/code_19B0.c +++ b/src/CC/code_19B0.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "actor.h" extern ActorInfo D_80389AA0; extern ActorInfo D_80389AD0; @@ -27,25 +28,25 @@ extern ActorInfo D_80389E8C; /* .code */ void CC_func_80387DA0(void) { - spawnableActorList_add(&D_80389AA0, actor_new, 0X4080); - spawnableActorList_add(&D_80389E44, actor_new, 0X10080); - spawnableActorList_add(&D_80389E68, actor_new, 0X10080); - spawnableActorList_add(&D_80389E8C, actor_new, 0X10080); - spawnableActorList_add(&D_80389AD0, actor_new, 0X80); - spawnableActorList_add(&D_80389B00, actor_new, 0X80); - spawnableActorList_add(&D_80389B24, actor_new, 0X80); - spawnableActorList_add(&D_80389B90, actor_new, 0X80); - spawnableActorList_add(&D_80389BB4, actor_new, 0X80); - spawnableActorList_add(&D_80389C90, actor_new, 0X2488); - spawnableActorList_add(&D_80389CB4, actor_new, 0X2488); - spawnableActorList_add(&D_80389CD8, actor_new, 0X2488); - spawnableActorList_add(&D_80389CFC, actor_new, 0X2488); - spawnableActorList_add(&D_80389D20, actor_new, 0X2488); - spawnableActorList_add(&D_80389D44, actor_new, 0X2488); - spawnableActorList_add(&D_80389D68, actor_new, 0X2488); - spawnableActorList_add(&D_80389D8C, actor_new, 0X2488); - spawnableActorList_add(&D_80389DB0, actor_new, 0X2488); - spawnableActorList_add(&D_80389DD4, actor_new, 0X2488); - spawnableActorList_add(&D_80389DF8, actor_new, 0X2488); - spawnableActorList_add(&D_80389E1C, actor_new, 0X2488); + spawnableActorList_add(&D_80389AA0, actor_new, ACTOR_FLAG_UNKNOWN_14 | ACTOR_FLAG_UNKNOWN_7 ); + spawnableActorList_add(&D_80389E44, actor_new, ACTOR_FLAG_UNKNOWN_16 | ACTOR_FLAG_UNKNOWN_7 ); + spawnableActorList_add(&D_80389E68, actor_new, ACTOR_FLAG_UNKNOWN_16 | ACTOR_FLAG_UNKNOWN_7 ); + spawnableActorList_add(&D_80389E8C, actor_new, ACTOR_FLAG_UNKNOWN_16 | ACTOR_FLAG_UNKNOWN_7 ); + spawnableActorList_add(&D_80389AD0, actor_new, ACTOR_FLAG_UNKNOWN_7); + spawnableActorList_add(&D_80389B00, actor_new, ACTOR_FLAG_UNKNOWN_7); + spawnableActorList_add(&D_80389B24, actor_new, ACTOR_FLAG_UNKNOWN_7); + spawnableActorList_add(&D_80389B90, actor_new, ACTOR_FLAG_UNKNOWN_7); + spawnableActorList_add(&D_80389BB4, actor_new, ACTOR_FLAG_UNKNOWN_7); + spawnableActorList_add(&D_80389C90, actor_new, ACTOR_FLAG_UNKNOWN_13 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); + spawnableActorList_add(&D_80389CB4, actor_new, ACTOR_FLAG_UNKNOWN_13 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); + spawnableActorList_add(&D_80389CD8, actor_new, ACTOR_FLAG_UNKNOWN_13 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); + spawnableActorList_add(&D_80389CFC, actor_new, ACTOR_FLAG_UNKNOWN_13 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); + spawnableActorList_add(&D_80389D20, actor_new, ACTOR_FLAG_UNKNOWN_13 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); + spawnableActorList_add(&D_80389D44, actor_new, ACTOR_FLAG_UNKNOWN_13 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); + spawnableActorList_add(&D_80389D68, actor_new, ACTOR_FLAG_UNKNOWN_13 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); + spawnableActorList_add(&D_80389D8C, actor_new, ACTOR_FLAG_UNKNOWN_13 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); + spawnableActorList_add(&D_80389DB0, actor_new, ACTOR_FLAG_UNKNOWN_13 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); + spawnableActorList_add(&D_80389DD4, actor_new, ACTOR_FLAG_UNKNOWN_13 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); + spawnableActorList_add(&D_80389DF8, actor_new, ACTOR_FLAG_UNKNOWN_13 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); + spawnableActorList_add(&D_80389E1C, actor_new, ACTOR_FLAG_UNKNOWN_13 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); } diff --git a/src/CCW/code_2B00.c b/src/CCW/code_2B00.c index 2b13ae23..8cf3cf75 100644 --- a/src/CCW/code_2B00.c +++ b/src/CCW/code_2B00.c @@ -70,7 +70,7 @@ void func_80388F50(ActorMarker *marker, ActorMarker *other_marker){ if ((func_8028ECAC() != 1) && !this->unk38_0) { this->unk38_0 = TRUE; actor_collisionOff(this); - func_80328B8C(this, 4, 0.0f, 1); + subaddie_set_state_with_direction(this, 4, 0.0f, 1); actor_playAnimationOnce(this); func_8030E6D4(SFX_90_SWITCH_PRESS); } @@ -87,7 +87,7 @@ void func_80388FD4(Actor *this) { if (!this->unk16C_4) { if (fileProgressFlag_get(this->unk10_12 + FILEPROG_8B_CCW_SPRING_OPEN)) { actor_playAnimationOnce(this); - func_80328B8C(this, 4, 0.999f, 1); + subaddie_set_state_with_direction(this, 4, 0.999f, 1); actor_collisionOff(this); } else { marker_setCollisionScripts(this->marker, 0, &func_80388F50, 0); @@ -143,7 +143,7 @@ void func_80389268(Actor *this) { this->unk16C_4 = TRUE; if (fileProgressFlag_get(this->unk10_12 + FILEPROG_8B_CCW_SPRING_OPEN)) { - func_80328A84(this, 3); + subaddie_set_state(this, 3); } } @@ -153,14 +153,14 @@ void func_80389268(Actor *this) { if (levelSpecificFlags_get(this->unk10_12 + 7)) { timedFunc_set_1(0.05f, func_803891B0, (s32) this->marker); timedFunc_set_1(4.0f, func_8038921C, (s32) this->marker); - func_80328A84(this, 2); + subaddie_set_state(this, 2); } break; case 2: this->position[1] += 60.0f * time_getDelta(); if (this->unk1C[1] <= this->position[1]) { levelSpecificFlags_set(this->unk10_12 + 7, FALSE); - func_80328A84(this, 3); + subaddie_set_state(this, 3); } break; case 3: diff --git a/src/CCW/code_7BF0.c b/src/CCW/code_7BF0.c index aa24a7f4..7557066e 100644 --- a/src/CCW/code_7BF0.c +++ b/src/CCW/code_7BF0.c @@ -21,12 +21,12 @@ ActorInfo D_8038F908 = { /* .code */ void func_8038DFE0(Actor* actor) { - func_80328B8C(actor, 1, 0.001f, 1); + subaddie_set_state_with_direction(actor, 1, 0.001f, 1); actor->unk38_31 = randi2(0, 0); } void CCW_func_8038E034(Actor* actor) { - func_80328B8C(actor, 2, 0.001f, 1); + subaddie_set_state_with_direction(actor, 2, 0.001f, 1); } void func_8038E060(s32 arg0, ActorMarker *marker){ diff --git a/src/CCW/code_8050.c b/src/CCW/code_8050.c index 0708d6ae..fca59e6a 100644 --- a/src/CCW/code_8050.c +++ b/src/CCW/code_8050.c @@ -82,7 +82,7 @@ void func_8038E4C0(ActorMarker* marker, s32 arg1) { Actor* actor = marker_getActor(marker); ParticleEmitter *pCtrl; - func_80328B8C(actor, 5, 0.0f, 1); + subaddie_set_state_with_direction(actor, 5, 0.0f, 1); actor_playAnimationOnce(actor); FUNC_8030E8B4(SFX_C2_GRUBLIN_EGH, 1.0f, 32000, actor->position, 1250, 2500); pCtrl = partEmitMgr_newEmitter(1); diff --git a/src/FP/ch/bearcub.c b/src/FP/ch/bearcub.c index f2cb5468..0ce6bb61 100644 --- a/src/FP/ch/bearcub.c +++ b/src/FP/ch/bearcub.c @@ -111,7 +111,7 @@ void func_8038A384(Actor *this){ if( jiggyscore_isCollected(JIGGY_2E_FP_PRESENTS) || func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE) ){ - func_80328B8C(this, 2, randf2(0.0f, 0.9f), 1); + subaddie_set_state_with_direction(this, 2, randf2(0.0f, 0.9f), 1); } }//L8038A4E4 @@ -153,7 +153,7 @@ void func_8038A384(Actor *this){ break; } if(levelSpecificFlags_get(D_80391E80[sp3C].unk0)){ - func_80328B8C(this, 2, 0.001f, 1); + subaddie_set_state_with_direction(this, 2, 0.001f, 1); if(sp38 == 0xc19){ func_80311480(sp38, 0x2f, this->position, this->marker, func_8038A318, NULL); } diff --git a/src/FP/ch/boggy1.c b/src/FP/ch/boggy1.c index 99fc1ff5..ba2bff24 100644 --- a/src/FP/ch/boggy1.c +++ b/src/FP/ch/boggy1.c @@ -47,14 +47,14 @@ Actor *func_803875E0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ } void func_803876A4(Actor *this){ - func_80328B8C(this, 2, 0.0001f, 1); + subaddie_set_state_with_direction(this, 2, 0.0001f, 1); actor_playAnimationOnce(this); FUNC_8030E8B4(SFX_8E_GRUNTLING_DAMAGE, 1.0f, 32000, this->position, 1250, 2500); } void func_803876F8(Actor *this){ this->marker->propPtr->unk8_3 = FALSE; - func_80328B8C(this, 5, 0.0001f, 1); + subaddie_set_state_with_direction(this, 5, 0.0001f, 1); this->unk48 = 0.0f; func_80343DEC(this); } @@ -76,7 +76,7 @@ void func_803877A8(ActorMarker *caller, enum asset_e text_id, s32 arg2){ jiggySpawn(JIGGY_2A_FP_BOGGY_1, this->velocity); } else if(arg2 == 2){ - func_80328B8C(this, 4, 0.0001f, 1); + subaddie_set_state_with_direction(this, 4, 0.0001f, 1); actor_loopAnimation(this); actor_collisionOff(this); } @@ -178,7 +178,7 @@ void func_8038794C(Actor *this){ }//L80387CF4 if(actor_animationIsAt(this, 0.9999f)){ - func_80328B8C(this, 3, 0.0001f, 1); + subaddie_set_state_with_direction(this, 3, 0.0001f, 1); actor_loopAnimation(this); } break; diff --git a/src/FP/ch/boggy2.c b/src/FP/ch/boggy2.c index 8358b276..9a10460d 100644 --- a/src/FP/ch/boggy2.c +++ b/src/FP/ch/boggy2.c @@ -90,7 +90,7 @@ Actor *func_80388740(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ void FP_func_803888E4(Actor *this){ static f32 D_80391D0C[3] = {1842.0f, 658.0f, 5758.0f}; static f32 D_80391D18[3] = {1463.0f, 635.0f, 5193.0f}; - func_80328B8C(this, 0xC, 0.0001f, 1); + subaddie_set_state_with_direction(this, 0xC, 0.0001f, 1); if(!jiggyscore_isSpawned(JIGGY_30_FP_BOGGY_2)){ if(mapSpecificFlags_get(5)){ func_80324DBC(0.1f, 0xc06, 0x2a, D_80391D18, this->marker, func_80388D70, NULL); @@ -115,7 +115,7 @@ void FP_func_803888E4(Actor *this){ void func_80388A50(Actor *this){ ActorLocal_FP_2350 *local = (ActorLocal_FP_2350 *)&this->local; - func_80328B8C(this, 2, 0.0001f, 1); + subaddie_set_state_with_direction(this, 2, 0.0001f, 1); timed_setStaticCameraToNode(0.0f, 4); local->unk18 = 0; } @@ -206,7 +206,7 @@ void func_80388D70(ActorMarker *caller, enum asset_e text_id, s32 arg2){ local->unk4 = partEmitMgr_newEmitter(16); func_80388EE8(local->unk0); func_80388EE8(local->unk4); - func_80328B8C(this, 4, 0.0001f, 1); + subaddie_set_state_with_direction(this, 4, 0.0001f, 1); local->unk14 = (local->unk19 == 2) ? 1.0f : 0.0f; this->marker->unk40_23 = TRUE; break; @@ -217,10 +217,10 @@ void func_80388D70(ActorMarker *caller, enum asset_e text_id, s32 arg2){ mapSpecificFlags_set(6, TRUE); break; case 0: - func_80328B8C(this, 1, 0.0001f, 1); + subaddie_set_state_with_direction(this, 1, 0.0001f, 1); break; default: - func_80328B8C(this, 1, 0.0001f, 1); + subaddie_set_state_with_direction(this, 1, 0.0001f, 1); break; } break; @@ -432,7 +432,7 @@ void func_803896FC(Actor *this){ local->unk19 = 1; this->unk38_31 = 2; this->unk4C = 600.0f; - func_80328B8C(this, 11, 0.0001f, 1); + subaddie_set_state_with_direction(this, 11, 0.0001f, 1); } else{ local->unk19 = 1; @@ -445,10 +445,10 @@ void func_803896FC(Actor *this){ if(!func_8038A1A0(this->marker)){ switch(this->unk38_31){ case 1://L80389920 - func_80328B8C(this, 9, 0.0001f, 1); + subaddie_set_state_with_direction(this, 9, 0.0001f, 1); break; case 2://L80389938 - func_80328B8C(this, 10, 0.0001f, 1); + subaddie_set_state_with_direction(this, 10, 0.0001f, 1); break; } }//L80389950 @@ -500,9 +500,9 @@ void func_803896FC(Actor *this){ local->unk14 = 0.0f; if( randf() < 0.02 && sp58 < 0.0){ if(randf() < 0.5) - func_80328B8C(this, 5, 0.0001f, 1); + subaddie_set_state_with_direction(this, 5, 0.0001f, 1); else - func_80328B8C(this, 6, 0.0001f, 1); + subaddie_set_state_with_direction(this, 6, 0.0001f, 1); }//L80389C18 func_803893E4(this, sp58, local->unk19); @@ -516,7 +516,7 @@ void func_803896FC(Actor *this){ case 5:// L80389C80 case 6:// L80389C80 if(actor_animationIsAt(this, 0.9999f) || sp58 >= 0.0){ - func_80328B8C(this, 4, 0.0001f, 1); + subaddie_set_state_with_direction(this, 4, 0.0001f, 1); }//L80389CC8 func_803893E4(this, sp58, local->unk19); @@ -528,7 +528,7 @@ void func_803896FC(Actor *this){ case 7:// L80389D34 if(actor_animationIsAt(this, 0.9999f)){ - func_80328B8C(this, 4, 0.0001f, 1); + subaddie_set_state_with_direction(this, 4, 0.0001f, 1); }//L80389D60 func_803893E4(this, sp58, local->unk19); func_80388F90(this); @@ -556,7 +556,7 @@ void func_803896FC(Actor *this){ func_80388F90(this); } if(actor_animationIsAt(this, 0.9999f)){ - func_80328B8C(this, 11, 0.0001f, 1); + subaddie_set_state_with_direction(this, 11, 0.0001f, 1); } break; @@ -567,7 +567,7 @@ void func_803896FC(Actor *this){ } if(actor_animationIsAt(this, 0.9999f)){ - func_80328B8C(this, 11, 0.0001f, 1); + subaddie_set_state_with_direction(this, 11, 0.0001f, 1); } break; @@ -629,10 +629,10 @@ void func_8038A0E4(UNK_TYPE(s32) arg0, ActorMarker *marker){ if(actor){ if(actor->state != 7){ - func_80328B8C(actor, 7, 0.0001f, 1); + subaddie_set_state_with_direction(actor, 7, 0.0001f, 1); } else{ - func_80328B8C(actor, 4, 0.0001f, 1); + subaddie_set_state_with_direction(actor, 4, 0.0001f, 1); } }; } @@ -641,7 +641,7 @@ void func_8038A150(UNK_TYPE(s32) arg0, ActorMarker *marker){ Actor *actor = marker_getActor(marker); if(actor && actor->state != 8){ - func_80328B8C(actor, 8, 0.0001f, 1); + subaddie_set_state_with_direction(actor, 8, 0.0001f, 1); }; } diff --git a/src/FP/ch/racesled.c b/src/FP/ch/racesled.c index b9ee0a4d..37a8a31a 100644 --- a/src/FP/ch/racesled.c +++ b/src/FP/ch/racesled.c @@ -31,7 +31,7 @@ Actor *chRaceSled_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ void __chRaceSled_setState(Actor *this, s32 next_state){ if(this->state != 1 || next_state != 1){ - func_80328A84(this, next_state); + subaddie_set_state(this, next_state); switch(next_state){ case 1: //L8038697C this->unk10_12 = TRUE; diff --git a/src/FP/ch/scarfsled.c b/src/FP/ch/scarfsled.c index 5eab7eae..5be4d707 100644 --- a/src/FP/ch/scarfsled.c +++ b/src/FP/ch/scarfsled.c @@ -21,7 +21,7 @@ ActorInfo chScarfSled = { /* .code */ void __chScarfSled_setState(Actor *this, s32 next_state){ - func_80328A84(this, next_state); + subaddie_set_state(this, next_state); if(next_state == 2){ mapSpecificFlags_set(0xB, TRUE); diff --git a/src/FP/ch/snowmanbutton.c b/src/FP/ch/snowmanbutton.c index 89d724ff..e862101b 100644 --- a/src/FP/ch/snowmanbutton.c +++ b/src/FP/ch/snowmanbutton.c @@ -50,7 +50,7 @@ void FP_func_80386BEC(Actor *this){ ParticleEmitter *pCtrl = partEmitMgr_newEmitter(12); player_getPosition(plyr_pos); - func_80328B8C(this, 2, 0.01f, 1); + subaddie_set_state_with_direction(this, 2, 0.01f, 1); actor_collisionOff(this); func_8025A6EC(COMUSIC_2B_DING_B, 28000); FUNC_8030E624(SFX_90_SWITCH_PRESS, 1.0f, 32000); @@ -93,7 +93,7 @@ void FP_func_80386CF8(Actor *this){ break; case 2: if(actor_animationIsAt(this, 0.99f)){ - func_80328B8C(this, 3, 0.99f, 0); + subaddie_set_state_with_direction(this, 3, 0.99f, 0); } break; case 3: diff --git a/src/FP/ch/twinkly.c b/src/FP/ch/twinkly.c index 9c72cfac..88639237 100644 --- a/src/FP/ch/twinkly.c +++ b/src/FP/ch/twinkly.c @@ -242,7 +242,7 @@ void func_8038C8F0(ActorMarker *marker){ void func_8038C94C(ActorMarker *caller, enum asset_e text_id, s32 arg2){ Actor *this = marker_getActor(caller); if(!func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE)){ - func_80328A84(this, 6); + subaddie_set_state(this, 6); __spawnQueue_add_1((GenFunction_1)func_8038C8F0, reinterpret_cast(s32, this->marker)); } } @@ -261,7 +261,7 @@ void func_8038C9A0(Actor *this){ this->marker->unk18 = &FP_D_80392018; this->unk38_31 = 0; if(0.0f != other->velocity[0]){ - func_80328A84(this, 4); + subaddie_set_state(this, 4); this->unk1C[1] = this->position_y + 50.0f; this->unk1C[2] = this->position_y; } @@ -286,7 +286,7 @@ void func_8038C9A0(Actor *this){ switch(this->state){ case 1:// 8038CB2C if(!func_8038C718(this, 0)){ - func_80328B8C(this, 2, 0.001f, 1); + subaddie_set_state_with_direction(this, 2, 0.001f, 1); func_8038C428(this, D_80392088, randf2(20.0f, 24.0f)); this->unk60 = this->yaw; } @@ -311,7 +311,7 @@ void func_8038C9A0(Actor *this){ if(!func_8038C718(this, 0.0f)){ if(func_8038C844(this->position, D_80392088)){ - func_80328B8C(this, 3, 0.001f, 1); + subaddie_set_state_with_direction(this, 3, 0.001f, 1); func_8038C428(this, D_80392094, 0.0f); } else{ @@ -341,7 +341,7 @@ void func_8038C9A0(Actor *this){ else{ func_80311480(0xc25, 0x2b, this->position, this->marker, func_8038C94C, NULL); } - func_80328A84(this, 5); + subaddie_set_state(this, 5); this->pitch -= 3.0f; } break; diff --git a/src/FP/ch/twinklybox.c b/src/FP/ch/twinklybox.c index dc1ed543..810b2b30 100644 --- a/src/FP/ch/twinklybox.c +++ b/src/FP/ch/twinklybox.c @@ -268,7 +268,7 @@ void func_8038D5C8(ActorMarker *this_marker, ActorMarker *other_marker){ func_8024BD08(0); this->unk1C[2] = 428571.0f; func_8025AEA0(0x68, (s32)this->unk1C[2]); - func_80328B8C(this, 3, 0.001f, 1); + subaddie_set_state_with_direction(this, 3, 0.001f, 1); actor_playAnimationOnce(this); this->velocity[0] = 1.0f; }//L8038D6B8 @@ -303,7 +303,7 @@ void func_8038D6C8(Actor *this){ this->unk1C[0] = -1.0f; func_8028F8F8(7, FALSE); if(func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE) && gcparade_8031B4F4() == -1){ - func_80328B8C(this, 3, 0.001f, 1); + subaddie_set_state_with_direction(this, 3, 0.001f, 1); actor_playAnimationOnce(this); this->velocity[0] = 1.0f; } @@ -320,9 +320,9 @@ void func_8038D6C8(Actor *this){ break; if(!(func_8023DB5C() & 1)) - func_80328B8C(this, 2, 0.001f, 1); + subaddie_set_state_with_direction(this, 2, 0.001f, 1); else - func_80328B8C(this, 2, 0.999f, 0); + subaddie_set_state_with_direction(this, 2, 0.999f, 0); actor_playAnimationOnce(this); this->velocity[2] = randf2(1.4f, 2.0f); @@ -335,7 +335,7 @@ void func_8038D6C8(Actor *this){ if( ( sp20 == TRUE && actor_animationIsAt(this, 0.999f) ) || ( sp20 == FALSE && actor_animationIsAt(this, 0.001f) ) ){ - func_80328B8C(this, 1, 0.001f, 0); + subaddie_set_state_with_direction(this, 1, 0.001f, 0); actor_playAnimationOnce(this); break; } @@ -362,7 +362,7 @@ void func_8038D6C8(Actor *this){ timed_exitStaticCamera(0.0f); func_8028F784(0); - func_80328B8C(this, 4, 0.999f, 1); + subaddie_set_state_with_direction(this, 4, 0.999f, 1); actor_playAnimationOnce(this); item_set(ITEM_0_HOURGLASS_TIMER, 80*60 - 1); item_set(ITEM_6_HOURGLASS, TRUE); @@ -381,7 +381,7 @@ void func_8038D6C8(Actor *this){ func_8025AEA0(COMUSIC_68_TWINKLY_MINIGAME, (s32)this->unk1C[2]); if(item_getCount(ITEM_24_TWINKLY_SCORE) == 0){ - func_80328B8C(this, 1, 0.001f, 1); + subaddie_set_state_with_direction(this, 1, 0.001f, 1); func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); func_8038D3D8(); func_80324E38(0.0f, 3); @@ -393,7 +393,7 @@ void func_8038D6C8(Actor *this){ } if(item_empty(ITEM_6_HOURGLASS)){ - func_80328B8C(this, 1, 0.001f, 0); + subaddie_set_state_with_direction(this, 1, 0.001f, 0); actor_playAnimationOnce(this); this->unk38_31 = 0; item_set(ITEM_6_HOURGLASS, FALSE); diff --git a/src/FP/ch/twinklymuncher.c b/src/FP/ch/twinklymuncher.c index bd3004b7..125852bc 100644 --- a/src/FP/ch/twinklymuncher.c +++ b/src/FP/ch/twinklymuncher.c @@ -35,23 +35,23 @@ Actor *func_8038DD70(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ void func_8038DDC8(Actor *this){ actor_collisionOn(this); - func_80328B8C(this, 2, 0.03f, 1); + subaddie_set_state_with_direction(this, 2, 0.03f, 1); actor_playAnimationOnce(this); } void func_8038DE08(Actor *this){ - func_80328B8C(this, 3, 0.03f, 1); + subaddie_set_state_with_direction(this, 3, 0.03f, 1); actor_loopAnimation(this); } void func_8038DE40(Actor *this){ - func_80328B8C(this, 4, 0.03f, 1); + subaddie_set_state_with_direction(this, 4, 0.03f, 1); actor_playAnimationOnce(this); } void func_8038DE78(Actor *this){ actor_collisionOff(this); - func_80328B8C(this, 5, 0.03f, 1); + subaddie_set_state_with_direction(this, 5, 0.03f, 1); actor_playAnimationOnce(this); } @@ -93,7 +93,7 @@ Actor *func_8038DF34(Actor *this){ void func_8038E040(ActorMarker *caller, enum asset_e text_id, s32 arg2){ Actor *this = marker_getActor(caller); timed_exitStaticCamera(0.5f); - func_80328B8C(this, 7, 0.03f, 1); + subaddie_set_state_with_direction(this, 7, 0.03f, 1); actor_playAnimationOnce(this); } @@ -129,7 +129,7 @@ void func_8038E094(Actor *this){ timed_setStaticCameraToNode(0.5f, 0xd); func_80311480(ASSET_C15_TEXT_TWINKLIE_MINIGAME_LOST, 0x2b, this->position, this->marker, func_8038E040, NULL); this->velocity[0] = 1.0f; - func_80328B8C(this, 6, 0.03f, 1); + subaddie_set_state_with_direction(this, 6, 0.03f, 1); actor_loopAnimation(this); } } @@ -214,7 +214,7 @@ void func_8038E094(Actor *this){ case 5: //L8038E644 this->marker->propPtr->unk8_3 = TRUE; if(actor_animationIsAt(this, 0.97f)){ - func_80328B8C(this, 1, 0.97f, 0); + subaddie_set_state_with_direction(this, 1, 0.97f, 0); actor_playAnimationOnce(this); this->unk60 = 0.0f; } diff --git a/src/FP/ch/wozza.c b/src/FP/ch/wozza.c index 2721abc3..45a5bbb5 100644 --- a/src/FP/ch/wozza.c +++ b/src/FP/ch/wozza.c @@ -56,12 +56,12 @@ void func_8038F274(void){ } void func_8038F2B8(Actor *this){ - func_80328B8C(this, 3, 0.02f, 1); + subaddie_set_state_with_direction(this, 3, 0.02f, 1); actor_loopAnimation(this); } void func_8038F2F0(Actor *this){ - func_80328B8C(this, 11, 0.02f, 1); + subaddie_set_state_with_direction(this, 11, 0.02f, 1); actor_loopAnimation(this); func_8038F274(); } @@ -96,14 +96,14 @@ void func_8038F3F4(ActorMarker *marker){ } void func_8038F41C(Actor *this){ - func_80328B8C(this, 1, 0.02f, 1); + subaddie_set_state_with_direction(this, 1, 0.02f, 1); actor_loopAnimation(this); } void func_8038F454(Actor *this){ if(!mapSpecificFlags_get(7) && func_8028ECAC() != BSGROUP_A_FLYING && func_80329530(this, 1000) ){ mapSpecificFlags_set(7, TRUE); - func_80328A84(this, 2); + subaddie_set_state(this, 2); actor_loopAnimation(this); timed_setStaticCameraToNode(0.0f, 0x2e); func_80324DBC(0.0f, 0xc1b, 0x2a, this->position, this->marker, func_8038F330, NULL); @@ -115,12 +115,12 @@ void func_8038F454(Actor *this){ } void func_8038F528(Actor *this){ - func_80328B8C(this, 4, 0.02f, 1); + subaddie_set_state_with_direction(this, 4, 0.02f, 1); actor_loopAnimation(this); } void func_8038F560(Actor *this){ - func_80328B8C(this, 7, 0.02f, 1); + subaddie_set_state_with_direction(this, 7, 0.02f, 1); actor_loopAnimation(this); } @@ -149,7 +149,7 @@ bool func_8038F5D4(Actor *this, f32 arg1[3], f32 arg2, f32 arg3, s32 arg4){ bool FP_func_8038F6C4(Actor *this, f32 arg1[3], f32 arg2){ s32 dTheta; - func_80328C64(this, func_803297C8(this, arg1)); + subaddie_set_ideal_yaw(this, func_803297C8(this, arg1)); func_80328FB0(this, arg2); dTheta = this->yaw - this->yaw_ideal; if(-arg2 <= dTheta && dTheta <= arg2){ @@ -223,7 +223,7 @@ void FP_func_8038F7AC(Actor *this){ } if(func_80329530(this, 1300) && player_getTransformation() == TRANSFORM_4_WALRUS){ - func_80328B8C(this, 8, 0.02f, 1); + subaddie_set_state_with_direction(this, 8, 0.02f, 1); actor_loopAnimation(this); break; } @@ -252,7 +252,7 @@ void FP_func_8038F7AC(Actor *this){ } if(func_8038F5D4(this, local->unk0, 30.0f, 12.0f, 0x3C)){ - func_80328B8C(this, 5, 0.02f, 1); + subaddie_set_state_with_direction(this, 5, 0.02f, 1); actor_playAnimationOnce(this); } break; @@ -260,7 +260,7 @@ void FP_func_8038F7AC(Actor *this){ case 5: //L8038FB50 FP_func_8038F6C4(this, local->unk18, 1.0f); if(0.97 < animctrl_getAnimTimer(this->animctrl)){ - func_80328B8C(this, 6, 0.02f, 1); + subaddie_set_state_with_direction(this, 6, 0.02f, 1); actor_loopAnimation(this); } break; @@ -309,7 +309,7 @@ void FP_func_8038F7AC(Actor *this){ if(mapSpecificFlags_get(8)){ if(FP_func_8038F6C4(this, D_803925AC, 9.0f)){ - func_80328B8C(this, 9, 0.02f, 1); + subaddie_set_state_with_direction(this, 9, 0.02f, 1); actor_playAnimationOnce(this); } break; @@ -331,7 +331,7 @@ void FP_func_8038F7AC(Actor *this){ case 9: //L8038FE14 FP_func_8038F6C4(this, D_803925AC, 9.0f); if(0.97 < animctrl_getAnimTimer(this->animctrl)){ - func_80328B8C(this, 10, 0.02f, 1); + subaddie_set_state_with_direction(this, 10, 0.02f, 1); actor_loopAnimation(this); } break; @@ -342,7 +342,7 @@ void FP_func_8038F7AC(Actor *this){ case 11: //L8038FE84 if(func_8038F5D4(this, local->unk24, 30.0f, 12.0f, 0x3C)){ - func_80328A84(this, 12); + subaddie_set_state(this, 12); } break; diff --git a/src/FP/ch/wozzasjig.c b/src/FP/ch/wozzasjig.c index c08acf54..f246ad17 100644 --- a/src/FP/ch/wozzasjig.c +++ b/src/FP/ch/wozzasjig.c @@ -51,7 +51,7 @@ void func_8038FF54(Actor *this){ other = marker_getActor(this->unk100); if(this->state != 9){ if(other->state == 9){ - func_80328B8C(this, 9, 0.01f, 1); + subaddie_set_state_with_direction(this, 9, 0.01f, 1); actor_playAnimationOnce(this); } else{ diff --git a/src/FP/ch/xmastree.c b/src/FP/ch/xmastree.c index d79a1bc3..c68dd31f 100644 --- a/src/FP/ch/xmastree.c +++ b/src/FP/ch/xmastree.c @@ -47,7 +47,7 @@ void __chXmasTree_80386F3C(void){ } void __chXmasTree_80386F84(Actor * this){ - func_80328A84(this, 2); + subaddie_set_state(this, 2); __chXmasTree_80386EF4(this, 0); } @@ -123,7 +123,7 @@ void chXmasTree_update(Actor *this){ case 2: // L80387294 if(!mapSpecificFlags_get(2)) break; - func_80328A84(this, 3); + subaddie_set_state(this, 3); this->unk60 = 2.0f; func_8025A6EC(COMUSIC_61_XMAS_TREE_LIGHTS_UP, 28000); func_802BAFE4(0x1A); @@ -148,7 +148,7 @@ void chXmasTree_update(Actor *this){ } else{//L803873BC if(func_802BB270()){ - func_80328A84(this, 4); + subaddie_set_state(this, 4); __chXmasTree_80386EF4(this, 1); item_set(ITEM_0_HOURGLASS_TIMER, 3600 - 1); item_set(ITEM_6_HOURGLASS, TRUE); @@ -159,7 +159,7 @@ void chXmasTree_update(Actor *this){ case 4: // L80387400 if(mapSpecificFlags_get(3)){ - func_80328A84(this, 6); + subaddie_set_state(this, 6); __chXmasTree_80386EF4(this, 1); item_set(ITEM_6_HOURGLASS, FALSE); tmp_a0 = this->unk44_31; @@ -172,7 +172,7 @@ void chXmasTree_update(Actor *this){ } else{//L80387470 if(item_empty(ITEM_6_HOURGLASS)){ - func_80328A84(this, 5); + subaddie_set_state(this, 5); mapSpecificFlags_set(2, FALSE); this->unk60 = 0.1f; if(!func_8038BFA0()){ diff --git a/src/FP/ch/xmastreestar.c b/src/FP/ch/xmastreestar.c index 9b86c2e9..082abdde 100644 --- a/src/FP/ch/xmastreestar.c +++ b/src/FP/ch/xmastreestar.c @@ -104,14 +104,14 @@ void func_8038ECD8(Actor *this){ if(!mapSpecificFlags_get(2)) break; if(mapSpecificFlags_get(3)) break; - func_80328A84(this, 2); + subaddie_set_state(this, 2); this->unk38_31 = 0; break; case 2://L8038EF5C if(!local->unk1A) return; if(item_empty(ITEM_6_HOURGLASS)){ - func_80328A84(this, 1); + subaddie_set_state(this, 1); } else{ this->marker->collidable = TRUE; @@ -136,7 +136,7 @@ void func_8038ECD8(Actor *this){ }//L8038F090 if(!(this->unk38_31 < 3)){ - func_80328A84(this, 1); + subaddie_set_state(this, 1); mapSpecificFlags_set(3, 1); } } diff --git a/src/FP/ch/xmastreeswitch.c b/src/FP/ch/xmastreeswitch.c index b0e44451..f930d674 100644 --- a/src/FP/ch/xmastreeswitch.c +++ b/src/FP/ch/xmastreeswitch.c @@ -28,7 +28,7 @@ Actor *func_8038E720(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ void func_8038E774(Actor *this){ - func_80328B8C(this, 2, 0.05f, 1); + subaddie_set_state_with_direction(this, 2, 0.05f, 1); actor_playAnimationOnce(this); this->marker->collidable = TRUE; this->unk38_31 = 0; @@ -70,7 +70,7 @@ void func_8038E940(Actor *this){ if(jiggyscore_isCollected(JIGGY_2F_FP_XMAS_TREE) || levelSpecificFlags_get(0x29)){ this->marker->propPtr->unk8_3 = TRUE; this->marker->collidable = FALSE; - func_80328B8C(this, 3, 0.95f, 0); + subaddie_set_state_with_direction(this, 3, 0.95f, 0); return; }//L8038E9B8 @@ -79,7 +79,7 @@ void func_8038E940(Actor *this){ this->marker->propPtr->unk8_3 = TRUE; this->marker->collidable = FALSE; marker_setCollisionScripts(this->marker, NULL, func_8038E7CC, NULL); - func_80328B8C(this, 1, 0.05f, 1); + subaddie_set_state_with_direction(this, 1, 0.05f, 1); this->unk38_31 = 0; this->unk60 = 0.0f; }//L8038EA3C @@ -98,7 +98,7 @@ void func_8038E940(Actor *this){ if(this->unk38_31 < 3) break; - func_80328B8C(this, 3, 0.05f, 1); + subaddie_set_state_with_direction(this, 3, 0.05f, 1); actor_playAnimationOnce(this); FUNC_8030E624(SFX_416, 0.8f, 32000); this->marker->collidable = FALSE; diff --git a/src/FP/code_19E0.c b/src/FP/code_19E0.c index 979f2b7f..247b7f90 100644 --- a/src/FP/code_19E0.c +++ b/src/FP/code_19E0.c @@ -98,7 +98,7 @@ void func_8038811C(ActorMarker *this_marker, ActorMarker *other_marker){ if(this->state == 2) return; - func_80328B8C(this, 2, 0.0001, 1); + subaddie_set_state_with_direction(this, 2, 0.0001, 1); func_8030E878(SFX_6A_FLAGPOLE_WOBBLE, randf2(0.9f, 1.1f), 32000, this->position, 1000.0f, 2000.0f); } @@ -137,7 +137,7 @@ void func_803881AC(Actor *this){ if(this->state == 2){ if(actor_animationIsAt(this, 0.9999f)){ - func_80328B8C(this, 1, 0.0001f, 1); + subaddie_set_state_with_direction(this, 1, 0.0001f, 1); } } diff --git a/src/FP/code_1FF0.c b/src/FP/code_1FF0.c index fcdeab78..6b54d15a 100644 --- a/src/FP/code_1FF0.c +++ b/src/FP/code_1FF0.c @@ -38,7 +38,7 @@ Actor *func_803883E0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ void func_803884F4(ActorMarker *this_marker, ActorMarker *other_marker){ Actor *this = marker_getActor(this_marker); if(this->state != 2){ - func_80328B8C(this, 2, 0.0001f, 1); + subaddie_set_state_with_direction(this, 2, 0.0001f, 1); func_8030E878(SFX_6A_FLAGPOLE_WOBBLE, randf2(0.9f, 1.1f), 32000, this->position, 1000.0f, 2000.0f); } } @@ -78,7 +78,7 @@ void func_80388584(Actor *this){ func_8028E668(this->position, 200.0f, -10.0f, 30.0f); if(this->state == 2){ if(actor_animationIsAt(this, 0.9999f)){ - func_80328B8C(this, 1, 0.0001f, 1); + subaddie_set_state_with_direction(this, 1, 0.0001f, 1); } } } diff --git a/src/GV/ch/ancientone.c b/src/GV/ch/ancientone.c index 44caf36b..e3859bb5 100644 --- a/src/GV/ch/ancientone.c +++ b/src/GV/ch/ancientone.c @@ -96,7 +96,7 @@ void func_803867F4(void){ void func_80386850(ActorMarker *caller_marker, enum asset_e text_id, s32 arg2){ Actor *caller = marker_getActor(caller_marker); if(text_id == 0xA80){ - func_80328B8C(caller, 2, 0.0f, 1); + subaddie_set_state_with_direction(caller, 2, 0.0f, 1); actor_playAnimationOnce(caller); func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7fff); timedFunc_set_0(1.0f, func_803867F4); @@ -162,7 +162,7 @@ void chAncientOne_update(Actor *this){ } } - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_playAnimationOnce(this); if(this->unkF4_8 < 5){ D_80390C28[this->unkF4_8]->propPtr->unk8_4 = TRUE; @@ -198,7 +198,7 @@ void chAncientOne_update(Actor *this){ break; case 2: //L80386DCC if(actor_animationIsAt(this, 0.999f)){ - func_80328B8C(this, 3, 0.9999f, 1); + subaddie_set_state_with_direction(this, 3, 0.9999f, 1); actor_playAnimationOnce(this); } break; diff --git a/src/GV/ch/histup.c b/src/GV/ch/histup.c index 81460532..7e8914d8 100644 --- a/src/GV/ch/histup.c +++ b/src/GV/ch/histup.c @@ -70,7 +70,7 @@ Actor *func_8038DA18(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ void GV_func_8038DB0C(Actor *this){ - func_80328B8C(this, 1, 0.99f, 0); + subaddie_set_state_with_direction(this, 1, 0.99f, 0); animctrl_setPlaybackType(this->animctrl, ANIMCTRL_STOPPED); } @@ -112,7 +112,7 @@ void func_8038DBDC(Actor *this){ this->initialized = TRUE; this->marker->propPtr->unk8_3 = TRUE; actor_collisionOff(this); - func_80328B8C(this, 1, 0.99f, 0); + subaddie_set_state_with_direction(this, 1, 0.99f, 0); animctrl_setPlaybackType(this->animctrl, ANIMCTRL_STOPPED); D_80391AB8 = 0; func_8038DB4C(0); @@ -120,7 +120,7 @@ void func_8038DBDC(Actor *this){ }//L8038DC90 if(func_8038E178() != (s32)this->unk1C[0] || func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE)){ if(15.0f <= this->unk60){ - func_80328B8C(this, 2, 0.01f, 1); + subaddie_set_state_with_direction(this, 2, 0.01f, 1); animctrl_setPlaybackType(this->animctrl, ANIMCTRL_ONCE); animctrl_setDuration(this->animctrl, 2.0f); this->unk1C[0] = (f32)func_8038E178(); @@ -135,7 +135,7 @@ void func_8038DBDC(Actor *this){ if(!(func_8038E178() < 5)){ func_8038DB88(this); if(D_80391AB8){ - func_80328B8C(this, 3, 0.99f, 0); + subaddie_set_state_with_direction(this, 3, 0.99f, 0); animctrl_setPlaybackType(this->animctrl, ANIMCTRL_STOPPED); this->unk1C[0] = 0.0f; } @@ -158,7 +158,7 @@ void func_8038DBDC(Actor *this){ break; case 3: //8038DE44 if(!(this->unk38_31 < 0x21)){ - func_80328B8C(this, 4, 0.01f, 1); + subaddie_set_state_with_direction(this, 4, 0.01f, 1); animctrl_setPlaybackType(this->animctrl, ANIMCTRL_ONCE); animctrl_setDuration(this->animctrl, 3.0f); func_803865F8(); @@ -170,7 +170,7 @@ void func_8038DBDC(Actor *this){ break; case 4: //8038DEBC if(actor_animationIsAt(this, 0.99f)){ - func_80328B8C(this, 5, 0.01f, 1); + subaddie_set_state_with_direction(this, 5, 0.01f, 1); animctrl_setPlaybackType(this->animctrl, ANIMCTRL_LOOP); animctrl_setDuration(this->animctrl, 2.0f); func_8038DB58(0); @@ -191,7 +191,7 @@ void func_8038DBDC(Actor *this){ break; case 5: //8038DFC8 if(func_8038DB64() == 0x127){ - func_80328B8C(this, 6, 0.01f, 1); + subaddie_set_state_with_direction(this, 6, 0.01f, 1); animctrl_setPlaybackType(this->animctrl, ANIMCTRL_LOOP); animctrl_setDuration(this->animctrl, 1.6f); func_80386608(); diff --git a/src/GV/ch/sarcophagus.c b/src/GV/ch/sarcophagus.c index 82f5a3dd..a96b3c1e 100644 --- a/src/GV/ch/sarcophagus.c +++ b/src/GV/ch/sarcophagus.c @@ -37,7 +37,7 @@ s32 D_80390E88[4] = {0, 0, 0, 0}; void GV_func_803894B0(Actor *this){ this->marker->propPtr->unk8_3 = TRUE; actor_collisionOff(this); - func_80328B8C(this, 1, 0.01f, 1); + subaddie_set_state_with_direction(this, 1, 0.01f, 1); this->unk38_31 = 0; this->initialized = TRUE; } @@ -72,7 +72,7 @@ void chSarcophagus_update(Actor *this){ GV_func_803894B0(this); } if(func_80329530(this, 500) && func_8038957C(this)){ - func_80328B8C(this, 2, 0.01f, 1); + subaddie_set_state_with_direction(this, 2, 0.01f, 1); FUNC_8030E8B4(SFX_6B_LOCKUP_OPENING, 1.0f, 32000, this->position, 1250, 2500); FUNC_8030E8B4(SFX_3F6_UNKNOWN, 1.0f, 32000, this->position, 1250, 2500); @@ -88,13 +88,13 @@ void chSarcophagus_update(Actor *this){ this->unk38_31 = 1; } if(actor_animationIsAt(this, 0.5f)){ - func_80328B8C(this, 3, 0.5f, 1); + subaddie_set_state_with_direction(this, 3, 0.5f, 1); } break; case 3: //L80389788 if(!func_80329530(this, 700)){ - func_80328B8C(this, 4, 0.5f, 1); + subaddie_set_state_with_direction(this, 4, 0.5f, 1); FUNC_8030E8B4(SFX_6B_LOCKUP_OPENING, 1.0f, 32000, this->position, 1250, 2500); FUNC_8030E8B4(SFX_3F6_UNKNOWN, 1.0f, 32000, this->position, 1250, 2500); } @@ -110,7 +110,7 @@ void chSarcophagus_update(Actor *this){ } if(actor_animationIsAt(this, 0.99f)){ - func_80328B8C(this, 1, 0.01f, 1); + subaddie_set_state_with_direction(this, 1, 0.01f, 1); } else if(actor_animationIsAt(this, 0.9f)){ FUNC_8030E8B4(SFX_7F_HEAVYDOOR_SLAM, 1.0f, 32000, this->position, 1250, 2500); @@ -123,7 +123,7 @@ void chSarcophagus_updateSNS(Actor *this){ if(!this->initialized){ GV_func_803894B0(this); if(fileProgressFlag_get(FILEPROG_A4_GV_SNS_SARCOPHAGUS_OPEN)) - func_80328B8C(this, 3, 0.5f, 1); + subaddie_set_state_with_direction(this, 3, 0.5f, 1); this->unk1C[0] = 0.0f; } @@ -132,7 +132,7 @@ void chSarcophagus_updateSNS(Actor *this){ if(this->unk1C[0] != 0.0f){ this->unk1C[0] -= 1.0f; if(this->unk1C[0] == 0.0f){ - func_80328B8C(this, 5, 0.01f, 1); + subaddie_set_state_with_direction(this, 5, 0.01f, 1); FUNC_8030E8B4(SFX_6B_LOCKUP_OPENING, 0.5f, 32000, this->position, 1250, 2500); FUNC_8030E8B4(SFX_3F6_UNKNOWN, 0.5f, 32000, this->position, 1250, 2500); } @@ -145,7 +145,7 @@ void chSarcophagus_updateSNS(Actor *this){ break; case 5://L803899DC if(actor_animationIsAt(this, 0.5f)){ - func_80328B8C(this, 3, 0.5f, 1); + subaddie_set_state_with_direction(this, 3, 0.5f, 1); FUNC_8030E624(SFX_7F_HEAVYDOOR_SLAM, 1.0f, 25000); } break; diff --git a/src/GV/ch/toots.c b/src/GV/ch/toots.c index 6804e711..3b0e96e6 100644 --- a/src/GV/ch/toots.c +++ b/src/GV/ch/toots.c @@ -24,17 +24,17 @@ s32 D_80391A34; /* .code */ void GV_func_803863F0(Actor *this){ - func_80328B8C(this, 1, 0.0001f, 1); + subaddie_set_state_with_direction(this, 1, 0.0001f, 1); D_80391A30 = FALSE; } void GV_func_80386420(Actor *this){ - func_80328B8C(this, 2, 0.0001f, 1); + subaddie_set_state_with_direction(this, 2, 0.0001f, 1); this->unk38_31 = 0x23; } void func_80386464(Actor *this){ - func_80328B8C(this, 3, 0.0001f, 1); + subaddie_set_state_with_direction(this, 3, 0.0001f, 1); } void chtoots_update(Actor *this){ diff --git a/src/GV/code_3630.c b/src/GV/code_3630.c index 10cc369f..dd69a89a 100644 --- a/src/GV/code_3630.c +++ b/src/GV/code_3630.c @@ -25,13 +25,13 @@ ActorInfo D_80390ED0 = { MARKER_A9_RUBEE, ACTOR_11B_RUBEE, ASSET_3DD_MODEL_RUBEE void func_80389A20(ActorMarker *caller, enum asset_e text_id, s32 arg2){ Actor *this = marker_getActor(caller); func_8038E18C(); - func_80328B8C(this, 3, 0.0f, 1); + subaddie_set_state_with_direction(this, 3, 0.0f, 1); } void func_80389A60(Actor *this){ func_80311480(ASSET_A70_TEXT_CHARMER_HELPED, 4, NULL, this->marker, func_80389A20, NULL); this->unk138_24 = TRUE; - func_80328A84(this, 5); + subaddie_set_state(this, 5); } void func_80389ABC(Actor *this){ @@ -75,7 +75,7 @@ void func_80389B1C(Actor *this){ func_80389ABC(this); } else if(actor_animationIsAt(this, 0.99f)){ - func_80328B38(this, 2, 0.9f); + subaddie_maybe_set_state(this, 2, 0.9f); } if( actor_animationIsAt(this, 0.42f) @@ -96,7 +96,7 @@ void func_80389B1C(Actor *this){ func_80389ABC(this); } else if(actor_animationIsAt(this, 0.99f)){ - func_80328B38(this, 1, 0.4f); + subaddie_maybe_set_state(this, 1, 0.4f); } break; case 3: //L80389E14 @@ -106,12 +106,12 @@ void func_80389B1C(Actor *this){ } if( actor_animationIsAt(this, 0.99f)){ - func_80328A84(this, 4); + subaddie_set_state(this, 4); } break; case 4: //L80389E64 if(!func_8038E178()) - func_80328A84(this, 2); + subaddie_set_state(this, 2); break; }//L80389E80 } diff --git a/src/GV/code_3D90.c b/src/GV/code_3D90.c index d4b191f3..a77a2e4b 100644 --- a/src/GV/code_3D90.c +++ b/src/GV/code_3D90.c @@ -88,7 +88,7 @@ void func_8038A31C(Actor *this){ this->unk1C[0] = 1.0; this->alpha_124_19 = 0xff; if(this->unk54 != 0.0f){ - func_80328B8C(this, 2, 0.02f, 1); + subaddie_set_state_with_direction(this, 2, 0.02f, 1); animctrl_setPlaybackType(this->animctrl, ANIMCTRL_STOPPED); } break; @@ -96,7 +96,7 @@ void func_8038A31C(Actor *this){ this->marker->propPtr->unk8_3 = TRUE; this->unk1C[0] = 1.0; if(45.0f <= this->velocity[0]){ - func_80328B8C(this, 3, 0.02f, 1); + subaddie_set_state_with_direction(this, 3, 0.02f, 1); this->velocity[0] = 0.0f; } else{ @@ -115,7 +115,7 @@ void func_8038A31C(Actor *this){ this->unk1C[0] = 0.0; this->alpha_124_19 = 0; if(this->unk54 == 0.0f){ - func_80328B8C(this, 4, 0.02f, 1); + subaddie_set_state_with_direction(this, 4, 0.02f, 1); } break; @@ -123,7 +123,7 @@ void func_8038A31C(Actor *this){ this->marker->propPtr->unk8_3 = TRUE; this->unk1C[0] = 1.0; if(45.0f <= this->velocity[0]){ - func_80328B8C(this, 1, 0.02f, 1); + subaddie_set_state_with_direction(this, 1, 0.02f, 1); animctrl_setPlaybackType(this->animctrl, ANIMCTRL_LOOP); this->velocity[0] = 0.0f; } diff --git a/src/GV/code_4740.c b/src/GV/code_4740.c index 8628b582..6f90f7b1 100644 --- a/src/GV/code_4740.c +++ b/src/GV/code_4740.c @@ -104,7 +104,7 @@ void func_8038ADFC(f32 pos[3], s32 cnt){ void func_8038AF10(Actor *this){ animctrl_setSmoothTransition(this->animctrl, TRUE); - func_80328B8C(this, 3, 0.00001f, 1); + subaddie_set_state_with_direction(this, 3, 0.00001f, 1); actor_loopAnimation(this); this->unk28 = 16.0f; this->unk1C[0] = 1.0f; @@ -124,7 +124,7 @@ void func_8038AFF4(ActorMarker *this_marker, ActorMarker *other_marker){ Actor *this = marker_getActor(this_marker); func_8032B4DC(this, other_marker, 0xC); actor_collisionOff(this); - func_80328B8C(this, ASSET_9_ANIM_BSDIE, 0.00001f, 1); + subaddie_set_state_with_direction(this, ASSET_9_ANIM_BSDIE, 0.00001f, 1); actor_playAnimationOnce(this); this->unk1C[0] = 0.0f; func_8030E878(SFX_D7_GRABBA_DEATH, 1.0f, 32000, this->position, 2250.0f, 4500.0f); @@ -189,7 +189,7 @@ void func_8038B124(Actor *this){ && func_803292E0(this) ){ animctrl_setSmoothTransition(this->animctrl, 0); - func_80328B8C(this, 2, 0.00001f, 1); + subaddie_set_state_with_direction(this, 2, 0.00001f, 1); actor_playAnimationOnce(this); this->yaw = (f32)func_80329784(this); this->unk28 = 0.0f; @@ -221,12 +221,12 @@ void func_8038B124(Actor *this){ case 3: //L8038B494 func_8030E2C4(this->unk44_31); if(func_80329530(this, 175)){ - func_80328B8C(this, 4, 0.00001f, 1); + subaddie_set_state_with_direction(this, 4, 0.00001f, 1); actor_loopAnimation(this); this->unk1C[0] = 1.0f; } else if(!func_80329530(this, 1100) || !func_8038AF78(this, 8.0f, 16.0f)){ - func_80328B8C(this, 8, 0.00001f, 1); + subaddie_set_state_with_direction(this, 8, 0.00001f, 1); actor_playAnimationOnce(this); this->unk1C[0] = 1.0f; func_802BB3DC(0, 6.0f, 0.92f); @@ -249,7 +249,7 @@ void func_8038B124(Actor *this){ this->yaw_ideal = func_80329784(this); func_80328FB0(this, 8.0f); if(this->unk38_31 >= 20){ - func_80328B8C(this, 5, 0.00001f, 1); + subaddie_set_state_with_direction(this, 5, 0.00001f, 1); actor_playAnimationOnce(this); this->unk38_31 = 0; this->unk1C[0] = 1.0f; @@ -269,7 +269,7 @@ void func_8038B124(Actor *this){ func_8030E878(SFX_3_DULL_CANNON_SHOT, 1.0f, 32000, this->position, 2250.0f, 4500.0f); }//L8038B734 if(0.98 < animctrl_getAnimTimer(this->animctrl)){ - func_80328B8C(this, 6, 0.99f, 0); + subaddie_set_state_with_direction(this, 6, 0.99f, 0); actor_playAnimationOnce(this); this->unk60 = 0.0f; this->unk1C[0] = 1.0f; @@ -278,7 +278,7 @@ void func_8038B124(Actor *this){ case 6: //L8038B78C if(75.0f <= this->unk60){ - func_80328B8C(this, 7, 0.00001f, 1); + subaddie_set_state_with_direction(this, 7, 0.00001f, 1); actor_playAnimationOnce(this); this->unk1C[0] = 1.0f; } @@ -295,14 +295,14 @@ void func_8038B124(Actor *this){ case 8: //L8038B820 if(0.98 < animctrl_getAnimTimer(this->animctrl)){ - func_80328B8C(this, 1, 0.00001f, 1); + subaddie_set_state_with_direction(this, 1, 0.00001f, 1); this->unk1C[0] = 0.0f; this->unk1C[1] = 2.0f; } break; case 9: //L8038B870 - func_80328A84(this, 0xA); + subaddie_set_state(this, 0xA); func_8038ACEC(this->position, 2); func_8034A174(this->marker->unk44, 5, GV_D_80391A70); func_8038ACEC(GV_D_80391A70, 2); diff --git a/src/GV/code_5570.c b/src/GV/code_5570.c index 16634b8f..2aecc5d6 100644 --- a/src/GV/code_5570.c +++ b/src/GV/code_5570.c @@ -47,7 +47,7 @@ extern s32 D_80391A80; /* .code */ void func_8038B988(ActorMarker *caller, enum asset_e text_id, s32 arg2){ Actor *this = marker_getActor(caller); - func_80328B8C(this, 5, 0.01f, 1); + subaddie_set_state_with_direction(this, 5, 0.01f, 1); actor_loopAnimation(this); func_802BAFE4(0x13); FUNC_8030E624(SFX_8D_BOGGY_OHWW, 0.9f, 32000); @@ -56,7 +56,7 @@ void func_8038B988(ActorMarker *caller, enum asset_e text_id, s32 arg2){ } void func_8038BA08(Actor *this){ - func_80328B8C(this, 6, 0.01f, 1); + subaddie_set_state_with_direction(this, 6, 0.01f, 1); actor_loopAnimation(this); this->unk100 = NULL; D_80391A80 = 3; @@ -182,7 +182,7 @@ void GV_func_8038BEA0(Actor *this){ this->unk100 = func_8032B16C(JIGGY_3E_GV_GRABBA); local->unk0 = this->unk100 != NULL ? this->unk100->unk5C : NULL; } - func_80328B8C(this, this->state, 0.01f, 1); + subaddie_set_state_with_direction(this, this->state, 0.01f, 1); this->unk58_0 = FALSE; this->marker->propPtr->unk8_3 = FALSE; }//L8038BFF4 @@ -195,7 +195,7 @@ void GV_func_8038BEA0(Actor *this){ this->unk58_0 = FALSE; this->marker->propPtr->unk8_3 = FALSE; if(func_8038BB24(this)){ - func_80328B8C(this, 2, 0.01f, 1); + subaddie_set_state_with_direction(this, 2, 0.01f, 1); actor_playAnimationOnce(this); this->unk38_31 = 0; D_80391A80 = this->state; @@ -208,7 +208,7 @@ void GV_func_8038BEA0(Actor *this){ case 2: //L8038C108 if(actor_animationIsAt(this, 0.69f)){ - func_80328B8C(this, 3, 0.01f, 1); + subaddie_set_state_with_direction(this, 3, 0.01f, 1); actor_loopAnimation(this); D_80391A80 = this->state; if(this->unk100){ @@ -230,7 +230,7 @@ void GV_func_8038BEA0(Actor *this){ func_8038BA08(this); } else if(this->unk38_31 >= 0xC){ - func_80328B8C(this, 4, 0.01f, 1); + subaddie_set_state_with_direction(this, 4, 0.01f, 1); actor_playAnimationOnce(this); D_80391A80 = this->state; func_802BB3DC(0, 12.0f, 0.92f); @@ -257,7 +257,7 @@ void GV_func_8038BEA0(Actor *this){ func_8038BA08(this); } else if(actor_animationIsAt(this, 0.89f)){ - func_80328B8C(this, 1, 0.01f, 1); + subaddie_set_state_with_direction(this, 1, 0.01f, 1); actor_loopAnimation(this); D_80391A80 = this->state; } diff --git a/src/GV/code_61E0.c b/src/GV/code_61E0.c index 491905d0..09a409b0 100644 --- a/src/GV/code_61E0.c +++ b/src/GV/code_61E0.c @@ -49,13 +49,13 @@ void GV_func_8038C658(Actor *this){ if(!this->unk16C_4 && this->initialized){ this->unk16C_4 = TRUE; - func_80328B8C(this, this->state, 0.01f, 1); + subaddie_set_state_with_direction(this, this->state, 0.01f, 1); } sp24 = GV_func_8038C5BC(); if(GV_D_80391A90) marker_despawn(this->marker); if(this->state != sp24) - func_80328A84(this, sp24); + subaddie_set_state(this, sp24); } void func_8038C748(void){ diff --git a/src/GV/code_7060.c b/src/GV/code_7060.c index 43643980..61f7bd63 100644 --- a/src/GV/code_7060.c +++ b/src/GV/code_7060.c @@ -23,7 +23,7 @@ ActorInfo D_803912B8 = { MARKER_F9_JINXY, ACTOR_1F7_JINXY, ASSET_422_MODEL_JINXY /* .code */ void func_8038D450(ActorMarker *this_marker){ Actor *this = marker_getActor(this_marker); - func_80328AC8(this, 3); + subaddie_set_state_forward(this, 3); } void func_8038D47C(Actor *this){ @@ -83,13 +83,13 @@ void func_8038D47C(Actor *this){ case 1: //L8038D6C0 if(!mapSpecificFlags_get(0xE) && mapSpecificFlags_get(0) + mapSpecificFlags_get(1) == 1){ mapSpecificFlags_set(0xE, TRUE); - func_80328AC8(this, 2); + subaddie_set_state_forward(this, 2); this->unk38_31 = 1; } else if(!mapSpecificFlags_get(0xF) && mapSpecificFlags_get(0) + mapSpecificFlags_get(1) == 2){ mapSpecificFlags_set(0xF, TRUE); func_8028F918(2); - func_80328AC8(this, 3); + subaddie_set_state_forward(this, 3); func_802BAFE4(0); } break; @@ -104,7 +104,7 @@ void func_8038D47C(Actor *this){ if(--this->unk38_31 == 0){ func_80311480(ASSET_A7C_TEXT_JINXY_ONE_EGG, 4, NULL, NULL, NULL, NULL); mapSpecificFlags_set(0x14, TRUE); - func_80328AC8(this, 1); + subaddie_set_state_forward(this, 1); } } break; @@ -126,7 +126,7 @@ void func_8038D47C(Actor *this){ } } if(actor_animationIsAt(this, 0.99f)){ - func_80328AC8(this, 1); + subaddie_set_state_forward(this, 1); } break; case 4: //L8038D910 diff --git a/src/GV/code_7DB0.c b/src/GV/code_7DB0.c index a9af74ef..44ae1c6e 100644 --- a/src/GV/code_7DB0.c +++ b/src/GV/code_7DB0.c @@ -34,7 +34,7 @@ void func_8038E1A8(Actor *this){ if(sp24){ sp24->velocity_y = 1.0f; } - func_80328B8C(this, 1, 0.02f, 1); + subaddie_set_state_with_direction(this, 1, 0.02f, 1); } else{ if(actor_animationIsAt(this, 0.2f)) @@ -57,7 +57,7 @@ void func_8038E2FC(ActorMarker *this_marker){ Actor *this = marker_getActor(this_marker); Actor *other = func_8032A7AC(this); if(other){ - func_80328B8C(this, 2, 0.02f, 1); + subaddie_set_state_with_direction(this, 2, 0.02f, 1); } } diff --git a/src/GV/code_7FF0.c b/src/GV/code_7FF0.c index 99d410e0..66ff3221 100644 --- a/src/GV/code_7FF0.c +++ b/src/GV/code_7FF0.c @@ -229,7 +229,7 @@ void func_8038E648(Actor *this){ this->pitch = 0.0f; if(mapSpecificFlags_get(5)){ func_802BAFE4(2); - func_80328A84(this, 6); + subaddie_set_state(this, 6); this->unk38_31 = 600; func_80244BB0(0, 0x6A, 0x7ff8, 0.3f); func_802D68F0(25); @@ -240,7 +240,7 @@ void func_8038E648(Actor *this){ case 6: //L8038E700 this->pitch += (this->pitch < 1.0) ? 0.017 : 1.09; if(90.0f <= this->pitch){ - func_80328A84(this, 7); + subaddie_set_state(this, 7); this->pitch = 90.0f; func_8030E540(SFX_7F_HEAVYDOOR_SLAM); func_80244C78(0); @@ -250,7 +250,7 @@ void func_8038E648(Actor *this){ case 7: //L8038E78C this->unk38_31 -= time_getDelta(); if(this->unk38_31 == 0){ - func_80328A84(this, 8); + subaddie_set_state(this, 8); func_80244BB0(0, 0x6A, 0x7ff8, 0.3f); } break; @@ -258,7 +258,7 @@ void func_8038E648(Actor *this){ case 8: //L8038E894 this->pitch -= 1.5; if(this->pitch <= 0.0f){ - func_80328A84(this, 1); + subaddie_set_state(this, 1); this->pitch = 0.0f; func_8030E540(SFX_7F_HEAVYDOOR_SLAM); mapSpecificFlags_set(5, FALSE); @@ -295,7 +295,7 @@ void func_8038E97C(Actor *this){ this->position_z += 117.0; this->position_y += 130.0; this->unk38_31 = 30; - func_80328A84(this, 8); + subaddie_set_state(this, 8); func_80244BB0(1, 0x6A, 0x7ff8, 0.3f); } }//L8038EA6C @@ -313,7 +313,7 @@ void func_8038E97C(Actor *this){ this->position_y = tmp_f0 - (f32)130.0/30.0f; this->unk38_31 -= 1; if(this->unk38_31 == 0){ - func_80328A84(this, 1); + subaddie_set_state(this, 1); func_80244C78(1); func_8030E540(SFX_7F_HEAVYDOOR_SLAM); } @@ -329,7 +329,7 @@ void chKazooieDoor_update(Actor *this){ if(mapSpecificFlags_get(6)){ func_8025A6EC(COMUSIC_2B_DING_B, -1); func_802BAFE4(3); - func_80328A84(this, 6); + subaddie_set_state(this, 6); func_80244BB0(1, 0x6a, 0x7ff8, 0.3f); this->unk1C[1] = this->position_y + 210.0f; this->unk1C[0] = this->position_y; @@ -340,7 +340,7 @@ void chKazooieDoor_update(Actor *this){ this->position_y += 1.8; this->position_z -= 1.3319999999999999; if(this->unk1C[1] <= this->position_y){ - func_80328A84(this, 7); + subaddie_set_state(this, 7); func_8030E540(SFX_7F_HEAVYDOOR_SLAM); func_80244C78(1); this->unk38_31 = 450; @@ -350,7 +350,7 @@ void chKazooieDoor_update(Actor *this){ case 7: //L8038EC70 this->unk38_31--; if(this->unk38_31 == 0){ - func_80328A84(this, 8); + subaddie_set_state(this, 8); func_80244BB0(1, 0x6a, 0x7ff8, 0.3f); } break; @@ -360,7 +360,7 @@ void chKazooieDoor_update(Actor *this){ this->position_z += 1.3319999999999999; if(this->position_y <= this->unk1C[0]){ this->position_y = this->unk1C[0]; - func_80328A84(this, 1); + subaddie_set_state(this, 1); func_8030E540(SFX_7F_HEAVYDOOR_SLAM); func_80244C78(1); mapSpecificFlags_set(6, FALSE); diff --git a/src/MM/ch/chimpystump.c b/src/MM/ch/chimpystump.c index 47ea0ffb..201d4846 100644 --- a/src/MM/ch/chimpystump.c +++ b/src/MM/ch/chimpystump.c @@ -44,7 +44,7 @@ void chchimpystump_update(Actor *this){ { case 1: if(mapSpecificFlags_get(0)) - func_80328A84(this, 2); + subaddie_set_state(this, 2); _chchimpystump_80386CA0(this); break; @@ -53,7 +53,7 @@ void chchimpystump_update(Actor *this){ this->position_y += 2.5; if(this->unk28 <= this->position_y){ this->position_y = this->unk28; - func_80328A84(this, 3); + subaddie_set_state(this, 3); func_802BB41C(1); func_80244C78(0); } diff --git a/src/MM/ch/conga.c b/src/MM/ch/conga.c index 7f62feeb..edc783c3 100644 --- a/src/MM/ch/conga.c +++ b/src/MM/ch/conga.c @@ -17,7 +17,7 @@ void func_80328FB0(Actor *, f32); -void func_80328B8C(Actor*, s32, f32, s32); +void subaddie_set_state_with_direction(Actor*, s32, f32, s32); void func_802C8F70(f32); void timed_exitStaticCamera(f32); Actor *func_8032811C(s32 actor_id, s32 position[3], s32 yaw); @@ -78,7 +78,7 @@ int func_80386ED0(Actor * this){ } void func_80386FB0(Actor *this){ - func_80328C64(this, func_80329784(this)); + subaddie_set_ideal_yaw(this, func_80329784(this)); func_80328FB0(this, 3.0f); } @@ -92,7 +92,7 @@ void func_80386FE8(void){ } void func_8038708C(Actor *this, s32 anim_id){ - func_80328B8C(this, anim_id, 0.0f, 1); + subaddie_set_state_with_direction(this, anim_id, 0.0f, 1); func_8030E58C(SFX_24_KONGA_NOISE_3, randf2(0.9f, 1.1f)); } @@ -128,7 +128,7 @@ void func_80387168(ActorMarker *marker, ActorMarker *other_marker){ if( actorPtr->unk38_31 == 3 && !jiggyscore_isCollected(JIGGY_A_MM_CONGA) ){ - func_80328B8C(actorPtr, 8, 0 ,1); + subaddie_set_state_with_direction(actorPtr, 8, 0 ,1); timed_setStaticCameraToNode(0.0f, 0x10); func_80324E38(0.0f, 3); FUNC_8030E624(SFX_84_GOBI_CRYING, 0.8f, 32750); @@ -238,7 +238,7 @@ void func_803876D0(Actor *this){ ){ if(this->state > 3 && this->state < 8){ actor_loopAnimation(this); - func_80328B8C(this, 1, 0.76f, 1); + subaddie_set_state_with_direction(this, 1, 0.76f, 1); } return; } @@ -269,7 +269,7 @@ void func_803876D0(Actor *this){ }; }//L80387A18 if(actor_animationIsAt(this, 0.66f)){ - func_80328BD4(this, 6, 0, 1, 0.38f); + subaddie_maybe_set_state_position_direction(this, 6, 0, 1, 0.38f); } if( sp3C && func_8028ECAC() != 1 @@ -278,14 +278,14 @@ void func_803876D0(Actor *this){ && !func_8032A9E4(((ActorLocal_Conga *)&this->local)->unk10, ((ActorLocal_Conga *)&this->local)->unk18, ((ActorLocal_Conga *)&this->local)->unk1C) && !func_803872EC() ){ - func_80328B8C(this, 4, 0.0f, 1); + subaddie_set_state_with_direction(this, 4, 0.0f, 1); }//L80387AC0 if( func_8028ECAC() != 1 && func_80386ED0(this) && this->unk38_31 != 0 && !func_803872EC() ){ - func_80328B8C(this, 7, 0.0f, 1); + subaddie_set_state_with_direction(this, 7, 0.0f, 1); } break; @@ -296,12 +296,12 @@ void func_803876D0(Actor *this){ if( animctrl_isPlayedForwards(this->animctrl) == TRUE && actor_animationIsAt(this, 0.0f) ){ - func_80328B8C(this, 5, 0.0f, 1); + subaddie_set_state_with_direction(this, 5, 0.0f, 1); } else if( !animctrl_isPlayedForwards(this->animctrl) && actor_animationIsAt(this, 0.001f) ){ - func_80328B8C(this, 1, 0.76f, 1); + subaddie_set_state_with_direction(this, 1, 0.76f, 1); } break; @@ -310,7 +310,7 @@ void func_803876D0(Actor *this){ actor_loopAnimation(this); func_80386FE8(); if( actor_animationIsAt(this, 0.99f)){ - func_80328BD4(this, 6, 0.999f, 0, sp3C ? 1.0 : 0.4); + subaddie_maybe_set_state_position_direction(this, 6, 0.999f, 0, sp3C ? 1.0 : 0.4); }//L80387C30 if( actor_animationIsAt(this, 0.9f) || actor_animationIsAt(this, 0.4f) @@ -330,21 +330,21 @@ void func_803876D0(Actor *this){ || !timedFuncQueue_is_empty() || func_803872EC() ){ - func_80328B8C(this, 1, 0.0f, 1); + subaddie_set_state_with_direction(this, 1, 0.0f, 1); } break; case 2: //L80387D0C actor_playAnimationOnce(this); if(actor_animationIsAt(this, 0.99f)){ - func_80328B8C(this, 1, 0.0f, 1); + subaddie_set_state_with_direction(this, 1, 0.0f, 1); } break; case 8: //L80387D4C actor_playAnimationOnce(this); if(actor_animationIsAt(this, 0.99f)){ - func_80328B8C(this, 3, 0.0f, 1); + subaddie_set_state_with_direction(this, 3, 0.0f, 1); func_80311480(ASSET_B38_TEXT_CONGA_DEFEAT, 0xe, this->position, this->marker, func_80387370, NULL); } break; @@ -352,7 +352,7 @@ void func_803876D0(Actor *this){ case 3: //L80387DB8 actor_loopAnimation(this); if(jiggyscore_isCollected(JIGGY_A_MM_CONGA)){ - func_80328B8C(this, 1, 0.0f, 1); + subaddie_set_state_with_direction(this, 1, 0.0f, 1); } break; @@ -360,7 +360,7 @@ void func_803876D0(Actor *this){ if(this->unk10_12 == 0){ if(actor_animationIsAt(this, 0.97f)){ ((ActorLocal_Conga *)&this->local)->unkC = 1; - func_80328B8C(this, 6, 0.0f, 1); + subaddie_set_state_with_direction(this, 6, 0.0f, 1); } } break; diff --git a/src/MM/ch/grublin.c b/src/MM/ch/grublin.c index 724119c9..21e74875 100644 --- a/src/MM/ch/grublin.c +++ b/src/MM/ch/grublin.c @@ -21,7 +21,7 @@ typedef struct chgrublin_s{ void (*unk34)(ActorMarker *, s32); }ActorLocal_Grublin; -void func_80328B8C(Actor *, s32, f32, s32); +void subaddie_set_state_with_direction(Actor *, s32, f32, s32); void func_80388A80(Actor *); @@ -51,7 +51,7 @@ void func_803889A0(ActorMarker *this, s32 arg1){ Actor *actorPtr; actorPtr = marker_getActor(this); - func_80328B8C(actorPtr, 5, 0.0f, 1); + subaddie_set_state_with_direction(actorPtr, 5, 0.0f, 1); actor_playAnimationOnce(actorPtr); FUNC_8030E8B4(SFX_C2_GRUBLIN_EGH, 1.0f, 32000, actorPtr->position, 1250, 2500); diff --git a/src/MM/ch/hut.c b/src/MM/ch/hut.c index dfa36681..82919a05 100644 --- a/src/MM/ch/hut.c +++ b/src/MM/ch/hut.c @@ -82,7 +82,7 @@ void chhut_update(Actor *this){ sp3C[2] = this->position_z; sp3C[1] += 125.0; func_8030E484(SFX_5B_HEAVY_STUFF_FALLING); - func_80328A84(this, 1); + subaddie_set_state(this, 1); actor_playAnimationOnce(this); __spawnQueue_add_1((GenFunction_1)func_803869EC, (s32)this->marker); func_802C8F70(this->yaw); @@ -98,7 +98,7 @@ void chhut_update(Actor *this){ case 1: //L80386C2C if(animctrl_getAnimTimer(this->animctrl) > 0.99){ animctrl_setTransitionDuration(this->animctrl, 0.0f); - func_80328A84(this, 2); + subaddie_set_state(this, 2); this->position_y -= 160.0f; } break; diff --git a/src/MM/ch/lmonkey.c b/src/MM/ch/lmonkey.c index 65d92f67..23db90e1 100644 --- a/src/MM/ch/lmonkey.c +++ b/src/MM/ch/lmonkey.c @@ -4,7 +4,7 @@ void func_8028E668(f32 *, f32, f32, f32); int actor_animationIsAt(Actor *, f32); -void func_80328B8C(Actor *, s32, f32, s32); +void subaddie_set_state_with_direction(Actor *, s32, f32, s32); void timed_exitStaticCamera(f32); void func_80324E38(f32,s32); void timed_setStaticCameraToNode(f32, s32); @@ -70,7 +70,7 @@ void __chLMonkey_spawnJiggy(s32 x, s32 y, s32 z){ void __chLMonkey_complete(ActorMarker *marker, enum asset_e arg1, s32 arg2){ Actor * actor = marker_getActor(marker); mapSpecificFlags_set(4,1); - func_80328A84(actor, 3); + subaddie_set_state(actor, 3); timed_setStaticCameraToNode(2.3f, 0x12); timedFunc_set_3(2.9f,__chLMonkey_spawnJiggy, actor->position_x, actor->position_y + 150.0f, actor->position_z); timed_exitStaticCamera(4.3f); @@ -90,7 +90,7 @@ void chLMonkey_update(Actor *this){ switch(this->state){ case 1://L80388690 if(mapSpecificFlags_get(2)){ - func_80328A84(this, 4); + subaddie_set_state(this, 4); if(!jiggyscore_isCollected(JIGGY_9_MM_CHIMPY)){ func_80311480(ASSET_B40_DIALOG_CHIMPY_COMPLETE, 0xE, this->position, this->marker, __chLMonkey_complete, NULL); }else{//L803886E8 @@ -107,14 +107,14 @@ void chLMonkey_update(Actor *this){ this->unk138_24 = 1; }//L80388774 actor_loopAnimation(this); - func_80328BD4(this, 2, 0.0f, -1, 0.02f); + subaddie_maybe_set_state_position_direction(this, 2, 0.0f, -1, 0.02f); } break; case 2: //L803887A4 func_80388300(&this); actor_playAnimationOnce(this); if(actor_animationIsAt(this, 0.99f)){ - func_80328B8C(this,1,0.0f,-1); + subaddie_set_state_with_direction(this,1,0.0f,-1); } break; case 4: //L803887E4 diff --git a/src/MM/code_24C0.c b/src/MM/code_24C0.c index 4b915ed3..c50426a7 100644 --- a/src/MM/code_24C0.c +++ b/src/MM/code_24C0.c @@ -2,6 +2,7 @@ #include #include "functions.h" #include "variables.h" +#include "actor.h" #include "prop.h" @@ -16,13 +17,13 @@ extern ActorInfo chorangepadInfo; extern ActorInfo chlmonkeyInfo; void MM_func_803888B0(void){ - spawnableActorList_add( &chhutInfo, actor_new, 0X400); - spawnableActorList_add( &chchimpystump, actor_new, 0x0); - spawnableActorList_add( &chgrublinInfo, actor_new, 0X2000121); - spawnableActorList_add( &chcongaInfo, actor_new, 0X2000160); - spawnableActorList_add( &chorangeInfo, actor_new, 0x0); - spawnableActorList_add( &chjujuhitboxInfo, actor_new, 0x0); - spawnableActorList_add( &chjujuInfo, actor_new, 0X4004); - spawnableActorList_add( &chorangepadInfo, actor_new, 0X40); - spawnableActorList_add( &chlmonkeyInfo, actor_new, 0X100); + spawnableActorList_add( &chhutInfo, actor_new, ACTOR_FLAG_UNKNOWN_10); + spawnableActorList_add( &chchimpystump, actor_new, ACTOR_FLAG_NONE); + spawnableActorList_add( &chgrublinInfo, actor_new, ACTOR_FLAG_UNKNOWN_25 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_0); + spawnableActorList_add( &chcongaInfo, actor_new, ACTOR_FLAG_UNKNOWN_25 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_5); + spawnableActorList_add( &chorangeInfo, actor_new, ACTOR_FLAG_NONE); + spawnableActorList_add( &chjujuhitboxInfo, actor_new, ACTOR_FLAG_NONE); + spawnableActorList_add( &chjujuInfo, actor_new, ACTOR_FLAG_UNKNOWN_14 | ACTOR_FLAG_UNKNOWN_2); + spawnableActorList_add( &chorangepadInfo, actor_new, ACTOR_FLAG_UNKNOWN_6); + spawnableActorList_add( &chlmonkeyInfo, actor_new, ACTOR_FLAG_UNKNOWN_8); } diff --git a/src/MMM/ch/loggo.c b/src/MMM/ch/loggo.c index 41e14839..3cc7b77e 100644 --- a/src/MMM/ch/loggo.c +++ b/src/MMM/ch/loggo.c @@ -24,7 +24,7 @@ ActorInfo chLoggo = { void __chLoggo_flush(ActorMarker* marker) { Actor* sp1C = marker_getActor(marker); func_8028F918(2); - func_80328B8C(sp1C, 2, 0.01, 1); + subaddie_set_state_with_direction(sp1C, 2, 0.01, 1); actor_playAnimationOnce(sp1C); sp1C->unk60 = 3.2f; } @@ -67,7 +67,7 @@ void chLoggo_update(Actor *this){ this->marker->propPtr->unk8_3 = TRUE; actor_collisionOn(this); marker_setCollisionScripts(this->marker, __chLoggo_collide, NULL, NULL); - func_80328B8C(this, 1, 0.01f, 1); + subaddie_set_state_with_direction(this, 1, 0.01f, 1); actor_loopAnimation(this); this->unk60 = 0.0f; if(!fileProgressFlag_get(FILEPROG_8A_EXITED_LOGGO) && levelSpecificFlags_get(0x33)){ diff --git a/src/MMM/code_2040.c b/src/MMM/code_2040.c index 7bdc6491..6592f514 100644 --- a/src/MMM/code_2040.c +++ b/src/MMM/code_2040.c @@ -191,7 +191,7 @@ f32 MMM_func_80388430(Actor *this, s32 arg1, s32 arg2, f32 arg3) { this->unk1C[1] = 11.0f; break; case 3: - func_80328A84(this, 5); + subaddie_set_state(this, 5); break; } func_8030E878(SFX_82_METAL_BREAK, randf2(0.93f, 1.07f), 0x7FF8, this->position, 100.0f, 900.0f); @@ -290,7 +290,7 @@ void func_80388BDC(Actor *this) { if (!this->unk16C_4) { if (this->yaw != 0.0f) { this->unk60 = 0.5f; - func_80328A84(this, 7); + subaddie_set_state(this, 7); this->unk38_31 = 1; this->yaw = 270.0f; } else { @@ -305,7 +305,7 @@ void func_80388BDC(Actor *this) { this->yaw = 0.0f; if(mapSpecificFlags_get(0)) { func_802BAFE4(0x21); - func_80328A84(this, 6); + subaddie_set_state(this, 6); func_80244BB0(0, 0x6A, 0x7FF8, 0.3f); mapSpecificFlags_set(2, 0); func_8025A6EC(COMUSIC_4_MMM_CLOCK_VERSION, -1); @@ -316,7 +316,7 @@ void func_80388BDC(Actor *this) { 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); + subaddie_set_state(this, 7U); this->yaw = 270.0f; func_8030E540(0x7F); func_80244C78(0); @@ -339,14 +339,14 @@ void func_80388BDC(Actor *this) { } else { func_802BAFE4(0x23); } - func_80328A84(this, 8); + subaddie_set_state(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); + subaddie_set_state(this, 1U); this->yaw = 0.0f; func_8030E540(SFX_7F_HEAVYDOOR_SLAM); mapSpecificFlags_set(0, 0); diff --git a/src/MMM/code_2F60.c b/src/MMM/code_2F60.c index ef12dfd3..0c4abb65 100644 --- a/src/MMM/code_2F60.c +++ b/src/MMM/code_2F60.c @@ -75,7 +75,7 @@ void func_803893A4(Actor *this){ break; case 2: if(actor_animationIsAt(this, 0.999f)){ - func_80328B8C(this, 1, 0.001f, 0); + subaddie_set_state_with_direction(this, 1, 0.001f, 0); actor_playAnimationOnce(this); this->unk38_31 = 2; } @@ -86,7 +86,7 @@ void func_803893A4(Actor *this){ void func_80389484(ActorMarker * marker, f32 anim_duration){ Actor *this = marker_getActor(marker); - func_80328B8C(this, 2, 0.001f, 1); + subaddie_set_state_with_direction(this, 2, 0.001f, 1); actor_playAnimationOnce(this); animctrl_setDuration(this->animctrl, anim_duration); this->unk38_31 = 1; diff --git a/src/MMM/code_DC0.c b/src/MMM/code_DC0.c index 988d2e75..8879059b 100644 --- a/src/MMM/code_DC0.c +++ b/src/MMM/code_DC0.c @@ -74,7 +74,7 @@ bool MMM_func_80387340(ActorMarker *marker){ if(actor->state == 2) return FALSE; - func_80328A84(actor, 2); + subaddie_set_state(actor, 2); animctrl_setPlaybackType(actor->animctrl, ANIMCTRL_ONCE); sp1C = func_803871B0(); if(sp1C != 0){ diff --git a/src/SM/ch/attacktutorial.c b/src/SM/ch/attacktutorial.c index d90a23ec..98c7341b 100644 --- a/src/SM/ch/attacktutorial.c +++ b/src/SM/ch/attacktutorial.c @@ -98,7 +98,7 @@ void chAttackTutorial_setState(Actor * this, s32 arg1){ } break; }//L803874A8 - func_80328A84(this, arg1); + subaddie_set_state(this, arg1); } int func_803874C4(void){ diff --git a/src/SM/ch/vegetables.c b/src/SM/ch/vegetables.c index 4a895e08..168f655d 100644 --- a/src/SM/ch/vegetables.c +++ b/src/SM/ch/vegetables.c @@ -8,7 +8,7 @@ f32 func_80309724(f32*); void func_802C4218(s32, f32, f32, f32); void func_803252D0(f32, s32); -void func_80328B8C(Actor *, s32, f32, s32); +void subaddie_set_state_with_direction(Actor *, s32, f32, s32); //typedefs typedef struct ch_vegatable{ @@ -208,7 +208,7 @@ void func_80387C28(Actor * this){ func_803252D0(1.5f, 7); actor_collisionOff(this); if(local->unkC != 3){ - func_80328B8C(this, 3, 0.0f, 1); + subaddie_set_state_with_direction(this, 3, 0.0f, 1); actor_playAnimationOnce(this); } else{ @@ -337,7 +337,7 @@ void func_80388080(Actor *this){ this->unk1C_y += (local->unkC == 3)? 270.0 : 85.0; } //L80388384 - func_80328A84(this, 4); + subaddie_set_state(this, 4); } break; case 4: //L8038839C @@ -352,7 +352,7 @@ void func_80388080(Actor *this){ func_80387F00(this); actor_collisionOn(this); - func_80328A84(this, 2); + subaddie_set_state(this, 2); }//L80388494 if(!this->unk138_23){ diff --git a/src/SM/code_2990.c b/src/SM/code_2990.c index d6c19034..065d38ac 100644 --- a/src/SM/code_2990.c +++ b/src/SM/code_2990.c @@ -8,7 +8,7 @@ void func_8028E668(f32*, f32, f32, f32); void func_80328FB0(Actor *, f32); void func_8030DA44(u8); void timed_exitStaticCamera(f32); -void func_80328B8C(Actor *, s32, f32, s32); +void subaddie_set_state_with_direction(Actor *, s32, f32, s32); //static types typedef struct sm_2900_struct{ @@ -126,7 +126,7 @@ void func_80388FA0(Actor *this, s32 arg1){ other = subaddie_getLinkedActor(this); myOther = this->unk100; if(myOther && other && myOther->unk14_20 == 0xB8) - func_80328B8C(other, 3, 0.0001f, 1); + subaddie_set_state_with_direction(other, 3, 0.0001f, 1); actor_playAnimationOnce(this); this->unk44_31 = func_8030D90C(); sfxsource_setSfxId(this->unk44_31, 0x3f9); @@ -150,7 +150,7 @@ void func_80388FA0(Actor *this, s32 arg1){ other = subaddie_getLinkedActor(this); myOther = this->unk100; if(myOther && other && myOther->unk14_20 == 0xB8) - func_80328B8C(other, 2, 0.0001f, 1); + subaddie_set_state_with_direction(other, 2, 0.0001f, 1); animctrl_setSmoothTransition(this->animctrl, 1); actor_playAnimationOnce(this); this->unk44_31 = func_8030D90C(); @@ -162,7 +162,7 @@ void func_80388FA0(Actor *this, s32 arg1){ func_8028F94C(2, this->position); break; } - func_80328B8C(this, arg1, 0.0001f, 1); + subaddie_set_state_with_direction(this, arg1, 0.0001f, 1); } void func_80389214(ActorMarker *marker, enum asset_e text_id, s32 arg2){ diff --git a/src/SM/code_3FC0.c b/src/SM/code_3FC0.c index 46e26ed5..ac0a0659 100644 --- a/src/SM/code_3FC0.c +++ b/src/SM/code_3FC0.c @@ -57,7 +57,7 @@ void func_8038A3B0(Actor *this){ actor_collisionOff(this); if(this->state == 2 && levelSpecificFlags_get(sp24 + 0x35)){ - func_80328A84(this, 1); + subaddie_set_state(this, 1); actor_playAnimationOnce(this); } diff --git a/src/SM/code_4070.c b/src/SM/code_4070.c index ba5f06ff..39347c92 100644 --- a/src/SM/code_4070.c +++ b/src/SM/code_4070.c @@ -52,7 +52,7 @@ void func_8038A4DC(Actor *this, s32 arg1){ mapSpecificFlags_set(5, 1); break; }//L8038A5BC - func_80328A84(this, arg1); + subaddie_set_state(this, arg1); } void SM_func_8038A5D8(Actor *this){ diff --git a/src/SM/code_5B0.c b/src/SM/code_5B0.c index 10c7194a..13aecdef 100644 --- a/src/SM/code_5B0.c +++ b/src/SM/code_5B0.c @@ -145,7 +145,7 @@ void SM_func_80386EF4(Actor *this) { } else { this->unk100 = NULL; } - func_80328A84(this, 2); + subaddie_set_state(this, 2); } } } diff --git a/src/SM/code_BF0.c b/src/SM/code_BF0.c index 078cb8c7..1e0dd9ab 100644 --- a/src/SM/code_BF0.c +++ b/src/SM/code_BF0.c @@ -25,7 +25,7 @@ void SM_func_80386FE0(Actor *this){ case 1://L80387064 if(this->unk38_31++ == 2){ this->unk10_12 = actorArray_actorCount(ACTOR_16F_QUARRIE); - func_80328A84(this, 2); + subaddie_set_state(this, 2); } break; case 2://L803870C4 diff --git a/src/TTC/ch/blubber.c b/src/TTC/ch/blubber.c index 36271de3..e6cfa225 100644 --- a/src/TTC/ch/blubber.c +++ b/src/TTC/ch/blubber.c @@ -60,7 +60,7 @@ void func_80387520(ActorMarker *caller, enum asset_e text_id, s32 arg1){ local->unk24 = 0; } else{ - func_80328B8C(this, 2, 0, 1); + subaddie_set_state_with_direction(this, 2, 0, 1); } } @@ -77,7 +77,7 @@ void func_803875D4(ActorMarker *marker){ Actor *this = marker_getActor(reinterpret_cast(ActorMarker *, marker)); enum asset_e text_id; - func_80328A84(this, 4); + subaddie_set_state(this, 4); actor_loopAnimation(this); this->unk28 = 0.0f; @@ -97,7 +97,7 @@ void func_80387678(Actor *this){ func_8028F918(2); timed_setStaticCameraToNode(0.0f, 4); timedFunc_set_1(1.0f, (GenFunction_1)func_803875D4, (s32)this->marker); - func_80328B8C(this, 1, 0.0f, 1); + subaddie_set_state_with_direction(this, 1, 0.0f, 1); } void func_8038771C(Actor *this){ @@ -140,7 +140,7 @@ void func_803878CC(Actor * this){ if(!this->unk16C_4){ if(this->state == 3){ - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); } this->unk16C_4 = TRUE; }//L80387970 @@ -151,7 +151,7 @@ void func_803878CC(Actor * this){ ){ func_80311480(0xa0b, 0xe, this->position, this->marker, func_80387520, NULL); this->unk138_24 = TRUE; - func_80328AC8(this, 3); + subaddie_set_state_forward(this, 3); } if( mapSpecificFlags_get(0) @@ -173,7 +173,7 @@ void func_803878CC(Actor * this){ } func_80387774(&this); - if(func_80328BD4(this, 2, 0.0f, 1, 0.007f)) + if(subaddie_maybe_set_state_position_direction(this, 2, 0.0f, 1, 0.007f)) break; func_80328FB0(this, 3.0f); @@ -185,7 +185,7 @@ void func_803878CC(Actor * this){ case 2:// 80387B10 func_80387774(&this); if( actor_animationIsAt(this, 0.99f) - && func_80328BD4(this, 1, 0.0f, 1, 0.78f) + && subaddie_maybe_set_state_position_direction(this, 1, 0.0f, 1, 0.78f) ){ this->unk28 = 4.0f; break; @@ -214,7 +214,7 @@ void func_803878CC(Actor * this){ func_80328FB0(this, 3.0f); local = (ActorLocal_Blubber*)&this->local; if(actor_animationIsAt(this, 0.99f) && !local->unk24){ - func_80328A84(this, 5); + subaddie_set_state(this, 5); this->unk28 = 8.0f; } } diff --git a/src/TTC/ch/clam.c b/src/TTC/ch/clam.c index a0d7b507..ab2b743e 100644 --- a/src/TTC/ch/clam.c +++ b/src/TTC/ch/clam.c @@ -35,7 +35,7 @@ void __chClam_func_803863F0(enum sfx_e sfx_id, f32 arg1, s32 arg2, f32 position[ } void __chClam_func_80386454(Actor *this){ - func_80328B8C(this, 1, 0.01f, 1); + subaddie_set_state_with_direction(this, 1, 0.01f, 1); actor_loopAnimation(this); animctrl_setDuration(this->animctrl, randf2(1.9f, 2.1f)); } @@ -286,7 +286,7 @@ void chClam_update(Actor *this){ if(this->position_y <= sp48 + 15.0f && sp48 - 15.0f <= this->position_y){ this->position_y = sp48; this->unk38_31 = sp44; - func_80328B8C(this, 3, 0.01f, 1); + subaddie_set_state_with_direction(this, 3, 0.01f, 1); actor_loopAnimation(this); this->velocity_x = 0.0f; animctrl_setDuration(this->animctrl, 0.6f); @@ -298,7 +298,7 @@ void chClam_update(Actor *this){ switch(this->state){ case 1://L80387170 if(__chClam_rotateTowardTarget(this, 140)){ - func_80328B8C(this, 2, 0.01f, 1); + subaddie_set_state_with_direction(this, 2, 0.01f, 1); actor_playAnimationOnce(this); animctrl_setDuration(this->animctrl, 1.0f); __chClam_func_803863F0(SFX_3F2_UNKNOWN, randf2(1.0f, 1.1f), 22000, this->position, 1500.0f, 2000.0f); diff --git a/src/TTC/ch/leaky.c b/src/TTC/ch/leaky.c index e29c461f..e11ff76f 100644 --- a/src/TTC/ch/leaky.c +++ b/src/TTC/ch/leaky.c @@ -83,7 +83,7 @@ void chLeaky_update(Actor *this) { void __chLeaky_startCutscene(ActorMarker *caller, enum asset_e text_id, s32 arg2){ Actor *this = marker_getActor(caller); Struct73s *temp_v0; - func_80328A84(this, 2); + subaddie_set_state(this, 2); temp_v0 = func_8034C5AC(300); if(temp_v0 != NULL){ func_8034E7B8(temp_v0, -600, 4.0f, 2, 10.0f); diff --git a/src/TTC/ch/lockup.c b/src/TTC/ch/lockup.c index 86fd9f64..47136a49 100644 --- a/src/TTC/ch/lockup.c +++ b/src/TTC/ch/lockup.c @@ -56,7 +56,7 @@ Actor *func_803894C0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ } void TTC_func_80389530(Actor *this){ - func_80328B8C(this, 1, 0.2f, 1); + subaddie_set_state_with_direction(this, 1, 0.2f, 1); this->marker->collidable = FALSE; this->unk38_31 = 0; FUNC_8030E8B4(SFX_6C_LOCKUP_CLOSING, 1.0f, 32000, this->position, 1250, 2500); @@ -65,7 +65,7 @@ void TTC_func_80389530(Actor *this){ void func_8038959C(Actor *this){ func_80389468(); - func_80328B8C(this, 2, 0.2f, 1); + subaddie_set_state_with_direction(this, 2, 0.2f, 1); this->unk38_31 = 1; FUNC_8030E8B4(SFX_6B_LOCKUP_OPENING, 1.0f, 32000, this->position, 1250, 2500); } @@ -94,7 +94,7 @@ void func_80389600(Actor *this){ case 1: //L803896F0 if(!this->initialized){ this->marker->propPtr->unk8_3 = TRUE; - func_80328B8C(this, 1, 0.2f, 1); + subaddie_set_state_with_direction(this, 1, 0.2f, 1); this->marker->collidable = FALSE; this->unk38_31 = 0; this->initialized = TRUE; @@ -119,7 +119,7 @@ void func_80389600(Actor *this){ } if(actor_animationIsAt(this, 0.5f)){ - func_80328B8C(this, 3, 0.5f, 1); + subaddie_set_state_with_direction(this, 3, 0.5f, 1); } if(0.15 < animctrl_getAnimTimer(this->animctrl)){ this->marker->collidable = TRUE; @@ -135,7 +135,7 @@ void func_80389600(Actor *this){ if(!(local->unk4 < tmp_v1)){ local->unk4 = 0; - func_80328B8C(this, 4, 0.5f, 1); + subaddie_set_state_with_direction(this, 4, 0.5f, 1); } break; diff --git a/src/TTC/ch/nipper.c b/src/TTC/ch/nipper.c index f28364c6..23952e43 100644 --- a/src/TTC/ch/nipper.c +++ b/src/TTC/ch/nipper.c @@ -66,7 +66,7 @@ Actor *func_80387EB0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { } void TTC_func_80387F18(Actor *this) { - func_80328AEC(this, 3); + subaddie_set_state_looped(this, 3); this->unk1C[0] = 0.0f; switch((s32)this->unk60){ case 0x78: @@ -94,7 +94,7 @@ void TTC_func_80387FB0(ActorMarker *caller, enum asset_e text_id, s32 arg2){ void TTC_func_80387FF4(Actor *this) { s32 i; - func_80328B8C(this, 4, 0.01f, 1); + subaddie_set_state_with_direction(this, 4, 0.01f, 1); actor_playAnimationOnce(this); for(i = 0; i < 3; i ++){ FUNC_8030E8B4(SFX_79_TICKER_DEATH, 0.5f, 17000, this->position, 1500, 3000); @@ -127,7 +127,7 @@ void func_80388178(ActorMarker *this_marker, ActorMarker *other_marker) { func_8032B4DC(this, other_marker, 7); if (this->unk60 == 40.0f) { - func_80328B8C(this, 6, 0.01f, 1); + subaddie_set_state_with_direction(this, 6, 0.01f, 1); actor_playAnimationOnce(this); for(i = 0; i < 3; i++){ FUNC_8030E8B4(SFX_78_EAGLECRY, 0.7f, 20000, this->position, 1500, 3000); @@ -220,7 +220,7 @@ void func_80388434(Actor *this){ case 1:// L80388578 if(!this->initialized){ animctrl_setTransitionDuration(this->animctrl, 0.35f); - func_80328B8C(this, 1, 0.01f, 1); + subaddie_set_state_with_direction(this, 1, 0.01f, 1); this->unk60 = 120.0f; this->marker->propPtr->unk8_3 = TRUE; marker_setCollisionScripts(this->marker, func_803883C8, func_80388344, func_80388178); @@ -233,7 +233,7 @@ void func_80388434(Actor *this){ && temp_v0 != 1 && temp_v0 != 10 ){ - func_80328B8C(this, 5, 0.01f, 1); + subaddie_set_state_with_direction(this, 5, 0.01f, 1); if(func_80311480(0xa0e, 0xf, this->position, this->marker, TTC_func_80387FB0, NULL)){ this->unk138_24 = TRUE; } @@ -258,7 +258,7 @@ void func_80388434(Actor *this){ case 2:// L8038872C if(!func_8038812C(this)){ - func_80328AEC(this, 1); + subaddie_set_state_looped(this, 1); break; } @@ -284,7 +284,7 @@ void func_80388434(Actor *this){ } if(2.0f <= this->unk1C[0]){ - func_80328AEC(this, 2); + subaddie_set_state_looped(this, 2); this->unk38_31 = 0; break; } @@ -322,7 +322,7 @@ void func_80388434(Actor *this){ } if(actor_animationIsAt(this, 0.99f)){ - func_80328B8C(this, 7, 0.01f, 1); + subaddie_set_state_with_direction(this, 7, 0.01f, 1); } break; diff --git a/src/TTC/ch/treasure.c b/src/TTC/ch/treasure.c index 498ff08c..32d87422 100644 --- a/src/TTC/ch/treasure.c +++ b/src/TTC/ch/treasure.c @@ -76,7 +76,7 @@ void chtreasure_update(Actor *this){ this->unk5C = animctrl_getAnimTimer(this->animctrl) *300.0; //radius of 300.0f if(animctrl_isStopped(this->animctrl)){ actor_loopAnimation(this); - func_80328AC8(this, 2); + subaddie_set_state_forward(this, 2); this->marker->propPtr->unk8_3 = 1; actor_collisionOn(this); func_8030E878(SFX_3F2_UNKNOWN, randf2(1.2f, 1.3f), 20000, this->position, 200.0f, 1500.0f); diff --git a/src/core1/code_1D5D0.c b/src/core1/code_1D5D0.c index 743ed5c1..0335e3e6 100644 --- a/src/core1/code_1D5D0.c +++ b/src/core1/code_1D5D0.c @@ -216,9 +216,8 @@ void sns_write_payload_over_heap(void) sns_generate_payload(snsBasePayloadPtr2); - // memcpy - func_80254630(snsBasePayloadPtr3, snsBasePayloadPtr2, sizeof(*snsBasePayloadPtr2)); - func_80254630(snsBasePayloadPtr4, snsBasePayloadPtr2, sizeof(*snsBasePayloadPtr2)); + wmemcpy(snsBasePayloadPtr3, snsBasePayloadPtr2, sizeof(*snsBasePayloadPtr2)); + wmemcpy(snsBasePayloadPtr4, snsBasePayloadPtr2, sizeof(*snsBasePayloadPtr2)); for (i = 1; i < 5; i++) { @@ -231,8 +230,7 @@ void sns_write_payload_over_heap(void) val1 -= val1 & 0x1FFF; for (val1 += 0x2C00; val1 < val3; val1 += 0x2000) - // memcpy - func_80254630((void *)val1, snsBasePayloadPtr2, sizeof(*snsBasePayloadPtr2)); + wmemcpy((void *)val1, snsBasePayloadPtr2, sizeof(*snsBasePayloadPtr2)); } } } diff --git a/src/core1/code_EAF0.c b/src/core1/code_EAF0.c index c04a2689..b067227b 100644 --- a/src/core1/code_EAF0.c +++ b/src/core1/code_EAF0.c @@ -79,10 +79,10 @@ f32 viewport_getYaw(void){ return viewportRotation[1]; } -void func_8024C794(f32 *arg0, f32 *arg1, f32 *arg2){ - *arg0 = viewportRotation[0]; - *arg1 = viewportRotation[1]; - *arg2 = viewportRotation[2]; +void func_8024C794(f32 *pitch, f32 *yaw, f32 *roll){ + *pitch = viewportRotation[0]; + *yaw = viewportRotation[1]; + *roll = viewportRotation[2]; } void func_8024C7B8(Gfx **gfx, Mtx **mtx){ diff --git a/src/core1/memory.c b/src/core1/memory.c index 31ae19cf..e88a24ce 100644 --- a/src/core1/memory.c +++ b/src/core1/memory.c @@ -141,7 +141,7 @@ void memcpy(void * dst, void *src, int size){ } } -void func_80254630(void * dst, void *src, int size){ +void wmemcpy(void * dst, void *src, int size){ while(size > 0){ *(u32*)dst = *(u32*)src; size -= 4; @@ -150,22 +150,16 @@ void func_80254630(void * dst, void *src, int size){ } } -void func_80254658(u8* arg0, u8* arg1, s32 arg2) { - if(arg0 < arg1){ - if(arg2--){ - do{ - *(arg0++) = *(arg1++); - - }while(arg2--); +void memmove(u8* dst, u8* src, s32 n) { + if(dst < src){ //copy + while(n--){ + *(dst++) = *(src++); } - }else{ - arg0 += arg2 -1; - arg1 += arg2 -1; - if(arg2--){ - do{ - *(arg0--) = *(arg1--); - - }while(arg2--); + }else{ //copy backwards to avoid data lose + dst += n -1; + src += n -1; + while(n--){ + *(dst--) = *(src--); } } } @@ -244,11 +238,11 @@ void func_80254908(void){ } } -u32 _heap_get_occupied_size(void){ +static u32 _heap_get_occupied_size(void){ return heap_occupiedBytes; } -u32 func_8025496C(void){ +u32 heap_get_occupied_size(void){ return _heap_get_occupied_size(); } @@ -356,7 +350,7 @@ void *malloc(s32 size){ animCache_flushStale(); if(!func_80254B84(0)) - func_8028873C(0); + animBinCache_flushStale(0); //nonpersistent anim if(!func_80254B84(0)) func_8032AD7C(2); @@ -377,7 +371,7 @@ void *malloc(s32 size){ func_802F1294(); //particleEmitters if(!func_80254B84(0)) - func_8028873C(1); //AnimationFileCache + animBinCache_flushStale(1); //persistent anim if(v1 = func_80254B84(0)){} else @@ -591,8 +585,8 @@ void *realloc(void *ptr, s32 size){ return ptr; } -u32 func_80255498(void){ - return HEAP_SIZE - func_8025496C(); +u32 heap_get_free_size(void){ + return HEAP_SIZE - heap_get_occupied_size(); } s32 heap_findLargestEmptyBlock(s32 *size_ptr){ diff --git a/src/core2/ba/anim.c b/src/core2/ba/anim.c index cb89b56a..beca5c24 100644 --- a/src/core2/ba/anim.c +++ b/src/core2/ba/anim.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" + extern f32 func_802E4B38(void); extern f32 ml_mapRange_f(f32, f32, f32, f32, f32); @@ -53,14 +55,14 @@ void __baanim_update_scaleToHorizontalVelocity(void) { f32 scale; scale = (baAnimScale.scalable_duration != 0) ? baAnimScale.duration_scale : 1.0f; - _get_velocity(velocity); + baphysics_get_velocity(velocity); temp_f12 = ml_mapRange_f(gu_sqrtf(velocity[0]*velocity[0] + velocity[2] * velocity[2]), baAnimScale.velocity_min, baAnimScale.velocity_max, baAnimScale.duration_min * scale, baAnimScale.duration_max * scale); animctrl_setDuration(playerAnimCtrl, ml_clamp_f(temp_f12, baAnimMinDuration, baAnimMaxDuration)); animctrl_update(playerAnimCtrl); } void __baanim_update_scaleToVerticalVelocity(void) { - animctrl_setDuration(playerAnimCtrl, ml_clamp_f(ml_mapRange_f(mlAbsF(_get_vertVelocity()), baAnimScale.velocity_min, baAnimScale.velocity_max, baAnimScale.duration_min, baAnimScale.duration_max), baAnimMinDuration, baAnimMaxDuration)); + animctrl_setDuration(playerAnimCtrl, ml_clamp_f(ml_mapRange_f(mlAbsF(baphysics_get_vertical_velocity()), baAnimScale.velocity_min, baAnimScale.velocity_max, baAnimScale.duration_min, baAnimScale.duration_max), baAnimMinDuration, baAnimMaxDuration)); animctrl_update(playerAnimCtrl); } diff --git a/src/core2/ba/marker.c b/src/core2/ba/marker.c index e00a61aa..3e3e42a1 100644 --- a/src/core2/ba/marker.c +++ b/src/core2/ba/marker.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" #include "prop.h" #include "SnS.h" @@ -105,8 +106,8 @@ void __baMarker_8028B7F4(void){ yaw_setIdeal(func_8029B41C()); yaw_setUpdateState(1); func_8029957C(3); - func_802978DC(2); - func_80297970(0.0f); + baphysics_set_type(BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_8029151C(0xC); } @@ -686,7 +687,7 @@ void __baMarker_resolveCollision(Prop *other_prop){ case MARKER_6B_GLOOPBUBBLE: //L8028CD20 if(func_8028EE84() == BSWATERGROUP_2_UNDERWATER){ - func_803463D4(ITEM_17_AIR, func_80301DBC(2)); + func_803463D4(ITEM_17_AIR, fxairscore_count_to_time(2)); } break; diff --git a/src/core2/ba/model.c b/src/core2/ba/model.c index f4c49e14..1427f43e 100644 --- a/src/core2/ba/model.c +++ b/src/core2/ba/model.c @@ -3,6 +3,7 @@ #include "variables.h" #include "core2/ba/model.h" +#include "core2/ba/physics.h" void func_80254008(void); extern void func_80256E24(f32[3], f32, f32, f32, f32, f32); @@ -317,7 +318,7 @@ void baModel_80292284(f32 arg0[3], s32 arg1){ arg0[1] += sp44[1]; arg0[2] += sp44[2]; } - func_802976C0(sp38); + baphysics_get_position_change(sp38); arg0[0] = arg0[0] + sp38[0]; arg0[1] = arg0[1] + sp38[1]; arg0[2] = arg0[2] + sp38[2]; diff --git a/src/core2/ba/physics.c b/src/core2/ba/physics.c new file mode 100644 index 00000000..659be176 --- /dev/null +++ b/src/core2/ba/physics.c @@ -0,0 +1,432 @@ +#include +#include "functions.h" +#include "variables.h" +#include "core2/ba/physics.h" + +#define _SQ3v1(v) (v[0] * v[0] + v[1] * v[1] + v[2] * v[2]) + +extern f32 ml_sin_deg(f32); +extern f32 ml_dotProduct_vec3f(f32[3], f32[3]); +extern void func_80256D0C(f32, f32, f32, f32, f32, f32 *, f32 *, f32 *); +extern void func_80256E24(f32[3], f32, f32, f32, f32, f32); +extern f32 climbGetRadius(void); +extern f32 func_8029CED0(void); + +/* .data */ +f32 baphysics_default_gravity = -2700.0f; //defaultGravity +f32 baphysics_default_terminal_velocity = -4000.0f; + +/* .bss */ +s32 baphysics_type; +f32 s_next_position[3]; +f32 s_player_velocity[3]; //velocity? +f32 baphysics_target_velocity[3]; +f32 s_delta_position[3]; +f32 D_8037C4E4; +f32 s_gravity; //gravity +f32 s_terminal_velocity; +f32 baphysics_target_horizontal_velocity; +f32 baphysics_target_yaw; //angle +f32 baphysics_acceleration; +f32 D_8037C4FC; +f32 D_8037C500; + +struct { + u8 state; + //u8 pad1[0x3]; + f32 start_position[3]; + f32 end_position[3]; + f32 duration; + f32 elapsed_time; +} baphysics_goto; + +/* .code */ +void __baphysics_update_normal(void){ + f32 sp84[3]; + f32 sp78[3]; + f32 sp6C[3]; + f32 sp60[3]; + f32 sp54[3]; + f32 sp48[3]; + f32 sp44; + f32 sp40; + + + func_80256D0C(0.0f, baphysics_target_yaw, 0.0f, 0.0f, baphysics_target_horizontal_velocity, &baphysics_target_velocity[0], &baphysics_target_velocity[1], &baphysics_target_velocity[2]); + sp6C[0] = s_player_velocity[0];\ + sp6C[1] = 0.0f;\ + sp6C[2] = s_player_velocity[2]; + // sp6C[1] = s_player_velocity[1]; + + ml_vec3f_copy(sp60, baphysics_target_velocity); + sp60[1] = 0.0f; + if(func_80294548()){ + func_80294480(sp54); + ml_vec3f_normalize_copy(sp48, sp60); + sp44 = ml_dotProduct_vec3f(sp48, sp54); + sp40 = get_slope_timer(); + if(sp44 != 0.0f){ + if(sp44 < 0){ + //sp44 = 0.0f; + if(func_8028B3B4()){ + sp40 = ml_map_f(sp40, 0.0f, 1.0f, sp44*0.5, -1.0f); + } + else{//L80296E3C + sp40 = 0.5*sp44; + }//L80296E54 + ml_vec3f_scale(sp60, 1.0 + sp40); + } + else{//L80296E84 + sp40 = sp44*0.2; + ml_vec3f_scale(sp60, sp40 + 1.0); + } + }//L80296EBC + }//L80296EBC + + ml_vec3f_scale_copy(sp84, sp60, func_8029CED0()); + ml_vec3f_scale_copy(sp78, sp6C, func_8029CED0()); + ml_vec3f_diff(sp84, sp78); + ml_vec3f_scale(sp84, time_getDelta()/0.0333333); + s_player_velocity[0] += sp84[0];\ + s_player_velocity[1] += sp84[1];\ + s_player_velocity[2] += sp84[2]; + + sp6C[0] = s_player_velocity[0]; + sp6C[2] = s_player_velocity[2]; + ml_vec3f_scale_copy(s_delta_position, sp6C, 1.0f); + if(mlAbsF(s_player_velocity[0]) < 0.0001) + s_player_velocity[0] = 0; + + if(mlAbsF(s_player_velocity[2]) < 0.0001) + s_player_velocity[2] = 0; + + //update velocity for gravity + s_player_velocity[1] = s_player_velocity[1] + time_getDelta()*s_gravity ; + if(s_player_velocity[1] < s_terminal_velocity) + s_player_velocity[1] = s_terminal_velocity; + + //update position + s_delta_position[1] = s_delta_position[1] + s_player_velocity[1]; + ml_vec3f_scale(s_delta_position, time_getDelta()); + s_next_position[0] += s_delta_position[0];\ + s_next_position[1] += s_delta_position[1];\ + s_next_position[2] += s_delta_position[2]; +} + +void __baphysics_update_no_gravity(void){ + f32 sp24[3]; + //update velocity + ml_vec3f_diff_copy(sp24, baphysics_target_velocity, s_player_velocity); + ml_vec3f_scale(sp24, time_getDelta()*baphysics_acceleration); + if(_SQ3v1(sp24) < 0.02){ + ml_vec3f_copy(s_player_velocity, baphysics_target_velocity); + } + else{ + s_player_velocity[0] += sp24[0];\ + s_player_velocity[1] += sp24[1];\ + s_player_velocity[2] += sp24[2]; + } + //update position + s_delta_position[0] = s_player_velocity[0];\ + s_delta_position[1] = s_player_velocity[1];\ + s_delta_position[2] = s_player_velocity[2]; + ml_vec3f_scale( s_delta_position, time_getDelta()); + + s_next_position[0] += s_delta_position[0];\ + s_next_position[1] += s_delta_position[1];\ + s_next_position[2] += s_delta_position[2]; +} + +void func_802971DC(void){ + s_player_velocity[1] = s_player_velocity[1] + time_getDelta()*s_gravity; + if(s_player_velocity[1] < s_terminal_velocity) + s_player_velocity[1] = s_terminal_velocity; + + s_delta_position[0] = s_player_velocity[0];\ + s_delta_position[1] = s_player_velocity[1];\ + s_delta_position[2] = s_player_velocity[2]; + ml_vec3f_scale(s_delta_position, time_getDelta()); + + s_next_position[0] += s_delta_position[0];\ + s_next_position[1] += s_delta_position[1];\ + s_next_position[2] += s_delta_position[2]; +} + +void __baphysics_update_climb(void){ + f32 sp34[3]; + f32 sp28[3]; + + climbGetBottom(sp28); + s_next_position[0] = sp28[0]; + s_next_position[2] = sp28[2]; + func_80256E24(sp34, 0.0f, yaw_get(), 0.0f, 0.0f, -climbGetRadius()); + + s_player_velocity[2] = 0.0f; + s_next_position[0] += sp34[0];\ + s_next_position[1] += sp34[1];\ + s_next_position[2] += sp34[2]; + + + s_player_velocity[0] = baphysics_target_velocity[0] = baphysics_target_velocity[2] = s_player_velocity[2]; + __baphysics_update_no_gravity(); +} + +void func_8029737C(void){ + s_delta_position[0] = s_player_velocity[0]; + s_delta_position[1] = s_player_velocity[1]; + s_delta_position[2] = s_player_velocity[2]; + ml_vec3f_scale(s_delta_position, time_getDelta()); + s_next_position[0] += s_delta_position[0]; + s_next_position[1] += s_delta_position[1]; + s_next_position[2] += s_delta_position[2]; +} + +void func_8029740C(void){ + s_delta_position[0] = s_player_velocity[0]; + s_delta_position[1] = s_player_velocity[1]; + s_delta_position[2] = s_player_velocity[2]; + ml_vec3f_clear(s_player_velocity); + ml_vec3f_scale(s_delta_position, time_getDelta()); + s_next_position[0] += s_delta_position[0]; + s_next_position[1] += s_delta_position[1]; + s_next_position[2] += s_delta_position[2]; +} + +void __baphysics_update_goto(void){ + f32 sp2C; + + switch(baphysics_goto.state){ + case 0: //L80297628 + break; + case 1: //L802974E8 + baphysics_goto.state = 2; + _player_getPosition(baphysics_goto.start_position); + baphysics_goto.elapsed_time = 0.0f; + baphysics_set_velocity(0); + break; + case 2: //L80297510 + baphysics_goto.elapsed_time += time_getDelta(); + sp2C = ml_map_f(baphysics_goto.elapsed_time, 0.0f, baphysics_goto.duration, 0.0f, 1.0f); + ml_vec3f_copy(s_player_velocity, s_next_position); + s_next_position[0] = ml_interpolate_f(sp2C, baphysics_goto.start_position[0], baphysics_goto.end_position[0]); + s_next_position[1] = ml_interpolate_f(sp2C, baphysics_goto.start_position[1], baphysics_goto.end_position[1]); + s_next_position[2] = ml_interpolate_f(sp2C, baphysics_goto.start_position[2], baphysics_goto.end_position[2]); + ml_vec3f_diff_copy(s_player_velocity, s_next_position, s_player_velocity); + ml_vec3f_scale(s_player_velocity, 1.0/time_getDelta()); + if(1.0 == sp2C){ + baphysics_set_velocity(0); + baphysics_goto.state = 3; + } + break; + case 3: //L80297628 + break; + } +} + +void __baphysics_update_transform(void){ + f32 temp_f0; + + D_8037C500 += time_getDelta(); + temp_f0 = func_80257A44(D_8037C500, 1.2f); + temp_f0 = ml_sin_deg(temp_f0*360.0f); + s_next_position[1] = 5.0*temp_f0 + D_8037C4FC; +} + +void baphysics_get_position_change(f32 arg0[3]){ + ml_vec3f_copy(arg0, s_delta_position); +} + +void baphysics_init(void){ + baphysics_type = 0; + ml_vec3f_clear(s_player_velocity); + ml_vec3f_clear(baphysics_target_velocity); + ml_vec3f_clear(s_delta_position); + ml_vec3f_clear(s_next_position); + D_8037C4E4 = 0.0f; + baphysics_reset(); +} + +void baphysics_update(void){ + _player_getPosition(s_next_position); + switch(baphysics_type){ + case BA_PHYSICS_GOTO: //L80297780 + __baphysics_update_goto(); + break; + case BA_PHYSICS_TRANSFORM: //L80297790 + __baphysics_update_transform(); + break; + case BA_PHYSICS_UNK8: //L802977A0 + func_8029737C(); + break; + case BA_PHYSICS_UNK1: //L802977B0 + func_802971DC(); + break; + case BA_PHYSICS_NO_GRAVITY: //L802977C0 + __baphysics_update_no_gravity(); + break; + case BA_PHYSICS_NORMAL: //L802977D0 //bear + baphysics_set_target_yaw(yaw_getIdeal()); + __baphysics_update_normal(); + break; + case BA_PHYSICS_INVERTED_YAW: //L802977F0 //bird + baphysics_set_target_yaw(mlNormalizeAngle(yaw_getIdeal() + 180.0f)); + __baphysics_update_normal(); + break; + case BA_PHYSICS_LOCKED_ROTATION: //L80297820 + __baphysics_update_normal(); + break; + case BA_PHYSICS_UNK4: //L80297830 + func_8029740C(); + break; + case BA_PHYSICS_AIRBORN: //L80297840 + if(0.0f < func_8029B2E8()){ + baphysics_set_target_yaw(func_8029B33C()); + } + __baphysics_update_normal(); + break; + case BA_PHYSICS_CLIMB: //L80297880 + __baphysics_update_climb(); + break; + case BA_PHYSICS_NONE: + case BA_PHYSICS_FREEZE: + default: + break; + } + player_setPosition(s_next_position); +} + +void baphysics_reset_horizontal_velocity(void){ + baphysics_set_target_horizontal_velocity(0.0f); + s_player_velocity[0] = s_player_velocity[2] = 0.0f; +} + +void baphysics_set_type(BaPhysicsType arg0){ + if((arg0 == BA_PHYSICS_TRANSFORM) && (arg0 != baphysics_type)){ + D_8037C4FC = s_next_position[1]; + D_8037C500 = 0.0f; + } + if(arg0 == BA_PHYSICS_GOTO){ + baphysics_goto.state = 1; + } + baphysics_type = arg0; +} + +void baphysics_set_target_velocity(f32 src[3]){ + if(src) + ml_vec3f_copy(baphysics_target_velocity, src); + else + ml_vec3f_clear(baphysics_target_velocity); +} + +void baphysics_set_target_horizontal_velocity(f32 arg0){ + baphysics_target_horizontal_velocity = arg0; +} + +void baphysics_set_target_yaw(f32 arg0){ + baphysics_target_yaw = mlNormalizeAngle(arg0); +} + +void baphysics_set_vertical_velocity(f32 arg0){ + s_player_velocity[1] = arg0; +} + +void baphysics_set_horizontal_velocity(f32 yaw, f32 magnitude) { \ + func_80256D0C(0.0f, yaw, 0.0f, 0.0f, magnitude, &s_player_velocity[0], &s_player_velocity[1], &s_player_velocity[2]); +} + +void baphysics_set_velocity(f32 src[3]){ + if(src) + ml_vec3f_copy(s_player_velocity, src); + else + ml_vec3f_clear(s_player_velocity); +} + +f32 baphysics_get_gravity(void){ + return s_gravity; +} + +BaPhysicsType baphysics_get_type(void){ + return baphysics_type; +} + +f32 baphysics_get_target_horizontal_velocity(void){ + return baphysics_target_horizontal_velocity; +} + +f32 baphysics_get_target_vertical_velocity(void){ + return baphysics_target_velocity[1]; +} + +f32 baphysics_get_target_yaw(void){ + return baphysics_target_yaw; +} + +void baphysics_get_velocity(f32 dst[3]){ + ml_vec3f_copy(dst, s_player_velocity); +} + +f32 baphysics_get_vertical_velocity(void){ + return s_player_velocity[1]; +} + +f32 baphysics_get_horizontal_velocity(void){ + return gu_sqrtf(s_player_velocity[0]*s_player_velocity[0] + s_player_velocity[2]*s_player_velocity[2]); +} + +f32 baphysics_get_horizontal_velocity_percentage(void){ + f32 horz_vel; + f32 target_vel; + f32 temp_f12; + + horz_vel = baphysics_get_horizontal_velocity(); + target_vel = baphysics_get_target_horizontal_velocity(); + + if(horz_vel < target_vel){ + temp_f12 = horz_vel/target_vel; + } + else{ + temp_f12 = 1.0f; + } + return temp_f12; +} + +void baphysics_reset(void){ + baphysics_reset_gravity(); + baphysics_reset_terminal_velocity(); +} + +void baphysics_set_acceleration(f32 arg0){ + baphysics_acceleration = arg0; +} + +void baphysics_reset_gravity(void){ + baphysics_set_gravity(baphysics_default_gravity); +} + +void baphysics_reset_terminal_velocity(void){ + baphysics_set_terminal_velocity(baphysics_default_terminal_velocity); +} + +void baphysics_set_goto_duration(f32 arg0){ + baphysics_goto.duration = arg0; +} + +void baphysics_set_goto_position(f32 src[3]) { \ + ml_vec3f_copy(baphysics_goto.end_position, src); +} + +void baphysics_set_gravity(f32 arg0){ + s_gravity = arg0; +} + +void baphysics_set_terminal_velocity(f32 arg0){ + s_terminal_velocity = arg0; +} + +int baphysics_is_slower_than(f32 arg0){ + return s_player_velocity[0]*s_player_velocity[0] + s_player_velocity[2]*s_player_velocity[2] <= (arg0*arg0); +} + +int baphysics_goto_done(void){ + return baphysics_goto.state == 3; +} diff --git a/src/core2/bs/ant.c b/src/core2/bs/ant.c index d3f9ae95..697f9557 100644 --- a/src/core2/bs/ant.c +++ b/src/core2/bs/ant.c @@ -3,6 +3,7 @@ #include "variables.h" #include "core2/yaw.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" void func_80293D48(f32,f32); @@ -41,10 +42,10 @@ void func_8029E48C(void){ f32 sp1C = func_8029B30C(); if(func_8029B300() == 0){ - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); } else{ - func_80297970(ml_interpolate_f(sp1C, D_80364960, D_80364964)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, D_80364960, D_80364964)); } } @@ -79,8 +80,8 @@ int bsant_inSet(s32 move_indx){ void bsant_idle_init(void){ func_8029E554(); baanim_playForDuration_loopSmooth(ASSET_5E_ANIM_BSANT_IDLE, 1.2f); - func_8029C7F4(1,YAW_STATE_1_DEFAULT,1,2); - func_80297970(0.0f); + func_8029C7F4(1,YAW_STATE_1_DEFAULT,1,BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); pitch_setAngVel(1000.0f, 12.0f); roll_setAngularVelocity(1000.0f, 12.0f); miscflag_set(3); @@ -115,7 +116,7 @@ void bsant_idle_end(void){ void bsant_walk_init(void){ func_8029E554(); baanim_playForDuration_loopSmooth(ASSET_5F_ANIM_BSANT_WALK, 0.8f); - func_8029C7F4(2,YAW_STATE_1_DEFAULT,1,2); + func_8029C7F4(2, YAW_STATE_1_DEFAULT,1, BA_PHYSICS_NORMAL); baanim_setVelocityMapRanges(D_80364960, D_80364964, D_80364968, D_8036496C); func_802900B4(); } @@ -133,7 +134,7 @@ void bsant_walk_update(void){ if(animctrl_isAt(aCtrl, 0.2781f)) func_8029E448(1); - if(func_8029B300() == 0 && func_80297C04(1.0f)) + if(func_8029B300() == 0 && baphysics_is_slower_than(1.0f)) sp1C = BS_35_ANT_IDLE; if(func_8028B094()) @@ -161,14 +162,14 @@ void bsant_jump_init(void){ animctrl_setSubRange(aCtrl, 0.0f, 0.4423f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bsant.c", 0x17c); - func_8029C7F4(1,YAW_STATE_1_DEFAULT,3,6); + func_8029C7F4(1, YAW_STATE_1_DEFAULT, 3, BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f) yaw_setIdeal(func_8029B33C()); - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_8029E48C(); - func_802979AC(yaw_getIdeal(), func_80297A64()); - player_setYVelocity(D_80364970); - gravity_set(D_80364974); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(D_80364970); + baphysics_set_gravity(D_80364974); func_8029E3E0(); D_8037D294 = 0; } @@ -180,10 +181,10 @@ void bsant_jump_update(void){ f32 sp1C[3]; func_8029E48C(); - _get_velocity(sp1C); + baphysics_get_velocity(sp1C); if(button_released(BUTTON_A) && 0.0f < sp1C[1]) - gravity_reset(); + baphysics_reset_gravity(); switch(D_8037D294){ case 0://L8029EA88 @@ -213,7 +214,7 @@ void bsant_jump_update(void){ break; }//L8029EB38 if(func_8028B2E8()){ - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); if(func_8029B300() > 0) sp2C = BS_ANT_WALK; @@ -225,7 +226,7 @@ void bsant_jump_update(void){ } void bsant_jump_end(void){ - gravity_reset(); + baphysics_reset_gravity(); func_8029E4EC(); } @@ -239,7 +240,7 @@ void bsant_fall_init(void){ animctrl_setStart(aCtrl, 0.4423f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_STOPPED); animctrl_start(aCtrl, "bsant.c", 0x208); - func_8029C7F4(1,YAW_STATE_1_DEFAULT,3,6); + func_8029C7F4(1, YAW_STATE_1_DEFAULT, 3, BA_PHYSICS_AIRBORN); D_8037D294 = 0; } @@ -252,7 +253,7 @@ void bsant_fall_update(void){ if(D_8037D298) func_8029E48C(); - _get_velocity(sp1C); + baphysics_get_velocity(sp1C); switch(D_8037D294){ case 0: if(func_8028B254(0x5A)){ @@ -300,12 +301,12 @@ static void __bsant_recoil_init(int take_damage){ func_80257F18(sp20, sp2C, &sp38); yaw_setIdeal(mlNormalizeAngle(sp38 + 180.0f)); yaw_applyIdeal(); - func_80297970(200.0f); - func_8029797C(sp38); - func_802979AC(sp38, func_80297A64()); - func_8029C7F4(1,YAW_STATE_1_DEFAULT,2,3); - player_setYVelocity(510.0f); - gravity_set(-1200.0f); + baphysics_set_target_horizontal_velocity(200.0f); + baphysics_set_target_yaw(sp38); + baphysics_set_horizontal_velocity(sp38, baphysics_get_target_horizontal_velocity()); + func_8029C7F4(1, YAW_STATE_1_DEFAULT, 2, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_vertical_velocity(510.0f); + baphysics_set_gravity(-1200.0f); baMarker_collisionOff(); func_80292E48(); D_8037D294 = 0; @@ -336,7 +337,7 @@ static void __bsant_recoil_update(void){ static void __bsant_recoil_end(void){ func_80297CA8(); - gravity_reset(); + baphysics_reset_gravity(); baMarker_collisionOn(); func_80292EA4(); func_8029E4EC(); @@ -387,12 +388,12 @@ void bsant_die_init(void){ D_8037D290 = 250.0f; yaw_setIdeal(mlNormalizeAngle(sp38 + 180.0f)); yaw_applyIdeal(); - func_80297970(D_8037D290); - func_8029797C(sp38); - func_802979AC(sp38, func_80297A64()); - func_8029C7F4(1,YAW_STATE_1_DEFAULT,2,3); - player_setYVelocity(510.0f); - gravity_set(-1200.0f); + baphysics_set_target_horizontal_velocity(D_8037D290); + baphysics_set_target_yaw(sp38); + baphysics_set_horizontal_velocity(sp38, baphysics_get_target_horizontal_velocity()); + func_8029C7F4(1, YAW_STATE_1_DEFAULT, 2, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_vertical_velocity(510.0f); + baphysics_set_gravity(-1200.0f); pitch_setAngVel(1000.0f, 12.0f); func_802914CC(0xd); ncDynamicCamD_func_802BF2C0(30.0f); @@ -406,7 +407,7 @@ void bsant_die_init(void){ void bsant_die_update(void){ AnimCtrl *aCtrl = baanim_getAnimCtrlPtr(); - func_80297970(D_8037D290); + baphysics_set_target_horizontal_velocity(D_8037D290); func_80299628(0); switch(D_8037D294){ case 0://L8029F270 @@ -440,7 +441,7 @@ void bsant_die_update(void){ void bsant_die_end(void){ func_8024BD08(0); - gravity_reset(); + baphysics_reset_gravity(); pitch_setIdeal(0.0f); roll_setIdeal(0.0f); func_80291548(); @@ -450,8 +451,8 @@ void bsant_die_end(void){ void func_8029F398(void){ func_8029E554(); baanim_playForDuration_loopSmooth(ASSET_5E_ANIM_BSANT_IDLE, 2.0f); - func_8029C7F4(1,YAW_STATE_1_DEFAULT,3,2); - func_80297970(0.0f); + func_8029C7F4(1, YAW_STATE_1_DEFAULT, 3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_8029C674(); func_802B3A50(); } diff --git a/src/core2/bs/bBarge.c b/src/core2/bs/bBarge.c index c23e323c..589617a7 100644 --- a/src/core2/bs/bBarge.c +++ b/src/core2/bs/bBarge.c @@ -1,15 +1,11 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" -void func_8029797C(f32); -f32 func_80297A64(void); -void func_80297970(f32); -f32 func_80297A7C(void); s32 func_8029E2E0(s32, f32); void func_80292864(f32, f32); -void func_802979AC(f32, f32); void func_8029E3C0(s32, f32); @@ -36,15 +32,15 @@ void func_8029F4F0(void){ switch(D_8037D2A4){ case 0: - tmp_f = (func_80297A7C() + 180.0f); + tmp_f = (baphysics_get_target_yaw() + 180.0f); func_80292864(tmp_f - 70.0f, 20.0f); break; case 1: - tmp_f = (func_80297A7C() + 180.0f); + tmp_f = (baphysics_get_target_yaw() + 180.0f); func_80292864(tmp_f - 10.0f, 20.0f); break; case 2: - tmp_f = (func_80297A7C() + 180.0f); + tmp_f = (baphysics_get_target_yaw() + 180.0f); func_80292864(tmp_f + 50.0f, 20.0f); break; } @@ -73,10 +69,10 @@ void bsbarge_init(void){ animctrl_setPlaybackType(plyrMvmnt, ANIMCTRL_ONCE); animctrl_start(plyrMvmnt, "bsbbarge.c", 0x98); D_8037D2A4 = 0; - func_8029C7F4(1,1,3,3); - func_8029797C(yaw_getIdeal()); - func_80297970(func_80297A64()*0.3); - func_802979AC(yaw_getIdeal(), func_80297A64()); + func_8029C7F4(1,1,3, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_target_yaw(yaw_getIdeal()); + baphysics_set_target_horizontal_velocity(baphysics_get_target_horizontal_velocity()*0.3); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); func_8029E070(1); D_8037D2A6 = 0; D_8037D2A5 = 0; @@ -127,15 +123,15 @@ void bsbarge_update(void){ animctrl_setDuration(plyrMvmnt, 1.0f); baanim_setEnd(0.565f); - func_80297970(D_8037D2A0); - func_802979AC(yaw_getIdeal(), func_80297A64()); + baphysics_set_target_horizontal_velocity(D_8037D2A0); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); func_8030E760(SFX_2_CLAW_SWIPE, 0.558f, 22000); D_8037D2A5 = 2; func_8029F4F0(); D_8037D2A6 = 1; break; case 2: - func_80297970(D_8037D2A0); + baphysics_set_target_horizontal_velocity(D_8037D2A0); if(animctrl_isStopped(plyrMvmnt)){ animctrl_setDuration(plyrMvmnt, 2.0f); baanim_setEnd(0.6f); @@ -149,7 +145,7 @@ void bsbarge_update(void){ if(miscflag_isFalse(0xC) || func_8029E384(0)){ D_8037D2A0 -= 80.0f; } - func_80297970(D_8037D2A0); + baphysics_set_target_horizontal_velocity(D_8037D2A0); if(D_8037D2A0 < 200.0f){ animctrl_setDuration(plyrMvmnt, 1.5f); baanim_setEnd(1.0f); @@ -164,7 +160,7 @@ void bsbarge_update(void){ D_8037D2A0 = 0.0f; D_8037D2A6 = 0; } - func_80297970(D_8037D2A0); + baphysics_set_target_horizontal_velocity(D_8037D2A0); if(animctrl_isAt(plyrMvmnt, 0.9193f)) sp24 = BS_20_LANDING; break; diff --git a/src/core2/bs/bEggAss.c b/src/core2/bs/bEggAss.c index ada34240..dc705448 100644 --- a/src/core2/bs/bEggAss.c +++ b/src/core2/bs/bEggAss.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + /* .bss */ u8 D_8037D2E0; u8 D_8037D2E1; @@ -9,9 +11,9 @@ u8 D_8037D2E1; /* .code */ void bseggass_init(void){ baanim_playForDuration_onceSmooth(ASSET_2B_ANIM_BSEGGASS, 1.0f); - func_8029C7F4(1,3,1,3); + func_8029C7F4(1,3,1, BA_PHYSICS_LOCKED_ROTATION); yaw_setVelocityBounded(350.0f, 14.0f); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); func_8029E058(1); D_8037D2E0 = (D_8037D2E1 = 1); func_802952A8(5,0); @@ -60,6 +62,6 @@ void bseggass_update(void) { void bseggass_end(void){ func_802952A8(5, 1); - gravity_reset(); + baphysics_reset_gravity(); func_8029E058(0); } diff --git a/src/core2/bs/bEggHead.c b/src/core2/bs/bEggHead.c index 1a0bb2d2..ffa0dee7 100644 --- a/src/core2/bs/bEggHead.c +++ b/src/core2/bs/bEggHead.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + void yaw_setVelocityBounded(f32, f32); void animctrl_start(AnimCtrl *, char*, s32); @@ -12,9 +14,9 @@ u8 D_8037D2F1; /* .code */ void bsegghead_init(void){ baanim_playForDuration_onceSmooth(ASSET_2A_ANIM_BSEGGHEAD, 1.0f); - func_8029C7F4(1,3,1,3); + func_8029C7F4(1,3,1, BA_PHYSICS_LOCKED_ROTATION); yaw_setVelocityBounded(350.0f, 14.0f); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); func_8029E070(1); D_8037D2F0 = (D_8037D2F1 = 1); func_802952A8(2,0); @@ -68,6 +70,6 @@ void bsegghead_update(void) { void bsegghead_end(void){ func_802952A8(2, 1); - gravity_reset(); + baphysics_reset_gravity(); func_8029E070(0); } diff --git a/src/core2/bs/bFlap.c b/src/core2/bs/bFlap.c index e273af61..62fed1b6 100644 --- a/src/core2/bs/bFlap.c +++ b/src/core2/bs/bFlap.c @@ -2,6 +2,7 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" f32 func_802A2858(void); @@ -19,15 +20,15 @@ u8 D_8037D30C; void bsbflap_init(void) { baanim_playForDuration_onceSmooth(ASSET_18_ANIM_BSBFLAP_ENTER, 0.3f); - func_8029C7F4(1, 1, 1, 2); + func_8029C7F4(1, 1, 1, BA_PHYSICS_NORMAL); if (func_8029B2E8() != 0.0f) { yaw_setIdeal(func_8029B33C()); } - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802B6FA8(); - func_802979AC(yaw_getIdeal(), func_80297A64()); - player_setYVelocity(0.0f); - gravity_set(D_80364A14); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(0.0f); + baphysics_set_gravity(D_80364A14); func_8029E070(1); miscflag_set(MISC_FLAG_12_HAS_FLAPPED); func_8029E3C0(0, 2.5f); @@ -119,9 +120,9 @@ void bsbflap_update(void){ animctrl_setPlaybackType(sp18, ANIMCTRL_LOOP); animctrl_setStart(sp18, 0.0f); animctrl_start(sp18, "bsbflap.c", 0xe1); - player_setYVelocity(D_80364A10); - gravity_set(D_80364A14); - func_80297BF8(D_80364A18); + baphysics_set_vertical_velocity(D_80364A10); + baphysics_set_gravity(D_80364A14); + baphysics_set_terminal_velocity(D_80364A18); D_8037D300 = 1; } break; @@ -144,8 +145,8 @@ void bsbflap_update(void){ if(D_8037D301 == 4) D_8037D300 = 3; if(button_released(BUTTON_A)){ - gravity_reset(); - func_80297B94(); + baphysics_reset_gravity(); + baphysics_reset_terminal_velocity(); animctrl_setDuration(sp18, 1.0f); D_8037D300 = 4; } @@ -157,14 +158,14 @@ void bsbflap_update(void){ func_802A28CC(); func_802A298C(); if(button_released(BUTTON_A)){ - gravity_reset(); - func_80297B94(); + baphysics_reset_gravity(); + baphysics_reset_terminal_velocity(); animctrl_setDuration(sp18, 1.0f); func_80293240(2); D_8037D300 = 4; } else{ - func_80297970(func_80297A64() * 0.35); + baphysics_set_target_horizontal_velocity(baphysics_get_target_horizontal_velocity() * 0.35); } break; case 4: @@ -192,8 +193,8 @@ void bsbflap_update(void){ void bsbflap_end(void) { ability_use(1); - gravity_reset(); - func_80297B94(); + baphysics_reset_gravity(); + baphysics_reset_terminal_velocity(); func_8029E090(0, 0.2f); func_8030DA44(D_8037D30C); } diff --git a/src/core2/bs/bFlip.c b/src/core2/bs/bFlip.c index 2fc17f75..186c1bcc 100644 --- a/src/core2/bs/bFlip.c +++ b/src/core2/bs/bFlip.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" /* .data */ const f32 D_80364A20 = 920.0f; @@ -18,9 +19,9 @@ void _bsbflip_802A2D60(void){ f32 sp1C; sp1C = func_8029B30C(); if(!func_8029B300()) - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); else - func_80297970(ml_interpolate_f(sp1C, D_80364A2C, D_80364A30)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, D_80364A2C, D_80364A30)); } void _bsbflip_802A2DC0(void){ @@ -33,10 +34,10 @@ void _bsbflip_802A2DC0(void){ animctrl_setStart(aCtrl, 0.8566f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bsbflip.c", 0x69); //nice - func_802978DC(3); - func_80297970(0.0f); + baphysics_set_type(BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_target_horizontal_velocity(0.0f); ml_vec3f_clear(sp20); - func_80297A0C(sp20); + baphysics_set_velocity(sp20); func_8029C5E8(); } @@ -50,7 +51,7 @@ void bsbflip_init(void){ animctrl_setStart(aCtrl, 0.0f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bsbflip.c", 0x80); - func_8029C7F4(1,1,2,3); + func_8029C7F4(1,1,2, BA_PHYSICS_LOCKED_ROTATION); func_8029B324(0, 0.03f); func_8029B324(1, 1.0f); func_8029E070(1); @@ -79,17 +80,17 @@ void bsbflip_update(void){ yaw_setIdeal(func_8029B33C()); } yaw_rotateTimed(1.0f); - func_802978DC(6); - func_8029797C(yaw_getIdeal()); - func_80297970(200.0f); - func_802979AC(yaw_getIdeal(), func_80297A64()); + baphysics_set_type(BA_PHYSICS_AIRBORN); + baphysics_set_target_yaw(yaw_getIdeal()); + baphysics_set_target_horizontal_velocity(200.0f); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); }else{//L802A3098 - func_802978DC(6); - func_80297970(0.0f); + baphysics_set_type(BA_PHYSICS_AIRBORN); + baphysics_set_target_horizontal_velocity(0.0f); } - player_setYVelocity(D_80364A20); - gravity_set(D_80364A24); - func_80297BF8(D_80364A28); + baphysics_set_vertical_velocity(D_80364A20); + baphysics_set_gravity(D_80364A24); + baphysics_set_terminal_velocity(D_80364A28); animctrl_setDuration(aCtrl, 1.9f); func_8030E4E4(SFX_33_BANJO_AHOO); D_8037D310 = 1; @@ -120,7 +121,7 @@ void bsbflip_update(void){ animctrl_setDuration(aCtrl, 0.8f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bsbflip.c", 0xee); - func_80297B94(); + baphysics_reset_terminal_velocity(); D_8037D310 = 3; }//L802A320C if(func_8028B2E8()){ @@ -160,8 +161,8 @@ void bsbflip_update(void){ void bsbflip_end(void){ ability_use(2); - gravity_reset(); - func_80297B94(); + baphysics_reset_gravity(); + baphysics_reset_terminal_velocity(); func_8029E070(0); func_8029B0C0(); } diff --git a/src/core2/bs/bFly.c b/src/core2/bs/bFly.c index 37233efd..3d95e39d 100644 --- a/src/core2/bs/bFly.c +++ b/src/core2/bs/bFly.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" extern void func_8028FDC8(f32); extern void baModel_setYDisplacement(f32); @@ -60,8 +61,8 @@ void func_802A3430(void){ void func_802A34C8(void){ if(!bsbfly_inSet(bs_getNextState())){ - gravity_reset(); - func_80297B94(); + baphysics_reset_gravity(); + baphysics_reset_terminal_velocity(); func_8029E070(0); baModel_setYDisplacement(0.0f); func_8029CB84(); @@ -134,14 +135,14 @@ int func_802A37F8(void){ void bsbfly_enter_init(void){ baanim_playForDuration_onceSmooth(ASSET_45_ANIM_BSBFLY_ENTER, 1.4f); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f) yaw_setIdeal(func_8029B33C()); - func_8029797C(yaw_getIdeal()); - func_80297A0C(0); - func_80297970(0.0f); - gravity_set(-1200.0f); + baphysics_set_target_yaw(yaw_getIdeal()); + baphysics_set_velocity(0); + baphysics_set_target_horizontal_velocity(0.0f); + baphysics_set_gravity(-1200.0f); func_8029E070(1); func_80299BD4(); D_8037D344 = 0; @@ -156,14 +157,14 @@ void bsbfly_enter_update(void){ case 0: if(animctrl_isAt(aCtrl, 0.2416f)){ animctrl_setDuration(aCtrl, 2.4f); - player_setYVelocity(1600.0f); + baphysics_set_vertical_velocity(1600.0f); func_8030E58C(SFX_C_TAKING_FLIGHT_LIFTOFF, 0.7f); D_8037D344 = 1; } break; default: func_802A36D0(); - if(_get_vertVelocity() < 0.0f) + if(baphysics_get_vertical_velocity() < 0.0f) sp1C = BS_24_FLY; break; } @@ -178,18 +179,18 @@ void bsbfly_enter_end(void){ void bsbfly_init(void){ baanim_playForDuration_loopSmooth(ASSET_38_ANIM_BSBFLY, 0.62f); - func_8029C7F4(1,1,3,3); + func_8029C7F4(1,1,3, BA_PHYSICS_LOCKED_ROTATION); if(miscflag_isTrue(9)){ - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); }else{ - func_80297970(600.0f); + baphysics_set_target_horizontal_velocity(600.0f); } - func_802979AC(yaw_getIdeal(), func_80297A64()); - func_8029797C(yaw_getIdeal()); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_target_yaw(yaw_getIdeal()); func_8029E070(1); - gravity_set(-300.0f); - func_80297BF8(-99.9f); + baphysics_set_gravity(-300.0f); + baphysics_set_terminal_velocity(-99.9f); func_802914CC(4); func_802A3430(); D_8037D320 = 1.0f; @@ -247,7 +248,7 @@ void bsbfly_update(void){ pitch_setIdeal(sp34); func_802A3404(); if(sp30){ - player_setYVelocity(sp30 * 400.0); + baphysics_set_vertical_velocity(sp30 * 400.0); } if(!sp30){ animctrl_setDuration(aCtrl, 0.62f); @@ -259,19 +260,19 @@ void bsbfly_update(void){ if(animctrl_isAt(aCtrl, 0.1358f)){ func_8030EBC8(SFX_2_CLAW_SWIPE, 0.6f, 0.7f, 0x2710, 0x2ee0); } - gravity_set(-300.0f); + baphysics_set_gravity(-300.0f); if(miscflag_isTrue(9)){ - func_80297BF8(0.0f); - func_80297A0C(0); + baphysics_set_terminal_velocity(0.0f); + baphysics_set_velocity(0); sp38 = 0.0f; } else if(sp3C <= 80.0f){ - func_80297BF8(ml_map_f(sp3C, 60.0f, 80.0f, -99.9f, -1000.33)); - gravity_set(ml_map_f(sp3C, 60.0f, 80.0f, -300.0f, -700.0f)); + baphysics_set_terminal_velocity(ml_map_f(sp3C, 60.0f, 80.0f, -99.9f, -1000.33)); + baphysics_set_gravity(ml_map_f(sp3C, 60.0f, 80.0f, -300.0f, -700.0f)); sp38 = ml_map_f(sp3C, 60.0f, 80.0f, 600.0f, 60.0f); } else{ - func_80297BF8(ml_map_f(sp3C, 300.0f, 310.0f, -399.99f, -99.9f)); + baphysics_set_terminal_velocity(ml_map_f(sp3C, 300.0f, 310.0f, -399.99f, -99.9f)); sp38 = ml_map_f(sp3C, 300.0f, 340.0f, 0.0f, 600.0f); }//L802A3E18 @@ -281,8 +282,8 @@ void bsbfly_update(void){ if(sp4C != NULL && -1.0 < sp40[1]) sp38 = 0.0f; - func_8029797C(yaw_get()); - func_80297970(sp38); + baphysics_set_target_yaw(yaw_get()); + baphysics_set_target_horizontal_velocity(sp38); if(should_beak_bust()) sp54 = BS_F_BBUSTER; @@ -321,12 +322,12 @@ int bsbfly_bombHitboxActive(void){ void func_802A3F9C(void){ f32 sp1C[3]; baanim_playForDuration_once(ASSET_43_ANIM_BSBFLY_BEAKBOMB_START, 1.0f); - func_8029C7F4(1,1,3,7); + func_8029C7F4(1,1,3,BA_PHYSICS_FREEZE); func_802A339C(D_8037D338, sp1C, 4200.0f); yaw_setIdeal(sp1C[1] + 180.0f); pitch_setIdeal(sp1C[0]); roll_setIdeal(0.0f); - func_80297A0C(D_8037D338); + baphysics_set_velocity(D_8037D338); pitch_setIdeal(sp1C[0]); func_8029E070(1); func_802914CC(4); @@ -375,7 +376,7 @@ void func_802A411C(void) { switch (D_8037D344) { case 0: if (animctrl_isAt(sp58, 0.6905f)) { - func_802978DC(8); + baphysics_set_type(BA_PHYSICS_UNK8); func_802914CC(5); ncDynamicCam5_func_802BF590(&D_8037D338); animctrl_setDuration(sp58, 0.05f); @@ -453,15 +454,15 @@ void func_802A4430(void){ animctrl_setDuration(plyr_animctrl, 0.38f); animctrl_setPlaybackType(plyr_animctrl, ANIMCTRL_LOOP); animctrl_start(plyr_animctrl, "bsbfly.c", 0x38a); - func_8029C7F4(1, 1, 3, 3); + func_8029C7F4(1, 1, 3, BA_PHYSICS_LOCKED_ROTATION); func_8029E070(1); func_802A3430(); func_80293D74(); func_80294378(1); roll_setIdeal(0.0f); pitch_setIdeal(0.0f); - gravity_reset(); - func_80297B94(); + baphysics_reset_gravity(); + baphysics_reset_terminal_velocity(); baModel_setYDisplacement(0.0f); func_80299CF4(SFX_31_BANJO_OHHWAAOOO, 1.0f, 0x7fff); func_80299D2C(SFX_61_CARTOONY_FALL, 1.0f, 0x7fff); @@ -472,7 +473,7 @@ void func_802A4430(void){ void func_802A4548(void){ s32 next_state = 0; f32 sp20[3]; - _get_velocity(sp20); + baphysics_get_velocity(sp20); switch(D_8037D344){ case 0://L802A457C if(func_8028B254(0x5A)){ @@ -528,7 +529,7 @@ void func_802A46C8(void) { void bsbfly_beakbomb_crash_init(void) { baanim_playForDuration_once(ASSET_3E_ANIM_BSBFLY_BEAKBOMB_CRASH, 1.4f); - func_8029C7F4(1, 1, 3, 3); + func_8029C7F4(1, 1, 3, BA_PHYSICS_LOCKED_ROTATION); func_8029E070(1); FUNC_8030E624(SFX_1F_HITTING_AN_ENEMY_3, 0.8f, 32750); func_80299CF4(SFX_36_BANJO_DOH, 1.0f, 28000); @@ -552,7 +553,7 @@ void func_802A47E0(void) { func_80299CF4(SFX_38_BANJO_AYE_1, 1.0f, 22000); } if (animctrl_isAt(sp1C, 0.92f)) { - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); } if (animctrl_getAnimTimer(sp1C) < 0.8) { func_802929F8(); @@ -639,17 +640,17 @@ void func_802A4A78(s32 arg0) { func_80257F18(sp30, sp3C, &sp28); yaw_setIdeal(mlNormalizeAngle(sp28 + 180.0f)); yaw_applyIdeal(); - func_80297970(sp20); - func_8029797C(sp28); - func_802979AC(sp28, func_80297A64()); + baphysics_set_target_horizontal_velocity(sp20); + baphysics_set_target_yaw(sp28); + baphysics_set_horizontal_velocity(sp28, baphysics_get_target_horizontal_velocity()); if ((arg0 == 1) && (map_get() == MAP_90_GL_BATTLEMENTS)) { yaw_setIdeal(mlNormalizeAngle(sp28)); yaw_applyIdeal(); } - func_8029C7F4(1, 1, 2, 3); - player_setYVelocity(800.0f); - gravity_set(sp2C); - func_80297BF8(-4000.0f); + func_8029C7F4(1, 1, 2, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_vertical_velocity(800.0f); + baphysics_set_gravity(sp2C); + baphysics_set_terminal_velocity(-4000.0f); func_8029E070(1); func_802914CC(4); ncDynamicCam4_func_802BFE50(12.0f, 10000.0f, 800.0f); @@ -671,7 +672,7 @@ void func_802A4C34(s32 arg0) { } void func_802A4C88(s32 arg0) { - func_80297B3C(); + baphysics_reset(); baMarker_collisionOn(); func_80297CA8(); func_8029E070(0); @@ -716,16 +717,16 @@ void func_802A4D90(void) { func_80257F18(sp1C, player_position, &sp34); yaw_setIdeal(mlNormalizeAngle(sp34 + 180.0f)); yaw_applyIdeal(); - func_80297970(1300.0f); - func_8029797C(sp34); - func_802979AC(sp34, func_80297A64()); + baphysics_set_target_horizontal_velocity(1300.0f); + baphysics_set_target_yaw(sp34); + baphysics_set_horizontal_velocity(sp34, baphysics_get_target_horizontal_velocity()); if (map_get() == MAP_90_GL_BATTLEMENTS) { yaw_setIdeal(mlNormalizeAngle(sp34)); yaw_applyIdeal(); } - func_8029C7F4(1, 1, 2, 3); - player_setYVelocity(400.0f); - gravity_set(-1800.0f); + func_8029C7F4(1, 1, 2, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_vertical_velocity(400.0f); + baphysics_set_gravity(-1800.0f); baMarker_collisionOff(); func_802914CC(4); ncDynamicCam4_func_802BFE50(12.0f, 10000.0f, 800.0f); @@ -748,14 +749,14 @@ void func_802A4EC8(void) { } void func_802A4F44(void){ - gravity_reset(); + baphysics_reset_gravity(); baMarker_collisionOn(); func_802A34C8(); } void func_802A4F74(void) { baanim_playForDuration_loopSmooth(ASSET_38_ANIM_BSBFLY, 0.62f); - func_8029C7F4(1, 1, 3, 7); + func_8029C7F4(1, 1, 3, BA_PHYSICS_FREEZE); func_8029E070(1); func_802914CC(4); func_802A3430(); @@ -808,15 +809,15 @@ void func_802A50F8(void){ void func_802A5120(void){ baanim_playForDuration_loop(ASSET_68_ANIM_BSJUMP_TUMBLE, 0.35f); - func_8029C7F4(1,1,3,6); - func_80297970(0.0f); - func_80297A0C(0); - player_setYVelocity(2000.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); + baphysics_set_target_horizontal_velocity(0.0f); + baphysics_set_velocity(0); + baphysics_set_vertical_velocity(2000.0f); func_80299CF4(SFX_63_BANJO_UWAAAAOOH, 1.0f, 32000); } void func_802A5190(void){ - player_setYVelocity(2000.0f); + baphysics_set_vertical_velocity(2000.0f); bs_setState(0); } diff --git a/src/core2/bs/bLongLeg.c b/src/core2/bs/bLongLeg.c index 4d72f617..c2c0bd94 100644 --- a/src/core2/bs/bLongLeg.c +++ b/src/core2/bs/bLongLeg.c @@ -4,6 +4,7 @@ #include "core2/ba/model.h" #include "core2/statetimer.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" /* .data */ @@ -39,9 +40,9 @@ void func_802A5208(int arg0){ void func_802A524C(void){ f32 sp1C = func_8029B30C(); if(!func_8029B300()) - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); else - func_80297970(ml_interpolate_f(sp1C, D_80364A40, D_80364A44)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, D_80364A40, D_80364A44)); } int bslongleg_inSet(s32 move_indx){ @@ -125,8 +126,8 @@ void bsblongleg_enter_init(void){ __bsblongleg_enterFromTrot(); else __bsblongleg_enter(); - func_8029C7F4(1,1,3,2); - func_80297970(0.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_802A5374(); func_80299BD4(); } @@ -156,8 +157,8 @@ void bsblongleg_enter_end(void){ void bsblongleg_stand_enter(void){ baanim_playForDuration_loopSmooth(ASSET_41_ANIM_BSLONGLEG_IDLE, 1.0f); - func_8029C7F4(1,1,1,2); - func_80297970(0.0f); + func_8029C7F4(1,1,1, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); baModel_setDirection(PLAYER_MODEL_DIR_KAZOOIE); func_802A5374(); } @@ -202,7 +203,7 @@ void bsblongleg_walk_init(void){ animctrl_setIndex(aCtrl, ASSET_42_ANIM_BSLONGLEG_WALK); animctrl_setPlaybackType(aCtrl, ANIMCTRL_LOOP); animctrl_start(aCtrl, "bsblongleg.c", 0x1a1); - func_8029C7F4(2,1,1,2); + func_8029C7F4(2,1,1, BA_PHYSICS_NORMAL); baanim_setVelocityMapRanges(D_80364A40, D_80364A44, D_80364A48, D_80364A4C); } @@ -220,10 +221,10 @@ void bsblongleg_walk_update(void){ func_802A5208(1); func_802A524C(); - if(button_pressed(BUTTON_B) && func_80297A64() == 0.0f) + if(button_pressed(BUTTON_B) && baphysics_get_target_horizontal_velocity() == 0.0f) stateTimer_clear(STATE_TIMER_2_LONGLEG); - if(!func_8029B300() && func_80297C04(1.0f)) + if(!func_8029B300() && baphysics_is_slower_than(1.0f)) next_state = BS_26_LONGLEG_IDLE; if(player_shouldSlideTrot()) @@ -273,7 +274,7 @@ void bsblongleg_exit_init(void){ func_802A5AB0(); baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); func_8029957C(2); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); D_8037D361 = func_8030D90C(); sfxsource_setSfxId(D_8037D361, SFX_2C_PULLING_NOISE); func_8030E04C(D_8037D361, 1.4f, 0.4f, -1.2f); @@ -322,14 +323,14 @@ void bsblongleg_jump_init(void){ animctrl_setSubRange(aCtrl, 0.0f, 0.42f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bsblongleg.c", 0x27F); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f) yaw_setIdeal(func_8029B33C()); - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802A524C(); - func_802979AC(yaw_getIdeal(), func_80297A64()); - player_setYVelocity(D_80364A50); - gravity_set(D_80364A54); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(D_80364A50); + baphysics_set_gravity(D_80364A54); func_8030E58C(SFX_48_KAZOOIE_RUUH, 0.9f); D_8037D360 = 0; } @@ -342,9 +343,9 @@ void bsblongleg_jump_update(void){ func_802A531C(); func_802A524C(); - _get_velocity(&sp34); + baphysics_get_velocity(sp34); if(button_released(BUTTON_A) && 0.0f < sp34[1]) - gravity_reset(); + baphysics_reset_gravity(); sp30 = player_getYPosition() - func_80294438(); switch(D_8037D360){ @@ -400,7 +401,7 @@ void bsblongleg_jump_update(void){ } void bsblongleg_jump_end(void){ - gravity_reset(); + baphysics_reset_gravity(); func_802A5404(); } @@ -412,14 +413,14 @@ void bsblongleg_slide_init(void){ animctrl_setPlaybackType(aCtrl, ANIMCTRL_STOPPED); animctrl_setStart(aCtrl, 0.0865f); animctrl_start(aCtrl, "bsblongleg.c", 0x339); - func_8029C7F4(1,1,3,3); - func_8029797C(yaw_getIdeal()); - func_802979AC(yaw_getIdeal(), func_80297A64()); + func_8029C7F4(1,1,3, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_target_yaw(yaw_getIdeal()); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); func_8029E070(1); func_8029E064(1); pitch_setAngVel(1000.0f, 12.0f); roll_setAngularVelocity(1000.0f, 12.0f); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); func_80299AAC(); D_8037D358 = 1.0f; } @@ -437,8 +438,8 @@ void bsblongleg_slide_update(void){ func_80294480(sp30); func_8025801C(sp30, &sp2C); func_80299594(1, 0.5f); - func_80297970(ml_map_f(pitch_getIdeal(), 20.0f, 60.0f, 550.0f, 700.0f)); - func_8029797C(sp2C); + baphysics_set_target_horizontal_velocity(ml_map_f(pitch_getIdeal(), 20.0f, 60.0f, 550.0f, 700.0f)); + baphysics_set_target_yaw(sp2C); func_8029C22C(); }else{//L802A6304 sp3C = BS_26_LONGLEG_IDLE; @@ -463,8 +464,8 @@ void func_802A6388(f32 arg0){ void func_802A6394(void){ baanim_playForDuration_loopSmooth(ASSET_41_ANIM_BSLONGLEG_IDLE, 1.0f); - func_8029C7F4(1,1,3,2); - func_80297970(0.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_802A5374(); baModel_setDirection(PLAYER_MODEL_DIR_KAZOOIE); func_8029C674(); diff --git a/src/core2/bs/bPeck.c b/src/core2/bs/bPeck.c index 63ee5a16..18e27bf3 100644 --- a/src/core2/bs/bPeck.c +++ b/src/core2/bs/bPeck.c @@ -3,6 +3,8 @@ #include "variables.h" #include "core2/yaw.h" +#include "core2/ba/physics.h" + void baModel_80292048(s32, f32, f32, f32); void animctrl_start(AnimCtrl *, char *, s32); @@ -38,11 +40,11 @@ void bsbpeck_init(void){ func_80293240(2); baanim_playForDuration_onceSmooth(ASSET_1A_ANIM_BSBPECK, 0.2f); - func_8029C7F4(1,YAW_STATE_3_BOUNDED, 1, 6); + func_8029C7F4(1,YAW_STATE_3_BOUNDED, 1, BA_PHYSICS_AIRBORN); yaw_setVelocityBounded(1200.0f, 10.0f); func_8029E070(1); - gravity_set(D_80364A60); - player_setYVelocity(D_80364A64); + baphysics_set_gravity(D_80364A60); + baphysics_set_vertical_velocity(D_80364A64); baModel_80292048(1, -38.0f, 0.0f, 105.0f); baModel_80292048(0, -38.0f, 0.0f, -7.0f); baMarker_8028D638(0x23, 0x2A); @@ -66,7 +68,7 @@ void func_802A664C(void){ } miscflag_set(MISC_FLAG_5_HAS_PECKED); func_8030E58C(SFX_42_KAZOOIE_RAH, sp1C); - player_setYVelocity(D_80364A64); + baphysics_set_vertical_velocity(D_80364A64); D_8037D375++; } @@ -76,7 +78,7 @@ void bsbpeck_update(void){ func_802B6FA8(); if(D_8037D377){ - func_80297970(func_80297A64() * 0.1); + baphysics_set_target_horizontal_velocity(baphysics_get_target_horizontal_velocity() * 0.1); } switch(D_8037D374){ @@ -134,5 +136,5 @@ void bsbpeck_end(void){ baModel_80292048(0, 0.0f, 0.0f, 0.0f); baMarker_8028D638(0, 0); func_8029E070(0); - gravity_reset(); + baphysics_reset_gravity(); } diff --git a/src/core2/bs/bShock.c b/src/core2/bs/bShock.c index 40151c1f..815da98c 100644 --- a/src/core2/bs/bShock.c +++ b/src/core2/bs/bShock.c @@ -1,6 +1,8 @@ #include #include "functions.h" -#include "variables.h"s +#include "variables.h" + +#include "core2/ba/physics.h" /* .data */ const f32 D_80364A70 = 1250.0f; @@ -21,14 +23,14 @@ void bsbshock_charge_init(void){ animctrl_setSubRange(aCtrl, 0.0f, 0.1061f); animctrl_setPlaybackType(aCtrl,1); animctrl_start(aCtrl, "bsbshock.c", 0x61); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f) yaw_setIdeal(func_8029B33C()); - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802B6FA8(); - func_802979AC(yaw_getIdeal(), func_80297A64()); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); func_8029E064(1); func_8029E070(1); func_80299BD4(); @@ -55,9 +57,9 @@ void bsbshock_charge_update(void){ func_8029C348(); } func_802B6FA8(); - _get_velocity(sp1C); + baphysics_get_velocity(sp1C); if(button_released(BUTTON_A) && 0.0f < sp1C[1]){ - gravity_reset(); + baphysics_reset_gravity(); } switch(D_8037D381){ @@ -89,7 +91,7 @@ void bsbshock_charge_update(void){ D_8037D380 = 0; }//L802A6CF4 if(func_8028B2E8()) - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); } else{//L802A6D18 if(should_flap()) @@ -102,7 +104,7 @@ void bsbshock_charge_update(void){ sp2C = BS_BSHOCK_JUMP; if(animctrl_isAt(aCtrl, 0.5551f)){ - player_setYVelocity(180.0f); + baphysics_set_vertical_velocity(180.0f); baModel_80292158(0.0f); func_80298528(50.0f); } @@ -132,16 +134,16 @@ void bsbshock_init(void){ animctrl_setSubRange(aCtrl, 0.0f, 1.0f); animctrl_setPlaybackType(aCtrl,1); animctrl_start(aCtrl, "bsbshock.c", 0x13a); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f) yaw_setIdeal(func_8029B33C()); - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802B6FA8(); - func_802979AC(yaw_getIdeal(), func_80297A64()); - player_setYVelocity(D_80364A70); - gravity_set(D_80364A74); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(D_80364A70); + baphysics_set_gravity(D_80364A74); func_8030E484(SFX_E_SHOCKSPRING_BOING); func_8029E064(1); func_8029E070(1); @@ -157,12 +159,12 @@ void bsbshock_update(void){ AnimCtrl * aCtrl = baanim_getAnimCtrlPtr(); func_802B6FA8(); - _get_velocity(sp20); + baphysics_get_velocity(sp20); if(animctrl_isAt(aCtrl, 0.7f)) func_8030E484(SFX_53_BANJO_HUIII); if(button_released(BUTTON_A) && 0.0f < sp20[1]) - gravity_reset(); + baphysics_reset_gravity(); if(D_8037D381 == 0){ func_8029C348(); @@ -186,7 +188,7 @@ void bsbshock_update(void){ void bsbshock_end(void){ if(bs_getNextState() != BS_11_BPECK) - gravity_reset(); + baphysics_reset_gravity(); func_8029E064(0); func_8029E070(0); diff --git a/src/core2/bs/bSwim.c b/src/core2/bs/bSwim.c index f536cd78..82d47f8a 100644 --- a/src/core2/bs/bSwim.c +++ b/src/core2/bs/bSwim.c @@ -3,6 +3,8 @@ #include "variables.h" #include "core2/ba/model.h" +#include "core2/ba/physics.h" + extern f32 func_8029494C(void); extern f32 func_8029B2D0(void); @@ -17,12 +19,12 @@ u8 D_8037D396; f32 D_8037D398; void func_802A7140() { - func_8029C7F4(1, 3, 3, 9); + func_8029C7F4(1, 3, 3, BA_PHYSICS_NO_GRAVITY); } f32 func_802A716C() { f32 sp24[3]; - _get_velocity(sp24); + baphysics_get_velocity(sp24); ml_map_f(gu_sqrtf((sp24[0] * sp24[0]) + (sp24[1] * sp24[1]) + (sp24[2] * sp24[2])), 50.0f, 200.0f, 0.0f, 1.0f); } @@ -71,14 +73,14 @@ void func_802A744C(void) { func_8035644C(FILEPROG_AC_DIVE_OILY_WATER); } roll_setAngularVelocity(30.0f, 0.9f); - gravity_set(0.0f); - func_80297BF8(-399.99f); + baphysics_set_gravity(0.0f); + baphysics_set_terminal_velocity(-399.99f); func_8029B324(0, 0.03f); func_8029B324(1, 1.0f); func_8029E070(1); func_80294378(3); baModel_setYDisplacement(60.0f); - func_80297B64(2.0f); + baphysics_set_acceleration(2.0f); } @@ -102,8 +104,8 @@ void func_802A75B0(void) { if (!bsbswim_inSet(bs_getNextState())) { pitch_setIdeal(0.0f); roll_setIdeal(0.0f); - func_80297B94(); - gravity_reset(); + baphysics_reset_terminal_velocity(); + baphysics_reset_gravity(); func_8029B0C0(); func_8029E070(0); func_80294378(1); @@ -114,9 +116,9 @@ void func_802A75B0(void) { void func_802A762C() { baanim_playForDuration_loopSmooth(0x70, 2.0f); func_802A7140(); - func_80297930(0); + baphysics_set_target_velocity(0); func_802A744C(); - func_80297B64(0.4f); + baphysics_set_acceleration(0.4f); } void func_802A7674() { @@ -162,7 +164,7 @@ void func_802A7738(void) { func_802A7140(); func_802A744C(); D_8037D390 = 0.0f; - func_80297B64(1.0f); + baphysics_set_acceleration(1.0f); func_802906A4(2); } @@ -174,8 +176,8 @@ void func_802A77D8(void) { sp34 = pitch_get(); sp30 = yaw_get(); func_80256E24(sp24, sp34, sp30, 0.0f, 0.0f, D_8037D390); - func_80297930(sp24); - func_80297A0C(sp24); + baphysics_set_target_velocity(sp24); + baphysics_set_velocity(sp24); } void func_802A7838(void) { @@ -237,7 +239,7 @@ void func_802A7A54() { func_802A7140(); func_802A744C(); D_8037D390 = 120.0f; - func_80297B64(2.0f); + baphysics_set_acceleration(2.0f); func_802906A4(2); } @@ -291,10 +293,10 @@ void func_802A7BD0(void) { func_80257F18(sp24, sp30, &sp3C); yaw_setIdeal(mlNormalizeAngle(sp3C)); yaw_applyIdeal(); - func_80297970(func_802987D4()); - func_8029797C(sp3C); - func_802979AC(sp3C, func_80297A64()); - func_8029C7F4(1, 1, 2, 3); + baphysics_set_target_horizontal_velocity(func_802987D4()); + baphysics_set_target_yaw(sp3C); + baphysics_set_horizontal_velocity(sp3C, baphysics_get_target_horizontal_velocity()); + func_8029C7F4(1, 1, 2, BA_PHYSICS_LOCKED_ROTATION); baMarker_collisionOff(); func_80292E48(); func_802A744C(); @@ -333,7 +335,7 @@ void bsSwim_dive_init(void) { baanim_playForDuration_once(ASSET_3C_ANIM_BSSWIM_DIVE_ENTER, 1.0f); func_802A7140(); yaw_setVelocityBounded(500.0f, 5.0f); - func_80297930(0); + baphysics_set_target_velocity(0); func_802A744C(); pitch_setAngVel(200.0f, 2.5f); func_80299BD4(); @@ -357,7 +359,7 @@ void func_802A7E2C(void) { sp34 = pitch_get(); sp30 = yaw_get(); func_80256E24(sp24, sp34, sp30, 0.0f, 0.0f, 800.0f); - func_80297A0C(sp24); + baphysics_set_velocity(sp24); func_8029E3C0(1, 0.8f); D_8037D396 = TRUE; } @@ -394,9 +396,9 @@ void func_802A7F6C(void) { baanim_playForDuration_loopSmooth(ASSET_B9_ANIM_BSSWIM_DIE, 0.7f); func_802A7140(); func_802A744C(); - func_80297B64(1.0f); - func_80297930(0); - func_80297A0C(0); + baphysics_set_acceleration(1.0f); + baphysics_set_target_velocity(0); + baphysics_set_velocity(0); pitch_setIdeal(275.0f); roll_setIdeal(0.0f); D_8037D396 = 0; @@ -415,8 +417,8 @@ void func_802A8098(void) { next_state = 0; func_80256E24(sp40, -90.0f, 0.0f, 0.0f, 0.0f, 100.0f); - func_80297930(sp40); - func_80297A0C(sp40); + baphysics_set_target_velocity(sp40); + baphysics_set_velocity(sp40); func_8029E22C(1); if( func_8029E284(1, 0.2f) || func_8029E284(1, 0.8f) @@ -437,7 +439,7 @@ void func_802A8098(void) { next_state = BS_2D_SWIM_IDLE; } if (func_8029E314(1, 1.55f)) { - player_setYVelocity(-50.0f); + baphysics_set_vertical_velocity(-50.0f); } if (func_8029E284(1, 1.9f)) { func_802914CC(0xD); @@ -487,8 +489,8 @@ void func_802A8330(void) { void func_802A83C0(void) { baanim_playForDuration_loopSmooth(0x70, 2.0f); func_802A7140(); - func_80297930(0); - func_80297B64(0.4f); + baphysics_set_target_velocity(0); + baphysics_set_acceleration(0.4f); func_802A744C(); func_802A8330(); } @@ -535,10 +537,10 @@ void func_802A846C(void) { animctrl_start(temp_s0, "bsbswim.c", 0x41E); } D_8037D398 = ml_map_f(sp28, 40.0f, 1000.0f, -300.0f, -1200.0f); - player_setYVelocity(D_8037D398); - func_8029C7F4(1, 3, 3, 9); + baphysics_set_vertical_velocity(D_8037D398); + func_8029C7F4(1, 3, 3, BA_PHYSICS_NO_GRAVITY); func_802A744C(); - func_802978DC(6); + baphysics_set_type(BA_PHYSICS_AIRBORN); } void func_802A85EC(void) { @@ -554,7 +556,7 @@ void func_802A85EC(void) { particleEmitter_emitN(sp34, 1); if (D_8037D398 < 0.0f) { D_8037D398 += ml_max_f(mlAbsF(D_8037D398) * 0.1, 50.0f); - player_setYVelocity(D_8037D398); + baphysics_set_vertical_velocity(D_8037D398); } if (func_8028B2E8()) { next_state = BS_2D_SWIM_IDLE; @@ -562,7 +564,7 @@ void func_802A85EC(void) { if (!player_inWater()) { next_state = BS_1_IDLE; } - if (_get_vertVelocity() >= 0.0f) { + if (baphysics_get_vertical_velocity() >= 0.0f) { next_state = BS_2D_SWIM_IDLE; } bs_setState(next_state); diff --git a/src/core2/bs/bTrot.c b/src/core2/bs/bTrot.c index 6d9b4948..3a1f7bc8 100644 --- a/src/core2/bs/bTrot.c +++ b/src/core2/bs/bTrot.c @@ -3,8 +3,9 @@ #include "variables.h" #include "core2/ba/model.h" -#include "core2/statetimer.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" +#include "core2/statetimer.h" /* .data */ f32 D_80364A90 = 30.0f; @@ -42,7 +43,7 @@ void func_802A880C(s32 arg0){ void func_802A8850(void){ if( button_pressed(BUTTON_B) && stateTimer_isActive(STATE_TIMER_3_TURBO_TALON) - && func_80297A64() == 0.0f + && baphysics_get_target_horizontal_velocity() == 0.0f ){ stateTimer_clear(STATE_TIMER_3_TURBO_TALON); } @@ -90,10 +91,10 @@ f32 func_802A8984(void){ void func_802A89D4(void){ f32 sp24 = func_8029B30C(); if(!func_8029B300()){ - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); } else{ - func_80297970(ml_interpolate_f(sp24, func_802A8900(), func_802A88B0())); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp24, func_802A8900(), func_802A88B0())); } } @@ -213,8 +214,8 @@ enum bs_e func_802A8D84(enum bs_e arg0){ void bsbtrot_enter_init(void){ func_802A8AD8(); baanim_playForDuration_onceSmooth(ASSET_16_ANIM_BSBTROT_ENTER, 1.0f); - func_8029C7F4(1,1,2,2); - func_80297970(0.0f); + func_8029C7F4(1,1,2, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_802A8A40(); func_80299BD4(); func_802952A8(0,0); @@ -242,8 +243,8 @@ void bsbtrot_enter_end(void){ void bsbtrot_stand_init(void){ baanim_playForDuration_loopSmooth(ASSET_26_ANIM_BSBTROT_IDLE, 1.2f); - func_8029C7F4(1,1,1,2); - func_80297970(0.0f); + func_8029C7F4(1,1,1, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_802A8A40(); } @@ -272,7 +273,7 @@ void func_802A9054(void){ f32 tmp = 1.0f; baanim_setVelocityMapRanges(func_802A8900(), func_802A88B0(), func_802A8984(), func_802A8934()); if(func_8028B394()){ - tmp = ml_map_f(func_80297AF0(), 0.0f, 1.0f, 0.6f, 0.9f); + tmp = ml_map_f(baphysics_get_horizontal_velocity_percentage(), 0.0f, 1.0f, 0.6f, 0.9f); baanim_scaleDuration(tmp); } else{ @@ -282,7 +283,7 @@ void func_802A9054(void){ void bsbtrot_walk_init(void){ baanim_playForDuration_loopSmooth(func_802A9030(), 0.53f); - func_8029C7F4(2,1,1,2); + func_8029C7F4(2,1,1, BA_PHYSICS_NORMAL); func_802A8A40(); func_802A9054(); } @@ -312,7 +313,7 @@ void bsbtrot_walk_update(void){ if(animctrl_isAt(aCtrl, 0.2115f) || animctrl_isAt(aCtrl, 0.7115f)) func_802A87C0(); } - if(!func_8029B300() && func_80297C04(1.0f)) + if(!func_8029B300() && baphysics_is_slower_than(1.0f)) sp1C = BS_15_BTROT_IDLE; if(func_8028B094()) @@ -355,15 +356,15 @@ void bsbtrot_jump_init(void){ baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); yaw_setUpdateState(1); func_8029957C(3); - func_802978DC(6); + baphysics_set_type(BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f) yaw_setIdeal(func_8029B33C()); - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802A89D4(); - func_802979AC(yaw_getIdeal(), func_80297A64()); - player_setYVelocity(D_80364ABC); - gravity_set(D_80364AC0); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(D_80364ABC); + baphysics_set_gravity(D_80364AC0); func_8030E484(SFX_48_KAZOOIE_RUUH); D_8037D3A4 = 0; } @@ -377,13 +378,13 @@ void bsbtrot_jump_update(void){ func_802A87C0(); if(miscflag_isTrue(0xF)) - func_802978A4(); + baphysics_reset_horizontal_velocity(); else func_802A89D4(); - _get_velocity(sp1C); + baphysics_get_velocity(sp1C); if(button_released(BUTTON_A) && 0.0f < sp1C[1]) - gravity_reset(); + baphysics_reset_gravity(); switch(D_8037D3A4){ case 0://L802A9530 @@ -411,13 +412,13 @@ void bsbtrot_jump_update(void){ animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); func_8029957C(1); D_8037D3A4 = 3; - if(220.0f < func_80297A64()) + if(220.0f < baphysics_get_target_horizontal_velocity()) func_80299AAC(); func_8029C22C(); } break; case 3://L802A9660 - if(220.0f < func_80297A64()) + if(220.0f < baphysics_get_target_horizontal_velocity()) func_80299AAC(); func_802A9320(); func_80299628(1); @@ -430,7 +431,7 @@ void bsbtrot_jump_update(void){ func_8029C22C(); break; case 4://L802A96F0 - if(220.0f < func_80297A64()) + if(220.0f < baphysics_get_target_horizontal_velocity()) func_80299AAC(); func_802A9320(); @@ -444,7 +445,7 @@ void bsbtrot_jump_update(void){ func_8029C22C(); break; case 5://L802A9780 - if(220.0f < func_80297A64()) + if(220.0f < baphysics_get_target_horizontal_velocity()) func_80299AAC(); func_802A9320(); func_80299628(1); @@ -474,14 +475,14 @@ void bsbtrot_jump_update(void){ } void bsbtrot_jump_end(void){ - gravity_reset(); + baphysics_reset_gravity(); func_802A8BB0(); } void bsbtrot_exit_init(void){ baanim_playForDuration_onceSmooth(ASSET_7_ANIM_BSBTROT_EXIT, 0.6f); baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); } void bsbtrot_exit_update(void){ @@ -504,14 +505,14 @@ void bsbtrot_slide_init(void){ animctrl_setPlaybackType(aCtrl, ANIMCTRL_STOPPED); animctrl_start(aCtrl, "bsbtrot.c", 0x382); func_802A8A40(); - func_8029C7F4(1,1,3,3); - func_8029797C(yaw_getIdeal()); - func_802979AC(yaw_getIdeal(), func_80297A64()); + func_8029C7F4(1,1,3, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_target_yaw(yaw_getIdeal()); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); func_8029E070(1); func_8029E064(1); pitch_setAngVel(1000.0f, 12.0f); roll_setAngularVelocity(1000.0f, 12.0f); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); func_80299AAC(); D_8037D3A0 = 1.0f; } @@ -530,8 +531,8 @@ void bsbtrot_slide_update(void){ func_80294480(sp30); func_8025801C(sp30, &sp2C); func_80299628(1); - func_80297970(ml_map_f(pitch_getIdeal(), 20.0f, 60.0f, 550.0f, 700.0f)); - func_8029797C(sp2C); + baphysics_set_target_horizontal_velocity(ml_map_f(pitch_getIdeal(), 20.0f, 60.0f, 550.0f, 700.0f)); + baphysics_set_target_yaw(sp2C); func_8029C22C(); }else{ sp3C = BS_15_BTROT_IDLE; @@ -572,10 +573,10 @@ void bsbtrot_fall_init(void){ animctrl_setPlaybackType(aCtrl, ANIMCTRL_STOPPED); animctrl_start(aCtrl, "bsbtrot.c", 0x400); func_802A8A40(); - func_8029C7F4(1,1,3,6); - func_8029797C(yaw_getIdeal()); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); + baphysics_set_target_yaw(yaw_getIdeal()); func_802A89D4(); - func_802979AC(yaw_getIdeal(), func_80297A64()); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); D_8037D3A4 = 0; } @@ -588,11 +589,11 @@ void bsbtrot_fall_update(void){ func_802A87C0(); if(miscflag_isTrue(0xf)) - func_802978A4(); + baphysics_reset_horizontal_velocity(); else func_802A89D4(); - _get_velocity(sp1C); + baphysics_get_velocity(sp1C); switch (D_8037D3A4){ case 0://L802A9D90 if(func_8028B254(0x8C)){ @@ -610,7 +611,7 @@ void bsbtrot_fall_update(void){ animctrl_setDuration(aCtrl, 0.9f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); func_8029957C(1); - if(220.0f < func_80297A64()){ + if(220.0f < baphysics_get_target_horizontal_velocity()){ func_80299AAC(); } func_8029C22C(); @@ -618,7 +619,7 @@ void bsbtrot_fall_update(void){ } break; case 2://L802A9E78 - if(220.0f < func_80297A64()) + if(220.0f < baphysics_get_target_horizontal_velocity()) func_80299AAC(); func_802A9320(); @@ -632,7 +633,7 @@ void bsbtrot_fall_update(void){ func_8029C22C(); break; case 3://L802A9F08 - if(220.0f < func_80297A64()) + if(220.0f < baphysics_get_target_horizontal_velocity()) func_80299AAC(); func_802A9320(); @@ -646,7 +647,7 @@ void bsbtrot_fall_update(void){ func_8029C22C(); break; case 4://802A9F98 - if(220.0f < func_80297A64()) + if(220.0f < baphysics_get_target_horizontal_velocity()) func_80299AAC(); func_802A9320(); @@ -679,8 +680,8 @@ void bsbtrot_fall_end(void){ void bsbtrot_unk79_init(void){ baanim_playForDuration_loopSmooth(ASSET_26_ANIM_BSBTROT_IDLE, 1.2f); - func_8029C7F4(1,1,3,2); - func_80297970(0.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_802A8A40(); baModel_setDirection(PLAYER_MODEL_DIR_KAZOOIE); func_8029C674(); @@ -715,14 +716,14 @@ void bsbtrot_ow_init(void){ func_80257F18(sp24, sp30, &sp3C); yaw_setIdeal(mlNormalizeAngle(sp3C + 180.0f));\ yaw_applyIdeal(); - func_80297970(func_802987D4()); - func_8029797C(sp3C); - func_802979AC(sp3C, func_80297A64()); - func_8029C7F4(1,1,2,3); + baphysics_set_target_horizontal_velocity(func_802987D4()); + baphysics_set_target_yaw(sp3C); + baphysics_set_horizontal_velocity(sp3C, baphysics_get_target_horizontal_velocity()); + func_8029C7F4(1,1,2, BA_PHYSICS_LOCKED_ROTATION); if(func_802987B4() == 2) - func_802978DC(6); - player_setYVelocity(func_802987C4()); - gravity_set(func_802987E4()); + baphysics_set_type(BA_PHYSICS_AIRBORN); + baphysics_set_vertical_velocity(func_802987C4()); + baphysics_set_gravity(func_802987E4()); baMarker_collisionOff(); func_80292E48(); } @@ -749,7 +750,7 @@ void bsbtrot_ow_update(void){ void bsbtrot_ow_end(void){ func_80297CA8(); - gravity_reset(); + baphysics_reset_gravity(); baMarker_collisionOn(); func_80292EA4(); func_802A8BB0(); diff --git a/src/core2/bs/bWhirl.c b/src/core2/bs/bWhirl.c index 3ffe3549..a3563d32 100644 --- a/src/core2/bs/bWhirl.c +++ b/src/core2/bs/bWhirl.c @@ -3,6 +3,7 @@ #include "variables.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" const f32 D_80364AD0 = 80.0f; const f32 D_80364AD4 = 425.0f; @@ -19,9 +20,9 @@ u8 D_8037D3B4; void func_802AA400(void){ f32 sp1C = func_8029B30C(); if(!func_8029B300()){ - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); }else{ - func_80297970(ml_interpolate_f(sp1C, D_80364AD0, D_80364AD4)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, D_80364AD0, D_80364AD4)); } } @@ -79,8 +80,8 @@ void func_802AA58C(enum bs_e *arg0){ void bsbwhirl_enter_init(void){ baanim_playForDuration_onceSmooth(ASSET_22_ANIM_BSWHIRL_EXIT, 0.5f); - func_8029C7F4(1,1,1,2); - func_80297970(0.0f); + func_8029C7F4(1,1,1, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_8029B324(0, 0.03f); func_8029B324(1, 1.0f); func_8029E070(1); @@ -107,8 +108,8 @@ void bsbwhirl_enter_end(void){ void bsbwhirl_stand_init(void){ baanim_playForDuration_loopSmooth(ASSET_23_ANIM_BSWONDERWING_IDLE, 1.0f); - func_8029C7F4(1,1,1,2); - func_80297970(0.0f); + func_8029C7F4(1,1,1, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); } void bsbwhirl_stand_update(void){ @@ -134,8 +135,7 @@ void bsbwhirl_stand_end(void){ void bsbwhirl_walk_init(void){ baanim_playForDuration_loopSmooth(ASSET_11_ANIM_BSWHIRL_WALK, 0.53f); baanim_setVelocityMapRanges(D_80364AD0, D_80364AD4, D_80364AD8, D_80364ADC); - func_8029C7F4(2,1,1,2); - + func_8029C7F4(2,1,1, BA_PHYSICS_NORMAL); } void bsbwhirl_walk_update(void){ @@ -145,7 +145,7 @@ void bsbwhirl_walk_update(void){ func_8029AD28(0.97f, 3); func_802AA400(); - if(!func_8029B300() && func_80297C04(1.0f)) + if(!func_8029B300() && baphysics_is_slower_than(1.0f)) sp1C = BS_1B_WONDERWING_IDLE; if(button_released(BUTTON_Z)) @@ -180,15 +180,15 @@ void bsbwhirl_jump_init(void){ animctrl_setSubRange(aCtrl, 0.0f, 0.4495f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bsbwhirl.c", 0x181); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3,BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f) yaw_setIdeal(func_8029B33C()); - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802AA400(); - func_802979AC(yaw_getIdeal(), func_80297A64()); - player_setYVelocity(D_80364AE0); - gravity_set(D_80364AE4); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(D_80364AE0); + baphysics_set_gravity(D_80364AE4); func_80299B58(0.91f, 1.09f); D_8037D3B4 = 0; } @@ -200,9 +200,9 @@ void bsbwhirl_jump_update(void){ __bsbwhirl_spawnSparkle(); func_802AA400(); - _get_velocity(&sp1C); + baphysics_get_velocity(sp1C); if(button_released(BUTTON_A) && 0.0f < sp1C[1]) - gravity_reset(); + baphysics_reset_gravity(); switch(D_8037D3B4){ case 0://L802AAB48 @@ -236,7 +236,7 @@ void bsbwhirl_jump_update(void){ } void bsbwhirl_jump_end(void){ - gravity_reset(); + baphysics_reset_gravity(); __bsbwhirl_end(); } @@ -252,7 +252,7 @@ void bsbwhirl_exit_init(void){ animctrl_start(aCtrl, "bsbwhirl.c", 0x201); baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); func_8029957C(2); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); comusic_8025AB44(COMUSIC_25_USING_GOLD_FEATHERS, 0.0f, 0xFA0); } @@ -285,8 +285,8 @@ void bsbwhirl_drone_end(void){ void func_802AADBC(void){ baanim_playForDuration_loopSmooth(ASSET_23_ANIM_BSWONDERWING_IDLE, 1.0f); - func_8029C7F4(1,1,3,2); - func_80297970(0.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_8029C674(); } diff --git a/src/core2/bs/bbuster.c b/src/core2/bs/bbuster.c index bd2602c3..0aece6cd 100644 --- a/src/core2/bs/bbuster.c +++ b/src/core2/bs/bbuster.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + /*.data*/ const f32 D_80364990 = 400.0f; const f32 D_80364994 = -800.0f; @@ -62,11 +64,11 @@ void bsbbuster_init(void){ animctrl_setSubRange(aCtrl, 0.0f, 0.35f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bsbbuster.c", 0x81); - func_8029C7F4(1,1,3,6); - gravity_set(0.0f); - func_80297970(0.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); + baphysics_set_gravity(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); ml_vec3f_clear(sp20); - func_80297A0C(sp20); + baphysics_set_velocity(sp20); func_8029E070(1); func_802A02B4(0); D_8037D2B9 = 0; @@ -101,16 +103,16 @@ void bsbbuster_update(void){ case 1://8029FE24 D_8037D2B0 -= time_getDelta(); if(D_8037D2B0 <= 0.0f){ - gravity_reset(); - func_80297BF8(D_803649A8); - gravity_set(D_803649A4); - player_setYVelocity(D_803649A0); + baphysics_reset_gravity(); + baphysics_set_terminal_velocity(D_803649A8); + baphysics_set_gravity(D_803649A4); + baphysics_set_vertical_velocity(D_803649A0); D_8037D2B7 = 1; D_8037D2BA = 2; } break; case 2://8029FEA0 - if(D_8037D2B5 == 0 && _get_vertVelocity() < 0.0f){ + if(D_8037D2B5 == 0 && baphysics_get_vertical_velocity() < 0.0f){ func_8030E760(SFX_45_KAZOOIE_HUGHH, 1.2f, 0x7530); D_8037D2B5++; } @@ -137,9 +139,9 @@ void bsbbuster_update(void){ func_802BB3DC( 0, 45.0f, 0.71f); func_8029AE74(0); func_8029FB30(); - func_80297A0C(0); - gravity_set(0.0f); - func_80297970(0.0f); + baphysics_set_velocity(0); + baphysics_set_gravity(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); D_8037D2B7 = 2; D_8037D2B8 = 1; D_8037D2B0 = 0.09f; @@ -160,11 +162,11 @@ void bsbbuster_update(void){ D_8037D2B0 -= time_getDelta(); if(D_8037D2B0 <= 0.0f){ if(D_8037D2BB){ - player_setYVelocity(D_80364990); - gravity_set(D_80364994); + baphysics_set_vertical_velocity(D_80364990); + baphysics_set_gravity(D_80364994); }else{ - player_setYVelocity(D_80364998); - gravity_set(D_8036499C); + baphysics_set_vertical_velocity(D_80364998); + baphysics_set_gravity(D_8036499C); } animctrl_setSubRange(aCtrl, 0.0f, 0.7299f); @@ -196,8 +198,8 @@ void bsbbuster_update(void){ }//L802A024C void bsbbuster_end(void){ - gravity_reset(); - func_80297B94(); + baphysics_reset_gravity(); + baphysics_reset_terminal_velocity(); func_8029E070(0); D_8037D2B7 = 0; D_8037D2B8 = 0; diff --git a/src/core2/bs/beeFly.c b/src/core2/bs/beeFly.c index f6f15945..6a44ba47 100644 --- a/src/core2/bs/beeFly.c +++ b/src/core2/bs/beeFly.c @@ -2,20 +2,18 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + + void func_80354030(f32*, f32); f32 func_8029B2E8(void); f32 func_8029B33C(void); -void func_8029797C(f32); -void func_80297970(f32); void baModel_setYDisplacement(f32); -void func_80297BF8(f32); void ncDynamicCam4_func_802BFE50(f32, f32, f32); void yaw_setVelocityBounded(f32, f32); f32 func_8029B2D0(void); f32 func_8029B2DC(void); -f32 func_80297A64(void); -void func_802979AC(f32, f32); void func_8028FDC8(f32); void func_80290B40(f32); void func_80290A6C(void); @@ -45,13 +43,13 @@ void func_802A04F0(void){ void func_802A0590(void){ func_802A0340(); baanim_playForDuration_onceSmooth(0x1df, 1.5f); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f){ yaw_setIdeal(func_8029B33C()); } - func_8029797C(yaw_getIdeal()); - func_80297970(0.0f); - gravity_set(-1200.0f); + baphysics_set_target_yaw(yaw_getIdeal()); + baphysics_set_target_horizontal_velocity(0.0f); + baphysics_set_gravity(-1200.0f); D_8037D2C0 = 0; } @@ -64,7 +62,7 @@ void func_802A0630(void){ case 0: if(!animctrl_isAt(mvmnt, 0.266f)) break; - player_setYVelocity(1600.0f); + baphysics_set_vertical_velocity(1600.0f); func_8030E58C(SFX_C_TAKING_FLIGHT_LIFTOFF, 0.7f); D_8037D2C0 = 1; break; @@ -72,7 +70,7 @@ void func_802A0630(void){ func_802A04F0(); if(animctrl_isStopped(mvmnt)) baanim_playForDuration_loopSmooth(ASSET_1DC_ANIM_BEE_FLY, 0.38f); - if(_get_vertVelocity() < 0.0f) + if(baphysics_get_vertical_velocity() < 0.0f) next_state = BS_BEE_FLY; break; } @@ -98,8 +96,8 @@ void _bsbeefly_end(void){ roll_setIdeal(0.0f); pitch_setIdeal(0.0f); func_80291548(); - gravity_reset(); - func_80297B94(); + baphysics_reset_gravity(); + baphysics_reset_terminal_velocity(); func_8028FFBC(0); func_8029099C(); } @@ -111,8 +109,8 @@ void func_802A07F8(void){ yaw_setUpdateState(3); roll_setAngularVelocity(500.0f, 2.0f); func_802A0724(); - gravity_set(-300.0f); - func_80297BF8(-99.9f); + baphysics_set_gravity(-300.0f); + baphysics_set_terminal_velocity(-99.9f); func_8028FEF0(); func_8028FFBC(1); func_802909C4(); @@ -153,13 +151,13 @@ void bsbeefly_enter(void){ mvmnt = bs_getPrevState(); baanim_playForDuration_loopSmooth(ASSET_1DC_ANIM_BEE_FLY, 0.38); - func_8029C7F4(1, 1, 3, 3); + func_8029C7F4(1, 1, 3, BA_PHYSICS_LOCKED_ROTATION); if(miscflag_isTrue(9)) - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); else - func_80297970(600.0f); - func_802979AC(yaw_getIdeal(), func_80297A64()); - func_8029797C(yaw_getIdeal()); + baphysics_set_target_horizontal_velocity(600.0f); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802914CC(4); func_802A07F8(); if(mvmnt != 0x8b){ @@ -200,7 +198,7 @@ void bsbeefly_update(void){ sp40 += *sp24; sp3C = pitch_get(); sp30 = 0.0f; - if(_get_vertVelocity() < 0.0f){ + if(baphysics_get_vertical_velocity() < 0.0f){ if(sp3C < 300.0f){ sp30 = ml_map_f(sp3C, 0.0f, 80.0f, 0.0f, 0.23f); } @@ -228,7 +226,7 @@ void bsbeefly_update(void){ pitch_setIdeal(sp40); func_802A0750(); if(sp44 != 0){ - player_setYVelocity(sp44*400.0); + baphysics_set_vertical_velocity(sp44*400.0); func_802A04F0(); } if((s32)sp24 == (s32)&D_803649C4){ @@ -238,23 +236,23 @@ void bsbeefly_update(void){ break; }//L802A0DF0 if(miscflag_isTrue(9)){ - func_80297BF8(0.0f); - func_80297A0C(0); + baphysics_set_terminal_velocity(0.0f); + baphysics_set_velocity(0); sp38 = 0.0f; }else{ if(sp3C <= 80.0f){ - func_80297BF8(ml_map_f(sp3C, 60.0f, 80.0f, -99.9, -1266.66)); + baphysics_set_terminal_velocity(ml_map_f(sp3C, 60.0f, 80.0f, -99.9, -1266.66)); sp38 = ml_map_f(sp3C, 60.0f, 80.0f, 600.0f, 60.0f); }else{ - func_80297BF8(ml_map_f(sp3C, 300.0f, 310.0f, -399.99, -99.9)); + baphysics_set_terminal_velocity(ml_map_f(sp3C, 300.0f, 310.0f, -399.99, -99.9)); sp38 = ml_map_f(sp3C, 300.0f, 340.0f, 0.0f, 600.0f); } } - func_8029797C(yaw_get()); + baphysics_set_target_yaw(yaw_get()); if(button_held(9)){ sp38 += (f64)sp38; } - func_80297970(sp38); + baphysics_set_target_horizontal_velocity(sp38); if(func_8028B2E8() && !player_inWater()) sp4C = BS_85_BEE_IDLE; func_8028FFF0(); diff --git a/src/core2/bs/beeMain.c b/src/core2/bs/beeMain.c index 675d4cc1..016e2567 100644 --- a/src/core2/bs/beeMain.c +++ b/src/core2/bs/beeMain.c @@ -2,13 +2,12 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + f32 func_8029B41C(void); void func_8029E3C0(s32, f32); void func_80299628(s32); void yaw_applyIdeal(void); -void func_8029797C(f32); -f32 func_80297A64(void); -void func_802979AC(f32, f32); void ncDynamicCamD_func_802BF2C0(f32); f32 baanim_getTimer(void); @@ -51,18 +50,18 @@ void func_802A1020(void){ sp1c = func_8029B30C(); if(func_8029B300() == 0){ - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); } else{ - func_80297970(ml_interpolate_f(sp1c, D_803649E0, D_803649E4)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1c, D_803649E0, D_803649E4)); } } void func_802A1080(void){ func_802A0340(); baanim_playForDuration_loopSmooth(ASSET_1DE_ANIM_BEE_IDLE,3.0f); - func_8029C7F4(1,1,1,2); - func_80297970(0.0f); + func_8029C7F4(1,1,1, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_802900B4(); } @@ -97,7 +96,7 @@ void func_802A117C(void){ void func_802A11A4(void){ func_802A0340(); baanim_playForDuration_loopSmooth(ASSET_1DD_ANIM_BEE_WALK, 0.38f); - func_8029C7F4(2,1,1,2); + func_8029C7F4(2,1,1, BA_PHYSICS_NORMAL); baanim_setVelocityMapRanges(D_803649E0, D_803649E4, D_803649E8, D_803649EC); func_802900B4(); } @@ -110,7 +109,7 @@ void func_802A1214(void){ func_802A1020(); func_8029AD28(0.94f, 4); func_8029AD28(0.44f, 3); - if(func_8029B300() == 0 && func_80297C04(1.0f)) + if(func_8029B300() == 0 && baphysics_is_slower_than(1.0f)) s0 = BS_85_BEE_IDLE; if(func_8028B094()) @@ -143,15 +142,15 @@ void func_802A12FC(void){ animctrl_setDuration(s0, 1.2f); animctrl_setPlaybackType(s0, ANIMCTRL_ONCE); animctrl_start(s0, "bsbeemain.c", 0x15b); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f){ yaw_setIdeal(func_8029B33C()); } - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802A1020(); - func_802979AC(yaw_getIdeal(), func_80297A64()); - player_setYVelocity(D_803649F0); - gravity_set(D_803649F4); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(D_803649F0); + baphysics_set_gravity(D_803649F4); func_802A0FB4(); D_8037D2D4 = 0; } @@ -164,9 +163,9 @@ void func_802A1438(void){ sp2c = 0; sp28 = baanim_getAnimCtrlPtr(); func_802A1020(); - _get_velocity(sp1c); + baphysics_get_velocity(sp1c); if(button_released(BUTTON_A) && (0.0f < sp1c[1])){ - gravity_reset(); + baphysics_reset_gravity(); } switch (D_8037D2D4) { @@ -198,7 +197,7 @@ void func_802A1438(void){ case 3: func_80299628(0); if(animctrl_isStopped(sp28)){ - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); sp2c = BS_85_BEE_IDLE; } break; @@ -222,7 +221,7 @@ void func_802A1438(void){ void func_802A163C(void){ func_802A02C0(); - gravity_reset(); + baphysics_reset_gravity(); } void func_802A1664(void){ @@ -237,7 +236,7 @@ void func_802A1664(void){ animctrl_setSubRange(s0, 0, 0.51f); animctrl_setPlaybackType(s0, ANIMCTRL_ONCE); animctrl_start(s0, "bsbeemain.c", 0x1e2); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); D_8037D2D4 = 0; } @@ -250,7 +249,7 @@ void func_802A170C(void){ sp28 = baanim_getAnimCtrlPtr(); func_80299628(0); func_802A1020(); - _get_velocity(sp1c); + baphysics_get_velocity(sp1c); switch(D_8037D2D4){ case 0: if(func_8028B254(0x82)){ @@ -262,7 +261,7 @@ void func_802A170C(void){ func_80299628(0); if(func_8028B2E8()){ func_802A0F90(); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); baanim_setEndAndDuration(1.0f, 0.7f); D_8037D2D4 = 2; } @@ -270,7 +269,7 @@ void func_802A170C(void){ case 2: func_80299628(0); if(animctrl_isStopped(sp28)){ - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); sp2c = BS_85_BEE_IDLE; } break; @@ -325,12 +324,12 @@ void func_802A18E8(s32 arg0){ func_80257F18(sp20, sp2C, &sp38); yaw_setIdeal(mlNormalizeAngle(sp38 + 180.0f)); yaw_applyIdeal(); - func_80297970(200.0f); - func_8029797C(sp38); - func_802979AC(sp38, func_80297A64()); - func_8029C7F4(1, 1, 2, 3); - player_setYVelocity(510.0f); - gravity_set(-1200.0f); + baphysics_set_target_horizontal_velocity(200.0f); + baphysics_set_target_yaw(sp38); + baphysics_set_horizontal_velocity(sp38, baphysics_get_target_horizontal_velocity()); + func_8029C7F4(1, 1, 2, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_vertical_velocity(510.0f); + baphysics_set_gravity(-1200.0f); baMarker_collisionOff(); func_80292E48(); D_8037D2D4 = 0; @@ -363,7 +362,7 @@ void func_802A1A50(void){ void func_802A1B28(void){ func_80297CA8(); - gravity_reset(); + baphysics_reset_gravity(); baMarker_collisionOn(); func_80292EA4(); func_802A02C0(); @@ -409,18 +408,18 @@ void bsbeemain_die_init(void){ animctrl_setDuration(sp3C, 1.7f); animctrl_setPlaybackType(sp3C, ANIMCTRL_ONCE); animctrl_start(sp3C, "bsbeemain.c", 0x2ef); - func_8029C7F4(1,1,2,3); + func_8029C7F4(1,1,2, BA_PHYSICS_LOCKED_ROTATION); _player_getPosition(sp2C); func_80294980(sp20); func_80257F18(sp20, sp2C, &sp38); yaw_setIdeal(mlNormalizeAngle(sp38 + 180.0f)); yaw_applyIdeal(); D_8037D2D0 = 250.f; - func_80297970(D_8037D2D0); - func_8029797C(sp38); - func_802979AC(sp38, func_80297A64()); - player_setYVelocity(420.0f); - gravity_set(-1200.0f); + baphysics_set_target_horizontal_velocity(D_8037D2D0); + baphysics_set_target_yaw(sp38); + baphysics_set_horizontal_velocity(sp38, baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(420.0f); + baphysics_set_gravity(-1200.0f); pitch_setAngVel(1000.0f, 12.0f); baMarker_collisionOff(); func_80292E48(); @@ -433,7 +432,7 @@ void bsbeemain_die_init(void){ } void func_802A1DD8(void){ - func_80297970(D_8037D2D0); + baphysics_set_target_horizontal_velocity(D_8037D2D0); func_80299628(0); switch(D_8037D2D4){ case 0: @@ -442,7 +441,7 @@ void func_802A1DD8(void){ baanim_setEnd(0.7453f); FUNC_8030E624(SFX_1F_HITTING_AN_ENEMY_3, 0.8f, 18000); FUNC_8030E624(SFX_39_BANJO_AYE_2, 1.8f, 18000); - player_setYVelocity(400.0f); + baphysics_set_vertical_velocity(400.0f); D_8037D2D4 = 1; break; case 1: @@ -471,7 +470,7 @@ void func_802A1DD8(void){ void func_802A1F2C(void){ func_8024BD08(0); - gravity_reset(); + baphysics_reset_gravity(); func_80291548(); func_80292EA4(); func_802A02C0(); @@ -480,8 +479,8 @@ void func_802A1F2C(void){ void func_802A1F6C(void){ func_802A0340(); baanim_playForDuration_loopSmooth(ASSET_1DE_ANIM_BEE_IDLE, 3.0f); - func_8029C7F4(1,1,3,2); - func_80297970(0.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_8029C674(); func_802B3A50(); } @@ -518,8 +517,8 @@ void func_802A2098(void){ miscflag_clear(0x1A); baanim_playForDuration_loopSmooth(ASSET_1DE_ANIM_BEE_IDLE, 3.0f); yaw_setIdeal(func_8029B41C()); - func_8029C7F4(1,1,3,2); - func_80297970(0.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_8024BD08(0); func_8025A2FC(0, 0xFA0); func_8025A6EC(COMUSIC_42_NOTEDOOR_OPENING_FANFARE, -1); diff --git a/src/core2/bs/carry.c b/src/core2/bs/carry.c index cf6f7d4f..726ef183 100644 --- a/src/core2/bs/carry.c +++ b/src/core2/bs/carry.c @@ -4,6 +4,7 @@ #include "bsint.h" #include "core2/statetimer.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" /* .data */ const f32 D_80364AF0 = 30.0f; @@ -14,9 +15,9 @@ const f32 D_80364AFC = 0.4f; void func_802AAE80(void){ f32 sp1C = func_8029B30C(); if(func_8029B300() == 0) - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); else - func_80297970(ml_interpolate_f(sp1C, D_80364AF0, D_80364AF4)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, D_80364AF0, D_80364AF4)); } void func_802AAEE0(void){ @@ -34,8 +35,8 @@ void bscarry_idle_init(void){ animctrl_setIndex(aCtrl, ASSET_72_ANIM_BSCARRY_IDLE); animctrl_setDuration(aCtrl, 1.2f); animctrl_start(aCtrl, "bscarry.c", 0x6f); - func_8029C7F4(1,1,1,2); - func_80297970(0.0f); + func_8029C7F4(1,1,1, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); pitch_setAngVel(1000.0f, 12.0f); roll_setAngularVelocity(1000.0f, 12.0f); } @@ -63,7 +64,7 @@ void bscarry_walk_init(void){ animctrl_setDuration(aCtrl, 0.8f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_LOOP); animctrl_start(aCtrl, "bscarry.c", 0xac); - func_8029C7F4(2,1,1,2); + func_8029C7F4(2,1,1, BA_PHYSICS_NORMAL); baanim_setVelocityMapRanges(D_80364AF0, D_80364AF4, D_80364AF8, D_80364AFC); } @@ -72,7 +73,7 @@ void bscarry_walk_update(void){ func_8029AD28(0.4f, 4); func_8029AD28(0.9f, 3); func_802AAE80(); - if(func_8029B300() == 0 && func_80297C04(1.0f)) + if(func_8029B300() == 0 && baphysics_is_slower_than(1.0f)) sp1C = BS_3A_CARRY_IDLE; if(carriedobj_getMarker() == NULL) diff --git a/src/core2/bs/claw.c b/src/core2/bs/claw.c index af05634e..a87b216b 100644 --- a/src/core2/bs/claw.c +++ b/src/core2/bs/claw.c @@ -1,7 +1,7 @@ #include #include "functions.h" #include "variables.h" - +#include "core2/ba/physics.h" void func_802915CC(f32); @@ -17,9 +17,9 @@ int bsclaw_hitboxActive(void){ void bsclaw_init(void){ baanim_playForDuration_once(ASSET_5_ANIM_BSPUNCH, 1.3f); - func_8029C7F4(1,1,3,3); - func_8029797C(yaw_getIdeal()); - func_80297970(160.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_target_yaw(yaw_getIdeal()); + baphysics_set_target_horizontal_velocity(160.0f); func_802915CC(80.0f); _bsclawHitboxActive = 0; } @@ -37,7 +37,7 @@ void bsclaw_update(void){ || animctrl_isAt(aCtrl, 0.5788f) || (0.4788 < sp24 && sp24 < 0.6788); if(animctrl_isAt(aCtrl, 0.5788f)) - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); func_8029AD28(0.08f, 3); func_8029AD28(0.34f, 4); diff --git a/src/core2/bs/climb.c b/src/core2/bs/climb.c index c3bc7bc0..322fc9a1 100644 --- a/src/core2/bs/climb.c +++ b/src/core2/bs/climb.c @@ -2,6 +2,7 @@ #include "functions.h" #include "variables.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" /* .bss */ u8 D_8037D3D0; @@ -24,7 +25,7 @@ void func_802AB5C0(void){ sp2C[0] = 0.0f; sp2C[1] = f2; sp2C[2] = 0.0f; - func_80297930(sp2C); + baphysics_set_target_velocity(sp2C); } void func_802AB654(void){ @@ -33,8 +34,8 @@ void func_802AB654(void){ yaw_setVelocityBounded(500.0f, 15.0f); func_8029B324(0, 0.03f); func_8029B324(1, 1.0f); - func_802978DC(0xA); - func_80297B64(10.0f); + baphysics_set_type(BA_PHYSICS_CLIMB); + baphysics_set_acceleration(10.0f); func_80294378(5); func_80293D48(80.0f, 10.0f); func_802914CC(0x10); @@ -45,7 +46,7 @@ void func_802AB6F0(void){ func_80291548(); func_8029B0C0(); baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); - func_802978DC(2); + baphysics_set_type(BA_PHYSICS_NORMAL); func_80294378(1); func_80293D74(); } @@ -56,7 +57,7 @@ void func_802AB750(f32 arg0, f32 arg1){ } int func_802AB788(void){ - return (0.0f < mlAbsF(func_80297A70())) || (yaw_get() != yaw_getIdeal()); + return (0.0f < mlAbsF(baphysics_get_target_vertical_velocity())) || (yaw_get() != yaw_getIdeal()); } int bsclimb_inSet(s32 move_indx){ @@ -160,15 +161,15 @@ void bsclimb_move_update(void){ func_80299D2C(SFX_D3_JINXIE_SNIFFLING_1, 0.87f, 22000); }//L802ABB84 - if(!func_802AB788() && _get_vertVelocity() < 30.0f) + if(!func_802AB788() && baphysics_get_vertical_velocity() < 30.0f) next_state = BS_4F_CLIMB_IDLE; _player_getPosition(plyr_pos); - if(func_80297A70() < 0.0f && climbGetBottomY() == plyr_pos[1]) + if(baphysics_get_target_vertical_velocity() < 0.0f && climbGetBottomY() == plyr_pos[1]) next_state = BS_1_IDLE; if( func_8029825C() == 2 - && 0.0f < func_80297A70() + && 0.0f < baphysics_get_target_vertical_velocity() && climbGetTopY() == plyr_pos[1] ){ next_state = BS_51_CLIMB_EXIT; @@ -194,7 +195,7 @@ void func_802ABCCC(void){ baanim_playForDuration_loopSmooth(ASSET_B2_ANIM_BSCLIMB_IDLE_2, 2.64f); baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); func_802AB654(); - func_802978DC(7); + baphysics_set_type(BA_PHYSICS_FREEZE); } //bsclimb_unknown_9E_update diff --git a/src/core2/bs/croc.c b/src/core2/bs/croc.c index a7748f1c..1999a6ee 100644 --- a/src/core2/bs/croc.c +++ b/src/core2/bs/croc.c @@ -3,6 +3,7 @@ #include "variables.h" #include "core2/statetimer.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" int bscroc_inSet(enum bs_e state); @@ -68,10 +69,10 @@ void func_802ABE70(void){ void func_802ABF54(void){ f32 sp1C = func_8029B30C(); if(func_8029B300() == 0){ - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); } else{ - func_80297970(ml_interpolate_f(sp1C, bsCrocMinWalkVelocity, __bscroc_getMaxVelocity())); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, bsCrocMinWalkVelocity, __bscroc_getMaxVelocity())); } } @@ -103,8 +104,8 @@ int bscroc_inSet(enum bs_e state){ void bscroc_idle_init(void){ baanim_playForDuration_loopSmooth(0xe1, 1.0f); - func_8029C7F4(1,1,1,2); - func_80297970(0.0f); + func_8029C7F4(1,1,1, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); pitch_setAngVel(1000.0f, 12.0f); roll_setAngularVelocity(1000.0f, 12.0f); func_80293D48(50.0f, 25.0f); @@ -144,7 +145,7 @@ void bscroc_idle_end(void){ void bscroc_walk_init(void){ baanim_playForDuration_loopStartingAt(ASSET_E0_ANIM_BSCROC_WALK, 0.8f, 0.4f); - func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1,2); + func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ, 1, 1, BA_PHYSICS_NORMAL); baanim_setVelocityMapRanges(bsCrocMinWalkVelocity, bsCrocMaxWalkVelocity, bsCrocSlowestWalkDuration, bsCrocFastestWalkDuration); func_802900B4(); } @@ -158,7 +159,7 @@ void bscroc_walk_update(void){ func_8029AD28(0.1f, 4); func_8029AD28(0.6f, 3); - if(func_8029B300() == 0 && func_80297C04(1.0f)) + if(func_8029B300() == 0 && baphysics_is_slower_than(1.0f)) next_state = BS_5E_CROC_IDLE; if(func_8028B094()) @@ -189,15 +190,15 @@ void bscroc_jump_init(void){ animctrl_setStart(aCtrl, 0.1f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bscroc.c", 0x1ac); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f){ yaw_setIdeal(func_8029B33C()); } - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802ABF54(); - func_802979AC(yaw_getIdeal(), func_80297A64()); - player_setYVelocity(bsCrocInitialJumpVelocity); - gravity_set(bsCrocGravity); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(bsCrocInitialJumpVelocity); + baphysics_set_gravity(bsCrocGravity); __bscroc_jumpSfx(); D_8037D3EC = 0; } @@ -209,9 +210,9 @@ void bscroc_jump_update(void){ func_802ABE70(); func_802ABF54(); - _get_velocity(player_velocity); + baphysics_get_velocity(player_velocity); if(button_released(BUTTON_A) && 0.0f < player_velocity[1]) - gravity_reset(); + baphysics_reset_gravity(); switch(D_8037D3EC){ case 0: @@ -243,7 +244,7 @@ void bscroc_jump_update(void){ case 3: func_80299628(0); if(animctrl_isStopped(aCtrl)){ - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); sp2C = BS_5E_CROC_IDLE; } break; @@ -264,7 +265,7 @@ void bscroc_jump_update(void){ } void bscroc_jump_end(void){ - gravity_reset(); + baphysics_reset_gravity(); func_802ABFBC(); } @@ -277,7 +278,7 @@ void bscroc_fall_init(void){ animctrl_setDuration(aCtrl, 0.7f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_STOPPED); animctrl_start(aCtrl, "bscroc.c", 0x235); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); D_8037D3EC = 0; } @@ -289,7 +290,7 @@ void bscroc_fall_update(void){ func_802ABE70(); func_80299628(0); func_802ABF54(); - _get_velocity(player_velocity); + baphysics_get_velocity(player_velocity); switch(D_8037D3EC){ case 0: @@ -301,7 +302,7 @@ void bscroc_fall_update(void){ case 1: if(func_8028B2E8()){ func_8029AE48(); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); baanim_setEndAndDuration(1.0f, 1.0f); D_8037D3EC = 2; } @@ -348,12 +349,12 @@ static void __bscroc_recoil_init(s32 damage){ func_80257F18(sp20, player_position, &sp38); yaw_setIdeal(mlNormalizeAngle(sp38 + 180.0f)); yaw_applyIdeal(); - func_80297970(200.0f); - func_8029797C(sp38); - func_802979AC(sp38, func_80297A64()); - func_8029C7F4(1,1,2,3); - player_setYVelocity(510.0f); - gravity_set(-1200.0f); + baphysics_set_target_horizontal_velocity(200.0f); + baphysics_set_target_yaw(sp38); + baphysics_set_horizontal_velocity(sp38, baphysics_get_target_horizontal_velocity()); + func_8029C7F4(1,1,2, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_vertical_velocity(510.0f); + baphysics_set_gravity(-1200.0f); baMarker_collisionOff(); func_80292E48(); D_8037D3EC = 0; @@ -383,7 +384,7 @@ static void __bscroc_recoil_update(void){ void __bscroc_recoil_end(void){ func_80297CA8(); - gravity_reset(); + baphysics_reset_gravity(); baMarker_collisionOn(); func_80292EA4(); func_802ABFBC(); @@ -427,18 +428,18 @@ void bscroc_die_init(void){ animctrl_setDuration(aCtrl, 1.7f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bscroc.c", 0x32b); - func_8029C7F4(1,1,2,3); + func_8029C7F4(1,1,2, BA_PHYSICS_LOCKED_ROTATION); _player_getPosition(player_position); func_80294980(sp20); func_80257F18(sp20, player_position, &sp38); yaw_setIdeal(mlNormalizeAngle(sp38 + 180.0f)); yaw_applyIdeal(); D_8037D3E0 = 250.0f; - func_80297970(D_8037D3E0); - func_8029797C(sp38); - func_802979AC(sp38, func_80297A64()); - player_setYVelocity(420.0f); - gravity_set(-1200.0f); + baphysics_set_target_horizontal_velocity(D_8037D3E0); + baphysics_set_target_yaw(sp38); + baphysics_set_horizontal_velocity(sp38, baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(420.0f); + baphysics_set_gravity(-1200.0f); pitch_setAngVel(1000.0f, 12.0f); baMarker_collisionOff(); func_80292E48(); @@ -453,7 +454,7 @@ void bscroc_die_init(void){ void bscroc_die_update(void){ enum bs_e next_state = 0; func_802ABE70(); - func_80297970(D_8037D3E0); + baphysics_set_target_horizontal_velocity(D_8037D3E0); func_80299628(0); switch(D_8037D3EC){ case 0: @@ -461,7 +462,7 @@ void bscroc_die_update(void){ baanim_setEnd(0.7453f); FUNC_8030E624(SFX_1F_HITTING_AN_ENEMY_3, 0.8f, 18000); FUNC_8030E624(SFX_39_BANJO_AYE_2, 1.8f, 18000); - player_setYVelocity(400.0f); + baphysics_set_vertical_velocity(400.0f); D_8037D3EC = 1; } break; @@ -490,7 +491,7 @@ void bscroc_die_update(void){ void bscroc_die_end(void){ func_8024BD08(0); - gravity_reset(); + baphysics_reset_gravity(); pitch_setIdeal(0.0f); roll_setIdeal(0.0f); func_80291548(); @@ -507,12 +508,12 @@ static void func_802ACF58(void){ sp2C = func_8028B2E8() ? 500.0f : 400.0f; func_802589E4(sp20, yaw_get(), sp2C); sp20[1] = 200.0f; - func_80297A0C(sp20); + baphysics_set_velocity(sp20); } void bscroc_bite_init(void){ baanim_playForDuration_loopStartingAt(ASSET_122_ANIM_BSCROC_BITE, 0.25f, 0.2f); - func_8029C7F4(1,1,1,3); + func_8029C7F4(1,1,1, BA_PHYSICS_LOCKED_ROTATION); func_802ACF58(); D_8037D3F4 = 0; _bscrocHitboxActive = TRUE; @@ -561,8 +562,8 @@ void bscroc_bite_end(void){ void bscroc_eat_bad_init(void){ baanim_playForDuration_once(ASSET_123_ANIM_BSCROC_EAT_BAD, 2.41f); - func_8029C7F4(1,1,2,3); - func_80297970(0.0f); + func_8029C7F4(1,1,2, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_target_horizontal_velocity(0.0f); } void bscroc_eat_bad_update(void){ @@ -612,7 +613,7 @@ void func_802AD318(void){ void bscroc_eat_good_init(void){ baanim_playForDuration_loopSmooth(ASSET_122_ANIM_BSCROC_BITE, 0.25f); - func_8029C7F4(1,1,1,2); + func_8029C7F4(1,1,1, BA_PHYSICS_NORMAL); baModel_setPostDraw(func_802AD2A8); D_8037D3E8 = assetcache_get(func_80294974()); D_8037D3F0 = 1.0f; @@ -668,8 +669,8 @@ void bscroc_eat_good_end(void){ void func_802AD56C(void){ baanim_playForDuration_loopSmooth(ASSET_E1_ANIM_BSCROC_IDLE, 1.0f); - func_8029C7F4(1,1,3,2); - func_80297970(0.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_8029C674(); func_802B3A50(); } diff --git a/src/core2/bs/crouch.c b/src/core2/bs/crouch.c index 892aa997..ae771656 100644 --- a/src/core2/bs/crouch.c +++ b/src/core2/bs/crouch.c @@ -2,6 +2,7 @@ #include "functions.h" #include "variables.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" /* .bss */ f32 D_8037D400; @@ -62,16 +63,16 @@ void bscrouch_init(void){ yaw_setVelocityBounded(350.0f, 14.0f); func_8029957C(7); func_8029932C(8.0f); - func_802978DC(3); + baphysics_set_type(BA_PHYSICS_LOCKED_ROTATION); func_8029E3C0(0, 0.7f); func_8029E3C0(1, 0.2f); - _get_velocity(&sp28); + baphysics_get_velocity(sp28); D_8037D400 = gu_sqrtf(sp28[0]*sp28[0] + sp28[2]*sp28[2]); if(140.0f < D_8037D400) func_80299AAC(); if(func_8025801C(sp28, &sp20)) - func_8029797C(sp20); + baphysics_set_target_yaw(sp20); D_8037D404 = 0; } @@ -88,7 +89,7 @@ void bscrouch_update(void){ func_8029E1A8(1); sp30 = ml_map_f(func_8029E270(0), 0.0f, 0.3f, 0.0f, D_8037D400); - func_80297970(sp30); + baphysics_set_target_horizontal_velocity(sp30); if(220.0f < sp30) func_802929F8(); if(160.0f < sp30) diff --git a/src/core2/bs/die.c b/src/core2/bs/die.c index 21ff2bed..dca890d5 100644 --- a/src/core2/bs/die.c +++ b/src/core2/bs/die.c @@ -2,6 +2,7 @@ #include "functions.h" #include "variables.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" /* .bss */ f32 D_8037D410; @@ -41,15 +42,15 @@ void bsdie_init(void){ D_8037D410 = 250.0f; yaw_setIdeal(mlNormalizeAngle(sp38 + 180.0f)); yaw_applyIdeal(); - func_80297970(D_8037D410); - func_8029797C(sp38); - func_802979AC(sp38, func_80297A64()); + baphysics_set_target_horizontal_velocity(D_8037D410); + baphysics_set_target_yaw(sp38); + baphysics_set_horizontal_velocity(sp38, baphysics_get_target_horizontal_velocity()); baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); yaw_setUpdateState(1); func_8029957C(2); - func_802978DC(3); - player_setYVelocity(510.0f); - gravity_set(-1400.0f); + baphysics_set_type(BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_vertical_velocity(510.0f); + baphysics_set_gravity(-1400.0f); pitch_setAngVel(1000.0f, 12.0f); func_8029E070(1); func_8029151C(0xd); @@ -64,14 +65,14 @@ void bsdie_init(void){ void bsdie_update(void){ AnimCtrl *aCtrl = baanim_getAnimCtrlPtr(); enum bs_e sp28 = 0; - func_80297970(D_8037D410); + baphysics_set_target_horizontal_velocity(D_8037D410); func_80299628(0); switch(D_8037D414){ case 0://L802AE0B8 if(_bsdie_802ADE00()){ animctrl_setSubRange(aCtrl, 0.0f, 1.0f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); - player_setYVelocity(400.0f); + baphysics_set_vertical_velocity(400.0f); func_80299DB8(); FUNC_8030E624(SFX_39_BANJO_AYE_2, 1.0f, 18000); rumbleManager_80250D94(1.0f, 1.0f, 0.4f); @@ -124,7 +125,7 @@ void bsdie_update(void){ void bsdie_end(void){ func_8024BD08(0); - gravity_reset(); + baphysics_reset_gravity(); func_8029E070(0); pitch_setIdeal(0.0f); roll_setIdeal(0.0f); diff --git a/src/core2/bs/droneenter.c b/src/core2/bs/droneenter.c index ac332c04..c1bbe4a8 100644 --- a/src/core2/bs/droneenter.c +++ b/src/core2/bs/droneenter.c @@ -1,6 +1,8 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + enum bsdroneenter_state_e{ BSDRONEENTER_SUBSTATE_0_UNINITIALIZED, @@ -108,7 +110,7 @@ void bsDroneEnter_init(void) { func_8029BCF8(&anim_id, &anim_duration); baanim_playForDuration_loopSmooth(anim_id, anim_duration); - func_8029C7F4(1, 1, 3, 7); + func_8029C7F4(1, 1, 3, BA_PHYSICS_FREEZE); func_80294378(6); __bsDroneEnter_init(); bsDroneEnterSubstate = BSDRONEENTER_SUBSTATE_0_UNINITIALIZED; diff --git a/src/core2/bs/dronegoto.c b/src/core2/bs/dronegoto.c index 04b47964..7cbf5cac 100644 --- a/src/core2/bs/dronegoto.c +++ b/src/core2/bs/dronegoto.c @@ -2,7 +2,8 @@ #include "functions.h" #include "variables.h" -void func_80297BB8(f32); +#include "core2/ba/physics.h" + /* .bss */ u8 D_8037D440; @@ -34,11 +35,11 @@ void func_802AEB60(s32 arg0){ } void func_802AEC08(void){ - func_802978A4(); + baphysics_reset_horizontal_velocity(); } void func_802AEC28(void){ - func_802978A4(); + baphysics_reset_horizontal_velocity(); if(func_8028B2E8() || player_inWater()) func_802AEB60(2); } @@ -52,9 +53,9 @@ void func_802AEC78(void){ func_8029BC60(&sp1C, &sp2C); baanim_playForDuration_loopSmooth(sp1C, sp2C); func_802925F8(&sp20, &sp2C); - func_80297BC4(&sp20); - func_80297BB8(sp2C); - func_8029C7F4(1,1,3,0xC); + baphysics_set_goto_position(&sp20); + baphysics_set_goto_duration(sp2C); + func_8029C7F4(1,1,3,BA_PHYSICS_GOTO); func_8029436C(1); D_8037D441 = 0; } @@ -64,7 +65,7 @@ void func_802AECE4(void){ f32 sp20[3]; AnimCtrl *aCtrl = baanim_getAnimCtrlPtr(); - _get_velocity(&sp20); + baphysics_get_velocity(sp20); if(func_8025801C(sp20, &sp2C)){ yaw_setIdeal(sp2C); } @@ -77,7 +78,7 @@ void func_802AECE4(void){ animctrl_start(aCtrl, "bsdronegoto.c", 0x9d); } - if(func_80297C48() && D_8037D441 == 0){ + if(baphysics_goto_done() && D_8037D441 == 0){ D_8037D441++; func_80292768(); } diff --git a/src/core2/bs/dronelook.c b/src/core2/bs/dronelook.c index 9678720f..13017231 100644 --- a/src/core2/bs/dronelook.c +++ b/src/core2/bs/dronelook.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" extern f32 func_8029B2D0(void); @@ -18,9 +19,9 @@ void bsDroneLook_init(void) { func_80299D2C(SFX_12D_CAMERA_ZOOM_CLOSEST, 1.2f, 12000); func_8029BCF8(&anim_id, &anim_duration); baanim_playForDuration_loopSmooth(anim_id, anim_duration); - func_8029C7F4(1, 1, 3, 2); - func_80297970(0.0f); - func_80297A0C(0); + func_8029C7F4(1, 1, 3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); + baphysics_set_velocity(0); ncDynamicCamera_enterFirstPerson(); __bsDroneLook_getEyePos(eye_position); ncFirstPersonCamera_setZoomedOutPosition(eye_position); @@ -42,6 +43,7 @@ void bsDroneLook_update(void) { next_state = 0; dt = time_getDelta(); if (ncFirstPersonCamera_getState() == 2) { + //camera is in "idle" state ncFirstPersonCamera_getZoomedInRotation(eye_rotation); eye_rotation[0] -= func_8029B2DC() * 90.0f * dt; eye_rotation[1] -= func_8029B2D0() * 90.0f * dt; @@ -49,10 +51,13 @@ void bsDroneLook_update(void) { eye_rotation[0] = (eye_rotation[0] > 180.0f) ? ml_max_f(305.0f, eye_rotation[0]) : ml_min_f(70.0f, eye_rotation[0]); ncFirstPersonCamera_setZoomedOutRotation(eye_rotation); yaw_setIdeal(eye_rotation[1] + 180.0f); + exit_first_person = FALSE; + // 1st person cancelled via input if (button_pressed(BUTTON_B) || button_pressed(BUTTON_A) || button_pressed(BUTTON_C_UP)) { exit_first_person = TRUE; } + // 1st person cancelled via entering water if (player_inWater()) { if (player_getTransformation() == TRANSFORM_1_BANJO && func_8028EE84() == BSWATERGROUP_0_NONE) { exit_first_person += TRUE; diff --git a/src/core2/bs/dronevanish.c b/src/core2/bs/dronevanish.c index 0d6cf7c8..2ef91e5f 100644 --- a/src/core2/bs/dronevanish.c +++ b/src/core2/bs/dronevanish.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + /* .bss */ struct { ParticleEmitter *unk0; @@ -93,7 +95,7 @@ void bsDroneVanish_init(void){ func_8029BCF8(&anim_id, &anim_duration); baanim_playForDuration_loopSmooth(anim_id, anim_duration); - func_8029C7F4(1,1,3,7); + func_8029C7F4(1,1,3, BA_PHYSICS_FREEZE); func_80294378(6); __bsDroneVanish_init(); D_8037D468 = 0; diff --git a/src/core2/bs/dronexform.c b/src/core2/bs/dronexform.c index 8f3987c5..6718856e 100644 --- a/src/core2/bs/dronexform.c +++ b/src/core2/bs/dronexform.c @@ -1,10 +1,11 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + extern void player_setYPosition(f32); extern void yaw_applyIdeal(void); -extern void func_802978DC(int); extern f32 func_80257A44(f32, f32); extern f32 cosf(f32); extern f32 ml_remainder_f(f32, f32); @@ -260,14 +261,14 @@ static void __bsdronexform_setState(int next_state){ func_802AFBA0(180.0f); func_802AFBAC(0.04f); func_802B01B0(0.05f); - func_802978DC(7); + baphysics_set_type(BA_PHYSICS_FREEZE); func_8029E3C0(0, 2.8f); FUNC_8030E624(SFX_17E_MUMBO_TRANSFORMATION_01, 1.0f, 15000); break; case 2:// 802B02A8 func_8029E3C0(0, 0.5f); - func_802978DC(0xb); + baphysics_set_type(BA_PHYSICS_TRANSFORM); break; case 3:// 802B02C4 @@ -314,7 +315,7 @@ static void __bsdronexform_setState(int next_state){ case 9:// 802B0438 D_8037D470.unk1C = 0; func_8029E3C0(0, 0.7f); - func_802978DC(7); + baphysics_set_type(BA_PHYSICS_FREEZE); break; } } @@ -324,9 +325,9 @@ void bsdronexform_init(void){ enum asset_e sp18; func_8029BCAC(&sp18, &sp1C); baanim_playForDuration_loopSmooth(sp18, sp1C); - func_8029C7F4(1,1,3,7); - func_80297A0C(0); - func_80297930(0); + func_8029C7F4(1,1,3, BA_PHYSICS_FREEZE); + baphysics_set_velocity(0); + baphysics_set_target_velocity(0); pitch_setIdeal(0.0f); roll_setIdeal(0.0f); func_80294378(6); diff --git a/src/core2/bs/jig.c b/src/core2/bs/jig.c index 15451e66..f412063a 100644 --- a/src/core2/bs/jig.c +++ b/src/core2/bs/jig.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + /* .bss */ u8 D_8037D4B0; u8 D_8037D4B1; @@ -28,8 +30,8 @@ void bsjig_jiggy_init(void){ animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bsjig.c", 0x7f); yaw_setIdeal(func_8029B41C()); //face camera - func_8029C7F4(1,1,3,2); - func_80297970(0.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_8024BD08(0); func_8025A2FC(0,0xfa0); tmp = (item_getCount(ITEM_E_JIGGY) == 9); @@ -169,8 +171,8 @@ void bsjig_notedoor_init(void){ animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bsjig.c", 0x14d); yaw_setIdeal(func_8029B41C()); - func_8029C7F4(1,1,3,2); - func_80297970(0.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); if(bs_getPrevState() != BS_44_JIG_JIGGY){ func_8024BD08(0); func_8025A2FC(0,0xfa0); diff --git a/src/core2/bs/jump.c b/src/core2/bs/jump.c index 10807ba0..9906d298 100644 --- a/src/core2/bs/jump.c +++ b/src/core2/bs/jump.c @@ -5,10 +5,9 @@ #include "core2/ba/model.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" + f32 func_80294438(void); -void func_8029797C(f32); -void func_802979AC(f32, f32); -f32 func_80297A64(void); void func_80299B58(f32, f32); f32 func_8029B2E8(void); f32 func_8029B33C(void); @@ -59,19 +58,19 @@ void bsjump_init(void){ animctrl_setSubRange(aCtrl, 0.0f, 0.5042f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bsjump.c", 0x95); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f){ yaw_setIdeal(func_8029B33C()); } - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802B6FA8(); - func_802979AC(yaw_getIdeal(), func_80297A64()); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); if(D_8037D4C1){ - player_setYVelocity(D_80364CE4); + baphysics_set_vertical_velocity(D_80364CE4); } else { - player_setYVelocity(D_80364CD0); + baphysics_set_vertical_velocity(D_80364CD0); } - gravity_set(D_80364CD4); + baphysics_set_gravity(D_80364CD4); D_8037D4C0 = 0; if(D_8037D4C2){ func_8030E6D4(SFX_33_BANJO_AHOO); @@ -91,14 +90,14 @@ void bsjump_update(void){ func_8029C348(); if(miscflag_isTrue(0xf)){ - func_802978A4(); + baphysics_reset_horizontal_velocity(); }else{ func_802B6FA8(); } - _get_velocity(velocity); + baphysics_get_velocity(velocity); if((button_released(BUTTON_A) && 0.0f < velocity[1] && !D_8037D4C2) || !can_control_jump_height()){ - gravity_reset(); + baphysics_reset_gravity(); } switch(D_8037D4C0){ @@ -166,15 +165,15 @@ void bsjump_end(void){ ability_use(0); if(bs_getNextState() != BS_11_BPECK) - gravity_reset(); + baphysics_reset_gravity(); } void bsjump_fall_init(void){ AnimCtrl *aCtrl = baanim_getAnimCtrlPtr(); int sp20; - if(miscflag_isTrue(7) && 700.0f < _get_vertVelocity()) - player_setYVelocity(700.0f); + if(miscflag_isTrue(7) && 700.0f < baphysics_get_vertical_velocity()) + baphysics_set_vertical_velocity(700.0f); sp20 = (bs_getPrevState() == BS_12_BFLIP)? 0 : 1; animctrl_reset(aCtrl); @@ -183,7 +182,7 @@ void bsjump_fall_init(void){ animctrl_setTransitionDuration(aCtrl, 0.3f); animctrl_setDuration(aCtrl, 0.38f); animctrl_start(aCtrl, "bsjump.c", 0x188); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); D_8037D4C0 = 0; } @@ -193,11 +192,11 @@ void bsjump_fall_update(void){ f32 player_velocity[3]; if(miscflag_isTrue(0xf)) - func_802978A4(); + baphysics_reset_horizontal_velocity(); else func_802B6FA8(); - _get_velocity(player_velocity); + baphysics_get_velocity(player_velocity); switch(D_8037D4C0){ case 0://L802B17B8 @@ -264,12 +263,12 @@ void func_802B1928(void) { baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); yaw_setUpdateState(1); func_8029957C(3); - func_802978DC(3); - func_8029797C(yaw_getIdeal()); - func_80297970(60.0f); - func_802979AC(yaw_getIdeal(), func_80297A64()); - player_setYVelocity(D_80364CDC); - gravity_set(D_80364CE0); + baphysics_set_type(BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_target_yaw(yaw_getIdeal()); + baphysics_set_target_horizontal_velocity(60.0f); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(D_80364CDC); + baphysics_set_gravity(D_80364CE0); func_80294378(6); D_8037D4C0 = 0; func_802B1100(); @@ -282,7 +281,7 @@ void func_802B1A54(void) { next_state = 0; anim_ctrl = baanim_getAnimCtrlPtr(); - _get_velocity(velocity); + baphysics_get_velocity(velocity); if (velocity[1] < 0.0f) { func_80294378(1); } @@ -321,7 +320,7 @@ void func_802B1A54(void) { void func_802B1BCC(void){ func_80294378(1); - gravity_reset(); + baphysics_reset_gravity(); } void func_802B1BF4(void) { @@ -345,9 +344,9 @@ void func_802B1BF4(void) { baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); yaw_setUpdateState(1); func_8029957C(3); - func_802978DC(6); - func_80297970(0.0f); - func_80297A0C(0); + baphysics_set_type(BA_PHYSICS_AIRBORN); + baphysics_set_target_horizontal_velocity(0.0f); + baphysics_set_velocity(0); D_8037D4C0 = 0; baMarker_collisionOff(); } @@ -359,7 +358,7 @@ void func_802B1CF8(void) { next_state = 0; anim_ctrl = baanim_getAnimCtrlPtr(); - _get_velocity(velocity); + baphysics_get_velocity(velocity); switch (D_8037D4C0) { case 0: if (func_8028B254(90)) { @@ -388,7 +387,7 @@ bool bsjump_jumpingFromWater(void){ void bsjump_tumble_init(void){ baanim_playForDuration_loop(ASSET_68_ANIM_BSJUMP_TUMBLE, 0.35f); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); baModel_setYDisplacement(60.0f); if(func_80293234() == 1){ func_8029E3C0(0, 0.5f); diff --git a/src/core2/bs/ow.c b/src/core2/bs/ow.c index 00c7b131..ae4b1034 100644 --- a/src/core2/bs/ow.c +++ b/src/core2/bs/ow.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + void func_802B37DC(void); /* .bss */ @@ -54,7 +56,7 @@ void bsow_update(void) { if (func_8028B2E8() != 0) { sp1C = BS_2_WALK_SLOW; } - if ((player_inWater() != 0) && (_get_vertVelocity() <= 0.0f)) { + if ((player_inWater() != 0) && (baphysics_get_vertical_velocity() <= 0.0f)) { sp1C = BS_4C_LANDING_IN_WATER; } @@ -65,7 +67,7 @@ void bsow_end(void){ func_802B35DC(); func_802B1FD0(0); func_80297CA8(); - gravity_reset(); + baphysics_reset_gravity(); baMarker_collisionOn(); func_80292EA4(); } diff --git a/src/core2/bs/pumpkin.c b/src/core2/bs/pumpkin.c index 21b0ab8b..e87df0ec 100644 --- a/src/core2/bs/pumpkin.c +++ b/src/core2/bs/pumpkin.c @@ -4,6 +4,7 @@ #include "core2/ba/model.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" extern void baanim_playForDuration_loop(s32, f32); extern void func_8029AD68(f32, s32); @@ -43,10 +44,10 @@ void func_802B223C(void) { sp1C = func_8029B30C(); if (func_8029B300() == 0) { - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); return; } - func_80297970(ml_interpolate_f(sp1C, D_80364CF0, D_80364CF4)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, D_80364CF0, D_80364CF4)); } void func_802B229C(void) { @@ -74,8 +75,8 @@ int bspumpkin_inSet(s32 move_indx){ void bspumpkin_idle_init(void) { baanim_playForDuration_loop(ASSET_A0_ANIM_BSPUMPKIN_WALK, 0.8f); - func_8029C7F4(1, 1, 1, 2); - func_80297970(0.0f); + func_8029C7F4(1, 1, 1, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); pitch_setAngVel(1000.0f, 12.0f); roll_setAngularVelocity(1000.0f, 12.0f); func_80293D48(50.0f, 25.0f); @@ -118,7 +119,7 @@ void bspumpkin_walk_init(void) { animctrl_setDuration(anim_ctrl, 0.8f); animctrl_setPlaybackType(anim_ctrl, ANIMCTRL_LOOP); animctrl_start(anim_ctrl, "bspumpkin.c", 0x11D); - func_8029C7F4(2, 1, 1, 2); + func_8029C7F4(2, 1, 1, BA_PHYSICS_NORMAL); baanim_setVelocityMapRanges(D_80364CF0, D_80364CF4, D_80364CF8, D_80364CFC); func_802900B4(); } @@ -130,7 +131,7 @@ void bspumpkin_walk_update(void) { next_state = 0; func_802B223C(); func_8029AD68(0.3f, 4); - if ((func_8029B300() == 0) && func_80297C04(1.0f)) { + if ((func_8029B300() == 0) && baphysics_is_slower_than(1.0f)) { next_state = BS_48_PUMPKIN_IDLE; } if (func_8028B094()) { @@ -157,15 +158,15 @@ void bspumpkin_jump_init(void) { animctrl_setDuration(anim_ctrl, 1.2f); animctrl_setPlaybackType(anim_ctrl, ANIMCTRL_ONCE); animctrl_start(anim_ctrl, "bspumpkin.c", 0x16C); - func_8029C7F4(1, 1, 3, 6); + func_8029C7F4(1, 1, 3, BA_PHYSICS_AIRBORN); if (func_8029B2E8() != 0.0f) { yaw_setIdeal(func_8029B33C()); } - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802B223C(); - func_802979AC(yaw_getIdeal(), func_80297A64()); - player_setYVelocity(D_80364D00); - gravity_set(D_80364D04); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(D_80364D00); + baphysics_set_gravity(D_80364D04); func_802B21D0(); D_8037D4E0 = 0; } @@ -178,13 +179,13 @@ void bspumpkin_jump_update(void) { next_state = 0; anim_ctrl = baanim_getAnimCtrlPtr(); func_802B223C(); - _get_velocity(sp1C); + baphysics_get_velocity(sp1C); if (button_released(BUTTON_A) && sp1C[1] > 0.0f) { - gravity_reset(); + baphysics_reset_gravity(); } switch (D_8037D4E0) { case 0: - if (_get_vertVelocity() < 0.0f) { + if (baphysics_get_vertical_velocity() < 0.0f) { if (func_8028B254(130)) { func_80292E48(); animctrl_setDuration(anim_ctrl, 0.7f); @@ -218,7 +219,7 @@ void bspumpkin_jump_update(void) { case 3: if (animctrl_isStopped(anim_ctrl)) { func_80292EA4(); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); next_state = BS_48_PUMPKIN_IDLE; } break; @@ -236,7 +237,7 @@ void bspumpkin_jump_update(void) { void bspumpkin_jump_end(void){ func_80292EA4(); - gravity_reset(); + baphysics_reset_gravity(); func_802B229C(); } @@ -251,7 +252,7 @@ void bspumpkin_fall_init(void) { animctrl_setDuration(anim_ctrl, 0.7f); animctrl_setPlaybackType(anim_ctrl, ANIMCTRL_STOPPED); animctrl_start(anim_ctrl, "bspumpkin.c", 0x1F1); - func_8029C7F4(1, 1, 3, 6); + func_8029C7F4(1, 1, 3, BA_PHYSICS_AIRBORN); D_8037D4E0 = 0; } @@ -266,7 +267,7 @@ void bspumpkin_fall_update(void) { if (D_8037D4E4) { func_802B223C(); } - _get_velocity(sp1C); + baphysics_get_velocity(sp1C); switch (D_8037D4E0) { case 0: if (func_8028B254(130)) { @@ -278,7 +279,7 @@ void bspumpkin_fall_update(void) { case 1: if (func_8028B2E8()) { func_8029AE48(); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); animctrl_setSubRange(anim_ctrl, 0.0f, 1.0f); animctrl_setDuration(anim_ctrl, 1.2f); animctrl_setPlaybackType(anim_ctrl, ANIMCTRL_ONCE); @@ -306,7 +307,7 @@ void func_802B2BF0(void) { func_8029656C(D_8037D4E8); func_8028FAB0(D_8037D4E8); baanim_playForDuration_loop(ASSET_A0_ANIM_BSPUMPKIN_WALK, 0.8f); - func_8029C7F4(1, 1, 2, 7); + func_8029C7F4(1, 1, 2, BA_PHYSICS_FREEZE); func_80294378(6); func_8029E3C0(0, 0.0f); } @@ -357,12 +358,12 @@ void __bspumpkin_bounce_init(s32 arg0) { func_80257F18(sp20, plyr_pos, &sp38); yaw_setIdeal(mlNormalizeAngle(sp38 + 180.0f)); yaw_applyIdeal(); - func_80297970(200.0f); - func_8029797C(sp38); - func_802979AC(sp38, func_80297A64()); - func_8029C7F4(1, 1, 2, 3); - player_setYVelocity(510.0f); - gravity_set(-1200.0f); + baphysics_set_target_horizontal_velocity(200.0f); + baphysics_set_target_yaw(sp38); + baphysics_set_horizontal_velocity(sp38, baphysics_get_target_horizontal_velocity()); + func_8029C7F4(1, 1, 2, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_vertical_velocity(510.0f); + baphysics_set_gravity(-1200.0f); baMarker_collisionOff(); func_80292E48(); D_8037D4E0 = 0; @@ -394,7 +395,7 @@ void __bspumpkin_bounce_update(void) { void __bspumpkin_bounce_end(void) { func_80297CA8(); - gravity_reset(); + baphysics_reset_gravity(); baMarker_collisionOn(); func_80292EA4(); func_802B229C(); @@ -446,12 +447,12 @@ void bspumpkin_die_init(void) { D_8037D4F4 = 250.0f; yaw_setIdeal(mlNormalizeAngle(sp38 + 180.0f)); yaw_applyIdeal(); - func_80297970(D_8037D4F4); - func_8029797C(sp38); - func_802979AC(sp38, func_80297A64()); - func_8029C7F4(1, 1, 2, 3); - player_setYVelocity(510.0f); - gravity_set(-1200.0f); + baphysics_set_target_horizontal_velocity(D_8037D4F4); + baphysics_set_target_yaw(sp38); + baphysics_set_horizontal_velocity(sp38, baphysics_get_target_horizontal_velocity()); + func_8029C7F4(1, 1, 2, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_vertical_velocity(510.0f); + baphysics_set_gravity(-1200.0f); pitch_setAngVel(1000.0f, 12.0f); func_802914CC(0xD); ncDynamicCamD_func_802BF2C0(30.0f); @@ -463,7 +464,7 @@ void bspumpkin_die_init(void) { } void bspumpkin_die_update(void){ - func_80297970(D_8037D4F4); + baphysics_set_target_horizontal_velocity(D_8037D4F4); func_80299628(0); switch(D_8037D4E0){ case 0://L802B3284 @@ -485,7 +486,7 @@ void bspumpkin_die_update(void){ case 2://L802B3300 if(baanim_isStopped()) { - player_setYVelocity(400.0f); + baphysics_set_vertical_velocity(400.0f); baanim_setEnd(0.355f); D_8037D4E0 = 3; } @@ -524,7 +525,7 @@ void bspumpkin_die_update(void){ void bspumpkin_die_end(void) { func_802B229C(); func_8024BD08(0); - gravity_reset(); + baphysics_reset_gravity(); pitch_setIdeal(0.0f); roll_setIdeal(0.0f); func_80292EA4(); @@ -533,8 +534,8 @@ void bspumpkin_die_end(void) { void func_802B34A0(void) { baanim_playForDuration_loopSmooth(0xA0, 0.8f); - func_8029C7F4(1, 1, 3, 2); - func_80297970(0.0f); + func_8029C7F4(1, 1, 3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_8029C674(); func_802B3A50(); } diff --git a/src/core2/bs/rebound.c b/src/core2/bs/rebound.c index 70622e59..0b0264ab 100644 --- a/src/core2/bs/rebound.c +++ b/src/core2/bs/rebound.c @@ -2,9 +2,10 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + extern f32 func_80296548(void); extern f32 func_8029653C(void); -extern f32 func_80297A4C(void); extern f32 func_8029B56C(f32, f32, f32, f32); /* .bss */ @@ -18,7 +19,7 @@ void func_802B35D0(s32 arg0){ void func_802B35DC(void) { if (D_8037D500 == 1) { - func_80297A0C(0); + baphysics_set_velocity(0); } } @@ -37,31 +38,31 @@ void func_802B360C(void) { func_80257F18(sp38, sp2C, &sp28); if ((sp1C == 0xE) || (sp1C == 0x10)) { func_802B35D0(1); - func_8029C7F4(1, 1, 2, 1); + func_8029C7F4(1, 1, 2, BA_PHYSICS_UNK1); yaw_setIdeal(mlNormalizeAngle(sp28)); - gravity_set(func_80296548()); + baphysics_set_gravity(func_80296548()); sp20 = func_8029653C(); - sp24 = func_8029B56C(sp2C[1], sp38[1], sp20, func_80297A4C()); + sp24 = func_8029B56C(sp2C[1], sp38[1], sp20, baphysics_get_gravity()); ml_vec3f_diff_copy(sp44, sp38, sp2C); D_8037D504 = sp24; sp44[0] /= sp24; sp44[1] /= sp24; sp44[2] /= sp24; sp44[1] = sp20; - func_80297A0C(sp44); + baphysics_set_velocity(sp44); func_8029E3C0(6, sp24); } else { func_802B35D0(0); func_80298760(sp1C); yaw_setIdeal(mlNormalizeAngle(sp28 + 180.0f)); - func_80297970(func_802987D4()); - func_8029797C(sp28); - func_802979AC(sp28, func_80297A64()); - player_setYVelocity(func_802987C4()); - gravity_set(func_802987E4()); - func_8029C7F4(1, 1, 2, 3); + baphysics_set_target_horizontal_velocity(func_802987D4()); + baphysics_set_target_yaw(sp28); + baphysics_set_horizontal_velocity(sp28, baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(func_802987C4()); + baphysics_set_gravity(func_802987E4()); + func_8029C7F4(1, 1, 2, BA_PHYSICS_LOCKED_ROTATION); if (func_802987B4() == 2) { - func_802978DC(6); + baphysics_set_type(BA_PHYSICS_AIRBORN); } } yaw_applyIdeal(); @@ -72,11 +73,11 @@ void func_802B37DC(void) { if (D_8037D500 != 0) { if ((D_8037D500 == 1) && func_8029E1A8(6)) { - _get_velocity(velocity); + baphysics_get_velocity(velocity); velocity[0] = 0.0f; velocity[2] = 0.0f; - func_80297A0C(velocity); - func_80297970(0.0f); + baphysics_set_velocity(velocity); + baphysics_set_target_horizontal_velocity(0.0f); } } else if (func_802987B4() == 2) { func_802B6FA8(); @@ -132,6 +133,6 @@ void func_802B3954(void) { void func_802B3A20(void) { func_802B35DC(); - gravity_reset(); + baphysics_reset_gravity(); baMarker_collisionOn(); } diff --git a/src/core2/bs/rest.c b/src/core2/bs/rest.c index 973528ec..328c7e10 100644 --- a/src/core2/bs/rest.c +++ b/src/core2/bs/rest.c @@ -2,6 +2,7 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" void func_802B3A50(void) { f32 sp34; @@ -40,8 +41,8 @@ void func_802B3AAC(enum asset_e anim_id, f32 anim_duration) { } else { baanim_playForDuration_loopSmooth(anim_id, anim_duration); } - func_8029C7F4(1, 1, 3, 2); - func_80297970(0.0f); + func_8029C7F4(1, 1, 3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_802B3A50(); } diff --git a/src/core2/bs/sled.c b/src/core2/bs/sled.c index 77c772d0..7c39fa2f 100644 --- a/src/core2/bs/sled.c +++ b/src/core2/bs/sled.c @@ -1,6 +1,8 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + ActorMarker *bssled_gSledMarker; @@ -25,8 +27,8 @@ void func_802B3F60(void){ void bssled_init(void){ func_802B3F20(); baanim_playForDuration_loopSmooth(ASSET_228_ANIM_BANJO_SLED, 1.8f); - func_8029C7F4(1, 1, 3, 7); - func_80297970(0.0f); + func_8029C7F4(1, 1, 3, BA_PHYSICS_FREEZE); + baphysics_set_target_horizontal_velocity(0.0f); func_80294A8C(0); func_80294378(6); } diff --git a/src/core2/bs/slide.c b/src/core2/bs/slide.c index 4d8de3fb..e96f53be 100644 --- a/src/core2/bs/slide.c +++ b/src/core2/bs/slide.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + /* .bss */ s32 D_8037D520; s32 D_8037D524; @@ -66,11 +68,11 @@ void bsslide_init(void){ animctrl_setPlaybackType(aCtrl, ANIMCTRL_STOPPED); animctrl_setDuration(aCtrl, 1.0f); animctrl_start(aCtrl, "bsslide.c", 0x7f); - func_8029C7F4(1,1,3,3); - func_8029797C(yaw_getIdeal()); - func_802979AC(yaw_getIdeal() ,func_80297A64()); + func_8029C7F4(1,1,3, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_target_yaw(yaw_getIdeal()); + baphysics_set_horizontal_velocity(yaw_getIdeal() ,baphysics_get_target_horizontal_velocity()); pitch_setAngVel(800.0f, 8.0f); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); func_80299AAC(); D_8037D524 = 0; D_8037D528 = 1.0f; @@ -95,10 +97,10 @@ void bsslide_update(void){ yaw_setIdeal(sp2C); pitch_setIdeal(sp28); } - func_80297970(ml_map_f(sp28,20.0f, 60.0f, 550.0f, 700.0f)); - func_8029797C(sp2C); + baphysics_set_target_horizontal_velocity(ml_map_f(sp28,20.0f, 60.0f, 550.0f, 700.0f)); + baphysics_set_target_yaw(sp2C); }else{ - func_80297970(500.0f); + baphysics_set_target_horizontal_velocity(500.0f); } func_802B40D0(); }else{//L802B44C4 diff --git a/src/core2/bs/splat.c b/src/core2/bs/splat.c index 646b663c..e63de900 100644 --- a/src/core2/bs/splat.c +++ b/src/core2/bs/splat.c @@ -3,6 +3,8 @@ #include "variables.h" #include "bsint.h" +#include "core2/ba/physics.h" + void func_80292900(f32, f32); void rumbleManager_80250D94(f32, f32, f32); @@ -21,7 +23,7 @@ void func_802B4570(void) { void bssplat_init(void){ s32 sp1C; baanim_playForDuration_onceSmooth(ASSET_149_ANIM_BSSPLAT, 1.1f); - func_8029C7F4(1,1,3,3); + func_8029C7F4(1,1,3, BA_PHYSICS_LOCKED_ROTATION); func_802931DC(&sp1C); func_803463D4(ITEM_14_HEALTH, -sp1C); if(func_8029CEB0() == 4){ @@ -45,12 +47,12 @@ void bssplat_init(void){ void bssplat_update(void){ enum bs_e sp1C = 0; AnimCtrl *aCtrl = baanim_getAnimCtrlPtr(); - func_80297970(ml_max_f(0.0f, func_80297A64() - 15.0f)); + baphysics_set_target_horizontal_velocity(ml_max_f(0.0f, baphysics_get_target_horizontal_velocity() - 15.0f)); switch (D_8037D530) { case 0://L802B4760 - if(140.0f < func_80297A64()) + if(140.0f < baphysics_get_target_horizontal_velocity()) func_802929F8(); if(func_8028B094()) diff --git a/src/core2/bs/stand.c b/src/core2/bs/stand.c index 3a886a79..ae3c4fc3 100644 --- a/src/core2/bs/stand.c +++ b/src/core2/bs/stand.c @@ -3,6 +3,7 @@ #include "variables.h" #include "bsint.h" #include "core2/statetimer.h" +#include "core2/ba/physics.h" extern f32 func_8029B2E8(void); void yaw_setVelocityBounded(f32, f32); @@ -91,8 +92,8 @@ void bsstand_init(void){ climbRelease(); baanim_playForDuration_once(ASSET_6F_ANIM_BSSTAND_IDLE, 5.5f); - func_8029C7F4(1,1,1,2); - func_80297970(0.0f); + func_8029C7F4(1,1,1, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_802900B4(); D_8037D540 = 0; D_8037D544 = 0; @@ -279,8 +280,8 @@ void bsstand_end(void){ //bsStand_Land_init void bsstand_landing_init(void){ - func_8029C7F4(1,1,1,2); - func_80297970(0.0f); + func_8029C7F4(1,1,1, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); } //bsStand_Land_update diff --git a/src/core2/bs/surf.c b/src/core2/bs/surf.c index 526b5da2..89671a04 100644 --- a/src/core2/bs/surf.c +++ b/src/core2/bs/surf.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + /* .bss */ s32 D_8037D560; @@ -15,8 +17,8 @@ void func_802B5FD0(void) { animctrl_setDuration(anim_ctrl, 1.8f); animctrl_setPlaybackType(anim_ctrl, ANIMCTRL_LOOP); animctrl_start(anim_ctrl, "bssurf.c", 0x33); - func_8029C7F4(1, 1, 3, 2); - func_80297970(0.0f); + func_8029C7F4(1, 1, 3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); D_8037D560 = 1; } diff --git a/src/core2/bs/swim.c b/src/core2/bs/swim.c index 076279e6..b0f693d0 100644 --- a/src/core2/bs/swim.c +++ b/src/core2/bs/swim.c @@ -3,6 +3,7 @@ #include "variables.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" extern void func_80295328(s32, f32); @@ -66,10 +67,10 @@ void func_802B55DC(void) { sp1C = func_8029B30C(); if (func_8029B300() == 0) { - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); return; } - func_80297970(ml_interpolate_f(sp1C, bsSwimHorzVelocityMin, bsSwimHorzVelocityMax)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, bsSwimHorzVelocityMin, bsSwimHorzVelocityMax)); } void func_802B563C(void) { @@ -78,8 +79,8 @@ void func_802B563C(void) { } else if (map_get() == MAP_46_CCW_WINTER) { func_8035644C(FILEPROG_DD_HAS_TOUCHED_ICY_WATER); } - gravity_set(100.0f); - func_80297BF8(133.33f); + baphysics_set_gravity(100.0f); + baphysics_set_terminal_velocity(133.33f); func_8029B324(0, 0.03f); func_8029B324(1, 1.0f); func_80294378(3); @@ -88,8 +89,8 @@ void func_802B563C(void) { void func_802B56D4(void) { if (!bsswim_inset(bs_getNextState())) { - func_80297B94(); - gravity_reset(); + baphysics_reset_terminal_velocity(); + baphysics_reset_gravity(); func_8029B0C0(); func_80294378(1); } @@ -138,9 +139,9 @@ void func_802B5774(void) { animctrl_setDuration(anim_ctrl, 1.2f); animctrl_start(anim_ctrl, "bsswim.c", 0xFD); } - func_8029C7F4(1, 3, 3, 2); + func_8029C7F4(1, 3, 3, BA_PHYSICS_NORMAL); yaw_setVelocityBounded(500.0f, 5.0f); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); func_802B563C(); bsSwimCurrentAnimation = 0; } @@ -212,7 +213,7 @@ void func_802B5B18(void) { yaw_setUpdateState(3); yaw_setVelocityBounded(500.0f, 5.0f); func_8029957C(1); - func_802978DC(2); + baphysics_set_type(BA_PHYSICS_NORMAL); } void func_802B5C40(void) { @@ -280,9 +281,9 @@ void func_802B5E30(void) { void func_802B5E8C(void) { baanim_playForDuration_loopSmooth(0x57, 1.2f); - func_8029C7F4(1, 3, 3, 2); + func_8029C7F4(1, 3, 3, BA_PHYSICS_NORMAL); yaw_setVelocityBounded(500.0f, 5.0f); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); func_802B563C(); func_802B5E30(); } diff --git a/src/core2/bs/talk.c b/src/core2/bs/talk.c index 1e8229ca..2e052bf3 100644 --- a/src/core2/bs/talk.c +++ b/src/core2/bs/talk.c @@ -2,6 +2,7 @@ #include "functions.h" #include "variables.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" #include "core2/yaw.h" /* .bss */ @@ -26,8 +27,8 @@ void bstalk_init(void){ baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); yaw_setUpdateState(YAW_STATE_1_DEFAULT); func_8029957C(3); - func_802978DC(2); - func_80297970(0.0f); + baphysics_set_type(BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); bsTalkStayInState = TRUE; } diff --git a/src/core2/bs/throw.c b/src/core2/bs/throw.c index f932ba1a..c6e7f429 100644 --- a/src/core2/bs/throw.c +++ b/src/core2/bs/throw.c @@ -3,6 +3,7 @@ #include "variables.h" #include "core2/statetimer.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" extern ActorMarker *carriedobj_getMarker(void); @@ -22,9 +23,9 @@ void bsthrow_init(void){ baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); yaw_setUpdateState(1); func_8029957C(3); - func_802978DC(3); - func_80297970(0.0f); - func_80297A0C(0); + baphysics_set_type(BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_target_horizontal_velocity(0.0f); + baphysics_set_velocity(0); D_8037D580 = 0; } diff --git a/src/core2/bs/timeout.c b/src/core2/bs/timeout.c index 4c628f00..8012eae5 100644 --- a/src/core2/bs/timeout.c +++ b/src/core2/bs/timeout.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" void func_80292E80(s32, f32); @@ -9,8 +10,8 @@ void ncDynamicCamD_func_802BF2C0(f32); void func_802B6270(void){ baanim_playForDuration_once(ASSET_77_ANIM_BSTIMEOUT, 3.2f); - func_8029C7F4(1,1,3,2); - func_80297970(0.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_802914CC(0xd); yaw_setIdeal(func_8029B41C() + 35.0f); ncDynamicCamD_func_802BF2C0(80.0f); @@ -50,8 +51,8 @@ void func_802B63F8(void){ func_8029C848(aCtrl); animctrl_setPlaybackType(aCtrl, ANIMCTRL_LOOP); animctrl_start(aCtrl, "bstimeout.c", 0x7e); - func_8029C7F4(1,1,3,7); - func_80297970(0.0f); + func_8029C7F4(1,1,3,BA_PHYSICS_FREEZE); + baphysics_set_target_horizontal_velocity(0.0f); func_802914CC(0xd); yaw_setIdeal(func_8029B41C() + 35.0f); ncDynamicCamD_func_802BF2C0(80.0f); diff --git a/src/core2/bs/turn.c b/src/core2/bs/turn.c index 24d375ba..2e16695b 100644 --- a/src/core2/bs/turn.c +++ b/src/core2/bs/turn.c @@ -2,9 +2,10 @@ #include "functions.h" #include "variables.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" /* .data */ -f32 D_8037D590; +f32 bsturn_starting_horizontal_velocity; s32 D_8037D594; /* .code */ @@ -21,9 +22,9 @@ void bsturn_init(void){ baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); yaw_setUpdateState(1); func_8029957C(2); - func_802978DC(3); - _get_velocity(&sp28); - D_8037D590 = gu_sqrtf(sp28[0]*sp28[0] + sp28[2]*sp28[2]); + baphysics_set_type(BA_PHYSICS_LOCKED_ROTATION); + baphysics_get_velocity(sp28); + bsturn_starting_horizontal_velocity = gu_sqrtf(sp28[0]*sp28[0] + sp28[2]*sp28[2]); func_8030EBC8(SFX_19_BANJO_LANDING_08, 0.95f, 1.05f, 0x7530, 0x7d00); D_8037D594 = 0; } @@ -31,7 +32,7 @@ void bsturn_init(void){ void bsturn_update(void){ enum bs_e sp2C = 0; - func_80297970(ml_map_f(animctrl_getAnimTimer(baanim_getAnimCtrlPtr()), 0.18f, 1.0f, D_8037D590, 0.0f)); + baphysics_set_target_horizontal_velocity(ml_map_f(animctrl_getAnimTimer(baanim_getAnimCtrlPtr()), 0.18f, 1.0f, bsturn_starting_horizontal_velocity, 0.0f)); D_8037D594++; if(!(D_8037D594 < 6)) @@ -39,13 +40,13 @@ void bsturn_update(void){ switch(D_8037D594){ case -1://L802B68DC - func_802927E0(func_80297A7C() - 10.0f, _get_horzVelocity()*0.88); + func_802927E0(baphysics_get_target_yaw() - 10.0f, baphysics_get_horizontal_velocity()*0.88); break; case 0://L802B691C - func_802927E0(func_80297A7C(), _get_horzVelocity()); + func_802927E0(baphysics_get_target_yaw(), baphysics_get_horizontal_velocity()); break; case 1://L802B6940 - func_802927E0(func_80297A7C() + 10.0f, _get_horzVelocity()*0.88); + func_802927E0(baphysics_get_target_yaw() + 10.0f, baphysics_get_horizontal_velocity()*0.88); break; }//L802B6978 diff --git a/src/core2/bs/twirl.c b/src/core2/bs/twirl.c index b8f72663..b7faed24 100644 --- a/src/core2/bs/twirl.c +++ b/src/core2/bs/twirl.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" #include "core2/ba/anim.h" - +#include "core2/ba/physics.h" /* .bss */ f32 D_8037D5A0; u8 D_8037D5A4; @@ -25,11 +25,11 @@ void bstwirl_init(void){ baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); yaw_setUpdateState(1); func_8029957C(3); - func_8029797C(yaw_getIdeal()); - func_802979AC(yaw_getIdeal(), func_80297A64()); - func_802978DC(3); - D_8037D5A0 = func_80297A64(); - func_80297970(600.0f); + baphysics_set_target_yaw(yaw_getIdeal()); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_type(BA_PHYSICS_LOCKED_ROTATION); + D_8037D5A0 = baphysics_get_target_horizontal_velocity(); + baphysics_set_target_horizontal_velocity(600.0f); func_80299CF4(SFX_32_BANJO_EGHEE, 1.0f, 0x6590); _bstwirlHitboxActive = TRUE; func_8029E3C0(0, 0.01f); @@ -54,7 +54,7 @@ void bstwirl_update(void){ } if(animctrl_isAt(aCtrl, 0.8011f)){ animctrl_setDuration(aCtrl, 2.5f); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); _bstwirlHitboxActive = 0; D_8037D5A4 = 3; } diff --git a/src/core2/bs/walk.c b/src/core2/bs/walk.c index 586e77c8..161b85ec 100644 --- a/src/core2/bs/walk.c +++ b/src/core2/bs/walk.c @@ -3,18 +3,15 @@ #include "variables.h" #include "animation.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" void baanim_setDurationRange(f32, f32); -f32 _get_horzVelocity(void); void func_802927E0(f32, f32); f32 func_8029B2E8(void); -int func_80297C04(f32); void func_8029AD28(f32, s32); -f32 func_80297AF0(void); void baanim_scaleDuration(f32); f32 func_8029B30C(void); f32 ml_interpolate_f(f32, f32, f32); -f32 func_80297A64(void); void func_80299594(s32, f32); // .data @@ -49,27 +46,27 @@ void func_802B6D00(void){ sp18 = func_8029B300(); if(func_8028B128()){ if(sp18 == 0){ - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); }else{//L802B6D48 - func_80297970(ml_interpolate_f(func_8029B2E8(), bsWalkMinMudVelocity, bsWalkMaxMudVelocity)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(func_8029B2E8(), bsWalkMinMudVelocity, bsWalkMaxMudVelocity)); } } else{//L802B6D78 switch(sp18){ case 0://802B6D98 - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); break; case 1://802B6DAC - func_80297970(ml_interpolate_f(sp1C, bsWalkMinCreepVelocity, bsWalkCreepSlowWalkVelocityThreshold)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, bsWalkMinCreepVelocity, bsWalkCreepSlowWalkVelocityThreshold)); break; case 2://802B6DD0 - func_80297970(ml_interpolate_f(sp1C, bsWalkCreepSlowWalkVelocityThreshold, bsWalkSlowWalkWalkVelocityThreshold)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, bsWalkCreepSlowWalkVelocityThreshold, bsWalkSlowWalkWalkVelocityThreshold)); break; case 3://802B6DF4 - func_80297970(ml_interpolate_f(sp1C, bsWalkSlowWalkWalkVelocityThreshold, bsWalkWalkFastWalkVelocityThreshold)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, bsWalkSlowWalkWalkVelocityThreshold, bsWalkWalkFastWalkVelocityThreshold)); break; case 4://802B6E18 - func_80297970(ml_interpolate_f(sp1C, bsWalkWalkFastWalkVelocityThreshold, bsWalkMaxFastWalkVelocity)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, bsWalkWalkFastWalkVelocityThreshold, bsWalkMaxFastWalkVelocity)); break; } }//L802B6E34 @@ -77,7 +74,7 @@ void func_802B6D00(void){ void func_802B6E44(void){ if(func_8028B394()){ - baanim_scaleDuration(ml_map_f(func_80297AF0(), 0.0f, 1.0f, 0.5f, 0.9f)); + baanim_scaleDuration(ml_map_f(baphysics_get_horizontal_velocity_percentage(), 0.0f, 1.0f, 0.5f, 0.9f)); }else{ baanim_scaleDuration(1.0f); } @@ -98,7 +95,7 @@ int func_802B6EF4(void){ s32 func_802B6F20(s32 arg0){ if(button_pressed(BUTTON_B)){ - if( bsWalkWalkFastWalkVelocityThreshold < func_80297A64()){ + if( bsWalkWalkFastWalkVelocityThreshold < baphysics_get_target_horizontal_velocity()){ if(can_roll()) arg0 = BS_ROLL; }else{//L802B6F74 @@ -132,7 +129,7 @@ void bswalk_creep_init(void){ animctrl_setStart(anim_ctrl, start_position); animctrl_setPlaybackType(anim_ctrl, ANIMCTRL_LOOP); animctrl_start(anim_ctrl, "bswalk.c", 0xe4); - func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1,2); + func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1, BA_PHYSICS_NORMAL); baanim_setDurationRange(0.3f, 1.5f); baanim_setVelocityMapRanges(bsWalkMinCreepVelocity, bsWalkCreepSlowWalkVelocityThreshold, bsWalkSlowestCreepDuration, bsWalkFastestCreepDuration); } @@ -149,7 +146,7 @@ void bswalk_creep_update(void){ func_802B6D00(); switch(func_8029B300()){ case 0://L802B7160 - if(func_80297C04(1.0f)) + if(baphysics_is_slower_than(1.0f)) next_state = BS_1_IDLE; break; case 2://L802B7180 @@ -205,7 +202,7 @@ void bswalk_slow_init(void){ animctrl_setStart(anim_ctrl, start_position); animctrl_setPlaybackType(anim_ctrl, ANIMCTRL_LOOP); animctrl_start(anim_ctrl, "bswalk.c", 0x168); - func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1,2); + func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1, BA_PHYSICS_NORMAL); baanim_setDurationRange(0.3f, 1.5f); baanim_setVelocityMapRanges(bsWalkCreepSlowWalkVelocityThreshold, bsWalkSlowWalkWalkVelocityThreshold, bsWalkSlowestSlowWalkDuration, bsWalkFastestSlowWalkDuration); } @@ -222,7 +219,7 @@ void bswalk_slow_upate(void){ func_802B6D00(); switch(func_8029B300()){ case 0://L802B7160 - if(func_80297C04(3.0f)) + if(baphysics_is_slower_than(3.0f)) next_state = BS_1_IDLE; break; case 1://L802B7180 @@ -283,7 +280,7 @@ void bswalk_init(void){ animctrl_setStart(anim_ctrl, start_position); animctrl_setPlaybackType(anim_ctrl, ANIMCTRL_LOOP); animctrl_start(anim_ctrl, "bswalk.c", 0x1ed); - func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1,2); + func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1, BA_PHYSICS_NORMAL); baanim_setDurationRange(0.3f, 1.5f); baanim_setVelocityMapRanges(bsWalkSlowWalkWalkVelocityThreshold, bsWalkWalkFastWalkVelocityThreshold, bsWalkSlowestWalkDuration, bsWalkFastestWalkDuration); func_802B6EB0(0.3f); @@ -300,7 +297,7 @@ void bswalk_update(void){ case 0: case 1: case 2: - if(func_80297C04(bsWalkSlowWalkWalkVelocityThreshold) && func_802B6EF4()) + if(baphysics_is_slower_than(bsWalkSlowWalkWalkVelocityThreshold) && func_802B6EF4()) next_state = BS_2_WALK_SLOW; break; case 4: @@ -310,7 +307,7 @@ void bswalk_update(void){ if(func_8028B128()) next_state = BS_WALK_MUD; - if(func_8028B4C4() && bsWalkSkidVelocity < _get_horzVelocity()){ + if(func_8028B4C4() && bsWalkSkidVelocity < baphysics_get_horizontal_velocity()){ next_state = BS_SKID; } @@ -347,7 +344,7 @@ void bswalk_fast_init(void){ switch(bs_getPrevState()){ case 1: case 2://L802B780C - if(_get_horzVelocity() < 200.0f){ + if(baphysics_get_horizontal_velocity() < 200.0f){ func_802927E0(0.0f, 0.0f); } break; @@ -367,7 +364,7 @@ void bswalk_fast_init(void){ animctrl_setStart(anim_ctrl, sp28); animctrl_setPlaybackType(anim_ctrl, ANIMCTRL_LOOP); animctrl_start(anim_ctrl, "bswalk.c", 0x27d); - func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1,2); + func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1, BA_PHYSICS_NORMAL); baanim_setDurationRange(0.3f, 1.5f); baanim_setVelocityMapRanges(bsWalkWalkFastWalkVelocityThreshold, bsWalkMaxFastWalkVelocity, bsWalkSlowestFastWalkDuration, bsWalkFastestFastWalkDuration); pitch_setAngVel(1000.0f, 12.0f); @@ -386,7 +383,7 @@ void bswalk_fast_update(void){ func_802B6D00(); switch(func_8029B300()){ case 0://L802B79EC - if(func_80297C04(18.0f)) + if(baphysics_is_slower_than(18.0f)) next_state = BS_1_IDLE; if(func_80294F78()) @@ -395,7 +392,7 @@ void bswalk_fast_update(void){ break; case 1: case 2://L802B7A28 - if(func_80297C04(bsWalkSlowWalkWalkVelocityThreshold)) + if(baphysics_is_slower_than(bsWalkSlowWalkWalkVelocityThreshold)) next_state = BS_2_WALK_SLOW; if(func_80294F78()) @@ -403,7 +400,7 @@ void bswalk_fast_update(void){ break; case 3://L802B7A60 - if(func_80297C04(bsWalkWalkFastWalkVelocityThreshold) && func_802B6EF4()) + if(baphysics_is_slower_than(bsWalkWalkFastWalkVelocityThreshold) && func_802B6EF4()) next_state = BS_WALK; if(func_80294F78()) @@ -413,7 +410,7 @@ void bswalk_fast_update(void){ if(func_8028B128()) next_state = BS_WALK_MUD; - if(func_8028B4C4() && bsWalkSkidVelocity < _get_horzVelocity()){ + if(func_8028B4C4() && bsWalkSkidVelocity < baphysics_get_horizontal_velocity()){ next_state = BS_SKID; } @@ -446,7 +443,7 @@ void bswalk_fast_end(void){ void bswalk_mud_init(void){ baanim_playForDuration_loopSmooth(ASSET_B_ANIM_BSWALK_MUD, 0.43f); - func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1,2); + func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1, BA_PHYSICS_NORMAL); baanim_setDurationRange(0.3f, 1.5f); baanim_setVelocityMapRanges(bsWalkMinMudVelocity, bsWalkMaxMudVelocity, bsWalkSlowestMudDuration, bsWalkFastestMudDuration); } diff --git a/src/core2/bs/walrus.c b/src/core2/bs/walrus.c index 8ea906d4..593e1109 100644 --- a/src/core2/bs/walrus.c +++ b/src/core2/bs/walrus.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" + extern void func_8029AD68(f32, s32); extern f32 ml_dotProduct_vec3f(f32[3], f32[3]); @@ -44,10 +46,10 @@ void func_802B7E6C(void) { sp1C = func_8029B30C(); if (func_8029B300() == 0) { - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); return; } - func_80297970(ml_interpolate_f(sp1C, D_80364DC0, D_80364DC4)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, D_80364DC0, D_80364DC4)); } void func_802B7ECC(void) { @@ -70,7 +72,7 @@ void func_802B7F28(void) { sp3C = D_80364DDC; sp40 = func_8029B30C(); func_802B7ECC(); - _get_velocity(sp20); + baphysics_get_velocity(sp20); sp20[1] = 0.0f; if (900.0 < sp20[0] * sp20[0] + sp20[1] * sp20[1] + sp20[2] * sp20[2]) { ml_vec3f_normalize(sp20); @@ -80,10 +82,10 @@ void func_802B7F28(void) { } } if (func_8029B300() == 0) { - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); return; } - func_80297970(ml_interpolate_f(sp40, sp38, sp3C)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp40, sp38, sp3C)); } void func_802B8048(void){ @@ -141,8 +143,8 @@ int bswalrus_inSet(enum bs_e state){ void bswalrus_idle_init(void){ baanim_playForDuration_loopSmooth(ASSET_11F_ANIM_BSWALRUS_IDLE, 4.0f); - func_8029C7F4(1,1,1,2); - func_80297970(0.0f); + func_8029C7F4(1,1,1, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); pitch_setAngVel(1000.0f, 12.0f); roll_setAngularVelocity(1000.0f, 12.0f); func_80293D48(50.0f, 25.0f); @@ -179,7 +181,7 @@ void bswalrus_idle_end(void){ void bswalrus_walk_init(void){ baanim_playForDuration_loopSmooth(ASSET_120_ANIM_BSWALRUS_WALK, 0.8f); - func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1,2); + func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1, BA_PHYSICS_NORMAL); baanim_setVelocityMapRanges(D_80364DC0, D_80364DC4, D_80364DC8, D_80364DCC); func_802900B4(); func_802B8110(); @@ -192,7 +194,7 @@ void bswalrus_walk_update(void){ func_802B7E6C(); func_8029AD68(0.3f, 4); - if(func_8029B300() == 0 && func_80297C04(1.0f)) + if(func_8029B300() == 0 && baphysics_is_slower_than(1.0f)) next_state = BS_67_WALRUS_IDLE; if(func_8028B094()) @@ -220,14 +222,14 @@ void bswalrus_jump_init(void){ animctrl_setStart(aCtrl, 0.1); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bswalrus.c", 0x1f8); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f) yaw_setIdeal(func_8029B33C()); - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802B7E6C(); - func_802979AC(yaw_getIdeal(), func_80297A64()); - player_setYVelocity(D_80364DD0); - gravity_set(D_80364DD4); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(D_80364DD0); + baphysics_set_gravity(D_80364DD4); func_802B7E00(); func_802B8110(); D_8037D5C8 = 0; @@ -239,9 +241,9 @@ void bswalrus_jump_update(void){ f32 sp1C[3]; func_802B7E6C(); - _get_velocity(sp1C); + baphysics_get_velocity(sp1C); if(button_released(BUTTON_A) && 0.0f < sp1C[1]) - gravity_reset(); + baphysics_reset_gravity(); switch(D_8037D5C8){ case 0://L802B86D8 @@ -279,7 +281,7 @@ void bswalrus_jump_update(void){ case 3://L802B880C func_80299628(0); if(animctrl_isStopped(aCtrl)){ - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); next_state = BS_67_WALRUS_IDLE; } break; @@ -297,7 +299,7 @@ void bswalrus_jump_update(void){ } void bswalrus_jump_end(void){ - gravity_reset(); + baphysics_reset_gravity(); func_802B8048(); } @@ -309,7 +311,7 @@ void bswalrus_fall_init(void){ animctrl_setDuration(aCtrl, 0.7f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_STOPPED); animctrl_start(aCtrl, "bswalrus.c", 0x284); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); func_802B8110(); D_8037D5C8 = 0; } @@ -321,7 +323,7 @@ void bswalrus_fall_update(void){ func_80299628(0); func_802B7E6C(); - _get_velocity(sp1C); + baphysics_get_velocity(sp1C); switch (D_8037D5C8) { @@ -335,7 +337,7 @@ void bswalrus_fall_update(void){ case 1://L802B89E0 if(func_8028B2E8()){ func_8029AE48(); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); animctrl_setSubRange(aCtrl, 0.0f, 1.0f); animctrl_setDuration(aCtrl, 1.0f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); @@ -381,12 +383,12 @@ static void __bswalrus_recoil_init(s32 damage){ func_80257F18(sp24, sp30, &sp3C); yaw_setIdeal(mlNormalizeAngle(sp3C + 180.0f)); yaw_applyIdeal(); - func_80297970(func_802987D4()); - func_8029797C(sp3C); - func_802979AC(sp3C, func_80297A64()); - func_8029C7F4(1,1,2,3); - player_setYVelocity(func_802987C4()); - gravity_set(func_802987E4()); + baphysics_set_target_horizontal_velocity(func_802987D4()); + baphysics_set_target_yaw(sp3C); + baphysics_set_horizontal_velocity(sp3C, baphysics_get_target_horizontal_velocity()); + func_8029C7F4(1,1,2, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_vertical_velocity(func_802987C4()); + baphysics_set_gravity(func_802987E4()); baMarker_collisionOff(); func_80292E48(); func_802B8110(); @@ -404,7 +406,7 @@ static void __bswalrus_recoil_update(void){ } static void __bswalrus_recoil_end(void){ - gravity_reset(); + baphysics_reset_gravity(); baMarker_collisionOn(); func_80292EA4(); func_802B8048(); @@ -455,12 +457,12 @@ void bswalrus_die_init(void){ D_8037D5C4 = 250.0f; yaw_setIdeal(mlNormalizeAngle(sp38 + 180.0f)); yaw_applyIdeal(); - func_80297970(D_8037D5C4); - func_8029797C(sp38); - func_802979AC(sp38, func_80297A64()); - func_8029C7F4(1,1,2,3); - player_setYVelocity(420.0f); //B) - gravity_set(-1200.0f); + baphysics_set_target_horizontal_velocity(D_8037D5C4); + baphysics_set_target_yaw(sp38); + baphysics_set_horizontal_velocity(sp38, baphysics_get_target_horizontal_velocity()); + func_8029C7F4(1,1,2, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_vertical_velocity(420.0f); //B) + baphysics_set_gravity(-1200.0f); pitch_setAngVel(1000.0f, 12.0f); func_802914CC(0xd); ncDynamicCamD_func_802BF2C0(30.0f); @@ -477,7 +479,7 @@ void bswalrus_die_init(void){ void bswalrus_die_update(void){ enum bs_e next_state = 0; - func_80297970(D_8037D5C4); + baphysics_set_target_horizontal_velocity(D_8037D5C4); func_80299628(0); switch(D_8037D5C8){ case 0://L802B8F54 @@ -485,7 +487,7 @@ void bswalrus_die_update(void){ baanim_setEnd(1.0f); FUNC_8030E624(SFX_1F_HITTING_AN_ENEMY_3, 0.8f, 18000); FUNC_8030E624(SFX_39_BANJO_AYE_2, 1.8f, 18000); - player_setYVelocity(400.0f); + baphysics_set_vertical_velocity(400.0f); D_8037D5C8 = 2; } break; @@ -507,7 +509,7 @@ void bswalrus_die_update(void){ void bswalrus_die_end(void){ func_8024BD08(0); - gravity_reset(); + baphysics_reset_gravity(); pitch_setIdeal(0.0f); roll_setIdeal(0.0f); func_80291548(); @@ -530,8 +532,8 @@ void bswalrus_drone_end(void){ void func_802B90D0(void){ baanim_playForDuration_loopSmooth(ASSET_19E_ANIM_BSWALRUS_SLED, 0.8f); - func_8029C7F4(1,1,3,2); - func_80297970(0.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_8029C674(); func_802B813C(); func_802B3A50(); @@ -555,7 +557,7 @@ void func_802B917C(void){ void bswalrus_sled_init(void){ baanim_playForDuration_loopSmooth(ASSET_19E_ANIM_BSWALRUS_SLED, 0.8f); - func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1,2); + func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1, BA_PHYSICS_NORMAL); baanim_setVelocityMapRanges(D_80364DC0, D_80364DC4, D_80364DE0, D_80364DE4); func_802900B4(); func_802B813C(); @@ -565,7 +567,7 @@ void bswalrus_sled_update(void){ enum bs_e next_state = 0; f32 sp20[3]; - if(50.0f < _get_horzVelocity()){ + if(50.0f < baphysics_get_horizontal_velocity()){ if(func_8023DB4C(1)){ baModel_80292554(&sp20); }else{ @@ -601,14 +603,14 @@ void bswalrus_sled_jump_init(void){ animctrl_setStart(aCtrl, 0.14f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bswalrus.c", 0x477); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f) yaw_setIdeal(func_8029B33C()); - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802B7F28(); - func_802979AC(yaw_getIdeal(), func_80297A64()); - player_setYVelocity(D_80364DD0); - gravity_set(D_80364DD4); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(D_80364DD0); + baphysics_set_gravity(D_80364DD4); func_802B7E00(); func_802B813C(); D_8037D5C8 = 0; @@ -620,10 +622,10 @@ void bswalrus_sled_jump_update(void){ f32 sp1C[3]; func_802B7F28(); - _get_velocity(sp1C); + baphysics_get_velocity(sp1C); if(button_released(BUTTON_A) && 0.0f < sp1C[1]) - gravity_reset(); + baphysics_reset_gravity(); switch (D_8037D5C8) { @@ -657,7 +659,7 @@ void bswalrus_sled_jump_update(void){ } void bswalrus_sled_jump_end(void){ - gravity_reset(); + baphysics_reset_gravity(); func_802B80D0(); } @@ -669,7 +671,7 @@ void func_802B95A0(void){ animctrl_setDuration(aCtrl, 1.0f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_STOPPED); animctrl_start(aCtrl, "bswalrus.c", 0x4e2); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); func_802B813C(); D_8037D5C8 = 0; } @@ -681,7 +683,7 @@ void func_802B963C(void){ func_80299628(0); func_802B7E6C(); - _get_velocity(sp1C); + baphysics_get_velocity(sp1C); switch (D_8037D5C8) { case 0://L802B9694 @@ -693,7 +695,7 @@ void func_802B963C(void){ case 1://L802B96C0 if(func_8028B2E8()){ func_8029AE48(); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); D_8037D5C8 = 2; } break; @@ -724,8 +726,8 @@ void func_802B976C(void){ void bswalrus_timeout_init(void) { baanim_playForDuration_once(ASSET_1A9_ANIM_BSWALRUS_LOSS, 3.2f); - func_8029C7F4(1, 1, 3, 7); - func_80297970(0.0f); + func_8029C7F4(1, 1, 3, BA_PHYSICS_FREEZE); + baphysics_set_target_horizontal_velocity(0.0f); func_802914CC(0xD); ncDynamicCamD_func_802BF2C0(60.0f); func_8025A58C(0, 4000); diff --git a/src/core2/bs/washy.c b/src/core2/bs/washy.c index ffa0bb47..38b25b93 100644 --- a/src/core2/bs/washy.c +++ b/src/core2/bs/washy.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + /* .bss */ u8 D_8037D5D0; @@ -14,11 +16,11 @@ void func_802B9980(s32 arg0){ case 1: //L802B99B8 func_802BB3DC(0, 30.0f, 0.6f); func_8030E58C(SFX_82_METAL_BREAK, 0.8f); - player_setYVelocity(400.0f); + baphysics_set_vertical_velocity(400.0f); break; case 2: //L802B99F4 func_802BB3DC(0, 10.0f, 0.6f); - player_setYVelocity(300.0f); + baphysics_set_vertical_velocity(300.0f); break; case 3: //L802B9A20 func_8029E3C0(0, 0.01f); @@ -45,7 +47,7 @@ void func_802B9AAC(void){ void func_802B9ACC(void){ baanim_playForDuration_once(ASSET_281_ANIM_WISHYWASHY_DOOOH, 40.0f); - func_8029C7F4(1, 1, 3, 2); + func_8029C7F4(1, 1, 3, BA_PHYSICS_NORMAL); func_802900B4(); func_802B9980(0); } diff --git a/src/core2/ch/beehive.c b/src/core2/ch/beehive.c index 98e2a206..5a0303d5 100644 --- a/src/core2/ch/beehive.c +++ b/src/core2/ch/beehive.c @@ -23,7 +23,7 @@ void func_802CE7E0(ActorMarker *marker, ActorMarker *other){ Actor *actor = marker_getActor(marker); FUNC_8030E8B4(SFX_11_WOOD_BREAKING_1, 1.0f, 28000, actor->position, 300, 3000); FUNC_8030E8B4(SFX_D_EGGSHELL_BREAKING, 1.0f, 28000, actor->position, 300, 3000); - func_80328A84(actor, 2); + subaddie_set_state(actor, 2); actor_playAnimationOnce(actor); marker->collidable = FALSE; actor->unk138_27 = 3; diff --git a/src/core2/ch/bigbutt.c b/src/core2/ch/bigbutt.c index d6270bc8..9c19bed4 100644 --- a/src/core2/ch/bigbutt.c +++ b/src/core2/ch/bigbutt.c @@ -52,19 +52,19 @@ void func_802C5EB8(Actor *this){ } else{ if(func_80329530(this, 1200) && func_803292E0(this)){ - func_80328A84(this, 8); + subaddie_set_state(this, 8); } } } void func_802C5F44(Actor *this){ if(!func_80329530(this, 1200) || !func_803292E0(this)){ - func_80328B8C(this, 1, 0.16f, 1); + subaddie_set_state_with_direction(this, 1, 0.16f, 1); } } void func_802C5F94(Actor *this){ - func_80328A84(this, 2); + subaddie_set_state(this, 2); func_802C5E80(this); func_80328CEC(this, (s32)this->yaw_ideal, 135, 175); this->unk38_31 = 150; @@ -87,14 +87,14 @@ void func_802C60AC(ActorMarker *marker, ActorMarker *other_marker){ && func_803294F0(actor, 80, func_80329784(actor)) ){ animctrl_setPlaybackType(actor->animctrl, ANIMCTRL_ONCE); - func_80328A84(actor, 5); + subaddie_set_state(actor, 5); func_8030E58C(SFX_1E_HITTING_AN_ENEMY_2, 1.0f); } } void func_802C6150(ActorMarker *marker, ActorMarker *other_marker){ Actor *actor = marker_getActor(marker); - func_80328AC8(actor, 0xC); + subaddie_set_state_forward(actor, 0xC); func_8030E878(SFX_2B_BULL_MOO_1, randf2(1.28f, 1.37f), 32000, actor->position, 0.0f, 2000.0f); } @@ -104,7 +104,7 @@ void func_802C61C0(ActorMarker *marker, ActorMarker *other_marker){ && actor->state != 0xe && actor->state != 0xf ){ - func_80328AC8(actor, 0xd); + subaddie_set_state_forward(actor, 0xd); FUNC_8030E8B4(SFX_143_BULL_DAMAGE, 1.0f, 16000, actor->position, 0, 2000); FUNC_8030E8B4(SFX_143_BULL_DAMAGE, 1.0f, 16000, actor->position, 0, 2000); } @@ -147,7 +147,7 @@ void func_802C6240(Actor *this){ func_802C5FF8(this); if( func_8032863C(this->animctrl, 0.65f, 0.99f) >= 2 && !func_80328A2C(this, 0.0f, -1, 0.45f) - && func_80328BD4(this, 2, 0.0f, -1, 0.58f) + && subaddie_maybe_set_state_position_direction(this, 2, 0.0f, -1, 0.58f) ){ func_80328CEC(this, (s32)this->yaw, 10, 45); func_802C5E80(this); @@ -165,11 +165,11 @@ void func_802C6240(Actor *this){ func_80328CEC(this, (s32)this->yaw_ideal, 10, 20); if(!(func_8023DB5C() & 0x7)) - func_80328BD4(this, 1, 0.16f, 1, 0.02f); + subaddie_maybe_set_state_position_direction(this, 1, 0.16f, 1, 0.02f); if( !(func_8023DB5C() & 0xf) && func_80329078(this, (s32)this->yaw_ideal, 150) - && func_80328B38(this, 3, 0.13f) + && subaddie_maybe_set_state(this, 3, 0.13f) ){ this->unk28 = randf2(7.1f, 8.4f); } @@ -181,17 +181,17 @@ void func_802C6240(Actor *this){ this->yaw_ideal = func_80329784(this); func_80328FB0(this, 4.0f); if(func_80329480(this)) - func_80328A84(this, 6); + subaddie_set_state(this, 6); break; case 0x3: //L802C6620 func_80328FB0(this, 3.0f); if(! func_80329030(this, 0) && func_80329480(this)){ func_80328CEC(this, (s32)this->yaw, 120, 180); - func_80328A84(this, 2); + subaddie_set_state(this, 2); func_802C5E80(this); } - if(!(func_8023DB5C() & 0xf) && func_80328B38(this, 2, 0.08f)) + if(!(func_8023DB5C() & 0xf) && subaddie_maybe_set_state(this, 2, 0.08f)) func_802C5E80(this); func_802C5EB8(this); break; @@ -200,7 +200,7 @@ void func_802C6240(Actor *this){ animctrl_setDuration(this->animctrl, D_80366010[6].duration - (3 - this->unk10_12)*0.1085); this->yaw_ideal = (f32)func_80329784(this); if(!func_803294B4(this, 0x21)){ - func_80328A84(this, 8); + subaddie_set_state(this, 8); } func_802C5F44(this); if(actor_animationIsAt(this, 0.35f) && func_8028EE84() != BSWATERGROUP_2_UNDERWATER){ @@ -211,7 +211,7 @@ void func_802C6240(Actor *this){ func_802C5F94(this); if(this->unk10_12 == 0 || (this->unk10_12 < 3 && func_80329530(this, 300))){ - func_80328A84(this, 9); + subaddie_set_state(this, 9); this->unk28 = 13.0f; } break; @@ -232,7 +232,7 @@ void func_802C6240(Actor *this){ if(func_80329530(this, 320)){ if(func_80329078(this, (s32)this->yaw_ideal,200)){ animctrl_setPlaybackType(this->animctrl, ANIMCTRL_ONCE); - func_80328A84(this, 4); + subaddie_set_state(this, 4); this->unk28 += 5.7; tmp_a0 = this->unk44_31; if(this->unk44_31 == 0){ @@ -261,7 +261,7 @@ void func_802C6240(Actor *this){ func_80329878(this, func_80329530(this, 250)? 0.8: 1.2); if(0.0f == this->unk28){ animctrl_setPlaybackType(this->animctrl, ANIMCTRL_LOOP); - func_80328B8C(this, 1, 0.65f, 1); + subaddie_set_state_with_direction(this, 1, 0.65f, 1); func_8030DA44(this->unk44_31); this->unk44_31 = 0; func_8030E484(SFX_19_BANJO_LANDING_08); @@ -282,7 +282,7 @@ void func_802C6240(Actor *this){ case 0xc: //L802C6BDC actor_playAnimationOnce(this); if(actor_animationIsAt(this, 0.95f)){ - func_80328B8C(this, 1, 0.65f, 1); + subaddie_set_state_with_direction(this, 1, 0.65f, 1); actor_loopAnimation(this); } break; @@ -290,7 +290,7 @@ void func_802C6240(Actor *this){ case 0xd: //L802C6C28 actor_playAnimationOnce(this); if(actor_animationIsAt(this, 0.95f)){ - func_80328B8C(this, 0xe, 0.99f, 1); + subaddie_set_state_with_direction(this, 0xe, 0.99f, 1); this->unk60 = 4.0f; } break; @@ -300,7 +300,7 @@ void func_802C6240(Actor *this){ this->unk60 -= time_getDelta(); if(this->unk60 <= 0.0f){ this->unk166 = 0x63; - func_80328AC8(this, 0xF); + subaddie_set_state_forward(this, 0xF); } break; @@ -308,7 +308,7 @@ void func_802C6240(Actor *this){ case 0xf: //L802C6CD4 actor_playAnimationOnce(this); if(actor_animationIsAt(this, 0.95f)){ - func_80328B8C(this, 1, 0.65f, 1); + subaddie_set_state_with_direction(this, 1, 0.65f, 1); actor_loopAnimation(this); } break; diff --git a/src/core2/ch/bottlesbonus.c b/src/core2/ch/bottlesbonus.c index dfaca5fd..ec45b440 100644 --- a/src/core2/ch/bottlesbonus.c +++ b/src/core2/ch/bottlesbonus.c @@ -13,6 +13,10 @@ BKAnimationList *model_getAnimationList(BKModelBin *arg0); extern void func_8034BB08(s32); extern void func_803458E4(f32[4], f32[4], f32[4], f32); +#define CH_BOTTLES_BONUS_PUZZLE_HEIGHT (4) +#define CH_BOTTLES_BONUS_PUZZLE_WIDTH (5) +#define CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT (CH_BOTTLES_BONUS_PUZZLE_HEIGHT * CH_BOTTLES_BONUS_PUZZLE_WIDTH) + /* .extern symbols??? */ extern u8 D_8037DCC0[7]; extern u8 D_8037DCC7; @@ -74,7 +78,7 @@ ActorAnimationInfo chBottlesBonusAnimations[] ={ f32 D_80368250 = 0.999388993f; -s32 D_80368254[20] = { +s32 D_80368254[CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT] = { 0x3C, 0x3D, 0x3F, 0x40, 0x42, 0x41, 0x43, 0x3A, 0x32, 0x30, 0x2E, 0x3E, @@ -106,37 +110,37 @@ 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]; +f32 D_8037DEC8[CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT]; +f32 D_8037DF18[CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT]; s32 chBottleBonusPuzzleIndex; f32 D_8037DF70[3]; f32 D_8037DF80[3]; -s32 D_8037DF90[20]; +s32 D_8037DF90[CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT]; /* .code */ void chBottlesBonus_func_802DD080(Gfx **gfx, Mtx **mtx) { - f32 sp24[3]; - f32 sp18[3]; + f32 vp_position[3]; + f32 vp_rotation[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; + vp_rotation[0] = 0.0f; + vp_rotation[1] = 0.0f; + vp_rotation[2] = 0.0f; + vp_position[0] = 0.0f; + vp_position[1] = 0.0f; + vp_position[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; + vp_position[0] = 248.4125; + vp_position[1] = 328.9; + vp_position[2] = -186.4; + vp_rotation[0] = 0.0f; + vp_rotation[1] = 270.0f; + vp_rotation[2] = 0.0f; } - viewport_setPosition(sp24); - viewport_setRotation(sp18); + viewport_setPosition(vp_position); + viewport_setRotation(vp_rotation); viewport_update(); func_8024C904(gfx, mtx); } @@ -153,7 +157,7 @@ Actor *chBottlesBonus_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) void *sp50; sp6C = marker_getActor(marker); - sp50 = func_8030C704(); + sp50 = func_8030C704(); //grabs frame as texture? if ((sp50 == NULL) || (getGameMode() != GAME_MODE_8_BOTTLES_BONUS)) return sp6C; @@ -287,18 +291,18 @@ void chBottlesBonus_func_802DD8AC(BoneTransformList *arg0, s32 arg1) { spD0 = func_8033DDB8(); if (D_8037DEB0 == 0) { D_8037DEB0 = 1; - for(i = 0; i < 20; i++){ + for(i = 0; i < CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT; i++){ func_8033A57C(arg0, D_80368254[i], D_8037DEC4[i].unkC); boneTransformList_getBoneScale(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); + chBottlesBonusCursor_func_802DF460(i + CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT, 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++){ + for(i = 0; i < CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT; i++){ func_8033A57C(arg0, D_80368254[i], D_8037DEB8[i].unkC); boneTransformList_getBoneScale(arg0, D_80368254[i], D_8037DEB8[i].unk1C); chBottlesBonus_func_802DD778(arg0, i, D_8037DEB8[i].unk0); @@ -315,7 +319,7 @@ void chBottlesBonus_func_802DD8AC(BoneTransformList *arg0, s32 arg1) { } } - for(i = 0; i < 20; i++){ + for(i = 0; i < CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT; i++){ spD8[0] = 1.0f; spD8[1] = 1.0f; spD8[2] = 1.0f; @@ -466,18 +470,18 @@ void chBottlesBonus_update(Actor *this) { func_8034CF74(local, 0, D_8037DEAC, 0xF0); } func_8028746C(this->animctrl, chBottlesBonus_func_802DD8AC); - for(phi_s0 = 0; phi_s0 < 0x14; phi_s0++){ + for(phi_s0 = 0; phi_s0 < CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT; 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)); + D_8037DEB8 = (Struct_core2_560F0_1 *) malloc(CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT*sizeof(Struct_core2_560F0_1)); + D_8037DEBC = (Struct_core2_560F0_1 *) malloc(CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT*sizeof(Struct_core2_560F0_1)); + D_8037DEC0 = (Struct_core2_560F0_1 *) malloc(CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT*sizeof(Struct_core2_560F0_1)); + D_8037DEC4 = (Struct_core2_560F0_1 *) malloc(CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT*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++){ + for(phi_s0_2 = 0; phi_s0_2 < CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT; 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)) { @@ -506,7 +510,7 @@ void chBottlesBonus_update(Actor *this) { 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); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_playAnimationOnce(this); } break; @@ -535,7 +539,7 @@ void chBottlesBonus_update(Actor *this) { } } break; - case 5: + case 5: //lose break; }//L802DE9A0 } @@ -550,7 +554,7 @@ void __chBottlesBonus_spawn(void){ } } -void chBottlesBonus_Spawn(s32 arg0, s32 arg1){ +void chBottlesBonus_spawn(s32 arg0, s32 arg1){ if(chBottlesBonusMarker == NULL){ __spawnQueue_add_0(__chBottlesBonus_spawn); } @@ -579,7 +583,7 @@ s32 chBottlesBonus_getState(void){ return actor->state; } -f32 *chBottlesBonus_func_802DEAF8(s32 arg0){ +f32 *chBottlesBonus_get_piece_distance_vec4f(s32 arg0){ //returns distance vector of puzzle piece id return D_8037DEBC[arg0].unkC; } diff --git a/src/core2/ch/bottlesbonuscursor.c b/src/core2/ch/bottlesbonuscursor.c index de2ee35f..021c0cf8 100644 --- a/src/core2/ch/bottlesbonuscursor.c +++ b/src/core2/ch/bottlesbonuscursor.c @@ -60,9 +60,9 @@ ActorInfo D_80368418 = { }; /* .bss */ -ActorMarker *chBottlesBonusSursorMarker; +ActorMarker *chBottlesBonusCursorMarker; f32 D_8037E068[20][2]; -Struct_core2_584D0_0 D_8037E248[20]; +Struct_core2_584D0_0 D_8037E248[20]; //puzzle pieces u8 pad_8037E478[0x140]; s32 D_8037E5B8; struct { @@ -124,7 +124,7 @@ bool chBottlesBonusCursor_checkPuzzleCompletion(void) { for(i = 0; i < 20 && D_8037E5C0.is_completed != 0; i++){ if((D_8037E248[i].state != 3) || (i != D_8037E248[i].piece_id) - || !vec4f_isAlmostZero(chBottlesBonus_func_802DEAF8(i)) + || !vec4f_isAlmostZero(chBottlesBonus_get_piece_distance_vec4f(i)) ) { D_8037E5C0.is_completed = FALSE; } @@ -132,10 +132,10 @@ bool chBottlesBonusCursor_checkPuzzleCompletion(void) { 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); + timedFunc_set_3(0.25f, (GenFunction_3)comusic_8025AB44, COMUSIC_94_BBONUS, 0, 2000); + timedFunc_set_2(0.3f, (GenFunction_2)func_8025A6EC, COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 22000); + timedFunc_set_0(1.5f, (GenFunction_0)chBottlesBonusCursor_func_802DF99C); + timedFunc_set_0(1.0f, (GenFunction_0)chBottlesBonus_completedPuzzle); } return D_8037E5C0.is_completed; } @@ -145,9 +145,9 @@ void chBottlesBonusCursor_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) { Actor *this; f32 sp3C; - this = marker_getActorAndRotation(chBottlesBonusSursorMarker, &rotation); + this = marker_getActorAndRotation(chBottlesBonusCursorMarker, rotation); modelRender_preDraw((GenFunction_1)actor_predrawMethod, (s32)this); - modelRender_postDraw((GenFunction_1)actor_postdrawMethod, (s32)chBottlesBonusSursorMarker); + modelRender_postDraw((GenFunction_1)actor_postdrawMethod, (s32)chBottlesBonusCursorMarker); modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); actor_setOpacity(this, 0xB9); func_8024E030(this->position, D_8037E5C0.unk18); @@ -157,7 +157,7 @@ void chBottlesBonusCursor_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) { (s32)sp3C, (s32)sp3C, D_803A5D00[func_8024BDA0()] ); - modelRender_draw(gfx, mtx, this->position, rotation, this->scale, NULL, func_80330B1C(chBottlesBonusSursorMarker)); + modelRender_draw(gfx, mtx, this->position, rotation, this->scale, NULL, func_80330B1C(chBottlesBonusCursorMarker)); func_8024E030(this->position, D_8037E5C0.unk10); if (this->state == 1) { D_8037E5C0.unk10[0] -= 24.0f; @@ -170,8 +170,8 @@ void chBottlesBonusCursor_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) { ActorMarker *chBottlesBonusCursor_spawn(void){ Actor *this = func_8032813C(0x2B4, D_80368400, 0); - chBottlesBonusSursorMarker = this->marker; - return chBottlesBonusSursorMarker; + chBottlesBonusCursorMarker = this->marker; + return chBottlesBonusCursorMarker; } void chBottlesBonusCursor_func_802DF928(s32 indx) { @@ -197,7 +197,7 @@ void chBottlesBonusCursor_freeMethod(Actor *this) { gameFile_load(func_8034BAFC()); func_80347AA8(); } - chBottlesBonusSursorMarker = 0; + chBottlesBonusCursorMarker = 0; } void chBottlesBonusCursor_update(Actor *this) { @@ -225,8 +225,8 @@ void chBottlesBonusCursor_update(Actor *this) { 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); + timedFunc_set_2(3.0f, (GenFunction_2)func_8025A6EC, COMUSIC_94_BBONUS, 0x5DC0); + timedFunc_set_1(3.0f, (GenFunction_1)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; @@ -275,7 +275,7 @@ void chBottlesBonusCursor_update(Actor *this) { 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); + subaddie_set_state_with_direction(this, 3, 0.0f, 1); actor_playAnimationOnce(this); } if((sp5C->button & R_CBUTTONS) && !(D_8037E5C0.prev_button & R_CBUTTONS)){ @@ -283,7 +283,7 @@ void chBottlesBonusCursor_update(Actor *this) { 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); + subaddie_set_state_with_direction(this, 4, 0.0f, 1); actor_playAnimationOnce(this); } } @@ -303,7 +303,7 @@ void chBottlesBonusCursor_update(Actor *this) { 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); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); } } @@ -312,7 +312,7 @@ void chBottlesBonusCursor_update(Actor *this) { ) { if (D_8037E248[D_8037E5B8 - 41].state == 3) { if( D_8037E5B8 - 41 != D_8037E248[D_8037E5B8 - 41].piece_id - || !vec4f_isAlmostZero(chBottlesBonus_func_802DEAF8(D_8037E5B8 - 41)) + || !vec4f_isAlmostZero(chBottlesBonus_get_piece_distance_vec4f(D_8037E5B8 - 41)) ) { D_8037E5C0.unk0 = D_8037E5B8 - 41; chBottlesBonus_func_802DEA50(D_8037E5C0.unk0); @@ -320,7 +320,7 @@ void chBottlesBonusCursor_update(Actor *this) { held_piece->state = 2; chBottlesBonusCursor_func_802DF928(D_8037E5C0.unk0); func_8030E484(SFX_112_TINKER_ATTENTION); - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); } } } @@ -330,7 +330,7 @@ void chBottlesBonusCursor_update(Actor *this) { 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); + subaddie_set_state_with_direction(this, 5, 0.0f, 1); func_8025A6EC(COMUISC_97_BBONUS_DROP_PIECE, -1); chBottlesBonus_func_802DEA50(D_8037E5C0.unk0); D_8037E5C0.unk0 = -1; @@ -341,64 +341,71 @@ void chBottlesBonusCursor_update(Actor *this) { 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) && vec4f_isAlmostZero(chBottlesBonus_func_802DEAF8(D_8037E5C0.unk0))) { + if ((D_8037E5C0.unk0 == held_piece->piece_id) && vec4f_isAlmostZero(chBottlesBonus_get_piece_distance_vec4f(D_8037E5C0.unk0))) { + //placed correctly sp44 = COMUSIC_2B_DING_B; - func_80328B8C(this, 6, 0.0f, 1); + subaddie_set_state_with_direction(this, 6, 0.0f, 1); actor_playAnimationOnce(this); } else { + //placed incorrectly sp44 = COMUSIC_2C_BUZZER; - func_80328B8C(this, 1, 0.0f, 1); + subaddie_set_state_with_direction(this, 1, 0.0f, 1); } if (chBottlesBonusCursor_checkPuzzleCompletion()) { - func_80328B8C(this, 8, 0.0f, 1); + subaddie_set_state_with_direction(this, 8, 0.0f, 1); actor_playAnimationOnce(this); } - timedFunc_set_2(0.25f, func_8025A6EC, sp44, 26000); + timedFunc_set_2(0.25f, (GenFunction_2)func_8025A6EC, sp44, 26000); chBottlesBonus_func_802DEA50(D_8037E5C0.unk0); D_8037E5C0.unk0 = -1; } } break; + //rotate CCW case 3://L802E0420 if (animctrl_isStopped(this->animctrl) ) { - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_loopAnimation(this); } break; + //rotate CW case 4://L802E0450 if (animctrl_isStopped(this->animctrl) ) { - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_loopAnimation(this); } break; case 7://L802E0480 if (animctrl_isStopped(this->animctrl) ) { - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_loopAnimation(this); } break; case 5://L802E04B0 - func_80328B8C(this, 1, 0.0f, 1); + subaddie_set_state_with_direction(this, 1, 0.0f, 1); break; + //placing correct piece 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); + subaddie_set_state_with_direction(this, 1, 0.0f, 1); actor_loopAnimation(this); } break; + //puzzle complete case 8://L802E0510 break; + case 9://L802E0510 break; } @@ -413,7 +420,7 @@ s32 chBottlesBonusCursor_func_802E0538(s32 indx){ s32 chBottlesBonusCursor_getState(void){ Actor *this; - this = marker_getActor(chBottlesBonusSursorMarker); + this = marker_getActor(chBottlesBonusCursorMarker); return this->state; } @@ -423,13 +430,13 @@ s32 chBottlesBonusCursor_func_802E0588(s32 indx){ 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]; + D_8037E5F8[0] = D_8036840C[0] + marker_getActor(chBottlesBonusCursorMarker)->position[0]; + D_8037E5F8[1] = D_8036840C[1] + marker_getActor(chBottlesBonusCursorMarker)->position[1]; + D_8037E5F8[2] = D_8036840C[2] + marker_getActor(chBottlesBonusCursorMarker)->position[2]; } else { - ml_vec3f_assign(&D_8037E5F8, 0, 0, 0); + ml_vec3f_assign(D_8037E5F8, 0, 0, 0); } - return &D_8037E5F8; + return D_8037E5F8; } f32 *chBottlesBonusCursor_func_802E0664(s32 indx){ @@ -451,7 +458,7 @@ bool chBottlesBonusCursor_isPuzzleCompleted(void){ void chBottlesBonusCursor_lose(void){ Actor *this; - this = marker_getActor(chBottlesBonusSursorMarker); - func_80328B8C(this, 9, 0.0f, 1); + this = marker_getActor(chBottlesBonusCursorMarker); + subaddie_set_state_with_direction(this, 9, 0.0f, 1); actor_playAnimationOnce(this); } diff --git a/src/core2/ch/climbBase.c b/src/core2/ch/climbBase.c index bd3d393d..c6c101a2 100644 --- a/src/core2/ch/climbBase.c +++ b/src/core2/ch/climbBase.c @@ -68,7 +68,7 @@ void func_802D77D4(Actor *this) { case 1: func_802D76E0(this, sp30); ml_vec3f_copy(local->unk0, sp30); - func_80328A84(this, 2); + subaddie_set_state(this, 2); return; case 2: diff --git a/src/core2/ch/collectible.c b/src/core2/ch/collectible.c index d3dfe0a2..30018158 100644 --- a/src/core2/ch/collectible.c +++ b/src/core2/ch/collectible.c @@ -47,7 +47,7 @@ void chCollectible_setState(Actor *arg0, s32 next_state){ actor_collisionOn(arg0); break; } - func_80328A84(arg0, next_state); + subaddie_set_state(arg0, next_state); } void func_802D8C98(Actor *this, s32 arg1) { diff --git a/src/core2/ch/crab.c b/src/core2/ch/crab.c index 40ff6efe..5d0582f2 100644 --- a/src/core2/ch/crab.c +++ b/src/core2/ch/crab.c @@ -50,14 +50,14 @@ void __chCrab_802CB078(Actor *this) { && ( (this->modelCacheIndex == ACTOR_F2_BLACK_SNIPPET) || func_803292E0(this)) ) { this->unk28 = 0.0f; - func_80328A84(this, 3U); + subaddie_set_state(this, 3U); } } } } void __chCrab_802CB140(Actor *this) { - func_80328A84(this, 2U); + subaddie_set_state(this, 2U); __chCrab_802CB040(this); func_80328CEC(this, (s32) this->yaw_ideal, 135, 175); this->unk38_31 = 150; @@ -70,7 +70,7 @@ void __chCrab_touch(ActorMarker *marker, ActorMarker *other){ if ((this->state == 4) && func_803294F0(this, 80, func_80329784(this))) { FUNC_8030E8B4(SFX_1E_HITTING_AN_ENEMY_2, 1.0f, 28000, this->position, 950, 1900); __chCrab_802CB140(this); - func_80328A84(this, 1); + subaddie_set_state(this, 1); } } @@ -79,7 +79,7 @@ void __chCrab_ow(ActorMarker *marker, ActorMarker *other) { this = marker_getActor(marker); this->unk60 = 3.0f; - func_80328A84(this, 6); + subaddie_set_state(this, 6); actor_playAnimationOnce(this); if (marker->unk14_20 == MARKER_13_SNIPPET) { FUNC_8030E8B4(SFX_6E_VILE_EGH, 2.0f, 26000, this->position, 950, 1900); @@ -292,14 +292,14 @@ void chCrab_update(Actor *this) { } if (levelSpecificFlags_get(0xE)) { if ((this->state != 8) && (this->state != 9)) { - func_80328B8C(this, (this->unk138_24) ? 8 : 9, 0.0f, 1); + subaddie_set_state_with_direction(this, (this->unk138_24) ? 8 : 9, 0.0f, 1); this->unk138_24 = FALSE; } } switch(this->state){ case 1: //L802CBE30 - if (func_80328B38(this, 2, 0.03f)) { + if (subaddie_maybe_set_state(this, 2, 0.03f)) { __chCrab_802CB040(this); } __chCrab_802CB078(this); @@ -307,7 +307,7 @@ void chCrab_update(Actor *this) { case 9: //L802CBE6C if (!levelSpecificFlags_get(0xE)) { - func_80328B8C(this, 3, 0.0f, 1); + subaddie_set_state_with_direction(this, 3, 0.0f, 1); } break; @@ -318,7 +318,7 @@ void chCrab_update(Actor *this) { ) { func_80328CEC(this, (s32) this->yaw, 90, 150); } - func_80328BD4(this, 1, 0.0f, 1, 0.0075f); + subaddie_maybe_set_state_position_direction(this, 1, 0.0f, 1, 0.0075f); __chCrab_802CB078(this); break; @@ -326,7 +326,7 @@ void chCrab_update(Actor *this) { this->yaw_ideal = (f32) func_80329784(this); func_80328FB0(this, 4.0f); if (func_80329480(this)) { - func_80328A84(this, 4); + subaddie_set_state(this, 4); this->unk28 = 12.0f; } break; @@ -335,10 +335,10 @@ void chCrab_update(Actor *this) { this->yaw_ideal = func_80329784(this) + 90.0; func_80328FB0(this, 4.0f); if (func_80329480(this)) { - func_80328A84(this, 9); + subaddie_set_state(this, 9); this->unk28 = 12.0f; } else if (!levelSpecificFlags_get(0xE)) { - func_80328B8C(this, 3, 0.0f, 1); + subaddie_set_state_with_direction(this, 3, 0.0f, 1); } break; @@ -355,7 +355,7 @@ void chCrab_update(Actor *this) { case 5: //L802CC0AC this->unk60 = MAX(0.0, this->unk60 - sp30); if (this->unk60 == 0.0f) { - func_80328A84(this, 7); + subaddie_set_state(this, 7); actor_playAnimationOnce(this); if (this->marker->unk14_20 == 0x16B) { this->marker->unk14_20 = MARKER_13_SNIPPET; @@ -371,7 +371,7 @@ void chCrab_update(Actor *this) { if (this->unk60 == 0.0f) { func_80326310(this); } else { - func_80328A84(this, 5); + subaddie_set_state(this, 5); actor_loopAnimation(this); } } @@ -379,7 +379,7 @@ void chCrab_update(Actor *this) { case 7: //L802CC1E8 if (animctrl_isStopped(this->animctrl)) { - func_80328A84(this, 1); + subaddie_set_state(this, 1); actor_loopAnimation(this); } break; diff --git a/src/core2/ch/gameSelect.c b/src/core2/ch/gameSelect.c index 0586c154..caa23cf3 100644 --- a/src/core2/ch/gameSelect.c +++ b/src/core2/ch/gameSelect.c @@ -315,7 +315,7 @@ void func_802C4C14(Actor *this){ func_802C7478(this); if(!sp80){ if(this->state != 1){ - func_80328A84(this, 1); + subaddie_set_state(this, 1); } } else{//L802C4D24 @@ -373,7 +373,7 @@ void func_802C4C14(Actor *this){ } } func_802C4768(sp84); - func_80328A84(this, 2); + subaddie_set_state(this, 2); break; case 5://L802C5040 if(D_8037DD2C == 0 && @@ -383,7 +383,7 @@ void func_802C4C14(Actor *this){ func_802C4AC8(sp84); func_8025A6EC(COMUSIC_2B_DING_B, 22000); } - func_80328A84(this, 2); + subaddie_set_state(this, 2); func_8031877C(chGameSelectTopZoombox); func_80318284(chGameSelectTopZoombox, 2, &D_8037DCE0); D_8037DD34 = 0.0f; @@ -417,7 +417,7 @@ void func_802C4C14(Actor *this){ func_8031877C(chGameSelectTopZoombox); func_803183A4(chGameSelectTopZoombox, (&D_80365DFC)[func_8031B5B0()]); D_8037DD2C = 1; - func_80328A84(this, 5); + subaddie_set_state(this, 5); } else{//L802C5240 func_8025A6EC(COMUSIC_2C_BUZZER, 22000); @@ -445,16 +445,16 @@ void func_802C4C14(Actor *this){ func_8030E540(SFX_8F_SNOWBALL_FLYING); break; }//L802C5394 - func_80328A84(this, 4); + subaddie_set_state(this, 4); levelSpecificFlags_set(sp84 + 0x35, 1); } else{//L802C53B4 func_8030E484(SFX_3EA_UNKNOWN); - func_80328A84(this, 3); + subaddie_set_state(this, 3); } }else{//L802C53D0 func_8030E510(SFX_4F_BANJO_WAHOO, 28000); - func_80328A84(this, 3); + subaddie_set_state(this, 3); }//L802C53E8 if(sp84 == 0) func_802C75A0(this, 2); diff --git a/src/core2/ch/ghost.c b/src/core2/ch/ghost.c index ee74e1dd..73d19ef0 100644 --- a/src/core2/ch/ghost.c +++ b/src/core2/ch/ghost.c @@ -76,7 +76,7 @@ void func_8035B1CC(ActorMarker *this_marker, ActorMarker *other_marker){ sp30 = this->scale; func_8030E878(SFX_121_AWAWAU, 1.3f, 32000, this->position, this->scale*400.0f, this->scale*1800.0f); func_8030E878(SFX_30_MAGIC_POOF, 1.0f, 32000, this->position, this->scale*400.0f, this->scale*1800.0f); - func_80328B8C(this, 6, 0.01f, 1); + subaddie_set_state_with_direction(this, 6, 0.01f, 1); actor_playAnimationOnce(this); actor_collisionOff(this); func_80326310(this); @@ -88,7 +88,7 @@ void func_8035B2C4(ActorMarker *this_marker, ActorMarker *other_marker){ f32 sp30 = this->scale; func_8030E878(SFX_121_AWAWAU, 1.3f, 32000, this->position, this->scale*400.0f, this->scale*1800.0f); func_8030E878(SFX_30_MAGIC_POOF, 1.0f, 32000, this->position, this->scale*400.0f, this->scale*1800.0f); - func_80328B8C(this, 6, 0.01f, 1); + subaddie_set_state_with_direction(this, 6, 0.01f, 1); actor_playAnimationOnce(this); actor_collisionOff(this); func_8035AFE0(sp30, this->position, 8, ASSET_700_SPRITE_DUST, D_80372C6C); @@ -160,21 +160,21 @@ void func_8035B56C(Actor *this){ void func_8035B674(Actor *this){ ActorLocal_Core2_D4050 *local = (ActorLocal_Core2_D4050 *)&this->local; - func_80328B8C(this, 1, 0.01f, 1); + subaddie_set_state_with_direction(this, 1, 0.01f, 1); actor_loopAnimation(this); local->unk0 = randf2(1.0f, 4.5f); } void func_8035B6CC(Actor *this){ - func_80328B8C(this, 2, 0.01f, 1); + subaddie_set_state_with_direction(this, 2, 0.01f, 1); actor_playAnimationOnce(this); this->unk28 = 1.0f; func_8030E878(0x3F4, randf2(1.0f, 1.2f), 32000, this->position, this->scale*400.0f, this->scale*1800.0f); } void func_8035B75C(Actor *this){ - func_80328B8C(this, 3, 0.01f, 1); + subaddie_set_state_with_direction(this, 3, 0.01f, 1); actor_loopAnimation(this); this->unk28 = func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE) ? 0.0 : 12.0; func_8030E878(0x3F4, randf2(1.0f, 1.2f), 32000, this->position, this->scale*400.0f, this->scale*1800.0f); @@ -183,7 +183,7 @@ void func_8035B75C(Actor *this){ void func_8035B824(Actor *this){ ActorLocal_Core2_D4050 *local = (ActorLocal_Core2_D4050 *)&this->local; - func_80328B8C(this, 4, 0.01f, 1); + subaddie_set_state_with_direction(this, 4, 0.01f, 1); actor_loopAnimation(this); func_80328CEC(this, (s32)this->yaw_ideal, 0xA, 0x1E); this->unk28 = 4.0f; @@ -193,7 +193,7 @@ void func_8035B824(Actor *this){ } void func_8035B8A8(Actor *this){ - func_80328B8C(this, 5, 0.01f, 1); + subaddie_set_state_with_direction(this, 5, 0.01f, 1); actor_loopAnimation(this); func_80328CEC(this, (s32)this->yaw_ideal, 0xE1, 0x87); } @@ -314,12 +314,12 @@ void func_8035BD48(Actor *this){ marker_despawn(this->marker); } else{//L8035BE04 - func_80328B8C(this, 1, 0.01f, 1); + subaddie_set_state_with_direction(this, 1, 0.01f, 1); actor_setOpacity(this, 0); } } else{//L8035BE2C - func_80328B8C(this, 3, 0.01f, 1); + subaddie_set_state_with_direction(this, 3, 0.01f, 1); actor_setOpacity(this, 0xff); } }//L8035BE50 @@ -331,7 +331,7 @@ void func_8035BD48(Actor *this){ marker_despawn(this->marker); } else if(mapSpecificFlags_getClear(3)){ - func_80328B8C(this, 3, 0.01f, 1); + subaddie_set_state_with_direction(this, 3, 0.01f, 1); } break; case 3: //L8035BECC @@ -360,7 +360,7 @@ void func_8035BD48(Actor *this){ marker_despawn(this->marker); } else{ - func_80328B8C(this, 1, 0.01f, 1); + subaddie_set_state_with_direction(this, 1, 0.01f, 1); timedFunc_set_2(randf2(5.0f, 10.0f), mapSpecificFlags_set, 3, TRUE); } } diff --git a/src/core2/ch/gloop.c b/src/core2/ch/gloop.c index fbe1722b..f1a6cf1c 100644 --- a/src/core2/ch/gloop.c +++ b/src/core2/ch/gloop.c @@ -56,7 +56,7 @@ void chgloop_update(Actor *this){ case 2://L802D14DC actor_loopAnimation(this); if(this->unk54 != 0.0f) - func_80328A84(this, 4); + subaddie_set_state(this, 4); if( !mapSpecificFlags_get(2) && func_80329530(this, 350) @@ -69,7 +69,7 @@ void chgloop_update(Actor *this){ case 4://L802D1558 actor_playAnimationOnce(this); if(this->unk54 == 0.0f) - func_80328A84(this, 2); + subaddie_set_state(this, 2); if(actor_animationIsAt(this, 0.6f)){ if(this->marker->unk14_21){ diff --git a/src/core2/ch/gravestone.c b/src/core2/ch/gravestone.c index cb360cdf..c3fef13b 100644 --- a/src/core2/ch/gravestone.c +++ b/src/core2/ch/gravestone.c @@ -97,14 +97,14 @@ void func_8035EE48(Actor *this){ } void func_8035EE80(Actor *this){ - func_80328A84(this, 3); + subaddie_set_state(this, 3); actor_loopAnimation(this); this->unk28 = 10.5f; func_8035EE48(this); } void func_8035EEC0(Actor *this){ - func_80328A84(this, 4); + subaddie_set_state(this, 4); actor_loopAnimation(this); this->unk28 = 9.0f; func_8035EE48(this); @@ -130,7 +130,7 @@ void func_8035EF9C(ActorMarker *marker, ActorMarker *other_marker) { this = marker_getActor(marker); local = (ActorLocal_core2_D7D10 *)&this->local; this->velocity[2] = 0.0f; - func_80328B8C(this, 7, 0.02f, 1); + subaddie_set_state_with_direction(this, 7, 0.02f, 1); actor_playAnimationOnce(this); local->unk0 = 2; actor_collisionOff(this); @@ -149,7 +149,7 @@ void func_8035F048(ActorMarker *marker, ActorMarker *other_marker) { FUNC_8030E8B4(SFX_F9_GRUNTLING_NOISE_1, 1.2f, 22000, this->position, 1750, 3500); FUNC_8030E8B4(SFX_1D_HITTING_AN_ENEMY_1, 0.9f, 22000, this->position, 1750, 3500); this->velocity[2] = 0.0f; - func_80328B8C(this, 6, 0.02f, 1); + subaddie_set_state_with_direction(this, 6, 0.02f, 1); actor_playAnimationOnce(this); local->unk0 = 2; func_8035EE48(this); @@ -199,7 +199,7 @@ void func_8035F138(Actor *this) { } animctrl_setAnimTimer(this->animctrl, 0.0f); if (func_80329530(this, (s32) (this->scale * 650.0f)) && func_803292E0(this)) { - func_80328A84(this, 2U); + subaddie_set_state(this, 2U); actor_playAnimationOnce(this); this->unk1C[1] = 1.0f; this->unk44_31 = func_8030ED2C(SFX_2C_PULLING_NOISE, 3); @@ -251,7 +251,7 @@ void func_8035F138(Actor *this) { } this->unk38_31 -= sp2C; if (func_8035ED60(this)) { - func_80328B8C(this, 5, 0.99f, 0); + subaddie_set_state_with_direction(this, 5, 0.99f, 0); actor_playAnimationOnce(this); this->unk28 = 0.0f; this->unk1C[1] = 1.9f; @@ -275,7 +275,7 @@ void func_8035F138(Actor *this) { func_8030DBB4(this->unk44_31, this->unk1C[1]); } if (animctrl_getAnimTimer(this->animctrl) <= 0.02) { - func_80328B8C(this, 1, 0.02f, 1); + subaddie_set_state_with_direction(this, 1, 0.02f, 1); actor_playAnimationOnce(this); this->unk28 = 0.0f; func_8035EE48(this); diff --git a/src/core2/ch/icecube.c b/src/core2/ch/icecube.c index 023b82f8..f0869693 100644 --- a/src/core2/ch/icecube.c +++ b/src/core2/ch/icecube.c @@ -232,20 +232,20 @@ void __chicecube_die(ActorMarker *marker, ActorMarker *other_marker){ } void func_8035A998(Actor *this){ - func_80328B8C(this, 1, 0.0001f, 1); + subaddie_set_state_with_direction(this, 1, 0.0001f, 1); actor_playAnimationOnce(this); this->unk38_31 = 0; } void func_8035A9E0(Actor *this){ - func_80328B8C(this, 3, animctrl_getAnimTimer(this->animctrl), 1); + subaddie_set_state_with_direction(this, 3, animctrl_getAnimTimer(this->animctrl), 1); actor_loopAnimation(this); this->unk38_31 = 1; this->unk28 = 0.0f; } void func_8035AA40(Actor *this){ - func_80328B8C(this, 5, 0.9999f, 0); + subaddie_set_state_with_direction(this, 5, 0.9999f, 0); actor_playAnimationOnce(this); this->unk38_31 = 1; } @@ -305,7 +305,7 @@ void chicecube_update(Actor *this){ if( func_80359DF4(this, 900) || (this->unkF4_8 == 2 && func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE)) ){ - func_80328B8C(this, 2, 0.0001f, 1); + subaddie_set_state_with_direction(this, 2, 0.0001f, 1); actor_playAnimationOnce(this); this->unk38_31 = 0x1; } @@ -330,7 +330,7 @@ void chicecube_update(Actor *this){ } func_8035A694(this); if(!func_80359DF4(this, 1300)){ - func_80328B8C(this, 4, animctrl_getAnimTimer(this->animctrl), 1); + subaddie_set_state_with_direction(this, 4, animctrl_getAnimTimer(this->animctrl), 1); actor_loopAnimation(this); this->unk38_31 = 1; } diff --git a/src/core2/ch/jiggy.c b/src/core2/ch/jiggy.c index f1dfc3ce..5a1a3c86 100644 --- a/src/core2/ch/jiggy.c +++ b/src/core2/ch/jiggy.c @@ -142,7 +142,7 @@ void chjiggy_update(Actor *this){ marker_despawn(this->marker); } else{ - func_80328A84(this, 2); + subaddie_set_state(this, 2); switch(chjiggy_getJiggyId(this)){ case JIGGY_17_CC_CLANKER_RAISED: //L802C7EF8 case JIGGY_49_CCW_EYRIE:// L802C7EF8 diff --git a/src/core2/ch/jigsawdance.c b/src/core2/ch/jigsawdance.c index 00848b70..26aee375 100644 --- a/src/core2/ch/jigsawdance.c +++ b/src/core2/ch/jigsawdance.c @@ -81,15 +81,15 @@ void chJigsawDance_setState(Actor * this, u32 arg1){ switch(arg1){ case 3: if(this->state == 1){ - func_80328A84(this, 2); + subaddie_set_state(this, 2); animctrl_setPlaybackType(this->animctrl, ANIMCTRL_ONCE); } break; case 2: - func_80328A84(this, 3); + subaddie_set_state(this, 3); break; case 1: - func_80328A84(this, 4); + subaddie_set_state(this, 4); break; case 4: player_getPosition(this->position); @@ -100,7 +100,7 @@ void chJigsawDance_setState(Actor * this, u32 arg1){ animctrl_start(this->animctrl, "chjigsawdance.c", 0x97); break; case 5: - func_80328A84(this, 5); + subaddie_set_state(this, 5); this->marker->propPtr->unk8_4 = 0; break; } diff --git a/src/core2/ch/jinjo.c b/src/core2/ch/jinjo.c index f2188fae..9438d729 100644 --- a/src/core2/ch/jinjo.c +++ b/src/core2/ch/jinjo.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" -extern void func_80328B8C(Actor *, s32, f32 , s32); +extern void subaddie_set_state_with_direction(Actor *, s32, f32 , s32); extern f32 func_80309B24(f32*); extern void func_80329904(ActorMarker*, s32, f32*); extern void func_80326310(Actor *); @@ -50,7 +50,7 @@ void __chJinjo_802CDBA8(ActorMarker *this, ActorMarker *other){ func_80311480(__chJinjo_getMeetDialogId(actorPtr->marker->unk14_20), 4, 0, 0, 0, 0); fileProgressFlag_set(FILEPROG_E_JINJO_TEXT, 1); } - func_80328B8C(actorPtr, 6, 0.0f , -1); + subaddie_set_state_with_direction(actorPtr, 6, 0.0f , -1); if(func_803463D4(ITEM_12_JINJOS, 1 << (this->unk14_20 + 6) ) == 0x1f) localPtr->unk4 = 1; actor_loopAnimation(actorPtr); @@ -128,9 +128,9 @@ void chJinjo_update(Actor * this){ case 1: if(randf() < 0.015){ if(sp60){ - func_80328B8C(this, 3, 0.0f, -1); + subaddie_set_state_with_direction(this, 3, 0.0f, -1); }else{ - func_80328B8C(this, 2, 0.0f, -1); + subaddie_set_state_with_direction(this, 2, 0.0f, -1); } actor_playAnimationOnce(this); }//L802CDF24 @@ -139,13 +139,13 @@ void chJinjo_update(Actor * this){ case 2: /* 46FA0 802CDF30 3C053F7D */ case 3: if(actor_animationIsAt(this, 0.99f)){ - func_80328B8C(this, 1, 0.0f, -1); + subaddie_set_state_with_direction(this, 1, 0.0f, -1); } break; case 4: /* 46FD8 802CDF68 3C053F7D */ if(actor_animationIsAt(this, 0.99f)){ - func_80328B8C(this, 1, 0.0f, -1); + subaddie_set_state_with_direction(this, 1, 0.0f, -1); }else{//L802CDF9C tmp_f0 = this->yaw; if(sp66 >= 0){ @@ -165,7 +165,7 @@ void chJinjo_update(Actor * this){ case 6:/* 47094 802CE024 02002025 */ __chJinjo_802CDC9C(this, sp66); if(actor_animationIsAt(this, 0.0f) && --(local->unk0) == 0){ - func_80328B8C(this, 7, 0.0f, -1); + subaddie_set_state_with_direction(this, 7, 0.0f, -1); actor_playAnimationOnce(this); if(local->unk4){ sp40[0] = this->position_x; @@ -270,14 +270,14 @@ void chJinjo_update(Actor * this){ if(sp50){ if(actor_animationIsAt(this, 0.96f) || actor_animationIsAt(this, 0.99f)){ - func_80328B8C(this, 8, 0.0f, -1); + subaddie_set_state_with_direction(this, 8, 0.0f, -1); actor_playAnimationOnce(this); } } break; }//L802CE5F0 if(this->state < 4 && !(((sp66 >= 0)? sp66: -sp66) <= 0x1000)){ - func_80328B8C(this, 4, 0.0f, -1); + subaddie_set_state_with_direction(this, 4, 0.0f, -1); actor_playAnimationOnce(this); }//L802CE630 if(!func_803114B0()){ diff --git a/src/core2/ch/mole.c b/src/core2/ch/mole.c index 3bb1fa56..1f06a5fd 100644 --- a/src/core2/ch/mole.c +++ b/src/core2/ch/mole.c @@ -117,9 +117,9 @@ void func_802D9530(Actor *this){ Actor *other = subaddie_getLinkedActor(this); if(this->unk100 && other){ if(this->unk100->unk14_20 == 0xB8) - func_80328B8C(other, 3, 0.0001f, 1); + subaddie_set_state_with_direction(other, 3, 0.0001f, 1); } - func_80328B8C(this, 4, 0.0001f, 1); + subaddie_set_state_with_direction(this, 4, 0.0001f, 1); actor_playAnimationOnce(this); this->unk44_31 = func_8030D90C(); sfxsource_setSfxId(this->unk44_31, SFX_3F9_UNKNOWN); @@ -131,7 +131,7 @@ void func_802D9530(Actor *this){ void func_802D9600(Actor * this){ animctrl_setSmoothTransition(this->animctrl, 0); - func_80328B8C(this, 1, 0.0001f, 1); + subaddie_set_state_with_direction(this, 1, 0.0001f, 1); this->marker->propPtr->unk8_3 = 0; } @@ -232,11 +232,11 @@ int func_802D997C(Actor *this){ void func_802D9ADC(Actor *this){ Actor *other = subaddie_getLinkedActor(this); if(this->unk100 && other && this->unk100->unk14_20 == 0xB8){ - func_80328B8C(other, 2, 0.0001f, 1); + subaddie_set_state_with_direction(other, 2, 0.0001f, 1); } this->marker->propPtr->unk8_3 = 1; animctrl_setSmoothTransition(this->animctrl, TRUE); - func_80328B8C(this, 2, 0.0001f, 1); + subaddie_set_state_with_direction(this, 2, 0.0001f, 1); actor_playAnimationOnce(this); this->unk44_31 = func_8030D90C(); sfxsource_setSfxId(this->unk44_31, SFX_3F9_UNKNOWN); @@ -248,14 +248,14 @@ void func_802D9ADC(Actor *this){ } void func_802D9BD8(Actor *this){ - func_80328A84(this, 5); + subaddie_set_state(this, 5); func_802D9658(this); func_8028F94C(2, this->position); func_802D997C(this); } void func_802D9C1C(Actor *this){ - func_80328B8C(this, 3, 0.0001f, 1); + subaddie_set_state_with_direction(this, 3, 0.0001f, 1); actor_loopAnimation(this); } @@ -310,7 +310,7 @@ void func_802D9D60(Actor *this){ if(this->unk100){ other = subaddie_getLinkedActor(this); if(other && this->unk100->unk14_20 == 0xB8){ - func_80328A84(other, 1); + subaddie_set_state(other, 1); } } } diff --git a/src/core2/ch/molehill.c b/src/core2/ch/molehill.c index dba736f6..d571b58a 100644 --- a/src/core2/ch/molehill.c +++ b/src/core2/ch/molehill.c @@ -79,7 +79,7 @@ void func_802DA740(Actor *this){ break; case 2: //L802DA7C4 if(actor_animationIsAt(this, 0.9999f)){ - func_80328B8C(this, 1, 0.0001f, 1); + subaddie_set_state_with_direction(this, 1, 0.0001f, 1); } else{ if(local->unk0 && actor_animationIsAt(this, 0.05f)){ @@ -89,7 +89,7 @@ void func_802DA740(Actor *this){ break; case 3: //L802DA838 if(actor_animationIsAt(this, 0.9999f)){ - func_80328B8C(this, 1, 0.0001f, 1); + subaddie_set_state_with_direction(this, 1, 0.0001f, 1); } else if(local->unk0){ if(actor_animationIsAt(this, 0.3f)){ diff --git a/src/core2/ch/overlaynocontroller.c b/src/core2/ch/overlaynocontroller.c index e409da22..e870582f 100644 --- a/src/core2/ch/overlaynocontroller.c +++ b/src/core2/ch/overlaynocontroller.c @@ -23,7 +23,7 @@ ActorInfo D_80368174 = { }; /* .bss */ -ActorMarker *D_8037DE90; +ActorMarker *chOverlayNoController_marker; /* .code */ Actor *chOverlayNoController_draw(ActorMarker *marker, Gfx **gdl, Mtx **mptr, Vtx **vptr){ @@ -53,7 +53,7 @@ Actor *chOverlayNoController_draw(ActorMarker *marker, Gfx **gdl, Mtx **mptr, Vt } void chOverlayNoController_freeMethod(Actor *this){ - D_8037DE90 = NULL; + chOverlayNoController_marker = NULL; } void chOverlayNoController_update(Actor *this) { @@ -61,24 +61,24 @@ void chOverlayNoController_update(Actor *this) { this->initialized = TRUE; this->depth_mode = MODEL_RENDER_DEPTH_NONE; actor_collisionOff(this); - func_80328B8C(this, 1, 0.0f, 1); + subaddie_set_state_with_direction(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); + subaddie_set_state_with_direction(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; + if(chOverlayNoController_marker == NULL){ + chOverlayNoController_marker = func_8032813C(ACTOR_1DF_NO_CONTROLLER_OVERLAY, D_80368168, 0)->marker; } } void chOverlayNoController_spawn(s32 arg0, s32 arg1){ - if(D_8037DE90 == NULL){ + if(chOverlayNoController_marker == NULL){ __spawnQueue_add_0(__chOverlayNoController_spawn); } } @@ -86,7 +86,7 @@ void chOverlayNoController_spawn(s32 arg0, s32 arg1){ void chOverlayNoController_func_802DD040(s32 arg0, s32 arg1) { ActorMarker *temp_a0; - temp_a0 = D_8037DE90; + temp_a0 = chOverlayNoController_marker; if (temp_a0 != 0) { func_80326310(marker_getActor(temp_a0)); } diff --git a/src/core2/ch/overlaypressstart.c b/src/core2/ch/overlaypressstart.c index 69971614..2777d9fa 100644 --- a/src/core2/ch/overlaypressstart.c +++ b/src/core2/ch/overlaypressstart.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" -extern void func_80328B8C(Actor *, s32, f32, s32); +extern void subaddie_set_state_with_direction(Actor *, s32, f32, s32); extern void actor_predrawMethod(Actor *); extern void actor_postdrawMethod(ActorMarker *); extern Actor *func_8032813C(enum actor_e id, f32[3], s32); @@ -72,13 +72,13 @@ void chOverlayPressStart_update(Actor *this){ this->initialized = 1; this->depth_mode = MODEL_RENDER_DEPTH_NONE; actor_collisionOff(this); - func_80328B8C(this, 1, 0.0f, 1); + subaddie_set_state_with_direction(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); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_loopAnimation(this); } } diff --git a/src/core2/ch/shrapnel.c b/src/core2/ch/shrapnel.c index 3361715d..ad81168d 100644 --- a/src/core2/ch/shrapnel.c +++ b/src/core2/ch/shrapnel.c @@ -36,13 +36,13 @@ void chShrapnel_func_802D0A38(Actor *this){ else{ if(func_80329530(this, 600) && func_803292E0(this)){ this->unk28 = 0.0f; - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); } } } void chShrapnel_func_802D0AB8(Actor *this) { - func_80328B8C(this, 1, 0.0f, 0); + subaddie_set_state_with_direction(this, 1, 0.0f, 0); chShrapnel_func_802D0A00(this); func_80328CEC(this, (s32) this->yaw_ideal, 0x87, 0xAF); this->unk38_31 = 0x1E; @@ -167,7 +167,7 @@ void chshrapnel_update(Actor *this) { func_80328FB0(this, 4.0f); if (func_80329480(this)) { if (250.0 > ABS(player_position[1] - this->unk1C[1])) { - func_80328A84(this, 3); + subaddie_set_state(this, 3); actor_loopAnimation(this); FUNC_8030E8B4(SFX_C4_TWINKLY_MUNCHER_GRR, 0.6f, 32750, this->position, 1250, 2500); this->unk28 = 4.0f; diff --git a/src/core2/ch/snowball.c b/src/core2/ch/snowball.c index dc6b679c..b5404a14 100644 --- a/src/core2/ch/snowball.c +++ b/src/core2/ch/snowball.c @@ -70,7 +70,7 @@ void __chSnowball_collisionCallback(Actor *this, bool water_collision) { func_8030E878(SFX_F_SMALL_WATER_SPLASH, randf2(0.8f, 1.2f), 32000, this->position, 1250.0f, 2500.0f); actor_collisionOff(this); func_80326310(this); - func_80328A84(this, 2U); + subaddie_set_state(this, 2U); } else{ func_8030E878(SFX_2F_ORANGE_SPLAT, 1.0f, 32000, this->position, 1250.0f, 2500.0f); diff --git a/src/core2/ch/snowman.c b/src/core2/ch/snowman.c index 69f3a3e8..4fab6ce3 100644 --- a/src/core2/ch/snowman.c +++ b/src/core2/ch/snowman.c @@ -4,7 +4,7 @@ extern int func_802592C4(f32[3], f32[3], f32); extern void func_802EFA20(ParticleEmitter *, f32, f32); -extern void func_80328B8C(Actor *, s32, f32, s32); +extern void subaddie_set_state_with_direction(Actor *, s32, f32, s32); extern void func_80328FB0(Actor *, f32); extern void func_803300C0(ActorMarker *, void *); @@ -133,13 +133,13 @@ void __chSnowman_spawnSnowballParticles(f32 position[3], s32 count){ void __chSnowman_enterIdle(Actor *this){ ActorLocal_chSirSlush *local = (ActorLocal_chSirSlush *) &this->local; - func_80328B8C(this, CHSNOWMAN_STATE_1_IDLE, 0.01f, 1); + subaddie_set_state_with_direction(this, CHSNOWMAN_STATE_1_IDLE, 0.01f, 1); actor_loopAnimation(this); local->unk4 = 0.4f; } void __chSnowman_enterDeath(Actor *this){ - func_80328B8C(this, CHSNOWMAN_STATE_3_DIE, 0.01f, 1); + subaddie_set_state_with_direction(this, CHSNOWMAN_STATE_3_DIE, 0.01f, 1); actor_playAnimationOnce(this); } @@ -272,7 +272,7 @@ void chSnowman_update(Actor *this){ && func_8028EE84() != BSWATERGROUP_2_UNDERWATER && !__chSnowman_CCW_playerInProtectedZone() ){ - func_80328B8C(this, CHSNOWMAN_STATE_2_ATTACK, 0.01f, 1); + subaddie_set_state_with_direction(this, CHSNOWMAN_STATE_2_ATTACK, 0.01f, 1); actor_playAnimationOnce(this); } } diff --git a/src/core2/ch/snowmanhat.c b/src/core2/ch/snowmanhat.c index aee78e6e..ad398225 100644 --- a/src/core2/ch/snowmanhat.c +++ b/src/core2/ch/snowmanhat.c @@ -27,7 +27,7 @@ void chSnowmanHat_update(Actor *this){ this->pitch -= 360.0f; if(this->position_y <= func_80309724(this->position)){ - func_80328A84(this, 2); + subaddie_set_state(this, 2); FUNC_8030E8B4(SFX_1D_HITTING_AN_ENEMY_1, 1.0f, 32750, this->position, 2250, 4500); } break; diff --git a/src/core2/ch/termite.c b/src/core2/ch/termite.c index df22c6d9..8d423ca3 100644 --- a/src/core2/ch/termite.c +++ b/src/core2/ch/termite.c @@ -121,7 +121,7 @@ void __chTermite_ow(ActorMarker *marker, ActorMarker *other_marker){ Actor *this; this = marker_getActor(marker); - func_80328AC8(this, 6); + subaddie_set_state_forward(this, 6); } void __chTermite_die(ActorMarker *marker, ActorMarker *other_marker){ @@ -187,7 +187,7 @@ void chTermite_update(Actor *this) { } switch (this->state) { case 1: - if (func_80328BD4(this, 2, 0.0f, 1, 0.06f)) { + if (subaddie_maybe_set_state_position_direction(this, 2, 0.0f, 1, 0.06f)) { __chTermite_updateRandomRotationSpeed(this); __chTermite_updateRandomSpeed(this); this->unk28 = 0.0f; @@ -222,11 +222,11 @@ void chTermite_update(Actor *this) { } __chTermite_updateAnimationSpeed(this); func_80329030(this, 0); - func_80328BD4(this, 1, 0.0f, 1, 0.047f); + subaddie_maybe_set_state_position_direction(this, 1, 0.0f, 1, 0.047f); return; case 6: if (actor_animationIsAt(this, 0.95f) != 0) { - func_80328AC8(this, 1); + subaddie_set_state_forward(this, 1); } break; } diff --git a/src/core2/ch/trainers.c b/src/core2/ch/trainers.c index 4f6082e7..9a8358bc 100644 --- a/src/core2/ch/trainers.c +++ b/src/core2/ch/trainers.c @@ -67,7 +67,7 @@ void chtrainers_update(Actor *this){ this->velocity[0] = this->yaw; this->velocity[1] = 0.0f; this->unk10_12 = !func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE) && !func_803203FC(0x1); - func_80328A84(this, 0); + subaddie_set_state(this, 0); } if(!func_803203FC(0xF) && ability_isUnlocked(ABILITY_11_TURBO_TALON)){ @@ -92,14 +92,14 @@ void chtrainers_update(Actor *this){ case 1://L802CA630 this->velocity[2] -= time_getDelta(); if(this->velocity[2] <= 0.0f){ - func_80328A84(this, 2); + subaddie_set_state(this, 2); } break; case 2://L802CA670 if(player_stateTimer_get(STATE_TIMER_3_TURBO_TALON) == 0.0f){ this->velocity[2] = 1.0f; - func_80328A84(this, 3); + subaddie_set_state(this, 3); } break; @@ -107,7 +107,7 @@ void chtrainers_update(Actor *this){ this->velocity[2] -= time_getDelta(); if(this->velocity[2] <= 0.0f){ this->unk10_12 = 1; - func_80328A84(this, 0); + subaddie_set_state(this, 0); } break; }//L802CA6F8 @@ -122,7 +122,7 @@ f32 chtrainers_getDuration(Actor *this){ } void chtrainers_pickup(Actor *this){ - func_80328A84(this, 1); + subaddie_set_state(this, 1); this->velocity[2] = 1.0f; this->unk10_12 = 0; } diff --git a/src/core2/ch/wadingboots.c b/src/core2/ch/wadingboots.c index 713cac16..e3c77034 100644 --- a/src/core2/ch/wadingboots.c +++ b/src/core2/ch/wadingboots.c @@ -42,7 +42,7 @@ void chwadingboots_update(Actor *this){ this->initialized = TRUE; this->velocity[0] = this->yaw; this->unk10_12 = !func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE) && !func_803203FC(0x1); - func_80328A84(this, 0); + subaddie_set_state(this, 0); } if(!func_803203FC(0x10) && ability_isUnlocked(ABILITY_E_WADING_BOOTS)){ @@ -78,14 +78,14 @@ void chwadingboots_update(Actor *this){ case 1://L802D6D34 this->velocity[1] -= time_getDelta(); if(this->velocity[1] <= 0.0f){ - func_80328A84(this, 2); + subaddie_set_state(this, 2); } break; case 2://L802D6D74 if(player_stateTimer_get(STATE_TIMER_2_LONGLEG) == 0.0f){ this->velocity[1] = 1.5f; - func_80328A84(this, 3); + subaddie_set_state(this, 3); } break; @@ -93,7 +93,7 @@ void chwadingboots_update(Actor *this){ this->velocity[1] -= time_getDelta(); if(this->velocity[1] <= 0.0f){ this->unk10_12 = 1; - func_80328A84(this, 0); + subaddie_set_state(this, 0); } break; }//L802D6DFC @@ -108,7 +108,7 @@ f32 chwadingboots_802D6E4C(Actor *this){ } void chwadingboots_802D6E54(Actor *this){ - func_80328A84(this, 1); + subaddie_set_state(this, 1); this->velocity[1] = 1.5f; this->unk10_12 = 0; } diff --git a/src/core2/code_13A00.c b/src/core2/code_13A00.c index e9334a8b..5ced3ba1 100644 --- a/src/core2/code_13A00.c +++ b/src/core2/code_13A00.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" extern void func_802F494C(void *, f32); extern void func_802F4884(void *, s32, f32); @@ -43,7 +44,7 @@ void func_8029AA3C(void){ else func_8029C304(2); - sp30 = ml_map_f(_get_horzVelocity(), 0.0f, 500.0f, 70.0f, 250.0f); + sp30 = ml_map_f(baphysics_get_horizontal_velocity(), 0.0f, 500.0f, 70.0f, 250.0f); func_8028E9C4(D_8037D194, sp34); sp34[1] = func_80294500(); pCtrl = func_802F4094(sp34, 8.0f); diff --git a/src/core2/code_14420.c b/src/core2/code_14420.c index 98e06cd1..1c38e6b5 100644 --- a/src/core2/code_14420.c +++ b/src/core2/code_14420.c @@ -4,6 +4,7 @@ #include "core2/yaw.h" #include "core2/statetimer.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" f32 func_8024DDD8(f32[3], f32); extern void func_8024E71C(s32, f32*); @@ -623,12 +624,12 @@ void func_8029C22C(void) { return; D_80364620 = D_80364620 ? FALSE : TRUE; - if (_get_horzVelocity() > 100.0f) { + if (baphysics_get_horizontal_velocity() > 100.0f) { if (D_80364620) { - func_80292864(func_80297A7C() - 20.0f, 20.0f); + func_80292864(baphysics_get_target_yaw() - 20.0f, 20.0f); } else{ - func_80292864(func_80297A7C() + 20.0f, 20.0f); + func_80292864(baphysics_get_target_yaw() + 20.0f, 20.0f); } } } @@ -660,7 +661,7 @@ void func_8029C3E8(f32 arg0, f32 arg1) { f32 sp28; _player_getPosition(sp30); - sp28 = ml_map_f(_get_horzVelocity(), 0.0f, 1000.0f, arg0, arg1); + sp28 = ml_map_f(baphysics_get_horizontal_velocity(), 0.0f, 1000.0f, arg0, arg1); sp2C = player_getYaw(); func_802589E4(sp3C, sp2C, sp28); sp3C[1] = 0.0f; @@ -764,11 +765,11 @@ enum bs_e func_8029C780(void){ return BS_5_JUMP; } -void func_8029C7F4(enum baanim_update_type_e arg0, enum yaw_state_e yaw_state, s32 arg2, s32 arg3){ +void func_8029C7F4(enum baanim_update_type_e arg0, enum yaw_state_e yaw_state, s32 arg2, BaPhysicsType arg3){ baanim_setUpdateType(arg0); yaw_setUpdateState(yaw_state); func_8029957C(arg2); - func_802978DC(arg3); + baphysics_set_type(arg3); } void func_8029C834(enum map_e map_id, s32 exit_id){ diff --git a/src/core2/code_1550.c b/src/core2/code_1550.c index 2cdb5de2..18274cc2 100644 --- a/src/core2/code_1550.c +++ b/src/core2/code_1550.c @@ -4,46 +4,66 @@ #include "animation.h" +typedef struct animation_file_cache_s{ + AnimationFile *ptr; + u16 exp_timer:15; + u16 persist:1; + u8 pad6[2]; +}AnimationFileCache; + AnimationFile *animBinCache_get(enum asset_e assest_id); /* .data */ -s16 D_803635C0[] = {0x1, 0x3, 0x5, 0xC, 0xE, 0x17, 0x18, 0x19, 0x1A, 0x1C, 0x1D, 0}; +s16 animBinCache_persistantList[] = { + ASSET_1_ANIM_BSCROUCH_ENTER, + ASSET_3_ANIM_BSWALK, + ASSET_5_ANIM_BSPUNCH, + ASSET_C_ANIM_BSWALK_RUN, + ASSET_E_ANIM_BSTURN, + ASSET_17_ANIM_BSBFLAP, + ASSET_18_ANIM_BSBFLAP_ENTER, + ASSET_19_ANIM_BSBPECK_ENTER, + ASSET_1A_ANIM_BSBPECK, + ASSET_1C_ANIM_BSBBARGE, + ASSET_1D_ANIM_BSBBUSTER, + 0 +}; /* .bss */ -AnimationFileCache D_8037A8C0[0x2CA]; +AnimationFileCache animBinCache[0x2CA]; /* .code */ -void func_802884E0(void){ +static void __animBinCache_initPersistent(void){ s16 *phi_v0; - for( phi_v0 = D_803635C0; *phi_v0 != 0; phi_v0++){ - D_8037A8C0[*phi_v0].unk4_0 = 1; + for( phi_v0 = animBinCache_persistantList; *phi_v0 != 0; phi_v0++){ + animBinCache[*phi_v0].persist = 1; } } -void animBinCache_loadAll(void){ +static void __animBinCache_loadAll(void){ s32 i; for(i = 0; i < 0x2CA; i++){ - if(D_8037A8C0[i].unk4_0){ + if(animBinCache[i].persist){ animBinCache_get(i); } } } AnimationFile *animBinCache_get(enum asset_e asset_id){ - if(!D_8037A8C0[asset_id].unk0){ - D_8037A8C0[asset_id].unk0 = (AnimationFile *) assetcache_get(asset_id); + if(animBinCache[asset_id].ptr == NULL){ + animBinCache[asset_id].ptr = (AnimationFile *) assetcache_get(asset_id); } - D_8037A8C0[asset_id].unk4_15 = 30; - return D_8037A8C0[asset_id].unk0; + animBinCache[asset_id].exp_timer = 30; + return animBinCache[asset_id].ptr; } void animBinCache_free(void){ s32 i; for(i = 0; i < 0x2CA; i++){ - if(D_8037A8C0[i].unk0){ - assetcache_release(D_8037A8C0[i].unk0); + if(animBinCache[i].ptr){ + assetcache_release(animBinCache[i].ptr); } } } @@ -51,30 +71,35 @@ void animBinCache_free(void){ void animBinCache_init(void){ s32 i = 0; for(i = 0; i < 0x2CA; i++){ - D_8037A8C0[i].unk0 = NULL; - D_8037A8C0[i].unk4_15 = 0; - D_8037A8C0[i].unk4_0 = 0; + animBinCache[i].ptr = NULL; + animBinCache[i].exp_timer = 0; + animBinCache[i].persist = 0; } - func_802884E0(); - animBinCache_loadAll(); + __animBinCache_initPersistent(); + __animBinCache_loadAll(); } -void func_8028873C(s32 arg0){ +void animBinCache_flushStale(s32 persistant){ s32 i; - if(arg0){ + if(persistant){ for(i = 0; i < 0x2CA; i++){ - if(D_8037A8C0[i].unk0 && D_8037A8C0[i].unk4_0 && (D_8037A8C0[i].unk4_15 < 30)){ - assetcache_release(D_8037A8C0[i].unk0); - D_8037A8C0[i].unk0 = NULL; - D_8037A8C0[i].unk4_0 = 0; + if( (animBinCache[i].ptr != NULL) + && (animBinCache[i].persist) + && (animBinCache[i].exp_timer < 30) + ){ + assetcache_release(animBinCache[i].ptr); + animBinCache[i].ptr = NULL; + animBinCache[i].persist = 0; } } - } - else{ + } else { for(i = 0; i < 0x2CA; i++){ - if(D_8037A8C0[i].unk0 && !D_8037A8C0[i].unk4_0 && (D_8037A8C0[i].unk4_15 < 30)){ - assetcache_release(D_8037A8C0[i].unk0); - D_8037A8C0[i].unk0 = NULL; + if( (animBinCache[i].ptr != NULL) + && !animBinCache[i].persist + && (animBinCache[i].exp_timer < 30) + ){ + assetcache_release(animBinCache[i].ptr); + animBinCache[i].ptr = NULL; if(func_80254BC4(1)) break; } @@ -82,13 +107,13 @@ void func_8028873C(s32 arg0){ } } -void func_80288834(void){ +void animBinCache_update(void){ s32 i; for(i = 0; i < 0x2CA; i++){ - if(D_8037A8C0[i].unk0 && !D_8037A8C0[i].unk4_0){ - if(--D_8037A8C0[i].unk4_15 == 0){ - assetcache_release(D_8037A8C0[i].unk0); - D_8037A8C0[i].unk0 = NULL; + if((animBinCache[i].ptr != NULL) && !animBinCache[i].persist){ + if(--animBinCache[i].exp_timer == 0){ + assetcache_release(animBinCache[i].ptr); + animBinCache[i].ptr = NULL; } } } diff --git a/src/core2/code_33C30.c b/src/core2/code_33C30.c index 5e49c797..be14e397 100644 --- a/src/core2/code_33C30.c +++ b/src/core2/code_33C30.c @@ -29,13 +29,13 @@ bool func_802BAC1C(void) { } void func_802BAC58(void) { - f32 sp34[3]; - f32 sp28[3]; + f32 vp_position[3]; + f32 vp_rotation[3]; f32 sp1C[3]; - viewport_getPosition(sp34); - viewport_getRotation(sp28); - func_802BEA4C(sp28, sp34, 150.0f, sp1C); + viewport_getPosition(vp_position); + viewport_getRotation(vp_rotation); + func_802BEA4C(vp_rotation, vp_position, 150.0f, sp1C); if (D_8037D810 == NULL) { D_8037D810 = func_8032FBE4(sp1C, func_802BABC0, 1, 0x15D); } diff --git a/src/core2/code_379B0.c b/src/core2/code_379B0.c index 3c5a1f1b..f9d6f31e 100644 --- a/src/core2/code_379B0.c +++ b/src/core2/code_379B0.c @@ -42,11 +42,11 @@ void func_802BE940(void) D_8037DA30[2] = sp24[2]; } -void func_802BEA4C(f32 arg0[3], f32 arg1[3], f32 arg2, f32 arg3[3]) { +void func_802BEA4C(f32 rotation[3], f32 position[3], f32 arg2, f32 dest[3]) { f32 sp24[3]; - func_80256E24(sp24, arg0[0], arg0[1], 0.0f, 0.0f, -arg2); - ml_vec3f_add(arg3, sp24, arg1); + func_80256E24(sp24, rotation[0], rotation[1], 0.0f, 0.0f, -arg2); + ml_vec3f_add(dest, sp24, position); } diff --git a/src/core2/code_39D0.c b/src/core2/code_39D0.c index 69c690d7..bd29d94a 100644 --- a/src/core2/code_39D0.c +++ b/src/core2/code_39D0.c @@ -4,6 +4,8 @@ #include "prop.h" #include "core2/statetimer.h" +#include "core2/ba/physics.h" + extern f32 func_8024DDD8(f32[3], f32); extern int func_80259254(f32 vec[3], f32 x, f32 z, f32 val); @@ -203,11 +205,11 @@ int player_shouldSlideTrot(void){ } bool func_8028B254(s32 arg0) { - return (func_8028B2E8() || (_get_vertVelocity() < 0.0f && (player_getYPosition() - func_80294438()) < (f32) arg0)); + return (func_8028B2E8() || (baphysics_get_vertical_velocity() < 0.0f && (player_getYPosition() - func_80294438()) < (f32) arg0)); } int func_8028B2E8(void){ - return D_8037BF60 && _get_vertVelocity() < 0.0f; + return D_8037BF60 && baphysics_get_vertical_velocity() < 0.0f; } int player_isSliding(void){ @@ -296,7 +298,7 @@ void func_8028B59C(void) { if (map_get() == MAP_6_TTC_NIPPERS_SHELL) { D_8037BF61 = FALSE; } - if (!sp24 && D_8037BF61 && (_get_vertVelocity() < -40.0)) { + if (!sp24 && D_8037BF61 && (baphysics_get_vertical_velocity() < -40.0)) { func_8029C0D0(); func_8030E58C(0xF, 0.7f); } diff --git a/src/core2/code_47BD0.c b/src/core2/code_47BD0.c index 3882e774..b5018790 100644 --- a/src/core2/code_47BD0.c +++ b/src/core2/code_47BD0.c @@ -250,7 +250,7 @@ void chBeeSwarm_802CF518(Actor *this) { && func_8028EE84() == BSWATERGROUP_0_NONE && player_getTransformation() != TRANSFORM_6_BEE ) { - func_80328A84(this, 3); + subaddie_set_state(this, 3); } } @@ -259,7 +259,7 @@ void chBeeSwarm_802CF57C(Actor *this) { local = (ActorLocal_core2_47BD0 *) &this->local; if (!func_803292E0(this) || !func_80329530(this, 900) || func_8028EE84() != BSWATERGROUP_0_NONE) { - func_80328A84(this, 5); + subaddie_set_state(this, 5); func_802CEF54(this, local->unkC, 100.0f); } } @@ -375,7 +375,7 @@ void chBeeSwarm_update(Actor *this) { if (this->unk100 != NULL) { fileProgressFlag_set(FILEPROG_D_BEEHIVE_TEXT, TRUE); } - func_80328A84(this, (this->unk100 != NULL) ? 1 : 2); + subaddie_set_state(this, (this->unk100 != NULL) ? 1 : 2); this->unk60 = 0.0f; chBeeSwarm_802CF040(this); this->unk38_0 = func_803203FC(1) | func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE); @@ -415,7 +415,7 @@ void chBeeSwarm_update(Actor *this) { this->unk1C[2] = this->position[2] + sp7C[2] * 37.5; if (this->state != 6) { local->unk6 = this->state; - func_80328A84(this, 6); + subaddie_set_state(this, 6); } } chBeeSwarm_802CF1C8(this->unk1C, this->position, this->velocity, this->unk28, 100.0f, 0, &spA0); @@ -437,7 +437,7 @@ void chBeeSwarm_update(Actor *this) { if (this->state != 7) { local->unk7 = this->state; local->unk4 = local->unk0; - func_80328A84(this, 7); + subaddie_set_state(this, 7); } } } @@ -453,7 +453,7 @@ void chBeeSwarm_update(Actor *this) { fileProgressFlag_set(FILEPROG_8F_MET_BEE_INFESTED_BEEHIVE, TRUE); } if (chBeeSwarm_802CF5E4(this)) { - func_80328A84(this, 2U); + subaddie_set_state(this, 2U); } if (ml_distance_vec3f(this->position, this->unk1C) < 50.0f) { func_802CEF54(this, local->unkC, 100.0f); @@ -473,7 +473,7 @@ void chBeeSwarm_update(Actor *this) { this->unk28 = 400.0f; if (ml_distance_vec3f(this->position, this->unk1C) < 100.0f) { func_802CEF54(this, spB4, 50.0f); - func_80328A84(this, 4); + subaddie_set_state(this, 4); } chBeeSwarm_802CF57C(this); break; @@ -500,19 +500,19 @@ void chBeeSwarm_update(Actor *this) { func_802CEF54(this, (s32 *) spB4, 50.0f); } if (ml_distance_vec3f(this->position, spB4) > 100.0f) { - func_80328A84(this, 3); + subaddie_set_state(this, 3); } chBeeSwarm_802CF57C(this); break; case 5: if (ml_distance_vec3f(this->position, this->unk1C) < 50.0f) { - func_80328A84(this, 2); + subaddie_set_state(this, 2); } chBeeSwarm_802CF518(this); break; case 6: if (ml_distance_vec3f(this->position, this->unk1C) < 50.0f) { - func_80328A84(this, local->unk6); + subaddie_set_state(this, local->unk6); } break; case 7: @@ -525,7 +525,7 @@ void chBeeSwarm_update(Actor *this) { if (local->unk0 < local->unk4) { local->unk0++; } else { - func_80328A84(this, local->unk7); + subaddie_set_state(this, local->unk7); } } break; diff --git a/src/core2/code_4A6F0.c b/src/core2/code_4A6F0.c index d0904dc0..3d4d331e 100644 --- a/src/core2/code_4A6F0.c +++ b/src/core2/code_4A6F0.c @@ -124,7 +124,7 @@ void chMumbo_func_802D18B4(Actor *this) { player_is_within_range = chMumbo_withinHorzDistToPlayer(0, -107, 188); } if(player_is_within_range || func_803203FC(1) || func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE)){ - func_80328AC8(this, 2); + subaddie_set_state_forward(this, 2); if( !fileProgressFlag_get(FILEPROG_11_HAS_MET_MUMBO) || (!fileProgressFlag_get(FILEPROG_DC_HAS_HAD_ENOUGH_TOKENS_BEFORE) && this->unk38_0) ) { @@ -166,7 +166,7 @@ static void __chMumbo_textCallback(ActorMarker *caller, enum asset_e text_id, s3 func_803463D4(ITEM_1C_MUMBO_TOKEN, -this->unk38_31); this->unk38_31 = 0; } - func_80328B8C(this, 5, 0.0f, 1); + subaddie_set_state_with_direction(this, 5, 0.0f, 1); return; case ASSET_DB0_DIALOG_MUMBO_MISTAKE_0: //L802D1AF8 @@ -180,14 +180,14 @@ static void __chMumbo_textCallback(ActorMarker *caller, enum asset_e text_id, s3 } case ASSET_DAE_DIALOG_MUMBO_TREX_START: //L802D1B48 - func_80328B8C(this, 5, 0.0f, 1); + subaddie_set_state_with_direction(this, 5, 0.0f, 1); return; default: //L802D1B64 gcpausemenu_80314AC8(1); break; } - func_80328A84(this, 4); + subaddie_set_state(this, 4); } void chMumbo_func_802D1B8C(Actor *this, enum transformation_e transform_id) { @@ -206,7 +206,7 @@ void chMumbo_func_802D1B8C(Actor *this, enum transformation_e transform_id) { return; } gcpausemenu_80314AC8(1); - func_80328A84(this, 4U); + subaddie_set_state(this, 4U); return; } func_80311480(ASSET_D90_DIALOG_MUMBO_MAGIC_PAID_FOR, 0xE, this->position, this->marker, __chMumbo_textCallback, NULL); @@ -232,10 +232,10 @@ void chMumbo_update(Actor *this) { this->unk60 = 0.0f; if (chMumbo_func_802D181C(0x201)) { this->unk60 = 1.0f; - func_80328A84(this, 7U); + subaddie_set_state(this, 7U); } else if (chMumbo_func_802D181C(0x202)) { this->unk60 = 2.0f; - func_80328A84(this, 8U); + subaddie_set_state(this, 8U); } } @@ -281,7 +281,7 @@ void chMumbo_update(Actor *this) { && !func_803203FC(1) && !func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE) ) { - func_80328A84(this, 3); + subaddie_set_state(this, 3); func_80311480(ASSET_D8F_DIALOG_MUMBO_MEET, 0xE, this->position, this->marker, __chMumbo_textCallback, NULL); fileProgressFlag_set(FILEPROG_11_HAS_MET_MUMBO, TRUE); break; @@ -292,13 +292,13 @@ void chMumbo_update(Actor *this) { && !func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE) && this->unk38_0 ){ - func_80328A84(this, 3); + subaddie_set_state(this, 3); func_80311480(ASSET_DAA_DIALOG_MUMBO_HAS_ENOUGH_TOKENS, 0xE, this->position, this->marker, __chMumbo_textCallback, NULL); fileProgressFlag_set(FILEPROG_DC_HAS_HAD_ENOUGH_TOKENS_BEFORE, TRUE); break; } - func_80328A84(this, 4); + subaddie_set_state(this, 4); } break; @@ -334,7 +334,7 @@ void chMumbo_update(Actor *this) { func_80311480(ASSET_DAE_DIALOG_MUMBO_TREX_START, 6, NULL, this->marker, __chMumbo_textCallback, NULL); fileProgressFlag_set(FILEPROG_BA_HAS_SEEN_TREX_TEXT, 1); this->unk138_24 = TRUE; - func_80328A84(this, 3); + subaddie_set_state(this, 3); } else if ( sp44 && map_get() != MAP_7A_GL_CRYPT @@ -347,13 +347,13 @@ void chMumbo_update(Actor *this) { this->unk10_12 = D_8037DDF0; D_8037DDF0 = 7; fileProgressFlag_setN(FILEPROG_BB_MUMBO_MISTAKE_INDEX, ++sp40, 2); - func_80328A84(this, 5); + subaddie_set_state(this, 5); } else { if (this->unk38_31) { func_8025A6EC(SFX_2B_BULL_MOO_1, 28000); func_803463D4(ITEM_1C_MUMBO_TOKEN, -this->unk38_31); } - func_80328A84(this, 5); + subaddie_set_state(this, 5); } gcpausemenu_80314AC8(0); @@ -412,17 +412,17 @@ void chMumbo_update(Actor *this) { } func_8025A7DC(COMUSIC_1D_MUMBO_TRANSFORMATION); if (player_getTransformation() != TRANSFORM_1_BANJO) { - func_80328A84(this, 3); + subaddie_set_state(this, 3); chMumbo_func_802D1B8C(this, D_8037DDF0); break; } if (this->unk138_24) { - func_80328A84(this, 3); + subaddie_set_state(this, 3); func_80311480(ASSET_DAF_DIALOG_MUMBO_TREX_MISTAKE, 6, NULL, this->marker, __chMumbo_textCallback, NULL); break; } gcpausemenu_80314AC8(1); - func_80328A84(this, 4); + subaddie_set_state(this, 4); } break; @@ -460,7 +460,7 @@ void chMumbo_update(Actor *this) { if (randf() < 0.4) { temp_f12 = (randf() - 0.5) * 0.95300000000000007 * 2; this->unk1C[0] = temp_f12 + ((temp_f12 >= 0.0f) ? 0.476 : -0.476); - func_80328AEC(this, 9); + subaddie_set_state_looped(this, 9); break; } if (0.6 < randf()) { @@ -471,7 +471,7 @@ void chMumbo_update(Actor *this) { case 9: //L802D2920 this->yaw += this->unk1C[0]; if (actor_animationIsAt(this, 0.99f)) { - func_80328AEC(this, 8); + subaddie_set_state_looped(this, 8); } break; } diff --git a/src/core2/code_4C020.c b/src/core2/code_4C020.c index 9de5b232..84580db7 100644 --- a/src/core2/code_4C020.c +++ b/src/core2/code_4C020.c @@ -158,7 +158,7 @@ void func_802D31AC(ActorMarker *arg0, ActorMarker * arg1) { case 0xA0: case 0xFF: func_8030E540(SFX_82_METAL_BREAK); - func_80328A84(sp2C, 4); + subaddie_set_state(sp2C, 4); break; case 0x17D: @@ -172,7 +172,7 @@ void func_802D31AC(ActorMarker *arg0, ActorMarker * arg1) { case MARKER_109_BREAKABLE_BRICK_WALL: func_8030E6D4(SFX_114_BRICKWALL_BREAKING); func_8030E510(SFX_11_WOOD_BREAKING_1, 28000); - func_80328AEC(sp2C, 9); + subaddie_set_state_looped(sp2C, 9); fileProgressFlag_set((sp2C->unkF4_8 == 1) ? FILEPROG_C8_LAIR_BRICKWALL_TO_WADINGBOOTS_BROKEN : FILEPROG_C9_LAIR_BRICKWALL_TO_SHOCKJUMP_PAD_BROKEN, TRUE); break; @@ -185,7 +185,7 @@ void func_802D31AC(ActorMarker *arg0, ActorMarker * arg1) { case MARKER_224_BREAKABLE_FLOOR_COBWEB: func_8025A70C(COMUSIC_2B_DING_B); func_8030E6A4(SFX_129_SWOOSH, (sp2C->scale < 0.45) ? 1.0 : 0.8, 0x7FF8); - func_80328AEC(sp2C, 0xC); + subaddie_set_state_looped(sp2C, 0xC); func_802D2FB0(sp2C, 8, -0x3C, 0xC8, 2.0f, 0xFA, 0x3C, 0x64); fileProgressFlag_set((sp2C->unkF4_8== 1) ? FILEPROG_CB_LAIR_COBWEB_OVER_FLIGHTPAD_BROKEN : FILEPROG_CC_LAIR_COBWEB_OVER_GREEN_CAULDRON_BROKEN, 1); break; @@ -193,7 +193,7 @@ void func_802D31AC(ActorMarker *arg0, ActorMarker * arg1) { case MARKER_225_BREAKABLE_WALL_COBWEB: func_8025A70C(COMUSIC_2B_DING_B); func_8030E540(SFX_129_SWOOSH); - func_80328AEC(sp2C, 0xF); + subaddie_set_state_looped(sp2C, 0xF); func_802D2FB0(sp2C, 0xE, -0x3C, 0xC8, 2.0f, 0xFA, 0x3C, 0x64); fileProgressFlag_set(FILEPROG_CA_COBWEB_BLOCKING_PURPLE_CAULDRON_BROKEN, 1); break; @@ -508,7 +508,7 @@ void func_802D4388(Actor *this){ switch(this->state){ case 0x12: //L802D4468 if(this->unk38_0 && mapSpecificFlags_get(0x1F)){ - func_80328B8C(this, 0x13, 0.0f, 1); + subaddie_set_state_with_direction(this, 0x13, 0.0f, 1); actor_playAnimationOnce(this); func_8030E6D4(SFX_90_SWITCH_PRESS); } @@ -516,20 +516,20 @@ void func_802D4388(Actor *this){ case 0x13: //L802D44B0 if(0.66 <= animctrl_getAnimTimer(this->animctrl)){ - func_80328B8C(this, 0x14, 0.66f, 0); + subaddie_set_state_with_direction(this, 0x14, 0.66f, 0); } break; case 0x14: //L802D44F0 if(!this->unk38_0 || !mapSpecificFlags_get(0x1F)){ - func_80328B8C(this, 0x15, 0.66f, 0); + subaddie_set_state_with_direction(this, 0x15, 0.66f, 0); actor_playAnimationOnce(this); } break; case 0x15: //L802D4534 if(animctrl_getAnimTimer(this->animctrl) < 0.03){ - func_80328B8C(this, 0x12, 0.0f, 1); + subaddie_set_state_with_direction(this, 0x12, 0.0f, 1); } break; }//L802D456C @@ -564,7 +564,7 @@ void func_802D4680(Actor *this){ switch(this->state){ case 0: if(150.0f < func_80258640(this->position, sp1C)){ - func_80328A84(this, 1); + subaddie_set_state(this, 1); D_803676AC = 0; } break; @@ -628,7 +628,7 @@ void func_802D4928(Actor *this, s32 arg1, s32 arg2, s32 arg3) { ) && (arg2 != this->state) ) { - func_80328B8C(this, arg2, 0.0f, 1); + subaddie_set_state_with_direction(this, arg2, 0.0f, 1); actor_playAnimationOnce(this); } if( ( (((arg1 & 0xC00000) == 0) && !mapSpecificFlags_get(arg1 - 0)) @@ -637,7 +637,7 @@ void func_802D4928(Actor *this, s32 arg1, s32 arg2, s32 arg3) { ) && (arg2 == this->state) ) { - func_80328B8C(this, arg3, 0.0f, 1); + subaddie_set_state_with_direction(this, arg3, 0.0f, 1); actor_playAnimationOnce(this); } } @@ -658,7 +658,7 @@ void func_802D4AC0(Actor *this, s32 arg1, s32 arg2) { if( (((arg1 & 0x800000) && (fileProgressFlag_get(arg1 + 0xFF800000))) || ((arg1 & 0x400000) && (func_803203FC(arg1 + 0xFFC00000)))) && (fileProgressFlag_get(arg2)) && (this->animctrl == NULL) ) { - func_80328B8C(this, 8, 0.0f, 1); + subaddie_set_state_with_direction(this, 8, 0.0f, 1); } func_802D4A9C(this, arg1); } diff --git a/src/core2/code_509D0.c b/src/core2/code_509D0.c index fa476cba..d4772c70 100644 --- a/src/core2/code_509D0.c +++ b/src/core2/code_509D0.c @@ -171,7 +171,7 @@ void func_802D7DE8(ActorMarker *marker, f32 arg1[3]) { } } func_8028F010(this->modelCacheIndex); - func_80328A84(this, 4); + subaddie_set_state(this, 4); var_f12 = this->position[1]; var_f14 = 28.0f; var_f18 = 0.0f; @@ -196,7 +196,7 @@ void func_802D8030(Actor *this){ local = (s32*)&this->local; *local = 1; this->marker->unkC = __chLevelCollectible_collide; - func_80328A84(this, 2); + subaddie_set_state(this, 2); } void __chLevelCollectible_returnObj(Actor *this) { @@ -252,7 +252,7 @@ void __chLevelCollectible_returnObj(Actor *this) { } } this->unk138_22 = this->unk138_21 = 0; - func_80328A84(this, 2); + subaddie_set_state(this, 2); } switch (this->marker->unk14_20) { case MARKER_1FD_BLUE_PRESENT_COLLECTIBLE: @@ -327,7 +327,7 @@ void chLevelCollectible_update(Actor *this){ } if(this->unk138_22){ func_8028F7D4(0.0f, 0.0f); - func_80328A84(this, 3); + subaddie_set_state(this, 3); } }//L802D85DC diff --git a/src/core2/code_53C10.c b/src/core2/code_53C10.c index 41386223..78c3aeef 100644 --- a/src/core2/code_53C10.c +++ b/src/core2/code_53C10.c @@ -89,7 +89,7 @@ void func_802DAE10(Actor *this){ void func_802DAE40(Actor *this) { - func_80328A84(this, 2); + subaddie_set_state(this, 2); func_802DAE10(this); func_80328CEC(this, (s32) this->yaw_ideal, (s32) (this->yaw + 160.0f) % 360, (s32) (this->yaw + 200.0f) % 360); this->unk38_31 = 0x5A; @@ -142,13 +142,13 @@ bool func_802DAFBC(Actor *this) { } else if (temp_v0 & 8) { func_802DAE10(this); this->unk38_31 = 0x5A; - func_80328B8C(this, 2, sp44, 1); + subaddie_set_state_with_direction(this, 2, sp44, 1); func_80328CEC(this, (s32) this->yaw_ideal, 0xB3, 0xB4); this->unk38_0 = TRUE; } else { func_802DAE10(this); this->unk38_31 = 0x5A; - func_80328B8C(this, 8, sp44, 1); + subaddie_set_state_with_direction(this, 8, sp44, 1); func_80328CEC(this, (s32) this->yaw_ideal, 120, 180); } return TRUE; @@ -156,13 +156,13 @@ bool func_802DAFBC(Actor *this) { void func_802DB220(Actor *this) { if (func_80329530(this, 900) && func_803292E0(this)) { - func_80328A84(this, 6); + subaddie_set_state(this, 6); } } void func_802DB264(Actor *this) { if (!func_80329530(this, 900) || !func_803292E0(this)) { - func_80328A84(this, 1); + subaddie_set_state(this, 1); } } @@ -219,7 +219,7 @@ void func_802DB440(ActorMarker *marker, ActorMarker *other_marker) { void func_802DB4E0(ActorMarker *marker, s32 arg1){ Actor * actor = marker_getActor(marker); - func_80328B8C(actor, 9, 0.0f, 1); + subaddie_set_state_with_direction(actor, 9, 0.0f, 1); actor_playAnimationOnce(actor); actor_collisionOff(actor); actor->unk60 = randf2(3.0f, 6.0f); @@ -248,7 +248,7 @@ void func_802DB5A0(Actor *this) { local->unk38 = 0; this->unk16C_4 = TRUE; if (func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE)) { - func_80328A84(this, 2U); + subaddie_set_state(this, 2U); return; } } @@ -261,7 +261,7 @@ void func_802DB5A0(Actor *this) { switch(this->state){ case 1://L802DB6B8 - if (func_80328B38(this, 2, 0.58f)) { + if (subaddie_maybe_set_state(this, 2, 0.58f)) { func_80328CEC(this, (s32) this->yaw, 0xA, 0x2D); func_802DAE10(this); } @@ -274,7 +274,7 @@ void func_802DB5A0(Actor *this) { if (phi_f14 >= 1.0) { phi_f14 -= 1.0; } - func_80328B8C(this, 2, phi_f14, 1); + subaddie_set_state_with_direction(this, 2, phi_f14, 1); this->yaw_ideal = this->yaw; func_802DAE10(this); } @@ -288,12 +288,12 @@ void func_802DB5A0(Actor *this) { func_80328CEC(this, this->yaw_ideal, 0xA, 0x14); } if (!(func_8023DB5C() & 7)) { - func_80328B38(this, 1, 0.02f); + subaddie_maybe_set_state(this, 1, 0.02f); } if( !(func_8023DB5C() & 0xF) && func_80329078(this, (s32) this->yaw_ideal, 0x96) ) { - if (func_80328B38(this, 3, 0.13f) != 0) { + if (subaddie_maybe_set_state(this, 3, 0.13f) != 0) { this->unk28 = randf2((f32)local->unk8, (f32)local->unk9); } } @@ -308,7 +308,7 @@ void func_802DB5A0(Actor *this) { func_80328FB0(this, 4.0f); if (func_80329480(this)) { this->unk10_12 = local->unkC_31; - func_80328A84(this, 4); + subaddie_set_state(this, 4); func_802DB2AC(this); } break; @@ -316,7 +316,7 @@ void func_802DB5A0(Actor *this) { case 3://L802DB930 func_80328FB0(this, 3.0f); func_802DB3B0(this); - if (!(func_8023DB5C() & 0xF) && (func_80328B38(this, 2, 0.08f))) { + if (!(func_8023DB5C() & 0xF) && (subaddie_maybe_set_state(this, 2, 0.08f))) { func_802DAE10(this); } func_802DB220(this); @@ -329,7 +329,7 @@ void func_802DB5A0(Actor *this) { } this->yaw_ideal = (f32) func_80329784(this); if (!func_803294B4(this, 0x21)) { - func_80328A84(this, 6); + subaddie_set_state(this, 6); } func_802DB264(this); if (actor_animationIsAt(this, 0.5f) != 0) { @@ -340,7 +340,7 @@ void func_802DB5A0(Actor *this) { if( (this->unk10_12 == 0) || (this->unk10_12 < local->unkC_31 && func_80329530(this, 0xFA)) ) { - func_80328A84(this, 7); + subaddie_set_state(this, 7); this->unk28 = (f32)local->unkA; this->unk38_31 = 0; } @@ -374,7 +374,7 @@ void func_802DB5A0(Actor *this) { this->unk60 -= time_getDelta(); break; } - func_80328B8C(this, 0xA, 0.0f, 1); + subaddie_set_state_with_direction(this, 0xA, 0.0f, 1); actor_playAnimationOnce(this); break; @@ -383,7 +383,7 @@ void func_802DB5A0(Actor *this) { func_802DB354(this); } if (animctrl_isStopped(this->animctrl)) { - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_loopAnimation(this); actor_collisionOn(this); } diff --git a/src/core2/code_57C70.c b/src/core2/code_57C70.c index de3b0dc1..65ecac43 100644 --- a/src/core2/code_57C70.c +++ b/src/core2/code_57C70.c @@ -100,7 +100,7 @@ void func_802DEE1C(Actor *this) { sp4C = map_getLevel(map_get()); sp44 = sp4C == D_8037DFE4; if (sp44) { - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_loopAnimation(this); } switch(sp4C){ @@ -126,7 +126,7 @@ void func_802DEE1C(Actor *this) { switch(this->state){ case 1: if (animctrl_isStopped(this->animctrl)) { - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_loopAnimation(this); } break; @@ -140,7 +140,7 @@ void func_802DEE1C(Actor *this) { case 2: if(gctransition_8030BDC0()) { - func_80328B8C(this, 5, 0.0f, 1); + subaddie_set_state_with_direction(this, 5, 0.0f, 1); } break; @@ -172,7 +172,7 @@ void func_802DF0C8(void) { sp1C = marker_getActor(D_8037DFE0); if (sp1C->state != 3) { - func_80328B8C(sp1C, 3, 0.0f, 1); + subaddie_set_state_with_direction(sp1C, 3, 0.0f, 1); actor_playAnimationOnce(sp1C); } } diff --git a/src/core2/code_59D40.c b/src/core2/code_59D40.c index 304c9856..0d0472ae 100644 --- a/src/core2/code_59D40.c +++ b/src/core2/code_59D40.c @@ -69,7 +69,7 @@ void func_802E0CE0(Actor *this) { } } } - func_80328B8C(this, 3, 0.0f, -1); + subaddie_set_state_with_direction(this, 3, 0.0f, -1); } } @@ -84,7 +84,7 @@ bool func_802E0DC0(f32 arg0[3]){ void func_802E0E88(Actor *this){ this->unk28 = 2.0f; - func_80328B8C(this, 5, 0.0f, -1); + subaddie_set_state_with_direction(this, 5, 0.0f, -1); actor_playAnimationOnce(this); } @@ -111,7 +111,7 @@ void func_802E0F60(ActorMarker *marker, ActorMarker *other){ this = marker_getActor(marker); actor_collisionOff(this); FUNC_8030E8B4(SFX_179_GRUNTY_DAMAGE, 0.6f, 32750, this->position, 300, 3000); - func_80328B8C(this, 9, 0.0f, 1); + subaddie_set_state_with_direction(this, 9, 0.0f, 1); actor_playAnimationOnce(this); } @@ -128,7 +128,7 @@ void func_802E1010(ActorMarker *marker, ActorMarker *other){ Actor *this; this = marker_getActor(marker); - func_80328B8C(this, 8, 0.0f, 1); + subaddie_set_state_with_direction(this, 8, 0.0f, 1); actor_playAnimationOnce(this); } @@ -190,7 +190,7 @@ void chsnacker_update(Actor *this) { switch(this->state){ case 1: //802E12C8 - if (func_80328BD4(this, 2, 0.0f, 1, 0.03f) != 0) { + if (subaddie_maybe_set_state_position_direction(this, 2, 0.0f, 1, 0.03f) != 0) { func_802E0CD0(this); } func_802E0CE0(this); @@ -203,7 +203,7 @@ void chsnacker_update(Actor *this) { if (func_80329480(this) != 0) { func_80328CEC(this, (s32) this->yaw, 0x5A, 0x96); } - func_80328BD4(this, 1, 0.0f, 1, 0.0075f); + subaddie_maybe_set_state_position_direction(this, 1, 0.0f, 1, 0.0075f); func_802E0CE0(this); break; @@ -214,7 +214,7 @@ void chsnacker_update(Actor *this) { func_80328FB0(this, 4.0f); func_80328FF0(this, 3.0f); if (func_80329480(this)) { - func_80328B8C(this, 4, 0.0f, 1); + subaddie_set_state_with_direction(this, 4, 0.0f, 1); this->unk28 = 9.0f; } break; @@ -237,7 +237,7 @@ void chsnacker_update(Actor *this) { func_802E0CD0(this); func_80328CEC(this, (s32) this->yaw_ideal, 0x87, 0xAF); this->unk38_31 = 0x78; - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_loopAnimation(this); } func_8032CA80(this, (D_8037E62C) ? 15 : 9); @@ -246,7 +246,7 @@ void chsnacker_update(Actor *this) { case 8: //802E15BC if (animctrl_isStopped(this->animctrl)) { func_802E0CD0(this); - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_loopAnimation(this); } break; diff --git a/src/core2/code_654C0.c b/src/core2/code_654C0.c index e1fb20c7..ce0e8104 100644 --- a/src/core2/code_654C0.c +++ b/src/core2/code_654C0.c @@ -163,7 +163,7 @@ BKVertexList *vtxList_clone(BKVertexList *vtxList){ list_size = sizeof(BKVertexList) + vtxList->count*sizeof(Vtx); out_v0 = (BKVertexList *) malloc(list_size); - func_80254630(out_v0, vtxList, list_size); + wmemcpy(out_v0, vtxList, list_size); return out_v0; } diff --git a/src/core2/code_6B030.c b/src/core2/code_6B030.c index 43dfdd6c..c44c45e3 100644 --- a/src/core2/code_6B030.c +++ b/src/core2/code_6B030.c @@ -257,7 +257,7 @@ void *func_802F2AEC(void) { } temp_v0->unk0 = 0; temp_v0->unk4 = 0; - D_80380A58 = heap_get_size() - func_8025496C(); + D_80380A58 = heap_get_size() - heap_get_occupied_size(); return temp_v0; } @@ -302,7 +302,7 @@ void func_802F2D8C(Struct64s *arg0) { Struct65s *var_s0; if ((arg0 != NULL) && (arg0->unk4 != 0)) { - D_80380A58 = heap_get_size() - func_8025496C(); + D_80380A58 = heap_get_size() - heap_get_occupied_size(); for(var_s0 = arg0->unk0; var_s0 < arg0->unk0 + arg0->unk4; var_s0++){ if (var_s0->unk23 & 1) { if (var_s0->unk10(var_s0->unk0, (f32)var_s0->unk20, var_s0->unkC) == 0) { diff --git a/src/core2/code_6B30.c b/src/core2/code_6B30.c index cbdaec95..0c0d2bff 100644 --- a/src/core2/code_6B30.c +++ b/src/core2/code_6B30.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" extern Actor *func_8032813C(enum actor_e, f32[3], s32); @@ -75,10 +76,10 @@ enum hitbox_e func_8028DB14(ActorMarker *arg0){ break; case BS_5_JUMP://8028DCD8 case BS_3D_FALL_TUMBLING: - if(_get_vertVelocity() < 0.0f && !func_8028B2E8()) + if(baphysics_get_vertical_velocity() < 0.0f && !func_8028B2E8()) return HITBOX_A_FAST_FALLING; case BS_2F_FALL://8028DD10 - if(_get_vertVelocity() < -1400.0f && !func_8028B2E8()) + if(baphysics_get_vertical_velocity() < -1400.0f && !func_8028B2E8()) return HITBOX_A_FAST_FALLING; default://8028DD4C return HITBOX_0_NONE; diff --git a/src/core2/code_7060.c b/src/core2/code_7060.c index 0d217387..98a2388d 100644 --- a/src/core2/code_7060.c +++ b/src/core2/code_7060.c @@ -5,6 +5,7 @@ #include "prop.h" #include "enums.h" +#include "core2/ba/physics.h" extern bool player_isInHorizontalRadius(f32[3], f32); @@ -539,7 +540,7 @@ BKCollisionTri *func_8028EF48(void){ } void player_getVelocity(f32 dst[3]){ - _get_velocity(dst); + baphysics_get_velocity(dst); } f32 func_8028EF88(void){ @@ -683,7 +684,7 @@ void func_8028F3D8(f32 arg0[3], f32 arg1, void(*arg2)(ActorMarker *), ActorMarke } void func_8028F408(f32 arg0[3]){ - func_80297BC4(arg0); + baphysics_set_goto_position(arg0); } bool func_8028F428(s32 arg0, ActorMarker *marker) { diff --git a/src/core2/code_72060.c b/src/core2/code_72060.c index 617fd087..0ab87595 100644 --- a/src/core2/code_72060.c +++ b/src/core2/code_72060.c @@ -101,7 +101,7 @@ void func_802F9114(void){ void func_802F9134(s32 gfx){ D_80369284 = D_80369284 - 1; if(gfx < D_80369284){ - func_80254630(D_80369280->unk1C + gfx, D_80369280->unk1C + D_80369284, sizeof(struct4Ds)); + wmemcpy(D_80369280->unk1C + gfx, D_80369280->unk1C + D_80369284, sizeof(struct4Ds)); } } diff --git a/src/core2/code_7AF80.c b/src/core2/code_7AF80.c index f525e021..73b822b0 100644 --- a/src/core2/code_7AF80.c +++ b/src/core2/code_7AF80.c @@ -2197,44 +2197,43 @@ bool func_803082D8(Cube *arg0, s32 *arg1, bool arg2, bool arg3) { #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_7AF80/func_803083B0.s") #else s32 func_803083B0(s32 arg0) { - s32 temp_v0; s32 var_v0; - bool var_a2; Cube *var_s0; static s32 D_80382140; static Cube *D_80382144; if (arg0 == -1) { - D_80382144 = D_80381FA0.cube_list; + var_s0 = D_80381FA0.cube_list; + D_80382144 = var_s0; D_80382140 = 0; return 0; } + var_s0 = D_80382144; if (D_80382140 < D_80382144->prop2Cnt) { - temp_v0 = func_803082D8(var_s0, &D_80382140, (arg0 < 0) ^ 1, arg0 & 1); + if (D_80381FA0.cube_list && D_80381FA0.cube_list && D_80381FA0.cube_list ); + var_v0 = func_803082D8(var_s0, &D_80382140, arg0 >= 0, arg0 & 1); if (D_80382140 != 0) { - return temp_v0; - } - } - D_80382140 = 0; -loop_6: -loop_7: - var_s0++; - if (var_s0 >= D_80381FA0.cube_list + D_80381FA0.cubeCnt) { - D_80382144 = var_s0; - return -1; - } - if (0 < var_s0->prop2Cnt) { - var_v0 = func_803082D8(var_s0, &D_80382140, (arg0 < 0) ^ 1, arg0 & 1); - if (D_80382140 != 0) { - D_80382144 = var_s0; return var_v0; } - goto loop_6; } - goto loop_7; - return -1; + + D_80382140 = 0; + while(D_80382140 == 0) { + do{ + var_s0++; + if (var_s0 >= D_80381FA0.cube_list + D_80381FA0.cubeCnt) { + D_80382144 = var_s0; + return -1; + } + }while (0 >= var_s0->prop2Cnt); + + var_v0 = func_803082D8(var_s0, &D_80382140, arg0 >= 0, arg0 & 1); + + } + D_80382144 = var_s0; + return var_v0; } #endif diff --git a/src/core2/code_851D0.c b/src/core2/code_851D0.c index 0ffa85f3..a4fb0185 100644 --- a/src/core2/code_851D0.c +++ b/src/core2/code_851D0.c @@ -80,7 +80,7 @@ void func_8030C204(void){ void func_8030C27C(void){ switch(getGameMode()){ case GAME_MODE_8_BOTTLES_BONUS: - chBottlesBonus_Spawn(0, 0); + chBottlesBonus_spawn(0, 0); break; case GAME_MODE_A_SNS_PICTURE: func_802DF090(0, 0); diff --git a/src/core2/code_935F0.c b/src/core2/code_935F0.c index 6342de71..e8925dbe 100644 --- a/src/core2/code_935F0.c +++ b/src/core2/code_935F0.c @@ -142,7 +142,7 @@ void __chMinigame_setState(Actor *this, u32 arg1) { timedFunc_set_3(2.0f, (GenFunction_3)func_802E4078, MAP_8E_GL_FURNACE_FUN, 1, 1); break; } - func_80328A84(this, arg1); + subaddie_set_state(this, arg1); } void __chMinigame_free(Actor *this){ diff --git a/src/core2/code_9E370.c b/src/core2/code_9E370.c index e800f420..8a0d93ce 100644 --- a/src/core2/code_9E370.c +++ b/src/core2/code_9E370.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "actor.h" #include "prop.h" @@ -29,7 +30,7 @@ extern void __spawnQueue_add_5(GenFunction_5, s32, s32, s32, s32, s32); void func_8032A6A8(Actor *arg0); void func_8032ACA8(Actor *arg0); void func_8032B5C0(ActorMarker *arg0, ActorMarker *arg1, struct5Cs *arg2); -void func_80328B8C(Actor * this, s32 arg1, f32 arg2, s32 arg3); +void subaddie_set_state_with_direction(Actor * this, s32 arg1, f32 arg2, s32 arg3); void func_8032BB88(Actor *this, s32 arg1, s32 arg2); int subaddie_playerIsWithinSphere(Actor *this, s32 dist); extern void func_8033A4A0(enum asset_e mode_id, f32, f32); @@ -757,7 +758,7 @@ void func_803272D0(f32 arg0[3], f32 arg1, s32 arg2, int (*arg3)(Actor *)){ func_803270B8(arg0, arg1, arg2, arg3, NULL); } -Actor *actor_new(s32 (* position)[3], s32 yaw, ActorInfo* actorInfo, u32 flags){ +Actor *actor_new(s32 position[3], s32 yaw, ActorInfo* actorInfo, u32 flags){ ActorAnimationInfo * sp54; s32 i; f32 sp44[3]; @@ -778,9 +779,9 @@ Actor *actor_new(s32 (* position)[3], s32 yaw, ActorInfo* actorInfo, u32 flags){ D_80383390->unk10_25 = 0; D_80383390->unk10_18 = 0; D_80383390->state = actorInfo->startAnimation; - D_80383390->position_x = (f32)(*position)[0]; - D_80383390->position_y = (f32)(*position)[1]; - D_80383390->position_z = (f32)(*position)[2]; + D_80383390->position_x = (f32)position[0]; + D_80383390->position_y = (f32)position[1]; + D_80383390->position_z = (f32)position[2]; D_80383390->unkF4_8 = 0; D_80383390->yaw = (f32) yaw; D_80383390->yaw_ideal = (f32) yaw; @@ -907,112 +908,112 @@ Actor *actor_new(s32 (* position)[3], s32 yaw, ActorInfo* actorInfo, u32 flags){ for(i = 0; i < 0x0C; i++){ ((s32 *)D_80383390->unkBC)[i] = 0; } - if(flags & 1){ + if(flags & ACTOR_FLAG_UNKNOWN_0){ D_80383390->unk10_25 = func_80306DDC(position) + 1; if(D_80383390->unk10_25 == 0){ D_80383390->unk10_25 = 0; }else{ - sp44[0] = (f32)(*position)[0]; - sp44[1] = (f32)(*position)[1]; - sp44[2] = (f32)(*position)[2]; + sp44[0] = (f32)position[0]; + sp44[1] = (f32)position[1]; + sp44[2] = (f32)position[2]; D_80383390->unk10_18 = func_80307258(&sp44, D_80383390->unk10_25 - 1, 0) + 1; } }//L80327D30 - if(flags & 4){ + if(flags & ACTOR_FLAG_UNKNOWN_2){ D_80383390->unk10_1 = 0; } - if(flags & 8){ + if(flags & ACTOR_FLAG_UNKNOWN_3){ D_80383390->unkF4_30 = 1; } - if(flags & 2){ + if(flags & ACTOR_FLAG_UNKNOWN_1){ D_80383390->marker->unk44 = 1; } - else if(flags & 0x40){ + else if(flags & ACTOR_FLAG_UNKNOWN_6){ D_80383390->marker->unk44 = func_8034A2C8(); } - if(flags & 0x1000){ + if(flags & ACTOR_FLAG_UNKNOWN_12){ func_8033F738(D_80383390->marker); func_8034BFF8(D_80383390->marker); } D_80383390->unk148 = 0; - if(flags & 0x800){ + if(flags & ACTOR_FLAG_UNKNOWN_11){ D_80383390->unk148 = skeletalAnim_new(); } - if(flags & 0x4000){ + if(flags & ACTOR_FLAG_UNKNOWN_14){ D_80383390->marker->unk50 = func_803406B0(); } - if(flags & 0x10){ + if(flags & ACTOR_FLAG_UNKNOWN_4){ D_80383390->unk124_31 = -1; } - if(flags & 0x80){ + if(flags & ACTOR_FLAG_UNKNOWN_7){ D_80383390->unkF4_22 = 1; } - if(flags & 0x80000){ + if(flags & ACTOR_FLAG_UNKNOWN_19){ D_80383390->unk58_1 = 1; } - if(flags & 0x100){ + if(flags & ACTOR_FLAG_UNKNOWN_8){ D_80383390->unk130 = func_803255FC; } - if(flags & 0x200){ + if(flags & ACTOR_FLAG_UNKNOWN_9){ D_80383390->marker->unk40_21 = 1; } - if(flags & 0x8000){ + if(flags & ACTOR_FLAG_UNKNOWN_15){ D_80383390->marker->unk40_20 = 1; } - if(flags & 0x20000){ + if(flags & ACTOR_FLAG_UNKNOWN_17){ D_80383390->marker->unk40_22 = 1; } - if(flags & 0x400000){ + if(flags & ACTOR_FLAG_UNKNOWN_22){ D_80383390->marker->unk40_19 = 1; } - if(flags & 0x10000){ + if(flags & ACTOR_FLAG_UNKNOWN_16){ D_80383390->unk138_9 = 1; } - if(flags & 0x40000){ + if(flags & ACTOR_FLAG_UNKNOWN_18){ D_80383390->unk138_8 = 1; } - if(flags & 0x200000){ + if(flags & ACTOR_FLAG_UNKNOWN_21){ D_80383390->unk138_25 = 1; } - if(flags & 0x800000){ + if(flags & ACTOR_FLAG_UNKNOWN_23){ D_80383390->unk16C_3 = 1; } - if(flags & 0x1000000){ + if(flags & ACTOR_FLAG_UNKNOWN_24){ D_80383390->unk16C_2 = 1; } - if(flags & 0x2000000){ + if(flags & ACTOR_FLAG_UNKNOWN_25){ D_80383390->unk16C_1 = 1; } - if(flags & 0x4000000){ + if(flags & ACTOR_FLAG_UNKNOWN_26){ D_80383390->unk17C_31 = 1; } - if(flags & 0x2000){ + if(flags & ACTOR_FLAG_UNKNOWN_13){ D_80383390->unk138_29 = 1; } - if(flags & 0x100000){ + if(flags & ACTOR_FLAG_UNKNOWN_20){ D_80383390->unk58_2 = 0; } @@ -1151,30 +1152,30 @@ void func_80328478(f32 arg0[3], f32 arg1, f32 arg2){ arg0[2] += sp1C[2]; } -bool func_80328508(Actor *arg0, s32 arg1) +static bool __subaddie_set_state(Actor *this, s32 state) { ActorAnimationInfo *animInfo; s32 index; - arg0->state = arg1; - if (arg0->unk18 == 0) + this->state = state; + if (this->unk18 == 0) return FALSE; - animInfo = arg0->unk18 + arg1; + animInfo = this->unk18 + state; index = animInfo->index; if (1); if (index != 0){ - if (arg0->animctrl == NULL){ - arg0->animctrl = animctrl_new(0); - animctrl_reset(arg0->animctrl); + if (this->animctrl == NULL){ + this->animctrl = animctrl_new(0); + animctrl_reset(this->animctrl); } - animctrl_setIndex(arg0->animctrl, animInfo->index); - animctrl_setDuration(arg0->animctrl, animInfo->duration); - animctrl_setDirection(arg0->animctrl, mvmt_dir_forwards); + animctrl_setIndex(this->animctrl, animInfo->index); + animctrl_setDuration(this->animctrl, animInfo->duration); + animctrl_setDirection(this->animctrl, mvmt_dir_forwards); } - else if (arg0->animctrl) { - animctrl_setPlaybackType(arg0->animctrl, ANIMCTRL_STOPPED); - animctrl_setDirection(arg0->animctrl, mvmt_dir_forwards); + else if (this->animctrl) { + animctrl_setPlaybackType(this->animctrl, ANIMCTRL_STOPPED); + animctrl_setDirection(this->animctrl, mvmt_dir_forwards); } return TRUE; } @@ -1281,41 +1282,41 @@ int func_80328A2C(Actor *this, f32 arg1, s32 direction, f32 probability){ } } -void func_80328A84(Actor * arg0, u32 arg1){ - if(func_80328508(arg0, arg1) && arg0->animctrl){ - animctrl_start(arg0->animctrl, "subaddie.c", 0X6CA); +void subaddie_set_state(Actor * this, u32 arg1){ + if(__subaddie_set_state(this, arg1) && this->animctrl){ + animctrl_start(this->animctrl, "subaddie.c", 0X6CA); } } -void func_80328AC8(Actor * arg0, s32 arg1){ - func_80328B8C(arg0, arg1, 0.0f, 1); +void subaddie_set_state_forward(Actor * this, s32 arg1){ + subaddie_set_state_with_direction(this, arg1, 0.0f, 1); } -void func_80328AEC(Actor * arg0, u32 arg1){ - if(func_80328508(arg0, arg1) && arg0->animctrl){ - animctrl_setPlaybackType(arg0->animctrl, ANIMCTRL_LOOP); - func_803289EC(arg0, 0.0f, 1); +void subaddie_set_state_looped(Actor * this, u32 arg1){ + if(__subaddie_set_state(this, arg1) && this->animctrl){ + animctrl_setPlaybackType(this->animctrl, ANIMCTRL_LOOP); + func_803289EC(this, 0.0f, 1); } } /* actor - maybe plays actor's animation with set probability */ -int func_80328B38(Actor *this, s32 myAnimId, f32 chance){ +int subaddie_maybe_set_state(Actor *this, s32 myAnimId, f32 chance){ if(randf() < chance){ - func_80328A84(this, myAnimId); + subaddie_set_state(this, myAnimId); return 1; } return 0; } -void func_80328B8C(Actor * this, s32 myAnimId, f32 arg2, s32 direction){ - if(func_80328508(this, myAnimId) && this->animctrl) +void subaddie_set_state_with_direction(Actor * this, s32 myAnimId, f32 arg2, s32 direction){ + if(__subaddie_set_state(this, myAnimId) && this->animctrl) func_803289EC(this, arg2, direction); } -int func_80328BD4(Actor * this, s32 myAnimId, f32 arg2, s32 arg3, f32 arg4){ - if(randf() < arg4){ - if(func_80328508(this, myAnimId) && this->animctrl){ - func_803285E8(this, arg2, arg3); +int subaddie_maybe_set_state_position_direction(Actor * this, s32 myAnimId, f32 start_position, s32 direction, f32 probability){ + if(randf() < probability){ + if(__subaddie_set_state(this, myAnimId) && this->animctrl){ + func_803285E8(this, start_position, direction); animctrl_start(this->animctrl, "subaddie.c", 0x705); } return 1; @@ -1323,14 +1324,14 @@ int func_80328BD4(Actor * this, s32 myAnimId, f32 arg2, s32 arg3, f32 arg4){ return 0; } -void func_80328C64(Actor * this, int arg1){ +void subaddie_set_ideal_yaw(Actor * this, int arg1){ int retVal = arg1; while(retVal < 0) retVal += 0x168; while(retVal >= 0x168) retVal -= 0x168; this->yaw_ideal = retVal; } -void func_80328CA8(Actor *arg0, s32 angle) { +void func_80328CA8(Actor *this, s32 angle) { s32 fixedAngle = angle; while (fixedAngle < 0) { fixedAngle += 360; @@ -1338,7 +1339,7 @@ void func_80328CA8(Actor *arg0, s32 angle) { while (fixedAngle >= 360) { fixedAngle -= 360; } - arg0->unk6C = fixedAngle; + this->unk6C = fixedAngle; } void func_80328CEC(Actor * this, s32 arg1, s32 min, s32 max){ @@ -1346,7 +1347,7 @@ void func_80328CEC(Actor * this, s32 arg1, s32 min, s32 max){ int abs; f12 = (randf() - 0.5)*(max - min)*2; abs = (0.0f <= f12) ? min : -min; - func_80328C64(this, abs + (arg1 + f12)); + subaddie_set_ideal_yaw(this, abs + (arg1 + f12)); } f32 func_80328DAC(Actor *this){ @@ -1574,11 +1575,11 @@ s32 func_8032970C(Actor *this){ return (s32) DIST_SQ_VEC3F(this->position, sp24); } -s32 func_80329784(Actor *arg0){ +s32 func_80329784(Actor *this){ f32 sp1C[3]; func_8028E964(sp1C); - return (s32)func_80257204(arg0->position[0], arg0->position[2], sp1C[0], sp1C[2]); + return (s32)func_80257204(this->position[0], this->position[2], sp1C[0], sp1C[2]); } s32 func_803297C8(Actor *arg0, f32 arg1[3]){ @@ -2225,7 +2226,7 @@ void func_8032B5C0(ActorMarker *arg0, ActorMarker *arg1, struct5Cs *arg2) { s32 sp68; s32 sp64; s32 var_v0; - f32 sp5C; + f32 player_yaw; f32 sp50[3]; s32 sp4C; NodeProp *sp48; @@ -2282,7 +2283,7 @@ void func_8032B5C0(ActorMarker *arg0, ActorMarker *arg1, struct5Cs *arg2) { this->unk164[sp64] = 0x63; } if ((sp64 == 2) && (sp70 != 0)) { - sp5C = player_getYaw(); + player_yaw = player_getYaw(); sp3C[0] = (s32) this->position[0]; sp3C[1] = (s32) this->position[1]; sp3C[2] = (s32) this->position[2]; @@ -2291,15 +2292,15 @@ void func_8032B5C0(ActorMarker *arg0, ActorMarker *arg1, struct5Cs *arg2) { } func_8032EE0C(func_8032B38C, this); if (((s32)arg0->unk44 < 0) && ((sp50[0] != 0.0f) || (sp50[1] != 0.0f) || (sp50[2] != 0.0f))) { - __spawnQueue_add_5((GenFunction_5)func_802C4260, sp70 + 0x15, reinterpret_cast(s32, sp50[0]), reinterpret_cast(s32, sp50[1]), reinterpret_cast(s32, sp50[2]), reinterpret_cast(s32, sp5C)); + __spawnQueue_add_5((GenFunction_5)func_802C4260, sp70 + 0x15, reinterpret_cast(s32, sp50[0]), reinterpret_cast(s32, sp50[1]), reinterpret_cast(s32, sp50[2]), reinterpret_cast(s32, player_yaw)); } else if (this->unk16C_3 && func_803048E0(sp3C, &sp4C, &sp48, 3, (s32) (func_8033229C(arg0) * 4.0f))) { sp50[0] = (f32) sp48->x; sp50[1] = (f32) sp48->y; sp50[2] = (f32) sp48->z; - __spawnQueue_add_5((GenFunction_5)func_802C4260, sp70 + 0x15, reinterpret_cast(s32, sp50[0]), reinterpret_cast(s32, sp50[1]), reinterpret_cast(s32, sp50[2]), reinterpret_cast(s32, sp5C)); + __spawnQueue_add_5((GenFunction_5)func_802C4260, sp70 + 0x15, reinterpret_cast(s32, sp50[0]), reinterpret_cast(s32, sp50[1]), reinterpret_cast(s32, sp50[2]), reinterpret_cast(s32, player_yaw)); } else { sp38 = this->position[1] + func_8033229C(arg0); - __spawnQueue_add_5((GenFunction_5)func_802C4260, sp70 + 0x15, reinterpret_cast(s32, this->position[0]), reinterpret_cast(s32, sp38), reinterpret_cast(s32, this->position[2]), reinterpret_cast(s32, sp5C)); + __spawnQueue_add_5((GenFunction_5)func_802C4260, sp70 + 0x15, reinterpret_cast(s32, this->position[0]), reinterpret_cast(s32, sp38), reinterpret_cast(s32, this->position[2]), reinterpret_cast(s32, player_yaw)); } func_8032EE20(); } diff --git a/src/core2/code_A960.c b/src/core2/code_A960.c index 0ec1cd75..9fcc29eb 100644 --- a/src/core2/code_A960.c +++ b/src/core2/code_A960.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" void func_80291930(s32); @@ -20,7 +21,7 @@ void func_80291930(s32 arg0){ func_8029C984(); bs_setState(BS_5A_LOADZONE); baModel_setVisible(FALSE); - func_802978DC(7); + baphysics_set_type(BA_PHYSICS_FREEZE); func_8029151C(6); } } diff --git a/src/core2/code_AD0.c b/src/core2/code_AD0.c index edd90769..933b0e5b 100644 --- a/src/core2/code_AD0.c +++ b/src/core2/code_AD0.c @@ -9,7 +9,7 @@ struct54s D_80379BA0[40]; /* .code */ void func_80287A60(struct54s *arg0){ - arg0->unk4 += arg0->unk0[arg0->unkC_24].unk1*0.03333333333333333*arg0->unk8; + arg0->unk4 += arg0->unk0[arg0->unkC_24].unk1*(1.0/30.0)*arg0->unk8; } void func_80287ACC(struct54s *arg0){ diff --git a/src/core2/code_AD5B0.c b/src/core2/code_AD5B0.c index 9c4917bb..c40de0e9 100644 --- a/src/core2/code_AD5B0.c +++ b/src/core2/code_AD5B0.c @@ -328,7 +328,7 @@ s32 func_80334ECC(void) { func_8033E1E0(); func_802F11E8(); animCache_update(); - func_80288834(); + animBinCache_update(); ncCamera_update(); func_803045D8(); func_80332E08(); diff --git a/src/core2/code_B850.c b/src/core2/code_B850.c index 467316c8..5520c05e 100644 --- a/src/core2/code_B850.c +++ b/src/core2/code_B850.c @@ -1,6 +1,8 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + extern void ml_vec3f_assign(f32[3], f32, f32, f32); @@ -58,13 +60,13 @@ void func_80292974(f32 arg0, f32 arg1, f32 arg2){ void func_802929F8(void){ switch (D_80363790) { case 0: //L80292A2C - func_80292864(func_80297A7C() - 20.0f, 40.0f); + func_80292864(baphysics_get_target_yaw() - 20.0f, 40.0f); break; case 1: //L80292A2C - func_80292864(func_80297A7C() + 20.0f, 40.0f); + func_80292864(baphysics_get_target_yaw() + 20.0f, 40.0f); break; case 2: //L80292A94 - func_80292864(func_80297A7C(), 30.0f); + func_80292864(baphysics_get_target_yaw(), 30.0f); break; default: //L80292AC0 break; diff --git a/src/core2/code_BEF20.c b/src/core2/code_BEF20.c index 78180a43..ad5d71b4 100644 --- a/src/core2/code_BEF20.c +++ b/src/core2/code_BEF20.c @@ -119,8 +119,8 @@ s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){ D_80385FE4 = 1; break; case ITEM_17_AIR: - sp30 = func_80301D24(oldVal); - sp2C = func_80301D24(sp28); + sp30 = fxairscore_time_to_count(oldVal); + sp2C = fxairscore_time_to_count(sp28); if(sp3C){ bs_checkInterrupt(0x11); D_80385FE4 = 1; diff --git a/src/core2/code_C0E60.c b/src/core2/code_C0E60.c index ef413b48..66ad4e7c 100644 --- a/src/core2/code_C0E60.c +++ b/src/core2/code_C0E60.c @@ -4,7 +4,7 @@ extern void func_80355C60(f32[3], f32); -void func_80348044(Gfx **gfx, BKSprite* sprite, s32 frame, s32 tmem, s32 rtile, s32 arg5, s32 arg6, s32 cms, s32 cmt, s32 *width, s32 *height, s32 *argB, s32 *argC, s32 *argD, s32 *argE, s32 *textureCount); +void func_80348044(Gfx **gfx, BKSprite* sprite, s32 frame, s32 tmem, s32 rtile, s32 uls, s32 ult, s32 cms, s32 cmt, s32 *width, s32 *height, s32 *frame_width, s32 *frame_height, s32 *texture_x, s32 *texture_y, s32 *textureCount); #define rare_gDPLoadMultiBlock(pkt, timg, tmem, rtile, fmt, siz, width, height, \ uls, ult, \ @@ -111,19 +111,19 @@ void func_80347FA4(s32 arg0, s32 arg1, s32 arg2, s32 tmem){} void func_80347FB8(s32 arg0){} -void func_80347FC0(Gfx **gfx, BKSprite *sprite, s32 frame, s32 tmem, s32 rtile, s32 arg5, s32 arg6, s32 cms, s32 cmt, s32 *width, s32 *height){ +void func_80347FC0(Gfx **gfx, BKSprite *sprite, s32 frame, s32 tmem, s32 rtile, s32 uls, s32 ult, s32 cms, s32 cmt, s32 *width, s32 *height){ s32 sp5C; s32 sp58; s32 sp54; s32 sp50; s32 sp4C = -1; - func_80348044(gfx, sprite, frame, tmem, rtile, arg5, arg6, cms, cmt, width, height, + func_80348044(gfx, sprite, frame, tmem, rtile, uls, ult, cms, cmt, width, height, &sp5C, &sp58, &sp54, &sp50, &sp4C ); } -void func_80348044(Gfx **gfx, BKSprite* sprite, s32 frame, s32 tmem, s32 rtile, s32 arg5, s32 arg6, s32 cms, s32 cmt, s32 *width, s32 *height, s32 *argB, s32 *argC, s32 *argD, s32 *argE, s32 *textureCount) { +void func_80348044(Gfx **gfx, BKSprite* sprite, s32 frame, s32 tmem, s32 rtile, s32 uls, s32 ult, s32 cms, s32 cmt, s32 *width, s32 *height, s32 *frame_width, s32 *frame_height, s32 *texture_x, s32 *texture_y, s32 *textureCount) { BKSpriteFrame *sprite_frame; s32 palette_addr; BKSpriteTextureBlock *texture_block; @@ -136,8 +136,8 @@ void func_80348044(Gfx **gfx, BKSprite* sprite, s32 frame, s32 tmem, s32 rtile, s32 maskt; sprite_frame = spriteGetFramePtr(sprite, frame); - *argB = (s32) sprite_frame->w; - *argC = (s32) sprite_frame->h; + *frame_width = (s32) sprite_frame->w; + *frame_height = (s32) sprite_frame->h; if (*textureCount == -1) { *textureCount = (s32) sprite_frame->chunkCnt; } @@ -163,8 +163,8 @@ void func_80348044(Gfx **gfx, BKSprite* sprite, s32 frame, s32 tmem, s32 rtile, for(var_a0 = 0; var_a0 < chunk_count; var_a0++) { texture_block = (s32)texture_block + (texture_block->w * texture_block->h) + sizeof(BKSpriteTextureBlock); } - *argD = texture_block->x; - *argE = texture_block->y; + *texture_x = texture_block->x; + *texture_y = texture_block->y; gDPSetTextureLUT((*gfx)++, G_TT_RGBA16); gDPLoadTLUT_pal256((*gfx)++, palette_addr); } else { @@ -175,15 +175,15 @@ void func_80348044(Gfx **gfx, BKSprite* sprite, s32 frame, s32 tmem, s32 rtile, if ((D_8038607C == 0) || (tmem == D_80386078)) { D_80386078 = tmem; D_80386070 = sprite_frame; - D_80386080 = arg5; - D_80386084 = arg6; + D_80386080 = uls; + D_80386084 = ult; D_80386088 = rtile; sp144 = 0; } else { D_80386094 = tmem; D_80386074 = sprite_frame; - D_8038609C = arg5; - D_803860A0 = arg6; + D_8038609C = uls; + D_803860A0 = ult; D_803860A4 = rtile; sp144 = 1; } @@ -226,52 +226,52 @@ void func_80348044(Gfx **gfx, BKSprite* sprite, s32 frame, s32 tmem, s32 rtile, } if ( sprite->type & SPRITE_TYPE_I4) { - rare_gDPLoadMultiBlock_4b((*gfx)++, timg, tmem, rtile, G_IM_FMT_I, *width, *height, arg5, arg6, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + rare_gDPLoadMultiBlock_4b((*gfx)++, timg, tmem, rtile, G_IM_FMT_I, *width, *height, uls, ult, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); if (sp144 == 0) { D_8038607C = (s32) D_8038607C >> 4; } else { D_80386098 = (s32) D_80386098 >> 4; } } else if (sprite->type & SPRITE_TYPE_IA4) { - rare_gDPLoadMultiBlock_4b((*gfx)++, timg, tmem, rtile, G_IM_FMT_IA, *width, *height, arg5, arg6, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + rare_gDPLoadMultiBlock_4b((*gfx)++, timg, tmem, rtile, G_IM_FMT_IA, *width, *height, uls, ult, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); if (sp144 == 0) { D_8038607C = (s32) D_8038607C >> 4; } else { D_80386098 = (s32) D_80386098 >> 4; } } else if (sprite->type & SPRITE_TYPE_I8) { - rare_gDPLoadMultiBlock((*gfx)++, timg, tmem, rtile, G_IM_FMT_I, G_IM_SIZ_8b, *width, *height, arg5, arg6, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + rare_gDPLoadMultiBlock((*gfx)++, timg, tmem, rtile, G_IM_FMT_I, G_IM_SIZ_8b, *width, *height, uls, ult, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); if (sp144 == 0) { D_8038607C = (s32) D_8038607C >> 3; } else { D_80386098 = (s32) D_80386098 >> 3; } } else if (sprite->type & SPRITE_TYPE_IA8) { - rare_gDPLoadMultiBlock((*gfx)++, timg, tmem, rtile, G_IM_FMT_IA, G_IM_SIZ_8b, *width, *height, arg5, arg6, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + rare_gDPLoadMultiBlock((*gfx)++, timg, tmem, rtile, G_IM_FMT_IA, G_IM_SIZ_8b, *width, *height, uls, ult, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); if (sp144 == 0) { D_8038607C = (s32) D_8038607C >> 3; } else { D_80386098 = (s32) D_80386098 >> 3; } } else if (sprite->type & SPRITE_TYPE_RGBA16) { - rare_gDPLoadMultiBlock((*gfx)++, timg, tmem, rtile, G_IM_FMT_RGBA, G_IM_SIZ_16b, *width, *height, arg5, arg6, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + rare_gDPLoadMultiBlock((*gfx)++, timg, tmem, rtile, G_IM_FMT_RGBA, G_IM_SIZ_16b, *width, *height, uls, ult, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); if (sp144 == 0) { D_8038607C = (s32) D_8038607C >> 2; } else { D_80386098 = (s32) D_80386098 >> 2; } } else if (sprite->type & SPRITE_TYPE_RGBA32) { - rare_gDPLoadMultiBlock((*gfx)++, timg, tmem, rtile, G_IM_FMT_RGBA, G_IM_SIZ_32b, *width, *height, arg5, arg6, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + rare_gDPLoadMultiBlock((*gfx)++, timg, tmem, rtile, G_IM_FMT_RGBA, G_IM_SIZ_32b, *width, *height, uls, ult, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); if (sp144 == 0) { D_8038607C = (s32) D_8038607C >> 1; } else { D_80386098 = (s32) D_80386098 >> 1; } } else if (sprite->type & SPRITE_TYPE_CI4) { - rare_gDPLoadMultiBlock_4b((*gfx)++, timg, tmem, rtile, G_IM_FMT_RGBA, *width, *height, arg5, arg6, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + rare_gDPLoadMultiBlock_4b((*gfx)++, timg, tmem, rtile, G_IM_FMT_RGBA, *width, *height, uls, ult, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); D_8038607C = D_8038607C >> 4; } else if (sprite->type & SPRITE_TYPE_CI8) { - rare_gDPLoadMultiBlock((*gfx)++, timg, tmem, rtile, G_IM_FMT_CI, G_IM_SIZ_8b, *width, *height, arg5, arg6, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + rare_gDPLoadMultiBlock((*gfx)++, timg, tmem, rtile, G_IM_FMT_CI, G_IM_SIZ_8b, *width, *height, uls, ult, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); D_8038607C = (s32) D_8038607C >> 3; } if( D_8038607C != 0 diff --git a/src/core2/code_C4320.c b/src/core2/code_C4320.c index ae851f9e..4a9f688c 100644 --- a/src/core2/code_C4320.c +++ b/src/core2/code_C4320.c @@ -63,7 +63,7 @@ Struct_core2_C4320_0 *D_80386114; //current attract demo ptr s32 D_80386118; s32 D_8038611C; bool D_80386120; -s32 D_80386124; +s32 D_80386124; //stored_gameFile_index f32 D_80386128; /* .code */ diff --git a/src/core2/code_C4B0.c b/src/core2/code_C4B0.c index 56768d07..391a2cd3 100644 --- a/src/core2/code_C4B0.c +++ b/src/core2/code_C4B0.c @@ -1,6 +1,8 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + extern int func_80258424(f32 vec[3], f32 minX, f32 minY, f32 minZ, f32 maxX, f32 maxY, f32 maxZ); extern f32 func_8031C5D4(struct0*); @@ -324,7 +326,7 @@ void func_80293F0C(void){ if ((D_8037C274 == 3) && func_8031C594(D_8037C200) && (D_8037C218[1] > (func_8031C5E4(D_8037C200) - 70.0f))) { D_8037C218[1] = func_8031C5E4(D_8037C200) - 70.0f; D_8037C27E = 1; - player_setYVelocity(1.0f); + baphysics_set_vertical_velocity(1.0f); } func_80293668(); player_setPosition(D_8037C218); @@ -352,14 +354,14 @@ void func_80293F0C(void){ if(D_8037C278 && D_8037C218[1] < (func_8031C5E4(D_8037C200) - 70.0f)){ func_80294384(3); - if(D_8037C279 && _get_vertVelocity() < 0.0f) { - player_setYVelocity(-1.0f); + if(D_8037C279 && baphysics_get_vertical_velocity() < 0.0f) { + baphysics_set_vertical_velocity(-1.0f); } } else if(D_8037C279){ func_80294390(); - if (_get_vertVelocity() < 0.0f) { - player_setYVelocity(-1.0f); + if (baphysics_get_vertical_velocity() < 0.0f) { + baphysics_set_vertical_velocity(-1.0f); } } else { func_80294384(1); diff --git a/src/core2/code_D5FD0.c b/src/core2/code_D5FD0.c index 5475ed18..780e7c87 100644 --- a/src/core2/code_D5FD0.c +++ b/src/core2/code_D5FD0.c @@ -60,7 +60,7 @@ void func_8035CF60(ActorMarker * marker, s32 arg1) { Actor *actor; actor = marker_getActor(marker); - func_80328B8C(actor, 5, 0.0f, 1); + subaddie_set_state_with_direction(actor, 5, 0.0f, 1); actor_playAnimationOnce(actor); FUNC_8030E8B4(SFX_C2_GRUBLIN_EGH, 1.0f, 32000, actor->position, 1250, 2500); actor_collisionOff(actor); diff --git a/src/core2/code_D6600.c b/src/core2/code_D6600.c index 1cf0ed81..cafb0c8f 100644 --- a/src/core2/code_D6600.c +++ b/src/core2/code_D6600.c @@ -64,22 +64,22 @@ void func_8035D65C(Actor *this) { } if (func_80329530(this, 500) && func_8028B470() && func_8035D608(this)) { this->unk28 = 2.0f; - func_80328B8C(this, 4, 0.0f, -1); + subaddie_set_state_with_direction(this, 4, 0.0f, -1); } } void func_8035D6FC(Actor *this) { - func_80328B8C(this, 3, 0.0f, -1); + subaddie_set_state_with_direction(this, 3, 0.0f, -1); this->unk28 = 2.0f; - func_80328C64(this, (s32) (randf2(-45.0f, 45.0f) + (this->yaw + 180.0f))); + subaddie_set_ideal_yaw(this, (s32) (randf2(-45.0f, 45.0f) + (this->yaw + 180.0f))); func_80328CA8(this, (s32) func_8035D590(randf2(-45.0f, 45.0f) + (360.0f - this->pitch))); this->unk38_31 = 0x78; } void func_8035D7CC(Actor *this) { - func_80328B8C(this, 3, 0.0f, -1); + subaddie_set_state_with_direction(this, 3, 0.0f, -1); this->unk28 = 2.0f; - func_80328C64(this, (s32) (randf2(-45.0f, 45.0f) + (this->yaw + 180.0f))); + subaddie_set_ideal_yaw(this, (s32) (randf2(-45.0f, 45.0f) + (this->yaw + 180.0f))); func_80328CA8(this, (s32) func_8035D590(randf2(-45.0f, 45.0f) + (360.0f - this->pitch))); } @@ -87,7 +87,7 @@ void func_8035D88C(ActorMarker *marker, ActorMarker *other_marker){ Actor *this; this = marker_getActor(marker); - func_80328B8C(this, 7, 0.0f, -1); + subaddie_set_state_with_direction(this, 7, 0.0f, -1); actor_playAnimationOnce(this); FUNC_8030E8B4(SFX_115_BUZZBOMB_DEATH, 0.8f, 30000, this->position, 1500, 3000); actor_collisionOff(this); @@ -132,7 +132,7 @@ void func_8035DA1C(Actor *this) { LOCAL_D6600(this)->unk4 =(map_get() == MAP_71_GL_STATUE_ROOM) ? 8 : 0xf; if (func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE)) { this->unk28 = 0.0f; - func_80328B8C(this, 1, 0.0f, 1); + subaddie_set_state_with_direction(this, 1, 0.0f, 1); } func_8032CA80(this, LOCAL_D6600(this)->unk4); marker_setCollisionScripts(this->marker, func_8035D8F0, NULL, func_8035D88C); @@ -151,7 +151,7 @@ void func_8035DA1C(Actor *this) { func_80328FB0(this, 0.5f); func_80328FF0(this, 0.5f); func_8032CA80(this, LOCAL_D6600(this)->unk4); - if (func_80328B38(this, 2, 0.05f) && !func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE)) { + if (subaddie_maybe_set_state(this, 2, 0.05f) && !func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE)) { this->unk28 = 4.0f; } func_8035D65C(this); @@ -161,7 +161,7 @@ void func_8035DA1C(Actor *this) { func_80328FB0(this, 0.5f); func_80328FF0(this, 0.5f); if (func_80329480(this) && randf() < 0.01) { - func_80328C64(this, (s32)(this->yaw + randf2(-45.0f, 45.0f))); + subaddie_set_ideal_yaw(this, (s32)(this->yaw + randf2(-45.0f, 45.0f))); } if (func_8032944C(this) && randf() < 0.01) { func_80328CA8(this, (s32)func_8035D590(this->pitch + randf2(-45.0f, 45.0f))); @@ -173,7 +173,7 @@ void func_8035DA1C(Actor *this) { if (sp3C & 2) { func_80328CA8(this, 0); } - if (func_80328BD4(this, 1, 0.0f, 1, 0.005f)) { + if (subaddie_maybe_set_state_position_direction(this, 1, 0.0f, 1, 0.005f)) { this->unk28 = 2.0f; } func_8035D65C(this); @@ -184,20 +184,20 @@ void func_8035DA1C(Actor *this) { func_80328FF0(this, 3.0f); func_8032CA80(this, LOCAL_D6600(this)->unk4); if (func_80329480(this) && func_8032944C(this)) { - func_80328B8C(this, 2, 0.0f, -1); + subaddie_set_state_with_direction(this, 2, 0.0f, -1); this->unk28 = 4.0f; } break; case 4://L8035DDB8 func_803297FC(this, &sp40, &sp44); - func_80328C64(this, (s32) sp44); + subaddie_set_ideal_yaw(this, (s32) sp44); func_80328CA8(this, (s32) func_8035D590(sp40)); func_80328FB0(this, 10.0f); func_80328FF0(this, 10.0f); func_8032CA80(this, LOCAL_D6600(this)->unk4); if (func_80329480(this) && func_8032944C(this)) { - func_80328B8C(this, 5, 0.0f, -1); + subaddie_set_state_with_direction(this, 5, 0.0f, -1); this->unk28 = 10.5f; } break; @@ -209,16 +209,16 @@ void func_8035DA1C(Actor *this) { case 5://L8035DE84 this->marker->unk14_20 = MARKER_173_CHUMP_FISH_2; func_803297FC(this, &sp40, &sp44); - func_80328C64(this, (s32) sp44); + subaddie_set_ideal_yaw(this, (s32) sp44); func_80328CA8(this, (s32) func_8035D590(sp40)); func_80328FB0(this, 10.0f); func_80328FF0(this, 10.0f); sp38 = func_80329530(this, 0x12C); if ((this->state == 5) && sp38) { - func_80328B8C(this, 6, 0.0f, -1); + subaddie_set_state_with_direction(this, 6, 0.0f, -1); } if ((this->state == 6) && !sp38) { - func_80328B8C(this, 5, 0.0f, -1); + subaddie_set_state_with_direction(this, 5, 0.0f, -1); } if ((func_8032CA80(this, LOCAL_D6600(this)->unk4) & ~2)) { func_8035D7CC(this); diff --git a/src/core2/code_D89E0.c b/src/core2/code_D89E0.c index f49bf696..829f4546 100644 --- a/src/core2/code_D89E0.c +++ b/src/core2/code_D89E0.c @@ -38,13 +38,13 @@ ActorInfo D_803730D8 = { /* .code */ void func_8035F970(Actor *this){ - func_80328A84(this, 1); + subaddie_set_state(this, 1); actor_loopAnimation(this); } void func_8035F99C(Actor *this){ if(!func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE)){ - func_80328B8C(this, 2, 0.01f, 1); + subaddie_set_state_with_direction(this, 2, 0.01f, 1); actor_playAnimationOnce(this); this->unk28 = 5.0f; FUNC_8030E8B4(SFX_419_UNKNOWN, 1.0f, 28000, this->position, 0x4e2, 0x9c4); @@ -52,30 +52,30 @@ void func_8035F99C(Actor *this){ } void func_8035FA0C(Actor *this){ - func_80328A84(this, 3); + subaddie_set_state(this, 3); actor_loopAnimation(this); this->unk28 = 5.0f; } void func_8035FA48(Actor *this){ - func_80328A84(this, 4); + subaddie_set_state(this, 4); actor_loopAnimation(this); } void func_8035FA74(Actor *this){ ActorLocal_Core2_D89E0 *local = (ActorLocal_Core2_D89E0 *)&this->local; this->yaw_ideal = local->unk4; - func_80328A84(this, 5); + subaddie_set_state(this, 5); actor_loopAnimation(this); } void func_8035FAA8(Actor *this){ - func_80328B8C(this, 6, 0.99f, 0); + subaddie_set_state_with_direction(this, 6, 0.99f, 0); actor_playAnimationOnce(this); } void func_8035FAE0(Actor *this){ - func_80328B8C(this, 7, 0.01f, 1); + subaddie_set_state_with_direction(this, 7, 0.01f, 1); actor_loopAnimation(this); this->yaw += 180.0f; this->unk28 = 20.0f; @@ -483,7 +483,7 @@ void func_80360828(Actor *this){ func_8032CA80(this, this->unk38_0 ? 0x13 : 0x4); if(func_8035FC98(this, this->velocity_x * sp34)){ this->position_y = func_80309724(this->position); - func_80328B8C(this, 8, 0.01f, 1); + subaddie_set_state_with_direction(this, 8, 0.01f, 1); actor_playAnimationOnce(this); func_8030E6A4(SFX_1F_HITTING_AN_ENEMY_3, 1.2f, 32200); } diff --git a/src/core2/code_D9B0.c b/src/core2/code_D9B0.c index 56592191..992fbcdc 100644 --- a/src/core2/code_D9B0.c +++ b/src/core2/code_D9B0.c @@ -9,7 +9,7 @@ extern f32 func_802944A8(void); f32 D_8037C2A0[3]; //recoil_target_position f32 D_8037C2B0[3]; //talk_target_position f32 D_8037C2C0[3]; //throw_target_position -f32 D_8037C2CC; //turbo_duration +f32 s_turbo_duration; enum transformation_e D_8037C2D0; f32 D_8037C2D8[3]; f32 D_8037C2E4; @@ -61,7 +61,7 @@ void get_throw_target_position(f32 dst[3]){ } f32 get_turbo_duration(void){ - return D_8037C2CC; + return s_turbo_duration; } enum transformation_e func_80294A4C(void){ @@ -89,7 +89,7 @@ void set_throw_target_position(f32 src[3]) } void set_turbo_duration(f32 arg0){ - D_8037C2CC = arg0; + s_turbo_duration = arg0; } void func_80294AF4(enum transformation_e xform){ diff --git a/src/core2/code_E910.c b/src/core2/code_E910.c index 854ac1c8..6ecde024 100644 --- a/src/core2/code_E910.c +++ b/src/core2/code_E910.c @@ -4,6 +4,7 @@ #include "bsint.h" #include "bs_funcs.h" #include "core2/statetimer.h" +#include "core2/ba/physics.h" u8 D_80363820 = 0; @@ -200,7 +201,7 @@ void func_80295914(void){ bs_clearState(); func_80295DD0(); func_80296C30(); - func_802976E4(); + baphysics_init(); func_80297C78(); pitch_reset(); climbClear(); @@ -286,7 +287,7 @@ void func_80295C14(void){ func_8029B174(); func_8029533C(); //dive_cooldown_update bs_updateState(); - func_80297744(); + baphysics_update(); func_8029858C(); func_802932EC(); func_80293F0C(); diff --git a/src/core2/code_EE40.c b/src/core2/code_EE40.c index 169c2c61..b9b06f9d 100644 --- a/src/core2/code_EE40.c +++ b/src/core2/code_EE40.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" /* .bss */ struct{ @@ -38,7 +39,7 @@ void func_80295E74(void){ func_8029B6F0(); } else{ - func_802978DC(7); + baphysics_set_type(BA_PHYSICS_FREEZE); } } } diff --git a/src/core2/code_EF50.c b/src/core2/code_EF50.c index 6392b6bf..e344f9bf 100644 --- a/src/core2/code_EF50.c +++ b/src/core2/code_EF50.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + extern void func_80256E24(f32[3], f32, f32, f32, f32, f32); extern f32 player_getYaw(void); extern void chJigsawDance_setState(Actor *, s32); @@ -488,8 +490,8 @@ void func_80296608(void){ } } - func_80297970(0.0f); - func_80297A0C(0); + baphysics_set_target_horizontal_velocity(0.0f); + baphysics_set_velocity(0); break; case BS_INTR_25: //L80296B54 sp2C = 2; diff --git a/src/core2/code_FD60.c b/src/core2/code_FD60.c deleted file mode 100644 index b0a3a545..00000000 --- a/src/core2/code_FD60.c +++ /dev/null @@ -1,432 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -#define _SQ3v1(v) (v[0] * v[0] + v[1] * v[1] + v[2] * v[2]) - -extern f32 ml_sin_deg(f32); -extern f32 ml_dotProduct_vec3f(f32[3], f32[3]); -extern void func_80256D0C(f32, f32, f32, f32, f32, f32 *, f32 *, f32 *); -extern void func_80256E24(f32[3], f32, f32, f32, f32, f32); -extern f32 climbGetRadius(void); -extern f32 func_8029CED0(void); - -void func_80297A0C(f32 arg0[3]); -void gravity_reset(void); -void func_80297B3C(void); -void func_80297B94(void); - - -/* .data */ -f32 D_80364440 = -2700.0f; //defaultGravity -f32 D_80364444 = -4000.0f; - -/* .bss */ -s32 D_8037C4A0; -f32 D_8037C4A8[3]; -f32 D_8037C4B8[3]; //velocity? -f32 D_8037C4C8[3]; -f32 D_8037C4D8[3]; -f32 D_8037C4E4; -f32 D_8037C4E8; //gravity -f32 D_8037C4EC; -f32 D_8037C4F0; -f32 D_8037C4F4; //angle -f32 D_8037C4F8; -f32 D_8037C4FC; -f32 D_8037C500; - -struct { - u8 unk0; - u8 pad1[0x3]; - f32 unk4[3]; - f32 unk10[3]; - f32 unk1C; - f32 unk20; -} D_8037C508; - -/* .code */ -void func_80296CF0(void){ - f32 sp84[3]; - f32 sp78[3]; - f32 sp6C[3]; - f32 sp60[3]; - f32 sp54[3]; - f32 sp48[3]; - f32 sp44; - f32 sp40; - - - func_80256D0C(0.0f, D_8037C4F4, 0.0f, 0.0f, D_8037C4F0, &D_8037C4C8[0], &D_8037C4C8[1], &D_8037C4C8[2]); - sp6C[0] = D_8037C4B8[0];\ - sp6C[1] = 0.0f;\ - sp6C[2] = D_8037C4B8[2]; - // sp6C[1] = D_8037C4B8[1]; - - ml_vec3f_copy(sp60, D_8037C4C8); - sp60[1] = 0.0f; - if(func_80294548()){ - func_80294480(sp54); - ml_vec3f_normalize_copy(sp48, sp60); - sp44 = ml_dotProduct_vec3f(sp48, sp54); - sp40 = get_slope_timer(); - if(sp44 != 0.0f){ - if(sp44 < 0){ - //sp44 = 0.0f; - if(func_8028B3B4()){ - sp40 = ml_map_f(sp40, 0.0f, 1.0f, sp44*0.5, -1.0f); - } - else{//L80296E3C - sp40 = 0.5*sp44; - }//L80296E54 - ml_vec3f_scale(sp60, 1.0 + sp40); - } - else{//L80296E84 - sp40 = sp44*0.2; - ml_vec3f_scale(sp60, sp40 + 1.0); - } - }//L80296EBC - }//L80296EBC - - ml_vec3f_scale_copy(sp84, sp60, func_8029CED0()); - ml_vec3f_scale_copy(sp78, sp6C, func_8029CED0()); - ml_vec3f_diff(sp84, sp78); - ml_vec3f_scale(sp84, time_getDelta()/0.0333333); - D_8037C4B8[0] += sp84[0];\ - D_8037C4B8[1] += sp84[1];\ - D_8037C4B8[2] += sp84[2]; - - sp6C[0] = D_8037C4B8[0]; - sp6C[2] = D_8037C4B8[2]; - ml_vec3f_scale_copy(D_8037C4D8, sp6C, 1.0f); - if(mlAbsF(D_8037C4B8[0]) < 0.0001) - D_8037C4B8[0] = 0; - - if(mlAbsF(D_8037C4B8[2]) < 0.0001) - D_8037C4B8[2] = 0; - - D_8037C4B8[1] = D_8037C4B8[1] + time_getDelta()*D_8037C4E8 ; - if(D_8037C4B8[1] < D_8037C4EC) - D_8037C4B8[1] = D_8037C4EC; - - D_8037C4D8[1] = D_8037C4D8[1] + D_8037C4B8[1]; - ml_vec3f_scale(D_8037C4D8, time_getDelta()); - D_8037C4A8[0] += D_8037C4D8[0];\ - D_8037C4A8[1] += D_8037C4D8[1];\ - D_8037C4A8[2] += D_8037C4D8[2]; -} - -void func_80297094(void){ - f32 sp24[3]; - ml_vec3f_diff_copy(sp24, D_8037C4C8, D_8037C4B8); - ml_vec3f_scale(sp24, time_getDelta()*D_8037C4F8); - if(_SQ3v1(sp24) < 0.02){ - ml_vec3f_copy(D_8037C4B8, D_8037C4C8); - } - else{ - D_8037C4B8[0] += sp24[0];\ - D_8037C4B8[1] += sp24[1];\ - D_8037C4B8[2] += sp24[2]; - } - D_8037C4D8[0] = D_8037C4B8[0];\ - D_8037C4D8[1] = D_8037C4B8[1];\ - D_8037C4D8[2] = D_8037C4B8[2]; - ml_vec3f_scale( D_8037C4D8, time_getDelta()); - - D_8037C4A8[0] += D_8037C4D8[0];\ - D_8037C4A8[1] += D_8037C4D8[1];\ - D_8037C4A8[2] += D_8037C4D8[2]; -} - -void func_802971DC(void){ - D_8037C4B8[1] = D_8037C4B8[1] + time_getDelta()*D_8037C4E8; - if(D_8037C4B8[1] < D_8037C4EC) - D_8037C4B8[1] = D_8037C4EC; - - D_8037C4D8[0] = D_8037C4B8[0];\ - D_8037C4D8[1] = D_8037C4B8[1];\ - D_8037C4D8[2] = D_8037C4B8[2]; - ml_vec3f_scale(D_8037C4D8, time_getDelta()); - - D_8037C4A8[0] += D_8037C4D8[0];\ - D_8037C4A8[1] += D_8037C4D8[1];\ - D_8037C4A8[2] += D_8037C4D8[2]; -} - -void func_802972AC(void){ - f32 sp34[3]; - f32 sp28[3]; - - climbGetBottom(sp28); - D_8037C4A8[0] = sp28[0]; - D_8037C4A8[2] = sp28[2]; - func_80256E24(sp34, 0.0f, yaw_get(), 0.0f, 0.0f, -climbGetRadius()); - - D_8037C4B8[2] = 0.0f; - D_8037C4A8[0] += sp34[0];\ - D_8037C4A8[1] += sp34[1];\ - D_8037C4A8[2] += sp34[2]; - - - D_8037C4B8[0] = D_8037C4C8[0] = D_8037C4C8[2] = D_8037C4B8[2]; - func_80297094(); -} - -void func_8029737C(void){ - D_8037C4D8[0] = D_8037C4B8[0]; - D_8037C4D8[1] = D_8037C4B8[1]; - D_8037C4D8[2] = D_8037C4B8[2]; - ml_vec3f_scale(D_8037C4D8, time_getDelta()); - D_8037C4A8[0] += D_8037C4D8[0]; - D_8037C4A8[1] += D_8037C4D8[1]; - D_8037C4A8[2] += D_8037C4D8[2]; -} - -void func_8029740C(void){ - D_8037C4D8[0] = D_8037C4B8[0]; - D_8037C4D8[1] = D_8037C4B8[1]; - D_8037C4D8[2] = D_8037C4B8[2]; - ml_vec3f_clear(D_8037C4B8); - ml_vec3f_scale(D_8037C4D8, time_getDelta()); - D_8037C4A8[0] += D_8037C4D8[0]; - D_8037C4A8[1] += D_8037C4D8[1]; - D_8037C4A8[2] += D_8037C4D8[2]; -} - -void func_802974A0(void){ - f32 sp2C; - - switch(D_8037C508.unk0){ - case 0: //L80297628 - break; - case 1: //L802974E8 - D_8037C508.unk0 = 2; - _player_getPosition(D_8037C508.unk4); - D_8037C508.unk20 = 0.0f; - func_80297A0C(0); - break; - case 2: //L80297510 - D_8037C508.unk20 += time_getDelta(); - sp2C = ml_map_f(D_8037C508.unk20, 0.0f, D_8037C508.unk1C, 0.0f, 1.0f); - ml_vec3f_copy(D_8037C4B8, D_8037C4A8); - D_8037C4A8[0] = ml_interpolate_f(sp2C, D_8037C508.unk4[0], D_8037C508.unk10[0]); - D_8037C4A8[1] = ml_interpolate_f(sp2C, D_8037C508.unk4[1], D_8037C508.unk10[1]); - D_8037C4A8[2] = ml_interpolate_f(sp2C, D_8037C508.unk4[2], D_8037C508.unk10[2]); - ml_vec3f_diff_copy(D_8037C4B8, D_8037C4A8, D_8037C4B8); - ml_vec3f_scale(D_8037C4B8, 1.0/time_getDelta()); - if(1.0 == sp2C){ - func_80297A0C(0); - D_8037C508.unk0 = 3; - } - break; - case 3: //L80297628 - break; - } -} - -void func_80297638(void){ - f32 temp_f0; - - D_8037C500 += time_getDelta(); - temp_f0 = func_80257A44(D_8037C500, 1.2f); - temp_f0 = ml_sin_deg(temp_f0*360.0f); - D_8037C4A8[1] = 5.0*temp_f0 + D_8037C4FC; -} - -void func_802976C0(f32 arg0[3]){ - ml_vec3f_copy(arg0, D_8037C4D8); -} - -void func_802976E4(void){ - D_8037C4A0 = 0; - ml_vec3f_clear(D_8037C4B8); - ml_vec3f_clear(D_8037C4C8); - ml_vec3f_clear(D_8037C4D8); - ml_vec3f_clear(D_8037C4A8); - D_8037C4E4 = 0.0f; - func_80297B3C(); -} - -void func_80297744(void){ - _player_getPosition(D_8037C4A8); - switch(D_8037C4A0){ - case 0xc: //L80297780 - func_802974A0(); - break; - case 0xb: //L80297790 - func_80297638(); - break; - case 0x8: //L802977A0 - func_8029737C(); - break; - case 0x1: //L802977B0 - func_802971DC(); - break; - case 0x9: //L802977C0 - func_80297094(); - break; - case 0x2: //L802977D0 - func_8029797C(yaw_getIdeal()); - func_80296CF0(); - break; - case 0x5: //L802977F0 - func_8029797C(mlNormalizeAngle(yaw_getIdeal() + 180.0f)); - func_80296CF0(); - break; - case 0x3: //L80297820 - func_80296CF0(); - break; - case 0x4: //L80297830 - func_8029740C(); - break; - case 0x6: //L80297840 - if(0.0f < func_8029B2E8()){ - func_8029797C(func_8029B33C()); - } - func_80296CF0(); - break; - case 0xa: //L80297880 - func_802972AC(); - break; - case 0: - default: - break; - } - player_setPosition(D_8037C4A8); -} - -void func_802978A4(void){ - func_80297970(0.0f); - D_8037C4B8[0] = D_8037C4B8[2] = 0.0f; -} - -void func_802978DC(int arg0){ - if(arg0 == 0xB && arg0 != D_8037C4A0){ - D_8037C4FC = D_8037C4A8[1]; - D_8037C500 = 0.0f; - } - if(arg0 == 0xC){ - D_8037C508.unk0 = 1; - } - D_8037C4A0 = arg0; -} - -void func_80297930(f32 arg0[3]){ - if(arg0) - ml_vec3f_copy(D_8037C4C8, arg0); - else - ml_vec3f_clear(D_8037C4C8); -} - -void func_80297970(f32 arg0){ - D_8037C4F0 = arg0; -} - -void func_8029797C(f32 arg0){ - D_8037C4F4 = mlNormalizeAngle(arg0); -} - -void player_setYVelocity(f32 arg0){ - D_8037C4B8[1] = arg0; -} - -void func_802979AC(f32 arg0, f32 arg1) -{ func_80256D0C(0.0f, arg0, 0.0f, 0.0f, arg1, &D_8037C4B8[0], &D_8037C4B8[1], &D_8037C4B8[2]); -} - -void func_80297A0C(f32 arg0[3]){ - if(arg0) - ml_vec3f_copy(D_8037C4B8, arg0); - else - ml_vec3f_clear(D_8037C4B8); -} - -f32 func_80297A4C(void){ - return D_8037C4E8; -} - -s32 func_80297A58(void){ - return D_8037C4A0; -} - -f32 func_80297A64(void){ - return D_8037C4F0; -} - -f32 func_80297A70(void){ - return D_8037C4C8[1]; -} - -f32 func_80297A7C(void){ - return D_8037C4F4; -} - -void _get_velocity(f32 dst[3]){ - ml_vec3f_copy(dst, D_8037C4B8); -} - -f32 _get_vertVelocity(void){ - return D_8037C4B8[1]; -} - -f32 _get_horzVelocity(void){ - return gu_sqrtf(D_8037C4B8[0]*D_8037C4B8[0] + D_8037C4B8[2]*D_8037C4B8[2]); -} - -f32 func_80297AF0(void){ - f32 temp_f2; - f32 temp_f0; - f32 temp_f12; - - temp_f2 = _get_horzVelocity(); - temp_f0 = func_80297A64(); - - if(temp_f2 < temp_f0){ - temp_f12 = temp_f2/temp_f0; - } - else{ - temp_f12 = 1.0f; - } - return temp_f12; -} - -void func_80297B3C(void){ - gravity_reset(); - func_80297B94(); -} - -void func_80297B64(f32 arg0){ - D_8037C4F8 = arg0; -} - -void gravity_reset(void){ - gravity_set(D_80364440); -} - -void func_80297B94(void){ - func_80297BF8(D_80364444); -} - -void func_80297BB8(f32 arg0){ - D_8037C508.unk1C = arg0; -} - -void func_80297BC4(f32 src[3]) -{ ml_vec3f_copy(D_8037C508.unk10, src); -} - -void gravity_set(f32 arg0){ - D_8037C4E8 = arg0; -} - -void func_80297BF8(f32 arg0){ - D_8037C4EC = arg0; -} - -int func_80297C04(f32 arg0){ - return D_8037C4B8[0]*D_8037C4B8[0] + D_8037C4B8[2]*D_8037C4B8[2] <= (arg0*arg0); -} - -int func_80297C48(void){ - return D_8037C508.unk0 == 3; -} diff --git a/src/core2/fx/airscore.c b/src/core2/fx/airscore.c index 16c23fc2..a36e10bf 100644 --- a/src/core2/fx/airscore.c +++ b/src/core2/fx/airscore.c @@ -2,11 +2,14 @@ #include "functions.h" #include "variables.h" +#define AIRSCORE_COUNT (6) +#define FXAIRSCORE_SCALE (0.68f) + extern f32 func_802FB0E4(struct8s *); /* .data */ -BKSprite *D_8036A960 = NULL; -Gfx D_8036A968[] ={ +static BKSprite *s_sprite = NULL; +static Gfx s_fxairscore_context[] ={ gsDPPipeSync(), gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH), gsSPSetGeometryMode(G_SHADE | G_TEXTURE_GEN_LINEAR | G_SHADING_SMOOTH), @@ -18,12 +21,12 @@ Gfx D_8036A968[] ={ }; /* .bss */ -s32 D_80381F50; +s32 s_freeze; f32 D_80381F54; f32 D_80381F58; -f32 D_80381F5C; -f32 D_80381F60; -f32 D_80381F68[6]; +static f32 s_texture_scale; +static f32 s_active_count; +f32 D_80381F68[AIRSCORE_COUNT]; struct7s D_80381F80; /* .code */ @@ -32,65 +35,67 @@ void func_803016F0(void) { D_80381F58 = -272.0f; D_80381F54 = 1.0f; - D_80381F50 = 0; - for(i = 0; i < 6; i++){ + s_freeze = 0; + for(i = 0; i < AIRSCORE_COUNT; i++){ D_80381F68[i] = -64.0f; } } -void fxairscore_free(s32 arg0, struct8s *arg1) { - if (D_8036A960 != NULL) { - func_8033BD4C(D_8036A960); - D_8036A960 = NULL; +void fxairscore_free(s32 arg0, struct7s *arg1) { + if (s_sprite != NULL) { + func_8033BD4C(s_sprite); + s_sprite = NULL; } func_803016F0(); } struct7s *fxairscore_new(s32 arg0) { func_803016F0(); - D_80381F5C = 0.68f; + s_texture_scale = FXAIRSCORE_SCALE; return &D_80381F80; } void fxairscore_draw(enum item_e item_id, struct8s *arg1, Gfx **gfx, Mtx **mtx, Vtx **vtx) { - f32 temp_f16; - f32 var_f14; - s32 spD4; - s32 spD0; - s32 var_s4; + f32 y; + f32 x; + s32 texture_width; + s32 texture_height; + s32 i_part; s32 var_s6; - s32 var_v0; - s32 var_v1; + s32 v_x; + s32 v_y; - if (D_8036A960 != 0) { - gSPDisplayList((*gfx)++, D_8036A968); - func_80347FC0(gfx, D_8036A960, 0, 0, 0, 0, 0, 2, 2, &spD4, &spD0); + if (s_sprite != 0) { + gSPDisplayList((*gfx)++, s_fxairscore_context); + func_80347FC0(gfx, s_sprite, 0, 0, 0, 0, 0, 2, 2, &texture_width, &texture_height); func_8024C7B8(gfx, mtx); - for(var_s4 = 0; var_s4 < 6; var_s4++){ - if ((var_s4 != 0) && (var_s4 != 5)) { - var_s6 = (var_s4 & 1) ? var_s4 + 1 : var_s4 - 1; + //render all 6 air pieces + for(i_part = 0; i_part < AIRSCORE_COUNT; i_part++){ + if ((i_part != 0) && (i_part != 5)) { + var_s6 = (i_part & 1) ? i_part + 1 : i_part - 1; } else { - var_s6 = var_s4; + var_s6 = i_part; } gDPPipeSync((*gfx)++); - if ((f32) (5 - var_s4) < D_80381F60) { + if ((f32) (5 - i_part) < s_active_count) { gDPSetPrimColor((*gfx)++, 0, 0, 0x00, 0x00, 0x00, 0xFF); } else { gDPSetPrimColor((*gfx)++, 0, 0, 0x00, 0x00, 0x00, 0x78); } - temp_f16 = func_802FB0E4(arg1); - temp_f16 = (-40.0f + temp_f16); - var_f14 = (temp_f16 + D_80381F68[var_s6]) - ((f32) framebuffer_width / 2); - temp_f16 = (((var_s4 * 15.5) + 78.0) - ((f32) framebuffer_height / 2)); - var_f14 = (var_s4 & 1) ? var_f14 + 5.0f : var_f14 - 5.0f; + x = func_802FB0E4(arg1); + x = ((-40 + x) + D_80381F68[var_s6]) - ((f32) framebuffer_width / 2); + y = ((78 + (i_part * 15.5)) - ((f32) framebuffer_height / 2)); + + //stagger x position + x = (i_part & 1) ? x + 5.0f : x - 5.0f; gSPVertex((*gfx)++, *vtx, 4, 0); - for(var_v1 = 0; var_v1 < 2; var_v1++){ - for(var_v0 = 0; var_v0 < 2; var_v0++){ - (*vtx)->v.ob[0] = ((((spD4 * D_80381F5C) * (f32) var_v0) - ((spD4 * D_80381F5C) / 2)) + var_f14) * 4.0f; - (*vtx)->v.ob[1] = ((((spD0 * D_80381F5C) / 2) - ((spD0 * D_80381F5C) * ((f32)var_v1))) + temp_f16) * 4.0f; + for(v_y = 0; v_y < 2; v_y++){ + for(v_x = 0; v_x < 2; v_x++){ + (*vtx)->v.ob[0] = (x + (((texture_width * s_texture_scale) * v_x) - ((texture_width * s_texture_scale) / 2))) * 4.0f; + (*vtx)->v.ob[1] = (y + (((texture_height * s_texture_scale) / 2) - (texture_height * s_texture_scale) * v_y)) * 4.0f; (*vtx)->v.ob[2] = -0x14; - (*vtx)->v.tc[0] = ((spD4 - 1) * var_v0) << 6; - (*vtx)->v.tc[1] = ((spD0 - 1) * var_v1) << 6; + (*vtx)->v.tc[0] = ((texture_width - 1) * v_x) << 6; + (*vtx)->v.tc[1] = ((texture_height - 1) * v_y) << 6; (*vtx)++; } } @@ -110,7 +115,7 @@ bool func_80301CE0(f32 arg0, s32 arg1, s32 arg2){ return arg0 < D_80381F68[arg1 + 1]; } -s32 func_80301D24(s32 time) { +s32 fxairscore_time_to_count(s32 time) { s32 minutes; s32 var_v0; @@ -119,28 +124,28 @@ s32 func_80301D24(s32 time) { return MIN(6, minutes); } -s32 func_80301DBC(s32 minutes) { - return (s32) (minutes * 60 * 60) / 6; +s32 fxairscore_count_to_time(s32 count) { + return (s32) (count * 60 * 60) / 6; } -void fxairscore_update(enum item_e arg0, struct7s *arg1) { +void fxairscore_update(enum item_e item_id, struct7s *arg1) { s32 temp_s0; s32 var_s0; temp_s0 = func_802FB0D4(arg1); - if (D_80381F50 == 0) { - D_80381F60 = (f32) func_80301D24(itemPrint_getValue(arg0)); + if (!s_freeze) { + s_active_count = (f32) fxairscore_time_to_count(itemPrint_getValue(item_id)); } switch (temp_s0) { case 2: break; - case 1: - if (D_8036A960 == NULL) { - D_8036A960 = (BKSprite *)assetcache_get(ASSET_7E5_SPRITE_WATER_HONEYCOMB); + case 1: //load sprite + if (s_sprite == NULL) { + s_sprite = (BKSprite *)assetcache_get(ASSET_7E5_SPRITE_WATER_HONEYCOMB); } break; case 0: - fxairscore_free(arg0, arg1); + fxairscore_free(item_id, arg1); break; } if (temp_s0 != 0) { diff --git a/src/core2/fx/common2score.c b/src/core2/fx/common2score.c index 575a5590..9b33d919 100644 --- a/src/core2/fx/common2score.c +++ b/src/core2/fx/common2score.c @@ -131,8 +131,8 @@ struct8s D_80369960[] = { void func_802FD360(struct8s *arg0, Gfx **gfx, Mtx **mtx, Vtx **vtx){ s32 tmp_s2 = 0; s32 tmp_s4; - s32 spAC; - s32 spA8; + s32 texture_width; + s32 texture_height; f32 tmp_f26; f32 f2; @@ -148,15 +148,15 @@ void func_802FD360(struct8s *arg0, Gfx **gfx, Mtx **mtx, Vtx **vtx){ if(arg0->unk20 == ITEM_0_HOURGLASS_TIMER){ tmp_s2 = 0xC; } - func_80347FC0(gfx, arg0->unk50, ((s32)arg0->unk60 + tmp_s2)%arg0->unk2C, 0, 0, 0, 0, 2, 2, &spAC, &spA8); - tmp_f26 = (arg0->unk20 == ITEM_0_HOURGLASS_TIMER && spAC == 0x10) ? 1.0f : 0.0f; + func_80347FC0(gfx, arg0->unk50, ((s32)arg0->unk60 + tmp_s2)%arg0->unk2C, 0, 0, 0, 0, 2, 2, &texture_width, &texture_height); + tmp_f26 = (arg0->unk20 == ITEM_0_HOURGLASS_TIMER && texture_width == 0x10) ? 1.0f : 0.0f; for(tmp_s4 = 0; tmp_s4 < 2; tmp_s4++){//L802FD528 for(tmp_s2 = 0; tmp_s2 < 2; tmp_s2++){// - (*vtx)->v.ob[0] = ((func_802FB0DC(arg0) + (((spAC*arg0->unk40*tmp_s2 - spAC*arg0->unk40/2) - (f32)framebuffer_width/2) + arg0->unk38)) + tmp_f26) * 4.0f; - (*vtx)->v.ob[1] = ((((spA8*arg0->unk40/2 - spA8*arg0->unk40*tmp_s4) + (f32)framebuffer_height/2) - arg0->unk3C) - func_802FB0E4(arg0)*arg0->unk4C)*4.0f; + (*vtx)->v.ob[0] = ((func_802FB0DC(arg0) + (((texture_width*arg0->unk40*tmp_s2 - texture_width*arg0->unk40/2) - (f32)framebuffer_width/2) + arg0->unk38)) + tmp_f26) * 4.0f; + (*vtx)->v.ob[1] = ((((texture_height*arg0->unk40/2 - texture_height*arg0->unk40*tmp_s4) + (f32)framebuffer_height/2) - arg0->unk3C) - func_802FB0E4(arg0)*arg0->unk4C)*4.0f; (*vtx)->v.ob[2] = -0x14; - (*vtx)->v.tc[0] = ((spAC -1) * tmp_s2) << 6; - (*vtx)->v.tc[1] = ((spA8 -1) * tmp_s4) << 6; + (*vtx)->v.tc[0] = ((texture_width -1) * tmp_s2) << 6; + (*vtx)->v.tc[1] = ((texture_height -1) * tmp_s4) << 6; if(arg0->unk20 == ITEM_C_NOTE){ if(tmp_s4 == 0){ (*vtx)->v.cn[0] = 0xff; diff --git a/src/core2/spawnqueue.c b/src/core2/spawnqueue.c index 501ffbbb..7ec16720 100644 --- a/src/core2/spawnqueue.c +++ b/src/core2/spawnqueue.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "actor.h" #include "prop.h" diff --git a/src/cutscenes/code_6730.c b/src/cutscenes/code_6730.c index 8ef17943..caa0b1dc 100644 --- a/src/cutscenes/code_6730.c +++ b/src/cutscenes/code_6730.c @@ -84,7 +84,7 @@ void func_8038CCA8(Actor *this){ case 1: this->unk60 = MAX(0.0, this->unk60 - sp24); if(0.0f == this->unk60){ - func_80328AC8(this, 2); + subaddie_set_state_forward(this, 2); actor_playAnimationOnce(this); } break; diff --git a/src/cutscenes/code_6C90.c b/src/cutscenes/code_6C90.c index 5933f4d7..cee45e44 100644 --- a/src/cutscenes/code_6C90.c +++ b/src/cutscenes/code_6C90.c @@ -85,7 +85,7 @@ void func_8038D218(Actor *this){ case 1: this->unk60 = MAX(0.0, this->unk60 - sp24); if(0.0f == this->unk60){ - func_80328AC8(this, 2); + subaddie_set_state_forward(this, 2); actor_playAnimationOnce(this); } break; diff --git a/src/fight/chbossjinjo.c b/src/fight/chbossjinjo.c index cbfbb936..717c9549 100644 --- a/src/fight/chbossjinjo.c +++ b/src/fight/chbossjinjo.c @@ -5,7 +5,7 @@ extern void viewport_getPosition(f32 (*)[3]); -extern void func_80328B8C(Actor *, s32, f32, s32); +extern void subaddie_set_state_with_direction(Actor *, s32, f32, s32); extern void func_80386654(f32 arg0, f32 (*arg1)[4], f32 (*arg2)[4]); extern void func_80324CFC(f32, enum comusic_e, s32); extern void func_80387470(Actor *, f32 [3], f32, f32, f32, f32, f32); @@ -208,7 +208,7 @@ void func_8038C840(Actor *this){ case 1: //8038C92C animctrl_setAnimTimer(this->animctrl, 0.0f); if(this->unk60 < 0.0) - func_80328B8C(this, 2, 0.001f, 1); + subaddie_set_state_with_direction(this, 2, 0.001f, 1); else//L8038C974 this->unk60 -= sp74; @@ -219,7 +219,7 @@ void func_8038C840(Actor *this){ func_8030E878(SFX_105_EYRIE_YAWN, randf2(0.95f, 1.05f), 32000, this->position, 1000.0f, 5000.0f); if(actor_animationIsAt(this, 0.999f)){ - func_80328B8C(this, 3, 0.001f, 1); + subaddie_set_state_with_direction(this, 3, 0.001f, 1); func_8030E878(0x3ee, randf2(0.95f, 1.05f), 32000, this->position, 5000.0f, 12000.0f); } break; @@ -289,14 +289,14 @@ void func_8038C840(Actor *this){ if(sp48){ if(actor_animationIsAt(this, 0.96f)){ - func_80328B8C(this, 4, 0.0f, -1); + subaddie_set_state_with_direction(this, 4, 0.0f, -1); actor_playAnimationOnce(this); } } else{//L8038CD68 if(actor_animationIsAt(this, 0.9f)){ animctrl_setSmoothTransition(this->animctrl, FALSE); - func_80328B8C(this, 5, 0.001f, 1); + subaddie_set_state_with_direction(this, 5, 0.001f, 1); FUNC_8030E8B4(SFX_135_CARTOONY_SPRING, 1.0f, 32000, this->position, 10000, 16000); func_80324D54(0.1f, SFX_C1_BUZZBOMB_ATTACK, 0.85f, 32000, this->position, 5000.0f, 12000.0f); func_8034A174(this->marker->unk44, 0x1f, this->position); @@ -356,7 +356,7 @@ void func_8038D014(Actor *this){ this->alpha_124_19 = 0x7d; actor_setOpacity(this, this->alpha_124_19); this->scale = (f64)this->scale + this->scale; - func_80328B8C(this, 5, 0.001f, 1); + subaddie_set_state_with_direction(this, 5, 0.001f, 1); func_80343DEC(this); }//L8038D0B8 diff --git a/src/fight/chbossjinjobase.c b/src/fight/chbossjinjobase.c index e8eab233..6f32d6ed 100644 --- a/src/fight/chbossjinjobase.c +++ b/src/fight/chbossjinjobase.c @@ -66,7 +66,7 @@ void func_8038D428(ActorMarker *arg0, ActorMarker *arg1) { func_8025A70C(COMUSIC_2B_DING_B); temp_v0->unk38_31++; if (temp_v0->unk38_31 >= 3) { - func_80328A84(temp_v0, 3); + subaddie_set_state(temp_v0, 3); chstonejinjo_breakOpen(temp_v0->unk100); func_8038D3DC(temp_v0, 0x19A, -100.0f, 0.0f, 1.2f); func_80324D54(1.2f, SFX_90_SWITCH_PRESS, 1.0f, 32000, temp_v0->position, 1000.0f, 2000.0f); @@ -158,7 +158,7 @@ void func_8038D568(Actor *this){ } else{//L8038D8E0 - func_80328A84(this, 2); + subaddie_set_state(this, 2); func_8030DA44(this->unk44_31); this->unk44_31 = 0; func_8030DA44(local->unk0); diff --git a/src/fight/chfinalboss.c b/src/fight/chfinalboss.c index 9d96c82d..1840fae5 100644 --- a/src/fight/chfinalboss.c +++ b/src/fight/chfinalboss.c @@ -691,7 +691,7 @@ void chfinalboss_setPhase(ActorMarker *this, u32 phase_id) switch(phase_id) { case 0: - func_80328B8C(actor, 1, 0.0001f, 1); + subaddie_set_state_with_direction(actor, 1, 0.0001f, 1); timed_setStaticCameraToNode(0.0f, 0); timed_exitStaticCamera(2.0f); timed_setStaticCameraToNode(2.0f, 1); @@ -699,7 +699,7 @@ void chfinalboss_setPhase(ActorMarker *this, u32 phase_id) return; case 1: - func_80328B8C(actor, 2, 0.0001f, 1); + subaddie_set_state_with_direction(actor, 2, 0.0001f, 1); func_8030E878(SFX_EA_GRUNTY_LAUGH_1, randf2(0.95f, 1.05f), 32000, actor->position, 5000.0f, 12000.0f); local->unk5 = 0x0; actor->unk1C_x = D_803927D0[(local->unk5)][0]; @@ -717,7 +717,7 @@ void chfinalboss_setPhase(ActorMarker *this, u32 phase_id) return; case 2: - func_80328B8C(actor, 0xE, 0.0001f, 1); + subaddie_set_state_with_direction(actor, 0xE, 0.0001f, 1); local->unk5 = 0x8; actor->unk1C_x = D_803927D0[(local->unk5)][0]; actor->unk1C_y = D_803927D0[(local->unk5)][1]; @@ -727,7 +727,7 @@ void chfinalboss_setPhase(ActorMarker *this, u32 phase_id) case 3: - func_80328B8C(actor, 0x15, 0.0001f, 1); + subaddie_set_state_with_direction(actor, 0x15, 0.0001f, 1); local->unk5 = 0xC; actor->unk1C_x = D_803927D0[(local->unk5)][0]; actor->unk1C_y = D_803927D0[(local->unk5)][1]; @@ -736,7 +736,7 @@ void chfinalboss_setPhase(ActorMarker *this, u32 phase_id) return; case 4: - func_80328B8C(actor, 0x1C, 0.0001f, 1); + subaddie_set_state_with_direction(actor, 0x1C, 0.0001f, 1); local->unk5 = 0x10; actor->unk1C_x = D_803927D0[(local->unk5)][0]; actor->unk1C_y = D_803927D0[(local->unk5)][1]; @@ -906,7 +906,7 @@ void chfinalboss_phase1_setState(Actor *this, s32 next_state) { sp40 = func_8023DB5C(); sp3C = animctrl_getAnimTimer(this->animctrl); local->phase = 1; - func_80328B8C(this, next_state, 0.0001f, 1); + subaddie_set_state_with_direction(this, next_state, 0.0001f, 1); actor_loopAnimation(this); func_80386600(this->marker, 0); if (next_state != 9) { @@ -1201,7 +1201,7 @@ void chfinalboss_phase2_setState(Actor *this, s32 arg1){ local = (ActorLocal_fight_180 *)&this->local; sp28 = func_8023DB5C(); local->phase = 2; - func_80328B8C(this, arg1, 0.0001f, 1); + subaddie_set_state_with_direction(this, arg1, 0.0001f, 1); actor_loopAnimation(this); switch (arg1) { case 14: @@ -1382,7 +1382,7 @@ void chfinalboss_phase3_setState(Actor *this, s32 arg1) { local = (ActorLocal_fight_180 *)&this->local; local->phase = 3; - func_80328B8C(this, arg1, 0.0001f, 1); + subaddie_set_state_with_direction(this, arg1, 0.0001f, 1); switch (arg1) { case 21: if((local->unk5 + 1) < 0x10) { @@ -1584,7 +1584,7 @@ void chfinalboss_phase4_setState(Actor *this, s32 arg1) { local = (ActorLocal_fight_180 *)&this->local; sp48 = animctrl_getAnimTimer(this->animctrl); local->phase = 4; - func_80328B8C(this, arg1, 0.0001f, 1); + subaddie_set_state_with_direction(this, arg1, 0.0001f, 1); switch (arg1) { case 28: animctrl_setAnimTimer(this->animctrl, sp48); @@ -1847,10 +1847,10 @@ void chfinalboss_phase4_update(ActorMarker *marker) { } } -void func_80328B8C(Actor *, s32, f32, s32); +void subaddie_set_state_with_direction(Actor *, s32, f32, s32); void func_8038AC50(ActorMarker *arg0) { - func_80328B8C(marker_getActor(arg0), 0x24, 0.0001f, 1); + subaddie_set_state_with_direction(marker_getActor(arg0), 0x24, 0.0001f, 1); } void chfinalboss_phase5_setState(Actor *this, s32 next_state) { @@ -1863,7 +1863,7 @@ void chfinalboss_phase5_setState(Actor *this, s32 next_state) { local = (ActorLocal_fight_180 *)&this->local; sp28 = 0x12; local->phase = 5; - func_80328B8C(this, next_state, 0.0001f, 1); + subaddie_set_state_with_direction(this, next_state, 0.0001f, 1); switch (next_state) { case 35: func_80311480(randi2(0, 5) + 0x114F, 4, NULL, NULL, NULL, NULL); diff --git a/src/fight/chjinjonator.c b/src/fight/chjinjonator.c index 2dd49514..7ec97b7b 100644 --- a/src/fight/chjinjonator.c +++ b/src/fight/chjinjonator.c @@ -3,7 +3,7 @@ #include "variables.h" extern f32 func_8038C288(void); -extern void func_80328B8C(Actor *, s32, f32, s32); +extern void subaddie_set_state_with_direction(Actor *, s32, f32, s32); extern void func_80324CFC(f32, s32, s32); extern void func_802F9E44(s32, f32, f32, f32, f32); extern void func_80387470(Actor *, f32 [3], f32, f32, f32, f32, f32); @@ -132,7 +132,7 @@ void chjinjonator_spawnAttackParticles(Actor *this, s32 arg1){ void chjinjonator_803903C4(Actor *this){ animctrl_setSmoothTransition(this->animctrl, FALSE); - func_80328B8C(this, 7, 0.001f, 1); + subaddie_set_state_with_direction(this, 7, 0.001f, 1); actor_loopAnimation(this); } @@ -183,7 +183,7 @@ void chjinjonator_update(Actor *this){ animctrl_setAnimTimer(this->animctrl, 0.0f); this->unk60 -= sp58; if(this->unk60 < 0.0){ - func_80328B8C(this, 2, 0.001f, 1); + subaddie_set_state_with_direction(this, 2, 0.001f, 1); actor_playAnimationOnce(this); } break; @@ -199,7 +199,7 @@ void chjinjonator_update(Actor *this){ } if(actor_animationIsAt(this, 0.999f)){ - func_80328B8C(this, 3, 0.001f, 1); + subaddie_set_state_with_direction(this, 3, 0.001f, 1); actor_playAnimationOnce(this); func_8030E394(this->unk44_31); func_8030DA44(this->unk44_31); @@ -216,7 +216,7 @@ void chjinjonator_update(Actor *this){ }//L803907A0 if(320.0f == this->position_y){ - func_80328B8C(this, 4, 0.001f, 1); + subaddie_set_state_with_direction(this, 4, 0.001f, 1); actor_loopAnimation(this); local->unk4 = func_8038C288(); } @@ -224,7 +224,7 @@ void chjinjonator_update(Actor *this){ case 4: //803907D4 chjinjonator_80390278(this); - func_80328B8C(this, 5, 0.001f, 1); + subaddie_set_state_with_direction(this, 5, 0.001f, 1); actor_playAnimationOnce(this); break; @@ -232,7 +232,7 @@ void chjinjonator_update(Actor *this){ chjinjonator_80390278(this); if(actor_animationIsAt(this, 0.998f)){ animctrl_setSmoothTransition(this->animctrl, FALSE); - func_80328B8C(this, 6, 0.0001f, 1); + subaddie_set_state_with_direction(this, 6, 0.0001f, 1); actor_loopAnimation(this); if(this->unk44_31 == 0){ local->unk18 = 0.1f; @@ -314,7 +314,7 @@ void chjinjonator_update(Actor *this){ } if(actor_animationIsAt(this, 0.999f)){ - func_80328B8C(this, 0xA, 0.001f, 1); + subaddie_set_state_with_direction(this, 0xA, 0.001f, 1); actor_loopAnimation(this); local->unk20 = 0xE; } @@ -332,7 +332,7 @@ void chjinjonator_update(Actor *this){ if(local->unk20 <= 0){ s32 text_id; - func_80328B8C(this, 0xB, 0.001f, 1); + subaddie_set_state_with_direction(this, 0xB, 0.001f, 1); actor_playAnimationOnce(this); func_802BB41C(0); text_id = 0x115e + randi2(0,5); @@ -345,7 +345,7 @@ void chjinjonator_update(Actor *this){ FUNC_8030E624(SFX_17B_AIRPLANE_FALLING, 1.0f, 32000); FUNC_8030E624(SFX_147_GRUNTY_SPELL_ATTACK_2, 1.0f, 32000); animctrl_setSmoothTransition(this->animctrl, 0); - func_80328B8C(this, 0xC, 0.001f, 1); + subaddie_set_state_with_direction(this, 0xC, 0.001f, 1); actor_playAnimationOnce(this); this->velocity[2] = 0.0f; this->velocity[1] = 0.0f; @@ -389,10 +389,10 @@ void chjinjonator_attack(ActorMarker *marker, s32 hit_count, bool mirrored) { animctrl_setSmoothTransition(temp_s0->animctrl, 1); actor_playAnimationOnce(temp_s0); if (&D_8039203C[hit_count] >= D_80392060) { - func_80328B8C(temp_s0, 9, 0.001f, 1); + subaddie_set_state_with_direction(temp_s0, 9, 0.001f, 1); return; } - func_80328B8C(temp_s0, 8, 0.001f, 1); + subaddie_set_state_with_direction(temp_s0, 8, 0.001f, 1); animctrl_setDuration(temp_s0->animctrl, (f32) (1.75 - 0.11 * local->unk24)); } diff --git a/src/fight/chjinjonatorbase.c b/src/fight/chjinjonatorbase.c index 6c71414e..acfe971e 100644 --- a/src/fight/chjinjonatorbase.c +++ b/src/fight/chjinjonatorbase.c @@ -86,7 +86,7 @@ void func_8038E120(ActorMarker * marker, ActorMarker *arg1){ remaining = local->unk0[0] + local->unk0[1] + local->unk0[2] + local->unk0[3]; if( remaining <= 0){ func_8038C148(); - func_80328A84(actor, 3); + subaddie_set_state(actor, 3); chstonejinjo_breakOpen(actor->unk100); } }//L8038E24C @@ -185,7 +185,7 @@ void chjinjonatorbase_update(Actor *this){ other->position_z = sp38[2] + other->position_z; } else{//L8038E6FC - func_80328A84(this, 2); + subaddie_set_state(this, 2); FUNC_8030E624(SFX_7F_HEAVYDOOR_SLAM, 0.8f, 32000); func_8030E394(this->unk44_31); func_8030DA44(this->unk44_31); diff --git a/src/fight/chspellfireball.c b/src/fight/chspellfireball.c index c633e457..232e6f9d 100644 --- a/src/fight/chspellfireball.c +++ b/src/fight/chspellfireball.c @@ -214,7 +214,7 @@ void func_8038F084(ActorMarker *marker){ chbossjinjo_spawnParticles(actor, 0x712, ASSET_6C3_SPRITE_SMOKE_GREEN, 1.6f); } local->unk0 = 0.66f; - func_80328A84(actor, 2); + subaddie_set_state(actor, 2); }//L8038F39C } diff --git a/src/fight/chstonejinjo.c b/src/fight/chstonejinjo.c index 91c0529f..31698801 100644 --- a/src/fight/chstonejinjo.c +++ b/src/fight/chstonejinjo.c @@ -4,7 +4,7 @@ #include "fight.h" extern Actor *actorArray_findActorFromActorId(); -extern void func_80328B8C(Actor*, s32, f32, s32); +extern void subaddie_set_state_with_direction(Actor*, s32, f32, s32); extern f32 chbossjinjo_8038D268(void); void chstonejinjo_update(Actor *); @@ -100,7 +100,7 @@ void chstonejinjo_update(Actor *this) { } } if (actor_animationIsAt(this, 0.999f)) { - func_80328B8C(this, 3, 0.99999f, 1); + subaddie_set_state_with_direction(this, 3, 0.99999f, 1); actor_playAnimationOnce(this); func_80326310(this); } @@ -116,7 +116,7 @@ void chstonejinjo_breakOpen(ActorMarker *marker){ f32 sp24[3]; if(actor->state != 2){ - func_80328B8C(actor, 2, 0.0f, 1); + subaddie_set_state_with_direction(actor, 2, 0.0f, 1); actor_playAnimationOnce(actor); animctrl_setDuration(actor->animctrl, actor->unk1C[0]); SPAWNQUEUE_ADD_1(chstonejinjo_spawnJinjo, actor->marker); diff --git a/src/lair/ch/brentilda.c b/src/lair/ch/brentilda.c index e9d9555e..02c34607 100644 --- a/src/lair/ch/brentilda.c +++ b/src/lair/ch/brentilda.c @@ -51,7 +51,7 @@ void func_8038BADC(ActorMarker *marker, enum asset_e text_id, s32 arg2) { func_80311480(0xD38, 0xC, this->position, this->marker, func_8038BADC, NULL); return; } - func_80328A84(this, 1); + subaddie_set_state(this, 1); } void func_8038BBC0(Actor *this) { @@ -181,14 +181,14 @@ void chBrentilda_update(Actor *this) { if (!fileProgressFlag_get(FILEPROG_96_MET_BRENTILDA)) { func_80311480(ASSET_10A1_DIALOG_BRENTILDA_MEET, 0xA, this->position, this->marker, func_8038BADC, NULL); fileProgressFlag_set(FILEPROG_96_MET_BRENTILDA, TRUE); - func_80328A84(this, 2); + subaddie_set_state(this, 2); return; } if (func_8028EFC8() && (sp78[FACE_BUTTON(BUTTON_B)] == 1)) { this->unk10_12++; this->unk10_12 %= 3; func_80311174(local->unk0 + this->unk10_12, 0xB, this->position, this->marker, func_8038BADC, NULL, func_8038BA30); - func_80328A84(this, 2); + subaddie_set_state(this, 2); return; } } else { @@ -197,13 +197,13 @@ void chBrentilda_update(Actor *this) { break; case 2: if (actor_animationIsAt(this, 0.999f)) { - func_80328A84(this, 3); + subaddie_set_state(this, 3); return; } break; case 3: if (actor_animationIsAt(this, 0.999f)) { - func_80328A84(this, 2); + subaddie_set_state(this, 2); } break; } diff --git a/src/lair/ch/cauldron.c b/src/lair/ch/cauldron.c index 6e1ca3af..14806538 100644 --- a/src/lair/ch/cauldron.c +++ b/src/lair/ch/cauldron.c @@ -80,7 +80,7 @@ enum file_progress_e chWarpCauldron_getPairedFileProgressFlagIndex(Actor *this){ } void func_8038A704(Actor *this){ - func_80328B8C(this, 3, 0.99f, 1); + subaddie_set_state_with_direction(this, 3, 0.99f, 1); } void func_8038A730(Actor *this, f32 *arg1, enum sfx_e arg2, enum sfx_e arg3, u32 arg4) { @@ -158,7 +158,7 @@ void func_8038AB90(Actor *this, s32 arg1, s32 arg2, enum sfx_e sfx_id, f32 sfx_t func_80324D2C(7.0f, COMUSIC_8C_JINJONATOR_POWERUP); } this->unk10_12 = 0; - func_80328AC8(this, arg1); + subaddie_set_state_forward(this, arg1); actor_playAnimationOnce(this); func_8028FCBC(); if (sfx_id != SFX_0_BLOOP) { @@ -235,7 +235,7 @@ void chWarpCauldron_update(Actor *this) { this->unk38_31 = randi2(0, phi_v0 - sp4C); } this->scale = 1.8f; - func_80328B8C(this, 6, 0.99f, 1); + subaddie_set_state_with_direction(this, 6, 0.99f, 1); func_802D09B8(this, 2); } if (fileProgressFlag_get(chWarpCauldron_getFileProgressFlagIndex(this))) { @@ -270,7 +270,7 @@ void chWarpCauldron_update(Actor *this) { case 1: //L8038B0F4 if (func_8038A690(this)) { func_8028F918(2); - func_80328AC8(this, 2); + subaddie_set_state_forward(this, 2); this->unk38_0 = FALSE; func_8038A96C(this, 1); func_802BAFE4(D_80393620[this->unkF4_8 - 1].unk3); diff --git a/src/lair/code_0.c b/src/lair/code_0.c index 9e852965..b24a7d0a 100644 --- a/src/lair/code_0.c +++ b/src/lair/code_0.c @@ -13,7 +13,7 @@ extern void func_802D4830(Actor *, s32, f32); extern void func_802EE6CC(f32[3], f32[3], s32[4], s32, f32, f32, s32, s32, s32); extern void func_80324CFC(f32, enum comusic_e, s32); extern int actor_animationIsAt(Actor *, f32); -extern void func_80328B8C(Actor *, s32, f32, s32); +extern void subaddie_set_state_with_direction(Actor *, s32, f32, s32); extern void func_8033A45C(s32, s32); extern void func_8034E0FC(void *, s32); extern void *func_8034C2C4(ActorMarker *, s32); @@ -231,7 +231,7 @@ void chFloorCobweb_update(Actor *this) { if (actor_animationIsAt(this, 0.95f)) { - func_80328B8C(this, 0xD, 0.98f, 1); + subaddie_set_state_with_direction(this, 0xD, 0.98f, 1); func_80326310(this); } } @@ -255,7 +255,7 @@ void chWallCobweb_update(Actor *this) { if (actor_animationIsAt(this, 0.9f)) { - func_80328B8C(this, 0x10, 0.98f, 1); + subaddie_set_state_with_direction(this, 0x10, 0.98f, 1); func_80326310(this); } } @@ -284,7 +284,7 @@ void lair_func_80386550(Actor *this) if (actor_animationIsAt(this, 0.95f)) { func_80326310(this); - func_80328B8C(this, 10, 0.98f, 1); + subaddie_set_state_with_direction(this, 10, 0.98f, 1); this->pitch = 270.0f; } @@ -1083,7 +1083,7 @@ void func_80388524(Actor *this) { switch(this->modelCacheIndex){ case ACTOR_2E5_DOOR_OF_GRUNTY: //L80388880 if (fileProgressFlag_get(FILEPROG_E2_DOOR_OF_GRUNTY_OPEN) && (this->state == 0x19)) { - func_80328B8C(this, 0x1B, 0.999f, 1); + subaddie_set_state_with_direction(this, 0x1B, 0.999f, 1); } break; @@ -1167,7 +1167,7 @@ void func_80388524(Actor *this) { case 0x2E5: switch (this->state) { case 0x19: //L80388B34 - func_80328B8C(this, 0x1A, 0.0f, 1); + subaddie_set_state_with_direction(this, 0x1A, 0.0f, 1); func_8025A6EC(JINGLE_END_OF_INTRO, -1); break; @@ -1179,7 +1179,7 @@ void func_80388524(Actor *this) { func_8030E6D4(SFX_1B_EXPLOSION_1); } if (actor_animationIsAt(this, 0.97f)) { - func_80328B8C(this, 0x1B, 0.999f, 1); + subaddie_set_state_with_direction(this, 0x1B, 0.999f, 1); fileProgressFlag_set(FILEPROG_E2_DOOR_OF_GRUNTY_OPEN, 1); func_8030E6D4(SFX_6C_LOCKUP_CLOSING); } @@ -1577,7 +1577,7 @@ void func_80389898(Actor *this) { if (this->unk10_12) { - func_80328AC8(this, 0x13); + subaddie_set_state_forward(this, 0x13); actor_playAnimationOnce(this); fileProgressFlag_set(FILEPROG_9E_CRYPT_COFFIN_LID_OPEN, TRUE); } @@ -1606,7 +1606,7 @@ void func_80389934(Actor *this) this->unk16C_4 = TRUE; if (fileProgressFlag_get(FILEPROG_A2_GV_LOBBY_COFFIN_OPEN)) - func_80328B8C(this, 0x18, 0.999f, 1); + subaddie_set_state_with_direction(this, 0x18, 0.999f, 1); } switch (this->state) @@ -1617,7 +1617,7 @@ void func_80389934(Actor *this) { this->unk1C[0] = 25; - func_80328AC8(this, 0x16); + subaddie_set_state_forward(this, 0x16); fileProgressFlag_set(FILEPROG_A2_GV_LOBBY_COFFIN_OPEN, TRUE); } @@ -1627,7 +1627,7 @@ void func_80389934(Actor *this) { if (--this->unk1C[0] == 0) { - func_80328AC8(this, 0x17); + subaddie_set_state_forward(this, 0x17); actor_playAnimationOnce(this); FUNC_8030E624(SFX_3F6_UNKNOWN, 0.6f, 32000); func_8025A6EC(COMUSIC_3D_JIGGY_SPAWN, 0x7FFF); @@ -1639,7 +1639,7 @@ void func_80389934(Actor *this) { if (actor_animationIsAt(this, 0.95f)) { - func_80328B8C(this, 0x18, 0.999f, 1); + subaddie_set_state_with_direction(this, 0x18, 0.999f, 1); FUNC_8030E624(SFX_7F_HEAVYDOOR_SLAM, 1.0f, 26000,); } @@ -1701,7 +1701,7 @@ f32 func_80389AAC(Actor *this, f32 a1) } case 3: { - func_80328A84(this, 5); + subaddie_set_state(this, 5); break; } @@ -1744,7 +1744,7 @@ void func_80389D08(Actor *this) { if (this->unk60) { - func_80328AC8(this, 4); + subaddie_set_state_forward(this, 4); this->unk38_31 = 0; this->unk60 = 0; diff --git a/src/lair/code_86F0.c b/src/lair/code_86F0.c index 5c012432..18a94488 100644 --- a/src/lair/code_86F0.c +++ b/src/lair/code_86F0.c @@ -369,7 +369,7 @@ void func_8038F350(Actor *this, s32 next_state){ this->unk60 = 3.0f; break; } - func_80328A84(this, next_state); + subaddie_set_state(this, next_state); } diff --git a/src/lair/code_A4A0.c b/src/lair/code_A4A0.c index 0ff29525..23fd075b 100644 --- a/src/lair/code_A4A0.c +++ b/src/lair/code_A4A0.c @@ -51,7 +51,7 @@ void func_80390890(ActorMarker *marker, ActorMarker *other_marker) { this = marker_getActor(marker); local = (ActorLocal_lair_A4A0 *)&this->local; - func_80328B8C(this, 5, 0.0f, 1); + subaddie_set_state_with_direction(this, 5, 0.0f, 1); actor_playAnimationOnce(this); func_8030E878(SFX_C2_GRUBLIN_EGH, local->unkC_27*0.1 + 0.8, 32000, this->position, 1250.0f, 2500.0f); __spawnQueue_add_4((GenFunction_4)func_802C4140, ACTOR_4C_STEAM, reinterpret_cast(s32, this->position[0]), reinterpret_cast(s32, this->position[1]), reinterpret_cast(s32, this->position[2])); diff --git a/src/lair/code_A810.c b/src/lair/code_A810.c index 5279a86e..c8fcbcd9 100644 --- a/src/lair/code_A810.c +++ b/src/lair/code_A810.c @@ -58,7 +58,7 @@ void func_80390D3C(Actor *this, s32 val) ActorLocal_lair_A810 *local; local = (ActorLocal_lair_A810 *)&this->local; - func_80328A84(this, val); + subaddie_set_state(this, val); switch (val) { diff --git a/src/lair/code_AD70.c b/src/lair/code_AD70.c index e6094496..36289cd6 100644 --- a/src/lair/code_AD70.c +++ b/src/lair/code_AD70.c @@ -210,7 +210,7 @@ void func_80391810(Actor *this, s32 next_state) { func_803917DC(); break; } - func_80328A84(this, next_state); + subaddie_set_state(this, next_state); } diff --git a/src/lair/code_BBD0.c b/src/lair/code_BBD0.c index 78637d1b..f59a9139 100644 --- a/src/lair/code_BBD0.c +++ b/src/lair/code_BBD0.c @@ -81,7 +81,7 @@ void func_8039217C(Actor *this) { switch(this->state){ case 1: //L803921F4 if (randf() < 0.01) { - func_80328A84(this, 2U); + subaddie_set_state(this, 2U); } break; @@ -96,13 +96,13 @@ void func_8039217C(Actor *this) { func_80392014(this, SFX_20_METAL_CLANK_1, 0.95f, 1.05f, 15000); } if (actor_animationIsAt(this, 0.999f)) { - func_80328A84(this, 1U); + subaddie_set_state(this, 1U); } break; case 3: //L803922FC if (randf() < 0.01) { - func_80328A84(this, 4U); + subaddie_set_state(this, 4U); } break; @@ -114,29 +114,29 @@ void func_8039217C(Actor *this) { func_80392014(this, SFX_9_SQUEAKY_TOY, 1.25f, 1.35f, 28000); } if (actor_animationIsAt(this, 0.999f)) { - func_80328A84(this, 3U); + subaddie_set_state(this, 3U); } break; case 5: //L803923C0 if (func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE)) { - func_80328A84(this, 8U); + subaddie_set_state(this, 8U); break; } if (mapSpecificFlags_get(9)) { mapSpecificFlags_set(5, 0); - func_80328A84(this, 8U); + subaddie_set_state(this, 8U); break; } if ((randf() < 0.1) || mapSpecificFlags_get(5)) { this->unk38_0 = mapSpecificFlags_get(5); this->unk60 = randf2(2.0f, 4.0f); - func_80328A84(this, 6U); + subaddie_set_state(this, 6U); func_803920E0(this, SFX_134_FREEZING_SHIVER, 1.1f, 1.2f, 15000, this->unk60); break; } if (randf() < 0.1) { - func_80328A84(this, 7U); + subaddie_set_state(this, 7U); } break; @@ -146,13 +146,13 @@ void func_8039217C(Actor *this) { break; } if (actor_animationIsAt(this, 0.999f) || (mapSpecificFlags_get(5) != this->unk38_0)) { - func_80328A84(this, 5U); + subaddie_set_state(this, 5U); } break; case 7: //L8039255C if ((actor_animationIsAt(this, 0.999f)) || (mapSpecificFlags_get(5) != this->unk38_0)) { - func_80328A84(this, 5U); + subaddie_set_state(this, 5U); } break; diff --git a/src/lair/code_C1C0.c b/src/lair/code_C1C0.c index 7ec635a5..d2666612 100644 --- a/src/lair/code_C1C0.c +++ b/src/lair/code_C1C0.c @@ -46,7 +46,7 @@ void func_80392690(ActorMarker *marker, enum asset_e text_id, s32 arg2){ this = marker_getActor(marker); func_8030E6D4(SFX_EA_GRUNTY_LAUGH_1); - func_80328B8C(this, 5, 0.0f, 1); + subaddie_set_state_with_direction(this, 5, 0.0f, 1); actor_loopAnimation(this); this->yaw_ideal = 79.0f; animctrl_setTransitionDuration(this->animctrl, 0.4f); @@ -72,17 +72,17 @@ void func_80392700(Actor *this) { func_8028F94C(2, this->position); func_80311480(0x103F, 0x2A, this->position, this->marker, func_80392690, func_80392610); mapSpecificFlags_set(6, 0); - func_80328B8C(this, 3, 0.0f, 1); + subaddie_set_state_with_direction(this, 3, 0.0f, 1); actor_playAnimationOnce(this); } if ((this->state == 3) && (actor_animationIsAt(this, 0.999f) != 0)) { - func_80328B8C(this, 4, 0.0f, 1); + subaddie_set_state_with_direction(this, 4, 0.0f, 1); actor_loopAnimation(this); } if (this->state == 5) { func_80328FB0(this, 12.0f); if (func_80329480(this) != 0) { - func_80328B8C(this, 5, 0.0f, 1); + subaddie_set_state_with_direction(this, 5, 0.0f, 1); this->marker->unk2C_2 = TRUE; } } From 4c7da415082b017e917f6ca702dc86f0228c306a Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Mon, 17 Jun 2024 01:10:20 -0500 Subject: [PATCH 10/38] document ba/carry, ba/drone and ba/falldamage --- decompressed.us.v10.yaml | 18 ++--- include/bs_funcs.h | 6 +- include/core2/ba/carry.h | 17 +++++ include/core2/ba/drone.h | 24 +++++++ include/functions.h | 2 +- src/FP/ch/bearcub.c | 2 +- src/MM/ch/lmonkey.c | 2 +- src/TTC/ch/blubber.c | 2 +- src/core2/ba/carry.c | 77 +++++++++++++++++++++ src/core2/ba/drone.c | 76 ++++++++++++++++++++ src/core2/ba/falldamage.c | 139 +++++++++++++++++++++++++++++++++++++ src/core2/bs/ant.c | 36 +++++----- src/core2/bs/bFlap.c | 10 +-- src/core2/bs/bLongLeg.c | 2 +- src/core2/bs/bPeck.c | 4 +- src/core2/bs/bSwim.c | 2 +- src/core2/bs/bTrot.c | 2 +- src/core2/bs/bbuster.c | 2 +- src/core2/bs/beeMain.c | 4 +- src/core2/bs/carry.c | 8 +-- src/core2/bs/climb.c | 4 +- src/core2/bs/croc.c | 4 +- src/core2/bs/drone.c | 21 +++--- src/core2/bs/dronegoto.c | 44 ++++++------ src/core2/bs/jump.c | 4 +- src/core2/bs/pumpkin.c | 4 +- src/core2/bs/splat.c | 2 +- src/core2/bs/stand.c | 6 +- src/core2/bs/swim.c | 2 +- src/core2/bs/throw.c | 6 +- src/core2/bs/walk.c | 14 ++-- src/core2/bs/walrus.c | 6 +- src/core2/code_14420.c | 7 +- src/core2/code_39D0.c | 2 +- src/core2/code_6B30.c | 13 ++-- src/core2/code_7060.c | 21 +++--- src/core2/code_B650.c | 75 -------------------- src/core2/code_C0E0.c | 142 -------------------------------------- src/core2/code_D800.c | 79 --------------------- src/core2/code_E910.c | 14 ++-- src/core2/code_EF50.c | 6 +- 41 files changed, 476 insertions(+), 435 deletions(-) create mode 100644 include/core2/ba/carry.h create mode 100644 include/core2/ba/drone.h create mode 100644 src/core2/ba/carry.c create mode 100644 src/core2/ba/drone.c create mode 100644 src/core2/ba/falldamage.c delete mode 100644 src/core2/code_B650.c delete mode 100644 src/core2/code_C0E0.c delete mode 100644 src/core2/code_D800.c diff --git a/decompressed.us.v10.yaml b/decompressed.us.v10.yaml index a80a139d..cc6df50a 100644 --- a/decompressed.us.v10.yaml +++ b/decompressed.us.v10.yaml @@ -522,14 +522,14 @@ segments: - [0xF60040, c, statetimer] #DONE - [0xF602C0, c, code_A960] #DONE - [0xF603C0, c, ba/model] #DONE - - [0xF60FB0, c, code_B650] #DONE + - [0xF60FB0, c, ba/drone] #DONE - [0xF611B0, c, code_B850] #DONE - [0xF614B0, c, eggshatter] #DONE - [0xF61680, c, code_BD20] #DONE - - [0xF61A40, c, code_C0E0] #DONE + - [0xF61A40, c, ba/falldamage] #DONE - [0xF61D50, c, code_C3F0] #DONE - [0xF61E10, c, code_C4B0] - - [0xF63160, c, code_D800] #DONE + - [0xF63160, c, ba/carry] #DONE - [0xF63310, c, code_D9B0] #DONE - [0xF638D0, c, code_DF70] #DONE - [0xF63D70, c, code_E410] #DONE @@ -904,7 +904,7 @@ segments: - [0x1032150, .data, ba/model] - [0x1032150, .data, code_B850] - [0x1032170, .data, eggshatter] - - [0x10321C0, .data, code_C0E0] + - [0x10321C0, .data, ba/falldamage] - [0x10321F0, .data, code_E910] - [0x1032E10, .data, ba/physics] - [0x1032E20, .data, code_117D0] @@ -1128,10 +1128,10 @@ segments: - [0x1042FC0, .rodata, code_9900] - [0x1042FD0, .rodata, code_9BD0] - [0x1043010, .rodata, ba/model] - - [0x10430C0, .rodata, code_B650] + - [0x10430C0, .rodata, ba/drone] - [0x10430D0, .rodata, code_B850] - [0x10430F0, .rodata, code_BD20] - - [0x1043110, .rodata, code_C0E0] + - [0x1043110, .rodata, ba/falldamage] - [0x1043130, .rodata, code_C4B0] - [0x1043170, .rodata, code_D9B0] - [0x1043180, .rodata, code_E680] @@ -1385,13 +1385,13 @@ segments: - [0x1048560, .bss, code_A600] - [0x1048560, .bss, statetimer] - [0x1048560, .bss, ba/model] - - [0x1048560, .bss, code_B650] + - [0x1048560, .bss, ba/drone] - [0x1048560, .bss, eggshatter] - [0x1048560, .bss, code_BD20] - - [0x1048560, .bss, code_C0E0] + - [0x1048560, .bss, ba/falldamage] - [0x1048560, .bss, code_C3F0] - [0x1048560, .bss, code_C4B0] - - [0x1048560, .bss, code_D800] + - [0x1048560, .bss, ba/carry] - [0x1048560, .bss, code_D9B0] - [0x1048560, .bss, code_DF70] - [0x1048560, .bss, code_E410] diff --git a/include/bs_funcs.h b/include/bs_funcs.h index 0c71258f..0e4c04d6 100644 --- a/include/bs_funcs.h +++ b/include/bs_funcs.h @@ -696,9 +696,9 @@ void func_802AADBC(void); void func_802AAE08(void); void func_802AAE4C(void); -void func_802AEDE8(void); -void func_802AEE48(void); -void func_802AEE9C(void); +void bsDroneGoTo_init(void); +void bsDroneGoTo_update(void); +void bsDroneGoTo_end(void); void bsDroneLook_init(void); void bsDroneLook_update(void); void bsDroneLook_end(void); diff --git a/include/core2/ba/carry.h b/include/core2/ba/carry.h new file mode 100644 index 00000000..5c74db27 --- /dev/null +++ b/include/core2/ba/carry.h @@ -0,0 +1,17 @@ +#ifndef __BA_CARRY_H__ +#define __BA_CARRY_H__ + +#include +#include "prop.h" + +void bacarry_init(void); +void bacarry_end(void); +void bacarry_update(void); + +void bacarry_reset_marker(void); +ActorMarker *bacarry_get_marker(void); +void bacarry_set_marker(ActorMarker *arg0); +void bacarry_set_offsets(f32 height, f32 rotation); + + +#endif diff --git a/include/core2/ba/drone.h b/include/core2/ba/drone.h new file mode 100644 index 00000000..5f0e7442 --- /dev/null +++ b/include/core2/ba/drone.h @@ -0,0 +1,24 @@ +#ifndef __BA_DRONE_H__ +#define __BA_DRONE_H__ + +#include +#include "prop.h" + +typedef enum ba_drone_type_e{ + BA_DRONE_NONE, + BA_DRONE_GOTO, + BA_DRONE_LOOK, + BA_DRONE_UNKNOWN_3, + BA_DRONE_TRANSFORM, + BA_DRONE_ENTER, + BA_DRONE_VANISH +} BaDroneType; + +void badrone_set_type(BaDroneType type); +BaDroneType badrone_get_type(void); +void badrone_get_position_and_duration(f32 position[3], f32 *duration); + +enum bs_e badrone_enter(void); +enum bs_e badrone_goto(f32 position[3], f32 duration, void (*arg2)(ActorMarker *), ActorMarker *arg3); + +#endif diff --git a/include/functions.h b/include/functions.h index c51b59da..13ab48d5 100644 --- a/include/functions.h +++ b/include/functions.h @@ -309,7 +309,7 @@ void func_80292974(f32, f32, f32); void func_80292900(f32, f32); void func_80292E80(s32, f32); -void func_80293350(void); +void bafalldamage_start(void); void func_80293D48(f32, f32); f32 func_80294438(void); f32 func_80294500(void); diff --git a/src/FP/ch/bearcub.c b/src/FP/ch/bearcub.c index 0ce6bb61..82298626 100644 --- a/src/FP/ch/bearcub.c +++ b/src/FP/ch/bearcub.c @@ -51,7 +51,7 @@ void func_8038A1F0(Actor **this_ptr, enum marker_e carried_obj_marker_id, enum a func_8028F31C((*this_ptr)->position, 600.0f, actor_id, this_ptr); if(!func_80329530(*this_ptr, 400)) return; - if(carriedObj_getMarkerId() != carried_obj_marker_id) return; + if(bacarry_get_markerId() != carried_obj_marker_id) return; if(!func_8028FC34()) return; func_8028FA34(arg3, *this_ptr); diff --git a/src/MM/ch/lmonkey.c b/src/MM/ch/lmonkey.c index 23db90e1..50313885 100644 --- a/src/MM/ch/lmonkey.c +++ b/src/MM/ch/lmonkey.c @@ -33,7 +33,7 @@ ActorInfo chlmonkeyInfo = { MARKER_A_CHIMPY, ACTOR_F_CHIMPY, ASSET_35D_MODEL_CHI void func_80388300(Actor **arg0){ func_8028F31C((*arg0)->position, 800.0f, ACTOR_29_ORANGE_COLLECTIBLE, arg0); if( func_80329530(*arg0, 345) - && carriedObj_getMarkerId() == MARKER_36_ORANGE_COLLECTIBLE + && bacarry_get_markerId() == MARKER_36_ORANGE_COLLECTIBLE && func_8028FC34() ){ func_8028FA34(0xc6, *arg0); diff --git a/src/TTC/ch/blubber.c b/src/TTC/ch/blubber.c index e6cfa225..f004dfa5 100644 --- a/src/TTC/ch/blubber.c +++ b/src/TTC/ch/blubber.c @@ -113,7 +113,7 @@ void func_80387774(Actor **this_ptr){ func_8028F364(local->throw_target_position, local->throw_target_radius, 100.0f, ACTOR_2A_GOLD_BULLION, this_ptr); if( func_80329530(*this_ptr, 200) - && carriedObj_getMarkerId() == MARKER_37_GOLD_BULLION + && bacarry_get_markerId() == MARKER_37_GOLD_BULLION && func_8028FC34() ){ func_8028FA34(!mapSpecificFlags_get(0)? 0x149 : 0x14a, *this_ptr); diff --git a/src/core2/ba/carry.c b/src/core2/ba/carry.c new file mode 100644 index 00000000..3f71a39a --- /dev/null +++ b/src/core2/ba/carry.c @@ -0,0 +1,77 @@ +#include "functions.h" + +#include "core2/ba/carry.h" + + +void bacarry_set_offsets(f32 arg0, f32 arg1); + +/* .bss */ +struct { + f32 height; + f32 rotation; +} bacarry_offsets; +ActorMarker* baCarry_marker; +u8 bacarry_active; + +/* .code */ +void bacarry_init(void){ + baCarry_marker = NULL; + bacarry_active = 0; + bacarry_set_offsets(0.0f, 0.0f); +} + +void bacarry_end(void){} + +void __bacarry_set_position_and_rotation(ActorMarker *marker, f32 arg1[3], f32 arg2[3]){ + Actor * actor = marker_getActor(marker); + if(actor->unk138_22){ + actor->position_x = arg1[0]; + actor->position_y = arg1[1]; + actor->position_z = arg1[2]; + + actor->yaw = arg2[1]; + } +} + +void __bacarry_update(void){ + f32 banjoPos[3]; + f32 banjoRot[3]; + + + player_getRotation(banjoRot); + baModel_getPosition(banjoPos); + banjoRot[1] = mlNormalizeAngle(banjoRot[1] + bacarry_offsets.rotation); + banjoPos[1] += bacarry_offsets.height; + __bacarry_set_position_and_rotation(baCarry_marker, banjoPos, banjoRot); +} + +void bacarry_update(void){ + if(baCarry_marker != NULL){ + if(bacarry_active == 0){ + baCarry_marker = NULL; + } + else{ + __bacarry_update(); + bacarry_active = 0; + } + } +} + +void bacarry_reset_marker(void){ + baCarry_marker = NULL; +} + +ActorMarker *bacarry_get_marker(void){ + return baCarry_marker; +} + +void bacarry_set_marker(ActorMarker *arg0){ + baCarry_marker = arg0; + __bacarry_update(); + bacarry_active = 1; +} + +void bacarry_set_offsets(f32 height, f32 rotation){ + bacarry_offsets.height = height; + bacarry_offsets.rotation = rotation; +} diff --git a/src/core2/ba/drone.c b/src/core2/ba/drone.c new file mode 100644 index 00000000..a5a0177a --- /dev/null +++ b/src/core2/ba/drone.c @@ -0,0 +1,76 @@ +#include +#include "functions.h" + +#include "core2/ba/drone.h" + +/* .bss */ +struct { + u8 type; + // u8 pad1[3]; + f32 duration; + f32 position[3]; + void (*unk14)(ActorMarker *); + ActorMarker *unk18; +}badrone; + +/* .code */ +void badrone_set_type(BaDroneType type){ + badrone.type = type; +} + +BaDroneType badrone_get_type(void){ + return badrone.type; +} + +void badrone_get_position_and_duration(f32 position[3], f32 *duration){ + ml_vec3f_copy(position, badrone.position); + *duration = badrone.duration; +} + +enum bs_e badrone_enter(void){ + badrone_set_type(BA_DRONE_ENTER); + return func_8029BD90(); +} + +enum bs_e badrone_goto(f32 position[3], f32 duration, void (*arg2)(ActorMarker *), ActorMarker *arg3){ + ml_vec3f_copy(badrone.position, position); + badrone.duration = duration; + badrone.unk14 = arg2; + badrone.unk18 = arg3; + badrone_set_type(BA_DRONE_GOTO); + return func_8029BD90(); +} + +enum bs_e badrone_look(void){ + badrone_set_type(BA_DRONE_LOOK); + return func_8029BD90(); +} + +enum bs_e badrone_802926E8(void){ + badrone_set_type(BA_DRONE_UNKNOWN_3); + return func_8029BD90(); +} + +enum bs_e badrone_vanish(void){ + badrone_set_type(BA_DRONE_VANISH); + return func_8029BD90(); +} + +enum bs_e badrone_transform(void){ + miscflag_clear(0x19); + badrone_set_type(BA_DRONE_TRANSFORM); + return func_8029BD90(); +} + +void badrone_goto_end(void){ + if(badrone.unk14){ + badrone.unk14(badrone.unk18); + } +} + +void badrone_init(void){ + badrone.type = 0; + badrone.unk14 = NULL; + badrone.duration = 0.1f; + ml_vec3f_clear(badrone.position); +} diff --git a/src/core2/ba/falldamage.c b/src/core2/ba/falldamage.c new file mode 100644 index 00000000..2c1c4307 --- /dev/null +++ b/src/core2/ba/falldamage.c @@ -0,0 +1,139 @@ +#include +#include "functions.h" +#include "variables.h" + +typedef struct { + s32 damage; + s32 state; +} struct_C0E0; + +typedef struct{ + s16 height; + u8 damage; + u8 state; +} struct_C0E0_1; + +typedef struct{ + u8 pad0[0xC]; + struct_C0E0_1 unkC[]; +} struct_C0E0_2; + +void bafalldamage_start(void); + +/* .data */ +struct_C0E0_1 bafalldamage_lookup_table[]={ + {1000, 0, 0}, + {1500, 0, 0}, + {2000, 0, 0}, + {7000, 8, 2}, + {6000, 7, 1}, + {5000, 6, 1}, + {4000, 5, 1}, + {3000, 4, 1}, + {2000, 3, 1}, + {1000, 2, 1}, + {0, 1, 1}, + {-1, 0, 0} +}; + +/* .bss */ +f32 bafalldamage_start_position[3]; +u8 bafalldamage_state; +struct_C0E0 D_8037C1C0; + +/* .code */ +s32 __bafalldamage_lookup(struct_C0E0 *arg0, s32 height, struct_C0E0_1 *arg2){ + struct_C0E0_1 *iPtr; + for(iPtr = &arg2[3]; iPtr->height >= 0; iPtr++){ + if(iPtr->height + 1000 < height){ + arg0->damage = iPtr->damage; + return iPtr->state; + } + } + return 0; +} + +s32 __bafalldamage_get_damage(struct_C0E0 *arg0, s32 height){ + arg0->damage = 0; + if(height < 0) + return 0; + else{ + switch(bsStoredState_getTransformation()){ + case TRANSFORM_2_TERMITE: //L80293110 + return __bafalldamage_lookup(arg0, height, bafalldamage_lookup_table); + case TRANSFORM_3_PUMPKIN: //L80293124 + return __bafalldamage_lookup(arg0, height, bafalldamage_lookup_table); + case TRANSFORM_5_CROC: //L80293138 + return __bafalldamage_lookup(arg0, height, bafalldamage_lookup_table); + case TRANSFORM_4_WALRUS: //L8029314C + return __bafalldamage_lookup(arg0, height, bafalldamage_lookup_table); + case TRANSFORM_6_BEE: //L80293160 + return __bafalldamage_lookup(arg0, height, bafalldamage_lookup_table); + default: + return __bafalldamage_lookup(arg0, height, bafalldamage_lookup_table); + break; + } + } +} + +void __bafalldamage_update(void){ + f32 player_position[3]; + s32 height; + + player_getPosition(player_position); + height = bafalldamage_start_position[1] - player_position[1]; + D_8037C1C0.state = __bafalldamage_get_damage(&D_8037C1C0, height); +} + +s32 bafalldamage_get_damage(s32 *damage){ + *damage = D_8037C1C0.damage; + return D_8037C1C0.state; +} + +f32 bafalldamage_get_distance_fallen(void){ + f32 player_position[3]; + s32 temp_v0; + + player_getPosition(player_position); + temp_v0 = bafalldamage_start_position[1] - player_position[1]; + return temp_v0; +} + +s32 bafalldamage_get_state(void){ + return bafalldamage_state; +} + +void bafalldamage_set_state(s32 arg0){ + bafalldamage_state = arg0; + if(bafalldamage_state == 2 || bafalldamage_state == 3) + bafalldamage_start(); +} + +void bafalldamage_set_start_position(f32 arg0[3]){ + ml_vec3f_copy(bafalldamage_start_position, arg0); +} + +void bafalldamage_init(void){ + _player_getPosition(bafalldamage_start_position); + bafalldamage_state = 0; + bafalldamage_set_state(1); + D_8037C1C0.damage = 0; + D_8037C1C0.state = 0; +} + +void bafalldamage_update(void){ + s32 player_position; + player_position = func_8028ECAC(); + if(func_8028B2E8() || (func_8028EE84() != BSWATERGROUP_0_NONE) || player_position == BSGROUP_A_FLYING){ + bafalldamage_start(); + bafalldamage_set_state(1); + } + __bafalldamage_update(); +} + +void bafalldamage_start(void){ + f32 player_position[3]; + + _player_getPosition(player_position); + bafalldamage_set_start_position(player_position); +} diff --git a/src/core2/bs/ant.c b/src/core2/bs/ant.c index 697f9557..b4b4f01d 100644 --- a/src/core2/bs/ant.c +++ b/src/core2/bs/ant.c @@ -23,7 +23,7 @@ s16 D_8036497C[3] = { /* .bss */ f32 D_8037D290; -u8 D_8037D294; +u8 bsant_substate; s32 D_8037D298; /* .code */ @@ -97,7 +97,7 @@ void bsant_idle_update(void){ new_state = BS_38_ANT_FALL; if(func_80294F78()) - new_state = func_802926C0(); + new_state = badrone_look(); if(func_8029B300() > 0) new_state = BS_ANT_WALK; @@ -171,7 +171,7 @@ void bsant_jump_init(void){ baphysics_set_vertical_velocity(D_80364970); baphysics_set_gravity(D_80364974); func_8029E3E0(); - D_8037D294 = 0; + bsant_substate = 0; } void bsant_jump_update(void){ @@ -186,26 +186,26 @@ void bsant_jump_update(void){ if(button_released(BUTTON_A) && 0.0f < sp1C[1]) baphysics_reset_gravity(); - switch(D_8037D294){ + switch(bsant_substate){ case 0://L8029EA88 if(animctrl_isStopped(aCtrl)){ animctrl_setDuration(aCtrl, 5.0f); baanim_setEnd(0.5026f); - D_8037D294 = 1; + bsant_substate = 1; } break; case 1://L8029EABC if(func_8028B254(0x82)){ animctrl_setDuration(aCtrl, 1.0f); baanim_setEnd(1.0f); - D_8037D294 = 2; + bsant_substate = 2; } break; case 2://L8029EAF4 func_80299628(0); if(func_8028B2E8()){ func_8029C5E8(); - D_8037D294 = 3; + bsant_substate = 3; } break; case 3://L8029EB24 @@ -241,7 +241,7 @@ void bsant_fall_init(void){ animctrl_setPlaybackType(aCtrl, ANIMCTRL_STOPPED); animctrl_start(aCtrl, "bsant.c", 0x208); func_8029C7F4(1, YAW_STATE_1_DEFAULT, 3, BA_PHYSICS_AIRBORN); - D_8037D294 = 0; + bsant_substate = 0; } void bsant_fall_update(void){ @@ -254,12 +254,12 @@ void bsant_fall_update(void){ func_8029E48C(); baphysics_get_velocity(sp1C); - switch(D_8037D294){ + switch(bsant_substate){ case 0: if(func_8028B254(0x5A)){ animctrl_setDuration(aCtrl, 2.0f); baanim_setEnd(1.0f); - D_8037D294 = 1; + bsant_substate = 1; } break; case 1: @@ -267,7 +267,7 @@ void bsant_fall_update(void){ } if(func_8028B2E8()){ if(miscflag_isTrue(0x19)) - sp2C = func_80292738(); + sp2C = badrone_transform(); else sp2C = BS_35_ANT_IDLE; } @@ -309,7 +309,7 @@ static void __bsant_recoil_init(int take_damage){ baphysics_set_gravity(-1200.0f); baMarker_collisionOff(); func_80292E48(); - D_8037D294 = 0; + bsant_substate = 0; } static void __bsant_recoil_update(void){ @@ -318,11 +318,11 @@ static void __bsant_recoil_update(void){ if(baanim_isAt(0.5f)) func_80292EA4(); - switch(D_8037D294){ + switch(bsant_substate){ case 0: if(func_8028B254(0x5a)){ baanim_setEnd(1.0f); - D_8037D294 = 1; + bsant_substate = 1; } break; case 1: @@ -398,7 +398,7 @@ void bsant_die_init(void){ func_802914CC(0xd); ncDynamicCamD_func_802BF2C0(30.0f); func_8029C984(); - D_8037D294 = 0; + bsant_substate = 0; baMarker_collisionOff(); func_80292E48(); func_8029E3C0(0, 2.9f); @@ -409,20 +409,20 @@ void bsant_die_update(void){ baphysics_set_target_horizontal_velocity(D_8037D290); func_80299628(0); - switch(D_8037D294){ + switch(bsant_substate){ case 0://L8029F270 if(func_8028B2E8()){ baanim_setEnd(1.0f); FUNC_8030E624(SFX_1F_HITTING_AN_ENEMY_3, 0.8f, 18000); FUNC_8030E624(SFX_39_BANJO_AYE_2, 1.8f, 18000); D_8037D290 = 0.0f; - D_8037D294 = 1; + bsant_substate = 1; } break; case 1://L8029F2C0 if(animctrl_isAt(aCtrl, 0.72f)){ D_8037D290 = 0.0f; - D_8037D294 = 2; + bsant_substate = 2; } break; case 2://L8029F2F0 diff --git a/src/core2/bs/bFlap.c b/src/core2/bs/bFlap.c index 62fed1b6..2146616c 100644 --- a/src/core2/bs/bFlap.c +++ b/src/core2/bs/bFlap.c @@ -110,7 +110,7 @@ void bsbflap_update(void){ func_802B6FA8(); switch(D_8037D300){ case 0: - func_80293350(); + bafalldamage_start(); func_802A2900(); func_802A298C(); if(animctrl_isAt(sp18, 0.9f)){ @@ -127,7 +127,7 @@ void bsbflap_update(void){ } break; case 1: - func_80293350(); + bafalldamage_start(); func_802A2900(); func_802A2810(); func_802A28CC(); @@ -137,7 +137,7 @@ void bsbflap_update(void){ } break; case 2: - func_80293350(); + bafalldamage_start(); func_802A2900(); func_802A2810(); func_802A28CC(); @@ -152,7 +152,7 @@ void bsbflap_update(void){ } break; case 3: - func_80293350(); + bafalldamage_start(); func_802A2900(); func_802A2810(); func_802A28CC(); @@ -161,7 +161,7 @@ void bsbflap_update(void){ baphysics_reset_gravity(); baphysics_reset_terminal_velocity(); animctrl_setDuration(sp18, 1.0f); - func_80293240(2); + bafalldamage_set_state(2); D_8037D300 = 4; } else{ diff --git a/src/core2/bs/bLongLeg.c b/src/core2/bs/bLongLeg.c index c2c0bd94..1019024c 100644 --- a/src/core2/bs/bLongLeg.c +++ b/src/core2/bs/bLongLeg.c @@ -168,7 +168,7 @@ void bsblongleg_stand_update(void){ func_802A531C(); func_80299594(1, 0.5f); if(func_80294F78()) - next_state = func_802926C0(); + next_state = badrone_look(); if(button_pressed(BUTTON_B)) stateTimer_clear(STATE_TIMER_2_LONGLEG); diff --git a/src/core2/bs/bPeck.c b/src/core2/bs/bPeck.c index 18e27bf3..ffa13b5b 100644 --- a/src/core2/bs/bPeck.c +++ b/src/core2/bs/bPeck.c @@ -36,8 +36,8 @@ void bsbpeck_init(void){ case BS_57_BOMB_END: break; } - if(func_80293234() == 1) - func_80293240(2); + if(bafalldamage_get_state() == 1) + bafalldamage_set_state(2); baanim_playForDuration_onceSmooth(ASSET_1A_ANIM_BSBPECK, 0.2f); func_8029C7F4(1,YAW_STATE_3_BOUNDED, 1, BA_PHYSICS_AIRBORN); diff --git a/src/core2/bs/bSwim.c b/src/core2/bs/bSwim.c index 82d47f8a..42235ea2 100644 --- a/src/core2/bs/bSwim.c +++ b/src/core2/bs/bSwim.c @@ -128,7 +128,7 @@ void func_802A7674() { func_802A7304(); if (func_80294F78()) { - state_id = func_802926C0(); + state_id = badrone_look(); } if (button_held(BUTTON_A)) { state_id = BS_39_DIVE_A; diff --git a/src/core2/bs/bTrot.c b/src/core2/bs/bTrot.c index 3a1f7bc8..e1a95d78 100644 --- a/src/core2/bs/bTrot.c +++ b/src/core2/bs/bTrot.c @@ -191,7 +191,7 @@ enum bs_e func_802A8D84(enum bs_e arg0){ arg0 = BS_16_BTROT_WALK; if(func_80294F78()) - arg0 = func_802926C0(); + arg0 = badrone_look(); if(func_8028B094()) arg0 = BS_71_BTROT_FALL; diff --git a/src/core2/bs/bbuster.c b/src/core2/bs/bbuster.c index 0aece6cd..b30876b5 100644 --- a/src/core2/bs/bbuster.c +++ b/src/core2/bs/bbuster.c @@ -148,7 +148,7 @@ void bsbbuster_update(void){ D_8037D2BA = 3; _player_getPosition(player_position); func_8032728C(player_position, 150.0f, 2, func_8029FB20); - if(func_802931DC(&sp3C)){ + if(bafalldamage_get_damage(&sp3C)){ sp44 = BS_SPLAT; } } diff --git a/src/core2/bs/beeMain.c b/src/core2/bs/beeMain.c index 016e2567..c0ab228b 100644 --- a/src/core2/bs/beeMain.c +++ b/src/core2/bs/beeMain.c @@ -74,7 +74,7 @@ void func_802A10D4(void){ s0 = 0x88; if(func_80294F78()) - s0 = func_802926C0(); + s0 = badrone_look(); if(func_8029B300() > 0) s0 = BS_BEE_WALK; @@ -276,7 +276,7 @@ void func_802A170C(void){ } if(func_8028B2E8()){ if(miscflag_isTrue(0x19)){ - sp2c = func_80292738(); + sp2c = badrone_transform(); }else{ if(func_8029B300() > 0) sp2c = BS_BEE_WALK; diff --git a/src/core2/bs/carry.c b/src/core2/bs/carry.c index 726ef183..1afceec4 100644 --- a/src/core2/bs/carry.c +++ b/src/core2/bs/carry.c @@ -47,7 +47,7 @@ void bscarry_idle_update(void){ if(func_8029B300() > 0) sp1C = BS_3B_CARRY_WALK; - if(carriedobj_getMarker() == NULL) + if(bacarry_get_marker() == NULL) sp1C = BS_1_IDLE; bs_setState(sp1C); @@ -76,7 +76,7 @@ void bscarry_walk_update(void){ if(func_8029B300() == 0 && baphysics_is_slower_than(1.0f)) sp1C = BS_3A_CARRY_IDLE; - if(carriedobj_getMarker() == NULL) + if(bacarry_get_marker() == NULL) sp1C = BS_1_IDLE; bs_setState(sp1C); @@ -94,7 +94,7 @@ int bscarry_inSet(enum bs_e state){ void bscarry_interrupt(void){ switch(bs_getInterruptType()){ case 7: - func_802948F8(baMarker_8028D688()); + bacarry_set_marker(baMarker_8028D688()); break; case 8: func_8029A86C(2); @@ -113,7 +113,7 @@ void bscarry_interrupt(void){ } break; default://L802AB260 - func_802948E0(); + bacarry_reset_marker(); func_80296608(); break; } diff --git a/src/core2/bs/climb.c b/src/core2/bs/climb.c index 322fc9a1..a75cc573 100644 --- a/src/core2/bs/climb.c +++ b/src/core2/bs/climb.c @@ -91,7 +91,7 @@ void bsclimb_idle_init(void){ void bsclimb_idle_update(void){ s32 next_state = 0; AnimCtrl *anim_ctrl = baanim_getAnimCtrlPtr(); - func_80293350(); + bafalldamage_start(); switch(D_8037D3D0){ case 0: D_8037D3D4 -= time_getDelta(); @@ -139,7 +139,7 @@ void bsclimb_move_update(void){ f32 plyr_pos[3]; s32 map; - func_80293350(); + bafalldamage_start(); func_802AB5C0(); map = map_get(); diff --git a/src/core2/bs/croc.c b/src/core2/bs/croc.c index 1999a6ee..68905985 100644 --- a/src/core2/bs/croc.c +++ b/src/core2/bs/croc.c @@ -122,7 +122,7 @@ void bscroc_idle_update(void){ next_state = BS_61_CROC_FALL; if(func_80294F78()) - next_state = func_802926C0(); + next_state = badrone_look(); if(func_8029B300() > 0) next_state = BS_CROC_WALK; @@ -313,7 +313,7 @@ void bscroc_fall_update(void){ if(func_8028B2E8()){ if(func_8029B300() > 0 || (D_8037D3EC == 2 && animctrl_isStopped(aCtrl))){ if(miscflag_isTrue(0x19)){ - next_state = func_80292738(); + next_state = badrone_transform(); }else{ next_state = BS_5E_CROC_IDLE; } diff --git a/src/core2/bs/drone.c b/src/core2/bs/drone.c index 88c05e8c..6a683962 100644 --- a/src/core2/bs/drone.c +++ b/src/core2/bs/drone.c @@ -3,17 +3,20 @@ #include "variables.h" #include "bsint.h" +#include "core2/ba/drone.h" + typedef struct{ - u8 unk0; + u8 type; bsState behavior; } struct_drone; struct_drone D_80364B30[] = { - {01, {func_802AEDE8, func_802AEE48, func_802AEE9C, NULL}}, - {02, {bsDroneLook_init, bsDroneLook_update, bsDroneLook_end, func_80296608}}, - {04, {bsdronexform_init, bsdronexform_update, bsdronexform_end, bsdronexform_interrupt}}, - {05, {bsDroneEnter_init, bsDroneEnter_update, bsDroneEnter_end, NULL}}, - {06, {bsDroneVanish_init, bsDroneVanish_update, bsDroneVanish_end, NULL}}, + {BA_DRONE_GOTO, {bsDroneGoTo_init, bsDroneGoTo_update, bsDroneGoTo_end, NULL}}, + {BA_DRONE_LOOK, {bsDroneLook_init, bsDroneLook_update, bsDroneLook_end, func_80296608}}, + // {BA_DRONE_UNKNOWN_3, {NULL, NULL, NULL, NULL}}, //unused drone type? + {BA_DRONE_TRANSFORM, {bsdronexform_init, bsdronexform_update, bsdronexform_end, bsdronexform_interrupt}}, + {BA_DRONE_ENTER, {bsDroneEnter_init, bsDroneEnter_update, bsDroneEnter_end, NULL}}, + {BA_DRONE_VANISH, {bsDroneVanish_init, bsDroneVanish_update, bsDroneVanish_end, NULL}}, {0} }; @@ -21,9 +24,9 @@ struct_drone D_80364B30[] = { static int __bsdrone_getIndex(void){ int i; - int val = func_802925EC(); - for(i = 0; D_80364B30[i].unk0 != 0; i++){ - if(val == D_80364B30[i].unk0) + int val = badrone_get_type(); + for(i = 0; D_80364B30[i].type != 0; i++){ + if(val == D_80364B30[i].type) return i; } return 0; diff --git a/src/core2/bs/dronegoto.c b/src/core2/bs/dronegoto.c index 7cbf5cac..faca4847 100644 --- a/src/core2/bs/dronegoto.c +++ b/src/core2/bs/dronegoto.c @@ -6,7 +6,7 @@ /* .bss */ -u8 D_8037D440; +u8 bsdronetogo_substate; u8 D_8037D441; void func_802AEC08(void); @@ -14,8 +14,8 @@ void func_802AEC70(void); void func_802AEC78(void); void func_802AEDC8(void); -void func_802AEB60(s32 arg0){ - switch(D_8037D440){ +static void __bsDroneGoTo_set_substate(s32 arg0){ + switch(bsdronetogo_substate){ case 1: func_802AEC70(); break; @@ -23,7 +23,7 @@ void func_802AEB60(s32 arg0){ func_802AEDC8(); break; } - switch(D_8037D440 = arg0){ + switch(bsdronetogo_substate = arg0){ case 1: func_802AEC08(); break; @@ -41,20 +41,20 @@ void func_802AEC08(void){ void func_802AEC28(void){ baphysics_reset_horizontal_velocity(); if(func_8028B2E8() || player_inWater()) - func_802AEB60(2); + __bsDroneGoTo_set_substate(2); } void func_802AEC70(void){} void func_802AEC78(void){ - f32 sp2C; - f32 sp20[3]; - s32 sp1C; - func_8029BC60(&sp1C, &sp2C); - baanim_playForDuration_loopSmooth(sp1C, sp2C); - func_802925F8(&sp20, &sp2C); - baphysics_set_goto_position(&sp20); - baphysics_set_goto_duration(sp2C); + f32 duration_s; + f32 target_position[3]; + s32 anim_id; + func_8029BC60(&anim_id, &duration_s); + baanim_playForDuration_loopSmooth(anim_id, duration_s); + badrone_get_position_and_duration(target_position, &duration_s); + baphysics_set_goto_position(target_position); + baphysics_set_goto_duration(duration_s); func_8029C7F4(1,1,3,BA_PHYSICS_GOTO); func_8029436C(1); D_8037D441 = 0; @@ -80,7 +80,7 @@ void func_802AECE4(void){ if(baphysics_goto_done() && D_8037D441 == 0){ D_8037D441++; - func_80292768(); + badrone_goto_end(); } } @@ -88,19 +88,19 @@ void func_802AEDC8(void){ func_8029436C(0); } -void func_802AEDE8(void){ - D_8037D440 = 0; +void bsDroneGoTo_init(void){ + bsdronetogo_substate = 0; func_8031F9F4(1); if( !func_8028B2E8() && func_8029BDE8()){ - func_802AEB60(1); + __bsDroneGoTo_set_substate(1); }else{ - func_802AEB60(2); + __bsDroneGoTo_set_substate(2); } } -void func_802AEE48(void){ - switch(D_8037D440){ +void bsDroneGoTo_update(void){ + switch(bsdronetogo_substate){ case 1: func_802AEC28(); break; @@ -110,7 +110,7 @@ void func_802AEE48(void){ } } -void func_802AEE9C(void){ - func_802AEB60(0); +void bsDroneGoTo_end(void){ + __bsDroneGoTo_set_substate(0); func_8031F9F4(0); } diff --git a/src/core2/bs/jump.c b/src/core2/bs/jump.c index 9906d298..b288a322 100644 --- a/src/core2/bs/jump.c +++ b/src/core2/bs/jump.c @@ -389,7 +389,7 @@ void bsjump_tumble_init(void){ baanim_playForDuration_loop(ASSET_68_ANIM_BSJUMP_TUMBLE, 0.35f); func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); baModel_setYDisplacement(60.0f); - if(func_80293234() == 1){ + if(bafalldamage_get_state() == 1){ func_8029E3C0(0, 0.5f); func_8029E3C0(1, 0.41f); func_80299CF4(SFX_52_BANJO_YAH_OH, 1.0f, 22000); @@ -436,7 +436,7 @@ void bsjump_tumble_end(void){ || next_state == BS_BFLAP || next_state == BS_11_BPECK ){ - func_80293240(3); + bafalldamage_set_state(3); } func_8029CB84(); baModel_setYDisplacement(0.0f); diff --git a/src/core2/bs/pumpkin.c b/src/core2/bs/pumpkin.c index e87df0ec..df5712d0 100644 --- a/src/core2/bs/pumpkin.c +++ b/src/core2/bs/pumpkin.c @@ -93,7 +93,7 @@ void bspumpkin_idle_update(void) { next_state = BS_4B_PUMPKIN_FALL; } if (func_80294F78()) { - next_state = func_802926C0(); + next_state = badrone_look(); } if (func_8029B300() > 0) { next_state = BS_49_PUMPKIN_WALK; @@ -291,7 +291,7 @@ void bspumpkin_fall_update(void) { } if (func_8028B2E8() && ((func_8029B300() > 0) || (D_8037D4E0 == 2 && animctrl_isStopped(anim_ctrl)))) { if (miscflag_isTrue(0x19)) { - next_state = func_80292738(); + next_state = badrone_transform(); } else { next_state = BS_48_PUMPKIN_IDLE; } diff --git a/src/core2/bs/splat.c b/src/core2/bs/splat.c index e63de900..f01eeb6c 100644 --- a/src/core2/bs/splat.c +++ b/src/core2/bs/splat.c @@ -24,7 +24,7 @@ void bssplat_init(void){ s32 sp1C; baanim_playForDuration_onceSmooth(ASSET_149_ANIM_BSSPLAT, 1.1f); func_8029C7F4(1,1,3, BA_PHYSICS_LOCKED_ROTATION); - func_802931DC(&sp1C); + bafalldamage_get_damage(&sp1C); func_803463D4(ITEM_14_HEALTH, -sp1C); if(func_8029CEB0() == 4){ FUNC_8030E624(SFX_116_DEAF_RUSTLING, 0.7f, 32000); diff --git a/src/core2/bs/stand.c b/src/core2/bs/stand.c index ae3c4fc3..0165ef3c 100644 --- a/src/core2/bs/stand.c +++ b/src/core2/bs/stand.c @@ -74,7 +74,7 @@ s32 func_802B488C(s32 arg0){ retVal = func_8029C780(); if(func_80294F78()) - retVal = func_802926C0(); + retVal = badrone_look(); if(player_isSliding()) retVal = BS_SLIDE; @@ -317,7 +317,7 @@ void func_802B5350(void){ if(bsStoredState_getTransformation() != TRANSFORM_1_BANJO) func_8029A86C(1); else{ - func_802948F8(baMarker_8028D688()); + bacarry_set_marker(baMarker_8028D688()); bs_setState(BS_3A_CARRY_IDLE); } } @@ -332,7 +332,7 @@ void func_802B5350(void){ func_8029A86C(2); bs_setState(BS_3C_TALK); }else{ - func_802948E0(); + bacarry_reset_marker(); func_80296608(); } } diff --git a/src/core2/bs/swim.c b/src/core2/bs/swim.c index b0f693d0..b78e61a7 100644 --- a/src/core2/bs/swim.c +++ b/src/core2/bs/swim.c @@ -171,7 +171,7 @@ void func_802B5950(void) { next_state = BS_1_IDLE; } if (func_80294F78()) { - next_state = func_802926C0(); + next_state = badrone_look(); } if (should_dive()) { next_state = BS_30_DIVE_ENTER; diff --git a/src/core2/bs/throw.c b/src/core2/bs/throw.c index c6e7f429..34e28950 100644 --- a/src/core2/bs/throw.c +++ b/src/core2/bs/throw.c @@ -5,7 +5,7 @@ #include "core2/ba/anim.h" #include "core2/ba/physics.h" -extern ActorMarker *carriedobj_getMarker(void); +extern ActorMarker *bacarry_get_marker(void); /* .bss */ u8 D_8037D580; @@ -35,10 +35,10 @@ void bsthrow_update(void){ f32 sp34[3]; f32 player_position[3]; f32 sp24; - ActorMarker *sp20 = carriedobj_getMarker(); + ActorMarker *sp20 = bacarry_get_marker(); if(D_8037D580 == 0 && sp20 != NULL) - func_802948F8(sp20); + bacarry_set_marker(sp20); _player_getPosition(player_position); get_throw_target_position(sp34); diff --git a/src/core2/bs/walk.c b/src/core2/bs/walk.c index 161b85ec..e60fb26c 100644 --- a/src/core2/bs/walk.c +++ b/src/core2/bs/walk.c @@ -163,7 +163,7 @@ void bswalk_creep_update(void){ next_state = BS_WALK_MUD; if(func_80294F78()) - next_state = func_802926C0(); + next_state = badrone_look(); if(func_8028B094()) next_state = BS_2F_FALL; @@ -236,7 +236,7 @@ void bswalk_slow_upate(void){ next_state = BS_WALK_MUD; if(func_80294F78()) - next_state = func_802926C0(); + next_state = badrone_look(); if(func_8028B094()) next_state = BS_2F_FALL; @@ -312,7 +312,7 @@ void bswalk_update(void){ } if(func_80294F78()) - next_state = func_802926C0(); + next_state = badrone_look(); if(func_8028B094()) next_state = BS_2F_FALL; @@ -387,7 +387,7 @@ void bswalk_fast_update(void){ next_state = BS_1_IDLE; if(func_80294F78()) - next_state = func_802926C0(); + next_state = badrone_look(); break; case 1: @@ -396,7 +396,7 @@ void bswalk_fast_update(void){ next_state = BS_2_WALK_SLOW; if(func_80294F78()) - next_state = func_802926C0(); + next_state = badrone_look(); break; case 3://L802B7A60 @@ -404,7 +404,7 @@ void bswalk_fast_update(void){ next_state = BS_WALK; if(func_80294F78()) - next_state = func_802926C0(); + next_state = badrone_look(); break; }//L802B7AA4 if(func_8028B128()) @@ -461,7 +461,7 @@ void bswalk_mud_update(void){ next_state = BS_1_IDLE; if(func_80294F78()) - next_state = func_802926C0(); + next_state = badrone_look(); if(func_8028B094()) next_state = BS_2F_FALL; diff --git a/src/core2/bs/walrus.c b/src/core2/bs/walrus.c index 593e1109..b63e5319 100644 --- a/src/core2/bs/walrus.c +++ b/src/core2/bs/walrus.c @@ -163,7 +163,7 @@ void bswalrus_idle_update(void){ next_state = BS_6A_WALRUS_FALL; if(func_80294F78()) - next_state = func_802926C0(); + next_state = badrone_look(); if(func_8029B300() > 0) next_state = BS_WALRUS_WALK; @@ -353,7 +353,7 @@ void bswalrus_fall_update(void){ || (D_8037D5C8 == 2 && animctrl_isStopped(aCtrl)) ){ if(miscflag_isTrue(0x19)) - next_state = func_80292738(); + next_state = badrone_transform(); else next_state = BS_67_WALRUS_IDLE; } @@ -579,7 +579,7 @@ void bswalrus_sled_update(void){ func_80299628(0); func_802B7F28(); if(func_80294F78()) - next_state = func_802926C0(); + next_state = badrone_look(); if(button_pressed(BUTTON_A)) next_state = BS_7E_WALRUS_SLED; diff --git a/src/core2/code_14420.c b/src/core2/code_14420.c index 1c38e6b5..d0de9d82 100644 --- a/src/core2/code_14420.c +++ b/src/core2/code_14420.c @@ -37,7 +37,7 @@ enum bs_14420_e{ BS14420_A_WALRUS_SLED, BS14420_B_BEE, BS14420_C_CLIMB, - BS14420_D_WONDERWING, + BS14420_D_WONDERWING }; /* .data */ @@ -505,6 +505,7 @@ enum bs_e func_8029BD90(void) { return D_80364650[func_8029BAF0()].state_id; } +//drone_look_exit_state enum bs_e func_8029BDBC(void) { return D_80364624[func_8029BAF0()]; } @@ -839,7 +840,7 @@ s32 func_8029C9C0(s32 arg0){ arg0 = BS_BBARGE; if(func_80294F78()) - arg0 = func_802926C0(); + arg0 = badrone_look(); if(player_isSliding()) arg0 = BS_SLIDE; @@ -849,7 +850,7 @@ s32 func_8029C9C0(s32 arg0){ s32 func_8029CA94(s32 arg0){ if(miscflag_isTrue(0x19)) - arg0 = func_80292738(); + arg0 = badrone_transform(); if(miscflag_isTrue(0x1A)) arg0 = (player_getTransformation() == TRANSFORM_6_BEE) ? 0x46 : BS_34_JIG_NOTEDOOR; diff --git a/src/core2/code_39D0.c b/src/core2/code_39D0.c index bd29d94a..bf12a816 100644 --- a/src/core2/code_39D0.c +++ b/src/core2/code_39D0.c @@ -238,7 +238,7 @@ bool func_8028B424(void){ if (func_8028B2E8()) { return FALSE; } - if (!func_802931DC(&sp1C)) { + if (!bafalldamage_get_damage(&sp1C)) { return FALSE; } return TRUE; diff --git a/src/core2/code_6B30.c b/src/core2/code_6B30.c index 0c0d2bff..1a4e242a 100644 --- a/src/core2/code_6B30.c +++ b/src/core2/code_6B30.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/carry.h" #include "core2/ba/physics.h" extern Actor *func_8032813C(enum actor_e, f32[3], s32); @@ -94,7 +95,7 @@ bool func_8028DD60(enum actor_e actor_id, Actor **arg1){ Actor *actor; m1 = (*arg1)->marker; - m2 = carriedobj_getMarker(); + m2 = bacarry_get_marker(); if(m2){ actor = marker_getActor(m2); } @@ -117,7 +118,7 @@ void func_8028DE0C(enum actor_e actor_id){ baModel_getPosition(sp20); actor = func_8032813C(actor_id, sp20, (s32) yaw_get()); actor->unk138_22 = TRUE; - func_802948F8(actor->marker); + bacarry_set_marker(actor->marker); bs_setState(BS_3A_CARRY_IDLE); } @@ -125,13 +126,13 @@ void func_8028DE6C(enum actor_e actor_id){ ActorMarker *marker; Actor *actor; - marker = carriedobj_getMarker(); + marker = bacarry_get_marker(); if(marker){ actor = marker_getActor(marker); } if(marker && actor->modelCacheIndex == actor_id){ - func_802948F8(marker); + bacarry_set_marker(marker); } else{ __spawnQueue_add_1((GenFunction_1)func_8028DE0C, baMarker_getCarriedObjectActorId()); @@ -153,12 +154,12 @@ void func_8028DF48(enum actor_e actor_id){ ActorMarker *marker; Actor* actor; - marker = carriedobj_getMarker(); + marker = bacarry_get_marker(); if(marker) actor = marker_getActor(marker); if(marker && actor->modelCacheIndex == actor_id){ - func_802948E0(); + bacarry_reset_marker(); } item_dec(carriedobj_actorId2ItemId(actor_id)); } diff --git a/src/core2/code_7060.c b/src/core2/code_7060.c index 98a2388d..5da4b72a 100644 --- a/src/core2/code_7060.c +++ b/src/core2/code_7060.c @@ -5,14 +5,13 @@ #include "prop.h" #include "enums.h" +#include "core2/ba/carry.h" +#include "core2/ba/drone.h" #include "core2/ba/physics.h" - extern bool player_isInHorizontalRadius(f32[3], f32); extern bool player_isInVerticalRange(f32[3], f32); -extern enum bs_e func_80292658(f32 arg0[3], f32 arg1, void(*arg2)(ActorMarker *), ActorMarker *arg3); extern void miscflag_clear(s32); -extern void func_80294924(f32, f32); extern void func_80295A8C(void); extern void climbSet(f32[3], f32[3], f32, u32); extern void func_80296C90(f32); @@ -148,7 +147,7 @@ void func_8028E0F0(s32 arg0, s32 arg1[3]) { func_8028E060(arg0, &sp6C); yaw_setIdeal((f32) sp6C); yaw_applyIdeal(); - bs_setState(func_80292658(&sp7C, 1.0f, func_8028E0B0, NULL)); + bs_setState(badrone_goto(sp7C, 1.0f, func_8028E0B0, NULL)); return; } func_8028F85C(&sp7C); @@ -285,13 +284,13 @@ void func_8028E84C(f32 arg0[3]){ } ActorMarker *func_8028E86C(void){ - return carriedobj_getMarker(); + return bacarry_get_marker(); } -enum marker_e carriedObj_getMarkerId(void){ +enum marker_e bacarry_get_markerId(void){ ActorMarker *marker; - marker = carriedobj_getMarker(); + marker = bacarry_get_marker(); if(marker){ return marker->unk14_20; } @@ -302,7 +301,7 @@ enum actor_e carriedObj_getActorId(void){ ActorMarker *marker; Actor *actor; - marker = carriedobj_getMarker(); + marker = bacarry_get_marker(); if(marker != NULL){ actor = marker_getActor(marker); @@ -680,7 +679,7 @@ void ability_unlock(enum ability_e uid){ } void func_8028F3D8(f32 arg0[3], f32 arg1, void(*arg2)(ActorMarker *), ActorMarker *arg3){ - bs_setState(func_80292658(arg0, arg1, arg2, arg3)); + bs_setState(badrone_goto(arg0, arg1, arg2, arg3)); } void func_8028F408(f32 arg0[3]){ @@ -801,7 +800,7 @@ void func_8028F7C8(bool arg0){ } void func_8028F7D4(f32 arg0, f32 arg1){ - func_80294924(arg0, arg1); + bacarry_set_offsets(arg0, arg1); } void func_8028F7F4(s32 arg0, s32 arg1){} @@ -904,7 +903,7 @@ void func_8028FAEC(f32 rotation[3]){ } void func_8028FB28(void){ - func_802948E0(); + bacarry_reset_marker(); } void func_8028FB48(u32 mask){ diff --git a/src/core2/code_B650.c b/src/core2/code_B650.c deleted file mode 100644 index 3821af4e..00000000 --- a/src/core2/code_B650.c +++ /dev/null @@ -1,75 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -/* .bss */ -struct { - u8 unk0; - u8 pad1[3]; - f32 unk4; - f32 unk8[3]; - void (*unk14)(ActorMarker *); - ActorMarker *unk18; -}D_8037C160; - -/* .code */ -void func_802925E0(s32 arg0){ - D_8037C160.unk0 = arg0; -} - -s32 func_802925EC(void){ - return D_8037C160.unk0; -} - -void func_802925F8(f32 arg0[3], f32 *arg1){ - ml_vec3f_copy(arg0, D_8037C160.unk8); - *arg1 = D_8037C160.unk4; -} - -enum bs_e func_80292630(void){ - func_802925E0(5); - return func_8029BD90(); -} - -enum bs_e func_80292658(f32 arg0[3], f32 arg1, void (*arg2)(ActorMarker *), ActorMarker *arg3){ - ml_vec3f_copy(D_8037C160.unk8, arg0); - D_8037C160.unk4 = arg1; - D_8037C160.unk14 = arg2; - D_8037C160.unk18 = arg3; - func_802925E0(1); - return func_8029BD90(); -} - -enum bs_e func_802926C0(void){ - func_802925E0(2); - return func_8029BD90(); -} - -enum bs_e func_802926E8(void){ - func_802925E0(0x3); - return func_8029BD90(); -} - -enum bs_e func_80292710(void){ - func_802925E0(0x6); - return func_8029BD90(); -} - -enum bs_e func_80292738(void){ - miscflag_clear(0x19); - func_802925E0(0x4); - return func_8029BD90(); -} - -void func_80292768(void){ - if(D_8037C160.unk14){ - D_8037C160.unk14(D_8037C160.unk18); - } -} - -void func_8029279C(void){ - D_8037C160.unk0 = 0; - D_8037C160.unk14 = 0; - D_8037C160.unk4 = 0.1f; - ml_vec3f_clear(D_8037C160.unk8); -} diff --git a/src/core2/code_C0E0.c b/src/core2/code_C0E0.c deleted file mode 100644 index 3598af51..00000000 --- a/src/core2/code_C0E0.c +++ /dev/null @@ -1,142 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -typedef struct { - s32 unk0; - s32 unk4; -} struct_C0E0; - -typedef struct{ - s16 unk0; - u8 unk2; - u8 unk3; -} struct_C0E0_1; - -typedef struct{ - u8 pad0[0xC]; - struct_C0E0_1 unkC[]; -} struct_C0E0_2; - -void func_80293350(void); - -/* .data */ -struct_C0E0_2 D_803637F0 ={ - { 0x03, 0xE8, 0x00, 0x00, - 0x05, 0xDC, 0x00, 0x00, - 0x07, 0xD0, 0x00, 0x00 - }, - { - {7000, 8, 2}, - {6000, 7, 1}, - {5000, 6, 1}, - {4000, 5, 1}, - {3000, 4, 1}, - {2000, 3, 1}, - {1000, 2, 1}, - {0, 1, 1}, - {-1, 0, 0} - }, -}; - -/* .bss */ -f32 D_8037C1B0[3]; -u8 D_8037C1BC; -struct_C0E0 D_8037C1C0; - -/* .code */ -s32 func_80293070(struct_C0E0 *arg0, s32 arg1, struct_C0E0_2 *arg2){ - struct_C0E0_1 *iPtr; - for(iPtr = arg2->unkC; iPtr->unk0 >= 0; iPtr++){ - if(iPtr->unk0 + 1000 < arg1){ - arg0->unk0 = iPtr->unk2; - return iPtr->unk3; - } - } - return 0; -} - -s32 func_802930C0(struct_C0E0 *arg0, s32 arg1){ - arg0->unk0 = 0; - if(arg1 < 0) - return 0; - else{ - switch(bsStoredState_getTransformation()){ - case TRANSFORM_2_TERMITE: //L80293110 - return func_80293070(arg0, arg1, &D_803637F0); - case TRANSFORM_3_PUMPKIN: //L80293124 - return func_80293070(arg0, arg1, &D_803637F0); - case TRANSFORM_5_CROC: //L80293138 - return func_80293070(arg0, arg1, &D_803637F0); - case TRANSFORM_4_WALRUS: //L8029314C - return func_80293070(arg0, arg1, &D_803637F0); - case TRANSFORM_6_BEE: //L80293160 - return func_80293070(arg0, arg1, &D_803637F0); - default: - return func_80293070(arg0, arg1, &D_803637F0); - break; - } - } -} - -void func_80293190(void){ - f32 sp1C[3]; - s32 temp_a1; - - player_getPosition(sp1C); - temp_a1 = D_8037C1B0[1] - sp1C[1]; - D_8037C1C0.unk4 = func_802930C0(&D_8037C1C0, temp_a1); -} - -s32 func_802931DC(s32 *arg0){ - *arg0 = D_8037C1C0.unk0; - return D_8037C1C0.unk4; -} - -f32 func_802931F4(void){ - f32 sp1C[3]; - s32 temp_v0; - - player_getPosition(sp1C); - temp_v0 = D_8037C1B0[1] - sp1C[1]; - return temp_v0; -} - -s32 func_80293234(void){ - return D_8037C1BC; -} - -void func_80293240(s32 arg0){ - D_8037C1BC = arg0; - if(D_8037C1BC == 2 || D_8037C1BC == 3) - func_80293350(); -} - -void func_80293284(f32 arg0[3]){ - ml_vec3f_copy(D_8037C1B0, arg0); -} - -void func_802932AC(void){ - _player_getPosition(D_8037C1B0); - D_8037C1BC = 0; - func_80293240(1); - D_8037C1C0.unk0 = 0; - D_8037C1C0.unk4 = 0; -} - -void func_802932EC(void){ - s32 sp1C; - sp1C = func_8028ECAC(); - if(func_8028B2E8() || (func_8028EE84() != BSWATERGROUP_0_NONE) || sp1C == BSGROUP_A_FLYING){ - func_80293350(); - func_80293240(1); - } - func_80293190(); -} - -void func_80293350(void){ - f32 sp1C[3]; - - _player_getPosition(sp1C); - func_80293284(sp1C); -} diff --git a/src/core2/code_D800.c b/src/core2/code_D800.c deleted file mode 100644 index 1d3024ac..00000000 --- a/src/core2/code_D800.c +++ /dev/null @@ -1,79 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -#include "prop.h" - - -void func_80294924(f32 arg0, f32 arg1); - -/* .bss */ -struct { - f32 unk0; - f32 unk4; -} D_8037C290; -ActorMarker* D_8037C298; -u8 D_8037C29C; - -/* .code */ -void func_80294790(void){ - D_8037C298 = NULL; - D_8037C29C = 0; - func_80294924(0.0f, 0.0f); -} - -void func_802947C4(void){} - -void func_802947CC(ActorMarker *marker, f32 arg1[3], f32 arg2[3]){ - Actor * actor = marker_getActor(marker); - if(actor->unk138_22){ - actor->position_x = arg1[0]; - actor->position_y = arg1[1]; - actor->position_z = arg1[2]; - - actor->yaw = arg2[1]; - } -} - -void func_80294828(void){ - f32 banjoPos[3]; - f32 banjoRot[3]; - - - player_getRotation(banjoRot); - baModel_getPosition(banjoPos); - banjoRot[1] = mlNormalizeAngle(banjoRot[1] + D_8037C290.unk4); - banjoPos[1] += D_8037C290.unk0; - func_802947CC(D_8037C298, banjoPos, banjoRot); -} - -int func_80294890(void){ - if(D_8037C298){ - if(D_8037C29C == 0){ - D_8037C298 = NULL; - } - else{ - func_80294828(); - D_8037C29C = 0; - } - } -} - -void func_802948E0(void){ - D_8037C298 = NULL; -} - -ActorMarker *carriedobj_getMarker(void){ - return D_8037C298; -} - -void func_802948F8(ActorMarker *arg0){ - D_8037C298 = arg0; - func_80294828(); - D_8037C29C = 1; -} - -void func_80294924(f32 arg0, f32 arg1){ - D_8037C290.unk0 = arg0; - D_8037C290.unk4 = arg1; -} diff --git a/src/core2/code_E910.c b/src/core2/code_E910.c index 6ecde024..7fb7d534 100644 --- a/src/core2/code_E910.c +++ b/src/core2/code_E910.c @@ -189,8 +189,8 @@ void func_80295914(void){ func_802983F0(); snacker_reset(); func_80291910(); - func_8029279C(); - func_802932AC(); + badrone_init(); + bafalldamage_init(); miscflag_clearAll(); func_8028B6FC(); func_80291590(); @@ -217,7 +217,7 @@ void func_80295914(void){ func_80290664(); stateTimer_init(); eggShatter_init(); - func_80294790(); + bacarry_init(); func_80293DA4(); baAnim_init(); baModel_reset(); @@ -234,7 +234,7 @@ void func_80295A8C(void){ stateTimer_set(STATE_TIMER_2_LONGLEG, bsStoredState_getLongLegTimer()); stateTimer_set(STATE_TIMER_3_TURBO_TALON, bsStoredState_getTurboTimer()); if(func_8028ADB4()) - bs_setState(func_80292630()); + bs_setState(badrone_enter()); else bs_setState(bs_getIdleState()); @@ -264,7 +264,7 @@ void func_80295B04(void){ baModel_free(); baAnim_free(); func_80293E88(); - func_802947C4(); + bacarry_end(); func_80299A20(); func_8029A54C(); func_8029ADA8(); @@ -289,7 +289,7 @@ void func_80295C14(void){ bs_updateState(); baphysics_update(); func_8029858C(); - func_802932EC(); + bafalldamage_update(); func_80293F0C(); pitch_update(); roll_update(); @@ -304,7 +304,7 @@ void func_80295C14(void){ baModel_update(); func_8029842C(); baMarker_update(); - func_80294890(); + bacarry_update(); func_8028A8D0(); func_8028B71C(); func_8029D968(); diff --git a/src/core2/code_EF50.c b/src/core2/code_EF50.c index e344f9bf..62337482 100644 --- a/src/core2/code_EF50.c +++ b/src/core2/code_EF50.c @@ -301,7 +301,7 @@ void func_80296608(void){ case BS_INTR_A: //L8029666C sp2C = 2; if(func_8028B2E8()){ - next_state = func_80292738(); + next_state = badrone_transform(); } else{ miscflag_set(0x19); @@ -429,7 +429,7 @@ void func_80296608(void){ sp2C = 2; break; case BS_INTR_34: //L802969A4 - next_state = func_802926E8(); + next_state = badrone_802926E8(); sp2C = 2; break; case BS_INTR_27_BANJO_SLED: //L802969BC @@ -509,7 +509,7 @@ void func_80296608(void){ sp2C = 2; break; case BS_INTR_37: //L80296BB4 - next_state = func_80292710(); + next_state = badrone_vanish(); sp2C = 2; break; case BS_INTR_2A: //L80296BCC From a3648a5084bb6cadf72655b22ccb2f169f12c54a Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Sat, 22 Jun 2024 18:19:02 -0500 Subject: [PATCH 11/38] func_803083B0 matched --- README.md | 2 +- progress/progress_core2.svg | 6 ++-- progress/progress_total.svg | 4 +-- src/core2/ch/badShad.c | 13 +++---- src/core2/code_3B2C0.c | 72 ++++++++++++++++++------------------- src/core2/code_7AF80.c | 16 +++------ src/core2/spawnqueue.c | 4 +-- 7 files changed, 56 insertions(+), 61 deletions(-) diff --git a/README.md b/README.md index 0cc737e6..df08d5b9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (99.1612%) +# banjo (99.1816%) diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index d6610507..1c70a52e 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ core2 - 98.5381% - 98.5381% + 98.5735% + 98.5735% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index d401656e..99849367 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 99.1612% - 99.1612% + 99.1816% + 99.1816% \ No newline at end of file diff --git a/src/core2/ch/badShad.c b/src/core2/ch/badShad.c index 4c1a8c7f..20b9469c 100644 --- a/src/core2/ch/badShad.c +++ b/src/core2/ch/badShad.c @@ -4,15 +4,15 @@ extern void __spawnQueue_add_2(void (*)(s32, s32), s32, s32); -Actor *func_802D6F48(ActorMarker *this, Gfx **gdl, Mtx **mptr, Vtx **arg3); -void func_802D6EA0(Actor *this); +Actor *chBadShad_draw(ActorMarker *this, Gfx **gdl, Mtx **mptr, Vtx **arg3); +void chBadShad_update(Actor *this); void func_802D729C(Actor *actor, f32 arg1); /* .data */ -ActorInfo D_80367A50 = { +ActorInfo chBadShad = { 0x9B, 0x108, 0x3BF, 0x1, NULL, - func_802D6EA0, func_80326224, func_802D6F48, + chBadShad_update, func_80326224, chBadShad_draw, 0, 0, 0.0f, 0 }; @@ -21,13 +21,14 @@ f32 D_8037DE10[3]; f32 D_8037DE20[3]; /* .code */ -void func_802D6EA0(Actor *this){ +void chBadShad_update(Actor *this){ s32 iVar1; if(!this->initialized){ this->initialized = 1; this->marker->collidable = 0; } if(!this->despawn_flag && this->unk1C_x < (f32)(func_8023DB5C() - 1) ){ + //unlink if(this->unk104){ marker_getActor(this->unk104)->unk104 = 0; } @@ -35,7 +36,7 @@ void func_802D6EA0(Actor *this){ } } -Actor *func_802D6F48(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ +Actor *chBadShad_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ f32 sp44[3]; f32 sp40; Actor *this = marker_getActorAndRotation(marker, sp44); diff --git a/src/core2/code_3B2C0.c b/src/core2/code_3B2C0.c index 4673124e..dcb3cad2 100644 --- a/src/core2/code_3B2C0.c +++ b/src/core2/code_3B2C0.c @@ -7,63 +7,63 @@ f32 mlDiffDegF(f32, f32); /* .bss */ -f32 D_8037DC20[3]; -f32 D_8037DC30[3]; -f32 D_8037DC3C; -f32 D_8037DC40; -u8 D_8037DC44; +static f32 s_position[3]; +static f32 s_rotation[3]; +static f32 s_time_remaining_s; +static f32 s_duration; +static u8 s_state; /* .code */ void func_802C2250(void){} void func_802C2258(void){ - D_8037DC44 = 0; + s_state = 0; } -void func_802C2264(f32 arg0){ - D_8037DC40 = arg0; - D_8037DC3C = D_8037DC40; - ncDynamicCamera_getPosition(D_8037DC20); - ncDynamicCamera_getRotation(D_8037DC30); - D_8037DC44 = 1; +void func_802C2264(f32 duration){ + s_duration = duration; + s_time_remaining_s = s_duration; + ncDynamicCamera_getPosition(s_position); + ncDynamicCamera_getRotation(s_rotation); + s_state = 1; } void func_802C22B4(void){ - D_8037DC44 = 0; + s_state = 0; } -void func_802C22C0(f32 vp_position[3], f32 vp_rotation[3]){ +void func_802C22C0(f32 target_position[3], f32 target_rotation[3]){ f32 tmpf_1[3]; f32 tmpf_2[3]; f32 tmp; - if(D_8037DC44 == 0) + if(s_state == 0) return; - if(D_8037DC44 == 1){ - ml_vec3f_diff(D_8037DC20, vp_position); - D_8037DC30[0] = mlDiffDegF(D_8037DC30[0], vp_rotation[0]); - D_8037DC30[1] = mlDiffDegF(D_8037DC30[1], vp_rotation[1]); - D_8037DC30[2] = 0.0f; - D_8037DC44 = 2; + if(s_state == 1){ + ml_vec3f_diff(s_position, target_position); + s_rotation[0] = mlDiffDegF(s_rotation[0], target_rotation[0]); + s_rotation[1] = mlDiffDegF(s_rotation[1], target_rotation[1]); + s_rotation[2] = 0.0f; + s_state = 2; } - D_8037DC3C -= time_getDelta(); - if(D_8037DC3C <= 0.0f) - D_8037DC44 = 0; + s_time_remaining_s -= time_getDelta(); + if(s_time_remaining_s <= 0.0f) + s_state = 0; else { - tmp = ml_map_f(D_8037DC3C, 0.0f, D_8037DC40, 0.0f, 1.0f); - ml_vec3f_scale_copy(tmpf_1, D_8037DC20, tmp); - ml_vec3f_scale_copy(tmpf_2, D_8037DC30, tmp); - vp_position[0] += tmpf_1[0]; - vp_position[1] += tmpf_1[1]; - vp_position[2] += tmpf_1[2]; - vp_rotation[0] += tmpf_2[0]; - vp_rotation[1] += tmpf_2[1]; - vp_rotation[2] += tmpf_2[2]; - vp_rotation[0] = mlNormalizeAngle(vp_rotation[0]); - vp_rotation[1] = mlNormalizeAngle(vp_rotation[1]); - vp_rotation[2] = 0.0f; + tmp = ml_map_f(s_time_remaining_s, 0.0f, s_duration, 0.0f, 1.0f); + ml_vec3f_scale_copy(tmpf_1, s_position, tmp); + ml_vec3f_scale_copy(tmpf_2, s_rotation, tmp); + target_position[0] += tmpf_1[0]; + target_position[1] += tmpf_1[1]; + target_position[2] += tmpf_1[2]; + target_rotation[0] += tmpf_2[0]; + target_rotation[1] += tmpf_2[1]; + target_rotation[2] += tmpf_2[2]; + target_rotation[0] = mlNormalizeAngle(target_rotation[0]); + target_rotation[1] = mlNormalizeAngle(target_rotation[1]); + target_rotation[2] = 0.0f; } } diff --git a/src/core2/code_7AF80.c b/src/core2/code_7AF80.c index 73b822b0..be3b9851 100644 --- a/src/core2/code_7AF80.c +++ b/src/core2/code_7AF80.c @@ -127,9 +127,6 @@ s32 D_803820A8[3]; //local static s32 D_803820B4; //local static s32 D_803820B8[0x20]; //ActorProp *, (maybe Prop *) s32 pad_80382138; -s32 D_8038213C; -s32 D_80382140; -s32 D_80382144; @@ -705,6 +702,8 @@ void func_80303D78(ActorMarker *arg0, f32 arg1, UNK_TYPE(s32) arg2) { s32 sp60[3]; s32 sp5C; f32 sp50[3]; + static s32 D_8038213C; + sp5C = 0; sp50[0] = (f32) arg0->propPtr->x; @@ -2193,9 +2192,6 @@ bool func_803082D8(Cube *arg0, s32 *arg1, bool arg2, bool arg3) { return var_a0; } -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_7AF80/func_803083B0.s") -#else s32 func_803083B0(s32 arg0) { s32 var_v0; Cube *var_s0; @@ -2204,14 +2200,13 @@ s32 func_803083B0(s32 arg0) { if (arg0 == -1) { var_s0 = D_80381FA0.cube_list; - D_80382144 = var_s0; D_80382140 = 0; + D_80382144 = var_s0; return 0; } - - var_s0 = D_80382144; - if (D_80382140 < D_80382144->prop2Cnt) { + var_s0 = *(Cube **)&D_80382144; + if (D_80382140 < var_s0->prop2Cnt) { if (D_80381FA0.cube_list && D_80381FA0.cube_list && D_80381FA0.cube_list ); var_v0 = func_803082D8(var_s0, &D_80382140, arg0 >= 0, arg0 & 1); if (D_80382140 != 0) { @@ -2235,7 +2230,6 @@ s32 func_803083B0(s32 arg0) { D_80382144 = var_s0; return var_v0; } -#endif enum actor_e func_803084F0(s32 arg0){ s32 var_v1; diff --git a/src/core2/spawnqueue.c b/src/core2/spawnqueue.c index 7ec16720..853ef798 100644 --- a/src/core2/spawnqueue.c +++ b/src/core2/spawnqueue.c @@ -81,7 +81,7 @@ extern ActorInfo D_80367934; //witch_switch.cc extern ActorInfo D_80367958; //witch_switch.bgs extern ActorInfo D_8036797C; //witch_switch.gv extern ActorInfo D_80367A20; //wading boots -extern ActorInfo D_80367A50; //chbadshad +extern ActorInfo chBadShad; //chbadshad extern ActorInfo D_80367AB0; extern ActorInfo D_80367AD4; extern ActorInfo D_80367AF8; @@ -248,7 +248,7 @@ void spawnQueue_reset(void){ spawnableActorList_add(&D_80367184, actor_new, 0x0000000); spawnableActorList_add(&chExtraLife, actor_new, 0x0200000); //extralife spawnableActorList_add(&D_80365FB0, actor_new, 0x0000004); //shrapnel - spawnableActorList_add(&D_80367A50, actor_new, 0x0000004); //chbadshad + spawnableActorList_add(&chBadShad, actor_new, 0x0000004); //chbadshad spawnableActorList_add(&D_803685A0, actor_new, 0x0000040); //mumbotoken spawnableActorList_add(&D_80367F30, actor_new, 0x0000400); spawnableActorList_add(&chBubble, actor_new, 0x0000004); From 955312954f787ffb9026d5fcb3f6a0e140e8914c Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Sat, 29 Jun 2024 14:38:03 -0500 Subject: [PATCH 12/38] documentation. Include nonmatched functions in README --- decompressed.us.v10.yaml | 6 +- include/core2/anim/sprite.h | 51 +++++++ include/functions.h | 13 +- include/structs.h | 16 -- src/BGS/ch/code_2270.c | 2 +- src/BGS/ch/code_8A60.c | 4 +- src/BGS/ch/croctus.c | 2 +- src/BGS/ch/frogminigame.c | 2 +- src/BGS/ch/mudhut.c | 2 +- src/BGS/ch/pinkegg.c | 2 +- src/BGS/ch/tanktup.c | 2 +- src/BGS/code_3420.c | 4 +- src/CC/ch/tooth.c | 2 +- src/CC/code_1F70.c | 2 +- src/CCW/code_14B0.c | 4 +- src/CCW/code_1B20.c | 2 +- src/CCW/code_4960.c | 2 +- src/CCW/code_5540.c | 2 +- src/CCW/code_950.c | 4 +- src/FP/ch/bearcub.c | 2 +- src/FP/ch/boggy1.c | 2 +- src/FP/ch/wozzasjig.c | 2 +- src/FP/racectrl.c | 4 +- src/FP/sirslushgame.c | 2 +- src/FP/snowmanbuttongame.c | 2 +- src/GV/ch/ancientone.c | 2 +- src/GV/ch/gobi2.c | 2 +- src/GV/ch/gobirock.c | 2 +- src/GV/matchinggame.c | 2 +- src/MM/ch/hut.c | 2 +- src/MM/ch/juju.c | 2 +- src/MM/ch/lmonkey.c | 2 +- src/MM/ch/orangepad.c | 2 +- src/MMM/code_3420.c | 2 +- src/MMM/code_DC0.c | 2 +- src/RBB/ch/anchorctrl.c | 2 +- src/RBB/ch/bossboombox.c | 2 +- src/RBB/ch/cog.c | 22 +-- src/RBB/ch/whistlectrl.c | 2 +- src/TTC/ch/blubber.c | 2 +- src/TTC/ch/treasure.c | 2 +- src/core1/audio/n_csplayer.c | 12 +- src/core1/code_11AC0.c | 2 +- src/core1/code_5650.c | 6 +- src/core1/code_9D30.c | 10 ++ src/core2/anim/sprite.c | 275 +++++++++++++++++++++++++++++++++++ src/core2/ch/badShad.c | 6 +- src/core2/ch/beehive.c | 4 +- src/core2/ch/crab.c | 2 +- src/core2/ch/jinjo.c | 2 +- src/core2/ch/soundsource.c | 4 +- src/core2/code_47BD0.c | 8 +- src/core2/code_5BEB0.c | 2 +- src/core2/code_5C870.c | 12 +- src/core2/code_72B10.c | 4 +- src/core2/code_7AF80.c | 84 +++++------ src/core2/code_85800.c | 29 ++-- src/core2/code_956B0.c | 52 +++---- src/core2/code_9B990.c | 110 +++++++------- src/core2/code_ABC00.c | 126 ++++++++-------- src/core2/code_AD0.c | 156 -------------------- src/core2/code_AD5B0.c | 40 ++--- src/core2/code_AE290.c | 24 +-- src/core2/code_B5E00.c | 61 ++++---- src/core2/code_B6EA0.c | 18 +-- src/core2/code_B6EA0.h | 7 +- src/core2/code_C8760.c | 4 +- src/core2/code_CB610.c | 8 +- src/core2/code_CBD10.c | 18 ++- src/core2/code_CC1E0.c | 19 +-- src/core2/code_CD0A0.c | 7 +- src/core2/code_CD3F0.c | 7 +- src/core2/code_CD6E0.c | 53 +++---- src/core2/code_CECD0.c | 7 +- src/core2/code_CF090.c | 17 ++- src/core2/gc/section.c | 2 +- src/core2/mapModel.c | 4 +- src/core2/timedfuncqueue.c | 2 +- src/lair/code_0.c | 2 +- 79 files changed, 784 insertions(+), 612 deletions(-) create mode 100644 include/core2/anim/sprite.h create mode 100644 src/core2/anim/sprite.c delete mode 100644 src/core2/code_AD0.c diff --git a/decompressed.us.v10.yaml b/decompressed.us.v10.yaml index cc6df50a..fa7e0ea9 100644 --- a/decompressed.us.v10.yaml +++ b/decompressed.us.v10.yaml @@ -501,7 +501,7 @@ segments: follows_vram: core1 subsegments: - [0xF55960, c, animctrl] #DONE - - [0xF56430, c, code_AD0] #DONE + - [0xF56430, c, anim/sprite] #DONE - [0xF56A40, c, animcache] #DONE - [0xF56EB0, c, code_1550] #DONE - [0xF57290, c, code_1930] #DONE @@ -1116,7 +1116,7 @@ segments: - [0x1041CB0, .data, code_DB010] - [0x1042790, .data, code_DC4B0] - [0x10427C0, ".rodata", animctrl] - - [0x10427F0, .rodata, code_AD0] + - [0x10427F0, .rodata, anim/sprite] - [0x1042800, .rodata, code_1930] - [0x1042880, .rodata, ba/anim] - [0x1042890, .rodata, code_3480] @@ -1366,7 +1366,7 @@ segments: - [0x1048450, .rodata, code_DA3A0] - [0x1048460, .rodata, code_DA760] - [0x1048480, .rodata, code_DB010] - - [0x1048560, .bss, code_AD0] + - [0x1048560, .bss, anim/sprite] - [0x1048560, .bss, animcache] - [0x1048560, .bss, code_1550] - [0x1048560, .bss, code_1930] diff --git a/include/core2/anim/sprite.h b/include/core2/anim/sprite.h new file mode 100644 index 00000000..d6427bb1 --- /dev/null +++ b/include/core2/anim/sprite.h @@ -0,0 +1,51 @@ +#ifndef __CORE2_ANIM_SPRITE_H__ +#define __CORE2_ANIM_SPRITE_H__ + +#include + + +typedef struct{ + u8 index; + u8 duration; +} AnimSpriteStep; + +typedef enum { + ANIM_SPRITE_STATE_NONE, + ANIM_SPRITE_STATE_ONCE, + ANIM_SPRITE_STATE_LOOP, + ANIM_SPRITE_STATE_STOPPED +} AnimSpriteState; + +typedef struct{ + AnimSpriteStep *steps; + f32 remaining_time; + f32 speed_multiplier; + u32 step_count:7; //This is the index in the AnimSpriteStep list + u32 current_step:7; //current frame + u32 start_step:7; + u32 current_frame:7; //This is the actual sprite frame + u32 state:2; + u32 unknown:1; + u32 active:1; //active +} AnimSprite; + +void animsprite_init(void); +AnimSprite * animsprite_new(void); +void animsprite_free(AnimSprite *this); +void animsprite_terminate(void); +void animsprite_update(AnimSprite *this); +void animsprite_default(AnimSprite *this); +void animsprite_loop(AnimSprite *this); +void animsprite_set_steps(AnimSprite *this, AnimSpriteStep *step_list, s32 size); +void animsprite_set_state(AnimSprite *this, AnimSpriteState step); +void animsprite_set_unknown(AnimSprite *this, s32 value); +void animsprite_set_frame(AnimSprite *this, s32 frame_index); +void animsprite_set_speed(AnimSprite *this, f32 speed); +void animsprite_set_start_step(AnimSprite *this, s32 step); +s32 animsprite_get_frame(AnimSprite *this); +AnimSpriteState animsprite_get_current_state(AnimSprite *this); +s32 animsprite_get_unknown(AnimSprite *this); +f32 animsprite_get_speed(AnimSprite *this); +int animsprite_is_stopped(AnimSprite *this); +int animsprite_is_at_step(AnimSprite *this, s32 frame); +#endif diff --git a/include/functions.h b/include/functions.h index 13ab48d5..39a82013 100644 --- a/include/functions.h +++ b/include/functions.h @@ -162,7 +162,7 @@ Actor *func_802C8C04(s32 position[3], s32 yaw, ActorInfo* actorInfo, u32 flags); Actor *marker_getActor(ActorMarker *); f32 time_getDelta(void); -void jiggySpawn(enum jiggy_e jiggy_id, f32 pos[3]); +void jiggy_spawn(enum jiggy_e jiggy_id, f32 pos[3]); struct3s *func_802F8264(s32 arg0); struct6s *func_802F8BE0(s32 arg0); @@ -276,13 +276,6 @@ void comusic_8025AB44(enum comusic_e comusic_id, s32 arg1, s32 arg2); f32 cosf(f32); -struct54s * func_80287CA8(void); -void func_80287F50(struct54s *, struct53s *, s32); -void func_80287FD0(struct54s *, f32); -void func_80287F7C(struct54s *arg0, s32 arg1); -void func_80287F98(struct54s *arg0, s32 arg1); -void func_80287FDC(struct54s *arg0, s32 arg1); - void baanim_setDurationRange(f32, f32); @@ -395,7 +388,7 @@ u8 func_8030D90C(void); void sfxsource_setSfxId(u8 indx, enum sfx_e uid); void func_8030DBB4(u8, f32); void func_8030DD14(u8, int); -void func_8030DF68(u8, f32[3]); +void sfxsource_set_position(u8, f32[3]); void func_8030DFF0(u8, s32); void func_8030E04C(u8, f32, f32, f32); void func_8030E0FC(u8, f32, f32, f32); @@ -515,7 +508,7 @@ Actor *actorArray_findActorFromActorId(enum actor_e); f32 func_8038A6B8(ActorMarker *); void *defrag_asset(void *); void ml_interpolate_vec3f(f32 [3], f32 [3], f32 [3], f32); -void func_8030DEB4(u8, f32, f32); +void sfxsource_set_fade_distances(u8, f32, f32); void func_8030DB04(u8, s32, f32 position[3], f32, f32); void func_80258A4C(f32 [3], f32, f32 [3], f32 *, f32 *, f32 *); diff --git a/include/structs.h b/include/structs.h index c3f12473..14c19aab 100644 --- a/include/structs.h +++ b/include/structs.h @@ -504,23 +504,7 @@ typedef struct{ u8 pad4[8]; }struct52s; -typedef struct{ - u8 unk0; - u8 unk1; -} struct53s; -typedef struct{ - struct53s *unk0; - f32 unk4; - f32 unk8; - u32 unkC_31:7; - u32 unkC_24:7; - u32 unkC_17:7; - u32 unkC_10:7; - u32 unkC_3:2; - u32 unkC_1:1; - u32 unkC_0:1; -} struct54s; typedef struct{ s32 unk0; diff --git a/src/BGS/ch/code_2270.c b/src/BGS/ch/code_2270.c index 036df038..d778bbee 100644 --- a/src/BGS/ch/code_2270.c +++ b/src/BGS/ch/code_2270.c @@ -38,7 +38,7 @@ void BGS_func_80388660(ActorMarker *this){ } void BGS_func_8038868C(void){ - jiggySpawn(JIGGY_27_BGS_TIPTUP, D_80390868); + jiggy_spawn(JIGGY_27_BGS_TIPTUP, D_80390868); } void func_803886B4(ActorMarker *this, s32 arg1){ diff --git a/src/BGS/ch/code_8A60.c b/src/BGS/ch/code_8A60.c index 670920e1..8e8218fd 100644 --- a/src/BGS/ch/code_8A60.c +++ b/src/BGS/ch/code_8A60.c @@ -25,7 +25,7 @@ void func_8038EE50(void){ f32 sp24[3]; if(nodeProp_findPositionFromActorId(0x14d, sp24)){ - jiggySpawn(JIGGY_20_BGS_ELEVATED_WALKWAY, sp24); + jiggy_spawn(JIGGY_20_BGS_ELEVATED_WALKWAY, sp24); __spawnQueue_add_4((GenFunction_4)func_802C4140, ACTOR_4C_STEAM, reinterpret_cast(s32, sp24[0]), reinterpret_cast(s32, sp24[1]), @@ -68,7 +68,7 @@ void func_8038F018(void){ f32 sp24[3]; if(nodeProp_findPositionFromActorId(0x1fc, sp24)){ - jiggySpawn(JIGGY_25_BGS_MAZE, sp24); + jiggy_spawn(JIGGY_25_BGS_MAZE, sp24); __spawnQueue_add_4((GenFunction_4)func_802C4140, ACTOR_4C_STEAM, reinterpret_cast(s32, sp24[0]), reinterpret_cast(s32, sp24[1]), diff --git a/src/BGS/ch/croctus.c b/src/BGS/ch/croctus.c index ca653add..0bffffd5 100644 --- a/src/BGS/ch/croctus.c +++ b/src/BGS/ch/croctus.c @@ -65,7 +65,7 @@ void *func_80387D90(ActorMarker * arg0){ spawnPos[2] = this->position_z; marker->propPtr->unk8_3 = 0; func_802BAFE4(0x19); - jiggySpawn(JIGGY_22_CROCTUS, spawnPos); + jiggy_spawn(JIGGY_22_CROCTUS, spawnPos); func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7FFF); } diff --git a/src/BGS/ch/frogminigame.c b/src/BGS/ch/frogminigame.c index f42acb3b..410cc4fe 100644 --- a/src/BGS/ch/frogminigame.c +++ b/src/BGS/ch/frogminigame.c @@ -22,7 +22,7 @@ u8 D_80391240[4]; /* .code */ static void __chFrogMinigame_spawnJiggy(void){ static f32 D_80390AD4[3] = {1985.0f, 200.0f, -1386.0f}; - jiggySpawn(JIGGY_24_BGS_FLIBBITS, D_80390AD4); + jiggy_spawn(JIGGY_24_BGS_FLIBBITS, D_80390AD4); } static void __chFrogMinigame_textCallback(ActorMarker *marker, enum asset_e text_id, s32 arg2){ diff --git a/src/BGS/ch/mudhut.c b/src/BGS/ch/mudhut.c index 995c20db..8b960673 100644 --- a/src/BGS/ch/mudhut.c +++ b/src/BGS/ch/mudhut.c @@ -111,7 +111,7 @@ void chmudhut_update(Actor *this){ reinterpret_cast(s32, diffPos[2]) ); } else { - jiggySpawn(JIGGY_23_BGS_HUTS, diffPos); + jiggy_spawn(JIGGY_23_BGS_HUTS, diffPos); } } break; diff --git a/src/BGS/ch/pinkegg.c b/src/BGS/ch/pinkegg.c index 9e305c61..a455aabb 100644 --- a/src/BGS/ch/pinkegg.c +++ b/src/BGS/ch/pinkegg.c @@ -92,7 +92,7 @@ void chpinkegg_collision(ActorMarker *this, ActorMarker *other_marker){ if(D_803906C4[(tmp = (ActorLocal_PinkEgg *) &thisActor->local)->unk0] != 0){ __spawnQueue_add_2(chpinkegg_spawn_next, thisActor->marker, tmp->unk0); } else { - jiggySpawn(JIGGY_21_BGS_PINKEGG, thisActor->position); + jiggy_spawn(JIGGY_21_BGS_PINKEGG, thisActor->position); func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); } } diff --git a/src/BGS/ch/tanktup.c b/src/BGS/ch/tanktup.c index be84802e..005ea00c 100644 --- a/src/BGS/ch/tanktup.c +++ b/src/BGS/ch/tanktup.c @@ -207,7 +207,7 @@ void func_8038F6A4(Actor *this) func_8034A174(this->marker->unk44, 6, sp34); func_802C8F70(this->yaw); sp34[1] -= 125.0f; - jiggySpawn(JIGGY_26_BGS_TANKTUP, sp34); + jiggy_spawn(JIGGY_26_BGS_TANKTUP, sp34); } if (actor_animationIsAt(this, 0.9f) != 0) { diff --git a/src/BGS/code_3420.c b/src/BGS/code_3420.c index a3ce6840..0b96adf0 100644 --- a/src/BGS/code_3420.c +++ b/src/BGS/code_3420.c @@ -74,7 +74,7 @@ void BGS_func_80389850(Actor *this, s32 arg1) { sp94[1] = vile->position[1] + sp7C[1]; sp94[2] = vile->position[2] + sp7C[2]; func_802C8F70(vile->yaw); - jiggySpawn(JIGGY_28_BGS_MR_VILE, sp94); + jiggy_spawn(JIGGY_28_BGS_MR_VILE, sp94); } else { sp7C[0] = 0.0f - vile->position[0]; sp7C[1] = 0.0f; @@ -85,7 +85,7 @@ void BGS_func_80389850(Actor *this, s32 arg1) { sp94[1] = vile->position[1] + sp7C[1]; sp94[2] = vile->position[2] + sp7C[2]; func_802C8F70(func_8025715C(sp7C[0], sp7C[2])); - jiggySpawn(JIGGY_28_BGS_MR_VILE, sp94); + jiggy_spawn(JIGGY_28_BGS_MR_VILE, sp94); } } for(var_s0 = 2; var_s0 != 0x3C; var_s0++){ diff --git a/src/CC/ch/tooth.c b/src/CC/ch/tooth.c index 3fba9968..91d2148a 100644 --- a/src/CC/ch/tooth.c +++ b/src/CC/ch/tooth.c @@ -84,7 +84,7 @@ extern void chTooth_update(Actor * this){ player_getPosition(sp24); if(sp24[0] < 0.0f && 5400.0f < sp24[2]){ func_80333334(local->unk0->jiggy_id); - jiggySpawn(local->unk0->jiggy_id, local->unk0->jiggy_position); + jiggy_spawn(local->unk0->jiggy_id, local->unk0->jiggy_position); } else{//L8038774C sp24[0] = local->unk0->jiggy_position[0]; diff --git a/src/CC/code_1F70.c b/src/CC/code_1F70.c index d051be8b..54508c3a 100644 --- a/src/CC/code_1F70.c +++ b/src/CC/code_1F70.c @@ -110,7 +110,7 @@ void func_80388518(s32 arg0){ } void func_80388664(void) { - jiggySpawn(JIGGY_17_CC_CLANKER_RAISED, D_80389C00); + jiggy_spawn(JIGGY_17_CC_CLANKER_RAISED, D_80389C00); } void CC_func_8038868C(void) { diff --git a/src/CCW/code_14B0.c b/src/CCW/code_14B0.c index b4b49855..58c67841 100644 --- a/src/CCW/code_14B0.c +++ b/src/CCW/code_14B0.c @@ -114,8 +114,8 @@ void CCW_func_80387A40(Actor *this) { if(this->position[0]); func_8030DBFC(local->unk0, 0.8f, 0.9f, 0.05f); - func_8030DEB4(local->unk0, 500.0f, 1500.0f); - func_8030DF68(local->unk0, this->position); + sfxsource_set_fade_distances(local->unk0, 500.0f, 1500.0f); + sfxsource_set_position(local->unk0, this->position); func_8030E2C4(local->unk0); sfxsource_setSampleRate(local->unk0, 2000.0f + 8000.0f*(gu_sqrtf(local->unk18[0]*local->unk18[0] + local->unk18[1]*local->unk18[1] + local->unk18[2]*local->unk18[2])/ local->unk8)); if (!mapSpecificFlags_get(local->unk4->unk2)) { diff --git a/src/CCW/code_1B20.c b/src/CCW/code_1B20.c index 990dbc5d..0e2eb0dd 100644 --- a/src/CCW/code_1B20.c +++ b/src/CCW/code_1B20.c @@ -33,7 +33,7 @@ f32 D_8038EC94[3] = {200.0f, 2120.0f, -5570.0f}; /* .code */ void func_80387F10() { - jiggySpawn(JIGGY_4D_CCW_FLOWER, D_8038EC94); + jiggy_spawn(JIGGY_4D_CCW_FLOWER, D_8038EC94); } void func_80387F38(ActorMarker* marker, s32 arg1) { diff --git a/src/CCW/code_4960.c b/src/CCW/code_4960.c index 5f8f65a8..be2d5c08 100644 --- a/src/CCW/code_4960.c +++ b/src/CCW/code_4960.c @@ -95,7 +95,7 @@ void func_8038AEBC(Actor *this) { func_80326224(this); skeletalAnim_getProgressRange(this->unk148, &sp30, &sp2C); if ((sp30 <= 0.5) && (sp2C >= 0.5)) { - jiggySpawn(JIGGY_49_CCW_EYRIE, this->position); + jiggy_spawn(JIGGY_49_CCW_EYRIE, this->position); } if (skeletalAnim_getLoopCount(this->unk148) > 0) { func_8038AD50(this, 2); diff --git a/src/CCW/code_5540.c b/src/CCW/code_5540.c index 9b4106cb..2f6611cc 100644 --- a/src/CCW/code_5540.c +++ b/src/CCW/code_5540.c @@ -56,7 +56,7 @@ void chnabnut_setState(Actor *this, s32 next_state) { skeletalAnim_set(this->unk148, ASSET_22E_ANIM_NABNUT_STAND, 0.2f, 3.53f); skeletalAnim_setBehavior(this->unk148, SKELETAL_ANIM_1_LOOP); func_802C8F70(this->yaw - 40.0f); - jiggySpawn(JIGGY_4A_CCW_NABNUT, this->position); + jiggy_spawn(JIGGY_4A_CCW_NABNUT, this->position); } if (next_state == NABNUT_STATE_5_EXIT) { diff --git a/src/CCW/code_950.c b/src/CCW/code_950.c index d5c98b88..582aaaed 100644 --- a/src/CCW/code_950.c +++ b/src/CCW/code_950.c @@ -208,8 +208,8 @@ void chwasp_update(Actor *this) { } else { func_8030DBFC(local->unk0, 0.8f, 0.9f, 0.05f); } - func_8030DEB4(local->unk0, 500.0f, 1500.0f); - func_8030DF68(local->unk0, this->position); + sfxsource_set_fade_distances(local->unk0, 500.0f, 1500.0f); + sfxsource_set_position(local->unk0, this->position); func_8030E2C4(local->unk0); sfxsource_setSampleRate(local->unk0, (s32) ((local->unk18 / local->unk14) * 10000.0f)); } diff --git a/src/FP/ch/bearcub.c b/src/FP/ch/bearcub.c index 82298626..2ced0299 100644 --- a/src/FP/ch/bearcub.c +++ b/src/FP/ch/bearcub.c @@ -72,7 +72,7 @@ void func_8038A274(Actor *this){ void func_8038A318(ActorMarker *caller, enum asset_e text_id, s32 arg1){ if(text_id == 0xc19){ func_802BAFE4(0x25); - jiggySpawn(JIGGY_2E_FP_PRESENTS, FP_D_80391E74); + jiggy_spawn(JIGGY_2E_FP_PRESENTS, FP_D_80391E74); func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 32000); func_8025A6EC(COMUSIC_5B_FP_IGLOO_HAPPY, 25000); func_8025A58C(0, 4000); diff --git a/src/FP/ch/boggy1.c b/src/FP/ch/boggy1.c index ba2bff24..d1c4101a 100644 --- a/src/FP/ch/boggy1.c +++ b/src/FP/ch/boggy1.c @@ -73,7 +73,7 @@ void func_803877A8(ActorMarker *caller, enum asset_e text_id, s32 arg2){ Actor *this = marker_getActor(caller); if(arg2 == 1){ - jiggySpawn(JIGGY_2A_FP_BOGGY_1, this->velocity); + jiggy_spawn(JIGGY_2A_FP_BOGGY_1, this->velocity); } else if(arg2 == 2){ subaddie_set_state_with_direction(this, 4, 0.0001f, 1); diff --git a/src/FP/ch/wozzasjig.c b/src/FP/ch/wozzasjig.c index f246ad17..d4d6ab70 100644 --- a/src/FP/ch/wozzasjig.c +++ b/src/FP/ch/wozzasjig.c @@ -75,7 +75,7 @@ void func_8038FF54(Actor *this){ sp40[1] = (f32)(s32)sp40[1]; sp40[2] = (f32)(s32)sp40[2]; func_802C8F70(this->yaw + 90.0f); - jiggySpawn(JIGGY_32_FP_WOZZA, sp40); + jiggy_spawn(JIGGY_32_FP_WOZZA, sp40); levelSpecificFlags_set(0x26, TRUE); marker_despawn(this->marker); } diff --git a/src/FP/racectrl.c b/src/FP/racectrl.c index 00caaac9..7292abe2 100644 --- a/src/FP/racectrl.c +++ b/src/FP/racectrl.c @@ -197,10 +197,10 @@ void func_8038B0F8(void){ void func_8038B130(enum jiggy_e jiggy_id){ if(jiggy_id == JIGGY_2C_FP_BOGGY_3 && !jiggyscore_isCollected(JIGGY_30_FP_BOGGY_2)){ - jiggySpawn(jiggy_id, D_80391F38); + jiggy_spawn(jiggy_id, D_80391F38); } else{ - jiggySpawn(jiggy_id, D_80391F2C); + jiggy_spawn(jiggy_id, D_80391F2C); } } diff --git a/src/FP/sirslushgame.c b/src/FP/sirslushgame.c index cf96cafd..aae2f377 100644 --- a/src/FP/sirslushgame.c +++ b/src/FP/sirslushgame.c @@ -53,7 +53,7 @@ void fp_sirslushgame_update(void){ if(D_80392F30.unk1C){ func_802BAFE4(0x12); - jiggySpawn(JIGGY_31_FP_SIR_SLUSH, D_80392F30.spawn_pos); + jiggy_spawn(JIGGY_31_FP_SIR_SLUSH, D_80392F30.spawn_pos); __spawnQueue_add_4((GenFunction_4)func_802C4140, ACTOR_4C_STEAM, reinterpret_cast(s32, D_80392F30.spawn_pos[0]), reinterpret_cast(s32, D_80392F30.spawn_pos[1]), diff --git a/src/FP/snowmanbuttongame.c b/src/FP/snowmanbuttongame.c index f3738e61..99a0c14c 100644 --- a/src/FP/snowmanbuttongame.c +++ b/src/FP/snowmanbuttongame.c @@ -51,7 +51,7 @@ void fp_snowmanButtonGame_update(void){ if(D_80392F50.unk18){ func_802BAFE4(0x11); - jiggySpawn(JIGGY_2D_FP_SNOWMAN_BUTTONS, D_80392F50.spawn_pos); + jiggy_spawn(JIGGY_2D_FP_SNOWMAN_BUTTONS, D_80392F50.spawn_pos); __spawnQueue_add_4((GenFunction_4)func_802C4140, ACTOR_4C_STEAM, reinterpret_cast(s32, D_80392F50.spawn_pos[0]), reinterpret_cast(s32, D_80392F50.spawn_pos[1]), diff --git a/src/GV/ch/ancientone.c b/src/GV/ch/ancientone.c index e3859bb5..3554ed04 100644 --- a/src/GV/ch/ancientone.c +++ b/src/GV/ch/ancientone.c @@ -88,7 +88,7 @@ void func_803867F4(void){ f32 sp24[3]; func_802BAFE4(4); if(nodeProp_findPositionFromActorId(0x148, sp24)){ - jiggySpawn(JIGGY_46_GV_ANCIENT_ONES, sp24); + jiggy_spawn(JIGGY_46_GV_ANCIENT_ONES, sp24); __spawnQueue_add_4((GenFunction_4)func_802C4140, 0x4C, reinterpret_cast(s32, sp24[0]), reinterpret_cast(s32, sp24[1]), reinterpret_cast(s32, sp24[2])); } } diff --git a/src/GV/ch/gobi2.c b/src/GV/ch/gobi2.c index f319e9e5..d576eaac 100644 --- a/src/GV/ch/gobi2.c +++ b/src/GV/ch/gobi2.c @@ -34,7 +34,7 @@ void func_80387984(ActorMarker *this){ void __chGobi2_spawnJIggy(void){ static f32 jiggy_position[3] = {1150.0f, 1150.0f, 9200.0f}; - jiggySpawn(JIGGY_45_GV_GOBI_2, jiggy_position); + jiggy_spawn(JIGGY_45_GV_GOBI_2, jiggy_position); } void func_803879D4(ActorMarker *this_marker){ diff --git a/src/GV/ch/gobirock.c b/src/GV/ch/gobirock.c index 9632cbdb..64a76f61 100644 --- a/src/GV/ch/gobirock.c +++ b/src/GV/ch/gobirock.c @@ -120,7 +120,7 @@ void chGobiRock_update(Actor *this){ particleEmitter_update(local->unkC); particleEmitter_update(local->unk10); if(ml_timer_update(&local->unk14, sp24)){ - jiggySpawn(JIGGY_44_GV_GOBI_1, jiggy_position); + jiggy_spawn(JIGGY_44_GV_GOBI_1, jiggy_position); func_802BB3DC(0, 60.0f, 0.65f); } if(this->state == 2){ diff --git a/src/GV/matchinggame.c b/src/GV/matchinggame.c index 8fb1cf3b..9631ddc8 100644 --- a/src/GV/matchinggame.c +++ b/src/GV/matchinggame.c @@ -63,7 +63,7 @@ void func_80390218(void *arg0){ void __matchingGame_spawnJIggy(void){ static f32 jiggy_position[3] = {0.0f, 100.0f, 0.0f}; - jiggySpawn(JIGGY_40_GV_MATCHING_GAME, jiggy_position); + jiggy_spawn(JIGGY_40_GV_MATCHING_GAME, jiggy_position); } void __matchingGame_setState(s32 next_state){ diff --git a/src/MM/ch/hut.c b/src/MM/ch/hut.c index 82919a05..338f8b51 100644 --- a/src/MM/ch/hut.c +++ b/src/MM/ch/hut.c @@ -90,7 +90,7 @@ void chhut_update(Actor *this){ __spawnQueue_add_4((GenFunction_4)func_802C4218, D_803898D8[D_8037DCB0], *(s32*)(&sp3C[0]),*(s32*)(&sp3C[1]),*(s32*)(&sp3C[2])); } else{ - jiggySpawn(JIGGY_5_MM_HUTS, sp3C); + jiggy_spawn(JIGGY_5_MM_HUTS, sp3C); } D_8037DCB0 = ( D_8037DCB0 + 1 ) % 6; } diff --git a/src/MM/ch/juju.c b/src/MM/ch/juju.c index bedb8c5b..9600d4ec 100644 --- a/src/MM/ch/juju.c +++ b/src/MM/ch/juju.c @@ -89,7 +89,7 @@ void func_803891E8(s32 x, s32 y, s32 z, s32 yaw){ sp1C[0] = x; sp1C[1] = y + 0x14; sp1C[2] = z; - jiggySpawn(JIGGY_4_MM_JUJU, sp1C); + jiggy_spawn(JIGGY_4_MM_JUJU, sp1C); } void func_80389244(s32 x, s32 y, s32 z, s32 yaw){ diff --git a/src/MM/ch/lmonkey.c b/src/MM/ch/lmonkey.c index 50313885..098b7ee3 100644 --- a/src/MM/ch/lmonkey.c +++ b/src/MM/ch/lmonkey.c @@ -64,7 +64,7 @@ void MM_func_803883AC(Actor *this){ void __chLMonkey_spawnJiggy(s32 x, s32 y, s32 z){ f32 sp1C[3]; TUPLE_ASSIGN(sp1C, x, y, z); - jiggySpawn(JIGGY_9_MM_CHIMPY, sp1C); + jiggy_spawn(JIGGY_9_MM_CHIMPY, sp1C); } void __chLMonkey_complete(ActorMarker *marker, enum asset_e arg1, s32 arg2){ diff --git a/src/MM/ch/orangepad.c b/src/MM/ch/orangepad.c index a1178cf5..a63347df 100644 --- a/src/MM/ch/orangepad.c +++ b/src/MM/ch/orangepad.c @@ -24,7 +24,7 @@ void MM_func_803863F0(s32 x, s32 y, s32 z){ TUPLE_ASSIGN(pos, x, y, z); - jiggySpawn(JIGGY_8_MM_ORANGE_PADS, pos); + jiggy_spawn(JIGGY_8_MM_ORANGE_PADS, pos); } void func_80386444(ActorMarker *arg0){ diff --git a/src/MMM/code_3420.c b/src/MMM/code_3420.c index 8b796ea4..8c4eebc3 100644 --- a/src/MMM/code_3420.c +++ b/src/MMM/code_3420.c @@ -163,7 +163,7 @@ void MMM_func_80389810(ActorMarker *caller, enum asset_e text_id, s32 arg2) { } void MMM_func_803898A0() { - jiggySpawn(JIGGY_60_MMM_MOTZHAND, D_8038C1E0); + jiggy_spawn(JIGGY_60_MMM_MOTZHAND, D_8038C1E0); } void MMM_func_803898C8() { diff --git a/src/MMM/code_DC0.c b/src/MMM/code_DC0.c index 8879059b..a1bfcd0a 100644 --- a/src/MMM/code_DC0.c +++ b/src/MMM/code_DC0.c @@ -83,7 +83,7 @@ bool MMM_func_80387340(ActorMarker *marker){ ml_vec3f_copy(sp20, actor->position); sp20[1] += 80.0f; func_8025A70C(COMUSIC_2D_PUZZLE_SOLVED_FANFARE); - jiggySpawn(JIGGY_63_MMM_FLOWER_POTS, sp20); + jiggy_spawn(JIGGY_63_MMM_FLOWER_POTS, sp20); } else{ func_8025A70C(COMUSIC_2B_DING_B); diff --git a/src/RBB/ch/anchorctrl.c b/src/RBB/ch/anchorctrl.c index 825aacd1..c5f87d46 100644 --- a/src/RBB/ch/anchorctrl.c +++ b/src/RBB/ch/anchorctrl.c @@ -31,7 +31,7 @@ void __chAnchorCtrl_spawnJiggy(ActorMarker *marker, s32 arg1, s32 arg2){ static f32 D_80390B34[3] = {-5100.0f, -2550.0f, 1470.0f}; Actor *actor = marker_getActor(marker); - jiggySpawn(JIGGY_53_RBB_SNORKEL, &D_80390B34); + jiggy_spawn(JIGGY_53_RBB_SNORKEL, &D_80390B34); timed_setStaticCameraToNode(0.5f, 0xb); __chAnchorCtrl_setState(actor, 3); } diff --git a/src/RBB/ch/bossboombox.c b/src/RBB/ch/bossboombox.c index b4a3417d..c8e006c2 100644 --- a/src/RBB/ch/bossboombox.c +++ b/src/RBB/ch/bossboombox.c @@ -198,7 +198,7 @@ void chbossboombox_respawnJiggy(s32 position_x, s32 position_y, s32 position_z){ D_80391288[0] = (f32)position_x; D_80391288[1] = (f32)(position_y + 0x28); D_80391288[2] = (f32)position_z; - jiggySpawn(JIGGY_56_RBB_BOSS_BOOM_BOX, &D_80391288); + jiggy_spawn(JIGGY_56_RBB_BOSS_BOOM_BOX, &D_80391288); } void func_8038CA70(Actor *this, f32(*arg1)[3]){ diff --git a/src/RBB/ch/cog.c b/src/RBB/ch/cog.c index 4ab3b568..d164470c 100644 --- a/src/RBB/ch/cog.c +++ b/src/RBB/ch/cog.c @@ -4,7 +4,7 @@ /* typedefs and declarations */ typedef struct { - u8 unk0; + u8 sfxsource_index; }ActorLocal_RBB_27E0; void func_80388C20(Actor *this); @@ -38,7 +38,7 @@ void func_80388BD0(Actor *this, s32 arg1){ void func_80388BE8(Actor *actor){ ActorLocal_RBB_27E0 *local = (ActorLocal_RBB_27E0 *)&actor->local; if(actor->modelCacheIndex == 0x17b){ - func_8030DA44(local->unk0); + func_8030DA44(local->sfxsource_index); } } @@ -51,14 +51,14 @@ void func_80388C20(Actor *this){ this->marker->unk30 = func_80388BE8; this->unk16C_4 = 1; if(this->modelCacheIndex == 0x17B){ - local->unk0 = func_8030D90C(); - func_8030DEB4(local->unk0, 1000.0f, 2000.0f); - func_8030DF68(local->unk0, &this->position); - func_8030DBB4(local->unk0, 0.5f); - sfxsource_setSfxId(local->unk0, SFX_9F_GENERATOR_RUNNING); - func_8030DD14(local->unk0, 3); - sfxsource_setSampleRate(local->unk0, 0); - func_8030E2C4(local->unk0); + local->sfxsource_index = func_8030D90C(); + sfxsource_set_fade_distances(local->sfxsource_index, 1000.0f, 2000.0f); + sfxsource_set_position(local->sfxsource_index, &this->position); + func_8030DBB4(local->sfxsource_index, 0.5f); + sfxsource_setSfxId(local->sfxsource_index, SFX_9F_GENERATOR_RUNNING); + func_8030DD14(local->sfxsource_index, 3); + sfxsource_setSampleRate(local->sfxsource_index, 0); + func_8030E2C4(local->sfxsource_index); }//L80388CFC if(this->state == 0){ if(this->modelCacheIndex == 0x17B){ @@ -78,7 +78,7 @@ void func_80388C20(Actor *this){ if(360.0f <= this->roll) this->roll -= 360.0f; if(this->modelCacheIndex == 0x17B){ - func_8030DB04(local->unk0, 0x61a8, &this->position, 1000.0f, 2000.0f); + func_8030DB04(local->sfxsource_index, 25000, &this->position, 1000.0f, 2000.0f); } } } diff --git a/src/RBB/ch/whistlectrl.c b/src/RBB/ch/whistlectrl.c index 97737055..81d5a1a8 100644 --- a/src/RBB/ch/whistlectrl.c +++ b/src/RBB/ch/whistlectrl.c @@ -28,7 +28,7 @@ void __chWhistleCtrl_setState(Actor *actor, s32 arg1){ void __chWhistleCtrl_soundWhistle(void){ func_802C8F70(225.0f); - jiggySpawn(JIGGY_54_RBB_WHISTLE, D_80390A74); + jiggy_spawn(JIGGY_54_RBB_WHISTLE, D_80390A74); } void __chWhistleCtrl_correct(void){ diff --git a/src/TTC/ch/blubber.c b/src/TTC/ch/blubber.c index f004dfa5..e2829a75 100644 --- a/src/TTC/ch/blubber.c +++ b/src/TTC/ch/blubber.c @@ -68,7 +68,7 @@ void func_80387574(ActorMarker *caller, enum asset_e text_id, s32 arg1){ f32 sp24[3]; if(nodeProp_findPositionFromActorId(0x14b, sp24)){ - jiggySpawn(JIGGY_14_TTC_BLUBBER, sp24); + jiggy_spawn(JIGGY_14_TTC_BLUBBER, sp24); __spawnQueue_add_4((GenFunction_4)func_802C4140, ACTOR_4C_STEAM, reinterpret_cast(s32, sp24[0]), reinterpret_cast(s32, sp24[1]), reinterpret_cast(s32, sp24[2])); } } diff --git a/src/TTC/ch/treasure.c b/src/TTC/ch/treasure.c index 32d87422..dab5530f 100644 --- a/src/TTC/ch/treasure.c +++ b/src/TTC/ch/treasure.c @@ -25,7 +25,7 @@ void __chtreasure_die(ActorMarker *marker, ActorMarker *otherMarker){ __spawnQueue_add_4((GenFunction_4) func_802C4140, 0x4C, reinterpret_cast(s32, this->position[0]), reinterpret_cast(s32, this->position[1]), reinterpret_cast(s32, this->position[2])); func_802EE278(this, 3, 0xf, 0x3C, 0.2f, 1.2f); func_803115C4(0xA19); - jiggySpawn(JIGGY_11_TTC_RED_X, this->position); + jiggy_spawn(JIGGY_11_TTC_RED_X, this->position); marker_despawn(marker); } diff --git a/src/core1/audio/n_csplayer.c b/src/core1/audio/n_csplayer.c index 40d5cbd8..5561155c 100644 --- a/src/core1/audio/n_csplayer.c +++ b/src/core1/audio/n_csplayer.c @@ -51,7 +51,7 @@ void __n_seqpReleaseVoice(ALSeqPlayer *seqp, ALVoice *voice, ALMicroTime deltaT * 1 Fine Tuning * 2 Coarse Tuning */ -void func_8025D7C0(ALCSPlayer *seqp); +void __n_CSPPostNextSeqEvent(ALCSPlayer *seqp); static ALMicroTime __n_CSPVoiceHandler(void *node); static void __CSPHandleNextSeqEvent(ALCSPlayer *seqp); @@ -232,7 +232,7 @@ static ALMicroTime __n_CSPVoiceHandler(void *node) { seqp->state = AL_PLAYING; func_80250650(); - func_8025D7C0(seqp); /* seqp must be AL_PLAYING before we call this routine. */ + __n_CSPPostNextSeqEvent(seqp); /* seqp must be AL_PLAYING before we call this routine. */ } break; @@ -344,7 +344,7 @@ static ALMicroTime __n_CSPVoiceHandler(void *node) is no target sequence. sct 11/7/95 */ -void func_8025D7C0(ALCSPlayer *seqp) +void __n_CSPPostNextSeqEvent(ALCSPlayer *seqp) { ALEvent evt; s32 deltaTicks; @@ -383,12 +383,12 @@ __CSPHandleNextSeqEvent(ALCSPlayer *seqp) { case AL_SEQ_MIDI_EVT: __n_CSPHandleMIDIMsg(seqp, &evt); - func_8025D7C0(seqp); + __n_CSPPostNextSeqEvent(seqp); break; case AL_TEMPO_EVT: __CSPHandleMetaMsg(seqp, &evt); - func_8025D7C0(seqp); + __n_CSPPostNextSeqEvent(seqp); break; case AL_SEQ_END_EVT: @@ -400,7 +400,7 @@ __CSPHandleNextSeqEvent(ALCSPlayer *seqp) case AL_TRACK_END: case AL_CSP_LOOPSTART: case AL_CSP_LOOPEND: - func_8025D7C0(seqp); + __n_CSPPostNextSeqEvent(seqp); break; default: diff --git a/src/core1/code_11AC0.c b/src/core1/code_11AC0.c index 62e57610..f2a05573 100644 --- a/src/core1/code_11AC0.c +++ b/src/core1/code_11AC0.c @@ -258,7 +258,7 @@ void musicInstruments_init(void){ func_8024FB8C(); } -ALBank *func_8024F758(void){ +ALBank *music_get_sound_bank(void){ return D_80282108; } diff --git a/src/core1/code_5650.c b/src/core1/code_5650.c index 086987be..fe4fc37d 100644 --- a/src/core1/code_5650.c +++ b/src/core1/code_5650.c @@ -329,10 +329,10 @@ void func_802432F8(N_ALSndPlayer *sndp, N_ALEvent *event) { case 0x200: if (temp_s0->unk3F & 0x10) { sp68 = func_80244608(var_s5->msg.midi.duration, (s16)var_s5->msg.generic.data[1].i, temp_s0->unk30); - func_80244978(sp68, 8, temp_s0->unk34); - func_80244978(sp68, 4, temp_s0->unk3D); + func_80244978(sp68, AL_SEQP_PROG_EVT, temp_s0->unk34); + func_80244978(sp68, AL_SEQ_END_EVT, temp_s0->unk3D); func_80244978(sp68, 0x100, temp_s0->unk3E); - func_80244978(sp68, 0x10, reinterpret_cast(s32, temp_s0->unk2C)); + func_80244978(sp68, AL_SEQP_STOP_EVT, reinterpret_cast(s32, temp_s0->unk2C)); } break; diff --git a/src/core1/code_9D30.c b/src/core1/code_9D30.c index fe8de73b..cb9187a9 100644 --- a/src/core1/code_9D30.c +++ b/src/core1/code_9D30.c @@ -318,28 +318,38 @@ void func_80248098(f32 arg0) { func_80248520(); } +//letter to font index??? s32 func_8024824C(s32 arg0) { + //lowercase_letter if ((arg0 >= (s32) D_80275BE8[0]) && ((s32) D_80275BE8[1] >= arg0)) { return (arg0 - D_80275BE8[0]) + 0xA; } + //uppercase_letter if ((arg0 >= (s32) D_80275BE8[2]) && ((s32) D_80275BE8[3] >= arg0)) { return (arg0 - D_80275BE8[2]) + 0xA; } + //number if ((arg0 >= (s32) D_80275BE8[4]) && ((s32) D_80275BE8[5] >= arg0)) { return (arg0 - D_80275BE8[4]); } + //. if (arg0 == D_80275BE8[6]) { return 0x24; } + + //: if (arg0 == D_80275BE8[7]) { return 0x25; } + + //- if (arg0 == D_80275BE8[8]) { return 0x26; } + // if (arg0 == D_80275BE8[9]) { return 0x27; } diff --git a/src/core2/anim/sprite.c b/src/core2/anim/sprite.c new file mode 100644 index 00000000..eb0542a2 --- /dev/null +++ b/src/core2/anim/sprite.c @@ -0,0 +1,275 @@ +#include +#include "core2/anim/sprite.h" + +#include "functions.h" +#include "variables.h" + + + +/* .bss */ +u8 D_80379B90[0x10]; +static AnimSprite s_animsprite_list[40]; + +/* .code */ +static void __animsprite_reset_loop(AnimSprite *this){ + this->remaining_time += this->steps[this->current_step].duration*(1.0/30.0)*this->speed_multiplier; +} + +static void __animsprite_update_looped(AnimSprite *this){ + this->remaining_time -= time_getDelta(); + while(this->remaining_time <= 0.0f){ + this->current_step++; + if(this->current_step >= this->step_count) + this->current_step = 0; + __animsprite_reset_loop(this); + } +} + +static void __animsprite_update_once(AnimSprite *this){ + this->remaining_time -= time_getDelta(); + while(this->remaining_time <= 0.0f){ + this->current_step++; + if(this->step_count <= this->current_step){ + this->current_step--; + this->state = ANIM_SPRITE_STATE_STOPPED; + } + __animsprite_reset_loop(this); + } +} + +/** + * @brief initializes the use of AnimSprite structures + * + */ +void animsprite_init(void){ + int i; + for(i = 0; i < 40; i++){ + s_animsprite_list[i].active = 0; + } +} + +/** + * @brief Returns pointer to first free AnimSprite slot. + * Returns NULL if not slots are free + * + * @return AnimSprite* + */ +AnimSprite * animsprite_new(void){ + int i; + for(i = 0; i < 40; i++){ + if(!s_animsprite_list[i].active){ + s_animsprite_list[i].active = 1; + s_animsprite_list[i].current_step = 0; + s_animsprite_list[i].state = 0; + s_animsprite_list[i].step_count = 1; + s_animsprite_list[i].start_step = 0; + s_animsprite_list[i].steps = 0; + s_animsprite_list[i].unknown = 1; + s_animsprite_list[i].remaining_time = 0.0f; + s_animsprite_list[i].speed_multiplier = 1.0f; + s_animsprite_list[i].current_frame = 0; + return &s_animsprite_list[i]; + } + } + return NULL; +} + +/** + * @brief Marks AnimSprite as inactive/free + * + * @param this + */ +void animsprite_free(AnimSprite *this){ + this->active = 0; +} + +/** + * @brief Destructs all AnimSprites + * + */ +void animsprite_terminate(void){ + int i; + for(i = 0; i < 40; i++){ + if(s_animsprite_list[i].active){ + animsprite_free(&s_animsprite_list[i]); + } + } +} + +/** + * @brief performs frame update of an AnimSprite + * + * @param this + */ +void animsprite_update(AnimSprite *this){ + switch(this->state){ + case ANIM_SPRITE_STATE_NONE: + break; + case ANIM_SPRITE_STATE_ONCE: + __animsprite_update_once(this); + this->current_frame = this->steps[this->current_step].index; + break; + case ANIM_SPRITE_STATE_LOOP: + __animsprite_update_looped(this); + this->current_frame = this->steps[this->current_step].index; + break; + case ANIM_SPRITE_STATE_STOPPED: + break; + } +} + +/** + * @brief sets an AnimSprite to default settings + * + * @param this + */ +void animsprite_default(AnimSprite *this){ + this->current_step = 0; + this->remaining_time = 0.0f; + animsprite_set_steps(this, NULL, 1); + animsprite_set_speed(this, 1.0f); + animsprite_set_start_step(this, 0); + animsprite_set_state(this, ANIM_SPRITE_STATE_LOOP); + animsprite_set_unknown(this, 1); +} + +/** + * @brief starts the lopping of a AnimSprite + * + * @param this + */ +void animsprite_loop(AnimSprite *this){ + this->current_step = this->start_step; + __animsprite_reset_loop(this); +} + +/** + * @brief sets the steps of a AnimSprite + * + * @param this pointer to AnimSprite + * @param step_list pointer to AnimSpriteStep array + * @param size size of step list in bytes + */ +void animsprite_set_steps(AnimSprite *this, AnimSpriteStep *step_list, s32 size){ + this->steps = step_list; + this->step_count = size/2; +} + +/** + * @brief sets the state of a AnimSpriteState + * + * @param this + * @param arg1 + */ +void animsprite_set_state(AnimSprite *this, AnimSpriteState arg1){ + this->state = arg1; +} + +/** + * @brief sets an unknown bit bit in a AnimSprite + * + * @param this + * @return s32 + * + * @note This bit is not used in the final release of Banjo-Kazooie + */ +void animsprite_set_unknown(AnimSprite *this, s32 arg1){ + this->unknown = arg1; +} + +/** + * @brief sets the current frame index of a AnimSprite + * + * @param this + * @param arg1 + * + * @note this only persists if the AnimSprite is stopped + */ +void animsprite_set_frame(AnimSprite *this, s32 arg1){ + this->current_frame = arg1; +} + +/** + * @brief sets the speed multiplier of a AnimSprite + * + * @param this pointer to AnimSprite + * @param speed speed multiplier to default speed of 1 sprite frame per game + * frame (30 fps) + */ +void animsprite_set_speed(AnimSprite *this, f32 speed){ + this->speed_multiplier = speed; +} + +/** + * @brief sets the start position of a AnimSprite + * + * @param this + * @param step + */ +void animsprite_set_start_step(AnimSprite *this, s32 step){ + this->start_step = step; +} + +/** + * @brief returns the frame index corresponding to the current step of a + * AnimSprite + * + * @param this + * @return s32 + */ +s32 animsprite_get_frame(AnimSprite *this){ + return this->current_frame; +} + +/** + * @brief returns the current state of a AnimSprite + * + * @param this + * @return AnimSpriteState + */ +AnimSpriteState animsprite_get_current_state(AnimSprite *this){ + return this->state; +} + +/** + * @brief returns a bit from a AnimSprite + * + * @param this + * @return s32 + * + * @note This bit is not used in the final release of Banjo-Kazooie + */ +s32 animsprite_get_unknown(AnimSprite *this){ + return this->unknown; +} + +/** + * @brief returns the speed multiplier applied to a AnimSprite + * + * @param this + * @return f32 + */ +f32 animsprite_get_speed(AnimSprite *this){ + return this->speed_multiplier; +} + +/** + * @brief returns true if AnimSprite is stopped + * + * @param this + * @return int + */ +int animsprite_is_stopped(AnimSprite *this){ + return animsprite_get_current_state(this) == 3; +} + +/** + * @brief returns true if AnimSprite is on specified step + * + * @param this + * @param frame + * @return int + */ +int animsprite_is_at_step(AnimSprite *this, s32 frame){ + return this->current_step == frame; +} diff --git a/src/core2/ch/badShad.c b/src/core2/ch/badShad.c index 20b9469c..6ee83745 100644 --- a/src/core2/ch/badShad.c +++ b/src/core2/ch/badShad.c @@ -86,10 +86,10 @@ f32 func_802D7038(Actor *this) { } void func_802D7124(Actor *actor, f32 arg1) { - f32 sp1C[3]; + f32 vp[3]; - viewport_getPosition(&sp1C); - if ((actor->position[0] - sp1C[0]) * (actor->position[0] - sp1C[0]) + (actor->position[2] - sp1C[2]) * (actor->position[2] - sp1C[2]) < 12250000.0f) { + viewport_getPosition(&vp); + if ((actor->position[0] - vp[0]) * (actor->position[0] - vp[0]) + (actor->position[2] - vp[2]) * (actor->position[2] - vp[2]) < 12250000.0f) { func_802D729C(actor, arg1); } } diff --git a/src/core2/ch/beehive.c b/src/core2/ch/beehive.c index 5a0303d5..61db5e17 100644 --- a/src/core2/ch/beehive.c +++ b/src/core2/ch/beehive.c @@ -72,8 +72,8 @@ void func_802CE8D4(Actor *this){ sfxsource_setSfxId(this->unk44_31, SFX_67_BEEHIVE_CLONK); sfxsource_setSampleRate(this->unk44_31, 12000); func_8030DBB4(this->unk44_31, (animctrl_getAnimTimer(this->animctrl) + 0.9) - 0.4); - func_8030DF68(this->unk44_31, this->position); - func_8030DEB4(this->unk44_31, 300.0f, 1500.0f); + sfxsource_set_position(this->unk44_31, this->position); + sfxsource_set_fade_distances(this->unk44_31, 300.0f, 1500.0f); func_8030DD14(this->unk44_31, 3); func_8030E2C4(this->unk44_31); } diff --git a/src/core2/ch/crab.c b/src/core2/ch/crab.c index 5d0582f2..1dc83447 100644 --- a/src/core2/ch/crab.c +++ b/src/core2/ch/crab.c @@ -140,7 +140,7 @@ void __chCrab_spawn_mutant_crab_jiggy(void) { sp1C[0] = 13814.0f; sp1C[1] = 3812.0f; sp1C[2] = 0.0f; - jiggySpawn(JIGGY_16_CC_SNIPPETS, sp1C); + jiggy_spawn(JIGGY_16_CC_SNIPPETS, sp1C); } void __chCrab_mutantTextCallback(ActorMarker *caller, enum asset_e text_id, s32 model_id){ diff --git a/src/core2/ch/jinjo.c b/src/core2/ch/jinjo.c index 9438d729..cf29848b 100644 --- a/src/core2/ch/jinjo.c +++ b/src/core2/ch/jinjo.c @@ -172,7 +172,7 @@ void chJinjo_update(Actor * this){ sp40[1] = this->position_y; sp40[2] = this->position_z; sp40[1] += 50.0f; - jiggySpawn(10*level_get()-9, sp40); + jiggy_spawn(10*level_get()-9, sp40); }//L802CE0CC func_8024BD08(0); func_8032BB88(this, 0, 4000); diff --git a/src/core2/ch/soundsource.c b/src/core2/ch/soundsource.c index 7a2477b3..cdfc21d7 100644 --- a/src/core2/ch/soundsource.c +++ b/src/core2/ch/soundsource.c @@ -60,8 +60,8 @@ void func_802D05A0(Actor *this, s32 next_state){ sfxsource_setSfxId(local->unk0, D_80367340[(s32)this->yaw].unk0); func_8030DD14(local->unk0, 3); func_8030DFF0(local->unk0, 1); - func_8030DF68(local->unk0, this->position); - func_8030DEB4(local->unk0, D_80367340[(s32)this->yaw].unk4*this->scale, D_80367340[(s32)this->yaw].unk6*this->scale); + sfxsource_set_position(local->unk0, this->position); + sfxsource_set_fade_distances(local->unk0, D_80367340[(s32)this->yaw].unk4*this->scale, D_80367340[(s32)this->yaw].unk6*this->scale); func_8030DFB4(local->unk0, 1); func_802D0500(this); if(-1.0f != D_80367340[(s32)this->yaw].unkC) diff --git a/src/core2/code_47BD0.c b/src/core2/code_47BD0.c index b5018790..820098ec 100644 --- a/src/core2/code_47BD0.c +++ b/src/core2/code_47BD0.c @@ -6,8 +6,8 @@ extern void func_8030DBFC(u32, f32, f32, f32); extern bool func_80309DBC(f32[3], f32[3], f32, f32 sp54[3], s32, s32); extern void fileProgressFlag_set(s32, bool); -extern void func_8030DEB4(u8, f32, f32); -extern void func_8030DF68(u8, f32[3]); +extern void sfxsource_set_fade_distances(u8, f32, f32); +extern void sfxsource_set_position(u8, f32[3]); extern void func_8030E2C4(u8); extern void sfxsource_setSampleRate(u8, s32); extern void ml_vec3f_normalize(f32[3]); @@ -544,8 +544,8 @@ void chBeeSwarm_update(Actor *this) { ((this->state == 3) || (this->state == 4)) ? 1.1 : 0.9, 0.05f ); - func_8030DEB4(this->unk44_31, 500.0f, 1500.0f); - func_8030DF68(this->unk44_31, this->position); + sfxsource_set_fade_distances(this->unk44_31, 500.0f, 1500.0f); + sfxsource_set_position(this->unk44_31, this->position); func_8030E2C4(this->unk44_31); sfxsource_setSampleRate(this->unk44_31, (s32)(((gu_sqrtf(this->velocity[0]*this->velocity[0] + this->velocity[1]*this->velocity[1] + this->velocity[2]*this->velocity[2])/ this->unk28) * 8000.0f) + 2000.0f)); } diff --git a/src/core2/code_5BEB0.c b/src/core2/code_5BEB0.c index cbc35ade..a92a825b 100644 --- a/src/core2/code_5BEB0.c +++ b/src/core2/code_5BEB0.c @@ -13,7 +13,7 @@ u8 pad_8037E8A8[0x18]; /* public functions */ void func_802E3BD0(s32 frame_buffer_indx); -int func_802E49F0(void); +int game_is_frozen(void); /* .code */ void mapSavestate_init(void){ diff --git a/src/core2/code_5C870.c b/src/core2/code_5C870.c index ad41b168..8a445ee7 100644 --- a/src/core2/code_5C870.c +++ b/src/core2/code_5C870.c @@ -141,17 +141,17 @@ void func_802E39D0(Gfx **gdl, Mtx **mptr, Vtx **vptr, s32 arg3, s32 arg4){ func_8030C2D4(gdl, mptr, vptr); } - if(!func_802E49F0() && func_80335134()){ + if(!game_is_frozen() && func_80335134()){ func_8032D474(gdl, mptr, vptr); } gcpausemenu_draw(gdl, mptr, vptr); - if(!func_802E49F0()){ + if(!game_is_frozen()){ func_8025AFC0(gdl, mptr, vptr); } gcdialog_draw(gdl, mptr, vptr); - if(!func_802E49F0()){ + if(!game_is_frozen()){ itemPrint_draw(gdl, mptr, vptr); } @@ -274,7 +274,7 @@ void func_802E3E7C(enum game_mode_e mode){ mapSavestate_apply(map); D_8037E8E0.unk0 = prev_mode; func_802E3BF8(mode, sp30); - func_80332CCC(); + jiggylist_map_actors(); func_80346CA8(); } @@ -554,7 +554,7 @@ bool func_802E4424(void) { break; case GAME_MODE_4_PAUSED: /* switch 2 */ - if (gcPauseMenu_update() || func_8031C880()) { + if (gcPauseMenu_update() || cutscenetrigger_update()) { FUNC_8030E624(SFX_C9_PAUSEMENU_ENTER, 0.899316, 32736); func_80335110(1); func_8025A430(-1, 2000, 3); @@ -615,7 +615,7 @@ void func_802E49E0(void){ D_8037E8E0.unkC = TRUE; } -int func_802E49F0(void){ +int game_is_frozen(void){ return D_8037E8E0.unkC; } diff --git a/src/core2/code_72B10.c b/src/core2/code_72B10.c index 6a37f26d..22fb7118 100644 --- a/src/core2/code_72B10.c +++ b/src/core2/code_72B10.c @@ -127,8 +127,8 @@ void func_802F9EC4(s32 arg0, s32 arg1, s32 arg2, s32 arg3){ iPtr = vector_at(D_803810A0, arg0); if(iPtr->unk0){ - func_8030DEB4(iPtr->unk0, (f32)arg2, (f32)arg3); - func_8030DF68(iPtr->unk0, arg1); + sfxsource_set_fade_distances(iPtr->unk0, (f32)arg2, (f32)arg3); + sfxsource_set_position(iPtr->unk0, arg1); } } diff --git a/src/core2/code_7AF80.c b/src/core2/code_7AF80.c index be3b9851..c10d279e 100644 --- a/src/core2/code_7AF80.c +++ b/src/core2/code_7AF80.c @@ -369,9 +369,9 @@ void func_80302634(Gfx **gfx, Mtx **mtx, Vtx **vtx, s32 arg3[3], s32 arg4[3], s3 } void func_80302C94(Gfx **gfx, Mtx **mtx, Vtx **vtx) { - f32 sp6C[3]; - s32 sp60[3]; - f32 sp54[3]; + f32 vp_position[3]; + s32 vp_cube_indices[3]; + f32 vp_rotation[3]; s32 i; s32 sp44[3]; s32 sp38[3]; @@ -381,65 +381,65 @@ void func_80302C94(Gfx **gfx, Mtx **mtx, Vtx **vtx) { return; func_8032D3A8(); - viewport_getPosition(sp6C); - viewport_getRotation(sp54); - func_80256664(sp54); - cube_positionToIndices(sp60, sp6C); - sp60[0] -= D_80381FA0.min[0];\ - sp60[1] -= D_80381FA0.min[1];\ - sp60[2] -= D_80381FA0.min[2]; + viewport_getPosition(vp_position); + viewport_getRotation(vp_rotation); + func_80256664(vp_rotation); + cube_positionToIndices(vp_cube_indices, vp_position); + vp_cube_indices[0] -= D_80381FA0.min[0];\ + vp_cube_indices[1] -= D_80381FA0.min[1];\ + vp_cube_indices[2] -= D_80381FA0.min[2]; func_80308EC8(); sp44[0] = sp44[1] = sp44[2] = 0; sp38[0] = D_80381FA0.width[0] - 1;\ sp38[1] = D_80381FA0.width[1] - 1;\ sp38[2] = D_80381FA0.width[2] - 1; - if ((sp54[0]> 250.0f) && (sp54[0]< 290.0f)) { - if ((sp54[1] >= 225.0f) && (sp54[1] <= 315.0f)) { - sp44[0] = (sp60[0] > sp44[0]) ? sp60[0] - 1 : sp44[0]; + if ((vp_rotation[0]> 250.0f) && (vp_rotation[0]< 290.0f)) { + if ((vp_rotation[1] >= 225.0f) && (vp_rotation[1] <= 315.0f)) { + sp44[0] = (vp_cube_indices[0] > sp44[0]) ? vp_cube_indices[0] - 1 : sp44[0]; } else { - if ((sp54[1] >= 45.0f) && (sp54[1] <= 135.0f)) { - sp38[0] = sp60[0]; + if ((vp_rotation[1] >= 45.0f) && (vp_rotation[1] <= 135.0f)) { + sp38[0] = vp_cube_indices[0]; } } - if ((sp54[0]>= 45.0f) && (sp54[0]<= 135.0f)) { - sp44[1] = sp60[1]; - } else if ((sp54[0]>= 225.0f) && (sp54[0]<= 315.0f)) { - sp38[1] = sp60[1]; + if ((vp_rotation[0]>= 45.0f) && (vp_rotation[0]<= 135.0f)) { + sp44[1] = vp_cube_indices[1]; + } else if ((vp_rotation[0]>= 225.0f) && (vp_rotation[0]<= 315.0f)) { + sp38[1] = vp_cube_indices[1]; } - if ((sp54[1] >= 135.0f) && (sp54[1] <= 225.0f)) { - sp44[2] = (sp60[2] > sp44[2]) ? sp60[2] - 1 : sp44[2]; - } else if ((315.0f <= sp54[1]) || (sp54[1] <= 45.0f)) { - sp38[2] = sp60[2]; + if ((vp_rotation[1] >= 135.0f) && (vp_rotation[1] <= 225.0f)) { + sp44[2] = (vp_cube_indices[2] > sp44[2]) ? vp_cube_indices[2] - 1 : sp44[2]; + } else if ((315.0f <= vp_rotation[1]) || (vp_rotation[1] <= 45.0f)) { + sp38[2] = vp_cube_indices[2]; } } else { - if ((sp54[1] >= 225.0f) && (sp54[1] <= 315.0f)) { - sp44[0] = sp60[0]; + if ((vp_rotation[1] >= 225.0f) && (vp_rotation[1] <= 315.0f)) { + sp44[0] = vp_cube_indices[0]; } else { - if ((sp54[1] >= 45.0f) && (sp54[1] <= 135.0f)) { - sp38[0] = sp60[0]; + if ((vp_rotation[1] >= 45.0f) && (vp_rotation[1] <= 135.0f)) { + sp38[0] = vp_cube_indices[0]; } } - if ((sp54[0]>= 45.0f) && (sp54[0]<= 135.0f)) { - sp44[1] = sp60[1]; - } else if ((sp54[0]>= 225.0f) && (sp54[0]<= 315.0f)) { - sp38[1] = sp60[1]; + if ((vp_rotation[0]>= 45.0f) && (vp_rotation[0]<= 135.0f)) { + sp44[1] = vp_cube_indices[1]; + } else if ((vp_rotation[0]>= 225.0f) && (vp_rotation[0]<= 315.0f)) { + sp38[1] = vp_cube_indices[1]; } - if ((sp54[1] >= 135.0f) && (sp54[1] <= 225.0f)) { - sp44[2] = sp60[2]; - } else if ((315.0f <= sp54[1]) || (sp54[1] <= 45.0f)) { - sp38[2] = sp60[2]; + if ((vp_rotation[1] >= 135.0f) && (vp_rotation[1] <= 225.0f)) { + sp44[2] = vp_cube_indices[2]; + } else if ((315.0f <= vp_rotation[1]) || (vp_rotation[1] <= 45.0f)) { + sp38[2] = vp_cube_indices[2]; } } for(i = 0; i < 3; i++){ - if(sp60[i] - sp44[i] >= 5){ - sp44[i] = sp60[i] - 4; + if(vp_cube_indices[i] - sp44[i] >= 5){ + sp44[i] = vp_cube_indices[i] - 4; } - if(sp38[i] - sp60[i] >= 5){ - sp38[i] = sp60[i] + 4; + if(sp38[i] - vp_cube_indices[i] >= 5){ + sp38[i] = vp_cube_indices[i] + 4; } } if (D_80381FA0.unk3C != NULL) { @@ -449,10 +449,10 @@ void func_80302C94(Gfx **gfx, Mtx **mtx, Vtx **vtx) { if (D_80381FA0.unk40 != NULL) { func_8032D510(D_80381FA0.unk40, gfx, mtx, vtx); } - if (((45.0f <= sp54[1]) && (sp54[1] <= 135.0f)) || ((225.0f <= sp54[1]) && (sp54[1] <= 315.0f))) { - func_80301F50(gfx, mtx, vtx, sp60, sp44, sp38); + if (((45.0f <= vp_rotation[1]) && (vp_rotation[1] <= 135.0f)) || ((225.0f <= vp_rotation[1]) && (vp_rotation[1] <= 315.0f))) { + func_80301F50(gfx, mtx, vtx, vp_cube_indices, sp44, sp38); } else { - func_80302634(gfx, mtx, vtx, sp60, sp44, sp38); + func_80302634(gfx, mtx, vtx, vp_cube_indices, sp44, sp38); } func_80308D2C(gfx, mtx, vtx); } diff --git a/src/core2/code_85800.c b/src/core2/code_85800.c index f3dc6043..753920af 100644 --- a/src/core2/code_85800.c +++ b/src/core2/code_85800.c @@ -18,8 +18,8 @@ extern f32 sfx_randf2(f32, f32); typedef struct { f32 position[3]; - f32 unkC; //inner_radius_squared - f32 unk10; //outer_radius_squared + f32 fade_inner_radius_sqr; //inner_radius_squared + f32 fade_outer_radius_sqr; //outer_radius_squared s16 unk14; u8 unk16; u8 pad17[0x1]; @@ -202,10 +202,10 @@ s32 func_8030CCF0(struct45s *arg0, s32 arg1){ diff[1] = arg0->position[1] - plyr_pos[1]; diff[2] = arg0->position[2] - plyr_pos[2]; dist_sqr = diff[0]*diff[0] + diff[1]*diff[1] + diff[2]*diff[2]; - if( dist_sqr < arg0->unkC) + if( dist_sqr < arg0->fade_inner_radius_sqr) retVal = arg1; - else if( dist_sqr < arg0->unk10) - retVal = arg0->unk14 + (((arg0->unk10-dist_sqr))/(arg0->unk10 - arg0->unkC))*(arg1 - arg0->unk14); + else if( dist_sqr < arg0->fade_outer_radius_sqr) + retVal = arg0->unk14 + (((arg0->fade_outer_radius_sqr-dist_sqr))/(arg0->fade_outer_radius_sqr - arg0->fade_inner_radius_sqr))*(arg1 - arg0->unk14); else retVal = arg0->unk14; return retVal; @@ -497,8 +497,8 @@ u8 func_8030D90C(void){ sfxsource_setFlag(s0, SFX_SRC_FLAG_2_UNKOWN); sfxsource_setFlag(s0, SFX_SRC_FLAG_3_UNKOWN); sfxsource_setFlag(s0, SFX_SRC_FLAG_4_UNKOWN); - s0->unkC = 62500.0f; - s0->unk10 = 1440000.0f; + s0->fade_inner_radius_sqr = 62500.0f; + s0->fade_outer_radius_sqr = 1440000.0f; s0->unk14 = 0xa; s0->unk16 = 0; s0->unk18 = 64.0f; @@ -643,12 +643,12 @@ void func_8030DE44(u8 indx, s32 arg1, f32 arg2){ } } -void func_8030DEB4(u8 indx, f32 arg1, f32 arg2){ +void sfxsource_set_fade_distances(u8 indx, f32 min, f32 max){ struct45s *ptr; if(indx){ ptr = sfxsource_at(indx); - ptr->unkC = arg1*arg1; - ptr->unk10 = arg2*arg2; + ptr->fade_inner_radius_sqr = min*min; + ptr->fade_outer_radius_sqr = max*max; func_8030DFF0(indx, 1); } } @@ -662,8 +662,7 @@ void func_8030DF18(u8 indx, f32 arg1){ } } -//sfxsource_setPostion -void func_8030DF68(u8 indx, f32 position[3]){ +void sfxsource_set_position(u8 indx, f32 position[3]){ struct45s *ptr; if(indx){ ptr = sfxsource_at(indx); @@ -914,8 +913,8 @@ void func_8030E78C(enum sfx_e uid, f32 arg1, u32 arg2, f32 position[3], f32 arg4 sfxsource_setSfxId(s0, uid); sfxsource_setSampleRate(s0, arg2); func_8030DBB4(s0, arg1); - func_8030DEB4(s0, arg4, arg5); - func_8030DF68(s0, position); + sfxsource_set_fade_distances(s0, arg4, arg5); + sfxsource_set_position(s0, position); func_8030DD14(s0, 1); func_8030E2C4(s0); } @@ -984,7 +983,7 @@ void func_8030EC74(enum sfx_e uid, f32 arg1, f32 arg2, u32 arg3, u32 arg4, f32 a sfxsource_setSfxId(indx, uid); sfxsource_setSampleRate(indx, sfx_randi2(arg3, arg4)); func_8030DBB4(indx, sfx_randf2(arg1, arg2)); - func_8030DF68(indx, arg5); + sfxsource_set_position(indx, arg5); func_8030DD14(indx, 1); func_8030E2C4(indx); } diff --git a/src/core2/code_956B0.c b/src/core2/code_956B0.c index 1aaf0a7c..2a6d1924 100644 --- a/src/core2/code_956B0.c +++ b/src/core2/code_956B0.c @@ -78,7 +78,7 @@ bool func_8031C7C8(void){ } //checks is a cutscene can be inturrupted and performs take me there -void func_8031C7EC(s32 cs_map, s32 arg1, s32 return_map, s32 return_exit, bool (* condFunc)(void)){ +void cutscenetrigger_check(s32 cs_map, s32 arg1, s32 return_map, s32 return_exit, bool (* condFunc)(void)){ if(map_get() != cs_map) return; @@ -89,31 +89,31 @@ void func_8031C7EC(s32 cs_map, s32 arg1, s32 return_map, s32 return_exit, bool ( } //check cutscene interrupts -s32 func_8031C880(void){ - func_8031C7EC(MAP_86_CS_SPIRAL_MOUNTAIN_4, 0, MAP_89_CS_INTRO_BANJOS_HOUSE_2, -1, NULL); - func_8031C7EC(MAP_7D_CS_SPIRAL_MOUNTAIN_1, 0, MAP_7C_CS_INTRO_BANJOS_HOUSE_1, -1, NULL); - func_8031C7EC(MAP_7C_CS_INTRO_BANJOS_HOUSE_1, 0, MAP_86_CS_SPIRAL_MOUNTAIN_4, -1, NULL); - func_8031C7EC(MAP_89_CS_INTRO_BANJOS_HOUSE_2, 0, MAP_1_SM_SPIRAL_MOUNTAIN, 0x12, NULL); - func_8031C7EC(MAP_85_CS_SPIRAL_MOUNTAIN_3, 0, MAP_7B_CS_INTRO_GL_DINGPOT_1, -1, NULL); - func_8031C7EC(MAP_7B_CS_INTRO_GL_DINGPOT_1, 1, MAP_81_CS_INTRO_GL_DINGPOT_2, -1, NULL); - func_8031C7EC(MAP_81_CS_INTRO_GL_DINGPOT_2, 0, MAP_7D_CS_SPIRAL_MOUNTAIN_1, -1, NULL); - func_8031C7EC(MAP_82_CS_ENTERING_GL_MACHINE_ROOM, 0, MAP_69_GL_MM_LOBBY, 0x12, func_8031C688); - func_8031C7EC(MAP_83_CS_GAME_OVER_MACHINE_ROOM, 0, MAP_1F_CS_START_RAREWARE, -1, func_8031C6E4); - func_8031C7EC(MAP_87_CS_SPIRAL_MOUNTAIN_5, 0, MAP_88_CS_SPIRAL_MOUNTAIN_6, -1, NULL); - func_8031C7EC(MAP_94_CS_INTRO_SPIRAL_7, 0, MAP_8E_GL_FURNACE_FUN, 4, NULL); - func_8031C7EC(MAP_88_CS_SPIRAL_MOUNTAIN_6, 1, MAP_96_CS_END_BEACH_1, -1, NULL); - func_8031C7EC(MAP_98_CS_END_SPIRAL_MOUNTAIN_1, 0, MAP_1F_CS_START_RAREWARE, -1, NULL); - func_8031C7EC(MAP_99_CS_END_SPIRAL_MOUNTAIN_2, 0, MAP_1F_CS_START_RAREWARE, -1, NULL); - func_8031C7EC(MAP_20_CS_END_NOT_100, 0, MAP_98_CS_END_SPIRAL_MOUNTAIN_1, -1, NULL); - func_8031C7EC(MAP_95_CS_END_ALL_100, 0, MAP_99_CS_END_SPIRAL_MOUNTAIN_2, -1, NULL); - func_8031C7EC(MAP_97_CS_END_BEACH_2, 0, MAP_99_CS_END_SPIRAL_MOUNTAIN_2, -1, func_8031C7C8); - func_8031C7EC(MAP_85_CS_SPIRAL_MOUNTAIN_3, 0xC, MAP_1_SM_SPIRAL_MOUNTAIN, 0x12, func_8031C640); - func_8031C7EC(MAP_7B_CS_INTRO_GL_DINGPOT_1, 0xC, MAP_1_SM_SPIRAL_MOUNTAIN, 0x12, func_8031C640); - func_8031C7EC(MAP_81_CS_INTRO_GL_DINGPOT_2, 0xC, MAP_1_SM_SPIRAL_MOUNTAIN, 0x12, func_8031C640); - func_8031C7EC(MAP_7D_CS_SPIRAL_MOUNTAIN_1, 0xC, MAP_1_SM_SPIRAL_MOUNTAIN, 0x12, func_8031C640); - func_8031C7EC(MAP_7C_CS_INTRO_BANJOS_HOUSE_1, 0xC, MAP_1_SM_SPIRAL_MOUNTAIN, 0x12, func_8031C640); - func_8031C7EC(MAP_86_CS_SPIRAL_MOUNTAIN_4, 0xC, MAP_1_SM_SPIRAL_MOUNTAIN, 0x12, func_8031C640); - func_8031C7EC(MAP_89_CS_INTRO_BANJOS_HOUSE_2, 0xC, MAP_1_SM_SPIRAL_MOUNTAIN, 0x12, func_8031C640); +s32 cutscenetrigger_update(void){ + cutscenetrigger_check(MAP_86_CS_SPIRAL_MOUNTAIN_4, 0, MAP_89_CS_INTRO_BANJOS_HOUSE_2, -1, NULL); + cutscenetrigger_check(MAP_7D_CS_SPIRAL_MOUNTAIN_1, 0, MAP_7C_CS_INTRO_BANJOS_HOUSE_1, -1, NULL); + cutscenetrigger_check(MAP_7C_CS_INTRO_BANJOS_HOUSE_1, 0, MAP_86_CS_SPIRAL_MOUNTAIN_4, -1, NULL); + cutscenetrigger_check(MAP_89_CS_INTRO_BANJOS_HOUSE_2, 0, MAP_1_SM_SPIRAL_MOUNTAIN, 0x12, NULL); + cutscenetrigger_check(MAP_85_CS_SPIRAL_MOUNTAIN_3, 0, MAP_7B_CS_INTRO_GL_DINGPOT_1, -1, NULL); + cutscenetrigger_check(MAP_7B_CS_INTRO_GL_DINGPOT_1, 1, MAP_81_CS_INTRO_GL_DINGPOT_2, -1, NULL); + cutscenetrigger_check(MAP_81_CS_INTRO_GL_DINGPOT_2, 0, MAP_7D_CS_SPIRAL_MOUNTAIN_1, -1, NULL); + cutscenetrigger_check(MAP_82_CS_ENTERING_GL_MACHINE_ROOM, 0, MAP_69_GL_MM_LOBBY, 0x12, func_8031C688); + cutscenetrigger_check(MAP_83_CS_GAME_OVER_MACHINE_ROOM, 0, MAP_1F_CS_START_RAREWARE, -1, func_8031C6E4); + cutscenetrigger_check(MAP_87_CS_SPIRAL_MOUNTAIN_5, 0, MAP_88_CS_SPIRAL_MOUNTAIN_6, -1, NULL); + cutscenetrigger_check(MAP_94_CS_INTRO_SPIRAL_7, 0, MAP_8E_GL_FURNACE_FUN, 4, NULL); + cutscenetrigger_check(MAP_88_CS_SPIRAL_MOUNTAIN_6, 1, MAP_96_CS_END_BEACH_1, -1, NULL); + cutscenetrigger_check(MAP_98_CS_END_SPIRAL_MOUNTAIN_1, 0, MAP_1F_CS_START_RAREWARE, -1, NULL); + cutscenetrigger_check(MAP_99_CS_END_SPIRAL_MOUNTAIN_2, 0, MAP_1F_CS_START_RAREWARE, -1, NULL); + cutscenetrigger_check(MAP_20_CS_END_NOT_100, 0, MAP_98_CS_END_SPIRAL_MOUNTAIN_1, -1, NULL); + cutscenetrigger_check(MAP_95_CS_END_ALL_100, 0, MAP_99_CS_END_SPIRAL_MOUNTAIN_2, -1, NULL); + cutscenetrigger_check(MAP_97_CS_END_BEACH_2, 0, MAP_99_CS_END_SPIRAL_MOUNTAIN_2, -1, func_8031C7C8); + cutscenetrigger_check(MAP_85_CS_SPIRAL_MOUNTAIN_3, 0xC, MAP_1_SM_SPIRAL_MOUNTAIN, 0x12, func_8031C640); + cutscenetrigger_check(MAP_7B_CS_INTRO_GL_DINGPOT_1, 0xC, MAP_1_SM_SPIRAL_MOUNTAIN, 0x12, func_8031C640); + cutscenetrigger_check(MAP_81_CS_INTRO_GL_DINGPOT_2, 0xC, MAP_1_SM_SPIRAL_MOUNTAIN, 0x12, func_8031C640); + cutscenetrigger_check(MAP_7D_CS_SPIRAL_MOUNTAIN_1, 0xC, MAP_1_SM_SPIRAL_MOUNTAIN, 0x12, func_8031C640); + cutscenetrigger_check(MAP_7C_CS_INTRO_BANJOS_HOUSE_1, 0xC, MAP_1_SM_SPIRAL_MOUNTAIN, 0x12, func_8031C640); + cutscenetrigger_check(MAP_86_CS_SPIRAL_MOUNTAIN_4, 0xC, MAP_1_SM_SPIRAL_MOUNTAIN, 0x12, func_8031C640); + cutscenetrigger_check(MAP_89_CS_INTRO_BANJOS_HOUSE_2, 0xC, MAP_1_SM_SPIRAL_MOUNTAIN, 0x12, func_8031C640); if(map_get() == MAP_95_CS_END_ALL_100 && mapSpecificFlags_get(1)){ func_8034B9E4(); mapSpecificFlags_set(1, 0); diff --git a/src/core2/code_9B990.c b/src/core2/code_9B990.c index ab21b511..fb7e3fd0 100644 --- a/src/core2/code_9B990.c +++ b/src/core2/code_9B990.c @@ -6,67 +6,67 @@ /* !!!!!!!!!!!!!!!!!!!!!!!!!!! BREAK??? !!!!!!!!!!!!!!!!!!!!!!!!!*/ void __overlay_mmm_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx); -void func_80322930(void); +void __overlay_mmm_release(void); void func_80322960(void); void __overlay_mmm_update(void); void func_803229C0(s32, s32); void __overlay_cc_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx); -void func_80322A00(void); +void __overlay_cc_release(void); void func_80322A28(void); void __overlay_cc_update(void); void func_80322A78(s32, s32); void __overlay_gv_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx); -void func_80322A94(void); +void __overlay_gv_release(void); void func_80322ACC(void); void __overlay_gv_update(void); void func_80322B3C(s32, s32); void __overlay_ttc_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx); -void func_80322B58(void); +void __overlay_ttc_release(void); void func_80322B78(void); void __overlay_ttc_update(void); void func_80322BB8(s32, s32); void __overlay_mm_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx); -void func_80322CC8(void); +void __overlay_mm_release(void); void func_80322CD0(void); void __overlay_mm_update(void); void func_80322CE0(s32, s32); void __overlay_bgs_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx); -void func_80322D30(void); +void __overlay_bgs_release(void); void func_80322D38(void); void __overlay_bgs_update(void); void func_80322D94(s32, s32); void __overlay_sm_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx); -void func_80322BD4(void); +void __overlay_sm_release(void); void func_80322BDC(void); void __overlay_sm_update(void); void func_80322BEC(s32, s32); void __overlay_lair_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx); -void func_80322C18(void); +void __overlay_lair_release(void); void func_80322C38(void); void __overlay_lair_update(void); void func_80322C78(s32, s32); void __overlay_fight_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx); -void func_80322C94(void); +void __overlay_fight_release(void); void func_80322C9C(void); void __overlay_fight_update(void); void func_80322CAC(s32, s32); void __overlay_intro_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx); -void func_80322CFC(void); +void __overlay_intro_release(void); void func_80322D04(void); void __overlay_intro_update(void); void func_80322D14(s32, s32); void __overlay_fp_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx); -void func_80322DB0(void); +void __overlay_fp_release(void); void func_80322DE8(void); void __overlay_fp_update(void); void func_80322E58(s32, s32); @@ -80,10 +80,10 @@ typedef struct{ s16 unk0; u8 unk2; u8 unk3; - void (*unk4)(void); - void (*unk8)(void); - void (*unkC)(void); - void (*unk10)(Gfx **, Mtx **, Vtx **); + void (*init)(void); + void (*update)(void); + void (*release)(void); + void (*draw)(Gfx **, Mtx **, Vtx **); void (*unk14)(s32, s32); } level_overlay_update_struct; @@ -106,17 +106,17 @@ level_overlay_map_elem D_8036E2C0[] = { }; level_overlay_update_struct D_8036E2F8[] = { - { OVERLAY_2_WHALE, 1, 0, func_80322A28, __overlay_cc_update, func_80322A00, __overlay_cc_draw, func_80322A78}, - { OVERLAY_3_HAUNTED, 1, 0, func_80322960, __overlay_mmm_update, func_80322930, __overlay_mmm_draw, func_803229C0}, - { OVERLAY_4_DESERT, 1, 0, func_80322ACC, __overlay_gv_update, func_80322A94, __overlay_gv_draw, func_80322B3C}, - { OVERLAY_5_BEACH, 1, 0, func_80322B78, __overlay_ttc_update, func_80322B58, __overlay_ttc_draw, func_80322BB8}, - { OVERLAY_6_JUNGLE, 1, 0, func_80322CD0, __overlay_mm_update, func_80322CC8, __overlay_mm_draw, func_80322CE0}, - { OVERLAY_7_SWAMP, 1, 0, func_80322D38, __overlay_bgs_update, func_80322D30, __overlay_bgs_draw, func_80322D94}, - { OVERLAY_B_TRAINING, 1, 0, func_80322BDC, __overlay_sm_update, func_80322BD4, __overlay_sm_draw, func_80322BEC}, - { OVERLAY_C_INTRO, 1, 0, func_80322D04, __overlay_intro_update, func_80322CFC, __overlay_intro_draw, func_80322D14}, - { OVERLAY_D_WITCH, 1, 0, func_80322C38, __overlay_lair_update, func_80322C18, __overlay_lair_draw, func_80322C78}, - { OVERLAY_E_BATTLE, 1, 0, func_80322C9C, __overlay_fight_update, func_80322C94, __overlay_fight_draw, func_80322CAC}, - { OVERLAY_9_SNOW, 0, 1, func_80322DE8, __overlay_fp_update, func_80322DB0, __overlay_fp_draw, func_80322E58}, + { OVERLAY_2_WHALE, 1, 0, func_80322A28, __overlay_cc_update, __overlay_cc_release, __overlay_cc_draw, func_80322A78}, + { OVERLAY_3_HAUNTED, 1, 0, func_80322960, __overlay_mmm_update, __overlay_mmm_release, __overlay_mmm_draw, func_803229C0}, + { OVERLAY_4_DESERT, 1, 0, func_80322ACC, __overlay_gv_update, __overlay_gv_release, __overlay_gv_draw, func_80322B3C}, + { OVERLAY_5_BEACH, 1, 0, func_80322B78, __overlay_ttc_update, __overlay_ttc_release, __overlay_ttc_draw, func_80322BB8}, + { OVERLAY_6_JUNGLE, 1, 0, func_80322CD0, __overlay_mm_update, __overlay_mm_release, __overlay_mm_draw, func_80322CE0}, + { OVERLAY_7_SWAMP, 1, 0, func_80322D38, __overlay_bgs_update, __overlay_bgs_release, __overlay_bgs_draw, func_80322D94}, + { OVERLAY_B_TRAINING, 1, 0, func_80322BDC, __overlay_sm_update, __overlay_sm_release, __overlay_sm_draw, func_80322BEC}, + { OVERLAY_C_INTRO, 1, 0, func_80322D04, __overlay_intro_update, __overlay_intro_release, __overlay_intro_draw, func_80322D14}, + { OVERLAY_D_WITCH, 1, 0, func_80322C38, __overlay_lair_update, __overlay_lair_release, __overlay_lair_draw, func_80322C78}, + { OVERLAY_E_BATTLE, 1, 0, func_80322C9C, __overlay_fight_update, __overlay_fight_release, __overlay_fight_draw, func_80322CAC}, + { OVERLAY_9_SNOW, 0, 1, func_80322DE8, __overlay_fp_update, __overlay_fp_release, __overlay_fp_draw, func_80322E58}, {0} }; @@ -125,17 +125,17 @@ struct { u8 unk0; u8 unk1; u8 pad2[2]; - void (*unk4)(void); - void (*unk8)(void); - void (*unkC)(void); - void (*unk10)(Gfx **, Mtx **, Vtx **); + void (*init)(void); + void (*update)(void); + void (*release)(void); + void (*draw)(Gfx **, Mtx **, Vtx **); void (*unk14)(s32, s32); } D_80383350; /* .code */ void __overlay_mmm_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){ return; } -void func_80322930(void){ +void __overlay_mmm_release(void){ func_8038953C(); MMM_func_80389CD8(); func_8038A994(); @@ -161,7 +161,7 @@ void __overlay_cc_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){ CC_func_80388760(gfx, mtx, vtx); } -void func_80322A00(void){ +void __overlay_cc_release(void){ func_80388CB4(); func_803880D4(); } @@ -182,7 +182,7 @@ void func_80322A78(s32 arg0, s32 arg1){ return; } void __overlay_gv_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){ return; } -void func_80322A94(void){ +void __overlay_gv_release(void){ func_8038FF60(); func_803900F8(); gv_matchingGame_reset(); //gv_matchingGame_reset @@ -207,7 +207,7 @@ void func_80322B3C(s32 arg0, s32 arg1){ return; } void __overlay_ttc_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){ return; } -void func_80322B58(void){ +void __overlay_ttc_release(void){ func_8038B04C(); } @@ -223,7 +223,7 @@ void func_80322BB8(s32 arg0, s32 arg1){ return; } void __overlay_sm_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){ return; } -void func_80322BD4(void){ return; } +void __overlay_sm_release(void){ return; } void func_80322BDC(void){ return; } @@ -235,7 +235,7 @@ void __overlay_lair_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){ lair_func_8038E768(gfx, mtx, vtx); } -void func_80322C18(void){ +void __overlay_lair_release(void){ lair_func_8038CD48(); } @@ -252,7 +252,7 @@ void func_80322C78(s32 arg0, s32 arg1){ return; } void __overlay_fight_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){ return; } -void func_80322C94(void){ return; } +void __overlay_fight_release(void){ return; } void func_80322C9C(void){ return; } @@ -262,7 +262,7 @@ void func_80322CAC(s32 arg0, s32 arg1){ return; } void __overlay_mm_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){ return; } -void func_80322CC8(void){ return; } +void __overlay_mm_release(void){ return; } void func_80322CD0(void){ return; } @@ -272,7 +272,7 @@ void func_80322CE0(s32 arg0, s32 arg1){ return; } void __overlay_intro_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){ return; } -void func_80322CFC(void){ return; } +void __overlay_intro_release(void){ return; } void func_80322D04(void){ return; } @@ -282,7 +282,7 @@ void func_80322D14(s32 arg0, s32 arg1){ return; } void __overlay_bgs_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){ return; } -void func_80322D30(void){ return; } +void __overlay_bgs_release(void){ return; } void func_80322D38(void){ if( map_get() == MAP_10_BGS_MR_VILE @@ -299,7 +299,7 @@ void func_80322D94(s32 arg0, s32 arg1){ return; } void __overlay_fp_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){ return; } -void func_80322DB0(void){ +void __overlay_fp_release(void){ fp_sirslushgame_end(); fp_snowmanButtonGame_end(); func_8038B8A8(); @@ -323,8 +323,8 @@ void __overlay_fp_update(void){ void func_80322E58(s32 arg0, s32 arg1){ return; } void func_80322E64(Gfx **gfx, Mtx **mtx, Vtx **vtx){ - if(D_80383350.unk10) - D_80383350.unk10(gfx, mtx, vtx); + if(D_80383350.draw) + D_80383350.draw(gfx, mtx, vtx); } enum overlay_e level_to_overlay(enum level_e lvl){ @@ -337,14 +337,14 @@ enum overlay_e level_to_overlay(enum level_e lvl){ } void func_80322EDC(int arg0){ - if(arg0 == D_80383350.unk1 && D_80383350.unkC){ - D_80383350.unkC(); + if(arg0 == D_80383350.unk1 && D_80383350.release){ + D_80383350.release(); } } void func_80322F1C(int arg0){ - if(arg0 == D_80383350.unk0 && D_80383350.unk4){ - D_80383350.unk4(); + if(arg0 == D_80383350.unk0 && D_80383350.init){ + D_80383350.init(); } } @@ -371,17 +371,17 @@ void func_80322FE4(void){ s32 overlay_id; func_80356714(); overlay_id = overlayManagergetLoadedId(); - D_80383350.unk4 = D_80383350.unk8 = D_80383350.unkC = NULL; - D_80383350.unk10 = NULL; + D_80383350.init = D_80383350.update = D_80383350.release = NULL; + D_80383350.draw = NULL; D_80383350.unk14 = NULL; for(i = 0; D_8036E2F8[i].unk0 != 0; i++){ if(overlay_id == D_8036E2F8[i].unk0){ D_80383350.unk0 = D_8036E2F8[i].unk2; D_80383350.unk1 = D_8036E2F8[i].unk3; - D_80383350.unk4 = D_8036E2F8[i].unk4; - D_80383350.unk8 = D_8036E2F8[i].unk8; - D_80383350.unkC = D_8036E2F8[i].unkC; - D_80383350.unk10 = D_8036E2F8[i].unk10; + D_80383350.init = D_8036E2F8[i].init; + D_80383350.update = D_8036E2F8[i].update; + D_80383350.release = D_8036E2F8[i].release; + D_80383350.draw = D_8036E2F8[i].draw; D_80383350.unk14 = D_8036E2F8[i].unk14; break; } @@ -394,6 +394,6 @@ void func_80323098(s32 arg0, s32 arg1){ } void overlay_update(void){ - if(D_80383350.unk8) - D_80383350.unk8(); + if(D_80383350.update) + D_80383350.update(); } diff --git a/src/core2/code_ABC00.c b/src/core2/code_ABC00.c index f0f060ff..5f686538 100644 --- a/src/core2/code_ABC00.c +++ b/src/core2/code_ABC00.c @@ -19,19 +19,19 @@ void func_80347FB8(Struct81s*); typedef struct { - void (*unk0)(Struct81s *); - void (*unk4)(Struct81s *); - void (*unk8)(Struct81s *, Gfx**, Mtx **, Vtx **); - void (*unkC)(Struct81s *); + void (*init)(Struct81s *); + void (*update)(Struct81s *); + void (*draw)(Struct81s *, Gfx**, Mtx **, Vtx **); + void (*free)(Struct81s *); Struct81s unk10; }Struct_core2_ABC00_0; void func_803331D8(enum jiggy_e, f32[3]); -void func_803332D0(Actor *); +void jiggy_free(Actor *); /* .data */ u8 D_8036E830 = 0; -Struct_core2_ABC00_0 D_8036E834[] = { +Struct_core2_ABC00_0 jiggylist_list[] = { {func_80347E34, func_80347E60, func_80347FA4, func_80347FB8, {0x7, NULL, {0.0f, 0.0f, 0.0f}, NULL, NULL}}, {func_80347B54, func_80347B80, func_80347C5C, func_80347C70, {0, NULL, {0.0f, 0.0f, 0.0f}, NULL, NULL}}, {func_80347B54, func_80347B80, func_80347C5C, func_80347C70, {0, NULL, {0.0f, 0.0f, 0.0f}, NULL, NULL}}, @@ -135,10 +135,10 @@ Struct_core2_ABC00_0 D_8036E834[] = { }; /* .bss */ -s32 D_80383560; -s32 D_80383564; -s32 D_80383568; -s32 D_8038356C; +s32 s_jiggyList_level_start_index; +s32 s_jiggyList_level_end_index; +s32 s_jiggyList_level_jiggy_count; +s32 s_jiggylist_current_index; /* .code */ void func_80332B90(void){ @@ -150,34 +150,34 @@ void func_80332BB0(void) { func_8025A55C(-1, 4000, 5); } -void func_80332BEC(enum map_e map_id) { +void jiggylist_set_level(enum map_e map_id) { s32 temp_a2; s32 temp_at; s32 temp_hi; s32 temp_lo; s32 temp_t4; - s32 var_a1; + s32 level_index; s32 var_v1; s32 var_v0; - var_v1 = (map_getLevel(map_id) - 1) % (D_80383568 = 0xA); - var_a1 = MAX(0, var_v1); - D_80383560 = var_a1 * 0xA; - D_80383564 = (var_a1 + 1) * 0xA; - for(D_8038356C = D_80383560; D_8038356C < D_80383564; D_8038356C++){ - D_8036E834[D_8038356C].unk10.marker = NULL; + var_v1 = (map_getLevel(map_id) - 1) % (s_jiggyList_level_jiggy_count = 0xA); + level_index = MAX(0, var_v1); + s_jiggyList_level_start_index = level_index * 0xA; + s_jiggyList_level_end_index = (level_index + 1) * 0xA; + for(s_jiggylist_current_index = s_jiggyList_level_start_index; s_jiggylist_current_index < s_jiggyList_level_end_index; s_jiggylist_current_index++){ + jiggylist_list[s_jiggylist_current_index].unk10.marker = NULL; } D_8036E830 = 0; } -void func_80332CCC(void) { - Actor **temp_v0; +void jiggylist_map_actors(void) { + Actor **jiggy_actors; s32 i; - temp_v0 = actorArray_findJiggyActors(); - for(D_8038356C = 0; temp_v0[D_8038356C] != NULL; D_8038356C++){ - if(!temp_v0[D_8038356C]->unk44_2){ - D_8036E834[chjiggy_getJiggyId(temp_v0[D_8038356C]) - 1].unk10.marker = temp_v0[D_8038356C]->marker; + jiggy_actors = actorArray_findJiggyActors(); + for(s_jiggylist_current_index = 0; jiggy_actors[s_jiggylist_current_index] != NULL; s_jiggylist_current_index++){ + if(!jiggy_actors[s_jiggylist_current_index]->unk44_2){ + jiggylist_list[chjiggy_getJiggyId(jiggy_actors[s_jiggylist_current_index]) - 1].unk10.marker = jiggy_actors[s_jiggylist_current_index]->marker; } } } @@ -200,10 +200,10 @@ void func_80332E08(void) { s32 var_v0; void *temp_v1; - for(D_8038356C = D_80383560; D_8038356C < D_80383564; D_8038356C++) { - if (D_8036E834[D_8038356C].unk10.marker != NULL) { - D_8036E834[D_8038356C].unk4(&D_8036E834[D_8038356C].unk10); - var_v0 = D_8038356C; + for(s_jiggylist_current_index = s_jiggyList_level_start_index; s_jiggylist_current_index < s_jiggyList_level_end_index; s_jiggylist_current_index++) { + if (jiggylist_list[s_jiggylist_current_index].unk10.marker != NULL) { + jiggylist_list[s_jiggylist_current_index].update(&jiggylist_list[s_jiggylist_current_index].unk10); + var_v0 = s_jiggylist_current_index; } } func_80332D98(MAP_69_GL_MM_LOBBY, JIGGY_34_LAIR_MM_WITCH_SWITCH, FILEPROG_18_MM_WITCH_SWITCH_JIGGY_PRESSED, 0x205); @@ -217,32 +217,32 @@ void func_80332E08(void) { D_8036E830 = 1; } -void func_80332F4C(Gfx **gfx, Mtx **mtx, Vtx **vtx) { - for(D_8038356C = D_80383560; D_8038356C < D_80383564; D_8038356C++) { - if (D_8036E834[D_8038356C].unk10.marker != NULL) { - D_8036E834[D_8038356C].unk8(&D_8036E834[D_8038356C].unk10, gfx, mtx, vtx); +void jiggylist_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) { + for(s_jiggylist_current_index = s_jiggyList_level_start_index; s_jiggylist_current_index < s_jiggyList_level_end_index; s_jiggylist_current_index++) { + if (jiggylist_list[s_jiggylist_current_index].unk10.marker != NULL) { + jiggylist_list[s_jiggylist_current_index].draw(&jiggylist_list[s_jiggylist_current_index].unk10, gfx, mtx, vtx); } } } void func_8033301C(void) { - for(D_8038356C = D_80383560; D_8038356C < D_80383564; D_8038356C++) { - if (D_8036E834[D_8038356C].unk10.marker != NULL) { - func_803332D0(marker_getActor(D_8036E834[D_8038356C].unk10.marker)); + for(s_jiggylist_current_index = s_jiggyList_level_start_index; s_jiggylist_current_index < s_jiggyList_level_end_index; s_jiggylist_current_index++) { + if (jiggylist_list[s_jiggylist_current_index].unk10.marker != NULL) { + jiggy_free(marker_getActor(jiggylist_list[s_jiggylist_current_index].unk10.marker)); } } } -void jiggySpawn(enum jiggy_e jiggy_id, f32 pos[3]) { +void jiggy_spawn(enum jiggy_e jiggy_id, f32 pos[3]) { Struct_core2_ABC00_0 *temp_v0; - jiggy_id = ((jiggy_id <= 0) || (jiggy_id >= (D_80383568 * 10))) ? 10 : jiggy_id; - temp_v0 = &D_8036E834[jiggy_id - 1]; - if (D_8036E834[jiggy_id - 1].unk10.marker == NULL) { + jiggy_id = ((jiggy_id <= 0) || (jiggy_id >= (s_jiggyList_level_jiggy_count * 10))) ? JIGGY_A_MM_CONGA : jiggy_id; + temp_v0 = &jiggylist_list[jiggy_id - 1]; + if (jiggylist_list[jiggy_id - 1].unk10.marker == NULL) { temp_v0->unk10.position[0] = pos[0]; temp_v0->unk10.position[1] = pos[1]; temp_v0->unk10.position[2] = pos[2]; - temp_v0->unk0(&temp_v0->unk10); + temp_v0->init(&temp_v0->unk10); jiggyscore_setSpawned(jiggy_id, TRUE); if (!jiggyscore_isCollected(jiggy_id) && (jiggy_id != JIGGY_3E_GV_GRABBA) && (jiggy_id != JIGGY_0B_TTC_JINJO)) { func_8024BD08(0); @@ -254,53 +254,53 @@ void jiggySpawn(enum jiggy_e jiggy_id, f32 pos[3]) { } void func_803331D8(enum jiggy_e jiggy_id, f32 arg1[3]) { - jiggy_id = ((jiggy_id <= 0) || (jiggy_id >= (D_80383568 * 10))) ? JIGGY_A_MM_CONGA : jiggy_id; + jiggy_id = ((jiggy_id <= 0) || (jiggy_id >= (s_jiggyList_level_jiggy_count * 10))) ? JIGGY_A_MM_CONGA : jiggy_id; - D_8036E834[jiggy_id - 1].unk10.position[0] = arg1[0]; - D_8036E834[jiggy_id - 1].unk10.position[1] = arg1[1]; - D_8036E834[jiggy_id - 1].unk10.position[2] = arg1[2]; - D_8036E834[jiggy_id - 1].unk0(&D_8036E834[jiggy_id - 1].unk10); + jiggylist_list[jiggy_id - 1].unk10.position[0] = arg1[0]; + jiggylist_list[jiggy_id - 1].unk10.position[1] = arg1[1]; + jiggylist_list[jiggy_id - 1].unk10.position[2] = arg1[2]; + jiggylist_list[jiggy_id - 1].init(&jiggylist_list[jiggy_id - 1].unk10); jiggyscore_setSpawned(jiggy_id, TRUE); } void func_80333270(enum jiggy_e jiggy_id, f32 position[3], void (*method)(Actor *, ActorMarker *), ActorMarker *other_marker) { Struct_core2_ABC00_0 *ptr; - ptr = &D_8036E834[jiggy_id - 1]; - jiggySpawn(jiggy_id, position); + ptr = &jiggylist_list[jiggy_id - 1]; + jiggy_spawn(jiggy_id, position); ptr->unk10.unk14 = method; ptr->unk10.unk18 = other_marker; } -void func_803332D0(Actor *arg0) +void jiggy_free(Actor *arg0) { s32 indx = chjiggy_getJiggyId(arg0) - 1; - Struct81s *sp18 = &D_8036E834[indx].unk10; - if (D_8036E834[indx].unkC) + Struct81s *sp18 = &jiggylist_list[indx].unk10; + if (jiggylist_list[indx].free) { } - D_8036E834[indx].unkC(sp18); + jiggylist_list[indx].free(sp18); sp18->marker = 0; } void func_80333334(enum jiggy_e jiggy_id) { Struct_core2_ABC00_0 *temp_v0; - temp_v0 = &D_8036E834[jiggy_id - 1]; - temp_v0->unk0 = func_80347B54; - temp_v0->unk4 = func_80347B80; - temp_v0->unk8 = func_80347C5C; - temp_v0->unkC = func_80347C70; + temp_v0 = &jiggylist_list[jiggy_id - 1]; + temp_v0->init = func_80347B54; + temp_v0->update = func_80347B80; + temp_v0->draw = func_80347C5C; + temp_v0->free = func_80347C70; } void func_80333388(enum jiggy_e jiggy_id) { Struct_core2_ABC00_0 *temp_v0; - temp_v0 = &D_8036E834[jiggy_id - 1]; - temp_v0->unk0 = func_80347CC8; - temp_v0->unk4 = func_80347CF4; - temp_v0->unk8 = func_80347DD0; - temp_v0->unkC = func_80347DE4; + temp_v0 = &jiggylist_list[jiggy_id - 1]; + temp_v0->init = func_80347CC8; + temp_v0->update = func_80347CF4; + temp_v0->draw = func_80347DD0; + temp_v0->free = func_80347DE4; } @@ -311,8 +311,8 @@ void func_803333DC(Struct81s *arg0, Actor *arg1) { if (arg0->unk14 != NULL) { arg0->unk14(arg1, arg0->unk18); } - marker_setFreeMethod(arg1->marker, func_803332D0); - jiggy_id = ((s32) ((s32)arg0 - (s32)&D_8036E834) / 0x2C) + 1; + marker_setFreeMethod(arg1->marker, jiggy_free); + jiggy_id = ((s32) ((s32)arg0 - (s32)&jiggylist_list) / 0x2C) + 1; chjiggy_setJiggyId(arg1, jiggy_id); if ((jiggy_id == JIGGY_49_CCW_EYRIE) || (jiggy_id == JIGGY_39_LAIR_MMM_WITCH_SWITCH) || (jiggy_id == JIGGY_3C_LAIR_CCW_WITCH_SWITCH)) { arg1->marker->unk40_21 = TRUE; diff --git a/src/core2/code_AD0.c b/src/core2/code_AD0.c deleted file mode 100644 index 933b0e5b..00000000 --- a/src/core2/code_AD0.c +++ /dev/null @@ -1,156 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - - -/* .bss */ -u8 D_80379B90[0x10]; -struct54s D_80379BA0[40]; - -/* .code */ -void func_80287A60(struct54s *arg0){ - arg0->unk4 += arg0->unk0[arg0->unkC_24].unk1*(1.0/30.0)*arg0->unk8; -} - -void func_80287ACC(struct54s *arg0){ - arg0->unk4 -= time_getDelta(); - while(arg0->unk4 <= 0.0f){ - arg0->unkC_24++; - if(arg0->unkC_24 >= arg0->unkC_31) - arg0->unkC_24 = 0; - func_80287A60(arg0); - } -} - -void func_80287B84(struct54s *arg0){ - arg0->unk4 -= time_getDelta(); - while(arg0->unk4 <= 0.0f){ - arg0->unkC_24++; - if(arg0->unkC_31 <= arg0->unkC_24){ - arg0->unkC_24--; - arg0->unkC_3 = 3; - } - func_80287A60(arg0); - } -} - -void func_80287C58(void){ - int i; - for(i = 0; i < 40; i++){ - D_80379BA0[i].unkC_0 = 0; - } -} - -struct54s * func_80287CA8(void){ - int i; - for(i = 0; i < 40; i++){ - if(!D_80379BA0[i].unkC_0){ - D_80379BA0[i].unkC_0 = 1; - D_80379BA0[i].unkC_24 = 0; - D_80379BA0[i].unkC_3 = 0; - D_80379BA0[i].unkC_31 = 1; - D_80379BA0[i].unkC_17 = 0; - D_80379BA0[i].unk0 = 0; - D_80379BA0[i].unkC_1 = 1; - D_80379BA0[i].unk4 = 0.0f; - D_80379BA0[i].unk8 = 1.0f; - D_80379BA0[i].unkC_10 = 0; - return &D_80379BA0[i]; - } - } - return NULL; -} - -void func_80287D60(struct54s *arg0){ - arg0->unkC_0 = 0; -} - -void func_80287D70(void){ - int i; - for(i = 0; i < 40; i++){ - if(D_80379BA0[i].unkC_0){ - func_80287D60(&D_80379BA0[i]); - } - } -} - -void func_80287DC8(struct54s *arg0){ - switch(arg0->unkC_3){ - case 0: - break; - case 1: - func_80287B84(arg0); - arg0->unkC_10 = arg0->unk0[arg0->unkC_24].unk0; - break; - case 2: - func_80287ACC(arg0); - arg0->unkC_10 = arg0->unk0[arg0->unkC_24].unk0; - break; - case 3: - break; - } -} - -void func_80287E9C(struct54s *arg0){ - arg0->unkC_24 = 0; - arg0->unk4 = 0.0f; - func_80287F50(arg0, 0, 1); - func_80287FD0(arg0, 1.0f); - func_80287FDC(arg0, 0); - func_80287F7C(arg0, 2); - func_80287F98(arg0, 1); -} - -void func_80287F10(struct54s *arg0){ - arg0->unkC_24 = arg0->unkC_17; - func_80287A60(arg0); -} - -void func_80287F50(struct54s *arg0, struct53s *arg1, s32 arg2){ - arg0->unk0 = arg1; - arg0->unkC_31 = arg2/2; -} - -void func_80287F7C(struct54s *arg0, s32 arg1){ - arg0->unkC_3 = arg1; -} - -void func_80287F98(struct54s *arg0, s32 arg1){ - arg0->unkC_1 = arg1; -} - -void func_80287FB4(struct54s *arg0, s32 arg1){ - arg0->unkC_10 = arg1; -} - -void func_80287FD0(struct54s *arg0, f32 arg1){ - arg0->unk8 = arg1; -} - -void func_80287FDC(struct54s *arg0, s32 arg1){ - arg0->unkC_17 = arg1; -} - -s32 func_80287FFC(struct54s *arg0){ - return arg0->unkC_10; -} - -s32 func_8028800C(struct54s *arg0){ - return arg0->unkC_3; -} - -s32 func_8028801C(struct54s *arg0){ - return arg0->unkC_1; -} - -f32 func_8028802C(struct54s *arg0){ - return arg0->unk8; -} - -int func_80288034(struct54s *arg0){ - return func_8028800C(arg0) == 3; -} - -int func_80288058(struct54s *arg0, s32 arg1){ - return arg0->unkC_24 == arg1; -} diff --git a/src/core2/code_AD5B0.c b/src/core2/code_AD5B0.c index c40de0e9..718e9aa7 100644 --- a/src/core2/code_AD5B0.c +++ b/src/core2/code_AD5B0.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" #include "core2/particle.h" - +#include "core2/anim/sprite.h" /* .data */ extern u8 D_80370250 = 0; @@ -43,39 +43,39 @@ void func_80334540(Gfx** gdl, Mtx **mptr, Vtx **vptr) { func_802BBD2C(&sp44, &sp40); func_8024CE60(sp44, sp40); func_8024C904(gdl, mptr); - if (func_80309F78() != 0) { + if (mapModel_has_xlu_bin() != 0) { mapModel_opa_draw(gdl, mptr, vptr); - if (func_802E49F0() == 0) { + if (game_is_frozen() == 0) { func_80322E64(gdl, mptr, vptr); } - if (func_802E49F0() == 0) { + if (game_is_frozen() == 0) { player_draw(gdl, mptr, vptr); } - if (func_802E49F0() == 0) { + if (game_is_frozen() == 0) { func_80302C94(gdl, mptr, vptr); } - if (func_802E49F0() == 0) { - func_80332F4C(gdl, mptr, vptr); + if (game_is_frozen() == 0) { + jiggylist_draw(gdl, mptr, vptr); } - if (func_802E49F0() == 0) { + if (game_is_frozen() == 0) { func_803500D8(gdl, mptr, vptr); } - if (func_802E49F0() == 0) { + if (game_is_frozen() == 0) { func_802F2ED0(func_8032994C(), gdl, mptr, vptr); } - if (func_802E49F0() == 0) { + if (game_is_frozen() == 0) { partEmitMgr_drawPass0(gdl, mptr, vptr); } - if (func_802E49F0() == 0) { + if (game_is_frozen() == 0) { mapModel_xlu_draw(gdl, mptr, vptr); } - if (func_802E49F0() == 0) { + if (game_is_frozen() == 0) { func_8032D3D8(gdl, mptr, vptr); } - if (func_802E49F0() == 0) { + if (game_is_frozen() == 0) { partEmitMgr_drawPass1(gdl, mptr, vptr); } - if (func_802E49F0() == 0) { + if (game_is_frozen() == 0) { func_8034F6F0(gdl, mptr, vptr); } func_802D520C(gdl, mptr, vptr); @@ -86,16 +86,16 @@ void func_80334540(Gfx** gdl, Mtx **mptr, Vtx **vptr) { player_draw(gdl, mptr, vptr); func_80302C94(gdl, mptr, vptr); func_8032D3D8(gdl, mptr, vptr); - func_80332F4C(gdl, mptr, vptr); + jiggylist_draw(gdl, mptr, vptr); func_803500D8(gdl, mptr, vptr); func_802F2ED0(func_8032994C(), gdl, mptr, vptr); func_802D520C(gdl, mptr, vptr); partEmitMgr_draw(gdl, mptr, vptr); } - if (func_802E49F0() == 0) { + if (game_is_frozen() == 0) { func_80350818(gdl, mptr, vptr); } - if (func_802E49F0() == 0) { + if (game_is_frozen() == 0) { func_802BBD0C(gdl, mptr, vptr); } spawnQueue_lock(); @@ -144,7 +144,7 @@ void func_80334910(void) { func_8033E184(); func_8033FA24(); func_80344C80(); - func_80287D70(); + animsprite_terminate(); animBinCache_free(); func_802BC10C(); ncCameraNodeList_free(); @@ -222,7 +222,7 @@ void func_80334B20(enum map_e arg0, s32 arg1, s32 arg2) { func_80323230(); commonParticleType_init(); animBinCache_init(); - func_80287C58(); + animsprite_init(); func_80344C50(); func_8033F9C0(); ncCameraNodeList_init(); @@ -351,7 +351,7 @@ s32 func_80334ECC(void) { overlay_update(); func_80321924(); func_80334428(); - func_8031C880(); + cutscenetrigger_update(); func_802D2CDC(); func_803306C8(1); func_8032AD7C(1); diff --git a/src/core2/code_AE290.c b/src/core2/code_AE290.c index 73afd2d0..fde2f575 100644 --- a/src/core2/code_AE290.c +++ b/src/core2/code_AE290.c @@ -3,7 +3,7 @@ #include "variables.h" #include "n_libaudio.h" -extern ALBank *func_8024F758(void); +extern ALBank *music_get_sound_bank(void); extern u8 D_D846C0; extern u8 D_D954B0; @@ -15,7 +15,7 @@ struct { ALHeap *unkC; //heap s16 unk10; } D_803835F0; -ALBank * D_80383604; +ALBank * sfx_sound_bank; /* .code */ void sfxInstruments_init(void){ @@ -39,25 +39,25 @@ void sfxInstruments_init(void){ D_803835F0.unk8 = 0x18; D_803835F0.unkC = func_802405B8(); func_80243070(&D_803835F0); - D_80383604 = bnk; + sfx_sound_bank = bnk; } int func_8033531C(enum sfx_e uid, struct46s *arg1){ - return func_80244608(D_80383604, (s16) (uid + 1), arg1); + return func_80244608(sfx_sound_bank, (s16) (uid + 1), arg1); } int func_80335354(int uid, struct46s *arg1){ - return func_80244608(func_8024F758(), (s16) (uid + 1), arg1); + return func_80244608(music_get_sound_bank(), (s16) (uid + 1), arg1); } void func_80335394(s32 arg0, f32 arg1){ - func_80244978(arg0, 0x10, reinterpret_cast(s32, arg1)); + func_80244978(arg0, AL_SEQP_STOP_EVT, reinterpret_cast(s32, arg1)); } void func_803353BC(s32 arg0, u16 arg1){ if(arg1 > 0x7fff) arg1 = 0x7fff; - func_80244978(arg0, 0x8, arg1); + func_80244978(arg0, AL_SEQP_PROG_EVT, arg1); } void func_803353F4(s32 arg0, s32 arg1){ @@ -65,7 +65,7 @@ void func_803353F4(s32 arg0, s32 arg1){ } void func_80335418(s32 arg0, s32 arg1){ - func_80244978(arg0, 0x4, arg1); + func_80244978(arg0, AL_SEQ_END_EVT, arg1); } void func_8033543C(Struct81s *arg0){ @@ -83,17 +83,17 @@ u32 func_80335494(Struct81s *arg0){ } s32 func_803354B4(void){ - return D_80383604->instArray[0]->soundCount; + return sfx_sound_bank->instArray[0]->soundCount; } s32 func_803354C8(void){ - return func_8024F758()->instArray[0]->soundCount; + return music_get_sound_bank()->instArray[0]->soundCount; } bool func_803354EC(enum sfx_e sfx_id){ - return func_802445C4(D_80383604, (s16)(sfx_id + 1)); + return func_802445C4(sfx_sound_bank, (s16)(sfx_id + 1)); } bool func_80335520(s32 arg0){ - return func_802445C4(func_8024F758(), (s16)(arg0 + 1)); + return func_802445C4(music_get_sound_bank(), (s16)(arg0 + 1)); } diff --git a/src/core2/code_B5E00.c b/src/core2/code_B5E00.c index e042dc6a..b339f91c 100644 --- a/src/core2/code_B5E00.c +++ b/src/core2/code_B5E00.c @@ -16,12 +16,12 @@ int __gameFile_8033CD90(s32 filenum){ void *save_data_ptr; save_data_ptr = &gameFile_saveData[filenum]; i = 3; - while(i != 0){ + do{ tmp_v1 = savedata_8033CA2C(filenum, save_data_ptr); if(!tmp_v1) break; i--; - } + }while(i != 0); if(tmp_v1) savedata_clear(save_data_ptr); return tmp_v1; @@ -32,34 +32,39 @@ void __gameFile_8033CE14(s32 gamenum){ } void gameFile_8033CE40(void) { - s32 i; - s32 var_s0; - s32 sp48[4]; + s32 game_index; + s32 file_index; + s32 file_state[4]; - + //unmap all files D_80383F04 = -1; - sp48[3] = i = 0; - if (sp48[3] < 3) { - for(i = i; i < 3; i++) { - gameFile_GameIdToFileIdMap[i] = -1; - sp48[i] = 0; - i++; i--; //do nothing + file_state[3] = game_index = 0; + if (file_state[3] < 3) { + for(game_index = game_index; game_index < 3; game_index++) { + gameFile_GameIdToFileIdMap[game_index] = -1; + file_state[game_index] = 0; + game_index++; game_index--; //do nothing } } - for(var_s0 = 0; var_s0 < 4; var_s0++){ - if( (__gameFile_8033CD90(var_s0) == 0) && (gameFile_GameIdToFileIdMap[gameFile_saveData[var_s0].unk1 - 1] == -1)) { - gameFile_GameIdToFileIdMap[gameFile_saveData[var_s0].unk1 - 1] = var_s0; - sp48[var_s0] = 1; + + //map games to files + for(file_index = 0; file_index < 4; file_index++){ + if( (__gameFile_8033CD90(file_index) == 0) + && (gameFile_GameIdToFileIdMap[gameFile_saveData[file_index].unk1 - 1] == -1) + ) { + gameFile_GameIdToFileIdMap[gameFile_saveData[file_index].unk1 - 1] = file_index; + file_state[file_index] = 1; } else { - D_80383F04 = var_s0; + D_80383F04 = file_index; } } - sp48[D_80383F04] = 1; - for(i = 0; i < 3; i++){ - for(var_s0 = 0; (var_s0 < 4) && (gameFile_GameIdToFileIdMap[i] == -1); var_s0++){ - if (sp48[var_s0] == 0) { - sp48[var_s0] = 1; - gameFile_GameIdToFileIdMap[i] = var_s0; + + file_state[D_80383F04] = 1; + for(game_index = 0; game_index < 3; game_index++){ + for(file_index = 0; (file_index < 4) && (gameFile_GameIdToFileIdMap[game_index] == -1); file_index++){ + if (file_state[file_index] == 0) { + file_state[file_index] = 1; + gameFile_GameIdToFileIdMap[game_index] = file_index; } } } @@ -70,18 +75,18 @@ s32 gameFile_8033CFD4(s32 gamenum){ s32 filenum; u32 i = 3; s32 eeprom_error; - SaveData *var_a1; + SaveData *save_data; filenum = D_80383F04; next = gameFile_GameIdToFileIdMap[gamenum]; gameFile_GameIdToFileIdMap[gamenum] = D_80383F04; bcopy(&gameFile_saveData[next], &gameFile_saveData[filenum], 0xF*8); - var_a1 = gameFile_saveData + filenum; - var_a1->unk1 = gamenum + 1; - savedata_update_crc(var_a1, sizeof(SaveData)); + save_data = gameFile_saveData + filenum; + save_data->unk1 = gamenum + 1; + savedata_update_crc(save_data, sizeof(SaveData)); for(eeprom_error = 1; eeprom_error && i > 0; i--){//L8033D070 - eeprom_error = savedata_8033CC98(filenum, var_a1); + eeprom_error = savedata_8033CC98(filenum, save_data); if(!eeprom_error){ __gameFile_8033CE14(gamenum); } diff --git a/src/core2/code_B6EA0.c b/src/core2/code_B6EA0.c index 4afb40fd..22cd0e4c 100644 --- a/src/core2/code_B6EA0.c +++ b/src/core2/code_B6EA0.c @@ -1,8 +1,9 @@ +#include "code_B6EA0.h" #include #include "functions.h" #include "variables.h" -#include "code_B6EA0.h" +#include "core2/anim/sprite.h" extern s32 func_8033FA84(void); extern s32 func_8035287C(void); @@ -13,7 +14,6 @@ extern void func_8033FFB8(s32 , s32); extern void projectile_getPosition(s32 , f32[3]); extern void func_8032F64C(f32[3] , ActorMarker *); extern void func_8033FB64(s32); -extern void func_80287D60(s32); extern void func_803529DC(s32); extern void func_80344D70(s32); extern void func_80352B20(s32); @@ -153,8 +153,8 @@ void func_8033E1E0(void){ projectile_getPosition(D_80384490[D_80384FD0].unk45, sp4C); func_803451B0(D_80384490[D_80384FD0].unk47, sp4C); projectile_setPosition(D_80384490[D_80384FD0].unk45, sp4C); - func_80287DC8(D_80384490[D_80384FD0].unk34); - func_8033FFB8(D_80384490[D_80384FD0].unk45, func_80287FFC(D_80384490[D_80384FD0].unk34)); + animsprite_update(D_80384490[D_80384FD0].unk34); + func_8033FFB8(D_80384490[D_80384FD0].unk45, animsprite_get_frame(D_80384490[D_80384FD0].unk34)); func_8032F64C(sp4C, D_80384490[D_80384FD0].marker_30); } else{ @@ -192,7 +192,7 @@ int func_8033E3F0(enum common_particle_e particle_id, int arg1){ D_80384490[D_80384FD0].unk45 = func_8033FA84(); - D_80384490[D_80384FD0].unk34 = func_80287CA8(); + D_80384490[D_80384FD0].unk34 = animsprite_new(); D_80384490[D_80384FD0].unk46 = func_8035287C(); D_80384490[D_80384FD0].unk47 = func_80344CDC(); @@ -207,7 +207,7 @@ int func_8033E3F0(enum common_particle_e particle_id, int arg1){ } a0 = D_80384490[D_80384FD0].unk34; if(a0){ - func_80287D60(a0); + animsprite_free(a0); } a0 = D_80384490[D_80384FD0].unk46; if(a0){ @@ -227,7 +227,7 @@ int func_8033E3F0(enum common_particle_e particle_id, int arg1){ func_8032FFEC(D_80384490[D_80384FD0].marker_30, (u32)D_80384FD0); D_80384490[D_80384FD0].marker_30->collidable = FALSE; func_80352A38(D_80384490[D_80384FD0].unk46, particle_id); - func_8033FFB8(D_80384490[D_80384FD0].unk45, func_80287FFC(D_80384490[D_80384FD0].unk34)); + func_8033FFB8(D_80384490[D_80384FD0].unk45, animsprite_get_frame(D_80384490[D_80384FD0].unk34)); projectile_getPosition(D_80384490[D_80384FD0].unk45, sp34); func_8032F64C(sp34, D_80384490[D_80384FD0].marker_30); return D_80384FD0; @@ -238,7 +238,7 @@ void func_8033E6D4(s32 arg0){ func_803529DC(D_80384490[arg0].unk46); func_80344D70(D_80384490[arg0].unk47); func_8033FB64(D_80384490[arg0].unk45); - func_80287D60(D_80384490[arg0].unk34); + animsprite_free(D_80384490[arg0].unk34); marker_free(D_80384490[arg0].marker_30); D_80384490[arg0].marker_30 = NULL; D_80384490[arg0].unk38 = 0; @@ -288,7 +288,7 @@ u8 func_8033E8D0(void){ return D_80384490[D_80384FD0].unk45; } -struct54s * func_8033E8F4(void){ +AnimSprite * func_8033E8F4(void){ return D_80384490[D_80384FD0].unk34; } diff --git a/src/core2/code_B6EA0.h b/src/core2/code_B6EA0.h index 9835bedb..8a883ccb 100644 --- a/src/core2/code_B6EA0.h +++ b/src/core2/code_B6EA0.h @@ -4,6 +4,7 @@ #include #include "functions.h" #include "variables.h" +#include "core2/anim/sprite.h" typedef s32 (*FuncUnk40)(ActorMarker *, s32, f32[3]); @@ -16,7 +17,7 @@ typedef struct particle_struct_1_s{ s32 unk28; u8 pad24[0x4]; ActorMarker *marker_30; - struct54s *unk34; + AnimSprite *unk34; ActorMarker *unk38; s32 unk3C; FuncUnk40 unk40; @@ -39,7 +40,7 @@ typedef struct particle_struct_0_s{ s32 unk28; u8 pad24[0x4]; ActorMarker *marker_30; - struct54s *unk34; + AnimSprite *unk34; ActorMarker *unk38; s32 unk3C; FuncUnk40 unk40; @@ -52,7 +53,7 @@ typedef struct particle_struct_0_s{ ActorMarker *func_8033E864(void); FuncUnk40 func_8033E888(void); u8 func_8033E8D0(void); -struct54s *func_8033E8F4(void); +AnimSprite *func_8033E8F4(void); ParticleStruct0s *func_8033E960(void); void func_8033E984(void); void projectile_setSprite(u8, enum asset_e); diff --git a/src/core2/code_C8760.c b/src/core2/code_C8760.c index 75ffb6d5..57110965 100644 --- a/src/core2/code_C8760.c +++ b/src/core2/code_C8760.c @@ -55,8 +55,8 @@ void func_8034F774(void){ sfxsource_setSfxId(D_803720A0.unk5, 0x3EC); func_8030DD14(D_803720A0.unk5, 3); func_8030DFF0(D_803720A0.unk5, 1); - func_8030DF68(D_803720A0.unk5, &sp44); - func_8030DEB4(D_803720A0.unk5, 400.0f, 3200.0f); + sfxsource_set_position(D_803720A0.unk5, &sp44); + sfxsource_set_fade_distances(D_803720A0.unk5, 400.0f, 3200.0f); func_8030DE44(D_803720A0.unk5, 2, 0.5f); func_8030E2C4(D_803720A0.unk5); } diff --git a/src/core2/code_CB610.c b/src/core2/code_CB610.c index 8d1c1ba4..4134a9a3 100644 --- a/src/core2/code_CB610.c +++ b/src/core2/code_CB610.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" + +#include "core2/anim/sprite.h" #include "code_B6EA0.h" extern u8 func_8033E8D0(void); @@ -27,7 +29,7 @@ void func_80352614(void){} void func_8035261C(void) { ParticleStruct0s *sp2C; u8 sp2B; - struct54s *sp24; + AnimSprite *sp24; u8 sp23; s32 sp1C; f32 temp_f6; @@ -43,8 +45,8 @@ void func_8035261C(void) { projectile_setSprite(sp2B, ASSET_718_SPRITE_SPARKLE_WHITE_2); func_8033FFE4(sp2B, sp1C, sp1C); func_8033FCD8(sp2B, 0xC); - func_80287E9C(sp24); - func_80287F7C(sp24, 3); + animsprite_default(sp24); + animsprite_set_state(sp24, ANIM_SPRITE_STATE_STOPPED); func_80344E18(sp23, 3); } diff --git a/src/core2/code_CBD10.c b/src/core2/code_CBD10.c index 20807352..e2da7b97 100644 --- a/src/core2/code_CBD10.c +++ b/src/core2/code_CBD10.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" + +#include "core2/anim/sprite.h" #include "code_B6EA0.h" extern f32 func_8033DDEC(void); @@ -13,7 +15,7 @@ extern void func_80344D94(u8, f32[3]); extern void func_80344E3C(u8, f32[3]); /* .data */ -struct53s D_80372670[] = { +AnimSpriteStep D_80372670[] = { { 0x0, 1}, { 0x1, 1}, { 0x2, 1}, @@ -68,7 +70,7 @@ s32 func_80352D9C(void) { void func_80352DE4(void) { u8 temp_s0; - struct54s *sp58; + AnimSprite *sp58; u8 sp57; ParticleStruct0s *temp_s1; f32 sp44[3]; @@ -92,10 +94,10 @@ void func_80352DE4(void) { sp2C[1] = 0.0f; sp2C[2] = randf() * 359.0f; func_8033FD98(temp_s0, sp2C); - func_80287E9C(sp58); - func_80287F7C(sp58, 1); - func_80287F50(sp58, D_80372670, 0x28); - func_80287F10(sp58); + animsprite_default(sp58); + animsprite_set_state(sp58, ANIM_SPRITE_STATE_ONCE); + animsprite_set_steps(sp58, D_80372670, sizeof(D_80372670)); + animsprite_loop(sp58); sp38[0] = 0.0f; sp38[1] = 40.0f; sp38[2] = 0.0f; @@ -107,10 +109,10 @@ void func_80352DE4(void) { void func_80352F58(void){ f32 *sp2C = func_8033E960(); - struct54s *sp28 = func_8033E8F4(); + AnimSprite *sp28 = func_8033E8F4(); u8 sp27 = func_8033E8D0(); f32 sp20 = func_8033DDEC(); - if(func_80288034(sp28)){ + if(animsprite_is_stopped(sp28)){ func_8033E984(); } else{ diff --git a/src/core2/code_CC1E0.c b/src/core2/code_CC1E0.c index 9d97997f..ae89d5ed 100644 --- a/src/core2/code_CC1E0.c +++ b/src/core2/code_CC1E0.c @@ -3,6 +3,7 @@ #include "variables.h" #include "code_B6EA0.h" +#include "core2/anim/sprite.h" extern void func_80244D94(f32[3], f32[3], f32[3], u32, f32); @@ -27,7 +28,7 @@ extern ActorProp *func_80320EB0(ActorMarker *, f32, s32); void fxegg_collide(s32 arg0, ActorMarker *arg1, s32 arg2); /* .data */ -struct53s D_803726A0[] = { +AnimSpriteStep D_803726A0[] = { {9, 1}, {8, 1}, {7, 1}, @@ -156,7 +157,7 @@ void func_80353580(ActorMarker *marker){ void fxegg_head_spawn(void){ u8 projectile_indx = func_8033E8D0(); - struct54s *sp78 = func_8033E8F4(); + AnimSprite *sp78 = func_8033E8F4(); u8 sp77 = func_8033E93C(); f32 sp68[3]; f32 sp5C[3]; @@ -187,9 +188,9 @@ void fxegg_head_spawn(void){ projectile_setPosition(projectile_indx, sp50); func_8033FCD8(projectile_indx, 0xe); - func_80287E9C(sp78); - func_80287F50(sp78, D_803726A0, 0x14); - func_80287F10(sp78); + animsprite_default(sp78); + animsprite_set_steps(sp78, D_803726A0, sizeof(D_803726A0)); + animsprite_loop(sp78); func_80344E18(sp77, 1); func_80344EE4(sp77, 0.0f, 0.0f); @@ -263,7 +264,7 @@ void fxegg_head_destroy(void){} void fxegg_ass_spawn(void) { u8 projectile_indx; - struct54s *sp58; + AnimSprite *sp58; u8 sp57; f32 sp48[3]; f32 marker[3]; @@ -293,9 +294,9 @@ void fxegg_ass_spawn(void) { func_8033FFE4(projectile_indx, (s32)temp_f18, (s32)temp_f18); projectile_setPosition(projectile_indx, marker); func_8033FCD8(projectile_indx, 0xE); - func_80287E9C(sp58); - func_80287F50(sp58, &D_803726A0, 0x14); - func_80287F10(sp58); + animsprite_default(sp58); + animsprite_set_steps(sp58, D_803726A0, sizeof(D_803726A0)); + animsprite_loop(sp58); func_80344E18(sp57, 4); func_80344EE4(sp57, -2200.0f, -22000.0f); func_80344D94(sp57, marker); diff --git a/src/core2/code_CD0A0.c b/src/core2/code_CD0A0.c index 09173bd5..8004dc33 100644 --- a/src/core2/code_CD0A0.c +++ b/src/core2/code_CD0A0.c @@ -2,6 +2,7 @@ #include "functions.h" #include "variables.h" +#include "core2/anim/sprite.h" #include "code_B6EA0.h" struct{ @@ -31,7 +32,7 @@ void func_803540AC(void){} void func_803540B4(void){ ParticleStruct0s *sp34; u8 sp33; - struct54s *sp2C; + AnimSprite *sp2C; u8 sp2B; f32 sp1C[3]; @@ -43,8 +44,8 @@ void func_803540B4(void){ projectile_setSprite(sp33, D_803863D0.unk0 + 0x710); func_8033FFE4(sp33, D_803863D0.unk4, D_803863D0.unk4); func_8033FCD8(sp33, 0xC); - func_80287E9C(sp2C); - func_80287F7C(sp2C, 3); + animsprite_default(sp2C); + animsprite_set_state(sp2C, ANIM_SPRITE_STATE_STOPPED); sp1C[0] = randf2(-100.0f, 100.0f); sp1C[1] = randf2(-100.0f, 100.0f); sp1C[2] = randf2(-100.0f, 100.0f); diff --git a/src/core2/code_CD3F0.c b/src/core2/code_CD3F0.c index fdfa7187..3cc6c690 100644 --- a/src/core2/code_CD3F0.c +++ b/src/core2/code_CD3F0.c @@ -3,6 +3,7 @@ #include "variables.h" #include "code_B6EA0.h" +#include "core2/anim/sprite.h" extern f64 D_80379470; extern f32 D_80379478; @@ -27,7 +28,7 @@ void func_803543F4(void){} void func_803543FC(void) { ParticleStruct0s* sp3C; u8 sp3B; - struct54s* sp34; + AnimSprite* sp34; u8 sp33; f32 sp24[3]; s32 temp_f16; @@ -42,8 +43,8 @@ void func_803543FC(void) { projectile_setSprite(sp3B, ASSET_710_SPRITE_SPARKLE_PURPLE); func_8033FFE4(sp3B, temp_f16, temp_f16); func_8033FCD8(sp3B, 0xC); - func_80287E9C(sp34); - func_80287F7C(sp34, 3); + animsprite_default(sp34); + animsprite_set_state(sp34, ANIM_SPRITE_STATE_STOPPED); sp24[0] = randf2(-100.0f, 100.0f); sp24[1] = 250.0f; sp24[2] = randf2(-100.0f, 100.0f); diff --git a/src/core2/code_CD6E0.c b/src/core2/code_CD6E0.c index c3550eb2..ddded45e 100644 --- a/src/core2/code_CD6E0.c +++ b/src/core2/code_CD6E0.c @@ -3,6 +3,7 @@ #include "variables.h" #include "code_B6EA0.h" +#include "core2/anim/sprite.h" extern f32 player_getYaw(void); extern void projectile_getPosition(u8 arg0, f32 arg1[3]); @@ -22,7 +23,7 @@ void func_80354670(u8 arg0, s32 arg1) { void func_803546E8(void) { u8 sp4F; - struct54s* sp48; + AnimSprite* sp48; u8 sp47; ParticleStruct1s* temp_s0; f32 sp34[3]; @@ -44,8 +45,8 @@ void func_803546E8(void) { projectile_setSprite(sp4F, ASSET_713_SPRITE_SPARKLE_YELLOW); projectile_setPosition(sp4F, sp34); func_8033FCD8(sp4F, 0xC); - func_80287E9C(sp48); - func_80287F7C(sp48, 3); + animsprite_default(sp48); + animsprite_set_state(sp48, ANIM_SPRITE_STATE_STOPPED); func_80344E18(sp47, 5); func_80344EE4(sp47, -700.0f, -22000.0f); func_802589E4(sp28, D_803726EC, 250.0f); @@ -90,7 +91,7 @@ void func_80354990(void){} void func_80354998(void) { u8 sp57; ActorMarker *sp50; - struct54s *sp4C; + AnimSprite *sp4C; u8 sp4B; ParticleStruct1s *temp_s0; f32 sp38[3]; @@ -110,9 +111,9 @@ void func_80354998(void) { temp_s0->unkC[0] = 0.0f; temp_s0->unkC[1] = -0.05f; temp_s0->unkC[2] = 0.0f; - func_80287E9C(sp4C); - func_80287FD0(sp4C, 3.0f); - func_80287F7C(sp4C, 3); + animsprite_default(sp4C); + animsprite_set_speed(sp4C, 3.0f); + animsprite_set_state(sp4C, ANIM_SPRITE_STATE_STOPPED); switch (sp50->modelId) { /* irregular */ case 0x3BB: sp28 = 7; @@ -216,7 +217,7 @@ void func_80354DC8(void){} void func_80354DD0(void) { ParticleStruct1s* temp_s0; - struct54s* sp40; + AnimSprite* sp40; u8 sp3F; u8 pad3C[3]; u8 temp_s1; @@ -234,8 +235,8 @@ void func_80354DD0(void) { projectile_setSprite(temp_s1, ASSET_710_SPRITE_SPARKLE_PURPLE); func_8033FC60(temp_s1, 0xE1, 0xFF, 0); projectile_setPosition(temp_s1, sp2C); - func_80287E9C(sp40); - func_80287F7C(sp40, 3); + animsprite_default(sp40); + animsprite_set_state(sp40, ANIM_SPRITE_STATE_STOPPED); func_80344E18(sp3F, 3); sp20[0] = 0.0f; sp20[1] = 0.0f; @@ -285,7 +286,7 @@ void func_80355004(void){} void func_8035500C(void) { u8 sp47; - struct54s* sp40; + AnimSprite* sp40; u8 sp3F; ParticleStruct1s* temp_s0; f32 sp2C[3]; @@ -302,9 +303,9 @@ void func_8035500C(void) { projectile_setSprite(sp47, 0x70F); func_8033FC60(sp47, 0xFF, 0xE6, 0xF5); projectile_setPosition(sp47, sp2C); - func_80287E9C(sp40); - func_80287F7C(sp40, 3); - func_80287FB4(sp40, 0); //set frame + animsprite_default(sp40); + animsprite_set_state(sp40, ANIM_SPRITE_STATE_STOPPED); + animsprite_set_frame(sp40, 0); //set frame func_80344E18(sp3F, 3); sp20[0] = 0.0f; sp20[1] = 0.0f; @@ -356,7 +357,7 @@ void func_80355294(void){} void func_8035529C(void) { u8 sp4F; - struct54s* sp48; + AnimSprite* sp48; u8 sp47; ParticleStruct1s* sp40; f32 sp34[3]; @@ -373,9 +374,9 @@ void func_8035529C(void) { projectile_setSprite(sp4F, 0x70F); func_8033FC60(sp4F, randi2(0xD2, 0xFF), randi2(0xBE, 0xFF), randi2(0xC8, 0xFF)); projectile_setPosition(sp4F, sp34); - func_80287E9C(sp48); - func_80287F7C(sp48, 3); - func_80287FB4(sp48, 0); + animsprite_default(sp48); + animsprite_set_state(sp48, ANIM_SPRITE_STATE_STOPPED); + animsprite_set_frame(sp48, 0); func_80344E18(sp47, 3); sp28[0] = 0.0f; sp28[1] = 0.0f; @@ -428,7 +429,7 @@ void func_80355548(void){} void func_80355550(void) { static s32 D_803863E0; u8 sp3F; - struct54s *sp38; + AnimSprite *sp38; u8 sp37; ParticleStruct1s *sp30; f32 sp24[3]; @@ -451,9 +452,9 @@ void func_80355550(void) { } func_8033FC60(sp3F, 0xFF, 0xFF, 0xFF); projectile_setPosition(sp3F, sp24); - func_80287E9C(sp38); - func_80287F7C(sp38, 3); - func_80287FB4(sp38, 0); + animsprite_default(sp38); + animsprite_set_state(sp38, ANIM_SPRITE_STATE_STOPPED); + animsprite_set_frame(sp38, 0); if (D_803863E0 >= 4) { D_803863E0 = 0; } @@ -506,7 +507,7 @@ void func_8035585C(void){} void func_80355864(void) { u8 sp5F; - struct54s *sp58; + AnimSprite *sp58; u8 sp57; static s32 D_803863E4; f32 var_f2; @@ -533,9 +534,9 @@ void func_80355864(void) { projectile_setSprite(sp5F, 0x713); projectile_setPosition(sp5F, &sp38); func_8033FCD8(sp5F, 0xC); - func_80287E9C(sp58); - func_80287F7C(sp58, 3); - func_80287FD0(sp58, (sp44)? 16.0 : 3.0); + animsprite_default(sp58); + animsprite_set_state(sp58, ANIM_SPRITE_STATE_STOPPED); + animsprite_set_speed(sp58, (sp44)? 16.0 : 3.0); func_80344E18(sp57, 5); func_80344EE4(sp57, -700.0f, -22000.0f); sp28 = (sp44) ? randf2(-75.0f, 75.0f) + 400.0f diff --git a/src/core2/code_CECD0.c b/src/core2/code_CECD0.c index 87ecd80a..6d8a2813 100644 --- a/src/core2/code_CECD0.c +++ b/src/core2/code_CECD0.c @@ -3,6 +3,7 @@ #include "variables.h" #include "code_B6EA0.h" +#include "core2/anim/sprite.h" typedef struct { s32 unk0;//asset_id @@ -40,7 +41,7 @@ void func_80355D50(void){} void func_80355D58(void){ ParticleStruct0s * sp3C; u8 sp3B; - struct54s *sp34; + AnimSprite *sp34; u8 temp_s0; f32 sp24[3]; @@ -52,8 +53,8 @@ void func_80355D58(void){ projectile_setSprite(sp3B, D_803726F0.unk0 + ASSET_710_SPRITE_SPARKLE_PURPLE); func_8033FFE4(sp3B, D_803726F0.unk4, D_803726F0.unk4); func_8033FCD8(sp3B, 0xC); - func_80287E9C(sp34); - func_80287F7C(sp34, 3); + animsprite_default(sp34); + animsprite_set_state(sp34, ANIM_SPRITE_STATE_STOPPED); sp24[0] = randf2(-40.0f, 40.0f); sp24[1] = randf2(-40.0f, 40.0f); diff --git a/src/core2/code_CF090.c b/src/core2/code_CF090.c index 179cad35..daacb50c 100644 --- a/src/core2/code_CF090.c +++ b/src/core2/code_CF090.c @@ -3,9 +3,10 @@ #include "variables.h" #include "code_B6EA0.h" +#include "core2/anim/sprite.h" /* .data */ -struct53s D_80372700[] = { +AnimSpriteStep D_80372700[] = { {0x00, 1}, {0x01, 1}, {0x02, 1}, @@ -56,7 +57,7 @@ void func_80356074(f32 arg0[3], f32 arg1[3], f32 arg2, f32 arg3){ void func_8035611C(void){ u8 temp_s0; - struct54s *sp58; + AnimSprite *sp58; u8 sp57; ParticleStruct0s *sp54; f32 sp44[3]; @@ -81,10 +82,10 @@ void func_8035611C(void){ sp2C[1] = 0.0f; sp2C[2] = randf()*359.0f; func_8033FD98(temp_s0, sp2C); - func_80287E9C(sp58); - func_80287F7C(sp58, 1); - func_80287F50(sp58, D_80372700, 0x28); - func_80287F10(sp58); + animsprite_default(sp58); + animsprite_set_state(sp58, ANIM_SPRITE_STATE_ONCE); + animsprite_set_steps(sp58, D_80372700, sizeof(D_80372700)); + animsprite_loop(sp58); sp38[0] = 0.0f; sp38[1] = 40.0f; @@ -97,13 +98,13 @@ void func_8035611C(void){ void func_803562E8(void){ ParticleStruct0s *sp24; - struct54s *sp20; + AnimSprite *sp20; u8 sp1F; sp24 = func_8033E960(); sp20 = func_8033E8F4(); sp1F = func_8033E8D0(); - if(func_80288034(sp20)){ + if(animsprite_is_stopped(sp20)){ func_8033E984(); } else{ diff --git a/src/core2/gc/section.c b/src/core2/gc/section.c index ee9be77a..006ece56 100644 --- a/src/core2/gc/section.c +++ b/src/core2/gc/section.c @@ -263,7 +263,7 @@ bool func_8030AF58(enum map_e arg0) { void func_8030AFA0(enum map_e arg0){ s32 level = map_getLevel(arg0); if(level > 0 && level < LEVEL_C_BOSS){ - func_80332BEC(arg0); + jiggylist_set_level(arg0); } } diff --git a/src/core2/mapModel.c b/src/core2/mapModel.c index e749f78c..1e447f8e 100644 --- a/src/core2/mapModel.c +++ b/src/core2/mapModel.c @@ -343,7 +343,7 @@ void mapModel_opa_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) { } modelRender_setEnvColor(mapModel.env_red, mapModel.env_green, mapModel.env_blue, 0xFF); modelRender_draw(gfx, mtx, NULL, NULL, mapModel.description->scale, NULL, mapModel.model_bin_opa); - if (!func_80309F78()) { + if (!mapModel_has_xlu_bin()) { func_802F7BC0(gfx, mtx, vtx); } } @@ -539,7 +539,7 @@ UNK_TYPE(s32) func_80309EB0(f32 arg0[3], f32 arg1, f32 arg2[3], s32 arg3) { return (temp_v0_2 != 0) ? temp_v0_2 : sp24; } -bool func_80309F78(void) { +bool mapModel_has_xlu_bin(void) { return (mapModel.model_bin_opa != NULL) && (mapModel.model_bin_xlu != NULL); } diff --git a/src/core2/timedfuncqueue.c b/src/core2/timedfuncqueue.c index 66a5a63a..419e1559 100644 --- a/src/core2/timedfuncqueue.c +++ b/src/core2/timedfuncqueue.c @@ -150,7 +150,7 @@ void func_80324BA0(s32 arg0){ } void __spawnjiggy(DelayedJiggyInfo *jigInfo){ - jiggySpawn(jigInfo->id, jigInfo->pos); + jiggy_spawn(jigInfo->id, jigInfo->pos); } void func_80324C58(void){ diff --git a/src/lair/code_0.c b/src/lair/code_0.c index b24a7d0a..3d00e15d 100644 --- a/src/lair/code_0.c +++ b/src/lair/code_0.c @@ -820,7 +820,7 @@ void func_80387F1C(void) if (nodeProp_findPositionFromActorId(400, tmp)) { - jiggySpawn(JIGGY_35_LAIR_CC_WITCH_SWITCH, tmp); + jiggy_spawn(JIGGY_35_LAIR_CC_WITCH_SWITCH, tmp); // FIXME: macro? __spawnQueue_add_4((GenFunction_4)func_802C4140, ACTOR_4C_STEAM, *(s32 *)&tmp[0], *(s32 *)&tmp[1], *(s32 *)&tmp[2]); } From 676533f2dc6465c2be61c1aee4167a1328b9d194 Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Sat, 29 Jun 2024 14:38:46 -0500 Subject: [PATCH 13/38] Include nonmatched functions in README --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index df08d5b9..7c97e529 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,22 @@ - - +## Remaining Functions +These all are the remaining NTSC-USA V1.0 function left to be matched. +Be sure to check scratch "family" for any progress that may not be reflected here + +| File | Function | Scratch Link | % | Notes | +| ------------------ | --------------- | ---------------------------------------- | ------ | ----- | +| core2/code_C4B0.c | func_80293668 | [rOskO](https://decomp.me/scratch/rOskO) | 86.41% | +| core2/code_12F30.c | func_80299EC0 | [Ar62G](https://decomp.me/scratch/Ar62G) | 77.65% | +| core2/code_7AF80.c | func_80307948 | [zd8KD](https://decomp.me/scratch/zd8KD) | 85.40% | +| core2/code_7AF80.c | func_80308984 | [tFOGA](https://decomp.me/scratch/tFOGA) | 79.77% | +| core2/code_87E30.c | gcdialog_update | [cPns0](https://decomp.me/scratch/cPns0) | 92.23% | +| core2/code_98CB0.c | func_8031FC40 | [m2Bd9](https://decomp.me/scratch/m2Bd9) | 99.57% | address scrambling and unscrambling | +| core2/code_A5BC0.c | func_8032F194 | [G2oc8](https://decomp.me/scratch/G2oc8) | 81.12% | +| core2/code_B9770.c | func_80340BE4 | [FXyYS](https://decomp.me/scratch/FXyYS) | 65.91% | spline function +| core2/code_B9770.c | func_803411B0 | [rHkDu](https://decomp.me/scratch/rHkDu) | 87.70% | spline function + ## Building Grab tools From 9688497485efa12add3bdce09a206cd7f162e294 Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Mon, 1 Jul 2024 00:28:11 -0500 Subject: [PATCH 14/38] various documentation --- include/core1/core1.h | 2 - include/core2/nc/camera.h | 2 +- include/functions.h | 2 +- include/gc/gctransition.h | 6 +- include/prop.h | 2 +- include/structs.h | 17 - src/BGS/bss_pad.c | 2 +- src/BGS/ch/flibbit.c | 2 +- src/BGS/ch/yellowflibbit.c | 2 +- src/BGS/code_3030.c | 2 +- src/CC/code_13C0.c | 4 +- src/CC/code_1F70.c | 4 +- src/CCW/code_160.c | 2 +- src/FP/bss_end_pad.c | 2 +- src/FP/bss_pad.c | 2 +- src/FP/ch/boggy2.c | 3 +- src/FP/ch/twinkly.c | 4 +- src/FP/ch/wozza.c | 6 +- src/FP/code_ABD0.c | 2 +- src/FP/racectrl.c | 6 +- src/GV/bss_pad.c | 2 +- src/GV/ch/mazectrl.c | 16 +- src/GV/code_9B70.c | 4 +- src/GV/code_9C10.c | 4 +- src/GV/matchinggame.c | 2 +- src/MM/bss_pad.c | 2 +- src/MMM/bss_pad.c | 2 +- src/MMM/ch/napper.c | 2 +- src/MMM/code_47D0.c | 4 +- src/RBB/code_640.c | 2 +- src/core1/code_10A00.c | 2 +- src/core1/code_13990.c | 362 +++++++++-------- src/core1/code_18350.c | 4 +- src/core1/code_1BE90.c | 2 +- src/core1/code_2FA0.c | 4 +- src/core1/code_3250.c | 4 +- src/core1/code_3A70.c | 10 +- src/core1/code_7F60.c | 54 +-- src/core1/code_ABB0.c | 2 +- src/core1/code_EAF0.c | 126 +++--- src/core1/data_1E820.c | 2 +- src/core1/memory.c | 2 +- src/core1/os/kdebugserver.c | 2 +- src/core2/bs/bFly.c | 2 +- src/core2/ch/badShad.c | 4 +- src/core2/ch/bottlesbonus.c | 6 +- src/core2/ch/code_468E0.c | 4 +- src/core2/ch/gravestone.c | 2 +- src/core2/ch/overlaynocontroller.c | 4 +- src/core2/ch/overlaypressstart.c | 4 +- src/core2/ch/shrapnel.c | 4 +- src/core2/ch/snowball.c | 3 +- src/core2/ch/termite.c | 2 +- src/core2/code_14420.c | 4 +- src/core2/code_33C30.c | 4 +- src/core2/code_34790.c | 18 +- src/core2/code_37E50.c | 2 +- src/core2/code_43800.c | 2 +- src/core2/code_45310.c | 2 +- src/core2/code_55390.c | 4 +- src/core2/code_55850.c | 4 +- src/core2/code_59780.c | 2 +- src/core2/code_5C870.c | 18 +- src/core2/code_5FD90.c | 19 +- src/core2/code_637D0.c | 44 +-- src/core2/code_654C0.c | 2 +- src/core2/code_6A4B0.c | 4 +- src/core2/code_6B030.c | 4 +- src/core2/code_6D270.c | 2 +- src/core2/code_6DA30.c | 2 +- src/core2/code_70F20.c | 2 +- src/core2/code_71820.c | 2 +- src/core2/code_72060.c | 16 +- src/core2/code_7AF80.c | 234 ++++++----- src/core2/code_85800.c | 2 +- src/core2/code_87E30.c | 23 +- src/core2/code_94620.c | 45 +-- src/core2/code_98CB0.c | 18 +- src/core2/code_9E370.c | 10 +- src/core2/code_A5BC0.c | 76 ++-- src/core2/code_AD5B0.c | 6 +- src/core2/code_AEDA0.c | 6 +- src/core2/code_B3A80.c | 2 +- src/core2/code_B8860.c | 6 +- src/core2/code_BD100.c | 12 +- src/core2/code_BE2C0.c | 4 +- src/core2/code_BEF20.c | 2 +- src/core2/code_C4320.c | 6 +- src/core2/code_C97F0.c | 8 +- src/core2/code_F8EAF0.c | 2 +- src/core2/gc/pauseMenu.c | 10 +- src/core2/gc/sky.c | 2 +- src/core2/gc/transition.c | 535 +++++++++++++++----------- src/core2/levelspecificflags.c | 4 +- src/core2/mapModel.c | 2 +- src/core2/modelRender.c | 38 +- src/core2/nc/dynamicCamF.c | 4 +- src/core2/nc/dynamicCamera.c | 16 +- src/core2/nc/randomCamera.c | 12 +- src/core2/nc/staticCamera.c | 4 +- src/core2/quizquestionaskedbitfield.c | 2 +- src/cutscenes/bss_pad.c | 2 +- src/fight/chbossjinjo.c | 4 +- symbol_addrs.us.v10.txt | 2 +- 104 files changed, 1034 insertions(+), 947 deletions(-) diff --git a/include/core1/core1.h b/include/core1/core1.h index 82b04394..7f03b235 100644 --- a/include/core1/core1.h +++ b/include/core1/core1.h @@ -4,8 +4,6 @@ #include "core1/mem.h" void func_8025235C(f32[3], f32[3]); -void func_80252C08(f32[3], f32[3], f32, f32[3]); - void func_80252C08(f32 arg0[3], f32 arg1[3], f32 scale, f32 arg3[3]); #endif diff --git a/include/core2/nc/camera.h b/include/core2/nc/camera.h index e6934dd4..255f839d 100644 --- a/include/core2/nc/camera.h +++ b/include/core2/nc/camera.h @@ -8,4 +8,4 @@ enum camera_type_e{ CAMERA_TYPE_4_RANDOM = 4 }; -#endif \ No newline at end of file +#endif diff --git a/include/functions.h b/include/functions.h index 39a82013..145deaec 100644 --- a/include/functions.h +++ b/include/functions.h @@ -381,7 +381,7 @@ extern s32 func_802F9AA8(enum sfx_e); Actor * func_803055E0(enum actor_e id, s32 pos[3], s32 arg2, s32 arg3, s32 arg4); -Actor * func_803056FC(enum actor_e id, s32 pos[3], s32 yaw); +Actor * spawn_actor(enum actor_e id, s32 pos[3], s32 yaw); f32 func_80309724(f32[3]); BKModelBin *func_8030A428(s32); u8 func_8030D90C(void); diff --git a/include/gc/gctransition.h b/include/gc/gctransition.h index c5b2ad44..a891672a 100644 --- a/include/gc/gctransition.h +++ b/include/gc/gctransition.h @@ -1,12 +1,12 @@ #ifndef __GC_TRANSITION__ #define __GC_TRANSITION__ -void gctransition_8030B740(void); +void gctransition_defrag(void); void gctransition_draw(Gfx **arg0, Mtx **arg1, Vtx **arg2); void gctransition_8030BD4C(void); f32 gctransition_8030BD88(void); -int gctransition_8030BD98(void); -int gctransition_8030BDAC(void); +int gctransition_done(void); +int gctransition_active(void); int gctransition_8030BDC0(void); void gctransition_8030BE3C(void); void gctransition_8030BE60(void); diff --git a/include/prop.h b/include/prop.h index 8759f920..a42f0176 100644 --- a/include/prop.h +++ b/include/prop.h @@ -337,7 +337,7 @@ typedef struct { s16 y; s16 z; struct { - u16 bit15: 9; //selector_value //volume??? diameter + u16 radius: 9; //selector_value //volume??? diameter u16 bit6: 6; //category u16 bit0: 1; }unk6; diff --git a/include/structs.h b/include/structs.h index 14c19aab..023b0166 100644 --- a/include/structs.h +++ b/include/structs.h @@ -246,23 +246,6 @@ typedef struct struct_8_s{ f32 unk60; }struct8s; -typedef struct struct_9_s{ - u8 uid; - u8 unk1; - u8 unk2; - // u8 pad3[1]; - f32 unk4; //duration - s32 unk8; //asset_indx - s32 unkC; //animation_indx - f32 unk10; -}struct9s; - -typedef struct struct_10_s{ - u8 map_indx; - u8 unk1; - u8 unk2; -}struct10s; - typedef struct struct_11_s{ f32 unk0; f32 unk4; diff --git a/src/BGS/bss_pad.c b/src/BGS/bss_pad.c index ca03373b..471c70c7 100644 --- a/src/BGS/bss_pad.c +++ b/src/BGS/bss_pad.c @@ -1 +1 @@ -char pad_BGS_D_80391230[0x10]; \ No newline at end of file +char pad_BGS_D_80391230[0x10]; diff --git a/src/BGS/ch/flibbit.c b/src/BGS/ch/flibbit.c index 0fd3615d..183cb32f 100644 --- a/src/BGS/ch/flibbit.c +++ b/src/BGS/ch/flibbit.c @@ -266,7 +266,7 @@ void func_80386EB0(ActorMarker *this, ActorMarker *other){ Actor *chflibbit_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ Actor *this; ActorLocal_Flibbit *local; - s32 temp_a0; + BoneTransformList *temp_a0; int i; f32 sp7C[3]; f32 phi_f2; diff --git a/src/BGS/ch/yellowflibbit.c b/src/BGS/ch/yellowflibbit.c index aa735f74..c4955360 100644 --- a/src/BGS/ch/yellowflibbit.c +++ b/src/BGS/ch/yellowflibbit.c @@ -297,7 +297,7 @@ Actor *func_8038DE5C(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { s32 var_s0; f32 var_f2; f32 sp7C[3]; - s32 temp_a0_2; + BoneTransformList *temp_a0_2; this = marker_getActor(marker); local = (ActorLocal_Yellow_Flibbit *)&this->local; diff --git a/src/BGS/code_3030.c b/src/BGS/code_3030.c index 4903e82a..d5e81f23 100644 --- a/src/BGS/code_3030.c +++ b/src/BGS/code_3030.c @@ -43,7 +43,7 @@ void func_80389488(Actor *this, s32 next_state) { if (next_state == 3) { func_8030E6A4(SFX_86_TIPTUP_CHORUS_AH, local->unk8, 0x7FFF); skeletalAnim_set(this->unk148, ASSET_12F_ANIM_CHOIR_TURTLE_HURT, 0.1f, 1.75f); - skeletalAnim_setCallback_1(this->unk148, 0.9f, func_80389420, this->marker); + skeletalAnim_setCallback_1(this->unk148, 0.9f, (GenFunction_1)func_80389420, (s32)this->marker); if (local->tiptup_marker != NULL) { func_80388E94(local->tiptup_marker, local->unk0); } diff --git a/src/CC/code_13C0.c b/src/CC/code_13C0.c index 140e8941..de5b4afe 100644 --- a/src/CC/code_13C0.c +++ b/src/CC/code_13C0.c @@ -149,7 +149,7 @@ void func_80387CC0(void){ if(getGameMode() == GAME_MODE_7_ATTRACT_DEMO) return; - viewport_getRotation(sp1C); + viewport_get_rotation_vec3f(sp1C); tmp_v0 = func_8023DB4C(0x7F); if(tmp_v0 >= 0x40){ tmp_v0 = 0x7F - tmp_v0; @@ -158,7 +158,7 @@ void func_80387CC0(void){ if(360.0f <= sp1C[2]){ sp1C[2] -= 360.0f; } - viewport_setRotation(sp1C); + viewport_set_rotation_vec3f(sp1C); } diff --git a/src/CC/code_1F70.c b/src/CC/code_1F70.c index 54508c3a..10d32713 100644 --- a/src/CC/code_1F70.c +++ b/src/CC/code_1F70.c @@ -18,7 +18,7 @@ extern int func_80340020(s32, f32[3], s32, f32, s32, BKVertexList *, f32[3], f32 extern void boneTransformList_getBoneScale(s32, s32, f32[3]); extern void boneTransformList_setBoneScale(s32, s32, f32[3]); extern void func_8033A9A8(s32, s32, f32[3]); -extern void viewport_getPosition(f32[3]); +extern void viewport_get_position_vec3f(f32[3]); extern void ml_vec3f_normalize(f32[3]); extern void func_8033A45C(s32, s32); extern void modelRender_setBoneTransformList(s32); @@ -146,7 +146,7 @@ void CC_func_80388760(Gfx **gfx, Mtx **mtx, Vtx **vtx){ if(D_80389FA0.unk21 == 0) return; - viewport_getPosition(sp98); + viewport_get_position_vec3f(sp98); if(sp98[0] < -2600.0f || 11600.0f < sp98[0]) return; diff --git a/src/CCW/code_160.c b/src/CCW/code_160.c index 0c04fc84..6f43cb4b 100644 --- a/src/CCW/code_160.c +++ b/src/CCW/code_160.c @@ -162,7 +162,7 @@ void func_8038687C(Actor *this) { if (local->unk0 != NULL) { other = marker_getActor(local->unk0); - viewport_getPosition(sp78); + viewport_get_position_vec3f(sp78); sp6C[0] = this->position[0] - sp78[0]; sp6C[1] = this->position[1] - sp78[1]; sp6C[2] = this->position[2] - sp78[2]; diff --git a/src/FP/bss_end_pad.c b/src/FP/bss_end_pad.c index ea1cc140..7c0e2803 100644 --- a/src/FP/bss_end_pad.c +++ b/src/FP/bss_end_pad.c @@ -1 +1 @@ -char pad_FP_803935A8[0x20]; \ No newline at end of file +char pad_FP_803935A8[0x20]; diff --git a/src/FP/bss_pad.c b/src/FP/bss_pad.c index 22ee3257..3ca7500b 100644 --- a/src/FP/bss_pad.c +++ b/src/FP/bss_pad.c @@ -1 +1 @@ -char pad_FP_80392F10[0x10]; \ No newline at end of file +char pad_FP_80392F10[0x10]; diff --git a/src/FP/ch/boggy2.c b/src/FP/ch/boggy2.c index 9a10460d..fe3737db 100644 --- a/src/FP/ch/boggy2.c +++ b/src/FP/ch/boggy2.c @@ -3,7 +3,8 @@ #include "variables.h" extern void func_8028E668(f32[3], f32, f32, f32); - +extern Actor *func_80328230(enum actor_e id, f32 pos[3], f32 rot[3]); +extern NodeProp *cubeList_findNodePropByActorId(enum actor_e, s32[3]); extern f32 func_8038BE20(f32 arg0[3]); typedef struct { diff --git a/src/FP/ch/twinkly.c b/src/FP/ch/twinkly.c index 88639237..f598272e 100644 --- a/src/FP/ch/twinkly.c +++ b/src/FP/ch/twinkly.c @@ -3,6 +3,8 @@ #include "variables.h" extern Actor *func_802EBAE0(UNK_TYPE(s32), f32 position[3], f32 rotation[3], f32 scale, UNK_TYPE(s32), UNK_TYPE(s32), UNK_TYPE(s32), f32, UNK_TYPE(s32)); +extern Struct70s *func_8034C2C4(ActorMarker *marker, s32 arg1); + Actor *func_8038C0B0(ActorMarker *marker, UNK_TYPE(s32) arg1, f32 arg2, UNK_TYPE(s32) arg3); Actor *func_8038C1F8(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); void func_8038C9A0(Actor *this); @@ -42,7 +44,7 @@ ActorInfo D_80391FF4 = { MARKER_203_TWINKLY_RED, ACTOR_335_TWINKLY_RED, ASSET_44 0, 0, 1.0f, 0 }; -s32 FP_D_80392018[4] = {0, 0, 0, func_8038C0B0}; +Struct6Cs FP_D_80392018 = {NULL, NULL, NULL, (void*)func_8038C0B0}; struct43s D_80392028 = { {{-200.0f, 200.0f, -200.0f}, {200.0f, 400.0f, 200.0f}}, {{ 0.0f, -800.0f, 0.0f}, { 0.0f, -800.0f, 0.0f}}, diff --git a/src/FP/ch/wozza.c b/src/FP/ch/wozza.c index 45a5bbb5..e6f0bd99 100644 --- a/src/FP/ch/wozza.c +++ b/src/FP/ch/wozza.c @@ -49,9 +49,9 @@ Actor *func_8038F210(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ } void func_8038F274(void){ - UNK_TYPE(s32) v0 = func_8034C528(0x191); - if(v0){ - func_8034DE60(v0, 0.0f, -500.0f, 0.2f, 1); + Struct70s *v0 = func_8034C528(0x191); + if(v0 != NULL){ + func_8034DE60(&v0->type_6D, 0.0f, -500.0f, 0.2f, 1); } } diff --git a/src/FP/code_ABD0.c b/src/FP/code_ABD0.c index f63797be..c33e79d8 100644 --- a/src/FP/code_ABD0.c +++ b/src/FP/code_ABD0.c @@ -225,7 +225,7 @@ void func_80391744(Actor *this, Actor* other){ } void func_8039180C(Actor *this){ - ActorMarker *sp24; + Actor *sp24; if(!this->initialized){ sp24 = actorArray_findActorFromActorId(0x254); diff --git a/src/FP/racectrl.c b/src/FP/racectrl.c index 7292abe2..3234c89d 100644 --- a/src/FP/racectrl.c +++ b/src/FP/racectrl.c @@ -485,15 +485,15 @@ void FP_func_8038BA88(s32 arg0){ switch(FP_D_803935A8.unkC - FP_D_803935A8.unk8){ case 3: - func_8025AEA0(0x3a, 0x411aa); + func_8025AEA0(0x3a, 266666); break; case 2: - func_8025AEA0(0x3a, 0x493e0); + func_8025AEA0(0x3a, 300000); break; case 4: break; default: - func_8025AEA0(0x3a, 0x51615); + func_8025AEA0(0x3a, 333333); break; diff --git a/src/GV/bss_pad.c b/src/GV/bss_pad.c index e95b9c38..e4c10039 100644 --- a/src/GV/bss_pad.c +++ b/src/GV/bss_pad.c @@ -1 +1 @@ -char pad_GV_D_80391A20[0x10]; \ No newline at end of file +char pad_GV_D_80391A20[0x10]; diff --git a/src/GV/ch/mazectrl.c b/src/GV/ch/mazectrl.c index 664515de..be8d00ce 100644 --- a/src/GV/ch/mazectrl.c +++ b/src/GV/ch/mazectrl.c @@ -27,18 +27,18 @@ ActorInfo chMazeCtrl = { MARKER_1CD_GV_MAZE_CTRL, ACTOR_319_GV_MAZE_CTRL, 0x0, void func_8038F520(f32 arg0){ static f32 D_803915E4[3] = {460.0f, 1400.0f, 0.0f}; static f32 D_803915F0[3] = {0.0f, 0.0f, 0.0f}; - Struct6Ds *tmp_v0 = func_8034C528(0x19A); + Struct70s *tmp_v0 = func_8034C528(0x19A); if(tmp_v0 != NULL){ - func_8034DDF0(tmp_v0, D_803915E4, D_803915F0, arg0, 1); + func_8034DDF0(&tmp_v0->type_6D, D_803915E4, D_803915F0, arg0, 1); } } void func_8038F56C(f32 arg0){ static f32 D_803915FC[3] = {0.0f, 0.0f, 0.0f}; static f32 D_80391608[3] = {460.0f, 1400.0f, 0.0f}; - Struct6Ds *tmp_v0 = func_8034C528(0x19A); + Struct70s *tmp_v0 = func_8034C528(0x19A); if(tmp_v0 != NULL){ - func_8034DDF0(tmp_v0, D_803915FC, D_80391608, arg0, 1); + func_8034DDF0(&tmp_v0->type_6D, D_803915FC, D_80391608, arg0, 1); } } @@ -56,7 +56,7 @@ void __chMazeCtrl_8038F5E4(Actor *this){ void __chMazeCtrl_setState(Actor *this, s32 next_state){ f32 plyr_pos[3]; - Struct6Ds *tmp_v0; + Struct70s *tmp_v0; ActorLocal_GVMazeCtrl *local; f32 sp28[3]; @@ -111,7 +111,7 @@ void __chMazeCtrl_setState(Actor *this, s32 next_state){ func_8030E6D4(SFX_52_BANJO_YAH_OH); tmp_v0 = func_8034C528(400); if(tmp_v0){ - func_8034DE60(tmp_v0, 0.0f, -1700.0f, 1.0f, 1); + func_8034DE60(&tmp_v0->type_6D, 0.0f, -1700.0f, 1.0f, 1); } }//L8038F8C4 @@ -170,7 +170,7 @@ void chMazeCtrl_update(Actor *this){ player_getPosition(sp3C); if(this->state == 1){ - sp38 = func_8034C528(0x191); + sp38 = &func_8034C528(0x191)->type_6D; if(sp38 != NULL && func_8034DC80(sp38, sp3C)){ __chMazeCtrl_setState(this, 2); } @@ -200,7 +200,7 @@ void chMazeCtrl_update(Actor *this){ } if(this->state == 4){ - sp30 = func_8034C528(0x190); + sp30 = &func_8034C528(0x190)->type_6D; if(sp30 != NULL && func_8034DC78(sp30)){ __chMazeCtrl_setState(this, 0); } diff --git a/src/GV/code_9B70.c b/src/GV/code_9B70.c index c7064d2b..ea985be9 100644 --- a/src/GV/code_9B70.c +++ b/src/GV/code_9B70.c @@ -10,10 +10,10 @@ void func_8038FF68(void){ if(map_get() != MAP_12_GV_GOBIS_VALLEY) return; if(jiggyscore_isCollected(JIGGY_42_GV_WATER_PYRAMID)){ - func_8034DE60(func_8034C528(0x190), 0.0f, 270.0f, 0.0f, 1); + func_8034DE60(&func_8034C528(0x190)->type_6D, 0.0f, 270.0f, 0.0f, 1); } else{ - func_8034E71C(func_8034C5AC(0x130), -1500, 0.0f); + func_8034E71C(&func_8034C5AC(0x130)->type_73, -1500, 0.0f); } } diff --git a/src/GV/code_9C10.c b/src/GV/code_9C10.c index 5afb2d1d..14e4fbf4 100644 --- a/src/GV/code_9C10.c +++ b/src/GV/code_9C10.c @@ -17,13 +17,13 @@ void func_80390000(s32 arg0){ timed_setStaticCameraToNode(4.0f, 0x15); func_80324E38(8.0f, 0); - tmp_v0 = func_8034C5AC(0x130); + tmp_v0 = &func_8034C5AC(0x130)->type_73; if(tmp_v0){ func_8034E71C(tmp_v0, -1000, 0.0f); func_8034E71C(tmp_v0, 0, 10.0f); } - tmp_v0_2 = func_8034C528(0x190); + tmp_v0_2 = &func_8034C528(0x190)->type_6D; if(tmp_v0_2){ func_8034DE60(tmp_v0_2, 0.0f, 270.0f, 0.0f, 1); } diff --git a/src/GV/matchinggame.c b/src/GV/matchinggame.c index 9631ddc8..e32bf72a 100644 --- a/src/GV/matchinggame.c +++ b/src/GV/matchinggame.c @@ -160,7 +160,7 @@ void gv_matchingGame_update(void){ player_getPosition(player_position); sp4C = func_8033F3E8(mapModel_getModel(0), player_position, 0x190, 0x1a0); if(sp4C){ - sp48 = func_8034C528(sp4C); + sp48 = &func_8034C528(sp4C)->type_6D; if(matchingGame.state == 1){ __matchingGame_setState(2); } diff --git a/src/MM/bss_pad.c b/src/MM/bss_pad.c index 665fd437..28806312 100644 --- a/src/MM/bss_pad.c +++ b/src/MM/bss_pad.c @@ -1 +1 @@ -char pad_MM_D_80389C80[0x10]; \ No newline at end of file +char pad_MM_D_80389C80[0x10]; diff --git a/src/MMM/bss_pad.c b/src/MMM/bss_pad.c index 0132cf2b..88ce142d 100644 --- a/src/MMM/bss_pad.c +++ b/src/MMM/bss_pad.c @@ -1 +1 @@ -char pad_D_8038C4C0[0x10]; \ No newline at end of file +char pad_D_8038C4C0[0x10]; diff --git a/src/MMM/ch/napper.c b/src/MMM/ch/napper.c index 7f7f6f17..cc05e8d6 100644 --- a/src/MMM/ch/napper.c +++ b/src/MMM/ch/napper.c @@ -153,7 +153,7 @@ void chnapper_update(Actor *this){ }//L80386DF4 if(this->state != 4){ - viewport_getPosition(sp58); + viewport_get_position_vec3f(sp58); sp4C[0] = this->position_x - sp58[0]; sp4C[1] = this->position_y - sp58[1]; sp4C[2] = this->position_z - sp58[2]; diff --git a/src/MMM/code_47D0.c b/src/MMM/code_47D0.c index 72bd0b34..bee53e17 100644 --- a/src/MMM/code_47D0.c +++ b/src/MMM/code_47D0.c @@ -128,7 +128,7 @@ void func_8038AF90(Struct_MMM_47D0_0 *arg0, Struct68s *arg1, f32 arg2) { func_8028F66C(BS_INTR_D_SURF); } if (sp3C && ((sp40[0] != 0.0f) || (sp40[1] != 0.0f))) { - viewport_getRotation(sp70); + viewport_get_rotation_vec3f(sp70); sp64[0] = sp40[0]; sp64[1] = 0.0f; sp64[2] = -sp40[1]; @@ -147,7 +147,7 @@ void func_8038AF90(Struct_MMM_47D0_0 *arg0, Struct68s *arg1, f32 arg2) { func_80351B28(arg1, sp54); func_8035179C(arg1, sp54); if (arg0->unk0 != NULL) { - viewport_getPosition(sp7C); + viewport_get_position_vec3f(sp7C); sp64[0] = sp54[0] - sp7C[0]; sp64[2] = sp54[2] - sp7C[2]; sp64[1] = 0.0f; diff --git a/src/RBB/code_640.c b/src/RBB/code_640.c index 54b459ac..34ad2721 100644 --- a/src/RBB/code_640.c +++ b/src/RBB/code_640.c @@ -139,7 +139,7 @@ void func_80386A7C(Actor *this){ func_802D3D74(this); this->depth_mode = 1; - viewport_getPosition(&sp2C); + viewport_get_position_vec3f(&sp2C); sp28 = func_80386A30(&this->position); temp_v0 = func_80386A30(&sp2C); this->unk38_0 = 0; diff --git a/src/core1/code_10A00.c b/src/core1/code_10A00.c index 1df1a4e6..35dec438 100644 --- a/src/core1/code_10A00.c +++ b/src/core1/code_10A00.c @@ -178,7 +178,7 @@ void pfsManager_update(void) { || (getGameMode() == GAME_MODE_9_BANJO_AND_KAZOOIE) ) { s0 = 0x1000; - if (gctransition_8030BD98()) { + if (gctransition_done()) { D_802816E0 += time_getDelta(); } if ((D_802816E0 < 1.0) || (getGameMode() == GAME_MODE_9_BANJO_AND_KAZOOIE)) { diff --git a/src/core1/code_13990.c b/src/core1/code_13990.c index 37aa7aa8..fcf1ddc6 100644 --- a/src/core1/code_13990.c +++ b/src/core1/code_13990.c @@ -4,8 +4,7 @@ #include "ml/mtx.h" - -void func_8024632C(Mtx*, f32, f32, f32, f32); +void _guRotateF(Mtx*, f32, f32, f32, f32); f32 func_80263FF0(f32); f32 cosf(f32); @@ -21,25 +20,30 @@ f32 D_8027657C = BAD_DTOR; /*.bss*/ Mtx_t D_80282810; u8 pad_D_80282850[0x780]; -Mtx * D_80282FD0; +Mtx * s_mtx_stack; /*.code*/ -void mlMtxGet(f32 *arg0) { - s32 var_v0, j; +/** + * @brief copies the top of the matrix stack to the destination address + * + * @param dst + */ +void mlMtxGet(f32 *dst) { + s32 row, col; - for(var_v0 = 0; var_v0 < 4; var_v0++){ - for(j = 0; j < 4; j++){ - *(arg0++) = reinterpret_cast(f32, D_80282FD0->m[var_v0][j]); + for(row = 0; row < 4; row++){ + for(col = 0; col < 4; col++){ + *(dst++) = reinterpret_cast(f32, s_mtx_stack->m[row][col]); } } } -Mtx *func_80251488(void){ - return D_80282FD0; +Mtx *mlMtx_get_stack_pointer(void){ + return s_mtx_stack; } void mlMtxApply(Mtx *mPtr){ - func_80245A7C(D_80282FD0, mPtr); + _guMtxF2L(s_mtx_stack, mPtr); } void func_802514BC(Mtx* arg0) { @@ -49,19 +53,16 @@ void func_802514BC(Mtx* arg0) { f32 sum; f32 prod[4][4]; - for(row = 0; row < 4; row++, arg0 = &arg0->m[1][0]) - { - for(col = 0; col < 4; col++) - { + for(row = 0; row < 4; row++, arg0 = &arg0->m[1][0]) { + for(col = 0; col < 4; col++) { sum = 0.0; - for(i = 0; i < 4; i++) - { - sum += reinterpret_cast(f32, arg0->m[0][i]) * reinterpret_cast(f32, D_80282FD0->m[i][col]); + for(i = 0; i < 4; i++) { + sum += reinterpret_cast(f32, arg0->m[0][i]) * reinterpret_cast(f32, s_mtx_stack->m[i][col]); } prod[row][col] = sum; } } - func_80253010(D_80282FD0, prod, sizeof(Mtx)); + func_80253010(s_mtx_stack, prod, sizeof(Mtx)); } void func_802515D4(f32 arg0[3][3]) { @@ -75,7 +76,7 @@ void func_802515D4(f32 arg0[3][3]) { for(var_v1 = 0; var_v1 < 3; var_v1++){ var_f0 = 0.0f; for(var_v0 = 0; var_v0 < 3; var_v0++){ - var_f0 += arg0[i][var_v0] * reinterpret_cast(f32, D_80282FD0->m[var_v0][var_v1]); + var_f0 += arg0[i][var_v0] * reinterpret_cast(f32, s_mtx_stack->m[var_v0][var_v1]); } sp1C[i][var_v1] = var_f0; } @@ -84,7 +85,7 @@ void func_802515D4(f32 arg0[3][3]) { for( i = 0; i < 3; i++){ for(var_v1 = 0; var_v1 < 3; var_v1++){ - reinterpret_cast(f32, D_80282FD0->m[i][var_v1]) = sp1C[i][var_v1]; + reinterpret_cast(f32, s_mtx_stack->m[i][var_v1]) = sp1C[i][var_v1]; } } @@ -92,25 +93,34 @@ void func_802515D4(f32 arg0[3][3]) { void mlMtxPop(void){ - D_80282FD0--; + s_mtx_stack--; } -void func_802516E0(void) { +/** + * @brief pushes a copy of the current matrix on the top matrix stack to the top of + * the matrix stack. + * + */ +void mlMtx_push_duplicate(void) { s32 i, j; f32 *var_a3; f32 *var_a2; - var_a2 = D_80282FD0 + 1; - var_a3 = D_80282FD0; + var_a2 = s_mtx_stack + 1; + var_a3 = s_mtx_stack; for(i = 0; i < 16; i++) { var_a2[i] = var_a3[i]; } - D_80282FD0++; + s_mtx_stack++; } -void func_80251738(void){ +/** + * @brief pushes the identity matrix to the top of the matrix stack. + * + */ +void mlMtx_push_identity(void){ s32 i; - f32 *v0 = ++D_80282FD0; + f32 *v0 = ++s_mtx_stack; for(i = 0; i<3; i++){ v0[0] = 1.0f; v0[1] = 0.0f; @@ -122,67 +132,93 @@ void func_80251738(void){ v0[0] = 1.0f; } -f32 *func_80251788(f32 arg0, f32 arg1, f32 arg2){ - f32 * var_v0 = ++D_80282FD0; +/** + * @brief Pushes a translation matrix to the top of the matrix stack. + * + * @param x + * @param y + * @param z + * @return f32* + */ +f32 *mlMtx_push_translation(f32 x, f32 y, f32 z){ + f32 * var_v0 = ++s_mtx_stack; *(var_v0++) = 1.0f; *(var_v0++) = 0.0f; *(var_v0++) = 0.0f; *(var_v0++) = 0.0f; *(var_v0++) = 0.0f; *(var_v0++) = 1.0f; *(var_v0++) = 0.0f; *(var_v0++) = 0.0f; *(var_v0++) = 0.0f; *(var_v0++) = 0.0f; *(var_v0++) = 1.0f; *(var_v0++) = 0.0f; - *(var_v0++) = arg0; *(var_v0++) = arg1; *(var_v0++) = arg2; *(var_v0++) = 1.0f; + *(var_v0++) = x; *(var_v0++) = y; *(var_v0++) = z; *(var_v0++) = 1.0f; } -void func_802517F8(f32* arg0) { +/** + * @brief Pushes a copy of a matrix to the top of the matrix stack. + * + * @param mtx + */ +void mlMtx_push_mtx(f32* mtx) { s32 var_v0, j; - D_80282FD0++; + s_mtx_stack++; for(var_v0 = 0; var_v0 < 4; var_v0++){ for(j = 0; j < 4; j++){ - reinterpret_cast(f32, D_80282FD0->m[var_v0][j]) = *arg0++; + reinterpret_cast(f32, s_mtx_stack->m[var_v0][j]) = *mtx++; } } } -void func_80251878(f32* arg0) { +/** + * @brief Pushes a copy of the a matrix multiplied with the matrix at the top + * of the matrix stack onto the top of the matrix stack. + * + * @param l_mtx + */ +void mlMtx_push_multiplied(f32* l_mtx) { s32 i; s32 j; Mtx* var_a2; - var_a2 = D_80282FD0 + 1; - for(i = 0; i < 4; i++, arg0 += 4){ + var_a2 = s_mtx_stack + 1; + for(i = 0; i < 4; i++, l_mtx += 4){ for(j = 0; j < 4; j++){ - reinterpret_cast(f32, var_a2->m[i][j]) = arg0[0] * reinterpret_cast(f32, D_80282FD0->m[0][j]) - + arg0[1] * reinterpret_cast(f32, D_80282FD0->m[1][j]) - + arg0[2] * reinterpret_cast(f32, D_80282FD0->m[2][j]) - + arg0[3] * reinterpret_cast(f32, D_80282FD0->m[3][j]); + reinterpret_cast(f32, var_a2->m[i][j]) = l_mtx[0] * reinterpret_cast(f32, s_mtx_stack->m[0][j]) + + l_mtx[1] * reinterpret_cast(f32, s_mtx_stack->m[1][j]) + + l_mtx[2] * reinterpret_cast(f32, s_mtx_stack->m[2][j]) + + l_mtx[3] * reinterpret_cast(f32, s_mtx_stack->m[3][j]); } } - D_80282FD0 = var_a2; + s_mtx_stack = var_a2; } -void func_802519C8(Mtx * arg0, Mtx * arg1) { +/** + * @brief Pushes a copy of the a matrix multiplied with another matrix onto the + * top of the matrix stack. + * + * @param l_mtx + * @param r_mtx + */ +void mlMtx_push_multiplied_2(Mtx * l_mtx, Mtx * r_mtx) { s32 row; s32 col; - Mtx * dst = (D_80282FD0 + 1); + Mtx * dst = (s_mtx_stack + 1); - for (row = 0; row < 4; row++, arg1 = &arg1->m[1][0]) + for (row = 0; row < 4; row++, r_mtx = &r_mtx->m[1][0]) { for (col = 0; col < 4; col++) { reinterpret_cast(f32, dst->m[row][col]) = ( - reinterpret_cast(f32, arg1->m[0][0]) * reinterpret_cast(f32, arg0->m[0][col]) + - reinterpret_cast(f32, arg1->m[0][1]) * reinterpret_cast(f32, arg0->m[1][col]) + - reinterpret_cast(f32, arg1->m[0][2]) * reinterpret_cast(f32, arg0->m[2][col]) + - reinterpret_cast(f32, arg1->m[0][3]) * reinterpret_cast(f32, arg0->m[3][col]) + reinterpret_cast(f32, r_mtx->m[0][0]) * reinterpret_cast(f32, l_mtx->m[0][col]) + + reinterpret_cast(f32, r_mtx->m[0][1]) * reinterpret_cast(f32, l_mtx->m[1][col]) + + reinterpret_cast(f32, r_mtx->m[0][2]) * reinterpret_cast(f32, l_mtx->m[2][col]) + + reinterpret_cast(f32, r_mtx->m[0][3]) * reinterpret_cast(f32, l_mtx->m[3][col]) ); } } - D_80282FD0 = (dst + 0); + s_mtx_stack = (dst + 0); } //mlMtx void mlMtxIdent(void){ s32 i; - f32 *v0 = D_80282FD0 = &D_80282810; + f32 *v0 = s_mtx_stack = &D_80282810; for(i = 0; i<3; i++){ v0[0] = 1.0f; v0[1] = 0.0f; @@ -194,19 +230,19 @@ void mlMtxIdent(void){ v0[0] = 1.0f; } -void func_80251B5C(f32 arg0, f32 arg1, f32 arg2){ - f32 * var_v0 = D_80282FD0 = &D_80282810; +void func_80251B5C(f32 x, f32 y, f32 z){ + f32 * var_v0 = s_mtx_stack = &D_80282810; *(var_v0++) = 1.0f; *(var_v0++) = 0.0f; *(var_v0++) = 0.0f; *(var_v0++) = 0.0f; *(var_v0++) = 0.0f; *(var_v0++) = 1.0f; *(var_v0++) = 0.0f; *(var_v0++) = 0.0f; *(var_v0++) = 0.0f; *(var_v0++) = 0.0f; *(var_v0++) = 1.0f; *(var_v0++) = 0.0f; - *(var_v0++) = arg0; *(var_v0++) = arg1; *(var_v0++) = arg2; *(var_v0++) = 1.0f; + *(var_v0++) = x; *(var_v0++) = y; *(var_v0++) = z; *(var_v0++) = 1.0f; } void mlMtxSet(Mtx* arg0) { s32 i, j; f32 *v0; - v0 = D_80282FD0 = &D_80282810; + v0 = s_mtx_stack = &D_80282810; for(i = 0; i < 4*4; i+=4){ for(j = 0; j < 4; j++){ *(v0++) = *(((f32*)arg0)++); @@ -214,9 +250,9 @@ void mlMtxSet(Mtx* arg0) { } } -void func_80251C20(f32 arg0, f32 arg1, f32 arg2, f32 arg3) { - func_8024632C(D_80282FD0 + 1, arg0, arg1, arg2, arg3); - func_80245DCC(D_80282FD0 + 1, D_80282FD0, D_80282FD0); +void mlMtxRotate(f32 a, f32 x, f32 y, f32 z) { + _guRotateF(s_mtx_stack + 1, a, x, y, z); + guMtxCatF(s_mtx_stack + 1, s_mtx_stack, s_mtx_stack); } void mlMtxRotPitch(f32 arg0) { @@ -229,20 +265,20 @@ void mlMtxRotPitch(f32 arg0) { arg0 *= D_80276578; sin = sinf(arg0); cos = cosf(arg0); - var_f18 = reinterpret_cast(f32, D_80282FD0->m[1][0]); - var_f10 = reinterpret_cast(f32, D_80282FD0->m[2][0]); - reinterpret_cast(f32, D_80282FD0->m[1][0]) = var_f18*cos + var_f10*sin; - reinterpret_cast(f32, D_80282FD0->m[2][0]) = var_f18*-sin + var_f10*cos; + var_f18 = reinterpret_cast(f32, s_mtx_stack->m[1][0]); + var_f10 = reinterpret_cast(f32, s_mtx_stack->m[2][0]); + reinterpret_cast(f32, s_mtx_stack->m[1][0]) = var_f18*cos + var_f10*sin; + reinterpret_cast(f32, s_mtx_stack->m[2][0]) = var_f18*-sin + var_f10*cos; - var_f18 = reinterpret_cast(f32, D_80282FD0->m[1][1]); - var_f10 = reinterpret_cast(f32, D_80282FD0->m[2][1]); - reinterpret_cast(f32, D_80282FD0->m[1][1]) = var_f18*cos + var_f10*sin; - reinterpret_cast(f32, D_80282FD0->m[2][1]) = var_f18*-sin + var_f10*cos; + var_f18 = reinterpret_cast(f32, s_mtx_stack->m[1][1]); + var_f10 = reinterpret_cast(f32, s_mtx_stack->m[2][1]); + reinterpret_cast(f32, s_mtx_stack->m[1][1]) = var_f18*cos + var_f10*sin; + reinterpret_cast(f32, s_mtx_stack->m[2][1]) = var_f18*-sin + var_f10*cos; - var_f18 = reinterpret_cast(f32, D_80282FD0->m[1][2]); - var_f10 = reinterpret_cast(f32, D_80282FD0->m[2][2]); - reinterpret_cast(f32, D_80282FD0->m[1][2]) = var_f18*cos + var_f10*sin; - reinterpret_cast(f32, D_80282FD0->m[2][2]) = var_f18*-sin + var_f10*cos; + var_f18 = reinterpret_cast(f32, s_mtx_stack->m[1][2]); + var_f10 = reinterpret_cast(f32, s_mtx_stack->m[2][2]); + reinterpret_cast(f32, s_mtx_stack->m[1][2]) = var_f18*cos + var_f10*sin; + reinterpret_cast(f32, s_mtx_stack->m[2][2]) = var_f18*-sin + var_f10*cos; } } @@ -258,10 +294,10 @@ void mlMtxRotYaw(f32 arg0) { sin = sinf(arg0); cos = cosf(arg0); for(i = 0; i < 3; i++){ - var_f18 = reinterpret_cast(f32, D_80282FD0->m[0][i]); - var_f10 = reinterpret_cast(f32, D_80282FD0->m[2][i]); - reinterpret_cast(f32, D_80282FD0->m[0][i]) = var_f18*cos - var_f10*sin; - reinterpret_cast(f32, D_80282FD0->m[2][i]) = var_f18*sin + var_f10*cos; + var_f18 = reinterpret_cast(f32, s_mtx_stack->m[0][i]); + var_f10 = reinterpret_cast(f32, s_mtx_stack->m[2][i]); + reinterpret_cast(f32, s_mtx_stack->m[0][i]) = var_f18*cos - var_f10*sin; + reinterpret_cast(f32, s_mtx_stack->m[2][i]) = var_f18*sin + var_f10*cos; } } } @@ -276,25 +312,25 @@ void mlMtxRotRoll(f32 arg0) { arg0 *= D_8027657C; sin = sinf(arg0); cos = cosf(arg0); - var_f18 = reinterpret_cast(f32, D_80282FD0->m[0][0]); - var_f10 = reinterpret_cast(f32, D_80282FD0->m[1][0]); - reinterpret_cast(f32, D_80282FD0->m[0][0]) = var_f18*cos + var_f10*sin; - reinterpret_cast(f32, D_80282FD0->m[1][0]) = var_f18*-sin + var_f10*cos; + var_f18 = reinterpret_cast(f32, s_mtx_stack->m[0][0]); + var_f10 = reinterpret_cast(f32, s_mtx_stack->m[1][0]); + reinterpret_cast(f32, s_mtx_stack->m[0][0]) = var_f18*cos + var_f10*sin; + reinterpret_cast(f32, s_mtx_stack->m[1][0]) = var_f18*-sin + var_f10*cos; - var_f18 = reinterpret_cast(f32, D_80282FD0->m[0][1]); - var_f10 = reinterpret_cast(f32, D_80282FD0->m[1][1]); - reinterpret_cast(f32, D_80282FD0->m[0][1]) = var_f18*cos + var_f10*sin; - reinterpret_cast(f32, D_80282FD0->m[1][1]) = var_f18*-sin + var_f10*cos; + var_f18 = reinterpret_cast(f32, s_mtx_stack->m[0][1]); + var_f10 = reinterpret_cast(f32, s_mtx_stack->m[1][1]); + reinterpret_cast(f32, s_mtx_stack->m[0][1]) = var_f18*cos + var_f10*sin; + reinterpret_cast(f32, s_mtx_stack->m[1][1]) = var_f18*-sin + var_f10*cos; - var_f18 = reinterpret_cast(f32, D_80282FD0->m[0][2]); - var_f10 = reinterpret_cast(f32, D_80282FD0->m[1][2]); - reinterpret_cast(f32, D_80282FD0->m[0][2]) = var_f18*cos + var_f10*sin; - reinterpret_cast(f32, D_80282FD0->m[1][2]) = var_f18*-sin + var_f10*cos; + var_f18 = reinterpret_cast(f32, s_mtx_stack->m[0][2]); + var_f10 = reinterpret_cast(f32, s_mtx_stack->m[1][2]); + reinterpret_cast(f32, s_mtx_stack->m[0][2]) = var_f18*cos + var_f10*sin; + reinterpret_cast(f32, s_mtx_stack->m[1][2]) = var_f18*-sin + var_f10*cos; } } -void func_80251F8C(f32 arg0) { +void mlMtx_rotate_pitch_deg(f32 arg0) { f32 cos; f32 sin; f32 var_f10; @@ -306,15 +342,15 @@ void func_80251F8C(f32 arg0) { sin = sinf(arg0); cos = cosf(arg0); for(i = 0; i < 3; i++){ - var_f18 = reinterpret_cast(f32, D_80282FD0->m[1][i]); - var_f10 = reinterpret_cast(f32, D_80282FD0->m[2][i]); - reinterpret_cast(f32, D_80282FD0->m[1][i]) = var_f18*cos + var_f10*sin; - reinterpret_cast(f32, D_80282FD0->m[2][i]) = var_f18*-sin +var_f10*cos; + var_f18 = reinterpret_cast(f32, s_mtx_stack->m[1][i]); + var_f10 = reinterpret_cast(f32, s_mtx_stack->m[2][i]); + reinterpret_cast(f32, s_mtx_stack->m[1][i]) = var_f18*cos + var_f10*sin; + reinterpret_cast(f32, s_mtx_stack->m[2][i]) = var_f18*-sin +var_f10*cos; } } } -void func_8025208C(f32 arg0) { +void mlMtx_rotate_yaw_deg(f32 arg0) { f32 cos; f32 sin; f32 var_f10; @@ -326,16 +362,16 @@ void func_8025208C(f32 arg0) { sin = sinf(arg0); cos = cosf(arg0); for(i = 0; i < 3; i++){ - var_f18 = reinterpret_cast(f32, D_80282FD0->m[0][i]); - var_f10 = reinterpret_cast(f32, D_80282FD0->m[2][i]); - reinterpret_cast(f32, D_80282FD0->m[0][i]) = var_f18*cos - var_f10*sin; - reinterpret_cast(f32, D_80282FD0->m[2][i]) = var_f18*sin + var_f10*cos; + var_f18 = reinterpret_cast(f32, s_mtx_stack->m[0][i]); + var_f10 = reinterpret_cast(f32, s_mtx_stack->m[2][i]); + reinterpret_cast(f32, s_mtx_stack->m[0][i]) = var_f18*cos - var_f10*sin; + reinterpret_cast(f32, s_mtx_stack->m[2][i]) = var_f18*sin + var_f10*cos; } } } -void mlMtxRotate(f32 pitch, f32 yaw, f32 roll){ +void mlMtxRotatePYR(f32 pitch, f32 yaw, f32 roll){ mlMtxRotYaw(yaw); mlMtxRotPitch(pitch); mlMtxRotRoll(roll); @@ -344,25 +380,25 @@ void mlMtxRotate(f32 pitch, f32 yaw, f32 roll){ void mlMtxScale_xyz(f32 x, f32 y, f32 z){ int i; for(i = 0; i < 3; i++){ - reinterpret_cast(f32, D_80282FD0->m[0][i]) *= x; - reinterpret_cast(f32, D_80282FD0->m[1][i]) *= y; - reinterpret_cast(f32, D_80282FD0->m[2][i]) *= z; + reinterpret_cast(f32, s_mtx_stack->m[0][i]) *= x; + reinterpret_cast(f32, s_mtx_stack->m[1][i]) *= y; + reinterpret_cast(f32, s_mtx_stack->m[2][i]) *= z; } } void mlMtxScale(f32 scale){ int i; for(i = 0; i < 3; i++){ - reinterpret_cast(f32, D_80282FD0->m[0][i]) *= scale; - reinterpret_cast(f32, D_80282FD0->m[1][i]) *= scale; - reinterpret_cast(f32, D_80282FD0->m[2][i]) *= scale; + reinterpret_cast(f32, s_mtx_stack->m[0][i]) *= scale; + reinterpret_cast(f32, s_mtx_stack->m[1][i]) *= scale; + reinterpret_cast(f32, s_mtx_stack->m[2][i]) *= scale; } } void func_80252330(f32 x, f32 y, f32 z){ - reinterpret_cast(f32, D_80282FD0->m[3][0]) = x; - reinterpret_cast(f32, D_80282FD0->m[3][1]) = y; - reinterpret_cast(f32, D_80282FD0->m[3][2]) = z; + reinterpret_cast(f32, s_mtx_stack->m[3][0]) = x; + reinterpret_cast(f32, s_mtx_stack->m[3][1]) = y; + reinterpret_cast(f32, s_mtx_stack->m[3][2]) = z; } void func_8025235C(f32 arg0[3], f32 arg1[3]) { @@ -374,10 +410,10 @@ void func_8025235C(f32 arg0[3], f32 arg1[3]) { sp0[2] = arg1[2]; for(i = 0; i < 3; i++){ - arg0[i] = sp0[0]*reinterpret_cast(f32, D_80282FD0->m[0][i]) - + sp0[1]*reinterpret_cast(f32, D_80282FD0->m[1][i]) - + sp0[2]*reinterpret_cast(f32, D_80282FD0->m[2][i]) - + reinterpret_cast(f32, D_80282FD0->m[3][i]); + arg0[i] = sp0[0]*reinterpret_cast(f32, s_mtx_stack->m[0][i]) + + sp0[1]*reinterpret_cast(f32, s_mtx_stack->m[1][i]) + + sp0[2]*reinterpret_cast(f32, s_mtx_stack->m[2][i]) + + reinterpret_cast(f32, s_mtx_stack->m[3][i]); } } @@ -385,17 +421,17 @@ void func_80252434(f32 arg0[3], f32 arg1[3]) { s32 i; for(i = 0; i < 3; i++){ - arg0[i] = arg1[0]*reinterpret_cast(f32, D_80282FD0->m[0][i]) - + arg1[1]*reinterpret_cast(f32, D_80282FD0->m[1][i]) - + arg1[2]*reinterpret_cast(f32, D_80282FD0->m[2][i]) - + reinterpret_cast(f32, D_80282FD0->m[3][i]); + arg0[i] = arg1[0]*reinterpret_cast(f32, s_mtx_stack->m[0][i]) + + arg1[1]*reinterpret_cast(f32, s_mtx_stack->m[1][i]) + + arg1[2]*reinterpret_cast(f32, s_mtx_stack->m[2][i]) + + reinterpret_cast(f32, s_mtx_stack->m[3][i]); } } -void func_802524F0(f32 dst[3], f32 x, f32 y, f32 z) { - dst[0] = x*((f32 (*)[4])D_80282FD0)[0][0] + y*((f32 (*)[4])D_80282FD0)[1][0] + z*((f32 (*)[4])D_80282FD0)[2][0] + ((f32 (*)[4])D_80282FD0)[3][0]; - dst[1] = x*((f32 (*)[4])D_80282FD0)[0][1] + y*((f32 (*)[4])D_80282FD0)[1][1] + z*((f32 (*)[4])D_80282FD0)[2][1] + ((f32 (*)[4])D_80282FD0)[3][1]; - dst[2] = x*((f32 (*)[4])D_80282FD0)[0][2] + y*((f32 (*)[4])D_80282FD0)[1][2] + z*((f32 (*)[4])D_80282FD0)[2][2] + ((f32 (*)[4])D_80282FD0)[3][2]; +void mlMtx_apply_f3(f32 dst[3], f32 x, f32 y, f32 z) { + dst[0] = x*((f32 (*)[4])s_mtx_stack)[0][0] + y*((f32 (*)[4])s_mtx_stack)[1][0] + z*((f32 (*)[4])s_mtx_stack)[2][0] + ((f32 (*)[4])s_mtx_stack)[3][0]; + dst[1] = x*((f32 (*)[4])s_mtx_stack)[0][1] + y*((f32 (*)[4])s_mtx_stack)[1][1] + z*((f32 (*)[4])s_mtx_stack)[2][1] + ((f32 (*)[4])s_mtx_stack)[3][1]; + dst[2] = x*((f32 (*)[4])s_mtx_stack)[0][2] + y*((f32 (*)[4])s_mtx_stack)[1][2] + z*((f32 (*)[4])s_mtx_stack)[2][2] + ((f32 (*)[4])s_mtx_stack)[3][2]; } void mlMtx_apply_vec3s(s16 dst[3], s16 src[3]) { @@ -403,7 +439,7 @@ void mlMtx_apply_vec3s(s16 dst[3], s16 src[3]) { f32 sp0[3]; f32 (*temp_v0)[4]; - temp_v0 = D_80282FD0; + temp_v0 = s_mtx_stack; sp0[0] = (f32) src[0]; sp0[1] = (f32) src[1]; sp0[2] = (f32) src[2]; @@ -457,9 +493,9 @@ void mlMtxTranslate(f32 x, f32 y, f32 z) { f32 phi_f10; s32 phi_v1; - phi_v0 = D_80282FD0; + phi_v0 = s_mtx_stack; for(phi_v1 = 0; phi_v1 < 0xC; phi_v1 +=4){ - phi_v0 = (u32)D_80282FD0 + phi_v1; + phi_v0 = (u32)s_mtx_stack + phi_v1; phi_f18 = phi_v0[0] * x; phi_f16 = phi_v0[4] * y; phi_v0[0xC] += phi_f18 + phi_f16 + (phi_v0[8] * z); @@ -470,7 +506,7 @@ void func_80252A38(f32 x, f32 y, f32 z) { s32 var_v1; for(var_v1 = 0; var_v1 != 3; var_v1++){ - reinterpret_cast(f32, D_80282FD0->m[3][var_v1]) += reinterpret_cast(f32, D_80282FD0->m[0][var_v1])*x + reinterpret_cast(f32, D_80282FD0->m[1][var_v1])*y + reinterpret_cast(f32, D_80282FD0->m[2][var_v1])*z; + reinterpret_cast(f32, s_mtx_stack->m[3][var_v1]) += reinterpret_cast(f32, s_mtx_stack->m[0][var_v1])*x + reinterpret_cast(f32, s_mtx_stack->m[1][var_v1])*y + reinterpret_cast(f32, s_mtx_stack->m[2][var_v1])*z; } } @@ -520,7 +556,7 @@ void func_80252C08(f32 arg0[3], f32 rotation[3], f32 scale, f32 arg3[3]){ } -void func_80252CC4(f32 arg0[3], f32 arg1[3], f32 scale, f32 arg3[3]){ +void func_80252CC4(f32 position[3], f32 rotation[3], f32 scale, f32 arg3[3]){ if(arg3 != NULL) mlMtxTranslate(arg3[0], arg3[1], arg3[2]); @@ -528,62 +564,62 @@ void func_80252CC4(f32 arg0[3], f32 arg1[3], f32 scale, f32 arg3[3]){ mlMtxScale_xyz(1.0f/scale, 1.0f/scale, 1.0f/scale); } - if(arg1 != NULL){ - mlMtxRotRoll(-arg1[2]); - mlMtxRotPitch(-arg1[0]); - mlMtxRotYaw(-arg1[1]); + if(rotation != NULL){ + mlMtxRotRoll(-rotation[2]); + mlMtxRotPitch(-rotation[0]); + mlMtxRotYaw(-rotation[1]); } - if(arg0 != NULL) - mlMtxTranslate(-arg0[0], -arg0[1], -arg0[2]); + if(position != NULL) + mlMtxTranslate(-position[0], -position[1], -position[2]); } -void func_80252D8C(f32 arg0[3], f32 arg1[3]){ - mlMtxTranslate(arg0[0], arg0[1], arg0[2]); - mlMtxRotRoll(arg1[2]); - mlMtxRotPitch(arg1[0]); - mlMtxRotYaw(arg1[1]); +void func_80252D8C(f32 position[3], f32 rotation[3]){ + mlMtxTranslate(position[0], position[1], position[2]); + mlMtxRotRoll(rotation[2]); + mlMtxRotPitch(rotation[0]); + mlMtxRotYaw(rotation[1]); } -void func_80252DDC(f32 arg0[3], f32 arg1[3]){ - mlMtxRotYaw(-arg1[1]); - mlMtxRotPitch(-arg1[0]); - mlMtxRotRoll(-arg1[2]); - mlMtxTranslate(-arg0[0], -arg0[1], -arg0[2]); +void func_80252DDC(f32 position[3], f32 rotation[3]){ + mlMtxRotYaw(-rotation[1]); + mlMtxRotPitch(-rotation[0]); + mlMtxRotRoll(-rotation[2]); + mlMtxTranslate(-position[0], -position[1], -position[2]); } -void func_80252E4C(f32 arg0[3], f32 arg1[3]){ - mlMtxTranslate(arg0[0], arg0[1], arg0[2]); - mlMtxRotRoll(arg1[2]); - mlMtxRotPitch(arg1[0]); - mlMtxRotYaw(arg1[1]); - mlMtxTranslate(-arg0[0], -arg0[1], -arg0[2]); +void func_80252E4C(f32 position[3], f32 rotation[3]){ + mlMtxTranslate(position[0], position[1], position[2]); + mlMtxRotRoll(rotation[2]); + mlMtxRotPitch(rotation[0]); + mlMtxRotYaw(rotation[1]); + mlMtxTranslate(-position[0], -position[1], -position[2]); } -void func_80252EC8(f32 arg0[3], f32 arg1[3]){ - mlMtxTranslate(arg0[0], arg0[1], arg0[2]); - mlMtxRotYaw(-arg1[1]); - mlMtxRotPitch(-arg1[0]); - mlMtxRotRoll(-arg1[2]); - mlMtxTranslate(-arg0[0], -arg0[1], -arg0[2]); +void func_80252EC8(f32 position[3], f32 rotation[3]){ + mlMtxTranslate(position[0], position[1], position[2]); + mlMtxRotYaw(-rotation[1]); + mlMtxRotPitch(-rotation[0]); + mlMtxRotRoll(-rotation[2]); + mlMtxTranslate(-position[0], -position[1], -position[2]); } -void func_80252F50(f32 arg0[3]){ - mlMtxRotYaw(arg0[1]); - mlMtxRotPitch(arg0[0]); - mlMtxRotRoll(arg0[2]); +void func_80252F50(f32 rotation[3]){ + mlMtxRotYaw(rotation[1]); + mlMtxRotPitch(rotation[0]); + mlMtxRotRoll(rotation[2]); } -void func_80252F8C(f32 arg0[3]){ - mlMtxRotRoll(arg0[2]); - mlMtxRotPitch(arg0[0]); - mlMtxRotYaw(arg0[1]); +void func_80252F8C(f32 rotation[3]){ + mlMtxRotRoll(rotation[2]); + mlMtxRotPitch(rotation[0]); + mlMtxRotYaw(rotation[1]); } -void func_80252FC8(f32 arg0[3]){ - mlMtxRotYaw(-arg0[1]); - mlMtxRotPitch(-arg0[0]); - mlMtxRotRoll(-arg0[2]); +void func_80252FC8(f32 rotation[3]){ + mlMtxRotYaw(-rotation[1]); + mlMtxRotPitch(-rotation[0]); + mlMtxRotRoll(-rotation[2]); } diff --git a/src/core1/code_18350.c b/src/core1/code_18350.c index 1b822f8d..15d2d3a7 100644 --- a/src/core1/code_18350.c +++ b/src/core1/code_18350.c @@ -30,7 +30,7 @@ f32 ml_acosValTbl[90] = { //D_80276CBC 0.0871559978, 0.0697569996, 0.0523359999, 0.0348990001, 0.0174519997 }; -f32 viewport_getYaw(void); +f32 viewport_get_yaw(void); // .h void func_80257918(f32 arg0[3], f32 arg1[3], f32 arg2[3], f32 arg3[3]); @@ -1481,7 +1481,7 @@ void func_802596AC(f32 a0[3], f32 a1[3], f32 a2[3], f32 a3[3]) s32 func_8025975C(f32 a0) { - f32 val = (s32)(viewport_getYaw() - a0); + f32 val = (s32)(viewport_get_yaw() - a0); while (val < 0) val += 360; diff --git a/src/core1/code_1BE90.c b/src/core1/code_1BE90.c index 418796bf..65331693 100644 --- a/src/core1/code_1BE90.c +++ b/src/core1/code_1BE90.c @@ -616,7 +616,7 @@ int func_8025AEEC(void){ return out; } -void func_8025AF38(void){ +void comusic_defrag(void){ CoMusic *iPtr; if(!D_80276E30) return; diff --git a/src/core1/code_2FA0.c b/src/core1/code_2FA0.c index f6fa3936..8faeeee3 100644 --- a/src/core1/code_2FA0.c +++ b/src/core1/code_2FA0.c @@ -17,7 +17,7 @@ void func_802409C0(f32 arg0[3], f32 arg1){ sp30[1] = 0.0f; sp30[2] = -(sp28[1] * sp24); - viewport_getRotation(&sp3C); + viewport_get_rotation_vec3f(&sp3C); ml_vec3f_yaw_rotate_copy(sp30, sp30, sp3C[1]); arg0[0] = arg0[0] + sp30[0]; @@ -59,7 +59,7 @@ void func_80240AC8(f32 arg0[3], f32 arg1){ sp30[1] = 0.0f; sp30[2] = -(sp28[1] * sp24); - viewport_getRotation(&sp3C); + viewport_get_rotation_vec3f(&sp3C); ml_vec3f_yaw_rotate_copy(sp30, sp30, sp3C[1]); arg0[0] = arg0[0] + sp30[0]; diff --git a/src/core1/code_3250.c b/src/core1/code_3250.c index c94acaa4..3a914880 100644 --- a/src/core1/code_3250.c +++ b/src/core1/code_3250.c @@ -1,7 +1,7 @@ #include extern f32 gu_sqrtf(f32); -static void _guMtxF2L(float mf[4][4], Mtx *m) +static void __guMtxF2L(float mf[4][4], Mtx *m) { int i, j; int e1,e2; @@ -142,7 +142,7 @@ void guScale(Mtx *m, float x, float y, float z) float mf[4][4]; guScaleF(mf, x, y, z); - _guMtxF2L(mf, m); + __guMtxF2L(mf, m); } void guRotateRPYF(f32 mf[4][4], f32 r, f32 p, f32 h) { diff --git a/src/core1/code_3A70.c b/src/core1/code_3A70.c index bbd00db8..de7c0f9e 100644 --- a/src/core1/code_3A70.c +++ b/src/core1/code_3A70.c @@ -4,7 +4,7 @@ extern f32 ml_cos_deg(f32); extern f32 ml_sin_deg(f32); -extern void func_8024C5F0(s32[3]); +extern void veiwport_get_position_vec3w(s32[3]); Gfx D_80275880[] = { gsSPClearGeometryMode(G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH | G_CLIPPING | 0x0060CD00), @@ -26,7 +26,7 @@ void func_80241490(Gfx **gfx, Vtx **vtx, s32 *arg2[3], s32 arg3[3], s32 arg4[3], s32 sp78[3][4]; s32 i; - func_8024C5F0(spB4); + veiwport_get_position_vec3w(spB4); gSPDisplayList((*gfx)++, D_80275880); if (arg6 != 0) { gSPSetGeometryMode((*gfx)++, G_ZBUFFER | G_CULL_BACK); @@ -95,7 +95,7 @@ void func_80241928(Gfx** gfx, Vtx** vtx, s32 arg2[3], s32 arg3, s32 arg4[3]) { s32 var_fp; s32 var_s0; - func_8024C5F0(spB4); + veiwport_get_position_vec3w(spB4); for(var_fp = 0; var_fp < 4; var_fp++){ gSPDisplayList((*gfx)++, D_80275880); gSPSetGeometryMode((*gfx)++, G_ZBUFFER); @@ -162,7 +162,7 @@ void func_802424D4(Gfx **gfx, Mtx **mtx, Vtx **vtx, f32 arg3[3], f32 arg4[3], f3 sp68[1] *= arg5; sp68[2] *= arg5; - viewport_getPosition(sp5C); + viewport_get_position_vec3f(sp5C); gSPDisplayList((*gfx)++, D_80275880); gSPSetGeometryMode((*gfx)++, G_ZBUFFER); gSPVertex((*gfx)++, *vtx, 8, 0); @@ -209,7 +209,7 @@ void func_80242BE8(Gfx **gfx, Vtx **arg1, f32 arg2[2][2][2][3], s32 arg3[3], s32 s32 i; s32 j; s32 k; - viewport_getPosition(sp84); + viewport_get_position_vec3f(sp84); gSPDisplayList((*gfx)++, D_80275880); if (arg5){ gSPSetGeometryMode((*gfx)++, G_CULL_BACK); diff --git a/src/core1/code_7F60.c b/src/core1/code_7F60.c index 21bbe26c..6f2381e7 100644 --- a/src/core1/code_7F60.c +++ b/src/core1/code_7F60.c @@ -2,14 +2,16 @@ #include "functions.h" #include "variables.h" +static void _guMtxIdentF(float mf[4][4]); + u8 D_80275900[] = {0xCF, 0xAD, 0xA2, 0x90, 0x93, 0x4A, 0x83, 0xF1}; f32 D_80275908 = BAD_DTOR; -s32 func_80245980(f32 arg0){ +static s32 guFToFix32(f32 arg0){ return arg0*65536.0f; } -void func_802459A0(float mf[4][4], Mtx *m) +static void __guMtxF2L(float mf[4][4], Mtx *m) { int i, j; int e1,e2; @@ -21,14 +23,14 @@ void func_802459A0(float mf[4][4], Mtx *m) for (i=0; i<4; i++) for (j=0; j<2; j++) { - e1=func_80245980(mf[i][j*2]); - e2=func_80245980(mf[i][j*2+1]); + e1=guFToFix32(mf[i][j*2]); + e2=guFToFix32(mf[i][j*2+1]); *(ai++) = ( e1 & 0xffff0000 ) | ((e2 >> 16)&0xffff); *(af++) = ((e1 << 16) & 0xffff0000) | (e2 & 0xffff); } } -void func_80245A7C(float mf[4][4], Mtx *m) //should be mf[4][4] +void _guMtxF2L(float mf[4][4], Mtx *m) //should be mf[4][4] { int i; int j; @@ -50,10 +52,10 @@ void func_80245A7C(float mf[4][4], Mtx *m) //should be mf[4][4] } } -void func_80245BE4(f32 mf[4][4], f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, f32 arg7) { +void _guFustrumF(f32 mf[4][4], f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, f32 arg7) { s32 i, j; - _guMtxIdentF_80245D44(mf); + _guMtxIdentF(mf); mf[0][0] = (2 * arg5) / (arg2 - arg1); mf[1][1] = (2 * arg5) / (arg4 - arg3); mf[2][0] = (arg2 + arg1) / (arg2 - arg1); @@ -69,7 +71,7 @@ void func_80245BE4(f32 mf[4][4], f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg } } -void _guMtxIdentF_80245D44(float mf[4][4]) //static +static void _guMtxIdentF(float mf[4][4]) //static { int i, j; @@ -79,7 +81,7 @@ void _guMtxIdentF_80245D44(float mf[4][4]) //static else mf[i][j] = 0.0; } -void func_80245DCC(f32 lmf[4][4], f32 rmf[4][4], f32 dst[4][4]) { +void guMtxCatF(f32 lmf[4][4], f32 rmf[4][4], f32 dst[4][4]) { s32 i, j, k; f32 sp1C[4][4]; @@ -98,7 +100,7 @@ void func_80245DCC(f32 lmf[4][4], f32 rmf[4][4], f32 dst[4][4]) { } } -void func_80245F34(f32 *arg0, f32 *arg1, f32 *arg2) { +static void _guNormalize(f32 *arg0, f32 *arg1, f32 *arg2) { f32 inv_len; inv_len = 1.0f / gu_sqrtf((*arg0 * *arg0) + (*arg1 * *arg1) + (*arg2 * *arg2)); @@ -107,7 +109,7 @@ void func_80245F34(f32 *arg0, f32 *arg1, f32 *arg2) { *arg2 *= inv_len; } -void func_80245FB8(float mf[4][4], u16 *perspNorm, float fovy, float aspect, float near, float far, float scale) +void guPerspectiveF(float mf[4][4], u16 *perspNorm, float fovy, float aspect, float near, float far, float scale) { float cot; float tmp; @@ -163,25 +165,25 @@ void func_80245FB8(float mf[4][4], u16 *perspNorm, float fovy, float aspect, flo void guPerspective(Mtx *m, u16 *perspNorm, f32 fovy, f32 aspect, f32 near, f32 far, f32 scale) { f32 sp28[4][4]; - func_80245FB8(sp28, perspNorm, fovy, aspect, near, far, scale); - func_802459A0(sp28, m); + guPerspectiveF(sp28, perspNorm, fovy, aspect, near, far, scale); + __guMtxF2L(sp28, m); } -void func_8024632C(f32 mf[4][4], f32 arg1, f32 arg2, f32 arg3, f32 arg4) { +void _guRotateF(f32 mf[4][4], f32 arg1, f32 arg2, f32 arg3, f32 arg4) { f32 sp34; f32 sp30; f32 sp2C; f32 sp28; volatile f32 sp24; - func_80245F34(&arg2, &arg3, &arg4); + _guNormalize(&arg2, &arg3, &arg4); arg1 *= D_80275908; sp34 = sinf(arg1); sp30 = cosf(arg1); sp2C = arg2 * arg3 * (1.0f - sp30); sp28 = arg3 * arg4 * (1.0f - sp30); sp24 = (arg4 * arg2 * (1.0f - sp30)); - _guMtxIdentF_80245D44(mf); + _guMtxIdentF(mf); mf[0][0] = ((1.0f - (arg2 * arg2)) * sp30) + (arg2 * arg2); mf[2][1] = (sp28 - (arg2 * sp34)); mf[1][2] = ((arg2 * sp34) + sp28); @@ -195,10 +197,10 @@ void func_8024632C(f32 mf[4][4], f32 arg1, f32 arg2, f32 arg3, f32 arg4) { mf[0][1] = (arg4 * sp34) + sp2C; } -void func_802464B0(f32 mf[4][4], f32 arg1){ +void guRotateRollF(f32 mf[4][4], f32 arg1){ f32 c, s; arg1 *= D_80275908; - _guMtxIdentF_80245D44(mf); + _guMtxIdentF(mf); c = cosf(arg1); mf[1][1] = c; mf[2][2] = c; @@ -207,10 +209,10 @@ void func_802464B0(f32 mf[4][4], f32 arg1){ mf[2][1] = -s; } -void func_80246510(f32 mf[4][4], f32 arg1){ +void guRotatePitchF(f32 mf[4][4], f32 arg1){ f32 c, s; arg1 *= D_80275908; - _guMtxIdentF_80245D44(mf); + _guMtxIdentF(mf); c = cosf(arg1); mf[0][0] = c; mf[2][2] = c; @@ -219,10 +221,10 @@ void func_80246510(f32 mf[4][4], f32 arg1){ mf[0][2] = -s; } -void func_80246570(f32 mf[4][4], f32 arg1){ +void guRotateYawF(f32 mf[4][4], f32 arg1){ f32 c, s; arg1 *= D_80275908; - _guMtxIdentF_80245D44(mf); + _guMtxIdentF(mf); c = cosf(arg1); mf[0][0] = c; mf[1][1] = c; @@ -231,16 +233,16 @@ void func_80246570(f32 mf[4][4], f32 arg1){ mf[1][0] = -s; } -void func_802465D0(f32 mf[4][4], f32 arg1, f32 arg2, f32 arg3){ - _guMtxIdentF_80245D44(mf); +void _guScaleF(f32 mf[4][4], f32 arg1, f32 arg2, f32 arg3){ + _guMtxIdentF(mf); mf[0][0] = arg1; mf[1][1] = arg2; mf[2][2] = arg3; mf[3][3] = 1.0f; } -void func_80246624(f32 mf[4][4], f32 arg1, f32 arg2, f32 arg3){ - _guMtxIdentF_80245D44(mf); +void _guTranslateF(f32 mf[4][4], f32 arg1, f32 arg2, f32 arg3){ + _guMtxIdentF(mf); mf[3][0] = arg1; mf[3][1] = arg2; mf[3][2] = arg3; diff --git a/src/core1/code_ABB0.c b/src/core1/code_ABB0.c index b25c79f7..5b53b136 100644 --- a/src/core1/code_ABB0.c +++ b/src/core1/code_ABB0.c @@ -535,7 +535,7 @@ void draw_texture_ci4(s32 x, s32 y, void *tmem, s32 w, s32 h, bool alpha_enabled } } -void func_80249CEC(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled) { +void draw_sprite(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled) { s16 temp_v0; temp_v0 = sprite->type; diff --git a/src/core1/code_EAF0.c b/src/core1/code_EAF0.c index b067227b..2d455ee6 100644 --- a/src/core1/code_EAF0.c +++ b/src/core1/code_EAF0.c @@ -5,11 +5,13 @@ extern void guPerspective(Mtx *, u16*, f32, f32, f32, f32, f32); extern f32 ml_dotProduct_vec3f(f32[3], f32[3]); +#define VIEWPORT_FOVY_DEFAULT (40.0f) + /* .data */ -f32 D_80275D20 = 40.0f; //fovy -f32 D_80275D24 = 1.35185182f; //aspect -f32 D_80275D28 = 30.0f; //near -f32 D_80275D2C = 4000.0f; //far +f32 s_viewport_fovy = VIEWPORT_FOVY_DEFAULT; //fovy +f32 s_viewport_aspect = 1.35185182f; //aspect +f32 s_viewport_near = 30.0f; //near +f32 s_viewport_far = 4000.0f; //far /* .data */ f32 D_80280EA0[3]; @@ -30,11 +32,11 @@ void func_8024F450(void); void func_8024F4AC(void); void func_8024C964(Gfx **, Mtx **, f32, f32); void func_8024CD7C(int); -void func_8024CDF8(f32, f32, f32); -void func_8024CE40(f32, f32, f32); +void viewport_set_position_f3(f32, f32, f32); +void viewport_set_rotation_f3(f32, f32, f32); void func_8024CE60(f32, f32); void func_8024CE74(s32 arg0, s32 arg1, s32 arg2, s32 arg3); -void func_8024DDB4(f32); +void viewport_set_field_of_view(f32); void func_80256E24(f32 [3], f32, f32, f32, f32, f32); @@ -55,31 +57,31 @@ void func_8024C5A8(f32 arg0[3]){ ml_vec3f_copy(arg0, D_80280EA0); } -void viewport_getPosition(f32 arg0[3]){ +void viewport_get_position_vec3f(f32 arg0[3]){ ml_vec3f_copy(arg0, viewportPosition); } -void func_8024C5F0(s32 dst[3]){ +void veiwport_get_position_vec3w(s32 dst[3]){ dst[0] = ((f32)(s32)(viewportPosition[0]*500.0))/500.0; dst[1] = ((f32)(s32)(viewportPosition[1]*500.0))/500.0; dst[2] = ((f32)(s32)(viewportPosition[2]*500.0))/500.0; } -void func_8024C6A0(s16 dst[3]){ +void veiwport_get_position_vec3s(s16 dst[3]){ dst[0] = ((f32)(s32)(viewportPosition[0]*500.0))/500.0; dst[1] = ((f32)(s32)(viewportPosition[1]*500.0))/500.0; dst[2] = ((f32)(s32)(viewportPosition[2]*500.0))/500.0; } -void viewport_getRotation(f32 arg0[3]){ +void viewport_get_rotation_vec3f(f32 arg0[3]){ ml_vec3f_copy(arg0, viewportRotation); } -f32 viewport_getYaw(void){ +f32 viewport_get_yaw(void){ return viewportRotation[1]; } -void func_8024C794(f32 *pitch, f32 *yaw, f32 *roll){ +void viewport_get_rotation_f3(f32 *pitch, f32 *yaw, f32 *roll){ *pitch = viewportRotation[0]; *yaw = viewportRotation[1]; *roll = viewportRotation[2]; @@ -97,21 +99,21 @@ void func_8024C7B8(Gfx **gfx, Mtx **mtx){ void func_8024C904(Gfx **gfx, Mtx **mtx){ gSPViewport((*gfx)++, &D_80280F10[D_80281018]); - func_8024C964(gfx, mtx, D_80275D28, D_80275D2C); + func_8024C964(gfx, mtx, s_viewport_near, s_viewport_far); } void func_8024C964(Gfx **gfx, Mtx **mtx, f32 near, f32 far){ u16 sp5e; - near = MAX(D_80275D28, near); - far = MIN(D_80275D2C, far); + near = MAX(s_viewport_near, near); + far = MIN(s_viewport_far, far); if(*(u32*)OS_PHYSICAL_TO_K1(0x1D8) + 0x53D4FFF0){ near = 750.0f; far = 1250.0f; } - guPerspective(*mtx, &sp5e, D_80275D20, D_80275D24, near, far, 0.5f); + guPerspective(*mtx, &sp5e, s_viewport_fovy, s_viewport_aspect, near, far, 0.5f); gSPPerspNormalize((*gfx)++, sp5e); gSPMatrix((*gfx)++, OS_PHYSICAL_TO_K0((*mtx)++), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); @@ -129,7 +131,7 @@ void func_8024C964(Gfx **gfx, Mtx **mtx, f32 near, f32 far){ } void func_8024CBD4(Gfx **gfx, Mtx **mtx){ - func_8024C964(gfx, mtx, D_80275D28, D_80275D2C); + func_8024C964(gfx, mtx, s_viewport_near, s_viewport_far); } void func_8024CC00(void){} @@ -150,12 +152,12 @@ void func_8024CC5C(void){ void func_8024CCC4(void){ func_8024CD7C(1); - func_8024CDF8(0.0f, 0.0f, 0.0f); - func_8024CE40(0.0f, 0.0f, 0.0f); + viewport_set_position_f3(0.0f, 0.0f, 0.0f); + viewport_set_rotation_f3(0.0f, 0.0f, 0.0f); func_8024CC08(40.0f); func_8024CE60(1.0f, 10000.0f); func_8024CC5C(); - func_8024DDB4(40.0f); + viewport_set_field_of_view(VIEWPORT_FOVY_DEFAULT); mlMtxIdent(); mlMtxRotYaw(-60.0f); mlMtxRotPitch(-90.0f); @@ -166,35 +168,35 @@ void func_8024CD7C(int arg0){ D_80280F90 = arg0; } -void viewport_setPosition(f32 src[3]){ +void viewport_set_position_vec3f(f32 src[3]){ ml_vec3f_copy(viewportPosition, src); } -void func_8024CDB0(s32 src[3]){ +void viewport_set_position_vec3w(s32 src[3]){ viewportPosition[0] = (f32)src[0]; viewportPosition[1] = (f32)src[1]; viewportPosition[2] = (f32)src[2]; } -void func_8024CDF8(f32 arg0, f32 arg1, f32 arg2){ - viewportPosition[0] = arg0; - viewportPosition[1] = arg1; - viewportPosition[2] = arg2; +void viewport_set_position_f3(f32 x, f32 y, f32 z){ + viewportPosition[0] = x; + viewportPosition[1] = y; + viewportPosition[2] = z; } -void viewport_setRotation(f32 src[3]){ +void viewport_set_rotation_vec3f(f32 src[3]){ ml_vec3f_copy(viewportRotation, src); } -void func_8024CE40(f32 arg0, f32 arg1, f32 arg2){ - viewportRotation[0] = arg0; - viewportRotation[1] = arg1; - viewportRotation[2] = arg2; +void viewport_set_rotation_f3(f32 pitch, f32 yaw, f32 roll){ + viewportRotation[0] = pitch; + viewportRotation[1] = yaw; + viewportRotation[2] = roll; } void func_8024CE60(f32 near, f32 far){ - D_80275D28 = near; - D_80275D2C = far; + s_viewport_near = near; + s_viewport_far = far; } void func_8024CE74(s32 arg0, s32 arg1, s32 arg2, s32 arg3){ @@ -348,14 +350,14 @@ bool func_8024D9B0(Cube *cube) { } bool func_8024DB50(f32 arg0[3], f32 arg1) { - f32 sp3C[3]; + f32 delta[3]; s32 i; - sp3C[0] = arg0[0] - viewportPosition[0]; - sp3C[1] = arg0[1] - viewportPosition[1]; - sp3C[2] = arg0[2] - viewportPosition[2]; + delta[0] = arg0[0] - viewportPosition[0]; + delta[1] = arg0[1] - viewportPosition[1]; + delta[2] = arg0[2] - viewportPosition[2]; for(i = 0; i < 4; i++){ - if(arg1 <= ml_dotProduct_vec3f(sp3C, D_80280ED0[i])){ + if(arg1 <= ml_dotProduct_vec3f(delta, D_80280ED0[i])){ return FALSE; } } @@ -392,20 +394,20 @@ Mtx *func_8024DD9C(void){ return &D_80280FD8; } -f32 func_8024DDA8(void){ - return D_80275D20; +f32 viewport_get_field_of_view(void){ + return s_viewport_fovy; } -void func_8024DDB4(f32 arg0){ - D_80275D20 = arg0; +void viewport_set_field_of_view(f32 fovy){ + s_viewport_fovy = fovy; } -f32 func_8024DDC0(void){ - return D_80275D24; +f32 viewport_get_aspect_ratio(void){ + return s_viewport_aspect; } -f32 func_8024DDCC(void){ - return D_80275D28; +f32 viewport_get_near(void){ + return s_viewport_near; } f32 func_8024DDD8(s32 arg0, f32 arg1){ @@ -413,16 +415,16 @@ f32 func_8024DDD8(s32 arg0, f32 arg1){ } f32 func_8024DE1C(f32 arg0, f32 arg1, f32 arg2[3], f32 arg3[3]) { - f32 sp24; + f32 fovy_rad; static f32 D_8028101C; static f32 D_80281020; static f32 D_80281024; - if ((D_80275D20 != D_8028101C) || (D_80275D28 != D_80281020)) { - sp24 = (D_80275D20 * M_PI) / 360.0; - D_80281024 = (500.0 + D_80275D28) / (((framebuffer_height / (f32)2) / sinf(sp24)) * cosf(sp24)); - D_8028101C = D_80275D20; - D_80281020 = D_80275D28; + if ((s_viewport_fovy != D_8028101C) || (s_viewport_near != D_80281020)) { + fovy_rad = (s_viewport_fovy * M_PI) / 360.0; + D_80281024 = (500.0 + s_viewport_near) / (((framebuffer_height / (f32)2) / sinf(fovy_rad)) * cosf(fovy_rad)); + D_8028101C = s_viewport_fovy; + D_80281020 = s_viewport_near; } arg0 = arg0 - (framebuffer_width / (f32)2); arg1 = (framebuffer_height / (f32)2) - arg1; @@ -431,7 +433,7 @@ f32 func_8024DE1C(f32 arg0, f32 arg1, f32 arg2[3], f32 arg3[3]) { arg3[2] = viewportRotation[2]; arg2[0] = arg0 * D_80281024; arg2[1] = arg1 * D_80281024; - arg2[2] = (-500.0 - D_80275D28); + arg2[2] = (-500.0 - s_viewport_near); ml_vec3f_pitch_rotate_copy(arg2, arg2, arg3[0]); ml_vec3f_yaw_rotate_copy(arg2, arg2, arg3[1]); @@ -456,13 +458,13 @@ bool func_8024E030(f32 arg0[3], f32 *arg1) f32 temp_f2_2; f32 temp_f2; f32 sp28; - sp28 = (D_80275D20 * 3.14159265358979323846) / 360.0; + sp28 = (s_viewport_fovy * M_PI) / 360.0; sp34[0] = arg0[0] - viewportPosition[0]; sp34[1] = arg0[1] - viewportPosition[1]; sp34[2] = arg0[2] - viewportPosition[2]; ml_vec3f_yaw_rotate_copy(sp34, sp34, -viewportRotation[1]); ml_vec3f_pitch_rotate_copy(sp34, sp34, -viewportRotation[0]); - if ((-D_80275D28) <= sp34[2]) { + if ((-s_viewport_near) <= sp34[2]) { return 0; } temp_f2 = gu_sqrtf((sp34[1] * sp34[1]) + (sp34[2] * sp34[2])) * sinf(sp28); @@ -480,8 +482,8 @@ bool func_8024E030(f32 arg0[3], f32 *arg1) void func_8024E258(void){ s32 i, j; - viewport_getPosition(D_80281028); - viewport_getRotation(D_80281038); + viewport_get_position_vec3f(D_80281028); + viewport_get_rotation_vec3f(D_80281038); func_8024D1EC(D_80281048, D_80281058, D_80281068, D_80281078); func_8024C5A8(D_80281088); for(i = 0; i < 4; i++){ @@ -493,8 +495,8 @@ void func_8024E258(void){ void func_8024E2FC(void){ s32 i, j; - viewport_setPosition(D_80281028); - viewport_setRotation(D_80281038); + viewport_set_position_vec3f(D_80281028); + viewport_set_rotation_vec3f(D_80281038); func_8024D2B0(D_80281048, D_80281058, D_80281068, D_80281078); ml_vec3f_copy(D_80280EA0, D_80281088); for(i = 0; i < 4; i++){ @@ -505,10 +507,10 @@ void func_8024E2FC(void){ } //moves the point(arg0) some distance (arg1) further away from the camera -void func_8024E3A8(f32 arg0[3], f32 arg1){ +void func_8024E3A8(f32 arg0[3], f32 distance){ f32 sp1C[3]; ml_vec3f_diff_copy(sp1C, viewportPosition, arg0); - ml_vec3f_set_length_copy(sp1C, sp1C, arg1); + ml_vec3f_set_length_copy(sp1C, sp1C, distance); arg0[0] += sp1C[0]; arg0[1] += sp1C[1]; arg0[2] += sp1C[2]; diff --git a/src/core1/data_1E820.c b/src/core1/data_1E820.c index ccd7b314..99bccb51 100644 --- a/src/core1/data_1E820.c +++ b/src/core1/data_1E820.c @@ -1 +1 @@ -unsigned long long D_80276E70 = 0xAB8D9F7781280783; \ No newline at end of file +unsigned long long D_80276E70 = 0xAB8D9F7781280783; diff --git a/src/core1/memory.c b/src/core1/memory.c index e88a24ce..c0c3d9a9 100644 --- a/src/core1/memory.c +++ b/src/core1/memory.c @@ -800,7 +800,7 @@ void func_80255A3C(void){ func_802E6820(1); if(!func_802559A0()) - func_802F542C(); + printbuffer_defrag(); if(!func_802559A0()){ ml_defrag(); diff --git a/src/core1/os/kdebugserver.c b/src/core1/os/kdebugserver.c index 9d062249..9686ad6e 100644 --- a/src/core1/os/kdebugserver.c +++ b/src/core1/os/kdebugserver.c @@ -1,4 +1,4 @@ #include //not included in final rom, but __osThreadSave is here for some reason -OSThread __osThreadSave; \ No newline at end of file +OSThread __osThreadSave; diff --git a/src/core2/bs/bFly.c b/src/core2/bs/bFly.c index 3d95e39d..c9bcd43c 100644 --- a/src/core2/bs/bFly.c +++ b/src/core2/bs/bFly.c @@ -36,7 +36,7 @@ int func_802A3350(void){ void func_802A339C(f32 arg0[3], f32 arg1[3], f32 arg2){ func_8024C5A8(arg0); ml_vec3f_scale(arg0, arg2); - viewport_getRotation(arg1); + viewport_get_rotation_vec3f(arg1); } void func_802A33D8(void){ diff --git a/src/core2/ch/badShad.c b/src/core2/ch/badShad.c index 6ee83745..950e3db0 100644 --- a/src/core2/ch/badShad.c +++ b/src/core2/ch/badShad.c @@ -88,7 +88,7 @@ f32 func_802D7038(Actor *this) { void func_802D7124(Actor *actor, f32 arg1) { f32 vp[3]; - viewport_getPosition(&vp); + viewport_get_position_vec3f(&vp); if ((actor->position[0] - vp[0]) * (actor->position[0] - vp[0]) + (actor->position[2] - vp[2]) * (actor->position[2] - vp[2]) < 12250000.0f) { func_802D729C(actor, arg1); } @@ -112,7 +112,7 @@ void func_802D71A0(s32 this, s32 arg1){ sp2C[0] = (s32) D_8037DE10[0]; sp2C[1] = (s32) D_8037DE10[1]; sp2C[2] = (s32) D_8037DE10[2]; - sp3C = func_803056FC(0x108, sp2C, (s32)sp38->yaw); + sp3C = spawn_actor(0x108, sp2C, (s32)sp38->yaw); if(sp3C){ marker_getActor(marker)->unk104 = sp3C->marker; sp3C->unk104 = marker; diff --git a/src/core2/ch/bottlesbonus.c b/src/core2/ch/bottlesbonus.c index ec45b440..50f9b833 100644 --- a/src/core2/ch/bottlesbonus.c +++ b/src/core2/ch/bottlesbonus.c @@ -139,8 +139,8 @@ void chBottlesBonus_func_802DD080(Gfx **gfx, Mtx **mtx) { vp_rotation[1] = 270.0f; vp_rotation[2] = 0.0f; } - viewport_setPosition(vp_position); - viewport_setRotation(vp_rotation); + viewport_set_position_vec3f(vp_position); + viewport_set_rotation_vec3f(vp_rotation); viewport_update(); func_8024C904(gfx, mtx); } @@ -505,7 +505,7 @@ void chBottlesBonus_update(Actor *this) { this->unk60 += sp50; switch(this->state){ case 1: - if ((this->unk60 > 2.0) && gctransition_8030BD98()) { + if ((this->unk60 > 2.0) && gctransition_done()) { this->unk60 = 0.0f; func_8025A6EC(COMUSIC_98_BBONUS_PIECES_SHUFFLE, -1); comusic_8025AB44(COMUSIC_95_BBONUS_A, 0, 2000); diff --git a/src/core2/ch/code_468E0.c b/src/core2/ch/code_468E0.c index 0d96f9f3..abc75f55 100644 --- a/src/core2/ch/code_468E0.c +++ b/src/core2/ch/code_468E0.c @@ -88,11 +88,11 @@ void func_802CDAC4(Actor *this){ f32 sp1C[3]; camera_setType(1); - viewport_setPosition(this->position); + viewport_set_position_vec3f(this->position); sp1C[0] = this->pitch; sp1C[1] = this->yaw; sp1C[2] = 0.0f; - viewport_setRotation(sp1C); + viewport_set_rotation_vec3f(sp1C); } void func_802CDB18(Actor *this){ diff --git a/src/core2/ch/gravestone.c b/src/core2/ch/gravestone.c index c3fef13b..69a08929 100644 --- a/src/core2/ch/gravestone.c +++ b/src/core2/ch/gravestone.c @@ -3,9 +3,9 @@ #include "variables.h" #include "core2/particle.h" - Actor *func_8035ECA0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); void func_8035F138(Actor *this); +extern bool func_803257B4(ActorMarker *marker); extern void actor_postdrawMethod(ActorMarker *); extern f32 func_80257204(f32, f32, f32, f32); diff --git a/src/core2/ch/overlaynocontroller.c b/src/core2/ch/overlaynocontroller.c index e870582f..b9f5f279 100644 --- a/src/core2/ch/overlaynocontroller.c +++ b/src/core2/ch/overlaynocontroller.c @@ -40,8 +40,8 @@ Actor *chOverlayNoController_draw(ActorMarker *marker, Gfx **gdl, Mtx **mptr, Vt 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;}; - viewport_setPosition(sp58); - viewport_setRotation(sp4C); + viewport_set_position_vec3f(sp58); + viewport_set_rotation_vec3f(sp4C); viewport_update(); func_8024C904(gdl, mptr); {sp40[0] = 0.0f; sp40[1] = 0.0f; sp40[2] = 0.0f;}; diff --git a/src/core2/ch/overlaypressstart.c b/src/core2/ch/overlaypressstart.c index 2777d9fa..74fdb6e8 100644 --- a/src/core2/ch/overlaypressstart.c +++ b/src/core2/ch/overlaypressstart.c @@ -50,8 +50,8 @@ Actor *chOverlayPressStart_draw(ActorMarker *marker, Gfx **gdl, Mtx **mptr, Vtx 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;}; - viewport_setPosition(sp58); - viewport_setRotation(sp4C); + viewport_set_position_vec3f(sp58); + viewport_set_rotation_vec3f(sp4C); viewport_update(); func_8024C904(gdl, mptr); {sp40[0] = 0.0f; sp40[1] = 0.0f; sp40[2] = 0.0f;}; diff --git a/src/core2/ch/shrapnel.c b/src/core2/ch/shrapnel.c index ad81168d..ef741ee9 100644 --- a/src/core2/ch/shrapnel.c +++ b/src/core2/ch/shrapnel.c @@ -85,12 +85,12 @@ void chShrapnel_emitSmoke(Actor *this) { func_802EFB84(temp_v0, 2.0f, 3.0f); particleEmitter_setParticleSpawnPositionRange(temp_v0, -75.0f, 25.0f, -75.0f, 75.0f, 75.0f, 75.0f); particleEmitter_setParticleVelocityRange(temp_v0, -70.0f, 50.0f, -70.0f, 70.0f, 100.0f, 70.0f); - particleEmitter_setRGB(temp_v0, &D_803673F8); + particleEmitter_setRGB(temp_v0, D_803673F8); particleEmitter_setParticleLifeTimeRange(temp_v0, 3.0f, 4.0f); particleEmitter_emitN(temp_v0, 6); } -void chShrapnel_emitBodyParts(Actor *this, enum model_e model_id, s32 n) { +void chShrapnel_emitBodyParts(Actor *this, enum asset_e model_id, s32 n) { ParticleEmitter *temp_v0; temp_v0 = partEmitMgr_newEmitter(n); diff --git a/src/core2/ch/snowball.c b/src/core2/ch/snowball.c index b5404a14..1134ead5 100644 --- a/src/core2/ch/snowball.c +++ b/src/core2/ch/snowball.c @@ -3,8 +3,9 @@ #include "variables.h" extern void func_80329904(ActorMarker *, s32, f32 *); -extern int func_80320C94(f32 (*)[3], f32(*)[3], f32, s32, s32, u32); extern f32 func_8033229C(ActorMarker *); +extern BKCollisionTri *func_80320C94(f32[3], f32[3], f32, f32[3], s32, u32); + typedef struct{ s32 unk0; diff --git a/src/core2/ch/termite.c b/src/core2/ch/termite.c index 8d423ca3..90910ccd 100644 --- a/src/core2/ch/termite.c +++ b/src/core2/ch/termite.c @@ -52,7 +52,7 @@ void __chTermite_updateWalkSFX(Actor *this) { f32 sp24[3]; f32 sp20; - viewport_getPosition(&sp24); + viewport_get_position_vec3f(&sp24); sp20 = ml_map_f( (300.0f - sp24[0])*(300.0f - sp24[0]) + (this->position[1] - sp24[1])*(this->position[1] - sp24[1]) + (-858.0f - sp24[2])*(-858.0f - sp24[2]) , 7617600.0f, 8236900.0f , 8000.0f, 1000.0f diff --git a/src/core2/code_14420.c b/src/core2/code_14420.c index d0de9d82..7746ea2e 100644 --- a/src/core2/code_14420.c +++ b/src/core2/code_14420.c @@ -203,7 +203,7 @@ f32 func_8029B41C(void){ f32 sp1C; player_getPosition(sp2C); - viewport_getPosition(sp20); + viewport_get_position_vec3f(sp20); func_80257F18(sp2C, sp20, &sp1C); return sp1C; } @@ -363,7 +363,7 @@ void func_8029B984(f32 dst[3]){ f32 sp18[3]; _player_getPosition(plyr_pos); - viewport_getPosition(sp18); + viewport_get_position_vec3f(sp18); ml_vec3f_diff_copy(dst, sp18, plyr_pos); } diff --git a/src/core2/code_33C30.c b/src/core2/code_33C30.c index be14e397..e4a74d11 100644 --- a/src/core2/code_33C30.c +++ b/src/core2/code_33C30.c @@ -33,8 +33,8 @@ void func_802BAC58(void) { f32 vp_rotation[3]; f32 sp1C[3]; - viewport_getPosition(vp_position); - viewport_getRotation(vp_rotation); + viewport_get_position_vec3f(vp_position); + viewport_get_rotation_vec3f(vp_rotation); func_802BEA4C(vp_rotation, vp_position, 150.0f, sp1C); if (D_8037D810 == NULL) { D_8037D810 = func_8032FBE4(sp1C, func_802BABC0, 1, 0x15D); diff --git a/src/core2/code_34790.c b/src/core2/code_34790.c index bc703d97..d5560b98 100644 --- a/src/core2/code_34790.c +++ b/src/core2/code_34790.c @@ -106,7 +106,7 @@ f32 func_802BB938(f32 arg0[3], f32 arg1[3]) { phi_f20 = 65.0f; } - if (gctransition_8030BDAC()) { + if (gctransition_active()) { phi_f20 = ml_min_f(phi_f20, gctransition_8030BD88() * 0.8); } return phi_f20; @@ -120,8 +120,8 @@ void func_802BBA84(void) { f32 max[3]; mapModel_getBounds(min, max); - viewport_getPosition(vp_position); - viewport_getRotation(vp_rotation); + viewport_get_position_vec3f(vp_position); + viewport_get_rotation_vec3f(vp_rotation); func_8024C5A8(sp48); D_8037D8CC = (f32) func_8033EAF8(min, max, vp_position, sp48); D_8037D8CC += 100.0f; @@ -295,11 +295,11 @@ void ncCamera_update(void){ break; } - viewport_getPosition(sp2C); - viewport_getRotation(sp20); + viewport_get_position_vec3f(sp2C); + viewport_get_rotation_vec3f(sp20); func_802BB4D8(sp2C, sp20); - viewport_setPosition(sp2C); - viewport_setRotation(sp20); + viewport_set_position_vec3f(sp2C); + viewport_set_rotation_vec3f(sp20); viewport_update(); func_802BEFB0(); func_802BBA84(); @@ -352,8 +352,8 @@ void func_802BC2CC(s32 arg0) { if (ncCameraType == CAMERA_TYPE_2_DYNAMIC) { func_802BE894(D_8037D918, D_8037D908); } - viewport_setPosition(D_8037D908); - viewport_setRotation(D_8037D918); + viewport_set_position_vec3f(D_8037D908); + viewport_set_rotation_vec3f(D_8037D918); viewport_update(); __spawnQueue_add_2((GenFunction_2)func_802BC2A0, reinterpret_cast(s32, sp24), reinterpret_cast(s32, sp20)); if (ncCameraType == CAMERA_TYPE_2_DYNAMIC) { diff --git a/src/core2/code_37E50.c b/src/core2/code_37E50.c index 5daea25c..2a2b41ba 100644 --- a/src/core2/code_37E50.c +++ b/src/core2/code_37E50.c @@ -94,7 +94,7 @@ void func_802BEFB0(void) { return; } D_8037DA80.unk10 += time_getDelta(); - viewport_getPosition(sp30); + viewport_get_position_vec3f(sp30); sp24[0] = sp30[0]; sp24[1] = sp30[1] + 10000.0f; sp24[2] = sp30[2]; diff --git a/src/core2/code_43800.c b/src/core2/code_43800.c index f83efc26..1c341227 100644 --- a/src/core2/code_43800.c +++ b/src/core2/code_43800.c @@ -63,7 +63,7 @@ void func_802CA92C(Actor *this){ f32 sp28[3]; this->marker->collidable = FALSE; player_getPosition(this->position); - viewport_getPosition(sp34); + viewport_get_position_vec3f(sp34); ml_vec3f_diff_copy(sp28, sp34, this->position); ml_vec3f_set_length_copy(sp28, sp28, 180.0f); this->position_x += sp28[0]; diff --git a/src/core2/code_45310.c b/src/core2/code_45310.c index 379ace82..6da38fbd 100644 --- a/src/core2/code_45310.c +++ b/src/core2/code_45310.c @@ -434,7 +434,7 @@ void func_802CCC5C(Actor *this) { } if (this->state == 1) { player_getPosition(sp8C); - viewport_getPosition(sp80); + viewport_get_position_vec3f(sp80); func_8024C5A8(sp74); sp5C[0] = this->position[0] - sp80[0]; sp5C[1] = this->position[1] - sp80[1]; diff --git a/src/core2/code_55390.c b/src/core2/code_55390.c index 7106828c..00ae1f2d 100644 --- a/src/core2/code_55390.c +++ b/src/core2/code_55390.c @@ -38,8 +38,8 @@ Actor *func_802DC320(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ vp_rotation[0] = 0.0f; vp_rotation[1] = 0.0f; vp_rotation[2] = 0.0f; - viewport_setPosition(vp_position); - viewport_setRotation(vp_rotation); + viewport_set_position_vec3f(vp_position); + viewport_set_rotation_vec3f(vp_rotation); viewport_update(); func_8024C904(gfx, mtx); model_position[0] = 0.0f; diff --git a/src/core2/code_55850.c b/src/core2/code_55850.c index f234651c..f4cc3204 100644 --- a/src/core2/code_55850.c +++ b/src/core2/code_55850.c @@ -37,8 +37,8 @@ Actor *func_802DC7E0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ sp4C[0] = 0.0f; sp4C[1] = 0.0f; sp4C[2] = 0.0f; - viewport_setPosition(sp58); - viewport_setRotation(sp4C); + viewport_set_position_vec3f(sp58); + viewport_set_rotation_vec3f(sp4C); viewport_update(); func_8024C904(gfx, mtx); sp40[0] = 0.0f; diff --git a/src/core2/code_59780.c b/src/core2/code_59780.c index 913cf71e..7f3a94c3 100644 --- a/src/core2/code_59780.c +++ b/src/core2/code_59780.c @@ -145,6 +145,6 @@ void func_802E08F0(Actor *this) { if (actor_animationIsAt(this, 0.99f) != 0) { marker_despawn(this->marker); } - viewport_getRotation(sp24); + viewport_get_rotation_vec3f(sp24); this->yaw = sp24[1]; } diff --git a/src/core2/code_5C870.c b/src/core2/code_5C870.c index 8a445ee7..c8879970 100644 --- a/src/core2/code_5C870.c +++ b/src/core2/code_5C870.c @@ -5,8 +5,8 @@ #include "gc/gctransition.h" extern void func_8024C510(f32); -extern void func_8024CDF8(f32, f32, f32); -extern void func_8024CE40(f32, f32, f32); +extern void viewport_set_position_f3(f32, f32, f32); +extern void viewport_set_rotation_f3(f32, f32, f32); extern void func_8024CE60(f32, f32); extern void func_802F5374(void); extern void func_802FA0F8(void); @@ -64,8 +64,8 @@ struct{ } D_8037E8E0; void func_802E3800(void){ - func_8024CDF8(0.0f, 0.0f, 0.0f); - func_8024CE40(-30.0f, 30.0f, 0.0f); + viewport_set_position_f3(0.0f, 0.0f, 0.0f); + viewport_set_rotation_f3(-30.0f, 30.0f, 0.0f); func_8024C510(3000.0f); viewport_update(); } @@ -79,13 +79,13 @@ void func_802E3854(void){ func_802E6820(5); modelRender_defrag(); mapSavestate_defrag_all(); - gctransition_8030B740(); - func_802F542C(); + gctransition_defrag(); + printbuffer_defrag(); func_80350E00(); func_802FA4E0(); func_8033B5FC(); timedFuncQueue_defrag(); - func_8025AF38(); + comusic_defrag(); } } @@ -536,7 +536,7 @@ bool func_802E4424(void) { && func_8028F070() && (func_8028EC04() == 0) && !gctransition_8030BDC0() - && gctransition_8030BD98() + && gctransition_done() && (level_get() != 0) && (0.6 < D_8037E8E0.unk10) && gcpausemenu_80314B00() @@ -596,7 +596,7 @@ s32 game_defrag(void){ actorArray_defrag(); spawnQueue_defrag(); func_802F3300(); - func_802F542C(); + printbuffer_defrag(); gcdialog_defrag(); if(D_8037E8E0.game_mode == GAME_MODE_4_PAUSED) gcpausemenu_defrag(); diff --git a/src/core2/code_5FD90.c b/src/core2/code_5FD90.c index a28ea5cc..fdf89b10 100644 --- a/src/core2/code_5FD90.c +++ b/src/core2/code_5FD90.c @@ -971,29 +971,30 @@ BKCollisionTri *func_802E92AC(BKCollisionList *collisionList, BKVertexList *vert return spD0; } -s32 func_802E9DD8(BKCollisionList *collisionList, BKVertexList *vtxList, f32 arg2[3], f32 *arg3, f32 arg4, f32 arg5[3], f32 arg6, f32 arg7[3], s32 arg8) { +s32 func_802E9DD8(BKCollisionList *collisionList, BKVertexList *vtxList, f32 posA[3], f32 *rotA, f32 scaleA, f32 posB[3], f32 radB, f32 arg7[3], s32 arg8) { f32 sp34[3]; s32 sp30; s32 i; - if ((vtxList->global_norm * arg4) <= (ml_distance_vec3f(arg5, arg2) - arg6)) { + // check if (sphere around vtx's) <= ((distance between origins) - (radius of B)) + if ((vtxList->global_norm * scaleA) <= (ml_distance_vec3f(posB, posA) - radB)) { return 0; } mlMtxIdent(); - func_80252CC4(arg2, arg3, arg4, 0); - func_8025235C(sp34, arg5); - sp30 = func_802E92AC(collisionList, vtxList, &sp34, arg6 / arg4, arg7, arg8); + func_80252CC4(posA, rotA, scaleA, NULL); + func_8025235C(sp34, posB); + sp30 = func_802E92AC(collisionList, vtxList, &sp34, radB / scaleA, arg7, arg8); if (sp30 == 0) { return 0; } mlMtxIdent(); - func_80252C08(arg2, arg3, arg4, NULL); - func_8025235C(arg5, sp34); + func_80252C08(posA, rotA, scaleA, NULL); + func_8025235C(posB, sp34); mlMtxIdent(); - func_80252C08(NULL, arg3, 1.0f, NULL); + func_80252C08(NULL, rotA, 1.0f, NULL); func_8025235C(arg7, arg7); mlMtxIdent(); - func_80252C08(arg2, arg3, arg4, NULL); + func_80252C08(posA, rotA, scaleA, NULL); for(i = 0; i < 3; i++){ func_8025235C(D_8037EAA8[i], D_8037EAA8[i]); diff --git a/src/core2/code_637D0.c b/src/core2/code_637D0.c index 5d730a15..b3118452 100644 --- a/src/core2/code_637D0.c +++ b/src/core2/code_637D0.c @@ -4,7 +4,7 @@ extern void func_80252C08(f32[3], f32[3], f32, f32[3]); extern void func_80252CC4(f32[3], f32[3], f32, s32); -extern void func_802524F0(f32[3], f32, f32, f32); +extern void mlMtx_apply_f3(f32[3], f32, f32, f32); extern s32 func_802EBAE0(BKModelUnk14List *arg0, f32 position[3], f32 rotation[3], f32 scale, s32 arg4, s32 arg5, f32 arg6[3], f32 arg7, f32 arg8[3]); /* .bss */ Mtx D_80380880; @@ -191,10 +191,10 @@ s32 func_802EAED4(BKModelUnk14List *arg0, f32 position[3], f32 rotation[3], f32 spD0[0] *= 2; spD0[1] *= 2; spD0[2] *= 2; - func_802519C8(&D_80380880, animMtxList_get(arg5, i_ptr->unk16)); + mlMtx_push_multiplied_2(&D_80380880, animMtxList_get(arg5, i_ptr->unk16)); func_80252E4C(spF4, spD0); - func_802524F0(spB0, spE8[0], spE8[1], spE8[2]); - func_802524F0(sp98, spE8[0], spE8[1], spDC[2]); + mlMtx_apply_f3(spB0, spE8[0], spE8[1], spE8[2]); + mlMtx_apply_f3(sp98, spE8[0], spE8[1], spDC[2]); spBC[0] = spB0[0] - sp98[0]; spBC[1] = spB0[1] - sp98[1]; spBC[2] = spB0[2] - sp98[2]; @@ -208,7 +208,7 @@ s32 func_802EAED4(BKModelUnk14List *arg0, f32 position[3], f32 rotation[3], f32 sp8C[1] = arg6[1] - sp98[1]; sp8C[2] = arg6[2] - sp98[2]; if (!(arg7 <= -((sp8C[0]*spBC[0]) + (sp8C[1]*spBC[1]) + (sp8C[2]*spBC[2])))) { - func_802524F0(sp80, spDC[0], spE8[1], spE8[2]); + mlMtx_apply_f3(sp80, spDC[0], spE8[1], spE8[2]); spBC[0] = spB0[0] - sp80[0]; spBC[1] = spB0[1] - sp80[1]; spBC[2] = spB0[2] - sp80[2]; @@ -219,7 +219,7 @@ s32 func_802EAED4(BKModelUnk14List *arg0, f32 position[3], f32 rotation[3], f32 sp74[1] = arg6[1] - sp80[1]; sp74[2] = arg6[2] - sp80[2]; if (!(arg7 <= -((sp74[0]*spBC[0]) + (sp74[1]*spBC[1]) + (sp74[2]*spBC[2])))) { - func_802524F0(sp68, spE8[0], spDC[1], spE8[2]); + mlMtx_apply_f3(sp68, spE8[0], spDC[1], spE8[2]); spBC[0] = spB0[0] - sp68[0]; spBC[1] = spB0[1] - sp68[1]; spBC[2] = spB0[2] - sp68[2]; @@ -270,11 +270,11 @@ s32 func_802EB458(BKModelUnk14List *arg0, f32 position[3], f32 rotation[3], f32 spAC[0] = (f32) (i_ptr->unkA[0] * 2); spAC[1] = (f32) (i_ptr->unkA[1] * 2); spAC[2] = (f32) (i_ptr->unkA[2] * 2); - func_802519C8(&D_80380880, animMtxList_get(arg5, i_ptr->unkE)); + mlMtx_push_multiplied_2(&D_80380880, animMtxList_get(arg5, i_ptr->unkE)); func_80252D8C(spB8, spAC); - func_802524F0(sp98, 0.0f, 0.0f, (f32) ((-i_ptr->unk2) / 2)); - func_802524F0(sp8C, 0.0f, 0.0f, (f32) (i_ptr->unk2 / 2)); - func_802524F0(sp68, (f32) i_ptr->unk0, 0.0f, (f32) ((-i_ptr->unk2) / 2)); + mlMtx_apply_f3(sp98, 0.0f, 0.0f, (f32) ((-i_ptr->unk2) / 2)); + mlMtx_apply_f3(sp8C, 0.0f, 0.0f, (f32) (i_ptr->unk2 / 2)); + mlMtx_apply_f3(sp68, (f32) i_ptr->unk0, 0.0f, (f32) ((-i_ptr->unk2) / 2)); sp68[0] -= sp98[0]; sp68[1] -= sp98[1]; sp68[2] -= sp98[2]; @@ -445,7 +445,7 @@ s32 func_802EBD3C(BKModelUnk14List *arg0, f32 arg1[3], f32 rotation[3], f32 scal i_rotation[2] *= 2; mlMtxIdent(); - func_80252EC8(i_position, i_rotation); //rotate about point + func_80252EC8(i_position, i_rotation); //derotate about point func_80252CC4(arg1, rotation, scale, arg4); func_8025235C(sp68, arg5); //apply matrix to arg5 for (i = 0; i < 3; i++) @@ -522,35 +522,35 @@ s32 func_802EC238(BKModelUnk14List *arg0, f32 arg1[3], f32 rotation[3], f32 scal mlMtxIdent(); func_80252CC4(arg1, rotation, scale, arg4); func_8025235C(sp54, arg5); - for (i_ptr = i_ptr; i_ptr < end_ptr; i_ptr++) - { - if ((i_ptr->unk8 != 0) && ((arg6 == 0) || (arg6 == i_ptr->unk8))) - { + for (i_ptr = i_ptr; i_ptr < end_ptr; i_ptr++) { + if ((i_ptr->unk8 != 0) && ((arg6 == 0) || (arg6 == i_ptr->unk8))) { sp40[0] = i_ptr->unk2[0]; sp40[1] = i_ptr->unk2[1]; sp40[2] = i_ptr->unk2[2]; scale = i_ptr->unk0; if (ml_distance_vec3f(sp40, sp54) < scale) return i_ptr->unk8; - if (!i_ptr->unk0){ - - } + if (!i_ptr->unk0){ } } } return 0U; } -s32 func_802EC394(BKModelUnk14List *arg0, f32 arg1[3], f32 rotation[3], f32 scale, f32 arg4[3], f32 arg5[3], s32 arg6) { +s32 func_802EC394(BKModelUnk14List *arg0, f32 position[3], f32 rotation[3], f32 scale, f32 arg4[3], f32 arg5[3], s32 arg6) { s32 phi_v0; - phi_v0 = func_802EBD3C(arg0, arg1, rotation, scale, arg4, arg5, arg6); + //transform type 0 + phi_v0 = func_802EBD3C(arg0, position, rotation, scale, arg4, arg5, arg6); if (phi_v0 != NULL) { return phi_v0; } - phi_v0 = func_802EC000(arg0, arg1, rotation, scale, arg4, arg5, arg6); + //transform type 1 + phi_v0 = func_802EC000(arg0, position, rotation, scale, arg4, arg5, arg6); if (phi_v0 != NULL) { return phi_v0; } - return func_802EC238(arg0, arg1, rotation, scale, arg4, arg5, arg6); + + //transform type 2 + return func_802EC238(arg0, position, rotation, scale, arg4, arg5, arg6); } diff --git a/src/core2/code_654C0.c b/src/core2/code_654C0.c index ce0e8104..f5d43b35 100644 --- a/src/core2/code_654C0.c +++ b/src/core2/code_654C0.c @@ -215,7 +215,7 @@ void func_802ECBD4(BKVertexList *dst, BKVertexList *src, f32 arg2[3], f32 rotati f32 temp_f0; s32 pad40; - viewport_getPosition(sp74); + viewport_get_position_vec3f(sp74); func_8024C5A8(sp68); mlMtxIdent(); func_80252CC4(arg2, rotation, 1.0f, NULL); diff --git a/src/core2/code_6A4B0.c b/src/core2/code_6A4B0.c index 3e5a5871..593edb1a 100644 --- a/src/core2/code_6A4B0.c +++ b/src/core2/code_6A4B0.c @@ -160,7 +160,7 @@ void func_802F1A10(Struct_Core2_6A4B0_2 *arg0, f32 angle_degrees) { cos = cosf(angle_degrees * 2 * BAD_PI); sin = sinf(angle_degrees * 2 * BAD_PI); - viewport_getPosition(spC0); + viewport_get_position_vec3f(spC0); spCC[0] = (-(framebuffer_width / 2) * 4) + 8; spCC[1] = ((framebuffer_height / 2) * 4) - 0x38; spCC[2] = -0xA; @@ -214,7 +214,7 @@ void func_802F1CAC(Struct_Core2_6A4B0_2 *arg0) { s32 *var_s2; - viewport_getPosition(sp78); + viewport_get_position_vec3f(sp78); sp84[0] = (s32) ((1000.0f - sp78[0]) - 200.0f); sp84[1] = (s32) ((0.0f - sp78[1]) + 300.0f); sp84[2] = (s32) ((2000.0f - sp78[2]) + 0.0f); diff --git a/src/core2/code_6B030.c b/src/core2/code_6B030.c index c44c45e3..34673821 100644 --- a/src/core2/code_6B030.c +++ b/src/core2/code_6B030.c @@ -67,7 +67,7 @@ void func_802F1FC0(Struct65s *self, Gfx **gfx, Mtx **mtx, Vtx **vtx) { s32 width; s32 height; - viewport_getPosition(spDC); + viewport_get_position_vec3f(spDC); spD0[0] = self->unk0[0] - spDC[0]; spD0[1] = self->unk0[1] - spDC[1]; spD0[2] = self->unk0[2] - spDC[2]; @@ -326,7 +326,7 @@ void func_802F2ED0(Struct64s *arg0, Gfx **gfx, Mtx **mtx, Vtx **vtx) { f32 sp38[3]; if (arg0 != NULL && arg0->unk4) { - viewport_getRotation(sp38); + viewport_get_rotation_vec3f(sp38); mlMtxIdent(); mlMtxRotPitch(-sp38[0]); mlMtxRotYaw(-sp38[1]); diff --git a/src/core2/code_6D270.c b/src/core2/code_6D270.c index 8476014f..7a282063 100644 --- a/src/core2/code_6D270.c +++ b/src/core2/code_6D270.c @@ -36,7 +36,7 @@ ParticleEmitter *func_802F4274(f32 arg0[3]) { ml_vec3f_copy(sp2C, arg0); func_8024559C(sp2C, &sp20, &sp28); sp2C[1] = sp28 + 14.0f; - viewport_getPosition(sp38); + viewport_get_position_vec3f(sp38); sp44[0] = sp38[0] - sp2C[0]; sp44[2] = sp38[2] - sp2C[2]; sp44[1] = 0.0f; diff --git a/src/core2/code_6DA30.c b/src/core2/code_6DA30.c index 5c30b3d6..35f72df1 100644 --- a/src/core2/code_6DA30.c +++ b/src/core2/code_6DA30.c @@ -479,7 +479,7 @@ void func_802F53D0(void){ D_80380B18 = 0; } -void func_802F542C(void){ +void printbuffer_defrag(void){ print_sFonts[0] = (FontLetter *)defrag(print_sFonts[0]); print_sFonts[1] = (FontLetter *)defrag(print_sFonts[1]); if(print_sFonts[3]){ diff --git a/src/core2/code_70F20.c b/src/core2/code_70F20.c index 96ba9485..c5344f0e 100644 --- a/src/core2/code_70F20.c +++ b/src/core2/code_70F20.c @@ -20,7 +20,7 @@ void func_802F7EB0(struct3s *this){ player_getPosition(plyrPos); func_8024C5A8(camNorm); - viewport_getRotation(camRot); + viewport_get_rotation_vec3f(camRot); sp50 = vector_pushBackNew(&this->unk20); tmpf = randf2(50.0f, 1100.0f); sp4C[0] = 0.0f; diff --git a/src/core2/code_71820.c b/src/core2/code_71820.c index 0164dbb9..22b8a7d9 100644 --- a/src/core2/code_71820.c +++ b/src/core2/code_71820.c @@ -21,7 +21,7 @@ void func_802F87B0(struct6s *this){ player_getPosition(plyrPos); func_8024C5A8(camNorm); - viewport_getRotation(camRot); + viewport_get_rotation_vec3f(camRot); ptr = vector_pushBackNew(&this->unk1C); f20 = randf2(50.0f, 1200.0f); sp4C[0] = 0.0f; diff --git a/src/core2/code_72060.c b/src/core2/code_72060.c index 0ab87595..895b4055 100644 --- a/src/core2/code_72060.c +++ b/src/core2/code_72060.c @@ -7,11 +7,11 @@ typedef struct { f32 unkC[3]; }Struct_core2_72060_0; -extern f32 viewport_getYaw(); +extern f32 viewport_get_yaw(); extern int func_8024DD34(f32, f32, f32); extern void func_80251B5C(f32, f32, f32); -extern void func_80251F8C(f32); -extern void func_8025208C(f32); +extern void mlMtx_rotate_pitch_deg(f32); +extern void mlMtx_rotate_yaw_deg(f32); extern void func_80252A38(f32, f32, f32); extern void mlMtxApply(Mtx *); extern f32 vtxList_getGlobalNorm(BKVertexList *); @@ -166,7 +166,7 @@ void func_802F919C(void) { } else { var_f20 = 70.0f; } - ml_vec3f_yaw_rotate_copy(sp4C, sp4C, viewport_getYaw() + randf2(-var_f20, var_f20)); + ml_vec3f_yaw_rotate_copy(sp4C, sp4C, viewport_get_yaw() + randf2(-var_f20, var_f20)); sp4C[0] += D_80381040[0]; sp4C[1] += D_80381040[1]; sp4C[2] += D_80381040[2]; @@ -200,8 +200,8 @@ void func_802F962C(Gfx **gfx, Mtx **mtx, Vtx **vtx) { void *phi_s0_2; if ((D_80369280 != NULL) && (D_80369284 != 0)) { - viewport_getPosition(D_80381050); - viewport_getRotation(D_80381060); + viewport_get_position_vec3f(D_80381050); + viewport_get_rotation_vec3f(D_80381060); D_80381090 = (s32)D_80369288 + D_80369288->gfx_list_offset_C + sizeof(BKGfxList); temp_s3 = (BKVertexList *)((s32)D_80369288 + D_80369288->vtx_list_offset_10); D_8038108C = vtxList_getGlobalNorm(temp_s3); @@ -237,8 +237,8 @@ bool func_802F989C(Gfx **gfx, Mtx **mtx, f32 arg2[3]) { mlMtxApply(*mtx); func_80252434(&D_80381080, D_80381094->unkC); func_80251B5C(D_80381080[0], D_80381080[1], D_80381080[2]); - func_8025208C(D_80381060[1]); - func_80251F8C(D_80381060[0]); + mlMtx_rotate_yaw_deg(D_80381060[1]); + mlMtx_rotate_pitch_deg(D_80381060[0]); func_80252A38(-(D_80381094->unkC[0]), -(D_80381094->unkC[1]), -(D_80381094->unkC[2])); mlMtxApply(*mtx); gSPMatrix((*gfx)++, (*mtx)++, G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/core2/code_7AF80.c b/src/core2/code_7AF80.c index c10d279e..9cf129e4 100644 --- a/src/core2/code_7AF80.c +++ b/src/core2/code_7AF80.c @@ -4,6 +4,8 @@ #include "prop.h" +#define SQ(x) ((x) * (x)) + extern f32 ml_distanceSquared_vec3f(f32[3], f32[3]); extern f32 func_802586B0(f32[3], f32[3]); extern void mapModel_getCubeBounds(s32 min[3], s32 max[3]); @@ -14,14 +16,9 @@ extern ActorProp *func_803322F0(Cube *, ActorMarker *, f32, s32, s32 *); extern BKCollisionTri *func_803319C0(Cube *cube, f32 position[3], f32 radius, f32 arg2[3], u32 flags); extern BKCollisionTri *func_80331638(Cube *cube, f32 volume_p1[3], f32 volume_p2[3], f32 radius, f32 arg2[3], s32, u32 flags); -typedef struct { - s32 unk0; - NodeProp *unk4; -} Struct_core2_7AF80_0; - typedef struct{ - s32 unk0[3]; - s32 unkC; + s32 position[3]; + s32 radius; u32 unk10_31: 28; u32 unk10_3: 3; u32 unk10_0: 1; @@ -29,7 +26,7 @@ typedef struct{ } Struct_core2_7AF80_2; typedef struct { - s32 unk0; //count + s32 count; //count s32 unk4; Struct_core2_7AF80_2 *unk8; } Struct_core2_7AF80_1; @@ -381,8 +378,8 @@ void func_80302C94(Gfx **gfx, Mtx **mtx, Vtx **vtx) { return; func_8032D3A8(); - viewport_getPosition(vp_position); - viewport_getRotation(vp_rotation); + viewport_get_position_vec3f(vp_position); + viewport_get_rotation_vec3f(vp_rotation); func_80256664(vp_rotation); cube_positionToIndices(vp_cube_indices, vp_position); vp_cube_indices[0] -= D_80381FA0.min[0];\ @@ -539,12 +536,12 @@ Cube *cube_atPosition_s32(s32 position[3]) { } Cube *cube_atPosition_f32(f32 position[3]){ - s32 sp1C[3]; + s32 pos_s32[3]; - sp1C[0] = (s32)position[0]; - sp1C[1] = (s32)position[1]; - sp1C[2] = (s32)position[2]; - return cube_atPosition_s32(sp1C); + pos_s32[0] = (s32)position[0]; + pos_s32[1] = (s32)position[1]; + pos_s32[2] = (s32)position[2]; + return cube_atPosition_s32(pos_s32); } Cube *func_8030364C(void){ @@ -937,7 +934,7 @@ s32 func_80304984(s32 arg0, u32 *arg1) { temp_v0 = cubeList_findNodePropByActorId(arg0, 0); if (temp_v0 != 0) { - *arg1 = temp_v0->unk6.bit15; + *arg1 = temp_v0->unk6.radius; return 1; } return 0; @@ -1031,7 +1028,7 @@ NodeProp *func_80304D04(s32 arg0, s16 *arg1) { } s32 nodeprop_getRadius(NodeProp *arg0) { - return arg0->unk6.bit15; + return arg0->unk6.radius; } void func_80304D4C(NodeProp *arg0, s32 dst[3]) { @@ -1239,7 +1236,7 @@ NodeProp *func_80305510(s32 arg0) { } Actor * func_803055E0(enum actor_e arg0, s32 arg1[3], s32 arg2, s32 arg3, s32 arg4){ - Actor *actor = func_803056FC(arg0, arg1, arg2); + Actor *actor = spawn_actor(arg0, arg1, arg2); NodeProp *tmp; s32 sp34[3]; f32 sp28[3]; @@ -1264,14 +1261,11 @@ Actor * func_803055E0(enum actor_e arg0, s32 arg1[3], s32 arg2, s32 arg3, s32 ar return actor; } -Actor *func_803056FC(enum actor_e arg0, s32 arg1[3], s32 arg2) -{ +Actor *spawn_actor(enum actor_e arg0, s32 arg1[3], s32 arg2) { s32 i; arg0 = (!func_80320248()) ? (ACTOR_4_BIGBUTT) : (arg0); - for (i = 0; i < sSpawnableActorSize; i++) - { - if (arg0 == sSpawnableActorList[i].infoPtr->actorId) - { + for (i = 0; i < sSpawnableActorSize; i++) { + if (arg0 == sSpawnableActorList[i].infoPtr->actorId) { return sSpawnableActorList[i].spawnFunc(arg1, arg2, ((0, sSpawnableActorList[i])).infoPtr, sSpawnableActorList[i].unk8); } } @@ -1448,18 +1442,18 @@ void func_80305F04(s32 *arg0, Struct_core2_7AF80_1 **arg1) { for(a_list = *arg1; a_list < *arg1 + *arg0; a_list++){ for(b_list = a_list + 1; b_list < *arg1 + *arg0; b_list++) { //same types and neither A or B are empty - if ((a_list->unk4 == b_list->unk4) && (a_list->unk0 != 0) && (b_list->unk0 != 0)) { + if ((a_list->unk4 == b_list->unk4) && (a_list->count != 0) && (b_list->count != 0)) { continue_loop = TRUE; - for(a_elem = a_list->unk8; (a_elem < a_list->unk8 + a_list->unk0) && continue_loop; a_elem++){ - for(b_elem = b_list->unk8; (b_elem < b_list->unk8 + b_list->unk0) && continue_loop; b_elem++) { - if ((((a_elem->unk0[0] - b_elem->unk0[0]) * (a_elem->unk0[0] - b_elem->unk0[0])) + ((a_elem->unk0[2] - b_elem->unk0[2]) * (a_elem->unk0[2] - b_elem->unk0[2]))) < ((a_elem->unkC + b_elem->unkC) * (a_elem->unkC + b_elem->unkC))) { + for(a_elem = a_list->unk8; (a_elem < a_list->unk8 + a_list->count) && continue_loop; a_elem++){ + for(b_elem = b_list->unk8; (b_elem < b_list->unk8 + b_list->count) && continue_loop; b_elem++) { + if ((((a_elem->position[0] - b_elem->position[0]) * (a_elem->position[0] - b_elem->position[0])) + ((a_elem->position[2] - b_elem->position[2]) * (a_elem->position[2] - b_elem->position[2]))) < ((a_elem->radius + b_elem->radius) * (a_elem->radius + b_elem->radius))) { //concat b_list to end of a_list - a_list->unk8 = (Struct_core2_7AF80_2 *) realloc(a_list->unk8, (a_list->unk0 + b_list->unk0)*sizeof(Struct_core2_7AF80_2)); - memcpy(a_list->unk8 + a_list->unk0, b_list->unk8, b_list->unk0 * sizeof(Struct_core2_7AF80_2)); - a_list->unk0 = (s32) (a_list->unk0 + b_list->unk0); + a_list->unk8 = (Struct_core2_7AF80_2 *) realloc(a_list->unk8, (a_list->count + b_list->count)*sizeof(Struct_core2_7AF80_2)); + memcpy(a_list->unk8 + a_list->count, b_list->unk8, b_list->count * sizeof(Struct_core2_7AF80_2)); + a_list->count = (s32) (a_list->count + b_list->count); - b_list->unk0 = 0; + b_list->count = 0; free(b_list->unk8); b_list->unk8 = NULL; @@ -1474,13 +1468,13 @@ void func_80305F04(s32 *arg0, Struct_core2_7AF80_1 **arg1) { //remove empty lists for(a_list = *arg1; a_list < *arg1 + *arg0; a_list++){ - if (a_list->unk0 == 0) { //A is empty + if (a_list->count == 0) { //A is empty continue_loop = TRUE; for(b_list = a_list + 1; (b_list < *arg1 + *arg0) && continue_loop; b_list++){ - if (b_list->unk0 != 0) { //B is not empty + if (b_list->count != 0) { //B is not empty //swap A an B memcpy(a_list, b_list, sizeof(Struct_core2_7AF80_1)); - b_list->unk0 = 0; + b_list->count = 0; b_list->unk8 = NULL; continue_loop = FALSE; @@ -1490,7 +1484,7 @@ void func_80305F04(s32 *arg0, Struct_core2_7AF80_1 **arg1) { } //find first empty list (end) - for(a_list = *arg1; (a_list < *arg1 + *arg0) && (a_list->unk0 != 0); a_list++) { } + for(a_list = *arg1; (a_list < *arg1 + *arg0) && (a_list->count != 0); a_list++) { } *arg0 = (a_list - *arg1); //count *arg1 = (Struct_core2_7AF80_1 *)realloc((void *) *arg1, *arg0 * sizeof(Struct_core2_7AF80_1)); //ptr @@ -1566,27 +1560,27 @@ Struct_core2_7AF80_1 *func_803064C0(s32 arg0) { bool func_80306534(Struct_core2_7AF80_1 *arg0, s32 arg1, s32 arg2[3], s32 arg3) { Struct_core2_7AF80_2 *iPtr; - for(iPtr = arg0->unk8; iPtr < &arg0->unk8[arg0->unk0]; iPtr++){ - if(((arg2[0] - iPtr->unk0[0])*(arg2[0] - iPtr->unk0[0]) + (arg2[2] - iPtr->unk0[2])*(arg2[2] - iPtr->unk0[2])) < ((arg3 + iPtr->unkC) * (arg3 + iPtr->unkC))) { + for(iPtr = arg0->unk8; iPtr < &arg0->unk8[arg0->count]; iPtr++){ + if(((arg2[0] - iPtr->position[0])*(arg2[0] - iPtr->position[0]) + (arg2[2] - iPtr->position[2])*(arg2[2] - iPtr->position[2])) < ((arg3 + iPtr->radius) * (arg3 + iPtr->radius))) { return TRUE; } } return FALSE; } -void func_803065E4(s32 arg0, s32 position[3], s32 arg2, s32 arg3, s32 arg4) { +void func_803065E4(s32 arg0, s32 position[3], s32 radius, s32 arg3, s32 arg4) { Struct_core2_7AF80_2 *temp_v1; func_80306390(); while(func_803063D8(arg0) != NULL){ - if (func_80306534(D_8036A9C0, arg0, position, arg2)) { - D_8036A9C0->unk0++; - D_8036A9C0->unk8 = realloc(D_8036A9C0->unk8, D_8036A9C0->unk0 * sizeof(Struct_core2_7AF80_2)); - temp_v1 = &D_8036A9C0->unk8[D_8036A9C0->unk0 - 1]; - temp_v1->unk0[0] = position[0]; - temp_v1->unk0[1] = position[1]; - temp_v1->unk0[2] = position[2]; - temp_v1->unkC = arg2; + if (func_80306534(D_8036A9C0, arg0, position, radius)) { + D_8036A9C0->count++; + D_8036A9C0->unk8 = realloc(D_8036A9C0->unk8, D_8036A9C0->count * sizeof(Struct_core2_7AF80_2)); + temp_v1 = &D_8036A9C0->unk8[D_8036A9C0->count - 1]; + temp_v1->position[0] = position[0]; + temp_v1->position[1] = position[1]; + temp_v1->position[2] = position[2]; + temp_v1->radius = radius; temp_v1->unk10_31 = arg3; temp_v1->unk10_0 = arg4; temp_v1->unk10_3 = 0; @@ -1595,14 +1589,14 @@ void func_803065E4(s32 arg0, s32 position[3], s32 arg2, s32 arg3, s32 arg4) { } D_8036A9B8++; D_8036A9BC = realloc(D_8036A9BC, D_8036A9B8*sizeof(Struct_core2_7AF80_1)); - D_8036A9BC[D_8036A9B8-1].unk0 = 1; + D_8036A9BC[D_8036A9B8-1].count = 1; D_8036A9BC[D_8036A9B8-1].unk4 = arg0; D_8036A9BC[D_8036A9B8-1].unk8 = malloc(sizeof(Struct_core2_7AF80_2)); temp_v1 = (D_8036A9BC + D_8036A9B8-1)->unk8; - temp_v1->unk0[0] = position[0]; - temp_v1->unk0[1] = position[1]; - temp_v1->unk0[2] = position[2]; - temp_v1->unkC = arg2; + temp_v1->position[0] = position[0]; + temp_v1->position[1] = position[1]; + temp_v1->position[2] = position[2]; + temp_v1->radius = radius; temp_v1->unk10_31 = arg3; temp_v1->unk10_0 = arg4; temp_v1->unk10_3 = 0; @@ -1618,63 +1612,63 @@ s32 func_80306840(s32 arg0){ return 7; } -void func_8030688C(s32 arg0, s32 position[3], s32 arg2, s32 arg3){ +void func_8030688C(s32 arg0, s32 position[3], s32 radius, s32 arg3){ Struct_core2_7AF80_2 *temp_v1; func_803063A8(); while(func_8030644C(arg0) != NULL){ - if (func_80306534(D_8036A9CC, arg0, position, arg2)) { - D_8036A9CC->unk0++; - D_8036A9CC->unk8 = realloc(D_8036A9CC->unk8, D_8036A9CC->unk0 * sizeof(Struct_core2_7AF80_2)); - temp_v1 = &D_8036A9CC->unk8[D_8036A9CC->unk0 - 1]; - temp_v1->unk0[0] = position[0]; - temp_v1->unk0[1] = position[1]; - temp_v1->unk0[2] = position[2]; - temp_v1->unkC = arg2; + if (func_80306534(D_8036A9CC, arg0, position, radius)) { + D_8036A9CC->count++; + D_8036A9CC->unk8 = realloc(D_8036A9CC->unk8, D_8036A9CC->count * sizeof(Struct_core2_7AF80_2)); + temp_v1 = &D_8036A9CC->unk8[D_8036A9CC->count - 1]; + temp_v1->position[0] = position[0]; + temp_v1->position[1] = position[1]; + temp_v1->position[2] = position[2]; + temp_v1->radius = radius; temp_v1->unk10_3 = func_80306840(arg3); return; } } D_8036A9C4++; D_8036A9C8 = realloc(D_8036A9C8, D_8036A9C4*sizeof(Struct_core2_7AF80_1)); - D_8036A9C8[D_8036A9C4-1].unk0 = 1; + D_8036A9C8[D_8036A9C4-1].count = 1; D_8036A9C8[D_8036A9C4-1].unk4 = arg0; D_8036A9C8[D_8036A9C4-1].unk8 = malloc(sizeof(Struct_core2_7AF80_2)); temp_v1 = (D_8036A9C8 + D_8036A9C4-1)->unk8; - temp_v1->unk0[0] = position[0]; - temp_v1->unk0[1] = position[1]; - temp_v1->unk0[2] = position[2]; - temp_v1->unkC = arg2; + temp_v1->position[0] = position[0]; + temp_v1->position[1] = position[1]; + temp_v1->position[2] = position[2]; + temp_v1->radius = radius; temp_v1->unk10_3 = func_80306840(arg3); } -void func_80306AA8(s32 arg0, s32 position[3], s32 arg2){ +void func_80306AA8(s32 arg0, s32 position[3], s32 radius){ Struct_core2_7AF80_2 *temp_v1; func_803063C0(); while(func_803064C0(arg0) != NULL){ - if (func_80306534(D_8036A9D8, arg0, position, arg2)) { - D_8036A9D8->unk0++; - D_8036A9D8->unk8 = realloc(D_8036A9D8->unk8, D_8036A9D8->unk0 * sizeof(Struct_core2_7AF80_2)); - temp_v1 = &D_8036A9D8->unk8[D_8036A9D8->unk0 - 1]; - temp_v1->unk0[0] = position[0]; - temp_v1->unk0[1] = position[1]; - temp_v1->unk0[2] = position[2]; - temp_v1->unkC = arg2; + if (func_80306534(D_8036A9D8, arg0, position, radius)) { + D_8036A9D8->count++; + D_8036A9D8->unk8 = realloc(D_8036A9D8->unk8, D_8036A9D8->count * sizeof(Struct_core2_7AF80_2)); + temp_v1 = &D_8036A9D8->unk8[D_8036A9D8->count - 1]; + temp_v1->position[0] = position[0]; + temp_v1->position[1] = position[1]; + temp_v1->position[2] = position[2]; + temp_v1->radius = radius; temp_v1->unk10_3 = 0; return; } } D_8036A9D0++; D_8036A9D4 = realloc(D_8036A9D4, D_8036A9D0*sizeof(Struct_core2_7AF80_1)); - D_8036A9D4[D_8036A9D0-1].unk0 = 1; + D_8036A9D4[D_8036A9D0-1].count = 1; D_8036A9D4[D_8036A9D0-1].unk4 = arg0; D_8036A9D4[D_8036A9D0-1].unk8 = malloc(sizeof(Struct_core2_7AF80_2)); temp_v1 = (D_8036A9D4 + D_8036A9D0-1)->unk8; - temp_v1->unk0[0] = position[0]; - temp_v1->unk0[1] = position[1]; - temp_v1->unk0[2] = position[2]; - temp_v1->unkC = arg2; + temp_v1->position[0] = position[0]; + temp_v1->position[1] = position[1]; + temp_v1->position[2] = position[2]; + temp_v1->radius = radius; temp_v1->unk10_3 = 0; } @@ -1734,9 +1728,9 @@ s32 func_80306DDC(Struct_core2_7AF80_2 *arg0) { phi_v1 = D_8036A9BC; while(phi_v1 < &D_8036A9BC[D_8036A9B8]){ phi_a0 = phi_v1->unk8; - while(phi_a0 < &phi_v1->unk8[phi_v1->unk0]){ - if (((phi_a0->unk0[1] - 150) < arg0->unk0[1]) && (arg0->unk0[1] < (phi_a0->unk0[1] + 150))) { - if ((((arg0->unk0[0] - phi_a0->unk0[0]) * (arg0->unk0[0] - phi_a0->unk0[0])) + ((arg0->unk0[2] - phi_a0->unk0[2]) * (arg0->unk0[2] - phi_a0->unk0[2]))) < (phi_a0->unkC * phi_a0->unkC)) { + while(phi_a0 < &phi_v1->unk8[phi_v1->count]){ + if (((phi_a0->position[1] - 150) < arg0->position[1]) && (arg0->position[1] < (phi_a0->position[1] + 150))) { + if ((SQ(arg0->position[0] - phi_a0->position[0]) + SQ(arg0->position[2] - phi_a0->position[2])) < SQ(phi_a0->radius)) { return phi_v1 - D_8036A9BC; } } @@ -1759,20 +1753,20 @@ s32 func_80306EF4(s32 arg0[3], s32 arg1, u32 arg2) { if (D_80381FE8[var_s1->unk4] != 0) { if (arg2 & 1) { var_s0 = var_s1->unk8; - for(var_s0 = var_s1->unk8; var_s0 < var_s1->unk8 + var_s1->unk0; var_s0++){ + for(var_s0 = var_s1->unk8; var_s0 < var_s1->unk8 + var_s1->count; var_s0++){ if( (var_s0->unk10_3 & arg2) - && (temp_s4 >= var_s0->unk0[1]) && (temp_s6 < var_s0->unk0[1]) - && (func_80259328(arg0, (void *) var_s0, var_s0->unkC)) + && (temp_s4 >= var_s0->position[1]) && (temp_s6 < var_s0->position[1]) + && (func_80259328(arg0, (void *) var_s0, var_s0->radius)) ) { return var_s1 - D_8036A9C8; } } } else{ - for(var_s0 = var_s1->unk8; var_s0 < var_s1->unk8 + var_s1->unk0; var_s0++){ + for(var_s0 = var_s1->unk8; var_s0 < var_s1->unk8 + var_s1->count; var_s0++){ if( (var_s0->unk10_3 & arg2) - && ((var_s0->unk10_3 & 2) || ((temp_s4 >= var_s0->unk0[1]) && (temp_s6 < var_s0->unk0[1]))) - && (func_80259328(arg0, (void *) var_s0, var_s0->unkC)) + && ((var_s0->unk10_3 & 2) || ((temp_s4 >= var_s0->position[1]) && (temp_s6 < var_s0->position[1]))) + && (func_80259328(arg0, (void *) var_s0, var_s0->radius)) ) { return var_s1 - D_8036A9C8; } @@ -1783,20 +1777,16 @@ s32 func_80306EF4(s32 arg0[3], s32 arg1, u32 arg2) { return -1; } -s32 func_80307164(Struct_core2_7AF80_2 *arg0) { +s32 func_80307164(s32 arg0[3]) { Struct_core2_7AF80_1 *phi_v1; Struct_core2_7AF80_2 *phi_a0; - phi_v1 = D_8036A9D4; - while(phi_v1 < &D_8036A9D4[D_8036A9D0]){ - phi_a0 = phi_v1->unk8; - while(phi_a0 < &phi_v1->unk8[phi_v1->unk0]){ - if ((((arg0->unk0[0] - phi_a0->unk0[0]) * (arg0->unk0[0] - phi_a0->unk0[0])) + ((arg0->unk0[2] - phi_a0->unk0[2]) * (arg0->unk0[2] - phi_a0->unk0[2]))) < (phi_a0->unkC * phi_a0->unkC)) { + for( phi_v1 = D_8036A9D4; phi_v1 < &D_8036A9D4[D_8036A9D0]; phi_v1++){ + for(phi_a0 = phi_v1->unk8; phi_a0 < &phi_v1->unk8[phi_v1->count]; phi_a0++){ + if ((SQ(arg0[0] - phi_a0->position[0]) + SQ(arg0[2] - phi_a0->position[2])) < SQ(phi_a0->radius)) { return phi_v1 - D_8036A9D4; } - phi_a0++; } - phi_v1++; } return -1; } @@ -1811,14 +1801,14 @@ s32 func_80307258(f32 arg0[3], s32 arg1, s32 arg2) { temp_v0 = &D_8036A9BC[arg1]; var_v1 = temp_v0->unk8 + arg2; - if (((arg0[0] - var_v1->unk0[0]) * (arg0[0] - var_v1->unk0[0])) + (((arg0[2] - var_v1->unk0[2]) * (arg0[2] - var_v1->unk0[2]))) < (var_v1->unkC * var_v1->unkC)) { + if (((arg0[0] - var_v1->position[0]) * (arg0[0] - var_v1->position[0])) + (((arg0[2] - var_v1->position[2]) * (arg0[2] - var_v1->position[2]))) < (var_v1->radius * var_v1->radius)) { return arg2; } - temp_a0 = temp_v0->unk8 + temp_v0->unk0; + temp_a0 = temp_v0->unk8 + temp_v0->count; for (var_v1 = temp_v0->unk8; var_v1 < temp_a0; var_v1++) { - temp_f2 = arg0[2] - var_v1->unk0[2]; - temp_f14 = arg0[0] - var_v1->unk0[0]; - if (((temp_f2 * temp_f2) + (temp_f14 * temp_f14)) < (var_v1->unkC * var_v1->unkC)) { + temp_f2 = arg0[2] - var_v1->position[2]; + temp_f14 = arg0[0] - var_v1->position[0]; + if (((temp_f2 * temp_f2) + (temp_f14 * temp_f14)) < (var_v1->radius * var_v1->radius)) { return var_v1 - temp_v0->unk8; } } @@ -1839,14 +1829,14 @@ s32 func_803073CC(f32 arg0[3], s32 arg1, s32 arg2) { temp_v0 = &D_8036A9D4[arg1]; var_v1 = temp_v0->unk8 + arg2; - if (((arg0[0] - var_v1->unk0[0]) * (arg0[0] - var_v1->unk0[0])) + (((arg0[2] - var_v1->unk0[2]) * (arg0[2] - var_v1->unk0[2]))) < (var_v1->unkC * var_v1->unkC)) { + if (((arg0[0] - var_v1->position[0]) * (arg0[0] - var_v1->position[0])) + (((arg0[2] - var_v1->position[2]) * (arg0[2] - var_v1->position[2]))) < (var_v1->radius * var_v1->radius)) { return arg2; } - temp_a0 = temp_v0->unk8 + temp_v0->unk0; + temp_a0 = temp_v0->unk8 + temp_v0->count; for (var_v1 = temp_v0->unk8; var_v1 < temp_a0; var_v1++) { - temp_f2 = arg0[2] - var_v1->unk0[2]; - temp_f14 = arg0[0] - var_v1->unk0[0]; - if (((temp_f2 * temp_f2) + (temp_f14 * temp_f14)) < (var_v1->unkC * var_v1->unkC)) { + temp_f2 = arg0[2] - var_v1->position[2]; + temp_f14 = arg0[0] - var_v1->position[0]; + if (((temp_f2 * temp_f2) + (temp_f14 * temp_f14)) < (var_v1->radius * var_v1->radius)) { return var_v1 - temp_v0->unk8; } } @@ -1871,8 +1861,8 @@ s32 func_80307504(f32 arg0[3], s32 arg1, s32 arg2, s32 arg3, s32 arg4) { min = sp4C[1] - arg3 / 2; if (arg4 & 1) { if (var_s0->unk10_3 & arg4) { - if (!(max < var_s0->unk0[1]) && (min < var_s0->unk0[1])) { - if (func_80259328(sp4C, var_s0->unk0, var_s0->unkC)) { + if (!(max < var_s0->position[1]) && (min < var_s0->position[1])) { + if (func_80259328(sp4C, var_s0->position, var_s0->radius)) { return arg2; } } @@ -1880,24 +1870,24 @@ s32 func_80307504(f32 arg0[3], s32 arg1, s32 arg2, s32 arg3, s32 arg4) { } else{ if( (var_s0->unk10_3 & arg4)) - if( ((var_s0->unk10_3 & 2) || (!(max < var_s0->unk0[1]) && (min < var_s0->unk0[1])))) - if( func_80259328(&sp4C, var_s0->unk0, var_s0->unkC)) + if( ((var_s0->unk10_3 & 2) || (!(max < var_s0->position[1]) && (min < var_s0->position[1])))) + if( func_80259328(&sp4C, var_s0->position, var_s0->radius)) return arg2; } if (arg4 & 1) { - for(var_s0 = temp_s1->unk8; var_s0 < temp_s1->unk8 + temp_s1->unk0; var_s0++){ + for(var_s0 = temp_s1->unk8; var_s0 < temp_s1->unk8 + temp_s1->count; var_s0++){ if (var_s0->unk10_3 & arg4) - if (!(max < var_s0->unk0[1]) && (min < var_s0->unk0[1])) - if(func_80259328(&sp4C, var_s0, var_s0->unkC)) + if (!(max < var_s0->position[1]) && (min < var_s0->position[1])) + if(func_80259328(&sp4C, var_s0, var_s0->radius)) return (var_s0 - temp_s1->unk8); } } else{ - for(var_s0 = temp_s1->unk8; var_s0 < temp_s1->unk8 + temp_s1->unk0; var_s0++){ + for(var_s0 = temp_s1->unk8; var_s0 < temp_s1->unk8 + temp_s1->count; var_s0++){ if ((var_s0->unk10_3 & arg4)) - if(((var_s0->unk10_3 & 2) || (!(max < var_s0->unk0[1]) && (min < var_s0->unk0[1])))) - if(func_80259328(&sp4C, var_s0, var_s0->unkC)) + if(((var_s0->unk10_3 & 2) || (!(max < var_s0->position[1]) && (min < var_s0->position[1])))) + if(func_80259328(&sp4C, var_s0, var_s0->radius)) return var_s0 - temp_s1->unk8; } } @@ -2424,9 +2414,9 @@ void func_80308984(void) { void func_80308D2C(Gfx **gfx, Mtx **mtx, Vtx **vtx) { s32 phi_s4; s32 phi_s0; - s32 sp54[3]; + s32 vp_pos[3]; Cube *temp_s3; - s32 temp_lo; + s32 vp_cube_index; func_8032F464(1); phi_s4 = 0; @@ -2435,9 +2425,9 @@ void func_80308D2C(Gfx **gfx, Mtx **mtx, Vtx **vtx) { if (!func_80308F54(D_80382150[phi_s4])) { temp_s3 = &D_80381FA0.cube_list[D_80382150[phi_s4]]; if (func_8024D8F4(temp_s3)) { - func_8024C5F0(sp54); - temp_lo = cube_atPosition_s32(sp54) - D_80381FA0.cube_list; - for(phi_s0 = 0; (phi_s0 < D_80382150[phi_s4 + 1]) && (temp_lo != D_80382150[phi_s0 + 2]); phi_s0++) { + veiwport_get_position_vec3w(vp_pos); + vp_cube_index = cube_atPosition_s32(vp_pos) - D_80381FA0.cube_list; + for(phi_s0 = 0; (phi_s0 < D_80382150[phi_s4 + 1]) && (vp_cube_index != D_80382150[phi_s0 + 2]); phi_s0++) { } if (phi_s0 < (s32) D_80382150[phi_s4 + 1]) { func_80301F10(temp_s3, gfx, mtx, vtx); diff --git a/src/core2/code_85800.c b/src/core2/code_85800.c index 753920af..f88a66fb 100644 --- a/src/core2/code_85800.c +++ b/src/core2/code_85800.c @@ -218,7 +218,7 @@ s32 func_8030CDE4(struct45s *arg0){ f32 temp_f0; f32 pad; - viewport_getPosition(&sp44); + viewport_get_position_vec3f(&sp44); func_8024C5A8(&sp38); sp2C[0] = arg0->position[0] - sp44[0]; sp2C[1] = arg0->position[1] - sp44[1]; diff --git a/src/core2/code_87E30.c b/src/core2/code_87E30.c index 62ddb73e..4d48289f 100644 --- a/src/core2/code_87E30.c +++ b/src/core2/code_87E30.c @@ -10,13 +10,14 @@ extern void gczoombox_open(gczoombox_t *); extern void gczoombox_minimize(gczoombox_t *); extern void gczoombox_close(gczoombox_t *); extern bool func_803188B4(gczoombox_t *); +extern char *dialogBin_get(enum asset_e text_id); s8 D_8036C4D0[] = {1, 0x1E, 0x14, 0xF, 0xB, 8, 6, 4, 3, 2, -1, -1}; - + /* .bss */ struct { char output[0x100]; - u8 *unk100; + u8 *dialog_bin_ptr; struct13s *string_list[2]; //string ptr char *string[2]; //current_string u8 string_count[2]; //zoombox string_count @@ -74,7 +75,7 @@ void gcdialog_init(void) { s32 i; struct14s *i_ptr; - D_80382E20.unk100 = 0; + D_80382E20.dialog_bin_ptr = 0; for( i = 0; i < 2; i++){ D_80382E20.string_list[i] = NULL; @@ -134,9 +135,9 @@ void func_8030F078(void){ D_80382E20.string_list[i] = NULL; } if(D_80382E20.unk130 != -1){ - func_8031B6D8(D_80382E20.unk130); + dialogBin_release(D_80382E20.unk130); } - D_80382E20.unk100 = NULL; + D_80382E20.dialog_bin_ptr = NULL; } void func_8030F130(void){ @@ -579,7 +580,7 @@ void func_80310574(s32 text_id){ char ch; s32 len; - txt = D_80382E20.unk100 = func_8031B66C(text_id); + txt = D_80382E20.dialog_bin_ptr = dialogBin_get(text_id); for(i = 0; i < 2; i++){ D_80382E20.string_count[i] = *(txt++); @@ -637,7 +638,7 @@ void func_803106BC(s32 text_id, s32 arg1, ActorMarker *marker, void(*callback)(A D_80382E20.unk11A[j].unk0_5 = 0; if(D_80382E20.string_list[j][i].cmd >= 0){ if(!D_80382E20.unk11A[j].unk0_7){ - D_80382E20.zoombox[j] = gczoombox_new(D_80382E20.unk124[j], D_80382E20.string_list[j][i].cmd + 0xC, 0, func_803106A4(j), func_8030F754); + D_80382E20.zoombox[j] = gczoombox_new(D_80382E20.unk124[j], D_80382E20.string_list[j][i].cmd + 0xC, 0, func_803106A4(j), (void *)func_8030F754); if( j == 1 ){ func_80347A14(0); } @@ -674,7 +675,7 @@ void func_803106BC(s32 text_id, s32 arg1, ActorMarker *marker, void(*callback)(A D_80382E20.caller = marker; D_80382E20.unk13C = callback; D_80382E20.unk140 = arg4; - D_80382E20.unk144 = arg5; + D_80382E20.unk144 = (void *)arg5; D_80382E20.unk138 = (marker != NULL )? ((marker->unk5C)? marker->unk5C : -1) : 0; gcdialog_setState(((func_802E4A08() || func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE)) && D_80382E20.unk128_3) ? 6 : 1); //L803109EC @@ -835,7 +836,7 @@ int func_80311174(s32 text_id, s32 arg1, f32 *pos, ActorMarker *marker, void(*ca return 0; if(!func_803114B0()){ - func_80310B1C(text_id, arg1, marker, callback, arg5, arg6); + func_80310B1C(text_id, arg1, marker, (void *)callback, (void *)arg5, arg6); if(arg1 & 8){ if(!(func_802E4A08() || func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE)) || !D_80382E20.unk128_3){//L80311214 if(pos != NULL){ @@ -877,8 +878,8 @@ int func_80311174(s32 text_id, s32 arg1, f32 *pos, ActorMarker *marker, void(*ca } D_80382E20.unk148[temp_v1].unk10 = marker; D_80382E20.unk148[temp_v1].unk14 = (marker != NULL )? ((marker->unk5C)? marker->unk5C : -1) : 0; - D_80382E20.unk148[temp_v1].unk18 = callback; - D_80382E20.unk148[temp_v1].unk1C = arg5; + D_80382E20.unk148[temp_v1].unk18 = (void *)callback; + D_80382E20.unk148[temp_v1].unk1C = (void *)arg5; D_80382E20.unk148[temp_v1].unk20 = arg6; D_80382E20.unk12C_15++; if(arg1 & 0x08){ diff --git a/src/core2/code_94620.c b/src/core2/code_94620.c index 9cb8747d..deac9e7a 100644 --- a/src/core2/code_94620.c +++ b/src/core2/code_94620.c @@ -8,20 +8,20 @@ s32 D_80383150; s32 pad_80383154; struct { u8 unk0; - void *unk4; - s32 unk8; + char *ptr; + s32 index; } -D_80383158; +s_dialogBin; s32 func_8031B5B0(void) { - return D_80383158.unk0; + return s_dialogBin.unk0; } s32 func_8031B5BC(void){ return 1; } void func_8031B5C4(s32 arg0) { if ((arg0 >= 0) && (arg0 < func_8031B5BC())) { - D_80383158.unk0 = (s8) arg0; + s_dialogBin.unk0 = (s8) arg0; } D_80383150 = 1; } @@ -31,40 +31,41 @@ bool func_8031B604(char *arg0) { } void func_8031B62C(void) { - D_80383158.unk0 = (u8)0; + s_dialogBin.unk0 = (u8)0; } s32 func_8031B638(void) { return D_80383150; } -void func_8031B644(void){ - D_80383158.unk4 = NULL; - D_80383158.unk8 = -1; +void dialogBin_initialize(void){ + s_dialogBin.ptr = NULL; + s_dialogBin.index = -1; } -void func_8031B65C(void){} +void dialogBin_update(void){} -void func_8031B664(void){} +void dialogBin_terminate(void){} -char *func_8031B66C(enum asset_e text_id) { +char *dialogBin_get(enum asset_e text_id) { char *sp1C; - s32 var_v0; - s32 var_a0; + char *var_v0; + s32 var_a0; //offset where text starts (normally 0x3) - D_80383158.unk4 = assetcache_get(text_id); - sp1C = (s32)D_80383158.unk4 + 1; + //get text_bin from asset cache + s_dialogBin.ptr = assetcache_get(text_id); + sp1C = s_dialogBin.ptr + 1; sp1C += func_8031B5B0()*2; var_a0 = *(sp1C++); var_a0 += *(sp1C++)<< 8; if(sp1C); - var_v0 = (s32)D_80383158.unk4 + var_a0; - D_80383158.unk8 = text_id; + var_v0 = s_dialogBin.ptr + var_a0; + s_dialogBin.index = text_id; return var_v0; } -void func_8031B6D8(s32 arg0){ - assetcache_release(D_80383158.unk4); - D_80383158.unk4 = NULL; - D_80383158.unk8 = -1; +void dialogBin_release(s32 arg0){ + assetcache_release(s_dialogBin.ptr); + s_dialogBin.ptr = NULL; + s_dialogBin.index = -1; } diff --git a/src/core2/code_98CB0.c b/src/core2/code_98CB0.c index 0c2499c8..1a8a0013 100644 --- a/src/core2/code_98CB0.c +++ b/src/core2/code_98CB0.c @@ -4,8 +4,8 @@ void func_8031FFAC(void); void fileProgressFlag_set(s32 index, s32 set); -s32 func_803200A4(u8 *array, s32 index); -s32 func_803200E4(u8 *array, s32 offset, s32 numBits); +s32 bitfield_get_bit(u8 *array, s32 index); +s32 bitfield_get_n_bits(u8 *array, s32 offset, s32 numBits); void func_8032015C(u8 *array, s32 index, s32 set); void func_803201C8(u8 *array, s32 startIndex, s32 set, s32 length); void func_8032048C(void); @@ -108,11 +108,11 @@ void func_8031FEC0(void) { } bool fileProgressFlag_get(enum file_progress_e index) { - return func_803200A4(D_803831A0.unk8, index); + return bitfield_get_bit(D_803831A0.unk8, index); } s32 fileProgressFlag_getN(s32 offset, s32 numBits) { - return func_803200E4(D_803831A0.unk8, offset, numBits); + return bitfield_get_n_bits(D_803831A0.unk8, offset, numBits); } s32 fileProgressFlag_getAndSet(s32 index, s32 set) { @@ -151,7 +151,7 @@ void func_8032008C(s32 *arg0, u8 **arg1) { } // Returns a single bit from a byte array -s32 func_803200A4(u8 *array, s32 index) { +s32 bitfield_get_bit(u8 *array, s32 index) { s32 ret; if (array[index / 8] & (1 << (index & 7))) { ret = 1; @@ -162,12 +162,12 @@ s32 func_803200A4(u8 *array, s32 index) { } // Extracts an integer of the given number of bits from a byte array at the starting bit offset -s32 func_803200E4(u8 *array, s32 offset, s32 numBits) { +s32 bitfield_get_n_bits(u8 *array, s32 offset, s32 numBits) { s32 ret = 0; s32 i; for (i = 0; i < numBits; i++) { - ret |= (func_803200A4(array, offset + i) << i); + ret |= (bitfield_get_bit(array, offset + i) << i); } return ret; } @@ -246,11 +246,11 @@ void func_803203A0(void) { } s32 func_803203FC(s32 index) { - return func_803200A4(D_803831D0.unk8, index); + return bitfield_get_bit(D_803831D0.unk8, index); } void func_80320424(s32 index, s32 numBits) { - func_803200E4(D_803831D0.unk8, index, numBits); + bitfield_get_n_bits(D_803831D0.unk8, index, numBits); } s32 func_80320454(s32 index, s32 arg1) { diff --git a/src/core2/code_9E370.c b/src/core2/code_9E370.c index 8a0d93ce..d6a3fc0a 100644 --- a/src/core2/code_9E370.c +++ b/src/core2/code_9E370.c @@ -310,7 +310,7 @@ Actor *func_80325CAC(ActorMarker *marker, Gfx **gfx, Gfx **mtx, Vtx **vtx) { this->position[1] -= D_8036E58C[1]; this->position[2] -= D_8036E58C[2]; } - viewport_getRotation(rotation); + viewport_get_rotation_vec3f(rotation); rotation[2] += this->roll; func_80338338(0xFF, 0xFF, 0xFF); if (this->unk124_11 != 0) { @@ -1054,7 +1054,7 @@ static void __actor_free(ActorMarker *arg0, Actor *arg1){ } Actor *func_8032811C(enum actor_e id, s32 (* pos)[3], s32 rot){ - return func_803056FC(id, pos, rot); + return spawn_actor(id, pos, rot); } Actor *func_8032813C(enum actor_e id, f32 pos[3], s32 rot){ @@ -1063,7 +1063,7 @@ Actor *func_8032813C(enum actor_e id, f32 pos[3], s32 rot){ for(i = 0; i< 3; i++){ sp24[i] = pos[i]; } - func_803056FC(id, &sp24, rot); + spawn_actor(id, &sp24, rot); } Actor * spawn_child_actor(enum actor_e id, Actor ** parent){ @@ -1073,7 +1073,7 @@ Actor * spawn_child_actor(enum actor_e id, Actor ** parent){ sp1C[0] = (*parent)->position_x; sp1C[1] = (*parent)->position_y; sp1C[2] = (*parent)->position_z; - child = func_803056FC(id, sp1C, (*parent)->yaw); + child = spawn_actor(id, sp1C, (*parent)->yaw); *parent = marker_getActor(sp28); return child; } @@ -1097,7 +1097,7 @@ Actor *func_803282AC(enum actor_e id, s16 (* pos)[3], s32 yaw){ for(i = 0; i< 3; i++){ sp24[i] = (*pos)[i]; } - return func_803056FC(id, &sp24, yaw); + return spawn_actor(id, &sp24, yaw); } void marker_despawn(ActorMarker *marker){ diff --git a/src/core2/code_A5BC0.c b/src/core2/code_A5BC0.c index 88f06271..8f61be9c 100644 --- a/src/core2/code_A5BC0.c +++ b/src/core2/code_A5BC0.c @@ -100,7 +100,7 @@ void func_8032CB50(Cube *cube, bool global) { if (cube->prop2Cnt >= 2) { if (global == 0) { - func_8024C5F0(ref_position); //distance from viewport + veiwport_get_position_vec3w(ref_position); //distance from viewport } else { ref_position[0] = 0; ref_position[1] = 0; @@ -649,7 +649,7 @@ bool func_8032E178(Cube *arg0, s32 *arg1, s32 arg2) { && (var_v1->unk6.bit6 == 6) && (arg2 == var_v1->unk8) ) { - *arg1 = var_v1->unk6.bit15; + *arg1 = var_v1->unk6.radius; return TRUE; } var_v1++; @@ -1314,7 +1314,7 @@ void func_80330208(Cube *cube) { actor = func_803055E0(i_prop->unk8, position, i_prop->unkC_31, i_prop->unk10_31, i_prop->unk10_19); if (actor != NULL) { actor->unk78_13 = i_prop->unk10_31; - actor->unkF4_8 = i_prop->unk6.bit15; + actor->unkF4_8 = i_prop->unk6.radius; func_8032AA58(actor, (i_prop->unkC_22 != 0) ? ((f32)i_prop->unkC_22 * 0.01) : 1.0); } } @@ -1337,17 +1337,17 @@ void func_803303B8(Cube *cube) { sp4C[0] = (s32) var_s0->x; sp4C[1] = (s32) var_s0->y; sp4C[2] = (s32) var_s0->z; - func_803065E4(var_s0->unk8, sp4C, var_s0->unk6.bit15, var_s0->unk10_31, var_s0->unk10_7); + func_803065E4(var_s0->unk8, sp4C, var_s0->unk6.radius, var_s0->unk10_31, var_s0->unk10_7); } else if (var_s0->unk6.bit6 == 9) { sp4C[0] = (s32) var_s0->x; sp4C[1] = (s32) var_s0->y; sp4C[2] = (s32) var_s0->z; - func_8030688C(var_s0->unk8, sp4C, var_s0->unk6.bit15, var_s0->unk10_0); + func_8030688C(var_s0->unk8, sp4C, var_s0->unk6.radius, var_s0->unk10_0); } else if (var_s0->unk6.bit6 == 0xA) { sp4C[0] = (s32) var_s0->x; sp4C[1] = (s32) var_s0->y; sp4C[2] = (s32) var_s0->z; - func_80306AA8(var_s0->unk8, sp4C, var_s0->unk6.bit15); + func_80306AA8(var_s0->unk8, sp4C, var_s0->unk6.radius); } var_s0++; } @@ -1606,7 +1606,7 @@ s32 func_80330F94(NodeProp *arg0, s32 arg1[3]){ arg1[0] = arg0->x; arg1[1] = arg0->y; arg1[2] = arg0->z; - return arg0->unk6.bit15; + return arg0->unk6.radius; } void func_80330FBC(UNK_TYPE(void *)arg0, s32 arg1){ @@ -1766,9 +1766,9 @@ s32 func_80331638(Cube *cube, f32 arg1[3], f32 arg2[3], f32 arg3, f32 arg4[3], s f32 *new_var2; s32 spD8; Actor *temp_v0_6; - BKModelBin *temp_v0_2; + BKModelBin *model_bin; BKVertexList *temp_a1; - BKCollisionList *temp_v0_3; + BKCollisionList *model_collision_list; f32 spBC[3]; f32 spB0[3]; u32 var_s3; @@ -1789,13 +1789,13 @@ s32 func_80331638(Cube *cube, f32 arg1[3], f32 arg2[3], f32 arg3, f32 arg4[3], s { if (((!var_s0->markerFlag) && var_s0->unk8_1) && var_s0->unk8_4) { - temp_v0_2 = func_8030A4B4(((u32) (*((u16 *) (&var_s0->modelProp)))) >> 4); - if (temp_v0_2 == 0) + model_bin = func_8030A4B4(((u32) (*((u16 *) (&var_s0->modelProp)))) >> 4); + if (model_bin == 0) { continue; } - temp_v0_3 = model_getCollisionList(temp_v0_2); - if (temp_v0_3 == 0) + model_collision_list = model_getCollisionList(model_bin); + if (model_collision_list == 0) { continue; } @@ -1806,7 +1806,10 @@ s32 func_80331638(Cube *cube, f32 arg1[3], f32 arg2[3], f32 arg3, f32 arg4[3], s spB0[1] = (f32) (var_s0->modelProp.unk0_15 * 2); new_var = spB0; spB0[2] = (f32) (var_s0->modelProp.unk0_7 * 2); - var_v0 = func_802E9118(temp_v0_3, model_getVtxList(temp_v0_2), spBC, new_var, (f32) (((f32) var_s0->modelProp.unkA) / 100.0), arg1, arg2, arg3, arg4, arg5, flags); + var_v0 = func_802E9118(model_collision_list, model_getVtxList(model_bin), + spBC, new_var, (f32) (((f32) var_s0->modelProp.unkA) / 100.0), + arg1, arg2, arg3, arg4, arg5, flags + ); if (var_v0 != 0) { spD8 = var_v0; @@ -1815,14 +1818,14 @@ s32 func_80331638(Cube *cube, f32 arg1[3], f32 arg2[3], f32 arg3, f32 arg4[3], s else if ((var_s0->markerFlag && var_s0->unk8_3) && var_s0->unk8_4) { - temp_v0_3 = func_80330DE4(var_s0->actorProp.marker); - pad9C = temp_v0_3; - if (temp_v0_3 == 0) + model_collision_list = func_80330DE4(var_s0->actorProp.marker); + pad9C = model_collision_list; + if (model_collision_list == 0) { continue; } - temp_v0_2 = model_getCollisionList(pad9C); - if (temp_v0_2 == 0) + model_bin = model_getCollisionList(pad9C); + if (model_bin == 0) { continue; } @@ -1835,7 +1838,7 @@ s32 func_80331638(Cube *cube, f32 arg1[3], f32 arg2[3], f32 arg3, f32 arg4[3], s sp8C[0] = (f32) var_s0->actorProp.marker->pitch; sp8C[1] = (f32) var_s0->actorProp.marker->yaw; sp8C[2] = (f32) var_s0->actorProp.marker->roll; - var_v0 = func_802E9118(temp_v0_2, temp_a1, sp98, new_var2, temp_v0_6->scale, arg1, arg2, arg3, arg4, arg5, flags); + var_v0 = func_802E9118(model_bin, temp_a1, sp98, new_var2, temp_v0_6->scale, arg1, arg2, arg3, arg4, arg5, flags); } if (var_v0 != 0) { @@ -1865,16 +1868,16 @@ s32 func_80331638(Cube *cube, f32 arg1[3], f32 arg2[3], f32 arg3, f32 arg4[3], s return spD8; } -BKCollisionTri *func_803319C0(Cube *arg0, f32 arg1[3], f32 arg2, s32 arg3, f32 arg4[3], u32 arg5){ +BKCollisionTri *func_803319C0(Cube *cube, f32 position[3], f32 radius, s32 arg3, f32 arg4[3], u32 arg5){ BKCollisionTri *var_s7; BKCollisionTri *var_v0; s32 var_s3; Prop *var_s0; - BKCollisionList *temp_v0_3; + BKCollisionList *model_collision_list; BKVertexList *temp_a1; f32 spAC[3]; f32 spA0[3]; - BKModelBin *temp_v0_2; + BKModelBin *model_bin; BKModelBin *new_var; ModelProp *mProp; f32 sp88[3]; @@ -1883,25 +1886,25 @@ BKCollisionTri *func_803319C0(Cube *arg0, f32 arg1[3], f32 arg2, s32 arg3, f32 a ActorProp *aProp = &var_s0->actorProp; var_s7 = 0; - var_s0 = arg0->prop2Ptr; - for (var_s3 = arg0->prop2Cnt; var_s3 != 0; var_s3--, var_s0++) { + var_s0 = cube->prop2Ptr; + for (var_s3 = cube->prop2Cnt; var_s3 != 0; var_s3--, var_s0++) { if (((!var_s0->markerFlag) && var_s0->unk8_1) && var_s0->unk8_4) { mProp = &var_s0->modelProp; new_var = func_8030A4B4(mProp->unk0_31); if (1) { } if (1) { } if (1) { } - temp_v0_2 = new_var; - if (temp_v0_2 != 0){ - temp_v0_3 = model_getCollisionList(temp_v0_2); - if (temp_v0_3 != 0){ + model_bin = new_var; + if (model_bin != 0){ + model_collision_list = model_getCollisionList(model_bin); + if (model_collision_list != 0){ spAC[0] = (f32) mProp->unk4[0]; spAC[1] = (f32) mProp->unk4[1]; spAC[2] = (f32) mProp->unk4[2]; spA0[0] = 0.0f; spA0[1] = (f32) (mProp->unk0_15 * 2); - temp_v0_2 = temp_v0_2; + model_bin = model_bin; spA0[2] = (f32) (mProp->unk0_7 * 2); - var_v0 = func_802E9DD8(temp_v0_3, model_getVtxList(temp_v0_2), spAC, spA0, ((f32) mProp->unkA) / 100.0, arg1, arg2, arg3, arg4); + var_v0 = func_802E9DD8(model_collision_list, model_getVtxList(model_bin), spAC, spA0, ((f32) mProp->unkA) / 100.0, position, radius, arg3, arg4); if (var_v0 != 0) var_s7 = var_v0; } @@ -1910,10 +1913,9 @@ BKCollisionTri *func_803319C0(Cube *arg0, f32 arg1[3], f32 arg2, s32 arg3, f32 a aProp = &var_s0->actorProp; if ((var_s0->markerFlag && var_s0->unk8_3) && var_s0->unk8_4) { - temp_v0_2 = func_80330DE4(aProp->marker); - if (temp_v0_2 != 0) - { - new_var = model_getCollisionList(temp_v0_2); + model_bin = func_80330DE4(aProp->marker); + if (model_bin != 0) { + new_var = model_getCollisionList(model_bin); if (new_var != 0) { @@ -1925,7 +1927,7 @@ BKCollisionTri *func_803319C0(Cube *arg0, f32 arg1[3], f32 arg2, s32 arg3, f32 a sp7C[0] = aProp->marker->pitch; sp7C[1] = aProp->marker->yaw; sp7C[2] = aProp->marker->roll; - var_v0 = func_802E9DD8(new_var, temp_a1, sp88, sp7C, temp_v0_6->scale, arg1, arg2, arg3, arg4); + var_v0 = func_802E9DD8(new_var, temp_a1, sp88, sp7C, temp_v0_6->scale, position, radius, arg3, arg4); if (var_v0 != 0) { var_s7 = var_v0; @@ -1942,7 +1944,7 @@ BKCollisionTri *func_803319C0(Cube *arg0, f32 arg1[3], f32 arg2, s32 arg3, f32 a { if (temp_v0_7->unk8 != 0) { - var_v0 = temp_v0_7->unk8(aProp->marker, arg1, arg2, arg3, arg4); + var_v0 = temp_v0_7->unk8(aProp->marker, position, radius, arg3, arg4); if (var_v0 != 0) { var_s7 = var_v0; diff --git a/src/core2/code_AD5B0.c b/src/core2/code_AD5B0.c index 718e9aa7..c425e2e8 100644 --- a/src/core2/code_AD5B0.c +++ b/src/core2/code_AD5B0.c @@ -174,7 +174,7 @@ void func_80334910(void) { if (func_802E4A08() == 0) { itemPrint_free(); } - func_8031B664(); + dialogBin_terminate(); func_802986D0(); if (func_80322914() == 0) { func_8024F7C4(func_803226E8(D_803835D0.map_4)); @@ -211,7 +211,7 @@ void func_80334B20(enum map_e arg0, s32 arg1, s32 arg2) { if (func_802E4A08() == 0) { itemPrint_init(); } - func_8031B644(); + dialogBin_initialize(); spawnQueue_malloc(); func_803329AC(); func_80350BFC(); @@ -345,7 +345,7 @@ s32 func_80334ECC(void) { } AnimTextureListCache_update(); func_80350CA4(); - func_8031B65C(); + dialogBin_update(); func_80310D2C(); gcparade_update(); overlay_update(); diff --git a/src/core2/code_AEDA0.c b/src/core2/code_AEDA0.c index bff463de..2861baaa 100644 --- a/src/core2/code_AEDA0.c +++ b/src/core2/code_AEDA0.c @@ -443,7 +443,7 @@ void func_803380F8(Gfx **gfx, Mtx **mtx, f32 arg2[3]) { f32 sp2C[3]; f32 sp20[3]; - viewport_getPosition(sp2C); + viewport_get_position_vec3f(sp2C); sp20[0] = arg2[0] - sp2C[0]; sp20[1] = arg2[1] - sp2C[1]; sp20[2] = arg2[2] - sp2C[2]; @@ -457,7 +457,7 @@ void func_803381B4(Gfx **gfx, Mtx **mtx, f32 arg2[3]) { f32 sp2C[3]; f32 sp20[3]; - viewport_getPosition(sp2C); + viewport_get_position_vec3f(sp2C); sp20[0] = arg2[0] - sp2C[0]; sp20[1] = arg2[1] - sp2C[1]; sp20[2] = arg2[2] - sp2C[2]; @@ -525,4 +525,4 @@ void func_80338370(void){ void func_8033837C(s32 arg0){ D_8037033C = arg0; -} \ No newline at end of file +} diff --git a/src/core2/code_B3A80.c b/src/core2/code_B3A80.c index 28a57d19..96bced6f 100644 --- a/src/core2/code_B3A80.c +++ b/src/core2/code_B3A80.c @@ -6,7 +6,7 @@ #include "animation.h" extern f32 glspline_catmull_rom_interpolate(f32, s32, f32 *); - +extern BKSpriteDisplayData * func_80344A1C(BKSprite *arg0); f32 D_803709E0[] = { 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, diff --git a/src/core2/code_B8860.c b/src/core2/code_B8860.c index 1c6d49e4..cf657fce 100644 --- a/src/core2/code_B8860.c +++ b/src/core2/code_B8860.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" -extern void mlMtxRotate(f32, f32, f32); +extern void mlMtxRotatePYR(f32, f32, f32); extern void func_80252330(f32, f32, f32); extern void mlMtxApply(Mtx *); @@ -40,7 +40,7 @@ void func_8033F7F0(u8 arg0, Gfx **gfx, Mtx **mtx, Vtx **vtx){ if(sp54->unk28_23 != 1){ ml_vec3f_copy(sp48, sp54->unk4); sp48[1] += (sp54->unk1C*sp54->unk20[1])/100.0; - viewport_getPosition(sp3C); + viewport_get_position_vec3f(sp3C); ml_vec3f_diff_copy(sp30, sp48, sp3C); if(sp54->unk28_12){ mlMtxSet(func_8024DD90()); @@ -48,7 +48,7 @@ void func_8033F7F0(u8 arg0, Gfx **gfx, Mtx **mtx, Vtx **vtx){ else{ mlMtxIdent(); } - mlMtxRotate(sp54->unk10[0], sp54->unk10[1], sp54->unk10[2]); + mlMtxRotatePYR(sp54->unk10[0], sp54->unk10[1], sp54->unk10[2]); func_80252330(sp30[0], sp30[1], sp30[2]); mlMtxApply(*mtx); gSPMatrix((*gfx)++, OS_PHYSICAL_TO_K0((*mtx)++), G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/core2/code_BD100.c b/src/core2/code_BD100.c index 8fd6267c..6d06d4a4 100644 --- a/src/core2/code_BD100.c +++ b/src/core2/code_BD100.c @@ -4,7 +4,7 @@ extern void spriteRender_drawWithSegment(Gfx**, Vtx**, BKSprite *, s32, s32); extern void func_80252330(f32, f32, f32); -extern void mlMtxRotate(f32, f32, f32); +extern void mlMtxRotatePYR(f32, f32, f32); extern void mlMtxApply(Mtx *); extern void func_80349AD0(void); extern void func_8024C5A8(f32[3]); @@ -51,7 +51,7 @@ void func_80344138(BKSpriteDisplayData *self, s32 frame, s32 mirrored, f32 posit f32 sp38; f32 sp34; - viewport_getPosition(sp6C); + viewport_get_position_vec3f(sp6C); func_8024C5A8(sp60); sp50[0] = position[0] - sp6C[0]; sp50[1] = position[1] - sp6C[1]; @@ -109,7 +109,7 @@ void func_80344424(BKSpriteDisplayData *arg0, s32 frame, bool mirrored, f32 posi f32 sp38; f32 sp34; - viewport_getPosition(sp6C); + viewport_get_position_vec3f(sp6C); func_8024C5A8(sp60); sp50[0] = position[0] - sp6C[0]; sp50[1] = position[1] - sp6C[1]; @@ -141,7 +141,7 @@ void func_80344424(BKSpriteDisplayData *arg0, s32 frame, bool mirrored, f32 posi D_80371EC0.unk0(D_80371EC0.unk4); } mlMtxSet(func_8024DD90()); - mlMtxRotate(0.0f, 0.0f, rotation); + mlMtxRotatePYR(0.0f, 0.0f, rotation); func_80252330(sp50[0], sp50[1], sp50[2]); if ((scale != NULL) || mirrored) { mlMtxScale_xyz((mirrored) ? -scale[0] : scale[0], sp38, sp34); @@ -167,7 +167,7 @@ void func_80344720(BKSpriteDisplayData *arg0, s32 frame, bool mirrored, f32 posi f32 var_f14; BKSpriteFrameDisplayData *temp_a3; - viewport_getPosition(sp5C); + viewport_get_position_vec3f(sp5C); func_8024C5A8(sp50); sp40[0] = position[0] - sp5C[0]; sp40[1] = position[1] - sp5C[1]; @@ -191,7 +191,7 @@ void func_80344720(BKSpriteDisplayData *arg0, s32 frame, bool mirrored, f32 posi } mlMtxIdent(); func_80252330(sp40[0], sp40[1], sp40[2]); - mlMtxRotate(rotation[0], rotation[1], rotation[2]); + mlMtxRotatePYR(rotation[0], rotation[1], rotation[2]); mlMtxScale_xyz((mirrored) ? -scale[0] : scale[0], scale[1], scale[2]); mlMtxApply(*mtx); gSPMatrix((*gfx)++, (*mtx)++, G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/core2/code_BE2C0.c b/src/core2/code_BE2C0.c index 4a764413..86fcffa9 100644 --- a/src/core2/code_BE2C0.c +++ b/src/core2/code_BE2C0.c @@ -202,7 +202,7 @@ void func_80345C78(f32 arg0[4], f32 arg1[3]) { mlMtxRotYaw(arg1[1]); mlMtxRotPitch(arg1[0]); mlMtxRotRoll(arg1[2]); - func_80345A44(arg0, func_80251488()); + func_80345A44(arg0, mlMtx_get_stack_pointer()); } void func_80345CD4(f32 arg0[4], f32 arg1[4]){ @@ -210,7 +210,7 @@ void func_80345CD4(f32 arg0[4], f32 arg1[4]){ mlMtxRotRoll(arg1[2]); mlMtxRotYaw(arg1[1]); mlMtxRotPitch(arg1[0]); - func_80345A44(arg0, func_80251488()); + func_80345A44(arg0, mlMtx_get_stack_pointer()); } void func_80345D30(f32 arg0[4], f32 arg1[4], f32 arg2[4]) { diff --git a/src/core2/code_BEF20.c b/src/core2/code_BEF20.c index ad5d71b4..86af48f4 100644 --- a/src/core2/code_BEF20.c +++ b/src/core2/code_BEF20.c @@ -237,7 +237,7 @@ void func_803465E4(void){ }//L8034667C if(D_80385FE0){ - if(gctransition_8030BD98() || func_803203FC(0)){ + if(gctransition_done() || func_803203FC(0)){ if(D_80385FE4){ item_dec(ITEM_16_LIFE); func_802FACA4(ITEM_14_HEALTH); diff --git a/src/core2/code_C4320.c b/src/core2/code_C4320.c index 4a9f688c..7f8c3a77 100644 --- a/src/core2/code_C4320.c +++ b/src/core2/code_C4320.c @@ -148,7 +148,7 @@ void func_8034B580(s32 arg0) { f32 sp1C; sp1C = D_80386128; - if (gctransition_8030BD98() != 0) { + if (gctransition_done() != 0) { D_80386128 += time_getDelta(); } if ((getGameMode() != GAME_MODE_8_BOTTLES_BONUS) && (getGameMode() != GAME_MODE_A_SNS_PICTURE)) { @@ -278,7 +278,7 @@ void func_8034BB08(bool arg0) { } bool func_8034BB48(void) { - if (D_80386120 && gctransition_8030BD98()) { + if (D_80386120 && gctransition_done()) { D_80386120 = FALSE; return TRUE; } @@ -290,7 +290,7 @@ void func_8034BB90(void) { s32 sp18; sp1C = gctransition_8030BDC0(); - sp18 = gctransition_8030BD98(); + sp18 = gctransition_done(); if (!D_80386118) { func_8034B834(); func_8034B4E4(D_80386114->unk1); diff --git a/src/core2/code_C97F0.c b/src/core2/code_C97F0.c index b568052a..b806c935 100644 --- a/src/core2/code_C97F0.c +++ b/src/core2/code_C97F0.c @@ -3,7 +3,7 @@ #include "variables.h" extern bool func_8028F170(f32, f32); -extern void viewport_getPosition(f32[3]); +extern void viewport_get_position_vec3f(f32[3]); typedef struct { f32 unk0; @@ -129,8 +129,8 @@ void func_80350818(Gfx **gfx, Mtx **mtx, Vtx **vtx) { temp_s1 = D_80386170.unk4; if (( temp_s1 != NULL) && D_8038617C.unk0) { - viewport_getPosition(spDC); - viewport_getRotation(spD0); + viewport_get_position_vec3f(spDC); + viewport_get_rotation_vec3f(spD0); sp9C[0] = temp_s1->unk4[0]; sp9C[1] = temp_s1->unk4[1]; sp9C[2] = temp_s1->unk4[2]; @@ -196,7 +196,7 @@ void func_80350CA4(void) { s32 var_v0; if (D_80386170.unk4 != NULL) { - viewport_getPosition(sp54); + viewport_get_position_vec3f(sp54); sp48[0] = D_80386170.unk4->unk4[0]; sp48[1] = D_80386170.unk4->unk4[1]; sp48[2] = D_80386170.unk4->unk4[2]; diff --git a/src/core2/code_F8EAF0.c b/src/core2/code_F8EAF0.c index 768e7980..45911191 100644 --- a/src/core2/code_F8EAF0.c +++ b/src/core2/code_F8EAF0.c @@ -94,4 +94,4 @@ void func_802C02D4(f32 arg0[3]) { func_802C02B4(arg0); break; } -} \ No newline at end of file +} diff --git a/src/core2/gc/pauseMenu.c b/src/core2/gc/pauseMenu.c index 0b9de21b..3f732f71 100644 --- a/src/core2/gc/pauseMenu.c +++ b/src/core2/gc/pauseMenu.c @@ -1218,7 +1218,7 @@ void __gcpausemenu_drawSprite(Gfx** gdl, Mtx** mptr, Vtx** vptr, BKSprite* sprit func_80338338(0xFF, 0xFF, 0xFF); func_803382FC(a); func_8033837C(0); - viewport_getPosition(sp50); + viewport_get_position_vec3f(sp50); sp34 = func_8024DE1C(x, y, sp5C, sp44); mlMtxIdent(); //matrix_stack_identity @@ -1337,8 +1337,8 @@ void gcpausemenu_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) { sp8C[0] = 0.0f; sp8C[1] = 0.0f; sp8C[2] = 0.0f; - viewport_setPosition(sp98); - viewport_setRotation(sp8C); + viewport_set_position_vec3f(sp98); + viewport_set_rotation_vec3f(sp8C); viewport_update(); func_8024C904(gfx, mtx); sp98[0] = 0.0f; @@ -1382,8 +1382,8 @@ void gcpausemenu_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) { sp8C[1] = 0.0f; sp8C[2] = 0.0f; - viewport_setPosition(sp98); - viewport_setRotation(sp8C); + viewport_set_position_vec3f(sp98); + viewport_set_rotation_vec3f(sp8C); viewport_update(); func_8024C904(gfx, mtx); diff --git a/src/core2/gc/sky.c b/src/core2/gc/sky.c index e92eb58a..acf09c67 100644 --- a/src/core2/gc/sky.c +++ b/src/core2/gc/sky.c @@ -78,7 +78,7 @@ void sky_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){ if(gcSky.model_bins[0]){ func_80254084(gfx, 0, 0, (s32)(f32) framebuffer_width, (s32)(f32)framebuffer_height,0, 0, 0); //fill screen with black func_8024C904(gfx, mtx); - viewport_getPosition(position); + viewport_get_position_vec3f(position); for(i = 0; i < 3; i++){ iAsset = gcSky.model_bins[i]; if(iAsset){ diff --git a/src/core2/gc/transition.c b/src/core2/gc/transition.c index c6c4d72e..8acc96df 100644 --- a/src/core2/gc/transition.c +++ b/src/core2/gc/transition.c @@ -9,73 +9,125 @@ void func_8025AC20(s32, s32, s32, f32, char*, s32); f32 func_80257618(void); void func_8024CE60(f32, f32); +typedef enum { + TRANSITION_ID_1_BLACK_IN = 1, + TRANSITION_ID_2_BLACK_OUT, + TRANSITION_ID_3_CIRCLE_IN, + TRANSITION_ID_4_CIRCLE_OUT, + TRANSITION_ID_5_JIGGY_IN, + TRANSITION_ID_6_JIGGY_OUT, + TRANSITION_ID_7, + TRANSITION_ID_8_WHITE_IN, + TRANSITION_ID_9_WHITE_OUT, + TRANSITION_ID_A_WITCH_HEAD_OUT, + TRANSITION_ID_B_CIRCLE_IN_FAST, + TRANSITION_ID_C_CIRCLE_OUT_FAST, + TRANSITION_ID_D, + TRANSITION_ID_E_CIRCLE_IN_SLOW, + TRANSITION_ID_F_CIRCLE_OUT_SLOW, + TRANSITION_ID_10_FALLING_PIECES_IN, + TRANSITION_ID_11_FALLING_PIECES_OUT, + TRANSITION_ID_12_CIRCLE_IN_EXTRA_SLOW, + TRANSITION_ID_13_CIRCLE_OUT_EXTRA_SLOW, + TRANSITION_ID_14_CIRCLE_IN_SUPER_SLOW, + TRANSITION_ID_15_CIRCLE_OUT_SUPER_SLOW, +} TransitionId; + +typedef enum { + TRANSITION_STATE_0_NONE, + TRANSITION_STATE_1_LOADING, + TRANSITION_STATE_2_BLACK_IN, + TRANSITION_STATE_3_BLACK_OUT, + TRANSITION_STATE_4_FADE_IN, + TRANSITION_STATE_5_FADE_OUT, + TRANSITION_STATE_6_LOADING_WHITE, + TRANSITION_STATE_7_WHITE_IN, + TRANSITION_STATE_8_WHITE_OUT +} TransitionState; + +typedef struct { + u8 uid; + u8 state; + u8 next_state; + // u8 pad3[1]; + f32 duration; + s32 model_index; + s32 anim_index; + f32 scale; +}TransitionInfo; + +typedef struct { + u8 map_indx; + u8 in_index; + u8 out_index; +}MapTransitionInfo; /* .data */ -struct9s D_8036C150[0x16]= { - {0x1, 2, 0, 0.1f, 0, 0, 0.0f}, - {0x2, 3, 1, 0.1f, 0, 0, 0.0f}, - {0x3, 4, 0, 0.5f, ASSET_7CF_MODEL_TRANSITION_UNKNOWN, 0, 25.0f}, - {0x4, 5, 1, 0.5f, ASSET_7CF_MODEL_TRANSITION_UNKNOWN, 0, 25.0f}, - {0x5, 4, 0, 2.5f, ASSET_7D0_MODEL_TRANSITION_JIGGY, 0, 3.5f}, - {0x6, 5, 1, 0.9f, ASSET_7D0_MODEL_TRANSITION_JIGGY, 0, 3.5f}, - {0x7, 0, 0, 0.0f, 0, 0, 0.0f}, - {0x8, 7, 0, 1.1f, 0, 0, 0.0f}, - {0x9, 8, 6, 0.7f, 0, 0, 0.0f}, - {0xA, 5, 1, 3.5f, ASSET_7D4_MODEL_TRANSITION_WITCH, 0, 3.7f}, - {0xB, 4, 0, 0.3f, ASSET_7CF_MODEL_TRANSITION_UNKNOWN, 0, 25.0f}, - {0xC, 5, 1, 0.3f, ASSET_7CF_MODEL_TRANSITION_UNKNOWN, 0, 25.0f}, - {0xD, 2, 0, 0.6f, 0, 0, 0.0f}, - {0xE, 4, 0, 1.0f, ASSET_7CF_MODEL_TRANSITION_UNKNOWN, 0, 25.0f}, - {0xF, 5, 1, 1.0f, ASSET_7CF_MODEL_TRANSITION_UNKNOWN, 0, 25.0f}, - {0x10, 4, 0, 2.5f, ASSET_467_MODEL_TRANSITION_FALLING_JIGGIES, ASSET_1F5_ANIM_TRANSITION_FALLING_JIGGIES, 0.269645989f}, - {0x11, 5, 1, 2.0f, ASSET_467_MODEL_TRANSITION_FALLING_JIGGIES, ASSET_1F5_ANIM_TRANSITION_FALLING_JIGGIES, 0.269645989f}, - {0x12, 4, 0, 1.2f, ASSET_7CF_MODEL_TRANSITION_UNKNOWN, 0, 25.0f}, - {0x13, 5, 1, 1.2f, ASSET_7CF_MODEL_TRANSITION_UNKNOWN, 0, 25.0f}, - {0x14, 5, 1, 2.2f, ASSET_7CF_MODEL_TRANSITION_UNKNOWN, 0, 25.0f}, - {0x15, 4, 0, 2.2f, ASSET_7CF_MODEL_TRANSITION_UNKNOWN, 0, 25.0f}, +TransitionInfo D_8036C150[0x16]= { + {TRANSITION_ID_1_BLACK_IN, TRANSITION_STATE_2_BLACK_IN, TRANSITION_STATE_0_NONE, 0.1f, 0, 0, 0.0f}, + {TRANSITION_ID_2_BLACK_OUT, TRANSITION_STATE_3_BLACK_OUT, TRANSITION_STATE_1_LOADING, 0.1f, 0, 0, 0.0f}, + {TRANSITION_ID_3_CIRCLE_IN, TRANSITION_STATE_4_FADE_IN, TRANSITION_STATE_0_NONE, 0.5f, ASSET_7CF_MODEL_TRANSITION_UNKNOWN, 0, 25.0f}, + {TRANSITION_ID_4_CIRCLE_OUT, TRANSITION_STATE_5_FADE_OUT, TRANSITION_STATE_1_LOADING, 0.5f, ASSET_7CF_MODEL_TRANSITION_UNKNOWN, 0, 25.0f}, + {TRANSITION_ID_5_JIGGY_IN, TRANSITION_STATE_4_FADE_IN, TRANSITION_STATE_0_NONE, 2.5f, ASSET_7D0_MODEL_TRANSITION_JIGGY, 0, 3.5f}, + {TRANSITION_ID_6_JIGGY_OUT, TRANSITION_STATE_5_FADE_OUT, TRANSITION_STATE_1_LOADING, 0.9f, ASSET_7D0_MODEL_TRANSITION_JIGGY, 0, 3.5f}, + {TRANSITION_ID_7, TRANSITION_STATE_0_NONE, TRANSITION_STATE_0_NONE, 0.0f, 0, 0, 0.0f}, + {TRANSITION_ID_8_WHITE_IN, TRANSITION_STATE_7_WHITE_IN, TRANSITION_STATE_0_NONE, 1.1f, 0, 0, 0.0f}, + {TRANSITION_ID_9_WHITE_OUT, TRANSITION_STATE_8_WHITE_OUT, TRANSITION_STATE_6_LOADING_WHITE, 0.7f, 0, 0, 0.0f}, + {TRANSITION_ID_A_WITCH_HEAD_OUT, TRANSITION_STATE_5_FADE_OUT, TRANSITION_STATE_1_LOADING, 3.5f, ASSET_7D4_MODEL_TRANSITION_WITCH, 0, 3.7f}, + {TRANSITION_ID_B_CIRCLE_IN_FAST, TRANSITION_STATE_4_FADE_IN, TRANSITION_STATE_0_NONE, 0.3f, ASSET_7CF_MODEL_TRANSITION_UNKNOWN, 0, 25.0f}, + {TRANSITION_ID_C_CIRCLE_OUT_FAST, TRANSITION_STATE_5_FADE_OUT, TRANSITION_STATE_1_LOADING, 0.3f, ASSET_7CF_MODEL_TRANSITION_UNKNOWN, 0, 25.0f}, + {TRANSITION_ID_D, TRANSITION_STATE_2_BLACK_IN, TRANSITION_STATE_0_NONE, 0.6f, 0, 0, 0.0f}, + {TRANSITION_ID_E_CIRCLE_IN_SLOW, TRANSITION_STATE_4_FADE_IN, TRANSITION_STATE_0_NONE, 1.0f, ASSET_7CF_MODEL_TRANSITION_UNKNOWN, 0, 25.0f}, + {TRANSITION_ID_F_CIRCLE_OUT_SLOW, TRANSITION_STATE_5_FADE_OUT, TRANSITION_STATE_1_LOADING, 1.0f, ASSET_7CF_MODEL_TRANSITION_UNKNOWN, 0, 25.0f}, + {TRANSITION_ID_10_FALLING_PIECES_IN, TRANSITION_STATE_4_FADE_IN, TRANSITION_STATE_0_NONE, 2.5f, ASSET_467_MODEL_TRANSITION_FALLING_JIGGIES, ASSET_1F5_ANIM_TRANSITION_FALLING_JIGGIES, 0.269645989f}, + {TRANSITION_ID_11_FALLING_PIECES_OUT, TRANSITION_STATE_5_FADE_OUT, TRANSITION_STATE_1_LOADING, 2.0f, ASSET_467_MODEL_TRANSITION_FALLING_JIGGIES, ASSET_1F5_ANIM_TRANSITION_FALLING_JIGGIES, 0.269645989f}, + {TRANSITION_ID_12_CIRCLE_IN_EXTRA_SLOW, TRANSITION_STATE_4_FADE_IN, TRANSITION_STATE_0_NONE, 1.2f, ASSET_7CF_MODEL_TRANSITION_UNKNOWN, 0, 25.0f}, + {TRANSITION_ID_13_CIRCLE_OUT_EXTRA_SLOW, TRANSITION_STATE_5_FADE_OUT, TRANSITION_STATE_1_LOADING, 1.2f, ASSET_7CF_MODEL_TRANSITION_UNKNOWN, 0, 25.0f}, + {TRANSITION_ID_14_CIRCLE_IN_SUPER_SLOW, TRANSITION_STATE_5_FADE_OUT, TRANSITION_STATE_1_LOADING, 2.2f, ASSET_7CF_MODEL_TRANSITION_UNKNOWN, 0, 25.0f}, + {TRANSITION_ID_15_CIRCLE_OUT_SUPER_SLOW, TRANSITION_STATE_4_FADE_IN, TRANSITION_STATE_0_NONE, 2.2f, ASSET_7CF_MODEL_TRANSITION_UNKNOWN, 0, 25.0f}, 0 }; -struct9s D_8036C308[0xC] = { - {0xA, 5, 1, 3.5f, ASSET_7D4_MODEL_TRANSITION_WITCH, 0, 3.7f}, - {0x10, 4, 0, 2.5f, ASSET_467_MODEL_TRANSITION_FALLING_JIGGIES, ASSET_1F5_ANIM_TRANSITION_FALLING_JIGGIES, 0.269645989f}, - {0x11, 5, 1, 2.0f, ASSET_467_MODEL_TRANSITION_FALLING_JIGGIES, ASSET_1F5_ANIM_TRANSITION_FALLING_JIGGIES, 0.269645989f}, - {0x6, 5, 1, 0.9f, ASSET_7D0_MODEL_TRANSITION_JIGGY, 0, 3.5f}, - {0x5, 4, 0, 2.5f, ASSET_7D0_MODEL_TRANSITION_JIGGY, 0, 3.5f}, - {0x9, 8, 6, 0.7f, 0, 0, 0.0f}, - {0x8, 7, 0, 0.7f, 0, 0, 0.0f}, - {0xE, 4, 0, 1.0f, ASSET_7CF_MODEL_TRANSITION_UNKNOWN, 0, 25.0f}, - {0xF, 5, 1, 1.0f, ASSET_7CF_MODEL_TRANSITION_UNKNOWN, 0, 25.0f}, - {0x7, 0, 0, 0.0f, 0, 0, 0.0f}, - {0x8, 7, 0, 1.1f, 0, 0, 0.0f}, - {0x9, 8, 6, 1.5f, 0, 0, 0.0f} +TransitionInfo D_8036C308[0xC] = { + {TRANSITION_ID_A_WITCH_HEAD_OUT, TRANSITION_STATE_5_FADE_OUT, TRANSITION_STATE_1_LOADING, 3.5f, ASSET_7D4_MODEL_TRANSITION_WITCH, 0, 3.7f}, + {TRANSITION_ID_10_FALLING_PIECES_IN, TRANSITION_STATE_4_FADE_IN, TRANSITION_STATE_0_NONE, 2.5f, ASSET_467_MODEL_TRANSITION_FALLING_JIGGIES, ASSET_1F5_ANIM_TRANSITION_FALLING_JIGGIES, 0.269645989f}, + {TRANSITION_ID_11_FALLING_PIECES_OUT, TRANSITION_STATE_5_FADE_OUT, TRANSITION_STATE_1_LOADING, 2.0f, ASSET_467_MODEL_TRANSITION_FALLING_JIGGIES, ASSET_1F5_ANIM_TRANSITION_FALLING_JIGGIES, 0.269645989f}, + {TRANSITION_ID_6_JIGGY_OUT, TRANSITION_STATE_5_FADE_OUT, TRANSITION_STATE_1_LOADING, 0.9f, ASSET_7D0_MODEL_TRANSITION_JIGGY, 0, 3.5f}, + {TRANSITION_ID_5_JIGGY_IN, TRANSITION_STATE_4_FADE_IN, TRANSITION_STATE_0_NONE, 2.5f, ASSET_7D0_MODEL_TRANSITION_JIGGY, 0, 3.5f}, + {TRANSITION_ID_9_WHITE_OUT, TRANSITION_STATE_8_WHITE_OUT, TRANSITION_STATE_6_LOADING_WHITE, 0.7f, 0, 0, 0.0f}, + {TRANSITION_ID_8_WHITE_IN, TRANSITION_STATE_7_WHITE_IN, TRANSITION_STATE_0_NONE, 0.7f, 0, 0, 0.0f}, + {TRANSITION_ID_E_CIRCLE_IN_SLOW, TRANSITION_STATE_4_FADE_IN, TRANSITION_STATE_0_NONE, 1.0f, ASSET_7CF_MODEL_TRANSITION_UNKNOWN, 0, 25.0f}, + {TRANSITION_ID_F_CIRCLE_OUT_SLOW, TRANSITION_STATE_5_FADE_OUT, TRANSITION_STATE_1_LOADING, 1.0f, ASSET_7CF_MODEL_TRANSITION_UNKNOWN, 0, 25.0f}, + {TRANSITION_ID_7, TRANSITION_STATE_0_NONE, TRANSITION_STATE_0_NONE, 0.0f, 0, 0, 0.0f}, + {TRANSITION_ID_8_WHITE_IN, TRANSITION_STATE_7_WHITE_IN, TRANSITION_STATE_0_NONE, 1.1f, 0, 0, 0.0f}, + {TRANSITION_ID_9_WHITE_OUT, TRANSITION_STATE_8_WHITE_OUT, TRANSITION_STATE_6_LOADING_WHITE, 1.5f, 0, 0, 0.0f} }; -struct10s D_8036C3F8[0x18] = { - {MAP_20_CS_END_NOT_100, 0x12, 0x13}, - {MAP_1F_CS_START_RAREWARE, 0x15, 0x09}, - {MAP_1E_CS_START_NINTENDO, 0x08, 0x13}, - {MAP_7D_CS_SPIRAL_MOUNTAIN_1, 0x0B, 0x0C}, - {MAP_7E_CS_SPIRAL_MOUNTAIN_2, 0x0B, 0x0C}, - {MAP_85_CS_SPIRAL_MOUNTAIN_3, 0x12, 0x0C}, - {MAP_86_CS_SPIRAL_MOUNTAIN_4, 0x0B, 0x0C}, - {MAP_87_CS_SPIRAL_MOUNTAIN_5, 0x12, 0x13}, - {MAP_88_CS_SPIRAL_MOUNTAIN_6, 0x12, 0x13}, - {MAP_94_CS_INTRO_SPIRAL_7, 0x12, 0x13}, - {MAP_95_CS_END_ALL_100, 0x12, 0x13}, - {MAP_98_CS_END_SPIRAL_MOUNTAIN_1, 0x12, 0x0A}, - {MAP_99_CS_END_SPIRAL_MOUNTAIN_2, 0x12, 0x0A}, - {MAP_7B_CS_INTRO_GL_DINGPOT_1, 0x0B, 0x0C}, - {MAP_81_CS_INTRO_GL_DINGPOT_2, 0x0B, 0x0C}, - {MAP_82_CS_ENTERING_GL_MACHINE_ROOM, 0x12, 0x0A}, - {MAP_83_CS_GAME_OVER_MACHINE_ROOM, 0x12, 0x13}, - {MAP_84_CS_UNUSED_MACHINE_ROOM, 0x12, 0x0C}, - {MAP_7C_CS_INTRO_BANJOS_HOUSE_1, 0x0B, 0x0C}, - {MAP_89_CS_INTRO_BANJOS_HOUSE_2, 0x0B, 0x0A}, - {MAP_8A_CS_INTRO_BANJOS_HOUSE_3, 0x01, 0x02}, - {MAP_96_CS_END_BEACH_1, 0x12, 0x13}, - {MAP_97_CS_END_BEACH_2, 0x08, 0x14}, - {0, 0x05, 0x06} +MapTransitionInfo D_8036C3F8[0x18] = { + {MAP_20_CS_END_NOT_100, TRANSITION_ID_12_CIRCLE_IN_EXTRA_SLOW, TRANSITION_ID_13_CIRCLE_OUT_EXTRA_SLOW}, + {MAP_1F_CS_START_RAREWARE, TRANSITION_ID_15_CIRCLE_OUT_SUPER_SLOW, TRANSITION_ID_9_WHITE_OUT}, + {MAP_1E_CS_START_NINTENDO, TRANSITION_ID_8_WHITE_IN, TRANSITION_ID_13_CIRCLE_OUT_EXTRA_SLOW}, + {MAP_7D_CS_SPIRAL_MOUNTAIN_1, TRANSITION_ID_B_CIRCLE_IN_FAST, TRANSITION_ID_C_CIRCLE_OUT_FAST}, + {MAP_7E_CS_SPIRAL_MOUNTAIN_2, TRANSITION_ID_B_CIRCLE_IN_FAST, TRANSITION_ID_C_CIRCLE_OUT_FAST}, + {MAP_85_CS_SPIRAL_MOUNTAIN_3, TRANSITION_ID_12_CIRCLE_IN_EXTRA_SLOW, TRANSITION_ID_C_CIRCLE_OUT_FAST}, + {MAP_86_CS_SPIRAL_MOUNTAIN_4, TRANSITION_ID_B_CIRCLE_IN_FAST, TRANSITION_ID_C_CIRCLE_OUT_FAST}, + {MAP_87_CS_SPIRAL_MOUNTAIN_5, TRANSITION_ID_12_CIRCLE_IN_EXTRA_SLOW, TRANSITION_ID_13_CIRCLE_OUT_EXTRA_SLOW}, + {MAP_88_CS_SPIRAL_MOUNTAIN_6, TRANSITION_ID_12_CIRCLE_IN_EXTRA_SLOW, TRANSITION_ID_13_CIRCLE_OUT_EXTRA_SLOW}, + {MAP_94_CS_INTRO_SPIRAL_7, TRANSITION_ID_12_CIRCLE_IN_EXTRA_SLOW, TRANSITION_ID_13_CIRCLE_OUT_EXTRA_SLOW}, + {MAP_95_CS_END_ALL_100, TRANSITION_ID_12_CIRCLE_IN_EXTRA_SLOW, TRANSITION_ID_13_CIRCLE_OUT_EXTRA_SLOW}, + {MAP_98_CS_END_SPIRAL_MOUNTAIN_1, TRANSITION_ID_12_CIRCLE_IN_EXTRA_SLOW, TRANSITION_ID_A_WITCH_HEAD_OUT}, + {MAP_99_CS_END_SPIRAL_MOUNTAIN_2, TRANSITION_ID_12_CIRCLE_IN_EXTRA_SLOW, TRANSITION_ID_A_WITCH_HEAD_OUT}, + {MAP_7B_CS_INTRO_GL_DINGPOT_1, TRANSITION_ID_B_CIRCLE_IN_FAST, TRANSITION_ID_C_CIRCLE_OUT_FAST}, + {MAP_81_CS_INTRO_GL_DINGPOT_2, TRANSITION_ID_B_CIRCLE_IN_FAST, TRANSITION_ID_C_CIRCLE_OUT_FAST}, + {MAP_82_CS_ENTERING_GL_MACHINE_ROOM, TRANSITION_ID_12_CIRCLE_IN_EXTRA_SLOW, TRANSITION_ID_A_WITCH_HEAD_OUT}, + {MAP_83_CS_GAME_OVER_MACHINE_ROOM, TRANSITION_ID_12_CIRCLE_IN_EXTRA_SLOW, TRANSITION_ID_13_CIRCLE_OUT_EXTRA_SLOW}, + {MAP_84_CS_UNUSED_MACHINE_ROOM, TRANSITION_ID_12_CIRCLE_IN_EXTRA_SLOW, TRANSITION_ID_C_CIRCLE_OUT_FAST}, + {MAP_7C_CS_INTRO_BANJOS_HOUSE_1, TRANSITION_ID_B_CIRCLE_IN_FAST, TRANSITION_ID_C_CIRCLE_OUT_FAST}, + {MAP_89_CS_INTRO_BANJOS_HOUSE_2, TRANSITION_ID_B_CIRCLE_IN_FAST, TRANSITION_ID_A_WITCH_HEAD_OUT}, + {MAP_8A_CS_INTRO_BANJOS_HOUSE_3, TRANSITION_ID_1_BLACK_IN, TRANSITION_ID_2_BLACK_OUT}, + {MAP_96_CS_END_BEACH_1, TRANSITION_ID_12_CIRCLE_IN_EXTRA_SLOW, TRANSITION_ID_13_CIRCLE_OUT_EXTRA_SLOW}, + {MAP_97_CS_END_BEACH_2, TRANSITION_ID_8_WHITE_IN, TRANSITION_ID_14_CIRCLE_IN_SUPER_SLOW}, + {0, TRANSITION_ID_5_JIGGY_IN, TRANSITION_ID_6_JIGGY_OUT} }; f32 D_8036C440 = 63.6026115f; f32 D_8036C444 = 500.0f; @@ -84,19 +136,19 @@ f32 D_8036C444 = 500.0f; /* .bss */ struct{ s32 unk0; //times drawn? - struct9s *unk4; - u8 unk8; //state - u8 pad9[3]; //not needed - void * unkC; //asset_ptr + TransitionInfo *transistion_info; + u8 state; + //u8 pad9[3]; //not needed + void * model_ptr; //asset_ptr f32 rotation; f32 timer; AnimCtrl *animctrl; - s32 unk1C; //times update called? -} D_80382430; + s32 substate; //times update called? +} s_current_transition; /* .code */ -struct9s *_gctranstion_8030B400(s32 arg0){ - struct9s * i; +TransitionInfo *_gctranstion_8030B400(s32 arg0){ + TransitionInfo * i; for(i = D_8036C150; i->uid != 0; i++){ if(i->uid == arg0) return i; @@ -104,8 +156,8 @@ struct9s *_gctranstion_8030B400(s32 arg0){ return NULL; } -struct10s *_gctranstion_8030B44C(s32 map_indx){ - struct10s * i; +MapTransitionInfo *_gctranstion_get_map_transition_info(s32 map_indx){ + MapTransitionInfo * i; for(i = D_8036C3F8; i->map_indx != 0; i++){ if(i->map_indx == map_indx) return i; @@ -113,54 +165,57 @@ struct10s *_gctranstion_8030B44C(s32 map_indx){ return i; } -void _gctranstion_changeState(s32 state, struct9s *arg1){ - if(D_80382430.unkC != NULL){ - func_8033BD20(&D_80382430.unkC); +void _gctranstion_changeState(s32 state, TransitionInfo *desc){ + if(s_current_transition.model_ptr != NULL){ + func_8033BD20(&s_current_transition.model_ptr); } - if(D_80382430.animctrl != NULL){ - animctrl_free(D_80382430.animctrl); - D_80382430.animctrl = NULL; + if(s_current_transition.animctrl != NULL){ + animctrl_free(s_current_transition.animctrl); + s_current_transition.animctrl = NULL; } - D_80382430.unk0 = 0; - D_80382430.unk4 = arg1; - D_80382430.unk8 = state; - D_80382430.timer = 0.0f; - if(state == 1) - D_80382430.unkC = assetcache_get(0x7D2); - else if(state == 6) - D_80382430.unkC = assetcache_get(0x7D3); - else if(arg1 != NULL && arg1->unk8 != 0) - D_80382430.unkC = assetcache_get(arg1->unk8); + s_current_transition.unk0 = 0; + s_current_transition.transistion_info = desc; + s_current_transition.state = state; + s_current_transition.timer = 0.0f; + + //Loading screen model?? + if(state == TRANSITION_STATE_1_LOADING) + s_current_transition.model_ptr = assetcache_get(0x7D2); //scene transition black + else if(state == TRANSITION_STATE_6_LOADING_WHITE) + s_current_transition.model_ptr = assetcache_get(0x7D3); //scene transition white + else if(desc != NULL && desc->model_index != 0) + s_current_transition.model_ptr = assetcache_get(desc->model_index); - if(arg1 != NULL && arg1->unkC != NULL){ - D_80382430.animctrl = animctrl_new(0); - animctrl_reset(D_80382430.animctrl); - animctrl_setIndex(D_80382430.animctrl, arg1->unkC); - animctrl_setDuration(D_80382430.animctrl, arg1->unk4); - animctrl_setPlaybackType(D_80382430.animctrl, ANIMCTRL_ONCE); - if(state == 5){ - animctrl_setDirection(D_80382430.animctrl, 0); + //load transistion animation + if(desc != NULL && desc->anim_index != NULL){ + s_current_transition.animctrl = animctrl_new(0); + animctrl_reset(s_current_transition.animctrl); + animctrl_setIndex(s_current_transition.animctrl, desc->anim_index); + animctrl_setDuration(s_current_transition.animctrl, desc->duration); + animctrl_setPlaybackType(s_current_transition.animctrl, ANIMCTRL_ONCE); + if(state == TRANSITION_STATE_5_FADE_OUT){ + animctrl_setDirection(s_current_transition.animctrl, 0); func_8028F7C8(1); //player_noControl(true) func_80335110(0); //objects_update(false) } else{ osViBlack(1); - animctrl_setAnimTimer(D_80382430.animctrl, 0.25f); //set animation timer + animctrl_setAnimTimer(s_current_transition.animctrl, 0.25f); //set animation timer } - animctrl_start(D_80382430.animctrl, "gctransition.c", 0x125); + animctrl_start(s_current_transition.animctrl, "gctransition.c", 0x125); } - if(state == 4){ + if(state == TRANSITION_STATE_4_FADE_IN){ if(func_802D4608()==0){ func_8025A70C(COMUSIC_4E_IN_TRANSITION); func_8025AC20(COMUSIC_4E_IN_TRANSITION, 0, 1000, 0.4f, "gctransition.c", 0x12d); func_8025AABC(COMUSIC_4E_IN_TRANSITION); } }//L8030B67C - else if(state == 5){ - if(D_80382430.unk4->uid == 0xA){ + else if(state == TRANSITION_STATE_5_FADE_OUT){ + if(s_current_transition.transistion_info->uid == 0xA){ func_8030E704(SFX_EB_GRUNTY_LAUGH_2); } else{ @@ -171,167 +226,178 @@ void _gctranstion_changeState(s32 state, struct9s *arg1){ } } } - else if(state == 0){ + else if(state == TRANSITION_STATE_0_NONE){ func_80335128(1); func_80335110(1); if(func_8028F070()) func_8028F7C8(0); } - D_80382430.unk1C = 0; + s_current_transition.substate = 0; } -void gctransition_8030B740(void){ - if(D_80382430.unkC != NULL) - D_80382430.unkC = defrag_asset(D_80382430.unkC); +void gctransition_defrag(void){ + if(s_current_transition.model_ptr != NULL) + s_current_transition.model_ptr = defrag_asset(s_current_transition.model_ptr); } void gctransition_draw(Gfx **gdl, Mtx **mptr, Vtx **vptr){ - f32 sp74[3]; - f32 sp68[3]; - f32 sp64; + f32 vp_position[3]; + f32 vp_rotation[3]; + f32 percentage; f32 sp58[3]; - f32 tmp; + f32 scale; - D_80382430.unk0++; - if(D_80382430.unk8 == 0) + s_current_transition.unk0++; + if(s_current_transition.state == 0) return; func_8024E258(); - if(D_80382430.animctrl != NULL){ - sp74[0] = 0.0f; - sp74[1] = 0.0f; - sp74[2] = 350.0f; + if(s_current_transition.animctrl != NULL){ + vp_position[0] = 0.0f; + vp_position[1] = 0.0f; + vp_position[2] = 350.0f; }else{ - sp74[0] = 0.0f; - sp74[1] = 0.0f; - sp74[2] = 300.0f; + vp_position[0] = 0.0f; + vp_position[1] = 0.0f; + vp_position[2] = 300.0f; } - sp68[0] = 0.0f; - sp68[1] = 0.0f; - sp68[2] = 0.0f; + vp_rotation[0] = 0.0f; + vp_rotation[1] = 0.0f; + vp_rotation[2] = 0.0f; func_8024CE60(D_8036C440, D_8036C444); - viewport_setPosition(sp74); //viewport_getPosition - viewport_setRotation(sp68); //viewport_getRotation + viewport_set_position_vec3f(vp_position); //viewport_get_position_vec3f + viewport_set_rotation_vec3f(vp_rotation); //viewport_get_rotation_vec3f viewport_update(); //camera_updateNormal func_8024C904(gdl, mptr); + sp58[0] = 0.0f; sp58[1] = 0.0f; sp58[2] = 0.0f; - if(D_80382430.animctrl != NULL){ + if(s_current_transition.animctrl != NULL){ gDPSetTextureFilter((*gdl)++, G_TF_POINT); gDPSetColorDither((*gdl)++, G_CD_DISABLE); - animctrl_drawSetup(D_80382430.animctrl, sp58, 1); + animctrl_drawSetup(s_current_transition.animctrl, sp58, 1); modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); } - if(D_80382430.unk8 == 1 || D_80382430.unk8 == 6){ - modelRender_draw(gdl, mptr, sp58, sp68, 1.0f, 0, D_80382430.unkC); - if(D_80382430.animctrl != NULL){ + + //complex animation (from animation bin file) + if(s_current_transition.state == 1 || s_current_transition.state == 6){ + modelRender_draw(gdl, mptr, sp58, vp_rotation, 1.0f, 0, s_current_transition.model_ptr); + if(s_current_transition.animctrl != NULL){ gDPSetTextureFilter((*gdl)++, G_TF_BILERP); gDPSetColorDither((*gdl)++, G_CD_MAGICSQ); } + return; } - else{ - sp64 = D_80382430.timer/(D_80382430.unk4->unk4); - if(D_80382430.unk8 == 4){ - if(D_80382430.unk4->uid == 0x10){ - tmp = D_80382430.unk4->unk10; - - } - else{ - sp68[2] = D_80382430.rotation - 90.0f*sp64; - tmp = sp64*D_80382430.unk4->unk10 + 0.1; - } - modelRender_draw(gdl, mptr, sp58, sp68, tmp, 0, D_80382430.unkC); + + percentage = s_current_transition.timer/(s_current_transition.transistion_info->duration); + if(s_current_transition.state == TRANSITION_STATE_4_FADE_IN){ + //rotate and zoom in + if(s_current_transition.transistion_info->uid == 0x10){ + scale = s_current_transition.transistion_info->scale; + } - else if(D_80382430.unk8 == 5){//L8030B9EC - switch (D_80382430.unk4->uid) - { + else{ + vp_rotation[2] = s_current_transition.rotation - 90.0f*percentage; + scale = percentage*s_current_transition.transistion_info->scale + 0.1; + } + modelRender_draw(gdl, mptr, sp58, vp_rotation, scale, 0, s_current_transition.model_ptr); + } + else if(s_current_transition.state == TRANSITION_STATE_5_FADE_OUT){//L8030B9EC + switch (s_current_transition.transistion_info->uid) + { default: - sp68[2] = D_80382430.rotation - 90.0f*sp64; - tmp = (1.0f - sp64)*D_80382430.unk4->unk10 + 0.1; + //rotate and zoom out + vp_rotation[2] = s_current_transition.rotation - 90.0f*percentage; + scale = (1.0f - percentage)*s_current_transition.transistion_info->scale + 0.1; break; case 0x11: - tmp = D_80382430.unk4->unk10; + //static + scale = s_current_transition.transistion_info->scale; break; case 0xA: - sp68[2] = 0.0f; - tmp = (1.0f - func_80257618())*D_80382430.unk4->unk10 + 0.1; + //zoom out only + vp_rotation[2] = 0.0f; + scale = (1.0f - func_80257618())*s_current_transition.transistion_info->scale + 0.1; break; - } - if(!(D_80382430.unk1C < 3) || D_80382430.unk4->uid != 0x11){ - modelRender_draw(gdl, mptr, sp58, sp68, tmp, 0, D_80382430.unkC); - } - else{ - modelRender_reset(); - } - } - else if(D_80382430.unk8 == 2){//L8030BAF4 - gcbound_reset(); - gcbound_alpha((1.0f - sp64)*255.0f + 0.5); - gcbound_color(0,0,0); - gcbound_draw(gdl); + if(!(s_current_transition.substate < 3) || s_current_transition.transistion_info->uid != 0x11){ + modelRender_draw(gdl, mptr, sp58, vp_rotation, scale, 0, s_current_transition.model_ptr); } - else if(D_80382430.unk8 == 3){//L8030BB6C - gcbound_reset(); - gcbound_alpha(sp64*255.0f + 0.5); - gcbound_color(0,0,0); - gcbound_draw(gdl); - } - else if(D_80382430.unk8 == 7){//L8030BBD8 - sp64 = (sp64 <= 0.5)? 1.0 : 1.0 - (sp64-0.5)/0.5; - gcbound_reset(); - gcbound_alpha(sp64*255.0f + 0.5); - gcbound_color(0xff,0xff,0xff); - gcbound_draw(gdl); - } - else if(D_80382430.unk8 == 8){//L8030BC8C - - gcbound_reset(); - gcbound_alpha(sp64*255.0f + 0.5); - gcbound_color(0xff,0xff,0xff); - gcbound_draw(gdl); - }//L8030BD00 else{ - + modelRender_reset(); } - if(D_80382430.animctrl != NULL){ - gDPSetTextureFilter((*gdl)++, G_TF_BILERP); - } - func_8024E2FC(); - func_8024C904(gdl, mptr); + } + else if(s_current_transition.state == TRANSITION_STATE_2_BLACK_IN){//L8030BAF4 + //fade in black (i.e. get less black) + gcbound_reset(); + gcbound_alpha((1.0f - percentage)*255.0f + 0.5); + gcbound_color(0,0,0); + gcbound_draw(gdl); + } + else if(s_current_transition.state == TRANSITION_STATE_3_BLACK_OUT){//L8030BB6C + //fade out black (i.e. get more black) + gcbound_reset(); + gcbound_alpha(percentage*255.0f + 0.5); + gcbound_color(0,0,0); + gcbound_draw(gdl); + } + else if(s_current_transition.state == TRANSITION_STATE_7_WHITE_IN){//L8030BBD8 + //fade in white (i.e. get less white) + percentage = (percentage <= 0.5)? 1.0 : 1.0 - (percentage-0.5)/0.5; + gcbound_reset(); + gcbound_alpha(percentage*255.0f + 0.5); + gcbound_color(0xff,0xff,0xff); + gcbound_draw(gdl); + } + else if(s_current_transition.state == TRANSITION_STATE_8_WHITE_OUT){//L8030BC8C + //fade out white (i.e. get more white) + gcbound_reset(); + gcbound_alpha(percentage*255.0f + 0.5); + gcbound_color(0xff,0xff,0xff); + gcbound_draw(gdl); + }//L8030BD00 + else{ + + } + if(s_current_transition.animctrl != NULL){ + gDPSetTextureFilter((*gdl)++, G_TF_BILERP); + } + func_8024E2FC(); + func_8024C904(gdl, mptr); + } void gctransition_8030BD4C(void){ - struct10s *tmp_10s; - struct9s *tmp_a1; - tmp_10s = _gctranstion_8030B44C(map_get()); - tmp_a1 = _gctranstion_8030B400(tmp_10s->unk1); - _gctranstion_changeState(tmp_a1->unk1, tmp_a1); + MapTransitionInfo *tmp_10s; + TransitionInfo *tmp_a1; + tmp_10s = _gctranstion_get_map_transition_info(map_get()); + tmp_a1 = _gctranstion_8030B400(tmp_10s->in_index); + _gctranstion_changeState(tmp_a1->state, tmp_a1); } f32 gctransition_8030BD88(void){ return 300.0f; } -int gctransition_8030BD98(void){ - return D_80382430.unk8 == 0; +int gctransition_done(void){ + return s_current_transition.state == TRANSITION_STATE_0_NONE; } -int gctransition_8030BDAC(void){ - return D_80382430.unk8 != 0; +int gctransition_active(void){ + return s_current_transition.state != TRANSITION_STATE_0_NONE; } int gctransition_8030BDC0(void){ - return ( D_80382430.unk8 == 0x3) - || (( D_80382430.unk8 == 1) && (D_80382430.unk0 < 2)) - || ( D_80382430.unk8 == 5) - || ( D_80382430.unk8 == 8) - || (( D_80382430.unk8 == 6) && (D_80382430.unk0 < 2)); + return ( s_current_transition.state == TRANSITION_STATE_3_BLACK_OUT) + || (( s_current_transition.state == TRANSITION_STATE_1_LOADING) && (s_current_transition.unk0 < 2)) + || ( s_current_transition.state == TRANSITION_STATE_5_FADE_OUT) + || ( s_current_transition.state == TRANSITION_STATE_8_WHITE_OUT) + || (( s_current_transition.state == TRANSITION_STATE_6_LOADING_WHITE) && (s_current_transition.unk0 < 2)); } void gctransition_8030BE3C(void){ @@ -339,37 +405,37 @@ void gctransition_8030BE3C(void){ } void gctransition_8030BE60(void){ - struct9s *tmp_a1; - tmp_a1 = _gctranstion_8030B400(_gctranstion_8030B44C(map_get())->unk2); + TransitionInfo *tmp_a1; + tmp_a1 = _gctranstion_8030B400(_gctranstion_get_map_transition_info(map_get())->out_index); func_8030C180(); - _gctranstion_changeState(tmp_a1->unk1, tmp_a1); + _gctranstion_changeState(tmp_a1->state, tmp_a1); } void gctransition_8030BEA4(s32 arg0){ - _gctranstion_changeState(D_8036C308[arg0].unk1, &D_8036C308[arg0]); + _gctranstion_changeState(D_8036C308[arg0].state, &D_8036C308[arg0]); } void gctransition_reset(void){ - D_80382430.unk4 = NULL; - D_80382430.unk8 = 0; - D_80382430.unkC = NULL; - D_80382430.rotation = 0.0f; + s_current_transition.transistion_info = NULL; + s_current_transition.state = TRANSITION_STATE_0_NONE; + s_current_transition.model_ptr = NULL; + s_current_transition.rotation = 0.0f; _gctranstion_changeState(0,0); } void gctransition_update(void){ - f32 sp24; + f32 dt; f32 tmp; - sp24 = time_getDelta(); - if(D_80382430.unk4 == NULL) + dt = time_getDelta(); + if(s_current_transition.transistion_info == NULL) return; - if(D_80382430.animctrl != NULL){ - animctrl_update(D_80382430.animctrl); - if(D_80382430.unk8 == 4){ - switch(D_80382430.unk1C){ + if(s_current_transition.animctrl != NULL){ + animctrl_update(s_current_transition.animctrl); + if(s_current_transition.state == TRANSITION_STATE_4_FADE_IN){ + switch(s_current_transition.substate){ case 0: break; case 1: @@ -380,27 +446,27 @@ void gctransition_update(void){ func_80335128(0); break; case 3: - func_802FEF48(D_80382430.unkC); //framebuffer to model texture list + func_802FEF48(s_current_transition.model_ptr); //framebuffer to model texture list break; case 4: osViBlack(0); break; default: - D_80382430.timer += sp24; + s_current_transition.timer += dt; break; } } else{//L8030BFEC - switch(D_80382430.unk1C){ + switch(s_current_transition.substate){ default: - D_80382430.timer += sp24; + s_current_transition.timer += dt; break; case 0: case 1: break; case 2: func_80335128(0); - func_802FEF48(D_80382430.unkC); //framebuffer to model texture list + func_802FEF48(s_current_transition.model_ptr); //framebuffer to model texture list break; } @@ -408,25 +474,26 @@ void gctransition_update(void){ } } else{//L8030C034 - D_80382430.timer += sp24; + s_current_transition.timer += dt; } - if(D_80382430.unk4->unk4 < D_80382430.timer - || (D_80382430.animctrl!= NULL && animctrl_isStopped(D_80382430.animctrl)) + if(s_current_transition.transistion_info->duration < s_current_transition.timer + || (s_current_transition.animctrl!= NULL && animctrl_isStopped(s_current_transition.animctrl)) ){ - D_80382430.timer = D_80382430.unk4->unk4; - if(D_80382430.unk8 == 4 || D_80382430.unk8 == 5){ - D_80382430.rotation -= 90.0f; - if (D_80382430.rotation < -360.0f) - D_80382430.rotation += 360.0f; - if (360.0f < D_80382430.rotation) - D_80382430.rotation -= 360.0f; + s_current_transition.timer = s_current_transition.transistion_info->duration; + //update next transition rotation + if(s_current_transition.state == TRANSITION_STATE_4_FADE_IN || s_current_transition.state == TRANSITION_STATE_5_FADE_OUT){ + s_current_transition.rotation -= 90.0f; + if (s_current_transition.rotation < -360.0f) + s_current_transition.rotation += 360.0f; + if (360.0f < s_current_transition.rotation) + s_current_transition.rotation -= 360.0f; }//L8030C104 - _gctranstion_changeState(D_80382430.unk4->unk2, 0); - if(D_80382430.unk8 == 4) + _gctranstion_changeState(s_current_transition.transistion_info->next_state, 0); + if(s_current_transition.state == TRANSITION_STATE_4_FADE_IN) func_8030C180(); - if(D_80382430.animctrl != NULL) + if(s_current_transition.animctrl != NULL) func_80334ECC(); } - D_80382430.unk1C++; + s_current_transition.substate++; } diff --git a/src/core2/levelspecificflags.c b/src/core2/levelspecificflags.c index 08861c7b..c70ae807 100644 --- a/src/core2/levelspecificflags.c +++ b/src/core2/levelspecificflags.c @@ -61,11 +61,11 @@ void _levelSpecificFlags_updateCRC2(void) { } s32 levelSpecificFlags_get(s32 i){ - return func_803200A4(D_80383320.unk8, i); + return bitfield_get_bit(D_80383320.unk8, i); } s32 levelSpecificFlags_getN(s32 i, s32 n){ - return func_803200E4(D_80383320.unk8, i, n); + return bitfield_get_n_bits(D_80383320.unk8, i, n); } s32 levelSpecificFlags_getSet(s32 arg0, s32 arg1){ diff --git a/src/core2/mapModel.c b/src/core2/mapModel.c index 1e447f8e..65954c2a 100644 --- a/src/core2/mapModel.c +++ b/src/core2/mapModel.c @@ -498,7 +498,7 @@ BKCollisionTri *func_80309C74(f32 arg0[3], f32 arg1[3], f32 arg2[3], s32 flagFil } bool func_80309D58(f32 arg0[3], UNK_TYPE(s32) arg1) { - BKMeshList *temp_v0; + BKModelUnk14List *temp_v0; temp_v0 = func_8033A12C(mapModel.model_bin_opa); if (temp_v0 != NULL) { diff --git a/src/core2/modelRender.c b/src/core2/modelRender.c index e63f98f4..df2dd9b5 100644 --- a/src/core2/modelRender.c +++ b/src/core2/modelRender.c @@ -9,15 +9,15 @@ extern bool func_802ED420(BKModelUnk20List *arg0, u8 *arg1, u32 arg2); extern void func_802ED52C(BKModelUnk20List *, f32[3], f32); extern void func_80252AF0(f32[3], f32[3], f32[3], f32, f32[3]); -extern void mlMtxRotate(f32, f32, f32); -extern void viewport_getPosition(f32[3]); -extern void viewport_getRotation(f32[3]); -extern void viewport_setPosition(f32[3]); -extern void viewport_setRotation(f32[3]); +extern void mlMtxRotatePYR(f32, f32, f32); +extern void viewport_get_position_vec3f(f32[3]); +extern void viewport_get_rotation_vec3f(f32[3]); +extern void viewport_set_position_vec3f(f32[3]); +extern void viewport_set_rotation_vec3f(f32[3]); extern void viewport_update(void); extern void func_8033BD4C(BKModelBin *); extern s32 func_8024DB50(f32[3], f32); -extern void func_80251788(f32, f32, f32); +extern void mlMtx_push_translation(f32, f32, f32); extern void mlMtxScale(f32); extern void mlMtxApply(Mtx* mtx); extern AnimMtxList *animMtxList_new(); @@ -696,8 +696,8 @@ void modelRender_reset(void){ func_8033A45C(1,1); func_8033A45C(2,0); if(D_80383758.unk18){ - viewport_setPosition(D_80383758.unk1C); - viewport_setRotation(D_80383758.unk28); + viewport_set_position_vec3f(D_80383758.unk1C); + viewport_set_rotation_vec3f(D_80383758.unk28); viewport_update(); } } @@ -714,7 +714,7 @@ void func_803384A8(Gfx **gfx, Mtx **mtx, void *arg2){ if(cmd->unk8){ func_8025235C(sp30, cmd->unkC); - func_80251788(sp30[0], sp30[1], sp30[2]); + mlMtx_push_translation(sp30[0], sp30[1], sp30[2]); mlMtxRotYaw(modelRenderCameraRotation[1]); if(!cmd->unkA){ mlMtxRotPitch(modelRenderCameraRotation[0]); @@ -795,7 +795,7 @@ void func_803387F8(Gfx **gfx, Mtx **mtx, void *arg2){ GeoCmd2 *cmd = (GeoCmd2 *)arg2; if(D_8038371C){ - func_802519C8(&D_80383BF8, animMtxList_get(D_8038371C, cmd->unk9)); + mlMtx_push_multiplied_2(&D_80383BF8, animMtxList_get(D_8038371C, cmd->unk9)); if(D_80370990){ mlMtxApply(*mtx); gSPMatrix((*gfx)++, (*mtx)++, G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -875,7 +875,7 @@ void func_80338BFC(Gfx **gfx, Mtx **mtx, void *arg2){ if(D_80383650){ if(D_8038371C){ - func_802519C8(&D_80383BF8, animMtxList_get(D_8038371C, cmd->unkA)); + mlMtx_push_multiplied_2(&D_80383BF8, animMtxList_get(D_8038371C, cmd->unkA)); func_8025235C(sp20, cmd->unkC); mlMtxPop(); } @@ -970,7 +970,7 @@ void func_80338EB8(Gfx ** gfx, Mtx ** mtx, void *arg2){ sp30 = (f32)cmd->unkE*modelRenderScale; if(D_8038371C){ - func_802519C8(&D_80383BF8, animMtxList_get(D_8038371C, cmd->unk12)); + mlMtx_push_multiplied_2(&D_80383BF8, animMtxList_get(D_8038371C, cmd->unk12)); func_8025235C(sp34, sp34); mlMtxPop(); } @@ -1034,8 +1034,8 @@ BKModelBin *modelRender_draw(Gfx **gfx, Mtx **mtx, f32 position[3], f32 rotation } D_80370990 = 0; - viewport_getPosition(modelRenderCameraPosition); - viewport_getRotation(modelRenderCameraRotation); + viewport_get_position_vec3f(modelRenderCameraPosition); + viewport_get_rotation_vec3f(modelRenderCameraRotation); if(D_80383758.unk18){ D_80383758.unk1C[0] = modelRenderCameraPosition[0]; D_80383758.unk1C[1] = modelRenderCameraPosition[1]; @@ -1075,8 +1075,8 @@ BKModelBin *modelRender_draw(Gfx **gfx, Mtx **mtx, f32 position[3], f32 rotation modelRenderCameraRotation[0] = D_80383758.unkC[0], modelRenderCameraRotation[1] = D_80383758.unkC[1], modelRenderCameraRotation[2] = D_80383758.unkC[2]; - viewport_setPosition(modelRenderCameraPosition); - viewport_setRotation(modelRenderCameraRotation); + viewport_set_position_vec3f(modelRenderCameraPosition); + viewport_set_rotation_vec3f(modelRenderCameraRotation); viewport_update(); camera_focus[0] = object_position[0] - modelRenderCameraPosition[0]; camera_focus[1] = object_position[1] - modelRenderCameraPosition[1]; @@ -1264,7 +1264,7 @@ BKModelBin *modelRender_draw(Gfx **gfx, Mtx **mtx, f32 position[3], f32 rotation } if(D_803837B0.unk0){ - mlMtxRotate(D_803837B0.unk4[0], D_803837B0.unk4[1], D_803837B0.unk4[2]); + mlMtxRotatePYR(D_803837B0.unk4[0], D_803837B0.unk4[1], D_803837B0.unk4[2]); } mlMtxGet(&D_80383BF8); @@ -1420,8 +1420,8 @@ void func_8033A28C(bool arg0){ void func_8033A298(bool arg0){ D_80383758.unk18 = arg0; if(arg0){ - viewport_getPosition(D_80383758.unk0); - viewport_getRotation(D_80383758.unkC); + viewport_get_position_vec3f(D_80383758.unk0); + viewport_get_rotation_vec3f(D_80383758.unkC); } } diff --git a/src/core2/nc/dynamicCamF.c b/src/core2/nc/dynamicCamF.c index df6c7be3..52453811 100644 --- a/src/core2/nc/dynamicCamF.c +++ b/src/core2/nc/dynamicCamF.c @@ -7,8 +7,8 @@ void ncDynamicCamF_init(void){ f32 sp24[3]; f32 sp12[3]; - viewport_getPosition(sp24); - viewport_getRotation(sp12); + viewport_get_position_vec3f(sp24); + viewport_get_rotation_vec3f(sp12); ncDynamicCamera_setPosition(sp24); ncDynamicCamera_setRotation(sp12); player_getPosition(__playerStartPosition); diff --git a/src/core2/nc/dynamicCamera.c b/src/core2/nc/dynamicCamera.c index 85c4120d..af64857f 100644 --- a/src/core2/nc/dynamicCamera.c +++ b/src/core2/nc/dynamicCamera.c @@ -212,8 +212,8 @@ void func_802BCBD4(void) { func_802C0120(); func_802C2258(); func_802C0F4C(); - viewport_getRotation(cameraRotation); - viewport_getPosition(cameraPosition); + viewport_get_rotation_vec3f(cameraRotation); + viewport_get_position_vec3f(cameraPosition); ml_vec3f_copy(D_8037D948, cameraPosition); ml_vec3f_clear(D_8037D9C8); ml_vec3f_clear(D_8037D9E0); @@ -366,8 +366,8 @@ void ncDynamicCamera_update(void){ if(dynamicCameraInFirstPerson){ ncFirstPersonCamera_getPositionAndRotation(sp24, sp18); } - viewport_setPosition(sp24); - viewport_setRotation(sp18); + viewport_set_position_vec3f(sp24); + viewport_set_rotation_vec3f(sp18); } int ncDynamicCamera_getState(void){ @@ -940,8 +940,8 @@ void func_802BE720(void){ f32 sp28[3]; f32 sp1C[3]; - viewport_getPosition(sp28); - viewport_getRotation(sp1C); + viewport_get_position_vec3f(sp28); + viewport_get_rotation_vec3f(sp1C); ncDynamicCamera_setPosition(sp28); ncDynamicCamera_setRotation(sp1C); @@ -961,8 +961,8 @@ void func_802BE794(void){ sp2C[1] += 100.0f; player_getRotation(sp20); sp20[1] = mlNormalizeAngle(sp20[1] + 180.0f); - viewport_setPosition(sp2C); - viewport_setRotation(sp20); + viewport_set_position_vec3f(sp2C); + viewport_set_rotation_vec3f(sp20); func_8024C510(300.0f); func_802BE720(); }//L802BE828 diff --git a/src/core2/nc/randomCamera.c b/src/core2/nc/randomCamera.c index 19df9e44..1cfdeaea 100644 --- a/src/core2/nc/randomCamera.c +++ b/src/core2/nc/randomCamera.c @@ -15,8 +15,8 @@ void ncRandomCamera_init(void) { s32 sp24[3]; s32 sp18[3]; - viewport_getPosition(D_8037DA50.storedPosition); - viewport_getRotation(D_8037DA50.storedRotation); + viewport_get_position_vec3f(D_8037DA50.storedPosition); + viewport_get_rotation_vec3f(D_8037DA50.storedRotation); mapModel_getBounds(sp24, sp18); D_8037DA50.minPosition[0] = (f32) sp24[0]; @@ -30,8 +30,8 @@ void ncRandomCamera_init(void) { void ncRandomCamera_end(void){ - viewport_setPosition(D_8037DA50.storedPosition); - viewport_setRotation(D_8037DA50.storedRotation); + viewport_set_position_vec3f(D_8037DA50.storedPosition); + viewport_set_rotation_vec3f(D_8037DA50.storedRotation); } void ncRandomCamera_update(void) { @@ -45,6 +45,6 @@ void ncRandomCamera_update(void) { sp18[0] = randf2(-90.0f, 90.0f);\ sp18[1] = randf2(0.0f, 360.0f);\ sp18[2] = 0.0f; - viewport_setPosition(sp24); - viewport_setRotation(sp18); + viewport_set_position_vec3f(sp24); + viewport_set_rotation_vec3f(sp18); } diff --git a/src/core2/nc/staticCamera.c b/src/core2/nc/staticCamera.c index 574e22dc..e6a09f0e 100644 --- a/src/core2/nc/staticCamera.c +++ b/src/core2/nc/staticCamera.c @@ -33,8 +33,8 @@ void ncStaticCamera_setPosition(f32 arg0[3]){ } void ncStaticCamera_update(void){ - viewport_setPosition(ncStaticCameraPosition); - viewport_setRotation(ncStaticCameraRotation); + viewport_set_position_vec3f(ncStaticCameraPosition); + viewport_set_rotation_vec3f(ncStaticCameraRotation); } void __ncStaticCamera_setToNode(s32 camera_node_index){ diff --git a/src/core2/quizquestionaskedbitfield.c b/src/core2/quizquestionaskedbitfield.c index 14afb931..12fcdc41 100644 --- a/src/core2/quizquestionaskedbitfield.c +++ b/src/core2/quizquestionaskedbitfield.c @@ -9,7 +9,7 @@ u8* quizQuestionAskedBitfield; /* .code */ bool quizQuestionAskedBitfield_get(s32 index){ - return func_803200A4(quizQuestionAskedBitfield, index); + return bitfield_get_bit(quizQuestionAskedBitfield, index); } void quizQuestionAskedBitfield_free(void){ diff --git a/src/cutscenes/bss_pad.c b/src/cutscenes/bss_pad.c index 460ab074..e704b74e 100644 --- a/src/cutscenes/bss_pad.c +++ b/src/cutscenes/bss_pad.c @@ -1 +1 @@ -char pad_cutscenes_8038E9E0[0x10]; \ No newline at end of file +char pad_cutscenes_8038E9E0[0x10]; diff --git a/src/fight/chbossjinjo.c b/src/fight/chbossjinjo.c index 717c9549..1a7474ac 100644 --- a/src/fight/chbossjinjo.c +++ b/src/fight/chbossjinjo.c @@ -4,7 +4,7 @@ #include "core2/particle.h" -extern void viewport_getPosition(f32 (*)[3]); +extern void viewport_get_position_vec3f(f32 (*)[3]); extern void subaddie_set_state_with_direction(Actor *, s32, f32, s32); extern void func_80386654(f32 arg0, f32 (*arg1)[4], f32 (*arg2)[4]); extern void func_80324CFC(f32, enum comusic_e, s32); @@ -324,7 +324,7 @@ void func_8038CED8(f32 arg0[3], enum asset_e model_id, f32 arg2, f32 arg3){ f32 sp40[3]; f32 sp34[3]; - viewport_getPosition(&sp40); + viewport_get_position_vec3f(&sp40); sp34[0] = sp40[0] - arg0[0]; sp34[1] = sp40[1] - arg0[1]; diff --git a/symbol_addrs.us.v10.txt b/symbol_addrs.us.v10.txt index 1f655e20..6144285e 100644 --- a/symbol_addrs.us.v10.txt +++ b/symbol_addrs.us.v10.txt @@ -89,7 +89,7 @@ mapSavestate_apply = 0x802E30AC; getGameMode = 0x802E49FC; vtxList_getVertices = 0x802EC450; cube_atIndices = 0x80303384; -gctransition_8030BD98 = 0x8030BD98; +gctransition_done = 0x8030BD98; gcdialog_setState = 0x8030F488; gcdialog_update = 0x8030F990; gczoombox_update = 0x80316EF4; From ee5847f5f1e9cdf49e4fff58b65cf10435c43061 Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Sun, 7 Jul 2024 19:57:19 -0500 Subject: [PATCH 15/38] asm preprocessor update --- include/macro.inc | 4 ++++ include/prelude.s | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/include/macro.inc b/include/macro.inc index e1048cf1..6d60e311 100644 --- a/include/macro.inc +++ b/include/macro.inc @@ -16,6 +16,10 @@ \label: .endm +.macro jlabel label + \label: +.endm + .macro endlabel label .end \label .endm diff --git a/include/prelude.s b/include/prelude.s index 216bf780..5144efa8 100644 --- a/include/prelude.s +++ b/include/prelude.s @@ -11,5 +11,9 @@ \label: .endm +.macro jlabel label + \label: +.endm + .macro endlabel label .endm \ No newline at end of file From 05784992951a1fd2e53a33c6b05bdda1b5099d3c Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Sun, 7 Jul 2024 20:02:35 -0500 Subject: [PATCH 16/38] add non-matching functions --- asm/core1/code_1E820.s | 57 -------------------------- src/core2/code_98CB0.c | 91 +++++++++++++++++++++++------------------- src/core2/code_B9770.c | 71 ++++++++++++++++++++++++++++++++ 3 files changed, 121 insertions(+), 98 deletions(-) delete mode 100644 asm/core1/code_1E820.s diff --git a/asm/core1/code_1E820.s b/asm/core1/code_1E820.s deleted file mode 100644 index 0b10453e..00000000 --- a/asm/core1/code_1E820.s +++ /dev/null @@ -1,57 +0,0 @@ -.include "macro.inc" - -/* assembler directives */ -.set noat /* allow manual use of $at */ -.set noreorder /* don't insert nops after branches */ -.set gp=64 /* allow use of 64-bit general purpose registers */ - -.section .text, "ax" - -glabel func_8025C240 -/* F37A70 8025C240 3C048027 */ lui $a0, %hi(D_80276E70) -/* F37A74 8025C244 DC846E70 */ ld $a0, %lo(D_80276E70)($a0) -/* F37A78 8025C248 3C018027 */ lui $at, %hi(D_80276E70) -/* F37A7C 8025C24C 000437FC */ dsll32 $a2, $a0, 31 -/* F37A80 8025C250 00042FF8 */ dsll $a1, $a0, 31 -/* F37A84 8025C254 000637FA */ dsrl $a2, $a2, 31 -/* F37A88 8025C258 0005283E */ dsrl32 $a1, $a1, 0 -/* F37A8C 8025C25C 0004233C */ dsll32 $a0, $a0, 12 -/* F37A90 8025C260 00C53025 */ or $a2, $a2, $a1 -/* F37A94 8025C264 0004203E */ dsrl32 $a0, $a0, 0 -/* F37A98 8025C268 00C43026 */ xor $a2, $a2, $a0 -/* F37A9C 8025C26C 0006253A */ dsrl $a0, $a2, 20 -/* F37AA0 8025C270 30840FFF */ andi $a0, $a0, 0xFFF -/* F37AA4 8025C274 00862026 */ xor $a0, $a0, $a2 -/* F37AA8 8025C278 0004103C */ dsll32 $v0, $a0, 0 -/* F37AAC 8025C27C FC246E70 */ sd $a0, %lo(D_80276E70)($at) -/* F37AB0 8025C280 03E00008 */ jr $ra -/* F37AB4 8025C284 0002103F */ dsra32 $v0, $v0, 0 -endlabel func_8025C240 - -glabel func_8025C288 -/* F37AB8 8025C288 64840001 */ daddiu $a0, $a0, 0x1 -/* F37ABC 8025C28C 3C018027 */ lui $at, %hi(D_80276E70) -/* F37AC0 8025C290 FC246E70 */ sd $a0, %lo(D_80276E70)($at) -/* F37AC4 8025C294 03E00008 */ jr $ra -/* F37AC8 8025C298 24040000 */ addiu $a0, $zero, 0x0 -endlabel func_8025C288 - -glabel func_8025C29C -/* F37ACC 8025C29C DC870000 */ ld $a3, 0x0($a0) -/* F37AD0 8025C2A0 000737FC */ dsll32 $a2, $a3, 31 -/* F37AD4 8025C2A4 00072FF8 */ dsll $a1, $a3, 31 -/* F37AD8 8025C2A8 000637FA */ dsrl $a2, $a2, 31 -/* F37ADC 8025C2AC 0005283E */ dsrl32 $a1, $a1, 0 -/* F37AE0 8025C2B0 00073B3C */ dsll32 $a3, $a3, 12 -/* F37AE4 8025C2B4 00C53025 */ or $a2, $a2, $a1 -/* F37AE8 8025C2B8 0007383E */ dsrl32 $a3, $a3, 0 -/* F37AEC 8025C2BC 00C73026 */ xor $a2, $a2, $a3 -/* F37AF0 8025C2C0 00063D3A */ dsrl $a3, $a2, 20 -/* F37AF4 8025C2C4 30E70FFF */ andi $a3, $a3, 0xFFF -/* F37AF8 8025C2C8 00E63826 */ xor $a3, $a3, $a2 -/* F37AFC 8025C2CC 0007103C */ dsll32 $v0, $a3, 0 -/* F37B00 8025C2D0 FC870000 */ sd $a3, 0x0($a0) -/* F37B04 8025C2D4 03E00008 */ jr $ra -/* F37B08 8025C2D8 0002103F */ dsra32 $v0, $v0, 0 -/* F37B0C 8025C2DC 00000000 */ nop -endlabel func_8025C29C diff --git a/src/core2/code_98CB0.c b/src/core2/code_98CB0.c index 1a8a0013..21e5e79f 100644 --- a/src/core2/code_98CB0.c +++ b/src/core2/code_98CB0.c @@ -41,49 +41,58 @@ u8 D_803831F8[0x21]; //copy of D_803831D0 /* .code */ +#ifndef NONMATCHING #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_98CB0/func_8031FC40.s") -// void func_8031FC40(void) { -// s32 scrambled_ptr; -// s32 temp_a1; -// s32 temp_lo; -// s32 temp_t0; -// s32 temp_t1; -// s32 temp_t6; -// s32 temp_t9; -// s32 var_a0; -// s32 var_t3; -// u32 var_v0; -// u32 var_v1; -// u8 temp_a3; +#else +void func_8031FC40(void) { + s32 scrambled_ptr; + s32 *unscrambled_ptr; + s32 temp_a1; + s32 temp_lo; + s32 temp_t0; + s32 temp_t1; + s32 temp_a2; + s32 temp_t9; + s32 var_a0; + u8* b_ptr; + s32 var_t3; + u32 var_v0 = 0x17536C34; + u32 var_v1 = 0; + + //obsucre address + temp_t0 = (((s32)&D_803831A0.unk8 & 0xE0000000) >> 15) + + (((s32)&D_803831A0.unk8 & 0x1FC00000) >> 22) + + (((s32)&D_803831A0.unk8 & 0x00300000) << 10) + + (((s32)&D_803831A0.unk8 & 0x000F0000) << 7) + + (((s32)&D_803831A0.unk8 & 0x0000E000) << 14) + + (((s32)&D_803831A0.unk8 & 0x00001800) >> 4) + + (((s32)&D_803831A0.unk8 & 0x00000780) << 10) + + (((s32)&D_803831A0.unk8 & 0x00000060) << 4) + + (((s32)&D_803831A0.unk8 & 0x00000018) << 18) + + (((s32)&D_803831A0.unk8 & 0x00000007) << 11); + + //unobscure address + temp_t9 = (temp_t0 & 0x38000000) / (1 << 24); + temp_t1 = ((temp_t0 & 0x1E0600) << 0xB) | ((s32) (temp_t0 & 0x603800) / 8); + temp_a1 = (((temp_t0 & 0x1C07F) << 0xF) + ((u32) (temp_t0 & 0xC7800000) >> 0x11)) | (temp_t9 + ((s32) (temp_t0 & 0x180) >> 6)); \ + var_a0 = ((temp_a1 & 0x3FE000) << 7) + | (((temp_t1 >> 8) & 7) + ((temp_a1 << 0xA) & 0xFF800)) + | ((((u32) (temp_t1 & 0xF0000000) >> 0x15) + (temp_a1 & 0xE0000000)) ^ ((s32) ((temp_t1 /0x40) & 0xF000) >> 9)); + + //calculate checksum + temp_a1 = 0x25; + for(var_v1 = 0; var_v1 < temp_a1; var_v1++){ + b_ptr = (u8*)(var_a0 + var_v1); + var_v0 = (((var_v0 - *b_ptr) & 0x1F) << 0xF) ^ ((*b_ptr* 0x1B) + (var_v0 >> 0xB)); + } + + scrambled_ptr = (((s32) &D_803831A0 & 0x55555555) * 2) + ((u32) ((s32) &D_803831A0 & 0xAAAAAAAA) >> 1); + unscrambled_ptr = (((scrambled_ptr & 0x55555555) * 2) | ((u32) (scrambled_ptr & 0xAAAAAAAA) >> 1)); + *unscrambled_ptr = var_v0; + if(!var_a0); +} +#endif -// temp_t0 = (((s32) &D_803831A0.unk8 & 0xE0000000) >> 0xF) -// + (((s32) &D_803831A0.unk8 & 0x1FC00000) >> 0x16) -// + (((s32) &D_803831A0.unk8 & 0x300000) << 0xA) -// + (((s32) &D_803831A0.unk8 & 0xF0000) << 7) -// + (((s32) &D_803831A0.unk8 & 0xE000) << 0xE) -// + (((s32) &D_803831A0.unk8 & 0x1800) >> 4) -// + (((s32) &D_803831A0.unk8 & 0x780) << 0xA) -// + (((s32) &D_803831A0.unk8 & 0x60) << 4) -// + (((s32) &D_803831A0.unk8 & 0x18) << 0x12) -// + (((s32) &D_803831A0.unk8 & 7) << 0xB); -// temp_t9 = (temp_t0 & 0x38000000); -// var_v0 = 0x17536C34; -// var_t3 = temp_t9 >> 0x18; -// if (temp_t9 < 0) { -// var_t3 = (s32) (0xFFFFFF + temp_t9) >> 0x18; -// } -// temp_a1 = (((temp_t0 & 0x1C07F) << 0xF) + ((u32) (temp_t0 & 0xC7800000) >> 0x11)) | (var_t3 + ((s32) (temp_t0 & 0x180) >> 6)); -// temp_t1 = ((temp_t0 & 0x1E0600) << 0xB) | ((s32) (temp_t0 & 0x603800) >> 3); -// var_a0 = ((temp_a1 & 0x3FE000) << 7) -// | (((temp_t1 >> 8) & 7) + ((temp_a1 << 0xA) & 0xFF800)) -// | ((((u32) (temp_t1 & 0xF0000000) >> 0x15) + (temp_a1 & 0xE0000000)) ^ ((s32) ((temp_t1 >> 6) & 0xF000) >> 9)); -// for(var_v1 = 0; var_v1 < 0x25; var_v1++){ -// u8 byte = *(u8*)(var_a0 + var_v1); -// var_v0 = ((byte * 0x1B) + (var_v0 >> 0xB)) ^ (((var_v0 - byte) & 0x1F) << 0xF); -// } -// scrambled_ptr = (((s32) &D_803831A0 & 0x55555555) * 2) + ((u32) ((s32) &D_803831A0 & 0xAAAAAAAA) >> 1); -// *(s32 *)(((scrambled_ptr & 0x55555555) * 2) | ((u32) (scrambled_ptr & 0xAAAAAAAA) >> 1)) = var_v0; -// } u32 func_8031FE40(void) { diff --git a/src/core2/code_B9770.c b/src/core2/code_B9770.c index 7d550971..ccf3d0af 100644 --- a/src/core2/code_B9770.c +++ b/src/core2/code_B9770.c @@ -260,8 +260,79 @@ f32 glspline_catmull_rom_interpolate(f32 x, s32 knotCount, f32 *knotList) { return (((((sp24[2] * x) + sp24[1]) * x) + sp24[0]) * x) + (1.0*knotList[1]); } +#ifndef NONMATCHING void func_80340BE4(f32 arg0, s32 arg1, s32 arg2, s32 arg3, f32 * arg4, f32 arg5[3]); #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B9770/func_80340BE4.s") +#else +void func_80340BE4(f32 x, s32 length, s32 stride, s32 width, f32 *arg4, f32 *dst){ + s32 spD0; + s32 max_interval; + s32 i; + s32 var_a3; + f32 temp_f2; + f32 f3; + f32 f1; + f32 f2; + f32 sp94[3][3]; + + max_interval = length - 1; + if (length < 4) { + /* not enough points in spline to perform catmull-rom interpolation*/ + ml_vec3f_copy(sp94[0], arg4); + ml_vec3f_copy(sp94[1], arg4); + ml_vec3f_copy(sp94[2], arg4 + stride); + if (length - 1 == 1) { + ml_vec3f_copy(sp94[3], arg4 + stride); + } else { + ml_vec3f_copy(sp94[3], arg4 + 2*stride); + } + func_80340BE4(x, 4, 3, 3, sp94, dst); + return; + } + + temp_f2 = func_80340700(x, 0.0f, 1.0f) * max_interval; + var_a3 = (s32)temp_f2; + var_a3 = ((length - 1) < var_a3) ? (length - 1) : var_a3; + x = temp_f2 - (f32) var_a3; + if (0 == var_a3) { + /* desired point in interval[0,1], duplicate P0 to left */ + arg4 = arg4 + 0; + for(var_a3 = var_a3; var_a3 < width; var_a3++){ + f3 = -0.5*arg4[var_a3] + 1.5*arg4[var_a3] + -1.5*arg4[stride + var_a3] + 0.5*arg4[2*stride + var_a3]; + f1 = 1.0*arg4[var_a3] + -2.5*arg4[var_a3] + 2.0*arg4[stride + var_a3] + -0.5*arg4[2*stride + var_a3]; + f2 = -0.5*arg4[var_a3] + 0.0*arg4[var_a3] + 0.5*arg4[stride + var_a3] + 0.0*arg4[2*stride + var_a3]; + dst[var_a3] = ((((f3 * x) + f1)* x + f2) * x) + (1.0*arg4[var_a3]); + } + return; + } + spD0 = var_a3 - 1; + if (length == (var_a3 + 1)) { + arg4 = arg4 + spD0*stride; + for(var_a3 = 0; var_a3 < width; var_a3++){ + /* desired point in interval[n, inf], linearly interpret */ + dst[var_a3] = arg4[var_a3]; + } + } else if (length == (spD0 + 2)) { + /* desired point in interval[n-1, n], duplicate Pn to right */ + for(var_a3 = 0; var_a3 < width; var_a3++){ + f3 = -0.5*arg4[spD0*stride + var_a3] + 1.5*arg4[(spD0 + 1)* stride + var_a3] + -1.5*arg4[(spD0 + 2)* stride + var_a3] + 0.5*arg4[(spD0 + 2)* stride + var_a3]; + f1 = 1.0*arg4[spD0*stride + var_a3] + -2.5*arg4[(spD0 + 1)* stride + var_a3] + 2.0*arg4[(spD0 + 2)* stride + var_a3] + -0.5*arg4[(spD0 + 2)* stride + var_a3]; + f2 = -0.5*arg4[spD0*stride + var_a3] + 0.0*arg4[(spD0 + 1)* stride + var_a3] + 0.5*arg4[(spD0 + 2)* stride + var_a3] + 0.0*arg4[(spD0 + 2)* stride + var_a3]; + dst[var_a3] = ((((f3 * x) + f1)* x + f2) * x) + (1.0*arg4[((spD0 + 1) * stride) + var_a3]); + } + } else { + /* normal conditions */ + for(var_a3 = 0; var_a3 < width; var_a3++){ + f3 = -0.5*arg4[spD0*stride + var_a3] + 1.5*arg4[(spD0 + 1)*stride + var_a3] + -1.5*arg4[(spD0 + 2)* stride + var_a3] + 0.5*arg4[(spD0 + 3)* stride + var_a3]; + f1 = 1.0*arg4[spD0*stride + var_a3] + -2.5*arg4[(spD0 + 1)*stride + var_a3] + 2.0*arg4[(spD0 + 2)* stride + var_a3] + -0.5*arg4[(spD0 + 3)* stride + var_a3]; + f2 = -0.5*arg4[spD0*stride + var_a3] + 0.0*arg4[(spD0 + 1)*stride + var_a3] + 0.5*arg4[(spD0 + 2)* stride + var_a3] + 0.0*arg4[(spD0 + 3)* stride + var_a3]; + // var_f8 = + dst[var_a3] = ((((f3 * x) + f1)* x + f2) * x) + (1.0*arg4[(spD0 + 1)*stride + var_a3]); + } + } + +} +#endif void func_80341180(f32 arg0, s32 arg1, s32 arg2, f32 arg3[3], f32 arg4[3]){ func_80340BE4(arg0, arg1, arg2, arg2, arg3, arg4); From 4712748d9f22e28edb62073e6d0edcae913c73b8 Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Fri, 12 Jul 2024 17:19:27 -0500 Subject: [PATCH 17/38] rand_seed document --- include/structs.h | 2 +- src/core1/code_1BE90.c | 125 +++++++++++++++++++----------------- src/core1/code_EAF0.c | 58 ++++++++--------- src/core2/ba/marker.c | 2 +- src/core2/ch/bottlesbonus.c | 4 +- src/core2/code_5C870.c | 18 +++--- src/core2/code_AD5B0.c | 6 +- src/core2/code_C2F30.c | 2 +- src/core2/gc/sky.c | 4 +- src/core2/gc/transition.c | 4 +- src/core2/gc/zoombox.c | 8 +-- src/core2/rand.c | 39 ++++++++--- src/fight/chbossjinjo.c | 2 +- src/lair/ch/brentilda.c | 2 +- src/lair/code_86F0.c | 4 +- 15 files changed, 156 insertions(+), 124 deletions(-) diff --git a/include/structs.h b/include/structs.h index 023b0166..b38fb70a 100644 --- a/include/structs.h +++ b/include/structs.h @@ -251,7 +251,7 @@ typedef struct struct_11_s{ f32 unk4; s32 unk8; s32 unkC; - s16 unk10; //trackId + s16 track_id; //trackId s16 unk12; u8 unk14; u8 unk15; diff --git a/src/core1/code_1BE90.c b/src/core1/code_1BE90.c index 65331693..be7cb5f5 100644 --- a/src/core1/code_1BE90.c +++ b/src/core1/code_1BE90.c @@ -24,17 +24,24 @@ CoMusic *D_80276E30 = NULL; //active track ptr int D_80276E34 = 0; /* .code */ -CoMusic *func_802598B0(enum comusic_e track_id) { +/** + * @brief returns a pointer to the CoMusic struct with the corresponding track_id + * if it exists OR the first free CoMusic struct. + * + * @param track_id + * @return CoMusic* + */ +CoMusic *__find_track(enum comusic_e track_id) { CoMusic *iMusPtr; CoMusic *freeSlotPtr; freeSlotPtr = NULL; for(iMusPtr = D_80276E30 + 1; iMusPtr < D_80276E30 + 5; iMusPtr++) { - if (track_id == iMusPtr->unk10) { + if (track_id == iMusPtr->track_id) { return iMusPtr; } if (freeSlotPtr == 0) { - if ((s32) iMusPtr->unk10 < 0) { + if ((s32) iMusPtr->track_id < 0) { freeSlotPtr = iMusPtr; } } @@ -61,8 +68,8 @@ void func_80259994(CoMusic *this, s32 arg1){ } void func_802599B4(CoMusic *this){ - func_80259994(this, func_80250034(this->unk10)); - this->unk10 = -1; + func_80259994(this, func_80250034(this->track_id)); + this->track_id = -1; this->unk14 = 0; this->unk15 = 0; func_8024FC1C(this - D_80276E30, -1); @@ -77,7 +84,7 @@ void comusicPlayer_init(void){ D_80276E30 = (CoMusic *) malloc(6*sizeof(CoMusic)); for(iPtr = D_80276E30; iPtr < D_80276E30 + 6; iPtr++){ - iPtr->unk10 = -1; + iPtr->track_id = -1; iPtr->unk8 = 0; iPtr->unk12 = 0; iPtr->unkC = 0; @@ -105,12 +112,11 @@ void comusicPlayer_free(void){ D_80276E30 = NULL; } -//comusic_count -s32 func_80259B8C(void){ +s32 comusic_active_track_count(void){ CoMusic * iPtr; s32 cnt = 0; for(iPtr = D_80276E30; iPtr < D_80276E30 + 6; iPtr++){ - if(iPtr->unk10 >= 0) + if(iPtr->track_id >= 0) cnt++; } return cnt; @@ -124,11 +130,11 @@ void comusicPlayer_update(void) { dt = time_getDelta(); for(var_s0 = D_80276E30; var_s0 < &D_80276E30[6]; var_s0++){ - if (var_s0->unk10 >= 0) { + if (var_s0->track_id >= 0) { temp_lo = var_s0 - D_80276E30; var_s0->unk4 = ml_min_f(var_s0->unk4 + dt, 600.0f); if ((var_s0->unk4 > 1.0f) && func_80250074(temp_lo)) { - func_8025A7DC(var_s0->unk10); + func_8025A7DC(var_s0->track_id); } } } @@ -138,7 +144,7 @@ void comusicPlayer_update(void) { D_80276E34 = FALSE; for(var_s0 = D_80276E30; var_s0 < &D_80276E30[6]; var_s0++){ - if (var_s0->unk10 >= 0) { + if (var_s0->track_id >= 0) { if (var_s0->unk12 != 0) { temp_lo = var_s0 - D_80276E30; if (var_s0->unk0 > 0.0f) { @@ -212,8 +218,8 @@ void func_80259F7C(CoMusic *self, s32 *arg1, s32 *arg2, s32 *arg3) { if (var_s2 < 0) { temp_v0 = (struct12s *)freelist_at(self->unk18, 1); - if (temp_v0->unk0 < func_80250034(self->unk10)) { - var_s2 = func_80250034(self->unk10); + if (temp_v0->unk0 < func_80250034(self->track_id)) { + var_s2 = func_80250034(self->track_id); } else{ var_s2 = temp_v0->unk0; @@ -245,11 +251,11 @@ void func_80259F7C(CoMusic *self, s32 *arg1, s32 *arg2, s32 *arg3) { } void func_8025A104(enum comusic_e arg0, s32 arg1){ - if (arg0 != D_80276E30[0].unk10){ + if (arg0 != D_80276E30[0].track_id){ func_8024FC1C(0, arg0); } func_8024FD28(0, (s16)arg1); - D_80276E30[0].unk10 = (s16) arg0; + D_80276E30[0].track_id = (s16) arg0; D_80276E30[0].unk8 = arg1; D_80276E30[0].unk0 = 0.0f; D_80276E30[0].unk12 = 0; @@ -260,9 +266,9 @@ void func_8025A104(enum comusic_e arg0, s32 arg1){ void func_8025A1A8(enum comusic_e arg0){ - if (arg0 != D_80276E30[0].unk10){ + if (arg0 != D_80276E30[0].track_id){ func_8024FC1C(0, arg0); - D_80276E30[0].unk10 = (s16) arg0; + D_80276E30[0].track_id = (s16) arg0; D_80276E30[0].unk8 = func_80250034(arg0); D_80276E30[0].unk0 = 0.0f; D_80276E30[0].unk12 = 0; @@ -276,9 +282,9 @@ void func_8025A23C(s32 arg0){ CoMusic *music = &D_80276E30[5]; s32 temp_v0; - if (arg0 != music->unk10){ + if (arg0 != music->track_id){ func_8024FC1C(5, arg0); - music->unk10 = (s16) arg0; + music->track_id = (s16) arg0; temp_v0 = func_80250034(arg0); music->unk8 = temp_v0; music->unk12 = 0; @@ -302,7 +308,7 @@ void func_8025A2FC(s32 arg0, s32 arg1){ func_8025A55C(arg0, arg1, 1); for (i = 1; i < 5; i++){ - s16 val = (i + D_80276E30)->unk10; // Doesn't match with D_80276E30[i] + s16 val = (i + D_80276E30)->track_id; // Doesn't match with D_80276E30[i] if (val >= 0){ func_8025ABB8(val, arg0, arg1, 1); } @@ -317,8 +323,8 @@ void func_8025A388(s32 arg0, s32 arg1) { } for (i = 1; i < 5; i++){ CoMusic *current = (i + D_80276E30); // Doesn't match with D_80276E30[i] - if (current->unk10 >= 0 && current->unk14 == 0){ - func_8025ABB8(current->unk10, arg0, arg1, 1); + if (current->track_id >= 0 && current->unk14 == 0){ + func_8025ABB8(current->track_id, arg0, arg1, 1); } } } @@ -328,7 +334,7 @@ void func_8025A430(s32 arg0, s32 arg1, s32 arg2){ func_8025A55C(arg0, arg1, arg2); for (i = 1; i < 5; i++){ - s16 val = (i + D_80276E30)->unk10; // Doesn't match with D_80276E30[i] + s16 val = (i + D_80276E30)->track_id; // Doesn't match with D_80276E30[i] if (val >= 0){ func_8025ABB8(val, arg0, arg1, arg2); } @@ -336,7 +342,7 @@ void func_8025A430(s32 arg0, s32 arg1, s32 arg2){ } void func_8025A4C4(s32 arg0, s32 arg1, s32 *arg2){ - if(D_80276E30[0].unk10 >= 0){ + if(D_80276E30[0].track_id >= 0){ func_80259F7C(&D_80276E30[0], &arg0, &arg1, arg2); if(arg0 != D_80276E30[0].unk8){ if(D_80276E30[0].unk8 < arg0){ @@ -368,21 +374,22 @@ void func_8025A5AC(enum comusic_e comusic_id, s32 arg1, s32 arg2){ arg1 = func_80250034(comusic_id); } - tmp_a2 = func_802598B0(comusic_id); + tmp_a2 = __find_track(comusic_id); if(tmp_a2 == NULL) return; sp20 = (tmp_a2 - D_80276E30); - if(tmp_a2->unk10 < 0 || arg2){ + if(tmp_a2->track_id < 0 || arg2){ switch(comusic_id){ case COMUSIC_15_EXTRA_LIFE_COLLECTED: - if(map_get() != MAP_10_BGS_MR_VILE){ + if(map_get() == MAP_10_BGS_MR_VILE){ + break; + } case COMUSIC_3B_MINIGAME_VICTORY: case COMUSIC_3C_MINIGAME_LOSS: - func_8025AE50(4000, 2.0f); - }//L8025A668 + func_8025AE50(4000, 2.0f); } - tmp_a2->unk10 = comusic_id; + tmp_a2->track_id = comusic_id; tmp_a2->unk12 = 0; tmp_a2->unk15 = 0; tmp_a2->unk4 = 0.0f; @@ -407,13 +414,13 @@ void func_8025A70C(enum comusic_e track_id){ CoMusic *trackPtr; s32 indx; - trackPtr = func_802598B0(track_id); + trackPtr = __find_track(track_id); if(trackPtr == NULL) return; indx = trackPtr - D_80276E30; - if(trackPtr->unk10 < 0){ - trackPtr->unk10 = track_id; + if(trackPtr->track_id < 0){ + trackPtr->track_id = track_id; trackPtr->unk12 = 0; trackPtr->unk4 = 0.0f; func_8024FC1C( indx, track_id); @@ -430,8 +437,8 @@ void func_8025A788(enum comusic_e comusic_id, f32 delay1, f32 delay2){ void func_8025A7DC(enum comusic_e track_id){ CoMusic *trackPtr; - trackPtr = func_802598B0(track_id); - if (trackPtr != NULL && trackPtr->unk10 >= 0){ + trackPtr = __find_track(track_id); + if (trackPtr != NULL && trackPtr->track_id >= 0){ func_802599B4(trackPtr); } } @@ -447,7 +454,7 @@ s32 func_8025A818(void){ s32 func_8025A864(enum comusic_e track_id){ CoMusic *trackPtr; - trackPtr = func_802598B0(track_id); + trackPtr = __find_track(track_id); if (trackPtr != NULL && trackPtr->unkC == 0 && trackPtr->unk8 <= 0){ func_802599B4(trackPtr); return 1; @@ -458,14 +465,14 @@ s32 func_8025A864(enum comusic_e track_id){ void func_8025A8B8(enum comusic_e track_id, s32 arg1){ CoMusic *trackPtr; - trackPtr = func_802598B0(track_id); + trackPtr = __find_track(track_id); if (trackPtr != NULL){ trackPtr->unk14 = arg1; } } void func_8025A8E4(s32 arg0) { - if (D_80276E30[0].unk10 >= 0) { + if (D_80276E30[0].track_id >= 0) { D_80276E30[0].unk14 = arg0; } } @@ -474,7 +481,7 @@ void func_8025A904(void){ CoMusic *trackPtr = &D_80276E30[0]; while (trackPtr < &D_80276E30[6]){ - if (trackPtr->unk10 >= 0){ + if (trackPtr->track_id >= 0){ func_802599B4(trackPtr); } trackPtr++; @@ -486,7 +493,7 @@ void func_8025A96C(void){ CoMusic *iPtr; for(iPtr = &D_80276E30[1]; iPtr < &D_80276E30[6]; iPtr++){ - if(iPtr->unk10 >= 0){ + if(iPtr->track_id >= 0){ func_802599B4(iPtr); } } @@ -497,7 +504,7 @@ void func_8025A9D4(void){ CoMusic *iPtr; for(iPtr = &D_80276E30[0]; iPtr < &D_80276E30[6]; iPtr++){ - if(iPtr->unk10 >= 0 && !iPtr->unk14){ + if(iPtr->track_id >= 0 && !iPtr->unk14){ func_802599B4(iPtr); } } @@ -508,7 +515,7 @@ void func_8025AA48(void){ CoMusic *iPtr; for(iPtr = &D_80276E30[1]; iPtr < &D_80276E30[6]; iPtr++){ - if(iPtr->unk10 >= 0 && !iPtr->unk14){ + if(iPtr->track_id >= 0 && !iPtr->unk14){ func_802599B4(iPtr); } } @@ -518,7 +525,7 @@ void func_8025AA48(void){ void func_8025AABC(enum comusic_e track_id){ CoMusic *trackPtr; - if(trackPtr = func_802598B0(track_id)){ + if(trackPtr = __find_track(track_id)){ trackPtr->unk15 = 1; if(!trackPtr->unk8) func_802599B4(trackPtr); @@ -541,32 +548,34 @@ void comusic_8025AB78(enum comusic_e comusic_id, s32 arg1, s32 arg2, s32 arg3){ } void func_8025ABB8(enum comusic_e comusic_id, s32 arg1, s32 arg2, s32 arg3){ - func_8025AC7C(comusic_id, arg1, arg2, 0.0f, (s32)&(func_802598B0(comusic_id)->unk1C[arg3]), "comusic.c", 0x3aa); + func_8025AC7C(comusic_id, arg1, arg2, 0.0f, (s32)&(__find_track(comusic_id)->unk1C[arg3]), "comusic.c", 0x3aa); } void func_8025AC20(enum comusic_e comusic_id, s32 arg1, s32 arg2, f32 arg3, char* arg4, s32 char5){ - func_8025AC7C(comusic_id, arg1, arg2, 0.0f, (s32) func_802598B0(comusic_id)->unk1C, "comusic.c", 0x3b1); + func_8025AC7C(comusic_id, arg1, arg2, 0.0f, (s32) __find_track(comusic_id)->unk1C, "comusic.c", 0x3b1); } void func_8025AC7C(enum comusic_e comusic_id, s32 arg1, s32 arg2, f32 arg3, s32 arg4, char* arg5, s32 arg6){ CoMusic *trackPtr; - u32 sp24; + u32 slot_index; - trackPtr = func_802598B0(comusic_id); + //get track location + trackPtr = __find_track(comusic_id); if(trackPtr == NULL) return; - if(trackPtr->unk10 < 0){ //Track not ready + //check if track is loaded in slot + if(trackPtr->track_id < 0){ //Track not loaded if(arg1 == 0) return; - sp24 = (trackPtr - D_80276E30); - func_8024FC1C(sp24, comusic_id); - trackPtr->unk10 = comusic_id; + slot_index = (trackPtr - D_80276E30); + func_8024FC1C(slot_index, comusic_id); + trackPtr->track_id = comusic_id; trackPtr->unk8 = 0; trackPtr->unk15 = 0; trackPtr->unk4 = 0.0f; func_80259994(trackPtr, 0); - func_8024FD28(sp24, 0); + func_8024FD28(slot_index, 0); } func_80259F7C(trackPtr,&arg1, &arg2, arg4); trackPtr->unk0 = arg3; @@ -578,17 +587,17 @@ void func_8025AC7C(enum comusic_e comusic_id, s32 arg1, s32 arg2, f32 arg3, s32 //comusic_trackQueued int func_8025AD7C(enum comusic_e arg0){ - CoMusic * trackPtr = func_802598B0(arg0); - return (trackPtr == NULL || trackPtr->unk10 == -1)? 0 : 1; + CoMusic * trackPtr = __find_track(arg0); + return (trackPtr == NULL || trackPtr->track_id == -1)? 0 : 1; } //comusic_isPrimaryTrack int func_8025ADBC(enum comusic_e arg0){ - return D_80276E30[0].unk10 == arg0; + return D_80276E30[0].track_id == arg0; } s32 func_8025ADD4(enum comusic_e id){ - CoMusic * ptr = func_802598B0(id); + CoMusic * ptr = __find_track(id); return ptr - D_80276E30; } @@ -603,7 +612,7 @@ void func_8025AE50(s32 arg0, f32 arg1){ } void func_8025AEA0(enum comusic_e track_id, s32 arg1){ - CoMusic *ptr = func_802598B0(track_id); + CoMusic *ptr = __find_track(track_id); if(!ptr) return; func_8024FDDC(ptr - D_80276E30, arg1); diff --git a/src/core1/code_EAF0.c b/src/core1/code_EAF0.c index 2d455ee6..5ea939c3 100644 --- a/src/core1/code_EAF0.c +++ b/src/core1/code_EAF0.c @@ -19,11 +19,11 @@ f32 viewportPosition[3]; f32 viewportRotation[3]; f32 D_80280ECC; f32 D_80280ED0[4][4]; -Vp D_80280F10[8]; +Vp s_viewport_stack[8]; int D_80280F90; f32 D_80280F98[4][4]; Mtx D_80280FD8; -s32 D_80281018; //viewport indx +s32 s_viewport_stack_index; //viewport indx @@ -34,7 +34,7 @@ void func_8024C964(Gfx **, Mtx **, f32, f32); void func_8024CD7C(int); void viewport_set_position_f3(f32, f32, f32); void viewport_set_rotation_f3(f32, f32, f32); -void func_8024CE60(f32, f32); +void viewport_set_near_far(f32, f32); void func_8024CE74(s32 arg0, s32 arg1, s32 arg2, s32 arg3); void viewport_set_field_of_view(f32); @@ -88,7 +88,7 @@ void viewport_get_rotation_f3(f32 *pitch, f32 *yaw, f32 *roll){ } void func_8024C7B8(Gfx **gfx, Mtx **mtx){ - gSPViewport((*gfx)++, &D_80280F10[D_80281018]); + gSPViewport((*gfx)++, &s_viewport_stack[s_viewport_stack_index]); guOrtho(*mtx, -(2*(f32)framebuffer_width), (2*(f32)framebuffer_width), -(2*(f32)framebuffer_height), (2*(f32)framebuffer_height), 1.0f, 20.0f, 1.0f); gSPMatrix((*gfx)++, OS_K0_TO_PHYSICAL((*mtx)++), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); @@ -98,7 +98,7 @@ void func_8024C7B8(Gfx **gfx, Mtx **mtx){ } void func_8024C904(Gfx **gfx, Mtx **mtx){ - gSPViewport((*gfx)++, &D_80280F10[D_80281018]); + gSPViewport((*gfx)++, &s_viewport_stack[s_viewport_stack_index]); func_8024C964(gfx, mtx, s_viewport_near, s_viewport_far); } @@ -134,7 +134,7 @@ void func_8024CBD4(Gfx **gfx, Mtx **mtx){ func_8024C964(gfx, mtx, s_viewport_near, s_viewport_far); } -void func_8024CC00(void){} +void viewport_debug(void){} void func_8024CC08(f32 arg0){ if(90.0f < arg0) arg0 = 90.0f; @@ -150,12 +150,12 @@ void func_8024CC5C(void){ func_8024CE74((s32) ((f32)framebuffer_width/2), (s32) ((f32)framebuffer_height/2), (s32) ((f32)framebuffer_width/2), (s32) ((f32)framebuffer_height/2)); } -void func_8024CCC4(void){ +void viewport_reset(void){ func_8024CD7C(1); viewport_set_position_f3(0.0f, 0.0f, 0.0f); viewport_set_rotation_f3(0.0f, 0.0f, 0.0f); func_8024CC08(40.0f); - func_8024CE60(1.0f, 10000.0f); + viewport_set_near_far(1.0f, 10000.0f); func_8024CC5C(); viewport_set_field_of_view(VIEWPORT_FOVY_DEFAULT); mlMtxIdent(); @@ -194,35 +194,35 @@ void viewport_set_rotation_f3(f32 pitch, f32 yaw, f32 roll){ viewportRotation[2] = roll; } -void func_8024CE60(f32 near, f32 far){ +void viewport_set_near_far(f32 near, f32 far){ s_viewport_near = near; s_viewport_far = far; } void func_8024CE74(s32 arg0, s32 arg1, s32 arg2, s32 arg3){ - D_80281018 = (D_80281018 + 1) % 8; - D_80280F10[D_80281018].vp.vscale[0] = arg0 << 2; - D_80280F10[D_80281018].vp.vscale[1] = arg1 << 2; - D_80280F10[D_80281018].vp.vscale[2] = 0x1ff; - D_80280F10[D_80281018].vp.vscale[3] = 0; - D_80280F10[D_80281018].vp.vtrans[0] = arg2 << 2; - D_80280F10[D_80281018].vp.vtrans[1] = arg3 << 2; - D_80280F10[D_80281018].vp.vtrans[2] = 0x1ff; - D_80280F10[D_80281018].vp.vtrans[3] = 0; - osWritebackDCache(&D_80280F10[D_80281018], sizeof(Vp)*8); + s_viewport_stack_index = (s_viewport_stack_index + 1) % 8; + s_viewport_stack[s_viewport_stack_index].vp.vscale[0] = arg0 << 2; + s_viewport_stack[s_viewport_stack_index].vp.vscale[1] = arg1 << 2; + s_viewport_stack[s_viewport_stack_index].vp.vscale[2] = 0x1ff; + s_viewport_stack[s_viewport_stack_index].vp.vscale[3] = 0; + s_viewport_stack[s_viewport_stack_index].vp.vtrans[0] = arg2 << 2; + s_viewport_stack[s_viewport_stack_index].vp.vtrans[1] = arg3 << 2; + s_viewport_stack[s_viewport_stack_index].vp.vtrans[2] = 0x1ff; + s_viewport_stack[s_viewport_stack_index].vp.vtrans[3] = 0; + osWritebackDCache(&s_viewport_stack[s_viewport_stack_index], sizeof(Vp)*8); } void func_8024CF10(f32 arg0, f32 arg1, f32 arg2, f32 arg3){ - D_80281018 = (D_80281018 + 1) % 8; - D_80280F10[D_80281018].vp.vscale[0] = arg0*4; - D_80280F10[D_80281018].vp.vscale[1] = arg1*4; - D_80280F10[D_80281018].vp.vscale[2] = 0x1ff; - D_80280F10[D_80281018].vp.vscale[3] = 0; - D_80280F10[D_80281018].vp.vtrans[0] = arg2*4; - D_80280F10[D_80281018].vp.vtrans[1] = arg3*4; - D_80280F10[D_80281018].vp.vtrans[2] = 0x1ff; - D_80280F10[D_80281018].vp.vtrans[3] = 0; - osWritebackDCache(&D_80280F10[D_80281018], sizeof(Vp)*8); + s_viewport_stack_index = (s_viewport_stack_index + 1) % 8; + s_viewport_stack[s_viewport_stack_index].vp.vscale[0] = arg0*4; + s_viewport_stack[s_viewport_stack_index].vp.vscale[1] = arg1*4; + s_viewport_stack[s_viewport_stack_index].vp.vscale[2] = 0x1ff; + s_viewport_stack[s_viewport_stack_index].vp.vscale[3] = 0; + s_viewport_stack[s_viewport_stack_index].vp.vtrans[0] = arg2*4; + s_viewport_stack[s_viewport_stack_index].vp.vtrans[1] = arg3*4; + s_viewport_stack[s_viewport_stack_index].vp.vtrans[2] = 0x1ff; + s_viewport_stack[s_viewport_stack_index].vp.vtrans[3] = 0; + osWritebackDCache(&s_viewport_stack[s_viewport_stack_index], sizeof(Vp)*8); } void viewport_update(void){ diff --git a/src/core2/ba/marker.c b/src/core2/ba/marker.c index 3e3e42a1..efcb1931 100644 --- a/src/core2/ba/marker.c +++ b/src/core2/ba/marker.c @@ -892,7 +892,7 @@ void baMarker_update(void){ if ((D_8037BF88 != 0)){ temp_s0 = func_8024FEEC(func_8025ADD4(COMUSIC_30_5TH_JINJO_COLLECTED) & 0xFF); - if((func_80259B8C() < 4 && temp_s0 >= 0xBB9) || !func_8025AD7C(COMUSIC_30_5TH_JINJO_COLLECTED)){ + if((comusic_active_track_count() < 4 && temp_s0 >= 0xBB9) || !func_8025AD7C(COMUSIC_30_5TH_JINJO_COLLECTED)){ func_8028F918(0); D_8037BF88 = 0; } diff --git a/src/core2/ch/bottlesbonus.c b/src/core2/ch/bottlesbonus.c index 50f9b833..9e86fe47 100644 --- a/src/core2/ch/bottlesbonus.c +++ b/src/core2/ch/bottlesbonus.c @@ -50,7 +50,7 @@ typedef struct{ extern void item_set(enum item_e, s32); extern void actor_postdrawMethod(ActorMarker *); -extern void func_8024CE60(f32, f32); +extern void viewport_set_near_far(f32, f32); Actor *chBottlesBonus_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); void chBottlesBonus_update(Actor *this); @@ -123,7 +123,7 @@ void chBottlesBonus_func_802DD080(Gfx **gfx, Mtx **mtx) { f32 vp_rotation[3]; func_8024E258(); - func_8024CE60(50.0f, 2000.0f); + viewport_set_near_far(50.0f, 2000.0f); if (getGameMode() == GAME_MODE_A_SNS_PICTURE) { vp_rotation[0] = 0.0f; vp_rotation[1] = 0.0f; diff --git a/src/core2/code_5C870.c b/src/core2/code_5C870.c index c8879970..1b0c87b5 100644 --- a/src/core2/code_5C870.c +++ b/src/core2/code_5C870.c @@ -7,7 +7,7 @@ extern void func_8024C510(f32); extern void viewport_set_position_f3(f32, f32, f32); extern void viewport_set_rotation_f3(f32, f32, f32); -extern void func_8024CE60(f32, f32); +extern void viewport_set_near_far(f32, f32); extern void func_802F5374(void); extern void func_802FA0F8(void); extern void timedFuncQueue_update(void); @@ -285,7 +285,7 @@ s32 func_802E3F80(void){ //game_draw void func_802E3F8C(s32 arg0){ Gfx *sp34; - Gfx *sp30; + Gfx *gfx_start; Gfx *sp2C; Mtx *sp28; Vtx *sp24; @@ -297,12 +297,12 @@ void func_802E3F8C(s32 arg0){ if(D_8037E8E0.unkC == 1){ func_80254404(&sp34, &sp28, &sp24); } - sp30 = sp34; + gfx_start = sp34; func_802E39D0(&sp34, &sp28, &sp24, func_8024BDA0(), arg0); if(D_8037E8E0.unkC == 0){ sp2C = sp34; func_8024C1DC(); - func_80253EC4(sp30, sp2C); + func_80253EC4(gfx_start, sp2C); if(arg0){ func_80254348(); } @@ -396,9 +396,9 @@ void func_802E4214(enum map_e map_id){ modelRender_init(); func_80253428(1); animCache_init(); - func_8024CCC4(); - func_8024CE60(1.0f, 10000.0f); - func_8034A6B4(); + viewport_reset(); + viewport_set_near_far(1.0f, 10000.0f); + rand_reset(); func_80254348(); func_80253FE8(); func_8033DC70(); @@ -434,8 +434,8 @@ bool func_802E4424(void) { s32 sp1C; u8 temp_v0; - func_8024CC00(); - func_8034A85C(); + viewport_debug(); + rand_shuffle(); if (!gctransition_8030BDC0()) { temp_v0 = D_8037E8E0.transition; D_8037E8E0.transition = TRANSITION_0_NONE; diff --git a/src/core2/code_AD5B0.c b/src/core2/code_AD5B0.c index c425e2e8..02b78a2a 100644 --- a/src/core2/code_AD5B0.c +++ b/src/core2/code_AD5B0.c @@ -19,7 +19,7 @@ u32 D_803835E0; /* public */ void func_80335110(s32); void func_80335128(s32); -void func_8024CE60(f32, f32); +void viewport_set_near_far(f32, f32); void func_80335140(enum map_e); void func_8033520C(s32); @@ -31,7 +31,7 @@ void func_80334540(Gfx** gdl, Mtx **mptr, Vtx **vptr) { if (D_803835E0 == 0) { func_80254084(gdl, 0, 0, framebuffer_width, framebuffer_height, 0, 0, 0); func_802BBD2C(&sp44, &sp40); - func_8024CE60(sp44, sp40); + viewport_set_near_far(sp44, sp40); func_8024C904(gdl, mptr); return; } @@ -41,7 +41,7 @@ void func_80334540(Gfx** gdl, Mtx **mptr, Vtx **vptr) { spawnQueue_unlock(); sky_draw(gdl, mptr, vptr); func_802BBD2C(&sp44, &sp40); - func_8024CE60(sp44, sp40); + viewport_set_near_far(sp44, sp40); func_8024C904(gdl, mptr); if (mapModel_has_xlu_bin() != 0) { mapModel_opa_draw(gdl, mptr, vptr); diff --git a/src/core2/code_C2F30.c b/src/core2/code_C2F30.c index b5691d9d..0e2f8e20 100644 --- a/src/core2/code_C2F30.c +++ b/src/core2/code_C2F30.c @@ -79,7 +79,7 @@ void func_80349FB0(DemoInput *input_ptr, u32 size, int arg2){ func_8030AFA0(map_get()); func_803204E4(0xc4, 1); func_8024F224(); - func_8034A6B4(); + rand_reset(); func_8023DB68(); }//*/ diff --git a/src/core2/gc/sky.c b/src/core2/gc/sky.c index acf09c67..f0453c9b 100644 --- a/src/core2/gc/sky.c +++ b/src/core2/gc/sky.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" -extern void func_8024CE60(f32, f32); +extern void viewport_set_near_far(f32, f32); typedef struct { s16 model_id; @@ -74,7 +74,7 @@ void sky_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){ f32 rotation[3]; BKModelBin *iAsset; - func_8024CE60(5.0f, 15000.0f); + viewport_set_near_far(5.0f, 15000.0f); if(gcSky.model_bins[0]){ func_80254084(gfx, 0, 0, (s32)(f32) framebuffer_width, (s32)(f32)framebuffer_height,0, 0, 0); //fill screen with black func_8024C904(gfx, mtx); diff --git a/src/core2/gc/transition.c b/src/core2/gc/transition.c index 8acc96df..f2be092f 100644 --- a/src/core2/gc/transition.c +++ b/src/core2/gc/transition.c @@ -7,7 +7,7 @@ void animctrl_setAnimTimer(AnimCtrl*, f32); void func_8025AC20(s32, s32, s32, f32, char*, s32); f32 func_80257618(void); -void func_8024CE60(f32, f32); +void viewport_set_near_far(f32, f32); typedef enum { TRANSITION_ID_1_BLACK_IN = 1, @@ -265,7 +265,7 @@ void gctransition_draw(Gfx **gdl, Mtx **mptr, Vtx **vptr){ vp_rotation[0] = 0.0f; vp_rotation[1] = 0.0f; vp_rotation[2] = 0.0f; - func_8024CE60(D_8036C440, D_8036C444); + viewport_set_near_far(D_8036C440, D_8036C444); viewport_set_position_vec3f(vp_position); //viewport_get_position_vec3f viewport_set_rotation_vec3f(vp_rotation); //viewport_get_rotation_vec3f viewport_update(); //camera_updateNormal diff --git a/src/core2/gc/zoombox.c b/src/core2/gc/zoombox.c index 94d77940..7aa7cc33 100644 --- a/src/core2/gc/zoombox.c +++ b/src/core2/gc/zoombox.c @@ -616,7 +616,7 @@ void func_8031594C(gczoombox_t * this, u8 *str, s32 arg2, s32 arg3){ f22 = (this->portrait_id == TALK_PIC_5F_TOOTY_4) ? 0.4 : 0.8; if(getGameMode() == GAME_MODE_9_BANJO_AND_KAZOOIE){ - func_8034A900(); + sfx_rand_sync_to_rand(); } for(s2 = arg2; s2 <= arg3; s2++){ if(s1){ @@ -669,7 +669,7 @@ void func_8031594C(gczoombox_t * this, u8 *str, s32 arg2, s32 arg3){ this->unk189 = s1; this->unk187 = 0; if(getGameMode() == GAME_MODE_9_BANJO_AND_KAZOOIE){ - func_8034A964(); + rand_sync_to_sfx_rand(); } } @@ -991,7 +991,7 @@ void gczoombox_draw(gczoombox_t *this, Gfx **gdl, Mtx ** mptr, void *vptr){ return; if(getGameMode() == GAME_MODE_9_BANJO_AND_KAZOOIE) - func_8034A900(); + sfx_rand_sync_to_rand(); //L80316BCC if(this->unk1A4_28 && this->state && this->model){ func_803162B4(this); @@ -1027,7 +1027,7 @@ void gczoombox_draw(gczoombox_t *this, Gfx **gdl, Mtx ** mptr, void *vptr){ } }//L80316DD8 if(getGameMode() == GAME_MODE_9_BANJO_AND_KAZOOIE){ - func_8034A964(); + rand_sync_to_sfx_rand(); } diff --git a/src/core2/rand.c b/src/core2/rand.c index 27587384..458e82e8 100644 --- a/src/core2/rand.c +++ b/src/core2/rand.c @@ -17,6 +17,9 @@ s32 D_80386108; s32 D_8038610C; /* .code */ +/** + * returns a random float in the range of [0.0, 1.0) + */ f32 randf(void){ f32 out; if(D_803860E4 & 3){ @@ -38,7 +41,10 @@ f32 randf(void){ return out; } -//only used in some sfx instances; +/** + * returns a random float in the range of [0.0, 1.0). + * Is only used in some sfx instances. + */ f32 sfx_rand(void){ f32 out; if(D_803860F0 & 3){ @@ -67,7 +73,10 @@ f32 func_8034A668(void){ return out; } -void func_8034A6B4(void){ +/** + * @brief resets all random functions to their default seed + */ +void rand_reset(void){ D_803860E0 = 0x86D; D_803860E4 = 0x2c060731; D_803860E8 = 0x19f0458b; @@ -97,7 +106,10 @@ s32 sfx_randi2(s32 min, s32 max){ return min + sfx_rand()*(max - min); } -void func_8034A85C(void){ +/** + * @brief calls randf() between 2 to 5 times + */ +void rand_shuffle(void){ int i; int start = randf()*3.0f; for(i = 2 + start; i != 0; i--){ @@ -105,14 +117,21 @@ void func_8034A85C(void){ } } -void func_8034A8BC(s32 arg0){ - func_8034A6B4(); - for(arg0; arg0 > 0; arg0--){ +/** + * @brief seeds rand methods. + */ +void rand_seed(s32 seed){ + rand_reset(); + for(seed; seed > 0; seed--){ randf(); } } -void func_8034A900(void){ +/** + * @brief syncronizes the internal values of sfx specific rand to those of rand. + * + */ +void sfx_rand_sync_to_rand(void){ D_803860F8 = D_803860E0; D_803860FC = D_803860E4; D_80386100 = D_803860E8; @@ -121,7 +140,11 @@ void func_8034A900(void){ D_8038610C = D_803860F4; } -void func_8034A964(void){ +/** + * @brief syncronizes the internal values of rand to those of sfx specific rand. + * + */ +void rand_sync_to_sfx_rand(void){ D_803860E0 = D_803860F8; D_803860E4 = D_803860FC; D_803860E8 = D_80386100; diff --git a/src/fight/chbossjinjo.c b/src/fight/chbossjinjo.c index 1a7474ac..2b72d6d9 100644 --- a/src/fight/chbossjinjo.c +++ b/src/fight/chbossjinjo.c @@ -283,7 +283,7 @@ void func_8038C840(Actor *this){ if(func_8030E3FC(this->unk44_31)) func_8030E394(this->unk44_31); func_8030E484(SFX_19_BANJO_LANDING_08); - func_8025A7DC(0x43); + func_8025A7DC(COMUSIC_43_ENTER_LEVEL_GLITTER); }//L8038CD20 } diff --git a/src/lair/ch/brentilda.c b/src/lair/ch/brentilda.c index 02c34607..2430465f 100644 --- a/src/lair/ch/brentilda.c +++ b/src/lair/ch/brentilda.c @@ -69,7 +69,7 @@ void func_8038BC24(void) { s32 phi_s1; if (fileProgressFlag_get(FILEPROG_5C_FF_PATTERN_SET) && !func_803203FC(0x62)) { - func_8034A8BC(fileProgressFlag_getN(FILEPROG_D3_FF_PATTERN, 8)); + rand_seed(fileProgressFlag_getN(FILEPROG_D3_FF_PATTERN, 8)); for(phi_s1 = 0; phi_s1 < func_8031A45C(3); phi_s1++){ phi_s0 = 0x26 + 2*phi_s1; temp_v0 = randi2(0, 3); diff --git a/src/lair/code_86F0.c b/src/lair/code_86F0.c index 18a94488..663ba6f1 100644 --- a/src/lair/code_86F0.c +++ b/src/lair/code_86F0.c @@ -5,7 +5,7 @@ extern f32 ml_distanceSquared_vec3f(f32[3], f32[3]); extern void func_8028F3D8(f32[3], f32, void(*)(ActorMarker *), ActorMarker *); extern void func_80324CFC(f32, enum comusic_e, s32); -extern void func_8034A8BC(s32); +extern void rand_seed(s32); extern void func_8034DF30(s32, f32[3], f32[3], f32); extern void func_8034E088(s32, s32, s32,f32); @@ -225,7 +225,7 @@ s32 func_8038F0EC(Actor *this) { phi_s0 = 0; local = (ActorLocal_lair_86F0*)&this->local; - func_8034A8BC(this->unkF4_8); + rand_seed(this->unkF4_8); if (this->unkF4_8 >= 0xA) { for(phi_s2 = 0; phi_s2 < local->unk4; phi_s2++){ sp34 = phi_s2; From 9ada030d0edd7ee10b8528fed7e18758996a9883 Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Fri, 23 Aug 2024 18:24:32 -0500 Subject: [PATCH 18/38] func_8032F194 match --- README.md | 2 +- include/prop.h | 29 +++++++++++++++++------------ progress/progress_core2.svg | 4 ++-- progress/progress_total.svg | 4 ++-- src/core2/code_A5BC0.c | 34 +++++++++++++++++++--------------- 5 files changed, 41 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 7c97e529..8144e762 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (99.1816%) +# banjo (99.1902%) diff --git a/include/prop.h b/include/prop.h index a42f0176..4025977b 100644 --- a/include/prop.h +++ b/include/prop.h @@ -48,18 +48,23 @@ typedef struct model_prop_s{ typedef struct actor_prop_s{ - struct actorMarker_s* marker; - s16 x; - s16 y; - s16 z; - u16 unk8_15:5; - u16 unk8_10:5; - u16 unk8_5:1; - u16 unk8_4:1; - u16 unk8_3:1; - u16 unk8_2:1; - u16 unk8_1:1; - u16 unk8_0:1; + union { + struct { + struct actorMarker_s* marker; + s16 x; + s16 y; + s16 z; + u16 unk8_15:5; + u16 unk8_10:5; + u16 unk8_5:1; + u16 unk8_4:1; + u16 unk8_3:1; + u16 unk8_2:1; + u16 unk8_1:1; + u16 unk8_0:1; + }; + s32 words[3]; + }; } ActorProp; typedef void(*MarkerCollisionFunc)(struct actorMarker_s *this, struct actorMarker_s *other); diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index 1c70a52e..3a1480c2 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -17,7 +17,7 @@ core2 - 98.5735% - 98.5735% + 98.5886% + 98.5886% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 99849367..0b716bb0 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 99.1816% - 99.1816% + 99.1902% + 99.1902% \ No newline at end of file diff --git a/src/core2/code_A5BC0.c b/src/core2/code_A5BC0.c index 8f61be9c..fdf2daee 100644 --- a/src/core2/code_A5BC0.c +++ b/src/core2/code_A5BC0.c @@ -14,13 +14,10 @@ extern s32 func_802E9DD8(BKCollisionList *collisionList, BKVertexList *vtxList, extern void *func_802EBAE0(UNK_TYPE(s32), f32 position[3], f32 rotation[3], f32 scale, UNK_TYPE(s32), UNK_TYPE(s32), UNK_TYPE(s32), f32, UNK_TYPE(s32)); extern int func_802E805C(BKCollisionList *, BKVertexList *, f32[3], f32[3], f32, f32[3], f32[3], f32[3], u32); - extern f32 func_8030A590(void); extern void func_8030A5EC(Prop *, f32); Prop *func_80303F7C(s32, f32, s32, s32); -s32 func_8032D9C0(Cube*, Prop*); -void func_80332B2C(ActorMarker * arg0); s32 func_803058C0(f32); void func_80305CD8(s32, s32); void func_80330104(Cube*); @@ -28,6 +25,9 @@ ActorMarker * func_80332A60(void); extern void func_8032F3D4(s32 [3], ActorMarker *, s32); extern void func_8030A350(Gfx **, Mtx **, Vtx **, f32[3], f32, s32, Cube*,s32 ,s32, s32, s32, s32); extern void func_8030A2D0(Gfx **, Mtx **, Vtx **, f32[3], f32[3], f32, s32, Cube*); +s32 func_8032D9C0(Cube*, Prop*); +void func_8032F21C(Cube *cube, s32 position[3], ActorMarker *marker, bool arg3); +void func_80332B2C(ActorMarker * arg0); typedef union{ struct{ @@ -993,21 +993,25 @@ s32 func_8032F170(Cube **arg0, void **arg1){ return D_8038340C; } -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_A5BC0/func_8032F194.s") -#else void func_8032F194(ActorMarker *marker, s32 position[3], Cube *cube) { - ActorProp2 sp24; + ActorProp sp24; + ActorProp *propPtr = marker->propPtr; + ActorProp *v0 = &sp24; - ((s32*)&sp24)[2] = ((s32*)marker->propPtr)[2]; - sp24.x = (s16) position[0]; - sp24.y = (s16) position[1]; - sp24.z = (s16) position[2]; - func_8032F21C(cube, position, marker, func_8032D9C0(marker->cubePtr, marker->propPtr)); - ((s32*)marker->propPtr)[1] = ((s32*)&sp24)[1]; - ((s32*)marker->propPtr)[2] = ((s32*)&sp24)[2]; + v0 += 0; + + sp24.words[2] = propPtr->words[2]; + + v0->x = position[0]; + v0->y = position[1]; + v0->z = position[2]; + + func_8032F21C(cube, position, marker, func_8032D9C0(marker->cubePtr, propPtr)); + + propPtr = marker->propPtr; + propPtr->words[1] = sp24.words[1]; + propPtr->words[2] = sp24.words[2]; } -#endif void func_8032F21C(Cube *cube, s32 position[3], ActorMarker *marker, bool arg3) { ActorProp *sp1C; From fff563a3f081c0119f7add94a0cb880f2a82a12f Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Fri, 23 Aug 2024 18:28:26 -0500 Subject: [PATCH 19/38] func_80308984 match --- README.md | 2 +- progress/progress_core2.svg | 4 ++-- progress/progress_total.svg | 6 +++--- src/core2/code_7AF80.c | 43 ++++++++++++++++++++----------------- 4 files changed, 29 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 8144e762..d8c1a78a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (99.1902%) +# banjo (99.2497%) diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index 3a1480c2..f73bac9e 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -17,7 +17,7 @@ core2 - 98.5886% - 98.5886% + 98.6923% + 98.6923% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 0b716bb0..374af5ef 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 99.1902% - 99.1902% + 99.2497% + 99.2497% \ No newline at end of file diff --git a/src/core2/code_7AF80.c b/src/core2/code_7AF80.c index 9cf129e4..43706546 100644 --- a/src/core2/code_7AF80.c +++ b/src/core2/code_7AF80.c @@ -2359,47 +2359,51 @@ void func_8030895C(s32 arg0){ D_8036ABD4++; } -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_7AF80/func_80308984.s") -#else void func_80308984(void) { Cube *iCube; s16 temp_s4; s32 sp54; s32 sp50; + u32 padding[2]; NodeProp *iNode; s32 i; Cube *jCube; NodeProp *jNode; - D_8036ABD4 = 0; - sp54 = 0xF4240; + sp54 = 1000000; sp50 = 0; - for(i = 0; (u32)D_8036ABAC[i] != -1; i++){ - sp54 = (D_8036ABAC[i] < sp54)? D_8036ABAC[i] : sp54; - sp50 = (sp50 < D_8036ABAC[i])? D_8036ABAC[i] : sp50; + + for(i = 0; D_8036ABAC[i] != -1; i++){ + if (D_8036ABAC[i] < sp54) { + sp54 = D_8036ABAC[i]; + } + if (D_8036ABAC[i] > sp50) { + sp50 = D_8036ABAC[i]; + } } + for(iCube = D_80381FA0.cube_list; iCube < D_80381FA0.cube_list + D_80381FA0.cubeCnt; iCube++){ for(iNode = iCube->prop1Ptr; iNode < iCube->prop1Ptr + iCube->prop1Cnt; iNode++){ - if (iNode->unk6.bit6 == 6 && !iNode->unk6.bit0){ - if((iNode->unk8 >= (u32)sp54) && ((u32)sp50 >= iNode->unk8)) { - for(i = 0; iNode->unk8 != (u32)D_8036ABAC[i] && -1 != (u32)D_8036ABAC[i]; i++){ + if (iNode->unk6.bit6 == 6 && iNode->unk6.bit0 == 0){ + u32 tmp = iNode->unk8; + + if(tmp >= sp54 && tmp <= sp50) { + for(i = 0; D_8036ABAC[i] != tmp && D_8036ABAC[i] != -1; i++){ } - if(-1 != (u32)D_8036ABAC[i]){ + + if(D_8036ABAC[i] != -1){ temp_s4 = D_8036ABD4; func_8030895C(iCube - D_80381FA0.cube_list); func_8030895C(0); - for(jCube = iCube; jCube < D_80381FA0.cube_list + D_80381FA0.cubeCnt; jCube++){ + + for(jCube = D_80381FA0.cube_list; jCube < D_80381FA0.cube_list + D_80381FA0.cubeCnt; jCube++){ for(jNode = jCube->prop1Ptr; jNode < jCube->prop1Ptr + jCube->prop1Cnt; jNode++){ - if( - jNode->unk6.bit6 == 6 - && !jNode->unk6.bit0 - && jNode->unk8 == D_8036ABC0[i] - ) { + if (jNode->unk6.bit6 == 6 && jNode->unk6.bit0 == 0 && jNode->unk8 == D_8036ABC0[i]) { func_8030895C(jCube - D_80381FA0.cube_list); - D_80382150[temp_s4]++; + D_80382150[temp_s4 + 1]++; + jNode = jCube->prop1Ptr + jCube->prop1Cnt; } } } @@ -2409,7 +2413,6 @@ void func_80308984(void) { } } } -#endif void func_80308D2C(Gfx **gfx, Mtx **mtx, Vtx **vtx) { s32 phi_s4; From a0e73bfa4d39fefc47747512bc4ed74cf3ebdd7a Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Fri, 23 Aug 2024 18:30:19 -0500 Subject: [PATCH 20/38] README.md update --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index d8c1a78a..c024d72a 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,8 @@ Be sure to check scratch "family" for any progress that may not be reflected her | core2/code_C4B0.c | func_80293668 | [rOskO](https://decomp.me/scratch/rOskO) | 86.41% | | core2/code_12F30.c | func_80299EC0 | [Ar62G](https://decomp.me/scratch/Ar62G) | 77.65% | | core2/code_7AF80.c | func_80307948 | [zd8KD](https://decomp.me/scratch/zd8KD) | 85.40% | -| core2/code_7AF80.c | func_80308984 | [tFOGA](https://decomp.me/scratch/tFOGA) | 79.77% | | core2/code_87E30.c | gcdialog_update | [cPns0](https://decomp.me/scratch/cPns0) | 92.23% | | core2/code_98CB0.c | func_8031FC40 | [m2Bd9](https://decomp.me/scratch/m2Bd9) | 99.57% | address scrambling and unscrambling | -| core2/code_A5BC0.c | func_8032F194 | [G2oc8](https://decomp.me/scratch/G2oc8) | 81.12% | | core2/code_B9770.c | func_80340BE4 | [FXyYS](https://decomp.me/scratch/FXyYS) | 65.91% | spline function | core2/code_B9770.c | func_803411B0 | [rHkDu](https://decomp.me/scratch/rHkDu) | 87.70% | spline function From 929beb4de9ce8d108d66fee624daf7b480b960e7 Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Sat, 24 Aug 2024 20:26:16 -0500 Subject: [PATCH 21/38] func_80293668 match --- README.md | 3 +- progress/progress_core2.svg | 6 +- progress/progress_total.svg | 4 +- src/core2/code_C4B0.c | 139 +++++++++++++++++------------------- 4 files changed, 73 insertions(+), 79 deletions(-) diff --git a/README.md b/README.md index c024d72a..ee45b0ce 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (99.2497%) +# banjo (99.3598%) @@ -25,7 +25,6 @@ Be sure to check scratch "family" for any progress that may not be reflected her | File | Function | Scratch Link | % | Notes | | ------------------ | --------------- | ---------------------------------------- | ------ | ----- | -| core2/code_C4B0.c | func_80293668 | [rOskO](https://decomp.me/scratch/rOskO) | 86.41% | | core2/code_12F30.c | func_80299EC0 | [Ar62G](https://decomp.me/scratch/Ar62G) | 77.65% | | core2/code_7AF80.c | func_80307948 | [zd8KD](https://decomp.me/scratch/zd8KD) | 85.40% | | core2/code_87E30.c | gcdialog_update | [cPns0](https://decomp.me/scratch/cPns0) | 92.23% | diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index f73bac9e..e40953f2 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ core2 - 98.6923% - 98.6923% + 98.8842% + 98.8842% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 374af5ef..2562f664 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 99.2497% - 99.2497% + 99.3598% + 99.3598% \ No newline at end of file diff --git a/src/core2/code_C4B0.c b/src/core2/code_C4B0.c index 391a2cd3..b2fe6bc9 100644 --- a/src/core2/code_C4B0.c +++ b/src/core2/code_C4B0.c @@ -112,9 +112,6 @@ void func_8029350C(f32 *arg0) { } } -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_C4B0/func_80293668.s") -#else void func_80293668(void) { f32 sp3AC[3]; f32 sp3A0[3]; @@ -127,111 +124,111 @@ void func_80293668(void) { f32 sp364[3]; Struct_core2_C4B0_0 *var_s1; Struct_core2_C4B0_0 sp90[5]; - u32 temp_s7; s32 temp_v0; + Struct_core2_C4B0_0 *sp88; temp_v0 = baMarker_8028D694(); func_80244FC0(D_8037C228, sp390, D_8037C1F8[1], D_8037C1F8[0], 1, temp_v0 | 0x1E0000); - temp_s7 = temp_v0 | 0x1E0000; for(i = 0; i < 5; i++){ + sp88 = &sp90[i]; var_s1 = (i != 0) ? &sp90[i - 1] : NULL; if (i != 0) { - ml_vec3f_copy(sp90[i].unk0, var_s1->unk0); - ml_vec3f_copy(sp90[i].unkC, var_s1->unkC); + ml_vec3f_copy(sp88->unk0, var_s1->unk0); + ml_vec3f_copy(sp88->unkC, var_s1->unkC); } else { - ml_vec3f_copy(sp90[i].unk0, D_8037C218); - ml_vec3f_copy(sp90[i].unkC, D_8037C228); + ml_vec3f_copy(sp88->unk0, D_8037C218); + ml_vec3f_copy(sp88->unkC, D_8037C228); } - ml_vec3f_copy(sp364, sp90[i].unk0); - ml_vec3f_diff_copy(sp380, sp90[i].unk0, sp90[i].unkC); + ml_vec3f_copy(sp364, sp88->unk0); + ml_vec3f_diff_copy(sp380, sp88->unk0, sp88->unkC); temp_f0 = ((D_8037C1F8[1] * 2) - 4.0f); if ((sp380[0]*sp380[0] + sp380[1]*sp380[1] + sp380[2]*sp380[2]) > (temp_f0 * temp_f0)) { - sp38C = sp90[i].unk0[1]; - sp90[i].unk40 = func_80244E54(sp90[i].unkC, sp90[i].unk0, sp90[i].unk44, temp_s7, D_8037C1F8[1] - 1.0f, D_8037C1F8[0]); - if (sp90[i].unk40 != 0) { + sp38C = sp88->unk0[1]; + sp88->unk40 = func_80244E54(sp88->unkC, sp88->unk0, sp88->unk44, temp_v0 | 0x1E0000, D_8037C1F8[1] - 1.0f, D_8037C1F8[0]); + if (sp88->unk40 != 0) { ml_vec3f_normalize(sp380); - if ((sp380[0]*sp90[i].unk44[0] + sp380[1]*sp90[i].unk44[1] + sp380[2]*sp90[i].unk44[2]) > 0.0f) { - sp90[i].unk40 = 0; - ml_vec3f_copy(sp90[i].unk0, sp364); + temp_f0 = sp380[0]*sp88->unk44[0][0] + sp380[1]*sp88->unk44[0][1] + sp380[2]*sp88->unk44[0][2]; + if (temp_f0 > 0.0f) { + sp88->unk40 = 0; + ml_vec3f_copy(sp88->unk0, sp364); } } - if (sp90[i].unk40 != 0) { - if ((sp90[i].unk44[1] >= 0.0) && (sp90[i].unk44[1] < D_80374770)) { - sp90[i].unk0[1] = sp38C; + if (sp88->unk40 != 0) { + if ((sp88->unk44[0][1] >= 0.0) && (sp88->unk44[0][1] < 0.02)) { + sp88->unk0[1] = sp38C; } } } else { - sp90[i].unk40 = 0; + sp88->unk40 = 0; } - func_8029350C(sp90[i].unk0); - sp90[i].unk8C = D_8037C279; - sp90[i].unk34[0] = sp90[i].unkC[0]; - sp90[i].unk34[1] = sp90[i].unkC[1]; - sp90[i].unk34[2] = sp90[i].unkC[2]; - sp90[i].unk34[1] +=D_8037C1F8[0]; - sp90[i].unk28[0] = sp90[i].unk0[0]; - sp90[i].unk28[1] = sp90[i].unk0[1]; - sp90[i].unk28[2] = sp90[i].unk0[2]; - sp90[i].unk28[1] +=D_8037C1F8[0]; + func_8029350C(sp88->unk0); - sp90[i].unk18 = func_80320C94(sp90[i].unk34, sp90[i].unk28, D_8037C1F8[1], sp90[i].unk1C, 3, temp_s7); - if (sp90[i].unk18 != NULL) { + sp88->unk8C = D_8037C279; + + sp88->unk34[0] = sp88->unkC[0]; + sp88->unk34[1] = D_8037C1F8[0] + sp88->unkC[1]; + sp88->unk34[2] = sp88->unkC[2]; + + sp88->unk28[0] = sp88->unk0[0]; + sp88->unk28[1] = D_8037C1F8[0] + sp88->unk0[1]; + sp88->unk28[2] = sp88->unk0[2]; + + sp88->unk18 = func_80320C94(sp88->unk34, sp88->unk28, D_8037C1F8[1], sp88->unk1C, 3, temp_v0 | 0x1E0000); + if (sp88->unk18 != NULL) { D_8037C27D++; - D_8037C204 = sp90[i].unk18; - ml_vec3f_copy(D_8037C258, sp90[i].unk1C); + D_8037C204 = sp88->unk18; + ml_vec3f_copy(D_8037C258, sp88->unk1C); if (i == 2) { - if ((sp90[i].unk18 == sp90[0].unk18) && (var_s1->unk18 != sp90[0].unk18)) { - ml_vec3f_add(sp380, sp90[i].unk1C, var_s1->unk1C); + if ((sp88->unk18 == sp90[0].unk18) && (sp88->unk18 != var_s1->unk18)) { + ml_vec3f_add(sp380, sp88->unk1C, var_s1->unk1C); ml_vec3f_normalize(sp380); - ml_vec3f_copy(sp90[i].unk1C, sp380); + ml_vec3f_copy(sp88->unk1C, sp380); } } if (i == 2) { - if (sp90[i].unk18 == sp90[0].unk18) { - if ((var_s1->unk18 == sp90[i].unk18) && func_802946FC(sp90[i].unk68, sp90[i].unk18)) { - func_802578A4(sp380, sp90[i].unk0, sp90[i].unk68); - ml_vec3f_diff_copy(sp3A0, sp90[i].unk0, sp380); + if (sp88->unk18 == sp90[0].unk18) { + if ((sp88->unk18 == var_s1->unk18) && func_802946FC(sp88->unk68, sp88->unk18)) { + func_802578A4(sp380, sp88->unk0, sp88->unk68[0]); + ml_vec3f_diff_copy(sp3A0, sp88->unk0, sp380); ml_vec3f_set_length_copy(sp3A0, sp3A0, D_8037C1F8[1] + 1.0f); sp380[0] += sp3A0[0]; sp380[1] += sp3A0[1]; sp380[2] += sp3A0[2]; - if (!(sp90[i].unk18->unk8 & 0x00010000)) { - sp90[i].unk18 = func_802457C4(sp380, sp90[i].unk0, D_8037C1F8[0], D_8037C1F8[1], sp90[i].unk1C, 3, temp_s7); + if (!(sp88->unk18->flags & 0x00010000)) { + sp88->unk18 = func_802457C4(sp380, sp88->unk0, D_8037C1F8[0], D_8037C1F8[1], sp88->unk1C, 3, temp_v0 | 0x1E0000); } else { - ml_vec3f_copy(sp90[i].unk0, sp380); + ml_vec3f_copy(sp88->unk0, sp380); } } } } - if ((sp90[i].unk8C == 0) && (sp90[i].unk18 != NULL) && (D_8037C238[1] < 0.0f)) { - if( (mlAbsF(sp90[i].unk1C[1]) < D_80374778) && func_802946FC(sp90[i].unk68, sp90[i].unk18)) { - func_802578A4(sp380, sp90[i].unk0, sp90[i].unk68); - ml_vec3f_scale_copy(sp3A0, sp90[i].unk1C, D_8037C1F8[1] + 1.0f); + if ((sp88->unk8C == 0) && (sp88->unk18 != NULL) && (D_8037C238[1] < 0.0f)) { + if( (mlAbsF(sp88->unk1C[1]) < 0.01) && func_802946FC(sp88->unk68, sp88->unk18)) { + func_802578A4(sp380, sp88->unk0, sp88->unk68[0]); + ml_vec3f_scale_copy(sp3A0, sp88->unk1C, D_8037C1F8[1] + 1.0f); ml_vec3f_add(sp374, sp380, sp3A0); - sp90[i].unk18 = func_802457C4(sp374, sp380, D_8037C1F8[0], D_8037C1F8[1], sp90[i].unk1C, 3, temp_s7); - sp90[i].unk0[0] = sp380[0]; - sp90[i].unk0[2] = sp380[2]; + sp88->unk18 = func_802457C4(sp374, sp380, D_8037C1F8[0], D_8037C1F8[1], sp88->unk1C, 3, temp_v0 | 0x1E0000); + sp88->unk0[0] = sp380[0]; + sp88->unk0[2] = sp380[2]; } } - if ((D_80374780 < sp90[i].unk1C[1]) && func_802946FC(sp90[i].unk68, sp90[i].unk18)) { - func_8025778C(sp3AC, sp90[i].unk0, sp90[i].unk68); - sp380[0] = sp90[i].unk0[0] - sp3AC[0]; + if ((0.999 < sp88->unk1C[1]) && func_802946FC(sp88->unk68, sp88->unk18)) { + func_8025778C(sp3AC, sp88->unk0, sp88->unk68); + sp380[0] = sp88->unk0[0] - sp3AC[0]; sp380[1] = 0.0f; - sp380[2] = sp90[i].unk0[2] - sp3AC[2]; - ml_vec3f_set_length_copy(sp380, sp380, D_8037C1F8[1] + 1.0f); - sp380[0] = sp380[0] + sp3AC[0]; - sp380[1] = sp380[1] + sp3AC[1]; - sp380[2] = sp380[2] + sp3AC[2]; - sp90[i].unk0[0] = sp380[0]; - sp90[i].unk0[2] = sp380[2]; - } else if (ml_isNonzero_vec3f(sp90[i].unk1C)) { - func_802450DC(sp90[i].unkC, sp90[i].unk0, sp90[i].unk34, sp90[i].unk28, sp90[i].unk1C); + sp380[2] = sp88->unk0[2] - sp3AC[2]; + ml_vec3f_set_length_copy(sp380, sp380, 1.0f + D_8037C1F8[1]); + sp380[0] += sp3AC[0]; + sp380[1] += sp3AC[1]; + sp380[2] += sp3AC[2]; + sp88->unk0[0] = sp380[0]; + sp88->unk0[2] = sp380[2]; + } else if (ml_isNonzero_vec3f(sp88->unk1C)) { + func_802450DC(sp88->unkC, sp88->unk0, sp88->unk34, sp88->unk28, sp88->unk1C); } - - } - else{ + } else { break; } } @@ -239,15 +236,13 @@ void func_80293668(void) { if ((i == 5) && (D_8037C279 == 0) && (D_8037C204 != 0) && (D_8037C218[1] < D_8037C228[1])) { D_8037C27C = 1; } - + if (i == 5) { ml_vec3f_copy(D_8037C218, sp390); - } - else{ - ml_vec3f_copy(D_8037C218, sp90[i].unk0); + } else{ + ml_vec3f_copy(D_8037C218, sp88->unk0); } } -#endif void func_80293D2C(f32 *arg0, f32 * arg1){ *arg0 = D_8037C1F8[0]; From f00389249935cc3cfa074e0f5af6934599e4728b Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Sun, 25 Aug 2024 20:45:15 -0500 Subject: [PATCH 22/38] func_8031FC40 match --- README.md | 3 +- progress/progress_core2.svg | 4 +-- progress/progress_total.svg | 4 +-- src/core2/code_98CB0.c | 59 +++++++++++++++---------------------- 4 files changed, 29 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index ee45b0ce..29cce5d8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (99.3598%) +# banjo (99.3923%) @@ -28,7 +28,6 @@ Be sure to check scratch "family" for any progress that may not be reflected her | core2/code_12F30.c | func_80299EC0 | [Ar62G](https://decomp.me/scratch/Ar62G) | 77.65% | | core2/code_7AF80.c | func_80307948 | [zd8KD](https://decomp.me/scratch/zd8KD) | 85.40% | | core2/code_87E30.c | gcdialog_update | [cPns0](https://decomp.me/scratch/cPns0) | 92.23% | -| core2/code_98CB0.c | func_8031FC40 | [m2Bd9](https://decomp.me/scratch/m2Bd9) | 99.57% | address scrambling and unscrambling | | core2/code_B9770.c | func_80340BE4 | [FXyYS](https://decomp.me/scratch/FXyYS) | 65.91% | spline function | core2/code_B9770.c | func_803411B0 | [rHkDu](https://decomp.me/scratch/rHkDu) | 87.70% | spline function diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index e40953f2..673f0ed1 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -17,7 +17,7 @@ core2 - 98.8842% - 98.8842% + 98.9409% + 98.9409% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 2562f664..6f6e28b0 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 99.3598% - 99.3598% + 99.3923% + 99.3923% \ No newline at end of file diff --git a/src/core2/code_98CB0.c b/src/core2/code_98CB0.c index 21e5e79f..8b53cc14 100644 --- a/src/core2/code_98CB0.c +++ b/src/core2/code_98CB0.c @@ -41,26 +41,19 @@ u8 D_803831F8[0x21]; //copy of D_803831D0 /* .code */ -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_98CB0/func_8031FC40.s") -#else void func_8031FC40(void) { - s32 scrambled_ptr; + s32 *scrambled_ptr; s32 *unscrambled_ptr; - s32 temp_a1; - s32 temp_lo; - s32 temp_t0; - s32 temp_t1; - s32 temp_a2; - s32 temp_t9; - s32 var_a0; - u8* b_ptr; - s32 var_t3; - u32 var_v0 = 0x17536C34; - u32 var_v1 = 0; - + u32 a1; + s32 t0; + s32 t1; + u32 a0; + u8 *ptr; + u32 v0 = 0x17536C34; + u32 v1; + //obsucre address - temp_t0 = (((s32)&D_803831A0.unk8 & 0xE0000000) >> 15) + + t0 = (((s32)&D_803831A0.unk8 & 0xE0000000) >> 15) + (((s32)&D_803831A0.unk8 & 0x1FC00000) >> 22) + (((s32)&D_803831A0.unk8 & 0x00300000) << 10) + (((s32)&D_803831A0.unk8 & 0x000F0000) << 7) + @@ -70,30 +63,26 @@ void func_8031FC40(void) { (((s32)&D_803831A0.unk8 & 0x00000060) << 4) + (((s32)&D_803831A0.unk8 & 0x00000018) << 18) + (((s32)&D_803831A0.unk8 & 0x00000007) << 11); - + //unobscure address - temp_t9 = (temp_t0 & 0x38000000) / (1 << 24); - temp_t1 = ((temp_t0 & 0x1E0600) << 0xB) | ((s32) (temp_t0 & 0x603800) / 8); - temp_a1 = (((temp_t0 & 0x1C07F) << 0xF) + ((u32) (temp_t0 & 0xC7800000) >> 0x11)) | (temp_t9 + ((s32) (temp_t0 & 0x180) >> 6)); \ - var_a0 = ((temp_a1 & 0x3FE000) << 7) - | (((temp_t1 >> 8) & 7) + ((temp_a1 << 0xA) & 0xFF800)) - | ((((u32) (temp_t1 & 0xF0000000) >> 0x15) + (temp_a1 & 0xE0000000)) ^ ((s32) ((temp_t1 /0x40) & 0xF000) >> 9)); + t1 = ((t0 & 0x1E0600) << 0xB) | ((s32) (t0 & 0x603800) / 8); + a0 = (((t0 & 0x1C07F) << 0xF) + ((u32) (t0 & 0xC7800000) >> 0x11)) | (((t0 & 0x38000000) / (1 << 24)) + ((s32) (t0 & 0x180) >> 6)); \ + a1 = a0; \ + a0 = (((a1 & 0x3FE000) << 7) + | (((t1 >> 8) & 7) + ((a1 << 0xA) & 0xFF800)) + | ((((u32) (t1 & 0xF0000000) >> 0x15) + (a1 & 0xE0000000)) ^ ((s32) ((t1 /0x40) & 0xF000) >> 9))); //calculate checksum - temp_a1 = 0x25; - for(var_v1 = 0; var_v1 < temp_a1; var_v1++){ - b_ptr = (u8*)(var_a0 + var_v1); - var_v0 = (((var_v0 - *b_ptr) & 0x1F) << 0xF) ^ ((*b_ptr* 0x1B) + (var_v0 >> 0xB)); + ptr = (u8*)(a0); + a1 = 0x25; + for(v1 = 0; v1 < a1; v1++){ + v0 = (((v0 - ptr[v1]) & 0x1F) << 0xF) ^ ((ptr[v1]* 0x1B) + (v0 >> 0xB)); } - scrambled_ptr = (((s32) &D_803831A0 & 0x55555555) * 2) + ((u32) ((s32) &D_803831A0 & 0xAAAAAAAA) >> 1); - unscrambled_ptr = (((scrambled_ptr & 0x55555555) * 2) | ((u32) (scrambled_ptr & 0xAAAAAAAA) >> 1)); - *unscrambled_ptr = var_v0; - if(!var_a0); + scrambled_ptr = (s32 *) ((((s32) &D_803831A0 & 0x55555555) << 1) + (((s32) &D_803831A0 & 0xAAAAAAAA) >> 1)); + unscrambled_ptr = (s32 *) ((((s32) scrambled_ptr & 0x55555555) << 1) | (((s32) scrambled_ptr & 0xAAAAAAAA) >> 1)); + *unscrambled_ptr = v0; } -#endif - - u32 func_8031FE40(void) { u8 *obscured_addr; From ed2fb89d88134815e27e9e985389bde1b5fda9fe Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Mon, 26 Aug 2024 10:46:28 -0500 Subject: [PATCH 23/38] gcdialog_update matched --- README.md | 3 +- progress/progress_core2.svg | 6 +- progress/progress_total.svg | 6 +- src/core2/code_87E30.c | 946 +++++++++++++++++++----------------- 4 files changed, 502 insertions(+), 459 deletions(-) diff --git a/README.md b/README.md index 29cce5d8..68cfa99f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (99.3923%) +# banjo (99.5858%) @@ -27,7 +27,6 @@ Be sure to check scratch "family" for any progress that may not be reflected her | ------------------ | --------------- | ---------------------------------------- | ------ | ----- | | core2/code_12F30.c | func_80299EC0 | [Ar62G](https://decomp.me/scratch/Ar62G) | 77.65% | | core2/code_7AF80.c | func_80307948 | [zd8KD](https://decomp.me/scratch/zd8KD) | 85.40% | -| core2/code_87E30.c | gcdialog_update | [cPns0](https://decomp.me/scratch/cPns0) | 92.23% | | core2/code_B9770.c | func_80340BE4 | [FXyYS](https://decomp.me/scratch/FXyYS) | 65.91% | spline function | core2/code_B9770.c | func_803411B0 | [rHkDu](https://decomp.me/scratch/rHkDu) | 87.70% | spline function diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index 673f0ed1..d08e45ea 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ core2 - 98.9409% - 98.9409% + 99.2781% + 99.2781% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 6f6e28b0..7e705082 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 99.3923% - 99.3923% + 99.5858% + 99.5858% \ No newline at end of file diff --git a/src/core2/code_87E30.c b/src/core2/code_87E30.c index 4d48289f..739569a6 100644 --- a/src/core2/code_87E30.c +++ b/src/core2/code_87E30.c @@ -9,6 +9,7 @@ extern int func_803114B0(void); extern void gczoombox_open(gczoombox_t *); extern void gczoombox_minimize(gczoombox_t *); extern void gczoombox_close(gczoombox_t *); +extern void gczoombox_update(gczoombox_t *); extern bool func_803188B4(gczoombox_t *); extern char *dialogBin_get(enum asset_e text_id); @@ -26,24 +27,48 @@ struct { struct15s unk11A[2]; gczoombox_t *zoombox[2]; s16 unk124[2]; - u32 unk128_31:8; - u32 state:8; - u32 unk128_15:8; - u32 active_zoombox:1; //active_zoombox_index - u32 unk128_6:1; - u32 unk128_5:1; - u32 unk128_4:1; - u32 unk128_3:1; - u32 pad128_2:2; - u32 unk128_0:1; - u32 unk12C_31:2; - u32 unk12C_29:2; - u32 unk12C_27:2; - u32 unk12C_25:2; - s32 unk12C_23:8; - u32 unk12C_15:4; - u32 unk12C_11:4; - u32 pad12C_7:8; + union{ + struct { + u8 unk128_31; + u8 state; + u8 unk128_15; + u8 active_zoombox:1; //active_zoombox_index + u8 unk128_6:1; + u8 unk128_5:1; + u8 unk128_4:1; + u8 unk128_3:1; + u8 pad128_2:2; + u8 unk128_0:1; + u8 unk12C_31:2; + u8 unk12C_29:2; + u8 unk12C_27:2; + u8 unk12C_25:2; + s8 unk12C_23:8; + u8 unk12C_15:4; + u8 unk12C_11:4; + u8 pad12C_7:8; + } u8; + struct { + u32 unk128_31:8; + u32 state:8; + u32 unk128_15:8; + u32 active_zoombox:1; //active_zoombox_index + u32 unk128_6:1; + u32 unk128_5:1; + u32 unk128_4:1; + u32 unk128_3:1; + u32 pad128_2:2; + u32 unk128_0:1; + u32 unk12C_31:2; + u32 unk12C_29:2; + u32 unk12C_27:2; + u32 unk12C_25:2; + s32 unk12C_23:8; + u32 unk12C_15:4; + u32 unk12C_11:4; + u32 pad12C_7:8; + }; + }; s16 unk130; s8 unk132; u8 pad133[0x1]; @@ -53,7 +78,7 @@ struct { void (* unk140)(ActorMarker *, s32, s32); s32 (* unk144)(ActorMarker *, s32, s32); struct14s unk148[4]; -} D_80382E20; +} g_Dialog; char D_80382FF8[0x18]; /* .code */ @@ -75,51 +100,51 @@ void gcdialog_init(void) { s32 i; struct14s *i_ptr; - D_80382E20.dialog_bin_ptr = 0; + g_Dialog.dialog_bin_ptr = 0; for( i = 0; i < 2; i++){ - D_80382E20.string_list[i] = NULL; - D_80382E20.string_count[i] = 0; - D_80382E20.zoombox[i] = NULL; - D_80382E20.string_index[i] = NULL; - D_80382E20.string_cmd[i] = -1; - D_80382E20.string[i] = 0; - D_80382E20.unk11A[i].unk0_7 = 0; - D_80382E20.unk11A[i].unk0_5 = 0; + g_Dialog.string_list[i] = NULL; + g_Dialog.string_count[i] = 0; + g_Dialog.zoombox[i] = NULL; + g_Dialog.string_index[i] = NULL; + g_Dialog.string_cmd[i] = -1; + g_Dialog.string[i] = 0; + g_Dialog.unk11A[i].unk0_7 = 0; + g_Dialog.unk11A[i].unk0_5 = 0; } for(i = 0; i < 4; i++){ - D_80382E20.unk148[i].unk0 = -1; - D_80382E20.unk148[i].unk2 = 0; - D_80382E20.unk148[i].unk10 = NULL; - D_80382E20.unk148[i].unk14 = 0; - D_80382E20.unk148[i].unk18 = NULL; - D_80382E20.unk148[i].unk1C = NULL; - D_80382E20.unk148[i].unk20 = 0; - D_80382E20.unk148[i].unk4[0] = D_80382E20.unk148[i].unk4[1] = D_80382E20.unk148[i].unk4[2] = 0; + g_Dialog.unk148[i].unk0 = -1; + g_Dialog.unk148[i].unk2 = 0; + g_Dialog.unk148[i].unk10 = NULL; + g_Dialog.unk148[i].unk14 = 0; + g_Dialog.unk148[i].unk18 = NULL; + g_Dialog.unk148[i].unk1C = NULL; + g_Dialog.unk148[i].unk20 = 0; + g_Dialog.unk148[i].unk4[0] = g_Dialog.unk148[i].unk4[1] = g_Dialog.unk148[i].unk4[2] = 0; } - D_80382E20.state = 0; - D_80382E20.unk128_31 = D_80382E20.unk128_5 = FALSE; - D_80382E20.unk12C_31 = D_80382E20.unk12C_29 = D_80382E20.unk12C_27 = D_80382E20.unk12C_25 = 0; - D_80382E20.unk128_15 = D_80382E20.active_zoombox = FALSE; - D_80382E20.unk128_6 = TRUE; - D_80382E20.unk12C_23 = -1; - D_80382E20.unk12C_15 = D_80382E20.unk12C_11 = 0; - D_80382E20.unk130 = (s16) -1; - D_80382E20.caller = NULL; - D_80382E20.unk13C = NULL; - D_80382E20.unk140 = NULL; - D_80382E20.unk144 = 0; - D_80382E20.unk132 = 0xC; - D_80382E20.unk128_3 = TRUE; + g_Dialog.state = 0; + g_Dialog.unk128_31 = g_Dialog.unk128_5 = FALSE; + g_Dialog.unk12C_31 = g_Dialog.unk12C_29 = g_Dialog.unk12C_27 = g_Dialog.unk12C_25 = 0; + g_Dialog.unk128_15 = g_Dialog.active_zoombox = FALSE; + g_Dialog.unk128_6 = TRUE; + g_Dialog.unk12C_23 = -1; + g_Dialog.unk12C_15 = g_Dialog.unk12C_11 = 0; + g_Dialog.unk130 = (s16) -1; + g_Dialog.caller = NULL; + g_Dialog.unk13C = NULL; + g_Dialog.unk140 = NULL; + g_Dialog.unk144 = 0; + g_Dialog.unk132 = 0xC; + g_Dialog.unk128_3 = TRUE; } static void _gcdialog_freeZoomboxes(void){ s32 i; for(i =0; i < 2; i++){ - gczoombox_free(D_80382E20.zoombox[i]); - D_80382E20.zoombox[i] = NULL; + gczoombox_free(g_Dialog.zoombox[i]); + g_Dialog.zoombox[i] = NULL; } } @@ -127,34 +152,34 @@ void func_8030F078(void){ s32 i; s32 j; for(i = 0; i <2; i++){ - for(j =0; j < D_80382E20.string_count[i]; j++){ - D_80382E20.string_list[i][j].str = NULL; + for(j =0; j < g_Dialog.string_count[i]; j++){ + g_Dialog.string_list[i][j].str = NULL; } - D_80382E20.string_count[i] = 0; - free(D_80382E20.string_list[i]); - D_80382E20.string_list[i] = NULL; + g_Dialog.string_count[i] = 0; + free(g_Dialog.string_list[i]); + g_Dialog.string_list[i] = NULL; } - if(D_80382E20.unk130 != -1){ - dialogBin_release(D_80382E20.unk130); + if(g_Dialog.unk130 != -1){ + dialogBin_release(g_Dialog.unk130); } - D_80382E20.dialog_bin_ptr = NULL; + g_Dialog.dialog_bin_ptr = NULL; } void func_8030F130(void){ func_8030F078(); - if(D_80382E20.zoombox[1] != NULL && !D_80382E20.unk11A[1].unk0_7){ + if(g_Dialog.zoombox[1] != NULL && !g_Dialog.unk11A[1].unk0_7){ func_80347A14(1); } - if(!D_80382E20.unk11A[0].unk0_7 && !D_80382E20.unk11A[1].unk0_7){ + if(!g_Dialog.unk11A[0].unk0_7 && !g_Dialog.unk11A[1].unk0_7){ _gcdialog_freeZoomboxes(); } - D_80382E20.unk130 = -1; - D_80382E20.unk128_15 = 0; - D_80382E20.unk128_31 = 0; - D_80382E20.caller = NULL; - D_80382E20.unk13C = NULL; - D_80382E20.unk140 = NULL; - D_80382E20.unk144 = NULL; + g_Dialog.unk130 = -1; + g_Dialog.unk128_15 = 0; + g_Dialog.unk128_31 = 0; + g_Dialog.caller = NULL; + g_Dialog.unk13C = NULL; + g_Dialog.unk140 = NULL; + g_Dialog.unk144 = NULL; } void func_8030F1D0(void){ @@ -163,7 +188,7 @@ void func_8030F1D0(void){ } func_803114D0(); func_8030F130(); - D_80382E20.state = 0; + g_Dialog.state = 0; } void func_8030F218(char *next_state, char *arg1, char *arg2, bool arg3, bool arg4) { @@ -198,17 +223,17 @@ void func_8030F218(char *next_state, char *arg1, char *arg2, bool arg3, bool arg } void func_8030F338(void){ - if(D_80382E20.unk13C != NULL){ - if(D_80382E20.caller == NULL){ - D_80382E20.unk13C(D_80382E20.caller, D_80382E20.unk130, D_80382E20.unk12C_23); + if(g_Dialog.unk13C != NULL){ + if(g_Dialog.caller == NULL){ + g_Dialog.unk13C(g_Dialog.caller, g_Dialog.unk130, g_Dialog.unk12C_23); }else{ - if(func_8030EDC0(D_80382E20.caller, D_80382E20.unk138)){ - D_80382E20.unk13C(D_80382E20.caller, D_80382E20.unk130, D_80382E20.unk12C_23); + if(func_8030EDC0(g_Dialog.caller, g_Dialog.unk138)){ + g_Dialog.unk13C(g_Dialog.caller, g_Dialog.unk130, g_Dialog.unk12C_23); } } } - if(D_80382E20.unk128_31 & 0x8){ - if((!func_802E4A08() && !func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE)) || !D_80382E20.unk128_3){ + if(g_Dialog.unk128_31 & 0x8){ + if((!func_802E4A08() && !func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE)) || !g_Dialog.unk128_3){ func_8028F918(0); } }//L8030F3E8 @@ -219,7 +244,7 @@ void func_8030F338(void){ void gcdialog_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){ s32 i; for(i = 0; i<2; i++){ - gczoombox_draw(D_80382E20.zoombox[i], gfx, mtx, vtx); + gczoombox_draw(g_Dialog.zoombox[i], gfx, mtx, vtx); } } @@ -229,43 +254,43 @@ void gcdialog_setState(s32 next_state){ s32 v0 = 6; if(v0); - if(D_80382E20.state != v0 || next_state != v0){ + if(g_Dialog.state != v0 || next_state != v0){ switch(next_state){ case 1: for(i = 0; i < 2; i++){ - if(D_80382E20.zoombox[i] != NULL && D_80382E20.unk11A[i].unk0_7 == 0) - gczoombox_open(D_80382E20.zoombox[i]); + if(g_Dialog.zoombox[i] != NULL && g_Dialog.unk11A[i].unk0_7 == 0) + gczoombox_open(g_Dialog.zoombox[i]); } break; case 5: for(i =0; i < 2; i++){ - if(D_80382E20.zoombox[i] != NULL && D_80382E20.unk11A[i].unk0_7 == 0){ - gczoombox_minimize(D_80382E20.zoombox[i]); - gczoombox_close(D_80382E20.zoombox[i]); + if(g_Dialog.zoombox[i] != NULL && g_Dialog.unk11A[i].unk0_7 == 0){ + gczoombox_minimize(g_Dialog.zoombox[i]); + gczoombox_close(g_Dialog.zoombox[i]); } } break; case 6: for(i = 0; i< 2; i++){//L8030F59C - for(j = D_80382E20.string_index[i]; D_80382E20.string_list[i][j].cmd < -4 || D_80382E20.string_list[i][j].cmd >= 0; j++){ - if(D_80382E20.string_list[i][j].cmd == -7 && D_80382E20.unk140){ - if(D_80382E20.caller == NULL){ - D_80382E20.unk140(D_80382E20.caller, D_80382E20.unk130, *D_80382E20.string_list[i][j].str); + for(j = g_Dialog.string_index[i]; g_Dialog.string_list[i][j].cmd < -4 || g_Dialog.string_list[i][j].cmd >= 0; j++){ + if(g_Dialog.string_list[i][j].cmd == -7 && g_Dialog.unk140){ + if(g_Dialog.caller == NULL){ + g_Dialog.unk140(g_Dialog.caller, g_Dialog.unk130, *g_Dialog.string_list[i][j].str); }else{ - if(func_8030EDC0(D_80382E20.caller, D_80382E20.unk138)){ - D_80382E20.unk140(D_80382E20.caller, D_80382E20.unk130, *D_80382E20.string_list[i][j].str); + if(func_8030EDC0(g_Dialog.caller, g_Dialog.unk138)){ + g_Dialog.unk140(g_Dialog.caller, g_Dialog.unk130, *g_Dialog.string_list[i][j].str); } } } } } - D_80382E20.unk12C_25 = 0; + g_Dialog.unk12C_25 = 0; for(i=0; i< 2; i++){ - D_80382E20.unk11A[i].unk0_7 = 0; - if(D_80382E20.zoombox[i] != NULL){ - D_80382E20.unk12C_25 += (u8)func_803188B4(D_80382E20.zoombox[i]); + g_Dialog.unk11A[i].unk0_7 = 0; + if(g_Dialog.zoombox[i] != NULL){ + g_Dialog.unk12C_25 += (u8)func_803188B4(g_Dialog.zoombox[i]); } } break; @@ -277,16 +302,16 @@ void gcdialog_setState(s32 next_state){ case 8: func_8030F338(); for(i=0; i<2; i++){ - if(D_80382E20.unk11A[i].unk0_7 == 0){ - gczoombox_free(D_80382E20.zoombox[i]); - D_80382E20.zoombox[i] = NULL; + if(g_Dialog.unk11A[i].unk0_7 == 0){ + gczoombox_free(g_Dialog.zoombox[i]); + g_Dialog.zoombox[i] = NULL; } } break; default: break; } - D_80382E20.state = next_state; + g_Dialog.state = next_state; } } @@ -297,7 +322,7 @@ void func_8030F754(enum talk_pic_e portrait_id, s32 arg1){ switch(arg1){ case 1: //L8030F790 - D_80382E20.unk12C_31++; + g_Dialog.unk12C_31++; break; case 3: //L8030F7BC @@ -305,271 +330,290 @@ void func_8030F754(enum talk_pic_e portrait_id, s32 arg1){ break; case 4: //L8030F7CC - if(D_80382E20.state == 6){ - D_80382E20.unk12C_25--; - if(D_80382E20.unk12C_25 == 0){ - temp_a0 = ((D_80382E20.unk11A[0].unk0_7) ? 1 : 0); - temp_v0 = ((D_80382E20.unk11A[1].unk0_7) ? 1 : 0); + if(g_Dialog.state == 6){ + g_Dialog.unk12C_25--; + if(g_Dialog.unk12C_25 == 0){ + temp_a0 = ((g_Dialog.unk11A[0].unk0_7) ? 1 : 0); + temp_v0 = ((g_Dialog.unk11A[1].unk0_7) ? 1 : 0); gcdialog_setState((temp_v0 + temp_a0) ? 8 : 5); }//L8030F980 break; } - temp_v0 = ((D_80382E20.unk11A[0].unk0_7) ? 1 : 0) + ((D_80382E20.unk11A[1].unk0_7) ? 1 : 0); - if(temp_v0 > (s32)D_80382E20.unk12C_29){ - D_80382E20.unk12C_29++; - if(D_80382E20.unk128_15 == D_80382E20.unk12C_29 + D_80382E20.unk12C_27){ + temp_v0 = ((g_Dialog.unk11A[0].unk0_7) ? 1 : 0) + ((g_Dialog.unk11A[1].unk0_7) ? 1 : 0); + if(temp_v0 > (s32)g_Dialog.unk12C_29){ + g_Dialog.unk12C_29++; + if(g_Dialog.unk128_15 == g_Dialog.unk12C_29 + g_Dialog.unk12C_27){ gcdialog_setState(8); } } break; case 6: //L8030F8FC - D_80382E20.unk12C_27++; - if(D_80382E20.unk12C_27 == D_80382E20.unk128_15){ + g_Dialog.unk12C_27++; + if(g_Dialog.unk12C_27 == g_Dialog.unk128_15){ gcdialog_setState(7); }//L8030F964 - if(D_80382E20.unk128_15 == D_80382E20.unk12C_29 + D_80382E20.unk12C_27){ + if(g_Dialog.unk128_15 == g_Dialog.unk12C_29 + g_Dialog.unk12C_27){ gcdialog_setState(8); } break; }//L8030F984 } -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_87E30/gcdialog_update.s") -#else +#define CMD(i) (g_Dialog.string_list[g_Dialog.u8.active_zoombox] + i) +#define CMD2(i) (&g_Dialog.string_list[g_Dialog.u8.active_zoombox][i]) + void gcdialog_update(void) { - s32 spA8; s32 i; - s32 sp90[6]; - bool temp_v1_2; - s32 sp84[2]; - s32 sp80; + s32 spA8; + s32 controller_face_buttons[6]; + s32 controller_side_buttons[3]; + s32 ret; s32 sp7C; + s32 padding[4]; char *sp4C[8]; - s32 var_v0_6; - s32 var_a3; - s32 var_v0_2; - sp80 = -1; - if (D_80382E20.unk128_31 & 0x80) { - func_8024E5A8(0, sp90); - func_8024E640(0, sp84); + ret = -1; + + if (g_Dialog.u8.unk128_31 & 0x80) { + func_8024E5A8(0, controller_face_buttons); + func_8024E640(0, controller_side_buttons); } else { - func_8024E55C(0, sp90); - func_8024E60C(0, sp84); + func_8024E55C(0, controller_face_buttons); + func_8024E60C(0, controller_side_buttons); } - switch (D_80382E20.state) { /* switch 1 */ - case 1: /* switch 1 */ - var_a3 = 0;\ - for(i = 0; i < 2; i++){ - if(D_80382E20.zoombox[i] == NULL){ - var_a3++; + + switch (g_Dialog.state) { + case 1: + for(spA8 = 0, i = 0; i < 2; i++){ + if(g_Dialog.zoombox[i] == NULL){ + spA8++; + } + } + if (spA8 == 2) { + gcdialog_setState(7); + } else if (g_Dialog.u8.unk12C_31 == g_Dialog.u8.unk128_15) { + g_Dialog.u8.unk12C_31 = 0; + gcdialog_setState(2); + } + break; + + case 2: + if (g_Dialog.zoombox[g_Dialog.u8.active_zoombox] == NULL || func_80318BEC(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]) || g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_5) { + g_Dialog.u8.active_zoombox ^= 1; + } else { + g_Dialog.string_cmd[g_Dialog.u8.active_zoombox] = CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->cmd; + g_Dialog.string[g_Dialog.u8.active_zoombox] = CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str; + + switch (g_Dialog.string_cmd[g_Dialog.u8.active_zoombox]) { + case -2: + if (g_Dialog.string_index[g_Dialog.u8.active_zoombox] == 0) { + g_Dialog.u8.unk12C_29++; } - }; - if (var_a3 == 2) { - gcdialog_setState(7); - } else if (D_80382E20.unk128_15 == D_80382E20.unk12C_31) { - D_80382E20.unk12C_31 = 0; - gcdialog_setState(2); - } - break; + gczoombox_minimize(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); + g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_7 = 1; + g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_5 = 1; + g_Dialog.u8.active_zoombox ^= 1; + g_Dialog.unk128_6 = TRUE; + break; - case 2: /* switch 1 */ - if ((D_80382E20.zoombox[D_80382E20.active_zoombox] == NULL) || func_80318BEC(D_80382E20.zoombox[D_80382E20.active_zoombox]) || (D_80382E20.unk11A[D_80382E20.active_zoombox].unk0_5 != 0)) { - D_80382E20.active_zoombox ^= 1; - } else { - D_80382E20.string_cmd[D_80382E20.active_zoombox] = D_80382E20.string_list[D_80382E20.active_zoombox][D_80382E20.string_index[D_80382E20.active_zoombox]].cmd; - D_80382E20.string[D_80382E20.active_zoombox] = D_80382E20.string_list[D_80382E20.active_zoombox][D_80382E20.string_index[D_80382E20.active_zoombox]].str; - switch (D_80382E20.string_cmd[D_80382E20.active_zoombox]) { /* switch 2 */ - case -2: /* switch 2 */ - if (D_80382E20.string_index[D_80382E20.active_zoombox] == 0) { - D_80382E20.unk12C_29++; - } - gczoombox_minimize(D_80382E20.zoombox[D_80382E20.active_zoombox]); - D_80382E20.unk11A[D_80382E20.active_zoombox].unk0_7 = 1; - D_80382E20.unk11A[D_80382E20.active_zoombox].unk0_5 = 1; - D_80382E20.active_zoombox ^= 1; - D_80382E20.unk128_6 = TRUE; - break; + case -1: // Choice + g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_7 = 2; + gcdialog_setState(4); + break; - case -1: /* switch 2 */ - D_80382E20.unk11A[D_80382E20.active_zoombox].unk0_7 = 2; - gcdialog_setState(4); - break; + case -4: // Close + gczoombox_minimize(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); + gczoombox_close(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); + g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_7 = 0; + g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_5 = 1; + g_Dialog.u8.active_zoombox ^= 1; + g_Dialog.unk128_6 = TRUE; + break; - case -4: /* switch 2 */ - gczoombox_minimize(D_80382E20.zoombox[D_80382E20.active_zoombox]); - gczoombox_close(D_80382E20.zoombox[D_80382E20.active_zoombox]); - D_80382E20.unk11A[D_80382E20.active_zoombox].unk0_7 = 0; - D_80382E20.unk11A[D_80382E20.active_zoombox].unk0_5 = 1; - D_80382E20.active_zoombox ^= 1; - D_80382E20.unk128_6 = TRUE; - break; - - case -7: /* switch 2 */ - if (D_80382E20.unk140 != NULL) { - if (D_80382E20.caller == NULL) { - D_80382E20.unk140(D_80382E20.caller, D_80382E20.unk130, *D_80382E20.string[D_80382E20.active_zoombox]); - } else if (func_8030EDC0(D_80382E20.caller, D_80382E20.unk138)) { - D_80382E20.unk140(D_80382E20.caller, D_80382E20.unk130, *D_80382E20.string[D_80382E20.active_zoombox]); - } - } - D_80382E20.string_index[D_80382E20.active_zoombox]++; - break; - - case -9: /* switch 2 */ - case -8: /* switch 2 */ - do { - D_80382E20.string_index[D_80382E20.active_zoombox]++; - D_80382E20.string_cmd[D_80382E20.active_zoombox] = D_80382E20.string_list[D_80382E20.active_zoombox][D_80382E20.string_index[D_80382E20.active_zoombox]].cmd; - } while (D_80382E20.string_cmd[D_80382E20.active_zoombox] == -8 || D_80382E20.string_cmd[D_80382E20.active_zoombox] == -9); - break; - - case -6: /* switch 2 */ - for(var_v0_2 = D_80382E20.string_index[D_80382E20.active_zoombox]; - D_80382E20.string_list[D_80382E20.active_zoombox][var_v0_2].cmd < -4; - var_v0_2++){ - } - - if (D_80382E20.string_list[D_80382E20.active_zoombox][var_v0_2].cmd >= 0) { - func_803189C4(D_80382E20.zoombox[D_80382E20.active_zoombox], D_80382E20.string_list[D_80382E20.active_zoombox][var_v0_2].cmd + 0xC); - } - if (D_80382E20.string_index[D_80382E20.active_zoombox]) { - gczoombox_minimize(D_80382E20.zoombox[D_80382E20.active_zoombox]); - } - if ((D_80382E20.string_index[D_80382E20.active_zoombox] == 0) && (D_80382E20.unk11A[D_80382E20.active_zoombox].unk0_7 == 2)) { - gczoombox_minimize(D_80382E20.zoombox[D_80382E20.active_zoombox]); - } - D_80382E20.unk11A[D_80382E20.active_zoombox].unk0_7 = 0; - D_80382E20.string_index[D_80382E20.active_zoombox]++; - D_80382E20.active_zoombox ^= 1; - D_80382E20.unk128_6 = TRUE; - break; - - case -5: /* switch 2 */ - gczoombox_minimize(D_80382E20.zoombox[D_80382E20.active_zoombox]); - D_80382E20.unk11A[D_80382E20.active_zoombox].unk0_7 = 0; - D_80382E20.string_index[D_80382E20.active_zoombox]++; - D_80382E20.active_zoombox ^= 1; - D_80382E20.unk128_6 = TRUE; - break; - - case -3: /* switch 2 */ - D_80382E20.unk11A[D_80382E20.active_zoombox].unk0_7 = 0; - gcdialog_setState(4); - break; - - default: /* switch 2 */ - if (!func_80316ED4(D_80382E20.string_list[D_80382E20.active_zoombox][D_80382E20.string_index[D_80382E20.active_zoombox]].str)) { - D_80382E20.string_index[D_80382E20.active_zoombox]++; - } else { - if(D_80382E20.string_list[D_80382E20.active_zoombox][D_80382E20.string_index[D_80382E20.active_zoombox] + 1].cmd == -8){ - if (D_80382E20.unk144 != NULL) { - sp7C = 1; - - if (D_80382E20.caller == NULL) { - sp80 = D_80382E20.unk144(D_80382E20.caller, D_80382E20.unk130, D_80382E20.string_index[D_80382E20.active_zoombox]); - } - else if (func_8030EDC0(D_80382E20.caller, D_80382E20.unk138)) { - sp80 = D_80382E20.unk144(D_80382E20.caller, D_80382E20.unk130, D_80382E20.string_index[D_80382E20.active_zoombox]); - } - - if (sp80 < 0) { - sp80 = -1 - sp80; - sp7C = 0; - } - if((sp80 >= 0) && ((D_80382E20.string_list[D_80382E20.active_zoombox][D_80382E20.string_index[D_80382E20.active_zoombox] + sp80 + 1].cmd == -8))) { - strlen(D_80382E20.string_list[D_80382E20.active_zoombox][D_80382E20.string_index[D_80382E20.active_zoombox] + sp80 + 1].str); - strlen(D_80382E20.string_list[D_80382E20.active_zoombox][D_80382E20.string_index[D_80382E20.active_zoombox]].str); - func_8030F218(D_80382E20.output, D_80382E20.string_list[D_80382E20.active_zoombox][D_80382E20.string_index[D_80382E20.active_zoombox]].str, D_80382E20.string_list[D_80382E20.active_zoombox][D_80382E20.string_index[D_80382E20.active_zoombox] + sp80 + 1].str, func_8031B604(D_80382E20.string_list[D_80382E20.active_zoombox][D_80382E20.string_index[D_80382E20.active_zoombox]].str), sp7C); - } - else{ - sp80 = -1; - } - } - } else if(D_80382E20.string_list[D_80382E20.active_zoombox][D_80382E20.string_index[D_80382E20.active_zoombox] + 1].cmd == -9){ - if (D_80382E20.unk144 != NULL) { - D_80382FF8[0] = '\0'; - if (D_80382E20.caller == 0) { - sp80 = D_80382E20.unk144(D_80382E20.caller, D_80382E20.unk130, D_80382E20.string_index[D_80382E20.active_zoombox]); - } - else if (func_8030EDC0(D_80382E20.caller, D_80382E20.unk138)) { - sp80 = D_80382E20.unk144(D_80382E20.caller, D_80382E20.unk130, D_80382E20.string_index[D_80382E20.active_zoombox]); - } - strIToA(D_80382FF8, sp80); - strlen(D_80382FF8); - strlen(D_80382E20.string_list[D_80382E20.active_zoombox][D_80382E20.string_index[D_80382E20.active_zoombox]].str); - func_8030F218(D_80382E20.output, D_80382E20.string_list[D_80382E20.active_zoombox][D_80382E20.string_index[D_80382E20.active_zoombox]].str, &D_80382FF8, func_8031B604(D_80382E20.string_list[D_80382E20.active_zoombox][D_80382E20.string_index[D_80382E20.active_zoombox]].str), 0); - } - } - if (func_803189C4(D_80382E20.zoombox[D_80382E20.active_zoombox], D_80382E20.string_cmd[D_80382E20.active_zoombox] + 0xC)) { - gczoombox_minimize(D_80382E20.zoombox[D_80382E20.active_zoombox]); - D_80382E20.unk128_6 = TRUE; - } - if (D_80382E20.unk128_6) { - gczoombox_maximize(D_80382E20.zoombox[D_80382E20.active_zoombox]); - D_80382E20.unk128_6 = FALSE; - } - if (sp80 == -1) { - for(spA8 = D_80382E20.string_index[D_80382E20.active_zoombox]; - ((D_80382E20.string_list[D_80382E20.active_zoombox][spA8].cmd == D_80382E20.string_cmd[D_80382E20.active_zoombox]) && ((spA8 * 0) < 8)); - spA8++ - ){ - sp4C[spA8 - D_80382E20.string_index[D_80382E20.active_zoombox]] = D_80382E20.string_list[D_80382E20.active_zoombox][spA8].str; - } - func_80318284(D_80382E20.zoombox[D_80382E20.active_zoombox], spA8 - D_80382E20.string_index[D_80382E20.active_zoombox], sp4C); - D_80382E20.string_index[D_80382E20.active_zoombox] = spA8; - } else { - func_803183A4(D_80382E20.zoombox[D_80382E20.active_zoombox], D_80382E20.output); - D_80382E20.string_index[D_80382E20.active_zoombox]++; - } - gcdialog_setState(3); - } - break; - } - } - break; - case 3: /* switch 1 */ - temp_v1_2 = D_80382E20.unk128_31 & 0x80; - if (D_80382E20.unk128_0 && (sp90[FACE_BUTTON(BUTTON_B)] == 1)) { - gcdialog_setState(6); - } - else{ - if (!temp_v1_2) { - var_v0_6 = (temp_v1_2) ? func_8024E5E8(0, 4) : func_8024E5E8(0, 3); - if ((var_v0_6 ^ 1) == 0) { - gcdialog_setState(6); + case -7: // Trigger + if (g_Dialog.unk140 != NULL) { + if (g_Dialog.caller == NULL) { + g_Dialog.unk140(g_Dialog.caller, g_Dialog.unk130, *g_Dialog.string[g_Dialog.u8.active_zoombox]); + } else if (func_8030EDC0(g_Dialog.caller, g_Dialog.unk138)) { + g_Dialog.unk140(g_Dialog.caller, g_Dialog.unk130, *g_Dialog.string[g_Dialog.u8.active_zoombox]); } } - } - break; + g_Dialog.string_index[g_Dialog.u8.active_zoombox]++; + break; - case 4: /* switch 1 */ - if (sp90[FACE_BUTTON(BUTTON_A)] == 1) { - D_80382E20.unk12C_23 = 1; - } else if (sp90[FACE_BUTTON(BUTTON_B)] == 1) { - D_80382E20.unk12C_23 = 0; - } - if (D_80382E20.unk12C_23 != -1) { - // var_a0 = 5; - gcdialog_setState((D_80382E20.unk11A[D_80382E20.active_zoombox].unk0_7) ? 8 : 5); - } - break; + case -9: // Substitute integer + case -8: // Conditional text + do { + g_Dialog.string_index[g_Dialog.u8.active_zoombox]++; + g_Dialog.string_cmd[g_Dialog.u8.active_zoombox] = CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->cmd; + } while (g_Dialog.string_cmd[g_Dialog.u8.active_zoombox] == -8 || g_Dialog.string_cmd[g_Dialog.u8.active_zoombox] == -9); + break; - case 7: /* switch 1 */ - case 8: /* switch 1 */ - gcdialog_setState(0); + case -6: // Conditional minimize + for(spA8 = g_Dialog.string_index[g_Dialog.u8.active_zoombox]; CMD2(spA8)->cmd < -4; spA8++); + + if (CMD2(spA8)->cmd >= 0) { + func_803189C4(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], CMD2(spA8)->cmd + 0xC); + } + if (g_Dialog.string_index[g_Dialog.u8.active_zoombox]) { + gczoombox_minimize(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); + } + if (!g_Dialog.string_index[g_Dialog.u8.active_zoombox] && g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_7 == 2) { + gczoombox_minimize(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); + } + g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_7 = 0; + g_Dialog.string_index[g_Dialog.u8.active_zoombox]++; + g_Dialog.u8.active_zoombox ^= 1; + g_Dialog.unk128_6 = TRUE; + break; + + case -5: + gczoombox_minimize(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); + g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_7 = 0; + g_Dialog.string_index[g_Dialog.u8.active_zoombox]++; + g_Dialog.u8.active_zoombox ^= 1; + g_Dialog.unk128_6 = TRUE; + break; + + case -3: + g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_7 = 0; + gcdialog_setState(4); + break; + + default: + if (!func_80316ED4(CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str)) { + g_Dialog.string_index[g_Dialog.u8.active_zoombox]++; + } else { + if (CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox] + 1)->cmd == -8) { + // Conditional text - use callback to determine if text should be shown + if (g_Dialog.unk144 != NULL) { + sp7C = 1; + + if (g_Dialog.caller == NULL) { + ret = g_Dialog.unk144(g_Dialog.caller, g_Dialog.unk130, g_Dialog.string_index[g_Dialog.u8.active_zoombox]); + } else if (func_8030EDC0(g_Dialog.caller, g_Dialog.unk138)) { + ret = g_Dialog.unk144(g_Dialog.caller, g_Dialog.unk130, g_Dialog.string_index[g_Dialog.u8.active_zoombox]); + } + + if (ret < 0) { + ret = -1 - ret; + sp7C = 0; + } + + if(ret >= 0 && CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox] + ret + 1)->cmd == -8) { + strlen(CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox] + ret + 1)->str); + strlen(CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str); + + func_8030F218( + g_Dialog.output, + CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str, + CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox] + ret + 1)->str, + func_8031B604(CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str), + sp7C + ); + } else { + ret = -1; + } + } + } else if(CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox] + 1)->cmd == -9){ + // Integer substitution - use callback to determine integer value + // (used for player's note count in some messages) + if (g_Dialog.unk144 != NULL) { + // static char D_80382FF8[24]; + + D_80382FF8[0] = '\0'; + + if (g_Dialog.caller == NULL) { + ret = g_Dialog.unk144(g_Dialog.caller, g_Dialog.unk130, g_Dialog.string_index[g_Dialog.u8.active_zoombox]); + } else if (func_8030EDC0(g_Dialog.caller, g_Dialog.unk138)) { + ret = g_Dialog.unk144(g_Dialog.caller, g_Dialog.unk130, g_Dialog.string_index[g_Dialog.u8.active_zoombox]); + } + + strIToA(D_80382FF8, ret); + strlen(D_80382FF8); + strlen(CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str); + + func_8030F218( + g_Dialog.output, + CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str, + D_80382FF8, + func_8031B604(CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str), + 0 + ); + } + } + + if (func_803189C4(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], g_Dialog.string_cmd[g_Dialog.u8.active_zoombox] + 12)) { + gczoombox_minimize(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); + g_Dialog.unk128_6 = TRUE; + } + + if (g_Dialog.unk128_6) { + gczoombox_maximize(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); + g_Dialog.unk128_6 = FALSE; + } + + if (ret == -1) { + for (spA8 = g_Dialog.string_index[g_Dialog.u8.active_zoombox]; CMD(spA8)->cmd == g_Dialog.string_cmd[g_Dialog.u8.active_zoombox] && spA8 - g_Dialog.string_index[g_Dialog.u8.active_zoombox] < 8; spA8++) { + sp4C[spA8 - g_Dialog.string_index[g_Dialog.u8.active_zoombox]] = CMD(spA8)->str; + } + + func_80318284(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], spA8 - g_Dialog.string_index[g_Dialog.u8.active_zoombox], sp4C); + g_Dialog.string_index[g_Dialog.u8.active_zoombox] = spA8; + } else { + func_803183A4(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], g_Dialog.output); + g_Dialog.string_index[g_Dialog.u8.active_zoombox]++; + } + + gcdialog_setState(3); + } + break; + } + } + break; + + case 3: + if ((g_Dialog.u8.unk128_31 & 1) && controller_face_buttons[FACE_BUTTON(BUTTON_B)] == 1u) { + gcdialog_setState(6); break; + } + + if (g_Dialog.u8.unk128_31 & 0x80) { + break; + } + + if (NOT((g_Dialog.u8.unk128_31 & 0x80) ? func_8024E5E8(0, 4) : func_8024E5E8(0, 3))) { + break; + } + + gcdialog_setState(6); + break; + + case 4: // Waiting for player to make choice + if (controller_face_buttons[FACE_BUTTON(BUTTON_A)] == 1) { + g_Dialog.u8.unk12C_23 = 1; + } else if (controller_face_buttons[FACE_BUTTON(BUTTON_B)] == 1) { + g_Dialog.u8.unk12C_23 = 0; + } + + if (g_Dialog.u8.unk12C_23 != -1) { + gcdialog_setState(g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_7 ? 8 : 5); + } + break; + + case 7: + case 8: + gcdialog_setState(0); + break; } for(i = 0; i < 2; i++){ - gczoombox_update(D_80382E20.zoombox[i]); + gczoombox_update(g_Dialog.zoombox[i]); } } -#endif //parses text asset into seperate strings void func_80310574(s32 text_id){ @@ -580,12 +624,12 @@ void func_80310574(s32 text_id){ char ch; s32 len; - txt = D_80382E20.dialog_bin_ptr = dialogBin_get(text_id); + txt = g_Dialog.dialog_bin_ptr = dialogBin_get(text_id); for(i = 0; i < 2; i++){ - D_80382E20.string_count[i] = *(txt++); - D_80382E20.string_list[i] = (struct13s *) malloc(D_80382E20.string_count[i]*sizeof(struct13s)); - for(j = 0; j < D_80382E20.string_count[i]; j++){//L803105F0 + g_Dialog.string_count[i] = *(txt++); + g_Dialog.string_list[i] = (struct13s *) malloc(g_Dialog.string_count[i]*sizeof(struct13s)); + for(j = 0; j < g_Dialog.string_count[i]; j++){//L803105F0 ch = *(txt++); if(ch > 0 && ch < 0x20){ _v0 = -ch; @@ -594,10 +638,10 @@ void func_80310574(s32 text_id){ _v0 = (ch >= 0x80)? ch - 0x80 : ch; } - D_80382E20.string_list[i][j].cmd = _v0; + g_Dialog.string_list[i][j].cmd = _v0; len = *(txt); txt++; - D_80382E20.string_list[i][j].str = txt; + g_Dialog.string_list[i][j].str = txt; txt += len; } @@ -620,64 +664,64 @@ void func_803106BC(s32 text_id, s32 arg1, ActorMarker *marker, void(*callback)(A s32 temp_a2; func_80310574(text_id); - D_80382E20.unk12C_29 = 0; - D_80382E20.unk12C_31 = (D_80382E20.unk12C_25 = D_80382E20.unk12C_29); - D_80382E20.unk12C_27 = D_80382E20.unk12C_31; - D_80382E20.unk128_15 = D_80382E20.unk12C_27; + g_Dialog.unk12C_29 = 0; + g_Dialog.unk12C_31 = (g_Dialog.unk12C_25 = g_Dialog.unk12C_29); + g_Dialog.unk12C_27 = g_Dialog.unk12C_31; + g_Dialog.unk128_15 = g_Dialog.unk12C_27; for(j = 0; j < 2; j++){//L80310774 i = 0; - temp_a2 = D_80382E20.string_list[j][0].cmd; - while(D_80382E20.string_list[j][i].cmd < -4 && i < D_80382E20.string_count[j]){ + temp_a2 = g_Dialog.string_list[j][0].cmd; + while(g_Dialog.string_list[j][i].cmd < -4 && i < g_Dialog.string_count[j]){ i++; }; - D_80382E20.string_cmd[j] = temp_a2; + g_Dialog.string_cmd[j] = temp_a2; //L803107C4 - D_80382E20.string[j] = D_80382E20.string_list[j]->str; - D_80382E20.string_index[j] = 0; - D_80382E20.unk124[j] = func_8031068C(j); - D_80382E20.unk11A[j].unk0_5 = 0; - if(D_80382E20.string_list[j][i].cmd >= 0){ - if(!D_80382E20.unk11A[j].unk0_7){ - D_80382E20.zoombox[j] = gczoombox_new(D_80382E20.unk124[j], D_80382E20.string_list[j][i].cmd + 0xC, 0, func_803106A4(j), (void *)func_8030F754); + g_Dialog.string[j] = g_Dialog.string_list[j]->str; + g_Dialog.string_index[j] = 0; + g_Dialog.unk124[j] = func_8031068C(j); + g_Dialog.unk11A[j].unk0_5 = 0; + if(g_Dialog.string_list[j][i].cmd >= 0){ + if(!g_Dialog.unk11A[j].unk0_7){ + g_Dialog.zoombox[j] = gczoombox_new(g_Dialog.unk124[j], g_Dialog.string_list[j][i].cmd + 0xC, 0, func_803106A4(j), (void *)func_8030F754); if( j == 1 ){ func_80347A14(0); } } else{//L80310860 - D_80382E20.unk12C_31++; + g_Dialog.unk12C_31++; } //L80310880 - D_80382E20.unk128_15++; + g_Dialog.unk128_15++; }else{//L80310890 - if(D_80382E20.string_list[j][i].cmd < -2){ - if(D_80382E20.unk11A[j].unk0_7){ - gczoombox_close(D_80382E20.zoombox[j]); - D_80382E20.unk128_15++; + if(g_Dialog.string_list[j][i].cmd < -2){ + if(g_Dialog.unk11A[j].unk0_7){ + gczoombox_close(g_Dialog.zoombox[j]); + g_Dialog.unk128_15++; }else{ - D_80382E20.zoombox[j] = NULL; + g_Dialog.zoombox[j] = NULL; } - D_80382E20.unk11A[j].unk0_7 = 0; + g_Dialog.unk11A[j].unk0_7 = 0; }else{//L803108D8 - if(D_80382E20.unk11A[j].unk0_7){ - D_80382E20.unk128_15++; - D_80382E20.unk12C_31++; + if(g_Dialog.unk11A[j].unk0_7){ + g_Dialog.unk128_15++; + g_Dialog.unk12C_31++; } } }//L80310910 } - D_80382E20.unk130 = text_id; - D_80382E20.unk128_31 = arg1; - if(D_80382E20.string_cmd[0] < 0){ - D_80382E20.active_zoombox = 0; + g_Dialog.unk130 = text_id; + g_Dialog.unk128_31 = arg1; + if(g_Dialog.string_cmd[0] < 0){ + g_Dialog.active_zoombox = 0; }else{//L80310950 - D_80382E20.active_zoombox = 1; + g_Dialog.active_zoombox = 1; }//L8031095C - D_80382E20.unk128_6 = 1; - D_80382E20.unk12C_23 = ((func_802E4A08() || func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE)) && D_80382E20.unk128_3) ? 1 : -1; - D_80382E20.caller = marker; - D_80382E20.unk13C = callback; - D_80382E20.unk140 = arg4; - D_80382E20.unk144 = (void *)arg5; - D_80382E20.unk138 = (marker != NULL )? ((marker->unk5C)? marker->unk5C : -1) : 0; - gcdialog_setState(((func_802E4A08() || func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE)) && D_80382E20.unk128_3) ? 6 : 1); + g_Dialog.unk128_6 = 1; + g_Dialog.unk12C_23 = ((func_802E4A08() || func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE)) && g_Dialog.unk128_3) ? 1 : -1; + g_Dialog.caller = marker; + g_Dialog.unk13C = callback; + g_Dialog.unk140 = arg4; + g_Dialog.unk144 = (void *)arg5; + g_Dialog.unk138 = (marker != NULL )? ((marker->unk5C)? marker->unk5C : -1) : 0; + gcdialog_setState(((func_802E4A08() || func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE)) && g_Dialog.unk128_3) ? 6 : 1); //L803109EC } @@ -685,8 +729,8 @@ void func_80310A5C(s32 next_state, s32 arg1, s32 arg2, s32 arg3, s32 arg4){ s32 i; f32 tmpf; for(i = 0, tmpf = 0.4f; i< 2; i++){ - if(D_80382E20.zoombox[i]){ - func_803184C8(D_80382E20.zoombox[i], arg2, next_state, arg1, tmpf, arg3, arg4); + if(g_Dialog.zoombox[i]){ + func_803184C8(g_Dialog.zoombox[i], arg2, next_state, arg1, tmpf, arg3, arg4); } } } @@ -702,39 +746,39 @@ void func_80310B1C(s32 text_id, s32 arg1, ActorMarker *marker, void(*callback)(A } void func_80310BB4(s32 next_state, s32 arg1, s32 arg2){ - func_80310A5C(arg1, arg2, next_state, D_80382E20.unk128_31 & 2, D_80382E20.unk128_31 & 0x80); + func_80310A5C(arg1, arg2, next_state, g_Dialog.unk128_31 & 2, g_Dialog.unk128_31 & 0x80); } void func_80310BFC(void){ s32 ch; - if(D_80382E20.unk128_4){ - D_80382E20.unk132++; - ch = D_8036C4D0[D_80382E20.unk132]; - if(D_80382E20.zoombox[0] != NULL){ - D_80382E20.unk124[0] -= ch; - func_80318B7C(D_80382E20.zoombox[0], D_80382E20.unk124[0]); + if(g_Dialog.unk128_4){ + g_Dialog.unk132++; + ch = D_8036C4D0[g_Dialog.unk132]; + if(g_Dialog.zoombox[0] != NULL){ + g_Dialog.unk124[0] -= ch; + func_80318B7C(g_Dialog.zoombox[0], g_Dialog.unk124[0]); }//L80310C60 - if(D_80382E20.zoombox[1] != NULL){ - D_80382E20.unk124[1] += ch; - func_80318B7C(D_80382E20.zoombox[1], D_80382E20.unk124[1]); + if(g_Dialog.zoombox[1] != NULL){ + g_Dialog.unk124[1] += ch; + func_80318B7C(g_Dialog.zoombox[1], g_Dialog.unk124[1]); }//L80310C84 - if(D_80382E20.unk132 == 0xC){ - D_80382E20.unk128_5 = 0; + if(g_Dialog.unk132 == 0xC){ + g_Dialog.unk128_5 = 0; } }else{//L80310CA4 - D_80382E20.unk132--; - ch = D_8036C4D0[D_80382E20.unk132]; - if(D_80382E20.zoombox[0] != NULL){ - D_80382E20.unk124[0] += ch; - func_80318B7C(D_80382E20.zoombox[0], D_80382E20.unk124[0]); + g_Dialog.unk132--; + ch = D_8036C4D0[g_Dialog.unk132]; + if(g_Dialog.zoombox[0] != NULL){ + g_Dialog.unk124[0] += ch; + func_80318B7C(g_Dialog.zoombox[0], g_Dialog.unk124[0]); } - if(D_80382E20.zoombox[1] != NULL){ - D_80382E20.unk124[1] -= ch; - func_80318B7C(D_80382E20.zoombox[1], D_80382E20.unk124[1]); + if(g_Dialog.zoombox[1] != NULL){ + g_Dialog.unk124[1] -= ch; + func_80318B7C(g_Dialog.zoombox[1], g_Dialog.unk124[1]); } - if(D_80382E20.unk132 == 0){ - D_80382E20.unk128_5 = 0; + if(g_Dialog.unk132 == 0){ + g_Dialog.unk128_5 = 0; } } } @@ -742,45 +786,45 @@ void func_80310BFC(void){ void func_80310D2C(void){ struct14s * sp24; - if(D_80382E20.unk128_5) + if(g_Dialog.unk128_5) func_80310BFC(); if(getGameMode() == GAME_MODE_3_NORMAL || func_802E4A08()){ - if(D_80382E20.unk128_5) + if(g_Dialog.unk128_5) return; - if(!func_803114B0() && (s32)(D_80382E20.unk12C_15) > 0){ + if(!func_803114B0() && (s32)(g_Dialog.unk12C_15) > 0){ - sp24 = D_80382E20.unk148 + D_80382E20.unk12C_11; + sp24 = g_Dialog.unk148 + g_Dialog.unk12C_11; func_80310B1C(sp24->unk0,sp24->unk2, sp24->unk10, sp24->unk18, sp24->unk1C, sp24->unk20); - D_80382E20.unk138 = sp24->unk14; + g_Dialog.unk138 = sp24->unk14; func_8025A55C(8000, 300, 2); - if((sp24->unk2 & 0x8) && !((func_802E4A08() || func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE)) && D_80382E20.unk128_3)){//L80310E6C + if((sp24->unk2 & 0x8) && !((func_802E4A08() || func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE)) && g_Dialog.unk128_3)){//L80310E6C func_8028F918(0); if( 0.0f == sp24->unk4_x && 0.0f == sp24->unk4_y && 0.0f == sp24->unk4_z ){ - func_8028F918((D_80382E20.string_cmd[1] < 0)? 1 : 3); + func_8028F918((g_Dialog.string_cmd[1] < 0)? 1 : 3); } else{//L80310F00 - func_8028F94C((D_80382E20.string_cmd[1] < 0)? 1 : 3, sp24->unk4); + func_8028F94C((g_Dialog.string_cmd[1] < 0)? 1 : 3, sp24->unk4); } } //L80310F28 - D_80382E20.unk12C_11++; - if(!((s32) D_80382E20.unk12C_11 < 4)){ - D_80382E20.unk12C_11 = D_80382E20.unk12C_11 - 4; + g_Dialog.unk12C_11++; + if(!((s32) g_Dialog.unk12C_11 < 4)){ + g_Dialog.unk12C_11 = g_Dialog.unk12C_11 - 4; } - D_80382E20.unk12C_15--; + g_Dialog.unk12C_15--; }else{//L80310F88 gcdialog_update(); }//L80310F98 - if( ( D_80382E20.state != 0 && D_80382E20.state != 5 && D_80382E20.state != 7) - || ((!D_80382E20.state && (D_80382E20.unk11A[0].unk0_7 || D_80382E20.unk11A[1].unk0_7))) - || D_80382E20.unk12C_15 + if( ( g_Dialog.state != 0 && g_Dialog.state != 5 && g_Dialog.state != 7) + || ((!g_Dialog.state && (g_Dialog.unk11A[0].unk0_7 || g_Dialog.unk11A[1].unk0_7))) + || g_Dialog.unk12C_15 ){ //L80310FF0 if(func_802FADD4(0)){ @@ -838,11 +882,11 @@ int func_80311174(s32 text_id, s32 arg1, f32 *pos, ActorMarker *marker, void(*ca if(!func_803114B0()){ func_80310B1C(text_id, arg1, marker, (void *)callback, (void *)arg5, arg6); if(arg1 & 8){ - if(!(func_802E4A08() || func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE)) || !D_80382E20.unk128_3){//L80311214 + if(!(func_802E4A08() || func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE)) || !g_Dialog.unk128_3){//L80311214 if(pos != NULL){ - func_8028F94C(((D_80382E20.string_cmd[1] < 0)? 1 : 3), pos); + func_8028F94C(((g_Dialog.string_cmd[1] < 0)? 1 : 3), pos); }else{//L8031126C - func_8028F918(((D_80382E20.string_cmd[1] < 0)? 1 : 3)); + func_8028F918(((g_Dialog.string_cmd[1] < 0)? 1 : 3)); } } }//L8031128C @@ -850,40 +894,40 @@ int func_80311174(s32 text_id, s32 arg1, f32 *pos, ActorMarker *marker, void(*ca return 1; }else{//L803112A0 if(arg1 & 0x20){ - if(!(D_80382E20.unk128_31 & 0x80)){ + if(!(g_Dialog.unk128_31 & 0x80)){ func_803114D0(); } else{ - D_80382E20.unk12C_15 = 0; - D_80382E20.unk12C_11 = 0; + g_Dialog.unk12C_15 = 0; + g_Dialog.unk12C_11 = 0; } }//L803112E8 if(arg1 & 0x04 || arg1 & 0x20){ //L80311300 - temp_v1 = D_80382E20.unk12C_11 + D_80382E20.unk12C_15; + temp_v1 = g_Dialog.unk12C_11 + g_Dialog.unk12C_15; temp_v1 = (temp_v1 < 4)?temp_v1 : temp_v1 - 4; //L80311328 - D_80382E20.unk148[temp_v1].unk0 = text_id; - D_80382E20.unk148[temp_v1].unk2 = arg1; + g_Dialog.unk148[temp_v1].unk0 = text_id; + g_Dialog.unk148[temp_v1].unk2 = arg1; if(pos){ - D_80382E20.unk148[temp_v1].unk4[0] = pos[0]; - D_80382E20.unk148[temp_v1].unk4[1] = pos[1]; - D_80382E20.unk148[temp_v1].unk4[2] = pos[2]; + g_Dialog.unk148[temp_v1].unk4[0] = pos[0]; + g_Dialog.unk148[temp_v1].unk4[1] = pos[1]; + g_Dialog.unk148[temp_v1].unk4[2] = pos[2]; } else{ - D_80382E20.unk148[temp_v1].unk4[2] = 0.0f; - D_80382E20.unk148[temp_v1].unk4[1] = 0.0f; - D_80382E20.unk148[temp_v1].unk4[0] = 0.0f; + g_Dialog.unk148[temp_v1].unk4[2] = 0.0f; + g_Dialog.unk148[temp_v1].unk4[1] = 0.0f; + g_Dialog.unk148[temp_v1].unk4[0] = 0.0f; } - D_80382E20.unk148[temp_v1].unk10 = marker; - D_80382E20.unk148[temp_v1].unk14 = (marker != NULL )? ((marker->unk5C)? marker->unk5C : -1) : 0; - D_80382E20.unk148[temp_v1].unk18 = (void *)callback; - D_80382E20.unk148[temp_v1].unk1C = (void *)arg5; - D_80382E20.unk148[temp_v1].unk20 = arg6; - D_80382E20.unk12C_15++; + g_Dialog.unk148[temp_v1].unk10 = marker; + g_Dialog.unk148[temp_v1].unk14 = (marker != NULL )? ((marker->unk5C)? marker->unk5C : -1) : 0; + g_Dialog.unk148[temp_v1].unk18 = (void *)callback; + g_Dialog.unk148[temp_v1].unk1C = (void *)arg5; + g_Dialog.unk148[temp_v1].unk20 = arg6; + g_Dialog.unk12C_15++; if(arg1 & 0x08){ - if(!( func_802E4A08() || func_803203FC(0x1f, &D_80382E20)) || !D_80382E20.unk128_3){//L8031141C + if(!( func_802E4A08() || func_803203FC(0x1f, &g_Dialog)) || !g_Dialog.unk128_3){//L8031141C if(!func_8028EC04()){ if(pos != NULL){ func_8028F94C(2, pos); @@ -908,11 +952,11 @@ bool func_80311480(s32 text_id, s32 arg1, f32 *pos, ActorMarker *marker, void(*c } int func_803114B0(void){ - return (D_80382E20.unk130 + 1) != 0; + return (g_Dialog.unk130 + 1) != 0; } int func_803114C4(void){ - return D_80382E20.unk130; + return g_Dialog.unk130; } void func_803114D0(void){ @@ -921,21 +965,21 @@ void func_803114D0(void){ if(func_803114B0()){ gcdialog_setState(6); }else{ - if(D_80382E20.state != 6){ - D_80382E20.unk12C_25 = 0; + if(g_Dialog.state != 6){ + g_Dialog.unk12C_25 = 0; for(i = 0; i< 2; i++){ - D_80382E20.unk11A[i].unk0_7 = 0; - if(D_80382E20.zoombox[i]){ - D_80382E20.unk12C_25 += (u8)func_803188B4(D_80382E20.zoombox[i]); + g_Dialog.unk11A[i].unk0_7 = 0; + if(g_Dialog.zoombox[i]){ + g_Dialog.unk12C_25 += (u8)func_803188B4(g_Dialog.zoombox[i]); } } - if(D_80382E20.unk12C_25 != 0){ - D_80382E20.state = 6; + if(g_Dialog.unk12C_25 != 0){ + g_Dialog.state = 6; } } }//L80311594 - D_80382E20.unk12C_15 = 0; - D_80382E20.unk12C_11 = 0; + g_Dialog.unk12C_15 = 0; + g_Dialog.unk12C_11 = 0; } @@ -950,17 +994,17 @@ int func_803115C4(s32 next_state){ void func_80311604(void){ if(func_803114B0()){ - D_80382E20.unk128_5 = 1; - D_80382E20.unk128_4 = 0; - D_80382E20.unk132++; + g_Dialog.unk128_5 = 1; + g_Dialog.unk128_4 = 0; + g_Dialog.unk132++; } } void func_80311650(void){ if(func_803114B0()){ - D_80382E20.unk128_5 = 1; - D_80382E20.unk128_4 = 1; - D_80382E20.unk132--; + g_Dialog.unk128_5 = 1; + g_Dialog.unk128_4 = 1; + g_Dialog.unk132--; } } @@ -968,16 +1012,16 @@ void gcdialog_defrag(void){ s32 i; for(i = 0; i< 2; i++){ - func_80318C0C(D_80382E20.zoombox[i]); - if(D_80382E20.string_list[i]){ - D_80382E20.string_list[i] = (struct13s *)defrag(D_80382E20.string_list[i]); + func_80318C0C(g_Dialog.zoombox[i]); + if(g_Dialog.string_list[i]){ + g_Dialog.string_list[i] = (struct13s *)defrag(g_Dialog.string_list[i]); } - if(D_80382E20.zoombox[i] != NULL){ - D_80382E20.zoombox[i] = (gczoombox_t *)defrag(D_80382E20.zoombox[i]); + if(g_Dialog.zoombox[i] != NULL){ + g_Dialog.zoombox[i] = (gczoombox_t *)defrag(g_Dialog.zoombox[i]); } } } void func_80311714(int next_state){ - D_80382E20.unk128_3 = next_state; + g_Dialog.unk128_3 = next_state; } From d4ba75e1635077b7712f78ad4f14fb0126a3cfd9 Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Mon, 26 Aug 2024 20:51:17 -0500 Subject: [PATCH 24/38] update bk_rom_compressor, includes crc correction --- tools/bk_rom_compressor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/bk_rom_compressor b/tools/bk_rom_compressor index af9f3e18..934ff321 160000 --- a/tools/bk_rom_compressor +++ b/tools/bk_rom_compressor @@ -1 +1 @@ -Subproject commit af9f3e18913dfe5b1f5ed2b69b28946444538a9c +Subproject commit 934ff321b4d284db197dd5c5b8b446a8e3233520 From ac6099cbda6766b109a544ccce306a2b595742f9 Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Tue, 27 Aug 2024 20:31:47 -0500 Subject: [PATCH 25/38] func_80307948 match --- README.md | 3 +- progress/progress_core2.svg | 4 +- progress/progress_total.svg | 6 +- src/core2/code_7AF80.c | 111 ++++++++++++++---------------------- 4 files changed, 48 insertions(+), 76 deletions(-) diff --git a/README.md b/README.md index 68cfa99f..d70b2bc6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (99.5858%) +# banjo (99.6748%) @@ -26,7 +26,6 @@ Be sure to check scratch "family" for any progress that may not be reflected her | File | Function | Scratch Link | % | Notes | | ------------------ | --------------- | ---------------------------------------- | ------ | ----- | | core2/code_12F30.c | func_80299EC0 | [Ar62G](https://decomp.me/scratch/Ar62G) | 77.65% | -| core2/code_7AF80.c | func_80307948 | [zd8KD](https://decomp.me/scratch/zd8KD) | 85.40% | | core2/code_B9770.c | func_80340BE4 | [FXyYS](https://decomp.me/scratch/FXyYS) | 65.91% | spline function | core2/code_B9770.c | func_803411B0 | [rHkDu](https://decomp.me/scratch/rHkDu) | 87.70% | spline function diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index d08e45ea..efcb53a1 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -17,7 +17,7 @@ core2 - 99.2781% - 99.2781% + 99.4332% + 99.4332% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 7e705082..00f24a0d 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 99.5858% - 99.5858% + 99.6748% + 99.6748% \ No newline at end of file diff --git a/src/core2/code_7AF80.c b/src/core2/code_7AF80.c index 43706546..19a350e1 100644 --- a/src/core2/code_7AF80.c +++ b/src/core2/code_7AF80.c @@ -119,13 +119,6 @@ struct { u8 D_80381FE8[0x50]; -Cube *D_80382038[0x1C]; //static? -s32 D_803820A8[3]; //local static -s32 D_803820B4; //local static -s32 D_803820B8[0x20]; //ActorProp *, (maybe Prop *) -s32 pad_80382138; - - /* .code */ void func_80301F10(Cube *cube, Gfx **gfx, Mtx **mtx, Vtx **vtx){ @@ -671,6 +664,7 @@ BKCollisionTri * func_80303AF0(f32 position[3], f32 radius, f32 arg2[3], u32 arg return var_s5; } +s32 D_803820B8[0x20]; //ActorProp *, (maybe Prop *) void func_80303C54(Cube *cube, ActorMarker *marker, f32 arg2, s32 arg3, s32 *arg4, s32 *arg5) { ActorProp *phi_s0; @@ -694,12 +688,12 @@ void func_80303C54(Cube *cube, ActorMarker *marker, f32 arg2, s32 arg3, s32 *arg }; } +s32 D_8038213C; void func_80303D78(ActorMarker *arg0, f32 arg1, UNK_TYPE(s32) arg2) { s32 sp6C[3]; s32 sp60[3]; s32 sp5C; f32 sp50[3]; - static s32 D_8038213C; sp5C = 0; @@ -1927,72 +1921,53 @@ bool func_803077FC(f32 arg0[3], s32 *arg1, s32 *arg2, s32 arg3, u32 arg4) { return FALSE; } -#ifndef NONMATCHING -Cube **func_80307948(s32 arg0[3]); -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_7AF80/func_80307948.s") -#else -Cube **func_80307948(s32 arg0[3]) { - s32 sp34[3]; - s32 sp24[3]; - // ? *var_a2; - s32 *var_a1; - Cube *var_t2; - s32 *var_v0; - s32 temp_a0; - s32 temp_a1; - s32 temp_a1_2; - s32 temp_a2; - s32 temp_a2_2; - s32 temp_lo; - s32 temp_t0; - s32 temp_t0_2; - s32 temp_t5; - s32 temp_t6; - s32 temp_t6_2; - s32 temp_t7; - s32 temp_t7_2; - s32 temp_t8; - s32 temp_t9; - s32 temp_v0; - s32 temp_v1; - s32 var_a0; - s32 var_a0_2; - s32 var_a3; - s32 var_t1; - s32 var_v0_2; - s32 var_v1; - s32 i; +Cube **func_80307948(int* arg0) { + int sp34[3]; + s32 cubeCount; + int sp24[3]; + static Cube *D_80382038[0x1C]; + s32 idx; + s32 base; - for(i = 0; i < 3; i++){ - sp34[i] = ((arg0[i] >= 0) ? (arg0[i] / 1000) : ((arg0[i]/1000) - 1)) - D_80381FA0.min[i]; + for(cubeCount = 0; cubeCount < 3; cubeCount++){ + sp34[cubeCount] = ((arg0[cubeCount] >= 0) ? (arg0[cubeCount] / 1000) : ((arg0[cubeCount]/1000) - 1)) - D_80381FA0.min[cubeCount]; } - var_v1 = 0; - if( (sp34[0] > 0) && (sp34[0] < (D_80381FA0.width[0] - 1)) - && (sp34[1] > 0) && (sp34[1] < (D_80381FA0.width[1] - 1)) - && (sp34[2] > 0) && (sp34[2] < (D_80381FA0.width[2] - 1)) + cubeCount = 0; + + if( sp34[0] > 0 && sp34[0] < D_80381FA0.width[0] - 1 + && sp34[1] > 0 && sp34[1] < D_80381FA0.width[1] - 1 + && sp34[2] > 0 && sp34[2] < D_80381FA0.width[2] - 1 ) { - for(sp24[0] = sp34[0] - 1; sp24[0] < sp34[0] + 2; sp24[0]++){ - for(sp24[1] = sp34[1] - 1; sp24[1] < sp34[1] + 2; sp24[1]++){ - for(sp24[2] = sp34[2] - 1; sp24[2] < sp34[2] + 2; sp24[2]++){ - temp_lo = sp24[0] + (sp24[1] * D_80381FA0.stride[0]) + (sp24[2] * D_80381FA0.stride[1]); - if (var_t2[temp_lo].unk0_4) { - D_80382038[var_v1++] = D_80381FA0.cube_list + temp_lo; + base = (sp34[0] - 1) + + (sp34[1] - 1) * D_80381FA0.stride[0] + + (sp34[2] - 1) * D_80381FA0.stride[1]; + idx = base; + + for(sp24[0] = 0; sp24[0] < 3; sp24[0]++){ + for(sp24[1] = 0; sp24[1] < 3; sp24[1]++, idx += D_80381FA0.stride[0] - 3){ + for(sp24[2] = 0; sp24[2] < 3; sp24[2]++, idx++){ + if (D_80381FA0.cube_list[idx].unk0_4) { + D_80382038[cubeCount] = &D_80381FA0.cube_list[idx]; + cubeCount++; } } } + base += D_80381FA0.stride[1]; + idx = base; } } else { for(sp24[0] = sp34[0] - 1; sp24[0] < sp34[0] + 2; sp24[0]++){ - if ((sp24[0] >= 0) && (sp24[0] < D_80381FA0.width[0])) { + if (sp24[0] >= 0 && sp24[0] < D_80381FA0.width[0]) { for(sp24[1] = sp34[1] - 1; sp24[1] < sp34[1] + 2; sp24[1]++){ - if ((sp24[1] >= 0) && (sp24[1] < D_80381FA0.width[1])) { + if (sp24[1] >= 0 && sp24[1] < D_80381FA0.width[1]) { for(sp24[2] = sp34[2] - 1; sp24[2] < sp34[2] + 2; sp24[2]++){ - if ((sp24[2] >= 0) && (sp24[2] < D_80381FA0.width[2])) { - temp_lo = sp24[0] + (sp24[1] * D_80381FA0.stride[0]) + (sp24[2] * D_80381FA0.stride[1]); - if (D_80381FA0.cube_list[temp_lo].unk0_4) { - D_80382038[var_v1] = D_80381FA0.cube_list + temp_lo; - var_v1++; + if (sp24[2] >= 0 && sp24[2] < D_80381FA0.width[2]) { + idx = sp24[0] + sp24[1] * D_80381FA0.stride[0] + sp24[2] * D_80381FA0.stride[1]; + + if (D_80381FA0.cube_list[idx].unk0_4) { + D_80382038[cubeCount] = &D_80381FA0.cube_list[idx]; + cubeCount++; } } } @@ -2001,10 +1976,11 @@ Cube **func_80307948(s32 arg0[3]) { } } } - D_80382038[var_v1] = NULL; + + D_80382038[cubeCount] = NULL; return D_80382038; } -#endif + void func_80307CA0(ActorMarker *marker) { s32 temp_s4; @@ -2057,9 +2033,6 @@ u32 func_80307E1C(void) { return phi_v1; } -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_7AF80/func_80307EA8.s") -#else u32 func_80307EA8(s32 arg0, s32 arg1[3], s32 *arg2, s32 *arg3) { s32 temp_lo; s32 temp_t1; @@ -2116,7 +2089,6 @@ u32 func_80307EA8(s32 arg0, s32 arg1[3], s32 *arg2, s32 *arg3) { return var_s4; } -#endif NodeProp *func_803080C8(s32 arg0) { s32 sp3C[3]; @@ -2182,11 +2154,12 @@ bool func_803082D8(Cube *arg0, s32 *arg1, bool arg2, bool arg3) { return var_a0; } +Cube *D_80382144; s32 func_803083B0(s32 arg0) { s32 var_v0; Cube *var_s0; + static u8 a; static s32 D_80382140; - static Cube *D_80382144; if (arg0 == -1) { var_s0 = D_80381FA0.cube_list; From 01776fb5bfc3f7522982ae4de5f036917b348998 Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Wed, 28 Aug 2024 21:48:23 -0500 Subject: [PATCH 26/38] func_80340BE4 match --- README.md | 3 +- progress/progress_core2.svg | 6 +- progress/progress_total.svg | 4 +- src/core2/code_B9770.c | 115 +++++++++++++++++++++--------------- 4 files changed, 72 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index d70b2bc6..18a0b975 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (99.6748%) +# banjo (99.7661%) @@ -26,7 +26,6 @@ Be sure to check scratch "family" for any progress that may not be reflected her | File | Function | Scratch Link | % | Notes | | ------------------ | --------------- | ---------------------------------------- | ------ | ----- | | core2/code_12F30.c | func_80299EC0 | [Ar62G](https://decomp.me/scratch/Ar62G) | 77.65% | -| core2/code_B9770.c | func_80340BE4 | [FXyYS](https://decomp.me/scratch/FXyYS) | 65.91% | spline function | core2/code_B9770.c | func_803411B0 | [rHkDu](https://decomp.me/scratch/rHkDu) | 87.70% | spline function ## Building diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index efcb53a1..36d13e1c 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ core2 - 99.4332% - 99.4332% + 99.5923% + 99.5923% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index 00f24a0d..a2555e35 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 99.6748% - 99.6748% + 99.7661% + 99.7661% \ No newline at end of file diff --git a/src/core2/code_B9770.c b/src/core2/code_B9770.c index ccf3d0af..32c5e4e3 100644 --- a/src/core2/code_B9770.c +++ b/src/core2/code_B9770.c @@ -260,79 +260,96 @@ f32 glspline_catmull_rom_interpolate(f32 x, s32 knotCount, f32 *knotList) { return (((((sp24[2] * x) + sp24[1]) * x) + sp24[0]) * x) + (1.0*knotList[1]); } -#ifndef NONMATCHING -void func_80340BE4(f32 arg0, s32 arg1, s32 arg2, s32 arg3, f32 * arg4, f32 arg5[3]); -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B9770/func_80340BE4.s") -#else -void func_80340BE4(f32 x, s32 length, s32 stride, s32 width, f32 *arg4, f32 *dst){ - s32 spD0; +void func_80340BE4(f32 x, s32 length, s32 stride, s32 width, f32 *arg4, f32 dst[3]){ + s32 padding; s32 max_interval; - s32 i; - s32 var_a3; + s32 a3; f32 temp_f2; f32 f3; f32 f1; f32 f2; + f32 *t0; f32 sp94[3][3]; max_interval = length - 1; + if (length < 4) { /* not enough points in spline to perform catmull-rom interpolation*/ ml_vec3f_copy(sp94[0], arg4); ml_vec3f_copy(sp94[1], arg4); - ml_vec3f_copy(sp94[2], arg4 + stride); + ml_vec3f_copy(sp94[2], &arg4[stride]); if (length - 1 == 1) { - ml_vec3f_copy(sp94[3], arg4 + stride); + ml_vec3f_copy(sp94[3], &arg4[stride]); } else { - ml_vec3f_copy(sp94[3], arg4 + 2*stride); + ml_vec3f_copy(sp94[3], &arg4[stride*2]); } - func_80340BE4(x, 4, 3, 3, sp94, dst); + func_80340BE4(x, 4, 3, 3, (f32 *) sp94, dst); return; } - + temp_f2 = func_80340700(x, 0.0f, 1.0f) * max_interval; - var_a3 = (s32)temp_f2; - var_a3 = ((length - 1) < var_a3) ? (length - 1) : var_a3; - x = temp_f2 - (f32) var_a3; - if (0 == var_a3) { - /* desired point in interval[0,1], duplicate P0 to left */ - arg4 = arg4 + 0; - for(var_a3 = var_a3; var_a3 < width; var_a3++){ - f3 = -0.5*arg4[var_a3] + 1.5*arg4[var_a3] + -1.5*arg4[stride + var_a3] + 0.5*arg4[2*stride + var_a3]; - f1 = 1.0*arg4[var_a3] + -2.5*arg4[var_a3] + 2.0*arg4[stride + var_a3] + -0.5*arg4[2*stride + var_a3]; - f2 = -0.5*arg4[var_a3] + 0.0*arg4[var_a3] + 0.5*arg4[stride + var_a3] + 0.0*arg4[2*stride + var_a3]; - dst[var_a3] = ((((f3 * x) + f1)* x + f2) * x) + (1.0*arg4[var_a3]); - } - return; + a3 = temp_f2; + + if (a3 > (length - 1)) { + a3 = (length - 1); } - spD0 = var_a3 - 1; - if (length == (var_a3 + 1)) { - arg4 = arg4 + spD0*stride; - for(var_a3 = 0; var_a3 < width; var_a3++){ - /* desired point in interval[n, inf], linearly interpret */ - dst[var_a3] = arg4[var_a3]; - } - } else if (length == (spD0 + 2)) { - /* desired point in interval[n-1, n], duplicate Pn to right */ - for(var_a3 = 0; var_a3 < width; var_a3++){ - f3 = -0.5*arg4[spD0*stride + var_a3] + 1.5*arg4[(spD0 + 1)* stride + var_a3] + -1.5*arg4[(spD0 + 2)* stride + var_a3] + 0.5*arg4[(spD0 + 2)* stride + var_a3]; - f1 = 1.0*arg4[spD0*stride + var_a3] + -2.5*arg4[(spD0 + 1)* stride + var_a3] + 2.0*arg4[(spD0 + 2)* stride + var_a3] + -0.5*arg4[(spD0 + 2)* stride + var_a3]; - f2 = -0.5*arg4[spD0*stride + var_a3] + 0.0*arg4[(spD0 + 1)* stride + var_a3] + 0.5*arg4[(spD0 + 2)* stride + var_a3] + 0.0*arg4[(spD0 + 2)* stride + var_a3]; - dst[var_a3] = ((((f3 * x) + f1)* x + f2) * x) + (1.0*arg4[((spD0 + 1) * stride) + var_a3]); + + x = temp_f2 - a3; + + if (a3 == 0) { + /* desired point in interval[0,1], duplicate P0 to left */ + t0 = arg4; + t0 += (stride * 2); + + for (; a3 < width; a3++) { + f3 = -0.5*arg4[a3] + 1.5*arg4[a3] + -1.5*arg4[stride + a3] + 0.5*t0[a3]; + f1 = 1.0*arg4[a3] + -2.5*arg4[a3] + 2.0*arg4[stride + a3] + -0.5*t0[a3]; + if (1); + f2 = -0.5*arg4[a3] + 0.0*arg4[a3] + 0.5*arg4[stride + a3] + 0.0*t0[a3]; + + dst[a3] = (1.0*arg4[a3]) + (((f3 * x + f1) * x + f2) * x); } } else { - /* normal conditions */ - for(var_a3 = 0; var_a3 < width; var_a3++){ - f3 = -0.5*arg4[spD0*stride + var_a3] + 1.5*arg4[(spD0 + 1)*stride + var_a3] + -1.5*arg4[(spD0 + 2)* stride + var_a3] + 0.5*arg4[(spD0 + 3)* stride + var_a3]; - f1 = 1.0*arg4[spD0*stride + var_a3] + -2.5*arg4[(spD0 + 1)*stride + var_a3] + 2.0*arg4[(spD0 + 2)* stride + var_a3] + -0.5*arg4[(spD0 + 3)* stride + var_a3]; - f2 = -0.5*arg4[spD0*stride + var_a3] + 0.0*arg4[(spD0 + 1)*stride + var_a3] + 0.5*arg4[(spD0 + 2)* stride + var_a3] + 0.0*arg4[(spD0 + 3)* stride + var_a3]; - // var_f8 = - dst[var_a3] = ((((f3 * x) + f1)* x + f2) * x) + (1.0*arg4[(spD0 + 1)*stride + var_a3]); + a3--; + + if (a3 == length - 2) { + arg4 += stride * (length - 1); + + for (a3 = 0; a3 < width; a3++) { + /* desired point in interval[n, inf], linearly interpret */ + dst[a3] = arg4[a3]; + } + } else if (a3 == length - 3) { + /* desired point in interval[n-1, n], duplicate Pn to right */ + arg4 += a3 * stride; + + t0 = arg4; + t0 += (stride * 2); + + for (a3 = 0; a3 < width; a3++) { + f3 = -0.5*arg4[a3] + 1.5*arg4[stride + a3] + -1.5*t0[a3] + 0.5*t0[a3]; + f1 = 1.0*arg4[a3] + -2.5*arg4[stride + a3] + 2.0*t0[a3] + -0.5*t0[a3]; + f2 = -0.5*arg4[a3] + 0.0*arg4[stride + a3] + 0.5*t0[a3] + 0.0*t0[a3]; + + dst[a3] = (1.0*arg4[stride + a3]) + (((f3 * x + f1) * x + f2) * x); + } + } else { + /* normal conditions */ + arg4 += a3 * stride; + + t0 = arg4; + t0 += (stride * 2); + + for (a3 = 0; a3 < width; a3++) { + f3 = -0.5*arg4[a3] + 1.5*arg4[stride + a3] + -1.5*t0[a3] + 0.5*arg4[stride*3 + a3]; + f1 = 1.0*arg4[a3] + -2.5*arg4[stride + a3] + 2.0*t0[a3] + -0.5*arg4[stride*3 + a3]; + f2 = -0.5*arg4[a3] + 0.0*arg4[stride + a3] + 0.5*t0[a3] + 0.0*arg4[stride*3 + a3]; + + dst[a3] = (1.0*arg4[stride + a3]) + (((f3 * x + f1) * x + f2) * x); + } } } - } -#endif void func_80341180(f32 arg0, s32 arg1, s32 arg2, f32 arg3[3], f32 arg4[3]){ func_80340BE4(arg0, arg1, arg2, arg2, arg3, arg4); From e1ca9892de5139196ee001e43a295359d1df5bdc Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Thu, 29 Aug 2024 02:42:08 -0500 Subject: [PATCH 27/38] func_80299EC0 match --- README.md | 3 +- progress/progress_core2.svg | 6 +-- progress/progress_total.svg | 4 +- src/core2/code_12F30.c | 85 ++++++++++++++++++++----------------- 4 files changed, 53 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 18a0b975..ee294fd6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (99.7661%) +# banjo (99.8594%) @@ -25,7 +25,6 @@ Be sure to check scratch "family" for any progress that may not be reflected her | File | Function | Scratch Link | % | Notes | | ------------------ | --------------- | ---------------------------------------- | ------ | ----- | -| core2/code_12F30.c | func_80299EC0 | [Ar62G](https://decomp.me/scratch/Ar62G) | 77.65% | | core2/code_B9770.c | func_803411B0 | [rHkDu](https://decomp.me/scratch/rHkDu) | 87.70% | spline function ## Building diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index 36d13e1c..c9f3e400 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -9,7 +9,7 @@ - + @@ -17,7 +17,7 @@ core2 - 99.5923% - 99.5923% + 99.7549% + 99.7549% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index a2555e35..c992390c 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -17,7 +17,7 @@ Banjo-Kazooie (us.v10) - 99.7661% - 99.7661% + 99.8594% + 99.8594% \ No newline at end of file diff --git a/src/core2/code_12F30.c b/src/core2/code_12F30.c index 65877856..60f7ab7c 100644 --- a/src/core2/code_12F30.c +++ b/src/core2/code_12F30.c @@ -93,14 +93,14 @@ struct { D_8037C6F0; /*.code */ -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_12F30/func_80299EC0.s") -#else void func_80299EC0(f32 arg0[3]) { f32 spEC[3]; //player_pos f32 spE0[3]; f32 spD4[3]; + f32 a; + f32 f0; BKModelBin *spC8; + f32 f2; f32 spB8[3]; f32 spAC[3]; f32 spA0[3]; @@ -110,17 +110,14 @@ void func_80299EC0(f32 arg0[3]) { f32 sp70; BKCollisionTri *sp6C; //floor_vtx_list f32 sp48[3][3]; //tri_vtx_coord - f32 temp_f0_2; - f32 temp_f2_2; - f32 temp_f2_4; Vtx *vtx_buffer; Vtx *temp_v1; - f32 phi_f18; + f32 f18; + arg0[2] = + arg0[1] = + arg0[0] = 255; - arg0[0] = 255.0f;\ - arg0[1] = 255.0f;\ - arg0[2] = 255.0f; if (D_8037C6F0.unk0 == 1) { sp78 = 50; } else if (func_8028EE84() == BSWATERGROUP_0_NONE) { @@ -134,77 +131,89 @@ void func_80299EC0(f32 arg0[3]) { if (spC8 == NULL) { sp6C = NULL; } - if ((spEC[1] - func_80294438()) > 100.0f) { + if ((spEC[1] - func_80294438()) > 100) { sp6C = NULL; } if (sp6C == NULL) return; if (sp6C->unk6 &2) return; vtx_buffer = vtxList_getVertices(model_getVtxList(spC8)); + for(i = 0; i<3; i++){ temp_v1 = vtx_buffer + sp6C->unk0[i]; sp48[i][0] = (f32) temp_v1->v.ob[0]; sp48[i][1] = (f32) temp_v1->v.ob[1]; sp48[i][2] = (f32) temp_v1->v.ob[2]; - sp48[i][1] = 0.0f; + sp48[i][1] = 0; sp7C[i][0] = (f32) temp_v1->v.cn[0]; sp7C[i][1] = (f32) temp_v1->v.cn[1]; sp7C[i][2] = (f32) temp_v1->v.cn[2]; } - // spEC[1] = 0.0f; + + spEC[1] = 0; spE0[0] = spEC[0] - sp48[0][0]; + spE0[1] = 0; spE0[2] = spEC[2] - sp48[0][2]; - spE0[1] = 0.0f; spAC[0] = sp48[0][0] - sp48[1][0]; + spAC[1] = 0; spAC[2] = sp48[0][2] - sp48[1][2]; - spAC[1] = 0.0f; - - spB8[0] = -(sp48[2][2] - sp48[1][2]); - spB8[2] = sp48[2][0] - sp48[1][0]; - spB8[1] = 0.0f; - - phi_f18 = (spE0[0] * spB8[0]) + (spE0[1] * spB8[1]) + (spB8[2] * spE0[2]); - phi_f18 = (phi_f18 == 0.0f)? 0.1f : phi_f18; - - temp_f0_2 = -((spB8[2] * spAC[2]) + ((spAC[0] * spB8[0]) + 0.0f)) / phi_f18; - spA0[0] = (spE0[0] * temp_f0_2) + sp48[0][0]; - spA0[1] = 0.0f; - spA0[2] = (spE0[2] * temp_f0_2) + sp48[0][2]; + + spB8[0] = sp48[2][0] - sp48[1][0]; + spB8[1] = 0; + spB8[2] = sp48[2][2] - sp48[1][2]; + //swap + sp70 = spB8[0]; + spB8[0] = -spB8[2]; + spB8[2] = sp70; + + f18 = spE0[0]*spB8[0] + spE0[1]*spB8[1] + spE0[2]*spB8[2]; + if (f18 == 0) { + f18 = 0.1; + } + + f0 = -(spAC[0]*spB8[0] + spAC[1]*spB8[1] + spAC[2]*spB8[2]) / f18; + spA0[0] = sp48[0][0] + (spE0[0] * f0); + spA0[1] = 0; + spA0[2] = sp48[0][2] + (spE0[2] * f0); + spD4[0] = spA0[0] - sp48[1][0]; spD4[1] = spA0[1] - sp48[1][1]; spD4[2] = spA0[2] - sp48[1][2]; - temp_f2_2 = gu_sqrtf(spD4[0]*spD4[0] + spD4[1]*spD4[1] + spD4[2]*spD4[2]) / (gu_sqrtf(spB8[0] * spB8[0] + spB8[1] * spB8[1] + spB8[2] * spB8[2]) + 0.01); + f2 = gu_sqrtf(spD4[0]*spD4[0] + spD4[1]*spD4[1] + spD4[2]*spD4[2]) + / (gu_sqrtf(spB8[0]*spB8[0] + spB8[1]*spB8[1] + spB8[2]*spB8[2]) + 0.01); for(i = 0; i < 3; i++){ - arg0[i] = sp7C[1][i] + (sp7C[2][i] - sp7C[1][i])*temp_f2_2; + arg0[i] = sp7C[1][i] + (sp7C[2][i] - sp7C[1][i]) * f2; } spD4[0] = spA0[0] - sp48[0][0]; spD4[1] = spA0[1] - sp48[0][1]; spD4[2] = spA0[2] - sp48[0][2]; - temp_f2_4 = (1.0 - (gu_sqrtf(spE0[0]*spE0[0] + spE0[1]*spE0[1] + spE0[2]*spE0[2]) / (gu_sqrtf(spD4[0]*spD4[0] + spD4[1]*spD4[1] + spD4[2]*spD4[2]) + 0.01))); + f2 = 1 - (gu_sqrtf(spE0[0]*spE0[0] + spE0[1]*spE0[1] + spE0[2]*spE0[2]) + / (gu_sqrtf(spD4[0]*spD4[0] + spD4[1]*spD4[1] + spD4[2]*spD4[2]) + 0.01)); for(i = 0; i < 3; i++){ - arg0[i] += (sp7C[0][i] - arg0[i])*temp_f2_4; + arg0[i] = arg0[i] + (sp7C[0][i] - arg0[i]) * f2; + } + + f2 = func_80294404() / 100; + for(i = 0; i < 3; i++){ + arg0[i] = arg0[i] + (255 - arg0[i]) * f2; } for(i = 0; i < 3; i++){ - arg0[i] += (255.0f - arg0[i]) * (func_80294404() / 100.0f); + if(arg0[i] > 255){ arg0[i] = 255; } + if(arg0[i] < 0) { arg0[i] = 0; } } - for(i = 0; i < 3; i++){ - if(arg0[i] > 255.0f){ arg0[i] = 255.0f; } - if(arg0[i] < 0.0f) { arg0[i] = 0.0f; } - } - arg0[0] = ((arg0[0] + arg0[1] + arg0[2]) * (f32) (0xFF - sp78)) / 765.0f + sp78; + arg0[0] = ((arg0[0] + arg0[1] + arg0[2]) * (255 - sp78)) / 765 + sp78; arg0[1] = arg0[0]; arg0[2] = arg0[0]; } -#endif void func_8029A47C(s32 arg0[3]){ arg0[0] = (s32)(D_8037C6F0.unk4[0] + 0.5); From 3cfac5bf5c67198f2a281019c814246d93adb010 Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Thu, 29 Aug 2024 08:50:27 -0500 Subject: [PATCH 28/38] func_803411B0 match --- README.md | 10 +- progress/progress_core2.svg | 12 +- progress/progress_total.svg | 12 +- src/core2/code_B9770.c | 251 +++++++++++++++++++----------------- 4 files changed, 144 insertions(+), 141 deletions(-) diff --git a/README.md b/README.md index ee294fd6..9ae98068 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# banjo (99.8594%) +# banjo (100.0000%) @@ -19,14 +19,6 @@ - - -## Remaining Functions -These all are the remaining NTSC-USA V1.0 function left to be matched. -Be sure to check scratch "family" for any progress that may not be reflected here - -| File | Function | Scratch Link | % | Notes | -| ------------------ | --------------- | ---------------------------------------- | ------ | ----- | -| core2/code_B9770.c | func_803411B0 | [rHkDu](https://decomp.me/scratch/rHkDu) | 87.70% | spline function - ## Building Grab tools diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg index c9f3e400..43d21f64 100644 --- a/progress/progress_core2.svg +++ b/progress/progress_core2.svg @@ -1,23 +1,23 @@ - + - + - - + + core2 core2 - 99.7549% - 99.7549% + 100.0000% + 100.0000% \ No newline at end of file diff --git a/progress/progress_total.svg b/progress/progress_total.svg index c992390c..d3b89080 100644 --- a/progress/progress_total.svg +++ b/progress/progress_total.svg @@ -1,23 +1,23 @@ - + - + - - + + Banjo-Kazooie (us.v10) Banjo-Kazooie (us.v10) - 99.8594% - 99.8594% + 100.0000% + 100.0000% \ No newline at end of file diff --git a/src/core2/code_B9770.c b/src/core2/code_B9770.c index 32c5e4e3..f0f0efde 100644 --- a/src/core2/code_B9770.c +++ b/src/core2/code_B9770.c @@ -14,9 +14,7 @@ extern f32 func_80323FDC(struct56s *, f32, f32, s32 *); extern f32 func_803240E0(struct56s *, f32, f32, s32 *); extern void func_8032417C(struct56s *, f32, f32[3], f32[3]); extern void func_80328FF0(Actor *, f32); - - - +extern void func_8032DC70(s32); typedef struct { f32 unk0; @@ -153,6 +151,7 @@ typedef struct { u16 pad8_12:13; }Struct_glspline_803411B0; + s32 func_80341BC8(struct56s *arg0, SplineList * arg1); /* .data */ @@ -355,161 +354,173 @@ void func_80341180(f32 arg0, s32 arg1, s32 arg2, f32 arg3[3], f32 arg4[3]){ func_80340BE4(arg0, arg1, arg2, arg2, arg3, arg4); } -#ifndef NONMATCHING -#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_B9770/func_803411B0.s") -#else -void func_803411B0(void) { +void func_803411B0(void){ s32 spE4; s32 spE0; + s32 a0; Struct_glspline_803411B0 *spD8; s32 spCC[3]; s32 spC8; s32 spC4; + s32 padding[3]; struct56s *spB4; - SplineList *spA8; - struct56s *spA4; - Union_glspline *sp80; - Struct_glspline_803411B0 *sp50; - Union_glspline *temp_s6; + Struct_glspline_803411B0 *spline; Union_glspline *var_s0_2; + SplineList *spA8; + f32 *spA4; Union_glspline *var_s1_2; - s32 temp_v0_2; - s32 var_a0; - s32 var_a0_3; - s32 var_a0_4; - s32 var_a0_5; s32 var_fp; s32 var_s0; s32 var_s2; - s32 var_s2_2; + Union_glspline sp80; s32 var_s5; - s32 var_s7; - s32 var_v1; + u32 var_s7; Union_glspline *temp_s3_2; Union_glspline *temp_v0_16; - Struct_glspline_803411B0 *temp_v0_17; - Struct_glspline_803411B0 *var_v0_4; - s16 *i_ptr; + s32 tmp; D_80371E80 = 0; D_80371E70 = malloc(0); D_80371E74 = malloc(0); D_80371E78 = 0; - D_803858A0 = (s16 *) malloc(0x80*sizeof(s16)); - for(var_v1 = 0; var_v1 < 0x80; var_v1++){ - D_803858A0[var_v1] = 0; + D_803858A0 = malloc(128 * sizeof(s16)); + + for (spE0 = 0; spE0 < 128; spE0++) { + D_803858A0[spE0] = 0; } - spE4 = func_80307E1C(D_803858A0) + 1; - if (spE4 > 1) { - spD8 = (Struct_glspline_803411B0 *)malloc(spE4 * sizeof(Struct_glspline_803411B0)); - for(var_a0 = 0; var_a0 < spE4; var_a0++){ - spD8[var_a0].unk0 = -1; + + spE4 = func_80307E1C() + 1; + + if (spE4 <= 1) { + return; + } + + spD8 = (Struct_glspline_803411B0 *) malloc(spE4 * sizeof(Struct_glspline_803411B0)); + + for (spE0 = 0; spE0 < spE4; spE0++) { + (spD8 + spE0)->unk0 = -1; + } + + func_80307EA8(0, spCC, &spC8, &spC4); + + do { + spE0 = func_80307EA8(1, spCC, &spC8, &spC4); + + if (spE0 >= 0) { + (spD8+spE0)->unk0 = spC8; + (spD8+spE0)->unk8_13 = spC4; + (spD8+spE0)->unk2[0] = spCC[0]; + (spD8+spE0)->unk2[1] = spCC[1]; + (spD8+spE0)->unk2[2] = spCC[2]; } + } while (spE0 >= 0); + for (spE0 = 1; spE0 < spE4; spE0++) { + (spD8+spE0)->unk8_15 = 0; - func_80307EA8(0, spCC, &spC8, &spC4); - do { - temp_v0_2 = func_80307EA8(1, spCC, &spC8, &spC4); - if (temp_v0_2 >= 0) { - spD8[temp_v0_2].unk0 = (s16) spC8; - spD8[temp_v0_2].unk2[0] = (s16) spCC[0]; - spD8[temp_v0_2].unk2[1] = (s16) spCC[1]; - spD8[temp_v0_2].unk2[2] = (s16) spCC[2]; - spD8[temp_v0_2].unk8_13 = spC4; - } - } while (temp_v0_2 >= 0); - - for(spE0 = 1; spE0 < spE4; spE0++) { - spD8[spE0].unk8_15 = 0; - if ((spD8[spE0].unk0 >= spE4) || (spD8[spE0].unk0 == -1)) { - spD8[spE0].unk0 = 0; - } + if ((spD8+spE0)->unk0 >= spE4 || (spD8+spE0)->unk0 == -1) { + (spD8+spE0)->unk0 = 0; } + } - for(spE0 = 1; spE0 < spE4; spE0++) { - if (spD8[spE0].unk0 > 0) { - spD8[spD8[spE0].unk0].unk8_15 = 1; - } + for (spE0 = 1; spE0 < spE4; spE0++) { + if ((spD8+spE0)->unk0 > 0) { + (spD8+(spD8+spE0)->unk0)->unk8_15 = 1; } + } - for(spE0 = 1; spE0 < spE4; spE0++) { - if( (spD8[spE0].unk8_13 == 1) - && ((spD8[spE0].unk8_15 != 0) || (spD8[spE0].unk0 <= 0)) - && ((spD8[spE0].unk8_15 != 1) || (spD8[spE0].unk0 <= 0)) - && ((spD8[spE0].unk8_15 != 1) || (spD8[spE0].unk0 != 0)) - ) { - func_8032DC70(); - spD8[spE0].unk0 = -1; - spD8[spE0].unk8_13 = 0; + for (spE0 = 1; spE0 < spE4; spE0++) { + if ((spD8+spE0)->unk8_13 == 1 + && ((spD8+spE0)->unk8_15 != 0 || (spD8+spE0)->unk0 <= 0) + && ((spD8+spE0)->unk8_15 != 1 || (spD8+spE0)->unk0 <= 0) + && ((spD8+spE0)->unk8_15 != 1 || (spD8+spE0)->unk0 != 0)) { + func_8032DC70(spE0); + + (spD8+spE0)->unk0 = -1; + (spD8+spE0)->unk8_13 = 0; + } + } + + for (spE0 = 1; spE0 < spE4; spE0++) { + if ((spD8+spE0)->unk0 > 0 && (spD8+spE0)->unk8_15 == 0 && (spD8+spE0)->unk8_13 == 0) { + var_s5 = 1; + var_s7 = 1; + var_s0 = 0; + var_fp = 0; + + for (; var_s5 < spE4; var_s5++) { + (spD8+var_s5)->unk8_14 = 0; + } + + for (var_s5 = spE0; (spD8+var_s5)->unk0 != 0 && !(spD8+var_s5)->unk8_14; var_s5 = (spD8+var_s5)->unk0) { + (spD8+var_s5)->unk8_14 = 1; + tmp = (spD8+var_s5)->unk8_13 == 0 ? 1 : 0; + var_s7 += tmp; + var_s0 += ((spD8+var_s5)->unk8_13 == 0) ? 0 : 1; + } + + tmp = var_s7 * 3; + spB4 = (struct56s *) malloc(8 + tmp * sizeof(f32)); + spA4 = (f32 *) spB4; + spB4->unk0 = var_s7; + spB4->unk4 = 0; + + spA8 = (SplineList *) malloc(4 + var_s0 * sizeof(Union_glspline)); + spA8->unk0 = var_s0; + + var_s1_2 = &spA8->spline[0]; + a0 = spE0; + var_s2 = spA8->unk0; + + for (; var_s2 != 0; a0 = (spD8+a0)->unk0) { + if (0); + if ((spD8+a0)->unk8_13 == 1) { + temp_v0_16 = func_803080C8(a0); + temp_v0_16->t1.unk8.pad_bit7 = D_80371E78; + + memcpy(var_s1_2, temp_v0_16, sizeof(Union_glspline)); + + var_s1_2++; + var_s2--; } - } + } - for(spE0 = 1; spE0 < spE4; spE0++) { - if (spD8[spE0].unk0 > 0) { - if (spD8[spE0].unk8_15 == 0) { - if (!spD8[spE0].unk8_13) { - var_s7 = 1; - var_s0 = 0; - var_fp = 0; - for(var_s5 = 1; var_s5 < spE4; var_s5++){ - spD8[var_s5].unk8_14 = 0; - } + temp_s3_2 = spA8->unk0 - 1 + spA8->spline; - var_v0_4 = &spD8[spE0]; - while ((var_v0_4->unk0 != 0) && !(var_v0_4->unk8_14)) { - var_v0_4->unk8_14 = 1; - var_s7 += (var_v0_4->unk8_13 == 0) ? 1 : 0; - var_s0 += (var_v0_4->unk8_13 == 0) ? 0 : 1; - var_v0_4 = &spD8[var_v0_4->unk0]; - } + do { + var_s2 = 0; - spB4 = (struct56s *) malloc(sizeof(struct56s) + (var_s7 * 3* sizeof(f32))); - spB4->unk0 = var_s7; - spB4->unk4 = 0; - spA8 = (SplineList *)malloc(sizeof(SplineList) + var_s0*sizeof(Union_glspline)); - spA8->unk0 = var_s0; - var_s1_2 = &spA8->spline[0]; - var_s2 = var_s0; - for(var_a0_4 = spE0; (var_s2 != 0); var_a0_4 = spD8[var_a0_4].unk0){ - if (spD8[var_a0_4].unk8_13 == 1) { - temp_v0_16 = func_803080C8(); - temp_v0_16->t1.unk8.pad_bit7 = (s8) D_80371E78; - memcpy(var_s1_2, temp_v0_16, 0x14); - var_s1_2++; - var_s2--; - } - } - temp_s6 = &spA8->spline[0]; - temp_s3_2 = &spA8->spline[spA8->unk0]; - var_s2_2 = 0; - do { - for(var_s0_2 = temp_s6; var_s0_2 < temp_s3_2; var_s0_2++){ - if ((var_s0_2 + 1)->common.unk0 < var_s0_2->common.unk0) { - memcpy(sp80, var_s0_2, sizeof(Union_glspline)); - memcpy(var_s0_2, var_s0_2 + 1, sizeof(Union_glspline)); - memcpy(var_s0_2 + 1, sp80, sizeof(Union_glspline)); - var_s2_2++; - } - } - } while (var_s2_2 != 0); - while(var_s7 != 0){ - temp_v0_17 = &spD8[spE0]; - if (!(temp_v0_17->unk8_13)) { - spB4->unk8[var_fp][0] = (f32) temp_v0_17->unk2[0]; - spB4->unk8[var_fp][1] = (f32) temp_v0_17->unk2[1]; - spB4->unk8[var_fp][2] = (f32) temp_v0_17->unk2[2]; - var_s7--; - } - } - func_80341BC8(spB4, spA8); + for (var_s0_2 = &spA8->spline[0]; var_s0_2 < temp_s3_2; var_s0_2++) { + var_s1_2 = var_s0_2 + 1; + + if (var_s0_2->common.unk0 > var_s1_2->common.unk0) { + memcpy(&sp80, var_s0_2, sizeof(Union_glspline)); + memcpy(var_s0_2, var_s1_2, sizeof(Union_glspline)); + memcpy(var_s1_2, &sp80, sizeof(Union_glspline)); + var_s2++; } } + } while (var_s2); + + a0 = var_s7; + + for (var_s5 = spE0; a0 != 0; var_s5 = (spD8 + var_s5)->unk0) { + if (!(spD8 + var_s5)->unk8_13) { + spA4[var_fp + 2] = (spD8 + var_s5)->unk2[0]; + spA4[var_fp + 3] = (spD8 + var_s5)->unk2[1]; + spA4[var_fp + 4] = (spD8 + var_s5)->unk2[2]; + + var_fp += 3; + a0--; + } } + + func_80341BC8(spB4, spA8); } - free(spD8); } + + free(spD8); } -#endif //glspline_free void func_80341A54(void) { From 2514b28c123e1ea68d371a25ffc5b922d2a1abb3 Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Thu, 29 Aug 2024 09:05:42 -0500 Subject: [PATCH 29/38] remove tracked .rodata section --- asm/data/fight/code_180.data.s | 429 --------------------------------- 1 file changed, 429 deletions(-) delete mode 100644 asm/data/fight/code_180.data.s diff --git a/asm/data/fight/code_180.data.s b/asm/data/fight/code_180.data.s deleted file mode 100644 index d589d122..00000000 --- a/asm/data/fight/code_180.data.s +++ /dev/null @@ -1,429 +0,0 @@ -.include "macro.inc" - -.section .data - -dlabel D_80392100 -.double -500.0 - -dlabel jtbl_80392108 -.word L80387794_13A4, L803877F8_1408, L803878FC_150C, L803879A0_15B0, L80387A20_1630, L80387A98_16A8 - -dlabel D_80392120 -.float 0.95 - -dlabel D_80392124 -.float 1.05 - -dlabel D_80392128 -.float 5000.0 - -dlabel D_8039212C -.float 12000.0 - -dlabel D_80392130 -.float 1e8 - -dlabel jtbl_80392134 -.word L80388254_1E64, L80388558_2168, L80388558_2168, L80388268_1E78, L80388314_1F24, L8038837C_1F8C, L80388420_2030, L80388468_2078, L80388484_2094, L80388558_2168, L803884CC_20DC, L803884E0_20F0 - -dlabel D_80392164 -.float 0.95 - -dlabel D_80392168 -.float 1.05 - -dlabel D_8039216C -.float 5000.0 - -dlabel D_80392170 -.float 12000.0, 0.95 - -dlabel D_80392178 -.float 1.05 - -dlabel D_8039217C -.float 5000.0 - -dlabel D_80392180 -.float 12000.0 - -dlabel D_80392184 -.float 0.4 - -dlabel D_80392188 -.float 5000.0 - -dlabel D_8039218C -.float 12000.0, 2700.0 - -dlabel D_80392194 -.float 1150.0 - -dlabel D_80392198 -.float 0.95 - -dlabel D_8039219C -.float 1.05 - -dlabel D_803921A0 -.float 5000.0 - -dlabel D_803921A4 -.float 12000.0 - -dlabel D_803921A8 -.float 0.95 - -dlabel D_803921AC -.float 1.05 - -dlabel D_803921B0 -.float 5000.0 - -dlabel D_803921B4 -.float 12000.0 - -dlabel jtbl_803921B8 -.word L803887AC_23BC, L803888A8_24B8, L80388964_2574, L803889EC_25FC, L80388B24_2734, L80388DC4_29D4, L80388E84_2A94, L80388F5C_2B6C, L80388FC4_2BD4, L80389054_2C64, L803890C0_2CD0, L80389158_2D68 - -dlabel D_803921E8 -.double 0.3333333333333333 - -dlabel D_803921F0 -.double 3300.0, 0.7333333333333334 - -dlabel D_80392200 -.double 3300.0 - -dlabel D_80392208 -.double 0.66 - -dlabel D_80392210 -.double 0.65 - -dlabel jtbl_80392218 -.word L803893E8_2FF8, L803894CC_30DC, L803894F0_3100, L80389594_31A4, L803895D8_31E8, L80389638_3248, L80389660_3270 - -dlabel jtbl_80392234 -.word L8038975C_336C, L80389788_3398, L803897B4_33C4, L803897E0_33F0, L8038980C_341C - -dlabel D_80392248 -.float 1.54 - -dlabel jtbl_8039224C -.word L80389BD8_37E8, L80389CFC_390C, L80389D48_3958, L80389D80_3990, L80389E14_3A24, L80389E3C_3A4C, L80389F40_3B50 - -dlabel D_80392268 -.word 0x3F99999A, 0x00000000 - -dlabel D_80392270 -.double 0.1 - -dlabel D_80392278 -.double 0.8 - -dlabel jtbl_80392280 -.word L80389FEC_3BFC, L8038A4D4_40E4, L8038A01C_3C2C, L8038A4D4_40E4, L8038A1B4_3DC4, L8038A208_3E18, L8038A3D4_3FE4 - -dlabel D_8039229C -.float 2.2 - -dlabel D_803922A0 -.float 2.2 - -dlabel D_803922A4 -.float 2.2 - -dlabel D_803922A8 -.float 4.4 - -dlabel D_803922AC -.float 4.4 - -dlabel D_803922B0 -.float 4.4 - -dlabel D_803922B4 -.float 6.6 - -dlabel D_803922B8 -.float 6.6 - -dlabel D_803922BC -.float 6.6 - -dlabel D_803922C0 -.float 8.8 - -dlabel D_803922C4 -.float 8.8 - -dlabel D_803922C8 -.float 8.8 - -dlabel D_803922CC -.float 0.95 - -dlabel D_803922D0 -.float 1.05 - -dlabel D_803922D4 -.float 5000.0 - -dlabel D_803922D8 -.float 12000.0 - -dlabel D_803922DC -.float 0.6 - -dlabel D_803922E0 -.double 1.7, -1190.0 - -dlabel D_803922F0 -.float 1.7 - -dlabel D_803922F4 -.float 1.7 - -dlabel D_803922F8 -.float 1.7 - -dlabel D_803922FC -.float 1.7 - -dlabel D_80392300 -.float 0.95 - -dlabel D_80392304 -.float 1.05 - -dlabel D_80392308 -.float 0.95 - -dlabel D_8039230C -.float 1.05 - -dlabel jtbl_80392310 -.word L8038A778_4388, L8038A7D0_43E0, L8038A818_4428, L8038A8A0_44B0, L8038A8FC_450C, L8038A924_4534, L8038AA3C_464C - -dlabel D_8039232C -.float 0.95 - -dlabel D_80392330 -.float 1.05 - -dlabel D_80392334 -.float 0.95 - -dlabel D_80392338 -.float 1.05 - -dlabel D_8039233C -.float 0.95 - -dlabel D_80392340 -.float 1.05 - -dlabel D_80392344 -.float 0.95 - -dlabel D_80392348 -.float 1.05 - -dlabel D_8039234C -.float 0.95 - -dlabel D_80392350 -.float 1.05 - -dlabel D_80392354 -.float 0.95 - -dlabel D_80392358 -.float 1.05, 0.0 - -dlabel D_80392360 -.double 0.4 - -dlabel D_80392368 -.double 0.65 - -dlabel D_80392370 -.double 0.005 - -dlabel D_80392378 -.double 1.99 - -dlabel D_80392380 -.float 0.95 - -dlabel D_80392384 -.float 1.05 - -dlabel jtbl_80392388 -.word L8038ACE8_48F8, L8038AD90_49A0, L8038ADA0_49B0, L8038AF14_4B24, L8038AF70_4B80, L8038ADA8_49B8, L8038AE00_4A10, L8038AE5C_4A6C, L8038AF28_4B38 - -dlabel D_803923AC -.float 0.95 - -dlabel D_803923B0 -.float 1.05 - -dlabel D_803923B4 -.float 5000.0 - -dlabel D_803923B8 -.float 12000.0, 0.95 - -dlabel D_803923C0 -.float 1.05 - -dlabel D_803923C4 -.float 5000.0 - -dlabel D_803923C8 -.float 12000.0 - -dlabel D_803923CC -.float 0.95 - -dlabel D_803923D0 -.float 1.05 - -dlabel D_803923D4 -.float 5000.0 - -dlabel D_803923D8 -.float 12000.0 - -dlabel D_803923DC -.float 0.6 - -dlabel D_803923E0 -.float 0.6, 2.4 - -dlabel D_803923E8 -.float 2.4 - -dlabel D_803923EC -.float 4.4 - -dlabel D_803923F0 -.float 4.4 - -dlabel jtbl_803923F4 -.word L8038B290_4EA0, L8038B2A4_4EB4, L8038B2DC_4EEC, L8038B368_4F78, L8038B3B4_4FC4, L8038B460_5070, L8038B4FC_510C, L8038B564_5174, L8038B58C_519C - -dlabel D_80392418 -.double 0.56 - -dlabel D_80392420 -.double 0.99 - -dlabel D_80392428 -.float 4.8 - -dlabel jtbl_8039242C -.word L8038B874_5484, L8038B8D0_54E0, L8038B91C_552C, L8038B93C_554C, L8038B95C_556C - -dlabel D_80392440 -.float 0.95 - -dlabel D_80392444 -.float 1.05 - -dlabel D_80392448 -.float 5000.0 - -dlabel D_8039244C -.float 12000.0 - -dlabel D_80392450 -.float 0.6 - -dlabel jtbl_80392454 -.word L8038BF30_5B40, L8038BF40_5B50, L8038BF50_5B60, L8038BF60_5B70, L8038BF70_5B80, L8038BF80_5B90, 0 - -dlabel D_80392470 -.double 0.08 - -dlabel D_80392478 -.float 2.88, 0.0 - -dlabel D_80392480 -.double 0.35 - -dlabel D_80392488 -.double 0.65 - -dlabel D_80392490 -.float 0.3, 0.0 - -dlabel D_80392498 -.double 45.0 - -dlabel D_803924A0 -.double 0.3 - -dlabel D_803924A8 -.double 2.26 - -dlabel D_803924B0 -.double 182.04444 - -dlabel jtbl_803924B8 -.word L8038C92C_653C, L8038C980_6590, L8038CA48_6658, L8038CA48_6658, L8038CE68_6A78 - -dlabel D_803924CC -.float 0.95 - -dlabel D_803924D0 -.float 1.05 - -dlabel D_803924D4 -.float 5000.0 - -dlabel D_803924D8 -.float 0.95 - -dlabel D_803924DC -.float 1.05 - -dlabel D_803924E0 -.float 5000.0 - -dlabel D_803924E4 -.float 12000.0 - -dlabel D_803924E8 -.double 0.1 - -dlabel D_803924F0 -.double 0.8 - -dlabel D_803924F8 -.double 0.2 - -dlabel D_80392500 -.float 0.1 - -dlabel D_80392504 -.float 5000.0 - -dlabel D_80392508 -.float 12000.0 - -dlabel D_8039250C -.float 2500.0 - -dlabel D_80392510 -.double 0.98 - -dlabel D_80392518 -.float 1.15 - -dlabel D_8039251C -.float 0.1 - -dlabel D_80392520 -.float 2.26, 0.0, 0.0, 0.0 From b1b7605a5f800e37eef7e5f8e6570a0550b85f82 Mon Sep 17 00:00:00 2001 From: Mr-Wiseguy Date: Fri, 30 Aug 2024 17:59:33 -0400 Subject: [PATCH 30/38] WIP Removed all defined or auto undefined symbols (not matching) --- Makefile | 7 ++-- asm/core1/ultra/exceptasm.s | 57 +++++++++++++++++------------ asm/core1/ultra/setintmask.s | 9 +++-- asm/ultra/exceptasm.s | 41 +++++++++++---------- asm/ultra/setintmask.s | 9 +++-- decompressed.us.v10.yaml | 31 ++++++++++------ first_diff.py | 2 +- include/assets.h | 2 +- include/core2/code_C9E70.h | 2 - src/FP/bss_end_pad.c | 1 - src/GV/ch/histup.c | 8 ++-- src/GV/code_7D50.c | 2 +- src/MM/bss_pad.c | 1 - src/MM/ch/juju.c | 1 + src/RBB/propellorctrl.c | 7 ++-- src/core1/code_10A00.c | 15 ++++---- src/core1/code_11AC0.c | 11 +++--- src/core1/code_13990.c | 2 +- src/core1/code_1D00.c | 6 +-- src/core1/code_2BD0.c | 16 ++++---- src/core1/code_5650.c | 2 +- src/core1/code_660.c | 2 +- src/core1/code_72B0.c | 1 - src/core1/code_8C50.c | 6 +-- src/core1/code_E360.c | 15 +++++--- src/core2/bs/dronevanish.c | 1 + src/core2/ch/bottlesbonuscursor.c | 5 +-- src/core2/ch/gameSelect.c | 20 ++++++++-- src/core2/code_47BD0.c | 3 +- src/core2/code_59D40.c | 2 +- src/core2/code_5BEB0.c | 1 - src/core2/code_AE290.c | 11 +++--- src/core2/code_B3A80.c | 2 +- src/core2/code_C9E70.c | 2 +- src/core2/code_CF5F0.c | 2 +- src/core2/code_D9B0.c | 2 +- src/core2/nc/dynamicCamera.c | 3 +- src/done/bk_boot_1050.c | 4 +- src/fight/chfinalboss.c | 2 +- src/fight/chstonejinjo.c | 2 +- src/lair/code_5ED0.c | 4 +- undefined_syms.libultra.txt | 61 ++++++++++++++++++------------- undefined_syms.us.v10.txt | 34 ----------------- 43 files changed, 212 insertions(+), 205 deletions(-) delete mode 100644 src/FP/bss_end_pad.c delete mode 100644 src/MM/bss_pad.c delete mode 100644 undefined_syms.us.v10.txt diff --git a/Makefile b/Makefile index cc2cf081..6cbd4f32 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ CC := ido/ido5.3_recomp/cc CPP := cpp GCC := $(CROSS)gcc AS := $(CROSS)as -LD := $(CROSS)ld -b elf32-tradbigmips +LD := LD_LIBRARY_PATH=../../papermario ../../papermario/mips-linux-gnu-ld.bfd -b elf32-tradbigmips OBJDUMP := $(CROSS)objdump OBJCOPY := $(CROSS)objcopy PYTHON := python3 @@ -316,7 +316,7 @@ $(DECOMPRESSED_BASEROM): $(BASEROM) $(BK_ROM_DECOMPRESS) # .o -> .elf (dummy symbols) $(PRELIM_ELF): $(ALL_OBJS) $(LD_SCRIPT) $(ASSET_OBJS) $(call print1,Linking elf:,$@) - @$(LD) $(LDFLAGS) -T undefined_syms_auto.$(VERSION).txt -T undefined_syms.$(VERSION).txt -T rzip_dummy_addrs.txt -o $@ + @$(LD) $(LDFLAGS) -T rzip_dummy_addrs.txt -o $@ # .elf -> .z64 (dummy symbols) $(PRELIM_Z64) : $(PRELIM_ELF) @@ -330,7 +330,7 @@ $(COMPRESSED_SYMBOLS): $(PRELIM_ELF) $(PRELIM_Z64) $(BK_ROM_COMPRESS) # .o -> .elf (game) $(ELF): $(ALL_OBJS) $(LD_SCRIPT) $(ASSET_OBJS) $(COMPRESSED_SYMBOLS) $(call print1,Linking elf:,$@) - @$(LD) $(LDFLAGS) -T undefined_syms_auto.$(VERSION).txt -T undefined_syms.$(VERSION).txt -T $(COMPRESSED_SYMBOLS) -o $@ + @$(LD) $(LDFLAGS) -T $(COMPRESSED_SYMBOLS) -o $@ # .elf -> .z64 (uncompressed) $(UNCOMPRESSED_Z64) : $(ELF) @@ -361,7 +361,6 @@ clean: @$(RM) -rf $(addprefix $(ASM_ROOT)/,$(filter-out core1,$(OVERLAYS))) @$(RM) -rf $(ASM_ROOT)/core1/*.s @$(RM) -rf $(ASM_ROOT)/core1/os - @$(RM) -f undefined_syms_auto* undefined_funcs_auto* @$(RM) -f *.ld # Per-file flag definitions diff --git a/asm/core1/ultra/exceptasm.s b/asm/core1/ultra/exceptasm.s index 6620a849..6048455b 100644 --- a/asm/core1/ultra/exceptasm.s +++ b/asm/core1/ultra/exceptasm.s @@ -1,4 +1,5 @@ #include +#include .include "macro.inc" /* assembler directives */ @@ -59,6 +60,8 @@ __osIntTable: .section .text, "ax" +/* Generated by spimdisasm 1.24.3 */ + # Handwritten function glabel func_8026A2E0 /* F45B10 8026A2E0 3C1A8027 */ lui $k0, %hi(D_8026A300) @@ -141,8 +144,8 @@ D_8026A300: /* F45C40 8026A410 0369D825 */ or $k1, $k1, $t1 /* F45C44 8026A414 AF5B0118 */ sw $k1, 0x118($k0) .L8026A418: -/* F45C48 8026A418 3C09A430 */ lui $t1, %hi(D_A430000C) -/* F45C4C 8026A41C 8D29000C */ lw $t1, %lo(D_A430000C)($t1) +/* F45C48 8026A418 3C09A430 */ lui $t1, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) +/* F45C4C 8026A41C 8D29000C */ lw $t1, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($t1) /* F45C50 8026A420 5120000C */ beql $t1, $zero, .L8026A454 /* F45C54 8026A424 AF490128 */ sw $t1, 0x128($k0) /* F45C58 8026A428 3C088027 */ lui $t0, %hi(__OSGlobalIntMask) @@ -258,21 +261,21 @@ rcp: /* F45DE4 8026A5B4 3C088027 */ lui $t0, %hi(__OSGlobalIntMask) /* F45DE8 8026A5B8 25087130 */ addiu $t0, $t0, %lo(__OSGlobalIntMask) /* F45DEC 8026A5BC 8D080000 */ lw $t0, 0x0($t0) -/* F45DF0 8026A5C0 3C11A430 */ lui $s1, %hi(D_A4300008) -/* F45DF4 8026A5C4 8E310008 */ lw $s1, %lo(D_A4300008)($s1) +/* F45DF0 8026A5C0 3C11A430 */ lui $s1, %hi(PHYS_TO_K1(MI_INTR_REG)) +/* F45DF4 8026A5C4 8E310008 */ lw $s1, %lo(PHYS_TO_K1(MI_INTR_REG))($s1) /* F45DF8 8026A5C8 00084402 */ srl $t0, $t0, 16 /* F45DFC 8026A5CC 02288824 */ and $s1, $s1, $t0 /* F45E00 8026A5D0 32290001 */ andi $t1, $s1, 0x1 /* F45E04 8026A5D4 51200014 */ beql $t1, $zero, .L8026A628 /* F45E08 8026A5D8 32290008 */ andi $t1, $s1, 0x8 -/* F45E0C 8026A5DC 3C0CA404 */ lui $t4, %hi(D_A4040010) -/* F45E10 8026A5E0 8D8C0010 */ lw $t4, %lo(D_A4040010)($t4) +/* F45E0C 8026A5DC 3C0CA404 */ lui $t4, %hi(PHYS_TO_K1(SP_STATUS_REG)) +/* F45E10 8026A5E0 8D8C0010 */ lw $t4, %lo(PHYS_TO_K1(SP_STATUS_REG))($t4) /* F45E14 8026A5E4 24090008 */ addiu $t1, $zero, 0x8 -/* F45E18 8026A5E8 3C01A404 */ lui $at, %hi(D_A4040010) +/* F45E18 8026A5E8 3C01A404 */ lui $at, %hi(PHYS_TO_K1(SP_STATUS_REG)) /* F45E1C 8026A5EC 318C0300 */ andi $t4, $t4, 0x300 /* F45E20 8026A5F0 3231003E */ andi $s1, $s1, 0x3E /* F45E24 8026A5F4 11800007 */ beqz $t4, .L8026A614 -/* F45E28 8026A5F8 AC290010 */ sw $t1, %lo(D_A4040010)($at) +/* F45E28 8026A5F8 AC290010 */ sw $t1, %lo(PHYS_TO_K1(SP_STATUS_REG))($at) /* F45E2C 8026A5FC 0C09AA09 */ jal func_8026A824 /* F45E30 8026A600 24040020 */ addiu $a0, $zero, 0x20 /* F45E34 8026A604 52200039 */ beql $s1, $zero, .L8026A6EC @@ -287,9 +290,9 @@ rcp: /* F45E54 8026A624 32290008 */ andi $t1, $s1, 0x8 .L8026A628: /* F45E58 8026A628 11200007 */ beqz $t1, .L8026A648 -/* F45E5C 8026A62C 3C01A440 */ lui $at, %hi(D_A4400010) +/* F45E5C 8026A62C 3C01A440 */ lui $at, %hi(PHYS_TO_K1(VI_CURRENT_REG)) /* F45E60 8026A630 32310037 */ andi $s1, $s1, 0x37 -/* F45E64 8026A634 AC200010 */ sw $zero, %lo(D_A4400010)($at) +/* F45E64 8026A634 AC200010 */ sw $zero, %lo(PHYS_TO_K1(VI_CURRENT_REG))($at) /* F45E68 8026A638 0C09AA09 */ jal func_8026A824 /* F45E6C 8026A63C 24040038 */ addiu $a0, $zero, 0x38 /* F45E70 8026A640 5220002A */ beql $s1, $zero, .L8026A6EC @@ -299,9 +302,9 @@ rcp: /* F45E7C 8026A64C 5120000A */ beql $t1, $zero, .L8026A678 /* F45E80 8026A650 32290002 */ andi $t1, $s1, 0x2 /* F45E84 8026A654 24090001 */ addiu $t1, $zero, 0x1 -/* F45E88 8026A658 3C01A450 */ lui $at, %hi(D_A450000C) +/* F45E88 8026A658 3C01A450 */ lui $at, %hi(PHYS_TO_K1(AI_STATUS_REG)) /* F45E8C 8026A65C 3231003B */ andi $s1, $s1, 0x3B -/* F45E90 8026A660 AC29000C */ sw $t1, %lo(D_A450000C)($at) +/* F45E90 8026A660 AC29000C */ sw $t1, %lo(PHYS_TO_K1(AI_STATUS_REG))($at) /* F45E94 8026A664 0C09AA09 */ jal func_8026A824 /* F45E98 8026A668 24040030 */ addiu $a0, $zero, 0x30 /* F45E9C 8026A66C 5220001F */ beql $s1, $zero, .L8026A6EC @@ -309,9 +312,9 @@ rcp: /* F45EA4 8026A674 32290002 */ andi $t1, $s1, 0x2 .L8026A678: /* F45EA8 8026A678 11200007 */ beqz $t1, .L8026A698 -/* F45EAC 8026A67C 3C01A480 */ lui $at, %hi(D_A4800018) +/* F45EAC 8026A67C 3C01A480 */ lui $at, %hi(PHYS_TO_K1(SI_STATUS_REG)) /* F45EB0 8026A680 3231003D */ andi $s1, $s1, 0x3D -/* F45EB4 8026A684 AC200018 */ sw $zero, %lo(D_A4800018)($at) +/* F45EB4 8026A684 AC200018 */ sw $zero, %lo(PHYS_TO_K1(SI_STATUS_REG))($at) /* F45EB8 8026A688 0C09AA09 */ jal func_8026A824 /* F45EBC 8026A68C 24040028 */ addiu $a0, $zero, 0x28 /* F45EC0 8026A690 52200016 */ beql $s1, $zero, .L8026A6EC @@ -321,9 +324,9 @@ rcp: /* F45ECC 8026A69C 5120000A */ beql $t1, $zero, .L8026A6C8 /* F45ED0 8026A6A0 32290020 */ andi $t1, $s1, 0x20 /* F45ED4 8026A6A4 24090002 */ addiu $t1, $zero, 0x2 -/* F45ED8 8026A6A8 3C01A460 */ lui $at, %hi(D_A4600010) +/* F45ED8 8026A6A8 3C01A460 */ lui $at, %hi(PHYS_TO_K1(PI_STATUS_REG)) /* F45EDC 8026A6AC 3231002F */ andi $s1, $s1, 0x2F -/* F45EE0 8026A6B0 AC290010 */ sw $t1, %lo(D_A4600010)($at) +/* F45EE0 8026A6B0 AC290010 */ sw $t1, %lo(PHYS_TO_K1(PI_STATUS_REG))($at) /* F45EE4 8026A6B4 0C09AA09 */ jal func_8026A824 /* F45EE8 8026A6B8 24040040 */ addiu $a0, $zero, 0x40 /* F45EEC 8026A6BC 5220000B */ beql $s1, $zero, .L8026A6EC @@ -333,9 +336,9 @@ rcp: /* F45EF8 8026A6C8 51200008 */ beql $t1, $zero, .L8026A6EC /* F45EFC 8026A6CC 2401FBFF */ addiu $at, $zero, -0x401 /* F45F00 8026A6D0 24090800 */ addiu $t1, $zero, 0x800 -/* F45F04 8026A6D4 3C01A430 */ lui $at, %hi(D_A4300000) +/* F45F04 8026A6D4 3C01A430 */ lui $at, %hi(PHYS_TO_K1(MI_MODE_REG)) /* F45F08 8026A6D8 3231001F */ andi $s1, $s1, 0x1F -/* F45F0C 8026A6DC AC290000 */ sw $t1, %lo(D_A4300000)($at) +/* F45F0C 8026A6DC AC290000 */ sw $t1, %lo(PHYS_TO_K1(MI_MODE_REG))($at) /* F45F10 8026A6E0 0C09AA09 */ jal func_8026A824 /* F45F14 8026A6E4 24040048 */ addiu $a0, $zero, 0x48 /* F45F18 8026A6E8 2401FBFF */ addiu $at, $zero, -0x401 @@ -427,6 +430,7 @@ enqueueRunning: /* F4604C 8026A81C 0809AA99 */ j __osDispatchThread /* F46050 8026A820 00000000 */ nop endlabel func_8026A2E0 +.size func_8026A2E0, . - func_8026A2E0 # Handwritten function glabel func_8026A824 @@ -493,6 +497,7 @@ glabel func_8026A824 /* F46134 8026A904 1000FFB5 */ b enqueueRunning /* F46138 8026A908 AF5B0118 */ sw $k1, 0x118($k0) endlabel func_8026A824 +.size func_8026A824, . - func_8026A824 # Handwritten function glabel __osEnqueueAndYield @@ -528,7 +533,7 @@ glabel __osEnqueueAndYield /* F461AC 8026A97C 8CBB0118 */ lw $k1, 0x118($a1) /* F461B0 8026A980 3369FF00 */ andi $t1, $k1, 0xFF00 /* F461B4 8026A984 5120000E */ beql $t1, $zero, .L8026A9C0 -/* F461B8 8026A988 3C1BA430 */ lui $k1, %hi(D_A430000C) +/* F461B8 8026A988 3C1BA430 */ lui $k1, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) /* F461BC 8026A98C 3C088027 */ lui $t0, %hi(__OSGlobalIntMask) /* F461C0 8026A990 25087130 */ addiu $t0, $t0, %lo(__OSGlobalIntMask) /* F461C4 8026A994 8D080000 */ lw $t0, 0x0($t0) @@ -541,9 +546,9 @@ glabel __osEnqueueAndYield /* F461E0 8026A9B0 0361D824 */ and $k1, $k1, $at /* F461E4 8026A9B4 0369D825 */ or $k1, $k1, $t1 /* F461E8 8026A9B8 ACBB0118 */ sw $k1, 0x118($a1) -/* F461EC 8026A9BC 3C1BA430 */ lui $k1, %hi(D_A430000C) +/* F461EC 8026A9BC 3C1BA430 */ lui $k1, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) .L8026A9C0: -/* F461F0 8026A9C0 8F7B000C */ lw $k1, %lo(D_A430000C)($k1) +/* F461F0 8026A9C0 8F7B000C */ lw $k1, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($k1) /* F461F4 8026A9C4 1360000B */ beqz $k1, .L8026A9F4 /* F461F8 8026A9C8 00000000 */ nop /* F461FC 8026A9CC 3C1A8027 */ lui $k0, %hi(__OSGlobalIntMask) @@ -565,6 +570,7 @@ glabel __osEnqueueAndYield /* F46234 8026AA04 0809AA99 */ j __osDispatchThread /* F46238 8026AA08 00000000 */ nop endlabel __osEnqueueAndYield +.size __osEnqueueAndYield, . - __osEnqueueAndYield glabel __osEnqueueThread /* F4623C 8026AA0C 8C980000 */ lw $t8, 0x0($a0) @@ -588,6 +594,7 @@ glabel __osEnqueueThread /* F4627C 8026AA4C 03E00008 */ jr $ra /* F46280 8026AA50 ACA40008 */ sw $a0, 0x8($a1) endlabel __osEnqueueThread +.size __osEnqueueThread, . - __osEnqueueThread glabel __osPopThread /* F46284 8026AA54 8C820000 */ lw $v0, 0x0($a0) @@ -595,6 +602,7 @@ glabel __osPopThread /* F4628C 8026AA5C 03E00008 */ jr $ra /* F46290 8026AA60 AC990000 */ sw $t9, 0x0($a0) endlabel __osPopThread +.size __osPopThread, . - __osPopThread # Handwritten function glabel __osDispatchThread @@ -686,8 +694,8 @@ glabel __osDispatchThread /* F463E4 8026ABB4 275A8C60 */ addiu $k0, $k0, %lo(__osRcpImTable) /* F463E8 8026ABB8 037AD821 */ addu $k1, $k1, $k0 /* F463EC 8026ABBC 977B0000 */ lhu $k1, 0x0($k1) -/* F463F0 8026ABC0 3C1AA430 */ lui $k0, %hi(D_A430000C) -/* F463F4 8026ABC4 275A000C */ addiu $k0, $k0, %lo(D_A430000C) +/* F463F0 8026ABC0 3C1AA430 */ lui $k0, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) +/* F463F4 8026ABC4 275A000C */ addiu $k0, $k0, %lo(PHYS_TO_K1(MI_INTR_MASK_REG)) /* F463F8 8026ABC8 AF5B0000 */ sw $k1, 0x0($k0) /* F463FC 8026ABCC 00000000 */ nop /* F46400 8026ABD0 00000000 */ nop @@ -695,6 +703,7 @@ glabel __osDispatchThread /* F46408 8026ABD8 00000000 */ nop /* F4640C 8026ABDC 42000018 */ eret endlabel __osDispatchThread +.size __osDispatchThread, . - __osDispatchThread glabel __osCleanupThread /* F46410 8026ABE0 0C09936C */ jal osDestroyThread @@ -702,6 +711,7 @@ glabel __osCleanupThread /* F46418 8026ABE8 00000000 */ nop /* F4641C 8026ABEC 00000000 */ nop endlabel __osCleanupThread +.size __osCleanupThread, . - __osCleanupThread # Handwritten function glabel osMapTLBRdb @@ -730,3 +740,4 @@ glabel osMapTLBRdb /* F46478 8026AC48 00000000 */ nop /* F4647C 8026AC4C 00000000 */ nop endlabel osMapTLBRdb +.size osMapTLBRdb, . - osMapTLBRdb diff --git a/asm/core1/ultra/setintmask.s b/asm/core1/ultra/setintmask.s index a561e22f..a5cf9f88 100644 --- a/asm/core1/ultra/setintmask.s +++ b/asm/core1/ultra/setintmask.s @@ -1,4 +1,5 @@ #include +#include .include "macro.inc" # assembler directives .set noat # allow manual use of $at @@ -100,8 +101,8 @@ glabel osSetIntMask xor $t0, $t3, $at andi $t0, $t0, 0xff00 or $v0, $v0, $t0 - lui $t2, %hi(D_A430000C) - lw $t2, %lo(D_A430000C)($t2) + lui $t2, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) + lw $t2, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($t2) beqz $t2, setintmask_1 srl $t1, $t3, 0x10 addiu $at, $zero, -1 @@ -118,8 +119,8 @@ setintmask_1: lui $t2, %hi(__osRcpImTable) addu $t2, $t2, $t0 lhu $t2, %lo(__osRcpImTable)($t2) - lui $at, %hi(D_A430000C) - sw $t2, %lo(D_A430000C)($at) + lui $at, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) + sw $t2, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($at) andi $t0, $a0, 0xff01 andi $t1, $t3, 0xff00 and $t0, $t0, $t1 diff --git a/asm/ultra/exceptasm.s b/asm/ultra/exceptasm.s index 307ba0fa..ac13e866 100644 --- a/asm/ultra/exceptasm.s +++ b/asm/ultra/exceptasm.s @@ -1,4 +1,5 @@ #include +#include .include "macro.inc" # assembler directives @@ -146,8 +147,8 @@ glabel __osException /* 2F90 80002390 0369D825 */ or $k1, $k1, $t1 /* 2F94 80002394 AF5B0118 */ sw $k1, 0x118($k0) .L80002398: -/* 2F98 80002398 3C09A430 */ lui $t1, %hi(D_A430000C) -/* 2F9C 8000239C 8D29000C */ lw $t1, %lo(D_A430000C)($t1) +/* 2F98 80002398 3C09A430 */ lui $t1, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) +/* 2F9C 8000239C 8D29000C */ lw $t1, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($t1) /* 2FA0 800023A0 5120000C */ beql $t1, $zero, .L800023D4 /* 2FA4 800023A4 AF490128 */ sw $t1, 0x128($k0) /* 2FA8 800023A8 3C088000 */ lui $t0, %hi(__OSGlobalIntMask) @@ -262,21 +263,21 @@ rcp: /* 3134 80002534 3C088000 */ lui $t0, %hi(__OSGlobalIntMask) /* 3138 80002538 250850F0 */ addiu $t0, $t0, %lo(__OSGlobalIntMask) /* 313C 8000253C 8D080000 */ lw $t0, ($t0) -/* 3140 80002540 3C11A430 */ lui $s1, %hi(D_A4300008) -/* 3144 80002544 8E310008 */ lw $s1, %lo(D_A4300008)($s1) +/* 3140 80002540 3C11A430 */ lui $s1, %hi(PHYS_TO_K1(MI_INTR_REG)) +/* 3144 80002544 8E310008 */ lw $s1, %lo(PHYS_TO_K1(MI_INTR_REG))($s1) /* 3148 80002548 00084402 */ srl $t0, $t0, 0x10 /* 314C 8000254C 02288824 */ and $s1, $s1, $t0 /* 3150 80002550 32290001 */ andi $t1, $s1, 1 /* 3154 80002554 51200014 */ beql $t1, $zero, .L800025A8 /* 3158 80002558 32290008 */ andi $t1, $s1, 8 -/* 315C 8000255C 3C0CA404 */ lui $t4, %hi(D_A4040010) -/* 3160 80002560 8D8C0010 */ lw $t4, %lo(D_A4040010)($t4) +/* 315C 8000255C 3C0CA404 */ lui $t4, %hi(PHYS_TO_K1(SP_STATUS_REG)) +/* 3160 80002560 8D8C0010 */ lw $t4, %lo(PHYS_TO_K1(SP_STATUS_REG))($t4) /* 3164 80002564 24090008 */ addiu $t1, $zero, 8 -/* 3168 80002568 3C01A404 */ lui $at, %hi(D_A4040010) +/* 3168 80002568 3C01A404 */ lui $at, %hi(PHYS_TO_K1(SP_STATUS_REG)) /* 316C 8000256C 318C0300 */ andi $t4, $t4, 0x300 /* 3170 80002570 3231003E */ andi $s1, $s1, 0x3e /* 3174 80002574 11800007 */ beqz $t4, .L80002594 -/* 3178 80002578 AC290010 */ sw $t1, %lo(D_A4040010)($at) +/* 3178 80002578 AC290010 */ sw $t1, %lo(PHYS_TO_K1(SP_STATUS_REG))($at) /* 317C 8000257C 0C0009E9 */ jal send_mesg /* 3180 80002580 24040020 */ addiu $a0, $zero, 0x20 /* 3184 80002584 52200039 */ beql $s1, $zero, .L8000266C @@ -291,9 +292,9 @@ rcp: /* 31A4 800025A4 32290008 */ andi $t1, $s1, 8 .L800025A8: /* 31A8 800025A8 11200007 */ beqz $t1, .L800025C8 -/* 31AC 800025AC 3C01A440 */ lui $at, %hi(D_A4400010) +/* 31AC 800025AC 3C01A440 */ lui $at, %hi(PHYS_TO_K1(VI_CURRENT_REG)) /* 31B0 800025B0 32310037 */ andi $s1, $s1, 0x37 -/* 31B4 800025B4 AC200010 */ sw $zero, %lo(D_A4400010)($at) +/* 31B4 800025B4 AC200010 */ sw $zero, %lo(PHYS_TO_K1(VI_CURRENT_REG))($at) /* 31B8 800025B8 0C0009E9 */ jal send_mesg /* 31BC 800025BC 24040038 */ addiu $a0, $zero, 0x38 /* 31C0 800025C0 5220002A */ beql $s1, $zero, .L8000266C @@ -303,9 +304,9 @@ rcp: /* 31CC 800025CC 5120000A */ beql $t1, $zero, .L800025F8 /* 31D0 800025D0 32290002 */ andi $t1, $s1, 2 /* 31D4 800025D4 24090001 */ addiu $t1, $zero, 1 -/* 31D8 800025D8 3C01A450 */ lui $at, %hi(D_A450000C) +/* 31D8 800025D8 3C01A450 */ lui $at, %hi(PHYS_TO_K1(AI_STATUS_REG)) /* 31DC 800025DC 3231003B */ andi $s1, $s1, 0x3b -/* 31E0 800025E0 AC29000C */ sw $t1, %lo(D_A450000C)($at) +/* 31E0 800025E0 AC29000C */ sw $t1, %lo(PHYS_TO_K1(AI_STATUS_REG))($at) /* 31E4 800025E4 0C0009E9 */ jal send_mesg /* 31E8 800025E8 24040030 */ addiu $a0, $zero, 0x30 /* 31EC 800025EC 5220001F */ beql $s1, $zero, .L8000266C @@ -313,9 +314,9 @@ rcp: /* 31F4 800025F4 32290002 */ andi $t1, $s1, 2 .L800025F8: /* 31F8 800025F8 11200007 */ beqz $t1, .L80002618 -/* 31FC 800025FC 3C01A480 */ lui $at, %hi(D_A4800018) +/* 31FC 800025FC 3C01A480 */ lui $at, %hi(PHYS_TO_K1(SI_STATUS_REG)) /* 3200 80002600 3231003D */ andi $s1, $s1, 0x3d -/* 3204 80002604 AC200018 */ sw $zero, %lo(D_A4800018)($at) +/* 3204 80002604 AC200018 */ sw $zero, %lo(PHYS_TO_K1(SI_STATUS_REG))($at) /* 3208 80002608 0C0009E9 */ jal send_mesg /* 320C 8000260C 24040028 */ addiu $a0, $zero, 0x28 /* 3210 80002610 52200016 */ beql $s1, $zero, .L8000266C @@ -325,9 +326,9 @@ rcp: /* 321C 8000261C 5120000A */ beql $t1, $zero, .L80002648 /* 3220 80002620 32290020 */ andi $t1, $s1, 0x20 /* 3224 80002624 24090002 */ addiu $t1, $zero, 2 -/* 3228 80002628 3C01A460 */ lui $at, %hi(D_A4600010) +/* 3228 80002628 3C01A460 */ lui $at, %hi(PHYS_TO_K1(PI_STATUS_REG)) /* 322C 8000262C 3231002F */ andi $s1, $s1, 0x2f -/* 3230 80002630 AC290010 */ sw $t1, %lo(D_A4600010)($at) +/* 3230 80002630 AC290010 */ sw $t1, %lo(PHYS_TO_K1(PI_STATUS_REG))($at) /* 3234 80002634 0C0009E9 */ jal send_mesg /* 3238 80002638 24040040 */ addiu $a0, $zero, 0x40 /* 323C 8000263C 5220000B */ beql $s1, $zero, .L8000266C @@ -545,9 +546,9 @@ glabel __osEnqueueAndYield /* 3530 80002930 0361D824 */ and $k1, $k1, $at /* 3534 80002934 0369D825 */ or $k1, $k1, $t1 /* 3538 80002938 ACBB0118 */ sw $k1, 0x118($a1) -/* 353C 8000293C 3C1BA430 */ lui $k1, %hi(D_A430000C) +/* 353C 8000293C 3C1BA430 */ lui $k1, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) .L80002940: -/* 3540 80002940 8F7B000C */ lw $k1, %lo(D_A430000C)($k1) +/* 3540 80002940 8F7B000C */ lw $k1, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($k1) /* 3544 80002944 1360000B */ beqz $k1, .L80002974 /* 3548 80002948 00000000 */ nop /* 354C 8000294C 3C1A8000 */ lui $k0, %hi(__OSGlobalIntMask) @@ -689,8 +690,8 @@ glabel __osDispatchThread /* 3734 80002B34 275A51D0 */ addiu $k0, $k0, %lo(__osRcpImTable) /* 3738 80002B38 037AD821 */ addu $k1, $k1, $k0 /* 373C 80002B3C 977B0000 */ lhu $k1, ($k1) -/* 3740 80002B40 3C1AA430 */ lui $k0, %hi(D_A430000C) -/* 3744 80002B44 275A000C */ addiu $k0, $k0, %lo(D_A430000C) +/* 3740 80002B40 3C1AA430 */ lui $k0, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) +/* 3744 80002B44 275A000C */ addiu $k0, $k0, %lo(PHYS_TO_K1(MI_INTR_MASK_REG)) /* 3748 80002B48 AF5B0000 */ sw $k1, ($k0) /* 374C 80002B4C 00000000 */ nop /* 3750 80002B50 00000000 */ nop diff --git a/asm/ultra/setintmask.s b/asm/ultra/setintmask.s index 5af09ba5..c5c891d8 100644 --- a/asm/ultra/setintmask.s +++ b/asm/ultra/setintmask.s @@ -1,4 +1,5 @@ #include +#include .include "macro.inc" # assembler directives .set noat # allow manual use of $at @@ -100,8 +101,8 @@ glabel func_80003A30 /* 4648 80003A48 01614026 */ xor $t0, $t3, $at /* 464C 80003A4C 3108FF00 */ andi $t0, $t0, 0xff00 /* 4650 80003A50 00481025 */ or $v0, $v0, $t0 -/* 4654 80003A54 3C0AA430 */ lui $t2, %hi(D_A430000C) -/* 4658 80003A58 8D4A000C */ lw $t2, %lo(D_A430000C)($t2) +/* 4654 80003A54 3C0AA430 */ lui $t2, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) +/* 4658 80003A58 8D4A000C */ lw $t2, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($t2) /* 465C 80003A5C 11400005 */ beqz $t2, .L80003A74 /* 4660 80003A60 000B4C02 */ srl $t1, $t3, 0x10 /* 4664 80003A64 2401FFFF */ addiu $at, $zero, -1 @@ -118,8 +119,8 @@ glabel func_80003A30 /* 468C 80003A8C 3C0A8000 */ lui $t2, %hi(__osRcpImTable) /* 4690 80003A90 01485021 */ addu $t2, $t2, $t0 /* 4694 80003A94 954A51D0 */ lhu $t2, %lo(__osRcpImTable)($t2) -/* 4698 80003A98 3C01A430 */ lui $at, %hi(D_A430000C) -/* 469C 80003A9C AC2A000C */ sw $t2, %lo(D_A430000C)($at) +/* 4698 80003A98 3C01A430 */ lui $at, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) +/* 469C 80003A9C AC2A000C */ sw $t2, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($at) /* 46A0 80003AA0 3088FF01 */ andi $t0, $a0, 0xff01 /* 46A4 80003AA4 3169FF00 */ andi $t1, $t3, 0xff00 /* 46A8 80003AA8 01094024 */ and $t0, $t0, $t1 diff --git a/decompressed.us.v10.yaml b/decompressed.us.v10.yaml index fa7e0ea9..dadbfb14 100644 --- a/decompressed.us.v10.yaml +++ b/decompressed.us.v10.yaml @@ -15,12 +15,14 @@ options: #include "variables.h" undefined_syms_path: undefined_syms.us.v10.txt symbol_addrs_path: symbol_addrs.us.v10.txt - undefined_funcs_auto_path: undefined_funcs_auto.us.v10.txt - undefined_syms_auto_path: undefined_syms_auto.us.v10.txt + create_undefined_funcs_auto: no + create_undefined_syms_auto: no base_path: . target_path: decompressed.us.v10.z64 asset_path: bin build_path: build/us.v10 + libultra_symbols: True + hardware_regs: True segments: - name: header type: header @@ -123,18 +125,20 @@ segments: start: 0x5E90 subsegments: - [0x5E90, bin, assets] -- name: soundfont1 +- name: soundfont1ctl type: bin start: 0xD846C0 - subsegments: - - [0xD846C0, bin, soundfont1.ctl] - - [0xD954B0, bin, soundfont1.tbl] -- name: soundfont2 +- name: soundfont1tbl + type: bin + start: 0xD954B0 + +- name: soundfont2ctl type: bin start: 0xEA3EB0 - subsegments: - - [0xEA3EB0, bin, soundfont2.ctl] - - [0xEADE60, bin, soundfont2.tbl] +- name: soundfont2tbl + type: bin + start: 0xEADE60 + - name: core1 dir: core1 type: code @@ -1496,6 +1500,7 @@ segments: - [0x1048560, .bss, code_41FB0] - [0x1048560, .bss, code_42CB0] - [0x1048560, .bss, mapspecificflags] + - [0x1048560, .bss, code_47BD0] - [0x1048560, .bss, code_4A6F0] - [0x1048560, .bss, code_4C020] - [0x1048560, .bss, ch/badShad] @@ -1614,6 +1619,7 @@ segments: - [0x1048560, .bss, code_C5440] - [0x1048560, .bss, code_C89C0] - [0x1048560, .bss, code_C97F0] + - [0x1048560, .bss, code_C9E70] - [0x1048560, .bss, code_C9F00] - [0x1048560, .bss, code_CB8A0] - [0x1048560, .bss, code_CBBF0] @@ -1882,7 +1888,7 @@ segments: - [0x1068340, .rodata, ch/grublin] - [0x1068350, .rodata, ch/jujuhitbox] - [0x1068360, .rodata, ch/juju] - - [0x1068370, .bss, bss_pad] + - [0x1068370, .bss, ch/hut] - [0x1068370, .bss, ch/juju] - name: BGS dir: BGS @@ -2112,7 +2118,8 @@ segments: - [0x108AB50, .bss, sirslushgame] - [0x108AB50, .bss, snowmanbuttongame] - [0x108AB50, .bss, racectrl] - - [0x108AB50, .bss, bss_end_pad] + - [0x108AB50, .bss, ch/xmastreestar] + - [0x108AB50, .bss, code_B4D0] - name: SM dir: SM type: code diff --git a/first_diff.py b/first_diff.py index a2546fc1..3bffd788 100755 --- a/first_diff.py +++ b/first_diff.py @@ -184,7 +184,7 @@ def hexbytes(bs): found_instr_diff = [] map_search_diff = [] diffs = 0 -shift_cap = 1000 +shift_cap = 100000 for i in range(24, len(mybin), 4): # (mybin[i:i+4] != basebin[i:i+4], but that's slightly slower in CPython...) if diffs <= shift_cap and ( diff --git a/include/assets.h b/include/assets.h index a762c0e1..6dde267f 100644 --- a/include/assets.h +++ b/include/assets.h @@ -16,6 +16,6 @@ typedef struct asset_file_meta_s{ } AssetFileMeta; -extern u8 D_5E90; //rom file asset bin; +extern u8 assets_ROM_START[]; //rom file asset bin; #endif diff --git a/include/core2/code_C9E70.h b/include/core2/code_C9E70.h index 480ac104..bd6793e1 100644 --- a/include/core2/code_C9E70.h +++ b/include/core2/code_C9E70.h @@ -42,8 +42,6 @@ struct FF_StorageStruct_48 { struct FF_StorageStruct_48_sub data[4]; }; // 0x90 - - // FF: generic storage struct struct FF_StorageStruct { /* 00 */ BKModel *unk0; diff --git a/src/FP/bss_end_pad.c b/src/FP/bss_end_pad.c deleted file mode 100644 index 7c0e2803..00000000 --- a/src/FP/bss_end_pad.c +++ /dev/null @@ -1 +0,0 @@ -char pad_FP_803935A8[0x20]; diff --git a/src/GV/ch/histup.c b/src/GV/ch/histup.c index 7e8914d8..9b1efd8b 100644 --- a/src/GV/ch/histup.c +++ b/src/GV/ch/histup.c @@ -29,8 +29,8 @@ ActorInfo D_80391318 = { MARKER_AA_HISTUP, ACTOR_11C_HISTUP, ASSET_3DE_MODEL_HIS extern struct { s32 unk0; s32 unk4; + s32 unk8; }GV_D_80391AB0; -extern s32 D_80391AB8; /* .code */ int func_8038D920(Actor *this, f32 arg1){ @@ -114,7 +114,7 @@ void func_8038DBDC(Actor *this){ actor_collisionOff(this); subaddie_set_state_with_direction(this, 1, 0.99f, 0); animctrl_setPlaybackType(this->animctrl, ANIMCTRL_STOPPED); - D_80391AB8 = 0; + GV_D_80391AB0.unk8 = 0; func_8038DB4C(0); this->unk1C[0] = 0.0f; }//L8038DC90 @@ -134,7 +134,7 @@ void func_8038DBDC(Actor *this){ case 2: //8038DD3C if(!(func_8038E178() < 5)){ func_8038DB88(this); - if(D_80391AB8){ + if(GV_D_80391AB0.unk8){ subaddie_set_state_with_direction(this, 3, 0.99f, 0); animctrl_setPlaybackType(this->animctrl, ANIMCTRL_STOPPED); this->unk1C[0] = 0.0f; @@ -196,7 +196,7 @@ void func_8038DBDC(Actor *this){ animctrl_setDuration(this->animctrl, 1.6f); func_80386608(); func_8038DB4C(0); - D_80391AB8 = FALSE; + GV_D_80391AB0.unk8 = FALSE; func_8025A58C(-1, 0x190); func_8025A7DC(COMUSIC_27_GV_RUBEES_SONG); if(!this->unk44_31){ diff --git a/src/GV/code_7D50.c b/src/GV/code_7D50.c index 0e94027b..f4476b9d 100644 --- a/src/GV/code_7D50.c +++ b/src/GV/code_7D50.c @@ -4,7 +4,7 @@ struct { s32 unk0; - u8 pad4[4]; + s32 unk4; s32 unk8; }GV_D_80391AB0; diff --git a/src/MM/bss_pad.c b/src/MM/bss_pad.c deleted file mode 100644 index 28806312..00000000 --- a/src/MM/bss_pad.c +++ /dev/null @@ -1 +0,0 @@ -char pad_MM_D_80389C80[0x10]; diff --git a/src/MM/ch/juju.c b/src/MM/ch/juju.c index 9600d4ec..1493d8fe 100644 --- a/src/MM/ch/juju.c +++ b/src/MM/ch/juju.c @@ -19,6 +19,7 @@ void func_80389598(Actor *this); Actor* func_80389014(ActorMarker *, Gfx **, Mtx**, Vtx** ); /* .bss */ +u8 MM_pad_80389C80[0x10]; s32 MM_D_80389C90; /* .data */ diff --git a/src/RBB/propellorctrl.c b/src/RBB/propellorctrl.c index cfa06f82..cf31c61c 100644 --- a/src/RBB/propellorctrl.c +++ b/src/RBB/propellorctrl.c @@ -3,7 +3,8 @@ #include "variables.h" -s32 pad_803912C0[2]; +s32 pad_803912C0[1]; +f32 __propellorTimer2; // TODO rematch __propellorCtrl_setState to merge this with __propellorTimer u8 __propellorCtrlState; void __propellorCtrl_setState(s32 arg0){ @@ -49,14 +50,12 @@ void rbb_propellorCtrl_start(void){ } void rbb_propellorCtrl_update(void){ - extern f32 __propellorTimer; - if( __propellorCtrlState == 0) if(levelSpecificFlags_get(0x27) && levelSpecificFlags_get(0x28)) __propellorCtrl_setState(1); if(__propellorCtrlState == 1) - if(ml_timer_update(&__propellorTimer,time_getDelta())) + if(ml_timer_update(&__propellorTimer2,time_getDelta())) __propellorCtrl_setState(2); if(__propellorCtrlState == 2) diff --git a/src/core1/code_10A00.c b/src/core1/code_10A00.c index 35dec438..858af440 100644 --- a/src/core1/code_10A00.c +++ b/src/core1/code_10A00.c @@ -2,12 +2,7 @@ #include "functions.h" #include "variables.h" - -#ifndef CORE2_DATA_CRC2 - #define CORE2_DATA_CRC2 0 -#endif - -extern s32 core2_D_803727F4; +extern s32 D_803727F4; extern struct { u8 pad0[4]; @@ -32,7 +27,7 @@ typedef struct { f32 joystick[2]; }Struct_core1_10A00_1; -extern s32 D_80276574; // = CORE2_DATA_CRC2 +extern s32 D_80276574; /* .data */ s32 D_80275D30 = 0xC3A68832; //WHAT IS THIS? @@ -73,7 +68,7 @@ f32 func_8024E420(s32 arg0, s32 arg1, s32 arg2) { f32 phi_f2; phi_f2 = 0.0125f; - if ((D_80379B90.unk4 != core2_D_803727F4) || (D_80379B90.unkC != D_80276574)) { + if ((D_80379B90.unk4 != D_803727F4) || (D_80379B90.unkC != D_80276574)) { phi_f2 = 0.00625f; } if (arg0 > 0) { @@ -341,6 +336,10 @@ void func_8024F1F0(void){ void func_8024F224(void){ s32 iCont, j; + // for(iCont = 0; iCont < 4; iCont++){ + // D_80281250[iCont].unk0 = 0; + // } + for(iCont = 0; iCont < 4; iCont++){ D_80281250[iCont].unk0 = 0; D_80281250[iCont].unk2 = 0; diff --git a/src/core1/code_11AC0.c b/src/core1/code_11AC0.c index f2a05573..cfa70c3d 100644 --- a/src/core1/code_11AC0.c +++ b/src/core1/code_11AC0.c @@ -9,8 +9,9 @@ extern void func_8025F570(ALCSPlayer *, u8); extern void func_8025F510(ALCSPlayer *, u8, u8); extern void func_8025F5C0(ALCSPlayer *, u8); -extern ALBankFile D_EA3EB0; -extern ALWaveTable D_EADE60; +extern u8 soundfont2ctl_ROM_START[]; +extern u8 soundfont2ctl_ROM_END[]; +extern u8 soundfont2tbl_ROM_START[]; /* dependent functions */ void func_8024FA98(u8, enum comusic_e); @@ -220,10 +221,10 @@ void musicInstruments_init(void){ s32 i; f32 tmpf1; - size = (u8*)&D_EADE60 - (u8*)&D_EA3EB0; + size = soundfont2ctl_ROM_END - soundfont2ctl_ROM_START; bnk_f = malloc(size); osWriteBackDCacheAll(); - osPiStartDma(func_802405D0(), 0, 0, &D_EA3EB0, bnk_f, size, func_802405C4()); + osPiStartDma(func_802405D0(), 0, 0, (u32)soundfont2ctl_ROM_START, bnk_f, size, func_802405C4()); osRecvMesg(func_802405C4(), 0, 1); //osRecvMesg D_80282104 = 0xAD; D_802820E0 = (MusicTrack **) malloc(D_80282104 * sizeof(MusicTrack *)); @@ -242,7 +243,7 @@ void musicInstruments_init(void){ n_alCSPNew(&D_80281720[i].cseqp, &D_802820E8); } - alBnkfNew(bnk_f, (u8 *)&D_EADE60); + alBnkfNew(bnk_f, soundfont2tbl_ROM_START); D_80282108 = bnk_f->bankArray[0]; for(i = 0; i < 6; i++){ alCSPSetBank(&D_80281720[i].cseqp, D_80282108); diff --git a/src/core1/code_13990.c b/src/core1/code_13990.c index fcf1ddc6..086bf7a5 100644 --- a/src/core1/code_13990.c +++ b/src/core1/code_13990.c @@ -9,7 +9,7 @@ f32 func_80263FF0(f32); f32 cosf(f32); #ifndef CORE2_DATA_CRC2 - #define CORE2_DATA_CRC2 0 + #define CORE2_DATA_CRC2 0x84D7B4F8 #endif s32 D_80276570 = 0xFF62C2B8; //WHAT IS THIS? diff --git a/src/core1/code_1D00.c b/src/core1/code_1D00.c index d20c8ef6..e88dea9f 100644 --- a/src/core1/code_1D00.c +++ b/src/core1/code_1D00.c @@ -147,9 +147,9 @@ ALHeap D_8027CFF0; u8 * D_8027D000; s32 D_8027D004; OSMesgQueue D_8027D008; -OSMesg D_8027D020; +OSMesg D_8027D020[50]; OSIoMesg D_8027D0E8; -Struct_core1_1D00_4 D_8027D100[58]; +Struct_core1_1D00_4 D_8027D100[50]; struct { u8 unk0; Struct_1D00_3 *unk4; @@ -297,7 +297,7 @@ void audioManager_create(void) { int i; f32 var_f0; - osCreateMesgQueue(&D_8027D008, &D_8027D020, 0x32); + osCreateMesgQueue(&D_8027D008, D_8027D020, 50); osCreateMesgQueue(&audioManager.audioReplyMsgQ, audioManager.audioReplyMsgBuf, 8); //audioReplyMesgQueue osCreateMesgQueue(&audioManager.audioFrameMsgQ, audioManager.audioFrameMsgBuf, 8); var_f0 = 733.333313f; diff --git a/src/core1/code_2BD0.c b/src/core1/code_2BD0.c index 3f06cb29..13b56978 100644 --- a/src/core1/code_2BD0.c +++ b/src/core1/code_2BD0.c @@ -3,8 +3,10 @@ #include "variables.h" OSIoMesg D_8027E090; -OSMesg D_8027E0A8; -OSMesgQueue D_8027E0AC; +struct { + OSMesg mesg; + OSMesgQueue queue; +} D_8027E0A8; OSMesg D_8027E0C8[16]; //g_PimgrMesgBuffer OSMesgQueue D_8027E108; //g_PimgrMesgQueue @@ -19,20 +21,20 @@ void func_802405F0(u32 * arg0, s32 arg1, s32 size){ block_remainder = size % block_size; for(i = 0; i < block_cnt; i++){ - osPiStartDma(&D_8027E090, OS_MESG_PRI_NORMAL, OS_READ, arg1, arg0, 0x20000, &D_8027E0AC); - osRecvMesg(&D_8027E0AC, NULL, 1); + osPiStartDma(&D_8027E090, OS_MESG_PRI_NORMAL, OS_READ, arg1, arg0, 0x20000, &D_8027E0A8.queue); + osRecvMesg(&D_8027E0A8.queue, NULL, 1); arg1 += 0x20000; arg0 += 0x8000; } - osPiStartDma(&D_8027E090, OS_MESG_PRI_NORMAL, OS_READ, arg1, arg0, block_remainder, &D_8027E0AC); - osRecvMesg(&D_8027E0AC, NULL, 1); + osPiStartDma(&D_8027E090, OS_MESG_PRI_NORMAL, OS_READ, arg1, arg0, block_remainder, &D_8027E0A8.queue); + osRecvMesg(&D_8027E0A8.queue, NULL, 1); osInvalDCache(arg0, size); } void piMgr_create(void){ - osCreateMesgQueue(&D_8027E0AC, &D_8027E0A8, 1); + osCreateMesgQueue(&D_8027E0A8.queue, &D_8027E0A8.mesg, 1); osCreateMesgQueue(&D_8027E108, &D_8027E0C8[0], 16); osCreatePiManager(OS_PRIORITY_PIMGR, &D_8027E108, &D_8027E0C8[0], 16); } diff --git a/src/core1/code_5650.c b/src/core1/code_5650.c index fe4fc37d..b677532c 100644 --- a/src/core1/code_5650.c +++ b/src/core1/code_5650.c @@ -21,7 +21,7 @@ void func_80244978(s32 arg0, s16 type, s32 arg2); N_ALSndPlayer D_8027EEC0; s16 *D_8027EF14; -extern struct { +struct { s32 volume[4]; }D_8027EF18; diff --git a/src/core1/code_660.c b/src/core1/code_660.c index 8bbb3703..950442d9 100644 --- a/src/core1/code_660.c +++ b/src/core1/code_660.c @@ -53,7 +53,7 @@ s32 D_80275768 = 6; //dbits /* .data */ extern struct huft D_803FBE00; struct huft *D_8027BF00; -u8 pad_8027BF00[0xC]; +u8 pad_8027BF08[0x8]; u8 *D_8027BF10; //inbuf u8 *D_8027BF14; //slide u32 D_8027BF18; //inptr diff --git a/src/core1/code_72B0.c b/src/core1/code_72B0.c index eb83d545..00dc82fa 100644 --- a/src/core1/code_72B0.c +++ b/src/core1/code_72B0.c @@ -12,7 +12,6 @@ extern f32 func_8031C5D4(struct0*); extern void func_8031C5AC(struct0 *, f32 *); /* .bss */ -u8 pad_D_8027EF20[0x10]; f32 D_8027EF30; /* .code */ diff --git a/src/core1/code_8C50.c b/src/core1/code_8C50.c index 9187e78b..64f8958a 100644 --- a/src/core1/code_8C50.c +++ b/src/core1/code_8C50.c @@ -61,7 +61,7 @@ s32 D_8027599C = 0; /* .bss */ u64 D_8027EF40[OS_YIELD_DATA_SIZE / sizeof(u64)]; -static u8 pad[0x28]; // 8027FB40 +static u8 pad[0x20]; // 8027FB40 OSMesgQueue D_8027FB60; OSMesg D_8027FB78[20]; OSMesgQueue D_8027FBC8; @@ -74,7 +74,7 @@ s32 D_8027FC18; s32 D_8027FC1C; s32 D_8027FC20; s32 D_8027FC24; -u8 D_8027FC28[2040]; //stack for thread D_80280428; +u8 D_8027FC28[2048]; //stack for thread D_80280428; OSThread D_80280428; Struct_Core1_8C50_s * D_802805D8[20]; volatile s32 D_80280628; @@ -458,7 +458,7 @@ void func_80247560(void){ tmp_v0 = D_8027EF40; while((u32)tmp_v0 % 0x10){((u32)tmp_v0)++;} D_80275950.t.yield_data_ptr = tmp_v0; - osCreateThread(&D_80280428, 5, func_802473B4, NULL, &D_8027FC28[2040], 60); + osCreateThread(&D_80280428, 5, func_802473B4, NULL, &D_8027FC28[2048], 60); osStartThread(&D_80280428); } diff --git a/src/core1/code_E360.c b/src/core1/code_E360.c index 8158d989..9a6054a7 100644 --- a/src/core1/code_E360.c +++ b/src/core1/code_E360.c @@ -61,12 +61,16 @@ u32 D_80280724; u32 D_80280728; struct1 D_80280730[8]; OSMesgQueue D_80280770; +OSMesg D_80280788[10]; OSMesgQueue D_802807B0; +OSMesg D_802807C8[1]; OSMesgQueue D_802807D0; +OSMesg D_802807E8[60]; volatile s32 D_802808D8; s32 D_802808DC; OSThread D_802808E0; -u8 pad_80280970[0x520]; +#define THREAD0_STACK_SIZE 0x400 +u8 thread0_stack[THREAD0_STACK_SIZE]; extern u8 D_803A5D00[2][0x1ECC0]; //framebuffer @@ -100,7 +104,6 @@ void func_8024BDAC(OSMesgQueue *mq, OSMesg msg){ } void func_8024BE30(void){ - extern s32 D_80280E90; s32 i; func_8024C428(); @@ -113,9 +116,9 @@ void func_8024BE30(void){ osViSetSpecialFeatures(OS_VI_DITHER_FILTER_ON); osViSetSpecialFeatures(OS_VI_GAMMA_OFF); osViSwapBuffer(&D_803A5D00); - osCreateMesgQueue(&D_80280770, (&D_80280770 + 1), 10); - osCreateMesgQueue(&D_802807B0, (&D_802807B0 + 1), 1); - osCreateMesgQueue(&D_802807D0, (&D_802807D0 + 1), 0x3C); + osCreateMesgQueue(&D_80280770, D_80280788, 10); + osCreateMesgQueue(&D_802807B0, D_802807C8, 1); + osCreateMesgQueue(&D_802807D0, D_802807E8, 60); osViSetEvent(&D_80280770,NULL,1); D_80280720 = 0; D_80280724 = 1; @@ -125,7 +128,7 @@ void func_8024BE30(void){ } D_802808D8 = 0; func_8024BF94(2); - osCreateThread(&D_802808E0,0,func_8024C2F8,NULL,&D_80280E90,0x50); + osCreateThread(&D_802808E0,0,func_8024C2F8,NULL,&thread0_stack[THREAD0_STACK_SIZE],80); osStartThread(&D_802808E0); } diff --git a/src/core2/bs/dronevanish.c b/src/core2/bs/dronevanish.c index 2ef91e5f..12b80bbd 100644 --- a/src/core2/bs/dronevanish.c +++ b/src/core2/bs/dronevanish.c @@ -12,6 +12,7 @@ struct { f32 unkC; f32 unk10; }D_8037D450; +u32 pad_8037D464; u8 D_8037D468; /* .code */ diff --git a/src/core2/ch/bottlesbonuscursor.c b/src/core2/ch/bottlesbonuscursor.c index 021c0cf8..49615def 100644 --- a/src/core2/ch/bottlesbonuscursor.c +++ b/src/core2/ch/bottlesbonuscursor.c @@ -7,7 +7,7 @@ #endif extern s16 D_803A5D00[2][0xF660]; //framebuffer -extern u8 D_8037DCC8[]; //bottels bonus flags??? +extern u8 D_8037DCC8; //bottles bonus flags??? extern void ml_vec3f_assign(f32[3], f32, f32, f32); @@ -61,9 +61,8 @@ ActorInfo D_80368418 = { /* .bss */ ActorMarker *chBottlesBonusCursorMarker; -f32 D_8037E068[20][2]; +f32 D_8037E068[60][2]; Struct_core2_584D0_0 D_8037E248[20]; //puzzle pieces -u8 pad_8037E478[0x140]; s32 D_8037E5B8; struct { s32 unk0; diff --git a/src/core2/ch/gameSelect.c b/src/core2/ch/gameSelect.c index caa23cf3..b4ee783e 100644 --- a/src/core2/ch/gameSelect.c +++ b/src/core2/ch/gameSelect.c @@ -2,6 +2,7 @@ #include "functions.h" #include "variables.h" +#include "core2/code_C9E70.h" #include "core2/modelRender.h" #ifndef ABS @@ -77,10 +78,21 @@ ActorInfo D_80365F00 = { 0xE6, 0x197, 0x532, 0x1, D_80365ED0, func_802C4C14, fun /* .bss */ -// Remove this when this memory region is properly symbolized -u8 unk_8037DCB0[0x8037DCE0 - 0x8037DCB0]; - -extern u8 D_8037DCCE[0x12]; +s32 D_8037DCB0; +u32 D_8037DCB4; +struct FF_StorageStruct* D_8037DCB8; +s32 D_8037DCBC; +u8 D_8037DCC0[7]; +u8 D_8037DCC7; +u8 D_8037DCC8; +u8 D_8037DCC9; +u8 D_8037DCCA; +u8 D_8037DCCB; +u8 D_8037DCCC; +u8 D_8037DCCD; +u8 D_8037DCCE[3]; +s32 pad_8037DCD4; +s32 pad_8037DCD8; struct { u8 *unk0; diff --git a/src/core2/code_47BD0.c b/src/core2/code_47BD0.c index 820098ec..fee020d4 100644 --- a/src/core2/code_47BD0.c +++ b/src/core2/code_47BD0.c @@ -2,6 +2,7 @@ #include "functions.h" #include "variables.h" +#include "core2/code_C9E70.h" extern void func_8030DBFC(u32, f32, f32, f32); extern bool func_80309DBC(f32[3], f32[3], f32, f32 sp54[3], s32, s32); @@ -45,8 +46,6 @@ ActorInfo D_80367310 = {MARKER_217_BEE_SWARM, ACTOR_34D_BEE_SWARM, ASSET_49E_SPR 0, 0, 1.0f, 0 }; - -/* .bss */ extern s32 D_8037DCBC; /* .code */ diff --git a/src/core2/code_59D40.c b/src/core2/code_59D40.c index 0d0472ae..48fcbd18 100644 --- a/src/core2/code_59D40.c +++ b/src/core2/code_59D40.c @@ -39,6 +39,7 @@ ActorInfo D_80368620 = { /* .bss */ ActorMarker *D_8037E620; +f32 D_8037E624; f32 D_8037E628; s32 D_8037E62C; s32 D_8037E630; @@ -292,7 +293,6 @@ void chsnacker_update(Actor *this) { this->depth_mode = (255.0 == local->unk4) ? MODEL_RENDER_DEPTH_FULL : MODEL_RENDER_DEPTH_COMPARE; } -extern f32 D_8037E624; void func_802E1790(void){ D_8037E624 = 0.0f; D_8037E628 = 1.0f; diff --git a/src/core2/code_5BEB0.c b/src/core2/code_5BEB0.c index a92a825b..295376fe 100644 --- a/src/core2/code_5BEB0.c +++ b/src/core2/code_5BEB0.c @@ -9,7 +9,6 @@ typedef struct map_savestate_s{ /* .bss */ s32 D_8037E650[0x9A]; -u8 pad_8037E8A8[0x18]; /* public functions */ void func_802E3BD0(s32 frame_buffer_indx); diff --git a/src/core2/code_AE290.c b/src/core2/code_AE290.c index fde2f575..620d6b12 100644 --- a/src/core2/code_AE290.c +++ b/src/core2/code_AE290.c @@ -5,8 +5,9 @@ extern ALBank *music_get_sound_bank(void); -extern u8 D_D846C0; -extern u8 D_D954B0; +extern u8 soundfont1ctl_ROM_START[]; +extern u8 soundfont1ctl_ROM_END[]; +extern u8 soundfont1tbl_ROM_START[]; struct { s32 unk0; //sound state cnt @@ -25,12 +26,12 @@ void sfxInstruments_init(void){ ALBankFile * bnkf; - size = &D_D954B0 - &D_D846C0; + size = soundfont1ctl_ROM_END - soundfont1ctl_ROM_START; bnkf = (ALBankFile *)malloc(size); osWritebackDCache(bnkf, size); - osPiStartDma(func_802405D0(), 0, 0, &D_D846C0, bnkf, size, func_802405C4()); + osPiStartDma(func_802405D0(), 0, 0, (u32)soundfont1ctl_ROM_START, bnkf, size, func_802405C4()); osRecvMesg(func_802405C4(), NULL, 1); - alBnkfNew(bnkf, &D_D954B0); + alBnkfNew(bnkf, soundfont1tbl_ROM_START); bnk = bnkf->bankArray[0]; inst = bnk->instArray[0]; D_803835F0.unk0 = inst->soundCount; diff --git a/src/core2/code_B3A80.c b/src/core2/code_B3A80.c index 96bced6f..59065812 100644 --- a/src/core2/code_B3A80.c +++ b/src/core2/code_B3A80.c @@ -437,7 +437,7 @@ void assetCache_init(void){ assetCacheAssetIdList = (s16 *)malloc(150*sizeof(s16)); assetCacheLength = 0; assetSectionRomHeader = (AssetROMHead *)malloc(sizeof(AssetROMHead)); - D_80383CC8 = (u32) &D_5E90; + D_80383CC8 = (u32)assets_ROM_START; func_802405F0(assetSectionRomHeader, D_80383CC8, sizeof(AssetROMHead)); assetSectionRomMetaList = (AssetFileMeta *)malloc(assetSectionRomHeader->count*sizeof(AssetFileMeta)); func_802405F0(assetSectionRomMetaList, D_80383CC8 + sizeof(AssetROMHead),assetSectionRomHeader->count*sizeof(AssetFileMeta)); diff --git a/src/core2/code_C9E70.c b/src/core2/code_C9E70.c index fe74d0c8..1522c47b 100644 --- a/src/core2/code_C9E70.c +++ b/src/core2/code_C9E70.c @@ -4,7 +4,7 @@ #include "core2/code_C9E70.h" -struct FF_StorageStruct *D_8037DCB8; +extern struct FF_StorageStruct *D_8037DCB8; void func_80350E00(void){ quizQuestionAskedBitfield_defrag(); diff --git a/src/core2/code_CF5F0.c b/src/core2/code_CF5F0.c index ecaa9d91..f85d466f 100644 --- a/src/core2/code_CF5F0.c +++ b/src/core2/code_CF5F0.c @@ -15,7 +15,7 @@ extern u8 crc_ROM_START[]; // bk_boot segment crc next word s32 D_803727F0 = 0; -s32 core2_D_803727F4 = CORE2_CODE_CRC2; +s32 D_803727F4 = CORE2_CODE_CRC2; s32 D_803727F8 = 0; s32 D_803727FC = 0; diff --git a/src/core2/code_D9B0.c b/src/core2/code_D9B0.c index 992fbcdc..7c8db6a8 100644 --- a/src/core2/code_D9B0.c +++ b/src/core2/code_D9B0.c @@ -14,8 +14,8 @@ enum transformation_e D_8037C2D0; f32 D_8037C2D8[3]; f32 D_8037C2E4; enum asset_e D_8037C2E8; -u8 D_8037C2ED; u8 D_8037C2EC; +u8 D_8037C2ED; struct{ f32 unk0; diff --git a/src/core2/nc/dynamicCamera.c b/src/core2/nc/dynamicCamera.c index af64857f..914f75da 100644 --- a/src/core2/nc/dynamicCamera.c +++ b/src/core2/nc/dynamicCamera.c @@ -41,7 +41,6 @@ s32 D_8037D940; f32 D_8037D948[3]; f32 cameraPosition[3]; f32 cameraRotation[3]; -f32 D_8037D96C; f32 D_8037D974; f32 D_8037D978; f32 D_8037D97C; @@ -188,7 +187,7 @@ void func_802BCA58(void) { player_getPosition(player_position); ml_vec3f_diff_copy(sp34, player_position, cameraPosition); sp4C = player_getYaw(); - sp48 = ml_map_f(mlAbsF((f32) (mlNormalizeAngle(D_8037D96C - sp4C) - 180.0)), 0.0f, 180.0f, D_8037D97C, D_8037D980); + sp48 = ml_map_f(mlAbsF((f32) (mlNormalizeAngle(cameraRotation[1] - sp4C) - 180.0)), 0.0f, 180.0f, D_8037D97C, D_8037D980); func_80256E24(D_8037D9A8, 0.0f, sp4C, 0.0f, 0.0f, ml_map_f(gu_sqrtf(sp34[0]*sp34[0] + sp34[2]*sp34[2]), 300.0f, 450.0f, 0.0f, sp48)); ml_vec3f_diff_copy(sp34, D_8037D9A8, D_8037D9B8); if (func_802BC428()) { diff --git a/src/done/bk_boot_1050.c b/src/done/bk_boot_1050.c index 0c7720d4..924c77a3 100644 --- a/src/done/bk_boot_1050.c +++ b/src/done/bk_boot_1050.c @@ -12,7 +12,7 @@ u64 gEntryStack[ENTRY_STACK_LEN_U64]; extern u8 core1_us_v10_rzip_ROM_START[]; extern u8 core1_us_v10_rzip_ROM_END[]; extern u8 D_8002D500; -extern u8 D_8023DA20; +extern u8 core1_VRAM; extern u32 D_803FFE00[4]; void func_80000594(u8 **, u8 **); @@ -23,7 +23,7 @@ void func_80000450(s32 arg0){ u8 *dst; tmp = &D_8002D500; - dst = &D_8023DA20; + dst = &core1_VRAM; osInitialize(); osPiRawStartDma(OS_READ, core1_us_v10_rzip_ROM_START, tmp, core1_us_v10_rzip_ROM_END - core1_us_v10_rzip_ROM_START); while(osPiGetStatus() & PI_STATUS_DMA_BUSY); diff --git a/src/fight/chfinalboss.c b/src/fight/chfinalboss.c index 1840fae5..f0978ec4 100644 --- a/src/fight/chfinalboss.c +++ b/src/fight/chfinalboss.c @@ -1466,7 +1466,7 @@ u8 D_8039286A; u8 D_8039286B; u8 D_8039286C[0x4C]; -f32 D_803928B8[2]; +f32 D_803928B8[3]; void chfinalboss_phase3_update(ActorMarker *marker) { static f32 D_803917A4[4] = {500.0f, 650.0f, 800.0f, 950.0f}; diff --git a/src/fight/chstonejinjo.c b/src/fight/chstonejinjo.c index 31698801..a0506114 100644 --- a/src/fight/chstonejinjo.c +++ b/src/fight/chstonejinjo.c @@ -16,7 +16,7 @@ ActorAnimationInfo fight_D_803919F0[] ={ {0x265, 1e+8f}, {0x265, 1e+8f}, }; -ActorInfo D_80391A10 = { +ActorInfo fight_D_80391A10 = { MARKER_276_STONE_JINJO, ACTOR_3A1_STONE_JINJO, ASSET_545_MODEL_STONE_JINJO, 0x1, fight_D_803919F0, chstonejinjo_update, func_80326224, actor_draw, diff --git a/src/lair/code_5ED0.c b/src/lair/code_5ED0.c index a6900e91..05834d40 100644 --- a/src/lair/code_5ED0.c +++ b/src/lair/code_5ED0.c @@ -186,7 +186,7 @@ extern Struct_lair_5ED0_0 D_80393760[FF_QNF_CNT - 1] = { }; -extern struct FF_QuestionTypeInfo FF_QuestionTypeInfoArr[5] = { +struct FF_QuestionTypeInfo FF_QuestionTypeInfoArr[5] = { { 0x0, 100}, { 0x64, 118}, { 0xDA, 51}, @@ -194,7 +194,7 @@ extern struct FF_QuestionTypeInfo FF_QuestionTypeInfoArr[5] = { {0x12B, 6} }; -extern struct { +struct { u8 unk0; s16 unk2; s16 unk4; diff --git a/undefined_syms.libultra.txt b/undefined_syms.libultra.txt index 78fa6052..1ef69a36 100644 --- a/undefined_syms.libultra.txt +++ b/undefined_syms.libultra.txt @@ -1,35 +1,46 @@ +/* Fixed-address libultra symbols */ osTvType = 0x80000300; osRomBase = 0x80000308; osResetType = 0x8000030C; osCicId = 0x80000310; osAppNMIBuffer = 0x8000031C; -D_8023DA20 = 0x8023DA20; + +/* Microcode renames to match ucode.h names */ +n_aspMainTextStart = _binary_bin_core1_n_aspMain_text_bin_start; +n_aspMainTextEnd = _binary_bin_core1_n_aspMain_text_bin_end; +gSPF3DEX_fifoTextStart = _binary_bin_core1_gSPF3DEX_fifo_text_bin_start; +gSPF3DEX_fifoTextEnd = _binary_bin_core1_gSPF3DEX_fifo_text_bin_end; +gSPL3DEX_fifoTextStart = _binary_bin_core1_gSPL3DEX_fifo_text_bin_start; +gSPL3DEX_fifoTextEnd = _binary_bin_core1_gSPL3DEX_fifo_text_bin_end; +n_aspMainDataStart = _binary_bin_core1_n_aspMain_data_bin_start; +n_aspMainDataEnd = _binary_bin_core1_n_aspMain_data_bin_end; +gSPF3DEX_fifoDataStart = _binary_bin_core1_gSPF3DEX_fifo_data_bin_start; +gSPF3DEX_fifoDataEnd = _binary_bin_core1_gSPF3DEX_fifo_data_bin_end; +gSPL3DEX_fifoDataStart = _binary_bin_core1_gSPL3DEX_fifo_data_bin_start; +gSPL3DEX_fifoDataEnd = _binary_bin_core1_gSPL3DEX_fifo_data_bin_end; + +/* Fixed-address buffers */ +D_8000E800 = 0x8000E800; +D_8002D500 = 0x8002D500; +D_8023DA00 = 0x8023DA00; /* confirm */ +D_803FBE00 = 0x803FBE00; +D_803FFE00 = 0x803FFE00; +D_803FFE10 = 0x803FFE10; gOverlayTable = 0x803FFE10; -func_8023DA20 = 0x8023DA20; +D_803A5D00 = 0x803A5D00; /* framebuffers */ + +/* Renames for the boot segment */ +boot_osTvType = osTvType; +boot_osRomBase = osRomBase; +boot_osResetType = osResetType; +boot_osCicId = osCicId; +boot_osAppNMIBuffer = osAppNMIBuffer; -boot_osTvType = 0x80000300; -boot_osRomBase = 0x80000308; -boot_osResetType = 0x8000030C; -boot_osAppNMIBuffer = 0x8000031C; boot_D_8002D500 = D_8002D500; -boot_func_8023DA20 = func_8023DA20; -boot_D_8023DA20 = core1_VRAM; -boot_gOverlayTable = gOverlayTable; +boot_core1_VRAM = core1_VRAM; boot_D_803FBE00 = D_803FBE00; -boot_D_803FFE00 = 0x803FFE00; +boot_D_803FFE00 = D_803FFE00; +boot_gOverlayTable = gOverlayTable; +boot_func_8023DA20 = func_8023DA20; -boot_D_A430000C = 0xA430000C; -boot_D_A4300008 = 0xA4300008; -boot_D_A4300008 = 0xA4300008; -boot_D_A4040010 = 0xA4040010; -boot_D_A4040010 = 0xA4040010; -boot_D_A4040010 = 0xA4040010; -boot_D_A4040010 = 0xA4040010; -boot_D_A4400010 = 0xA4400010; -boot_D_A4400010 = 0xA4400010; -boot_D_A450000C = 0xA450000C; -boot_D_A450000C = 0xA450000C; -boot_D_A4800018 = 0xA4800018; -boot_D_A4800018 = 0xA4800018; -boot_D_A4600010 = 0xA4600010; -boot_D_A4600010 = 0xA4600010; +__propellorTimer = 0x803912CC; diff --git a/undefined_syms.us.v10.txt b/undefined_syms.us.v10.txt deleted file mode 100644 index 38d9bf15..00000000 --- a/undefined_syms.us.v10.txt +++ /dev/null @@ -1,34 +0,0 @@ -/* lair */ -FF_QuestionTypeInfoArr = 0x80394340; -D_80392EB0 = 0x80392EB0; -D_80392E20 = 0x80392E20; -lair_D_80392D90 = 0x80392D90; -MMM_D_8038C510 = 0x8038C510; -func_803863F0 = 0x803863F0; -D_8038D6A0 = 0x8038D6A0; -D_8038D378 = 0x8038D378; -D_8038D4DC = 0x8038D4DC; -D_8038D534 = 0x8038D534; -D_8038D590 = 0x8038D590; -D_8038D6DC = 0x8038D6DC; -D_8038D844 = 0x8038D844; -fight_D_80391A10 = 0x80391A10; -FP_D_80392840 = 0x80392840; -core1_D_803727F4 = 0x803727F4; -__osBaseTimer = 0x80285D00; -FP_D_80392864 = 0x80392864; -D_803687F0 = 0x803687F0; -D_80276E70 = 0x80276E70; - -n_aspMainTextStart = _binary_bin_core1_n_aspMain_text_bin_start; -n_aspMainTextEnd = _binary_bin_core1_n_aspMain_text_bin_end; -gSPF3DEX_fifoTextStart = _binary_bin_core1_gSPF3DEX_fifo_text_bin_start; -gSPF3DEX_fifoTextEnd = _binary_bin_core1_gSPF3DEX_fifo_text_bin_end; -gSPL3DEX_fifoTextStart = _binary_bin_core1_gSPL3DEX_fifo_text_bin_start; -gSPL3DEX_fifoTextEnd = _binary_bin_core1_gSPL3DEX_fifo_text_bin_end; -n_aspMainDataStart = _binary_bin_core1_n_aspMain_data_bin_start; -n_aspMainDataEnd = _binary_bin_core1_n_aspMain_data_bin_end; -gSPF3DEX_fifoDataStart = _binary_bin_core1_gSPF3DEX_fifo_data_bin_start; -gSPF3DEX_fifoDataEnd = _binary_bin_core1_gSPF3DEX_fifo_data_bin_end; -gSPL3DEX_fifoDataStart = _binary_bin_core1_gSPL3DEX_fifo_data_bin_start; -gSPL3DEX_fifoDataEnd = _binary_bin_core1_gSPL3DEX_fifo_data_bin_end; From 9f05494e7caf62214a0b669a98f95861bf3f1206 Mon Sep 17 00:00:00 2001 From: Mr-Wiseguy Date: Fri, 30 Aug 2024 19:38:02 -0400 Subject: [PATCH 31/38] Matched __propellorCtrl_setState without a function static --- src/RBB/propellorctrl.c | 19 ++++++++++--------- undefined_syms.libultra.txt | 2 -- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/RBB/propellorctrl.c b/src/RBB/propellorctrl.c index cf31c61c..27047fb8 100644 --- a/src/RBB/propellorctrl.c +++ b/src/RBB/propellorctrl.c @@ -2,17 +2,18 @@ #include "functions.h" #include "variables.h" - -s32 pad_803912C0[1]; -f32 __propellorTimer2; // TODO rematch __propellorCtrl_setState to merge this with __propellorTimer +s32 pad_803912C0[2]; u8 __propellorCtrlState; +f32 __propellorTimer; -void __propellorCtrl_setState(s32 arg0){ - static f32 __propellorTimer; +void __propellorCtrl_setState(s32 arg0){ + f32* timerPtr = &__propellorTimer; + + *timerPtr = 0.0f; - __propellorTimer = 0.0f; - if(arg0 == 1) - __propellorTimer = 6.5f; + if(arg0 == 1) { + *timerPtr = 6.5f; + } if(arg0 == 2){ item_set(ITEM_3_PROPELLOR_TIMER, 3900 - 1); @@ -55,7 +56,7 @@ void rbb_propellorCtrl_update(void){ __propellorCtrl_setState(1); if(__propellorCtrlState == 1) - if(ml_timer_update(&__propellorTimer2,time_getDelta())) + if(ml_timer_update(&__propellorTimer,time_getDelta())) __propellorCtrl_setState(2); if(__propellorCtrlState == 2) diff --git a/undefined_syms.libultra.txt b/undefined_syms.libultra.txt index 1ef69a36..05bcae7b 100644 --- a/undefined_syms.libultra.txt +++ b/undefined_syms.libultra.txt @@ -42,5 +42,3 @@ boot_D_803FBE00 = D_803FBE00; boot_D_803FFE00 = D_803FFE00; boot_gOverlayTable = gOverlayTable; boot_func_8023DA20 = func_8023DA20; - -__propellorTimer = 0x803912CC; From 9d1d1e5de8d083d2ad9748ad5e22882c7ff28d3a Mon Sep 17 00:00:00 2001 From: Mr-Wiseguy Date: Fri, 30 Aug 2024 20:51:36 -0400 Subject: [PATCH 32/38] Fix bss ordering in code_7AF80 --- src/core2/code_7AF80.c | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/src/core2/code_7AF80.c b/src/core2/code_7AF80.c index 19a350e1..a7f3e16d 100644 --- a/src/core2/code_7AF80.c +++ b/src/core2/code_7AF80.c @@ -117,9 +117,6 @@ struct { s32 unk44; } D_80381FA0; - -u8 D_80381FE8[0x50]; - /* .code */ void func_80301F10(Cube *cube, Gfx **gfx, Mtx **mtx, Vtx **vtx){ func_80308F0C(cube); @@ -252,6 +249,7 @@ void func_80301F50(Gfx **gfx, Mtx **mtx, Vtx **vtx, s32 arg3[3], s32 arg4[3], s3 sp44 -= D_80381FA0.stride[0]; } } +u8 D_80381FE8[0x50]; void func_80302634(Gfx **gfx, Mtx **mtx, Vtx **vtx, s32 arg3[3], s32 arg4[3], s32 arg5[3]) { s32 sp54; @@ -541,6 +539,7 @@ Cube *func_8030364C(void){ return D_80381FA0.unk40; } +s32 D_803820A8[3]; Cube *func_80303658(void){ return D_80381FA0.unk3C; } @@ -637,6 +636,11 @@ BKCollisionTri * func_80303960(f32 volume_p1[3], f32 volume_p2[3], f32 radius, f return var_s5; } +s32 D_803820B8[0x20]; //ActorProp *, (maybe Prop *) +u8 pad_80382138[4]; +s32 D_8038213C; + +extern Cube *D_80382144; //BKCollisionTri * BKCollisionTri * func_80303AF0(f32 position[3], f32 radius, f32 arg2[3], u32 arg3) { s32 cube_indx[3]; @@ -664,7 +668,6 @@ BKCollisionTri * func_80303AF0(f32 position[3], f32 radius, f32 arg2[3], u32 arg return var_s5; } -s32 D_803820B8[0x20]; //ActorProp *, (maybe Prop *) void func_80303C54(Cube *cube, ActorMarker *marker, f32 arg2, s32 arg3, s32 *arg4, s32 *arg5) { ActorProp *phi_s0; @@ -676,7 +679,7 @@ void func_80303C54(Cube *cube, ActorMarker *marker, f32 arg2, s32 arg3, s32 *arg phi_s0 = func_803322F0(cube, marker, arg2, arg3, arg4); if (phi_s0 != NULL) { if (phi_s0->unk8_0 && phi_s0->marker->unk58 != NULL) { - if (phi_s0->marker->unk58(phi_s0->marker, marker) == 0) { + if (phi_s0->marker->unk58(phi_s0->marker, marker) == 0) { phi_s0 = NULL; } } @@ -688,7 +691,10 @@ void func_80303C54(Cube *cube, ActorMarker *marker, f32 arg2, s32 arg3, s32 *arg }; } -s32 D_8038213C; +Cube *D_80382144; +s32 D_80382148; +s16 D_80382150[0x48]; +u32 D_803821E0[0x5B]; void func_80303D78(ActorMarker *arg0, f32 arg1, UNK_TYPE(s32) arg2) { s32 sp6C[3]; s32 sp60[3]; @@ -727,17 +733,19 @@ void func_80303F6C(s32 indx, s32 arg1){ ActorProp *func_80303F7C(ActorMarker *arg0, f32 arg1, s32 arg2, s32 arg3) { s32 temp_v1; s32 phi_a0; - static s32 D_80382148; + // This matches without a pointer by using a function static, but + // triggers tricky bss reordering. + s32* D_80382148_ptr = &D_80382148; if (arg3 == 0) { func_80303D78(arg0, arg1, arg2); - D_80382148 = 0; + *D_80382148_ptr = 0; return 0; } else{ - temp_v1 = D_803820B8[D_80382148]; + temp_v1 = D_803820B8[*D_80382148_ptr]; if (temp_v1 != 0) { - D_80382148++; + (*D_80382148_ptr)++; } return temp_v1; } @@ -2042,10 +2050,8 @@ u32 func_80307EA8(s32 arg0, s32 arg1[3], s32 *arg2, s32 *arg3) { u32 var_s4; NodeProp *temp_a0; Cube *temp_v0; - static s32 D_803820A8[3]; static s32 D_803820B4; - var_s4 = 0; if (arg0 == 0) { D_803820A8[0] = (s32) D_80381FA0.min[0]; @@ -2154,11 +2160,9 @@ bool func_803082D8(Cube *arg0, s32 *arg1, bool arg2, bool arg3) { return var_a0; } -Cube *D_80382144; s32 func_803083B0(s32 arg0) { s32 var_v0; Cube *var_s0; - static u8 a; static s32 D_80382140; if (arg0 == -1) { @@ -2323,9 +2327,6 @@ bool func_803088C8(s32 arg0) { return (D_8036ABAC[i] == -1) ? FALSE : TRUE; } -/* .bss */ //must be defined AFTER func_80303F7C for local static alignment -s16 D_80382150[0x48]; - /* .code */ void func_8030895C(s32 arg0){ D_80382150[D_8036ABD4] = arg0; @@ -2416,9 +2417,6 @@ void func_80308D2C(Gfx **gfx, Mtx **mtx, Vtx **vtx) { func_8032F464(0); } -/* .bss */ -u32 D_803821E0[0x5B]; - /* .code */ void func_80308EC8(void){ s32 i; From fd89ad55607fb9cc572d313312393e209d18c369 Mon Sep 17 00:00:00 2001 From: Mr-Wiseguy Date: Fri, 30 Aug 2024 21:56:03 -0400 Subject: [PATCH 33/38] Back to OK without undefined symbols --- src/fight/chfinalboss.c | 175 ++++++++-------------------------------- 1 file changed, 32 insertions(+), 143 deletions(-) diff --git a/src/fight/chfinalboss.c b/src/fight/chfinalboss.c index f0978ec4..36768734 100644 --- a/src/fight/chfinalboss.c +++ b/src/fight/chfinalboss.c @@ -189,9 +189,18 @@ f32 D_80391774[3] = {-1290.0f, 0.0f, -1290.0f}; f32 D_80391780[3] = {1290.0f, 0.0f, -1290.0f}; f32 D_8039178C[3] = {1290.0f, 0.0f, 1290.0f}; f32 D_80391798[3] = {0.0f, 0.0f, 0.0f}; +f32 D_803917A4[4] = {500.0f, 650.0f, 800.0f, 950.0f}; +f32 D_803917B4[4] = {3.75f, 3.0f, 2.25f, 1.5f}; +s32 D_803917C4[3] = {230, 230, 230}; +f32 D_803917D0[4] = {2.4f, 2.1f, 1.8f, 1.5f}; +f32 D_803917E0[3] = {0.0f, 186.0f, 0.0f}; +f32 D_803917EC[3] = {-827.0f, 793.0f, 1700.0f}; +f32 D_803917F8[3] = {827.0f, 793.0f, -1700.0f}; +f32 D_80391804[3] = {0.0f, 0.0f, 1350.0f}; /* .bss */ +f32 D_80392750; f32 D_80392758[3]; f32 D_80392768[3]; f32 D_80392778[3]; @@ -207,70 +216,10 @@ u8 __chFinalBossJinjonatorHits; u8 D_803927C7; u8 D_803927C8; u8 D_803927C9; -f32 D_803927D0[4][3]; //actually f32 [0x13][3], but exploded to match .bss wrapping -//Exploded for .bss matching -u8 D_80392800; -u8 D_80392801; -u8 D_80392802; -u8 D_80392803; -u8 D_80392804; -u8 D_80392805; -u8 D_80392806; -u8 D_80392807; -u8 D_80392808; -u8 D_80392809; -u8 D_8039280A; -u8 D_8039280B; -u8 D_8039280C; -u8 D_8039280D; -u8 D_8039280E; -u8 D_8039280F; -u8 D_80392810; -u8 D_80392811; -u8 D_80392812; -u8 D_80392813; -u8 D_80392814; -u8 D_80392815; -u8 D_80392816; -u8 D_80392817; -u8 D_80392818; -u8 D_80392819; -u8 D_8039281A; -u8 D_8039281B; -u8 D_8039281C; -u8 D_8039281D; -u8 D_8039281E; -u8 D_8039281F; -u8 D_80392820; -u8 D_80392821; -u8 D_80392822; -u8 D_80392823; -u8 D_80392824; -u8 D_80392825; -u8 D_80392826; -u8 D_80392827; -u8 D_80392828; -u8 D_80392829; -u8 D_8039282A; -u8 D_8039282B; -u8 D_8039282C; -u8 D_8039282D; -u8 D_8039282E; -u8 D_8039282F; -u8 D_80392830; -u8 D_80392831; -u8 D_80392832; -u8 D_80392833; -u8 D_80392834; -u8 D_80392835; -u8 D_80392836; -u8 D_80392837; -u8 D_80392838; -u8 D_80392839; -u8 D_8039283A; -u8 D_8039283B; - - +f32 D_803927D0[0x13][3]; +f32 D_803928B8[3]; +s32 D_803928C4; +f32 D_803928C8[3]; /* .code */ Actor *chfinalboss_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { @@ -1312,10 +1261,8 @@ void chfinalboss_phase2_update(ActorMarker *marker) { } void __chfinalboss_spawnStatue(enum bossjinjo_e statue_id) { - static f32 D_80392750; - s32 pad24_A; - s32 pad20_A; + f32* D_80392750_ptr = &D_80392750; Actor *sp1C; ActorLocal_fight_180 *local; @@ -1343,8 +1290,8 @@ void __chfinalboss_spawnStatue(enum bossjinjo_e statue_id) { break; case BOSSJINJO_JINJONATOR: - D_80392750 = ((local->mirror_phase5) ? 0.0f : 180.0f); - sp1C = func_8032813C(ACTOR_3A9_JINJONATOR_STATUE_BASE, D_80391798, (s32)D_80392750); + *D_80392750_ptr = ((local->mirror_phase5) ? 0.0f : 180.0f); + sp1C = func_8032813C(ACTOR_3A9_JINJONATOR_STATUE_BASE, D_80391798, (s32)*D_80392750_ptr); break; } sp1C->unk60 = (statue_id == BOSSJINJO_JINJONATOR) ? 5.25f : 1.54f; @@ -1415,63 +1362,7 @@ void chfinalboss_dropHealth(ActorMarker *marker) { SPAWNQUEUE_ADD_1(__chfinalboss_dropHealth, marker); } -//exploded for .bss matching -u8 D_8039283C; -u8 D_8039283D; -u8 D_8039283E; -u8 D_8039283F; -u8 fight_D_80392840; -u8 D_80392841; -u8 D_80392842; -u8 D_80392843; -u8 D_80392844; -u8 D_80392845; -u8 D_80392846; -u8 D_80392847; -u8 D_80392848; -u8 D_80392849; -u8 D_8039284A; -u8 D_8039284B; -u8 D_8039284C; -u8 D_8039284D; -u8 D_8039284E; -u8 D_8039284F; -u8 D_80392850; -u8 D_80392851; -u8 D_80392852; -u8 D_80392853; -u8 D_80392854; -u8 D_80392855; -u8 D_80392856; -u8 D_80392857; -u8 D_80392858; -u8 D_80392859; -u8 D_8039285A; -u8 D_8039285B; -u8 D_8039285C; -u8 D_8039285D; -u8 D_8039285E; -u8 D_8039285F; -u8 D_80392860; -u8 D_80392861; -u8 D_80392862; -u8 D_80392863; -u8 fight_D_80392864; -u8 D_80392865; -u8 D_80392866; -u8 D_80392867; -u8 D_80392868; -u8 D_80392869; -u8 D_8039286A; -u8 D_8039286B; -u8 D_8039286C[0x4C]; - -f32 D_803928B8[3]; - void chfinalboss_phase3_update(ActorMarker *marker) { - static f32 D_803917A4[4] = {500.0f, 650.0f, 800.0f, 950.0f}; - static f32 D_803917B4[4] = {3.75f, 3.0f, 2.25f, 1.5f}; - static s32 D_803917C4[3] = {230, 230, 230}; Actor *this; ActorLocal_fight_180 *local; f32 sp3C; @@ -1578,8 +1469,14 @@ void chfinalboss_phase4_setState(Actor *this, s32 arg1) { ActorLocal_fight_180 *local; f32 sp48; f32 sp3C[3]; - s32 i; - static s32 D_803928C4; + // TODO this union is only needed to avoid making D_803928C4 a function static. + // It uses a trick to generate the same codegen as if it were a function static by taking the address to it + // and using that pointer in its place. This avoids needing to deal with bss reordering issues in this file, + // but if bss can be solved without it then this union can be removed and just replaced with `i`. + union { + s32 i; + s32 *D_803928C4_ptr; + } iter; local = (ActorLocal_fight_180 *)&this->local; sp48 = animctrl_getAnimTimer(this->animctrl); @@ -1595,6 +1492,7 @@ void chfinalboss_phase4_setState(Actor *this, s32 arg1) { case 30: if ((local->unk3 == 2) && (local->unkA == 0)) { + iter.D_803928C4_ptr = &D_803928C4; D_803927C8 = 1; func_80311480(randi2(0, 5) + 0x1136, 4, NULL, NULL, NULL, NULL); if ( !fileProgressFlag_get(FILEPROG_D2_HAS_SPAWNED_A_JINJO_STATUE_IN_FINAL_FIGHT) ) { @@ -1617,8 +1515,9 @@ void chfinalboss_phase4_setState(Actor *this, s32 arg1) { func_80324E38(8.8f, 0); break; } - for(D_803928C4 = 1; D_803928C4 < 5; D_803928C4++){ - chfinalboss_spawnStatue(D_803928C4); + + for(*iter.D_803928C4_ptr = 1; *iter.D_803928C4_ptr < 5; (*iter.D_803928C4_ptr)++){ + chfinalboss_spawnStatue(*iter.D_803928C4_ptr); } } break; @@ -1666,17 +1565,16 @@ void chfinalboss_phase4_setState(Actor *this, s32 arg1) { func_8030DD14(this->unk44_31, 2); func_8030DBB4(this->unk44_31, D_803927C0); sfxsource_setSampleRate(this->unk44_31, 26000); - for(i = 0; i < 4; i++){ - if(__chFinalBossJinjoStatueMarker[i] != NULL){ - marker_despawn(__chFinalBossJinjoStatueMarker[i]); - __chFinalBossJinjoStatueMarker[i] = NULL; + for(iter.i = 0; iter.i < 4; iter.i+=1){ + if(__chFinalBossJinjoStatueMarker[iter.i] != NULL){ + marker_despawn(__chFinalBossJinjoStatueMarker[iter.i]); + __chFinalBossJinjoStatueMarker[iter.i] = NULL; } } break; } } -f32 D_803928C8[3]; ActorMarker *chfinalboss_findCollidingJinjo(Actor *this, f32 arg1) { Actor *jinjo; @@ -1768,8 +1666,6 @@ void chfinalboss_phase4_update(ActorMarker *marker) { if (D_803927C4 == 0) { fight_func_80387340(this, 1.0f); if (actor_animationIsAt(this, 0.9999f)) { - static f32 D_803917D0[4] = {2.4f, 2.1f, 1.8f, 1.5f}; - local->unk3++; chfinalboss_phase4_setState(this, 0x1F); this->unk60 = D_803917D0[sp70]; @@ -1976,8 +1872,6 @@ void chfinalboss_phase5_update(ActorMarker *marker) { timed_setStaticCameraToNode(4.4f, sp38 + 3 + __chFinalBossJinjonatorHits); } } else { - static f32 D_803917E0[3] = {0.0f, 186.0f, 0.0f}; - func_802BB3DC(0, 63.0f, 0.9f); chjinjonator_finalAttack(jinjonator_marker); func_8030E6D4(SFX_HEAVY_THUNDERSTORM_01); @@ -2112,10 +2006,8 @@ void chfinalboss_phase5_update(ActorMarker *marker) { if (actor_animationIsAt(this, 0.9f)) { ncStaticCamera_exit(); if (local->mirror_phase5 == 0) { - static f32 D_803917EC[3] = {-827.0f, 793.0f, 1700.0f}; ncStaticCamera_setPositionAndTarget(D_803917EC, this->position); } else { - static f32 D_803917F8[3] = {827.0f, 793.0f, -1700.0f}; ncStaticCamera_setPositionAndTarget(D_803917F8, this->position); } func_8038FC2C(1); @@ -2272,9 +2164,6 @@ void chfinalboss_spawnShadow(ActorMarker *marker) { } void chfinalboss_update(Actor *this){ - static f32 D_80391804[3] = {0.0f, 0.0f, 1350.0f}; - - ActorLocal_fight_180 *local = (ActorLocal_fight_180 *) &this->local; s32 i; s32 tmp_s0; From 87f630370ee4c089ab83ad49b0b5329b2ba0b0c3 Mon Sep 17 00:00:00 2001 From: Mr-Wiseguy Date: Fri, 30 Aug 2024 22:01:08 -0400 Subject: [PATCH 34/38] Import parameters.s from ultralib and cleanup undefined syms, fix accidental change in makefile --- Makefile | 4 ++-- asm/core1/ultra/parameters.s | 17 +++++++++++++++++ asm/ultra/parameters.s | 17 +++++++++++++++++ decompressed.us.v10.yaml | 4 ++-- undefined_syms.libultra.txt => manual_syms.txt | 13 ------------- 5 files changed, 38 insertions(+), 17 deletions(-) create mode 100644 asm/core1/ultra/parameters.s create mode 100644 asm/ultra/parameters.s rename undefined_syms.libultra.txt => manual_syms.txt (80%) diff --git a/Makefile b/Makefile index 6cbd4f32..54d2e824 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ CC := ido/ido5.3_recomp/cc CPP := cpp GCC := $(CROSS)gcc AS := $(CROSS)as -LD := LD_LIBRARY_PATH=../../papermario ../../papermario/mips-linux-gnu-ld.bfd -b elf32-tradbigmips +LD := $(CROSS)ld -b elf32-tradbigmips OBJDUMP := $(CROSS)objdump OBJCOPY := $(CROSS)objcopy PYTHON := python3 @@ -166,7 +166,7 @@ OPT_FLAGS := -O2 MIPSBIT := -mips2 ASFLAGS := -EB -mtune=vr4300 -march=vr4300 -mabi=32 -I include GCC_ASFLAGS := -c -x assembler-with-cpp -mabi=32 -ffreestanding -mtune=vr4300 -march=vr4300 -mfix4300 -G 0 -O -mno-shared -fno-PIC -mno-abicalls -LDFLAGS := -T $(LD_SCRIPT) -Map $(ELF:.elf=.map) --no-check-sections --accept-unknown-input-arch -T undefined_syms.libultra.txt +LDFLAGS := -T $(LD_SCRIPT) -Map $(ELF:.elf=.map) --no-check-sections --accept-unknown-input-arch -T manual_syms.txt BINOFLAGS := -I binary -O elf32-tradbigmips ### Rules ### diff --git a/asm/core1/ultra/parameters.s b/asm/core1/ultra/parameters.s new file mode 100644 index 00000000..450af31b --- /dev/null +++ b/asm/core1/ultra/parameters.s @@ -0,0 +1,17 @@ +#include "PR/R4300.h" +#include "sys/asm.h" +#include "sys/regdef.h" + +.text +ABS(leoBootID, 0x800001a0) +ABS(osTvType, 0x80000300) +ABS(osRomType, 0x80000304) +ABS(osRomBase, 0x80000308) +ABS(osResetType, 0x8000030c) +ABS(osCicId, 0x80000310) +ABS(osVersion, 0x80000314) +ABS(osMemSize, 0x80000318) +ABS(osAppNMIBuffer, 0x8000031c) + +.space 0x60 +/* padded to 0x60 in the object file */ diff --git a/asm/ultra/parameters.s b/asm/ultra/parameters.s new file mode 100644 index 00000000..450af31b --- /dev/null +++ b/asm/ultra/parameters.s @@ -0,0 +1,17 @@ +#include "PR/R4300.h" +#include "sys/asm.h" +#include "sys/regdef.h" + +.text +ABS(leoBootID, 0x800001a0) +ABS(osTvType, 0x80000300) +ABS(osRomType, 0x80000304) +ABS(osRomBase, 0x80000308) +ABS(osResetType, 0x8000030c) +ABS(osCicId, 0x80000310) +ABS(osVersion, 0x80000314) +ABS(osMemSize, 0x80000318) +ABS(osAppNMIBuffer, 0x8000031c) + +.space 0x60 +/* padded to 0x60 in the object file */ diff --git a/decompressed.us.v10.yaml b/decompressed.us.v10.yaml index dadbfb14..f848f3b9 100644 --- a/decompressed.us.v10.yaml +++ b/decompressed.us.v10.yaml @@ -65,7 +65,7 @@ segments: - [0x3870, hasm, maptlbrdb] - [0x38D0, c, done/pirawread] - [0x3930, c, done/ll] - - [0x3BF0, bin, padding3BF0] # Empty space + - [0x3BF0, hasm, ultra/parameters] - [0x3C50, c, done/virtualtophysical] - [0x3CD0, c, done/si] - [0x3D00, c, done/thread] @@ -237,7 +237,7 @@ segments: - [0xF3F820, c, gu/sinf] #DONE - [0xF3F9E0, c, audio/cents2ratio] #DONE - [0xF3FA30, c, audio/heapinit] #DONE - - [0xF3FA70, asm, padding] # 0x60 bytes of zeroes? + - [0xF3FA70, hasm, ultra/parameters] #DONE - [0xF3FAD0, c, os/createmesgqueue] #DONE - [0xF3FB00, c, io/aisetfreq] #DONE - [0xF3FC60, c, audio/sl] #DONE diff --git a/undefined_syms.libultra.txt b/manual_syms.txt similarity index 80% rename from undefined_syms.libultra.txt rename to manual_syms.txt index 05bcae7b..4cc3d756 100644 --- a/undefined_syms.libultra.txt +++ b/manual_syms.txt @@ -1,10 +1,3 @@ -/* Fixed-address libultra symbols */ -osTvType = 0x80000300; -osRomBase = 0x80000308; -osResetType = 0x8000030C; -osCicId = 0x80000310; -osAppNMIBuffer = 0x8000031C; - /* Microcode renames to match ucode.h names */ n_aspMainTextStart = _binary_bin_core1_n_aspMain_text_bin_start; n_aspMainTextEnd = _binary_bin_core1_n_aspMain_text_bin_end; @@ -30,12 +23,6 @@ gOverlayTable = 0x803FFE10; D_803A5D00 = 0x803A5D00; /* framebuffers */ /* Renames for the boot segment */ -boot_osTvType = osTvType; -boot_osRomBase = osRomBase; -boot_osResetType = osResetType; -boot_osCicId = osCicId; -boot_osAppNMIBuffer = osAppNMIBuffer; - boot_D_8002D500 = D_8002D500; boot_core1_VRAM = core1_VRAM; boot_D_803FBE00 = D_803FBE00; From 0185fdefa31798e9d6d101fb563c5c6789d03e4c Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Sat, 31 Aug 2024 00:04:26 -0500 Subject: [PATCH 35/38] Make tool build recipes Phony --- Makefile | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index cc2cf081..d6237905 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ PRINT := printf ASM_PROCESSOR_DIR := tools/asm-processor BK_ROM_COMPRESS := tools/bk_rom_compressor/target/release/bk_rom_compress BK_ROM_DECOMPRESS := tools/bk_rom_compressor/target/release/bk_rom_decompress -BK_ASSET_TOOL := tools/bk_asset_tool/bk_asset_tool +BK_ASSET_TOOL := tools/bk_asset_tool/target/release/bk_asset_tool ASM_PROCESSOR := $(PYTHON) $(ASM_PROCESSOR_DIR)/asm_processor.py SPLAT_INPUTS := $(PYTHON) tools/splat_inputs.py PROGRESS := $(PYTHON) tools/progress.py @@ -341,15 +341,18 @@ $(UNCOMPRESSED_Z64) : $(ELF) $(FINAL_Z64) : $(UNCOMPRESSED_Z64) $(ELF) $(BK_ROM_COMPRESS) @$(BK_ROM_COMPRESS) $(ELF) $(UNCOMPRESSED_Z64) $@ +# TOOLS +# Tool for spliting BK asset sections into and from ROM Bin and transforming certain file types $(BK_ASSET_TOOL): - @$(CD) tools/bk_asset_tool && cargo build --release - @$(CP) tools/bk_asset_tool/target/release/bk_asset_tool $@ + @$(CD) tools/bk_asset_tool && cargo build --release 2> /dev/null +# Tool to compress BK and correct checksums from elf and uncompressed rom $(BK_ROM_COMPRESS): - @$(CD) tools/bk_rom_compressor && cargo build --release --bin bk_rom_compress + @$(CD) tools/bk_rom_compressor && cargo build --release --bin bk_rom_compress 2> /dev/null +# Tool to turn compressed BK into uncompressed ROM $(BK_ROM_DECOMPRESS): - @$(CD) tools/bk_rom_compressor && cargo build --release --bin bk_rom_decompress + @$(CD) tools/bk_rom_compressor && cargo build --release --bin bk_rom_decompress 2> /dev/null clean: $(call print0,Cleaning build artifacts) @@ -415,7 +418,9 @@ MAKEFLAGS += -r .SUFFIXES: # Phony targets -.PHONY: all clean verify $(OVERLAYS) progress $(addprefix progress-,$(OVERLAYS)) +.PHONY: all clean verify $(OVERLAYS) progress $(addprefix progress-,$(OVERLAYS)) \ + $(BK_ASSET_TOOL) $(BK_ROM_COMPRESS) $(BK_ROM_DECOMPRESS) + # Set up pipefail SHELL = /bin/bash -e -o pipefail From 33745d334b562e9f67676e4d973a6e98e46515f7 Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Sat, 31 Aug 2024 01:54:14 -0500 Subject: [PATCH 36/38] update bk_rom_compressor --- tools/bk_rom_compressor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/bk_rom_compressor b/tools/bk_rom_compressor index 934ff321..48ac16ba 160000 --- a/tools/bk_rom_compressor +++ b/tools/bk_rom_compressor @@ -1 +1 @@ -Subproject commit 934ff321b4d284db197dd5c5b8b446a8e3233520 +Subproject commit 48ac16ba5bb0f3e926a7634c4837bf87a58cbbb5 From 131e422275c210923c16f7d52f422fedbad50afd Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Sat, 31 Aug 2024 17:48:41 -0500 Subject: [PATCH 37/38] ccw/ch/vacationtexttrigger, ccw/ch/grublinhood documentation update --- decompressed.us.v10.yaml | 10 +++--- include/enums.h | 7 +++- include/math.h | 6 ++++ remaining | 2 -- src/CCW/{code_8050.c => ch/grublinhood.c} | 33 +++++++++-------- src/CCW/ch/vacationtexttrigger.c | 43 +++++++++++++++++++++++ src/CCW/code_76C0.c | 8 ++--- src/CCW/code_8670.c | 31 ---------------- src/core2/animctrl.c | 2 -- src/core2/code_1550.c | 8 +++++ 10 files changed, 88 insertions(+), 62 deletions(-) create mode 100644 include/math.h delete mode 100644 remaining rename src/CCW/{code_8050.c => ch/grublinhood.c} (86%) create mode 100644 src/CCW/ch/vacationtexttrigger.c delete mode 100644 src/CCW/code_8670.c diff --git a/decompressed.us.v10.yaml b/decompressed.us.v10.yaml index f848f3b9..b522c36e 100644 --- a/decompressed.us.v10.yaml +++ b/decompressed.us.v10.yaml @@ -2307,8 +2307,8 @@ segments: - [0x10BA9E0, c, code_76C0] #DONE - [0x10BAEE0, c, code_7BC0] #DONE - [0x10BAF10, c, code_7BF0] #DONE - - [0x10BB370, c, code_8050] #DONE - - [0x10BB990, c, code_8670] #DONE + - [0x10BB370, c, ch/grublinhood] #DONE + - [0x10BB990, c, ch/vacationtexttrigger] #DONE - [0x10BBA80, .data, code_0] - [0x10BBAD0, .data, code_160] - [0x10BBB00, .data, code_950] @@ -2335,8 +2335,8 @@ segments: - [0x10BC650, .data, code_76C0] - [0x10BC7E0, .data, code_7BC0] - [0x10BC820, .data, code_7BF0] - - [0x10BC860, .data, code_8050] - - [0x10BC930, .data, code_8670] + - [0x10BC860, .data, ch/grublinhood] + - [0x10BC930, .data, ch/vacationtexttrigger] - [0x10BC960, .rodata, code_160] - [0x10BC980, .rodata, code_950] - [0x10BC9E0, .rodata, code_1B20] @@ -2355,7 +2355,7 @@ segments: - [0x10BCC20, .rodata, code_6AC0] - [0x10BCC40, .rodata, code_76C0] - [0x10BCC50, .rodata, code_7BF0] - - [0x10BCC60, .rodata, code_8050] + - [0x10BCC60, .rodata, ch/grublinhood] - [0x10BCD00, .bss, bss_pad] - [0x10BCD00, .bss, code_3310] - name: emptyLvl diff --git a/include/enums.h b/include/enums.h index 18be86e6..3ec51450 100644 --- a/include/enums.h +++ b/include/enums.h @@ -235,6 +235,8 @@ enum unkflags_1{ UNKFLAGS1_A_HAS_SEEN_TIPTUP_FF_MINIGAME, UNKFLAGS1_B_HAS_SEEN_SANDCASTLE_FF_MINIGAME, + UNKFLAGS1_13_HAS_TRIGGERED_MUMBO_VACATION_TEXT = 0x13, + UNKFLAGS1_1F_IN_CHARACTER_PARADE = 0x1F, UNKFLAGS1_20_BEGIN_CHARACTER_PARADE, @@ -1847,7 +1849,8 @@ enum actor_e ACTOR_TOPPER_B = 0x36F, ACTOR_370_GOLD_FEATHER = 0x370, - ACTOR_375_GRUBLIN_HOOD = 0x375, + ACTOR_374_VACATION_TEXT_TRIGGER = 0x374, + ACTOR_375_GRUBLIN_HOOD, ACTOR_376_FF_MINIGAME, ACTOR_379_UNKNOWN = 0x379, @@ -4301,6 +4304,8 @@ enum marker_e{ MARKER_1E1_FF_MINIGAME = 0x1E1, MARKER_1E2_GRUBLIN_HOOD, + MARKER_1E3_VACATION_TEXT_TRIGGER, + MARKER_1E5_GOLD_FEATHER_COLLECTIBLE = 0x1E5, MARKER_1E6_TOPPER_B, diff --git a/include/math.h b/include/math.h new file mode 100644 index 00000000..ee66ae46 --- /dev/null +++ b/include/math.h @@ -0,0 +1,6 @@ +#ifndef __BANJO_KAZOOIE_MATH_H__ +#define __BANJO_KAZOOIE_MATH_H__ + +#define SQ(x) ((x)*(x)) + +#endif // __BANJO_KAZOOIE_MATH_H__ \ No newline at end of file diff --git a/remaining b/remaining deleted file mode 100644 index f4298921..00000000 --- a/remaining +++ /dev/null @@ -1,2 +0,0 @@ - -./src/FP/code_5CC0.c:#pragma GLOBAL_ASM("asm/nonmatchings/FP/code_5CC0/func_8038C428.s") diff --git a/src/CCW/code_8050.c b/src/CCW/ch/grublinhood.c similarity index 86% rename from src/CCW/code_8050.c rename to src/CCW/ch/grublinhood.c index fca59e6a..be909653 100644 --- a/src/CCW/code_8050.c +++ b/src/CCW/ch/grublinhood.c @@ -36,11 +36,11 @@ typedef struct { f32 unk3C; } ActorLocal_CCW_8050; -void func_8038E964(Actor *this); -Actor *func_8038E56C(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); +void chgrublinhood_update(Actor *this); +Actor *chgrublinhood_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); /* .data */ -ActorAnimationInfo D_8038F930[] = { +ActorAnimationInfo chGrublinHood_animations[] = { {0x000, 0.0f}, {0x243, 4.0f}, {0x243, 0.7f}, @@ -54,15 +54,15 @@ ActorAnimationInfo D_8038F930[] = { {0x243, 1e+06f} }; -ActorInfo D_8038F988 = { +ActorInfo chGrublinHood = { MARKER_1E2_GRUBLIN_HOOD, ACTOR_375_GRUBLIN_HOOD, ASSET_52C_MODEL_GRUBLIN_HOOD, - 0x1, D_8038F930, - func_8038E964, func_80326224, func_8038E56C, + 0x1, chGrublinHood_animations, + chgrublinhood_update, func_80326224, chgrublinhood_draw, 2500, 0, 1.0f, 0 }; /* .code */ -void func_8038E440(ParticleEmitter *pCtrl, Actor *actor, enum asset_e model_id){ +void __chgrublinhood_emitHat(ParticleEmitter *pCtrl, Actor *actor, enum asset_e model_id){ static struct43s D_8038F9AC = { {{-200.0f, 200.0f, -200.0f}, {200.0f, 400.0f, 200.0f}}, {{ 0.0f, -1800.0f, 0.0f}, { 0.0f, -1800.0f, 0.0f}}, @@ -78,7 +78,7 @@ void func_8038E440(ParticleEmitter *pCtrl, Actor *actor, enum asset_e model_id){ particleEmitter_emitN(pCtrl, 1); } -void func_8038E4C0(ActorMarker* marker, s32 arg1) { +void __chgrublinhood_die(ActorMarker* marker, s32 arg1) { Actor* actor = marker_getActor(marker); ParticleEmitter *pCtrl; @@ -86,13 +86,13 @@ void func_8038E4C0(ActorMarker* marker, s32 arg1) { actor_playAnimationOnce(actor); FUNC_8030E8B4(SFX_C2_GRUBLIN_EGH, 1.0f, 32000, actor->position, 1250, 2500); pCtrl = partEmitMgr_newEmitter(1); - func_8038E440(pCtrl, actor, ASSET_52D_MODEL_GRUBLIN_HOOD_HAT); + __chgrublinhood_emitHat(pCtrl, actor, ASSET_52D_MODEL_GRUBLIN_HOOD_HAT); __spawnQueue_add_4((GenFunction_4)func_802C4140, ACTOR_4C_STEAM, reinterpret_cast(s32,actor->position_x), reinterpret_cast(s32,actor->position_y), reinterpret_cast(s32,actor->position_z)); actor_collisionOff(actor); actor->unk138_24 = 1; } -Actor *func_8038E56C(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ +Actor *chgrublinhood_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ Actor *this; ActorLocal_CCW_8050 *local; @@ -113,10 +113,9 @@ Actor *func_8038E56C(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ return actor_draw(marker, gfx, mtx, vtx); } -void func_8038E868(Actor *this){ +void __chgrublinhood_initialize(Actor *this){ ActorLocal_CCW_8050 *local = (ActorLocal_CCW_8050 *)&this->local; - local->unk8 = 6; local->unk9 = 0xC; local->unkA = 0x10; @@ -126,14 +125,14 @@ void func_8038E868(Actor *this){ local->unk12 = 25000; local->unkC_28 = 1; local->unk30 = func_802DB548; - local->unk34 = func_8038E4C0; + local->unk34 = __chgrublinhood_die; local->unk0 = 5.0f; local->unk4 = 8.0f; local->unk14 = 1.0f; local->unk3C = 1.5f; } -enum ccw_season_e func_8038E8FC(Actor *this){ +enum ccw_season_e __get_current_season(Actor *this){ switch(map_get()){ case MAP_43_CCW_SPRING: //// 8038E930 case MAP_4A_CCW_SPRING_MUMBOS_SKULL:// 8038E930 @@ -171,15 +170,15 @@ enum ccw_season_e func_8038E8FC(Actor *this){ } } -void func_8038E964(Actor *this) { +void chgrublinhood_update(Actor *this) { ActorLocal_CCW_8050 *local; f32 temp_a0; local = (ActorLocal_CCW_8050 *)&this->local; if (!this->unk16C_4) { - func_8038E868(this); - local->season = func_8038E8FC(this); + __chgrublinhood_initialize(this); + local->season = __get_current_season(this); } if(local->season < 4){ diff --git a/src/CCW/ch/vacationtexttrigger.c b/src/CCW/ch/vacationtexttrigger.c new file mode 100644 index 00000000..bc4722e8 --- /dev/null +++ b/src/CCW/ch/vacationtexttrigger.c @@ -0,0 +1,43 @@ +#include +#include "functions.h" +#include "variables.h" + +#include "math.h" // for SQ() + +void chVacationTextTrigger_update(Actor* this); + +/* .data */ + +ActorInfo gChVacationTextTrigger = { + MARKER_1E3_VACATION_TEXT_TRIGGER, ACTOR_374_VACATION_TEXT_TRIGGER, 0x0, + 0x0, NULL, + chVacationTextTrigger_update, func_80326224, func_80325340, + 0, 0, 0.0f, 0 +}; + +/* .code */ + +/** + * @brief Returns if player is within a specified horizontal radius of the + * supplied x,z positions. + */ +static bool __playerIsWithinTrigger(s32 x, s32 z, s32 distance) { + s32 player_position[3]; + + player_getPosition_s32(player_position); + return (SQ(x - player_position[0]) + SQ(z - player_position[2])) < SQ(distance); +} + +void chVacationTextTrigger_update(Actor* this) { + // Despawn if already triggered + if (func_803203FC(UNKFLAGS1_13_HAS_TRIGGERED_MUMBO_VACATION_TEXT)) { + marker_despawn(this->marker); + return; + } + + // Start dialog if player is within trigger + if (__playerIsWithinTrigger(0, -107, 188) != 0) { + func_80311480(0xDA9, 4, NULL, NULL, NULL, NULL); + func_803204E4(UNKFLAGS1_13_HAS_TRIGGERED_MUMBO_VACATION_TEXT, 1); + } +} diff --git a/src/CCW/code_76C0.c b/src/CCW/code_76C0.c index 27367574..729340de 100644 --- a/src/CCW/code_76C0.c +++ b/src/CCW/code_76C0.c @@ -51,8 +51,8 @@ extern ActorInfo D_8038F720; extern ActorInfo D_8038F744; extern ActorInfo D_8038F768; extern ActorInfo D_8038F78C; -extern ActorInfo D_8038F988; -extern ActorInfo D_8038FA00; +extern ActorInfo chGrublinHood; +extern ActorInfo gChVacationTextTrigger; extern ActorInfo D_8038F7D4; extern ActorInfo D_8038F7B0; extern ActorInfo D_8038F888; @@ -143,8 +143,8 @@ void CCW_func_8038DB6C(void) spawnableActorList_add(&D_8038F744, actor_new, 0); spawnableActorList_add(&D_8038F768, actor_new, 0); spawnableActorList_add(&D_8038F78C, actor_new, 0); - spawnableActorList_add(&D_8038F988, actor_new, 0X2010121); - spawnableActorList_add(&D_8038FA00, actor_new, 0); + spawnableActorList_add(&chGrublinHood, actor_new, 0X2010121); + spawnableActorList_add(&gChVacationTextTrigger, actor_new, 0); spawnableActorList_add(&D_8038F7D4, actor_new, 0X400); spawnableActorList_add(&D_8038F7B0, actor_new, 0X400); spawnableActorList_add(&D_8038F888, actor_new, 0X80); diff --git a/src/CCW/code_8670.c b/src/CCW/code_8670.c deleted file mode 100644 index 87aefc3b..00000000 --- a/src/CCW/code_8670.c +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -void func_8038EAD4(Actor *this); - -/* .data */ -ActorInfo D_8038FA00 = { 0x1E3, 0x374, 0x0, 0x0, NULL, func_8038EAD4, func_80326224, func_80325340, 0, 0, 0.0f, 0}; - -/* .code */ -bool func_8038EA60(s32 arg0, s32 arg1, s32 arg2) { - s32 sp24; - s32 temp_a0; - s32 sp1C; - s32 temp_v1; - - player_getPosition_s32(&sp1C); - temp_v1 = arg1 - sp24; - temp_a0 = arg0 - sp1C; - return ((temp_v1 * temp_v1) + (temp_a0 * temp_a0)) < (arg2 * arg2); -} -void func_8038EAD4(Actor* this) { - if (func_803203FC(0x13)) { - marker_despawn(this->marker); - return; - } - if (func_8038EA60(0, -0x6B, 0xBC) != 0) { - func_80311480(0xDA9, 4, NULL, NULL, NULL, NULL); - func_803204E4(0x13, 1); - } -} diff --git a/src/core2/animctrl.c b/src/core2/animctrl.c index a18da493..17c2f7d9 100644 --- a/src/core2/animctrl.c +++ b/src/core2/animctrl.c @@ -5,8 +5,6 @@ #include "core2/animctrl.h" #include "animation.h" -extern u32 D_A0000238; - /* .code */ void animctrl_80286F90(AnimCtrl *this){ Animation *anim; diff --git a/src/core2/code_1550.c b/src/core2/code_1550.c index 18274cc2..42694c68 100644 --- a/src/core2/code_1550.c +++ b/src/core2/code_1550.c @@ -1,3 +1,11 @@ +/** + * @file anim/commoncache.c + * @brief This file controls a cache of common animations consisting of + * player move animations. This main difference between this cache and + * the normal anim/cache.c is that these assets default to persist even + * after they become stall, and are cleaned up much later in memory + * defragmentation. + */ #include #include "functions.h" #include "variables.h" From 9cb645df24e9943133e1d055d56cc47421301d1d Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Sun, 1 Sep 2024 15:12:21 -0500 Subject: [PATCH 38/38] chsnacker documentation snackerctl documentation gczoombox partial documentation several warning resolutions --- asm/core1/code_1E820.s | 57 +++++ decompressed.us.v10.yaml | 24 +-- include/enums.h | 21 +- include/file_and_line.h | 2 +- include/gc/gc.h | 1 - include/gc/gczoombox.h | 212 ------------------- include/math.h | 2 +- src/core1/code_18350.c | 2 - src/core1/code_3A70.c | 2 +- src/core1/code_660.c | 1 + src/core2/ch/gameSelect.c | 21 +- src/core2/ch/gravestone.c | 2 +- src/core2/{code_59D40.c => ch/snacker.c} | 255 ++++++++++++----------- src/core2/ch/snacker.h | 12 ++ src/core2/code_47BD0.c | 27 +-- src/core2/code_7060.c | 4 +- src/core2/code_91E10.c | 103 ++++----- src/core2/code_9E370.c | 4 +- src/core2/code_C9E70.c | 6 +- {include => src}/core2/code_C9E70.h | 4 +- src/core2/code_E910.c | 6 +- src/core2/{code_87E30.c => gc/dialog.c} | 23 +- src/core2/gc/parade.c | 8 +- src/core2/gc/pauseMenu.c | 42 ++-- src/core2/gc/zoombox.c | 202 +++++++++--------- src/core2/gc/zoombox.h | 252 ++++++++++++++++++++++ src/core2/{code_3480.c => snackerctl.c} | 71 +++---- src/core2/snackerctl.h | 14 ++ src/core2/spawnqueue.c | 8 +- src/lair/code_5ED0.c | 60 +++--- symbol_addrs.us.v10.txt | 68 ------ 31 files changed, 783 insertions(+), 733 deletions(-) create mode 100644 asm/core1/code_1E820.s delete mode 100644 include/gc/gczoombox.h rename src/core2/{code_59D40.c => ch/snacker.c} (51%) create mode 100644 src/core2/ch/snacker.h rename {include => src}/core2/code_C9E70.h (96%) rename src/core2/{code_87E30.c => gc/dialog.c} (97%) create mode 100644 src/core2/gc/zoombox.h rename src/core2/{code_3480.c => snackerctl.c} (60%) create mode 100644 src/core2/snackerctl.h diff --git a/asm/core1/code_1E820.s b/asm/core1/code_1E820.s new file mode 100644 index 00000000..0b10453e --- /dev/null +++ b/asm/core1/code_1E820.s @@ -0,0 +1,57 @@ +.include "macro.inc" + +/* assembler directives */ +.set noat /* allow manual use of $at */ +.set noreorder /* don't insert nops after branches */ +.set gp=64 /* allow use of 64-bit general purpose registers */ + +.section .text, "ax" + +glabel func_8025C240 +/* F37A70 8025C240 3C048027 */ lui $a0, %hi(D_80276E70) +/* F37A74 8025C244 DC846E70 */ ld $a0, %lo(D_80276E70)($a0) +/* F37A78 8025C248 3C018027 */ lui $at, %hi(D_80276E70) +/* F37A7C 8025C24C 000437FC */ dsll32 $a2, $a0, 31 +/* F37A80 8025C250 00042FF8 */ dsll $a1, $a0, 31 +/* F37A84 8025C254 000637FA */ dsrl $a2, $a2, 31 +/* F37A88 8025C258 0005283E */ dsrl32 $a1, $a1, 0 +/* F37A8C 8025C25C 0004233C */ dsll32 $a0, $a0, 12 +/* F37A90 8025C260 00C53025 */ or $a2, $a2, $a1 +/* F37A94 8025C264 0004203E */ dsrl32 $a0, $a0, 0 +/* F37A98 8025C268 00C43026 */ xor $a2, $a2, $a0 +/* F37A9C 8025C26C 0006253A */ dsrl $a0, $a2, 20 +/* F37AA0 8025C270 30840FFF */ andi $a0, $a0, 0xFFF +/* F37AA4 8025C274 00862026 */ xor $a0, $a0, $a2 +/* F37AA8 8025C278 0004103C */ dsll32 $v0, $a0, 0 +/* F37AAC 8025C27C FC246E70 */ sd $a0, %lo(D_80276E70)($at) +/* F37AB0 8025C280 03E00008 */ jr $ra +/* F37AB4 8025C284 0002103F */ dsra32 $v0, $v0, 0 +endlabel func_8025C240 + +glabel func_8025C288 +/* F37AB8 8025C288 64840001 */ daddiu $a0, $a0, 0x1 +/* F37ABC 8025C28C 3C018027 */ lui $at, %hi(D_80276E70) +/* F37AC0 8025C290 FC246E70 */ sd $a0, %lo(D_80276E70)($at) +/* F37AC4 8025C294 03E00008 */ jr $ra +/* F37AC8 8025C298 24040000 */ addiu $a0, $zero, 0x0 +endlabel func_8025C288 + +glabel func_8025C29C +/* F37ACC 8025C29C DC870000 */ ld $a3, 0x0($a0) +/* F37AD0 8025C2A0 000737FC */ dsll32 $a2, $a3, 31 +/* F37AD4 8025C2A4 00072FF8 */ dsll $a1, $a3, 31 +/* F37AD8 8025C2A8 000637FA */ dsrl $a2, $a2, 31 +/* F37ADC 8025C2AC 0005283E */ dsrl32 $a1, $a1, 0 +/* F37AE0 8025C2B0 00073B3C */ dsll32 $a3, $a3, 12 +/* F37AE4 8025C2B4 00C53025 */ or $a2, $a2, $a1 +/* F37AE8 8025C2B8 0007383E */ dsrl32 $a3, $a3, 0 +/* F37AEC 8025C2BC 00C73026 */ xor $a2, $a2, $a3 +/* F37AF0 8025C2C0 00063D3A */ dsrl $a3, $a2, 20 +/* F37AF4 8025C2C4 30E70FFF */ andi $a3, $a3, 0xFFF +/* F37AF8 8025C2C8 00E63826 */ xor $a3, $a3, $a2 +/* F37AFC 8025C2CC 0007103C */ dsll32 $v0, $a3, 0 +/* F37B00 8025C2D0 FC870000 */ sd $a3, 0x0($a0) +/* F37B04 8025C2D4 03E00008 */ jr $ra +/* F37B08 8025C2D8 0002103F */ dsra32 $v0, $v0, 0 +/* F37B0C 8025C2DC 00000000 */ nop +endlabel func_8025C29C diff --git a/decompressed.us.v10.yaml b/decompressed.us.v10.yaml index b522c36e..72dc9024 100644 --- a/decompressed.us.v10.yaml +++ b/decompressed.us.v10.yaml @@ -511,7 +511,7 @@ segments: - [0xF57290, c, code_1930] #DONE - [0xF57BA0, c, code_2240] #DONE - [0xF581F0, c, ba/anim] #DONE - - [0xF58DE0, c, code_3480] #DONE + - [0xF58DE0, c, snackerctl] #DONE - [0xF59330, c, code_39D0] #DONE - [0xF5A120, c, ba/marker] #DONE - [0xF5C490, c, code_6B30] #DONE @@ -706,7 +706,7 @@ segments: - [0xFAF0E0, c, code_59780] #DONE - [0xFAF340, c, code_599E0] #DONE - [0xFAF3E0, c, code_59A80] #DONE - - [0xFAF6A0, c, code_59D40] #DONE + - [0xFAF6A0, c, ch/snacker] #DONE - [0xFB0490, c, ch/snowman] #DONE - [0xFB1000, c, ch/snowball] #DONE - [0xFB16F0, c, ch/snowmanhat] #DONE @@ -775,7 +775,7 @@ segments: - [0xFDAB30, c, code_851D0] #DONE - [0xFDB110, c, code_857B0] #DONE - [0xFDB160, c, code_85800] #DONE - - [0xFDD790, c, code_87E30] + - [0xFDD790, c, gc/dialog] - [0xFE0110, c, gc/pauseMenu] #DONE - [0xFE3580, c, code_8DC20] #DONE - [0xFE3BD0, c, gc/zoombox] #DONE @@ -901,7 +901,7 @@ segments: - [0x1031F60, bin, data_DC600] #unreferenced - [0x1031F90, .data, code_1550] - [0x1031FB0, .data, ba/anim] - - [0x1031FE0, .data, code_3480] + - [0x1031FE0, .data, snackerctl] - [0x1032000, .data, ba/marker] - [0x1032060, .data, code_7060] - [0x10320A0, .data, code_90E0] @@ -1003,7 +1003,7 @@ segments: - [0x1036D80, .data, ch/bottlesbonuscursor] - [0x1036E10, .data, code_59780] - [0x1036F70, .data, code_59A80] - - [0x1036FA0, .data, code_59D40] + - [0x1036FA0, .data, ch/snacker] - [0x1037020, .data, ch/snowman] - [0x10370E0, .data, ch/snowball] - [0x1037190, .data, ch/snowmanhat] @@ -1048,7 +1048,7 @@ segments: - [0x103A710, .data, gc/sky] - [0x103AB20, .data, gc/transition] - [0x103AE20, .data, code_851D0] - - [0x103AEA0, .data, code_87E30] + - [0x103AEA0, .data, gc/dialog] - [0x103AEB0, .data, gc/pauseMenu] - [0x103B000, .data, code_8DC20] - [0x103B090, .data, gc/zoombox] @@ -1123,7 +1123,7 @@ segments: - [0x10427F0, .rodata, anim/sprite] - [0x1042800, .rodata, code_1930] - [0x1042880, .rodata, ba/anim] - - [0x1042890, .rodata, code_3480] + - [0x1042890, .rodata, snackerctl] - [0x10428A0, .rodata, code_39D0] - [0x1042940, .rodata, ba/marker] - [0x1042D70, .rodata, code_6B30] @@ -1259,7 +1259,7 @@ segments: - [0x10459A0, .rodata, ch/bottlesbonuscursor] - [0x1045A00, .rodata, code_599E0] - [0x1045A10, .rodata, code_59A80] - - [0x1045A20, .rodata, code_59D40] + - [0x1045A20, .rodata, ch/snacker] - [0x1045A70, .rodata, ch/snowman] - [0x1045AA0, .rodata, ch/snowball] - [0x1045AD0, .rodata, code_5C240] @@ -1295,7 +1295,7 @@ segments: - [0x1046E10, .rodata, gc/sky] - [0x1046E20, .rodata, gc/transition] - [0x1046E80, .rodata, code_85800] - - [0x1046EA0, .rodata, code_87E30] + - [0x1046EA0, .rodata, gc/dialog] - [0x1046F10, .rodata, gc/pauseMenu] - [0x1047250, .rodata, gc/zoombox] - [0x1047320, .rodata, code_91E10] @@ -1375,7 +1375,7 @@ segments: - [0x1048560, .bss, code_1550] - [0x1048560, .bss, code_1930] - [0x1048560, .bss, ba/anim] - - [0x1048560, .bss, code_3480] + - [0x1048560, .bss, snackerctl] - [0x1048560, .bss, code_39D0] - [0x1048560, .bss, ba/marker] - [0x1048560, .bss, code_6B30] @@ -1516,7 +1516,7 @@ segments: - [0x1048560, .bss, code_581D0] - [0x1048560, .bss, ch/bottlesbonuscursor] - [0x1048560, .bss, code_59A80] - - [0x1048560, .bss, code_59D40] + - [0x1048560, .bss, ch/snacker] - [0x1048560, .bss, ch/snowball] - [0x1048560, .bss, code_5BEB0] - [0x1048560, .bss, code_5C240] @@ -1564,7 +1564,7 @@ segments: - [0x1048560, .bss, code_851D0] - [0x1048560, .bss, code_857B0] - [0x1048560, .bss, code_85800] - - [0x1048560, .bss, code_87E30] + - [0x1048560, .bss, gc/dialog] - [0x1048560, .bss, gc/pauseMenu] - [0x1048560, .bss, code_8DC20] - [0x1048560, .bss, gc/zoombox] diff --git a/include/enums.h b/include/enums.h index 3ec51450..b6e0fbf4 100644 --- a/include/enums.h +++ b/include/enums.h @@ -1537,8 +1537,8 @@ enum actor_e ACTOR_65_WADING_BOOTS = 0x65, ACTOR_67_SNIPPET = 0x67, - - ACTOR_69_CLAM = 0x69, + ACTOR_68_SNACKER, + ACTOR_69_CLAM, ACTOR_6D_GV_BANJO_DOOR = 0x6D, @@ -2262,7 +2262,7 @@ enum asset_e /* [0x74, 0x75] empty */ ASSET_76_ANIM_JIGSAWDANCE_HOLD = 0x76, ASSET_77_ANIM_BSTIMEOUT, - //ASSET_78 // snacker_swimming + ASSET_78_ANIM_SNACKER_SWIMMING, //ASSET_79 // Mumbo Concert Playing Instrument //ASSET_7A // Banjo Concert Angry //ASSET_7B // Banjo Concert Play @@ -2440,8 +2440,8 @@ enum asset_e ASSET_14A_ANIM_BSREST_LISTEN, ASSET_153_ANIM_BURIED_TREASURE_APPEAR = 0x153, - - ASSET_155_ANIM_CRAB_FLIP_UPRIGHT = 0x155, + ASSET_154_ANIM_SNACKER_EATING, + ASSET_155_ANIM_CRAB_FLIP_UPRIGHT, ASSET_156_ANIM_MUTANT_CRAB_WALK, ASSET_157_ANIM_MUTANT_CRAB_FLIP_UPSIDEDOWN, ASSET_158_ANIM_MUTANT_CRAB_UPSIDEDOWN, @@ -2544,7 +2544,10 @@ enum asset_e ASSET_256_ANIM_TERMITE_OW, ASSET_25B_ANIM_ACORN_IDLE = 0x25B, - + + ASSET_273_ANIM_SNACKER_HURT = 0x273, + ASSET_274_ANIM_SNACKER_DIE, + ASSET_281_ANIM_WISHYWASHY_DOOOH = 0x281, ASSET_282_ANIM_BSJIG_NOTEDOOR, @@ -2778,7 +2781,7 @@ enum asset_e ASSET_3AD_FIRE_SPARKLE = 0x3AD, ASSET_3AE_MODEL_GRAVE_FLOWER_POT, // 3af (Green Plank?) - // 3b0 Snacker + ASSET_3B0_SNACKER = 0x3B0, // 3b1 Concert Mumbo // 3b2 (Two Poles?) // 3b3 Mumbo's Hut @@ -4081,8 +4084,8 @@ enum marker_e{ MARKER_11_WADING_BOOTS = 0x11, MARKER_13_SNIPPET = 0x13, - - MARKER_15_CLAM = 0x15, + MARKER_14_SNACKER, + MARKER_15_CLAM, MARKER_28_CLANKER_SAWBLADE = 0x28, diff --git a/include/file_and_line.h b/include/file_and_line.h index a67656c6..06231717 100644 --- a/include/file_and_line.h +++ b/include/file_and_line.h @@ -15,7 +15,7 @@ extern void func_8033F000(const char *, const char *, int); #else #define FILE(file_name) "file_name" #endif - #define matching_assert(EX, F, L) assert(EX) + #ifdef __ANSI_CPP__ #define matching_assert(EX, F, L) ((EX)?((void)0):func_8033F000( # EX , # F, L)) #else diff --git a/include/gc/gc.h b/include/gc/gc.h index 9a4b3879..4ea14c0e 100644 --- a/include/gc/gc.h +++ b/include/gc/gc.h @@ -3,6 +3,5 @@ #include "gc/gcbound.h" #include "gc/gctransition.h" -#include "gc/gczoombox.h" #endif diff --git a/include/gc/gczoombox.h b/include/gc/gczoombox.h deleted file mode 100644 index f8dd39ce..00000000 --- a/include/gc/gczoombox.h +++ /dev/null @@ -1,212 +0,0 @@ -#ifndef GCZOOMBOX_H -#define GCZOOMBOX_H - -#include - -#include "structs.h" - -enum talk_pic_e { - TALK_PIC_0_GRUNTILDA_1, - TALK_PIC_1_VILE_1, - TALK_PIC_2_VILE_2, - TALK_PIC_3_VILE_3, - TALK_PIC_4_BANJO_1, - TALK_PIC_5_GRUNTILDA_2, - TALK_PIC_6_JIGGY_1, - TALK_PIC_7_TOOTY_1, - TALK_PIC_8_MUSIC_NOTE_1, - TALK_PIC_9_JIGGY_2, - TALK_PIC_A_EXTRA_HEALTH_MAX, - TALK_PIC_B_CLOCK, - TALK_PIC_C_BANJO_2, - TALK_PIC_D_KAZOOIE_1, - TALK_PIC_E_KAZOOIE_2, - TALK_PIC_F_BOTTLES, - TALK_PIC_10_MUMBO_1, - TALK_PIC_11_CHIMPY, - TALK_PIC_12_CONGA, - TALK_PIC_13_BLUBBER, - TALK_PIC_14_NIPPER, - TALK_PIC_15_CLANKER, - TALK_PIC_16_SNIPPET, - TALK_PIC_17_VILE_4, - TALK_PIC_18_TIPTUP, - TALK_PIC_19_TANKTUP, - TALK_PIC_1A_FLIBBIT, - TALK_PIC_1B_TRUNKER, - TALK_PIC_1C_RUBEE, - TALK_PIC_1D_GOBI, - TALK_PIC_1E_GRABBA, - TALK_PIC_1F_TEEHEE, - TALK_PIC_20_JINJO_YELLOW, - TALK_PIC_21_JINJO_GREEN, - TALK_PIC_22_JINJO_BLUE, - TALK_PIC_23_JINJO_PINK, - TALK_PIC_24_JINJO_ORANGE, - TALK_PIC_25_MUSIC_NOTE_2, - TALK_PIC_26_MUMBO_TOKEN, - TALK_PIC_27_BLUE_EGG, - TALK_PIC_28_RED_FEATHER, - TALK_PIC_29_GOLD_FEATHER, - TALK_PIC_2A_ORANGE, - TALK_PIC_2B_GOLD_BULLION, - TALK_PIC_2C_HONEYCOMB, - TALK_PIC_2D_EXTRA_HEALTH_MAX, - TALK_PIC_2E_EXTRA_LIFE, - TALK_PIC_2F_JIGGY_3, - TALK_PIC_30_EXTRA_HONEYCOMB, - TALK_PIC_31_CATERPILLAR, - TALK_PIC_32_WADING_BOOTS, - TALK_PIC_33_PIRANHA, - TALK_PIC_34_TERMITE, - TALK_PIC_35_JUJU, - TALK_PIC_36_YUMYUM, - TALK_PIC_37_LITTLE_LOCKUP, - TALK_PIC_38_LEAKY, - TALK_PIC_39_GLOOP, - TALK_PIC_3A_TIPTUP_CHOIR_MEMBER, - TALK_PIC_3B_SNACKER, - TALK_PIC_3C_ANCIENT_ONE, - TALK_PIC_3D_SAND_EEL, - TALK_PIC_3E_SNORKEL, - TALK_PIC_3F_JINXY, - TALK_PIC_40_CROCTUS, - TALK_PIC_41_GRUNTILDA_3, - TALK_PIC_42_TOOTY_2, - TALK_PIC_43_BOGGY, - TALK_PIC_44_WOZZA, - TALK_PIC_45_MOTZHAND, - TALK_PIC_46_TUMBLAR, - TALK_PIC_47_MUMMUM, - TALK_PIC_48_XMAS_GIFT_BLUE, - TALK_PIC_49_WORM, - TALK_PIC_4A_FREEZING_WATER, - TALK_PIC_4B_TWINKLY, - TALK_PIC_4C_TWINKLY_CHOMPER, - TALK_PIC_4D_GNAWTY, - TALK_PIC_4E_BOSS_BOOM_BOX, - TALK_PIC_4F_ZUBBA, - TALK_PIC_50_NABNUT, - TALK_PIC_51_POLAR_BEAR_CUBS, - TALK_PIC_52_YOUNG_EEYRIE_1, - TALK_PIC_53_YOUNG_EEYRIE_2, - TALK_PIC_54_YOUNG_EEYRIE_3, - TALK_PIC_55_ADULT_EEYRIE, - TALK_PIC_56_WARP_CAULDRON, - TALK_PIC_57_BRENTILDA, - TALK_PIC_58_TOOTY_3, - TALK_PIC_59_BLACK_SNIPPET, - TALK_PIC_5A_LOGGO, - TALK_PIC_5B_CHEATO, - TALK_PIC_5C_XMAS_GIFT_GREEN, - TALK_PIC_5D_KLUNGO, - TALK_PIC_5E_SEXY_GRUNTY, - TALK_PIC_5F_TOOTY_4, - TALK_PIC_60_BANJO_3, - TALK_PIC_61_KAZOOIE_3, - TALK_PIC_62_TOOTY_5, - TALK_PIC_63_DINGPOT, - TALK_PIC_64_CROC_BANJO, - TALK_PIC_65_GRUNTILDA_4, - TALK_PIC_66_LOCKUP, - TALK_PIC_67_VILE_5, - TALK_PIC_68_VILE_6, - TALK_PIC_69_VILE_7 -}; - -typedef struct { - u8 unk0[0x30]; //string1 - u8 unk30[0x30]; //string2 - u8 unk60[0x30]; - u8 unk90[0x20]; - u8 unkB0[0x40]; - BKModelBin *model; - AnimCtrl *anim_ctrl; - BKSprite *unkF8; - BKSpriteDisplayData *unkFC; - BKSprite *unk100; - BKSpriteDisplayData *unk104; - u8 unk108[5]; //sfx_ids - u8 pad10D[3]; - f32 unk110[5]; //sfx_??? - s16 unk124[5]; //sfx_??? - s16 unk12E; - void (*unk130)(s32, s32); - u8 unk134; - u8 state; - u8 portrait_id; //0x136 - u8 unk137; //string_cnt - u8 unk138; //current_string - u8 unk139; - u8 unk13A; - u8 sfx_count; - char *raw_str[8]; //string_ptrs - u8 unk15C; - u8 unk15D; - u8 unk15E; - u8 pad15F[0x1]; - u8 *unk160; - s16 unk164; - s16 unk166; //top_transparency??? - s16 unk168; //rgb??? - s16 unk16A; //x_pos - s16 unk16C; //y1_pos - s16 unk16E; //y2_pos - s16 unk170; - s16 unk172; - s16 unk174; - s8 unk176; - s8 unk177; - s8 unk178; - s8 unk179; - u8 pad17A[0x2]; - f32 unk17C; - s8 unk180; - s8 unk181; - u8 unk182; - u8 unk183; - u8 unk184; - u8 unk185; - s8 unk186; - u8 unk187; - u8 frame_count; //sprite frame count - u8 unk189; - u8 unk18A; - u8 prev_sfx; //next_sfx - f32 unk18C; - f32 unk190; - f32 unk194; - f32 unk198; - f32 unk19C; - f32 unk1A0; - u32 unk1A4_31:1; - u32 unk1A4_30:1; - u32 unk1A4_29:1; - u32 unk1A4_28:1; - u32 unk1A4_27:1; - u32 unk1A4_26:1; - u32 unk1A4_25:1; - u32 unk1A4_24:1; - u32 unk1A4_23:1; - u32 unk1A4_22:1; - u32 unk1A4_21:1; - u32 unk1A4_20:1; - u32 unk1A4_19:1; - u32 unk1A4_18:1; //highlighted - u32 unk1A4_17:1; - u32 unk1A4_16:1; - u32 unk1A4_15:1; - u32 unk1A4_14:1; - u32 unk1A4_13:1; - u32 unk1A4_12:1; - u32 unk1A4_11:1; - u32 unk1A4_10:1; - u32 pad1A4_9:10; -}gczoombox_t; //size 0x1A8 - - -void gczoombox_draw(gczoombox_t *this, Gfx **gdl, Mtx ** mptr, void *vptr); -void gczoombox_free(gczoombox_t* this); -gczoombox_t *gczoombox_new(s32 arg0, enum talk_pic_e arg1, s32 arg2, s32 arg3, void (*arg4)(s32, s32)); - -#endif diff --git a/include/math.h b/include/math.h index ee66ae46..95e8fe93 100644 --- a/include/math.h +++ b/include/math.h @@ -3,4 +3,4 @@ #define SQ(x) ((x)*(x)) -#endif // __BANJO_KAZOOIE_MATH_H__ \ No newline at end of file +#endif // __BANJO_KAZOOIE_MATH_H__ diff --git a/src/core1/code_18350.c b/src/core1/code_18350.c index 15d2d3a7..336d2147 100644 --- a/src/core1/code_18350.c +++ b/src/core1/code_18350.c @@ -2,8 +2,6 @@ #include "functions.h" #include "variables.h" -#define BAD_DTOR (BAD_PI/180.0) - /* .data*/ u32 D_80276CB0 = 0xD22FFFD8; //WHAT IS THIS? u32 D_80276CB4 = 0xDEFEF692; //WHAT IS THIS? diff --git a/src/core1/code_3A70.c b/src/core1/code_3A70.c index de7c0f9e..ae7db6d3 100644 --- a/src/core1/code_3A70.c +++ b/src/core1/code_3A70.c @@ -18,7 +18,7 @@ Gfx D_80275880[] = { }; /* .code */ -void func_80241490(Gfx **gfx, Vtx **vtx, s32 *arg2[3], s32 arg3[3], s32 arg4[3], s32 arg5[3], s32 arg6, s32 arg7) { +void func_80241490(Gfx **gfx, Vtx **vtx, s32 arg2[3], s32 arg3[3], s32 arg4[3], s32 arg5[3], s32 arg6, s32 arg7) { s32 spB4[3]; s32 var_a0; s32 var_v0; diff --git a/src/core1/code_660.c b/src/core1/code_660.c index 950442d9..f532f549 100644 --- a/src/core1/code_660.c +++ b/src/core1/code_660.c @@ -65,6 +65,7 @@ u32 D_8027BF2C; //crc1 u32 D_8027BF30; //crc2 u32 D_8027BF34; //hufts +static int _rarezip_inflate(u8 * src, u8 * dst, struct huft * arg2); /* .code */ s32 rarezip_get_uncompressed_size(u8 *arg0) { diff --git a/src/core2/ch/gameSelect.c b/src/core2/ch/gameSelect.c index b4ee783e..77b0b210 100644 --- a/src/core2/ch/gameSelect.c +++ b/src/core2/ch/gameSelect.c @@ -2,16 +2,17 @@ #include "functions.h" #include "variables.h" -#include "core2/code_C9E70.h" #include "core2/modelRender.h" +#include "../gc/zoombox.h" +#include "../code_C9E70.h" + #ifndef ABS #define ABS(d) ((d) >= 0) ? (d) : -(d) #endif void func_8031FBF8(void); void func_8031FBA0(void); -void func_803184C8(gczoombox_t *, f32, s32, s32, f32, s32, s32); Actor *func_802C4360(ActorMarker *, Gfx **, Mtx **, Vtx **); Actor *func_802C4464(ActorMarker *, Gfx **, Mtx **, Vtx **); @@ -100,8 +101,8 @@ struct { } D_8037DCE0; s32 D_8037DCE8; s32 D_8037DCEC; -gczoombox_t *chGameSelectTopZoombox; -gczoombox_t *chGameSelectBottomZoombox; +GcZoombox *chGameSelectTopZoombox; +GcZoombox *chGameSelectBottomZoombox; f32 D_8037DCF8[2][3]; f32 D_8037DD10[2][3]; s32 D_8037DD28; @@ -241,7 +242,7 @@ void func_802C4768(s32 gamenum){ sp20[0] = D_8037DD48;\ sp20[1] = D_8037DD68; func_8031877C(chGameSelectBottomZoombox); - func_80318284(chGameSelectBottomZoombox, 2, sp20); + gczoombox_setStrings(chGameSelectBottomZoombox, 2, sp20); gczoombox_maximize(chGameSelectBottomZoombox); gczoombox_resolve_minimize(chGameSelectBottomZoombox); } @@ -397,7 +398,7 @@ void func_802C4C14(Actor *this){ } subaddie_set_state(this, 2); func_8031877C(chGameSelectTopZoombox); - func_80318284(chGameSelectTopZoombox, 2, &D_8037DCE0); + gczoombox_setStrings(chGameSelectTopZoombox, 2, &D_8037DCE0); D_8037DD34 = 0.0f; } break; @@ -523,7 +524,7 @@ void func_802C4C14(Actor *this){ D_8037DD34 += sp50; if(20.0 < D_8037DD34){ func_8031877C(chGameSelectTopZoombox); - func_80318284(chGameSelectTopZoombox, 2, &D_8037DCE0); + gczoombox_setStrings(chGameSelectTopZoombox, 2, &D_8037DCE0); D_8037DD34 = 0.0f; } } @@ -557,14 +558,14 @@ void func_802C5740(Actor * this){ if(!this->initialized){ gameFile_8033CE40(); if(chGameSelectBottomZoombox == NULL){ - chGameSelectBottomZoombox = gczoombox_new(0xA0, TALK_PIC_C_BANJO_2, 2, 0, NULL); + chGameSelectBottomZoombox = gczoombox_new(0xA0, ZOOMBOX_SPRITE_C_BANJO_2, 2, 0, NULL); gczoombox_open(chGameSelectBottomZoombox); func_803184C8(chGameSelectBottomZoombox, 30.0f, 5, 2, 0.4f, 0, 0); }//L802C57FC if(chGameSelectTopZoombox == NULL){ - chGameSelectTopZoombox = gczoombox_new(0xA, TALK_PIC_D_KAZOOIE_1, 2, 1, func_802C44D0); - func_80318284(chGameSelectTopZoombox, 2, &D_8037DCE0); + chGameSelectTopZoombox = gczoombox_new(0xA, ZOOMBOX_SPRITE_D_KAZOOIE_1, 2, 1, func_802C44D0); + gczoombox_setStrings(chGameSelectTopZoombox, 2, &D_8037DCE0); gczoombox_open(chGameSelectTopZoombox); gczoombox_maximize(chGameSelectTopZoombox); }//L802C5860 diff --git a/src/core2/ch/gravestone.c b/src/core2/ch/gravestone.c index 69a08929..06f79c1b 100644 --- a/src/core2/ch/gravestone.c +++ b/src/core2/ch/gravestone.c @@ -5,7 +5,7 @@ Actor *func_8035ECA0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); void func_8035F138(Actor *this); -extern bool func_803257B4(ActorMarker *marker); +BKModelBin *func_803257B4(ActorMarker *marker); extern void actor_postdrawMethod(ActorMarker *); extern f32 func_80257204(f32, f32, f32, f32); diff --git a/src/core2/code_59D40.c b/src/core2/ch/snacker.c similarity index 51% rename from src/core2/code_59D40.c rename to src/core2/ch/snacker.c index 48fcbd18..508d7e0a 100644 --- a/src/core2/code_59D40.c +++ b/src/core2/ch/snacker.c @@ -2,46 +2,65 @@ #include "functions.h" #include "variables.h" +#include "snacker.h" + extern f32 ml_distanceSquared_vec3f(f32 [3], f32 [3]); extern f32 func_80309B24(f32[3]); extern void func_80328FF0(Actor *, f32); extern void mapSpecificFlags_setN(s32, s32, s32); -typedef struct { - s32 unk0; - s32 unk4; //opacity - f32 unk8; -}ActorLocal_core2_59D40; +typedef enum { + CH_SNACKER_OPA_0_APPEAR, + CH_SNACKER_OPA_1_ACTIVE, + CH_SNACKER_OPA_2_FADE +} ChSnackerOpacityState; +typedef enum { + CH_SNACKER_STATE_1 = 1, + CH_SNACKER_STATE_2, + CH_SNACKER_STATE_3, + CH_SNACKER_STATE_4, + CH_SNACKER_STATE_5_EATING, + CH_SNACKER_STATE_6, + CH_SNACKER_STATE_7, + CH_SNACKER_STATE_8_HURT, + CH_SNACKER_STATE_9_DEAD +} ChSnackerState; + +typedef struct { + s32 ctl; //ChSnackerControl + s32 opa; //opacity + f32 unk8; +}ChSnackerLocal; void chsnacker_update(Actor *this); /* .data */ -ActorAnimationInfo D_803685D0[] ={ +ActorAnimationInfo sChSnackerAnimations[] ={ {0x000, 0.0f}, - {0x078, 2.0f}, - {0x078, 1.0f}, - {0x078, 0.4f}, - {0x078, 0.4f}, - {0x154, 1.1f}, - {0x078, 0.4f}, - {0x078, 1.0f}, - {0x273, 0.53f}, - {0x274, 1.09f} + {ASSET_78_ANIM_SNACKER_SWIMMING, 2.0f}, + {ASSET_78_ANIM_SNACKER_SWIMMING, 1.0f}, + {ASSET_78_ANIM_SNACKER_SWIMMING, 0.4f}, + {ASSET_78_ANIM_SNACKER_SWIMMING, 0.4f}, + {ASSET_154_ANIM_SNACKER_EATING, 1.1f}, + {ASSET_78_ANIM_SNACKER_SWIMMING, 0.4f}, + {ASSET_78_ANIM_SNACKER_SWIMMING, 1.0f}, + {ASSET_273_ANIM_SNACKER_HURT, 0.53f}, + {ASSET_274_ANIM_SNACKER_DIE, 1.09f} }; -ActorInfo D_80368620 = { - 0x14, 0x68, 0x3B0, - 0x1, D_803685D0, +ActorInfo gChSnacker = { + MARKER_14_SNACKER, ACTOR_68_SNACKER, ASSET_3B0_SNACKER, + 0x1, sChSnackerAnimations, chsnacker_update, func_80326224, actor_draw, 0, 0, 0.0f, 0 }; /* .bss */ -ActorMarker *D_8037E620; -f32 D_8037E624; -f32 D_8037E628; -s32 D_8037E62C; +ActorMarker *s_chSnacker_marker; +f32 s_chSnacker_spawnTimer; +f32 s_chSnacker_respawnDelay_s; +s32 s_chSnacker_inRbb; s32 D_8037E630; /* .code */ @@ -49,9 +68,9 @@ void func_802E0CD0(Actor *this){ this->unk28 = 4.0f; } -void func_802E0CE0(Actor *this) { - ActorLocal_core2_59D40 *local = (ActorLocal_core2_59D40 *)&this->local; - s32 temp_v0; +static void __chsnacker_start_dialog(Actor *this) { + ChSnackerLocal *local = (ChSnackerLocal *)&this->local; + s32 text_index; if (this->unk38_31 != 0) { this->unk38_31--; @@ -59,12 +78,12 @@ void func_802E0CE0(Actor *this) { else{ this->unk28 = 0.0f; if (level_get() == LEVEL_2_TREASURE_TROVE_COVE) { - temp_v0 = mapSpecificFlags_getN(8, 3); + text_index = mapSpecificFlags_getN(8, 3); if( !this->unk138_24 ) { - if(temp_v0 < 4) { - if(func_80311480(0xA1B + temp_v0, 0, NULL, NULL, NULL, NULL)){ - temp_v0++; - mapSpecificFlags_setN(8, temp_v0, 3); + if(text_index < 4) { + if(func_80311480(0xA1B + text_index, 0, NULL, NULL, NULL, NULL)){ + text_index++; + mapSpecificFlags_setN(8, text_index, 3); this->unk138_24 = TRUE; } } @@ -74,13 +93,13 @@ void func_802E0CE0(Actor *this) { } } -bool func_802E0DC0(f32 arg0[3]){ - f32 sp2C[3]; +bool func_802E0DC0(f32 snacker_position[3]){ + f32 player_position[3]; f32 pad0; - player_getPosition(sp2C); - return (4000000.0f < ml_distanceSquared_vec3f(sp2C, arg0)) - || ( (arg0[1] - func_80309724(arg0) < 70.0f) && (func_80309B24(arg0) - arg0[1] < 70.0f)); + player_getPosition(player_position); + return (4000000.0f < ml_distanceSquared_vec3f(player_position, snacker_position)) + || ( (snacker_position[1] - func_80309724(snacker_position) < 70.0f) && (func_80309B24(snacker_position) - snacker_position[1] < 70.0f)); } void func_802E0E88(Actor *this){ @@ -91,33 +110,33 @@ void func_802E0E88(Actor *this){ void func_802E0EC8(void){ Actor *this; - ActorLocal_core2_59D40 *local; + ChSnackerLocal *local; - this = marker_getActor(D_8037E620); - local = (ActorLocal_core2_59D40 *)&this->local; + this = marker_getActor(s_chSnacker_marker); + local = (ChSnackerLocal *)&this->local; actor_collisionOff(this); - D_8037E620->propPtr->unk8_3 = FALSE; - if(local->unk0 != 2){ + s_chSnacker_marker->propPtr->unk8_3 = FALSE; + if(local->ctl != CH_SNACKER_OPA_2_FADE){ func_8032BB88(this, -1, 750); comusic_8025AB44(COMUSIC_34_SNACKER_DANGER, 0, 750); func_8025AABC(COMUSIC_34_SNACKER_DANGER); - local->unk0 = 2; + local->ctl = CH_SNACKER_OPA_2_FADE; } } -void func_802E0F60(ActorMarker *marker, ActorMarker *other){ +static void __chsnacker_die(ActorMarker *marker, ActorMarker *other){ Actor *this; this = marker_getActor(marker); actor_collisionOff(this); FUNC_8030E8B4(SFX_179_GRUNTY_DAMAGE, 0.6f, 32750, this->position, 300, 3000); - subaddie_set_state_with_direction(this, 9, 0.0f, 1); + subaddie_set_state_with_direction(this, CH_SNACKER_STATE_9_DEAD, 0.0f, 1); actor_playAnimationOnce(this); } void func_802E0FC4(Actor *this){ - D_8037E620 = NULL; + s_chSnacker_marker = NULL; D_8037E630 = this->unk166; if(func_8025AD7C(COMUSIC_34_SNACKER_DANGER)){ func_8025AABC(COMUSIC_34_SNACKER_DANGER); @@ -133,7 +152,7 @@ void func_802E1010(ActorMarker *marker, ActorMarker *other){ actor_playAnimationOnce(this); } -void func_802E1050(ActorMarker *marker, ActorMarker *other){ +static void __chsnacker_ow(ActorMarker *marker, ActorMarker *other){ Actor *this; this = marker_getActor(marker); @@ -159,29 +178,29 @@ f32 func_802E10F0(f32 arg0) { } void chsnacker_update(Actor *this) { - f32 sp5C; - ActorLocal_core2_59D40 *local; - s32 sp54; + f32 dt; + ChSnackerLocal *local; + SnackerCtlState controller_state; f32 player_position[3]; f32 sp44; f32 sp40; s32 tmp; - sp5C = time_getDelta(); - local = (ActorLocal_core2_59D40 *)&this->local; + dt = time_getDelta(); + local = (ChSnackerLocal *)&this->local; if (!this->initialized) { this->initialized = TRUE; this->marker->propPtr->unk8_3 = TRUE; this->unk138_25 = TRUE; this->unk154 = 0x085E0000; - marker_setCollisionScripts(this->marker, func_802E1050, func_802E1010, func_802E0F60); + marker_setCollisionScripts(this->marker, __chsnacker_ow, func_802E1010, __chsnacker_die); } _player_getPosition(player_position); - sp54 = func_8028A94C(); + controller_state = snackerctl_get_state(); - if(func_802E0DC0(this->position) || ((sp54 != 1) && (sp54 != 2))) { - local->unk8 = MIN(3.5, local->unk8 + sp5C); + if(func_802E0DC0(this->position) || ((controller_state != SNACKER_CTL_STATE_1_RBB) && (controller_state != SNACKER_CTL_STATE_2_TTC))) { + local->unk8 = MIN(3.5, local->unk8 + dt); if (local->unk8 == 3.5) { func_802E0EC8(); } @@ -194,18 +213,18 @@ void chsnacker_update(Actor *this) { if (subaddie_maybe_set_state_position_direction(this, 2, 0.0f, 1, 0.03f) != 0) { func_802E0CD0(this); } - func_802E0CE0(this); + __chsnacker_start_dialog(this); break; case 2: //802E130C func_80328FB0(this, 3.0f); func_80328FF0(this, 3.0f); - func_8032CA80(this, (D_8037E62C) ? 15 : 9); + func_8032CA80(this, (s_chSnacker_inRbb) ? 15 : 9); if (func_80329480(this) != 0) { func_80328CEC(this, (s32) this->yaw, 0x5A, 0x96); } subaddie_maybe_set_state_position_direction(this, 1, 0.0f, 1, 0.0075f); - func_802E0CE0(this); + __chsnacker_start_dialog(this); break; case 3: //802E13AC @@ -226,11 +245,11 @@ void chsnacker_update(Actor *this) { this->unk6C = func_802E10F0(sp44); func_80328FB0(this, this->unk28 / 2); func_80328FF0(this, this->unk28 / 2); - this->unk28 = MIN(50.0, this->unk28 + sp5C); - func_8032CA80(this, (D_8037E62C) ? 15 : 9); + this->unk28 = MIN(50.0, this->unk28 + dt); + func_8032CA80(this, (s_chSnacker_inRbb) ? 15 : 9); break; - case 5: //802E14F8 + case CH_SNACKER_STATE_5_EATING: //802E14F8 if (actor_animationIsAt(this, 0.25f)) { FUNC_8030E8B4(SFX_6D_CROC_BITE, 1.0f, 28000, this->position, 300, 3000); } @@ -241,10 +260,10 @@ void chsnacker_update(Actor *this) { subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_loopAnimation(this); } - func_8032CA80(this, (D_8037E62C) ? 15 : 9); + func_8032CA80(this, (s_chSnacker_inRbb) ? 15 : 9); break; - case 8: //802E15BC + case CH_SNACKER_STATE_8_HURT: //802E15BC if (animctrl_isStopped(this->animctrl)) { func_802E0CD0(this); subaddie_set_state_with_direction(this, 2, 0.0f, 1); @@ -252,9 +271,9 @@ void chsnacker_update(Actor *this) { } break; - case 9: //802E15FC + case CH_SNACKER_STATE_9_DEAD: //802E15FC if (animctrl_isStopped(this->animctrl)) { - D_8037E628 = 60.0f; + s_chSnacker_respawnDelay_s = 60.0f; D_8037E630 = 0x63; func_802E0EC8(); } @@ -263,111 +282,111 @@ void chsnacker_update(Actor *this) { break; }//L802E1630 - local = (ActorLocal_core2_59D40 *)&this->local; - switch(local->unk0){ - case 0: - local->unk4 = MIN(0xFF, local->unk4 + 8); - if(local->unk4 >= 0x81){ + local = (ChSnackerLocal *)&this->local; + switch(local->ctl){ + case CH_SNACKER_OPA_0_APPEAR: + local->opa = MIN(0xFF, local->opa + 8); + if(local->opa >= 0x81){ this->marker->collidable = TRUE; } - if (local->unk4 == 0xFF) { - local->unk0 = 1; + if (local->opa == 0xFF) { + local->ctl = CH_SNACKER_OPA_1_ACTIVE; } break; - case 1: + case CH_SNACKER_OPA_1_ACTIVE: break; - case 2: - local->unk4 = MAX(0, local->unk4 - 8); - if(local->unk4 < 0x80){ + case CH_SNACKER_OPA_2_FADE: + local->opa = MAX(0, local->opa - 8); + if(local->opa < 0x80){ this->marker->collidable = FALSE; } - if (local->unk4 == 0) { + if (local->opa == 0) { marker_despawn(this->marker); } break; } - actor_setOpacity(this, local->unk4); - this->depth_mode = (255.0 == local->unk4) ? MODEL_RENDER_DEPTH_FULL : MODEL_RENDER_DEPTH_COMPARE; + actor_setOpacity(this, local->opa); + this->depth_mode = (255.0 == local->opa) ? MODEL_RENDER_DEPTH_FULL : MODEL_RENDER_DEPTH_COMPARE; } -void func_802E1790(void){ - D_8037E624 = 0.0f; - D_8037E628 = 1.0f; - D_8037E620 = NULL; - D_8037E62C = (level_get() == LEVEL_9_RUSTY_BUCKET_BAY); +void chSnacker_initialize(void){ + s_chSnacker_spawnTimer = 0.0f; + s_chSnacker_respawnDelay_s = 1.0f; + s_chSnacker_marker = NULL; + s_chSnacker_inRbb = (level_get() == LEVEL_9_RUSTY_BUCKET_BAY); D_8037E630 = 0x63; } -void func_802E17E8(void) { +void chSnacker_spawn(void) { Actor *snacker; - f32 sp50[3]; - f32 sp4C; - ActorLocal_core2_59D40 *local; + f32 spawn_position[3]; + f32 spawn_angle_rad; + ChSnackerLocal *local; s32 pad; f32 sp38[3]; f32 sp2C[3]; f32 sp20[3]; - _player_getPosition(sp50); + _player_getPosition(spawn_position); if (func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE) != 0) { - nodeprop_getPosition(func_80304CAC(0x3CB, sp50), sp50); + nodeprop_getPosition(func_80304CAC(0x3CB, spawn_position), spawn_position); } else{ - sp4C = randf2(0.0f, 3.28f); - sp50[0] += 1000.0 * cosf(sp4C); - sp50[2] += 1000.0 * sinf(sp4C); + spawn_angle_rad = randf2(0.0f, 3.28f); + spawn_position[0] += 1000.0 * cosf(spawn_angle_rad); + spawn_position[2] += 1000.0 * sinf(spawn_angle_rad); - sp38[0] = sp50[0]; - sp38[1] = sp50[1]; - sp38[2] = sp50[2]; + sp38[0] = spawn_position[0]; + sp38[1] = spawn_position[1]; + sp38[2] = spawn_position[2]; sp38[1] += 1000.0f; - sp2C[0] = sp50[0]; - sp2C[1] = sp50[1]; - sp2C[2] = sp50[2]; + sp2C[0] = spawn_position[0]; + sp2C[1] = spawn_position[1]; + sp2C[2] = spawn_position[2]; sp2C[1] -= 1000.0f; if (func_80309B48(sp38, sp2C, sp20, 0xF800FF0F)) { - sp50[1] = sp2C[1] - 60.0f; + spawn_position[1] = sp2C[1] - 60.0f; } else{ return; } } - snacker = func_8032813C(0x68, sp50, 0); - D_8037E620 = snacker->marker; + snacker = func_8032813C(ACTOR_68_SNACKER, spawn_position, 0); + s_chSnacker_marker = snacker->marker; - local = (ActorLocal_core2_59D40 *)&snacker->local; + local = (ChSnackerLocal *)&snacker->local; snacker->unk166 = (s8) D_8037E630; - local->unk0 = 0; - local->unk4 = 0; + local->ctl = CH_SNACKER_OPA_0_APPEAR; + local->opa = 0; local->unk8 = 0.0f; - marker_setFreeMethod(D_8037E620, func_802E0FC4); - if (func_8032CA80(snacker, D_8037E62C ? 0x10 : 0xC)) { - marker_despawn(D_8037E620); + marker_setFreeMethod(s_chSnacker_marker, func_802E0FC4); + if (func_8032CA80(snacker, s_chSnacker_inRbb ? 0x10 : 0xC)) { + marker_despawn(s_chSnacker_marker); return; } if (func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE) == 0) { func_8032BB88(snacker, 5000, 750); func_8024BD08(0); - func_8025A6EC(0x34, 0); + func_8025A6EC(COMUSIC_34_SNACKER_DANGER, 0); comusic_8025AB44(COMUSIC_34_SNACKER_DANGER, 0x7FFF, 750); func_8024BD08(1); } - D_8037E624 = 0.0f; - func_8032CA80(snacker, D_8037E62C ? 15 : 9); + s_chSnacker_spawnTimer = 0.0f; + func_8032CA80(snacker, s_chSnacker_inRbb ? 15 : 9); } -void func_802E1A04(s32 nextState) { - f32 sp1C; +void chsnacker_setControlState(SnackerCtlState control_state) { + f32 dt; - sp1C = time_getDelta(); + dt = time_getDelta(); if( getGameMode() == GAME_MODE_A_SNS_PICTURE || getGameMode() == GAME_MODE_5_UNKNOWN @@ -376,11 +395,11 @@ void func_802E1A04(s32 nextState) { return; } - if ((D_8037E620 == NULL)) { - D_8037E624 += sp1C; - if ((D_8037E628 < D_8037E624) && (nextState != 0)) { - __spawnQueue_add_0(func_802E17E8); - D_8037E628 = 1.0f; + if ((s_chSnacker_marker == NULL)) { + s_chSnacker_spawnTimer += dt; + if ((s_chSnacker_respawnDelay_s < s_chSnacker_spawnTimer) && (control_state != SNACKER_CTL_STATE_0_INACTIVE)) { + __spawnQueue_add_0(chSnacker_spawn); + s_chSnacker_respawnDelay_s = 1.0f; } } } diff --git a/src/core2/ch/snacker.h b/src/core2/ch/snacker.h new file mode 100644 index 00000000..8fb961ad --- /dev/null +++ b/src/core2/ch/snacker.h @@ -0,0 +1,12 @@ +#ifndef __BANJO_KAZOOIE_CORE2_CH_SNACKER_H__ +#define __BANJO_KAZOOIE_CORE2_CH_SNACKER_H__ + +#include "prop.h" // for ActorInfo +#include "../snackerctl.h" //for SnackerCtlState + +extern ActorInfo gChSnacker; + +void chSnacker_initialize(void); +void chsnacker_setControlState(SnackerCtlState nextState); + +#endif // __BANJO_KAZOOIE_CORE2_CH_SNACKER_H__ diff --git a/src/core2/code_47BD0.c b/src/core2/code_47BD0.c index fee020d4..ea58338c 100644 --- a/src/core2/code_47BD0.c +++ b/src/core2/code_47BD0.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" -#include "core2/code_C9E70.h" +#include "code_C9E70.h" extern void func_8030DBFC(u32, f32, f32, f32); extern bool func_80309DBC(f32[3], f32[3], f32, f32 sp54[3], s32, s32); @@ -40,7 +40,8 @@ Actor *chBeeSwarm_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); /* .data */ -ActorInfo D_80367310 = {MARKER_217_BEE_SWARM, ACTOR_34D_BEE_SWARM, ASSET_49E_SPRITE_BEE_SWARM, +ActorInfo D_80367310 = { + MARKER_217_BEE_SWARM, ACTOR_34D_BEE_SWARM, ASSET_49E_SPRITE_BEE_SWARM, 1, NULL, chBeeSwarm_update, NULL, chBeeSwarm_draw, 0, 0, 1.0f, 0 @@ -307,8 +308,8 @@ void chBeeSwarm_update(Actor *this) { Actor *beehive; ActorLocal_core2_47BD0 *local = (ActorLocal_core2_47BD0 *)&this->local; f32 spB4[3]; - f32 spB0; - f32 spAC; + f32 distance_to_home; + f32 dt; f32 spA0[3]; f32 position[3]; f32 next_position[3]; @@ -317,13 +318,13 @@ void chBeeSwarm_update(Actor *this) { f32 temp_f0; f32 sp68[3]; - spAC = time_getDelta(); + dt = time_getDelta(); sp78 = 0; if (!this->initialized) { this->initialized = TRUE; - beehive = actorArray_findClosestActorFromActorId(this->position, ACTOR_12_BEEHIVE, -1, &spB0); + beehive = actorArray_findClosestActorFromActorId(this->position, ACTOR_12_BEEHIVE, -1, &distance_to_home); this->unk100 = (beehive != NULL) ? beehive->marker : NULL; - if(500.0f < spB0){ + if(500.0f < distance_to_home){ this->unk100 = NULL; } sp78 = 1; @@ -359,13 +360,13 @@ void chBeeSwarm_update(Actor *this) { actor_collisionOff(this); local->unk20 = assetcache_get(ASSET_3BF_MODEL_PLAYER_SHADOW); if (sp78 == 0) { - beehive = actorArray_findClosestActorFromActorId(this->position, ACTOR_12_BEEHIVE, -1, &spB0); + beehive = actorArray_findClosestActorFromActorId(this->position, ACTOR_12_BEEHIVE, -1, &distance_to_home); if (beehive != NULL) { this->unk100 = beehive->marker; } else { this->unk100 = NULL; } - if (spB0 > 500.0f) { + if (distance_to_home > 500.0f) { this->unk100 = NULL; } } @@ -399,9 +400,9 @@ void chBeeSwarm_update(Actor *this) { position[0] = this->position[0]; position[1] = this->position[1]; position[2] = this->position[2]; - next_position[0] = this->position[0] + (this->velocity[0] * spAC); - next_position[1] = this->position[1] + (this->velocity[1] * spAC); - next_position[2] = this->position[2] + (this->velocity[2] * spAC); + next_position[0] = this->position[0] + (this->velocity[0] * dt); + next_position[1] = this->position[1] + (this->velocity[1] * dt); + next_position[2] = this->position[2] + (this->velocity[2] * dt); if (this->state != 7) { if (func_80309DBC(position, next_position, 75.0f, sp7C, 3, 0)) { ml_vec3f_normalize(sp7C); @@ -478,7 +479,7 @@ void chBeeSwarm_update(Actor *this) { break; case 4: spB4[1] += 50.0f; - this->unk60 += spAC; + this->unk60 += dt; if ((this->unk60 - 0.5 > 0.0) && (local->unk0 > 0) && (func_8028ECAC() != 3)) { func_8028F504(0xD); this->unk60 -= 0.5; diff --git a/src/core2/code_7060.c b/src/core2/code_7060.c index 5da4b72a..a16103c3 100644 --- a/src/core2/code_7060.c +++ b/src/core2/code_7060.c @@ -9,6 +9,8 @@ #include "core2/ba/drone.h" #include "core2/ba/physics.h" +#include "snackerctl.h" + extern bool player_isInHorizontalRadius(f32[3], f32); extern bool player_isInVerticalRange(f32[3], f32); extern void miscflag_clear(s32); @@ -817,7 +819,7 @@ void func_8028F800(s32 arg0[3]){ void func_8028F85C(f32 arg0[3]){ func_80298464(arg0); func_80293F0C(); - func_8028A8D0(); + snackerctl_update(); func_8028B71C(); func_80290B6C(); cameraMode_update(); diff --git a/src/core2/code_91E10.c b/src/core2/code_91E10.c index 2102f877..3a44f4a6 100644 --- a/src/core2/code_91E10.c +++ b/src/core2/code_91E10.c @@ -2,9 +2,10 @@ #include "functions.h" #include "variables.h" +#include "gc/zoombox.h" + extern void item_set(enum item_e, s32); extern void func_8025A55C(s32, s32, s32); -extern void func_803184C8(gczoombox_t *, f32, s32, s32, f32, bool, bool); typedef struct { @@ -47,7 +48,7 @@ typedef struct { u8 unk18[4]; s8 unk1C[4]; s8 unk20[4]; //portrait_id - gczoombox_t *unk24[4]; //zoombox + GcZoombox *unk24[4]; //zoombox Struct_Core2_91E10_1 unk34; }Struct_Core2_91E10; @@ -57,50 +58,50 @@ void func_8031A3E4(void); u8 D_8036D940[] = { 0, - TALK_PIC_11_CHIMPY, - TALK_PIC_12_CONGA, - TALK_PIC_13_BLUBBER, - TALK_PIC_14_NIPPER, - TALK_PIC_15_CLANKER, - TALK_PIC_16_SNIPPET, - TALK_PIC_17_VILE_4, - TALK_PIC_18_TIPTUP, - TALK_PIC_19_TANKTUP, - TALK_PIC_1A_FLIBBIT, - TALK_PIC_1B_TRUNKER, - TALK_PIC_1C_RUBEE, - TALK_PIC_1D_GOBI, - TALK_PIC_1E_GRABBA, - TALK_PIC_1F_TEEHEE, - TALK_PIC_3B_SNACKER, - TALK_PIC_3C_ANCIENT_ONE, - TALK_PIC_43_BOGGY, - TALK_PIC_44_WOZZA, - TALK_PIC_5B_CHEATO, - TALK_PIC_64_CROC_BANJO, - TALK_PIC_35_JUJU, - TALK_PIC_34_TERMITE, - TALK_PIC_38_LEAKY, - TALK_PIC_37_LITTLE_LOCKUP, - TALK_PIC_59_BLACK_SNIPPET, - TALK_PIC_39_GLOOP, - TALK_PIC_40_CROCTUS, - TALK_PIC_33_PIRANHA, - TALK_PIC_4B_TWINKLY, - TALK_PIC_4C_TWINKLY_CHOMPER, - TALK_PIC_3F_JINXY, - TALK_PIC_45_MOTZHAND, - TALK_PIC_5A_LOGGO, - TALK_PIC_3E_SNORKEL, - TALK_PIC_4E_BOSS_BOOM_BOX, - TALK_PIC_50_NABNUT, - TALK_PIC_55_ADULT_EEYRIE, - TALK_PIC_4D_GNAWTY, - TALK_PIC_4F_ZUBBA, - TALK_PIC_36_YUMYUM, - TALK_PIC_3D_SAND_EEL, - TALK_PIC_3A_TIPTUP_CHOIR_MEMBER, - TALK_PIC_67_VILE_5, + ZOOMBOX_SPRITE_11_CHIMPY, + ZOOMBOX_SPRITE_12_CONGA, + ZOOMBOX_SPRITE_13_BLUBBER, + ZOOMBOX_SPRITE_14_NIPPER, + ZOOMBOX_SPRITE_15_CLANKER, + ZOOMBOX_SPRITE_16_SNIPPET, + ZOOMBOX_SPRITE_17_VILE_4, + ZOOMBOX_SPRITE_18_TIPTUP, + ZOOMBOX_SPRITE_19_TANKTUP, + ZOOMBOX_SPRITE_1A_FLIBBIT, + ZOOMBOX_SPRITE_1B_TRUNKER, + ZOOMBOX_SPRITE_1C_RUBEE, + ZOOMBOX_SPRITE_1D_GOBI, + ZOOMBOX_SPRITE_1E_GRABBA, + ZOOMBOX_SPRITE_1F_TEEHEE, + ZOOMBOX_SPRITE_3B_SNACKER, + ZOOMBOX_SPRITE_3C_ANCIENT_ONE, + ZOOMBOX_SPRITE_43_BOGGY, + ZOOMBOX_SPRITE_44_WOZZA, + ZOOMBOX_SPRITE_5B_CHEATO, + ZOOMBOX_SPRITE_64_CROC_BANJO, + ZOOMBOX_SPRITE_35_JUJU, + ZOOMBOX_SPRITE_34_TERMITE, + ZOOMBOX_SPRITE_38_LEAKY, + ZOOMBOX_SPRITE_37_LITTLE_LOCKUP, + ZOOMBOX_SPRITE_59_BLACK_SNIPPET, + ZOOMBOX_SPRITE_39_GLOOP, + ZOOMBOX_SPRITE_40_CROCTUS, + ZOOMBOX_SPRITE_33_PIRANHA, + ZOOMBOX_SPRITE_4B_TWINKLY, + ZOOMBOX_SPRITE_4C_TWINKLY_CHOMPER, + ZOOMBOX_SPRITE_3F_JINXY, + ZOOMBOX_SPRITE_45_MOTZHAND, + ZOOMBOX_SPRITE_5A_LOGGO, + ZOOMBOX_SPRITE_3E_SNORKEL, + ZOOMBOX_SPRITE_4E_BOSS_BOOM_BOX, + ZOOMBOX_SPRITE_50_NABNUT, + ZOOMBOX_SPRITE_55_ADULT_EEYRIE, + ZOOMBOX_SPRITE_4D_GNAWTY, + ZOOMBOX_SPRITE_4F_ZUBBA, + ZOOMBOX_SPRITE_36_YUMYUM, + ZOOMBOX_SPRITE_3D_SAND_EEL, + ZOOMBOX_SPRITE_3A_TIPTUP_CHOIR_MEMBER, + ZOOMBOX_SPRITE_67_VILE_5, }; /* .bss */ @@ -332,7 +333,7 @@ bool func_803192A4(enum ff_question_type_e q_type, s32 q_indx, s32 arg2) { void func_803196D0(s32 arg0) { gczoombox_open(D_803830E0->unk24[arg0]); gczoombox_maximize(D_803830E0->unk24[arg0]); - func_80318284(D_803830E0->unk24[arg0], D_803830E0->unk18[D_803830E0->unk1C[arg0]], D_803830E0->unk34.unk0[D_803830E0->unk1C[arg0]]); + gczoombox_setStrings(D_803830E0->unk24[arg0], D_803830E0->unk18[D_803830E0->unk1C[arg0]], D_803830E0->unk34.unk0[D_803830E0->unk1C[arg0]]); } //__gcquiz_set_box_highlight @@ -368,7 +369,7 @@ void func_803197AC(s32 arg0){ case 1: //80319910 gczoombox_open(D_803830E0->unk24[0]); gczoombox_maximize(D_803830E0->unk24[0]); - func_80318284(D_803830E0->unk24[0], D_803830E0->unk18[0], D_803830E0->unk34.unk0[0]); + gczoombox_setStrings(D_803830E0->unk24[0], D_803830E0->unk18[0], D_803830E0->unk34.unk0[0]); break; case 2: //8031994C @@ -583,7 +584,7 @@ bool func_8031A22C(u8 *arg0, s8 *arg1, Struct_Core2_91E10_1 *arg2, s32 arg3, voi D_803830E0->unk1C[i] = i; } if (D_803830E0->unk20[0] != 0) { - func_803189C4(D_803830E0->unk24[0], D_803830E0->unk20[0]); + gczoombox_loadSprite(D_803830E0->unk24[0], D_803830E0->unk20[0]); } D_803830E0->unk0 = -1; D_803830E0->unk1 = -1; @@ -639,8 +640,8 @@ void func_8031A4CC(void) { if (D_803830E0 != NULL) { for(i = 0; i < 4; i++){ - func_80318C0C(D_803830E0->unk24[i]); - D_803830E0->unk24[i] = (gczoombox_t *)defrag(D_803830E0->unk24[i]); + gczoombox_defrag(D_803830E0->unk24[i]); + D_803830E0->unk24[i] = (GcZoombox *)defrag(D_803830E0->unk24[i]); } if (func_8031A3BC() == 0) { diff --git a/src/core2/code_9E370.c b/src/core2/code_9E370.c index d6a3fc0a..4bbeee08 100644 --- a/src/core2/code_9E370.c +++ b/src/core2/code_9E370.c @@ -195,7 +195,7 @@ void func_803257A4(ActorMarker *marker){ marker->unk14_21 = TRUE; } -bool func_803257B4(ActorMarker *marker) { +BKModelBin *func_803257B4(ActorMarker *marker) { Actor *actor; BKModelBin *model_bin; BKVertexList *vtx_list; @@ -209,7 +209,7 @@ bool func_803257B4(ActorMarker *marker) { assetcache_release(model_bin); } func_8033A4A0(marker->modelId, actor->unk174, actor->unk178); - return FALSE; + return NULL; } diff --git a/src/core2/code_C9E70.c b/src/core2/code_C9E70.c index 1522c47b..9340fe78 100644 --- a/src/core2/code_C9E70.c +++ b/src/core2/code_C9E70.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" -#include "core2/code_C9E70.h" +#include "code_C9E70.h" extern struct FF_StorageStruct *D_8037DCB8; @@ -13,8 +13,8 @@ void func_80350E00(void){ return; if(D_8037DCB8->unk20){ - func_80318C0C(D_8037DCB8->unk20); - D_8037DCB8->unk20 = (gczoombox_t *)defrag(D_8037DCB8->unk20); + gczoombox_defrag(D_8037DCB8->unk20); + D_8037DCB8->unk20 = (GcZoombox *)defrag(D_8037DCB8->unk20); } D_8037DCB8->unk48 = (struct FF_StorageStruct_48 *)defrag(D_8037DCB8->unk48); D_8037DCB8 = (struct FF_StorageStruct *) defrag(D_8037DCB8); diff --git a/include/core2/code_C9E70.h b/src/core2/code_C9E70.h similarity index 96% rename from include/core2/code_C9E70.h rename to src/core2/code_C9E70.h index bd6793e1..14269b9c 100644 --- a/include/core2/code_C9E70.h +++ b/src/core2/code_C9E70.h @@ -4,6 +4,8 @@ #include #include "structs.h" +#include "gc/zoombox.h" + typedef struct { s16 unk0[4]; u8 unk8; //FF_TileType @@ -68,7 +70,7 @@ struct FF_StorageStruct { // holds moves involved with the FFM glitch /* 1C */ u32 unlockedMoves; - /* 20 */ gczoombox_t *unk20; + /* 20 */ GcZoombox *unk20; /* 24 */ f32 playerPosition[3]; /* 30 */ f32 playerRotation[3]; diff --git a/src/core2/code_E910.c b/src/core2/code_E910.c index 7fb7d534..ca026660 100644 --- a/src/core2/code_E910.c +++ b/src/core2/code_E910.c @@ -5,7 +5,7 @@ #include "bs_funcs.h" #include "core2/statetimer.h" #include "core2/ba/physics.h" - +#include "snackerctl.h" u8 D_80363820 = 0; bsMap D_80363824[] ={ @@ -187,7 +187,7 @@ void func_80295914(void){ D_8037C3B0 = NULL; update_void_return_Location(); func_802983F0(); - snacker_reset(); + snackerctl_reset(); func_80291910(); badrone_init(); bafalldamage_init(); @@ -305,7 +305,7 @@ void func_80295C14(void){ func_8029842C(); baMarker_update(); bacarry_update(); - func_8028A8D0(); + snackerctl_update(); func_8028B71C(); func_8029D968(); func_80297CF8(); diff --git a/src/core2/code_87E30.c b/src/core2/gc/dialog.c similarity index 97% rename from src/core2/code_87E30.c rename to src/core2/gc/dialog.c index 739569a6..fe5881a6 100644 --- a/src/core2/code_87E30.c +++ b/src/core2/gc/dialog.c @@ -2,15 +2,10 @@ #include "functions.h" #include "variables.h" +#include "zoombox.h" extern void func_803114D0(void ); -extern void func_803184C8(gczoombox_t *, f32, s32, s32, f32, s32, s32); extern int func_803114B0(void); -extern void gczoombox_open(gczoombox_t *); -extern void gczoombox_minimize(gczoombox_t *); -extern void gczoombox_close(gczoombox_t *); -extern void gczoombox_update(gczoombox_t *); -extern bool func_803188B4(gczoombox_t *); extern char *dialogBin_get(enum asset_e text_id); s8 D_8036C4D0[] = {1, 0x1E, 0x14, 0xF, 0xB, 8, 6, 4, 3, 2, -1, -1}; @@ -25,7 +20,7 @@ struct { s8 string_cmd[2]; //current_cmd u8 string_index[2]; //current_string_index struct15s unk11A[2]; - gczoombox_t *zoombox[2]; + GcZoombox *zoombox[2]; s16 unk124[2]; union{ struct { @@ -316,7 +311,7 @@ void gcdialog_setState(s32 next_state){ } -void func_8030F754(enum talk_pic_e portrait_id, s32 arg1){ +void func_8030F754(GcZoomboxSprite portrait_id, s32 arg1){ s32 temp_a0; s32 temp_v0; @@ -456,7 +451,7 @@ void gcdialog_update(void) { for(spA8 = g_Dialog.string_index[g_Dialog.u8.active_zoombox]; CMD2(spA8)->cmd < -4; spA8++); if (CMD2(spA8)->cmd >= 0) { - func_803189C4(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], CMD2(spA8)->cmd + 0xC); + gczoombox_loadSprite(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], CMD2(spA8)->cmd + 0xC); } if (g_Dialog.string_index[g_Dialog.u8.active_zoombox]) { gczoombox_minimize(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); @@ -484,7 +479,7 @@ void gcdialog_update(void) { break; default: - if (!func_80316ED4(CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str)) { + if (!gczoombox_strlen(CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str)) { g_Dialog.string_index[g_Dialog.u8.active_zoombox]++; } else { if (CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox] + 1)->cmd == -8) { @@ -546,7 +541,7 @@ void gcdialog_update(void) { } } - if (func_803189C4(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], g_Dialog.string_cmd[g_Dialog.u8.active_zoombox] + 12)) { + if (gczoombox_loadSprite(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], g_Dialog.string_cmd[g_Dialog.u8.active_zoombox] + 12)) { gczoombox_minimize(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); g_Dialog.unk128_6 = TRUE; } @@ -561,7 +556,7 @@ void gcdialog_update(void) { sp4C[spA8 - g_Dialog.string_index[g_Dialog.u8.active_zoombox]] = CMD(spA8)->str; } - func_80318284(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], spA8 - g_Dialog.string_index[g_Dialog.u8.active_zoombox], sp4C); + gczoombox_setStrings(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], spA8 - g_Dialog.string_index[g_Dialog.u8.active_zoombox], sp4C); g_Dialog.string_index[g_Dialog.u8.active_zoombox] = spA8; } else { func_803183A4(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], g_Dialog.output); @@ -1012,12 +1007,12 @@ void gcdialog_defrag(void){ s32 i; for(i = 0; i< 2; i++){ - func_80318C0C(g_Dialog.zoombox[i]); + gczoombox_defrag(g_Dialog.zoombox[i]); if(g_Dialog.string_list[i]){ g_Dialog.string_list[i] = (struct13s *)defrag(g_Dialog.string_list[i]); } if(g_Dialog.zoombox[i] != NULL){ - g_Dialog.zoombox[i] = (gczoombox_t *)defrag(g_Dialog.zoombox[i]); + g_Dialog.zoombox[i] = (GcZoombox *)defrag(g_Dialog.zoombox[i]); } } } diff --git a/src/core2/gc/parade.c b/src/core2/gc/parade.c index b3fccaf3..7200e258 100644 --- a/src/core2/gc/parade.c +++ b/src/core2/gc/parade.c @@ -2,7 +2,9 @@ #include "functions.h" #include "variables.h" -extern void func_8028A8D0(void); +#include "../snackerctl.h" + + extern void func_8028F918(s32); extern void func_80311714(int); extern void func_803204E4(s32, s32); @@ -285,7 +287,7 @@ void gcparade_update(void) { return; } if (func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE) != 0) { - func_8028A8D0(); + snackerctl_update(); switch (D_803830F0.state) { case PARADE_STATE_3_WARP: if (D_803830F0.unk5 == 0) { @@ -315,7 +317,7 @@ void gcparade_update(void) { break; case PARADE_STATE_5_WAIT_ON_NAME: //name on screen (wait) gcparade_print(D_803830F0.indx); - return; + break; case PARADE_STATE_6_NAME_DISAPPEAR:// name scroll up off screen gcparade_print(D_803830F0.indx); D_803830F0.scroll_frame--; diff --git a/src/core2/gc/pauseMenu.c b/src/core2/gc/pauseMenu.c index 3f732f71..5c5445bf 100644 --- a/src/core2/gc/pauseMenu.c +++ b/src/core2/gc/pauseMenu.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "zoombox.h" + #ifndef MIN #define MIN(s,t) (((s) < t)?(s):(t)) #endif @@ -20,10 +22,6 @@ typedef struct struct_1A_s{ u8 unkF; }struct1As; -extern void func_803160A8(gczoombox_t *); -extern void gczoombox_close(gczoombox_t *); -extern void gczoombox_minimize(gczoombox_t *); -extern void gczoombox_maximize(gczoombox_t *); extern void func_802C5994(void); extern void func_802E412C(s32, s32); void func_803204E4(s32, s32); @@ -32,18 +30,14 @@ void mlMtxApply(Mtx*); void func_80310D2C(void); s32 level_get(void); -void gczoombox_update(gczoombox_t *); void func_8024E6E0(s32, void *); void func_8024E60C(s32, void *); void func_8024E71C(s32, void *); s32 getGameMode(void); -void gczoombox_highlight(gczoombox_t *, int); void func_802DC5B8(void); void func_802DC560(s32, s32); s32 func_8024E67C(s32 controller_index); -bool func_803188B4(gczoombox_t*); -bool func_803183A4(gczoombox_t*, char *); bool fileProgressFlag_get(enum file_progress_e); enum map_e map_get(void); bool func_802FD2D4(void); @@ -54,10 +48,6 @@ extern void func_802DC528(s32,s32); extern void func_802F5060(enum asset_e); extern void func_802F5188(void); extern void func_802FACA4(enum item_e); -extern void func_803184C8(gczoombox_t *, f32, s32, s32, f32, s32, s32); -extern void func_80318640(gczoombox_t *, s32, f32, f32, s32); -extern void func_80318734(gczoombox_t *, f32); -extern void func_80318964(gczoombox_t *); extern void func_8033BD20(void *); enum gcpausemenu_state_e { @@ -69,17 +59,17 @@ enum gcpausemenu_state_e { /* .data */ struct1As D_8036C4E0[4] = { - {0.0f, 0.0f, "RETURN TO GAME", 55, TALK_PIC_4_BANJO_1, 0}, - {0.3f, 0.0f, "EXIT TO WITCH'S LAIR", -100, TALK_PIC_4_BANJO_1, 0}, - {0.1f, 0.0f, "VIEW TOTALS", 90, TALK_PIC_6_JIGGY_1, 0}, - {0.2f, 0.0f, "SAVE AND QUIT", 125, TALK_PIC_7_TOOTY_1, 0}, + {0.0f, 0.0f, "RETURN TO GAME", 55, ZOOMBOX_SPRITE_4_BANJO_1, 0}, + {0.3f, 0.0f, "EXIT TO WITCH'S LAIR", -100, ZOOMBOX_SPRITE_4_BANJO_1, 0}, + {0.1f, 0.0f, "VIEW TOTALS", 90, ZOOMBOX_SPRITE_6_JIGGY_1, 0}, + {0.2f, 0.0f, "SAVE AND QUIT", 125, ZOOMBOX_SPRITE_7_TOOTY_1, 0}, }; struct1As D_8036C520[4] = { - {0.0f, 0.0f, "cc999 / 999cc", 30, TALK_PIC_8_MUSIC_NOTE_1, 0}, - {0.1f, 0.0f, "cc999 / 999cc", 66, TALK_PIC_9_JIGGY_2, 0}, - {0.2f, 0.0f, "cc999 / 999cc", 102, TALK_PIC_A_EXTRA_HEALTH_MAX, 0}, - {0.3f, 0.0f, "cc999 : 999cc", 138, TALK_PIC_B_CLOCK, 0}, + {0.0f, 0.0f, "cc999 / 999cc", 30, ZOOMBOX_SPRITE_8_MUSIC_NOTE_1, 0}, + {0.1f, 0.0f, "cc999 / 999cc", 66, ZOOMBOX_SPRITE_9_JIGGY_2, 0}, + {0.2f, 0.0f, "cc999 / 999cc", 102, ZOOMBOX_SPRITE_A_EXTRA_HEALTH_MAX, 0}, + {0.3f, 0.0f, "cc999 : 999cc", 138, ZOOMBOX_SPRITE_B_CLOCK, 0}, }; struct1Bs D_8036C560[] = { @@ -153,7 +143,7 @@ struct{ s8 joystick_frame; u8 joystick_frame_count; f32 unkC; - gczoombox_t *zoombox[4]; + GcZoombox *zoombox[4]; f32 unk20; BKSprite * joystick_sprite; f32 unk28; @@ -190,8 +180,8 @@ void gcpausemenu_defrag(void){ s32 i; for(i =0; i< 4; i++){ if(D_80383010.zoombox[i]){ - func_80318C0C(D_80383010.zoombox[i]); - D_80383010.zoombox[i] = (gczoombox_t *)defrag(D_80383010.zoombox[i]); + gczoombox_defrag(D_80383010.zoombox[i]); + D_80383010.zoombox[i] = (GcZoombox *)defrag(D_80383010.zoombox[i]); } } } @@ -561,7 +551,7 @@ void gcPauseMenu_setState(enum gcpausemenu_state_e next_state){ else{ gczoombox_highlight(D_80383010.zoombox[i], 1); } - if(func_80318604(D_80383010.zoombox[i])){ + if(gczoombox_is_highlighted(D_80383010.zoombox[i])){ gczoombox_maximize(D_80383010.zoombox[i]); func_803183A4( D_80383010.zoombox[i], D_8036C520[i].str); } @@ -741,7 +731,7 @@ s32 gcpausemenu_80312D78(struct1As *arg0, s32 arg1) { gczoombox_open(D_80383010.zoombox[var_s2]); gczoombox_maximize(D_80383010.zoombox[var_s2]); } - if (!func_80318604(D_80383010.zoombox[var_s2])) { + if (!gczoombox_is_highlighted(D_80383010.zoombox[var_s2])) { func_80318498(D_80383010.zoombox[var_s2]); func_8031843C(D_80383010.zoombox[var_s2]); } @@ -887,7 +877,7 @@ s32 gcPauseMenu_update(void){ func_8024E6E0(0, sp50); func_80310D2C(); for(i = 0; i < 4; i++){ - gczoombox_update(D_80383010.zoombox[i]);//gczoombox_update; + gczoombox_update(D_80383010.zoombox[i]); } diff --git a/src/core2/gc/zoombox.c b/src/core2/gc/zoombox.c index 7aa7cc33..1c96903e 100644 --- a/src/core2/gc/zoombox.c +++ b/src/core2/gc/zoombox.c @@ -1,7 +1,7 @@ #include #include "functions.h" #include "variables.h" -#include "gc/gczoombox.h" +#include "zoombox.h" extern f32 func_8024DE1C(f32, f32, f32[3], f32[3]); void func_80252330(f32, f32, f32); @@ -429,18 +429,8 @@ void func_8030DA44(u8); void func_80338338(s32, s32, s32); void func_803382FC(u8); -s32 func_80316ED4(u8*); -void func_8031843C(gczoombox_t *this); -void func_80318478(gczoombox_t *this); -void func_80318488(gczoombox_t *this); -void func_80318498(gczoombox_t *this); -void gczoombox_resolve_minimize(gczoombox_t *this); -void func_803184C8(gczoombox_t *, f32, s32, s32, f32, bool, bool); -void func_80318760(gczoombox_t *this, s32 arg1); - - /* .code */ -void func_80315200(gczoombox_t *this){ +void func_80315200(GcZoombox *this){ s32 s1 = 0; if(-1.0f == this->unk110[0]){ if(func_8025AD7C(this->unk108[0])){ @@ -459,14 +449,14 @@ void func_80315200(gczoombox_t *this){ } } -void func_803152C4(gczoombox_t *this){ +void func_803152C4(GcZoombox *this){ if(this->unk100 != NULL){ func_8033BD20(&this->unk100); this->unk100 = NULL; } } -void func_80315300(gczoombox_t *this){ +void func_80315300(GcZoombox *this){ if(this->model != NULL){ func_8033BD20(&this->model); this->model = NULL; @@ -482,7 +472,7 @@ void func_80315300(gczoombox_t *this){ func_803152C4(this); } -void gczoombox_free(gczoombox_t *this){ +void gczoombox_free(GcZoombox *this){ if(this){ func_80315200(this); func_80315300(this); @@ -505,7 +495,7 @@ void _gczoombox_memClear(u8 *arg0, s32 size){ } } -void func_80315484(gczoombox_t *this){ +void func_80315484(GcZoombox *this){ if( this->unk1A4_31 && !this->unk1A4_26){ this->unk16C = 0.5 * ((this->unk1A4_19) ? 0xf : 0xc) * this->unk198 + this->unk166; } @@ -515,7 +505,7 @@ void func_80315484(gczoombox_t *this){ } } -void func_80315524(gczoombox_t *this){ +void func_80315524(GcZoombox *this){ if(this->unk1A4_26 || this->unk1A4_31){ this->state = 3; this->unk181 = this->unk182; @@ -527,7 +517,7 @@ void func_80315524(gczoombox_t *this){ this->unk1A4_23 = 0; } -void func_8031556C(gczoombox_t *this){ +void func_8031556C(GcZoombox *this){ this->state = 5; animctrl_setPlaybackType(this->anim_ctrl, ANIMCTRL_ONCE); animctrl_setDirection(this->anim_ctrl, 1); @@ -536,7 +526,7 @@ void func_8031556C(gczoombox_t *this){ func_80318498(this); } -void func_803155C8(gczoombox_t *this){ +void func_803155C8(GcZoombox *this){ int i; this->state = 6; @@ -597,13 +587,13 @@ static int __get_str_print_len(u8 *arg0, s32 len){ static s32 _gczoombox_findLineBreak(char *string, s32 line_length){ s32 i; - for(i = func_80316ED4(string); (line_length < (__get_str_print_len(string, i)) || (' ' != string[i] )); i--); + for(i = gczoombox_strlen(string); (line_length < (__get_str_print_len(string, i)) || (' ' != string[i] )); i--); return i; } -void func_8031594C(gczoombox_t * this, u8 *str, s32 arg2, s32 arg3){ +void func_8031594C(GcZoombox * this, u8 *str, s32 arg2, s32 arg3){ s32 s0; - gczoombox_t *s4; + GcZoombox *s4; s32 s5; s32 s3; s32 s2; @@ -613,7 +603,7 @@ void func_8031594C(gczoombox_t * this, u8 *str, s32 arg2, s32 arg3){ s0 = arg2; s4 = this; s1 = 0; - f22 = (this->portrait_id == TALK_PIC_5F_TOOTY_4) ? 0.4 : 0.8; + f22 = (this->portrait_id == ZOOMBOX_SPRITE_5F_TOOTY_4) ? 0.4 : 0.8; if(getGameMode() == GAME_MODE_9_BANJO_AND_KAZOOIE){ sfx_rand_sync_to_rand(); @@ -673,27 +663,27 @@ void func_8031594C(gczoombox_t * this, u8 *str, s32 arg2, s32 arg3){ } } -u8 func_80315BC0(gczoombox_t *this, enum sfx_e sfx_id, s32 arg2){ +u8 func_80315BC0(GcZoombox *this, enum sfx_e sfx_id, s32 arg2){ u8 sp1F = func_8030ED2C(sfx_id, arg2) & 0xff; func_8030DD90(sp1F, 0); - if(this->portrait_id == TALK_PIC_66_LOCKUP){ + if(this->portrait_id == ZOOMBOX_SPRITE_66_LOCKUP){ func_8030DCCC(sp1F, 0x40); } return sp1F; } -void func_80315C1C(gczoombox_t *this){ +void func_80315C1C(GcZoombox *this){ int i; func_80315200(this); func_80315300(this); - for(i = 0 ; i < 8; i++){ + for(i = 0 ; i < ZOOMBOX_MAX_STRING_COUNT; i++){ this->raw_str[i] = NULL; } this->state = 0; - this->unk137 = this->unk1A4_20 = 0; + this->str_cnt = this->unk1A4_20 = 0; } -void func_80315C90(gczoombox_t *this, s32 arg1) { +void func_80315C90(GcZoombox *this, s32 arg1) { s32 phi_s1; s32 current_sfx; f32 phi_f12; @@ -707,7 +697,7 @@ void func_80315C90(gczoombox_t *this, s32 arg1) { current_sfx = 0U; if (this != NULL && this->sfx_count != 0 && this->unk1A4_11) { - if (this->portrait_id == TALK_PIC_15_CLANKER) { + if (this->portrait_id == ZOOMBOX_SPRITE_15_CLANKER) { for(phi_s1 = 0; phi_s1 < 5; phi_s1++){ if(func_8030E3FC(this->unk108[phi_s1])) return; @@ -772,7 +762,7 @@ void func_80315C90(gczoombox_t *this, s32 arg1) { } } -void func_803160A8(gczoombox_t *this) { +void func_803160A8(GcZoombox *this) { f32 temp_f14; f32 phi_f14; s32 phi_a0; @@ -804,7 +794,7 @@ void func_803160A8(gczoombox_t *this) { } } -void func_803162B4(gczoombox_t *this){ +void func_803162B4(GcZoombox *this){ func_802F7B90(this->unk168, this->unk168, this->unk168); if(this->unk1A4_30){ if(this->unk1A4_17){ @@ -826,7 +816,7 @@ void func_803162B4(gczoombox_t *this){ func_802F7B90(0xff, 0xff, 0xff); } -void func_803163A8(gczoombox_t *this, Gfx **gfx, Mtx **mtx) { +void func_803163A8(GcZoombox *this, Gfx **gfx, Mtx **mtx) { f32 sp5C[3]; f32 sp50[3]; f32 sp44[3]; @@ -848,11 +838,11 @@ void func_803163A8(gczoombox_t *this, Gfx **gfx, Mtx **mtx) { modelRender_draw(gfx, mtx, sp50, sp5C, this->unk198 * sp34, sp38, this->model); } -void func_803164B0(gczoombox_t *this, Gfx **gfx, Mtx **mtx, s32 arg3, s32 arg4, s32 arg5, f32 arg6) { +void func_803164B0(GcZoombox *this, Gfx **gfx, Mtx **mtx, s32 arg3, s32 arg4, s32 arg5, f32 arg6) { f32 sp2C[3]; f32 temp_f12; - if (this->portrait_id == TALK_PIC_46_TUMBLAR) { + if (this->portrait_id == ZOOMBOX_SPRITE_46_TUMBLAR) { arg6 = 0.75f; } func_80338338(0xFF, 0xFF, 0xFF); @@ -880,7 +870,7 @@ void func_803164B0(gczoombox_t *this, Gfx **gfx, Mtx **mtx, s32 arg3, s32 arg4, func_8024C904(gfx, mtx); } -void func_80316764(gczoombox_t *this, s32 arg1) { +void func_80316764(GcZoombox *this, s32 arg1) { s32 sp38[6]; f32 phi_f0; s32 sp2C[2]; @@ -986,7 +976,7 @@ void func_80316764(gczoombox_t *this, s32 arg1) { } -void gczoombox_draw(gczoombox_t *this, Gfx **gdl, Mtx ** mptr, void *vptr){ +void gczoombox_draw(GcZoombox *this, Gfx **gdl, Mtx ** mptr, void *vptr){ if(!this) return; @@ -1015,13 +1005,13 @@ void gczoombox_draw(gczoombox_t *this, Gfx **gdl, Mtx ** mptr, void *vptr){ func_803164B0(this, gdl, mptr, this->unk178, this->unk179, this->unk104, this->unk17C); }//L80316D40 - if( !this->unk1A4_18 && !(this->unk168 < 0x81) + if( !this->highlighted && !(this->unk168 < 0x81) ){ this->unk168 -= 0xC; this->unk168 = !(this->unk168 < 0x81) ? this->unk168 : 0x80; } - if(this->unk1A4_18 && this->unk168 < 0xff){ + if(this->highlighted && this->unk168 < 0xff){ this->unk168 += 0xC; this->unk168 = MIN(this->unk168, 0xff); } @@ -1033,7 +1023,7 @@ void gczoombox_draw(gczoombox_t *this, Gfx **gdl, Mtx ** mptr, void *vptr){ } -void func_80316E08(gczoombox_t *this) { +void func_80316E08(GcZoombox *this) { this->state = 8; func_80318478(this); if (this->unk1A4_24) { @@ -1044,12 +1034,12 @@ void func_80316E08(gczoombox_t *this) { } } -void func_80316E60(gczoombox_t *this){ +void func_80316E60(GcZoombox *this){ this->state = 9; func_80318488(this); } -void func_80316E84(gczoombox_t *this, s32 arg1){ +void func_80316E84(GcZoombox *this, s32 arg1){ if(this->unk134 != arg1){ if(this->unk130 != NULL){ this->unk130(this->portrait_id, arg1); @@ -1058,12 +1048,11 @@ void func_80316E84(gczoombox_t *this, s32 arg1){ } } -//gczoombox_strLen -s32 func_80316ED4(u8 *arg0){ +s32 gczoombox_strlen(u8 *arg0){ return strlen(arg0); } -void gczoombox_update(gczoombox_t *this){ +void gczoombox_update(GcZoombox *this){ s32 sp58[6]; s32 sp4C[3]; s32 sp48; @@ -1090,11 +1079,11 @@ void gczoombox_update(gczoombox_t *this){ this->unk160 += this->unk15C + 1; } else{ - this->unk160 = this->raw_str[this->unk138]; + this->unk160 = this->raw_str[this->current_str_index]; this->unk1A4_19 = func_8031B604(this->unk160); this->unk166 = ((this->unk1A4_19) ? 0x11 : 0x14) * this->unk198 + this->unk164; } - this->unk15C = func_80316ED4(this->unk160); + this->unk15C = gczoombox_strlen(this->unk160); if(this->unk15C >= 24){ this->unk15C = _gczoombox_findLineBreak(this->unk160, 24); this->unk15D = 1; @@ -1105,10 +1094,10 @@ void gczoombox_update(gczoombox_t *this){ func_803153A8(this->unk160, this->unk60, 0, this->unk15C); this->unk60[this->unk15C] = 0; if(!this->unk15D){ - this->unk138++; + this->current_str_index++; } - if(this->unk15D || this->unk138 < this->unk137){ + if(this->unk15D || this->current_str_index < this->str_cnt){ this->unk1A4_25 = 0; this->unk1A4_31 = 0; } @@ -1347,8 +1336,7 @@ void gczoombox_update(gczoombox_t *this){ } } -//_gczoombox_loadSprite -void func_80317C90(gczoombox_t *this, s32 portrait_id){ +void __gczoombox_load_sprite(GcZoombox *this, GcZoomboxSprite portrait_id){ this->unkF8 = func_8033B6C4(D_8036C6C0[portrait_id].spite_id, &this->unkFC); this->frame_count = this->unkF8->frameCnt; func_803382E4(-1); @@ -1356,8 +1344,7 @@ void func_80317C90(gczoombox_t *this, s32 portrait_id){ func_80338308(func_802510A0(this->unkF8), func_802510A8(this->unkF8)); } -//_gczoombox_loadsfx -void func_80317D10(gczoombox_t *this, enum talk_pic_e portrait_id){ +void __gczoombox_load_sfx(GcZoombox *this, GcZoomboxSprite portrait_id){ s32 i; this->sfx_count = 0; @@ -1387,19 +1374,19 @@ void func_80317D10(gczoombox_t *this, enum talk_pic_e portrait_id){ } } -gczoombox_t *gczoombox_new(s32 arg0, enum talk_pic_e portrait_id, s32 arg2, s32 arg3, void (*arg4)(s32, s32)){ - gczoombox_t *this; +GcZoombox *gczoombox_new(s32 arg0, GcZoomboxSprite portrait_id, s32 arg2, s32 arg3, void (*arg4)(s32, s32)){ + GcZoombox *this; s32 i; s32 temp_v1; - this = (gczoombox_t *)malloc(sizeof(gczoombox_t)); + this = (GcZoombox *)malloc(sizeof(GcZoombox)); this->unk130 = arg4; this->state = 0xB; this->portrait_id = portrait_id; - this->unk134 = this->unk137 = this->unk138 = 0; + this->unk134 = this->str_cnt = this->current_str_index = 0; this->unk139 = arg2; this->unk13A = 0x20; - for(i = 0; i < 8; i++){ + for(i = 0; i < ZOOMBOX_MAX_STRING_COUNT; i++){ this->raw_str[i] = NULL; } this->unk15E = 0; @@ -1451,10 +1438,10 @@ gczoombox_t *gczoombox_new(s32 arg0, enum talk_pic_e portrait_id, s32 arg2, s32 this->unk1A4_14 =\ this->unk1A4_13 = 0; - this->unk1A4_11 = this->unk1A4_18 = 1; + this->unk1A4_11 = this->highlighted = 1; this->model = assetcache_get(0x89d); - func_80317C90(this, portrait_id); + __gczoombox_load_sprite(this, portrait_id); this->anim_ctrl = animctrl_new(0); animctrl_reset(this->anim_ctrl); animctrl_setIndex(this->anim_ctrl, ASSET_138_ANIM_ZOOMBOX); @@ -1468,7 +1455,7 @@ gczoombox_t *gczoombox_new(s32 arg0, enum talk_pic_e portrait_id, s32 arg2, s32 this->unk17C = 1.0f; this->unk178 = this->unk179 = 0; - func_80317D10(this, portrait_id); + __gczoombox_load_sfx(this, portrait_id); func_80318760(this, 18000); _gczoombox_memClear( this->unk0, 0x30); _gczoombox_memClear( this->unk30, 0x30); @@ -1478,19 +1465,25 @@ gczoombox_t *gczoombox_new(s32 arg0, enum talk_pic_e portrait_id, s32 arg2, s32 return this; } -bool func_80318284(gczoombox_t *this, s32 str_cnt, char **str_ptrs) { +/** + * @brief Manually sets the strings gczoombox displays. Assumed that + * `str_cnt <= ZOOMBOX_MAX_STRING_COUNT`. Returns 1 on success, 0 on + * failure + */ +bool gczoombox_setStrings(GcZoombox *this, s32 str_cnt, char **str_ptrs) { + // assert!(str_cnt <= ZOOMBOX_MAX_STRING_COUNT) s32 phi_v0; if ((this->unk13A & 4) || (str_ptrs == NULL) || (str_cnt == 0)) { return FALSE; } - this->unk138 = 0; - this->unk137 = str_cnt; + this->current_str_index = 0; + this->str_cnt = str_cnt; for(phi_v0 = 0; phi_v0 < str_cnt; phi_v0++){ this->raw_str[phi_v0] = str_ptrs[phi_v0]; } - for(phi_v0 = str_cnt; phi_v0 < 8; phi_v0++){ + for(phi_v0 = str_cnt; phi_v0 < ZOOMBOX_MAX_STRING_COUNT; phi_v0++){ this->raw_str[phi_v0] = NULL; } @@ -1498,70 +1491,70 @@ bool func_80318284(gczoombox_t *this, s32 str_cnt, char **str_ptrs) { return 1; } -bool func_803183A4(gczoombox_t *this, char *arg1) { +bool func_803183A4(GcZoombox *this, char *arg1) { char *sp1C; if ((this->unk13A & 4) || (arg1 == NULL)) { return FALSE; } sp1C = arg1; - return func_80318284(this, 1, &sp1C); + return gczoombox_setStrings(this, 1, &sp1C); } -void gczoombox_open(gczoombox_t *this){ +void gczoombox_open(GcZoombox *this){ this->unk13A |= 0x1; } -void gczoombox_close(gczoombox_t *this){ +void gczoombox_close(GcZoombox *this){ this->unk13A |= 0x10; } -void gczoombox_maximize(gczoombox_t *this){ +void gczoombox_maximize(GcZoombox *this){ this->unk13A |= 0x2; } -void gczoombox_minimize(gczoombox_t *this){ +void gczoombox_minimize(GcZoombox *this){ this->unk13A |= 0x8; } -void func_8031842C(gczoombox_t *this){ +void func_8031842C(GcZoombox *this){ this->unk13A |= 0x20; } -void func_8031843C(gczoombox_t *this){ +void func_8031843C(GcZoombox *this){ void *temp_v1; void *phi_v1; s32 phi_v0; - for(phi_v0 = 0; phi_v0 < 8; phi_v0++){ + for(phi_v0 = 0; phi_v0 < ZOOMBOX_MAX_STRING_COUNT; phi_v0++){ this->raw_str[phi_v0] = NULL; }; - this->unk137 = 0; + this->str_cnt = 0; this->unk13A &= (u8)~(0x4); } -void func_80318478(gczoombox_t *this){ +void func_80318478(GcZoombox *this){ this->unk13A &= (u8)~(0x1); } -void func_80318488(gczoombox_t *this){ +void func_80318488(GcZoombox *this){ this->unk13A &= (u8)~(0x10); } -void func_80318498(gczoombox_t *this){ +void func_80318498(GcZoombox *this){ this->unk13A &= (u8)~(0x2); } -void gczoombox_resolve_minimize(gczoombox_t *this){ +void gczoombox_resolve_minimize(GcZoombox *this){ this->unk13A &= (u8)~(0x8); } -void func_803184B8(gczoombox_t *this){ +void func_803184B8(GcZoombox *this){ this->unk13A &= (u8)~(0x20); } -void func_803184C8(gczoombox_t *this, f32 arg1, s32 arg2, s32 arg3, f32 arg4, bool arg5, bool arg6) { +void func_803184C8(GcZoombox *this, f32 arg1, s32 arg2, s32 arg3, f32 arg4, bool arg5, bool arg6) { if (this != NULL) { this->unk182 = arg2; @@ -1575,7 +1568,7 @@ void func_803184C8(gczoombox_t *this, f32 arg1, s32 arg2, s32 arg3, f32 arg4, bo } } -bool func_8031857C(gczoombox_t *this, u8 *str){ +bool func_8031857C(GcZoombox *this, u8 *str){ if(func_803183A4(this, str)){ gczoombox_open(this); gczoombox_maximize(this); @@ -1586,26 +1579,25 @@ bool func_8031857C(gczoombox_t *this, u8 *str){ return FALSE; } -void gczoombox_highlight(gczoombox_t *this, bool arg1){ +void gczoombox_highlight(GcZoombox *this, bool arg1){ if(arg1) - this->unk1A4_18 = 1; + this->highlighted = 1; else - this->unk1A4_18 = 0; + this->highlighted = 0; } -//gczoombox_isHiglighted -bool func_80318604(gczoombox_t *this){ - return this->unk1A4_18; +bool gczoombox_is_highlighted(GcZoombox *this){ + return this->highlighted; } -void func_80318614(gczoombox_t *this, int arg1){ +void func_80318614(GcZoombox *this, int arg1){ if(arg1) this->unk1A4_11 = 1; else this->unk1A4_11 = 0; } -void func_80318640(gczoombox_t *this, s32 arg1, f32 arg2, f32 arg3, s32 arg4) { +void func_80318640(GcZoombox *this, s32 arg1, f32 arg2, f32 arg3, s32 arg4) { s32 phi_v0; if (this != NULL) { @@ -1626,21 +1618,21 @@ void func_80318640(gczoombox_t *this, s32 arg1, f32 arg2, f32 arg3, s32 arg4) { } -void func_80318734(gczoombox_t *this, f32 arg1){ +void func_80318734(GcZoombox *this, f32 arg1){ if(this) this->unk1A0 = 1.0/arg1; } -void func_80318760(gczoombox_t *this, s32 arg1){ +void func_80318760(GcZoombox *this, s32 arg1){ if(this) this->unk12E = arg1; } -void func_80318774(gczoombox_t *this){ +void func_80318774(GcZoombox *this){ this->unk13A = 0; } -bool func_8031877C(gczoombox_t *this){ +bool func_8031877C(GcZoombox *this){ if( this == NULL || this->state == 0 || this->state == 0xb || this->state == 0x9 || this->state == 0x6 || this->state == 0x7 ){ @@ -1663,7 +1655,7 @@ bool func_8031877C(gczoombox_t *this){ return TRUE; } -bool func_803188B4(gczoombox_t *this) { +bool func_803188B4(GcZoombox *this) { if ((this == NULL) || (this->state == 0) || (this->state == 7) || (this->state == 9)) { return FALSE; @@ -1683,7 +1675,7 @@ bool func_803188B4(gczoombox_t *this) { } -bool func_80318964(gczoombox_t *this) { +bool func_80318964(GcZoombox *this) { if (this == NULL || this->state == 0 || this->state == 7 || this->state == 9) { return FALSE; } @@ -1693,7 +1685,7 @@ bool func_80318964(gczoombox_t *this) { return TRUE; } -bool func_803189C4(gczoombox_t *this, enum talk_pic_e arg1){ +bool gczoombox_loadSprite(GcZoombox *this, GcZoomboxSprite arg1){ if( this == NULL || arg1 == this->portrait_id || ( this->state != 6 @@ -1710,11 +1702,11 @@ bool func_803189C4(gczoombox_t *this, enum talk_pic_e arg1){ this->unkF8 = NULL; } func_803152C4(this); - func_80317C90(this, arg1); + __gczoombox_load_sprite(this, arg1); this->unk176 = D_8036C6C0[arg1].unk2; this->unk177 = D_8036C6C0[arg1].unk3; func_80315200(this); - func_80317D10(this, arg1); + __gczoombox_load_sfx(this, arg1); this->portrait_id = arg1; } else{//L80318AAC @@ -1730,11 +1722,11 @@ bool func_803189C4(gczoombox_t *this, enum talk_pic_e arg1){ } this->unk178 = this->unk176; this->unk179 = this->unk177; - func_80317C90(this, arg1); + __gczoombox_load_sprite(this, arg1); this->unk176 = D_8036C6C0[arg1].unk2; this->unk177 = D_8036C6C0[arg1].unk3; func_80315200(this); - func_80317D10(this, arg1); + __gczoombox_load_sfx(this, arg1); this->unk1A4_14 = 1; this->portrait_id = arg1; this->unk1A4_13 = 1; @@ -1743,7 +1735,7 @@ bool func_803189C4(gczoombox_t *this, enum talk_pic_e arg1){ return TRUE; } -void func_80318B7C(gczoombox_t *this, s32 arg1) { +void func_80318B7C(GcZoombox *this, s32 arg1) { s32 phi_v0; if (this != NULL) { @@ -1755,11 +1747,11 @@ void func_80318B7C(gczoombox_t *this, s32 arg1) { } } -bool func_80318BEC(gczoombox_t *this){ +bool func_80318BEC(GcZoombox *this){ return this != NULL && !this->state; } -void func_80318C0C(gczoombox_t *this) { +void gczoombox_defrag(GcZoombox *this) { AnimCtrl *temp_a0; if (this != NULL) { @@ -1769,7 +1761,7 @@ void func_80318C0C(gczoombox_t *this) { } } -void func_80318C48(gczoombox_t *this, s32 arg1) { +void func_80318C48(GcZoombox *this, s32 arg1) { if (this != NULL) { if (this->unk1A4_30) { if (arg1 != 0) { diff --git a/src/core2/gc/zoombox.h b/src/core2/gc/zoombox.h new file mode 100644 index 00000000..0a1d21a3 --- /dev/null +++ b/src/core2/gc/zoombox.h @@ -0,0 +1,252 @@ +#ifndef __BANJO_KAZOOIE_CORE2_GC_ZOOMBOX_H__ +#define __BANJO_KAZOOIE_CORE2_GC_ZOOMBOX_H__ + +#include +#include "structs.h" + +#define ZOOMBOX_MAX_STRING_COUNT 8 + +typedef enum talk_pic_e { + ZOOMBOX_SPRITE_0_GRUNTILDA_1, + ZOOMBOX_SPRITE_1_VILE_1, + ZOOMBOX_SPRITE_2_VILE_2, + ZOOMBOX_SPRITE_3_VILE_3, + ZOOMBOX_SPRITE_4_BANJO_1, + ZOOMBOX_SPRITE_5_GRUNTILDA_2, + ZOOMBOX_SPRITE_6_JIGGY_1, + ZOOMBOX_SPRITE_7_TOOTY_1, + ZOOMBOX_SPRITE_8_MUSIC_NOTE_1, + ZOOMBOX_SPRITE_9_JIGGY_2, + ZOOMBOX_SPRITE_A_EXTRA_HEALTH_MAX, + ZOOMBOX_SPRITE_B_CLOCK, + ZOOMBOX_SPRITE_C_BANJO_2, + ZOOMBOX_SPRITE_D_KAZOOIE_1, + ZOOMBOX_SPRITE_E_KAZOOIE_2, + ZOOMBOX_SPRITE_F_BOTTLES, + ZOOMBOX_SPRITE_10_MUMBO_1, + ZOOMBOX_SPRITE_11_CHIMPY, + ZOOMBOX_SPRITE_12_CONGA, + ZOOMBOX_SPRITE_13_BLUBBER, + ZOOMBOX_SPRITE_14_NIPPER, + ZOOMBOX_SPRITE_15_CLANKER, + ZOOMBOX_SPRITE_16_SNIPPET, + ZOOMBOX_SPRITE_17_VILE_4, + ZOOMBOX_SPRITE_18_TIPTUP, + ZOOMBOX_SPRITE_19_TANKTUP, + ZOOMBOX_SPRITE_1A_FLIBBIT, + ZOOMBOX_SPRITE_1B_TRUNKER, + ZOOMBOX_SPRITE_1C_RUBEE, + ZOOMBOX_SPRITE_1D_GOBI, + ZOOMBOX_SPRITE_1E_GRABBA, + ZOOMBOX_SPRITE_1F_TEEHEE, + ZOOMBOX_SPRITE_20_JINJO_YELLOW, + ZOOMBOX_SPRITE_21_JINJO_GREEN, + ZOOMBOX_SPRITE_22_JINJO_BLUE, + ZOOMBOX_SPRITE_23_JINJO_PINK, + ZOOMBOX_SPRITE_24_JINJO_ORANGE, + ZOOMBOX_SPRITE_25_MUSIC_NOTE_2, + ZOOMBOX_SPRITE_26_MUMBO_TOKEN, + ZOOMBOX_SPRITE_27_BLUE_EGG, + ZOOMBOX_SPRITE_28_RED_FEATHER, + ZOOMBOX_SPRITE_29_GOLD_FEATHER, + ZOOMBOX_SPRITE_2A_ORANGE, + ZOOMBOX_SPRITE_2B_GOLD_BULLION, + ZOOMBOX_SPRITE_2C_HONEYCOMB, + ZOOMBOX_SPRITE_2D_EXTRA_HEALTH_MAX, + ZOOMBOX_SPRITE_2E_EXTRA_LIFE, + ZOOMBOX_SPRITE_2F_JIGGY_3, + ZOOMBOX_SPRITE_30_EXTRA_HONEYCOMB, + ZOOMBOX_SPRITE_31_CATERPILLAR, + ZOOMBOX_SPRITE_32_WADING_BOOTS, + ZOOMBOX_SPRITE_33_PIRANHA, + ZOOMBOX_SPRITE_34_TERMITE, + ZOOMBOX_SPRITE_35_JUJU, + ZOOMBOX_SPRITE_36_YUMYUM, + ZOOMBOX_SPRITE_37_LITTLE_LOCKUP, + ZOOMBOX_SPRITE_38_LEAKY, + ZOOMBOX_SPRITE_39_GLOOP, + ZOOMBOX_SPRITE_3A_TIPTUP_CHOIR_MEMBER, + ZOOMBOX_SPRITE_3B_SNACKER, + ZOOMBOX_SPRITE_3C_ANCIENT_ONE, + ZOOMBOX_SPRITE_3D_SAND_EEL, + ZOOMBOX_SPRITE_3E_SNORKEL, + ZOOMBOX_SPRITE_3F_JINXY, + ZOOMBOX_SPRITE_40_CROCTUS, + ZOOMBOX_SPRITE_41_GRUNTILDA_3, + ZOOMBOX_SPRITE_42_TOOTY_2, + ZOOMBOX_SPRITE_43_BOGGY, + ZOOMBOX_SPRITE_44_WOZZA, + ZOOMBOX_SPRITE_45_MOTZHAND, + ZOOMBOX_SPRITE_46_TUMBLAR, + ZOOMBOX_SPRITE_47_MUMMUM, + ZOOMBOX_SPRITE_48_XMAS_GIFT_BLUE, + ZOOMBOX_SPRITE_49_WORM, + ZOOMBOX_SPRITE_4A_FREEZING_WATER, + ZOOMBOX_SPRITE_4B_TWINKLY, + ZOOMBOX_SPRITE_4C_TWINKLY_CHOMPER, + ZOOMBOX_SPRITE_4D_GNAWTY, + ZOOMBOX_SPRITE_4E_BOSS_BOOM_BOX, + ZOOMBOX_SPRITE_4F_ZUBBA, + ZOOMBOX_SPRITE_50_NABNUT, + ZOOMBOX_SPRITE_51_POLAR_BEAR_CUBS, + ZOOMBOX_SPRITE_52_YOUNG_EEYRIE_1, + ZOOMBOX_SPRITE_53_YOUNG_EEYRIE_2, + ZOOMBOX_SPRITE_54_YOUNG_EEYRIE_3, + ZOOMBOX_SPRITE_55_ADULT_EEYRIE, + ZOOMBOX_SPRITE_56_WARP_CAULDRON, + ZOOMBOX_SPRITE_57_BRENTILDA, + ZOOMBOX_SPRITE_58_TOOTY_3, + ZOOMBOX_SPRITE_59_BLACK_SNIPPET, + ZOOMBOX_SPRITE_5A_LOGGO, + ZOOMBOX_SPRITE_5B_CHEATO, + ZOOMBOX_SPRITE_5C_XMAS_GIFT_GREEN, + ZOOMBOX_SPRITE_5D_KLUNGO, + ZOOMBOX_SPRITE_5E_SEXY_GRUNTY, + ZOOMBOX_SPRITE_5F_TOOTY_4, + ZOOMBOX_SPRITE_60_BANJO_3, + ZOOMBOX_SPRITE_61_KAZOOIE_3, + ZOOMBOX_SPRITE_62_TOOTY_5, + ZOOMBOX_SPRITE_63_DINGPOT, + ZOOMBOX_SPRITE_64_CROC_BANJO, + ZOOMBOX_SPRITE_65_GRUNTILDA_4, + ZOOMBOX_SPRITE_66_LOCKUP, + ZOOMBOX_SPRITE_67_VILE_5, + ZOOMBOX_SPRITE_68_VILE_6, + ZOOMBOX_SPRITE_69_VILE_7 +}GcZoomboxSprite; + +typedef struct { + u8 unk0[0x30]; //string1 + u8 unk30[0x30]; //string2 + u8 unk60[0x30]; + u8 unk90[0x20]; + u8 unkB0[0x40]; + BKModelBin *model; + AnimCtrl *anim_ctrl; + BKSprite *unkF8; + BKSpriteDisplayData *unkFC; + BKSprite *unk100; + BKSpriteDisplayData *unk104; + u8 unk108[5]; //sfx_ids + u8 pad10D[3]; + f32 unk110[5]; //sfx_??? + s16 unk124[5]; //sfx_??? + s16 unk12E; + void (*unk130)(s32, s32); + u8 unk134; + u8 state; + u8 portrait_id; //0x136 + u8 str_cnt; //string_cnt + u8 current_str_index; //current_string + u8 unk139; + u8 unk13A; + u8 sfx_count; + char *raw_str[ZOOMBOX_MAX_STRING_COUNT]; //string_ptrs + u8 unk15C; + u8 unk15D; + u8 unk15E; + u8 pad15F[0x1]; + u8 *unk160; + s16 unk164; + s16 unk166; //top_transparency??? + s16 unk168; //rgb??? + s16 unk16A; //x_pos + s16 unk16C; //y1_pos + s16 unk16E; //y2_pos + s16 unk170; + s16 unk172; + s16 unk174; + s8 unk176; + s8 unk177; + s8 unk178; + s8 unk179; + u8 pad17A[0x2]; + f32 unk17C; + s8 unk180; + s8 unk181; + u8 unk182; + u8 unk183; + u8 unk184; + u8 unk185; + s8 unk186; + u8 unk187; + u8 frame_count; //sprite frame count + u8 unk189; + u8 unk18A; + u8 prev_sfx; //next_sfx + f32 unk18C; + f32 unk190; + f32 unk194; + f32 unk198; + f32 unk19C; + f32 unk1A0; + u32 unk1A4_31:1; + u32 unk1A4_30:1; + u32 unk1A4_29:1; + u32 unk1A4_28:1; + u32 unk1A4_27:1; + u32 unk1A4_26:1; + u32 unk1A4_25:1; + u32 unk1A4_24:1; + u32 unk1A4_23:1; + u32 unk1A4_22:1; + u32 unk1A4_21:1; + u32 unk1A4_20:1; + u32 unk1A4_19:1; + u32 highlighted:1; + u32 unk1A4_17:1; + u32 unk1A4_16:1; + u32 unk1A4_15:1; + u32 unk1A4_14:1; + u32 unk1A4_13:1; + u32 unk1A4_12:1; + u32 unk1A4_11:1; + u32 unk1A4_10:1; + u32 pad1A4_9:10; +}GcZoombox; //size 0x1A8 + + +void gczoombox_free(GcZoombox *this); +void func_803160A8(GcZoombox *this); +void func_803163A8(GcZoombox *this, Gfx **gfx, Mtx **mtx); +void func_803164B0(GcZoombox *this, Gfx **gfx, Mtx **mtx, s32 arg3, s32 arg4, s32 arg5, f32 arg6); +void func_80316764(GcZoombox *this, s32 arg1); +void gczoombox_draw(GcZoombox *this, Gfx **gdl, Mtx ** mptr, void *vptr); +void func_80316E08(GcZoombox *this); +void func_80316E60(GcZoombox *this); +void func_80316E84(GcZoombox *this, s32 arg1); +s32 gczoombox_strlen(u8 *arg0); +void gczoombox_update(GcZoombox *this); +GcZoombox *gczoombox_new(s32 arg0, GcZoomboxSprite portrait_id, s32 arg2, s32 arg3, void (*arg4)(s32, s32)); +bool gczoombox_setStrings(GcZoombox *this, s32 str_cnt, char **str_ptrs); +bool func_803183A4(GcZoombox *this, char *arg1); +void gczoombox_open(GcZoombox *this); +void gczoombox_close(GcZoombox *this); +void gczoombox_maximize(GcZoombox *this); +void gczoombox_minimize(GcZoombox *this); +void func_8031842C(GcZoombox *this); +void func_8031843C(GcZoombox *this); +void func_80318478(GcZoombox *this); +void func_80318488(GcZoombox *this); +void func_80318498(GcZoombox *this); +void gczoombox_resolve_minimize(GcZoombox *this); +void func_803184B8(GcZoombox *this); +void func_803184C8(GcZoombox *this, f32 arg1, s32 arg2, s32 arg3, f32 arg4, bool arg5, bool arg6); +bool func_8031857C(GcZoombox *this, u8 *str); +void gczoombox_highlight(GcZoombox *this, bool arg1); +bool gczoombox_is_highlighted(GcZoombox *this); +void func_80318614(GcZoombox *this, int arg1); +void func_80318640(GcZoombox *this, s32 arg1, f32 arg2, f32 arg3, s32 arg4); +void func_80318734(GcZoombox *this, f32 arg1); +void func_80318760(GcZoombox *this, s32 arg1); +void func_80318774(GcZoombox *this); +bool func_8031877C(GcZoombox *this); +bool func_803188B4(GcZoombox *this); +bool func_80318964(GcZoombox *this); +bool gczoombox_loadSprite(GcZoombox *this, GcZoomboxSprite arg1); +void func_80318B7C(GcZoombox *this, s32 arg1); +bool func_80318BEC(GcZoombox *this); +void gczoombox_defrag(GcZoombox *this); +void func_80318C48(GcZoombox *this, s32 arg1); + +#endif // __BANJO_KAZOOIE_CORE2_GC_ZOOMBOX_H__ diff --git a/src/core2/code_3480.c b/src/core2/snackerctl.c similarity index 60% rename from src/core2/code_3480.c rename to src/core2/snackerctl.c index b054919a..d49abd44 100644 --- a/src/core2/code_3480.c +++ b/src/core2/snackerctl.c @@ -1,7 +1,11 @@ +#include "snackerctl.h" + #include #include "functions.h" #include "variables.h" +#include "ch/snacker.h" + s32 func_80259254(f32 *, f32, f32, f32); void ncFirstPersonCamera_getZoomedInRotation(f32 *); @@ -14,64 +18,59 @@ f32 D_80363610[3] = {350.0f, 200.0f, -100.0f}; f32 D_8036361C[2] = {29.25f, 269.5f}; /* .bss */ -s32 D_8037BF50; +SnackerCtlState s_snackerctl_state; /* .code */ -//snacker_clearState -void snacker_reset(void){ - D_8037BF50 = 0; +void snackerctl_reset(void){ + s_snackerctl_state = SNACKER_CTL_STATE_0_INACTIVE; } -//__playerWithinHorizontalDistance -s32 func_8028A41C(f32 x, f32 z, f32 dist){ +static s32 __snackerctl_player_within_distance(f32 x, f32 z, f32 dist){ f32 player_position[3]; _player_getPosition(player_position); return func_80259254(player_position, x, z, dist); } -//_snacker_ttc_update -s32 func_8028A45C(void){ - s32 nextState = 0; +static SnackerCtlState __snackerctl_update_ttc(void){ + SnackerCtlState nextState = 0; f32 player_position[3]; _player_getPosition(player_position); if(func_8028B470() || func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE)){ //(swimming || ???) if(player_position[1] < 600.0f - && !func_8028A41C(2478.0f, 4586.0f, 1750.0f) //within 1750 of sandcastle center - && !func_8028A41C(-400.0, 2315.0f, 2000.0f) //within 2000 of blubber's ship center + && !__snackerctl_player_within_distance(2478.0f, 4586.0f, 1750.0f) //within 1750 of sandcastle center + && !__snackerctl_player_within_distance(-400.0, 2315.0f, 2000.0f) //within 2000 of blubber's ship center ){ - nextState = 2; + nextState = SNACKER_CTL_STATE_2_TTC; } } - func_802E1A04(nextState); + chsnacker_setControlState(nextState); return nextState; } -//_snacker_rbb_update -s32 func_8028A504(void){ - s32 nextState = 0; +static SnackerCtlState __snackerctl_update_rbb(void){ + SnackerCtlState nextState = 0; f32 sp18[3]; if(func_8028B470()){ func_8028E964(sp18); if(func_80309D58(sp18, 0)) - nextState = 1; + nextState = SNACKER_CTL_STATE_1_RBB; } - func_802E1A04(nextState); + chsnacker_setControlState(nextState); return nextState; } -void func_8028A558(s32 arg0, s32 arg1, s32 arg2){ +static void func_8028A558(ActorMarker *arg0, enum asset_e arg1, s32 arg2){ func_8028F918(0); } -void func_8028A584(s32 arg0, s32 arg1, s32 arg2){ +static void func_8028A584(ActorMarker *arg0, enum asset_e arg1, s32 arg2){ func_803219F4(3); func_8034B9BC(chBottlesBonus_getPuzzleIndex()); } -//snacker_update_bottlesBonusPuzzle -s32 func_8028A5C0(void){ +static SnackerCtlState _snackerctl_update_bottles_bonus(void){ s32 tmp; f32 sp30[3]; @@ -79,22 +78,22 @@ s32 func_8028A5C0(void){ return 0; if(func_8034BB48() && chBottlesBonus_getPuzzleIndex() != 7){ - func_80311480(0xe26 + (chBottlesBonus_getPuzzleIndex() << 1), 6, &D_80363610, 0, 0, 0); + func_80311480(0xe26 + (chBottlesBonus_getPuzzleIndex() << 1), 6, D_80363610, NULL, NULL, NULL); } if(!func_8028F25C() && func_80321960() == 3) func_803219F4(1); if(miscflag_isTrue(0x17) && !func_8028F25C()){ - if(func_8028A41C(183.0f, -100.0f, 75.0f)){ + if(__snackerctl_player_within_distance(183.0f, -100.0f, 75.0f)){ if(chBottlesBonus_getPuzzleIndex() == 6){ if(!D_8037DCCC){ func_8028F94C(4, &D_80363610); - func_80311480(0xe33, 0x6, &D_80363610, 0, func_8028A584, NULL); + func_80311480(0xe33, 0x6, D_80363610, NULL, func_8028A584, NULL); } }//L8028A70C else if(chBottlesBonus_getPuzzleIndex() == 7){ func_8028F94C(4, &D_80363610); - func_80311480(0xe35, 0x6, &D_80363610, 0, func_8028A558, NULL); + func_80311480(0xe35, 0x6, D_80363610, NULL, func_8028A558, NULL); D_8037DCCC = 1; }//L8028A764 else if(jiggyscore_isCollected(0x10)){ @@ -104,7 +103,7 @@ s32 func_8028A5C0(void){ ){ if(!D_8037DCCA){ func_8028F94C(4, &D_80363610); - func_80311480(0xe21, 6, &D_80363610, 0, func_8028A584, NULL); + func_80311480(0xe21, 6, D_80363610, 0, func_8028A584, NULL); D_8037DCCA = 1; }else{ func_8028A584(0,0,0); @@ -114,31 +113,29 @@ s32 func_8028A5C0(void){ else{ if(!D_8037DCCB){ func_8028F94C(4, &D_80363610); - func_80311480(0xe20, 6, &D_80363610, 0, func_8028A558, NULL); + func_80311480(0xe20, 6, D_80363610, 0, func_8028A558, NULL); D_8037DCCB = 1; } } } } - return 0; + return SNACKER_CTL_STATE_0_INACTIVE; } -//snacker_updateState -void func_8028A8D0(void){ +void snackerctl_update(void){ switch(map_get()){ case MAP_7_TTC_TREASURE_TROVE_COVE: - D_8037BF50 = func_8028A45C(); + s_snackerctl_state = __snackerctl_update_ttc(); break; case MAP_31_RBB_RUSTY_BUCKET_BAY: - D_8037BF50 = func_8028A504(); + s_snackerctl_state = __snackerctl_update_rbb(); break; case MAP_8C_SM_BANJOS_HOUSE: - D_8037BF50 = func_8028A5C0(); + s_snackerctl_state = _snackerctl_update_bottles_bonus(); break; } } -//snacker_getState -s32 func_8028A94C(void){ - return D_8037BF50; +SnackerCtlState snackerctl_get_state(void){ + return s_snackerctl_state; } diff --git a/src/core2/snackerctl.h b/src/core2/snackerctl.h new file mode 100644 index 00000000..7c6d2061 --- /dev/null +++ b/src/core2/snackerctl.h @@ -0,0 +1,14 @@ +#ifndef __BANJO_KAZOOIE_CORE2_SNACKER_CTL_H__ +#define __BANJO_KAZOOIE_CORE2_SNACKER_CTL_H__ + +typedef enum { + SNACKER_CTL_STATE_0_INACTIVE, + SNACKER_CTL_STATE_1_RBB, + SNACKER_CTL_STATE_2_TTC +} SnackerCtlState; + +void snackerctl_reset(void); +void snackerctl_update(void); +SnackerCtlState snackerctl_get_state(void); + +#endif // __BANJO_KAZOOIE_CORE2_SNACKER_CTL_H__ diff --git a/src/core2/spawnqueue.c b/src/core2/spawnqueue.c index 853ef798..2fbf2198 100644 --- a/src/core2/spawnqueue.c +++ b/src/core2/spawnqueue.c @@ -5,8 +5,7 @@ #include "prop.h" - -void func_802E1790(void); +#include "ch/snacker.h" void spawnQueue_unlock(void); void spawnQueue_lock(void); @@ -121,7 +120,6 @@ extern ActorInfo D_80368528; extern ActorInfo D_8036854C; extern ActorInfo D_80368570; extern ActorInfo D_803685A0; //mumbotoken -extern ActorInfo D_80368620; //snacker extern ActorInfo chSnowman; //sirslush extern ActorInfo chSnowball; //snowball extern ActorInfo chSnowmanHat; //sir_slush_hat @@ -191,7 +189,7 @@ void spawnQueue_reset(void){ spawnQueue_lock(); spawnQueueLength = 0; chmumbo_func_802D1724(); - func_802E1790(); + chSnacker_initialize(); switch(loaded_asm_file){ case OVERLAY_2_WHALE: CC_func_803870E0(); @@ -263,7 +261,7 @@ void spawnQueue_reset(void){ spawnableActorList_add(&D_80367E20, actor_new, 0x44); //chmolehill spawnableActorList_add(&D_80373DC0, actor_new, 0x80000); spawnableActorList_add(&D_80367E70, actor_new, 0x0); - spawnableActorList_add(&D_80368620, actor_new, 0x10004); //snacker + spawnableActorList_add(&gChSnacker, actor_new, 0x10004); //snacker spawnableActorList_add(&D_80366EF0, actor_new, 0x20004); //large_shadow spawnableActorList_add(&D_80367B20, actor_new, 0x80); //chclimbbase spawnableActorList_add(&D_80367BA4, actor_new, 0x40); //gold_bullion diff --git a/src/lair/code_5ED0.c b/src/lair/code_5ED0.c index 05834d40..c63592d2 100644 --- a/src/lair/code_5ED0.c +++ b/src/lair/code_5ED0.c @@ -2,7 +2,8 @@ #include "functions.h" #include "variables.h" -#include "core2/code_C9E70.h" +#include "../core2/gc/zoombox.h" +#include "../core2/code_C9E70.h" #include "core2/nc/camera.h" @@ -67,18 +68,11 @@ extern s32 ability_getAllLearned(void); // get unlocked moves bitfield extern s32 item_getCount(s32); // item count get extern void func_803463F4(s32, s32); // item count set -extern void func_80318614(gczoombox_t *, s32); -extern bool func_803183A4(gczoombox_t *, u8 *); -extern void gczoombox_minimize(gczoombox_t *); -extern void gczoombox_close(gczoombox_t *); - extern void func_80250530(s32, u16, f32); extern void func_8025A55C(s32, s32, s32); extern void func_80324CFC(f32, s16, s16); -extern void gczoombox_open(gczoombox_t *); -extern void gczoombox_maximize(gczoombox_t *); extern void *mapModel_getModel(s32); extern void player_setTransformation(s32); // set transformation @@ -208,31 +202,31 @@ struct { {1, COMUSIC_9_NOTE_COLLECTED, 32000, 3.0f}, {1, COMUSIC_14_GOLD_FEATHER_COLLECTED, 0x7FFF, 3.0f}, {1, COMUSIC_17_EMPTY_HONEYCOMB_COLLECTED, 0x7FFF, 3.0f}, - {2, TALK_PIC_1D_GOBI, 0, 0.0f}, - {2, TALK_PIC_15_CLANKER, 0, 0.0f}, - {2, TALK_PIC_1B_TRUNKER, 0, 0.0f}, - {2, TALK_PIC_17_VILE_4, 0, 0.0f}, - {2, TALK_PIC_13_BLUBBER, 0, 0.0f}, - {2, TALK_PIC_10_MUMBO_1, 0, 0.0f}, - {2, TALK_PIC_12_CONGA, 0, 0.0f}, - {2, TALK_PIC_F_BOTTLES, 0, 0.0f}, - {2, TALK_PIC_11_CHIMPY, 0, 0.0f}, - {2, TALK_PIC_18_TIPTUP, 0, 0.0f}, - {2, TALK_PIC_1C_RUBEE, 0, 0.0f}, - {2, TALK_PIC_1F_TEEHEE, 0, 0.0f}, - {2, TALK_PIC_3E_SNORKEL, 0, 0.0f}, - {2, TALK_PIC_41_GRUNTILDA_3, 0, 0.0f}, - {2, TALK_PIC_43_BOGGY, 0, 0.0f}, - {2, TALK_PIC_44_WOZZA, 0, 0.0f}, - {2, TALK_PIC_50_NABNUT, 0, 0.0f}, - {2, TALK_PIC_51_POLAR_BEAR_CUBS, 0, 0.0f}, - {2, TALK_PIC_55_ADULT_EEYRIE, 0, 0.0f}, - {2, TALK_PIC_57_BRENTILDA, 0, 0.0f}, - {2, TALK_PIC_58_TOOTY_3, 0, 0.0f}, - {2, TALK_PIC_5A_LOGGO, 0, 0.0f}, - {2, TALK_PIC_14_NIPPER, 0, 0.0f}, - {2, TALK_PIC_19_TANKTUP, 0, 0.0f}, - {2, TALK_PIC_20_JINJO_YELLOW, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_1D_GOBI, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_15_CLANKER, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_1B_TRUNKER, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_17_VILE_4, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_13_BLUBBER, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_10_MUMBO_1, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_12_CONGA, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_F_BOTTLES, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_11_CHIMPY, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_18_TIPTUP, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_1C_RUBEE, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_1F_TEEHEE, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_3E_SNORKEL, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_41_GRUNTILDA_3, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_43_BOGGY, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_44_WOZZA, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_50_NABNUT, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_51_POLAR_BEAR_CUBS, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_55_ADULT_EEYRIE, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_57_BRENTILDA, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_58_TOOTY_3, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_5A_LOGGO, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_14_NIPPER, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_19_TANKTUP, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_20_JINJO_YELLOW, 0, 0.0f}, {1, COMUSIC_57_TURBO_TRAINERS, 32000, 10.0f}, {1, COMUSIC_58_WADING_BOOTS, 32000, 10.0f}, {1, COMUSIC_25_USING_GOLD_FEATHERS, 32000, 10.0f}, diff --git a/symbol_addrs.us.v10.txt b/symbol_addrs.us.v10.txt index 6144285e..00442389 100644 --- a/symbol_addrs.us.v10.txt +++ b/symbol_addrs.us.v10.txt @@ -15,24 +15,7 @@ __osProbeTLB = 0x80003BD0; __osDisableInt = 0x80003FC0; __osRestoreInt = 0x80003FE0; bk_boot_BSS_START = 0x80005270; -mainLoop = 0x8023DD0C; -func_802405F0 = 0x802405F0; -rumbleManager_80250C08 = 0x80250C08; -memcpy = 0x80254608; -malloc = 0x80254CA8; -free = 0x802550F0; -realloc = 0x80255358; -write_file_blocks = 0x80255B30; -ml_vec3f_normalize = 0x80256450; -ml_vec3f_set_length_copy = 0x802565E0; -ml_isNonzero_vec3f = 0x80258368; -mlAbsF = 0x80258964; -ml_vec3f_copy = 0x80258BA4; -ml_vec3f_diff_copy = 0x80258BC0; -ml_vec3f_add = 0x80258C48; -ml_vec3f_scale_copy = 0x80258CB0; ___osGetSR = 0x8025AFE0; -sns_write_payload_over_heap = 0x8025B700; bzero = 0x80263B40; osWriteBackDCacheAll = 0x80263BE0; osVirtualToPhysical = 0x802646A0; @@ -42,7 +25,6 @@ osWritebackDCache = 0x80264AF0; osInvalDCache = 0x80264B70; osDestroyThread = 0x80264DB0; osSetThreadPri = 0x80265000; -gu_sqrtf = 0x80265350; osSetIntMask = 0x802654D0; osInvalICache = 0x802684C0; __osSetSR = 0x8026A210; @@ -60,8 +42,6 @@ __osProbeTLB = 0x8026B420; bcopy = 0x8026C110; __osSetCompare = 0x8026CA70; osGetCount = 0x8026CE00; -framebuffer_width = 0x80276588; -framebuffer_height = 0x8027658C; __osShutdown = 0x8027712C; __OSGlobalIntMask = 0x80277130; __osRunQueue = 0x80277378; @@ -69,53 +49,5 @@ __osRunningThread = 0x80277380; __osFaultedThread = 0x80277384; __osRcpImTable = 0x80278C60; __libm_qnan_f = 0x80278DB0; -D_8027BEEC = 0x8027BEEC; -__osEventStateTab = 0x80284660; -__osThreadSave = 0x80285DE0; -leoDiskStack = 0x80285F90;//technically should have a OS_LEO_STACKSIZE or something... -baMarker_8028D694 = 0x8028D694; -player_getPosition = 0x8028E9A4; -_player_getPosition = 0x802984D4; -bs_checkInterrupt = 0x8029A81C; -spawnQueue_func_802C3A18 = 0x802C3A18; -spawnQueue_flush = 0x802C3A38; -spawnQueue_unlock = 0x802C3BDC; -spawnQueue_lock = 0x802C3BE8; -mapSpecificFlags_getAll = 0x802CAE8C; -mapSpecificFlags_setAll = 0x802CAE98; -mapSpecificFlags_validateCRC1 = 0x802CB00C; -mapSavestate_save = 0x802E2F2C; -mapSavestate_apply = 0x802E30AC; -getGameMode = 0x802E49FC; -vtxList_getVertices = 0x802EC450; -cube_atIndices = 0x80303384; -gctransition_done = 0x8030BD98; -gcdialog_setState = 0x8030F488; -gcdialog_update = 0x8030F990; -gczoombox_update = 0x80316EF4; -gczoombox_close = 0x803183FC; -gczoombox_maximize = 0x8031840C; -gczoombox_minimize = 0x8031841C; -fileProgressFlag_get = 0x8031FF1C; -level_get = 0x80321900; -levelSpecificFlags_validateCRC1 = 0x8032204C; -marker_despawn = 0x803282F4; -actor_copy = 0x80329C40; -actors_appendToSavestate = 0x80329CBC; -model_getVtxList = 0x8033A148; -strIToA = 0x8033D884; -strlen = 0x8033DA80; -time_getDelta = 0x8033DD9C; -item_inc = 0x80345F24; -item_empty = 0x80345F74; -itemscore_noteScores_get = 0x80346F34; -demo_readInput = 0x80349EE4; -randf = 0x8034A390; -suBaddieActorArray = 0x8036E560; -D_80374CF0 = 0x80374CF0; -D_8037901C = 0x8037901C; -D_8037DCB0 = 0x8037DCB0; __propellorTimer = 0x803912CC; -D_A00001D8 = 0xA00001D8; -D_A0000238 = 0xA0000238;