diff --git a/config/SOUE01/rels/d_t_dowsingNP/splits.txt b/config/SOUE01/rels/d_t_dowsingNP/splits.txt index 5912c975..5aa87752 100644 --- a/config/SOUE01/rels/d_t_dowsingNP/splits.txt +++ b/config/SOUE01/rels/d_t_dowsingNP/splits.txt @@ -11,3 +11,5 @@ REL/executor.c: REL/d/t/d_t_dowsing.cpp: .text start:0x00000070 end:0x00000580 + .rodata start:0x00000000 end:0x00000004 + .data start:0x00000000 end:0x000000B0 diff --git a/config/SOUE01/rels/d_t_dowsingNP/symbols.txt b/config/SOUE01/rels/d_t_dowsingNP/symbols.txt index aea9cf6f..83d3f60a 100644 --- a/config/SOUE01/rels/d_t_dowsingNP/symbols.txt +++ b/config/SOUE01/rels/d_t_dowsingNP/symbols.txt @@ -1,17 +1,17 @@ _prolog = .text:0x00000000; // type:function size:0x2C scope:global _epilog = .text:0x00000030; // type:function size:0x2C scope:global _unresolved = .text:0x00000060; // type:function size:0x4 scope:global -fn_299_70 = .text:0x00000070; // type:function size:0x30 -fn_299_A0 = .text:0x000000A0; // type:function size:0x60 -fn_299_100 = .text:0x00000100; // type:function size:0xBC -fn_299_1C0 = .text:0x000001C0; // type:function size:0x8 -fn_299_1D0 = .text:0x000001D0; // type:function size:0xF4 -fn_299_2D0 = .text:0x000002D0; // type:function size:0x8 -fn_299_2E0 = .text:0x000002E0; // type:function size:0x228 -fn_299_510 = .text:0x00000510; // type:function size:0x70 +dTgDowsing_c_classInit__Fv = .text:0x00000070; // type:function size:0x30 +__ct__12dTgDowsing_cFv = .text:0x000000A0; // type:function size:0x60 +create__12dTgDowsing_cFv = .text:0x00000100; // type:function size:0xBC +doDelete__12dTgDowsing_cFv = .text:0x000001C0; // type:function size:0x8 +actorExecute__12dTgDowsing_cFv = .text:0x000001D0; // type:function size:0xF4 +draw__12dTgDowsing_cFv = .text:0x000002D0; // type:function size:0x8 +checkDowsing__12dTgDowsing_cCFv = .text:0x000002E0; // type:function size:0x228 +__dt__12dTgDowsing_cFv = .text:0x00000510; // type:function size:0x70 _ctors = .ctors:0x00000000; // type:label scope:global _dtors = .dtors:0x00000000; // type:label scope:global -lbl_299_rodata_0 = .rodata:0x00000000; // type:object size:0x4 data:float -lbl_299_data_0 = .data:0x00000000; // type:object size:0x10 +lbl_299_rodata_0 = .rodata:0x00000000; // type:object size:0x4 scope:local data:float +g_profile_T_DOWSING = .data:0x00000000; // type:object size:0x10 jumptable_299_data_10 = .data:0x00000010; // type:object size:0x2C scope:local -lbl_299_data_3C = .data:0x0000003C; // type:object size:0x74 +__vt__12dTgDowsing_c = .data:0x0000003C; // type:object size:0x74 diff --git a/config/SOUE01/rels/d_t_genki_dws_tgtNP/splits.txt b/config/SOUE01/rels/d_t_genki_dws_tgtNP/splits.txt index af62192c..65fc6f99 100644 --- a/config/SOUE01/rels/d_t_genki_dws_tgtNP/splits.txt +++ b/config/SOUE01/rels/d_t_genki_dws_tgtNP/splits.txt @@ -11,3 +11,6 @@ REL/executor.c: REL/d/t/d_t_genki_dws_tgt.cpp: .text start:0x00000070 end:0x000003C0 + .rodata start:0x00000000 end:0x0000000C + .data start:0x00000000 end:0x00000084 + .bss start:0x00000008 end:0x00000018 diff --git a/config/SOUE01/rels/d_t_genki_dws_tgtNP/symbols.txt b/config/SOUE01/rels/d_t_genki_dws_tgtNP/symbols.txt index 941e11e2..f50c18b3 100644 --- a/config/SOUE01/rels/d_t_genki_dws_tgtNP/symbols.txt +++ b/config/SOUE01/rels/d_t_genki_dws_tgtNP/symbols.txt @@ -1,16 +1,16 @@ _prolog = .text:0x00000000; // type:function size:0x2C scope:global _epilog = .text:0x00000030; // type:function size:0x2C scope:global _unresolved = .text:0x00000060; // type:function size:0x4 scope:global -fn_632_70 = .text:0x00000070; // type:function size:0x70 -fn_632_E0 = .text:0x000000E0; // type:function size:0x168 -fn_632_250 = .text:0x00000250; // type:function size:0x24 -fn_632_280 = .text:0x00000280; // type:function size:0xB4 -fn_632_340 = .text:0x00000340; // type:function size:0xC -fn_632_350 = .text:0x00000350; // type:function size:0x70 +dTgGenkiDwsTgt_c_classInit__Fv = .text:0x00000070; // type:function size:0x70 +create__16dTgGenkiDwsTgt_cFv = .text:0x000000E0; // type:function size:0x168 +doDelete__16dTgGenkiDwsTgt_cFv = .text:0x00000250; // type:function size:0x24 +actorExecute__16dTgGenkiDwsTgt_cFv = .text:0x00000280; // type:function size:0xB4 +getSceneFlagFromParams__16dTgGenkiDwsTgt_cFv = .text:0x00000340; // type:function size:0xC +__dt__16dTgGenkiDwsTgt_cFv = .text:0x00000350; // type:function size:0x70 _ctors = .ctors:0x00000000; // type:label scope:global _dtors = .dtors:0x00000000; // type:label scope:global -lbl_632_rodata_0 = .rodata:0x00000000; // type:object size:0xC data:float -lbl_632_data_0 = .data:0x00000000; // type:object size:0x10 -lbl_632_data_10 = .data:0x00000010; // type:object size:0x74 -lbl_632_bss_8 = .bss:0x00000008; // type:object size:0x1 data:byte -lbl_632_bss_C = .bss:0x0000000C; // type:object size:0xC data:float +lbl_632_rodata_0 = .rodata:0x00000000; // type:object size:0xC scope:local data:float +g_profile_TAG_GENKI_DOWSING_TARGET = .data:0x00000000; // type:object size:0x10 +__vt__16dTgGenkiDwsTgt_c = .data:0x00000010; // type:object size:0x74 +@GUARD@create__16dTgGenkiDwsTgt_cFv@offset = .bss:0x00000008; // type:object size:0x1 scope:local data:byte +@LOCAL@create__16dTgGenkiDwsTgt_cFv@offset = .bss:0x0000000C; // type:object size:0xC scope:local data:float diff --git a/config/SOUE01/rels/d_t_holy_waterNP/splits.txt b/config/SOUE01/rels/d_t_holy_waterNP/splits.txt index 2a0f7297..e201db41 100644 --- a/config/SOUE01/rels/d_t_holy_waterNP/splits.txt +++ b/config/SOUE01/rels/d_t_holy_waterNP/splits.txt @@ -11,3 +11,5 @@ REL/executor.c: REL/d/t/d_t_holy_water.cpp: .text start:0x00000070 end:0x00000360 + .rodata start:0x00000000 end:0x0000000C + .data start:0x00000000 end:0x00000084 diff --git a/config/SOUE01/rels/d_t_holy_waterNP/symbols.txt b/config/SOUE01/rels/d_t_holy_waterNP/symbols.txt index 965fce98..f58132b7 100644 --- a/config/SOUE01/rels/d_t_holy_waterNP/symbols.txt +++ b/config/SOUE01/rels/d_t_holy_waterNP/symbols.txt @@ -1,18 +1,18 @@ _prolog = .text:0x00000000; // type:function size:0x2C scope:global _epilog = .text:0x00000030; // type:function size:0x2C scope:global _unresolved = .text:0x00000060; // type:function size:0x4 scope:global -fn_445_70 = .text:0x00000070; // type:function size:0x70 -fn_445_E0 = .text:0x000000E0; // type:function size:0x3C -fn_445_120 = .text:0x00000120; // type:function size:0x8 -fn_445_130 = .text:0x00000130; // type:function size:0x70 -fn_445_1A0 = .text:0x000001A0; // type:function size:0x8 -fn_445_1B0 = .text:0x000001B0; // type:function size:0x12C -fn_445_2E0 = .text:0x000002E0; // type:function size:0x4 -fn_445_2F0 = .text:0x000002F0; // type:function size:0x70 +dTgHolyWater_c_classInit__Fv = .text:0x00000070; // type:function size:0x70 +create__14dTgHolyWater_cFv = .text:0x000000E0; // type:function size:0x3C +doDelete__14dTgHolyWater_cFv = .text:0x00000120; // type:function size:0x8 +actorExecute__14dTgHolyWater_cFv = .text:0x00000130; // type:function size:0x70 +draw__14dTgHolyWater_cFv = .text:0x000001A0; // type:function size:0x8 +isLinkNearby__14dTgHolyWater_cFv = .text:0x000001B0; // type:function size:0x12C +dowsingActive__14dTgHolyWater_cFv = .text:0x000002E0; // type:function size:0x4 +__dt__14dTgHolyWater_cFv = .text:0x000002F0; // type:function size:0x70 _ctors = .ctors:0x00000000; // type:label scope:global _dtors = .dtors:0x00000000; // type:label scope:global -lbl_445_rodata_0 = .rodata:0x00000000; // type:object size:0x4 data:float -lbl_445_rodata_4 = .rodata:0x00000004; // type:object size:0x4 data:float -lbl_445_rodata_8 = .rodata:0x00000008; // type:object size:0x4 data:float -lbl_445_data_0 = .data:0x00000000; // type:object size:0x10 -lbl_445_data_10 = .data:0x00000010; // type:object size:0x74 +lbl_445_rodata_0 = .rodata:0x00000000; // type:object size:0x4 scope:local data:float +lbl_445_rodata_4 = .rodata:0x00000004; // type:object size:0x4 scope:local data:float +lbl_445_rodata_8 = .rodata:0x00000008; // type:object size:0x4 scope:local data:float +g_profile_TAG_HOLY_WATER = .data:0x00000000; // type:object size:0x10 +__vt__14dTgHolyWater_c = .data:0x00000010; // type:object size:0x74 diff --git a/config/SOUE01/rels/d_t_light_shaft_effNP/symbols.txt b/config/SOUE01/rels/d_t_light_shaft_effNP/symbols.txt index fb105ef3..85d2a741 100644 --- a/config/SOUE01/rels/d_t_light_shaft_effNP/symbols.txt +++ b/config/SOUE01/rels/d_t_light_shaft_effNP/symbols.txt @@ -2,10 +2,10 @@ _prolog = .text:0x00000000; // type:function size:0x2C scope:global _epilog = .text:0x00000030; // type:function size:0x2C scope:global _unresolved = .text:0x00000060; // type:function size:0x4 scope:global dTgLightShaftEff_c_classInit__Fv = .text:0x00000070; // type:function size:0x4C -create__5dTg_cFv = .text:0x000000C0; // type:function size:0x8 -doDelete__5dTg_cFv = .text:0x000000D0; // type:function size:0x8 -actorExecute__5dTg_cFv = .text:0x000000E0; // type:function size:0x8 -draw__5dTg_cFv = .text:0x000000F0; // type:function size:0x8 +create__18dTgLightShaftEff_cFv = .text:0x000000C0; // type:function size:0x8 +doDelete__18dTgLightShaftEff_cFv = .text:0x000000D0; // type:function size:0x8 +actorExecute__18dTgLightShaftEff_cFv = .text:0x000000E0; // type:function size:0x8 +draw__18dTgLightShaftEff_cFv = .text:0x000000F0; // type:function size:0x8 __dt__18dTgLightShaftEff_cFv = .text:0x00000100; // type:function size:0x5C _ctors = .ctors:0x00000000; // type:label scope:global _dtors = .dtors:0x00000000; // type:label scope:global diff --git a/config/SOUE01/rels/d_t_map_instNP/symbols.txt b/config/SOUE01/rels/d_t_map_instNP/symbols.txt index 976fa02b..18e1a025 100644 --- a/config/SOUE01/rels/d_t_map_instNP/symbols.txt +++ b/config/SOUE01/rels/d_t_map_instNP/symbols.txt @@ -3,9 +3,9 @@ _epilog = .text:0x00000030; // type:function size:0x2C scope:global _unresolved = .text:0x00000060; // type:function size:0x4 scope:global dTgMapInst_c_classInit__Fv = .text:0x00000070; // type:function size:0x4C create__12dTgMapInst_cFv = .text:0x000000C0; // type:function size:0x10 -doDelete__5dTg_cFv = .text:0x000000D0; // type:function size:0x8 -actorExecute__5dTg_cFv = .text:0x000000E0; // type:function size:0x8 -draw__5dTg_cFv = .text:0x000000F0; // type:function size:0x8 +doDelete__12dTgMapInst_cFv = .text:0x000000D0; // type:function size:0x8 +actorExecute__12dTgMapInst_cFv = .text:0x000000E0; // type:function size:0x8 +draw__12dTgMapInst_cFv = .text:0x000000F0; // type:function size:0x8 __dt__12dTgMapInst_cFv = .text:0x00000100; // type:function size:0x5C _ctors = .ctors:0x00000000; // type:label scope:global _dtors = .dtors:0x00000000; // type:label scope:global diff --git a/config/SOUE01/rels/d_t_tackleNP/symbols.txt b/config/SOUE01/rels/d_t_tackleNP/symbols.txt index 1ab3d997..507e951c 100644 --- a/config/SOUE01/rels/d_t_tackleNP/symbols.txt +++ b/config/SOUE01/rels/d_t_tackleNP/symbols.txt @@ -2,10 +2,10 @@ _prolog = .text:0x00000000; // type:function size:0x2C scope:global _epilog = .text:0x00000030; // type:function size:0x2C scope:global _unresolved = .text:0x00000060; // type:function size:0x4 scope:global dTgTackle_c_classInit__Fv = .text:0x00000070; // type:function size:0x4C -create__5dTg_cFv = .text:0x000000C0; // type:function size:0x8 -doDelete__5dTg_cFv = .text:0x000000D0; // type:function size:0x8 -actorExecute__5dTg_cFv = .text:0x000000E0; // type:function size:0x8 -draw__5dTg_cFv = .text:0x000000F0; // type:function size:0x8 +create__11dTgTackle_cFv = .text:0x000000C0; // type:function size:0x8 +doDelete__11dTgTackle_cFv = .text:0x000000D0; // type:function size:0x8 +actorExecute__11dTgTackle_cFv = .text:0x000000E0; // type:function size:0x8 +draw__11dTgTackle_cFv = .text:0x000000F0; // type:function size:0x8 __dt__11dTgTackle_cFv = .text:0x00000100; // type:function size:0x5C _ctors = .ctors:0x00000000; // type:label scope:global _dtors = .dtors:0x00000000; // type:label scope:global diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index 68b301b9..d0ab5e5d 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -27,6 +27,9 @@ toBeSorted/file_manager.cpp: toBeSorted/save_manager.cpp: .text start:0x80011730 end:0x80015310 +toBeSorted/sound_info.cpp: + .text start:0x8002C250 end:0x8002C308 + d/a/d_a_base.cpp: .text start:0x8002C3A0 end:0x8002DE40 .data start:0x80501538 end:0x805015B8 @@ -143,6 +146,14 @@ toBeSorted/arc_managers/layout_arc_manager.cpp: .sdata start:0x80571D68 end:0x80571D70 .sbss start:0x80575288 end:0x80575290 +toBeSorted/dowsing_target.cpp: + .text start:0x80097570 end:0x80098574 + .ctors start:0x804DB6BC end:0x804DB6C0 + .rodata start:0x804E3698 end:0x804E36B8 + .data start:0x8050F550 end:0x8050F560 + .sdata2 start:0x80579640 end:0x80579670 + .bss start:0x805A2FB0 end:0x805A3010 + toBeSorted/sceneflag_manager.cpp: .text start:0x800BD8C0 end:0x800BE7A8 .sbss start:0x805753E0 end:0x805753F0 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 9f58be2c..b7c31248 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -3411,36 +3411,36 @@ fn_80097450 = .text:0x80097450; // type:function size:0x6C fn_800974C0 = .text:0x800974C0; // type:function size:0x18 fn_800974E0 = .text:0x800974E0; // type:function size:0x28 fn_80097510 = .text:0x80097510; // type:function size:0x58 -fn_80097570 = .text:0x80097570; // type:function size:0x60 -fn_800975D0 = .text:0x800975D0; // type:function size:0x68 -fn_80097640 = .text:0x80097640; // type:function size:0x4 -fn_80097650 = .text:0x80097650; // type:function size:0x4 -fn_80097660 = .text:0x80097660; // type:function size:0x4C -fn_800976B0 = .text:0x800976B0; // type:function size:0x94 -fn_80097750 = .text:0x80097750; // type:function size:0x44 -fn_800977A0 = .text:0x800977A0; // type:function size:0x70 -fn_80097810 = .text:0x80097810; // type:function size:0x70 -fn_80097880 = .text:0x80097880; // type:function size:0x70 -fn_800978F0 = .text:0x800978F0; // type:function size:0x178 -fn_80097A70 = .text:0x80097A70; // type:function size:0x70 -fn_80097AE0 = .text:0x80097AE0; // type:function size:0x70 -fn_80097B50 = .text:0x80097B50; // type:function size:0x70 -fn_80097BC0 = .text:0x80097BC0; // type:function size:0x44 -fn_80097C10 = .text:0x80097C10; // type:function size:0x44 -fn_80097C60 = .text:0x80097C60; // type:function size:0x44 -fn_80097CB0 = .text:0x80097CB0; // type:function size:0x44 -fn_80097D00 = .text:0x80097D00; // type:function size:0x44 -fn_80097D50 = .text:0x80097D50; // type:function size:0x44 -fn_80097DA0 = .text:0x80097DA0; // type:function size:0x154 -fn_80097F00 = .text:0x80097F00; // type:function size:0x32C -fn_80098230 = .text:0x80098230; // type:function size:0x4 -fn_80098240 = .text:0x80098240; // type:function size:0x4 -fn_80098250 = .text:0x80098250; // type:function size:0xBC -fn_80098310 = .text:0x80098310; // type:function size:0xCC -fn_800983E0 = .text:0x800983E0; // type:function size:0xA8 -fn_80098490 = .text:0x80098490; // type:function size:0xA8 -fn_80098540 = .text:0x80098540; // type:function size:0x20 -fn_80098560 = .text:0x80098560; // type:function size:0x14 +__dt__13DowsingTargetFv = .text:0x80097570; // type:function size:0x60 +initialize__13DowsingTargetFQ213DowsingTarget11DowsingSlotUsPC7mVec3_cf = .text:0x800975D0; // type:function size:0x68 +doRegister__13DowsingTargetFv = .text:0x80097640; // type:function size:0x4 +doUnregister__13DowsingTargetFv = .text:0x80097650; // type:function size:0x4 +reinitialize__13DowsingTargetFQ213DowsingTarget11DowsingSlot = .text:0x80097660; // type:function size:0x4C +getPosition__13DowsingTargetFR7mVec3_c = .text:0x800976B0; // type:function size:0x94 +hasZeldaDowsing__13DowsingTargetFv = .text:0x80097750; // type:function size:0x44 +hasKikwiDowsing__13DowsingTargetFv = .text:0x800977A0; // type:function size:0x70 +hasKeyPieceDowsing__13DowsingTargetFv = .text:0x80097810; // type:function size:0x70 +hasDesertNodeDowsing__13DowsingTargetFv = .text:0x80097880; // type:function size:0x70 +hasAnyTrialDowsing__13DowsingTargetFv = .text:0x800978F0; // type:function size:0x178 +hasSacredWaterDowsing__13DowsingTargetFv = .text:0x80097A70; // type:function size:0x70 +hasSandshipDowsing__13DowsingTargetFv = .text:0x80097AE0; // type:function size:0x70 +hasTadtoneDowsing__13DowsingTargetFv = .text:0x80097B50; // type:function size:0x70 +hasPropellerDowsing__13DowsingTargetFv = .text:0x80097BC0; // type:function size:0x44 +hasWaterBasinDowsing__13DowsingTargetFv = .text:0x80097C10; // type:function size:0x44 +hasCrystalBallDowsing__13DowsingTargetFv = .text:0x80097C60; // type:function size:0x44 +hasPumpkinDowsing__13DowsingTargetFv = .text:0x80097CB0; // type:function size:0x44 +hasNewPlantSpeciesDowsing__13DowsingTargetFv = .text:0x80097D00; // type:function size:0x44 +hasPartyWheelDowsing__13DowsingTargetFv = .text:0x80097D50; // type:function size:0x44 +hasDowsingInSlot__13DowsingTargetFi = .text:0x80097DA0; // type:function size:0x154 +getDowsingInfo__13DowsingTargetFRC7mVec3_cRC7mVec3_cPfPfPfi = .text:0x80097F00; // type:function size:0x32C +init__13DowsingTargetFv = .text:0x80098230; // type:function size:0x4 +execute__13DowsingTargetFv = .text:0x80098240; // type:function size:0x4 +insertDowsingTarget__FP13DowsingTarget = .text:0x80098250; // type:function size:0xBC +removeDowsingTarget__FP13DowsingTarget = .text:0x80098310; // type:function size:0xCC +getTopDowsingIcon__13DowsingTargetFv = .text:0x800983E0; // type:function size:0xA8 +getLeftDowsingIcon__13DowsingTargetFv = .text:0x80098490; // type:function size:0xA8 +__sinit_\dowsing_target_cpp = .text:0x80098540; // type:function size:0x20 scope:local +__ct__24TList<13DowsingTarget,0>Fv = .text:0x80098560; // type:function size:0x14 fn_80098580 = .text:0x80098580; // type:function size:0x40 fn_800985C0 = .text:0x800985C0; // type:function size:0x2C fn_800985F0 = .text:0x800985F0; // type:function size:0xC @@ -4152,7 +4152,7 @@ fn_800BF530 = .text:0x800BF530; // type:function size:0x78 fn_800BF5B0 = .text:0x800BF5B0; // type:function size:0x8 fn_800BF5C0 = .text:0x800BF5C0; // type:function size:0x8 fn_800BF5D0 = .text:0x800BF5D0; // type:function size:0x4 -fn_800BF5E0 = .text:0x800BF5E0; // type:function size:0x4 +getFlag__20ItemStoryManagerBaseCFUs = .text:0x800BF5E0; // type:function size:0x4 fn_800BF5F0 = .text:0x800BF5F0; // type:function size:0x4 fn_800BF600 = .text:0x800BF600; // type:function size:0x4 fn_800BF610 = .text:0x800BF610; // type:function size:0x18 @@ -17286,7 +17286,7 @@ prepend__9cListMg_cFP9cListNd_c = .text:0x802E09E0; // type:function size:0x30 fn_802E0A10 = .text:0x802E0A10; // type:function size:0x40 fn_802E0A50 = .text:0x802E0A50; // type:function size:0x5C fn_802E0AB0 = .text:0x802E0AB0; // type:function size:0x34 -fn_802E0AF0 = .text:0x802E0AF0; // type:function size:0x1BC +atan2s__2cMFff = .text:0x802E0AF0; // type:function size:0x1BC fn_802E0CB0 = .text:0x802E0CB0; // type:function size:0x48 fn_802E0D00 = .text:0x802E0D00; // type:function size:0x8 rnd__2cMFv = .text:0x802E0D10; // type:function size:0x8 @@ -17869,7 +17869,7 @@ fn_802F2780 = .text:0x802F2780; // type:function size:0x198 fn_802F2920 = .text:0x802F2920; // type:function size:0x48 fn_802F2970 = .text:0x802F2970; // type:function size:0x110 fn_802F2A80 = .text:0x802F2A80; // type:function size:0xF0 -fn_802F2B70 = .text:0x802F2B70; // type:function size:0x78 +normalize__7mVec3_cFv = .text:0x802F2B70; // type:function size:0x78 fn_802F2BF0 = .text:0x802F2BF0; // type:function size:0x84 fn_802F2C80 = .text:0x802F2C80; // type:function size:0xA8 fn_802F2D30 = .text:0x802F2D30; // type:function size:0xAC @@ -28208,7 +28208,7 @@ lbl_804E34CC = .rodata:0x804E34CC; // type:object size:0x3C data:4byte lbl_804E3508 = .rodata:0x804E3508; // type:object size:0x58 data:4byte lbl_804E3560 = .rodata:0x804E3560; // type:object size:0x20 data:4byte lbl_804E3580 = .rodata:0x804E3580; // type:object size:0x118 data:4byte -lbl_804E3698 = .rodata:0x804E3698; // type:object size:0x20 +DOWSING_TARGET_STORY_FLAGS = .rodata:0x804E3698; // type:object size:0x20 lbl_804E36B8 = .rodata:0x804E36B8; // type:object size:0x10 data:4byte lbl_804E36C8 = .rodata:0x804E36C8; // type:object size:0x24 data:4byte lbl_804E36EC = .rodata:0x804E36EC; // type:object size:0xC data:4byte @@ -30871,7 +30871,7 @@ lbl_8050F4F8 = .data:0x8050F4F8; // type:object size:0x30 lbl_8050F528 = .data:0x8050F528; // type:object size:0xC lbl_8050F534 = .data:0x8050F534; // type:object size:0xC lbl_8050F540 = .data:0x8050F540; // type:object size:0x10 data:4byte -lbl_8050F550 = .data:0x8050F550; // type:object size:0x10 +__vt__13DowsingTarget = .data:0x8050F550; // type:object size:0x10 lbl_8050F560 = .data:0x8050F560; // type:object size:0xC data:string lbl_8050F56C = .data:0x8050F56C; // type:object size:0x12C lbl_8050F698 = .data:0x8050F698; // type:object size:0x20 @@ -39907,8 +39907,8 @@ sTempFlags__16SceneflagManager = .sbss:0x805753E8; // type:object size:0x8 sInstance__15TBoxFlagManager = .sbss:0x805753F0; // type:object size:0x4 data:4byte sTBoxFlags__15TBoxFlagManager = .sbss:0x805753F4; // type:object size:0x4 sInstance__18EnemyDefeatManager = .sbss:0x805753F8; // type:object size:0x4 data:4byte -lbl_805753FC = .sbss:0x805753FC; // type:object size:0x4 data:4byte -lbl_80575400 = .sbss:0x80575400; // type:object size:0x4 data:4byte +sInstance__16StoryFlagManager = .sbss:0x805753FC; // type:object size:0x4 data:4byte +sInstance__15ItemFlagManager = .sbss:0x80575400; // type:object size:0x4 data:4byte lbl_80575404 = .sbss:0x80575404; // type:object size:0x4 data:4byte sInstance__15SkipflagManager = .sbss:0x80575408; // type:object size:0x4 data:4byte lbl_80575410 = .sbss:0x80575410; // type:object size:0x8 data:4byte @@ -48266,7 +48266,7 @@ lbl_805A2F18 = .bss:0x805A2F18; // type:object size:0x40 lbl_805A2F58 = .bss:0x805A2F58; // type:object size:0x10 lbl_805A2F68 = .bss:0x805A2F68; // type:object size:0x30 lbl_805A2F98 = .bss:0x805A2F98; // type:object size:0x18 -lbl_805A2FB0 = .bss:0x805A2FB0; // type:object size:0x60 +DOWSING_LISTS = .bss:0x805A2FB0; // type:object size:0x60 lbl_805A3010 = .bss:0x805A3010; // type:object size:0x18 lbl_805A3028 = .bss:0x805A3028; // type:object size:0xF78 data:byte lbl_805A3FA0 = .bss:0x805A3FA0; // type:object size:0x4C8 @@ -48789,7 +48789,7 @@ lbl_805B3760 = .bss:0x805B3760; // type:object size:0x80 lbl_805B37E0 = .bss:0x805B37E0; // type:object size:0xC lbl_805B37EC = .bss:0x805B37EC; // type:object size:0x40 data:4byte lbl_805B382C = .bss:0x805B382C; // type:object size:0x34 data:4byte -lbl_805B3860 = .bss:0x805B3860; // type:object size:0x2C data:4byte +currentSpawnInfo__6ScGame = .bss:0x805B3860; // type:object size:0x2C data:4byte lbl_805B388C = .bss:0x805B388C; // type:object size:0x2C data:byte lbl_805B38B8 = .bss:0x805B38B8; // type:object size:0x50 lbl_805B3908 = .bss:0x805B3908; // type:object size:0x40 data:4byte @@ -49135,10 +49135,10 @@ lbl_805CB0C8 = .bss:0x805CB0C8; // type:object size:0xC g_PadAdditionalData__4mPad = .bss:0x805CB0D8; // type:object size:0x60 data:float s_WPADInfo__4mPad = .bss:0x805CB138; // type:object size:0x60 s_WPADInfoTmp__4mPad = .bss:0x805CB198; // type:object size:0x60 -lbl_805CB1F8 = .bss:0x805CB1F8; // type:object size:0xC data:float -lbl_805CB204 = .bss:0x805CB204; // type:object size:0xC data:float -lbl_805CB210 = .bss:0x805CB210; // type:object size:0xC data:float -lbl_805CB21C = .bss:0x805CB21C; // type:object size:0xC data:float +Zero__7mVec3_c = .bss:0x805CB1F8; // type:object size:0xC data:float +Ex__7mVec3_c = .bss:0x805CB204; // type:object size:0xC data:float +Ey__7mVec3_c = .bss:0x805CB210; // type:object size:0xC data:float +Ez__7mVec3_c = .bss:0x805CB21C; // type:object size:0xC data:float lbl_805CB228 = .bss:0x805CB228; // type:object size:0x8 data:4byte lbl_805CB230 = .bss:0x805CB230; // type:object size:0xC8 lbl_805CB2F8 = .bss:0x805CB2F8; // type:object size:0xC0 diff --git a/configure.py b/configure.py index 240f3ca6..0e401820 100644 --- a/configure.py +++ b/configure.py @@ -319,11 +319,13 @@ def nw4rLib(lib_name, objects, extra_cflags=[]): Object(Matching, "d/d_rawarchive.cpp"), Object(NonMatching, "d/d_stage.cpp"), Object(NonMatching, "d/d_sys.cpp"), + Object(NonMatching, "toBeSorted/sound_info.cpp"), Object(NonMatching, "d/a/d_a_base.cpp"), Object(NonMatching, "d/a/obj/d_a_obj_base.cpp"), Object(Matching, "toBeSorted/arc_managers/current_stage_arc_manager.cpp"), Object(Matching, "toBeSorted/arc_managers/oarc_manager.cpp"), Object(Matching, "toBeSorted/arc_managers/layout_arc_manager.cpp"), + Object(NonMatching, "toBeSorted/dowsing_target.cpp"), Object(Matching, "toBeSorted/save_file.cpp"), Object(Matching, "toBeSorted/counters/counter.cpp"), Object(Matching, "toBeSorted/counters/rupee_counter.cpp"), @@ -1092,7 +1094,7 @@ def nw4rLib(lib_name, objects, extra_cflags=[]): Rel(NonMatching, "d_t_col_bomb_shield", "REL/d/t/d_t_col_bomb_shield.cpp"), Rel(NonMatching, "d_t_D3_scene_change", "REL/d/t/d_t_D3_scene_change.cpp"), Rel(NonMatching, "d_t_defeat_boss", "REL/d/t/d_t_defeat_boss.cpp"), - Rel(NonMatching, "d_t_dowsing", "REL/d/t/d_t_dowsing.cpp"), + Rel(Matching, "d_t_dowsing", "REL/d/t/d_t_dowsing.cpp"), Rel(NonMatching, "d_t_drum", "REL/d/t/d_t_drum.cpp"), Rel(NonMatching, "d_t_dungeon_start", "REL/d/t/d_t_dungeon_start.cpp"), Rel(NonMatching, "d_t_effect_gen", "REL/d/t/d_t_effect_gen.cpp"), @@ -1100,12 +1102,12 @@ def nw4rLib(lib_name, objects, extra_cflags=[]): Rel(NonMatching, "d_t_fence_synchronizer", "REL/d/t/d_t_fence_synchronizer.cpp"), Rel(NonMatching, "d_t_gate_to_ground", "REL/d/t/d_t_gate_to_ground.cpp"), Rel(NonMatching, "d_t_gekotag", "REL/d/t/d_t_gekotag.cpp"), - Rel(NonMatching, "d_t_genki_dws_tgt", "REL/d/t/d_t_genki_dws_tgt.cpp"), + Rel(Matching, "d_t_genki_dws_tgt", "REL/d/t/d_t_genki_dws_tgt.cpp"), Rel(NonMatching, "d_t_group_summon", "REL/d/t/d_t_group_summon.cpp"), Rel(NonMatching, "d_t_group_test", "REL/d/t/d_t_group_test.cpp"), Rel(NonMatching, "d_t_harp", "REL/d/t/d_t_harp.cpp"), Rel(NonMatching, "d_t_heat_resist", "REL/d/t/d_t_heat_resist.cpp"), - Rel(NonMatching, "d_t_holy_water", "REL/d/t/d_t_holy_water.cpp"), + Rel(Matching, "d_t_holy_water", "REL/d/t/d_t_holy_water.cpp"), Rel(NonMatching, "d_t_insect", "REL/d/t/d_t_insect.cpp"), Rel(NonMatching, "d_t_ks", "REL/d/t/d_t_ks.cpp"), Rel(NonMatching, "d_t_kytag", "REL/d/t/d_t_kytag.cpp"), diff --git a/include/d/a/d_a_base.h b/include/d/a/d_a_base.h index 46072cb0..659a3d59 100644 --- a/include/d/a/d_a_base.h +++ b/include/d/a/d_a_base.h @@ -10,6 +10,7 @@ #include "m/m_angle.h" #include "m/m_vec.h" #include "toBeSorted/room_manager.h" +#include "toBeSorted/tlist.h" class dAcBase_c; @@ -60,21 +61,6 @@ class dAcRef_c : dAcRefBase_c { } }; -template -struct TList { - T *GetOffset() { - return (T *)((u8 *)this - offset); - } - TList() { - sound_info_next = GetOffset(); - sound_info_tail = GetOffset(); - count = 0; - } - T *sound_info_tail; - T *sound_info_next; - s32 count; -}; - // Ghidra: ActorBase // size: 0xFC // non-official name diff --git a/include/d/d_player.h b/include/d/d_player.h index cc99016f..7477b0a9 100644 --- a/include/d/d_player.h +++ b/include/d/d_player.h @@ -7,9 +7,9 @@ class dPlayer: public dAcObjBase_c { public: /* 0x330 */ u8 unk_0x330[0x350 - 0x330]; - /* 0x350 */ u32 someFlags; - - + /* 0x350 */ u32 someFlags_0x350; + u8 UNK_0x354[0x35C - 0x354]; + /* 0x35C */ u32 mForceOrPreventActionFlags; static dPlayer *LINK; }; diff --git a/include/d/tg/d_t_dowsing.h b/include/d/tg/d_t_dowsing.h new file mode 100644 index 00000000..21a583a1 --- /dev/null +++ b/include/d/tg/d_t_dowsing.h @@ -0,0 +1,66 @@ +#ifndef D_T_DOWSING_H +#define D_T_DOWSING_H + +#include +#include + +class dTgDowsing_c : public dTg_c { +public: + dTgDowsing_c(); + virtual ~dTgDowsing_c() {} + + virtual int create() override; + virtual int doDelete() override; + virtual int actorExecute() override; + virtual int draw() override; + + bool checkDowsing() const; + +private: + enum DowsingOption { + TRIAL_0, + TRIAL_1, + TRIAL_2, + TRIAL_3, + PROPELLER, + WATER_BASIN, + CRYSTAL_BALL, + PUMPKIN, + NEW_PLANT_SPECIES, + PARTY_WHEEL, + ZELDA, + DOWSING_MAX + }; + + DowsingTarget mDowsingTarget; // 0x0FC + DowsingOption mDowsingOption; // 0x11C + u16 mUntriggerStoryFlag; // 0x120 + u16 mTriggerStoryFlag; // 0x122 + bool mTargetActive; // 0x124 + + u16 getTriggerSceneFlag() { + return params & 0xFF; + } + + u16 getUntriggerSceneFlag() { + return params >> 0x8 & 0xFF; + } + + DowsingOption getDowsingOption() { + return (DowsingOption)(params >> 0x10 & 0xF); + } + + u32 getDowsingOptionNum() { + return mDowsingOption; + } + + u16 getUntriggerStoryFlag() { + return params >> 0x14 & 0x7FF; + } + + u16 getTriggerStoryFlag() { + return rotation.z.mVal & 0x7FF; + } +}; + +#endif diff --git a/include/d/tg/d_t_genki_dws_tgt.h b/include/d/tg/d_t_genki_dws_tgt.h new file mode 100644 index 00000000..b6d9899f --- /dev/null +++ b/include/d/tg/d_t_genki_dws_tgt.h @@ -0,0 +1,23 @@ +#ifndef D_T_GENKI_DWS_TGT_H +#define D_T_GENKI_DWS_TGT_H + +#include +#include + +class dTgGenkiDwsTgt_c : public dTg_c { +public: + dTgGenkiDwsTgt_c() : mDowsingTarget(this, DowsingTarget::SLOT_NONE) {} + virtual ~dTgGenkiDwsTgt_c() {} + + virtual int create() override; + virtual int doDelete() override; + virtual int actorExecute() override; + + +private: + u16 getSceneFlagFromParams(); + + DowsingTarget mDowsingTarget; // 0xFC +}; + +#endif diff --git a/include/d/tg/d_t_holy_water.h b/include/d/tg/d_t_holy_water.h new file mode 100644 index 00000000..fd6bacfe --- /dev/null +++ b/include/d/tg/d_t_holy_water.h @@ -0,0 +1,24 @@ +#ifndef D_T_HOLY_WATER_H +#define D_T_HOLY_WATER_H + +#include +#include + +class dTgHolyWater_c : public dTg_c { +public: + dTgHolyWater_c() : mDowsingTarget(this, DowsingTarget::SLOT_NONE) {} + virtual ~dTgHolyWater_c() {} + + virtual int create() override; + virtual int doDelete() override; + virtual int actorExecute() override; + virtual int draw() override; + + bool isLinkNearby(); + bool dowsingActive(); + +private: + DowsingTarget mDowsingTarget; // 0x0FC +}; + +#endif diff --git a/include/d/tg/d_t_light_shaft_eff.h b/include/d/tg/d_t_light_shaft_eff.h index 18928aad..d3d8a35f 100644 --- a/include/d/tg/d_t_light_shaft_eff.h +++ b/include/d/tg/d_t_light_shaft_eff.h @@ -7,6 +7,11 @@ class dTgLightShaftEff_c : public dTg_c { public: dTgLightShaftEff_c() {} virtual ~dTgLightShaftEff_c() {} + + virtual int create() override; + virtual int doDelete() override; + virtual int actorExecute() override; + virtual int draw() override; }; #endif diff --git a/include/d/tg/d_t_map_inst.h b/include/d/tg/d_t_map_inst.h index 855cc6c0..f5545962 100644 --- a/include/d/tg/d_t_map_inst.h +++ b/include/d/tg/d_t_map_inst.h @@ -9,6 +9,9 @@ class dTgMapInst_c : public dTg_c { virtual ~dTgMapInst_c() {} virtual int create() override; + virtual int doDelete() override; + virtual int actorExecute() override; + virtual int draw() override; u8 field_0xfc; }; diff --git a/include/d/tg/d_t_tackle.h b/include/d/tg/d_t_tackle.h index c325c7bb..aba9f97c 100644 --- a/include/d/tg/d_t_tackle.h +++ b/include/d/tg/d_t_tackle.h @@ -7,6 +7,11 @@ class dTgTackle_c : public dTg_c { public: dTgTackle_c() {} virtual ~dTgTackle_c() {} + + virtual int create() override; + virtual int doDelete() override; + virtual int actorExecute() override; + virtual int draw() override; }; #endif diff --git a/include/d/tg/d_tg.h b/include/d/tg/d_tg.h index ceb14579..6f8f519e 100644 --- a/include/d/tg/d_tg.h +++ b/include/d/tg/d_tg.h @@ -6,18 +6,6 @@ class dTg_c : public dAcBase_c { public: virtual ~dTg_c() {} - virtual int draw() override { - return 1; - } - virtual int actorExecute() override { - return 1; - } - virtual int doDelete() override { - return 1; - } - virtual int create() override { - return 1; - } }; #endif diff --git a/include/m/m_vec.h b/include/m/m_vec.h index f7ba025d..1009f7a1 100644 --- a/include/m/m_vec.h +++ b/include/m/m_vec.h @@ -122,7 +122,7 @@ class mVec3_c : public EGG::Vector3f { /// @brief Scalar product operator. mVec3_c operator*(f32 f) const { - return mVec3_c(f * x, f * y, f * z); + return mVec3_c(x * f, y * f, z * f); } /// @brief Scalar division operator. @@ -140,6 +140,18 @@ class mVec3_c : public EGG::Vector3f { bool operator!=(const mVec3_c &v) const { return x != v.x || y != v.y || z != v.z; } + + void normalize(); + bool normalizeRS(); + + inline f32 mag() const { + return PSVECMag(*this); + } + + static mVec3_c Zero; + static mVec3_c Ex; + static mVec3_c Ey; + static mVec3_c Ez; }; #endif diff --git a/include/toBeSorted/dowsing_target.h b/include/toBeSorted/dowsing_target.h new file mode 100644 index 00000000..a157cbae --- /dev/null +++ b/include/toBeSorted/dowsing_target.h @@ -0,0 +1,71 @@ +#ifndef DOWSING_TARGET_H +#define DOWSING_TARGET_H + +#include +#include +#include + +class DowsingTarget { +public: + TListNode mLink; // 0x00 +private: + dAcBase_c *mpActor; // 0x08 + u8 mDowsingSlot; // 0x0C + u16 field_0x0E; // 0x0E + mVec3_c mOffset; // 0x10 + +public: + enum DowsingSlot { + SLOT_STORY_EVENT = 0, + SLOT_RUPEE = 1, + SLOT_QUEST = 2, + SLOT_CRYSTAL = 3, + SLOT_HEART = 4, + SLOT_GODDESS_CUBE = 5, + SLOT_LOOK = 6, + SLOT_TREASURE = 7, + SLOT_NONE = 8, + }; + + DowsingTarget(dAcBase_c *ac, u8 dowsingSlot) : mpActor(ac), mDowsingSlot(dowsingSlot) {} + // vt offset 0x1C + virtual ~DowsingTarget(); // 0x08 + virtual void getPosition(mVec3_c &); // 0x0C + + bool doRegister(); + bool doUnregister(); + void initialize(DowsingSlot type, u16 unk, const mVec3_c *offset, f32 f); + void reinitialize(DowsingSlot type); + + inline DowsingSlot getSlot() { + return (DowsingSlot)mDowsingSlot; + } + + static bool hasZeldaDowsing(); + static bool hasKikwiDowsing(); + static bool hasKeyPieceDowsing(); + static bool hasDesertNodeDowsing(); + static bool hasAnyTrialDowsing(); + static bool hasSacredWaterDowsing(); + static bool hasSandshipDowsing(); + static bool hasTadtoneDowsing(); + static bool hasPropellerDowsing(); + static bool hasWaterBasinDowsing(); + static bool hasCrystalBallDowsing(); + static bool hasPumpkinDowsing(); + static bool hasNewPlantSpeciesDowsing(); + static bool hasPartyWheelDowsing(); + + static bool hasDowsingInSlot(int slot); + + static DowsingTarget *getDowsingInfo(const mVec3_c &playerPosition, const mVec3_c &dowsingDirection, f32 *, f32 *, + f32 *intensity, int slot); + + static void init(); + static void execute(); + + static u8 getTopDowsingIcon(); + static u8 getLeftDowsingIcon(); +}; + +#endif diff --git a/include/toBeSorted/item_story_flag_manager.h b/include/toBeSorted/item_story_flag_manager.h new file mode 100644 index 00000000..b2eaf6f8 --- /dev/null +++ b/include/toBeSorted/item_story_flag_manager.h @@ -0,0 +1,46 @@ +#ifndef ITEM_STORY_FLAG_MANAGER_H +#define ITEM_STORY_FLAG_MANAGER_H + +#include +#include + +// TODO These classes have an interesting relation and there are like 5 vtables, so +// the stuff in this header should not be relied upon for actually implementing these, +// but we need the interface + +class ItemStoryManagerBase { +public: + ItemStoryManagerBase(); + + /** 0x08 */ virtual ~ItemStoryManagerBase(); + /** 0x0C */ virtual void setFlagszptr(); + /** 0x10 */ virtual void onDirty(); + /** 0x14 */ virtual void copyFlagsFromSave() = 0; + /** 0x18 */ virtual void setupUnkFlagsStuff() = 0; + /** 0x1C */ virtual bool doCommit() = 0; + /** 0x20 */ virtual void setFlag(u16 flag); + /** 0x24 */ virtual void unsetFlag(u16 flag); + /** 0x28 */ virtual void setFlagOrCounterToValue(u16 flag, u16 value); + /** 0x2C */ virtual u16 getCounterOrFlag(u16 flag) const; + /** 0x30 */ virtual u16 getUncommittedValue(u16 flag); + /** 0x34 */ virtual void unk3(); + /** 0x38 */ virtual u16 *getSaveFlagSpace() = 0; + + u16 getFlag(u16 flag) const; +}; + +class StoryFlagManager : public ItemStoryManagerBase { + FlagSpace storyFlags; + +public: + static StoryFlagManager *sInstance; +}; + +class ItemFlagManager : public ItemStoryManagerBase { + FlagSpace itemFlags; + +public: + static ItemFlagManager *sInstance; +}; + +#endif diff --git a/include/toBeSorted/room_manager.h b/include/toBeSorted/room_manager.h index c4c19821..5e17f25c 100644 --- a/include/toBeSorted/room_manager.h +++ b/include/toBeSorted/room_manager.h @@ -21,7 +21,7 @@ class dRoomCollision { char todo[352]; }; -class dRoom : dBase_c { +class dRoom : public dBase_c { public: mAllocator_c allocator; nw4r::g3d::ResFile *roomRes; @@ -94,8 +94,8 @@ class RoomManager : public dBase_c { /* 80575760 */ static RoomManager *m_Instance; public: - dRoom *GetRoomByIndex(int roomid); - /* 801b42b0 */ static dBase_c *getRoom(int roomid); + /* 801b3970 */ dRoom *GetRoomByIndex(int roomid); + /* 801b42b0 */ static dRoom *getRoom(int roomid); /* 801b42d0 */ static void bindStageResToFile(nw4r::g3d::ResFile *); /* 801b4320 */ static void bindSkyCmnToResFile(nw4r::g3d::ResFile *); /* 801b4380 */ static bool getMA0AnmTexSrt(nw4r::g3d::ResAnmTexSrt *, char *); diff --git a/include/toBeSorted/sceneflag_manager.h b/include/toBeSorted/sceneflag_manager.h index bb2106e6..a8fe5112 100644 --- a/include/toBeSorted/sceneflag_manager.h +++ b/include/toBeSorted/sceneflag_manager.h @@ -58,6 +58,11 @@ class SceneflagManager { void unsetSceneflagGlobal(u16 sceneIdx, u16 flag); void unsetTempOrSceneflag(u16 flag); s32 doCommit(); + + + bool checkBoolFlag(u16 roomid, u16 flag) { + return checkFlag(roomid, flag); + } }; #endif diff --git a/include/toBeSorted/scgame.h b/include/toBeSorted/scgame.h index aa465d4a..229c0e7a 100644 --- a/include/toBeSorted/scgame.h +++ b/include/toBeSorted/scgame.h @@ -13,6 +13,10 @@ struct SpawnInfo { /* 0x26 */ s8 trial; /* 0x27 */ s8 transitionType; /* 0x28 */ s32 unk; + + bool isNight() { + return night == 1; + } }; class ScGame { diff --git a/include/toBeSorted/tlist.h b/include/toBeSorted/tlist.h new file mode 100644 index 00000000..9d62beb2 --- /dev/null +++ b/include/toBeSorted/tlist.h @@ -0,0 +1,130 @@ +#ifndef T_LIST_H +#define T_LIST_H + +// A templated list, similar to nw4r::ut::LinkList. +// Notable differences are: +// * No dtor +// * Entirely in headers +// * Swapped node and count members +// Used in DowsingTarget, maybe also in dAcBase_c.soundStuff + +// It's not immediately clear whether this stores pointers to nodes +// or pointers to objects. DowsingTarget's node offset is 0, so there's +// no observable difference, but the SoundSource stuff makes it +// look like it stores object pointers + +class TListNode { +public: + TListNode() : mpPrev(nullptr), mpNext(nullptr) {} + + void *GetNext() const { + return mpNext; + } + void *GetPrev() const { + return mpPrev; + } + void *mpPrev; + void *mpNext; +}; + +template +class TList { +public: + class Iterator { + public: + Iterator() : mNode(NULL) {} + Iterator(TListNode *node) : mNode(node) {} + + Iterator &operator++() { + mNode = GetNodeFromPointer(mNode->GetNext()); + return *this; + } + + Iterator &operator--() { + mNode = mNode->GetPrev(); + return *this; + } + + T *operator->() const { + return GetPointerFromNode(mNode); + } + + T &operator*() { + return *this->operator->(); + } + + friend bool operator==(Iterator lhs, Iterator rhs) { + return lhs.mNode == rhs.mNode; + } + + friend bool operator!=(Iterator lhs, Iterator rhs) { + return !(lhs.mNode == rhs.mNode); + } + + private: + TListNode *mNode; // at 0x0 + }; + + TList() { + this->mNode.mpNext = GetPointerFromNode(&mNode); + this->mNode.mpPrev = GetPointerFromNode(&mNode); + mCount = 0; + } + + Iterator GetBeginIter() { + return GetNodeFromPointer(&mNode) != mNode.GetNext() ? Iterator(GetNodeFromPointer(mNode.GetNext())) : + Iterator(&mNode); + } + Iterator GetEndIter() { + return Iterator(&mNode); + } + + static TListNode *GetNodeFromPointer(void *p) { + return reinterpret_cast(reinterpret_cast(p) + offset); + } + + static T *GetPointerFromNode(TListNode *node) { + return reinterpret_cast(reinterpret_cast(node) - offset); + } + + void insert(T *value) { + TListNode *node = GetNodeFromPointer(value); + if (GetPointerFromNode(&mNode) == this->mNode.mpNext) { + node->mpNext = GetPointerFromNode(&mNode); + node->mpPrev = GetPointerFromNode(&mNode); + this->mNode.mpNext = value; + this->mNode.mpPrev = value; + mCount++; + } else { + node->mpPrev = this->mNode.mpPrev; + node->mpNext = GetPointerFromNode(&mNode); + GetNodeFromPointer(this->mNode.mpPrev)->mpNext = value; + this->mNode.mpPrev = value; + mCount++; + } + } + + void remove(T *value) { + TListNode *node = GetNodeFromPointer(value); + T *next = reinterpret_cast(node->mpNext); + if (GetPointerFromNode(&mNode) == node->mpPrev) { + this->mNode.mpNext = next; + } else { + GetNodeFromPointer(node->mpPrev)->mpNext = next; + } + + if (GetPointerFromNode(&mNode) == node->mpNext) { + this->mNode.mpPrev = node->mpPrev; + } else { + GetNodeFromPointer(node->mpNext)->mpPrev = node->mpPrev; + } + node->mpPrev = nullptr; + node->mpNext = nullptr; + mCount--; + } + + TListNode mNode; + s32 mCount; +}; + +#endif diff --git a/src/REL/d/a/d_a_t_wood_area.cpp b/src/REL/d/a/d_a_t_wood_area.cpp index 43921e3a..2bf155e4 100644 --- a/src/REL/d/a/d_a_t_wood_area.cpp +++ b/src/REL/d/a/d_a_t_wood_area.cpp @@ -56,7 +56,7 @@ extern u16 PARTICLE_RESOURCE_ID_MAPPING[]; void dAcTWoodArea_c::initializeState_Wait() {} void dAcTWoodArea_c::executeState_Wait() { - if (dPlayer::LINK != nullptr && (dPlayer::LINK->someFlags & 0x2000)) { + if (dPlayer::LINK != nullptr && (dPlayer::LINK->someFlags_0x350 & 0x2000)) { // This is a bit messed up mVec3_c dist = position - dPlayer::LINK->position; f32 attachRadius = getAttachRadius(); diff --git a/src/REL/d/t/d_t_dowsing.cpp b/src/REL/d/t/d_t_dowsing.cpp index e69de29b..9a664f63 100644 --- a/src/REL/d/t/d_t_dowsing.cpp +++ b/src/REL/d/t/d_t_dowsing.cpp @@ -0,0 +1,81 @@ +#include +#include +#include +#include + +SPECIAL_ACTOR_PROFILE(T_DOWSING, dTgDowsing_c, fProfile::T_DOWSING, 0x0293, 0, 0); + +dTgDowsing_c::dTgDowsing_c() : mDowsingTarget(this, DowsingTarget::SLOT_NONE) {} + +int dTgDowsing_c::create() { + mDowsingOption = getDowsingOption(); + if (mDowsingOption > 11) { + mDowsingOption = DOWSING_MAX; + } + mUntriggerStoryFlag = getUntriggerStoryFlag(); + mTriggerStoryFlag = getTriggerStoryFlag(); + rotation.z = 0; + bool doThing = getDowsingOptionNum() <= DOWSING_MAX && (1 << getDowsingOptionNum() & 0xC3F) != 0; + + mDowsingTarget.initialize(!doThing ? DowsingTarget::SLOT_QUEST : DowsingTarget::SLOT_STORY_EVENT, 0, nullptr, 0); + mTargetActive = false; + return SUCCEEDED; +} + +int dTgDowsing_c::doDelete() { + return 1; +} + +int dTgDowsing_c::actorExecute() { + if (getTriggerSceneFlag() < 0xFF && SceneflagManager::sInstance->checkBoolFlag(roomid, getTriggerSceneFlag()) || + getUntriggerSceneFlag() < 0xFF && + !SceneflagManager::sInstance->checkBoolFlag(roomid, getUntriggerSceneFlag()) || + !checkDowsing()) { + mDowsingTarget.doUnregister(); + mTargetActive = false; + } else if (!mTargetActive && checkDowsing()) { + mDowsingTarget.doRegister(); + mTargetActive = true; + } + return 1; +} + +int dTgDowsing_c::draw() { + return 1; +} + +bool dTgDowsing_c::checkDowsing() const { + if (!((mUntriggerStoryFlag == 0 || mUntriggerStoryFlag >= 0x7FF || + !StoryFlagManager::sInstance->getCounterOrFlag(mUntriggerStoryFlag)) && + (mTriggerStoryFlag == 0 || mTriggerStoryFlag >= 0x7FF || + StoryFlagManager::sInstance->getCounterOrFlag(mTriggerStoryFlag)))) { + return false; + } + + switch (mDowsingOption) { + case TRIAL_0: + return ItemFlagManager::sInstance->getFlag(187) && !StoryFlagManager::sInstance->getCounterOrFlag(93); + case TRIAL_1: + return ItemFlagManager::sInstance->getFlag(188) && !StoryFlagManager::sInstance->getCounterOrFlag(97); + case TRIAL_2: + return ItemFlagManager::sInstance->getFlag(189) && !StoryFlagManager::sInstance->getCounterOrFlag(98); + case TRIAL_3: + return ItemFlagManager::sInstance->getFlag(193) && !StoryFlagManager::sInstance->getCounterOrFlag(99); + case PROPELLER: + return DowsingTarget::hasPropellerDowsing(); + case WATER_BASIN: + return DowsingTarget::hasWaterBasinDowsing(); + case CRYSTAL_BALL: + return DowsingTarget::hasCrystalBallDowsing(); + case PUMPKIN: + return DowsingTarget::hasPumpkinDowsing(); + case NEW_PLANT_SPECIES: + return DowsingTarget::hasNewPlantSpeciesDowsing(); + case PARTY_WHEEL: + return DowsingTarget::hasPartyWheelDowsing(); + case ZELDA: + return DowsingTarget::hasZeldaDowsing(); + default: + return true; + } +} diff --git a/src/REL/d/t/d_t_genki_dws_tgt.cpp b/src/REL/d/t/d_t_genki_dws_tgt.cpp index e69de29b..550eb670 100644 --- a/src/REL/d/t/d_t_genki_dws_tgt.cpp +++ b/src/REL/d/t/d_t_genki_dws_tgt.cpp @@ -0,0 +1,69 @@ +#include +#include +#include +#include +#include + +SPECIAL_ACTOR_PROFILE(TAG_GENKI_DOWSING_TARGET, dTgGenkiDwsTgt_c, fProfile::TAG_GENKI_DOWSING_TARGET, 0x02A5, 0, 0); + +int dTgGenkiDwsTgt_c::create() { + u16 batQuestActivated = StoryFlagManager::sInstance->getCounterOrFlag(304); + if (batQuestActivated == 0 || !ScGame::sInstance->currentSpawnInfo.isNight()) { + return FAILED; + } + + u16 flag = getSceneFlagFromParams(); + if (flag < 0xFF) { + bool flagSet = SceneflagManager::sInstance->checkFlag(roomid, flag); + if (flagSet) { + return FAILED; + } + } else { + return FAILED; + } + + + int roomId_tmp = roomid; + if (addActorToRoom(-1)) { + roomid = roomId_tmp; + changeLoadedEntitiesWithSet(); + } else { + return FAILED; + } + scale.x = 1.0f; + scale.y = 1.0f; + scale.z = 1.0f; + + static mVec3_c offset(0.0f, 25.0f, 0.0f); + mDowsingTarget.initialize(DowsingTarget::SLOT_CRYSTAL, 0, &offset, 1.0f); + return SUCCEEDED; +} + +int dTgGenkiDwsTgt_c::doDelete() { + changeLoadedEntitiesNoSet(); + return 1; +} + +int dTgGenkiDwsTgt_c::actorExecute() { + bool flag = SceneflagManager::sInstance->checkFlag(roomid, getSceneFlagFromParams()); + if (flag) { + deleteRequest(); + } else { + RoomManager *mgr = RoomManager::m_Instance; + if (mgr != nullptr) { + dRoom *room = RoomManager::m_Instance->GetRoomByIndex(roomid); + if (room != nullptr) { + if (room->flags & 8) { + mDowsingTarget.doRegister(); + } else { + mDowsingTarget.doUnregister(); + } + } + } + } + return 1; +} + +u16 dTgGenkiDwsTgt_c::getSceneFlagFromParams() { + return params & 0xFF; +} diff --git a/src/REL/d/t/d_t_holy_water.cpp b/src/REL/d/t/d_t_holy_water.cpp index e69de29b..ebc49f6e 100644 --- a/src/REL/d/t/d_t_holy_water.cpp +++ b/src/REL/d/t/d_t_holy_water.cpp @@ -0,0 +1,41 @@ +#include +#include + +SPECIAL_ACTOR_PROFILE(TAG_HOLY_WATER, dTgHolyWater_c, fProfile::TAG_HOLY_WATER, 0x0224, 0, 4); + +int dTgHolyWater_c::create() { + mDowsingTarget.initialize(DowsingTarget::SLOT_STORY_EVENT, 0, nullptr, 0.0f); + return SUCCEEDED; +} + +int dTgHolyWater_c::doDelete() { + return 1; +} + +int dTgHolyWater_c::actorExecute() { + if (dowsingActive()) { + mDowsingTarget.doRegister(); + } else { + mDowsingTarget.doUnregister(); + } + if (isLinkNearby()) { + dPlayer::LINK->mForceOrPreventActionFlags |= 0x10000000; + } + return 1; +} + +int dTgHolyWater_c::draw() { + return 1; +} + +bool dTgHolyWater_c::isLinkNearby() { + mVec3_c diff = dPlayer::LINK->position - (position + mVec3_c::Ey * scale.y * 0.5f); + diff.x /= scale.x; + diff.y /= scale.y; + diff.z /= scale.z; + return diff.x <= 0.5f && diff.x >= -0.5f && diff.y <= 0.5f && diff.y >= -0.5f && diff.z <= 0.5f && diff.z >= -0.5f; +} + +bool dTgHolyWater_c::dowsingActive() { + return DowsingTarget::hasSacredWaterDowsing(); +} diff --git a/src/REL/d/t/d_t_light_shaft_eff.cpp b/src/REL/d/t/d_t_light_shaft_eff.cpp index 2c5158ae..5fcad377 100644 --- a/src/REL/d/t/d_t_light_shaft_eff.cpp +++ b/src/REL/d/t/d_t_light_shaft_eff.cpp @@ -2,4 +2,18 @@ SPECIAL_ACTOR_PROFILE(TAG_LIGHT_SHAFT_EFF, dTgLightShaftEff_c, fProfile::TAG_LIGHT_SHAFT_EFF, 0x025E, 0, 0); -// clang-format on +int dTgLightShaftEff_c::create() { + return SUCCEEDED; +} + +int dTgLightShaftEff_c::doDelete() { + return 1; +} + +int dTgLightShaftEff_c::actorExecute() { + return 1; +} + +int dTgLightShaftEff_c::draw() { + return 1; +} diff --git a/src/REL/d/t/d_t_map_inst.cpp b/src/REL/d/t/d_t_map_inst.cpp index bcea34c0..d18510f0 100644 --- a/src/REL/d/t/d_t_map_inst.cpp +++ b/src/REL/d/t/d_t_map_inst.cpp @@ -4,5 +4,17 @@ SPECIAL_ACTOR_PROFILE(TAG_MAP_INST, dTgMapInst_c, fProfile::TAG_MAP_INST, 0x021d int dTgMapInst_c::create() { field_0xfc = params & 0xff; + return SUCCEEDED; +} + +int dTgMapInst_c::doDelete() { + return 1; +} + +int dTgMapInst_c::actorExecute() { + return 1; +} + +int dTgMapInst_c::draw() { return 1; } diff --git a/src/REL/d/t/d_t_tackle.cpp b/src/REL/d/t/d_t_tackle.cpp index 58286c21..37b2b333 100644 --- a/src/REL/d/t/d_t_tackle.cpp +++ b/src/REL/d/t/d_t_tackle.cpp @@ -1,3 +1,19 @@ #include SPECIAL_ACTOR_PROFILE(TACKLE_TAG, dTgTackle_c, fProfile::TACKLE_TAG, 0x0241, 0, 0); + +int dTgTackle_c::create() { + return SUCCEEDED; +} + +int dTgTackle_c::doDelete() { + return 1; +} + +int dTgTackle_c::actorExecute() { + return 1; +} + +int dTgTackle_c::draw() { + return 1; +} diff --git a/src/d/a/d_a_base.cpp b/src/d/a/d_a_base.cpp index 0ebbe74c..7aea5fe8 100644 --- a/src/d/a/d_a_base.cpp +++ b/src/d/a/d_a_base.cpp @@ -109,9 +109,8 @@ int dAcBase_c::initAllocatorWork1Heap(int size, char *name, int align) { return initAllocator(size, name, dHeap::work1Heap.heap, align); } -extern "C" int fn_802EE510(mAllocator_c *, int size, EGG::Heap *heap, char *name, int align, int unk); int dAcBase_c::initAllocator(int size, char *name, EGG::Heap *heap, int align) { - if (fn_802EE510(&heap_allocator, size, heap, name, 0x20, 0) == 0) { + if (!heap_allocator.createNewTempFrmHeap(size, heap, name, 0x20, 0)) { return 0; } sound_source = FUN_8002c690(); diff --git a/src/toBeSorted/counters/counter.cpp b/src/toBeSorted/counters/counter.cpp index 2c388e44..42729f33 100644 --- a/src/toBeSorted/counters/counter.cpp +++ b/src/toBeSorted/counters/counter.cpp @@ -1,26 +1,5 @@ #include - -// TODO use the item flag manager once it exists -class ItemFlagManager { -public: - ItemFlagManager() {} - /** 0x08 */ virtual ~ItemFlagManager(); - /** 0x0C */ virtual void setFlagszptr(); - /** 0x10 */ virtual void onDirty(); - /** 0x14 */ virtual void copyFlagsFromSave() = 0; - /** 0x18 */ virtual void setupUnkFlagsStuff() = 0; - /** 0x1C */ virtual bool doCommit() = 0; - /** 0x20 */ virtual void setFlag(u16 flag); - /** 0x24 */ virtual void unsetFlag(u16 flag); - /** 0x28 */ virtual void setFlagOrCounterToValue(u16 flag, u16 value); - /** 0x2C */ virtual u16 getCounterOrFlag(u16 flag); - /** 0x30 */ virtual u16 getUncommittedValue(u16 flag); - /** 0x34 */ virtual void unk3(); - /** 0x38 */ virtual u16 *getSaveFlagSpace() = 0; -}; - -// TODO set up item flag manager -extern "C" ItemFlagManager *lbl_80575400; +#include /* 8016cc40 */ s32 Counter::checkedAdd(s32 num) { @@ -43,13 +22,13 @@ extern "C" ItemFlagManager *lbl_80575400; } /* 8016cd30 */ u16 Counter::getCommittedValue() { - return lbl_80575400->getCounterOrFlag(counterId | 0x4000); + return ItemFlagManager::sInstance->getCounterOrFlag(counterId | 0x4000); } /* 8016cd50 */ u16 Counter::getUncommittedValue() { - return lbl_80575400->getUncommittedValue(counterId | 0x4000); + return ItemFlagManager::sInstance->getUncommittedValue(counterId | 0x4000); } /* 8016cd70 */ void Counter::setValue(u16 num) { - lbl_80575400->setFlagOrCounterToValue(counterId | 0x4000, num); + ItemFlagManager::sInstance->setFlagOrCounterToValue(counterId | 0x4000, num); } diff --git a/src/toBeSorted/counters/rupee_counter.cpp b/src/toBeSorted/counters/rupee_counter.cpp index d1264a74..02f3cd0f 100644 --- a/src/toBeSorted/counters/rupee_counter.cpp +++ b/src/toBeSorted/counters/rupee_counter.cpp @@ -1,4 +1,5 @@ #include +#include static u16 getBaseCapacity(); static u16 getExtraWalletCapacity(); @@ -17,10 +18,6 @@ struct WalletStruct { u16 capacity; }; -// TODO set up item flag manager -extern "C" void *lbl_80575400; -extern "C" u16 fn_800BF5E0(void *data, u16 flag); - /* 8016DE10 */ static u16 getBaseCapacity() { int i = 0; /* 804E91B0 */ WalletStruct wallet_definitions[4] = { @@ -31,7 +28,7 @@ extern "C" u16 fn_800BF5E0(void *data, u16 flag); }; const WalletStruct *wallet = &wallet_definitions[3]; for (; i < 4; i++, wallet--) { - if (fn_800BF5E0(lbl_80575400, wallet->flag)) { + if (ItemFlagManager::sInstance->getFlag(wallet->flag)) { return wallet->capacity; } } diff --git a/src/toBeSorted/dowsing_target.cpp b/src/toBeSorted/dowsing_target.cpp new file mode 100644 index 00000000..84eea947 --- /dev/null +++ b/src/toBeSorted/dowsing_target.cpp @@ -0,0 +1,272 @@ +#include +#include +#include +#include +#include +#include + +typedef TList DowsingList; + +DowsingList DOWSING_LISTS[8]; + +static const int DOWSING_TARGET_STORY_FLAGS[8] = { + 100, + 105, + 100, + 104, + 108, + 110, + 109, + 102, +}; + +DowsingTarget::~DowsingTarget() { + doUnregister(); +} + +void DowsingTarget::initialize(DowsingSlot type, u16 unk, const mVec3_c *offset, f32 unk2) { + reinitialize(type); + field_0x0E = unk; + if (offset != nullptr) { + mOffset = *offset; + } +} + +static bool insertDowsingTarget(DowsingTarget *target); +static bool removeDowsingTarget(DowsingTarget *target); + +bool DowsingTarget::doRegister() { + return insertDowsingTarget(this); +} + +bool DowsingTarget::doUnregister() { + return removeDowsingTarget(this); +} + +void DowsingTarget::reinitialize(DowsingSlot type) { + bool res = doUnregister(); + mDowsingSlot = type; + if (res) { + doRegister(); + } +} + +void DowsingTarget::getPosition(mVec3_c &position) { + mMtx_c mtx; + mMtx_c mtx2; + PSMTXTrans(mtx.m, mpActor->position.x, mpActor->position.y, mpActor->position.z); + mtx.YrotM(mpActor->rotation.y); + PSMTXScale(mtx2.m, mpActor->scale.x, mpActor->scale.y, mpActor->scale.z); + PSMTXConcat(mtx.m, mtx2.m, mtx.m); + PSMTXMultVec(mtx.m, mOffset, position); +} + +bool DowsingTarget::hasZeldaDowsing() { + return StoryFlagManager::sInstance->getCounterOrFlag(100); +} + +bool DowsingTarget::hasKikwiDowsing() { + return StoryFlagManager::sInstance->getCounterOrFlag(56) && !StoryFlagManager::sInstance->getCounterOrFlag(57); +} + +bool DowsingTarget::hasKeyPieceDowsing() { + return StoryFlagManager::sInstance->getCounterOrFlag(106) && !StoryFlagManager::sInstance->getCounterOrFlag(120); +} + +bool DowsingTarget::hasDesertNodeDowsing() { + return StoryFlagManager::sInstance->getCounterOrFlag(107) && !StoryFlagManager::sInstance->getCounterOrFlag(8); +} + +bool DowsingTarget::hasAnyTrialDowsing() { + // TODO more complicated code + return ItemFlagManager::sInstance->getFlag(187) && !StoryFlagManager::sInstance->getCounterOrFlag(93) || + ItemFlagManager::sInstance->getFlag(188) && !StoryFlagManager::sInstance->getCounterOrFlag(97) || + ItemFlagManager::sInstance->getFlag(189) && !StoryFlagManager::sInstance->getCounterOrFlag(98) || + ItemFlagManager::sInstance->getFlag(193) && !StoryFlagManager::sInstance->getCounterOrFlag(99); +} + +bool DowsingTarget::hasSacredWaterDowsing() { + return StoryFlagManager::sInstance->getCounterOrFlag(64) && !StoryFlagManager::sInstance->getCounterOrFlag(65); +} + +bool DowsingTarget::hasSandshipDowsing() { + return StoryFlagManager::sInstance->getCounterOrFlag(271) && !StoryFlagManager::sInstance->getCounterOrFlag(14); +} + +bool DowsingTarget::hasTadtoneDowsing() { + return StoryFlagManager::sInstance->getCounterOrFlag(81) && !StoryFlagManager::sInstance->getCounterOrFlag(18); +} + +bool DowsingTarget::hasPropellerDowsing() { + return StoryFlagManager::sInstance->getCounterOrFlag(668); +} + +bool DowsingTarget::hasWaterBasinDowsing() { + return StoryFlagManager::sInstance->getCounterOrFlag(669); +} + +bool DowsingTarget::hasCrystalBallDowsing() { + return StoryFlagManager::sInstance->getCounterOrFlag(670); +} + +bool DowsingTarget::hasPumpkinDowsing() { + return StoryFlagManager::sInstance->getCounterOrFlag(680); +} + +bool DowsingTarget::hasNewPlantSpeciesDowsing() { + return StoryFlagManager::sInstance->getCounterOrFlag(681); +} + +bool DowsingTarget::hasPartyWheelDowsing() { + return StoryFlagManager::sInstance->getCounterOrFlag(682); +} + +bool DowsingTarget::hasDowsingInSlot(int slot) { + if (slot >= 8) { + return false; + } + + if (slot == 6) { + return true; + } + + if (slot == 0) { + return hasZeldaDowsing() || hasAnyTrialDowsing() || hasSacredWaterDowsing() || hasSandshipDowsing() || + hasTadtoneDowsing() || hasPropellerDowsing() || hasWaterBasinDowsing(); + } else if (slot == 2) { + return hasCrystalBallDowsing() || hasPumpkinDowsing() || hasNewPlantSpeciesDowsing() || hasKikwiDowsing() || + hasKeyPieceDowsing() || hasDesertNodeDowsing() || hasPartyWheelDowsing(); + } else if (StoryFlagManager::sInstance->getCounterOrFlag(DOWSING_TARGET_STORY_FLAGS[slot])) { + // TODO small instruction shuffle + return true; + } + + return false; +} + +#define MYCLAMP(low, high, x) ((x) < (low) ? (low) : ((x) > (high) ? (high) : (x))) + +DowsingTarget *DowsingTarget::getDowsingInfo(const mVec3_c &playerPosition, const mVec3_c &dowsingDirection, f32 *p3, + f32 *p4, f32 *intensity, int slot) { + if (slot >= 8) { + return nullptr; + } + mVec3_c dwsDir = dowsingDirection; + dwsDir.normalize(); + DowsingList *list = &DOWSING_LISTS[slot]; + DowsingTarget *best = nullptr; + + for (DowsingList::Iterator node = list->GetBeginIter(); node != list->GetEndIter(); ++node) { + mVec3_c targetPos; + node->getPosition(targetPos); + mVec3_c targetDir = mVec3_c(targetPos - playerPosition); + f32 proximity = nw4r::ut::Max(10000.0f - targetDir.mag(), 0.0f); + + targetDir.normalize(); + + f32 dot = dwsDir.dot(targetDir); + dot = MYCLAMP(-1.0f, 1.0f, dot); + f32 a = 1.0f - dot * dot <= 0.0f ? 0.0f : nw4r::math::FrSqrt(1.0f - dot * dot) * (1.0f - dot * dot); + + f32 f9 = (5461 - labs(cM::atan2s(a, dot))) * (1.0f / 5461.0f); + if (!(f9 < 0.0f)) { + f32 val; + f32 f10 = MYCLAMP(0.0f, 0.9f, proximity * 0.0001f) * 1.1111112f; + if (f9 > 0.85f) { + f9 = 0.85f; + } + + f9 = f9 * 1.1764705f; + f9 *= f9; + if (f9 > 1.0f) { + f9 = 1.0f; + } + + val = f9 * f10; + if (val > *intensity) { + *intensity = val; + *p3 = f10; + *p4 = f9; + best = &*node; + } + } + } + return best; +} + +void DowsingTarget::init() {} + +void DowsingTarget::execute() {} + +// Not sure what this is +inline static TListNode *getNode(u8 slot, DowsingTarget *t) { + if (t->mLink.mpNext == nullptr || t->mLink.mpPrev == nullptr) { + return &DOWSING_LISTS[slot].mNode; + } else { + return &t->mLink; + } +} + +static bool insertDowsingTarget(DowsingTarget *target) { + u8 slot = target->getSlot(); + if (slot == DowsingTarget::SLOT_NONE) { + return false; + } + + if (getNode(slot, target) != &DOWSING_LISTS[slot].mNode) { + return false; + } + DOWSING_LISTS[slot].insert(target); + return true; +} + +static bool removeDowsingTarget(DowsingTarget *target) { + u8 slot = target->getSlot(); + if (slot == DowsingTarget::SLOT_NONE) { + return false; + } + + if (getNode(slot, target) != &DOWSING_LISTS[slot].mNode) { + DOWSING_LISTS[slot].remove(target); + return true; + } + return false; +} + +u8 DowsingTarget::getTopDowsingIcon() { + if (hasZeldaDowsing()) { + return 19; + } else if (hasAnyTrialDowsing()) { + return 20; + } else if (hasSacredWaterDowsing()) { + return 5; + } else if (hasSandshipDowsing()) { + return 18; + } else if (hasTadtoneDowsing()) { + return 17; + } else if (hasPropellerDowsing()) { + return 10; + } else if (hasWaterBasinDowsing()) { + return 14; + } + return 19; +} + +u8 DowsingTarget::getLeftDowsingIcon() { + if (hasCrystalBallDowsing()) { + return 15; + } else if (hasPumpkinDowsing()) { + return 12; + } else if (hasNewPlantSpeciesDowsing()) { + return 21; + } else if (hasPartyWheelDowsing()) { + return 13; + } else if (hasKikwiDowsing()) { + return 8; + } else if (hasKeyPieceDowsing()) { + return 11; + } else if (hasDesertNodeDowsing()) { + return 7; + } + return 15; +} diff --git a/src/toBeSorted/sound_info.cpp b/src/toBeSorted/sound_info.cpp new file mode 100644 index 00000000..0009e3c7 --- /dev/null +++ b/src/toBeSorted/sound_info.cpp @@ -0,0 +1,13 @@ +#include + +extern "C" SoundSource *soundForActorInitRelated_803889c0(int, fBase_c *, char *, u8); + +extern "C" bool fn_8002C250(SoundInfo *p1, int someNum, char *name, mVec3_c *position) { + p1->sound_source = soundForActorInitRelated_803889c0(someNum, p1->actor, name, 0); + if (!p1->sound_source) { + return false; + } + p1->actor->sound_list.insert(p1); + p1->obj_pos = position; + return true; +}