18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-21 12:05:01 +01:00

Merge branch 'master' into feat/renderers-cleanup

This commit is contained in:
2026-11-10 17:09:09 +01:00
140 changed files with 13065 additions and 622 deletions

View File

@@ -14,10 +14,12 @@ http://mozilla.org/MPL/2.0/.
#include "vehicle/Driver.h"
#include "vehicle/Button.h"
#include "vehicle/Gauge.h"
#include "vehicle/enginestart.h"
#include "audio/sound.h"
#include "scripting/PyInt.h"
#include "input/command.h"
#include "scripting/pythonscreenviewer.h"
#include "scripting/scriptscreens.h"
#include "utilities/dictionary.h"
#undef snprintf // pyint.h->python
@@ -144,6 +146,14 @@ class TTrain {
using screenentry_sequence = std::vector<screen_entry>;
// a screen of the cab drawn by a script (luascreen:, wasmscreen: in the .mmd)
struct script_screen_entry {
script_screens::screen_config config;
dictionary_source parameters; // the config's parameters, pre-processed
std::shared_ptr<script_screen> screen;
std::shared_ptr<std::vector<glm::vec2>> touch_list;
};
// methods
bool CabChange(int iDirection);
bool ShowNextCurrent{false}; // pokaz przd w podlaczonej lokomotywie (ET41)
@@ -189,6 +199,8 @@ class TTrain {
// sets cabin controls based on current state of the vehicle
// NOTE: we can get rid of this function once we have per-cab persistent state
void set_cab_controls( int const Cab );
// sets the cab interior light as the selected light preset says, if it says anything (eu07/maszyna#529)
void set_cab_light_from_lights_preset();
// initializes a gauge matching provided label. returns: true if the label was found, false otherwise
bool initialize_gauge(cParser &Parser, std::string const &Label, int const Cabindex);
// initializes a button matching provided label. returns: true if the label was found, false otherwise
@@ -214,6 +226,10 @@ class TTrain {
void change_pantograph_selection( int const Change );
// helper, common part of pantograh valves state update methods
void update_pantograph_valves();
// the Index-th other vehicle in multiple whose engine the cab starts with its own switches (0: mainb_*, 1: mainc_*)
TMoverParameters *remote_engine( std::size_t const Index ) const;
// the switches starting the engines of the other vehicles in multiple, for Deltatime seconds
void update_remote_linebreakers( double const Deltatime );
// update function subroutines
void update_sounds( double const Deltatime );
void update_sounds_runningnoise( sound_source &Sound );
@@ -227,6 +243,10 @@ class TTrain {
end cab_to_end() const {
return cab_to_end( iCabn ); }
void update_screens(double dt);
void update_script_screens();
// finds the submodel and the texture a cab screen is drawn on. returns false when the screen is to be ignored
bool find_screen_surface(std::string const &Target, std::string_view Kind, TSubModel *&Submodel, ITexture *&Texture) const;
void load_script_screen(cParser &Parser, script_language Language);
// command handlers
// NOTE: we're currently using universal handlers and static handler map but it may be beneficial to have these implemented on individual class instance basis
@@ -339,6 +359,9 @@ class TTrain {
static void OnCommand_linebreakertoggle( TTrain *Train, command_data const &Command );
static void OnCommand_linebreakeropen( TTrain *Train, command_data const &Command );
static void OnCommand_linebreakerclose( TTrain *Train, command_data const &Command );
static void OnCommand_linebreakertoggleremote( TTrain *Train, command_data const &Command );
static void OnCommand_linebreakeropenremote( TTrain *Train, command_data const &Command );
static void OnCommand_linebreakercloseremote( TTrain *Train, command_data const &Command );
static void OnCommand_fuelpumptoggle( TTrain *Train, command_data const &Command );
static void OnCommand_fuelpumpenable( TTrain *Train, command_data const &Command );
static void OnCommand_fuelpumpdisable( TTrain *Train, command_data const &Command );
@@ -497,6 +520,9 @@ class TTrain {
static void OnCommand_fmradiotuneincrease(TTrain *Train, command_data const &Command);
static void OnCommand_fmradiotunedecrease(TTrain *Train, command_data const &Command);
static void OnCommand_fmradiotuneset(TTrain *Train, command_data const &Command);
static void OnCommand_radiofusetoggle(TTrain *Train, command_data const &Command);
static void OnCommand_radiofuseenable(TTrain *Train, command_data const &Command);
static void OnCommand_radiofusedisable(TTrain *Train, command_data const &Command);
static void OnCommand_cabchangeforward( TTrain *Train, command_data const &Command );
static void OnCommand_cabchangebackward( TTrain *Train, command_data const &Command );
static void OnCommand_generictoggle( TTrain *Train, command_data const &Command );
@@ -578,6 +604,15 @@ public: // reszta może by?publiczna
TGauge ggMainOffButton;
TGauge ggMainOnButton;
TGauge ggMainButton; // EZT
// the line breaker / engine start switches of the second and the third vehicle in multiple (mainb_*, mainc_*)
struct remote_linebreaker {
TGauge main_switch; // mainb_sw:
TGauge on_button; // mainb_on_bt:
TGauge off_button; // mainb_off_bt:
bool held_without_switch{ false }; // closed by a command, in a cab without a switch for it
engine_start::remote_switch state;
};
std::array<remote_linebreaker, 2> m_remotelinebreakers;
TGauge ggSecurityResetButton;
TGauge ggSHPResetButton;
TGauge ggReleaserButton;
@@ -603,6 +638,10 @@ public: // reszta może by?publiczna
TGauge ggRadioVolumeSelector;
TGauge ggRadioVolumePrevious;
TGauge ggRadioVolumeNext;
TGauge ggRadioOnButton;
TGauge ggRadioOffButton;
TGauge ggRadioFuseOnButton;
TGauge ggRadioFuseOffButton;
TGauge ggUpperLightButton;
TGauge ggLeftLightButton;
TGauge ggRightLightButton;
@@ -768,6 +807,7 @@ public: // reszta może by?publiczna
TButton btLampkaSprezarkaOff;
TButton btLampkaSprezarkaBOff;
TButton btLampkaFuelPumpOff;
TButton btLampkaOilPump;
TButton btLampkaBocznik1;
TButton btLampkaBocznik2;
TButton btLampkaBocznik3;
@@ -916,6 +956,7 @@ private:
bool m_mastercontrollerinuse { false };
float m_mastercontrollerreturndelay { 0.f };
screenentry_sequence m_screens;
std::vector<script_screen_entry> m_scriptscreens;
uint16_t vid { 0 }; // train network recipient id
float m_distancecounter { -1.f }; // distance traveled since meter was activated or -1 if inactive
double m_brakehandlecp{ 0.0 };