Skip to content

Commit 28313d1

Browse files
authored
Revert "Reformat souce code"
1 parent ef6a5a0 commit 28313d1

File tree

5,347 files changed

+610675
-578881
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,347 files changed

+610675
-578881
lines changed

src/.clang-format

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
Language: Cpp
3-
AccessModifierOffset: -4
3+
AccessModifierOffset: -2
44
AlignAfterOpenBracket: DontAlign
55
AlignConsecutiveAssignments: false
66
AlignConsecutiveDeclarations: false
@@ -73,7 +73,7 @@ SpaceAfterCStyleCast: false
7373
SpaceBeforeAssignmentOperators: true
7474
SpaceBeforeParens: ControlStatements
7575
SpaceInEmptyParentheses: false
76-
SpacesBeforeTrailingComments: 1
76+
SpacesBeforeTrailingComments: 2
7777
SpacesInAngles: false
7878
SpacesInContainerLiterals: true
7979
SpacesInCStyleCastParentheses: false

src/Common/GUID.hpp

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

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)
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)
1216
{
1317
string128 buff;
1418
g[0] = ini.r_u64(section, strconcat(sizeof(buff), buff, name, "_g0"));
1519
g[1] = ini.r_u64(section, strconcat(sizeof(buff), buff, name, "_g1"));
1620
}
1721

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

src/Common/LevelGameDef.h

Lines changed: 41 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,35 @@
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-
{
8-
ptRPoint = 0,
6+
enum EPointType{
7+
ptRPoint=0,
98
ptEnvMod,
109
ptSpawnPoint,
1110
ptMaxType,
12-
pt_force_dword = u32(-1)
11+
pt_force_dword=u32(-1)
1312
};
1413

15-
enum EWayType
16-
{
17-
wtPatrolPath = 0,
14+
enum EWayType{
15+
wtPatrolPath=0,
1816
wtMaxType,
19-
wt_force_dword = u32(-1)
17+
wt_force_dword=u32(-1)
2018
};
2119

22-
enum ERPpointType
23-
{ // [0..255]
24-
rptActorSpawn = 0,
25-
rptArtefactSpawn,
20+
enum ERPpointType{ // [0..255]
21+
rptActorSpawn = 0,
22+
rptArtefactSpawn,
2623
rptItemSpawn,
2724
rptLast = 0xff
2825
};
2926

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)
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)
3833
};
3934

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

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

5348
// POINT chunks
54-
#define RPOINT_CHUNK POINT_BASE + ptRPoint
49+
#define RPOINT_CHUNK POINT_BASE+ptRPoint
5550

5651
// WAY chunks
57-
#define WAY_PATROLPATH_CHUNK WAY_BASE + wtPatrolPath
52+
#define WAY_PATROLPATH_CHUNK WAY_BASE+wtPatrolPath
5853
//----------------------------------------------------
5954

60-
#define WAYOBJECT_VERSION 0x0013
55+
#define WAYOBJECT_VERSION 0x0013
6156
//----------------------------------------------------
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
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
6762

6863
/*
6964
- chunk RPOINT_CHUNK
70-
- chunk #0
65+
- chunk #0
7166
vector3 (PPosition);
7267
vector3 (PRotation);
7368
u8 (team_id);
7469
u8 (type)
7570
u16 (reserved)
7671
...
7772
- chunk #n
78-
73+
7974
- chunk WAY_PATH_CHUNK
80-
- chunk #0
81-
chunk WAYOBJECT_CHUNK_VERSION
82-
word (version)
83-
chunk WAYOBJECT_CHUNK_NAME
84-
stringZ (Name)
75+
- chunk #0
76+
chunk WAYOBJECT_CHUNK_VERSION
77+
word (version)
78+
chunk WAYOBJECT_CHUNK_NAME
79+
stringZ (Name)
8580
chunk WAY_CHUNK_TYPE
86-
dword EWayType (type)
81+
dword EWayType (type)
8782
chunk WAY_CHUNK_POINTS
8883
word (count)
8984
for (i=0; i<count; ++i){
90-
Fvector (pos)
85+
Fvector (pos)
9186
dword (flags)
9287
stringZ (name)
9388
}
9489
chunk WAY_CHUNK_LINKS
9590
word (count)
9691
for (i=0; i<count; ++i){
97-
word (from)
98-
word (to)
92+
word (from)
93+
word (to)
9994
float (probability)
10095
}
10196
...
10297
- chunk #n
10398
- chunk WAY_JUMP_CHUNK
104-
-//-
99+
-//-
105100
- chunk WAY_TRAFFIC_CHUNK
106-
-//-
101+
-//-
107102
- chunk WAY_CUSTOM_CHUNK
108-
-//-
103+
-//-
109104
110105
*/

src/Common/LevelStructure.hpp

Lines changed: 65 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44

55
enum fsL_Chunks
66
{
7-
fsL_HEADER = 1, //*
8-
fsL_SHADERS = 2, //*
9-
fsL_VISUALS = 3, //*
10-
fsL_PORTALS = 4, //* - Portal polygons
7+
fsL_HEADER = 1, //*
8+
fsL_SHADERS = 2, //*
9+
fsL_VISUALS = 3, //*
10+
fsL_PORTALS = 4, //* - Portal polygons
1111
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
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
{
2222
fsP_Portals = 1, // - portal polygons
23-
fsP_Root = 2, // - geometry root
23+
fsP_Root = 2, // - geometry root
2424
fsP_forcedword = u32(-1)
2525
};
2626

@@ -73,12 +73,27 @@ class NodePosition
7373
u8 data[5];
7474

7575
ICF void xz(u32 value) { CopyMemory(data, &value, 3); }
76-
ICF void y(u16 value) { CopyMemory(data + 3, &value, 2); }
76+
77+
ICF void y(u16 value) { CopyMemory(data+3, &value, 2); }
78+
7779
public:
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))); }
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+
8297
friend class CLevelGraph;
8398
friend struct CNodePositionCompressor;
8499
friend struct CNodePositionConverter;
@@ -101,23 +116,25 @@ struct NodeCompressed
101116
break;
102117
case 1:
103118
value <<= 7;
104-
value |= *(u32*)(data + 2) & 0xc000007f;
105-
CopyMemory(data + 2, &value, sizeof(u32));
119+
value |= *(u32*)(data+2) & 0xc000007f;
120+
CopyMemory(data+2, &value, sizeof(u32));
106121
break;
107122
case 2:
108123
value <<= 6;
109-
value |= *(u32*)(data + 5) & 0xe000003f;
110-
CopyMemory(data + 5, &value, sizeof(u32));
124+
value |= *(u32*)(data+5) & 0xe000003f;
125+
CopyMemory(data+5, &value, sizeof(u32));
111126
break;
112127
case 3:
113128
value <<= 5;
114-
value |= *(u32*)(data + 8) & 0xf000001f;
115-
CopyMemory(data + 8, &value, sizeof(u32));
129+
value |= *(u32*)(data+8) & 0xf000001f;
130+
CopyMemory(data+8, &value, sizeof(u32));
116131
break;
117132
}
118133
}
119134

120-
ICF void light(u8 value) { data[10] |= value << 4; }
135+
ICF void light(u8 value)
136+
{ data[10] |= value << 4; }
137+
121138
public:
122139
struct SCover
123140
{
@@ -152,11 +169,16 @@ struct NodeCompressed
152169
{
153170
switch (index)
154171
{
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;
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;
160182
}
161183
#ifdef DEBUG
162184
return (0);
@@ -188,23 +210,25 @@ struct NodeCompressed6
188210
break;
189211
case 1:
190212
value <<= 5;
191-
value |= *(u32*)(data + 2) & 0xfc00001f;
192-
CopyMemory(data + 2, &value, sizeof(u32));
213+
value |= *(u32*)(data+2) & 0xfc00001f;
214+
CopyMemory(data+2, &value, sizeof(u32));
193215
break;
194216
case 2:
195217
value <<= 2;
196-
value |= *(u32*)(data + 5) & 0xff800003;
197-
CopyMemory(data + 5, &value, sizeof(u32));
218+
value |= *(u32*)(data+5) & 0xff800003;
219+
CopyMemory(data+5, &value, sizeof(u32));
198220
break;
199221
case 3:
200222
value <<= 7;
201-
value |= *(u32*)(data + 7) & 0xf000007f;
202-
CopyMemory(data + 7, &value, sizeof(u32));
223+
value |= *(u32*)(data+7) & 0xf000007f;
224+
CopyMemory(data+7, &value, sizeof(u32));
203225
break;
204226
}
205227
}
206228

207-
ICF void light(u8 value) { data[10] |= value << 4; }
229+
ICF void light(u8 value)
230+
{ data[10] |= value << 4; }
231+
208232
public:
209233
u16 cover0 : 4;
210234
u16 cover1 : 4;
@@ -218,17 +242,19 @@ struct NodeCompressed6
218242
switch (index)
219243
{
220244
case 0: return *(u32*)data & 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;
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;
224248
default: NODEFAULT;
225249
}
226250
#ifdef DEBUG
227251
return 0;
228252
#endif
229253
}
230254

231-
ICF u8 light() const { return data[10] >> 4; }
255+
ICF u8 light() const
256+
{ return data[10] >> 4; }
257+
232258
ICF u16 cover(u8 index) const
233259
{
234260
switch (index)
@@ -264,7 +290,7 @@ typedef SNodePositionOld NodePosition;
264290

265291
const char LEVEL_GRAPH_NAME[] = "level.ai";
266292

267-
const u32 XRCL_CURRENT_VERSION = 18; // input
293+
const u32 XRCL_CURRENT_VERSION = 18; // input
268294
const u32 XRCL_PRODUCTION_VERSION = 14; // output
269295
const u32 CFORM_CURRENT_VERSION = 4;
270296
const u32 MAX_NODE_BIT_COUNT = 23;

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)