Esempio n. 1
0
/*
================
idCommonLocal::ProcessGameReturn
================
*/
void idCommonLocal::ProcessGameReturn( const gameReturn_t & ret ) {
	// set joystick rumble
	if ( in_useJoystick.GetBool() && in_joystickRumble.GetBool() && !game->Shell_IsActive() && session->GetSignInManager().GetMasterInputDevice() >= 0 ) {
		Sys_SetRumble( session->GetSignInManager().GetMasterInputDevice(), ret.vibrationLow, ret.vibrationHigh );		// Only set the rumble on the active controller
	} else {
		for ( int i = 0; i < MAX_INPUT_DEVICES; i++ ) {
			Sys_SetRumble( i, 0, 0 );
		}
	}

	syncNextGameFrame = ret.syncNextGameFrame;

	if ( ret.sessionCommand[0] ) {
		idCmdArgs args;

		args.TokenizeString( ret.sessionCommand, false );

		if ( !idStr::Icmp( args.Argv(0), "map" ) ) {
			MoveToNewMap( args.Argv( 1 ), false );
		} else if ( !idStr::Icmp( args.Argv(0), "devmap" ) ) {
			MoveToNewMap( args.Argv( 1 ), true );
		} else if ( !idStr::Icmp( args.Argv(0), "died" ) ) {
			if ( !IsMultiplayer() ) {
				game->Shell_Show( true );
			}
		} else if ( !idStr::Icmp( args.Argv(0), "disconnect" ) ) {
			cmdSystem->BufferCommandText( CMD_EXEC_INSERT, "stoprecording ; disconnect" );
		} else if ( !idStr::Icmp( args.Argv(0), "endOfDemo" ) ) {
			cmdSystem->BufferCommandText( CMD_EXEC_NOW, "endOfDemo" );
		}
	}
}
/*
==============
idSessionLocal::HandleRestartMenuCommands

Executes any commands returned by the gui
==============
*/
void idSessionLocal::HandleRestartMenuCommands(const char *menuCommand)
{
	// execute the command from the menu
	int icmd;
	idCmdArgs args;

	args.TokenizeString(menuCommand, false);

	for (icmd = 0; icmd < args.Argc();) {
		const char *cmd = args.Argv(icmd++);

		if (HandleSaveGameMenuCommand(args, icmd)) {
			continue;
		}

		if (!idStr::Icmp(cmd, "restart")) {
			if (!LoadGame(GetAutoSaveName(mapSpawnData.serverInfo.GetString("si_map")))) {
				// If we can't load the autosave then just restart the map
				MoveToNewMap(mapSpawnData.serverInfo.GetString("si_map"));
			}

			continue;
		}

		if (!idStr::Icmp(cmd, "quit")) {
			ExitMenu();
			common->Quit();
			return;
		}

		if (!idStr::Icmp(cmd, "exec")) {
			cmdSystem->BufferCommandText(CMD_EXEC_APPEND, args.Argv(icmd++));
			continue;
		}

		if (!idStr::Icmp(cmd, "play")) {
			if (args.Argc() - icmd >= 1) {
				idStr snd = args.Argv(icmd++);
				sw->PlayShaderDirectly(snd);
			}

			continue;
		}
	}
}