/* ==================== CL_Init ==================== */ void CL_Init( void ) { qboolean loaded; if( host.type == HOST_DEDICATED ) return; // nothing running on the client Con_Init(); CL_InitLocal(); R_Init(); // init renderer S_Init(); // init sound // unreliable buffer. unsed for unreliable commands and voice stream BF_Init( &cls.datagram, "cls.datagram", cls.datagram_buf, sizeof( cls.datagram_buf )); loaded = CL_LoadProgs( va( "%s/%s" , GI->dll_path, GI->client_lib )); if( !loaded ) #if defined (__ANDROID__) { char clientlib[256]; Q_strncpy( clientlib, getenv("XASH3D_ENGLIBDIR"), 256 ); Q_strncat( clientlib, "/" CLIENTDLL, 256 ); loaded = CL_LoadProgs( clientlib ); } #else loaded = CL_LoadProgs( CLIENTDLL ); #endif if( loaded ) { cls.initialized = true; cl.maxclients = 1; // allow to drawing player in menu cls.olddemonum = -1; cls.demonum = -1; } }
/* ==================== CL_Init ==================== */ void CL_Init( void ) { qboolean loaded; Q_memset( &cls, 0, sizeof( cls ) ); if( Host_IsDedicated() ) return; // nothing running on the client Con_Init(); CL_InitLocal(); R_Init(); // init renderer S_Init(); // init sound // unreliable buffer. unsed for unreliable commands and voice stream BF_Init( &cls.datagram, "cls.datagram", cls.datagram_buf, sizeof( cls.datagram_buf )); IN_TouchInit(); #if defined (__ANDROID__) { char clientlib[256]; Q_snprintf( clientlib, sizeof(clientlib), "%s/" CLIENTDLL, getenv("XASH3D_GAMELIBDIR")); loaded = CL_LoadProgs( clientlib ); if( !loaded ) { Q_snprintf( clientlib, sizeof(clientlib), "%s/" CLIENTDLL, getenv("XASH3D_ENGLIBDIR")); loaded = CL_LoadProgs( clientlib ); } } #else { char clientlib[256]; Com_ResetLibraryError(); if( Sys_GetParmFromCmdLine( "-clientlib", clientlib ) ) loaded = CL_LoadProgs( clientlib ); else loaded = CL_LoadProgs( va( "%s/%s" , GI->dll_path, SI.clientlib )); if( !loaded ) { loaded = CL_LoadProgs( CLIENTDLL ); } } #endif if( loaded ) { cls.initialized = true; cls.keybind_changed = false; cl.maxclients = 1; // allow to drawing player in menu cls.olddemonum = -1; cls.demonum = -1; } else Sys_Warn("Could not load client library:\n%s", Com_GetLibraryError()); }
/* ==================== CL_Init ==================== */ void CL_Init( void ) { if( host.type == HOST_DEDICATED ) return; // nothing running on the client Con_Init(); CL_InitLocal(); R_Init(); // init renderer S_Init(); // init sound // unreliable buffer. unsed for unreliable commands and voice stream BF_Init( &cls.datagram, "cls.datagram", cls.datagram_buf, sizeof( cls.datagram_buf )); if( !CL_LoadProgs( va( "%s/client.dll", GI->dll_path ))) Host_Error( "can't initialize client.dll\n" ); cls.initialized = true; cl.maxclients = 1; // allow to drawing player in menu cls.olddemonum = -1; cls.demonum = -1; }
/* =============== CL_ChangeGame This is experiment. Use with precaution =============== */ qboolean CL_ChangeGame( const char *gamefolder, qboolean bReset ) { if( Host_IsDedicated() ) return false; if( Q_stricmp( host.gamefolder, gamefolder )) { kbutton_t *mlook, *jlook; qboolean mlook_active = false, jlook_active = false; string mapname, maptitle; int maxEntities; mlook = (kbutton_t *)clgame.dllFuncs.KB_Find( "in_mlook" ); jlook = (kbutton_t *)clgame.dllFuncs.KB_Find( "in_jlook" ); if( mlook && ( mlook->state & 1 )) mlook_active = true; if( jlook && ( jlook->state & 1 )) jlook_active = true; // so reload all images (remote connect) Mod_ClearAll( true ); R_ShutdownImages(); FS_LoadGameInfo( (bReset) ? host.gamefolder : gamefolder ); R_InitImages(); // save parms maxEntities = clgame.maxEntities; Q_strncpy( mapname, clgame.mapname, MAX_STRING ); Q_strncpy( maptitle, clgame.maptitle, MAX_STRING ); Com_ResetLibraryError(); if( !CL_LoadProgs( va( "%s/%s", GI->dll_path, GI->client_lib))) Sys_Warn( "Can't initialize client library\n%s", Com_GetLibraryError() ); // restore parms clgame.maxEntities = maxEntities; Q_strncpy( clgame.mapname, mapname, MAX_STRING ); Q_strncpy( clgame.maptitle, maptitle, MAX_STRING ); // invalidate fonts so we can reloading them again Q_memset( &cls.creditsFont, 0, sizeof( cls.creditsFont )); SCR_InstallParticlePalette(); SCR_LoadCreditsFont(); Con_InvalidateFonts(); SCR_RegisterTextures (); CL_FreeEdicts (); SCR_VidInit (); if( cls.key_dest == key_game ) // restore mouse state clgame.dllFuncs.IN_ActivateMouse(); // restore mlook state if( mlook_active ) Cmd_ExecuteString( "+mlook\n", src_command ); if( jlook_active ) Cmd_ExecuteString( "+jlook\n", src_command ); return true; } return false; }