File: common.h

package info (click to toggle)
freespace2 24.2.0%2Brepack-3
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 43,740 kB
  • sloc: cpp: 595,005; ansic: 21,741; python: 1,174; sh: 457; makefile: 243; xml: 181
file content (59 lines) | stat: -rw-r--r-- 1,511 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#pragma once

#include "globalincs/flagset.h"

#include "actions/expression/ParseContext.h"
#include "actions/expression/ProgramVariables.h"
#include "math/vecmat.h"
#include "object/object.h"

class object;
class ship_subsys;

namespace actions {

struct ProgramLocals {
	object_h host;
	vec3d localPosition = vmd_zero_vector;
	matrix localOrient = vmd_identity_matrix;
	int hostSubobject = -1;

	TIMESTAMP waitTimestamp = TIMESTAMP::invalid();

	expression::ProgramVariables variables;
};

/**
 * @brief A list of flags for altering the program parsing behavior
 *
 * This should be used for differentiating between different program environments when validating the program (e.g. a
 * particle effect requires an object host).
 */
// clang-format off
FLAG_LIST(ProgramContextFlags) {
	HasObject = 0, //!< The program will be started with an object host
	HasSubobject,  //!< The program will be started with a subobject host

	NUM_VALUES
};
// clang-format on

/**
 * @brief Constructs the "table" parse context
 *
 * This is the context that is available when parsing a program from an external table (e.g. ships or weapons).
 *
 * @return The parse context
 */
expression::ParseContext getTableParseContext();

/**
 * @brief Gets a program variables instance initialized with the default values
 *
 * The values are consistent with what is required for the default table parse context;
 *
 * @return The program variables
 */
expression::ProgramVariables getDefaultTableVariables();

} // namespace actions