Show Kart Status Effects on Minimap v2 [Ro]
#1
Show Kart Status Effects on Minimap v2 [Ro]

This code will show kart status effects on minimap like the recent Mario Kart titles. This version of the code is a big improvement from v1, thus why I reuploaded it as v2.
  • The character icon dynamically scales in real time according to the kart’s size. For example, using a Mega causes the icon to grow, while shrinking from Mega causes the icon to shrink. These same rules apply to any effect that changes kart size, such as shock, squish, or Battle vanish shrink
  • When the player is in a Bullet, the character icon is outlined in black. While in a Star, the outline matches the kart’s star color, providing a clear visual indicator of the star’s remaining duration. Due to how I change the outline color, your outline (and only yours) will appear ice-colored when frozen by the N64 Sherbet Land ice cube - a nice detail that I’ve kept
  • If the player is inked, the character icon turns completely black. When invisible (blink) in Battle mode, the icon becomes fully invisible
  • Fixed an issue where your status effect would be applied to other players sometimes
  • Searchlight size is now affected

NTSC-U
C27E2120 00000035
3D80809C 818CD110
818C0020 897C01B4
1D6B0004 7D8C582E
80CC0000 80860058
81660028 80A60004
48000011 3F4CCCCD
3F99999A 3E4CCCCD
7D0802A6 835C01C4
813C01C0 815C01B8
83BC01BC C00A0044
C0280008 C0490044
C06B0164 C0AB0168
C0C90048 C0EA0048
C0880004 FC032040
40810008 FC602090
EC84082A FC052040
40810008 ECA40828
80E5000C 74E0000C
40820044 C0880000
FC032040 40800008
FC602090 FC052040
4080002C 74E00001
41820008 EC840828
3C000001 60000080
7CEB0038 7C0B0000
40820008 EC840828
FCA02090 74E01000
41820008 EC000028
89840012 2C0C0000
40820018 EC000028
FC400090 FCC00090
FCE00090 48000014
EC4200F2 EC0000F2
ECC60172 ECE70172
D00A0044 D05D0044
D0490044 D05A0044
D0EA0048 D0FD0048
D0C90048 D0DA0048
81860054 892C0014
894C0015 896C0016
993D0149 993D034D
995D014B 995D034F
997D014D 997D0351
819C0098 818C0044
818C0000 818C000C
39400000 994C0030
994C00FC 81650008
74E01800 4082000C
75608000 4182001C
39600001 997D00BB
819C01C0 39600005
996C00BB 3BE00000
C03E0000 00000000


PAL
C27EB9CC 00000035
3D80809C 818C18F8
818C0020 897C01B4
1D6B0004 7D8C582E
80CC0000 80860058
81660028 80A60004
48000011 3F4CCCCD
3F99999A 3E4CCCCD
7D0802A6 835C01C4
813C01C0 815C01B8
83BC01BC C00A0044
C0280008 C0490044
C06B0164 C0AB0168
C0C90048 C0EA0048
C0880004 FC032040
40810008 FC602090
EC84082A FC052040
40810008 ECA40828
80E5000C 74E0000C
40820044 C0880000
FC032040 40800008
FC602090 FC052040
4080002C 74E00001
41820008 EC840828
3C000001 60000080
7CEB0038 7C0B0000
40820008 EC840828
FCA02090 74E01000
41820008 EC000028
89840012 2C0C0000
40820018 EC000028
FC400090 FCC00090
FCE00090 48000014
EC4200F2 EC0000F2
ECC60172 ECE70172
D00A0044 D05D0044
D0490044 D05A0044
D0EA0048 D0FD0048
D0C90048 D0DA0048
81860054 892C0014
894C0015 896C0016
993D0149 993D034D
995D014B 995D034F
997D014D 997D0351
819C0098 818C0044
818C0000 818C000C
39400000 994C0030
994C00FC 81650008
74E01800 4082000C
75608000 4182001C
39600001 997D00BB
819C01C0 39600005
996C00BB 3BE00000
C03E0000 00000000

NTSC-J
C27EB038 00000035
3D80809C 818C0958
818C0020 897C01B4
1D6B0004 7D8C582E
80CC0000 80860058
81660028 80A60004
48000011 3F4CCCCD
3F99999A 3E4CCCCD
7D0802A6 835C01C4
813C01C0 815C01B8
83BC01BC C00A0044
C0280008 C0490044
C06B0164 C0AB0168
C0C90048 C0EA0048
C0880004 FC032040
40810008 FC602090
EC84082A FC052040
40810008 ECA40828
80E5000C 74E0000C
40820044 C0880000
FC032040 40800008
FC602090 FC052040
4080002C 74E00001
41820008 EC840828
3C000001 60000080
7CEB0038 7C0B0000
40820008 EC840828
FCA02090 74E01000
41820008 EC000028
89840012 2C0C0000
40820018 EC000028
FC400090 FCC00090
FCE00090 48000014
EC4200F2 EC0000F2
ECC60172 ECE70172
D00A0044 D05D0044
D0490044 D05A0044
D0EA0048 D0FD0048
D0C90048 D0DA0048
81860054 892C0014
894C0015 896C0016
993D0149 993D034D
995D014B 995D034F
997D014D 997D0351
819C0098 818C0044
818C0000 818C000C
39400000 994C0030
994C00FC 81650008
74E01800 4082000C
75608000 4182001C
39600001 997D00BB
819C01C0 39600005
996C00BB 3BE00000
C03E0000 00000000

NTSC-K
C27D9D8C 00000035
3D80809B 818CFF38
818C0020 897C01B4
1D6B0004 7D8C582E
80CC0000 80860058
81660028 80A60004
48000011 3F4CCCCD
3F99999A 3E4CCCCD
7D0802A6 835C01C4
813C01C0 815C01B8
83BC01BC C00A0044
C0280008 C0490044
C06B0164 C0AB0168
C0C90048 C0EA0048
C0880004 FC032040
40810008 FC602090
EC84082A FC052040
40810008 ECA40828
80E5000C 74E0000C
40820044 C0880000
FC032040 40800008
FC602090 FC052040
4080002C 74E00001
41820008 EC840828
3C000001 60000080
7CEB0038 7C0B0000
40820008 EC840828
FCA02090 74E01000
41820008 EC000028
89840012 2C0C0000
40820018 EC000028
FC400090 FCC00090
FCE00090 48000014
EC4200F2 EC0000F2
ECC60172 ECE70172
D00A0044 D05D0044
D0490044 D05A0044
D0EA0048 D0FD0048
D0C90048 D0DA0048
81860054 892C0014
894C0015 896C0016
993D0149 993D034D
995D014B 995D034F
997D014D 997D0351
819C0098 818C0044
818C0000 818C000C
39400000 994C0030
994C00FC 81650008
74E01800 4082000C
75608000 4182001C
39600001 997D00BB
819C01C0 39600005
996C00BB 3BE00000
C03E0000 00000000


Code:
NTSC-U  807E2120
PAL  807EB9CC
NTSC-J 807EB038
NTSC-K 807D9D8C

.set region, '' #Plug in e,p,j,k for compilation region
.if (region == 'E' || region == 'e')
        .set ptr_playerBase, 0x809BD110
.elseif (region == 'P' || region == 'p')
        .set ptr_playerBase, 0x809C18F8
.elseif (region == 'J' || region == 'j')
      .set ptr_playerBase, 0x809C0958
.elseif (region == 'K' || region == 'k')
      .set ptr_playerBase, 0x809AFF38
.else
        .err
.endif

getKartPointers:
lis r12, ptr_playerBase@ha
lwz r12, ptr_playerBase@l (r12)
lwz r12, 0x20 (r12)
lbz r11, 0x1B4 (r28)
mulli r11, r11, 4
lwzx r12, r12, r11
lwz r6, 0 (r12)
lwz r4, 0x58 (r6)
lwz r11, 0x28 (r6)
lwz r5, 4 (r6)

bl calcIconSize
.float 0.8 # Minumum kart size base
.float 1.2 # Maximum kart size base
.float 0.2 # Delta (Used for kart size calculations)

calcIconSize:
mflr r8
lwz r26, 0x1C4 (r28)
lwz r9, 0x1C0 (r28)
lwz r10, 0x1B8 (r28)
lwz r29, 0x1BC (r28)
lfs f0, 0x44 (r10)
lfs f1, 8 (r8)
lfs f2, 0x44 (r9)
lfs f3, 0x164 (r11)
lfs f5, 0x168 (r11)
lfs f6, 0x48 (r9)
lfs f7, 0x48 (r10)

# Check if kart X size is above maximum size cap and cap it if it is
isKartMaxXSize:
lfs f4, 4 (r8)
fcmpo cr0, f3, f4
ble isKartMaxYSize

# Cap kart X size to maximum size
setKartSizeMaxX:
fmr f3, f4

# Check if kart Y size is above maximum size cap and cap it if it is
isKartMaxYSize:
fadds f4, f4, f1
fcmpo cr0, f5, f4
ble isVanish

# Cap kart Y size to maximum size
setKartSizeMaxY:
fsubs f5, f4, f1

# If vanishing (Battle shrink), skip kart size minimum cap
isVanish:
lwz r7, 0xC (r5)
andis. r0, r7, 0xC
bne isGesso

# Check if kart X size is below minimum size cap and cap it if it is
isKartMinXSize:
lfs f4, 0 (r8)
fcmpo cr0, f3, f4
bge isKartMinYSize

# Cap kart X size to minimum size
setKartSizeMinX:
fmr f3, f4

# Check if kart Y size is below minimum size cap and cap it if it is
isKartMinYSize:
fcmpo cr0, f5, f4
bge isGesso

# If squished, decrease minimum size (to make icon more squished)
isPress:
andis. r0, r7, 0x1
beq isPressAndThunder

# Squish kart Y size
squishKartYSize:
fsubs f4, f4, f1

# If squished and shocked at the same time, decrease minimum size even more (way more squished)
isPressAndThunder:
lis r0, 0x1
ori r0, r0, 0x80
and r11, r7, r0
cmpw r11, r0
bne setKartMinYSize
fsubs f4, f4, f1

# Cap kart Y size to minimum size
setKartMinYSize:
fmr f5, f4

# If inked, set character icon size to zero (invisible, except for shadow/outline)
isGesso:
andis. r0, r7, 0x1000
beq isBlinkInvisible

# Set character icon X size to zero (shadow/outline not affected)
setKartXSizeZero:
fsubs f0, f0, f0

# If invisible from Battle blink, set icon size to zero (entirely invisible)
isBlinkInvisible:
lbz r12, 0x12 (r4)
cmpwi r12, 0
bne scaleIconToKartSize

# Set icon size to zero
setIconInvisible:
fsubs f0, f0, f0
fmr f2, f0
fmr f6, f0
fmr f7, f0
b storeMinimapIconXSizes

# Multiply kart X/Y size with icon X/Y size
scaleIconToKartSize:
fmuls f2, f2, f3
fmuls f0, f0, f3
fmuls f6, f6, f5
fmuls f7, f7, f5

# Store icon X size
storeMinimapIconXSizes:
stfs f0, 0x44 (r10)
stfs f2, 0x44 (r29)
stfs f2, 0x44 (r9)
stfs f2, 0x44 (r26)

# Store icon Y size
storeMinimapIconYSizes:
stfs f7, 0x48 (r10)
stfs f7, 0x48 (r29)
stfs f6, 0x48 (r9)
stfs f6, 0x48 (r26)

# Set kart color to outline (Star and rSL ice - Always running to avoid outline color from being stuck if Star is ended by respawn - When normal kart color, color is black)
setOutlineKartColor:
lwz r12, 0x54 (r6)
lbz r9, 0x14 (r12)
lbz r10, 0x15 (r12)
lbz r11, 0x16 (r12)
stb r9, 0x149 (r29)
stb r9, 0x34D (r29)
stb r10, 0x14B (r29)
stb r10, 0x34F (r29)
stb r11, 0x14D (r29)
stb r11, 0x351 (r29)
lwz r12, 0x98 (r28)
lwz r12, 0x44 (r12)
lwz r12, 0 (r12)
lwz r12, 0xC (r12)
li r10, 0
stb r10, 0x30 (r12)
stb r10, 0xFC (r12)

# If in Bullet, Blooper or Star, enable shadow outline
isOutlineStatus:
lwz r11, 0x8 (r5)
andis. r0, r7, 0x1800 # Bullet and Blooper
bne applyOutlines
andis. r0, r11, 0x8000 # Star
beq end

# Apply outline and remove team outline
applyOutlines:
li r11, 1
stb r11, 0xBB (r29)
lwz r12, 0x1C0 (r28)
li r11, 5
stb r11, 0xBB (r12)
li r31, 0

end:
lfs f1, 0(r30)


Code creator: Ro
Reply
#2
I updated the code again (final update this time). Icon X and Y size are now based on kart X and Y size. Previously, it was based on Y only. Now it generates a way smoother and accurate view of both kart X and Y scale on the minimap, a very nice animation.

Please use the updated code if you aren't
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)