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 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 script.h.

Enumerator:
kGameEventOnGameLoop 
kGameEventOnEnterLocation 
kGameEventOnExitLocation 

Definition at line 64 of file script.h.

Enumerator:
kResumeComplete 
kResumeAbort 
kResumeSuspend 

Definition at line 86 of file script.h.

Enumerator:
kScriptTypeOnGameEvent 
kScriptTypePassiveDialog 
kScriptTypeOnPlayerAction 
kScriptType3 
kScriptType4 

Definition at line 56 of file script.h.

Enumerator:
kSubTypeGameEvent 
kSubTypePlayerAction 
kSubTypeDialog 

Definition at line 50 of file script.h.


Constructor & Destructor Documentation

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

Definition at line 48 of file script.cpp.

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

Definition at line 45 of file 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 387 of file script.cpp.

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

Enable the script.

Definition at line 137 of file script.cpp.

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

Attempt to run the script using the specified call mode.

Definition at line 322 of file script.cpp.

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

Get the script's startup command.

Definition at line 118 of file script.cpp.

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

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

Definition at line 191 of file script.cpp.

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

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

Definition at line 318 of file script.cpp.

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

Is the script enabled?

Definition at line 122 of file script.cpp.

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

Is the script on its Begin command?

Definition at line 110 of file script.cpp.

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

Has the script ended?

Definition at line 114 of file script.cpp.

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

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

Definition at line 187 of file 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 87 of file script.cpp.

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

Called once per game loop.

Reimplemented from Stark::Resources::Object.

Definition at line 92 of file script.cpp.

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

Pause the script for the specified time.

Definition at line 305 of file 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 391 of file script.cpp.

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

Reimplemented from Stark::Resources::Object.

Definition at line 415 of file 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 63 of file script.cpp.

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

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

Definition at line 97 of file script.cpp.

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

Definition at line 370 of file script.cpp.

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

Persist / restore the resource state.

Reimplemented from Stark::Resources::Object.

Definition at line 423 of file 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 427 of file script.cpp.

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

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

Definition at line 314 of file 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 143 of file script.cpp.

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

Disable and reset the script.

Definition at line 299 of file script.cpp.

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

Suspend the script while the specified resource is running.

Definition at line 309 of file script.cpp.

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

Definition at line 195 of file script.cpp.


Member Data Documentation

Definition at line 168 of file script.h.

Definition at line 165 of file script.h.

Definition at line 164 of file script.h.

Definition at line 169 of file script.h.

Definition at line 171 of file script.h.

Definition at line 173 of file script.h.

Definition at line 175 of file script.h.

Definition at line 163 of file script.h.

Definition at line 162 of file script.h.

Definition at line 166 of file script.h.

Definition at line 172 of file script.h.

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

Definition at line 48 of file script.h.


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


Generated on Sat Jul 20 2019 05:03:36 for ResidualVM by doxygen 1.7.1
curved edge   curved edge