Merge pull request #195 from spannerisms/decompressed

More v31.2.0
This commit is contained in:
Lexi Rose
2023-08-26 23:39:21 -05:00
committed by GitHub
19 changed files with 181 additions and 118 deletions

View File

@@ -3,6 +3,7 @@
;--------------------------------------------------------------------------------
LoadLibraryItemGFX:
%GetPossiblyEncryptedItem(LibraryItem, SpriteItemValues)
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
STA.w SpriteID, X
JSL.l PrepDynamicTile_loot_resolved
@@ -30,9 +31,17 @@ LoadBonkItemGFX:
LoadBonkItemGFX_inner:
LDA.b #$00 : STA.l RedrawFlag
JSR LoadBonkItem
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
STA.w SpriteItemType, X
STA.w SpriteID, X
JSL.l PrepDynamicTile
PHA : PHX
LDA.w SpriteID,X : TAX
LDA.l SpriteProperties_standing_width,X : BNE +
LDA.b #$00 : STA.l SpriteOAM : STA.l SpriteOAM+8
+
PLX : PLA
RTL
;--------------------------------------------------------------------------------
DrawBonkItemGFX:
@@ -42,7 +51,7 @@ DrawBonkItemGFX:
BRA .done ; don't draw on the init frame
.skipInit
JSR LoadBonkItem
LDA.w SpriteID,X
JSL.l DrawDynamicTileNoShadow
.done

View File

@@ -10,7 +10,7 @@ dw $0000, $7FFF, $27FF, $5E2D, $7FFF, $1CE7, $7A10, $64A5
.red_shield
dw $0000, $7FFF, $27FF, $5E2D, $4F5F, $1CE7, $2E9C, $14B6
.mirror_shield
dw $0000, $7FFF, $27FF, $5E2D, $7399, $1CE7, $02F9, $0233
dw $0000, $7E4E, $6F44, $1CF5, $7399, $1CE7, $02F9, $0233
.crystal
dw $7FFF, $7FFF, $0000, $5907, $6E0E, $0000, $7FBB, $7672
.off_black

View File

@@ -3,6 +3,7 @@
;--------------------------------------------------------------------------------
SpawnDungeonPrize:
PHX : PHB
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
STA.w ItemReceiptID
TAX
@@ -61,6 +62,7 @@ RTS
PrepPrizeTile:
PHA : PHX : PHY
LDA.w AncillaGet, X
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
STA.w SpriteID,X
JSL.l TransferItemReceiptToBuffer_using_ReceiptID
@@ -69,6 +71,7 @@ RTL
SetItemPose:
PHA
LDA.w DungeonID : BMI .one_handed
LDA.w RoomItemsTaken : BIT.b #$80 : BNE +
.one_handed
PLA
@@ -97,6 +100,7 @@ SetCutsceneFlag:
; Out: c - Cutscene flag $02 if set, $01 if unset.
PHX
LDY.b #$01 ; wrote over
LDA.w DungeonID : BMI .no_cutscene
LDA.w RoomItemsTaken : BIT #$80 : BNE .dungeon_prize
.no_cutscene
PLX
@@ -112,6 +116,7 @@ RTL
AnimatePrizeCutscene:
LDA.w ItemReceiptMethod : CMP.b #$03 : BNE +
JSR.w CrystalOrPendantBehavior : BCC +
LDA.w DungeonID : BMI +
LDA.w RoomItemsTaken : BIT #$80 : BEQ +
SEC
RTL
@@ -148,7 +153,9 @@ RTL
MaybeKeepLootID:
PHA
LDA.w DungeonID : BMI .no_prize
LDA.w RoomItemsTaken : BIT #$80 : BNE .prize
.no_prize
STZ.w ItemReceiptID
STZ.w ItemReceiptPose
PLA

View File

@@ -236,6 +236,7 @@ PostItemGet:
RTL
;--------------------------------------------------------------------------------
PostItemAnimation:
PHB
LDA.b #$00 : STA.l BusyItem ; mark item as finished
LDA.l TextBoxDefer : BEQ +
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
@@ -247,29 +248,32 @@ PostItemAnimation:
JSL.l IncrementChestTurnCounter
+
REP #$20
PEA.w $7E00
PLB : PLB
LDA.w TransparencyFlag : BNE .SP05
LDA.l PalettesCustom_off_black+$00 : STA.l PaletteBuffer+$0170
LDA.l PalettesCustom_off_black+$02 : STA.l PaletteBuffer+$0172
LDA.l PalettesCustom_off_black+$04 : STA.l PaletteBuffer+$0174
LDA.l PalettesCustom_off_black+$06 : STA.l PaletteBuffer+$0176
LDA.l PalettesCustom_off_black+$08 : STA.l PaletteBuffer+$0178
LDA.l PalettesCustom_off_black+$0A : STA.l PaletteBuffer+$017A
LDA.l PalettesCustom_off_black+$0C : STA.l PaletteBuffer+$017C
LDA.l PalettesCustom_off_black+$0E : STA.l PaletteBuffer+$017E
LDA.l PalettesCustom_off_black+$00 : STA.w PaletteBuffer+$0170 : STA.w PaletteBufferAux+$0170
LDA.l PalettesCustom_off_black+$02 : STA.w PaletteBuffer+$0172 : STA.w PaletteBufferAux+$0172
STA.w PaletteBuffer+$0174 : STA.w PaletteBufferAux+$0174
STA.w PaletteBuffer+$0176 : STA.w PaletteBufferAux+$0176
STA.w PaletteBuffer+$0178 : STA.w PaletteBufferAux+$0178
STA.w PaletteBuffer+$017A : STA.w PaletteBufferAux+$017A
STA.w PaletteBuffer+$017C : STA.w PaletteBufferAux+$017C
STA.w PaletteBuffer+$017E : STA.w PaletteBufferAux+$017E
BRA .done
.SP05
LDA.l PalettesCustom_off_black+$00 : STA.l PaletteBuffer+$01B0
LDA.l PalettesCustom_off_black+$02 : STA.l PaletteBuffer+$01B2
LDA.l PalettesCustom_off_black+$04 : STA.l PaletteBuffer+$01B4
LDA.l PalettesCustom_off_black+$06 : STA.l PaletteBuffer+$01B6
LDA.l PalettesCustom_off_black+$08 : STA.l PaletteBuffer+$01B8
LDA.l PalettesCustom_off_black+$0A : STA.l PaletteBuffer+$01BA
LDA.l PalettesCustom_off_black+$0C : STA.l PaletteBuffer+$01BC
LDA.l PalettesCustom_off_black+$0E : STA.l PaletteBuffer+$01BE
LDA.l PalettesCustom_off_black+$00 : STA.w PaletteBuffer+$01B0 : STA.w PaletteBufferAux+$01B0
LDA.l PalettesCustom_off_black+$02 : STA.w PaletteBuffer+$01B2 : STA.w PaletteBufferAux+$01B2
STA.w PaletteBuffer+$01B4 : STA.w PaletteBufferAux+$01B4
STA.w PaletteBuffer+$01B6 : STA.w PaletteBufferAux+$01B6
STA.w PaletteBuffer+$01B8 : STA.w PaletteBufferAux+$01B8
STA.w PaletteBuffer+$01BA : STA.w PaletteBufferAux+$01BA
STA.w PaletteBuffer+$01BC : STA.w PaletteBufferAux+$01BC
STA.w PaletteBuffer+$01BE : STA.w PaletteBufferAux+$01BE
.done
INC.b NMICGRAM
SEP #$20
STZ.w ItemReceiptMethod : LDA.w AncillaGet, X ; thing we wrote over to get here
PLB
RTL
;--------------------------------------------------------------------------------

View File

@@ -44,10 +44,12 @@ TransferItemGFX:
; Only used for shops now but could be used for anything. We should look at how door rando does this
; and try to unify one approach.
REP #$30
LDX.w ItemQueuePtr : BEQ .done
LDX.w ItemStackPtr : BEQ .done
TXA : BIT #$0040 : BNE .fail ; Crash if we have more than 16 queued (should never happen.)
DEX #2
-
LDA.w ItemGFXQueue,X : STA.w ItemGFXPtr
LDA.w ItemTargetQueue,X : STA.w ItemGFXTarget
LDA.l ItemGFXStack,X : STA.w ItemGFXPtr
LDA.l ItemTargetStack,X : STA.w ItemGFXTarget
PHX
JSL.l TransferItemToVRAM
REP #$10
@@ -55,7 +57,9 @@ TransferItemGFX:
DEX #2
BPL -
STZ.w ItemQueuePtr
STZ.w ItemStackPtr
.done
SEP #$30
RTS
.fail
BRK #$00

View File

@@ -142,10 +142,8 @@ CheckEnoughCrystalsForGanon:
RTL
;--------------------------------------------------------------------------------
CheckTowerOpen:
REP #$30
LDA.l GanonsTowerOpenMode : ASL : TAX
JSR.w (.tower_open_modes,X)
SEP #$30
RTL
.tower_open_modes
dw .vanilla
@@ -153,13 +151,15 @@ RTL
.vanilla
LDA.l CrystalsField
AND.w #$007F : CMP.w #$007F
AND.b #$7F : CMP.b #$7F
RTS
.arbitrary_cmp
REP #$30
LDA.l GanonsTowerOpenAddress : TAX
LDA.l $7E0000,X
CMP.l GanonsTowerOpenTarget
SEP #$30
RTS
;---------------------------------------------------------------------------------------------------
@@ -195,10 +195,9 @@ KillGanon:
CMP.b #$06 : BNE .exit
.light_speed
LDA.l OverworldEventDataWRAM+$5B : ORA.b #$20 : STA.l OverworldEventDataWRAM+$5B ; pyramid hole
LDA.b #$08 : STA.l RoomDataWRAM[$00].high ; kill ganon
LDA.b #$02 : STA.l MoonPearlEquipment ; pearl but invisible in menu
REP #$20
LDA.w #$0019 : STA.b GameMode
SEP #$20
.exit
RTL
@@ -267,7 +266,9 @@ RTL
RTS
.arbitrary_cmp
REP #$30
LDA.l PedPullAddress : TAX
LDA.l $7E000,X
LDA.l $7E0000,X
CMP.l PedPullTarget
SEP #$30
RTS

View File

@@ -4,6 +4,7 @@
HeartPieceGet:
PHX : PHY
JSL.l LoadHeartPieceRoomValue
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
TAY
JSL.l MaybeMarkDigSpotCollected
@@ -112,6 +113,7 @@ HeartPieceSpritePrep:
LDA.b #$00 : STA.l RedrawFlag
JSL.l LoadHeartPieceRoomValue
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
STA.w SpriteID, X
JSL.l PrepDynamicTile_loot_resolved
@@ -125,6 +127,7 @@ HeartContainerSpritePrep:
LDA.b #$00 : STA.l RedrawFlag
JSL.l LoadHeartContainerRoomValue ; load item type
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
STA.w SpriteID, X
JSL.l PrepDynamicTile_loot_resolved

View File

@@ -59,10 +59,8 @@ org $00FFEA : dw NMIBounce
org $00FFEE : dw IRQBounce
org $8098AB
NMIBounce: JML $8080C9
IRQBounce: JML $8082D8
NMIBounce: JML.l $8080C9
IRQBounce: JML.l $8082D8
warnpc $8098C0
;================================================================================
@@ -1408,19 +1406,15 @@ MVN $A17E
org $8DFB1F : JSL CheckHUDSilverArrows
org $8DFB29 : BRA UpdateHUDBuffer_update_item_check_arrows
;--------------------------------------------------------------------------------
org $8DF1AB
JSR.w RebuildHUD_update
org $8DDFC8
JSR.w RebuildHUD_update
org $8DF1AB : JSR.w RebuildHUD_update
org $8DDFC8 : JSR.w RebuildHUD_update
org $8DDB88 ; Don't rebuild HUD twice on icon refresh
NOP #3 ; Not sure why this is here
;--------------------------------------------------------------------------------
org $87A205
JSL.l RebuildHUD_update_long
org $8AEF62
JSL.l RebuildHUD_update_long
org $87A1CF
JSL.l RebuildHUD_update_long
org $87A205 : JSL.l RebuildHUD_update_long
org $8AEF62 : JSL.l RebuildHUD_update_long
org $87A1CF : JSL.l RebuildHUD_update_long
org $87A235 : JSL.l RebuildHUD_update_long
;--------------------------------------------------------------------------------
org $8DFFE1
RebuildHUD_update_long:

View File

@@ -48,11 +48,12 @@ Init_Primary:
LDA.l OneMindTimerInit : STA.l OneMindTimerRAM
SEP #$30
LDA.b #$01 : STA.w MEMSEL ; enable fastrom access on upper banks
STA.l OneMindId
LDA.l RomSpeed : STA.w MEMSEL ; enable fastrom access on upper banks
LDA.b #$01 : STA.l OneMindId
LDA.b #$10 : STA.b PlayerSpriteBank ; set default player sprite bank
LDA.b #$81 : STA.w NMITIMEN ; thing we wrote over, turn on NMI & gamepad
LDA.b #(ReturnFromInit>>16)|$80 : PHA : PLB
JML ReturnFromInit

View File

@@ -520,6 +520,7 @@ LoadPowder:
PHX
JSL.l Sprite_SpawnDynamically ; thing we wrote over
%GetPossiblyEncryptedItem(WitchItem, SpriteItemValues)
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
STA.w SpriteID, Y
TYX
@@ -572,6 +573,7 @@ LoadMushroom:
LDA.b #$00 : STA.l RedrawFlag
%GetPossiblyEncryptedItem(MushroomItem, SpriteItemValues)
JSL.l AttemptItemSubstitution
JSR.w ResolveLootID
STA.w SpriteID,X
JSL.l PrepDynamicTile

View File

@@ -183,9 +183,9 @@ endmacro
%ReceiptProps($2B, -4, 0, $1E, $F35C, $FF, skip, bottles) ; 2B - Full bottle (red)
%ReceiptProps($2C, -4, 0, $1E, $F35C, $FF, skip, bottles) ; 2C - Full bottle (green)
%ReceiptProps($2D, -4, 0, $1E, $F35C, $FF, skip, bottles) ; 2D - Full bottle (blue)
%ReceiptProps($2E, -4, 0, $1E, $F36D, $FF, skip, bottles) ; 2E - Potion refill (red)
%ReceiptProps($2F, -4, 0, $1E, $F36E, $FF, skip, bottles) ; 2F - Potion refill (green)
%ReceiptProps($30, -4, 0, $1E, $F36E, $FF, skip, bottles) ; 30 - Potion refill (blue)
%ReceiptProps($2E, -4, 0, $1E, $F36D, $FF, skip, skip) ; 2E - Potion refill (red)
%ReceiptProps($2F, -4, 0, $1E, $F36E, $FF, skip, skip) ; 2F - Potion refill (green)
%ReceiptProps($30, -4, 0, $1E, $F36E, $FF, skip, skip) ; 30 - Potion refill (blue)
%ReceiptProps($31, -4, 0, $30, $F375, $FF, skip, skip) ; 31 - 10 bombs
%ReceiptProps($32, -4, 0, $22, $F366, $FF, dungeon_bigkey, skip) ; 32 - Big key
%ReceiptProps($33, -4, 0, $21, $F368, $FF, dungeon_map, skip) ; 33 - Map
@@ -416,7 +416,7 @@ macro SpriteProps(id, chest_width, standing_width, chest_pal, standing_pal, addr
pullpc
endmacro
%SpriteProps($00, 2, 2, $02, $02, PalettesVanilla_blue_ice+$0E) ; 00 - Fighter sword & Shield
%SpriteProps($00, 0, 2, $05, $02, PalettesVanilla_blue_ice+$0E) ; 00 - Fighter sword & Shield
%SpriteProps($01, 0, 2, $05, $05, PalettesCustom_master_sword) ; 01 - Master sword
%SpriteProps($02, 0, 2, $05, $01, PalettesCustom_tempered_sword) ; 02 - Tempered sword
%SpriteProps($03, 0, 2, $05, $04, PalettesCustom_golden_sword) ; 03 - Golden sword
@@ -452,7 +452,7 @@ endmacro
%SpriteProps($21, 2, 2, $01, $01, PalettesVanilla_red_melon+$0E) ; 21 - Net
%SpriteProps($22, 2, 2, $02, $02, PalettesVanilla_blue_ice+$0E) ; 22 - Blue mail
%SpriteProps($23, 2, 2, $01, $01, PalettesVanilla_red_melon+$0E) ; 23 - Red mail
%SpriteProps($24, 0, 0, $02, $02, PalettesVanilla_blue_ice+$0E) ; 24 - Small key
%SpriteProps($24, 0, 0, $04, $04, PalettesVanilla_blue_ice+$0E) ; 24 - Small key
%SpriteProps($25, 2, 2, $02, $02, PalettesVanilla_blue_ice+$0E) ; 25 - Compass
%SpriteProps($26, 2, 2, $01, $01, PalettesVanilla_red_melon+$0E) ; 26 - Heart container from 4/4
%SpriteProps($27, 2, 2, $02, $02, PalettesVanilla_blue_ice+$0E) ; 27 - Bomb
@@ -590,7 +590,7 @@ endmacro
%SpriteProps($AB, 0, 0, $04, $04, PalettesVanilla_blue_ice+$0E) ; AB - Small key of Thieves' Town
%SpriteProps($AC, 0, 0, $04, $04, PalettesVanilla_blue_ice+$0E) ; AC - Small key of Turtle Rock
%SpriteProps($AD, 0, 0, $04, $04, PalettesVanilla_blue_ice+$0E) ; AD - Small key of Ganon's Tower
%SpriteProps($AE, 2, 2, $04, $04, $0000) ; AE - Reserved
%SpriteProps($AE, 2, 2, $02, $02, $0000) ; AE - Reserved
%SpriteProps($AF, 0, 0, $04, $04, PalettesVanilla_blue_ice+$0E) ; AF - Generic small key
%SpriteProps($B0, 2, 2, $80, $80, PalettesCustom_crystal) ; B0 - Crystal 6
%SpriteProps($B1, 2, 2, $80, $80, PalettesCustom_crystal) ; B1 - Crystal 1
@@ -1032,7 +1032,7 @@ ItemReceiptGraphicsOffsets:
dw $05A0 ; 4D - Arrow capacity (70)
dw $01A0 ; 4E - 1/2 magic
dw $01E0 ; 4F - 1/4 magic
dw $0 ; 50 - Safe master sword
dw $00E0 ; 50 - Safe master sword
dw $0420 ; 51 - Bomb capacity (+5)
dw $0460 ; 52 - Bomb capacity (+10)
dw $0520 ; 53 - Arrow capacity (+5)

View File

@@ -434,7 +434,10 @@ ItemBehavior:
RTS
.single_arrow
INC.w UpdateHUD
LDA.l ArrowMode : BEQ +
LDA.l CurrentArrows : INC : STA.l CurrentArrows ; Should be sole write to this address
INC.w UpdateHUD ; in retro/rupee bow mode.
+
RTS
.rupoor
@@ -626,7 +629,12 @@ ItemBehavior:
.pendant
SEP #$20
LDA.l PendantCounter : INC : STA.l PendantCounter
LSR
SEC : SBC.b #$37
TAX
LDA.w PendantMasks,X : AND.l PendantsField : BNE +
LDA.l PendantCounter : INC : STA.l PendantCounter
+
RTS
.dungeon_crystal
@@ -645,9 +653,12 @@ ItemBehavior:
DEX
BPL -
SEP #$20
ORA.l CrystalsField : STA.l CrystalsField
LDA.l CrystalCounter : INC : STA.l CrystalCounter
TAX
AND.l CrystalsField : BNE +
TXA
ORA.l CrystalsField : STA.l CrystalsField
LDA.l CrystalCounter : INC : STA.l CrystalCounter
+
.done
RTS
@@ -657,7 +668,7 @@ ResolveReceipt:
JSL.l PreItemGet
LDA.w ItemReceiptID
.get_item
JSR.w AttemptItemSubstitution
JSL.l AttemptItemSubstitution
JSR.w HandleBowTracking
JSR.w ResolveLootID
.have_item
@@ -1013,7 +1024,7 @@ AttemptItemSubstitution:
BRA -
.exit
PLA : PLX
RTS
RTL
;--------------------------------------------------------------------------------
CountBottles:
PHX
@@ -1121,3 +1132,5 @@ dw $0004 ; EP
dw $0002 ; HC
dw $0000 ; Sewers
PendantMasks:
db $04, 01, 02

View File

@@ -175,6 +175,7 @@ RTL
;--------------------------------------------------------------------------------
LoadZoraKingItemGFX:
LDA.l $9DE1C3 ; location randomizer writes zora item to
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
STA.w SpriteID,Y
TYX
@@ -190,6 +191,7 @@ JumpToSplashItemTarget:
;--------------------------------------------------------------------------------
LoadCatfishItemGFX:
LDA.l $9DE185 ; location randomizer writes catfish item to
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
STA.w SpriteID, Y
TYX

12
ram.asm
View File

@@ -190,10 +190,10 @@ MessageJunk = $7E0223 ; Zeroed but never used (?)
;
ShopPurchaseFlag = $7E0224 ; $01 = Shop purchase item receipt.
;CoolScratch = $7E0224 ; 0x5C bytes of free ram
ItemQueuePtr = $7E0226 ; Pointer into Item GFX and VRAM target queues. Word length.
ItemStackPtr = $7E0226 ; Pointer into Item GFX and VRAM target queues. Word length.
; If not zero, pointer should always be left pointing at the
; next available slot in the stack during the frame.
SpriteID = $7E0230 ; 0x0A bytes. Receipt ID for main loop sprite we're handling.
ItemGFXQueue = $7E0230 ; Pointers to decompressed item tiles deferred to NMI loading. $10 bytes
ItemTargetQueue = $7E0240 ; Pointers to VRAM targets for ItemGFXQueue. $10 bytes
AncillaVelocityZ = $7E0294 ; 0x0A bytes
AncillaZCoord = $7E029E ; 0x0A bytes
;
@@ -476,7 +476,10 @@ HUDArrowCount = $7EC760 ;
HUDKeyDigits = $7EC764 ;
;
BigRAM = $7EC900 ; Big buffer of free ram (0x1F00)
TotalItemCountTiles = $7ECB00 ; Cached total item count tiles for HUD. Four words high to low.
ItemGFXStack = $7ECB00 ; Pointers to source of decompressed item tiles deferred to NMI loading.
ItemGFXSBankStack = $7ECB20 ; Source bank byte for above.
ItemTargetStack = $7ECB40 ; Pointers to VRAM targets for ItemGFXStack.
TotalItemCountTiles = $7ECF00 ; Cached total item count tiles for HUD. Four words high to low.
;================================================================================
; Bank 7F
@@ -485,7 +488,6 @@ DecompressionBuffer = $7F0000 ; Decompression Buffer. $2000 bytes.
DecompBuffer2 = $7F4000 ; Another buffer
base $7F5000
RedrawFlag: skip 1 ;
skip 2 ; Unused

View File

@@ -105,8 +105,8 @@ SpritePrep_ShopKeeper:
LDX.w #$0000
LDY.w #$0000
-
TYA : CMP.l ShopCapacity : !BLT ++ : JMP .stop : ++
LDA.l ShopContentsTable+1, X : CMP.b #$FF : BNE ++ : JMP .stop : ++
TYA : CMP.l ShopCapacity : !BLT ++ : JMP .done : ++
LDA.l ShopContentsTable+1, X : CMP.b #$FF : BNE ++ : JMP .done : ++
LDA.l ShopContentsTable, X : CMP.l ShopId : BEQ ++ : JMP .next : ++
LDA.l ShopContentsTable+1, X : PHX : TYX : STA.l ShopInventory, X : PLX
@@ -129,29 +129,23 @@ SpritePrep_ShopKeeper:
++
PLY : +++
PHX : PHY
PHX : TYX : LDA.l ShopInventory, X : PLX
SEP #$10
JSL.l ResolveLootIDLong
TAY
REP #$30
LDA.b 1,s : TAX : LDA.l .tile_offsets, X : TAX
JSR.w SetupTileTransfer
PLY : PLX
INY #4
PHX : PHY
PHX : TYX : LDA.l ShopInventory, X : PLX
SEP #$10
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
TAY
REP #$30
LDA.b 1,s : TAX : LDA.l .tile_offsets, X : TAX
JSR.w SetupTileTransfer
PLY : PLX
INY #4
.next
INX #8
JMP -
.stop
REP #$20
LDA.w ItemQueuePtr
DEC #2
AND.w #$00E
STA.w ItemQueuePtr
SEP #$20
.done
SEP #$20
LDA.l ShopType : BIT.b #$20 : BEQ .notTakeAll ; Take-all
.takeAll
@@ -199,19 +193,19 @@ SetupTileTransfer:
TXA : LSR #2
CLC : ADC.w #!FREE_TILE_ALT
.store_target
LDX.w ItemQueuePtr
STA.w ItemTargetQueue,X
LDX.w ItemStackPtr
STA.l ItemTargetStack,X
TYA : ASL : TAX
LDA.l StandingItemGraphicsOffsets,X
LDX.w ItemQueuePtr
STA.w ItemGFXQueue,X
LDX.w ItemStackPtr
STA.l ItemGFXStack,X
TXA
INC #2
AND.w #$000E
STA.w ItemQueuePtr
TDC
STA.l ItemStackPtr
LDA.w #$0000
REP #$10 ; set 16-bit index registers
SEP #$20
RTS
@@ -561,6 +555,7 @@ Shopkeeper_DrawNextItem:
PLY
LDA.l ShopInventory, X ; get item id
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
STA.b Scrap0D
CMP.b #$2E : BNE + : BRA .potion

View File

@@ -87,7 +87,6 @@ SmithItemMode:
db $01 ; #$00 = Classic Tempering Process - #$01 = Quick Item Get (default)
SmithItem:
db $02 ; #$02 = Tempered Sword (default)
org $86B55C ; PC 0x3355C ; sprite_smithy_bros.asm : 634
SmithSword:
db $02 ; #$02 = Tempered Sword (default)
@@ -643,17 +642,17 @@ org $81C6FC ; PC 0xC6FC - Bank01.asm:10344 - (db $00, $00, $01, $02, $00, $06, $
DungeonPrizeReceiptID:
db $00 ; Sewers
db $00 ; Hyrule Castle
db $01 ; Eastern Palace
db $02 ; Desert Palace
db $37 ; Eastern Palace
db $38 ; Desert Palace
db $00 ; Agahnim's Tower
db $06 ; Swamp Palace
db $06 ; Palace of Darkness
db $20 ; Swamp Palace
db $20 ; Palace of Darkness
db $20 ; Misery Mire
db $20 ; Skull Woods
db $06 ; Ice Palace
db $03 ; Tower of Hera
db $06 ; Thieves' Town
db $06 ; Turtle Rock
db $20 ; Ice Palace
db $39 ; Tower of Hera
db $20 ; Thieves' Town
db $20 ; Turtle Rock
;Ether/Nothing: $00
;Green Pendant: $01
;Blue Pendant: $02
@@ -2600,10 +2599,14 @@ dw #$0C00 ; Blue
dw #$1800 ; Green
dw #$0800 ; Yellow
org $B0F032
org $B0F032 ; PC 0x187032
RomSpeed:
db $01 ; $01 = FastROM (default) | $00 = SlowROM
org $B0F033 ; PC 0x187033
;--------------------------------------------------------------------------------
; 0x187032 - 187FFF (unused)
; 0x187033 - 187FFF (unused)
;--------------------------------------------------------------------------------

View File

@@ -30,6 +30,7 @@ RTS
;--------------------------------------------------------------------------------
SpawnTabletItem:
JSL.l LoadOutdoorValue
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
PHA
LDA.b #$EB : STA.l MiniGameTime

View File

@@ -6,7 +6,7 @@
; out: A - Sprite GFX ID
;--------------------------------------------------------------------------------
GetSpriteID:
JSR.w AttemptItemSubstitution
JSL.l AttemptItemSubstitution
JSR.w ResolveLootID
CMP.b #$6D : BEQ .server_F0 ; Server Request F0
CMP.b #$6E : BEQ .server_F1 ; Server Request F1
@@ -32,7 +32,7 @@ RTL
; out: A - Palette
;--------------------------------------------------------------------------------
GetSpritePalette:
JSR AttemptItemSubstitution
JSL.l AttemptItemSubstitution
JSR.w ResolveLootID
.resolved
TAX
@@ -69,6 +69,10 @@ RTL
;-------------------------------------------------------------------------------- 20/847B
LoadDynamicTileOAMTable:
PHP
REP #$20
LDA.w #$0000 : STA.l SpriteOAM : STA.l SpriteOAM+2
LDA.w #$0200 : STA.l SpriteOAM+6
SEP #$20
LDA.b #$24 : STA.l SpriteOAM+4
LDA.w SpriteID,X
@@ -76,27 +80,23 @@ LoadDynamicTileOAMTable:
STA.l SpriteOAM+5 : STA.l SpriteOAM+13
PHX
LDA.l SpriteProperties_standing_width,X : BEQ .narrow
REP #$20
LDA.w #$0000 : STA.l SpriteOAM : STA.l SpriteOAM+2
LDA.w #$0200 : STA.l SpriteOAM+6
BRA .done
.narrow
REP #$20
LDA.w #$0004 : STA.l SpriteOAM
LDA.w #$0000 : STA.l SpriteOAM+2
LDA.w #$0200 : STA.l SpriteOAM+6
LDA.w #$0400 : STA.l SpriteOAM+7 : STA.l SpriteOAM+14
LDA.w #$0000 : STA.l SpriteOAM+14
LDA.w #$0800 : STA.l SpriteOAM+9
LDA.w #$3400 : STA.l SpriteOAM+11
SEP #$20
LDA.b #$04 : STA.l SpriteOAM
.done
TXA
PLX
PLP
RTS
;--------------------------------------------------------------------------------
; DrawDynamicTile
; in: A - Loot ID
@@ -359,23 +359,26 @@ LoadItemPalette:
; Out: A - Sprite palette index
PHX : PHY : PHB
LDA.b #PalettesVanillaBank>>16 : STA.b Scrap0C
LDA.b #$7E
PHA : PLB
PEA $7E00
PLB : PLB
REP #$30
TXA : ASL : TAX
LDA.l SpriteProperties_palette_addr,X : STA.b Scrap0A
LDY.w #$000E
LDA.w RoomIndex : CMP.w #$008C : BEQ .aux
LDA.w TransparencyFlag : BNE .SP05
-
LDA.b [Scrap0A], Y : STA.w PaletteBuffer+$0170,Y
LDA.b [Scrap0A], Y
STA.w PaletteBuffer+$0170,Y
DEY #2
BPL -
LDA.w #$0003
BRA .done
.SP05
-
LDA.b [Scrap0A], Y : STA.w PaletteBuffer+$01B0,Y
LDA.b [Scrap0A], Y
STA.w PaletteBuffer+$01B0,Y
DEY #2
BPL -
LDA.w #$0005
@@ -384,6 +387,23 @@ LoadItemPalette:
PLB : PLY : PLX
INC.b NMICGRAM
RTL
.aux
LDA.w TransparencyFlag : BNE .SP05_aux
-
LDA.b [Scrap0A], Y
STA.w PaletteBufferAux+$0170,Y
DEY #2
BPL -
LDA.w #$0003
BRA .done
.SP05_aux
-
LDA.b [Scrap0A], Y
STA.w PaletteBufferAux+$01B0,Y
DEY #2
BPL -
LDA.w #$0005
BRA .done
TransferVRAMStripes:
JSL.l TransferNewNameStripes

View File

@@ -164,6 +164,8 @@ RenderText_DecompressAndDrawSingle = $8EF4FB
DecompressFontGFX = $8EF572
CopyDecompressedCharToTransferBuffer = $8EF5BC
CopyDecompressedToFullBuffer = $8EF6A8
Trinexx_FinalPhase = $9DADB5
Trinexx_PreFinalPhase = $9DB0D2
;===================================================================================================
; Palettes