- Replace every line that just contains spaces or tabs with an empty line feed in all files except 3rd party libraries.

This commit is contained in:
Mitchell Richters 2021-12-30 20:30:21 +11:00
parent 1b077251e3
commit 9bbb54fe2e
370 changed files with 2163 additions and 2163 deletions

View file

@ -3,20 +3,20 @@
### Raze special thanks: ### Raze special thanks:
* sinisterseed, Rachael, dpJudas, Enjay, Nash Muhandes * sinisterseed, Rachael, dpJudas, Enjay, Nash Muhandes
### EDuke32 engine: ### EDuke32 engine:
* TerminX, Hendricks266, pogokeen, Plagman * TerminX, Hendricks266, pogokeen, Plagman
* Helixhorned * Helixhorned
### JFDuke3D by: ### JFDuke3D by:
* JonoF * JonoF
### Uses BUILD Engine technology by: ### Uses BUILD Engine technology by:
* Ken Silverman * Ken Silverman
### NBlood programming: ### NBlood programming:
* Nuke.YKT, NoOne, sirlemonhead * Nuke.YKT, NoOne, sirlemonhead
### NBlood special thanks: ### NBlood special thanks:
* NY00123, MetHy, Striker, oasiz, Mblackwell, Zombie, Marphy Black, SAmik37, meleemario * NY00123, MetHy, Striker, oasiz, Mblackwell, Zombie, Marphy Black, SAmik37, meleemario
@ -34,7 +34,7 @@
### Widescreen graphics: ### Widescreen graphics:
* James Manning, fgsfds, Dzierzan, Phredreeke, MaxED, Kinsie, Maxi Clouds * James Manning, fgsfds, Dzierzan, Phredreeke, MaxED, Kinsie, Maxi Clouds
### Exhumed BigFont ### Exhumed BigFont
* Dynamo * Dynamo

View file

@ -237,11 +237,11 @@ if( MSVC )
# Disable warnings for unsecure CRT functions from VC8+ # Disable warnings for unsecure CRT functions from VC8+
set( ALL_C_FLAGS "${ALL_C_FLAGS} /DUNICODE /D_UNICODE /D_WIN32_WINNT=0x0600 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS" ) set( ALL_C_FLAGS "${ALL_C_FLAGS} /DUNICODE /D_UNICODE /D_WIN32_WINNT=0x0600 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS" )
# These must be silenced because the code is full of them. Expect some of undefined behavior hidden in this mess. :( # These must be silenced because the code is full of them. Expect some of undefined behavior hidden in this mess. :(
#set( ALL_C_FLAGS "${ALL_C_FLAGS} /wd4244 /wd4018 /wd4267" ) #set( ALL_C_FLAGS "${ALL_C_FLAGS} /wd4244 /wd4018 /wd4267" )
# Most of these need to be cleaned out. The source is currently infested with far too much conditional compilation which is a constant source of problems. # Most of these need to be cleaned out. The source is currently infested with far too much conditional compilation which is a constant source of problems.
set( ALL_C_FLAGS "${ALL_C_FLAGS} /DUSE_OPENGL=1 /DNOASM=1 /DWIN32" ) set( ALL_C_FLAGS "${ALL_C_FLAGS} /DUSE_OPENGL=1 /DNOASM=1 /DWIN32" )

View file

@ -148,7 +148,7 @@ typedef enum EIntConfigKey_
zmusic_mod_autochip_scan_threshold, zmusic_mod_autochip_scan_threshold,
zmusic_snd_streambuffersize, zmusic_snd_streambuffersize,
zmusic_snd_mididevice, zmusic_snd_mididevice,
zmusic_snd_outputrate, zmusic_snd_outputrate,
@ -226,7 +226,7 @@ typedef struct ZMusicCallbacks_
{ {
// Callbacks the client can install to capture messages from the backends // Callbacks the client can install to capture messages from the backends
// or to provide sound font data. // or to provide sound font data.
void (*MessageFunc)(int severity, const char* msg); void (*MessageFunc)(int severity, const char* msg);
// The message callbacks are optional, without them the output goes to stdout. // The message callbacks are optional, without them the output goes to stdout.

View file

@ -9,7 +9,7 @@
function(enable_precompiled_headers PRECOMPILED_HEADER SOURCE_VARIABLE_NAME) function(enable_precompiled_headers PRECOMPILED_HEADER SOURCE_VARIABLE_NAME)
if(MSVC) if(MSVC)
set(files ${${SOURCE_VARIABLE_NAME}}) set(files ${${SOURCE_VARIABLE_NAME}})
# Generate precompiled header translation unit # Generate precompiled header translation unit
get_filename_component(pch_basename ${PRECOMPILED_HEADER} NAME_WE) get_filename_component(pch_basename ${PRECOMPILED_HEADER} NAME_WE)
set(pch_abs ${CMAKE_CURRENT_SOURCE_DIR}/${PRECOMPILED_HEADER}) set(pch_abs ${CMAKE_CURRENT_SOURCE_DIR}/${PRECOMPILED_HEADER})
@ -28,7 +28,7 @@ function(enable_precompiled_headers PRECOMPILED_HEADER SOURCE_VARIABLE_NAME)
FILE(WRITE ${pch_unity} "${pch_content}") FILE(WRITE ${pch_unity} "${pch_content}")
endif() endif()
set_source_files_properties(${pch_unity} PROPERTIES COMPILE_FLAGS "/Yc\"${pch_abs}\"") set_source_files_properties(${pch_unity} PROPERTIES COMPILE_FLAGS "/Yc\"${pch_abs}\"")
# Update properties of source files to use the precompiled header. # Update properties of source files to use the precompiled header.
# Additionally, force the inclusion of the precompiled header at beginning of each source file. # Additionally, force the inclusion of the precompiled header at beginning of each source file.
foreach(source_file ${files} ) foreach(source_file ${files} )
@ -38,7 +38,7 @@ function(enable_precompiled_headers PRECOMPILED_HEADER SOURCE_VARIABLE_NAME)
"/Yu\"${pch_abs}\" /FI\"${pch_abs}\"" "/Yu\"${pch_abs}\" /FI\"${pch_abs}\""
) )
endforeach(source_file) endforeach(source_file)
# Finally, update the source file collection to contain the precompiled header translation unit # Finally, update the source file collection to contain the precompiled header translation unit
set(${SOURCE_VARIABLE_NAME} ${${SOURCE_VARIABLE_NAME}} ${pch_unity} PARENT_SCOPE) set(${SOURCE_VARIABLE_NAME} ${${SOURCE_VARIABLE_NAME}} ${pch_unity} PARENT_SCOPE)
endif(MSVC) endif(MSVC)

View file

@ -313,7 +313,7 @@ if( DEM_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC" )
endif() endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD") if(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ljemalloc") set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ljemalloc")
endif() endif()
@ -473,7 +473,7 @@ set( PLAT_WIN32_SOURCES
if (HAVE_VULKAN) if (HAVE_VULKAN)
set (PLAT_WIN32_SOURCES ${PLAT_WIN32_SOURCES} common/platform/win32/win32vulkanvideo.cpp ) set (PLAT_WIN32_SOURCES ${PLAT_WIN32_SOURCES} common/platform/win32/win32vulkanvideo.cpp )
endif() endif()
# todo: implement an actual crash catcher for ARM # todo: implement an actual crash catcher for ARM
# for now this is purely experimental # for now this is purely experimental
if (NOT ${TARGET_ARCHITECTURE} MATCHES "arm" ) if (NOT ${TARGET_ARCHITECTURE} MATCHES "arm" )
@ -609,7 +609,7 @@ file( GLOB HEADER_FILES
core/input/*.h core/input/*.h
core/rendering/*.h core/rendering/*.h
core/rendering/scene/*.h core/rendering/scene/*.h
common/audio/sound/thirdparty/*.h common/audio/sound/thirdparty/*.h
common/audio/sound/*.h common/audio/sound/*.h
common/audio/music/*.h* common/audio/music/*.h*
@ -757,7 +757,7 @@ set( NOT_COMPILED_SOURCE_FILES
games/blood/src/view.cpp games/blood/src/view.cpp
games/blood/src/warp.cpp games/blood/src/warp.cpp
games/blood/src/weapon.cpp games/blood/src/weapon.cpp
# Duke # Duke
games/duke/src/actors.cpp games/duke/src/actors.cpp
games/duke/src/actors_d.cpp games/duke/src/actors_d.cpp
@ -801,7 +801,7 @@ set( NOT_COMPILED_SOURCE_FILES
games/duke/src/spawn.cpp games/duke/src/spawn.cpp
games/duke/src/spawn_d.cpp games/duke/src/spawn_d.cpp
games/duke/src/spawn_r.cpp games/duke/src/spawn_r.cpp
# Shadow Warrior # Shadow Warrior
games/sw/src/actor.cpp games/sw/src/actor.cpp
games/sw/src/ai.cpp games/sw/src/ai.cpp
@ -864,7 +864,7 @@ set( NOT_COMPILED_SOURCE_FILES
games/sw/src/weapon.cpp games/sw/src/weapon.cpp
games/sw/src/zilla.cpp games/sw/src/zilla.cpp
games/sw/src/zombie.cpp games/sw/src/zombie.cpp
# Exhumed # Exhumed
games/exhumed/src/2d.cpp games/exhumed/src/2d.cpp
games/exhumed/src/anims.cpp games/exhumed/src/anims.cpp
@ -915,8 +915,8 @@ set( NOT_COMPILED_SOURCE_FILES
games/exhumed/src/trigdat.cpp games/exhumed/src/trigdat.cpp
games/exhumed/src/view.cpp games/exhumed/src/view.cpp
games/exhumed/src/wasp.cpp games/exhumed/src/wasp.cpp
) )
set( VM_JIT_SOURCES set( VM_JIT_SOURCES
@ -946,7 +946,7 @@ set( FASTMATH_SOURCES
gitinfo.cpp gitinfo.cpp
) )
#Vulkan stuff must go into a separate list because it needs to be disabled for some platforms #Vulkan stuff must go into a separate list because it needs to be disabled for some platforms
set (VULKAN_SOURCES set (VULKAN_SOURCES
common/rendering/vulkan/system/vk_device.cpp common/rendering/vulkan/system/vk_device.cpp
@ -1216,7 +1216,7 @@ set (PCH_SOURCES
common/menu/menudef.cpp common/menu/menudef.cpp
common/menu/savegamemanager.cpp common/menu/savegamemanager.cpp
common/statusbar/base_sbar.cpp common/statusbar/base_sbar.cpp
common/rendering/v_framebuffer.cpp common/rendering/v_framebuffer.cpp
common/rendering/v_video.cpp common/rendering/v_video.cpp
common/rendering/r_thread.cpp common/rendering/r_thread.cpp
@ -1276,7 +1276,7 @@ set (PCH_SOURCES
core/menu/loadsavemenu.cpp core/menu/loadsavemenu.cpp
core/menu/usermap.cpp core/menu/usermap.cpp
core/menu/razemenu.cpp core/menu/razemenu.cpp
#Duke is split because Duke and RR need different constants. #Duke is split because Duke and RR need different constants.
games/duke/all.cpp games/duke/all.cpp
games/duke/all_d.cpp games/duke/all_d.cpp
@ -1284,7 +1284,7 @@ set (PCH_SOURCES
games/exhumed/all.cpp games/exhumed/all.cpp
games/blood/all.cpp games/blood/all.cpp
games/sw/all.cpp games/sw/all.cpp
) )
if( ${HAVE_VM_JIT} ) if( ${HAVE_VM_JIT} )

View file

@ -19,11 +19,11 @@ class FGameTexture;
struct mdmodel_t struct mdmodel_t
{ {
int32_t mdnum, shadeoff; int32_t mdnum, shadeoff;
float scale, bscale, zadd, yoffset; float scale, bscale, zadd, yoffset;
FGameTexture *texture; FGameTexture *texture;
int32_t flags; int32_t flags;
}; };

View file

@ -789,7 +789,7 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect,
} }
vec2_t vec = goal; vec2_t vec = goal;
if ((hitwall = cliptrace(pos->vec2, &vec)) >= 0) if ((hitwall = cliptrace(pos->vec2, &vec)) >= 0)
{ {
vec2_t const clipr = { clipit[hitwall].x2 - clipit[hitwall].x1, clipit[hitwall].y2 - clipit[hitwall].y1 }; vec2_t const clipr = { clipit[hitwall].x2 - clipit[hitwall].x1, clipit[hitwall].y2 - clipit[hitwall].y1 };
@ -984,7 +984,7 @@ int pushmove_(vec3_t *const vect, int *const sectnum,
closest = { dax, day }; closest = { dax, day };
} }
j = cliptestsector(clipsectorlist[clipsectcnt], wal->nextsector, flordist, ceildist, closest, vect->Z); j = cliptestsector(clipsectorlist[clipsectcnt], wal->nextsector, flordist, ceildist, closest, vect->Z);
} }

View file

@ -1089,7 +1089,7 @@ void md3_vox_calcmat_common(tspriteptr_t tspr, const FVector3 *a0, float f, floa
mat[0] = k4*k6 + k5*k7; mat[4] = 0; mat[ 8] = k4*k7 - k5*k6; mat[12] = k2*k6 + k3*k7; mat[0] = k4*k6 + k5*k7; mat[4] = 0; mat[ 8] = k4*k7 - k5*k6; mat[12] = k2*k6 + k3*k7;
mat[1] = 0; mat[5] = 1; mat[ 9] = 0; mat[13] = 0; mat[1] = 0; mat[5] = 1; mat[ 9] = 0; mat[13] = 0;
k6 = gcosang2; k6 = gcosang2;
k7 = gsinang2; k7 = gsinang2;
mat[2] = k4*k6 + k5*k7; mat[2] = k4*k6 + k5*k7;
@ -1347,7 +1347,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
auto tex = mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,globalpal,surfi, &exact); auto tex = mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,globalpal,surfi, &exact);
if (!tex) if (!tex)
continue; continue;
int palid = TRANSLATION(Translation_Remap + curbasepal, globalpal); int palid = TRANSLATION(Translation_Remap + curbasepal, globalpal);
GLInterface.SetFade(tspr->sector()->floorpal); GLInterface.SetFade(tspr->sector()->floorpal);
GLInterface.SetTexture(tex, palid, CLAMP_XY); GLInterface.SetTexture(tex, palid, CLAMP_XY);
@ -1414,7 +1414,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
GLInterface.SetCull(Cull_None); GLInterface.SetCull(Cull_None);
GLInterface.SetIdentityMatrix(Matrix_Model); GLInterface.SetIdentityMatrix(Matrix_Model);
globalnoeffect=0; globalnoeffect=0;
return 1; return 1;
} }
@ -1449,7 +1449,7 @@ static void md3free(md3model_t *m)
} }
M_Free(m->head.tags); M_Free(m->head.tags);
M_Free(m->head.frames); M_Free(m->head.frames);
M_Free(m->muladdframes); M_Free(m->muladdframes);
M_Free(m->indexes); M_Free(m->indexes);
@ -1540,7 +1540,7 @@ void updateModelInterpolation()
// sigh... // sigh...
omdtims = mdtims; omdtims = mdtims;
mdtims = I_msTime(); mdtims = I_msTime();
TSpriteIterator<DCoreActor> it; TSpriteIterator<DCoreActor> it;
while (auto actor = it.Next()) while (auto actor = it.Next())
{ {

View file

@ -350,7 +350,7 @@ static void polymost_drawpoly(FVector2 const * const dpxy, int32_t const n, int3
} }
static int32_t skyzbufferhack_pass = 0; static int32_t skyzbufferhack_pass = 0;
if (flatskyrender && skyzbufferhack_pass == 0) if (flatskyrender && skyzbufferhack_pass == 0)
{ {
polymost_flatskyrender(dpxy, n, method|DAMETH_SKY, tilesize); polymost_flatskyrender(dpxy, n, method|DAMETH_SKY, tilesize);
@ -709,7 +709,7 @@ static void polymost_domost(float x0, float y0, float x1, float y1, float y0top
firstnode = i; firstnode = i;
continue; continue;
} }
if (n0.X >= dm1.X) if (n0.X >= dm1.X)
break; break;
@ -1281,7 +1281,7 @@ static void polymost_flatskyrender(FVector2 const* const dpxy, int32_t const n,
xys[i].X = v.x * r + ghalfx; xys[i].X = v.x * r + ghalfx;
xys[i].Y = v.y * r + ghalfy; xys[i].Y = v.y * r + ghalfy;
} }
float const fglobalang = FixedToFloat(qglobalang); float const fglobalang = FixedToFloat(qglobalang);
int32_t dapyscale, dapskybits, dapyoffs, daptileyscale; int32_t dapyscale, dapskybits, dapyoffs, daptileyscale;
int16_t const * dapskyoff = getpsky(globalpicnum, &dapyscale, &dapskybits, &dapyoffs, &daptileyscale); int16_t const * dapskyoff = getpsky(globalpicnum, &dapyscale, &dapskybits, &dapyoffs, &daptileyscale);
@ -1575,7 +1575,7 @@ static void polymost_drawalls(int32_t const bunch)
xtex.d = (ryp0-ryp1)*gxyaspect / (x0-x1); xtex.d = (ryp0-ryp1)*gxyaspect / (x0-x1);
ytex.d = 0; ytex.d = 0;
otex.d = ryp0*gxyaspect - xtex.d*x0; otex.d = ryp0*gxyaspect - xtex.d*x0;
xtex.u = ytex.u = otex.u = 0; xtex.u = ytex.u = otex.u = 0;
xtex.v = ytex.v = otex.v = 0; xtex.v = ytex.v = otex.v = 0;
polymost_domost(x0, fy0, x1, fy1); polymost_domost(x0, fy0, x1, fy1);
@ -1622,13 +1622,13 @@ static void polymost_drawalls(int32_t const bunch)
global_cf_ypanning = sec->ceilingypan_, global_cf_ypanning = sec->ceilingypan_,
global_cf_heinum = sec->ceilingheinum; global_cf_heinum = sec->ceilingheinum;
global_getzofslope_func = &fgetceilzofslope; global_getzofslope_func = &fgetceilzofslope;
if (globalpicnum >= r_rortexture && globalpicnum < r_rortexture + r_rortexturerange && r_rorphase == 0) if (globalpicnum >= r_rortexture && globalpicnum < r_rortexture + r_rortexturerange && r_rorphase == 0)
{ {
xtex.d = (ryp0-ryp1)*gxyaspect / (x0-x1); xtex.d = (ryp0-ryp1)*gxyaspect / (x0-x1);
ytex.d = 0; ytex.d = 0;
otex.d = ryp0*gxyaspect - xtex.d*x0; otex.d = ryp0*gxyaspect - xtex.d*x0;
xtex.u = ytex.u = otex.u = 0; xtex.u = ytex.u = otex.u = 0;
xtex.v = ytex.v = otex.v = 0; xtex.v = ytex.v = otex.v = 0;
polymost_domost(x1, cy1, x0, cy0); polymost_domost(x1, cy1, x0, cy0);

View file

@ -993,7 +993,7 @@ void F2DDrawer::AddLine(double x1, double y1, double x2, double y2, int clipx1,
dg.mScissor[3] = clipy2 + 1 + int(offset.Y); dg.mScissor[3] = clipy2 + 1 + int(offset.Y);
dg.mFlags |= DTF_Scissor; dg.mFlags |= DTF_Scissor;
} }
dg.mType = DrawTypeLines; dg.mType = DrawTypeLines;
dg.mRenderStyle = LegacyRenderStyles[STYLE_Translucent]; dg.mRenderStyle = LegacyRenderStyles[STYLE_Translucent];
dg.mVertCount = 2; dg.mVertCount = 2;

View file

@ -101,7 +101,7 @@ public:
} }
}; };
struct RenderCommand struct RenderCommand
{ {
EDrawType mType; EDrawType mType;
@ -175,7 +175,7 @@ public:
public: public:
int fullscreenautoaspect = 3; int fullscreenautoaspect = 3;
int cliptop = -1, clipleft = -1, clipwidth = -1, clipheight = -1; int cliptop = -1, clipleft = -1, clipwidth = -1, clipheight = -1;
int AddCommand(RenderCommand *data); int AddCommand(RenderCommand *data);
void AddIndices(int firstvert, int count, ...); void AddIndices(int firstvert, int count, ...);
private: private:
@ -200,8 +200,8 @@ public:
void ClearScreen(PalEntry color = 0xff000000); void ClearScreen(PalEntry color = 0xff000000);
void AddDim(PalEntry color, float damount, int x1, int y1, int w, int h); void AddDim(PalEntry color, float damount, int x1, int y1, int w, int h);
void AddClear(int left, int top, int right, int bottom, int palcolor, uint32_t color); void AddClear(int left, int top, int right, int bottom, int palcolor, uint32_t color);
void AddLine(double x1, double y1, double x2, double y2, int cx, int cy, int cx2, int cy2, uint32_t color, uint8_t alpha = 255); void AddLine(double x1, double y1, double x2, double y2, int cx, int cy, int cx2, int cy2, uint32_t color, uint8_t alpha = 255);
void AddThickLine(int x1, int y1, int x2, int y2, double thickness, uint32_t color, uint8_t alpha = 255); void AddThickLine(int x1, int y1, int x2, int y2, double thickness, uint32_t color, uint8_t alpha = 255);
void AddPixel(int x1, int y1, uint32_t color); void AddPixel(int x1, int y1, uint32_t color);

View file

@ -857,7 +857,7 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
parms->cleanmode = DTA_Base; parms->cleanmode = DTA_Base;
parms->virtHeight = ListGetDouble(tags); parms->virtHeight = ListGetDouble(tags);
break; break;
case DTA_FullscreenScale: case DTA_FullscreenScale:
intval = ListGetInt(tags); intval = ListGetInt(tags);
if (intval >= FSMode_None && intval < FSMode_Max) if (intval >= FSMode_None && intval < FSMode_Max)

View file

@ -36,7 +36,7 @@ enum
FSMode_Max, FSMode_Max,
// These all use ScaleToFit43, their purpose is to cut down on verbosity because they imply the virtual screen size. // These all use ScaleToFit43, their purpose is to cut down on verbosity because they imply the virtual screen size.
FSMode_Predefined = 1000, FSMode_Predefined = 1000,
FSMode_Fit320x200 = 1000, FSMode_Fit320x200 = 1000,

View file

@ -226,7 +226,7 @@ void I_InitMusic(void)
nomusic = !!Args->CheckParm("-nomusic") || !!Args->CheckParm("-nosound"); nomusic = !!Args->CheckParm("-nomusic") || !!Args->CheckParm("-nosound");
snd_mididevice.Callback(); snd_mididevice.Callback();
ZMusicCallbacks callbacks{}; ZMusicCallbacks callbacks{};
callbacks.MessageFunc = zmusic_printfunc; callbacks.MessageFunc = zmusic_printfunc;

View file

@ -140,7 +140,7 @@ FileReader FSoundFontReader::Open(const char *name, std::string& filename)
ZMusicCustomReader* FSoundFontReader::open_interface(const char* name) ZMusicCustomReader* FSoundFontReader::open_interface(const char* name)
{ {
std::string filename; std::string filename;
FileReader fr = Open(name, filename); FileReader fr = Open(name, filename);
if (!fr.isOpen()) return nullptr; if (!fr.isOpen()) return nullptr;
auto fri = GetMusicReader(fr); auto fri = GetMusicReader(fr);
@ -336,7 +336,7 @@ void FSoundFontManager::ProcessOneFile(const FString &fn)
// We already got a soundfont with this name. Do not add again. // We already got a soundfont with this name. Do not add again.
if (!sfi.mName.CompareNoCase(fb)) return; if (!sfi.mName.CompareNoCase(fb)) return;
} }
FileReader fr; FileReader fr;
if (fr.OpenFile(fn)) if (fr.OpenFile(fn))
{ {

View file

@ -29,13 +29,13 @@ protected:
// When reading from an archive it will always be case insensitive, just like the lump manager. // When reading from an archive it will always be case insensitive, just like the lump manager.
bool mCaseSensitivePaths = false; bool mCaseSensitivePaths = false;
TArray<FString> mPaths; TArray<FString> mPaths;
int pathcmp(const char *p1, const char *p2); int pathcmp(const char *p1, const char *p2);
public: public:
virtual ~FSoundFontReader() {} virtual ~FSoundFontReader() {}
virtual FileReader OpenMainConfigFile() = 0; // this is special because it needs to be synthesized for .sf files and set some restrictions for patch sets virtual FileReader OpenMainConfigFile() = 0; // this is special because it needs to be synthesized for .sf files and set some restrictions for patch sets
virtual FString MainConfigFileName() virtual FString MainConfigFileName()
@ -147,15 +147,15 @@ public:
class FSoundFontManager class FSoundFontManager
{ {
TArray<FSoundFontInfo> soundfonts; TArray<FSoundFontInfo> soundfonts;
void ProcessOneFile(const FString & fn); void ProcessOneFile(const FString & fn);
public: public:
void CollectSoundfonts(); void CollectSoundfonts();
const FSoundFontInfo *FindSoundFont(const char *name, int allowedtypes) const; const FSoundFontInfo *FindSoundFont(const char *name, int allowedtypes) const;
FSoundFontReader *OpenSoundFont(const char *name, int allowedtypes); FSoundFontReader *OpenSoundFont(const char *name, int allowedtypes);
const auto &GetList() const { return soundfonts; } // This is for the menu const auto &GetList() const { return soundfonts; } // This is for the menu
}; };

View file

@ -180,7 +180,7 @@ static bool FillStream(SoundStream* stream, void* buff, int len, void* userdata)
fbuf[i] = convert[i] * mus_playing.replayGainFactor * (1.f/32768.f); fbuf[i] = convert[i] * mus_playing.replayGainFactor * (1.f/32768.f);
} }
} }
if (!written) if (!written)
{ {
memset((char*)buff, 0, len); memset((char*)buff, 0, len);
@ -298,7 +298,7 @@ void S_UpdateMusic ()
if (mus_playing.handle != nullptr) if (mus_playing.handle != nullptr)
{ {
ZMusic_Update(mus_playing.handle); ZMusic_Update(mus_playing.handle);
// [RH] Update music and/or playlist. IsPlaying() must be called // [RH] Update music and/or playlist. IsPlaying() must be called
// to attempt to reconnect to broken net streams and to advance the // to attempt to reconnect to broken net streams and to advance the
// playlist when the current song finishes. // playlist when the current song finishes.

View file

@ -107,7 +107,7 @@ public:
// Streaming sounds. // Streaming sounds.
virtual SoundStream *CreateStream (SoundStreamCallback callback, int buffbytes, int flags, int samplerate, void *userdata) = 0; virtual SoundStream *CreateStream (SoundStreamCallback callback, int buffbytes, int flags, int samplerate, void *userdata) = 0;
// Starts a sound. // Starts a sound.
virtual FISoundChannel *StartSound (SoundHandle sfx, float vol, int pitch, int chanflags, FISoundChannel *reuse_chan, float startTime = 0.f) = 0; virtual FISoundChannel *StartSound (SoundHandle sfx, float vol, int pitch, int chanflags, FISoundChannel *reuse_chan, float startTime = 0.f) = 0;
virtual FISoundChannel *StartSound3D (SoundHandle sfx, SoundListener *listener, float vol, FRolloffInfo *rolloff, float distscale, int pitch, int priority, const FVector3 &pos, const FVector3 &vel, int channum, int chanflags, FISoundChannel *reuse_chan, float startTime = 0.f) = 0; virtual FISoundChannel *StartSound3D (SoundHandle sfx, SoundListener *listener, float vol, FRolloffInfo *rolloff, float distscale, int pitch, int priority, const FVector3 &pos, const FVector3 &vel, int channum, int chanflags, FISoundChannel *reuse_chan, float startTime = 0.f) = 0;

View file

@ -1675,7 +1675,7 @@ void OpenALSoundRenderer::UpdateListener(SoundListener *listener)
const_cast<ReverbContainer*>(env)->Modified = false; const_cast<ReverbContainer*>(env)->Modified = false;
} }
// NOTE: Moving into and out of water will undo pitch variations on sounds. // NOTE: Moving into and out of water will undo pitch variations on sounds.
if(listener->underwater || env->SoftwareWater) if(listener->underwater || env->SoftwareWater)
{ {
@ -1721,7 +1721,7 @@ void OpenALSoundRenderer::UpdateListener(SoundListener *listener)
} }
else if(WasInWater) else if(WasInWater)
{ {
WasInWater = false; WasInWater = false;
if(EnvSlot != 0) if(EnvSlot != 0)

View file

@ -402,7 +402,7 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
{ {
return nullptr; return nullptr;
} }
sfx = &S_sfx[sound_id]; sfx = &S_sfx[sound_id];
// Scale volume according to SNDINFO data. // Scale volume according to SNDINFO data.
@ -611,7 +611,7 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
{ {
chan->Source = source; chan->Source = source;
} }
if (spitch > 0.0) // A_StartSound has top priority over all others. if (spitch > 0.0) // A_StartSound has top priority over all others.
SetPitch(chan, spitch); SetPitch(chan, spitch);
else if (defpitch > 0.0) // $PitchSet overrides $PitchShift else if (defpitch > 0.0) // $PitchSet overrides $PitchShift
@ -726,7 +726,7 @@ sfxinfo_t *SoundEngine::LoadSound(sfxinfo_t *sfx)
{ {
return sfx; return sfx;
} }
// See if there is another sound already initialized with this lump. If so, // See if there is another sound already initialized with this lump. If so,
// then set this one up as a link, and don't load the sound again. // then set this one up as a link, and don't load the sound again.
for (i = 0; i < S_sfx.Size(); i++) for (i = 0; i < S_sfx.Size(); i++)
@ -830,7 +830,7 @@ bool SoundEngine::CheckSoundLimit(sfxinfo_t *sfx, const FVector3 &pos, int near_
{ {
FSoundChan *chan; FSoundChan *chan;
int count; int count;
for (chan = Channels, count = 0; chan != NULL && count < near_limit; chan = chan->NextChan) for (chan = Channels, count = 0; chan != NULL && count < near_limit; chan = chan->NextChan)
{ {
if (chan->ChanFlags & CHANF_FORGETTABLE) continue; if (chan->ChanFlags & CHANF_FORGETTABLE) continue;

View file

@ -73,7 +73,7 @@ class FSoundID
{ {
public: public:
FSoundID() = default; FSoundID() = default;
static FSoundID byResId(int ndx) static FSoundID byResId(int ndx)
{ {
return FSoundID(S_FindSoundByResID(ndx)); return FSoundID(S_FindSoundByResID(ndx));
@ -120,7 +120,7 @@ protected:
enum EDummy { NoInit }; enum EDummy { NoInit };
FSoundID(EDummy) {} FSoundID(EDummy) {}
}; };
class FSoundIDNoInit : public FSoundID class FSoundIDNoInit : public FSoundID
{ {
public: public:
@ -196,7 +196,7 @@ void S_SetEnvironment (const ReverbContainer *settings);
ReverbContainer *S_FindEnvironment (const char *name); ReverbContainer *S_FindEnvironment (const char *name);
ReverbContainer *S_FindEnvironment (int id); ReverbContainer *S_FindEnvironment (int id);
void S_AddEnvironment (ReverbContainer *settings); void S_AddEnvironment (ReverbContainer *settings);
class SoundEngine class SoundEngine
{ {
protected: protected:

View file

@ -393,7 +393,7 @@ void FKeyBindings::PerformBind(FCommandLine &argv, const char *msg)
else else
{ {
Printf ("%s:\n", msg); Printf ("%s:\n", msg);
for (i = 0; i < NUM_KEYS; i++) for (i = 0; i < NUM_KEYS; i++)
{ {
if (!Binds[i].IsEmpty()) if (!Binds[i].IsEmpty())
@ -696,7 +696,7 @@ void ReadBindings(int lump, bool override)
} }
continue; continue;
} }
// bind destination is optional and is the same as the console command // bind destination is optional and is the same as the console command
if (sc.Compare("bind")) if (sc.Compare("bind"))
{ {

View file

@ -101,13 +101,13 @@ int ButtonMap::ListActionCommands (const char *pattern)
int ButtonMap::FindButtonIndex (const char *key, int funclen) const int ButtonMap::FindButtonIndex (const char *key, int funclen) const
{ {
if (!key) return -1; if (!key) return -1;
FName name = funclen == -1? FName(key, true) : FName(key, funclen, true); FName name = funclen == -1? FName(key, true) : FName(key, funclen, true);
if (name == NAME_None) return -1; if (name == NAME_None) return -1;
auto res = NameToNum.CheckKey(name); auto res = NameToNum.CheckKey(name);
if (!res) return -1; if (!res) return -1;
return *res; return *res;
} }

View file

@ -299,7 +299,7 @@ void FCommandBuffer::AddString(FString clip)
} }
auto strp = (const uint8_t*)clip.GetChars(); auto strp = (const uint8_t*)clip.GetChars();
while (auto chr = GetCharFromString(strp)) build += chr; while (auto chr = GetCharFromString(strp)) build += chr;
if (Text.length() == 0) if (Text.length() == 0)
{ {
Text = build; Text = build;

View file

@ -1027,7 +1027,7 @@ static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer)
TabbedList = false; TabbedList = false;
break; break;
} }
case '`': case '`':
// Check to see if we have ` bound to the console before accepting // Check to see if we have ` bound to the console before accepting
// it as a way to close the console. // it as a way to close the console.

View file

@ -72,7 +72,7 @@ FConsoleBuffer::FConsoleBuffer()
void FConsoleBuffer::AddText(int printlevel, const char *text) void FConsoleBuffer::AddText(int printlevel, const char *text)
{ {
FString build = TEXTCOLOR_TAN; FString build = TEXTCOLOR_TAN;
if (mAddType == REPLACELINE) if (mAddType == REPLACELINE)
{ {
// Just wondering: Do we actually need this case? If so, it may need some work. // Just wondering: Do we actually need this case? If so, it may need some work.
@ -85,15 +85,15 @@ void FConsoleBuffer::AddText(int printlevel, const char *text)
printlevel = -1; printlevel = -1;
mLastLineNeedsUpdate = true; mLastLineNeedsUpdate = true;
} }
if (printlevel >= 0 && printlevel != PRINT_HIGH) if (printlevel >= 0 && printlevel != PRINT_HIGH)
{ {
if (printlevel == 200) build = TEXTCOLOR_GREEN; if (printlevel == 200) build = TEXTCOLOR_GREEN;
else if (printlevel < PRINTLEVELS) build.Format("%c%c", TEXTCOLOR_ESCAPE, PrintColors[printlevel]+'A'); else if (printlevel < PRINTLEVELS) build.Format("%c%c", TEXTCOLOR_ESCAPE, PrintColors[printlevel]+'A');
} }
size_t textsize = strlen(text); size_t textsize = strlen(text);
if (text[textsize-1] == '\r') if (text[textsize-1] == '\r')
{ {
textsize--; textsize--;

View file

@ -56,12 +56,12 @@ class FConsoleBuffer
EAddType mAddType; EAddType mAddType;
int mTextLines; int mTextLines;
bool mBufferWasCleared; bool mBufferWasCleared;
FFont *mLastFont; FFont *mLastFont;
int mLastDisplayWidth; int mLastDisplayWidth;
bool mLastLineNeedsUpdate; bool mLastLineNeedsUpdate;
public: public:
FConsoleBuffer(); FConsoleBuffer();
void AddText(int printlevel, const char *string); void AddText(int printlevel, const char *string);

View file

@ -175,7 +175,7 @@ public:
static void ResetColors (); // recalc color cvars' indices after screen change static void ResetColors (); // recalc color cvars' indices after screen change
static void ListVars (const char *filter, bool plain); static void ListVars (const char *filter, bool plain);
const FString &GetDescription() const { return Description; }; const FString &GetDescription() const { return Description; };
const FString& GetToggleMessage(int which) { return ToggleMessages[which]; } const FString& GetToggleMessage(int which) { return ToggleMessages[which]; }
void SetToggleMessages(const char* on, const char* off) void SetToggleMessages(const char* on, const char* off)
@ -398,7 +398,7 @@ public:
protected: protected:
virtual void DoSet (UCVarValue value, ECVarType type); virtual void DoSet (UCVarValue value, ECVarType type);
static UCVarValue FromInt2 (int value, ECVarType type); static UCVarValue FromInt2 (int value, ECVarType type);
static int ToInt2 (UCVarValue value, ECVarType type); static int ToInt2 (UCVarValue value, ECVarType type);
}; };

View file

@ -253,7 +253,7 @@ void C_DoCommand (const char *cmd, int keynum)
return; return;
} }
} }
// Parse it as a normal command // Parse it as a normal command
// Checking for matching commands follows this search order: // Checking for matching commands follows this search order:
// 1. Check the Commands[] hash table // 1. Check the Commands[] hash table

View file

@ -248,7 +248,7 @@ done:
bool IsFloat (const char *str) bool IsFloat (const char *str)
{ {
const char *pt; const char *pt;
if (*str == '+' || *str == '-') if (*str == '+' || *str == '-')
str++; str++;
@ -367,7 +367,7 @@ static FStringProd *DoubleToString (FProduction *prod)
static FDoubleProd *StringToDouble (FProduction *prod) static FDoubleProd *StringToDouble (FProduction *prod)
{ {
FDoubleProd *newprod; FDoubleProd *newprod;
newprod = NewDoubleProd (atof (static_cast<FStringProd *>(prod)->Value)); newprod = NewDoubleProd (atof (static_cast<FStringProd *>(prod)->Value));
M_Free (prod); M_Free (prod);
return newprod; return newprod;

View file

@ -126,7 +126,7 @@ void FNotifyBufferBase::Tick()
{ {
Text[i].Ticker++; Text[i].Ticker++;
} }
for (i = 0; i < Text.Size(); ++i) for (i = 0; i < Text.Size(); ++i)
{ {
if (Text[i].TimeOut != 0 && Text[i].TimeOut > Text[i].Ticker) if (Text[i].TimeOut != 0 && Text[i].TimeOut > Text[i].Ticker)

View file

@ -174,7 +174,7 @@ class MvePlayer : public MoviePlayer
{ {
InterplayDecoder decoder; InterplayDecoder decoder;
bool failed = false; bool failed = false;
public: public:
bool isvalid() { return !failed; } bool isvalid() { return !failed; }

View file

@ -464,7 +464,7 @@ bool InterplayDecoder::RunFrame(uint64_t clock)
if (decodeMap.nSize) if (decodeMap.nSize)
{ {
int i = 0; int i = 0;
for (uint32_t y = 0; y < nHeight; y += 8) for (uint32_t y = 0; y < nHeight; y += 8)
{ {
for (uint32_t x = 0; x < nWidth; x += 8) for (uint32_t x = 0; x < nWidth; x += 8)

View file

@ -58,7 +58,7 @@ public:
{ {
CHUNK_PREAMBLE_SIZE = 4, CHUNK_PREAMBLE_SIZE = 4,
OPCODE_PREAMBLE_SIZE = 4, OPCODE_PREAMBLE_SIZE = 4,
CHUNK_INIT_AUDIO = 0x0000, CHUNK_INIT_AUDIO = 0x0000,
CHUNK_AUDIO_ONLY = 0x0001, CHUNK_AUDIO_ONLY = 0x0001,
CHUNK_INIT_VIDEO = 0x0002, CHUNK_INIT_VIDEO = 0x0002,
@ -70,7 +70,7 @@ public:
CHUNK_NOMEM = 0xFFFD, CHUNK_NOMEM = 0xFFFD,
CHUNK_EOF = 0xFFFE, CHUNK_EOF = 0xFFFE,
CHUNK_BAD = 0xFFFF, CHUNK_BAD = 0xFFFF,
OPCODE_END_OF_STREAM = 0x00, OPCODE_END_OF_STREAM = 0x00,
OPCODE_END_OF_CHUNK = 0x01, OPCODE_END_OF_CHUNK = 0x01,
OPCODE_CREATE_TIMER = 0x02, OPCODE_CREATE_TIMER = 0x02,
@ -93,7 +93,7 @@ public:
OPCODE_UNKNOWN_13 = 0x13, OPCODE_UNKNOWN_13 = 0x13,
OPCODE_UNKNOWN_14 = 0x14, OPCODE_UNKNOWN_14 = 0x14,
OPCODE_UNKNOWN_15 = 0x15, OPCODE_UNKNOWN_15 = 0x15,
PALETTE_COUNT = 256, PALETTE_COUNT = 256,
kAudioBlocks = 20 // alloc a lot of blocks - need to store lots of audio data before video frames start. kAudioBlocks = 20 // alloc a lot of blocks - need to store lots of audio data before video frames start.
}; };

View file

@ -97,20 +97,20 @@ void FCycler::Update(double diff)
{ {
double mult, angle; double mult, angle;
double step = m_end - m_start; double step = m_end - m_start;
if (!m_shouldCycle) if (!m_shouldCycle)
{ {
return; return;
} }
m_time += diff; m_time += diff;
if (m_time >= m_cycle) if (m_time >= m_cycle)
{ {
m_time = m_cycle; m_time = m_cycle;
} }
mult = m_time / m_cycle; mult = m_time / m_cycle;
switch (m_cycleType) switch (m_cycleType)
{ {
case CYCLE_Linear: case CYCLE_Linear:
@ -149,7 +149,7 @@ void FCycler::Update(double diff)
} }
break; break;
} }
if (m_time == m_cycle) if (m_time == m_cycle)
{ {
m_time = 0.; m_time = 0.;

View file

@ -23,7 +23,7 @@ public:
FCycler() = default; FCycler() = default;
FCycler(const FCycler &other) = default; FCycler(const FCycler &other) = default;
FCycler &operator=(const FCycler &other) = default; FCycler &operator=(const FCycler &other) = default;
void Update(double diff); void Update(double diff);
void SetParams(double start, double end, double cycle, bool update = false); void SetParams(double start, double end, double cycle, bool update = false);
void ShouldCycle(bool sc) { m_shouldCycle = sc; } void ShouldCycle(bool sc) { m_shouldCycle = sc; }

View file

@ -138,7 +138,7 @@ void D_RemoveNextCharEvent()
} }
} }
} }
//========================================================================== //==========================================================================
// //

View file

@ -172,7 +172,7 @@ FString GetPlayerName(int num)
SOCKET UDPsocket (void) SOCKET UDPsocket (void)
{ {
SOCKET s; SOCKET s;
// allocate a socket // allocate a socket
s = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP); s = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (s == INVALID_SOCKET) if (s == INVALID_SOCKET)
@ -193,7 +193,7 @@ void BindToLocalPort (SOCKET s, u_short port)
address.sin_family = AF_INET; address.sin_family = AF_INET;
address.sin_addr.s_addr = INADDR_ANY; address.sin_addr.s_addr = INADDR_ANY;
address.sin_port = htons(port); address.sin_port = htons(port);
v = bind (s, (sockaddr *)&address, sizeof(address)); v = bind (s, (sockaddr *)&address, sizeof(address));
if (v == SOCKET_ERROR) if (v == SOCKET_ERROR)
I_FatalError ("BindToPort: %s", neterror ()); I_FatalError ("BindToPort: %s", neterror ());
@ -459,7 +459,7 @@ void StartNetwork (bool autoPort)
netgame = true; netgame = true;
multiplayer = true; multiplayer = true;
// create communication socket // create communication socket
mysocket = UDPsocket (); mysocket = UDPsocket ();
BindToLocalPort (mysocket, autoPort ? 0 : DOOMPORT); BindToLocalPort (mysocket, autoPort ? 0 : DOOMPORT);
@ -892,7 +892,7 @@ bool JoinGame (int i)
SendAbort(); SendAbort();
return false; return false;
} }
StartScreen->NetMessage ("Total players: %d", doomcom.numnodes); StartScreen->NetMessage ("Total players: %d", doomcom.numnodes);
doomcom.id = DOOMCOM_ID; doomcom.id = DOOMCOM_ID;

View file

@ -76,7 +76,7 @@ struct doomcom_t
// packet data to be sent // packet data to be sent
uint8_t data[MAX_MSGLEN]; uint8_t data[MAX_MSGLEN];
}; };
extern doomcom_t doomcom; extern doomcom_t doomcom;

View file

@ -21,7 +21,7 @@ enum EJoyAxis
struct NOVTABLE IJoystickConfig struct NOVTABLE IJoystickConfig
{ {
virtual ~IJoystickConfig() = 0; virtual ~IJoystickConfig() = 0;
virtual FString GetName() = 0; virtual FString GetName() = 0;
virtual float GetSensitivity() = 0; virtual float GetSensitivity() = 0;
virtual void SetSensitivity(float scale) = 0; virtual void SetSensitivity(float scale) = 0;

View file

@ -857,7 +857,7 @@ bool FScanner::CheckFloat (bool evaluate)
UnGet(); UnGet();
return false; return false;
} }
Float = strtod (String, &stopper); Float = strtod (String, &stopper);
if (*stopper != 0) if (*stopper != 0)
{ {

View file

@ -159,7 +159,7 @@ public:
{ {
return constants.CheckKey(name); return constants.CheckKey(name);
} }
// Token based variant // Token based variant
bool CheckValue(bool allowfloat, bool evaluate = true); bool CheckValue(bool allowfloat, bool evaluate = true);
void MustGetValue(bool allowfloat, bool evaluate = true); void MustGetValue(bool allowfloat, bool evaluate = true);

View file

@ -102,14 +102,14 @@ std2:
":" { RET(':'); } ":" { RET(':'); }
";" { RET(';'); } ";" { RET(';'); }
"}" { StateMode = 0; StateOptions = false; RET('}'); } "}" { StateMode = 0; StateOptions = false; RET('}'); }
WSP+ { goto std1; } WSP+ { goto std1; }
"\n" { goto newline; } "\n" { goto newline; }
TOKS = (NWS\[/":;}]); TOKS = (NWS\[/":;}]);
TOKS* ([/] (TOKS\[*]) TOKS*)* TOKS* ([/] (TOKS\[*]) TOKS*)*
{ RET(TK_NonWhitespace); } { RET(TK_NonWhitespace); }
*/ */
} }
else if (tokens) // A well-defined scanner, based on the c.re example. else if (tokens) // A well-defined scanner, based on the c.re example.
@ -222,7 +222,7 @@ std2:
'canraise' { RET(StateOptions ? TK_CanRaise : TK_Identifier); } 'canraise' { RET(StateOptions ? TK_CanRaise : TK_Identifier); }
'offset' { RET(StateOptions ? TK_Offset : TK_Identifier); } 'offset' { RET(StateOptions ? TK_Offset : TK_Identifier); }
'light' { RET(StateOptions ? TK_Light : TK_Identifier); } 'light' { RET(StateOptions ? TK_Light : TK_Identifier); }
/* other DECORATE top level keywords */ /* other DECORATE top level keywords */
'#include' { RET(TK_Include); } '#include' { RET(TK_Include); }

View file

@ -623,7 +623,7 @@ void FSerializer::WriteObjects()
void FSerializer::ReadObjects(bool hubtravel) void FSerializer::ReadObjects(bool hubtravel)
{ {
bool founderrors = false; bool founderrors = false;
if (isReading() && BeginArray("objects")) if (isReading() && BeginArray("objects"))
{ {
// Do not link any thinker that's being created here. This will be done by deserializing the thinker list later. // Do not link any thinker that's being created here. This will be done by deserializing the thinker list later.

View file

@ -111,7 +111,7 @@ public:
{ {
return w != nullptr; return w != nullptr;
} }
bool canSkip() const; bool canSkip() const;
template<class T> template<class T>

View file

@ -42,7 +42,7 @@ struct FWriter
rapidjson::StringBuffer mOutString; rapidjson::StringBuffer mOutString;
TArray<DObject *> mDObjects; TArray<DObject *> mDObjects;
TMap<DObject *, int> mObjectMap; TMap<DObject *, int> mObjectMap;
FWriter(bool pretty) FWriter(bool pretty)
{ {
if (!pretty) if (!pretty)
@ -193,7 +193,7 @@ struct FReader
rapidjson::Value *FindKey(const char *key) rapidjson::Value *FindKey(const char *key)
{ {
FJSONObject &obj = mObjects.Last(); FJSONObject &obj = mObjects.Last();
if (obj.mObject->IsObject()) if (obj.mObject->IsObject())
{ {
if (key == nullptr) if (key == nullptr)

View file

@ -47,7 +47,7 @@ public:
CurPos = 0; CurPos = 0;
NotchPos = 0; NotchPos = 0;
} }
virtual ~FStartupScreen() = default; virtual ~FStartupScreen() = default;
virtual void Progress() {} virtual void Progress() {}
@ -98,7 +98,7 @@ public:
void AppendStatusLine(const char *status); void AppendStatusLine(const char *status);
protected: protected:
void SetWindowSize(); void SetWindowSize();
int ThermX, ThermY, ThermWidth, ThermHeight; int ThermX, ThermY, ThermWidth, ThermHeight;
int HMsgY, SMsgX; int HMsgY, SMsgX;
}; };

View file

@ -61,28 +61,28 @@ public:
{ {
Sec = 0; Sec = 0;
} }
void Clock() void Clock()
{ {
timespec ts; timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts); clock_gettime(CLOCK_MONOTONIC, &ts);
Sec -= ts.tv_sec + ts.tv_nsec * 1e-9; Sec -= ts.tv_sec + ts.tv_nsec * 1e-9;
} }
void Unclock() void Unclock()
{ {
timespec ts; timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts); clock_gettime(CLOCK_MONOTONIC, &ts);
Sec += ts.tv_sec + ts.tv_nsec * 1e-9; Sec += ts.tv_sec + ts.tv_nsec * 1e-9;
} }
double Time() double Time()
{ {
return Sec; return Sec;
} }
double TimeMS() double TimeMS()
{ {
return Sec * 1e3; return Sec * 1e3;
@ -159,24 +159,24 @@ public:
{ {
Counter = 0; Counter = 0;
} }
void Clock() void Clock()
{ {
int64_t time = rdtsc(); int64_t time = rdtsc();
Counter -= time; Counter -= time;
} }
void Unclock(bool checkvar = true) void Unclock(bool checkvar = true)
{ {
int64_t time = rdtsc(); int64_t time = rdtsc();
Counter += time; Counter += time;
} }
double Time() double Time()
{ {
return Counter * PerfToSec; return Counter * PerfToSec;
} }
double TimeMS() double TimeMS()
{ {
return Counter * PerfToMillisec; return Counter * PerfToMillisec;

View file

@ -639,7 +639,7 @@ bool FStringTable::MatchDefaultString(const char *name, const char *content) con
// This only compares the first line to avoid problems with bad linefeeds. For the few cases where this feature is needed it is sufficient. // This only compares the first line to avoid problems with bad linefeeds. For the few cases where this feature is needed it is sufficient.
auto c = GetLanguageString(name, FStringTable::default_table); auto c = GetLanguageString(name, FStringTable::default_table);
if (!c) return false; if (!c) return false;
// Check a secondary key, in case the text comparison cannot be done due to needed orthographic fixes (see Harmony's exit text) // Check a secondary key, in case the text comparison cannot be done due to needed orthographic fixes (see Harmony's exit text)
FStringf checkkey("%s_CHECK", name); FStringf checkkey("%s_CHECK", name);
auto cc = GetLanguageString(checkkey, FStringTable::default_table); auto cc = GetLanguageString(checkkey, FStringTable::default_table);

View file

@ -91,7 +91,7 @@ public:
allStrings.Insert(override_table, map); allStrings.Insert(override_table, map);
UpdateLanguage(nullptr); UpdateLanguage(nullptr);
} }
const char *GetLanguageString(const char *name, uint32_t langtable, int gender = -1) const; const char *GetLanguageString(const char *name, uint32_t langtable, int gender = -1) const;
bool MatchDefaultString(const char *name, const char *content) const; bool MatchDefaultString(const char *name, const char *content) const;
const char *GetString(const char *name, uint32_t *langtable, int gender = -1) const; const char *GetString(const char *name, uint32_t *langtable, int gender = -1) const;
@ -110,7 +110,7 @@ private:
StringMacroMap allMacros; StringMacroMap allMacros;
LangMap allStrings; LangMap allStrings;
TArray<std::pair<uint32_t, StringMap*>> currentLanguageSet; TArray<std::pair<uint32_t, StringMap*>> currentLanguageSet;
void LoadLanguage (int lumpnum, const TArray<uint8_t> &buffer); void LoadLanguage (int lumpnum, const TArray<uint8_t> &buffer);
TArray<TArray<FString>> parseCSV(const TArray<uint8_t> &buffer); TArray<TArray<FString>> parseCSV(const TArray<uint8_t> &buffer);
bool ParseLanguageCSV(int lumpnum, const TArray<uint8_t> &buffer); bool ParseLanguageCSV(int lumpnum, const TArray<uint8_t> &buffer);
@ -127,7 +127,7 @@ public:
if (*str == '$') return str; if (*str == '$') return str;
return FString("$") + str; return FString("$") + str;
} }
static FString MakeMacro(const char *str, size_t len) static FString MakeMacro(const char *str, size_t len)
{ {
if (*str == '$') return FString(str, len); if (*str == '$') return FString(str, len);

View file

@ -57,7 +57,7 @@ ColorTable256k RGB256k;
void BuildTransTable (const PalEntry *palette) void BuildTransTable (const PalEntry *palette)
{ {
int r, g, b; int r, g, b;
// create the RGB555 lookup table // create the RGB555 lookup table
for (r = 0; r < 32; r++) for (r = 0; r < 32; r++)
for (g = 0; g < 32; g++) for (g = 0; g < 32; g++)
@ -68,16 +68,16 @@ void BuildTransTable (const PalEntry *palette)
for (g = 0; g < 64; g++) for (g = 0; g < 64; g++)
for (b = 0; b < 64; b++) for (b = 0; b < 64; b++)
RGB256k.RGB[r][g][b] = ColorMatcher.Pick ((r<<2)|(r>>4), (g<<2)|(g>>4), (b<<2)|(b>>4)); RGB256k.RGB[r][g][b] = ColorMatcher.Pick ((r<<2)|(r>>4), (g<<2)|(g>>4), (b<<2)|(b>>4));
int x, y; int x, y;
// create the swizzled palette // create the swizzled palette
for (x = 0; x < 65; x++) for (x = 0; x < 65; x++)
for (y = 0; y < 256; y++) for (y = 0; y < 256; y++)
Col2RGB8[x][y] = (((palette[y].r*x)>>4)<<20) | Col2RGB8[x][y] = (((palette[y].r*x)>>4)<<20) |
((palette[y].g*x)>>4) | ((palette[y].g*x)>>4) |
(((palette[y].b*x)>>4)<<10); (((palette[y].b*x)>>4)<<10);
// create the swizzled palette with the lsb of red and blue forced to 0 // create the swizzled palette with the lsb of red and blue forced to 0
// (for green, a 1 is okay since it never gets added into) // (for green, a 1 is okay since it never gets added into)
for (x = 1; x < 64; x++) for (x = 1; x < 64; x++)
@ -90,7 +90,7 @@ void BuildTransTable (const PalEntry *palette)
} }
Col2RGB8_LessPrecision[0] = Col2RGB8[0]; Col2RGB8_LessPrecision[0] = Col2RGB8[0];
Col2RGB8_LessPrecision[64] = Col2RGB8[64]; Col2RGB8_LessPrecision[64] = Col2RGB8[64];
// create the inverse swizzled palette // create the inverse swizzled palette
for (x = 0; x < 65; x++) for (x = 0; x < 65; x++)
for (y = 0; y < 256; y++) for (y = 0; y < 256; y++)

View file

@ -118,7 +118,7 @@ int FDirectory::AddDirectory(const char *dirpath)
FString dirmatch = dirpath; FString dirmatch = dirpath;
findstate_t find; findstate_t find;
dirmatch += '*'; dirmatch += '*';
handle = I_FindFirst(dirmatch.GetChars(), &find); handle = I_FindFirst(dirmatch.GetChars(), &find);
if (handle == ((void *)(-1))) if (handle == ((void *)(-1)))
{ {

View file

@ -99,7 +99,7 @@ bool FGrpFile::Open(bool quiet, LumpFilterInfo*)
Reader.Read(&header, sizeof(header)); Reader.Read(&header, sizeof(header));
NumLumps = LittleLong(header.NumLumps); NumLumps = LittleLong(header.NumLumps);
GrpLump *fileinfo = new GrpLump[NumLumps]; GrpLump *fileinfo = new GrpLump[NumLumps];
Reader.Read (fileinfo, NumLumps * sizeof(GrpLump)); Reader.Read (fileinfo, NumLumps * sizeof(GrpLump));

View file

@ -95,7 +95,7 @@ bool FPakFile::Open(bool quiet, LumpFilterInfo* filter)
Reader.Read(&header, sizeof(header)); Reader.Read(&header, sizeof(header));
NumLumps = LittleLong(header.dirlen) / sizeof(dpackfile_t); NumLumps = LittleLong(header.dirlen) / sizeof(dpackfile_t);
header.dirofs = LittleLong(header.dirofs); header.dirofs = LittleLong(header.dirofs);
TArray<dpackfile_t> fileinfo(NumLumps, true); TArray<dpackfile_t> fileinfo(NumLumps, true);
Reader.Seek (header.dirofs, FileReader::SeekSet); Reader.Seek (header.dirofs, FileReader::SeekSet);
Reader.Read (fileinfo.Data(), NumLumps * sizeof(dpackfile_t)); Reader.Read (fileinfo.Data(), NumLumps * sizeof(dpackfile_t));

View file

@ -221,7 +221,7 @@ int FRFFLump::FillCache()
{ {
int cryptlen = min<int> (LumpSize, 256); int cryptlen = min<int> (LumpSize, 256);
uint8_t *data = (uint8_t *)Cache; uint8_t *data = (uint8_t *)Cache;
for (int i = 0; i < cryptlen; ++i) for (int i = 0; i < cryptlen; ++i)
{ {
data[i] ^= i >> 1; data[i] ^= i >> 1;

View file

@ -206,7 +206,7 @@ bool FWadFile::Open(bool quiet, LumpFilterInfo*)
Lumps[i].LumpSize = isBigEndian ? BigLong(fileinfo[i].Size) : LittleLong(fileinfo[i].Size); Lumps[i].LumpSize = isBigEndian ? BigLong(fileinfo[i].Size) : LittleLong(fileinfo[i].Size);
Lumps[i].Namespace = ns_global; Lumps[i].Namespace = ns_global;
Lumps[i].Flags = Lumps[i].Compressed ? LUMPF_COMPRESSED | LUMPF_SHORTNAME : LUMPF_SHORTNAME; Lumps[i].Flags = Lumps[i].Compressed ? LUMPF_COMPRESSED | LUMPF_SHORTNAME : LUMPF_SHORTNAME;
// Check if the lump is within the WAD file and print a warning if not. // Check if the lump is within the WAD file and print a warning if not.
if (Lumps[i].Position + Lumps[i].LumpSize > wadSize || Lumps[i].Position < 0 || Lumps[i].LumpSize < 0) if (Lumps[i].Position + Lumps[i].LumpSize > wadSize || Lumps[i].Position < 0 || Lumps[i].LumpSize < 0)
{ {
@ -279,7 +279,7 @@ void FWadFile::SetNamespace(const char *startmarker, const char *endmarker, name
int numstartmarkers = 0, numendmarkers = 0; int numstartmarkers = 0, numendmarkers = 0;
unsigned int i; unsigned int i;
TArray<Marker> markers; TArray<Marker> markers;
for(i = 0; i < NumLumps; i++) for(i = 0; i < NumLumps; i++)
{ {
if (IsMarker(i, startmarker)) if (IsMarker(i, startmarker))
@ -302,7 +302,7 @@ void FWadFile::SetNamespace(const char *startmarker, const char *endmarker, name
Printf(TEXTCOLOR_YELLOW"WARNING: %s marker without corresponding %s found.\n", endmarker, startmarker); Printf(TEXTCOLOR_YELLOW"WARNING: %s marker without corresponding %s found.\n", endmarker, startmarker);
if (flathack) if (flathack)
{ {
// We have found no F_START but one or more F_END markers. // We have found no F_START but one or more F_END markers.

View file

@ -95,10 +95,10 @@ FWHResFile::FWHResFile(const char *filename, FileReader &file)
bool FWHResFile::Open(bool quiet, LumpFilterInfo*) bool FWHResFile::Open(bool quiet, LumpFilterInfo*)
{ {
int directory[1024]; int directory[1024];
Reader.Seek(-4096, FileReader::SeekEnd); Reader.Seek(-4096, FileReader::SeekEnd);
Reader.Read(directory, 4096); Reader.Read(directory, 4096);
int nl =1024/3; int nl =1024/3;
Lumps.Resize(nl); Lumps.Resize(nl);
@ -135,10 +135,10 @@ FResourceFile *CheckWHRes(const char *filename, FileReader &file, bool quiet, Lu
{ {
int directory[1024]; int directory[1024];
int nl =1024/3; int nl =1024/3;
file.Seek(-4096, FileReader::SeekEnd); file.Seek(-4096, FileReader::SeekEnd);
file.Read(directory, 4096); file.Read(directory, 4096);
int checkpos = 0; int checkpos = 0;
for(int k = 0; k < nl; k++) for(int k = 0; k < nl; k++)
{ {

View file

@ -219,12 +219,12 @@ void FileSystem::InitMultipleFiles (TArray<FString> &filenames, bool quiet, Lump
for(unsigned i=0;i<filenames.Size(); i++) for(unsigned i=0;i<filenames.Size(); i++)
{ {
AddFile (filenames[i], nullptr, quiet, filter); AddFile (filenames[i], nullptr, quiet, filter);
if (i == (unsigned)MaxIwadIndex) MoveLumpsInFolder("after_iwad/"); if (i == (unsigned)MaxIwadIndex) MoveLumpsInFolder("after_iwad/");
FStringf path("filter/%s", Files.Last()->GetHash().GetChars()); FStringf path("filter/%s", Files.Last()->GetHash().GetChars());
MoveLumpsInFolder(path); MoveLumpsInFolder(path);
} }
NumEntries = FileInfo.Size(); NumEntries = FileInfo.Size();
if (NumEntries == 0) if (NumEntries == 0)
{ {
@ -283,7 +283,7 @@ int FileSystem::AddFromBuffer(const char* name, const char* type, char* data, in
FileInfo.Last().resourceId = id; FileInfo.Last().resourceId = id;
return FileInfo.Size()-1; return FileInfo.Size()-1;
} }
//========================================================================== //==========================================================================
// //
// AddFile // AddFile
@ -332,7 +332,7 @@ void FileSystem::AddFile (const char *filename, FileReader *filer, bool quiet, L
startlump = NumEntries; startlump = NumEntries;
FResourceFile *resfile; FResourceFile *resfile;
if (!isdir) if (!isdir)
resfile = FResourceFile::OpenResourceFile(filename, filereader, quiet, false, filter); resfile = FResourceFile::OpenResourceFile(filename, filereader, quiet, false, filter);
else else
@ -945,10 +945,10 @@ void FileSystem::MoveLumpsInFolder(const char *path)
{ {
return; return;
} }
auto len = strlen(path); auto len = strlen(path);
auto rfnum = FileInfo.Last().rfnum; auto rfnum = FileInfo.Last().rfnum;
unsigned i; unsigned i;
for (i = 0; i < FileInfo.Size(); i++) for (i = 0; i < FileInfo.Size(); i++)
{ {
@ -1021,7 +1021,7 @@ int FileSystem::FindLumpMulti (const char **names, int *lastlump, bool anyns, in
{ {
if (anyns || lump_p->Namespace == ns_global) if (anyns || lump_p->Namespace == ns_global)
{ {
for(const char **name = names; *name != NULL; name++) for(const char **name = names; *name != NULL; name++)
{ {
if (!strnicmp(*name, lump_p->shortName.String, 8)) if (!strnicmp(*name, lump_p->shortName.String, 8))
@ -1511,7 +1511,7 @@ int FileSystem::GetEntryCount (int rfnum) const noexcept
{ {
return 0; return 0;
} }
return Files[rfnum]->LumpCount(); return Files[rfnum]->LumpCount();
} }

View file

@ -306,11 +306,11 @@ int lumpcmp(const void * a, const void * b)
void FResourceFile::GenerateHash() void FResourceFile::GenerateHash()
{ {
// hash the lump directory after sorting // hash the lump directory after sorting
Hash.Format(("%08X-%04X-"), (unsigned)Reader.GetLength(), NumLumps); Hash.Format(("%08X-%04X-"), (unsigned)Reader.GetLength(), NumLumps);
MD5Context md5; MD5Context md5;
uint8_t digest[16]; uint8_t digest[16];
for(uint32_t i = 0; i < NumLumps; i++) for(uint32_t i = 0; i < NumLumps; i++)
{ {
@ -382,9 +382,9 @@ int FResourceFile::FilterLumps(FString filtername, void *lumps, size_t lumpsize,
return 0; return 0;
} }
filter << "filter/" << filtername << '/'; filter << "filter/" << filtername << '/';
bool found = FindPrefixRange(filter, lumps, lumpsize, max, start, end); bool found = FindPrefixRange(filter, lumps, lumpsize, max, start, end);
// Workaround for old Doom filter names. // Workaround for old Doom filter names.
if (!found && filtername.IndexOf("doom.id.doom") == 0) if (!found && filtername.IndexOf("doom.id.doom") == 0)
{ {

View file

@ -86,10 +86,10 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
TMap<int, FGameTexture*> charMap; TMap<int, FGameTexture*> charMap;
int minchar = INT_MAX; int minchar = INT_MAX;
int maxchar = INT_MIN; int maxchar = INT_MIN;
// Read the font's configuration. // Read the font's configuration.
// This will not be done for the default fonts, because they are not atomic and the default content does not need it. // This will not be done for the default fonts, because they are not atomic and the default content does not need it.
TArray<FolderEntry> folderdata; TArray<FolderEntry> folderdata;
if (filetemplate != nullptr) if (filetemplate != nullptr)
{ {
@ -97,16 +97,16 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
// If a name template is given, collect data from all resource files. // If a name template is given, collect data from all resource files.
// For anything else, each folder is being treated as an atomic, self-contained unit and mixing from different glyph sets is blocked. // For anything else, each folder is being treated as an atomic, self-contained unit and mixing from different glyph sets is blocked.
fileSystem.GetFilesInFolder(path, folderdata, nametemplate == nullptr); fileSystem.GetFilesInFolder(path, folderdata, nametemplate == nullptr);
//if (nametemplate == nullptr) //if (nametemplate == nullptr)
{ {
FStringf infpath("fonts/%s/font.inf", filetemplate); FStringf infpath("fonts/%s/font.inf", filetemplate);
unsigned index = folderdata.FindEx([=](const FolderEntry &entry) unsigned index = folderdata.FindEx([=](const FolderEntry &entry)
{ {
return infpath.CompareNoCase(entry.name) == 0; return infpath.CompareNoCase(entry.name) == 0;
}); });
if (index < folderdata.Size()) if (index < folderdata.Size())
{ {
FScanner sc; FScanner sc;
@ -182,7 +182,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
} }
} }
} }
if (FixedWidth > 0) if (FixedWidth > 0)
{ {
ReadSheetFont(folderdata, FixedWidth, FontHeight, Scale); ReadSheetFont(folderdata, FixedWidth, FontHeight, Scale);
@ -559,10 +559,10 @@ FFont *FFont::FindFont (FName name)
void RecordTextureColors (FImageSource *pic, uint32_t *usedcolors) void RecordTextureColors (FImageSource *pic, uint32_t *usedcolors)
{ {
int x; int x;
auto pixels = pic->GetPalettedPixels(false); auto pixels = pic->GetPalettedPixels(false);
auto size = pic->GetWidth() * pic->GetHeight(); auto size = pic->GetWidth() * pic->GetHeight();
for(x = 0;x < size; x++) for(x = 0;x < size; x++)
{ {
usedcolors[pixels[x]]++; usedcolors[pixels[x]]++;
@ -727,7 +727,7 @@ int FFont::GetCharCode(int code, bool needpic) const
{ {
return code; return code;
} }
// Use different substitution logic based on the fonts content: // Use different substitution logic based on the fonts content:
// In a font which has both upper and lower case, prefer unaccented small characters over capital ones. // In a font which has both upper and lower case, prefer unaccented small characters over capital ones.
// In a pure upper-case font, do not check for lower case replacements. // In a pure upper-case font, do not check for lower case replacements.
@ -805,7 +805,7 @@ FGameTexture *FFont::GetChar (int code, int translation, int *const width) const
code -= FirstChar; code -= FirstChar;
xmove = Chars[code].XMove; xmove = Chars[code].XMove;
} }
if (width != nullptr) if (width != nullptr)
{ {
*width = xmove; *width = xmove;

View file

@ -266,7 +266,7 @@ int FHexFontChar2::CopyPixels(FBitmap* bmp, int conversion)
class FHexFont : public FFont class FHexFont : public FFont
{ {
public: public:
//========================================================================== //==========================================================================
// //
@ -283,14 +283,14 @@ public:
assert(lump >= 0); assert(lump >= 0);
FontName = fontname; FontName = fontname;
FirstChar = hexdata.FirstChar; FirstChar = hexdata.FirstChar;
LastChar = hexdata.LastChar; LastChar = hexdata.LastChar;
FontHeight = 16; FontHeight = 16;
SpaceWidth = 9; SpaceWidth = 9;
GlobalKerning = 0; GlobalKerning = 0;
Chars.Resize(LastChar - FirstChar + 1); Chars.Resize(LastChar - FirstChar + 1);
for (int i = FirstChar; i <= LastChar; i++) for (int i = FirstChar; i <= LastChar; i++)
{ {
@ -325,7 +325,7 @@ public:
else Translations[i] = LuminosityTranslation(i * 2 + 1, minlum, maxlum); else Translations[i] = LuminosityTranslation(i * 2 + 1, minlum, maxlum);
} }
} }
}; };

View file

@ -96,7 +96,7 @@ protected:
void LoadFON1 (int lump, const uint8_t *data); void LoadFON1 (int lump, const uint8_t *data);
void LoadFON2 (int lump, const uint8_t *data); void LoadFON2 (int lump, const uint8_t *data);
void LoadBMF (int lump, const uint8_t *data); void LoadBMF (int lump, const uint8_t *data);
enum enum
{ {
FONT1, FONT1,
@ -259,7 +259,7 @@ void FSingleLumpFont::LoadFON2 (int lump, const uint8_t *data)
LastChar = data[7]; LastChar = data[7];
ActiveColors = data[10]+1; ActiveColors = data[10]+1;
RescalePalette = data[9] == 0; RescalePalette = data[9] == 0;
count = LastChar - FirstChar + 1; count = LastChar - FirstChar + 1;
Chars.Resize(count); Chars.Resize(count);
TArray<int> widths2(count, true); TArray<int> widths2(count, true);

View file

@ -106,10 +106,10 @@ FFont *V_GetFont(const char *name, const char *fontlumpname)
int lump = -1; int lump = -1;
int folderfile = -1; int folderfile = -1;
TArray<FolderEntry> folderdata; TArray<FolderEntry> folderdata;
FStringf path("fonts/%s/", name); FStringf path("fonts/%s/", name);
// Use a folder-based font only if it comes from a later file than the single lump version. // Use a folder-based font only if it comes from a later file than the single lump version.
if (fileSystem.GetFilesInFolder(path, folderdata, true)) if (fileSystem.GetFilesInFolder(path, folderdata, true))
{ {
@ -119,7 +119,7 @@ FFont *V_GetFont(const char *name, const char *fontlumpname)
lump = fileSystem.CheckNumForFullName(fontlumpname? fontlumpname : name, true); lump = fileSystem.CheckNumForFullName(fontlumpname? fontlumpname : name, true);
if (lump != -1 && fileSystem.GetFileContainer(lump) >= folderfile) if (lump != -1 && fileSystem.GetFileContainer(lump) >= folderfile)
{ {
uint32_t head; uint32_t head;
@ -769,7 +769,7 @@ static void CalcDefaultTranslation(FFont* base, int index)
lowindex = highindex++; lowindex = highindex++;
} }
} }
} }
//========================================================================== //==========================================================================

View file

@ -271,7 +271,7 @@ DMenu::DMenu(DMenu *parent)
DontDim = false; DontDim = false;
GC::WriteBarrier(this, parent); GC::WriteBarrier(this, parent);
} }
//============================================================================= //=============================================================================
// //
// //

View file

@ -48,7 +48,7 @@ protected:
unsigned int mNumIndices; unsigned int mNumIndices;
TArray<FModelVertex> mVertices; TArray<FModelVertex> mVertices;
TArray<unsigned int> mIndices; TArray<unsigned int> mIndices;
void MakeSlabPolys(int x, int y, kvxslab_t *voxptr, FVoxelMap &check); void MakeSlabPolys(int x, int y, kvxslab_t *voxptr, FVoxelMap &check);
void AddFace(int x1, int y1, int z1, int x2, int y2, int z2, int x3, int y3, int z3, int x4, int y4, int z4, uint8_t color, FVoxelMap &check); void AddFace(int x1, int y1, int z1, int x2, int y2, int z2, int x3, int y3, int z3, int x4, int y4, int z4, uint8_t color, FVoxelMap &check);
unsigned int AddVertex(FModelVertex &vert, FVoxelMap &check); unsigned int AddVertex(FModelVertex &vert, FVoxelMap &check);

View file

@ -536,7 +536,7 @@ void FMD2Model::LoadGeometry()
} }
lods[0].triangles = new FTriangle[lodInfo[0].numTriangles]; lods[0].triangles = new FTriangle[lodInfo[0].numTriangles];
int cnt = lodInfo[0].numTriangles; int cnt = lodInfo[0].numTriangles;
memcpy(lods[0].triangles, buffer + lodInfo[0].offsetTriangles, sizeof(FTriangle) * cnt); memcpy(lods[0].triangles, buffer + lodInfo[0].offsetTriangles, sizeof(FTriangle) * cnt);
for (int j = 0; j < cnt; j++) for (int j = 0; j < cnt; j++)

View file

@ -133,7 +133,7 @@ bool FMD3Model::Load(const char * path, int lumpnum, const char * buffer, int le
auto numFrames = LittleLong(hdr->Num_Frames); auto numFrames = LittleLong(hdr->Num_Frames);
auto numSurfaces = LittleLong(hdr->Num_Surfaces); auto numSurfaces = LittleLong(hdr->Num_Surfaces);
numTags = LittleLong(hdr->Num_Tags); numTags = LittleLong(hdr->Num_Tags);
md3_frame_t * frm = (md3_frame_t*)(buffer + LittleLong(hdr->Ofs_Frames)); md3_frame_t * frm = (md3_frame_t*)(buffer + LittleLong(hdr->Ofs_Frames));

View file

@ -100,7 +100,7 @@ TArray<uint8_t> FVoxelTexture::CreatePalettedPixels(int conversion)
pe.b = (pp[2] << 2) | (pp[2] >> 4); pe.b = (pp[2] << 2) | (pp[2] >> 4);
// Alphatexture handling is just for completeness, but rather unlikely to be used ever. // Alphatexture handling is just for completeness, but rather unlikely to be used ever.
Pixels[i] = conversion == luminance ? pe.r : ColorMatcher.Pick(pe); Pixels[i] = conversion == luminance ? pe.r : ColorMatcher.Pick(pe);
} }
} }
else else

View file

@ -267,7 +267,7 @@ DObject::~DObject ()
Release(); Release();
} }
} }
if (nullptr != type) if (nullptr != type)
{ {
type->DestroySpecials(this); type->DestroySpecials(this);

View file

@ -429,7 +429,7 @@ void ProcessKeyboardEventInMenu(NSEvent* theEvent)
event.subtype = EV_GUI_Char; event.subtype = EV_GUI_Char;
event.data1 = realchar; event.data1 = realchar;
event.data2 = event.data3 & GKM_ALT; event.data2 = event.data3 & GKM_ALT;
D_PostEvent(&event); D_PostEvent(&event);
} }
} }
@ -667,9 +667,9 @@ void ProcessMouseWheelEvent(NSEvent* theEvent)
{ {
return; return;
} }
event_t event = {}; event_t event = {};
if (GUICapture) if (GUICapture)
{ {
event.type = EV_GUI_Event; event.type = EV_GUI_Event;
@ -681,7 +681,7 @@ void ProcessMouseWheelEvent(NSEvent* theEvent)
event.type = isZeroDelta ? EV_KeyUp : EV_KeyDown; event.type = isZeroDelta ? EV_KeyUp : EV_KeyDown;
event.data1 = delta > 0.0f ? KEY_MWHEELUP : KEY_MWHEELDOWN; event.data1 = delta > 0.0f ? KEY_MWHEELUP : KEY_MWHEELDOWN;
} }
D_PostEvent(&event); D_PostEvent(&event);
} }

View file

@ -1127,7 +1127,7 @@ void IOKitJoystickManager::AddDevices(const IONotificationPortRef notificationPo
} }
IOObjectRelease(device); IOObjectRelease(device);
PostDeviceChangeEvent(); PostDeviceChangeEvent();
} }
} }

View file

@ -90,10 +90,10 @@ static bool ReadSystemVersionFromPlist(NSOperatingSystemVersion& version)
if (stat(plistPath, &dummy) != 0) if (stat(plistPath, &dummy) != 0)
return false; return false;
char commandLine[1024] = {}; char commandLine[1024] = {};
snprintf(commandLine, sizeof commandLine, "defaults read %s ProductVersion", plistPath); snprintf(commandLine, sizeof commandLine, "defaults read %s ProductVersion", plistPath);
FILE *const versionFile = popen(commandLine, "r"); FILE *const versionFile = popen(commandLine, "r");
if (versionFile == nullptr) if (versionFile == nullptr)
@ -146,7 +146,7 @@ void I_DetectOS()
} }
const char* name = "Unknown version"; const char* name = "Unknown version";
switch (version.majorVersion) switch (version.majorVersion)
{ {
case 10: case 10:
@ -183,7 +183,7 @@ void I_DetectOS()
#else #else
"Unknown"; "Unknown";
#endif #endif
Printf("%s running %s %d.%d.%d (%s) %s\n", model, name, Printf("%s running %s %d.%d.%d (%s) %s\n", model, name,
int(version.majorVersion), int(version.minorVersion), int(version.patchVersion), int(version.majorVersion), int(version.minorVersion), int(version.patchVersion),
release, architecture); release, architecture);
@ -266,14 +266,14 @@ ApplicationController* appCtrl;
- (void)keyDown:(NSEvent*)theEvent - (void)keyDown:(NSEvent*)theEvent
{ {
// Empty but present to avoid playing of 'beep' alert sound // Empty but present to avoid playing of 'beep' alert sound
ZD_UNUSED(theEvent); ZD_UNUSED(theEvent);
} }
- (void)keyUp:(NSEvent*)theEvent - (void)keyUp:(NSEvent*)theEvent
{ {
// Empty but present to avoid playing of 'beep' alert sound // Empty but present to avoid playing of 'beep' alert sound
ZD_UNUSED(theEvent); ZD_UNUSED(theEvent);
} }
@ -283,7 +283,7 @@ extern bool AppActive;
- (void)applicationDidBecomeActive:(NSNotification*)aNotification - (void)applicationDidBecomeActive:(NSNotification*)aNotification
{ {
ZD_UNUSED(aNotification); ZD_UNUSED(aNotification);
S_SetSoundPaused(1); S_SetSoundPaused(1);
AppActive = true; AppActive = true;
@ -292,7 +292,7 @@ extern bool AppActive;
- (void)applicationWillResignActive:(NSNotification*)aNotification - (void)applicationWillResignActive:(NSNotification*)aNotification
{ {
ZD_UNUSED(aNotification); ZD_UNUSED(aNotification);
S_SetSoundPaused(i_soundinbackground); S_SetSoundPaused(i_soundinbackground);
AppActive = false; AppActive = false;

View file

@ -449,7 +449,7 @@ public:
} }
else else
#endif #endif
#ifdef HAVE_SOFTPOLY #ifdef HAVE_SOFTPOLY
if (vid_preferbackend == 2) if (vid_preferbackend == 2)
{ {
@ -832,7 +832,7 @@ bool I_SetCursor(FGameTexture *cursorpic)
if (NULL != cursorpic && cursorpic->isValid()) if (NULL != cursorpic && cursorpic->isValid())
{ {
// Create bitmap image representation // Create bitmap image representation
auto sbuffer = cursorpic->GetTexture()->CreateTexBuffer(0); auto sbuffer = cursorpic->GetTexture()->CreateTexBuffer(0);
const NSInteger imageWidth = sbuffer.mWidth; const NSInteger imageWidth = sbuffer.mWidth;
@ -873,11 +873,11 @@ bool I_SetCursor(FGameTexture *cursorpic)
cursor = [[NSCursor alloc] initWithImage:cursorImage cursor = [[NSCursor alloc] initWithImage:cursorImage
hotSpot:NSMakePoint(0.0f, 0.0f)]; hotSpot:NSMakePoint(0.0f, 0.0f)];
} }
SystemBaseFrameBuffer::SetCursor(cursor); SystemBaseFrameBuffer::SetCursor(cursor);
[pool release]; [pool release];
return true; return true;
} }

View file

@ -256,7 +256,7 @@ FString M_GetDocumentsPath()
FString M_GetDemoPath() FString M_GetDemoPath()
{ {
FString path = GetSpecialPath(NSDocumentDirectory); FString path = GetSpecialPath(NSDocumentDirectory);
if (path.IsNotEmpty()) if (path.IsNotEmpty())
{ {
path += "/" GAME_DIR "/Demos/"; path += "/" GAME_DIR "/Demos/";

View file

@ -446,7 +446,7 @@ int I_PickIWad_Cocoa (WadStuff *wads, int numwads, bool showwin, int defaultiwad
if (ret >= 0) if (ret >= 0)
{ {
NSString* parametersToAppend = [picker commandLineParameters]; NSString* parametersToAppend = [picker commandLineParameters];
if (0 != [parametersToAppend length]) if (0 != [parametersToAppend length])
{ {
RestartWithParameters(wads[ret], parametersToAppend); RestartWithParameters(wads[ret], parametersToAppend);

View file

@ -79,7 +79,7 @@ void I_InitGraphics ()
extern IVideo *gl_CreateVideo(); extern IVideo *gl_CreateVideo();
Video = gl_CreateVideo(); Video = gl_CreateVideo();
if (Video == NULL) if (Video == NULL)
I_FatalError ("Failed to initialize display"); I_FatalError ("Failed to initialize display");
} }

View file

@ -205,7 +205,7 @@ static void MouseRead ()
static void I_CheckNativeMouse () static void I_CheckNativeMouse ()
{ {
bool focus = SDL_GetKeyboardFocus() != NULL; bool focus = SDL_GetKeyboardFocus() != NULL;
bool captureModeInGame = sysCallbacks.CaptureModeInGame && sysCallbacks.CaptureModeInGame(); bool captureModeInGame = sysCallbacks.CaptureModeInGame && sysCallbacks.CaptureModeInGame();
bool wantNative = !focus || (!use_mouse || GUICapture || !captureModeInGame); bool wantNative = !focus || (!use_mouse || GUICapture || !captureModeInGame);
@ -228,7 +228,7 @@ void MessagePump (const SDL_Event &sev)
static int lastx = 0, lasty = 0; static int lastx = 0, lasty = 0;
int x, y; int x, y;
event_t event = { 0,0,0,0,0,0,0 }; event_t event = { 0,0,0,0,0,0,0 };
switch (sev.type) switch (sev.type)
{ {
case SDL_QUIT: case SDL_QUIT:
@ -369,7 +369,7 @@ void MessagePump (const SDL_Event &sev)
{ {
break; break;
} }
event.type = sev.type == SDL_KEYDOWN ? EV_KeyDown : EV_KeyUp; event.type = sev.type == SDL_KEYDOWN ? EV_KeyDown : EV_KeyUp;
// Try to look up our key mapped key for conversion to DirectInput. // Try to look up our key mapped key for conversion to DirectInput.
@ -448,7 +448,7 @@ void MessagePump (const SDL_Event &sev)
if (GUICapture) if (GUICapture)
{ {
int size; int size;
int unichar = utf8_decode((const uint8_t*)sev.text.text, &size); int unichar = utf8_decode((const uint8_t*)sev.text.text, &size);
if (size != 4) if (size != 4)
{ {
@ -474,7 +474,7 @@ void MessagePump (const SDL_Event &sev)
void I_GetEvent () void I_GetEvent ()
{ {
SDL_Event sev; SDL_Event sev;
while (SDL_PollEvent (&sev)) while (SDL_PollEvent (&sev))
{ {
MessagePump (sev); MessagePump (sev);

View file

@ -171,7 +171,7 @@ int main (int argc, char **argv)
} }
printf("\n"); printf("\n");
Args = new FArgs(argc, argv); Args = new FArgs(argc, argv);
// Should we even be doing anything with progdir on Unix systems? // Should we even be doing anything with progdir on Unix systems?
@ -188,7 +188,7 @@ int main (int argc, char **argv)
{ {
progdir = "./"; progdir = "./";
} }
I_StartupJoysticks(); I_StartupJoysticks();
const int result = GameMain(); const int result = GameMain();

View file

@ -159,7 +159,7 @@ void RedrawProgressBar(int CurPos, int MaxPos)
memset(progressBuffer,'.',512); memset(progressBuffer,'.',512);
progressBuffer[sizeOfWindow.ws_col - 1] = 0; progressBuffer[sizeOfWindow.ws_col - 1] = 0;
int lengthOfStr = 0; int lengthOfStr = 0;
while (curProgVal-- > 0) while (curProgVal-- > 0)
{ {
progressBuffer[lengthOfStr++] = '='; progressBuffer[lengthOfStr++] = '=';
@ -208,7 +208,7 @@ void I_PrintStr(const char *cp)
else if (v < 0.90) attrib = 0x7; else if (v < 0.90) attrib = 0x7;
else attrib = 0xF; else attrib = 0xF;
} }
printData.AppendFormat("\033[%um",((attrib & 0x8) ? 90 : 30) + (attrib & 0x7)); printData.AppendFormat("\033[%um",((attrib & 0x8) ? 90 : 30) + (attrib & 0x7));
} }
else printData.AppendFormat("\033[38;2;%u;%u;%um",color.r,color.g,color.b); else printData.AppendFormat("\033[38;2;%u;%u;%um",color.r,color.g,color.b);
@ -224,7 +224,7 @@ void I_PrintStr(const char *cp)
else break; else break;
} }
} }
if (StartScreen) CleanProgressBar(); if (StartScreen) CleanProgressBar();
fputs(printData.GetChars(),stdout); fputs(printData.GetChars(),stdout);
if (terminal) fputs("\033[0m",stdout); if (terminal) fputs("\033[0m",stdout);
@ -303,7 +303,7 @@ int I_PickIWad (WadStuff *wads, int numwads, bool showwin, int defaultiwad)
#ifdef __APPLE__ #ifdef __APPLE__
return I_PickIWad_Cocoa (wads, numwads, showwin, defaultiwad); return I_PickIWad_Cocoa (wads, numwads, showwin, defaultiwad);
#endif #endif
if (!isatty(fileno(stdin))) if (!isatty(fileno(stdin)))
{ {
return defaultiwad; return defaultiwad;

View file

@ -5,13 +5,13 @@ void Mac_I_FatalError(const char* errortext)
{ {
// Close window or exit fullscreen and release mouse capture // Close window or exit fullscreen and release mouse capture
SDL_Quit(); SDL_Quit();
const CFStringRef errorString = CFStringCreateWithCStringNoCopy( kCFAllocatorDefault, const CFStringRef errorString = CFStringCreateWithCStringNoCopy( kCFAllocatorDefault,
errortext, kCFStringEncodingASCII, kCFAllocatorNull ); errortext, kCFStringEncodingASCII, kCFAllocatorNull );
if ( NULL != errorString ) if ( NULL != errorString )
{ {
CFOptionFlags dummy; CFOptionFlags dummy;
CFUserNotificationDisplayAlert( 0, kCFUserNotificationStopAlertLevel, NULL, NULL, NULL, CFUserNotificationDisplayAlert( 0, kCFUserNotificationStopAlertLevel, NULL, NULL, NULL,
CFSTR( "Fatal Error" ), errorString, CFSTR( "Exit" ), NULL, NULL, &dummy ); CFSTR( "Fatal Error" ), errorString, CFSTR( "Exit" ), NULL, NULL, &dummy );
CFRelease( errorString ); CFRelease( errorString );

View file

@ -53,7 +53,7 @@
#ifdef HAVE_GLES2 #ifdef HAVE_GLES2
#include "gles_framebuffer.h" #include "gles_framebuffer.h"
#endif #endif
#ifdef HAVE_VULKAN #ifdef HAVE_VULKAN
#include "vulkan/system/vk_framebuffer.h" #include "vulkan/system/vk_framebuffer.h"
#endif #endif
@ -517,7 +517,7 @@ int SystemBaseFrameBuffer::GetClientWidth()
return width; return width;
} }
#endif #endif
#ifdef HAVE_VULKAN #ifdef HAVE_VULKAN
assert(Priv::vulkanEnabled); assert(Priv::vulkanEnabled);
SDL_Vulkan_GetDrawableSize(Priv::window, &width, nullptr); SDL_Vulkan_GetDrawableSize(Priv::window, &width, nullptr);

View file

@ -228,7 +228,7 @@ void FTTYStartupScreen::NetMessage(const char *format, ...)
{ {
FString str; FString str;
va_list argptr; va_list argptr;
va_start (argptr, format); va_start (argptr, format);
str.VFormat (format, argptr); str.VFormat (format, argptr);
va_end (argptr); va_end (argptr);

View file

@ -165,5 +165,5 @@ void I_InitGraphics ()
// 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");
} }

View file

@ -1581,7 +1581,7 @@ static void AddZipFile (HANDLE ziphandle, TarFile *whichfile, short dosdate, sho
local.ModDate = dosdate; local.ModDate = dosdate;
local.UncompressedSize = LittleLong(whichfile->UncompressedSize); local.UncompressedSize = LittleLong(whichfile->UncompressedSize);
local.NameLength = LittleShort((uint16_t)strlen(whichfile->Filename)); local.NameLength = LittleShort((uint16_t)strlen(whichfile->Filename));
whichfile->ZipOffset = SetFilePointer (ziphandle, 0, NULL, FILE_CURRENT); whichfile->ZipOffset = SetFilePointer (ziphandle, 0, NULL, FILE_CURRENT);
WriteFile (ziphandle, &local, sizeof(local), &wrote, NULL); WriteFile (ziphandle, &local, sizeof(local), &wrote, NULL);
WriteFile (ziphandle, whichfile->Filename, (DWORD)strlen(whichfile->Filename), &wrote, NULL); WriteFile (ziphandle, whichfile->Filename, (DWORD)strlen(whichfile->Filename), &wrote, NULL);

View file

@ -58,7 +58,7 @@ class FDInputKeyboard : public FKeyboard
public: public:
FDInputKeyboard(); FDInputKeyboard();
~FDInputKeyboard(); ~FDInputKeyboard();
bool GetDevice(); bool GetDevice();
void ProcessInput(); void ProcessInput();

View file

@ -777,7 +777,7 @@ int DoMain (HINSTANCE hInstance)
RECT cRect; RECT cRect;
TIMECAPS tc; TIMECAPS tc;
DEVMODE displaysettings; DEVMODE displaysettings;
// Do not use the multibyte __argv here because we want UTF-8 arguments // Do not use the multibyte __argv here because we want UTF-8 arguments
// and those can only be done by converting the Unicode variants. // and those can only be done by converting the Unicode variants.
Args = new FArgs(); Args = new FArgs();
@ -787,17 +787,17 @@ int DoMain (HINSTANCE hInstance)
{ {
Args->AppendArg(FString(wargv[i])); Args->AppendArg(FString(wargv[i]));
} }
// Load Win32 modules // Load Win32 modules
Kernel32Module.Load({"kernel32.dll"}); Kernel32Module.Load({"kernel32.dll"});
Shell32Module.Load({"shell32.dll"}); Shell32Module.Load({"shell32.dll"});
User32Module.Load({"user32.dll"}); User32Module.Load({"user32.dll"});
// Under XP, get our session ID so we can know when the user changes/locks sessions. // Under XP, get our session ID so we can know when the user changes/locks sessions.
// Since we need to remain binary compatible with older versions of Windows, we // Since we need to remain binary compatible with older versions of Windows, we
// need to extract the ProcessIdToSessionId function from kernel32.dll manually. // need to extract the ProcessIdToSessionId function from kernel32.dll manually.
HMODULE kernel = GetModuleHandleA ("kernel32.dll"); HMODULE kernel = GetModuleHandleA ("kernel32.dll");
if (Args->CheckParm("-stdout")) if (Args->CheckParm("-stdout"))
{ {
// As a GUI application, we don't normally get a console when we start. // As a GUI application, we don't normally get a console when we start.
@ -805,7 +805,7 @@ int DoMain (HINSTANCE hInstance)
// console. Otherwise, we can create a new one. If we already have a // console. Otherwise, we can create a new one. If we already have a
// stdout handle, then we have been redirected and should just use that // stdout handle, then we have been redirected and should just use that
// handle instead of creating a console window. // handle instead of creating a console window.
StdOut = GetStdHandle(STD_OUTPUT_HANDLE); StdOut = GetStdHandle(STD_OUTPUT_HANDLE);
if (StdOut != NULL) if (StdOut != NULL)
{ {
@ -832,18 +832,18 @@ int DoMain (HINSTANCE hInstance)
{ {
StdOut = GetStdHandle(STD_OUTPUT_HANDLE); StdOut = GetStdHandle(STD_OUTPUT_HANDLE);
} }
// These two functions do not exist in Windows XP. // These two functions do not exist in Windows XP.
BOOL (WINAPI* p_GetCurrentConsoleFontEx)(HANDLE hConsoleOutput, BOOL bMaximumWindow, PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx); BOOL (WINAPI* p_GetCurrentConsoleFontEx)(HANDLE hConsoleOutput, BOOL bMaximumWindow, PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx);
BOOL (WINAPI* p_SetCurrentConsoleFontEx)(HANDLE hConsoleOutput, BOOL bMaximumWindow, PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx); BOOL (WINAPI* p_SetCurrentConsoleFontEx)(HANDLE hConsoleOutput, BOOL bMaximumWindow, PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx);
p_SetCurrentConsoleFontEx = (decltype(p_SetCurrentConsoleFontEx))GetProcAddress(kernel, "SetCurrentConsoleFontEx"); p_SetCurrentConsoleFontEx = (decltype(p_SetCurrentConsoleFontEx))GetProcAddress(kernel, "SetCurrentConsoleFontEx");
p_GetCurrentConsoleFontEx = (decltype(p_GetCurrentConsoleFontEx))GetProcAddress(kernel, "GetCurrentConsoleFontEx"); p_GetCurrentConsoleFontEx = (decltype(p_GetCurrentConsoleFontEx))GetProcAddress(kernel, "GetCurrentConsoleFontEx");
if (p_SetCurrentConsoleFontEx && p_GetCurrentConsoleFontEx) if (p_SetCurrentConsoleFontEx && p_GetCurrentConsoleFontEx)
{ {
CONSOLE_FONT_INFOEX cfi; CONSOLE_FONT_INFOEX cfi;
cfi.cbSize = sizeof(cfi); cfi.cbSize = sizeof(cfi);
if (p_GetCurrentConsoleFontEx(StdOut, false, &cfi)) if (p_GetCurrentConsoleFontEx(StdOut, false, &cfi))
{ {
if (*cfi.FaceName == 0) // If the face name is empty, the default (useless) raster font is actoive. if (*cfi.FaceName == 0) // If the face name is empty, the default (useless) raster font is actoive.
@ -858,16 +858,16 @@ int DoMain (HINSTANCE hInstance)
FancyStdOut = true; FancyStdOut = true;
} }
} }
// Set the timer to be as accurate as possible // Set the timer to be as accurate as possible
if (timeGetDevCaps (&tc, sizeof(tc)) != TIMERR_NOERROR) if (timeGetDevCaps (&tc, sizeof(tc)) != TIMERR_NOERROR)
TimerPeriod = 1; // Assume minimum resolution of 1 ms TimerPeriod = 1; // Assume minimum resolution of 1 ms
else else
TimerPeriod = tc.wPeriodMin; TimerPeriod = tc.wPeriodMin;
timeBeginPeriod (TimerPeriod); timeBeginPeriod (TimerPeriod);
atexit(UnTbp); atexit(UnTbp);
// Figure out what directory the program resides in. // Figure out what directory the program resides in.
WCHAR progbuff[1024]; WCHAR progbuff[1024];
if (GetModuleFileNameW(nullptr, progbuff, sizeof progbuff) == 0) if (GetModuleFileNameW(nullptr, progbuff, sizeof progbuff) == 0)
@ -875,22 +875,22 @@ int DoMain (HINSTANCE hInstance)
MessageBoxA(nullptr, "Fatal", "Could not determine program location.", MB_ICONEXCLAMATION|MB_OK); MessageBoxA(nullptr, "Fatal", "Could not determine program location.", MB_ICONEXCLAMATION|MB_OK);
exit(-1); exit(-1);
} }
progbuff[1023] = '\0'; progbuff[1023] = '\0';
if (auto lastsep = wcsrchr(progbuff, '\\')) if (auto lastsep = wcsrchr(progbuff, '\\'))
{ {
lastsep[1] = '\0'; lastsep[1] = '\0';
} }
progdir = progbuff; progdir = progbuff;
FixPathSeperator(progdir); FixPathSeperator(progdir);
HDC screenDC = GetDC(0); HDC screenDC = GetDC(0);
int dpi = GetDeviceCaps(screenDC, LOGPIXELSX); int dpi = GetDeviceCaps(screenDC, LOGPIXELSX);
ReleaseDC(0, screenDC); ReleaseDC(0, screenDC);
width = (512 * dpi + 96 / 2) / 96; width = (512 * dpi + 96 / 2) / 96;
height = (384 * dpi + 96 / 2) / 96; height = (384 * dpi + 96 / 2) / 96;
// Many Windows structures that specify their size do so with the first // Many Windows structures that specify their size do so with the first
// element. DEVMODE is not one of those structures. // element. DEVMODE is not one of those structures.
memset (&displaysettings, 0, sizeof(displaysettings)); memset (&displaysettings, 0, sizeof(displaysettings));
@ -898,12 +898,12 @@ int DoMain (HINSTANCE hInstance)
EnumDisplaySettings (NULL, ENUM_CURRENT_SETTINGS, &displaysettings); EnumDisplaySettings (NULL, ENUM_CURRENT_SETTINGS, &displaysettings);
x = (displaysettings.dmPelsWidth - width) / 2; x = (displaysettings.dmPelsWidth - width) / 2;
y = (displaysettings.dmPelsHeight - height) / 2; y = (displaysettings.dmPelsHeight - height) / 2;
if (Args->CheckParm ("-0")) if (Args->CheckParm ("-0"))
{ {
x = y = 0; x = y = 0;
} }
WNDCLASS WndClass; WNDCLASS WndClass;
WndClass.style = 0; WndClass.style = 0;
WndClass.lpfnWndProc = LConProc; WndClass.lpfnWndProc = LConProc;
@ -915,14 +915,14 @@ int DoMain (HINSTANCE hInstance)
WndClass.hbrBackground = NULL; WndClass.hbrBackground = NULL;
WndClass.lpszMenuName = NULL; WndClass.lpszMenuName = NULL;
WndClass.lpszClassName = WinClassName; WndClass.lpszClassName = WinClassName;
/* register this new class with Windows */ /* register this new class with Windows */
if (!RegisterClass((LPWNDCLASS)&WndClass)) if (!RegisterClass((LPWNDCLASS)&WndClass))
{ {
MessageBoxA(nullptr, "Could not register window class", "Fatal", MB_ICONEXCLAMATION|MB_OK); MessageBoxA(nullptr, "Could not register window class", "Fatal", MB_ICONEXCLAMATION|MB_OK);
exit(-1); exit(-1);
} }
/* create window */ /* create window */
FStringf caption("" GAMENAME " %s " X64 " (%s)", GetVersionString(), GetGitTime()); FStringf caption("" GAMENAME " %s " X64 " (%s)", GetVersionString(), GetGitTime());
std::wstring wcaption = caption.WideString(); std::wstring wcaption = caption.WideString();
@ -936,13 +936,13 @@ int DoMain (HINSTANCE hInstance)
(HMENU) NULL, (HMENU) NULL,
hInstance, hInstance,
NULL); NULL);
if (!Window) if (!Window)
{ {
MessageBoxA(nullptr, "Unable to create main window", "Fatal", MB_ICONEXCLAMATION|MB_OK); MessageBoxA(nullptr, "Unable to create main window", "Fatal", MB_ICONEXCLAMATION|MB_OK);
exit(-1); exit(-1);
} }
if (kernel != NULL) if (kernel != NULL)
{ {
typedef BOOL (WINAPI *pts)(DWORD, DWORD *); typedef BOOL (WINAPI *pts)(DWORD, DWORD *);
@ -969,15 +969,15 @@ int DoMain (HINSTANCE hInstance)
} }
} }
} }
GetClientRect (Window, &cRect); GetClientRect (Window, &cRect);
WinWidth = cRect.right; WinWidth = cRect.right;
WinHeight = cRect.bottom; WinHeight = cRect.bottom;
CoInitialize (NULL); CoInitialize (NULL);
atexit (UnCOM); atexit (UnCOM);
int ret = GameMain (); int ret = GameMain ();
CheckForRestart(); CheckForRestart();
@ -990,7 +990,7 @@ int DoMain (HINSTANCE hInstance)
{ // Outputting to a new console window: Wait for a keypress before quitting. { // Outputting to a new console window: Wait for a keypress before quitting.
DWORD bytes; DWORD bytes;
HANDLE stdinput = GetStdHandle(STD_INPUT_HANDLE); HANDLE stdinput = GetStdHandle(STD_INPUT_HANDLE);
ShowWindow(Window, SW_HIDE); ShowWindow(Window, SW_HIDE);
WriteFile(StdOut, "Press any key to exit...", 24, &bytes, NULL); WriteFile(StdOut, "Press any key to exit...", 24, &bytes, NULL);
FlushConsoleInputBuffer(stdinput); FlushConsoleInputBuffer(stdinput);
@ -1017,7 +1017,7 @@ void I_ShowFatalError(const char *msg)
{ {
Printf("%s", CVMAbortException::stacktrace.GetChars()); Printf("%s", CVMAbortException::stacktrace.GetChars());
} }
if (!batchrun) if (!batchrun)
{ {
ShowErrorPane(msg); ShowErrorPane(msg);

View file

@ -86,7 +86,7 @@ class FDInputMouse : public FMouse
public: public:
FDInputMouse(); FDInputMouse();
~FDInputMouse(); ~FDInputMouse();
bool GetDevice(); bool GetDevice();
void ProcessInput(); void ProcessInput();
bool WndProcHook(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result); bool WndProcHook(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result);
@ -103,7 +103,7 @@ class FWin32Mouse : public FMouse
public: public:
FWin32Mouse(); FWin32Mouse();
~FWin32Mouse(); ~FWin32Mouse();
bool GetDevice(); bool GetDevice();
void ProcessInput(); void ProcessInput();
bool WndProcHook(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result); bool WndProcHook(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result);
@ -697,7 +697,7 @@ bool FDInputMouse::GetDevice()
{ {
return false; return false;
} }
// How many buttons does this mouse have? // How many buttons does this mouse have?
DIDEVCAPS_DX3 caps = { sizeof(caps) }; DIDEVCAPS_DX3 caps = { sizeof(caps) };
hr = Device->GetCapabilities((DIDEVCAPS *)&caps); hr = Device->GetCapabilities((DIDEVCAPS *)&caps);

View file

@ -503,7 +503,7 @@ bool FRawPS2Controller::ProcessInput(RAWHID *raw, int code)
// Generate events for buttons that have changed. // Generate events for buttons that have changed.
int buttons = 0; int buttons = 0;
// If we know we are digital, ignore the D-Pad. // If we know we are digital, ignore the D-Pad.
if (!digital) if (!digital)
{ {
@ -538,7 +538,7 @@ void FRawPS2Controller::ProcessThumbstick(int value1, AxisInfo *axis1, int value
{ {
uint8_t buttonstate; uint8_t buttonstate;
double axisval1, axisval2; double axisval1, axisval2;
axisval1 = value1 * (2.0 / 255) - 1.0; axisval1 = value1 * (2.0 / 255) - 1.0;
axisval2 = value2 * (2.0 / 255) - 1.0; axisval2 = value2 * (2.0 / 255) - 1.0;
axisval1 = Joy_RemoveDeadZone(axisval1, axis1->DeadZone, NULL); axisval1 = Joy_RemoveDeadZone(axisval1, axis1->DeadZone, NULL);

View file

@ -868,7 +868,7 @@ static HCURSOR CreateBitmapCursor(int xhot, int yhot, HBITMAP and_mask, HBITMAP
// Delete the bitmaps. // Delete the bitmaps.
DeleteObject(and_mask); DeleteObject(and_mask);
DeleteObject(color_mask); DeleteObject(color_mask);
return cursor; return cursor;
} }

View file

@ -310,7 +310,7 @@ void FXInputController::ProcessThumbstick(int value1, AxisInfo *axis1,
{ {
uint8_t buttonstate; uint8_t buttonstate;
double axisval1, axisval2; double axisval1, axisval2;
axisval1 = (value1 - SHRT_MIN) * 2.0 / 65536 - 1.0; axisval1 = (value1 - SHRT_MIN) * 2.0 / 65536 - 1.0;
axisval2 = (value2 - SHRT_MIN) * 2.0 / 65536 - 1.0; axisval2 = (value2 - SHRT_MIN) * 2.0 / 65536 - 1.0;
axisval1 = Joy_RemoveDeadZone(axisval1, axis1->DeadZone, NULL); axisval1 = Joy_RemoveDeadZone(axisval1, axis1->DeadZone, NULL);
@ -337,7 +337,7 @@ void FXInputController::ProcessTrigger(int value, AxisInfo *axis, int base)
{ {
uint8_t buttonstate; uint8_t buttonstate;
double axisval; double axisval;
axisval = Joy_RemoveDeadZone(value / 256.0, axis->DeadZone, &buttonstate); axisval = Joy_RemoveDeadZone(value / 256.0, axis->DeadZone, &buttonstate);
Joy_GenerateButtonEvents(axis->ButtonValue, buttonstate, 1, base); Joy_GenerateButtonEvents(axis->ButtonValue, buttonstate, 1, base);
axis->ButtonValue = buttonstate; axis->ButtonValue = buttonstate;

View file

@ -310,7 +310,7 @@ void FBasicStartupScreen::NetMessage(const char *format, ...)
{ {
FString str; FString str;
va_list argptr; va_list argptr;
va_start (argptr, format); va_start (argptr, format);
str.VFormat (format, argptr); str.VFormat (format, argptr);
va_end (argptr); va_end (argptr);

View file

@ -17,7 +17,7 @@ void I_GetVulkanDrawableSize(int *width, int *height)
RECT clientRect = { 0 }; RECT clientRect = { 0 };
GetClientRect(Window, &clientRect); GetClientRect(Window, &clientRect);
if (width != nullptr) if (width != nullptr)
{ {
*width = clientRect.right; *width = clientRect.right;

View file

@ -21,7 +21,7 @@ public:
{ {
device = new VulkanDevice(); device = new VulkanDevice();
} }
~Win32VulkanVideo() ~Win32VulkanVideo()
{ {
delete device; delete device;

View file

@ -192,12 +192,12 @@ void GLBuffer::GPUDropSync()
void GLBuffer::GPUWaitSync() void GLBuffer::GPUWaitSync()
{ {
GLenum status = glClientWaitSync(mGLSync, GL_SYNC_FLUSH_COMMANDS_BIT, 1000 * 1000 * 50); // Wait for a max of 50ms... GLenum status = glClientWaitSync(mGLSync, GL_SYNC_FLUSH_COMMANDS_BIT, 1000 * 1000 * 50); // Wait for a max of 50ms...
if (status != GL_ALREADY_SIGNALED && status != GL_CONDITION_SATISFIED) if (status != GL_ALREADY_SIGNALED && status != GL_CONDITION_SATISFIED)
{ {
//Printf("Error on glClientWaitSync: %d\n", status); //Printf("Error on glClientWaitSync: %d\n", status);
} }
glDeleteSync(mGLSync); glDeleteSync(mGLSync);
mGLSync = NULL; mGLSync = NULL;
@ -213,10 +213,10 @@ void GLVertexBuffer::SetFormat(int numBindingPoints, int numAttributes, size_t s
{ {
static int VFmtToGLFmt[] = { GL_FLOAT, GL_FLOAT, GL_FLOAT, GL_FLOAT, GL_UNSIGNED_BYTE, GL_INT_2_10_10_10_REV }; static int VFmtToGLFmt[] = { GL_FLOAT, GL_FLOAT, GL_FLOAT, GL_FLOAT, GL_UNSIGNED_BYTE, GL_INT_2_10_10_10_REV };
static uint8_t VFmtToSize[] = {4, 3, 2, 1, 4, 4}; static uint8_t VFmtToSize[] = {4, 3, 2, 1, 4, 4};
mStride = stride; mStride = stride;
mNumBindingPoints = numBindingPoints; mNumBindingPoints = numBindingPoints;
for(int i = 0; i < numAttributes; i++) for(int i = 0; i < numAttributes; i++)
{ {
if (attrs[i].location >= 0 && attrs[i].location < VATTR_MAX) if (attrs[i].location >= 0 && attrs[i].location < VATTR_MAX)

View file

@ -65,7 +65,7 @@ public:
bool HWGammaActive = false; // Are we using hardware or software gamma? bool HWGammaActive = false; // Are we using hardware or software gamma?
std::shared_ptr<FGLDebug> mDebug; // Debug API std::shared_ptr<FGLDebug> mDebug; // Debug API
FTexture *WipeStartScreen() override; FTexture *WipeStartScreen() override;
FTexture *WipeEndScreen() override; FTexture *WipeEndScreen() override;

View file

@ -148,7 +148,7 @@ unsigned int FHardwareTexture::CreateTexture(unsigned char * buffer, int w, int
{ {
sourcetype = GL_BGRA; sourcetype = GL_BGRA;
} }
if (!firstCall && glBufferID > 0) if (!firstCall && glBufferID > 0)
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, rw, rh, sourcetype, GL_UNSIGNED_BYTE, buffer); glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, rw, rh, sourcetype, GL_UNSIGNED_BYTE, buffer);
else else
@ -315,7 +315,7 @@ bool FHardwareTexture::BindOrCreate(FTexture *tex, int texunit, int clampmode, i
int w = 0, h = 0; int w = 0, h = 0;
// Create this texture // Create this texture
FTextureBuffer texbuffer; FTextureBuffer texbuffer;
if (!tex->isHardwareCanvas()) if (!tex->isHardwareCanvas())

View file

@ -80,7 +80,7 @@ public:
void DrawPresentTexture(const IntRect &box, bool applyGamma); void DrawPresentTexture(const IntRect &box, bool applyGamma);
void Flush(); void Flush();
void BeginFrame(); void BeginFrame();
bool StartOffscreen(); bool StartOffscreen();
void EndOffscreen(); void EndOffscreen();

View file

@ -311,7 +311,7 @@ void FGLRenderState::ApplyMaterial(FMaterial *mat, int clampmode, int translatio
if (tex->isHardwareCanvas()) static_cast<FCanvasTexture*>(tex->GetTexture())->NeedUpdate(); if (tex->isHardwareCanvas()) static_cast<FCanvasTexture*>(tex->GetTexture())->NeedUpdate();
clampmode = tex->GetClampMode(clampmode); clampmode = tex->GetClampMode(clampmode);
// avoid rebinding the same texture multiple times. // avoid rebinding the same texture multiple times.
if (mat == lastMaterial && lastClamp == clampmode && translation == lastTranslation) return; if (mat == lastMaterial && lastClamp == clampmode && translation == lastTranslation) return;
lastMaterial = mat; lastMaterial = mat;

View file

@ -98,7 +98,7 @@ void FSamplerManager::UnbindAll()
glBindSampler(i, 0); glBindSampler(i, 0);
} }
} }
uint8_t FSamplerManager::Bind(int texunit, int num, int lastval) uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
{ {
unsigned int samp = mSamplers[num]; unsigned int samp = mSamplers[num];
@ -106,11 +106,11 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
return 255; return 255;
} }
void FSamplerManager::SetTextureFilterMode() void FSamplerManager::SetTextureFilterMode()
{ {
GLint bounds[IHardwareTexture::MAX_TEXTURES]; GLint bounds[IHardwareTexture::MAX_TEXTURES];
// Unbind all // Unbind all
for(int i = IHardwareTexture::MAX_TEXTURES-1; i >= 0; i--) for(int i = IHardwareTexture::MAX_TEXTURES-1; i >= 0; i--)
{ {

View file

@ -336,7 +336,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
#endif #endif
)"; )";
#ifdef __APPLE__ #ifdef __APPLE__
// The noise functions are completely broken in macOS OpenGL drivers // The noise functions are completely broken in macOS OpenGL drivers

Some files were not shown because too many files have changed in this diff Show more