MKDS Star Character Animation [Ro]
#1
MKDS Star Character Animation [Ro]

This code will make your character animated (item hit success, win animation is broken) when you are in a Star, similarly to Mario Kart DS's character animation when in a star. It is done by modifying what loads the damage animation to execute the damage animation when in a star, and also when hit, and then load a different animation if in a star. As mentioned above, the win animation breaks - it resets when another animation is about to start and it will only stop the animation (after star ends) when another animation starts. No other animations can happen during the process of the star animation.

This code is poorly done andwritten and had me confused on why the other ways I tried didn't worked, so I am releasing it in the only way I got to work. Tips and helps are highly appreciated.

NTSC-U:
C27BCCC4 00000004
80040008 54000001
4182000C 38000001
48000008 80040008
60000000 00000000
C27BCD0C 00000004
80040008 54000001
4182000C 38800014
48000008 3880001A
60000000 00000000


PAL (Untested):
C27CB724 00000004
80040008 54000001
4182000C 38000001
48000008 80040008
60000000 00000000
C27CB76C 00000004
80040008 54000001
4182000C 38800014
48000008 3880001A
60000000 00000000


NTSC-J (Untested):
C27CAD90 00000004
80040008 54000001
4182000C 38000001
48000008 80040008
60000000 00000000
C27CADD8 00000004
80040008 54000001
4182000C 38800014
48000008 3880001A
60000000 00000000

NTSC-K (Untested):
C27B9AE4 00000004
80040008 54000001
4182000C 38000001
48000008 80040008
60000000 00000000
C27B9B2C 00000004
80040008 54000001
4182000C 38800014
48000008 3880001A
60000000 00000000

Code:
Play Animation
Write to:
NTSC-U: 807BCCC4
PAL: 807CB724
NTSC-J: 807CAD90
NTSC-K: 807B9AE4

lwz r0, 8(r4) #Loads player status
rlwinm. r0, r0, 0, 0, 0 #Checks if player status is star
beq notIn #If not in a star, skip to original instruction (or else breaks, idk why)
li r0, 1 #Load 1 if in star (the address below checks for it to load damage animation)
b end #Skip original instruction
notIn: #Label name for original instruction
lwz r0, 8(r4) #Original instruction
end: #End of function (return)



Animation Replacement
Write to:
NTSC-U: 807BCD0C
PAL: 807CB76C
NTSC-J: 807CADD8
NTSC-K: 807B9B2C

lwz r0, 8(r4) #Loads player status
rlwinm. r0, r0, 0, 0, 0 #Checks if player status is star
beq notIn #If not in a star, skip to original instruction (or else breaks, idk why)
li r4, 0x14 #Loads item hit success animation
b end #Skip original instruction
notIn: #Label name for original instruction
li r4, 0x1A #Original instruction
end: #End of function (return)

Code by: Ro
Code credits: Skullface (for the address) and mdmwii for animation values
Reply
#2
Neat. Like your other recent codes, needs an ntsc-k port before it can be posted outside of the incomplete section
Reply
#3
Added. Sorry for my incovinience. Adding for the rest of my codes
Reply
#4
Cool, moved them all back now
Reply
#5
You can optimize your source by using r12 as a scrap register. Btw since you are only checking for a single bit and its in the upper 16 bits of the register, you can use andis instead of rlwinm. Simpler to use imo.

Code:
lwz r0, 8 (r4) #Load player status, this is the default instruction
andis. r12, r0, 0x8000 #Check if bit 0 is high (Star bit); use r12 as a scrap register for the result so r0 is not modified
beq- end_code #If Star bit was found low, simply end the code
li r0, 1 #Since star bit was found high, set r0 to 1. this sets bit 31 (damage bit) high. All other bits forced low.
end_code:

My question is why is r0 being to set just 1 in a pre-defined manner? This would effect the other bits that aren't in use of your code (bits 1 thru 30). You may want to write it like this...

Code:
lwz r0, 8 (r4)
andis. r12, r0, 0x8000
beq- end_code
rlwinm r0, r0, 0, 1, 31 #Set bit 0 (star bit) low, fyi this is doing a logical AND against the value of 0x7FFFFFFF
ori r0, r0, 0x0001 #Flip Damage bit high (bit 31)
end_code:

The above source will force the previous Star bit that was found high to now be low, then flip the damange bit flip high. This leads me to my next question of do you want the Star bit (bit 0) to be always be forced low when it was previusly found high? If not, then source would be like this...

Code:
lwz r0, 8 (r4)
andis. r12, r0, 0x8000
beq- end_code
ori r0, r0, 0x0001
end_code

--------

Regarding your second source. Here's a better configuration~

Code:
lwz r0, 8 (r4) #r0 safe for use since we are approaching a function call
andis. r4, r0, 0x8000 #r4 now safe for use
li r4, 0x1A #Preset original instruction. Normal r4 value.
beq- end_code
li r4, 0x14 #Load item hit success animation value for r4
end_code:
Reply
#6
Hello Vega. Thank you for the tips and consideration of helping me improve!
I set r0 to 1 which is the value being checked after it - I set it to 1 because below r0 is reloaded, so I didn't see a problem doing this.

About the star bit thing, I think it's better to make the star bit low, in case another flags are applied, the animations can properly be played.

I highly appreciate the help. I will consider testing them someday and possibly updating the code with the changes
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)