aboutsummaryrefslogtreecommitdiff
path: root/sp/src/utils/common/map_shared.cpp
diff options
context:
space:
mode:
authorJørgen P. Tjernø <[email protected]>2013-12-02 19:31:46 -0800
committerJørgen P. Tjernø <[email protected]>2013-12-02 19:46:31 -0800
commitf56bb35301836e56582a575a75864392a0177875 (patch)
treede61ddd39de3e7df52759711950b4c288592f0dc /sp/src/utils/common/map_shared.cpp
parentMark some more files as text. (diff)
downloadsource-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz
source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip
Fix line endings. WHAMMY.
Diffstat (limited to 'sp/src/utils/common/map_shared.cpp')
-rw-r--r--sp/src/utils/common/map_shared.cpp272
1 files changed, 136 insertions, 136 deletions
diff --git a/sp/src/utils/common/map_shared.cpp b/sp/src/utils/common/map_shared.cpp
index f1e970c0..e33e20cb 100644
--- a/sp/src/utils/common/map_shared.cpp
+++ b/sp/src/utils/common/map_shared.cpp
@@ -1,136 +1,136 @@
-//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-// $NoKeywords: $
-//=============================================================================//
-
-#include "map_shared.h"
-#include "bsplib.h"
-#include "cmdlib.h"
-
-
-CMapError g_MapError;
-int g_nMapFileVersion;
-
-
-//-----------------------------------------------------------------------------
-// Purpose:
-// Input : *szKey -
-// *szValue -
-// *pLoadEntity -
-// Output : ChunkFileResult_t
-//-----------------------------------------------------------------------------
-ChunkFileResult_t LoadEntityKeyCallback(const char *szKey, const char *szValue, LoadEntity_t *pLoadEntity)
-{
- if (!stricmp(szKey, "classname"))
- {
- if (!stricmp(szValue, "func_detail"))
- {
- pLoadEntity->nBaseContents = CONTENTS_DETAIL;
- }
- else if (!stricmp(szValue, "func_ladder"))
- {
- pLoadEntity->nBaseContents = CONTENTS_LADDER;
- }
- else if (!stricmp(szValue, "func_water"))
- {
- pLoadEntity->nBaseContents = CONTENTS_WATER;
- }
- }
- else if (!stricmp(szKey, "id"))
- {
- // UNDONE: flag entity errors by ID instead of index
- //g_MapError.EntityState( atoi( szValue ) );
- // rename this field since DME code uses this name
- SetKeyValue( pLoadEntity->pEntity, "hammerid", szValue );
- return(ChunkFile_Ok);
- }
- else if( !stricmp( szKey, "mapversion" ) )
- {
- // .vmf map revision number
- g_MapRevision = atoi( szValue );
- SetKeyValue( pLoadEntity->pEntity, szKey, szValue );
- return ( ChunkFile_Ok );
- }
-
- SetKeyValue( pLoadEntity->pEntity, szKey, szValue );
-
- return(ChunkFile_Ok);
-}
-
-
-static ChunkFileResult_t LoadEntityCallback( CChunkFile *pFile, int nParam )
-{
- if (num_entities == MAX_MAP_ENTITIES)
- {
- // Exits.
- g_MapError.ReportError ("num_entities == MAX_MAP_ENTITIES");
- }
-
- entity_t *mapent = &entities[num_entities];
- num_entities++;
- memset(mapent, 0, sizeof(*mapent));
- mapent->numbrushes = 0;
-
- LoadEntity_t LoadEntity;
- LoadEntity.pEntity = mapent;
-
- // No default flags/contents
- LoadEntity.nBaseFlags = 0;
- LoadEntity.nBaseContents = 0;
-
- //
- // Read the entity chunk.
- //
- ChunkFileResult_t eResult = pFile->ReadChunk((KeyHandler_t)LoadEntityKeyCallback, &LoadEntity);
-
- return eResult;
-}
-
-
-bool LoadEntsFromMapFile( char const *pFilename )
-{
- //
- // Dummy this up for the texture handling. This can be removed when old .MAP file
- // support is removed.
- //
- g_nMapFileVersion = 400;
-
- //
- // Open the file.
- //
- CChunkFile File;
- ChunkFileResult_t eResult = File.Open( pFilename, ChunkFile_Read );
-
- if(eResult == ChunkFile_Ok)
- {
- num_entities = 0;
-
- //
- // Set up handlers for the subchunks that we are interested in.
- //
- CChunkHandlerMap Handlers;
- Handlers.AddHandler("entity", (ChunkHandler_t)LoadEntityCallback, 0);
-
- File.PushHandlers(&Handlers);
-
- //
- // Read the sub-chunks. We ignore keys in the root of the file.
- //
- while (eResult == ChunkFile_Ok)
- {
- eResult = File.ReadChunk();
- }
-
- File.PopHandlers();
- return true;
- }
- else
- {
- Error("Error in LoadEntsFromMapFile (in-memory file): %s.\n", File.GetErrorText(eResult));
- return false;
- }
-}
-
-
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#include "map_shared.h"
+#include "bsplib.h"
+#include "cmdlib.h"
+
+
+CMapError g_MapError;
+int g_nMapFileVersion;
+
+
+//-----------------------------------------------------------------------------
+// Purpose:
+// Input : *szKey -
+// *szValue -
+// *pLoadEntity -
+// Output : ChunkFileResult_t
+//-----------------------------------------------------------------------------
+ChunkFileResult_t LoadEntityKeyCallback(const char *szKey, const char *szValue, LoadEntity_t *pLoadEntity)
+{
+ if (!stricmp(szKey, "classname"))
+ {
+ if (!stricmp(szValue, "func_detail"))
+ {
+ pLoadEntity->nBaseContents = CONTENTS_DETAIL;
+ }
+ else if (!stricmp(szValue, "func_ladder"))
+ {
+ pLoadEntity->nBaseContents = CONTENTS_LADDER;
+ }
+ else if (!stricmp(szValue, "func_water"))
+ {
+ pLoadEntity->nBaseContents = CONTENTS_WATER;
+ }
+ }
+ else if (!stricmp(szKey, "id"))
+ {
+ // UNDONE: flag entity errors by ID instead of index
+ //g_MapError.EntityState( atoi( szValue ) );
+ // rename this field since DME code uses this name
+ SetKeyValue( pLoadEntity->pEntity, "hammerid", szValue );
+ return(ChunkFile_Ok);
+ }
+ else if( !stricmp( szKey, "mapversion" ) )
+ {
+ // .vmf map revision number
+ g_MapRevision = atoi( szValue );
+ SetKeyValue( pLoadEntity->pEntity, szKey, szValue );
+ return ( ChunkFile_Ok );
+ }
+
+ SetKeyValue( pLoadEntity->pEntity, szKey, szValue );
+
+ return(ChunkFile_Ok);
+}
+
+
+static ChunkFileResult_t LoadEntityCallback( CChunkFile *pFile, int nParam )
+{
+ if (num_entities == MAX_MAP_ENTITIES)
+ {
+ // Exits.
+ g_MapError.ReportError ("num_entities == MAX_MAP_ENTITIES");
+ }
+
+ entity_t *mapent = &entities[num_entities];
+ num_entities++;
+ memset(mapent, 0, sizeof(*mapent));
+ mapent->numbrushes = 0;
+
+ LoadEntity_t LoadEntity;
+ LoadEntity.pEntity = mapent;
+
+ // No default flags/contents
+ LoadEntity.nBaseFlags = 0;
+ LoadEntity.nBaseContents = 0;
+
+ //
+ // Read the entity chunk.
+ //
+ ChunkFileResult_t eResult = pFile->ReadChunk((KeyHandler_t)LoadEntityKeyCallback, &LoadEntity);
+
+ return eResult;
+}
+
+
+bool LoadEntsFromMapFile( char const *pFilename )
+{
+ //
+ // Dummy this up for the texture handling. This can be removed when old .MAP file
+ // support is removed.
+ //
+ g_nMapFileVersion = 400;
+
+ //
+ // Open the file.
+ //
+ CChunkFile File;
+ ChunkFileResult_t eResult = File.Open( pFilename, ChunkFile_Read );
+
+ if(eResult == ChunkFile_Ok)
+ {
+ num_entities = 0;
+
+ //
+ // Set up handlers for the subchunks that we are interested in.
+ //
+ CChunkHandlerMap Handlers;
+ Handlers.AddHandler("entity", (ChunkHandler_t)LoadEntityCallback, 0);
+
+ File.PushHandlers(&Handlers);
+
+ //
+ // Read the sub-chunks. We ignore keys in the root of the file.
+ //
+ while (eResult == ChunkFile_Ok)
+ {
+ eResult = File.ReadChunk();
+ }
+
+ File.PopHandlers();
+ return true;
+ }
+ else
+ {
+ Error("Error in LoadEntsFromMapFile (in-memory file): %s.\n", File.GetErrorText(eResult));
+ return false;
+ }
+}
+
+