mission3.cpp 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144
  1. /*
  2. ** Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
  3. **
  4. ** File: Mission3.cpp
  5. **
  6. ** Author:
  7. **
  8. ** Description:
  9. ** Implementation of the first training mission
  10. **
  11. ** History:
  12. */
  13. #include "pch.h"
  14. #include "Mission3.h"
  15. #include "Training.h"
  16. #include "GoalList.h"
  17. #include "Predicate.h"
  18. #include "TrueCondition.h"
  19. #include "FalseCondition.h"
  20. #include "AndCondition.h"
  21. #include "OrCondition.h"
  22. #include "NotCondition.h"
  23. #include "PeriodicCondition.h"
  24. #include "ElapsedTimeCondition.h"
  25. #include "ObjectMovingTowardsCondition.h"
  26. #include "ObjectWithinRadiusCondition.h"
  27. #include "ObjectPointingAtCondition.h"
  28. #include "ConditionalAction.h"
  29. #include "ConditionList.h"
  30. #include "ActionList.h"
  31. #include "MessageAction.h"
  32. #include "PlaySoundAction.h"
  33. #include "SetCommandAction.h"
  34. #include "NoAction.h"
  35. #include "NTimesCondition.h"
  36. #include "EndMissionAction.h"
  37. #include "ResetAction.h"
  38. #include "ResetShipAction.h"
  39. #include "SoundFinishedCondition.h"
  40. #include "SetDisplayModeAction.h"
  41. #include "TurnShipAboutCondition.h"
  42. #include "GetRadarLODCondition.h"
  43. #include "SetRadarLODAction.h"
  44. #include "GetControlActiveCondition.h"
  45. #include "GetStateBitsCondition.h"
  46. #include "GetShipIsStoppedCondition.h"
  47. #include "GetShipIsDestroyedCondition.h"
  48. #include "SetControlConstraintsAction.h"
  49. #include "SetControlsAction.h"
  50. #include "GetAutopilotCondition.h"
  51. #include "SetAutopilotAction.h"
  52. #include "SetSignatureAction.h"
  53. #include "GetTargetCondition.h"
  54. #include "CommandAcknowledgedCondition.h"
  55. #include "GetCommandCondition.h"
  56. #include "ReleaseConsumerAction.h"
  57. #include "CreateProbeAction.h"
  58. #include "CreateWaypointAction.h"
  59. #include "SetHUDOverlayAction.h"
  60. #include "GetKeyCondition.h"
  61. #include "ProxyCondition.h"
  62. #include "TurnToAction.h"
  63. #include "ToggleWeaponAction.h"
  64. #include "SwapWeaponAction.h"
  65. #include "DoDamageAction.h"
  66. #include "CurrentTarget.h"
  67. #include "PlayerShipTarget.h"
  68. #include "RepairRearmAction.h"
  69. #include "ShowPaneAction.h"
  70. namespace Training
  71. {
  72. //------------------------------------------------------------------------------
  73. // class methods
  74. //------------------------------------------------------------------------------
  75. /* void */ Mission3::~Mission3 (void)
  76. {
  77. }
  78. //------------------------------------------------------------------------------
  79. int Mission3::GetMissionID (void)
  80. {
  81. return c_TM_3_Basic_Weaponry;
  82. }
  83. //------------------------------------------------------------------------------
  84. SectorID Mission3::GetStartSectorID (void)
  85. {
  86. return 1010;
  87. }
  88. //------------------------------------------------------------------------------
  89. bool Mission3::RecordKeyPress (TrekKey key)
  90. {
  91. switch (key)
  92. {
  93. case TK_TargetCenter:
  94. if (trekClient.flyingF())
  95. {
  96. IshipIGC* pShip = trekClient.GetShip ();
  97. const Orientation* pOrientation = &(pShip->GetOrientation());
  98. ImodelIGC* pTarget = FindTarget ( pShip,
  99. c_ttFront | c_ttShip | c_ttEnemy,
  100. pShip->GetCommandTarget (c_cmdCurrent),
  101. NULL, NULL, pOrientation);
  102. GetWindow ()->SetTarget(pTarget, c_cidNone);
  103. }
  104. return false;
  105. case TK_SwapWeapon1:
  106. case TK_SwapWeapon2:
  107. case TK_SwapWeapon3:
  108. case TK_SwapWeapon4:
  109. case TK_SwapTurret1:
  110. case TK_SwapTurret2:
  111. case TK_SwapTurret3:
  112. case TK_SwapTurret4:
  113. case TK_SwapMissile:
  114. case TK_SwapChaff:
  115. case TK_SwapShield:
  116. case TK_SwapCloak:
  117. case TK_SwapAfterburner:
  118. case TK_SwapMine:
  119. case TK_NextCargo:
  120. case TK_ToggleWeapon1:
  121. case TK_ToggleWeapon2:
  122. case TK_ToggleWeapon3:
  123. case TK_ToggleWeapon4:
  124. case TK_DropCargo:
  125. case TK_Reload:
  126. case TK_ToggleGroupFire:
  127. case TK_PrevWeapon:
  128. case TK_NextWeapon:
  129. case TK_PrevPart:
  130. case TK_NextPart:
  131. case TK_MountPart:
  132. case TK_ReplacePart:
  133. case TK_UnmountPart:
  134. case TK_DropPart:
  135. {
  136. // only allow if the inventory pane is up
  137. TrekWindow* pWindow = GetWindow ();
  138. if (pWindow->GetOverlayFlags () bit_and ofInventory)
  139. return true;
  140. return false;
  141. }
  142. }
  143. return TrainingMission::RecordKeyPress (key);
  144. }
  145. //------------------------------------------------------------------------------
  146. bool Mission3::ShipLanded (void)
  147. {
  148. Terminate ();
  149. return false;
  150. }
  151. //------------------------------------------------------------------------------
  152. void Mission3::CreateUniverse (void)
  153. {
  154. LoadUniverse ("training_1", 414, 1010); // a fighter 3
  155. // stuff for setup
  156. ImissionIGC* pCore = trekClient.GetCore();
  157. Time now = pCore->GetLastUpdate();
  158. IshipIGC* pShip = trekClient.GetShip();
  159. ImodelIGC* pStation = pCore->GetModel (OT_station, 1010);
  160. // take one of the guns off the ship
  161. IpartIGC* pPart = pShip->GetMountedPart (ET_Weapon, 0);
  162. if (pPart)
  163. pPart->Terminate ();
  164. // put an anti-shield weapon on the ship
  165. AddPartToShip (92, 0, 0);
  166. // take the missiles off the ship
  167. pPart = pShip->GetMountedPart (ET_Magazine, 0);
  168. if (pPart)
  169. pPart->Terminate ();
  170. // activate only the starting weapon
  171. trekClient.SetSelectedWeapon (0);
  172. trekClient.fGroupFire = false;
  173. // set a global attribute to reduce overall energy of ship
  174. IsideIGC* pSide = pShip->GetSide ();
  175. GlobalAttributeSet gas = pSide->GetGlobalAttributeSet ();
  176. gas.SetAttribute (c_gaMaxEnergy, 0.25f);
  177. pSide->SetGlobalAttributeSet (gas);
  178. // put the commander ship in the station
  179. IshipIGC* pCommander = pCore->GetShip (m_commanderID);
  180. pCommander->SetStation (static_cast<IstationIGC*> (pStation));
  181. pCommander->SetCommand (c_cmdAccepted, NULL, c_cidDoNothing);
  182. pCommander->SetCommand (c_cmdCurrent, NULL, c_cidDoNothing);
  183. pCommander->SetAutopilot (false);
  184. // create a bunch of derelict hulls in a sphere around the ship
  185. // at about 200m to 450m distance
  186. Vector direction (1.0f, 0.0f, 0.0f);
  187. for (int i = 0; i < TM_NUMBER_OF_DERELICTS; i++)
  188. {
  189. float fRadius = 200.0f + (static_cast<float> (i) * 25.0f);
  190. Vector newPosition = direction * fRadius;
  191. HullID hullID;
  192. switch (randomInt (0, 2))
  193. {
  194. case 0:
  195. hullID = 800;
  196. break;
  197. case 1:
  198. case 2:
  199. hullID = 801;
  200. break;
  201. }
  202. char name[32];
  203. sprintf (name, "Derelict %02d", i + 1);
  204. m_derelict_hulls[i] = pCore->GenerateNewShipID ();
  205. IshipIGC* pShip = CreateDrone (name, m_derelict_hulls[i], hullID, 1, c_ptPlayer);
  206. pShip->SetAutopilot (false);
  207. pShip->SetPosition (newPosition);
  208. // XXX I hope this works out - if a random vector is generated that is the same as direction, we're in trouble
  209. pShip->SetOrientation (Orientation (pShip->GetOrientation ().GetForward (), direction * -1.0f));
  210. pShip->SetCluster (pCore->GetCluster(1010));
  211. direction = Vector::RandomDirection ();
  212. }
  213. }
  214. //------------------------------------------------------------------------------
  215. Condition* Mission3::CreateMission (void)
  216. {
  217. // create the goal and the goal list
  218. GoalList* pGoalList = new GoalList;
  219. Goal* pGoal = new Goal (pGoalList);
  220. // put a constraint that will point the back in if it's more than 7500m from the base
  221. ImodelIGC* pShip = static_cast<ImodelIGC*> (trekClient.GetShip ());
  222. TurnToAction* pTurnToAction = new TurnToAction (pShip, OT_station, 1010);
  223. ObjectWithinRadiusCondition* pObjectWithinRadiusCondition = new ObjectWithinRadiusCondition (pShip, OT_station, 1010, 7500.0f);
  224. ObjectWithinRadiusCondition* pObjectWithinRadiusCondition2 = new ObjectWithinRadiusCondition (pShip, OT_station, 1010, 7000.0f);
  225. ConditionalAction* pConditionalAction = new ConditionalAction (new NotCondition (pObjectWithinRadiusCondition), pTurnToAction);
  226. ConditionalAction* pConditionalAction2 = new ConditionalAction (new AndCondition (new NotCondition (pObjectWithinRadiusCondition2), new ProxyCondition (pObjectWithinRadiusCondition)), new SetControlsAction);
  227. pGoal->AddConstraintCondition (pConditionalAction);
  228. pGoal->AddConstraintCondition (pConditionalAction2);
  229. // add the subgoals
  230. pGoalList->AddGoal (CreateGoal01 ());
  231. pGoalList->AddGoal (CreateGoal02 ());
  232. pGoalList->AddGoal (CreateGoal03 ());
  233. pGoalList->AddGoal (CreateGoal04 ());
  234. pGoalList->AddGoal (CreateGoal05 ());
  235. pGoalList->AddGoal (CreateGoal06 ());
  236. pGoalList->AddGoal (CreateGoal07 ());
  237. pGoalList->AddGoal (CreateGoal08 ());
  238. pGoalList->AddGoal (CreateGoal09 ());
  239. pGoalList->AddGoal (CreateGoal10 ());
  240. pGoalList->AddGoal (CreateGoal11 ());
  241. pGoalList->AddGoal (CreateGoal12 ());
  242. pGoalList->AddGoal (CreateGoal13 ());
  243. // return the goal
  244. return pGoal;
  245. }
  246. //------------------------------------------------------------------------------
  247. Condition* Mission3::CreateGotTargetCondition (void)
  248. {
  249. // generate the array of leaf conditions and fill it in
  250. Condition* pTargetCondition[TM_NUMBER_OF_DERELICTS];
  251. for (int i = 0; i < TM_NUMBER_OF_DERELICTS; i++)
  252. pTargetCondition[i] = new GetTargetCondition (trekClient.GetShip(), OT_ship, m_derelict_hulls[i]);
  253. // walk the array of leaf conditions pairing them using Or conditions
  254. Condition* pTmpCondition = pTargetCondition[0];
  255. for (i = 1; i < TM_NUMBER_OF_DERELICTS; i++)
  256. pTmpCondition = new OrCondition (pTmpCondition, pTargetCondition[i]);
  257. // return the last Or condition generated
  258. return pTmpCondition;
  259. }
  260. //------------------------------------------------------------------------------
  261. Goal* Mission3::CreateGoal01 (void)
  262. {
  263. GoalList* pGoalList = new GoalList;
  264. // play the introductory audio
  265. {
  266. Goal* pGoal = CreatePlaySoundGoal (salCommenceScanSound);
  267. SetControlConstraintsAction* pSetControlConstraintsAction = new SetControlConstraintsAction;
  268. pSetControlConstraintsAction->DisableInputAction (0xffffffff ^ selectedWeaponMaskIGC);
  269. pSetControlConstraintsAction->ScaleInputControl (c_axisYaw, 0.0f);
  270. pSetControlConstraintsAction->ScaleInputControl (c_axisPitch, 0.0f);
  271. pSetControlConstraintsAction->ScaleInputControl (c_axisRoll, 0.0f);
  272. pSetControlConstraintsAction->ScaleInputControl (c_axisThrottle, 0.0f);
  273. pGoal->AddStartAction (pSetControlConstraintsAction);
  274. pGoalList->AddGoal (pGoal);
  275. }
  276. // wait two seconds
  277. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (2.0f)));
  278. // tm_3_01
  279. // This ship is a fighter. It is well armed and has a moderate
  280. // scan range.
  281. pGoalList->AddGoal (CreatePlaySoundGoal (tm_3_01Sound));
  282. // wait one second, zoom into ship
  283. {
  284. Goal* pGoal = new Goal (new ElapsedTimeCondition (1.0f));
  285. pGoal->AddStartAction (new SetDisplayModeAction (TrekWindow::cmCockpit));
  286. pGoalList->AddGoal (pGoal);
  287. }
  288. // tm_3_02
  289. // In this mission, we're going to go over targeting with the
  290. // peripheral radar and the weapon systems carried by your
  291. // ships.
  292. pGoalList->AddGoal (CreatePlaySoundGoal (tm_3_02Sound));
  293. // wait half second
  294. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  295. // tm_3_03
  296. // As before, your controls will be disabled until I ask you
  297. // to do something, so listen carefully.
  298. pGoalList->AddGoal (CreatePlaySoundGoal (tm_3_03Sound));
  299. // wait half second
  300. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  301. return new Goal (pGoalList);
  302. }
  303. //------------------------------------------------------------------------------
  304. Goal* Mission3::CreateGoal02 (void)
  305. {
  306. GoalList* pGoalList = new GoalList;
  307. // tm_3_04
  308. // First, notice the two gauges in the center of your heads-up
  309. // display: the shield and armor gauges. These gauges indicate
  310. // the relative health of your craft.
  311. pGoalList->AddGoal (CreatePlaySoundGoal (tm_3_04Sound));
  312. // wait half second
  313. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  314. // tm_3_05
  315. // The shield gauge shows how much damage the shields can
  316. // absorb before you will start taking armor damage. Shields
  317. // can regenerate, so it's not a disaster if this gauge shows
  318. // that your shields are offline. When you take shield damage,
  319. // it will look like this.
  320. {
  321. Goal* pGoal = CreatePlaySoundGoal (tm_3_05Sound);
  322. pGoal->AddStartAction (new SetHUDOverlayAction (ShieldTrainingOverlay));
  323. pGoalList->AddGoal (pGoal);
  324. }
  325. // wait one second and show shield damage
  326. {
  327. Goal* pGoal = new Goal (new ElapsedTimeCondition (1.0f));
  328. pGoal->AddConstraintCondition (new ConditionalAction (new TrueCondition, new DoDamageAction (false)));
  329. pGoalList->AddGoal (pGoal);
  330. }
  331. // wait half second
  332. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  333. // tm_3_06
  334. // Now notice that the shield regenerates.
  335. pGoalList->AddGoal (CreatePlaySoundGoal (tm_3_06Sound));
  336. // wait four seconds
  337. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (4.0f)));
  338. // tm_3_07
  339. // The armor gauge shows how much more damage your ship hull
  340. // can withstand before breaking apart. If this gauge drops to
  341. // 0, you will explodeÿ. This is what it will look like when
  342. // you take armor damage.
  343. {
  344. Goal* pGoal = CreatePlaySoundGoal (tm_3_07Sound);
  345. pGoal->AddStartAction (new SetHUDOverlayAction (HullTrainingOverlay));
  346. pGoalList->AddGoal (pGoal);
  347. }
  348. // wait one second and show hull damage
  349. {
  350. Goal* pGoal = new Goal (new ElapsedTimeCondition (1.0f));
  351. pGoal->AddConstraintCondition (new ConditionalAction (new TrueCondition, new DoDamageAction (true)));
  352. pGoalList->AddGoal (pGoal);
  353. }
  354. // wait one and a half seconds
  355. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (1.5f)));
  356. // tm_3_08
  357. // Notice that the armor does not regenerate.
  358. pGoalList->AddGoal (CreatePlaySoundGoal (tm_3_08Sound));
  359. // wait half second
  360. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  361. // tm_3_09
  362. // If you're in a battle and you get damaged, try to return to
  363. // the nearest friendly station for repairs or search for a
  364. // shield and armor power-up.
  365. {
  366. Goal* pGoal = CreatePlaySoundGoal (tm_3_09Sound);
  367. pGoal->AddStartAction (new SetHUDOverlayAction (NoTrainingOverlay));
  368. pGoalList->AddGoal (pGoal);
  369. }
  370. // wait half second
  371. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  372. return new Goal (pGoalList);
  373. }
  374. //------------------------------------------------------------------------------
  375. Goal* Mission3::CreateGoal03 (void)
  376. {
  377. GoalList* pGoalList = new GoalList;
  378. // tm_3_10
  379. // There are a number of derelict hulls in this sector of
  380. // space. We'll use these for target practice.
  381. pGoalList->AddGoal (CreatePlaySoundGoal (tm_3_10Sound));
  382. // wait half second
  383. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  384. // tm_3_11
  385. // As your first introduction to targeting, you're going to
  386. // learn to target objects in front of the craft.
  387. pGoalList->AddGoal (CreatePlaySoundGoal (tm_3_11Sound));
  388. // wait half second
  389. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  390. // tm_3_11r
  391. // Press the C key to target objects nearest to the center of
  392. // your display.
  393. {
  394. Goal *pGoal = new Goal (CreateGotTargetCondition ());
  395. pGoal->AddStartAction (new MessageAction ("Press the C key to target the derelict hull nearest the center of your display."));
  396. pGoal->AddStartAction (new PlaySoundAction (tm_3_11rSound));
  397. pGoal->AddConstraintCondition (CreateTooLongCondition (30.0f, tm_3_11Sound));
  398. pGoalList->AddGoal (pGoal);
  399. }
  400. // wait half second
  401. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  402. // tm_3_12
  403. // Good! I'm enabling your flight controls now. Practice
  404. // turning and targeting the derelict hulls with the C key.
  405. {
  406. Goal* pGoal = CreatePlaySoundGoal (tm_3_12Sound);
  407. SetControlConstraintsAction* pSetControlConstraintsAction = new SetControlConstraintsAction;
  408. pSetControlConstraintsAction->ScaleInputControl (c_axisYaw, 1.0f);
  409. pSetControlConstraintsAction->ScaleInputControl (c_axisPitch, 1.0f);
  410. pSetControlConstraintsAction->ScaleInputControl (c_axisRoll, 1.0f);
  411. pGoal->AddStartAction (pSetControlConstraintsAction);
  412. pGoalList->AddGoal (pGoal);
  413. }
  414. // wait half second
  415. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  416. // tm_3_12r
  417. // When you are comfortable with targeting, press the SPACEBAR
  418. // to proceed.
  419. {
  420. Goal* pGoal = new Goal (new GetKeyCondition (TK_FireWeapon));
  421. pGoal->AddStartAction (new MessageAction ("Press the SPACEBAR when you are ready to proceed."));
  422. pGoal->AddStartAction (new PlaySoundAction (tm_3_12rSound));
  423. pGoal->AddConstraintCondition (CreateTooLongCondition (30.0f, tm_3_12rSound));
  424. pGoalList->AddGoal (pGoal);
  425. }
  426. // wait half second
  427. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  428. return new Goal (pGoalList);
  429. }
  430. //------------------------------------------------------------------------------
  431. Goal* Mission3::CreateGoal04 (void)
  432. {
  433. GoalList* pGoalList = new GoalList;
  434. // tm_3_13
  435. // All ships have a scan range, within which you can detect
  436. // the presence of other objects. Some ships, like the
  437. // interceptor we flew in the first mission, have a very poor
  438. // range. These ships are not very good in unexplored space
  439. // because an enemy can sneak up on them quite easily.
  440. // However, if a friendly ship can see something in its scan
  441. // range, you can too. It's always handy to have a scout or
  442. // two around when you're in uncharted regions, because they
  443. // have a very large scan range.
  444. pGoalList->AddGoal (CreatePlaySoundGoal (tm_3_13Sound));
  445. // wait half second
  446. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  447. // XXX target something if there isn't a target?
  448. // tm_3_14
  449. // Now examine the portion of your heads-up display that shows
  450. // a detail of the target. Notice that this area displays the
  451. // shield and armor strength of your target, as well as its
  452. // velocity and range.
  453. {
  454. Goal* pGoal = CreatePlaySoundGoal (tm_3_14Sound);
  455. pGoal->AddStartAction (new SetHUDOverlayAction (TargetTrainingOverlay));
  456. pGoalList->AddGoal (pGoal);
  457. }
  458. // wait half second
  459. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  460. // tm_3_15
  461. // Press the SPACEBAR when you are ready to proceed.
  462. {
  463. Goal* pGoal = new Goal (new GetKeyCondition (TK_FireWeapon));
  464. pGoal->AddStartAction (new MessageAction ("Press the SPACEBAR when you are ready to proceed."));
  465. pGoal->AddStartAction (new PlaySoundAction (tm_3_15Sound));
  466. pGoal->AddConstraintCondition (CreateTooLongCondition (30.0f, tm_3_15Sound));
  467. pGoalList->AddGoal (pGoal);
  468. }
  469. // wait half second
  470. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  471. return new Goal (pGoalList);
  472. }
  473. //------------------------------------------------------------------------------
  474. Goal* Mission3::CreateGoal05 (void)
  475. {
  476. GoalList* pGoalList = new GoalList;
  477. // tm_3_16
  478. // When you target an enemy craft, you will see an aiming
  479. // reticule in the center of your display. This reticule will
  480. // be green when you are in range and aiming at the target. If
  481. // you are not aiming correctly, or you are not in range, the
  482. // reticule will be gray. Your ship will now turn to show you
  483. // this effect.
  484. {
  485. Goal* pGoal = CreatePlaySoundGoal (tm_3_16Sound);
  486. pGoal->AddStartAction (new SetHUDOverlayAction (ReticuleTrainingOverlay));
  487. pGoalList->AddGoal (pGoal);
  488. }
  489. // wait half second
  490. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  491. // turn the craft until it lines up
  492. {
  493. ObjectPointingAtCondition* pObjectPointingAtCondition = new ObjectPointingAtCondition (static_cast<ImodelIGC*> (trekClient.GetShip ()), new CurrentTarget (new PlayerShipTarget));
  494. Goal* pGoal = new Goal (pObjectPointingAtCondition);
  495. pObjectPointingAtCondition->SetMinimumAngle (1.0f);
  496. TurnToAction* pTurnToAction = new TurnToAction (trekClient.GetShip (), new CurrentTarget (new PlayerShipTarget));
  497. ConditionalAction* pConditionalAction = new ConditionalAction (new TrueCondition, pTurnToAction);
  498. pGoal->AddConstraintCondition (pConditionalAction);
  499. pGoalList->AddGoal (pGoal);
  500. }
  501. // wait half second, and turn to the right
  502. {
  503. Goal* pGoal = new Goal (new ElapsedTimeCondition (0.5f));
  504. SetControlsAction* pSetControlsAction = new SetControlsAction;
  505. pSetControlsAction->SetInputControl (c_axisYaw, -0.5f);
  506. pGoal->AddStartAction (pSetControlsAction);
  507. pGoalList->AddGoal (pGoal);
  508. }
  509. // turn the craft until it lines up
  510. {
  511. ObjectPointingAtCondition* pObjectPointingAtCondition = new ObjectPointingAtCondition (static_cast<ImodelIGC*> (trekClient.GetShip ()), new CurrentTarget (new PlayerShipTarget));
  512. Goal* pGoal = new Goal (pObjectPointingAtCondition);
  513. pObjectPointingAtCondition->SetMinimumAngle (1.0f);
  514. TurnToAction* pTurnToAction = new TurnToAction (trekClient.GetShip (), new CurrentTarget (new PlayerShipTarget));
  515. ConditionalAction* pConditionalAction = new ConditionalAction (new TrueCondition, pTurnToAction);
  516. pGoal->AddConstraintCondition (pConditionalAction);
  517. pGoalList->AddGoal (pGoal);
  518. }
  519. // wait half second, and reset the controls
  520. {
  521. Goal* pGoal = new Goal (new ElapsedTimeCondition (0.5f));
  522. SetControlsAction* pSetControlsAction = new SetControlsAction;
  523. pGoal->AddStartAction (pSetControlsAction);
  524. pGoalList->AddGoal (pGoal);
  525. }
  526. // tm_3_17
  527. // Okay. There are basically three weapon types: weapons that
  528. // use energy, weapons that use ammunition, and missiles. Your
  529. // craft is currently armed with all three. To start with,
  530. // only the energy-based weapon is activated.
  531. {
  532. Goal* pGoal = CreatePlaySoundGoal (tm_3_17Sound);
  533. pGoal->AddStartAction (new SetHUDOverlayAction (NoTrainingOverlay));
  534. pGoalList->AddGoal (pGoal);
  535. }
  536. // wait half second
  537. {
  538. Goal* pGoal = new Goal (new ElapsedTimeCondition (0.5f));
  539. SetControlConstraintsAction* pSetControlConstraintsAction = new SetControlConstraintsAction;
  540. pSetControlConstraintsAction->EnableInputAction (weaponsMaskIGC);
  541. pGoal->AddStartAction (pSetControlConstraintsAction);
  542. pGoalList->AddGoal (pGoal);
  543. }
  544. // wait for weapons to fire
  545. {
  546. Goal* pGoal = new Goal (new GetStateBitsCondition (trekClient.GetShip(), weaponsMaskIGC));
  547. if (GetWindow ()->GetInputEngine ()->GetJoystickCount () > 0)
  548. {
  549. // tm_3_18
  550. // Press the trigger button on your joystick to fire your main
  551. // weapon.
  552. pGoal->AddStartAction (new PlaySoundAction (tm_3_18Sound));
  553. pGoal->AddConstraintCondition (CreateTooLongCondition (30.0f, tm_3_18Sound));
  554. pGoal->AddStartAction (new MessageAction ("Fire the main weapon by pressing the trigger button on your joystick."));
  555. }
  556. else
  557. {
  558. // tm_3_19
  559. // Press the SPACEBAR on the keyboard to fire your main weapon.
  560. pGoal->AddStartAction (new PlaySoundAction (tm_3_19Sound));
  561. pGoal->AddConstraintCondition (CreateTooLongCondition (30.0f, tm_3_19Sound));
  562. pGoal->AddStartAction (new MessageAction ("Fire the main weapon by pressing the SPACEBAR."));
  563. }
  564. pGoalList->AddGoal (pGoal);
  565. }
  566. // wait half second
  567. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  568. // tm_3_20
  569. // Good!
  570. pGoalList->AddGoal (CreatePlaySoundGoal (tm_3_20Sound));
  571. // wait half second
  572. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  573. return new Goal (pGoalList);
  574. }
  575. //------------------------------------------------------------------------------
  576. Goal* Mission3::CreateGoal06 (void)
  577. {
  578. GoalList* pGoalList = new GoalList;
  579. // tm_3_21
  580. // Notice the energy gauge on your heads-up display. This
  581. // gauge shows how much energy is available to power your gun.
  582. // As you fire, energy is used up. This gauge shows you how
  583. // much energy remains.
  584. {
  585. Goal* pGoal = CreatePlaySoundGoal (tm_3_21Sound);
  586. pGoal->AddStartAction (new SetHUDOverlayAction (EnergyTrainingOverlay));
  587. /*
  588. SetControlsAction* pSetControlsAction = new SetControlsAction;
  589. pSetControlsAction->SetInputAction (oneWeaponIGC);
  590. pGoal->AddStartAction (pSetControlsAction);
  591. */
  592. pGoalList->AddGoal (pGoal);
  593. }
  594. // wait half second
  595. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  596. // tm_3_22
  597. // One benefit of using energy-based weapons is that the
  598. // energy available to your ship will recharge. In effect, you
  599. // never run out.
  600. {
  601. Goal* pGoal = CreatePlaySoundGoal (tm_3_22Sound);
  602. /*
  603. SetControlsAction* pSetControlsAction = new SetControlsAction;
  604. pGoal->AddStartAction (pSetControlsAction);
  605. */
  606. pGoalList->AddGoal (pGoal);
  607. }
  608. // wait half second
  609. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  610. // tm_3_23
  611. // Notice how the shield and armor strength of your target are
  612. // affected.
  613. {
  614. Goal* pGoal = CreatePlaySoundGoal (tm_3_23Sound);
  615. pGoal->AddStartAction (new SetHUDOverlayAction (TargetTrainingOverlay));
  616. pGoalList->AddGoal (pGoal);
  617. }
  618. // wait half second
  619. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  620. // tm_3_23r
  621. // Keep firing until your target is destroyed.
  622. {
  623. Goal* pGoal = new Goal (new GetShipIsDestroyedCondition (new CurrentTarget (new PlayerShipTarget, true)));
  624. pGoal->AddStartAction (new MessageAction ("Destroy current target."));
  625. pGoal->AddStartAction (new PlaySoundAction (tm_3_23rSound));
  626. pGoal->AddConstraintCondition (CreateTooLongCondition (30.0f, tm_3_23rSound));
  627. pGoalList->AddGoal (pGoal);
  628. }
  629. // wait half second
  630. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  631. // tm_3_24
  632. // Great. As you can see, stationary objects are easy
  633. // pickings.
  634. {
  635. Goal* pGoal = CreatePlaySoundGoal (tm_3_24Sound);
  636. pGoal->AddStartAction (new SetHUDOverlayAction (NoTrainingOverlay));
  637. pGoalList->AddGoal (pGoal);
  638. }
  639. // wait half second
  640. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  641. return new Goal (pGoalList);
  642. }
  643. //------------------------------------------------------------------------------
  644. Goal* Mission3::CreateGoal07 (void)
  645. {
  646. GoalList* pGoalList = new GoalList;
  647. // tm_3_25
  648. // Notice that your radar has targeted another derelict hull.
  649. // Whenever an item that you have targeted goes away, the
  650. // radar will automatically target the next item of the same
  651. // type.
  652. pGoalList->AddGoal (CreatePlaySoundGoal (tm_3_25Sound));
  653. // wait half second
  654. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  655. // tm_3_26
  656. // You can selectively target the nearest friendly craft and
  657. // the nearest enemy craft. To target the nearest enemy, press
  658. // the E key. To target the nearest friendly object, press the
  659. // F key.
  660. pGoalList->AddGoal (CreatePlaySoundGoal (tm_3_26Sound));
  661. // wait half second
  662. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  663. // tm_3_27
  664. // Select a new target now using the E key.
  665. {
  666. Goal* pGoal = new Goal (new GetKeyCondition (TK_TargetEnemy));
  667. pGoal->AddStartAction (new MessageAction ("Target an enemy using the E key."));
  668. pGoal->AddStartAction (new PlaySoundAction (tm_3_27Sound));
  669. pGoal->AddConstraintCondition (CreateTooLongCondition (30.0f, tm_3_27Sound));
  670. pGoalList->AddGoal (pGoal);
  671. }
  672. // wait half second
  673. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  674. // tm_3_28
  675. // Notice your radar. The targeted object has a set of square
  676. // brackets around it, and there is a red arrow near the
  677. // center of your display that points at the target. You can
  678. // use this information to help you locate your target in
  679. // space.
  680. pGoalList->AddGoal (CreatePlaySoundGoal (tm_3_28Sound));
  681. // wait half second
  682. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  683. // tm_3_29
  684. // Turn to face your new target.
  685. {
  686. ObjectPointingAtCondition* pObjectPointingAtCondition = new ObjectPointingAtCondition (static_cast<ImodelIGC*> (trekClient.GetShip ()), new CurrentTarget (new PlayerShipTarget));
  687. Goal* pGoal = new Goal (pObjectPointingAtCondition);
  688. pGoal->AddStartAction (new PlaySoundAction (tm_3_29Sound));
  689. pGoal->AddConstraintCondition (CreateTooLongCondition (30.0f, tm_3_29Sound));
  690. pGoalList->AddGoal (pGoal);
  691. }
  692. // wait half second
  693. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  694. // tm_3_30
  695. // Excellent! You're getting the hang of this!
  696. pGoalList->AddGoal (CreatePlaySoundGoal (tm_3_30Sound));
  697. // wait half second
  698. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  699. return new Goal (pGoalList);
  700. }
  701. //------------------------------------------------------------------------------
  702. Goal* Mission3::CreateGoal08 (void)
  703. {
  704. GoalList* pGoalList = new GoalList;
  705. // tm_3_31
  706. // I am activating your machine gun now.
  707. {
  708. Goal* pGoal = CreatePlaySoundGoal (tm_3_31Sound);
  709. pGoal->AddStartAction (new ToggleWeaponAction (1));
  710. pGoalList->AddGoal (pGoal);
  711. }
  712. // wait half second
  713. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  714. // tm_3_31r
  715. // Go ahead and fire.
  716. {
  717. Goal* pGoal = new Goal (new GetStateBitsCondition (trekClient.GetShip(), weaponsMaskIGC));
  718. if (GetWindow ()->GetInputEngine ()->GetJoystickCount () > 0)
  719. pGoal->AddStartAction (new MessageAction ("Fire the main weapon by pressing the trigger button on your joystick."));
  720. else
  721. pGoal->AddStartAction (new MessageAction ("Fire the main weapon by pressing the SPACEBAR."));
  722. pGoal->AddStartAction (new PlaySoundAction (tm_3_31rSound));
  723. pGoal->AddConstraintCondition (CreateTooLongCondition (30.0f, tm_3_31rSound));
  724. pGoalList->AddGoal (pGoal);
  725. }
  726. // wait half second
  727. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  728. // tm_3_32
  729. // Good!
  730. pGoalList->AddGoal (CreatePlaySoundGoal (tm_3_32Sound));
  731. // wait half second
  732. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  733. // tm_3_33
  734. // The machine gun uses ammunition. This gauge shows how much
  735. // ammunition remains. Note that the ammunition is not
  736. // recharged until you land again, so watch your supply.
  737. {
  738. Goal* pGoal = CreatePlaySoundGoal (tm_3_33Sound);
  739. pGoal->AddStartAction (new SetHUDOverlayAction (AmmoTrainingOverlay));
  740. pGoalList->AddGoal (pGoal);
  741. }
  742. // wait half second
  743. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  744. // tm_3_34
  745. // Blow up your target with the machine guns.ÿ
  746. {
  747. Goal* pGoal = new Goal (new GetShipIsDestroyedCondition (new CurrentTarget (new PlayerShipTarget, true)));
  748. pGoal->AddStartAction (new MessageAction ("Destroy current target."));
  749. pGoal->AddStartAction (new PlaySoundAction (tm_3_34Sound));
  750. pGoal->AddConstraintCondition (CreateTooLongCondition (30.0f, tm_3_34Sound));
  751. pGoal->AddStartAction (new SetHUDOverlayAction (NoTrainingOverlay));
  752. pGoalList->AddGoal (pGoal);
  753. }
  754. // wait half second
  755. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  756. // tm_3_35
  757. // Now turn to face the next targeted derelict hull.
  758. {
  759. ObjectPointingAtCondition* pObjectPointingAtCondition = new ObjectPointingAtCondition (static_cast<ImodelIGC*> (trekClient.GetShip ()), new CurrentTarget (new PlayerShipTarget));
  760. Goal* pGoal = new Goal (pObjectPointingAtCondition);
  761. pGoal->AddStartAction (new PlaySoundAction (tm_3_35Sound));
  762. pGoal->AddConstraintCondition (CreateTooLongCondition (30.0f, tm_3_35Sound));
  763. pGoalList->AddGoal (pGoal);
  764. }
  765. // wait half second
  766. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  767. return new Goal (pGoalList);
  768. }
  769. //------------------------------------------------------------------------------
  770. Goal* Mission3::CreateGoal09 (void)
  771. {
  772. GoalList* pGoalList = new GoalList;
  773. // tm_3_36
  774. // Perfect! I'm going to load a missile launcher from cargo.
  775. // When the load is complete, you will see a new set of
  776. // brackets around this target. These brackets indicate the
  777. // quality of the lock you have on your target. When the lock
  778. // is perfect, you will hear a special sound. Missiles will
  779. // turn to follow targets when they have a lock, so you don't
  780. // need to shoot quite as straight.
  781. {
  782. Goal* pGoal = CreatePlaySoundGoal (tm_3_36Sound);
  783. pGoal->AddStartAction (new SwapWeaponAction (ET_Magazine, 0));
  784. pGoalList->AddGoal (pGoal);
  785. }
  786. // wait half second
  787. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  788. // wait for missilies to fire
  789. {
  790. Goal* pGoal = new Goal (new GetStateBitsCondition (trekClient.GetShip(), missileFireIGC));
  791. if (GetWindow ()->GetInputEngine ()->GetJoystickCount () > 0)
  792. {
  793. // tm_3_37
  794. // Fire your missiles by pressing button 2 on your joystick.
  795. pGoalList->AddGoal (CreatePlaySoundGoal (tm_3_37Sound));
  796. pGoal->AddStartAction (new MessageAction ("Fire missiles by pressing the #2 button on your joystick."));
  797. pGoal->AddConstraintCondition (CreateTooLongCondition (30.0f, tm_3_37Sound));
  798. }
  799. else
  800. {
  801. // tm_3_38
  802. // Fire your missiles by pressing CONTROL plus SPACEBAR on the
  803. // keyboard.
  804. pGoalList->AddGoal (CreatePlaySoundGoal (tm_3_38Sound));
  805. pGoal->AddStartAction (new MessageAction ("Fire missiles by pressing CTRL+SPACEBAR."));
  806. pGoal->AddConstraintCondition (CreateTooLongCondition (30.0f, tm_3_38Sound));
  807. }
  808. SetControlConstraintsAction* pSetControlConstraintsAction = new SetControlConstraintsAction;
  809. pSetControlConstraintsAction->EnableInputAction (missileFireIGC);
  810. pGoal->AddStartAction (pSetControlConstraintsAction);
  811. pGoalList->AddGoal (pGoal);
  812. }
  813. // wait half second
  814. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  815. // tm_3_39
  816. // Watch how these affect the target!
  817. pGoalList->AddGoal (CreatePlaySoundGoal (tm_3_39Sound));
  818. // wait half second
  819. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  820. // tm_3_23r
  821. // Keep firing until your target is destroyed.
  822. {
  823. Goal* pGoal = new Goal (new GetShipIsDestroyedCondition (new CurrentTarget (new PlayerShipTarget, true)));
  824. pGoal->AddStartAction (new MessageAction ("Destroy current target."));
  825. pGoal->AddStartAction (new PlaySoundAction (tm_3_23rSound));
  826. pGoal->AddConstraintCondition (CreateTooLongCondition (30.0f, tm_3_23rSound));
  827. pGoalList->AddGoal (pGoal);
  828. }
  829. // wait half second
  830. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  831. // tm_3_40
  832. // Good job.
  833. pGoalList->AddGoal (CreatePlaySoundGoal (tm_3_40Sound));
  834. // wait half second
  835. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  836. return new Goal (pGoalList);
  837. }
  838. //------------------------------------------------------------------------------
  839. Goal* Mission3::CreateGoal10 (void)
  840. {
  841. GoalList* pGoalList = new GoalList;
  842. // tm_3_41
  843. // This is the Inventory display. I?ve been using your
  844. // inventory controls to enable and disable weapons and to
  845. // load missiles from cargo. You can do this yourself by
  846. // pressing the corresponding number keys to enable or disable
  847. // the items and CONTROL plus the number keys to shift items
  848. // to and from cargo.
  849. {
  850. Goal* pGoal = CreatePlaySoundGoal (tm_3_41Sound);
  851. pGoal->AddStartAction (new ShowPaneAction (ofInventory));
  852. pGoal->AddStartAction (new SetHUDOverlayAction (InventoryTrainingOverlay));
  853. pGoalList->AddGoal (pGoal);
  854. }
  855. // wait half second
  856. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  857. // tm_3_42
  858. // Check that out and make sure you are comfortable with it.
  859. {
  860. Goal* pGoal = CreatePlaySoundGoal (tm_3_42Sound);
  861. pGoal->AddStartAction (new SetHUDOverlayAction (NoTrainingOverlay));
  862. pGoalList->AddGoal (pGoal);
  863. }
  864. // wait half second
  865. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  866. // tm_3_42r
  867. // Press the END key when you are ready to proceed.
  868. {
  869. Goal* pGoal = new Goal (new GetKeyCondition (TK_CommandFinishTM));
  870. pGoal->AddStartAction (new MessageAction ("Press the END key when you are comfortable with the Inventory Display."));
  871. pGoal->AddStartAction (new PlaySoundAction (tm_3_42rSound));
  872. pGoal->AddConstraintCondition (CreateTooLongCondition (30.0f, tm_3_42rSound));
  873. pGoalList->AddGoal (pGoal);
  874. }
  875. // wait half second
  876. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  877. // tm_3_43
  878. // One more thing you?ll need to know about is your craft?s
  879. // kill bonus.
  880. {
  881. Goal* pGoal = CreatePlaySoundGoal (tm_3_43Sound);
  882. pGoal->AddStartAction (new SetHUDOverlayAction (KillBonusTrainingOverlay));
  883. pGoalList->AddGoal (pGoal);
  884. }
  885. // wait half second
  886. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  887. // tm_3_44
  888. // This number represents the percentage of extra damage your
  889. // craft is doing against enemies. This number will increase
  890. // every time you get a kill but will drop back to 0 every
  891. // time you die.
  892. pGoalList->AddGoal (CreatePlaySoundGoal (tm_3_44Sound));
  893. // wait half second
  894. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  895. return new Goal (pGoalList);
  896. }
  897. //------------------------------------------------------------------------------
  898. Goal* Mission3::CreateGoal11 (void)
  899. {
  900. GoalList* pGoalList = new GoalList;
  901. // tm_3_45
  902. // You've done well, Cadet! Here?s a chance to put your
  903. // learning to the test ? I'm going to give you a full load of
  904. // ammo and missiles now and enable all your controls. Fly
  905. // around the derelicts and destroy them, use your targeting
  906. // keys, throttle, and missiles.
  907. {
  908. Goal* pGoal = CreatePlaySoundGoal (tm_3_45Sound);
  909. SetControlConstraintsAction* pSetControlConstraintsAction = new SetControlConstraintsAction;
  910. pSetControlConstraintsAction->EnableInputAction (0xffffffff);
  911. pSetControlConstraintsAction->ScaleInputControl (c_axisThrottle, 1.0f);
  912. pGoal->AddStartAction (new SetHUDOverlayAction (NoTrainingOverlay));
  913. pGoal->AddStartAction (pSetControlConstraintsAction);
  914. pGoal->AddStartAction (new ToggleWeaponAction (1));
  915. pGoal->AddStartAction (new RepairRearmAction);
  916. pGoalList->AddGoal (pGoal);
  917. }
  918. // wait half second
  919. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  920. // tm_3_46
  921. // When you are ready to go home, press the END key.
  922. {
  923. Goal* pGoal = new Goal (new GetKeyCondition (TK_CommandFinishTM));
  924. pGoal->AddStartAction (new MessageAction ("Press the END key when you are ready to go home."));
  925. pGoal->AddStartAction (new PlaySoundAction (tm_3_46Sound));
  926. pGoal->AddConstraintCondition (CreateTooLongCondition (120.0f, tm_3_46Sound));
  927. pGoalList->AddGoal (pGoal);
  928. }
  929. // wait half second
  930. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  931. return new Goal (pGoalList);
  932. }
  933. //------------------------------------------------------------------------------
  934. Goal* Mission3::CreateGoal12 (void)
  935. {
  936. GoalList* pGoalList = new GoalList;
  937. // tm_3_47
  938. // All right, you are going to land the ship yourself this
  939. // time, Cadet. Remember what I told you about landing in the
  940. // green bays.
  941. pGoalList->AddGoal (CreatePlaySoundGoal (tm_3_47Sound));
  942. // wait half second
  943. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  944. // tm_3_48
  945. // Press the B key to target your nearest base.
  946. {
  947. Goal* pGoal = new Goal (new GetTargetCondition (trekClient.GetShip(), OT_station, 1010));
  948. pGoal->AddStartAction (new MessageAction ("Press the B key to target the outpost."));
  949. pGoal->AddStartAction (new PlaySoundAction (tm_3_48Sound));
  950. pGoal->AddConstraintCondition (CreateTooLongCondition (30.0f, tm_3_48Sound));
  951. pGoalList->AddGoal (pGoal);
  952. }
  953. // wait half second
  954. pGoalList->AddGoal (new Goal (new ElapsedTimeCondition (0.5f)));
  955. return new Goal (pGoalList);
  956. }
  957. //------------------------------------------------------------------------------
  958. Goal* Mission3::CreateGoal13 (void)
  959. {
  960. GoalList* pGoalList = new GoalList;
  961. // tm_3_49
  962. // Good! Fly toward the base, and locate and land in a green
  963. // hangar. It might help if you fly close to the base, then
  964. // stop and line yourself up with the bay. That's how
  965. // autopilot works.
  966. pGoalList->AddGoal (CreatePlaySoundGoal (tm_3_49Sound));
  967. // tm_3_49r
  968. // Land the ship in a green hangar bay to complete the mission.
  969. {
  970. Goal* pGoal = new Goal (new FalseCondition);
  971. pGoal->AddStartAction (new MessageAction ("Land in a green hangar to complete the mission."));
  972. pGoal->AddConstraintCondition (CreateTooLongCondition (30.0f, tm_3_49rSound));
  973. pGoalList->AddGoal (pGoal);
  974. }
  975. return new Goal (pGoalList);
  976. }
  977. //------------------------------------------------------------------------------
  978. }