Skip to content

Commit dc4b243

Browse files
committed
Context-sensitive instructions at bottom of Help
1 parent ff590d8 commit dc4b243

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

src/help.c

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ extern unsigned char scr_mem[];
3838
extern unsigned char * dlist;
3939

4040
/* Local function prototypes: */
41+
void show_help_controls(unsigned char first_page, unsigned char last_page);
42+
4143
#ifdef FANCY_HELP_IO
4244
unsigned char ciov(void);
4345
unsigned char xio_open_read(char * filespec);
@@ -47,6 +49,7 @@ unsigned char xio_point(unsigned char * ptr);
4749
unsigned char xio_get_record(char * buf, unsigned int buf_size, unsigned int * read_len);
4850
#endif
4951

52+
5053
/* Routine to load and show help text on a fullscreen text display */
5154
void show_help(void) {
5255
int i, j;
@@ -96,11 +99,8 @@ void show_help(void) {
9699

97100
OS.sdmctl = (DMACTL_PLAYFIELD_NORMAL | DMACTL_DMA_FETCH);
98101

99-
/* Show control instructions */
100-
draw_text("SPACE/RETURN/FIRE: Next Page - ESC: Exit", scr_mem + (LINES * 40));
101-
#ifdef FANCY_HELP_IO
102-
draw_text("UP/BACKSPACE: Previous Page", scr_mem + ((LINES + 1) * 40) + 7);
103-
#endif
102+
/* Show control instructions (the first time) */
103+
show_help_controls(1, 0);
104104

105105
/* Open the help text file for read */
106106
#ifdef FANCY_HELP_IO
@@ -154,6 +154,8 @@ void show_help(void) {
154154
draw_number(cur_page, 2, scr_mem + ((LINES + 1) * 40));
155155
#endif
156156

157+
show_help_controls((cur_page == 1), eof);
158+
157159
/* (Eat input) */
158160
do {
159161
} while (OS.strig0 == 0 || OS.strig1 == 0 || CONSOL_START(GTIA_READ.consol) == 1);
@@ -197,7 +199,7 @@ void show_help(void) {
197199
xio_point(ptrs + (cur_page * 3));
198200
}
199201
#endif
200-
} while (!eof && cmd != HELP_CMD_EXIT);
202+
} while (cmd != HELP_CMD_EXIT);
201203

202204
#ifdef FANCY_HELP_IO
203205
xio_close();
@@ -307,3 +309,24 @@ unsigned char ciov(void) {
307309
}
308310
#endif
309311

312+
313+
/* Show help screen controls at the bottom of the screen.
314+
@param unsigned char first_page true, if we're on the first page
315+
@param unsigned char last_page true, if we're on the last page (have hit EOF)
316+
*/
317+
void show_help_controls(unsigned char first_page, unsigned char last_page) {
318+
if (!last_page) {
319+
draw_text("SPACE/RETURN/FIRE: Next Page - ESC: Exit", scr_mem + (LINES * 40));
320+
} else {
321+
draw_text(" SPACE/RETURN/FIRE/ESC: Exit ", scr_mem + (LINES * 40));
322+
}
323+
324+
#ifdef FANCY_HELP_IO
325+
if (!first_page) {
326+
draw_text("UP/BACKSPACE: Previous Page", scr_mem + ((LINES + 1) * 40) + 7);
327+
} else {
328+
draw_text(" ", scr_mem + ((LINES + 1) * 40) + 7);
329+
}
330+
#endif
331+
}
332+

0 commit comments

Comments
 (0)