From f012f8f839c9a255f37eacf06cc9aa8af3661aa0 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Sat, 16 Dec 2023 20:59:05 +0700 Subject: [PATCH] move video definition to v_video.c, add comments --- src/i_video.c | 7 ------- src/v_video.c | 7 +++++++ src/v_video.h | 14 +++++++------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/i_video.c b/src/i_video.c index ea407b13..5776ae2a 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -46,8 +46,6 @@ #define ACTUALHEIGHT 240 -video_t video; - resolution_mode_t resolution_mode, default_resolution_mode; boolean use_vsync; // killough 2/8/98: controls whether vsync is called @@ -1033,11 +1031,6 @@ static void ResetResolution(int height) video.fov = 2 * atan(video.unscaledw / (1.2 * SCREENHEIGHT) * 3 / 4) / M_PI * ANG180; - video.xscale = (video.width << FRACBITS) / video.unscaledw; - video.yscale = (video.height << FRACBITS) / SCREENHEIGHT; - video.xstep = ((video.unscaledw << FRACBITS) / video.width) + 1; - video.ystep = ((SCREENHEIGHT << FRACBITS) / video.height) + 1; - Z_FreeTag(PU_VALLOC); V_Init(); diff --git a/src/v_video.c b/src/v_video.c index e4af080e..d77d2bc4 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -282,6 +282,8 @@ void WriteGeneratedLumpWad(const char *filename) free(lumps); } +video_t video; + #define WIDE_SCREENWIDTH 576 // corresponds to 2.4 aspect ratio static int x1lookup[WIDE_SCREENWIDTH + 1]; @@ -970,6 +972,11 @@ void V_Init(void) linesize = video.width; + video.xscale = (video.width << FRACBITS) / video.unscaledw; + video.yscale = (video.height << FRACBITS) / SCREENHEIGHT; + video.xstep = ((video.unscaledw << FRACBITS) / video.width) + 1; + video.ystep = ((SCREENHEIGHT << FRACBITS) / video.height) + 1; + x1lookup[0] = 0; lastfrac = frac = 0; for (i = 0; i < video.width; i++) diff --git a/src/v_video.h b/src/v_video.h index e66adfae..44ec9d25 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -93,15 +93,15 @@ typedef struct { int width; int height; - int unscaledw; - int deltaw; + int unscaledw; // unscaled width with correction for widecreen + int deltaw; // widescreen delta - fixed_t xscale; - fixed_t yscale; - fixed_t xstep; - fixed_t ystep; + fixed_t xscale; // x-axis scaling multiplier + fixed_t yscale; // y-axis scaling multiplier + fixed_t xstep; // x-axis scaling step + fixed_t ystep; // y-axis scaling step - angle_t fov; + angle_t fov; // widescreen FOV } video_t; extern video_t video;