Corrected false error messages, old printfs
netplay.c got a bunch of new LOG_NET debug()s whose effects on performance have not been tested git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@619 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
bc6a921b84
commit
e52dba36cc
|
@ -353,8 +353,8 @@ BOOL frameInitialise(HANDLE hInst, // The windows application instance
|
||||||
{
|
{
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_CDROM) != 0)
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_CDROM) != 0)
|
||||||
{
|
{
|
||||||
printf("Error: Could not initialise SDL (%s).\n", SDL_GetError());
|
debug( LOG_ERROR, "Error: Could not initialise SDL (%s).\n", SDL_GetError() );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_WM_SetCaption(pWindowName, NULL);
|
SDL_WM_SetCaption(pWindowName, NULL);
|
||||||
|
|
|
@ -110,109 +110,5 @@ int PHYSFSEXT_locateCorrectCase(char *buf)
|
||||||
return(locateOneElement(buf) ? 0 : -1);
|
return(locateOneElement(buf) ? 0 : -1);
|
||||||
} /* PHYSFSEXT_locateCorrectCase */
|
} /* PHYSFSEXT_locateCorrectCase */
|
||||||
|
|
||||||
|
|
||||||
#ifdef TEST_PHYSFSEXT_LOCATECORRECTCASE
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
int rc;
|
|
||||||
char buf[128];
|
|
||||||
PHYSFS_file *f;
|
|
||||||
|
|
||||||
if (!PHYSFS_init(argv[0]))
|
|
||||||
{
|
|
||||||
fprintf(stderr, "PHYSFS_init(): %s\n", PHYSFS_getLastError());
|
|
||||||
return(1);
|
|
||||||
} /* if */
|
|
||||||
|
|
||||||
if (!PHYSFS_addToSearchPath(".", 1))
|
|
||||||
{
|
|
||||||
fprintf(stderr, "PHYSFS_addToSearchPath(): %s\n", PHYSFS_getLastError());
|
|
||||||
PHYSFS_deinit();
|
|
||||||
return(1);
|
|
||||||
} /* if */
|
|
||||||
|
|
||||||
if (!PHYSFS_setWriteDir("."))
|
|
||||||
{
|
|
||||||
fprintf(stderr, "PHYSFS_setWriteDir(): %s\n", PHYSFS_getLastError());
|
|
||||||
PHYSFS_deinit();
|
|
||||||
return(1);
|
|
||||||
} /* if */
|
|
||||||
|
|
||||||
if (!PHYSFS_mkdir("/a/b/c"))
|
|
||||||
{
|
|
||||||
fprintf(stderr, "PHYSFS_mkdir(): %s\n", PHYSFS_getLastError());
|
|
||||||
PHYSFS_deinit();
|
|
||||||
return(1);
|
|
||||||
} /* if */
|
|
||||||
|
|
||||||
if (!PHYSFS_mkdir("/a/b/C"))
|
|
||||||
{
|
|
||||||
fprintf(stderr, "PHYSFS_mkdir(): %s\n", PHYSFS_getLastError());
|
|
||||||
PHYSFS_deinit();
|
|
||||||
return(1);
|
|
||||||
} /* if */
|
|
||||||
|
|
||||||
f = PHYSFS_openWrite("/a/b/c/x.txt");
|
|
||||||
PHYSFS_close(f);
|
|
||||||
if (f == NULL)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "PHYSFS_openWrite(): %s\n", PHYSFS_getLastError());
|
|
||||||
PHYSFS_deinit();
|
|
||||||
return(1);
|
|
||||||
} /* if */
|
|
||||||
|
|
||||||
f = PHYSFS_openWrite("/a/b/C/X.txt");
|
|
||||||
PHYSFS_close(f);
|
|
||||||
if (f == NULL)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "PHYSFS_openWrite(): %s\n", PHYSFS_getLastError());
|
|
||||||
PHYSFS_deinit();
|
|
||||||
return(1);
|
|
||||||
} /* if */
|
|
||||||
|
|
||||||
strcpy(buf, "/a/b/c/x.txt");
|
|
||||||
rc = PHYSFSEXT_locateCorrectCase(buf);
|
|
||||||
if ((rc != 0) || (strcmp(buf, "/a/b/c/x.txt") != 0))
|
|
||||||
printf("test 1 failed\n");
|
|
||||||
|
|
||||||
strcpy(buf, "/a/B/c/x.txt");
|
|
||||||
rc = PHYSFSEXT_locateCorrectCase(buf);
|
|
||||||
if ((rc != 0) || (strcmp(buf, "/a/b/c/x.txt") != 0))
|
|
||||||
printf("test 2 failed\n");
|
|
||||||
|
|
||||||
strcpy(buf, "/a/b/C/x.txt");
|
|
||||||
rc = PHYSFSEXT_locateCorrectCase(buf);
|
|
||||||
if ((rc != 0) || (strcmp(buf, "/a/b/C/X.txt") != 0))
|
|
||||||
printf("test 3 failed\n");
|
|
||||||
|
|
||||||
strcpy(buf, "/a/b/c/X.txt");
|
|
||||||
rc = PHYSFSEXT_locateCorrectCase(buf);
|
|
||||||
if ((rc != 0) || (strcmp(buf, "/a/b/c/x.txt") != 0))
|
|
||||||
printf("test 4 failed\n");
|
|
||||||
|
|
||||||
strcpy(buf, "/a/b/c/z.txt");
|
|
||||||
rc = PHYSFSEXT_locateCorrectCase(buf);
|
|
||||||
if ((rc != -1) || (strcmp(buf, "/a/b/c/z.txt") != 0))
|
|
||||||
printf("test 5 failed\n");
|
|
||||||
|
|
||||||
strcpy(buf, "/A/B/Z/z.txt");
|
|
||||||
rc = PHYSFSEXT_locateCorrectCase(buf);
|
|
||||||
if ((rc != -2) || (strcmp(buf, "/a/b/Z/z.txt") != 0))
|
|
||||||
printf("test 6 failed\n");
|
|
||||||
|
|
||||||
printf("Testing completed.\n");
|
|
||||||
printf(" If no errors were reported, you're good to go.\n");
|
|
||||||
|
|
||||||
PHYSFS_delete("/a/b/c/x.txt");
|
|
||||||
PHYSFS_delete("/a/b/C/X.txt");
|
|
||||||
PHYSFS_delete("/a/b/c");
|
|
||||||
PHYSFS_delete("/a/b/C");
|
|
||||||
PHYSFS_delete("/a/b");
|
|
||||||
PHYSFS_delete("/a");
|
|
||||||
PHYSFS_deinit();
|
|
||||||
return(0);
|
|
||||||
} /* main */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* end of ignorecase.c ... */
|
/* end of ignorecase.c ... */
|
||||||
|
|
||||||
|
|
|
@ -49,12 +49,12 @@ void dbg_MONO_ClearRectangle(SDWORD leftedge,
|
||||||
ub_i, ub_j,
|
ub_i, ub_j,
|
||||||
ub_leftedge, ub_topedge,
|
ub_leftedge, ub_topedge,
|
||||||
ub_width, ub_height;
|
ub_width, ub_height;
|
||||||
|
|
||||||
ub_leftedge = (UBYTE)leftedge;
|
ub_leftedge = (UBYTE)leftedge;
|
||||||
ub_topedge = (UBYTE)topedge;
|
ub_topedge = (UBYTE)topedge;
|
||||||
ub_width = (UBYTE)width;
|
ub_width = (UBYTE)width;
|
||||||
ub_height = (UBYTE)height;
|
ub_height = (UBYTE)height;
|
||||||
|
|
||||||
/* do some clipping first */
|
/* do some clipping first */
|
||||||
ub_newwidth = ub_width;
|
ub_newwidth = ub_width;
|
||||||
ub_newheight = ub_height;
|
ub_newheight = ub_height;
|
||||||
|
@ -169,7 +169,7 @@ void dbg_MONO_PrintString(SDWORD ub_leftedge,
|
||||||
/* get the next character */
|
/* get the next character */
|
||||||
aub_currentcharacter[0] = *pub_formatstringptr++;
|
aub_currentcharacter[0] = *pub_formatstringptr++;
|
||||||
|
|
||||||
/* is the character a %? */
|
/* is the character a %? */
|
||||||
if (aub_currentcharacter[0] == '%')
|
if (aub_currentcharacter[0] == '%')
|
||||||
{
|
{
|
||||||
/* yes, the character is a %; is the percent flag set? */
|
/* yes, the character is a %; is the percent flag set? */
|
||||||
|
@ -369,7 +369,6 @@ static UBYTE DBug_ExpandString(UBYTE *pub_stringbuffer,
|
||||||
switch (ub_percentchar)
|
switch (ub_percentchar)
|
||||||
{
|
{
|
||||||
case 'a': /* attribute (char) */
|
case 'a': /* attribute (char) */
|
||||||
printf("Warning (%s:%d): changed char to int, might not work.\n", __FILE__, __LINE__);
|
|
||||||
ub_newattribute = va_arg(val_arglist, int);
|
ub_newattribute = va_arg(val_arglist, int);
|
||||||
// changed because gcc 4 says it'll crash here
|
// changed because gcc 4 says it'll crash here
|
||||||
// was ub_newattribute = va_arg(val_arglist, char);
|
// was ub_newattribute = va_arg(val_arglist, char);
|
||||||
|
@ -378,8 +377,6 @@ static UBYTE DBug_ExpandString(UBYTE *pub_stringbuffer,
|
||||||
|
|
||||||
|
|
||||||
case 'c': /* character */
|
case 'c': /* character */
|
||||||
|
|
||||||
printf("Warning (%s:%d): changed char to int, might not work.\n", __FILE__, __LINE__);
|
|
||||||
sprintf((char*)pub_stringbuffer, (const char*)pub_percentstring, va_arg(val_arglist, int));
|
sprintf((char*)pub_stringbuffer, (const char*)pub_percentstring, va_arg(val_arglist, int));
|
||||||
// changed because gcc 4 says it'll crash here
|
// changed because gcc 4 says it'll crash here
|
||||||
// was sprintf((char*)pub_stringbuffer, (const char*)pub_percentstring, va_arg(val_arglist, char));
|
// was sprintf((char*)pub_stringbuffer, (const char*)pub_percentstring, va_arg(val_arglist, char));
|
||||||
|
|
|
@ -56,7 +56,6 @@ line: TEXT_T QTEXT_T
|
||||||
if (!strresStoreString(psCurrRes, $1, $2))
|
if (!strresStoreString(psCurrRes, $1, $2))
|
||||||
{
|
{
|
||||||
YYABORT;
|
YYABORT;
|
||||||
printf("Hello. I'm the parser.\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
|
@ -152,7 +152,7 @@ anim_Create3D( char szPieFileName[], UWORD uwStates,
|
||||||
/* Where does this constant come from, though? - Per */
|
/* Where does this constant come from, though? - Per */
|
||||||
if ((UDWORD)psFrames==0xcdcdcdcd)
|
if ((UDWORD)psFrames==0xcdcdcdcd)
|
||||||
{
|
{
|
||||||
printf("bad pointer in Create 3D !!!! -[%s]\n", szPieFileName);
|
debug( LOG_ERROR, "bad pointer in Create 3D !!!! -[%s]\n", szPieFileName );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
uwFrames++;
|
uwFrames++;
|
||||||
|
|
|
@ -309,7 +309,7 @@ iBool iV_IMDSave(STRING *filename, iIMDShape *s, BOOL PieIMD)
|
||||||
if (poly->flags & iV_IMD_TEXANIM) {
|
if (poly->flags & iV_IMD_TEXANIM) {
|
||||||
|
|
||||||
if (poly->pTexAnim == NULL) {
|
if (poly->pTexAnim == NULL) {
|
||||||
printf("No TexAnim pointer!\n");
|
debug( LOG_3D, "No TexAnim pointer!\n" );
|
||||||
} else {
|
} else {
|
||||||
fprintf(fp," %d %d %d %d",
|
fprintf(fp," %d %d %d %d",
|
||||||
poly->pTexAnim->nFrames,
|
poly->pTexAnim->nFrames,
|
||||||
|
|
|
@ -45,13 +45,13 @@ BOOL check_extension(const char* extension_name) {
|
||||||
|
|
||||||
if ( extension_name_length == first_extension_length
|
if ( extension_name_length == first_extension_length
|
||||||
&& strncmp(extension_name, tmp, first_extension_length) == 0) {
|
&& strncmp(extension_name, tmp, first_extension_length) == 0) {
|
||||||
printf("%s is supported.\n", extension_name);
|
debug( LOG_3D, "%s is supported.\n", extension_name );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
tmp += first_extension_length + 1;
|
tmp += first_extension_length + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%s is not supported.\n", extension_name);
|
debug( LOG_3D, "%s is not supported.\n", extension_name );
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ iBool iV_VideoMemoryLock(int mode)
|
||||||
_VIDEO_SIZE = size;
|
_VIDEO_SIZE = size;
|
||||||
_VIDEO_LOCK = TRUE;
|
_VIDEO_LOCK = TRUE;
|
||||||
|
|
||||||
printf("vid[VideoMemoryLock] = locked %dK of video memory\n",size/1024);
|
debug( LOG_3D, "vid[VideoMemoryLock] = locked %dK of video memory\n", size/1024 );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,7 @@ BOOL screenInitialise( UDWORD width, // Display width
|
||||||
exit( 1 );
|
exit( 1 );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
debug( LOG_ERROR, "Error: Weird bit depth: %i", bpp );
|
debug( LOG_ERROR, "Error: Unsupported bit depth: %i", bpp );
|
||||||
exit( 1 );
|
exit( 1 );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ BOOL screenInitialise( UDWORD width, // Display width
|
||||||
|
|
||||||
screen = SDL_SetVideoMode(width, height, bpp, video_flags);
|
screen = SDL_SetVideoMode(width, height, bpp, video_flags);
|
||||||
if (!screen) {
|
if (!screen) {
|
||||||
printf("Error: SDL_SetVideoMode failed (%s).\n", SDL_GetError());
|
debug( LOG_ERROR, "Error: SDL_SetVideoMode failed (%s).\n", SDL_GetError() );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -615,7 +615,7 @@ void screenDoDumpToDiskIfRequired()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Saving screenshot %s\n", screendump_filename);
|
debug( LOG_3D, "Saving screenshot %s\n", screendump_filename );
|
||||||
|
|
||||||
cinfo.err = jpeg_std_error(&jerr);
|
cinfo.err = jpeg_std_error(&jerr);
|
||||||
jpeg_create_compress(&cinfo);
|
jpeg_create_compress(&cinfo);
|
||||||
|
|
|
@ -146,11 +146,7 @@ BOOL NET_recvMessage(NETBUFSOCKET* bs, NETMSG* pMsg)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NET_DEBUG
|
debug( LOG_NET, "NETrecvMessage: received message of type %i and size %i.\n", message->type, message->size );
|
||||||
printf("NETrecvMessage: received message of type %i and size %i.\n",
|
|
||||||
message->type,
|
|
||||||
message->size);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
memcpy(pMsg, message, size);
|
memcpy(pMsg, message, size);
|
||||||
bs->buffer_start += size;
|
bs->buffer_start += size;
|
||||||
|
@ -490,7 +486,7 @@ BOOL NETinit(BOOL bFirstCall)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SDLNet_Init() == -1) {
|
if (SDLNet_Init() == -1) {
|
||||||
printf("SDLNet_Init: %s\n", SDLNet_GetError());
|
debug( LOG_ERROR, "SDLNet_Init: %s\n", SDLNet_GetError() );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,9 +520,8 @@ HRESULT NETclose(VOID)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
#ifdef NET_DEBUG
|
debug( LOG_NET, "NETclose\n" );
|
||||||
printf("NETclose\n");
|
|
||||||
#endif
|
|
||||||
NEThaltJoining();
|
NEThaltJoining();
|
||||||
is_server=FALSE;
|
is_server=FALSE;
|
||||||
|
|
||||||
|
@ -662,11 +657,10 @@ UDWORD NETgetRecentPacketsRecvd(VOID)
|
||||||
// Send a message to a player, option to guarantee message
|
// Send a message to a player, option to guarantee message
|
||||||
BOOL NETsend(NETMSG *msg, DPID player, BOOL guarantee)
|
BOOL NETsend(NETMSG *msg, DPID player, BOOL guarantee)
|
||||||
{
|
{
|
||||||
#ifdef NET_DEBUG
|
|
||||||
printf("NETsend\n");
|
|
||||||
#endif
|
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
|
|
||||||
|
debug( LOG_NET, "NETsend\n" );
|
||||||
|
|
||||||
if(!NetPlay.bComms)
|
if(!NetPlay.bComms)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -710,11 +704,10 @@ printf("NETsend\n");
|
||||||
// broadcast a message to all players.
|
// broadcast a message to all players.
|
||||||
BOOL NETbcast(NETMSG *msg, BOOL guarantee)
|
BOOL NETbcast(NETMSG *msg, BOOL guarantee)
|
||||||
{
|
{
|
||||||
#ifdef NET_DEBUG
|
|
||||||
printf("NETbcast\n");
|
|
||||||
#endif
|
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
|
|
||||||
|
debug( LOG_NET, "NETbcast\n" );
|
||||||
|
|
||||||
if(!NetPlay.bComms)
|
if(!NetPlay.bComms)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -759,9 +752,8 @@ printf("NETbcast\n");
|
||||||
// Check if a message is a system message
|
// Check if a message is a system message
|
||||||
BOOL NETprocessSystemMessage(NETMSG * pMsg)
|
BOOL NETprocessSystemMessage(NETMSG * pMsg)
|
||||||
{
|
{
|
||||||
#ifdef NET_DEBUG
|
debug( LOG_NET, "NETprocessSystemMessage\n" );
|
||||||
printf("NETprocessSystemMessage\n");
|
|
||||||
#endif
|
|
||||||
switch (pMsg->type) {
|
switch (pMsg->type) {
|
||||||
case MSG_PLAYER_INFO: {
|
case MSG_PLAYER_INFO: {
|
||||||
NET_PLAYER* pi = (NET_PLAYER*)(pMsg->body);
|
NET_PLAYER* pi = (NET_PLAYER*)(pMsg->body);
|
||||||
|
@ -962,9 +954,8 @@ receive_message:
|
||||||
|
|
||||||
BOOL NETsetupTCPIP(LPVOID *addr, char * machine)
|
BOOL NETsetupTCPIP(LPVOID *addr, char * machine)
|
||||||
{
|
{
|
||||||
#ifdef NET_DEBUG
|
debug( LOG_NET, "NETsetupTCPIP\n" );
|
||||||
printf("NETsetupTCPIP\n");
|
|
||||||
#endif
|
|
||||||
if ( hostname != NULL
|
if ( hostname != NULL
|
||||||
&& hostname != master_server) {
|
&& hostname != master_server) {
|
||||||
free(hostname);
|
free(hostname);
|
||||||
|
@ -1113,18 +1104,14 @@ void NETregisterServer(int state) {
|
||||||
switch(state) {
|
switch(state) {
|
||||||
case 1: {
|
case 1: {
|
||||||
if(SDLNet_ResolveHost(&ip, master_server, MASTER_SERVER_PORT) == -1) {
|
if(SDLNet_ResolveHost(&ip, master_server, MASTER_SERVER_PORT) == -1) {
|
||||||
printf("NETregisterServer: couldn't resolve master server (%s): %s\n",
|
debug( LOG_ERROR, "NETregisterServer: couldn't resolve master server (%s): %s\n", master_server, SDLNet_GetError() );
|
||||||
master_server,
|
|
||||||
SDLNet_GetError());
|
|
||||||
server_not_there = 1;
|
server_not_there = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!rs_socket) rs_socket = SDLNet_TCP_Open(&ip);
|
if(!rs_socket) rs_socket = SDLNet_TCP_Open(&ip);
|
||||||
if(rs_socket == NULL) {
|
if(rs_socket == NULL) {
|
||||||
printf("NETregisterServer: Cannot connect to master server (%s): %s\n",
|
debug( LOG_ERROR, "NETregisterServer: Cannot connect to master server (%s): %s\n", master_server, SDLNet_GetError() );
|
||||||
master_server,
|
|
||||||
SDLNet_GetError());
|
|
||||||
server_not_there = 1;
|
server_not_there = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1159,8 +1146,7 @@ void NETallowJoining() {
|
||||||
if (tmp_socket_set == NULL) {
|
if (tmp_socket_set == NULL) {
|
||||||
tmp_socket_set = SDLNet_AllocSocketSet(MAX_TMP_SOCKETS+1);
|
tmp_socket_set = SDLNet_AllocSocketSet(MAX_TMP_SOCKETS+1);
|
||||||
if (tmp_socket_set == NULL) {
|
if (tmp_socket_set == NULL) {
|
||||||
printf("Couldn't create socket set: %s\n",
|
debug( LOG_ERROR, "Couldn't create socket set: %s\n", SDLNet_GetError() );
|
||||||
SDLNet_GetError());
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SDLNet_TCP_AddSocket(tmp_socket_set, tcp_socket);
|
SDLNet_TCP_AddSocket(tmp_socket_set, tcp_socket);
|
||||||
|
@ -1249,12 +1235,11 @@ BOOL NEThostGame(LPSTR SessionName, LPSTR PlayerName,
|
||||||
DWORD one, DWORD two, DWORD three, DWORD four,
|
DWORD one, DWORD two, DWORD three, DWORD four,
|
||||||
UDWORD plyrs) // # of players.
|
UDWORD plyrs) // # of players.
|
||||||
{
|
{
|
||||||
#ifdef NET_DEBUG
|
|
||||||
printf("NEThostGame\n");
|
|
||||||
#endif
|
|
||||||
IPaddress ip;
|
IPaddress ip;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
debug( LOG_NET, "NEThostGame\n" );
|
||||||
|
|
||||||
if(!NetPlay.bComms)
|
if(!NetPlay.bComms)
|
||||||
{
|
{
|
||||||
NetPlay.dpidPlayer = 1;
|
NetPlay.dpidPlayer = 1;
|
||||||
|
@ -1264,8 +1249,7 @@ printf("NEThostGame\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SDLNet_ResolveHost(&ip, NULL, WARZONE_NET_PORT) == -1) {
|
if(SDLNet_ResolveHost(&ip, NULL, WARZONE_NET_PORT) == -1) {
|
||||||
printf("NEThostGame: couldn't resolve master self: %s\n",
|
debug( LOG_ERROR, "NEThostGame: couldn't resolve master self: %s\n", SDLNet_GetError() );
|
||||||
SDLNet_GetError());
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1277,8 +1261,7 @@ printf("NEThostGame\n");
|
||||||
|
|
||||||
if(!socket_set) socket_set = SDLNet_AllocSocketSet(MAX_CONNECTED_PLAYERS);
|
if(!socket_set) socket_set = SDLNet_AllocSocketSet(MAX_CONNECTED_PLAYERS);
|
||||||
if (socket_set == NULL) {
|
if (socket_set == NULL) {
|
||||||
printf("Couldn't create socket set: %s\n",
|
debug( LOG_ERROR, "Couldn't create socket set: %s\n", SDLNet_GetError() );
|
||||||
SDLNet_GetError());
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
for (i = 0; i < MAX_CONNECTED_PLAYERS; ++i) {
|
for (i = 0; i < MAX_CONNECTED_PLAYERS; ++i) {
|
||||||
|
@ -1318,9 +1301,8 @@ printf("NEThostGame\n");
|
||||||
// Stop the dplay interface from accepting more players.
|
// Stop the dplay interface from accepting more players.
|
||||||
BOOL NEThaltJoining(VOID)
|
BOOL NEThaltJoining(VOID)
|
||||||
{
|
{
|
||||||
#ifdef NET_DEBUG
|
debug( LOG_NET, "NEThaltJoining\n" );
|
||||||
printf("NEThaltJoining\n");
|
|
||||||
#endif
|
|
||||||
allow_joining = FALSE;
|
allow_joining = FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1332,14 +1314,12 @@ printf("NEThaltJoining\n");
|
||||||
BOOL NETfindGame(BOOL async) /// may (not) want to use async here...
|
BOOL NETfindGame(BOOL async) /// may (not) want to use async here...
|
||||||
{
|
{
|
||||||
static UDWORD gamecount = 0, gamesavailable;
|
static UDWORD gamecount = 0, gamesavailable;
|
||||||
|
|
||||||
#ifdef NET_DEBUG
|
|
||||||
printf("NETfindGame\n");
|
|
||||||
#endif
|
|
||||||
IPaddress ip;
|
IPaddress ip;
|
||||||
char buffer[sizeof(GAMESTRUCT)*2];
|
char buffer[sizeof(GAMESTRUCT)*2];
|
||||||
GAMESTRUCT* tmpgame = (GAMESTRUCT*)buffer;
|
GAMESTRUCT* tmpgame = (GAMESTRUCT*)buffer;
|
||||||
|
|
||||||
|
debug( LOG_NET, "NETfindGame\n" );
|
||||||
|
|
||||||
gamecount = 0;
|
gamecount = 0;
|
||||||
NetPlay.games[0].desc.dwSize = 0;
|
NetPlay.games[0].desc.dwSize = 0;
|
||||||
NetPlay.games[0].desc.dwCurrentPlayers = 0;
|
NetPlay.games[0].desc.dwCurrentPlayers = 0;
|
||||||
|
@ -1354,9 +1334,7 @@ printf("NETfindGame\n");
|
||||||
|
|
||||||
if (SDLNet_ResolveHost(&ip, hostname, (hostname == master_server) ? MASTER_SERVER_PORT
|
if (SDLNet_ResolveHost(&ip, hostname, (hostname == master_server) ? MASTER_SERVER_PORT
|
||||||
: WARZONE_NET_PORT) == -1) {
|
: WARZONE_NET_PORT) == -1) {
|
||||||
printf("NETfindGame: couldn't resolve hostname (%s): %s\n",
|
debug( LOG_ERROR, "NETfindGame: couldn't resolve hostname (%s): %s\n", hostname, SDLNet_GetError() );
|
||||||
hostname,
|
|
||||||
SDLNet_GetError());
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1366,14 +1344,13 @@ printf("NETfindGame\n");
|
||||||
|
|
||||||
tcp_socket = SDLNet_TCP_Open(&ip);
|
tcp_socket = SDLNet_TCP_Open(&ip);
|
||||||
if (tcp_socket == NULL) {
|
if (tcp_socket == NULL) {
|
||||||
printf("SDLNet_TCP_Open: %s\n", SDLNet_GetError());
|
debug( LOG_ERROR, "SDLNet_TCP_Open: %s\n", SDLNet_GetError() );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
socket_set = SDLNet_AllocSocketSet(1);
|
socket_set = SDLNet_AllocSocketSet(1);
|
||||||
if (socket_set == NULL) {
|
if (socket_set == NULL) {
|
||||||
printf("Couldn't create socket set: %s\n",
|
debug( LOG_ERROR, "Couldn't create socket set: %s\n", SDLNet_GetError() );
|
||||||
SDLNet_GetError());
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
SDLNet_TCP_AddSocket(socket_set, tcp_socket);
|
SDLNet_TCP_AddSocket(socket_set, tcp_socket);
|
||||||
|
@ -1386,9 +1363,7 @@ printf("NETfindGame\n");
|
||||||
gamesavailable=(UDWORD)buffer[0];
|
gamesavailable=(UDWORD)buffer[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NET_DEBUG
|
debug( LOG_NET, "receiving info of %d game(s)\n", gamesavailable );
|
||||||
printf("receiving info of %d game(s)\n", gamesavailable);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if ( SDLNet_CheckSockets(socket_set, 1000) > 0
|
if ( SDLNet_CheckSockets(socket_set, 1000) > 0
|
||||||
|
@ -1424,14 +1399,12 @@ printf("NETfindGame\n");
|
||||||
// Functions used to setup and join games.
|
// Functions used to setup and join games.
|
||||||
BOOL NETjoinGame(UDWORD gameNumber, LPSTR playername)
|
BOOL NETjoinGame(UDWORD gameNumber, LPSTR playername)
|
||||||
{
|
{
|
||||||
#ifdef NET_DEBUG
|
|
||||||
printf("NETjoinGame gameNumber=%d\n", gameNumber);
|
|
||||||
#endif
|
|
||||||
char* name;
|
char* name;
|
||||||
IPaddress ip;
|
IPaddress ip;
|
||||||
char buffer[sizeof(GAMESTRUCT)*2];
|
char buffer[sizeof(GAMESTRUCT)*2];
|
||||||
GAMESTRUCT* tmpgame = (GAMESTRUCT*)buffer;
|
GAMESTRUCT* tmpgame = (GAMESTRUCT*)buffer;
|
||||||
|
|
||||||
|
debug( LOG_NET, "NETjoinGame gameNumber=%d\n", gameNumber );
|
||||||
|
|
||||||
NETclose(); // just to be sure :)
|
NETclose(); // just to be sure :)
|
||||||
|
|
||||||
|
@ -1441,9 +1414,7 @@ printf("NETjoinGame gameNumber=%d\n", gameNumber);
|
||||||
hostname = strdup(NetPlay.games[gameNumber].desc.host);
|
hostname = strdup(NetPlay.games[gameNumber].desc.host);
|
||||||
|
|
||||||
if(SDLNet_ResolveHost(&ip, hostname, WARZONE_NET_PORT) == -1) {
|
if(SDLNet_ResolveHost(&ip, hostname, WARZONE_NET_PORT) == -1) {
|
||||||
printf("NETjoinGame: couldn't resolve hostname (%s): %s\n",
|
debug( LOG_ERROR, "NETjoinGame: couldn't resolve hostname (%s): %s\n", hostname, SDLNet_GetError() );
|
||||||
hostname,
|
|
||||||
SDLNet_GetError());
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1453,14 +1424,13 @@ printf("NETjoinGame gameNumber=%d\n", gameNumber);
|
||||||
|
|
||||||
tcp_socket = SDLNet_TCP_Open(&ip);
|
tcp_socket = SDLNet_TCP_Open(&ip);
|
||||||
if (tcp_socket == NULL) {
|
if (tcp_socket == NULL) {
|
||||||
printf("SDLNet_TCP_Open: %s\n", SDLNet_GetError());
|
debug( LOG_ERROR, "SDLNet_TCP_Open: %s\n", SDLNet_GetError() );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
socket_set = SDLNet_AllocSocketSet(1);
|
socket_set = SDLNet_AllocSocketSet(1);
|
||||||
if (socket_set == NULL) {
|
if (socket_set == NULL) {
|
||||||
printf("Couldn't create socket set: %s\n",
|
debug( LOG_ERROR, "Couldn't create socket set: %s\n", SDLNet_GetError() );
|
||||||
SDLNet_GetError());
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
SDLNet_TCP_AddSocket(socket_set, tcp_socket);
|
SDLNet_TCP_AddSocket(socket_set, tcp_socket);
|
||||||
|
|
|
@ -143,7 +143,7 @@ rpl_open(char* filename) {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
rpl->sound_decoder = rpl_decode_sound_unknown;
|
rpl->sound_decoder = rpl_decode_sound_unknown;
|
||||||
printf("Unknown sound format %i\n", tmp);
|
debug( LOG_VIDEO, "Unknown sound format %i\n", tmp );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
rpl->current_sound_frame = 0;
|
rpl->current_sound_frame = 0;
|
||||||
|
@ -191,7 +191,7 @@ rpl_open(char* filename) {
|
||||||
for (i = 0; i < rpl->nb_chunks; ++i) {
|
for (i = 0; i < rpl->nb_chunks; ++i) {
|
||||||
readline(f, buf, len);
|
readline(f, buf, len);
|
||||||
if (sscanf(buf, "%i,%i;%i", &rpl->chunks[i].offset, &rpl->chunks[i].video_size, &rpl->chunks[i].audio_size) != 3) {
|
if (sscanf(buf, "%i,%i;%i", &rpl->chunks[i].offset, &rpl->chunks[i].video_size, &rpl->chunks[i].audio_size) != 3) {
|
||||||
printf("Error in chunk catalog\n");
|
debug( LOG_VIDEO, "Error in chunk catalog\n" );
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ unsigned int rpl_decode_sound_unknown(RPL* rpl, short* buffer, unsigned int buff
|
||||||
char* tmp;
|
char* tmp;
|
||||||
PHYSFS_file * out;
|
PHYSFS_file * out;
|
||||||
|
|
||||||
printf("Saving unknown sound stream to file\n");
|
debug( LOG_VIDEO, "Saving unknown sound stream to file\n" );
|
||||||
for (i = 0; i < rpl->nb_chunks; ++i) {
|
for (i = 0; i < rpl->nb_chunks; ++i) {
|
||||||
total_audio_size += rpl->chunks[i].audio_size;
|
total_audio_size += rpl->chunks[i].audio_size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ void seq_start_sound(RPL* s) {
|
||||||
BOOL seq_SetSequenceForBuffer(char* filename, int startTime, PERF_MODE perfMode)
|
BOOL seq_SetSequenceForBuffer(char* filename, int startTime, PERF_MODE perfMode)
|
||||||
{
|
{
|
||||||
#ifdef DUMMY_VIDEO
|
#ifdef DUMMY_VIDEO
|
||||||
printf("seq_SetSequenceForBuffer %s -> novideo.rpl\n", filename);
|
debug( LOG_VIDEO, "seq_SetSequenceForBuffer %s -> novideo.rpl\n", filename );
|
||||||
filename = "novideo.rpl";
|
filename = "novideo.rpl";
|
||||||
#endif
|
#endif
|
||||||
if (current_sequence != NULL) {
|
if (current_sequence != NULL) {
|
||||||
|
@ -86,7 +86,7 @@ BOOL seq_SetSequenceForBuffer(char* filename, int startTime, PERF_MODE perfMode)
|
||||||
BOOL seq_SetSequence(char* filename, int startTime, char* lpBF, PERF_MODE perfMode)
|
BOOL seq_SetSequence(char* filename, int startTime, char* lpBF, PERF_MODE perfMode)
|
||||||
{
|
{
|
||||||
#ifdef DUMMY_VIDEO
|
#ifdef DUMMY_VIDEO
|
||||||
printf("seq_SetSequence %s -> novideo.rpl\n", filename);
|
debug( LOG_VIDEO, "seq_SetSequence %s -> novideo.rpl\n", filename );
|
||||||
filename = "novideo.rpl";
|
filename = "novideo.rpl";
|
||||||
#endif
|
#endif
|
||||||
if (current_sequence != NULL) {
|
if (current_sequence != NULL) {
|
||||||
|
@ -104,7 +104,7 @@ BOOL seq_SetSequence(char* filename, int startTime, char* lpBF, PERF_MODE perfMo
|
||||||
|
|
||||||
int seq_ClearMovie(void)
|
int seq_ClearMovie(void)
|
||||||
{
|
{
|
||||||
printf("seq_ClearMovie\n");
|
debug( LOG_VIDEO, "seq_ClearMovie\n" );
|
||||||
if (current_sequence != NULL) {
|
if (current_sequence != NULL) {
|
||||||
rpl_close(current_sequence);
|
rpl_close(current_sequence);
|
||||||
current_sequence = NULL;
|
current_sequence = NULL;
|
||||||
|
@ -162,7 +162,7 @@ BOOL seq_RefreshVideoBuffers(void)
|
||||||
|
|
||||||
BOOL seq_ShutDown(void)
|
BOOL seq_ShutDown(void)
|
||||||
{
|
{
|
||||||
printf("seq_ShutDown\n");
|
debug( LOG_VIDEO, "seq_ShutDown\n" );
|
||||||
if (current_sequence != NULL) {
|
if (current_sequence != NULL) {
|
||||||
if (seq_sound == TRUE) {
|
if (seq_sound == TRUE) {
|
||||||
alSourceStop(seq_source);
|
alSourceStop(seq_source);
|
||||||
|
|
|
@ -438,7 +438,7 @@ BOOL gwGenerateLinkGates(void)
|
||||||
ASSERT( apEquivZones != NULL,
|
ASSERT( apEquivZones != NULL,
|
||||||
"gwGenerateLinkGates: no zone equivalence table" );
|
"gwGenerateLinkGates: no zone equivalence table" );
|
||||||
|
|
||||||
debug( LOG_ERROR, "Generating water link Gateways...." );
|
debug( LOG_NEVER, "Generating water link Gateways...." );
|
||||||
|
|
||||||
for(zone=1; zone<gwNumZones; zone += 1)
|
for(zone=1; zone<gwNumZones; zone += 1)
|
||||||
{
|
{
|
||||||
|
@ -459,7 +459,7 @@ BOOL gwGenerateLinkGates(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
debug( LOG_ERROR, "Done\n" );
|
debug( LOG_NEVER, "Done\n" );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3587,13 +3587,13 @@ void moveUpdateGroundModel(DROID *psDroid, SDWORD speed, SDWORD direction)
|
||||||
droidGetNaybors(psDroid);
|
droidGetNaybors(psDroid);
|
||||||
|
|
||||||
#ifdef DEBUG_DRIVE_SPEED
|
#ifdef DEBUG_DRIVE_SPEED
|
||||||
if(psDroid == driveGetDriven()) printf("%d ",speed);
|
if(psDroid == driveGetDriven()) debug( LOG_NEVER, "%d ", speed );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
moveCheckFinalWaypoint( psDroid, &speed );
|
moveCheckFinalWaypoint( psDroid, &speed );
|
||||||
|
|
||||||
#ifdef DEBUG_DRIVE_SPEED
|
#ifdef DEBUG_DRIVE_SPEED
|
||||||
if(psDroid == driveGetDriven()) printf("%d ",speed);
|
if(psDroid == driveGetDriven()) debug( LOG_NEVER, "%d ", speed );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// moveUpdateDroidDirection( psDroid, &speed, direction, TRACKED_SPIN_ANGLE,
|
// moveUpdateDroidDirection( psDroid, &speed, direction, TRACKED_SPIN_ANGLE,
|
||||||
|
@ -3602,7 +3602,7 @@ if(psDroid == driveGetDriven()) printf("%d ",speed);
|
||||||
spinSpeed, turnSpeed, &iDroidDir, &fSpeed );
|
spinSpeed, turnSpeed, &iDroidDir, &fSpeed );
|
||||||
|
|
||||||
#ifdef DEBUG_DRIVE_SPEED
|
#ifdef DEBUG_DRIVE_SPEED
|
||||||
if(psDroid == driveGetDriven()) printf("%d ",speed);
|
if(psDroid == driveGetDriven()) debug( LOG_NEVER, "%d ", speed );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fNormalSpeed = moveCalcNormalSpeed( psDroid, fSpeed, iDroidDir,
|
fNormalSpeed = moveCalcNormalSpeed( psDroid, fSpeed, iDroidDir,
|
||||||
|
@ -3613,7 +3613,7 @@ if(psDroid == driveGetDriven()) printf("%d ",speed);
|
||||||
fPerpSpeed, iDroidDir );
|
fPerpSpeed, iDroidDir );
|
||||||
|
|
||||||
#ifdef DEBUG_DRIVE_SPEED
|
#ifdef DEBUG_DRIVE_SPEED
|
||||||
if(psDroid == driveGetDriven()) printf("%d\n",speed);
|
if(psDroid == driveGetDriven()) debug( LOG_NEVER, "%d\n", speed );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// if (psDroid->direction != psDroid->sMove.dir)
|
// if (psDroid->direction != psDroid->sMove.dir)
|
||||||
|
|
Loading…
Reference in New Issue