From 0dbec74af5a989ed5e330b4a9d1dde9c002be391 Mon Sep 17 00:00:00 2001 From: nstbayless Date: Tue, 23 Jul 2024 13:21:40 -0700 Subject: [PATCH] slight remodelling --- out.ips | Bin 321 -> 311 bytes patch.asm | 240 +++++++++++++++++++++++++++++++++++------------------- ram.asm | 9 +- 3 files changed, 165 insertions(+), 84 deletions(-) diff --git a/out.ips b/out.ips index 106ccf621bafa98bb7e072ec78be67603dfd1188..394ba5f06b63ce4266e8bbdf44e5313acece03e0 100644 GIT binary patch delta 264 zcmX@ew4JFwz%j(xgSpv*f%VlZg-!dJC-*Th+3jbZV$Z;=&<~_%KphQ0K?PO;u9Y&qAjkA7uqI4qV^rbr`k)CE tH;|dQUP|Nsez5G$&Sfh()_h_~SgPeUfprl>-wGBG%?PA@cv@Wj-2l9GUUmQg delta 276 zcmdnabdae&z%j(xgSpv*f%VlZg|z+5llvH$?DjKHabRFN2BdC*sp$y}j2z6<(-{q@a+29}i!y_~EG|3Lsk{%4+P$iVb+Kl98j3@i#~_P=7DwTFS}%zoxM zKw+SR)N((awSJ^D(h0u55h}5PBLBKU1`w^bP&ibK9l#almT*fb}n1V zvE~y?!rD~UlN=Yg)-tf16!^g0vw{U^MZ*PtpeX`eV3k1ED{!zT^a3qdwSVGCmB|W> F;sBPAZd3pO diff --git a/patch.asm b/patch.asm index 4618a13..7d38a8b 100644 --- a/patch.asm +++ b/patch.asm @@ -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 @@ -161,4 +229,12 @@ LBFF3: LDX #$01 STX facing LBFFB: - JMP $840C \ No newline at end of file + ; (detour trampoline continue) + JMP $840C + +; -------------------------------------------------------------------- +BANK $F +BASE $C000 + +; jump by table +FROM $E814 \ No newline at end of file diff --git a/ram.asm b/ram.asm index 9163087..edabe67 100644 --- a/ram.asm +++ b/ram.asm @@ -83,10 +83,10 @@ BASE $004A: hitpoints: BASE $0028: - control_pressed: + joypad_pressed: BASE $002A: - control_held: + joypad_down: BASE $0506: dagger_hspint: @@ -130,3 +130,8 @@ BASE $000B: BASE $0008: tmp_y: +BASE $003A + partner_us: + +BASE $0048 + partner_jp: \ No newline at end of file