MKDS Star Character Animation [Ro]
#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


Messages In This Thread
MKDS Star Character Animation [Ro] - by _Ro - 03-05-2022, 05:51 AM
RE: MKDS Star Character Animation [Ro] - by Seeky - 03-05-2022, 02:55 PM
RE: MKDS Star Character Animation [Ro] - by _Ro - 03-05-2022, 04:11 PM
RE: MKDS Star Character Animation [Ro] - by Seeky - 03-05-2022, 05:47 PM
RE: MKDS Star Character Animation [Ro] - by Vega - 03-06-2022, 01:07 AM
RE: MKDS Star Character Animation [Ro] - by _Ro - 03-06-2022, 08:59 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)