Merge pull request #29 from KevinCathcart/base_rom_updates

Base rom updates
This commit is contained in:
Karkat
2018-02-23 21:00:08 -05:00
committed by GitHub
10 changed files with 178 additions and 20 deletions

View File

@@ -157,6 +157,7 @@ incsrc init.asm
org $A48000 ; code bank - PUT NEW CODE HERE
incsrc openmode.asm
incsrc quickswap.asm
incsrc endingsequence.asm
;org $228000 ; contrib area
@@ -328,6 +329,9 @@ DecompSwordGfx:
org $00D348
DecompShieldGfx:
org $00D463
Tagalong_LoadGfx:
org $00D51B
GetAnimatedSpriteTile:

View File

@@ -98,3 +98,20 @@ MakeBunny:
PLY : PLX
RTS
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; fix issue where cross world caves (in Entrance randomizer) don't cause
; frog to become smith or vice versa.
FixFrogSmith:
LDA.l $7EF3CA : BNE .darkWorld
LDA.l $7EF3CC : CMP.b #$07 : BNE .done
LDA.b #$08 : STA.l $7EF3CC ; make frog into smith in light world
BRA .loadgfx
.darkWorld
LDA.l $7EF3CC : CMP.b #$08 : BNE .done
LDA.b #$07 : STA.l $7EF3CC ; make smith into frog in dark world
.loadgfx
JSL Tagalong_LoadGfx
.done
RTS
;--------------------------------------------------------------------------------

View File

@@ -23,4 +23,16 @@ RTS
+
LDA.w #$0000
RTS
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
SmithDoorCheck:
LDA.l SmithTravelsFreely : AND.w #$00FF : BEQ .orig
;If SmithTravelsFreely is set Frog/Smith can enter multi-entrance overworld doors
JMP.l Overworld_Entrance_BRANCH_RHO
.orig ; The rest is equivlent to what we overwrote
CPX.w #$0076 : !BGE +
JMP.l Overworld_Entrance_BRANCH_LAMBDA
+
JMP.l Overworld_Entrance_BRANCH_RHO
;--------------------------------------------------------------------------------

View File

@@ -13,18 +13,10 @@ OnDrawHud:
JSL.l DrawDungeonCompassCounts
RTL
;--------------------------------------------------------------------------------
OnDungeonEntrance:
PHA : PHP
SEP #$20 ; set 8-bit accumulator
LDA $040C : CMP #$FF : BEQ + ; don't do this unless it's a real dungeon
REP #$20 : LDA $A0 : CMP.w #18 : BEQ + : SEP #$20 ; skip if we're in the sanctuary
LDA $7EF3CC ; load follower
CMP #$0C : BNE + ; skip if not the purple chest
LDA #$00 : STA $7EF3CC
+ ; this might get hit from above in either accumulator mode
PLP : PLA
STA $7EC172 ; thing we wrote over
RTL
;OnDungeonEntrance:
;
; STA $7EC172 ; thing we wrote over
;RTL
;--------------------------------------------------------------------------------
OnDungeonExit:
STA $040C : STZ $04AC ; thing we wrote over

View File

@@ -31,10 +31,10 @@ ReturnCheckZSNES:
;--------------------------------------------------------------------------------
;================================================================================
; Dungeon Entrance Hook
; Dungeon Entrance Hook (works, but not needed at the moment)
;--------------------------------------------------------------------------------
org $02D8C7 ; <- 158C7 - Bank02.asm : 10981 (STA $7EC172)
JSL.l OnDungeonEntrance
;org $02D8C7 ; <- 158C7 - Bank02.asm : 10981 (STA $7EC172)
;JSL.l OnDungeonEntrance
;--------------------------------------------------------------------------------
;================================================================================
@@ -1179,6 +1179,9 @@ JSL.l HUDRebuildIndoor : NOP #4
org $029A35 ; <- 11A35 : Bank02.asm:4789 - (JSL HUD.RebuildIndoor.palace)
JSL.l HUDRebuildIndoorHole
;--------------------------------------------------------------------------------
org $0DFCEC ; <- 6FCEC : headsup_display.asm:887 - (LDA.w #$007F : STA $05)
LDA.w #$7F7F : STA $04 ; Have both key digits default to blank
org $0DFD02 ; <- 6FD02 ; headsup_display.asm:900 - (LDA $05 : AND.w #$00FF : ORA.w #$2400 : STA $7EC764)
JSL.l DrawKeyIcon : NOP #8
;--------------------------------------------------------------------------------
@@ -2085,3 +2088,30 @@ JSL.l ArrowGame : NOP #14
org $07A06C ; <- Bank07.asm:5215 (LDA $7EF377 : BEQ BRANCH_EPSILON)
JSL.l DecrementArrows : SKIP #2 : NOP #5
;================================================================================
;================================================================================
; Quick Swap
;--------------------------------------------------------------------------------
org $0287FB ; <- 107FB - Bank02.asm:1526 (LDA $F6 : AND.b #$40 : BEQ .dontActivateMap)
JSL.l QuickSwap
org $02A451 ; <- 12451 - Bank02.asm:6283 (LDA $F6 : AND.b #$40 : BEQ .xButtonNotDown)
JSL.l QuickSwap
;================================================================================
;================================================================================
; Tagalong Fixes
;--------------------------------------------------------------------------------
org $0689A7 ; <- 309A7 - sprite_prep.asm: 647 (LDA $7EF3CC : CMP.b #$06 : BEQ .killSprite)
; Note: In JP 1.0 we have: (CMP.b #$00 : BNE .killSprite) appling US bugfix
; Prevent followers from causing blind/maiden to despawn:
CMP.b #$06 : db #$F0 ; BEQ
;--------------------------------------------------------------------------------
;Control which doors frog/smith can enter
org $1BBCF0 ; <- DBCF0 - Bank1B.asm: 248 (LDA $04B8 : BNE BRANCH_MU)
Overworld_Entrance_BRANCH_LAMBDA: ; Branch here to show Cannot Enter with Follower message
org $1BBD55 ; <- DBD55 - Bank1B.asm: 290 (CPX.w #$0076 : BCC BRANCH_LAMBDA)
JML.l SmithDoorCheck : NOP
Overworld_Entrance_BRANCH_RHO: ; branch here to continue into door
;================================================================================

View File

@@ -53,7 +53,7 @@ RTL
LDA.b #$20 : STA $012F ; menu select sound
JSL.l ResetEquipment
RTL
.y_pressed
.y_pressed ; Note: used as entry point by quickswap code. Must preserve X.
LDA.b #$10 : STA $0207
LDA $0202 ; check selected item
CMP #$02 : BNE + ; boomerang

View File

@@ -3,6 +3,7 @@ PreOverworld_LoadProperties_ChooseMusic:
; A: scratch space (value never used)
; Y: set to overworld animated tileset
; X: set to music track/command id
JSR.w FixFrogSmith ; Just a convenient spot to install this hook
LDY.b #$58 ; death mountain animated tileset.

93
quickswap.asm Normal file
View File

@@ -0,0 +1,93 @@
; Thanks to Kazuto for developing the original QS code that inspired this one
QuickSwap:
; We perform all other checks only if we are pushing L or R in order to have minimal
; perf impact, since this runs every frame
LDA.b $F6 : AND #$30 : BEQ .done
XBA ; stash away the value for after the checks.
LDA.l QuickSwapFlag : BEQ .done
LDA.w $0202 : BEQ .done ; Skip everything if we don't have any items
;TODO add romtype and race rom checks here
PHX
XBA ; restore the stashed value
CMP.b #$30 : BNE +
; If prossing both L and R this frame, then go directly to the special swap code
LDX.w $0202 : BRA .special_swap
+
BIT #$10 : BEQ + ; Only pressed R
JSR.w RCode
LDA.b $F2 : BIT #$20 : BNE .special_swap ; Still holding L from a previous frame
BRA .store
+
; Only pressed L
JSR.w LCode
LDA.b $F2 : BIT #$10 : BNE .special_swap ; Still holding R from a previous frame
BRA .store
.special_swap
CPX.b #$02 : BEQ + ; boomerang
CPX.b #$01 : BEQ + ; bow
CPX.b #$05 : BEQ + ; powder
CPX.b #$0D : BEQ + ; flute
BRA .store
+ STX $0202 : JSL ProcessMenuButtons_y_pressed
.store
LDA.b #$20 : STA.w $012F
STX $0202
JSL HUD_RefreshIconLong
PLX
.done
LDA.b $F6 : AND.b #$40 ;what we wrote over
RTL
RCode:
LDA.w $0202 : TAX
-
CPX.b #$0F : BNE + ; incrementing into bottle
LDX.b #$00 : BRA ++
+ CPX.b #$10 : BNE + ; incrementing bottle
LDA.l $7EF34F : TAX
-- : ++
CPX.b #$04 : BEQ .noMoreBottles
INX
LDA.l $7EF35B,X : BEQ --
TXA : STA.l $7EF34F
LDX #$10
RTS
.noMoreBottles
LDX #$11
BRA .nextItem
+ CPX.b #$14 : BNE + : LDX.b #$00 ;will wrap around to 1
+ INX
.nextItem
JSL.l IsItemAvailable : BEQ -
RTS
LCode:
LDA.w $0202 : TAX
-
CPX.b #$11 : BNE + ; decrementing into bottle
LDX.b #$05 : BRA ++
+ CPX.b #$10 : BNE + ; decrementing bottle
LDA.l $7EF34F : TAX
-- : ++
CPX.b #$01 : BEQ .noMoreBottles
DEX
LDA.l $7EF35B,X : BEQ --
TXA : STA.l $7EF34F
LDX.b #$10
RTS
.noMoreBottles
LDX.b #$0F : BRA .nextItem
+ CPX.b #$01 : BNE + : LDX.b #$15 ; will wrap around to $14
+ DEX
.nextItem
JSL.l IsItemAvailable : BEQ -
RTS

View File

@@ -197,6 +197,14 @@ org $30804A ; PC 0x18004A
InvertedMode:
db #$00 ; #$00 = Normal (default) - #$01 = Inverted
;--------------------------------------------------------------------------------
org $30804B ; PC 0x18004B
QuickSwapFlag:
db #$00 ; #$00 = Off (default) - #$01 = On
;--------------------------------------------------------------------------------
org $30804C ; PC 0x18004C
SmithTravelsFreely:
db #$00 ; #$00 = Off (default) - #$01 = On (frog/smith can enter multi-entrance doors)
;--------------------------------------------------------------------------------
org $308080 ; PC 0x180080
Upgrade5BombsRefill:
db #$00

View File

@@ -2,8 +2,9 @@
; Spawn Zelda (or not)
;--------------------------------------------------------------------------------
SpawnZelda:
LDA.l $7EF3CC : CMP #$08 : BEQ + ; don't spawn if dwarf is present
CMP #$0C : BEQ + ; don't spawn if purple chest is present
LDA.l $7EF3CC : CMP #$08 : BEQ + ; don't spawn if dwarf is present
CMP #$07 : BEQ + ; don't spawn if frog is present
CMP #$0C : BEQ + ; don't spawn if purple chest is present
CLC : RTL
+
SEC
@@ -14,4 +15,4 @@ EndRainState:
LDA.b #$02 : STA $7EF3C5 ; end rain state
+
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------