123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- #ifndef CMDLIB_H__
- #define CMDLIB_H__
- #if _MSC_VER >= 1000
- #pragma once
- #endif
- #ifdef __MINGW32__
- #include <io.h>
- #endif
- #ifdef HAVE_CONFIG_H
- #include "config.h"
- #endif
- // AJM: gnu compiler fix
- #ifdef __GNUC__
- #define _alloca __builtin_alloca
- #define alloca __builtin_alloca
- #endif
- #include "win32fix.h"
- #include "mathtypes.h"
- #ifdef _DEBUG
- #define ZHLT_VERSIONSTRING "v3.7"
- #else
- #define ZHLT_VERSIONSTRING "3.7"
- #endif
- // SILENCER -->
- #if !defined(_WIN64)
- #if _M_IX86_FP == 0
- #define HACK_VERSIONSTRING "x86 (32b) SSE OFF"
- #endif
- #if _M_IX86_FP == 1
- #define HACK_VERSIONSTRING "x86 (32b) SSE1 ON"
- #endif
- #if _M_IX86_FP == 2
- #define HACK_VERSIONSTRING "x86 (32b) SSE2 ON"
- #endif
- #else
- #define HACK_VERSIONSTRING "x64 (64b) "
- #endif
- // <-- SILENCER
- //=====================================================================
- // AJM: Different features of the tools can be undefined here
- // these are not officially beta tested, but seem to work okay
- // ZHLT_* features are spread across more than one tool. Hence, changing
- // one of these settings probably means recompiling the whole set
- #define ZHLT_INFO_COMPILE_PARAMETERS // ALL TOOLS
- #define ZHLT_NULLTEX // HLCSG, HLBSP
- #define ZHLT_TEXLIGHT // HLCSG, HLRAD - triggerable texlights by LRC
- #define ZHLT_GENERAL // ALL TOOLS - general changes
- #define ZHLT_NEW_FILE_FUNCTIONS // ALL TOOLS - file path/extension extraction functions
- //#define ZHLT_DETAIL // HLCSG, HLBSP - detail brushes
- //#define ZHLT_PROGRESSFILE // ALL TOOLS - estimate progress reporting to -progressfile
- //#define ZHLT_NSBOB
- #define COMMON_HULLU // winding optimisations by hullu
- // tool specific settings below only mean a recompile of the tool affected
- #define HLCSG_CLIPECONOMY
- #define HLCSG_WADCFG
- #define HLCSG_AUTOWAD
- #define HLCSG_PRECISIONCLIP
- #define HLCSG_FASTFIND
- #ifdef ZHLT_NULLTEX
- #define HLCSG_NULLIFY_INVISIBLE //requires null textures as prerequisite
- #endif
- //#define HLBSP_THREADS // estimate for hlbsp
- #define HLVIS_MAXDIST
- #define HLRAD_INFO_TEXLIGHTS
- #define HLRAD_WHOME // encompases all of Adam Foster's changes
- #define HLRAD_HULLU // semi-opaque brush based entities and effects by hullu
- #define HLRAD_FASTMATH // optimized mathutil.cpp by KGP
- //=====================================================================
- #ifdef SYSTEM_WIN32
- #pragma warning(disable:4127 4115 4244 4786 4305 4800)
- #endif
- #ifdef STDC_HEADERS
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include <errno.h>
- #include <ctype.h>
- #include <time.h>
- #include <stdarg.h>
- #include <limits.h>
- #endif
- #ifdef HAVE_SYS_TIME_H
- #include <sys/time.h>
- #endif
- #ifdef HAVE_UNISTD_H
- #include <unistd.h>
- #endif
- #ifdef ZHLT_NETVIS
- #include "c2cpp.h"
- #endif
- #ifdef SYSTEM_WIN32
- #define SYSTEM_SLASH_CHAR '\\'
- #define SYSTEM_SLASH_STR "\\"
- #endif
- #ifdef SYSTEM_POSIX
- #define SYSTEM_SLASH_CHAR '/'
- #define SYSTEM_SLASH_STR "/"
- #endif
- // the dec offsetof macro doesn't work very well...
- #define myoffsetof(type,identifier) ((size_t)&((type*)0)->identifier)
- #define sizeofElement(type,identifier) (sizeof((type*)0)->identifier)
- #ifdef SYSTEM_POSIX
- extern char* strupr(char* string);
- extern char* strlwr(char* string);
- #endif
- extern const char* stristr(const char* const string, const char* const substring);
- extern bool CDECL safe_snprintf(char* const dest, const size_t count, const char* const args, ...);
- extern bool safe_strncpy(char* const dest, const char* const src, const size_t count);
- extern bool safe_strncat(char* const dest, const char* const src, const size_t count);
- extern bool TerminatedString(const char* buffer, const int size);
- extern char* FlipSlashes(char* string);
- extern double I_FloatTime();
- extern int CheckParm(char* check);
- extern void DefaultExtension(char* path, const char* extension);
- extern void DefaultPath(char* path, char* basepath);
- extern void StripFilename(char* path);
- extern void StripExtension(char* path);
- extern void ExtractFile(const char* const path, char* dest);
- extern void ExtractFilePath(const char* const path, char* dest);
- extern void ExtractFileBase(const char* const path, char* dest);
- extern void ExtractFileExtension(const char* const path, char* dest);
- extern short BigShort(short l);
- extern short LittleShort(short l);
- extern int BigLong(int l);
- extern int LittleLong(int l);
- extern float BigFloat(float l);
- extern float LittleFloat(float l);
- #endif //CMDLIB_H__
|