GL- levelLoader can now load a correct spawnpoint
This commit is contained in:
parent
bfb9864be9
commit
3051621f30
|
@ -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;
|
||||
|
|
|
@ -59,6 +59,27 @@ std::vector<SmartPointer<ObjectTypeHeader>> 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<SmartPointer<ObjectTypeHeader>> LevelParser::Parse(std::string filen
|
|||
objects.push_back(header);
|
||||
break;
|
||||
}
|
||||
//this is a hotfix, fix so you only load the relevant data when the file is updated
|
||||
|
||||
case ObjectSpecialType_SpawnPoint:
|
||||
{
|
||||
loadCgf = false;
|
||||
ObjectHeader* header = new ObjectHeader;
|
||||
ParseObject(&buffer[counter], *header, counter, loadCgf);
|
||||
}
|
||||
|
||||
default:
|
||||
//Couldn't find specialType
|
||||
|
|
|
@ -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
|
||||
*************************************/
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
/////////////////////////////////////
|
||||
|
||||
#include "LevelParser.h"
|
||||
|
||||
#include "Loader.h"
|
||||
#include "ParseFunctions.h"
|
||||
|
||||
|
@ -59,6 +58,27 @@ std::vector<SmartPointer<ObjectTypeHeader>> 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<SmartPointer<ObjectTypeHeader>> 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;
|
||||
|
|
|
@ -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
|
||||
*************************************/
|
||||
|
|
Loading…
Reference in New Issue