Skip to content

Commit

Permalink
slight remodelling
Browse files Browse the repository at this point in the history
  • Loading branch information
nstbayless committed Jul 23, 2024
1 parent c23199a commit 0dbec74
Show file tree
Hide file tree
Showing 3 changed files with 165 additions and 84 deletions.
Binary file modified out.ips
Binary file not shown.
240 changes: 158 additions & 82 deletions patch.asm
Original file line number Diff line number Diff line change
Expand Up @@ -4,153 +4,221 @@ include "pre.asm"

include "ram.asm"

VSP_CONTROL_ZERO_VSPEED=$1C

; --------------------------------------------------------------------
BANK $E
BASE $8000

FROM $81FE
getting_hit:

FROM $8307
knockback_step:

FROM $8338
NOP
NOP
JSR $BF66
JSR custom_knockback

FROM $8AC6
standard_state_0:

; in Trevor state jump table ($9376)
FROM $9376
trevor_jump_table:

FROM $937E
DW $BF3E
FROM $9430
DW $BFC6
; state 8 (jumping)
; jump replacement
DW custom_jump_then_standard_jump

FROM $942F
attack:
jsr jumping_attack

FROM $94C9
jump_attack_step:
jsr jumping_attack

FROM $952D
standard_idle:

FROM $9624
standard_begin_jump:

FROM $94CA
DW $BFC6
FROM $9667
standard_walk:

FROM $9750
DB $08
FROM $974F
; go to jump state (instead of falling state)
lda #$08

FROM $9757
DB $1C
FROM $9756
; x=0 before this
lda #VSP_CONTROL_ZERO_VSPEED
STA vsp_control,X
LDA #$00
STA $5C1,X
STA simon_fall_objphase,X
lda #$16
sta imgsin
zero_hspfra:
lda #$00
sta hspfra
rts
DB $FF,$FF,$FF,$FF,$FF,$60,$FF,$FF,$FF,$FF,$FF,$FF
FROM $9921
DB $E9,$BF
;DB $FF,$FF,$FF,$FF,$FF,$60,$FF,$FF,$FF,$FF,$FF,$FF

FROM $9777
standard_jump:

FROM $9920
standard_crouch:
jsr crouch_direction

FROM $99A4
JSR $BFCC
JSR stair_jumping
NOP
FROM $9AAC
DW $BFCC
FROM $9AAB
JSR stair_jumping

FROM $9C19
sypha_jumptable:

FROM $9C21
DW $BF3E
DW custom_jump_then_standard_jump

FROM $A59B
alucard_jumptable:

FROM $A5A3
DW $BF3E
DW custom_jump_then_standard_jump

; custom code
FROM $BF39
LDA #$01
STA hspint,X
custom_jump:
custom_jump_then_standard_jump:
; push return address (-1)
LDA #$97
PHA
LDA #$76
PHA
LBF44:
JSR $9765
LDA $2A
AND #$03
BEQ $BFC0
custom_jump_jsr:
JSR zero_hspfra
LDA joypad_down
AND #$03 ; 1=right, 2=left
BEQ hcancel
LSR A
BCC LBF5C
BCC air_control_left
air_control_right:
; if left and right, hcancel
LSR A
BCS hcancel
; standard right
LDY #$00
LDX #$01
STX hspint
BPL $BF99
LSR A
BCC $BFAA
LBF5C
BPL __jumping_contd ; guaranteed
air_control_left:
LDY #$01
LDX #$FF
STX hspint
JMP $BF99
custom_knockback:
LDA $4A
BEQ __return_to_knockback
LDA vspint
BMI LBF88
LDA #tmp_y
STA simon_state
LDA $49
BEQ LBF8B
LDA $48
CMP #$02
BNE LBF8B
LDA #$38
STA vsp_control
LDA #$16
STA imgsin
LBF88:
JMP __return_to_knockback
LBF8B:
LDA #$1C
STA vsp_control
LDA $A689,Y
__return_to_knockback:
LDA #tmp_y
LDY hspint
RTS
__jumping_contd:
__jumping_contd

; decide whether or not to set facing
LDA simon_state
CMP #tmp_y
BNE check_vstall
CMP #8 ; jumping
BNE check_vcancel
LDA imgsin
CMP #$10
BEQ check_vstall
set_facing:
BEQ check_vcancel
STY facing
check_vstall:
LDA control_held
AND #$80
BNE LBFBF
LDA vspint
BPL LBFBF
LDA #$1C
BNE check_vcancel ; guaranteed
hcancel:
STA hspint
check_vcancel:
LDA joypad_down
AND #$80 ; holding jump button?
BNE __vcancel_rts
LDA vspint ; already moving downward?
BPL __vcancel_rts
LDA #VSP_CONTROL_ZERO_VSPEED
STA vsp_control
LDA #$00
STA vspint
LBFBF:
__vcancel_rts:
RTS
hstall:
STA hspint
JMP check_vstall

jumping_attack:
JSR LBF44
JMP $97A3
JSR custom_jump_jsr
JMP $97A3 ; .. not necessarily air-attacking?

stair_jumping:
LDA control_pressed
; TODO: demystify this

; pressed jump button?
LDA joypad_pressed
AND #$80
BEQ __recover_step
LDA #$06
LDA #$06 ; begin jump
STA simon_state
; double-return (why?)
PLA
PLA
RTS
__recover_step:
LDA simon_state
CMP #$14
CMP #$14 ; stair climb
BEQ LBFE6
LDA control_held
LDA joypad_down
AND #$40
RTS
LBFE6:
JMP $9A43

custom_knockback:
; if 0 hp, do normal knockback
LDA hitpoints
BEQ __return_to_knockback
LDA vspint
BMI custom_knockback_moving_upward
LDA #8 ; jumping
STA simon_state
LDA $49
BEQ custom_knockback_moving_upward
LDA $48
CMP #$02
BNE custom_knockback_moving_upward
LDA #$38
STA vsp_control
LDA #$16
STA imgsin
LBF88:
JMP __return_to_knockback
custom_knockback_moving_upward:
LDA #VSP_CONTROL_ZERO_VSPEED
STA vsp_control
LDA $A689,Y
__return_to_knockback:
LDA #8
LDY hspint
RTS

crouch_direction:
LDA control_held
LDA joypad_down
LSR A
BCC LBFF3
LDX #$00
Expand All @@ -161,4 +229,12 @@ LBFF3:
LDX #$01
STX facing
LBFFB:
JMP $840C
; (detour trampoline continue)
JMP $840C
; --------------------------------------------------------------------
BANK $F
BASE $C000

; jump by table
FROM $E814
9 changes: 7 additions & 2 deletions ram.asm
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ BASE $004A:
hitpoints:

BASE $0028:
control_pressed:
joypad_pressed:

BASE $002A:
control_held:
joypad_down:

BASE $0506:
dagger_hspint:
Expand Down Expand Up @@ -130,3 +130,8 @@ BASE $000B:
BASE $0008:
tmp_y:

BASE $003A
partner_us:

BASE $0048
partner_jp:

0 comments on commit 0dbec74

Please sign in to comment.