void CL_InitUI( void ) { int v; vmInterpret_t interpret; // load the dll or bytecode if ( cl_connectedToPureServer != 0 ) { // if sv_pure is set we only allow qvms to be loaded interpret = VMI_COMPILED; } else { interpret = Cvar_VariableValue( "vm_ui" ); } //----(SA) always dll #ifdef WOLF_SP_DEMO uivm = VM_Create( "ui", CL_UISystemCalls, VMI_NATIVE ); #else uivm = VM_Create( "ui", CL_UISystemCalls, Cvar_VariableValue( "vm_ui" ) ); #endif if ( !uivm ) { Com_Error( ERR_FATAL, "VM_Create on UI failed" ); } // sanity check v = VM_Call( uivm, UI_GETAPIVERSION ); if ( v != UI_API_VERSION ) { Com_Error( ERR_FATAL, "User Interface is version %d, expected %d", v, UI_API_VERSION ); cls.uiStarted = qfalse; } // init for this gamestate // VM_Call( uivm, UI_INIT ); VM_Call( uivm, UI_INIT, ( cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE ) ); }
/* =============== PHYS_InitGameProgs Called on a normal map change, not on a map_restart =============== */ void PHYS_InitGameProgs(void) { #if defined(USE_LLVM) pvm = VM_Create("physics", PHYS_SystemCalls, Cvar_VariableValue("vm_physics")); #else pvm = VM_Create("physics", PHYS_SystemCalls, VMI_NATIVE); #endif if (!pvm) Com_Error(ERR_FATAL, "VM_Create on physics failed"); PHYS_InitVM(qfalse); }
/* ==================== CL_InitUI ==================== */ void CL_InitUI( void ) { int v; uivm = VM_Create( "ui", CL_UISystemCalls, VMI_NATIVE ); if ( !uivm ) { Com_Error( ERR_FATAL, "VM_Create on UI failed" ); } // sanity check v = VM_Call( uivm, UI_GETAPIVERSION ); if ( v != UI_API_VERSION ) { // Free uivm now, so UI_SHUTDOWN doesn't get called later. VM_Free( uivm ); uivm = NULL; Com_Error( ERR_FATAL, "User Interface is version %d, expected %d", v, UI_API_VERSION ); } // init for this gamestate VM_Call( uivm, UI_INIT, ( cls.state >= CA_CONNECTING && cls.state < CA_ACTIVE ) ); }
/* ==================== CL_InitCGame Should only be called by CL_StartHunkUsers ==================== */ void CL_InitCGame(void) { const char *info; const char *mapname; int t1, t2; t1 = Sys_Milliseconds(); // put away the console Con_Close(); // find the current mapname info = cl.gameState.stringData + cl.gameState.stringOffsets[CS_SERVERINFO]; mapname = Info_ValueForKey(info, "mapname"); Com_sprintf(cl.mapname, sizeof(cl.mapname), "maps/%s.bsp", mapname); // load the dll cgvm = VM_Create("cgame", CL_CgameSystemCalls, VMI_NATIVE); if (!cgvm) { Com_Error(ERR_DROP, "VM_Create on cgame failed"); } cls.state = CA_LOADING; // init for this gamestate // use the lastExecutedServerCommand instead of the serverCommandSequence // otherwise server commands sent just before a gamestate are dropped // bani - added clc.demoplaying, since some mods need this at init time, and drawactiveframe is too late for them VM_Call(cgvm, CG_INIT, clc.serverMessageSequence, clc.lastExecutedServerCommand, clc.clientNum, clc.demoplaying, qtrue); // reset any CVAR_CHEAT cvars registered by cgame if (!clc.demoplaying && !cl_connectedToCheatServer) { Cvar_SetCheatState(); } // we will send a usercmd this frame, which // will cause the server to send us the first snapshot cls.state = CA_PRIMED; t2 = Sys_Milliseconds(); Com_Printf("CL_InitCGame: %5.2f seconds\n", (t2 - t1) / 1000.0); // have the renderer touch all its images, so they are present // on the card even if the driver does deferred loading re.EndRegistration(); // make sure everything is paged in if (!Sys_LowPhysicalMemory()) { Com_TouchMemory(); } // clear anything that got printed Con_ClearNotify(); // update the memory usage file CL_UpdateLevelHunkUsage(); }
/* ==================== CL_InitUI ==================== */ void CL_InitUI(void) { int v; uivm = VM_Create("ui", CL_UISystemCalls, VMI_NATIVE ); if(!uivm) { Com_Error(ERR_FATAL, "VM_Create on UI failed"); } // sanity check v = VM_Call(uivm, UI_GETAPIVERSION); if(v != UI_API_VERSION) { Com_Error(ERR_FATAL, "User Interface is version %d, expected %d", v, UI_API_VERSION); cls.uiStarted = false; } #if defined (USE_HTTP) // if the session id has something in it, then assume that the browser sent it from the // command line and tell ui we're already logged in. if ( com_sessionid->string[0] ) { VM_Call( uivm, UI_AUTHORIZED, AUTHORIZE_OK ); } #endif // init for this gamestate VM_Call(uivm, UI_INIT, (cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE)); }
void CL_InitUI( void ) { int v; vmInterpret_t interpret; // load the dll or bytecode if ( cl_connectedToPureServer != 0 ) { // if sv_pure is set we only allow qvms to be loaded interpret = VMI_COMPILED; } else { interpret = Cvar_VariableValue( "vm_ui" ); } uivm = VM_Create( "ui", CL_UISystemCalls, interpret ); if ( !uivm ) { Com_Error( ERR_FATAL, "VM_Create on UI failed" ); } // sanity check v = VM_Call( uivm, UI_GETAPIVERSION ); if (v == UI_OLD_API_VERSION) { // Com_Printf(S_COLOR_YELLOW "WARNING: loading old Quake III Arena User Interface version %d\n", v ); // init for this gamestate VM_Call( uivm, UI_INIT, (cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE)); } else if (v != UI_API_VERSION) { Com_Error( ERR_DROP, "User Interface is version %d, expected %d", v, UI_API_VERSION ); cls.uiStarted = qfalse; } else { // init for this gamestate VM_Call( uivm, UI_INIT, (cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE) ); } }
void CL_InitUI( void ) { int v; vmInterpret_t interpret; // load the dll or bytecode if ( cl_connectedToPureServer != 0 ) { #if 0 // if sv_pure is set we only allow qvms to be loaded interpret = VMI_COMPILED; #else //load the module type based on what the server is doing -rww interpret = (vmInterpret_t)cl_connectedUI; #endif } else { interpret = (vmInterpret_t)(int)Cvar_VariableValue( "vm_ui" ); } uivm = VM_Create( "ui", CL_UISystemCalls, interpret ); if ( !uivm ) { Com_Error( ERR_FATAL, "VM_Create on UI failed" ); } // sanity check v = VM_Call( uivm, UI_GETAPIVERSION ); if (v != UI_API_VERSION) { Com_Error( ERR_DROP, "User Interface is version %d, expected %d", v, UI_API_VERSION ); cls.uiStarted = qfalse; } else { // init for this gamestate //rww - changed to <= CA_ACTIVE, because that is the state when we did a vid_restart //ingame (was just < CA_ACTIVE before, resulting in ingame menus getting wiped and //not reloaded on vid restart from ingame menu) VM_Call( uivm, UI_INIT, (cls.state >= CA_AUTHORIZING && cls.state <= CA_ACTIVE) ); } }
/* ==================== CL_InitCGame Should only be called by CL_StartHunkUsers ==================== */ void CL_InitCGame( void ) { const char *info; const char *mapname; int t1, t2; vmInterpret_t interpret; t1 = Sys_Milliseconds(); // put away the console Con_Close(); // find the current mapname info = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SERVERINFO ]; mapname = Info_ValueForKey( info, "mapname" ); Com_sprintf( cl.mapname, sizeof( cl.mapname ), "maps/%s.bsp", mapname ); // load the dll or bytecode if ( cl_connectedToPureServer != 0 ) { // if sv_pure is set we only allow qvms to be loaded interpret = VMI_COMPILED; } else { interpret = Cvar_VariableValue( "vm_cgame" ); } cgvm = VM_Create( "cgame", CL_CgameSystemCalls, interpret ); if ( !cgvm ) { Com_Error( ERR_DROP, "VM_Create on cgame failed" ); } cls.state = CA_LOADING; // init for this gamestate // use the lastExecutedServerCommand instead of the serverCommandSequence // otherwise server commands sent just before a gamestate are dropped VM_Call( cgvm, CG_INIT, clc.serverMessageSequence, clc.lastExecutedServerCommand, clc.clientNum ); // reset any CVAR_CHEAT cvars registered by cgame if ( !clc.demoplaying && !cl_connectedToCheatServer ) Cvar_SetCheatState(); // we will send a usercmd this frame, which // will cause the server to send us the first snapshot cls.state = CA_PRIMED; t2 = Sys_Milliseconds(); Com_DPrintf( "CL_InitCGame: %5.2f seconds\n", (t2-t1)/1000.0 ); // have the renderer touch all its images, so they are present // on the card even if the driver does deferred loading re.EndRegistration(); // make sure everything is paged in if (!Sys_LowPhysicalMemory()) { Com_TouchMemory(); } // clear anything that got printed Con_ClearNotify (); CL_WriteClientLog( va("`~=-----------------=~`\n MAP: %s \n`~=-----------------=~`\n", mapname ) ); }
/* ==================== CL_InitCGame Should only by called by CL_StartHunkUsers ==================== */ void CL_InitCGame( void ) { const char *info; const char *mapname; int t1, t2; t1 = Sys_Milliseconds(); // put away the console Con_Close(); // find the current mapname info = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SERVERINFO ]; mapname = Info_ValueForKey( info, "mapname" ); Com_sprintf( cl.mapname, sizeof( cl.mapname ), "maps/%s.bsp", mapname ); cgvm = VM_Create( "cgame", CL_CgameSystemCalls, Cvar_VariableValue( "vm_cgame" ) ); if ( !cgvm ) { Com_Error( ERR_DROP, "VM_Create on cgame failed" ); } cls.state = CA_LOADING; // init for this gamestate // use the lastExecutedServerCommand instead of the serverCommandSequence // otherwise server commands sent just before a gamestate are dropped //bani - added clc.demoplaying, since some mods need this at init time, and drawactiveframe is too late for them VM_Call( cgvm, CG_INIT, clc.serverMessageSequence, clc.lastExecutedServerCommand, clc.clientNum, clc.demoplaying ); // we will send a usercmd this frame, which // will cause the server to send us the first snapshot cls.state = CA_PRIMED; t2 = Sys_Milliseconds(); Com_DPrintf( "CL_InitCGame: %5.2fs\n", ( t2 - t1 ) / 1000.0 ); // have the renderer touch all its images, so they are present // on the card even if the driver does deferred loading re.EndRegistration(); // make sure everything is paged in if ( !Sys_LowPhysicalMemory() ) { Com_TouchMemory(); } // Ridah, update the memory usage file CL_UpdateLevelHunkUsage(); CL_WriteClientLog( va("`~=-----------------=~`\n MAP: %s \n`~=-----------------=~`\n", mapname ) ); // if( cl_autorecord->integer ) { // Cvar_Set( "g_synchronousClients", "1" ); // } }
/* ================= VM_Restart Reload the data, but leave everything else in place This allows a server to do a map_restart without changing memory allocation ================= */ vm_t *VM_Restart( vm_t *vm ) { vm_t saved; memcpy( &saved, vm, sizeof( saved ) ); VM_Free( vm ); return VM_Create( saved.slot ); }
// Reload the data, but leave everything else in place // This allows a server to do a map_restart without changing memory allocation vm_t *VM_Restart( vm_t *vm ) { const vm_t saved = *vm; VM_Free( vm ); if ( saved.isLegacy ) return VM_CreateLegacy( saved.slot, saved.legacy.syscall ); else return VM_Create( saved.slot ); }
/* ================= VM_Restart Reload the data, but leave everything else in place This allows a server to do a map_restart without changing memory allocation ================= */ vm_t *VM_Restart( vm_t *vm ) { vm_t saved; memcpy( &saved, vm, sizeof( saved ) ); VM_Free( vm ); if ( saved.isLegacy ) return VM_CreateLegacy( saved.slot, saved.legacy.syscall ); else return VM_Create( saved.slot ); }
/* =============== SV_InitGameProgs Called on a normal map change, not on a map_restart =============== */ void SV_InitGameProgs(void) { sv.num_tagheaders = 0; sv.num_tags = 0; // load the dll or bytecode gvm = VM_Create( "qagame", SV_GameSystemCalls, VMI_NATIVE ); if(!gvm) { Com_Error(ERR_FATAL, "VM_Create on game failed"); } SV_InitGameVM(false); }
void CL_InitCGameCVars( void ) { vm_t *cgv_vm = VM_Create( "cgame", CL_CgameSystemCalls, Cvar_VariableValue( "vm_cgame" ) ); if ( !cgv_vm ) { Com_Error( ERR_DROP, "VM_Create on cgame failed" ); } VM_Call( cgv_vm, CG_INIT_CVARS ); VM_Free( cgv_vm ); }
/* ================= VM_Restart Reload the data, but leave everything else in place This allows a server to do a map_restart without changing memory allocation ================= */ vm_t *VM_Restart( vm_t *vm ) { // DLL's can't be restarted in place char name[MAX_QPATH]; vmInterpret_t interpret; intptr_t(*systemCall) (intptr_t * parms); systemCall = vm->systemCall; Q_strncpyz(name, vm->name, sizeof(name)); interpret = vm->interpret; VM_Free(vm); vm = VM_Create(name, systemCall, interpret); return vm; }
void CL_InitUI( void ) { int v; uivm = VM_Create( "ui", CL_UISystemCalls, VMI_NATIVE ); if ( !uivm ) { Com_Error( ERR_FATAL, "VM_Create on UI failed" ); } // sanity check v = VM_Call( uivm, UI_GETAPIVERSION ); if ( v != UI_API_VERSION ) { Com_Error( ERR_FATAL, "User Interface is version %d, expected %d", v, UI_API_VERSION ); cls.uiStarted = qfalse; } // init for this gamestate VM_Call( uivm, UI_INIT, ( cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE ) ); }
/* ================= VM_Restart Reload the data, but leave everything else in place This allows a server to do a map_restart without changing memory allocation ================= */ vm_t *VM_Restart( vm_t *vm ) { // DLL's can't be restarted in place if ( vm->dllHandle ) { char name[MAX_QPATH]; intptr_t ( *systemCall )( intptr_t *parms ); systemCall = vm->systemCall; Q_strncpyz( name, vm->name, sizeof( name ) ); VM_Free( vm ); vm = VM_Create( name, systemCall, VMI_NATIVE ); return vm; } return NULL; }
void CL_InitUI() { // if sv_pure is set we only allow qvms to be loaded vmInterpret_t interpret = cl_connectedToPureServer ? VMI_COMPILED : (vmInterpret_t)Cvar_VariableIntegerValue("vm_ui"); uivm = VM_Create( "ui", CL_UISystemCalls, interpret ); if ( !uivm ) Com_Error( ERR_FATAL, "VM_Create on UI failed" ); // currently-pointless sanity check caused by TA poison, sigh int v = VM_Call( uivm, UI_GETAPIVERSION ); if (v != UI_API_VERSION) { Com_Error( ERR_DROP, "User Interface is version %d, expected %d", v, UI_API_VERSION ); cls.uiStarted = qfalse; return; } // init for this gamestate VM_Call( uivm, UI_INIT, (cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE) ); }
/* ================= VM_Restart Reload the data, but leave everything else in place This allows a server to do a map_restart without changing memory allocation ================= */ vm_t *VM_Restart( vm_t *vm ) { int length; int dataLength; int i; char filename[MAX_QPATH]; // DLL's can't be restarted in place if ( vm->dllHandle ) { char name[MAX_QPATH]; int (*systemCall)( int *parms ); systemCall = vm->systemCall; Q_strncpyz( name, vm->name, sizeof( name ) ); VM_Free( vm ); vm = VM_Create( name, systemCall ); return vm; } Com_Error( ERR_FATAL, "Unable to load %s.", vm->name ); }
void CL_InitUI( void ) { int v; vmInterpret_t interpret; // load the dll or bytecode if ( cl_connectedToPureServer != 0 ) { // if sv_pure is set we only allow qvms to be loaded interpret = VMI_COMPILED; } else { interpret = Cvar_VariableValue( "vm_ui" ); } uivm = VM_Create( "ui", CL_UISystemCalls, interpret ); if ( !uivm ) { Com_Error( ERR_FATAL, "VM_Create on UI failed" ); } // sanity check v = VM_Call( uivm, UI_GETAPIVERSION ); if (v == UI_OLD_API_VERSION) { // init for this gamestate VM_Call( uivm, UI_INIT, (cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE)); } else if (v != UI_API_VERSION) { Com_Error( ERR_DROP, "User Interface is version %d, expected %d", v, UI_API_VERSION ); cls.uiStarted = qfalse; } else { // init for this gamestate VM_Call( uivm, UI_INIT, (cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE) ); } // reset any CVAR_CHEAT cvars registered by ui if ( !clc.demoplaying && !cl_connectedToCheatServer ) Cvar_SetCheatState(); }
void CL_InitUI( void ) { int v; uivm = VM_Create( "ui", CL_UISystemCalls ); if ( !uivm ) { Com_Error( ERR_FATAL, "VM_Create on UI failed" ); } // sanity check v = VM_Call( uivm, UI_GETAPIVERSION ); if (v == UI_OLD_API_VERSION) { // Com_Printf(S_COLOR_YELLOW "WARNING: loading old Quake III Arena User Interface version %d\n", v ); // init for this gamestate VM_Call( uivm, UI_INIT, (cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE)); } else if (v != UI_API_VERSION) { Com_Error( ERR_DROP, "User Interface is version %d, expected %d", v, UI_API_VERSION ); cls.uiStarted = qfalse; } else { // init for this gamestate VM_Call( uivm, UI_INIT, (cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE) ); } }
/* ================= VM_Restart Reload the data, but leave everything else in place This allows a server to do a map_restart without changing memory allocation ================= */ vm_t *VM_Restart( vm_t *vm ) { vmHeader_t *header; int length; int dataLength; int i; char filename[MAX_QPATH]; // DLL's can't be restarted in place if ( vm->dllHandle ) { char name[MAX_QPATH]; int (*systemCall)( int *parms ); systemCall = vm->systemCall; Q_strncpyz( name, vm->name, sizeof( name ) ); VM_Free( vm ); vm = VM_Create( name, systemCall, VMI_NATIVE ); return vm; } // load the image Com_Printf( "VM_Restart()\n", filename ); Com_sprintf( filename, sizeof(filename), "vm/%s.qvm", vm->name ); Com_Printf( "Loading vm file %s.\n", filename ); length = FS_ReadFile( filename, (void **)&header ); if ( !header ) { Com_Error( ERR_DROP, "VM_Restart failed.\n" ); } // byte swap the header for ( i = 0 ; i < sizeof( *header ) / 4 ; i++ ) { ((int *)header)[i] = LittleLong( ((int *)header)[i] ); } // validate if ( header->vmMagic != VM_MAGIC || header->bssLength < 0 || header->dataLength < 0 || header->litLength < 0 || header->codeLength <= 0 ) { VM_Free( vm ); Com_Error( ERR_FATAL, "%s has bad header", filename ); } // round up to next power of 2 so all data operations can // be mask protected dataLength = header->dataLength + header->litLength + header->bssLength; for ( i = 0 ; dataLength > ( 1 << i ) ; i++ ) { } dataLength = 1 << i; // clear the data Com_Memset( vm->dataBase, 0, dataLength ); // copy the intialized data Com_Memcpy( vm->dataBase, (byte *)header + header->dataOffset, header->dataLength + header->litLength ); // byte swap the longs for ( i = 0 ; i < header->dataLength ; i += 4 ) { *(int *)(vm->dataBase + i) = LittleLong( *(int *)(vm->dataBase + i ) ); } // free the original file FS_FreeFile( header ); return vm; }
/* ==================== CL_InitCGame Should only be called by CL_StartHunkUsers ==================== */ void CL_InitCGame( void ) { const char *info; const char *mapname; int t1, t2; char backup[ MAX_STRING_CHARS ]; vmInterpret_t interpret; t1 = Sys_Milliseconds(); // find the current mapname info = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SERVERINFO ]; mapname = Info_ValueForKey( info, "mapname" ); Com_sprintf( cl.mapname, sizeof( cl.mapname ), "maps/%s.bsp", mapname ); // load the dll or bytecode interpret = (vmInterpret_t)Cvar_VariableValue("vm_cgame"); if(cl_connectedToPureServer) { // if sv_pure is set we only allow qvms to be loaded if(interpret != VMI_COMPILED && interpret != VMI_BYTECODE) interpret = VMI_COMPILED; } cls.cgame = VM_Create( "cgame", CL_CgameSystemCalls, interpret ); if ( !cls.cgame ) { Com_Error( ERR_DROP, "VM_Create on cgame failed" ); } clc.state = CA_LOADING; Cvar_VariableStringBuffer( "cl_voipSendTarget", backup, sizeof( backup ) ); Cvar_Set( "cl_voipSendTarget", "" ); // Probe 1.1 or gpp cgame cls.cgInterface = 0; probingCG = true; VM_Call( cls.cgame, CG_VOIP_STRING ); probingCG = false; Cvar_Set( "cl_voipSendTarget", backup ); if ( ( clc.netchan.alternateProtocol == 2 ) != ( cls.cgInterface == 2 ) ) { Com_Error( ERR_DROP, "%s protocol %i, but a cgame module using the %s interface was found", ( clc.demoplaying ? "Demo was recorded using" : "Server uses" ), ( clc.netchan.alternateProtocol == 0 ? PROTOCOL_VERSION : clc.netchan.alternateProtocol == 1 ? 70 : 69 ), ( cls.cgInterface == 2 ? "1.1" : "non-1.1" ) ); } // init for this gamestate // use the lastExecutedServerCommand instead of the serverCommandSequence // otherwise server commands sent just before a gamestate are dropped VM_Call( cls.cgame, CG_INIT, clc.serverMessageSequence, clc.lastExecutedServerCommand, clc.clientNum ); // reset any CVAR_CHEAT cvars registered by cgame if ( !clc.demoplaying && !cl_connectedToCheatServer ) Cvar_SetCheatState(); // we will send a usercmd this frame, which // will cause the server to send us the first snapshot clc.state = CA_PRIMED; t2 = Sys_Milliseconds(); Com_Printf( "CL_InitCGame: %5.2f seconds\n", (t2-t1)/1000.0 ); // have the renderer touch all its images, so they are present // on the card even if the driver does deferred loading re.EndRegistration(); // make sure everything is paged in if (!Sys_LowPhysicalMemory()) { Com_TouchMemory(); CL_ProtocolSpecificCommandsInit(); } // clear anything that got printed Con_ClearNotify (); }
void CLT3_InitCGame() { int t1 = Sys_Milliseconds(); // put away the console Con_Close(); // find the current mapname const char* info = GGameType & GAME_WolfSP ? cl.ws_gameState.stringData + cl.ws_gameState.stringOffsets[ Q3CS_SERVERINFO ] : GGameType & GAME_WolfMP ? cl.wm_gameState.stringData + cl.wm_gameState.stringOffsets[ Q3CS_SERVERINFO ] : GGameType & GAME_ET ? cl.et_gameState.stringData + cl.et_gameState.stringOffsets[ Q3CS_SERVERINFO ] : cl.q3_gameState.stringData + cl.q3_gameState.stringOffsets[ Q3CS_SERVERINFO ]; const char* mapname = Info_ValueForKey( info, "mapname" ); String::Sprintf( cl.q3_mapname, sizeof ( cl.q3_mapname ), "maps/%s.bsp", mapname ); if ( GGameType & GAME_Quake3 ) { // load the dll or bytecode vmInterpret_t interpret; if ( cl_connectedToPureServer != 0 ) { // if sv_pure is set we only allow qvms to be loaded interpret = VMI_COMPILED; } else { interpret = ( vmInterpret_t )( int )Cvar_VariableValue( "vm_cgame" ); } cgvm = VM_Create( "cgame", CLQ3_CgameSystemCalls, interpret ); } else if ( GGameType & GAME_WolfSP ) { cgvm = VM_Create( "cgame", CLWS_CgameSystemCalls, VMI_NATIVE ); } else if ( GGameType & GAME_WolfMP ) { cgvm = VM_Create( "cgame", CLWM_CgameSystemCalls, VMI_NATIVE ); } else { cgvm = VM_Create( "cgame", CLET_CgameSystemCalls, VMI_NATIVE ); } if ( !cgvm ) { common->Error( "VM_Create on cgame failed" ); } cls.state = CA_LOADING; // init for this gamestate // use the lastExecutedServerCommand instead of the serverCommandSequence // otherwise server commands sent just before a gamestate are dropped if ( GGameType & GAME_ET ) { //bani - added clc.demoplaying, since some mods need this at init time, and drawactiveframe is too late for them VM_Call( cgvm, CG_INIT, clc.q3_serverMessageSequence, clc.q3_lastExecutedServerCommand, clc.q3_clientNum, clc.demoplaying ); } else { VM_Call( cgvm, CG_INIT, clc.q3_serverMessageSequence, clc.q3_lastExecutedServerCommand, clc.q3_clientNum ); } // we will send a usercmd this frame, which // will cause the server to send us the first snapshot cls.state = CA_PRIMED; int t2 = Sys_Milliseconds(); common->Printf( "CLT3_InitCGame: %5.2f seconds\n", ( t2 - t1 ) / 1000.0 ); // have the renderer touch all its images, so they are present // on the card even if the driver does deferred loading R_EndRegistration(); // clear anything that got printed Con_ClearNotify(); }
void CL_BindUI( void ) { static uiImport_t uii; uiExport_t *ret; GetUIAPI_t GetUIAPI; char dllName[MAX_OSPATH] = "ui"ARCH_STRING DLL_EXT; memset( &uii, 0, sizeof( uii ) ); uivm = VM_Create( VM_UI ); if ( uivm ) { uii.Print = Com_Printf; uii.Error = Com_Error; uii.Milliseconds = CL_Milliseconds; uii.RealTime = Com_RealTime; uii.MemoryRemaining = Hunk_MemoryRemaining; uii.Cvar_Create = CL_Cvar_Get; uii.Cvar_InfoStringBuffer = Cvar_InfoStringBuffer; uii.Cvar_Register = Cvar_Register; uii.Cvar_Reset = Cvar_Reset; uii.Cvar_Set = Cvar_Set; uii.Cvar_SetValue = Cvar_SetValue; uii.Cvar_Update = Cvar_Update; uii.Cvar_VariableStringBuffer = Cvar_VariableStringBuffer; uii.Cvar_VariableValue = Cvar_VariableValue; uii.Cmd_Argc = Cmd_Argc; uii.Cmd_Argv = Cmd_ArgvBuffer; uii.Cmd_ExecuteText = Cbuf_ExecuteText; uii.FS_Close = FS_FCloseFile; uii.FS_GetFileList = FS_GetFileList; uii.FS_Open = FS_FOpenFileByMode; uii.FS_Read = FS_Read2; uii.FS_Write = FS_Write; uii.GetClientState = CL_GetClientState; uii.GetClipboardData = GetClipboardData; uii.GetConfigString = GetConfigString; uii.GetGlconfig = CL_GetGlconfig; uii.UpdateScreen = SCR_UpdateScreen; uii.Key_ClearStates = Key_ClearStates; uii.Key_GetBindingBuf = Key_GetBindingBuf; uii.Key_IsDown = Key_IsDown; uii.Key_KeynumToStringBuf = Key_KeynumToStringBuf; uii.Key_SetBinding = Key_SetBinding; uii.Key_GetCatcher = Key_GetCatcher; uii.Key_GetOverstrikeMode = Key_GetOverstrikeMode; uii.Key_SetCatcher = Key_SetCatcher; uii.Key_SetOverstrikeMode = Key_SetOverstrikeMode; uii.PC_AddGlobalDefine = botlib_export->PC_AddGlobalDefine; uii.PC_FreeSource = botlib_export->PC_FreeSourceHandle; uii.PC_LoadGlobalDefines = botlib_export->PC_LoadGlobalDefines; uii.PC_LoadSource = botlib_export->PC_LoadSourceHandle; uii.PC_ReadToken = botlib_export->PC_ReadTokenHandle; uii.PC_RemoveAllGlobalDefines = botlib_export->PC_RemoveAllGlobalDefines; uii.PC_SourceFileAndLine = botlib_export->PC_SourceFileAndLine; uii.CIN_DrawCinematic = CIN_DrawCinematic; uii.CIN_PlayCinematic = CIN_PlayCinematic; uii.CIN_RunCinematic = CIN_RunCinematic; uii.CIN_SetExtents = CIN_SetExtents; uii.CIN_StopCinematic = CIN_StopCinematic; uii.LAN_AddServer = LAN_AddServer; uii.LAN_ClearPing = LAN_ClearPing; uii.LAN_CompareServers = LAN_CompareServers; uii.LAN_GetPing = LAN_GetPing; uii.LAN_GetPingInfo = LAN_GetPingInfo; uii.LAN_GetPingQueueCount = LAN_GetPingQueueCount; uii.LAN_GetServerAddressString = LAN_GetServerAddressString; uii.LAN_GetServerCount = LAN_GetServerCount; uii.LAN_GetServerInfo = LAN_GetServerInfo; uii.LAN_GetServerPing = LAN_GetServerPing; uii.LAN_LoadCachedServers = LAN_LoadCachedServers; uii.LAN_MarkServerVisible = LAN_MarkServerVisible; uii.LAN_RemoveServer = LAN_RemoveServer; uii.LAN_ResetPings = LAN_ResetPings; uii.LAN_SaveCachedServers = LAN_SaveServersToCache; uii.LAN_ServerIsVisible = LAN_ServerIsVisible; uii.LAN_ServerStatus = LAN_GetServerStatus; uii.LAN_UpdateVisiblePings = LAN_UpdateVisiblePings; uii.S_StartBackgroundTrack = S_StartBackgroundTrack; uii.S_StartLocalSound = S_StartLocalSound; uii.S_StopBackgroundTrack = S_StopBackgroundTrack; uii.S_RegisterSound = S_RegisterSound; uii.SE_GetLanguageName = CL_SE_GetLanguageName; uii.SE_GetNumLanguages = SE_GetNumLanguages; uii.SE_GetStringTextString = CL_SE_GetStringTextString; uii.R_Language_IsAsian = re->Language_IsAsian; uii.R_Language_UsesSpaces = re->Language_UsesSpaces; uii.R_AnyLanguage_ReadCharFromString = re->AnyLanguage_ReadCharFromString; uii.R_AddLightToScene = re->AddLightToScene; uii.R_AddPolysToScene = re->AddPolyToScene; uii.R_AddRefEntityToScene = re->AddRefEntityToScene; uii.R_ClearScene = re->ClearScene; uii.R_DrawStretchPic = re->DrawStretchPic; uii.R_Font_DrawString = re->Font_DrawString; uii.R_Font_HeightPixels = re->Font_HeightPixels; uii.R_Font_StrLenChars = re->Font_StrLenChars; uii.R_Font_StrLenPixels = re->Font_StrLenPixels; uii.R_LerpTag = re->LerpTag; uii.R_ModelBounds = re->ModelBounds; uii.R_RegisterFont = re->RegisterFont; uii.R_RegisterModel = re->RegisterModel; uii.R_RegisterShaderNoMip = re->RegisterShaderNoMip; uii.R_RegisterSkin = re->RegisterSkin; uii.R_RemapShader = re->RemapShader; uii.R_RenderScene = re->RenderScene; uii.R_SetColor = re->SetColor; uii.R_ShaderNameFromIndex = CL_R_ShaderNameFromIndex; uii.G2_ListModelSurfaces = CL_G2API_ListModelSurfaces; uii.G2_ListModelBones = CL_G2API_ListModelBones; uii.G2_SetGhoul2ModelIndexes = CL_G2API_SetGhoul2ModelIndexes; uii.G2_HaveWeGhoul2Models = CL_G2API_HaveWeGhoul2Models; uii.G2API_GetBoltMatrix = CL_G2API_GetBoltMatrix; uii.G2API_GetBoltMatrix_NoReconstruct = CL_G2API_GetBoltMatrix_NoReconstruct; uii.G2API_GetBoltMatrix_NoRecNoRot = CL_G2API_GetBoltMatrix_NoRecNoRot; uii.G2API_InitGhoul2Model = CL_G2API_InitGhoul2Model; uii.G2API_SetSkin = CL_G2API_SetSkin; uii.G2API_CollisionDetect = CL_G2API_CollisionDetect; uii.G2API_CollisionDetectCache = CL_G2API_CollisionDetectCache; uii.G2API_CleanGhoul2Models = CL_G2API_CleanGhoul2Models; uii.G2API_SetBoneAngles = CL_G2API_SetBoneAngles; uii.G2API_SetBoneAnim = CL_G2API_SetBoneAnim; uii.G2API_GetBoneAnim = CL_G2API_GetBoneAnim; uii.G2API_GetBoneFrame = CL_G2API_GetBoneFrame; uii.G2API_GetGLAName = CL_G2API_GetGLAName; uii.G2API_CopyGhoul2Instance = CL_G2API_CopyGhoul2Instance; uii.G2API_CopySpecificGhoul2Model = CL_G2API_CopySpecificGhoul2Model; uii.G2API_DuplicateGhoul2Instance = CL_G2API_DuplicateGhoul2Instance; uii.G2API_HasGhoul2ModelOnIndex = CL_G2API_HasGhoul2ModelOnIndex; uii.G2API_RemoveGhoul2Model = CL_G2API_RemoveGhoul2Model; uii.G2API_AddBolt = CL_G2API_AddBolt; uii.G2API_SetBoltInfo = CL_G2API_SetBoltInfo; uii.G2API_SetRootSurface = CL_G2API_SetRootSurface; uii.G2API_SetSurfaceOnOff = CL_G2API_SetSurfaceOnOff; uii.G2API_SetNewOrigin = CL_G2API_SetNewOrigin; uii.G2API_GetTime = CL_G2API_GetTime; uii.G2API_SetTime = CL_G2API_SetTime; uii.G2API_SetRagDoll = CL_G2API_SetRagDoll; uii.G2API_AnimateG2Models = CL_G2API_AnimateG2Models; uii.G2API_SetBoneIKState = CL_G2API_SetBoneIKState; uii.G2API_IKMove = CL_G2API_IKMove; uii.G2API_GetSurfaceName = CL_G2API_GetSurfaceName; uii.G2API_AttachG2Model = CL_G2API_AttachG2Model; GetUIAPI = (GetUIAPI_t)uivm->GetModuleAPI; ret = GetUIAPI( UI_API_VERSION, &uii ); if ( !ret ) { //free VM? cls.uiStarted = qfalse; Com_Error( ERR_FATAL, "GetGameAPI failed on %s", dllName ); } uie = ret; } // fall back to legacy syscall/vm_call api uivm = VM_CreateLegacy( VM_UI, CL_UISystemCalls ); if ( !uivm ) { cls.uiStarted = qfalse; Com_Error( ERR_DROP, "VM_CreateLegacy on ui failed" ); } }
void CL_BindCGame( void ) { static cgameImport_t cgi; cgameExport_t *ret; GetCGameAPI_t GetCGameAPI; char dllName[MAX_OSPATH] = "cgame"ARCH_STRING DLL_EXT; memset( &cgi, 0, sizeof( cgi ) ); cgvm = VM_Create( VM_CGAME ); if ( !cgvm ) { cls.cgameStarted = qfalse; Com_Error( ERR_FATAL, "Could not load '%s'", dllName ); } cgi.Print = Com_Printf; cgi.Error = Com_Error; cgi.SnapVector = Sys_SnapVector; cgi.MemoryRemaining = Hunk_MemoryRemaining; cgi.RegisterSharedMemory = RegisterSharedMemory; cgi.TrueMalloc = VM_Shifted_Alloc; cgi.TrueFree = VM_Shifted_Free; cgi.Milliseconds = CL_Milliseconds; cgi.RealTime = Com_RealTime; cgi.PrecisionTimerStart = CL_PrecisionTimerStart; cgi.PrecisionTimerEnd = CL_PrecisionTimerEnd; cgi.Cvar_Register = Cvar_Register; cgi.Cvar_Set = Cvar_Set; cgi.Cvar_Update = Cvar_Update; cgi.Cvar_VariableStringBuffer = Cvar_VariableStringBuffer; cgi.AddCommand = CL_AddCgameCommand; cgi.Cmd_Argc = Cmd_Argc; cgi.Cmd_Args = Cmd_ArgsBuffer; cgi.Cmd_Argv = Cmd_Argv; cgi.RemoveCommand = Cmd_RemoveCommand; cgi.SendClientCommand = CL_AddReliableCommand2; cgi.SendConsoleCommand = Cbuf_AddText; cgi.FS_Close = FS_FCloseFile; cgi.FS_GetFileList = FS_GetFileList; cgi.FS_Open = FS_FOpenFileByMode; cgi.FS_Read = FS_Read2; cgi.FS_Write = FS_Write; cgi.UpdateScreen = SCR_UpdateScreen; cgi.CM_InlineModel = CM_InlineModel; cgi.CM_LoadMap = CL_CM_LoadMap; cgi.CM_NumInlineModels = CM_NumInlineModels; cgi.CM_PointContents = CM_PointContents; cgi.CM_RegisterTerrain = CL_CM_RegisterTerrain; cgi.CM_TempModel = CM_TempBoxModel; cgi.CM_Trace = CM_BoxTrace; cgi.CM_TransformedPointContents = CM_TransformedPointContents; cgi.CM_TransformedTrace = CM_TransformedBoxTrace; cgi.RMG_Init = CL_RMG_Init; cgi.S_AddLocalSet = S_AddLocalSet; cgi.S_AddLoopingSound = S_AddLoopingSound; cgi.S_ClearLoopingSounds = S_ClearLoopingSounds; cgi.S_GetVoiceVolume = CL_S_GetVoiceVolume; cgi.S_MuteSound = S_MuteSound; cgi.S_RegisterSound = S_RegisterSound; cgi.S_Respatialize = S_Respatialize; cgi.S_Shutup = CL_S_Shutup; cgi.S_StartBackgroundTrack = S_StartBackgroundTrack; cgi.S_StartLocalSound = S_StartLocalSound; cgi.S_StartSound = S_StartSound; cgi.S_StopBackgroundTrack = S_StopBackgroundTrack; cgi.S_StopLoopingSound = S_StopLoopingSound; cgi.S_UpdateEntityPosition = S_UpdateEntityPosition; cgi.S_UpdateAmbientSet = S_UpdateAmbientSet; cgi.AS_AddPrecacheEntry = AS_AddPrecacheEntry; cgi.AS_GetBModelSound = AS_GetBModelSound; cgi.AS_ParseSets = AS_ParseSets; cgi.R_AddAdditiveLightToScene = re->AddAdditiveLightToScene; cgi.R_AddDecalToScene = re->AddDecalToScene; cgi.R_AddLightToScene = re->AddLightToScene; cgi.R_AddPolysToScene = re->AddPolyToScene; cgi.R_AddRefEntityToScene = re->AddRefEntityToScene; cgi.R_AnyLanguage_ReadCharFromString = re->AnyLanguage_ReadCharFromString; cgi.R_AutomapElevationAdjustment = re->AutomapElevationAdjustment; cgi.R_ClearDecals = re->ClearDecals; cgi.R_ClearScene = re->ClearScene; cgi.R_DrawStretchPic = re->DrawStretchPic; cgi.R_DrawRotatePic = re->DrawRotatePic; cgi.R_DrawRotatePic2 = re->DrawRotatePic2; cgi.R_Font_DrawString = re->Font_DrawString; cgi.R_Font_HeightPixels = re->Font_HeightPixels; cgi.R_Font_StrLenChars = re->Font_StrLenChars; cgi.R_Font_StrLenPixels = re->Font_StrLenPixels; cgi.R_GetBModelVerts = re->GetBModelVerts; cgi.R_GetDistanceCull = re->GetDistanceCull; cgi.R_GetEntityToken = re->GetEntityToken; cgi.R_GetLightStyle = re->GetLightStyle; cgi.R_GetRealRes = re->GetRealRes; cgi.R_InitializeWireframeAutomap = re->InitializeWireframeAutomap; cgi.R_InPVS = re->inPVS; cgi.R_Language_IsAsian = re->Language_IsAsian; cgi.R_Language_UsesSpaces = re->Language_UsesSpaces; cgi.R_LerpTag = re->LerpTag; cgi.R_LightForPoint = re->LightForPoint; cgi.R_LoadWorld = re->LoadWorld; cgi.R_MarkFragments = re->MarkFragments; cgi.R_ModelBounds = re->ModelBounds; cgi.R_RegisterFont = re->RegisterFont; cgi.R_RegisterModel = re->RegisterModel; cgi.R_RegisterShader = re->RegisterShader; cgi.R_RegisterShaderNoMip = re->RegisterShaderNoMip; cgi.R_RegisterSkin = re->RegisterSkin; cgi.R_RemapShader = re->RemapShader; cgi.R_RenderScene = re->RenderScene; cgi.R_SetColor = re->SetColor; cgi.R_SetLightStyle = re->SetLightStyle; cgi.R_SetRangedFog = re->SetRangedFog; cgi.R_SetRefractionProperties = re->SetRefractionProperties; cgi.R_WorldEffectCommand = re->WorldEffectCommand; cgi.RE_InitRendererTerrain = re->InitRendererTerrain; cgi.WE_AddWeatherZone = re->AddWeatherZone; cgi.GetCurrentSnapshotNumber = CL_GetCurrentSnapshotNumber; cgi.GetCurrentCmdNumber = CL_GetCurrentCmdNumber; cgi.GetDefaultState = CL_GetDefaultState; cgi.GetGameState = CL_GetGameState; cgi.GetGlconfig = CL_GetGlconfig; cgi.GetServerCommand = CL_GetServerCommand; cgi.GetSnapshot = CL_GetSnapshot; cgi.GetUserCmd = CL_GetUserCmd; cgi.OpenUIMenu = CL_OpenUIMenu; cgi.SetClientForceAngle = CL_SetClientForceAngle; cgi.SetUserCmdValue = _CL_SetUserCmdValue; cgi.Key_GetCatcher = Key_GetCatcher; cgi.Key_GetKey = Key_GetKey; cgi.Key_IsDown = Key_IsDown; cgi.Key_SetCatcher = Key_SetCatcher; cgi.PC_AddGlobalDefine = botlib_export->PC_AddGlobalDefine; cgi.PC_FreeSource = botlib_export->PC_FreeSourceHandle; cgi.PC_LoadGlobalDefines = botlib_export->PC_LoadGlobalDefines; cgi.PC_LoadSource = botlib_export->PC_LoadSourceHandle; cgi.PC_ReadToken = botlib_export->PC_ReadTokenHandle; cgi.PC_RemoveAllGlobalDefines = botlib_export->PC_RemoveAllGlobalDefines; cgi.PC_SourceFileAndLine = botlib_export->PC_SourceFileAndLine; cgi.CIN_DrawCinematic = CIN_DrawCinematic; cgi.CIN_PlayCinematic = CIN_PlayCinematic; cgi.CIN_RunCinematic = CIN_RunCinematic; cgi.CIN_SetExtents = CIN_SetExtents; cgi.CIN_StopCinematic = CIN_StopCinematic; cgi.FX_AddLine = CGFX_AddLine; cgi.FX_RegisterEffect = FX_RegisterEffect; cgi.FX_PlayEffect = FX_PlayEffect; cgi.FX_PlayEffectID = FX_PlayEffectID; cgi.FX_PlayEntityEffectID = FX_PlayEntityEffectID; cgi.FX_PlayBoltedEffectID = CGFX_PlayBoltedEffectID; cgi.FX_AddScheduledEffects = FX_AddScheduledEffects; cgi.FX_InitSystem = FX_InitSystem; cgi.FX_SetRefDef = FX_SetRefDef; cgi.FX_FreeSystem = FX_FreeSystem; cgi.FX_AdjustTime = FX_AdjustTime; cgi.FX_Draw2DEffects = FX_Draw2DEffects; cgi.FX_AddPoly = CGFX_AddPoly; cgi.FX_AddBezier = CGFX_AddBezier; cgi.FX_AddPrimitive = CGFX_AddPrimitive; cgi.FX_AddSprite = CGFX_AddSprite; cgi.FX_AddElectricity = CGFX_AddElectricity; cgi.SE_GetStringTextString = CL_SE_GetStringTextString; cgi.ROFF_Clean = CL_ROFF_Clean; cgi.ROFF_UpdateEntities = CL_ROFF_UpdateEntities; cgi.ROFF_Cache = CL_ROFF_Cache; cgi.ROFF_Play = CL_ROFF_Play; cgi.ROFF_Purge_Ent = CL_ROFF_Purge_Ent; cgi.G2_ListModelSurfaces = CL_G2API_ListModelSurfaces; cgi.G2_ListModelBones = CL_G2API_ListModelBones; cgi.G2_SetGhoul2ModelIndexes = CL_G2API_SetGhoul2ModelIndexes; cgi.G2_HaveWeGhoul2Models = CL_G2API_HaveWeGhoul2Models; cgi.G2API_GetBoltMatrix = CL_G2API_GetBoltMatrix; cgi.G2API_GetBoltMatrix_NoReconstruct = CL_G2API_GetBoltMatrix_NoReconstruct; cgi.G2API_GetBoltMatrix_NoRecNoRot = CL_G2API_GetBoltMatrix_NoRecNoRot; cgi.G2API_InitGhoul2Model = CL_G2API_InitGhoul2Model; cgi.G2API_SetSkin = CL_G2API_SetSkin; cgi.G2API_CollisionDetect = CL_G2API_CollisionDetect; cgi.G2API_CollisionDetectCache = CL_G2API_CollisionDetectCache; cgi.G2API_CleanGhoul2Models = CL_G2API_CleanGhoul2Models; cgi.G2API_SetBoneAngles = CL_G2API_SetBoneAngles; cgi.G2API_SetBoneAnim = CL_G2API_SetBoneAnim; cgi.G2API_GetBoneAnim = CL_G2API_GetBoneAnim; cgi.G2API_GetBoneFrame = CL_G2API_GetBoneFrame; cgi.G2API_GetGLAName = CL_G2API_GetGLAName; cgi.G2API_CopyGhoul2Instance = CL_G2API_CopyGhoul2Instance; cgi.G2API_CopySpecificGhoul2Model = CL_G2API_CopySpecificGhoul2Model; cgi.G2API_DuplicateGhoul2Instance = CL_G2API_DuplicateGhoul2Instance; cgi.G2API_HasGhoul2ModelOnIndex = CL_G2API_HasGhoul2ModelOnIndex; cgi.G2API_RemoveGhoul2Model = CL_G2API_RemoveGhoul2Model; cgi.G2API_SkinlessModel = CL_G2API_SkinlessModel; cgi.G2API_GetNumGoreMarks = CL_G2API_GetNumGoreMarks; cgi.G2API_AddSkinGore = CL_G2API_AddSkinGore; cgi.G2API_ClearSkinGore = CL_G2API_ClearSkinGore; cgi.G2API_Ghoul2Size = CL_G2API_Ghoul2Size; cgi.G2API_AddBolt = CL_G2API_AddBolt; cgi.G2API_AttachEnt = CL_G2API_AttachEnt; cgi.G2API_SetBoltInfo = CL_G2API_SetBoltInfo; cgi.G2API_SetRootSurface = CL_G2API_SetRootSurface; cgi.G2API_SetSurfaceOnOff = CL_G2API_SetSurfaceOnOff; cgi.G2API_SetNewOrigin = CL_G2API_SetNewOrigin; cgi.G2API_DoesBoneExist = CL_G2API_DoesBoneExist; cgi.G2API_GetSurfaceRenderStatus = CL_G2API_GetSurfaceRenderStatus; cgi.G2API_GetTime = CL_G2API_GetTime; cgi.G2API_SetTime = CL_G2API_SetTime; cgi.G2API_AbsurdSmoothing = CL_G2API_AbsurdSmoothing; cgi.G2API_SetRagDoll = CL_G2API_SetRagDoll; cgi.G2API_AnimateG2Models = CL_G2API_AnimateG2Models; cgi.G2API_RagPCJConstraint = CL_G2API_RagPCJConstraint; cgi.G2API_RagPCJGradientSpeed = CL_G2API_RagPCJGradientSpeed; cgi.G2API_RagEffectorGoal = CL_G2API_RagEffectorGoal; cgi.G2API_GetRagBonePos = CL_G2API_GetRagBonePos; cgi.G2API_RagEffectorKick = CL_G2API_RagEffectorKick; cgi.G2API_RagForceSolve = CL_G2API_RagForceSolve; cgi.G2API_SetBoneIKState = CL_G2API_SetBoneIKState; cgi.G2API_IKMove = CL_G2API_IKMove; cgi.G2API_RemoveBone = CL_G2API_RemoveBone; cgi.G2API_AttachInstanceToEntNum = CL_G2API_AttachInstanceToEntNum; cgi.G2API_ClearAttachedInstance = CL_G2API_ClearAttachedInstance; cgi.G2API_CleanEntAttachments = CL_G2API_CleanEntAttachments; cgi.G2API_OverrideServer = CL_G2API_OverrideServer; cgi.G2API_GetSurfaceName = CL_G2API_GetSurfaceName; GetCGameAPI = (GetCGameAPI_t)cgvm->GetModuleAPI; ret = GetCGameAPI( CGAME_API_VERSION, &cgi ); if ( !ret ) { //free VM? cls.cgameStarted = qfalse; Com_Error( ERR_FATAL, "GetGameAPI failed on %s", dllName ); } cge = ret; }
void CL_InitUI( void ) { int v; vmInterpret_t interpret; // load the dll or bytecode if ( cl_connectedToPureServer != 0 ) { // if sv_pure is set we only allow qvms to be loaded interpret = VMI_COMPILED; } else { interpret = Cvar_VariableValue( "vm_ui" ); } uivm = VM_Create( "ui", CL_UISystemCalls, interpret ); if ( !uivm ) { Com_Error( ERR_FATAL, "VM_Create on UI failed" ); } // Don't use ui messagemode unless it askes us to Cvar_Set( "ui_useMessagemode", "0" ); // sanity check v = VM_Call( uivm, UI_GETAPIVERSION ); if (v == UI_OLD_API_VERSION || v == UI_API_VERSION) { // init for this gamestate VM_Call( uivm, UI_INIT, (cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE)); } else { Com_Error( ERR_DROP, "User Interface is version %d, expected %d", v, UI_API_VERSION ); cls.uiStarted = qfalse; } // See who gets control of messagemodes if ( !Cvar_VariableIntegerValue( "ui_useMessagemode" ) ) { // client messagemode commands Cmd_RemoveCommand( "messagemode" ); Cmd_RemoveCommand( "messagemode2" ); Cmd_RemoveCommand( "messagemode3" ); Cmd_RemoveCommand( "messagemode4" ); Cmd_RemoveCommand( "messagemode5" ); Cmd_RemoveCommand( "messagemode6" ); Cmd_RemoveCommand( "prompt" ); Cmd_AddCommand( "messagemode", Con_MessageMode_f ); Cmd_AddCommand( "messagemode2", Con_MessageMode2_f ); Cmd_AddCommand( "messagemode3", Con_MessageMode3_f ); Cmd_AddCommand( "messagemode4", Con_MessageMode4_f ); Cmd_AddCommand( "messagemode5", Con_MessageMode5_f ); Cmd_AddCommand( "messagemode6", Con_MessageMode6_f ); Cmd_AddCommand( "prompt", Con_Prompt_f ); } else { // ui messagemode commands Cmd_RemoveCommand( "messagemode" ); Cmd_RemoveCommand( "messagemode2" ); Cmd_RemoveCommand( "messagemode3" ); Cmd_RemoveCommand( "messagemode4" ); Cmd_RemoveCommand( "messagemode5" ); Cmd_RemoveCommand( "messagemode6" ); Cmd_RemoveCommand( "prompt" ); Cmd_AddCommand( "messagemode", NULL ); Cmd_AddCommand( "messagemode2", NULL ); Cmd_AddCommand( "messagemode3", NULL ); Cmd_AddCommand( "messagemode4", NULL ); Cmd_AddCommand( "messagemode5", NULL ); Cmd_AddCommand( "messagemode6", NULL ); Cmd_AddCommand( "prompt", NULL ); } // reset any CVAR_CHEAT cvars registered by ui if ( !clc.demoplaying && !cl_connectedToCheatServer ) Cvar_SetCheatState(); }
/* ==================== CL_InitCGame Should only be called by CL_StartHunkUsers ==================== */ void CL_InitCGame( void ) { const char *info; const char *mapname; int t1, t2; vmInterpret_t interpret; #ifdef SMOKINGUNS int l; char *at; char blockThis[255]; char *buf; char **tempBuf; int capacity = 40; #endif t1 = Sys_Milliseconds(); // Load language filter #ifdef SMOKINGUNS if( !badWords ) { numWords = 0; buf = Cvar_VariableString( "cg_filterWords" ); if( strlen( buf ) > 0 ) { l = 0; badWords = Z_Malloc( capacity * sizeof( char* ) ); at = buf; while( ( at = strchr( buf, ',' ) ) ) { if( ( l-1 ) > capacity ) // ( l-1 ) because we want to leave room for the last word { tempBuf = Z_Malloc( ( capacity + 40 ) * sizeof( char** ) ); Com_Memcpy( tempBuf, badWords, capacity * sizeof( char** ) ); Z_Free( badWords ); badWords = tempBuf; capacity += 40; } strncpy( blockThis, buf, ( strchr( buf, ',' ) - buf ) ); blockThis[( strchr( buf, ',' ) - buf )] = '\0'; badWords[l] = strdup( blockThis ); buf = at + 1; ++l; } badWords[l] = strdup( buf ); ++l; numWords = l; } else Com_Printf( "No filter loaded.\n" ); } #endif // put away the console Con_Close(); // find the current mapname info = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SERVERINFO ]; mapname = Info_ValueForKey( info, "mapname" ); Com_sprintf( cl.mapname, sizeof( cl.mapname ), "maps/%s.bsp", mapname ); // load the dll or bytecode if ( cl_connectedToPureServer != 0 ) { // if sv_pure is set we only allow qvms to be loaded interpret = VMI_COMPILED; } else { interpret = Cvar_VariableValue( "vm_cgame" ); } cgvm = VM_Create( "cgame", CL_CgameSystemCalls, interpret ); if ( !cgvm ) { Com_Error( ERR_DROP, "VM_Create on cgame failed" ); } cls.state = CA_LOADING; // init for this gamestate // use the lastExecutedServerCommand instead of the serverCommandSequence // otherwise server commands sent just before a gamestate are dropped VM_Call( cgvm, CG_INIT, clc.serverMessageSequence, clc.lastExecutedServerCommand, clc.clientNum ); // reset any CVAR_CHEAT cvars registered by cgame if ( !clc.demoplaying && !cl_connectedToCheatServer ) Cvar_SetCheatState(); // we will send a usercmd this frame, which // will cause the server to send us the first snapshot cls.state = CA_PRIMED; t2 = Sys_Milliseconds(); Com_Printf( "CL_InitCGame: %5.2f seconds\n", (t2-t1)/1000.0 ); // have the renderer touch all its images, so they are present // on the card even if the driver does deferred loading re.EndRegistration(); // make sure everything is paged in if (!Sys_LowPhysicalMemory()) { Com_TouchMemory(); } // clear anything that got printed Con_ClearNotify (); }