mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
Merged branch mover_in_c++ into master
This commit is contained in:
@@ -477,7 +477,8 @@ float Console::AnalogCalibrateGet(int x)
|
||||
b = (b - Global::fMWDAnalogInCalib[x][0]) / (Global::fMWDAnalogInCalib[x][1] - Global::fMWDAnalogInCalib[x][0]);
|
||||
switch (x)
|
||||
{
|
||||
case 0: return (b * 8 - 2);
|
||||
case 0: if (Global::bMWDdebugEnable && Global::iMWDDebugMode & 4) WriteLog("Pozycja kranu = " + to_string(b * 8 - 2));
|
||||
return (b * 8 - 2);
|
||||
break;
|
||||
case 1: return (b * 10);
|
||||
break;
|
||||
|
||||
@@ -29,8 +29,8 @@ TMWDComm::TMWDComm() // konstruktor
|
||||
MWDTime = 0;
|
||||
bSHPstate = false;
|
||||
bPrzejazdSHP = false;
|
||||
bKabina1 = true; // pasuje wyciągnąć dane na temat kabiny i ustawiać te dwa parametry!
|
||||
bKabina2 = false;
|
||||
bKabina1 = true; // pasuje wyciągnąć dane na temat kabiny
|
||||
bKabina2 = false; // i ustawiać te dwa parametry!
|
||||
bHamowanie = false;
|
||||
bCzuwak = false;
|
||||
|
||||
|
||||
@@ -1171,6 +1171,10 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
||||
iDrivigFlags |= moveSemaphorFound; //jeśli z przodu to dajemy falgę, że jest
|
||||
d_to_next_sem = Min0R(sSpeedTable[i].fDist, d_to_next_sem);
|
||||
}
|
||||
if( sSpeedTable[ i ].fDist <= d_to_next_sem )
|
||||
{
|
||||
VelSignalNext = sSpeedTable[ i ].fVelNext;
|
||||
}
|
||||
}
|
||||
else if (sSpeedTable[i].iFlags & spRoadVel)
|
||||
{ // to W6
|
||||
|
||||
28
DynObj.cpp
28
DynObj.cpp
@@ -3100,7 +3100,11 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
dDOMoveLen =
|
||||
GetdMoveLen() + MoverParameters->ComputeMovement(dt, dt1, ts, tp, tmpTraction, l, r);
|
||||
// yB: zeby zawsze wrzucalo w jedna strone zakretu
|
||||
/*
|
||||
// this seemed to have opposite effect, if anything -- the sway direction would be affected
|
||||
// by the 'direction' of the track, making the sway go sometimes inward, sometimes outward
|
||||
MoverParameters->AccN *= -ABuGetDirection();
|
||||
*/
|
||||
// if (dDOMoveLen!=0.0) //Ra: nie może być, bo blokuje Event0
|
||||
Move(dDOMoveLen);
|
||||
if (!bEnabled) // usuwane pojazdy nie mają toru
|
||||
@@ -3530,24 +3534,24 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
// NBMX Obsluga drzwi, MC: zuniwersalnione
|
||||
if ((dDoorMoveL < MoverParameters->DoorMaxShiftL) && (MoverParameters->DoorLeftOpened))
|
||||
{
|
||||
rsDoorOpen.Play(vol, 0, MechInside, vPosition);
|
||||
rsDoorOpen.Play(1, 0, MechInside, vPosition);
|
||||
dDoorMoveL += dt1 * 0.5 * MoverParameters->DoorOpenSpeed;
|
||||
}
|
||||
if ((dDoorMoveL > 0) && (!MoverParameters->DoorLeftOpened))
|
||||
{
|
||||
rsDoorClose.Play(vol, 0, MechInside, vPosition);
|
||||
rsDoorClose.Play(1, 0, MechInside, vPosition);
|
||||
dDoorMoveL -= dt1 * MoverParameters->DoorCloseSpeed;
|
||||
if (dDoorMoveL < 0)
|
||||
dDoorMoveL = 0;
|
||||
}
|
||||
if ((dDoorMoveR < MoverParameters->DoorMaxShiftR) && (MoverParameters->DoorRightOpened))
|
||||
{
|
||||
rsDoorOpen.Play(vol, 0, MechInside, vPosition);
|
||||
rsDoorOpen.Play(1, 0, MechInside, vPosition);
|
||||
dDoorMoveR += dt1 * 0.5 * MoverParameters->DoorOpenSpeed;
|
||||
}
|
||||
if ((dDoorMoveR > 0) && (!MoverParameters->DoorRightOpened))
|
||||
{
|
||||
rsDoorClose.Play(vol, 0, MechInside, vPosition);
|
||||
rsDoorClose.Play(1, 0, MechInside, vPosition);
|
||||
dDoorMoveR -= dt1 * MoverParameters->DoorCloseSpeed;
|
||||
if (dDoorMoveR < 0)
|
||||
dDoorMoveR = 0;
|
||||
@@ -5357,10 +5361,6 @@ void TDynamicObject::LoadMMediaFile(std::string BaseDir, std::string TypeName,
|
||||
token, 50,
|
||||
GetPosition().x, GetPosition().y, GetPosition().z,
|
||||
true );
|
||||
sPantUp.AM = 50000;
|
||||
sPantUp.AA = -1 * ( 105 - Random( 10 ) ) / 100;
|
||||
sPantUp.FM = 1.0;
|
||||
sPantUp.FA = 0.0;
|
||||
}
|
||||
|
||||
else if( token == "pantographdown:" ) {
|
||||
@@ -5370,10 +5370,6 @@ void TDynamicObject::LoadMMediaFile(std::string BaseDir, std::string TypeName,
|
||||
token, 50,
|
||||
GetPosition().x, GetPosition().y, GetPosition().z,
|
||||
true );
|
||||
sPantDown.AM = 50000;
|
||||
sPantDown.AA = -1 * ( 105 - Random( 10 ) ) / 100;
|
||||
sPantDown.FM = 1.0;
|
||||
sPantDown.FA = 0.0;
|
||||
}
|
||||
|
||||
else if( token == "compressor:" ) {
|
||||
@@ -5404,10 +5400,6 @@ void TDynamicObject::LoadMMediaFile(std::string BaseDir, std::string TypeName,
|
||||
token, 50,
|
||||
GetPosition().x, GetPosition().y, GetPosition().z,
|
||||
true );
|
||||
rsDoorOpen.AM = 50000;
|
||||
rsDoorOpen.AA = -1 * ( 105 - Random( 10 ) ) / 100;
|
||||
rsDoorOpen.FM = 1.0;
|
||||
rsDoorOpen.FA = 0.0;
|
||||
}
|
||||
|
||||
else if( token == "doorclose:" ) {
|
||||
@@ -5417,10 +5409,6 @@ void TDynamicObject::LoadMMediaFile(std::string BaseDir, std::string TypeName,
|
||||
token, 50,
|
||||
GetPosition().x, GetPosition().y, GetPosition().z,
|
||||
true );
|
||||
rsDoorClose.AM = 50000;
|
||||
rsDoorClose.AA = -1 * ( 105 - Random( 10 ) ) / 100;
|
||||
rsDoorClose.FM = 1.0;
|
||||
rsDoorClose.FA = 0.0;
|
||||
}
|
||||
|
||||
else if( token == "sand:" ) {
|
||||
|
||||
22
Globals.cpp
22
Globals.cpp
@@ -856,46 +856,52 @@ void Global::ConfigParse(cParser &Parser)
|
||||
else if (token == "mwdlocbreakconfig") { // ustawienia hamulca lokomotywy
|
||||
Parser.getTokens(2, false);
|
||||
Parser >> fMWDAnalogInCalib[1][0] >> fMWDAnalogInCalib[1][1];
|
||||
if (bMWDdebugEnable) WriteLog("Locomotive break settings: " + to_string(fMWDAnalogInCalib[1][0]) + to_string(" ") + to_string(fMWDAnalogInCalib[1][1]));
|
||||
if (bMWDdebugEnable) WriteLog("Locomotive break settings: " + to_string(fMWDAnalogInCalib[1][0]) + (" ") + to_string(fMWDAnalogInCalib[1][1]));
|
||||
}
|
||||
else if (token == "mwdanalogin1config") { // ustawienia hamulca zespolonego
|
||||
Parser.getTokens(2, false);
|
||||
Parser >> fMWDAnalogInCalib[2][0] >> fMWDAnalogInCalib[2][1];
|
||||
if (bMWDdebugEnable) WriteLog("Analog input 1 settings: " + to_string(fMWDAnalogInCalib[2][0]) + to_string(" ") + to_string(fMWDAnalogInCalib[2][1]));
|
||||
if (bMWDdebugEnable) WriteLog("Analog input 1 settings: " + to_string(fMWDAnalogInCalib[2][0]) + (" ") + to_string(fMWDAnalogInCalib[2][1]));
|
||||
}
|
||||
else if (token == "mwdanalogin2config") { // ustawienia hamulca lokomotywy
|
||||
Parser.getTokens(2, false);
|
||||
Parser >> fMWDAnalogInCalib[3][0] >> fMWDAnalogInCalib[3][1];
|
||||
if (bMWDdebugEnable) WriteLog("Analog input 2 settings: " + to_string(fMWDAnalogInCalib[3][0]) + to_string(" ") + to_string(fMWDAnalogInCalib[3][1]));
|
||||
if (bMWDdebugEnable) WriteLog("Analog input 2 settings: " + to_string(fMWDAnalogInCalib[3][0]) + (" ") + to_string(fMWDAnalogInCalib[3][1]));
|
||||
}
|
||||
else if (token == "mwdmaintankpress") { // max ciśnienie w zbiorniku głownym i rozdzielczość
|
||||
Parser.getTokens(2, false);
|
||||
Parser >> fMWDzg[0] >> fMWDzg[1];
|
||||
if (bMWDdebugEnable) WriteLog("MainAirTank settings: " + to_string(fMWDzg[0]) + to_string(" ") + to_string(fMWDzg[1]));
|
||||
if (bMWDdebugEnable) WriteLog("MainAirTank settings: " + to_string(fMWDzg[0]) + (" ") + to_string(fMWDzg[1]));
|
||||
}
|
||||
else if (token == "mwdmainpipepress") { // max ciśnienie w przewodzie głownym i rozdzielczość
|
||||
Parser.getTokens(2, false);
|
||||
Parser >> fMWDpg[0] >> fMWDpg[1];
|
||||
if (bMWDdebugEnable) WriteLog("MainAirPipe settings: " + to_string(fMWDpg[0]) + to_string(" ") + to_string(fMWDpg[1]));
|
||||
if (bMWDdebugEnable) WriteLog("MainAirPipe settings: " + to_string(fMWDpg[0]) + (" ") + to_string(fMWDpg[1]));
|
||||
}
|
||||
else if (token == "mwdbreakpress") { // max ciśnienie w hamulcach i rozdzielczość
|
||||
Parser.getTokens(2, false);
|
||||
Parser >> fMWDph[0] >> fMWDph[1];
|
||||
if (bMWDdebugEnable) WriteLog("AirPipe settings: " + to_string(fMWDph[0]) + to_string(" ") + to_string(fMWDph[1]));
|
||||
if (bMWDdebugEnable) WriteLog("AirPipe settings: " + to_string(fMWDph[0]) + (" ") + to_string(fMWDph[1]));
|
||||
}
|
||||
else if (token == "mwdhivoltmeter") { // max napięcie na woltomierzu WN
|
||||
Parser.getTokens(2, false);
|
||||
Parser >> fMWDvolt[0] >> fMWDvolt[1];
|
||||
if (bMWDdebugEnable) WriteLog("VoltMeter settings: " + to_string(fMWDvolt[0]) + to_string(" ") + to_string(fMWDvolt[1]));
|
||||
if (bMWDdebugEnable) WriteLog("VoltMeter settings: " + to_string(fMWDvolt[0]) + (" ") + to_string(fMWDvolt[1]));
|
||||
}
|
||||
else if (token == "mwdhiampmeter") {
|
||||
Parser.getTokens(2, false);
|
||||
Parser >> fMWDamp[0] >> fMWDamp[1];
|
||||
if (bMWDdebugEnable) WriteLog("Amp settings: " + to_string(fMWDamp[0]) + to_string(" ") + to_string(fMWDamp[1]));
|
||||
if (bMWDdebugEnable) WriteLog("Amp settings: " + to_string(fMWDamp[0]) + (" ") + to_string(fMWDamp[1]));
|
||||
}
|
||||
else if (token == "mwddivider") {
|
||||
Parser.getTokens(1, false);
|
||||
Parser >> iMWDdivider;
|
||||
if (iMWDdivider == 0)
|
||||
{
|
||||
WriteLog("Dzielnik nie może być równy ZERO! Ustawiam na 1!");
|
||||
iMWDdivider = 1;
|
||||
}
|
||||
if (bMWDdebugEnable) WriteLog("Divider = " + to_string(iMWDdivider));
|
||||
}
|
||||
} while ((token != "") && (token != "endconfig")); //(!Parser->EndOfFile)
|
||||
// na koniec trochę zależności
|
||||
|
||||
@@ -726,7 +726,7 @@ void TSubModel::DisplayLists()
|
||||
glColorMaterial(GL_FRONT, GL_EMISSION);
|
||||
glDisable(GL_LIGHTING); // Tolaris-030603: bo mu punkty swiecace sie blendowaly
|
||||
glBegin(GL_POINTS);
|
||||
glVertex3f(0, 0, 0);
|
||||
glVertex3f( 0.0f, 0.0f, -0.025f ); // shift point towards the viewer, to avoid z-fighting with the light polygons
|
||||
glEnd();
|
||||
glEnable(GL_LIGHTING);
|
||||
glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
|
||||
|
||||
282
Train.cpp
282
Train.cpp
@@ -24,6 +24,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "Console.h"
|
||||
#include "McZapkie\hamulce.h"
|
||||
#include "McZapkie\MOVER.h"
|
||||
#include "Camera.h"
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
using namespace Timer;
|
||||
@@ -891,56 +892,56 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
||||
if (false == (mvOccupied->LightsPosNo > 0))
|
||||
{
|
||||
if ((GetAsyncKeyState(VK_CONTROL) < 0) &&
|
||||
(ggRearLeftLightButton.SubModel)) // hunter-230112 - z controlem zapala z tylu
|
||||
(ggRearRightLightButton.SubModel)) // hunter-230112 - z controlem zapala z tylu.
|
||||
// 17.02.17 changed rear to opposite side, so the same key actually controls both lights on the left side, from the driver's point of view
|
||||
// TODO: do it a more elegant way. preferably along with the rest of the controlling code
|
||||
{
|
||||
//------------------------------
|
||||
if (mvOccupied->ActiveCab == 1)
|
||||
{ // kabina 1
|
||||
if (((DynamicObject->iLights[1]) & 3) == 0)
|
||||
if (((DynamicObject->iLights[1]) & 48) == 0)
|
||||
{
|
||||
DynamicObject->iLights[1] |= 1;
|
||||
DynamicObject->iLights[1] |= 16;
|
||||
dsbSwitch->SetVolume(DSBVOLUME_MAX);
|
||||
dsbSwitch->Play(0, 0, 0);
|
||||
ggRearLeftLightButton.PutValue(1);
|
||||
ggRearRightLightButton.PutValue(1);
|
||||
}
|
||||
if (((DynamicObject->iLights[1]) & 3) == 2)
|
||||
if (((DynamicObject->iLights[1]) & 48) == 32)
|
||||
{
|
||||
DynamicObject->iLights[1] &= (255 - 2);
|
||||
DynamicObject->iLights[1] &= (255 - 32);
|
||||
dsbSwitch->SetVolume(DSBVOLUME_MAX);
|
||||
dsbSwitch->Play(0, 0, 0);
|
||||
if (ggRearLeftEndLightButton.SubModel)
|
||||
if (ggRearRightEndLightButton.SubModel)
|
||||
{
|
||||
ggRearLeftEndLightButton.PutValue(0);
|
||||
ggRearLeftLightButton.PutValue(0);
|
||||
ggRearRightEndLightButton.PutValue(0);
|
||||
ggRearRightLightButton.PutValue(0);
|
||||
}
|
||||
else
|
||||
ggRearLeftLightButton.PutValue(0);
|
||||
ggRearRightLightButton.PutValue(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // kabina -1
|
||||
if (((DynamicObject->iLights[0]) & 3) == 0)
|
||||
if (((DynamicObject->iLights[0]) & 48) == 0)
|
||||
{
|
||||
DynamicObject->iLights[0] |= 1;
|
||||
DynamicObject->iLights[0] |= 16;
|
||||
dsbSwitch->SetVolume(DSBVOLUME_MAX);
|
||||
dsbSwitch->Play(0, 0, 0);
|
||||
ggRearLeftLightButton.PutValue(1);
|
||||
ggRearRightLightButton.PutValue(1);
|
||||
}
|
||||
if (((DynamicObject->iLights[0]) & 3) == 2)
|
||||
if (((DynamicObject->iLights[0]) & 48) == 32)
|
||||
{
|
||||
DynamicObject->iLights[0] &= (255 - 2);
|
||||
DynamicObject->iLights[0] &= (255 - 32);
|
||||
dsbSwitch->SetVolume(DSBVOLUME_MAX);
|
||||
dsbSwitch->Play(0, 0, 0);
|
||||
if (ggRearLeftEndLightButton.SubModel)
|
||||
if (ggRearRightEndLightButton.SubModel)
|
||||
{
|
||||
ggRearLeftEndLightButton.PutValue(0);
|
||||
ggRearLeftLightButton.PutValue(0);
|
||||
ggRearRightEndLightButton.PutValue(0);
|
||||
ggRearRightLightButton.PutValue(0);
|
||||
}
|
||||
else
|
||||
ggRearLeftLightButton.PutValue(0);
|
||||
ggRearRightLightButton.PutValue(0);
|
||||
}
|
||||
}
|
||||
//----------------------
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1066,53 +1067,46 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
||||
if (false == (mvOccupied->LightsPosNo > 0))
|
||||
{
|
||||
if ((GetAsyncKeyState(VK_CONTROL) < 0) &&
|
||||
(ggRearRightLightButton.SubModel)) // hunter-230112 - z controlem zapala z tylu
|
||||
(ggRearLeftLightButton.SubModel)) // hunter-230112 - z controlem zapala z tylu
|
||||
// 17.02.17 changed rear to opposite side, so the same key actually controls both lights on the left side, from the driver's point of view
|
||||
// TODO: do it a more elegant way. preferably along with the rest of the controlling code
|
||||
{
|
||||
//------------------------------
|
||||
if (mvOccupied->ActiveCab == 1)
|
||||
{ // kabina 1
|
||||
if (((DynamicObject->iLights[1]) & 48) == 0)
|
||||
{
|
||||
DynamicObject->iLights[1] |= 16;
|
||||
dsbSwitch->SetVolume(DSBVOLUME_MAX);
|
||||
dsbSwitch->Play(0, 0, 0);
|
||||
ggRearRightLightButton.PutValue(1);
|
||||
if( mvOccupied->ActiveCab == 1 ) { // kabina 1
|
||||
if( ( ( DynamicObject->iLights[ 1 ] ) & 3 ) == 0 ) {
|
||||
DynamicObject->iLights[ 1 ] |= 1;
|
||||
dsbSwitch->SetVolume( DSBVOLUME_MAX );
|
||||
dsbSwitch->Play( 0, 0, 0 );
|
||||
ggRearLeftLightButton.PutValue( 1 );
|
||||
}
|
||||
if (((DynamicObject->iLights[1]) & 48) == 32)
|
||||
{
|
||||
DynamicObject->iLights[1] &= (255 - 32);
|
||||
dsbSwitch->SetVolume(DSBVOLUME_MAX);
|
||||
dsbSwitch->Play(0, 0, 0);
|
||||
if (ggRearRightEndLightButton.SubModel)
|
||||
{
|
||||
ggRearRightEndLightButton.PutValue(0);
|
||||
ggRearRightLightButton.PutValue(0);
|
||||
if( ( ( DynamicObject->iLights[ 1 ] ) & 3 ) == 2 ) {
|
||||
DynamicObject->iLights[ 1 ] &= ( 255 - 2 );
|
||||
dsbSwitch->SetVolume( DSBVOLUME_MAX );
|
||||
dsbSwitch->Play( 0, 0, 0 );
|
||||
if( ggRearLeftEndLightButton.SubModel ) {
|
||||
ggRearLeftEndLightButton.PutValue( 0 );
|
||||
ggRearLeftLightButton.PutValue( 0 );
|
||||
}
|
||||
else
|
||||
ggRearRightLightButton.PutValue(0);
|
||||
ggRearLeftLightButton.PutValue( 0 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // kabina -1
|
||||
if (((DynamicObject->iLights[0]) & 48) == 0)
|
||||
{
|
||||
DynamicObject->iLights[0] |= 16;
|
||||
dsbSwitch->SetVolume(DSBVOLUME_MAX);
|
||||
dsbSwitch->Play(0, 0, 0);
|
||||
ggRearRightLightButton.PutValue(1);
|
||||
else { // kabina -1
|
||||
if( ( ( DynamicObject->iLights[ 0 ] ) & 3 ) == 0 ) {
|
||||
DynamicObject->iLights[ 0 ] |= 1;
|
||||
dsbSwitch->SetVolume( DSBVOLUME_MAX );
|
||||
dsbSwitch->Play( 0, 0, 0 );
|
||||
ggRearLeftLightButton.PutValue( 1 );
|
||||
}
|
||||
if (((DynamicObject->iLights[0]) & 48) == 32)
|
||||
{
|
||||
DynamicObject->iLights[0] &= (255 - 32);
|
||||
dsbSwitch->SetVolume(DSBVOLUME_MAX);
|
||||
dsbSwitch->Play(0, 0, 0);
|
||||
if (ggRearRightEndLightButton.SubModel)
|
||||
{
|
||||
ggRearRightEndLightButton.PutValue(0);
|
||||
ggRearRightLightButton.PutValue(0);
|
||||
if( ( ( DynamicObject->iLights[ 0 ] ) & 3 ) == 2 ) {
|
||||
DynamicObject->iLights[ 0 ] &= ( 255 - 2 );
|
||||
dsbSwitch->SetVolume( DSBVOLUME_MAX );
|
||||
dsbSwitch->Play( 0, 0, 0 );
|
||||
if( ggRearLeftEndLightButton.SubModel ) {
|
||||
ggRearLeftEndLightButton.PutValue( 0 );
|
||||
ggRearLeftLightButton.PutValue( 0 );
|
||||
}
|
||||
else
|
||||
ggRearRightLightButton.PutValue(0);
|
||||
ggRearLeftLightButton.PutValue( 0 );
|
||||
}
|
||||
}
|
||||
} //------------------------------
|
||||
@@ -2099,52 +2093,46 @@ if
|
||||
{
|
||||
if ((GetAsyncKeyState(VK_CONTROL) < 0) &&
|
||||
(ggRearLeftLightButton.SubModel)) // hunter-230112 - z controlem gasi z tylu
|
||||
// 17.02.17 changed rear to opposite side, so the same key actually controls both lights on the left side, from the driver's point of view
|
||||
// TODO: do it a more elegant way. preferably along with the rest of the controlling code
|
||||
{
|
||||
//------------------------------
|
||||
if (mvOccupied->ActiveCab == 1)
|
||||
{ // kabina 1
|
||||
if (((DynamicObject->iLights[1]) & 3) == 0)
|
||||
{
|
||||
DynamicObject->iLights[1] |= 2;
|
||||
dsbSwitch->SetVolume(DSBVOLUME_MAX);
|
||||
dsbSwitch->Play(0, 0, 0);
|
||||
if (ggRearLeftEndLightButton.SubModel)
|
||||
{
|
||||
ggRearLeftEndLightButton.PutValue(1);
|
||||
ggRearLeftLightButton.PutValue(0);
|
||||
if( mvOccupied->ActiveCab == 1 ) { // kabina 1 (od strony 0)
|
||||
if( ( ( DynamicObject->iLights[ 1 ] ) & 48 ) == 0 ) {
|
||||
DynamicObject->iLights[ 1 ] |= 32;
|
||||
dsbSwitch->SetVolume( DSBVOLUME_MAX );
|
||||
dsbSwitch->Play( 0, 0, 0 );
|
||||
if( ggRearRightEndLightButton.SubModel ) {
|
||||
ggRearRightEndLightButton.PutValue( 1 );
|
||||
ggRearRightLightButton.PutValue( 0 );
|
||||
}
|
||||
else
|
||||
ggRearLeftLightButton.PutValue(-1);
|
||||
ggRearRightLightButton.PutValue( -1 );
|
||||
}
|
||||
if (((DynamicObject->iLights[1]) & 3) == 1)
|
||||
{
|
||||
DynamicObject->iLights[1] &= (255 - 1);
|
||||
dsbSwitch->SetVolume(DSBVOLUME_MAX);
|
||||
dsbSwitch->Play(0, 0, 0);
|
||||
ggRearLeftLightButton.PutValue(0);
|
||||
if( ( ( DynamicObject->iLights[ 1 ] ) & 48 ) == 16 ) {
|
||||
DynamicObject->iLights[ 1 ] &= ( 255 - 16 );
|
||||
dsbSwitch->SetVolume( DSBVOLUME_MAX );
|
||||
dsbSwitch->Play( 0, 0, 0 );
|
||||
ggRearRightLightButton.PutValue( 0 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // kabina -1
|
||||
if (((DynamicObject->iLights[0]) & 3) == 0)
|
||||
{
|
||||
DynamicObject->iLights[0] |= 2;
|
||||
dsbSwitch->SetVolume(DSBVOLUME_MAX);
|
||||
dsbSwitch->Play(0, 0, 0);
|
||||
if (ggRearLeftEndLightButton.SubModel)
|
||||
{
|
||||
ggRearLeftEndLightButton.PutValue(1);
|
||||
ggRearLeftLightButton.PutValue(0);
|
||||
else { // kabina -1
|
||||
if( ( ( DynamicObject->iLights[ 0 ] ) & 48 ) == 0 ) {
|
||||
DynamicObject->iLights[ 0 ] |= 32;
|
||||
dsbSwitch->SetVolume( DSBVOLUME_MAX );
|
||||
dsbSwitch->Play( 0, 0, 0 );
|
||||
if( ggRearRightEndLightButton.SubModel ) {
|
||||
ggRearRightEndLightButton.PutValue( 1 );
|
||||
ggRearRightLightButton.PutValue( 0 );
|
||||
}
|
||||
else
|
||||
ggRearLeftLightButton.PutValue(-1);
|
||||
ggRearRightLightButton.PutValue( -1 );
|
||||
}
|
||||
if (((DynamicObject->iLights[1]) & 3) == 1)
|
||||
{
|
||||
DynamicObject->iLights[1] &= (255 - 1);
|
||||
dsbSwitch->SetVolume(DSBVOLUME_MAX);
|
||||
dsbSwitch->Play(0, 0, 0);
|
||||
ggLeftLightButton.PutValue(0);
|
||||
if( ( ( DynamicObject->iLights[ 0 ] ) & 48 ) == 16 ) {
|
||||
DynamicObject->iLights[ 0 ] &= ( 255 - 16 );
|
||||
dsbSwitch->SetVolume( DSBVOLUME_MAX );
|
||||
dsbSwitch->Play( 0, 0, 0 );
|
||||
ggRearRightLightButton.PutValue( 0 );
|
||||
}
|
||||
}
|
||||
} //------------------------------
|
||||
@@ -2272,52 +2260,46 @@ if
|
||||
{
|
||||
if ((GetAsyncKeyState(VK_CONTROL) < 0) &&
|
||||
(ggRearRightLightButton.SubModel)) // hunter-230112 - z controlem gasi z tylu
|
||||
// 17.02.17 changed rear to opposite side, so the same key actually controls both lights on the left side, from the driver's point of view
|
||||
// TODO: do it a more elegant way. preferably along with the rest of the controlling code
|
||||
{
|
||||
//------------------------------
|
||||
if (mvOccupied->ActiveCab == 1)
|
||||
{ // kabina 1 (od strony 0)
|
||||
if (((DynamicObject->iLights[1]) & 48) == 0)
|
||||
{
|
||||
DynamicObject->iLights[1] |= 32;
|
||||
dsbSwitch->SetVolume(DSBVOLUME_MAX);
|
||||
dsbSwitch->Play(0, 0, 0);
|
||||
if (ggRearRightEndLightButton.SubModel)
|
||||
{
|
||||
ggRearRightEndLightButton.PutValue(1);
|
||||
ggRearRightLightButton.PutValue(0);
|
||||
if( mvOccupied->ActiveCab == 1 ) { // kabina 1
|
||||
if( ( ( DynamicObject->iLights[ 1 ] ) & 3 ) == 0 ) {
|
||||
DynamicObject->iLights[ 1 ] |= 2;
|
||||
dsbSwitch->SetVolume( DSBVOLUME_MAX );
|
||||
dsbSwitch->Play( 0, 0, 0 );
|
||||
if( ggRearLeftEndLightButton.SubModel ) {
|
||||
ggRearLeftEndLightButton.PutValue( 1 );
|
||||
ggRearLeftLightButton.PutValue( 0 );
|
||||
}
|
||||
else
|
||||
ggRearRightLightButton.PutValue(-1);
|
||||
ggRearLeftLightButton.PutValue( -1 );
|
||||
}
|
||||
if (((DynamicObject->iLights[1]) & 48) == 16)
|
||||
{
|
||||
DynamicObject->iLights[1] &= (255 - 16);
|
||||
dsbSwitch->SetVolume(DSBVOLUME_MAX);
|
||||
dsbSwitch->Play(0, 0, 0);
|
||||
ggRearRightLightButton.PutValue(0);
|
||||
if( ( ( DynamicObject->iLights[ 1 ] ) & 3 ) == 1 ) {
|
||||
DynamicObject->iLights[ 1 ] &= ( 255 - 1 );
|
||||
dsbSwitch->SetVolume( DSBVOLUME_MAX );
|
||||
dsbSwitch->Play( 0, 0, 0 );
|
||||
ggRearLeftLightButton.PutValue( 0 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // kabina -1
|
||||
if (((DynamicObject->iLights[0]) & 48) == 0)
|
||||
{
|
||||
DynamicObject->iLights[0] |= 32;
|
||||
dsbSwitch->SetVolume(DSBVOLUME_MAX);
|
||||
dsbSwitch->Play(0, 0, 0);
|
||||
if (ggRearRightEndLightButton.SubModel)
|
||||
{
|
||||
ggRearRightEndLightButton.PutValue(1);
|
||||
ggRearRightLightButton.PutValue(0);
|
||||
else { // kabina -1
|
||||
if( ( ( DynamicObject->iLights[ 0 ] ) & 3 ) == 0 ) {
|
||||
DynamicObject->iLights[ 0 ] |= 2;
|
||||
dsbSwitch->SetVolume( DSBVOLUME_MAX );
|
||||
dsbSwitch->Play( 0, 0, 0 );
|
||||
if( ggRearLeftEndLightButton.SubModel ) {
|
||||
ggRearLeftEndLightButton.PutValue( 1 );
|
||||
ggRearLeftLightButton.PutValue( 0 );
|
||||
}
|
||||
else
|
||||
ggRearRightLightButton.PutValue(-1);
|
||||
ggRearLeftLightButton.PutValue( -1 );
|
||||
}
|
||||
if (((DynamicObject->iLights[0]) & 48) == 16)
|
||||
{
|
||||
DynamicObject->iLights[0] &= (255 - 16);
|
||||
dsbSwitch->SetVolume(DSBVOLUME_MAX);
|
||||
dsbSwitch->Play(0, 0, 0);
|
||||
ggRearRightLightButton.PutValue(0);
|
||||
if( ( ( DynamicObject->iLights[ 1 ] ) & 3 ) == 1 ) {
|
||||
DynamicObject->iLights[ 1 ] &= ( 255 - 1 );
|
||||
dsbSwitch->SetVolume( DSBVOLUME_MAX );
|
||||
dsbSwitch->Play( 0, 0, 0 );
|
||||
ggLeftLightButton.PutValue( 0 );
|
||||
}
|
||||
}
|
||||
} //------------------------------
|
||||
@@ -2402,17 +2384,25 @@ if
|
||||
{
|
||||
// McZapkie: poruszanie sie po kabinie, w updatemechpos zawarte sa wiezy
|
||||
|
||||
// double dt=Timer::GetDeltaTime();
|
||||
if (mvOccupied->ActiveCab < 0)
|
||||
fMechCroach = -0.5;
|
||||
else
|
||||
fMechCroach = 0.5;
|
||||
auto step = 60.0f * Timer::GetDeltaTime();
|
||||
auto const camerayaw = Global::pCamera->Yaw;
|
||||
Math3D::vector3 direction( 0.0f, 0.0f, step );
|
||||
direction.RotateY( camerayaw );
|
||||
Math3D::vector3 right( -step, 0.0f, 0.0f );
|
||||
right.RotateY( camerayaw );
|
||||
// auto right = Math3D::CrossProduct( direction, Math3D::vector3( 0.0f, 1.0f, 0.0f ) );
|
||||
|
||||
if( mvOccupied->ActiveCab < 0 ) {
|
||||
|
||||
direction *= -1.0f;
|
||||
right *= -1.0f;
|
||||
}
|
||||
// if (!GetAsyncKeyState(VK_SHIFT)<0) // bez shifta
|
||||
if (!Console::Pressed(VK_CONTROL)) // gdy [Ctrl] zwolniony (dodatkowe widoki)
|
||||
{
|
||||
if (cKey == Global::Keys[k_MechLeft])
|
||||
{
|
||||
vMechMovement.x += fMechCroach;
|
||||
vMechMovement -= right;
|
||||
if (DynamicObject->Mechanik)
|
||||
if (!FreeFlyModeFlag) //żeby nie mieszać obserwując z zewnątrz
|
||||
DynamicObject->Mechanik->RouteSwitch(
|
||||
@@ -2420,7 +2410,7 @@ if
|
||||
}
|
||||
else if (cKey == Global::Keys[k_MechRight])
|
||||
{
|
||||
vMechMovement.x -= fMechCroach;
|
||||
vMechMovement += right;
|
||||
if (DynamicObject->Mechanik)
|
||||
if (!FreeFlyModeFlag) //żeby nie mieszać obserwując z zewnątrz
|
||||
DynamicObject->Mechanik->RouteSwitch(
|
||||
@@ -2428,7 +2418,7 @@ if
|
||||
}
|
||||
else if (cKey == Global::Keys[k_MechBackward])
|
||||
{
|
||||
vMechMovement.z -= fMechCroach;
|
||||
vMechMovement -= direction;
|
||||
// if (DynamicObject->Mechanik)
|
||||
// if (!FreeFlyModeFlag) //żeby nie mieszać obserwując z zewnątrz
|
||||
// DynamicObject->Mechanik->RouteSwitch(0); //na skrzyżowaniu stanie
|
||||
@@ -2436,16 +2426,16 @@ if
|
||||
}
|
||||
else if (cKey == Global::Keys[k_MechForward])
|
||||
{
|
||||
vMechMovement.z += fMechCroach;
|
||||
vMechMovement += direction;
|
||||
if (DynamicObject->Mechanik)
|
||||
if (!FreeFlyModeFlag) //żeby nie mieszać obserwując z zewnątrz
|
||||
DynamicObject->Mechanik->RouteSwitch(
|
||||
3); // na skrzyżowaniu pojedzie prosto
|
||||
}
|
||||
else if (cKey == Global::Keys[k_MechUp])
|
||||
pMechOffset.y += 0.2; // McZapkie-120302 - wstawanie
|
||||
pMechOffset.y += 0.25; // McZapkie-120302 - wstawanie
|
||||
else if (cKey == Global::Keys[k_MechDown])
|
||||
pMechOffset.y -= 0.2; // McZapkie-120302 - siadanie
|
||||
pMechOffset.y -= 0.25; // McZapkie-120302 - siadanie
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5994,6 +5984,10 @@ bool TTrain::initialize_button(cParser &Parser, std::string const &Label, int co
|
||||
{
|
||||
btLampkaHamienie.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if( Label == "i-dynamicbrake:" ) {
|
||||
|
||||
btLampkaED.Load( Parser, DynamicObject->mdKabina );
|
||||
}
|
||||
else if (Label == "i-braking-ezt:")
|
||||
{
|
||||
btLampkaHamowanie1zes.Load(Parser, DynamicObject->mdKabina);
|
||||
@@ -6334,6 +6328,10 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
|
||||
// hunter-091012: przyciemnienie swiatla w kabinie
|
||||
ggCabLightDimButton.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if( Label == "battery_sw:" ) {
|
||||
|
||||
ggBatteryButton.Load( Parser, DynamicObject->mdKabina );
|
||||
}
|
||||
// ABu 090305: uniwersalne przyciski lub inne rzeczy
|
||||
else if (Label == "universal1:")
|
||||
{
|
||||
|
||||
@@ -345,8 +345,10 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
WriteLog("glLineWidth(1.0f);");
|
||||
glLineWidth(1.0f);
|
||||
// glLineWidth(2.0f);
|
||||
WriteLog("glPointSize(2.0f);");
|
||||
glPointSize(2.0f);
|
||||
WriteLog("glPointSize(3.0f);");
|
||||
glPointSize(3.0f);
|
||||
// glHint( GL_POINT_SMOOTH_HINT, GL_NICEST ); // Really Nice Perspective Calculations
|
||||
// glEnable( GL_POINT_SMOOTH );
|
||||
|
||||
// ----------- LIGHTING SETUP -----------
|
||||
// Light values and coordinates
|
||||
|
||||
Reference in New Issue
Block a user