finished sprite swap (still commented out)

This commit is contained in:
Karkat
2018-04-03 01:01:04 -04:00
parent 9af6bd70bd
commit 4af145d56d
3 changed files with 20 additions and 15 deletions

View File

@@ -26,7 +26,7 @@ org $3FFFFF ; <- 1FFFFF
db #$00 ; expand file to 2mb
org $1FFFF8 ; <- FFFF8 timestamp rom
db #$20, #$18, #$03, #$28 ; year/month/day
db #$20, #$18, #$04, #$02 ; year/month/day
;================================================================================
@@ -76,6 +76,7 @@ db #$20, #$18, #$03, #$28 ; year/month/day
incsrc hooks.asm
incsrc treekid.asm
;incsrc spriteswap.asm
incsrc hashalphabethooks.asm
;org $208000 ; bank #$20

View File

@@ -11,6 +11,7 @@ OnDrawHud:
JSL.l DrawChallengeTimer
JSL.l DrawGoalIndicator
JSL.l DrawDungeonCompassCounts
;JSL.l SwapSpriteIfNecissary
RTL
;--------------------------------------------------------------------------------
;OnDungeonEntrance:

View File

@@ -2,19 +2,31 @@ org $008A01 ; 0xA01 - Bank00.asm (LDA.b #$10 : STA $4304 : STA $4314 : STA $4324
LDA $BC
org $1BEDF9
JSL Palette_ArmorAndGloves ;4bytes
JSL SpriteSwap_Palette_ArmorAndGloves ;4bytes
RTL ;1byte
NOP #$01
org $1BEE1B
JSL Palette_ArmorAndGloves_part_two
JSL SpriteSwap_Palette_ArmorAndGloves_part_two
RTL
!SPRITE_SWAP = "$7F50CD"
;!STABLE_SCRATCH = "$7EC178"
!BANK_BASE = "#$29"
org $BF8000
Palette_ArmorAndGloves:
SwapSpriteIfNecissary:
PHP
SEP #$20 ; set 8-bit accumulator
LDA !SPRITE_SWAP : BEQ + : !ADD !BANK_BASE : CMP $BC : BEQ +
STA $BC
STZ $0710 ; Set Normal Sprite NMI
JSL.l SpriteSwap_Palette_ArmorAndGloves_part_two
+
PLP
RTL
SpriteSwap_Palette_ArmorAndGloves:
{
;DEDF9
LDA !SPRITE_SWAP : BNE .continue
@@ -36,7 +48,7 @@ Palette_ArmorAndGloves:
PHX : PHY : PHA
; Load armor palette
PHB : PHK : PLB
REP #$20
REP #$20 ; set 16-bit accumulator
; Check what Link's armor value is.
LDA $7EF35B : AND.w #$00FF : TAX
@@ -45,14 +57,13 @@ Palette_ArmorAndGloves:
LDA $1BEC06, X : AND.w #$00FF : ASL A : ADC.w #$F000 : STA $00
;replace D308 by 7000 and search
REP #$10
REP #$10 ; set 16-bit index registers
LDA.w #$01E2 ; Target SP-7 (sprite palette 6)
LDX.w #$000E ; Palette has 15 colors
TXY : TAX
;LDA !STABLE_SCRATCH : AND #$00FF : STA $02
LDA.b $BC : AND #$00FF : STA $02
.loop
@@ -72,12 +83,4 @@ Palette_ArmorAndGloves:
INC $15
PLA : PLY : PLX
RTL
}
SpriteSwap_SetSprite:
{
;LDA $BC : CLC : ADC #$32 : STA !STABLE_SCRATCH
JSL Palette_ArmorAndGloves
STZ $0710 ; Set Normal Sprite NMI
RTL
}