2010-11-20 10:37:14 +00:00
|
|
|
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
|
|
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
2010-09-09 03:37:08 +00:00
|
|
|
/*
|
2010-09-06 10:29:28 +00:00
|
|
|
#include <game/server/gamecontext.h>
|
2010-08-25 14:15:59 +00:00
|
|
|
#include "flag.h"
|
|
|
|
|
2010-09-06 10:29:28 +00:00
|
|
|
CFlag::CFlag(CGameWorld *pGameWorld, int Team)
|
2010-08-25 14:15:59 +00:00
|
|
|
: CEntity(pGameWorld, NETOBJTYPE_FLAG)
|
|
|
|
{
|
2010-11-13 13:22:19 +00:00
|
|
|
m_Number = Team;
|
2010-09-06 10:29:28 +00:00
|
|
|
m_ProximityRadius = ms_PhysSize;
|
|
|
|
m_pCarryingCharacter = NULL;
|
|
|
|
m_GrabTick = 0;
|
2010-08-25 14:15:59 +00:00
|
|
|
|
2010-09-06 10:29:28 +00:00
|
|
|
Reset();
|
2010-08-25 14:15:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFlag::Reset()
|
|
|
|
{
|
2010-09-06 10:29:28 +00:00
|
|
|
m_pCarryingCharacter = NULL;
|
|
|
|
m_AtStand = 1;
|
|
|
|
m_Pos = m_StandPos;
|
|
|
|
m_Vel = vec2(0,0);
|
|
|
|
m_GrabTick = 0;
|
2010-08-25 14:15:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFlag::Snap(int SnappingClient)
|
|
|
|
{
|
2010-11-13 13:22:19 +00:00
|
|
|
CNetObj_Flag *pFlag = (CNetObj_Flag *)Server()->SnapNewItem(NETOBJTYPE_FLAG, m_Number, sizeof(CNetObj_Flag));
|
2010-12-16 02:29:08 +00:00
|
|
|
if(!pFlag)
|
|
|
|
return;
|
|
|
|
|
2010-08-25 14:15:59 +00:00
|
|
|
pFlag->m_X = (int)m_Pos.x;
|
|
|
|
pFlag->m_Y = (int)m_Pos.y;
|
2010-11-13 13:22:19 +00:00
|
|
|
pFlag->m_Number = m_Number;
|
2010-08-25 14:15:59 +00:00
|
|
|
pFlag->m_CarriedBy = -1;
|
|
|
|
|
2010-09-06 10:29:28 +00:00
|
|
|
if(m_AtStand)
|
2010-08-25 14:15:59 +00:00
|
|
|
pFlag->m_CarriedBy = -2;
|
2010-09-06 10:29:28 +00:00
|
|
|
else if(m_pCarryingCharacter && m_pCarryingCharacter->GetPlayer())
|
|
|
|
pFlag->m_CarriedBy = m_pCarryingCharacter->GetPlayer()->GetCID();
|
|
|
|
}
|
2010-09-09 03:37:08 +00:00
|
|
|
*/
|