diff --git a/include/functions.h b/include/functions.h index 529de810aa..3faf69b262 100644 --- a/include/functions.h +++ b/include/functions.h @@ -2690,11 +2690,7 @@ void func_801588D0(GlobalContext* globalCtx, s16 param_2); // void func_8015E750(void); void func_8015E7EC(GlobalContext* globalCtx, UNK_PTR puParm2); // void func_8015F8A8(UNK_TYPE4 ctxt); -// void func_80160A90(void); -// void func_80160AF8(void); -// void func_80160B40(void); -// void func_80160B80(void); -// void func_80160BC0(void); + void ShrinkWindow_SetLetterboxTarget(s32 target); s32 ShrinkWindow_GetLetterboxTarget(void); void ShrinkWindow_SetLetterboxMagnitude(s32 magnitude); diff --git a/include/initvars.h b/include/initvars.h index 797e738764..11a6719e9c 100644 --- a/include/initvars.h +++ b/include/initvars.h @@ -34,6 +34,7 @@ extern EffectSsInit Effect_Ss_Ice_Smoke_InitVars; extern EffectSsInit Effect_En_Ice_Block_InitVars; extern EffectSsInit Effect_Ss_Sbn_InitVars; +extern ActorInit Player_InitVars; extern ActorInit Arms_Hook_InitVars; extern ActorInit Arrow_Fire_InitVars; extern ActorInit Arrow_Ice_InitVars; diff --git a/include/variables.h b/include/variables.h index 9ddad27f90..7eafe0d2f3 100644 --- a/include/variables.h +++ b/include/variables.h @@ -1535,7 +1535,6 @@ extern char D_801D0714[]; // extern UNK_TYPE1 D_801D08E4; // extern UNK_TYPE1 D_801D08E8; // extern UNK_TYPE1 D_801D0900; -extern ActorInit Player_InitVars; extern KaleidoMgrOverlay gKaleidoMgrOverlayTable[2]; // extern UNK_TYPE1 D_801D0B8C; extern KaleidoMgrOverlay* gKaleidoMgrCurOvl; @@ -3294,10 +3293,6 @@ extern LightsBuffer sLightsBuffer; // extern UNK_TYPE1 D_801F6B1E; // extern UNK_TYPE1 D_801F6B20; // extern UNK_TYPE1 D_801F6B22; -// extern UNK_TYPE1 D_801F6B30; -// extern UNK_TYPE1 D_801F6B34; -// extern UNK_TYPE1 D_801F6B38; -// extern UNK_TYPE1 D_801F6B3C; extern ShrinkWindowContext gShrinkWindowContext; extern ShrinkWindowContext* gShrinkWindowContextPtr; // extern UNK_TYPE4 D_801F6B50; diff --git a/spec b/spec index 4d9004e49e..cb017e135c 100644 --- a/spec +++ b/spec @@ -553,11 +553,9 @@ beginseg include "build/data/code/z_message_nes.data.o" include "build/src/code/z_message_staff.o" include "build/src/code/z_player_call.o" - include "build/data/code/z_player_call.bss.o" include "build/src/code/z_shrink_window.o" include "build/src/code/db_camera.o" include "build/data/code/db_camera.bss.o" - include "build/data/code/code_801D0B50.data.o" include "build/src/code/z_kaleido_manager.o" include "build/src/code/z_kaleido_scope_call.o" include "build/src/code/z_fbdemo_dlftbls.o" diff --git a/src/code/z_player_call.c b/src/code/z_player_call.c index 69e2f4dae9..7ed1ce5ce6 100644 --- a/src/code/z_player_call.c +++ b/src/code/z_player_call.c @@ -1,11 +1,60 @@ #include "global.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_call/func_80160A90.s") +#define FLAGS \ + (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_200000 | ACTOR_FLAG_2000000 | \ + ACTOR_FLAG_4000000 | ACTOR_FLAG_80000000) -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_call/func_80160AF8.s") +ActorFunc sPlayerCallInitFunc; +ActorFunc sPlayerCallDestroyFunc; +ActorFunc sPlayerCallUpdateFunc; +ActorFunc sPlayerCallDrawFunc; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_call/func_80160B40.s") +void PlayerCall_Init(Actor* thisx, GlobalContext* globalCtx); +void PlayerCall_Destroy(Actor* thisx, GlobalContext* globalCtx); +void PlayerCall_Update(Actor* thisx, GlobalContext* globalCtx); +void PlayerCall_Draw(Actor* thisx, GlobalContext* globalCtx); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_call/func_80160B80.s") +const ActorInit Player_InitVars = { + ACTOR_PLAYER, + ACTORCAT_PLAYER, + FLAGS, + GAMEPLAY_KEEP, + sizeof(Player), + (ActorFunc)PlayerCall_Init, + (ActorFunc)PlayerCall_Destroy, + (ActorFunc)PlayerCall_Update, + (ActorFunc)PlayerCall_Draw, +}; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_call/func_80160BC0.s") +void Player_Init(Actor* thisx, GlobalContext* globalCtx); +void Player_Destroy(Actor* thisx, GlobalContext* globalCtx); +void Player_Update(Actor* thisx, GlobalContext* globalCtx); +void Player_Draw(Actor* thisx, GlobalContext* globalCtx); + +void PlayerCall_InitFuncPtrs(void) { + sPlayerCallInitFunc = KaleidoManager_GetRamAddr(Player_Init); + sPlayerCallDestroyFunc = KaleidoManager_GetRamAddr(Player_Destroy); + sPlayerCallUpdateFunc = KaleidoManager_GetRamAddr(Player_Update); + sPlayerCallDrawFunc = KaleidoManager_GetRamAddr(Player_Draw); +} + +void PlayerCall_Init(Actor* thisx, GlobalContext* globalCtx) { + KaleidoScopeCall_LoadPlayer(); + PlayerCall_InitFuncPtrs(); + sPlayerCallInitFunc(thisx, globalCtx); +} + +void PlayerCall_Destroy(Actor* thisx, GlobalContext* globalCtx) { + KaleidoScopeCall_LoadPlayer(); + sPlayerCallDestroyFunc(thisx, globalCtx); +} + +void PlayerCall_Update(Actor* thisx, GlobalContext* globalCtx) { + KaleidoScopeCall_LoadPlayer(); + sPlayerCallUpdateFunc(thisx, globalCtx); +} + +void PlayerCall_Draw(Actor* thisx, GlobalContext* globalCtx) { + KaleidoScopeCall_LoadPlayer(); + sPlayerCallDrawFunc(thisx, globalCtx); +} diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 6a5fa04231..bc3e3c1e8b 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -12,6 +12,11 @@ extern UNK_TYPE D_06008860; extern UNK_TYPE D_0600BDD8; extern UNK_TYPE D_060178D0; +void Player_Init(Actor* thisx, GlobalContext* globalCtx); +void Player_Destroy(Actor* thisx, GlobalContext* globalCtx); +void Player_Update(Actor* thisx, GlobalContext* globalCtx); +void Player_Draw(Actor* thisx, GlobalContext* globalCtx); + #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_8082DA90.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_8082DABC.s") @@ -728,7 +733,7 @@ extern UNK_TYPE D_060178D0; #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_80841A50.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_80841AC4.s") +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/Player_Init.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_80842510.s") @@ -754,15 +759,15 @@ extern UNK_TYPE D_060178D0; #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_80844EF8.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_808460B8.s") +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/Player_Update.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_808463C0.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_80846460.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_80846528.s") +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/Player_Draw.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_808470D4.s") +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/Player_Destroy.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_80847190.s") diff --git a/tools/disasm/files.txt b/tools/disasm/files.txt index fc9f9fc534..a43ef93f45 100644 --- a/tools/disasm/files.txt +++ b/tools/disasm/files.txt @@ -562,7 +562,7 @@ 0x801C5E30 : "z_vr_box", 0x801C5FC0 : "z_sram_NES", 0x801D0470 : "z_message_nes", - 0x801D0B50 : "", + 0x801D0B50 : "z_player_call", 0x801D0B70 : "z_kaleido_manager", 0x801D0BB0 : "", 0x801D0C80 : "z_fbdemo", diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 0d5a3c7923..7236e45218 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2887,11 +2887,11 @@ 0x8015E750:("func_8015E750",), 0x8015E7EC:("func_8015E7EC",), 0x8015F8A8:("func_8015F8A8",), - 0x80160A90:("func_80160A90",), - 0x80160AF8:("func_80160AF8",), - 0x80160B40:("func_80160B40",), - 0x80160B80:("func_80160B80",), - 0x80160BC0:("func_80160BC0",), + 0x80160A90:("PlayerCall_InitFuncPtrs",), + 0x80160AF8:("PlayerCall_Init",), + 0x80160B40:("PlayerCall_Destroy",), + 0x80160B80:("PlayerCall_Update",), + 0x80160BC0:("PlayerCall_Draw",), 0x80160C00:("ShrinkWindow_SetLetterboxTarget",), 0x80160C14:("ShrinkWindow_GetLetterboxTarget",), 0x80160C28:("ShrinkWindow_SetLetterboxMagnitude",), @@ -4602,7 +4602,7 @@ 0x80841744:("func_80841744",), 0x8084182C:("func_8084182C",), 0x80841A50:("func_80841A50",), - 0x80841AC4:("func_80841AC4",), + 0x80841AC4:("Player_Init",), 0x80842510:("func_80842510",), 0x808425B4:("func_808425B4",), 0x808426F0:("func_808426F0",), @@ -4615,11 +4615,11 @@ 0x80844784:("func_80844784",), 0x80844D80:("func_80844D80",), 0x80844EF8:("func_80844EF8",), - 0x808460B8:("func_808460B8",), + 0x808460B8:("Player_Update",), 0x808463C0:("func_808463C0",), 0x80846460:("func_80846460",), - 0x80846528:("func_80846528",), - 0x808470D4:("func_808470D4",), + 0x80846528:("Player_Draw",), + 0x808470D4:("Player_Destroy",), 0x80847190:("func_80847190",), 0x8084748C:("func_8084748C",), 0x808475B4:("func_808475B4",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 1271518888..b01c5729d8 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -4095,10 +4095,10 @@ 0x801F6B1E:("D_801F6B1E","UNK_TYPE1","",0x1), 0x801F6B20:("D_801F6B20","UNK_TYPE1","",0x1), 0x801F6B22:("D_801F6B22","UNK_TYPE1","",0x1), - 0x801F6B30:("D_801F6B30","UNK_TYPE1","",0x1), - 0x801F6B34:("D_801F6B34","UNK_TYPE1","",0x1), - 0x801F6B38:("D_801F6B38","UNK_TYPE1","",0x1), - 0x801F6B3C:("D_801F6B3C","UNK_TYPE1","",0x1), + 0x801F6B30:("sPlayerCallInitFunc","UNK_TYPE1","",0x1), + 0x801F6B34:("sPlayerCallDestroyFunc","UNK_TYPE1","",0x1), + 0x801F6B38:("sPlayerCallUpdateFunc","UNK_TYPE1","",0x1), + 0x801F6B3C:("sPlayerCallDrawFunc","UNK_TYPE1","",0x1), 0x801F6B40:("gShrinkWindowContext","ShrinkWindowContext","",0x4), 0x801F6B44:("gShrinkWindowContextPtr","ShrinkWindowContext*","",0x4), 0x801F6B50:("D_801F6B50","UNK_TYPE4","",0x4), diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 8ec9f8ca33..c93719e087 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -2401,11 +2401,11 @@ asm/non_matchings/code/z_message_nes/func_8015B198.s,func_8015B198,0x8015B198,0x asm/non_matchings/code/z_message_staff/func_8015E750.s,func_8015E750,0x8015E750,0x27 asm/non_matchings/code/z_message_staff/func_8015E7EC.s,func_8015E7EC,0x8015E7EC,0x42F asm/non_matchings/code/z_message_staff/func_8015F8A8.s,func_8015F8A8,0x8015F8A8,0x47A -asm/non_matchings/code/z_player_call/func_80160A90.s,func_80160A90,0x80160A90,0x1A -asm/non_matchings/code/z_player_call/func_80160AF8.s,func_80160AF8,0x80160AF8,0x12 -asm/non_matchings/code/z_player_call/func_80160B40.s,func_80160B40,0x80160B40,0x10 -asm/non_matchings/code/z_player_call/func_80160B80.s,func_80160B80,0x80160B80,0x10 -asm/non_matchings/code/z_player_call/func_80160BC0.s,func_80160BC0,0x80160BC0,0x10 +asm/non_matchings/code/z_player_call/PlayerCall_InitFuncPtrs.s,PlayerCall_InitFuncPtrs,0x80160A90,0x1A +asm/non_matchings/code/z_player_call/PlayerCall_Init.s,PlayerCall_Init,0x80160AF8,0x12 +asm/non_matchings/code/z_player_call/PlayerCall_Destroy.s,PlayerCall_Destroy,0x80160B40,0x10 +asm/non_matchings/code/z_player_call/PlayerCall_Update.s,PlayerCall_Update,0x80160B80,0x10 +asm/non_matchings/code/z_player_call/PlayerCall_Draw.s,PlayerCall_Draw,0x80160BC0,0x10 asm/non_matchings/code/z_shrink_window/ShrinkWindow_SetLetterboxTarget.s,ShrinkWindow_SetLetterboxTarget,0x80160C00,0x5 asm/non_matchings/code/z_shrink_window/ShrinkWindow_GetLetterboxTarget.s,ShrinkWindow_GetLetterboxTarget,0x80160C14,0x5 asm/non_matchings/code/z_shrink_window/ShrinkWindow_SetLetterboxMagnitude.s,ShrinkWindow_SetLetterboxMagnitude,0x80160C28,0x5