Dropped Item direction modifier [Unnamed]
#1
Dropped Item direction modifier [Unnamed]


With this code, you can choose the direction (angle) your Item (in inventory) will drop if losing it. If you have more than 1 Item in your inventory, it will at least 1 Item drop towards your set direction.

Values:
XXXXXXXX = Floating Point value of angle. See explanation below.

NTSC-U
C27AD978 00000005
3C804336 60840B60
90830000 C0430000
3C80XXXX 6084XXXX
90830000 C0030000
EC220072 00000000

PAL
C27BC3D8 00000005
3C804336 60840B60
90830000 C0430000
3C80XXXX 6084XXXX
90830000 C0030000
EC220072 00000000

NTSC-J
C27BBA44 00000005
3C804336 60840B60
90830000 C0430000
3C80XXXX 6084XXXX
90830000 C0030000
EC220072 00000000

NTSC-K
C27AA798 00000005
3C804336 60840B60
90830000 C0430000
3C80XXXX 6084XXXX
90830000 C0030000
EC220072 00000000


Explanation: The allowed values for XXXXXXXX are 0 degrees to 360 degrees single float, where 0 degrees means forward and increasing values mean a change in mathematically positive direction (counterclockwise).
I provide an example:

270 degrees (right) --> XXXXXXXX = 43870000



Source:
###################################### Dropped Item direction Function #########################################

### Insert at: ###
### 0x807AD978 - NTSC-U ###
### 0x807BC3D8 - PAL ###
### 0x807BBA44 - NTSC-J ###
### 0x807AA798 - NTSC-K ###


## lis r4, 0x4336    ## load upper part of 0x43360B60 into r4 (r4 will be overwritten two instructions ahead the Insert ASM adress)
## ori r4, r4, 0x0B60 ## load lower part 0x43360B60 into r4, 0x43360B60 is the number 65536/360 = 184.4444 in single precision (we need this value for scaling)
## stw r4, 0 (r3)
## lfs f2, 0 (r3)      ## load scale factor, f2 is overwritten a few instructions further on.
## lis r4, XXXX      ## load upper part of the angle float into r4
## ori r4, r4, XXXX  ## load lower part of the angle float into r4
## stw r4, 0 (r3)
## lfs f1, 0 (r3)      ## load the angle as single float.
## fmuls f1, f2, f1  ## apply scaling, angle is now ready for the sine/cosine function.


########################################################################################################################


Code Creator: Unnamed
Code Credits: Fishguy (Drop Item Subroutine)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)