22 #if defined( __x86_64__ ) || defined( _WIN64 ) 
   30 #define UNINITIALIZED 0x7f8e6d9c 
   32 #define MAX_PLAYERS     12 
   34 #define USE_INLINE_ASM 1                // Define this to use inline assembly 
   35 #define STRUCT_CMP(a, b) memcmp((void *) &a, (void *) &b, sizeof(a)) 
   37 #define LOCAL static                    // make module local varilable static. 
   40 #define DIR_SEPARATOR_CHAR '\\' 
   41 #define DIR_SEPARATOR_STR  "\\" 
   43 #define DIR_SEPARATOR_CHAR '/' 
   44 #define DIR_SEPARATOR_STR  "/" 
  100         return (
self.xyz.x == other.
xyz.x
 
  101                 && 
self.xyz.y == other.
xyz.y
 
  102                 && 
self.xyz.z == other.
xyz.z
 
  141         return (left.
u == right.
u) && (left.
v == right.
v);
 
  162         return (
self.xyw.x == other.
xyw.x
 
  163                 && 
self.xyw.y == other.
xyw.y
 
  164                 && 
self.xyw.w == other.
xyw.w
 
  233 #include "osapi/outwnd.h" 
  238 #define mprintf(args) outwnd_printf2 args 
  239 #define nprintf(args) outwnd_printf args 
  241 #define mprintf(args) 
  242 #define nprintf(args) 
  245 #define LOCATION __FILE__,__LINE__ 
  259 #       define Assert(expr) do { ASSUME(expr); } while (0) 
  262 #       define Assert(expr) do {\ 
  264                         WinAssert(#expr,__FILE__,__LINE__);\ 
  272 #define Verify(x) do { if (!(x)){ Error(LOCATION, "Verify failure: %s\n", #x); } ASSUME(x); } while(0) 
  275 #ifndef _MSC_VER   // non MS compilers 
  276 #       define VerifyEx(x, y, ...) do { if (!(x)) { Error(LOCATION, "Verify failure: %s with help text " #y "\n", #x, ##__VA_ARGS__); } ASSUME(x); } while(0) 
  278 #       if _MSC_VER >= 1400     // VC 2005 or greater 
  279 #               define VerifyEx(x, y, ...) do { if (!(x)) { Error(LOCATION, "Verify failure: %s with help text " #y "\n", #x, __VA_ARGS__); } ASSUME(x); } while(0) 
  280 #       else // everything else 
  281 #               define VerifyEx(x, y) Verify(x) 
  287         #define Int3() do { } while (0) 
  292         #define Int3() debug_int3(__FILE__, __LINE__) 
  296 #define MIN(a,b) (((a) < (b)) ? (a) : (b)) 
  299 #define MAX(a,b) (((a) > (b)) ? (a) : (b)) 
  303 #define PI                              3.141592654f 
  324 #define MAX_FILENAME_LEN        32              // Length for filenames, ie "title.pcx" 
  325 #define MAX_PATH_LEN            256             // Length for pathnames, ie "c:\bitmaps\title.pcx" 
  329 #define SWAPSHORT(x)    (                                                       \ 
  334 #define SWAPINT(x)              (                                                       \ 
  336                                                 (((ulong)x) >> 24) |            \ 
  337                                                 ((x & 0x0000ff00) << 8) |       \ 
  338                                                 ((x & 0x00ff0000) >> 8)         \ 
  342 #include "SDL_endian.h" 
  345 #if SDL_BYTEORDER == SDL_BIG_ENDIAN 
  347 #define BYTE_ORDER      BIG_ENDIAN 
  348 #endif // !BYTE_ORDER 
  349 #endif // SDL_BYTEORDER 
  351 #ifdef SCP_SOLARIS // Solaris 
  352 #define INTEL_INT(x)    x 
  353 #define INTEL_SHORT(x)  x 
  354 #define INTEL_FLOAT(x)  (*x) 
  355 #elif BYTE_ORDER == BIG_ENDIAN 
  357 #undef USE_INLINE_ASM 
  362 #if !defined(__MWERKS__) 
  364 #define __stwbrx(value, base, index) \ 
  365         __asm__ ( "stwbrx %0, %1, %2" :  : "r" (value), "b%" (index), "r" (base) : "memory" ) 
  375         register int a = ((
int*) x)[0];
 
  385 #define INTEL_INT(x)    SDL_Swap32(x) 
  386 #define INTEL_SHORT(x)  SDL_Swap16(x) 
  388 #define INTEL_INT(x)    SWAPINT(x) 
  389 #define INTEL_SHORT(x)  SWAPSHORT(x) 
  391 #define INTEL_FLOAT(x)  SWAPFLOAT(x) 
  393 #else // Little Endian - 
  394 #define INTEL_INT(x)    x 
  395 #define INTEL_SHORT(x)  x 
  396 #define INTEL_FLOAT(x)  (*x) 
  418 #define VALID_FNAME(x) ( strlen((x)) && stricmp((x), "none") && stricmp((x), "<none>") ) 
  439 extern void game_busy(
const char *filename = NULL);
 
  454 #define MONITOR(function_name)                          monitor mon_##function_name(#function_name); 
  457 #define MONITOR_INC(function_name,inc)          do { mon_##function_name.value+=(inc); } while(0) 
  464 #define MONITOR(function_name) 
  466 #define MONITOR_INC(function_name,inc)          do { } while(0) 
  469 #define monitor_update() do { } while(0) 
  475 const char *
XSTR(
const char *str, 
int index);
 
  478 template <
class T> 
void CAP( T& 
v, T mn, T mx )
 
  482         } 
else if ( v > mx ) {
 
  488 #define CLAMP(x, min, max) do { if ( (x) < (min) ) (x) = (min); else if ((x) > (max)) (x) = (max); } while(0) 
  495 #define STAMP_STRING "\001\001\001\001\002\002\002\002Read the Foundation Novels from Asimov.  I liked them." 
  496 #define STAMP_STRING_LENGTH                     80 
  497 #define DEFAULT_CHECKSUM_STRING         "\001\001\001\001" 
  498 #define DEFAULT_TIME_STRING                     "\002\002\002\002" 
  502 #define CALCULATE_STAMP_CHECKSUM() do { \ 
  506                 for ( i = 0; i < (int)strlen(ptr); i++ ) {      \ 
  508                         checksum += ptr[i];     \ 
  509                         if ( checksum & 0x01 )  \ 
  511                         checksum = checksum >> 1;       \ 
  513                                 checksum |= 0x80000000; \ 
  515                 checksum |= 0x80000000; \ 
  523 int vm_init(
int min_heap_size);
 
  532         void *
_vm_malloc( 
int size, 
char *filename = NULL, 
int line = -1, 
int quiet = 0 );
 
  535         char *
_vm_strdup( 
const char *ptr, 
char *filename, 
int line );
 
  538         char *
_vm_strndup( 
const char *ptr, 
int size, 
char *filename, 
int line );
 
  541         void _vm_free( 
void *ptr, 
char *filename = NULL, 
int line= -1 );
 
  544         void *
_vm_realloc( 
void *ptr, 
int size, 
char *filename = NULL, 
int line= -1, 
int quiet = 0 );
 
  547         #define vm_malloc(size) _vm_malloc((size),__FILE__,__LINE__,0) 
  548         #define vm_free(ptr) _vm_free((ptr),__FILE__,__LINE__) 
  549         #define vm_strdup(ptr) _vm_strdup((ptr),__FILE__,__LINE__) 
  550         #define vm_strndup(ptr, size) _vm_strndup((ptr),(size),__FILE__,__LINE__) 
  551         #define vm_realloc(ptr, size) _vm_realloc((ptr),(size),__FILE__,__LINE__,0) 
  554         #define vm_malloc_q(size) _vm_malloc((size),__FILE__,__LINE__,1) 
  555         #define vm_realloc_q(ptr, size) _vm_realloc((ptr),(size),__FILE__,__LINE__,1) 
  575         #define vm_malloc(size) _vm_malloc((size),0) 
  576         #define vm_free(ptr) _vm_free(ptr) 
  577         #define vm_strdup(ptr) _vm_strdup(ptr) 
  578         #define vm_strndup(ptr, size) _vm_strndup((ptr),(size)) 
  579         #define vm_realloc(ptr, size) _vm_realloc((ptr),(size),0) 
  582         #define vm_malloc_q(size) _vm_malloc((size),1) 
  583         #define vm_realloc_q(ptr, size) _vm_realloc((ptr),(size),1) 
  613         camid(
int n_idx, 
int n_sig);
 
  628         #if defined(HAVE_CXX11) 
  633         #include <type_traits> 
  637         const auto ptr_memset = std::memset;
 
  638         #define memset memset_if_trivial_else_error 
  641         void *memset_if_trivial_else_error(T *memset_data, 
int ch, 
size_t count)
 
  644                 return ptr_memset(memset_data, ch, count);
 
  649         inline void *memset_if_trivial_else_error(
void *memset_data, 
int ch, 
size_t count)
 
  651                 return ptr_memset(memset_data, ch, count);
 
  655         const auto ptr_memcpy = std::memcpy;
 
  656         #define memcpy memcpy_if_trivial_else_error 
  658         template<
typename T, 
typename U>
 
  659         void *memcpy_if_trivial_else_error(T *memcpy_dest, U *
src, 
size_t count)
 
  663                 return ptr_memcpy(memcpy_dest, src, count);
 
  675         void *memcpy_if_trivial_else_error(
void *memcpy_dest, U *memcpy_src, 
size_t count)
 
  678                 return ptr_memcpy(memcpy_dest, memcpy_src, count);
 
  682         void *memcpy_if_trivial_else_error(T *memcpy_dest, 
void *memcpy_src, 
size_t count)
 
  685                 return ptr_memcpy(memcpy_dest, memcpy_src, count);
 
  688         void *memcpy_if_trivial_else_error(T *memcpy_dest, 
const void *memcpy_src, 
size_t count)
 
  691                 return ptr_memcpy(memcpy_dest, memcpy_src, count);
 
  694         inline void *memcpy_if_trivial_else_error(
void *memcpy_dest, 
void *memcpy_src, 
size_t count)
 
  696                 return ptr_memcpy(memcpy_dest, memcpy_src, count);
 
  700         const auto ptr_memmove = std::memmove;
 
  701         #define memmove memmove_if_trivial_else_error 
  703         template<
typename T, 
typename U>
 
  704         void *memmove_if_trivial_else_error(T *memmove_dest, U *memmove_src, 
size_t count)
 
  708                 return ptr_memmove(memmove_dest, memmove_src, count);
 
GLenum GLsizei GLenum format
 
struct screen3d::@234::@236 xyw
 
#define SCP_FORMAT_STRING_ARGS(x, y)
 
struct vec4::@222::@224 xyzw
 
bool operator==(const vec3d &self, const vec3d &other)
 
GLsizei const GLfloat * value
 
void debug_int3(char *file, int line)
 
void _cdecl void void _cdecl void _cdecl Warning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
 
void _cdecl void void _cdecl void _cdecl void _cdecl WarningEx(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
 
struct vec3d::@225::@227 xyz
 
GLenum GLuint GLenum GLsizei const GLchar * buf
 
void _vm_free(void *ptr, char *filename=NULL, int line=-1)
 
int game_busy_callback(void(*callback)(int count), int delta_step=-1)
 
void game_busy(const char *filename=NULL)
 
struct matrix::@228::@230 vec
 
GLboolean GLboolean GLboolean GLboolean a
 
int vm_init(int min_heap_size)
 
#define SCP_FORMAT_STRING
 
float SWAPFLOAT(float *x)
 
unsigned __int64 ulonglong
 
char * _vm_strndup(const char *ptr, int size, char *filename, int line)
 
struct script_hook script_hook
 
bool script_hook_valid(script_hook *hook)
 
GLint GLint GLint GLint GLint x
 
void * _vm_realloc(void *ptr, int size, char *filename=NULL, int line=-1, int quiet=0)
 
const char * XSTR(const char *str, int index)
 
void _cdecl void void _cdecl Error(const char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
 
char * _vm_strdup(const char *ptr, char *filename, int line)
 
void CAP(T &v, T mn, T mx)
 
void * _vm_malloc(int size, char *filename=NULL, int line=-1, int quiet=0)
 
class camera * getCamera()
 
struct flag_def_list def_list
 
struct effect_vertex effect_vertex
 
void _cdecl void void _cdecl void _cdecl void _cdecl void _cdecl ReleaseWarning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
 
void _cdecl WinAssert(char *text, char *filename, int line)
 
struct lod_checker lod_checker
 
#define __stwbrx(value, base, index)
 
struct matrix4::@231::@233 vec
 
void _cdecl void void _cdecl void _cdecl void _cdecl void _cdecl int Global_warning_count
 
void _cdecl void LuaError(struct lua_State *L, SCP_FORMAT_STRING const char *format=NULL,...) SCP_FORMAT_STRING_ARGS(2
 
void script_hook_init(script_hook *hook)