Merge branch '4.13' of ../gzdoom into gz4.13.1-merge

This commit is contained in:
Rachael Alexanderson 2024-10-20 10:23:29 -04:00
commit 7980d351b7
No known key found for this signature in database
GPG key ID: 26A8ACCE97115EE0
32 changed files with 174 additions and 143 deletions

View file

@ -193,7 +193,7 @@ int FCommandLine::argc ()
return _argc;
}
char *FCommandLine::operator[] (int i)
const char *FCommandLine::operator[] (int i)
{
if (_argv == NULL)
{

View file

@ -44,7 +44,7 @@ public:
FCommandLine (const char *commandline, bool no_escapes = false);
~FCommandLine ();
int argc ();
char *operator[] (int i);
const char *operator[] (int i);
const char *args () { return cmd; }
void Shift();

View file

@ -163,6 +163,7 @@ static int nulPrintf(FSMessageLevel msg, const char* fmt, ...)
FResourceFile *FResourceFile::DoOpenResourceFile(const char *filename, FileReader &file, bool containeronly, LumpFilterInfo* filter, FileSystemMessageFunc Printf, StringPool* sp)
{
if (!file.isOpen()) return nullptr;
if (Printf == nullptr) Printf = nulPrintf;
for(auto func : funcs)
{

View file

@ -122,11 +122,22 @@ void I_SetIWADInfo()
bool isConsoleApp()
{
DWORD pids[2];
DWORD num_pids = GetConsoleProcessList(pids, 2);
bool win32con_is_exclusive = (num_pids <= 1);
static bool alreadychecked = false;
static bool returnvalue;
return GetConsoleWindow() != NULL && !win32con_is_exclusive;
if (!alreadychecked)
{
DWORD pids[2];
DWORD num_pids = GetConsoleProcessList(pids, 2);
bool win32con_is_exclusive = (num_pids <= 1);
returnvalue = ((GetConsoleWindow() != NULL && !win32con_is_exclusive) || (GetStdHandle(STD_OUTPUT_HANDLE) != NULL));
alreadychecked = true;
}
//printf("isConsoleApp is %i\n", returnvalue);
return returnvalue;
}
//==========================================================================
@ -152,18 +163,16 @@ int DoMain (HINSTANCE hInstance)
if (isConsoleApp())
{
StdOut = GetStdHandle(STD_OUTPUT_HANDLE);
BY_HANDLE_FILE_INFORMATION info;
if (!GetFileInformationByHandle(StdOut, &info) && StdOut != nullptr)
SetConsoleCP(CP_UTF8);
SetConsoleOutputCP(CP_UTF8);
DWORD mode;
if (GetConsoleMode(StdOut, &mode))
{
SetConsoleCP(CP_UTF8);
SetConsoleOutputCP(CP_UTF8);
DWORD mode;
if (GetConsoleMode(StdOut, &mode))
{
if (SetConsoleMode(StdOut, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING))
FancyStdOut = IsWindows10OrGreater(); // Windows 8.1 and lower do not understand ANSI formatting.
}
if (SetConsoleMode(StdOut, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING))
FancyStdOut = IsWindows10OrGreater(); // Windows 8.1 and lower do not understand ANSI formatting.
}
}
else if (Args->CheckParm("-stdout") || Args->CheckParm("-norun"))
@ -326,8 +335,14 @@ void I_ShowFatalError(const char *msg)
//==========================================================================
int wmain()
{
return wWinMain(GetModuleHandle(0), 0, GetCommandLineW(), SW_SHOW);
}
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE nothing, LPWSTR cmdline, int nCmdShow)
{
g_hInst = hInstance;
InitCommonControls();

View file

@ -102,6 +102,7 @@
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
void DestroyCustomCursor();
bool isConsoleApp();
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
@ -305,6 +306,7 @@ static void PrintToStdOut(const char *cpt, HANDLE StdOut)
else break;
}
}
DWORD bytes_written;
WriteFile(StdOut, printData.GetChars(), (DWORD)printData.Len(), &bytes_written, NULL);
if (terminal)

View file

@ -248,7 +248,7 @@ CCMD (vid_scaletoheight)
}
}
inline bool atob(char* I)
inline bool atob(const char* I)
{
if (stricmp (I, "true") == 0 || stricmp (I, "1") == 0)
return true;

View file

@ -72,6 +72,7 @@ enum EGameTexFlags
GTexf_OffsetsNotForFont = 512, // The offsets must be ignored when using this texture in a font.
GTexf_NoTrim = 1024, // Don't perform trimming on this texture.
GTexf_Seen = 2048, // Set to true when the texture is being used for rendering. Must be cleared manually if the check is needed.
GTexf_NoMipmap = 4096, // Disable mipmapping for this texture
};
struct FMaterialLayers
@ -284,6 +285,9 @@ public:
void SetGlowing(PalEntry color) { flags = (flags & ~GTexf_AutoGlowing) | GTexf_Glowing; GlowColor = color; }
void SetDisableBrightmap() { flags |= GTexf_BrightmapChecked; Brightmap = nullptr; }
bool isNoMipmap() const { return !!(flags & GTexf_NoMipmap); }
void SetNoMipmap(bool set) { if (set) flags |= GTexf_NoMipmap; else flags &= ~GTexf_NoMipmap; }
bool isUserContent() const;
int CheckRealHeight() { return xs_RoundToInt(Base->CheckRealHeight() / ScaleY); }
void SetSize(int x, int y)