Skip to content

Commit

Permalink
Revert "Reformat souce code"
Browse files Browse the repository at this point in the history
  • Loading branch information
CrossVR authored Jan 23, 2017
1 parent ef6a5a0 commit 28313d1
Show file tree
Hide file tree
Showing 5,347 changed files with 610,675 additions and 578,881 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 2 additions & 2 deletions src/.clang-format
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
Language: Cpp
AccessModifierOffset: -4
AccessModifierOffset: -2
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
Expand Down Expand Up @@ -73,7 +73,7 @@ SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
Expand Down
12 changes: 8 additions & 4 deletions src/Common/GUID.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@ class xrGUID
public:
u64 g[2];

ICF bool operator==(const xrGUID& that) const { return g[0] == that.g[0] && g[1] == that.g[1]; }
ICF bool operator!=(const xrGUID& that) const { return !(*this == that); }
ICF void LoadLTX(CInifile& ini, const char* section, const char* name)
ICF bool operator== (const xrGUID &that) const
{ return g[0]==that.g[0] && g[1]==that.g[1]; }

ICF bool operator!= (const xrGUID &that) const
{ return !(*this==that); }

ICF void LoadLTX(CInifile &ini, const char *section, const char *name)
{
string128 buff;
g[0] = ini.r_u64(section, strconcat(sizeof(buff), buff, name, "_g0"));
g[1] = ini.r_u64(section, strconcat(sizeof(buff), buff, name, "_g1"));
}

ICF void SaveLTX(CInifile& ini, const char* section, const char* name)
ICF void SaveLTX(CInifile &ini, const char *section, const char *name)
{
string128 buff;
ini.w_u64(section, strconcat(sizeof(buff), buff, name, "_g0"), g[0]);
Expand Down
87 changes: 41 additions & 46 deletions src/Common/LevelGameDef.h
Original file line number Diff line number Diff line change
@@ -1,40 +1,35 @@
#pragma once

#define RPOINT_CHOOSE_NAME "$rpoint"
#define ENVMOD_CHOOSE_NAME "$env_mod"
#define RPOINT_CHOOSE_NAME "$rpoint"
#define ENVMOD_CHOOSE_NAME "$env_mod"

enum EPointType
{
ptRPoint = 0,
enum EPointType{
ptRPoint=0,
ptEnvMod,
ptSpawnPoint,
ptMaxType,
pt_force_dword = u32(-1)
pt_force_dword=u32(-1)
};

enum EWayType
{
wtPatrolPath = 0,
enum EWayType{
wtPatrolPath=0,
wtMaxType,
wt_force_dword = u32(-1)
wt_force_dword=u32(-1)
};

enum ERPpointType
{ // [0..255]
rptActorSpawn = 0,
rptArtefactSpawn,
enum ERPpointType{ // [0..255]
rptActorSpawn = 0,
rptArtefactSpawn,
rptItemSpawn,
rptLast = 0xff
};

enum EEnvModUsedParams
{
eViewDist = (1 << 0),
eFogColor = (1 << 1),
eFogDensity = (1 << 2),
eAmbientColor = (1 << 3),
eSkyColor = (1 << 4),
eHemiColor = (1 << 5)
enum EEnvModUsedParams{ eViewDist =(1<<0),
eFogColor =(1<<1),
eFogDensity =(1<<2),
eAmbientColor =(1<<3),
eSkyColor =(1<<4),
eHemiColor =(1<<5)
};

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

// BASE offset
#define WAY_BASE 0x1000
#define POINT_BASE 0x2000
#define WAY_BASE 0x1000
#define POINT_BASE 0x2000

// POINT chunks
#define RPOINT_CHUNK POINT_BASE + ptRPoint
#define RPOINT_CHUNK POINT_BASE+ptRPoint

// WAY chunks
#define WAY_PATROLPATH_CHUNK WAY_BASE + wtPatrolPath
#define WAY_PATROLPATH_CHUNK WAY_BASE+wtPatrolPath
//----------------------------------------------------

#define WAYOBJECT_VERSION 0x0013
#define WAYOBJECT_VERSION 0x0013
//----------------------------------------------------
#define WAYOBJECT_CHUNK_VERSION 0x0001
#define WAYOBJECT_CHUNK_POINTS 0x0002
#define WAYOBJECT_CHUNK_LINKS 0x0003
#define WAYOBJECT_CHUNK_TYPE 0x0004
#define WAYOBJECT_CHUNK_NAME 0x0005
#define WAYOBJECT_CHUNK_VERSION 0x0001
#define WAYOBJECT_CHUNK_POINTS 0x0002
#define WAYOBJECT_CHUNK_LINKS 0x0003
#define WAYOBJECT_CHUNK_TYPE 0x0004
#define WAYOBJECT_CHUNK_NAME 0x0005

/*
- chunk RPOINT_CHUNK
- chunk #0
- chunk #0
vector3 (PPosition);
vector3 (PRotation);
u8 (team_id);
u8 (type)
u16 (reserved)
...
- chunk #n
- chunk WAY_PATH_CHUNK
- chunk #0
chunk WAYOBJECT_CHUNK_VERSION
word (version)
chunk WAYOBJECT_CHUNK_NAME
stringZ (Name)
- chunk #0
chunk WAYOBJECT_CHUNK_VERSION
word (version)
chunk WAYOBJECT_CHUNK_NAME
stringZ (Name)
chunk WAY_CHUNK_TYPE
dword EWayType (type)
dword EWayType (type)
chunk WAY_CHUNK_POINTS
word (count)
for (i=0; i<count; ++i){
Fvector (pos)
Fvector (pos)
dword (flags)
stringZ (name)
}
chunk WAY_CHUNK_LINKS
word (count)
for (i=0; i<count; ++i){
word (from)
word (to)
word (from)
word (to)
float (probability)
}
...
- chunk #n
- chunk WAY_JUMP_CHUNK
-//-
-//-
- chunk WAY_TRAFFIC_CHUNK
-//-
-//-
- chunk WAY_CUSTOM_CHUNK
-//-
-//-
*/
104 changes: 65 additions & 39 deletions src/Common/LevelStructure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@

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

enum fsESectorChunks
{
fsP_Portals = 1, // - portal polygons
fsP_Root = 2, // - geometry root
fsP_Root = 2, // - geometry root
fsP_forcedword = u32(-1)
};

Expand Down Expand Up @@ -73,12 +73,27 @@ class NodePosition
u8 data[5];

ICF void xz(u32 value) { CopyMemory(data, &value, 3); }
ICF void y(u16 value) { CopyMemory(data + 3, &value, 2); }

ICF void y(u16 value) { CopyMemory(data+3, &value, 2); }

public:
ICF u32 xz() const { return ((*((u32*)data)) & 0x00ffffff); }
ICF u32 x(u32 row) const { return (xz() / row); }
ICF u32 z(u32 row) const { return (xz() % row); }
ICF u32 y() const { return (*((u16*)(data + 3))); }
ICF u32 xz() const
{
return ((*((u32*)data)) & 0x00ffffff);
}
ICF u32 x(u32 row) const
{
return (xz() / row);
}
ICF u32 z(u32 row) const
{
return (xz() % row);
}
ICF u32 y() const
{
return (*((u16*)(data + 3)));
}

friend class CLevelGraph;
friend struct CNodePositionCompressor;
friend struct CNodePositionConverter;
Expand All @@ -101,23 +116,25 @@ struct NodeCompressed
break;
case 1:
value <<= 7;
value |= *(u32*)(data + 2) & 0xc000007f;
CopyMemory(data + 2, &value, sizeof(u32));
value |= *(u32*)(data+2) & 0xc000007f;
CopyMemory(data+2, &value, sizeof(u32));
break;
case 2:
value <<= 6;
value |= *(u32*)(data + 5) & 0xe000003f;
CopyMemory(data + 5, &value, sizeof(u32));
value |= *(u32*)(data+5) & 0xe000003f;
CopyMemory(data+5, &value, sizeof(u32));
break;
case 3:
value <<= 5;
value |= *(u32*)(data + 8) & 0xf000001f;
CopyMemory(data + 8, &value, sizeof(u32));
value |= *(u32*)(data+8) & 0xf000001f;
CopyMemory(data+8, &value, sizeof(u32));
break;
}
}

ICF void light(u8 value) { data[10] |= value << 4; }
ICF void light(u8 value)
{ data[10] |= value << 4; }

public:
struct SCover
{
Expand Down Expand Up @@ -152,11 +169,16 @@ struct NodeCompressed
{
switch (index)
{
case 0: return ((*(u32*)data) & 0x007fffff);
case 1: return (((*(u32*)(data + 2)) >> 7) & 0x007fffff);
case 2: return (((*(u32*)(data + 5)) >> 6) & 0x007fffff);
case 3: return (((*(u32*)(data + 8)) >> 5) & 0x007fffff);
default: NODEFAULT;
case 0:
return ((*(u32*)data) & 0x007fffff);
case 1:
return (((*(u32*)(data + 2)) >> 7) & 0x007fffff);
case 2:
return (((*(u32*)(data + 5)) >> 6) & 0x007fffff);
case 3:
return (((*(u32*)(data + 8)) >> 5) & 0x007fffff);
default:
NODEFAULT;
}
#ifdef DEBUG
return (0);
Expand Down Expand Up @@ -188,23 +210,25 @@ struct NodeCompressed6
break;
case 1:
value <<= 5;
value |= *(u32*)(data + 2) & 0xfc00001f;
CopyMemory(data + 2, &value, sizeof(u32));
value |= *(u32*)(data+2) & 0xfc00001f;
CopyMemory(data+2, &value, sizeof(u32));
break;
case 2:
value <<= 2;
value |= *(u32*)(data + 5) & 0xff800003;
CopyMemory(data + 5, &value, sizeof(u32));
value |= *(u32*)(data+5) & 0xff800003;
CopyMemory(data+5, &value, sizeof(u32));
break;
case 3:
value <<= 7;
value |= *(u32*)(data + 7) & 0xf000007f;
CopyMemory(data + 7, &value, sizeof(u32));
value |= *(u32*)(data+7) & 0xf000007f;
CopyMemory(data+7, &value, sizeof(u32));
break;
}
}

ICF void light(u8 value) { data[10] |= value << 4; }
ICF void light(u8 value)
{ data[10] |= value << 4; }

public:
u16 cover0 : 4;
u16 cover1 : 4;
Expand All @@ -218,17 +242,19 @@ struct NodeCompressed6
switch (index)
{
case 0: return *(u32*)data & 0x001fffff;
case 1: return (*(u32*)(data + 2) >> 5) & 0x001fffff;
case 2: return (*(u32*)(data + 5) >> 2) & 0x001fffff;
case 3: return (*(u32*)(data + 7) >> 7) & 0x001fffff;
case 1: return (*(u32*)(data+2) >> 5) & 0x001fffff;
case 2: return (*(u32*)(data+5) >> 2) & 0x001fffff;
case 3: return (*(u32*)(data+7) >> 7) & 0x001fffff;
default: NODEFAULT;
}
#ifdef DEBUG
return 0;
#endif
}

ICF u8 light() const { return data[10] >> 4; }
ICF u8 light() const
{ return data[10] >> 4; }

ICF u16 cover(u8 index) const
{
switch (index)
Expand Down Expand Up @@ -264,7 +290,7 @@ typedef SNodePositionOld NodePosition;

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

const u32 XRCL_CURRENT_VERSION = 18; // input
const u32 XRCL_CURRENT_VERSION = 18; // input
const u32 XRCL_PRODUCTION_VERSION = 14; // output
const u32 CFORM_CURRENT_VERSION = 4;
const u32 MAX_NODE_BIT_COUNT = 23;
Expand Down
4 changes: 2 additions & 2 deletions src/Common/Noncopyable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ class Noncopyable
{
public:
Noncopyable() = default;
Noncopyable(Noncopyable&) = delete;
Noncopyable& operator=(Noncopyable&) = delete;
Noncopyable(Noncopyable &) = delete;
Noncopyable &operator=(Noncopyable &) = delete;
};
Loading

0 comments on commit 28313d1

Please sign in to comment.