pre-merge syncs

This commit is contained in:
tmj-fstate
2018-02-03 17:37:46 +01:00
parent b3e7b88bbc
commit e8bb25454e
20 changed files with 53 additions and 82 deletions

View File

@@ -27,8 +27,8 @@ class sound_source;
class TEventLauncher;
class TTraction; // drut
class TTractionPowerSource; // zasilanie drutów
class TCamera;
class TWorld;
class TCamera;
class simulation_time;
class TMoverParameters;

View File

@@ -84,7 +84,7 @@ TKeyTrans Console::ktTable[4 * 256];
// Ra: bajer do migania LED-ami w klawiaturze
void SetLedState( unsigned char Code, bool bOn ) {
#ifdef _WINDOWS
#ifdef _WIN32
if( bOn != ( ::GetKeyState( Code ) != 0 ) ) {
keybd_event( Code, MapVirtualKey( Code, 0 ), KEYEVENTF_EXTENDEDKEY | 0, 0 );
keybd_event( Code, MapVirtualKey( Code, 0 ), KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0 );

View File

@@ -3833,24 +3833,6 @@ void TDynamicObject::RenderSounds() {
// special events
if( MoverParameters->EventFlag ) {
// TODO: dedicated sound, played alongside regular noise
if( true == TestFlag( MoverParameters->DamageFlag, dtrain_wheelwear ) ) {
#ifdef EU07_USE_OLD_SOUNDCODE
if( rsOuterNoise.AM != 0 ) {
rsOuterNoise.Stop();
float am = rsOuterNoise.AM;
float fa = rsOuterNoise.FA;
float fm = rsOuterNoise.FM;
rsOuterNoise.Init( "lomotpodkucia.wav", -1, 0, 0, 0, true ); // MC: zmiana szumu na lomot
if( rsOuterNoise.AM == 1 )
rsOuterNoise.AM = am;
rsOuterNoise.AA = 0.7;
rsOuterNoise.FA = fa;
rsOuterNoise.FM = fm;
}
#else
#endif
}
// McZapkie: w razie wykolejenia
if( true == TestFlag( MoverParameters->DamageFlag, dtrain_out ) ) {
if( GetVelocity() > 0 ) {
@@ -5441,7 +5423,7 @@ void TDynamicObject::DestinationSet(std::string to, std::string numer)
for( auto const &destination : destinations ) {
auto material = TextureTest( destination );
auto material = TextureTest( ToLower( destination ) );
if( false == material.empty() ) {
m_materialdata.replacable_skins[ 4 ] = GfxRenderer.Fetch_Material( material );
break;

View File

@@ -38,7 +38,7 @@ Stele, firleju, szociu, hunter, ZiomalCl, OLI_EU and others
#pragma comment( lib, "glfw3.lib" )
#pragma comment( lib, "glew32s.lib" )
#else
#ifdef _WINDOWS
#ifdef _WIN32
#pragma comment( lib, "glfw3dll.lib" )
#else
#pragma comment( lib, "glfw3.lib" )
@@ -47,9 +47,7 @@ Stele, firleju, szociu, hunter, ZiomalCl, OLI_EU and others
#endif // build_static
#pragma comment( lib, "opengl32.lib" )
#pragma comment( lib, "glu32.lib" )
#pragma comment( lib, "dsound.lib" )
#pragma comment( lib, "openal32.lib")
#pragma comment( lib, "winmm.lib" )
#pragma comment( lib, "setupapi.lib" )
#pragma comment( lib, "python27.lib" )
#pragma comment (lib, "dbghelp.lib")
@@ -218,7 +216,7 @@ void scroll_callback( GLFWwindow* window, double xoffset, double yoffset ) {
}
}
#ifdef _WINDOWS
#ifdef _WIN32
extern "C"
{
GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
@@ -241,14 +239,14 @@ int main(int argc, char *argv[])
// this will turn on FPE for #IND and zerodiv
state = _control87( state & ~( _EM_ZERODIVIDE | _EM_INVALID ), _MCW_EM );
#endif
#ifdef _WINDOWS
#ifdef _WIN32
::SetUnhandledExceptionFilter( unhandled_handler );
#endif
if (!glfwInit())
return -1;
#ifdef _WINDOWS
#ifdef _WIN32
DeleteFile( "log.txt" );
DeleteFile( "errors.txt" );
_mkdir("logs");
@@ -394,7 +392,7 @@ int main(int argc, char *argv[])
return -1;
}
#ifdef _WINDOWS
#ifdef _WIN32
// setup wrapper for base glfw window proc, to handle copydata messages
Hwnd = glfwGetWin32Window( window );
BaseWindowProc = (WNDPROC)::SetWindowLongPtr( Hwnd, GWLP_WNDPROC, (LONG_PTR)WndProc );
@@ -426,7 +424,7 @@ int main(int argc, char *argv[])
ErrorLog( "Critical error, memory allocation failure: " + std::string( Error.what() ) );
return -1;
}
#ifdef _WINDOWS
#ifdef _WIN32
Console *pConsole = new Console(); // Ra: nie wiem, czy ma to sens, ale jakoś zainicjowac trzeba
#endif
if( Global.iConvertModels < 0 ) {
@@ -434,7 +432,7 @@ int main(int argc, char *argv[])
World.CreateE3D( "models\\" ); // rekurencyjne przeglądanie katalogów
World.CreateE3D( "dynamic\\", true );
} // po zrobieniu E3D odpalamy normalnie scenerię, by ją zobaczyć
#ifdef _WINDOWS
#ifdef _WIN32
Console::On(); // włączenie konsoli
#endif
try {
@@ -454,7 +452,7 @@ int main(int argc, char *argv[])
}
TPythonInterpreter::killInstance();
#ifdef _WINDOWS
#ifdef _WIN32
Console::Off(); // wyłączenie konsoli (komunikacji zwrotnej)
SafeDelete( pConsole );
#endif

View File

@@ -32,7 +32,7 @@ http://mozilla.org/MPL/2.0/.
// and the high byte holds modifiers: 0x1 = shift, 0x2 = ctrl, 0x4 = alt
int vk_to_glfw_key( int const Keycode ) {
#ifdef _WINDOWS
#ifdef _WIN32
auto const code = VkKeyScan( Keycode );
char key = code & 0xff;
char shiftstate = ( code & 0xff00 ) >> 8;

View File

@@ -50,10 +50,10 @@ TEvent::~TEvent() {
SafeDeleteArray(Params[10].asText);
break;
case tp_Animation: // nic
// SafeDeleteArray(Params[9].asText); //nie usuwać - nazwa jest zamieniana na wskaźnik do
// submodelu
// SafeDeleteArray(Params[9].asText); //nie usuwać - nazwa jest zamieniana na wskaźnik do submodelu
if (Params[0].asInt == 4) // jeśli z pliku VMD
SafeDeleteArray( Params[8].asPointer ); // zwolnić obszar
break;
case tp_GetValues: // nic
break;
case tp_PutValues: // params[0].astext stores the token

View File

@@ -72,11 +72,7 @@ union TParam
bool asBool;
double asdouble;
int asInt;
#ifdef EU07_USE_OLD_SOUNDCODE
TTextSound *tsTextSound;
#else
sound_source *tsTextSound;
#endif
char *asText;
TCommandType asCommand;
TTractionPowerSource *psPower;

View File

@@ -704,7 +704,7 @@ global_settings::ConfigParse(cParser &Parser) {
// TBD: remove, or launch depending on passed flag?
if (qp)
{ // to poniżej wykonywane tylko raz, jedynie po wczytaniu eu07.ini*/
#ifdef _WINDOWS
#ifdef _WIN32
Console::ModeSet(iFeedbackMode, iFeedbackPort); // tryb pracy konsoli sterowniczej
#endif
/*iFpsRadiusMax = 0.000025 * fFpsRadiusMax *

View File

@@ -1111,7 +1111,6 @@ TModel3d::~TModel3d() {
if (iFlags & 0x0200) {
// wczytany z pliku tekstowego, submodele sprzątają same
SafeDelete( Root );
// Root = nullptr;
}
else {
// wczytano z pliku binarnego (jest właścicielem tablic)
@@ -1121,17 +1120,19 @@ TModel3d::~TModel3d() {
TSubModel *TModel3d::AddToNamed(const char *Name, TSubModel *SubModel)
{
TSubModel *sm = Name ? GetFromName(Name) : NULL;
TSubModel *sm = Name ? GetFromName(Name) : nullptr;
if( ( sm == nullptr )
&& ( Name != nullptr ) && ( std::strcmp( Name, "none" ) != 0 ) ) {
ErrorLog( "Bad model: parent for sub-model \"" + SubModel->pName +"\" doesn't exist or is located after in the model data", logtype::model );
}
AddTo(sm, SubModel); // szukanie nadrzędnego
return sm; // zwracamy wskaźnik do nadrzędnego submodelu
};
void TModel3d::AddTo(TSubModel *tmp, TSubModel *SubModel)
{ // jedyny poprawny sposób dodawania
// submodeli, inaczej mogą zginąć
// przy zapisie E3D
if (tmp)
{ // jeśli znaleziony, podłączamy mu jako potomny
// jedyny poprawny sposób dodawania submodeli, inaczej mogą zginąć przy zapisie E3D
void TModel3d::AddTo(TSubModel *tmp, TSubModel *SubModel) {
if (tmp) {
// jeśli znaleziony, podłączamy mu jako potomny
tmp->ChildAdd(SubModel);
}
else

View File

@@ -596,8 +596,7 @@ void TWorld::OnKeyDown(int cKey) {
{ // i potwierdzenie
if( cKey == GLFW_KEY_Y ) {
// flaga wyjścia z programu
::PostQuitMessage( 0 );
// Global.iTextMode = -1;
glfwSetWindowShouldClose( window, 1 );
}
return; // nie przekazujemy do pociągu
}
@@ -1921,7 +1920,7 @@ void TWorld::CreateE3D(std::string const &Path, bool Dynamic)
double at{ 0.0 };
double shift{ 0.0 };
#ifdef _WINDOWS
#ifdef _WIN32
std::string searchpattern( "*.*" );

View File

@@ -127,7 +127,7 @@ class matrix4x4
public:
matrix4x4(void)
{
::SecureZeroMemory( e, sizeof( e ) );
memset( e, 0, sizeof( e ) );
}
// When defining matrices in C arrays, it is easiest to define them with

View File

@@ -15,26 +15,30 @@ http://mozilla.org/MPL/2.0/.
#include "mtable.h"
#include "logs.h"
#ifdef _WIN32
extern "C"
{
GLFWAPI HWND glfwGetWin32Window( GLFWwindow* window ); //m7todo: potrzebne do directsound
}
#endif
namespace multiplayer {
#ifdef _WINDOWS
void
Navigate(std::string const &ClassName, UINT Msg, WPARAM wParam, LPARAM lParam) {
#ifdef _WIN32
// wysłanie komunikatu do sterującego
HWND h = FindWindow(ClassName.c_str(), 0); // można by to zapamiętać
if (h == 0)
h = FindWindow(0, ClassName.c_str()); // można by to zapamiętać
SendMessage(h, Msg, wParam, lParam);
#endif
}
void
WyslijEvent(const std::string &e, const std::string &d)
{ // Ra: jeszcze do wyczyszczenia
#ifdef _WIN32
DaneRozkaz r;
r.iSygn = MAKE_ID4( 'E', 'U', '0', '7' );
r.iComm = 2; // 2 - event
@@ -49,12 +53,14 @@ WyslijEvent(const std::string &e, const std::string &d)
cData.lpData = &r;
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Global.window ), (LPARAM)&cData );
CommLog( Now() + " " + std::to_string(r.iComm) + " " + e + " sent" );
#endif
}
void
WyslijUszkodzenia(const std::string &t, char fl)
{ // wysłanie informacji w postaci pojedynczego tekstu
DaneRozkaz r;
#ifdef _WIN32
DaneRozkaz r;
r.iSygn = MAKE_ID4( 'E', 'U', '0', '7' );
r.iComm = 13; // numer komunikatu
size_t i = t.length();
@@ -67,11 +73,13 @@ WyslijUszkodzenia(const std::string &t, char fl)
cData.lpData = &r;
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Global.window ), (LPARAM)&cData );
CommLog( Now() + " " + std::to_string(r.iComm) + " " + t + " sent");
#endif
}
void
WyslijString(const std::string &t, int n)
{ // wysłanie informacji w postaci pojedynczego tekstu
#ifdef _WIN32
DaneRozkaz r;
r.iSygn = MAKE_ID4( 'E', 'U', '0', '7' );
r.iComm = n; // numer komunikatu
@@ -84,6 +92,7 @@ WyslijString(const std::string &t, int n)
cData.lpData = &r;
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Global.window ), (LPARAM)&cData );
CommLog( Now() + " " + std::to_string(r.iComm) + " " + t + " sent");
#endif
}
void
@@ -95,7 +104,8 @@ WyslijWolny(const std::string &t)
void
WyslijNamiary(TDynamicObject const *Vehicle)
{ // wysłanie informacji o pojeździe - (float), długość ramki będzie zwiększana w miarę potrzeby
// WriteLog("Wysylam pojazd");
#ifdef _WIN32
// WriteLog("Wysylam pojazd");
DaneRozkaz r;
r.iSygn = MAKE_ID4( 'E', 'U', '0', '7' );
r.iComm = 7; // 7 - dane pojazdu
@@ -167,12 +177,14 @@ WyslijNamiary(TDynamicObject const *Vehicle)
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Global.window ), (LPARAM)&cData );
// WriteLog("Ramka poszla!");
CommLog( Now() + " " + std::to_string(r.iComm) + " " + Vehicle->asName + " sent");
#endif
}
void
WyslijObsadzone()
{ // wysłanie informacji o pojeździe
DaneRozkaz2 r;
#ifdef _WIN32
DaneRozkaz2 r;
r.iSygn = MAKE_ID4( 'E', 'U', '0', '7' );
r.iComm = 12; // kod 12
for (int i=0; i<1984; ++i) r.cString[i] = 0;
@@ -213,11 +225,13 @@ WyslijObsadzone()
// WriteLog("Ramka gotowa");
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Global.window ), (LPARAM)&cData );
CommLog( Now() + " " + std::to_string(r.iComm) + " obsadzone" + " sent");
#endif
}
void
WyslijParam(int nr, int fl)
{ // wysłanie parametrów symulacji w ramce (nr) z flagami (fl)
#ifdef _WIN32
DaneRozkaz r;
r.iSygn = MAKE_ID4( 'E', 'U', '0', '7' );
r.iComm = nr; // zwykle 5
@@ -236,8 +250,8 @@ WyslijParam(int nr, int fl)
cData.cbData = 12 + i; // 12+rozmiar danych
cData.lpData = &r;
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Global.window ), (LPARAM)&cData );
}
#endif
}
} // multiplayer

View File

@@ -21,14 +21,13 @@ extern TWorld World;
bool
mouse_input::init() {
#ifdef _WINDOWS
#ifdef _WIN32
DWORD systemkeyboardspeed;
::SystemParametersInfo( SPI_GETKEYBOARDSPEED, 0, &systemkeyboardspeed, 0 );
m_updaterate = interpolate( 0.5, 0.04, systemkeyboardspeed / 31.0 );
DWORD systemkeyboarddelay;
::SystemParametersInfo( SPI_GETKEYBOARDDELAY, 0, &systemkeyboarddelay, 0 );
m_updatedelay = interpolate( 0.25, 1.0, systemkeyboarddelay / 3.0 );
#endif
return true;
}

View File

@@ -13,7 +13,7 @@ http://mozilla.org/MPL/2.0/.
#include <glm/glm.hpp>
#include <glm/gtc/type_ptr.hpp>
#include "GL/glew.h"
#ifdef _WINDOWS
#ifdef _WIN32
#include "GL/wglew.h"
#endif
#include "ResourceManager.h"

View File

@@ -15,7 +15,7 @@ http://mozilla.org/MPL/2.0/.
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include "GL/glew.h"
#ifdef _WINDOWS
#ifdef _WIN32
#include "GL/wglew.h"
#endif

View File

@@ -105,11 +105,7 @@ public:
insert( TAnimModel *Instance );
// adds provided sound instance to the cell
void
#ifdef EU07_USE_OLD_SOUNDCODE
insert( TTextSound *Sound );
#else
insert( sound_source *Sound );
#endif
// adds provided event launcher to the cell
void
insert( TEventLauncher *Launcher );

View File

@@ -832,11 +832,7 @@ state_manager::deserialize_dynamic( cParser &Input, scene::scratch_data &Scratch
return vehicle;
}
#ifdef EU07_USE_OLD_SOUNDCODE
TTextSound *
#else
sound_source *
#endif
state_manager::deserialize_sound( cParser &Input, scene::scratch_data &Scratchpad, scene::node_data const &Nodedata ) {
glm::dvec3 location;
@@ -848,16 +844,10 @@ state_manager::deserialize_sound( cParser &Input, scene::scratch_data &Scratchpa
// adjust location
location = transform( location, Scratchpad );
#ifdef EU07_USE_OLD_SOUNDCODE
auto const soundname { Input.getToken<std::string>() };
auto *sound = new TTextSound( soundname, Nodedata.range_max, location.x, location.y, location.z, false, false, Nodedata.range_min );
sound->name( Nodedata.name );
#else
auto *sound = new sound_source( sound_placement::external, Nodedata.range_max );
sound->offset( location );
sound->name( Nodedata.name );
sound->deserialize( Input, sound_type::single );
#endif
skip_until( Input, "endsound" );

View File

@@ -64,11 +64,7 @@ private:
TEventLauncher * deserialize_eventlauncher( cParser &Input, scene::scratch_data &Scratchpad, scene::node_data const &Nodedata );
TAnimModel * deserialize_model( cParser &Input, scene::scratch_data &Scratchpad, scene::node_data const &Nodedata );
TDynamicObject * deserialize_dynamic( cParser &Input, scene::scratch_data &Scratchpad, scene::node_data const &Nodedata );
#ifdef EU07_USE_OLD_SOUNDCODE
TTextSound * deserialize_sound( cParser &Input, scene::scratch_data &Scratchpad, scene::node_data const &Nodedata );
#else
sound_source * deserialize_sound( cParser &Input, scene::scratch_data &Scratchpad, scene::node_data const &Nodedata );
#endif
// skips content of stream until specified token
void skip_until( cParser &Input, std::string const &Token );
// transforms provided location by specifed rotation and offset

View File

@@ -18,7 +18,7 @@
#endif // _DEBUG
#endif
// operating system
#ifdef _WINDOWS
#ifdef _WIN32
#include "targetver.h"
#define NOMINMAX
#include <windows.h>
@@ -73,12 +73,12 @@
#ifdef EU07_BUILD_STATIC
#define GLEW_STATIC
#else
#ifdef _WINDOWS
#ifdef _WIN32
#define GLFW_DLL
#endif // _windows
#endif // build_static
#include "GL/glew.h"
#ifdef _WINDOWS
#ifdef _WIN32
#include "GL/wglew.h"
#endif
#define GLFW_INCLUDE_GLU

View File

@@ -84,7 +84,7 @@ bool ClearFlag( int &Flag, int const Value ) {
}
}
inline double Random(double a, double b)
double Random(double a, double b)
{
std::uniform_real_distribution<> dis(a, b);
return dis(Global.random_engine);