// SCR_Init public void Initialise( ) { if (Host.Cvars.ViewSize == null) { Host.Cvars.ViewSize = Host.CVars.Add("viewsize", 100f, ClientVariableFlags.Archive); Host.Cvars.Fov = Host.CVars.Add("fov", 90f, ClientVariableFlags.Archive); // 10 - 170 Host.Cvars.ConSpeed = Host.CVars.Add("scr_conspeed", 3000); Host.Cvars.CenterTime = Host.CVars.Add("scr_centertime", 2); Host.Cvars.ShowRam = Host.CVars.Add("showram", true); Host.Cvars.ShowTurtle = Host.CVars.Add("showturtle", false); Host.Cvars.ShowPause = Host.CVars.Add("showpause", true); Host.Cvars.PrintSpeed = Host.CVars.Add("scr_printspeed", 8); Host.Cvars.glTripleBuffer = Host.CVars.Add("gl_triplebuffer", 1, ClientVariableFlags.Archive); } // // register our commands // Host.Commands.Add("screenshot", ScreenShot_f); Host.Commands.Add("sizeup", SizeUp_f); Host.Commands.Add("sizedown", SizeDown_f); Ram = BasePicture.FromWad(Host.Video.Device, Host.Wads.FromTexture("ram"), "ram", "GL_LINEAR"); Net = BasePicture.FromWad(Host.Video.Device, Host.Wads.FromTexture("net"), "net", "GL_LINEAR"); Turtle = BasePicture.FromWad(Host.Video.Device, Host.Wads.FromTexture("turtle"), "turtle", "GL_LINEAR"); if (CommandLine.HasParam("-fullsbar")) { FullSbarDraw = true; } _IsInitialized = true; }
// Draw_Init public void Initialise( ) { if (Host.Cvars.glNoBind == null) { Host.Cvars.glNoBind = Host.CVars.Add("gl_nobind", false); Host.Cvars.glMaxSize = Host.CVars.Add("gl_max_size", 8192); Host.Cvars.glPicMip = Host.CVars.Add("gl_picmip", 0f); } // 3dfx can only handle 256 wide textures var renderer = Host.Video.Device.Desc.Renderer; if (renderer.Contains("3dfx") || renderer.Contains("Glide")) { Host.CVars.Set("gl_max_size", 256); } Host.Commands.Add("gl_texturemode", TextureMode_f); Host.Commands.Add("imagelist", Imagelist_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 var concharsWad = Host.Wads.FromTexture("conchars"); var offset = concharsWad.GetLumpNameOffset("conchars"); var draw_chars = concharsWad.Data; // draw_chars for (var i = 0; i < 256 * 64; i++) { if (draw_chars[offset + i] == 0) { draw_chars[offset + i] = 255; // proper transparent color } } // Temporarily set here BaseTexture.PicMip = Host.Cvars.glPicMip.Get <Single>( ); BaseTexture.MaxSize = Host.Cvars.glMaxSize.Get <Int32>(); CharSetFont = new Renderer.Font(Host.Video.Device, "charset"); CharSetFont.Initialise(new ByteArraySegment(draw_chars, offset)); var buf = FileSystem.LoadFile("gfx/conback.lmp"); if (buf == null) { Utilities.Error("Couldn't load gfx/conback.lmp"); } var cbHeader = Utilities.BytesToStructure <WadPicHeader>(buf, 0); EndianHelper.SwapPic(cbHeader); // hack the version number directly into the pic var ver = String.Format($"(c# {QDef.CSQUAKE_VERSION,7:F2}) {QDef.VERSION,7:F2}"); var offset2 = Marshal.SizeOf(typeof(WadPicHeader)) + 320 * 186 + 320 - 11 - 8 * ver.Length; var y = ver.Length; for (var x = 0; x < y; x++) { CharToConback(ver[x], new ByteArraySegment(buf, offset2 + (x << 3)), new ByteArraySegment(draw_chars, offset)); } var ncdataIndex = Marshal.SizeOf(typeof(WadPicHeader)); // cb->data; ConsoleBackground = BasePicture.FromBuffer(Host.Video.Device, new ByteArraySegment(buf, ncdataIndex), ( Int32 )cbHeader.width, ( Int32 )cbHeader.height, "conback", "GL_LINEAR"); TranslateTexture = BaseTexture.FromDynamicBuffer(Host.Video.Device, "_TranslateTexture", new ByteArraySegment(_MenuPlayerPixels), _MenuPlayerPixelWidth, _MenuPlayerPixelHeight, false, true, "GL_LINEAR"); // // get the other pics we need // Disc = BasePicture.FromWad(Host.Video.Device, Host.Wads.FromTexture("disc"), "disc", "GL_NEAREST"); BackgroundTile = BasePicture.FromWad(Host.Video.Device, Host.Wads.FromTexture("backtile"), "backtile", "GL_NEAREST"); IsInitialised = true; }
// Sbar_Init public void Initialise( ) { for (var i = 0; i < 10; i++) { var str = i.ToString( ); Numbers[0, i] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "num_" + str, "GL_NEAREST"); Numbers[1, i] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "anum_" + str, "GL_NEAREST"); } Numbers[0, 10] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "num_minus", "GL_NEAREST"); Numbers[1, 10] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "anum_minus", "GL_NEAREST"); Colon = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "num_colon", "GL_NEAREST"); Slash = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "num_slash", "GL_NEAREST"); Weapons[0, 0] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "inv_shotgun", "GL_LINEAR"); Weapons[0, 1] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "inv_sshotgun", "GL_LINEAR"); Weapons[0, 2] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "inv_nailgun", "GL_LINEAR"); Weapons[0, 3] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "inv_snailgun", "GL_LINEAR"); Weapons[0, 4] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "inv_rlaunch", "GL_LINEAR"); Weapons[0, 5] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "inv_srlaunch", "GL_LINEAR"); Weapons[0, 6] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "inv_lightng", "GL_LINEAR"); Weapons[1, 0] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "inv2_shotgun", "GL_LINEAR"); Weapons[1, 1] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "inv2_sshotgun", "GL_LINEAR"); Weapons[1, 2] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "inv2_nailgun", "GL_LINEAR"); Weapons[1, 3] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "inv2_snailgun", "GL_LINEAR"); Weapons[1, 4] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "inv2_rlaunch", "GL_LINEAR"); Weapons[1, 5] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "inv2_srlaunch", "GL_LINEAR"); Weapons[1, 6] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "inv2_lightng", "GL_LINEAR"); for (var i = 0; i < 5; i++) { var s = "inva" + (i + 1).ToString( ); Weapons[2 + i, 0] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, s + "_shotgun", "GL_LINEAR"); Weapons[2 + i, 1] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, s + "_sshotgun", "GL_LINEAR"); Weapons[2 + i, 2] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, s + "_nailgun", "GL_LINEAR"); Weapons[2 + i, 3] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, s + "_snailgun", "GL_LINEAR"); Weapons[2 + i, 4] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, s + "_rlaunch", "GL_LINEAR"); Weapons[2 + i, 5] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, s + "_srlaunch", "GL_LINEAR"); Weapons[2 + i, 6] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, s + "_lightng", "GL_LINEAR"); } Ammo[0] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "sb_shells", "GL_LINEAR"); Ammo[1] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "sb_nails", "GL_LINEAR"); Ammo[2] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "sb_rocket", "GL_LINEAR"); Ammo[3] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "sb_cells", "GL_LINEAR"); Armour[0] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "sb_armor1", "GL_LINEAR"); Armour[1] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "sb_armor2", "GL_LINEAR"); Armour[2] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "sb_armor3", "GL_LINEAR"); Items[0] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "sb_key1", "GL_LINEAR"); Items[1] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "sb_key2", "GL_LINEAR"); Items[2] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "sb_invis", "GL_LINEAR"); Items[3] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "sb_invuln", "GL_LINEAR"); Items[4] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "sb_suit", "GL_LINEAR"); Items[5] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "sb_quad", "GL_LINEAR"); Sigil[0] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "sb_sigil1", "GL_LINEAR"); Sigil[1] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "sb_sigil2", "GL_LINEAR"); Sigil[2] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "sb_sigil3", "GL_LINEAR"); Sigil[3] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "sb_sigil4", "GL_LINEAR"); Faces[4, 0] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "face1", "GL_NEAREST"); Faces[4, 1] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "face_p1", "GL_NEAREST"); Faces[3, 0] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "face2", "GL_NEAREST"); Faces[3, 1] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "face_p2", "GL_NEAREST"); Faces[2, 0] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "face3", "GL_NEAREST"); Faces[2, 1] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "face_p3", "GL_NEAREST"); Faces[1, 0] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "face4", "GL_NEAREST"); Faces[1, 1] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "face_p4", "GL_NEAREST"); Faces[0, 0] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "face5", "GL_NEAREST"); Faces[0, 1] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "face_p5", "GL_NEAREST"); FaceInvis = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "face_invis", "GL_NEAREST"); FaceInvuln = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "face_invul2", "GL_NEAREST"); FaceInvisInvuln = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "face_inv2", "GL_NEAREST"); FaceQuad = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "face_quad", "GL_NEAREST"); Host.Commands.Add("+showscores", ShowScores); Host.Commands.Add("-showscores", DontShowScores); SBar = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "sbar", "GL_NEAREST"); IBar = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "ibar", "GL_NEAREST"); ScoreBar = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "scorebar", "GL_LINEAR"); //MED 01/04/97 added new hipnotic weapons if (MainWindow.Common.GameKind == GameKind.Hipnotic) { HWeapons[0, 0] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "inv_laser", "GL_LINEAR"); HWeapons[0, 1] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "inv_mjolnir", "GL_LINEAR"); HWeapons[0, 2] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "inv_gren_prox", "GL_LINEAR"); HWeapons[0, 3] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "inv_prox_gren", "GL_LINEAR"); HWeapons[0, 4] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "inv_prox", "GL_LINEAR"); HWeapons[1, 0] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "inv2_laser", "GL_LINEAR"); HWeapons[1, 1] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "inv2_mjolnir", "GL_LINEAR"); HWeapons[1, 2] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "inv2_gren_prox", "GL_LINEAR"); HWeapons[1, 3] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "inv2_prox_gren", "GL_LINEAR"); HWeapons[1, 4] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "inv2_prox", "GL_LINEAR"); for (var i = 0; i < 5; i++) { var s = "inva" + (i + 1).ToString( ); HWeapons[2 + i, 0] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, s + "_laser", "GL_LINEAR"); HWeapons[2 + i, 1] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, s + "_mjolnir", "GL_LINEAR"); HWeapons[2 + i, 2] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, s + "_gren_prox", "GL_LINEAR"); HWeapons[2 + i, 3] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, s + "_prox_gren", "GL_LINEAR"); HWeapons[2 + i, 4] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, s + "_prox", "GL_LINEAR"); } HItems[0] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "sb_wsuit", "GL_LINEAR"); HItems[1] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "sb_eshld", "GL_LINEAR"); } if (MainWindow.Common.GameKind == GameKind.Rogue) { RInvBar[0] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "r_invbar1", "GL_LINEAR"); RInvBar[1] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "r_invbar2", "GL_LINEAR"); RWeapons[0] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "r_lava", "GL_LINEAR"); RWeapons[1] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "r_superlava", "GL_LINEAR"); RWeapons[2] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "r_gren", "GL_LINEAR"); RWeapons[3] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "r_multirock", "GL_LINEAR"); RWeapons[4] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "r_plasma", "GL_LINEAR"); RItems[0] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "r_shield1", "GL_LINEAR"); RItems[1] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "r_agrav1", "GL_LINEAR"); // PGM 01/19/97 - team color border RTeamBord = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "r_teambord", "GL_LINEAR"); // PGM 01/19/97 - team color border RAmmo[0] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "r_ammolava", "GL_LINEAR"); RAmmo[1] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "r_ammomulti", "GL_LINEAR"); RAmmo[2] = BasePicture.FromWad(Host.Video.Device, Host.GfxWad, "r_ammoplasma", "GL_LINEAR"); } }