This lets you modify, per-character-per-action-state, which direction the character is allowed to grab the ledge. It does not add ledge grab ability to action states that can't grab the ledge in the first place.
Thanks @Punkline for the tip on how to store data inline with code.
I've tested it but not extensively. If you spot a bug let me know
Thanks @Punkline for the tip on how to store data inline with code.
I've tested it but not extensively. If you spot a bug let me know
C2046E78 NNNNNNNN
C01A0014 393AF910
81490010 81290004
48000091 7D0802A6
80E80000 7CE903A6
38E70001 1CE70004
7D083A14 3908FFFC
89680000 7C0B4800
40820018 A1680002
556B053E 7C0B5000
40820008 4800000C
4200FFDC 4800003C
C05AF93C C062A1C4
89680001 7D6B0774
FC021840 4080000C
38000000 7D6B0050
B17A0036 A0080002
540004E7 4182000C
C0029D80 EC01002A
3C008004 60006E7C
7C0803A6 4E800020
4E800021 PPPPPPPP
WWXXYZZZ 00000000
NNNNNNNN: Number of lines in the code minus the top line, in hex. Need to update if using more than one WWXXYZZZ set.
PPPPPPPP: Number of WWXXYZZZ option sets.
WWXXYZZZ: Change ledgegrab behavior for one action state for one character.
WW: Character internal ID
XX: Ledge grab type. 01 for forward, FF for backward, 00 for both.
Y: 0 for normal behavior. 1 to enable ledge grab while ascending.
ZZZ: Action State ID
An arbitrary number of WWXXYZZZ entries can be added, as long as N and P are updated appropriately. If the number of entries is even, it is necessary to add 60000000 before the final 00000000 to fill the line.
C01A0014 393AF910
81490010 81290004
48000091 7D0802A6
80E80000 7CE903A6
38E70001 1CE70004
7D083A14 3908FFFC
89680000 7C0B4800
40820018 A1680002
556B053E 7C0B5000
40820008 4800000C
4200FFDC 4800003C
C05AF93C C062A1C4
89680001 7D6B0774
FC021840 4080000C
38000000 7D6B0050
B17A0036 A0080002
540004E7 4182000C
C0029D80 EC01002A
3C008004 60006E7C
7C0803A6 4E800020
4E800021 PPPPPPPP
WWXXYZZZ 00000000
NNNNNNNN: Number of lines in the code minus the top line, in hex. Need to update if using more than one WWXXYZZZ set.
PPPPPPPP: Number of WWXXYZZZ option sets.
WWXXYZZZ: Change ledgegrab behavior for one action state for one character.
WW: Character internal ID
XX: Ledge grab type. 01 for forward, FF for backward, 00 for both.
Y: 0 for normal behavior. 1 to enable ledge grab while ascending.
ZZZ: Action State ID
An arbitrary number of WWXXYZZZ entries can be added, as long as N and P are updated appropriately. If the number of entries is even, it is necessary to add 60000000 before the final 00000000 to fill the line.
This example uses the options shown in the source given below, and is intended to show the procedure for editing the options in Gecko code format and to demonstrate the various things the code can do, not to be used as-is.
C01A0014 393AF910
81490010 81290004
48000091 7D0802A6
80E80000 7CE903A6
38E70001 1CE70004
7D083A14 3908FFFC
89680000 7C0B4800
40820018 A1680002
556B053E 7C0B5000
40820008 4800000C
4200FFDC 4800003C
C05AF93C C062A1C4
89680001 7D6B0774
FC021840 4080000C
38000000 7D6B0050
B17A0036 A0080002
540004E7 4182000C
C0029D80 EC01002A
3C008004 60006E7C
7C0803A6 4E800020
4E800021 00000005
0800116D 13000162
10000166 17FF0023
02011162 00000000
- Ness UpB grabs on both sides and snaps while ascending
- Zelda UpB Appearance ledgegrabs on both sides
- Mewtwo UpB Appearance ledgegrabs on both sides
- Pichu can only grab ledge from behind during FallSpecial
- Falcon UpB grabs only in front and snaps ascending
C01A0014 393AF910
81490010 81290004
48000091 7D0802A6
80E80000 7CE903A6
38E70001 1CE70004
7D083A14 3908FFFC
89680000 7C0B4800
40820018 A1680002
556B053E 7C0B5000
40820008 4800000C
4200FFDC 4800003C
C05AF93C C062A1C4
89680001 7D6B0774
FC021840 4080000C
38000000 7D6B0050
B17A0036 A0080002
540004E7 4182000C
C0029D80 EC01002A
3C008004 60006E7C
7C0803A6 4E800020
4E800021 00000005
0800116D 13000162
10000166 17FF0023
02011162 00000000
Code:
# Reverse and Ascending Ledgegrab for Selected Action States [rmn]
# Inject at 80046e78
#
# Allows modification, on a per-character, per-action-state basis, of the
# direction the ledge can be grabbed (forward, backward, or both). The
# ability to grab ledge while travelling upward can also be enabled.
# Does not add ledgegrab capability to action states that do not grab ledge
# at all (for those action states, the injection point is never reached).
#
# Examples are included to demonstrate the format to use for the data section.
# Replace the data section to select the options you want to enable.
lfs f0, 0x14(r26) # Y_prev, used by default (cannot grab ascending) case
subi r9, r26, 0x6f0 # player character data pointer
lwz r10, 0x10(r9) # action state
lwz r9, 4(r9) # character ID
bl get_data
mflr r8 # data pointer
lwz r7, 0(r8)
mtctr r7
addi r7, r7, 1
mulli r7, r7, 0x4
add r8, r8, r7
loop_start:
subi r8, r8, 0x4
lbz r11, 0(r8)
cmpw r11, r9 # check character
bne continue
lhz r11, 2(r8)
rlwinm r11, r11, 0, 0x14, 0x1F # remove flag
cmpw r11, r10 # check action state
bne continue
b set_grabtype
continue:
bdnz loop_start
b done
set_grabtype:
lfs f2, -0x6c4(r26) # facing direction
lfs f3, -0x5e3c(r2) # 0
lbz r11, 1(r8)
extsb r11, r11
fcmpo cr0, f2, f3
bge right_facing
left_facing:
li r0, 0
sub r11, r0, r11
right_facing:
write_flag:
sth r11, 0x36(r26) # overwrite ledge grab direction
lhz r0, 2(r8)
rlwinm. r0, r0, 0, 0x13, 0x13 # check flag
beq done
grab_ascending:
lfs f0, -0x6280(r2) # 1
fadds f0, f1, f0 # so ledgegrab logic thinks character is descending
done:
lis r0, 0x8004 # done like this so changing data section in gecko code
ori r0, r0, 0x6e7c # form doesn't require recalculating branches
mtlr r0
blr
get_data:
blrl
#### Options: Modify this section to choose what action states will be affected
.long 0x5 # number of entries in the list below - change this value!
# Action States to modify ledge grab behavior for:
# WWXXYZZZ
# WW: Character ID.
# XX: Ledge grab type. 01 for forward, FF for backward, 00 for both.
# Y: 0 for normal behavior, 1 to enable ledge grab while ascending
# ZZZ: Action State ID.
.long 0x0800116d # Ness upB grabs on both sides and snaps while ascending
.long 0x13000162 # Zelda UpB Appearance ledgegrabs on both sides
.long 0x10000166 # Mewtwo UpB Appearance ledgegrabs on both sides
.long 0x17ff0023 # Pichu can grab only backwards during FallSpecial
.long 0x02011162 # Falcon UpB grabs only in front and snaps ascending
####