Removing QUIT + bug corrections

This commit is contained in:
Christophe Meneboeuf 2017-01-18 01:13:43 +01:00
parent 94da5cf7be
commit 202b08f39d
2 changed files with 8 additions and 10 deletions

BIN
disk.dsk

Binary file not shown.

View File

@ -119,14 +119,12 @@ int main( int argc, char** argv )
case STATE_RUN: case STATE_RUN:
clear_text(); clear_text();
run(); run();
if( KeyPressed == 'e' ) { /* Go back to editor */ if( KeyPressed == 's' ) { /* Go back to editor */
State = STATE_EDITOR; State = STATE_EDITOR;
} else if( KeyPressed == 'r' ) { /* reset and rerun */ } else if( KeyPressed == 'r' ) { /* reset and rerun */
memcpy( Cells, Cells_Initial, sizeof(Cells) ); memcpy( Cells, Cells_Initial, sizeof(Cells) );
memcpy( Cells_Future, Cells_Initial, sizeof(Cells_Future) ); memcpy( Cells_Future, Cells_Initial, sizeof(Cells_Future) );
draw_cells(); draw_cells();
} else if( KeyPressed == 'q' ) { /* quit */
State = STATE_QUIT;
} }
break; break;
default: default:
@ -147,7 +145,7 @@ void quit( void )
mode_text(); mode_text();
screensize (&x, &y); screensize (&x, &y);
clrscr(); clrscr();
printf("\n *** THIS WAS LIFE BY WWW.XTOF.INFO ***\nn"); printf("\n *** READ WWW.XTOF.INFO ***\nn");
exit(0); exit(0);
} }
@ -205,7 +203,7 @@ void draw_cells( void ) {
} }
} }
const char* const Text_Editor ="H K U J: Move the cursor\nSPACE : Toggle a cell\n(L)oad - (S)ave - (R)un\n(A)bout";
void editor( void ) void editor( void )
{ {
#define KEY_LEFT 'h' #define KEY_LEFT 'h'
@ -217,8 +215,7 @@ void editor( void )
uint8_t color_pixel; uint8_t color_pixel;
uint8_t update_color = 1; uint8_t update_color = 1;
const char* const text = "H K U J: Move the cursor\nSPACE : Toggle a cell\nn(L)oad - (S)ave - (R)un - (A)bout"; set_text( Text_Editor );
set_text( text );
//Place the cursor middle screen //Place the cursor middle screen
x_cursor = NB_COLUMNS >> 1u; x_cursor = NB_COLUMNS >> 1u;
@ -270,14 +267,14 @@ void editor( void )
draw_cells(); draw_cells();
update_color = 1; update_color = 1;
} }
set_text( text ); set_text( Text_Editor );
break; break;
case 's': case 's':
if( editor_load_save( SAVE ) == 0) { if( editor_load_save( SAVE ) == 0) {
set_text( "Stage saved!\nnPress a key to continue." ); set_text( "Stage saved!\nnPress a key to continue." );
cgetc(); cgetc();
} }
set_text( text ); set_text( Text_Editor );
gfx_pixel( color_pixel, x_cursor, y_cursor ); gfx_pixel( color_pixel, x_cursor, y_cursor );
update_color = 0; update_color = 0;
break; break;
@ -375,7 +372,7 @@ void run( void )
uint16_t nb_iterations = 2u; uint16_t nb_iterations = 2u;
KeyPressed = NO_KEY; KeyPressed = NO_KEY;
gotoxy( 0u, PRINTF_LINE+1 ); gotoxy( 0u, PRINTF_LINE+1 );
printf("Iteration:1\nn(R)eset (E)ditor (Q)uit"); printf("Iteration:1\n(R)eset (S)top");
while( KeyPressed == NO_KEY) while( KeyPressed == NO_KEY)
{ {
/* Evolving the cells */ /* Evolving the cells */
@ -471,5 +468,6 @@ Follow me on Twitter: @pixinn\n\n\
FEEL FREE TO SHARE THIS DISK!" ); FEEL FREE TO SHARE THIS DISK!" );
cgetc(); cgetc();
init_display(); init_display();
set_text( Text_Editor );
draw_cells(); draw_cells();
} }