16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-21 11:19:19 +02:00

Merge branch 'tmj-dev' into milek-dev

This commit is contained in:
milek7
2018-06-15 18:58:03 +02:00
54 changed files with 2310 additions and 927 deletions

56
Event.h
View File

@@ -17,7 +17,6 @@ http://mozilla.org/MPL/2.0/.
enum TEventType {
tp_Unknown,
tp_Sound,
tp_SoundPos,
tp_Exit,
tp_Disable,
tp_Velocity,
@@ -31,7 +30,6 @@ enum TEventType {
tp_TrackVel,
tp_Multiple,
tp_AddValues,
// tp_Ignored, // NOTE: refactored to separate flag
tp_CopyValues,
tp_WhoIs,
tp_LogValues,
@@ -51,7 +49,6 @@ const int update_only = 0x00000FF; // wartość graniczna
const int conditional_memstring = 0x0000100; // porównanie tekstu
const int conditional_memval1 = 0x0000200; // porównanie pierwszej wartości liczbowej
const int conditional_memval2 = 0x0000400; // porównanie drugiej wartości
const int conditional_anyelse = 0x0FF0000; // do sprawdzania, czy są odwrócone warunki
const int conditional_trackoccupied = 0x1000000; // jeśli tor zajęty
const int conditional_trackfree = 0x2000000; // jeśli tor wolny
const int conditional_propability = 0x4000000; // zależnie od generatora lizcb losowych
@@ -61,7 +58,7 @@ union TParam
{
void *asPointer;
TMemCell *asMemCell;
editor::basic_node *asEditorNode;
scene::basic_node *asSceneNode;
glm::dvec3 const *asLocation;
TTrack *asTrack;
TAnimModel *asModel;
@@ -69,7 +66,6 @@ union TParam
TTrain *asTrain;
TDynamicObject *asDynamic;
TEvent *asEvent;
bool asBool;
double asdouble;
int asInt;
sound_source *tsTextSound;
@@ -80,10 +76,27 @@ union TParam
class TEvent // zmienne: ev*
{ // zdarzenie
private:
void Conditions(cParser *parser, std::string s);
public:
public:
// types
// wrapper for binding between editor-supplied name, event, and execution conditional flag
using conditional_event = std::tuple<std::string, TEvent *, bool>;
// constructors
TEvent(std::string const &m = "");
~TEvent();
// metody
void Load(cParser *parser, Math3D::vector3 const &org);
// sends basic content of the class in legacy (text) format to provided stream
void
export_as_text( std::ostream &Output ) const;
static void AddToQuery( TEvent *Event, TEvent *&Start );
std::string CommandGet();
TCommandType Command();
double ValueGet(int n);
glm::dvec3 PositionGet() const;
bool StopCommand();
void StopCommandSent();
void Append(TEvent *e);
// members
std::string asName;
bool m_ignored { false }; // replacement for tp_ignored
bool bEnabled = false; // false gdy ma nie być dodawany do kolejki (skanowanie sygnałów)
@@ -95,27 +108,15 @@ class TEvent // zmienne: ev*
TDynamicObject *Activator = nullptr;
TParam Params[13]; // McZapkie-070502 //Ra: zamienić to na union/struct
// this is already mess, so one more hack won't make it much worse...
// stores TParam union and magic flag (eg. else flag)
std::vector<std::pair<TParam, int>> ext_params;
unsigned int iFlags = 0; // zamiast Params[8] z flagami warunku
std::string asNodeName; // McZapkie-100302 - dodalem zeby zapamietac nazwe toru
TEvent *evJoined = nullptr; // kolejny event z tą samą nazwą - od wersji 378
double fRandomDelay = 0.0; // zakres dodatkowego opóźnienia // standardowo nie będzie dodatkowego losowego opóźnienia
public:
// metody
TEvent(std::string const &m = "");
~TEvent();
void Load(cParser *parser, Math3D::vector3 const &org);
static void AddToQuery( TEvent *Event, TEvent *&Start );
std::string CommandGet();
TCommandType Command();
double ValueGet(int n);
glm::dvec3 PositionGet() const;
bool StopCommand();
void StopCommandSent();
void Append(TEvent *e);
std::vector<conditional_event> m_children; // events which are placed in the query when this event is executed
bool m_conditionalelse { false }; // TODO: make a part of condition struct
private:
void Conditions( cParser *parser, std::string s );
};
class event_manager {
@@ -156,6 +157,9 @@ public:
// legacy method, initializes event launchers after deserialization from scenario file
void
InitLaunchers();
// sends basic content of the class in legacy (text) format to provided stream
void
export_as_text( std::ostream &Output ) const;
private:
// types