Skip to content

Commit 716dc03

Browse files
committed
Reformat: Common
1 parent 5f64707 commit 716dc03

20 files changed

+2522
-2738
lines changed

src/Common/GUID.hpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,16 @@ class xrGUID
66
public:
77
u64 g[2];
88

9-
ICF bool operator== (const xrGUID &that) const
10-
{ return g[0]==that.g[0] && g[1]==that.g[1]; }
11-
12-
ICF bool operator!= (const xrGUID &that) const
13-
{ return !(*this==that); }
14-
15-
ICF void LoadLTX(CInifile &ini, const char *section, const char *name)
9+
ICF bool operator==(const xrGUID& that) const { return g[0] == that.g[0] && g[1] == that.g[1]; }
10+
ICF bool operator!=(const xrGUID& that) const { return !(*this == that); }
11+
ICF void LoadLTX(CInifile& ini, const char* section, const char* name)
1612
{
1713
string128 buff;
1814
g[0] = ini.r_u64(section, strconcat(sizeof(buff), buff, name, "_g0"));
1915
g[1] = ini.r_u64(section, strconcat(sizeof(buff), buff, name, "_g1"));
2016
}
2117

22-
ICF void SaveLTX(CInifile &ini, const char *section, const char *name)
18+
ICF void SaveLTX(CInifile& ini, const char* section, const char* name)
2319
{
2420
string128 buff;
2521
ini.w_u64(section, strconcat(sizeof(buff), buff, name, "_g0"), g[0]);

src/Common/LevelGameDef.h

Lines changed: 46 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,40 @@
11
#pragma once
22

3-
#define RPOINT_CHOOSE_NAME "$rpoint"
4-
#define ENVMOD_CHOOSE_NAME "$env_mod"
3+
#define RPOINT_CHOOSE_NAME "$rpoint"
4+
#define ENVMOD_CHOOSE_NAME "$env_mod"
55

6-
enum EPointType{
7-
ptRPoint=0,
6+
enum EPointType
7+
{
8+
ptRPoint = 0,
89
ptEnvMod,
910
ptSpawnPoint,
1011
ptMaxType,
11-
pt_force_dword=u32(-1)
12+
pt_force_dword = u32(-1)
1213
};
1314

14-
enum EWayType{
15-
wtPatrolPath=0,
15+
enum EWayType
16+
{
17+
wtPatrolPath = 0,
1618
wtMaxType,
17-
wt_force_dword=u32(-1)
19+
wt_force_dword = u32(-1)
1820
};
1921

20-
enum ERPpointType{ // [0..255]
21-
rptActorSpawn = 0,
22-
rptArtefactSpawn,
22+
enum ERPpointType
23+
{ // [0..255]
24+
rptActorSpawn = 0,
25+
rptArtefactSpawn,
2326
rptItemSpawn,
2427
rptLast = 0xff
2528
};
2629

27-
enum EEnvModUsedParams{ eViewDist =(1<<0),
28-
eFogColor =(1<<1),
29-
eFogDensity =(1<<2),
30-
eAmbientColor =(1<<3),
31-
eSkyColor =(1<<4),
32-
eHemiColor =(1<<5)
30+
enum EEnvModUsedParams
31+
{
32+
eViewDist = (1 << 0),
33+
eFogColor = (1 << 1),
34+
eFogDensity = (1 << 2),
35+
eAmbientColor = (1 << 3),
36+
eSkyColor = (1 << 4),
37+
eHemiColor = (1 << 5)
3338
};
3439

3540
/* // XXX: find better place for this (need cpp)
@@ -42,64 +47,64 @@ xr_token rpoint_type[] = {
4247
*/
4348

4449
// BASE offset
45-
#define WAY_BASE 0x1000
46-
#define POINT_BASE 0x2000
50+
#define WAY_BASE 0x1000
51+
#define POINT_BASE 0x2000
4752

4853
// POINT chunks
49-
#define RPOINT_CHUNK POINT_BASE+ptRPoint
54+
#define RPOINT_CHUNK POINT_BASE + ptRPoint
5055

5156
// WAY chunks
52-
#define WAY_PATROLPATH_CHUNK WAY_BASE+wtPatrolPath
57+
#define WAY_PATROLPATH_CHUNK WAY_BASE + wtPatrolPath
5358
//----------------------------------------------------
5459

55-
#define WAYOBJECT_VERSION 0x0013
60+
#define WAYOBJECT_VERSION 0x0013
5661
//----------------------------------------------------
57-
#define WAYOBJECT_CHUNK_VERSION 0x0001
58-
#define WAYOBJECT_CHUNK_POINTS 0x0002
59-
#define WAYOBJECT_CHUNK_LINKS 0x0003
60-
#define WAYOBJECT_CHUNK_TYPE 0x0004
61-
#define WAYOBJECT_CHUNK_NAME 0x0005
62+
#define WAYOBJECT_CHUNK_VERSION 0x0001
63+
#define WAYOBJECT_CHUNK_POINTS 0x0002
64+
#define WAYOBJECT_CHUNK_LINKS 0x0003
65+
#define WAYOBJECT_CHUNK_TYPE 0x0004
66+
#define WAYOBJECT_CHUNK_NAME 0x0005
6267

6368
/*
6469
- chunk RPOINT_CHUNK
65-
- chunk #0
70+
- chunk #0
6671
vector3 (PPosition);
6772
vector3 (PRotation);
6873
u8 (team_id);
6974
u8 (type)
7075
u16 (reserved)
7176
...
7277
- chunk #n
73-
78+
7479
- chunk WAY_PATH_CHUNK
75-
- chunk #0
76-
chunk WAYOBJECT_CHUNK_VERSION
77-
word (version)
78-
chunk WAYOBJECT_CHUNK_NAME
79-
stringZ (Name)
80+
- chunk #0
81+
chunk WAYOBJECT_CHUNK_VERSION
82+
word (version)
83+
chunk WAYOBJECT_CHUNK_NAME
84+
stringZ (Name)
8085
chunk WAY_CHUNK_TYPE
81-
dword EWayType (type)
86+
dword EWayType (type)
8287
chunk WAY_CHUNK_POINTS
8388
word (count)
8489
for (i=0; i<count; ++i){
85-
Fvector (pos)
90+
Fvector (pos)
8691
dword (flags)
8792
stringZ (name)
8893
}
8994
chunk WAY_CHUNK_LINKS
9095
word (count)
9196
for (i=0; i<count; ++i){
92-
word (from)
93-
word (to)
97+
word (from)
98+
word (to)
9499
float (probability)
95100
}
96101
...
97102
- chunk #n
98103
- chunk WAY_JUMP_CHUNK
99-
-//-
104+
-//-
100105
- chunk WAY_TRAFFIC_CHUNK
101-
-//-
106+
-//-
102107
- chunk WAY_CUSTOM_CHUNK
103-
-//-
108+
-//-
104109
105110
*/

src/Common/LevelStructure.hpp

Lines changed: 44 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,29 @@
44

55
enum fsL_Chunks
66
{
7-
fsL_HEADER = 1, //*
8-
fsL_SHADERS = 2, //*
9-
fsL_VISUALS = 3, //*
10-
fsL_PORTALS = 4, //* - Portal polygons
11-
fsL_LIGHT_DYNAMIC = 6, //*
12-
fsL_GLOWS = 7, //* - All glows inside level
13-
fsL_SECTORS = 8, //* - All sectors on level
14-
fsL_VB = 9, //* - Static geometry
15-
fsL_IB = 10, //*
16-
fsL_SWIS = 11, //* - collapse info, usually for trees
7+
fsL_HEADER = 1, //*
8+
fsL_SHADERS = 2, //*
9+
fsL_VISUALS = 3, //*
10+
fsL_PORTALS = 4, //* - Portal polygons
11+
fsL_LIGHT_DYNAMIC = 6, //*
12+
fsL_GLOWS = 7, //* - All glows inside level
13+
fsL_SECTORS = 8, //* - All sectors on level
14+
fsL_VB = 9, //* - Static geometry
15+
fsL_IB = 10, //*
16+
fsL_SWIS = 11, //* - collapse info, usually for trees
1717
fsL_forcedword = 0xFFFFFFFF
1818
};
1919

2020
enum fsESectorChunks
2121
{
22-
fsP_Portals = 1, // - portal polygons
23-
fsP_Root = 2, // - geometry root
22+
fsP_Portals = 1, // - portal polygons
23+
fsP_Root = 2, // - geometry root
2424
fsP_forcedword = u32(-1)
2525
};
2626

2727
enum fsSLS_Chunks
2828
{
29-
fsSLS_Description = 1, // Name of level
29+
fsSLS_Description = 1, // Name of level
3030
fsSLS_ServerState = 2,
3131
fsSLS_forcedword = u32(-1)
3232
};
@@ -73,27 +73,12 @@ class NodePosition
7373
u8 data[5];
7474

7575
ICF void xz(u32 value) { CopyMemory(data, &value, 3); }
76-
77-
ICF void y(u16 value) { CopyMemory(data+3, &value, 2); }
78-
76+
ICF void y(u16 value) { CopyMemory(data + 3, &value, 2); }
7977
public:
80-
ICF u32 xz() const
81-
{
82-
return ((*((u32*)data)) & 0x00ffffff);
83-
}
84-
ICF u32 x(u32 row) const
85-
{
86-
return (xz() / row);
87-
}
88-
ICF u32 z(u32 row) const
89-
{
90-
return (xz() % row);
91-
}
92-
ICF u32 y() const
93-
{
94-
return (*((u16*)(data + 3)));
95-
}
96-
78+
ICF u32 xz() const { return ((*((u32*)data)) & 0x00ffffff); }
79+
ICF u32 x(u32 row) const { return (xz() / row); }
80+
ICF u32 z(u32 row) const { return (xz() % row); }
81+
ICF u32 y() const { return (*((u16*)(data + 3))); }
9782
friend class CLevelGraph;
9883
friend struct CNodePositionCompressor;
9984
friend struct CNodePositionConverter;
@@ -116,25 +101,23 @@ struct NodeCompressed
116101
break;
117102
case 1:
118103
value <<= 7;
119-
value |= *(u32*)(data+2) & 0xc000007f;
120-
CopyMemory(data+2, &value, sizeof(u32));
104+
value |= *(u32*)(data + 2) & 0xc000007f;
105+
CopyMemory(data + 2, &value, sizeof(u32));
121106
break;
122107
case 2:
123108
value <<= 6;
124-
value |= *(u32*)(data+5) & 0xe000003f;
125-
CopyMemory(data+5, &value, sizeof(u32));
109+
value |= *(u32*)(data + 5) & 0xe000003f;
110+
CopyMemory(data + 5, &value, sizeof(u32));
126111
break;
127112
case 3:
128113
value <<= 5;
129-
value |= *(u32*)(data+8) & 0xf000001f;
130-
CopyMemory(data+8, &value, sizeof(u32));
114+
value |= *(u32*)(data + 8) & 0xf000001f;
115+
CopyMemory(data + 8, &value, sizeof(u32));
131116
break;
132117
}
133118
}
134119

135-
ICF void light(u8 value)
136-
{ data[10] |= value << 4; }
137-
120+
ICF void light(u8 value) { data[10] |= value << 4; }
138121
public:
139122
struct SCover
140123
{
@@ -169,16 +152,11 @@ struct NodeCompressed
169152
{
170153
switch (index)
171154
{
172-
case 0:
173-
return ((*(u32*)data) & 0x007fffff);
174-
case 1:
175-
return (((*(u32*)(data + 2)) >> 7) & 0x007fffff);
176-
case 2:
177-
return (((*(u32*)(data + 5)) >> 6) & 0x007fffff);
178-
case 3:
179-
return (((*(u32*)(data + 8)) >> 5) & 0x007fffff);
180-
default:
181-
NODEFAULT;
155+
case 0: return ((*(u32*)data) & 0x007fffff);
156+
case 1: return (((*(u32*)(data + 2)) >> 7) & 0x007fffff);
157+
case 2: return (((*(u32*)(data + 5)) >> 6) & 0x007fffff);
158+
case 3: return (((*(u32*)(data + 8)) >> 5) & 0x007fffff);
159+
default: NODEFAULT;
182160
}
183161
#ifdef DEBUG
184162
return (0);
@@ -210,25 +188,23 @@ struct NodeCompressed6
210188
break;
211189
case 1:
212190
value <<= 5;
213-
value |= *(u32*)(data+2) & 0xfc00001f;
214-
CopyMemory(data+2, &value, sizeof(u32));
191+
value |= *(u32*)(data + 2) & 0xfc00001f;
192+
CopyMemory(data + 2, &value, sizeof(u32));
215193
break;
216194
case 2:
217195
value <<= 2;
218-
value |= *(u32*)(data+5) & 0xff800003;
219-
CopyMemory(data+5, &value, sizeof(u32));
196+
value |= *(u32*)(data + 5) & 0xff800003;
197+
CopyMemory(data + 5, &value, sizeof(u32));
220198
break;
221199
case 3:
222200
value <<= 7;
223-
value |= *(u32*)(data+7) & 0xf000007f;
224-
CopyMemory(data+7, &value, sizeof(u32));
201+
value |= *(u32*)(data + 7) & 0xf000007f;
202+
CopyMemory(data + 7, &value, sizeof(u32));
225203
break;
226204
}
227205
}
228206

229-
ICF void light(u8 value)
230-
{ data[10] |= value << 4; }
231-
207+
ICF void light(u8 value) { data[10] |= value << 4; }
232208
public:
233209
u16 cover0 : 4;
234210
u16 cover1 : 4;
@@ -242,19 +218,17 @@ struct NodeCompressed6
242218
switch (index)
243219
{
244220
case 0: return *(u32*)data & 0x001fffff;
245-
case 1: return (*(u32*)(data+2) >> 5) & 0x001fffff;
246-
case 2: return (*(u32*)(data+5) >> 2) & 0x001fffff;
247-
case 3: return (*(u32*)(data+7) >> 7) & 0x001fffff;
221+
case 1: return (*(u32*)(data + 2) >> 5) & 0x001fffff;
222+
case 2: return (*(u32*)(data + 5) >> 2) & 0x001fffff;
223+
case 3: return (*(u32*)(data + 7) >> 7) & 0x001fffff;
248224
default: NODEFAULT;
249225
}
250226
#ifdef DEBUG
251227
return 0;
252228
#endif
253229
}
254230

255-
ICF u8 light() const
256-
{ return data[10] >> 4; }
257-
231+
ICF u8 light() const { return data[10] >> 4; }
258232
ICF u16 cover(u8 index) const
259233
{
260234
switch (index)
@@ -273,7 +247,7 @@ struct NodeCompressed6
273247
friend class CLevelGraph;
274248
friend struct CNodeCompressed;
275249
friend class CNodeRenumberer;
276-
}; // 2+5+2+11 = 20b
250+
}; // 2+5+2+11 = 20b
277251
#endif
278252

279253
struct SNodePositionOld
@@ -290,8 +264,8 @@ typedef SNodePositionOld NodePosition;
290264

291265
const char LEVEL_GRAPH_NAME[] = "level.ai";
292266

293-
const u32 XRCL_CURRENT_VERSION = 18; // input
294-
const u32 XRCL_PRODUCTION_VERSION = 14; // output
267+
const u32 XRCL_CURRENT_VERSION = 18; // input
268+
const u32 XRCL_PRODUCTION_VERSION = 14; // output
295269
const u32 CFORM_CURRENT_VERSION = 4;
296270
const u32 MAX_NODE_BIT_COUNT = 23;
297271
const u32 XRAI_CURRENT_VERSION = 10;

src/Common/Noncopyable.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ class Noncopyable
44
{
55
public:
66
Noncopyable() = default;
7-
Noncopyable(Noncopyable &) = delete;
8-
Noncopyable &operator=(Noncopyable &) = delete;
7+
Noncopyable(Noncopyable&) = delete;
8+
Noncopyable& operator=(Noncopyable&) = delete;
99
};

0 commit comments

Comments
 (0)