Overhaul menu: Add RHS selector, expand journal, document states
This commit is contained in:
@@ -95,6 +95,7 @@ Menu_InitGraphics:
|
||||
STZ.w $0300 ; ITEMSTEP
|
||||
STZ.w $037A ; USEY2
|
||||
STZ.w $0301 ; USEY1
|
||||
STZ.w $020C ; Stats Screen Cursor Index
|
||||
INC $0200
|
||||
}
|
||||
|
||||
@@ -299,6 +300,7 @@ incsrc "menu_scroll.asm"
|
||||
Menu_StatsScreen:
|
||||
{
|
||||
JSR Menu_CheckHScroll
|
||||
JSR Menu_StatsScreen_Input
|
||||
RTS
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,10 @@ JOURNAL_STATE_FIRST_PAGE = $0000
|
||||
JOURNAL_STATE_MIDDLE_PAGE = $0001
|
||||
JOURNAL_STATE_LAST_PAGE = $0002
|
||||
|
||||
; ---------------------------------------------------------
|
||||
; Journal Handler
|
||||
; ---------------------------------------------------------
|
||||
|
||||
Journal_Handler:
|
||||
{
|
||||
PHB : PHK : PLB
|
||||
@@ -28,6 +32,10 @@ Journal_Handler:
|
||||
RTL
|
||||
}
|
||||
|
||||
; ---------------------------------------------------------
|
||||
; Page Navigation
|
||||
; ---------------------------------------------------------
|
||||
|
||||
Journal_PrevPage:
|
||||
{
|
||||
LDA.l JournalState
|
||||
@@ -58,23 +66,85 @@ Journal_NextPage:
|
||||
RTS
|
||||
}
|
||||
|
||||
; ---------------------------------------------------------
|
||||
; Entry Drawing
|
||||
; ---------------------------------------------------------
|
||||
|
||||
Journal_DrawEntry:
|
||||
{
|
||||
REP #$30
|
||||
LDX.w #$0000
|
||||
LDY.w #$0000
|
||||
; Calculate pointer to the text based on JournalState (Page #)
|
||||
; Entry = JournalEntries[JournalState]
|
||||
LDA.l JournalState : AND.w #$00FF : ASL : TAX
|
||||
LDA.w JournalEntries, X : STA.b $00 ; Store pointer in $00 (Direct Page)
|
||||
|
||||
LDX.w #$0000 ; Text Offset
|
||||
LDY.w #$0000 ; VRAM Offset
|
||||
|
||||
.loop
|
||||
LDA.w BookEntries, X : STA.w $1292, Y
|
||||
INY #2 : INX #2
|
||||
CPY.w #$001F : BCC .loop
|
||||
; Read from Indirect Address ($00) + Y (offset)
|
||||
; We need to be careful with addressing.
|
||||
; $00 is 16-bit pointer. We need to read from Bank 2D (current bank).
|
||||
; LDA ($00), Y works if Y is index.
|
||||
; But our X is the text offset index, Y is VRAM index.
|
||||
; Let's swap registers.
|
||||
|
||||
PHY ; Save VRAM offset
|
||||
TXY ; Y = Text Offset
|
||||
LDA ($00), Y ; Read word from text table
|
||||
PLY ; Restore VRAM offset
|
||||
|
||||
STA.w $1292, Y ; Write to VRAM buffer
|
||||
|
||||
INY #2 ; Next VRAM word
|
||||
INX #2 ; Next Text word
|
||||
|
||||
CPY.w #$0060 ; Copy 3 lines (32 bytes * 3 approx? No, original was $1F bytes -> 16 chars/1 line)
|
||||
; Original loop: CPY #$001F. That's 32 bytes (16 chars).
|
||||
; The BookEntries had 3 lines defined but the loop only did 1 line?
|
||||
; Original:
|
||||
; .loop
|
||||
; LDA.w BookEntries, X : STA.w $1292, Y
|
||||
; INY #2 : INX #2
|
||||
; CPY.w #$001F : BCC .loop
|
||||
; Yes, it only copied the first line ($00 to $1E).
|
||||
; We should probably copy more lines.
|
||||
; Let's copy 6 lines ($60 bytes? No, $1F is 31. So 16 chars * 2 bytes = 32 bytes = $20)
|
||||
; Let's copy 3 lines = $60 bytes.
|
||||
|
||||
CPY.w #$0060 : BCC .loop
|
||||
|
||||
SEP #$30
|
||||
RTS
|
||||
}
|
||||
|
||||
BookEntries:
|
||||
dw "THIS_IS_A_TEST__"
|
||||
dw "______________ "
|
||||
dw "______________ "
|
||||
; ---------------------------------------------------------
|
||||
; Data Tables
|
||||
; ---------------------------------------------------------
|
||||
|
||||
JournalEntries:
|
||||
dw Entry_Page1
|
||||
dw Entry_Page2
|
||||
dw Entry_Page3
|
||||
|
||||
Entry_Page1:
|
||||
dw "QUEST_LOG:_I____"
|
||||
dw "Must_find_the___"
|
||||
dw "missing_girl____"
|
||||
|
||||
Entry_Page2:
|
||||
dw "QUEST_LOG:_II___"
|
||||
dw "The_Mushroom_is_"
|
||||
dw "key_to_the_woods"
|
||||
|
||||
Entry_Page3:
|
||||
dw "QUEST_LOG:_III__"
|
||||
dw "Zora_River_flows"
|
||||
dw "from_the_north__"
|
||||
|
||||
; ---------------------------------------------------------
|
||||
; Background Drawing
|
||||
; ---------------------------------------------------------
|
||||
|
||||
Menu_DrawJournal:
|
||||
{
|
||||
@@ -183,4 +253,3 @@ Journal_DrawLastPage:
|
||||
.last_page_tilemap
|
||||
incbin "tilemaps/journal_end.bin"
|
||||
}
|
||||
|
||||
|
||||
@@ -325,3 +325,135 @@ assert pc() <= $0DE3C7
|
||||
|
||||
pullpc
|
||||
|
||||
|
||||
; =========================================================
|
||||
; Stats Screen Selector Logic
|
||||
; =========================================================
|
||||
|
||||
Menu_StatsCursorPositions:
|
||||
; Row 14: Sword, Shield, Tunic
|
||||
dw menu_offset(14,2) ; 0: Sword
|
||||
dw menu_offset(14,5) ; 1: Shield
|
||||
dw menu_offset(14,8) ; 2: Tunic
|
||||
dw menu_offset(14,8) ; 3: Placeholder (maps to Tunic)
|
||||
|
||||
; Row 17: Glove, Flippers, Boots, Pearl
|
||||
dw menu_offset(17,2) ; 4: Glove
|
||||
dw menu_offset(17,5) ; 5: Flippers
|
||||
dw menu_offset(17,8) ; 6: Boots
|
||||
dw menu_offset(17,11) ; 7: Pearl
|
||||
|
||||
Stats_Nav_Right:
|
||||
db $01, $02, $00, $00, $05, $06, $07, $04
|
||||
Stats_Nav_Left:
|
||||
db $02, $00, $01, $01, $07, $04, $05, $06
|
||||
Stats_Nav_Down:
|
||||
db $04, $05, $06, $07, $00, $01, $02, $02
|
||||
Stats_Nav_Up:
|
||||
db $04, $05, $06, $07, $00, $01, $02, $02
|
||||
|
||||
Menu_DrawStatsCursor:
|
||||
{
|
||||
LDA.b #$20 : BIT.w $0207
|
||||
REP #$20
|
||||
BEQ .no_delete
|
||||
; Delete cursor
|
||||
LDA.w #$20F5
|
||||
STA.w $1108, X : STA.w $1148, X
|
||||
STA.w $114E, X : STA.w $110E, X
|
||||
STA.w $11C8, X : STA.w $1188, X
|
||||
STA.w $118E, X : STA.w $11CE, X
|
||||
BRA .done
|
||||
|
||||
.no_delete
|
||||
; We reuse the Item Menu cursor graphics
|
||||
LDA.w #$3060 : STA.w $1108, X ; corner
|
||||
LDA.w #$3070 : STA.w $1148, X
|
||||
|
||||
LDA.w #$7060 : STA.w $110E, X ; corner
|
||||
LDA.w #$7070 : STA.w $114E, X
|
||||
|
||||
LDA.w #$3070 : STA.w $1188, X
|
||||
LDA.w #$B060 : STA.w $11C8, X ; corner
|
||||
|
||||
LDA.w #$7070 : STA.w $118E, X
|
||||
LDA.w #$F060 : STA.w $11CE, X ; corner
|
||||
|
||||
.done
|
||||
SEP #$20
|
||||
RTS
|
||||
}
|
||||
|
||||
Menu_DeleteStatsCursor:
|
||||
{
|
||||
REP #$30
|
||||
; Use $020C for index
|
||||
LDA.w $020C : AND.w #$00FF : ASL : TAY
|
||||
LDX.w Menu_StatsCursorPositions, Y
|
||||
|
||||
LDA.w #$20F5
|
||||
STA.w $1108, X : STA.w $1148, X
|
||||
STA.w $114E, X : STA.w $110E, X
|
||||
STA.w $11C8, X : STA.w $1188, X
|
||||
STA.w $118E, X : STA.w $11CE, X
|
||||
SEP #$30
|
||||
STZ $0207
|
||||
RTS
|
||||
}
|
||||
|
||||
Menu_StatsScreen_Input:
|
||||
{
|
||||
INC $0207
|
||||
|
||||
; Safety check for uninitialized index
|
||||
LDA.w $020C : AND #$F8 : BEQ .safe_index
|
||||
STZ.w $020C
|
||||
.safe_index
|
||||
|
||||
LDA.b $F4 ; Joypad
|
||||
LSR : BCS .move_right
|
||||
LSR : BCS .move_left
|
||||
LSR : BCS .move_down
|
||||
LSR : BCS .move_up
|
||||
BRA .draw_cursor
|
||||
|
||||
.move_right
|
||||
JSR Menu_DeleteStatsCursor
|
||||
LDY.w $020C
|
||||
LDA.w Stats_Nav_Right, Y
|
||||
STA.w $020C
|
||||
BRA .play_sound
|
||||
|
||||
.move_left
|
||||
JSR Menu_DeleteStatsCursor
|
||||
LDY.w $020C
|
||||
LDA.w Stats_Nav_Left, Y
|
||||
STA.w $020C
|
||||
BRA .play_sound
|
||||
|
||||
.move_down
|
||||
JSR Menu_DeleteStatsCursor
|
||||
LDY.w $020C
|
||||
LDA.w Stats_Nav_Down, Y
|
||||
STA.w $020C
|
||||
BRA .play_sound
|
||||
|
||||
.move_up
|
||||
JSR Menu_DeleteStatsCursor
|
||||
LDY.w $020C
|
||||
LDA.w Stats_Nav_Up, Y
|
||||
STA.w $020C
|
||||
BRA .play_sound
|
||||
|
||||
.play_sound
|
||||
LDA.b #$20 : STA.w $012F
|
||||
|
||||
.draw_cursor
|
||||
SEP #$30
|
||||
LDA.w $020C : ASL : TAY
|
||||
REP #$10
|
||||
LDX.w Menu_StatsCursorPositions, Y
|
||||
JSR Menu_DrawStatsCursor
|
||||
SEP #$20
|
||||
RTS
|
||||
}
|
||||
Reference in New Issue
Block a user