From dc46e662179f579bec2388fe9d5e178025c6fe9e Mon Sep 17 00:00:00 2001 From: MokhaLeee Date: Thu, 19 Oct 2023 05:13:16 +0000 Subject: [PATCH 1/3] decomp efxsound in process --- asm/banim-efxmagic-5BA64.s | 24 +- asm/banim-efxmagic-66514.s | 14 +- asm/banim-efxmagic-ivaldi.s | 2 +- asm/banim-efxmagic.s | 28 +- asm/banim-efxsound.s | 1154 +--------------------------------- include/ekrbattle.h | 21 +- src/banim-efxhit.c | 4 +- src/banim-efxhpbar.c | 18 +- src/banim-efxmagic-fire.c | 2 +- src/banim-efxmagic-thunder.c | 2 +- src/banim-efxmisc.c | 2 +- src/banim-efxsound.c | 346 ++++++++-- src/banim-ekrutils.c | 4 +- src/banim-main.c | 4 +- 14 files changed, 348 insertions(+), 1277 deletions(-) diff --git a/asm/banim-efxmagic-5BA64.s b/asm/banim-efxmagic-5BA64.s index a59de59ec..05a54393b 100644 --- a/asm/banim-efxmagic-5BA64.s +++ b/asm/banim-efxmagic-5BA64.s @@ -666,7 +666,7 @@ sub_805BF40: @ 0x0805BF40 adds r0, r6, #0 bl StartBattleAnimHitEffectsDefault adds r0, r6, #0 - bl sub_8072400 + bl GetEfxHpChangeType lsls r0, r0, #0x10 asrs r0, r0, #0x10 cmp r0, #2 @@ -689,7 +689,7 @@ _0805BFB2: cmp r0, #0 bne _0805BFD6 adds r0, r6, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _0805BFD6 _0805BFC0: movs r1, #0x2c @@ -1108,7 +1108,7 @@ sub_805C29C: @ 0x0805C29C adds r0, r6, #0 bl StartBattleAnimHitEffectsDefault adds r0, r6, #0 - bl sub_8072400 + bl GetEfxHpChangeType lsls r0, r0, #0x10 asrs r0, r0, #0x10 cmp r0, #2 @@ -1131,7 +1131,7 @@ _0805C326: cmp r0, #0 bne _0805C350 adds r0, r6, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _0805C350 _0805C334: movs r3, #0x2c @@ -1707,7 +1707,7 @@ sub_805C7E4: @ 0x0805C7E4 adds r0, r6, #0 bl StartBattleAnimHitEffectsDefault adds r0, r6, #0 - bl sub_8072400 + bl GetEfxHpChangeType lsls r0, r0, #0x10 asrs r0, r0, #0x10 cmp r0, #2 @@ -1730,7 +1730,7 @@ _0805C862: cmp r0, #0 bne _0805C886 adds r0, r6, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _0805C886 _0805C870: movs r3, #0x2c @@ -2401,7 +2401,7 @@ _0805CDB0: adds r0, r6, #0 bl StartBattleAnimHitEffectsDefault adds r0, r6, #0 - bl sub_8072400 + bl GetEfxHpChangeType lsls r0, r0, #0x10 asrs r0, r0, #0x10 cmp r0, #2 @@ -2424,7 +2424,7 @@ _0805CDF4: cmp r0, #0 bne _0805CE14 adds r0, r6, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _0805CE14 _0805CE02: cmp r0, #0x3e @@ -2617,7 +2617,7 @@ _0805CF32: cmp r0, #0 bne _0805CFB6 adds r0, r5, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _0805CFB6 .align 2, 0 _0805CF7C: .4byte 0x0000010D @@ -2831,7 +2831,7 @@ _0805D110: cmp r0, #0 bne _0805D142 adds r0, r5, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _0805D142 _0805D134: cmp r0, #0x82 @@ -3206,7 +3206,7 @@ _0805D400: cmp r0, #0 bne _0805D43E adds r0, r5, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _0805D43E _0805D428: cmp r0, #0x32 @@ -3376,7 +3376,7 @@ _0805D558: cmp r0, #0 bne _0805D596 adds r0, r5, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _0805D596 .align 2, 0 _0805D580: .4byte 0x0000011F diff --git a/asm/banim-efxmagic-66514.s b/asm/banim-efxmagic-66514.s index 86bb300aa..26a5be12d 100644 --- a/asm/banim-efxmagic-66514.s +++ b/asm/banim-efxmagic-66514.s @@ -155,7 +155,7 @@ _08066636: cmp r0, #0 bne _0806669C adds r0, r4, #0 - bl sub_8072450 + bl EfxPlayHittedSFX adds r0, r4, #0 movs r1, #0x78 movs r2, #0xa @@ -2459,7 +2459,7 @@ _08067848: cmp r0, #0 bne _08067886 adds r0, r5, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _08067886 _08067870: adds r0, r2, #0 @@ -4528,7 +4528,7 @@ _08068884: cmp r0, #0 bne _080688B6 adds r0, r5, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _080688B6 _080688A8: cmp r0, #0x82 @@ -5027,7 +5027,7 @@ _08068C68: cmp r0, #0 bne _08068D14 adds r0, r5, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _08068D14 _08068C8C: movs r3, #0x9a @@ -7550,7 +7550,7 @@ _08069FBC: cmp r0, #0 bne _08069FFE adds r0, r5, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _08069FFE .align 2, 0 _08069FE4: .4byte 0x00000123 @@ -9589,7 +9589,7 @@ _0806AFAE: cmp r0, #0 bne _0806B07A adds r0, r5, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _0806B07A _0806AFD6: adds r0, r2, #0 @@ -10381,7 +10381,7 @@ _0806B608: cmp r0, #0 bne _0806B646 adds r0, r5, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _0806B646 _0806B630: adds r0, r2, #0 diff --git a/asm/banim-efxmagic-ivaldi.s b/asm/banim-efxmagic-ivaldi.s index 624e987b5..f233698ce 100644 --- a/asm/banim-efxmagic-ivaldi.s +++ b/asm/banim-efxmagic-ivaldi.s @@ -185,7 +185,7 @@ _0806592A: cmp r0, #0 bne _080659A4 adds r0, r5, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _080659A4 .align 2, 0 _0806595C: .4byte 0x00000107 diff --git a/asm/banim-efxmagic.s b/asm/banim-efxmagic.s index 758757925..075986914 100644 --- a/asm/banim-efxmagic.s +++ b/asm/banim-efxmagic.s @@ -142,7 +142,7 @@ _0805E1E4: cmp r0, #0 bne _0805E228 adds r0, r5, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _0805E228 _0805E20C: adds r0, r6, #0 @@ -904,7 +904,7 @@ _0805E7F6: cmp r0, #0 bne _0805E848 adds r0, r5, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _0805E848 .align 2, 0 _0805E828: .4byte 0x00000119 @@ -1484,7 +1484,7 @@ _0805EC80: cmp r0, #0 bne _0805ECCC adds r0, r5, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _0805ECCC _0805ECAA: adds r0, r2, #0 @@ -1895,7 +1895,7 @@ _0805EFB8: cmp r0, #0 bne _0805EFFE adds r0, r5, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _0805EFFE _0805EFE8: adds r0, r2, #0 @@ -2484,7 +2484,7 @@ _0805F468: cmp r0, #0 bne _0805F4A8 adds r0, r5, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _0805F4A8 _0805F490: adds r0, r6, #0 @@ -3106,7 +3106,7 @@ _0805F93E: cmp r0, #0 bne _0805F9A0 adds r0, r5, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _0805F9A0 .align 2, 0 _0805F980: .4byte 0x00000121 @@ -3456,7 +3456,7 @@ _0805FC12: cmp r0, #0 bne _0805FC88 adds r0, r5, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _0805FC88 .align 2, 0 _0805FC54: .4byte 0x00000101 @@ -3871,7 +3871,7 @@ _0805FF62: cmp r0, #0 bne _0805FFAA adds r0, r5, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _0805FFAA _0805FF90: adds r0, r3, #0 @@ -4419,7 +4419,7 @@ _080603B8: cmp r0, #0 bne _08060438 adds r0, r5, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _08060438 .align 2, 0 _080603FC: .4byte 0x000002E2 @@ -5217,7 +5217,7 @@ _08060A04: cmp r0, #0 bne _08060A94 adds r0, r5, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _08060A94 .align 2, 0 _08060A4C: .4byte 0x00000133 @@ -10672,7 +10672,7 @@ _0806354A: cmp r0, #0 bne _08063588 adds r0, r5, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _08063588 _08063572: adds r0, r6, #0 @@ -11389,7 +11389,7 @@ _08063B02: cmp r0, #0 bne _08063B62 adds r0, r6, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _08063B62 _08063B32: adds r0, r5, #0 @@ -12584,7 +12584,7 @@ _08064444: adds r0, r4, #0 bl StartBattleAnimHitEffectsDefault adds r0, r4, #0 - bl sub_8072450 + bl EfxPlayHittedSFX _0806446E: movs r0, #0x2c ldrsh r1, [r5, r0] @@ -14042,7 +14042,7 @@ _08064F86: cmp r0, #0 bne _08064FFE adds r0, r5, #0 - bl sub_8072450 + bl EfxPlayHittedSFX b _08064FFE _08064FB6: adds r0, r2, #0 diff --git a/asm/banim-efxsound.s b/asm/banim-efxsound.s index 9a7d6c01e..23f4e8cc3 100644 --- a/asm/banim-efxsound.s +++ b/asm/banim-efxsound.s @@ -2,1158 +2,6 @@ .SYNTAX UNIFIED - THUMB_FUNC_START EfxPlaySEwithCmdCtrl -EfxPlaySEwithCmdCtrl: @ 0x08071B6C - push {r4, r5, r6, r7, lr} - mov r7, sl - mov r6, r9 - mov r5, r8 - push {r5, r6, r7} - sub sp, #8 - mov r8, r0 - mov sl, r1 - bl GetAnimAnotherSide - mov r9, r0 - mov r0, r8 - bl GetAISLayerId - cmp r0, #1 - bne _08071B8E - b _08072246 -_08071B8E: - mov r0, r8 - bl GetAnimPosition - adds r6, r0, #0 - cmp r6, #0 - bne _08071BA8 - ldr r0, _08071BA4 @ gEkrPairTerrainID - movs r1, #0 - ldrsh r5, [r0, r1] - b _08071BAE - .align 2, 0 -_08071BA4: .4byte gEkrPairTerrainID -_08071BA8: - ldr r0, _08071BD8 @ gEkrPairTerrainID - movs r2, #2 - ldrsh r5, [r0, r2] -_08071BAE: - lsls r0, r5, #0x10 - lsrs r0, r0, #0x10 - bl sub_8072258 - lsls r0, r0, #0x10 - lsrs r4, r0, #0x10 - cmp r5, #0x14 - bne _08071BCA - mov r0, r8 - bl sub_80723A4 - cmp r0, #0 - bne _08071BCA - movs r4, #2 -_08071BCA: - cmp r6, #0 - bne _08071BE0 - ldr r0, _08071BDC @ gEkrPairBaseCon - movs r1, #0 - ldrsh r0, [r0, r1] - b _08071BE6 - .align 2, 0 -_08071BD8: .4byte gEkrPairTerrainID -_08071BDC: .4byte gEkrPairBaseCon -_08071BE0: - ldr r0, _08071C20 @ gEkrPairBaseCon - movs r2, #2 - ldrsh r0, [r0, r2] -_08071BE6: - lsls r0, r0, #0x10 - lsrs r0, r0, #0x10 - bl sub_80723D4 - lsls r0, r0, #0x10 - lsrs r7, r0, #0x10 - ldr r5, _08071C24 @ 0x0000FFFF - mov r0, r8 - bl sub_807290C - mov r2, r8 - ldrh r1, [r2, #2] - adds r1, r1, r0 - lsls r1, r1, #0x10 - lsrs r2, r1, #0x10 - movs r0, #0x80 - lsls r0, r0, #1 - str r0, [sp] - mov r0, sl - subs r0, #0x19 - cmp r0, #0x62 - bls _08071C14 - b _08072220 -_08071C14: - lsls r0, r0, #2 - ldr r1, _08071C28 @ _08071C2C - adds r0, r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_08071C20: .4byte gEkrPairBaseCon -_08071C24: .4byte 0x0000FFFF -_08071C28: .4byte _08071C2C -_08071C2C: @ jump table - .4byte _08071DB8 @ case 0 - .4byte _08072220 @ case 1 - .4byte _08071DBC @ case 2 - .4byte _08071DD0 @ case 3 - .4byte _08071DE4 @ case 4 - .4byte _08071DF8 @ case 5 - .4byte _08071E0C @ case 6 - .4byte _08071E78 @ case 7 - .4byte _08071EE4 @ case 8 - .4byte _08071F78 @ case 9 - .4byte _08071F7C @ case 10 - .4byte _08071F80 @ case 11 - .4byte _08071F84 @ case 12 - .4byte _08072220 @ case 13 - .4byte _08072220 @ case 14 - .4byte _08071F8C @ case 15 - .4byte _08071F90 @ case 16 - .4byte _08071F98 @ case 17 - .4byte _08071F9E @ case 18 - .4byte _08072220 @ case 19 - .4byte _08072220 @ case 20 - .4byte _08072220 @ case 21 - .4byte _08071FA8 @ case 22 - .4byte _08072220 @ case 23 - .4byte _08072220 @ case 24 - .4byte _08072220 @ case 25 - .4byte _08071FAE @ case 26 - .4byte _08071FB2 @ case 27 - .4byte _08071FFC @ case 28 - .4byte _0807200C @ case 29 - .4byte _08072010 @ case 30 - .4byte _08072014 @ case 31 - .4byte _08072220 @ case 32 - .4byte _08072018 @ case 33 - .4byte _08072020 @ case 34 - .4byte _08072026 @ case 35 - .4byte _08072220 @ case 36 - .4byte _08072038 @ case 37 - .4byte _0807203C @ case 38 - .4byte _08072042 @ case 39 - .4byte _0807204C @ case 40 - .4byte _08072050 @ case 41 - .4byte _08072054 @ case 42 - .4byte _0807205C @ case 43 - .4byte _08072062 @ case 44 - .4byte _0807206C @ case 45 - .4byte _08072220 @ case 46 - .4byte _08072074 @ case 47 - .4byte _08072078 @ case 48 - .4byte _08072080 @ case 49 - .4byte _08072086 @ case 50 - .4byte _08072090 @ case 51 - .4byte _08072098 @ case 52 - .4byte _08072220 @ case 53 - .4byte _080720A0 @ case 54 - .4byte _080720A8 @ case 55 - .4byte _08072220 @ case 56 - .4byte _08072220 @ case 57 - .4byte _08072220 @ case 58 - .4byte _08072220 @ case 59 - .4byte _08072220 @ case 60 - .4byte _080720AE @ case 61 - .4byte _080720B8 @ case 62 - .4byte _080720C0 @ case 63 - .4byte _080720C8 @ case 64 - .4byte _080720DC @ case 65 - .4byte _080720E4 @ case 66 - .4byte _080720EC @ case 67 - .4byte _080720F2 @ case 68 - .4byte _08072108 @ case 69 - .4byte _08072110 @ case 70 - .4byte _08072118 @ case 71 - .4byte _08072120 @ case 72 - .4byte _08072128 @ case 73 - .4byte _0807212E @ case 74 - .4byte _08072138 @ case 75 - .4byte _0807213E @ case 76 - .4byte _08072148 @ case 77 - .4byte _0807215C @ case 78 - .4byte _08072170 @ case 79 - .4byte _08072220 @ case 80 - .4byte _08072176 @ case 81 - .4byte _08072180 @ case 82 - .4byte _08072188 @ case 83 - .4byte _0807218E @ case 84 - .4byte _080721A4 @ case 85 - .4byte _080721B8 @ case 86 - .4byte _080721CC @ case 87 - .4byte _08072220 @ case 88 - .4byte _08072220 @ case 89 - .4byte _080721E0 @ case 90 - .4byte _080721E8 @ case 91 - .4byte _080721F0 @ case 92 - .4byte _080721F8 @ case 93 - .4byte _08072200 @ case 94 - .4byte _08072208 @ case 95 - .4byte _0807220E @ case 96 - .4byte _08072214 @ case 97 - .4byte _0807221C @ case 98 -_08071DB8: - movs r5, #0xd1 - b _08072222 -_08071DBC: - ldr r1, _08071DCC @ gBanimSongTable1 - lsls r0, r4, #2 - adds r0, r0, r1 - ldr r1, [r0] - lsls r0, r7, #1 - adds r0, r0, r6 - lsls r0, r0, #1 - b _08072198 - .align 2, 0 -_08071DCC: .4byte gBanimSongTable1 -_08071DD0: - ldr r1, _08071DE0 @ gBanimSongTable2 - lsls r0, r4, #2 - adds r0, r0, r1 - ldr r1, [r0] - lsls r0, r7, #1 - adds r0, r0, r6 - lsls r0, r0, #1 - b _08072198 - .align 2, 0 -_08071DE0: .4byte gBanimSongTable2 -_08071DE4: - ldr r1, _08071DF4 @ gBanimSongTable3 - lsls r0, r4, #2 - adds r0, r0, r1 - ldr r1, [r0] - lsls r0, r7, #1 - adds r0, r0, r6 - lsls r0, r0, #1 - b _08072198 - .align 2, 0 -_08071DF4: .4byte gBanimSongTable3 -_08071DF8: - ldr r1, _08071E08 @ gBanimSongTable4 - lsls r0, r4, #2 - adds r0, r0, r1 - ldr r1, [r0] - lsls r0, r7, #1 - adds r0, r0, r6 - lsls r0, r0, #1 - b _08072198 - .align 2, 0 -_08071E08: .4byte gBanimSongTable4 -_08071E0C: - mov r0, r9 - bl sub_8072504 - mov r0, r9 - bl sub_8072400 - lsls r0, r0, #0x10 - asrs r0, r0, #0x10 - cmp r0, #2 - beq _08071E5A - mov r0, r8 - bl GetAnimPosition - adds r1, r0, #0 - mov r2, r8 - ldrh r0, [r2, #0xe] - subs r0, #1 - lsls r0, r0, #1 - adds r0, r0, r1 - bl GetBattleAnimRoundTypeFlags - movs r1, #0x80 - lsls r1, r1, #2 - ands r1, r0 - cmp r1, #0 - beq _08071E5A - ldr r4, _08071E74 @ 0x000003CF - movs r1, #0x80 - lsls r1, r1, #1 - adds r0, r4, #0 - bl EfxPlaySE - mov r0, r8 - movs r2, #2 - ldrsh r1, [r0, r2] - adds r0, r4, #0 - movs r2, #1 - bl M4aPlayWithPostionCtrl -_08071E5A: - mov r0, r9 - bl sub_8072400 - lsls r0, r0, #0x10 - asrs r0, r0, #0x10 - cmp r0, #1 - beq _08071F5A - cmp r0, #1 - bgt _08071F50 - cmp r0, #0 - bne _08071F60 - movs r5, #0xd2 - b _08071F60 - .align 2, 0 -_08071E74: .4byte 0x000003CF -_08071E78: - mov r0, r9 - bl sub_8072504 - mov r0, r9 - bl sub_8072400 - lsls r0, r0, #0x10 - asrs r0, r0, #0x10 - cmp r0, #2 - beq _08071EC6 - mov r0, r8 - bl GetAnimPosition - adds r1, r0, #0 - mov r2, r8 - ldrh r0, [r2, #0xe] - subs r0, #1 - lsls r0, r0, #1 - adds r0, r0, r1 - bl GetBattleAnimRoundTypeFlags - movs r1, #0x80 - lsls r1, r1, #2 - ands r1, r0 - cmp r1, #0 - beq _08071EC6 - ldr r4, _08071EE0 @ 0x000003CF - movs r1, #0x80 - lsls r1, r1, #1 - adds r0, r4, #0 - bl EfxPlaySE - mov r0, r8 - movs r2, #2 - ldrsh r1, [r0, r2] - adds r0, r4, #0 - movs r2, #1 - bl M4aPlayWithPostionCtrl -_08071EC6: - mov r0, r9 - bl sub_8072400 - lsls r0, r0, #0x10 - asrs r0, r0, #0x10 - cmp r0, #1 - beq _08071F5A - cmp r0, #1 - bgt _08071F50 - cmp r0, #0 - bne _08071F60 - movs r5, #0xd3 - b _08071F60 - .align 2, 0 -_08071EE0: .4byte 0x000003CF -_08071EE4: - mov r0, r9 - bl sub_8072504 - mov r0, r9 - bl sub_8072400 - lsls r0, r0, #0x10 - asrs r0, r0, #0x10 - cmp r0, #2 - beq _08071F32 - mov r0, r8 - bl GetAnimPosition - adds r1, r0, #0 - mov r2, r8 - ldrh r0, [r2, #0xe] - subs r0, #1 - lsls r0, r0, #1 - adds r0, r0, r1 - bl GetBattleAnimRoundTypeFlags - movs r1, #0x80 - lsls r1, r1, #2 - ands r1, r0 - cmp r1, #0 - beq _08071F32 - ldr r4, _08071F4C @ 0x000003CF - movs r1, #0x80 - lsls r1, r1, #1 - adds r0, r4, #0 - bl EfxPlaySE - mov r0, r8 - movs r2, #2 - ldrsh r1, [r0, r2] - adds r0, r4, #0 - movs r2, #1 - bl M4aPlayWithPostionCtrl -_08071F32: - mov r0, r9 - bl sub_8072400 - lsls r0, r0, #0x10 - asrs r0, r0, #0x10 - cmp r0, #1 - beq _08071F5A - cmp r0, #1 - bgt _08071F50 - cmp r0, #0 - beq _08071F56 - b _08071F60 - .align 2, 0 -_08071F4C: .4byte 0x000003CF -_08071F50: - cmp r0, #2 - beq _08071F5E - b _08071F60 -_08071F56: - movs r5, #0xd4 - b _08071F60 -_08071F5A: - movs r5, #0xd5 - b _08071F60 -_08071F5E: - ldr r5, _08071F74 @ 0x000002CE -_08071F60: - mov r0, r9 - bl sub_807290C - mov r2, r9 - ldrh r1, [r2, #2] - adds r1, r1, r0 - lsls r1, r1, #0x10 - lsrs r2, r1, #0x10 - b _08072222 - .align 2, 0 -_08071F74: .4byte 0x000002CE -_08071F78: - movs r5, #0xc9 - b _08072222 -_08071F7C: - movs r5, #0xc8 - b _08072222 -_08071F80: - movs r5, #0xca - b _08072222 -_08071F84: - ldr r5, _08071F88 @ 0x00000263 - b _08071FFE - .align 2, 0 -_08071F88: .4byte 0x00000263 -_08071F8C: - movs r5, #0xf6 - b _08072222 -_08071F90: - ldr r5, _08071F94 @ 0x00000141 - b _08072222 - .align 2, 0 -_08071F94: .4byte 0x00000141 -_08071F98: - movs r5, #0xa1 - lsls r5, r5, #1 - b _08072222 -_08071F9E: - ldr r5, _08071FA4 @ 0x00000267 - b _08071FFE - .align 2, 0 -_08071FA4: .4byte 0x00000267 -_08071FA8: - movs r5, #0xbe - lsls r5, r5, #2 - b _08072222 -_08071FAE: - movs r5, #0xe7 - b _08072222 -_08071FB2: - cmp r6, #0 - beq _08071FC4 - ldr r0, _08071FC0 @ gEkrPairBanimID2 - movs r1, #0 - ldrsh r0, [r0, r1] - b _08071FCA - .align 2, 0 -_08071FC0: .4byte gEkrPairBanimID2 -_08071FC4: - ldr r0, _08071FE0 @ gEkrPairBanimID2 - movs r1, #2 - ldrsh r0, [r0, r1] -_08071FCA: - cmp r0, #0xbf - bgt _08071FE8 - cmp r0, #0xbc - blt _08071FE8 - ldr r0, _08071FE4 @ gBanimSongTable1 - lsls r1, r4, #2 - adds r1, r1, r0 - ldr r1, [r1] - adds r0, r6, #4 - lsls r0, r0, #1 - b _08072198 - .align 2, 0 -_08071FE0: .4byte gEkrPairBanimID2 -_08071FE4: .4byte gBanimSongTable1 -_08071FE8: - ldr r1, _08071FF8 @ gBanimSongTable1 - lsls r0, r4, #2 - adds r0, r0, r1 - ldr r1, [r0] - lsls r0, r7, #1 - adds r0, r0, r6 - lsls r0, r0, #1 - b _08072198 - .align 2, 0 -_08071FF8: .4byte gBanimSongTable1 -_08071FFC: - ldr r5, _08072008 @ 0x00000265 -_08071FFE: - cmp r6, #0 - beq _08072004 - b _08072222 -_08072004: - subs r5, #1 - b _08072222 - .align 2, 0 -_08072008: .4byte 0x00000265 -_0807200C: - movs r5, #0xce - b _08072222 -_08072010: - movs r5, #0xcf - b _08072222 -_08072014: - movs r5, #0xcb - b _08072222 -_08072018: - ldr r5, _0807201C @ 0x000002D3 - b _08072222 - .align 2, 0 -_0807201C: .4byte 0x000002D3 -_08072020: - movs r5, #0xb5 - lsls r5, r5, #2 - b _08072222 -_08072026: - ldr r5, _08072034 @ 0x00000263 - cmp r6, #0 - bne _0807202E - subs r5, #1 -_0807202E: - movs r0, #0x80 - str r0, [sp] - b _08072222 - .align 2, 0 -_08072034: .4byte 0x00000263 -_08072038: - movs r5, #0xf1 - b _08072222 -_0807203C: - movs r5, #0x9b - lsls r5, r5, #1 - b _08072222 -_08072042: - ldr r5, _08072048 @ 0x00000117 - b _08072222 - .align 2, 0 -_08072048: .4byte 0x00000117 -_0807204C: - movs r5, #0xeb - b _08072222 -_08072050: - movs r5, #0xea - b _08072222 -_08072054: - ldr r5, _08072058 @ 0x000002CF - b _08072222 - .align 2, 0 -_08072058: .4byte 0x000002CF -_0807205C: - movs r5, #0xb4 - lsls r5, r5, #2 - b _08072222 -_08072062: - ldr r5, _08072068 @ 0x000002D1 - b _08072222 - .align 2, 0 -_08072068: .4byte 0x000002D1 -_0807206C: - ldr r5, _08072070 @ 0x000002D2 - b _08072222 - .align 2, 0 -_08072070: .4byte 0x000002D2 -_08072074: - movs r5, #0xed - b _08072222 -_08072078: - ldr r5, _0807207C @ 0x00000135 - b _08072222 - .align 2, 0 -_0807207C: .4byte 0x00000135 -_08072080: - movs r5, #0x9a - lsls r5, r5, #1 - b _08072222 -_08072086: - ldr r5, _0807208C @ 0x000002DD - b _08072222 - .align 2, 0 -_0807208C: .4byte 0x000002DD -_08072090: - ldr r5, _08072094 @ 0x000002DE - b _08072222 - .align 2, 0 -_08072094: .4byte 0x000002DE -_08072098: - ldr r5, _0807209C @ 0x000002DF - b _08072222 - .align 2, 0 -_0807209C: .4byte 0x000002DF -_080720A0: - ldr r5, _080720A4 @ 0x000002F7 - b _08072222 - .align 2, 0 -_080720A4: .4byte 0x000002F7 -_080720A8: - movs r5, #0xba - lsls r5, r5, #2 - b _08072222 -_080720AE: - ldr r5, _080720B4 @ 0x00000325 - b _08072222 - .align 2, 0 -_080720B4: .4byte 0x00000325 -_080720B8: - ldr r5, _080720BC @ 0x00000326 - b _08072222 - .align 2, 0 -_080720BC: .4byte 0x00000326 -_080720C0: - ldr r5, _080720C4 @ 0x00000327 - b _08072222 - .align 2, 0 -_080720C4: .4byte 0x00000327 -_080720C8: - ldr r1, _080720D8 @ gBanimSongTable5 - lsls r0, r4, #2 - adds r0, r0, r1 - ldr r1, [r0] - lsls r0, r7, #1 - adds r0, r0, r6 - lsls r0, r0, #1 - b _08072198 - .align 2, 0 -_080720D8: .4byte gBanimSongTable5 -_080720DC: - ldr r5, _080720E0 @ 0x0000032A - b _08072222 - .align 2, 0 -_080720E0: .4byte 0x0000032A -_080720E4: - ldr r5, _080720E8 @ 0x0000032B - b _08072222 - .align 2, 0 -_080720E8: .4byte 0x0000032B -_080720EC: - movs r5, #0xcb - lsls r5, r5, #2 - b _08072222 -_080720F2: - ldr r1, _08072104 @ gBanimSongTable6 - lsls r0, r4, #2 - adds r0, r0, r1 - ldr r1, [r0] - lsls r0, r7, #1 - adds r0, r0, r6 - lsls r0, r0, #1 - b _08072198 - .align 2, 0 -_08072104: .4byte gBanimSongTable6 -_08072108: - ldr r5, _0807210C @ 0x0000032E - b _08072222 - .align 2, 0 -_0807210C: .4byte 0x0000032E -_08072110: - ldr r5, _08072114 @ 0x00000332 - b _08072222 - .align 2, 0 -_08072114: .4byte 0x00000332 -_08072118: - ldr r5, _0807211C @ 0x000003B7 - b _08072222 - .align 2, 0 -_0807211C: .4byte 0x000003B7 -_08072120: - ldr r5, _08072124 @ 0x0000032F - b _08072222 - .align 2, 0 -_08072124: .4byte 0x0000032F -_08072128: - movs r5, #0xcc - lsls r5, r5, #2 - b _08072222 -_0807212E: - ldr r5, _08072134 @ 0x00000331 - b _08072222 - .align 2, 0 -_08072134: .4byte 0x00000331 -_08072138: - movs r5, #0xc8 - lsls r5, r5, #2 - b _08072222 -_0807213E: - ldr r5, _08072144 @ 0x00000321 - b _08072222 - .align 2, 0 -_08072144: .4byte 0x00000321 -_08072148: - ldr r1, _08072158 @ gBanimSongTable7 - lsls r0, r4, #2 - adds r0, r0, r1 - ldr r1, [r0] - lsls r0, r7, #1 - adds r0, r0, r6 - lsls r0, r0, #1 - b _08072198 - .align 2, 0 -_08072158: .4byte gBanimSongTable7 -_0807215C: - ldr r1, _0807216C @ gBanimSongTable8 - lsls r0, r4, #2 - adds r0, r0, r1 - ldr r1, [r0] - lsls r0, r7, #1 - adds r0, r0, r6 - lsls r0, r0, #1 - b _08072198 - .align 2, 0 -_0807216C: .4byte gBanimSongTable8 -_08072170: - movs r5, #0xf0 - lsls r5, r5, #2 - b _08072222 -_08072176: - ldr r5, _0807217C @ 0x000003C2 - b _08072222 - .align 2, 0 -_0807217C: .4byte 0x000003C2 -_08072180: - ldr r5, _08072184 @ 0x000003C3 - b _08072222 - .align 2, 0 -_08072184: .4byte 0x000003C3 -_08072188: - movs r5, #0xf1 - lsls r5, r5, #2 - b _08072222 -_0807218E: - ldr r0, _080721A0 @ gBanimSongTable1 - lsls r1, r4, #2 - adds r1, r1, r0 - ldr r1, [r1] - lsls r0, r6, #1 -_08072198: - adds r0, r0, r1 - ldrh r5, [r0] - b _08072222 - .align 2, 0 -_080721A0: .4byte gBanimSongTable1 -_080721A4: - ldr r0, _080721B4 @ gBanimSongTable1 - lsls r1, r4, #2 - adds r1, r1, r0 - ldr r1, [r1] - lsls r0, r6, #1 - adds r0, r0, r1 - ldrh r5, [r0, #4] - b _08072222 - .align 2, 0 -_080721B4: .4byte gBanimSongTable1 -_080721B8: - ldr r0, _080721C8 @ gBanimSongTable1 - lsls r1, r4, #2 - adds r1, r1, r0 - ldr r1, [r1] - lsls r0, r6, #1 - adds r0, r0, r1 - ldrh r5, [r0, #8] - b _08072222 - .align 2, 0 -_080721C8: .4byte gBanimSongTable1 -_080721CC: - ldr r0, _080721DC @ gBanimSongTable1 - lsls r1, r4, #2 - adds r1, r1, r0 - ldr r1, [r1] - lsls r0, r6, #1 - adds r0, r0, r1 - ldrh r5, [r0, #0xc] - b _08072222 - .align 2, 0 -_080721DC: .4byte gBanimSongTable1 -_080721E0: - ldr r5, _080721E4 @ 0x00000322 - b _08072222 - .align 2, 0 -_080721E4: .4byte 0x00000322 -_080721E8: - ldr r5, _080721EC @ 0x0000037D - b _08072222 - .align 2, 0 -_080721EC: .4byte 0x0000037D -_080721F0: - ldr r5, _080721F4 @ 0x00000329 - b _08072222 - .align 2, 0 -_080721F4: .4byte 0x00000329 -_080721F8: - ldr r5, _080721FC @ 0x0000037A - b _08072222 - .align 2, 0 -_080721FC: .4byte 0x0000037A -_08072200: - ldr r5, _08072204 @ 0x0000037B - b _08072222 - .align 2, 0 -_08072204: .4byte 0x0000037B -_08072208: - movs r5, #0xb9 - lsls r5, r5, #2 - b _08072222 -_0807220E: - movs r5, #0xdf - lsls r5, r5, #2 - b _08072222 -_08072214: - ldr r5, _08072218 @ 0x0000037F - b _08072222 - .align 2, 0 -_08072218: .4byte 0x0000037F -_0807221C: - movs r5, #0xde - b _08072222 -_08072220: - movs r5, #0 -_08072222: - lsls r0, r5, #0x10 - asrs r4, r0, #0x10 - movs r0, #1 - negs r0, r0 - cmp r4, r0 - beq _08072246 - ldr r1, [sp] - adds r0, r4, #0 - str r2, [sp, #4] - bl EfxPlaySE - ldr r2, [sp, #4] - lsls r1, r2, #0x10 - asrs r1, r1, #0x10 - movs r2, #1 - adds r0, r4, #0 - bl M4aPlayWithPostionCtrl -_08072246: - add sp, #8 - pop {r3, r4, r5} - mov r8, r3 - mov r9, r4 - mov sl, r5 - pop {r4, r5, r6, r7} - pop {r0} - bx r0 - - THUMB_FUNC_END EfxPlaySEwithCmdCtrl - - THUMB_FUNC_START sub_8072258 -sub_8072258: @ 0x08072258 - push {r4, lr} - lsls r0, r0, #0x10 - lsrs r4, r0, #0x10 - bl GetBattleAnimArenaFlag - cmp r0, #1 - bne _0807226A -_08072266: - movs r0, #0 - b _0807239E -_0807226A: - cmp r4, #0x40 - bls _08072270 - b _0807239C -_08072270: - lsls r0, r4, #2 - ldr r1, _0807227C @ _08072280 - adds r0, r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_0807227C: .4byte _08072280 -_08072280: @ jump table - .4byte _0807239C @ case 0 - .4byte _08072266 @ case 1 - .4byte _08072266 @ case 2 - .4byte _08072266 @ case 3 - .4byte _08072266 @ case 4 - .4byte _08072266 @ case 5 - .4byte _08072398 @ case 6 - .4byte _08072398 @ case 7 - .4byte _08072398 @ case 8 - .4byte _08072398 @ case 9 - .4byte _08072266 @ case 10 - .4byte _08072398 @ case 11 - .4byte _08072384 @ case 12 - .4byte _08072384 @ case 13 - .4byte _08072390 @ case 14 - .4byte _08072390 @ case 15 - .4byte _08072388 @ case 16 - .4byte _08072266 @ case 17 - .4byte _0807238C @ case 18 - .4byte _08072394 @ case 19 - .4byte _08072394 @ case 20 - .4byte _08072388 @ case 21 - .4byte _08072388 @ case 22 - .4byte _08072398 @ case 23 - .4byte _08072398 @ case 24 - .4byte _08072266 @ case 25 - .4byte _08072266 @ case 26 - .4byte _08072266 @ case 27 - .4byte _08072266 @ case 28 - .4byte _08072398 @ case 29 - .4byte _08072398 @ case 30 - .4byte _08072398 @ case 31 - .4byte _08072398 @ case 32 - .4byte _08072398 @ case 33 - .4byte _08072266 @ case 34 - .4byte _08072266 @ case 35 - .4byte _08072398 @ case 36 - .4byte _08072266 @ case 37 - .4byte _0807238C @ case 38 - .4byte _08072266 @ case 39 - .4byte _08072266 @ case 40 - .4byte _08072266 @ case 41 - .4byte _0807238C @ case 42 - .4byte _08072266 @ case 43 - .4byte _0807239C @ case 44 - .4byte _08072398 @ case 45 - .4byte _0807239C @ case 46 - .4byte _08072266 @ case 47 - .4byte _08072398 @ case 48 - .4byte _08072398 @ case 49 - .4byte _08072398 @ case 50 - .4byte _08072266 @ case 51 - .4byte _0807239C @ case 52 - .4byte _0807239C @ case 53 - .4byte _08072388 @ case 54 - .4byte _08072398 @ case 55 - .4byte _08072266 @ case 56 - .4byte _08072266 @ case 57 - .4byte _0807238C @ case 58 - .4byte _0807238C @ case 59 - .4byte _08072388 @ case 60 - .4byte _0807238C @ case 61 - .4byte _08072398 @ case 62 - .4byte _08072266 @ case 63 - .4byte _08072266 @ case 64 -_08072384: - movs r0, #1 - b _0807239E -_08072388: - movs r0, #2 - b _0807239E -_0807238C: - movs r0, #3 - b _0807239E -_08072390: - movs r0, #4 - b _0807239E -_08072394: - movs r0, #5 - b _0807239E -_08072398: - movs r0, #6 - b _0807239E -_0807239C: - movs r0, #0 -_0807239E: - pop {r4} - pop {r1} - bx r1 - - THUMB_FUNC_END sub_8072258 - - THUMB_FUNC_START sub_80723A4 -sub_80723A4: @ 0x080723A4 - push {r4, r5, lr} - adds r4, r0, #0 - bl sub_807290C - movs r2, #2 - ldrsh r1, [r4, r2] - adds r5, r0, r1 - adds r0, r4, #0 - bl GetAnimPosition - cmp r0, #0 - bne _080723C2 - cmp r5, #0x58 - bgt _080723CA - b _080723C6 -_080723C2: - cmp r5, #0x97 - ble _080723CA -_080723C6: - movs r0, #1 - b _080723CC -_080723CA: - movs r0, #0 -_080723CC: - pop {r4, r5} - pop {r1} - bx r1 - - THUMB_FUNC_END sub_80723A4 - - THUMB_FUNC_START sub_80723D4 -sub_80723D4: @ 0x080723D4 - push {lr} - lsls r0, r0, #0x10 - lsrs r0, r0, #0x10 - adds r2, r0, #0 - movs r1, #0 - cmp r0, #4 - bls _080723F8 - cmp r0, #8 - bhi _080723EA - movs r1, #1 - b _080723F8 -_080723EA: - cmp r0, #0xb - bhi _080723F2 - movs r1, #2 - b _080723F8 -_080723F2: - cmp r2, #0xf - bhi _080723F8 - movs r1, #3 -_080723F8: - adds r0, r1, #0 - pop {r1} - bx r1 - - THUMB_FUNC_END sub_80723D4 - - THUMB_FUNC_START sub_8072400 -sub_8072400: @ 0x08072400 - push {r4, r5, r6, lr} - adds r5, r0, #0 - ldr r4, _08072440 @ gEfxPairHpBufOffset - bl GetAnimPosition - lsls r0, r0, #1 - adds r0, r0, r4 - movs r1, #0 - ldrsh r6, [r0, r1] - adds r0, r5, #0 - bl GetAnimPosition - lsls r1, r6, #1 - adds r6, r1, r0 - adds r0, r6, #0 - bl GetEfxHp - adds r4, r0, #0 - lsls r4, r4, #0x10 - asrs r4, r4, #0x10 - adds r0, r6, #2 - bl GetEfxHp - lsls r0, r0, #0x10 - asrs r0, r0, #0x10 - cmp r4, r0 - beq _08072448 - cmp r0, #0 - beq _08072444 - movs r0, #0 - b _0807244A - .align 2, 0 -_08072440: .4byte gEfxPairHpBufOffset -_08072444: - movs r0, #1 - b _0807244A -_08072448: - movs r0, #2 -_0807244A: - pop {r4, r5, r6} - pop {r1} - bx r1 - - THUMB_FUNC_END sub_8072400 - - THUMB_FUNC_START sub_8072450 -sub_8072450: @ 0x08072450 - push {r4, r5, r6, lr} - adds r5, r0, #0 - bl GetAnimAnotherSide - adds r4, r0, #0 - ldr r6, _080724C0 @ 0x0000FFFF - adds r0, r5, #0 - bl sub_8072504 - adds r0, r4, #0 - bl sub_8072400 - lsls r0, r0, #0x10 - asrs r0, r0, #0x10 - cmp r0, #2 - beq _080724A6 - adds r0, r5, #0 - bl GetAnimPosition - adds r1, r0, #0 - ldrh r0, [r5, #0xe] - subs r0, #1 - lsls r0, r0, #1 - adds r0, r0, r1 - bl GetBattleAnimRoundTypeFlags - movs r1, #0x80 - lsls r1, r1, #2 - ands r1, r0 - cmp r1, #0 - beq _080724A6 - ldr r4, _080724C4 @ 0x000003CF - movs r1, #0x80 - lsls r1, r1, #1 - adds r0, r4, #0 - bl EfxPlaySE - movs r0, #2 - ldrsh r1, [r5, r0] - adds r0, r4, #0 - movs r2, #1 - bl M4aPlayWithPostionCtrl -_080724A6: - adds r0, r5, #0 - bl sub_8072400 - lsls r0, r0, #0x10 - asrs r0, r0, #0x10 - cmp r0, #1 - beq _080724D2 - cmp r0, #1 - bgt _080724C8 - cmp r0, #0 - beq _080724CE - b _080724D8 - .align 2, 0 -_080724C0: .4byte 0x0000FFFF -_080724C4: .4byte 0x000003CF -_080724C8: - cmp r0, #2 - beq _080724D6 - b _080724D8 -_080724CE: - movs r6, #0xd4 - b _080724D8 -_080724D2: - movs r6, #0xd5 - b _080724D8 -_080724D6: - ldr r6, _08072500 @ 0x000002CE -_080724D8: - lsls r0, r6, #0x10 - asrs r4, r0, #0x10 - movs r0, #1 - negs r0, r0 - cmp r4, r0 - beq _080724FA - movs r1, #0x80 - lsls r1, r1, #1 - adds r0, r4, #0 - bl EfxPlaySE - movs r0, #2 - ldrsh r1, [r5, r0] - adds r0, r4, #0 - movs r2, #1 - bl M4aPlayWithPostionCtrl -_080724FA: - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_08072500: .4byte 0x000002CE - - THUMB_FUNC_END sub_8072450 - THUMB_FUNC_START sub_8072504 sub_8072504: @ 0x08072504 push {r4, r5, lr} @@ -1161,7 +9,7 @@ sub_8072504: @ 0x08072504 bl GetAnimAnotherSide adds r5, r0, #0 adds r0, r4, #0 - bl sub_8072400 + bl GetEfxHpChangeType lsls r0, r0, #0x10 asrs r0, r0, #0x10 cmp r0, #1 diff --git a/include/ekrbattle.h b/include/ekrbattle.h index 59b979a63..21f43c185 100644 --- a/include/ekrbattle.h +++ b/include/ekrbattle.h @@ -377,8 +377,6 @@ void DoM4aSongNumStop(int); void UnregisterEfxSoundSeExist(void); void RegisterEfxSoundSeExist(void); int CheckEfxSoundSeExist(void); -void M4aPlayWithPostionCtrl(int, int, int); -void EfxPlaySEwithCmdCtrl(struct Anim * anim, int); extern int gEkrDebugTimer, gEkrDebugUnk1; @@ -916,11 +914,20 @@ int GetAnimSpriteRotScaleX(u32 header); int GetAnimSpriteRotScaleY(u32 header); void BanimUpdateSpriteRotScale(void * src, struct AnimSpriteData * out, s16 x, s16 y, int unused); -u16 sub_8072258(u16 terrain); -int sub_80723A4(struct Anim * anim); -u16 sub_80723D4(u16 basecon); -s16 sub_8072400(struct Anim * anim); -void sub_8072450(struct Anim * anim); +void M4aPlayWithPostionCtrl(int, int, int); +void EfxPlaySEwithCmdCtrl(struct Anim * anim, int); +u16 GetEfxSoundType1FromTerrain(u16 terrain); +int IsAnimSoundInPositionMaybe(struct Anim * anim); +u16 GetEfxSoundType2FromBaseCon(u16 basecon); + +enum efx_hp_change_type { + EFX_HPT_CHANGED = 0, + EFX_HPT_DEFEATED = 1, + EFX_HPT_NOT_CHANGE = 2 +}; + +s16 GetEfxHpChangeType(struct Anim * anim); +void EfxPlayHittedSFX(struct Anim * anim); void sub_8072504(struct Anim * anim); // ??? sub_8072548(???); // ??? sub_8072570(???); diff --git a/src/banim-efxhit.c b/src/banim-efxhit.c index fa9d53b0d..bc3243e83 100644 --- a/src/banim-efxhit.c +++ b/src/banim-efxhit.c @@ -76,7 +76,7 @@ void NewEfxPierceCritical(struct Anim * anim) struct Anim * anim1 = GetAnimAnotherSide(anim); int is_pierce; - is_pierce = GetBattleAnimRoundTypeFlags((anim1->nextRoundId - 1) * 2 + GetAnimPosition(anim1)) & ANIM_ROUND_PIERCE; + is_pierce = GetRoundFlagByAnim(anim1) & ANIM_ROUND_PIERCE; if (is_pierce != 0) { NewEfxPierceCriticalEffect(anim); } else { @@ -155,7 +155,7 @@ void NewEfxNormalEffect(struct Anim *anim) int is_pierce; SpellFx_ClearBG1Position(); - is_pierce = GetBattleAnimRoundTypeFlags((anim->nextRoundId - 1) * 2 + GetAnimPosition(anim)) & ANIM_ROUND_PIERCE; + is_pierce = GetRoundFlagByAnim(anim) & ANIM_ROUND_PIERCE; if (is_pierce != 0) { NewEfxPierceNormalEffect(anim); } else { diff --git a/src/banim-efxhpbar.c b/src/banim-efxhpbar.c index 5cef10afa..f48b8c475 100644 --- a/src/banim-efxhpbar.c +++ b/src/banim-efxhpbar.c @@ -27,14 +27,13 @@ short EkrEfxIsUnitHittedNow(int pos) } /* During dmage, cause hp bar change value effect */ -void NewEfxHPBar(struct Anim *anim) +void NewEfxHPBar(struct Anim * anim) { int val1; s16 val2; - struct ProcEfxHPBar *proc; - int ais_id = GetAnimPosition(anim); + struct ProcEfxHPBar * proc; - if (ANIM_ROUND_GREAT_SHIELD & GetBattleAnimRoundTypeFlags((anim->nextRoundId - 1) * 2 + ais_id) || gEkrHPBarCount != 0) + if (ANIM_ROUND_GREAT_SHIELD & GetRoundFlagByAnim(anim) || gEkrHPBarCount != 0) return; gEkrHPBarCount = 1; @@ -419,13 +418,12 @@ void EfxHPBarLiveMain(struct ProcEfxHPBar * proc) proc->timer = 0x1E; } -void NewEfxNoDmage(struct Anim *anim1, struct Anim *anim2, int death) +void NewEfxNoDmage(struct Anim * anim1, struct Anim * anim2, int death) { - struct BattleUnit *bu; - struct ProcEfxHPBar *proc; - int ais_id = GetAnimPosition(anim1); + struct BattleUnit * bu; + struct ProcEfxHPBar * proc; - if (ANIM_ROUND_GREAT_SHIELD & GetBattleAnimRoundTypeFlags((anim1->nextRoundId - 1) * 2 + ais_id)) + if (ANIM_ROUND_GREAT_SHIELD & GetRoundFlagByAnim(anim1)) return; if (GetAnimPosition(anim1) == 0) @@ -449,7 +447,7 @@ void NewEfxNoDmage(struct Anim *anim1, struct Anim *anim2, int death) void EfxNoDamageMain(struct ProcEfxHPBar * proc) { s32 val; - struct Anim *anim = GetAnimAnotherSide(proc->anim5C); + struct Anim * anim = GetAnimAnotherSide(proc->anim5C); ++proc->pos; val = proc->pos; diff --git a/src/banim-efxmagic-fire.c b/src/banim-efxmagic-fire.c index 43d8c42bb..79587c38b 100644 --- a/src/banim-efxmagic-fire.c +++ b/src/banim-efxmagic-fire.c @@ -78,7 +78,7 @@ void Loop6C_efxFire(struct ProcEfx *proc) StartSubSpell_efxElfireBGCOL(animc); StartSubSpell_efxElfireOBJ(animc); } - sub_8072450(animc); + EfxPlayHittedSFX(animc); return; } diff --git a/src/banim-efxmagic-thunder.c b/src/banim-efxmagic-thunder.c index ca7bfdc8c..96b1bd734 100644 --- a/src/banim-efxmagic-thunder.c +++ b/src/banim-efxmagic-thunder.c @@ -40,7 +40,7 @@ void Loop6C_efxThunder(struct ProcEfx *proc) PlaySFX(0xF5, 0x100, animc->xPosition, 1); if (proc->hitted == EKR_HITTED) - sub_8072450(animc); + EfxPlayHittedSFX(animc); return; } diff --git a/src/banim-efxmisc.c b/src/banim-efxmisc.c index 574817288..3787f1b11 100644 --- a/src/banim-efxmisc.c +++ b/src/banim-efxmisc.c @@ -506,7 +506,7 @@ void NewEfxSunakemuriOBJ(struct Anim *anim, int type) break; case TERRAIN_BRIDGE_14: - if (sub_80723A4(proc->anim) != EKR_POS_L) + if (IsAnimSoundInPositionMaybe(proc->anim) != EKR_POS_L) SpellFx_RegisterObjPal(gUnknown_085F1620, 0x20); else SpellFx_RegisterObjPal(gUnknown_085F1640, 0x20); diff --git a/src/banim-efxsound.c b/src/banim-efxsound.c index a7f05d1dc..9e34eb67c 100644 --- a/src/banim-efxsound.c +++ b/src/banim-efxsound.c @@ -113,14 +113,14 @@ void M4aPlayWithPostionCtrl(int songid, int x, int flag) } } -/* https://decomp.me/scratch/B31Dj */ -#if 0 void EfxPlaySEwithCmdCtrl(struct Anim * anim, int cmd) { - u16 val1, val2, val3; - int pos, terrain, volume, tmp; + u16 sound_type, sound_pos, val2; + int pos, terrain, volume, basecon, tmp, _tmp; int songid; - s16 _songid; + s16 _songid, _volume; + u16 * song_table; + struct Anim * anim2 = GetAnimAnotherSide(anim); if (GetAISLayerId(anim) == 1) @@ -132,20 +132,22 @@ void EfxPlaySEwithCmdCtrl(struct Anim * anim, int cmd) else terrain = gEkrPairTerrainID[POS_R]; - val1 = sub_8072258(terrain); + sound_type = GetEfxSoundType1FromTerrain(terrain); if (terrain == TERRAIN_BRIDGE_14) { - if (sub_80723A4(anim) == 0) - val1 = 2; + if (IsAnimSoundInPositionMaybe(anim) == 0) + sound_type = 2; } if (pos == POS_L) - val2 = sub_80723D4(gEkrPairBaseCon[POS_L]); + basecon = gEkrPairBaseCon[POS_L]; else - val2 = sub_80723D4(gEkrPairBaseCon[POS_R]); + basecon = gEkrPairBaseCon[POS_R]; + + val2 = GetEfxSoundType2FromBaseCon(basecon); songid = (u16)-1; - val3 = anim->xPosition + sub_807290C(anim); + sound_pos = sub_807290C(anim) + anim->xPosition; volume = 0x100; switch (cmd) { @@ -154,28 +156,31 @@ void EfxPlaySEwithCmdCtrl(struct Anim * anim, int cmd) break; case 27: - songid = gBanimSongTable1[val1][pos]; + song_table = gBanimSongTable1[sound_type]; + songid = song_table[pos + val2 * 2]; break; case 28: - songid = gBanimSongTable2[val1][pos]; + song_table = gBanimSongTable2[sound_type]; + songid = song_table[pos + val2 * 2]; break; case 29: - songid = gBanimSongTable2[val1][pos]; + song_table = gBanimSongTable3[sound_type]; + songid = song_table[pos + val2 * 2]; break; case 30: - songid = gBanimSongTable2[val1][pos]; + song_table = gBanimSongTable4[sound_type]; + songid = song_table[pos + val2 * 2]; break; case 31: sub_8072504(anim2); - if (sub_8072400(anim2) != 2) + if (GetEfxHpChangeType(anim2) != EFX_HPT_NOT_CHANGE) { - int flag = GetBattleAnimRoundTypeFlags((anim->nextRoundId - 1) * 2 + GetAnimPosition(anim)); - if (flag & 0x200) + if (GetRoundFlagByAnim(anim) & ANIM_ROUND_PIERCE) { _songid = 0x3CF; EfxPlaySE(_songid, 0x100); @@ -183,32 +188,30 @@ void EfxPlaySEwithCmdCtrl(struct Anim * anim, int cmd) } } - switch (sub_8072400(anim2)) { - case 1: - songid = 0xD5; + switch (GetEfxHpChangeType(anim2)) { + case EFX_HPT_CHANGED: + songid = 0xD2; break; - case 2: - songid = 0x2CE; + case EFX_HPT_DEFEATED: + songid = 0xD5; break; - case 0: - songid = 0xD2; + case EFX_HPT_NOT_CHANGE: + songid = 0x2CE; break; default: break; } - val3 = anim2->xPosition + sub_807290C(anim2); + sound_pos = anim2->xPosition + sub_807290C(anim2); break; case 32: sub_8072504(anim2); - - if (sub_8072400(anim2) != 2) + if (GetEfxHpChangeType(anim2) != EFX_HPT_NOT_CHANGE) { - int flag = GetBattleAnimRoundTypeFlags((anim->nextRoundId - 1) * 2 + GetAnimPosition(anim)); - if (flag & 0x200) + if (GetRoundFlagByAnim(anim) & ANIM_ROUND_PIERCE) { _songid = 0x3CF; EfxPlaySE(_songid, 0x100); @@ -216,32 +219,31 @@ void EfxPlaySEwithCmdCtrl(struct Anim * anim, int cmd) } } - switch (sub_8072400(anim2)) { - case 1: - songid = 0xD5; + switch (GetEfxHpChangeType(anim2)) { + case EFX_HPT_CHANGED: + songid = 0xD3; break; - case 2: - songid = 0x2CE; + case EFX_HPT_DEFEATED: + songid = 0xD5; break; - case 0: - songid = 0xD3; + case EFX_HPT_NOT_CHANGE: + songid = 0x2CE; break; default: break; } - val3 = anim2->xPosition + sub_807290C(anim2); + sound_pos = anim2->xPosition + sub_807290C(anim2); break; case 33: sub_8072504(anim2); - if (sub_8072400(anim2) != 2) + if (GetEfxHpChangeType(anim2) != EFX_HPT_NOT_CHANGE) { - int flag = GetBattleAnimRoundTypeFlags((anim->nextRoundId - 1) * 2 + GetAnimPosition(anim)); - if (flag & 0x200) + if (GetRoundFlagByAnim(anim) & ANIM_ROUND_PIERCE) { _songid = 0x3CF; EfxPlaySE(_songid, 0x100); @@ -249,23 +251,23 @@ void EfxPlaySEwithCmdCtrl(struct Anim * anim, int cmd) } } - switch (sub_8072400(anim2)) { - case 1: - songid = 0xD5; + switch (GetEfxHpChangeType(anim2)) { + case EFX_HPT_CHANGED: + songid = 0xD4; break; - case 2: - songid = 0x2CE; + case EFX_HPT_DEFEATED: + songid = 0xD5; break; - case 0: - songid = 0xD4; + case EFX_HPT_NOT_CHANGE: + songid = 0x2CE; break; default: break; } - val3 = anim2->xPosition + sub_807290C(anim2); + sound_pos = anim2->xPosition + sub_807290C(anim2); break; case 34: @@ -313,21 +315,24 @@ void EfxPlaySEwithCmdCtrl(struct Anim * anim, int cmd) break; case 52: - if (pos == POS_L) + if (pos != POS_L) tmp = gEkrPairBanimID2[POS_L]; else tmp = gEkrPairBanimID2[POS_R]; switch (tmp) { - case 0xBC: + case 0xBC: /* todo: battle anim index */ case 0xBD: case 0xBE: case 0xBF: - songid = gBanimSongTable1[val1][pos + 4]; + song_table = gBanimSongTable1[sound_type]; + _tmp = pos + 4; + songid = song_table[_tmp]; break; default: - songid = gBanimSongTable1[val1][pos + val2 * 2]; + song_table = gBanimSongTable1[sound_type]; + songid = song_table[pos + val2 * 2]; break; } break; @@ -447,7 +452,8 @@ void EfxPlaySEwithCmdCtrl(struct Anim * anim, int cmd) break; case 89: - songid = gBanimSongTable5[val1][pos + val2 * 2]; + song_table = gBanimSongTable5[sound_type]; + songid = song_table[pos + val2 * 2]; break; case 90: @@ -463,7 +469,8 @@ void EfxPlaySEwithCmdCtrl(struct Anim * anim, int cmd) break; case 93: - songid = gBanimSongTable6[val1][pos + val2 * 2]; + song_table = gBanimSongTable6[sound_type]; + songid = song_table[pos + val2 * 2]; break; case 94: @@ -499,11 +506,13 @@ void EfxPlaySEwithCmdCtrl(struct Anim * anim, int cmd) break; case 102: - songid = gBanimSongTable7[val1][pos + val2 * 2]; + song_table = gBanimSongTable7[sound_type]; + songid = song_table[pos + val2 * 2]; break; case 103: - songid = gBanimSongTable8[val1][pos + val2 * 2]; + song_table = gBanimSongTable8[sound_type]; + songid = song_table[pos + val2 * 2]; break; case 104: @@ -523,19 +532,23 @@ void EfxPlaySEwithCmdCtrl(struct Anim * anim, int cmd) break; case 109: - songid = gBanimSongTable1[val1][pos]; + song_table = gBanimSongTable1[sound_type]; + songid = song_table[pos]; break; case 110: - songid = gBanimSongTable1[val1][pos + 2]; + song_table = gBanimSongTable1[sound_type]; + songid = song_table[pos + 2]; break; case 111: - songid = gBanimSongTable1[val1][pos + 4]; + song_table = gBanimSongTable1[sound_type]; + songid = song_table[pos + 4]; break; case 112: - songid = gBanimSongTable1[val1][pos + 6]; + song_table = gBanimSongTable1[sound_type]; + songid = song_table[pos + 6]; break; case 115: @@ -582,8 +595,213 @@ void EfxPlaySEwithCmdCtrl(struct Anim * anim, int cmd) _songid = songid; if (_songid != -1) { - EfxPlaySE(_songid, volume); - M4aPlayWithPostionCtrl(_songid, val3, 1); - } + _volume = volume; + EfxPlaySE(_songid, _volume); +#if !NONMATCHING +{ + register int r2 asm("r2"); + register int r1 asm("r1"); + + r2 = sound_pos; + r1 = (r2 << 0x10) >> 0x10; + r2 = 1; + M4aPlayWithPostionCtrl(_songid, r1, r2); } +#else + M4aPlayWithPostionCtrl(_songid, (s16)sound_pos, 1); #endif + } +} + +u16 GetEfxSoundType1FromTerrain(u16 terrain) +{ + int ret; + + if (GetBattleAnimArenaFlag() == true) + return 0; + + switch (terrain) { + case TERRAIN_PLAINS: + case TERRAIN_ROAD: + case TERRAIN_VILLAGE_03: + case TERRAIN_VILLAGE_04: + case TERRIAN_HOUSE: + case TERRAIN_FORT: + case TERRAIN_MOUNTAIN: + case TERRAIN_FENCE_19: + case TERRAIN_WALL_1A: + case TERRAIN_WALL_1B: + case TERRAIN_RUBBLE: + case TERRAIN_ROOF: + case TERRAIN_GATE_23: + case TERRAIN_RUINS_25: + case TERRAIN_BALLISTA_REGULAR: + case TERRAIN_BALLISTA_LONG: + case TERRAIN_BALLISTA_KILLER: + case TERRAIN_SHIP_WRECK: + case TERRAIN_GLACIER: + case TERRAIN_SNAG: + case TERRAIN_INN: + case TERRAIN_BARREL: + case TERRAIN_BRACE: + case TERRAIN_MAST: + ret = 0; + break; + + case TERRAIN_FOREST: + case TERRAIN_THICKET: + ret = 1; + break; + + case TERRAIN_RIVER: + case TERRAIN_SEA: + case TERRAIN_LAKE: + case TERRAIN_DEEPS: + case TERRAIN_WATER: + ret = 2; + break; + + case TERRAIN_PEAK: + case TERRAIN_CLIFF: + case TERRAIN_SHIP_FLAT: + case TERRAIN_BONE: + case TERRAIN_DARK: + case TERRAIN_GUNNELS: + ret = 3; + break; + + case TERRAIN_SAND: + case TERRAIN_DESERT: + ret = 4; + break; + + case TERRAIN_BRIDGE_13: + case TERRAIN_BRIDGE_14: + ret = 5; + break; + + case TERRAIN_ARMORY: + case TERRAIN_VENDOR: + case TERRAIN_ARENA_08: + case TERRAIN_C_ROOM_09: + case TERRAIN_GATE_0B: + case TERRAIN_FLOOR_17: + case TERRAIN_FLOOR_18: + case TERRAIN_PILLAR: + case TERRAIN_DOOR: + case TERRAIN_THRONE: + case TERRAIN_CHEST_20: + case TERRAIN_CHEST_21: + case TERRAIN_CHURCH: + case TERRAIN_STAIRS: + case TERRAIN_ARENA_30: + case TERRAIN_VALLEY: + case TERRAIN_FENCE_32: + case TERRAIN_RUINS_37: + case TERRAIN_DECK: + ret = 6; + break; + + case TERRAIN_TILE_00: + default: + ret = 0; + break; + } + return ret; +} + +int IsAnimSoundInPositionMaybe(struct Anim * anim) +{ + int sound_pos = sub_807290C(anim) + anim->xPosition; + if (GetAnimPosition(anim) == POS_L) + { + if (sound_pos > 0x58) + return false; + else + return true; + } + else + { + if (sound_pos <= 0x97) + return false; + else + return true; + } +} + +u16 GetEfxSoundType2FromBaseCon(u16 basecon) +{ + int ret = 0; + if (basecon >= 5) + { + if (basecon <= 8) + ret = 1; + else if (basecon <= 0xB) + ret = 2; + else if (basecon <= 0xF) + ret = 3; + } + return ret; +} + +s16 GetEfxHpChangeType(struct Anim * anim) +{ + int offset, hp1, hp2; + offset = gEfxPairHpBufOffset[GetAnimPosition(anim)]; + offset = offset * 2 + GetAnimPosition(anim); + + hp1 = GetEfxHp(offset); + hp2 = GetEfxHp(offset + 2); + + if (hp1 != hp2) + { + /* Hurt */ + if (hp2 != 0) + return EFX_HPT_CHANGED; + + /* Defeated */ + return EFX_HPT_DEFEATED; + } + /* Hp not change */ + return EFX_HPT_NOT_CHANGE; +} + +void EfxPlayHittedSFX(struct Anim * anim) +{ + struct Anim * animr = GetAnimAnotherSide(anim); + int songid = (u16)-1; + s16 _songid; + + sub_8072504(anim); + + if (GetEfxHpChangeType(animr) != EFX_HPT_NOT_CHANGE && (GetRoundFlagByAnim(anim) & ANIM_ROUND_PIERCE)) + { + _songid = 0x3CF; + EfxPlaySE(_songid, 0x100); + M4aPlayWithPostionCtrl(_songid, anim->xPosition, 1); + } + + switch (GetEfxHpChangeType(anim)) { + case EFX_HPT_CHANGED: + songid = 0xD4; + break; + + case EFX_HPT_DEFEATED: + songid = 0xD5; + break; + + case EFX_HPT_NOT_CHANGE: + songid = 0x2CE; + break; + + default: + break; + } + + _songid = songid; + if (_songid != -1) + { + EfxPlaySE(_songid, 0x100); + M4aPlayWithPostionCtrl(_songid, anim->xPosition, 1); + } +} diff --git a/src/banim-ekrutils.c b/src/banim-ekrutils.c index fbb50d2d5..28117f64b 100644 --- a/src/banim-ekrutils.c +++ b/src/banim-ekrutils.c @@ -84,8 +84,8 @@ void StartBattleAnimHitEffects(struct Anim *anim, int type, int a, int b) switch (type) { case EKR_HITTED: - roundt1 = GetBattleAnimRoundTypeFlags((animr7->nextRoundId - 1) * 2 + GetAnimPosition(animr7)); - roundt2 = GetBattleAnimRoundTypeFlags((animr5->nextRoundId - 1) * 2 + GetAnimPosition(animr5)); + roundt1 = GetRoundFlagByAnim(animr7); + roundt2 = GetRoundFlagByAnim(animr5); if (roundt1 & ANIM_ROUND_POISON) { if (GettUnitEfxDebuff(animr7) == UNIT_STATUS_NONE) diff --git a/src/banim-main.c b/src/banim-main.c index 087e0c201..af59d5680 100644 --- a/src/banim-main.c +++ b/src/banim-main.c @@ -221,7 +221,7 @@ void BattleAIS_ExecCommands(void) anim1 = GetAnimAnotherSide(anim); type = GetAnimRoundTypeAnotherSide(anim); if (CheckRoundMiss(type) == false) { - if (sub_8072400(anim1) != 2) { + if (GetEfxHpChangeType(anim1) != EFX_HPT_NOT_CHANGE) { if (GetRoundFlagByAnim(anim) & ANIM_ROUND_SILENCER) NewEfxChillEffect(anim1); else @@ -380,7 +380,7 @@ void BattleAIS_ExecCommands(void) StartBattleAnimHitEffectsDefault(anim1, CheckRoundMiss(type)); } - if (sub_8072400(anim1) != 2) { + if (GetEfxHpChangeType(anim1) != EFX_HPT_NOT_CHANGE) { if (GetRoundFlagByAnim(anim) & ANIM_ROUND_SILENCER) NewEfxChillEffect(anim1); else From 13f7cc6ea6a4a5e207624687f1e2bd09ec9ffa48 Mon Sep 17 00:00:00 2001 From: MokhaLeee Date: Fri, 20 Oct 2023 08:42:44 +0000 Subject: [PATCH 2/3] exfsound decompiled --- asm/banim-efxmagic-5BA64.s | 2 +- asm/banim-efxsound.s | 598 ------------------------------------- data/data-ekrclasschg.s | 201 ------------- include/efxbattle.h | 1 - include/ekrbattle.h | 33 +- include/ev_triggercheck.h | 4 +- ldscript.txt | 3 +- src/banim-efxsound-data.c | 163 ++++++++++ src/banim-efxsound.c | 326 +++++++++++++++++++- src/banim-ekrbattle.c | 4 +- src/banim-ekrcmd.c | 14 +- src/ev_triggercheck.c | 14 +- sym_ewram.txt | 2 +- 13 files changed, 521 insertions(+), 844 deletions(-) delete mode 100644 asm/banim-efxsound.s delete mode 100644 data/data-ekrclasschg.s create mode 100644 src/banim-efxsound-data.c diff --git a/asm/banim-efxmagic-5BA64.s b/asm/banim-efxmagic-5BA64.s index 05a54393b..5d3cd708f 100644 --- a/asm/banim-efxmagic-5BA64.s +++ b/asm/banim-efxmagic-5BA64.s @@ -1009,7 +1009,7 @@ sub_805C21C: @ 0x0805C21C cmp r0, #8 bne _0805C25C ldr r0, [r4, #0x60] - bl sub_807290C + bl GetProperAnimSoundLocation ldr r1, [r4, #0x60] ldrh r2, [r1, #2] adds r2, r2, r0 diff --git a/asm/banim-efxsound.s b/asm/banim-efxsound.s deleted file mode 100644 index 23f4e8cc3..000000000 --- a/asm/banim-efxsound.s +++ /dev/null @@ -1,598 +0,0 @@ - .INCLUDE "macro.inc" - - .SYNTAX UNIFIED - - THUMB_FUNC_START sub_8072504 -sub_8072504: @ 0x08072504 - push {r4, r5, lr} - adds r4, r0, #0 - bl GetAnimAnotherSide - adds r5, r0, #0 - adds r0, r4, #0 - bl GetEfxHpChangeType - lsls r0, r0, #0x10 - asrs r0, r0, #0x10 - cmp r0, #1 - bgt _08072540 - cmp r0, #0 - blt _08072540 - adds r0, r5, #0 - bl CheckRoundCrit - cmp r0, #1 - bne _08072540 - movs r1, #0x80 - lsls r1, r1, #1 - movs r0, #0xd8 - bl EfxPlaySE - movs r0, #2 - ldrsh r1, [r4, r0] - movs r0, #0xd8 - movs r2, #1 - bl M4aPlayWithPostionCtrl -_08072540: - pop {r4, r5} - pop {r0} - bx r0 - - THUMB_FUNC_END sub_8072504 - - THUMB_FUNC_START sub_8072548 -sub_8072548: @ 0x08072548 - push {lr} - ldr r1, _08072564 @ gBattleHitArray - ldr r1, [r1] - lsls r1, r1, #8 - lsrs r1, r1, #0x1b - movs r2, #8 - ands r1, r2 - negs r1, r1 - lsrs r1, r1, #0x1f - cmp r0, r1 - beq _08072568 - movs r0, #0 - b _0807256A - .align 2, 0 -_08072564: .4byte gBattleHitArray -_08072568: - movs r0, #1 -_0807256A: - pop {r1} - bx r1 - - THUMB_FUNC_END sub_8072548 - - THUMB_FUNC_START sub_8072570 -sub_8072570: @ 0x08072570 - push {lr} - cmp r0, #0 - bne _08072578 - b _080726A4 -_08072578: - bl GetItemIndex - subs r0, #0x4b - cmp r0, #0x41 - bls _08072584 - b _080726A4 -_08072584: - lsls r0, r0, #2 - ldr r1, _08072590 @ _08072594 - adds r0, r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_08072590: .4byte _08072594 -_08072594: @ jump table - .4byte _0807269C @ case 0 - .4byte _0807269C @ case 1 - .4byte _0807269C @ case 2 - .4byte _0807269C @ case 3 - .4byte _0807269C @ case 4 - .4byte _0807269C @ case 5 - .4byte _080726A0 @ case 6 - .4byte _080726A0 @ case 7 - .4byte _080726A0 @ case 8 - .4byte _080726A4 @ case 9 - .4byte _080726A4 @ case 10 - .4byte _080726A4 @ case 11 - .4byte _0807269C @ case 12 - .4byte _080726A4 @ case 13 - .4byte _0807269C @ case 14 - .4byte _080726A4 @ case 15 - .4byte _080726A4 @ case 16 - .4byte _080726A4 @ case 17 - .4byte _080726A4 @ case 18 - .4byte _080726A4 @ case 19 - .4byte _080726A4 @ case 20 - .4byte _080726A4 @ case 21 - .4byte _080726A4 @ case 22 - .4byte _080726A4 @ case 23 - .4byte _080726A4 @ case 24 - .4byte _080726A4 @ case 25 - .4byte _080726A4 @ case 26 - .4byte _080726A4 @ case 27 - .4byte _080726A4 @ case 28 - .4byte _080726A4 @ case 29 - .4byte _080726A4 @ case 30 - .4byte _080726A4 @ case 31 - .4byte _080726A4 @ case 32 - .4byte _080726A4 @ case 33 - .4byte _080726A4 @ case 34 - .4byte _080726A4 @ case 35 - .4byte _080726A4 @ case 36 - .4byte _080726A4 @ case 37 - .4byte _080726A4 @ case 38 - .4byte _080726A4 @ case 39 - .4byte _080726A4 @ case 40 - .4byte _080726A4 @ case 41 - .4byte _080726A4 @ case 42 - .4byte _080726A4 @ case 43 - .4byte _080726A4 @ case 44 - .4byte _080726A4 @ case 45 - .4byte _080726A4 @ case 46 - .4byte _080726A4 @ case 47 - .4byte _080726A4 @ case 48 - .4byte _080726A4 @ case 49 - .4byte _080726A4 @ case 50 - .4byte _080726A4 @ case 51 - .4byte _080726A4 @ case 52 - .4byte _080726A4 @ case 53 - .4byte _080726A4 @ case 54 - .4byte _080726A4 @ case 55 - .4byte _080726A4 @ case 56 - .4byte _080726A4 @ case 57 - .4byte _080726A4 @ case 58 - .4byte _080726A4 @ case 59 - .4byte _080726A4 @ case 60 - .4byte _080726A4 @ case 61 - .4byte _080726A4 @ case 62 - .4byte _080726A4 @ case 63 - .4byte _080726A4 @ case 64 - .4byte _0807269C @ case 65 -_0807269C: - movs r0, #2 - b _080726A6 -_080726A0: - movs r0, #1 - b _080726A6 -_080726A4: - movs r0, #0 -_080726A6: - pop {r1} - bx r1 - - THUMB_FUNC_END sub_8072570 - - THUMB_FUNC_START sub_80726AC -sub_80726AC: @ 0x080726AC - push {r4, r5, r6, r7, lr} - ldr r0, _080726F0 @ gpEkrBattleUnitLeft - ldr r1, _080726F4 @ gpEkrBattleUnitRight - ldr r5, [r0] - ldr r7, [r1] - ldr r0, _080726F8 @ gBmSt - ldrb r1, [r0, #4] - movs r0, #0x20 - ands r0, r1 - cmp r0, #0 - beq _080726C4 - b _0807288C -_080726C4: - ldr r1, _080726FC @ gUnknown_020200A8 - movs r0, #1 - str r0, [r1] - ldr r1, _08072700 @ gPalIndexEfxHpBarUnk - ldr r0, _08072704 @ gEkrInitialHitSide - movs r2, #0 - ldrsh r0, [r0, r2] - lsls r0, r0, #1 - adds r0, r0, r1 - movs r1, #0 - ldrsh r0, [r0, r1] - movs r6, #0x1a - cmp r0, #1 - beq _080726E2 - movs r6, #0x19 -_080726E2: - bl GetBattleAnimArenaFlag - cmp r0, #1 - bne _08072708 - bl Sound_SetDefaultMaxNumChannels - b _08072710 - .align 2, 0 -_080726F0: .4byte gpEkrBattleUnitLeft -_080726F4: .4byte gpEkrBattleUnitRight -_080726F8: .4byte gBmSt -_080726FC: .4byte gUnknown_020200A8 -_08072700: .4byte gPalIndexEfxHpBarUnk -_08072704: .4byte gEkrInitialHitSide -_08072708: - bl GetBanimLinkArenaFlag - cmp r0, #1 - bne _0807271C -_08072710: - movs r1, #0x80 - lsls r1, r1, #1 - movs r0, #0x39 - bl EfxOverrideBgm - b _08072892 -_0807271C: - ldr r0, _08072734 @ gEkrDistanceType - movs r2, #0 - ldrsh r0, [r0, r2] - cmp r0, #4 - bne _08072738 - movs r1, #0x80 - lsls r1, r1, #1 - movs r0, #0x23 - bl EfxOverrideBgm - b _08072892 - .align 2, 0 -_08072734: .4byte gEkrDistanceType -_08072738: - movs r4, #0 - adds r0, r7, #0 - adds r0, #0x4a - ldrh r0, [r0] - bl sub_8058B08 - lsls r0, r0, #0x10 - asrs r0, r0, #0x10 - cmp r0, #1 - bne _0807274E - movs r4, #1 -_0807274E: - movs r0, #1 - bl sub_8058B24 - lsls r0, r0, #0x18 - cmp r0, #0 - bne _0807275C - movs r4, #0 -_0807275C: - ldr r0, _08072790 @ gEkrPairSideVaild - movs r1, #0 - ldrsh r0, [r0, r1] - cmp r0, #0 - bne _08072768 - movs r4, #0 -_08072768: - ldr r0, [r5] - ldrb r0, [r0, #4] - cmp r0, #0x40 - bne _08072772 - movs r4, #0 -_08072772: - cmp r0, #0x6c - bne _08072778 - movs r4, #0 -_08072778: - cmp r0, #0xbe - bne _0807277E - movs r4, #0 -_0807277E: - cmp r4, #1 - bne _08072794 - movs r1, #0x80 - lsls r1, r1, #1 - movs r0, #0x1f - bl EfxOverrideBgm - b _08072892 - .align 2, 0 -_08072790: .4byte gEkrPairSideVaild -_08072794: - cmp r0, #0xbe - bne _080727B4 - bl CheckFlag82 - lsls r0, r0, #0x18 - asrs r0, r0, #0x18 - cmp r0, #1 - bne _080727B0 - movs r1, #0x80 - lsls r1, r1, #1 - movs r0, #0x55 - bl EfxOverrideBgm - b _08072892 -_080727B0: - bl SetFlag82 -_080727B4: - adds r0, r5, #0 - bl sub_80728D0 - adds r4, r0, #0 - ldr r0, [r5] - ldrb r0, [r0, #4] - bl GetUnitFromCharId - ldrb r0, [r0, #0xb] - lsls r0, r0, #0x18 - asrs r0, r0, #0x18 - movs r1, #0xc0 - ands r0, r1 - cmp r0, #0 - bne _080727D6 - movs r4, #1 - negs r4, r4 -_080727D6: - ldr r0, _080727F8 @ gEkrPairSideVaild - movs r2, #0 - ldrsh r0, [r0, r2] - cmp r0, #0 - bne _080727E4 - movs r4, #1 - negs r4, r4 -_080727E4: - movs r0, #1 - negs r0, r0 - cmp r4, r0 - beq _080727FC - movs r1, #0x80 - lsls r1, r1, #1 - adds r0, r4, #0 - bl EfxOverrideBgm - b _08072892 - .align 2, 0 -_080727F8: .4byte gEkrPairSideVaild -_080727FC: - movs r4, #0 - ldr r0, [r7, #4] - ldrb r0, [r0, #4] - cmp r0, #0x4d - bne _08072822 - ldr r0, _08072834 @ gBattleStats - ldrh r1, [r0] - movs r0, #0x40 - ands r0, r1 - lsls r0, r0, #0x10 - lsrs r0, r0, #0x10 - negs r0, r0 - lsrs r4, r0, #0x1f - movs r0, #0x80 - lsls r0, r0, #2 - ands r0, r1 - cmp r0, #0 - beq _08072822 - movs r4, #1 -_08072822: - cmp r4, #1 - bne _08072838 - movs r1, #0x80 - lsls r1, r1, #1 - movs r0, #0x20 - bl EfxOverrideBgm - b _08072892 - .align 2, 0 -_08072834: .4byte gBattleStats -_08072838: - movs r0, #0 - bl sub_8072548 - cmp r0, #1 - bne _0807284C - ldr r0, _08072848 @ gBattleActor - b _08072858 - .align 2, 0 -_08072848: .4byte gBattleActor -_0807284C: - movs r0, #1 - bl sub_8072548 - cmp r0, #1 - bne _08072868 - ldr r0, _08072864 @ gBattleTarget -_08072858: - adds r0, #0x4a - ldrh r0, [r0] - bl sub_8072570 - b _0807286A - .align 2, 0 -_08072864: .4byte gBattleTarget -_08072868: - movs r0, #0 -_0807286A: - cmp r0, #1 - beq _08072876 - cmp r0, #2 - bne _08072878 - movs r6, #0x22 - b _08072878 -_08072876: - movs r6, #0x21 -_08072878: - movs r0, #1 - negs r0, r0 - cmp r6, r0 - beq _0807288C - movs r1, #0x80 - lsls r1, r1, #1 - adds r0, r6, #0 - bl EfxOverrideBgm - b _08072892 -_0807288C: - ldr r1, _08072898 @ gUnknown_020200A8 - movs r0, #0 - str r0, [r1] -_08072892: - pop {r4, r5, r6, r7} - pop {r0} - bx r0 - .align 2, 0 -_08072898: .4byte gUnknown_020200A8 - - THUMB_FUNC_END sub_80726AC - - THUMB_FUNC_START sub_807289C -sub_807289C: @ 0x0807289C - push {lr} - bl CheckBanimHensei - cmp r0, #1 - beq _080728BA - ldr r0, _080728C0 @ gBmSt - ldrb r1, [r0, #4] - movs r0, #0x20 - ands r0, r1 - cmp r0, #0 - bne _080728BA - ldr r0, _080728C4 @ gUnknown_020200A8 - ldr r0, [r0] - cmp r0, #0 - bne _080728C8 -_080728BA: - bl MakeBgmOverridePersist - b _080728CC - .align 2, 0 -_080728C0: .4byte gBmSt -_080728C4: .4byte gUnknown_020200A8 -_080728C8: - bl RestoreBgm -_080728CC: - pop {r0} - bx r0 - - THUMB_FUNC_END sub_807289C - - THUMB_FUNC_START sub_80728D0 -sub_80728D0: @ 0x080728D0 - push {r4, r5, lr} - ldr r0, [r0] - ldrb r2, [r0, #4] - movs r3, #0 - ldr r0, _08072908 @ gUnknown_08758A60 - ldr r1, [r0] - movs r4, #1 - negs r4, r4 - adds r5, r0, #0 - cmp r1, r4 - beq _080728FA - cmp r2, r1 - beq _080728FA - adds r1, r5, #0 -_080728EC: - adds r1, #8 - adds r3, #2 - ldr r0, [r1] - cmp r0, r4 - beq _080728FA - cmp r2, r0 - bne _080728EC -_080728FA: - adds r0, r3, #1 - lsls r0, r0, #2 - adds r0, r0, r5 - ldr r0, [r0] - pop {r4, r5} - pop {r1} - bx r1 - .align 2, 0 -_08072908: .4byte gUnknown_08758A60 - - THUMB_FUNC_END sub_80728D0 - - THUMB_FUNC_START sub_807290C -sub_807290C: @ 0x0807290C - push {r4, r5, r6, r7, lr} - mov r7, r8 - push {r7} - ldr r2, [r0, #0x3c] - ldr r3, [r2] - ldr r1, _0807293C @ 0xFFFF0000 - adds r0, r3, #0 - ands r0, r1 - cmp r0, r1 - bne _08072930 - ldr r7, _08072940 @ 0x0000FFFF - ands r7, r3 - cmp r7, #0 - beq _08072930 -_08072928: - subs r7, #1 - adds r2, #0xc - cmp r7, #0 - bne _08072928 -_08072930: - adds r6, r2, #0 - movs r7, #0 - movs r0, #0 - mov r8, r0 - b _08072978 - .align 2, 0 -_0807293C: .4byte 0xFFFF0000 -_08072940: .4byte 0x0000FFFF -_08072944: - movs r0, #6 - ldrsh r5, [r6, r0] - ldr r0, [r6] - bl GetAnimSpriteRotScaleX - lsls r0, r0, #0x10 - asrs r0, r0, #0x11 - adds r5, r5, r0 - ldr r0, [r6] - bl GetAnimSpriteRotScaleX - adds r4, r0, #0 - ldr r0, [r6] - bl GetAnimSpriteRotScaleY - lsls r4, r4, #0x10 - asrs r4, r4, #0x10 - lsls r0, r0, #0x10 - asrs r0, r0, #0x10 - adds r1, r4, #0 - muls r1, r0, r1 - adds r0, r1, #0 - muls r0, r5, r0 - add r8, r0 - adds r7, r7, r1 - adds r6, #0xc -_08072978: - ldr r0, [r6] - cmp r0, #1 - bne _08072944 - cmp r7, #0 - bne _0807298C - ldr r0, _08072988 @ 0x7FFFFFFF - b _08072994 - .align 2, 0 -_08072988: .4byte 0x7FFFFFFF -_0807298C: - mov r0, r8 - adds r1, r7, #0 - bl Div -_08072994: - mov r8, r0 - mov r0, r8 - pop {r3} - mov r8, r3 - pop {r4, r5, r6, r7} - pop {r1} - bx r1 - - THUMB_FUNC_END sub_807290C - - THUMB_FUNC_START PlaySFX -PlaySFX: @ 0x080729A4 - push {r4, r5, r6, lr} - adds r4, r0, #0 - adds r5, r2, #0 - adds r6, r3, #0 - bl EfxPlaySE - adds r0, r4, #0 - adds r1, r5, #0 - adds r2, r6, #0 - bl M4aPlayWithPostionCtrl - pop {r4, r5, r6} - pop {r0} - bx r0 - - THUMB_FUNC_END PlaySFX - - THUMB_FUNC_START sub_80729C0 -sub_80729C0: @ 0x080729C0 - push {r4, r5, lr} - adds r5, r0, #0 - adds r4, r2, #0 - bl EfxPlaySE - adds r0, r4, #0 - bl sub_807290C - adds r1, r0, #0 - adds r0, r5, #0 - movs r2, #1 - bl M4aPlayWithPostionCtrl - pop {r4, r5} - pop {r0} - bx r0 - - THUMB_FUNC_END sub_80729C0 - -.align 2, 0 diff --git a/data/data-ekrclasschg.s b/data/data-ekrclasschg.s deleted file mode 100644 index 9e2a54c51..000000000 --- a/data/data-ekrclasschg.s +++ /dev/null @@ -1,201 +0,0 @@ - .section .data - - .global gUnknown_08758A60 -gUnknown_08758A60: @ 0x08758A60 - .incbin "baserom.gba", 0x758A60, 0x2C0 - - .global gBanimSongTable1 -gBanimSongTable1: @ 0x08758D20 - .4byte gUnknown_08758A60 + 0x100 - .4byte gUnknown_08758A60 + 0x110 - .4byte gUnknown_08758A60 + 0x120 - .4byte gUnknown_08758A60 + 0x130 - .4byte gUnknown_08758A60 + 0x140 - .4byte gUnknown_08758A60 + 0x150 - .4byte gUnknown_08758A60 + 0x160 - - .global gBanimSongTable2 -gBanimSongTable2: @ 0x08758D3C - .4byte gUnknown_08758A60 + 0x170 - .4byte gUnknown_08758A60 + 0x180 - .4byte gUnknown_08758A60 + 0x190 - .4byte gUnknown_08758A60 + 0x1a0 - .4byte gUnknown_08758A60 + 0x1b0 - .4byte gUnknown_08758A60 + 0x1c0 - .4byte gUnknown_08758A60 + 0x1d0 - - .global gBanimSongTable3 -gBanimSongTable3: @ 0x08758D58 - .4byte gUnknown_08758A60 + 0x1e0 - .4byte gUnknown_08758A60 + 0x1f0 - .4byte gUnknown_08758A60 + 0x200 - .4byte gUnknown_08758A60 + 0x210 - .4byte gUnknown_08758A60 + 0x220 - .4byte gUnknown_08758A60 + 0x230 - .4byte gUnknown_08758A60 + 0x240 - - .global gBanimSongTable4 -gBanimSongTable4: @ 0x08758D74 -@ Replacing .incbin "baserom.gba", 0x758D74, 0x8C - .4byte gUnknown_08758A60 + 0x250 - .4byte gUnknown_08758A60 + 0x260 - .4byte gUnknown_08758A60 + 0x270 - .4byte gUnknown_08758A60 + 0x280 - .4byte gUnknown_08758A60 + 0x290 - .4byte gUnknown_08758A60 + 0x2a0 - .4byte gUnknown_08758A60 + 0x2b0 - .4byte 0x03390338 - .4byte 0x03390338 - .4byte 0x03390338 - .4byte 0x03390338 - .4byte 0x03430342 - .4byte 0x03430342 - .4byte 0x03430342 - .4byte 0x03430342 - .4byte 0x034d034c - .4byte 0x034d034c - .4byte 0x034d034c - .4byte 0x034d034c - .4byte 0x03570356 - .4byte 0x03570356 - .4byte 0x03570356 - .4byte 0x03570356 - .4byte 0x03610360 - .4byte 0x03610360 - .4byte 0x03610360 - .4byte 0x03610360 - .4byte 0x036b036a - .4byte 0x036b036a - .4byte 0x036b036a - .4byte 0x036b036a - .4byte 0x03750374 - .4byte 0x03750374 - .4byte 0x03750374 - .4byte 0x03750374 - - .global gBanimSongTable5 -gBanimSongTable5: @ 0x08758E00 -@ Replacing .incbin "baserom.gba", 0x758E00, 0x8C - .4byte gBanimSongTable4 + 0x1c - .4byte gBanimSongTable4 + 0x2c - .4byte gBanimSongTable4 + 0x3c - .4byte gBanimSongTable4 + 0x4c - .4byte gBanimSongTable4 + 0x5c - .4byte gBanimSongTable4 + 0x6c - .4byte gBanimSongTable4 + 0x7c - .4byte 0x033b033a - .4byte 0x033b033a - .4byte 0x033b033a - .4byte 0x033b033a - .4byte 0x03450344 - .4byte 0x03450344 - .4byte 0x03450344 - .4byte 0x03450344 - .4byte 0x034f034e - .4byte 0x034f034e - .4byte 0x034f034e - .4byte 0x034f034e - .4byte 0x03590358 - .4byte 0x03590358 - .4byte 0x03590358 - .4byte 0x03590358 - .4byte 0x03630362 - .4byte 0x03630362 - .4byte 0x03630362 - .4byte 0x03630362 - .4byte 0x036d036c - .4byte 0x036d036c - .4byte 0x036d036c - .4byte 0x036d036c - .4byte 0x03770376 - .4byte 0x03770376 - .4byte 0x03770376 - .4byte 0x03770376 - - .global gBanimSongTable6 -gBanimSongTable6: @ 0x08758E8C -@ Replacing .incbin "baserom.gba", 0x758E8C, 0x8C - .4byte gBanimSongTable5 + 0x1c - .4byte gBanimSongTable5 + 0x2c - .4byte gBanimSongTable5 + 0x3c - .4byte gBanimSongTable5 + 0x4c - .4byte gBanimSongTable5 + 0x5c - .4byte gBanimSongTable5 + 0x6c - .4byte gBanimSongTable5 + 0x7c - .4byte 0x03350334 - .4byte 0x03350334 - .4byte 0x03350334 - .4byte 0x03350334 - .4byte 0x033f033e - .4byte 0x033f033e - .4byte 0x033f033e - .4byte 0x033f033e - .4byte 0x03490348 - .4byte 0x03490348 - .4byte 0x03490348 - .4byte 0x03490348 - .4byte 0x03530352 - .4byte 0x03530352 - .4byte 0x03530352 - .4byte 0x03530352 - .4byte 0x035d035c - .4byte 0x035d035c - .4byte 0x035d035c - .4byte 0x035d035c - .4byte 0x03670366 - .4byte 0x03670366 - .4byte 0x03670366 - .4byte 0x03670366 - .4byte 0x03710370 - .4byte 0x03710370 - .4byte 0x03710370 - .4byte 0x03710370 - - .global gBanimSongTable7 -gBanimSongTable7: @ 0x08758F18 -@ Replacing .incbin "baserom.gba", 0x758F18, 0x8C - .4byte gBanimSongTable6 + 0x1c - .4byte gBanimSongTable6 + 0x2c - .4byte gBanimSongTable6 + 0x3c - .4byte gBanimSongTable6 + 0x4c - .4byte gBanimSongTable6 + 0x5c - .4byte gBanimSongTable6 + 0x6c - .4byte gBanimSongTable6 + 0x7c - .4byte 0x03370336 - .4byte 0x03370336 - .4byte 0x03370336 - .4byte 0x03370336 - .4byte 0x03410340 - .4byte 0x03410340 - .4byte 0x03410340 - .4byte 0x03410340 - .4byte 0x034b034a - .4byte 0x034b034a - .4byte 0x034b034a - .4byte 0x034b034a - .4byte 0x03550354 - .4byte 0x03550354 - .4byte 0x03550354 - .4byte 0x03550354 - .4byte 0x035f035e - .4byte 0x035f035e - .4byte 0x035f035e - .4byte 0x035f035e - .4byte 0x03690368 - .4byte 0x03690368 - .4byte 0x03690368 - .4byte 0x03690368 - .4byte 0x03730372 - .4byte 0x03730372 - .4byte 0x03730372 - .4byte 0x03730372 - - .global gBanimSongTable8 -gBanimSongTable8: @ 0x08758FA4 - .4byte gBanimSongTable7 + 0x1c - .4byte gBanimSongTable7 + 0x2c - .4byte gBanimSongTable7 + 0x3c - .4byte gBanimSongTable7 + 0x4c - .4byte gBanimSongTable7 + 0x5c - .4byte gBanimSongTable7 + 0x6c - .4byte gBanimSongTable7 + 0x7c diff --git a/include/efxbattle.h b/include/efxbattle.h index c9542a326..c168a7291 100644 --- a/include/efxbattle.h +++ b/include/efxbattle.h @@ -1240,7 +1240,6 @@ extern s16 gUnknown_0875879C[]; extern u16 gEfxTileRefPals_08758A1C[]; extern struct ProcCmd ProcScr_ekrsubAnimeEmulator[]; extern struct ProcCmd ProcScr_efxSoundSE[]; -// extern ??? gUnknown_08758A60 extern u16 * gBanimSongTable1[]; extern u16 * gBanimSongTable2[]; extern u16 * gBanimSongTable3[]; diff --git a/include/ekrbattle.h b/include/ekrbattle.h index 21f43c185..806550513 100644 --- a/include/ekrbattle.h +++ b/include/ekrbattle.h @@ -372,12 +372,19 @@ struct ProcEfxSoundSE { void EfxPlaySE(int songid, int volume); void Loop6C_efxSoundSE(struct ProcEfxSoundSE * proc); void DoM4aSongNumStop(int); -// ??? EfxOverrideBgm(???); -// ??? StopBGM1(???); +void EfxOverrideBgm(int songid, int volume); +void StopBGM1(void); void UnregisterEfxSoundSeExist(void); void RegisterEfxSoundSeExist(void); int CheckEfxSoundSeExist(void); +/** + * 00: PID + * 04: songid + * size = 08 + */ +extern int gBanimBossBGMs[]; + extern int gEkrDebugTimer, gEkrDebugUnk1; extern u16 gEkrPairBanimID[2]; @@ -466,7 +473,7 @@ extern u16 gUnknown_0201FDC4[]; extern u16 gUnknown_0201FF04[]; // extern ??? gUnknown_02020044 -extern int gUnknown_020200A8; +extern int gEkrMainBgmPlaying; extern int gEfxSoundSeExist; // extern ??? gpProcEkrClasschg @@ -825,8 +832,8 @@ s16 GetEfxHp(int index); // ??? GetEfxHpModMaybe(???); u16 IsItemDisplayedInBattle(u16 item); u16 IsWeaponLegency(u16 item); -// ??? sub_8058B08(???); -// ??? sub_8058B24(???); +s16 EkrCheckWeaponSieglindeSiegmund(u16 item); +bool EkrCheckAttackRound(u16 round); void sub_8058B64(void); void sub_8058B70(void); bool sub_8058B7C(void); @@ -928,15 +935,15 @@ enum efx_hp_change_type { s16 GetEfxHpChangeType(struct Anim * anim); void EfxPlayHittedSFX(struct Anim * anim); -void sub_8072504(struct Anim * anim); -// ??? sub_8072548(???); -// ??? sub_8072570(???); -void sub_80726AC(void); -void sub_807289C(void); -// ??? sub_80728D0(???); -int sub_807290C(struct Anim * anim); +void EfxPlayCriticalHittedSFX(struct Anim * anim); +int EfxCheckRetaliation(int is_retaliation); +int EfxCheckStaffType(int weapon); +void EkrPlayMainBGM(void); +void EkrTryRestoreBGM(void); +int GetBanimBossBGM(struct Unit * unit); +int GetProperAnimSoundLocation(struct Anim * anim); void PlaySFX(int, int, int, int); -// ??? sub_80729C0(???); +void PlaySfxAutomatically(int songid, int volume, struct Anim * anim); ProcPtr NewEfxPartsofScroll(void); void sub_8074598(void); diff --git a/include/ev_triggercheck.h b/include/ev_triggercheck.h index 0b8bb4c9e..b03f06bbc 100644 --- a/include/ev_triggercheck.h +++ b/include/ev_triggercheck.h @@ -194,8 +194,8 @@ void StartPlayerPhaseStartTutorialEvent(void); void ClearActiveEventRegistry(void); void RegisterEventActivation(u32, u16); u16 GetEventTriggerId(const void * script); -// ??? SetFlag82(???); -// ??? CheckFlag82(???); +void SetFlag82(void); +bool CheckFlag82(void); struct BattleTalkExtEnt* GetBattleQuoteEntry(u16, u16); struct DefeatTalkEnt* GetDefeatTalkEntry(u16); struct SupportTalkEnt* GetSupportTalkEntry(u16, u16); diff --git a/ldscript.txt b/ldscript.txt index 27398ece5..21a44d1ea 100644 --- a/ldscript.txt +++ b/ldscript.txt @@ -187,7 +187,6 @@ SECTIONS src/banim-ekrdragon-myrrh.o(.text); src/banim-efxutils.o(.text); src/banim-efxsound.o(.text); - asm/banim-efxsound.o(.text); src/banim-ekrclasschg.o(.text); src/banim-ekrlvup.o(.text); asm/banim-efxlvup.o(.text); @@ -632,7 +631,7 @@ SECTIONS . = ALIGN(4); src/banim-ekrdragon-myrrh.o(.data); . = ALIGN(4); src/banim-efxutils.o(.data); . = ALIGN(4); src/banim-efxsound.o(.data); - . = ALIGN(4); data/data-ekrclasschg.o(.data); + . = ALIGN(4); src/banim-efxsound-data.o(.data); . = ALIGN(4); src/banim-ekrclasschg.o(.data); . = ALIGN(4); src/banim-ekrlvup.o(.data); . = ALIGN(4); data/banim-efxlvup.o(.data); diff --git a/src/banim-efxsound-data.c b/src/banim-efxsound-data.c new file mode 100644 index 000000000..c8812b07c --- /dev/null +++ b/src/banim-efxsound-data.c @@ -0,0 +1,163 @@ +#include "global.h" +#include "ekrbattle.h" +#include "efxbattle.h" + +CONST_DATA u16 gBanimSongIDs1[] = { + 0x14A, 0x14B, 0x14C, 0x14D, 0x14E, 0x14F, 0x150, 0x151, + 0x154, 0x155, 0x156, 0x157, 0x158, 0x159, 0x15A, 0x15B, + 0x15E, 0x15F, 0x160, 0x161, 0x162, 0x163, 0x164, 0x165, + 0x168, 0x169, 0x16A, 0x16B, 0x16C, 0x16D, 0x16E, 0x16F, + 0x172, 0x173, 0x174, 0x175, 0x176, 0x177, 0x178, 0x179, + 0x17C, 0x17D, 0x17E, 0x17F, 0x180, 0x181, 0x182, 0x183, + 0x186, 0x187, 0x188, 0x189, 0x18A, 0x18B, 0x18C, 0x18D, +}; + +CONST_DATA u16 gBanimSongIDs2[] = { + 0x190, 0x191, 0x19A, 0x19B, 0x1A4, 0x1A5, 0x1A4, 0x1A5, + 0x1AE, 0x1AF, 0x1B8, 0x1B9, 0x1C2, 0x1C3, 0x1C2, 0x1C3, + 0x1CC, 0x1CD, 0x1D6, 0x1D7, 0x1E0, 0x1E1, 0x1E0, 0x1E1, + 0x1EA, 0x1EB, 0x1F4, 0x1F5, 0x1FE, 0x1FF, 0x1FE, 0x1FF, + 0x208, 0x209, 0x212, 0x213, 0x21C, 0x21D, 0x21C, 0x21D, + 0x226, 0x227, 0x230, 0x231, 0x23A, 0x23B, 0x23A, 0x23B, + 0x244, 0x245, 0x24E, 0x24F, 0x258, 0x259, 0x258, 0x259, +}; + +CONST_DATA u16 gBanimSongIDs3[] = { + 0x192, 0x193, 0x19C, 0x19D, 0x1A6, 0x1A7, 0x1A6, 0x1A7, + 0x1B1, 0x1B0, 0x1BA, 0x1BB, 0x1C4, 0x1C5, 0x1C4, 0x1C5, + 0x1CE, 0x1CF, 0x1D8, 0x1D9, 0x1E2, 0x1E3, 0x1E2, 0x1E3, + 0x1EC, 0x1ED, 0x1F6, 0x1F7, 0x200, 0x201, 0x200, 0x201, + 0x20A, 0x20B, 0x214, 0x215, 0x21E, 0x21F, 0x21E, 0x21F, + 0x228, 0x229, 0x232, 0x233, 0x23C, 0x23D, 0x23C, 0x23D, + 0x246, 0x247, 0x250, 0x251, 0x25A, 0x25B, 0x25A, 0x25B, +}; + +CONST_DATA u16 gBanimSongIDs4[] = { + 0x194, 0x195, 0x19E, 0x19F, 0x1A8, 0x1A9, 0x1A8, 0x1A9, + 0x1B2, 0x1B3, 0x1BC, 0x1BD, 0x1C6, 0x1C7, 0x1C6, 0x1C7, + 0x1D0, 0x1D1, 0x1DA, 0x1DB, 0x1E4, 0x1E5, 0x1E4, 0x1E5, + 0x1EE, 0x1EF, 0x1F8, 0x1F9, 0x202, 0x203, 0x202, 0x203, + 0x20C, 0x20D, 0x216, 0x217, 0x220, 0x221, 0x220, 0x221, + 0x22A, 0x22B, 0x234, 0x235, 0x23E, 0x23F, 0x23E, 0x23F, + 0x248, 0x249, 0x252, 0x253, 0x25C, 0x25D, 0x25C, 0x25D, +}; + +CONST_DATA u16 * gBanimSongTable1[] = { + &gBanimSongIDs1[0x00], + &gBanimSongIDs1[0x08], + &gBanimSongIDs1[0x10], + &gBanimSongIDs1[0x18], + &gBanimSongIDs1[0x20], + &gBanimSongIDs1[0x28], + &gBanimSongIDs1[0x30], +}; + +CONST_DATA u16 * gBanimSongTable2[] = { + &gBanimSongIDs2[0x00], + &gBanimSongIDs2[0x08], + &gBanimSongIDs2[0x10], + &gBanimSongIDs2[0x18], + &gBanimSongIDs2[0x20], + &gBanimSongIDs2[0x28], + &gBanimSongIDs2[0x30], +}; + +CONST_DATA u16 * gBanimSongTable3[] = { + &gBanimSongIDs3[0x00], + &gBanimSongIDs3[0x08], + &gBanimSongIDs3[0x10], + &gBanimSongIDs3[0x18], + &gBanimSongIDs3[0x20], + &gBanimSongIDs3[0x28], + &gBanimSongIDs3[0x30], +}; + +CONST_DATA u16 * gBanimSongTable4[] = { + &gBanimSongIDs4[0x00], + &gBanimSongIDs4[0x08], + &gBanimSongIDs4[0x10], + &gBanimSongIDs4[0x18], + &gBanimSongIDs4[0x20], + &gBanimSongIDs4[0x28], + &gBanimSongIDs4[0x30], +}; + +CONST_DATA u16 gBanimSongIDs5[] = { + 0x338, 0x339, 0x338, 0x339, 0x338, 0x339, 0x338, 0x339, + 0x342, 0x343, 0x342, 0x343, 0x342, 0x343, 0x342, 0x343, + 0x34c, 0x34d, 0x34c, 0x34d, 0x34c, 0x34d, 0x34c, 0x34d, + 0x356, 0x357, 0x356, 0x357, 0x356, 0x357, 0x356, 0x357, + 0x360, 0x361, 0x360, 0x361, 0x360, 0x361, 0x360, 0x361, + 0x36a, 0x36b, 0x36a, 0x36b, 0x36a, 0x36b, 0x36a, 0x36b, + 0x374, 0x375, 0x374, 0x375, 0x374, 0x375, 0x374, 0x375 +}; + +CONST_DATA u16 * gBanimSongTable5[] = { + &gBanimSongIDs5[0x00], + &gBanimSongIDs5[0x08], + &gBanimSongIDs5[0x10], + &gBanimSongIDs5[0x18], + &gBanimSongIDs5[0x20], + &gBanimSongIDs5[0x28], + &gBanimSongIDs5[0x30], +}; + +CONST_DATA u16 gBanimSongIDs6[] = { + 0x33a, 0x33b, 0x33a, 0x33b, 0x33a, 0x33b, 0x33a, 0x33b, + 0x344, 0x345, 0x344, 0x345, 0x344, 0x345, 0x344, 0x345, + 0x34e, 0x34f, 0x34e, 0x34f, 0x34e, 0x34f, 0x34e, 0x34f, + 0x358, 0x359, 0x358, 0x359, 0x358, 0x359, 0x358, 0x359, + 0x362, 0x363, 0x362, 0x363, 0x362, 0x363, 0x362, 0x363, + 0x36c, 0x36d, 0x36c, 0x36d, 0x36c, 0x36d, 0x36c, 0x36d, + 0x376, 0x377, 0x376, 0x377, 0x376, 0x377, 0x376, 0x377, +}; + +CONST_DATA u16 * gBanimSongTable6[] = { + &gBanimSongIDs6[0x00], + &gBanimSongIDs6[0x08], + &gBanimSongIDs6[0x10], + &gBanimSongIDs6[0x18], + &gBanimSongIDs6[0x20], + &gBanimSongIDs6[0x28], + &gBanimSongIDs6[0x30], +}; + +CONST_DATA u16 gBanimSongIDs7[] = { + 0x334, 0x335, 0x334, 0x335, 0x334, 0x335, 0x334, 0x335, + 0x33e, 0x33f, 0x33e, 0x33f, 0x33e, 0x33f, 0x33e, 0x33f, + 0x348, 0x349, 0x348, 0x349, 0x348, 0x349, 0x348, 0x349, + 0x352, 0x353, 0x352, 0x353, 0x352, 0x353, 0x352, 0x353, + 0x35c, 0x35d, 0x35c, 0x35d, 0x35c, 0x35d, 0x35c, 0x35d, + 0x366, 0x367, 0x366, 0x367, 0x366, 0x367, 0x366, 0x367, + 0x370, 0x371, 0x370, 0x371, 0x370, 0x371, 0x370, 0x371, +}; + +CONST_DATA u16 * gBanimSongTable7[] = { + &gBanimSongIDs7[0x00], + &gBanimSongIDs7[0x08], + &gBanimSongIDs7[0x10], + &gBanimSongIDs7[0x18], + &gBanimSongIDs7[0x20], + &gBanimSongIDs7[0x28], + &gBanimSongIDs7[0x30], +}; + +CONST_DATA u16 gBanimSongIDs8[] = { + 0x336, 0x337, 0x336, 0x337, 0x336, 0x337, 0x336, 0x337, + 0x340, 0x341, 0x340, 0x341, 0x340, 0x341, 0x340, 0x341, + 0x34a, 0x34b, 0x34a, 0x34b, 0x34a, 0x34b, 0x34a, 0x34b, + 0x354, 0x355, 0x354, 0x355, 0x354, 0x355, 0x354, 0x355, + 0x35e, 0x35f, 0x35e, 0x35f, 0x35e, 0x35f, 0x35e, 0x35f, + 0x368, 0x369, 0x368, 0x369, 0x368, 0x369, 0x368, 0x369, + 0x372, 0x373, 0x372, 0x373, 0x372, 0x373, 0x372, 0x373, +}; + +CONST_DATA u16 * gBanimSongTable8[] = { + &gBanimSongIDs8[0x00], + &gBanimSongIDs8[0x08], + &gBanimSongIDs8[0x10], + &gBanimSongIDs8[0x18], + &gBanimSongIDs8[0x20], + &gBanimSongIDs8[0x28], + &gBanimSongIDs8[0x30], +}; diff --git a/src/banim-efxsound.c b/src/banim-efxsound.c index 9e34eb67c..2b50a70ae 100644 --- a/src/banim-efxsound.c +++ b/src/banim-efxsound.c @@ -3,8 +3,13 @@ #include "anime.h" #include "ekrbattle.h" #include "efxbattle.h" +#include "bmbattle.h" +#include "ev_triggercheck.h" #include "m4a.h" #include "soundwrapper.h" +#include "constants/characters.h" +#include "constants/classes.h" +#include "constants/items.h" #include "constants/terrains.h" CONST_DATA struct ProcCmd ProcScr_efxSoundSE[] = { @@ -147,7 +152,7 @@ void EfxPlaySEwithCmdCtrl(struct Anim * anim, int cmd) val2 = GetEfxSoundType2FromBaseCon(basecon); songid = (u16)-1; - sound_pos = sub_807290C(anim) + anim->xPosition; + sound_pos = GetProperAnimSoundLocation(anim) + anim->xPosition; volume = 0x100; switch (cmd) { @@ -176,7 +181,7 @@ void EfxPlaySEwithCmdCtrl(struct Anim * anim, int cmd) break; case 31: - sub_8072504(anim2); + EfxPlayCriticalHittedSFX(anim2); if (GetEfxHpChangeType(anim2) != EFX_HPT_NOT_CHANGE) { @@ -204,11 +209,11 @@ void EfxPlaySEwithCmdCtrl(struct Anim * anim, int cmd) default: break; } - sound_pos = anim2->xPosition + sub_807290C(anim2); + sound_pos = anim2->xPosition + GetProperAnimSoundLocation(anim2); break; case 32: - sub_8072504(anim2); + EfxPlayCriticalHittedSFX(anim2); if (GetEfxHpChangeType(anim2) != EFX_HPT_NOT_CHANGE) { if (GetRoundFlagByAnim(anim) & ANIM_ROUND_PIERCE) @@ -235,11 +240,11 @@ void EfxPlaySEwithCmdCtrl(struct Anim * anim, int cmd) default: break; } - sound_pos = anim2->xPosition + sub_807290C(anim2); + sound_pos = anim2->xPosition + GetProperAnimSoundLocation(anim2); break; case 33: - sub_8072504(anim2); + EfxPlayCriticalHittedSFX(anim2); if (GetEfxHpChangeType(anim2) != EFX_HPT_NOT_CHANGE) { @@ -267,7 +272,7 @@ void EfxPlaySEwithCmdCtrl(struct Anim * anim, int cmd) default: break; } - sound_pos = anim2->xPosition + sub_807290C(anim2); + sound_pos = anim2->xPosition + GetProperAnimSoundLocation(anim2); break; case 34: @@ -712,7 +717,7 @@ u16 GetEfxSoundType1FromTerrain(u16 terrain) int IsAnimSoundInPositionMaybe(struct Anim * anim) { - int sound_pos = sub_807290C(anim) + anim->xPosition; + int sound_pos = GetProperAnimSoundLocation(anim) + anim->xPosition; if (GetAnimPosition(anim) == POS_L) { if (sound_pos > 0x58) @@ -772,7 +777,7 @@ void EfxPlayHittedSFX(struct Anim * anim) int songid = (u16)-1; s16 _songid; - sub_8072504(anim); + EfxPlayCriticalHittedSFX(anim); if (GetEfxHpChangeType(animr) != EFX_HPT_NOT_CHANGE && (GetRoundFlagByAnim(anim) & ANIM_ROUND_PIERCE)) { @@ -805,3 +810,306 @@ void EfxPlayHittedSFX(struct Anim * anim) M4aPlayWithPostionCtrl(_songid, anim->xPosition, 1); } } + +void EfxPlayCriticalHittedSFX(struct Anim * anim) +{ + struct Anim * animr = GetAnimAnotherSide(anim); + + switch (GetEfxHpChangeType(anim)) { + case EFX_HPT_CHANGED: + case EFX_HPT_DEFEATED: + if (CheckRoundCrit(animr) == true) + { + EfxPlaySE(0xD8, 0x100); + M4aPlayWithPostionCtrl(0xD8, anim->xPosition, 1); + } + break; + } +} + +int EfxCheckRetaliation(int is_retaliation) +{ + struct BattleHit * hit = gBattleHitArray; + u32 hit_info = hit->info; + u32 unk = (-(hit_info & BATTLE_HIT_INFO_RETALIATION)) >> 0x1F; + + if (is_retaliation == unk) + return true; + + return false; +} + +int EfxCheckStaffType(int weapon) +{ + int ret; + + if (!weapon) + return 0; + + switch (GetItemIndex(weapon)) { + case ITEM_STAFF_HEAL: + case ITEM_STAFF_MEND: + case ITEM_STAFF_RECOVER: + case ITEM_STAFF_PHYSIC: + case ITEM_STAFF_FORTIFY: + case ITEM_STAFF_RESTORE: + case ITEM_STAFF_REPAIR: + case ITEM_STAFF_BARRIER: + case ITEM_STAFF_LATONA: + return 2; + + case ITEM_STAFF_SILENCE: + case ITEM_STAFF_SLEEP: + case ITEM_STAFF_BERSERK: + return 1; + + default: + return 0; + } +} + + +void EkrPlayMainBGM(void) +{ + int ret, songid, songid2, pid, staff_type; + struct BattleUnit * bu, * bul, * bur, ** pbul, ** pbur; + + pbul = &gpEkrBattleUnitLeft; + pbur = &gpEkrBattleUnitRight; + + bul = *pbul; + bur = *pbur; + + if (gBmSt.gameStateBits & BM_FLAG_5) + { + gEkrMainBgmPlaying = 0; + return; + } + + gEkrMainBgmPlaying = 1; + + songid = gPalIndexEfxHpBarUnk[gEkrInitialHitSide] != 1 ? 0x19 : 0x1A; + + if (GetBattleAnimArenaFlag() == 1) + { + Sound_SetDefaultMaxNumChannels(); + EfxOverrideBgm(0x39, 0x100); + return; + } + + if (GetBanimLinkArenaFlag() == 1) + { + EfxOverrideBgm(0x39, 0x100); + return; + } + + if (gEkrDistanceType == EKR_DISTANCE_PROMOTION) + { + EfxOverrideBgm(0x23, 0x100); + return; + } + + ret = false; + if (EkrCheckWeaponSieglindeSiegmund(bur->weaponBefore) == true) + ret = true; + + if (!EkrCheckAttackRound(1)) + ret = false; + + if (gEkrPairSideVaild[POS_L] == false) + ret = false; + + pid = UNIT_CHAR_ID(&bul->unit); + if (pid == CHARACTER_LYON) + ret = false; + + if (pid == CHARACTER_LYON_FINAL) + ret = false; + + if (pid == CHARACTER_FOMORTIIS) + ret = false; + + if (ret == true) + { + EfxOverrideBgm(0x1F, 0x100); + return; + } + + if (pid == CHARACTER_FOMORTIIS) + { + if (CheckFlag82() == true) + { + EfxOverrideBgm(0x55, 0x100); + return; + } + SetFlag82(); + } + + songid2 = GetBanimBossBGM(&bul->unit); + + if (UNIT_FACTION(GetUnitFromCharId(UNIT_CHAR_ID(&bul->unit))) == FACTION_BLUE) + songid2 = -1; + + if (gEkrPairSideVaild[POS_L] == false) + songid2 = -1; + + if (songid2 != -1) + { + EfxOverrideBgm(songid2, 0x100); + return; + } + + ret = false; + if (UNIT_CLASS_ID(&bur->unit) == CLASS_DANCER) + { + u16 unk2 = gBattleStats.config & 0x40; + ret = (u32)(-unk2) >> 0x1F; + + if (gBattleStats.config & 0x200) + ret = true; + } + + if (ret == true) + { + EfxOverrideBgm(0x20, 0x100); + return; + } + + if (EfxCheckRetaliation(POS_L) == true) + staff_type = EfxCheckStaffType(gBattleActor.weaponBefore); + else if (EfxCheckRetaliation(POS_R) == true) + staff_type = EfxCheckStaffType(gBattleTarget.weaponBefore); + else + staff_type = 0; + + + switch (staff_type) { + case 2: + songid = 0x22; + break; + + case 1: + songid = 0x21; + break; + + default: + break; + } + + if (songid != -1) + { + EfxOverrideBgm(songid, 0x100); + return; + } + gEkrMainBgmPlaying = false; +} + +void EkrTryRestoreBGM(void) +{ + if (CheckBanimHensei() == true || gBmSt.gameStateBits & BM_FLAG_5 || gEkrMainBgmPlaying == false) + { + MakeBgmOverridePersist(); + return; + } + + RestoreBgm(); +} + +CONST_DATA int gBanimBossBGMs[32 * 2] = { + CHARACTER_ONEILL, 0x1B, + CHARACTER_BREGUET, 0x1B, + CHARACTER_BONE, 0x1B, + CHARACTER_BAZBA, 0x1B, + CHARACTER_ENTOUMBED_CH4, 0x1B, + CHARACTER_SAAR, 0x1B, + CHARACTER_NOVALA, 0x1B, + CHARACTER_MURRAY, 0x1B, + CHARACTER_TIRADO, 0x1C, + CHARACTER_BINKS, 0x1B, + CHARACTER_PABLO, 0x1B, + CHARACTER_WIGHT_CHUnk, 0x1B, + CHARACTER_DEATHGOYLE_CHUnk, 0x1B, + CHARACTER_MAELDUIN_CHUnk, 0x1B, + CHARACTER_AIAS, 0x1B, + CHARACTER_CARLYLE, 0x1C, + CHARACTER_ZONTA, 0x1B, + CHARACTER_GHEB, 0x1B, + CHARACTER_BERAN, 0x1B, + CHARACTER_CYCLOPS_CHUnk, 0x1B, + CHARACTER_SELENA, 0x1C, + CHARACTER_VIGARDE, 0x1C, + CHARACTER_CAELLACH, 0x1C, + CHARACTER_VALTER, 0x1C, + CHARACTER_ORSON, 0x1C, + CHARACTER_LYON, 0x1D, + CHARACTER_GORGON_CHUnk, 0x1C, + CHARACTER_RIEV, 0x1C, + CHARACTER_MORVA, 0x1C, + CHARACTER_LYON_FINAL, 0x1D, + CHARACTER_FOMORTIIS, 0x1E, + -1, -1 +}; + +int GetBanimBossBGM(struct Unit * unit) +{ + int i, pid = UNIT_CHAR_ID(unit); + for (i = 0; gBanimBossBGMs[i] != -1; i = i + 2) + { + if (pid == gBanimBossBGMs[i]) + break; + } + return gBanimBossBGMs[i + 1]; +} + +int GetProperAnimSoundLocation(struct Anim * anim) +{ + int i, header, val2, val1; + u32 ret; + const struct AnimSpriteData * anim_sprite, * it; + + anim_sprite = anim->pSpriteData; + header = anim_sprite->header; + + if ((header & 0xFFFF0000) == 0xFFFF0000) + for (val2 = (header & 0x0000FFFF); val2 != 0; val2--, anim_sprite++); + + it = anim_sprite; + val2 = 0; + val1 = 0; + + for (; it->header != 1; it++) + { + int a, b, c; + + a = it->as.object.x; + a += (GetAnimSpriteRotScaleX(it->header) << 0x10) >> 0x11; + b = GetAnimSpriteRotScaleX(it->header); + c = GetAnimSpriteRotScaleY(it->header); + + val1 += ((s16)b) * ((s16)c) * a; + val2 += ((s16)b) * ((s16)c); + } + + if (val2 == 0) + ret = 0x7FFFFFFF; + else + ret = Div(val1, val2); + + val1 = ret; + + asm("":::"memory"); + ret = val1; + return val1; +} + +void PlaySFX(int songid, int volume, int locate, int type) +{ + EfxPlaySE(songid, volume); + M4aPlayWithPostionCtrl(songid, locate, type); +} + +void PlaySfxAutomatically(int songid, int volume, struct Anim * anim) +{ + EfxPlaySE(songid, volume); + M4aPlayWithPostionCtrl(songid, GetProperAnimSoundLocation(anim), 1); +} diff --git a/src/banim-ekrbattle.c b/src/banim-ekrbattle.c index 5c54c17ea..01d1cf75b 100644 --- a/src/banim-ekrbattle.c +++ b/src/banim-ekrbattle.c @@ -80,7 +80,7 @@ void NewEkrBattle(void) gEkrDebugUnk3 = 0; if (0 == gEkrDebugModeMaybe) - sub_80726AC(); + EkrPlayMainBGM(); } void InBattleMainRoutine(void) @@ -882,7 +882,7 @@ void ekrBattle_PostDragonStatusEffect(struct ProcEkrBattle *proc) if (gEkrDebugModeMaybe == 0) { NewEkrNamewinAppear(2, 7, 0); - sub_807289C(); + EkrTryRestoreBGM(); } proc->proc_idleCb = (ProcFunc)nullsub_69; diff --git a/src/banim-ekrcmd.c b/src/banim-ekrcmd.c index b4a88ed3a..2e9f94584 100644 --- a/src/banim-ekrcmd.c +++ b/src/banim-ekrcmd.c @@ -203,7 +203,7 @@ u16 IsWeaponLegency(u16 item) } } -bool sub_8058B08(u16 item) +s16 EkrCheckWeaponSieglindeSiegmund(u16 item) { switch (GetItemIndex(item)) { case ITEM_SWORD_SIEGLINDE: @@ -215,7 +215,7 @@ bool sub_8058B08(u16 item) } } -bool sub_8058B24(u16 round) +bool EkrCheckAttackRound(u16 round) { int i; s16 cur; @@ -223,19 +223,19 @@ bool sub_8058B24(u16 round) for (i = round; i < 0x14; i = i + 2) { cur = gAnimRoundData[i]; - if (cur == 0) + if (cur == ANIM_ROUND_HIT_CLOSE) return true; - if (cur == 1) + if (cur == ANIM_ROUND_CRIT_CLOSE) return true; - if (cur == 2) + if (cur == ANIM_ROUND_NONCRIT_FAR) return true; - if (cur == 3) + if (cur == ANIM_ROUND_CRIT_FAR) return true; - if (cur == 9) + if (cur == ANIM_ROUND_MISS_CLOSE) return true; } diff --git a/src/ev_triggercheck.c b/src/ev_triggercheck.c index d0eba1157..bcd9d7059 100644 --- a/src/ev_triggercheck.c +++ b/src/ev_triggercheck.c @@ -1827,18 +1827,18 @@ u16 GetEventTriggerId(const void * script) { } //! FE8U = 0x08084628 -void SetFlag82(void) { +void SetFlag82(void) +{ SetFlag(0x82); - return; } //! FE8U = 0x08084634 -s8 CheckFlag82(void) { - if (CheckFlag(0x82)) { - return 1; - } +bool CheckFlag82(void) +{ + if (CheckFlag(0x82)) + return true; - return 0; + return false; } //! FE8U = 0x0808464C diff --git a/sym_ewram.txt b/sym_ewram.txt index 3b2d7fec6..c331dbf57 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -259,7 +259,7 @@ . = 0x020044; gUnknown_02020044 = .; . = 0x020048; . = ALIGN(4); src/banim-ekrdragonstatus.o(ewram_data); -. = 0x0200A8; gUnknown_020200A8 = .; +. = 0x0200A8; gEkrMainBgmPlaying = .; . = 0x0200AC; gEfxSoundSeExist = .; . = 0x0200B0; gpProcEkrClasschg = .; . = 0x0200B4; gpProcEkrLevelup = .; From 8f2021f4913290c1d5f2d678af28dc3b435ea439 Mon Sep 17 00:00:00 2001 From: MokhaLeee Date: Fri, 20 Oct 2023 09:39:46 +0000 Subject: [PATCH 3/3] update thanks to jiang --- src/banim-efxsound.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/banim-efxsound.c b/src/banim-efxsound.c index 2b50a70ae..76e6986b1 100644 --- a/src/banim-efxsound.c +++ b/src/banim-efxsound.c @@ -829,11 +829,15 @@ void EfxPlayCriticalHittedSFX(struct Anim * anim) int EfxCheckRetaliation(int is_retaliation) { + int ret; struct BattleHit * hit = gBattleHitArray; - u32 hit_info = hit->info; - u32 unk = (-(hit_info & BATTLE_HIT_INFO_RETALIATION)) >> 0x1F; - if (is_retaliation == unk) + if (hit->info & BATTLE_HIT_INFO_RETALIATION) + ret = true; + else + ret = false; + + if (is_retaliation == ret) return true; return false; @@ -962,8 +966,8 @@ void EkrPlayMainBGM(void) ret = false; if (UNIT_CLASS_ID(&bur->unit) == CLASS_DANCER) { - u16 unk2 = gBattleStats.config & 0x40; - ret = (u32)(-unk2) >> 0x1F; + if (gBattleStats.config & 0x40) + ret = true; if (gBattleStats.config & 0x200) ret = true;