Bunch more work on getting this to compile. Down to Stream and Gfx_OpenGL now.

This commit is contained in:
Ryan C. Gordon 2016-03-30 13:41:30 -04:00
parent 7d118bd249
commit 105bc12d64
8 changed files with 60 additions and 47 deletions

View File

@ -155,27 +155,29 @@ public:
inline CTString &GetDescription(void) { return strm_strStreamDescription; }; inline CTString &GetDescription(void) { return strm_strStreamDescription; };
/* Read an object from stream. */ /* Read an object from stream. */
inline CTStream &operator>>(float &f) { Read_t( &f, sizeof( f)); return *this; } // throw char * inline CTStream &operator>>(UBYTE &ub) { Read_t(&ub, sizeof(ub)); return *this; } // throw char *
inline CTStream &operator>>(double &d) { Read_t( &d, sizeof( d)); return *this; } // throw char * inline CTStream &operator>>(SBYTE &sb) { Read_t(&sb, sizeof(sb)); return *this; } // throw char *
inline CTStream &operator>>(ULONG &ul) { Read_t(&ul, sizeof(ul)); return *this; } // throw char * inline CTStream &operator>>(float &f) { Read_t( &f, sizeof( f)); BYTESWAP( f); return *this; } // throw char *
inline CTStream &operator>>(UWORD &uw) { Read_t(&uw, sizeof(uw)); return *this; } // throw char * inline CTStream &operator>>(double &d) { Read_t( &d, sizeof( d)); BYTESWAP( d); return *this; } // throw char *
inline CTStream &operator>>(UBYTE &ub) { Read_t(&ub, sizeof(ub)); return *this; } // throw char * inline CTStream &operator>>(ULONG &ul) { Read_t(&ul, sizeof(ul)); BYTESWAP(ul); return *this; } // throw char *
inline CTStream &operator>>(SLONG &sl) { Read_t(&sl, sizeof(sl)); return *this; } // throw char * inline CTStream &operator>>(SLONG &sl) { Read_t(&sl, sizeof(sl)); BYTESWAP(sl); return *this; } // throw char *
inline CTStream &operator>>(SWORD &sw) { Read_t(&sw, sizeof(sw)); return *this; } // throw char * inline CTStream &operator>>(UWORD &uw) { Read_t(&uw, sizeof(uw)); BYTESWAP(uw); return *this; } // throw char *
inline CTStream &operator>>(SBYTE &sb) { Read_t(&sb, sizeof(sb)); return *this; } // throw char * inline CTStream &operator>>(SWORD &sw) { Read_t(&sw, sizeof(sw)); BYTESWAP(sw); return *this; } // throw char *
inline CTStream &operator>>(BOOL &b) { Read_t( &b, sizeof( b)); return *this; } // throw char * inline CTStream &operator>>(BOOL &b) { Read_t( &b, sizeof( b)); BYTESWAP( b); return *this; } // throw char *
inline CTStream &operator>>(__int64 &i64) { Read_t( &i64, sizeof(i64)); return *this; } // throw char * inline CTStream &operator>>(__int64 i) { Read_t( &i, sizeof( i)); BYTESWAP( i); return *this; } // throw char *
inline CTStream &operator>>(__uint64 i) { Read_t( &i, sizeof( i)); BYTESWAP( i); return *this; } // throw char *
/* Write an object into stream. */ /* Write an object into stream. */
inline CTStream &operator<<(const float &f) { Write_t( &f, sizeof( f)); return *this; } // throw char * inline CTStream &operator<<(UBYTE ub) { Write_t(&ub, sizeof(ub)); return *this; } // throw char *
inline CTStream &operator<<(const double &d) { Write_t( &d, sizeof( d)); return *this; } // throw char * inline CTStream &operator<<(SBYTE sb) { Write_t(&sb, sizeof(sb)); return *this; } // throw char *
inline CTStream &operator<<(const ULONG &ul) { Write_t(&ul, sizeof(ul)); return *this; } // throw char * inline CTStream &operator<<(float f) { BYTESWAP( f); Write_t( &f, sizeof( f)); return *this; } // throw char *
inline CTStream &operator<<(const UWORD &uw) { Write_t(&uw, sizeof(uw)); return *this; } // throw char * inline CTStream &operator<<(double d) { BYTESWAP( d); Write_t( &d, sizeof( d)); return *this; } // throw char *
inline CTStream &operator<<(const UBYTE &ub) { Write_t(&ub, sizeof(ub)); return *this; } // throw char * inline CTStream &operator<<(ULONG ul) { BYTESWAP(ul); Write_t(&ul, sizeof(ul)); return *this; } // throw char *
inline CTStream &operator<<(const SLONG &sl) { Write_t(&sl, sizeof(sl)); return *this; } // throw char * inline CTStream &operator<<(SLONG sl) { BYTESWAP(sl); Write_t(&sl, sizeof(sl)); return *this; } // throw char *
inline CTStream &operator<<(const SWORD &sw) { Write_t(&sw, sizeof(sw)); return *this; } // throw char * inline CTStream &operator<<(UWORD uw) { BYTESWAP(uw); Write_t(&uw, sizeof(uw)); return *this; } // throw char *
inline CTStream &operator<<(const SBYTE &sb) { Write_t(&sb, sizeof(sb)); return *this; } // throw char * inline CTStream &operator<<(SWORD sw) { BYTESWAP(sw); Write_t(&sw, sizeof(sw)); return *this; } // throw char *
inline CTStream &operator<<(const BOOL &b) { Write_t( &b, sizeof( b)); return *this; } // throw char * inline CTStream &operator<<(BOOL b) { BYTESWAP( b); Write_t( &b, sizeof( b)); return *this; } // throw char *
inline CTStream &operator<<(const __int64 &i64) { Write_t( &i64, sizeof(i64)); return *this; } // throw char * inline CTStream &operator<<(__int64 i) { BYTESWAP( i); Write_t( &i, sizeof( i)); return *this; } // throw char *
inline CTStream &operator<<(__uint64 i) { BYTESWAP( i); Write_t( &i, sizeof( i)); return *this; } // throw char *
// CTFileName reading/writing // CTFileName reading/writing
ENGINE_API friend CTStream &operator>>(CTStream &strmStream, CTFileName &fnmFileName); ENGINE_API friend CTStream &operator>>(CTStream &strmStream, CTFileName &fnmFileName);

View File

@ -191,6 +191,7 @@ typedef unsigned int UINT;
typedef long long __int64; typedef long long __int64;
#endif #endif
typedef char CHAR;
typedef UBYTE BYTE; typedef UBYTE BYTE;
typedef unsigned short WORD; typedef unsigned short WORD;
typedef unsigned long int DWORD; typedef unsigned long int DWORD;

View File

@ -1,6 +1,6 @@
/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */ /* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */
#include "StdH.h" #include <Engine/StdH.h>
#include <Engine/Engine.h> #include <Engine/Engine.h>
#include <Engine/CurrentVersion.h> #include <Engine/CurrentVersion.h>
@ -39,9 +39,10 @@ typedef struct sockaddr SOCKADDR;
#ifdef PLATFORM_WIN32 #ifdef PLATFORM_WIN32
#pragma comment(lib, "wsock32.lib") #pragma comment(lib, "wsock32.lib")
WSADATA* _wsaData = NULL; WSADATA* _wsaData = NULL;
typedef int socklen_t;
#endif #endif
SOCKET _socket = NULL; SOCKET _socket = INVALID_SOCKET;
sockaddr_in* _sin = NULL; sockaddr_in* _sin = NULL;
sockaddr_in* _sinLocal = NULL; sockaddr_in* _sinLocal = NULL;
@ -56,18 +57,18 @@ TIME _tmLastHeartbeat = 0;
CDynamicStackArray<CServerRequest> ga_asrRequests; CDynamicStackArray<CServerRequest> ga_asrRequests;
extern CTString ga_strServer = "master1.croteam.org"; CTString ga_strServer = "master1.croteam.org";
void _uninitWinsock(); void _uninitWinsock();
void _initializeWinsock(void) void _initializeWinsock(void)
{ {
#ifdef PLATFORM_WIN32 #ifdef PLATFORM_WIN32
if(_wsaData != NULL && _socket != NULL) { if(_wsaData != NULL && _socket != INVALID_SOCKET) {
return; return;
} }
_wsaData = new WSADATA; _wsaData = new WSADATA;
_socket = NULL; _socket = INVALID_SOCKET;
// make the buffer that we'll use for packet reading // make the buffer that we'll use for packet reading
if(_szBuffer != NULL) { if(_szBuffer != NULL) {
@ -89,7 +90,7 @@ void _initializeWinsock(void)
// if we couldn't resolve the hostname // if we couldn't resolve the hostname
if(phe == NULL) { if(phe == NULL) {
// report and stop // report and stop
CPrintF("Couldn't resolve GameAgent server %s.\n", ga_strServer); CPrintF("Couldn't resolve GameAgent server %s.\n", (const char *) ga_strServer);
_uninitWinsock(); _uninitWinsock();
return; return;
} }
@ -102,6 +103,11 @@ void _initializeWinsock(void)
// create the socket // create the socket
_socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); _socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (_socket == INVALID_SOCKET) {
CPrintF("Error creating GameAgent socket!\n");
_uninitWinsock();
return;
}
// if we're a server // if we're a server
if(_bServer) { if(_bServer) {
@ -141,14 +147,16 @@ void _initializeWinsock(void)
void _uninitWinsock() void _uninitWinsock()
{ {
if(_wsaData != NULL) { if (_socket != INVALID_SOCKET) {
closesocket(_socket); closesocket(_socket);
#ifdef PLATFORM_WIN32 _socket = INVALID_SOCKET;
}
#ifdef PLATFORM_WIN32
if(_wsaData != NULL) {
delete _wsaData; delete _wsaData;
_wsaData = NULL; _wsaData = NULL;
#endif
} }
_socket = NULL; #endif
} }
void _sendPacketTo(const char* pubBuffer, INDEX iLen, sockaddr_in* sin) void _sendPacketTo(const char* pubBuffer, INDEX iLen, sockaddr_in* sin)
@ -173,7 +181,7 @@ void _sendPacket(const char* szBuffer)
int _recvPacket() int _recvPacket()
{ {
int fromLength = sizeof(_sinFrom); socklen_t fromLength = sizeof(_sinFrom);
return recvfrom(_socket, _szBuffer, 1024, 0, (sockaddr*)&_sinFrom, &fromLength); return recvfrom(_socket, _szBuffer, 1024, 0, (sockaddr*)&_sinFrom, &fromLength);
} }
@ -202,10 +210,10 @@ void _sendHeartbeat(INDEX iChallenge)
iChallenge, iChallenge,
_pNetwork->ga_srvServer.GetPlayersCount(), _pNetwork->ga_srvServer.GetPlayersCount(),
_pNetwork->ga_sesSessionState.ses_ctMaxPlayers, _pNetwork->ga_sesSessionState.ses_ctMaxPlayers,
_pNetwork->ga_World.wo_strName, (const char *) _pNetwork->ga_World.wo_strName,
_getGameModeName(_getSP()->sp_gmGameMode), (const char *) _getGameModeName(_getSP()->sp_gmGameMode),
_SE_VER_STRING, _SE_VER_STRING,
_pShell->GetString("sam_strGameName")); (const char *) _pShell->GetString("sam_strGameName"));
_sendPacket(strPacket); _sendPacket(strPacket);
_tmLastHeartbeat = _pTimer->GetRealTimeTick(); _tmLastHeartbeat = _pTimer->GetRealTimeTick();
} }
@ -250,7 +258,7 @@ extern void GameAgent_ServerEnd(void)
/// GameAgent server update call which responds to enumeration pings and sends pings to masterserver. /// GameAgent server update call which responds to enumeration pings and sends pings to masterserver.
extern void GameAgent_ServerUpdate(void) extern void GameAgent_ServerUpdate(void)
{ {
if((_socket == NULL) || (!_bInitialized)) { if((_socket == INVALID_SOCKET) || (!_bInitialized)) {
return; return;
} }
@ -273,11 +281,11 @@ extern void GameAgent_ServerUpdate(void)
strPacket.PrintF("0;players;%d;maxplayers;%d;level;%s;gametype;%s;version;%s;gamename;%s;sessionname;%s", strPacket.PrintF("0;players;%d;maxplayers;%d;level;%s;gametype;%s;version;%s;gamename;%s;sessionname;%s",
_pNetwork->ga_srvServer.GetPlayersCount(), _pNetwork->ga_srvServer.GetPlayersCount(),
_pNetwork->ga_sesSessionState.ses_ctMaxPlayers, _pNetwork->ga_sesSessionState.ses_ctMaxPlayers,
_pNetwork->ga_World.wo_strName, (const char *) _pNetwork->ga_World.wo_strName,
_getGameModeName(_getSP()->sp_gmGameMode), (const char *) _getGameModeName(_getSP()->sp_gmGameMode),
_SE_VER_STRING, _SE_VER_STRING,
_pShell->GetString("sam_strGameName"), (const char *) _pShell->GetString("sam_strGameName"),
_pShell->GetString("gam_strSessionName")); (const char *) _pShell->GetString("gam_strSessionName"));
_sendPacketTo(strPacket, &_sinFrom); _sendPacketTo(strPacket, &_sinFrom);
break; break;
} }
@ -355,7 +363,7 @@ extern void GameAgent_EnumTrigger(BOOL bInternet)
/// GameAgent client update for enumerations. /// GameAgent client update for enumerations.
extern void GameAgent_EnumUpdate(void) extern void GameAgent_EnumUpdate(void)
{ {
if((_socket == NULL) || (!_bInitialized)) { if((_socket == INVALID_SOCKET) || (!_bInitialized)) {
return; return;
} }
@ -439,7 +447,7 @@ extern void GameAgent_EnumUpdate(void)
} else if(strKey == "gamename") { } else if(strKey == "gamename") {
strGameName = strValue; strGameName = strValue;
} else { } else {
CPrintF("Unknown GameAgent parameter key '%s'!", strKey); CPrintF("Unknown GameAgent parameter key '%s'!", (const char *) strKey);
} }
// reset temporary holders // reset temporary holders

View File

@ -7,6 +7,7 @@
#endif #endif
#include <Engine/Base/Assert.h> #include <Engine/Base/Assert.h>
#include <Engine/Math/Functions.h>
/* /*
* Template class for quaternion of arbitrary precision. * Template class for quaternion of arbitrary precision.

View File

@ -4,6 +4,7 @@
#include <Engine/Ska/AnimSet.h> #include <Engine/Ska/AnimSet.h>
#include <Engine/Ska/StringTable.h> #include <Engine/Ska/StringTable.h>
#include <Engine/Base/ErrorReporting.h> #include <Engine/Base/ErrorReporting.h>
#include <Engine/Base/Shell.h>
#include <Engine/Templates/DynamicContainer.cpp> #include <Engine/Templates/DynamicContainer.cpp>
// for static linking mojo... // for static linking mojo...

View File

@ -455,7 +455,7 @@ FLOAT BSPNode<Type, iDimensions>::TestSphere(const Vector<Type, iDimensions> &vS
} else { } else {
ASSERT(bn_bnlLocation == BNL_BRANCH); ASSERT(bn_bnlLocation == BNL_BRANCH);
// test the sphere against the split plane // test the sphere against the split plane
Type tCenterDistance = PointDistance(vSphereCenter); Type tCenterDistance = this->PointDistance(vSphereCenter);
// if the sphere is in front of the plane // if the sphere is in front of the plane
if (tCenterDistance > +tSphereRadius) { if (tCenterDistance > +tSphereRadius) {
// recurse down the front node // recurse down the front node
@ -564,8 +564,8 @@ void BSPNode<Type, iDimensions>::FindLineMinMax(
} else { } else {
ASSERT(bn_bnlLocation == BNL_BRANCH); ASSERT(bn_bnlLocation == BNL_BRANCH);
// test the points against the split plane // test the points against the split plane
Type tD0 = PointDistance(v0); Type tD0 = this->PointDistance(v0);
Type tD1 = PointDistance(v1); Type tD1 = this->PointDistance(v1);
// if both are front // if both are front
if (tD0>=0 && tD1>=0) { if (tD0>=0 && tD1>=0) {
// recurse down the front node // recurse down the front node

View File

@ -39,7 +39,7 @@ void CSelection<cType, ulFlag>::Deselect(cType &tToSelect)
// deselect it // deselect it
tToSelect.Deselect(ulFlag); tToSelect.Deselect(ulFlag);
// remove it from this container // remove it from this container
Remove(&tToSelect); this->Remove(&tToSelect);
// if the object is not selected // if the object is not selected
} else { } else {

View File

@ -664,7 +664,7 @@ endif
#DYNAMIC_SDL_LDFLAGS := $(shell sdl-config --libs) #DYNAMIC_SDL_LDFLAGS := $(shell sdl-config --libs)
DYNAMIC_SDL_LDFLAGS := DYNAMIC_SDL_LDFLAGS :=
ifeq ($(strip $(macosx)),true) ifeq ($(strip $(macosx)),true)
DYNAMIC_SDL_LDFLAGS := lib/macosx_x86/libSDL-1.2.0.dylib bin/libSDLmain.a DYNAMIC_SDL_LDFLAGS := lib/macosx/libSDL-1.2.0.dylib lib/macosx/libSDLmain.a
else else
DYNAMIC_SDL_LDFLAGS := lib/linux_x86/libSDL-1.2.so.0 DYNAMIC_SDL_LDFLAGS := lib/linux_x86/libSDL-1.2.so.0
endif endif
@ -743,7 +743,7 @@ endif
ifeq ($(strip $(macosx)),true) ifeq ($(strip $(macosx)),true)
SDLMAINLIB := bin/libSDLmain.a SDLMAINLIB := bin/libSDLmain.a
$(SDLMAINLIB) : lib/macosx_x86/libSDLmain.a $(BINDIR) $(SDLMAINLIB) : lib/macosx/libSDLmain.a $(BINDIR)
cp $< $@ cp $< $@
ranlib $@ ranlib $@
endif endif