ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

A script resource. More...

#include <script.h>

Inheritance diagram for Stark::Resources::Script:
Collaboration diagram for Stark::Resources::Script:

List of all members.

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
}
 

Script call modes.

More...
enum  ResumeStatus { kResumeComplete, kResumeAbort, kResumeSuspend }

Public Member Functions

 Script (Object *parent, byte subType, uint16 index, const Common::String &name)
virtual ~Script ()
void readData (Formats::XRCReadStream *stream) override
 Deserialize the resource static data and initial state.
void saveLoad (ResourceSerializer *serializer) override
 Persist / restore the resource state.
void saveLoadCurrent (ResourceSerializer *serializer) override
 Persist / restore the resource state.
void onAllLoaded () override
 Called when the resource sub-tree is entirely loaded.
void onGameLoop () override
 Called once per game loop.
void reset ()
 Reset the script so that it can be executed again from the beginning.
bool isEnabled ()
 Is the script enabled?
void enable (bool value)
 Enable the script.
void stop ()
 Disable and reset the script.
bool isOnBegin ()
 Is the script on its Begin command?
bool isOnEnd ()
 Has the script ended?
CommandgetBeginCommand ()
 Get the script's startup command.
void execute (uint32 callMode)
 Attempt to run the script using the specified call mode.
void pause (int32 msecs)
 Pause the script for the specified time.
void suspend (Object *cause)
 Suspend the script while the specified resource is running.
bool isSuspended ()
 Is the script paused, or waiting for a resource to complete?
ObjectgetSuspendingResource () const
 Get the resource the script is waiting to complete, if any.
bool shouldExecute (uint32 callMode)
 Returns true if the script is enabled and valid for this call mode.
void goToNextCommand ()
 Step the script to the next command, overriding all checks.
void addReturnObject (Object *object)
 Add an object to the return list.
void setResumeStatus (ResumeStatus status)
 Set the outcome of a suspension (completion or abortion).

Static Public Attributes

static const Type::ResourceType TYPE = Type::kScript

Protected Member Functions

void print (uint depth) override
 Print debug information for the resource.
void printData () override
void updateSuspended ()
void resumeCallerExecution (Object *callerObject)

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

Detailed Description

A script resource.

Scripts are made of a collection of Command resources. Commands return the next command to be executed, allowing for branches.

Definition at line 46 of file stark/resources/script.h.


Member Enumeration Documentation

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.

Enumerator:
kCallModeGameLoop 
kCallModeExitLocation 
kCallModeEnterLocation 
kCallModePlayerAction 
kCallModeDialogCreateSelections 
kCallModeDialogAnswer 

Definition at line 77 of file stark/resources/script.h.

Enumerator:
kGameEventOnGameLoop 
kGameEventOnEnterLocation 
kGameEventOnExitLocation 

Definition at line 64 of file stark/resources/script.h.

Enumerator:
kResumeComplete 
kResumeAbort 
kResumeSuspend 

Definition at line 86 of file stark/resources/script.h.

Enumerator:
kScriptTypeOnGameEvent 
kScriptTypePassiveDialog 
kScriptTypeOnPlayerAction 
kScriptType3 
kScriptType4 

Definition at line 56 of file stark/resources/script.h.

Enumerator:
kSubTypeGameEvent 
kSubTypePlayerAction 
kSubTypeDialog 

Definition at line 50 of file stark/resources/script.h.


Constructor & Destructor Documentation

Stark::Resources::Script::Script ( Object parent,
byte  subType,
uint16  index,
const Common::String name 
)

Definition at line 47 of file stark/resources/script.cpp.

Stark::Resources::Script::~Script (  )  [virtual]

Definition at line 44 of file stark/resources/script.cpp.


Member Function Documentation

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

Definition at line 377 of file stark/resources/script.cpp.

void Stark::Resources::Script::enable ( bool  value  ) 

Enable the script.

Definition at line 136 of file stark/resources/script.cpp.

void Stark::Resources::Script::execute ( uint32  callMode  ) 

Attempt to run the script using the specified call mode.

Definition at line 312 of file stark/resources/script.cpp.

Command * Stark::Resources::Script::getBeginCommand (  ) 

Get the script's startup command.

Definition at line 117 of file stark/resources/script.cpp.

Object * Stark::Resources::Script::getSuspendingResource (  )  const

Get the resource the script is waiting to complete, if any.

Definition at line 190 of file stark/resources/script.cpp.

void Stark::Resources::Script::goToNextCommand (  ) 

Step the script to the next command, overriding all checks.

Definition at line 308 of file stark/resources/script.cpp.

bool Stark::Resources::Script::isEnabled (  ) 

Is the script enabled?

Definition at line 121 of file stark/resources/script.cpp.

bool Stark::Resources::Script::isOnBegin (  ) 

Is the script on its Begin command?

Definition at line 109 of file stark/resources/script.cpp.

bool Stark::Resources::Script::isOnEnd (  ) 

Has the script ended?

Definition at line 113 of file stark/resources/script.cpp.

bool Stark::Resources::Script::isSuspended (  ) 

Is the script paused, or waiting for a resource to complete?

Definition at line 186 of file stark/resources/script.cpp.

void Stark::Resources::Script::onAllLoaded (  )  [override, virtual]

Called when the resource sub-tree is entirely loaded.

Allows to load data from other nodes.

Reimplemented from Stark::Resources::Object.

Definition at line 86 of file stark/resources/script.cpp.

void Stark::Resources::Script::onGameLoop (  )  [override, virtual]

Called once per game loop.

Reimplemented from Stark::Resources::Object.

Definition at line 91 of file stark/resources/script.cpp.

void Stark::Resources::Script::pause ( int32  msecs  ) 

Pause the script for the specified time.

Definition at line 295 of file stark/resources/script.cpp.

void Stark::Resources::Script::print ( uint  depth  )  [override, protected, virtual]

Print debug information for the resource.

Reimplemented from Stark::Resources::Object.

Definition at line 381 of file stark/resources/script.cpp.

void Stark::Resources::Script::printData (  )  [override, protected, virtual]

Reimplemented from Stark::Resources::Object.

Definition at line 405 of file stark/resources/script.cpp.

void Stark::Resources::Script::readData ( Formats::XRCReadStream stream  )  [override, virtual]

Deserialize the resource static data and initial state.

Reimplemented from Stark::Resources::Object.

Definition at line 62 of file stark/resources/script.cpp.

void Stark::Resources::Script::reset (  ) 

Reset the script so that it can be executed again from the beginning.

Definition at line 96 of file stark/resources/script.cpp.

void Stark::Resources::Script::resumeCallerExecution ( Object callerObject  )  [protected]

Definition at line 360 of file stark/resources/script.cpp.

void Stark::Resources::Script::saveLoad ( ResourceSerializer serializer  )  [override, virtual]

Persist / restore the resource state.

Reimplemented from Stark::Resources::Object.

Definition at line 413 of file stark/resources/script.cpp.

void Stark::Resources::Script::saveLoadCurrent ( ResourceSerializer serializer  )  [override, virtual]

Persist / restore the resource state.

Called only for active locations

Reimplemented from Stark::Resources::Object.

Definition at line 417 of file stark/resources/script.cpp.

void Stark::Resources::Script::setResumeStatus ( ResumeStatus  status  ) 

Set the outcome of a suspension (completion or abortion).

Definition at line 304 of file stark/resources/script.cpp.

bool Stark::Resources::Script::shouldExecute ( uint32  callMode  ) 

Returns true if the script is enabled and valid for this call mode.

Definition at line 142 of file stark/resources/script.cpp.

void Stark::Resources::Script::stop (  ) 

Disable and reset the script.

Definition at line 289 of file stark/resources/script.cpp.

void Stark::Resources::Script::suspend ( Object cause  ) 

Suspend the script while the specified resource is running.

Definition at line 299 of file stark/resources/script.cpp.

void Stark::Resources::Script::updateSuspended (  )  [protected]

Definition at line 194 of file stark/resources/script.cpp.


Member Data Documentation

Definition at line 168 of file stark/resources/script.h.

const Type::ResourceType Stark::Resources::Script::TYPE = Type::kScript [static]

Definition at line 48 of file stark/resources/script.h.


The documentation for this class was generated from the following files:


Generated on Sat Jan 12 2019 05:05:22 for ResidualVM by doxygen 1.7.1
curved edge   curved edge