mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
332 lines
13 KiB
C++
332 lines
13 KiB
C++
/*
|
||
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/.
|
||
*/
|
||
|
||
#pragma once
|
||
|
||
#include <string>
|
||
#include <Windows.h>
|
||
#include "opengl/glew.h"
|
||
#include "dumb3d.h"
|
||
|
||
// definicje klawiszy
|
||
const int k_IncMainCtrl = 0; //[Num+]
|
||
const int k_IncMainCtrlFAST = 1; //[Num+] [Shift]
|
||
const int k_DecMainCtrl = 2; //[Num-]
|
||
const int k_DecMainCtrlFAST = 3; //[Num-] [Shift]
|
||
const int k_IncScndCtrl = 4; //[Num/]
|
||
const int k_IncScndCtrlFAST = 5;
|
||
const int k_DecScndCtrl = 6;
|
||
const int k_DecScndCtrlFAST = 7;
|
||
const int k_IncLocalBrakeLevel = 8;
|
||
const int k_IncLocalBrakeLevelFAST = 9;
|
||
const int k_DecLocalBrakeLevel = 10;
|
||
const int k_DecLocalBrakeLevelFAST = 11;
|
||
const int k_IncBrakeLevel = 12;
|
||
const int k_DecBrakeLevel = 13;
|
||
const int k_Releaser = 14;
|
||
const int k_EmergencyBrake = 15;
|
||
const int k_Brake3 = 16;
|
||
const int k_Brake2 = 17;
|
||
const int k_Brake1 = 18;
|
||
const int k_Brake0 = 19;
|
||
const int k_WaveBrake = 20;
|
||
const int k_AntiSlipping = 21;
|
||
const int k_Sand = 22;
|
||
|
||
const int k_Main = 23;
|
||
const int k_DirectionForward = 24;
|
||
const int k_DirectionBackward = 25;
|
||
|
||
const int k_Fuse = 26;
|
||
const int k_Compressor = 27;
|
||
const int k_Converter = 28;
|
||
const int k_MaxCurrent = 29;
|
||
const int k_CurrentAutoRelay = 30;
|
||
const int k_BrakeProfile = 31;
|
||
|
||
const int k_Czuwak = 32;
|
||
const int k_Horn = 33;
|
||
const int k_Horn2 = 34;
|
||
|
||
const int k_FailedEngineCutOff = 35;
|
||
|
||
const int k_MechUp = 36;
|
||
const int k_MechDown = 37;
|
||
const int k_MechLeft = 38;
|
||
const int k_MechRight = 39;
|
||
const int k_MechForward = 40;
|
||
const int k_MechBackward = 41;
|
||
|
||
const int k_CabForward = 42;
|
||
const int k_CabBackward = 43;
|
||
|
||
const int k_Couple = 44;
|
||
const int k_DeCouple = 45;
|
||
|
||
const int k_ProgramQuit = 46;
|
||
// const int k_ProgramPause= 47;
|
||
const int k_ProgramHelp = 48;
|
||
// NBMX
|
||
const int k_OpenLeft = 49;
|
||
const int k_OpenRight = 50;
|
||
const int k_CloseLeft = 51;
|
||
const int k_CloseRight = 52;
|
||
const int k_DepartureSignal = 53;
|
||
// NBMX
|
||
const int k_PantFrontUp = 54;
|
||
const int k_PantRearUp = 55;
|
||
const int k_PantFrontDown = 56;
|
||
const int k_PantRearDown = 57;
|
||
|
||
const int k_Heating = 58;
|
||
|
||
// const int k_FreeFlyMode= 59;
|
||
|
||
const int k_LeftSign = 60;
|
||
const int k_UpperSign = 61;
|
||
const int k_RightSign = 62;
|
||
|
||
const int k_SmallCompressor = 63;
|
||
|
||
const int k_StLinOff = 64;
|
||
|
||
const int k_CurrentNext = 65;
|
||
|
||
const int k_Univ1 = 66;
|
||
const int k_Univ2 = 67;
|
||
const int k_Univ3 = 68;
|
||
const int k_Univ4 = 69;
|
||
const int k_EndSign = 70;
|
||
|
||
const int k_Active = 71;
|
||
// Winger 020304
|
||
const int k_Battery = 72;
|
||
const int k_WalkMode = 73;
|
||
const int MaxKeys = 74;
|
||
|
||
// klasy dla wska<6B>nik<69>w globalnych
|
||
class TGround;
|
||
class TWorld;
|
||
class TCamera;
|
||
class TDynamicObject;
|
||
class TAnimModel; // obiekt terenu
|
||
class cParser; // nowy (powolny!) parser
|
||
class TEvent;
|
||
class TTextSound;
|
||
|
||
class TTranscript
|
||
{ // klasa obs<62>uguj<75>ca linijk<6A> napisu do d<>wi<77>ku
|
||
public:
|
||
float fShow; // czas pokazania
|
||
float fHide; // czas ukrycia/usuni<6E>cia
|
||
std::string asText; // tekst gotowy do wy<77>wietlenia (usuni<6E>te znaczniki czasu)
|
||
bool bItalic; // czy kursywa (d<>wi<77>k nieistotny dla prowadz<64>cego)
|
||
int iNext; // nast<73>pna u<>ywana linijka, <20>eby nie przestawia<69> fizycznie tabeli
|
||
};
|
||
|
||
#define MAX_TRANSCRIPTS 30
|
||
class TTranscripts
|
||
{ // klasa obs<62>uguj<75>ca napisy do d<>wi<77>k<EFBFBD>w
|
||
TTranscript aLines[MAX_TRANSCRIPTS]; // pozycje na napisy do wy<77>wietlenia
|
||
int iCount; // liczba zaj<61>tych pozycji
|
||
int iStart; // pierwsza istotna pozycja w tabeli, <20>eby sortowa<77> przestawiaj<61>c numerki
|
||
float fRefreshTime;
|
||
|
||
public:
|
||
TTranscripts();
|
||
~TTranscripts();
|
||
void AddLine(char const *txt, float show, float hide, bool it);
|
||
void Add(char const *txt, float len,
|
||
bool backgorund = false); // dodanie tekst<73>w, d<>ugo<67><6F> d<>wi<77>ku, czy istotne
|
||
void Update(); // usuwanie niepotrzebnych (ok. 10 razy na sekund<6E>)
|
||
};
|
||
|
||
class Global
|
||
{
|
||
private:
|
||
static GLuint iTextureId; // ostatnio u<>yta tekstura 2D
|
||
public:
|
||
// double Global::tSinceStart;
|
||
static int Keys[MaxKeys];
|
||
static Math3D::vector3 pCameraPosition; // pozycja kamery w <20>wiecie
|
||
static double
|
||
pCameraRotation; // kierunek bezwzgl<67>dny kamery w <20>wiecie: 0=p<><70>noc, 90<39>=zach<63>d (-azymut)
|
||
static double pCameraRotationDeg; // w stopniach, dla animacji billboard
|
||
static Math3D::vector3 pFreeCameraInit[ 10 ]; // pozycje kamery
|
||
static Math3D::vector3 pFreeCameraInitAngle[ 10 ];
|
||
static int iWindowWidth;
|
||
static int iWindowHeight;
|
||
static float fDistanceFactor;
|
||
static int iBpp;
|
||
static bool bFullScreen;
|
||
static bool bFreeFly;
|
||
// float RunningTime;
|
||
static bool bWireFrame;
|
||
static bool bSoundEnabled;
|
||
// McZapkie-131202
|
||
// static bool bRenderAlpha;
|
||
static bool bAdjustScreenFreq;
|
||
static bool bEnableTraction;
|
||
static bool bLoadTraction;
|
||
static float fFriction;
|
||
static bool bLiveTraction;
|
||
static bool bManageNodes;
|
||
static bool bDecompressDDS;
|
||
// bool WFreeFly;
|
||
static float Global::fMouseXScale;
|
||
static float Global::fMouseYScale;
|
||
static double fFogStart;
|
||
static double fFogEnd;
|
||
static TGround *pGround;
|
||
static char **szDefaultExt;
|
||
static std::string SceneryFile;
|
||
static char CreatorName1[20];
|
||
static char CreatorName2[20];
|
||
static char CreatorName3[20];
|
||
static char CreatorName4[30];
|
||
static char CreatorName5[30];
|
||
static std::string asCurrentSceneryPath;
|
||
static std::string asCurrentTexturePath;
|
||
static std::string asCurrentDynamicPath;
|
||
// McZapkie-170602: zewnetrzna definicja pojazdu uzytkownika
|
||
static std::string asHumanCtrlVehicle;
|
||
static void LoadIniFile(std::string asFileName);
|
||
static void InitKeys(std::string asFileName);
|
||
inline static Math3D::vector3 GetCameraPosition()
|
||
{
|
||
return pCameraPosition;
|
||
};
|
||
static void SetCameraPosition(Math3D::vector3 pNewCameraPosition);
|
||
static void SetCameraRotation(double Yaw);
|
||
static int iWriteLogEnabled; // maska bitowa: 1-zapis do pliku, 2-okienko
|
||
// McZapkie-221002: definicja swiatla dziennego
|
||
static float Background[3];
|
||
static GLfloat AtmoColor[];
|
||
static GLfloat FogColor[];
|
||
// static bool bTimeChange;
|
||
static GLfloat ambientDayLight[];
|
||
static GLfloat diffuseDayLight[];
|
||
static GLfloat specularDayLight[];
|
||
static GLfloat ambientLight[];
|
||
static GLfloat diffuseLight[];
|
||
static GLfloat specularLight[];
|
||
static GLfloat whiteLight[];
|
||
static GLfloat noLight[];
|
||
static GLfloat darkLight[];
|
||
static GLfloat lightPos[4];
|
||
static int iSlowMotion;
|
||
static TDynamicObject *changeDynObj;
|
||
static double ABuDebug;
|
||
static bool detonatoryOK;
|
||
static std::string asSky;
|
||
static bool bnewAirCouplers;
|
||
// Ra: nowe zmienne globalne
|
||
static int iDefaultFiltering; // domy<6D>lne rozmywanie tekstur TGA
|
||
static int iBallastFiltering; // domy<6D>lne rozmywanie tekstury podsypki
|
||
static int iRailProFiltering; // domy<6D>lne rozmywanie tekstury szyn
|
||
static int iDynamicFiltering; // domy<6D>lne rozmywanie tekstur pojazd<7A>w
|
||
static int iReCompile; // zwi<77>kszany, gdy trzeba od<6F>wie<69>y<EFBFBD> siatki
|
||
static bool bUseVBO; // czy jest VBO w karcie graficznej
|
||
static int iFeedbackMode; // tryb pracy informacji zwrotnej
|
||
static int iFeedbackPort; // dodatkowy adres dla informacji zwrotnych
|
||
static double fOpenGL; // wersja OpenGL - przyda si<73>
|
||
static bool bOpenGL_1_5; // czy s<> dost<73>pne funkcje OpenGL 1.5
|
||
static double fLuminance; // jasno<6E><6F> <20>wiat<61>a do automatycznego zapalania
|
||
static int iMultiplayer; // blokada dzia<69>ania niekt<6B>rych event<6E>w na rzecz kominikacji
|
||
static HWND hWnd; // uchwyt okna
|
||
static int iCameraLast;
|
||
static std::string asRelease; // numer
|
||
static std::string asVersion; // z opisem
|
||
static int
|
||
iViewMode; // co aktualnie wida<64>: 0-kabina, 1-latanie, 2-sprz<72>gi, 3-dokumenty, 4-obwody
|
||
static GLint iMaxTextureSize; // maksymalny rozmiar tekstury
|
||
static int iTextMode; // tryb pracy wy<77>wietlacza tekstowego
|
||
static int iScreenMode[12]; // numer ekranu wy<77>wietlacza tekstowego
|
||
static bool bDoubleAmbient; // podw<64>jna jasno<6E><6F> ambient
|
||
static double fMoveLight; // numer dnia w roku albo -1
|
||
static bool bSmoothTraction; // wyg<79>adzanie drut<75>w
|
||
static double fSunDeclination; // deklinacja S<>o<EFBFBD>ca
|
||
static double fTimeSpeed; // przyspieszenie czasu, zmienna do test<73>w
|
||
static double fTimeAngleDeg; // godzina w postaci k<>ta
|
||
static float fClockAngleDeg[6]; // k<>ty obrotu cylindr<64>w dla zegara cyfrowego
|
||
static double fLatitudeDeg; // szeroko<6B><6F> geograficzna
|
||
static char *szTexturesTGA[4]; // lista tekstur od TGA
|
||
static char *szTexturesDDS[4]; // lista tekstur od DDS
|
||
static int iMultisampling; // tryb antyaliasingu: 0=brak,1=2px,2=4px,3=8px,4=16px
|
||
static bool bGlutFont; // tekst generowany przez GLUT
|
||
static int iKeyLast; // ostatnio naci<63>ni<6E>ty klawisz w celu logowania
|
||
static int iPause; // globalna pauza ruchu: b0=start,b1=klawisz,b2=t<>o,b3=lagi,b4=wczytywanie
|
||
static bool bActive; // czy jest aktywnym oknem
|
||
static void BindTexture(GLuint t);
|
||
static int iConvertModels; // tworzenie plik<69>w binarnych
|
||
static int iErorrCounter; // licznik sprawdza<7A> do <20>ledzenia b<><62>d<EFBFBD>w OpenGL
|
||
static bool bInactivePause; // automatyczna pauza, gdy okno nieaktywne
|
||
static int iTextures; // licznik u<>ytych tekstur
|
||
static int iSlowMotionMask; // maska wy<77><79>czanych w<>a<EFBFBD>ciwo<77>ci
|
||
static int iModifyTGA; // czy korygowa<77> pliki TGA dla szybszego wczytywania
|
||
static bool bHideConsole; // hunter-271211: ukrywanie konsoli
|
||
static bool bOldSmudge; // U<>ywanie starej smugi
|
||
|
||
static TWorld *pWorld; // wska<6B>nik na <20>wiat do usuwania pojazd<7A>w
|
||
static TAnimModel *pTerrainCompact; // obiekt terenu do ewentualnego zapisania w pliku
|
||
static std::string asTerrainModel; // nazwa obiektu terenu do zapisania w pliku
|
||
static bool bRollFix; // czy wykona<6E> przeliczanie przechy<68>ki
|
||
static cParser *pParser;
|
||
static int iSegmentsRendered; // ilo<6C><6F> segment<6E>w do regulacji wydajno<6E>ci
|
||
static double fFpsAverage; // oczekiwana wartos<6F> FPS
|
||
static double fFpsDeviation; // odchylenie standardowe FPS
|
||
static double fFpsMin; // dolna granica FPS, przy kt<6B>rej promie<69> scenerii b<>dzie zmniejszany
|
||
static double fFpsMax; // g<>rna granica FPS, przy kt<6B>rej promie<69> scenerii b<>dzie zwi<77>kszany
|
||
static double fFpsRadiusMax; // maksymalny promie<69> renderowania
|
||
static int iFpsRadiusMax; // maksymalny promie<69> renderowania w rozmiarze tabeli sektor<6F>w
|
||
static double fRadiusFactor; // wsp<73><70>czynnik zmiany promienia
|
||
static TCamera *pCamera; // parametry kamery
|
||
static TDynamicObject *pUserDynamic; // pojazd u<>ytkownika, renderowany bez trz<72>sienia
|
||
static double fCalibrateIn[6][6]; // parametry kalibracyjne wej<65><6A> z pulpitu
|
||
static double fCalibrateOut[7][6]; // parametry kalibracyjne wyj<79><6A> dla pulpitu
|
||
static double fCalibrateOutMax[7]; // warto<74>ci maksymalne wyj<79><6A> dla pulpitu
|
||
static int iCalibrateOutDebugInfo; // numer wyj<79>cia kalibrowanego dla kt<6B>rego wy<77>wietla<6C>
|
||
// informacje podczas kalibracji
|
||
static double fBrakeStep; // krok zmiany hamulca dla klawiszy [Num3] i [Num9]
|
||
static bool bJoinEvents; // czy grupowa<77> eventy o tych samych nazwach
|
||
static bool bSmudge; // czy wy<77>wietla<6C> smug<75>, a pojazd u<>ytkownika na ko<6B>cu
|
||
static std::string asTranscript[5]; // napisy na ekranie (widoczne)
|
||
static TTranscripts tranTexts; // obiekt obs<62>uguj<75>cy stenogramy d<>wi<77>k<EFBFBD>w na ekranie
|
||
static std::string asLang; // domy<6D>lny j<>zyk - http://tools.ietf.org/html/bcp47
|
||
static int iHiddenEvents; // czy <20><>czy<7A> eventy z torami poprzez nazw<7A> toru
|
||
static TTextSound *tsRadioBusy[10]; // zaj<61>to<74><6F> kana<6E><61>w radiowych (wska<6B>nik na odgrywany d<>wi<77>k)
|
||
static int iPoKeysPWM[7]; // numery wej<65><6A> dla PWM
|
||
|
||
// metody
|
||
static void TrainDelete(TDynamicObject *d);
|
||
static void ConfigParse(cParser &parser);
|
||
static std::string GetNextSymbol();
|
||
static TDynamicObject * DynamicNearest();
|
||
static TDynamicObject * CouplerNearest();
|
||
static bool AddToQuery(TEvent *event, TDynamicObject *who);
|
||
static bool DoEvents();
|
||
static std::string Bezogonkow(std::string str, bool _ = false);
|
||
static double Min0RSpeed(double vel1, double vel2);
|
||
static double CutValueToRange(double min, double value, double max);
|
||
|
||
// maciek001: zmienne dla MWD
|
||
static bool bMWDdebugEnable;
|
||
static unsigned int iMWDBaudrate;
|
||
static std::string sMWDPortId;
|
||
static bool bMWDBreakEnable;
|
||
static bool bMWDInputDataEnable;
|
||
static double fMWDAnalogCalib[4][3];
|
||
static double fMWDzg[2];
|
||
static double fMWDpg[2];
|
||
static double fMWDph[2];
|
||
static double fMWDvolt[2];
|
||
static double fMWDamp[2];
|
||
};
|
||
//---------------------------------------------------------------------------
|