#include <script.h>
Public Types | |
| enum | SubType { kSubTypeGameEvent = 4, kSubTypePlayerAction = 5, kSubTypeDialog = 6 } |
| enum | ScriptType { kScriptTypeOnGameEvent = 0, kScriptTypePassiveDialog = 1, kScriptTypeOnPlayerAction = 2, kScriptType3 = 3, kScriptType4 = 4 } |
| enum | GameEvent { kGameEventOnGameLoop = 0, kGameEventOnEnterLocation = 1, kGameEventOnExitLocation = 2 } |
| enum | CallMode { kCallModeGameLoop = 1, kCallModeExitLocation = 2, kCallModeEnterLocation = 3, kCallModePlayerAction = 4, kCallModeDialogCreateSelections = 5, kCallModeDialogAnswer = 6 } |
| enum | ResumeStatus { kResumeComplete, kResumeAbort, kResumeSuspend } |
Public Member Functions | |
| Script (Object *parent, byte subType, uint16 index, const Common::String &name) | |
| void | readData (Formats::XRCReadStream *stream) override |
| void | saveLoad (ResourceSerializer *serializer) override |
| void | saveLoadCurrent (ResourceSerializer *serializer) override |
| void | onAllLoaded () override |
| void | onGameLoop () override |
| void | reset () |
| bool | isEnabled () |
| void | enable (bool value) |
| void | stop () |
| bool | isOnBegin () |
| bool | isOnEnd () |
| Command * | getBeginCommand () |
| void | execute (uint32 callMode) |
| void | pause (int32 msecs) |
| void | suspend (Object *cause) |
| bool | isSuspended () |
| Object * | getSuspendingResource () const |
| bool | shouldExecute (uint32 callMode) |
| void | goToNextCommand () |
| void | addReturnObject (Object *object) |
| void | setResumeStatus (ResumeStatus status) |
Public Member Functions inherited from Stark::Resources::Object | |
| Type | getType () const |
| byte | getSubType () const |
| uint16 | getIndex () const |
| Common::String | getIndexAsString () const |
| Common::String | getName () const |
| virtual void | onPostRead () |
| virtual void | onEnterLocation () |
| virtual void | onEnginePause (bool pause) |
| virtual void | onExitLocation () |
| virtual void | onPreDestroy () |
| template<class T > | |
| T * | findParent () |
| Object * | findChildWithIndex (Type type, uint16 index, int subType=-1) const |
| Object * | findChildWithOrder (Type type, uint16 order, int subType=-1) const |
| Object * | findChildWithName (Type type, const Common::String &name, int subType=-1) const |
| template<class T > | |
| T * | findChild (bool mustBeUnique=true) const |
| template<class T > | |
| T * | findChildWithSubtype (int subType, bool mustBeUnique=true) const |
| template<class T > | |
| T * | findChildWithIndex (uint16 index, int subType=-1) const |
| template<class T > | |
| T * | findChildWithOrder (uint16 order, int subType=-1) const |
| template<class T > | |
| T * | findChildWithName (const Common::String &name, int subType=-1) const |
| template<class T > | |
| Common::Array< T * > | listChildren (int subType=-1) const |
| template<class T > | |
| Common::Array< T * > | listChildrenRecursive (int subType=-1) |
| void | addChild (Object *child) |
| template<> | |
| Object * | cast (Object *resource) |
| template<> | |
| Object * | findParent () |
| template<> | |
| Common::Array< Object * > | listChildren (int subType) const |
Static Public Attributes | |
| static const Type::ResourceType | TYPE = Type::kScript |
Protected Member Functions | |
| void | print (uint depth) override |
| void | printData () override |
| void | updateSuspended () |
| void | resumeCallerExecution (Object *callerObject) |
Protected Member Functions inherited from Stark::Resources::Object | |
| Object (Object *parent, byte subType, uint16 index, const Common::String &name) | |
| void | printWithDepth (uint depth, const Common::String &string) const |
| void | printDescription (uint depth) const |
Protected Attributes | |
| uint32 | _scriptType |
| uint32 | _runEvent |
| uint32 | _minChapter |
| uint32 | _maxChapter |
| bool | _shouldResetGameSpeed |
| bool | _enabled |
| Command * | _nextCommand |
| int32 | _pauseTimeLeft |
| Object * | _suspendingResource |
| ResumeStatus | _resumeStatus |
| Common::Array< Object * > | _returnObjects |
Protected Attributes inherited from Stark::Resources::Object | |
| Type | _type |
| byte | _subType |
| uint16 | _index |
| Common::String | _name |
| Object * | _parent |
| Common::Array< Object * > | _children |
Additional Inherited Members | |
Static Public Member Functions inherited from Stark::Resources::Object | |
| template<class T > | |
| static T * | cast (Object *resource) |
A script resource
Scripts are made of a collection of Command resources. Commands return the next command to be executed, allowing for branches.
Script call modes.
Most script types are only meaningful for a call mode. The shouldExecute method checks the consistency between the script type and the call mode.
|
overridevirtual |
Deserialize the resource static data and initial state.
Reimplemented from Stark::Resources::Object.
|
overridevirtual |
Persist / restore the resource state
Reimplemented from Stark::Resources::Object.
|
overridevirtual |
Persist / restore the resource state
Called only for active locations
Reimplemented from Stark::Resources::Object.
|
overridevirtual |
Called when the resource sub-tree is entirely loaded.
Allows to load data from other nodes.
Reimplemented from Stark::Resources::Object.
|
overridevirtual |
Called once per game loop
Reimplemented from Stark::Resources::Object.
| void Stark::Resources::Script::reset | ( | ) |
Reset the script so that it can be executed again from the beginning
| bool Stark::Resources::Script::isEnabled | ( | ) |
Is the script enabled?
| void Stark::Resources::Script::enable | ( | bool | value | ) |
Enable the script
| void Stark::Resources::Script::stop | ( | ) |
Disable and reset the script
| bool Stark::Resources::Script::isOnBegin | ( | ) |
Is the script on its Begin command?
| bool Stark::Resources::Script::isOnEnd | ( | ) |
Has the script ended?
| Command* Stark::Resources::Script::getBeginCommand | ( | ) |
Get the script's startup command
| void Stark::Resources::Script::execute | ( | uint32 | callMode | ) |
Attempt to run the script using the specified call mode
| void Stark::Resources::Script::pause | ( | int32 | msecs | ) |
Pause the script for the specified time
| void Stark::Resources::Script::suspend | ( | Object * | cause | ) |
Suspend the script while the specified resource is running
| bool Stark::Resources::Script::isSuspended | ( | ) |
Is the script paused, or waiting for a resource to complete?
| Object* Stark::Resources::Script::getSuspendingResource | ( | ) | const |
Get the resource the script is waiting to complete, if any
| bool Stark::Resources::Script::shouldExecute | ( | uint32 | callMode | ) |
Returns true if the script is enabled and valid for this call mode
| void Stark::Resources::Script::goToNextCommand | ( | ) |
Step the script to the next command, overriding all checks
| void Stark::Resources::Script::addReturnObject | ( | Object * | object | ) |
Add an object to the return list.
The script will resume execution of this object once it reaches an End opcode
| void Stark::Resources::Script::setResumeStatus | ( | ResumeStatus | status | ) |
Set the outcome of a suspension (completion or abortion)
|
overrideprotectedvirtual |
Print debug information for the resource
Reimplemented from Stark::Resources::Object.