Rise
The Vieneo Province
VMU.cpp
Go to the documentation of this file.
1 #include "Module.h"
2 
3 void Vmu::FrameMove(float fElapsed)
4 {
5  if (!sound)
6  return;
7 
8  if (!powered)
9  {
10  if (ourcockpit.power > 0.5f)
11  {
12  secondsPowered += fElapsed;
13  if (secondsPowered >= 2.0f)
14  {
15  powered = true;
17  }
18  }
19  }
20  else
21  {
22  if (ourcockpit.power <= 0.5f)
23  {
24  powered = false;
25  secondsPowered = 0.0f;
26  }
27  }
28 
29  if (!powered)
30  return;
31 
32  holdForSeconds -= fElapsed;
33  if (holdForSeconds > 0.0f)
34  return;
35 
37  {
38  holdForSeconds = sound->Play(testMode++) + 0.5f;
39  return;
40  }
41 
42  // so we have one-shot aural response like "priority pilot"
43  // we have ongoing aural warnings like "dual input" based on a bus value
44  // we also have ongoing warnings added from GPWS like "pull up" and "stall" from the FCS (these could be bus conditions)
45  // I feel like we need a priority for each command... and that dictates who gets shit-canned and what gets played
46  // more advanced than the real aircraft because GPWS aural priority and TCAS aural priorities are independent and CAN play simultaneously
47  // sort by priority should be done on the bus?
48  for (UINT i = 0; i < bus->commandStream.size(); i++)
49  {
50  const Command command = bus->commandStream.at(i);
51  if (command.delay > 0) continue;
52 
53  bool erase = true;
54  if (command.name == "VMUTest")
55  {
58  else
60  }
61  if (command.name == "CASConfigBrake")
63  else if (command.name == "CASConfigAF")
65  else if (command.name == "CASConfigFlaps")
67  else if (command.name == "CASConfigTrim")
69  else if (command.name == "CASCabinPressure")
71  else if (command.name == "GPWSPullUp")
73  else if (command.name == "GPWSTerrainTerrain")
75  else if (command.name == "GPWSTooLowTerrain")
77  else if (command.name == "GPWSTooLowGear")
79  else if (command.name == "GPWSTooLowFlaps")
81  else if (command.name == "GPWSSinkRate")
83  else if (command.name == "GPWSBankAngle")
85  else if (command.name == "GPWSGlideslope")
87  else if (command.name == "GPWSMode6Retard")
89  else if (command.name == "GPWSMode6Ten")
91  else if (command.name == "GPWSMode6Twenty")
93  else if (command.name == "GPWSMode6Thirty")
95  else if (command.name == "GPWSMode6Forty")
97  else if (command.name == "GPWSMode6Fifty")
99  else if (command.name == "GPWSMode6OneHundred")
101  else if (command.name == "GPWSMode6TwoHundred")
103  else if (command.name == "GPWSMode6Minimums")
105  else if (command.name == "GPWSMode6PositiveRate")
107  else if (command.name == "GPWSMode6FiveHundred")
109  else if (command.name == "GPWSMode6OneThousand")
111  else if (command.name == "GPWSMode6Rotate")
113  else if (command.name == "GPWSMode3DontSink")
115  else if (command.name == "GPWSMode7WindshearWarning")
117  else if (command.name == "GPWSMode7WindshearCaution")
119  else if (command.name == "AuralScannerSync")
121  else if (command.name == "AuralSoundBarrier")
123  else if (command.name == "AuralHullIonization")
125  else if (command.name == "AuralGearUp")
127  else if (command.name == "AuralGearDown")
129  else if (command.name == "AuralAllMooringsCleared")
131  else if (command.name == "AuralCargoBay")
133  else if (command.name == "TCASClear")
135  else if (command.name == "TCASTraffic")
137  else if (command.name == "TCASClimb")
139  else if (command.name == "TCASDescend")
141  else if (command.name == "TCASMonitor")
143  else if (command.name == "AuralStall")
145  else if (command.name == "AuralAOA")
147  else if (command.name == "AuralLightOn")
149  else if (command.name == "AuralLightOff")
151  else if (command.name == "AuralLowFuel")
153  else if (command.name == "AuralOverspeed")
155  else
156  erase = false;
157  if (erase)
158  {
159  bus->commandStream.erase(bus->commandStream.begin() + i);
160  break;
161  }
162  }
163 }
164 
165 Vmu::Vmu(Bus* prmBus, Logger* prmLogger, Sound* prmSound) : Module(prmBus)
166 {
167  logger = prmLogger;
168  sound = prmSound;
169 }
Scockpit ourcockpit
Definition: globals.cpp:176
float power
Definition: globals.h:608
Definition: Sound.h:276
std::vector< Command > commandStream
Definition: Bus.h:342
Sound * sound
Definition: Module.h:69
Definition: Logger.h:9
bool powered
Definition: Module.h:72
void FrameMove(float fElapsedTime) override
Definition: VMU.cpp:3
Logger * logger
Definition: Module.h:68
Definition: Bus.h:16
std::string name
Definition: Command.h:11
float holdForSeconds
Definition: Module.h:71
Definition: Module.h:12
Definition: Command.h:5
Vmu(Bus *prmBus, Logger *prmLogger, Sound *prmSound)
Definition: VMU.cpp:165
Bus * bus
Definition: Module.h:17
float secondsPowered
Definition: Module.h:73
float Play(int soundEnum)
Definition: Sound.cpp:577
int testMode
Definition: Module.h:74
float delay
Definition: Command.h:8