@@ -129,6 +129,7 @@ bool Supernova_hits_at_zero;
129129bool Show_subtitle_uses_pixels;
130130int Show_subtitle_screen_base_res[2 ];
131131int Show_subtitle_screen_adjusted_res[2 ];
132+ int HUD_set_coords_screen_base_res[2 ];
132133bool Always_warn_player_about_unbound_keys;
133134leadIndicatorBehavior Lead_indicator_behavior;
134135shadow_disable_overrides Shadow_disable_overrides {false , false , false , false };
@@ -465,6 +466,21 @@ void parse_mod_table(const char *filename)
465466 }
466467 }
467468
469+ if (optional_string (" $HUD-set-coords base resolution:" )) {
470+ int base_res[2 ];
471+ if (stuff_int_list (base_res, 2 ) == 2 ) {
472+ if (base_res[0 ] >= 640 && base_res[1 ] >= 480 ) {
473+ HUD_set_coords_screen_base_res[0 ] = base_res[0 ];
474+ HUD_set_coords_screen_base_res[1 ] = base_res[1 ];
475+ mprintf ((" Game Settings Table: HUD-set-coords base resolution is (%d, %d)\n " , base_res[0 ], base_res[1 ]));
476+ } else {
477+ Warning (LOCATION, " $HUD-set-coords base resolution: arguments must be at least 640x480!" );
478+ }
479+ } else {
480+ Warning (LOCATION, " $HUD-set-coords base resolution: must specify two arguments" );
481+ }
482+ }
483+
468484 optional_string (" #GRAPHICS SETTINGS" );
469485
470486 if (optional_string (" $Enable External Shaders:" )) {
@@ -1295,15 +1311,17 @@ void mod_table_post_process()
12951311 // use the same widescreen code as in adjust_base_res()
12961312 // This calculates an adjusted resolution if the aspect ratio of the base resolution doesn't exactly match that of the current resolution.
12971313 // The base resolution specified in game_settings.tbl does not need to be 1024x768 or even 4:3.
1298- float aspect_quotient = ((float )gr_screen.center_w / (float )gr_screen.center_h ) / ((float )Show_subtitle_screen_base_res[0 ] / (float )Show_subtitle_screen_base_res[1 ]);
1299- if (aspect_quotient >= 1.0 ) {
1300- Show_subtitle_screen_adjusted_res[0 ] = (int )(Show_subtitle_screen_base_res[0 ] * aspect_quotient );
1314+ float aspect_quotient_subtitle = ((float )gr_screen.center_w / (float )gr_screen.center_h ) / ((float )Show_subtitle_screen_base_res[0 ] / (float )Show_subtitle_screen_base_res[1 ]);
1315+ if (aspect_quotient_subtitle >= 1.0 ) {
1316+ Show_subtitle_screen_adjusted_res[0 ] = (int )(Show_subtitle_screen_base_res[0 ] * aspect_quotient_subtitle );
13011317 Show_subtitle_screen_adjusted_res[1 ] = Show_subtitle_screen_base_res[1 ];
13021318 } else {
13031319 Show_subtitle_screen_adjusted_res[0 ] = Show_subtitle_screen_base_res[0 ];
1304- Show_subtitle_screen_adjusted_res[1 ] = (int )(Show_subtitle_screen_base_res[1 ] / aspect_quotient );
1320+ Show_subtitle_screen_adjusted_res[1 ] = (int )(Show_subtitle_screen_base_res[1 ] / aspect_quotient_subtitle );
13051321 }
13061322 mprintf ((" Game Settings Table: Show-subtitle adjusted resolution is (%d, %d)\n " , Show_subtitle_screen_adjusted_res[0 ], Show_subtitle_screen_adjusted_res[1 ]));
1323+
1324+ // we don't need to calculate adjusted resolution for hud-set-coords because that function doesn't do screen scaling
13071325}
13081326
13091327bool mod_supports_version (int major, int minor, int build)
@@ -1416,6 +1434,8 @@ void mod_table_reset()
14161434 Show_subtitle_screen_base_res[1 ] = -1 ;
14171435 Show_subtitle_screen_adjusted_res[0 ] = -1 ;
14181436 Show_subtitle_screen_adjusted_res[1 ] = -1 ;
1437+ HUD_set_coords_screen_base_res[0 ] = -1 ;
1438+ HUD_set_coords_screen_base_res[1 ] = -1 ;
14191439 Always_warn_player_about_unbound_keys = false ;
14201440 Lead_indicator_behavior = leadIndicatorBehavior::DEFAULT;
14211441 Thruster_easing = 0 ;
0 commit comments