dao::gui::Movie

class

A Flash movie the game is showing (GFx’s GFxMovieView).

Use it to read and set the movie’s ActionScript variables and to call its functions. Get one from MovieOf or ScreenMovie. Paths work with or without “_root.” in front. Call a movie on the thread its own calls arrive on: FSCommand and ExternalInterface handlers run there, and in the GOG build so do frame callbacks.

Declared in dao/Gui.h.

Enumerations

SetType

enum class SetType : std::int32_t

How a variable keeps a value that is set (GFx’s SetVarType).

Value  
Normal = 0 sets only what exists now; cheaper, for a variable that already exists
Sticky = 1 also applied to a clip not loaded yet, once it loads
Permanent = 2 GFx’s Permanent mode.

Functions

ArraySize()

std::uint32_t ArraySize(const char *path) const

Returns the length of an ActionScript array at a path, as GFx reports it; 0 for an empty Movie.

Call()

std::optional<Answer> Call(const char *method, std::span<const Value> args={})

Calls an ActionScript function by its path and returns its return value.

Returns the return value, of type Undefined if the function returns nothing; nullopt if the function did not run

Get()

std::optional<Answer> Get(const char *path) const

Returns the value at a path, for example a list’s scroll position, a checkbox’s state or a label.

Returns the value; nullopt if the movie has nothing at the path or the Movie is empty

GetBool()

std::optional<bool> GetBool(const char *path) const

Returns the bool at a path, or nullopt if there is nothing there or it is not a bool.

GetNumber()

std::optional<double> GetNumber(const char *path) const

Returns the number at a path, or nullopt if there is nothing there or it is not a number.

Invoke()

bool Invoke(const char *method, std::span<const Value> args={})

Calls an ActionScript function by its path, such as “_root.TurnBar.SetCardCount”.

Call does the same and also returns the function’s return value. An FSCommand or ExternalInterface handler can run before Invoke returns.

Returns true if it ran

IsAvailable()

bool IsAvailable(const char *path) const

Returns whether a path names something in the movie right now; false for an empty Movie.

Movie()

Movie(void *view)

Wraps a GFxMovieView, as MovieOf returns it.

A null view makes an empty Movie, on which every call fails.

operator bool()

operator bool() const

Returns whether it holds a movie.

SetArray()

bool SetArray(const char *path, std::span<const double> values, std::uint32_t index=0, SetType type=SetType::Sticky)

Sets elements of an ActionScript array at a path to numbers, starting at index.

SetArray()

bool SetArray(const char *path, std::span<const std::int32_t> values, std::uint32_t index=0, SetType type=SetType::Sticky)

Sets elements of an ActionScript array at a path to ints, the way the game fills _root.fsc_retval.

Parameter  
index the first element to set

Returns true if GFx set them; false if it did not or the Movie is empty

SetArray()

bool SetArray(const char *path, std::span<const Value> values, std::uint32_t index=0, SetType type=SetType::Sticky)

Sets elements of an ActionScript array at a path to values, starting at index.

SetArray()

bool SetArray(const char *path, std::span<const wchar_t *const> values, std::uint32_t index=0, SetType type=SetType::Sticky)

Sets elements of an ActionScript array at a path to wide strings, starting at index.

SetArraySize()

bool SetArraySize(const char *path, std::uint32_t count, SetType type=SetType::Sticky)

Sets the length of an ActionScript array at a path.

Returns true if GFx set it; false if it did not or the Movie is empty

SetVariable()

bool SetVariable(const char *path, const Value &value, SetType type=SetType::Sticky)

Sets an ActionScript variable at a path, such as “_root.TurnBar._visible”.

Parameter  
type how the value is kept; Sticky is GFx’s default and what the game uses

Returns true if GFx set it; false if it did not or the Movie is empty

View()

void * View() const

Returns the GFxMovieView it wraps.

Answer

A value read back from a movie, from a path or a function call.

An object, array or clip comes back as text, as ActionScript’s String() would give it; a clip gives its path.

Fields

Field Type  
boolean bool = false the value, for a Boolean
number double = 0 the value, for a Number
text std::string the value, for a string: UTF-8, copied out of the movie
type Value::Type = Value::Type::Undefined