Exemplo n.º 1
0
		public ReadyRoomScreen (Mpq mpq,
					string scenario_prefix,
					int start_element_index,
					int cancel_element_index,
					int skiptutorial_element_index,
					int replay_element_index,
					int transmission_element_index,
					int objectives_element_index,
					int first_portrait_element_index)
			: base (mpq,
				String.Format ("glue\\Ready{0}", Util.RaceChar[(int)Game.Instance.Race]),
				String.Format (Builtins.rez_GluRdyBin, Util.RaceCharLower[(int)Game.Instance.Race]))
		{
			background_path = String.Format ("glue\\PalR{0}\\Backgnd.pcx", Util.RaceCharLower[(int)Game.Instance.Race]);
			fontpal_path = String.Format ("glue\\PalR{0}\\tFont.pcx", Util.RaceCharLower[(int)Game.Instance.Race]);
			effectpal_path = String.Format ("glue\\PalR{0}\\tEffect.pcx", Util.RaceCharLower[(int)Game.Instance.Race]);
			arrowgrp_path = String.Format ("glue\\PalR{0}\\arrow.grp", Util.RaceCharLower[(int)Game.Instance.Race]);

			this.start_element_index = start_element_index;
			this.cancel_element_index = cancel_element_index;
			this.skiptutorial_element_index = skiptutorial_element_index;
			this.replay_element_index = replay_element_index;
			this.transmission_element_index = transmission_element_index;
			this.objectives_element_index = objectives_element_index;
			this.first_portrait_element_index = first_portrait_element_index;

			this.scenario = (Chk)mpq.GetResource (scenario_prefix + "\\staredit\\scenario.chk");
			this.scenario_prefix = scenario_prefix;
		}
Exemplo n.º 2
0
		public MapRenderer (Mpq mpq, Chk chk)
		{
			this.mpq = mpq;
			this.chk = chk;

			pixel_width = (ushort)(chk.Width * 32);
			pixel_height = (ushort)(chk.Height * 32);

			Stream cv5_fs = (Stream)mpq.GetResource (String.Format ("tileset\\{0}.cv5", Util.TilesetNames[(int)chk.Tileset]));
			cv5 = new byte [cv5_fs.Length];
			cv5_fs.Read (cv5, 0, (int)cv5_fs.Length);
			cv5_fs.Close ();

			Stream vx4_fs = (Stream)mpq.GetResource (String.Format ("tileset\\{0}.vx4", Util.TilesetNames[(int)chk.Tileset]));
			vx4 = new byte [vx4_fs.Length];
			vx4_fs.Read (vx4, 0, (int)vx4_fs.Length);
			vx4_fs.Close ();

			Stream vr4_fs = (Stream)mpq.GetResource (String.Format ("tileset\\{0}.vr4", Util.TilesetNames[(int)chk.Tileset]));
			vr4 = new byte [vr4_fs.Length];
			vr4_fs.Read (vr4, 0, (int)vr4_fs.Length);
			vr4_fs.Close ();

			Stream vf4_fs = (Stream)mpq.GetResource (String.Format ("tileset\\{0}.vf4", Util.TilesetNames[(int)chk.Tileset]));
			vf4 = new byte [vf4_fs.Length];
			vf4_fs.Read (vf4, 0, (int)vf4_fs.Length);
			vf4_fs.Close ();

			Stream wpe_fs = (Stream)mpq.GetResource (String.Format ("tileset\\{0}.wpe", Util.TilesetNames[(int)chk.Tileset]));
			wpe = new byte [wpe_fs.Length];
			wpe_fs.Read (wpe, 0, (int)wpe_fs.Length);
			wpe_fs.Close ();
			
			mapLayer = (CATiledLayer)CATiledLayer.Create ();
			mapLayer.TileSize = new SizeF (32, 32);
			mapLayer.Bounds = new RectangleF (0, 0, pixel_width, pixel_height);
			mapLayer.AnchorPoint = new PointF (0, 0);
			mapLayerDelegate = new MapLayerDelegate (this);
			mapLayer.Delegate = mapLayerDelegate;
			mapLayer.SetNeedsDisplay ();
		}
Exemplo n.º 3
0
		public static Fnt[] GetFonts (Mpq mpq) {
			if (fonts == null) {
				string[] font_list;
				font_list = BroodwarFonts;

				fonts = new Fnt[font_list.Length];

				for (int i = 0; i < fonts.Length; i ++) {
					fonts[i] = (Fnt)mpq.GetResource (font_list[i]);
					Console.WriteLine ("fonts[{0}] = {1}", i, fonts[i] == null ? "null" : "not null");
				}
			}
			return fonts;
		}
Exemplo n.º 4
0
		public Sprite (Mpq mpq, int sprite_entry, byte[] palette, int x, int y)
		{
			this.mpq = mpq;
			this.palette = palette;

			images_entry = GlobalResources.Instance.SpritesDat.ImagesDatEntries [sprite_entry];
			//			Console.WriteLine ("image_dat_entry == {0}", images_entry);

			uint grp_index = GlobalResources.Instance.ImagesDat.GrpIndexes [images_entry];
			//			Console.WriteLine ("grp_index = {0}", grp_index);
			grp_path = GlobalResources.Instance.ImagesTbl[(int)grp_index-1];
			//			Console.WriteLine ("grp_path = {0}", grp_path);

			grp = (Grp)mpq.GetResource ("unit\\" + grp_path);

			iscript_entry = GlobalResources.Instance.ImagesDat.IScriptIndexes [images_entry];
			script_entry_offset = GlobalResources.Instance.IScriptBin.GetScriptEntryOffset (iscript_entry);

			Console.WriteLine ("new sprite: unit\\{0} @ {1}x{2} (image {3}, iscript id {4}, script_entry_offset {5:X})",
					   grp_path, x, y, images_entry, iscript_entry, script_entry_offset);

			this.buf = GlobalResources.Instance.IScriptBin.Contents;

			/* make sure the offset points to "SCPE" */
			if (Util.ReadDWord (buf, script_entry_offset) != 0x45504353)
				Console.WriteLine ("invalid script_entry_offset");

			SetPosition (x,y);
		}
Exemplo n.º 5
0
		public Sprite (Sprite parentSprite, ushort images_entry, byte[] palette)
		{
			this.parent_sprite = parentSprite;
			this.mpq = parentSprite.mpq;
			this.palette = palette;
			this.images_entry = images_entry;

			uint grp_index = GlobalResources.Instance.ImagesDat.GrpIndexes [images_entry];

			grp_path = GlobalResources.Instance.ImagesTbl[(int)grp_index-1];

			grp = (Grp)mpq.GetResource ("unit\\" + grp_path);

			this.buf = GlobalResources.Instance.IScriptBin.Contents;
			iscript_entry = GlobalResources.Instance.ImagesDat.IScriptIndexes [images_entry];

			script_entry_offset = GlobalResources.Instance.IScriptBin.GetScriptEntryOffset (iscript_entry);

			Console.WriteLine ("new dependent sprite: unit\\{0} (image {1}, iscript id {2}, script_entry_offset {3:X})",
					   grp_path, images_entry, iscript_entry, script_entry_offset);

			/* make sure the offset points to "SCEP" */
			if (Util.ReadDWord (buf, script_entry_offset) != 0x45504353)
				Console.WriteLine ("invalid script_entry_offset");

			int x, y;
			parentSprite.GetPosition (out x, out y);
			SetPosition (x,y);
		}
Exemplo n.º 6
0
		public static void PlayMusic (Mpq mpq, string resourcePath, int numLoops)
		{
			Stream stream = (Stream)mpq.GetResource (resourcePath);
			if (stream == null)
				return;
			NSSound s = GuiUtil.SoundFromStream (stream);
			s.Loops = true;;
			s.Play ();
		}
Exemplo n.º 7
0
		public static void PlaySound (Mpq mpq, string resourcePath)
		{
			Stream stream = (Stream)mpq.GetResource (resourcePath);
			if (stream == null)
				return;
			NSSound s = GuiUtil.SoundFromStream (stream);
			s.Play();
		}
Exemplo n.º 8
0
		void FileListSelectionChanged (int selectedIndex)
		{
			string map_path = Path.Combine (curdir, file_listbox.SelectedItem);

			if (selectedScenario !=null)
				selectedScenario.Dispose ();

			if (selectedIndex < directories.Length) {
				selectedScenario = null;
				selectedChk = null;
			}
			else {
				selectedScenario = new MpqArchive (map_path);

				selectedChk = (Chk)selectedScenario.GetResource ("staredit\\scenario.chk");
			}

			Elements[MAPTITLE_ELEMENT_INDEX].Text = selectedChk == null ? "" : selectedChk.Name;
			Elements[MAPDESCRIPTION_ELEMENT_INDEX].Text = selectedChk == null ? "" : selectedChk.Description;

			string mapSizeString = GlobalResources.Instance.GluAllTbl.Strings[MAPSIZE_FORMAT_INDEX];
			//			string mapDimString = GlobalResources.Instance.GluAllTbl.Strings[MAPDIM_FORMAT_INDEX];
			string tileSetString = GlobalResources.Instance.GluAllTbl.Strings[TILESET_FORMAT_INDEX];

			mapSizeString = mapSizeString.Replace ("%c", " "); /* should probably be a tab.. */
			mapSizeString = mapSizeString.Replace ("%s",
							       (selectedChk == null
								? ""
								: String.Format ("{0}x{1}",
										 selectedChk.Width,
										 selectedChk.Height)));

			tileSetString = tileSetString.Replace ("%c", " "); /* should probably be a tab.. */
			tileSetString = tileSetString.Replace ("%s",
							       (selectedChk == null
								? ""
								: String.Format ("{0}",
										 selectedChk.Tileset)));

			Elements[MAPSIZE_ELEMENT_INDEX].Text = mapSizeString;
			Elements[MAPTILESET_ELEMENT_INDEX].Text = tileSetString;

			UpdatePlayersDisplay ();
		}