New Version of Shared Item Code
#1
Hello,

I have created my own version of the Shared Item Code. It is a mix of the Standard Shared Item Code created by Guru and the Perfect Item Code created by Vega.

Here is the source:

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

###### 1st ASM - Item Probability Store ASM #######
Adresses:
807ACBC8  ## NTSC-U
807BB628  ## PAL
807BAC94  ## NTSC-J
807A99E8  ## NTSC-K

add r11, r4, r3 ## Add r3 and r4 together. You are now at the green shell halfword for your current position on the game's item table.
li r12, 0xVV ## Load Users Item Value VV into r12.
add r11, r12, r11 ## Add r11 and r12 (Item value) to get exact item's halfword prob. location on the game's table.
lhz r12, 0 (r11) ## Load the Probability from the game's Table into r12.
lis r11, 0x8000
stw r12, 0x1578 (r11) ## Store Probability to Memory Adress 80001578.
cmpwi r0, 0 ## Default instruction.

###### 2nd ASM - Shared Item ASM #########
Adresses:
807AB704  ## NTSC-U
807BA164  ## PAL
807B97D0  ## NTSC-J
807A8524  ## NTSC-K

lis r11, 0x8000
lwz r12, 0x1578 (r11) ## Load the Item Probability from Memory Adress 80001578.
cmpwi r12, 0
beq- no_go ## If Item's Probability is 0, we know you cannot get the item for that position for the current in-race room size. Jump to no_go.

li r3, 0xWW ## Load Item WW in r3,  typical Shared Item code.

no_go:
stw r3, 0x0020 (r23) ## Default instruction.


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

Now my Question: Is it good enough to post it. If yes, how should I name this code. It can be a new version of the "In Race Room Size and Position based Shared Item Code"
or you can call it "Perfect Shared Item Code", I don't have an Idea.

Thank you already for the Answer  Smile .
Reply
#2
This is would be a better version of In Race Room Size and Position based Shared Item code. I can already tell by the source that it will be work. Once you have it posted in the codes forum, I'll move my version to outdated. Ye they're technically different but your version does the check to make sure if the item is even possible to begin with.

If desired, you could name it something else, but then again we already have like 3 diff Versions of Shared Items lol

Nice work!
Reply
#3
Ok, then I will use the name "In Race Room sized & Position based Shared Item Code".

Then I would like to ask who gets the code credits. I think XeR (founder of the first ASM), Guru (founder of the second ASM) and Vega (due to the inspiration of the "Perfect Item Code").
Reply
#4
You don't need to include me for "inspiration".
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)