Remove parallax rendering when screen is full of level geometry

This commit is contained in:
Lucas S. Vieira 2024-12-24 13:33:58 -03:00
parent 58df55173a
commit e524fd60b0
3 changed files with 9 additions and 1 deletions

View file

@ -73,6 +73,7 @@ void level_debrief();
void load_map16(TileMap16 *mapping, const char *filename, const char *collision_filename); void load_map16(TileMap16 *mapping, const char *filename, const char *collision_filename);
void load_map128(TileMap128 *mapping, const char *filename); void load_map128(TileMap128 *mapping, const char *filename);
void load_lvl(LevelData *lvl, const char *filename); void load_lvl(LevelData *lvl, const char *filename);
uint16_t level_get_num_sprites();
void prepare_renderer(LevelData *lvl); void prepare_renderer(LevelData *lvl);
void render_lvl( void render_lvl(

View file

@ -230,6 +230,8 @@ static uint16_t _numsprites = 0;
static uint8_t _current_spritebuf = 0; static uint8_t _current_spritebuf = 0;
static SPRT_8 _sprites[2][MAX_TILES]; static SPRT_8 _sprites[2][MAX_TILES];
uint16_t level_get_num_sprites() { return _numsprites; }
void void
_render_8( _render_8(
int16_t vx, int16_t vy, int16_t otz, int16_t vx, int16_t vy, int16_t otz,

View file

@ -503,7 +503,9 @@ screen_level_draw(void *d)
render_lvl(&leveldata, &map128, &map16, &obj_table_common, camera.pos.vx, camera.pos.vy); render_lvl(&leveldata, &map128, &map16, &obj_table_common, camera.pos.vx, camera.pos.vy);
// Draw background and parallax // Draw background and parallax
parallax_draw(&data->parallax, &camera); if(level_get_num_sprites() < 1312)
parallax_draw(&data->parallax, &camera);
// If we're in R4, draw a gradient on the background. // If we're in R4, draw a gradient on the background.
if(level == 8 || level == 9) { if(level == 8 || level == 9) {
POLY_G4 *poly = get_next_prim(); POLY_G4 *poly = get_next_prim();
@ -671,6 +673,9 @@ screen_level_draw(void *d)
snprintf(buffer, 255, "AIR %02d", player.remaining_air_frames / 60); snprintf(buffer, 255, "AIR %02d", player.remaining_air_frames / 60);
font_draw_sm(buffer, 248, 52); font_draw_sm(buffer, 248, 52);
snprintf(buffer, 255, "SPR %4d", level_get_num_sprites());
font_draw_sm(buffer, 248, 60);
// Player debug // Player debug
if(debug_mode > 1) { if(debug_mode > 1) {
snprintf(buffer, 255, snprintf(buffer, 255,