From 06e7a74f82e932dc07a732ca505837f0e9fb36a6 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Fri, 15 Dec 2023 20:50:30 +0700 Subject: [PATCH] move video_t to v_video.h, clean up --- src/am_map.c | 3 +-- src/doomdef.h | 5 +---- src/i_video.h | 23 +---------------------- src/r_bsp.c | 1 + src/r_main.c | 2 +- src/r_plane.c | 2 +- src/v_video.h | 46 +++++++++++++++++++++++++++++++--------------- 7 files changed, 37 insertions(+), 45 deletions(-) diff --git a/src/am_map.c b/src/am_map.c index cdc2cc93..2d81b71c 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -18,17 +18,16 @@ //----------------------------------------------------------------------------- #include "doomstat.h" -#include "doomkeys.h" #include "st_stuff.h" #include "r_main.h" #include "r_things.h" #include "p_setup.h" #include "p_maputl.h" #include "w_wad.h" +#include "i_video.h" #include "v_video.h" #include "p_spec.h" #include "am_map.h" -#include "dstrings.h" #include "d_deh.h" // Ty 03/27/98 - externalizations #include "m_input.h" #include "m_menu.h" diff --git a/src/doomdef.h b/src/doomdef.h index f165d931..2b59f071 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -77,12 +77,9 @@ typedef enum // [FG] flashing disk icon #define DISK_ICON_THRESHOLD (20 * 1024) -// killough 2/8/98: MAX versions for maximum screen sizes -// allows us to avoid the overhead of dynamic allocation -// when multiple screen sizes are supported - #define SCREENWIDTH 320 #define SCREENHEIGHT 200 +#define NONWIDEWIDTH SCREENWIDTH // [crispy] non-widescreen SCREENWIDTH // The maximum number of players, multiplayer/networking. #define MAXPLAYERS 4 diff --git a/src/i_video.h b/src/i_video.h index cecfed51..15ec58e5 100644 --- a/src/i_video.h +++ b/src/i_video.h @@ -23,27 +23,6 @@ #include "doomtype.h" -#include "doomdef.h" -#include "tables.h" - -#define NONWIDEWIDTH SCREENWIDTH // [crispy] non-widescreen SCREENWIDTH - -typedef struct -{ - int width; - int height; - int unscaledw; - int deltaw; - - fixed_t xscale; - fixed_t yscale; - fixed_t xstep; - fixed_t ystep; - - angle_t fov; -} video_t; - -extern video_t video; enum { @@ -87,7 +66,7 @@ void I_ToggleVsync(void); // [JN] Calls native SDL vsync toggle extern boolean use_vsync; // killough 2/8/98: controls whether vsync is called extern boolean disk_icon; // killough 10/98 -extern int resolution_mode, default_resolution_mode; // killough 11/98 +extern resolution_mode_t resolution_mode, default_resolution_mode; extern boolean use_aspect; extern boolean uncapped, default_uncapped; // [FG] uncapped rendering frame rate diff --git a/src/r_bsp.c b/src/r_bsp.c index bbdd201c..ec56566f 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -25,6 +25,7 @@ #include "r_segs.h" #include "r_plane.h" #include "r_things.h" +#include "v_video.h" seg_t *curline; side_t *sidedef; diff --git a/src/r_main.c b/src/r_main.c index 9eb3b2bc..269f41f6 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -27,10 +27,10 @@ #include "r_draw.h" #include "r_sky.h" #include "r_voxel.h" +#include "i_video.h" #include "v_video.h" #include "am_map.h" #include "st_stuff.h" -#include "hu_stuff.h" // Fineangles in the SCREENWIDTH wide window. #define FIELDOFVIEW 2048 diff --git a/src/r_plane.c b/src/r_plane.c index 3231197e..0d06771f 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -31,7 +31,6 @@ // //----------------------------------------------------------------------------- -#include "i_video.h" #include "z_zone.h" /* memory allocation wrappers -- killough */ #include "doomstat.h" @@ -43,6 +42,7 @@ #include "r_plane.h" #include "r_bmaps.h" // [crispy] R_BrightmapForTexName() #include "r_swirl.h" // [crispy] R_DistortedFlat() +#include "v_video.h" #define MAXVISPLANES 128 /* must be a power of 2 */ diff --git a/src/v_video.h b/src/v_video.h index 5f802178..e66adfae 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -25,7 +25,6 @@ #include "doomtype.h" #include "doomdef.h" -#include "i_video.h" // Needed because we are refering to patches. #include "r_data.h" @@ -92,22 +91,39 @@ void V_InitColorTranslation(void); typedef struct { - int x; // original x coordinate for upper left corner - int y; // original y coordinate for upper left corner - int w; // original width - int h; // original height + int width; + int height; + int unscaledw; + int deltaw; - int cx1; // clipped x coordinate for left edge - int cx2; // clipped x coordinate for right edge - int cy1; // clipped y coordinate for upper edge - int cy2; // clipped y coordinate for lower edge - int cw; // clipped width - int ch; // clipped height + fixed_t xscale; + fixed_t yscale; + fixed_t xstep; + fixed_t ystep; - int sx; // scaled x - int sy; // scaled y - int sw; // scaled width - int sh; // scaled height + angle_t fov; +} video_t; + +extern video_t video; + +typedef struct +{ + int x; // original x coordinate for upper left corner + int y; // original y coordinate for upper left corner + int w; // original width + int h; // original height + + int cx1; // clipped x coordinate for left edge + int cx2; // clipped x coordinate for right edge + int cy1; // clipped y coordinate for upper edge + int cy2; // clipped y coordinate for lower edge + int cw; // clipped width + int ch; // clipped height + + int sx; // scaled x + int sy; // scaled y + int sw; // scaled width + int sh; // scaled height } vrect_t; void V_ScaleRect(vrect_t *rect);