Remove unused ActionResult
There is only one focused scene at a time as part of the design limitation. Thus, it is no longer neededlevel_select
parent
e52855dfbd
commit
b158bee1e8
|
@ -238,9 +238,9 @@ inline void render_scene(Scene_t* scene)
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ActionResult do_action(Scene_t* scene, ActionType_t action, bool pressed)
|
inline void do_action(Scene_t* scene, ActionType_t action, bool pressed)
|
||||||
{
|
{
|
||||||
return scene->action_function(scene, action, pressed);
|
scene->action_function(scene, action, pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void process_active_scene_inputs(GameEngine_t* engine)
|
void process_active_scene_inputs(GameEngine_t* engine)
|
||||||
|
|
|
@ -43,13 +43,8 @@ typedef struct GameEngine {
|
||||||
#define SCENE_RENDER_BIT (1 << 1) // Whether to render
|
#define SCENE_RENDER_BIT (1 << 1) // Whether to render
|
||||||
#define SCENE_COMPLETE_ACTIVE (SCENE_ACTIVE_BIT | SCENE_RENDER_BIT)
|
#define SCENE_COMPLETE_ACTIVE (SCENE_ACTIVE_BIT | SCENE_RENDER_BIT)
|
||||||
|
|
||||||
typedef enum ActionResult {
|
|
||||||
ACTION_PROPAGATE = 0,
|
|
||||||
ACTION_CONSUMED,
|
|
||||||
} ActionResult;
|
|
||||||
|
|
||||||
typedef void(*system_func_t)(Scene_t*);
|
typedef void(*system_func_t)(Scene_t*);
|
||||||
typedef ActionResult(*action_func_t)(Scene_t*, ActionType_t, bool);
|
typedef void(*action_func_t)(Scene_t*, ActionType_t, bool);
|
||||||
sc_array_def(system_func_t, systems);
|
sc_array_def(system_func_t, systems);
|
||||||
|
|
||||||
typedef struct RenderLayer {
|
typedef struct RenderLayer {
|
||||||
|
@ -102,7 +97,7 @@ void update_sfx_list(GameEngine_t* engine);
|
||||||
// Inline functions, for convenience
|
// Inline functions, for convenience
|
||||||
extern void update_scene(Scene_t* scene, float delta_time);
|
extern void update_scene(Scene_t* scene, float delta_time);
|
||||||
extern void render_scene(Scene_t* scene);
|
extern void render_scene(Scene_t* scene);
|
||||||
extern ActionResult do_action(Scene_t* scene, ActionType_t action, bool pressed);
|
extern void do_action(Scene_t* scene, ActionType_t action, bool pressed);
|
||||||
|
|
||||||
void init_scene(Scene_t* scene, action_func_t action_func);
|
void init_scene(Scene_t* scene, action_func_t action_func);
|
||||||
bool add_scene_layer(Scene_t* scene, int width, int height, Rectangle render_area);
|
bool add_scene_layer(Scene_t* scene, int width, int height, Rectangle render_area);
|
||||||
|
|
|
@ -65,7 +65,7 @@ static void print_number_sys(Scene_t* scene)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static ActionResult level_do_action(Scene_t* scene, ActionType_t action, bool pressed)
|
static void level_do_action(Scene_t* scene, ActionType_t action, bool pressed)
|
||||||
{
|
{
|
||||||
CPlayerState_t* p_playerstate;
|
CPlayerState_t* p_playerstate;
|
||||||
sc_map_foreach_value(&scene->ent_manager.component_map[CPLAYERSTATE_T], p_playerstate)
|
sc_map_foreach_value(&scene->ent_manager.component_map[CPLAYERSTATE_T], p_playerstate)
|
||||||
|
@ -96,7 +96,6 @@ static ActionResult level_do_action(Scene_t* scene, ActionType_t action, bool pr
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ACTION_PROPAGATE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
|
|
|
@ -797,7 +797,7 @@ static void restart_editor_level(Scene_t* scene)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static ActionResult level_do_action(Scene_t* scene, ActionType_t action, bool pressed)
|
static void level_do_action(Scene_t* scene, ActionType_t action, bool pressed)
|
||||||
{
|
{
|
||||||
LevelSceneData_t* data = &(CONTAINER_OF(scene, LevelScene_t, scene)->data);
|
LevelSceneData_t* data = &(CONTAINER_OF(scene, LevelScene_t, scene)->data);
|
||||||
Entity_t* p_player;
|
Entity_t* p_player;
|
||||||
|
@ -1002,7 +1002,6 @@ static ActionResult level_do_action(Scene_t* scene, ActionType_t action, bool pr
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ACTION_PROPAGATE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_sandbox_scene(LevelScene_t* scene)
|
void init_sandbox_scene(LevelScene_t* scene)
|
||||||
|
|
|
@ -45,7 +45,7 @@ static void level_scene_render_func(Scene_t* scene)
|
||||||
EndTextureMode();
|
EndTextureMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
static ActionResult level_do_action(Scene_t* scene, ActionType_t action, bool pressed)
|
static void level_do_action(Scene_t* scene, ActionType_t action, bool pressed)
|
||||||
{
|
{
|
||||||
CPlayerState_t* p_playerstate;
|
CPlayerState_t* p_playerstate;
|
||||||
sc_map_foreach_value(&scene->ent_manager.component_map[CPLAYERSTATE_T], p_playerstate)
|
sc_map_foreach_value(&scene->ent_manager.component_map[CPLAYERSTATE_T], p_playerstate)
|
||||||
|
@ -96,7 +96,6 @@ static ActionResult level_do_action(Scene_t* scene, ActionType_t action, bool pr
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ACTION_PROPAGATE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void render_regular_game_scene(Scene_t* scene)
|
static void render_regular_game_scene(Scene_t* scene)
|
||||||
|
|
|
@ -34,7 +34,7 @@ static void exec_component_function(Scene_t* scene, int sel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static ActionResult menu_do_action(Scene_t* scene, ActionType_t action, bool pressed)
|
static void menu_do_action(Scene_t* scene, ActionType_t action, bool pressed)
|
||||||
{
|
{
|
||||||
MenuSceneData_t* data = &(CONTAINER_OF(scene, MenuScene_t, scene)->data);
|
MenuSceneData_t* data = &(CONTAINER_OF(scene, MenuScene_t, scene)->data);
|
||||||
unsigned int new_selection = data->selected_comp;
|
unsigned int new_selection = data->selected_comp;
|
||||||
|
@ -83,7 +83,6 @@ static ActionResult menu_do_action(Scene_t* scene, ActionType_t action, bool pre
|
||||||
exec_component_function(scene, data->selected_comp);
|
exec_component_function(scene, data->selected_comp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ACTION_PROPAGATE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gui_loop(Scene_t* scene)
|
static void gui_loop(Scene_t* scene)
|
||||||
|
|
|
@ -343,7 +343,7 @@ static void toggle_block_system(Scene_t* scene)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static ActionResult level_do_action(Scene_t* scene, ActionType_t action, bool pressed)
|
static void level_do_action(Scene_t* scene, ActionType_t action, bool pressed)
|
||||||
{
|
{
|
||||||
CPlayerState_t* p_playerstate;
|
CPlayerState_t* p_playerstate;
|
||||||
sc_map_foreach_value(&scene->ent_manager.component_map[CPLAYERSTATE_T], p_playerstate)
|
sc_map_foreach_value(&scene->ent_manager.component_map[CPLAYERSTATE_T], p_playerstate)
|
||||||
|
@ -377,7 +377,6 @@ static ActionResult level_do_action(Scene_t* scene, ActionType_t action, bool pr
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ACTION_PROPAGATE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void player_simple_movement_system(Scene_t* scene)
|
static void player_simple_movement_system(Scene_t* scene)
|
||||||
|
|
Loading…
Reference in New Issue