-
Notifications
You must be signed in to change notification settings - Fork 32
update mother brain room barrier patch for expanded objectives #157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,34 +4,70 @@ lorom | |
| !bank_84_freespace_start = $84F200 | ||
| !bank_84_freespace_end = $84F300 | ||
|
|
||
| org $83AAD2 | ||
| dw $EB00 ; Set door ASM for Rinka Room toward Mother Brain | ||
|
|
||
| macro check_objective(i,plm) | ||
| lda.w #$007E | ||
| sta.b $02 | ||
| lda.l ObjectiveAddrs+<i> | ||
| sta.b $00 | ||
| lda.l ObjectiveBitmasks+<i> | ||
| sta.b $04 | ||
| lda.b [$00] | ||
| bit.b $04 | ||
| beq ?skip ; skip clearing if objective not done | ||
| incsrc "constants.asm" | ||
|
|
||
| macro clear_plm(plm) | ||
| jsl $8483D7 | ||
| db <plm> | ||
| db $04 | ||
| dw clear_barrier_plm | ||
| ?skip: | ||
| endmacro | ||
|
|
||
| org $83AAD2 | ||
| dw $EB00 ; Set door ASM for Rinka Room toward Mother Brain | ||
|
|
||
| ; Free space in bank $8F | ||
| org $8FEB00 | ||
| ; clear barriers in mother brain room based on main bosses killed: | ||
| %check_objective(0,$39) | ||
| %check_objective(2,$38) | ||
| %check_objective(4,$37) | ||
| %check_objective(6,$36) | ||
| door_asm_start: | ||
| ; 3 potential scenarios for barriers: | ||
| ; obj_num < 4, clear from left to right | ||
| ; obj_num = 4, stock behavior | ||
| ; obj_num > 4, maintain all 4 until all obj's cleared | ||
| lda !objectives_num : and $7FFF | ||
| beq clear_all ; None ? | ||
| cmp #$0005 | ||
| bcc normal_objs ; <= 4 ? | ||
|
|
||
| ldx #$0000 | ||
| tay | ||
| ; iterate through all obj's | ||
| .check_lp | ||
| jsr check_objective | ||
| beq motherbrain | ||
| dey | ||
| bne .check_lp | ||
|
|
||
| ; either none or all cleared | ||
| clear_all: | ||
| ldx #$FFFB | ||
| bra start_obj_checks | ||
|
|
||
| ; # obj's - 4 | ||
| normal_objs: | ||
| sec | ||
| sbc #$0004 | ||
| tax | ||
|
|
||
| ; starting value of X determines check/clear behavior | ||
| ; X = 0 for stock behavior (4 objs) | ||
| ; X < 0 will clear until 0, then check (for 0-3 objs) | ||
| ; X = -4 will clear all objs | ||
| start_obj_checks: | ||
| jsr check_objective | ||
| beq .skip_1 | ||
| %clear_plm($36) | ||
| .skip_1 | ||
| jsr check_objective | ||
| beq .skip_2 | ||
| %clear_plm($37) | ||
| .skip_2 | ||
| jsr check_objective | ||
| beq .skip_3 | ||
| %clear_plm($38) | ||
| .skip_3 | ||
| jsr check_objective | ||
| beq motherbrain | ||
| %clear_plm($39) | ||
|
|
||
| motherbrain: | ||
| lda $7ed82d | ||
|
|
@@ -46,43 +82,55 @@ motherbrain: | |
| jsl remove_spikes | ||
| done: | ||
| rts | ||
|
|
||
| check_objective: | ||
| ; X >= 0 obj to check; X < 0 = return obj cleared | ||
| ; also increments X | ||
| phx | ||
| txa | ||
| bmi .bypass_check | ||
| asl | ||
| tax | ||
| lda.w #$007E | ||
| sta.b $02 | ||
| lda.l ObjectiveAddrs, X | ||
| sta.b $00 | ||
| lda.l ObjectiveBitmasks, X | ||
| plx | ||
| inx | ||
| sta.b $04 | ||
| lda.b [$00] | ||
| bit.b $04 | ||
| rts | ||
| .bypass_check | ||
| plx | ||
| inx | ||
| lda #$0001 | ||
| rts | ||
|
|
||
| warnpc $8FEBC0 | ||
| org $8FEBC0 | ||
| warnpc !objectives_addrs | ||
|
|
||
| org !objectives_addrs | ||
| ObjectiveAddrs: | ||
| dw $D829, $D82A, $D82B, $D82C | ||
| dw $D829, $D82A, $D82B, $D82C, $D82D | ||
|
||
| dw $D82E, $D82F, $D830, $D831, $D832 | ||
| dw $D833, $D834, $D835, $D836, $D837 | ||
| dw $D838, $D839, $D83A, $D83B, $D83C | ||
| dw $D83D, $D83E, $D83F, $D840, $D841 | ||
| ObjectiveBitmasks: | ||
| dw $0001, $0001, $0001, $0001 | ||
| dw $0001, $0001, $0001, $0001, $0002 | ||
| dw $0001, $0001, $0001, $0001, $0001 | ||
| dw $0001, $0001, $0001, $0001, $0001 | ||
| dw $0001, $0001, $0001, $0001, $0001 | ||
| dw $0001, $0001, $0001, $0001, $0001 | ||
|
|
||
| ; OBJECTIVE: None (must match address in patch.rs) | ||
| warnpc $8FECA0 | ||
| org $8FECA0 | ||
|
|
||
| jsl $8483D7 | ||
| db $39 | ||
| db $04 | ||
| dw clear_barrier_plm | ||
|
|
||
| jsl $8483D7 | ||
| db $38 | ||
| db $04 | ||
| dw clear_barrier_plm | ||
|
|
||
| jsl $8483D7 | ||
| db $37 | ||
| db $04 | ||
| dw clear_barrier_plm | ||
|
|
||
| jsl $8483D7 | ||
| db $36 | ||
| db $04 | ||
| dw clear_barrier_plm | ||
|
|
||
| jmp motherbrain | ||
|
|
||
| jmp clear_all ; this section can be removed once patch.rs is updated | ||
|
|
||
| warnpc $8FED00 | ||
|
|
||
|
|
||
| ; Remove invisible spikes where Mother Brain used to be (common routine used by both the left and right door ASMs) | ||
| org !bank_84_freespace_start | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the zero-objective case doesn't need special handling? It should work being handled the same as <=4 objectives? With zero objectives, X would get initialized to 0-4 = -4, which is the same as what is being done manually?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you remove the clear_all segment, just be sure to update patch.rs too