• Welcome to Smashboards, the world's largest Super Smash Brothers community! Over 250,000 Smash Bros. fans from around the world have come to discuss these great games in over 19 million posts!

    You are currently viewing our boards as a visitor. Click here to sign up right now and start on your path in the Smash community!

Completed Damage HUD Overhaul

Punkline

Dr. Frankenstack
Joined
May 15, 2015
Messages
423
Over a year ago, Itaru Itaru made a request for a code that allows the 999% damage limit to be broken.

This code completely replaces ~4.5 kb of the game responsible for updating and animating the damage HUD. The overhaul enables users to customize the damage limit, the displayed colors, a few animation variables, and a handful of other things concerning the display of player damage values.

The default parameters cause the code to behave like the vanilla damage HUD, with a modified color scheme and a damage limit raised to 9999%. See the spoilers at the end of this post for more information about how to customize.

The replacement code is much smaller than the original code, so it fits into a set of overwrites; allowing it to be installed in-place without requiring any extra space for code injections. Some example color schemes have been included in the blank padding leftover from the replaced functions, and can be enabled by modifying the parameters explained in the spoilers at the end of this post. The remaining blank space can also be used to design new color schemes and include them with the code.

Because the code does not require any additional space, it should be compatible with 20XX if installed with a bit of finesse. A 20XX 4.07++ DOL has been included below with the code pre-installed. I’ve also included a short guide explaining how to install to an existing 20XX DOL using special settings in MCM.

MCM version 4.1+ is required to install/uninstall this code.


Get the code here:

Damage HUD Overhaul 1.10
Code:
    -==-


Damage HUD Overhaul 1.10
Replaces the Damage HUD update function to provide new features.
[Punkline]
Revision ---- DOL Offset ---- Hex to Replace ---------- ASM Code -
NTSC 1.02 --- 0x802F5F4C ---- 3C60802F38834EDC -> 3C60802F 60644c04
------------- 0x802F491C ----

7C0802A6 90010004 9421FF90 DBE10068 DBC10060 DBA10058 DB810050 BF61003C 7C7B1B78 88030010 5400D7FF 41820084 C382E094 7F7DDB78 C3E2E098 3B800000 C3C2E0A0 C3A2E09C 3BE00001 3BC00000 4808BBBD 880DB6C1 EC1C0072 7C000775 41820014 FC000050 9BCDB6C1 EC00F828 4800000C EC00F82A 9BEDB6C1 D01D0034 4808BB8D EC1EE87A 3B9C0001 2C1C0004 D01D0044 3BBD0004 4180FFB8 881B0010 38600000 50603672 981B0010 48000198 C3A2E08C 7F7DDB78 C3C2E0AC 3BE00000 C3E2E0B0 83DD0054 281E0000 40820014 386DA110 388003E1 38ADA118 48093829 C01E0038 D001002C 8001002C 5400007E 9001002C C001002C FC00E840 40800084 83DD0054 C39D0034 281E0000 40820014 386DA110 3880044E 38ADA118 480937E9 C01E0038 EC00E02A D01E0038 801E0014 5400018D 4082004C 281E0000 41820044 40820014 386DA110 38800234 38ADA118 480937B5 809E0014 38600000 54800211 40820010 54800673 41820008 38600001 2C030000 4082000C 7FC3F378 4807E851 83DD0054 281E0000 40820014 386DA110 388003EE 38ADA118 4809376D C01E003C FC00F040 40810090 83DD0054 C39D0044 281E0000 40820014 386DA110 3880045A 38ADA118 48093741 C01E003C EC00E02A D01E003C 801E0014 5400018D 4082004C 281E0000 41820044 40820014 386DA110 38800234 38ADA118 4809370D 809E0014 38600000 54800211 40820010 54800673 41820008 38600001 2C030000 4082000C 7FC3F378 4807E7A9 C01D0044 EC00F828 D01D0044 3BFF0001 2C1F0004 3BBD0004 4180FE84 BB61003C 80010074 CBE10068 CBC10060 CBA10058 CB810050 38210070 7C0803A6 4E800020 7C0802A6 90010004 9421FF98 DBE10060 DBC10058 DBA10050 DB810048 DB610040 DB410038 DB210030 93E1002C 93C10028 7C7E1B78 93A10024 93810020 8803000F 28000000 418202D8 28000001 40820118 3BE00000 3BBE0000 839D0054 C39D0014 281C0000 40820014 386DA110 388003A4 38ADA118 48093629 D39C0038 801C0014 5400018D 4082004C 281C0000 41820044 40820014 386DA110 38800234 38ADA118 480935FD 809C0014 38600000 54800211 40820010 54800673 41820008 38600001 2C030000 4082000C 7F83E378 4807E699 839D0054 C39D0024 281C0000 40820014 386DA110 388003B3 38ADA118 480935B1 D39C003C 801C0014 5400018D 4082004C 281C0000 41820044 40820014 386DA110 38800234 38ADA118 48093585 809C0014 38600000 54800211 40820010 54800673 41820008 38600001 2C030000 4082000C 7F83E378 4807E621 3BFF0001 2C1F0004 3BBD0004 4180FF04 38000000 981E000F 480001BC 887E000E 3C004330 C822E078 9061001C C042E0A4 90010018 C8010018 EC000828 EF420032 FC1A1040 4080000C FF401090 48000014 C002E0A8 FC1A0040 40810008 FF400090 C382E0B4 7FDDF378 C3A2E070 3BE00000 C3C2E06C C3E2E0B0 4808B7E5 EC01E028 EC1D0032 EF7A0032 4808B7D5 EC01E028 FC1BF040 EC1D0032 EF3A0032 4080000C EC3BF828 48000008 EC3BF82A FC19F040 4080000C EF39F828 48000008 EF39F82A 839D0054 C01D0014 281C0000 EF60082A 40820014 386DA110 388003A4 38ADA118 48093475 D37C0038 801C0014 5400018D 4082004C 281C0000 41820044 40820014 386DA110 38800234 38ADA118 48093449 809C0014 38600000 54800211 40820010 54800673 41820008 38600001 2C030000 4082000C 7F83E378 4807E4E5 839D0054 C01D0024 281C0000 EF60C82A 40820014 386DA110 388003B3 38ADA118 480933F9 D37C003C 801C0014 5400018D 4082004C 281C0000 41820044 40820014 386DA110 38800234 38ADA118 480933CD 809C0014 38600000 54800211 40820010 54800673 41820008 38600001 2C030000 4082000C 7F83E378 4807E469 3BFF0001 2C1F0004 3BBD0004 4180FEB4 887E000F 3803FFFF 981E000F 8001006C CBE10060 CBC10058 CBA10050 CB810048 CB610040 CB410038 CB210030 83E1002C 83C10028 83A10024 83810020 38210068 7C0803A6 4E800020 7C0802A6 3C80804A 90010004 38000006 7C0903A6 9421FF08 DBE100F0 DBC100E8 DBA100E0 BEE100BC 3B2410C8 38B90000 38800000 83C30028 80050000 7C001840 40820010 1C040064 7FF90214 48000014 38A50064 38840001 4200FFE0 3BE00000 881F0010 5400CFFF 41820010 7FE3FB78 4BFFF9D1 48000BD8 7FC3F378 4BD16145 889F0010 3BA30000 5480E7FF 418202CC 5480FFBE 28000001 4082000C 2C1D0000 408202B8 881F0010 38600001 50600F7C 981F0010 7FC3F378 4807A6B1 3AF90260 80B9025C 80D90260 7FC3F378 80F90264 38800001 4BD170CD 7FC3F378 C022E06C 4807A901 809F0060 28040000 4182007C 80770000 80840018 80630000 80840008 80630000 83040008 80830004 7F03C378 80840004 80840004 80840008 80840008 4806970D 887F0008 7C630774 4BD3F62D 2C030000 41820014 7F03C378 C022E068 480697E5 48000010 7F03C378 C022E06C 480697D5 80780064 C022E06C 480702D5 7F03C378 48069B2D 387E0000 38800001 38A00400 4BF3A389 3C606666 A8FF000A 3B836667 80770000 7C1C3896 835F005C 80630000 809A0018 80630000 7C001670 80A40008 54060FFE 80830008 7C003214 80650008 1C00000A 80840008 7C003850 5418063E 48069669 930100B4 3F604330 807A0018 936100B0 80630008 C822E078 C80100B0 C042E070 EC000828 80630008 EC220032 48069731 807A0018 C022E06C 80630008 80630008 80630064 48070225 3C6051EC A8FF000A 3B43851F 80770000 7C1A3896 831F0058 80630000 80980018 80630000 7C002E70 80A40008 54060FFE 80830008 7C003214 80650008 1C000064 80840008 7C003850 7C1C0096 7C001670 54050FFE 7C002A14 541C063E 480695C1 938100AC 80780018 936100A8 80630008 C822E078 C80100A8 C042E070 EC000828 80630008 EC220032 4806968D 80780018 C022E06C 80630008 80630008 80630064 48070181 3C601062 A8FF000A 38034DD3 80770000 7C003896 831F0054 80630000 80980018 80630000 7C003670 80A40008 54060FFE 80830008 7C003214 80650008 1C0003E8 80840008 7C003850 7C1A0096 7C002E70 54050FFE 7C002A14 5417063E 4806951D 92E100A4 80780018 936100A0 80630008 C822E078 C80100A0 C042E070 EC000828 80630008 EC220032 480695E9 80780018 C022E06C 80630008 80630008 80630064 480700DD 7FC3F378 4807B6F1 3C606666 A8DF000A 3B436667 831F005C 7C1A3096 80780018 80630008 3AF90260 80630008 80990260 7C001670 54050FFE 80840000 7C002A14 1C00000A 80840000 80840008 7C003050 5419063E 80840008 4806947D 932100A4 3F804330 80780018 938100A0 80630008 C822E078 C80100A0 C042E070 EC000828 80630008 EC220032 48069545 80780018 C022E06C 80630008 80630008 80630064 48070039 3C6051EC A8FF000A 3B63851F 80770000 7C1B3896 831F0058 80630000 80980018 80630000 7C002E70 80A40008 54060FFE 80830008 7C003214 80650008 1C000064 80840008 7C003850 7C1A0096 7C001670 54050FFE 7C002A14 5419063E 480693D5 932100AC 80780018 938100A8 80630008 C822E078 C80100A8 C042E070 EC000828 80630008 EC220032 480694A1 80780018 C022E06C 80630008 80630008 80630064 4806FF95 3C601062 A89F000A 38034DD3 7C002096 7C003670 54030FFE 7C001A14 1C0003E8 7C002050 7C1B0096 7C002E70 54030FFE 7C001A15 40820040 7C1B2096 7C002E70 54030FFE 7C001A14 1C000064 7C002050 7C1A0096 7C001670 54030FFE 7C001A15 40820014 807F0058 38800010 4807C9B5 48000010 807F0058 38800010 4807CBA5 3C601062 A8FF000A 3B834DD3 80770000 7C1C3896 831F0054 80630000 80980018 80630000 7C003670 80A40008 54060FFE 80830008 7C003214 80650008 1C0003E8 80840008 3CA051EC 7C003850 3B65851F 7C1B0096 7C002E70 54050FFE 7C002A14 5417063E 480692A9 92E100A4 3C004330 80780018 900100A0 80630008 C822E078 C80100A0 C042E070 EC000828 80630008 EC220032 48069371 80780018 C022E06C 80630008 80630008 80630064 4806FE65 A89F000A 7C1C2096 7C003670 54030FFE 7C001A14 1C0003E8 7C002050 7C1B0096 7C002E70 54030FFE 7C001A15 40820014 807F0054 38800010 4807C8B9 48000010 807F0054 38800010 4807CAA9 A87F000C A81F000A 7C030000 4182032C 887F0008 7C630774 4BD3F125 2C030000 41820140 A87F000A 2C030064 4081000C 38600064 48000010 7C600735 40800008 38600000 7C600734 88EDA108 6C038000 880DA10C 906100A4 3CC04330 7C070050 C882E080 90C100A0 6C008000 C002E08C C82100A0 38ADA108 900100AC 388DA10C EC212028 90E100B4 380000FF C0A2E068 EC610024 90C100A8 C842E078 90C100B0 C82100A8 C80100B0 EC651828 EC212028 EC001028 EC03007A FC00001E D8010098 8061009C 98610040 88E50001 88640001 90E1008C 7C671850 6C638000 90C10088 90610094 C8010088 90C10090 EC001028 C8210090 EC212028 EC03007A FC00001E D8010080 80610084 98610041 88A50002 88640002 90A10074 7C651850 6C638000 90C10070 9061007C C8010070 90C10078 EC001028 C8210078 EC212028 EC03007A FC00001E D8010068 8061006C 98610042 98010043 80010040 90010060 48000134 A87F000A 2C03012C 4081000C 3860012C 48000010 7C600735 40800008 38600000 7C600734 88EDA108 6C038000 880DA10C 9061006C 3CC04330 7C070050 C862E080 90C10068 6C008000 C002E088 C8210068 38ADA108 90010074 388DA10C EC211828 90E1007C 380000FF C842E078 EC810024 90C10070 90C10078 C8210070 C8010078 EC211828 EC001028 EC04007A FC00001E D8010080 80610084 98610038 88E50001 88640001 90E10094 7C671850 6C638000 90C10090 9061008C C8010090 90C10088 EC001028 C8210088 EC211828 EC04007A FC00001E D8010098 8061009C 98610039 88A50002 88640002 90A100AC 7C651850 6C638000 90C100A8 906100A4 C80100A8 90C100A0 EC001028 C82100A0 EC211828 EC04007A FC00001E D80100B0 806100B4 9861003A 9801003B 80010038 90010060 807F0054 88010060 80630018 80830008 8064000C 98030004 88A10061 8064000C 98A30005 88C10062 8064000C 98C30006 807F0058 88010060 80630018 80830008 8064000C 98030004 8064000C 98A30005 8064000C 98C30006 807F005C 88010060 80630018 80830008 8064000C 98030004 8064000C 98A30005 8064000C 98C30006 807F0060 88010060 80630018 80830008 8064000C 98030004 8064000C 98A30005 8064000C 98C30006 7FC3F378 4BD15869 2C030000 41820064 3AE00000 3B1F0000 83380054 28190000 40820014 386DA110 388003E1 38ADA118 480929C1 C0190038 D0180014 83380054 28190000 40820014 386DA110 388003EE 38ADA118 4809299D C019003C 3AF70001 2C170004 D0180024 3B180004 4180FFAC 3C606666 A89F000A 38036667 7C002096 7C001670 54030FFE 7C001A14 1C00000A 7C002050 2C000001 4082000C C3E2E090 48000008 C3E2E06C 3C6051EC 3803851F 7C002096 7C002E70 54030FFE 7C001A14 1C000064 3C606666 7C002050 38636667 7C030096 7C001670 54030FFE 7C001A14 2C000001 4082000C C3C2E090 48000008 C3C2E06C 82FF0060 C01F0020 28170000 EFA0F828 40820014 386DA110 388003A4 38ADA118 480928DD D3B70038 80170014 5400018D 4082004C 28170000 41820044 40820014 386DA110 38800234 38ADA118 480928B1 80970014 38600000 54800211 40820010 54800673 41820008 38600001 2C030000 4082000C 7EE3BB78 4807D94D EFFFF02A 82FF0058 C01F0018 28170000 EFA0F82A 40820014 386DA110 388003A4 38ADA118 4809285D D3B70038 80170014 5400018D 4082004C 28170000 41820044 40820014 386DA110 38800234 38ADA118 48092831 80970014 38600000 54800211 40820010 54800673 41820008 38600001 2C030000 4082000C 7EE3BB78 4807D8CD 3C601062 A89F000A 38034DD3 7C002096 7C003670 54030FFE 7C001A14 1C0003E8 3C6051EC 7C002050 3863851F 7C030096 7C002E70 54030FFE 7C001A14 2C000001 4082000C C002E090 48000008 C002E06C EC3E002A 82FF0054 C01F0014 28170000 EFFF082A EFA0F82A 40820014 386DA110 388003A4 38ADA118 48092789 D3B70038 80170014 5400018D 4082004C 28170000 41820044 40820014 386DA110 38800234 38ADA118 4809275D 80970014 38600000 54800211 40820010 54800673 41820008 38600001 2C030000 4082000C 7EE3BB78 4807D7F9 881F0010 5400DFFF 4182000C 3800000A 981F000F 387F0000 389D0000 4BFFF075 880DB6C0 28000005 4180000C C002E0B8 D01E002C BAE100BC 800100FC CBE100F0 CBC100E8 CBA100E0
->

3D80802F 618C5950 A18C0000 7C006000
b 0x802f5c14
3D80802F 618C5950 A18C0000 7C006000
b 0x802F5D1C
3D80802F 618C5950 A18C0000 B181FFF0 7D97E2A6 3D600005 7D77E3A6 E001FFF0 7D97E3A6
b 0x8006cd40
3D80804C 618C1FB0 816C0000 716B0060 41A2000C 38000000 48000010 3D80802F 618C5950 A00C0000
b 0x80189700
3D80802F 618C5950 A18C0000 7C036040
b 0x80189738
3D80802F 618C5950 A18C0000 7C006040
b 0x80189758
28830000 3D80804C 618C1FB8 816C0000 716B0060 4182000C 38000000 48000010 3803FFFF 40860008
b 0x801896fc
b 0x801896d0
3D80802F 618C5950 A00C0002
b 0x801B93C4
3C60802F 60635A28 808DB6BC 80840020 38A30000 38C40568 80060010 90050010 90A40634 38A30040 80C41180 90A411B8 90C50008 38A3004C 80C446BC 90A446F4 90C50008 80010024
b 0x802F6774
7C0802A6 90010004 9421FFE0 93E1000C 7C7F1B78 D0210010 D0410014
bl 0x8035e708
7FE3FB78 C0210010
bl 0x8035e800
807F0064 C0210014
bl 0x8036530c
83E1000C 38210020 80010004 7C0803A6 4E800020 7C0802A6 90010004 9421FFE0 90610010 D0210014
bl 0x8000C07C
80610010 C0210014
bl 0x8036F8BC
38210020 80010004 7C0803A6 4E800020 80030014 5400018D 4C820020 54000211 4082000C 54000673 4C820020
b 0x803732E8
7C042800 7C843000 4C802B82 54631839 4C422382 41820048 7D0784AA 7C044000 40810044 7C633A14 7C071800 7D0784AA 38E70008 7C8A4000 4C0029C2 41800028 7C045000 4181FFE4 7C832378 3881FFF0 7D0485AA 7C8484AA 48000028 39200000 39600000 38000000 9001FFF0 C021FFF0 7D234B78 7D645B78 7D254B78 4E800020 7D57E2A6 3D003005 7D17E3A6 7C641850 7D243050 9061FFE0 9121FFE2 B061FFE6 E0217FE0 E0413FE4 7D57E3A6 10811114 106208D4 7CA32B78 7CE43B78 EC241824 10210C20 7C17E2A6 3CA00804 60A50804 7CB7E3A6 C0C28028 ECC60828 9061FFF0 9081FFF4 E0417FF0 E0617FF2 E0817FF4 E0A17FF6 10040072 100201BA F0017FF8 10050072 100301BA F0017FFA 80A1FFF8 7C17E3A6 4E800020 7C0802A6 7C800026 90010004 9421FF20 90810014 BE010018 3E00802F 62105950 3E20804A 623110C8 3E40804A 62521064 38B20258 84920064 7C032000 7C922800 4182000C 4184FFF0 480005B0 3E60802F 627359C8 88D20008 54C62036 3A730006 82830028 82B20060 82B50008 8372000F 577C877C 88720008
bl 0x80034634
507B8B9C 577B021E 7F638120 7E83A378
bl 0x8000B09C
7C601120 4FEBF902 2C1C0002 4D6B1102 4D6BFB82 4D284A02 3B000004 418900AC 418800A8 83510260 835A0000 835A0000 837A0004 837B0004 837B0004 835A0008 837B0008 835A0008 837B0008 40AB0034 3911025C 38000000 7E83A378 900100A0 38800001 C02100A0 7CA864AA 4BFFFD99 38600002 88920010 5064077C 98920010 80F0001C 40AE0008 80F00020 2C070000 41A0001C 40AE0010 80F00028 90F00020 4800000C 80F00024 90F0001C 38600FFF A092000A 38A00000 A0D00000 4BFFFD9D 90A10094 A3B2000A 2C180004 4E021382 2C180003 4E221382 5717103B 4E421382 3AD20050 7C76B82E 40B20008 7EA3AB78 40A800EC 40A90064 8B8DB6C1 3BA00001
bl 0x80380528
D02100A0
bl 0x80380528
C04100A0 102114E0 E0500034 7F9CEA79 9B8DB6C1 E070002C 100110FA 4182000C 10200050 10010460 40B2000C F0130008 48000150 102004E0 3AD20030 7C16BD2E 3AD20040 7C36BD2E 48000138 3AD20030 7C76BC2E 3AD20040 7C96BC2E 40B2000C C0730008 C093000C C0230038 C043003C C0B00040 C0D0003C FCE03050 EC21182A EC42202A EC842828 FC023040 FC823840 40A10010 FC403090 40A40008 FC403890 D0230038 D043003C 40B20010 D0730008 D093000C 48000014 3AD20030 7C76BD2E 3AD20040 7C96BD2E 4BFFFC65 480000B4 3B80000A 80630018 80630008 8083000C 80630008 80010094 90040004 40B00028 7F64DB78 3BC00000 3FE03F80 BFC100A0 C02100A0 40AE0048 3BC00001 C02100A4 4800003C 7F44D378 3BC00000 2C1D0000 41A20014 7FFDE3D6 7FDFE1D6 7FDEE850 7FFDFB78 3CA03F04 7CD7E2A6 7CB7E3A6 9BC100A0 E021F0A0 7CD7E3A6 3BE10058 7FDFC1AE 3BE10060 7C3FBD2E 38000000 900100A0 C04100A0 4BFFFB45 57C0103A 3BF00050 7C3F042E 3BE10074 7C3FBD2E 3718FFFF 38000000 7C008120 41800008 4BFFFE2C 40A80014 88120010 540006B0 98120010 480002B8 418802B4 7E83A378
bl 0x80370928
E0210074 C0A28044 E041007C 10A21154 10C214E0 10820956 FCC03050 10852116 D0C10084 10810914 A072000A 10842114 F0A1007C F0810074 A092000C 7C032000 40AE0008 7C041800 7C77E2A6 3C800704 3CA00004 60A50004 7CB7E3A6 E032F00E D0210098 40A10048 7C97E3A6 E0307004 7CB7E3A6 E052F00E C0700008 10030098 1060005A E0907006 10032040 108320C0 40A00008 10642420 40A50008 106424E0 EC420072 10421C60 F052700E 7C77E3A6 80120024 90130004 8812000F 2C000001 4D810B82 4DA21382 7E83A378
bl 0x8000B09C
9061009C 3B000004 3B40000A 5717103B 4E421382 2C180003 4E600382 3AD20050 7C76B82E 40B20008 7EA3AB78 7C7B1B78 8001009C 2C000000 41A2003C BBC30038 40B20024 BFD30000 C0520018 C0320014 FC411028 EC21102A D0230038 D0330000 48000014 3AD20010 7FD6B92E 3AD20020 7FF6B92E 8012000A 3AC10074 2C0003E8 7C56BC2E 4180000C C0100018 EC42002A 3AD20010 7C36BC2E 40B20008 C0330000 EC21102A D0230038 38800010 4093001C A0B2000A 7C1A2800 1F5A000A 4081000C
bl 0x80371D9C
48000024
bl 0x80371F9C
3AD20010 7D76BC2E 3AD20020 7D96BC2E 118B6460 40B20008 E1930000 40AC0088
bl 0x80380528
D02100A0
bl 0x80380528
C10100A0 110144E0 C122805C C1428048 11084828 110802B2 C070004C FC801850 106820EE 7C17E2A6 3C600004 7C77E3A6 E0B2F00E 7C17E3A6 C0500044 C0F00048 ECC500B2 FC061040 40A00008 FCC01090 FC063840 40A10008 FCC03890 110819BA 1188602A 40B20024 8872000F 3863FFFF 9872000F 48000014 40AD0014 40B2000C 38000000 9812000F F19B0038 7F63DB78 4BFFF921 3718FFFF 38000000 7C008120 4080FE74 C030000C E0500010 FC600890 A012000A 2C0003E8 41A00008 10630098 880DB6C0 2C000004 40A10008 1063009A D074002C D0340030 7E83A378 4BFFF8D5 80810014 BA010018 382100E0 80010004 7C8FF120 7C0803A6 4E800020

# default color data: damage
# 802F5218
00000000 FFFFFFFF
0000012C 500000FF
00000000

# default color data: stamina
# 802F522C
00000000 500000FF
00000064 FFFFFFFF
00000000


# default custom gradient allocation:
# 802F5240
00000000 FFFFFFFF
00000028 FFFFE0FF
00000050 FFCC91FF
00000078 FA926CFF
000000A0 DE5F5CFF
000000C8 B63249FF
000000F0 850F2CFF
00000118 500000FF
00000000 00000000
00000000 00000000
00000000 00000000
00000000 00000000
00000000 00000000
00000000 00000000
00000000 00000000
00000000 00000000
00000000

# additional space
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

# additional example gradients:

# 802F569C
# white->red monochrome, with tint->tone->shade
# classic colors, but with a bit more emphasis on the red
00000000 FFFFFFFF
00000064 FF9078FF
000000C8 CB0518FF
0000012C 500000FF
00000000

# 802F56C0
# lightyellow->red analogous,  tint->tone
00000000 FFFFFFFF
0000001E FFFFE0FF
0000005A FFC94EFF
00000096 FF8808FF
000000D2 FF0000FF
00000000


# 802F56EC
# lightcyan->orange complementary,  tint->tone
0000001E E8FFFFFF
0000005A F8B685FF
00000096 E36D28FF
000000D2 C00000FF
00000000

# 802F5710
# lightyellow->dark burgundy analogous, tint->tone->shade
00000000 FFFFFFFF
00000028 FFFFE0FF
00000050 FFCC91FF
00000078 FA926CFF
000000A0 DE5F5CFF
000000C8 B63249FF
000000F0 850F2CFF
00000118 500000FF
00000000


# 802F5754
# pink->salmon->indigo analogous, tint->tone->shade
0000001E FDE0DDFF
00000046 FFAB9CFF
0000006E FA726FFF
00000096 DA3F61FF
000000BE A91762FF
000000E6 6D0260FF
0000010E 300050FF
00000000

# 802F5790
# yellowgreen->jade->darkblue analogous, tint->tone->shade
0000000A F2FFE2FF
00000032 A5DBBAFF
0000005A 69AFB7FF
00000082 4C80A7FF
000000FA 000050FF
00000000

# 802F57BC
# yellow->orange->red->purple->darkred analogous, tint->tone->shade
00000000 FFFFF0FF
0000003C FFC65EFF
00000078 FF8521FF
000000B4 FF0000FF
000000F0 BE0042FF
0000012C 810040FF
00000168 500000FF
00000000

# 802F57F8
# higher contrast variation of the above; complementary
00000000 FFFFF0FF
0000003C FFC961FF
00000078 FF871CFF
000000B4 FF0000FF
000000F0 B00048FF
0000012C 5F0060FF
00000168 000050FF
00000000

# 802F5834
# lightyellow->green->teal analogous, tint->tone->shade
0000000A FFFFE0FF
00000032 FAE983FF
0000005A D9D844FF
00000082 9ACD32FF
000000AA 39A844FF
000000D2 217A4DFF
000000FA 005050FF
00000000

# 802F5870
# jade->teal variation of the above
00000000 FFFFE0FF
00000032 C3DF93FF
00000064 83BC7AFF
00000096 009999FF
000000C8 0B8080FF
000000FA 0F6767FF
0000012C 105050FF
00000000

# 802F58AC
# lavender->red analogous, tint->tone->shade
00000000 E6E6FAFF
0000003C E0AEDDFF
00000078 D973B5FF
000000B4 DC143CFF
000000F0 AB0B29FF
0000012C 7C0417FF
00000168 500000FF
00000000

# 802F58E8
# cyan->red complementary, tint->tone
00000000 E8FFFFFF
00000019 D0E9F9FF
00000032 CDCDF2FF
0000004B D9ABE6FF
00000064 EC82CCFF
0000007D FF4D99FF
0000012C FF0000FF
00000000

# 802F5924
# cyan->darkblue analogous, tint->tone->shade
00000000 E8FFFFFF
0000003C 57BCBBFF
00000078 007080FF
000000B4 173968FF
00000168 000050FF
00000000

# USER PARAMETERS

# damage limit:
# 802F5950
270F     # Damage Capacity (must be <= 9999) (0x270F)
0096     # Starting HP in Stamina mode

# shake:
# 802F5954
80       # Shake Intensity Slider (0...256 == 0.0...2.0)
80       # Shake Duration  Slider (0...256 == 0.0...2.0)
0A       # Shake Duration Range min (in frames)
0A       # Shake Duration Range max (in frames)
3F2A7EFA # Shake Frames per Damage Point (capped by range)

# scale:
# 802F595C
3F800000 # Default XY scale
3F47AE14 # X-Width % for 4 digit number
3F266666 # X-Width % for 5+ player HUD width
3FC00000 # X-Padding for 4 digit number

# active colors:
# 802F596C
802F5240 # Active Damage colors
00000000
# if these are null, they will copy the "default" colors instead
# else, pointer address is used to define a unique color gradient

# default colors:
# 802F5974
802F5218 # Default Damage colors
802F522C # Default Stamina colors
# when active colors are nullified, these are used instead

# death anim:
# 802F597C
3F1BB98C # Random X-Velocity Limit
3F4F9DB2 # Random Y-Velocity Limit
3E9BB2FF # X-Velocity pad
3F9BB646 # Y-Velocity pad
42C80000 # Y-Translation Range
3E4FAACE # Gravity
# modify these to change the procedural animation constraints

# shake anim:
# 802F5994
3DCFAACE # Damage Weight (distance per damage)
3FC2A64C # Shake Maximum Distance
3E4FAACE # Shake Distance Padding
# modify these to change the procedural animation constraints

# font spacing:
# 802F59A0
00000000 # 0
3F01C433 # 1
00000000 # 2
00000000 # 3
00000000 # 4
00000000 # 5
00000000 # 6
00000000 # 7
00000000 # 8
00000000 # 9

# variables, and other data used by functions:
# 802F59C8
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00080000 00000000 00000000 00000000 00000000 00000000 00000000 3F800000 3F800000 3F800000 C12FAE19 C1081547 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

# toc:
802F491C 802F4930 802F4944 802F496C 802F4998 802F49AC 802F49C0 802F49F0 802F4A00 802F4A4C 802F4A98 802F4ACC 802F4AEC 802F4B6C 802F4BAC 802F4C04 802F5218 802F522C 802F5240 802F569C 802F56C0 802F56EC 802F5710 802F5754 802F5790 802F57BC 802F57F8 802F5834 802F5870 802F58AC 802F58E8 802F5924 802F5950 802F5954 802F595C 802F596C 802F5974 802F597C 802F5994 802F59A0 802F59C8 802F5A28 802F5A68 802F5A74 802F5A88

------------- 0x802F5C10 ---- 2C0003E7 -> b 0x802F491C
------------- 0x802F5C18 ---- 380003E7 -> 7D806378
------------- 0x802F5D18 ---- 2C0003E7 -> b 0x802F4930
------------- 0x802F5D20 ---- 380003E7 -> 7D806378
------------- 0x8006CD3C ---- C00288B0 -> b 0x802F4944
# set cap according to damage max
------------- 0x801896FC ---- 380003E7 -> b 0x802F496C
# fixes cap when decrementing below 0 in training mode
------------- 0x80189734 ---- 280303E7 -> b 0x802F4998
# compares against damage cap instead of 999 in training mode
------------- 0x80189754 ---- 280003E7 -> b 0x802F49AC
# compares against damage cap instead of 999 in training mode
------------- 0x801896C8 ---- 41820034 -> 60000000
------------- 0x801896CC ---- 3803FFFF -> b 0x802F49C0
# allows holding L/R while decrementing skip to 0 in training mode
------------- 0x801B93C0 ---- 38000096 -> b 0x802F49F0
# set stamina mode starting HP
------------- 0x802F6770 ---- 80010024 -> b 0x802F4A00
# HUD INIT: the stack is collapsing for end of init function
------------- 0x802F6178 ---- 4BFFED65 -> bl 0x802F4C04
# HUD UPDATE: main overhaul code, as a function call
Code:
     -==-


ASM - Damage HUD Overhaul 1.10
Replaces the Damage HUD update function to provide new features.
[Punkline]
Revision ---- DOL Offset ---- Hex to Replace ---------- ASM Code -
NTSC 1.02 --- 0x802F5F4C ---- 3C60802F38834EDC -> 3C60802F 60644c04
------------- 0x802F491C ----

7C0802A6 90010004 9421FF90 DBE10068 DBC10060 DBA10058 DB810050 BF61003C 7C7B1B78 88030010 5400D7FF 41820084 C382E094 7F7DDB78 C3E2E098 3B800000 C3C2E0A0 C3A2E09C 3BE00001 3BC00000 4808BBBD 880DB6C1 EC1C0072 7C000775 41820014 FC000050 9BCDB6C1 EC00F828 4800000C EC00F82A 9BEDB6C1 D01D0034 4808BB8D EC1EE87A 3B9C0001 2C1C0004 D01D0044 3BBD0004 4180FFB8 881B0010 38600000 50603672 981B0010 48000198 C3A2E08C 7F7DDB78 C3C2E0AC 3BE00000 C3E2E0B0 83DD0054 281E0000 40820014 386DA110 388003E1 38ADA118 48093829 C01E0038 D001002C 8001002C 5400007E 9001002C C001002C FC00E840 40800084 83DD0054 C39D0034 281E0000 40820014 386DA110 3880044E 38ADA118 480937E9 C01E0038 EC00E02A D01E0038 801E0014 5400018D 4082004C 281E0000 41820044 40820014 386DA110 38800234 38ADA118 480937B5 809E0014 38600000 54800211 40820010 54800673 41820008 38600001 2C030000 4082000C 7FC3F378 4807E851 83DD0054 281E0000 40820014 386DA110 388003EE 38ADA118 4809376D C01E003C FC00F040 40810090 83DD0054 C39D0044 281E0000 40820014 386DA110 3880045A 38ADA118 48093741 C01E003C EC00E02A D01E003C 801E0014 5400018D 4082004C 281E0000 41820044 40820014 386DA110 38800234 38ADA118 4809370D 809E0014 38600000 54800211 40820010 54800673 41820008 38600001 2C030000 4082000C 7FC3F378 4807E7A9 C01D0044 EC00F828 D01D0044 3BFF0001 2C1F0004 3BBD0004 4180FE84 BB61003C 80010074 CBE10068 CBC10060 CBA10058 CB810050 38210070 7C0803A6 4E800020 7C0802A6 90010004 9421FF98 DBE10060 DBC10058 DBA10050 DB810048 DB610040 DB410038 DB210030 93E1002C 93C10028 7C7E1B78 93A10024 93810020 8803000F 28000000 418202D8 28000001 40820118 3BE00000 3BBE0000 839D0054 C39D0014 281C0000 40820014 386DA110 388003A4 38ADA118 48093629 D39C0038 801C0014 5400018D 4082004C 281C0000 41820044 40820014 386DA110 38800234 38ADA118 480935FD 809C0014 38600000 54800211 40820010 54800673 41820008 38600001 2C030000 4082000C 7F83E378 4807E699 839D0054 C39D0024 281C0000 40820014 386DA110 388003B3 38ADA118 480935B1 D39C003C 801C0014 5400018D 4082004C 281C0000 41820044 40820014 386DA110 38800234 38ADA118 48093585 809C0014 38600000 54800211 40820010 54800673 41820008 38600001 2C030000 4082000C 7F83E378 4807E621 3BFF0001 2C1F0004 3BBD0004 4180FF04 38000000 981E000F 480001BC 887E000E 3C004330 C822E078 9061001C C042E0A4 90010018 C8010018 EC000828 EF420032 FC1A1040 4080000C FF401090 48000014 C002E0A8 FC1A0040 40810008 FF400090 C382E0B4 7FDDF378 C3A2E070 3BE00000 C3C2E06C C3E2E0B0 4808B7E5 EC01E028 EC1D0032 EF7A0032 4808B7D5 EC01E028 FC1BF040 EC1D0032 EF3A0032 4080000C EC3BF828 48000008 EC3BF82A FC19F040 4080000C EF39F828 48000008 EF39F82A 839D0054 C01D0014 281C0000 EF60082A 40820014 386DA110 388003A4 38ADA118 48093475 D37C0038 801C0014 5400018D 4082004C 281C0000 41820044 40820014 386DA110 38800234 38ADA118 48093449 809C0014 38600000 54800211 40820010 54800673 41820008 38600001 2C030000 4082000C 7F83E378 4807E4E5 839D0054 C01D0024 281C0000 EF60C82A 40820014 386DA110 388003B3 38ADA118 480933F9 D37C003C 801C0014 5400018D 4082004C 281C0000 41820044 40820014 386DA110 38800234 38ADA118 480933CD 809C0014 38600000 54800211 40820010 54800673 41820008 38600001 2C030000 4082000C 7F83E378 4807E469 3BFF0001 2C1F0004 3BBD0004 4180FEB4 887E000F 3803FFFF 981E000F 8001006C CBE10060 CBC10058 CBA10050 CB810048 CB610040 CB410038 CB210030 83E1002C 83C10028 83A10024 83810020 38210068 7C0803A6 4E800020 7C0802A6 3C80804A 90010004 38000006 7C0903A6 9421FF08 DBE100F0 DBC100E8 DBA100E0 BEE100BC 3B2410C8 38B90000 38800000 83C30028 80050000 7C001840 40820010 1C040064 7FF90214 48000014 38A50064 38840001 4200FFE0 3BE00000 881F0010 5400CFFF 41820010 7FE3FB78 4BFFF9D1 48000BD8 7FC3F378 4BD16145 889F0010 3BA30000 5480E7FF 418202CC 5480FFBE 28000001 4082000C 2C1D0000 408202B8 881F0010 38600001 50600F7C 981F0010 7FC3F378 4807A6B1 3AF90260 80B9025C 80D90260 7FC3F378 80F90264 38800001 4BD170CD 7FC3F378 C022E06C 4807A901 809F0060 28040000 4182007C 80770000 80840018 80630000 80840008 80630000 83040008 80830004 7F03C378 80840004 80840004 80840008 80840008 4806970D 887F0008 7C630774 4BD3F62D 2C030000 41820014 7F03C378 C022E068 480697E5 48000010 7F03C378 C022E06C 480697D5 80780064 C022E06C 480702D5 7F03C378 48069B2D 387E0000 38800001 38A00400 4BF3A389 3C606666 A8FF000A 3B836667 80770000 7C1C3896 835F005C 80630000 809A0018 80630000 7C001670 80A40008 54060FFE 80830008 7C003214 80650008 1C00000A 80840008 7C003850 5418063E 48069669 930100B4 3F604330 807A0018 936100B0 80630008 C822E078 C80100B0 C042E070 EC000828 80630008 EC220032 48069731 807A0018 C022E06C 80630008 80630008 80630064 48070225 3C6051EC A8FF000A 3B43851F 80770000 7C1A3896 831F0058 80630000 80980018 80630000 7C002E70 80A40008 54060FFE 80830008 7C003214 80650008 1C000064 80840008 7C003850 7C1C0096 7C001670 54050FFE 7C002A14 541C063E 480695C1 938100AC 80780018 936100A8 80630008 C822E078 C80100A8 C042E070 EC000828 80630008 EC220032 4806968D 80780018 C022E06C 80630008 80630008 80630064 48070181 3C601062 A8FF000A 38034DD3 80770000 7C003896 831F0054 80630000 80980018 80630000 7C003670 80A40008 54060FFE 80830008 7C003214 80650008 1C0003E8 80840008 7C003850 7C1A0096 7C002E70 54050FFE 7C002A14 5417063E 4806951D 92E100A4 80780018 936100A0 80630008 C822E078 C80100A0 C042E070 EC000828 80630008 EC220032 480695E9 80780018 C022E06C 80630008 80630008 80630064 480700DD 7FC3F378 4807B6F1 3C606666 A8DF000A 3B436667 831F005C 7C1A3096 80780018 80630008 3AF90260 80630008 80990260 7C001670 54050FFE 80840000 7C002A14 1C00000A 80840000 80840008 7C003050 5419063E 80840008 4806947D 932100A4 3F804330 80780018 938100A0 80630008 C822E078 C80100A0 C042E070 EC000828 80630008 EC220032 48069545 80780018 C022E06C 80630008 80630008 80630064 48070039 3C6051EC A8FF000A 3B63851F 80770000 7C1B3896 831F0058 80630000 80980018 80630000 7C002E70 80A40008 54060FFE 80830008 7C003214 80650008 1C000064 80840008 7C003850 7C1A0096 7C001670 54050FFE 7C002A14 5419063E 480693D5 932100AC 80780018 938100A8 80630008 C822E078 C80100A8 C042E070 EC000828 80630008 EC220032 480694A1 80780018 C022E06C 80630008 80630008 80630064 4806FF95 3C601062 A89F000A 38034DD3 7C002096 7C003670 54030FFE 7C001A14 1C0003E8 7C002050 7C1B0096 7C002E70 54030FFE 7C001A15 40820040 7C1B2096 7C002E70 54030FFE 7C001A14 1C000064 7C002050 7C1A0096 7C001670 54030FFE 7C001A15 40820014 807F0058 38800010 4807C9B5 48000010 807F0058 38800010 4807CBA5 3C601062 A8FF000A 3B834DD3 80770000 7C1C3896 831F0054 80630000 80980018 80630000 7C003670 80A40008 54060FFE 80830008 7C003214 80650008 1C0003E8 80840008 3CA051EC 7C003850 3B65851F 7C1B0096 7C002E70 54050FFE 7C002A14 5417063E 480692A9 92E100A4 3C004330 80780018 900100A0 80630008 C822E078 C80100A0 C042E070 EC000828 80630008 EC220032 48069371 80780018 C022E06C 80630008 80630008 80630064 4806FE65 A89F000A 7C1C2096 7C003670 54030FFE 7C001A14 1C0003E8 7C002050 7C1B0096 7C002E70 54030FFE 7C001A15 40820014 807F0054 38800010 4807C8B9 48000010 807F0054 38800010 4807CAA9 A87F000C A81F000A 7C030000 4182032C 887F0008 7C630774 4BD3F125 2C030000 41820140 A87F000A 2C030064 4081000C 38600064 48000010 7C600735 40800008 38600000 7C600734 88EDA108 6C038000 880DA10C 906100A4 3CC04330 7C070050 C882E080 90C100A0 6C008000 C002E08C C82100A0 38ADA108 900100AC 388DA10C EC212028 90E100B4 380000FF C0A2E068 EC610024 90C100A8 C842E078 90C100B0 C82100A8 C80100B0 EC651828 EC212028 EC001028 EC03007A FC00001E D8010098 8061009C 98610040 88E50001 88640001 90E1008C 7C671850 6C638000 90C10088 90610094 C8010088 90C10090 EC001028 C8210090 EC212028 EC03007A FC00001E D8010080 80610084 98610041 88A50002 88640002 90A10074 7C651850 6C638000 90C10070 9061007C C8010070 90C10078 EC001028 C8210078 EC212028 EC03007A FC00001E D8010068 8061006C 98610042 98010043 80010040 90010060 48000134 A87F000A 2C03012C 4081000C 3860012C 48000010 7C600735 40800008 38600000 7C600734 88EDA108 6C038000 880DA10C 9061006C 3CC04330 7C070050 C862E080 90C10068 6C008000 C002E088 C8210068 38ADA108 90010074 388DA10C EC211828 90E1007C 380000FF C842E078 EC810024 90C10070 90C10078 C8210070 C8010078 EC211828 EC001028 EC04007A FC00001E D8010080 80610084 98610038 88E50001 88640001 90E10094 7C671850 6C638000 90C10090 9061008C C8010090 90C10088 EC001028 C8210088 EC211828 EC04007A FC00001E D8010098 8061009C 98610039 88A50002 88640002 90A100AC 7C651850 6C638000 90C100A8 906100A4 C80100A8 90C100A0 EC001028 C82100A0 EC211828 EC04007A FC00001E D80100B0 806100B4 9861003A 9801003B 80010038 90010060 807F0054 88010060 80630018 80830008 8064000C 98030004 88A10061 8064000C 98A30005 88C10062 8064000C 98C30006 807F0058 88010060 80630018 80830008 8064000C 98030004 8064000C 98A30005 8064000C 98C30006 807F005C 88010060 80630018 80830008 8064000C 98030004 8064000C 98A30005 8064000C 98C30006 807F0060 88010060 80630018 80830008 8064000C 98030004 8064000C 98A30005 8064000C 98C30006 7FC3F378 4BD15869 2C030000 41820064 3AE00000 3B1F0000 83380054 28190000 40820014 386DA110 388003E1 38ADA118 480929C1 C0190038 D0180014 83380054 28190000 40820014 386DA110 388003EE 38ADA118 4809299D C019003C 3AF70001 2C170004 D0180024 3B180004 4180FFAC 3C606666 A89F000A 38036667 7C002096 7C001670 54030FFE 7C001A14 1C00000A 7C002050 2C000001 4082000C C3E2E090 48000008 C3E2E06C 3C6051EC 3803851F 7C002096 7C002E70 54030FFE 7C001A14 1C000064 3C606666 7C002050 38636667 7C030096 7C001670 54030FFE 7C001A14 2C000001 4082000C C3C2E090 48000008 C3C2E06C 82FF0060 C01F0020 28170000 EFA0F828 40820014 386DA110 388003A4 38ADA118 480928DD D3B70038 80170014 5400018D 4082004C 28170000 41820044 40820014 386DA110 38800234 38ADA118 480928B1 80970014 38600000 54800211 40820010 54800673 41820008 38600001 2C030000 4082000C 7EE3BB78 4807D94D EFFFF02A 82FF0058 C01F0018 28170000 EFA0F82A 40820014 386DA110 388003A4 38ADA118 4809285D D3B70038 80170014 5400018D 4082004C 28170000 41820044 40820014 386DA110 38800234 38ADA118 48092831 80970014 38600000 54800211 40820010 54800673 41820008 38600001 2C030000 4082000C 7EE3BB78 4807D8CD 3C601062 A89F000A 38034DD3 7C002096 7C003670 54030FFE 7C001A14 1C0003E8 3C6051EC 7C002050 3863851F 7C030096 7C002E70 54030FFE 7C001A14 2C000001 4082000C C002E090 48000008 C002E06C EC3E002A 82FF0054 C01F0014 28170000 EFFF082A EFA0F82A 40820014 386DA110 388003A4 38ADA118 48092789 D3B70038 80170014 5400018D 4082004C 28170000 41820044 40820014 386DA110 38800234 38ADA118 4809275D 80970014 38600000 54800211 40820010 54800673 41820008 38600001 2C030000 4082000C 7EE3BB78 4807D7F9 881F0010 5400DFFF 4182000C 3800000A 981F000F 387F0000 389D0000 4BFFF075 880DB6C0 28000005 4180000C C002E0B8 D01E002C BAE100BC 800100FC CBE100F0 CBC100E8 CBA100E0

  ->

# completely overwrite the 3 following (contiguous) functions:
  # 802f491c: original death animation handle
  # 802f4b84: original shake animation handle
  # 802f4edc: original update function
  # -- the first 2 are leaf funcs called by the 3rd
  # -- the 3rd func is a callback that is only explicitly called from 1 location.
  # - it is otherwise called by a callback event in function 80390cfc
  # - a pair of overwrites handle changing the interpreted destination of these calls

  # around 4.5 kb are granted for overhaul of these functions.
  # overwrite must not become larger than 0x1220 bytes.

  # this overwrite includes all non-calling instructions and data used in this code:

.set self, 0x802f491c
  # 'self' symbol can be used with labels to calculate the position
  # of all things contained in this overwrite.

_beginning_of_overwrite:









  # These are manually injected with overwrites,
  # to avoid requiring any memory regions.

  # The injection lines have been commented out.



_INJ0:
  # 802F491C

  # 1.02 ------ 802f5c10 ---- 2c0003e7 ->Branch
  # set cap according to damage max
lis r12, self+_HParams_damage@h
ori r12, r12, self+_HParams_damage@l
lhz  r12, 0x0(r12)
cmpw r0, r12
b 0x802f5c14
  # 1.02 ------ 802F5C18 ---- 802f5c18 -> 7D806378
  # cap according to damage max



_INJ1:
  # 802F4930

  # 1.02 ------ 802F5D18 ---- 2c0003e7 -> Branch
  # set cap2 according to damage max
lis r12, self+_HParams_damage@h
ori r12, r12, self+_HParams_damage@l
lhz  r12, 0x0(r12)
cmpw r0, r12
b 0x802F5D1C
  # 1.02 ------ 802f5d20 ---- 802f5c18 -> 7D806378
  # cap2 according to damage max



_INJ2:
  # 802F4944

  # 1.02 ------ 8006cd3c ---- c00288b0 -> Branch
  # set cap3 according to damage max
lis r12, self+_HParams_damage@h
ori r12, r12, self+_HParams_damage@l
lhz r12, 0x0(r12)
sth r12, -0x10(sp)
  # store damage cap int in redzone

mfspr r12, 919
lis r11, 0x0005
mtspr 919, r11
  # hword dequantizing

psq_l f0, -0x10(sp), 1, 7
mtspr 919, r12
b 0x8006cd40
  # damage cap now loaded in f0[0] -- will be used in comparison









_INJ3:
  # 802F496C

  # 1.02 ------ 801896fc ---- 380003E7 -> Branch
  # code fixes cap when decrementing below 0 in training mode
lis r12, 0x804C
ori r12, r12, 0x1FB0
lwz r11, 0x0(r12)
andi. r11, r11, 0x60
beq+ _TR_load_max
  # check if holding L or R

_TR_stall_while_holding_LR:
li r0, 0
b _TR_return0
  # if holding L/R, then set to 0

_TR_load_max:
lis r12, self+_HParams_damage@h
ori r12, r12, self+_HParams_damage@l
lhz  r0, 0x0(r12)
  # else, load maximum

_TR_return0:
b 0x80189700



_INJ4:
  # 802F4998

  # 1.02 ------ 80189734 ---- 280303E7 -> Branch
  # code compares against damage cap instead of 999
lis r12, self+_HParams_damage@h
ori r12, r12, self+_HParams_damage@l
lhz  r12, 0x0(r12)
cmplw r3, r12
b 0x80189738



_INJ5:
  # 802F49AC

  # 1.02 ------ 80189754 ---- 280003E7 -> Branch
  # code compares against damage cap instead of 999
lis r12, self+_HParams_damage@h
ori r12, r12, self+_HParams_damage@l
lhz  r12, 0x0(r12)
cmplw r0, r12
b 0x80189758



_INJ6:
  # 802F49C0

  # 1.02 ------ 801896c8 ---- 41820034 -> 60000000
  # 1.02 ------ 801896cc ---- 3803ffff -> Branch
  # code allows holding L/R while decrementing skip to 0
cmplwi cr1, r3, 0
lis r12, 0x804C
ori r12, r12, 0x1FB8
lwz r11, 0x0(r12)
andi. r11, r11, 0x60
beq _no_LR
  # if holding L or R when decrementing

_LR:
li r0, 0
b _return

_no_LR:
subi r0, r3, 1
bne cr1, _return
b 0x801896fc

_return:
b 0x801896d0









_INJ7:
  # 802F49F0

  # 1.02 ------ 0x801B93C0 ---- 38000096 -> Branch
lis r12, self+_HParams_damage@h
ori r12, r12, self+_HParams_damage@l
lhz r0, 0x2(r12)
b 0x801B93C4
  # return r0 = starting stamina









_INJ8:
  # 802F4A00

  # ------------- 0x802F6770 ---- 80010024 -> Branch
  # HUD INIT: the stack is collapsing for end of init function
  # this injection has access to file data before any instances are made for objects
  # r30 and r31 are free

  # relocation info table for IfAll.dat/usd -- from r13
.set xIfAll,   -0x4944 # to relocation table alloc
.set xReloc,      0x20 # to base address for relocation
.set xFirstJDesc, 0x568
.set xLastJDesc,  0x628
.set xFirstIntroJAnim,  0x1178
.set xLastIntroJAnim,   0x11B4
.set xFirstHealJAnim,   0x46B4
.set xLastHealJAnim,    0x46F0

  # JDesc
.set xJDescSibling, 0xC # JObjDesc -> sibling JObjDesc
.set xJDescDDesc,   0x10 #

  # JAnims:
.set xJAnimSibling, 0x4 # Anim -> sibling Anim
.set xJAnimADesc,   0x8 # Anim -> AObjDesc

  # fake file
.set xFakeJDesc,      _fake_JObjDesc     - _fake_JObjDesc
.set xFakeIntroJAnim, _fake_JAnimIntro   - _fake_JObjDesc
.set xFakeHealJAnim,  _fake_JAnimHeal    - _fake_JObjDesc

.set rFake, 3
.set rFile, 4

lis rFake, self+_fake_JObjDesc@h
ori rFake, rFake, self+_fake_JObjDesc@l
  # r3 = new fake file data

lwz rFile, xIfAll(r13)
lwz rFile, xReloc(rFile)
  # r4 = existing file data

_init_set_JDNew:
addi r5, rFake, xFakeJDesc
addi r6, rFile, xFirstJDesc
lwz  r0, xJDescDDesc(r6)
stw  r0, xJDescDDesc(r5)
  # new JObjDesc for 1000s digit

_init_create_sibling_JDesc:
stw  r5, xLastJDesc + xJDescSibling(rFile)
  # append new JObjDesc to existing skeleton

_init_intro_JAnim_node:
addi r5, rFake, xFakeIntroJAnim
lwz  r6, xFirstIntroJAnim+xJAnimADesc(rFile)
stw  r5, xLastIntroJAnim+xJAnimSibling(rFile)
stw  r6, xJAnimADesc(r5)
  # Intro animation will now create a second instance of the 100s digit AObj for 1000s digit

_init_heal_JAnim_node:
addi r5, rFake, xFakeHealJAnim
lwz  r6, xFirstHealJAnim+xJAnimADesc(rFile)
stw  r5, xLastHealJAnim+xJAnimSibling(rFile)
stw  r6, xJAnimADesc(r5)
  # Heal animation will now create a second instance of the 100s digit AObj for 1000s digit

_init_return:
lwz r0, 0x0024(sp)
b 0x802F6774










_func_set_TAnim:
  # 802F4A4C

  # r3 = TObj address
  # r4 = TAnim
  # f1 = ReqAnim f1 value
  # f2 = AObjRate f1 value
.set xTAObj,    0x64 # TObj -> AObj (for texture)
mflr r0
stw  r0, 0x4(sp)
stwu sp, -0x20(sp)
stw r31, 0xC(sp)

mr   r31, r3
stfs f1, 0x10(sp)
stfs f2, 0x14(sp)

  # r3 = TObj
  # r4 = TAnim
bl 0x8035e708

mr  r3, r31 # r3 = TObj
lfs f1, 0x10(sp) # f1 = ReqAnim value -- keyframe to start on?
bl 0x8035e800

lwz r3, xTAObj(r31) # AObj
lfs f1, 0x14(sp) # Frame Rate?
bl 0x8036530c

lwz  r31, 0xC(sp)
addi sp, sp, 0x20
lwz  r0, 0x4(sp)
mtlr r0
blr



_func_set_JAnim:
  # 802F4A98

  # r3 = parent JObj
  # r4 = ID 1
  # r5 = xJAnimList
  # r6 = xTAnimList
  # r7 = unk (xRAnimList?)
  # f1 = ReqAnim F1 (index?)
mflr r0
stw  r0, 0x4(sp)
stwu sp, -0x20(sp)

stw  r3, 0x10(sp)
stfs f1, 0x14(sp)
  # stored params

  # _Index_HSD_JObjAddAnim:
bl 0x8000C07C
  # 8000C07C   $!_Index_HSD_JObjAddAnim

  # _HSD_JObjReqAnimAll:
lwz r3, 0x10(sp)
lfs f1, 0x14(sp)
  # r3 = parent JObj
  # f1 = index? duration? start? unknown floating point

bl 0x8036F8BC
  # 8036F8BC   HSD_JObjReqAnimAll

  # _return:
addi sp, sp, 0x20
lwz  r0, 0x4(sp)
mtlr r0
blr



_func_check_DirtySub:
  # 802F4ACC

  # r3 = JObj
  # this is how the game makes a joint
  # move after modifying it with code.
lwz r0, 0x14(r3)
rlwinm. r0, r0, 0, 0x02000000
bnelr-
rlwinm. r0, r0, 0, 0x00800000
bne- _func_check_DirtySub_call
rlwinm. r0, r0, 0, 0x00000040
bnelr-
_func_check_DirtySub_call:
b 0x803732E8
  # if all of these conditions work out, then call HSD_JObjSetMtxDirtySub
  # else, nothing is done



_func_RGBA_ilerp:
  # 802F4AEC

  # RGBA indexed linear interpolation
  # - converts an int into an RGBA color using
  # an ordered list of integer-based color keys.

  # r3 = number of colors
  # r4 = input index number
  # r5 = minimum index number
  # r6 = maximum index number
  # r7 = address of keyed color array

  # returns:
  # f1 = interpolation coefficient
  # r3 = RGBA 1
  # r4 = RGBA 2
  # r5 = interpolated RGBA 3

  # Array of keyed colors use this format:
.set xKey,   0x0 # 32-bit unsigned integer
.set xColor, 0x4 # RGBA color associated with this index

  # register names:
.set rCount,  3 # Number of colors
.set rEnd,    3 # end of array
.set rInput,  4 # input 32-bit UINT
.set rMin,    5 # minimum key value
.set rMax,    6 # maximum key value
.set rArray,  7 # array pointer
.set rFloor,  8 # bottom key value, for RGBA1
.set rRGBA1,  9 # floor color
.set rCeil,  10 # top key value, for RGBA2
.set rRGBA2, 11 # ceiling color


  # _check_valid:
cmpw rInput, rMin
cmpw cr1, rInput, rMax
cror 4, lt, gt+4
slwi. rCount, rCount, 3
cror eq, eq, 4
beq- _func_RGBA_ilerp_return_null_color
  # if rInput is <min or >max
  # or if color count == 0
  # then return the color 0x00000000

lswi rFloor, r7, 0x10
  # load first colors

  # _check_starting_floor:
cmpw  rInput, rFloor
ble-  _func_RGBA_ilerp_return_floor_color
  # if the input number is valid, but the first key is still > input
  # then return the floor color without interpolating

  # _loop_setup:
add  rEnd, rCount, rArray
  # rCount is now rEnd ; address of end of array
  # rArray now points to base of array

_func_RGBA_ilerp_iter:
cmpw rArray, rEnd
lswi rFloor, rArray, 0x10
addi rArray, rArray, 8
cmpw cr1, rCeil, rFloor
crnand 0, lt, gt+4
bt- 0, _func_RGBA_ilerp_return_floor_color
  # if rArray has been exhausted,
  # or if rCeil <= rFloor
  # then return floor color

cmpw rInput, rCeil
bgt+ _func_RGBA_ilerp_iter
  # if rInput > rCeil, then we haven't reached the correct range yet

  # else, we've found something in range
mr    r3, rInput
addi  r4, sp, -0x10
stswi rFloor, r4, 0x10
lswi  r4, r4, 0x10
  # r3 = rInput
  # r4 = rFloor
  # r5 = rRGBA1
  # r6 = rCeil
  # r7 = rRGBA2

b _func_RGBA_lerp_U32range
  # function will now interpolate from selected range

  # else, exceptions are handled with returns:

_func_RGBA_ilerp_return_null_color:
li rRGBA1, 0
li rRGBA2, 0

_func_RGBA_ilerp_return_floor_color:
li r0, 0
stw r0, -0x10(sp)
lfs f1, -0x10(sp)
  # return floor fLerp value:

mr r3, rRGBA1
mr r4, rRGBA2
mr r5, rRGBA1
blr



_func_RGBA_lerp_U32range:
  # 802F4B6C

  # RGBA linear interpolation from integer
  # - casts and normalizes integer based on given
  # arguments. For use with <RGBA_lerp>

  # r3 = input integer
  # r4 = floor integer - key for RGBA floor
  # r5 = RGBA floor
  # r6 = ceil integer - key for RGBA ceiling
  # r7 = RGBA ceiling

  # returns:
  # f1 = interpolation coefficient
  # r3 = RGBA 1
  # r4 = RGBA 2
  # r5 = interpolated RGBA 3

.set rInput,  3 # input 32-bit UINT
.set rFloor,  4 # bottom key value, for RGBA1
.set rRGBA1,  5 # floor color
.set rCeil,   6 # top key value, for RGBA2
.set rRGBA2,  7 # ceiling color
.set rQuant,  8 # used to set up QR7
.set rDelta,  9 # rCeil-rFloor
.set rSave,  10 # used to store QR7
.set fLerp,   1 # input arg for <RGBA_lerp>
.set fHighs,  1 # highs, in casting operation
.set fLows,   2 # lows, in casting operation
.set fDelta,  3 # - casted rDelta
.set fInput,  4 # - casted rInput, after (rInput -= rFloor)

  # _dequantize:
mfspr rSave, 919
lis rQuant, 0x3005 # -16 load scale, unsigned hword pairs
mtspr 919, rQuant
  # qr7 can now load in high order bits from a pair of 32-bit UINTs
  # qr3 (default) can be used to load in the low order

sub rInput, rInput, rFloor
sub rDelta, rCeil, rFloor
  # 2 32-bit values to be dequantized

stw rInput, 0 - 0x20(sp)
stw rDelta, 2 - 0x20(sp)
sth rInput, 6 - 0x20(sp)
  # highs and lows are placed in the redzone in hword pairs, with their orders in lows:
  # Ih, Dh
  # Dl, Il

psq_l fHighs, 0 - 0x20(sp), 0, 7
psq_l fLows,  4 - 0x20(sp), 0, 3
mtspr 919, rSave
  # done with dequantization

ps_sum0 fInput, fHighs, fInput, fLows
ps_sum0 fDelta, fLows, fDelta, fHighs
  # sums construct 32-bit casted pair
  # pair has been transposed to ps0 of registers fInput and fDelta


mr r3, rRGBA1
mr r4, rRGBA2
fdivs fLerp, fInput, fDelta
  # create a normalized lerp value to mix between RGBA1 and RGBA2


  # ready for lerp after normalizing input



_func_RGBA_lerp:
  # 802F4BAC
  # an efficient RGBA lerp leaf that safely utilizes graphical quantization registers

  # r3 = RGBA floor
  # r4 = RGBA ceiling
  # f1 = interpolation amount between floor (0.0) and ceiling (1.0)

  # returns:
  # r3 = RGBA floor
  # r4 = RGBA ceiling
  # r5 = interpolated RGBA

ps_merge00 f1, f1, f1
  # just to be absolutely sure that f1[1] = f1[0]

mfspr r0, 919
lis   r5, 0x0804
ori   r5, r5, 0x0804
mtspr 919, r5
  # qr7 is set to work with bytes as mantissas now

lfs   f6, -0x7FD8(rtoc) # load constant "1.0" from rtoc
fsubs f6, f6, f1 # (1.0 - I)
  # f6[0] and f6[1] are duplicates of the same value

  # _dequantize:
stw     r3, -0x10(sp) # store colors in redzone
stw     r4, -0x0C(sp)
psq_l   f2, -0x10(sp), 0, 7 # R, G
psq_l   f3, -0x0E(sp), 0, 7 # B, A   4 channels (fA)
psq_l   f4, -0x0C(sp), 0, 7 # R, G
psq_l   f5, -0x0A(sp), 0, 7 # B, A   4 channels (fB)
  # all dequantized variables are loaded

  # _interpolate:
ps_mul  f0, f4, f1 # pair (G * I)
ps_madd f0, f2, f6, f0 # pair (R * (1.0 - I)) + (G * fI)
psq_st  f0, -0x8(sp), 0, 7 # quantize pair of channels "R and G"
ps_mul  f0, f5, f1 # pair (A * I)
ps_madd f0, f3, f6, f0 # pair (B * (1.0 - I)) + (A * fI)

  # _requantize:
psq_st  f0, -0x6(sp), 0, 7 # quantize pair of channels "B and A"
lwz     r5, -0x8(sp)
mtspr 919, r0
  # all 4 channels quantized and loaded in r5, for return value
  # qr7 has been restored to its normal state

  # _return:
blr









_update_overhaul:
  # 802F4C04

  # r3 = HUD GObj
  # no returns

  # func replaces 0x1220 bytes of code vital to updating the damage HUD.

_overhaul_symbols:
  # registers:
.set rParams,  16 # holds user parameters
.set rGlobals, 17 # holds global pointers
.set rHUD,     18 # holds variables for this HUD GObj, and its joints
.set rHUDex,   19 # holds variables for extra HUD joint
.set rJObj,    20 # address of parent JObj
.set rJObjex,  21 # address of extra JObj
.set rBase,    22 # base variable, for loops that read from rHUD arrays
.set rI,       23 # index variable, for reaching rHUD variables
.set rCount,   24 # counter, for loops
  # .set        25
.set rA,       26 # working saved registers [ABCDEF]
.set rB,       27
.set rC,       28
.set rD,       29
.set rE,       30
.set rF,       31

  # sp:
.set xCR,         0x14
.set xStoreGPRs,  0x18
.set xVars,       0x58
.set xDecIDs,     xVars       + 0x00
.set xDecKeys,    xDecIDs     + 0x08
.set xPadding,    xDecKeys    + 0x14
.set xHealJAnim,  xPadding    + 0x14
.set xDigitTAnim, xHealJAnim  + 0x04
.set xSignTAnim,  xDigitTAnim + 0x04
.set xThisColor,  xSignTAnim  + 0x04
.set xThisDelta,  xThisColor  + 0x04
.set xAnimating,  xThisDelta  + 0x04
.set xTemp,       xAnimating  + 0x04
.set endofstack,  xTemp       + 0x30
.set stacksize, ((endofstack>>4)+1)<<4

  # rParams:
.set addrParams, self+_HParams

.set xDamageCap,            _HParams_damage         - _HParams + 0x00

.set xShakeIntensitySlider, _HParams_shake          - _HParams + 0x00
.set xShakeDurationSlider,  _HParams_shake          - _HParams + 0x01
.set xShakeLimitMin,        _HParams_shake          - _HParams + 0x02
.set xShakeLimitMax,        _HParams_shake          - _HParams + 0x03
.set xShakeFrameWeight,     _HParams_shake          - _HParams + 0x04

.set xShakingDamageRatio,   _HParams_shake_anim     - _HParams + 0x00
.set xShakingDistanceMax,   _HParams_shake_anim     - _HParams + 0x04
.set xShakingPad,           _HParams_shake_anim     - _HParams + 0x08

.set xScaleXYBase,          _HParams_scale          - _HParams + 0x00
.set xScaleX4Digit,         _HParams_scale          - _HParams + 0x04
.set xScaleX5Player,        _HParams_scale          - _HParams + 0x08
.set xPadX4Digit,           _HParams_scale          - _HParams + 0x0C

.set xColorActiveDMG,       _HParams_active_colors  - _HParams + 0x00
.set xColorActiveSTM,       _HParams_active_colors  - _HParams + 0x04
.set xColorDefaultDMG,      _HParams_default_colors - _HParams + 0x00
.set xColorDefaultSTM,      _HParams_default_colors - _HParams + 0x04

.set xExplodingXvelRandCap, _HParams_death_anim     - _HParams + 0x00
.set xExplodingYvelRandCap, _HParams_death_anim     - _HParams + 0x04
.set xExplodingXpad,        _HParams_death_anim     - _HParams + 0x08
.set xExplodingYpad,        _HParams_death_anim     - _HParams + 0x0C
.set xExplodingYLimitMax,   _HParams_death_anim     - _HParams + 0x10
.set xExplodingGravity,     _HParams_death_anim     - _HParams + 0x14

.set xFontPadding,          _HParams_font_spacing   - _HParams + 0x00

  # rHUD structure:
.set xHUDThisGObj, 0x00 # points to GObj belonging to this HUD struct
.set xHUDPlayer,   0x08 # player slot ID
.set xHUDDMG,      0x0A # updated damage
.set xHUDDMGPrev,  0x0C # previous damage
.set xHUDDMGDelta, 0x0E # difference, for calculating shake
.set xHUDShakeCTR, 0x0F # 0 = no shake, 1 = reset, <= shake countdown
.set xHUDflags,    0x10 # flags are loaded into saved cr2
.set xHUDSignJObj, 0x60 # the JObj for the damage sign

  # rHUD array bases (each contains 4 entries, for loops) :
.set xHUDMemX,     0x14 # copied values from local X in joint
.set xHUDMemY,     0x24 # copied values from local Y in joint
.set xHUDXVel,     0x34 #
.set xHUDYVel,     0x44 #
.set xHUDJObjs,    0x54 # pointers to joints
  # in all of these:  0   , 1  , 2 , 3
  # 100s, 10s, 1s, %sign

  # rHUDex structure:
.set xHUDexMemX,   0x0
.set xHUDexMemY,   0x4
.set xHUDexXVel,   0x8
.set xHUDexYVel,   0xC

  # Globals -> animation stuff:
.set addrGlobals,   0x804a10c8
.set xJObjDescRoot, 0x258 # root of skeleton, used to instantiate new HUDs on player init
.set xJAnimList,    0x25C # indexed pointers point to root JAnim joint nodes
.set xTAnimList,    0x260 # indexed pointers point to root TAnim joint nodes
.set xRAnimList,    0x264 # this one is null, so 'RAnim' is a bit of a guess
.set xTAnimJObjs,   0x0
.set JAnimHeal,     1

  # JAnim:
.set xJAnimJChild,   0x0
.set xJAnimJSibling, 0x4

  # TAnim:
.set xTAnimJChild,   0x0
.set xTAnimJSibling, 0x4
.set xTAnimJDObjs,   0x8
.set xTAnimDMObjs,   0x8

  # GObj structure:
.set xParentObj, 0x28 # parent HSD Object -- in this case, a parent JObj (joint)

  # JObj structure:
.set xJObjSibling, 0x08
.set xJObjDObj,    0x18 # Display object
.set xJObjFlags,   0x14 # Joint flags
.set xJObjScaleX,  0x2C
.set xJObjScaleY,  0x30
.set xJObjTransX,  0x38
.set xJObjTransY,  0x3C

  # DObj structure:
.set xDObjMObj,  0x8 # Material Object

  # MObj structure:
.set xMObjTObj,  0x8 # Texture Object
.set xMObjMCol,  0xC # Material Color

  # Material Color Structure:
.set xMColAmCol, 0x4 # Ambient Color

  # TObj structure:
.set xTObjAObj,  0x64 # Texture Animation Object

  # CR bools:
.set bExploding,     8 # xHUDflags(80) - no update, just update velocity and xy pos
.set bExplodeStart,  9 # xHUDflags(40) - has not been initialized for explosion velocity
.set bShakeInit,    10 # xHUDflags(20) - sets shake CTR
.set bHealing,      11 # xHUDflags(10) - ORed with unknown flag returned from 0x8000B09C
.set bShaking,      12 # causes shake effect, initiated by !0 shake timer logic
.set bShakeReset,   13 # caused by shake timer == 1 -- resets XY position to memXY
.set bStamina,      14 # flag returned from 0x80034634 -- determines stamina mode status

  # the following help each loop correctly manage differences between different joints:
.set bSignJoint,    16 # '%' or 'HP' sign
.set bFirstDigit,   17 # 1s digit
.set bLastDigit,    18 # 1000s digit
.set bFormatDigit,  19 # 10s+


_overhaul_start:
mflr  r0
mfcr  r4
stw   r0, 0x4(sp)
stwu  sp, -stacksize(sp)
stw   r4,  xCR(sp)
stmw  r16, xStoreGPRs(sp)
# cr is backed up with r16...r31
# cr2...4 are safe to use for storage

# basic setup:

_saved_params:
lis rParams, addrParams@h
ori rParams, rParams, addrParams@l
# rParams points to the base of our overwrite data
# symbols use labels to reach them, as they are local to the contiguous overwrite

lis rGlobals, addrGlobals@h
ori rGlobals, rGlobals, addrGlobals@l

_find_rHUD:
lis rHUD, 0x804a
ori rHUD, rHUD, 0x10c8-0x64
addi r5, rHUD, 0x64*6
# rHUD will be updated with lwzu until the correct base is found
# r5 = termination address

_find_rHUD_loop:
lwzu r4, xHUDThisGObj+0x64(rHUD)
cmpw r3, r4
cmpw cr1, rHUD, r5
beq- _found_rHUD
blt+ cr1, _find_rHUD_loop
   b _abort_func
   # abort if invalid r3 argument

_found_rHUD:
# rHUD = base of HUD structure for this entity

lis rHUDex, self+_HUDex@h
ori rHUDex, rHUDex, self+_HUDex@l
lbz r6, xHUDPlayer(rHUD)
slwi r6, r6, 4
addi rHUDex, rHUDex, r6
# rHUDex will be used to read/write to extra HUD variables

lwz rJObj, xParentObj(r3)
# xHUDThisGObj(rHUD) == r3
# rJObj will let us reference the entire skeleton

lwz rJObjex, xHUDSignJObj(rHUD)
lwz rJObjex, xJObjSibling(rJObjex)
# rJObjex will be used to read/write to extra JObj
# saved params are loaded.

_rHUD_bools:
lwz    rB, xHUDflags-1(rHUD)
# rB = misaligned word; loads the flags we want in nibble 2
# This causes bools in rHUD to line up with symbols,
#  without need for an extra rotation instruction.

rlwinm rC, rB, 16, 0x6
# rC now holds 2-bit value used to represent the state of the healing animation

lbz r3, xHUDPlayer(rHUD)
bl 0x80034634
rlwimi rB, r3, 31-bStamina, 0x00020000
# bStamina has been inserted into rB bools

rlwinm rB, rB, 0, 0x00FF0000
mtcrf 0b00111000, rB
# load bools into saved cr nibbles

# precompiled cr values in saved cr.
# saved bits can be read from multiple points in the function without rechecking.

_check_if_healing:
mr r3, rJObj
bl 0x8000B09C
mtcrf 0b00000001, r3
crandc 31, bHealing, 31
# b31 = TRUE if heal anim has finished, but still bHealing

cmpwi rC, 2
# check for heal animation indicator
# if not "1" (in this case, 1 <<1),
# then it will be set and the logic is skipped.

crandc bHealing, bHealing, eq
cror bHealing, bHealing, 31
# if bHealing, AND ID !=1<<1;
# or,
# if bHealing, AND Anim is done with its animation;
# then bHealing is TRUE.

crand bExplodeStart, bExploding, bExplodeStart
# bExplodeStart will use a different loop from bExploding
# non exploding routine will be different from exploding routine
# the upcoming loop will use these bools to select 1 of 3 loop routines,
# with a common iteration routine.


_setup_first_loop:
li rCount, 4
# for 5 joints, counting down. Creates the following order:
# 4=sign,     3=1s,        2=10s,     1=100s,    0=1000s
# bSignJoint, bFirstDigit, ...,       ...,       bLastDigit

# this order cooresponds with the order that rHUD stores its arrays:
# 0x0 = variable for 100s
# 0x4 = variable for 10s
# 0x8 = variable for 1s
# 0xC = variable for %

# to access these with (rCount=0) representing the 1000s digit,
# we use bases from rHUD arrays, and subtract 4 to account for the gap
# -- then, bLastDigit tells the parse to use a unique base from rHUDex

# this joins the two data tables when loading variables according to rCount.



# The upcoming loop is used to handle pre-animation operations.

# Since the death exploding animation is entirely procedural,
# the preanimation loop handles exploding joints separately from
# updating joints -- creating a little bit of spaghetti
# for the sake of creating a more economic code.

# There are 3 unique routines encapsulated in this pre-animation loop;
# each sharing a common startup, iteration, and termination condition.

# 2 of these are for explosions; the first for initializing it,
# and second for animating it. These conditions have been saved
# as bExplodeStart and bExploding, respectively.

# The Exploding digits already have all of the variables that
# they need in order to proceed, so they branch into the loop from here.

bt- bExplodeStart, _first_loop
bt- bExploding,    _first_loop

# The update routine still needs to find its TAnim assets,
# reset its heal animations if necessary,
# and fetch the color to be applied to each MObj's color struct.

_get_TAnims:
lwz rA, xTAnimList(rGlobals)
lwz rA, xTAnimJObjs(rA)     # these are joint nodes:

lwz rA, xTAnimJChild(rA)    # 100s -> rA
lwz rB, xTAnimJSibling(rA)  # 10s  v
lwz rB, xTAnimJSibling(rB)  # 1s   v
lwz rB, xTAnimJSibling(rB)  # sign -> rB

lwz rA, xTAnimJDObjs(rA)    # select texture nodes from the joint nodes
lwz rB, xTAnimJDObjs(rB)
lwz rA, xTAnimDMObjs(rA)
lwz rB, xTAnimDMObjs(rB)
# rA = Digit TAnim (texture node)
# rB = Percentage TAnim (texture node)

# these nodes are structured to represent families of joint assets,
# and are used to pair TObjs with AObjs that translate keyframes into
# a list of numbers [0 ... 9 or] or signs ['%', 'HP']

# They are not updated during explosions, making the explosions
# retain the number that they exploded with.
# (we skip it when exploding because death resets the damage to 0,
# and we want to keep the old value for display)

bf+ bHealing, _end_of_heal
# if bHealing, then run the heal animation startup routine:

   _set_heal_animation:
   addi r8, rGlobals, 0x25C
   li   r0, 0
   mr   r3, rJObj
   stw  r0, xTemp(sp)
   li   r4, JAnimHeal
   lfs  f1, xTemp(sp)
   lswi r5, r8, 0xC
   # r3 = parent JObj
   # r4 = animation ID
   # r5 = JAnimlist
   # r6 = TAnimlist
   # r7 = (null)
   # f1 = 0.0

   # these are arguments for the function 8000C07C   $!_Index_HSD_JObjAddAnim
   # it applies a joint/texture animation to each joint in a familly, selected
   # from a list of pointers that describe the bases of different animation trees.

   bl _func_set_JAnim
   # this custom function pairs the 8000C07C $!_Index_HSD_JObjAddAnim call with
   # a call to 8036F8BC HSD_JObjReqAnimAll -- so that it will be animated after the loop.

   # JAnim has been set to the healing animation
   # AObjs have been applied to each joint in the skeleton
   # -- this is according to precompiled structures that exist in the IfAll.dat file
   # -- injection 8 modifies the JObjDesc and animation nodes to include a 1000s digit
   #     as a sibling to the % joint.

   _store_new_anim_ID:
   li r3, 2
   lbz r4, xHUDflags(rHUD)
   rlwimi r4, r3, 0, 0x6
   stb r4, xHUDflags(rHUD)
   # heal animation will only be initialized on the first frame
   # animation ID keeps it from initializing every frame of the animation
_end_of_heal:

_check_color_type:
# We want to be able change the color remotely, so we use
#  static pointers that can be changed and reset.
# On each use, the pointers are checked for nulls
#  so that they can be reset, if needed.

# There's a pointer for both damage and stamina colors, so
#  some checks must be done to find the appropriate pointer to load/store

lwz  r7, xColorActiveDMG(rParams)
bf+ bStamina, _check_color_pointer
   lwz r7, xColorActiveSTM(rParams)

# r7 = color list, for ilerp
# we'll be checking it for null before using it

_check_color_pointer:
cmpwi r7, 0
blt+ _fetch_color
   bf+ bStamina, _reset_damage_color
   # if color pointer is null,

     _reset_stamina_color:
     lwz r7, xColorDefaultSTM(rParams)
     stw r7, xColorActiveSTM(rParams)
     b _fetch_color

     _reset_damage_color:
     lwz r7, xColorDefaultDMG(rParams)
     stw r7, xColorActiveDMG(rParams)
     # then reset color pointer to default colors.

_fetch_color:
li  r3, 0xFFF
lhz r4, xHUDDMG(rHUD)
li  r5, 0
lhz r6, xDamageCap(rParams)
# r7 = color list

# arguments have been created for an RGBA lerp based on the current damage,
# as well as the currently selected color list.

bl _func_RGBA_ilerp
# r5 = new color to apply to MObj color structs

stw r5, xThisColor(sp)
# store color in the stack

lhz rD, xHUDDMG(rHUD)
# rD will hold the current damage as an integer
# as each digit is interpreted, the damage is divided by 10.
# The remainder will be kept in rE, for creating
# animation keyframes that update the texture.

   _first_loop:
   cmpwi rCount, 4
   crmove bSignJoint,  eq
   cmpwi rCount, 3
   crmove bFirstDigit, eq
   slwi.   rI, rCount, 2
   crmove bLastDigit,  eq
   # all common vars are set up to be used by any of the following loop routines:

   addi  rBase, rHUD, xHUDJObjs-4
   lwzx r3, rBase, rI
   bf+ bLastDigit, _check_exploding
     mr r3, rJObjex

   # r3 = THIS JObj

   _check_exploding:
   bf+ bExploding, _first_update_routine
   # if not bExploding, then proceed to normal update routine

     bf+ bExplodeStart, _bExploding_routine
     # else, if explosion already has its velocities, then animate it




       _bExplodeStart_routine:
       # the following block of code is only run during the first explosion frame:

       lbz  rC, -0x493F(r13)
       li   rD, 1
       # global variable is used to alternate Xvel directions on joint iteration
       # rD will be used to toggle it

       # load floats from params for initializing explosion animation
       bl 0x80380528
       stfs f1, xTemp(sp)
       bl 0x80380528
       lfs f2, xTemp(sp)
       ps_merge11 f1, f1, f2
       # f1 = XY Random percentages

       psq_l f2, xExplodingXpad(rParams), 0, 0
       # f2 = XY padding minimum values

       xor. rC, rC, rD
       stb  rC, -0x493F(r13)
       # toggle the global alternation bool, and update it
       # result of left/right bias will be determined by cr0

       psq_l f3, xExplodingXvelRandCap(rParams), 0, 0
       # f3 = XY velocity limit -- random will become (0.0 ... f3)

       ps_madd f0, f1, f3, f2
       # f0 XYVel = XYRand * XYLimit + XYPad

       beq _explInit_set_velocity
       # if even then use positive XVel
       # if odd  then use negative XVel

         _explInit_odd:
         ps_neg f1, f0
         ps_merge01 f0, f1, f0
         # flip XVelocity to negative if odd

       _explInit_set_velocity:
       bf+ bLastDigit, _explInit_store_HUD
       # if storing last digit joint variables,
       # then store them to HUDex instead of normal HUD

         _explInit_store_HUDex:
         psq_st f0, xHUDexXVel(rHUDex), 0, 0
         b _iter_first_loop
         # if storing to HUDex, values are simply stored as a pair.

       _explInit_store_HUD:
       ps_merge11 f1, f0, f0
       addi rBase, rHUD, xHUDXVel-4
       stfsx f0, rBase, rI
       addi  rBase, rHUD, xHUDYVel-4
       stfsx f1, rBase, rI
       b _iter_first_loop
       # if storing to HUD, values are stored to separate arrays.



     _bExploding_routine:
     # the following block of code only runs when updating the XY positions for explosion

     addi rBase, rHUD, xHUDXVel-4
     lfsx f3, rBase, rI
     addi rBase, rHUD, xHUDYVel-4
     lfsx f4, rBase, rI
     bf+ bLastDigit, _expl_apply_velocity
     # load from rHUD if normal joint

       _expl_load_HUDex:
       lfs f3, xHUDexXVel(rHUDex)
       lfs f4, xHUDexYVel(rHUDex)
       # load from HUDex if custom joint

     _expl_apply_velocity:
     lfs   f1, xJObjTransX(r3)
     lfs   f2, xJObjTransY(r3)
     lfs   f5, xExplodingGravity(rParams)
     lfs   f6, xExplodingYLimitMax(rParams)
     fneg  f7, f6
     # f1 = X
     # f2 = Y
     # f3 = X velocity
     # f4 = Y velocity
     # f5 = gravity
     # f6 = max range
     # f7 = min range

     fadds f1, f1, f3  # X += XVel
     fadds f2, f2, f4  # Y += YVel
     fsubs f4, f4, f5  # YVel -= Gravity
     # increment and decrement variables

     fcmpo cr0, f2, f6
     fcmpo cr1, f2, f7
     ble+ cr0, _expl_new_XY
       fmr f2, f6
       # cap Y Trans with max limit if necessary

     bge+ cr1, _expl_new_XY
       fmr f2, f7
       # cap Y trans with min limit if necessary

     _expl_new_XY:
     stfs f1, xJObjTransX(r3)
     stfs f2, xJObjTransY(r3)
     bf+ bLastDigit, _expl_store_HUD
     # store new X and Y translation in joint

       _expl_store_HUDex:
       stfs f3, xHUDexXVel(rHUDex)
       stfs f4, xHUDexYVel(rHUDex)
       b _expl_drtysub
       # store new X and Y Velocity in custom variables

       _expl_store_HUD:
       addi rBase, rHUD, xHUDXVel-4
       stfsx f3, rBase, rI
       addi rBase, rHUD, xHUDYVel-4
       stfsx f4, rBase, rI
       # store new X and Y Velocity in original variables

     _expl_drtysub:
     bl _func_check_DirtySub
     # this allows the changes we've made to update the JObj matrix

     b _iter_first_loop
     # branch to common iteration routine for loop




   _first_update_routine:
   # rA = Digit TAnim arg
   # rB = Sign  TAnim arg

   # This block of code only runs when updating the display, without exploding

   li rC, 10
   # constant used for division modulo operation;
   # helps us extract base-10 numbers for display

   lwz r3, xJObjDObj(r3)
   lwz r3, xDObjMObj(r3)
   lwz r4, xMObjMCol(r3)
   lwz r3, xMObjTObj(r3)
   # r3 = THIS TObj
   # r4 = THIS MObj

   _store_color:
   lwz r0, xThisColor(sp)
   stw r0, xMColAmCol(r4)
   # color has been updated

   _check_if_not_dec:
   bf+ bSignJoint, _get_decimal_number

     _sign_joint_update:
     mr r4, rB
     # if updating the sign joint,
     # then we need to use a different TAnim from the one used for digits

     li  rE, 0
     lis rF, 0x3F80
     stmw rE,xTemp(sp)  # 0x0 - 0x00000000 = 0.0
     lfs f1, xTemp(sp)  # 0x4 - 0x3F800000 = 1.0
     bf+ bStamina, _update_TAnim
       li rE, 1
       lfs f1, xTemp+4(sp)
       b _update_TAnim
       # 0 for '%' and 1 for 'HP' signs
       # the appropriate keyframe has also been loaded into f1

   _get_decimal_number:
   mr r4, rA
   # if updating a digit joint,
   # then use digit TAnim

   # rD = current remaining damage for mod(10) operation
   # rC = 10
   # rE will = remainder from next division

   li rE, 0
   cmpwi rD, 0
   beq+ _get_TAnim_keyframe
   # if rD == 0, then rE = 0
   # (to avoid dividing by 0)

     divw  rF, rD, rC  # rF = rD / 10
     mullw rE, rF, rC  # rE = rF * 10
     # integer division is exploited to create modulo from difference of rD and rE

     sub   rE, rD, rE
     # rE = remainder of division

     mr    rD, rF
     # (rD /= 10) copied from rF

   _get_TAnim_keyframe:
   # rE = decimal to convert for keyframe

   lis   r5, 0x3F04
   mfspr r6, 919
   mtspr 919, r5
   stb   rE, xTemp(sp)
   psq_l f1, xTemp(sp), 1, 7
   mtspr 919, r6
   # f1 = keyframe for TAnim update

   _update_TAnim:
   addi  rF, sp, xDecIDs
   stbx  rE, rF, rCount
   addi  rF, sp, xDecKeys
   stfsx f1, rF, rI
   # store params in stack, for debugging

   li   r0, 0
   stw  r0, xTemp(sp)
   lfs  f2, xTemp(sp)
   # r3 = TObj
   # r4 = TAnim
   # f1 = keyframe
   # f2 = duration

   bl _func_set_TAnim
   # TAnim has been updated

   slwi r0, rE, 2
   addi rF, rParams, xFontPadding
   lfsx f1, rF, r0
   addi rF, sp, xPadding
   stfsx f1, rF, rI
   # padding has been saved for second loop




   _iter_first_loop:
   # this block of code is shared by the 3 previous blocks of code:

   subic. rCount, rCount, 1
   # decrement rCount

   li r0, 0
   mtcrf 0b00001000, r0
   # clear all bits in cr4

   blt _end_of_first_loop
   # if rCount is exhausted, then terminate loop

   b _first_loop
   # else, iterate




_end_of_first_loop:
# At this point, the spaghetti is finished. I've separated the blocks of code
# using a bunch of whitespace so that they can be easily discerned from one another.

# Now all that's left to do before animating the JObjs in each joint
# is to terminate any cases of exploding joints.

bf+ bExploding, _return_if_exploding
# Exploding joints don't update their TAnims, so they're done.

   _update_exploding_flag:
   lbz r0, xHUDflags(rHUD)
   rlwinm r0, r0, 0, 0xFFFFFFBF
   stb r0, xHUDflags(rHUD)
   b _overhaul_return
   # inverted rlwinm masks out bExplodeStart bit before returning
   # this causes explosions to animate on the following frame

_return_if_exploding:
bt- bExploding, _overhaul_return
# return from function, if exploding



_not_exploding:
# from this point, only non-exploding joints are being processed.

_animate_all:
mr r3, rJObj
bl 0x80370928
# HSD_JObjAnimAll

# If doing a joint animation like the intro sweep or the heal stretch thing;
# then it will iterate through its animation with this call

# Otherwise, only the textures are updated from this call.
# -- this can be observed by the lack of updates on exploding digits.
# They keep the values they exploded with, rather than 0% on death.

_load_padding:
psq_l f1, xPadding+0(sp), 0, 0
lfs   f5, -0x7FBC(rtoc)
psq_l f2, xPadding+8(sp), 0, 0
# f1, f2 = array of floats:
#  - f1A = 1000s padding value
#  - f1B = 100s padding value
#  - f2A = 10s padding value
#  - f2B = 1s padding value
# f5 = starting point

_sum_up_padding:
ps_sum0 f5, f2, f5, f2             # f5 = 10s + 1s  , 0
ps_merge11  f6, f2, f2             # f6 = 1s        , 1s
ps_sum1 f4, f2, f5, f1             # f4 = --        , 10s + 100s
fneg    f6, f6                     # f6 = (1s, 1s)* -1
# f5 =  (10s total), (1s total)
# f6 = (sign total), (sign total)

# Negative 1s padding creates opposite direction in X translation for sign.
# - this anchors the 1s digit (as a direction in which things are padded towards)

ps_sum1 f4, f5, f4, f4             # f4 = 0           ,  10s + 100s + (10s total)
stfs    f6, xPadding+0x10(sp)
ps_sum0 f4, f1, f4, f1             # f4 = 1000s + 100s,  (100s total)
lhz r3, xHUDDMG(rHUD)
ps_sum0 f4, f4, f4, f4             # f4 =(1000s total),  (100s total)
psq_st  f5, xPadding+8(sp), 0, 0
psq_st  f4, xPadding+0(sp), 0, 0   # all totals have been stored in place of their old values

# The padding value of each digit is applied to each "side" of adjacent digits.
# - this creates a symetrical spacing for each joint.

# The totals are used to inherit the corrections made for joints inbetween it and the anchor.

# Padding values have been pre-calculated using paired singles.
# Now the post-animation loop simply needs to apply them to the appropriate MemXY vars.

lhz r4, xHUDDMGPrev(rHUD)
cmpw r3, r4
bf+ bStamina, _stamordmg_shake_comparison
  cmpw r4, r3
# checking for new shake application

_stamordmg_shake_comparison:
mfspr r3, 919
lis r4, 0x0704  # 7-bit mantissa, u8
lis r5, 0x0004  # 0-bit mantissa, u8
ori r5, r5, 0x0004
# r4, r5 carry new quantization settings for casting ints to floats
# qr7 has been backed up in r3

_setup_shake_constants:
mtspr 919, r5
# qr7 is now set to load/store bytes

psq_l f1, xHUDDMGDelta(rHUD), 1, 7
stfs  f1, xThisDelta(sp)
# cast byte and save it for later as a float in xThisDelta

_check_if_init_shake:
ble+ _end_of_scaled_HUDshake
# if damage has increased since the last frame
# then scale shake effects
# else, just check for the shakeloop flag


   _scale_shake_effects:
   mtspr 919, r4
   psq_l f1, xShakeIntensitySlider(rParams), 0, 7
   # f1[0] = intensity weight (0.0...2.0)  -- scales delta value
   # f1[1] = duration weight  (0.0...2.0)  -- scales CTR value

   mtspr 919, r5
   psq_l f2, xHUDDMGDelta(rHUD), 1, 7
   # f2[0] = xHUDDMGDelta     (0.0...255.0)
   # f2[1] = (1.0)

   lfs      f3, xShakeFrameWeight(rParams)
   ps_muls0 f0, f3, f2
   ps_muls1 f3, f0, f1
   # f3[0] = scaledFrameDuration
   # f3[1] = scaledFrameDuration

   psq_l f4, xShakeLimitMin(rParams), 0, 7
   # f4[0] = xShakeLimitMin   (0.0...255.0) -- minimum shake frames on hit
   # f4[1] = xShakeLimitMax   (0.0...255.0) -- maximum shake frames on hit


   ps_cmpo0 cr0, f3, f4
   ps_cmpo1 cr1, f3, f4

   _check_min_shake_frames:
   bge+ cr0, _check_max_shake_frames
     ps_merge00 f3, f4, f4

   _check_max_shake_frames:
   ble+ cr1, _update_scaled_HUDShake_vars
     ps_merge11 f3, f4, f4

   _update_scaled_HUDShake_vars:
   fmuls f2, f2, f1
   ps_merge01 f2, f2, f3
   psq_st f2, xHUDDMGDelta(rHUD), 0, 7

_end_of_scaled_HUDshake:
mtspr 919, r3
# qr7 is back to normal

_update_extra_joint_height:
lwz r0, xHUDMemY(rHUD)
stw r0, xHUDexMemY(rHUDex)

_save_shaking_flags:
lbz r0, xHUDShakeCTR(rHUD)
cmpwi r0, 1
crmove bShaking, gt
crmove bShakeReset, eq
# Bools are in in saved cr3

_setup_second_loop:
mr r3, rJObj
bl 0x8000B09C
stw r3, xAnimating(sp)
# store animation bool r3 in xAnimating

li rCount, 4
# second loop fixes XY position post-animation, and hides any unused digits
# the XY must be corrected for font padding and procedural shake animation

li rA, 10
# rA will be used to check thresholds for hiding digits
# each iteration beyond 10s (bFormatDigit) will multiply this value by 10

   _second_loop:
   slwi.  rI, rCount, 2
   crmove bLastDigit, eq
   cmpwi  rCount, 3
   crmove bFormatDigit, lt
   # loop bools are precalculated for each iteration

   addi rBase, rHUD, xHUDJObjs-4
   lwzx r3, rBase, rI
   bf+ bLastDigit, _check_reset_mem
     mr r3, rJObjex


   _check_reset_mem:
   mr rB, r3

   # r3, rB = THIS JObj

   lwz r0, xAnimating(sp)
   cmpwi r0, 0
   beq+ _get_FontPadding
   # if not animating

     _reset_XY_memory:
     lmw rE, xJObjTransX(r3)
     bf+ bLastDigit, _reset_XY_HUD
     # load JObj X and Y for update

       _reset_XY_HUDex:
       stmw rE, xHUDexMemX(rHUDex)
       # store updated memory in HUDex

       _correct_1000s_digit_memX:
       lfs f2, xHUDMemX+4(rHUD)
       lfs f1, xHUDMemX+0(rHUD)
       fsub f2, f1, f2
       fadds f1, f1, f2
       stfs f1, xJObjTransX(r3)
       stfs f1, xHUDexMemX(rHUDex)
       # animations have been procedurally corrected for 1000s joint

       b _get_FontPadding

       _reset_XY_HUD:
       addi rBase, rHUD, xHUDMemX-4
       stwx rE, rBase, rI
       addi rBase, rHUD, xHUDMemY-4
       stwx rF, rBase, rI
       # store updated memory in HUD

   _get_FontPadding:
   lwz   r0, xHUDDMG(rHUD)
   addi rBase, sp, xPadding
   cmpwi r0, 1000
   lfsx f2, rBase, rI
   blt _commit_to_padding
    lfs   f0, xPadX4Digit(rParams)
    fadds f2, f2, f0
    # f2 = X padding

   _commit_to_padding:
   addi rBase, rHUD, xHUDMemX-4
   lfsx f1, rBase, rI
   bf+ bLastDigit, _store_FontPadding
     lfs f1, xHUDexMemX(rHUDex)
   # f1 = X memory

   _store_FontPadding:
   fadds f1, f1, f2
   stfs  f1, xJObjTransX(r3)
   # padding has been pre-calculated, so we just add it to X mem
   # overwrites value of JObjX

   li r4, 0x10
   bf- bFormatDigit, _show_digit
     lhz r5, xHUDDMG(rHUD)
     cmpw rA, r5
     mulli rA, rA, 10
     ble- _show_digit
     # turn this into a hard branch to disable digit hiding

     # r3 = JObj
     # r4 = flags to mark as true or false

       _hide_digit:
       bl 0x80371D9C # HSD_JObjSetFlagsAll
       # set   flag 00000010 to hide joint
       b _check_if_shaking

       _show_digit:
       bl 0x80371F9C # HSD_JObjClearFlagsAll
       # clear flag 000000010 to show joint

   _shake_setup:
   addi rBase, rHUD, xHUDMemX-4
   lfsx f11, rBase, rI
   addi rBase, rHUD, xHUDMemY-4
   lfsx f12, rBase, rI
   ps_merge01 fMEMXY, f11, f12
   bf+ bLastDigit, _check_if_shaking
     psq_l fMEMXY, xHUDexMemX(rHUDex), 0, 0

   _check_if_shaking:
   bf+ bShaking, _check_if_resetting_shake
     .set fDecr,       1
     .set fUnit,       2
     .set fPad,        3
     .set fPadNeg,     4
     .set fDelta,      5
     .set fScale,      6
     .set fScaleMax,   7
     .set fXY,         8
     .set fHalf,       9
     .set fTwo,       10
     .set fMEMXY,     12

     _setup_shake_XY:
     bl 0x80380528
     stfs f1, xTemp(sp)
     bl 0x80380528
     lfs fXY, xTemp(sp)
     ps_merge11 fXY, f1, fXY
     # fXY pair holds random percentages in each single

     lfs fHalf, -0x7FA4(rtoc)
     lfs fTwo,  -0x7FB8(rtoc)
     ps_sub fXY, fXY, fHalf
     ps_mul fXY, fXY, fTwo
     # fXY pair is now random pair of -1.0...1.0

     lfs fPad, xShakingPad(rParams)
     fneg fPadNeg, fPad
     ps_sel fPad, fXY, fPad, fPadNeg
     # fPad pair now shares signs with fXY pair

     mfspr r0, 919
     lis   r3, 0x0004
     mtspr 919, r3
     psq_l fDelta, xHUDDMGDelta(rHUD), 1, 7
     mtspr 919, r0
     # fDelta = casted byte

     lfs fUnit, xShakingDamageRatio(rParams)
     lfs fScaleMax, xShakingDistanceMax(rParams)
     fmuls fScale, fDelta, fUnit
     # fScale = scaled delta

     _check_min_shake_scale:
     fcmpo cr0, fScale, fUnit
     bge+ _check_max_shake_scale
       fmr fScale, fUnit
       # cap minimum with unit value

     _check_max_shake_scale:
     fcmpo cr0, fScale, fScaleMax
     ble+ _scale_and_pad_shake
       fmr fScale, fScaleMax
       # cap maximum with max value

     _scale_and_pad_shake:
     ps_madd fXY, fXY, fScale, fPad
     # fXY = random * scaled_delta + minimum_padding

     _calculate_shake:
     ps_add fMEMXY, fXY, fMEMXY

     _decrement_shake_ctr:
     bf+ bLastDigit, _store_shake
     lbz r3, xHUDShakeCTR(rHUD)
     subi r3, r3, 1
     stb r3, xHUDShakeCTR(rHUD)
     b _store_shake

     _check_if_resetting_shake:
     bf+ bShakeReset, _update_joint_drtysub
       bf+ bLastDigit, _store_shake
         li r0, 0
         stb r0, xHUDShakeCTR(rHUD)

       _store_shake:
       psq_st fMEMXY, 0x38(rB), 0, 0
       # store in JObj


   _update_joint_drtysub:
   mr r3, rB
   bl _func_check_DirtySub
   # all procedural animations should now be applied correctly
   # - without this call, all of our post-animation modifications would likely be discarded

   _iter_second_loop:
   subic. rCount, rCount, 1
   li r0, 0
   mtcrf 0b00001000, r0
   bge+ _second_loop
   # clear flags in cr4, and iterate if rCount >= 1

_scale_parent_joint:
lfs f1, xScaleXYBase(rParams)
psq_l f2, xScaleX4Digit(rParams), 0, 0
# f1 = X, Y base scale
# f2[0] = X scale modifier for 4 digit displays
# f2[1] = X scale modifier for 5+ player HUDs

fmr f3, f1
# f3 = value used for X scale write

lhz r0, xHUDDMG(rHUD)
cmpwi r0, 1000
blt+ _check_if_5player
   ps_muls0 f3, f3, f2
   # apply 4 digit width modifier if over 1000 damage

_check_if_5player:
lbz r0, -0x4940(r13)
cmpwi r0, 4
ble+ _write_parent_scale
   ps_muls1 f3, f3, f2
   # apply 5+ player width modifier if there are more than 4 HUDs

_write_parent_scale:
stfs f3, xJObjScaleX(rJObj)
stfs f1, xJObjScaleY(rJObj)
# new scale has been written

_final_drtysub:
mr r3, rJObj
bl _func_check_DirtySub
# HUD is updated

_abort_func:

_overhaul_return:
lwz  r4, xCR(sp)
lmw  r16, xStoreGPRs(sp)
addi sp, sp, stacksize
lwz  r0, 0x4(sp)
mtcr r4
mtlr r0
blr









_default_color_data_damage:
  # 802F5218

  # these color scales will be used as defaults
  # the color may be changed procedurally from the pointers in the HUD parameters;
  # or by modifying the defaults from here.
.long 0,   0xffffffFF
.long 300, 0x500000FF, 0 # end

_default_color_data_stamina:
  # 802F522C
.long 0,   0x500000FF
.long 100, 0xffffffFF, 0 # end











_custom_color_gradients:
  # 802F5240
  # lightyellow->dark burgundy analogous, tint->tone->shade
.long   0,  0xFFFFFFFF
.long  40,  0xFFFFE0FF
.long  80,  0xFFCC91FF
.long 120,  0xFA926CFF
.long 160,  0xDE5F5CFF
.long 200,  0xB63249FF
.long 240,  0x850F2CFF
.long 280,  0x500000FF
.long 0

_end_of_overwrite:
.zero 0x1220-(_end_of_overwrite-_beginning_of_overwrite)-(_end_of_HParams-_example_gradients)
  # zeros will make this overwrite a predictable length of 0x1220, regardless of contents
  # the following parameters will be pushed to the end of this 0x1220 byte region

_example_gradients:

_ex_00:
  # 802F569C
  # white->red monochrome, with tint->tone->shade
  # classic colors, but with a bit more emphasis on the red
.long 0,    0xFFFFFFFF
.long 100,  0xFF9078FF
.long 200,  0xCB0518FF
.long 300,  0x500000FF
.long 0

  _ex_01:
  # 802F56C0
  # lightyellow->red analogous,  tint->tone
.long   0,  0xFFFFFFFF
.long  30,  0xFFFFE0FF
.long  90,  0xFFC94EFF
.long 150,  0xFF8808FF
.long 210,  0xFF0000FF
.long 0

  _ex_02:
  # 802F56EC
  # lightcyan->orange complementary,  tint->tone
.long  30,  0xE8FFFFFF
.long  90,  0xF8B685FF
.long 150,  0xE36D28FF
.long 210,  0xC00000FF
.long 0

  _ex_03:
  # 802F5710
  # lightyellow->dark burgundy analogous, tint->tone->shade
.long   0,  0xFFFFFFFF
.long  40,  0xFFFFE0FF
.long  80,  0xFFCC91FF
.long 120,  0xFA926CFF
.long 160,  0xDE5F5CFF
.long 200,  0xB63249FF
.long 240,  0x850F2CFF
.long 280,  0x500000FF
.long 0

  _ex_04:
  # 802F5754
  # pink->salmon->indigo analogous, tint->tone->shade
.long  30, 0xFDE0DDFF
.long  70, 0xFFAB9CFF
.long 110, 0xFA726FFF
.long 150, 0xDA3F61FF
.long 190, 0xA91762FF
.long 230, 0x6D0260FF
.long 270, 0x300050FF
.long 0

  _ex_05:
  # 802F5790
  # yellowgreen->jade->darkblue analogous, tint->tone->shade
.long  10, 0xF2FFE2FF
.long  50, 0xA5DBBAFF
.long  90, 0x69AFB7FF
.long 130, 0x4C80A7FF
.long 250, 0x000050FF
.long 0

  _ex_06:
  # 802F57BC
  # yellow->orange->red->purple->darkred analogous, tint->tone->shade
.long   0, 0xFFFFF0FF
.long  60, 0xFFC65EFF
.long 120, 0xFF8521FF
.long 180, 0xFF0000FF
.long 240, 0xBE0042FF
.long 300, 0x810040FF
.long 360, 0x500000FF
.long 0

  _ex_07:
  # 802F57F8
  # higher contrast variation of the above; complementary
.long   0,    0xFFFFF0FF
.long  60,    0xFFC961FF
.long 120,    0xFF871CFF
.long 180,    0xFF0000FF
.long 240,    0xB00048FF
.long 300,    0x5F0060FF
.long 360,    0x000050FF
.long 0

  _ex_08:
  # 802F5834
  # lightyellow->green->teal analogous, tint->tone->shade
.long  10,    0xFFFFE0FF
.long  50,    0xFAE983FF
.long  90,    0xD9D844FF
.long 130,    0x9ACD32FF
.long 170,    0x39A844FF
.long 210,    0x217A4DFF
.long 250,    0x005050FF
.long 0

  _ex_09:
  # 802F5870
  # jade->teal variation of the above
.long   0,    0xFFFFE0FF
.long  50,    0xC3DF93FF
.long 100,    0x83BC7AFF
.long 150,    0x009999FF
.long 200,    0x0B8080FF
.long 250,    0x0F6767FF
.long 300,    0x105050FF
.long 0

  _ex_0A:
  # 802F58AC
  # lavender->red analogous, tint->tone->shade
.long   0,    0xE6E6FAFF
.long  60,    0xE0AEDDFF
.long 120,    0xD973B5FF
.long 180,    0xDC143CFF
.long 240,    0xAB0B29FF
.long 300,    0x7C0417FF
.long 360,    0x500000FF
.long 0

  _ex_0B:
  # 802F58E8
  # cyan->red complementary, tint->tone
.long   0,    0xE8FFFFFF
.long  25,    0xD0E9F9FF
.long  50,    0xCDCDF2FF
.long  75,    0xD9ABE6FF
.long 100,    0xEC82CCFF
.long 125,    0xFF4D99FF
.long 300,    0xFF0000FF
.long 0

  _ex_0C:
  # 802F5924
  # cyan->darkblue analogous, tint->tone->shade
.long   0, 0xE8FFFFFF
.long  60, 0x57BCBBFF
.long 120, 0x007080FF
.long 180, 0x173968FF
.long 360, 0x000050FF
.long 0









_HParams:
# USER PARAMETERS

_HParams_damage:
  # 802F5950
.short 9999 # Damage Capacity (must be <= 9999)
.short 150  # Starting HP in Stamina mode

_HParams_shake:
  # 802F5954
.byte  0x80 # Shake Intensity Slider (0...256 == 0.0...2.0)
.byte  0x80 # Shake Duration  Slider (0...256 == 0.0...2.0)

.byte  10, 10 # Shake Duration Range (in frames, must be between 0 and 255)
.float 0.666  # Shake Frames per Damage Point (capped by range)

_HParams_scale:
  # 802F595C
.float 1.00 # Default XY scale
.float 0.78 # X-Width % for 4 digit number
.float 0.65 # X-Width % for 5+ player HUD width
.float 1.50 # X-Padding for 4 digit number

_HParams_active_colors:
  # 802F596C
  # if either of these pointers are null, they will default to HUDmod colors
  # - this allows them to be changed to new colors, and then easily reverted
.long self+_custom_color_gradients # default is set to custom color setup
.long 0 # 0 = _default_color_data_stamina

_HParams_default_colors:
  # 802F5974
.long self+_default_color_data_damage # pointers are used to
.long self+_default_color_data_stamina # memorize defaults

_HParams_death_anim:
  # 802F597C
  # these will be used to calculate the XY translation for
  # the procedural death animation handle.
.float 0.6083 # Random X-Velocity Limit
.float 0.8110 # Random Y-Velocity Limit
.float 0.3041 # X-Velocity pad
.float 1.2165 # Y-Velocity pad
.float 100.0  # Y-Translation Range
.float 0.2028 # Gravity

_HParams_shake_anim:
  # 802F5994
  # these will be used to calculate the XY translation for
  # the procedural shake animation handle
.float 0.1014 # Damage Weight (distance per damage)
.float 1.5207 # Shake Maximum Distance
.float 0.2028 # Shake Distance Padding

_HParams_font_spacing:
  # 802F59A0
  # default spacing only applies to the '1' number with 0.5069,
  # describing how much the width of the number must be shortened.

  # if using a custom font, these may be altered accordingly.
  # negative numbers may be used.
.float 0.0000 # 0
.float 0.5069 # 1
.float 0.0000 # 2
.float 0.0000 # 3
.float 0.0000 # 4
.float 0.0000 # 5
.float 0.0000 # 6
.float 0.0000 # 7
.float 0.0000 # 8
.float 0.0000 # 9







_HUDex:
  # 802F59C8
  # these are global allocations for variables that
  # memorize the current XY position and velocity
  # of the 4th digit in each player slot.
.long 0,0,0,0 # p1
.long 0,0,0,0 # p2
.long 0,0,0,0 # p3
.long 0,0,0,0 # p4
.long 0,0,0,0 # p5
.long 0,0,0,0 # p6







_fake_JObjDesc:
  # 802F5A28
  # fake JObjDesc for the 4th digit to be instantiated from
.long 0x00000000, 0x00080000, 0x00000000, 0x00000000
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
.long 0x3F800000, 0x3F800000, 0x3F800000, 0xC12FAE19
.long 0xC1081547, 0x00000000, 0x00000000, 0x00000000

_fake_JAnimIntro:
  # 802F5A68
  # animation node for joint animation 0 -- intro pan-in from the bottom
.long 0, 0, 0

_fake_JAnimHeal:
  # 802F5A74
  # animation node for joint animation 1 -- used for healing
.long 0, 0, 0, 0, 0

_toc:
  # 802F5A88
.long self+_INJ0
.long self+_INJ1
.long self+_INJ2
.long self+_INJ3
.long self+_INJ4
.long self+_INJ5
.long self+_INJ6
.long self+_INJ7
.long self+_INJ8
.long self+_func_set_TAnim
.long self+_func_set_JAnim
.long self+_func_check_DirtySub
.long self+_func_RGBA_ilerp
.long self+_func_RGBA_lerp_U32range
.long self+_func_RGBA_lerp
.long self+_update_overhaul
.long self+_default_color_data_damage
.long self+_default_color_data_stamina
.long self+_custom_color_gradients
.long self+_ex_00
.long self+_ex_01
.long self+_ex_02
.long self+_ex_03
.long self+_ex_04
.long self+_ex_05
.long self+_ex_06
.long self+_ex_07
.long self+_ex_08
.long self+_ex_09
.long self+_ex_0A
.long self+_ex_0B
.long self+_ex_0C
.long self+_HParams_damage
.long self+_HParams_shake
.long self+_HParams_scale
.long self+_HParams_active_colors
.long self+_HParams_default_colors
.long self+_HParams_death_anim
.long self+_HParams_shake_anim
.long self+_HParams_font_spacing
.long self+_HUDex
.long self+_fake_JObjDesc
.long self+_fake_JAnimIntro
.long self+_fake_JAnimHeal
.long self+_toc

# 802F491C = _INJ0
# 802F4930 = _INJ1
# 802F4944 = _INJ2
# 802F496C = _INJ3
# 802F4998 = _INJ4
# 802F49AC = _INJ5
# 802F49C0 = _INJ6
# 802F49F0 = _INJ7
# 802F4A00 = _INJ8
# 802F4A4C = _func_set_TAnim
# 802F4A98 = _func_set_JAnim
# 802F4ACC = _func_check_DirtySub
# 802F4AEC = _func_RGBA_ilerp
# 802F4B6C = _func_RGBA_lerp_U32range
# 802F4BAC = _func_RGBA_lerp
# 802F4C04 = _update_overhaul
# 802F5218 = _default_color_data_damage
# 802F522C = _default_color_data_stamina
# 802F5240 = _custom_color_gradients
# 802F569C = _ex_00
# 802F56C0 = _ex_01
# 802F56EC = _ex_02
# 802F5710 = _ex_03
# 802F5754 = _ex_04
# 802F5790 = _ex_05
# 802F57BC = _ex_06
# 802F57F8 = _ex_07
# 802F5834 = _ex_08
# 802F5870 = _ex_09
# 802F58AC = _ex_0A
# 802F58E8 = _ex_0B
# 802F5924 = _ex_0C
# 802F5950 = _HParams_damage
# 802F5954 = _HParams_shake
# 802F595C = _HParams_scale
# 802F596C = _HParams_active_colors
# 802F5974 = _HParams_default_colors
# 802F597C = _HParams_death_anim
# 802F5994 = _HParams_shake_anim
# 802F59A0 = _HParams_font_spacing
# 802F59C8 = _HUDex
# 802F5A28 = _fake_JObjDesc
# 802F5A68 = _fake_JAnimIntro
# 802F5A74 = _fake_JAnimHeal
# 802F5A88 = _toc

_end_of_HParams:

------------- 0x802F5C10 ---- 2C0003E7 -> b 0x802F491C
------------- 0x802F5C18 ---- 380003E7 -> 7D806378
------------- 0x802F5D18 ---- 2C0003E7 -> b 0x802F4930
------------- 0x802F5D20 ---- 380003E7 -> 7D806378
------------- 0x8006CD3C ---- C00288B0 -> b 0x802F4944
  # set cap according to damage max
------------- 0x801896FC ---- 380003E7 -> b 0x802F496C
  # fixes cap when decrementing below 0 in training mode
------------- 0x80189734 ---- 280303E7 -> b 0x802F4998
  # compares against damage cap instead of 999 in training mode
------------- 0x80189754 ---- 280003E7 -> b 0x802F49AC
  # compares against damage cap instead of 999 in training mode
------------- 0x801896C8 ---- 41820034 -> 60000000
------------- 0x801896CC ---- 3803FFFF -> b 0x802F49C0
  # allows holding L/R while decrementing skip to 0 in training mode
------------- 0x801B93C0 ---- 38000096 -> b 0x802F49F0
  # set stamina mode starting HP
------------- 0x802F6770 ---- 80010024 -> b 0x802F4A00
  # HUD INIT: the stack is collapsing for end of init function
------------- 0x802F6178 ---- 4BFFED65 -> bl 0x802F4C04
  # HUD UPDATE: main overhaul code, as a function call


20XXHP 4.07++ DOL - download DOL with code pre-installed

You may also use the following guide to install on your own 20XX DOL:
NOTE - following these steps is not necessary if you are installing to a regular DOL that only has codes installed through the MCM mods library. These are precautionary steps that just guarantee you won’t mess with any of the code regions on the DOL you are modifying.

Step 1 - Get MCM
Download the latest version Melee Code Manager, if you haven’t already.

Step 2 - Open Mods Library
Open it up and click the “Open Mods Library Folder” button to access your mods library.



Step 3 - Create a new text file
Create a new text file and paste the code in it.

Step 4 - Rename it
Rename the text file to something with “+” as the first character.

This step is important, because it will tell MCM to look at ONLY this file -- preventing any conflicts with other mods in your library that might exist on the ISO. This includes some default codes included with MCM.



Step 5 - Rescan your Mods Library
Rescan your mods library, and only the Damage HUD Overhaul mod should appear

Step 6 - Turn off all memory regions
Click the Code-Space Options button to toggle memory regions. Make sure each region is unchecked, and that there are 0 Bytes displayed at the bottom.

This will make sure that MCM does not overwrite any regions that 20XX is currently using; installing only the overwrite that we’ve prioritized in the mods library.



Step 7 - Install
First back up your 20XX ISO or DOL, and load it up in MCM. Install the overwrite code.

If you followed all of the steps, then no memory regions will be altered besides the overwrite code. Only the overwrite code is seen by MCM, so other codes that might be recognized in the DOL are ignored.

Step 8 - Revert settings
When you’re done installing to the ISO, go back to your Mods Library folder and rename the text file to delete the “+” prefix. You can also give it a “!” prefix to hide it. Hit the rescan button, and MCM will see your other mods again.

Also remember to go back to the Code-Space Options and re-enable your memory regions. You won’t be able to install most codes without them enabled.


See here for info about how to access user parameters, for customization:
To modify any of the following parameters, simply click the edit button in the code description and select the second overwrite mod that appears in the NTSC 1.02 tab.



The Static Overwrite you're looking for is 0x1220 bytes large.
When you have the text open, scroll down until you see the comment # USER PARAMETERS.



You may optionally install the ASM source version of the code as though it were a normal DOL mod. This has the benefit of being able to declare values in decimal or floating point formats without having to use hexadecimal; as seen on the right, above.

---

If you are using a modified 20XX DOL, you may also modify these parameters with a hex editor. See the final spoiler below for a list of RAM addresses that can be converted using MCM’s RAM Address Conversion tool.

For quick reference, the following start.dol offsets may be found in a hex editor:

0x2F1E20 = beginning of custom color gradient region
0x2F2530 = beginning of # USER PARAMETERS region

0x2F254C = active damage color gradient pointer
0x2F2550 = active stamina color gradient pointer

0x2F2554 = default damage color gradient pointer
0x2F2558 = default stamina color gradient pointer



Damage Limit:
  • Damage limit can now be set to any number between 0% and 9999%
    • A new joint object is generated to display the 1000s digit
    • Default damage limit is set to 9999%
  • Starting HP in Stamina Mode can now be set to any number between 1HP and 9999HP
    • Default HP limit remains at 150HP (same as vanilla)
  • Training Mode pause menu damage settings adopt user-specified damage limit
    • Holding L while lowering the damage number will reset damage to 0


Any damage gained that exceeds the given damage limit will become equal to the damage limit.

The variables responsible for remembering damage are 16-bit integers, and can not exceed a value of 0xFFFF. Currently, only 4 decimal digits are available for display; limiting the displayable maximum to 9999%. The actual value may be set higher, but the 5th digit will not be displayed.

The damage parameters are the very first definitions in the user parameters:



---

Note that in training mode, the displayable maximum damage setting in the pause menu is limited to displaying only 3 decimal digits, but it is possible to use this to select a value beyond 999%. For example, the value 9999 appears as "/99"



To make it easier to reset the damage, hold the L button while decreasing the value for a moment and the value will jump back to 0%.



Damage Colors:
  • Create custom color gradients for damage % and stamina HP
    • Change the color keys of the classic damage colors to any RGBA colors
    • Change the damage thresholds for each key
    • Map an unlimited number of color keys to create complex color gradients

The game normally specifies the damage/color relationship as an interpolation between 0 and 300 for scaling the color WHITE to DARKRED.

With these settings, you can redefine this relationship using however many colors you want.

The code uses a set of included functions that take advantage of the graphical quantization registers to quickly perform RGBA color interpolations. They use the following format to describe keyed colors as a null-terminated array, using ordered 32-bit UINTS for the key values:

Code:
#--Key----Color--
00000000 FFFFFFFF  #   0, white
0000012C 500000FF  # 300, darkred
00000000

For each keyed color; the first value, Key is used to specify a damage value to assign the color to. The second value, Color is an RGBA hex color.

Any number of keyed colors may be specified so long as the list is ordered from lowest key to highest. The first key value found out of order will serve as a terminator, so you may terminate a list by using “0” or any value smaller than the previous key.

---

The game uses an “active color gradient” variable to select a color gradient structure by pointing to it in RAM:



The default address is set to the “custom gradient” allocation, which is just a space within the code that can be used to write new gradient structures and include them in Melee. It has a generous amount of free space available, so you can create many gradients with this region:



If you are using a DOL with this code pre-installed, and want to modify the DOL with a hex editor to change the active colors used; you may access this region at offset 0x2F254C of start.dol.


NOTE: when modifying the custom gradient region, zero out any bytes you don’t need instead of deleting them. This will create a null terminator, plus some padding. Also, if you need more lines; move them over from the “additional space” region instead of adding them yourself.

Following these steps will keep the overwrite size at 0x1220 bytes:



---

Included with the code are 13 custom gradients that can be assigned by writing one of the following addresses to the active color gradient pointer variable:
Code:
# 802F569C = _ex_00
# white->red monochrome, with tint->tone->shade
# classic colors, but with a bit more emphasis on the red

# 802F56C0 = _ex_01
# lightyellow->red analogous,  tint->tone

# 802F56EC = _ex_02
# lightcyan->orange complementary,  tint->tone

# 802F5710 = _ex_03
# lightyellow->dark burgundy analogous, tint->tone->shade

# 802F5754 = _ex_04
# pink->salmon->indigo analogous, tint->tone->shade

# 802F5790 = _ex_05
# yellowgreen->jade->darkblue analogous, tint->tone->shade

# 802F57BC = _ex_06
# yellow->orange->red->purple->darkred analogous, tint->tone->shade

# 802F57F8 = _ex_07
# higher contrast variation of the above; complementary

# 802F5834 = _ex_08
# lightyellow->green->teal analogous, tint->tone->shade

# 802F5870 = _ex_09
# jade->teal variation of the above

# 802F58AC = _ex_0A
# lavender->red analogous, tint->tone->shade

# 802F58E8 = _ex_0B
# cyan->red complementary, tint->tone

# 802F5924 = _ex_0C
# cyan->darkblue analogous, tint->tone->shade

If the active color gradient is null or invalid, then a fallback “default color gradient” is used to display default colors. These can be modified like the active color gradient, but point to the classic color schemes by default.

Separate pointer variables are kept for damage and stamina colors. A null is placed in the active stamina color by default, causing it to display the vanilla color scheme.

Future versions of this code may extend this active color pointer system to include individual pointers for each controller port, or team color. For now though, only one active color acts globally on all damage displays.



Damage Shake Animation:
  • Procedural shake animation has been broken into modifiable parameters:
    • Damage weight - the amount of influence each point of damage has on shake strength
    • Maximum shake - the limit that the Damage/Shake ratio can be scaled to
    • Shake padding - the minimum amount of shake that is always applied regardless of strength
  • Additional shake modifiers have been added as new features:
    • Shake duration range - set a min/max frame count for shake animation
    • Damage duration weight - frames per point of damage (capped by range)
    • Shake duration slider - scale the applied duration weight between 0.0...2.0
    • Shake intensity slider - scale the applied damage weight between 0.0...2.0

The shake animation is normally a simple random value applied as an offset of a memorized XY position for each digit each frame of shaking. The distance traveled each frame is determined by a decrementing counter that is initialized by the value of the most recent amount of damage taken.

This code extends the calculation to support more control over scaling the duration of the shake, which by default is always 10 frames. With the new variables, it is possible to change the duration to a shorter value for easier readability, or give it a range in which it may be scaled by the damage causing it.

The following variables may be modified to change the behavior of the shake animation:




By setting the duration and intensity “sliders” after modifying the other variables, you can fine-tune the resulting shake animation via weights that use integers to increment in linear quantized steps. This may also be used to design an in-game mechanic that scales the given parent values like an option.



Death Explosion Animation:
  • Procedural explosion animation (for damage HUD digits, not the player) has been broken into modifiable parameters:
    • XY Velocity is constructed from 2 pairs of variables that add a pseudo-random number to a padding number for X and Y.
    • When applied, velocity causes digits to behave like a simple 2D particle system, with “gravity” applied each frame.

The death animation uses random numbers with variables to create a pseudo-random direction for a digit to be flung, with applied “gravity”.

When calculating the applied velocity of each digit, a weighted/capped Random variable is added to a Padding constant.

For the X axis, a positive value goes right and a negative goes left. The game negates the generated X velocity on every odd digit, causing the directions to be alternate left and right. By using a negative padding value with a positive random value, you can turn this into a scalable bias rather than an enforced alternation.

The following variables can be modified to change P and R for X and Y, as well as the gravity applied to Y each frame:



The “Y Translation Range” variable is a limit on the distance that a digit is allowed to travel up or down. By default, the value is set to be off-screen. Currently, the digits do not bounce when hitting this limit, but that may change in future versions.



Basic Font Kerning:
  • Space between each digit can be modified to support new font styles.
    • “Basic” kerning describes the symmetrical bounds of individual characters, rather than character pairs. This only works for centered character textures.
    • Custom font textures can use these parameters to fine-tune the padding of each numeric character.
    • The default settings only modify the “1” number, as per the original game function.
      • 0 and 2...9 are all treated as monospace characters in default font style
The basic kerning variables can be used to apply a subtractive padding to each side of a numeric character, to account for differences in character width from a custom font style.

The implied tracking value has characters printed 3.15 units apart. By default, the only character that uses a kerning adjustment in the vanilla game font is the “1” character; which subtracts the value 0.5069 from this default 3.15 tracking. The result is roughly 5 pixels worth of space on both sides of the 1 character being ignored when placing adjacent characters.

The kerning value is always relative to the tracking value 3.15, so keep that in mind when using textures with a higher resolution than 32 pixels wide.

The default values are listed in a short array towards the end of the user parameters:



By setting all of these to the same value, you can create a monospace font spacing. You can also use negative values to add on artificial padding that extends beyond the texture plane, if desired.

In future versions of this code, more options may become available for modifying scale and positioning for each character.



Other Settings:
  • Color pointers can be overwritten procedurally by other codes
    • Custom color gradients are pointed to by an “active color” variable.
    • If “active color” is null, then a fallback “default color” is used.
  • General XY Scale - change the size of the whole display (1.0 by default)
    • 6-player width modifier - X scale modifier for shrinking the width during 5+ HUDs
      • The game normally uses 0.65, which is the default
    • 4-digit width modifier - X scale modifier during displays >= 1000
      • 0.78 by default
    • 4-digit width padding - X translation applied to a 4 digit number
      • 1.5 by default
The end of the overwrite contains a table of contents that points to each labeled section in the ASM source. This includes the static data tables used to store user parameters:
Code:
# 802F491C = _INJ0
# 802F4930 = _INJ1
# 802F4944 = _INJ2
# 802F496C = _INJ3
# 802F4998 = _INJ4
# 802F49AC = _INJ5
# 802F49C0 = _INJ6
# 802F49F0 = _INJ7
# 802F4A00 = _INJ8
# 802F4A4C = _func_set_TAnim
# 802F4A98 = _func_set_JAnim
# 802F4ACC = _func_check_DirtySub
# 802F4AEC = _func_RGBA_ilerp
# 802F4B6C = _func_RGBA_lerp_U32range
# 802F4BAC = _func_RGBA_lerp
# 802F4C04 = _update_overhaul
# 802F5218 = _default_color_data_damage
# 802F522C = _default_color_data_stamina
# 802F5240 = _custom_color_gradients
# 802F569C = _ex_00
# 802F56C0 = _ex_01
# 802F56EC = _ex_02
# 802F5710 = _ex_03
# 802F5754 = _ex_04
# 802F5790 = _ex_05
# 802F57BC = _ex_06
# 802F57F8 = _ex_07
# 802F5834 = _ex_08
# 802F5870 = _ex_09
# 802F58AC = _ex_0A
# 802F58E8 = _ex_0B
# 802F5924 = _ex_0C
# 802F5950 = _HParams_damage
# 802F5954 = _HParams_shake
# 802F595C = _HParams_scale
# 802F596C = _HParams_active_colors
# 802F5974 = _HParams_default_colors
# 802F597C = _HParams_death_anim
# 802F5994 = _HParams_shake_anim
# 802F59A0 = _HParams_font_spacing
# 802F59C8 = _HUDex
# 802F5A28 = _fake_JObjDesc
# 802F5A68 = _fake_JAnimIntro
# 802F5A74 = _fake_JAnimHeal
# 802F5A88 = _toc


---

Feel free to ask questions, make suggestions, report bugs, or leave any other kind of feedback.
 
Last edited:

DRGN

Technowizard
Moderator
Joined
Aug 20, 2005
Messages
2,178
Location
Sacramento, CA
Wow. Awesome and well-executed overhaul!

Really cool to see all of those customization options, too.
 
Last edited:

UnclePunch

Smash Ace
Joined
Nov 9, 2014
Messages
673
the amount of polish you put on your codes is incredible...

goes without saying but amazing job!
 
Last edited:

JoshuaMK

Smash Apprentice
Joined
May 19, 2019
Messages
75
This seems so awesome!... But I don't even know where to start with installing this... I know I need MCM, and from what I can tell I'm supposed to use Static Overwrites, but how do I even put this in? How do I know when to start the next Overwrite? Sorry for being noobish, I just really get lost in code that is this long. If you could walk me through it that would be amazing!

EDIT: Nvm I figured it out :D
 
Last edited:

JoshuaMK

Smash Apprentice
Joined
May 19, 2019
Messages
75
Just a heads up, this code doesn't seem to work on a real Wii. Only on Dolphin :p If you could fix this somehow that would be cool.
 

PrimeMagicMaker7

Smash Rookie
Joined
Aug 31, 2021
Messages
3
The damage Hud is a great mod my question is. When i go to debug menu in 20xx melee game in dolphin emulator its freezes the game.
When i tried add 6 players in smash melee any video tutorial how no get debug menu not crash?
 

Punkline

Dr. Frankenstack
Joined
May 15, 2015
Messages
423
The damage Hud is a great mod my question is. When i go to debug menu in 20xx melee game in dolphin emulator its freezes the game.
When i tried add 6 players in smash melee any video tutorial how no get debug menu not crash?
It sounds like you still have code-space regions enabled in MCM when trying to install it.

At this time, the code regions in MCM will overwrite parts of 20XX because 20XX uses up the space. Installing to 20XX with certain code regions (like the debug menu) will cause crashes.

To make sure this doesn't happen, you have to use MCM on a fresh 20XX DOL, and ensure you have no checkboxes checked in the code regions menu, like in step 6 (if you're using MCM):


NOTE - following these steps is not necessary if you are installing to a regular DOL that only has codes installed through the MCM mods library. These are precautionary steps that just guarantee you won’t mess with any of the code regions on the DOL you are modifying.

Step 1 - Get MCM
Download the latest version Melee Code Manager, if you haven’t already.

Step 2 - Open Mods Library
Open it up and click the “Open Mods Library Folder” button to access your mods library.


Step 3 - Create a new text file
Create a new text file and paste the code in it.

Step 4 - Rename it
Rename the text file to something with “+” as the first character.

This step is important, because it will tell MCM to look at ONLY this file -- preventing any conflicts with other mods in your library that might exist on the ISO. This includes some default codes included with MCM.


Step 5 - Rescan your Mods Library
Rescan your mods library, and only the Damage HUD Overhaul mod should appear

Step 6 - Turn off all memory regions
Click the Code-Space Options button to toggle memory regions. Make sure each region is unchecked, and that there are 0 Bytes displayed at the bottom.

This will make sure that MCM does not overwrite any regions that 20XX is currently using; installing only the overwrite that we’ve prioritized in the mods library.


Step 7 - Install
First back up your 20XX ISO or DOL, and load it up in MCM. Install the overwrite code.

If you followed all of the steps, then no memory regions will be altered besides the overwrite code. Only the overwrite code is seen by MCM, so other codes that might be recognized in the DOL are ignored.

Step 8 - Revert settings
When you’re done installing to the ISO, go back to your Mods Library folder and rename the text file to delete the “+” prefix. You can also give it a “!” prefix to hide it. Hit the rescan button, and MCM will see your other mods again.

Also remember to go back to the Code-Space Options and re-enable your memory regions. You won’t be able to install most codes without them enabled.

---

Alternatively, you may overwrite the DOL on your 20XX disk with the one provided in the link:

20XXHP 4.07++ DOL - download DOL with code pre-installed
-- if you want to avoid complications with code-space regions, you can probably use a program like DTW to do this file overwrite, instead.
 

Punkline

Dr. Frankenstack
Joined
May 15, 2015
Messages
423
Which file do I overwrite in 20XX DTW to do this file overwrite, instead.

Right-click on Start.dol from the System files folder:



-- the option Import File will let you select the DOL file you downloaded with the code pre-installed.


Make sure you save your changes to the disk with ctrl+s or from the file menu:




-- when saved, the replaced file will look like this:

 

NinTOONdo

Smash Rookie
Premium
Joined
Apr 9, 2017
Messages
18
I really wish that I could get a simple Gecko Code that I could copy+paste in order to automatically increase the damage-limit from 999% to 9999%, but all these codings that are split apart seem so complex that I can't even remotely put them together completely! If someone knows the right value, err I mean, exact coding to copy+paste for my Dolphin Emulator on Melee, I really would appreciate it! Thanks? :(

EDIT: Never mind, I already finally figured out how simple the Melee Code Manager was supposed to be like in the first place, so my apologies for any inconvenience.
 
Last edited:
Top Bottom