static void EnableDisableFunc( void *unused ) { if (Cvar_VariableInteger("vr_enabled") > 0) Cmd_ExecuteString("vr_disable"); else Cmd_ExecuteString("vr_enable"); }
static void AntialiasCallback ( void *usused ) { int old = Cvar_VariableInteger("r_antialias"); int newVal = s_antialias_box.curvalue; float oldscale, newscale, ratio; oldscale = R_AntialiasGetScale(); Cvar_SetValue( "r_antialias", newVal); newscale = R_AntialiasGetScale(); if (Cvar_VariableInteger("vr_enabled")) return; ratio = newscale / oldscale; cursor.x *= ratio; cursor.y *= ratio; }
static void VRSetMenuItemValues( void ) { s_options_vr_aimmode_box.curvalue = ( Cvar_VariableValue("vr_aimmode") ); s_options_vr_viewmove_box.curvalue = ( Cvar_VariableValue("vr_viewmove") ); s_options_vr_autoipd_box.curvalue = ( Cvar_VariableValue("vr_autoipd") ); strcpy( s_options_vr_aimmode_deadzone_pitch_field.buffer, vr_aimmode_deadzone_pitch->string ); s_options_vr_aimmode_deadzone_pitch_field.cursor = strlen( vr_aimmode_deadzone_pitch->string ); strcpy( s_options_vr_aimmode_deadzone_yaw_field.buffer, vr_aimmode_deadzone_yaw->string ); s_options_vr_aimmode_deadzone_yaw_field.cursor = strlen( vr_aimmode_deadzone_yaw->string ); strcpy( s_options_vr_hud_deadzone_yaw_field.buffer, vr_hud_deadzone_yaw->string ); s_options_vr_hud_deadzone_yaw_field.cursor = strlen( vr_hud_deadzone_yaw->string ); strcpy( s_options_vr_ipd_field.buffer, vr_ipd->string ); s_options_vr_ipd_field.cursor = strlen( vr_ipd->string ); s_options_vr_walkspeed_slider.curvalue = (int) (( ClampCvar(0.5,1.5, Cvar_VariableValue("vr_walkspeed")) - 0.5) * 10.0); s_options_vr_laser_box.curvalue = ( Cvar_VariableInteger("vr_aimlaser") ); s_options_vr_hud_fixed_box.curvalue = ( Cvar_VariableInteger("vr_hud_fixed") ); }
/* =============== SV_PlayersOnly_f disable physics, except for players =============== */ void SV_PlayersOnly_f( void ) { if( !Cvar_VariableInteger( "sv_cheats" )) return; sv.hostflags = sv.hostflags ^ SVF_PLAYERSONLY; if(!( sv.hostflags & SVF_PLAYERSONLY )) SV_BroadcastPrintf( D_INFO, "Resume server physics\n" ); else SV_BroadcastPrintf( D_INFO, "Freeze server physics\n" ); }
static void VROVRSetMenuItemValues( void ) { s_options_vr_ovr_enable_box.curvalue = ( !! Cvar_VariableInteger("vr_ovr_enable") ); s_options_vr_ovr_maxfov_box.curvalue = ( Cvar_VariableInteger("vr_ovr_maxfov") ); s_options_vr_ovr_debug_box.curvalue = ( Cvar_VariableInteger("vr_ovr_debug") ); s_options_vr_ovr_prediction_box.curvalue = ( Cvar_VariableInteger("vr_ovr_autoprediction") ); s_options_vr_ovr_timewarp_box.curvalue = ( Cvar_VariableInteger("vr_ovr_timewarp") ); s_options_vr_ovr_lowpersistence_box.curvalue = ( Cvar_VariableInteger("vr_ovr_lowpersistence") ); s_options_vr_ovr_lumaoverdrive_box.curvalue = ( Cvar_VariableInteger("vr_ovr_lumoverdrive") ); s_options_vr_ovr_dk2_color_hack_box.curvalue = ( Cvar_VariableInteger("vr_ovr_dk2_color_hack") ); }
/* ============ Cmd_Unlink unlink all commands with flag CVAR_EXTDLL ============ */ void Cmd_Unlink( int group ) { cmd_t *cmd; cmd_t **prev; int count = 0; if( Cvar_VariableInteger( "host_gameloaded" ) && ( group & CMD_EXTDLL )) { Msg( "can't unlink cvars while game is loaded\n" ); return; } if( Cvar_VariableInteger( "host_clientloaded" ) && ( group & CMD_CLIENTDLL )) { Msg( "can't unlink cvars while client is loaded\n" ); return; } prev = &cmd_functions; while( 1 ) { cmd = *prev; if( !cmd ) break; if( group && !( cmd->flags & group )) { prev = &cmd->next; continue; } *prev = cmd->next; if( cmd->name ) Mem_Free( cmd->name ); if( cmd->desc ) Mem_Free( cmd->desc ); Mem_Free( cmd ); count++; } }
static void VRAdvSetMenuItemValues( void ) { s_options_vr_advanced_autoenable_box.curvalue = ( Cvar_VariableInteger("vr_autoenable") ); s_options_vr_advanced_laser_box.curvalue = ( Cvar_VariableInteger("vr_aimlaser") ); s_options_vr_advanced_hud_depth_slider.curvalue = ( Cvar_VariableValue("vr_hud_depth") * 20.0f); s_options_vr_advanced_hud_fov_slider.curvalue = ( Cvar_VariableValue("vr_hud_fov") ); s_options_vr_advanced_hudtrans_box.curvalue = ( Cvar_VariableInteger("vr_hud_transparency") ); s_options_vr_advanced_hudbounce_box.curvalue = ( Cvar_VariableInteger("vr_hud_bounce") ); s_options_vr_advanced_neckmodel_box.curvalue = ( Cvar_VariableValue("vr_neckmodel") ); s_options_vr_advanced_positiontracking_box.curvalue = ( Cvar_VariableValue("vr_positiontracking")); strcpy( s_options_vr_advanced_neckmodel_up_field.buffer, vr_neckmodel_up->string ); s_options_vr_advanced_neckmodel_up_field.cursor = strlen( vr_neckmodel_up->string ); strcpy( s_options_vr_advanced_neckmodel_forward_field.buffer, vr_neckmodel_forward->string ); s_options_vr_advanced_neckmodel_forward_field.cursor = strlen( vr_neckmodel_forward->string ); s_options_vr_advanced_chroma_box.curvalue = ( Cvar_VariableInteger("vr_chromatic") ); strcpy( s_options_vr_advanced_prediction_field.buffer, vr_prediction->string ); s_options_vr_advanced_prediction_field.cursor = strlen( vr_prediction->string ); }
void SCR_DrawPlaque( void ) { int levelshot; if(( cl_allow_levelshots->integer && !cls.changelevel ) || Cvar_VariableInteger( "sv_background" )) { levelshot = GL_LoadTexture( cl_levelshot_name->string, NULL, 0, TF_IMAGE ); GL_SetRenderMode( kRenderNormal ); R_DrawStretchPic( 0, 0, scr_width->integer, scr_height->integer, 0, 0, 1, 1, levelshot ); CL_DrawHUD( CL_LOADING ); } }
static int no_save_games(void) { if (dedicated->integer) return 1; if (!(g_features->integer & GMF_ENHANCED_SAVEGAMES)) return 1; if (Cvar_VariableInteger("deathmatch")) return 1; return 0; }
/* ============ Cmd_Unlink unlink all commands with specified flag ============ */ void Cmd_Unlink( int flag ) { cmd_function_t *cmd; cmd_function_t **prev; int count = 0; if( Cvar_VariableInteger( "host_gameloaded" )) { Msg( "can't unlink cvars while game is loaded\n" ); return; } prev = &cmd_functions; while( 1 ) { cmd = *prev; if( !cmd ) break; if( !( cmd->flags & flag )) { prev = &cmd->next; continue; } *prev = cmd->next; if( cmd->name ) Mem_Free( cmd->name ); if( cmd->desc ) Mem_Free( cmd->desc ); Mem_Free( cmd ); count++; } }
/* ======================== Android_RunEvents Execute all events from queue ======================== */ void Android_RunEvents() { int i; // enter events read Android_Lock(); pthread_mutex_unlock( &events.framemutex ); for( i = 0; i < events.count; i++ ) { switch( events.queue[i].type ) { case event_touch_down: case event_touch_up: case event_touch_move: IN_TouchEvent( events.queue[i].type, events.queue[i].arg, events.queue[i].touch.x, events.queue[i].touch.y, events.queue[i].touch.dx, events.queue[i].touch.dy ); break; case event_key_down: Key_Event( events.queue[i].arg, true ); break; case event_key_up: Key_Event( events.queue[i].arg, false ); break; case event_set_pause: // destroy EGL surface when hiding application if( !events.queue[i].arg ) { host.state = HOST_FRAME; S_Activate( true ); (*jni.env)->CallStaticVoidMethod( jni.env, jni.actcls, jni.toggleEGL, 1 ); Android_UpdateSurface(); Android_SwapInterval( Cvar_VariableInteger( "gl_swapinterval" ) ); } if( events.queue[i].arg ) { host.state = HOST_NOFOCUS; S_Activate( false ); (*jni.env)->CallStaticVoidMethod( jni.env, jni.actcls, jni.toggleEGL, 0 ); negl.valid = false; } break; case event_resize: // reinitialize EGL and change engine screen size if( host.state == HOST_NORMAL && ( scr_width->integer != jni.width || scr_height->integer != jni.height ) ) { (*jni.env)->CallStaticVoidMethod( jni.env, jni.actcls, jni.toggleEGL, 0 ); (*jni.env)->CallStaticVoidMethod( jni.env, jni.actcls, jni.toggleEGL, 1 ); Android_UpdateSurface(); Android_SwapInterval( Cvar_VariableInteger( "gl_swapinterval" ) ); VID_SetMode(); } break; case event_joyadd: Joy_AddEvent( events.queue[i].arg ); break; case event_joyremove: Joy_RemoveEvent( events.queue[i].arg ); break; case event_joyball: Joy_BallMotionEvent( events.queue[i].arg, events.queue[i].ball.ball, events.queue[i].ball.xrel, events.queue[i].ball.yrel ); break; case event_joyhat: Joy_HatMotionEvent( events.queue[i].arg, events.queue[i].hat.hat, events.queue[i].hat.key ); break; case event_joyaxis: Joy_AxisMotionEvent( events.queue[i].arg, events.queue[i].axis.axis, events.queue[i].axis.val ); break; case event_joybutton: Joy_ButtonEvent( events.queue[i].arg, events.queue[i].button.button, (byte)events.queue[i].button.down ); break; } } events.count = 0; // no more events // text input handled separately to allow unicode symbols for( i = 0; events.inputtext[i]; i++ ) { int ch; // if engine does not use utf-8, we need to convert it to preferred encoding if( !Q_stricmp( cl_charset->string, "utf-8" ) ) ch = (unsigned char)events.inputtext[i]; else ch = Con_UtfProcessCharForce( (unsigned char)events.inputtext[i] ); if( !ch ) continue; // otherwise just push it by char, text render will decode unicode strings Con_CharEvent( ch ); if( cls.key_dest == key_menu ) UI_CharEvent ( ch ); } events.inputtext[0] = 0; // no more text //end events read Android_Unlock(); pthread_mutex_lock( &events.framemutex ); }
/* ============== SV_InitGame A brand new game has been started ============== */ void SV_InitGame( void ) { edict_t *ent; int i; if( svs.initialized ) { // cause any connected clients to reconnect Q_strncpy( host.finalmsg, "Server restarted", MAX_STRING ); SV_Shutdown( true ); } else { // init game after host error if( !svgame.hInstance ) { if( !SV_LoadProgs( GI->game_dll )) { MsgDev( D_ERROR, "SV_InitGame: can't initialize %s\n", GI->game_dll ); return; // can't load } MsgDev( D_INFO, "Server loaded\n" ); } // make sure the client is down CL_Drop(); } // now apply latched commands Cmd_ExecuteString( "latch\n", src_command ); if( Cvar_VariableValue( "coop" ) && Cvar_VariableValue ( "deathmatch" ) && Cvar_VariableValue( "teamplay" )) { MsgDev( D_WARN, "Deathmatch, Teamplay and Coop set, defaulting to Deathmatch\n"); Cvar_FullSet( "coop", "0", CVAR_LATCH ); Cvar_FullSet( "teamplay", "0", CVAR_LATCH ); } // dedicated servers are can't be single player and are usually DM // so unless they explicity set coop, force it to deathmatch if( host.type == HOST_DEDICATED ) { if( !Cvar_VariableValue( "coop" ) && !Cvar_VariableValue( "teamplay" )) Cvar_FullSet( "deathmatch", "1", CVAR_LATCH ); } // init clients if( Cvar_VariableValue( "deathmatch" ) || Cvar_VariableValue( "teamplay" )) { if( sv_maxclients->integer <= 1 ) Cvar_FullSet( "maxplayers", "8", CVAR_LATCH ); else if( sv_maxclients->integer > MAX_CLIENTS ) Cvar_FullSet( "maxplayers", "32", CVAR_LATCH ); } else if( Cvar_VariableValue( "coop" )) { if( sv_maxclients->integer <= 1 || sv_maxclients->integer > 4 ) Cvar_FullSet( "maxplayers", "4", CVAR_LATCH ); } else { // non-deathmatch, non-coop is one player Cvar_FullSet( "maxplayers", "1", CVAR_LATCH ); } svgame.globals->maxClients = sv_maxclients->integer; SV_UPDATE_BACKUP = ( svgame.globals->maxClients == 1 ) ? SINGLEPLAYER_BACKUP : MULTIPLAYER_BACKUP; svs.clients = Z_Malloc( sizeof( sv_client_t ) * sv_maxclients->integer ); svs.num_client_entities = sv_maxclients->integer * SV_UPDATE_BACKUP * 64; svs.packet_entities = Z_Malloc( sizeof( entity_state_t ) * svs.num_client_entities ); svs.baselines = Z_Malloc( sizeof( entity_state_t ) * GI->max_edicts ); // client frames will be allocated in SV_DirectConnect // init network stuff NET_Config(( sv_maxclients->integer > 1 )); // copy gamemode into svgame.globals svgame.globals->deathmatch = Cvar_VariableInteger( "deathmatch" ); svgame.globals->teamplay = Cvar_VariableInteger( "teamplay" ); svgame.globals->coop = Cvar_VariableInteger( "coop" ); // heartbeats will always be sent to the id master svs.last_heartbeat = MAX_HEARTBEAT; // send immediately // set client fields on player ents for( i = 0; i < svgame.globals->maxClients; i++ ) { // setup all the clients ent = EDICT_NUM( i + 1 ); SV_InitEdict( ent ); svs.clients[i].edict = ent; } // get actual movevars SV_UpdateMovevars( true ); svgame.numEntities = svgame.globals->maxClients + 1; // clients + world svs.initialized = true; }
/* ================= UI_CreateGame_Init ================= */ static void UI_CreateGame_Init( void ) { Mem_Set( &uiCreateGame, 0, sizeof( uiCreateGame_t )); com.strncat( uiCreateGame.hintText, "Map", MAPNAME_LENGTH ); com.strncat( uiCreateGame.hintText, uiEmptyString, MAPNAME_LENGTH ); com.strncat( uiCreateGame.hintText, "Title", TITLE_LENGTH ); com.strncat( uiCreateGame.hintText, uiEmptyString, TITLE_LENGTH ); uiCreateGame.background.generic.id = ID_BACKGROUND; uiCreateGame.background.generic.type = QMTYPE_BITMAP; uiCreateGame.background.generic.flags = QMF_INACTIVE; uiCreateGame.background.generic.x = 0; uiCreateGame.background.generic.y = 0; uiCreateGame.background.generic.width = 1024; uiCreateGame.background.generic.height = 768; uiCreateGame.background.pic = ART_BACKGROUND; uiCreateGame.banner.generic.id = ID_BANNER; uiCreateGame.banner.generic.type = QMTYPE_BITMAP; uiCreateGame.banner.generic.flags = QMF_INACTIVE; uiCreateGame.banner.generic.x = UI_BANNER_POSX; uiCreateGame.banner.generic.y = UI_BANNER_POSY; uiCreateGame.banner.generic.width = UI_BANNER_WIDTH; uiCreateGame.banner.generic.height = UI_BANNER_HEIGHT; uiCreateGame.banner.pic = ART_BANNER; uiCreateGame.advOptions.generic.id = ID_ADVOPTIONS; uiCreateGame.advOptions.generic.type = QMTYPE_ACTION; uiCreateGame.advOptions.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_GRAYED; uiCreateGame.advOptions.generic.x = 72; uiCreateGame.advOptions.generic.y = 230; uiCreateGame.advOptions.generic.name = "Adv. Options"; uiCreateGame.advOptions.generic.statusText = "Open the LAN game advanced options menu"; uiCreateGame.advOptions.generic.callback = UI_CreateGame_Callback; uiCreateGame.done.generic.id = ID_DONE; uiCreateGame.done.generic.type = QMTYPE_ACTION; uiCreateGame.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW; uiCreateGame.done.generic.x = 72; uiCreateGame.done.generic.y = 280; uiCreateGame.done.generic.name = "Ok"; uiCreateGame.done.generic.statusText = "Start the multiplayer game"; uiCreateGame.done.generic.callback = UI_CreateGame_Callback; uiCreateGame.cancel.generic.id = ID_CANCEL; uiCreateGame.cancel.generic.type = QMTYPE_ACTION; uiCreateGame.cancel.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW; uiCreateGame.cancel.generic.x = 72; uiCreateGame.cancel.generic.y = 330; uiCreateGame.cancel.generic.name = "Cancel"; uiCreateGame.cancel.generic.statusText = "Return to LAN game menu"; uiCreateGame.cancel.generic.callback = UI_CreateGame_Callback; uiCreateGame.dedicatedServer.generic.id = ID_DEDICATED; uiCreateGame.dedicatedServer.generic.type = QMTYPE_CHECKBOX; uiCreateGame.dedicatedServer.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW; uiCreateGame.dedicatedServer.generic.name = "Dedicated server"; uiCreateGame.dedicatedServer.generic.x = 72; uiCreateGame.dedicatedServer.generic.y = 685; uiCreateGame.dedicatedServer.generic.callback = UI_CreateGame_Callback; uiCreateGame.dedicatedServer.generic.statusText = "faster, but you can't join the server from this machine"; uiCreateGame.hintMessage.generic.id = ID_TABLEHINT; uiCreateGame.hintMessage.generic.type = QMTYPE_ACTION; uiCreateGame.hintMessage.generic.flags = QMF_INACTIVE|QMF_SMALLFONT; uiCreateGame.hintMessage.generic.color = uiColorHelp; uiCreateGame.hintMessage.generic.name = uiCreateGame.hintText; uiCreateGame.hintMessage.generic.x = 590; uiCreateGame.hintMessage.generic.y = 215; uiCreateGame.mapsList.generic.id = ID_MAPLIST; uiCreateGame.mapsList.generic.type = QMTYPE_SCROLLLIST; uiCreateGame.mapsList.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_SMALLFONT; uiCreateGame.mapsList.generic.x = 590; uiCreateGame.mapsList.generic.y = 245; uiCreateGame.mapsList.generic.width = 410; uiCreateGame.mapsList.generic.height = 440; uiCreateGame.mapsList.generic.callback = UI_CreateGame_Callback; uiCreateGame.hostName.generic.id = ID_HOSTNAME; uiCreateGame.hostName.generic.type = QMTYPE_FIELD; uiCreateGame.hostName.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW; uiCreateGame.hostName.generic.name = "Server Name:"; uiCreateGame.hostName.generic.x = 350; uiCreateGame.hostName.generic.y = 260; uiCreateGame.hostName.generic.width = 205; uiCreateGame.hostName.generic.height = 32; uiCreateGame.hostName.generic.callback = UI_CreateGame_Callback; uiCreateGame.hostName.maxLength = 16; com.strncpy( uiCreateGame.hostName.buffer, Cvar_VariableString( "sv_hostname" ), sizeof( uiCreateGame.hostName.buffer )); uiCreateGame.maxClients.generic.id = ID_MAXCLIENTS; uiCreateGame.maxClients.generic.type = QMTYPE_FIELD; uiCreateGame.maxClients.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NUMBERSONLY; uiCreateGame.maxClients.generic.name = "Max Players:"; uiCreateGame.maxClients.generic.x = 350; uiCreateGame.maxClients.generic.y = 360; uiCreateGame.maxClients.generic.width = 205; uiCreateGame.maxClients.generic.height = 32; uiCreateGame.maxClients.maxLength = 3; if( Cvar_VariableInteger( "sv_maxclients" ) <= 1 ) com.snprintf( uiCreateGame.maxClients.buffer, sizeof( uiCreateGame.maxClients.buffer ), "8" ); else com.snprintf( uiCreateGame.maxClients.buffer, sizeof( uiCreateGame.maxClients.buffer ), "%i", Cvar_VariableInteger( "sv_maxclients" )); uiCreateGame.password.generic.id = ID_PASSWORD; uiCreateGame.password.generic.type = QMTYPE_FIELD; uiCreateGame.password.generic.flags = QMF_CENTER_JUSTIFY|QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW; uiCreateGame.password.generic.name = "Password:"******"Starting a new game will exit"; uiCreateGame.dlgMessage1.generic.x = 248; uiCreateGame.dlgMessage1.generic.y = 280; uiCreateGame.dlgMessage2.generic.id = ID_MSGTEXT; uiCreateGame.dlgMessage2.generic.type = QMTYPE_ACTION; uiCreateGame.dlgMessage2.generic.flags = QMF_INACTIVE|QMF_HIDDEN; uiCreateGame.dlgMessage2.generic.name = "any current game, OK to exit?"; uiCreateGame.dlgMessage2.generic.x = 248; uiCreateGame.dlgMessage2.generic.y = 310; uiCreateGame.yes.generic.id = ID_YES; uiCreateGame.yes.generic.type = QMTYPE_ACTION; uiCreateGame.yes.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_HIDDEN; uiCreateGame.yes.generic.name = "Ok"; uiCreateGame.yes.generic.x = 380; uiCreateGame.yes.generic.y = 460; uiCreateGame.yes.generic.callback = UI_CreateGame_Callback; uiCreateGame.no.generic.id = ID_NO; uiCreateGame.no.generic.type = QMTYPE_ACTION; uiCreateGame.no.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_HIDDEN; uiCreateGame.no.generic.name = "Cancel"; uiCreateGame.no.generic.x = 530; uiCreateGame.no.generic.y = 460; uiCreateGame.no.generic.callback = UI_CreateGame_Callback; UI_CreateGame_GetMapsList(); if( !Host_ServerState()) SV_LoadProgs( "server" ); // force to get user mp_variables UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.background ); UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.banner ); UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.advOptions ); UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.done ); UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.cancel ); UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.maxClients ); UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.hostName ); UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.password ); UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.dedicatedServer ); UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.hintMessage ); UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.mapsList ); UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.msgBox ); UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.dlgMessage1 ); UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.dlgMessage2 ); UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.no ); UI_AddItem( &uiCreateGame.menu, (void *)&uiCreateGame.yes ); }
/* ================ Menu_Video_Init ================ */ void Menu_Video_Init (void) { // Knightmare- added 1280x1024, 1400x1050, 856x480, 1024x480 modes, removed 320x240, 400x300, 512x384 modes static const char *resolutions[] = { "[640x480 ]", "[800x600 ]", "[1024x768 ]", "[1280x960 ]", "[1280x1024]", // Knightmare added "[1600x1200]", "[1280x720 ]", // Knightmare added "[1280x768 ]", // Knightmare added "[1280x800 ]", // Knightmare added "[1360x768 ]", // Knightmare added "[1366x768 ]", // Knightmare added "[1440x900 ]", // Knightmare added "[1600x900 ]", // Knightmare added "[1680x1050]", // Knightmare added "[1920x1080]", // Knightmare added "[1920x1200]", // Knightmare added "[2560x1440]", // Knightmare added "[2560x1600]", // Knightmare added "[custom ]", 0 }; static const char *refreshrate_names[] = { "[default]", "[60Hz ]", "[70Hz ]", "[72Hz ]", "[75Hz ]", "[85Hz ]", "[100Hz ]", "[110Hz ]", "[120Hz ]", "[150Hz ]", 0 }; static const char *yesno_names[] = { "no", "yes", 0 }; static const char *sync_names[] = { "no", "vsync", "late frame", 0 }; static const char *mip_names[] = { "bilinear", "trilinear", 0 }; static const char *lmh_names[] = { "low", "medium", "high", "highest", 0 }; static const char *vsync_names[] = { "no", "yes", "adaptive", 0 }; static const char *antialias_names[] = { "off", "4x SSAA", "FXAA", "FXAA FSS", 0 }; static const char *compression_names[] = { "off", "low quality", "high quality", 0 }; int32_t y = 0; float temp; int32_t i; // int32_t j = sizeof(vid_modes) / sizeof(vidmode_t); for (i = 0; i < NUM_VIDEO_MODES; i++) { if (vid_modes[i].width == Cvar_VariableInteger("vid_width") && vid_modes[i].height == Cvar_VariableInteger("vid_height") ) break; } temp = i; if ( !con_font_size ) con_font_size = Cvar_Get ("con_font_size", "8", CVAR_ARCHIVE); s_video_menu.x = SCREEN_WIDTH*0.5; // s_video_menu.x = viddef.width * 0.50; s_video_menu.y = SCREEN_HEIGHT*0.5 - 80; s_video_menu.nitems = 0; s_mode_list.generic.type = MTYPE_SPINCONTROL; s_mode_list.generic.name = "video mode"; s_mode_list.generic.x = 0; s_mode_list.generic.y = y; s_mode_list.itemnames = resolutions; s_mode_list.curvalue = temp; // offset for getting rid of < 640x480 resolutions s_mode_list.generic.statusbar = "changes screen resolution"; if (glConfig.ext_framebuffer_object) { s_antialias_box.generic.type = MTYPE_SPINCONTROL; s_antialias_box.generic.x = 0; s_antialias_box.generic.y = y += MENU_LINE_SIZE; s_antialias_box.generic.name = "anti-aliasing"; s_antialias_box.generic.callback = AntialiasCallback; s_antialias_box.curvalue = Cvar_VariableInteger("r_antialias"); s_antialias_box.itemnames = antialias_names; s_antialias_box.generic.statusbar = "selects a software post-processing antialiasing technique"; } s_fs_box.generic.type = MTYPE_SPINCONTROL; s_fs_box.generic.x = 0; s_fs_box.generic.y = y += MENU_LINE_SIZE; s_fs_box.generic.name = "fullscreen"; s_fs_box.itemnames = yesno_names; s_fs_box.curvalue = Cvar_VariableValue("vid_fullscreen"); s_fs_box.generic.statusbar = "changes bettween fullscreen and windowed display"; s_brightness_slider.generic.type = MTYPE_SLIDER; s_brightness_slider.generic.x = 0; s_brightness_slider.generic.y = y += 2 * MENU_LINE_SIZE; s_brightness_slider.generic.name = "brightness"; s_brightness_slider.generic.callback = BrightnessCallback; s_brightness_slider.minvalue = 0; s_brightness_slider.maxvalue = 20; s_brightness_slider.curvalue = Cvar_VariableValue("vid_brightness") * 20.0f; s_brightness_slider.generic.statusbar = "changes display brightness"; s_texfilter_box.generic.type = MTYPE_SPINCONTROL; s_texfilter_box.generic.x = 0; s_texfilter_box.generic.y = y += 2*MENU_LINE_SIZE; s_texfilter_box.generic.name = "texture filter"; s_texfilter_box.curvalue = texfilter_box_setval(); s_texfilter_box.itemnames = mip_names; s_texfilter_box.generic.statusbar = "changes texture filtering mode"; s_aniso_box.generic.type = MTYPE_SPINCONTROL; s_aniso_box.generic.x = 0; s_aniso_box.generic.y = y += MENU_LINE_SIZE; s_aniso_box.generic.name = "anisotropic filter"; s_aniso_box.curvalue = GetAnisoCurValue(); s_aniso_box.itemnames = GetAnisoNames(); s_aniso_box.generic.statusbar = "changes level of anisotropic mipmap filtering"; s_texqual_box.generic.type = MTYPE_SPINCONTROL; s_texqual_box.generic.x = 0; s_texqual_box.generic.y = y += MENU_LINE_SIZE; s_texqual_box.generic.name = "texture quality"; s_texqual_box.curvalue = ClampCvar (0, 3, 3-Cvar_VariableValue("r_picmip")); s_texqual_box.itemnames = lmh_names; s_texqual_box.generic.statusbar = "changes maximum texture size (highest = no limit)"; if (glConfig.ext_texture_compression_s3tc || glConfig.arb_texture_compression_bptc) { s_texcompress_box.generic.type = MTYPE_SPINCONTROL; s_texcompress_box.generic.x = 0; s_texcompress_box.generic.y = y += MENU_LINE_SIZE; s_texcompress_box.generic.name = "texture compression"; s_texcompress_box.itemnames = compression_names; s_texcompress_box.curvalue = ClampCvar(0,2,Cvar_VariableValue("r_texturecompression")); s_texcompress_box.generic.statusbar = "enables texture compression"; } s_vsync_box.generic.type = MTYPE_SPINCONTROL; s_vsync_box.generic.x = 0; s_vsync_box.generic.y = y += 2*MENU_LINE_SIZE; s_vsync_box.generic.name = "video sync"; s_vsync_box.generic.callback = VsyncCallback; if (glConfig.ext_swap_control_tear) { int32_t temp = !!Cvar_VariableInteger("r_swapinterval"); temp += temp ? !!Cvar_VariableInteger("r_adaptivevsync") : 0; s_vsync_box.curvalue = temp; s_vsync_box.itemnames = vsync_names; } else { s_vsync_box.curvalue = !!Cvar_VariableValue("r_swapinterval"); s_vsync_box.itemnames = yesno_names; } s_vsync_box.generic.statusbar = "sync framerate with monitor refresh"; if (glConfig.arb_sync) { s_fencesync_box.generic.type = MTYPE_SPINCONTROL; s_fencesync_box.generic.x = 0; s_fencesync_box.generic.y = y += MENU_LINE_SIZE; s_fencesync_box.generic.name = "gpu frame pacing"; s_fencesync_box.generic.callback = FenceSyncCallback; s_fencesync_box.curvalue = ClampCvar(0,2, abs(Cvar_VariableInteger("r_fencesync"))); s_fencesync_box.itemnames = sync_names; s_fencesync_box.generic.statusbar = "forces the gpu to synchronize after monitor refresh"; } // Knightmare- refresh rate option s_refresh_box.generic.type = MTYPE_SPINCONTROL; s_refresh_box.generic.x = 0; s_refresh_box.generic.y = y += MENU_LINE_SIZE; s_refresh_box.generic.name = "refresh rate"; s_refresh_box.curvalue = refresh_box_setval(); s_refresh_box.itemnames = refreshrate_names; s_refresh_box.generic.statusbar = "sets refresh rate for fullscreen modes"; s_advanced_action.generic.type = MTYPE_ACTION; s_advanced_action.generic.name = "advanced options"; s_advanced_action.generic.x = 0; s_advanced_action.generic.y = y += 3*MENU_LINE_SIZE; s_advanced_action.generic.callback = AdvancedOptions; s_defaults_action.generic.type = MTYPE_ACTION; s_defaults_action.generic.name = "reset to defaults"; s_defaults_action.generic.x = 0; s_defaults_action.generic.y = y += 3*MENU_LINE_SIZE; s_defaults_action.generic.callback = ResetVideoDefaults; s_defaults_action.generic.statusbar = "resets all video settings to internal defaults"; // changed cancel to apply changes, thanx to MrG s_apply_action.generic.type = MTYPE_ACTION; s_apply_action.generic.name = "apply changes"; s_apply_action.generic.x = 0; s_apply_action.generic.y = y += 2*MENU_LINE_SIZE; s_apply_action.generic.callback = ApplyChanges; s_backmain_action.generic.type = MTYPE_ACTION; s_backmain_action.generic.name = "back to main"; s_backmain_action.generic.x = 0; s_backmain_action.generic.y = y += 2*MENU_LINE_SIZE; s_backmain_action.generic.callback = UI_BackMenu; Menu_AddItem( &s_video_menu, ( void * ) &s_mode_list ); if (glConfig.ext_framebuffer_object) Menu_AddItem( &s_video_menu, ( void * ) &s_antialias_box ); Menu_AddItem( &s_video_menu, ( void * ) &s_fs_box ); Menu_AddItem( &s_video_menu, ( void * ) &s_brightness_slider ); Menu_AddItem( &s_video_menu, ( void * ) &s_texfilter_box ); Menu_AddItem( &s_video_menu, ( void * ) &s_aniso_box ); Menu_AddItem( &s_video_menu, ( void * ) &s_texqual_box ); // Menu_AddItem( &s_video_menu, ( void * ) &s_npot_mipmap_box ); if (glConfig.ext_texture_compression_s3tc) Menu_AddItem( &s_video_menu, ( void * ) &s_texcompress_box ); Menu_AddItem( &s_video_menu, ( void * ) &s_vsync_box ); if (glConfig.arb_sync) Menu_AddItem( &s_video_menu, ( void * ) &s_fencesync_box ); Menu_AddItem( &s_video_menu, ( void * ) &s_refresh_box ); Menu_AddItem( &s_video_menu, ( void * ) &s_advanced_action ); Menu_AddItem( &s_video_menu, ( void * ) &s_defaults_action ); Menu_AddItem( &s_video_menu, ( void * ) &s_apply_action ); Menu_AddItem( &s_video_menu, ( void * ) &s_backmain_action ); // Menu_Center( &s_video_menu ); // s_video_menu.x -= MENU_FONT_SIZE; }
static void SV_Savegame_f(void) { char *dir; if (sv.state != ss_game) { Com_Printf("You must be in a game to save.\n"); return; } if (dedicated->integer) { Com_Printf("Savegames are for listen servers only.\n"); return; } // don't bother saving if we can't read them back! if (!(g_features->integer & GMF_ENHANCED_SAVEGAMES)) { Com_Printf("Game does not support enhanced savegames.\n"); return; } if (Cvar_VariableInteger("deathmatch")) { Com_Printf("Can't savegame in a deathmatch.\n"); return; } if (sv_maxclients->integer == 1 && svs.client_pool[0].edict->client->ps.stats[STAT_HEALTH] <= 0) { Com_Printf("Can't savegame while dead!\n"); return; } if (Cmd_Argc() != 2) { Com_Printf("Usage: %s <directory>\n", Cmd_Argv(0)); return; } dir = Cmd_Argv(1); if (!COM_IsPath(dir)) { Com_Printf("Bad savedir.\n"); return; } // archive current level, including all client edicts. // when the level is reloaded, they will be shells awaiting // a connecting client if (write_level_file()) { Com_Printf("Couldn't write level file.\n"); return; } // save server state if (write_server_file(qfalse)) { Com_Printf("Couldn't write server file.\n"); return; } // clear whatever savegames are there if (wipe_save_dir(dir)) { Com_Printf("Couldn't wipe '%s' directory.\n", dir); return; } // copy it off if (copy_save_dir(SAVE_CURRENT, dir)) { Com_Printf("Couldn't write '%s' directory.\n", dir); return; } Com_Printf("Game saved.\n"); }
/* ============== SV_InitGame A brand new game has been started. If mvd_spawn is non-zero, load the built-in MVD game module. ============== */ void SV_InitGame( unsigned mvd_spawn ) { int i, entnum; edict_t *ent; client_t *client; if( svs.initialized ) { // cause any connected clients to reconnect SV_Shutdown( "Server restarted\n", ERR_RECONNECT | mvd_spawn ); } else { #if USE_CLIENT // make sure the client is down CL_Disconnect( ERR_RECONNECT ); SCR_BeginLoadingPlaque(); #endif CM_FreeMap( &sv.cm ); SV_FreeFile( sv.entitystring ); memset( &sv, 0, sizeof( sv ) ); #if USE_FPS // set up default frametime for main loop sv.frametime = BASE_FRAMETIME; #endif } // get any latched variable changes (maxclients, etc) Cvar_GetLatchedVars (); #if !USE_CLIENT Cvar_Reset( sv_recycle ); #endif if( mvd_spawn ) { Cvar_Set( "deathmatch", "1" ); Cvar_Set( "coop", "0" ); } else { if( Cvar_VariableInteger( "coop" ) && Cvar_VariableInteger( "deathmatch" ) ) { Com_Printf( "Deathmatch and Coop both set, disabling Coop\n" ); Cvar_Set( "coop", "0" ); } // dedicated servers can't be single player and are usually DM // so unless they explicity set coop, force it to deathmatch if( Com_IsDedicated() ) { if( !Cvar_VariableInteger( "coop" ) ) Cvar_Set( "deathmatch", "1" ); } } // init clients if( Cvar_VariableInteger( "deathmatch" ) ) { if( sv_maxclients->integer <= 1 ) { Cvar_SetInteger( sv_maxclients, 8, FROM_CODE ); } else if( sv_maxclients->integer > CLIENTNUM_RESERVED ) { Cvar_SetInteger( sv_maxclients, CLIENTNUM_RESERVED, FROM_CODE ); } } else if( Cvar_VariableInteger( "coop" ) ) { if( sv_maxclients->integer <= 1 || sv_maxclients->integer > 4 ) Cvar_Set( "maxclients", "4" ); } else { // non-deathmatch, non-coop is one player Cvar_FullSet( "maxclients", "1", CVAR_SERVERINFO|CVAR_LATCH, FROM_CODE ); } // enable networking if( sv_maxclients->integer > 1 ) { NET_Config( NET_SERVER ); } svs.client_pool = SV_Mallocz( sizeof( client_t ) * sv_maxclients->integer ); svs.num_entities = sv_maxclients->integer * UPDATE_BACKUP * MAX_PACKET_ENTITIES; svs.entities = SV_Mallocz( sizeof( entity_state_t ) * svs.num_entities ); #if USE_MVD_SERVER // initialize MVD server if( !mvd_spawn ) { SV_MvdInit(); } #endif Cvar_ClampInteger( sv_reserved_slots, 0, sv_maxclients->integer - 1 ); #if USE_ZLIB svs.z.zalloc = SV_Zalloc; svs.z.zfree = SV_Zfree; if( deflateInit2( &svs.z, Z_DEFAULT_COMPRESSION, Z_DEFLATED, -MAX_WBITS, 9, Z_DEFAULT_STRATEGY ) != Z_OK ) { Com_Error( ERR_FATAL, "%s: deflateInit2() failed", __func__ ); } #endif // init game #if USE_MVD_CLIENT if( mvd_spawn ) { if( ge ) { SV_ShutdownGameProgs(); } ge = &mvd_ge; ge->Init(); } else #endif SV_InitGameProgs(); // send heartbeat very soon svs.last_heartbeat = -(HEARTBEAT_SECONDS-5)*1000; for( i = 0; i < sv_maxclients->integer; i++ ) { client = svs.client_pool + i; entnum = i + 1; ent = EDICT_NUM( entnum ); ent->s.number = entnum; client->edict = ent; client->number = i; } #if USE_AC_SERVER AC_Connect( mvd_spawn ); #endif svs.initialized = qtrue; }
/* ================ SV_SpawnServer Change the server to a new map, taking all connected clients along with it. ================ */ void SV_SpawnServer( cm_t *cm, const char *server, const char *spawnpoint ) { int i; client_t *client; #if USE_CLIENT SCR_BeginLoadingPlaque(); // for local system #endif Com_Printf( "------- Server Initialization -------\n" ); Com_Printf( "SpawnServer: %s\n", server ); // everyone needs to reconnect FOR_EACH_CLIENT( client ) { SV_ClientReset( client ); } SV_BroadcastCommand( "changing map=%s\n", server ); SV_SendClientMessages(); SV_SendAsyncPackets(); // free current level CM_FreeMap( &sv.cm ); SV_FreeFile( sv.entitystring ); // wipe the entire per-level structure memset( &sv, 0, sizeof( sv ) ); sv.spawncount = ( rand() | ( rand() << 16 ) ) ^ Sys_Milliseconds(); sv.spawncount &= 0x7FFFFFFF; // set legacy spawncounts FOR_EACH_CLIENT( client ) { client->spawncount = sv.spawncount; } // reset entity counter svs.next_entity = 0; #if USE_FPS // set framerate parameters set_frame_time(); #endif // save name for levels that don't set message Q_strlcpy( sv.configstrings[CS_NAME], server, MAX_QPATH ); Q_strlcpy( sv.name, server, sizeof( sv.name ) ); if( Cvar_VariableInteger( "deathmatch" ) ) { sprintf( sv.configstrings[CS_AIRACCEL], "%d", sv_airaccelerate->integer ); } else { strcpy( sv.configstrings[CS_AIRACCEL], "0" ); } #if !USE_CLIENT resolve_masters(); #endif override_entity_string( server ); sv.cm = *cm; sprintf( sv.configstrings[CS_MAPCHECKSUM], "%d", ( int )cm->cache->checksum ); // set inline model names Q_concat( sv.configstrings[CS_MODELS + 1], MAX_QPATH, "maps/", server, ".bsp", NULL ); for( i = 1; i < cm->cache->nummodels; i++ ) { sprintf( sv.configstrings[ CS_MODELS + 1 + i ], "*%d", i ); } // // clear physics interaction links // SV_ClearWorld(); // // spawn the rest of the entities on the map // // precache and static commands can be issued during // map initialization sv.state = ss_loading; X86_PUSH_FPCW; X86_SINGLE_FPCW; // load and spawn all other entities ge->SpawnEntities ( sv.name, sv.entitystring ? sv.entitystring : cm->cache->entitystring, spawnpoint ); // run two frames to allow everything to settle ge->RunFrame (); sv.framenum++; ge->RunFrame (); sv.framenum++; X86_POP_FPCW; // make sure maxclients string is correct sprintf( sv.configstrings[CS_MAXCLIENTS], "%d", sv_maxclients->integer ); // all precaches are complete sv.state = ss_game; #if USE_MVD_SERVER // respawn dummy MVD client, set base states, etc SV_MvdMapChanged(); #endif // set serverinfo variable SV_InfoSet( "mapname", sv.name ); SV_InfoSet( "port", net_port->string ); Cvar_SetInteger( sv_running, ss_game, FROM_CODE ); Cvar_Set( "sv_paused", "0" ); Cvar_Set( "timedemo", "0" ); EXEC_TRIGGER( sv_changemapcmd ); #if USE_SYSCON SV_SetConsoleTitle(); #endif SV_BroadcastCommand( "reconnect\n" ); Com_Printf ("-------------------------------------\n"); }
// these cvars will be duplicated on each client across network int Host_ServerState( void ) { return Cvar_VariableInteger( "host_serverstate" ); }
/* ================ SV_SpawnServer Change the server to a new map, taking all connected clients along with it. ================ */ qboolean SV_SpawnServer( const char *mapname, const char *startspot ) { int i, current_skill; qboolean loadgame, paused; qboolean background, changelevel; // save state loadgame = sv.loadgame; background = sv.background; changelevel = sv.changelevel; paused = sv.paused; if( sv.state == ss_dead ) SV_InitGame(); // the game is just starting else if( !sv_maxclients->modified ) Cmd_ExecuteString( "latch\n", src_command ); else MsgDev( D_ERROR, "SV_SpawnServer: while 'maxplayers' was modified.\n" ); sv_maxclients->modified = false; deathmatch->modified = false; teamplay->modified = false; coop->modified = false; if( !svs.initialized ) return false; svgame.globals->changelevel = false; // will be restored later if needed svs.timestart = Sys_DoubleTime(); svs.spawncount++; // any partially connected client will be restarted if( startspot ) { MsgDev( D_INFO, "Spawn Server: %s [%s]\n", mapname, startspot ); } else { MsgDev( D_INFO, "Spawn Server: %s\n", mapname ); } sv.state = ss_dead; Host_SetServerState( sv.state ); Q_memset( &sv, 0, sizeof( sv )); // wipe the entire per-level structure // restore state sv.paused = paused; sv.loadgame = loadgame; sv.background = background; sv.changelevel = changelevel; sv.time = 1.0f; // server spawn time it's always 1.0 second svgame.globals->time = sv.time; // initialize buffers BF_Init( &sv.datagram, "Datagram", sv.datagram_buf, sizeof( sv.datagram_buf )); BF_Init( &sv.reliable_datagram, "Datagram R", sv.reliable_datagram_buf, sizeof( sv.reliable_datagram_buf )); BF_Init( &sv.multicast, "Multicast", sv.multicast_buf, sizeof( sv.multicast_buf )); BF_Init( &sv.signon, "Signon", sv.signon_buf, sizeof( sv.signon_buf )); BF_Init( &sv.spectator_datagram, "Spectator Datagram", sv.spectator_buf, sizeof( sv.spectator_buf )); // leave slots at start for clients only for( i = 0; i < sv_maxclients->integer; i++ ) { // needs to reconnect if( svs.clients[i].state > cs_connected ) svs.clients[i].state = cs_connected; } // make cvars consistant if( Cvar_VariableInteger( "coop" )) Cvar_SetFloat( "deathmatch", 0 ); current_skill = (int)(Cvar_VariableValue( "skill" ) + 0.5f); current_skill = bound( 0, current_skill, 3 ); Cvar_SetFloat( "skill", (float)current_skill ); if( sv.background ) { // tell the game parts about background state Cvar_FullSet( "sv_background", "1", CVAR_READ_ONLY ); Cvar_FullSet( "cl_background", "1", CVAR_READ_ONLY ); } else { Cvar_FullSet( "sv_background", "0", CVAR_READ_ONLY ); Cvar_FullSet( "cl_background", "0", CVAR_READ_ONLY ); } // make sure what server name doesn't contain path and extension FS_FileBase( mapname, sv.name ); if( startspot ) Q_strncpy( sv.startspot, startspot, sizeof( sv.startspot )); else sv.startspot[0] = '\0'; Q_snprintf( sv.model_precache[1], sizeof( sv.model_precache[0] ), "maps/%s.bsp", sv.name ); Mod_LoadWorld( sv.model_precache[1], &sv.checksum, false ); sv.worldmodel = Mod_Handle( 1 ); // get world pointer for( i = 1; i < sv.worldmodel->numsubmodels; i++ ) { Q_sprintf( sv.model_precache[i+1], "*%i", i ); Mod_RegisterModel( sv.model_precache[i+1], i+1 ); } // precache and static commands can be issued during map initialization sv.state = ss_loading; Host_SetServerState( sv.state ); // clear physics interaction links SV_ClearWorld(); // tell dlls about new level started svgame.dllFuncs.pfnParmsNewLevel(); return true; }
/* ================== VID_SetMode Set the described video mode ================== */ qboolean VID_SetMode( void ) { #ifdef XASH_SDL qboolean fullscreen = false; int iScreenWidth, iScreenHeight; rserr_t err; if( vid_mode->integer == -1 ) // trying to get resolution automatically by default { SDL_DisplayMode mode; SDL_GetDesktopDisplayMode(0, &mode); iScreenWidth = mode.w; iScreenHeight = mode.h; Cvar_SetFloat( "fullscreen", 1 ); } else if( vid_mode->modified && vid_mode->integer >= 0 && vid_mode->integer <= num_vidmodes ) { iScreenWidth = vidmode[vid_mode->integer].width; iScreenHeight = vidmode[vid_mode->integer].height; } else { iScreenHeight = scr_height->integer; iScreenWidth = scr_width->integer; } gl_swapInterval->modified = true; fullscreen = Cvar_VariableInteger("fullscreen") != 0; if(( err = R_ChangeDisplaySettings( iScreenWidth, iScreenHeight, fullscreen )) == rserr_ok ) { glConfig.prev_width = iScreenWidth; glConfig.prev_height = iScreenHeight; } else { if( err == rserr_invalid_fullscreen ) { Cvar_SetFloat( "fullscreen", 0 ); MsgDev( D_ERROR, "VID_SetMode: fullscreen unavailable in this mode\n" ); if(( err = R_ChangeDisplaySettings( iScreenWidth, iScreenHeight, false )) == rserr_ok ) return true; } else if( err == rserr_invalid_mode ) { Cvar_SetFloat( "vid_mode", glConfig.prev_mode ); MsgDev( D_ERROR, "VID_SetMode: invalid mode\n" ); } // try setting it back to something safe if(( err = R_ChangeDisplaySettings( glConfig.prev_width, glConfig.prev_height, false )) != rserr_ok ) { MsgDev( D_ERROR, "VID_SetMode: could not revert to safe mode\n" ); return false; } } #endif return true; }
static void VRSVRSetMenuItemValues( void ) { s_options_vr_svr_enable_box.curvalue = ( !! Cvar_VariableInteger("vr_svr_enable") ); s_options_vr_svr_distortion_box.curvalue = ( 3 - ClampCvar(0, 3, Cvar_VariableInteger("vr_svr_distortion")) ); }