Prev: 37233 Up: Map Next: 37298
37259: In-Game: Move Cursor
Used by the routine at InGameControls.
Input
A Keypress
InGame_MoveCursor 37259 PUSH AF Stash the keypress on the stack.
37260 LD B,120 B=INK: BLACK, PAPER: WHITE (BRIGHT) .
37262 CALL InGame_UpdateCursorPosition Call InGame_UpdateCursorPosition.
37265 POP AF Restore the keypress from the stack.
37266 CP 4 Jump to Handler_MoveCursorRight if "right" was pressed.
37268 LD A,(37336)
37271 JR Z,Handler_MoveCursorRight
Else "left" was pressed, so check if there's a slot on the left still to move to.
37273 OR A Jump to InGame_MoveCursorLeft if *InGame_HighlightedOption is not zero.
37274 JR NZ,InGame_MoveCursorLeft
The cursor IS at the first position, 0 so reset it to the last position +1.
37276 LD A,3 A=3.
Process the "left" action.
InGame_MoveCursorLeft 37278 DEC A Decrease A by one.
37279 JR InGame_WriteCursorPosition Jump to InGame_WriteCursorPosition.
Handle moving the cursor right.
Handler_MoveCursorRight 37281 CP 2 Jump to InGame_MoveCursorRight if the cursor still has slots to the right it can move to, and is not in the last position.
37283 JR NZ,InGame_MoveCursorRight
The cursor IS at the last position, 2 so reset it to the starting position -1.
37285 LD A,255 A=255.
Process the "right" action.
InGame_MoveCursorRight 37287 INC A Increment the cursor position by one.
The cursor position has changed, left or right, both actions follow the same flow.
InGame_WriteCursorPosition 37288 LD (37336),A Write A to *InGame_HighlightedOption.
37291 LD B,104 B=INK: BLACK, PAPER: CYAN (BRIGHT) .
37293 CALL InGame_UpdateCursorPosition Call InGame_UpdateCursorPosition.
37296 JR InGameControls_Loop Jump to InGameControls_Loop.
Prev: 37233 Up: Map Next: 37298