ScummVM API documentation
changecommand.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #include "mutationofjb/commands/seqcommand.h"
23 #include "mutationofjb/gamedata.h"
24 
25 namespace MutationOfJB {
26 
28  uint8 _byteVal;
29  uint16 _wordVal;
30  char _strVal[MAX_ENTITY_NAME_LENGTH + 1];
31 };
32 
33 class ChangeCommand : public SeqCommand {
34 public:
35  enum ChangeRegister {
36  NM, // Name
37  LT, // Destination scene ID
38  SX, // Destination X
39  SY, // Destination Y
40  XX, // X
41  YY, // Y
42  XL, // Width
43  YL, // Height
44  WX, // Walk to X
45  WY, // Walk to Y
46  SP, //
47  AC, // Active
48  FA, // First animation
49  FR,
50  NA,
51  FS,
52  CA,
53  DS, // Startup
54  DL,
55  ND, // Number of doors
56  NO, // Number of objects
57  NS, // Number of statics
58  PF, // Palette rotation first
59  PL, // Palette rotation last
60  PD // Palette rotation delay
61  };
62 
63  enum ChangeOperation {
64  SetValue,
65  AddValue,
66  SubtractValue
67  };
68 
69  ChangeCommand(uint8 sceneId, uint8 entityId, ChangeRegister reg, ChangeOperation op, const ChangeCommandValue &val) :
70  _sceneId(sceneId), _entityId(entityId), _register(reg), _operation(op), _value(val)
71  {}
72 protected:
73  const char *getRegisterAsString() const;
74  Common::String getValueAsString() const;
75  const char *getOperationAsString() const;
76 
77  uint8 _sceneId;
78  uint8 _entityId;
79  ChangeRegister _register;
80  ChangeOperation _operation;
81  ChangeCommandValue _value;
82 };
83 
85 protected:
86  bool parseValueString(const Common::String &valueString, bool changeEntity, uint8 &sceneId, uint8 &entityId, ChangeCommand::ChangeRegister &reg, ChangeCommand::ChangeOperation &op, ChangeCommandValue &ccv);
87  int parseInteger(const char *val, ChangeCommand::ChangeOperation &op);
88 };
89 
91 public:
92  bool parse(const Common::String &line, ScriptParseContext &parseCtx, Command *&command) override;
93 };
94 
96 public:
97  bool parse(const Common::String &line, ScriptParseContext &parseCtx, Command *&command) override;
98 };
99 
101 public:
102  bool parse(const Common::String &line, ScriptParseContext &parseCtx, Command *&command) override;
103 };
104 
106 public:
107  bool parse(const Common::String &line, ScriptParseContext &parseCtx, Command *&command) override;
108 };
109 
111 public:
112  ChangeDoorCommand(uint8 sceneId, uint8 doorId, ChangeRegister reg, ChangeOperation op, const ChangeCommandValue &val)
113  : ChangeCommand(sceneId, doorId, reg, op, val)
114  {}
115  ExecuteResult execute(ScriptExecutionContext &scriptExecCtx) override;
116  Common::String debugString() const override;
117 };
118 
120 public:
121  ChangeObjectCommand(uint8 sceneId, uint8 objectId, ChangeRegister reg, ChangeOperation op, const ChangeCommandValue &val)
122  : ChangeCommand(sceneId, objectId, reg, op, val)
123  {}
124  ExecuteResult execute(ScriptExecutionContext &scriptExecCtx) override;
125  Common::String debugString() const override;
126 };
127 
129 public:
130  ChangeStaticCommand(uint8 sceneId, uint8 staticId, ChangeRegister reg, ChangeOperation op, const ChangeCommandValue &val)
131  : ChangeCommand(sceneId, staticId, reg, op, val)
132  {}
133  ExecuteResult execute(ScriptExecutionContext &scriptExecCtx) override;
134  Common::String debugString() const override;
135 };
136 
138 public:
139  ChangeSceneCommand(uint8 sceneId, uint8 staticId, ChangeRegister reg, ChangeOperation op, const ChangeCommandValue &val)
140  : ChangeCommand(sceneId, staticId, reg, op, val)
141  {}
142  ExecuteResult execute(ScriptExecutionContext &scriptExecCtx) override;
143  Common::String debugString() const override;
144 };
145 
146 }
Definition: str.h:59
Definition: changecommand.h:90
Definition: script.h:106
Definition: seqcommand.h:30
Definition: changecommand.h:105
Definition: script.h:71
Definition: command.h:85
Definition: changecommand.h:119
Definition: changecommand.h:27
Definition: changecommand.h:84
Definition: animationdecoder.h:36
Definition: background.h:31
Definition: changecommand.h:128
Definition: seqcommand.h:38
Definition: changecommand.h:100
Definition: changecommand.h:110
Definition: changecommand.h:137
Definition: changecommand.h:33
Definition: changecommand.h:95