New Version of Shared Item Code
#5
You might ask yourself why I have such questions like "How do I know my Trailed Item?" or "How do I get the Mega Timer? " .
And this is the answer: I want it to be much more enjoyable to play with the Shared Item Code. First of all I have already made it possible to add a position check.  And now two more rules can be ensured with it. It is now possible to add a state check which checks if you are currently in the mega (no mega while in the mega rule) or if you are trailing a triple item (no triple item while a triple item is trailed rule). I now provide the relevant sources:


----------------------------For the no mega while in the mega rule--------------------------------------------------

----Store Player Item Slot ASM:----
Adresses:
807E4CA0 ## NTSC-U
807EEFB0 ## PAL
807EE61C ## NTSC-J
807DD370 ## NTSC-K

lis r29, 0x8000
mulli r5, r0, 4 ## r0 is Player Item Slot
sth r5, 0xVVVV
mulli r29, r0, 584 ## Default instruction

----Write Mega State:----
Adresses:
807ED9F8 ## NTSC-U
807F84F8 ## PAL
807F7B64 ## NTSC-J
807E68B8 ## NTSC-K

Mega Adresses:
NTSC-U:
MEGA_UPPER  0x809C
MEGA_LOWER -0x2EF0
PAL:
MEGA_UPPER  0x809C
MEGA_LOWER  0x18F8
NTSC-J:
MEGA_UPPER  0x809C
MEGA_LOWER  0x0958
NTSC-K:
MEGA_UPPER  0x809B
MEGA_LOWER -0x00C8

lis r11, MEGA_UPPER
lwz r11, MEGA_LOWER (r11)
lwz r11, 0x20 (r11)
lis r12, 0x8000
lhz r12, VVVV (r12) ## load Player Item Slot
add r11,r12,r11
lwz r11, 0 (r11)
lwz r11, 0x10 (r11)
lwz r11, 0x10 (r11)
lhz r26, 0x194 (r11) ## Load Mega Time
cmpwi r26, 0
li r11, 1 ## Load active State in r11 (Mega on)
bgt- store
li r11, 0 ## If active branch immediately to store instruction, if not, overwrite State with not active.
store:
lis r12, 0x8000
sth r11, 0xMMMM (r12) # store Mega State to exception Vector Area.
lhz r28, 8 (r4) # Default instruction

----Shared Item with Mega State check:----
Adresses:
807AB704  ## NTSC-U
807BA164  ## PAL
807B97D0  ## NTSC-J
807A8524  ## NTSC-K

lis r11, 0x8000
lhz r12, 0xMMMM (r11) ## Load Mega State
cmpwi r12,1
beq- dont_execute ## If State active branch directly to Default instruction
li r3, 0xB ## Load the Mega in r3
dont_execute:
stw r3,32 (r23) ## Default instruction.


----------------------------For the no triple item while a triple item is trailed rule--------------------------------------------------

----Triple Trailed Item State:----
Adresses:
8065EE14 ## NTSC-U
8065E18C ## PAL
8065D7F8 ## NTSC-J
8064C4A4 ## NTSC-K

lhz r0,1(r3) ## Load the Local Item Halfword including held and trailed item
rlwinm r0,r0,0,24,31 ## Same as "clrlwi r0, r0, 24", clears the first 24 bits, we need only the Trailed Item.
cmpwi r0, 0x10
li r12, 0 ## Load State not active in r12
blt+ store
cmpwi r0, 0x12
bgt- store
li r12, 1 ## If it is smaller or equal 12 and greater or equal 10, it's a triple Item, overwrite State with active.
store:
lis r11, 0x8000
sth r12, 0xTTTT (r11) ## store Triple Trailed Item State to exception Vector Area.
lbz r0, 1 (r3) ## Default instruction.

----Shared Item with Triple Trailed State check:----
Adresses:
807AB704  ## NTSC-U
807BA164  ## PAL
807B97D0  ## NTSC-J
807A8524  ## NTSC-K

lis r11, 0x8000
lhz r12, 0xTTTT (r11) ## Load Triple Trailed State
cmpwi r12,1
beq- dont_execute ## If State active branch directly to Default instruction
li r3, 0x10 ## Load e.g. Triple Greens in r3, you can also use Tr. Reds or Tr. Bananas
dont_execute:
stw r3, 32 (r23) ## Default instruction.

----------------------------------------------------------------------------------------------------

The only thing left to do would be to reject when the maximum number of items is reached. I had the idea to use parts from Star's "Shared Item Cheat Detection".
But then I remembered that this is not really optimal because it only counts the held items and not the trailed items or those that are currently in the game.
If anyone has an idea about this, he/she can let me know.
Reply


Messages In This Thread
New Version of Shared Item Code - by Unnamed - 01-23-2020, 12:53 PM
RE: New Version of Shared Item Code - by Vega - 01-23-2020, 02:10 PM
RE: New Version of Shared Item Code - by Unnamed - 01-23-2020, 06:25 PM
RE: New Version of Shared Item Code - by Vega - 01-23-2020, 07:02 PM
RE: New Version of Shared Item Code - by Unnamed - 09-14-2020, 10:16 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)