Remove unused ActionResult

There is only one focused scene at a time as part of the design
limitation. Thus, it is no longer needed
level_select
En Yi 2024-07-01 20:48:48 +08:00
parent e52855dfbd
commit b158bee1e8
7 changed files with 9 additions and 19 deletions

View File

@ -238,9 +238,9 @@ inline void render_scene(Scene_t* scene)
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)

View File

@ -43,13 +43,8 @@ typedef struct GameEngine {
#define SCENE_RENDER_BIT (1 << 1) // Whether to render
#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 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);
typedef struct RenderLayer {
@ -102,7 +97,7 @@ void update_sfx_list(GameEngine_t* engine);
// Inline functions, for convenience
extern void update_scene(Scene_t* scene, float delta_time);
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);
bool add_scene_layer(Scene_t* scene, int width, int height, Rectangle render_area);

View File

@ -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;
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:
break;
}
return ACTION_PROPAGATE;
}
int main(void)

View File

@ -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);
Entity_t* p_player;
@ -1002,7 +1002,6 @@ static ActionResult level_do_action(Scene_t* scene, ActionType_t action, bool pr
break;
}
}
return ACTION_PROPAGATE;
}
void init_sandbox_scene(LevelScene_t* scene)

View File

@ -45,7 +45,7 @@ static void level_scene_render_func(Scene_t* scene)
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;
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;
}
}
return ACTION_PROPAGATE;
}
static void render_regular_game_scene(Scene_t* scene)

View File

@ -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);
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);
}
}
return ACTION_PROPAGATE;
}
static void gui_loop(Scene_t* scene)

View File

@ -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;
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:
break;
}
return ACTION_PROPAGATE;
}
static void player_simple_movement_system(Scene_t* scene)