- got it to the point where it can render to the GL surface from the native backend.

This commit is contained in:
Christoph Oelckers 2019-12-23 19:37:40 +01:00
parent a1f7f0cc30
commit 62ecedf1f8
34 changed files with 193 additions and 2103 deletions

View file

@ -1096,39 +1096,12 @@ void ClockStrobe()
//gGameClock++;
}
#if defined(_WIN32) && defined(DEBUGGINGAIDS)
// See FILENAME_CASE_CHECK in cache1d.c
static int32_t check_filename_casing(void)
{
return 1;
}
#endif
int GameInterface::app_main()
{
memcpy(&gGameOptions, &gSingleGameOptions, sizeof(GAMEOPTIONS));
gGameOptions.nMonsterSettings = !userConfig.nomonsters;
bQuickStart = userConfig.nologo;
ParseOptions();
CONFIG_ReadSetup();
if (enginePreInit())
{
I_Error("app_main: There was a problem initializing the Build engine: %s\n", engineerrstr);
}
registerosdcommands();
#if 0
// todo: Handle more intelligently.
OSD_Exec("autoexec.cfg");
#endif
// Not neccessary ?
// CONFIG_SetDefaultKeys(keydefaults, true);
system_getcvars();
#ifdef USE_QHEAP
Resource::heap = new QHeap(nMaxAlloc);
#endif
@ -1187,7 +1160,7 @@ int GameInterface::app_main()
initprintf("Initializing network users\n");
netInitialize(true);
scrSetGameMode( ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP);
scrSetGameMode(0, 0, 0, 0);
scrSetGamma(gGamma);
hud_size.Callback();
initprintf("Initializing sound system\n");

View file

@ -49,88 +49,25 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS
int32_t gTurnSpeed;
int32_t gDetail;
int32_t gTurnSpeed = 92;
int32_t gDetail = 4;
int32_t cl_weaponswitch;
int32_t gFollowMap;
int32_t gOverlayMap;
int32_t gRotateMap;
int32_t gMessageCount;
int32_t gMessageTime;
int32_t gMessageFont;
int32_t gbAdultContent;
char gzAdultPassword[9];
int32_t gFollowMap = 1;
int32_t gOverlayMap = 0;
int32_t gRotateMap = 0;
int32_t gMessageCount = 4;
int32_t gMessageTime = 5;
int32_t gMessageFont = 0;
int32_t gbAdultContent = 0;
int32_t gMouseSensitivity;
bool gNoClip;
bool gInfiniteAmmo;
bool gFullMap;
int32_t gUpscaleFactor;
int32_t gDeliriumBlur;
int32_t gDeliriumBlur = 1;
//////////
int gWeaponsV10x;
/////////
void CONFIG_SetDefaults(void)
{
# if defined RENDERTYPESDL && SDL_MAJOR_VERSION > 1
uint32_t inited = SDL_WasInit(SDL_INIT_VIDEO);
if (inited == 0)
SDL_Init(SDL_INIT_VIDEO);
else if (!(inited & SDL_INIT_VIDEO))
SDL_InitSubSystem(SDL_INIT_VIDEO);
SDL_DisplayMode dm;
if (SDL_GetDesktopDisplayMode(0, &dm) == 0)
{
ScreenWidth = dm.w;
ScreenHeight = dm.h;
}
else
{
ScreenWidth = 1024;
ScreenHeight = 768;
}
#endif
gUpscaleFactor = 0;
gDeliriumBlur = 1;
gViewSize = 2;
gTurnSpeed = 92;
gDetail = 4;
gFollowMap = 1;
gOverlayMap = 0;
gRotateMap = 0;
gMessageCount = 4;
gMessageTime = 5;
gMessageFont = 0;
gbAdultContent = 0;
gzAdultPassword[0] = 0;
}
int CONFIG_ReadSetup(void)
{
CONFIG_SetDefaults();
if (ScreenBPP < 8) ScreenBPP = 32;
return 0;
}
void CONFIG_WriteSettings(void) // save binds and aliases to <cfgname>_settings.cfg
{
}
END_BLD_NS

View file

@ -41,21 +41,16 @@ extern int32_t gMessageCount;
extern int32_t gMessageTime;
extern int32_t gMessageFont;
extern int32_t gbAdultContent;
extern char gzAdultPassword[9];
extern int32_t gMouseSensitivity;
extern bool gNoClip;
extern bool gInfiniteAmmo;
extern bool gFullMap;
extern int32_t gUpscaleFactor;
extern int32_t gDeliriumBlur;
///////
extern int gWeaponsV10x;
//////
int CONFIG_ReadSetup(void);
void CONFIG_SetDefaults(void);
END_BLD_NS
#endif

View file

@ -102,54 +102,6 @@ static int osdcmd_demo(osdcmdptr_t parm)
}
static int osdcmd_vidmode(osdcmdptr_t parm)
{
int32_t newbpp = ScreenBPP, newwidth = ScreenWidth,
newheight = ScreenHeight, newfs = ScreenMode;
int32_t tmp;
if (parm->numparms < 1 || parm->numparms > 4) return OSDCMD_SHOWHELP;
switch (parm->numparms)
{
case 1: // bpp switch
tmp = Batol(parm->parms[0]);
if (!(tmp==8 || tmp==16 || tmp==32))
return OSDCMD_SHOWHELP;
newbpp = tmp;
break;
case 2: // res switch
newwidth = Batol(parm->parms[0]);
newheight = Batol(parm->parms[1]);
break;
case 3: // res & bpp switch
case 4:
newwidth = Batol(parm->parms[0]);
newheight = Batol(parm->parms[1]);
tmp = Batol(parm->parms[2]);
if (!(tmp==8 || tmp==16 || tmp==32))
return OSDCMD_SHOWHELP;
newbpp = tmp;
if (parm->numparms == 4)
newfs = (Batol(parm->parms[3]) != 0);
break;
}
if (videoSetGameMode(newfs,newwidth,newheight,newbpp,upscalefactor))
{
initprintf("vidmode: Mode change failed!\n");
if (videoSetGameMode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, upscalefactor))
ThrowError("vidmode: Reset failed!\n");
}
ScreenBPP = newbpp;
ScreenWidth = newwidth;
ScreenHeight = newheight;
ScreenMode = newfs;
onvideomodechange(ScreenBPP>8);
viewResizeView(gViewSize);
return OSDCMD_OK;
}
static int osdcmd_crosshaircolor(osdcmdptr_t parm)
{
if (parm->numparms != 3)
@ -291,8 +243,6 @@ int32_t registerosdcommands(void)
OSD_RegisterFunction("god","god: toggles god mode", osdcmd_god);
OSD_RegisterFunction("noclip","noclip: toggles clipping mode", osdcmd_noclip);
OSD_RegisterFunction("vidmode","vidmode <xdim> <ydim> <bpp> <fullscreen>: change the video mode",osdcmd_vidmode);
return 0;
}

View file

@ -32,6 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "config.h"
#include "resource.h"
#include "screen.h"
#include "rendering/v_video.h"
BEGIN_BLD_NS
@ -243,45 +244,7 @@ void scrUnInit(void)
void scrSetGameMode(int vidMode, int XRes, int YRes, int nBits)
{
videoResetMode();
//videoSetGameMode(vidMode, XRes, YRes, nBits, 0);
if (videoSetGameMode(vidMode, XRes, YRes, nBits, 0) < 0)
{
initprintf("Failure setting video mode %dx%dx%d %s! Trying next mode...\n", XRes, YRes,
nBits, vidMode ? "fullscreen" : "windowed");
int resIdx = 0;
for (int i=0; i < validmodecnt; i++)
{
if (validmode[i].xdim == XRes && validmode[i].ydim == YRes)
{
resIdx = i;
break;
}
}
int const savedIdx = resIdx;
int bpp = nBits;
while (videoSetGameMode(0, validmode[resIdx].xdim, validmode[resIdx].ydim, bpp, 0) < 0)
{
initprintf("Failure setting video mode %dx%dx%d windowed! Trying next mode...\n",
validmode[resIdx].xdim, validmode[resIdx].ydim, bpp);
if (++resIdx == validmodecnt)
{
if (bpp == 8)
ThrowError("Fatal error: unable to set any video mode!");
resIdx = savedIdx;
bpp = 8;
}
}
ScreenWidth = validmode[resIdx].xdim;
ScreenHeight = validmode[resIdx].ydim;
ScreenBPP = bpp;
}
V_Init2();
videoClearViewableArea(0);
scrNextPage();
scrSetPalette(curPalette);

View file

@ -16,12 +16,6 @@
#include "zstring.h"
#include "vectors.h"
#ifdef DEBUGGINGAIDS
# define DEBUG_MASK_DRAWING
extern int32_t g_maskDrawMode;
#endif
extern char appactive;
extern char modechange;
extern char nogl;
@ -49,26 +43,9 @@ void videoResetMode(void);
void videoEndDrawing(void);
void videoShowFrame(int32_t);
int32_t videoUpdatePalette(int32_t start, int32_t num);
int32_t videoSetGamma(void);
int32_t videoSetVsync(int32_t newSync);
//#define DEBUG_FRAME_LOCKING
#if !defined DEBUG_FRAME_LOCKING
void videoBeginDrawing(void);
#else
void begindrawing_real(void);
# define BEGINDRAWING_SIZE 256
extern uint32_t begindrawing_line[BEGINDRAWING_SIZE];
extern const char *begindrawing_file[BEGINDRAWING_SIZE];
extern int32_t lockcount;
# define videoBeginDrawing() do { \
if (lockcount < BEGINDRAWING_SIZE) { \
begindrawing_line[lockcount] = __LINE__; \
begindrawing_file[lockcount] = __FILE__; \
} \
begindrawing_real(); \
} while(0)
#endif
#define GAMMA_CALC ((int32_t)(min(max((float)((vid_gamma - 1.0f) * 10.0f), 0.f), 15.f)))
@ -89,22 +66,6 @@ extern char inputdevices;
// keys
#define KEYFIFOSIZ 64
char CONSTEXPR const g_keyAsciiTable[128] = {
0 , 0, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 0, 0, 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p',
'[', ']', 0, 0, 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', 39, '`', 0, 92, 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',',
'.', '/', 0, '*', 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '7', '8', '9', '-', '4', '5', '6',
'+', '1', '2', '3', '0', '.', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
char CONSTEXPR const g_keyAsciiTableShift[128] = {
0 , 0, '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', 0, 0, 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P',
'{', '}', 0, 0, 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', '~', 0, '|', 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<',
'>', '?', 0, '*', 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '7', '8', '9', '-', '4', '5', '6',
'+', '1', '2', '3', '0', '.', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
// mouse
// joystick
@ -128,14 +89,13 @@ extern int32_t qsetmode;
#define in3dmode() (qsetmode==200)
void system_getcvars(void);
extern int32_t g_logFlushWindow;
void I_GetEvent();
inline int32_t handleevents(void)
{
timerUpdateClock();
I_GetEvent();
return 0;
}

View file

@ -1088,7 +1088,6 @@ EXTERN_CVAR(Bool, hw_animsmoothing)
EXTERN_CVAR(Bool, hw_hightile)
EXTERN_CVAR(Bool, hw_models)
EXTERN_CVAR(Float, hw_shadescale)
EXTERN_CVAR(Int, vid_vsync)
EXTERN_CVAR(Int, hw_anisotropy)
EXTERN_CVAR(Int, hw_texfilter)
EXTERN_CVAR(Bool, hw_useindexedcolortextures)

View file

@ -34,6 +34,7 @@
# include "hightile.h"
# include "mdsprite.h"
# include "polymost.h"
#include "v_video.h"
#include "../../glbackend/glbackend.h"
#endif
@ -98,7 +99,7 @@ static TArray<TArray<uint8_t>> voxelmemory;
void (*loadvoxel_replace)(int32_t voxindex) = NULL;
int16_t tiletovox[MAXTILES];
#ifdef USE_OPENGL
static char *voxfilenames[MAXVOXELS];
char *voxfilenames[MAXVOXELS];
#endif
char g_haveVoxels;
//#define kloadvoxel loadvoxel
@ -9654,8 +9655,6 @@ int32_t engineLoadBoard(const char *filename, char flags, vec3_t *dapos, int16_t
OSD_Exec(fn);
#endif
system_getcvars();
// Per-map ART
artSetupMapArt(filename);
}
@ -9947,32 +9946,6 @@ static void videoAllocateBuffers(void)
#endif
}
#ifdef USE_OPENGL
void (*PolymostProcessVoxels_Callback)(void) = NULL;
static void PolymostProcessVoxels(void)
{
if (PolymostProcessVoxels_Callback)
PolymostProcessVoxels_Callback();
if (g_haveVoxels != 1)
return;
g_haveVoxels = 2;
OSD_Printf("Generating voxel models for Polymost. This may take a while...\n");
videoNextPage();
for (bssize_t i=0; i<MAXVOXELS; i++)
{
if (voxfilenames[i])
{
voxmodels[i] = voxload(voxfilenames[i]);
voxmodels[i]->scale = voxscale[i]*(1.f/65536.f);
DO_FREE_AND_NULL(voxfilenames[i]);
}
}
}
#endif
//
// setgamemode
@ -9983,14 +9956,13 @@ int32_t videoSetGameMode(char davidoption, int32_t daupscaledxdim, int32_t daups
{
int32_t j;
#ifdef USE_OPENGL
if (nogl) dabpp = 8;
#endif
if (dabpp != 32) return -1; // block software mode.
daupscaledxdim = max(320, daupscaledxdim);
daupscaledydim = max(200, daupscaledydim);
if (in3dmode() && videomodereset == 0 && (davidoption == fullscreen) &&
(xres == daupscaledxdim) && (yres == daupscaledydim) && (bpp == dabpp) && (upscalefactor == daupscalefactor))
if (in3dmode() && videomodereset == 0 &&
(xres == daupscaledxdim) && (yres == daupscaledydim) && (bpp == dabpp))
return 0;
Bstrcpy(kensmessage,"!!!! BUILD engine&tools programmed by Ken Silverman of E.G. RI."
@ -10005,24 +9977,12 @@ int32_t videoSetGameMode(char davidoption, int32_t daupscaledxdim, int32_t daups
j = bpp;
g_lastpalettesum = 0;
if (videoSetMode(daupscaledxdim,daupscaledydim,dabpp,davidoption) < 0) return -1;
#ifdef USE_OPENGL
if (dabpp > 8) rendmode = glrendmode; // GL renderer
else rendmode = REND_CLASSIC;
#endif
rendmode = REND_POLYMOST;
upscalefactor = max(1, min(tabledivide32(yres, 200), daupscalefactor));
//POGOTODO: Polymost/Polymer could work with upscaling with a couple more changes
int32_t scalefactor = upscalefactor;
#ifdef RENDERTYPESDL
if (bpp != 8)
#endif
{
scalefactor = 1;
}
xdim = daupscaledxdim/scalefactor;
ydim = daupscaledydim/scalefactor;
upscalefactor = 1;
xdim = daupscaledxdim;
ydim = daupscaledydim;
V_UpdateModeSize(xdim, ydim);
#ifdef USE_OPENGL
@ -10056,16 +10016,6 @@ int32_t videoSetGameMode(char davidoption, int32_t daupscaledxdim, int32_t daups
if (searchx < 0) { searchx = halfxdimen; searchy = (ydimen>>1); }
#ifdef USE_OPENGL
if (videoGetRenderMode() >= REND_POLYMOST)
{
polymost_glreset();
polymost_glinit();
if (videoGetRenderMode() == REND_POLYMOST)
PolymostProcessVoxels();
}
#endif
qsetmode = 200;
return 0;
}
@ -12243,4 +12193,9 @@ void renderSetRollAngle(int32_t rolla)
}
#endif
void videoShowFrame(int32_t w)
{
screen->Update();
}

View file

@ -745,7 +745,6 @@ void videoSetPalette(char dabrightness, uint8_t dapalid, uint8_t flags)
const uint8_t* dapal;
int32_t paldidchange;
int32_t palsumdidchange;
// uint32_t lastbright = curbrightness;
// Bassert((flags&4)==0); // What is so bad about this flag?
@ -792,21 +791,6 @@ void videoSetPalette(char dabrightness, uint8_t dapalid, uint8_t flags)
if ((flags & 16) && palfadedelta) // keep the fade
paletteSetFade(palfadedelta >> 2);
// Don't waste time on this palette voodoo if we are hardware rendering. videoUpdatePalette is a strictly software rendering function.
if (videoGetRenderMode() < REND_POLYMOST)
{
static uint32_t lastpalettesum = 0;
uint32_t newpalettesum = SuperFastHash((char*)curpalettefaded, sizeof(curpalettefaded));
palsumdidchange = (newpalettesum != lastpalettesum);
if (palsumdidchange || newpalettesum != g_lastpalettesum)
{
videoUpdatePalette(0, 256);
}
g_lastpalettesum = lastpalettesum = newpalettesum;
}
if ((flags & 16) == 0)
{
@ -851,18 +835,4 @@ void videoFadePalette(uint8_t r, uint8_t g, uint8_t b, uint8_t offset)
palfadedelta = offset;
paletteSetFade(offset);
// Don't waste time on this palette voodoo if we are hardware rendering. videoUpdatePalette is a strictly software rendering function.
if (videoGetRenderMode() < REND_POLYMOST)
{
static uint32_t lastpalettesum = 0;
uint32_t newpalettesum = SuperFastHash((char*)curpalettefaded, sizeof(curpalettefaded));
if (newpalettesum != lastpalettesum || newpalettesum != g_lastpalettesum)
{
videoUpdatePalette(0, 256);
}
g_lastpalettesum = lastpalettesum = newpalettesum;
}
}

View file

@ -30,16 +30,6 @@ CVARD(Bool, hw_shadeinterpolate, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "enable
CVARD(Float, hw_shadescale, 1.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "multiplier for shading")
CVARD(Bool, hw_useindexedcolortextures, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "enable/disable indexed color texture rendering")
CUSTOM_CVAR(Int, vid_vsync, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
{
static bool recursion;
if (!recursion)
{
recursion = true;
self = videoSetVsync(self);
recursion = false;
}
}
CUSTOM_CVARD(Int, hw_texfilter, TEXFILTER_ON, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "changes the texture filtering settings")
{
@ -5416,3 +5406,36 @@ void PrecacheHardwareTextures(int nTile)
// This really *really* needs improvement on the game side - the entire precaching logic has no clue about the different needs of a hardware renderer.
polymost_precache(nTile, 0, 1);
}
extern char* voxfilenames[MAXVOXELS];
void (*PolymostProcessVoxels_Callback)(void) = NULL;
static void PolymostProcessVoxels(void)
{
if (PolymostProcessVoxels_Callback)
PolymostProcessVoxels_Callback();
if (g_haveVoxels != 1)
return;
g_haveVoxels = 2;
OSD_Printf("Generating voxel models for Polymost. This may take a while...\n");
videoNextPage();
for (bssize_t i = 0; i < MAXVOXELS; i++)
{
if (voxfilenames[i])
{
voxmodels[i] = voxload(voxfilenames[i]);
voxmodels[i]->scale = voxscale[i] * (1.f / 65536.f);
DO_FREE_AND_NULL(voxfilenames[i]);
}
}
}
void Polymost_Startup()
{
polymost_glreset();
polymost_glinit();
PolymostProcessVoxels();
}

File diff suppressed because it is too large Load diff

View file

@ -56,6 +56,7 @@
#include "i_time.h"
#include "gamecvars.h"
#include "baselayer.h"
#include "i_system.h"
#define LEFTMARGIN 8
@ -897,9 +898,7 @@ int PrintString (int iprintlevel, const char *outline)
if (printlevel != PRINT_LOG)
{
#if 0
I_PrintStr(outline);
#endif
conbuffer->AddText(printlevel, outline);
if (vidactive && (iprintlevel & PRINT_NOTIFY))

View file

@ -709,7 +709,6 @@ EColorRange V_ParseFontColor (const uint8_t *&color_value, int normalcolor, int
void V_InitFonts()
{
V_InitFontColors();
V_InitCustomFonts();
FFont *CreateHexLumpFont(const char *fontname, const char* lump);

View file

@ -46,6 +46,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "quotemgr.h"
#include "mapinfo.h"
#include "s_soundinternal.h"
#include "i_system.h"
#include "inputstate.h"
#include "v_video.h"
#include "st_start.h"
#ifndef NETCODE_DISABLE
#include "enet.h"
#endif
@ -282,19 +286,6 @@ void ShutdownSystem()
int GameMain()
{
// Set up the console before anything else so that it can receive text.
C_InitConsole(1024, 768, true);
FStringf logpath("logfile %sdemolition.log", M_GetDocumentsPath().GetChars());
C_DoCommand(logpath);
//I_StartupJoysticks();
//mouseInit();
#ifndef NETCODE_DISABLE
gHaveNetworking = !enet_initialize();
if (!gHaveNetworking)
initprintf("An error occurred while initializing ENet.\n");
#endif
int r;
try
{
@ -355,14 +346,8 @@ void SetDefaultStrings()
//
//==========================================================================
int RunGame()
static TArray<GrpEntry> SetupGame()
{
SetClipshapes();
userConfig.ProcessOptions();
G_LoadConfig();
// Startup dialog must be presented here so that everything can be set up before reading the keybinds.
auto groups = GrpScan();
@ -399,8 +384,8 @@ int RunGame()
if (groupno == -1 || userConfig.setupstate == 1)
groupno = ShowStartupWindow(groups);
if (groupno == -1) return 0;
auto &group = groups[groupno];
if (groupno == -1) return TArray<GrpEntry>();
auto& group = groups[groupno];
// Now filter out the data we actually need and delete the rest.
@ -425,8 +410,8 @@ int RunGame()
if (ugroup.FileInfo.defname.IsNotEmpty()) selectedDef = ugroup.FileInfo.defname;
// CVAR has priority. This also overwrites the global variable each time. Init here is lazy so this is ok.
if (ugroup.FileInfo.rtsname.IsNotEmpty() && **rtsname == 0) RTS_Init(ugroup.FileInfo.rtsname);
if (ugroup.FileInfo.rtsname.IsNotEmpty() && **rtsname == 0) RTS_Init(ugroup.FileInfo.rtsname);
// For the game filter the last non-empty one wins.
if (ugroup.FileInfo.gamefilter.IsNotEmpty()) LumpFilter = ugroup.FileInfo.gamefilter;
g_gameType |= ugroup.FileInfo.flags;
@ -445,8 +430,61 @@ int RunGame()
currentGame = LumpFilter;
currentGame.Truncate(currentGame.IndexOf("."));
CheckFrontend(g_gameType);
return usedgroups;
}
//==========================================================================
//
//
//
//==========================================================================
int RunGame()
{
// Set up the console before anything else so that it can receive text.
C_InitConsole(1024, 768, true);
// +logfile gets checked too late to catch the full startup log in the logfile so do some extra check for it here.
FString logfile = Args->TakeValue("+logfile");
// As long as this engine is still in prerelease mode let's always write a log file.
if (logfile.IsEmpty()) logfile.Format("%sdemolition.log", M_GetDocumentsPath().GetChars());
if (logfile.IsNotEmpty())
{
execLogfile(logfile);
}
I_DetectOS();
SetClipshapes();
userConfig.ProcessOptions();
G_LoadConfig();
//I_StartupJoysticks();
//mouseInit();
#ifndef NETCODE_DISABLE
gHaveNetworking = !enet_initialize();
if (!gHaveNetworking)
initprintf("An error occurred while initializing ENet.\n");
#endif
auto usedgroups = SetupGame();
InitFileSystem(usedgroups);
if (usedgroups.Size() == 0) return 0;
G_ReadConfig(currentGame);
V_InitFontColors();
GStrings.LoadStrings();
I_Init();
V_InitScreenSize();
V_InitScreen();
StartScreen = FStartupScreen::CreateInstance(100);
TArray<FString> addArt;
for (auto& grp : usedgroups)
{
@ -461,10 +499,9 @@ int RunGame()
}
TileFiles.AddArt(addArt);
CONFIG_InitMouseAndController();
inputState.ClearAllInput();
CONFIG_SetDefaultKeys(cl_defaultconfiguration == 1 ? "demolition/origbinds.txt" : cl_defaultconfiguration == 2 ? "demolition/leftbinds.txt" : "demolition/defbinds.txt");
G_ReadConfig(currentGame);
if (!GameConfig->IsInitialized())
{
CONFIG_ReadCombatMacros();
@ -474,7 +511,6 @@ int RunGame()
{
playername = userConfig.CommandName;
}
GStrings.LoadStrings();
V_InitFonts();
C_CON_SetAliases();
sfx_empty = fileSystem.FindFile("demolition/dsempty.lmp"); // this must be done outside the sound code because it's initialized late.
@ -484,6 +520,12 @@ int RunGame()
SetDefaultStrings();
if (g_gameType & GAMEFLAG_RR) InitRREndMap(); // this needs to be done better later
//C_DoCommand("stat sounddebug");
if (enginePreInit())
{
I_Error("app_main: There was a problem initializing the Build engine: %s\n", engineerrstr);
}
return gi->app_main();
}
@ -554,14 +596,6 @@ int CONFIG_SetMapBestTime(uint8_t const* const mapmd4, int32_t tm)
}
void CONFIG_InitMouseAndController()
{
inputState.ClearKeysDown();
inputState.keyFlushChars();
inputState.keyFlushScans();
}
CCMD(snd_reset)
{
Mus_Stop();

View file

@ -36,7 +36,6 @@ void CONFIG_SetDefaultKeys(const char *defbinds);
void CONFIG_SetupJoystick(void);
void CONFIG_InitMouseAndController();
void CONFIG_SetGameControllerDefaultsClear();

View file

@ -457,11 +457,6 @@ bool G_AllowAutoload()
return true;
}
CVAR(Int, ScreenMode, 0, CVAR_ARCHIVE | CVAR_VIDEOCONFIG)
CVAR(Int, ScreenWidth, 1024, CVAR_ARCHIVE | CVAR_VIDEOCONFIG)
CVAR(Int, ScreenHeight, 768, CVAR_ARCHIVE | CVAR_VIDEOCONFIG)
CVAR(Int, ScreenBPP, 32, CVAR_ARCHIVE | CVAR_VIDEOCONFIG)
CVAR(Bool, adult_lockout, false, CVAR_ARCHIVE)
CUSTOM_CVAR(String, playername, "Player", CVAR_ARCHIVE | CVAR_USERINFO)
{

View file

@ -101,11 +101,6 @@ EXTERN_CVAR(String, wchoice)
EXTERN_CVAR(Bool, displaysetup)
EXTERN_CVAR(Bool, noautoload)
EXTERN_CVAR(Int, ScreenMode)
EXTERN_CVAR(Int, ScreenWidth)
EXTERN_CVAR(Int, ScreenHeight)
EXTERN_CVAR(Int, ScreenBPP)
EXTERN_CVAR(Bool, adult_lockout)
EXTERN_CVAR(String, playername)
EXTERN_CVAR(String, rtsname)

View file

@ -56,6 +56,8 @@
#include "i_time.h"
#include "version.h"
#include "filesystem.h"
#include "build.h"
#include "glbackend/glbackend.h"
EXTERN_CVAR(Int, menu_resolution_custom_width)
EXTERN_CVAR(Int, menu_resolution_custom_height)
@ -613,6 +615,13 @@ void V_Init2()
screen->SetGamma ();
FBaseCVar::ResetColors ();
C_NewModeAdjust();
videoSetGameMode(vid_fullscreen, SCREENWIDTH, SCREENHEIGHT, 32, 1);
polymost_glinit();
GLInterface.Init(SCREENHEIGHT);
GLInterface.InitGLState(4, glmultisample);
GLInterface.mSamplers->SetTextureFilterMode(hw_texfilter, hw_anisotropy);
//setsizeneeded = true;
}

View file

@ -27,93 +27,46 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "renderlayer.h"
#include "cmdline.h"
#if defined RENDERTYPESDL && defined SDL_TARGET && SDL_TARGET > 1
# include "sdl_inc.h"
#endif
// we load this in to get default button and key assignments
// as well as setting up function mappings
BEGIN_DUKE_NS
void CONFIG_SetDefaults(void)
{
# if defined RENDERTYPESDL && SDL_MAJOR_VERSION > 1
uint32_t inited = SDL_WasInit(SDL_INIT_VIDEO);
if (inited == 0)
SDL_Init(SDL_INIT_VIDEO);
else if (!(inited & SDL_INIT_VIDEO))
SDL_InitSubSystem(SDL_INIT_VIDEO);
SDL_DisplayMode dm;
if (SDL_GetDesktopDisplayMode(0, &dm) == 0)
{
ScreenWidth = dm.w;
ScreenHeight = dm.h;
}
else
# endif
{
ScreenWidth = 1024;
ScreenHeight = 768;
}
ScreenBPP = 32;
ud.camera_time = 0;//4;
g_player[0].ps->aim_mode = 1;
ScreenMode = 1;
ud.althud = 1;
ud.angleinterpolation = 0;
ud.camerasprite = -1;
ud.config.ShowWeapons = 0;
ud.display_bonus_screen = 1;
hud_position = 0;
ud.menubackground = 1;
ud.screen_size = 4;
ud.screen_tilting = 1;
ud.screenfade = 1;
ud.shadow_pal = 4;
ud.show_level_text = 1;
ud.slidebar_paldisabled = 1;
ud.statusbarflags = 0;//STATUSBAR_NOSHRINK;
ud.statusbarmode = 1;
ud.statusbarscale = 100;
ud.god = 0;
ud.m_respawn_items = 0;
ud.m_respawn_monsters = 0;
ud.m_respawn_inventory = 0;
ud.warp_on = 0;
ud.cashman = 0;
m_ffire = 1;
ud.m_player_skill = ud.player_skill = 2;
memcpy(g_player[0].wchoice, "\3\4\5\7\0x8\6\0\2\0x9\1", 10);
wchoice.Callback();
}
int CONFIG_ReadSetup(void)
{
CONFIG_SetDefaults();
if (ScreenBPP < 8) ScreenBPP = 32;
ud.camera_time = 0;//4;
g_player[0].ps->aim_mode = 1;
ud.althud = 1;
ud.angleinterpolation = 0;
ud.camerasprite = -1;
ud.config.ShowWeapons = 0;
ud.display_bonus_screen = 1;
hud_position = 0;
ud.menubackground = 1;
ud.screen_size = 4;
ud.screen_tilting = 1;
ud.screenfade = 1;
ud.shadow_pal = 4;
ud.show_level_text = 1;
ud.slidebar_paldisabled = 1;
ud.statusbarflags = 0;//STATUSBAR_NOSHRINK;
ud.statusbarmode = 1;
ud.statusbarscale = 100;
ud.god = 0;
ud.m_respawn_items = 0;
ud.m_respawn_monsters = 0;
ud.m_respawn_inventory = 0;
ud.warp_on = 0;
ud.cashman = 0;
m_ffire = 1;
ud.m_player_skill = ud.player_skill = 2;
memcpy(g_player[0].wchoice, "\3\4\5\7\0x8\6\0\2\0x9\1", 10);
wchoice.Callback();
return 0;
}
void CONFIG_WriteSettings(void) // save binds and aliases to <cfgname>_settings.cfg
{
}
END_DUKE_NS

View file

@ -29,7 +29,6 @@ BEGIN_DUKE_NS
int CONFIG_ReadSetup(void);
void CONFIG_SetDefaults(void);
END_DUKE_NS
#endif

View file

@ -49,6 +49,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "statistics.h"
#include "menu/menu.h"
#include "mapinfo.h"
#include "rendering/v_video.h"
// Uncomment to prevent anything except mirrors from drawing. It is sensible to
// also uncomment ENGINE_CLEAR_SCREEN in build/src/engine_priv.h.
@ -187,23 +188,6 @@ void G_HandleSpecialKeys(void)
CONTROL_GetInput(&noshareinfo);
}
if (g_networkMode != NET_DEDICATED_SERVER && ALT_IS_PRESSED && inputState.GetKeyStatus(sc_Enter))
{
if (videoSetGameMode(!ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, 1))
{
OSD_Printf(OSD_ERROR "Failed setting video mode!\n");
if (videoSetGameMode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, 1))
G_GameExit("Fatal error: unable to recover from failure setting video mode!\n");
}
else
ScreenMode = !ScreenMode;
inputState.ClearKeyStatus(sc_Enter);
g_restorePalette = 1;
G_UpdateScreenArea();
}
// only dispatch commands here when not in a game
if ((myplayer.gm & MODE_GAME) != MODE_GAME)
OSD_DispatchQueued();
@ -267,7 +251,6 @@ void G_GameExit(const char *msg)
g_mostConcurrentPlayers > 1 && g_player[myconnectindex].ps->gm & MODE_GAME && GTFLAGS(GAMETYPE_SCORESHEET) && *msg == ' ')
{
G_BonusScreen(1);
videoSetGameMode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, 1);
}
// shareware and TEN screens
@ -5800,10 +5783,6 @@ int GameInterface::app_main()
CONFIG_ReadSetup();
if (enginePreInit())
{
I_Error("app_main: There was a problem initializing the Build engine: %s\n", engineerrstr);
}
hud_size.Callback();
S_InitSound();
@ -5940,53 +5919,9 @@ int GameInterface::app_main()
g_clipMapFiles.clear();
#endif
#if 0
OSD_Exec("autoexec.cfg");
#endif
system_getcvars();
if (g_networkMode != NET_DEDICATED_SERVER && validmodecnt > 0)
if (g_networkMode != NET_DEDICATED_SERVER)
{
if (videoSetGameMode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, 1) < 0)
{
initprintf("Failure setting video mode %dx%dx%d %s! Trying next mode...\n", *ScreenWidth, *ScreenHeight,
*ScreenBPP, *ScreenMode ? "fullscreen" : "windowed");
int resIdx = 0;
for (int i=0; i < validmodecnt; i++)
{
if (validmode[i].xdim == ScreenWidth && validmode[i].ydim == ScreenHeight)
{
resIdx = i;
break;
}
}
int const savedIdx = resIdx;
int bpp = ScreenBPP;
while (videoSetGameMode(0, validmode[resIdx].xdim, validmode[resIdx].ydim, bpp, 1) < 0)
{
initprintf("Failure setting video mode %dx%dx%d windowed! Trying next mode...\n",
validmode[resIdx].xdim, validmode[resIdx].ydim, bpp);
if (++resIdx >= validmodecnt)
{
if (bpp == 8)
G_GameExit("Fatal error: unable to set any video mode!");
resIdx = savedIdx;
bpp = 8;
}
}
ScreenWidth = validmode[resIdx].xdim;
ScreenHeight = validmode[resIdx].ydim;
ScreenBPP = bpp;
}
V_Init2();
videoSetPalette(0, myplayer.palette, 0);
}

View file

@ -182,54 +182,6 @@ int osdcmd_restartmap(osdcmdptr_t UNUSED(parm))
return OSDCMD_OK;
}
static int osdcmd_vidmode(osdcmdptr_t parm)
{
int32_t newbpp = ScreenBPP, newwidth = ScreenWidth,
newheight = ScreenHeight, newfs = ScreenMode;
int32_t tmp;
if (parm->numparms < 1 || parm->numparms > 4) return OSDCMD_SHOWHELP;
switch (parm->numparms)
{
case 1: // bpp switch
tmp = Batol(parm->parms[0]);
if (!(tmp==8 || tmp==16 || tmp==32))
return OSDCMD_SHOWHELP;
newbpp = tmp;
break;
case 2: // res switch
newwidth = Batol(parm->parms[0]);
newheight = Batol(parm->parms[1]);
break;
case 3: // res & bpp switch
case 4:
newwidth = Batol(parm->parms[0]);
newheight = Batol(parm->parms[1]);
tmp = Batol(parm->parms[2]);
if (!(tmp==8 || tmp==16 || tmp==32))
return OSDCMD_SHOWHELP;
newbpp = tmp;
if (parm->numparms == 4)
newfs = (Batol(parm->parms[3]) != 0);
break;
}
if (videoSetGameMode(newfs,newwidth,newheight,newbpp,upscalefactor))
{
initprintf("vidmode: Mode change failed!\n");
if (videoSetGameMode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, upscalefactor))
G_GameExit("vidmode: Reset failed!\n");
}
ScreenBPP = newbpp;
ScreenWidth = newwidth;
ScreenHeight = newheight;
ScreenMode = newfs;
onvideomodechange(ScreenBPP>8);
G_UpdateScreenArea();
return OSDCMD_OK;
}
static int osdcmd_spawn(osdcmdptr_t parm)
{
int32_t picnum = 0;
@ -806,9 +758,6 @@ int32_t registerosdcommands(void)
OSD_RegisterFunction("spawn","spawn <picnum> [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",osdcmd_spawn);
OSD_RegisterFunction("vidmode","vidmode <xdim> <ydim> <bpp> <fullscreen>: change the video mode",osdcmd_vidmode);
return 0;
}

View file

@ -1778,7 +1778,6 @@ int G_EnterLevel(int gameMode)
FX_StopAllSounds();
S_ClearSoundLocks();
FX_SetReverb(0);
videoSetGameMode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, upscalefactor);
}
if (Menu_HaveUserMap())

View file

@ -44,6 +44,7 @@
#include "imgui_impl_sdl.h"
#include "imgui_impl_opengl3.h"
#include "baselayer.h"
#include "gl_interface.h"
extern int ydim;
@ -77,17 +78,9 @@ void GLInstance::Init(int ydim)
memset(LastBoundTextures, 0, sizeof(LastBoundTextures));
}
glinfo.vendor = (const char*)glGetString(GL_VENDOR);
glinfo.renderer = (const char*)glGetString(GL_RENDERER);
glinfo.version = (const char*)glGetString(GL_VERSION);
glinfo.extensions = (const char*)glGetString(GL_EXTENSIONS);
glinfo.bufferstorage = !!strstr(glinfo.extensions, "GL_ARB_buffer_storage");
//glinfo.bufferstorage = !!strstr(glinfo.extensions, "GL_ARB_buffer_storage");
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glinfo.maxanisotropy);
if (!glinfo.dumped)
{
//osdcmd_glinfo(NULL);
glinfo.dumped = 1;
}
new(&renderState) PolymostRenderState; // reset to defaults.
LoadSurfaceShader();
LoadVPXShader();

View file

@ -91,14 +91,7 @@ public:
struct glinfo_t {
const char* vendor;
const char* renderer;
const char* version;
const char* extensions;
float maxanisotropy;
char bufferstorage;
char dumped;
};
struct BaseVertex

View file

@ -131,48 +131,6 @@ static void PopulateForm(int32_t pgs)
#endif
}
if (pgs & POPULATE_VIDEO)
{
HWND hwnd = GetDlgItem(pages[TAB_CONFIG], IDCVMODE);
int mode = videoCheckMode(&settings.shared.xdim, &settings.shared.ydim, settings.shared.bpp, settings.shared.fullscreen, 1);
if (mode < 0 || (settings.shared.bpp < 15))
{
int CONSTEXPR cd[] = { 32, 24, 16, 15, 8, 0 };
int i;
for (i=0; cd[i];)
{
if (cd[i] >= settings.shared.bpp) i++;
else break;
}
for (; cd[i]; i++)
{
mode = videoCheckMode(&settings.shared.xdim, &settings.shared.ydim, cd[i], settings.shared.fullscreen, 1);
if (mode < 0) continue;
settings.shared.bpp = cd[i];
break;
}
}
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), ((settings.shared.fullscreen) ? BST_CHECKED : BST_UNCHECKED));
//Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCPOLYMER), ((settings.polymer) ? BST_CHECKED : BST_UNCHECKED));
(void)ComboBox_ResetContent(hwnd);
for (int i=0; i<validmodecnt; i++)
{
if (validmode[i].fs != (settings.shared.fullscreen)) continue;
if ((validmode[i].bpp < 15)) continue;
// all modes get added to the 3D mode list
Bsprintf(buf, "%dx%d %s", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp == 8 ? "software" : "OpenGL");
int const j = ComboBox_AddString(hwnd, buf);
(void)ComboBox_SetItemData(hwnd, j, i);
if (i == mode)(void)ComboBox_SetCurSel(hwnd, j);
}
}
if (pgs & POPULATE_GAME)
{
@ -584,7 +542,7 @@ int32_t startwin_run(void)
SetPage(TAB_CONFIG);
EnableConfig(1);
settings.shared = { ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP };
settings.shared = { 0, 0, 0, 0 };
settings.grp = 0;
PopulateForm(-1);
@ -613,14 +571,6 @@ int32_t startwin_run(void)
SetPage(TAB_MESSAGES);
EnableConfig(0);
if (done)
{
ScreenWidth = settings.shared.xdim;
ScreenHeight = settings.shared.ydim;
ScreenMode = settings.shared.fullscreen;
ScreenBPP = settings.shared.bpp;
}
return done;
}

View file

@ -405,7 +405,7 @@ bool Win32GLVideo::InitHardware(HWND Window, int multisample)
int prof = WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
const char *version = Args->CheckValue("-glversion");
if (version != nullptr && strtod(version, nullptr) < 3.0) prof = WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
prof = WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; // At the moment the renderer still needs the compatibility profile.
for (; prof <= WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; prof++)
{
@ -413,8 +413,8 @@ bool Win32GLVideo::InitHardware(HWND Window, int multisample)
if (myWglCreateContextAttribsARB != NULL)
{
// let's try to get the best version possible. Some drivers only give us the version we request
// which breaks all version checks for feature support. The highest used features we use are from version 4.4, and 3.0 is a requirement.
static int versions[] = { 46, 45, 44, 43, 42, 41, 40, 33, 32, 31, 30, -1 };
// which breaks all version checks for feature support. The highest used features we use are from version 4.4, and 3.3 is a requirement.
static int versions[] = { 46, 45, 44, 43, 42, 41, 40, 33, -1 };
for (int i = 0; versions[i] > 0; i++)
{

View file

@ -36,66 +36,28 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_RR_NS
void CONFIG_SetDefaults(void)
int32_t CONFIG_ReadSetup(void)
{
# if defined RENDERTYPESDL && SDL_MAJOR_VERSION > 1
uint32_t inited = SDL_WasInit(SDL_INIT_VIDEO);
if (inited == 0)
SDL_Init(SDL_INIT_VIDEO);
else if (!(inited & SDL_INIT_VIDEO))
SDL_InitSubSystem(SDL_INIT_VIDEO);
SDL_DisplayMode dm;
if (SDL_GetDesktopDisplayMode(0, &dm) == 0)
{
ScreenWidth = dm.w;
ScreenHeight = dm.h;
}
else
# endif
{
ScreenWidth = 1024;
ScreenHeight = 768;
}
ScreenBPP = 32;
g_player[0].ps->aim_mode = 1;
ud.config.ShowOpponentWeapons = 0;
ud.automsg = 0;
ud.camerasprite = -1;
ud.camera_time = 0;//4;
ud.camera_time = 0;//4;
ud.screen_tilting = 1;
ud.screen_tilting = 1;
ud.statusbarflags = STATUSBAR_NOSHRINK;
ud.statusbarscale = 100;
playerteam = 0;
ud.angleinterpolation = 0;
ScreenMode = 1;
ud.display_bonus_screen = 1;
ud.show_level_text = 1;
ud.screenfade = 1;
ud.menubackground = 1;
ud.slidebar_paldisabled = 1;
ud.shadow_pal = 4;
}
int32_t CONFIG_ReadSetup(void)
{
CONFIG_SetDefaults();
if (ScreenBPP < 8) ScreenBPP = 32;
return 0;
}
void CONFIG_WriteSettings(void) // save binds and aliases to <cfgname>_settings.cfg
{
}
END_RR_NS

View file

@ -48,6 +48,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "statistics.h"
#include "c_dispatch.h"
#include "mapinfo.h"
#include "rendering/v_video.h"
// Uncomment to prevent anything except mirrors from drawing. It is sensible to
// also uncomment ENGINE_CLEAR_SCREEN in build/src/engine_priv.h.
@ -174,22 +175,6 @@ void G_HandleSpecialKeys(void)
CONTROL_GetInput(&noshareinfo);
}
// CONTROL_ProcessBinds();
if (/*g_networkMode != NET_DEDICATED_SERVER && */ALT_IS_PRESSED && inputState.GetKeyStatus(sc_Enter))
{
if (videoSetGameMode(!ScreenMode,ScreenWidth,ScreenHeight,ScreenBPP,1))
{
OSD_Printf(OSD_ERROR "Failed setting fullscreen video mode.\n");
if (videoSetGameMode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, 1))
G_GameExit("Failed to recover from failure to set fullscreen video mode.\n");
}
else ScreenMode = !ScreenMode;
inputState.ClearKeyStatus(sc_Enter);
g_restorePalette = 1;
G_UpdateScreenArea();
}
// only dispatch commands here when not in a game
if (!(g_player[myconnectindex].ps->gm & MODE_GAME))
OSD_DispatchQueued();
@ -375,7 +360,6 @@ void G_GameExit(const char *msg)
if (g_mostConcurrentPlayers > 1 && g_player[myconnectindex].ps->gm&MODE_GAME && GTFLAGS(GAMETYPE_SCORESHEET) && *msg == ' ')
{
G_BonusScreen(1);
videoSetGameMode(ScreenMode,ScreenWidth,ScreenHeight,ScreenBPP,1);
}
// shareware and TEN screens
@ -7256,10 +7240,6 @@ int GameInterface::app_main()
CONFIG_ReadSetup();
if (enginePreInit())
{
I_Error("app_main: There was a problem initializing the Build engine: %s\n", engineerrstr);
}
hud_size.Callback();
S_InitSound();
@ -7395,55 +7375,8 @@ int GameInterface::app_main()
g_clipMapFiles.clear();
#endif
#if 0
OSD_Exec("autoexec.cfg");
#endif
system_getcvars();
//if (g_networkMode != NET_DEDICATED_SERVER)
{
if (videoSetGameMode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, 1) < 0)
{
initprintf("Failure setting video mode %dx%dx%d %s! Trying next mode...\n", *ScreenWidth, *ScreenHeight,
*ScreenBPP, *ScreenMode ? "fullscreen" : "windowed");
int resIdx = 0;
for (int i=0; i < validmodecnt; i++)
{
if (validmode[i].xdim == ScreenWidth && validmode[i].ydim == ScreenHeight)
{
resIdx = i;
break;
}
}
int const savedIdx = resIdx;
int bpp = ScreenBPP;
while (videoSetGameMode(0, validmode[resIdx].xdim, validmode[resIdx].ydim, bpp, 1) < 0)
{
initprintf("Failure setting video mode %dx%dx%d windowed! Trying next mode...\n",
validmode[resIdx].xdim, validmode[resIdx].ydim, bpp);
if (++resIdx == validmodecnt)
{
if (bpp == 8)
G_GameExit("Fatal error: unable to set any video mode!");
resIdx = savedIdx;
bpp = 8;
}
}
ScreenWidth = validmode[resIdx].xdim;
ScreenHeight = validmode[resIdx].ydim;
ScreenBPP = bpp;
}
videoSetPalette(0, g_player[myconnectindex].ps->palette, 0);
}
V_Init2();
videoSetPalette(0, g_player[myconnectindex].ps->palette, 0);
// check if the minifont will support lowercase letters (3136-3161)
// there is room for them in tiles012.art between "[\]^_." and "{|}~"

View file

@ -179,54 +179,6 @@ int osdcmd_restartmap(osdcmdptr_t UNUSED(parm))
return OSDCMD_OK;
}
static int osdcmd_vidmode(osdcmdptr_t parm)
{
int32_t newbpp = ScreenBPP, newwidth = ScreenWidth,
newheight = ScreenHeight, newfs = ScreenMode;
int32_t tmp;
if (parm->numparms < 1 || parm->numparms > 4) return OSDCMD_SHOWHELP;
switch (parm->numparms)
{
case 1: // bpp switch
tmp = Batol(parm->parms[0]);
if (!(tmp==8 || tmp==16 || tmp==32))
return OSDCMD_SHOWHELP;
newbpp = tmp;
break;
case 2: // res switch
newwidth = Batol(parm->parms[0]);
newheight = Batol(parm->parms[1]);
break;
case 3: // res & bpp switch
case 4:
newwidth = Batol(parm->parms[0]);
newheight = Batol(parm->parms[1]);
tmp = Batol(parm->parms[2]);
if (!(tmp==8 || tmp==16 || tmp==32))
return OSDCMD_SHOWHELP;
newbpp = tmp;
if (parm->numparms == 4)
newfs = (Batol(parm->parms[3]) != 0);
break;
}
if (videoSetGameMode(newfs,newwidth,newheight,newbpp,upscalefactor))
{
initprintf("vidmode: Mode change failed!\n");
if (videoSetGameMode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, upscalefactor))
G_GameExit("vidmode: Reset failed!\n");
}
ScreenBPP = newbpp;
ScreenWidth = newwidth;
ScreenHeight = newheight;
ScreenMode = newfs;
onvideomodechange(ScreenBPP>8);
G_UpdateScreenArea();
return OSDCMD_OK;
}
static int osdcmd_spawn(osdcmdptr_t parm)
{
int32_t picnum = 0;
@ -659,8 +611,6 @@ int32_t registerosdcommands(void)
OSD_RegisterFunction("spawn","spawn <picnum> [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",osdcmd_spawn);
OSD_RegisterFunction("vidmode","vidmode <xdim> <ydim> <bpp> <fullscreen>: change the video mode",osdcmd_vidmode);
return 0;
}

View file

@ -2306,7 +2306,6 @@ int G_EnterLevel(int gameMode)
FX_StopAllSounds();
S_ClearSoundLocks();
FX_SetReverb(0);
videoSetGameMode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, upscalefactor);
}
if (Menu_HaveUserMap())

View file

@ -63,54 +63,6 @@ int32_t NumberPlayers,CommPort,PortSpeed,IrqNumber,UartAddress;
int32_t UseMouse = 1, UseJoystick = 0;
//
// Screen variables
//
/*
===================
=
= CONFIG_SetDefaults
=
===================
*/
void CONFIG_SetDefaults(void)
{
ScreenMode = 1;
#if defined RENDERTYPESDL && SDL_MAJOR_VERSION > 1
uint32_t inited = SDL_WasInit(SDL_INIT_VIDEO);
if (inited == 0)
SDL_Init(SDL_INIT_VIDEO);
else if (!(inited & SDL_INIT_VIDEO))
SDL_InitSubSystem(SDL_INIT_VIDEO);
SDL_DisplayMode dm;
if (SDL_GetDesktopDisplayMode(0, &dm) == 0)
{
ScreenWidth = dm.w;
ScreenHeight = dm.h;
}
else
#endif
{
ScreenWidth = 1024;
ScreenHeight = 768;
}
memcpy(&gs, &gs_defaults, sizeof(gs));
}
void SetDefaultKeyDefinitions(int style)
{
CONFIG_SetDefaultKeys(style ? "demolition/defbinds.txt" : "demolition/origbinds.txt");
}
/*
===================
@ -122,7 +74,7 @@ void SetDefaultKeyDefinitions(int style)
int32_t CONFIG_ReadSetup(void)
{
CONFIG_SetDefaults();
memcpy(&gs, &gs_defaults, sizeof(gs));
return 0;
}

View file

@ -1537,133 +1537,10 @@ void SpriteSortList2D(int tx, int ty)
}
}
int COVERsetgamemode(int mode, int xdim, int ydim, int bpp)
{
ScreenHeight = ydim;
ScreenWidth = xdim;
ScreenMode = mode;
ScreenBPP = bpp;
// [JM] Should I be using upscalefactor here, or some SW equivalent to Duke's ud.detail? !CHECKME!
return (int)videoSetGameMode(mode,xdim,ydim,bpp,upscalefactor);
}
void CheatResChange(void)
{
/*
extern char permanentupdate;
int i;
// needs to be called from drawscreen - crashes otherwise
//cycle through all vesa modes, then screen-buffer mode
if (vidoption == 1)
{
for(i=0;i < validmodecnt;i++)
{
if ((validmodexdim[i] == xdim) && (validmodeydim[i] == ydim))
{
if (i == validmodecnt-1)
COVERsetgamemode(2,320L,200L);
else
COVERsetgamemode(1,validmodexdim[i+1],validmodeydim[i+1]);
break;
}
}
}
else
{
if (validmodecnt > 0)
COVERsetgamemode(1,validmodexdim[0],validmodeydim[0]);
}
permanentupdate = 0;
SetupAspectRatio();
SetRedrawScreen(Player + myconnectindex);
sprintf(ds,"%d x %d mode selected.", xdim, ydim);
PutStringInfo(Player + myconnectindex, ds);
*/
PutStringInfo(Player + myconnectindex, "JonoF: Not now");
}
#if 0
void ResChange(void)
{
extern char permanentupdate;
int i;
static short sw_res[5];
static short res_ndx=0;
// clear pages before and after res set for good measure
for (i = 0; i < numpages; i++)
{
clearview(0);
videoNextPage();
}
// needs to be called from drawscreen - crashes otherwise
if (res_ndx == 0)
{
// choose resolutions for shadow warrior
for (i=0; i < validmodecnt; i++)
{
if (validmodexdim[i] + validmodeydim[i] == 320 + 200)
sw_res[res_ndx++] = i;
else if (validmodexdim[i] + validmodeydim[i] == 640 + 400)
sw_res[res_ndx++] = i;
else if (validmodexdim[i] + validmodeydim[i] == 640 + 480)
sw_res[res_ndx++] = i;
else if (validmodexdim[i] + validmodeydim[i] == 800 + 600)
sw_res[res_ndx++] = i;
}
}
//cycle through all sw modes, then screen-buffer mode
if (vidoption == 1)
{
for (i = 0; i < res_ndx; i++)
{
if ((validmodexdim[sw_res[i]] == xdim) && (validmodeydim[sw_res[i]] == ydim))
{
if (i >= res_ndx-1)
COVERsetgamemode(2, 320L, 200L);
else
COVERsetgamemode(1, validmodexdim[sw_res[i+1]], validmodeydim[sw_res[i+1]]);
break;
}
}
// if did not find current res then reset to 320x200
if (i >= res_ndx)
COVERsetgamemode(2, 320L, 200L);
}
else
{
if (validmodecnt > 0)
COVERsetgamemode(1, validmodexdim[0], validmodeydim[0]);
}
permanentupdate = 0;
for (i = 0; i < numpages; i++)
{
clearview(0);
videoNextPage();
}
SetupAspectRatio();
SetRedrawScreen(Player + myconnectindex);
sprintf(ds,"%d x %d mode selected.", xdim, ydim);
PutStringInfo(Player + myconnectindex, ds);
}
#endif
void DrawCheckKeys(PLAYERp pp)
{
extern SWBOOL ResCheat;

View file

@ -96,6 +96,7 @@ Things required to make savegames work:
#include "statistics.h"
#include "gstrings.h"
#include "mapinfo.h"
#include "rendering/v_video.h"
#include "sound/s_soundinternal.h"
//#include "crc32.h"
@ -697,18 +698,6 @@ void DisplayDemoText(void)
}
}
void Set_GameMode(void)
{
int result;
char ch;
//DSPRINTF(ds,"ScreenMode %d, ScreenWidth %d, ScreenHeight %d",ScreenMode, ScreenWidth, ScreenHeight);
//MONO_PRINT(ds);
result = COVERsetgamemode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP);
}
void MultiSharewareCheck(void)
{
if (!SW_SHAREWARE) return;
@ -946,7 +935,7 @@ bool InitGame()
DoTheCache();
}
Set_GameMode();
V_Init2();
GraphicsMode = TRUE;
SetupAspectRatio();
@ -2878,10 +2867,6 @@ int32_t GameInterface::app_main()
CONFIG_ReadSetup();
if (enginePreInit())
{
I_Error("There was a problem initialising the Build engine: %s", engineerrstr);
}
hud_size.Callback();
if (!DetectShareware())