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;
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();
{
// 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;
}