So I'm expanding the text capability in my top-down adventure game to be able to give the player a choice, and have different things happen based on the choice. So for example, this is how a string would appear in rom:
The control codes:
An option definition follows this format: [text prompt], ENDPROMPT, [script lsb], [script msb]
MENU2 could also be other things, like MENU3, a counter for a value (a "How many?" type question), or a text input ("Enter your name:").
Anyone ever done something like this or dissassembled a game that does? This solution works pretty well for me, but you never know.
Code:
.db "Would you rather have a beer or a water?", CLRSCR
.db "Well?", NEWLINE
.db MENU2
.db "Beer", ENDPROMPT, <script1, >script1
.db "Water", ENDPROMPT, <script2, >script2
.db "Well?", NEWLINE
.db MENU2
.db "Beer", ENDPROMPT, <script1, >script1
.db "Water", ENDPROMPT, <script2, >script2
The control codes:
Code:
CLRSC = clears the textbox and resets the cursor to the top
NEWLINE = a newline
MENU2 = a text "menu" with 2 options is about to be defined
-build a menu coordinate struct in ram (for the arrow) based
on where the textbox appears on screen
-save the event handler pointers
-change the state of the player to "menu handling mode"
-print the prompts
ENDPROMPT = end of a prompt string
NEWLINE = a newline
MENU2 = a text "menu" with 2 options is about to be defined
-build a menu coordinate struct in ram (for the arrow) based
on where the textbox appears on screen
-save the event handler pointers
-change the state of the player to "menu handling mode"
-print the prompts
ENDPROMPT = end of a prompt string
An option definition follows this format: [text prompt], ENDPROMPT, [script lsb], [script msb]
MENU2 could also be other things, like MENU3, a counter for a value (a "How many?" type question), or a text input ("Enter your name:").
Anyone ever done something like this or dissassembled a game that does? This solution works pretty well for me, but you never know.