Thunder Cloud Effect Modifier [Unnamed]
#4
Here's the randomizer code (C0 source, this will work for all regions)

It works by cycling a number from 0 thru 6 per every frame of the game (good enough for randomization for what we need).

Based on that random number, it uses that as an offset to load from an item table. This table holds all the applicable items. The appropriate item value gets loaded and then stored to the EVA

We solely cannot use the random cycled number to be the item value itself because some item values are skipped.

Code:
#Directives
.set mushroom, 4
.set shock, 8
.set star, 9
.set mega, 0xB
.set blooper, 0xC
.set pow, 0xD
.set bullet, 0xF
.set random_int_amt, 6

#Save C0 LR
mflr r12

#Set EVA Upper
lis r11, 0x8000

#Make LUT
bl item_value_table
.byte mushroom
.byte shock
.byte star
.byte mega
.byte blooper
.byte pow
.byte bullet
.align 2
item_value_table:
mflr r10

#Grab, increment, and check randomized int
lbz r9, 0x1500 (r11)
addi r9, r9, 1
cmplwi r9, random_int_amt
ble+ store_random_int

#Reset random int
li r9, 0

#Store random int
store_random_int:
stb r9, 0x1500 (r11)

#Based on int set item in EVA
lbzx r3, r9, r10
stb r3, 0x1501 (r11)

#Restore C0 LR
mtlr r12

#End
#blr #uncomment for Assemblers that can't do C0 codes correctly


You will also need to slightly modify Unnamed's code (its source) to load the item value that resides in the EVA

This part here..

Code:
li r11, 0xII      # Our Item

Needs to be...

Code:
lis r11, 0x8000
lbz r11, 0x1501 (r11)      # Our Item

.. then reassemble the code.

All of this is untested
Reply


Messages In This Thread
RE: Thunder Cloud Effect Modifier [Unnamed] - by Vega - 12-23-2024, 07:30 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)