Merge branch 'GameLogic' of https://github.com/dean11/Danbias into GameLogic

This commit is contained in:
Linda Andersson 2013-12-13 12:03:04 +01:00
commit c41f5dda3f
7 changed files with 32 additions and 13 deletions

View File

@ -1,3 +1,6 @@
//////////////////////////////////////////////////
//Created by Erik of the GameLogic team
//////////////////////////////////////////////////
#ifndef ATTATCHMENTMASSDRIVER_H #ifndef ATTATCHMENTMASSDRIVER_H
#define ATTATCHMENTMASSDRIVER_H #define ATTATCHMENTMASSDRIVER_H
#include "IAttatchment.h" #include "IAttatchment.h"

View File

@ -1,3 +1,7 @@
//////////////////////////////////////////////////
//Created by Erik of the GameLogic team
//////////////////////////////////////////////////
#ifndef ATTATCHMENTSOCKET_H #ifndef ATTATCHMENTSOCKET_H
#define ATTATCHMENTSOCKET_H #define ATTATCHMENTSOCKET_H
#include "IAttatchment.h" #include "IAttatchment.h"

View File

@ -168,7 +168,6 @@
<ItemGroup> <ItemGroup>
<ClInclude Include="AttatchmentMassDriver.h" /> <ClInclude Include="AttatchmentMassDriver.h" />
<ClInclude Include="AttatchmentSocket.h" /> <ClInclude Include="AttatchmentSocket.h" />
<ClInclude Include="Camera.h" />
<ClInclude Include="CollisionManager.h" /> <ClInclude Include="CollisionManager.h" />
<ClInclude Include="DynamicObject.h" /> <ClInclude Include="DynamicObject.h" />
<ClInclude Include="GameMode.h" /> <ClInclude Include="GameMode.h" />
@ -182,7 +181,6 @@
<ItemGroup> <ItemGroup>
<ClCompile Include="AttatchmentMassDriver.cpp" /> <ClCompile Include="AttatchmentMassDriver.cpp" />
<ClCompile Include="AttatchmentSocket.cpp" /> <ClCompile Include="AttatchmentSocket.cpp" />
<ClCompile Include="Camera.cpp" />
<ClCompile Include="CollisionManager.cpp" /> <ClCompile Include="CollisionManager.cpp" />
<ClCompile Include="DynamicObject.cpp" /> <ClCompile Include="DynamicObject.cpp" />
<ClCompile Include="GameMode.cpp" /> <ClCompile Include="GameMode.cpp" />

View File

@ -1,3 +1,7 @@
//////////////////////////////////////////////////
//Created by Erik of the GameLogic team
//////////////////////////////////////////////////
#ifndef IATTATCHMENT_H #ifndef IATTATCHMENT_H
#define IATTATCHMENT_H #define IATTATCHMENT_H
#include "GameLogicStates.h" #include "GameLogicStates.h"

View File

@ -2,6 +2,7 @@
#include "StaticObject.h" #include "StaticObject.h"
#include "DynamicObject.h" #include "DynamicObject.h"
#include "GameMode.h" #include "GameMode.h"
#include "Player.h"
using namespace GameLogic; using namespace GameLogic;
@ -15,6 +16,8 @@ struct Level::PrivateData
{ {
} }
Player *players;
int nrOfPlayers;
StaticObject** staticObjects; StaticObject** staticObjects;
int nrOfStaticObjects; int nrOfStaticObjects;
@ -37,4 +40,9 @@ Level::~Level(void)
delete myData; delete myData;
} }
void Level::InitiateLevel(std::string levelPath)
{
}

View File

@ -3,6 +3,7 @@
////////////////////////////////////////////////// //////////////////////////////////////////////////
#ifndef LEVEL_H #ifndef LEVEL_H
#define LEVEL_H #define LEVEL_H
#include <string>
namespace GameLogic namespace GameLogic
{ {
@ -14,7 +15,7 @@ namespace GameLogic
Level(void); Level(void);
~Level(void); ~Level(void);
void CreateBox(); void InitiateLevel(std::string levelPath);
private: private:
struct PrivateData; struct PrivateData;

View File

@ -9,9 +9,10 @@ struct Weapon::PrivateData
PrivateData() PrivateData()
{ {
weaponState = WEAPON_STATE_IDLE; weaponState = WEAPON_STATE_IDLE;
SelectedAttatchment = 0; selectedAttatchment = 0;
currentNrOfAttatchments = 0; currentNrOfAttatchments = 0;
selectedSocketID = 0; selectedSocketID = 0;
maxNrOfSockets = 0;
} }
~PrivateData() ~PrivateData()
@ -21,10 +22,10 @@ struct Weapon::PrivateData
WEAPON_STATE weaponState; WEAPON_STATE weaponState;
AttatchmentSocket **attatchmentSockets; AttatchmentSocket **attatchmentSockets;
int MaxNrOfSockets; int maxNrOfSockets;
int currentNrOfAttatchments; int currentNrOfAttatchments;
IAttatchment *SelectedAttatchment; IAttatchment *selectedAttatchment;
int selectedSocketID; int selectedSocketID;
}myData; }myData;
@ -37,7 +38,7 @@ Weapon::Weapon()
Weapon::Weapon(int MaxNrOfSockets) Weapon::Weapon(int MaxNrOfSockets)
{ {
myData = new PrivateData(); myData = new PrivateData();
myData->MaxNrOfSockets = MaxNrOfSockets; myData->maxNrOfSockets = MaxNrOfSockets;
myData->attatchmentSockets = new AttatchmentSocket*[MaxNrOfSockets]; myData->attatchmentSockets = new AttatchmentSocket*[MaxNrOfSockets];
for (int i = 0; i < MaxNrOfSockets; i++) for (int i = 0; i < MaxNrOfSockets; i++)
{ {
@ -56,7 +57,7 @@ Weapon::~Weapon(void)
********************************************************/ ********************************************************/
void Weapon::Use(const WEAPON_FIRE &fireInput) void Weapon::Use(const WEAPON_FIRE &fireInput)
{ {
myData->SelectedAttatchment->UseAttatchment(fireInput); myData->selectedAttatchment->UseAttatchment(fireInput);
} }
/******************************************************** /********************************************************
@ -83,7 +84,7 @@ bool Weapon::IsReloading()
bool Weapon::IsValidSocket(int socketID) bool Weapon::IsValidSocket(int socketID)
{ {
if(socketID < myData->MaxNrOfSockets && socketID >= 0) if(socketID < myData->maxNrOfSockets && socketID >= 0)
{ {
if (myData->attatchmentSockets[socketID]->GetAttatchment() != 0) if (myData->attatchmentSockets[socketID]->GetAttatchment() != 0)
{ {
@ -100,16 +101,16 @@ int Weapon::GetCurrentSocketID()
} }
void Weapon::AddNewAttatchment(IAttatchment *attatchment) void Weapon::AddNewAttatchment(IAttatchment *attatchment, Player *owner)
{ {
if(myData->currentNrOfAttatchments < myData->MaxNrOfSockets) if(myData->currentNrOfAttatchments < myData->maxNrOfSockets)
{ {
myData->attatchmentSockets[myData->currentNrOfAttatchments]->SetAttatchment(attatchment); myData->attatchmentSockets[myData->currentNrOfAttatchments]->SetAttatchment(attatchment);
myData->currentNrOfAttatchments++; myData->currentNrOfAttatchments++;
} }
} }
void Weapon::SwitchAttatchment(IAttatchment *attatchment, int socketID) void Weapon::SwitchAttatchment(IAttatchment *attatchment, int socketID, Player *owner)
{ {
if (IsValidSocket(socketID)) if (IsValidSocket(socketID))
{ {
@ -129,7 +130,7 @@ void Weapon::SelectAttatchment(int socketID)
{ {
if (IsValidSocket(socketID)) if (IsValidSocket(socketID))
{ {
myData->SelectedAttatchment = myData->attatchmentSockets[socketID]->GetAttatchment(); myData->selectedAttatchment = myData->attatchmentSockets[socketID]->GetAttatchment();
myData->selectedSocketID = socketID; myData->selectedSocketID = socketID;
} }