let's dev 1/24/18

shopkeeper dev & bugfixes
This commit is contained in:
Karkat
2018-01-24 00:33:53 -05:00
parent 88babf9ed0
commit 49488755fa
3 changed files with 78 additions and 84 deletions

View File

@@ -26,7 +26,7 @@ org $3FFFFF ; <- 1FFFFF
db #$00 ; expand file to 2mb
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 compasses.asm
incsrc doorframefixes.asm
;incsrc music.asm
incsrc music.asm
incsrc cuccostorm.asm
incsrc roomloading.asm
incsrc icepalacegraphics.asm

View File

@@ -1061,14 +1061,14 @@ JSL.l GetMagicBatItem
;================================================================================
; Replacement Shopkeeper
;--------------------------------------------------------------------------------
org $068BEB ; <- 30BEB - Bank07.asm:1125 - (INC $0BA0, X)
JSL.l SpritePrep_ShopKeeper : RTS
;org $068BEB ; <- 30BEB - Bank07.asm:1125 - (INC $0BA0, X)
;JSL.l SpritePrep_ShopKeeper : RTS
;--------------------------------------------------------------------------------
org $1EEEE3 ; <- F6EE3 - sprite_shopkeeper.asm:7 - (LDA $0E80, X)
JSL.l Sprite_ShopKeeper : RTS
;org $1EEEE3 ; <- F6EE3 - sprite_shopkeeper.asm:7 - (LDA $0E80, X)
;JSL.l Sprite_ShopKeeper : RTS
;--------------------------------------------------------------------------------
org $00D55E ; <- 555E - Bank00.asm:3491 (LDX.w #$2D40)
JSL.l LoadModifiedTileBufferAddress : NOP #2
;org $00D55E ; <- 555E - Bank00.asm:3491 (LDX.w #$2D40)
;JSL.l LoadModifiedTileBufferAddress : NOP #2
;--------------------------------------------------------------------------------
;================================================================================
@@ -1934,21 +1934,34 @@ JSL.l SetOverlayIfLamp
; Overworld Door Frame Overlay Fix
;
; 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
; identify the tavern entrance to determine whether link should walk up or down.
;--------------------------------------------------------------------------------
;org $1BBD5F ; <- Bank1b.asm:296 (LDA $1BBB73, X : STA $010E)
;JSL.l StoreLastEntranceID
;NOP #3
org $1BBD5F ; <- Bank1b.asm:296 (LDA $1BBB73, X : STA $010E)
JSL.l StoreLastOverworldDoorID
NOP #3
;--------------------------------------------------------------------------------
;org $02D754 ; <- Bank02.asm:10847 (LDA $D724, X : STA $0696 : STZ $0698)
;JSL.l CacheDoorFrameData
;NOP #5
org $02D754 ; <- Bank02.asm:10847 (LDA $D724, X : STA $0696 : STZ $0698)
JSL.l CacheDoorFrameData
NOP #5
;--------------------------------------------------------------------------------
;org $0298AD ; <- Bank02.asm:4495 (LDA $010E : CMP.b #$43)
;JSL.l WalkDownIntoTavern
;NOP #1
org $0298AD ; <- Bank02.asm:4495 (LDA $010E : CMP.b #$43)
JSL.l WalkDownIntoTavern
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
;================================================================================
;================================================================================

View File

@@ -79,12 +79,12 @@ macro DrawDigit(value,offset)
LDA.w #56 : STA !BIGRAM, X : INX : INX
LDY $0A : TYA : ASL : TAY : LDA .digit_properties, Y : STA !BIGRAM, X : INX : INX
LDA.w #$0000 : STA !BIGRAM, X : INX : INX
LDA $0E : !ADD.w #$0008 : STA $0E ; move offset 8px right
endmacro
;--------------------------------------------------------------------------------
!COLUMN_LOW = "$7F5020"
!COLUMN_HIGH = "$7F5021"
!COLUMN_LOW = "$7F5022"
!COLUMN_HIGH = "$7F5023"
DrawPrice:
PHX : PHY : PHP
LDY.b #$FF
@@ -109,7 +109,7 @@ DrawPrice:
SEP #$20 ; set 8-bit accumulator
TXA : LSR #3 : STA $06 ; request 1-4 OAM slots
;ASL #2 : JSL.l OAM_AllocateFromRegionB ; request 4-16 bytes
STA $FFFFFF
ASL #2
PHA
LDA $22 : CMP !COLUMN_LOW : !BLT .off
@@ -278,8 +278,9 @@ UploadVRAMTiles:
PLA : STA $4300 ; restore DMA parameters
RTS
;--------------------------------------------------------------------------------
!COLUMN_LOW = "$7F5020"
!COLUMN_HIGH = "$7F5021"
;!SHOP_TYPE = "$7F5051"
;!SCRATCH_CAPACITY = "$7F5020"
;!SCRATCH_TEMP_X = "$7F5021"
Sprite_ShopKeeper:
PHB : PHK : PLB
JSL.l Sprite_PlayerCantPassThrough
@@ -305,71 +306,13 @@ Sprite_ShopKeeper:
; Draw Items
JSR.w Shopkeeper_DrawItems
LDA.b #$00 : STA.l !SKIP_EOR
; $22
; 0x48 - Left
; 0x60 - Midpoint 1
; 0x78 - Center
; 0x90 - Midpoint 2
; 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
RTL
;--------------------------------------------------------------------------------
@@ -387,6 +330,7 @@ Shopkeeper_DrawItems:
PHB : PHK : PLB
PHX : PHY
TXA : STA !SCRATCH_TEMP_X;
LDX.b #$00
LDY.b #$00
LDA !SHOP_TYPE : AND.b #$03
@@ -433,6 +377,9 @@ Shopkeeper_DrawNextItem:
LDA.b #$02
++
PHX : PHA : LDA !SCRATCH_TEMP_X : TAX : PLA : JSR.w RequestItemOAM : PLX
JSR.w Shopkeeper_DrawNextPrice
INY
INX #3
RTS
@@ -444,10 +391,44 @@ dw 56, 40
.tile_indices
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:
PHX : PHY : PHA
STA $06 ; request A OAM slots
LDA $20 : CMP.b #$60 : !BGE .below
LDA $20 : CMP.b #$62 : !BGE .below
.above
LDA 1,s : ASL #2 : JSL.l OAM_AllocateFromRegionA ; request 4A bytes
BRA +