r1155 - in branches/unified-sdl/code: client null qcommon server sys
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Tue Sep 4 15:54:11 EDT 2007
Author: tma
Date: 2007-09-04 15:54:11 -0400 (Tue, 04 Sep 2007)
New Revision: 1155
Modified:
branches/unified-sdl/code/client/cl_console.c
branches/unified-sdl/code/client/cl_keys.c
branches/unified-sdl/code/client/cl_main.c
branches/unified-sdl/code/client/cl_scrn.c
branches/unified-sdl/code/client/client.h
branches/unified-sdl/code/null/null_client.c
branches/unified-sdl/code/qcommon/common.c
branches/unified-sdl/code/qcommon/net_ip.c
branches/unified-sdl/code/qcommon/qcommon.h
branches/unified-sdl/code/server/sv_init.c
branches/unified-sdl/code/server/sv_main.c
branches/unified-sdl/code/sys/sys_main.c
branches/unified-sdl/code/sys/sys_unix.c
branches/unified-sdl/code/sys/sys_win32.c
Log:
* Get (client based) dedicated server support working again
+ Remove Sys_ShowConsole
+ Remove com_viewlog
+ Allow the client to remain usable when no ui module is loaded
+ First proper support for non-windows-client-based-dedicated-serving
Modified: branches/unified-sdl/code/client/cl_console.c
===================================================================
--- branches/unified-sdl/code/client/cl_console.c 2007-09-03 19:29:49 UTC (rev 1154)
+++ branches/unified-sdl/code/client/cl_console.c 2007-09-04 19:54:11 UTC (rev 1155)
@@ -71,9 +71,8 @@
================
*/
void Con_ToggleConsole_f (void) {
- // closing a full screen console restarts the demo loop
+ // Can't toggle the console when it's the only thing available
if ( cls.state == CA_DISCONNECTED && cls.keyCatchers == KEYCATCH_CONSOLE ) {
- CL_StartDemoLoop();
return;
}
Modified: branches/unified-sdl/code/client/cl_keys.c
===================================================================
--- branches/unified-sdl/code/client/cl_keys.c 2007-09-03 19:29:49 UTC (rev 1154)
+++ branches/unified-sdl/code/client/cl_keys.c 2007-09-04 19:54:11 UTC (rev 1155)
@@ -1202,7 +1202,7 @@
if ( cls.state == CA_ACTIVE && !clc.demoplaying ) {
VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_INGAME );
}
- else {
+ else if ( cls.state != CA_DISCONNECTED ) {
CL_Disconnect_f();
S_StopAllSounds();
VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_MAIN );
@@ -1217,19 +1217,21 @@
//
// key up events only perform actions if the game key binding is
// a button command (leading + sign). These will be processed even in
- // console mode and menu mode, to keep the character from continuing
+ // console mode and menu mode, to keep the character from continuing
// an action started before a mode switch.
//
- if (!down) {
- kb = keys[key].binding;
+ if (!down ) {
+ if ( cls.state != CA_DISCONNECTED ) {
+ kb = keys[key].binding;
- CL_AddKeyUpCommands( key, kb, time );
+ CL_AddKeyUpCommands( key, kb, time );
- if ( cls.keyCatchers & KEYCATCH_UI && uivm ) {
- VM_Call( uivm, UI_KEY_EVENT, key, down );
- } else if ( cls.keyCatchers & KEYCATCH_CGAME && cgvm ) {
- VM_Call( cgvm, CG_KEY_EVENT, key, down );
- }
+ if ( cls.keyCatchers & KEYCATCH_UI && uivm ) {
+ VM_Call( uivm, UI_KEY_EVENT, key, down );
+ } else if ( cls.keyCatchers & KEYCATCH_CGAME && cgvm ) {
+ VM_Call( cgvm, CG_KEY_EVENT, key, down );
+ }
+ }
return;
}
@@ -1258,7 +1260,7 @@
Com_Printf ("%s is unbound, use controls menu to set.\n"
, Key_KeynumToString( key ) );
}
- } else if (kb[0] == '+') {
+ } else if (kb[0] == '+') {
int i;
char button[1024], *buttonPtr;
buttonPtr = button;
Modified: branches/unified-sdl/code/client/cl_main.c
===================================================================
--- branches/unified-sdl/code/client/cl_main.c 2007-09-03 19:29:49 UTC (rev 1154)
+++ branches/unified-sdl/code/client/cl_main.c 2007-09-04 19:54:11 UTC (rev 1155)
@@ -736,7 +736,7 @@
Hunk_ClearToMark();
}
- CL_StartHunkUsers();
+ CL_StartHunkUsers( qfalse );
}
/*
@@ -749,6 +749,12 @@
=====================
*/
void CL_MapLoading( void ) {
+ if ( com_dedicated->integer ) {
+ cls.state = CA_DISCONNECTED;
+ cls.keyCatchers = KEYCATCH_CONSOLE;
+ return;
+ }
+
if ( !com_cl_running->integer ) {
return;
}
@@ -1350,7 +1356,7 @@
CL_InitRef();
// startup all the client stuff
- CL_StartHunkUsers();
+ CL_StartHunkUsers( qfalse );
// start the cgame if connected
if ( cls.state > CA_CONNECTED && cls.state != CA_CINEMATIC ) {
@@ -2390,7 +2396,7 @@
This is the only place that any of these functions are called from
============================
*/
-void CL_StartHunkUsers( void ) {
+void CL_StartHunkUsers( qboolean rendererOnly ) {
if (!com_cl_running) {
return;
}
@@ -2404,6 +2410,10 @@
CL_InitRenderer();
}
+ if ( rendererOnly ) {
+ return;
+ }
+
if ( !cls.soundStarted ) {
cls.soundStarted = qtrue;
S_Init();
Modified: branches/unified-sdl/code/client/cl_scrn.c
===================================================================
--- branches/unified-sdl/code/client/cl_scrn.c 2007-09-03 19:29:49 UTC (rev 1154)
+++ branches/unified-sdl/code/client/cl_scrn.c 2007-09-04 19:54:11 UTC (rev 1155)
@@ -448,14 +448,9 @@
}
}
- if ( !uivm ) {
- Com_DPrintf("draw screen without UI loaded\n");
- return;
- }
-
// if the menu is going to cover the entire screen, we
// don't need to render anything under it
- if ( !VM_Call( uivm, UI_IS_FULLSCREEN )) {
+ if ( uivm && !VM_Call( uivm, UI_IS_FULLSCREEN )) {
switch( cls.state ) {
default:
Com_Error( ERR_FATAL, "SCR_DrawScreenField: bad cls.state" );
Modified: branches/unified-sdl/code/client/client.h
===================================================================
--- branches/unified-sdl/code/client/client.h 2007-09-03 19:29:49 UTC (rev 1154)
+++ branches/unified-sdl/code/client/client.h 2007-09-04 19:54:11 UTC (rev 1155)
@@ -389,7 +389,7 @@
void CL_ShutdownAll(void);
void CL_AddReliableCommand( const char *cmd );
-void CL_StartHunkUsers( void );
+void CL_StartHunkUsers( qboolean rendererOnly );
void CL_Disconnect_f (void);
void CL_GetChallengePacket (void);
Modified: branches/unified-sdl/code/null/null_client.c
===================================================================
--- branches/unified-sdl/code/null/null_client.c 2007-09-03 19:29:49 UTC (rev 1154)
+++ branches/unified-sdl/code/null/null_client.c 2007-09-04 19:54:11 UTC (rev 1155)
@@ -81,7 +81,7 @@
void CL_FlushMemory( void ) {
}
-void CL_StartHunkUsers( void ) {
+void CL_StartHunkUsers( qboolean rendererOnly ) {
}
void CL_ShutdownAll(void) {}
Modified: branches/unified-sdl/code/qcommon/common.c
===================================================================
--- branches/unified-sdl/code/qcommon/common.c 2007-09-03 19:29:49 UTC (rev 1154)
+++ branches/unified-sdl/code/qcommon/common.c 2007-09-04 19:54:11 UTC (rev 1155)
@@ -56,7 +56,6 @@
fileHandle_t com_journalFile; // events are written here
fileHandle_t com_journalDataFile; // config files are written here
-cvar_t *com_viewlog;
cvar_t *com_speeds;
cvar_t *com_developer;
cvar_t *com_dedicated;
@@ -159,10 +158,9 @@
return;
}
- // echo to console if we're not a dedicated server
- if ( com_dedicated && !com_dedicated->integer ) {
- CL_ConsolePrint( msg );
- }
+#ifndef DEDICATED
+ CL_ConsolePrint( msg );
+#endif
// echo to dedicated console and early console
Sys_Print( msg );
@@ -2449,7 +2447,6 @@
com_fixedtime = Cvar_Get ("fixedtime", "0", CVAR_CHEAT);
com_showtrace = Cvar_Get ("com_showtrace", "0", CVAR_CHEAT);
com_dropsim = Cvar_Get ("com_dropsim", "0", CVAR_CHEAT);
- com_viewlog = Cvar_Get( "viewlog", "0", CVAR_CHEAT );
com_speeds = Cvar_Get ("com_speeds", "0", 0);
com_timedemo = Cvar_Get ("timedemo", "0", CVAR_CHEAT);
com_cameraMode = Cvar_Get ("com_cameraMode", "0", CVAR_CHEAT);
@@ -2465,12 +2462,6 @@
com_introPlayed = Cvar_Get( "com_introplayed", "0", CVAR_ARCHIVE);
- if ( com_dedicated->integer ) {
- if ( !com_viewlog->integer ) {
- Cvar_Set( "viewlog", "1" );
- }
- }
-
if ( com_developer && com_developer->integer ) {
Cmd_AddCommand ("error", Com_Error_f);
Cmd_AddCommand ("crash", Com_Crash_f );
@@ -2489,10 +2480,9 @@
SV_Init();
com_dedicated->modified = qfalse;
- if ( !com_dedicated->integer ) {
- CL_Init();
- Sys_ShowConsole( com_viewlog->integer, qfalse );
- }
+#ifndef DEDICATED
+ CL_Init();
+#endif
// set com_frameTime so that if a map is started on the
// command line it will still be able to count on com_frameTime
@@ -2514,7 +2504,7 @@
// start in full screen ui mode
Cvar_Set("r_uiFullScreen", "1");
- CL_StartHunkUsers();
+ CL_StartHunkUsers( qfalse );
// make sure single player is off by default
Cvar_Set("ui_singlePlayerActive", "0");
@@ -2694,14 +2684,6 @@
// write config file if anything changed
Com_WriteConfiguration();
- // if "viewlog" has been modified, show or hide the log console
- if ( com_viewlog->modified ) {
- if ( !com_dedicated->value ) {
- Sys_ShowConsole( com_viewlog->integer, qfalse );
- }
- com_viewlog->modified = qfalse;
- }
-
//
// main event loop
//
@@ -2754,42 +2736,39 @@
Cvar_Get( "dedicated", "0", 0 );
com_dedicated->modified = qfalse;
if ( !com_dedicated->integer ) {
- CL_Init();
- Sys_ShowConsole( com_viewlog->integer, qfalse );
- } else {
- CL_Shutdown();
- Sys_ShowConsole( 1, qtrue );
+ SV_Shutdown( "dedicated set to 0" );
+ CL_FlushMemory();
}
}
+#ifndef DEDICATED
//
// client system
//
- if ( !com_dedicated->integer ) {
- //
- // run event loop a second time to get server to client packets
- // without a frame of latency
- //
- if ( com_speeds->integer ) {
- timeBeforeEvents = Sys_Milliseconds ();
- }
- Com_EventLoop();
- Cbuf_Execute ();
+ //
+ // run event loop a second time to get server to client packets
+ // without a frame of latency
+ //
+ if ( com_speeds->integer ) {
+ timeBeforeEvents = Sys_Milliseconds ();
+ }
+ Com_EventLoop();
+ Cbuf_Execute ();
- //
- // client side
- //
- if ( com_speeds->integer ) {
- timeBeforeClient = Sys_Milliseconds ();
- }
+ //
+ // client side
+ //
+ if ( com_speeds->integer ) {
+ timeBeforeClient = Sys_Milliseconds ();
+ }
- CL_Frame( msec );
+ CL_Frame( msec );
- if ( com_speeds->integer ) {
- timeAfter = Sys_Milliseconds ();
- }
+ if ( com_speeds->integer ) {
+ timeAfter = Sys_Milliseconds ();
}
+#endif
//
// report timing information
Modified: branches/unified-sdl/code/qcommon/net_ip.c
===================================================================
--- branches/unified-sdl/code/qcommon/net_ip.c 2007-09-03 19:29:49 UTC (rev 1154)
+++ branches/unified-sdl/code/qcommon/net_ip.c 2007-09-04 19:54:11 UTC (rev 1155)
@@ -1026,7 +1026,7 @@
====================
NET_Sleep
-Sleeps msec or until net socket is ready
+Sleeps msec or until something happens on the network or stdin
====================
*/
void NET_Sleep( int msec ) {
@@ -1038,6 +1038,10 @@
return; // we're not a server, just run full speed
FD_ZERO(&fdset);
+
+ FD_SET(fileno(stdin), &fdset);
+ highestfd = fileno(stdin) + 1;
+
if(ip_socket)
{
FD_SET(ip_socket, &fdset); // network socket
Modified: branches/unified-sdl/code/qcommon/qcommon.h
===================================================================
--- branches/unified-sdl/code/qcommon/qcommon.h 2007-09-03 19:29:49 UTC (rev 1154)
+++ branches/unified-sdl/code/qcommon/qcommon.h 2007-09-04 19:54:11 UTC (rev 1155)
@@ -746,7 +746,6 @@
extern cvar_t *com_timescale;
extern cvar_t *com_sv_running;
extern cvar_t *com_cl_running;
-extern cvar_t *com_viewlog; // 0 = hidden, 1 = visible, 2 = minimized
extern cvar_t *com_version;
extern cvar_t *com_blood;
extern cvar_t *com_buildScript; // for building release pak files
@@ -896,7 +895,7 @@
void CL_FlushMemory( void );
// dump all memory on an error
-void CL_StartHunkUsers( void );
+void CL_StartHunkUsers( qboolean rendererOnly );
// start all the client stuff using the hunk
void Key_WriteBindings( fileHandle_t f );
@@ -1003,7 +1002,6 @@
cpuFeatures_t Sys_GetProcessorFeatures( void );
-void Sys_ShowConsole( int level, qboolean quitOnClose );
void Sys_SetErrorText( const char *text );
void Sys_SendPacket( int length, const void *data, netadr_t to );
Modified: branches/unified-sdl/code/server/sv_init.c
===================================================================
--- branches/unified-sdl/code/server/sv_init.c 2007-09-03 19:29:49 UTC (rev 1154)
+++ branches/unified-sdl/code/server/sv_init.c 2007-09-04 19:54:11 UTC (rev 1155)
@@ -416,6 +416,11 @@
// clear the whole hunk because we're (re)loading the server
Hunk_Clear();
+#ifndef DEDICATED
+ // Restart renderer
+ CL_StartHunkUsers( qtrue );
+#endif
+
// clear collision map data
CM_ClearMap();
Modified: branches/unified-sdl/code/server/sv_main.c
===================================================================
--- branches/unified-sdl/code/server/sv_main.c 2007-09-03 19:29:49 UTC (rev 1154)
+++ branches/unified-sdl/code/server/sv_main.c 2007-09-04 19:54:11 UTC (rev 1155)
@@ -771,13 +771,12 @@
if (!com_sv_running->integer)
{
- if(com_dedicated->integer)
- {
- // Block indefinitely until something interesting happens
- // on STDIN.
- NET_Sleep(-1);
- }
-
+ // Running as a server, but no map loaded
+#ifdef DEDICATED
+ // Block until something interesting happens
+ NET_Sleep(-1);
+#endif
+
return;
}
Modified: branches/unified-sdl/code/sys/sys_main.c
===================================================================
--- branches/unified-sdl/code/sys/sys_main.c 2007-09-03 19:29:49 UTC (rev 1154)
+++ branches/unified-sdl/code/sys/sys_main.c 2007-09-04 19:54:11 UTC (rev 1155)
@@ -750,15 +750,18 @@
while( 1 )
{
#ifndef DEDICATED
- int appState = SDL_GetAppState( );
+ if( !com_dedicated->integer )
+ {
+ int appState = SDL_GetAppState( );
- // If we have no input focus at all, sleep a bit
- if( !( appState & ( SDL_APPMOUSEFOCUS | SDL_APPINPUTFOCUS ) ) )
- SDL_Delay( 16 );
+ // If we have no input focus at all, sleep a bit
+ if( !( appState & ( SDL_APPMOUSEFOCUS | SDL_APPINPUTFOCUS ) ) )
+ SDL_Delay( 16 );
- // If we're minimised, sleep a bit more
- if( !( appState & SDL_APPACTIVE ) )
- SDL_Delay( 32 );
+ // If we're minimised, sleep a bit more
+ if( !( appState & SDL_APPACTIVE ) )
+ SDL_Delay( 32 );
+ }
#endif
// Check for input
Modified: branches/unified-sdl/code/sys/sys_unix.c
===================================================================
--- branches/unified-sdl/code/sys/sys_unix.c 2007-09-03 19:29:49 UTC (rev 1154)
+++ branches/unified-sdl/code/sys/sys_unix.c 2007-09-04 19:54:11 UTC (rev 1155)
@@ -167,15 +167,6 @@
/*
==================
-Sys_ShowConsole
-==================
-*/
-void Sys_ShowConsole( int visLevel, qboolean quitOnClose )
-{
-}
-
-/*
-==================
Sys_GetClipboardData
==================
*/
Modified: branches/unified-sdl/code/sys/sys_win32.c
===================================================================
--- branches/unified-sdl/code/sys/sys_win32.c 2007-09-03 19:29:49 UTC (rev 1154)
+++ branches/unified-sdl/code/sys/sys_win32.c 2007-09-04 19:54:11 UTC (rev 1155)
@@ -184,15 +184,6 @@
/*
================
-Sys_ShowConsole
-================
-*/
-void Sys_ShowConsole( int visLevel, qboolean quitOnClose )
-{
-}
-
-/*
-================
Sys_GetClipboardData
================
*/
More information about the quake3-commits
mailing list