I'm using this sprite to make Mario move freely on the screen. My issue with this, though, is the hitbox, which right now (as small mario) is 16x16.
I was wondering if there are any ways to edit Mario's hitbox and make it 8x8, with center on that sprite.
I tried this too: the "small" hitbox does help a little, but it's still not an 8x8 hitbox, and I don't feel like editing stuff in that patch, due to my limited asm knowledge.
Any help with this, I'd greatly appreciate.
MairoClipDispY: .db $06,$14,$10,$18
MarioClippingHeight: .db $1A,$0C,$20,$18
GetMarioClipping: DA PHX
CODE_03B665: A5 94 LDA RAM_MarioXPos ; \
CODE_03B667: 18 CLC ; |
CODE_03B668: 69 02 ADC.B #$02 ; |
CODE_03B66A: 85 00 STA $00 ; | $00 = (Mario X position + #$02) Low byte
CODE_03B66C: A5 95 LDA RAM_MarioXPosHi ; |
CODE_03B66E: 69 00 ADC.B #$00 ; |
CODE_03B670: 85 08 STA $08 ; / $08 = (Mario X position + #$02) High byte
CODE_03B672: A9 0C LDA.B #$0C ; \ $06 = Clipping width X (#$0C)
CODE_03B674: 85 02 STA $02 ; /
CODE_03B676: A2 00 LDX.B #$00 ; \ If mario small or ducking, X = #$01
CODE_03B678: A5 73 LDA RAM_IsDucking ; | else, X = #$00
CODE_03B67A: D0 04 BNE CODE_03B680 ; |
CODE_03B67C: A5 19 LDA RAM_MarioPowerUp ; |
CODE_03B67E: D0 01 BNE CODE_03B681 ; |
CODE_03B680: E8 INX ; /
CODE_03B681: AD 7A 18 LDA.W RAM_OnYoshi ; \ If on Yoshi, X += #$02
CODE_03B684: F0 02 BEQ CODE_03B688 ; |
CODE_03B686: E8 INX ; |
CODE_03B687: E8 INX ; /
CODE_03B688: BF 60 B6 03 LDA.L MarioClippingHeight,X ; \ $03 = Clipping height
CODE_03B68C: 85 03 STA $03 ; /
CODE_03B68E: A5 96 LDA RAM_MarioYPos ; \
CODE_03B690: 18 CLC ; |
CODE_03B691: 7F 5C B6 03 ADC.L MairoClipDispY,X ; |
CODE_03B695: 85 01 STA $01 ; | $01 = (Mario Y position + displacement) Low byte
CODE_03B697: A5 97 LDA RAM_MarioYPosHi ; |
CODE_03B699: 69 00 ADC.B #$00 ; |
CODE_03B69B: 85 09 STA $09 ; / $09 = (Mario Y position + displacement) High byte
CODE_03B69D: FA PLX
Return03B69E: 6B RTL ; Return
This is the routine that get Mario's clipping values and positions.
When your free movement sprite is active, you could set a flag using some free RAM, that'd be used in a hijack of this code to change the clippings.
Changing the width and X position of the hitbox is easy, but fiddling with the height and Y position might be harder: Is Mario, in your case, always small ? Or can he also be big as usual ?
Asar would usually throw an error if it detects that freespace isn't properly cleaned and asks you if you are sure about inserting that patch before modifing your rom. So as long as asar doesn't have some odd bug that no one ever found it should be fine to insert it and asar should tell you if it isn't.