From 763e101208dbdd78cc43ed45141e72d9dc298929 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Wed, 16 Oct 2024 21:35:52 +0300 Subject: [PATCH] ref: preserve aspect ratio when saving level and save shots --- ref/gl/gl_backend.c | 16 ++-------------- ref/soft/r_glblit.c | 16 ++-------------- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/ref/gl/gl_backend.c b/ref/gl/gl_backend.c index 1019efc6..01dc9556 100644 --- a/ref/gl/gl_backend.c +++ b/ref/gl/gl_backend.c @@ -494,22 +494,10 @@ qboolean VID_ScreenShot( const char *filename, int shot_type ) gEngfuncs.fsapi->AllowDirectPaths( true ); break; case VID_LEVELSHOT: - flags |= IMAGE_RESAMPLE; - if( gpGlobals->wideScreen ) - { - height = 480; - width = 800; - } - else - { - height = 480; - width = 640; - } - break; case VID_MINISHOT: flags |= IMAGE_RESAMPLE; - height = 200; - width = 320; + height = shot_type == VID_MINISHOT ? 200 : 480; + width = Q_rint( height * ((double)r_shot->width / r_shot->height )); break; case VID_MAPSHOT: flags |= IMAGE_RESAMPLE|IMAGE_QUANTIZE; // GoldSrc request overviews in 8-bit format diff --git a/ref/soft/r_glblit.c b/ref/soft/r_glblit.c index 54dcbfa1..f113a535 100644 --- a/ref/soft/r_glblit.c +++ b/ref/soft/r_glblit.c @@ -906,22 +906,10 @@ qboolean GAME_EXPORT VID_ScreenShot( const char *filename, int shot_type ) gEngfuncs.fsapi->AllowDirectPaths( true ); break; case VID_LEVELSHOT: - flags |= IMAGE_RESAMPLE; - if( gpGlobals->wideScreen ) - { - height = 480; - width = 800; - } - else - { - height = 480; - width = 640; - } - break; case VID_MINISHOT: flags |= IMAGE_RESAMPLE; - height = 200; - width = 320; + height = shot_type == VID_MINISHOT ? 200 : 480; + width = Q_rint( height * ((double)r_shot->width / r_shot->height )); break; case VID_MAPSHOT: flags |= IMAGE_RESAMPLE|IMAGE_QUANTIZE; // GoldSrc request overviews in 8-bit format