static void Main(string[] args) { //InfiniminerMessageBox.Show("Test :)"); if (Debugger.IsAttached) { using (InfiniminerGame game = new InfiniminerGame(args)) { game.Run(); } } else { using (InfiniminerGame game = new InfiniminerGame(args)) { try { game.Run(); } catch (Exception e) { //System.Windows.Forms.MessageBox.Show(e.Message + "\r\n\r\n" + e.StackTrace); InfiniminerMessageBox.Show(e.Message + "\r\n\r\n" + e.StackTrace); } } } }
public SkyplaneEngine(InfiniminerGame gameInstance) { this.gameInstance = gameInstance; // Generate a noise texture. randGen = new Random(); texNoise = new Texture2D(gameInstance.GraphicsDevice, 64, 64); uint[] noiseData = new uint[64 * 64]; for (int i = 0; i < 64 * 64; i++) { if (randGen.Next(32) == 0) { noiseData[i] = Color.White.PackedValue; } else { noiseData[i] = Color.Black.PackedValue; } } texNoise.SetData(noiseData); // Load the effect file. effect = gameInstance.Content.Load <Effect>("effect_skyplane"); // Create our vertices. vertexDeclaration = new VertexDeclaration(VertexPositionTexture.VertexDeclaration.GetVertexElements()); vertices = new VertexPositionTexture[6]; vertices[0] = new VertexPositionTexture(new Vector3(-210, 100, -210), new Vector2(0, 0)); vertices[1] = new VertexPositionTexture(new Vector3(274, 100, -210), new Vector2(1, 0)); vertices[2] = new VertexPositionTexture(new Vector3(274, 100, 274), new Vector2(1, 1)); vertices[3] = new VertexPositionTexture(new Vector3(-210, 100, -210), new Vector2(0, 0)); vertices[4] = new VertexPositionTexture(new Vector3(274, 100, 274), new Vector2(1, 1)); vertices[5] = new VertexPositionTexture(new Vector3(-210, 100, 274), new Vector2(0, 1)); }
public SkyplaneEngine(InfiniminerGame gameInstance) { this.gameInstance = gameInstance; // Generate a noise texture. randGen = new Random(); texNoise = new Texture2D(gameInstance.GraphicsDevice, 64, 64); uint[] noiseData = new uint[64*64]; for (int i = 0; i < 64 * 64; i++) if (randGen.Next(32) == 0) noiseData[i] = Color.White.PackedValue; else noiseData[i] = Color.Black.PackedValue; texNoise.SetData(noiseData); // Load the effect file. effect = gameInstance.Content.Load<Effect>("effect_skyplane"); // Create our vertices. vertexDeclaration = new VertexDeclaration(gameInstance.GraphicsDevice, VertexPositionTexture.VertexElements); vertices = new VertexPositionTexture[6]; vertices[0] = new VertexPositionTexture(new Vector3(-210, 100, -210), new Vector2(0, 0)); vertices[1] = new VertexPositionTexture(new Vector3(274, 100, -210), new Vector2(1, 0)); vertices[2] = new VertexPositionTexture(new Vector3(274, 100, 274), new Vector2(1, 1)); vertices[3] = new VertexPositionTexture(new Vector3(-210, 100, -210), new Vector2(0, 0)); vertices[4] = new VertexPositionTexture(new Vector3(274, 100, 274), new Vector2(1, 1)); vertices[5] = new VertexPositionTexture(new Vector3(-210, 100, 274), new Vector2(0, 1)); }
public PropertyBag(InfiniminerGame gameInstance) { // Initialize our network device. NetPeerConfiguration netConfig = new NetPeerConfiguration("InfiniminerPlus"); netConfig.EnableMessageType(NetIncomingMessageType.DiscoveryResponse); netConfig.EnableMessageType(NetIncomingMessageType.ErrorMessage); netConfig.EnableMessageType(NetIncomingMessageType.DebugMessage); netConfig.EnableMessageType(NetIncomingMessageType.WarningMessage); netClient = new NetClient(netConfig); //netClient.SimulatedMinimumLatency = 0.1f; //netClient.SimulatedLatencyVariance = 0.05f; //netClient.SimulatedLoss = 0.1f; //netClient.SimulatedDuplicates = 0.05f; netClient.Start(); // Initialize engines. Engines = new Dictionary <string, Tuple <IEngine, Type> >(); RegisterEngine(new BlockEngine(gameInstance), "blockEngine"); RegisterEngine(new InterfaceEngine(gameInstance), "interfaceEngine"); RegisterEngine(new PlayerEngine(gameInstance), "playerEngine"); RegisterEngine(new SkyplaneEngine(gameInstance), "skyplaneEngine"); RegisterEngine(new ParticleEngine(gameInstance), "particleEngine"); PlayerContainer = new PlayerContainer(); SettingsContainer = new SettingsContainer(); ChatContainer = new ChatContainer(); TeamContainer = new TeamContainer(); TeamContainer.BeaconList = new Dictionary <Vector3, Beacon>(); PlayerList = new Dictionary <uint, Player>(); // Create a camera. PlayerContainer.PlayerCamera = new Camera(gameInstance.GraphicsDevice); UpdateCamera(); // Load sounds. if (!gameInstance.NoSound) { soundList[InfiniminerSound.DigDirt] = gameInstance.Content.Load <SoundEffect>("sounds/dig-dirt"); soundList[InfiniminerSound.DigMetal] = gameInstance.Content.Load <SoundEffect>("sounds/dig-metal"); soundList[InfiniminerSound.Ping] = gameInstance.Content.Load <SoundEffect>("sounds/ping"); soundList[InfiniminerSound.ConstructionGun] = gameInstance.Content.Load <SoundEffect>("sounds/build"); soundList[InfiniminerSound.Death] = gameInstance.Content.Load <SoundEffect>("sounds/death"); soundList[InfiniminerSound.CashDeposit] = gameInstance.Content.Load <SoundEffect>("sounds/cash"); soundList[InfiniminerSound.ClickHigh] = gameInstance.Content.Load <SoundEffect>("sounds/click-loud"); soundList[InfiniminerSound.ClickLow] = gameInstance.Content.Load <SoundEffect>("sounds/click-quiet"); soundList[InfiniminerSound.GroundHit] = gameInstance.Content.Load <SoundEffect>("sounds/hitground"); soundList[InfiniminerSound.Teleporter] = gameInstance.Content.Load <SoundEffect>("sounds/teleport"); soundList[InfiniminerSound.Jumpblock] = gameInstance.Content.Load <SoundEffect>("sounds/jumpblock"); soundList[InfiniminerSound.Explosion] = gameInstance.Content.Load <SoundEffect>("sounds/explosion"); soundList[InfiniminerSound.RadarHigh] = gameInstance.Content.Load <SoundEffect>("sounds/radar-high"); soundList[InfiniminerSound.RadarLow] = gameInstance.Content.Load <SoundEffect>("sounds/radar-low"); soundList[InfiniminerSound.RadarSwitch] = gameInstance.Content.Load <SoundEffect>("sounds/switch"); } }
public ParticleEngine(InfiniminerGame gameInstance) { this.gameInstance = gameInstance; particleEffect = gameInstance.Content.Load <Effect>("effect_particle"); randGen = new Random(); particleList = new List <Particle>(); VertexPositionTextureShade[] vertices = GenerateVertices(); vertexBuffer = new VertexBuffer(gameInstance.GraphicsDevice, new VertexDeclaration(VertexPositionTextureShade.VertexElements), vertices.Length * VertexPositionTextureShade.SizeInBytes, BufferUsage.WriteOnly); vertexBuffer.SetData(vertices); }
public ParticleEngine(InfiniminerGame gameInstance) { this.gameInstance = gameInstance; particleEffect = gameInstance.Content.Load<Effect>("effect_particle"); randGen = new Random(); particleList = new List<Particle>(); vertexDeclaration = new VertexDeclaration(gameInstance.GraphicsDevice, VertexPositionTextureShade.VertexElements); VertexPositionTextureShade[] vertices = GenerateVertices(); vertexBuffer = new VertexBuffer(gameInstance.GraphicsDevice, vertices.Length * VertexPositionTextureShade.SizeInBytes, BufferUsage.WriteOnly); vertexBuffer.SetData(vertices); }
public PropertyBag(InfiniminerGame gameInstance) { // Initialize our network device. NetPeerConfiguration netConfig = new NetPeerConfiguration("InfiniminerPlus"); netClient = new NetClient(netConfig); netConfig.SetMessageTypeEnabled(NetIncomingMessageType.ErrorMessage, true); //netClient.SimulatedMinimumLatency = 0.1f; //netClient.SimulatedLatencyVariance = 0.05f; //netClient.SimulatedLoss = 0.1f; //netClient.SimulatedDuplicates = 0.05f; netClient.Start(); // Initialize engines. blockEngine = new BlockEngine(gameInstance); interfaceEngine = new InterfaceEngine(gameInstance); playerEngine = new PlayerEngine(gameInstance); skyplaneEngine = new SkyplaneEngine(gameInstance); particleEngine = new ParticleEngine(gameInstance); // Create a camera. playerCamera = new Camera(gameInstance.GraphicsDevice); UpdateCamera(); // Load sounds. if (!gameInstance.NoSound) { soundList[InfiniminerSound.DigDirt] = gameInstance.Content.Load <SoundEffect>("sounds/dig-dirt"); soundList[InfiniminerSound.DigMetal] = gameInstance.Content.Load <SoundEffect>("sounds/dig-metal"); soundList[InfiniminerSound.Ping] = gameInstance.Content.Load <SoundEffect>("sounds/ping"); soundList[InfiniminerSound.ConstructionGun] = gameInstance.Content.Load <SoundEffect>("sounds/build"); soundList[InfiniminerSound.Death] = gameInstance.Content.Load <SoundEffect>("sounds/death"); soundList[InfiniminerSound.CashDeposit] = gameInstance.Content.Load <SoundEffect>("sounds/cash"); soundList[InfiniminerSound.ClickHigh] = gameInstance.Content.Load <SoundEffect>("sounds/click-loud"); soundList[InfiniminerSound.ClickLow] = gameInstance.Content.Load <SoundEffect>("sounds/click-quiet"); soundList[InfiniminerSound.GroundHit] = gameInstance.Content.Load <SoundEffect>("sounds/hitground"); soundList[InfiniminerSound.Teleporter] = gameInstance.Content.Load <SoundEffect>("sounds/teleport"); soundList[InfiniminerSound.Jumpblock] = gameInstance.Content.Load <SoundEffect>("sounds/jumpblock"); soundList[InfiniminerSound.Explosion] = gameInstance.Content.Load <SoundEffect>("sounds/explosion"); soundList[InfiniminerSound.RadarHigh] = gameInstance.Content.Load <SoundEffect>("sounds/radar-high"); soundList[InfiniminerSound.RadarLow] = gameInstance.Content.Load <SoundEffect>("sounds/radar-low"); soundList[InfiniminerSound.RadarSwitch] = gameInstance.Content.Load <SoundEffect>("sounds/switch"); } // Create a SINGLE SPRITEBATCH FOR THE F*****G GOD DAMN STATES AND SHIT spriteBatch = new SpriteBatch(gameInstance.GraphicsDevice); //Generate a SINGLE 1px white texture shade = new Texture2D(gameInstance.GraphicsDevice, 1, 1, false, SurfaceFormat.Color); shade.SetData(new Color[] { Color.White }); }
public IMTexture(InfiniminerGame gameInstance, string filename) { if (gameInstance != null) { string customFilename = "custom/blocks/" + filename + ".png"; string contentFilename = "blocks/" + filename; if (File.Exists(customFilename)) { FileStream pngFile = File.OpenRead(customFilename); Texture = Texture2D.FromStream(gameInstance.GraphicsDevice, pngFile); pngFile.Close(); pngFile.Dispose(); } else { Texture = gameInstance.Content.Load <Texture2D>(contentFilename); } } else { Texture = null; } LODColor = Color.Black; // If this is a null texture, use a black LOD color. if (Texture == null) { return; } // Calculate the load color dynamically. float r = 0, g = 0, b = 0; Color[] pixelData = new Color[Texture.Width * Texture.Height]; Texture.GetData <Color>(pixelData); for (int i = 0; i < Texture.Width; i++) { for (int j = 0; j < Texture.Height; j++) { r += pixelData[i + j * Texture.Width].R; g += pixelData[i + j * Texture.Width].G; b += pixelData[i + j * Texture.Width].B; } } r /= Texture.Width * Texture.Height; g /= Texture.Width * Texture.Height; b /= Texture.Width * Texture.Height; LODColor = new Color(r / 256, g / 256, b / 256); }
static void Main(string[] args) { using (InfiniminerGame game = new InfiniminerGame(args)) { try { game.Run(); } catch (Exception e) { System.Windows.Forms.MessageBox.Show(e.Message + "\r\n\r\n" + e.StackTrace); } } }
public PropertyBag(InfiniminerGame gameInstance) { // Initialize our network device. NetPeerConfiguration netConfig = new NetPeerConfiguration("InfiniminerPlus"); netClient = new NetClient(netConfig); //netClient.SetMessageTypeEnabled(NetMessageType.ConnectionRejected, true); netConfig.EnableMessageType(NetIncomingMessageType.WarningMessage); //netClient.SimulatedMinimumLatency = 0.1f; //netClient.SimulatedLatencyVariance = 0.05f; //netClient.SimulatedLoss = 0.1f; //netClient.SimulatedDuplicates = 0.05f; netClient.Start(); // Initialize engines. blockEngine = new BlockEngine(gameInstance); interfaceEngine = new InterfaceEngine(gameInstance); playerEngine = new PlayerEngine(gameInstance); skyplaneEngine = new SkyplaneEngine(gameInstance); particleEngine = new ParticleEngine(gameInstance); // Create a camera. playerCamera = new Camera(gameInstance.GraphicsDevice); UpdateCamera(); // Load sounds. if (!gameInstance.NoSound) { soundList[InfiniminerSound.DigDirt] = gameInstance.Content.Load <SoundEffect>("sounds/dig-dirt"); soundList[InfiniminerSound.DigMetal] = gameInstance.Content.Load <SoundEffect>("sounds/dig-metal"); soundList[InfiniminerSound.Ping] = gameInstance.Content.Load <SoundEffect>("sounds/ping"); soundList[InfiniminerSound.ConstructionGun] = gameInstance.Content.Load <SoundEffect>("sounds/build"); soundList[InfiniminerSound.Death] = gameInstance.Content.Load <SoundEffect>("sounds/death"); soundList[InfiniminerSound.CashDeposit] = gameInstance.Content.Load <SoundEffect>("sounds/cash"); soundList[InfiniminerSound.ClickHigh] = gameInstance.Content.Load <SoundEffect>("sounds/click-loud"); soundList[InfiniminerSound.ClickLow] = gameInstance.Content.Load <SoundEffect>("sounds/click-quiet"); soundList[InfiniminerSound.GroundHit] = gameInstance.Content.Load <SoundEffect>("sounds/hitground"); soundList[InfiniminerSound.Teleporter] = gameInstance.Content.Load <SoundEffect>("sounds/teleport"); soundList[InfiniminerSound.Jumpblock] = gameInstance.Content.Load <SoundEffect>("sounds/jumpblock"); soundList[InfiniminerSound.Explosion] = gameInstance.Content.Load <SoundEffect>("sounds/explosion"); soundList[InfiniminerSound.RadarHigh] = gameInstance.Content.Load <SoundEffect>("sounds/radar-high"); soundList[InfiniminerSound.RadarLow] = gameInstance.Content.Load <SoundEffect>("sounds/radar-low"); soundList[InfiniminerSound.RadarSwitch] = gameInstance.Content.Load <SoundEffect>("sounds/switch"); } }
public PlayerEngine(InfiniminerGame gameInstance) { this.gameInstance = gameInstance; }
public InterfaceEngine(InfiniminerGame gameInstance) { this.gameInstance = gameInstance; spriteBatch = new SpriteBatch(gameInstance.GraphicsDevice); // Load textures. texCrosshairs = gameInstance.Content.Load<Texture2D>("ui/tex_ui_crosshair"); texBlank = new Texture2D(gameInstance.GraphicsDevice, 1, 1); texBlank.SetData(new uint[1] { 0xFFFFFFFF }); texRadarBackground = gameInstance.Content.Load<Texture2D>("ui/tex_radar_background"); texRadarForeground = gameInstance.Content.Load<Texture2D>("ui/tex_radar_foreground"); texRadarPlayerSame = gameInstance.Content.Load<Texture2D>("ui/tex_radar_player_same"); texRadarPlayerAbove = gameInstance.Content.Load<Texture2D>("ui/tex_radar_player_above"); texRadarPlayerBelow = gameInstance.Content.Load<Texture2D>("ui/tex_radar_player_below"); texRadarPlayerPing = gameInstance.Content.Load<Texture2D>("ui/tex_radar_player_ping"); texRadarNorth = gameInstance.Content.Load<Texture2D>("ui/tex_radar_north"); texHelp = gameInstance.Content.Load<Texture2D>("menus/tex_menu_help"); texToolRadarRed = gameInstance.Content.Load<Texture2D>("tools/tex_tool_radar_red"); texToolRadarBlue = gameInstance.Content.Load<Texture2D>("tools/tex_tool_radar_blue"); texToolRadarGold = gameInstance.Content.Load<Texture2D>("tools/tex_tool_radar_screen_gold"); texToolRadarDiamond = gameInstance.Content.Load<Texture2D>("tools/tex_tool_radar_screen_diamond"); texToolRadarLED = gameInstance.Content.Load<Texture2D>("tools/tex_tool_radar_led"); texToolRadarPointer = gameInstance.Content.Load<Texture2D>("tools/tex_tool_radar_pointer"); texToolRadarFlash = gameInstance.Content.Load<Texture2D>("tools/tex_tool_radar_flash"); texToolBuild = gameInstance.Content.Load<Texture2D>("tools/tex_tool_build"); texToolBuildCharge = gameInstance.Content.Load<Texture2D>("tools/tex_tool_build_charge"); texToolBuildBlast = gameInstance.Content.Load<Texture2D>("tools/tex_tool_build_blast"); texToolBuildSmoke = gameInstance.Content.Load<Texture2D>("tools/tex_tool_build_smoke"); texToolDetonatorDownRed = gameInstance.Content.Load<Texture2D>("tools/tex_tool_detonator_down_red"); texToolDetonatorUpRed = gameInstance.Content.Load<Texture2D>("tools/tex_tool_detonator_up_red"); texToolDetonatorDownBlue = gameInstance.Content.Load<Texture2D>("tools/tex_tool_detonator_down_blue"); texToolDetonatorUpBlue = gameInstance.Content.Load<Texture2D>("tools/tex_tool_detonator_up_blue"); drawRect = new Rectangle(gameInstance.GraphicsDevice.Viewport.Width / 2 - 1024 / 2, gameInstance.GraphicsDevice.Viewport.Height / 2 - 768 / 2, 1024, 1024); // Load icons. blockIcons[BlockType.BankBlue] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_bank_blue"); blockIcons[BlockType.BankRed] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_bank_red"); blockIcons[BlockType.Explosive] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_explosive"); blockIcons[BlockType.Jump] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_jump"); blockIcons[BlockType.Water] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_water"); blockIcons[BlockType.Ladder] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_ladder"); blockIcons[BlockType.SolidBlue] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_solid_blue"); blockIcons[BlockType.SolidRed] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_solid_red"); blockIcons[BlockType.Shock] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_spikes"); blockIcons[BlockType.TransBlue] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_translucent_blue"); blockIcons[BlockType.TransRed] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_translucent_red"); blockIcons[BlockType.GlassB] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_glassb"); blockIcons[BlockType.GlassR] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_glassr"); blockIcons[BlockType.BeaconRed] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_beacon"); blockIcons[BlockType.BeaconBlue] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_beacon"); blockIcons[BlockType.Road] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_road"); blockIcons[BlockType.Generator] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_generator"); blockIcons[BlockType.Controller] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_controller"); blockIcons[BlockType.Pipe] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_pipe"); blockIcons[BlockType.Lava] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_pipe"); blockIcons[BlockType.StealthBlockB] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_stealth"); blockIcons[BlockType.StealthBlockR] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_stealth"); blockIcons[BlockType.TrapB] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_trap"); blockIcons[BlockType.Metal] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_metal"); blockIcons[BlockType.TrapR] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_trap"); blockIcons[BlockType.Dirt] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_dirt"); blockIcons[BlockType.Grass] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_grass"); blockIcons[BlockType.Pump] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_pump"); blockIcons[BlockType.Barrel] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_compressor"); blockIcons[BlockType.Lever] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_lever"); blockIcons[BlockType.Plate] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_plate"); blockIcons[BlockType.RadarRed] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_radar"); blockIcons[BlockType.RadarBlue] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_radar"); blockIcons[BlockType.Hinge] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_hinge"); blockIcons[BlockType.ArtCaseR] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_artcaser"); blockIcons[BlockType.ArtCaseB] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_artcaseb"); blockIcons[BlockType.ConstructionR] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_magmavent"); blockIcons[BlockType.ConstructionB] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_magmavent"); blockIcons[BlockType.ResearchR] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_research"); blockIcons[BlockType.ResearchB] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_research"); //held icons blockIcons[BlockType.Diamond] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_diamond"); blockIcons[BlockType.MagmaVent] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_magmavent"); blockIcons[BlockType.Gold] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_silver"); blockIcons[BlockType.Ore] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_ore"); blockIcons[BlockType.DirtSign] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_dirt_sign"); blockIcons[BlockType.Rock] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_rock"); blockIcons[BlockType.Sand] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_sand"); blockIcons[BlockType.Spring] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_spring"); blockIcons[BlockType.Mud] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_dirt"); blockIcons[BlockType.SolidBlue2] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_solid_blue"); blockIcons[BlockType.SolidRed2] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_solid_red"); //blockIcons[BlockType.Spring] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_rock"); blockIcons[BlockType.None] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_deconstruction"); // Load fonts. uiFont = gameInstance.Content.Load<SpriteFont>("font_04b08"); radarFont = gameInstance.Content.Load<SpriteFont>("font_04b03b"); }
public BlockEngine(InfiniminerGame gameInstance) { this.gameInstance = gameInstance; // Initialize the block list. downloadList = new BlockType[MAPSIZE, MAPSIZE, MAPSIZE]; blockList = new BlockType[MAPSIZE, MAPSIZE, MAPSIZE]; for (ushort i = 0; i < MAPSIZE; i++) for (ushort j = 0; j < MAPSIZE; j++) for (ushort k = 0; k < MAPSIZE; k++) { downloadList[i, j, k] = BlockType.None; blockList[i, j, k] = BlockType.None; } // Initialize the face lists. faceMap = new Dictionary<uint,bool>[(byte)BlockTexture.MAXIMUM, NUMREGIONS]; for (BlockTexture blockTexture = BlockTexture.None; blockTexture < BlockTexture.MAXIMUM; blockTexture++) for (int r=0; r<NUMREGIONS; r++) faceMap[(byte)blockTexture, r] = new Dictionary<uint, bool>(); // Initialize the texture map. blockTextureMap = new BlockTexture[(byte)BlockType.MAXIMUM, 6]; for (BlockType blockType = BlockType.None; blockType < BlockType.MAXIMUM; blockType++) for (BlockFaceDirection faceDir = BlockFaceDirection.XIncreasing; faceDir < BlockFaceDirection.MAXIMUM; faceDir++) blockTextureMap[(byte)blockType,(byte)faceDir] = BlockInformation.GetTexture(blockType, faceDir); // Load the textures we'll use. blockTextures = new IMTexture[(byte)BlockTexture.MAXIMUM]; blockTextures[(byte)BlockTexture.None] = new IMTexture(null); blockTextures[(byte)BlockTexture.Dirt] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_dirt")); blockTextures[(byte)BlockTexture.Rock] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_rock")); blockTextures[(byte)BlockTexture.Ore] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_ore")); blockTextures[(byte)BlockTexture.Gold] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_silver")); blockTextures[(byte)BlockTexture.Diamond] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_diamond")); blockTextures[(byte)BlockTexture.HomeRed] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_home_red")); blockTextures[(byte)BlockTexture.HomeBlue] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_home_blue")); blockTextures[(byte)BlockTexture.SolidRed] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_red")); blockTextures[(byte)BlockTexture.SolidBlue] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_blue")); blockTextures[(byte)BlockTexture.Ladder] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_ladder")); blockTextures[(byte)BlockTexture.LadderTop] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_ladder_top")); blockTextures[(byte)BlockTexture.Spikes] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_spikes")); blockTextures[(byte)BlockTexture.Jump] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_jump")); blockTextures[(byte)BlockTexture.JumpTop] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_jump_top")); blockTextures[(byte)BlockTexture.Explosive] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_explosive")); blockTextures[(byte)BlockTexture.Metal] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_metal")); blockTextures[(byte)BlockTexture.DirtSign] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_dirt_sign")); blockTextures[(byte)BlockTexture.BankTopRed] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_top_red")); blockTextures[(byte)BlockTexture.BankLeftRed] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_left_red")); blockTextures[(byte)BlockTexture.BankFrontRed] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_front_red")); blockTextures[(byte)BlockTexture.BankRightRed] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_right_red")); blockTextures[(byte)BlockTexture.BankBackRed] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_back_red")); blockTextures[(byte)BlockTexture.BankTopBlue] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_top_blue")); blockTextures[(byte)BlockTexture.BankLeftBlue] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_left_blue")); blockTextures[(byte)BlockTexture.BankFrontBlue] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_front_blue")); blockTextures[(byte)BlockTexture.BankRightBlue] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_right_blue")); blockTextures[(byte)BlockTexture.BankBackBlue] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_back_blue")); blockTextures[(byte)BlockTexture.TeleSideA] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_teleporter_a")); blockTextures[(byte)BlockTexture.TeleSideB] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_teleporter_b")); blockTextures[(byte)BlockTexture.TeleTop] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_teleporter_top")); blockTextures[(byte)BlockTexture.TeleBottom] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_teleporter_bottom")); blockTextures[(byte)BlockTexture.Lava] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_lava")); blockTextures[(byte)BlockTexture.Road] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_road")); blockTextures[(byte)BlockTexture.RoadTop] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_road_top")); blockTextures[(byte)BlockTexture.RoadBottom] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_road_bottom")); blockTextures[(byte)BlockTexture.BeaconRed] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_beacon_top_red")); blockTextures[(byte)BlockTexture.BeaconBlue] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_beacon_top_blue")); blockTextures[(byte)BlockTexture.TransRed] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_trans_red")); blockTextures[(byte)BlockTexture.TransBlue] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_trans_blue")); // Load our effects. basicEffect = gameInstance.Content.Load<Effect>("effect_basic"); // Build vertex lists. vertexBuffers = new DynamicVertexBuffer[(byte)BlockTexture.MAXIMUM, NUMREGIONS]; vertexListDirty = new bool[(byte)BlockTexture.MAXIMUM, NUMREGIONS]; for (int i = 0; i < (byte)BlockTexture.MAXIMUM; i++) for (int j = 0; j < NUMREGIONS; j++) vertexListDirty[i, j] = true; // Initialize any graphics stuff. vertexDeclaration = new VertexDeclaration(gameInstance.GraphicsDevice, VertexPositionTextureShade.VertexElements); // Initialize the bloom engine. if (gameInstance.RenderPretty) { bloomPosteffect = new BloomComponent(); bloomPosteffect.Load(gameInstance.GraphicsDevice, gameInstance.Content); } else bloomPosteffect = null; }
public BlockEngine(InfiniminerGame gameInstance) { this.gameInstance = gameInstance; // Initialize the block list. downloadList = new BlockType[MAPSIZE, MAPSIZE, MAPSIZE]; blockList = new BlockType[MAPSIZE, MAPSIZE, MAPSIZE]; for (ushort i = 0; i < MAPSIZE; i++) for (ushort j = 0; j < MAPSIZE; j++) for (ushort k = 0; k < MAPSIZE; k++) { downloadList[i, j, k] = BlockType.None; blockList[i, j, k] = BlockType.None; } // Initialize the face lists. faceMap = new Dictionary<uint,bool>[(byte)BlockTexture.MAXIMUM, NUMREGIONS]; for (BlockTexture blockTexture = BlockTexture.None; blockTexture < BlockTexture.MAXIMUM; blockTexture++) for (int r=0; r<NUMREGIONS; r++) faceMap[(byte)blockTexture, r] = new Dictionary<uint, bool>(); // Initialize the texture map. blockTextureMap = new BlockTexture[(byte)BlockType.MAXIMUM, 6]; for (BlockType blockType = BlockType.None; blockType < BlockType.MAXIMUM; blockType++) for (BlockFaceDirection faceDir = BlockFaceDirection.XIncreasing; faceDir < BlockFaceDirection.MAXIMUM; faceDir++) blockTextureMap[(byte)blockType,(byte)faceDir] = BlockInformation.GetTexture(blockType, faceDir); // Load the textures we'll use. blockTextures = new IMTexture[(byte)BlockTexture.MAXIMUM]; blockTextures[(byte)BlockTexture.None] = new IMTexture(null); blockTextures[(byte)BlockTexture.Dirt] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_dirt")); blockTextures[(byte)BlockTexture.Mud] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_mud")); blockTextures[(byte)BlockTexture.Grass] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_grass")); blockTextures[(byte)BlockTexture.GrassSide] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_grass_side")); blockTextures[(byte)BlockTexture.Sand] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_sand")); blockTextures[(byte)BlockTexture.Rock] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_rock")); blockTextures[(byte)BlockTexture.Ore] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_ore")); blockTextures[(byte)BlockTexture.Gold] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_silver")); blockTextures[(byte)BlockTexture.Diamond] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_diamond")); blockTextures[(byte)BlockTexture.HomeRed] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_home_red")); blockTextures[(byte)BlockTexture.HomeBlue] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_home_blue")); blockTextures[(byte)BlockTexture.SolidRed] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_red")); blockTextures[(byte)BlockTexture.SolidBlue] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_blue")); blockTextures[(byte)BlockTexture.SolidRed2] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_red2"));//placeholder texture blockTextures[(byte)BlockTexture.SolidBlue2] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_blue2"));//placeholder texture blockTextures[(byte)BlockTexture.Ladder] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_ladder")); blockTextures[(byte)BlockTexture.LadderTop] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_ladder_top")); blockTextures[(byte)BlockTexture.Spikes] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_spikes")); blockTextures[(byte)BlockTexture.Jump] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_jump")); blockTextures[(byte)BlockTexture.JumpTop] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_jump_top")); blockTextures[(byte)BlockTexture.Explosive] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_explosive")); blockTextures[(byte)BlockTexture.Metal] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_metal")); blockTextures[(byte)BlockTexture.DirtSign] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_dirt_sign")); blockTextures[(byte)BlockTexture.BankTopRed] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_top_red")); blockTextures[(byte)BlockTexture.BankLeftRed] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_left_red")); blockTextures[(byte)BlockTexture.BankFrontRed] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_front_red")); blockTextures[(byte)BlockTexture.BankRightRed] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_right_red")); blockTextures[(byte)BlockTexture.BankBackRed] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_back_red")); blockTextures[(byte)BlockTexture.BankTopBlue] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_top_blue")); blockTextures[(byte)BlockTexture.BankLeftBlue] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_left_blue")); blockTextures[(byte)BlockTexture.BankFrontBlue] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_front_blue")); blockTextures[(byte)BlockTexture.BankRightBlue] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_right_blue")); blockTextures[(byte)BlockTexture.BankBackBlue] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_back_blue")); blockTextures[(byte)BlockTexture.Forge] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_forge")); blockTextures[(byte)BlockTexture.ForgeSide] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_forge_side")); blockTextures[(byte)BlockTexture.ArtCaseR] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_artcase_red")); blockTextures[(byte)BlockTexture.ArtCaseB] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_artcase_blue")); //base block blockTextures[(byte)BlockTexture.BaseTopRed] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_top_red")); blockTextures[(byte)BlockTexture.BaseLeftRed] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_left_red")); blockTextures[(byte)BlockTexture.BaseFrontRed] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_front_red")); blockTextures[(byte)BlockTexture.BaseRightRed] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_right_red")); blockTextures[(byte)BlockTexture.BaseBackRed] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_back_red")); blockTextures[(byte)BlockTexture.BaseTopBlue] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_top_blue")); blockTextures[(byte)BlockTexture.BaseLeftBlue] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_left_blue")); blockTextures[(byte)BlockTexture.BaseFrontBlue] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_front_blue")); blockTextures[(byte)BlockTexture.BaseRightBlue] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_right_blue")); blockTextures[(byte)BlockTexture.BaseBackBlue] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_bank_back_blue")); //base block blockTextures[(byte)BlockTexture.TeleSideA] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_teleporter_a")); blockTextures[(byte)BlockTexture.TeleSideB] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_teleporter_b")); blockTextures[(byte)BlockTexture.TeleTop] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_teleporter_top")); blockTextures[(byte)BlockTexture.TeleBottom] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_teleporter_bottom")); blockTextures[(byte)BlockTexture.Lava] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_lava")); blockTextures[(byte)BlockTexture.Water] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_trans_water")); blockTextures[(byte)BlockTexture.Road] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_road")); blockTextures[(byte)BlockTexture.RoadTop] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_road_top")); blockTextures[(byte)BlockTexture.RoadBottom] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_road_bottom")); blockTextures[(byte)BlockTexture.BeaconRed] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_beacon_top_red")); blockTextures[(byte)BlockTexture.BeaconBlue] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_beacon_top_blue")); blockTextures[(byte)BlockTexture.TransRed] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_trans_red")); blockTextures[(byte)BlockTexture.TransBlue] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_trans_blue")); blockTextures[(byte)BlockTexture.GlassR] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_glass_red")); blockTextures[(byte)BlockTexture.GlassB] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_glass_blue")); blockTextures[(byte)BlockTexture.ForceR] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_force_red")); blockTextures[(byte)BlockTexture.ForceB] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_force_blue")); blockTextures[(byte)BlockTexture.Generator] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_generator")); blockTextures[(byte)BlockTexture.Controller] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_controller")); blockTextures[(byte)BlockTexture.Pipe] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_pipe")); blockTextures[(byte)BlockTexture.Pump] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_pump")); blockTextures[(byte)BlockTexture.Barrel] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_barrel_side")); blockTextures[(byte)BlockTexture.BarrelTop] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_barrel_top")); blockTextures[(byte)BlockTexture.Spring] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_spring")); blockTextures[(byte)BlockTexture.MagmaVent] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_magmavent")); blockTextures[(byte)BlockTexture.MagmaBurst] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_magma")); blockTextures[(byte)BlockTexture.Fire] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_fire")); blockTextures[(byte)BlockTexture.StealthBlockR] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_dirt_trans")); blockTextures[(byte)BlockTexture.StealthBlockB] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_dirt_trans")); blockTextures[(byte)BlockTexture.Trap] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_dirt")); blockTextures[(byte)BlockTexture.TrapB] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_dirt")); blockTextures[(byte)BlockTexture.TrapR] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_dirt")); blockTextures[(byte)BlockTexture.TrapVis] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_trapVis")); blockTextures[(byte)BlockTexture.Magma] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_magma")); blockTextures[(byte)BlockTexture.Lever] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_mechanism")); blockTextures[(byte)BlockTexture.Plate] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_metal")); blockTextures[(byte)BlockTexture.Hinge] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_hinge")); blockTextures[(byte)BlockTexture.Construction] = new IMTexture(gameInstance.Content.Load<Texture2D>("blocks/tex_block_construction")); // Load our effects. basicEffect = gameInstance.Content.Load<Effect>("effect_basic"); // Build vertex lists. vertexBuffers = new DynamicVertexBuffer[(byte)BlockTexture.MAXIMUM, NUMREGIONS]; vertexListDirty = new bool[(byte)BlockTexture.MAXIMUM, NUMREGIONS]; Light = new float[MAPSIZE, MAPSIZE, MAPSIZE]; for(int x = 0;x < MAPSIZE-1;x++) for (int y = 0; y < MAPSIZE - 1; y++) for (int z = 0; z < MAPSIZE - 1; z++) { Light[x, y, z] = 0.2f; } for (int i = 0; i < (byte)BlockTexture.MAXIMUM; i++) for (int j = 0; j < NUMREGIONS; j++) vertexListDirty[i, j] = true; // Initialize any graphics stuff. vertexDeclaration = new VertexDeclaration(gameInstance.GraphicsDevice, VertexPositionTextureShade.VertexElements); // Initialize the bloom engine. if (gameInstance.RenderPretty) { bloomPosteffect = new BloomComponent(); bloomPosteffect.Load(gameInstance.GraphicsDevice, gameInstance.Content); } else bloomPosteffect = null; }
public InterfaceEngine(InfiniminerGame gameInstance) { this.gameInstance = gameInstance; spriteBatch = new SpriteBatch(gameInstance.GraphicsDevice); // Load textures. texCrosshairs = gameInstance.Content.Load<Texture2D>("ui/tex_ui_crosshair"); texBlank = new Texture2D(gameInstance.GraphicsDevice, 1, 1); texBlank.SetData(new uint[1] { 0xFFFFFFFF }); texRadarBackground = gameInstance.Content.Load<Texture2D>("ui/tex_radar_background"); texRadarForeground = gameInstance.Content.Load<Texture2D>("ui/tex_radar_foreground"); texRadarPlayerSame = gameInstance.Content.Load<Texture2D>("ui/tex_radar_player_same"); texRadarPlayerAbove = gameInstance.Content.Load<Texture2D>("ui/tex_radar_player_above"); texRadarPlayerBelow = gameInstance.Content.Load<Texture2D>("ui/tex_radar_player_below"); texRadarPlayerPing = gameInstance.Content.Load<Texture2D>("ui/tex_radar_player_ping"); texRadarNorth = gameInstance.Content.Load<Texture2D>("ui/tex_radar_north"); texHelp = gameInstance.Content.Load<Texture2D>("menus/tex_menu_help"); texToolRadarRed = gameInstance.Content.Load<Texture2D>("tools/tex_tool_radar_red"); texToolRadarBlue = gameInstance.Content.Load<Texture2D>("tools/tex_tool_radar_blue"); texToolRadarGold = gameInstance.Content.Load<Texture2D>("tools/tex_tool_radar_screen_gold"); texToolRadarDiamond = gameInstance.Content.Load<Texture2D>("tools/tex_tool_radar_screen_diamond"); texToolRadarLED = gameInstance.Content.Load<Texture2D>("tools/tex_tool_radar_led"); texToolRadarPointer = gameInstance.Content.Load<Texture2D>("tools/tex_tool_radar_pointer"); texToolRadarFlash = gameInstance.Content.Load<Texture2D>("tools/tex_tool_radar_flash"); texToolBuild = gameInstance.Content.Load<Texture2D>("tools/tex_tool_build"); texToolBuildCharge = gameInstance.Content.Load<Texture2D>("tools/tex_tool_build_charge"); texToolBuildBlast = gameInstance.Content.Load<Texture2D>("tools/tex_tool_build_blast"); texToolBuildSmoke = gameInstance.Content.Load<Texture2D>("tools/tex_tool_build_smoke"); texToolDetonatorDownRed = gameInstance.Content.Load<Texture2D>("tools/tex_tool_detonator_down_red"); texToolDetonatorUpRed = gameInstance.Content.Load<Texture2D>("tools/tex_tool_detonator_up_red"); texToolDetonatorDownBlue = gameInstance.Content.Load<Texture2D>("tools/tex_tool_detonator_down_blue"); texToolDetonatorUpBlue = gameInstance.Content.Load<Texture2D>("tools/tex_tool_detonator_up_blue"); drawRect = new Rectangle(gameInstance.GraphicsDevice.Viewport.Width / 2 - 1024 / 2, gameInstance.GraphicsDevice.Viewport.Height / 2 - 768 / 2, 1024, 1024); // Load icons. blockIcons[BlockType.BankBlue] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_bank_blue"); blockIcons[BlockType.BankRed] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_bank_red"); blockIcons[BlockType.Explosive] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_explosive"); blockIcons[BlockType.Jump] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_jump"); blockIcons[BlockType.Ladder] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_ladder"); blockIcons[BlockType.SolidBlue] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_solid_blue"); blockIcons[BlockType.SolidRed] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_solid_red"); blockIcons[BlockType.Shock] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_spikes"); blockIcons[BlockType.TransBlue] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_translucent_blue"); blockIcons[BlockType.TransRed] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_translucent_red"); blockIcons[BlockType.BeaconRed] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_beacon"); blockIcons[BlockType.BeaconBlue] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_beacon"); blockIcons[BlockType.Road] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_road"); blockIcons[BlockType.None] = gameInstance.Content.Load<Texture2D>("icons/tex_icon_deconstruction"); // Load fonts. uiFont = gameInstance.Content.Load<SpriteFont>("font_04b08"); radarFont = gameInstance.Content.Load<SpriteFont>("font_04b03b"); }
public InterfaceElement(Infiniminer.InfiniminerGame gameInstance, Infiniminer.PropertyBag pb) { uiFont = gameInstance.Content.Load <SpriteFont>("font_04b08"); _P = pb; }
public InterfaceEngine(InfiniminerGame gameInstance) { this.gameInstance = gameInstance; spriteBatch = new SpriteBatch(gameInstance.GraphicsDevice); // Load textures. texCrosshairs = gameInstance.Content.Load <Texture2D>("ui/tex_ui_crosshair"); texBlank = new Texture2D(gameInstance.GraphicsDevice, 1, 1); texBlank.SetData(new uint[1] { 0xFFFFFFFF }); texRadarBackground = gameInstance.Content.Load <Texture2D>("ui/tex_radar_background"); texRadarForeground = gameInstance.Content.Load <Texture2D>("ui/tex_radar_foreground"); texRadarPlayerSame = gameInstance.Content.Load <Texture2D>("ui/tex_radar_player_same"); texRadarPlayerAbove = gameInstance.Content.Load <Texture2D>("ui/tex_radar_player_above"); texRadarPlayerBelow = gameInstance.Content.Load <Texture2D>("ui/tex_radar_player_below"); texRadarPlayerPing = gameInstance.Content.Load <Texture2D>("ui/tex_radar_player_ping"); texRadarNorth = gameInstance.Content.Load <Texture2D>("ui/tex_radar_north"); texHelp = gameInstance.Content.Load <Texture2D>("menus/tex_menu_help"); texToolRadarRed = gameInstance.Content.Load <Texture2D>("tools/tex_tool_radar_red"); texToolRadarBlue = gameInstance.Content.Load <Texture2D>("tools/tex_tool_radar_blue"); texToolRadarGold = gameInstance.Content.Load <Texture2D>("tools/tex_tool_radar_screen_gold"); texToolRadarDiamond = gameInstance.Content.Load <Texture2D>("tools/tex_tool_radar_screen_diamond"); texToolRadarLED = gameInstance.Content.Load <Texture2D>("tools/tex_tool_radar_led"); texToolRadarPointer = gameInstance.Content.Load <Texture2D>("tools/tex_tool_radar_pointer"); texToolRadarFlash = gameInstance.Content.Load <Texture2D>("tools/tex_tool_radar_flash"); texToolBuild = gameInstance.Content.Load <Texture2D>("tools/tex_tool_build"); texToolBuildCharge = gameInstance.Content.Load <Texture2D>("tools/tex_tool_build_charge"); texToolBuildBlast = gameInstance.Content.Load <Texture2D>("tools/tex_tool_build_blast"); texToolBuildSmoke = gameInstance.Content.Load <Texture2D>("tools/tex_tool_build_smoke"); texToolDetonatorDownRed = gameInstance.Content.Load <Texture2D>("tools/tex_tool_detonator_down_red"); texToolDetonatorUpRed = gameInstance.Content.Load <Texture2D>("tools/tex_tool_detonator_up_red"); texToolDetonatorDownBlue = gameInstance.Content.Load <Texture2D>("tools/tex_tool_detonator_down_blue"); texToolDetonatorUpBlue = gameInstance.Content.Load <Texture2D>("tools/tex_tool_detonator_up_blue"); drawRect = new Rectangle(gameInstance.GraphicsDevice.Viewport.Width / 2 - 1024 / 2, gameInstance.GraphicsDevice.Viewport.Height / 2 - 768 / 2, 1024, 1024); // Load icons. blockIcons[BlockType.BankBlue] = gameInstance.Content.Load <Texture2D>("icons/tex_icon_bank_blue"); blockIcons[BlockType.BankRed] = gameInstance.Content.Load <Texture2D>("icons/tex_icon_bank_red"); blockIcons[BlockType.Explosive] = gameInstance.Content.Load <Texture2D>("icons/tex_icon_explosive"); blockIcons[BlockType.Jump] = gameInstance.Content.Load <Texture2D>("icons/tex_icon_jump"); blockIcons[BlockType.Ladder] = gameInstance.Content.Load <Texture2D>("icons/tex_icon_ladder"); blockIcons[BlockType.SolidBlue] = gameInstance.Content.Load <Texture2D>("icons/tex_icon_solid_blue"); blockIcons[BlockType.SolidRed] = gameInstance.Content.Load <Texture2D>("icons/tex_icon_solid_red"); blockIcons[BlockType.Shock] = gameInstance.Content.Load <Texture2D>("icons/tex_icon_spikes"); blockIcons[BlockType.TransBlue] = gameInstance.Content.Load <Texture2D>("icons/tex_icon_translucent_blue"); blockIcons[BlockType.TransRed] = gameInstance.Content.Load <Texture2D>("icons/tex_icon_translucent_red"); blockIcons[BlockType.BeaconRed] = gameInstance.Content.Load <Texture2D>("icons/tex_icon_beacon"); blockIcons[BlockType.BeaconBlue] = gameInstance.Content.Load <Texture2D>("icons/tex_icon_beacon"); blockIcons[BlockType.Road] = gameInstance.Content.Load <Texture2D>("icons/tex_icon_road"); blockIcons[BlockType.None] = gameInstance.Content.Load <Texture2D>("icons/tex_icon_deconstruction"); // Load fonts. uiFont = gameInstance.Content.Load <SpriteFont>("font_04b08"); radarFont = gameInstance.Content.Load <SpriteFont>("font_04b03b"); }
public InterfaceTextInput(Infiniminer.InfiniminerGame gameInstance, Infiniminer.PropertyBag pb) { uiFont = gameInstance.Content.Load <SpriteFont>("font_04b08"); _P = pb; //keyMap = new Infiniminer.KeyMap(); }
bool colorDirection = true; //increases when true #endregion Fields #region Constructors public PropertyBag(InfiniminerGame gameInstance) { // Initialize our network device. NetConfiguration netConfig = new NetConfiguration("InfiniminerPlus"); netClient = new NetClient(netConfig); netClient.SetMessageTypeEnabled(NetMessageType.ConnectionRejected, true); //netClient.SimulatedMinimumLatency = 0.5f; //netClient.SimulatedLatencyVariance = 0.1f; //netClient.SimulatedLoss = 0.2f; //netClient.SimulatedDuplicates = 0.1f; for (int a = 0; a < 50; a++) { Content[a] = 0; } artifactActive = new int[3, 20]; netClient.Start(); // Initialize engines. blockEngine = new BlockEngine(gameInstance); interfaceEngine = new InterfaceEngine(gameInstance); playerEngine = new PlayerEngine(gameInstance); skyplaneEngine = new SkyplaneEngine(gameInstance); particleEngine = new ParticleEngine(gameInstance); // Create a camera. playerCamera = new Camera(gameInstance.GraphicsDevice); UpdateCamera(); // Load sounds. if (!gameInstance.NoSound) { soundList[InfiniminerSound.DigDirt] = gameInstance.Content.Load<SoundEffect>("sounds/dig-dirt"); soundList[InfiniminerSound.DigMetal] = gameInstance.Content.Load<SoundEffect>("sounds/dig-metal"); soundList[InfiniminerSound.Ping] = gameInstance.Content.Load<SoundEffect>("sounds/ping"); soundList[InfiniminerSound.ConstructionGun] = gameInstance.Content.Load<SoundEffect>("sounds/build"); soundList[InfiniminerSound.Death] = gameInstance.Content.Load<SoundEffect>("sounds/death"); soundList[InfiniminerSound.CashDeposit] = gameInstance.Content.Load<SoundEffect>("sounds/cash"); soundList[InfiniminerSound.ClickHigh] = gameInstance.Content.Load<SoundEffect>("sounds/click-loud"); soundList[InfiniminerSound.ClickLow] = gameInstance.Content.Load<SoundEffect>("sounds/click-quiet"); soundList[InfiniminerSound.GroundHit] = gameInstance.Content.Load<SoundEffect>("sounds/hitground"); soundList[InfiniminerSound.Teleporter] = gameInstance.Content.Load<SoundEffect>("sounds/teleport"); soundList[InfiniminerSound.Jumpblock] = gameInstance.Content.Load<SoundEffect>("sounds/jumpblock"); soundList[InfiniminerSound.Explosion] = gameInstance.Content.Load<SoundEffect>("sounds/explosion"); soundList[InfiniminerSound.RadarHigh] = gameInstance.Content.Load<SoundEffect>("sounds/radar-high"); soundList[InfiniminerSound.RadarLow] = gameInstance.Content.Load<SoundEffect>("sounds/radar-low"); soundList[InfiniminerSound.RadarSwitch] = gameInstance.Content.Load<SoundEffect>("sounds/switch"); soundList[InfiniminerSound.RockFall] = gameInstance.Content.Load<SoundEffect>("sounds/rockfall"); } }
public InterfaceSlider(Infiniminer.InfiniminerGame gameInstance) { uiFont = gameInstance.Content.Load <SpriteFont>("font_04b08"); }
public PlayerEngine(InfiniminerGame gameInstance) { this.gameInstance = gameInstance; blockEngine = gameInstance.propertyBag.GetEngine <BlockEngine>("blockEngine"); }
public BlockEngine(InfiniminerGame gameInstance) { this.gameInstance = gameInstance; // Initialize the block list. downloadList = new BlockType[MAPSIZE, MAPSIZE, MAPSIZE]; blockList = new BlockType[MAPSIZE, MAPSIZE, MAPSIZE]; for (ushort i = 0; i < MAPSIZE; i++) { for (ushort j = 0; j < MAPSIZE; j++) { for (ushort k = 0; k < MAPSIZE; k++) { downloadList[i, j, k] = BlockType.None; blockList[i, j, k] = BlockType.None; } } } // Initialize the face lists. faceMap = new Dictionary <uint, bool> [(byte)BlockTexture.MAXIMUM, NUMREGIONS]; for (BlockTexture blockTexture = BlockTexture.None; blockTexture < BlockTexture.MAXIMUM; blockTexture++) { for (int r = 0; r < NUMREGIONS; r++) { faceMap[(byte)blockTexture, r] = new Dictionary <uint, bool>(); } } // Initialize the texture map. blockTextureMap = new BlockTexture[(byte)BlockType.MAXIMUM, 6]; for (BlockType blockType = BlockType.None; blockType < BlockType.MAXIMUM; blockType++) { for (BlockFaceDirection faceDir = BlockFaceDirection.XIncreasing; faceDir < BlockFaceDirection.MAXIMUM; faceDir++) { blockTextureMap[(byte)blockType, (byte)faceDir] = BlockInformation.GetTexture(blockType, faceDir); } } // Load the textures we'll use. blockTextures = new IMTexture[(byte)BlockTexture.MAXIMUM]; blockTextures[(byte)BlockTexture.None] = new IMTexture(null); blockTextures[(byte)BlockTexture.Dirt] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_dirt")); blockTextures[(byte)BlockTexture.Rock] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_rock")); blockTextures[(byte)BlockTexture.Ore] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_ore")); blockTextures[(byte)BlockTexture.Gold] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_silver")); blockTextures[(byte)BlockTexture.Diamond] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_diamond")); blockTextures[(byte)BlockTexture.HomeRed] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_home_red")); blockTextures[(byte)BlockTexture.HomeBlue] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_home_blue")); blockTextures[(byte)BlockTexture.SolidRed] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_red")); blockTextures[(byte)BlockTexture.SolidBlue] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_blue")); blockTextures[(byte)BlockTexture.Ladder] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_ladder")); blockTextures[(byte)BlockTexture.LadderTop] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_ladder_top")); blockTextures[(byte)BlockTexture.Spikes] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_spikes")); blockTextures[(byte)BlockTexture.Jump] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_jump")); blockTextures[(byte)BlockTexture.JumpTop] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_jump_top")); blockTextures[(byte)BlockTexture.Explosive] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_explosive")); blockTextures[(byte)BlockTexture.Metal] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_metal")); blockTextures[(byte)BlockTexture.DirtSign] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_dirt_sign")); blockTextures[(byte)BlockTexture.BankTopRed] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_bank_top_red")); blockTextures[(byte)BlockTexture.BankLeftRed] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_bank_left_red")); blockTextures[(byte)BlockTexture.BankFrontRed] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_bank_front_red")); blockTextures[(byte)BlockTexture.BankRightRed] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_bank_right_red")); blockTextures[(byte)BlockTexture.BankBackRed] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_bank_back_red")); blockTextures[(byte)BlockTexture.BankTopBlue] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_bank_top_blue")); blockTextures[(byte)BlockTexture.BankLeftBlue] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_bank_left_blue")); blockTextures[(byte)BlockTexture.BankFrontBlue] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_bank_front_blue")); blockTextures[(byte)BlockTexture.BankRightBlue] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_bank_right_blue")); blockTextures[(byte)BlockTexture.BankBackBlue] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_bank_back_blue")); blockTextures[(byte)BlockTexture.TeleSideA] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_teleporter_a")); blockTextures[(byte)BlockTexture.TeleSideB] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_teleporter_b")); blockTextures[(byte)BlockTexture.TeleTop] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_teleporter_top")); blockTextures[(byte)BlockTexture.TeleBottom] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_teleporter_bottom")); blockTextures[(byte)BlockTexture.Lava] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_lava")); blockTextures[(byte)BlockTexture.Road] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_road")); blockTextures[(byte)BlockTexture.RoadTop] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_road_top")); blockTextures[(byte)BlockTexture.RoadBottom] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_road_bottom")); blockTextures[(byte)BlockTexture.BeaconRed] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_beacon_top_red")); blockTextures[(byte)BlockTexture.BeaconBlue] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_beacon_top_blue")); blockTextures[(byte)BlockTexture.TransRed] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_trans_red")); blockTextures[(byte)BlockTexture.TransBlue] = new IMTexture(gameInstance.Content.Load <Texture2D>("blocks/tex_block_trans_blue")); // Load our effects. basicEffect = gameInstance.Content.Load <Effect>("effect_basic"); // Build vertex lists. vertexBuffers = new DynamicVertexBuffer[(byte)BlockTexture.MAXIMUM, NUMREGIONS]; vertexListDirty = new bool[(byte)BlockTexture.MAXIMUM, NUMREGIONS]; for (int i = 0; i < (byte)BlockTexture.MAXIMUM; i++) { for (int j = 0; j < NUMREGIONS; j++) { vertexListDirty[i, j] = true; } } // Initialize any graphics stuff. vertexDeclaration = new VertexDeclaration(VertexPositionTexture.VertexDeclaration.GetVertexElements()); // Initialize the bloom engine. if (gameInstance.RenderPretty) { bloomPosteffect = new BloomComponent(); bloomPosteffect.Load(gameInstance.GraphicsDevice, gameInstance.Content); } else { bloomPosteffect = null; } }