diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index a8c4b89..681f5a1 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -191,6 +191,7 @@ warnpc $348000 org $320000 Extra_Text_Table: +incsrc itemtext.asm incsrc externalhooks.asm ;================================================================================ diff --git a/dialog.asm b/dialog.asm index 5312859..ab562eb 100644 --- a/dialog.asm +++ b/dialog.asm @@ -44,11 +44,43 @@ RTL ; PLY : PLX : PLA ;endmacro ;-------------------------------------------------------------------------------- +;macro LoadDialogAddress(address) +; PHA : PHX : PHY +; PHP +; PHB : PHK : PLB +; SEP #$30 ; set 8-bit accumulator and index registers +; LDA $00 : PHA +; LDA $01 : PHA +; LDA $02 : PHA +; LDA.b #$01 : STA $7F5035 ; set flag +; +; LDA.b #
: STA $00 ; write pointer to direct page +; LDA.b #
>>8 : STA $01 +; LDA.b #
>>16 : STA $02 +; +; LDX.b #$00 : LDY.b #$00 +; - +; LDA [$00], Y ; load the next character from the pointer +; STA $7F5700, X ; write to the buffer +; INX : INY +; CMP.b #$7F : BNE - +; PLA : STA $02 +; PLA : STA $01 +; PLA : STA $00 +; PLB +; PLP +; PLY : PLX : PLA +;endmacro +;-------------------------------------------------------------------------------- +!OFFSET_POINTER = "$7F5094" +!OFFSET_RETURN = "$7F5096" +!DIALOG_BUFFER = "$7F5700" macro LoadDialogAddress(address) - PHP PHA : PHX : PHY + PHP PHB : PHK : PLB - SEP #$30 ; set 8-bit accumulator and index registers + SEP #$20 ; set 8-bit accumulator + REP #$10 ; set 16-bit index registers LDA $00 : PHA LDA $01 : PHA LDA $02 : PHA @@ -58,20 +90,87 @@ macro LoadDialogAddress(address) LDA.b #
>>8 : STA $01 LDA.b #
>>16 : STA $02 - LDX.b #$00 : LDY.b #$00 + LDA !OFFSET_POINTER : TAX : LDY.w #$0000 - LDA [$00], Y ; load the next character from the pointer - STA $7F5700, X ; write to the buffer + STA !DIALOG_BUFFER, X ; write to the buffer INX : INY CMP.b #$7F : BNE - + REP #$20 ; set 16-bit accumulator + TXA : STA !OFFSET_RETURN ; copy out X into + LDA.w #$0000 : STA !OFFSET_POINTER + SEP #$20 ; set 8-bit accumulator PLA : STA $02 PLA : STA $01 PLA : STA $00 PLB - PLY : PLX : PLA PLP + PLY : PLX : PLA endmacro ;-------------------------------------------------------------------------------- +FreeDungeonItemNotice: + PHX : PHA + LDA.l FreeItemTest : BNE + : BRL .skip : + + + AND.b #$F0 ; looking at high bits only + CMP.b #$70 : BNE + ; map of... + %LoadDialogAddress(Notice_MapOf) + BRL .dungeon + + : CMP.b #$80 : BNE + ; compass of... + %LoadDialogAddress(Notice_CompassOf) + BRL .dungeon + + : CMP.b #$90 : BNE + ; big key of... + %LoadDialogAddress(Notice_BigKeyOf) + BRA .dungeon + + : CMP.b #$A0 : BNE + ; small key of... + %LoadDialogAddress(Notice_SmallKeyOf) + PLA : AND.b #$0F : STA $7F5020 : LDA.b #$0F : !SUB $7F5020 : PHA + + + + .dungeon + LDA !OFFSET_RETURN : STA !OFFSET_POINTER + PLA : PHA + AND.b #$0F ; looking at high bits only + CMP.b #$00 : BNE + ; ...light world + %LoadDialogAddress(Notice_LightWorld) + + : CMP.b #$01 : BNE + ; ...dark world + %LoadDialogAddress(Notice_DarkWorld) + + : CMP.b #$02 : BNE + ; ...ganon's tower + %LoadDialogAddress(Notice_GTower) + + : CMP.b #$03 : BNE + ; ...turtle rock + %LoadDialogAddress(Notice_TRock) + + : CMP.b #$04 : BNE + ; ...thieves' town + %LoadDialogAddress(Notice_Thieves) + + : CMP.b #$05 : BNE + ; ...tower of hera + %LoadDialogAddress(Notice_Hera) + + : CMP.b #$06 : BNE + ; ...ice palace + %LoadDialogAddress(Notice_Ice) + + : CMP.b #$07 : BNE + ; ...skull woods + %LoadDialogAddress(Notice_Skull) + + : CMP.b #$08 : BNE + ; ...misery mire + %LoadDialogAddress(Notice_Mire) + + : CMP.b #$09 : BNE + ; ...dark palace + %LoadDialogAddress(Notice_PoD) + + : CMP.b #$0A : BNE + ; ...swamp palace + %LoadDialogAddress(Notice_Swamp) + + : CMP.b #$0B : BNE + ; ...agahnim's tower + %LoadDialogAddress(Notice_AgaTower) + + : CMP.b #$0C : BNE + ; ...desert palace + %LoadDialogAddress(Notice_Desert) + + : CMP.b #$0D : BNE + ; ...eastern palace + %LoadDialogAddress(Notice_Eastern) + + : CMP.b #$0E : BNE + ; ...hyrule castle + %LoadDialogAddress(Notice_Castle) + + : CMP.b #$0F : BNE + ; ...sewers + %LoadDialogAddress(Notice_Sewers) + + + + ;LDA.b #$01 : STA $7F5035 ; set alternate dialog flag + JSL.l Sprite_ShowMessageMinimal + .skip + PLA : PLX +RTL +;-------------------------------------------------------------------------------- DialogBlind: %LoadDialogAddress(BlindText) JSL.l Sprite_ShowMessageMinimal diff --git a/itemtext.asm b/itemtext.asm new file mode 100644 index 0000000..13c2217 --- /dev/null +++ b/itemtext.asm @@ -0,0 +1,22 @@ +org $320000 +Notice_MapOf: +Notice_CompassOf: +Notice_BigKeyOf: +Notice_SmallKeyOf: +Notice_LightWorld: +Notice_DarkWorld: +Notice_GTower: +Notice_TRock: +Notice_Thieves: +Notice_Hera: +Notice_Ice: +Notice_Skull: +Notice_Mire: +Notice_PoD: +Notice_Swamp: +Notice_AgaTower: +Notice_Desert: +Notice_Eastern: +Notice_Castle: +Notice_Sewers: + dw #$7F7F ; terminate \ No newline at end of file diff --git a/newitems.asm b/newitems.asm index 3f38728..81f6092 100755 --- a/newitems.asm +++ b/newitems.asm @@ -231,6 +231,7 @@ AddReceivedItemExpandedGetItem: CMP GoalItemRequirement : !BLT ++ : JSL.l StatsFinalPrep : ++ BRL .done + CMP.b #$70 : !BLT + : CMP.b #$80 : !BGE + ; Free Map + JSL.l FreeDungeonItemNotice AND #$0F : CMP #$08 : !BGE ++ %ValueShift() ORA $7EF368 : STA $7EF368 ; Map 1 @@ -240,6 +241,7 @@ AddReceivedItemExpandedGetItem: ORA $7EF369 : STA $7EF369 ; Map 2 BRL .done + CMP.b #$80 : !BLT + : CMP.b #$90 : !BGE + ; Free Compass + JSL.l FreeDungeonItemNotice AND #$0F : CMP #$08 : !BGE ++ %ValueShift() ORA $7EF364 : STA $7EF364 ; Compass 1 @@ -249,6 +251,7 @@ AddReceivedItemExpandedGetItem: ORA $7EF365 : STA $7EF365 ; Compass 2 BRL .done + CMP.b #$90 : !BLT + : CMP.b #$A0 : !BGE + ; Free Big Key + JSL.l FreeDungeonItemNotice AND #$0F : CMP #$08 : !BGE ++ %ValueShift() ORA $7EF366 : STA $7EF366 ; Big Key 1 @@ -258,6 +261,7 @@ AddReceivedItemExpandedGetItem: ORA $7EF367 : STA $7EF367 ; Big Key 2 BRL .done + CMP.b #$A0 : !BLT + : CMP.b #$B0 : !BGE + ; Free Small Key + JSL.l FreeDungeonItemNotice AND #$0F : TAX LDA $7EF37C, X : INC : STA $7EF37C, X ; Increment Key Count TXA : ASL : CMP $040C : BNE ++ diff --git a/tables.asm b/tables.asm index bb96525..632e5bf 100644 --- a/tables.asm +++ b/tables.asm @@ -617,6 +617,10 @@ org $308169 ; PC 0x180169 AgahnimDoorStyle: db #$00 ; #00 = Never Locked - #$01 = Locked During Escape (default) ;================================================================================ +org $30816A ; PC 0x18016A +FreeItemTest: +db #$00 ; #00 = Off - #$01 = On (default) +;================================================================================ org $308190 ; PC 0x180190 TimerStyle: db #$00 ; #$00 = Off (Default) - #$01 Countdown - #$02 = Stopwatch @@ -1056,6 +1060,10 @@ dw #9999 ; Rupee Limit ; $7F5091 - Item Animation Busy Flag ; $7F5092 - Potion Animation Busy Flags (Health) ; $7F5093 - Potion Animation Busy Flags (Magic) +; $7F5094 - Dialog Offset Pointer (Low) +; $7F5095 - Dialog Offset Pointer (High) +; $7F5096 - Dialog Offset Pointer Return (Low) +; $7F5097 - Dialog Offset Pointer Return (High) ; $7F50D0 - $7F50FF - Block Cypher Parameters ; $7F5100 - $7F51FF - Block Cypher Buffer ;