let's dev 1/24/18
shopkeeper dev & bugfixes
This commit is contained in:
@@ -26,7 +26,7 @@ org $3FFFFF ; <- 1FFFFF
|
|||||||
db #$00 ; expand file to 2mb
|
db #$00 ; expand file to 2mb
|
||||||
|
|
||||||
org $1FFFF8 ; <- FFFF8 timestamp rom
|
org $1FFFF8 ; <- FFFF8 timestamp rom
|
||||||
db #$20, #$18, #$01, #$21 ; year/month/day
|
db #$20, #$18, #$01, #$23 ; year/month/day
|
||||||
|
|
||||||
;================================================================================
|
;================================================================================
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ incsrc hardmode.asm
|
|||||||
incsrc goalitem.asm
|
incsrc goalitem.asm
|
||||||
incsrc compasses.asm
|
incsrc compasses.asm
|
||||||
incsrc doorframefixes.asm
|
incsrc doorframefixes.asm
|
||||||
;incsrc music.asm
|
incsrc music.asm
|
||||||
incsrc cuccostorm.asm
|
incsrc cuccostorm.asm
|
||||||
incsrc roomloading.asm
|
incsrc roomloading.asm
|
||||||
incsrc icepalacegraphics.asm
|
incsrc icepalacegraphics.asm
|
||||||
|
|||||||
45
hooks.asm
45
hooks.asm
@@ -1061,14 +1061,14 @@ JSL.l GetMagicBatItem
|
|||||||
;================================================================================
|
;================================================================================
|
||||||
; Replacement Shopkeeper
|
; Replacement Shopkeeper
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
org $068BEB ; <- 30BEB - Bank07.asm:1125 - (INC $0BA0, X)
|
;org $068BEB ; <- 30BEB - Bank07.asm:1125 - (INC $0BA0, X)
|
||||||
JSL.l SpritePrep_ShopKeeper : RTS
|
;JSL.l SpritePrep_ShopKeeper : RTS
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
org $1EEEE3 ; <- F6EE3 - sprite_shopkeeper.asm:7 - (LDA $0E80, X)
|
;org $1EEEE3 ; <- F6EE3 - sprite_shopkeeper.asm:7 - (LDA $0E80, X)
|
||||||
JSL.l Sprite_ShopKeeper : RTS
|
;JSL.l Sprite_ShopKeeper : RTS
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
org $00D55E ; <- 555E - Bank00.asm:3491 (LDX.w #$2D40)
|
;org $00D55E ; <- 555E - Bank00.asm:3491 (LDX.w #$2D40)
|
||||||
JSL.l LoadModifiedTileBufferAddress : NOP #2
|
;JSL.l LoadModifiedTileBufferAddress : NOP #2
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
|
|
||||||
;================================================================================
|
;================================================================================
|
||||||
@@ -1934,21 +1934,34 @@ JSL.l SetOverlayIfLamp
|
|||||||
; Overworld Door Frame Overlay Fix
|
; Overworld Door Frame Overlay Fix
|
||||||
;
|
;
|
||||||
; When entering an overworld entrance, if it is an entrance to a simple cave, we
|
; When entering an overworld entrance, if it is an entrance to a simple cave, we
|
||||||
; store the entrance id, then use that (instead of the cave id) to determine the
|
; store the overworld door id, then use that (instead of the cave id) to determine the
|
||||||
; overlay to draw when leaving the cave again. We also use this value to
|
; overlay to draw when leaving the cave again. We also use this value to
|
||||||
; identify the tavern entrance to determine whether link should walk up or down.
|
; identify the tavern entrance to determine whether link should walk up or down.
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
;org $1BBD5F ; <- Bank1b.asm:296 (LDA $1BBB73, X : STA $010E)
|
org $1BBD5F ; <- Bank1b.asm:296 (LDA $1BBB73, X : STA $010E)
|
||||||
;JSL.l StoreLastEntranceID
|
JSL.l StoreLastOverworldDoorID
|
||||||
;NOP #3
|
NOP #3
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
;org $02D754 ; <- Bank02.asm:10847 (LDA $D724, X : STA $0696 : STZ $0698)
|
org $02D754 ; <- Bank02.asm:10847 (LDA $D724, X : STA $0696 : STZ $0698)
|
||||||
;JSL.l CacheDoorFrameData
|
JSL.l CacheDoorFrameData
|
||||||
;NOP #5
|
NOP #5
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
;org $0298AD ; <- Bank02.asm:4495 (LDA $010E : CMP.b #$43)
|
org $0298AD ; <- Bank02.asm:4495 (LDA $010E : CMP.b #$43)
|
||||||
;JSL.l WalkDownIntoTavern
|
JSL.l WalkDownIntoTavern
|
||||||
;NOP #1
|
NOP #1
|
||||||
|
;================================================================================
|
||||||
|
|
||||||
|
;================================================================================
|
||||||
|
; Music fixes
|
||||||
|
;--------------------------------------------------------------------------------
|
||||||
|
org $0282F4 ; <- Bank02.asm:654 (LDY.b #$58 ...)
|
||||||
|
JML.l PreOverworld_LoadProperties_ChooseMusic
|
||||||
|
org $028389 ; <- Bank02.asm:763
|
||||||
|
PreOverworld_LoadProperties_SetSong:
|
||||||
|
;--------------------------------------------------------------------------------
|
||||||
|
org $05CC58 ; <- Bank05.asm:1307 (LDA $040A : CMP.b #$18)
|
||||||
|
JSL PsychoSolder_MusicCheck
|
||||||
|
NOP #1
|
||||||
;================================================================================
|
;================================================================================
|
||||||
|
|
||||||
;================================================================================
|
;================================================================================
|
||||||
|
|||||||
109
shopkeeper.asm
109
shopkeeper.asm
@@ -83,8 +83,8 @@ macro DrawDigit(value,offset)
|
|||||||
LDA $0E : !ADD.w #$0008 : STA $0E ; move offset 8px right
|
LDA $0E : !ADD.w #$0008 : STA $0E ; move offset 8px right
|
||||||
endmacro
|
endmacro
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
!COLUMN_LOW = "$7F5020"
|
!COLUMN_LOW = "$7F5022"
|
||||||
!COLUMN_HIGH = "$7F5021"
|
!COLUMN_HIGH = "$7F5023"
|
||||||
DrawPrice:
|
DrawPrice:
|
||||||
PHX : PHY : PHP
|
PHX : PHY : PHP
|
||||||
LDY.b #$FF
|
LDY.b #$FF
|
||||||
@@ -109,7 +109,7 @@ DrawPrice:
|
|||||||
|
|
||||||
SEP #$20 ; set 8-bit accumulator
|
SEP #$20 ; set 8-bit accumulator
|
||||||
TXA : LSR #3 : STA $06 ; request 1-4 OAM slots
|
TXA : LSR #3 : STA $06 ; request 1-4 OAM slots
|
||||||
;ASL #2 : JSL.l OAM_AllocateFromRegionB ; request 4-16 bytes
|
STA $FFFFFF
|
||||||
ASL #2
|
ASL #2
|
||||||
PHA
|
PHA
|
||||||
LDA $22 : CMP !COLUMN_LOW : !BLT .off
|
LDA $22 : CMP !COLUMN_LOW : !BLT .off
|
||||||
@@ -278,8 +278,9 @@ UploadVRAMTiles:
|
|||||||
PLA : STA $4300 ; restore DMA parameters
|
PLA : STA $4300 ; restore DMA parameters
|
||||||
RTS
|
RTS
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
!COLUMN_LOW = "$7F5020"
|
;!SHOP_TYPE = "$7F5051"
|
||||||
!COLUMN_HIGH = "$7F5021"
|
;!SCRATCH_CAPACITY = "$7F5020"
|
||||||
|
;!SCRATCH_TEMP_X = "$7F5021"
|
||||||
Sprite_ShopKeeper:
|
Sprite_ShopKeeper:
|
||||||
PHB : PHK : PLB
|
PHB : PHK : PLB
|
||||||
JSL.l Sprite_PlayerCantPassThrough
|
JSL.l Sprite_PlayerCantPassThrough
|
||||||
@@ -305,8 +306,6 @@ Sprite_ShopKeeper:
|
|||||||
; Draw Items
|
; Draw Items
|
||||||
JSR.w Shopkeeper_DrawItems
|
JSR.w Shopkeeper_DrawItems
|
||||||
|
|
||||||
LDA.b #$00 : STA.l !SKIP_EOR
|
|
||||||
|
|
||||||
; $22
|
; $22
|
||||||
; 0x48 - Left
|
; 0x48 - Left
|
||||||
; 0x60 - Midpoint 1
|
; 0x60 - Midpoint 1
|
||||||
@@ -314,62 +313,6 @@ Sprite_ShopKeeper:
|
|||||||
; 0x90 - Midpoint 2
|
; 0x90 - Midpoint 2
|
||||||
; 0xA8 - Right
|
; 0xA8 - Right
|
||||||
|
|
||||||
LDA.b #$00 : STA !COLUMN_LOW
|
|
||||||
LDA.b #$60 : STA !COLUMN_HIGH
|
|
||||||
REP #$20 ; set 16-bit accumulator
|
|
||||||
LDA.w #80 : STA $0C ; set value
|
|
||||||
LDA.w #-40 : STA $0E ; set coordinate
|
|
||||||
JSR.w DrawPrice
|
|
||||||
SEP #$20 : STA $06 ; set 8-bit accumulator & store result
|
|
||||||
PHA
|
|
||||||
STZ $07
|
|
||||||
LDA.b #!BIGRAM : STA $08
|
|
||||||
LDA.b #!BIGRAM>>8 : STA $09
|
|
||||||
LDA.b #$7E : PHA : PLB ; set data bank to $7E
|
|
||||||
JSL.l Sprite_DrawMultiple_quantity_preset
|
|
||||||
PHK : PLB
|
|
||||||
LDA 1,s
|
|
||||||
ASL #2 : !ADD $90 : STA $90 ; increment oam pointer
|
|
||||||
PLA
|
|
||||||
!ADD $92 : STA $92
|
|
||||||
|
|
||||||
LDA.b #$60 : STA !COLUMN_LOW
|
|
||||||
LDA.b #$90 : STA !COLUMN_HIGH
|
|
||||||
REP #$20 ; set 16-bit accumulator
|
|
||||||
LDA.w #10 : STA $0C ; set value
|
|
||||||
LDA.w #8 : STA $0E ; set coordinate
|
|
||||||
JSR.w DrawPrice
|
|
||||||
SEP #$20 : STA $06 ; set 8-bit accumulator & store result
|
|
||||||
PHA
|
|
||||||
STZ $07
|
|
||||||
LDA.b #!BIGRAM : STA $08
|
|
||||||
LDA.b #!BIGRAM>>8 : STA $09
|
|
||||||
LDA.b #$7E : PHA : PLB ; set data bank to $7E
|
|
||||||
JSL.l Sprite_DrawMultiple_quantity_preset
|
|
||||||
PHK : PLB
|
|
||||||
LDA 1,s
|
|
||||||
ASL #2 : !ADD $90 : STA $90 ; increment oam pointer
|
|
||||||
PLA
|
|
||||||
!ADD $92 : STA $92
|
|
||||||
|
|
||||||
LDA.b #$90 : STA !COLUMN_LOW
|
|
||||||
LDA.b #$FF : STA !COLUMN_HIGH
|
|
||||||
REP #$20 ; set 16-bit accumulator
|
|
||||||
LDA.w #500 : STA $0C ; set value
|
|
||||||
LDA.w #56 : STA $0E ; set coordinate
|
|
||||||
JSR.w DrawPrice
|
|
||||||
SEP #$20 : STA $06 ; set 8-bit accumulator & store result
|
|
||||||
PHA
|
|
||||||
STZ $07
|
|
||||||
LDA.b #!BIGRAM : STA $08
|
|
||||||
LDA.b #!BIGRAM>>8 : STA $09
|
|
||||||
LDA.b #$7E : PHA : PLB ; set data bank to $7E
|
|
||||||
JSL.l Sprite_DrawMultiple_quantity_preset
|
|
||||||
PHK : PLB
|
|
||||||
LDA 1,s
|
|
||||||
ASL #2 : !ADD $90 : STA $90 ; increment oam pointer
|
|
||||||
PLA
|
|
||||||
!ADD $92 : STA $92
|
|
||||||
PLB
|
PLB
|
||||||
RTL
|
RTL
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
@@ -387,6 +330,7 @@ Shopkeeper_DrawItems:
|
|||||||
PHB : PHK : PLB
|
PHB : PHK : PLB
|
||||||
PHX : PHY
|
PHX : PHY
|
||||||
TXA : STA !SCRATCH_TEMP_X;
|
TXA : STA !SCRATCH_TEMP_X;
|
||||||
|
|
||||||
LDX.b #$00
|
LDX.b #$00
|
||||||
LDY.b #$00
|
LDY.b #$00
|
||||||
LDA !SHOP_TYPE : AND.b #$03
|
LDA !SHOP_TYPE : AND.b #$03
|
||||||
@@ -433,6 +377,9 @@ Shopkeeper_DrawNextItem:
|
|||||||
LDA.b #$02
|
LDA.b #$02
|
||||||
++
|
++
|
||||||
PHX : PHA : LDA !SCRATCH_TEMP_X : TAX : PLA : JSR.w RequestItemOAM : PLX
|
PHX : PHA : LDA !SCRATCH_TEMP_X : TAX : PLA : JSR.w RequestItemOAM : PLX
|
||||||
|
|
||||||
|
JSR.w Shopkeeper_DrawNextPrice
|
||||||
|
|
||||||
INY
|
INY
|
||||||
INX #3
|
INX #3
|
||||||
RTS
|
RTS
|
||||||
@@ -444,10 +391,44 @@ dw 56, 40
|
|||||||
.tile_indices
|
.tile_indices
|
||||||
db $C0, $C2, $C4
|
db $C0, $C2, $C4
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
|
!COLUMN_LOW = "$7F5022"
|
||||||
|
!COLUMN_HIGH = "$7F5023"
|
||||||
|
Shopkeeper_DrawNextPrice:
|
||||||
|
PHB : PHK : PLB
|
||||||
|
PHX : PHY : PHP
|
||||||
|
|
||||||
|
REP #$20 ; set 16-bit accumulator
|
||||||
|
PHY
|
||||||
|
TYA : ASL : TAY
|
||||||
|
LDA.w .price_columns, Y : STA !COLUMN_LOW
|
||||||
|
LDA.w .price_offsets, Y : STA $0E ; set coordinate
|
||||||
|
PLY
|
||||||
|
LDA.l !SHOP_INVENTORY+1, X : STA $0C ; set value
|
||||||
|
JSR.w DrawPrice
|
||||||
|
SEP #$20 : STA $06 : STZ $07 ; set 8-bit accumulator & store result
|
||||||
|
PHA
|
||||||
|
LDA.b #!BIGRAM : STA $08
|
||||||
|
LDA.b #!BIGRAM>>8 : STA $09
|
||||||
|
LDA.b #$7E : PHA : PLB ; set data bank to $7E
|
||||||
|
|
||||||
|
PHX : PHA : LDA !SCRATCH_TEMP_X : TAX : PLA : JSL.l Sprite_DrawMultiple_quantity_preset : PLX
|
||||||
|
|
||||||
|
LDA 1,s
|
||||||
|
ASL #2 : !ADD $90 : STA $90 ; increment oam pointer
|
||||||
|
PLA
|
||||||
|
!ADD $92 : STA $92
|
||||||
|
PLP : PLY : PLX
|
||||||
|
PLB
|
||||||
|
RTS
|
||||||
|
.price_columns
|
||||||
|
db #$00, #$60, #$60, #$90, #$90, $FF
|
||||||
|
.price_offsets
|
||||||
|
dw #-40, #8, #56
|
||||||
|
;--------------------------------------------------------------------------------
|
||||||
RequestItemOAM:
|
RequestItemOAM:
|
||||||
PHX : PHY : PHA
|
PHX : PHY : PHA
|
||||||
STA $06 ; request A OAM slots
|
STA $06 ; request A OAM slots
|
||||||
LDA $20 : CMP.b #$60 : !BGE .below
|
LDA $20 : CMP.b #$62 : !BGE .below
|
||||||
.above
|
.above
|
||||||
LDA 1,s : ASL #2 : JSL.l OAM_AllocateFromRegionA ; request 4A bytes
|
LDA 1,s : ASL #2 : JSL.l OAM_AllocateFromRegionA ; request 4A bytes
|
||||||
BRA +
|
BRA +
|
||||||
|
|||||||
Reference in New Issue
Block a user