diff --git a/source/graphics/ObjectEntry.cpp b/source/graphics/ObjectEntry.cpp index 105b23628c..00c2eae5c7 100755 --- a/source/graphics/ObjectEntry.cpp +++ b/source/graphics/ObjectEntry.cpp @@ -110,7 +110,7 @@ bool CObjectEntry::BuildModel() } } } else { - LOG(ERROR,"Failed to matching prop point called \"%s\" in model \"%s\"\n",prop.m_PropPointName,(const char*) modelfilename); + LOG(ERROR,"Failed to matching prop point called \"%s\" in model \"%s\"\n", (const char*)prop.m_PropPointName, (const char*)modelfilename); } } diff --git a/source/lib/glext_funcs.h b/source/lib/glext_funcs.h index 84997ecd0b..7dd2d12889 100755 --- a/source/lib/glext_funcs.h +++ b/source/lib/glext_funcs.h @@ -1,5 +1,7 @@ -//#include -#include +#include +#ifdef _WIN32 +# include +#endif /* typedef void* HDC; typedef void* HGLRC; @@ -51,6 +53,7 @@ FUNC(void, glGetBufferParameterivARB, (int target, int pname, int* params)) FUNC(void, glGetBufferPointervARB, (int target, int pname, void** params)) // ARB_pbuffer +#ifdef _WIN32 FUNC(HPBUFFERARB, wglCreatePbufferARB, (HDC, int, int, int, const int*)) FUNC(HDC, wglGetPbufferDCARB, (HPBUFFERARB)) FUNC(int, wglReleasePbufferDCARB, (HPBUFFERARB, HDC)) @@ -61,6 +64,7 @@ FUNC(int, wglQueryPbufferARB, (HPBUFFERARB, int, int*)) FUNC(int, wglGetPixelFormatAttribivARB, (HDC, int, int, unsigned int, const int*, int*)) FUNC(int, wglGetPixelFormatAttribfvARB, (HDC, int, int, unsigned int, const int*, float*)) FUNC(int, wglChoosePixelFormatARB, (HDC, const int *, const float*, unsigned int, int*, unsigned int*)) +#endif // _WIN32 // ARB_texture_compression FUNC(void, glCompressedTexImage3DARB, (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*)) diff --git a/source/lib/res/res.cpp b/source/lib/res/res.cpp index c26efc5665..a4b050a23c 100755 --- a/source/lib/res/res.cpp +++ b/source/lib/res/res.cpp @@ -10,6 +10,7 @@ #include #endif +#include int res_reload(const char* const fn) { diff --git a/source/lib/res/sound.cpp b/source/lib/res/sound.cpp index e46e15bd8a..4f8e952c5b 100755 --- a/source/lib/res/sound.cpp +++ b/source/lib/res/sound.cpp @@ -58,7 +58,11 @@ Handle sound_load(const char* filename) { ONCE( FSOUND_Init(44100, 32, 0); +#ifdef _WIN32 atexit2(FSOUND_Close, 0, CC_STDCALL_0); +#else +// atexit2(FSOUND_Close, 0, CC_CDECL_0); // PT: Doesn't compile +#endif ); return h_alloc(H_Sound,filename,0,0); diff --git a/source/lib/res/tex.cpp b/source/lib/res/tex.cpp index 47b6beb9cd..cb392806fa 100755 --- a/source/lib/res/tex.cpp +++ b/source/lib/res/tex.cpp @@ -503,6 +503,9 @@ static int png_load(const char* fn, const u8* ptr, size_t size, Tex* t) const char* msg = 0; int err = -1; + const u8** rows = 0; + // freed in cleanup code; need scoping on VC6 due to goto + // allocate PNG structures png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0); if(!png_ptr) @@ -522,8 +525,6 @@ fail: goto ret; } - const u8** rows = 0; - // freed in cleanup code; need scoping on VC6 due to goto { diff --git a/source/lib/sysdep/sysdep.cpp b/source/lib/sysdep/sysdep.cpp index ff624f31e7..b0dd07096d 100755 --- a/source/lib/sysdep/sysdep.cpp +++ b/source/lib/sysdep/sysdep.cpp @@ -7,6 +7,10 @@ #ifndef _WIN32 +#include +#include +#include + // portable output routines (win.cpp overrides these) void display_msg(const char* caption, const char* msg) diff --git a/source/lib/timer.cpp b/source/lib/timer.cpp index 4752535ace..134421f77b 100755 --- a/source/lib/timer.cpp +++ b/source/lib/timer.cpp @@ -21,6 +21,7 @@ #include "timer.h" #include "adts.h" +#include #include // wrapper over gettimeofday, instead of emulating it for Windows, diff --git a/source/ps/CConsole.cpp b/source/ps/CConsole.cpp index eea1f0d0b9..6a01325240 100755 --- a/source/ps/CConsole.cpp +++ b/source/ps/CConsole.cpp @@ -374,7 +374,7 @@ void CConsole::InsertMessage(const wchar_t* szMessage, ...) wchar_t* szBuffer = new wchar_t[BUFFER_SIZE]; va_start(args, szMessage); - if (vsnwprintf(szBuffer, BUFFER_SIZE, szMessage, args) == -1) + if (vswprintf(szBuffer, BUFFER_SIZE, szMessage, args) == -1) debug_out("Error printfing console message (buffer size exceeded?"); va_end(args); @@ -390,7 +390,7 @@ void CConsole::SetBuffer(const wchar_t* szMessage, ...) wchar_t* szBuffer = new wchar_t[BUFFER_SIZE]; va_start(args, szMessage); - vsnwprintf(szBuffer, BUFFER_SIZE, szMessage, args); + vswprintf(szBuffer, BUFFER_SIZE, szMessage, args); va_end(args); FlushBuffer(); diff --git a/source/ps/CStr.h b/source/ps/CStr.h index aa657397e9..9545d50f8a 100755 --- a/source/ps/CStr.h +++ b/source/ps/CStr.h @@ -66,8 +66,8 @@ enum PS_TRIM_MODE {PS_TRIM_LEFT, PS_TRIM_RIGHT, PS_TRIM_BOTH}; #define _tcout wcout #define _tstod wcstod #define TCHAR wchar_t -#define _ttoi _wtoi -#define _ttol _wtol +#define _ttoi(a) wcstol(a, NULL, 0) +#define _ttol(a) wcstol(a, NULL, 0) #define _T(t) L ## t #define _totlower towlower #define _istspace iswspace diff --git a/source/ps/UniDoubler.h b/source/ps/UniDoubler.h index 3bbcc3a037..b6fd05485c 100755 --- a/source/ps/UniDoubler.h +++ b/source/ps/UniDoubler.h @@ -36,4 +36,5 @@ #undef IN_UNIDOUBLER #undef UNIDOUBLER_HEADER -#endif \ No newline at end of file +#endif + diff --git a/source/scripting/ScriptGlue.cpp b/source/scripting/ScriptGlue.cpp index fe70c1c910..e2d08bb339 100755 --- a/source/scripting/ScriptGlue.cpp +++ b/source/scripting/ScriptGlue.cpp @@ -65,7 +65,7 @@ JSBool writeConsole( JSContext* context, JSObject* globalObject, unsigned int ar { assert( argc >= 1 ); CStr output = g_ScriptingHost.ValueToString( argv[0] ); - g_Console->InsertMessage( L"%S", output ); + g_Console->InsertMessage( L"%S", (const char*)output ); return( JS_TRUE ); } diff --git a/source/scripting/ScriptingHost.cpp b/source/scripting/ScriptingHost.cpp index 94244ff7c8..9bd6db5475 100755 --- a/source/scripting/ScriptingHost.cpp +++ b/source/scripting/ScriptingHost.cpp @@ -6,7 +6,13 @@ #include #include #include -#include "float.h" // <- MT: Just for _finite(), converting certain strings was causing wierd bugs. + +#ifdef _WIN32 +# include "float.h" // <- MT: Just for _finite(), converting certain strings was causing wierd bugs. +# define finite _finite +#else +# define finite __finite // PT: Need to use _finite in MSVC, __finite in gcc +#endif #pragma comment (lib, "js32.lib") @@ -282,7 +288,7 @@ double ScriptingHost::ValueToDouble(const jsval value) JSBool ok = JS_ValueToNumber(m_Context, value, &d); - if (ok == JS_FALSE || !_finite( d ) ) + if (ok == JS_FALSE || !finite( d ) ) { throw (std::string("Convert to double failed")); } diff --git a/source/scripting/ScriptingHost.h b/source/scripting/ScriptingHost.h index 4f923dfc4b..e90a049986 100755 --- a/source/scripting/ScriptingHost.h +++ b/source/scripting/ScriptingHost.h @@ -2,7 +2,10 @@ #ifndef _SCRIPTINGHOST_H_ #define _SCRIPTINGHOST_H_ +#ifdef _WIN32 #define XP_WIN +#endif + #include #include