forked from eu07/maszyna
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTrain.h
398 lines (357 loc) · 12.4 KB
/
Train.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
#ifndef TrainH
#define TrainH
#include "Track.h"
#include "TrkFoll.h"
#include "Model3d.h"
#include "Spring.h"
#include "Gauge.h"
#include "Button.h"
#include "DynObj.h"
#include "mtable.hpp"
#include "Sound.h"
#include "AdvSound.h"
#include "RealSound.h"
#include "FadeSound.h"
// typedef enum {st_Off, st_Starting, st_On, st_ShuttingDown} T4State;
const int maxcab = 2;
// const double fCzuwakTime= 90.0f;
const double fCzuwakBlink = 0.15;
const float fConverterPrzekaznik = 1.5; // hunter-261211: do przekaznika nadmiarowego przetwornicy
// 0.33f
// const double fBuzzerTime= 5.0f;
const float fHaslerTime = 1.2;
// const double fStycznTime= 0.5f;
// const double fDblClickTime= 0.2f;
class TCab
{
public:
TCab();
~TCab();
void Init(double Initx1, double Inity1, double Initz1, double Initx2, double Inity2,
double Initz2, bool InitEnabled, bool InitOccupied);
void Load(TQueryParserComp *Parser);
vector3 CabPos1;
vector3 CabPos2;
bool bEnabled;
bool bOccupied;
double dimm_r, dimm_g, dimm_b; // McZapkie-120503: tlumienie swiatla
double intlit_r, intlit_g, intlit_b; // McZapkie-120503: oswietlenie kabiny
double intlitlow_r, intlitlow_g,
intlitlow_b; // McZapkie-120503: przyciemnione oswietlenie kabiny
private:
// bool bChangePossible;
TGauge *ggList; // Ra 2014-08: lista animacji macierzowych (ga貫k) w kabinie
int iGaugesMax, iGauges; // ile miejsca w tablicy i ile jest w u篡ciu
TButton *btList; // Ra 2014-08: lista animacji dwustanowych (lampek) w kabinie
int iButtonsMax, iButtons; // ile miejsca w tablicy i ile jest w u篡ciu
public:
TGauge *__fastcall Gauge(int n = -1); // pobranie adresu obiektu
TButton *__fastcall Button(int n = -1); // pobranie adresu obiektu
void Update();
};
class TTrain
{
public:
bool CabChange(int iDirection);
bool ActiveUniversal4;
bool ShowNextCurrent; // pokaz przd w podlaczonej lokomotywie (ET41)
bool InitializeCab(int NewCabNo, AnsiString asFileName);
TTrain();
~TTrain();
// bool Init(TTrack *Track);
// McZapkie-010302
bool Init(TDynamicObject *NewDynamicObject, bool e3d = false);
void OnKeyDown(int cKey);
void OnKeyUp(int cKey);
// bool SHP() { fShpTimer= 0; };
inline vector3 GetDirection()
{
return DynamicObject->VectorFront();
};
inline vector3 GetUp()
{
return DynamicObject->VectorUp();
};
void UpdateMechPosition(double dt);
bool Update();
void MechStop();
// virtual bool RenderAlpha();
// McZapkie-310302: ladowanie parametrow z pliku
bool LoadMMediaFile(AnsiString asFileName);
private: //瞠by go nic z zewn靖rz nie przestawia這
TDynamicObject *DynamicObject; // przestawia zmiana pojazdu [F5]
private: //瞠by go nic z zewn靖rz nie przestawia這
TMoverParameters *mvControlled; // cz這n, w kt鏎ym sterujemy silnikiem
TMoverParameters *mvOccupied; // cz這n, w kt鏎ym sterujemy hamulcem
TMoverParameters *mvSecond; // drugi cz這n (ET40, ET41, ET42, ukrotnienia)
TMoverParameters *mvThird; // trzeci cz這n (SN61)
public: // reszta mo瞠 by?publiczna
// AnsiString asMessage;
// McZapkie: definicje wskaik闚
// Ra 2014-08: cz瘰ciowo przeniesione do tablicy w TCab
TGauge ggZbS;
TGauge ggClockSInd;
TGauge ggClockMInd;
TGauge ggClockHInd;
// TGauge ggHVoltage;
TGauge ggLVoltage;
// TGauge ggEnrot1m;
// TGauge ggEnrot2m;
// TGauge ggEnrot3m;
// TGauge ggEngageRatio;
TGauge ggMainGearStatus;
TGauge ggEngineVoltage;
TGauge ggI1B; // drugi cz這n w postaci jawnej
TGauge ggI2B;
TGauge ggI3B;
TGauge ggItotalB;
// McZapkie: definicje regulatorow
TGauge ggMainCtrl;
TGauge ggMainCtrlAct;
TGauge ggScndCtrl;
TGauge ggScndCtrlButton;
TGauge ggDirKey;
TGauge ggBrakeCtrl;
TGauge ggLocalBrake;
TGauge ggManualBrake;
TGauge ggBrakeProfileCtrl; // nastawiacz GPR - przelacznik obrotowy
TGauge ggBrakeProfileG; // nastawiacz GP - hebelek towarowy
TGauge ggBrakeProfileR; // nastawiacz PR - hamowanie dwustopniowe
TGauge ggMaxCurrentCtrl;
TGauge ggMainOffButton;
TGauge ggMainOnButton;
TGauge ggMainButton; // EZT
TGauge ggSecurityResetButton;
TGauge ggReleaserButton;
TGauge ggAntiSlipButton;
TGauge ggFuseButton;
TGauge ggConverterFuseButton; // hunter-261211: przycisk odblokowania nadmiarowego przetwornic i
// ogrzewania
TGauge ggStLinOffButton;
TGauge ggRadioButton;
TGauge ggUpperLightButton;
TGauge ggLeftLightButton;
TGauge ggRightLightButton;
TGauge ggLeftEndLightButton;
TGauge ggRightEndLightButton;
// hunter-230112: przelacznik swiatel tylnich
TGauge ggRearUpperLightButton;
TGauge ggRearLeftLightButton;
TGauge ggRearRightLightButton;
TGauge ggRearLeftEndLightButton;
TGauge ggRearRightEndLightButton;
TGauge ggIgnitionKey;
TGauge ggCompressorButton;
TGauge ggConverterButton;
TGauge ggConverterOffButton;
// ABu 090305 - syrena i prad nastepnego czlonu
TGauge ggHornButton;
TGauge ggNextCurrentButton;
// ABu 090305 - uniwersalne przyciski
TGauge ggUniversal1Button;
TGauge ggUniversal2Button;
TGauge ggUniversal3Button;
TGauge ggUniversal4Button;
TGauge ggCabLightButton; // hunter-091012: przelacznik oswietlania kabiny
TGauge ggCabLightDimButton; // hunter-091012: przelacznik przyciemnienia oswietlenia kabiny
// NBMX wrzesien 2003 - obsluga drzwi
TGauge ggDoorLeftButton;
TGauge ggDoorRightButton;
TGauge ggDepartureSignalButton;
// Winger 160204 - obsluga pantografow - ZROBIC
TGauge ggPantFrontButton;
TGauge ggPantRearButton;
TGauge ggPantFrontButtonOff; // EZT
TGauge ggPantAllDownButton;
// Winger 020304 - wlacznik ogrzewania
TGauge ggTrainHeatingButton;
TGauge ggSignallingButton;
TGauge ggDoorSignallingButton;
// TModel3d *mdKabina; McZapkie-030303: to do dynobj
// TGauge ggDistCounter; //Ra 2014-07: licznik kilometr闚
// TGauge ggVelocityDgt; //i od razu pr璠koiomierz
TButton btLampkaPoslizg;
TButton btLampkaStyczn;
TButton btLampkaNadmPrzetw;
TButton btLampkaPrzetw;
TButton btLampkaPrzekRozn;
TButton btLampkaPrzekRoznPom;
TButton btLampkaNadmSil;
TButton btLampkaWylSzybki;
TButton btLampkaNadmWent;
TButton btLampkaNadmSpr;
// yB: drugie lampki dla EP05 i ET42
TButton btLampkaOporyB;
TButton btLampkaStycznB;
TButton btLampkaWylSzybkiB;
TButton btLampkaNadmPrzetwB;
TButton btLampkaPrzetwB;
// KURS90 lampki jazdy bezoporowej dla EU04
TButton btLampkaBezoporowaB;
TButton btLampkaBezoporowa;
TButton btLampkaUkrotnienie;
TButton btLampkaHamPosp;
TButton btLampkaRadio;
TButton btLampkaHamowanie1zes;
TButton btLampkaHamowanie2zes;
// TButton btLampkaUnknown;
TButton btLampkaOpory;
TButton btLampkaWysRozr;
TButton btLampkaUniversal3;
int LampkaUniversal3_typ; // ABu 030405 - swiecenie uzaleznione od: 0-nic, 1-obw.gl, 2-przetw.
bool LampkaUniversal3_st;
TButton btLampkaWentZaluzje; // ET22
TButton btLampkaOgrzewanieSkladu;
TButton btLampkaSHP;
TButton btLampkaCzuwaka; // McZapkie-141102
TButton btLampkaRezerwa;
// youBy - jakies dodatkowe lampki
TButton btLampkaNapNastHam;
TButton btLampkaSprezarka;
TButton btLampkaSprezarkaB;
TButton btLampkaBocznik1;
TButton btLampkaBocznik2;
TButton btLampkaBocznik3;
TButton btLampkaBocznik4;
TButton btLampkaRadiotelefon;
TButton btLampkaHamienie;
TButton btLampkaJazda; // Ra: nie u篡wane
// KURS90
TButton btLampkaBoczniki;
TButton btLampkaMaxSila;
TButton btLampkaPrzekrMaxSila;
// TButton bt;
//
TButton btLampkaDoorLeft;
TButton btLampkaDoorRight;
TButton btLampkaDepartureSignal;
TButton btLampkaBlokadaDrzwi;
TButton btLampkaHamulecReczny;
TButton btLampkaForward; // Ra: lampki w prz鏚 i w ty?dla komputerowych kabin
TButton btLampkaBackward;
TButton btCabLight; // hunter-171012: lampa oswietlajaca kabine
// Ra 2013-12: wirtualne "lampki" do odbijania na haslerze w PoKeys
TButton btHaslerBrakes; // ciienie w cylindrach
TButton btHaslerCurrent; // pr鉅 na silnikach
vector3 pPosition;
vector3 pMechOffset; // driverNpos
vector3 vMechMovement;
vector3 pMechPosition;
vector3 pMechShake;
vector3 vMechVelocity;
// McZapkie: do poruszania sie po kabinie
double fMechCroach;
// McZapkie: opis kabiny - obszar poruszania sie mechanika oraz zajetosc
TCab Cabine[maxcab + 1]; // przedzial maszynowy, kabina 1 (A), kabina 2 (B)
int iCabn;
TSpring MechSpring;
double fMechSpringX; // McZapkie-250303: parametry bujania
double fMechSpringY;
double fMechSpringZ;
double fMechMaxSpring;
double fMechRoll;
double fMechPitch;
PSound dsbNastawnikJazdy;
PSound dsbNastawnikBocz; // hunter-081211
PSound dsbRelay;
PSound dsbPneumaticRelay;
PSound dsbSwitch;
PSound dsbPneumaticSwitch;
PSound dsbReverserKey; // hunter-121211
PSound dsbCouplerAttach; // Ra: w kabinie????
PSound dsbCouplerDetach; // Ra: w kabinie???
PSound dsbDieselIgnition; // Ra: w kabinie???
PSound dsbDoorClose; // Ra: w kabinie???
PSound dsbDoorOpen; // Ra: w kabinie???
// Winger 010304
PSound dsbPantUp;
PSound dsbPantDown;
PSound dsbWejscie_na_bezoporow;
PSound dsbWejscie_na_drugi_uklad; // hunter-081211: poprawka literowki
// PSound dsbHiss1;
// PSound dsbHiss2;
// McZapkie-280302
TRealSound rsBrake;
TRealSound rsSlippery;
TRealSound rsHiss; // upuszczanie
TRealSound rsHissU; // napelnianie
TRealSound rsHissE; // nagle
TRealSound rsHissX; // fala
TRealSound rsHissT; // czasowy
TRealSound rsSBHiss;
TRealSound rsRunningNoise;
TRealSound rsEngageSlippery;
TRealSound rsFadeSound;
PSound dsbHasler;
PSound dsbBuzzer;
PSound dsbSlipAlarm; // Bombardier 011010: alarm przy poslizgu dla 181/182
// TFadeSound sConverter; //przetwornica
// TFadeSound sSmallCompressor; //przetwornica
int iCabLightFlag; // McZapkie:120503: oswietlenie kabiny (0: wyl, 1: przyciemnione, 2: pelne)
bool bCabLight; // hunter-091012: czy swiatlo jest zapalone?
bool bCabLightDim; // hunter-091012: czy przyciemnienie kabiny jest zapalone?
vector3 pMechSittingPosition; // ABu 180404
vector3 MirrorPosition(bool lewe);
private:
// PSound dsbBuzzer;
PSound dsbCouplerStretch;
PSound dsbEN57_CouplerStretch;
PSound dsbBufferClamp;
// TSubModel *smCzuwakShpOn;
// TSubModel *smCzuwakOn;
// TSubModel *smShpOn;
// TSubModel *smCzuwakShpOff;
// double fCzuwakTimer;
double fBlinkTimer;
float fHaslerTimer;
float fConverterTimer; // hunter-261211: dla przekaznika
float fMainRelayTimer; // hunter-141211: zalaczanie WSa z opoznieniem
float fCzuwakTestTimer; // hunter-091012: do testu czuwaka
int CAflag; // hunter-131211: dla osobnego zbijania CA i SHP
double fPoslizgTimer;
// double fShpTimer;
// double fDblClickTimer;
// ABu: Przeniesione do public. - Wiem, ze to nieladnie...
// bool CabChange(int iDirection);
// bool InitializeCab(int NewCabNo, AnsiString asFileName);
TTrack *tor;
int keybrakecount;
// McZapkie-240302 - przyda sie do tachometru
float fTachoVelocity;
float fTachoVelocityJump; // ze skakaniem
float fTachoTimer;
float fTachoCount;
float fHVoltage; // napi璚ie dla dynamicznych ga貫k
float fHCurrent[4]; // pr鉅y: suma i amperomierze 1,2,3
float fEngine[4]; // obroty te?trzeba pobra?
// McZapkie: do syczenia
float fPPress, fNPress;
float fSPPress, fSNPress;
int iSekunda; // Ra: sekunda aktualizacji pr璠koi
int iRadioChannel; // numer aktualnego kana逝 radiowego
public:
int RadioChannel()
{
return iRadioChannel;
};
inline TDynamicObject *__fastcall Dynamic()
{
return DynamicObject;
};
inline TMoverParameters *__fastcall Controlled()
{
return mvControlled;
};
void DynamicSet(TDynamicObject *d);
void Silence();
};
//---------------------------------------------------------------------------
#endif