ScummVM API documentation
script.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_H
23#define PHOENIXVR_SCRIPT_H
24
25#include "common/hash-str.h"
26#include "common/hashmap.h"
27#include "common/ptr.h"
28#include "common/str.h"
29#include "phoenixvr/commands.h"
30
31namespace Common {
32class SeekableReadStream;
33}
34
35namespace PhoenixVR {
36class Parser;
37class Script {
38public:
39 struct Test {
40 int idx;
41 int hover;
42 Scope scope;
43 ScopePtr enter;
44 ScopePtr leave;
45 };
47
48 struct Warp {
49 Common::String vrFile;
50 Common::String testFile;
52
53 void parseLine(const Common::String &line, uint lineno);
54 TestPtr getTest(int idx) const;
55 TestPtr getLastTest(int idx) const;
56 TestPtr getDefaultTest() const {
57 return getTest(-1);
58 }
59 };
60
63
64protected:
69 Common::String name;
70 int value;
71 };
73
74 virtual void parseLine(const Common::String &line, uint lineno) = 0;
75
76public:
77 Script();
78 virtual ~Script();
79
80 static Script *load(Common::SeekableReadStream &s, int version);
81
82 int getWarp(const Common::String &name) const;
83 ConstWarpPtr getWarp(int index) const;
84 ConstWarpPtr getInitScript() const;
85
86 uint numWarps() const {
87 return _warps.size();
88 }
89
90 const Common::Array<Common::String> &getWarpNames() const {
91 return _warpNames;
92 }
93 const Common::Array<VariableDeclaration> &getVars() const {
94 return _vars;
95 }
96};
97} // namespace PhoenixVR
98
99#endif
Definition: array.h:52
size_type size() const
Definition: array.h:316
Definition: stream.h:745
Definition: str.h:59
Definition: script.h:37
Definition: algorithm.h:29
Definition: commands.h:48
Definition: script.h:39
Definition: script.h:48