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

post-merge fixes, continued

This commit is contained in:
tmj-fstate
2017-03-07 14:29:03 +01:00
parent 32c554f6b8
commit 2f3e916d9e
5 changed files with 25 additions and 24 deletions

View File

@@ -460,7 +460,7 @@ bool TAnimModel::Init(std::string const &asName, std::string const &asReplacable
iTexAlpha = 0x30300030;
}
// przezroczystych
return (Init(TModelsManager::GetModel(asName.c_str())));
return (Init(TModelsManager::GetModel(asName)));
}
bool TAnimModel::Load(cParser *parser, bool ter)

View File

@@ -67,7 +67,7 @@ int vk_to_glfw_key( int const Keycode ) {
if( (key >= 'A') && (key <= 'Z') ) {
key = GLFW_KEY_A + key - 'A';
}
else if( key >= '0' ) {
else if( ( key >= '0' ) && ( key <= '9' ) ) {
key = GLFW_KEY_0 + key - '0';
}
return key + ( shiftstate << 8 );

View File

@@ -5092,7 +5092,7 @@ void TGround::WyslijString(const std::string &t, int n)
r.cString[0] = char(i);
strcpy(r.cString + 1, t.c_str()); // z zerem kończącym
COPYDATASTRUCT cData;
cData.dwData = 'EU07'; // sygnatura
cData.dwData = MAKE_ID4( 'E', 'U', '0', '7' ); // sygnatura
cData.cbData = (DWORD)(10 + i); // 8+licznik i zero kończące
cData.lpData = &r;
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Global::window ), (LPARAM)&cData );
@@ -5171,7 +5171,7 @@ void TGround::WyslijNamiary(TGroundNode *t)
r.cString[i] = char(j); // na końcu nazwa, żeby jakoś zidentyfikować
strcpy(r.cString + i + 1, t->asName.c_str()); // zakończony zerem
COPYDATASTRUCT cData;
cData.dwData = 'EU07'; // sygnatura
cData.dwData = MAKE_ID4( 'E', 'U', '0', '7' ); // sygnatura
cData.cbData = (DWORD)(10 + i + j); // 8+licznik i zero kończące
cData.lpData = &r;
// WriteLog("Ramka gotowa");

View File

@@ -2015,7 +2015,13 @@ void TSubModel::BinInit(TSubModel *s, float4x4 *m, float8 *v,
if (pTexture.find_last_of("/\\") == std::string::npos)
pTexture.insert(0, Global::asCurrentTexturePath);
TextureID = GfxRenderer.GetTextureId(pTexture, szTexturePath);
}
if( Opacity < 1.0 ) // przezroczystość z tekstury brana tylko dla Opacity 0!
iFlags |= GfxRenderer.Texture( TextureID ).has_alpha ?
0x20 :
0x10; // 0x10-nieprzezroczysta, 0x20-przezroczysta
else
iFlags |= 0x10; // normalnie nieprzezroczyste
}
else
TextureID = iTexture;
b_aAnim = b_Anim; // skopiowanie animacji do drugiego cyklu

View File

@@ -34,9 +34,6 @@ http://mozilla.org/MPL/2.0/.
#define TEXTURE_LOD_BIAS_EXT 0x8501
//---------------------------------------------------------------------------
typedef void(APIENTRY *FglutBitmapCharacter)(void *font, int character); // typ funkcji
FglutBitmapCharacter glutBitmapCharacterDLL = NULL; // deklaracja zmiennej
HINSTANCE hinstGLUT32 = NULL; // wskaźnik do GLUT32.DLL
// GLUTAPI void APIENTRY glutBitmapCharacterDLL(void *font, int character);
TDynamicObject *Controlled = NULL; // pojazd, który prowadzimy
@@ -75,8 +72,6 @@ TWorld::~TWorld()
TSoundsManager::Free();
TModelsManager::Free();
glDeleteLists(base, 96);
if (hinstGLUT32)
FreeLibrary(hinstGLUT32);
}
void TWorld::TrainDelete(TDynamicObject *d)
@@ -243,7 +238,7 @@ bool TWorld::Init( GLFWwindow *w ) {
else
{
Global::bDecompressDDS =
!(true == GLEW_EXT_texture_compression_s3tc); // czy obsługiwane?
!(GLEW_EXT_texture_compression_s3tc); // czy obsługiwane?
if (Global::bDecompressDDS) // czy jest obsługa DDS w karcie graficznej
WriteLog("DDS textures are not supported.");
else // brak obsługi DDS - trzeba włączyć programową dekompresję
@@ -277,7 +272,7 @@ bool TWorld::Init( GLFWwindow *w ) {
{
glEnable(GL_BLEND);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.04);
glAlphaFunc(GL_GREATER, 0.04f);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthFunc(GL_LEQUAL);
}
@@ -451,11 +446,11 @@ bool TWorld::Init( GLFWwindow *w ) {
// directional light
// TODO, TBD: test omni-directional variant
Global::DayLight.position[ 3 ] = 1.0f;
::glLightf( opengl_renderer::sunlight, GL_SPOT_CUTOFF, 90.0 );
::glLightf( opengl_renderer::sunlight, GL_SPOT_CUTOFF, 90.0f );
// rgb value for 5780 kelvin
Global::DayLight.diffuse[ 0 ] = 255.0 / 255.0;
Global::DayLight.diffuse[ 1 ] = 242.0 / 255.0;
Global::DayLight.diffuse[ 2 ] = 231.0 / 255.0;
Global::DayLight.diffuse[ 0 ] = 255.0f / 255.0f;
Global::DayLight.diffuse[ 1 ] = 242.0f / 255.0f;
Global::DayLight.diffuse[ 2 ] = 231.0f / 255.0f;
#endif
Ground.Init(Global::SceneryFile);
@@ -746,7 +741,7 @@ void TWorld::OnKeyDown(int cKey)
// else if (cKey=='3') Global::iWriteLogEnabled^=4; //wypisywanie nazw torów
}
}
else if( cKey == GLFW_KEY_3 ) //[Ctrl]+[Break]
else if( Global::ctrlState && cKey == GLFW_KEY_PAUSE ) //[Ctrl]+[Break]
{ // hamowanie wszystkich pojazdów w okolicy
if (Controlled->MoverParameters->Radio)
Ground.RadioStop(Camera.Pos);
@@ -763,7 +758,7 @@ void TWorld::OnKeyDown(int cKey)
TDynamicObject *temp = Global::DynamicNearest();
if (temp)
{
if (Global::ctrlState < 0) // z ctrl odcinanie
if (Global::ctrlState) // z ctrl odcinanie
{
temp->MoverParameters->BrakeStatus ^= 128;
}
@@ -825,7 +820,7 @@ void TWorld::OnKeyDown(int cKey)
TDynamicObject *temp = Global::DynamicNearest();
if (temp)
{
if (Global::ctrlState < 0)
if (Global::ctrlState)
if ((temp->MoverParameters->LocalBrake == ManualBrake) ||
(temp->MoverParameters->MBrake == true))
temp->MoverParameters->IncManualBrakeLevel(1);
@@ -845,7 +840,7 @@ void TWorld::OnKeyDown(int cKey)
TDynamicObject *temp = Global::DynamicNearest();
if (temp)
{
if (Global::ctrlState < 0)
if (Global::ctrlState)
if ((temp->MoverParameters->LocalBrake == ManualBrake) ||
(temp->MoverParameters->MBrake == true))
temp->MoverParameters->DecManualBrakeLevel(1);
@@ -1157,7 +1152,7 @@ bool TWorld::Update()
// variable step simulation time routines
if( Train != nullptr ) {
TSubModel::iInstance = reinterpret_cast<int>( Train->Dynamic() );
TSubModel::iInstance = reinterpret_cast<size_t>( Train->Dynamic() );
Train->Update( dt );
}
else {
@@ -1429,7 +1424,7 @@ void TWorld::Update_Environment() {
bool TWorld::Render()
{
glColor3b(255, 255, 255);
glColor3ub(255, 255, 255);
// glColor3b(255, 0, 255);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glDepthFunc( GL_LEQUAL );
@@ -1469,7 +1464,7 @@ TWorld::Render_Cab() {
}
TDynamicObject *dynamic = Train->Dynamic();
TSubModel::iInstance = reinterpret_cast<int>( dynamic );
TSubModel::iInstance = reinterpret_cast<size_t>( dynamic );
if( ( true == FreeFlyModeFlag )
|| ( false == dynamic->bDisplayCab )
@@ -2624,7 +2619,7 @@ void TWorld::OnCommandGet(DaneRozkaz *pRozkaz)
std::string(pRozkaz->cString + 1, (unsigned)(pRozkaz->cString[0])));
if (e)
if ((e->Type == tp_Multiple) || (e->Type == tp_Lights) ||
bool(e->evJoined)) // tylko jawne albo niejawne Multiple
(e->evJoined != 0)) // tylko jawne albo niejawne Multiple
Ground.AddToQuery(e, NULL); // drugi parametr to dynamic wywołujący - tu
// brak
}