diff --git a/nq/source/console.c b/nq/source/console.c index 4670c176d..1e865dfd7 100644 --- a/nq/source/console.c +++ b/nq/source/console.c @@ -269,9 +269,11 @@ Con_Print (const char *txt) { int mask, c, l, y; static int cr; + const char *s; // echo to debugging console - Sys_Printf ("%s", txt); + for (s = txt; *s; s++) + fputc (sys_char_map[(byte)*s], stdout); // log all messages to file if (con_debuglog) diff --git a/nq/source/host.c b/nq/source/host.c index 23c854d0a..87fc967ad 100644 --- a/nq/source/host.c +++ b/nq/source/host.c @@ -385,7 +385,7 @@ SV_DropClient (qboolean crash) *sv_globals.self = saveSelf; } - Sys_Printf ("Client %s removed\n", host_client->name); + Con_Printf ("Client %s removed\n", host_client->name); } // break the net connection NET_Close (host_client->netconnection); @@ -998,7 +998,7 @@ Host_Init (quakeparms_t *parms) host_initialized = true; - Sys_Printf ("========Quake Initialized=========\n"); + Con_Printf ("========Quake Initialized=========\n"); CL_UpdateScreen (cl.time); } diff --git a/nq/source/host_cmd.c b/nq/source/host_cmd.c index 87eede1e1..d00d5b6ef 100644 --- a/nq/source/host_cmd.c +++ b/nq/source/host_cmd.c @@ -774,7 +774,7 @@ Host_Say (qboolean teamonly) } host_client = save; - Sys_Printf ("%s", &text[1]); + Con_Printf ("%s", &text[1]); } @@ -974,7 +974,7 @@ Host_Spawn_f (void) sv_funcs.ClientConnect); if ((Sys_DoubleTime () - host_client->netconnection->connecttime) <= - sv.time) Sys_Printf ("%s entered the game\n", host_client->name); + sv.time) Con_Printf ("%s entered the game\n", host_client->name); PR_ExecuteProgram (&sv_pr_state, sv_funcs.PutClientInServer); diff --git a/nq/source/sv_user.c b/nq/source/sv_user.c index 91c8c1800..50fc56e48 100644 --- a/nq/source/sv_user.c +++ b/nq/source/sv_user.c @@ -454,7 +454,7 @@ SV_ReadClientMessage (void) nextmsg: ret = NET_GetMessage (host_client->netconnection); if (ret == -1) { - Sys_Printf ("SV_ReadClientMessage: NET_GetMessage failed\n"); + Con_Printf ("SV_ReadClientMessage: NET_GetMessage failed\n"); return false; } if (!ret) @@ -467,7 +467,7 @@ SV_ReadClientMessage (void) return false; // a command caused an error if (net_message->badread) { - Sys_Printf ("SV_ReadClientMessage: badread\n"); + Con_Printf ("SV_ReadClientMessage: badread\n"); return false; } @@ -478,11 +478,11 @@ SV_ReadClientMessage (void) goto nextmsg; // end of message default: - Sys_Printf ("SV_ReadClientMessage: unknown command char\n"); + Con_Printf ("SV_ReadClientMessage: unknown command char\n"); return false; case clc_nop: -// Sys_Printf ("clc_nop\n"); +// Con_Printf ("clc_nop\n"); break; case clc_stringcmd: @@ -538,7 +538,7 @@ SV_ReadClientMessage (void) break; case clc_disconnect: -// Sys_Printf ("SV_ReadClientMessage: client disconnected\n"); +// Con_Printf ("SV_ReadClientMessage: client disconnected\n"); return false; case clc_move: diff --git a/nq/source/sys_null.c b/nq/source/sys_null.c deleted file mode 100644 index 39caad3a1..000000000 --- a/nq/source/sys_null.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - sys_null.c - - (description) - - Copyright (C) 1996-1997 Id Software, Inc. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to: - - Free Software Foundation, Inc. - 59 Temple Place - Suite 330 - Boston, MA 02111-1307, USA - - $Id$ -*/ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "errno.h" - -#define MAX_HANDLES 10 - -VFile *sys_handles[MAX_HANDLES]; - - -// VFile IO =================================================================== - -int -findhandle (void) -{ - int i; - - for (i = 1; i < MAX_HANDLES; i++) - if (!sys_handles[i]) - return i; - Sys_Error ("out of handles"); - return -1; -} - -int -filelength (VFile *f) -{ - int pos, end; - - pos = ftell (f); - fseek (f, 0, SEEK_END); - end = ftell (f); - fseek (f, pos, SEEK_SET); - - return end; -} - -int -Sys_FileOpenRead (char *path, int *hndl) -{ - VFile *f; - int i; - - i = findhandle (); - - f = Qopen (path, "rb"); - if (!f) { - *hndl = -1; - return -1; - } - sys_handles[i] = f; - *hndl = i; - - return filelength (f); -} - -int -Sys_FileOpenWrite (char *path) -{ - VFile *f; - int i; - - i = findhandle (); - - f = Qopen (path, "wb"); - if (!f) - Sys_Error ("Error opening %s: %s", path, strerror (errno)); - sys_handles[i] = f; - - return i; -} - -void -Sys_FileClose (int handle) -{ - Qclose (sys_handles[handle]); - sys_handles[handle] = NULL; -} - -void -Sys_FileSeek (int handle, int position) -{ - fseek (sys_handles[handle], position, SEEK_SET); -} - -int -Sys_FileRead (int handle, void *dest, int count) -{ - return fread (dest, 1, count, sys_handles[handle]); -} - -int -Sys_FileWrite (int handle, void *data, int count) -{ - return fwrite (data, 1, count, sys_handles[handle]); -} - -int -Sys_FileTime (char *path) -{ - VFile *f; - - f = Qopen (path, "rb"); - if (f) { - Qclose (f); - return 1; - } - - return -1; -} - -void -Sys_mkdir (char *path) -{ -} - -// SYSTEM IO ================================================================== - -void -Sys_Error (char *error, ...) -{ - va_list argptr; - - printf ("Sys_Error: "); - va_start (argptr, error); - vprintf (error, argptr); - va_end (argptr); - printf ("\n"); - - exit (1); -} - -void -Sys_Printf (char *fmt, ...) -{ - va_list argptr; - - va_start (argptr, fmt); - vprintf (fmt, argptr); - va_end (argptr); -} - -void -Sys_Quit (void) -{ - exit (0); -} - -double -Sys_DoubleTime (void) -{ - static double t; - - t += 0.1; - - return t; -} - -char * -Sys_ConsoleInput (void) -{ - return NULL; -} - -void -IN_SendKeyEvents (void) -{ -} - -void -Sys_HighFPPrecision (void) -{ -} - -void -Sys_LowFPPrecision (void) -{ -} - -//============================================================================= - -void -main (int argc, char **argv) -{ - static quakeparms_t parms; - - parms.memsize = 8 * 1024 * 1024; - parms.membase = malloc (parms.memsize); - - COM_InitArgv (argc, argv); - - parms.argc = com_argc; - parms.argv = com_argv; - - printf ("Host_Init\n"); - Host_Init (&parms); - while (1) { - Host_Frame (0.1); - } -} diff --git a/nq/source/sys_win.c b/nq/source/sys_win.c index d9c9fa07d..0ffff240c 100644 --- a/nq/source/sys_win.c +++ b/nq/source/sys_win.c @@ -501,7 +501,7 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, // because sound is off until we become active //XXX S_BlockSound (); - Sys_Printf ("Host_Init\n"); + Con_Printf ("Host_Init\n"); Host_Init (&parms); Sys_Init_Cvars (); diff --git a/qw/source/cl_sys_win.c b/qw/source/cl_sys_win.c index 2b767b46c..801238beb 100644 --- a/qw/source/cl_sys_win.c +++ b/qw/source/cl_sys_win.c @@ -409,7 +409,7 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, // because sound is off until we become active // XXX S_BlockSound (); - Sys_Printf ("Host_Init\n"); + Con_Printf ("Host_Init\n"); Host_Init (); oldtime = Sys_DoubleTime (); diff --git a/qw/source/console.c b/qw/source/console.c index 06dfe6508..17145fa67 100644 --- a/qw/source/console.c +++ b/qw/source/console.c @@ -270,9 +270,11 @@ Con_Print (const char *txt) { int mask, c, l, y; static int cr; + const char *s; // echo to debugging console - Sys_Printf ("%s", txt); + for (s = txt; *s; s++) + fputc (sys_char_map[(byte)*s], stdout); // log all messages to file if (con_debuglog) diff --git a/qw/source/net_udp.c b/qw/source/net_udp.c index 242e77df6..dc7c9f8f4 100644 --- a/qw/source/net_udp.c +++ b/qw/source/net_udp.c @@ -276,7 +276,7 @@ NET_GetPacket (void) #endif /* _WIN32 */ if (err == EWOULDBLOCK) return false; - Sys_Printf ("NET_GetPacket: %s\n", strerror (err)); + Con_Printf ("NET_GetPacket: %s\n", strerror (err)); return false; } @@ -337,7 +337,7 @@ NET_SendPacket (int length, void *data, netadr_t to) if (err == EWOULDBLOCK) return; - Sys_Printf ("NET_SendPacket: %s\n", strerror (errno)); + Con_Printf ("NET_SendPacket: %s\n", strerror (errno)); } } diff --git a/qw/source/net_udp6.c b/qw/source/net_udp6.c index b0ed3dcf4..2bca562de 100644 --- a/qw/source/net_udp6.c +++ b/qw/source/net_udp6.c @@ -380,7 +380,7 @@ NET_GetPacket (void) #endif /* _WIN32 */ if (err == EWOULDBLOCK) return false; - Sys_Printf ("NET_GetPacket: %s\n", strerror (err)); + Con_Printf ("NET_GetPacket: %s\n", strerror (err)); return false; } @@ -421,7 +421,7 @@ NET_SendPacket (int length, void *data, netadr_t to) if (err == EWOULDBLOCK) return; - Sys_Printf ("NET_SendPacket: %s\n", strerror (err)); + Con_Printf ("NET_SendPacket: %s\n", strerror (err)); } } diff --git a/qw/source/sv_main.c b/qw/source/sv_main.c index e22a55a4e..efd703ddc 100644 --- a/qw/source/sv_main.c +++ b/qw/source/sv_main.c @@ -1643,7 +1643,7 @@ SV_RestorePenaltyFilter (client_t *cl, filtertype_t type) // search for existing penalty filter of same type for (i = 0; i < numipfilters; i++) { if (type == ipfilters[i].type && SV_IPCompare (ip, ipfilters[i].ip)) { - Sys_Printf ("Penalty restored for user %d\n", cl->userid); + Con_Printf ("Penalty restored for user %d\n", cl->userid); return ipfilters[i].time; } }