Add() public static method

public static Add ( string name, xcommand_t function ) : void
name string
function xcommand_t
return void
Exemplo n.º 1
0
        private static bool _IsMouseWindowed; // windowed_mouse (don't confuse with _windowed_mouse cvar)
                                              // scr_fullupdate    set to 0 to force full redraw

        // SCR_Init
        public static void Init()
        {
            if (_ViewSize == null)
            {
                _ViewSize       = new Cvar("viewsize", "100", true);
                _Fov            = new Cvar("fov", "90"); // 10 - 170
                _ConSpeed       = new Cvar("scr_conspeed", "3000");
                _CenterTime     = new Cvar("scr_centertime", "2");
                _ShowRam        = new Cvar("showram", "1");
                _ShowTurtle     = new Cvar("showturtle", "0");
                _ShowPause      = new Cvar("showpause", "1");
                _PrintSpeed     = new Cvar("scr_printspeed", "8");
                _glTripleBuffer = new Cvar("gl_triplebuffer", "1", true);
            }

            //
            // register our commands
            //
            Cmd.Add("screenshot", ScreenShot_f);
            Cmd.Add("sizeup", SizeUp_f);
            Cmd.Add("sizedown", SizeDown_f);

            _Ram    = Drawer.PicFromWad("ram");
            _Net    = Drawer.PicFromWad("net");
            _Turtle = Drawer.PicFromWad("turtle");

            if (Common.HasParam("-fullsbar"))
            {
                FullSbarDraw = true;
            }

            _IsInitialized = true;
        }
Exemplo n.º 2
0
        // Con_Init (void)
        public static void Init()
        {
            _DebugLog = (Common.CheckParm("-condebug") > 0);
            if (_DebugLog)
            {
                string path = Path.Combine(Common.GameDir, LOG_FILE_NAME);
                if (File.Exists(path))
                {
                    File.Delete(path);
                }

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

            _LineWidth = -1;
            CheckResize();

            Con.Print("Console initialized.\n");

            //
            // register our commands
            //
            if (_NotifyTime == null)
            {
                _NotifyTime = new Cvar("con_notifytime", "3");
            }

            Cmd.Add("toggleconsole", ToggleConsole_f);
            Cmd.Add("messagemode", MessageMode_f);
            Cmd.Add("messagemode2", MessageMode2_f);
            Cmd.Add("clear", Clear_f);

            _IsInitialized = true;
        }
Exemplo n.º 3
0
        // Cache_Init
        public static void Init(int capacity)
        {
            _Capacity       = capacity;
            _BytesAllocated = 0;
            _Head           = new CacheEntry(true);

            Cmd.Add("flush", Flush);
        }
Exemplo n.º 4
0
        // CL_Init
        public static void Init()
        {
            InitInput();
            InitTempEntities();

            if (_Name == null)
            {
                _Name          = new Cvar("_cl_name", "player", true);
                _Color         = new Cvar("_cl_color", "0", true);
                _ShowNet       = new Cvar("cl_shownet", "0"); // can be 0, 1, or 2
                _NoLerp        = new Cvar("cl_nolerp", "0");
                _LookSpring    = new Cvar("lookspring", "0", true);
                _LookStrafe    = new Cvar("lookstrafe", "0", true);
                _Sensitivity   = new Cvar("sensitivity", "3", true);
                _MPitch        = new Cvar("m_pitch", "0.022", true);
                _MYaw          = new Cvar("m_yaw", "0.022", true);
                _MForward      = new Cvar("m_forward", "1", true);
                _MSide         = new Cvar("m_side", "0.8", true);
                _UpSpeed       = new Cvar("cl_upspeed", "200");
                _ForwardSpeed  = new Cvar("cl_forwardspeed", "200", true);
                _BackSpeed     = new Cvar("cl_backspeed", "200", true);
                _SideSpeed     = new Cvar("cl_sidespeed", "350");
                _MoveSpeedKey  = new Cvar("cl_movespeedkey", "2.0");
                _YawSpeed      = new Cvar("cl_yawspeed", "140");
                _PitchSpeed    = new Cvar("cl_pitchspeed", "150");
                _AngleSpeedKey = new Cvar("cl_anglespeedkey", "1.5");
            }

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

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

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

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

            //
            // register our commands
            //
            Cmd.Add("entities", PrintEntities_f);
            Cmd.Add("disconnect", Disconnect_f);
            Cmd.Add("record", Record_f);
            Cmd.Add("stop", Stop_f);
            Cmd.Add("playdemo", PlayDemo_f);
            Cmd.Add("timedemo", TimeDemo_f);
        }
Exemplo n.º 5
0
        // V_Init
        public static void Init()
        {
            Cmd.Add("v_cshift", CShift_f);
            Cmd.Add("bf", BonusFlash_f);
            Cmd.Add("centerview", StartPitchDrift);

            if (_LcdX == null)
            {
                _LcdX   = new Cvar("lcd_x", "0");
                _LcdYaw = new Cvar("lcd_yaw", "0");

                _ScrOfsX = new Cvar("scr_ofsx", "0", false);
                _ScrOfsY = new Cvar("scr_ofsy", "0", false);
                _ScrOfsZ = new Cvar("scr_ofsz", "0", false);

                _ClRollSpeed = new Cvar("cl_rollspeed", "200");
                _ClRollAngle = new Cvar("cl_rollangle", "2.0");

                _ClBob      = new Cvar("cl_bob", "0.02", false);
                _ClBobCycle = new Cvar("cl_bobcycle", "0.6", false);
                _ClBobUp    = new Cvar("cl_bobup", "0.5", false);

                _KickTime  = new Cvar("v_kicktime", "0.5", false);
                _KickRoll  = new Cvar("v_kickroll", "0.6", false);
                _KickPitch = new Cvar("v_kickpitch", "0.6", false);

                _IYawCycle   = new Cvar("v_iyaw_cycle", "2", false);
                _IRollCycle  = new Cvar("v_iroll_cycle", "0.5", false);
                _IPitchCycle = new Cvar("v_ipitch_cycle", "1", false);
                _IYawLevel   = new Cvar("v_iyaw_level", "0.3", false);
                _IRollLevel  = new Cvar("v_iroll_level", "0.1", false);
                _IPitchLevel = new Cvar("v_ipitch_level", "0.3", false);

                _IdleScale = new Cvar("v_idlescale", "0", false);

                _Crosshair = new Cvar("crosshair", "0", true);
                _ClCrossX  = new Cvar("cl_crossx", "0", false);
                _ClCrossY  = new Cvar("cl_crossy", "0", false);

                _glCShiftPercent = new Cvar("gl_cshiftpercent", "100", false);

                _CenterMove  = new Cvar("v_centermove", "0.15", false);
                _CenterSpeed = new Cvar("v_centerspeed", "500");

                BuildGammaTable(1.0f);  // no gamma yet
                _Gamma = new Cvar("gamma", "1", true);
            }
        }
Exemplo n.º 6
0
        // Host_InitCommands
        private static void InitCommands()
        {
            Cmd.Add("status", Status_f);
            Cmd.Add("quit", Quit_f);
            Cmd.Add("god", God_f);
            Cmd.Add("notarget", Notarget_f);
            Cmd.Add("fly", Fly_f);
            Cmd.Add("map", Map_f);
            Cmd.Add("restart", Restart_f);
            Cmd.Add("changelevel", Changelevel_f);
            Cmd.Add("connect", Connect_f);
            Cmd.Add("reconnect", Reconnect_f);
            Cmd.Add("name", Name_f);
            Cmd.Add("noclip", Noclip_f);
            Cmd.Add("version", Version_f);
            Cmd.Add("say", Say_f);
            Cmd.Add("say_team", Say_Team_f);
            Cmd.Add("tell", Tell_f);
            Cmd.Add("color", Color_f);
            Cmd.Add("kill", Kill_f);
            Cmd.Add("pause", Pause_f);
            Cmd.Add("spawn", Spawn_f);
            Cmd.Add("begin", Begin_f);
            Cmd.Add("prespawn", PreSpawn_f);
            Cmd.Add("kick", Kick_f);
            Cmd.Add("ping", Ping_f);
            Cmd.Add("load", Loadgame_f);
            Cmd.Add("save", Savegame_f);
            Cmd.Add("give", Give_f);

            Cmd.Add("startdemos", Startdemos_f);
            Cmd.Add("demos", Demos_f);
            Cmd.Add("stopdemo", Stopdemo_f);

            Cmd.Add("viewmodel", Viewmodel_f);
            Cmd.Add("viewframe", Viewframe_f);
            Cmd.Add("viewnext", Viewnext_f);
            Cmd.Add("viewprev", Viewprev_f);

            Cmd.Add("mcache", Mod.Print);
        }
Exemplo n.º 7
0
        /// <summary>
        /// CDAudio_Init
        /// </summary>
        public static bool Init()
        {
            if (Client.cls.state == cactive_t.ca_dedicated)
            {
                return(false);
            }

            if (Common.HasParam("-nocdaudio"))
            {
                return(false);
            }

            _Controller.Init();

            if (_Controller.IsInitialized)
            {
                Cmd.Add("cd", CD_f);
                Con.Print("CD Audio Initialized\n");
            }

            return(_Controller.IsInitialized);
        }
Exemplo n.º 8
0
 public static void Init()
 {
     Cmd.Add("+moveup", UpDown);
     Cmd.Add("-moveup", UpUp);
     Cmd.Add("+movedown", DownDown);
     Cmd.Add("-movedown", DownUp);
     Cmd.Add("+left", LeftDown);
     Cmd.Add("-left", LeftUp);
     Cmd.Add("+right", RightDown);
     Cmd.Add("-right", RightUp);
     Cmd.Add("+forward", ForwardDown);
     Cmd.Add("-forward", ForwardUp);
     Cmd.Add("+back", BackDown);
     Cmd.Add("-back", BackUp);
     Cmd.Add("+lookup", LookupDown);
     Cmd.Add("-lookup", LookupUp);
     Cmd.Add("+lookdown", LookdownDown);
     Cmd.Add("-lookdown", LookdownUp);
     Cmd.Add("+strafe", StrafeDown);
     Cmd.Add("-strafe", StrafeUp);
     Cmd.Add("+moveleft", MoveleftDown);
     Cmd.Add("-moveleft", MoveleftUp);
     Cmd.Add("+moveright", MoverightDown);
     Cmd.Add("-moveright", MoverightUp);
     Cmd.Add("+speed", SpeedDown);
     Cmd.Add("-speed", SpeedUp);
     Cmd.Add("+attack", AttackDown);
     Cmd.Add("-attack", AttackUp);
     Cmd.Add("+use", UseDown);
     Cmd.Add("-use", UseUp);
     Cmd.Add("+jump", JumpDown);
     Cmd.Add("-jump", JumpUp);
     Cmd.Add("impulse", ImpulseCmd);
     Cmd.Add("+klook", KLookDown);
     Cmd.Add("-klook", KLookUp);
     Cmd.Add("+mlook", MLookDown);
     Cmd.Add("-mlook", MLookUp);
 }
Exemplo n.º 9
0
        // PR_Init
        public static void Init()
        {
            Cmd.Add("edict", PrintEdict_f);
            Cmd.Add("edicts", PrintEdicts);
            Cmd.Add("edictcount", EdictCount);
            Cmd.Add("profile", Profile_f);
            Cmd.Add("test5", Test5_f);

            if (_NoMonsters == null)
            {
                _NoMonsters   = new Cvar("nomonsters", "0");
                _GameCfg      = new Cvar("gamecfg", "0");
                _Scratch1     = new Cvar("scratch1", "0");
                _Scratch2     = new Cvar("scratch2", "0");
                _Scratch3     = new Cvar("scratch3", "0");
                _Scratch4     = new Cvar("scratch4", "0");
                _SavedGameCfg = new Cvar("savedgamecfg", "0", true);
                _Saved1       = new Cvar("saved1", "0", true);
                _Saved2       = new Cvar("saved2", "0", true);
                _Saved3       = new Cvar("saved3", "0", true);
                _Saved4       = new Cvar("saved4", "0", true);
            }
        }
Exemplo n.º 10
0
        public void Init()
        {
            _DriverLevel = Array.IndexOf(Net.Drivers, this);
            Cmd.Add("net_stats", Stats_f);

            if (Common.HasParam("-nolan"))
            {
                return;
            }

            foreach (INetLanDriver driver in Net.LanDrivers)
            {
                driver.Init();
            }

#if BAN_TEST
            Cmd_AddCommand("ban", NET_Ban_f);
#endif
            //Cmd.Add("test", Test_f);
            //Cmd.Add("test2", Test2_f);

            _IsInitialized = true;
        }
Exemplo n.º 11
0
        // S_Init (void)
        public static void Init()
        {
            Con.Print("\nSound Initialization\n");

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

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

            Cmd.Add("play", Play);
            Cmd.Add("playvol", PlayVol);
            Cmd.Add("stopsound", StopAllSoundsCmd);
            Cmd.Add("soundlist", SoundList);
            Cmd.Add("soundinfo", SoundInfo_f);

            _IsInitialized = true;

            Startup();

            InitScaletable();

            _NumSfx = 0;

            Con.Print("Sound sampling rate: {0}\n", _shm.speed);

            // provides a tick sound until washed clean
            _AmbientSfx[Ambients.AMBIENT_WATER] = PrecacheSound("ambience/water1.wav");
            _AmbientSfx[Ambients.AMBIENT_SKY]   = PrecacheSound("ambience/wind2.wav");

            StopAllSounds(true);
        }
Exemplo n.º 12
0
        // NET_Init (void)
        public static void Init()
        {
            for (int i2 = 0; i2 < _HostCache.Length; i2++)
            {
                _HostCache[i2] = new hostcache_t();
            }

            if (_Drivers == null)
            {
                if (Common.HasParam("-playback"))
                {
                    _Drivers = new INetDriver[]
                    {
                        new NetVcr()
                    };
                }
                else
                {
                    _Drivers = new INetDriver[]
                    {
                        new NetLoop(),
                        NetDatagram.Instance
                    };
                }
            }

            if (_LanDrivers == null)
            {
                _LanDrivers = new INetLanDriver[]
                {
                    NetTcpIp.Instance
                };
            }

            if (Common.HasParam("-record"))
            {
                _IsRecording = true;
            }

            int i = Common.CheckParm("-port");

            if (i == 0)
            {
                i = Common.CheckParm("-udpport");
            }
            if (i == 0)
            {
                i = Common.CheckParm("-ipxport");
            }

            if (i > 0)
            {
                if (i < Common.Argc - 1)
                {
                    _DefHostPort = Common.atoi(Common.Argv(i + 1));
                }
                else
                {
                    Sys.Error("Net.Init: you must specify a number after -port!");
                }
            }
            HostPort = _DefHostPort;

            if (Common.HasParam("-listen") || Client.cls.state == cactive_t.ca_dedicated)
            {
                _IsListening = true;
            }
            int numsockets = Server.svs.maxclientslimit;

            if (Client.cls.state != cactive_t.ca_dedicated)
            {
                numsockets++;
            }

            _FreeSockets   = new List <qsocket_t>(numsockets);
            _ActiveSockets = new List <qsocket_t>(numsockets);

            for (i = 0; i < numsockets; i++)
            {
                _FreeSockets.Add(new qsocket_t());
            }

            SetNetTime();

            // allocate space for network message buffer
            Message = new MsgWriter(NET_MAXMESSAGE); // SZ_Alloc (&net_message, NET_MAXMESSAGE);
            Reader  = new MsgReader(Net.Message);

            if (_MessageTimeout == null)
            {
                _MessageTimeout = new Cvar("net_messagetimeout", "300");
                _HostName       = new Cvar("hostname", "UNNAMED");
            }

            Cmd.Add("slist", Slist_f);
            Cmd.Add("listen", Listen_f);
            Cmd.Add("maxplayers", MaxPlayers_f);
            Cmd.Add("port", Port_f);

            // initialize all the drivers
            _DriverLevel = 0;
            foreach (INetDriver driver in _Drivers)
            {
                driver.Init();
                if (driver.IsInitialized && _IsListening)
                {
                    driver.Listen(true);
                }
                _DriverLevel++;
            }

            //if (*my_ipx_address)
            //    Con_DPrintf("IPX address %s\n", my_ipx_address);
            if (!String.IsNullOrEmpty(_MyTcpIpAddress))
            {
                Con.DPrint("TCP/IP address {0}\n", _MyTcpIpAddress);
            }
        }
Exemplo n.º 13
0
        // Key_Init (void);
        public static void Init()
        {
            for (int i = 0; i < 32; i++)
            {
                _Lines[i]    = new char[MAXCMDLINE];
                _Lines[i][0] = ']'; // key_lines[i][0] = ']'; key_lines[i][1] = 0;
            }
            LinePos = 1;

            //
            // init ascii characters in console mode
            //
            for (int i = 32; i < 128; i++)
            {
                _ConsoleKeys[i] = true;
            }

            _ConsoleKeys[K_ENTER]      = true;
            _ConsoleKeys[K_TAB]        = true;
            _ConsoleKeys[K_LEFTARROW]  = true;
            _ConsoleKeys[K_RIGHTARROW] = true;
            _ConsoleKeys[K_UPARROW]    = true;
            _ConsoleKeys[K_DOWNARROW]  = true;
            _ConsoleKeys[K_BACKSPACE]  = true;
            _ConsoleKeys[K_PGUP]       = true;
            _ConsoleKeys[K_PGDN]       = true;
            _ConsoleKeys[K_SHIFT]      = true;
            _ConsoleKeys[K_MWHEELUP]   = true;
            _ConsoleKeys[K_MWHEELDOWN] = true;
            _ConsoleKeys['`']          = false;
            _ConsoleKeys['~']          = false;

            for (int i = 0; i < 256; i++)
            {
                _KeyShift[i] = i;
            }

            for (int i = 'a'; i <= 'z'; i++)
            {
                _KeyShift[i] = i - 'a' + 'A';
            }

            _KeyShift['1']  = '!';
            _KeyShift['2']  = '@';
            _KeyShift['3']  = '#';
            _KeyShift['4']  = '$';
            _KeyShift['5']  = '%';
            _KeyShift['6']  = '^';
            _KeyShift['7']  = '&';
            _KeyShift['8']  = '*';
            _KeyShift['9']  = '(';
            _KeyShift['0']  = ')';
            _KeyShift['-']  = '_';
            _KeyShift['=']  = '+';
            _KeyShift[',']  = '<';
            _KeyShift['.']  = '>';
            _KeyShift['/']  = '?';
            _KeyShift[';']  = ':';
            _KeyShift['\''] = '"';
            _KeyShift['[']  = '{';
            _KeyShift[']']  = '}';
            _KeyShift['`']  = '~';
            _KeyShift['\\'] = '|';

            _MenuBound[K_ESCAPE] = true;
            for (int i = 0; i < 12; i++)
            {
                _MenuBound[K_F1 + i] = true;
            }

            //
            // register our functions
            //
            Cmd.Add("bind", Bind_f);
            Cmd.Add("unbind", Unbind_f);
            Cmd.Add("unbindall", UnbindAll_f);
        }
Exemplo n.º 14
0
        // VID_Init (unsigned char *palette)
        // Called at startup to set up translation tables, takes 256 8 bit RGB values
        // the palette data will go away after the call, so it must be copied off if
        // the video driver will need it again
        public static void Init(byte[] palette)
        {
            if (_glZTrick == null)
            {
                _glZTrick       = new Cvar("gl_ztrick", "1");
                _Mode           = new Cvar("vid_mode", "0", false);
                _DefaultMode    = new Cvar("_vid_default_mode", "0", true);
                _DefaultModeWin = new Cvar("_vid_default_mode_win", "3", true);
                _Wait           = new Cvar("vid_wait", "0");
                _NoPageFlip     = new Cvar("vid_nopageflip", "0", true);
                _WaitOverride   = new Cvar("_vid_wait_override", "0", true);
                _ConfigX        = new Cvar("vid_config_x", "800", true);
                _ConfigY        = new Cvar("vid_config_y", "600", true);
                _StretchBy2     = new Cvar("vid_stretch_by_2", "1", true);
                _WindowedMouse  = new Cvar("_windowed_mouse", "1", true);
            }

            Cmd.Add("vid_nummodes", NumModes_f);
            Cmd.Add("vid_describecurrentmode", DescribeCurrentMode_f);
            Cmd.Add("vid_describemode", DescribeMode_f);
            Cmd.Add("vid_describemodes", DescribeModes_f);

            DisplayDevice dev = MainForm.DisplayDevice;

            // Enumerate available modes, skip 8 bpp modes, and group by refresh rates
            List <mode_t> tmp = new List <mode_t>(dev.AvailableResolutions.Count);

            foreach (DisplayResolution res in dev.AvailableResolutions)
            {
                if (res.BitsPerPixel <= 8)
                {
                    continue;
                }

                Predicate <mode_t> SameMode = delegate(mode_t m)
                {
                    return(m.width == res.Width && m.height == res.Height && m.bpp == res.BitsPerPixel);
                };
                if (tmp.Exists(SameMode))
                {
                    continue;
                }

                mode_t mode = new mode_t();
                mode.width       = res.Width;
                mode.height      = res.Height;
                mode.bpp         = res.BitsPerPixel;
                mode.refreshRate = res.RefreshRate;
                tmp.Add(mode);
            }
            _Modes = tmp.ToArray();

            mode_t mode1 = new mode_t();

            mode1.width       = dev.Width;
            mode1.height      = dev.Height;
            mode1.bpp         = dev.BitsPerPixel;
            mode1.refreshRate = dev.RefreshRate;
            mode1.fullScreen  = true;

            int width = dev.Width, height = dev.Height;
            int i = Common.CheckParm("-width");

            if (i > 0 && i < Common.Argc - 1)
            {
                width = Common.atoi(Common.Argv(i + 1));

                foreach (DisplayResolution res in dev.AvailableResolutions)
                {
                    if (res.Width == width)
                    {
                        height = res.Height;
                        break;
                    }
                }
            }

            i = Common.CheckParm("-height");
            if (i > 0 && i < Common.Argc - 1)
            {
                height = Common.atoi(Common.Argv(i + 1));
            }

            mode1.width  = width;
            mode1.height = height;

            if (Common.HasParam("-window"))
            {
                _Windowed = true;
            }
            else
            {
                _Windowed = false;

                if (Common.HasParam("-current"))
                {
                    mode1.width  = dev.Width;
                    mode1.height = dev.Height;
                }
                else
                {
                    int bpp = mode1.bpp;
                    i = Common.CheckParm("-bpp");
                    if (i > 0 && i < Common.Argc - 1)
                    {
                        bpp = Common.atoi(Common.Argv(i + 1));
                    }
                    mode1.bpp = bpp;
                }
            }

            _IsInitialized = true;

            int i2 = Common.CheckParm("-conwidth");

            if (i2 > 0)
            {
                Scr.vid.conwidth = Common.atoi(Common.Argv(i2 + 1));
            }
            else
            {
                Scr.vid.conwidth = 640;
            }

            Scr.vid.conwidth &= 0xfff8; // make it a multiple of eight

            if (Scr.vid.conwidth < 320)
            {
                Scr.vid.conwidth = 320;
            }

            // pick a conheight that matches with correct aspect
            Scr.vid.conheight = Scr.vid.conwidth * 3 / 4;

            i2 = Common.CheckParm("-conheight");
            if (i2 > 0)
            {
                Scr.vid.conheight = Common.atoi(Common.Argv(i2 + 1));
            }
            if (Scr.vid.conheight < 200)
            {
                Scr.vid.conheight = 200;
            }

            Scr.vid.maxwarpwidth  = WARP_WIDTH;
            Scr.vid.maxwarpheight = WARP_HEIGHT;
            Scr.vid.colormap      = Host.ColorMap;
            int v = BitConverter.ToInt32(Host.ColorMap, 2048);

            Scr.vid.fullbright = 256 - Common.LittleLong(v);

            CheckGamma(palette);
            SetPalette(palette);

            mode1.fullScreen = !_Windowed;

            _DefModeNum = -1;
            for (i = 0; i < _Modes.Length; i++)
            {
                mode_t m = _Modes[i];
                if (m.width != mode1.width || m.height != mode1.height)
                {
                    continue;
                }

                _DefModeNum = i;

                if (m.bpp == mode1.bpp && m.refreshRate == mode1.refreshRate)
                {
                    break;
                }
            }
            if (_DefModeNum == -1)
            {
                _DefModeNum = 0;
            }

            SetMode(_DefModeNum, palette);

            InitOpenGL();

            Directory.CreateDirectory(Path.Combine(Common.GameDir, "glquake"));
        }
Exemplo n.º 15
0
        }                                     // sb_lines scan lines to draw


        // Sbar_Init
        public static void Init()
        {
            for (int i = 0; i < 10; i++)
            {
                string str = i.ToString();
                _Nums[0, i] = Drawer.PicFromWad("num_" + str);
                _Nums[1, i] = Drawer.PicFromWad("anum_" + str);
            }

            _Nums[0, 10] = Drawer.PicFromWad("num_minus");
            _Nums[1, 10] = Drawer.PicFromWad("anum_minus");

            _Colon = Drawer.PicFromWad("num_colon");
            _Slash = Drawer.PicFromWad("num_slash");

            _Weapons[0, 0] = Drawer.PicFromWad("inv_shotgun");
            _Weapons[0, 1] = Drawer.PicFromWad("inv_sshotgun");
            _Weapons[0, 2] = Drawer.PicFromWad("inv_nailgun");
            _Weapons[0, 3] = Drawer.PicFromWad("inv_snailgun");
            _Weapons[0, 4] = Drawer.PicFromWad("inv_rlaunch");
            _Weapons[0, 5] = Drawer.PicFromWad("inv_srlaunch");
            _Weapons[0, 6] = Drawer.PicFromWad("inv_lightng");

            _Weapons[1, 0] = Drawer.PicFromWad("inv2_shotgun");
            _Weapons[1, 1] = Drawer.PicFromWad("inv2_sshotgun");
            _Weapons[1, 2] = Drawer.PicFromWad("inv2_nailgun");
            _Weapons[1, 3] = Drawer.PicFromWad("inv2_snailgun");
            _Weapons[1, 4] = Drawer.PicFromWad("inv2_rlaunch");
            _Weapons[1, 5] = Drawer.PicFromWad("inv2_srlaunch");
            _Weapons[1, 6] = Drawer.PicFromWad("inv2_lightng");

            for (int i = 0; i < 5; i++)
            {
                string s = "inva" + (i + 1).ToString();
                _Weapons[2 + i, 0] = Drawer.PicFromWad(s + "_shotgun");
                _Weapons[2 + i, 1] = Drawer.PicFromWad(s + "_sshotgun");
                _Weapons[2 + i, 2] = Drawer.PicFromWad(s + "_nailgun");
                _Weapons[2 + i, 3] = Drawer.PicFromWad(s + "_snailgun");
                _Weapons[2 + i, 4] = Drawer.PicFromWad(s + "_rlaunch");
                _Weapons[2 + i, 5] = Drawer.PicFromWad(s + "_srlaunch");
                _Weapons[2 + i, 6] = Drawer.PicFromWad(s + "_lightng");
            }

            _Ammo[0] = Drawer.PicFromWad("sb_shells");
            _Ammo[1] = Drawer.PicFromWad("sb_nails");
            _Ammo[2] = Drawer.PicFromWad("sb_rocket");
            _Ammo[3] = Drawer.PicFromWad("sb_cells");

            _Armor[0] = Drawer.PicFromWad("sb_armor1");
            _Armor[1] = Drawer.PicFromWad("sb_armor2");
            _Armor[2] = Drawer.PicFromWad("sb_armor3");

            _Items[0] = Drawer.PicFromWad("sb_key1");
            _Items[1] = Drawer.PicFromWad("sb_key2");
            _Items[2] = Drawer.PicFromWad("sb_invis");
            _Items[3] = Drawer.PicFromWad("sb_invuln");
            _Items[4] = Drawer.PicFromWad("sb_suit");
            _Items[5] = Drawer.PicFromWad("sb_quad");

            _Sigil[0] = Drawer.PicFromWad("sb_sigil1");
            _Sigil[1] = Drawer.PicFromWad("sb_sigil2");
            _Sigil[2] = Drawer.PicFromWad("sb_sigil3");
            _Sigil[3] = Drawer.PicFromWad("sb_sigil4");

            _Faces[4, 0] = Drawer.PicFromWad("face1");
            _Faces[4, 1] = Drawer.PicFromWad("face_p1");
            _Faces[3, 0] = Drawer.PicFromWad("face2");
            _Faces[3, 1] = Drawer.PicFromWad("face_p2");
            _Faces[2, 0] = Drawer.PicFromWad("face3");
            _Faces[2, 1] = Drawer.PicFromWad("face_p3");
            _Faces[1, 0] = Drawer.PicFromWad("face4");
            _Faces[1, 1] = Drawer.PicFromWad("face_p4");
            _Faces[0, 0] = Drawer.PicFromWad("face5");
            _Faces[0, 1] = Drawer.PicFromWad("face_p5");

            _FaceInvis       = Drawer.PicFromWad("face_invis");
            _FaceInvuln      = Drawer.PicFromWad("face_invul2");
            _FaceInvisInvuln = Drawer.PicFromWad("face_inv2");
            _FaceQuad        = Drawer.PicFromWad("face_quad");

            Cmd.Add("+showscores", ShowScores);
            Cmd.Add("-showscores", DontShowScores);

            _SBar     = Drawer.PicFromWad("sbar");
            _IBar     = Drawer.PicFromWad("ibar");
            _ScoreBar = Drawer.PicFromWad("scorebar");

            //MED 01/04/97 added new hipnotic weapons
            if (Common.GameKind == GameKind.Hipnotic)
            {
                _HWeapons[0, 0] = Drawer.PicFromWad("inv_laser");
                _HWeapons[0, 1] = Drawer.PicFromWad("inv_mjolnir");
                _HWeapons[0, 2] = Drawer.PicFromWad("inv_gren_prox");
                _HWeapons[0, 3] = Drawer.PicFromWad("inv_prox_gren");
                _HWeapons[0, 4] = Drawer.PicFromWad("inv_prox");

                _HWeapons[1, 0] = Drawer.PicFromWad("inv2_laser");
                _HWeapons[1, 1] = Drawer.PicFromWad("inv2_mjolnir");
                _HWeapons[1, 2] = Drawer.PicFromWad("inv2_gren_prox");
                _HWeapons[1, 3] = Drawer.PicFromWad("inv2_prox_gren");
                _HWeapons[1, 4] = Drawer.PicFromWad("inv2_prox");

                for (int i = 0; i < 5; i++)
                {
                    string s = "inva" + (i + 1).ToString();
                    _HWeapons[2 + i, 0] = Drawer.PicFromWad(s + "_laser");
                    _HWeapons[2 + i, 1] = Drawer.PicFromWad(s + "_mjolnir");
                    _HWeapons[2 + i, 2] = Drawer.PicFromWad(s + "_gren_prox");
                    _HWeapons[2 + i, 3] = Drawer.PicFromWad(s + "_prox_gren");
                    _HWeapons[2 + i, 4] = Drawer.PicFromWad(s + "_prox");
                }

                _HItems[0] = Drawer.PicFromWad("sb_wsuit");
                _HItems[1] = Drawer.PicFromWad("sb_eshld");
            }

            if (Common.GameKind == GameKind.Rogue)
            {
                _RInvBar[0] = Drawer.PicFromWad("r_invbar1");
                _RInvBar[1] = Drawer.PicFromWad("r_invbar2");

                _RWeapons[0] = Drawer.PicFromWad("r_lava");
                _RWeapons[1] = Drawer.PicFromWad("r_superlava");
                _RWeapons[2] = Drawer.PicFromWad("r_gren");
                _RWeapons[3] = Drawer.PicFromWad("r_multirock");
                _RWeapons[4] = Drawer.PicFromWad("r_plasma");

                _RItems[0] = Drawer.PicFromWad("r_shield1");
                _RItems[1] = Drawer.PicFromWad("r_agrav1");

                // PGM 01/19/97 - team color border
                _RTeamBord = Drawer.PicFromWad("r_teambord");
                // PGM 01/19/97 - team color border

                _RAmmo[0] = Drawer.PicFromWad("r_ammolava");
                _RAmmo[1] = Drawer.PicFromWad("r_ammomulti");
                _RAmmo[2] = Drawer.PicFromWad("r_ammoplasma");
            }
        }
Exemplo n.º 16
0
        // Draw_Init
        public static void Init()
        {
            for (int i = 0; i < _MenuCachePics.Length; i++)
            {
                _MenuCachePics[i] = new cachepic_t();
            }

            if (_glNoBind == null)
            {
                _glNoBind  = new Cvar("gl_nobind", "0");
                _glMaxSize = new Cvar("gl_max_size", "1024");
                _glPicMip  = new Cvar("gl_picmip", "0");
            }

            // 3dfx can only handle 256 wide textures
            string renderer = GL.GetString(StringName.Renderer);

            if (renderer.Contains("3dfx") || renderer.Contains("Glide"))
            {
                Cvar.Set("gl_max_size", "256");
            }

            Cmd.Add("gl_texturemode", TextureMode_f);

            // load the console background and the charset
            // by hand, because we need to write the version
            // string into the background before turning
            // it into a texture
            int offset = Wad.GetLumpNameOffset("conchars");

            byte[] draw_chars = Wad.Data; // draw_chars
            for (int i = 0; i < 256 * 64; i++)
            {
                if (draw_chars[offset + i] == 0)
                {
                    draw_chars[offset + i] = 255;   // proper transparent color
                }
            }

            // now turn them into textures
            _CharTexture = LoadTexture("charset", 128, 128, new ByteArraySegment(draw_chars, offset), false, true);

            byte[] buf = Common.LoadFile("gfx/conback.lmp");
            if (buf == null)
            {
                Sys.Error("Couldn't load gfx/conback.lmp");
            }

            dqpicheader_t cbHeader = Sys.BytesToStructure <dqpicheader_t>(buf, 0);

            Wad.SwapPic(cbHeader);

            // hack the version number directly into the pic
            string ver     = String.Format("(c# {0,7:F2}) {1,7:F2}", (float)QDef.CSQUAKE_VERSION, (float)QDef.VERSION);
            int    offset2 = Marshal.SizeOf(typeof(dqpicheader_t)) + 320 * 186 + 320 - 11 - 8 * ver.Length;
            int    y       = ver.Length;

            for (int x = 0; x < y; x++)
            {
                CharToConback(ver[x], new ByteArraySegment(buf, offset2 + (x << 3)), new ByteArraySegment(draw_chars, offset));
            }

            _ConBack        = new glpic_t();
            _ConBack.width  = cbHeader.width;
            _ConBack.height = cbHeader.height;
            int ncdataIndex = Marshal.SizeOf(typeof(dqpicheader_t)); // cb->data;

            SetTextureFilters(TextureMinFilter.Nearest, TextureMagFilter.Nearest);

            _ConBack.texnum = LoadTexture("conback", _ConBack.width, _ConBack.height, new ByteArraySegment(buf, ncdataIndex), false, false);
            _ConBack.width  = Scr.vid.width;
            _ConBack.height = Scr.vid.height;

            // save a texture slot for translated picture
            _TranslateTexture = _TextureExtensionNumber++;

            // save slots for scraps
            _ScrapTexNum             = _TextureExtensionNumber;
            _TextureExtensionNumber += MAX_SCRAPS;

            //
            // get the other pics we need
            //
            _Disc     = PicFromWad("disc");
            _BackTile = PicFromWad("backtile");
        }