-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgravity_actor_list.h
More file actions
99 lines (76 loc) · 2.26 KB
/
gravity_actor_list.h
File metadata and controls
99 lines (76 loc) · 2.26 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#pragma once
#include <functional>
#include "SM64DS_PI.h"
class GravityField;
class ActorExtension;
class ActorList
{
public:
constexpr ActorList() = default;
ActorList(const ActorList&) = delete;
class Node;
class Range;
class Node // only to be used as a base class of ActorExtension
{
public:
struct Settings
{
bool alwaysInDefaultField = false;
bool shouldBeTransformed = true;
bool canSpawnAsSubActor = false;
};
friend class ActorList;
Node(const Node&) = delete;
Node(Node&&) = delete;
Node& operator=(const Node&) = delete;
Node& operator=(Node&&) = delete;
Settings settings;
std::reference_wrapper<GravityField> gravityField;
std::reference_wrapper<Node> next;
std::reference_wrapper<Node> prev;
protected:
Node(Actor& actor);
~Node();
constexpr void SetGravityField(GravityField& field) { gravityField = field; }
public:
constexpr bool AlwaysInDefaultField() const { return settings.alwaysInDefaultField; }
constexpr bool ShouldBeTransformed() const { return settings.shouldBeTransformed; }
constexpr bool CanSpawnAsSubActor() const { return settings.canSpawnAsSubActor; }
constexpr auto OtherNodes() { return Range(*this); }
constexpr GravityField& GetGravityField() { return gravityField; }
constexpr const GravityField& GetGravityField() const { return gravityField; }
};
static void SetNextSettings(Node::Settings settings);
class Iterator
{
std::reference_wrapper<Node> node;
public:
constexpr Iterator(Node& node) : node(node) {}
constexpr Node& operator* () const { return node; }
constexpr Node* operator->() const { return &node.get(); }
constexpr bool operator==(const Iterator& other) const
{
return &node.get() == &other.node.get();
}
constexpr Iterator& operator++()
{
node = node.get().next;
return *this;
}
};
class Range
{
Node& node;
public:
constexpr explicit Range(Node& node) : node(node) {}
constexpr Iterator begin() const { return node.next.get(); }
constexpr Iterator end() const { return node; }
};
void Insert(Node& node);
void Remove(Node& node);
private:
Node* last = nullptr;
Node& GetNextOfNewNode(Node& newNode);
Node& GetPrevOfNewNode(Node& newNode);
};
asm("_ZN9ActorList15SetNextSettingsENS_4Node8SettingsE = 0x02010e70");