diff --git a/source/lib/misc.cpp b/source/lib/misc.cpp index eb83de9cd1..befbf359c8 100755 --- a/source/lib/misc.cpp +++ b/source/lib/misc.cpp @@ -180,21 +180,34 @@ uintptr_t round_up(uintptr_t val, uintptr_t multiple) } +//u16 addusw(u16 x, u16 y) +//{ +// u32 t = x; +// return (u16)MIN(t+y, 0xffff); +//} +// +// +//u16 subusw(u16 x, u16 y) +//{ +// long t = x; +// return MAX(t-y, 0); +//} + + u16 addusw(u16 x, u16 y) { - u32 t = x; - return (u16)MIN(t+y, 0xffff); +u32 t = x; +return (u16)MIN(t+y, 0xffff); } u16 subusw(u16 x, u16 y) { - long t = x; - return MAX(t-y, 0); +long t = x; +return (u16)(MAX(t-y, 0)); } - // provide fminf for non-C99 compilers #ifndef HAVE_C99 diff --git a/source/lib/sysdep/win/waio.cpp b/source/lib/sysdep/win/waio.cpp index 5af4ac8b5c..275ee020e3 100755 --- a/source/lib/sysdep/win/waio.cpp +++ b/source/lib/sysdep/win/waio.cpp @@ -472,11 +472,22 @@ static int aio_rw(struct aiocb* cb) r->ovl.Internal = r->ovl.InternalHigh = 0; -#if _MSC_VER >= 1300 - r->ovl.Pointer = (void*)ofs; -#else - r->ovl.Offset = ofs; -#endif +//#if _MSC_VER >= 1300 +// r->ovl.Pointer = (void*)ofs; +//#else +// r->ovl.Offset = ofs; +//#endif + +// a bit tricky: this should work even if size_t grows to 64 bits. +// +// we don't use OVERLAPPED.Pointer because it's not defined in +// previous platform sdk versions, and i can't figure out how +// determine the sdk version installed. can't just check for the +// vc6/vc7 compiler - vc6 with the old sdk may have been upgraded +// to the vc7.1 compiler. +// +// this assumes little endian, but we're windows-specific here anyway. +*(size_t*)&r->ovl.Offset = ofs; assert(cb->aio_buf != 0); diff --git a/source/lib/sysdep/win/wposix.cpp b/source/lib/sysdep/win/wposix.cpp index e75623a4c7..a864c8ee12 100755 --- a/source/lib/sysdep/win/wposix.cpp +++ b/source/lib/sysdep/win/wposix.cpp @@ -649,10 +649,10 @@ fp_freeaddrinfo_t freeaddrinfo; These are included in the linux C libraries, and in newer platform SDK's, so should only be needed in VC++6 or earlier. */ -#if _MSC_VER <= 1200 /* VC++6 or earlier */ +//#if _MSC_VER <= 1200 /* VC++6 or earlier */ const struct in6_addr in6addr_any=IN6ADDR_ANY_INIT; /* :: */ const struct in6_addr in6addr_loopback=IN6ADDR_LOOPBACK_INIT; /* ::1 */ -#endif +//#endif /* void entry(void) { diff --git a/source/lib/sysdep/win/wposix.h b/source/lib/sysdep/win/wposix.h index 6d4eeee44c..8b55ef00e7 100755 --- a/source/lib/sysdep/win/wposix.h +++ b/source/lib/sysdep/win/wposix.h @@ -420,8 +420,12 @@ struct ip_mreq // ==== IPv6 ==== +#define in6addr_any PS_in6addr_any +#define in6addr_loopback PS_in6addr_loopback + extern const struct in6_addr in6addr_any; /* :: */ extern const struct in6_addr in6addr_loopback; /* ::1 */ + #define IN6ADDR_ANY_INIT { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } #define IN6ADDR_LOOPBACK_INIT { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } // struct of array => 2 braces. diff --git a/source/terrain/terrainMain.cpp b/source/terrain/terrainMain.cpp index e597dfad7d..7bbbad541a 100755 --- a/source/terrain/terrainMain.cpp +++ b/source/terrain/terrainMain.cpp @@ -294,12 +294,20 @@ void InitScene () } // get default texture to apply to terrain +// CTextureEntry* texture=0; +// if (g_TexMan.m_TerrainTextures.size()>0) { +// if (g_TexMan.m_TerrainTextures[0].m_Textures.size()) { +// texture=g_TexMan.m_TerrainTextures[0].m_Textures[0]; +// } +// } + CTextureEntry* texture=0; - if (g_TexMan.m_TerrainTextures.size()>0) { - if (g_TexMan.m_TerrainTextures[0].m_Textures.size()) { - texture=g_TexMan.m_TerrainTextures[0].m_Textures[0]; - } - } +for (uint ii=0;ii