From bb668ee1f9903f6ee4da54b875eeda700eb84f46 Mon Sep 17 00:00:00 2001 From: 4am Date: Fri, 10 Jul 2020 14:56:07 -0400 Subject: [PATCH] help screen --- src/million.a | 3 +- src/ui.help.a | 79 ++++++++++++++++++++++++++++++++++++++++++++++ src/ui.main.menu.a | 44 +++++++++++++++++--------- src/ui.message.a | 13 -------- src/ui.play.a | 35 +++++++++++++------- 5 files changed, 134 insertions(+), 40 deletions(-) create mode 100644 src/ui.help.a diff --git a/src/million.a b/src/million.a index 2f25ed5..ebf17fd 100644 --- a/src/million.a +++ b/src/million.a @@ -50,7 +50,7 @@ Start lda #0 sta gSelectedLogicalColumn jsr DrawPuzzleChrome - jsr ClearAndDrawPuzzle + jsr DrawPuzzle jsr AnimatePuzzleIntoPlace jsr DrawColumnSelectionIndicator @@ -76,6 +76,7 @@ Start !source "src/ui.main.menu.a" !source "src/ui.about.a" !source "src/ui.play.a" + !source "src/ui.help.a" !source "src/ui.message.a" !source "src/ui.common.a" !source "src/puzzle.a" diff --git a/src/ui.help.a b/src/ui.help.a new file mode 100644 index 0000000..e7d1b59 --- /dev/null +++ b/src/ui.help.a @@ -0,0 +1,79 @@ +;license:MIT +;(c) 2020 by 4am +; +; display help screen +; +; Public functions: +; - HelpEventLoop +; + +;0123456789012345678901234567890123456789 +; +; +; +; MOVE COLUMNS TO FORM WORDS +; +; USE ALL LETTERS TO ADVANCE +; +; +; * +; +; +;LEFT/RIGHT ARROWS..........SELECT COLUMN +; +;UP/DOWN ARROWS...............MOVE COLUMN +; +;A-Z.......................MOVE TO LETTER +; +;CTRL-R....................RESTART PUZZLE +; +;ESC............................MAIN MENU +; +; +; +; + +help_info1 + !byte 26 + !raw "MOVE COLUMNS TO FORM WORDS" +help_info2 + !byte 26 + !raw "USE ALL LETTERS TO ADVANCE" +help_leftright + !byte 40 + !raw "LEFT/RIGHT ARROWS..........SELECT COLUMN" +help_updown + !byte 40 + !raw "UP/DOWN ARROWS...............MOVE COLUMN" +help_az + !byte 40 + !raw "A-Z.......................MOVE TO LETTER" +help_ctrlr + !byte 40 + !raw "CTRL-R....................RESTART PUZZLE" +help_esc + !byte 40 + !raw "ESC............................MAIN MENU" + +HelpEventLoop + jsr Home + jsr DrawHelpText + bit CLEARKBD +- lda KBD + bpl - + bit CLEARKBD + sec + rts + +DrawHelpText + bit TEXTMODE + +PRINT_AT help_info1, 3, 7 + +PRINT_AT help_info2, 5, 7 + +PRINT_AT asterisk, 8, 20 + +PRINT_AT help_leftright, 11, 0 + +PRINT_AT help_updown, 13, 0 + +PRINT_AT help_az, 15, 0 + +PRINT_AT help_ctrlr, 17, 0 + +PRINT_AT help_esc, 19, 0 + bit GFXMODE + rts diff --git a/src/ui.main.menu.a b/src/ui.main.menu.a index 7f13a1e..5c5bd3a 100644 --- a/src/ui.main.menu.a +++ b/src/ui.main.menu.a @@ -19,6 +19,8 @@ kMainMenuKeys ; must keep in sync with kMainMenuKeyHandle !byte $03 ; Ctrl-C !byte $53 ; S/s !byte $13 ; Ctrl-S + !byte $2F ; / + !byte $3F ; ? !byte $51 ; Q/q !byte $11 ; Ctrl-Q !byte $1B ; Esc @@ -30,6 +32,8 @@ kMainMenuKeyHandlersLo !byte MainMenuEventC !byte >MainMenuEventS !byte >MainMenuEventS + !byte >MainMenuEventQuestion + !byte >MainMenuEventQuestion !byte >MainMenuEventQ !byte >MainMenuEventQ !byte >MainMenuEventQ @@ -86,6 +92,10 @@ MainMenuEventLoop beq MainMenuEventLoop rts +MainMenuEventQuestion + jsr HelpEventLoop + jmp + + MainMenuEventReturn jsr SelectWorld bcs + ; in next event handler @@ -137,17 +147,18 @@ DrawMainMenuTitle DrawMainMenuText +PRINT_AT asterisk, 2, 30 +PRINT_AT version, 11, 26 - +PRINT_AT menuline_play, 15, 10 - +PRINT_AT menuline_sound, 16, 10 + +PRINT_AT mainmenu_play, 15, 10 + +PRINT_AT mainmenu_sound, 16, 10 lda gSoundPref beq @theSoundOfSilence - +LDADDR menuline_sound_on + +LDADDR mainmenu_sound_on bne + ; always branches @theSoundOfSilence - +LDADDR menuline_sound_off + +LDADDR mainmenu_sound_off + jsr DrawHeavySilkString - +PRINT_AT menuline_about, 17, 10 - +PRINT_AT menuline_quit, 18, 10 + +PRINT_AT mainmenu_about, 17, 10 + +PRINT_AT mainmenu_help, 18, 10 + +PRINT_AT mainmenu_quit, 19, 10 +PRINT_AT disclaimer, 23, 0 rts @@ -321,24 +332,27 @@ asterisk version !byte 4 !raw "V0.3" -menuline_play +mainmenu_play !byte 20 !raw "RETURN.....PLAY GAME" -menuline_sound +mainmenu_sound !byte 18 - !raw "CTRL-S.....SOUND (" -menuline_sound_on + !raw " S.....SOUND (" +mainmenu_sound_on !byte 4 !raw "ON) " -menuline_sound_off +mainmenu_sound_off !byte 4 !raw "OFF)" -menuline_about +mainmenu_about !byte 18 - !raw "CTRL-C.....CREDITS" -menuline_quit + !raw " C.....CREDITS" +mainmenu_help !byte 15 - !raw "CTRL-Q.....QUIT" + !raw " ?.....HELP" +mainmenu_quit + !byte 15 + !raw " Q.....QUIT" disclaimer !byte 40 !raw "* NOT GUARANTEED, ACTUAL COUNT MAY VARY." diff --git a/src/ui.message.a b/src/ui.message.a index adb6f16..5f495a1 100644 --- a/src/ui.message.a +++ b/src/ui.message.a @@ -9,19 +9,6 @@ ; - HideMessage ; -;0123456789012345678901 -; press ? for help -; -;0123456789012345678901 -;letters can be reused -; -;0123456789012345678901 -;3-word solution exists -; -;0123456789012345678901 -; don't panic! - ; - showingMessage ; [byte][private] !byte 0 ; 1 = currently showing message, 0 = not diff --git a/src/ui.play.a b/src/ui.play.a index 5b92181..c044420 100644 --- a/src/ui.play.a +++ b/src/ui.play.a @@ -44,6 +44,8 @@ kPlayKeys ; must keep in sync with kPlayKeyHandlersLo !byte $1B ; Esc !byte $12 ; Ctrl-R !byte $0D ; Return + !byte $2F ; / + !byte $3F ; ? !byte $00 ; A-Z kPlayKeyHandlersLo @@ -54,6 +56,8 @@ kPlayKeyHandlersLo !byte PlayEventEsc !byte >PlayEventCtrlR !byte >PlayEventReturn + !byte >PlayEventQuestion + !byte >PlayEventQuestion !byte >PlayEventLetter ;------------------------------------------------------------------------------ @@ -177,6 +183,15 @@ MoveToFirstColumn ldx #kKeepPlaying rts +PlayEventQuestion + jsr HelpEventLoop + jsr Home + jsr DrawPuzzleChrome + jsr DrawPuzzle + jsr DrawColumnSelectionIndicator + ldx #kKeepPlaying + rts + - jsr PlayNextChord PlayEventLetter lda gLastKeyPressed @@ -235,14 +250,14 @@ CheckForPuzzleComplete rts ;------------------------------------------------------------------------------ -; ClearAndDrawPuzzle -; clears screen and draws current puzzle (but not column selection indicator or +; DrawPuzzle +; draws letters in current puzzle (but not column selection indicator or ; other UI elements) ; ; in: none ; out: all registers and flags clobbered ;------------------------------------------------------------------------------ -ClearAndDrawPuzzle +DrawPuzzle jsr DrawThinLines +LDADDR puzzle_data0 +ST16 $FE @@ -260,10 +275,8 @@ ClearAndDrawPuzzle bcc + inc $FF + inx - cpx puzzle_logical_height + cpx #9 bne -- - - bit GFXMODE rts ;------------------------------------------------------------------------------ @@ -285,13 +298,14 @@ AnimatePuzzleIntoPlace iny @max cpy #$FD ; SMC bne -- - jmp ShowMessage - + jsr ShowMessage + +LDADDR noMessage + jmp SetNextMessage ; ;------------------------------------------------------------------------------ ; DrawPuzzleChrome ; draw all elements on puzzle screen that are not the actual puzzle -; (e.g. column selection indicator, game title, help text) +; (game title, level) ; ; in: none ; out: all registers and flags clobbered @@ -328,8 +342,7 @@ DrawPuzzleChrome lda #$30 ; padding character ('0') jsr ToASCIIString +LDADDR $00F1 - jsr DrawHeavySilkString - jmp DrawColumnSelectionIndicator + jmp DrawHeavySilkString ;------------------------------------------------------------------------------ ; AnimatePuzzleCompleted