/* =============== SV_InitPhysicsAPI Initialize server external physics =============== */ qboolean SV_InitPhysicsAPI( void ) { static PHYSICAPI pPhysIface; pPhysIface = (PHYSICAPI)Com_GetProcAddress( svgame.hInstance, "Server_GetPhysicsInterface" ); if( pPhysIface ) { if( pPhysIface( SV_PHYSICS_INTERFACE_VERSION, &gPhysicsAPI, &svgame.physFuncs )) { MsgDev( D_AICONSOLE, "SV_LoadProgs: ^2initailized extended PhysicAPI ^7ver. %i\n", SV_PHYSICS_INTERFACE_VERSION ); if( svgame.physFuncs.SV_CheckFeatures != NULL ) { // grab common engine features (it will be shared across the network) host.features = svgame.physFuncs.SV_CheckFeatures(); Host_PrintEngineFeatures (); } return true; } // make sure what physic functions is cleared Q_memset( &svgame.physFuncs, 0, sizeof( svgame.physFuncs )); return false; // just tell user about problems } // physic interface is missed return true; }
/* ================ VGui_Startup Load vgui_support library and call VGui_Startup ================ */ void VGui_Startup( int width, int height ) { if(!vgui.initialized) { void (*F) (vguiapi_t *); lib = Com_LoadLibrary(host.vguiloader, false); if(!lib) MsgDev(D_ERROR, "Failed to load vgui_support library!\n"); else { F = Com_GetProcAddress(lib, "InitAPI"); if(F) { F(&vgui); vgui.initialized = true; } else MsgDev(D_ERROR, "Failed to find vgui_support library entry point!\n"); } VGUI_InitCursors(); } if (vgui.initialized) { //host.mouse_visible = true; vgui.Startup(width, height); } }
/* =============== Mod_InitStudioAPI Initialize server studio (blending interface) =============== */ void Mod_InitStudioAPI( void ) { static STUDIOAPI pBlendIface; pBlendAPI = &gBlendAPI; pBlendIface = (STUDIOAPI)Com_GetProcAddress( svgame.hInstance, "Server_GetBlendingInterface" ); if( pBlendIface && pBlendIface( SV_BLENDING_INTERFACE_VERSION, &pBlendAPI, &gStudioAPI, &studio_transform, &studio_bones )) { MsgDev( D_AICONSOLE, "SV_LoadProgs: ^2initailized Server Blending interface ^7ver. %i\n", SV_BLENDING_INTERFACE_VERSION ); return; } // just restore pointer to builtin function pBlendAPI = &gBlendAPI; }
/* ================ VGui_Startup Load vgui_support library and call VGui_Startup ================ */ void VGui_Startup( int width, int height ) { static qboolean failed = false; if( failed ) return; if(!vgui.initialized) { void (*F) ( vguiapi_t * ); char vguiloader[256]; char vguilib[256]; Com_ResetLibraryError(); // hack: load vgui with correct path first if specified. // it will be reused while resolving vgui support and client deps if( Sys_GetParmFromCmdLine( "-vguilib", vguilib ) ) { if( Q_strstr( vguilib, ".dll") ) Q_strncpy( vguiloader, "vgui_support.dll", 256 ); else Q_strncpy( vguiloader, VGUI_SUPPORT_DLL, 256 ); if( !Com_LoadLibrary( vguilib, false ) ) MsgDev( D_WARN, "VGUI preloading failed. Default library will be used!\n"); } if( !Sys_GetParmFromCmdLine( "-vguiloader", vguiloader ) ) Q_strncpy( vguiloader, VGUI_SUPPORT_DLL, 256 ); lib = Com_LoadLibrary( vguiloader, false ); if(!lib) MsgDev( D_ERROR, "Failed to load vgui_support library: %s", Com_GetLibraryError() ); else { F = Com_GetProcAddress( lib, "InitAPI" ); if( F ) { F( &vgui ); vgui.initialized = true; VGUI_InitCursors(); } else MsgDev( D_ERROR, "Failed to find vgui_support library entry point!\n" ); } } // vgui may crash if it cannot find font if( width <= 320 ) width = 320; else if( width <= 400 ) width = 400; else if( width <= 512 ) width = 512; else if( width <= 640 ) width = 640; else if( width <= 800 ) width = 800; else if( width <= 1024 ) width = 1024; else if( width <= 1152 ) width = 1152; else if( width <= 1280 ) width = 1280; else //if( width <= 1600 ) width = 1600; if( vgui.initialized ) { //host.mouse_visible = true; vgui.Startup( width, height ); } else failed = true; }