Skip to content

Commit

Permalink
FF7: Fix rendering issues in the main menu screen with external textures
Browse files Browse the repository at this point in the history
  • Loading branch information
julianxhokaxhiu committed Dec 18, 2024
1 parent 65e06e3 commit c3e3f11
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1275,6 +1275,7 @@ void common_flip(struct game_obj *game_object)
{
// Skip reset on these mode(s)
case MODE_MENU:
case MODE_MAIN_MENU:
case MODE_GAMEOVER:
case MODE_CREDITS:
ff7_do_reset = false;
Expand Down Expand Up @@ -1315,7 +1316,7 @@ void common_clear(uint32_t clear_color, uint32_t clear_depth, uint32_t unknown,
if (!ff8 && enable_lighting) newRenderer.clearShadowMap();

newRenderer.setClearFlags(
clear_color || mode == MODE_MENU || mode == MODE_CONDOR,
clear_color || mode == MODE_MENU || mode == MODE_MAIN_MENU || mode == MODE_CONDOR,
clear_depth
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/gl/deferred.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ uint32_t gl_defer_sorted_draw(uint32_t primitivetype, uint32_t vertextype, struc
{
if (trace_all) ffnx_trace("gl_defer_sorted_draw: blend_mode != BLEND_AVG - blend_mode: %u\n", current_state.blend_mode);
// be conservative with non-standard blending modes
if (mode != MODE_MENU && mode != MODE_BATTLE) {
if (mode != MODE_MENU && mode != MODE_MAIN_MENU && mode != MODE_BATTLE) {
if (trace_all) ffnx_trace("gl_defer_sorted_draw: mode != MODE_MENU && mode != MODE_BATTLE - mode: %u\n", mode);
return false;
}
Expand Down
6 changes: 3 additions & 3 deletions src/gl/special_case.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@ uint32_t gl_special_case(uint32_t primitivetype, uint32_t vertextype, struct nve
if(vertextype != TLVERTEX && current_state.texture_set && VREF(texture_set, ogl.external)) current_state.texture_filter = true;

// modpath textures in menu should always be filtered
if(mode == MODE_MENU && current_state.texture_set && VREF(texture_set, ogl.external)) current_state.texture_filter = true;
if((mode == MODE_MENU || mode == MODE_MAIN_MENU) && current_state.texture_set && VREF(texture_set, ogl.external)) current_state.texture_filter = true;

// some modpath textures have filtering forced on
if(current_state.texture_set && VREF(texture_set, ogl.gl_set->force_filter) && VREF(texture_set, ogl.external)) current_state.texture_filter = true;

// Texture filtering mostly does not work well in FF8
if(ff8) current_state.texture_filter = enable_bilinear && vertextype != TLVERTEX && current_state.texture_set;
else if (enable_bilinear && (vertextype != TLVERTEX || mode == MODE_MENU || (current_state.texture_set && VREF(texture_set, ogl.gl_set->force_filter)))) current_state.texture_filter = true;
else if (enable_bilinear && (vertextype != TLVERTEX || mode == MODE_MENU || mode == MODE_MAIN_MENU || (current_state.texture_set && VREF(texture_set, ogl.gl_set->force_filter)))) current_state.texture_filter = true;

// some modpath textures have z-sort forced on
if(current_state.texture_set && VREF(texture_set, ogl.gl_set->force_zsort) && VREF(texture_set, ogl.external)) defer = true;

// z-sort by default in menu, unnecessary sorting will be avoided by defer logic
if(mode == MODE_MENU) defer = true;
if(mode == MODE_MENU || mode == MODE_MAIN_MENU) defer = true;

if(!ff8)
{
Expand Down
2 changes: 2 additions & 0 deletions src/sfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ bool ff7_sfx_play_layered(float panning, int id, int channel)
sprintf(track_name, "%s_%d_%d", get_current_field_name(), *common_externals.current_triangle_id, id);
break;
case MODE_MENU:
case MODE_MAIN_MENU:
sprintf(track_name, "menu_%d", id);
break;
case MODE_WORLDMAP:
Expand Down Expand Up @@ -263,6 +264,7 @@ bool ff8_sfx_play_layered(int channel, int id, int volume, float panning)
if (!playing) sprintf(track_name, "%s_%d", get_current_field_name(), id);
break;
case MODE_MENU:
case MODE_MAIN_MENU:
sprintf(track_name, "menu_%d", id);
break;
case MODE_WORLDMAP:
Expand Down

0 comments on commit c3e3f11

Please sign in to comment.