Esempio 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;
		}
Esempio n. 2
0
		public GameModeDialog (UIScreen parent, Mpq mpq)
			: base (parent, mpq, "glue\\Palmm", Builtins.rez_GluGameModeBin)
		{
			background_path = "glue\\Palmm\\retail_ex.pcx";
			background_translucent = 42;
			background_transparent = 0;
		}
Esempio n. 3
0
		public RaceSelectionScreen (Mpq mpq) 
			: base (mpq, "glue\\PalCs",
				Game.Instance.PlayingBroodWar ? Builtins.rez_GluExpcmpgnBin : Builtins.rez_GluCmpgnBin)
		{
			background_translucent = 254;
			background_transparent = 0;
		}
Esempio n. 4
0
 public void Remove(Mpq mpq)
 {
     if (mpq == null)
     {
         return;
     }
     mpqs.Remove(mpq);
 }
Esempio n. 5
0
 public void Add(Mpq mpq)
 {
     if (mpq == null)
     {
         return;
     }
     mpqs.Add(mpq);
 }
Esempio n. 6
0
		public GlobalResources (Mpq stardatMpq, Mpq broodatMpq)
		{
			if (instance != null)
				throw new Exception ("There can only be one GlobalResources");

			this.stardatMpq = stardatMpq;
			this.broodatMpq = broodatMpq;

			starcraftResources = new Resources();
			broodwarResources = new Resources();

			instance = this;
		}
Esempio n. 7
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;
		}
Esempio n. 8
0
		protected UIDialog (UIScreen parent, Mpq mpq, string prefix, string binFile)
			: base (mpq, prefix, binFile)
		{
			this.parent = parent;
			background_translucent = 254;
			background_transparent = 0;
			
			dimScreen = true;
			
			dimLayer = CALayer.Create ();
			dimLayer.Bounds = parent.Bounds;
			dimLayer.AnchorPoint = new PointF (0, 0);
			dimLayer.BackgroundColor = new CGColor (0, 0, 0, .7f);
		}
Esempio n. 9
0
	public RunAnimation (Mpq mpq)
	{
		this.mpq = mpq;

		GlobalResources globals = new GlobalResources (mpq);
		//		globals.Ready += GlobalsReady;

		globals.Load ();
		
		CreateWindow ();

		Timer.DelaySeconds (5);

		GlobalsReady ();
	}
Esempio n. 10
0
		protected UIDialog dialog; /* the currently popped up dialog */

		protected UIScreen (Mpq mpq, string prefix, string binFile)
		{
			this.mpq = mpq;
			this.prefix = prefix; 
			this.binFile = binFile;

			if (prefix != null) {
				background_path = prefix + "\\Backgnd.pcx";
				fontpal_path = prefix + "\\tFont.pcx";
				effectpal_path = prefix + "\\tEffect.pcx";
				arrowgrp_path = prefix + "\\arrow.grp";
			}

			background_transparent = -1;
			background_translucent = -1;
			
			Bounds = new RectangleF (0, 0, 640, 480);
			AnchorPoint = new PointF (0, 0);
		}
Esempio n. 11
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 ();
		}
Esempio n. 12
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);
		}
Esempio n. 13
0
		public EstablishingShot (string markup_resource, string scenario_prefix, Mpq mpq) : base (mpq)
		{
			this.markup_resource = markup_resource;
			this.scenario_prefix = scenario_prefix;
		}
Esempio n. 14
0
		public static ReadyRoomScreen Create (Mpq mpq,
						      string scenario_prefix)
		{
			switch (Game.Instance.Race) {
			case Race.Terran:
				return new TerranReadyRoomScreen (mpq, scenario_prefix);
			case Race.Protoss:
				return new ProtossReadyRoomScreen (mpq, scenario_prefix);
			case Race.Zerg:
				return new ZergReadyRoomScreen (mpq, scenario_prefix);
			default:
				return null;
			}
		}
Esempio n. 15
0
		public ZergReadyRoomScreen (Mpq mpq,
					      string scenario_prefix)
			: base (mpq,
				scenario_prefix,
				START_ELEMENT_INDEX,
				CANCEL_ELEMENT_INDEX,
				SKIPTUTORIAL_ELEMENT_INDEX,
				REPLAY_ELEMENT_INDEX,
				TRANSMISSION_ELEMENT_INDEX,
				OBJECTIVES_ELEMENT_INDEX,
				FIRST_PORTRAIT_ELEMENT_INDEX)
		{
		}
Esempio n. 16
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 ();
		}
Esempio n. 17
0
		public VideoDialog (UIScreen parent, Mpq mpq)
			: base (parent, mpq, "glue\\Palmm", Builtins.rez_VideoBin)
		{
			background_path = null;
		}
Esempio n. 18
0
		public NetworkDialog (UIScreen parent, Mpq mpq)
			: base (parent, mpq, "glue\\Palmm", Builtins.rez_NetDlgBin)
		{
			background_path = null;
		}
Esempio n. 19
0
 public void Remove(Mpq mpq)
 {
     if (mpq == null)
         return;
     mpqs.Remove (mpq);
 }
Esempio n. 20
0
		public ObjectivesDialog (UIScreen parent, Mpq mpq)
			: base (parent, mpq, "glue\\Palmm", Builtins.rez_ObjctDlgBin)
		{
			background_path = null;
		}
Esempio n. 21
0
		public EntryDialog (UIScreen parent, Mpq mpq, string title)
			: base (parent, mpq, "glue\\PalNl", Builtins.rez_GluPEditBin)
		{
			background_path = "glue\\PalNl\\pEPopup.pcx";
			this.title = title;
		}
Esempio n. 22
0
		public static Sprite CreateSprite (Mpq mpq, int sprite_number, byte[] palette, int x, int y)
		{
			our_mpq = mpq;
			return CreateSprite (sprite_number, palette, x, y);
		}
Esempio n. 23
0
		public SpeedDialog (UIScreen parent, Mpq mpq)
			: base (parent, mpq, "glue\\Palmm", Builtins.rez_SpdDlgBin)
		{
			background_path = null;
		}
Esempio n. 24
0
		public OptionsDialog (UIScreen parent, Mpq mpq)
			: base (parent, mpq, "glue\\Palmm", Builtins.rez_OptionsBin)
		{
			background_path = null;
		}
Esempio n. 25
0
 public void Add(Mpq mpq)
 {
     if (mpq == null)
         return;
     mpqs.Add (mpq);
 }
Esempio n. 26
0
		public KeystrokeDialog (UIScreen parent, Mpq mpq)
			: base (parent, mpq, "glue\\Palmm", Builtins.rez_HelpBin)
		{
			background_path = null;
		}
Esempio n. 27
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();
		}
Esempio n. 28
0
		public GameMenuDialog (UIScreen parent, Mpq mpq)
			: base (parent, mpq, "glue\\Palmm", Builtins.rez_GameMenuBin)
		{
			background_path = null;
		}
Esempio n. 29
0
		public QuitMissionDialog (UIScreen parent, Mpq mpq)
			: base (parent, mpq, "glue\\Palmm", Builtins.rez_Quit2MnuBin)
		{
			background_path = null;
		}
Esempio n. 30
0
		public Game (string starcraftDir, string scCDDir, string bwCDDir)
		{
			instance = this;
			
			Layer = CALayer.Create();
			Layer.BackgroundColor = new CGColor (0, 0, 0, 1);
			
#if USE_TRACKING_RECTS
			AddTrackingRect (new Rectangle (0, 0, 640, 480), this, IntPtr.Zero, false);
#endif
			
			WantsLayer = true;
			
			starcraftDir = starcraftDir.Replace ('\\', Path.DirectorySeparatorChar)
						   .Replace ('/', Path.DirectorySeparatorChar);

			scCDDir = scCDDir.Replace ('\\', Path.DirectorySeparatorChar)
					 .Replace ('/', Path.DirectorySeparatorChar);

			bwCDDir = bwCDDir.Replace ('\\', Path.DirectorySeparatorChar)
					 .Replace ('/', Path.DirectorySeparatorChar);

			screens = new UIScreen[(int)UIScreenType.ScreenCount];

			installedMpq = new MpqContainer ();
			playingMpq = new MpqContainer ();

			Mpq scMpq = null, bwMpq = null;

			if (starcraftDir != null) {
				foreach (string path in Directory.GetFileSystemEntries (starcraftDir)) {
					if (Path.GetFileName (path).ToLower() == "broodat.mpq" || Path.GetFileName (path).Equals ("Brood War Data")) {
						if (broodatMpq != null)
							throw new Exception ("You have multiple broodat.mpq files in your starcraft directory.");
						try {
							bwMpq = GetMpq (path);
							Console.WriteLine ("found BrooDat.mpq");
						}
						catch (Exception e) {
							throw new Exception (String.Format ("Could not read mpq archive {0}",
											    path),
									     e);
						}
					}
					else if (Path.GetFileName (path).ToLower() == "stardat.mpq" || Path.GetFileName (path).Equals ("Starcraft Data")) {
						if (stardatMpq != null)
							throw new Exception ("You have multiple stardat.mpq files in your starcraft directory.");
						try {
							scMpq = GetMpq (path);
							Console.WriteLine ("found StarDat.mpq");
						}
						catch (Exception e) {
							throw new Exception (String.Format ("could not read mpq archive {0}",
											    path),
									     e);
						}
					}
					else if (Path.GetFileName (path).ToLower() == "patch_rt.mpq" || Path.GetFileName (path).Equals ("Starcraft Mac Patch")) {
						if (patchRtMpq != null)
							throw new Exception ("You have multiple patch_rt.mpq files in your starcraft directory.");
						try {
							patchRtMpq = GetMpq (path);
							Console.WriteLine ("found patch_rt.mpq");
						}
						catch (Exception e) {
							throw new Exception (String.Format ("could not read mpq archive {0}",
											    path),
									     e);
						}
					}
					else if (Path.GetFileName (path).ToLower() == "starcraft.mpq") {
						try {
							scInstallExe = GetMpq (path);
							Console.WriteLine ("found starcraft.mpq");
						}
						catch (Exception e) {
							throw new Exception (String.Format ("could not read mpq archive {0}",
											    path),
									     e);
						}
					}
					else if (Path.GetFileName (path).ToLower() == "broodwar.mpq") {
						try {
							bwInstallExe = GetMpq (path);
							Console.WriteLine ("found broodwar.mpq");
						}
						catch (Exception e) {
							throw new Exception (String.Format ("could not read mpq archive {0}",
											    path),
									     e);
						}
					}
				}
			}

			if (scMpq == null) {
				throw new Exception ("unable to locate stardat.mpq, please check your StarcraftDirectory configuration setting");
			}

			if (!string.IsNullOrEmpty (scCDDir)) {
				foreach (string path in Directory.GetFileSystemEntries (scCDDir)) {
					if (Path.GetFileName (path).ToLower() == "install.exe" || Path.GetFileName (path).Equals ("Starcraft Archive")) {
						try {
							scInstallExe = GetMpq (path);
							Console.WriteLine ("found SC install.exe");
						}
						catch (Exception e) {
							throw new Exception (String.Format ("could not read mpq archive {0}",
											    path),
									     e);
						}
					}
				}
			}

			if (!string.IsNullOrEmpty (bwCDDir)) {
				foreach (string path in Directory.GetFileSystemEntries (bwCDDir)) {
					if (Path.GetFileName (path).ToLower() == "install.exe" || Path.GetFileName (path).Equals ("Brood War Archive")) {
						try {
							bwInstallExe = GetMpq (path);
							Console.WriteLine ("found BW install.exe");
						}
						catch (Exception e) {
							throw new Exception (String.Format ("could not read mpq archive {0}",
											    path),
									     e);
						}
					}
				}
			}

			if (bwInstallExe == null)
				throw new Exception ("unable to locate broodwar cd's install.exe, please check your BroodwarCDDirectory configuration setting");

			if (bwMpq != null) {
				if (patchRtMpq != null) {
					broodatMpq = new MpqContainer ();
					((MpqContainer)broodatMpq).Add (patchRtMpq);
					((MpqContainer)broodatMpq).Add (bwMpq);
				}
				else
					broodatMpq = bwMpq;
			}

			if (scMpq != null) {
				if (patchRtMpq != null) {
					stardatMpq = new MpqContainer ();
					((MpqContainer)stardatMpq).Add (patchRtMpq);
					((MpqContainer)stardatMpq).Add (scMpq);
				}
				else
					stardatMpq = bwMpq;
			}

			if (broodatMpq != null)
				installedMpq.Add (broodatMpq);
			if (bwInstallExe != null)
				installedMpq.Add (bwInstallExe);
			if (stardatMpq != null)
				installedMpq.Add (stardatMpq);
			if (scInstallExe != null)
				installedMpq.Add (scInstallExe);
			
			PlayingBroodWar = isBroodWar = (broodatMpq != null);
			
			this.rootDir = starcraftDir;
		}
Esempio n. 31
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);
		}
Esempio n. 32
0
		public ExitConfirmationDialog (UIScreen parent, Mpq mpq)
			: base (parent, mpq, "glue\\Palmm", Builtins.rez_QuitBin)
		{
			background_path = null;
		}