Ejemplo n.º 1
0
        public static void Init( )
        {
            Com.Printf("\\n------- sound initialization -------\\n");
            cvar_t cv = Cvar.Get("s_initsound", "1", 0);

            if (cv.value == 0F)
            {
                Com.Printf("not initializing.\\n");
                UseDriver("dummy");
                return;
            }

            var defaultDriver = "dummy";

            if (drivers.Count > 1)
            {
                defaultDriver = (( ISound )drivers.Last()).GetName();
            }

            s_impl = Cvar.Get("s_impl", defaultDriver, Defines.CVAR_ARCHIVE);
            UseDriver(s_impl.string_renamed);
            if (impl.Init())
            {
                Cvar.Set("s_impl", impl.GetName());
            }
            else
            {
                UseDriver("dummy");
            }

            Com.Printf("\\n------- use sound driver \\\"" + impl.GetName() + "\\\" -------\\n");
            StopAllSounds();
        }
Ejemplo n.º 2
0
 public static void SV_Init( )
 {
     SV_CCMDS.SV_InitOperatorCommands();
     SV_MAIN.rcon_password = Cvar.Get("rcon_password", "", 0);
     Cvar.Get("skill", "1", 0);
     Cvar.Get("deathmatch", "0", Defines.CVAR_LATCH);
     Cvar.Get("coop", "0", Defines.CVAR_LATCH);
     Cvar.Get("dmflags", "" + Defines.DF_INSTANT_ITEMS, Defines.CVAR_SERVERINFO);
     Cvar.Get("fraglimit", "0", Defines.CVAR_SERVERINFO);
     Cvar.Get("timelimit", "0", Defines.CVAR_SERVERINFO);
     Cvar.Get("cheats", "0", Defines.CVAR_SERVERINFO | Defines.CVAR_LATCH);
     Cvar.Get("protocol", "" + Defines.PROTOCOL_VERSION, Defines.CVAR_SERVERINFO | Defines.CVAR_NOSET);
     SV_MAIN.maxclients             = Cvar.Get("maxclients", "1", Defines.CVAR_SERVERINFO | Defines.CVAR_LATCH);
     SV_MAIN.hostname               = Cvar.Get("hostname", "noname", Defines.CVAR_SERVERINFO | Defines.CVAR_ARCHIVE);
     SV_MAIN.timeout                = Cvar.Get("timeout", "125", 0);
     SV_MAIN.zombietime             = Cvar.Get("zombietime", "2", 0);
     SV_MAIN.sv_showclamp           = Cvar.Get("showclamp", "0", 0);
     SV_MAIN.sv_paused              = Cvar.Get("paused", "0", 0);
     SV_MAIN.sv_timedemo            = Cvar.Get("timedemo", "0", 0);
     SV_MAIN.sv_enforcetime         = Cvar.Get("sv_enforcetime", "0", 0);
     SV_MAIN.allow_download         = Cvar.Get("allow_download", "1", Defines.CVAR_ARCHIVE);
     SV_MAIN.allow_download_players = Cvar.Get("allow_download_players", "0", Defines.CVAR_ARCHIVE);
     SV_MAIN.allow_download_models  = Cvar.Get("allow_download_models", "1", Defines.CVAR_ARCHIVE);
     SV_MAIN.allow_download_sounds  = Cvar.Get("allow_download_sounds", "1", Defines.CVAR_ARCHIVE);
     SV_MAIN.allow_download_maps    = Cvar.Get("allow_download_maps", "1", Defines.CVAR_ARCHIVE);
     SV_MAIN.sv_noreload            = Cvar.Get("sv_noreload", "0", 0);
     SV_MAIN.sv_airaccelerate       = Cvar.Get("sv_airaccelerate", "0", Defines.CVAR_LATCH);
     SV_MAIN.public_server          = Cvar.Get("public", "0", 0);
     SV_MAIN.sv_reconnect_limit     = Cvar.Get("sv_reconnect_limit", "3", Defines.CVAR_ARCHIVE);
     SZ.Init(Globals.net_message, Globals.net_message_buffer, Globals.net_message_buffer.Length);
 }
Ejemplo n.º 3
0
    public static void SCR_Init()
    {
        scr_viewsize    = new cvar_t("viewsize", "100", true);
        scr_fov         = new cvar_t("fov", "90"); // 10 - 170
        scr_conspeed    = new cvar_t("scr_conspeed", "3000");
        scr_centertime  = new cvar_t("scr_centertime", "2");
        scr_showram     = new cvar_t("showram", "1");
        scr_showturtle  = new cvar_t("showturtle", "0");
        scr_showpause   = new cvar_t("showpause", "1");
        scr_printspeed  = new cvar_t("scr_printspeed", "8");
        gl_triplebuffer = new cvar_t("gl_triplebuffer", "1", true);

        //
        // register our commands
        //
        Cmd_AddCommand("screenshot", SCR_ScreenShot_f);
        Cmd_AddCommand("sizeup", SCR_SizeUp_f);
        Cmd_AddCommand("sizedown", SCR_SizeDown_f);

        scr_ram    = Draw_PicFromWad("ram");
        scr_net    = Draw_PicFromWad("net");
        scr_turtle = Draw_PicFromWad("turtle");

        if (HasParam("-fullsbar"))
        {
            fullsbardraw = true;
        }

        scr_initialized = true;
    }
Ejemplo n.º 4
0
        /*
         * ============
         * Cvar_RegisterVariable
         *
         * Adds a freestanding variable to the variable list.
         * ============
         */
        public static void Cvar_RegisterVariable(cvar_t variable)
        {
            string oldstr;

            // first check to see if it has allready been defined
            if (Cvar_FindVar(variable.name) != null)
            {
                console.Con_Printf("Can't register variable " + variable.name + ", allready defined\n");
                return;
            }

            // check for overlap with a command
            if (cmd.Cmd_Exists(variable.name))
            {
                console.Con_Printf("Cvar_RegisterVariable: " + variable.name + " is a command\n");
                return;
            }

            // copy the value off, because future sets will Z_Free it
            oldstr           = variable._string;
            variable._string = oldstr;
            variable.value   = common.Q_atof(variable._string);

            // link the variable in
            variable.next = cvar_vars;
            cvar_vars     = variable;
        }
Ejemplo n.º 5
0
    public cvar_t(string name, string value, bool archive, bool server)
    {
        if (String.IsNullOrEmpty(name))
        {
            throw new ArgumentNullException("name");
        }
        cvar_t var = Cvar.Cvar_FindVar(name);

        if (var != null)
        {
            throw new ArgumentException(String.Format("Can't register variable {0}, already defined!\n", name));
            //Con_Printf("Can't register variable %s, allready defined\n", variable->name);
            //return;
        }
        if (game_engine.Cmd_Exists(name))
        {
            throw new ArgumentException(String.Format("Can't register variable: {0} is a command!\n", name));
        }
        next       = Cvar.First;
        Cvar.First = this;

        this.name    = name;
        this.@string = value;
        this.archive = archive;
        this.server  = server;
        this.value   = game_engine.atof(@string);
    }
Ejemplo n.º 6
0
    public static void Con_Init()
    {
        con_debuglog = (COM_CheckParm("-condebug") > 0);
        if (con_debuglog)
        {
            string path = Path.Combine(com_gamedir, q_shared.LOG_FILE_NAME);
            if (File.Exists(path))
            {
                File.Delete(path);
            }

            _Log = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read);
        }

        con_linewidth = -1;
        Con_CheckResize();

        Con_Print("Console initialized.\n");

        //
        // register our commands
        //
        con_notifytime = new cvar_t("con_notifytime", "3");

        Cmd_AddCommand("toggleconsole", Con_ToggleConsole_f);
        Cmd_AddCommand("messagemode", Con_MessageMode_f);
        Cmd_AddCommand("messagemode2", Con_MessageMode2_f);
        Cmd_AddCommand("clear", Con_Clear_f);

        con_initialized = true;
    }
Ejemplo n.º 7
0
 public static void Chase_Init()
 {
     chase_back   = new cvar_t("chase_back", "100");
     chase_up     = new cvar_t("chase_up", "16");
     chase_right  = new cvar_t("chase_right", "0");
     chase_active = new cvar_t("chase_active", "0");
 }
Ejemplo n.º 8
0
    public static void SV_Init()
    {
        for (int i = 0; i < _BoxClipNodes.Length; i++)
        {
            _BoxClipNodes[i].children = new short[2];
        }
        for (int i = 0; i < _BoxPlanes.Length; i++)
        {
            _BoxPlanes[i] = new mplane_t();
        }
        for (int i = 0; i < sv_areanodes.Length; i++)
        {
            sv_areanodes[i] = new areanode_t();
        }

        sv_friction        = new cvar_t("sv_friction", "4", false, true);
        edgefriction       = new cvar_t("edgefriction", "2");
        sv_stopspeed       = new cvar_t("sv_stopspeed", "100");
        sv_gravity         = new cvar_t("sv_gravity", "800", false, true);
        sv_maxvelocity     = new cvar_t("sv_maxvelocity", "2000");
        sv_nostep          = new cvar_t("sv_nostep", "0");
        sv_maxspeed        = new cvar_t("sv_maxspeed", "320", false, true);
        sv_accelerate      = new cvar_t("sv_accelerate", "10");
        sv_aim             = new cvar_t("sv_aim", "0.93");
        sv_idealpitchscale = new cvar_t("sv_idealpitchscale", "0.8");

        for (int i = 0; i < q_shared.MAX_MODELS; i++)
        {
            localmodels[i] = "*" + i.ToString();
        }
    }
Ejemplo n.º 9
0
        public bool Init()
        {
            try
            {
                InitOpenAL();
                CheckError();
            }
            catch (Exception e)
            {
                Com.DPrintf(e.Message + '\\');
                return(false);
            }

            s_volume = Cvar.Get("s_volume", "0.7", Defines.CVAR_ARCHIVE);
            AL10.AlGenBuffers(buffers);
            int count = Channel.Init(buffers);

            Com.Printf("... using " + count + " channels\\n");
            AL10.AlDistanceModel(AL10.AL_INVERSE_DISTANCE_CLAMPED);
            Cmd.AddCommand("play", new Anonymousxcommand_t(this));
            Cmd.AddCommand("stopsound", new Anonymousxcommand_t1(this));
            Cmd.AddCommand("soundlist", new Anonymousxcommand_t2(this));
            Cmd.AddCommand("soundinfo", new Anonymousxcommand_t3(this));
            num_sfx = 0;
            Com.Printf("sound sampling rate: 44100Hz\\n");
            StopAllSounds();
            Com.Printf("------------------------------------\\n");
            return(true);
        }
Ejemplo n.º 10
0
 public static void SetCDDir( )
 {
     fs_cddir = Cvar.Get("cddir", "", CVAR_ARCHIVE);
     if (fs_cddir.string_renamed.Length > 0)
     {
         AddGameDirectory(fs_cddir.string_renamed);
     }
 }
Ejemplo n.º 11
0
        public static void Netchan_Init()
        {
            long port;

            port        = Timer.Milliseconds() & 0xffff;
            showpackets = Cvar.Get("showpackets", "0", 0);
            showdrop    = Cvar.Get("showdrop", "0", 0);
            qport       = Cvar.Get("qport", "" + port, Defines.CVAR_NOSET);
        }
Ejemplo n.º 12
0
    public static void IN_Init()
    {
        m_filter = new cvar_t("m_filter", "0");

        mouseactive = (MainForm.Instance.Mouse != null);
        if (mouseactive)
        {
            mouse_buttons = MainForm.Instance.Mouse.NumberOfButtons;
        }
    }
Ejemplo n.º 13
0
        public static Single VariableValue(String var_name)
        {
            cvar_t var = Cvar.FindVar(var_name);

            if (var == null)
            {
                return(0);
            }
            return(Lib.Atof(var.string_renamed));
        }
Ejemplo n.º 14
0
    public static string Cvar_VariableString(string name)
    {
        cvar_t var = Cvar_FindVar(name);

        if (var != null)
        {
            return(var.@string);
        }
        return(String.Empty);
    }
Ejemplo n.º 15
0
    public static void CL_Init()
    {
        CL_InitInput();
        CL_InitTEnts();

        cl_name          = new cvar_t("_cl_name", "player", true);
        cl_color         = new cvar_t("_cl_color", "0", true);
        cl_shownet       = new cvar_t("cl_shownet", "0"); // can be 0, 1, or 2
        cl_nolerp        = new cvar_t("cl_nolerp", "0");
        lookspring       = new cvar_t("lookspring", "0", true);
        lookstrafe       = new cvar_t("lookstrafe", "0", true);
        sensitivity      = new cvar_t("sensitivity", "3", true);
        m_pitch          = new cvar_t("m_pitch", "0.022", true);
        m_yaw            = new cvar_t("m_yaw", "0.022", true);
        m_forward        = new cvar_t("m_forward", "1", true);
        m_side           = new cvar_t("m_side", "0.8", true);
        cl_upspeed       = new cvar_t("cl_upspeed", "200");
        cl_forwardspeed  = new cvar_t("cl_forwardspeed", "200", true);
        cl_backspeed     = new cvar_t("cl_backspeed", "200", true);
        cl_sidespeed     = new cvar_t("cl_sidespeed", "350");
        cl_movespeedkey  = new cvar_t("cl_movespeedkey", "2.0");
        cl_yawspeed      = new cvar_t("cl_yawspeed", "140");
        cl_pitchspeed    = new cvar_t("cl_pitchspeed", "150");
        cl_anglespeedkey = new cvar_t("cl_anglespeedkey", "1.5");

        for (int i = 0; i < cl_efrags.Length; i++)
        {
            cl_efrags[i] = new efrag_t();
        }

        for (int i = 0; i < cl_entities.Length; i++)
        {
            cl_entities[i] = new entity_t();
        }

        for (int i = 0; i < cl_static_entities.Length; i++)
        {
            cl_static_entities[i] = new entity_t();
        }

        for (int i = 0; i < cl_dlights.Length; i++)
        {
            cl_dlights[i] = new dlight_t();
        }

        //
        // register our commands
        //
        Cmd_AddCommand("entities", CL_PrintEntities_f);
        Cmd_AddCommand("disconnect", CL_Disconnect_f);
        Cmd_AddCommand("record", CL_Record_f);
        Cmd_AddCommand("stop", CL_Stop_f);
        Cmd_AddCommand("playdemo", CL_PlayDemo_f);
        Cmd_AddCommand("timedemo", CL_TimeDemo_f);
    }
Ejemplo n.º 16
0
    /*
     * ============
     * Cvar_VariableValue
     * ============
     */
    static float Cvar_VariableValue(string var_name)
    {
        cvar_t var = Cvar_FindVar(var_name);

        if (var != null)
        {
            return(0);
        }

        return(var.value);
    }
Ejemplo n.º 17
0
    public static float Cvar_VariableValue(string name)
    {
        float  result = 0;
        cvar_t var    = Cvar_FindVar(name);

        if (var != null)
        {
            result = game_engine.atof(var.@string);
        }
        return(result);
    }
Ejemplo n.º 18
0
    public static void Cvar_Set(string name, string value)
    {
        cvar_t var = Cvar_FindVar(name);

        if (var == null)
        {
            // there is an error in C code if this happens
            game_engine.Con_Printf("Cvar.Set: variable {0} not found\n", name);
            return;
        }
        var.Set(value);
    }
Ejemplo n.º 19
0
    public static int _PlayVolHash = 543; // hash S_PlayVol


    public static void S_Init()
    {
        Con_Printf("\nSound Initialization\n");

        for (int i = 0; i < _KnownSfx.Length; i++)
        {
            _KnownSfx[i] = new sfx_t();
        }

        bgmvolume         = new cvar_t("bgmvolume", "1", true);
        volume            = new cvar_t("volume", "0.7", true);
        nosound           = new cvar_t("nosound", "0");
        precache          = new cvar_t("precache", "1");
        loadas8bit        = new cvar_t("loadas8bit", "0");
        bgmbuffer         = new cvar_t("bgmbuffer", "4096");
        ambient_level     = new cvar_t("ambient_level", "0.3");
        ambient_fade      = new cvar_t("ambient_fade", "100");
        snd_noextraupdate = new cvar_t("snd_noextraupdate", "0");
        snd_show          = new cvar_t("snd_show", "0");
        _snd_mixahead     = new cvar_t("_snd_mixahead", "0.1", true);

        if (HasParam("-nosound"))
        {
            return;
        }

        for (int i = 0; i < channels.Length; i++)
        {
            channels[i] = new channel_t();
        }

        Cmd_AddCommand("play", S_Play);
        Cmd_AddCommand("playvol", S_PlayVol);
        Cmd_AddCommand("stopsound", S_StopAllSoundsC);
        Cmd_AddCommand("soundlist", S_SoundList);
        Cmd_AddCommand("soundinfo", S_SoundInfo_f);

        snd_initialized = true;

        S_Startup();

        SND_InitScaletable();

        num_sfx = 0;

        Con_Printf("Sound sampling rate: {0}\n", shm.speed);

        // provides a tick sound until washed clean
        ambient_sfx[q_shared.AMBIENT_WATER] = S_PrecacheSound("ambience/water1.wav");
        ambient_sfx[q_shared.AMBIENT_SKY]   = S_PrecacheSound("ambience/wind2.wav");

        S_StopAllSounds(true);
    }
Ejemplo n.º 20
0
    public static float _OldGammaValue; // static float oldgammavalue from CheckGamma


    public static void V_Init()
    {
        _GammaTable = new byte[256];

        _CShift_empty = new cshift_t(new[] { 130, 80, 50 }, 0);
        _CShift_water = new cshift_t(new[] { 130, 80, 50 }, 128);
        _CShift_slime = new cshift_t(new[] { 0, 25, 5 }, 150);
        _CShift_lava  = new cshift_t(new[] { 255, 80, 0 }, 150);

        Cmd_AddCommand("v_cshift", V_cshift_f);
        Cmd_AddCommand("bf", V_BonusFlash_f);
        Cmd_AddCommand("centerview", V_StartPitchDrift);

        lcd_x   = new cvar_t("lcd_x", "0");
        lcd_yaw = new cvar_t("lcd_yaw", "0");

        scr_ofsx = new cvar_t("scr_ofsx", "0", false);
        scr_ofsy = new cvar_t("scr_ofsy", "0", false);
        scr_ofsz = new cvar_t("scr_ofsz", "0", false);

        cl_rollspeed = new cvar_t("cl_rollspeed", "200");
        cl_rollangle = new cvar_t("cl_rollangle", "2.0");

        cl_bob      = new cvar_t("cl_bob", "0.02", false);
        cl_bobcycle = new cvar_t("cl_bobcycle", "0.6", false);
        cl_bobup    = new cvar_t("cl_bobup", "0.5", false);

        v_kicktime  = new cvar_t("v_kicktime", "0.5", false);
        v_kickroll  = new cvar_t("v_kickroll", "0.6", false);
        v_kickpitch = new cvar_t("v_kickpitch", "0.6", false);

        v_iyaw_cycle   = new cvar_t("v_iyaw_cycle", "2", false);
        v_iroll_cycle  = new cvar_t("v_iroll_cycle", "0.5", false);
        v_ipitch_cycle = new cvar_t("v_ipitch_cycle", "1", false);
        v_iyaw_level   = new cvar_t("v_iyaw_level", "0.3", false);
        v_iroll_level  = new cvar_t("v_iroll_level", "0.1", false);
        v_ipitch_level = new cvar_t("v_ipitch_level", "0.3", false);

        v_idlescale = new cvar_t("v_idlescale", "0", false);

        crosshair = new cvar_t("crosshair", "0", true);
        cl_crossx = new cvar_t("cl_crossx", "0", false);
        cl_crossy = new cvar_t("cl_crossy", "0", false);

        gl_cshiftpercent = new cvar_t("gl_cshiftpercent", "100", false);

        v_centermove  = new cvar_t("v_centermove", "0.15", false);
        v_centerspeed = new cvar_t("v_centerspeed", "500");

        BuildGammaTable(1.0f);  // no gamma yet
        gamma = new cvar_t("gamma", "1", true);
    }
Ejemplo n.º 21
0
 public static void Init()
 {
     Cmd.AddCommand("gun_next", V.Gun_Next_f);
     Cmd.AddCommand("gun_prev", V.Gun_Prev_f);
     Cmd.AddCommand("gun_model", V.Gun_Model_f);
     Cmd.AddCommand("viewpos", V.Viewpos_f);
     Globals.crosshair  = Cvar.Get("crosshair", "0", Defines.CVAR_ARCHIVE);
     V.cl_testblend     = Cvar.Get("cl_testblend", "0", 0);
     V.cl_testparticles = Cvar.Get("cl_testparticles", "0", 0);
     V.cl_testentities  = Cvar.Get("cl_testentities", "0", 0);
     V.cl_testlights    = Cvar.Get("cl_testlights", "0", 0);
     V.cl_stats         = Cvar.Get("cl_stats", "0", 0);
 }
Ejemplo n.º 22
0
        public static ArrayList CompleteVariable(String partial)
        {
            ArrayList vars = new ArrayList();

            for (cvar_t cvar = Globals.cvar_vars; cvar != null; cvar = cvar.next)
            {
                if (cvar.name.StartsWith(partial))
                {
                    vars.Add(cvar.name);
                }
            }
            return(vars);
        }
Ejemplo n.º 23
0
    public static cvar_t Cvar_FindVar(string name)
    {
        cvar_t var = First;

        while (var != null)
        {
            if (var.name.Equals(name))
            {
                return(var);
            }
            var = var.next;
        }
        return(null);
    }
Ejemplo n.º 24
0
 public static void Init()
 {
     vid_ref              = Cvar.Get("vid_ref", Renderer.GetPreferedName(), CVAR_ARCHIVE);
     vid_xpos             = Cvar.Get("vid_xpos", "3", CVAR_ARCHIVE);
     vid_ypos             = Cvar.Get("vid_ypos", "22", CVAR_ARCHIVE);
     vid_width            = Cvar.Get("vid_width", "640", CVAR_ARCHIVE);
     vid_height           = Cvar.Get("vid_height", "480", CVAR_ARCHIVE);
     vid_fullscreen       = Cvar.Get("vid_fullscreen", "0", CVAR_ARCHIVE);
     vid_gamma            = Cvar.Get("vid_gamma", "1", CVAR_ARCHIVE);
     vid_modes[11].width  = (int)vid_width.value;
     vid_modes[11].height = (int)vid_height.value;
     Cmd.AddCommand("vid_restart", new Anonymousxcommand_t());
     CheckChanges();
 }
Ejemplo n.º 25
0
    public static void R_Init()
    {
        for (int i = 0; i < frustum.Length; i++)
        {
            frustum[i] = new mplane_t();
        }

        Cmd_AddCommand("timerefresh", R_TimeRefresh_f);
        //Cmd.Add("envmap", Envmap_f);
        //Cmd.Add("pointfile", ReadPointFile_f);

        r_norefresh     = new cvar_t("r_norefresh", "0");
        r_drawentities  = new cvar_t("r_drawentities", "1");
        r_drawviewmodel = new cvar_t("r_drawviewmodel", "1");
        r_speeds        = new cvar_t("r_speeds", "0");
        r_fullbright    = new cvar_t("r_fullbright", "0");
        r_lightmap      = new cvar_t("r_lightmap", "0");
        r_shadows       = new cvar_t("r_shadows", "0");
        r_mirroralpha   = new cvar_t("r_mirroralpha", "1");
        r_wateralpha    = new cvar_t("r_wateralpha", "1");
        r_dynamic       = new cvar_t("r_dynamic", "1");
        r_novis         = new cvar_t("r_novis", "0");

        gl_finish           = new cvar_t("gl_finish", "0");
        gl_clear            = new cvar_t("gl_clear", "0");
        gl_cull             = new cvar_t("gl_cull", "1");
        gl_texsort          = new cvar_t("gl_texsort", "1");
        gl_smoothmodels     = new cvar_t("gl_smoothmodels", "1");
        gl_affinemodels     = new cvar_t("gl_affinemodels", "0");
        gl_polyblend        = new cvar_t("gl_polyblend", "1");
        gl_flashblend       = new cvar_t("gl_flashblend", "1");
        gl_playermip        = new cvar_t("gl_playermip", "0");
        gl_nocolors         = new cvar_t("gl_nocolors", "0");
        gl_keeptjunctions   = new cvar_t("gl_keeptjunctions", "0");
        gl_reporttjunctions = new cvar_t("gl_reporttjunctions", "0");
        gl_doubleeys        = new cvar_t("gl_doubleeys", "1");

        if (gl_mtexable)
        {
            Cvar.Cvar_SetValue("gl_texsort", 0.0f);
        }

        R_InitParticles();
        R_InitParticleTexture();

        // reserve 16 textures
        playertextures = GenerateTextureNumberRange(16);
    }
Ejemplo n.º 26
0
 public static void InitFilesystem( )
 {
     Cmd.AddCommand("path", new Anonymousxcommand_t());
     Cmd.AddCommand("link", new Anonymousxcommand_t1());
     Cmd.AddCommand("dir", new Anonymousxcommand_t2());
     fs_userdir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "/.jake2";
     FS.CreatePath(fs_userdir + "/");
     FS.AddGameDirectory(fs_userdir);
     fs_basedir = Cvar.Get("basedir", ".", CVAR_NOSET);
     SetCDDir();
     AddGameDirectory(fs_basedir.string_renamed + '/' + Globals.BASEDIRNAME);
     MarkBaseSearchPaths();
     fs_gamedirvar = Cvar.Get("game", "", CVAR_LATCH | CVAR_SERVERINFO);
     if (fs_gamedirvar.string_renamed.Length > 0)
     {
         SetGamedir(fs_gamedirvar.string_renamed);
     }
 }
Ejemplo n.º 27
0
        public bool Init()
        {
            try
            {
                var deviceName = ALC.GetString(ALDevice.Null, AlcGetString.DefaultDeviceSpecifier);
                OpenTkSound.device = ALC.OpenDevice(deviceName);
                var context = ALC.CreateContext(OpenTkSound.device, (int[])null);
                ALC.MakeContextCurrent(context);
                this.checkError();
                this.initOpenALExtensions();
            }
            catch (Exception e)
            {
                Com.Printf(e.Message + '\n');

                return(false);
            }

            // set the master volume
            this.s_volume = Cvar.Get("s_volume", "0.7", Defines.CVAR_ARCHIVE);

            AL.GenBuffers(this.buffers.Length, this.buffers);
            var count = Channel.init(this.buffers, OpenTkSound.efxSlot);

            Com.Printf("... using " + count + " channels\n");
            AL.DistanceModel(ALDistanceModel.InverseDistanceClamped);

            Cmd.AddCommand("play", () => { this.Play(); });

            Cmd.AddCommand("stopsound", () => { this.StopAllSounds(); });

            Cmd.AddCommand("soundlist", () => { this.SoundList(); });

            Cmd.AddCommand("soundinfo", () => { this.SoundInfo_f(); });

            OpenTkSound.num_sfx = 0;

            Com.Println("sound sampling rate: 44100Hz");

            this.StopAllSounds();
            Com.Println("------------------------------------");

            return(true);
        }
Ejemplo n.º 28
0
    public static void Cvar_WriteVariables(Stream dest)
    {
        StringBuilder sb  = new StringBuilder(4096);
        cvar_t        var = First;

        while (var != null)
        {
            if (var.archive)
            {
                sb.Append(var.name);
                sb.Append(" \"");
                sb.Append(var.@string);
                sb.AppendLine("\"");
            }
            var = var.next;
        }
        byte[] buf = Encoding.ASCII.GetBytes(sb.ToString());
        dest.Write(buf, 0, buf.Length);
    }
Ejemplo n.º 29
0
        public static cvar_t Get(String var_name, String var_value, Int32 flags)
        {
            cvar_t var;

            if ((flags & (CVAR_USERINFO | CVAR_SERVERINFO)) != 0)
            {
                if (!InfoValidate(var_name))
                {
                    Com.Printf("invalid info cvar name\\n");
                    return(null);
                }
            }

            var = Cvar.FindVar(var_name);
            if (var != null)
            {
                var.flags |= flags;
                return(var);
            }

            if (var_value == null)
            {
                return(null);
            }
            if ((flags & (CVAR_USERINFO | CVAR_SERVERINFO)) != 0)
            {
                if (!InfoValidate(var_value))
                {
                    Com.Printf("invalid info cvar value\\n");
                    return(null);
                }
            }

            var                = new cvar_t();
            var.name           = new String(var_name);
            var.string_renamed = new String(var_value);
            var.modified       = true;
            var.value          = Lib.Atof(var.string_renamed);
            var.next           = Globals.cvar_vars;
            Globals.cvar_vars  = var;
            var.flags          = flags;
            return(var);
        }
Ejemplo n.º 30
0
    public static void PR_Init()
    {
        Cmd_AddCommand("edict", ED_PrintEdict_f);
        Cmd_AddCommand("edicts", ED_PrintEdicts);
        Cmd_AddCommand("edictcount", ED_Count);
        Cmd_AddCommand("profile", PR_Profile_f);
        Cmd_AddCommand("test5", Test5_f);

        nomonsters   = new cvar_t("nomonsters", "0");
        gamecfg      = new cvar_t("gamecfg", "0");
        scratch1     = new cvar_t("scratch1", "0");
        scratch2     = new cvar_t("scratch2", "0");
        scratch3     = new cvar_t("scratch3", "0");
        scratch4     = new cvar_t("scratch4", "0");
        savedgamecfg = new cvar_t("savedgamecfg", "0", true);
        saved1       = new cvar_t("saved1", "0", true);
        saved2       = new cvar_t("saved2", "0", true);
        saved3       = new cvar_t("saved3", "0", true);
        saved4       = new cvar_t("saved4", "0", true);
    }
Ejemplo n.º 31
0
        /*
        ============
        Cvar_RegisterVariable

        Adds a freestanding variable to the variable list.
        ============
        */
        public static void Cvar_RegisterVariable(cvar_t variable)
        {
            string	oldstr;

            // first check to see if it has allready been defined
            if (Cvar_FindVar (variable.name) != null)
            {
                console.Con_Printf ("Can't register variable " + variable.name + ", allready defined\n");
                return;
            }

            // check for overlap with a command
            if (cmd.Cmd_Exists (variable.name))
            {
                console.Con_Printf ("Cvar_RegisterVariable: " + variable.name + " is a command\n");
                return;
            }

            // copy the value off, because future sets will Z_Free it
            oldstr = variable._string;
            variable._string = oldstr;
            variable.value = common.Q_atof(variable._string);

            // link the variable in
            variable.next = cvar_vars;
            cvar_vars = variable;
        }