k_world_button_settings = 3
};
+enum e_game_state
+{
+ k_game_state_main,
+ k_game_state_settings
+};
+
#define FLAG_CANAL 0x1
#define FLAG_IS_TRIGGER 0x2
#define FLAG_RESERVED0 0x4
static struct world
{
+ // Things that are 'static', aka, initialized once
struct
{
struct world_button buttons[4];
float zoom;
+ enum e_game_state state;
+
+ struct cmp_level *lvl_to_load;
+ float lvl_load_time;
+
+ float world_transition;
}
st;
#pragma pack(pop)
int initialzed;
-
int sim_run, max_runs;
int sim_frame, sim_target;
int num_fishes;
char map_name[64];
- //struct career_level *ptr_career_level;
struct cmp_level *pCmpLevel;
u32 score;
static int colour_set_id = 0;
-static void colour_code_v3( char const cc, v3f target )
+static v3f colour_sets[][4] =
{
- static v3f colour_sets[][4] =
- {
- { { 1.0f, 0.9f, 0.3f }, // Yellow
- { 0.4f, 0.8f, 1.00f }, // Blue
- { 0.2f, 0.9f, 0.14f }, // Green
- { 0.882f, 0.204f, 0.922f } // Pink
- },
- { { 1.0f, 0.9f, 0.3f }, // Yellow
- { 0.4f, 0.8f, 1.00f }, // Blue
- { 0.85f, 0.85f, 0.85f }, // Weiss
- { 0.2f, 0.2f, 0.2f } // Black/Gray
- },
- { { 1.0f, 0.9f, 0.3f }, // Yellow
- { 0.827f, 0.373f, 0.718f }, // Pink
- { 0.0f, 0.353f, 0.71f }, // Blue
- { 0.863f, 0.196f, 0.125f } // Red
- },
- };
+ { { 1.0f, 0.9f, 0.3f }, // Yellow
+ { 0.4f, 0.8f, 1.00f }, // Blue
+ { 0.2f, 0.9f, 0.14f }, // Green
+ { 0.882f, 0.204f, 0.922f } // Pink
+ },
+ { { 1.0f, 0.9f, 0.3f }, // Yellow
+ { 0.4f, 0.8f, 1.00f }, // Blue
+ { 0.85f, 0.85f, 0.85f }, // Weiss
+ { 0.2f, 0.2f, 0.2f } // Black/Gray
+ },
+ { { 1.0f, 0.9f, 0.3f }, // Yellow
+ { 0.827f, 0.373f, 0.718f }, // Pink
+ { 0.0f, 0.353f, 0.71f }, // Blue
+ { 0.863f, 0.196f, 0.125f } // Red
+ },
+};
+static void colour_code_v3( char const cc, v3f target )
+{
if( cc >= 'a' && cc <= 'z' )
{
int id = cc - 'a';
v2i turtle;
v2i turtle_dir;
int original_y;
+
+ // Only make breakouts for terminals on the edge
+ if( !(term->pos[1] == 1 || term->pos[1] == world.h-2) )
+ continue;
turtle[0] = 16+term->pos[0];
turtle[1] = 16+term->pos[1];
static void vg_update(void)
{
+ // Async events
+ if( world.st.lvl_to_load )
+ {
+ world.st.world_transition = (world.st.lvl_load_time-vg_time) * 4.0f;
+
+ if( vg_time > world.st.lvl_load_time )
+ {
+ if( console_changelevel( 1, &world.st.lvl_to_load->map_name ) )
+ {
+ world.pCmpLevel = world.st.lvl_to_load;
+ gen_level_text( world.pCmpLevel );
+ }
+
+ world.st.lvl_to_load = NULL;
+ }
+ }
+ else
+ {
+ world.st.world_transition = vg_minf( 1.0f, (vg_time-world.st.lvl_load_time) * 4.0f );
+ }
+
// Camera
// ========================================================================================================
if( switch_level_to )
{
+ world.st.lvl_to_load = switch_level_to;
+ world.st.lvl_load_time = vg_time + 0.25f;
+ world.st.world_transition = 1.0f;
+
+ /*
if( console_changelevel( 1, &switch_level_to->map_name ) )
{
world.pCmpLevel = switch_level_to;
gen_level_text( world.pCmpLevel );
}
+ */
}
}
glActiveTexture( GL_TEXTURE1 );
glBindTexture( GL_TEXTURE_2D, world.random_samples );
glUniform1i( SHADER_UNIFORM( shader_background, "uSamplerNoise" ), 1 );
- glUniform1f( SHADER_UNIFORM( shader_background, "uVisibility" ), 1.0f ); // (sinf( vg_time ) + 1.0f) * 0.5f );
+ glUniform1f( SHADER_UNIFORM( shader_background, "uVisibility" ), 1.0f ); //world.st.world_transition );
draw_mesh( 0, 2 );
glUniformMatrix3fv( SHADER_UNIFORM( shader_tile_main, "uPv" ), 1, GL_FALSE, (float *)vg_pv );
glUniform1f( SHADER_UNIFORM( shader_tile_main, "uGhost" ), 0.0f );
glUniform1f( SHADER_UNIFORM( shader_tile_main, "uForeground" ), 0.0f );
- glUniform1f( SHADER_UNIFORM( shader_tile_main, "uVisibility" ), 2.0f ); // sinf( vg_time ) + 1.0f );
+ glUniform1f( SHADER_UNIFORM( shader_tile_main, "uVisibility" ), world.st.world_transition * 2.0f );
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
if( world_button_exec( &world.st.buttons[k_world_button_settings], (v2f){ 1.0f, 2.0f }, btn_orange, &stat ))
{
- //world.st.state = k_game_settings;
+ world.st.state = stat == k_world_button_on_enable? k_game_state_settings: k_game_state_main;
}
level_selection_buttons();
*/
}
-void vg_ui(void) {}
+void vg_ui(void)
+{
+ if( world.st.state == k_game_state_settings )
+ {
+ gui_group_id( 35 );
+
+ ui_global_ctx.cursor[2] = 225;
+ gui_fill_y();
+ gui_align_right();
+
+ gui_new_node();
+ {
+ gui_capture_mouse( 200 );
+
+ gui_fill_rect( ui_global_ctx.cursor, 0xC0202020 );
+ ui_rect_pad( ui_global_ctx.cursor, 8 );
+
+ ui_global_ctx.cursor[3] = 25;
+
+ gui_new_node();
+ {
+ gui_text( "Settings", 3 );
+ }
+ gui_end();
+
+ // Colour scheme selection
+ ui_global_ctx.cursor[1] += 30;
+
+ gui_text( "Colour Scheme", 2 );
+ ui_global_ctx.cursor[1] += 25;
+
+ gui_new_node();
+ {
+ ui_global_ctx.cursor[2] = 50;
+
+ for( int i = 0; i < 4; i ++ )
+ {
+ gui_new_node();
+ {
+ // Convert to RGB
+ u32 rgb = 0xff000000;
+
+ for( int j = 0; j < 3; j ++ )
+ rgb |= (u32)(colour_sets[ colour_set_id ][i][j]*255.0f) << j * 8;
+
+ gui_fill_rect( ui_global_ctx.cursor, rgb );
+ }
+ gui_end_right();
+ }
+ }
+ gui_end_down();
+
+ gui_new_node();
+ {
+ ui_global_ctx.cursor[2] = 25;
+ if( gui_button( 0 ) == k_button_click )
+ {
+ if( colour_set_id > 0 )
+ colour_set_id --;
+ }
+ gui_text( "<", 2 );
+ gui_end_right();
+
+ ui_global_ctx.cursor[2] = 150;
+ gui_new_node();
+ {
+ ui_global_ctx.cursor[0] += 45;
+ ui_global_ctx.cursor[1] += 6;
+ gui_text( (const char *[]){ "Normal", "Extra1", "Extra2" }[ colour_set_id ], 2 );
+ }
+ gui_end_right();
+
+ ui_global_ctx.cursor[2] = 25;
+ if( gui_button( 1 ) == k_button_click )
+ {
+ if( colour_set_id < vg_list_size( colour_sets )-1 )
+ colour_set_id ++;
+ }
+ gui_text( ">", 2 );
+ gui_end_down();
+ }
+ gui_end_down();
+ }
+ gui_end();
+ }
+}
#if STEAM_LEADERBOARDS
void leaderboard_dispatch_score(void)
{
// Save current level
console_save_map( 0, NULL );
+
if( console_load_map( argc, argv ) )
{
- world_static.zoom = 0.0f;
+ world.st.zoom = 0.0f;
simulation_stop();
return 1;
}