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
#define ATTATCHMENTMASSDRIVER_H
#include "IAttatchment.h"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,9 +9,10 @@ struct Weapon::PrivateData
PrivateData()
{
weaponState = WEAPON_STATE_IDLE;
SelectedAttatchment = 0;
selectedAttatchment = 0;
currentNrOfAttatchments = 0;
selectedSocketID = 0;
maxNrOfSockets = 0;
}
~PrivateData()
@ -21,10 +22,10 @@ struct Weapon::PrivateData
WEAPON_STATE weaponState;
AttatchmentSocket **attatchmentSockets;
int MaxNrOfSockets;
int maxNrOfSockets;
int currentNrOfAttatchments;
IAttatchment *SelectedAttatchment;
IAttatchment *selectedAttatchment;
int selectedSocketID;
}myData;
@ -37,7 +38,7 @@ Weapon::Weapon()
Weapon::Weapon(int MaxNrOfSockets)
{
myData = new PrivateData();
myData->MaxNrOfSockets = MaxNrOfSockets;
myData->maxNrOfSockets = MaxNrOfSockets;
myData->attatchmentSockets = new AttatchmentSocket*[MaxNrOfSockets];
for (int i = 0; i < MaxNrOfSockets; i++)
{
@ -56,7 +57,7 @@ Weapon::~Weapon(void)
********************************************************/
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)
{
if(socketID < myData->MaxNrOfSockets && socketID >= 0)
if(socketID < myData->maxNrOfSockets && socketID >= 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->currentNrOfAttatchments++;
}
}
void Weapon::SwitchAttatchment(IAttatchment *attatchment, int socketID)
void Weapon::SwitchAttatchment(IAttatchment *attatchment, int socketID, Player *owner)
{
if (IsValidSocket(socketID))
{
@ -129,7 +130,7 @@ void Weapon::SelectAttatchment(int socketID)
{
if (IsValidSocket(socketID))
{
myData->SelectedAttatchment = myData->attatchmentSockets[socketID]->GetAttatchment();
myData->selectedAttatchment = myData->attatchmentSockets[socketID]->GetAttatchment();
myData->selectedSocketID = socketID;
}