From a949230f34943594ac0fc561f5a803021618ebeb Mon Sep 17 00:00:00 2001 From: Kara Alexandra Date: Sun, 24 Nov 2024 22:08:05 -0600 Subject: [PATCH] Variable I-Frames --- LTTP_RND_GeneralBugfixes.asm | 1 + data/c2807_v4.bin | Bin 2048 -> 2048 bytes data/c2807_v4.gfx | Bin 1518 -> 1504 bytes data/customitems.4bpp | Bin 5120 -> 5120 bytes events.asm | 6 ++--- iframes.asm | 45 +++++++++++++++++++++++++++++++++++ itemdatatables.asm | 10 ++++---- newitems.asm | 7 +++++- pendantcrystalhud.asm | 4 +++- sram.asm | 6 +++-- 10 files changed, 67 insertions(+), 12 deletions(-) create mode 100644 iframes.asm diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index ef8e0fc..81e2742 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -162,6 +162,7 @@ incsrc lift.asm incsrc mothula.asm incsrc switches.asm incsrc zoom_on_carry.asm +incsrc iframes.asm warnpc $A58000 org $A28000 diff --git a/data/c2807_v4.bin b/data/c2807_v4.bin index 328b31d29ff13fdfda8536e4a72e7cb2ff8a85f7..2023b0b43738e02dc62f6577535791938dc6012b 100644 GIT binary patch delta 86 zcmZn=Xb{-2fmz}I|BnB+f$# delta 86 zcmZn=Xb{-2fmz{S{onn+?|*;){`>vk`~TMeL+4Mvz^uUk9~Dgg&wNk-UE$^nEC$Q~ D>=8jA diff --git a/data/c2807_v4.gfx b/data/c2807_v4.gfx index 82d79c9534580887f7220fbb5da0fb070f9cb3ef..29994a64fbb1908d21ed8f3c96dd8fd2273f00a0 100644 GIT binary patch delta 669 zcmWNNT}V@57{}ke=RL=dQ96kt6(u!uM3>brf$W#$gJGv_u* z^mya>_~Z6m?Ev(jj@9p8WF>JNV&e$VfDOlR6Te2{UF;*pw8 z=EbNy^3Yu=`|b={eIh(Tq;9RGthu5lK1|e6L?>SSa5#=~Y?CYXaB9F$e8V<2akdeI z7ik@a0+hbPj&4w*>LXM!_R{)G9BbtTZ0@A;pMPi8bBo9TYhKKd)mW0U3_f8uv_u=g zwy?dM27A)I`h&r&cLJ@9<<|OqIXf4p$w>1{OrfI3<=^)cuu+&tSvv)K)9 z1=I~oJp|i17<|vgbkTzNC;EkDg?~x=uj9aXtY94ieSOU-|56uj;xcCSUgM2aTfvcJ zaU}7)0dxkh?S~ttR9&X4G8wn4CwS(?I5Dc&2^U8qGAM@wawH~`MQ%@CWn9)>N@$;v zWR)kmnFz1QBvEIE$`ywx)Fuxx2dWhMSN!4DOQP3VvT06>Nudtp$)vt2le91W)Brnn zJTj-)jjT9LGZ-vr=W6z z@AGvE_q{S$itq_(3Y#5KkBajRDh_b#Wwm{y+@3Ku%lJOo{ zrgw|p-b^oMY#UAu?4yK4LXl1qaSKpX#!s4qVyi~Ac0uc)8jMS#{26c1r`M8JLKtN& zb!>-mt(ziUTsQI40=X2z$Dw{l9=l+MMHe_g(e!2_MB=VpNIsD8osGtQxNOs(kK>?o*9=wV4mssdP3kwEZwXA4#g)j3DtUnrGloMU5J4^@$V`tQnv^rAjQNQpTgTWwAnyPtO GN&W{XDO?o* diff --git a/data/customitems.4bpp b/data/customitems.4bpp index 83e41beaa0396faa72598f825451e28402244cd8..8f8bfafd9921b1d6857d1e47718726f76e4b8934 100644 GIT binary patch delta 63 zcmZqBXwcZOjz>_B0R$Qt9Do=E^fvG3dB`YT&+s1%>l@aAg##I`GK2zgAj7)NyZKyM E0RmbPApigX delta 63 zcmZqBXwcZOjz>_20R$Qt9Do=EWH#^TdB`Yj$FPUtAHzL{x`sJmVI_t&3`q>PfOyX4 I-F&XB0OD5<{Qv*} diff --git a/events.asm b/events.asm index 78dcfed..b7fb316 100644 --- a/events.asm +++ b/events.asm @@ -123,9 +123,9 @@ OnFileCreation: MVN CartridgeSRAM>>16, InitSRAMTable>>16 PLB - ; initialize rewind table - LDA.w #$0000 - STA.l RewindTriggerSRAM + ; initialize rewind table and IFrames + LDA.w #$0014 + STA.l IFramesSRAM ; low byte i-frames, high byte rewind trigger LDA.w #$FFFF STA.l RewindRoomIdSRAM diff --git a/iframes.asm b/iframes.asm new file mode 100644 index 0000000..57ecfab --- /dev/null +++ b/iframes.asm @@ -0,0 +1,45 @@ +pushpc + +org $8780B9 +JSL CalcIFrames +NOP + +pullpc + +CalcIFrames: + LDA.l IFrames + STA.w $031F + RTL + +DrawIFrames: + LDA.l IFrames + AND.w #$00FF + JSL HexToDec + + LDY.w #$16EE + LDA.w #$253B + STA.w $0000, Y + LDA.w #$253C + STA.w $0002, Y + + LDA.l HexToDecDigit3 + AND.w #$00FF + BEQ + + CLC : ADC.w #$2416 + STA.w $003E, Y ++ + LDA.l HexToDecDigit4 + AND.w #$00FF + BNE + + LDA.w #$0011 ++ CLC : ADC.w #$2416 + STA.w $0040, Y + + LDA.l HexToDecDigit5 + AND.w #$00FF + BNE + + LDA.w #$0011 ++ CLC : ADC.w #$2416 + STA.w $0042, Y + + RTL diff --git a/itemdatatables.asm b/itemdatatables.asm index 42c4da0..b1e9a35 100644 --- a/itemdatatables.asm +++ b/itemdatatables.asm @@ -321,7 +321,7 @@ endmacro %ReceiptProps($B6, -4, 0, $28, $F36A, $FF, free_crystal, skip) ; B6 - Crystal 3 %ReceiptProps($B7, -4, 0, $49, $F36A, $FF, skip, skip) ; B7 - Reserved %ReceiptProps($B8, -4, 0, $52, $F36A, $FF, teleporter, skip) ; B8 - Teleporter -%ReceiptProps($B9, -4, 0, $49, $F36A, $FF, skip, skip) ; B9 - +%ReceiptProps($B9, -4, 0, $53, $F36A, $FF, i_frames, skip) ; B9 - 10 IFrames %ReceiptProps($BA, -4, 0, $49, $F36A, $FF, skip, skip) ; BA - %ReceiptProps($BB, -4, 0, $49, $F36A, $FF, skip, skip) ; BB - %ReceiptProps($BC, -4, 0, $49, $F36A, $FF, skip, skip) ; BC - @@ -600,7 +600,7 @@ endmacro %SpriteProps($B6, 2, 2, $80, $80, PalettesCustom_crystal) ; B6 - Crystal 3 %SpriteProps($B7, 2, 2, $80, $80, $0000) ; B7 - Reserved %SpriteProps($B8, 2, 2, $01, $01, PalettesVanilla_red_melon+$0E) ; B8 - Teleporter -%SpriteProps($B9, 2, 2, $04, $04, $0000) ; B9 - +%SpriteProps($B9, 2, 2, $01, $01, PalettesVanilla_red_melon+$0E) ; B9 - 10 IFrames %SpriteProps($BA, 2, 2, $04, $04, $0000) ; BA - %SpriteProps($BB, 2, 2, $04, $04, $0000) ; BB - %SpriteProps($BC, 2, 2, $04, $04, $0000) ; BC - @@ -876,7 +876,7 @@ endmacro %InventoryItem($B6, $0080, $0000, $0000) ; B6 - Crystal 3 %InventoryItem($B7, $0000, $0000, $0000) ; B7 - Reserved %InventoryItem($B8, $0081, $0000, $0000) ; B8 - Teleporter -%InventoryItem($B9, $0001, $0000, $0000) ; B9 - +%InventoryItem($B9, $0081, $0000, $0000) ; B9 - 10 IFrames %InventoryItem($BA, $0001, $0000, $0000) ; BA - %InventoryItem($BB, $0001, $0000, $0000) ; BB - %InventoryItem($BC, $0001, $0000, $0000) ; BC - @@ -1140,7 +1140,7 @@ ItemReceiptGraphicsOffsets: dw BigDecompressionBuffer+$08A0 ; B6 - Crystal 3 dw $0 ; B7 - Reserved dw $0CE0 ; B8 - Teleporter - dw $0 ; B9 - + dw $0CA0 ; B9 - 10 IFrames dw $0 ; BA - dw $0 ; BB - dw $0 ; BC - @@ -1410,7 +1410,7 @@ StandingItemGraphicsOffsets: dw BigDecompressionBuffer+$08A0 ; B6 - Crystal 3 dw $0 ; B7 - Reserved dw $0CE0 ; B8 - Teleporter - dw $0 ; B9 - + dw $0CA0 ; B9 - 10 IFrames dw $0 ; BA - dw $0 ; BB - dw $0 ; BC - diff --git a/newitems.asm b/newitems.asm index 4cfa022..dc200ca 100644 --- a/newitems.asm +++ b/newitems.asm @@ -670,13 +670,18 @@ ItemBehavior: LDA.b #$01 STA.l RewindTrigger RTS - ; save + JSL.l SaveRewind SEP #$20 RTS + .i_frames + LDA.l IFrames + CLC : ADC.b #10 + STA.l IFrames + RTS + ResolveReceipt: PHA : PHX PHK : PLB diff --git a/pendantcrystalhud.asm b/pendantcrystalhud.asm index 8f36de3..b6fcba9 100644 --- a/pendantcrystalhud.asm +++ b/pendantcrystalhud.asm @@ -602,6 +602,8 @@ RestoreMenu_SetSubModule: RTL ;------------------------------------------------------------------------------- DrawHeartPiecesMenu: + JSL DrawIFrames + LDA.l HUDHeartColors_index : AND.w #$00FF ASL : TAX LDA.l HUDHeartColors_masks_game_hud,X @@ -609,7 +611,7 @@ DrawHeartPiecesMenu: LDA.l HeartPieceQuarter : AND.w #$00FF ASL #3 : TAX - LDY.w #$16F2 + LDY.w #$16F6 LDA.l HeartPieceMenuBaseTiles,X ORA.b Scrap0D diff --git a/sram.asm b/sram.asm index 2b01b15..bde76ce 100644 --- a/sram.asm +++ b/sram.asm @@ -392,6 +392,7 @@ SpritePotData: skip 592 ; Table for expanded pot shuffle. One word per PurchaseCounts: skip 96 ; Keeps track of shop purchases PrivateBlockPersistent: ; Reserved for 3rd party developers +IFrames: skip 1 RewindTrigger: skip 1 RewindRoomId: skip 2 RewindDungeonEntrance: skip 2 @@ -415,7 +416,7 @@ Rewind_A6: skip 1 Rewind_A7: skip 1 Rewind_A9: skip 1 Rewind_AA: skip 1 -skip 474 +skip 473 ;================================================================================ ; Direct SRAM Assignments ($700000 - $7080000) @@ -446,9 +447,10 @@ InverseChecksumSRAM: skip 2 ; ExtendedSaveDataSRAM: ; ExtendedFileNameSRAM: skip 24 ; We read and write the file name directly from and to SRAM (24 bytes) skip $500 +IFramesSRAM: skip 1 RewindTriggerSRAM: skip 1 RewindRoomIdSRAM: skip 2 -skip $15E1 ; +skip $15E0 ; RomVersionSRAM: skip 4 ; ALTTPR ROM version. Low byte is the version, high byte writes ; $01 for now (32-bits total) RomNameSRAM: skip 21 ; ROM name from $FFC0, burned in during init (21 bytes)