Beispiel #1
0
 void initializeMission()
 {
     tabMain.Focus(); //[JB] Exit focus from any form controls.  Fixes some crashes when Leave() events are processed after mission data has been cleared (notably from within the Messages tab).
     _mission = new Mission();
     _config.LastMission = "";
     _activeFG = 0;
     _activeMessage = 0;
     _mission.FlightGroups[0].CraftType = Convert.ToByte(_config.XvtCraft);
     _mission.FlightGroups[0].IFF = Convert.ToByte(_config.XvtIff);
     string[] fgList = _mission.FlightGroups.GetList();
     comboReset(cboArrMS, fgList, 0);
     comboReset(cboArrMSAlt, fgList, 0);
     comboReset(cboDepMS, fgList, 0);
     comboReset(cboDepMSAlt, fgList, 0);
     lstFG.Items.Clear();
     lstFG.Items.Add(_mission.FlightGroups[_activeFG].ToString(true));
     tabMain.SelectedIndex = 0;
     tabFGMinor.SelectedIndex = 0;
     this.Text = "Ye Olde Galactic Empire Mission Editor - XvT - New Mission.tie";
 }
Beispiel #2
0
 void labelRefresh(Mission.Trigger trigger, Label lbl)
 {
     // lbl is the affected label
     string triggerText = trigger.ToString();
     triggerText = replaceTargetText(triggerText);
     lbl.Text = triggerText;
 }
Beispiel #3
0
 /// <summary>Downgrades XWA missions to XvT and BoP</summary>
 /// <remarks>Maximum CraftType of 91. Triggers will update.<br/>
 /// For Triggers, maximum Trigger index of 46, maximum VariableType of 23, Amounts will be adjusted as "each special" to "100% special"<br/>
 /// Only Start and Hyp WPs converted, manual placement for WP1-8 required.<br/>
 /// For the Briefing, first 32 strings and text tags are copied, events are ignored (due to using icons instead of Craft)<br/>
 /// Filename will end in "_XvT.tie" or "_.BoP.tie"</remarks>
 /// <param name="miss">XWA mission to convert</param>
 /// <param name="bop">Determines if mission is to be converted to BoP instead of XvT</param>
 /// <returns>Downgraded mission</returns>
 /// <exception cref="System.ArgumentException">Properties incompatable with XvT/BoP were detected in <i>miss</i></exception>
 public static Xvt.Mission XwaToXvtBop(Xwa.Mission miss, bool bop)
 {
     Xvt.Mission xvt = new Xvt.Mission();
     xvt.IsBop = bop;
     if (miss.FlightGroups.Count > Xvt.Mission.FlightGroupLimit) throw maxException(false, true, Xvt.Mission.FlightGroupLimit);
     if (miss.Messages.Count > Xvt.Mission.MessageLimit) throw maxException(false, false, Xvt.Mission.MessageLimit);
     xvt.FlightGroups = new Xvt.FlightGroupCollection(miss.FlightGroups.Count);
     if (miss.Messages.Count > 0) xvt.Messages = new Xvt.MessageCollection(miss.Messages.Count);
     xvt.MissionDescription = miss.MissionDescription;
     xvt.MissionFailed = miss.MissionFailed;
     xvt.MissionSuccessful = miss.MissionSuccessful;
     #region FGs
     for (int i = 0; i < xvt.FlightGroups.Count; i++)
     {
         #region craft
         xvt.FlightGroups[i].Name = miss.FlightGroups[i].Name;
         xvt.FlightGroups[i].Cargo = miss.FlightGroups[i].Cargo;
         xvt.FlightGroups[i].SpecialCargo = miss.FlightGroups[i].SpecialCargo;
         xvt.FlightGroups[i].SpecialCargoCraft = miss.FlightGroups[i].SpecialCargoCraft;
         xvt.FlightGroups[i].RandSpecCargo = miss.FlightGroups[i].RandSpecCargo;
         xvt.FlightGroups[i].CraftType = Xvt.Mission.CraftCheck(miss.FlightGroups[i].CraftType);
         if (xvt.FlightGroups[i].CraftType == 255) throw flightException(4, i, Xwa.Strings.CraftType[miss.FlightGroups[i].CraftType]);
         xvt.FlightGroups[i].NumberOfCraft = miss.FlightGroups[i].NumberOfCraft;
         if (xvt.FlightGroups[i].Status1 > 21) throw flightException(0, i, Xwa.Strings.Status[miss.FlightGroups[i].Status1]);
         xvt.FlightGroups[i].Status1 = miss.FlightGroups[i].Status1;
         if (xvt.FlightGroups[i].Status2 > 21) throw flightException(0, i, Xwa.Strings.Status[miss.FlightGroups[i].Status2]);
         xvt.FlightGroups[i].Status2 = miss.FlightGroups[i].Status2;
         xvt.FlightGroups[i].Missile = miss.FlightGroups[i].Missile;
         xvt.FlightGroups[i].Beam = miss.FlightGroups[i].Beam;
         xvt.FlightGroups[i].IFF = miss.FlightGroups[i].IFF;
         xvt.FlightGroups[i].Team = miss.FlightGroups[i].Team;
         xvt.FlightGroups[i].AI = miss.FlightGroups[i].AI;
         xvt.FlightGroups[i].Markings = miss.FlightGroups[i].Markings;
         xvt.FlightGroups[i].Radio = miss.FlightGroups[i].Radio;
         xvt.FlightGroups[i].Formation = miss.FlightGroups[i].Formation;
         xvt.FlightGroups[i].FormDistance= miss.FlightGroups[i].FormDistance;
         xvt.FlightGroups[i].GlobalGroup = miss.FlightGroups[i].GlobalGroup;
         xvt.FlightGroups[i].FormLeaderDist = miss.FlightGroups[i].FormLeaderDist;
         xvt.FlightGroups[i].NumberOfWaves = miss.FlightGroups[i].NumberOfWaves;
         xvt.FlightGroups[i].Unknowns.Unknown1 = miss.FlightGroups[i].Unknowns.Unknown3;
         xvt.FlightGroups[i].PlayerNumber = miss.FlightGroups[i].PlayerNumber;
         xvt.FlightGroups[i].ArriveOnlyIfHuman = miss.FlightGroups[i].ArriveOnlyIfHuman;
         xvt.FlightGroups[i].PlayerCraft = miss.FlightGroups[i].PlayerCraft;
         xvt.FlightGroups[i].Yaw = miss.FlightGroups[i].Yaw;
         xvt.FlightGroups[i].Pitch = miss.FlightGroups[i].Pitch;
         xvt.FlightGroups[i].Roll = miss.FlightGroups[i].Roll;
         #endregion craft
         #region ArrDep
         xvt.FlightGroups[i].Difficulty = miss.FlightGroups[i].Difficulty;
         for (int j = 0; j < 6; j++)
         {
             try { xvt.FlightGroups[i].ArrDepTriggers[j] = (Xvt.Mission.Trigger)miss.FlightGroups[i].ArrDepTriggers[j]; }
             catch (Exception x) { throw new ArgumentException("FG[" + i + "] ArrDep[" + j + "]: " + x.Message, x); }
         }
         for (int j=0; j<4; j++) xvt.FlightGroups[i].ArrDepAO[j] = miss.FlightGroups[i].ArrDepAndOr[j];
         xvt.FlightGroups[i].ArrivalDelayMinutes = miss.FlightGroups[i].ArrivalDelayMinutes;
         xvt.FlightGroups[i].ArrivalDelaySeconds = miss.FlightGroups[i].ArrivalDelaySeconds;
         xvt.FlightGroups[i].DepartureTimerMinutes = miss.FlightGroups[i].DepartureTimerMinutes;
         xvt.FlightGroups[i].DepartureTimerSeconds = miss.FlightGroups[i].DepartureTimerSeconds;
         xvt.FlightGroups[i].AbortTrigger = miss.FlightGroups[i].AbortTrigger;
         xvt.FlightGroups[i].ArrivalCraft1 = miss.FlightGroups[i].ArrivalCraft1;
         xvt.FlightGroups[i].ArrivalMethod1 = miss.FlightGroups[i].ArrivalMethod1;
         xvt.FlightGroups[i].ArrivalCraft2 = miss.FlightGroups[i].ArrivalCraft2;
         xvt.FlightGroups[i].ArrivalMethod2 = miss.FlightGroups[i].ArrivalMethod2;
         xvt.FlightGroups[i].DepartureCraft1 = miss.FlightGroups[i].DepartureCraft1;
         xvt.FlightGroups[i].DepartureMethod1 = miss.FlightGroups[i].DepartureMethod1;
         xvt.FlightGroups[i].DepartureCraft2 = miss.FlightGroups[i].DepartureCraft2;
         xvt.FlightGroups[i].DepartureMethod2 = miss.FlightGroups[i].DepartureMethod2;
         #endregion ArrDep
         #region Goals
         for (int j=0; j<8; j++)
         {
             for (int k = 0; k < 6; k++) xvt.FlightGroups[i].Goals[j][k] = miss.FlightGroups[i].Goals[j][k];
             if (xvt.FlightGroups[i].Goals[j].Condition > 46)
                 throw triggerException(0, "FG " + i + " Goal " + j, Xwa.Strings.Trigger[xvt.FlightGroups[i].Goals[j].Condition]);
             if (xvt.FlightGroups[i].Goals[j].Amount == 19) xvt.FlightGroups[i].Goals[j].Amount = 6;
             xvt.FlightGroups[i].Goals[j].IncompleteText = miss.FlightGroups[i].Goals[j].IncompleteText;
             xvt.FlightGroups[i].Goals[j].CompleteText = miss.FlightGroups[i].Goals[j].CompleteText;
             xvt.FlightGroups[i].Goals[j].FailedText = miss.FlightGroups[i].Goals[j].FailedText;
         }
         #endregion Goals
         for (int j = 0; j < 4; j++)
         {
             try { xvt.FlightGroups[i].Orders[j] = (Xvt.FlightGroup.Order)miss.FlightGroups[i].Orders[0, j]; }
             catch (Exception x) { throw new ArgumentException("FG[" + i + "] Order[" + j + "]: " + x.Message, x); }
         }
         xvt.FlightGroups[i].SkipToO4T1AndOrT2 = miss.FlightGroups[i].Orders[0, 3].SkipT1AndOrT2;
         for (int j = 0; j < 2; j++)
         {
             try { xvt.FlightGroups[i].SkipToOrder4Trigger[j] = (Xvt.Mission.Trigger)miss.FlightGroups[i].Orders[0, 3].SkipTriggers[j]; }
             catch (Exception x) { throw new ArgumentException("FG[" + i + "] SkipT[" + j + "]: " + x.Message, x); }
         }
         for (int j = 0; j < 3; j++)
             xvt.FlightGroups[i].Waypoints[j] = (Xvt.FlightGroup.Waypoint)miss.FlightGroups[i].Waypoints[j];
         xvt.FlightGroups[i].Waypoints[13] = (Xvt.FlightGroup.Waypoint)miss.FlightGroups[i].Waypoints[3];
     }
     #endregion FGs
     #region Messages
     for (int i = 0; i < xvt.Messages.Count; i++)
     {
         xvt.Messages[i].MessageString = miss.Messages[i].MessageString;
         xvt.Messages[i].Color = miss.Messages[i].Color;
         xvt.Messages[i].Delay = (byte)((miss.Messages[i].DelaySeconds + miss.Messages[i].DelayMinutes * 60) / 5);	// should throw if delay > 21:15
         xvt.Messages[i].Note = miss.Messages[i].Note;
         xvt.Messages[i].T1AndOrT2 = miss.Messages[i].TrigAndOr[0];
         xvt.Messages[i].T3AndOrT4 = miss.Messages[i].TrigAndOr[1];
         xvt.Messages[i].T12AndOrT34 = miss.Messages[i].TrigAndOr[2];
         for (int j = 0; j < 10; j++) xvt.Messages[i].SentToTeam[j] = miss.Messages[i].SentTo[j];
         for (int j = 0; j < 4; j++)
         {
             try { xvt.Messages[i].Triggers[j] = (Xvt.Mission.Trigger)miss.Messages[i].Triggers[j]; }
             catch (Exception x) { throw new ArgumentException("Mess[" + i + "] T[" + j + "]: " + x.Message, x); }
         }
     }
     #endregion Messages
     #region Briefing
     for (int i = 0; i < 2; i++)
     {
         for (int j = 0; j < xvt.Briefings[i].BriefingTag.Length; j++) xvt.Briefings[i].BriefingTag[j] = miss.Briefings[i].BriefingTag[j];
         for (int j = 0; j < xvt.Briefings[i].BriefingString.Length; j++) xvt.Briefings[i].BriefingString[j] = miss.Briefings[i].BriefingString[j];
         xvt.Briefings[i].Unknown1 = miss.Briefings[i].Unknown1;
         xvt.Briefings[i].Length = (short)(miss.Briefings[i].Length * Xvt.Briefing.TicksPerSecond / Xwa.Briefing.TicksPerSecond);
     }
     #endregion Briefing
     #region Globals
     for (int i = 0; i < 10; i++)
     {
         for (int j = 0; j < 3; j++)
         {
             xvt.Globals[i].Goals[j].T1AndOrT2 = miss.Globals[i].Goals[j].T1AndOrT2;
             xvt.Globals[i].Goals[j].T3AndOrT4 = miss.Globals[i].Goals[j].T3AndOrT4;
             xvt.Globals[i].Goals[j].T12AndOrT34 = miss.Globals[i].Goals[j].T12AndOrT34;
             for (int k = 0; k < 12; k++) xvt.Globals[i].Goals[j].Triggers[k / 3].GoalStrings[k % 3] = miss.Globals[i].Goals[j].GoalStrings[k / 3, k % 3];
             xvt.Globals[i].Goals[j].RawPoints = miss.Globals[i].Goals[j].RawPoints;
             for (int h = 0; h < 4; h++)
             {
                 try { xvt.Globals[i].Goals[j].Triggers[h].GoalTrigger = (Xvt.Mission.Trigger)miss.Globals[i].Goals[j].Triggers[h]; }
                 catch (Exception x) { throw new ArgumentException("Team[" + i + "] Goal[" + j + "] T[" + h + "]: " + x.Message, x); }
             }
         }
     }
     #endregion Globals
     #region Team
     for (int i = 0; i < 10; i++)
     {
         xvt.Teams[i].Name = miss.Teams[i].Name;
         for (int j = 0; j < 6; j++)
             xvt.Teams[i].EndOfMissionMessages[j] = miss.Teams[i].EndOfMissionMessages[j];
         for (int j = 0; j < 10; j++)
             xvt.Teams[i].AlliedWithTeam[j] = (miss.Teams[i].Allies[j] == Xwa.Team.Allegeance.Friendly);
     }
     #endregion Team
     xvt.MissionPath = miss.MissionPath.ToUpper().Replace(".TIE", "_XVT.tie");
     return xvt;
 }