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

Lua script screens beside the WebAssembly ones

This commit is contained in:
2026-11-10 15:29:25 +01:00
parent a73585dca0
commit c4924f756d
34 changed files with 3777 additions and 1635 deletions

View File

@@ -19,7 +19,7 @@ http://mozilla.org/MPL/2.0/.
#include "scripting/PyInt.h"
#include "input/command.h"
#include "scripting/pythonscreenviewer.h"
#include "scripting/wasmscreens.h"
#include "scripting/scriptscreens.h"
#include "utilities/dictionary.h"
#undef snprintf // pyint.h->python
@@ -146,11 +146,11 @@ class TTrain {
using screenentry_sequence = std::vector<screen_entry>;
// a screen of the cab drawn by a WebAssembly module (wasmscreen: in the .mmd)
struct wasm_screen_entry {
wasm_screens::screen_config config;
// 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<wasm_screen> screen;
std::shared_ptr<script_screen> screen;
std::shared_ptr<std::vector<glm::vec2>> touch_list;
};
@@ -242,10 +242,10 @@ class TTrain {
end cab_to_end() const {
return cab_to_end( iCabn ); }
void update_screens(double dt);
void update_wasm_screens();
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_wasm_screen(cParser &Parser);
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
@@ -948,7 +948,7 @@ private:
bool m_mastercontrollerinuse { false };
float m_mastercontrollerreturndelay { 0.f };
screenentry_sequence m_screens;
std::vector<wasm_screen_entry> m_wasmscreens;
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 };