ScummVM API documentation
script_v2.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#ifndef PHOENIXVR_SCRIPT_V2_H
23#define PHOENIXVR_SCRIPT_V2_H
24
25#include "phoenixvr/script.h"
26
27namespace PhoenixVR {
28class ScriptV2 : public Script {
29public:
30 struct Condition {
32 Common::String arg1;
33 Common::String arg2;
34
35 Condition(const Common::String &text);
36 bool parse(const Common::String &text, const Common::String &maybeOp);
37 int value() const;
38 };
40
41 struct Conditional : public Command {
43 ScopePtr trueScope;
44 ScopePtr falseScope;
45
47 void branch(ExecutionContext &ctx, bool branch) const;
48 };
50
51private:
52 WarpPtr _currentWarp;
53 TestPtr _currentTest;
54 Scope *_currentTestScope = nullptr;
55 struct ConditionalScope {
56 ConditionalPtr conditional;
57 ScopePtr scope;
58 };
60
61 Scope &topScope() const {
62 assert(_currentTestScope);
63 return !_conditionals.empty() ? *_conditionals.back().scope : *_currentTestScope;
64 }
65 void closeScope();
66 void closeAllScopes();
67 void closeAllScopesWithWarning(int lineno);
68
69private:
70 void parseLine(const Common::String &line, uint lineno) override;
71};
72} // namespace PhoenixVR
73
74#endif
Definition: array.h:52
T & back()
Definition: array.h:230
bool empty() const
Definition: array.h:352
Definition: str.h:59
Definition: script.h:37
Definition: script_v2.h:28
Definition: commands.h:40
Definition: commands.h:33
Definition: commands.h:48
Definition: script_v2.h:30
Definition: script_v2.h:41