aboutsummaryrefslogtreecommitdiff
path: root/engines/zvision
diff options
context:
space:
mode:
authorrichiesams2013-07-29 21:42:07 -0500
committerrichiesams2013-08-04 13:32:48 -0500
commit93c6670f6f80b98dd05df09d710b3c683cfd1173 (patch)
tree59feaf42ce7b31bc0525d5279cc98b95b9e7fc83 /engines/zvision
parent032afd3c1a6fe929cafde4f30f4c1e59b7ac6a89 (diff)
downloadscummvm-rg350-93c6670f6f80b98dd05df09d710b3c683cfd1173.tar.gz
scummvm-rg350-93c6670f6f80b98dd05df09d710b3c683cfd1173.tar.bz2
scummvm-rg350-93c6670f6f80b98dd05df09d710b3c683cfd1173.zip
ZVISION: Create clone member function for ResultAction class
Diffstat (limited to 'engines/zvision')
-rw-r--r--engines/zvision/actions.cpp36
-rw-r--r--engines/zvision/actions.h11
2 files changed, 47 insertions, 0 deletions
diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp
index 791eda11e0..35e5d4886d 100644
--- a/engines/zvision/actions.cpp
+++ b/engines/zvision/actions.cpp
@@ -37,6 +37,10 @@ ActionAdd::ActionAdd(Common::String *line) {
sscanf(line->c_str(), ":add(%u,%hhu)", &_key, &_value);
}
+ResultAction *ActionAdd::clone() const {
+ return new ActionAdd(*this);
+}
+
bool ActionAdd::execute(ZVision *engine) {
engine->getScriptManager()->addToStateValue(_key, _value);
return true;
@@ -51,6 +55,10 @@ ActionAssign::ActionAssign(Common::String *line) {
sscanf(line->c_str(), ":assign(%u, %hhu)", &_key, &_value);
}
+ResultAction *ActionAssign::clone() const {
+ return new ActionAssign(*this);
+}
+
bool ActionAssign::execute(ZVision *engine) {
engine->getScriptManager()->setStateValue(_key, _value);
return true;
@@ -65,6 +73,10 @@ ActionAttenuate::ActionAttenuate(Common::String *line) {
sscanf(line->c_str(), ":assign(%u, %hd)", &_key, &_attenuation);
}
+ResultAction *ActionAttenuate::clone() const {
+ return new ActionAttenuate(*this);
+}
+
bool ActionAttenuate::execute(ZVision *engine) {
// TODO: Implement
return true;
@@ -79,6 +91,10 @@ ActionChangeLocation::ActionChangeLocation(Common::String *line) {
sscanf(line->c_str(), ":change_location(%c,%c,%2c,%hu)", &_world, &_room, &_nodeview, &_x);
}
+ResultAction *ActionChangeLocation::clone() const {
+ return new ActionChangeLocation(*this);
+}
+
bool ActionChangeLocation::execute(ZVision *engine) {
// TODO: Implement
return true;
@@ -95,6 +111,10 @@ ActionCrossfade::ActionCrossfade(Common::String *line) {
&_keyOne, &_keyTwo, &_oneStartVolume, &_twoStartVolume, &_oneEndVolume, &_twoEndVolume, &_timeInMillis);
}
+ResultAction *ActionCrossfade::clone() const {
+ return new ActionCrossfade(*this);
+}
+
bool ActionCrossfade::execute(ZVision *engine) {
// TODO: Implement
return true;
@@ -110,6 +130,10 @@ ActionPreloadAnimation::ActionPreloadAnimation(Common::String *line) {
sscanf(line->c_str(), ":animpreload:%u(%s %*hhu %*hhu %u %hhu)", &_key, &_fileName, &_mask, &_framerate);
}
+ResultAction *ActionPreloadAnimation::clone() const {
+ return new ActionPreloadAnimation(*this);
+}
+
bool ActionPreloadAnimation::execute(ZVision *engine) {
// TODO: Implement
return true;
@@ -127,6 +151,10 @@ ActionPlayAnimation::ActionPlayAnimation(Common::String *line) {
&_key, &_x, &_y, &_width, &_height, &_start, &_end, &_loop, &_mask, &_framerate);
}
+ResultAction *ActionPlayAnimation::clone() const {
+ return new ActionPlayAnimation(*this);
+}
+
bool ActionPlayAnimation::execute(ZVision *engine) {
// TODO: Implement
return true;
@@ -141,6 +169,10 @@ ActionRandom::ActionRandom(Common::String *line) {
sscanf(line->c_str(), ":random:%u, %u)", &_key, &_max);
}
+ResultAction *ActionRandom::clone() const {
+ return new ActionRandom(*this);
+}
+
bool ActionRandom::execute(ZVision *engine) {
uint32 randNumber = engine->getRandomSource()->getRandomNumber(_max);
engine->getScriptManager()->setStateValue(_key, randNumber);
@@ -156,6 +188,10 @@ ActionTimer::ActionTimer(Common::String *line) {
sscanf(line->c_str(), ":timer:%u(%hu)", &_key, &_time);
}
+ResultAction *ActionTimer::clone() const {
+ return new ActionTimer(*this);
+}
+
bool ActionTimer::execute(ZVision *engine) {
engine->getScriptManager()->addActionNode(new NodeTimer(_key, _time));
return true;
diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h
index 224f9011a1..75cffab59b 100644
--- a/engines/zvision/actions.h
+++ b/engines/zvision/actions.h
@@ -35,6 +35,7 @@ class ZVision;
class ResultAction {
public:
virtual ~ResultAction() {}
+ virtual ResultAction *clone() const = 0;
virtual bool execute(ZVision *engine) = 0;
};
@@ -73,6 +74,7 @@ public:
class ActionAdd : public ResultAction {
public:
ActionAdd(Common::String *line);
+ ResultAction *clone() const;
bool execute(ZVision *engine);
private:
@@ -83,6 +85,7 @@ private:
class ActionAssign : public ResultAction {
public:
ActionAssign(Common::String *line);
+ ResultAction *clone() const;
bool execute(ZVision *engine);
private:
@@ -93,6 +96,7 @@ private:
class ActionAttenuate : public ResultAction {
public:
ActionAttenuate(Common::String *line);
+ ResultAction *clone() const;
bool execute(ZVision *engine);
private:
@@ -103,6 +107,7 @@ private:
class ActionChangeLocation : public ResultAction {
public:
ActionChangeLocation(Common::String *line);
+ ResultAction *clone() const;
bool execute(ZVision *engine);
private:
@@ -115,6 +120,7 @@ private:
class ActionCrossfade : public ResultAction {
public:
ActionCrossfade(Common::String *line);
+ ResultAction *clone() const;
bool execute(ZVision *engine);
private:
@@ -130,6 +136,7 @@ private:
class ActionDelayRender : public ResultAction {
public:
ActionDelayRender(Common::String *line);
+ ResultAction *clone() const;
bool execute(ZVision *engine);
private:
@@ -140,6 +147,7 @@ private:
class ActionPlayAnimation : public ResultAction {
public:
ActionPlayAnimation(Common::String *line);
+ ResultAction *clone() const;
bool execute(ZVision *engine);
private:
@@ -159,6 +167,7 @@ private:
class ActionPreloadAnimation : public ResultAction {
public:
ActionPreloadAnimation(Common::String *line);
+ ResultAction *clone() const;
bool execute(ZVision *engine);
private:
@@ -178,6 +187,7 @@ private:
class ActionRandom : public ResultAction {
public:
ActionRandom(Common::String *line);
+ ResultAction *clone() const;
bool execute(ZVision *engine);
private:
@@ -188,6 +198,7 @@ private:
class ActionTimer : public ResultAction {
public:
ActionTimer(Common::String *line);
+ ResultAction *clone() const;
bool execute(ZVision *engine);
private: