mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-06 23:13:00 +01:00
First implementation of graph vehicles
This commit is contained in:
@@ -48,10 +48,14 @@ public:
|
||||
offset,
|
||||
smoothing,
|
||||
submodel,
|
||||
sound_inc,
|
||||
sound_dec,
|
||||
sound_positions,
|
||||
key_inc,
|
||||
key_dec,
|
||||
command,
|
||||
hw_name
|
||||
hw_name,
|
||||
cab
|
||||
};
|
||||
};
|
||||
enum class behaviour_type
|
||||
@@ -136,6 +140,21 @@ public:
|
||||
{
|
||||
return m_submodel;
|
||||
}
|
||||
// sounds played by the animated submodel when the position increases or decreases, in the format of
|
||||
// soundinc: and sounddec: of the .mmd controls
|
||||
std::string const &sound_increase() const
|
||||
{
|
||||
return m_soundincrease;
|
||||
}
|
||||
std::string const &sound_decrease() const
|
||||
{
|
||||
return m_sounddecrease;
|
||||
}
|
||||
// sounds of single positions, as soundN: entries of the .mmd controls with N the number of the position
|
||||
std::string const &sound_positions() const
|
||||
{
|
||||
return m_soundpositions;
|
||||
}
|
||||
// bindings: keys, existing simulator command, name for the hardware desk
|
||||
std::string const &key_increase() const
|
||||
{
|
||||
@@ -153,6 +172,16 @@ public:
|
||||
{
|
||||
return m_hardwarename;
|
||||
}
|
||||
// cab whose model holds the submodel: 0 any, 1 or 2
|
||||
int cab() const
|
||||
{
|
||||
return m_cab;
|
||||
}
|
||||
// stable address of the value animating the submodel (the position), for TGauge::AssignFloat
|
||||
float *display_state()
|
||||
{
|
||||
return &m_display;
|
||||
}
|
||||
|
||||
static block_type describe();
|
||||
|
||||
@@ -171,11 +200,16 @@ private:
|
||||
double const m_offset;
|
||||
double const m_smoothing;
|
||||
std::string const m_submodel;
|
||||
std::string const m_soundincrease;
|
||||
std::string const m_sounddecrease;
|
||||
std::string const m_soundpositions;
|
||||
std::string const m_keyincrease;
|
||||
std::string const m_keydecrease;
|
||||
std::string const m_command;
|
||||
std::string const m_hardwarename;
|
||||
int const m_cab;
|
||||
int m_position{0};
|
||||
float m_display{0.f};
|
||||
};
|
||||
|
||||
// indicator lamp. when the graph simulates low voltage circuits and the supply input is connected, the lamp lights
|
||||
@@ -200,7 +234,10 @@ public:
|
||||
blink_period,
|
||||
min_voltage,
|
||||
power,
|
||||
submodel
|
||||
submodel,
|
||||
sound_on,
|
||||
sound_off,
|
||||
cab
|
||||
};
|
||||
};
|
||||
|
||||
@@ -229,6 +266,19 @@ public:
|
||||
{
|
||||
return m_submodel;
|
||||
}
|
||||
// sounds played when the lamp lights and goes out, as soundinc: and sounddec: of the .mmd lamps
|
||||
std::string const &sound_on() const
|
||||
{
|
||||
return m_soundon;
|
||||
}
|
||||
std::string const &sound_off() const
|
||||
{
|
||||
return m_soundoff;
|
||||
}
|
||||
int cab() const
|
||||
{
|
||||
return m_cab;
|
||||
}
|
||||
|
||||
static block_type describe();
|
||||
|
||||
@@ -239,9 +289,15 @@ private:
|
||||
double const m_minvoltage;
|
||||
double const m_power;
|
||||
std::string const m_submodel;
|
||||
std::string const m_soundon;
|
||||
std::string const m_soundoff;
|
||||
int const m_cab;
|
||||
bool m_lit{false};
|
||||
};
|
||||
|
||||
// cab given by the "cab" parameter of a cab block: 0 any, 1 or 2, -1 the engine room
|
||||
int cab_of(block_setup const &Setup);
|
||||
|
||||
// needle gauge with one or two needles: voltmeter, ammeter, speedometer, pressure gauge
|
||||
class cab_gauge final : public block
|
||||
{
|
||||
@@ -318,6 +374,10 @@ public:
|
||||
{
|
||||
return Needle == 0 ? m_submodel : m_submodel2;
|
||||
}
|
||||
int cab() const
|
||||
{
|
||||
return m_cab;
|
||||
}
|
||||
|
||||
static block_type describe(bool Twoneedles);
|
||||
|
||||
@@ -330,6 +390,7 @@ private:
|
||||
double const m_smoothing;
|
||||
std::string const m_submodel;
|
||||
std::string const m_submodel2;
|
||||
int const m_cab;
|
||||
float m_values[2]{0.f, 0.f};
|
||||
};
|
||||
|
||||
@@ -358,7 +419,8 @@ public:
|
||||
range,
|
||||
offset_x,
|
||||
offset_y,
|
||||
offset_z
|
||||
offset_z,
|
||||
cab
|
||||
};
|
||||
};
|
||||
// the same placements as sound_placement of the audio subsystem
|
||||
@@ -422,6 +484,11 @@ public:
|
||||
{
|
||||
return m_offset[2];
|
||||
}
|
||||
// for the sounds placed in the cab: the cab they belong to, 0 any
|
||||
int cab() const
|
||||
{
|
||||
return m_cab;
|
||||
}
|
||||
|
||||
static block_type describe();
|
||||
|
||||
@@ -433,9 +500,53 @@ private:
|
||||
placement_type const m_placement;
|
||||
double const m_range;
|
||||
double const m_offset[3];
|
||||
int const m_cab;
|
||||
bool m_playing{false};
|
||||
float m_volume{0.f};
|
||||
float m_pitch{1.f};
|
||||
};
|
||||
|
||||
// value published for the python screens of the cab (TTrain::GetTrainState), under the specified name
|
||||
class cab_export final : public block
|
||||
{
|
||||
public:
|
||||
struct port
|
||||
{
|
||||
enum : std::size_t
|
||||
{
|
||||
value
|
||||
};
|
||||
};
|
||||
enum class kind_type
|
||||
{
|
||||
real,
|
||||
integer,
|
||||
boolean
|
||||
};
|
||||
|
||||
explicit cab_export(block_setup const &Setup);
|
||||
|
||||
void update(frame &Frame) override;
|
||||
|
||||
std::string const &name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
kind_type kind() const
|
||||
{
|
||||
return m_kind;
|
||||
}
|
||||
double value() const
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
|
||||
static block_type describe();
|
||||
|
||||
private:
|
||||
std::string const m_name;
|
||||
kind_type const m_kind;
|
||||
double m_value{0.0};
|
||||
};
|
||||
|
||||
} // namespace vgraph
|
||||
|
||||
Reference in New Issue
Block a user