ScriptGraphics class
The sprites the script of a level gives the objects of the events, so the editor shows them.
The script runs in a level of its own, loaded as the game loads it but with no players and nothing shown of it, only until onLevelLoad() returns. The templates of the objects (jjObjectPresets) it gave another animation then, or whose frames it changed, are taken with the frames of their animations, and the level goes away with whatever else the script did; the palette of the sprites is put back. An event is matched to a template by the event of the original game it converts from.
Constructors, destructors, conversion operators
- ScriptGraphics()
- ~ScriptGraphics()
- ScriptGraphics(const ScriptGraphics&) deleted
Public functions
- auto operator=(const ScriptGraphics&) -> ScriptGraphics& deleted
- auto Capture(IRootController* root, const LevelDocument& document, StringView levelName, StringView fullPath, StringView scriptText = {}) -> bool
- Runs the script of a level and takes the sprites it gives the objects, returns
falseif there are none. - void Clear()
- Forgets all sprites.
- auto IsEmpty() const -> bool
- Returns
trueif there are no sprites. -
auto Find(const Formats::
EventRecord& event, bool animated, bool ownAnimated) -> Resources:: GraphicResource* - Returns the sprite the script gives the object of an event, or
nullptr. -
auto FindWeaponIcon(std::
int32_t weapon, bool powered) -> Resources:: GraphicResource* - Returns the sprite a weapon of the script shows on the screen, as the hook of the weapons of MLLE draws it, or
nullptr.
Function documentation
bool Jazz2:: Editor:: ScriptGraphics:: Capture(IRootController* root,
const LevelDocument& document,
StringView levelName,
StringView fullPath,
StringView scriptText = {})
Runs the script of a level and takes the sprites it gives the objects, returns false if there are none.
A non-empty scriptText is run in place of the script file, see DocumentFiles::
Resources:: GraphicResource* Jazz2:: Editor:: ScriptGraphics:: Find(const Formats:: EventRecord& event,
bool animated,
bool ownAnimated)
Returns the sprite the script gives the object of an event, or nullptr.
With animated its animation plays as a behavior of JJ2 plays it, otherwise it shows the frame the object starts with, as an object of the game that doesn't animate (crates) shows it. A template that keeps the animation of the game, only with other frames, plays it only if ownAnimated says the sprite of the game does too.
Resources:: GraphicResource* Jazz2:: Editor:: ScriptGraphics:: FindWeaponIcon(std:: int32_t weapon,
bool powered)
Returns the sprite a weapon of the script shows on the screen, as the hook of the weapons of MLLE draws it, or nullptr.
The weapon is a WeaponType, the blaster is 0.