From 8110b677ff2704bc72607d1d2e61abef6e5fae12 Mon Sep 17 00:00:00 2001 From: lindaandersson Date: Fri, 14 Feb 2014 13:09:55 +0100 Subject: [PATCH] GL - added spawnpoint array --- .../DanBiasGame/GameClientState/GameState.cpp | 5 ++- Code/Game/GameLogic/Level.cpp | 37 +------------------ Code/Game/GameLogic/Level.h | 1 + 3 files changed, 7 insertions(+), 36 deletions(-) diff --git a/Code/Game/DanBiasGame/GameClientState/GameState.cpp b/Code/Game/DanBiasGame/GameClientState/GameState.cpp index 9e42c87b..c4da14bb 100644 --- a/Code/Game/DanBiasGame/GameClientState/GameState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/GameState.cpp @@ -183,7 +183,10 @@ bool GameState::LoadModels(std::string mapFile) case GameLogic::ObjectType::ObjectType_Static: { GameLogic::ObjectHeader* staticObjData = ((GameLogic::ObjectHeader*)obj); - + if((ObjectSpecialType)staticObjData->specialTypeID == ObjectSpecialType_Sky) + { + int i = 0; + } modelData.modelPath.assign(staticObjData->ModelFile.begin(), staticObjData->ModelFile.end()); modelData.visible = true; modelData.position = staticObjData->position; diff --git a/Code/Game/GameLogic/Level.cpp b/Code/Game/GameLogic/Level.cpp index 6d3de52c..a828f30b 100644 --- a/Code/Game/GameLogic/Level.cpp +++ b/Code/Game/GameLogic/Level.cpp @@ -33,7 +33,7 @@ Object* Level::createGameObj(ObjectHeader* obj, ICustomBody* rigidBody) case ObjectSpecialType_Sky: { float skySize = ((SkyAttributes*)obj)->skySize; - gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID++); + //gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID++); } break; case ObjectSpecialType_World: @@ -111,13 +111,12 @@ Object* Level::createGameObj(ObjectHeader* obj, ICustomBody* rigidBody) case ObjectSpecialType_SpawnPoint: { // save - gameObj = new StaticObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID++); + } break; case ObjectSpecialType_Player: { // should not be read from the lvl format - //gameObj = new Player(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID,objID++); } break; case ObjectSpecialType_Generic: @@ -206,12 +205,10 @@ void Level::InitiateLevel(std::string levelPath) API::Instance().SetGravityPoint(Oyster::Math3D::Float3(0,0,0)); API::Instance().SetGravity(200); int objCount = objects.size(); - int modelCount = 100; for (int i = 0; i < objCount; i++) { ObjectTypeHeader* obj = objects.at(i); - int id = obj->typeID; switch (obj->typeID) { case ObjectType::ObjectType_LevelMetaData: @@ -223,7 +220,6 @@ void Level::InitiateLevel(std::string levelPath) break; case ObjectType::ObjectType_Static: { - ObjectHeader* staticObjData = ((ObjectHeader*)obj); staticObjData->ModelFile; @@ -237,7 +233,6 @@ void Level::InitiateLevel(std::string levelPath) else if(staticObjData->boundingVolume.geoType == CollisionGeometryType_Box) { - rigidBody_Static = InitRigidBodyCube(staticObjData); } @@ -248,22 +243,13 @@ void Level::InitiateLevel(std::string levelPath) if(rigidBody_Static != NULL) { - // create game object Object* staticGameObj = createGameObj(staticObjData, rigidBody_Static); - //Object* staticGameObj = new StaticObject(rigidBody_Static, Object::DefaultCollisionAfter, (ObjectSpecialType)staticObjData->specialTypeID); if(staticGameObj != NULL) { this->staticObjects.Push((StaticObject*)staticGameObj); - //this->staticObjects[this->staticObjects.Size()-1]->objectID = modelCount++; - //rigidBody_Static->SetCustomTag(this->staticObjects[this->staticObjects.Size()-1]); } - - //this->staticObjects.Push(new StaticObject(rigidBody_Static, Object::DefaultCollisionAfter, (ObjectSpecialType)staticObjData->specialTypeID, 0)); - //this->staticObjects[staticObjCount]->objectID = modelCount++; - } - } break; case ObjectType::ObjectType_Dynamic: @@ -293,12 +279,9 @@ void Level::InitiateLevel(std::string levelPath) { // create game object Object* dynamicGameObj = createGameObj(dynamicObjData, rigidBody_Dynamic); - //Object* dynamicGameObj =new DynamicObject(rigidBody_Dynamic, Object::DefaultCollisionAfter, (ObjectSpecialType)dynamicObjData->specialTypeID); if (dynamicGameObj != NULL) { this->dynamicObjects.Push((DynamicObject*)dynamicGameObj); - //this->dynamicObjects[this->dynamicObjects.Size()-1]->objectID = modelCount++; - //rigidBody_Dynamic->SetCustomTag(this->dynamicObjects[this->dynamicObjects.Size()-1]); } } } @@ -334,9 +317,6 @@ void Level::InitiateLevel(float radius) rigidBody_TestBox = API::Instance().AddCollisionBox(Oyster::Math::Float3(0.5f, 0.5f, 0.5f), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(0, 605 + i*5, 10), 5, 0.5f, 0.8f, 0.6f); this->dynamicObjects.Push(new DynamicObject(rigidBody_TestBox, Object::DefaultCollisionAfter, ObjectSpecialType_StandardBox, idCount++)); - - //this->dynamicObjects[i]->objectID = idCount++; - rigidBody_TestBox->SetCustomTag(this->dynamicObjects[i]); } /*offset += nrOfBoxex; for(int i =0; i< nrOfBoxex; i ++) @@ -365,31 +345,18 @@ void Level::InitiateLevel(float radius) }*/ - - - - // add crystal ICustomBody* rigidBody_Crystal = API::Instance().AddCollisionBox(Oyster::Math::Float3(0.5f, 0.5f, 0.5f), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(10, 605, 0), 5, 0.5f, 0.8f, 0.6f); - this->dynamicObjects.Push(new DynamicObject(rigidBody_Crystal, Object::DefaultCollisionAfter, ObjectSpecialType_StandardBox, idCount++)); - rigidBody_Crystal->SetCustomTag(this->dynamicObjects[nrOfBoxex]); - //this->dynamicObjects[nrOfBoxex]->objectID = idCount++; - - // add house ICustomBody* rigidBody_House =API::Instance().AddCollisionBox(Oyster::Math::Float3(20, 20, 20), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(-50, 590, 0), 0, 0.5f, 0.8f, 0.6f); this->staticObjects.Push(new StaticObject(rigidBody_House, Object::DefaultCollisionAfter, ObjectSpecialType_Generic, idCount++)); - rigidBody_House->SetCustomTag(this->staticObjects[0]); - //this->staticObjects[0]->objectID = idCount++; // add jumppad ICustomBody* rigidBody_Jumppad = API::Instance().AddCollisionBox(Oyster::Math::Float3(1, 1, 1), Oyster::Math::Float4(0, 0, 0, 1), Oyster::Math::Float3(4, 600.3, 0), 5, 0.5f, 0.8f, 0.6f); - this->staticObjects.Push(new JumpPad(rigidBody_Jumppad, ObjectSpecialType_JumpPad,idCount++ ,Oyster::Math::Float3(0,2000,0))); rigidBody_Jumppad->SetCustomTag(this->staticObjects[1]); - //this->staticObjects[1]->objectID = idCount++; } void Level::AddPlayerToTeam(Player *player, int teamID) diff --git a/Code/Game/GameLogic/Level.h b/Code/Game/GameLogic/Level.h index 0b6c2a31..623d04b2 100644 --- a/Code/Game/GameLogic/Level.h +++ b/Code/Game/GameLogic/Level.h @@ -77,6 +77,7 @@ namespace GameLogic Utility::DynamicMemory::SmartPointer rigidBodyLevel; StaticObject *levelObj; int objID; + Utility::DynamicMemory::DynamicArray spawnPoints; };