diff --git a/src/v_video.cpp b/src/v_video.cpp index dcc5789ee..acd34f37f 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -1721,6 +1721,26 @@ const int BaseRatioSizes[7][4] = { 1707, 338, 0, 48*9/16 } // 21:9 568.8889, 337.5, multiplied by three }; +int AspectBaseWidth(float aspect) +{ + return (int)round(240.0f * aspect * 3.0f); +} + +int AspectBaseHeight(float aspect) +{ + return (int)round(200.0f * (320.0f / (240.0f * aspect)) * 3.0f); +} + +int AspectPspriteOffset(float aspect) +{ + return aspect < 1.3f ? (int)(6.5*FRACUNIT) : 0; +} + +int AspectMultiplier(float aspect) +{ + return (int)round(320.0f / (240.0f * aspect) * 48.0f); +} + void IVideo::DumpAdapters () { Printf("Multi-monitor support unavailable.\n"); diff --git a/src/v_video.h b/src/v_video.h index 6b46fa278..2dc3bbddc 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -518,6 +518,11 @@ int CheckRatio (int width, int height, int *trueratio=NULL); static inline int CheckRatio (double width, double height) { return CheckRatio(int(width), int(height)); } float ActiveRatio (int width, int height, float *trueratio = NULL); static inline double ActiveRatio (double width, double height) { return ActiveRatio(int(width), int(height)); } + +int AspectBaseWidth(float aspect); +int AspectBaseHeight(float aspect); +int AspectPspriteOffset(float aspect); +int AspectMultiplier(float aspect); extern const int BaseRatioSizes[7][4]; inline bool IsRatioWidescreen(int ratio) {