16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 15:09:19 +02:00

Merge branch 'tmj-dev' into dev

This commit is contained in:
milek7
2017-12-25 18:27:10 +01:00
65 changed files with 5288 additions and 4558 deletions

179
DynObj.h
View File

@@ -17,6 +17,7 @@ http://mozilla.org/MPL/2.0/.
#include "Button.h"
#include "AirCoupler.h"
#include "Texture.h"
#include "sound.h"
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
@@ -257,12 +258,62 @@ private:
TSubModel *smWiper; // wycieraczka (poniekąd też wajcha)
// Ra: koneic animacji do ogarnięcia
private:
void ABuLittleUpdate(double ObjSqrDist);
bool btnOn; // ABu: czy byly uzywane buttony, jesli tak, to po renderingu wylacz
// bo ten sam model moze byc jeszcze wykorzystany przez inny obiekt!
double ComputeRadius( Math3D::vector3 p1, Math3D::vector3 p2, Math3D::vector3 p3, Math3D::vector3 p4);
private:
// types
struct coupler_sounds {
sound_source dsbCouplerAttach { sound_placement::external }; // moved from cab
sound_source dsbCouplerDetach { sound_placement::external }; // moved from cab
sound_source dsbCouplerStretch { sound_placement::external }; // moved from cab
sound_source dsbBufferClamp { sound_placement::external }; // moved from cab
};
struct pantograph_sounds {
sound_source sPantUp { sound_placement::external };
sound_source sPantDown { sound_placement::external };
};
struct door_sounds {
sound_source rsDoorOpen { sound_placement::general, 25.f }; // Ra: przeniesione z kabiny
sound_source rsDoorClose { sound_placement::general, 25.f };
};
struct axle_sounds {
double distance; // distance to rail joint
double offset; // axle offset from centre of the vehicle
sound_source clatter; // clatter emitter
};
struct powertrain_sounds {
sound_source motor { sound_placement::external }; // generally traction motor
double motor_volume { 0.0 }; // MC: pomocnicze zeby gladziej silnik buczal
float motor_momentum { 0.f }; // recent change in motor revolutions
sound_source motor_relay { sound_placement::engine };
sound_source dsbWejscie_na_bezoporow { sound_placement::engine }; // moved from cab
sound_source motor_parallel { sound_placement::engine }; // moved from cab
sound_source rsWentylator { sound_placement::engine }; // McZapkie-030302
sound_source engine { sound_placement::engine }; // generally diesel engine
sound_source engine_ignition { sound_placement::engine }; // moved from cab
double engine_volume { 0.0 }; // MC: pomocnicze zeby gladziej silnik buczal
sound_source engine_revving { sound_placement::engine }; // youBy
float engine_revs_last { -1.f }; // helper, cached rpm of the engine
float engine_revs_change { 0.f }; // recent change in engine revolutions
sound_source engine_turbo { sound_placement::engine };
double engine_turbo_pitch { 1.0 };
sound_source transmission { sound_placement::engine };
sound_source rsEngageSlippery { sound_placement::engine }; // moved from cab
void position( glm::vec3 const Location );
void render( TMoverParameters const &Vehicle, double const Deltatime );
};
// methods
void ABuLittleUpdate(double ObjSqrDist);
double ComputeRadius( Math3D::vector3 p1, Math3D::vector3 p2, Math3D::vector3 p3, Math3D::vector3 p4);
void ABuBogies();
void ABuModelRoll();
void TurnOff();
// members
TButton btCoupler1; // sprzegi
TButton btCoupler2;
AirCoupler btCPneumatic1; // sprzegi powietrzne //yB - zmienione z Button na AirCoupler - krzyzyki
@@ -296,50 +347,67 @@ private:
TButton btHeadSignals23;
TButton btMechanik1;
TButton btMechanik2;
double enginevolume; // MC: pomocnicze zeby gladziej silnik buczal
int iAxles; // McZapkie: to potem mozna skasowac i zastapic iNumAxles
double dRailLength;
double dRailPosition[MaxAxles]; // licznik pozycji osi w/m szyny
double dWheelsPosition[MaxAxles]; // pozycja osi w/m srodka pojazdu
sound* rsStukot[MaxAxles] = { nullptr }; // dzwieki poszczegolnych osi //McZapkie-270202
sound* rsSilnik = nullptr; // McZapkie-010302 - silnik
sound* rsWentylator = nullptr; // McZapkie-030302
sound* rsPisk = nullptr; // McZapkie-260302
sound* rsDerailment = nullptr; // McZapkie-051202
sound* rsPrzekladnia = nullptr;
sound* sHorn1 = nullptr;
sound* sHorn2 = nullptr;
sound* sCompressor = nullptr; // NBMX wrzesien 2003
sound* sConverter = nullptr;
sound* sSmallCompressor = nullptr;
sound* sDepartureSignal = nullptr;
sound* sTurbo = nullptr;
sound* sSand = nullptr;
sound* sReleaser = nullptr;
// Winger 010304
sound* sPantUp = nullptr;
sound* sPantDown = nullptr;
sound* rsDoorOpen = nullptr; // Ra: przeniesione z kabiny
sound* rsDoorClose = nullptr;
// int iAxles; // McZapkie: to potem mozna skasowac i zastapic iNumAxles
double dRailLength { 0.0 };
std::vector<axle_sounds> m_axlesounds;
powertrain_sounds m_powertrainsounds;
// engine sounds
/*
sound_source dsbDieselIgnition { sound_placement::engine }; // moved from cab
sound_source rsSilnik { sound_placement::engine };
double enginevolume { 0.0 }; // MC: pomocnicze zeby gladziej silnik buczal
sound_source m_tractionmotor { sound_placement::external };
sound_source dsbRelay { sound_placement::engine };
sound_source dsbWejscie_na_bezoporow { sound_placement::engine }; // moved from cab
sound_source dsbWejscie_na_drugi_uklad { sound_placement::engine }; // moved from cab
sound_source rsPrzekladnia { sound_placement::engine };
sound_source rsEngageSlippery { sound_placement::engine }; // moved from cab
sound_source rsDieselInc { sound_placement::engine }; // youBy
float m_lastenginerevolutions { -1.f }; // helper, cached rpm of the engine
float m_enginerevolutionschange { 0.f }; // recent change of engine revolutions
sound_source sTurbo { sound_placement::engine };
sound_source rsWentylator { sound_placement::engine }; // McZapkie-030302
sound_source sConverter { sound_placement::engine };
sound_source sCompressor { sound_placement::engine }; // NBMX wrzesien 2003
sound_source sSmallCompressor { sound_placement::engine };
*/
sound_source sConverter { sound_placement::engine };
sound_source sCompressor { sound_placement::engine }; // NBMX wrzesien 2003
sound_source sSmallCompressor { sound_placement::engine };
// braking sounds
sound_source dsbPneumaticRelay { sound_placement::external };
sound_source rsUnbrake { sound_placement::external }; // yB - odglos luzowania
float m_lastbrakepressure { -1.f }; // helper, cached level of pressure in brake cylinder
float m_brakepressurechange { 0.f }; // recent change of pressure in brake cylinder
sound_source sReleaser { sound_placement::external };
sound_source rsSlippery { sound_placement::external, EU07_SOUND_BRAKINGCUTOFFRANGE }; // moved from cab
sound_source sSand { sound_placement::external };
sound_source rsBrake { sound_placement::external, EU07_SOUND_BRAKINGCUTOFFRANGE }; // moved from cab
sound_source sBrakeAcc { sound_placement::external };
bool bBrakeAcc;
sound_source rsPisk { sound_placement::external, EU07_SOUND_BRAKINGCUTOFFRANGE }; // McZapkie-260302
sound_source rsDerailment { sound_placement::external, 250.f }; // McZapkie-051202
// moving part and other external sounds
std::array<coupler_sounds, 2> m_couplersounds; // always front and rear
std::vector<pantograph_sounds> m_pantographsounds; // typically 2 but can be less (or more?)
std::vector<door_sounds> m_doorsounds; // can expect symmetrical arrangement, but don't count on it
sound_source sDepartureSignal { sound_placement::general };
sound_source sHorn1 { sound_placement::external, 5 * EU07_SOUND_RUNNINGNOISECUTOFFRANGE };
sound_source sHorn2 { sound_placement::external, 5 * EU07_SOUND_RUNNINGNOISECUTOFFRANGE };
sound_source rsOuterNoise { sound_placement::external, EU07_SOUND_RUNNINGNOISECUTOFFRANGE };
sound_source rscurve { sound_placement::external, EU07_SOUND_RUNNINGNOISECUTOFFRANGE }; // youBy
double eng_vol_act;
double eng_frq_act;
double eng_dfrq;
double eng_turbo;
void ABuBogies();
void ABuModelRoll();
Math3D::vector3 modelShake;
bool renderme; // yB - czy renderowac
// sound* sBrakeAcc; //dźwięk przyspieszacza
sound* sBrakeAcc = nullptr;
bool bBrakeAcc;
sound* rsUnbrake = nullptr; // yB - odglos luzowania
float ModCamRot;
int iInventory[ 2 ] { 0, 0 }; // flagi bitowe posiadanych submodeli (np. świateł)
void TurnOff();
bool btnOn; // ABu: czy byly uzywane buttony, jesli tak, to po renderingu wylacz
// bo ten sam model moze byc jeszcze wykorzystany przez inny obiekt!
public:
int iHornWarning; // numer syreny do użycia po otrzymaniu sygnału do jazdy
@@ -375,10 +443,10 @@ private:
void SetPneumatic(bool front, bool red);
std::string asName;
std::string name() const {
return this ? asName : std::string(); };
return this ?
asName :
std::string(); };
sound* rsDiesielInc = nullptr; // youBy
sound* rscurve = nullptr; // youBy
// std::ofstream PneuLogFile; //zapis parametrow pneumatycznych
// youBy - dym
// TSmoke Smog;
@@ -428,13 +496,17 @@ private:
inline Math3D::vector3 RearPosition() {
return vCoulpler[iDirection]; };
inline Math3D::vector3 AxlePositionGet() {
return iAxleFirst ? Axle1.pPosition : Axle0.pPosition; };
return iAxleFirst ?
Axle1.pPosition :
Axle0.pPosition; };
inline Math3D::vector3 VectorFront() const {
return vFront; };
inline Math3D::vector3 VectorUp() {
inline Math3D::vector3 VectorUp() const {
return vUp; };
inline Math3D::vector3 VectorLeft() const {
return vLeft; };
inline double const * Matrix() const {
return mMatrix.readArray(); };
inline double * Matrix() {
return mMatrix.getArray(); };
inline double GetVelocity() {
@@ -444,7 +516,9 @@ private:
inline double GetWidth() const {
return MoverParameters->Dim.W; };
inline TTrack * GetTrack() {
return (iAxleFirst ? Axle1.GetTrack() : Axle0.GetTrack()); };
return (iAxleFirst ?
Axle1.GetTrack() :
Axle0.GetTrack()); };
// McZapkie-260202
void LoadMMediaFile(std::string BaseDir, std::string TypeName, std::string ReplacableSkin);
@@ -453,13 +527,22 @@ private:
return (Axle1.GetTrack() == MyTrack ? Axle1.GetDirection() : Axle0.GetDirection()); };
// zwraca kierunek pojazdu na torze z aktywną osą
inline double RaDirectionGet() {
return iAxleFirst ? Axle1.GetDirection() : Axle0.GetDirection(); };
return iAxleFirst ?
Axle1.GetDirection() :
Axle0.GetDirection(); };
// zwraca przesunięcie wózka względem Point1 toru z aktywną osią
inline double RaTranslationGet() {
return iAxleFirst ? Axle1.GetTranslation() : Axle0.GetTranslation(); };
return iAxleFirst ?
Axle1.GetTranslation() :
Axle0.GetTranslation(); };
// zwraca tor z aktywną osią
inline TTrack * RaTrackGet() {
return iAxleFirst ? Axle1.GetTrack() : Axle0.GetTrack(); };
return iAxleFirst ?
Axle1.GetTrack() :
Axle0.GetTrack(); };
void couple( int const Side );
int uncouple( int const Side );
void CouplersDettach(double MinDist, int MyScanDir);
void RadioStop();
void Damage(char flag);