X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=fishladder.c;h=d4640be4b2f08e27c15113af77bd07bfe819f5e8;hb=aacc3fa98842a475c5fd6d0f102a341ec6ed4b69;hp=deea9791ea0762bab88c7d97461ab6504eeea0ce;hpb=5293bf2e9c4f30d5b01f1e1638c00509c1674768;p=fishladder.git diff --git a/fishladder.c b/fishladder.c index deea979..d4640be 100644 --- a/fishladder.c +++ b/fishladder.c @@ -564,7 +564,7 @@ static int map_load( const char *str, const char *name ) struct cell_terminal *terminal = &world.io[ reg_start ]; struct terminal_run *run = &terminal->runs[ terminal->run_count-1 ]; - if( *c >= 'a' && *c <= 'z' ) + if( (*c >= 'a' && *c <= 'z') || *c == ' ' ) { run->conditions[ run->condition_count ++ ] = *c; } @@ -1611,11 +1611,15 @@ void vg_update(void) { if( world.sim_frame < term->runs[ world.sim_run ].condition_count ) { + char emit = term->runs[ world.sim_run ].conditions[ world.sim_frame ]; + if( emit == ' ' ) + continue; + struct fish *fish = &world.fishes[ world.num_fishes ]; v2i_copy( term->pos, fish->pos ); fish->state = k_fish_state_alive; - fish->payload = term->runs[ world.sim_run ].conditions[ world.sim_frame ]; + fish->payload = emit; struct cell *cell_ptr = pcell( fish->pos ); @@ -2340,14 +2344,18 @@ void vg_render(void) if( is_input ) { - colour_code_v3( term->runs[k].conditions[j], dot_colour ); - glUniform4fv( SHADER_UNIFORM( shader_tile_colour, "uColour" ), 1, dot_colour ); - - // Draw filled if tick not passed, draw empty if empty - if( (world.sim_frame > j && world.sim_run >= k) || world.sim_run > k ) - draw_mesh( empty_start, empty_count ); - else - draw_mesh( filled_start, filled_count ); + char cc = term->runs[k].conditions[j]; + if( cc != ' ' ) + { + colour_code_v3( cc, dot_colour ); + glUniform4fv( SHADER_UNIFORM( shader_tile_colour, "uColour" ), 1, dot_colour ); + + // Draw filled if tick not passed, draw empty if empty + if( (world.sim_frame > j && world.sim_run >= k) || world.sim_run > k ) + draw_mesh( empty_start, empty_count ); + else + draw_mesh( filled_start, filled_count ); + } } else { @@ -2500,14 +2508,16 @@ void vg_ui(void) for( int i = 0; i < 3; i ++ ) { - if( i == pack_selection ) + int pack_is_unlocked = pack_infos[i].levels[0].unlocked; + + if( i == pack_selection || !pack_is_unlocked ) gui_override_colours( &flcol_list_locked ); - - if( gui_button( 2000 + i ) == k_button_click ) + + if( gui_button( 2000 + i ) == k_button_click && pack_is_unlocked ) pack_selection = i; ui_global_ctx.cursor[1] += 2; - gui_text( pack_infos[i].name, 4, 0 ); + gui_text( pack_is_unlocked? pack_infos[i].name: "???", 4, 0 ); gui_end_right(); gui_reset_colours();