Revert some changes for sandbox drawing
Changelog: - Remove entity culling when drawing, not good right now - Put back number of entity in each tilescene_man
parent
fae37eeecd
commit
cf8e2ca1be
|
@ -109,12 +109,14 @@ static void level_scene_render_func(Scene_t* scene)
|
||||||
int y = tile_y * TILE_SIZE;
|
int y = tile_y * TILE_SIZE;
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(PLATFORM_WEB)
|
||||||
if (!tilemap.tiles[i].moveable)
|
if (!tilemap.tiles[i].moveable)
|
||||||
{
|
{
|
||||||
// Draw water tile
|
// Draw water tile
|
||||||
Color water_colour = ColorAlpha(RED, 0.2);
|
Color water_colour = ColorAlpha(RED, 0.2);
|
||||||
DrawRectangle(x, y, TILE_SIZE, TILE_SIZE, water_colour);
|
DrawRectangle(x, y, TILE_SIZE, TILE_SIZE, water_colour);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
uint8_t tile_sprite_idx = tilemap.tiles[i].tile_type + tilemap.tiles[i].rotation;
|
uint8_t tile_sprite_idx = tilemap.tiles[i].tile_type + tilemap.tiles[i].rotation;
|
||||||
if (data->tile_sprites[tile_sprite_idx] != NULL)
|
if (data->tile_sprites[tile_sprite_idx] != NULL)
|
||||||
|
@ -194,12 +196,13 @@ static void level_scene_render_func(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);
|
||||||
|
|
||||||
if (
|
// TODO: Figure out better way to cull this
|
||||||
p_ct->position.x < min.x * tilemap.tile_size
|
//if (
|
||||||
|| p_ct->position.x + p_bbox->size.x > max.x * tilemap.tile_size
|
// p_ct->position.x + p_bbox < min.x * tilemap.tile_size
|
||||||
|| p_ct->position.y < min.y * tilemap.tile_size
|
// || p_ct->position.x + p_bbox->size.x > max.x * tilemap.tile_size
|
||||||
|| p_ct->position.y + p_bbox->size.y > max.y * tilemap.tile_size
|
// || p_ct->position.y < min.y * tilemap.tile_size
|
||||||
) continue;
|
// || p_ct->position.y + p_bbox->size.y > max.y * tilemap.tile_size
|
||||||
|
//) continue;
|
||||||
|
|
||||||
Color colour;
|
Color colour;
|
||||||
switch(p_ent->m_tag)
|
switch(p_ent->m_tag)
|
||||||
|
@ -327,11 +330,14 @@ static void level_scene_render_func(Scene_t* scene)
|
||||||
unsigned int y = ((p_runner->current_tile) / tilemap.width) * tilemap.tile_size;
|
unsigned int y = ((p_runner->current_tile) / tilemap.width) * tilemap.tile_size;
|
||||||
DrawCircle(x+16, y+16, 8, ColorAlpha(BLUE, 0.6));
|
DrawCircle(x+16, y+16, 8, ColorAlpha(BLUE, 0.6));
|
||||||
}
|
}
|
||||||
#if !defined(PLATFORM_WEB)
|
for (int tile_y = min.y; tile_y <= max.y; tile_y++)
|
||||||
for (size_t i = 0; i < tilemap.n_tiles; ++i)
|
|
||||||
{
|
{
|
||||||
int x = (i % tilemap.width) * TILE_SIZE;
|
for (int tile_x = min.x; tile_x <= max.x; tile_x++)
|
||||||
int y = (i / tilemap.width) * TILE_SIZE;
|
{
|
||||||
|
int i = tile_x + tile_y * tilemap.width;
|
||||||
|
int x = tile_x * TILE_SIZE;
|
||||||
|
int y = tile_y * TILE_SIZE;
|
||||||
|
|
||||||
sprintf(buffer, "%u", sc_map_size_64v(&tilemap.tiles[i].entities_set));
|
sprintf(buffer, "%u", sc_map_size_64v(&tilemap.tiles[i].entities_set));
|
||||||
|
|
||||||
if (tilemap.tiles[i].solid > 0)
|
if (tilemap.tiles[i].solid > 0)
|
||||||
|
@ -344,7 +350,7 @@ static void level_scene_render_func(Scene_t* scene)
|
||||||
DrawText(buffer, x, y, 10, BLACK);
|
DrawText(buffer, x, y, 10, BLACK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
|
|
||||||
// Draw tile grid
|
// Draw tile grid
|
||||||
for (size_t i = min.x; i < max.x; ++i)
|
for (size_t i = min.x; i < max.x; ++i)
|
||||||
|
@ -425,6 +431,7 @@ static void level_scene_render_func(Scene_t* scene)
|
||||||
gui_y += 30;
|
gui_y += 30;
|
||||||
sprintf(buffer, "Ladder: %u", p_pstate->ladder_state);
|
sprintf(buffer, "Ladder: %u", p_pstate->ladder_state);
|
||||||
DrawText(buffer, gui_x, gui_y, 12, BLACK);
|
DrawText(buffer, gui_x, gui_y, 12, BLACK);
|
||||||
|
gui_y += 30;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
//sprintf(buffer, "Spawn Entity: %s", get_spawn_selection_string(current_spawn_selection));
|
//sprintf(buffer, "Spawn Entity: %s", get_spawn_selection_string(current_spawn_selection));
|
||||||
|
|
Loading…
Reference in New Issue