blob: a436114b0cd73c4d5a0d22f240832ddb44c27494 (
plain)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
#ifndef __NEWER_WORLDMAPDATA_H
#define __NEWER_WORLDMAPDATA_H
#include <common.h>
#include <rvl/mtx.h>
// Forward declarations
struct WMPathPoint;
struct WMPathAction;
struct WMPathSegment;
struct WMPathDef;
// here's a note: while most of these structs contain pointers to other structs,
// in the data file these fields actually contain an index into the lists
// (defined in WMPathHeader)
// WorldMapData::load() fixes these offsets.
/******************************************************************************/
// Definition for an entrance onto one side of a path
// (TODO: Maybe rename this struct?)
// Note: a null WMPathEntrance has no path defined
// since the path pointer is stored as an index in the data file, the index for
// a null path becomes -1
struct WMPathEntrance {
WMPathDef *path;
bool isEndSide;
bool isValid() { return (this->path != 0); }
};
/******************************************************************************/
// Definition for one point on the map
struct WMPathPoint {
enum PointType {
NONE_TYPE,
LEVEL_TYPE
};
// Paths you arrive on when you press a direction when at this point
union {
struct {
WMPathEntrance left;
WMPathEntrance right;
WMPathEntrance up;
WMPathEntrance down;
} asDirection;
WMPathEntrance asArray[4];
} exits;
// Point metadata
PointType type;
int params[4];
Vec position;
};
/******************************************************************************/
// Definition for an action that can be triggered when the player reaches a
// specific point
struct WMPathAction {
enum ActionType {
TELEPORT_TYPE // teleports to another submap
};
// Action metadata
ActionType type;
int params[4];
};
/******************************************************************************/
// Definition for one part of a path
struct WMPathSegment {
// Segment metadata
Vec start;
Vec end;
float stepsPerFrame;
int animationType;
float animationSpeed;
short direction;
bool useLastDir;
bool alwaysSameDir;
// Optional Action that's triggered when the player touches this segment
WMPathAction *action;
};
/******************************************************************************/
// Definition for one path
struct WMPathDef {
// Path metadata
WMPathPoint *startPoint;
WMPathPoint *endPoint;
u16 eventRequired;
u16 segCount;
WMPathSegment *segments[1]; // variable-length array
};
struct WMPathHeader {
u32 magic;
WMPathDef **pathList;
int pathCount;
WMPathPoint **pointList;
int pointCount;
WMPathSegment **segmentList;
int segmentCount;
// todo: remove action list?
WMPathAction **actionList;
int actionCount;
};
class dWMPathData_c {
private:
WMPathHeader *data;
public:
dWMPathData_c();
~dWMPathData_c();
bool load(void *data);
int pathCount() { return data->pathCount; }
int pointCount() { return data->pointCount; }
int segmentCount() { return data->segmentCount; }
WMPathDef *getPath(int idx) { return data->pathList[idx]; }
WMPathPoint *getPoint(int idx) { return data->pointList[idx]; }
WMPathSegment *getSegment(int idx) { return data->segmentList[idx]; }
int getPointID(WMPathPoint *point);
};
#endif // __NEWER_WORLDMAPDATA_H
|