diff --git a/Code/Game/DanBiasGame/GameClientState/GameState.cpp b/Code/Game/DanBiasGame/GameClientState/GameState.cpp index c86d599d..22194795 100644 --- a/Code/Game/DanBiasGame/GameClientState/GameState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/GameState.cpp @@ -175,8 +175,15 @@ bool GameState::LoadModels(std::string mapFile) { GameLogic::ObjectTypeHeader* obj = objects.at(i); + switch (obj->typeID) { + + case GameLogic::ObjectType::ObjectType_SpawnPoint: + { + + break; + } case GameLogic::ObjectType::ObjectType_LevelMetaData: break; diff --git a/Code/Game/DanBiasGame/GameClientState/LevelLoader/LevelParser.cpp b/Code/Game/DanBiasGame/GameClientState/LevelLoader/LevelParser.cpp index c5dfa8cc..39d2f625 100644 --- a/Code/Game/DanBiasGame/GameClientState/LevelLoader/LevelParser.cpp +++ b/Code/Game/DanBiasGame/GameClientState/LevelLoader/LevelParser.cpp @@ -59,6 +59,27 @@ std::vector> LevelParser::Parse(std::string filen break; } + case ObjectType_SpawnPoint: + { + loadCgf = false; + ObjectHeader* header = new ObjectHeader; + ParseObject(&buffer[counter], *header, counter, loadCgf); + + SpawnPointAttributes* spawn = new SpawnPointAttributes; + + spawn->typeID = header->typeID; + + for(int i = 0; i < 3; i++) + { + spawn->position[i] = header->position[i]; + } + + delete header; + //objects.push_back(header); + objects.push_back(spawn); + break; + } + //This is by design, static and dynamic is using the same converter. Do not add anything inbetween them. //Unless they are changed to not be the same. case ObjectType_Static: case ObjectType_Dynamic: @@ -133,13 +154,8 @@ std::vector> LevelParser::Parse(std::string filen objects.push_back(header); break; } - - case ObjectSpecialType_SpawnPoint: - { - loadCgf = false; - ObjectHeader* header = new ObjectHeader; - ParseObject(&buffer[counter], *header, counter, loadCgf); - } + //this is a hotfix, fix so you only load the relevant data when the file is updated + default: //Couldn't find specialType diff --git a/Code/Game/DanBiasGame/GameClientState/LevelLoader/ObjectDefines.h b/Code/Game/DanBiasGame/GameClientState/LevelLoader/ObjectDefines.h index 09556cdc..bb2ae439 100644 --- a/Code/Game/DanBiasGame/GameClientState/LevelLoader/ObjectDefines.h +++ b/Code/Game/DanBiasGame/GameClientState/LevelLoader/ObjectDefines.h @@ -16,6 +16,7 @@ namespace GameLogic ObjectType_Static, ObjectType_Dynamic, ObjectType_Light, + ObjectType_SpawnPoint, //Etc ObjectType_NUM_OF_TYPES, @@ -38,7 +39,6 @@ namespace GameLogic ObjectSpecialType_CrystalShard, ObjectSpecialType_JumpPad, ObjectSpecialType_Portal, - ObjectSpecialType_SpawnPoint, ObjectSpecialType_Player, @@ -206,6 +206,13 @@ namespace GameLogic virtual ~ObjectHeader(){} }; + //inheritance from the base class because there is no use for ModelFile, Rotation and Scale + //so this is a special struct for just spawnpoints + struct SpawnPointAttributes : public ObjectTypeHeader + { + float position[3]; + }; + /************************************ Special objects *************************************/ @@ -234,6 +241,8 @@ namespace GameLogic + + /************************************ Lights *************************************/ diff --git a/Code/Game/GameLogic/LevelLoader/LevelParser.cpp b/Code/Game/GameLogic/LevelLoader/LevelParser.cpp index 038b9a40..1e33361d 100644 --- a/Code/Game/GameLogic/LevelLoader/LevelParser.cpp +++ b/Code/Game/GameLogic/LevelLoader/LevelParser.cpp @@ -3,7 +3,6 @@ ///////////////////////////////////// #include "LevelParser.h" - #include "Loader.h" #include "ParseFunctions.h" @@ -59,6 +58,27 @@ std::vector> LevelParser::Parse(std::string filen break; } + case ObjectType_SpawnPoint: + { + loadCgf = false; + ObjectHeader* header = new ObjectHeader; + ParseObject(&buffer[counter], *header, counter, loadCgf); + + SpawnPointAttributes* spawn = new SpawnPointAttributes; + + spawn->typeID = header->typeID; + + for(int i = 0; i < 3; i++) + { + spawn->position[i] = header->position[i]; + } + + delete header; + //objects.push_back(header); + objects.push_back(spawn); + break; + } + //This is by design, static and dynamic is using the same converter. Do not add anything inbetween them. //Unless they are changed to not be the same. case ObjectType_Static: case ObjectType_Dynamic: @@ -134,13 +154,6 @@ std::vector> LevelParser::Parse(std::string filen break; } - case ObjectSpecialType_SpawnPoint: - { - loadCgf = false; - ObjectHeader* header = new ObjectHeader; - ParseObject(&buffer[counter], *header, counter, loadCgf); - } - default: //Couldn't find specialType break; diff --git a/Code/Game/GameLogic/LevelLoader/ObjectDefines.h b/Code/Game/GameLogic/LevelLoader/ObjectDefines.h index 50c722b6..01d17c3e 100644 --- a/Code/Game/GameLogic/LevelLoader/ObjectDefines.h +++ b/Code/Game/GameLogic/LevelLoader/ObjectDefines.h @@ -16,6 +16,7 @@ namespace GameLogic ObjectType_Static, ObjectType_Dynamic, ObjectType_Light, + ObjectType_SpawnPoint, //Etc ObjectType_NUM_OF_TYPES, @@ -38,7 +39,6 @@ namespace GameLogic ObjectSpecialType_CrystalShard, ObjectSpecialType_JumpPad, ObjectSpecialType_Portal, - ObjectSpecialType_SpawnPoint, ObjectSpecialType_Player, ObjectSpecialType_Generic, @@ -207,6 +207,11 @@ namespace GameLogic virtual ~ObjectHeader(){} }; + struct SpawnPointAttributes : public ObjectTypeHeader + { + ObjectSpecialType specialTypeID; + float position[3]; + }; /************************************ Special objects *************************************/