Compare commits
No commits in common. "8a39f85c45e342006da577cd47c83020b530b2c0" and "05e58677a5d49f1c712bced1461e247bb2ce366b" have entirely different histories.
8a39f85c45
...
05e58677a5
|
@ -17,6 +17,5 @@ typedef enum ActionType
|
||||||
ACTION_NEXTLEVEL,
|
ACTION_NEXTLEVEL,
|
||||||
ACTION_PREVLEVEL,
|
ACTION_PREVLEVEL,
|
||||||
ACTION_TOGGLE_GRID,
|
ACTION_TOGGLE_GRID,
|
||||||
ACTION_SET_SPAWNPOINT,
|
|
||||||
}ActionType_t;
|
}ActionType_t;
|
||||||
#endif // __ACTIONS_H
|
#endif // __ACTIONS_H
|
||||||
|
|
|
@ -79,9 +79,7 @@ static inline unsigned int get_tile_idx(int x, int y, const TileGrid_t* tilemap)
|
||||||
return MAX_N_TILES;
|
return MAX_N_TILES;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This means you might be able to have two editor scene without running into problems
|
|
||||||
static RenderTexture2D selection_section;
|
static RenderTexture2D selection_section;
|
||||||
#define SELECTION_RENDER_HEIGHT (SELECTION_REGION_HEIGHT * 3)
|
|
||||||
static void level_scene_render_func(Scene_t* scene)
|
static void level_scene_render_func(Scene_t* scene)
|
||||||
{
|
{
|
||||||
LevelSceneData_t* data = &(CONTAINER_OF(scene, LevelScene_t, scene)->data);
|
LevelSceneData_t* data = &(CONTAINER_OF(scene, LevelScene_t, scene)->data);
|
||||||
|
@ -100,7 +98,7 @@ static void level_scene_render_func(Scene_t* scene)
|
||||||
WHITE
|
WHITE
|
||||||
);
|
);
|
||||||
draw_rec.width = SELECTION_REGION_WIDTH;
|
draw_rec.width = SELECTION_REGION_WIDTH;
|
||||||
draw_rec.height = -SELECTION_RENDER_HEIGHT;
|
draw_rec.height = -(SELECTION_REGION_HEIGHT * 2 + 10);
|
||||||
|
|
||||||
|
|
||||||
Vector2 draw_pos = {data->game_rec.x, data->game_rec.y + data->game_rec.height + SELECTION_GAP};
|
Vector2 draw_pos = {data->game_rec.x, data->game_rec.y + data->game_rec.height + SELECTION_GAP};
|
||||||
|
@ -292,12 +290,6 @@ static void render_editor_game_scene(Scene_t* scene)
|
||||||
{
|
{
|
||||||
CTransform_t* p_ct = get_component(p_ent, CTRANSFORM_COMP_T);
|
CTransform_t* p_ct = get_component(p_ent, CTRANSFORM_COMP_T);
|
||||||
CBBox_t* p_bbox = get_component(p_ent, CBBOX_COMP_T);
|
CBBox_t* p_bbox = get_component(p_ent, CBBOX_COMP_T);
|
||||||
|
|
||||||
// Draw the spawn point
|
|
||||||
if (p_ent->m_tag == PLAYER_ENT_TAG)
|
|
||||||
{
|
|
||||||
DrawCircleV(p_ent->spawn_pos, 6, PURPLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Entity culling
|
// Entity culling
|
||||||
Vector2 box_size = {0};
|
Vector2 box_size = {0};
|
||||||
|
@ -795,11 +787,9 @@ static void restart_editor_level(Scene_t* scene)
|
||||||
static void 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;
|
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)
|
||||||
sc_map_foreach_value(&scene->ent_manager.entities_map[PLAYER_ENT_TAG], p_player)
|
|
||||||
{
|
{
|
||||||
CPlayerState_t* p_playerstate = get_component(p_player, CPLAYERSTATE_T);
|
|
||||||
switch(action)
|
switch(action)
|
||||||
{
|
{
|
||||||
case ACTION_UP:
|
case ACTION_UP:
|
||||||
|
@ -908,12 +898,6 @@ static void level_do_action(Scene_t* scene, ActionType_t action, bool pressed)
|
||||||
data->show_grid = !data->show_grid;
|
data->show_grid = !data->show_grid;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_SET_SPAWNPOINT:
|
|
||||||
{
|
|
||||||
CTransform_t* p_ct = get_component(p_player, CTRANSFORM_COMP_T);
|
|
||||||
p_player->spawn_pos = p_ct->position;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -939,7 +923,7 @@ void init_sandbox_scene(LevelScene_t* scene)
|
||||||
unsigned int tile_idx = (scene->data.tilemap.height - 1) * scene->data.tilemap.width + i;
|
unsigned int tile_idx = (scene->data.tilemap.height - 1) * scene->data.tilemap.width + i;
|
||||||
change_a_tile(&scene->data.tilemap, tile_idx, SOLID_TILE);
|
change_a_tile(&scene->data.tilemap, tile_idx, SOLID_TILE);
|
||||||
}
|
}
|
||||||
selection_section = LoadRenderTexture(SELECTION_REGION_WIDTH, SELECTION_RENDER_HEIGHT);
|
selection_section = LoadRenderTexture(SELECTION_REGION_WIDTH, SELECTION_REGION_HEIGHT * 2 + 10);
|
||||||
|
|
||||||
BeginTextureMode(selection_section);
|
BeginTextureMode(selection_section);
|
||||||
ClearBackground(LIGHTGRAY);
|
ClearBackground(LIGHTGRAY);
|
||||||
|
@ -1016,7 +1000,7 @@ void init_sandbox_scene(LevelScene_t* scene)
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_pos.y += SELECTION_TILE_SIZE + 2;
|
draw_pos.y += SELECTION_TILE_SIZE + 2;
|
||||||
DrawText("R to reset the map, Q/E to cycle the selection,\nF to toggle metal crates. T to toggle crate spawn behaviour\nB to toggle grid, V to set spawn point", 0, draw_pos.y, 14, BLACK);
|
DrawText("R to reset the map, Q/E to cycle the selection,\nF to toggle metal crates. T to toggle crate spawn behaviour", 0, draw_pos.y, 14, BLACK);
|
||||||
|
|
||||||
|
|
||||||
EndTextureMode();
|
EndTextureMode();
|
||||||
|
@ -1076,8 +1060,7 @@ void init_sandbox_scene(LevelScene_t* scene)
|
||||||
sc_map_put_64(&scene->scene.action_map, KEY_T, ACTION_CRATE_ACTIVATION);
|
sc_map_put_64(&scene->scene.action_map, KEY_T, ACTION_CRATE_ACTIVATION);
|
||||||
sc_map_put_64(&scene->scene.action_map, KEY_L, ACTION_EXIT);
|
sc_map_put_64(&scene->scene.action_map, KEY_L, ACTION_EXIT);
|
||||||
sc_map_put_64(&scene->scene.action_map, KEY_R, ACTION_RESTART);
|
sc_map_put_64(&scene->scene.action_map, KEY_R, ACTION_RESTART);
|
||||||
sc_map_put_64(&scene->scene.action_map, KEY_B, ACTION_TOGGLE_GRID);
|
sc_map_put_64(&scene->scene.action_map, KEY_H, ACTION_TOGGLE_GRID);
|
||||||
sc_map_put_64(&scene->scene.action_map, KEY_V, ACTION_SET_SPAWNPOINT);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1504,9 +1504,9 @@ void update_entity_emitter_system(Scene_t* scene)
|
||||||
{
|
{
|
||||||
Entity_t* p_ent = get_entity(&scene->ent_manager, ent_idx);
|
Entity_t* p_ent = get_entity(&scene->ent_manager, ent_idx);
|
||||||
CTransform_t* p_ctransform = get_component(p_ent, CTRANSFORM_COMP_T);
|
CTransform_t* p_ctransform = get_component(p_ent, CTRANSFORM_COMP_T);
|
||||||
//CBBox_t* p_bbox = get_component(p_ent, CBBOX_COMP_T);
|
CBBox_t* p_bbox = get_component(p_ent, CBBOX_COMP_T);
|
||||||
Vector2 new_pos = Vector2Add(p_ctransform->position,p_emitter->offset);
|
Vector2 new_pos = p_ctransform->position;
|
||||||
//new_pos.y += p_bbox->half_size.y;
|
new_pos.y += p_bbox->half_size.y;
|
||||||
if (is_emitter_handle_alive(&scene->part_sys, p_emitter->handle))
|
if (is_emitter_handle_alive(&scene->part_sys, p_emitter->handle))
|
||||||
{
|
{
|
||||||
update_emitter_handle_position(&scene->part_sys, p_emitter->handle, new_pos);
|
update_emitter_handle_position(&scene->part_sys, p_emitter->handle, new_pos);
|
||||||
|
@ -1936,14 +1936,13 @@ void airtimer_update_system(Scene_t* scene)
|
||||||
{
|
{
|
||||||
if (!is_emitter_handle_alive(&scene->part_sys, p_emitter->handle))
|
if (!is_emitter_handle_alive(&scene->part_sys, p_emitter->handle))
|
||||||
{
|
{
|
||||||
//Vector2 new_pos = p_ctransform->position;
|
Vector2 new_pos = p_ctransform->position;
|
||||||
//new_pos.y += p_bbox->half_size.y;
|
new_pos.y += p_bbox->half_size.y;
|
||||||
|
|
||||||
ParticleEmitter_t emitter = {
|
ParticleEmitter_t emitter = {
|
||||||
.spr = get_sprite(&scene->engine->assets, "p_water"),
|
.spr = get_sprite(&scene->engine->assets, "p_water"),
|
||||||
.config = get_emitter_conf(&scene->engine->assets, "pe_bubbling"),
|
.config = get_emitter_conf(&scene->engine->assets, "pe_bubbling"),
|
||||||
//.position = new_pos,
|
.position = new_pos,
|
||||||
.position = p_ctransform->position,
|
|
||||||
.n_particles = 5,
|
.n_particles = 5,
|
||||||
.user_data = &(CONTAINER_OF(scene, LevelScene_t, scene)->data),
|
.user_data = &(CONTAINER_OF(scene, LevelScene_t, scene)->data),
|
||||||
.update_func = &floating_particle_system_update,
|
.update_func = &floating_particle_system_update,
|
||||||
|
|
|
@ -105,8 +105,7 @@ Entity_t* create_player(EntityManager_t* ent_manager)
|
||||||
p_cspr->sprites = player_sprite_map;
|
p_cspr->sprites = player_sprite_map;
|
||||||
p_cspr->transition_func = &player_sprite_transition_func;
|
p_cspr->transition_func = &player_sprite_transition_func;
|
||||||
|
|
||||||
CEmitter_t* p_emitter = add_component(p_ent, CEMITTER_T);
|
add_component(p_ent, CEMITTER_T);
|
||||||
p_emitter->offset = (Vector2){7,0};
|
|
||||||
|
|
||||||
return p_ent;
|
return p_ent;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue