diff --git a/source/blood/src/levels.cpp b/source/blood/src/levels.cpp index 852ce5db0..5b94ad66e 100644 --- a/source/blood/src/levels.cpp +++ b/source/blood/src/levels.cpp @@ -64,7 +64,7 @@ void levelInitINI(const char *pzIni) if (!fileSystem.FileExists(pzIni)) ThrowError("Initialization: %s does not exist", pzIni); BloodINI = new IniFile(pzIni); - Bstrncpy(BloodIniFile, pzIni, BMAX_PATH); + strncpy(BloodIniFile, pzIni, BMAX_PATH); } diff --git a/source/build/include/compat.h b/source/build/include/compat.h index 850457350..5507db3a1 100644 --- a/source/build/include/compat.h +++ b/source/build/include/compat.h @@ -20,66 +20,9 @@ # define EDUKE32_GCC_PREREQ(major, minor) 0 #endif -#ifdef __clang__ -# define EDUKE32_CLANG_PREREQ(major, minor) (major < __clang_major__ || (major == __clang_major__ && minor <= __clang_minor__)) -#else -# define EDUKE32_CLANG_PREREQ(major, minor) 0 -#endif -#ifndef __has_builtin -# define __has_builtin(x) 0 // Compatibility with non-clang compilers. -#endif -#ifndef __has_feature -# define __has_feature(x) 0 // Compatibility with non-clang compilers. -#endif -#ifndef __has_extension -# define __has_extension __has_feature // Compatibility with pre-3.0 compilers. -#endif -#ifndef __has_cpp_attribute -# define __has_cpp_attribute(x) 0 -#endif - -#ifdef _MSC_VER -# define EDUKE32_MSVC_PREREQ(major) ((major) <= (_MSC_VER)) -# ifdef __cplusplus -# define EDUKE32_MSVC_CXX_PREREQ(major) ((major) <= (_MSC_VER)) -# else -# define EDUKE32_MSVC_CXX_PREREQ(major) 0 -# endif -#else -# define EDUKE32_MSVC_PREREQ(major) 0 -# define EDUKE32_MSVC_CXX_PREREQ(major) 0 -#endif - ////////// Language detection ////////// -#if defined __STDC__ -# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L -# define CSTD 2011 -# elif defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L -# define CSTD 1999 -# elif defined __STDC_VERSION__ && __STDC_VERSION__ >= 199409L -# define CSTD 1994 -# else -# define CSTD 1989 -# endif -#else -# define CSTD 0 -#endif - -#if defined __cplusplus && __cplusplus >= 201703L -# define CXXSTD 2017 -#elif defined __cplusplus && __cplusplus >= 201402L -# define CXXSTD 2014 -#elif defined __cplusplus && __cplusplus >= 201103L -# define CXXSTD 2011 -#elif defined __cplusplus && __cplusplus >= 199711L -# define CXXSTD 2014 // Thanks, Microsoft... :? -#else -# define CXXSTD 0 -#endif - - ////////// Language and compiler feature polyfills ////////// # define EXTERNC @@ -123,42 +66,13 @@ # endif #endif -#if EDUKE32_GCC_PREREQ(2,0) || defined _MSC_VER -# define EDUKE32_FUNCTION __FUNCTION__ -#elif CSTD >= 1999 || CXXSTD >= 2011 -# define EDUKE32_FUNCTION __func__ -#else -# define EDUKE32_FUNCTION "???" -#endif - -#if CXXSTD >= 2011 -# if __has_cpp_attribute(fallthrough) # define fallthrough__ [[fallthrough]] -# elif __has_cpp_attribute(clang::fallthrough) -# define fallthrough__ [[clang::fallthrough]] -# elif __has_cpp_attribute(gnu::fallthrough) -# define fallthrough__ [[gnu::fallthrough]] -# endif -#endif -#ifndef fallthrough__ -# if !defined __clang__ && EDUKE32_GCC_PREREQ(7,0) -# define fallthrough__ __attribute__((fallthrough)) -# elif defined _MSC_VER -# define fallthrough__ __fallthrough -# else -# define fallthrough__ -# endif -#endif - - ////////// Architecture detection ////////// #ifdef WORDS_BIGENDIAN -# define B_LITTLE_ENDIAN 0 # define B_BIG_ENDIAN 1 #else -# define B_LITTLE_ENDIAN 1 # define B_BIG_ENDIAN 0 #endif @@ -184,9 +98,7 @@ #include #include #include -#ifndef USE_PHYSFS #include -#endif #include #include @@ -201,16 +113,10 @@ #include -#ifdef __cplusplus # include -# if CXXSTD >= 2011 || EDUKE32_MSVC_PREREQ(1800) # include # include # include -// we need this because MSVC does not properly identify C++11 support -# define HAVE_CXX11_HEADERS -# endif -#endif ////////// Platform headers ////////// @@ -218,19 +124,6 @@ # include #endif -#ifndef USE_PHYSFS -#include -#include -#include - -#if defined(_WIN32) -# include -# include -#else -# include -#endif -#endif - #include "engineerrors.h" ////////// DEPRECATED: Standard library prefixing ////////// @@ -242,42 +135,9 @@ typedef ssize_t bssize_t; #define BMAX_PATH 256 -#define Bstrcpy strcpy -#define Bstrncpy strncpy -#define Bstrcmp strcmp -#define Bstrncmp strncmp -#define Bstrcat strcat -#define Bstrncat strncat -#define Bstrlen strlen -#define Bstrchr strchr -#define Bstrrchr strrchr -#define Bstrtol strtol -#define Bstrtoul strtoul -#define Bstrtod strtod -#define Bstrstr strstr -#define Bmemcpy memcpy -#define Bmemset memset - - -////////// Standard library wrappers ////////// - -#if defined(__arm__) -# define Bsqrtf __builtin_sqrtf -#else -# define Bsqrtf sqrtf -#endif - - ////////// Metaprogramming structs ////////// -# if CXXSTD >= 2014 using std::enable_if_t; -# elif defined HAVE_CXX11_HEADERS -template -using enable_if_t = typename std::enable_if::type; -# endif - - using native_t = intptr_t; typedef struct MAY_ALIAS { @@ -332,10 +192,6 @@ static_assert(sizeof(vec3d_t) == sizeof(double) * 3); #include "basics.h" -# define ARRAY_SIZE(arr) countof(arr) - - - ////////// Pointer management ////////// #define DO_FREE_AND_NULL(var) do { \ @@ -359,7 +215,6 @@ static FORCE_INLINE uint16_t B_UNBUF16(void const * const buf) { return *(uint16 ////////// Abstract data operations ////////// template constexpr T clamp(T in, X min, Y max) { return in <= (T) min ? (T) min : (in >= (T) max ? (T) max : in); } -template constexpr T clamp2(T in, X min, Y max) { return in >= (T) max ? (T) max : (in <= (T) min ? (T) min : in); } using std::min; using std::max; @@ -374,9 +229,8 @@ static struct } pow2char; -static FORCE_INLINE void bitmap_set(uint8_t *const ptr, int const n) { ptr[n>>3] |= pow2char[n&7]; } -static FORCE_INLINE void bitmap_clear(uint8_t *const ptr, int const n) { ptr[n>>3] &= ~pow2char[n&7]; } -static FORCE_INLINE char bitmap_test(uint8_t const *const ptr, int const n) { return ptr[n>>3] & pow2char[n&7]; } +static FORCE_INLINE void bitmap_set(uint8_t *const ptr, int const n) { ptr[n>>3] |= 1 << (n&7); } +static FORCE_INLINE char bitmap_test(uint8_t const *const ptr, int const n) { return ptr[n>>3] & (1 << (n&7)); } ////////// Utility functions ////////// @@ -384,7 +238,7 @@ static FORCE_INLINE char bitmap_test(uint8_t const *const ptr, int const n) { re template void bfirst_search_init(T *const list, uint8_t *const bitmap, T *const eltnumptr, int const maxelts, int const firstelt) { - Bmemset(bitmap, 0, (maxelts+7)>>3); + memset(bitmap, 0, (maxelts+7)>>3); list[0] = firstelt; bitmap_set(bitmap, firstelt); @@ -401,14 +255,6 @@ void bfirst_search_try(T *const list, uint8_t *const bitmap, T *const eltnumptr, } } -// Copy min(strlen(src)+1, n) characters into dst, always terminate with a NUL. -static FORCE_INLINE char *Bstrncpyz(char *dst, const char *src, bsize_t n) -{ - Bstrncpy(dst, src, n); - dst[n-1] = 0; - return dst; -} - ////////// PANICKING ALLOCATION WRAPPERS ////////// diff --git a/source/build/include/polymost.h b/source/build/include/polymost.h index a0598ae62..41c151db6 100644 --- a/source/build/include/polymost.h +++ b/source/build/include/polymost.h @@ -78,7 +78,7 @@ static inline float polymost_invsqrt_approximation(float x) return n.f * (1.5f - haf * (n.f * n.f)); #else // this is the comment - return 1.f / Bsqrtf(x); + return 1.f / sqrtf(x); #endif } diff --git a/source/build/src/animvpx.cpp b/source/build/src/animvpx.cpp index 93cd050ce..41285647e 100644 --- a/source/build/src/animvpx.cpp +++ b/source/build/src/animvpx.cpp @@ -150,8 +150,8 @@ int32_t animvpx_init_codec(const animvpx_ivf_header_t *info, FileReader & inhand codec->errmsg_detail = codec->errmsg = NULL; codec->numframes = 0; - Bmemset(codec->sumtimes, 0, sizeof(codec->sumtimes)); - Bmemset(codec->maxtimes, 0, sizeof(codec->maxtimes)); + memset(codec->sumtimes, 0, sizeof(codec->sumtimes)); + memset(codec->maxtimes, 0, sizeof(codec->maxtimes)); return 0; } diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index 7a89435c3..030c2d704 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -54,7 +54,7 @@ void engineInitClipMaps() DO_FREE_AND_NULL(loadsprite); // two's complement trick, -1 = 0xff - Bmemset(&pictoidx, -1, sizeof(pictoidx)); + memset(&pictoidx, -1, sizeof(pictoidx)); numsectors = 0; numwalls = 0; @@ -334,7 +334,7 @@ static inline int32_t cliptrace(vec2_t const pos, vec2_t * const goal) topu--; } while (area.x*(n.y-p1.y) <= (n.x-p1.x)*area.y); - if (klabs(pos.x-n.x)+klabs(pos.y-n.y) < klabs(pos.x-goal->x)+klabs(pos.y-goal->y)) + if (abs(pos.x-n.x)+abs(pos.y-n.y) < abs(pos.x-goal->x)+abs(pos.y-goal->y)) { *goal = n; hitwall = z; @@ -412,7 +412,7 @@ static void clipupdatesector(vec2_t const pos, int16_t * const sectnum, int wall if (nsecs > (walldist + 8)) { - Printf("%s(): initial position (%d, %d) not within initial sector %d; shortest distance %d.\n", EDUKE32_FUNCTION, pos.x, pos.y, *sectnum, nsecs); + Printf("%s(): initial position (%d, %d) not within initial sector %d; shortest distance %d.\n", __func__, pos.x, pos.y, *sectnum, nsecs); walldist = 0x7fff; } @@ -505,7 +505,7 @@ int32_t clipmove(vec3_t * const pos, int16_t * const sectnum, int32_t xvect, int clipmove_warned = 0; - Bmemset(clipsectormap, 0, (numsectors+7)>>3); + memset(clipsectormap, 0, (numsectors+7)>>3); bitmap_set(clipsectormap, *sectnum); do @@ -875,7 +875,7 @@ int pushmove(vec3_t *const vect, int16_t *const sectnum, clipsectorlist[0] = *sectnum; clipsectnum = 1; - Bmemset(clipsectormap, 0, (numsectors + 7) >> 3); + memset(clipsectormap, 0, (numsectors + 7) >> 3); bitmap_set(clipsectormap, *sectnum); } @@ -1029,7 +1029,7 @@ void getzrange(const vec3_t *pos, int16_t sectnum, clipsectorlist[0] = sectnum; clipsectnum = 1; clipspritenum = 0; - Bmemset(clipsectormap, 0, (numsectors+7)>>3); + memset(clipsectormap, 0, (numsectors+7)>>3); bitmap_set(clipsectormap, sectnum); do //Collect sectors inside your square first diff --git a/source/build/src/defs.cpp b/source/build/src/defs.cpp index ebf39d57b..308a979cc 100644 --- a/source/build/src/defs.cpp +++ b/source/build/src/defs.cpp @@ -55,7 +55,7 @@ if (sc.Compare("music")) while (pScript->textptr < musicEnd) { - switch (getatoken(pScript, soundTokens, ARRAY_SIZE(soundTokens))) + switch (getatoken(pScript, soundTokens, countof(soundTokens))) { case T_ID: scriptfile_getstring(pScript, &musicID); break; case T_FILE: scriptfile_getstring(pScript, &fileName); break; @@ -361,7 +361,7 @@ static int32_t defsparser(scriptfile *script) iter = 0; } #endif - tokn = getatoken(script,basetokens,ARRAY_SIZE(basetokens)); + tokn = getatoken(script,basetokens,countof(basetokens)); cmdtokptr = script->ltextptr; switch (tokn) { @@ -574,7 +574,7 @@ static int32_t defsparser(scriptfile *script) if (scriptfile_getbraces(script,&blockend)) break; while (script->textptr < blockend) { - int32_t token = getatoken(script,artfiletokens,ARRAY_SIZE(artfiletokens)); + int32_t token = getatoken(script,artfiletokens,countof(artfiletokens)); switch (token) { case T_FILE: @@ -685,7 +685,7 @@ static int32_t defsparser(scriptfile *script) if (scriptfile_getbraces(script,&textureend)) break; while (script->textptr < textureend) { - int32_t token = getatoken(script,tilefromtexturetokens,ARRAY_SIZE(tilefromtexturetokens)); + int32_t token = getatoken(script,tilefromtexturetokens,countof(tilefromtexturetokens)); switch (token) { case T_FILE: @@ -722,7 +722,7 @@ static int32_t defsparser(scriptfile *script) if (scriptfile_getbraces(script,&ifmatchend)) break; while (script->textptr < ifmatchend) { - int32_t token = getatoken(script,ifmatchtokens,ARRAY_SIZE(ifmatchtokens)); + int32_t token = getatoken(script,ifmatchtokens,countof(ifmatchtokens)); switch (token) { case T_CRC32: @@ -901,7 +901,7 @@ static int32_t defsparser(scriptfile *script) if (scriptfile_getbraces(script,&blockend)) break; while (script->textptr < blockend) { - int32_t token = getatoken(script,copytiletokens,ARRAY_SIZE(copytiletokens)); + int32_t token = getatoken(script,copytiletokens,countof(copytiletokens)); switch (token) { case T_TILE: @@ -1295,7 +1295,7 @@ static int32_t defsparser(scriptfile *script) { "flags", T_FLAGS }, }; - Bmemset(usedframebitmap, 0, sizeof(usedframebitmap)); + memset(usedframebitmap, 0, sizeof(usedframebitmap)); modelskin = lastmodelskin = 0; seenframe = 0; @@ -1313,7 +1313,7 @@ static int32_t defsparser(scriptfile *script) #endif while (script->textptr < modelend) { - int32_t token = getatoken(script,modeltokens,ARRAY_SIZE(modeltokens)); + int32_t token = getatoken(script,modeltokens,countof(modeltokens)); switch (token) { //case T_ERROR: Printf("Error on line %s:%d in model tokens\n", script->filename,script->linenum); break; @@ -1352,7 +1352,7 @@ static int32_t defsparser(scriptfile *script) if (scriptfile_getbraces(script,&frameend)) break; while (script->textptr < frameend) { - switch (getatoken(script,modelframetokens,ARRAY_SIZE(modelframetokens))) + switch (getatoken(script,modelframetokens,countof(modelframetokens))) { case T_PAL: scriptfile_getsymbol(script,&pal); break; @@ -1437,7 +1437,7 @@ static int32_t defsparser(scriptfile *script) if (scriptfile_getbraces(script,&animend)) break; while (script->textptr < animend) { - switch (getatoken(script,modelanimtokens,ARRAY_SIZE(modelanimtokens))) + switch (getatoken(script,modelanimtokens,countof(modelanimtokens))) { case T_FRAME0: scriptfile_getstring(script,&startframe); break; @@ -1512,7 +1512,7 @@ static int32_t defsparser(scriptfile *script) if (scriptfile_getbraces(script,&skinend)) break; while (script->textptr < skinend) { - switch (getatoken(script,modelskintokens,ARRAY_SIZE(modelskintokens))) + switch (getatoken(script,modelskintokens,countof(modelskintokens))) { case T_PAL: scriptfile_getsymbol(script,&palnum); break; @@ -1615,7 +1615,7 @@ static int32_t defsparser(scriptfile *script) if (scriptfile_getbraces(script,&frameend)) break; while (script->textptr < frameend) { - switch (getatoken(script,modelhudtokens,ARRAY_SIZE(modelhudtokens))) + switch (getatoken(script,modelhudtokens,countof(modelhudtokens))) { case T_TILE: scriptfile_getsymbol(script,&ftilenume); ltilenume = ftilenume; break; @@ -1738,7 +1738,7 @@ static int32_t defsparser(scriptfile *script) if (scriptfile_getbraces(script,&modelend)) break; while (script->textptr < modelend) { - switch (getatoken(script, voxeltokens, ARRAY_SIZE(voxeltokens))) + switch (getatoken(script, voxeltokens, countof(voxeltokens))) { //case T_ERROR: Printf("Error on line %s:%d in voxel tokens\n", script->filename,linenum); break; case T_TILE: @@ -1811,7 +1811,7 @@ static int32_t defsparser(scriptfile *script) if (scriptfile_getbraces(script,&modelend)) break; while (script->textptr < modelend) { - switch (getatoken(script,skyboxtokens,ARRAY_SIZE(skyboxtokens))) + switch (getatoken(script,skyboxtokens,countof(skyboxtokens))) { //case T_ERROR: Printf("Error on line %s:%d in skybox tokens\n",script->filename,linenum); break; case T_TILE: @@ -1863,7 +1863,7 @@ static int32_t defsparser(scriptfile *script) if (scriptfile_getbraces(script,&highpalend)) break; while (script->textptr < highpalend) { - switch (getatoken(script,highpaltokens,ARRAY_SIZE(highpaltokens))) + switch (getatoken(script,highpaltokens,countof(highpaltokens))) { case T_BASEPAL: scriptfile_getsymbol(script,&basepal); break; @@ -1920,7 +1920,7 @@ static int32_t defsparser(scriptfile *script) if (scriptfile_getbraces(script,&tintend)) break; while (script->textptr < tintend) { - switch (getatoken(script,tinttokens,ARRAY_SIZE(tinttokens))) + switch (getatoken(script,tinttokens,countof(tinttokens))) { case T_PAL: scriptfile_getsymbol(script,&pal); break; @@ -1982,7 +1982,7 @@ static int32_t defsparser(scriptfile *script) if (scriptfile_getbraces(script,&endtextptr)) break; while (script->textptr < endtextptr) { - switch (getatoken(script, palookuptokens, ARRAY_SIZE(palookuptokens))) + switch (getatoken(script, palookuptokens, countof(palookuptokens))) { case T_PAL: scriptfile_getsymbol(script, &pal); @@ -2078,7 +2078,7 @@ static int32_t defsparser(scriptfile *script) if (scriptfile_getbraces(script,&textureend)) break; while (script->textptr < textureend) { - token = getatoken(script,texturetokens,ARRAY_SIZE(texturetokens)); + token = getatoken(script,texturetokens,countof(texturetokens)); switch (token) { case T_PAL: @@ -2108,7 +2108,7 @@ static int32_t defsparser(scriptfile *script) if (scriptfile_getbraces(script,&palend)) break; while (script->textptr < palend) { - switch (getatoken(script,texturetokens_pal,ARRAY_SIZE(texturetokens_pal))) + switch (getatoken(script,texturetokens_pal,countof(texturetokens_pal))) { case T_FILE: scriptfile_getstring(script,&fn); break; @@ -2188,7 +2188,7 @@ static int32_t defsparser(scriptfile *script) if (scriptfile_getbraces(script,&detailend)) break; while (script->textptr < detailend) { - switch (getatoken(script,texturetokens_pal,ARRAY_SIZE(texturetokens_pal))) + switch (getatoken(script,texturetokens_pal,countof(texturetokens_pal))) { case T_FILE: scriptfile_getstring(script,&fn); break; @@ -2365,7 +2365,7 @@ static int32_t defsparser(scriptfile *script) if (scriptfile_getbraces(script,&dummy)) break; while (script->textptr < dummy) { - switch (getatoken(script,sound_musictokens,ARRAY_SIZE(sound_musictokens))) + switch (getatoken(script,sound_musictokens,countof(sound_musictokens))) { case T_ID: scriptfile_getstring(script,&dummy2); @@ -2394,7 +2394,7 @@ static int32_t defsparser(scriptfile *script) if (scriptfile_getbraces(script,&mapinfoend)) break; while (script->textptr < mapinfoend) { - switch (getatoken(script,mapinfotokens,ARRAY_SIZE(mapinfotokens))) + switch (getatoken(script,mapinfotokens,countof(mapinfotokens))) { case T_MAPFILE: scriptfile_getstring(script,&dummy); @@ -2415,7 +2415,7 @@ static int32_t defsparser(scriptfile *script) char smallbuf[3] = { 0, 0, 0 }; smallbuf[0] = mapmd4string[2*i]; smallbuf[1] = mapmd4string[2*i+1]; - newusermaphack->md4[i] = Bstrtol(smallbuf, NULL, 16); + newusermaphack->md4[i] = strtol(smallbuf, NULL, 16); } break; @@ -2485,7 +2485,7 @@ static int32_t defsparser(scriptfile *script) while (script->textptr < blockend) { - int32_t token = getatoken(script,subtokens,ARRAY_SIZE(subtokens)); + int32_t token = getatoken(script,subtokens,countof(subtokens)); switch (token) { case T_HORIZFRAC: @@ -2573,7 +2573,7 @@ static int32_t defsparser(scriptfile *script) while (script->textptr < blockend) { - int32_t token = getatoken(script,subtokens,ARRAY_SIZE(subtokens)); + int32_t token = getatoken(script,subtokens,countof(subtokens)); switch (token) { case T_RAW: @@ -2596,7 +2596,7 @@ static int32_t defsparser(scriptfile *script) while (script->textptr < rawblockend) { - int32_t token = getatoken(script,rawsubtokens,ARRAY_SIZE(rawsubtokens)); + int32_t token = getatoken(script,rawsubtokens,countof(rawsubtokens)); switch (token) { case T_FILE: @@ -2752,7 +2752,7 @@ static int32_t defsparser(scriptfile *script) while (script->textptr < blockend) { - int32_t token = getatoken(script,subtokens,ARRAY_SIZE(subtokens)); + int32_t token = getatoken(script,subtokens,countof(subtokens)); switch (token) { case T_RAW: @@ -2775,7 +2775,7 @@ static int32_t defsparser(scriptfile *script) while (script->textptr < subblockend) { - int32_t token = getatoken(script,rawsubtokens,ARRAY_SIZE(rawsubtokens)); + int32_t token = getatoken(script,rawsubtokens,countof(rawsubtokens)); switch (token) { case T_FILE: @@ -2896,7 +2896,7 @@ static int32_t defsparser(scriptfile *script) while (script->textptr < subblockend) { - switch (getatoken(script, fogpaltokens, ARRAY_SIZE(fogpaltokens))) + switch (getatoken(script, fogpaltokens, countof(fogpaltokens))) { case T_RED: scriptfile_getnumber(script,&red); @@ -2944,7 +2944,7 @@ static int32_t defsparser(scriptfile *script) while (script->textptr < subblockend) { - switch (getatoken(script, makepalookuptokens, ARRAY_SIZE(makepalookuptokens))) + switch (getatoken(script, makepalookuptokens, countof(makepalookuptokens))) { case T_RED: scriptfile_getnumber(script,&red); @@ -3044,7 +3044,7 @@ static int32_t defsparser(scriptfile *script) while (script->textptr < blockend) { - int32_t token = getatoken(script,subtokens,ARRAY_SIZE(subtokens)); + int32_t token = getatoken(script,subtokens,countof(subtokens)); switch (token) { case T_RAW: @@ -3065,7 +3065,7 @@ static int32_t defsparser(scriptfile *script) while (script->textptr < rawblockend) { - int32_t token = getatoken(script,rawsubtokens,ARRAY_SIZE(rawsubtokens)); + int32_t token = getatoken(script,rawsubtokens,countof(rawsubtokens)); switch (token) { case T_FILE: @@ -3168,7 +3168,7 @@ static int32_t defsparser(scriptfile *script) while (script->textptr < glblendblockend) { - int32_t glblendtoken = getatoken(script,glblendtokens,ARRAY_SIZE(glblendtokens)); + int32_t glblendtoken = getatoken(script,glblendtokens,countof(glblendtokens)); switch (glblendtoken) { case T_FORWARD: @@ -3199,7 +3199,7 @@ static int32_t defsparser(scriptfile *script) while (script->textptr < glblenddefblockend) { - int32_t glblenddeftoken = getatoken(script,glblenddeftokens,ARRAY_SIZE(glblenddeftokens)); + int32_t glblenddeftoken = getatoken(script,glblenddeftokens,countof(glblenddeftokens)); switch (glblenddeftoken) { case T_SRC: @@ -3219,7 +3219,7 @@ static int32_t defsparser(scriptfile *script) { "ONE_MINUS_DST_COLOR", T_ONE_MINUS_DST_COLOR }, }; - int32_t factortoken = getatoken(script,blendFuncTokens,ARRAY_SIZE(blendFuncTokens)); + int32_t factortoken = getatoken(script,blendFuncTokens,countof(blendFuncTokens)); #ifdef USE_OPENGL uint8_t * const factor = glblenddeftoken == T_SRC ? &glbdef->src : &glbdef->dst; diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index bb3f0cb00..6e44afa85 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -583,7 +583,7 @@ static void dosetaspect(void) { j = (x&65535); k = FixedToInt(x); x += xinc; - if (k < 0 || k >= (int32_t)ARRAY_SIZE(qradarang)-1) + if (k < 0 || k >= (int32_t)countof(qradarang)-1) { no_radarang2 = 1; break; @@ -1287,7 +1287,7 @@ int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz, if ((xyaspect != oxyaspect) || (xdimen != oxdimen) || (viewingrange != oviewingrange)) dosetaspect(); - Bmemset(gotsector, 0, sizeof(gotsector)); + memset(gotsector, 0, sizeof(gotsector)); i = xdimen-1; @@ -1896,7 +1896,7 @@ void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang) renderSetAspect(65536, divscale16((320*5)/8, 200)); - Bmemset(gotsector, 0, sizeof(gotsector)); + memset(gotsector, 0, sizeof(gotsector)); vec2_t const c1 = { (windowxy1.x<<12), (windowxy1.y<<12) }; vec2_t const c2 = { ((windowxy2.x+1)<<12)-1, ((windowxy2.y+1)<<12)-1 }; @@ -2204,13 +2204,13 @@ static int32_t engineFinishLoadBoard(const vec3_t *dapos, int16_t *dacursectnum, updatesector(dapos->x, dapos->y, dacursectnum); { - Bmemset(spriteext, 0, sizeof(spriteext_t)*MAXSPRITES); + memset(spriteext, 0, sizeof(spriteext_t)*MAXSPRITES); #ifndef NEW_MAP_FORMAT - Bmemset(wallext, 0, sizeof(wallext_t)*MAXWALLS); + memset(wallext, 0, sizeof(wallext_t)*MAXWALLS); #endif #ifdef USE_OPENGL - Bmemset(spritesmooth, 0, sizeof(spritesmooth_t)*(MAXSPRITES+MAXUNIQHUDID)); + memset(spritesmooth, 0, sizeof(spritesmooth_t)*(MAXSPRITES+MAXUNIQHUDID)); # ifdef POLYMER if (videoGetRenderMode() == REND_POLYMER) @@ -2236,7 +2236,7 @@ static int32_t engineFinishLoadBoard(const vec3_t *dapos, int16_t *dacursectnum, static void remove_sprite(int32_t i) { - Bmemset(&sprite[i], 0, sizeof(spritetype)); + memset(&sprite[i], 0, sizeof(spritetype)); sprite[i].statnum = MAXSTATUS; sprite[i].sectnum = MAXSECTORS; } @@ -2652,7 +2652,7 @@ int32_t videoSetGameMode(char davidoption, int32_t daupscaledxdim, int32_t daups daupscaledxdim = max(320, daupscaledxdim); daupscaledydim = max(200, daupscaledydim); - Bstrcpy(kensmessage,"!!!! BUILD engine&tools programmed by Ken Silverman of E.G. RI." + strcpy(kensmessage,"!!!! BUILD engine&tools programmed by Ken Silverman of E.G. RI." " (c) Copyright 1995 Ken Silverman. Summary: BUILD = Ken. !!!!"); rendmode = REND_POLYMOST; @@ -3094,7 +3094,7 @@ int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1, int32_t x2, in const int32_t x21 = x2-x1, y21 = y2-y1, z21 = z2-z1; static uint8_t sectbitmap[(MAXSECTORS+7)>>3]; - Bmemset(sectbitmap, 0, sizeof(sectbitmap)); + memset(sectbitmap, 0, sizeof(sectbitmap)); if (x1 == x2 && y1 == y2) return (sect1 == sect2); @@ -3275,7 +3275,7 @@ void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day, uint8_t flags) uint8_t *const walbitmap = (uint8_t *)tempbuf; if ((flags&1)==0) - Bmemset(walbitmap, 0, (numwalls+7)>>3); + memset(walbitmap, 0, (numwalls+7)>>3); yaxwalls[numyaxwalls++] = pointhighlight; for (i=0; inumframes; i++) { fr = (md2frame_t *)&m->frames[i*m->framebytes]; - if (!Bstrcmp(fr->name, nam)) break; + if (!strcmp(fr->name, nam)) break; } } break; @@ -182,7 +182,7 @@ static int32_t framename2index(mdmodel_t *vm, const char *nam) { md3model_t *m = (md3model_t *)vm; for (i=0; inumframes; i++) - if (!Bstrcmp(m->head.frames[i].nam,nam)) break; + if (!strcmp(m->head.frames[i].nam,nam)) break; } break; } @@ -230,7 +230,7 @@ int32_t md_defineanimation(int32_t modelid, const char *framestart, const char * if ((uint32_t)modelid >= (uint32_t)nextmodelid) return -1; - Bmemset(&ma, 0, sizeof(ma)); + memset(&ma, 0, sizeof(ma)); m = (md2model_t *)models[modelid]; if (m->mdnum < 2) return 0; @@ -249,7 +249,7 @@ int32_t md_defineanimation(int32_t modelid, const char *framestart, const char * map = (mdanim_t *)Xmalloc(sizeof(mdanim_t)); - Bmemcpy(map, &ma, sizeof(ma)); + memcpy(map, &ma, sizeof(ma)); map->next = m->animations; m->animations = map; @@ -307,8 +307,8 @@ int32_t md_thinoutmodel(int32_t modelid, uint8_t *usedframebitmap) if (otonframe[i]>=0 && otonframe[i] != i) { if (m->muladdframes) - Bmemcpy(&m->muladdframes[2*otonframe[i]], &m->muladdframes[2*i], 2*sizeof(vec3f_t)); - Bmemcpy(&m->head.frames[otonframe[i]], &m->head.frames[i], sizeof(md3frame_t)); + memcpy(&m->muladdframes[2*otonframe[i]], &m->muladdframes[2*i], 2*sizeof(vec3f_t)); + memcpy(&m->head.frames[otonframe[i]], &m->head.frames[i], sizeof(md3frame_t)); } } @@ -318,7 +318,7 @@ int32_t md_thinoutmodel(int32_t modelid, uint8_t *usedframebitmap) for (i=0; inumframes; i++) if (otonframe[i]>=0 && otonframe[i] != i) - Bmemcpy(&s->xyzn[otonframe[i]*s->numverts], &s->xyzn[i*s->numverts], s->numverts*sizeof(md3xyzn_t)); + memcpy(&s->xyzn[otonframe[i]*s->numverts], &s->xyzn[i*s->numverts], s->numverts*sizeof(md3xyzn_t)); } ////// tweak frame indices in various places @@ -756,13 +756,13 @@ static md2model_t *md2load(FileReader & fil, const char *filnam) } #endif - Bstrcpy(st,filnam); + strcpy(st,filnam); for (i=strlen(st)-1; i>0; i--) if ((st[i] == '/') || (st[i] == '\\')) { i++; break; } if (i<0) i=0; st[i] = 0; m->basepath = (char *)Xmalloc(i+1); - Bstrcpy(m->basepath, st); + strcpy(m->basepath, st); m->skinfn = (char *)Xmalloc(ournumskins*64); if (m->numskins > 0) @@ -802,7 +802,7 @@ static md2model_t *md2load(FileReader & fil, const char *filnam) while (i < m->numframes) { f = (md2frame_t *)&m->frames[i*m->framebytes]; - Bstrcpy(m3->head.frames[i].nam, f->name); + strcpy(m3->head.frames[i].nam, f->name); //Printf("Copied frame %s.\n", m3->head.frames[i].nam); m3->muladdframes[i*2] = f->mul; m3->muladdframes[i*2+1] = f->add; @@ -824,7 +824,7 @@ static md2model_t *md2load(FileReader & fil, const char *filnam) maxmodelverts = max(maxmodelverts, s->numverts); - Bstrcpy(s->nam, "Dummy surface from MD2"); + strcpy(s->nam, "Dummy surface from MD2"); s->shaders = NULL; @@ -1104,8 +1104,8 @@ static void md3postload_common(md3model_t *m) { frame = &m->head.frames[framei]; - Bmemset(&frame->min, 0, sizeof(vec3f_t)); - Bmemset(&frame->max, 0, sizeof(vec3f_t)); + memset(&frame->min, 0, sizeof(vec3f_t)); + memset(&frame->max, 0, sizeof(vec3f_t)); frame->r = 0.0f; @@ -1184,7 +1184,7 @@ static void md3postload_common(md3model_t *m) ++surfi; } - frame->r = Bsqrtf(frame->r); + frame->r = sqrtf(frame->r); ++framei; } @@ -1392,7 +1392,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr) if (sext->pitch || sext->roll) { float f = 1.f/((fxdimen * fviewingrange) * (256.f/(65536.f*128.f)) * (m0.x+m1.x)); - Bmemset(&a0, 0, sizeof(a0)); + memset(&a0, 0, sizeof(a0)); if (sext->pivot_offset.x) a0.x = (float) sext->pivot_offset.x * f; @@ -1643,8 +1643,8 @@ static mdmodel_t *mdload(const char *filnam) // smuggle the file name into the model struct. // head.nam is unused as far as I can tell - Bstrncpyz(vm3->head.nam, filnam, sizeof(vm3->head.nam)); - + strncpy(vm3->head.nam, filnam, sizeof(vm3->head.nam)); + vm3->head.nam[sizeof(vm3->head.nam)-1] = 0; md3postload_common(vm3); } diff --git a/source/build/src/mhk.cpp b/source/build/src/mhk.cpp index 732f5729b..8d0a4a0bc 100644 --- a/source/build/src/mhk.cpp +++ b/source/build/src/mhk.cpp @@ -107,9 +107,9 @@ int32_t engineLoadMHK(const char *filename) if (filename) { - Bmemset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES); - Bmemset(spritesmooth, 0, sizeof(spritesmooth_t) *(MAXSPRITES+MAXUNIQHUDID)); - Bstrcpy(fn, filename); + memset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES); + memset(spritesmooth, 0, sizeof(spritesmooth_t) *(MAXSPRITES+MAXUNIQHUDID)); + strcpy(fn, filename); script = scriptfile_fromfile(filename); } else if (fn[0]) diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index be90b54d7..64ac613ea 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -144,7 +144,7 @@ static float* multiplyMatrix4f(float m0[4*4], const float m1[4*4]) multMatrix4RowCol(3, 2); multMatrix4RowCol(3, 3); - Bmemcpy(m0, mR, sizeof(float)*4*4); + memcpy(m0, mR, sizeof(float)*4*4); return m0; @@ -1124,7 +1124,7 @@ static void polymost_internal_nonparallaxed(vec2f_t n0, vec2f_t n1, float ryp0, if (globalorientation&64) //Hack for relative alignment on slopes { float r = global_cf_heinum * (1.0f / 4096.f); - r = Bsqrtf(r*r+1); + r = sqrtf(r*r+1); if (!(globalorientation&4)) { xtex.v *= r; ytex.v *= r; otex.v *= r; } else { xtex.u *= r; ytex.u *= r; otex.u *= r; } } @@ -2498,8 +2498,8 @@ void polymost_drawrooms() else { float r = (float)(ydimen >> 1) - (ghoriz + ghorizcorrect); - gshang = r / Bsqrtf(r * r + ghalfx * ghalfx / (gvrcorrection * gvrcorrection)); - gchang = Bsqrtf(1.f - gshang * gshang); + gshang = r / sqrtf(r * r + ghalfx * ghalfx / (gvrcorrection * gvrcorrection)); + gchang = sqrtf(1.f - gshang * gshang); ghoriz2 = 0.f; } @@ -2610,7 +2610,7 @@ void polymost_drawrooms() while (numbunches > 0) { - Bmemset(ptempbuf,0,numbunches+3); ptempbuf[0] = 1; + memset(ptempbuf,0,numbunches+3); ptempbuf[0] = 1; int32_t closest = 0; //Almost works, but not quite :( @@ -2895,8 +2895,8 @@ void polymost_prepareMirror(int32_t dax, int32_t day, int32_t daz, fixed_t daang else { float r = (float)(ydimen >> 1) - (ghoriz+ghorizcorrect); - gshang = r / Bsqrtf(r * r + ghalfx * ghalfx / (gvrcorrection * gvrcorrection)); - gchang = Bsqrtf(1.f - gshang * gshang); + gshang = r / sqrtf(r * r + ghalfx * ghalfx / (gvrcorrection * gvrcorrection)); + gchang = sqrtf(1.f - gshang * gshang); ghoriz2 = 0.f; } ghoriz = (float)(ydimen>>1); @@ -2941,7 +2941,7 @@ static wallspriteinfo_t wsprinfo[MAXSPRITES]; void Polymost_prepare_loadboard(void) { - Bmemset(wsprinfo, 0, sizeof(wsprinfo)); + memset(wsprinfo, 0, sizeof(wsprinfo)); } void polymost_deletesprite(int num) diff --git a/source/build/src/scriptfile.cpp b/source/build/src/scriptfile.cpp index a8a13f014..d32e419cf 100644 --- a/source/build/src/scriptfile.cpp +++ b/source/build/src/scriptfile.cpp @@ -136,7 +136,7 @@ int scriptfile_getsymbol(scriptfile *sf, int32_t *num) if (!t) return -1; char * e; - int32_t v = Bstrtol(t, &e, 10); + int32_t v = strtol(t, &e, 10); if (*e) { @@ -321,12 +321,12 @@ scriptfile *scriptfile_fromstring(const char *string) { if (!string) return nullptr; - uint32_t flen = Bstrlen(string); + uint32_t flen = strlen(string); char * tx = (char *)Xmalloc(flen + 2); scriptfile *sf = (scriptfile *)Xmalloc(sizeof(scriptfile)); - Bmemcpy(tx, string, flen); + memcpy(tx, string, flen); tx[flen] = tx[flen+1] = 0; scriptfile_preparse(sf,tx,flen); @@ -373,7 +373,7 @@ static char *getsymbtabspace(int32_t reqd) int32_t scriptfile_getsymbolvalue(char const *name, int32_t *val) { - if (Bstrlen(name) > 2) + if (strlen(name) > 2) { if (name[0] == '0' && tolower(name[1]) == 'x') // hex constants { diff --git a/source/build/src/voxmodel.cpp b/source/build/src/voxmodel.cpp index b5471a60e..cc6ac7804 100644 --- a/source/build/src/voxmodel.cpp +++ b/source/build/src/voxmodel.cpp @@ -317,10 +317,10 @@ static void addquad(int32_t x0, int32_t y0, int32_t z0, int32_t x1, int32_t y1, //Extend borders vertically for (bssize_t yy=0; yymytex[(shp[z].y+yy)*gvox->mytexx + shp[z].x], + memcpy(&gvox->mytex[(shp[z].y+yy)*gvox->mytexx + shp[z].x], &gvox->mytex[(shp[z].y+VOXBORDWIDTH)*gvox->mytexx + shp[z].x], (x+(VOXBORDWIDTH<<1))<<2); - Bmemcpy(&gvox->mytex[(shp[z].y+y+yy+VOXBORDWIDTH)*gvox->mytexx + shp[z].x], + memcpy(&gvox->mytex[(shp[z].y+y+yy+VOXBORDWIDTH)*gvox->mytexx + shp[z].x], &gvox->mytex[(shp[z].y+y-1+VOXBORDWIDTH)*gvox->mytexx + shp[z].x], (x+(VOXBORDWIDTH<<1))<<2); } @@ -863,7 +863,7 @@ voxmodel_t *voxload(const char *filnam) { int32_t is8bit, ret; - const int32_t i = Bstrlen(filnam)-4; + const int32_t i = strlen(filnam)-4; if (i < 0) return NULL; @@ -905,7 +905,7 @@ voxmodel_t *loadkvxfrombuf(const char *kvxbuffer, int32_t length) if (!buffer) return NULL; - Bmemcpy(buffer, kvxbuffer, length); + memcpy(buffer, kvxbuffer, length); int32_t *longptr = (int32_t*)buffer; @@ -1107,7 +1107,7 @@ int32_t polymost_voxdraw(voxmodel_t *m, tspriteptr_t const tspr) //transform to Build coords float omat[16]; - Bmemcpy(omat, mat, sizeof(omat)); + memcpy(omat, mat, sizeof(omat)); f = 1.f/64.f; g = m0.x*f; mat[0] *= g; mat[1] *= g; mat[2] *= g; diff --git a/source/core/searchpaths.cpp b/source/core/searchpaths.cpp index 3cc3965a7..d125b1bf1 100644 --- a/source/core/searchpaths.cpp +++ b/source/core/searchpaths.cpp @@ -953,7 +953,7 @@ bool AddINIFile(const char* pzFile, bool bForce = false) pINIIter = pINIIter->pNext = new INICHAIN; pINIIter->pNext = NULL; pINIIter->pDescription = NULL; - Bstrncpy(pINIIter->zName, pzFile, BMAX_PATH); + strncpy(pINIIter->zName, pzFile, BMAX_PATH); for (int i = 0; i < countof(gINIDescription); i++) { if (!strnicmp(pINIIter->zName, gINIDescription[i].pzFilename, BMAX_PATH)) diff --git a/source/exhumed/src/gun.cpp b/source/exhumed/src/gun.cpp index 76493ad7d..00789f297 100644 --- a/source/exhumed/src/gun.cpp +++ b/source/exhumed/src/gun.cpp @@ -311,7 +311,7 @@ int CheckCloseRange(short nPlayer, int *x, int *y, int *z, short *nSector) if (sqrtNum > INT_MAX) { - DPrintf(DMSG_WARNING, "%s %d: overflow\n", EDUKE32_FUNCTION, __LINE__); + DPrintf(DMSG_WARNING, "%s %d: overflow\n", __func__, __LINE__); sqrtNum = INT_MAX; } diff --git a/source/exhumed/src/move.cpp b/source/exhumed/src/move.cpp index 596fd90e6..a25192a1a 100644 --- a/source/exhumed/src/move.cpp +++ b/source/exhumed/src/move.cpp @@ -692,7 +692,7 @@ int PlotCourseToSprite(int nSprite1, int nSprite2) if (diff > INT_MAX) { - DPrintf(DMSG_WARNING, "%s %d: overflow\n", EDUKE32_FUNCTION, __LINE__); + DPrintf(DMSG_WARNING, "%s %d: overflow\n", __func__, __LINE__); diff = INT_MAX; } @@ -854,7 +854,7 @@ void CreatePushBlock(int nSector) if (sqrtNum > INT_MAX) { - DPrintf(DMSG_WARNING, "%s %d: overflow\n", EDUKE32_FUNCTION, __LINE__); + DPrintf(DMSG_WARNING, "%s %d: overflow\n", __func__, __LINE__); sqrtNum = INT_MAX; } @@ -1127,7 +1127,7 @@ void SetQuake(short nSprite, int nVal) if (sqrtNum > INT_MAX) { - DPrintf(DMSG_WARNING, "%s %d: overflow\n", EDUKE32_FUNCTION, __LINE__); + DPrintf(DMSG_WARNING, "%s %d: overflow\n", __func__, __LINE__); sqrtNum = INT_MAX; } @@ -1189,7 +1189,7 @@ int AngleChase(int nSprite, int nSprite2, int ebx, int ecx, int push1) if (sqrtNum > INT_MAX) { - DPrintf(DMSG_WARNING, "%s %d: overflow\n", EDUKE32_FUNCTION, __LINE__); + DPrintf(DMSG_WARNING, "%s %d: overflow\n", __func__, __LINE__); sqrtNum = INT_MAX; } @@ -1241,7 +1241,7 @@ int AngleChase(int nSprite, int nSprite2, int ebx, int ecx, int push1) if (sqrtNum > INT_MAX) { - DPrintf(DMSG_WARNING, "%s %d: overflow\n", EDUKE32_FUNCTION, __LINE__); + DPrintf(DMSG_WARNING, "%s %d: overflow\n", __func__, __LINE__); sqrtNum = INT_MAX; } diff --git a/source/exhumed/src/player.cpp b/source/exhumed/src/player.cpp index e95898485..d2b050d1b 100644 --- a/source/exhumed/src/player.cpp +++ b/source/exhumed/src/player.cpp @@ -183,7 +183,7 @@ void feebtag(int x, int y, int z, int nSector, short *nSprite, int nVal2, int nV if (diff > INT_MAX) { - Printf("%s %d: overflow\n", EDUKE32_FUNCTION, __LINE__); + Printf("%s %d: overflow\n", __func__, __LINE__); diff = INT_MAX; } @@ -1212,7 +1212,7 @@ loc_1AB8E: if (sqrtNum > INT_MAX) { - DPrintf(DMSG_WARNING, "%s %d: overflow\n", EDUKE32_FUNCTION, __LINE__); + DPrintf(DMSG_WARNING, "%s %d: overflow\n", __func__, __LINE__); sqrtNum = INT_MAX; } diff --git a/source/exhumed/src/queen.cpp b/source/exhumed/src/queen.cpp index 5f3b72a11..1fe66da8f 100644 --- a/source/exhumed/src/queen.cpp +++ b/source/exhumed/src/queen.cpp @@ -262,7 +262,7 @@ int QueenAngleChase(short nSprite, short nSprite2, int val1, int val2) if (sqrtVal > INT_MAX) { - DPrintf(DMSG_WARNING, "%s %d: overflow\n", EDUKE32_FUNCTION, __LINE__); + DPrintf(DMSG_WARNING, "%s %d: overflow\n", __func__, __LINE__); sqrtVal = INT_MAX; } @@ -307,7 +307,7 @@ int QueenAngleChase(short nSprite, short nSprite2, int val1, int val2) if (sqrtNum > INT_MAX) { - DPrintf(DMSG_WARNING, "%s %d: overflow\n", EDUKE32_FUNCTION, __LINE__); + DPrintf(DMSG_WARNING, "%s %d: overflow\n", __func__, __LINE__); sqrtNum = INT_MAX; } diff --git a/source/exhumed/src/runlist.cpp b/source/exhumed/src/runlist.cpp index d213a9381..0be1a8222 100644 --- a/source/exhumed/src/runlist.cpp +++ b/source/exhumed/src/runlist.cpp @@ -1550,7 +1550,7 @@ int runlist_CheckRadialDamage(short nSprite) if (sqrtNum > INT_MAX) { - DPrintf(DMSG_WARNING, "%s %d: overflow\n", EDUKE32_FUNCTION, __LINE__); + DPrintf(DMSG_WARNING, "%s %d: overflow\n", __func__, __LINE__); sqrtNum = INT_MAX; } diff --git a/source/exhumed/src/snake.cpp b/source/exhumed/src/snake.cpp index a8ff1c192..d3eaae52a 100644 --- a/source/exhumed/src/snake.cpp +++ b/source/exhumed/src/snake.cpp @@ -152,7 +152,7 @@ int BuildSnake(short nPlayer, short zVal) if (sqrtNum > INT_MAX) { - DPrintf(DMSG_WARNING, "%s %d: overflow\n", EDUKE32_FUNCTION, __LINE__); + DPrintf(DMSG_WARNING, "%s %d: overflow\n", __func__, __LINE__); sqrtNum = INT_MAX; } diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index a036210b0..9e726ce95 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -96,7 +96,6 @@ void addspritetodelete(int spnum) // // //--------------------------------------------------------------------------- -void VM_Execute(native_t loop); void ParseState::parseifelse(int condition) { diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 66eaf7588..843375871 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -1007,7 +1007,7 @@ void sethorizon(int snum, ESyncBits actions, double factor, fixed_t adjustment) auto p = &ps[snum]; // Calculate adjustment as true pitch (Fixed point math really sucks...) - double horizAngle = clamp2(atan2(p->q16horiz - IntToFixed(100), IntToFixed(128)) * (512. / pi::pi()) + (factor * p->pitchAdjust) + (adjustment / 65536.), -180, 180); + double horizAngle = clamp(atan2(p->q16horiz - IntToFixed(100), IntToFixed(128)) * (512. / pi::pi()) + (factor * p->pitchAdjust) + (adjustment / 65536.), -180, 180); if (p->return_to_center > 0 && (actions & (SB_LOOK_UP | SB_LOOK_DOWN)) == 0) // only snap back if no relevant button is pressed. { diff --git a/source/sw/src/game.h b/source/sw/src/game.h index eefdad74d..5e0be8d02 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -523,7 +523,7 @@ int StdRandomRange(int range); ) -#define SIZ ARRAY_SIZE +#define SIZ countof // diff --git a/source/sw/src/saveable.h b/source/sw/src/saveable.h index 97992360a..f74438696 100644 --- a/source/sw/src/saveable.h +++ b/source/sw/src/saveable.h @@ -52,7 +52,7 @@ constexpr enable_if_t::value, size_t> SAVE_SIZEOF(T const & #define SAVE_CODE(s) (void*)(s) #define SAVE_DATA(s) { (void*)&(s), SAVE_SIZEOF(s) } -#define NUM_SAVEABLE_ITEMS(x) ARRAY_SIZE(x) +#define NUM_SAVEABLE_ITEMS(x) countof(x) typedef struct {