mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 00:41:55 +00:00
- updated the platform code to be mostly identical with GZDoom
This commit is contained in:
parent
c4017de12f
commit
29db3febb8
70 changed files with 2292 additions and 529 deletions
|
@ -464,7 +464,8 @@ endif()
|
||||||
|
|
||||||
|
|
||||||
set( PLAT_POSIX_SOURCES
|
set( PLAT_POSIX_SOURCES
|
||||||
platform/posix/i_steam.cpp )
|
platform/posix/i_steam.cpp
|
||||||
|
platform/posix/i_system_posix.cpp )
|
||||||
set( PLAT_SDL_SOURCES
|
set( PLAT_SDL_SOURCES
|
||||||
platform/posix/sdl/crashcatcher.c
|
platform/posix/sdl/crashcatcher.c
|
||||||
platform/posix/sdl/hardware.cpp
|
platform/posix/sdl/hardware.cpp
|
||||||
|
@ -511,6 +512,7 @@ set( PLAT_WIN32_SOURCES
|
||||||
platform/win32/win32basevideo.cpp
|
platform/win32/win32basevideo.cpp
|
||||||
platform/win32/win32glvideo.cpp
|
platform/win32/win32glvideo.cpp
|
||||||
platform/win32/win32vulkanvideo.cpp
|
platform/win32/win32vulkanvideo.cpp
|
||||||
|
platform/win32/i_steam.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ struct GameInterface : ::GameInterface
|
||||||
void MenuOpened() override;
|
void MenuOpened() override;
|
||||||
void MenuClosed() override;
|
void MenuClosed() override;
|
||||||
bool CanSave() override;
|
bool CanSave() override;
|
||||||
void StartGame(FGameStartup& gs) override;
|
void StartGame(FNewGameStartup& gs) override;
|
||||||
void DrawNativeMenuText(int fontnum, int state, double xpos, double ypos, float fontscale, const char* text, int flags) override;
|
void DrawNativeMenuText(int fontnum, int state, double xpos, double ypos, float fontscale, const char* text, int flags) override;
|
||||||
void DrawMenuCaption(const DVector2& origin, const char* text) override;
|
void DrawMenuCaption(const DVector2& origin, const char* text) override;
|
||||||
bool SaveGame(FSaveGameNode*) override;
|
bool SaveGame(FSaveGameNode*) override;
|
||||||
|
|
|
@ -254,7 +254,7 @@ bool GameInterface::CanSave()
|
||||||
return (gGameStarted && gPlayer[myconnectindex].pXSprite->health != 0);
|
return (gGameStarted && gPlayer[myconnectindex].pXSprite->health != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameInterface::StartGame(FGameStartup& gs)
|
void GameInterface::StartGame(FNewGameStartup& gs)
|
||||||
{
|
{
|
||||||
sfxKillAllSounds();
|
sfxKillAllSounds();
|
||||||
gGameOptions.nDifficulty = gs.Skill;
|
gGameOptions.nDifficulty = gs.Skill;
|
||||||
|
|
|
@ -38,8 +38,7 @@ extern int32_t qsetmode;
|
||||||
#define in3dmode() (qsetmode==200)
|
#define in3dmode() (qsetmode==200)
|
||||||
|
|
||||||
extern int32_t g_logFlushWindow;
|
extern int32_t g_logFlushWindow;
|
||||||
|
bool System_WantGuiCapture(); // During playing this tells us whether the game must be paused due to active GUI elememts.
|
||||||
void mouseGrabInput(bool grab);
|
|
||||||
|
|
||||||
void getScreen(uint8_t* imgBuf);
|
void getScreen(uint8_t* imgBuf);
|
||||||
|
|
||||||
|
@ -54,7 +53,7 @@ struct GameStats
|
||||||
int frags;
|
int frags;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FGameStartup
|
struct FNewGameStartup
|
||||||
{
|
{
|
||||||
int Episode;
|
int Episode;
|
||||||
int Level;
|
int Level;
|
||||||
|
@ -109,7 +108,7 @@ struct GameInterface
|
||||||
virtual void MenuSound(EMenuSounds snd) {}
|
virtual void MenuSound(EMenuSounds snd) {}
|
||||||
virtual bool CanSave() { return true; }
|
virtual bool CanSave() { return true; }
|
||||||
virtual void CustomMenuSelection(int menu, int item) {}
|
virtual void CustomMenuSelection(int menu, int item) {}
|
||||||
virtual void StartGame(FGameStartup& gs) {}
|
virtual void StartGame(FNewGameStartup& gs) {}
|
||||||
virtual FSavegameInfo GetSaveSig() { return { "", 0, 0}; }
|
virtual FSavegameInfo GetSaveSig() { return { "", 0, 0}; }
|
||||||
virtual bool DrawSpecialScreen(const DVector2 &origin, int tilenum) { return false; }
|
virtual bool DrawSpecialScreen(const DVector2 &origin, int tilenum) { return false; }
|
||||||
virtual void DrawCenteredTextScreen(const DVector2& origin, const char* text, int position, bool withbg = true) {}
|
virtual void DrawCenteredTextScreen(const DVector2& origin, const char* text, int position, bool withbg = true) {}
|
||||||
|
|
|
@ -486,3 +486,4 @@ SoundHandle SoundRenderer::LoadSoundVoc(uint8_t *sfxdata, int length)
|
||||||
if (data) delete[] data;
|
if (data) delete[] data;
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ struct FISoundChannel
|
||||||
|
|
||||||
class SoundStream;
|
class SoundStream;
|
||||||
|
|
||||||
|
void S_SetSoundPaused(int state);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
#include "i_interface.h"
|
#include "i_interface.h"
|
||||||
|
|
||||||
|
// Some global engine variables taken out of the backend code.
|
||||||
SystemCallbacks *sysCallbacks;
|
SystemCallbacks *sysCallbacks;
|
||||||
|
double refreshfreq;
|
||||||
|
FString endoomName;
|
||||||
|
bool batchrun;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "zstring.h"
|
||||||
|
|
||||||
struct SystemCallbacks
|
struct SystemCallbacks
|
||||||
{
|
{
|
||||||
|
@ -8,6 +9,18 @@ struct SystemCallbacks
|
||||||
bool (*NetGame)();
|
bool (*NetGame)();
|
||||||
bool (*WantNativeMouse)();
|
bool (*WantNativeMouse)();
|
||||||
bool (*CaptureModeInGame)();
|
bool (*CaptureModeInGame)();
|
||||||
|
void (*CrashInfo)(char* buffer, size_t bufflen, const char* lfstr);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SystemCallbacks *sysCallbacks;
|
extern SystemCallbacks *sysCallbacks;
|
||||||
|
|
||||||
|
struct WadStuff
|
||||||
|
{
|
||||||
|
FString Path;
|
||||||
|
FString Name;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
extern FString endoomName;
|
||||||
|
extern bool batchrun;
|
||||||
|
|
22
source/common/engine/i_specialpaths.h
Normal file
22
source/common/engine/i_specialpaths.h
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "zstring.h"
|
||||||
|
|
||||||
|
#ifdef __unix__
|
||||||
|
FString GetUserFile (const char *path);
|
||||||
|
#endif
|
||||||
|
FString M_GetAppDataPath(bool create);
|
||||||
|
FString M_GetCachePath(bool create);
|
||||||
|
FString M_GetAutoexecPath();
|
||||||
|
FString M_GetConfigPath(bool for_reading);
|
||||||
|
FString M_GetScreenshotsPath();
|
||||||
|
FString M_GetSavegamesPath();
|
||||||
|
FString M_GetDocumentsPath();
|
||||||
|
FString M_GetDemoPath();
|
||||||
|
|
||||||
|
FString M_GetNormalizedPath(const char* path);
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
FString M_GetMacAppSupportPath(const bool create = true);
|
||||||
|
void M_GetMacSearchDirectories(FString& user_docs, FString& user_app_support, FString& local_app_support);
|
||||||
|
#endif // __APPLE__
|
|
@ -78,28 +78,63 @@ protected:
|
||||||
int NetMaxPos, NetCurPos;
|
int NetMaxPos, NetCurPos;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class FGraphicalStartupScreen : public FBasicStartupScreen
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FGraphicalStartupScreen(int max_progress);
|
||||||
|
~FGraphicalStartupScreen();
|
||||||
|
};
|
||||||
|
|
||||||
|
class FHereticStartupScreen : public FGraphicalStartupScreen
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FHereticStartupScreen(int max_progress, long &hr);
|
||||||
|
|
||||||
|
void Progress();
|
||||||
|
void LoadingStatus(const char *message, int colors);
|
||||||
|
void AppendStatusLine(const char *status);
|
||||||
|
protected:
|
||||||
|
void SetWindowSize();
|
||||||
|
|
||||||
|
int ThermX, ThermY, ThermWidth, ThermHeight;
|
||||||
|
int HMsgY, SMsgX;
|
||||||
|
};
|
||||||
|
|
||||||
|
class FHexenStartupScreen : public FGraphicalStartupScreen
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FHexenStartupScreen(int max_progress, long &hr);
|
||||||
|
~FHexenStartupScreen();
|
||||||
|
|
||||||
|
void Progress();
|
||||||
|
void NetProgress(int count);
|
||||||
|
void NetDone();
|
||||||
|
void SetWindowSize();
|
||||||
|
|
||||||
|
// Hexen's notch graphics, converted to chunky pixels.
|
||||||
|
uint8_t * NotchBits;
|
||||||
|
uint8_t * NetNotchBits;
|
||||||
|
};
|
||||||
|
|
||||||
|
class FStrifeStartupScreen : public FGraphicalStartupScreen
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FStrifeStartupScreen(int max_progress, long &hr);
|
||||||
|
~FStrifeStartupScreen();
|
||||||
|
|
||||||
|
void Progress();
|
||||||
|
protected:
|
||||||
|
void DrawStuff(int old_laser, int new_laser);
|
||||||
|
void SetWindowSize();
|
||||||
|
|
||||||
|
uint8_t *StartupPics[4+2+1];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern FStartupScreen *StartScreen;
|
extern FStartupScreen *StartScreen;
|
||||||
|
|
||||||
|
void DeleteStartupScreen();
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
//
|
|
||||||
// DeleteStartupScreen
|
|
||||||
//
|
|
||||||
// Makes sure the startup screen has been deleted before quitting.
|
|
||||||
//
|
|
||||||
//===========================================================================
|
|
||||||
|
|
||||||
inline void DeleteStartupScreen()
|
|
||||||
{
|
|
||||||
if (StartScreen != nullptr)
|
|
||||||
{
|
|
||||||
delete StartScreen;
|
|
||||||
StartScreen = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extern void ST_Endoom();
|
extern void ST_Endoom();
|
||||||
|
|
||||||
// The entire set of functions here uses native Windows types. These are recreations of those types so that the code doesn't need to be changed more than necessary
|
// The entire set of functions here uses native Windows types. These are recreations of those types so that the code doesn't need to be changed more than necessary
|
||||||
|
@ -134,6 +169,9 @@ struct BitmapInfo
|
||||||
RgbQuad bmiColors[1];
|
RgbQuad bmiColors[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern BitmapInfo* StartupBitmap;
|
||||||
|
|
||||||
|
|
||||||
void ST_Util_PlanarToChunky4(uint8_t* dest, const uint8_t* src, int width, int height);
|
void ST_Util_PlanarToChunky4(uint8_t* dest, const uint8_t* src, int width, int height);
|
||||||
void ST_Util_DrawBlock(BitmapInfo* bitmap_info, const uint8_t* src, int x, int y, int bytewidth, int height);
|
void ST_Util_DrawBlock(BitmapInfo* bitmap_info, const uint8_t* src, int x, int y, int bytewidth, int height);
|
||||||
void ST_Util_ClearBlock(BitmapInfo* bitmap_info, uint8_t fill, int x, int y, int bytewidth, int height);
|
void ST_Util_ClearBlock(BitmapInfo* bitmap_info, uint8_t fill, int x, int y, int bytewidth, int height);
|
||||||
|
@ -148,3 +186,22 @@ void ST_Util_DrawTextScreen(BitmapInfo* bitmap_info, const uint8_t* text_screen,
|
||||||
void ST_Util_DrawChar(BitmapInfo* screen, const uint8_t* font, int x, int y, uint8_t charnum, uint8_t attrib);
|
void ST_Util_DrawChar(BitmapInfo* screen, const uint8_t* font, int x, int y, uint8_t charnum, uint8_t attrib);
|
||||||
void ST_Util_UpdateTextBlink(BitmapInfo* bitmap_info, const uint8_t* text_screen, const uint8_t* font, bool on);
|
void ST_Util_UpdateTextBlink(BitmapInfo* bitmap_info, const uint8_t* text_screen, const uint8_t* font, bool on);
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// DeleteStartupScreen
|
||||||
|
//
|
||||||
|
// Makes sure the startup screen has been deleted before quitting.
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
inline void DeleteStartupScreen()
|
||||||
|
{
|
||||||
|
if (StartScreen != nullptr)
|
||||||
|
{
|
||||||
|
delete StartScreen;
|
||||||
|
StartScreen = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
28
source/common/engine/startupinfo.h
Normal file
28
source/common/engine/startupinfo.h
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "zstring.h"
|
||||||
|
|
||||||
|
struct FStartupInfo
|
||||||
|
{
|
||||||
|
FString Name;
|
||||||
|
uint32_t FgColor; // Foreground color for title banner
|
||||||
|
uint32_t BkColor; // Background color for title banner
|
||||||
|
FString Song;
|
||||||
|
int Type;
|
||||||
|
int LoadLights = -1;
|
||||||
|
int LoadBrightmaps = -1;
|
||||||
|
int modern = -1;
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
DefaultStartup,
|
||||||
|
DoomStartup,
|
||||||
|
HereticStartup,
|
||||||
|
HexenStartup,
|
||||||
|
StrifeStartup,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
extern FStartupInfo GameStartupInfo;
|
||||||
|
|
10
source/common/menu/menustate.h
Normal file
10
source/common/menu/menustate.h
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
enum EMenuState : int
|
||||||
|
{
|
||||||
|
MENU_Off, // Menu is closed
|
||||||
|
MENU_On, // Menu is opened
|
||||||
|
MENU_WaitKey, // Menu is opened and waiting for a key in the controls menu
|
||||||
|
MENU_OnNoPause, // Menu is opened but does not pause the game
|
||||||
|
};
|
||||||
|
extern EMenuState menuactive; // Menu overlayed?
|
|
@ -1308,14 +1308,12 @@ void C_ToggleConsole ()
|
||||||
HistPos = NULL;
|
HistPos = NULL;
|
||||||
TabbedLast = false;
|
TabbedLast = false;
|
||||||
TabbedList = false;
|
TabbedList = false;
|
||||||
mouseGrabInput(false);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else //if (gamestate != GS_FULLCONSOLE && gamestate != GS_STARTUP)
|
else //if (gamestate != GS_FULLCONSOLE && gamestate != GS_STARTUP)
|
||||||
{
|
{
|
||||||
ConsoleState = c_rising;
|
ConsoleState = c_rising;
|
||||||
C_FlushDisplay ();
|
C_FlushDisplay ();
|
||||||
mouseGrabInput(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ void D_PostEvent (const event_t *ev)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ev->type == EV_Mouse && GUICapture == 0)
|
if (ev->type == EV_Mouse && !System_WantGuiCapture())
|
||||||
{
|
{
|
||||||
inputState.MouseAddToPos(ev->x, -ev->y);
|
inputState.MouseAddToPos(ev->x, -ev->y);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -61,12 +61,30 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "gamestate.h"
|
#include "gamestate.h"
|
||||||
#include "gstrings.h"
|
#include "gstrings.h"
|
||||||
#include "texturemanager.h"
|
#include "texturemanager.h"
|
||||||
|
#include "i_interface.h"
|
||||||
|
#include "x86.h"
|
||||||
|
#include "startupinfo.h"
|
||||||
|
|
||||||
|
CVAR(Bool, autoloadlights, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
|
CVAR(Bool, autoloadbrightmaps, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
|
|
||||||
CUSTOM_CVAR(String, language, "auto", CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
|
CUSTOM_CVAR(String, language, "auto", CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
|
||||||
{
|
{
|
||||||
GStrings.UpdateLanguage(self);
|
GStrings.UpdateLanguage(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CUSTOM_CVAR(Int, mouse_capturemode, 1, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
|
||||||
|
{
|
||||||
|
if (self < 0)
|
||||||
|
{
|
||||||
|
self = 0;
|
||||||
|
}
|
||||||
|
else if (self > 2)
|
||||||
|
{
|
||||||
|
self = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// The last remains of sdlayer.cpp
|
// The last remains of sdlayer.cpp
|
||||||
double g_beforeSwapTime;
|
double g_beforeSwapTime;
|
||||||
GameInterface* gi;
|
GameInterface* gi;
|
||||||
|
@ -85,7 +103,7 @@ gamestate_t gamestate = GS_STARTUP;
|
||||||
|
|
||||||
FILE* hashfile;
|
FILE* hashfile;
|
||||||
|
|
||||||
FStartupInfo RazeStartupInfo;
|
FStartupInfo GameStartupInfo;
|
||||||
FMemArena dump; // this is for memory blocks than cannot be deallocated without some huge effort. Put them in here so that they do not register on shutdown.
|
FMemArena dump; // this is for memory blocks than cannot be deallocated without some huge effort. Put them in here so that they do not register on shutdown.
|
||||||
|
|
||||||
void C_CON_SetAliases();
|
void C_CON_SetAliases();
|
||||||
|
@ -134,22 +152,73 @@ static StringtableCallbacks stblcb =
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
bool System_WantGuiCapture()
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
bool grab_mouse;
|
|
||||||
|
|
||||||
void mouseGrabInput(bool grab)
|
|
||||||
{
|
{
|
||||||
grab_mouse = grab;
|
bool wantCapt;
|
||||||
if (grab) GUICapture &= ~1;
|
|
||||||
else GUICapture |= 1;
|
if (menuactive == MENU_Off)
|
||||||
|
{
|
||||||
|
wantCapt = ConsoleState == c_down || ConsoleState == c_falling || chatmodeon;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wantCapt = (menuactive == MENU_On || menuactive == MENU_OnNoPause);
|
||||||
|
}
|
||||||
|
return wantCapt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool System_WantLeftButton()
|
||||||
|
{
|
||||||
|
return false;// (gamestate == GS_DEMOSCREEN || gamestate == GS_TITLELEVEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool System_NetGame()
|
||||||
|
{
|
||||||
|
return false; // fixme later. For now there is no netgame support.
|
||||||
|
}
|
||||||
|
|
||||||
|
bool System_WantNativeMouse()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool System_CaptureModeInGame()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// DoomSpecificInfo
|
||||||
|
//
|
||||||
|
// Called by the crash logger to get application-specific information.
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
void System_CrashInfo(char* buffer, size_t bufflen, const char *lfstr)
|
||||||
|
{
|
||||||
|
const char* arg;
|
||||||
|
char* const buffend = buffer + bufflen - 2; // -2 for CRLF at end
|
||||||
|
int i;
|
||||||
|
|
||||||
|
buffer += mysnprintf(buffer, buffend - buffer, GAMENAME " version %s (%s)", GetVersionString(), GetGitHash());
|
||||||
|
|
||||||
|
buffer += snprintf(buffer, buffend - buffer, "%sCommand line:", lfstr);
|
||||||
|
for (i = 0; i < Args->NumArgs(); ++i)
|
||||||
|
{
|
||||||
|
buffer += snprintf(buffer, buffend - buffer, " %s", Args->GetArg(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; (arg = fileSystem.GetResourceFileName(i)) != NULL; ++i)
|
||||||
|
{
|
||||||
|
buffer += mysnprintf(buffer, buffend - buffer, "%sFile %d: %s", lfstr, i, arg);
|
||||||
|
}
|
||||||
|
buffer += mysnprintf(buffer, buffend - buffer, "%s", lfstr);
|
||||||
|
*buffer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -373,11 +442,11 @@ void CheckFrontend(int flags)
|
||||||
{
|
{
|
||||||
gi = Powerslave::CreateInterface();
|
gi = Powerslave::CreateInterface();
|
||||||
}
|
}
|
||||||
else if ((flags & GAMEFLAG_FURY) || RazeStartupInfo.modern > 0)
|
else if ((flags & GAMEFLAG_FURY) || GameStartupInfo.modern > 0)
|
||||||
{
|
{
|
||||||
gi = Duke::CreateInterface();
|
gi = Duke::CreateInterface();
|
||||||
}
|
}
|
||||||
else if (RazeStartupInfo.modern < 0)
|
else if (GameStartupInfo.modern < 0)
|
||||||
{
|
{
|
||||||
gi = Redneck::CreateInterface();
|
gi = Redneck::CreateInterface();
|
||||||
}
|
}
|
||||||
|
@ -395,6 +464,17 @@ int RunGame();
|
||||||
int GameMain()
|
int GameMain()
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
static SystemCallbacks syscb =
|
||||||
|
{
|
||||||
|
System_WantGuiCapture,
|
||||||
|
System_WantLeftButton,
|
||||||
|
System_NetGame,
|
||||||
|
System_WantNativeMouse,
|
||||||
|
System_CaptureModeInGame,
|
||||||
|
};
|
||||||
|
sysCallbacks = &syscb;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
r = RunGame();
|
r = RunGame();
|
||||||
|
@ -576,7 +656,7 @@ static TArray<GrpEntry> SetupGame()
|
||||||
if (groupno == -1) return TArray<GrpEntry>();
|
if (groupno == -1) return TArray<GrpEntry>();
|
||||||
auto& group = groups[groupno];
|
auto& group = groups[groupno];
|
||||||
|
|
||||||
if (RazeStartupInfo.Name.IsNotEmpty()) I_SetWindowTitle(RazeStartupInfo.Name);
|
if (GameStartupInfo.Name.IsNotEmpty()) I_SetWindowTitle(GameStartupInfo.Name);
|
||||||
else I_SetWindowTitle(group.FileInfo.name);
|
else I_SetWindowTitle(group.FileInfo.name);
|
||||||
|
|
||||||
// Now filter out the data we actually need and delete the rest.
|
// Now filter out the data we actually need and delete the rest.
|
||||||
|
@ -682,7 +762,11 @@ int RunGame()
|
||||||
V_InitFontColors();
|
V_InitFontColors();
|
||||||
GStrings.LoadStrings(language);
|
GStrings.LoadStrings(language);
|
||||||
|
|
||||||
I_Init();
|
CheckCPUID(&CPU);
|
||||||
|
CalculateCPUSpeed();
|
||||||
|
auto ci = DumpCPUInfo(&CPU);
|
||||||
|
Printf("%s", ci.GetChars());
|
||||||
|
|
||||||
V_InitScreenSize();
|
V_InitScreenSize();
|
||||||
V_InitScreen();
|
V_InitScreen();
|
||||||
StartScreen = FStartupScreen::CreateInstance(100);
|
StartScreen = FStartupScreen::CreateInstance(100);
|
||||||
|
@ -734,8 +818,6 @@ int RunGame()
|
||||||
I_FatalError("app_main: There was a problem initializing the Build engine: %s\n", engineerrstr);
|
I_FatalError("app_main: There was a problem initializing the Build engine: %s\n", engineerrstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
mouseGrabInput(true); // the intros require the mouse to be grabbed.
|
|
||||||
|
|
||||||
auto exec = C_ParseCmdLineParams(nullptr);
|
auto exec = C_ParseCmdLineParams(nullptr);
|
||||||
if (exec) exec->ExecCommands();
|
if (exec) exec->ExecCommands();
|
||||||
|
|
||||||
|
@ -748,7 +830,6 @@ void G_FatalEngineError(void)
|
||||||
I_FatalError("There was a problem initializing the engine: %s\n\nThe application will now close.", engineerrstr);
|
I_FatalError("There was a problem initializing the engine: %s\n\nThe application will now close.", engineerrstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
extern FString currentGame;
|
extern FString currentGame;
|
||||||
extern FString LumpFilter;
|
extern FString LumpFilter;
|
||||||
class FArgs;
|
class FArgs;
|
||||||
|
extern bool GUICapture;
|
||||||
|
|
||||||
extern FMemArena dump; // this is for memory blocks than cannot be deallocated without some huge effort. Put them in here so that they do not register on shutdown.
|
extern FMemArena dump; // this is for memory blocks than cannot be deallocated without some huge effort. Put them in here so that they do not register on shutdown.
|
||||||
|
|
||||||
|
@ -135,12 +136,6 @@ struct GrpInfo
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct WadStuff
|
|
||||||
{
|
|
||||||
FString Path;
|
|
||||||
FString Name;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct GrpEntry
|
struct GrpEntry
|
||||||
{
|
{
|
||||||
FString FileName;
|
FString FileName;
|
||||||
|
@ -154,28 +149,12 @@ const char* G_DefaultConFile(void);
|
||||||
const char* G_ConFile(void);
|
const char* G_ConFile(void);
|
||||||
|
|
||||||
TArray<GrpEntry> GrpScan();
|
TArray<GrpEntry> GrpScan();
|
||||||
void S_SetSoundPaused(int state);
|
|
||||||
|
|
||||||
void G_FatalEngineError(void);
|
void G_FatalEngineError(void);
|
||||||
int CalcSmoothRatio(const ClockTicks& totalclk, const ClockTicks& ototalclk, int realgameticspersec);
|
int CalcSmoothRatio(const ClockTicks& totalclk, const ClockTicks& ototalclk, int realgameticspersec);
|
||||||
|
|
||||||
FString G_GetDemoPath();
|
FString G_GetDemoPath();
|
||||||
|
|
||||||
|
|
||||||
struct FStartupInfo
|
|
||||||
{
|
|
||||||
FString Name;
|
|
||||||
uint32_t FgColor; // Foreground color for title banner
|
|
||||||
uint32_t BkColor; // Background color for title banner
|
|
||||||
int modern;
|
|
||||||
//FString Song;
|
|
||||||
//int Type;
|
|
||||||
//int LoadLights = -1;
|
|
||||||
//int LoadBrightmaps = -1;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern FStartupInfo RazeStartupInfo;
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PAUSESFX_MENU = 1,
|
PAUSESFX_MENU = 1,
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
FString GetUserFile (const char *path);
|
FString GetUserFile (const char *path);
|
||||||
#endif
|
#endif
|
||||||
FString M_GetAppDataPath(bool create);
|
FString M_GetAppDataPath(bool create);
|
||||||
|
FString M_GetCachePath(bool create);
|
||||||
FString M_GetAutoexecPath();
|
FString M_GetAutoexecPath();
|
||||||
FString M_GetConfigPath(bool for_reading);
|
FString M_GetConfigPath(bool for_reading);
|
||||||
FString M_GetScreenshotsPath();
|
FString M_GetScreenshotsPath();
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#include "v_text.h"
|
#include "v_text.h"
|
||||||
#include "findfile.h"
|
#include "findfile.h"
|
||||||
#include "palutil.h"
|
#include "palutil.h"
|
||||||
|
#include "startupinfo.h"
|
||||||
|
|
||||||
#ifndef PATH_MAX
|
#ifndef PATH_MAX
|
||||||
#define PATH_MAX 260
|
#define PATH_MAX 260
|
||||||
|
@ -111,20 +112,20 @@ static FString ParseGameInfo(TArray<FString>& pwads, const char* fn, const char*
|
||||||
else if (!nextKey.CompareNoCase("STARTUPTITLE"))
|
else if (!nextKey.CompareNoCase("STARTUPTITLE"))
|
||||||
{
|
{
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
RazeStartupInfo.Name = sc.String;
|
GameStartupInfo.Name = sc.String;
|
||||||
}
|
}
|
||||||
else if (!nextKey.CompareNoCase("STARTUPCOLORS"))
|
else if (!nextKey.CompareNoCase("STARTUPCOLORS"))
|
||||||
{
|
{
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
RazeStartupInfo.FgColor = V_GetColor(NULL, sc);
|
GameStartupInfo.FgColor = V_GetColor(NULL, sc);
|
||||||
sc.MustGetStringName(",");
|
sc.MustGetStringName(",");
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
RazeStartupInfo.BkColor = V_GetColor(NULL, sc);
|
GameStartupInfo.BkColor = V_GetColor(NULL, sc);
|
||||||
}
|
}
|
||||||
else if (!nextKey.CompareNoCase("MODERN"))
|
else if (!nextKey.CompareNoCase("MODERN"))
|
||||||
{
|
{
|
||||||
sc.MustGetNumber();
|
sc.MustGetNumber();
|
||||||
RazeStartupInfo.modern = sc.Number ? 1 : -1;
|
GameStartupInfo.modern = sc.Number ? 1 : -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,13 +32,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "inputstate.h"
|
#include "inputstate.h"
|
||||||
|
#include "i_system.h"
|
||||||
#include "v_draw.h"
|
#include "v_draw.h"
|
||||||
#include "build.h"
|
#include "build.h"
|
||||||
#include "gamecvars.h"
|
#include "gamecvars.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
|
|
||||||
int GUICapture = false;
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -172,6 +171,7 @@ int32_t handleevents(void)
|
||||||
D_PostEvent(&ev);
|
D_PostEvent(&ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
I_StartFrame();
|
||||||
I_StartTic();
|
I_StartTic();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
#include "gamecvars.h"
|
#include "gamecvars.h"
|
||||||
|
|
||||||
typedef uint16_t kb_scancode;
|
typedef uint16_t kb_scancode;
|
||||||
extern int GUICapture;
|
|
||||||
|
|
||||||
// This encapsulates the entire game-readable input state which previously was spread out across several files.
|
// This encapsulates the entire game-readable input state which previously was spread out across several files.
|
||||||
|
|
||||||
struct ControlInfo
|
struct ControlInfo
|
||||||
|
|
|
@ -88,7 +88,7 @@ TArray<MenuClassDescriptor*> menuClasses(TArray<MenuClassDescriptor*>::ENoInit(0
|
||||||
DMenu *DMenu::CurrentMenu;
|
DMenu *DMenu::CurrentMenu;
|
||||||
int DMenu::MenuTime;
|
int DMenu::MenuTime;
|
||||||
|
|
||||||
FGameStartup GameStartupInfo;
|
FNewGameStartup NewGameStartupInfo;
|
||||||
EMenuState menuactive;
|
EMenuState menuactive;
|
||||||
bool M_DemoNoPlay;
|
bool M_DemoNoPlay;
|
||||||
FButtonStatus MenuButtons[NUM_MKEYS];
|
FButtonStatus MenuButtons[NUM_MKEYS];
|
||||||
|
@ -384,7 +384,6 @@ void M_StartControlPanel (bool makeSound)
|
||||||
}
|
}
|
||||||
|
|
||||||
C_HideConsole (); // [RH] Make sure console goes bye bye.
|
C_HideConsole (); // [RH] Make sure console goes bye bye.
|
||||||
mouseGrabInput(false);
|
|
||||||
menuactive = MENU_On;
|
menuactive = MENU_On;
|
||||||
// Pause sound effects before we play the menu switch sound.
|
// Pause sound effects before we play the menu switch sound.
|
||||||
// That way, it won't be paused.
|
// That way, it won't be paused.
|
||||||
|
@ -431,7 +430,7 @@ bool M_SetMenu(FName menu, int param, FName caller)
|
||||||
#if 0
|
#if 0
|
||||||
// skip the menu and go right into the first level.
|
// skip the menu and go right into the first level.
|
||||||
// For tracking memory leaks that normally require operating the menu to start the game so that they always get the same allocation number.
|
// For tracking memory leaks that normally require operating the menu to start the game so that they always get the same allocation number.
|
||||||
GameStartupInfo.Episode = GameStartupInfo.Skill = 0;
|
NewGameStartupInfo.Episode = NewGameStartupInfo.Skill = 0;
|
||||||
menu = NAME_Startgame;
|
menu = NAME_Startgame;
|
||||||
#endif
|
#endif
|
||||||
if (DrawBackground == -1)
|
if (DrawBackground == -1)
|
||||||
|
@ -446,22 +445,22 @@ bool M_SetMenu(FName menu, int param, FName caller)
|
||||||
case NAME_HuntMenu:
|
case NAME_HuntMenu:
|
||||||
case NAME_TargetMenu:
|
case NAME_TargetMenu:
|
||||||
// sent from the episode menu
|
// sent from the episode menu
|
||||||
GameStartupInfo.Episode = param;
|
NewGameStartupInfo.Episode = param;
|
||||||
GameStartupInfo.Level = 0;
|
NewGameStartupInfo.Level = 0;
|
||||||
GameStartupInfo.CustomLevel1 = GameStartupInfo.CustomLevel2 = -1;
|
NewGameStartupInfo.CustomLevel1 = NewGameStartupInfo.CustomLevel2 = -1;
|
||||||
GameStartupInfo.Skill = gDefaultSkill;
|
NewGameStartupInfo.Skill = gDefaultSkill;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_WeaponMenu:
|
case NAME_WeaponMenu:
|
||||||
GameStartupInfo.Skill = param;
|
NewGameStartupInfo.Skill = param;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_CustomGameMenu:
|
case NAME_CustomGameMenu:
|
||||||
GameStartupInfo.CustomLevel1 = param;
|
NewGameStartupInfo.CustomLevel1 = param;
|
||||||
GameStartupInfo.CustomLevel2 = -1;
|
NewGameStartupInfo.CustomLevel2 = -1;
|
||||||
GameStartupInfo.Episode = 0; // Set start to E1L1 so that even if the script fails to set the starting level it is set to something valid.
|
NewGameStartupInfo.Episode = 0; // Set start to E1L1 so that even if the script fails to set the starting level it is set to something valid.
|
||||||
GameStartupInfo.Level = 0;
|
NewGameStartupInfo.Level = 0;
|
||||||
GameStartupInfo.Skill = gDefaultSkill;
|
NewGameStartupInfo.Skill = gDefaultSkill;
|
||||||
gi->CustomMenuSelection(param, -1);
|
gi->CustomMenuSelection(param, -1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -472,12 +471,12 @@ bool M_SetMenu(FName menu, int param, FName caller)
|
||||||
case NAME_CustomSubMenu5:
|
case NAME_CustomSubMenu5:
|
||||||
case NAME_CustomSubMenu6:
|
case NAME_CustomSubMenu6:
|
||||||
case NAME_CustomSubMenu7:
|
case NAME_CustomSubMenu7:
|
||||||
GameStartupInfo.CustomLevel2 = param;
|
NewGameStartupInfo.CustomLevel2 = param;
|
||||||
gi->CustomMenuSelection(GameStartupInfo.CustomLevel1, param);
|
gi->CustomMenuSelection(NewGameStartupInfo.CustomLevel1, param);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_Skillmenu:
|
case NAME_Skillmenu:
|
||||||
GameStartupInfo.Skill = param;
|
NewGameStartupInfo.Skill = param;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NAME_EngineCredits:
|
case NAME_EngineCredits:
|
||||||
|
@ -495,11 +494,11 @@ bool M_SetMenu(FName menu, int param, FName caller)
|
||||||
{
|
{
|
||||||
case NAME_Startgame:
|
case NAME_Startgame:
|
||||||
M_ClearMenus(); // must be done before starting the level.
|
M_ClearMenus(); // must be done before starting the level.
|
||||||
if (caller == NAME_Mainmenu || caller == NAME_IngameMenu) GameStartupInfo.Episode = param;
|
if (caller == NAME_Mainmenu || caller == NAME_IngameMenu) NewGameStartupInfo.Episode = param;
|
||||||
STAT_StartNewGame(gVolumeNames[GameStartupInfo.Episode], GameStartupInfo.Skill);
|
STAT_StartNewGame(gVolumeNames[NewGameStartupInfo.Episode], NewGameStartupInfo.Skill);
|
||||||
inputState.ClearAllInput();
|
inputState.ClearAllInput();
|
||||||
|
|
||||||
gi->StartGame(GameStartupInfo);
|
gi->StartGame(NewGameStartupInfo);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case NAME_CustomSubMenu1:
|
case NAME_CustomSubMenu1:
|
||||||
|
@ -510,7 +509,7 @@ bool M_SetMenu(FName menu, int param, FName caller)
|
||||||
case NAME_StartgameConfirm:
|
case NAME_StartgameConfirm:
|
||||||
{
|
{
|
||||||
// sent from the skill menu for a skill that needs to be confirmed
|
// sent from the skill menu for a skill that needs to be confirmed
|
||||||
GameStartupInfo.Skill = param;
|
NewGameStartupInfo.Skill = param;
|
||||||
|
|
||||||
const char *msg = AllSkills[param].MustConfirmText;
|
const char *msg = AllSkills[param].MustConfirmText;
|
||||||
if (*msg==0) msg = GStrings("NIGHTMARE");
|
if (*msg==0) msg = GStrings("NIGHTMARE");
|
||||||
|
@ -968,7 +967,6 @@ void M_ClearMenus (bool final)
|
||||||
M_UnpauseSound();
|
M_UnpauseSound();
|
||||||
if (!final)
|
if (!final)
|
||||||
{
|
{
|
||||||
mouseGrabInput(true);
|
|
||||||
gi->MenuClosed();
|
gi->MenuClosed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,7 @@ enum ENativeFontValues
|
||||||
// positive values for color are direct palswap indices.
|
// positive values for color are direct palswap indices.
|
||||||
};
|
};
|
||||||
|
|
||||||
extern FGameStartup GameStartupInfo;
|
extern FNewGameStartup NewGameStartupInfo;
|
||||||
extern EMenuState menuactive;
|
extern EMenuState menuactive;
|
||||||
|
|
||||||
|
|
||||||
|
@ -752,7 +752,7 @@ void M_CreateMenus();
|
||||||
void M_ActivateMenu(DMenu *menu);
|
void M_ActivateMenu(DMenu *menu);
|
||||||
void M_ClearMenus (bool final = false);
|
void M_ClearMenus (bool final = false);
|
||||||
void M_ParseMenuDefs();
|
void M_ParseMenuDefs();
|
||||||
void M_StartupSkillMenu(FGameStartup *gs);
|
void M_StartupSkillMenu(FNewGameStartup *gs);
|
||||||
int M_GetDefaultSkill();
|
int M_GetDefaultSkill();
|
||||||
void M_StartControlPanel (bool makeSound);
|
void M_StartControlPanel (bool makeSound);
|
||||||
bool M_SetMenu(FName menu, int param = -1, FName callingMenu = NAME_None);
|
bool M_SetMenu(FName menu, int param = -1, FName callingMenu = NAME_None);
|
||||||
|
|
|
@ -373,7 +373,6 @@ public:
|
||||||
pKey = keyptr;
|
pKey = keyptr;
|
||||||
SetMenuMessage(1);
|
SetMenuMessage(1);
|
||||||
menuactive = MENU_WaitKey; // There should be a better way to disable GUI capture...
|
menuactive = MENU_WaitKey; // There should be a better way to disable GUI capture...
|
||||||
mouseGrabInput(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TranslateKeyboardEvents() override
|
bool TranslateKeyboardEvents() override
|
||||||
|
@ -400,7 +399,6 @@ public:
|
||||||
{
|
{
|
||||||
*pKey = ev->data1;
|
*pKey = ev->data1;
|
||||||
menuactive = MENU_On;
|
menuactive = MENU_On;
|
||||||
mouseGrabInput(false);
|
|
||||||
SetMenuMessage(0);
|
SetMenuMessage(0);
|
||||||
auto p = mParentMenu;
|
auto p = mParentMenu;
|
||||||
Close();
|
Close();
|
||||||
|
|
|
@ -514,7 +514,7 @@ void GameInterface::CustomMenuSelection(int menu, int item)
|
||||||
VM_OnEventWithReturn(EVENT_NEWGAMECUSTOM, -1, myconnectindex, menu);
|
VM_OnEventWithReturn(EVENT_NEWGAMECUSTOM, -1, myconnectindex, menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameInterface::StartGame(FGameStartup& gs)
|
void GameInterface::StartGame(FNewGameStartup& gs)
|
||||||
{
|
{
|
||||||
int32_t skillsound = PISTOL_BODYHIT;
|
int32_t skillsound = PISTOL_BODYHIT;
|
||||||
|
|
||||||
|
|
|
@ -233,7 +233,7 @@ struct GameInterface : ::GameInterface
|
||||||
void MenuSound(EMenuSounds snd) override;
|
void MenuSound(EMenuSounds snd) override;
|
||||||
bool CanSave() override;
|
bool CanSave() override;
|
||||||
void CustomMenuSelection(int menu, int item) override;
|
void CustomMenuSelection(int menu, int item) override;
|
||||||
void StartGame(FGameStartup& gs) override;
|
void StartGame(FNewGameStartup& gs) override;
|
||||||
FSavegameInfo GetSaveSig() override;
|
FSavegameInfo GetSaveSig() override;
|
||||||
bool DrawSpecialScreen(const DVector2 &origin, int tilenum) override;
|
bool DrawSpecialScreen(const DVector2 &origin, int tilenum) override;
|
||||||
void DrawCenteredTextScreen(const DVector2 &origin, const char *text, int position, bool bg) override;
|
void DrawCenteredTextScreen(const DVector2 &origin, const char *text, int position, bool bg) override;
|
||||||
|
|
|
@ -5945,7 +5945,7 @@ MAIN_LOOP_RESTART:
|
||||||
|
|
||||||
localInput = {};
|
localInput = {};
|
||||||
|
|
||||||
if (((myplayer.gm & MODE_MENU) != MODE_MENU || ud.recstat == 2 || (g_netServer || ud.multimode > 1))
|
if ((!System_WantGuiCapture() || ud.recstat == 2 || (g_netServer || ud.multimode > 1))
|
||||||
&& (myplayer.gm & MODE_GAME))
|
&& (myplayer.gm & MODE_GAME))
|
||||||
{
|
{
|
||||||
Net_GetPackets();
|
Net_GetPackets();
|
||||||
|
|
|
@ -1633,8 +1633,8 @@ void __fastcall VM_SetUserdef(int const labelNum, int const lParm2, int32_t cons
|
||||||
case USERDEFS_M_FFIRE: m_ffire = iSet; break;
|
case USERDEFS_M_FFIRE: m_ffire = iSet; break;
|
||||||
case USERDEFS_FFIRE: ud.ffire = iSet; break;
|
case USERDEFS_FFIRE: ud.ffire = iSet; break;
|
||||||
case USERDEFS_M_PLAYER_SKILL: ud.m_player_skill = iSet; break;
|
case USERDEFS_M_PLAYER_SKILL: ud.m_player_skill = iSet; break;
|
||||||
case USERDEFS_M_LEVEL_NUMBER: GameStartupInfo.Level = m_level_number = iSet; break;
|
case USERDEFS_M_LEVEL_NUMBER: NewGameStartupInfo.Level = m_level_number = iSet; break;
|
||||||
case USERDEFS_M_VOLUME_NUMBER: GameStartupInfo.Episode = ud.m_volume_number = iSet; break;
|
case USERDEFS_M_VOLUME_NUMBER: NewGameStartupInfo.Episode = ud.m_volume_number = iSet; break;
|
||||||
case USERDEFS_MULTIMODE: ud.multimode = iSet; break;
|
case USERDEFS_MULTIMODE: ud.multimode = iSet; break;
|
||||||
case USERDEFS_PLAYER_SKILL: ud.player_skill = iSet; break;
|
case USERDEFS_PLAYER_SKILL: ud.player_skill = iSet; break;
|
||||||
case USERDEFS_LEVEL_NUMBER: ud.level_number = iSet; break;
|
case USERDEFS_LEVEL_NUMBER: ud.level_number = iSet; break;
|
||||||
|
|
|
@ -187,7 +187,7 @@ void GameInterface::MenuClosed()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GameInterface::StartGame(FGameStartup& gs)
|
void GameInterface::StartGame(FNewGameStartup& gs)
|
||||||
{
|
{
|
||||||
MenuExitCondition = gs.Episode; // Gross hack. The main loop needs to be redone for better handling.
|
MenuExitCondition = gs.Episode; // Gross hack. The main loop needs to be redone for better handling.
|
||||||
}
|
}
|
||||||
|
|
|
@ -2332,7 +2332,7 @@ GAMELOOP:
|
||||||
{
|
{
|
||||||
bInMove = kTrue;
|
bInMove = kTrue;
|
||||||
|
|
||||||
if (M_Active() || GUICapture || bPause)
|
if (System_WantGuiCapture() || bPause)
|
||||||
{
|
{
|
||||||
tclocks = totalclock - 4;
|
tclocks = totalclock - 4;
|
||||||
buttonMap.ResetButtonStates();
|
buttonMap.ResetButtonStates();
|
||||||
|
|
|
@ -345,7 +345,7 @@ struct GameInterface : ::GameInterface
|
||||||
void MenuOpened() override;
|
void MenuOpened() override;
|
||||||
void MenuSound(EMenuSounds snd) override;
|
void MenuSound(EMenuSounds snd) override;
|
||||||
void MenuClosed() override;
|
void MenuClosed() override;
|
||||||
void StartGame(FGameStartup& gs) override;
|
void StartGame(FNewGameStartup& gs) override;
|
||||||
FSavegameInfo GetSaveSig() override;
|
FSavegameInfo GetSaveSig() override;
|
||||||
void DrawCenteredTextScreen(const DVector2& origin, const char* text, int position, bool bg) override;
|
void DrawCenteredTextScreen(const DVector2& origin, const char* text, int position, bool bg) override;
|
||||||
void DrawMenuCaption(const DVector2& origin, const char* text) override;
|
void DrawMenuCaption(const DVector2& origin, const char* text) override;
|
||||||
|
|
|
@ -43,7 +43,9 @@
|
||||||
#include "d_gui.h"
|
#include "d_gui.h"
|
||||||
#include "dikeys.h"
|
#include "dikeys.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "menu/menu.h"
|
#include "i_interface.h"
|
||||||
|
#include "menustate.h"
|
||||||
|
#include "engineerrors.h"
|
||||||
|
|
||||||
|
|
||||||
EXTERN_CVAR(Int, m_use_mouse)
|
EXTERN_CVAR(Int, m_use_mouse)
|
||||||
|
@ -54,22 +56,11 @@ CVAR(Bool, m_filter, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
|
|
||||||
CVAR(Bool, k_allowfullscreentoggle, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
CVAR(Bool, k_allowfullscreentoggle, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
|
|
||||||
CUSTOM_CVAR(Int, mouse_capturemode, 1, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
|
|
||||||
{
|
|
||||||
if (self < 0)
|
|
||||||
{
|
|
||||||
self = 0;
|
|
||||||
}
|
|
||||||
else if (self > 2)
|
|
||||||
{
|
|
||||||
self = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extern int paused, chatmodeon;
|
extern int paused, chatmodeon;
|
||||||
extern constate_e ConsoleState;
|
extern constate_e ConsoleState;
|
||||||
extern bool ToggleFullscreen;
|
extern bool ToggleFullscreen;
|
||||||
|
bool GUICapture;
|
||||||
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -81,21 +72,20 @@ size_t s_skipMouseMoves;
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
void CheckGUICapture()
|
void CheckGUICapture()
|
||||||
{
|
{
|
||||||
bool wantCapture = (MENU_Off == menuactive)
|
bool wantCapt = sysCallbacks && sysCallbacks->WantGuiCapture && sysCallbacks->WantGuiCapture();
|
||||||
? (c_down == ConsoleState || c_falling == ConsoleState || chatmodeon)
|
|
||||||
: (MENU_On == menuactive || MENU_OnNoPause == menuactive);
|
|
||||||
|
|
||||||
if (wantCapture != GUICapture)
|
if (wantCapt != GUICapture)
|
||||||
{
|
{
|
||||||
GUICapture = wantCapture;
|
GUICapture = wantCapt;
|
||||||
|
if (wantCapt)
|
||||||
ResetButtonStates();
|
{
|
||||||
|
buttonMap.ResetButtonStates();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void SetCursorPosition(const NSPoint position)
|
void SetCursorPosition(const NSPoint position)
|
||||||
{
|
{
|
||||||
|
@ -143,14 +133,9 @@ void CenterCursor()
|
||||||
SetCursorPosition(centerPoint);
|
SetCursorPosition(centerPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsInGame()
|
|
||||||
{
|
|
||||||
return gi->CanSave();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckNativeMouse()
|
void CheckNativeMouse()
|
||||||
{
|
{
|
||||||
const bool windowed = !vid_fullscreen;
|
const bool windowed = (NULL == screen) || !screen->IsFullscreen();
|
||||||
bool wantNative;
|
bool wantNative;
|
||||||
|
|
||||||
if (windowed)
|
if (windowed)
|
||||||
|
@ -165,8 +150,9 @@ void CheckNativeMouse()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
bool captureModeInGame = sysCallbacks && sysCallbacks->CaptureModeInGame && sysCallbacks->CaptureModeInGame();
|
||||||
wantNative = (!m_use_mouse || MENU_WaitKey != menuactive)
|
wantNative = (!m_use_mouse || MENU_WaitKey != menuactive)
|
||||||
&& (!IsInGame() || GUICapture /*|| paused*/);
|
&& (!captureModeInGame || GUICapture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -176,6 +162,9 @@ void CheckNativeMouse()
|
||||||
&& (MENU_On == menuactive || MENU_OnNoPause == menuactive);
|
&& (MENU_On == menuactive || MENU_OnNoPause == menuactive);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!wantNative && sysCallbacks && sysCallbacks->WantNativeMouse && sysCallbacks->WantNativeMouse())
|
||||||
|
wantNative = true;
|
||||||
|
|
||||||
I_SetNativeMouse(wantNative);
|
I_SetNativeMouse(wantNative);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +178,7 @@ void I_GetEvent()
|
||||||
|
|
||||||
void I_StartTic()
|
void I_StartTic()
|
||||||
{
|
{
|
||||||
//CheckGUICapture();
|
CheckGUICapture();
|
||||||
CheckNativeMouse();
|
CheckNativeMouse();
|
||||||
|
|
||||||
I_ProcessJoysticks();
|
I_ProcessJoysticks();
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "printf.h"
|
#include "printf.h"
|
||||||
#include "s_music.h"
|
#include "s_music.h"
|
||||||
#include "gamecontrol.h"
|
#include "engineerrors.h"
|
||||||
|
|
||||||
|
|
||||||
#define ZD_UNUSED(VARIABLE) ((void)(VARIABLE))
|
#define ZD_UNUSED(VARIABLE) ((void)(VARIABLE))
|
||||||
|
@ -59,7 +59,7 @@ EXTERN_CVAR(Int, vid_defwidth )
|
||||||
EXTERN_CVAR(Int, vid_defheight)
|
EXTERN_CVAR(Int, vid_defheight)
|
||||||
EXTERN_CVAR(Bool, vid_vsync )
|
EXTERN_CVAR(Bool, vid_vsync )
|
||||||
|
|
||||||
|
int GameMain();
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,8 +103,6 @@ void I_DetectOS()
|
||||||
|
|
||||||
if (10 == version.majorVersion) switch (version.minorVersion)
|
if (10 == version.majorVersion) switch (version.minorVersion)
|
||||||
{
|
{
|
||||||
case 7: name = "Mac OS X Lion"; break;
|
|
||||||
case 8: name = "OS X Mountain Lion"; break;
|
|
||||||
case 9: name = "OS X Mavericks"; break;
|
case 9: name = "OS X Mavericks"; break;
|
||||||
case 10: name = "OS X Yosemite"; break;
|
case 10: name = "OS X Yosemite"; break;
|
||||||
case 11: name = "OS X El Capitan"; break;
|
case 11: name = "OS X El Capitan"; break;
|
||||||
|
@ -139,8 +137,6 @@ void I_DetectOS()
|
||||||
|
|
||||||
FArgs* Args; // command line arguments
|
FArgs* Args; // command line arguments
|
||||||
|
|
||||||
double refreshfreq;
|
|
||||||
bool batchrun;
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,18 +36,14 @@
|
||||||
#include <fnmatch.h>
|
#include <fnmatch.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
|
|
||||||
#include "gameconfigfile.h"
|
|
||||||
#include "i_sound.h"
|
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "st_console.h"
|
#include "st_console.h"
|
||||||
#include "v_text.h"
|
#include "v_text.h"
|
||||||
#include "cmdlib.h"
|
|
||||||
#include "printf.h"
|
|
||||||
|
|
||||||
|
|
||||||
double PerfToSec, PerfToMillisec;
|
double PerfToSec, PerfToMillisec;
|
||||||
|
|
||||||
static void CalculateCPUSpeed()
|
void CalculateCPUSpeed()
|
||||||
{
|
{
|
||||||
long long frequency;
|
long long frequency;
|
||||||
size_t size = sizeof frequency;
|
size_t size = sizeof frequency;
|
||||||
|
@ -64,10 +60,6 @@ static void CalculateCPUSpeed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_Init(void)
|
|
||||||
{
|
|
||||||
CalculateCPUSpeed();
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_SetIWADInfo()
|
void I_SetIWADInfo()
|
||||||
{
|
{
|
||||||
|
@ -147,13 +139,6 @@ int I_PickIWad(WadStuff* const wads, const int numwads, const bool showwin, cons
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool I_WriteIniFailed()
|
|
||||||
{
|
|
||||||
printf("The config file %s could not be saved:\n%s\n", GameConfig->GetPathName(), strerror(errno));
|
|
||||||
return false; // return true to retry
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void I_PutInClipboard(const char* const string)
|
void I_PutInClipboard(const char* const string)
|
||||||
{
|
{
|
||||||
NSPasteboard* const pasteBoard = [NSPasteboard generalPasteboard];
|
NSPasteboard* const pasteBoard = [NSPasteboard generalPasteboard];
|
||||||
|
@ -185,11 +170,3 @@ unsigned int I_MakeRNGSeed()
|
||||||
{
|
{
|
||||||
return static_cast<unsigned int>(arc4random());
|
return static_cast<unsigned int>(arc4random());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TArray<FString> I_GetGogPaths()
|
|
||||||
{
|
|
||||||
// GOG's Doom games are Windows only at the moment
|
|
||||||
return TArray<FString>();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gl_load/gl_load.h"
|
#include "gl_load.h"
|
||||||
|
|
||||||
#ifdef HAVE_VULKAN
|
#ifdef HAVE_VULKAN
|
||||||
#define VK_USE_PLATFORM_MACOS_MVK
|
#define VK_USE_PLATFORM_MACOS_MVK
|
||||||
|
@ -54,8 +54,12 @@
|
||||||
#include "printf.h"
|
#include "printf.h"
|
||||||
|
|
||||||
#include "gl/system/gl_framebuffer.h"
|
#include "gl/system/gl_framebuffer.h"
|
||||||
//#include "vulkan/system/vk_framebuffer.h"
|
#ifdef HAVE_VULKAN
|
||||||
//#include "rendering/polyrenderer/backend/poly_framebuffer.h"
|
#include "vulkan/system/vk_framebuffer.h"
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SOFTPOLY
|
||||||
|
#include "rendering/polyrenderer/backend/poly_framebuffer.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
extern bool ToggleFullscreen;
|
extern bool ToggleFullscreen;
|
||||||
|
|
||||||
|
@ -429,7 +433,7 @@ public:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_vulkanDevice = new VulkanDevice();
|
m_vulkanDevice = new VulkanDevice();
|
||||||
fb = new VulkanFrameBuffer(nullptr, fullscreen, m_vulkanDevice);
|
fb = new VulkanFrameBuffer(nullptr, vid_fullscreen, m_vulkanDevice);
|
||||||
}
|
}
|
||||||
catch (std::exception const&)
|
catch (std::exception const&)
|
||||||
{
|
{
|
||||||
|
@ -441,7 +445,7 @@ public:
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#ifdef HAVE_SOFTPOLY
|
||||||
if (vid_preferbackend == 2)
|
if (vid_preferbackend == 2)
|
||||||
{
|
{
|
||||||
SetupOpenGLView(ms_window, OpenGLProfile::Legacy);
|
SetupOpenGLView(ms_window, OpenGLProfile::Legacy);
|
||||||
|
@ -642,7 +646,7 @@ void SystemBaseFrameBuffer::SetMode(const bool fullscreen, const bool hiDPI)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(m_window.screen != nil);
|
assert(m_window.screen != nil);
|
||||||
assert(m_window.contentView.layer != nil);
|
assert([m_window.contentView layer] != nil);
|
||||||
[m_window.contentView layer].contentsScale = hiDPI ? m_window.screen.backingScaleFactor : 1.0;
|
[m_window.contentView layer].contentsScale = hiDPI ? m_window.screen.backingScaleFactor : 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -808,11 +812,11 @@ bool I_SetCursor(FTexture *cursorpic)
|
||||||
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
||||||
NSCursor* cursor = nil;
|
NSCursor* cursor = nil;
|
||||||
|
|
||||||
if (NULL != cursorpic)
|
if (NULL != cursorpic && cursorpic->isValid())
|
||||||
{
|
{
|
||||||
// Create bitmap image representation
|
// Create bitmap image representation
|
||||||
|
|
||||||
auto sbuffer = cursorpic->CreateTexBuffer(0);
|
auto sbuffer = cursorpic->GetTexture()->CreateTexBuffer(0);
|
||||||
|
|
||||||
const NSInteger imageWidth = sbuffer.mWidth;
|
const NSInteger imageWidth = sbuffer.mWidth;
|
||||||
const NSInteger imageHeight = sbuffer.mHeight;
|
const NSInteger imageHeight = sbuffer.mHeight;
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "i_common.h"
|
#include "i_common.h"
|
||||||
|
#include "startupinfo.h"
|
||||||
#include "st_console.h"
|
#include "st_console.h"
|
||||||
#include "v_text.h"
|
#include "v_text.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
@ -48,11 +48,16 @@ static NSColor* RGB(const uint8_t red, const uint8_t green, const uint8_t blue)
|
||||||
alpha:1.0f];
|
alpha:1.0f];
|
||||||
}
|
}
|
||||||
|
|
||||||
static NSColor* RGB(PalEntry color)
|
static NSColor* RGB(const PalEntry& color)
|
||||||
{
|
{
|
||||||
return RGB(color.r, color.g, color.b);
|
return RGB(color.r, color.g, color.b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static NSColor* RGB(const uint32_t color)
|
||||||
|
{
|
||||||
|
return RGB(PalEntry(color));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static const CGFloat PROGRESS_BAR_HEIGHT = 18.0f;
|
static const CGFloat PROGRESS_BAR_HEIGHT = 18.0f;
|
||||||
static const CGFloat NET_VIEW_HEIGHT = 88.0f;
|
static const CGFloat NET_VIEW_HEIGHT = 88.0f;
|
||||||
|
@ -331,29 +336,27 @@ void FConsoleWindow::SetTitleText()
|
||||||
textViewFrame.size.width,
|
textViewFrame.size.width,
|
||||||
TITLE_TEXT_HEIGHT);
|
TITLE_TEXT_HEIGHT);
|
||||||
|
|
||||||
#if 0
|
|
||||||
// Temporary solution for the same foreground and background colors
|
// Temporary solution for the same foreground and background colors
|
||||||
// It's used in graphical startup screen, with Hexen style in particular
|
// It's used in graphical startup screen, with Hexen style in particular
|
||||||
// Native OS X backend doesn't implement this yet
|
// Native OS X backend doesn't implement this yet
|
||||||
|
|
||||||
if (RazeStartupInfo.FgColor == RazeStartupInfo.BkColor)
|
if (GameStartupInfo.FgColor == GameStartupInfo.BkColor)
|
||||||
{
|
{
|
||||||
RazeStartupInfo.FgColor = ~RazeStartupInfo.FgColor;
|
GameStartupInfo.FgColor = ~GameStartupInfo.FgColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSTextField* titleText = [[NSTextField alloc] initWithFrame:titleTextRect];
|
NSTextField* titleText = [[NSTextField alloc] initWithFrame:titleTextRect];
|
||||||
[titleText setStringValue:[NSString stringWithCString:RazeStartupInfo.Name
|
[titleText setStringValue:[NSString stringWithCString:GameStartupInfo.Name.GetChars()
|
||||||
encoding:NSISOLatin1StringEncoding]];
|
encoding:NSISOLatin1StringEncoding]];
|
||||||
[titleText setAlignment:NSCenterTextAlignment];
|
[titleText setAlignment:NSCenterTextAlignment];
|
||||||
[titleText setTextColor:RGB(RazeStartupInfo.FgColor)];
|
[titleText setTextColor:RGB(GameStartupInfo.FgColor)];
|
||||||
[titleText setBackgroundColor:RGB(RazeStartupInfo.BkColor)];
|
[titleText setBackgroundColor:RGB(GameStartupInfo.BkColor)];
|
||||||
[titleText setFont:[NSFont fontWithName:@"Trebuchet MS Bold" size:18.0f]];
|
[titleText setFont:[NSFont fontWithName:@"Trebuchet MS Bold" size:18.0f]];
|
||||||
[titleText setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin];
|
[titleText setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin];
|
||||||
[titleText setSelectable:NO];
|
[titleText setSelectable:NO];
|
||||||
[titleText setBordered:NO];
|
[titleText setBordered:NO];
|
||||||
[[m_window contentView] addSubview:titleText];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
[[m_window contentView] addSubview:titleText];
|
||||||
}
|
}
|
||||||
|
|
||||||
void FConsoleWindow::SetProgressBar(const bool visible)
|
void FConsoleWindow::SetProgressBar(const bool visible)
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include "st_console.h"
|
#include "st_console.h"
|
||||||
#include "st_start.h"
|
#include "st_start.h"
|
||||||
#include "printf.h"
|
#include "printf.h"
|
||||||
|
#include "engineerrors.h"
|
||||||
|
|
||||||
|
|
||||||
FStartupScreen *StartScreen;
|
FStartupScreen *StartScreen;
|
||||||
|
@ -64,7 +65,7 @@ FBasicStartupScreen::FBasicStartupScreen(int maxProgress, bool showBar)
|
||||||
: FStartupScreen(maxProgress)
|
: FStartupScreen(maxProgress)
|
||||||
{
|
{
|
||||||
FConsoleWindow& consoleWindow = FConsoleWindow::GetInstance();
|
FConsoleWindow& consoleWindow = FConsoleWindow::GetInstance();
|
||||||
consoleWindow.SetProgressBar(false);
|
consoleWindow.SetProgressBar(true);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// Testing code, please do not remove
|
// Testing code, please do not remove
|
||||||
|
@ -164,3 +165,11 @@ FStartupScreen *FStartupScreen::CreateInstance(const int maxProgress)
|
||||||
return new FBasicStartupScreen(maxProgress, true);
|
return new FBasicStartupScreen(maxProgress, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void ST_Endoom()
|
||||||
|
{
|
||||||
|
throw CExitEvent(0);
|
||||||
|
}
|
||||||
|
|
|
@ -20,9 +20,7 @@ struct WadStuff;
|
||||||
#define SHARE_DIR "/usr/local/share/"
|
#define SHARE_DIR "/usr/local/share/"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void CalculateCPUSpeed(void);
|
||||||
// Called by DoomMain.
|
|
||||||
void I_Init (void);
|
|
||||||
|
|
||||||
// Return a seed value for the RNG.
|
// Return a seed value for the RNG.
|
||||||
unsigned int I_MakeRNGSeed();
|
unsigned int I_MakeRNGSeed();
|
||||||
|
@ -43,8 +41,6 @@ void I_StartTic (void);
|
||||||
// for normal input.
|
// for normal input.
|
||||||
ticcmd_t *I_BaseTiccmd (void);
|
ticcmd_t *I_BaseTiccmd (void);
|
||||||
|
|
||||||
void I_Tactile (int on, int off, int total);
|
|
||||||
|
|
||||||
// Print a console string
|
// Print a console string
|
||||||
void I_PrintStr (const char *str);
|
void I_PrintStr (const char *str);
|
||||||
|
|
||||||
|
|
45
source/platform/posix/i_system_posix.cpp
Normal file
45
source/platform/posix/i_system_posix.cpp
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Copyright 1993-1996 id Software
|
||||||
|
// Copyright 1999-2016 Randy Heit
|
||||||
|
//
|
||||||
|
// 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 3 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.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see http://www.gnu.org/licenses/
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <fnmatch.h>
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include <AvailabilityMacros.h>
|
||||||
|
#endif // __APPLE__
|
||||||
|
|
||||||
|
#include "cmdlib.h"
|
||||||
|
#include "d_protocol.h"
|
||||||
|
#include "i_system.h"
|
||||||
|
#include "gameconfigfile.h"
|
||||||
|
#include "x86.h"
|
||||||
|
|
||||||
|
|
||||||
|
bool I_WriteIniFailed()
|
||||||
|
{
|
||||||
|
printf("The config file %s could not be saved:\n%s\n", GameConfig->GetPathName(), strerror(errno));
|
||||||
|
return false; // return true to retry
|
||||||
|
}
|
||||||
|
|
||||||
|
TArray<FString> I_GetGogPaths()
|
||||||
|
{
|
||||||
|
// GOG's Doom games are Windows only at the moment
|
||||||
|
return TArray<FString>();
|
||||||
|
}
|
|
@ -109,6 +109,28 @@ FString M_GetAppDataPath(bool create)
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// M_GetCachePath macOS
|
||||||
|
//
|
||||||
|
// Returns the path for cache GL nodes.
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
FString M_GetCachePath(bool create)
|
||||||
|
{
|
||||||
|
FString path = M_GetMacAppSupportPath(create);
|
||||||
|
|
||||||
|
if (path.IsEmpty())
|
||||||
|
{
|
||||||
|
path = progdir;
|
||||||
|
}
|
||||||
|
|
||||||
|
path += "/zdoom/cache";
|
||||||
|
if (create) CreatePath(path);
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
// M_GetAutoexecPath macOS
|
// M_GetAutoexecPath macOS
|
||||||
|
|
|
@ -38,8 +38,8 @@
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
#include "m_argv.h"
|
#include "m_argv.h"
|
||||||
#include "gameconfigfile.h"
|
#include "gameconfigfile.h"
|
||||||
#include "printf.h"
|
#include "engineerrors.h"
|
||||||
#include "gamecontrol.h"
|
#include "i_interface.h"
|
||||||
|
|
||||||
#include <Cocoa/Cocoa.h>
|
#include <Cocoa/Cocoa.h>
|
||||||
#include <wordexp.h>
|
#include <wordexp.h>
|
||||||
|
|
|
@ -43,7 +43,7 @@ bool I_SetCursor(FGameTexture *cursorpic)
|
||||||
static SDL_Cursor *cursor;
|
static SDL_Cursor *cursor;
|
||||||
static SDL_Surface *cursorSurface;
|
static SDL_Surface *cursorSurface;
|
||||||
|
|
||||||
if (cursorpic != NULL)
|
if (cursorpic != NULL && cursorpic->isValid())
|
||||||
{
|
{
|
||||||
auto src = cursorpic->GetTexture()->GetBgraBitmap(nullptr);
|
auto src = cursorpic->GetTexture()->GetBgraBitmap(nullptr);
|
||||||
// Must be no larger than 32x32.
|
// Must be no larger than 32x32.
|
||||||
|
|
|
@ -36,15 +36,21 @@
|
||||||
|
|
||||||
#include "d_event.h"
|
#include "d_event.h"
|
||||||
#include "d_gui.h"
|
#include "d_gui.h"
|
||||||
|
#include "c_buttons.h"
|
||||||
#include "c_console.h"
|
#include "c_console.h"
|
||||||
#include "c_dispatch.h"
|
#include "c_dispatch.h"
|
||||||
#include "dikeys.h"
|
#include "dikeys.h"
|
||||||
#include "utf8.h"
|
#include "utf8.h"
|
||||||
#include "keydef.h"
|
#include "keydef.h"
|
||||||
#include "menu/menu.h"
|
#include "i_interface.h"
|
||||||
|
#include "engineerrors.h"
|
||||||
|
#include "i_interface.h"
|
||||||
|
|
||||||
|
|
||||||
|
static void I_CheckGUICapture ();
|
||||||
static void I_CheckNativeMouse ();
|
static void I_CheckNativeMouse ();
|
||||||
|
|
||||||
|
bool GUICapture;
|
||||||
static bool NativeMouse = true;
|
static bool NativeMouse = true;
|
||||||
|
|
||||||
CVAR (Bool, use_mouse, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
CVAR (Bool, use_mouse, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
|
@ -159,6 +165,20 @@ static TMap<SDL_Scancode, uint8_t> InitKeyScanMap ()
|
||||||
}
|
}
|
||||||
static const TMap<SDL_Scancode, uint8_t> KeyScanToDIK(InitKeyScanMap());
|
static const TMap<SDL_Scancode, uint8_t> KeyScanToDIK(InitKeyScanMap());
|
||||||
|
|
||||||
|
static void I_CheckGUICapture ()
|
||||||
|
{
|
||||||
|
bool wantCapt = sysCallbacks && sysCallbacks->WantGuiCapture && sysCallbacks->WantGuiCapture();
|
||||||
|
|
||||||
|
if (wantCapt != GUICapture)
|
||||||
|
{
|
||||||
|
GUICapture = wantCapt;
|
||||||
|
if (wantCapt)
|
||||||
|
{
|
||||||
|
buttonMap.ResetButtonStates();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void I_SetMouseCapture()
|
void I_SetMouseCapture()
|
||||||
{
|
{
|
||||||
// Clear out any mouse movement.
|
// Clear out any mouse movement.
|
||||||
|
@ -216,30 +236,15 @@ static void MouseRead ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CUSTOM_CVAR(Int, mouse_capturemode, 1, CVAR_GLOBALCONFIG|CVAR_ARCHIVE)
|
|
||||||
{
|
|
||||||
if (self < 0) self = 0;
|
|
||||||
else if (self > 2) self = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool inGame()
|
|
||||||
{
|
|
||||||
if (mouse_capturemode == 2)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return gi->CanSave();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void I_CheckNativeMouse ()
|
static void I_CheckNativeMouse ()
|
||||||
{
|
{
|
||||||
bool focus = SDL_GetKeyboardFocus() != NULL;
|
bool focus = SDL_GetKeyboardFocus() != NULL;
|
||||||
|
|
||||||
// TODO: We want this to check for demo playback, as well. And paused state
|
bool captureModeInGame = sysCallbacks && sysCallbacks->CaptureModeInGame && sysCallbacks->CaptureModeInGame();
|
||||||
bool wantNative = !focus || (!use_mouse || GUICapture || !inGame());
|
bool wantNative = !focus || (!use_mouse || GUICapture || !captureModeInGame);
|
||||||
|
|
||||||
|
if (!wantNative && sysCallbacks && sysCallbacks->WantNativeMouse && sysCallbacks->WantNativeMouse())
|
||||||
|
wantNative = true;
|
||||||
|
|
||||||
if (wantNative != NativeMouse)
|
if (wantNative != NativeMouse)
|
||||||
{
|
{
|
||||||
|
@ -519,6 +524,7 @@ void I_GetEvent ()
|
||||||
|
|
||||||
void I_StartTic ()
|
void I_StartTic ()
|
||||||
{
|
{
|
||||||
|
I_CheckGUICapture ();
|
||||||
I_CheckNativeMouse ();
|
I_CheckNativeMouse ();
|
||||||
I_GetEvent ();
|
I_GetEvent ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,12 +41,14 @@
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
|
#include "engineerrors.h"
|
||||||
#include "m_argv.h"
|
#include "m_argv.h"
|
||||||
#include "c_console.h"
|
#include "c_console.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
|
#include "engineerrors.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "core/gamecontrol.h"
|
#include "i_interface.h"
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -66,6 +68,7 @@ void Linux_I_FatalError(const char* errortext);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
||||||
|
int GameMain();
|
||||||
|
|
||||||
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
||||||
|
|
||||||
|
@ -82,6 +85,13 @@ FArgs *Args;
|
||||||
// CODE --------------------------------------------------------------------
|
// CODE --------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int GetCrashInfo (char *buffer, char *end)
|
||||||
|
{
|
||||||
|
if (sysCallbacks && sysCallbacks->CrashInfo) sysCallbacks->CrashInfo(buffer, end - buffer, "\n");
|
||||||
|
return strlen(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
void I_DetectOS()
|
void I_DetectOS()
|
||||||
{
|
{
|
||||||
// The POSIX version never implemented this.
|
// The POSIX version never implemented this.
|
||||||
|
@ -93,10 +103,8 @@ int main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
#if !defined (__APPLE__)
|
#if !defined (__APPLE__)
|
||||||
{
|
{
|
||||||
#if 0 // TODO: Crash handling
|
|
||||||
int s[4] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS };
|
int s[4] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS };
|
||||||
cc_install_handlers(argc, argv, 4, s, GAMENAMELOWERCASE "-crash.log", DoomSpecificInfo);
|
cc_install_handlers(argc, argv, 4, s, GAMENAMELOWERCASE "-crash.log", GetCrashInfo);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif // !__APPLE__
|
#endif // !__APPLE__
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,6 @@
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "i_system.h"
|
|
||||||
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -46,23 +44,17 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
#include "x86.h"
|
||||||
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
#include "m_argv.h"
|
#include "m_argv.h"
|
||||||
#include "i_sound.h"
|
#include "i_sound.h"
|
||||||
|
#include "i_interface.h"
|
||||||
|
|
||||||
#include "c_dispatch.h"
|
|
||||||
#include "gamecontrol.h"
|
|
||||||
#include "gameconfigfile.h"
|
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
double SecondsPerCycle = 1e-8;
|
|
||||||
double CyclesPerSecond = 1e8;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef NO_GTK
|
#ifndef NO_GTK
|
||||||
bool I_GtkAvailable ();
|
bool I_GtkAvailable ();
|
||||||
|
@ -74,30 +66,13 @@ int I_PickIWad_Cocoa (WadStuff *wads, int numwads, bool showwin, int defaultiwad
|
||||||
|
|
||||||
double PerfToSec, PerfToMillisec;
|
double PerfToSec, PerfToMillisec;
|
||||||
|
|
||||||
void I_BeginRead(void)
|
void I_SetIWADInfo()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_EndRead(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// I_Init
|
|
||||||
//
|
|
||||||
void I_Init (void)
|
|
||||||
{
|
|
||||||
#if 0 // do we need this?
|
|
||||||
CheckCPUID (&CPU);
|
|
||||||
DumpCPUInfo (&CPU);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// I_Error
|
// I_Error
|
||||||
//
|
//
|
||||||
extern FILE *Logfile;
|
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
void Mac_I_FatalError(const char* errortext);
|
void Mac_I_FatalError(const char* errortext);
|
||||||
|
@ -146,11 +121,9 @@ void I_ShowFatalError(const char *message)
|
||||||
#else
|
#else
|
||||||
// ???
|
// ???
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CalculateCPUSpeed()
|
||||||
void I_SetIWADInfo ()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,13 +246,6 @@ int I_PickIWad (WadStuff *wads, int numwads, bool showwin, int defaultiwad)
|
||||||
return i-1;
|
return i-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool I_WriteIniFailed ()
|
|
||||||
{
|
|
||||||
printf ("The config file %s could not be saved:\n%s\n", GameConfig->GetPathName(), strerror(errno));
|
|
||||||
return false;
|
|
||||||
// return true to retry
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_PutInClipboard (const char *str)
|
void I_PutInClipboard (const char *str)
|
||||||
{
|
{
|
||||||
SDL_SetClipboardText(str);
|
SDL_SetClipboardText(str);
|
||||||
|
@ -317,10 +283,3 @@ unsigned int I_MakeRNGSeed()
|
||||||
}
|
}
|
||||||
return seed;
|
return seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
TArray<FString> I_GetGogPaths()
|
|
||||||
{
|
|
||||||
// GOG's Doom games are Windows only at the moment
|
|
||||||
return TArray<FString>();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,6 @@
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// TODO: Softpoly is temporarily #if 0'd out in 5 places.
|
|
||||||
|
|
||||||
// HEADER FILES ------------------------------------------------------------
|
// HEADER FILES ------------------------------------------------------------
|
||||||
|
|
||||||
#include "i_module.h"
|
#include "i_module.h"
|
||||||
|
@ -44,26 +42,31 @@
|
||||||
#include "c_console.h"
|
#include "c_console.h"
|
||||||
#include "c_dispatch.h"
|
#include "c_dispatch.h"
|
||||||
#include "printf.h"
|
#include "printf.h"
|
||||||
#include "gamecontrol.h"
|
|
||||||
|
|
||||||
#include "hardware.h"
|
#include "hardware.h"
|
||||||
#include "gl_sysfb.h"
|
#include "gl_sysfb.h"
|
||||||
#include "gl_load/gl_system.h"
|
#include "gl_system.h"
|
||||||
|
|
||||||
#include "gl/renderer/gl_renderer.h"
|
#include "gl/renderer/gl_renderer.h"
|
||||||
#include "gl/system/gl_framebuffer.h"
|
#include "gl/system/gl_framebuffer.h"
|
||||||
#include "glbackend/gl_shader.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_VULKAN
|
#ifdef HAVE_VULKAN
|
||||||
#include "rendering/vulkan/system/vk_framebuffer.h"
|
#include "rendering/vulkan/system/vk_framebuffer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0 // softpoly
|
#ifdef HAVE_SOFTPOLY
|
||||||
#include "rendering/polyrenderer/backend/poly_framebuffer.h"
|
#include "rendering/polyrenderer/backend/poly_framebuffer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Requires SDL 2.0.6 or newer
|
||||||
|
//#define SDL2_STATIC_LIBRARY
|
||||||
|
|
||||||
|
#if defined SDL2_STATIC_LIBRARY && defined HAVE_VULKAN
|
||||||
|
#include <SDL_vulkan.h>
|
||||||
|
#endif // SDL2_STATIC_LIBRARY && HAVE_VULKAN
|
||||||
|
|
||||||
// TYPES -------------------------------------------------------------------
|
// TYPES -------------------------------------------------------------------
|
||||||
|
|
||||||
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
||||||
|
@ -71,7 +74,7 @@
|
||||||
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
||||||
|
|
||||||
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
|
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
|
||||||
|
extern double refreshfreq;
|
||||||
extern IVideo *Video;
|
extern IVideo *Video;
|
||||||
|
|
||||||
EXTERN_CVAR (Int, vid_adapter)
|
EXTERN_CVAR (Int, vid_adapter)
|
||||||
|
@ -111,17 +114,24 @@ CCMD(vid_list_sdl_render_drivers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double refreshfreq;
|
|
||||||
|
|
||||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||||
|
|
||||||
namespace Priv
|
namespace Priv
|
||||||
{
|
{
|
||||||
|
#ifdef SDL2_STATIC_LIBRARY
|
||||||
|
|
||||||
|
#define SDL2_OPTIONAL_FUNCTION(RESULT, NAME, ...) \
|
||||||
|
RESULT(*NAME)(__VA_ARGS__) = SDL_ ## NAME
|
||||||
|
|
||||||
|
#else // !SDL2_STATIC_LIBRARY
|
||||||
|
|
||||||
FModule library("SDL2");
|
FModule library("SDL2");
|
||||||
|
|
||||||
#define SDL2_OPTIONAL_FUNCTION(RESULT, NAME, ...) \
|
#define SDL2_OPTIONAL_FUNCTION(RESULT, NAME, ...) \
|
||||||
static TOptProc<library, RESULT(*)(__VA_ARGS__)> NAME("SDL_" #NAME)
|
static TOptProc<library, RESULT(*)(__VA_ARGS__)> NAME("SDL_" #NAME)
|
||||||
|
|
||||||
|
#endif // SDL2_STATIC_LIBRARY
|
||||||
|
|
||||||
SDL2_OPTIONAL_FUNCTION(int, GetWindowBordersSize, SDL_Window *window, int *top, int *left, int *bottom, int *right);
|
SDL2_OPTIONAL_FUNCTION(int, GetWindowBordersSize, SDL_Window *window, int *top, int *left, int *bottom, int *right);
|
||||||
#ifdef HAVE_VULKAN
|
#ifdef HAVE_VULKAN
|
||||||
SDL2_OPTIONAL_FUNCTION(void, Vulkan_GetDrawableSize, SDL_Window *window, int *width, int *height);
|
SDL2_OPTIONAL_FUNCTION(void, Vulkan_GetDrawableSize, SDL_Window *window, int *width, int *height);
|
||||||
|
@ -249,7 +259,7 @@ bool I_CreateVulkanSurface(VkInstance instance, VkSurfaceKHR *surface)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0 // softpoly stuff
|
#ifdef HAVE_SOFTPOLY
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
SDL_Renderer* polyrendertarget = nullptr;
|
SDL_Renderer* polyrendertarget = nullptr;
|
||||||
|
@ -409,16 +419,20 @@ SDLVideo::SDLVideo ()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SDL2_STATIC_LIBRARY
|
||||||
// Load optional SDL functions
|
// Load optional SDL functions
|
||||||
if (!Priv::library.IsLoaded())
|
if (!Priv::library.IsLoaded())
|
||||||
{
|
{
|
||||||
Priv::library.Load({ "libSDL2-2.0.so.0", "libSDL2-2.0.so", "libSDL2.so" });
|
Priv::library.Load({ "libSDL2-2.0.so.0", "libSDL2-2.0.so", "libSDL2.so" });
|
||||||
}
|
}
|
||||||
|
#endif // !SDL2_STATIC_LIBRARY
|
||||||
|
|
||||||
|
#ifdef HAVE_SOFTPOLY
|
||||||
|
Priv::softpolyEnabled = vid_preferbackend == 2;
|
||||||
|
#endif
|
||||||
#ifdef HAVE_VULKAN
|
#ifdef HAVE_VULKAN
|
||||||
Priv::vulkanEnabled = vid_preferbackend == 1
|
Priv::vulkanEnabled = vid_preferbackend == 1
|
||||||
&& Priv::Vulkan_GetDrawableSize && Priv::Vulkan_GetInstanceExtensions && Priv::Vulkan_CreateSurface;
|
&& Priv::Vulkan_GetDrawableSize && Priv::Vulkan_GetInstanceExtensions && Priv::Vulkan_CreateSurface;
|
||||||
Priv::softpolyEnabled = vid_preferbackend == 2;
|
|
||||||
|
|
||||||
if (Priv::vulkanEnabled)
|
if (Priv::vulkanEnabled)
|
||||||
{
|
{
|
||||||
|
@ -429,7 +443,9 @@ SDLVideo::SDLVideo ()
|
||||||
Priv::vulkanEnabled = false;
|
Priv::vulkanEnabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Priv::softpolyEnabled)
|
#endif
|
||||||
|
#ifdef HAVE_SOFTPOLY
|
||||||
|
if (Priv::softpolyEnabled)
|
||||||
{
|
{
|
||||||
Priv::CreateWindow(SDL_WINDOW_HIDDEN);
|
Priv::CreateWindow(SDL_WINDOW_HIDDEN);
|
||||||
}
|
}
|
||||||
|
@ -482,7 +498,7 @@ DFrameBuffer *SDLVideo::CreateFrameBuffer ()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0 // softpoly is not yet implemented
|
#ifdef HAVE_SOFTPOLY
|
||||||
if (Priv::softpolyEnabled)
|
if (Priv::softpolyEnabled)
|
||||||
{
|
{
|
||||||
fb = new PolyFrameBuffer(nullptr, vid_fullscreen);
|
fb = new PolyFrameBuffer(nullptr, vid_fullscreen);
|
||||||
|
@ -505,12 +521,12 @@ IVideo *gl_CreateVideo()
|
||||||
|
|
||||||
// FrameBuffer Implementation -----------------------------------------------
|
// FrameBuffer Implementation -----------------------------------------------
|
||||||
|
|
||||||
SystemBaseFrameBuffer::SystemBaseFrameBuffer (void *, bool vid_fullscreen)
|
SystemBaseFrameBuffer::SystemBaseFrameBuffer (void *, bool fullscreen)
|
||||||
: DFrameBuffer (vid_defwidth, vid_defheight)
|
: DFrameBuffer (vid_defwidth, vid_defheight)
|
||||||
{
|
{
|
||||||
if (Priv::window != nullptr)
|
if (Priv::window != nullptr)
|
||||||
{
|
{
|
||||||
SDL_SetWindowFullscreen(Priv::window, vid_fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
|
SDL_SetWindowFullscreen(Priv::window, fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
|
||||||
SDL_ShowWindow(Priv::window);
|
SDL_ShowWindow(Priv::window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -519,7 +535,7 @@ int SystemBaseFrameBuffer::GetClientWidth()
|
||||||
{
|
{
|
||||||
int width = 0;
|
int width = 0;
|
||||||
|
|
||||||
#if 0 // softpoly
|
#ifdef HAVE_SOFTPOLY
|
||||||
if (Priv::softpolyEnabled)
|
if (Priv::softpolyEnabled)
|
||||||
{
|
{
|
||||||
if (polyrendertarget)
|
if (polyrendertarget)
|
||||||
|
@ -542,7 +558,7 @@ int SystemBaseFrameBuffer::GetClientHeight()
|
||||||
{
|
{
|
||||||
int height = 0;
|
int height = 0;
|
||||||
|
|
||||||
#if 0 // softpoly
|
#ifdef HAVE_SOFTPOLY
|
||||||
if (Priv::softpolyEnabled)
|
if (Priv::softpolyEnabled)
|
||||||
{
|
{
|
||||||
if (polyrendertarget)
|
if (polyrendertarget)
|
||||||
|
@ -593,7 +609,7 @@ void SystemBaseFrameBuffer::SetWindowSize(int w, int h)
|
||||||
}
|
}
|
||||||
win_w = w;
|
win_w = w;
|
||||||
win_h = h;
|
win_h = h;
|
||||||
if ( vid_fullscreen )
|
if (vid_fullscreen)
|
||||||
{
|
{
|
||||||
vid_fullscreen = false;
|
vid_fullscreen = false;
|
||||||
}
|
}
|
||||||
|
@ -611,8 +627,8 @@ void SystemBaseFrameBuffer::SetWindowSize(int w, int h)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SystemGLFrameBuffer::SystemGLFrameBuffer(void *hMonitor, bool vid_fullscreen)
|
SystemGLFrameBuffer::SystemGLFrameBuffer(void *hMonitor, bool fullscreen)
|
||||||
: SystemBaseFrameBuffer(hMonitor, vid_fullscreen)
|
: SystemBaseFrameBuffer(hMonitor, fullscreen)
|
||||||
{
|
{
|
||||||
// NOTE: Core profiles were added with GL 3.2, so there's no sense trying
|
// NOTE: Core profiles were added with GL 3.2, so there's no sense trying
|
||||||
// to set core 3.1 or 3.0. We could try a forward-compatible context
|
// to set core 3.1 or 3.0. We could try a forward-compatible context
|
||||||
|
@ -647,7 +663,7 @@ SystemGLFrameBuffer::SystemGLFrameBuffer(void *hMonitor, bool vid_fullscreen)
|
||||||
for ( ; glvers[glveridx][0] > 0; ++glveridx)
|
for ( ; glvers[glveridx][0] > 0; ++glveridx)
|
||||||
{
|
{
|
||||||
Priv::SetupPixelFormat(0, glvers[glveridx]);
|
Priv::SetupPixelFormat(0, glvers[glveridx]);
|
||||||
Priv::CreateWindow(SDL_WINDOW_OPENGL | (vid_fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0));
|
Priv::CreateWindow(SDL_WINDOW_OPENGL | (fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0));
|
||||||
|
|
||||||
if (Priv::window == nullptr)
|
if (Priv::window == nullptr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#include "st_start.h"
|
#include "st_start.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
#include "compat.h"
|
#include "engineerrors.h"
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -58,8 +58,10 @@ typedef enum
|
||||||
#include "i_module.h"
|
#include "i_module.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "gamecontrol.h"
|
#include "startupinfo.h"
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
|
#include "i_interface.h"
|
||||||
|
#include "printf.h"
|
||||||
|
|
||||||
EXTERN_CVAR (Bool, queryiwad);
|
EXTERN_CVAR (Bool, queryiwad);
|
||||||
|
|
||||||
|
@ -208,7 +210,7 @@ static int PickIWad (WadStuff *wads, int numwads, bool showwin, int defaultiwad)
|
||||||
|
|
||||||
// Create the dialog window.
|
// Create the dialog window.
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
snprintf(caption, countof(caption), GAMENAME " %s: Select an IWAD to use", GetVersionString());
|
mysnprintf(caption, countof(caption), GAMENAME " %s: Select an IWAD to use", GetVersionString());
|
||||||
gtk_window_set_title (GTK_WINDOW(window), caption);
|
gtk_window_set_title (GTK_WINDOW(window), caption);
|
||||||
gtk_window_set_position (GTK_WINDOW(window), GTK_WIN_POS_CENTER);
|
gtk_window_set_position (GTK_WINDOW(window), GTK_WIN_POS_CENTER);
|
||||||
gtk_window_set_gravity (GTK_WINDOW(window), GDK_GRAVITY_CENTER);
|
gtk_window_set_gravity (GTK_WINDOW(window), GDK_GRAVITY_CENTER);
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
#include "printf.h"
|
#include "printf.h"
|
||||||
|
#include "engineerrors.h"
|
||||||
|
|
||||||
#include "version.h" // for GAMENAME
|
#include "version.h" // for GAMENAME
|
||||||
|
|
||||||
|
@ -119,6 +120,26 @@ FString M_GetAppDataPath(bool create)
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// M_GetCachePath Unix
|
||||||
|
//
|
||||||
|
// Returns the path for cache GL nodes.
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
FString M_GetCachePath(bool create)
|
||||||
|
{
|
||||||
|
// Don't use GAME_DIR and such so that ZDoom and its child ports can
|
||||||
|
// share the node cache.
|
||||||
|
FString path = NicePath("$HOME/.config/zdoom/cache");
|
||||||
|
if (create)
|
||||||
|
{
|
||||||
|
CreatePath(path);
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
// M_GetAutoexecPath Unix
|
// M_GetAutoexecPath Unix
|
||||||
|
|
|
@ -44,9 +44,13 @@
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "printf.h"
|
#include "printf.h"
|
||||||
#include "win32glvideo.h"
|
#include "win32glvideo.h"
|
||||||
|
#ifdef HAVE_SOFTPOLY
|
||||||
|
#include "win32polyvideo.h"
|
||||||
|
#endif
|
||||||
#ifdef HAVE_VULKAN
|
#ifdef HAVE_VULKAN
|
||||||
#include "win32vulkanvideo.h"
|
#include "win32vulkanvideo.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "engineerrors.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
|
|
||||||
EXTERN_CVAR(Int, vid_preferbackend)
|
EXTERN_CVAR(Int, vid_preferbackend)
|
||||||
|
@ -127,8 +131,15 @@ void I_InitGraphics ()
|
||||||
// are the active app. Huh?
|
// are the active app. Huh?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_SOFTPOLY
|
||||||
|
if (vid_preferbackend == 2)
|
||||||
|
{
|
||||||
|
Video = new Win32PolyVideo();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
#ifdef HAVE_VULKAN
|
#ifdef HAVE_VULKAN
|
||||||
else if (vid_preferbackend == 1)
|
if (vid_preferbackend == 1)
|
||||||
{
|
{
|
||||||
// first try Vulkan, if that fails OpenGL
|
// first try Vulkan, if that fails OpenGL
|
||||||
try
|
try
|
||||||
|
@ -141,12 +152,16 @@ void I_InitGraphics ()
|
||||||
Video = new Win32GLVideo();
|
Video = new Win32GLVideo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
Video = new Win32GLVideo();
|
Video = new Win32GLVideo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_SOFTPOLY
|
||||||
|
if (Video == NULL)
|
||||||
|
Video = new Win32PolyVideo();
|
||||||
|
#endif
|
||||||
// we somehow STILL don't have a display!!
|
// we somehow STILL don't have a display!!
|
||||||
if (Video == NULL)
|
if (Video == NULL)
|
||||||
I_FatalError ("Failed to initialize display");
|
I_FatalError ("Failed to initialize display");
|
||||||
|
|
|
@ -80,12 +80,11 @@
|
||||||
#include "d_event.h"
|
#include "d_event.h"
|
||||||
#include "v_text.h"
|
#include "v_text.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
#include "engineerrors.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
|
#include "i_interface.h"
|
||||||
#include "printf.h"
|
#include "printf.h"
|
||||||
#include "c_console.h"
|
|
||||||
#include "menu.h"
|
|
||||||
#include "c_buttons.h"
|
#include "c_buttons.h"
|
||||||
#include "gamecontrol.h"
|
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
|
|
||||||
// Compensate for w32api's lack
|
// Compensate for w32api's lack
|
||||||
|
@ -109,6 +108,7 @@ extern DWORD SessionID;
|
||||||
|
|
||||||
static HMODULE DInputDLL;
|
static HMODULE DInputDLL;
|
||||||
|
|
||||||
|
bool GUICapture;
|
||||||
extern FMouse *Mouse;
|
extern FMouse *Mouse;
|
||||||
extern FKeyboard *Keyboard;
|
extern FKeyboard *Keyboard;
|
||||||
extern bool ToggleFullscreen;
|
extern bool ToggleFullscreen;
|
||||||
|
@ -136,7 +136,7 @@ extern bool AppActive;
|
||||||
|
|
||||||
int SessionState = 0;
|
int SessionState = 0;
|
||||||
int BlockMouseMove;
|
int BlockMouseMove;
|
||||||
double refreshfreq;
|
extern double refreshfreq;
|
||||||
|
|
||||||
static bool EventHandlerResultForNativeMouse;
|
static bool EventHandlerResultForNativeMouse;
|
||||||
|
|
||||||
|
@ -146,6 +146,19 @@ CVAR (Bool, k_allowfullscreentoggle, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
|
|
||||||
extern int chatmodeon;
|
extern int chatmodeon;
|
||||||
|
|
||||||
|
static void I_CheckGUICapture ()
|
||||||
|
{
|
||||||
|
bool wantCapt = sysCallbacks && sysCallbacks->WantGuiCapture && sysCallbacks->WantGuiCapture();
|
||||||
|
|
||||||
|
if (wantCapt != GUICapture)
|
||||||
|
{
|
||||||
|
GUICapture = wantCapt;
|
||||||
|
if (wantCapt && Keyboard != NULL)
|
||||||
|
{
|
||||||
|
Keyboard->AllKeysUp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void I_SetMouseCapture()
|
void I_SetMouseCapture()
|
||||||
{
|
{
|
||||||
|
@ -398,15 +411,13 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
if (message == WM_LBUTTONDOWN && sysCallbacks && sysCallbacks->WantLeftButton() && sysCallbacks->WantLeftButton())
|
||||||
if ((gamestate == GS_DEMOSCREEN || gamestate == GS_TITLELEVEL) && message == WM_LBUTTONDOWN)
|
|
||||||
{
|
{
|
||||||
if (GUIWndProcHook(hWnd, message, wParam, lParam, &result))
|
if (GUIWndProcHook(hWnd, message, wParam, lParam, &result))
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
switch (message)
|
switch (message)
|
||||||
|
@ -436,7 +447,7 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
case WM_SETFOCUS:
|
case WM_SETFOCUS:
|
||||||
GetRefreshRate(hWnd);
|
GetRefreshRate(hWnd);
|
||||||
I_CheckNativeMouse (false, false); // This cannot call the event handler. Doing it from here is unsafe.
|
I_CheckNativeMouse (false, EventHandlerResultForNativeMouse); // This cannot call the event handler. Doing it from here is unsafe.
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_SETCURSOR:
|
case WM_SETCURSOR:
|
||||||
|
@ -513,12 +524,10 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
SetPriorityClass (GetCurrentProcess (), INGAME_PRIORITY_CLASS);
|
SetPriorityClass (GetCurrentProcess (), INGAME_PRIORITY_CLASS);
|
||||||
}
|
}
|
||||||
#if 0
|
else if (!noidle && !(sysCallbacks && sysCallbacks->NetGame && sysCallbacks->NetGame()))
|
||||||
else if (!noidle && !netgame)
|
|
||||||
{
|
{
|
||||||
SetPriorityClass (GetCurrentProcess (), IDLE_PRIORITY_CLASS);
|
SetPriorityClass (GetCurrentProcess (), IDLE_PRIORITY_CLASS);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
S_SetSoundPaused ((!!i_soundinbackground) || wParam);
|
S_SetSoundPaused ((!!i_soundinbackground) || wParam);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -757,10 +766,11 @@ void I_GetEvent ()
|
||||||
//
|
//
|
||||||
void I_StartTic ()
|
void I_StartTic ()
|
||||||
{
|
{
|
||||||
I_StartFrame();
|
|
||||||
BlockMouseMove--;
|
BlockMouseMove--;
|
||||||
buttonMap.ResetButtonTriggers ();
|
buttonMap.ResetButtonTriggers ();
|
||||||
I_CheckNativeMouse (false, false);
|
I_CheckGUICapture ();
|
||||||
|
EventHandlerResultForNativeMouse = sysCallbacks && sysCallbacks->WantNativeMouse && sysCallbacks->WantNativeMouse();
|
||||||
|
I_CheckNativeMouse (false, EventHandlerResultForNativeMouse);
|
||||||
I_GetEvent ();
|
I_GetEvent ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ protected:
|
||||||
void PostKeyEvent(int keynum, INTBOOL down, bool foreground);
|
void PostKeyEvent(int keynum, INTBOOL down, bool foreground);
|
||||||
};
|
};
|
||||||
|
|
||||||
class /*NOVTABLE*/ FJoystickCollection : public FInputDevice
|
class NOVTABLE FJoystickCollection : public FInputDevice
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void AddAxes(float axes[NUM_JOYAXIS]) = 0;
|
virtual void AddAxes(float axes[NUM_JOYAXIS]) = 0;
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
|
|
||||||
#include "i_input.h"
|
#include "i_input.h"
|
||||||
#include "d_event.h"
|
#include "d_event.h"
|
||||||
#include "inputstate.h"
|
|
||||||
|
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
@ -91,7 +90,7 @@ protected:
|
||||||
extern HWND Window;
|
extern HWND Window;
|
||||||
extern LPDIRECTINPUT8 g_pdi;
|
extern LPDIRECTINPUT8 g_pdi;
|
||||||
extern LPDIRECTINPUT g_pdi3;
|
extern LPDIRECTINPUT g_pdi3;
|
||||||
|
extern bool GUICapture;
|
||||||
|
|
||||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -55,28 +55,27 @@
|
||||||
#endif
|
#endif
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
//#include "doomerrors.h"
|
#include "engineerrors.h"
|
||||||
#include "hardware.h"
|
#include "hardware.h"
|
||||||
|
|
||||||
#include "m_argv.h"
|
#include "m_argv.h"
|
||||||
#include "gamecontrol.h"
|
|
||||||
#include "i_module.h"
|
#include "i_module.h"
|
||||||
#include "c_console.h"
|
#include "c_console.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "i_input.h"
|
#include "i_input.h"
|
||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
//#include "g_game.h"
|
|
||||||
//#include "r_utility.h"
|
|
||||||
//#include "g_levellocals.h"
|
|
||||||
#include "s_soundinternal.h"
|
#include "s_soundinternal.h"
|
||||||
//#include "vm.h"
|
#include "vm.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "gstrings.h"
|
#include "gstrings.h"
|
||||||
#include "s_music.h"
|
#include "s_music.h"
|
||||||
|
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
#include "st_start.h"
|
#include "st_start.h"
|
||||||
|
#include "i_interface.h"
|
||||||
|
#include "startupinfo.h"
|
||||||
|
#include "printf.h"
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -88,7 +87,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TYPES -------------------------------------------------------------------
|
// TYPES -------------------------------------------------------------------
|
||||||
bool batchrun;
|
|
||||||
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
||||||
|
|
||||||
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
|
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
|
||||||
|
@ -96,6 +95,7 @@ void CreateCrashLog (const char *custominfo, DWORD customsize, HWND richedit);
|
||||||
void DisplayCrashLog ();
|
void DisplayCrashLog ();
|
||||||
void I_FlushBufferedConsoleStuff();
|
void I_FlushBufferedConsoleStuff();
|
||||||
void DestroyCustomCursor();
|
void DestroyCustomCursor();
|
||||||
|
int GameMain();
|
||||||
|
|
||||||
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
||||||
|
|
||||||
|
@ -268,14 +268,12 @@ void LayoutMainWindow (HWND hWnd, HWND pane)
|
||||||
w = rect.right;
|
w = rect.right;
|
||||||
h = rect.bottom;
|
h = rect.bottom;
|
||||||
|
|
||||||
/*
|
if (GameStartupInfo.Name.IsNotEmpty() && GameTitleWindow != NULL)
|
||||||
if (userConfig..IsNotEmpty() && GameTitleWindow != NULL)
|
|
||||||
{
|
{
|
||||||
bannerheight = GameTitleFontHeight + 5;
|
bannerheight = GameTitleFontHeight + 5;
|
||||||
MoveWindow (GameTitleWindow, 0, 0, w, bannerheight, TRUE);
|
MoveWindow (GameTitleWindow, 0, 0, w, bannerheight, TRUE);
|
||||||
InvalidateRect (GameTitleWindow, NULL, FALSE);
|
InvalidateRect (GameTitleWindow, NULL, FALSE);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
if (ProgressBar != NULL)
|
if (ProgressBar != NULL)
|
||||||
{
|
{
|
||||||
// Base the height of the progress bar on the height of a scroll bar
|
// Base the height of the progress bar on the height of a scroll bar
|
||||||
|
@ -340,14 +338,14 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
HWND view;
|
HWND view;
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
//HBRUSH hbr;
|
HBRUSH hbr;
|
||||||
HGDIOBJ oldfont;
|
HGDIOBJ oldfont;
|
||||||
//RECT rect;
|
RECT rect;
|
||||||
//SIZE size;
|
SIZE size;
|
||||||
LOGFONT lf;
|
LOGFONT lf;
|
||||||
TEXTMETRIC tm;
|
TEXTMETRIC tm;
|
||||||
HINSTANCE inst = (HINSTANCE)(LONG_PTR)GetWindowLongPtr(hWnd, GWLP_HINSTANCE);
|
HINSTANCE inst = (HINSTANCE)(LONG_PTR)GetWindowLongPtr(hWnd, GWLP_HINSTANCE);
|
||||||
//DRAWITEMSTRUCT *drawitem;
|
DRAWITEMSTRUCT *drawitem;
|
||||||
CHARFORMAT2W format;
|
CHARFORMAT2W format;
|
||||||
|
|
||||||
switch (msg)
|
switch (msg)
|
||||||
|
@ -428,45 +426,73 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
case WM_DRAWITEM:
|
case WM_DRAWITEM:
|
||||||
// Draw title banner.
|
// Draw title banner.
|
||||||
if (wParam == IDC_STATIC_TITLE && RazeStartupInfo.Name.IsNotEmpty())
|
if (wParam == IDC_STATIC_TITLE && GameStartupInfo.Name.IsNotEmpty())
|
||||||
{
|
{
|
||||||
const PalEntry *c;
|
const PalEntry *c;
|
||||||
|
|
||||||
// Draw the game title strip at the top of the window.
|
// Draw the game title strip at the top of the window.
|
||||||
auto drawitem = (LPDRAWITEMSTRUCT)lParam;
|
drawitem = (LPDRAWITEMSTRUCT)lParam;
|
||||||
SIZE size;
|
|
||||||
|
|
||||||
// Draw the background.
|
// Draw the background.
|
||||||
auto rect = drawitem->rcItem;
|
rect = drawitem->rcItem;
|
||||||
rect.bottom -= 1;
|
rect.bottom -= 1;
|
||||||
c = (const PalEntry *)&RazeStartupInfo.BkColor;
|
c = (const PalEntry *)&GameStartupInfo.BkColor;
|
||||||
auto hbr = CreateSolidBrush (RGB(c->r,c->g,c->b));
|
hbr = CreateSolidBrush (RGB(c->r,c->g,c->b));
|
||||||
FillRect (drawitem->hDC, &drawitem->rcItem, hbr);
|
FillRect (drawitem->hDC, &drawitem->rcItem, hbr);
|
||||||
DeleteObject (hbr);
|
DeleteObject (hbr);
|
||||||
|
|
||||||
// Calculate width of the title string.
|
// Calculate width of the title string.
|
||||||
SetTextAlign (drawitem->hDC, TA_TOP);
|
SetTextAlign (drawitem->hDC, TA_TOP);
|
||||||
oldfont = SelectObject (drawitem->hDC, GameTitleFont != NULL ? GameTitleFont : (HFONT)GetStockObject (DEFAULT_GUI_FONT));
|
oldfont = SelectObject (drawitem->hDC, GameTitleFont != NULL ? GameTitleFont : (HFONT)GetStockObject (DEFAULT_GUI_FONT));
|
||||||
auto widename = RazeStartupInfo.Name.WideString();
|
auto widename = GameStartupInfo.Name.WideString();
|
||||||
GetTextExtentPoint32W (drawitem->hDC, widename.c_str(), (int)widename.length(), &size);
|
GetTextExtentPoint32W (drawitem->hDC, widename.c_str(), (int)widename.length(), &size);
|
||||||
|
|
||||||
// Draw the title.
|
// Draw the title.
|
||||||
c = (const PalEntry *)&RazeStartupInfo.FgColor;
|
c = (const PalEntry *)&GameStartupInfo.FgColor;
|
||||||
SetTextColor (drawitem->hDC, RGB(c->r,c->g,c->b));
|
SetTextColor (drawitem->hDC, RGB(c->r,c->g,c->b));
|
||||||
SetBkMode (drawitem->hDC, TRANSPARENT);
|
SetBkMode (drawitem->hDC, TRANSPARENT);
|
||||||
TextOutW (drawitem->hDC, rect.left + (rect.right - rect.left - size.cx) / 2, 2, widename.c_str(), (int)widename.length());
|
TextOutW (drawitem->hDC, rect.left + (rect.right - rect.left - size.cx) / 2, 2, widename.c_str(), (int)widename.length());
|
||||||
SelectObject (drawitem->hDC, oldfont);
|
SelectObject (drawitem->hDC, oldfont);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
// Draw startup screen
|
||||||
|
else if (wParam == IDC_STATIC_STARTUP)
|
||||||
|
{
|
||||||
|
if (StartupScreen != NULL)
|
||||||
|
{
|
||||||
|
drawitem = (LPDRAWITEMSTRUCT)lParam;
|
||||||
|
|
||||||
|
rect = drawitem->rcItem;
|
||||||
|
// Windows expects DIBs to be bottom-up but ours is top-down,
|
||||||
|
// so flip it vertically while drawing it.
|
||||||
|
StretchDIBits (drawitem->hDC, rect.left, rect.bottom - 1, rect.right - rect.left, rect.top - rect.bottom,
|
||||||
|
0, 0, StartupBitmap->bmiHeader.biWidth, StartupBitmap->bmiHeader.biHeight,
|
||||||
|
ST_Util_BitsForBitmap(StartupBitmap), reinterpret_cast<const BITMAPINFO*>(StartupBitmap), DIB_RGB_COLORS, SRCCOPY);
|
||||||
|
|
||||||
|
// If the title banner is gone, then this is an ENDOOM screen, so draw a short prompt
|
||||||
|
// where the command prompt would have been in DOS.
|
||||||
|
if (GameTitleWindow == NULL)
|
||||||
|
{
|
||||||
|
auto quitmsg = WideString(GStrings("TXT_QUITENDOOM"));
|
||||||
|
|
||||||
|
SetTextColor (drawitem->hDC, RGB(240,240,240));
|
||||||
|
SetBkMode (drawitem->hDC, TRANSPARENT);
|
||||||
|
oldfont = SelectObject (drawitem->hDC, (HFONT)GetStockObject (DEFAULT_GUI_FONT));
|
||||||
|
TextOutW (drawitem->hDC, 3, drawitem->rcItem.bottom - DefaultGUIFontHeight - 3, quitmsg.c_str(), (int)quitmsg.length());
|
||||||
|
SelectObject (drawitem->hDC, oldfont);
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
// Draw stop icon.
|
// Draw stop icon.
|
||||||
else if (wParam == IDC_ICONPIC)
|
else if (wParam == IDC_ICONPIC)
|
||||||
{
|
{
|
||||||
HICON icon;
|
HICON icon;
|
||||||
POINTL char_pos;
|
POINTL char_pos;
|
||||||
auto drawitem = (LPDRAWITEMSTRUCT)lParam;
|
drawitem = (LPDRAWITEMSTRUCT)lParam;
|
||||||
|
|
||||||
// This background color should match the edit control's.
|
// This background color should match the edit control's.
|
||||||
auto hbr = CreateSolidBrush (RGB(70,70,70));
|
hbr = CreateSolidBrush (RGB(70,70,70));
|
||||||
FillRect (drawitem->hDC, &drawitem->rcItem, hbr);
|
FillRect (drawitem->hDC, &drawitem->rcItem, hbr);
|
||||||
DeleteObject (hbr);
|
DeleteObject (hbr);
|
||||||
|
|
||||||
|
@ -613,12 +639,10 @@ void ShowErrorPane(const char *text)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (StartScreen != NULL) // Ensure that the network pane is hidden.
|
if (StartScreen != NULL) // Ensure that the network pane is hidden.
|
||||||
{
|
{
|
||||||
StartScreen->NetDone();
|
StartScreen->NetDone();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (text != NULL)
|
if (text != NULL)
|
||||||
{
|
{
|
||||||
FStringf caption("Fatal Error - " GAMENAME " %s " X64 " (%s)", GetVersionString(), GetGitTime());
|
FStringf caption("Fatal Error - " GAMENAME " %s " X64 " (%s)", GetVersionString(), GetGitTime());
|
||||||
|
@ -959,6 +983,11 @@ void I_ShowFatalError(const char *msg)
|
||||||
S_StopMusic(true);
|
S_StopMusic(true);
|
||||||
I_FlushBufferedConsoleStuff();
|
I_FlushBufferedConsoleStuff();
|
||||||
|
|
||||||
|
if (CVMAbortException::stacktrace.IsNotEmpty())
|
||||||
|
{
|
||||||
|
Printf("%s", CVMAbortException::stacktrace.GetChars());
|
||||||
|
}
|
||||||
|
|
||||||
if (!batchrun)
|
if (!batchrun)
|
||||||
{
|
{
|
||||||
ShowErrorPane(msg);
|
ShowErrorPane(msg);
|
||||||
|
@ -969,34 +998,6 @@ void I_ShowFatalError(const char *msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// DoomSpecificInfo
|
|
||||||
//
|
|
||||||
// Called by the crash logger to get application-specific information.
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void DoomSpecificInfo (char *buffer, size_t bufflen)
|
|
||||||
{
|
|
||||||
const char *arg;
|
|
||||||
char *const buffend = buffer + bufflen - 2; // -2 for CRLF at end
|
|
||||||
int i;
|
|
||||||
|
|
||||||
buffer += snprintf (buffer, buffend - buffer, GAMENAME " version %s (%s)", GetVersionString(), GetGitHash());
|
|
||||||
FString cmdline(GetCommandLineW());
|
|
||||||
buffer += snprintf (buffer, buffend - buffer, "\r\nCommand line: %s\r\n", cmdline.GetChars() );
|
|
||||||
|
|
||||||
for (i = 0; (arg = fileSystem.GetResourceFileFullName (i)) != NULL; ++i)
|
|
||||||
{
|
|
||||||
buffer += snprintf (buffer, buffend - buffer, "\r\nFile %d: %s", i, arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
*buffer++ = '\r';
|
|
||||||
*buffer++ = '\n';
|
|
||||||
*buffer++ = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Here is how the error logging system works.
|
// Here is how the error logging system works.
|
||||||
//
|
//
|
||||||
// To catch exceptions that occur in secondary threads, CatchAllExceptions is
|
// To catch exceptions that occur in secondary threads, CatchAllExceptions is
|
||||||
|
@ -1089,7 +1090,7 @@ LONG WINAPI CatchAllExceptions (LPEXCEPTION_POINTERS info)
|
||||||
char *custominfo = (char *)HeapAlloc (GetProcessHeap(), 0, 16384);
|
char *custominfo = (char *)HeapAlloc (GetProcessHeap(), 0, 16384);
|
||||||
|
|
||||||
CrashPointers = *info;
|
CrashPointers = *info;
|
||||||
DoomSpecificInfo (custominfo, 16384);
|
if (sysCallbacks && sysCallbacks->CrashInfo && custominfo) sysCallbacks->CrashInfo(custominfo, 16384, "\r\n");
|
||||||
CreateCrashLog (custominfo, (DWORD)strlen(custominfo), ConWindow);
|
CreateCrashLog (custominfo, (DWORD)strlen(custominfo), ConWindow);
|
||||||
|
|
||||||
// If the main thread crashed, then make it clean up after itself.
|
// If the main thread crashed, then make it clean up after itself.
|
||||||
|
@ -1223,8 +1224,7 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE nothing, LPWSTR cmdline, int
|
||||||
_CrtSetDbgFlag (_CrtSetDbgFlag(0) | _CRTDBG_LEAK_CHECK_DF);
|
_CrtSetDbgFlag (_CrtSetDbgFlag(0) | _CRTDBG_LEAK_CHECK_DF);
|
||||||
|
|
||||||
// Use this to break at a specific allocation number.
|
// Use this to break at a specific allocation number.
|
||||||
|
//_crtBreakAlloc = 227524;
|
||||||
//_crtBreakAlloc = 254849;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int ret = DoMain (hInstance);
|
int ret = DoMain (hInstance);
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#include "d_gui.h"
|
#include "d_gui.h"
|
||||||
#include "hardware.h"
|
#include "hardware.h"
|
||||||
#include "menu/menu.h"
|
#include "menu/menu.h"
|
||||||
|
#include "i_interface.h"
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -138,6 +139,7 @@ static void CenterMouse(int x, int y, LONG *centx, LONG *centy);
|
||||||
extern HWND Window;
|
extern HWND Window;
|
||||||
extern LPDIRECTINPUT8 g_pdi;
|
extern LPDIRECTINPUT8 g_pdi;
|
||||||
extern LPDIRECTINPUT g_pdi3;
|
extern LPDIRECTINPUT g_pdi3;
|
||||||
|
extern bool GUICapture;
|
||||||
extern int BlockMouseMove;
|
extern int BlockMouseMove;
|
||||||
|
|
||||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||||
|
@ -162,7 +164,7 @@ CVAR (Bool, m_noprescale, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
CVAR (Bool, m_filter, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
CVAR (Bool, m_filter, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
CVAR (Bool, m_hidepointer, true, 0)
|
CVAR (Bool, m_hidepointer, true, 0)
|
||||||
|
|
||||||
CUSTOM_CVAR (Int, in_mouse, 2, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
|
CUSTOM_CVAR (Int, in_mouse, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
|
||||||
{
|
{
|
||||||
if (self < 0)
|
if (self < 0)
|
||||||
{
|
{
|
||||||
|
@ -178,19 +180,6 @@ CUSTOM_CVAR (Int, in_mouse, 2, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CUSTOM_CVAR(Int, mouse_capturemode, 1, CVAR_GLOBALCONFIG|CVAR_ARCHIVE)
|
|
||||||
{
|
|
||||||
if (self < 0)
|
|
||||||
{
|
|
||||||
self = 0;
|
|
||||||
}
|
|
||||||
else if (self > 2)
|
|
||||||
{
|
|
||||||
self = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// CODE --------------------------------------------------------------------
|
// CODE --------------------------------------------------------------------
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -248,24 +237,6 @@ static void CenterMouse(int curx, int cury, LONG *centxp, LONG *centyp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// CaptureMode_InGame
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
static bool CaptureMode_InGame()
|
|
||||||
{
|
|
||||||
if (mouse_capturemode == 2)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return gi->CanSave();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// I_CheckNativeMouse
|
// I_CheckNativeMouse
|
||||||
|
@ -275,11 +246,40 @@ static bool CaptureMode_InGame()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
extern bool grab_mouse;
|
|
||||||
|
|
||||||
void I_CheckNativeMouse(bool preferNative, bool eventhandlerresult)
|
void I_CheckNativeMouse(bool preferNative, bool eventhandlerresult)
|
||||||
{
|
{
|
||||||
bool want_native = !grab_mouse || preferNative;
|
bool windowed = (screen == NULL) || !screen->IsFullscreen();
|
||||||
|
bool want_native;
|
||||||
|
|
||||||
|
if (!windowed)
|
||||||
|
{
|
||||||
|
// ungrab mouse when in the menu with mouse control on.
|
||||||
|
want_native = m_use_mouse && (menuactive == MENU_On || menuactive == MENU_OnNoPause);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((GetForegroundWindow() != Window) || preferNative || !use_mouse)
|
||||||
|
{
|
||||||
|
want_native = true;
|
||||||
|
}
|
||||||
|
else if (menuactive == MENU_WaitKey)
|
||||||
|
{
|
||||||
|
want_native = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bool pauseState = false;
|
||||||
|
bool captureModeInGame = sysCallbacks && sysCallbacks->CaptureModeInGame && sysCallbacks->CaptureModeInGame();
|
||||||
|
want_native = ((!m_use_mouse || menuactive != MENU_WaitKey) &&
|
||||||
|
(!captureModeInGame || GUICapture));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!want_native && eventhandlerresult)
|
||||||
|
want_native = true;
|
||||||
|
|
||||||
|
//Printf ("%d %d %d\n", wantNative, preferNative, NativeMouse);
|
||||||
|
|
||||||
if (want_native != NativeMouse)
|
if (want_native != NativeMouse)
|
||||||
{
|
{
|
||||||
if (Mouse != NULL)
|
if (Mouse != NULL)
|
||||||
|
@ -382,9 +382,8 @@ void FMouse::WheelMoved(int axis, int wheelmove)
|
||||||
{
|
{
|
||||||
ev.type = EV_KeyDown;
|
ev.type = EV_KeyDown;
|
||||||
D_PostEvent(&ev);
|
D_PostEvent(&ev);
|
||||||
// The Up events must be delayed so that the wheel can remain in a "pressed" state for the next tic's duration.
|
ev.type = EV_KeyUp;
|
||||||
//ev.type = EV_KeyUp;
|
D_PostEvent(&ev);
|
||||||
//D_PostEvent(&ev);
|
|
||||||
WheelMove[axis] += dir;
|
WheelMove[axis] += dir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,8 +41,8 @@
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "gameconfigfile.h"
|
#include "gameconfigfile.h"
|
||||||
#include "m_argv.h"
|
#include "m_argv.h"
|
||||||
#include "keydef.h"
|
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
|
#include "keydef.h"
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,6 @@
|
||||||
#include "findfile.h"
|
#include "findfile.h"
|
||||||
#include "version.h" // for GAMENAME
|
#include "version.h" // for GAMENAME
|
||||||
|
|
||||||
// Stuff that needs to be set up later.
|
|
||||||
|
|
||||||
// Vanilla MinGW does not have folder ids
|
// Vanilla MinGW does not have folder ids
|
||||||
#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
|
#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
|
||||||
static const GUID FOLDERID_LocalAppData = { 0xf1b32785, 0x6fba, 0x4fcf, 0x9d, 0x55, 0x7b, 0x8e, 0x7f, 0x15, 0x70, 0x91 };
|
static const GUID FOLDERID_LocalAppData = { 0xf1b32785, 0x6fba, 0x4fcf, 0x9d, 0x55, 0x7b, 0x8e, 0x7f, 0x15, 0x70, 0x91 };
|
||||||
|
@ -138,6 +136,33 @@ FString M_GetAppDataPath(bool create)
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// M_GetCachePath Windows
|
||||||
|
//
|
||||||
|
// Returns the path for cache GL nodes.
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
FString M_GetCachePath(bool create)
|
||||||
|
{
|
||||||
|
FString path;
|
||||||
|
|
||||||
|
if (!GetKnownFolder(CSIDL_LOCAL_APPDATA, FOLDERID_LocalAppData, create, path))
|
||||||
|
{ // Failed (e.g. On Win9x): use program directory
|
||||||
|
path = progdir;
|
||||||
|
}
|
||||||
|
// Don't use GAME_DIR and such so that ZDoom and its child ports can
|
||||||
|
// share the node cache.
|
||||||
|
path += "/zdoom/cache";
|
||||||
|
path.Substitute("//", "/"); // needed because progdir ends with a slash.
|
||||||
|
if (create)
|
||||||
|
{
|
||||||
|
CreatePath(path);
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
// M_GetAutoexecPath Windows
|
// M_GetAutoexecPath Windows
|
||||||
|
@ -332,9 +357,9 @@ FString M_GetDocumentsPath()
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
// M_GetDocumentsPath Windows
|
// M_GetDemoPath Windows
|
||||||
//
|
//
|
||||||
// Returns the path to the default documents directory.
|
// Returns the path to the default demp directory.
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
|
|
39
source/platform/win32/i_steam.cpp
Normal file
39
source/platform/win32/i_steam.cpp
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
#include <shlwapi.h>
|
||||||
|
|
||||||
|
#include "zstring.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// QueryPathKey
|
||||||
|
//
|
||||||
|
// Returns the value of a registry key into the output variable value.
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
bool I_QueryPathKey(const wchar_t* keypath, const wchar_t* valname, FString& value)
|
||||||
|
{
|
||||||
|
HKEY pathkey;
|
||||||
|
DWORD pathtype;
|
||||||
|
DWORD pathlen;
|
||||||
|
LONG res;
|
||||||
|
|
||||||
|
value = "";
|
||||||
|
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, keypath, 0, KEY_QUERY_VALUE, &pathkey))
|
||||||
|
{
|
||||||
|
if (ERROR_SUCCESS == RegQueryValueEx(pathkey, valname, 0, &pathtype, NULL, &pathlen) &&
|
||||||
|
pathtype == REG_SZ && pathlen != 0)
|
||||||
|
{
|
||||||
|
// Don't include terminating null in count
|
||||||
|
TArray<wchar_t> chars(pathlen + 1, true);
|
||||||
|
res = RegQueryValueEx(pathkey, valname, 0, NULL, (LPBYTE)chars.Data(), &pathlen);
|
||||||
|
if (res == ERROR_SUCCESS) value = FString(chars.Data());
|
||||||
|
}
|
||||||
|
RegCloseKey(pathkey);
|
||||||
|
}
|
||||||
|
return value.IsNotEmpty();
|
||||||
|
}
|
||||||
|
|
|
@ -70,7 +70,6 @@
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
#include "v_text.h"
|
#include "v_text.h"
|
||||||
#include "utf8.h"
|
#include "utf8.h"
|
||||||
#include "gamecontrol.h"
|
|
||||||
|
|
||||||
#include "i_input.h"
|
#include "i_input.h"
|
||||||
#include "c_dispatch.h"
|
#include "c_dispatch.h"
|
||||||
|
@ -80,8 +79,8 @@
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "bitmap.h"
|
#include "bitmap.h"
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
|
#include "i_interface.h"
|
||||||
|
|
||||||
extern bool batchrun;
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
@ -94,7 +93,6 @@ extern bool batchrun;
|
||||||
|
|
||||||
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
||||||
|
|
||||||
//extern void CheckCPUID(CPUInfo *cpu);
|
|
||||||
extern void LayoutMainWindow(HWND hWnd, HWND pane);
|
extern void LayoutMainWindow(HWND hWnd, HWND pane);
|
||||||
|
|
||||||
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
||||||
|
@ -103,8 +101,6 @@ void DestroyCustomCursor();
|
||||||
|
|
||||||
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
||||||
|
|
||||||
static void CalculateCPUSpeed();
|
|
||||||
|
|
||||||
static HCURSOR CreateCompatibleCursor(FBitmap &cursorpic, int leftofs, int topofs);
|
static HCURSOR CreateCompatibleCursor(FBitmap &cursorpic, int leftofs, int topofs);
|
||||||
static HCURSOR CreateAlphaCursor(FBitmap &cursorpic, int leftofs, int topofs);
|
static HCURSOR CreateAlphaCursor(FBitmap &cursorpic, int leftofs, int topofs);
|
||||||
static HCURSOR CreateBitmapCursor(int xhot, int yhot, HBITMAP and_mask, HBITMAP color_mask);
|
static HCURSOR CreateBitmapCursor(int xhot, int yhot, HBITMAP and_mask, HBITMAP color_mask);
|
||||||
|
@ -145,7 +141,6 @@ static int DefaultWad;
|
||||||
|
|
||||||
static HCURSOR CustomCursor;
|
static HCURSOR CustomCursor;
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// I_DetectOS
|
// I_DetectOS
|
||||||
|
@ -171,24 +166,7 @@ void I_DetectOS(void)
|
||||||
{
|
{
|
||||||
case VER_PLATFORM_WIN32_NT:
|
case VER_PLATFORM_WIN32_NT:
|
||||||
osname = "NT";
|
osname = "NT";
|
||||||
if (info.dwMajorVersion == 5)
|
if (info.dwMajorVersion == 6)
|
||||||
{
|
|
||||||
if (info.dwMinorVersion == 0)
|
|
||||||
{
|
|
||||||
osname = "2000";
|
|
||||||
}
|
|
||||||
if (info.dwMinorVersion == 1)
|
|
||||||
{
|
|
||||||
osname = "XP";
|
|
||||||
sys_ostype = 1; // legacy OS
|
|
||||||
}
|
|
||||||
else if (info.dwMinorVersion == 2)
|
|
||||||
{
|
|
||||||
osname = "Server 2003";
|
|
||||||
sys_ostype = 1; // legacy OS
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (info.dwMajorVersion == 6)
|
|
||||||
{
|
{
|
||||||
if (info.dwMinorVersion == 0)
|
if (info.dwMinorVersion == 0)
|
||||||
{
|
{
|
||||||
|
@ -215,12 +193,12 @@ void I_DetectOS(void)
|
||||||
}
|
}
|
||||||
else if (info.dwMinorVersion == 4)
|
else if (info.dwMinorVersion == 4)
|
||||||
{
|
{
|
||||||
osname = (info.wProductType == VER_NT_WORKSTATION) ? "10 (beta)" : "Server 10 (beta)";
|
osname = (info.wProductType == VER_NT_WORKSTATION) ? "10 (beta)" : "Server 2016 (beta)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (info.dwMajorVersion == 10)
|
else if (info.dwMajorVersion == 10)
|
||||||
{
|
{
|
||||||
osname = (info.wProductType == VER_NT_WORKSTATION) ? "10 (or higher)" : "Server 10 (or higher)";
|
osname = (info.wProductType == VER_NT_WORKSTATION) ? "10 (or higher)" : "Server 2016 (or higher)";
|
||||||
sys_ostype = 3; // modern OS
|
sys_ostype = 3; // modern OS
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -292,20 +270,6 @@ void CalculateCPUSpeed()
|
||||||
if (!batchrun) Printf ("CPU speed: %.0f MHz\n", 0.001 / PerfToMillisec);
|
if (!batchrun) Printf ("CPU speed: %.0f MHz\n", 0.001 / PerfToMillisec);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// I_Init
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void I_Init()
|
|
||||||
{
|
|
||||||
//CheckCPUID(&CPU);
|
|
||||||
CalculateCPUSpeed();
|
|
||||||
//DumpCPUInfo(&CPU);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// I_PrintStr
|
// I_PrintStr
|
||||||
|
@ -394,6 +358,31 @@ static void DoPrintStr(const char *cpt, HWND edit, HANDLE StdOut)
|
||||||
{
|
{
|
||||||
// Change the color of future text added to the control.
|
// Change the color of future text added to the control.
|
||||||
PalEntry color = V_LogColorFromColorRange(range);
|
PalEntry color = V_LogColorFromColorRange(range);
|
||||||
|
if (StdOut != NULL && FancyStdOut)
|
||||||
|
{
|
||||||
|
// Unfortunately, we are pretty limited here: There are only
|
||||||
|
// eight basic colors, and each comes in a dark and a bright
|
||||||
|
// variety.
|
||||||
|
float h, s, v, r, g, b;
|
||||||
|
int attrib = 0;
|
||||||
|
|
||||||
|
RGBtoHSV(color.r / 255.f, color.g / 255.f, color.b / 255.f, &h, &s, &v);
|
||||||
|
if (s != 0)
|
||||||
|
{ // color
|
||||||
|
HSVtoRGB(&r, &g, &b, h, 1, 1);
|
||||||
|
if (r == 1) attrib = FOREGROUND_RED;
|
||||||
|
if (g == 1) attrib |= FOREGROUND_GREEN;
|
||||||
|
if (b == 1) attrib |= FOREGROUND_BLUE;
|
||||||
|
if (v > 0.6) attrib |= FOREGROUND_INTENSITY;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // gray
|
||||||
|
if (v < 0.33) attrib = FOREGROUND_INTENSITY;
|
||||||
|
else if (v < 0.90) attrib = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
|
||||||
|
else attrib = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY;
|
||||||
|
}
|
||||||
|
SetConsoleTextAttribute(StdOut, (WORD)attrib);
|
||||||
|
}
|
||||||
if (edit != NULL)
|
if (edit != NULL)
|
||||||
{
|
{
|
||||||
// GDI uses BGR colors, but color is RGB, so swap the R and the B.
|
// GDI uses BGR colors, but color is RGB, so swap the R and the B.
|
||||||
|
@ -538,8 +527,8 @@ BOOL CALLBACK IWADBoxCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
|
|
||||||
// [SP] This is our's
|
// [SP] This is our's
|
||||||
SendDlgItemMessage( hDlg, IDC_WELCOME_NOAUTOLOAD, BM_SETCHECK, disableautoload ? BST_CHECKED : BST_UNCHECKED, 0 );
|
SendDlgItemMessage( hDlg, IDC_WELCOME_NOAUTOLOAD, BM_SETCHECK, disableautoload ? BST_CHECKED : BST_UNCHECKED, 0 );
|
||||||
//SendDlgItemMessage( hDlg, IDC_WELCOME_LIGHTS, BM_SETCHECK, autoloadlights ? BST_CHECKED : BST_UNCHECKED, 0 );
|
SendDlgItemMessage( hDlg, IDC_WELCOME_LIGHTS, BM_SETCHECK, autoloadlights ? BST_CHECKED : BST_UNCHECKED, 0 );
|
||||||
//SendDlgItemMessage( hDlg, IDC_WELCOME_BRIGHTMAPS, BM_SETCHECK, autoloadbrightmaps ? BST_CHECKED : BST_UNCHECKED, 0 );
|
SendDlgItemMessage( hDlg, IDC_WELCOME_BRIGHTMAPS, BM_SETCHECK, autoloadbrightmaps ? BST_CHECKED : BST_UNCHECKED, 0 );
|
||||||
|
|
||||||
// Set up our version string.
|
// Set up our version string.
|
||||||
sprintf(szString, "Version %s.", GetVersionString());
|
sprintf(szString, "Version %s.", GetVersionString());
|
||||||
|
@ -592,8 +581,8 @@ BOOL CALLBACK IWADBoxCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
|
|
||||||
// [SP] This is our's.
|
// [SP] This is our's.
|
||||||
disableautoload = SendDlgItemMessage( hDlg, IDC_WELCOME_NOAUTOLOAD, BM_GETCHECK, 0, 0 ) == BST_CHECKED;
|
disableautoload = SendDlgItemMessage( hDlg, IDC_WELCOME_NOAUTOLOAD, BM_GETCHECK, 0, 0 ) == BST_CHECKED;
|
||||||
//autoloadlights = SendDlgItemMessage( hDlg, IDC_WELCOME_LIGHTS, BM_GETCHECK, 0, 0 ) == BST_CHECKED;
|
autoloadlights = SendDlgItemMessage( hDlg, IDC_WELCOME_LIGHTS, BM_GETCHECK, 0, 0 ) == BST_CHECKED;
|
||||||
//autoloadbrightmaps = SendDlgItemMessage( hDlg, IDC_WELCOME_BRIGHTMAPS, BM_GETCHECK, 0, 0 ) == BST_CHECKED;
|
autoloadbrightmaps = SendDlgItemMessage( hDlg, IDC_WELCOME_BRIGHTMAPS, BM_GETCHECK, 0, 0 ) == BST_CHECKED;
|
||||||
ctrl = GetDlgItem (hDlg, IDC_IWADLIST);
|
ctrl = GetDlgItem (hDlg, IDC_IWADLIST);
|
||||||
EndDialog(hDlg, SendMessage (ctrl, LB_GETCURSEL, 0, 0));
|
EndDialog(hDlg, SendMessage (ctrl, LB_GETCURSEL, 0, 0));
|
||||||
}
|
}
|
||||||
|
@ -650,7 +639,7 @@ bool I_SetCursor(FGameTexture *cursorpic)
|
||||||
{
|
{
|
||||||
HCURSOR cursor;
|
HCURSOR cursor;
|
||||||
|
|
||||||
if (cursorpic != NULL)
|
if (cursorpic != NULL && cursorpic->isValid())
|
||||||
{
|
{
|
||||||
auto image = cursorpic->GetTexture()->GetBgraBitmap(nullptr);
|
auto image = cursorpic->GetTexture()->GetBgraBitmap(nullptr);
|
||||||
// Must be no larger than 32x32. (is this still necessary?
|
// Must be no larger than 32x32. (is this still necessary?
|
||||||
|
@ -659,8 +648,8 @@ bool I_SetCursor(FGameTexture *cursorpic)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Fixme: This should get a raw image, not a texture. (Once raw images get implemented.)
|
// Fixme: This should get a raw image, not a texture. (Once raw images get implemented.)
|
||||||
int lo = cursorpic->GetTexelLeftOffset(0);
|
int lo = cursorpic->GetTexelLeftOffset();
|
||||||
int to = cursorpic->GetTexelTopOffset(0);
|
int to = cursorpic->GetTexelTopOffset();
|
||||||
|
|
||||||
cursor = CreateAlphaCursor(image, lo, to);
|
cursor = CreateAlphaCursor(image, lo, to);
|
||||||
if (cursor == NULL)
|
if (cursor == NULL)
|
||||||
|
@ -1089,35 +1078,3 @@ void I_SetThreadNumaNode(std::thread &thread, int numaNode)
|
||||||
SetThreadAffinityMask(handle, (DWORD_PTR)numaNodes[numaNode].affinityMask);
|
SetThreadAffinityMask(handle, (DWORD_PTR)numaNodes[numaNode].affinityMask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// QueryPathKey
|
|
||||||
//
|
|
||||||
// Returns the value of a registry key into the output variable value.
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
bool I_QueryPathKey(const wchar_t* keypath, const wchar_t* valname, FString& value)
|
|
||||||
{
|
|
||||||
HKEY pathkey;
|
|
||||||
DWORD pathtype;
|
|
||||||
DWORD pathlen;
|
|
||||||
LONG res;
|
|
||||||
|
|
||||||
value = "";
|
|
||||||
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, keypath, 0, KEY_QUERY_VALUE, &pathkey))
|
|
||||||
{
|
|
||||||
if (ERROR_SUCCESS == RegQueryValueEx(pathkey, valname, 0, &pathtype, NULL, &pathlen) &&
|
|
||||||
pathtype == REG_SZ && pathlen != 0)
|
|
||||||
{
|
|
||||||
// Don't include terminating null in count
|
|
||||||
TArray<wchar_t> chars(pathlen + 1, true);
|
|
||||||
res = RegQueryValueEx(pathkey, valname, 0, NULL, (LPBYTE)chars.Data(), &pathlen);
|
|
||||||
if (res == ERROR_SUCCESS) value = FString(chars.Data());
|
|
||||||
}
|
|
||||||
RegCloseKey(pathkey);
|
|
||||||
}
|
|
||||||
return value.IsNotEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ struct WadStuff;
|
||||||
void I_DetectOS (void);
|
void I_DetectOS (void);
|
||||||
|
|
||||||
// Called by DoomMain.
|
// Called by DoomMain.
|
||||||
void I_Init (void);
|
void CalculateCPUSpeed (void);
|
||||||
|
|
||||||
// Return a seed value for the RNG.
|
// Return a seed value for the RNG.
|
||||||
unsigned int I_MakeRNGSeed();
|
unsigned int I_MakeRNGSeed();
|
||||||
|
@ -59,8 +59,6 @@ ticcmd_t *I_BaseTiccmd (void);
|
||||||
void I_Quit (void);
|
void I_Quit (void);
|
||||||
|
|
||||||
|
|
||||||
void I_Tactile (int on, int off, int total);
|
|
||||||
|
|
||||||
// Set the mouse cursor. The texture must be 32x32.
|
// Set the mouse cursor. The texture must be 32x32.
|
||||||
class FGameTexture;
|
class FGameTexture;
|
||||||
bool I_SetCursor(FGameTexture *cursor);
|
bool I_SetCursor(FGameTexture *cursor);
|
||||||
|
@ -104,8 +102,6 @@ typedef long WLONG_PTR;
|
||||||
// Wrapper for GetLongPathName
|
// Wrapper for GetLongPathName
|
||||||
FString I_GetLongPathName(const FString &shortpath);
|
FString I_GetLongPathName(const FString &shortpath);
|
||||||
|
|
||||||
// Directory searching routines
|
|
||||||
|
|
||||||
// Mirror WIN32_FIND_DATAA in <winbase.h>
|
// Mirror WIN32_FIND_DATAA in <winbase.h>
|
||||||
#ifndef MAX_PATH
|
#ifndef MAX_PATH
|
||||||
#define MAX_PATH 260
|
#define MAX_PATH 260
|
||||||
|
@ -114,7 +110,6 @@ FString I_GetLongPathName(const FString &shortpath);
|
||||||
#define PATH_MAX 260
|
#define PATH_MAX 260
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int I_GetNumaNodeCount();
|
int I_GetNumaNodeCount();
|
||||||
int I_GetNumaNodeThreadCount(int numaNode);
|
int I_GetNumaNodeThreadCount(int numaNode);
|
||||||
void I_SetThreadNumaNode(std::thread &thread, int numaNode);
|
void I_SetThreadNumaNode(std::thread &thread, int numaNode);
|
||||||
|
|
|
@ -31,8 +31,6 @@
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NO_XINPUT
|
|
||||||
|
|
||||||
// HEADER FILES ------------------------------------------------------------
|
// HEADER FILES ------------------------------------------------------------
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
@ -45,6 +43,7 @@
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "gameconfigfile.h"
|
#include "gameconfigfile.h"
|
||||||
#include "m_argv.h"
|
#include "m_argv.h"
|
||||||
|
#include "cmdlib.h"
|
||||||
#include "keydef.h"
|
#include "keydef.h"
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
@ -830,13 +829,3 @@ void I_StartupXInput()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // NO_XINPUT
|
|
||||||
|
|
||||||
#include "i_input.h"
|
|
||||||
|
|
||||||
void I_StartupXInput()
|
|
||||||
{
|
|
||||||
JoyDevices[INPUT_XInput] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -40,18 +40,21 @@
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
#include "st_start.h"
|
#include "st_start.h"
|
||||||
|
#include "cmdlib.h"
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "i_input.h"
|
#include "i_input.h"
|
||||||
#include "hardware.h"
|
#include "hardware.h"
|
||||||
|
#include "filesystem.h"
|
||||||
#include "m_argv.h"
|
#include "m_argv.h"
|
||||||
|
#include "engineerrors.h"
|
||||||
#include "s_music.h"
|
#include "s_music.h"
|
||||||
#include "printf.h"
|
#include "printf.h"
|
||||||
#include "cmdlib.h"
|
#include "startupinfo.h"
|
||||||
|
#include "i_interface.h"
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
// How many ms elapse between blinking text flips. On a standard VGA
|
// How many ms elapse between blinking text flips. On a standard VGA
|
||||||
// adapter, the characters are on for 16 frames and then off for another 16.
|
// adapter, the characters are on for 16 frames and then off for another 16.
|
||||||
// The number here therefore corresponds roughly to the blink rate on a
|
// The number here therefore corresponds roughly to the blink rate on a
|
||||||
|
@ -109,7 +112,32 @@ CUSTOM_CVAR(Int, showendoom, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
FStartupScreen *FStartupScreen::CreateInstance(int max_progress)
|
FStartupScreen *FStartupScreen::CreateInstance(int max_progress)
|
||||||
{
|
{
|
||||||
FStartupScreen *scr = NULL;
|
FStartupScreen *scr = NULL;
|
||||||
scr = new FBasicStartupScreen(max_progress, true);
|
HRESULT hr;
|
||||||
|
|
||||||
|
if (!Args->CheckParm("-nostartup"))
|
||||||
|
{
|
||||||
|
if (GameStartupInfo.Type == FStartupInfo::HexenStartup)
|
||||||
|
{
|
||||||
|
scr = new FHexenStartupScreen(max_progress, hr);
|
||||||
|
}
|
||||||
|
else if (GameStartupInfo.Type == FStartupInfo::HereticStartup)
|
||||||
|
{
|
||||||
|
scr = new FHereticStartupScreen(max_progress, hr);
|
||||||
|
}
|
||||||
|
else if (GameStartupInfo.Type == FStartupInfo::StrifeStartup)
|
||||||
|
{
|
||||||
|
scr = new FStrifeStartupScreen(max_progress, hr);
|
||||||
|
}
|
||||||
|
if (scr != NULL && FAILED(hr))
|
||||||
|
{
|
||||||
|
delete scr;
|
||||||
|
scr = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (scr == NULL)
|
||||||
|
{
|
||||||
|
scr = new FBasicStartupScreen(max_progress, true);
|
||||||
|
}
|
||||||
return scr;
|
return scr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +152,7 @@ FStartupScreen *FStartupScreen::CreateInstance(int max_progress)
|
||||||
FBasicStartupScreen::FBasicStartupScreen(int max_progress, bool show_bar)
|
FBasicStartupScreen::FBasicStartupScreen(int max_progress, bool show_bar)
|
||||||
: FStartupScreen(max_progress)
|
: FStartupScreen(max_progress)
|
||||||
{
|
{
|
||||||
if (false)//show_bar)
|
if (show_bar)
|
||||||
{
|
{
|
||||||
ProgressBar = CreateWindowEx(0, PROGRESS_CLASS,
|
ProgressBar = CreateWindowEx(0, PROGRESS_CLASS,
|
||||||
NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
|
NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
|
||||||
|
@ -320,7 +348,7 @@ void FBasicStartupScreen :: NetProgress(int count)
|
||||||
{
|
{
|
||||||
char buf[16];
|
char buf[16];
|
||||||
|
|
||||||
snprintf (buf, countof(buf), "%d/%d", NetCurPos, NetMaxPos);
|
mysnprintf (buf, countof(buf), "%d/%d", NetCurPos, NetMaxPos);
|
||||||
SetDlgItemTextA (NetStartPane, IDC_NETSTARTCOUNT, buf);
|
SetDlgItemTextA (NetStartPane, IDC_NETSTARTCOUNT, buf);
|
||||||
SendDlgItemMessage (NetStartPane, IDC_NETSTARTPROGRESS, PBM_SETPOS, std::min(NetCurPos, NetMaxPos), 0);
|
SendDlgItemMessage (NetStartPane, IDC_NETSTARTPROGRESS, PBM_SETPOS, std::min(NetCurPos, NetMaxPos), 0);
|
||||||
}
|
}
|
||||||
|
@ -397,6 +425,192 @@ static INT_PTR CALLBACK NetStartPaneProc (HWND hDlg, UINT msg, WPARAM wParam, LP
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// FGraphicalStartupScreen Constructor
|
||||||
|
//
|
||||||
|
// This doesn't really do anything. The subclass is responsible for
|
||||||
|
// creating the resources that will be freed by this class's destructor.
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
FGraphicalStartupScreen::FGraphicalStartupScreen(int max_progress)
|
||||||
|
: FBasicStartupScreen(max_progress, false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// FGraphicalStartupScreen Destructor
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
FGraphicalStartupScreen::~FGraphicalStartupScreen()
|
||||||
|
{
|
||||||
|
if (StartupScreen != NULL)
|
||||||
|
{
|
||||||
|
DestroyWindow (StartupScreen);
|
||||||
|
StartupScreen = NULL;
|
||||||
|
}
|
||||||
|
if (StartupBitmap != NULL)
|
||||||
|
{
|
||||||
|
ST_Util_FreeBitmap (StartupBitmap);
|
||||||
|
StartupBitmap = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
void FHexenStartupScreen::SetWindowSize()
|
||||||
|
{
|
||||||
|
ST_Util_SizeWindowForBitmap(1);
|
||||||
|
LayoutMainWindow(Window, NULL);
|
||||||
|
InvalidateRect(StartupScreen, NULL, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
void FHereticStartupScreen::SetWindowSize()
|
||||||
|
{
|
||||||
|
ST_Util_SizeWindowForBitmap(1);
|
||||||
|
LayoutMainWindow(Window, NULL);
|
||||||
|
InvalidateRect(StartupScreen, NULL, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
void FStrifeStartupScreen::SetWindowSize()
|
||||||
|
{
|
||||||
|
ST_Util_SizeWindowForBitmap(2);
|
||||||
|
LayoutMainWindow(Window, NULL);
|
||||||
|
InvalidateRect(StartupScreen, NULL, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// ST_Endoom
|
||||||
|
//
|
||||||
|
// Shows an ENDOOM text screen
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
int RunEndoom()
|
||||||
|
{
|
||||||
|
if (showendoom == 0 || endoomName.Len() == 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int endoom_lump = fileSystem.CheckNumForFullName (endoomName, true);
|
||||||
|
|
||||||
|
uint8_t endoom_screen[4000];
|
||||||
|
uint8_t *font;
|
||||||
|
MSG mess;
|
||||||
|
BOOL bRet;
|
||||||
|
bool blinking = false, blinkstate = false;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (endoom_lump < 0 || fileSystem.FileLength (endoom_lump) != 4000)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileSystem.GetFileContainer(endoom_lump) == fileSystem.GetMaxIwadNum() && showendoom == 2)
|
||||||
|
{
|
||||||
|
// showendoom==2 means to show only lumps from PWADs.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
font = ST_Util_LoadFont (TEXT_FONT_NAME);
|
||||||
|
if (font == NULL)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ST_Util_CreateStartupWindow())
|
||||||
|
{
|
||||||
|
ST_Util_FreeFont (font);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
I_ShutdownGraphics ();
|
||||||
|
RestoreConView ();
|
||||||
|
S_StopMusic(true);
|
||||||
|
|
||||||
|
fileSystem.ReadFile (endoom_lump, endoom_screen);
|
||||||
|
|
||||||
|
// Draw the loading screen to a bitmap.
|
||||||
|
StartupBitmap = ST_Util_AllocTextBitmap (font);
|
||||||
|
ST_Util_DrawTextScreen (StartupBitmap, endoom_screen, font);
|
||||||
|
|
||||||
|
// Make the title banner go away.
|
||||||
|
if (GameTitleWindow != NULL)
|
||||||
|
{
|
||||||
|
DestroyWindow (GameTitleWindow);
|
||||||
|
GameTitleWindow = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ST_Util_SizeWindowForBitmap (1);
|
||||||
|
LayoutMainWindow (Window, NULL);
|
||||||
|
InvalidateRect (StartupScreen, NULL, TRUE);
|
||||||
|
|
||||||
|
// Does this screen need blinking?
|
||||||
|
for (i = 0; i < 80*25; ++i)
|
||||||
|
{
|
||||||
|
if (endoom_screen[1+i*2] & 0x80)
|
||||||
|
{
|
||||||
|
blinking = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (blinking && SetTimer (Window, 0x5A15A, BLINK_PERIOD, NULL) == 0)
|
||||||
|
{
|
||||||
|
blinking = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wait until any key has been pressed or a quit message has been received
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
bRet = GetMessage (&mess, NULL, 0, 0);
|
||||||
|
if (bRet == 0 || bRet == -1 || // bRet == 0 means we received WM_QUIT
|
||||||
|
mess.message == WM_KEYDOWN || mess.message == WM_SYSKEYDOWN || mess.message == WM_LBUTTONDOWN)
|
||||||
|
{
|
||||||
|
if (blinking)
|
||||||
|
{
|
||||||
|
KillTimer (Window, 0x5A15A);
|
||||||
|
}
|
||||||
|
ST_Util_FreeBitmap (StartupBitmap);
|
||||||
|
ST_Util_FreeFont (font);
|
||||||
|
return int(bRet == 0 ? mess.wParam : 0);
|
||||||
|
}
|
||||||
|
else if (blinking && mess.message == WM_TIMER && mess.hwnd == Window && mess.wParam == 0x5A15A)
|
||||||
|
{
|
||||||
|
ST_Util_UpdateTextBlink (StartupBitmap, endoom_screen, font, blinkstate);
|
||||||
|
blinkstate = !blinkstate;
|
||||||
|
}
|
||||||
|
TranslateMessage (&mess);
|
||||||
|
DispatchMessage (&mess);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ST_Endoom()
|
||||||
|
{
|
||||||
|
int code = RunEndoom();
|
||||||
|
throw CExitEvent(code);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
|
@ -419,3 +633,86 @@ bool ST_Util_CreateStartupWindow ()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// ST_Util_SizeWindowForBitmap
|
||||||
|
//
|
||||||
|
// Resizes the main window so that the startup bitmap will be drawn
|
||||||
|
// at the desired scale.
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
void ST_Util_SizeWindowForBitmap (int scale)
|
||||||
|
{
|
||||||
|
DEVMODE displaysettings;
|
||||||
|
int w, h, cx, cy, x, y;
|
||||||
|
RECT rect;
|
||||||
|
|
||||||
|
if (GameTitleWindow != NULL)
|
||||||
|
{
|
||||||
|
GetClientRect (GameTitleWindow, &rect);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rect.bottom = 0;
|
||||||
|
}
|
||||||
|
RECT sizerect = { 0, 0, StartupBitmap->bmiHeader.biWidth * scale,
|
||||||
|
StartupBitmap->bmiHeader.biHeight * scale + rect.bottom };
|
||||||
|
AdjustWindowRectEx(&sizerect, WS_VISIBLE|WS_OVERLAPPEDWINDOW, FALSE, WS_EX_APPWINDOW);
|
||||||
|
w = sizerect.right - sizerect.left;
|
||||||
|
h = sizerect.bottom - sizerect.top;
|
||||||
|
|
||||||
|
// Resize the window, but keep its center point the same, unless that
|
||||||
|
// puts it partially offscreen.
|
||||||
|
memset (&displaysettings, 0, sizeof(displaysettings));
|
||||||
|
displaysettings.dmSize = sizeof(displaysettings);
|
||||||
|
EnumDisplaySettings (NULL, ENUM_CURRENT_SETTINGS, &displaysettings);
|
||||||
|
GetWindowRect (Window, &rect);
|
||||||
|
cx = (rect.left + rect.right) / 2;
|
||||||
|
cy = (rect.top + rect.bottom) / 2;
|
||||||
|
x = cx - w / 2;
|
||||||
|
y = cy - h / 2;
|
||||||
|
if (x + w > (int)displaysettings.dmPelsWidth)
|
||||||
|
{
|
||||||
|
x = displaysettings.dmPelsWidth - w;
|
||||||
|
}
|
||||||
|
if (x < 0)
|
||||||
|
{
|
||||||
|
x = 0;
|
||||||
|
}
|
||||||
|
if (y + h > (int)displaysettings.dmPelsHeight)
|
||||||
|
{
|
||||||
|
y = displaysettings.dmPelsHeight - h;
|
||||||
|
}
|
||||||
|
if (y < 0)
|
||||||
|
{
|
||||||
|
y = 0;
|
||||||
|
}
|
||||||
|
MoveWindow (Window, x, y, w, h, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// ST_Util_InvalidateRect
|
||||||
|
//
|
||||||
|
// Invalidates the portion of the window that the specified rect of the
|
||||||
|
// bitmap appears in.
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
void ST_Util_InvalidateRect (HWND hwnd, BitmapInfo *bitmap_info, int left, int top, int right, int bottom)
|
||||||
|
{
|
||||||
|
RECT rect;
|
||||||
|
|
||||||
|
GetClientRect (hwnd, &rect);
|
||||||
|
rect.left = left * rect.right / bitmap_info->bmiHeader.biWidth - 1;
|
||||||
|
rect.top = top * rect.bottom / bitmap_info->bmiHeader.biHeight - 1;
|
||||||
|
rect.right = right * rect.right / bitmap_info->bmiHeader.biWidth + 1;
|
||||||
|
rect.bottom = bottom * rect.bottom / bitmap_info->bmiHeader.biHeight + 1;
|
||||||
|
InvalidateRect (hwnd, &rect, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ST_Util_InvalidateRect(BitmapInfo* bitmap_info, int left, int top, int right, int bottom)
|
||||||
|
{
|
||||||
|
ST_Util_InvalidateRect(StartupScreen , bitmap_info, left, top, right, bottom);
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
#include "gl_sysfb.h"
|
#include "gl_sysfb.h"
|
||||||
#include "hardware.h"
|
#include "hardware.h"
|
||||||
|
#include "x86.h"
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "c_console.h"
|
#include "c_console.h"
|
||||||
|
@ -46,6 +47,7 @@
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "v_text.h"
|
#include "v_text.h"
|
||||||
#include "m_argv.h"
|
#include "m_argv.h"
|
||||||
|
#include "engineerrors.h"
|
||||||
#include "printf.h"
|
#include "printf.h"
|
||||||
#include "win32basevideo.h"
|
#include "win32basevideo.h"
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
|
@ -167,7 +169,7 @@ static BOOL CALLBACK DumpAdaptersMonitorEnumProc(HMONITOR hMonitor, HDC, LPRECT,
|
||||||
{
|
{
|
||||||
bool primary = !!(mi.dwFlags & MONITORINFOF_PRIMARY);
|
bool primary = !!(mi.dwFlags & MONITORINFOF_PRIMARY);
|
||||||
|
|
||||||
snprintf(moreinfo, countof(moreinfo), " [%ldx%ld @ (%ld,%ld)]%s",
|
mysnprintf(moreinfo, countof(moreinfo), " [%ldx%ld @ (%ld,%ld)]%s",
|
||||||
mi.rcMonitor.right - mi.rcMonitor.left,
|
mi.rcMonitor.right - mi.rcMonitor.left,
|
||||||
mi.rcMonitor.bottom - mi.rcMonitor.top,
|
mi.rcMonitor.bottom - mi.rcMonitor.top,
|
||||||
mi.rcMonitor.left, mi.rcMonitor.top,
|
mi.rcMonitor.left, mi.rcMonitor.top,
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
|
|
||||||
#include "gl_sysfb.h"
|
#include "gl_sysfb.h"
|
||||||
#include "hardware.h"
|
#include "hardware.h"
|
||||||
|
#include "x86.h"
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "c_console.h"
|
#include "c_console.h"
|
||||||
|
@ -49,6 +50,7 @@
|
||||||
#include "v_text.h"
|
#include "v_text.h"
|
||||||
#include "m_argv.h"
|
#include "m_argv.h"
|
||||||
#include "printf.h"
|
#include "printf.h"
|
||||||
|
#include "engineerrors.h"
|
||||||
#include "win32glvideo.h"
|
#include "win32glvideo.h"
|
||||||
|
|
||||||
#include "gl/system/gl_framebuffer.h"
|
#include "gl/system/gl_framebuffer.h"
|
||||||
|
@ -407,7 +409,6 @@ bool Win32GLVideo::InitHardware(HWND Window, int multisample)
|
||||||
int prof = WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
|
int prof = WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
|
||||||
const char *version = Args->CheckValue("-glversion");
|
const char *version = Args->CheckValue("-glversion");
|
||||||
|
|
||||||
//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++)
|
for (; prof <= WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; prof++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -662,7 +662,7 @@ bool GameInterface::CanSave()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameInterface::StartGame(FGameStartup& gs)
|
void GameInterface::StartGame(FNewGameStartup& gs)
|
||||||
{
|
{
|
||||||
int32_t skillsound = PISTOL_BODYHIT;
|
int32_t skillsound = PISTOL_BODYHIT;
|
||||||
|
|
||||||
|
|
|
@ -225,7 +225,7 @@ struct GameInterface : ::GameInterface
|
||||||
void MenuSound(EMenuSounds snd) override;
|
void MenuSound(EMenuSounds snd) override;
|
||||||
void MenuClosed() override;
|
void MenuClosed() override;
|
||||||
bool CanSave() override;
|
bool CanSave() override;
|
||||||
void StartGame(FGameStartup& gs) override;
|
void StartGame(FNewGameStartup& gs) override;
|
||||||
FSavegameInfo GetSaveSig() override;
|
FSavegameInfo GetSaveSig() override;
|
||||||
void DrawCenteredTextScreen(const DVector2& origin, const char* text, int position, bool bg) override;
|
void DrawCenteredTextScreen(const DVector2& origin, const char* text, int position, bool bg) override;
|
||||||
void DrawMenuCaption(const DVector2& origin, const char* text) override;
|
void DrawMenuCaption(const DVector2& origin, const char* text) override;
|
||||||
|
|
|
@ -924,7 +924,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
|
||||||
|
|
||||||
if (RRRA && pPlayer->drug_mode > 0)
|
if (RRRA && pPlayer->drug_mode > 0)
|
||||||
{
|
{
|
||||||
while (pPlayer->drug_timer < totalclock && !(pPlayer->gm & MODE_MENU) && !ud.pause_on && !GUICapture)
|
while (pPlayer->drug_timer < totalclock && !(pPlayer->gm & MODE_MENU) && !ud.pause_on && !System_WantGuiCapture())
|
||||||
{
|
{
|
||||||
int aspect;
|
int aspect;
|
||||||
if (pPlayer->drug_stat[0] == 0)
|
if (pPlayer->drug_stat[0] == 0)
|
||||||
|
@ -5850,7 +5850,7 @@ void G_HandleLocalKeys(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_player[myconnectindex].ps->cheat_phase == 1 || (g_player[myconnectindex].ps->gm&(MODE_MENU|MODE_TYPE)) || GUICapture)
|
if (g_player[myconnectindex].ps->cheat_phase == 1 || (g_player[myconnectindex].ps->gm&(MODE_MENU|MODE_TYPE)) || System_WantGuiCapture())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_See_Coop_View) && (GTFLAGS(GAMETYPE_COOPVIEW) || ud.recstat == 2))
|
if (buttonMap.ButtonDown(gamefunc_See_Coop_View) && (GTFLAGS(GAMETYPE_COOPVIEW) || ud.recstat == 2))
|
||||||
|
@ -7335,7 +7335,7 @@ MAIN_LOOP_RESTART:
|
||||||
|
|
||||||
g_player[myconnectindex].movefifoend++;
|
g_player[myconnectindex].movefifoend++;
|
||||||
|
|
||||||
if (((g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU || ud.recstat == 2 || (g_netServer || ud.multimode > 1)) &&
|
if (((!System_WantGuiCapture() && (g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU) || ud.recstat == 2 || (g_netServer || ud.multimode > 1)) &&
|
||||||
(g_player[myconnectindex].ps->gm&MODE_GAME))
|
(g_player[myconnectindex].ps->gm&MODE_GAME))
|
||||||
{
|
{
|
||||||
G_MoveLoop();
|
G_MoveLoop();
|
||||||
|
|
|
@ -1775,7 +1775,7 @@ void Net_GetInput(void)
|
||||||
if (numplayers > 1)
|
if (numplayers > 1)
|
||||||
Net_GetPackets();
|
Net_GetPackets();
|
||||||
|
|
||||||
if (g_player[myconnectindex].movefifoend - movefifoplc >= 100 || GUICapture)
|
if (g_player[myconnectindex].movefifoend - movefifoplc >= 100 || System_WantGuiCapture())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (RRRA && g_player[myconnectindex].ps->on_motorcycle)
|
if (RRRA && g_player[myconnectindex].ps->on_motorcycle)
|
||||||
|
|
|
@ -212,7 +212,7 @@ bool GameInterface::CanSave()
|
||||||
return (!CommEnabled && numplayers ==1 && !DemoMode && !InMenuLevel && !TEST(Player[myconnectindex].Flags, PF_DEAD));
|
return (!CommEnabled && numplayers ==1 && !DemoMode && !InMenuLevel && !TEST(Player[myconnectindex].Flags, PF_DEAD));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameInterface::StartGame(FGameStartup& gs)
|
void GameInterface::StartGame(FNewGameStartup& gs)
|
||||||
{
|
{
|
||||||
PLAYERp pp = Player + screenpeek;
|
PLAYERp pp = Player + screenpeek;
|
||||||
int handle = 0;
|
int handle = 0;
|
||||||
|
|
|
@ -2545,7 +2545,7 @@ struct GameInterface : ::GameInterface
|
||||||
void MenuSound(EMenuSounds snd) override;
|
void MenuSound(EMenuSounds snd) override;
|
||||||
void MenuClosed() override;
|
void MenuClosed() override;
|
||||||
bool CanSave() override;
|
bool CanSave() override;
|
||||||
void StartGame(FGameStartup& gs) override;
|
void StartGame(FNewGameStartup& gs) override;
|
||||||
FSavegameInfo GetSaveSig() override;
|
FSavegameInfo GetSaveSig() override;
|
||||||
void DrawMenuCaption(const DVector2& origin, const char* text) override;
|
void DrawMenuCaption(const DVector2& origin, const char* text) override;
|
||||||
void DrawCenteredTextScreen(const DVector2& origin, const char* text, int position, bool bg) override;
|
void DrawCenteredTextScreen(const DVector2& origin, const char* text, int position, bool bg) override;
|
||||||
|
|
Loading…
Reference in a new issue