mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-23 12:04:38 -04:00
Merge branch 'master' of github.com:fabiangreffrath/woof
This commit is contained in:
commit
ae45b03db3
@ -49,7 +49,7 @@ set(WOOF_SOURCES
|
|||||||
i_video.c i_video.h
|
i_video.c i_video.h
|
||||||
info.c info.h
|
info.c info.h
|
||||||
m_argv.c m_argv.h
|
m_argv.c m_argv.h
|
||||||
m_array.c m_array.h
|
m_array.h
|
||||||
m_bbox.c m_bbox.h
|
m_bbox.c m_bbox.h
|
||||||
m_cheat.c m_cheat.h
|
m_cheat.c m_cheat.h
|
||||||
m_fixed.h
|
m_fixed.h
|
||||||
@ -227,7 +227,7 @@ set(SETUP_SOURCES
|
|||||||
i_system.c i_system.h
|
i_system.c i_system.h
|
||||||
i_timer.c i_timer.h
|
i_timer.c i_timer.h
|
||||||
m_argv.c m_argv.h
|
m_argv.c m_argv.h
|
||||||
m_array.c m_array.h
|
m_array.h
|
||||||
m_io.c m_io.h
|
m_io.c m_io.h
|
||||||
m_misc2.c m_misc2.h
|
m_misc2.c m_misc2.h
|
||||||
net_io.c net_io.h
|
net_io.c net_io.h
|
||||||
|
@ -575,14 +575,6 @@ static void AM_clearLastMark(void)
|
|||||||
|
|
||||||
void AM_enableSmoothLines(void)
|
void AM_enableSmoothLines(void)
|
||||||
{
|
{
|
||||||
static boolean precalc_once = true;
|
|
||||||
|
|
||||||
if (precalc_once && map_smooth_lines)
|
|
||||||
{
|
|
||||||
V_InitFlexTranTable();
|
|
||||||
precalc_once = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
AM_drawFline = map_smooth_lines ? AM_drawFline_Smooth : AM_drawFline_Vanilla;
|
AM_drawFline = map_smooth_lines ? AM_drawFline_Smooth : AM_drawFline_Vanilla;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,7 +388,7 @@ void D_Display (void)
|
|||||||
}
|
}
|
||||||
while (!done);
|
while (!done);
|
||||||
|
|
||||||
I_ResetTargetRefresh(); // reset after wipe
|
drs_skip_frame = true; // skip DRS after wipe
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
#include "m_snapshot.h"
|
#include "m_snapshot.h"
|
||||||
#include "m_swap.h" // [FG] LONG
|
#include "m_swap.h" // [FG] LONG
|
||||||
#include "i_input.h"
|
#include "i_input.h"
|
||||||
|
#include "i_video.h"
|
||||||
#include "m_array.h"
|
#include "m_array.h"
|
||||||
|
|
||||||
#define SAVEGAMESIZE 0x20000
|
#define SAVEGAMESIZE 0x20000
|
||||||
@ -2155,6 +2156,8 @@ static void G_DoSaveGame(void)
|
|||||||
if (name) free(name);
|
if (name) free(name);
|
||||||
|
|
||||||
M_SetQuickSaveSlot(savegameslot);
|
M_SetQuickSaveSlot(savegameslot);
|
||||||
|
|
||||||
|
drs_skip_frame = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void G_DoLoadGame(void)
|
static void G_DoLoadGame(void)
|
||||||
|
@ -108,6 +108,8 @@ boolean screenvisible = true;
|
|||||||
|
|
||||||
boolean window_focused = true;
|
boolean window_focused = true;
|
||||||
|
|
||||||
|
boolean drs_skip_frame;
|
||||||
|
|
||||||
void *I_GetSDLWindow(void)
|
void *I_GetSDLWindow(void)
|
||||||
{
|
{
|
||||||
return screen;
|
return screen;
|
||||||
@ -249,6 +251,8 @@ static void HandleWindowEvent(SDL_WindowEvent *event)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drs_skip_frame = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// [FG] fullscreen toggle from Chocolate Doom 3.0
|
// [FG] fullscreen toggle from Chocolate Doom 3.0
|
||||||
@ -471,7 +475,7 @@ static void UpdateRender(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint64_t frametime_withoutpresent;
|
static uint64_t frametime_start, frametime_withoutpresent;
|
||||||
static int targetrefresh;
|
static int targetrefresh;
|
||||||
|
|
||||||
static void ResetResolution(int height);
|
static void ResetResolution(int height);
|
||||||
@ -482,13 +486,18 @@ void I_DynamicResolution(void)
|
|||||||
static int frame_counter;
|
static int frame_counter;
|
||||||
static double averagepercent;
|
static double averagepercent;
|
||||||
|
|
||||||
if (resolution_mode != RES_DRS || frametime_withoutpresent == 0 ||
|
if (resolution_mode != RES_DRS || frametime_withoutpresent == 0 || menuactive)
|
||||||
// Skip if frame time is too long (e.g. window event).
|
|
||||||
frametime_withoutpresent > 100000)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (drs_skip_frame)
|
||||||
|
{
|
||||||
|
frametime_start = frametime_withoutpresent = 0;
|
||||||
|
drs_skip_frame = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 1.25 milliseconds for SDL render present
|
// 1.25 milliseconds for SDL render present
|
||||||
double target = (1.0 / targetrefresh) - 0.00125;
|
double target = (1.0 / targetrefresh) - 0.00125;
|
||||||
double actual = frametime_withoutpresent / 1000000.0;
|
double actual = frametime_withoutpresent / 1000000.0;
|
||||||
@ -498,9 +507,8 @@ void I_DynamicResolution(void)
|
|||||||
#define DRS_MIN_HEIGHT 400
|
#define DRS_MIN_HEIGHT 400
|
||||||
#define DRS_DELTA 0.1
|
#define DRS_DELTA 0.1
|
||||||
#define DRS_GREATER (1 + DRS_DELTA)
|
#define DRS_GREATER (1 + DRS_DELTA)
|
||||||
#define DRS_LESS (1 - DRS_DELTA)
|
#define DRS_LESS (1 - DRS_DELTA / 10.0)
|
||||||
// 50px step to make scaling artefacts less noticeable.
|
#define DRS_STEP (SCREENHEIGHT / 2)
|
||||||
#define DRS_STEP (SCREENHEIGHT / 4)
|
|
||||||
|
|
||||||
int newheight = 0;
|
int newheight = 0;
|
||||||
int oldheight = video.height;
|
int oldheight = video.height;
|
||||||
@ -513,7 +521,7 @@ void I_DynamicResolution(void)
|
|||||||
|
|
||||||
if (actualpercent > DRS_GREATER)
|
if (actualpercent > DRS_GREATER)
|
||||||
{
|
{
|
||||||
double reduction = (actualpercent - DRS_GREATER ) * 0.2;
|
double reduction = (actualpercent - DRS_GREATER ) * 0.4;
|
||||||
newheight = (int)MAX(DRS_MIN_HEIGHT, oldheight - oldheight * reduction);
|
newheight = (int)MAX(DRS_MIN_HEIGHT, oldheight - oldheight * reduction);
|
||||||
}
|
}
|
||||||
else if (averagepercent < DRS_LESS && frame_counter > targetrefresh)
|
else if (averagepercent < DRS_LESS && frame_counter > targetrefresh)
|
||||||
@ -553,8 +561,6 @@ static void CreateUpscaledTexture(boolean force);
|
|||||||
|
|
||||||
void I_FinishUpdate(void)
|
void I_FinishUpdate(void)
|
||||||
{
|
{
|
||||||
static uint64_t frametime_start;
|
|
||||||
|
|
||||||
if (noblit)
|
if (noblit)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -1090,6 +1096,8 @@ static void ResetResolution(int height)
|
|||||||
I_InitDiskFlash();
|
I_InitDiskFlash();
|
||||||
|
|
||||||
I_Printf(VB_DEBUG, "ResetResolution: %dx%d", video.width, video.height);
|
I_Printf(VB_DEBUG, "ResetResolution: %dx%d", video.width, video.height);
|
||||||
|
|
||||||
|
drs_skip_frame = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CreateUpscaledTexture(boolean force)
|
static void CreateUpscaledTexture(boolean force)
|
||||||
@ -1206,8 +1214,6 @@ static void ResetLogicalSize(void)
|
|||||||
|
|
||||||
void I_ResetTargetRefresh(void)
|
void I_ResetTargetRefresh(void)
|
||||||
{
|
{
|
||||||
frametime_withoutpresent = 0; // skip DRS one frame
|
|
||||||
|
|
||||||
if (uncapped)
|
if (uncapped)
|
||||||
{
|
{
|
||||||
targetrefresh = (fpslimit >= TICRATE) ? fpslimit : native_refresh_rate;
|
targetrefresh = (fpslimit >= TICRATE) ? fpslimit : native_refresh_rate;
|
||||||
|
@ -69,6 +69,8 @@ void I_ToggleVsync(void); // [JN] Calls native SDL vsync toggle
|
|||||||
|
|
||||||
void I_DynamicResolution(void);
|
void I_DynamicResolution(void);
|
||||||
|
|
||||||
|
extern boolean drs_skip_frame;
|
||||||
|
|
||||||
extern char *sdl_renderdriver;
|
extern char *sdl_renderdriver;
|
||||||
|
|
||||||
extern boolean use_vsync; // killough 2/8/98: controls whether vsync is called
|
extern boolean use_vsync; // killough 2/8/98: controls whether vsync is called
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
//
|
|
||||||
// Copyright(C) 2024 Roman Fomin
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 2
|
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#include "m_array.h"
|
|
||||||
#include "i_system.h"
|
|
||||||
|
|
||||||
m_array_buffer_t *array_ptr(void *v)
|
|
||||||
{
|
|
||||||
return (m_array_buffer_t *)((char *)v - offsetof(m_array_buffer_t, buffer));
|
|
||||||
}
|
|
||||||
|
|
||||||
int array_size(void *v)
|
|
||||||
{
|
|
||||||
return v ? array_ptr(v)->size : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int array_capacity(void *v)
|
|
||||||
{
|
|
||||||
return v ? array_ptr(v)->capacity : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *M_ArrayGrow(void *v, size_t esize, int n)
|
|
||||||
{
|
|
||||||
m_array_buffer_t *p;
|
|
||||||
|
|
||||||
if (v)
|
|
||||||
{
|
|
||||||
p = array_ptr(v);
|
|
||||||
p = I_Realloc(p, sizeof(m_array_buffer_t) + (p->capacity + n) * esize);
|
|
||||||
p->capacity += n;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
p = malloc(sizeof(m_array_buffer_t) + n * esize);
|
|
||||||
p->capacity = n;
|
|
||||||
p->size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return p->buffer;
|
|
||||||
}
|
|
@ -19,6 +19,9 @@
|
|||||||
// and any previously-taken pointers should be considered invalidated.
|
// and any previously-taken pointers should be considered invalidated.
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#include "doomtype.h"
|
||||||
|
|
||||||
#ifndef M_ARRAY_INIT_CAPACITY
|
#ifndef M_ARRAY_INIT_CAPACITY
|
||||||
#define M_ARRAY_INIT_CAPACITY 8
|
#define M_ARRAY_INIT_CAPACITY 8
|
||||||
@ -31,11 +34,20 @@ typedef struct
|
|||||||
char buffer[];
|
char buffer[];
|
||||||
} m_array_buffer_t;
|
} m_array_buffer_t;
|
||||||
|
|
||||||
m_array_buffer_t *array_ptr(void *v);
|
inline static m_array_buffer_t *array_ptr(void *v)
|
||||||
int array_size(void *v);
|
{
|
||||||
int array_capacity(void *v);
|
return (m_array_buffer_t *)((char *)v - offsetof(m_array_buffer_t, buffer));
|
||||||
|
}
|
||||||
|
|
||||||
void *M_ArrayGrow(void *v, size_t esize, int n);
|
inline static int array_size(void *v)
|
||||||
|
{
|
||||||
|
return v ? array_ptr(v)->size : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline static int array_capacity(void *v)
|
||||||
|
{
|
||||||
|
return v ? array_ptr(v)->capacity : 0;
|
||||||
|
}
|
||||||
|
|
||||||
#define array_grow(v, n) \
|
#define array_grow(v, n) \
|
||||||
((v) = M_ArrayGrow((v), sizeof(*(v)), n))
|
((v) = M_ArrayGrow((v), sizeof(*(v)), n))
|
||||||
@ -63,3 +75,23 @@ void *M_ArrayGrow(void *v, size_t esize, int n);
|
|||||||
(v) = NULL; \
|
(v) = NULL; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
inline static void *M_ArrayGrow(void *v, size_t esize, int n)
|
||||||
|
{
|
||||||
|
m_array_buffer_t *p;
|
||||||
|
|
||||||
|
if (v)
|
||||||
|
{
|
||||||
|
p = array_ptr(v);
|
||||||
|
p = realloc(p, sizeof(m_array_buffer_t) + (p->capacity + n) * esize);
|
||||||
|
p->capacity += n;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p = malloc(sizeof(m_array_buffer_t) + n * esize);
|
||||||
|
p->capacity = n;
|
||||||
|
p->size = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return p->buffer;
|
||||||
|
}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "r_voxel.h"
|
#include "r_voxel.h"
|
||||||
#include "i_video.h"
|
#include "i_video.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "am_map.h"
|
#include "v_flextran.h"
|
||||||
#include "st_stuff.h"
|
#include "st_stuff.h"
|
||||||
|
|
||||||
// killough: viewangleoffset is a legacy from the pre-v1.2 days, when Doom
|
// killough: viewangleoffset is a legacy from the pre-v1.2 days, when Doom
|
||||||
@ -557,6 +557,7 @@ void R_Init (void)
|
|||||||
R_InitLightTables();
|
R_InitLightTables();
|
||||||
R_InitSkyMap();
|
R_InitSkyMap();
|
||||||
R_InitTranslationTables();
|
R_InitTranslationTables();
|
||||||
|
V_InitFlexTranTable();
|
||||||
|
|
||||||
// [FG] spectre drawing mode
|
// [FG] spectre drawing mode
|
||||||
R_SetFuzzColumnMode();
|
R_SetFuzzColumnMode();
|
||||||
|
@ -418,7 +418,7 @@ static void V_DrawPatchColumnTL(const patch_column_t *patchcol)
|
|||||||
static void V_DrawMaskedColumn(patch_column_t *patchcol, const int ytop,
|
static void V_DrawMaskedColumn(patch_column_t *patchcol, const int ytop,
|
||||||
column_t *column)
|
column_t *column)
|
||||||
{
|
{
|
||||||
for ( ; column->topdelta != 0xff; column = (column_t *)((byte *)column + column->length + 4))
|
while (column->topdelta != 0xff)
|
||||||
{
|
{
|
||||||
// calculate unclipped screen coordinates for post
|
// calculate unclipped screen coordinates for post
|
||||||
int columntop = ytop + column->topdelta;
|
int columntop = ytop + column->topdelta;
|
||||||
@ -459,6 +459,8 @@ static void V_DrawMaskedColumn(patch_column_t *patchcol, const int ytop,
|
|||||||
patchcol->source = (byte *)column + 3;
|
patchcol->source = (byte *)column + 3;
|
||||||
drawcolfunc(patchcol);
|
drawcolfunc(patchcol);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
column = (column_t *)((byte *)column + column->length + 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -467,7 +469,6 @@ void V_DrawPatchInt(int x, int y, patch_t *patch, boolean flipped,
|
|||||||
{
|
{
|
||||||
int x1, x2, w;
|
int x1, x2, w;
|
||||||
fixed_t iscale, xiscale, startfrac = 0;
|
fixed_t iscale, xiscale, startfrac = 0;
|
||||||
int maxw;
|
|
||||||
patch_column_t patchcol = {0};
|
patch_column_t patchcol = {0};
|
||||||
|
|
||||||
w = SHORT(patch->width);
|
w = SHORT(patch->width);
|
||||||
@ -488,10 +489,9 @@ void V_DrawPatchInt(int x, int y, patch_t *patch, boolean flipped,
|
|||||||
|
|
||||||
iscale = video.xstep;
|
iscale = video.xstep;
|
||||||
patchcol.step = video.ystep;
|
patchcol.step = video.ystep;
|
||||||
maxw = video.unscaledw;
|
|
||||||
|
|
||||||
// off the left or right side?
|
// off the left or right side?
|
||||||
if (x2 < 0 || x1 >= maxw)
|
if (x2 < 0 || x1 >= video.unscaledw)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (translation)
|
if (translation)
|
||||||
@ -510,10 +510,10 @@ void V_DrawPatchInt(int x, int y, patch_t *patch, boolean flipped,
|
|||||||
// very carefully here.
|
// very carefully here.
|
||||||
if (x1 >= 0)
|
if (x1 >= 0)
|
||||||
x1 = x1lookup[x1];
|
x1 = x1lookup[x1];
|
||||||
else if (-x1 - 1 < maxw)
|
else if (-x1 - 1 < video.unscaledw)
|
||||||
x1 = -x2lookup[-x1 - 1];
|
x1 = -x2lookup[-x1 - 1];
|
||||||
else // too far off-screen
|
else // too far off-screen
|
||||||
x1 = -(((-x1 - 1) * video.xscale) >> FRACBITS);
|
x1 = (x1 * video.xscale) >> FRACBITS;
|
||||||
|
|
||||||
if (x2 < video.unscaledw)
|
if (x2 < video.unscaledw)
|
||||||
x2 = x2lookup[x2];
|
x2 = x2lookup[x2];
|
||||||
@ -680,6 +680,11 @@ void V_FillRect(int x, int y, int width, int height, byte color)
|
|||||||
dstrect.h = height;
|
dstrect.h = height;
|
||||||
|
|
||||||
V_ClipRect(&dstrect);
|
V_ClipRect(&dstrect);
|
||||||
|
|
||||||
|
// clipped away completely?
|
||||||
|
if (dstrect.cw <= 0 || dstrect.ch <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
V_ScaleClippedRect(&dstrect);
|
V_ScaleClippedRect(&dstrect);
|
||||||
|
|
||||||
byte* dest = V_ADDRESS(dest_screen, dstrect.sx, dstrect.sy);
|
byte* dest = V_ADDRESS(dest_screen, dstrect.sx, dstrect.sy);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user