ScummVM API documentation
execution.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 FREESCAPE_LANGUAGE_EXECUTION_H
23#define FREESCAPE_LANGUAGE_EXECUTION_H
24
25#include "freescape/language/instruction.h"
26
27namespace Freescape {
28
29// Default redraw cadence in 50 Hz ticks.
30static const uint32 kFCLRedrawTicks = 8;
31
32enum FCLExecutionResult {
33 kFCLFinished,
34 kFCLYielded, // Resume this script after the other scripts in the frame.
35 kFCLPaused // Resume this script before advancing the frame.
36};
37
39 const FCLInstructionVector *code;
40 uint32 ip = 0;
41 explicit FCLExecutionFrame(const FCLInstructionVector *instructions = nullptr) : code(instructions) {}
42};
43
45 bool value, previousValue;
46 Token::Type operation = Token::UNKNOWN;
47 explicit FCLPredicateState(bool initialValue = false) : value(initialValue), previousValue(initialValue) {}
48
49 void combine(Token::Type op) {
50 previousValue = value;
51 operation = op;
52 }
53
54 void set(bool result) {
55 if (operation == Token::AND)
56 result = previousValue && result;
57 else if (operation == Token::OR)
58 result = previousValue || result;
59 value = result;
60 operation = Token::UNKNOWN;
61 }
62};
63
64} // namespace Freescape
65
66#endif
Definition: area.h:36
Definition: execution.h:38
Definition: execution.h:44