Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial version of HOM test #1525

Draft
wants to merge 23 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions src/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ static void ProcessDehLump(int lumpnum)

boolean devparm; // started game with -devparm

boolean run_test;

// jff 1/24/98 add new versions of these variables to remember command line
boolean clnomonsters; // checkparm of -nomonsters
boolean clrespawnparm; // checkparm of -respawn
Expand Down Expand Up @@ -2710,6 +2712,11 @@ void D_DoomMain(void)
I_AtExitPrio(D_EndDoom, false, "D_EndDoom", exit_priority_last);
}

if (M_ParmExists("-test"))
{
run_test = true;
}

TryRunTics();

D_StartGameLoop();
Expand All @@ -2719,6 +2726,50 @@ void D_DoomMain(void)
// frame syncronous IO operations
I_StartFrame ();

if (run_test)
{
static int oldgametic = 3;

if (gametic >= oldgametic)
{
static boolean first_test = true;
static boolean cycle_fov = false;

oldgametic = gametic + 3;

if (first_test)
{
custom_fov = FOV_MIN;
setsizeneeded = true;
cycle_fov = false;
first_test = false;
}
else if (cycle_fov)
{
if (custom_fov == FOV_MAX)
{
custom_fov = FOV_MIN;
cycle_fov = false;
}
else
{
custom_fov++;
}
setsizeneeded = true;
}
else
{
cycle_fov = true;
if (!I_ChangeRes())
{
custom_fov = FOV_DEFAULT;
default_widescreen = RATIO_AUTO;
I_SafeExit(0);
}
}
}
}

TryRunTics (); // will run at least one tic

// Update display, next frame, with current state.
Expand Down
1 change: 1 addition & 0 deletions src/d_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ void D_PageDrawer(void);
void D_AdvanceDemo(void);
void D_StartTitle(void);

extern boolean run_test;
extern boolean advancedemo;

#endif
Expand Down
66 changes: 64 additions & 2 deletions src/i_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ static int fpslimit; // when uncapped, limit framerate to this value
static boolean fullscreen;
static boolean exclusive_fullscreen;
static boolean change_display_resolution;
static int widescreen, default_widescreen;
static int widescreen;
int default_widescreen;
static boolean vga_porch_flash; // emulate VGA "porch" behaviour
static boolean smooth_scaling;
static int video_display = 0; // display index
Expand Down Expand Up @@ -1254,7 +1255,8 @@ static void ResetResolution(int height, boolean reset_pitch)
AM_ResetScreenSize();
}

I_Printf(VB_DEBUG, "ResetResolution: %dx%d", video.width, video.height);
I_Printf(VB_DEBUG, "ResetResolution: %dx%d (%dx%d)",
video.width, video.height, video.unscaledw, SCREENHEIGHT);

drs_skip_frame = true;
}
Expand Down Expand Up @@ -1894,6 +1896,66 @@ void I_BindVideoVariables(void)
wad_no, "Grab mouse during play");
}

static struct {
int w, h;
} native_res[] = {
{ 320, 240 },
{ 640, 480 },
{ 800, 600 },
{ 1024, 768 },
{ 1280, 1024 },
{ 1280, 720 },
{ 1280, 800 },
{ 1366, 768 },
{ 1440, 900 },
{ 1440, 1080 },
{ 1680, 1050 },
{ 1920, 1080 },
{ 1920, 1200 },
{ 2048, 1152 },
{ 2560, 1080 },
{ 2304, 1440 },
{ 2560, 1440 },
{ 2560, 1600 },
{ 3200, 2400 },
{ 3440, 1440 },
{ 3840, 1600 },
{ 3840, 2160 },
{ 5120, 2160 }
};
ceski-1 marked this conversation as resolved.
Show resolved Hide resolved

static int curr_test_res;

boolean I_ChangeRes(void)
{
if (curr_test_res == arrlen(native_res))
return false;

max_width = native_res[curr_test_res].w;
max_height = native_res[curr_test_res].h;

max_height_adjusted = (int)(max_height / 1.2);

printf("I_ChangeRes: %dx%d\n", max_width, max_height);
ResetResolution(max_height_adjusted, true);
CreateSurfaces(video.pitch, video.height);
ResetLogicalSize();

curr_test_res++;

return true;
}

void I_CheckHOM(void)
{
if (I_VideoBuffer[video.width - 1] == 0xb0)
{
I_Printf(VB_WARNING, "HOM: native %dx%d, video %dx%d, fov %d",
max_width, max_height, video.width, video.height,
custom_fov);
}
}

//----------------------------------------------------------------------------
//
// $Log: i_video.c,v $
Expand Down
4 changes: 4 additions & 0 deletions src/i_video.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ void I_UpdatePriority(boolean active);

void I_BindVideoVariables(void);

extern int default_widescreen;
boolean I_ChangeRes(void);
void I_CheckHOM(void);

#endif

//----------------------------------------------------------------------------
Expand Down
14 changes: 12 additions & 2 deletions src/r_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <string.h>

#include "d_loop.h"
#include "d_main.h"
#include "d_player.h"
#include "doomdata.h"
#include "doomdef.h"
Expand Down Expand Up @@ -525,8 +526,8 @@ static void R_SetupFreelook(void)
dy = 0;
}

centery = viewheight / 2 + (dy >> FRACBITS);
centeryfrac = centery << FRACBITS;
centeryfrac = (viewheight << FRACBITS) / 2 + dy;
centery = centeryfrac >> FRACBITS;

for (i = 0; i < viewheight; i++)
{
Expand Down Expand Up @@ -913,6 +914,12 @@ void R_RenderPlayerView (player_t* player)
R_ClearSprites ();
VX_ClearVoxels ();

if (run_test)
{
V_FillRect(scaledviewx, scaledviewy, scaledviewwidth, scaledviewheight,
0xb0);
}

if (autodetect_hom)
{ // killough 2/10/98: add flashing red HOM indicators
pixel_t c[47*47];
Expand Down Expand Up @@ -1007,6 +1014,9 @@ void R_RenderPlayerView (player_t* player)
R_SetFuzzPosDraw();
R_DrawMasked ();

if (run_test)
I_CheckHOM();

// Check for new console commands.
NetUpdate ();
}
Expand Down
Loading