build 200604. sound loading logging enhancement, driving aid throttle data enhancement, external camera movement control fix

This commit is contained in:
tmj-fstate
2020-06-05 16:45:52 +02:00
parent ad1a14082c
commit 03561b11d8
9 changed files with 28 additions and 17 deletions

View File

@@ -14,6 +14,7 @@ http://mozilla.org/MPL/2.0/.
#include "utilities.h"
#include "Console.h"
#include "Timer.h"
#include "Driver.h"
#include "DynObj.h"
#include "MOVER.h"
@@ -188,7 +189,8 @@ void TCamera::Update()
// attached movement position update
auto movement { Velocity * -2.0 };
movement.y = -movement.y;
if( m_owner->MoverParameters->CabOccupied < 0 ) {
if( ( m_owner->ctOwner )
&& ( m_owner->ctOwner->Vehicle()->MoverParameters->CabOccupied < 0 ) ) {
movement *= -1.f;
movement.y = -movement.y;
}

View File

@@ -861,7 +861,8 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
double v; // prędkość
double d; // droga
double d_to_next_sem = 10000.0; //ustaiwamy na pewno dalej niż widzi AI
IsAtPassengerStop = false;
IsAtPassengerStop = false;
auto IsScheduledPassengerStopVisible { false };
TCommandType go = TCommandType::cm_Unknown;
eSignNext = NULL;
// te flagi są ustawiane tutaj, w razie potrzeby
@@ -879,7 +880,9 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
// first 19 chars of the command is expected to be "PassengerStopPoint:" so we skip them
if ( ToLower(sSpeedTable[i].evEvent->input_text()).compare( 19, sizeof(asNextStop), ToLower(asNextStop)) != 0 )
{ // jeśli nazwa nie jest zgodna
if (sSpeedTable[i].fDist < 300.0 && sSpeedTable[i].fDist > 0) // tylko jeśli W4 jest blisko, przy dwóch może zaczać szaleć
if( ( false == IsScheduledPassengerStopVisible ) // check if our next scheduled stop didn't show up earlier in the scan
&& ( sSpeedTable[i].fDist < ( 1.15 * fBrakeDist + 300 ) )
&& ( sSpeedTable[i].fDist > 0 ) ) // tylko jeśli W4 jest blisko, przy dwóch może zaczać szaleć
{
// porównuje do następnej stacji, więc trzeba przewinąć do poprzedniej
// nastepnie ustawić następną na aktualną tak żeby prawidłowo ją obsłużył w następnym kroku
@@ -896,6 +899,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
}
else if (iDrivigFlags & moveStopPoint) // jeśli pomijanie W4, to nie sprawdza czasu odjazdu
{ // tylko gdy nazwa zatrzymania się zgadza
IsScheduledPassengerStopVisible = true; // block potential timetable rewind if the next stop shows up later in the scan
if (false == TrainParams.IsStop())
{ // jeśli nie ma tu postoju
sSpeedTable[i].fVelNext = -1; // maksymalna prędkość w tym miejscu

View File

@@ -51,7 +51,7 @@ std::string filename_scenery() {
void WriteLog( const char *str, logtype const Type ) {
if( str == nullptr ) { return; }
if( true == TestFlag( Global.DisabledLogTypes, Type ) ) { return; }
if( true == TestFlag( Global.DisabledLogTypes, static_cast<unsigned int>( Type ) ) ) { return; }
if (Global.iWriteLogEnabled & 1) {
if( !output.is_open() ) {
@@ -79,7 +79,7 @@ void WriteLog( const char *str, logtype const Type ) {
void ErrorLog( const char *str, logtype const Type ) {
if( str == nullptr ) { return; }
if( true == TestFlag( Global.DisabledLogTypes, Type ) ) { return; }
if( true == TestFlag( Global.DisabledLogTypes, static_cast<unsigned int>( Type ) ) ) { return; }
if (!errors.is_open()) {

5
Logs.h
View File

@@ -11,7 +11,7 @@ http://mozilla.org/MPL/2.0/.
#include <string>
enum logtype : unsigned int {
enum class logtype : unsigned int {
generic = ( 1 << 0 ),
file = ( 1 << 1 ),
@@ -20,7 +20,8 @@ enum logtype : unsigned int {
// lua = ( 1 << 4 ),
material = ( 1 << 5 ),
shader = ( 1 << 6 ),
net = ( 1 << 7 )
net = ( 1 << 7 ),
sound = ( 1 << 8 ),
};
void WriteLog( const char *str, logtype const Type = logtype::generic );

View File

@@ -819,7 +819,7 @@ eu07_application::init_gfx() {
// legacy render path
GfxRenderer = std::make_unique<opengl_renderer>();
Global.GfxFramebufferSRGB = false;
Global.DisabledLogTypes |= logtype::material;
Global.DisabledLogTypes |= static_cast<unsigned int>( logtype::material );
}
if( false == GfxRenderer->Init( m_windows.front() ) ) {

View File

@@ -27,6 +27,8 @@ namespace audio {
openal_buffer::openal_buffer( std::string const &Filename ) :
name( Filename ) {
WriteLog( "Loading sound data from \"" + Filename + "\"", logtype::sound );
::alGenBuffers( 1, &id );
// fetch audio data
if( Filename.substr( Filename.rfind( '.' ) ) == ".wav" ) {

View File

@@ -88,9 +88,9 @@ drivingaid_panel::update() {
std::snprintf(
m_buffer.data(), m_buffer.size(),
locale::strings[ locale::string::driver_aid_throttle ].c_str(),
driver->Controlling()->MainCtrlPos,
driver->Controlling()->ScndCtrlPos,
( mover->DirActive > 0 ? 'D' : mover->DirActive < 0 ? 'R' : 'N' ),
( mover->EIMCtrlType > 0 ? std::max( 0, static_cast<int>( 100.4 * mover->eimic_real ) ) : driver->Controlling()->MainCtrlPos ),
( mover->EIMCtrlType > 0 ? driver->Controlling()->MainCtrlPos : driver->Controlling()->ScndCtrlPos ),
( mover->SpeedCtrlUnit.IsActive ? 'T' : mover->DirActive > 0 ? 'D' : mover->DirActive < 0 ? 'R' : 'N' ),
expandedtext.c_str());
text_lines.emplace_back( m_buffer.data(), Global.UITextColor );
@@ -106,10 +106,12 @@ drivingaid_panel::update() {
mover->PipePress * 100 );
expandedtext = m_buffer.data();
}
auto const basicbraking { mover->fBrakeCtrlPos };
auto const eimicbraking { std::max( 0.0, -100.0 * mover->eimic_real ) };
std::snprintf(
m_buffer.data(), m_buffer.size(),
locale::strings[ locale::string::driver_aid_brakes ].c_str(),
mover->fBrakeCtrlPos,
( mover->EIMCtrlType == 0 ? basicbraking : mover->EIMCtrlType == 3 ? ( mover->UniCtrlIntegratedBrakeCtrl ? eimicbraking : basicbraking ) : eimicbraking ),
mover->LocalBrakePosA * LocalBrakePosNo,
( mover->SlippingWheels ? '!' : ' ' ),
expandedtext.c_str() );

View File

@@ -27,11 +27,11 @@ init() {
{ "en",
{
"Driving Aid",
"Throttle: %2d+%d %c%s",
"Throttle: %3d+%d %c%s",
" Speed: %d km/h (limit %d km/h%s)%s",
", new limit: %d km/h in %.1f km",
" Grade: %.1f%%%%",
"Brakes: %4.1f+%-2.0f%c%s",
"Brakes: %5.1f+%-2.0f%c%s",
" Pressure: %.2f kPa (train pipe: %.2f kPa)",
"!ALERTER! ",
"!SHP!",
@@ -229,11 +229,11 @@ init() {
{ "pl",
{
"Pomocnik",
"Nastawnik: %2d+%d %c%s",
"Nastawnik: %3d+%d %c%s",
" Predkosc: %d km/h (limit %d km/h%s)%s",
", nowy limit: %d km/h za %.1f km",
" Nachylenie: %.1f%%%%",
"Hamulce: %4.1f+%-2.0f%c%s",
"Hamulce: %5.1f+%-2.0f%c%s",
" Cisnienie: %.2f kPa (przewod glowny: %.2f kPa)",
"!CZUWAK! ",
"!SHP!",

View File

@@ -1,5 +1,5 @@
#pragma once
#define VERSION_MAJOR 20
#define VERSION_MINOR 525
#define VERSION_MINOR 604
#define VERSION_REVISION 0