2011-12-25 13:33:05 +00:00
|
|
|
/* (c) Shereef Marzouk. See "licence DDRace.txt" and the readme.txt in the root of the distribution for more information. */
|
2010-07-29 05:21:18 +00:00
|
|
|
#include <engine/config.h>
|
|
|
|
#include <engine/server.h>
|
|
|
|
#include <game/generated/protocol.h>
|
|
|
|
#include <game/server/gamecontext.h>
|
2011-12-25 13:00:47 +00:00
|
|
|
#include <game/server/teams.h>
|
|
|
|
#include <game/server/gamemodes/DDRace.h>
|
2010-08-21 17:32:42 +00:00
|
|
|
#include "dragger.h"
|
2010-07-29 05:21:18 +00:00
|
|
|
|
2011-12-25 13:51:04 +00:00
|
|
|
const int LENGTH = 700;
|
2010-07-29 05:21:18 +00:00
|
|
|
|
2011-12-25 13:51:04 +00:00
|
|
|
CDragger::CDragger(CGameWorld *pGameWorld, vec2 Pos, float Strength, bool NW,
|
|
|
|
int CatchedTeam, int Layer, int Number) :
|
|
|
|
CEntity(pGameWorld, CGameWorld::ENTTYPE_LASER)
|
2010-07-29 05:21:18 +00:00
|
|
|
{
|
2010-11-13 13:22:19 +00:00
|
|
|
m_Layer = Layer;
|
|
|
|
m_Number = Number;
|
2010-08-30 23:45:42 +00:00
|
|
|
m_Pos = Pos;
|
|
|
|
m_Strength = Strength;
|
|
|
|
m_EvalTick = Server()->Tick();
|
|
|
|
m_NW = NW;
|
2010-09-22 10:43:59 +00:00
|
|
|
m_CatchedTeam = CatchedTeam;
|
2010-07-29 05:21:18 +00:00
|
|
|
GameWorld()->InsertEntity(this);
|
2014-05-07 22:53:21 +00:00
|
|
|
|
|
|
|
for (int i = 0; i < MAX_CLIENTS; i++)
|
|
|
|
{
|
|
|
|
m_SoloIDs[i] = -1;
|
|
|
|
}
|
2010-07-29 05:21:18 +00:00
|
|
|
}
|
|
|
|
|
2010-08-30 23:45:42 +00:00
|
|
|
void CDragger::Move()
|
2010-07-29 05:21:18 +00:00
|
|
|
{
|
2014-05-08 13:45:02 +00:00
|
|
|
if (m_Target && (!m_Target->IsAlive() || (m_Target->IsAlive()
|
2012-04-27 13:01:26 +00:00
|
|
|
&& (m_Target->m_Super || m_Target->IsPaused()
|
2011-12-25 13:51:04 +00:00
|
|
|
|| (m_Layer == LAYER_SWITCH
|
2014-05-08 13:45:02 +00:00
|
|
|
&& !GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[m_Target->Team()])))))
|
2010-11-13 13:22:19 +00:00
|
|
|
m_Target = 0;
|
2014-05-08 13:42:20 +00:00
|
|
|
|
2014-05-07 22:53:21 +00:00
|
|
|
mem_zero(m_SoloEnts, sizeof(m_SoloEnts));
|
2014-05-08 13:42:20 +00:00
|
|
|
CCharacter *TempEnts[MAX_CLIENTS];
|
|
|
|
|
2011-12-25 13:51:04 +00:00
|
|
|
int Num = GameServer()->m_World.FindEntities(m_Pos, LENGTH,
|
2014-05-07 22:53:21 +00:00
|
|
|
(CEntity**) m_SoloEnts, MAX_CLIENTS, CGameWorld::ENTTYPE_CHARACTER);
|
2014-05-08 13:42:20 +00:00
|
|
|
mem_copy(TempEnts, m_SoloEnts, sizeof(TempEnts));
|
|
|
|
|
2011-12-25 13:51:04 +00:00
|
|
|
int Id = -1;
|
|
|
|
int MinLen = 0;
|
2014-05-07 22:53:21 +00:00
|
|
|
CCharacter *Temp;
|
2010-08-30 23:45:42 +00:00
|
|
|
for (int i = 0; i < Num; i++)
|
2010-07-29 05:21:18 +00:00
|
|
|
{
|
2014-05-07 22:53:21 +00:00
|
|
|
Temp = m_SoloEnts[i];
|
|
|
|
if (Temp->Team() != m_CatchedTeam)
|
|
|
|
{
|
|
|
|
m_SoloEnts[i] = 0;
|
2011-12-25 13:51:04 +00:00
|
|
|
continue;
|
2014-05-07 22:53:21 +00:00
|
|
|
}
|
2011-12-25 13:51:04 +00:00
|
|
|
if (m_Layer == LAYER_SWITCH
|
2014-05-07 22:53:21 +00:00
|
|
|
&& !GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[Temp->Team()])
|
|
|
|
{
|
|
|
|
m_SoloEnts[i] = 0;
|
2011-12-25 13:51:04 +00:00
|
|
|
continue;
|
2014-05-07 22:53:21 +00:00
|
|
|
}
|
2011-12-25 13:51:04 +00:00
|
|
|
int Res =
|
|
|
|
m_NW ? GameServer()->Collision()->IntersectNoLaserNW(m_Pos,
|
2014-05-07 22:53:21 +00:00
|
|
|
Temp->m_Pos, 0, 0) :
|
2011-12-25 13:51:04 +00:00
|
|
|
GameServer()->Collision()->IntersectNoLaser(m_Pos,
|
2014-05-07 22:53:21 +00:00
|
|
|
Temp->m_Pos, 0, 0);
|
2010-07-29 05:21:18 +00:00
|
|
|
|
2011-12-25 13:51:04 +00:00
|
|
|
if (Res == 0)
|
2010-07-29 05:21:18 +00:00
|
|
|
{
|
2014-05-07 22:53:21 +00:00
|
|
|
int Len = length(Temp->m_Pos - m_Pos);
|
2011-12-25 13:51:04 +00:00
|
|
|
if (MinLen == 0 || MinLen > Len)
|
2010-07-29 05:21:18 +00:00
|
|
|
{
|
2011-12-25 13:51:04 +00:00
|
|
|
MinLen = Len;
|
|
|
|
Id = i;
|
2010-07-29 05:21:18 +00:00
|
|
|
}
|
2014-05-07 22:53:21 +00:00
|
|
|
|
|
|
|
if (!Temp->Teams()->m_Core.GetSolo(Temp->GetPlayer()->GetCID()))
|
|
|
|
m_SoloEnts[i] = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_SoloEnts[i] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!m_Target)
|
2014-05-08 13:42:20 +00:00
|
|
|
m_Target = Id != -1 ? TempEnts[Id] : 0;
|
2014-05-07 22:53:21 +00:00
|
|
|
|
|
|
|
if (m_Target)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < MAX_CLIENTS; i++)
|
|
|
|
{
|
|
|
|
if (m_SoloEnts[i] == m_Target)
|
|
|
|
m_SoloEnts[i] = 0;
|
2010-07-29 05:21:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-30 23:45:42 +00:00
|
|
|
void CDragger::Drag()
|
2010-07-29 05:21:18 +00:00
|
|
|
{
|
2010-09-22 00:03:14 +00:00
|
|
|
if (m_Target)
|
2010-07-29 05:21:18 +00:00
|
|
|
{
|
2014-05-07 22:53:21 +00:00
|
|
|
CCharacter *Target = m_Target;
|
2010-09-22 00:03:14 +00:00
|
|
|
|
2014-05-07 22:53:21 +00:00
|
|
|
for (int i = -1; i < MAX_CLIENTS; i++)
|
2010-07-29 05:21:18 +00:00
|
|
|
{
|
2014-05-07 22:53:21 +00:00
|
|
|
if (i >= 0)
|
|
|
|
Target = m_SoloEnts[i];
|
|
|
|
|
|
|
|
if (!Target)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
int Res = 0;
|
|
|
|
if (!m_NW)
|
|
|
|
Res = GameServer()->Collision()->IntersectNoLaser(m_Pos,
|
|
|
|
Target->m_Pos, 0, 0);
|
|
|
|
else
|
|
|
|
Res = GameServer()->Collision()->IntersectNoLaserNW(m_Pos,
|
|
|
|
Target->m_Pos, 0, 0);
|
|
|
|
if (Res || length(m_Pos - Target->m_Pos) > 700)
|
|
|
|
{
|
|
|
|
Target = 0;
|
|
|
|
if (i == -1)
|
|
|
|
m_Target = 0;
|
|
|
|
else
|
|
|
|
m_SoloEnts[i] = 0;
|
|
|
|
}
|
|
|
|
else if (length(m_Pos - Target->m_Pos) > 28)
|
|
|
|
{
|
|
|
|
vec2 Temp = Target->Core()->m_Vel
|
|
|
|
+ (normalize(m_Pos - Target->m_Pos) * m_Strength);
|
|
|
|
if (Temp.x > 0
|
|
|
|
&& ((Target->m_TileIndex == TILE_STOP
|
|
|
|
&& Target->m_TileFlags == ROTATION_270)
|
|
|
|
|| (Target->m_TileIndexL == TILE_STOP
|
|
|
|
&& Target->m_TileFlagsL == ROTATION_270)
|
|
|
|
|| (Target->m_TileIndexL == TILE_STOPS
|
|
|
|
&& (Target->m_TileFlagsL == ROTATION_90
|
|
|
|
|| Target->m_TileFlagsL
|
|
|
|
== ROTATION_270))
|
|
|
|
|| (Target->m_TileIndexL == TILE_STOPA)
|
|
|
|
|| (Target->m_TileFIndex == TILE_STOP
|
|
|
|
&& Target->m_TileFFlags == ROTATION_270)
|
|
|
|
|| (Target->m_TileFIndexL == TILE_STOP
|
|
|
|
&& Target->m_TileFFlagsL == ROTATION_270)
|
|
|
|
|| (Target->m_TileFIndexL == TILE_STOPS
|
|
|
|
&& (Target->m_TileFFlagsL == ROTATION_90
|
|
|
|
|| Target->m_TileFFlagsL
|
|
|
|
== ROTATION_270))
|
|
|
|
|| (Target->m_TileFIndexL == TILE_STOPA)
|
|
|
|
|| (Target->m_TileSIndex == TILE_STOP
|
|
|
|
&& Target->m_TileSFlags == ROTATION_270)
|
|
|
|
|| (Target->m_TileSIndexL == TILE_STOP
|
|
|
|
&& Target->m_TileSFlagsL == ROTATION_270)
|
|
|
|
|| (Target->m_TileSIndexL == TILE_STOPS
|
|
|
|
&& (Target->m_TileSFlagsL == ROTATION_90
|
|
|
|
|| Target->m_TileSFlagsL
|
|
|
|
== ROTATION_270))
|
|
|
|
|| (Target->m_TileSIndexL == TILE_STOPA)))
|
|
|
|
Temp.x = 0;
|
|
|
|
if (Temp.x < 0
|
|
|
|
&& ((Target->m_TileIndex == TILE_STOP
|
|
|
|
&& Target->m_TileFlags == ROTATION_90)
|
|
|
|
|| (Target->m_TileIndexR == TILE_STOP
|
|
|
|
&& Target->m_TileFlagsR == ROTATION_90)
|
|
|
|
|| (Target->m_TileIndexR == TILE_STOPS
|
|
|
|
&& (Target->m_TileFlagsR == ROTATION_90
|
|
|
|
|| Target->m_TileFlagsR
|
|
|
|
== ROTATION_270))
|
|
|
|
|| (Target->m_TileIndexR == TILE_STOPA)
|
|
|
|
|| (Target->m_TileFIndex == TILE_STOP
|
|
|
|
&& Target->m_TileFFlags == ROTATION_90)
|
|
|
|
|| (Target->m_TileFIndexR == TILE_STOP
|
|
|
|
&& Target->m_TileFFlagsR == ROTATION_90)
|
|
|
|
|| (Target->m_TileFIndexR == TILE_STOPS
|
|
|
|
&& (Target->m_TileFFlagsR == ROTATION_90
|
|
|
|
|| Target->m_TileFFlagsR
|
|
|
|
== ROTATION_270))
|
|
|
|
|| (Target->m_TileFIndexR == TILE_STOPA)
|
|
|
|
|| (Target->m_TileSIndex == TILE_STOP
|
|
|
|
&& Target->m_TileSFlags == ROTATION_90)
|
|
|
|
|| (Target->m_TileSIndexR == TILE_STOP
|
|
|
|
&& Target->m_TileSFlagsR == ROTATION_90)
|
|
|
|
|| (Target->m_TileSIndexR == TILE_STOPS
|
|
|
|
&& (Target->m_TileSFlagsR == ROTATION_90
|
|
|
|
|| Target->m_TileSFlagsR
|
|
|
|
== ROTATION_270))
|
|
|
|
|| (Target->m_TileSIndexR == TILE_STOPA)))
|
|
|
|
Temp.x = 0;
|
|
|
|
if (Temp.y < 0
|
|
|
|
&& ((Target->m_TileIndex == TILE_STOP
|
|
|
|
&& Target->m_TileFlags == ROTATION_180)
|
|
|
|
|| (Target->m_TileIndexB == TILE_STOP
|
|
|
|
&& Target->m_TileFlagsB == ROTATION_180)
|
|
|
|
|| (Target->m_TileIndexB == TILE_STOPS
|
|
|
|
&& (Target->m_TileFlagsB == ROTATION_0
|
|
|
|
|| Target->m_TileFlagsB
|
|
|
|
== ROTATION_180))
|
|
|
|
|| (Target->m_TileIndexB == TILE_STOPA)
|
|
|
|
|| (Target->m_TileFIndex == TILE_STOP
|
|
|
|
&& Target->m_TileFFlags == ROTATION_180)
|
|
|
|
|| (Target->m_TileFIndexB == TILE_STOP
|
|
|
|
&& Target->m_TileFFlagsB == ROTATION_180)
|
|
|
|
|| (Target->m_TileFIndexB == TILE_STOPS
|
|
|
|
&& (Target->m_TileFFlagsB == ROTATION_0
|
|
|
|
|| Target->m_TileFFlagsB
|
|
|
|
== ROTATION_180))
|
|
|
|
|| (Target->m_TileFIndexB == TILE_STOPA)
|
|
|
|
|| (Target->m_TileSIndex == TILE_STOP
|
|
|
|
&& Target->m_TileSFlags == ROTATION_180)
|
|
|
|
|| (Target->m_TileSIndexB == TILE_STOP
|
|
|
|
&& Target->m_TileSFlagsB == ROTATION_180)
|
|
|
|
|| (Target->m_TileSIndexB == TILE_STOPS
|
|
|
|
&& (Target->m_TileSFlagsB == ROTATION_0
|
|
|
|
|| Target->m_TileSFlagsB
|
|
|
|
== ROTATION_180))
|
|
|
|
|| (Target->m_TileSIndexB == TILE_STOPA)))
|
|
|
|
Temp.y = 0;
|
|
|
|
if (Temp.y > 0
|
|
|
|
&& ((Target->m_TileIndex == TILE_STOP
|
|
|
|
&& Target->m_TileFlags == ROTATION_0)
|
|
|
|
|| (Target->m_TileIndexT == TILE_STOP
|
|
|
|
&& Target->m_TileFlagsT == ROTATION_0)
|
|
|
|
|| (Target->m_TileIndexT == TILE_STOPS
|
|
|
|
&& (Target->m_TileFlagsT == ROTATION_0
|
|
|
|
|| Target->m_TileFlagsT
|
|
|
|
== ROTATION_180))
|
|
|
|
|| (Target->m_TileIndexT == TILE_STOPA)
|
|
|
|
|| (Target->m_TileFIndex == TILE_STOP
|
|
|
|
&& Target->m_TileFFlags == ROTATION_0)
|
|
|
|
|| (Target->m_TileFIndexT == TILE_STOP
|
|
|
|
&& Target->m_TileFFlagsT == ROTATION_0)
|
|
|
|
|| (Target->m_TileFIndexT == TILE_STOPS
|
|
|
|
&& (Target->m_TileFFlagsT == ROTATION_0
|
|
|
|
|| Target->m_TileFFlagsT
|
|
|
|
== ROTATION_180))
|
|
|
|
|| (Target->m_TileFIndexT == TILE_STOPA)
|
|
|
|
|| (Target->m_TileSIndex == TILE_STOP
|
|
|
|
&& Target->m_TileSFlags == ROTATION_0)
|
|
|
|
|| (Target->m_TileSIndexT == TILE_STOP
|
|
|
|
&& Target->m_TileSFlagsT == ROTATION_0)
|
|
|
|
|| (Target->m_TileSIndexT == TILE_STOPS
|
|
|
|
&& (Target->m_TileSFlagsT == ROTATION_0
|
|
|
|
|| Target->m_TileSFlagsT
|
|
|
|
== ROTATION_180))
|
|
|
|
|| (Target->m_TileSIndexT == TILE_STOPA)))
|
|
|
|
Temp.y = 0;
|
|
|
|
Target->Core()->m_Vel = Temp;
|
|
|
|
}
|
2010-07-29 05:21:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-21 17:32:42 +00:00
|
|
|
void CDragger::Reset()
|
2010-07-29 05:21:18 +00:00
|
|
|
{
|
|
|
|
GameServer()->m_World.DestroyEntity(this);
|
|
|
|
}
|
|
|
|
|
2010-08-21 17:32:42 +00:00
|
|
|
void CDragger::Tick()
|
2010-07-29 05:21:18 +00:00
|
|
|
{
|
2011-12-25 13:51:04 +00:00
|
|
|
if (((CGameControllerDDRace*) GameServer()->m_pController)->m_Teams.GetTeamState(
|
|
|
|
m_CatchedTeam) == CGameTeams::TEAMSTATE_EMPTY)
|
2011-12-25 13:00:47 +00:00
|
|
|
return;
|
2011-12-25 13:51:04 +00:00
|
|
|
if (Server()->Tick() % int(Server()->TickSpeed() * 0.15f) == 0)
|
2010-07-29 05:21:18 +00:00
|
|
|
{
|
2010-11-01 01:51:17 +00:00
|
|
|
int Flags;
|
2011-12-25 13:51:04 +00:00
|
|
|
m_EvalTick = Server()->Tick();
|
|
|
|
int index = GameServer()->Collision()->IsMover(m_Pos.x, m_Pos.y,
|
|
|
|
&Flags);
|
2010-11-01 01:51:17 +00:00
|
|
|
if (index)
|
2010-07-29 05:21:18 +00:00
|
|
|
{
|
2011-12-25 13:51:04 +00:00
|
|
|
m_Core = GameServer()->Collision()->CpSpeed(index, Flags);
|
2010-07-29 05:21:18 +00:00
|
|
|
}
|
2011-12-25 13:51:04 +00:00
|
|
|
m_Pos += m_Core;
|
2010-08-30 23:45:42 +00:00
|
|
|
Move();
|
2010-07-29 05:21:18 +00:00
|
|
|
}
|
2010-08-30 23:45:42 +00:00
|
|
|
Drag();
|
2010-07-29 05:21:18 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-08-30 23:45:42 +00:00
|
|
|
void CDragger::Snap(int SnappingClient)
|
2010-07-29 05:21:18 +00:00
|
|
|
{
|
2011-12-25 13:51:04 +00:00
|
|
|
if (((CGameControllerDDRace*) GameServer()->m_pController)->m_Teams.GetTeamState(
|
|
|
|
m_CatchedTeam) == CGameTeams::TEAMSTATE_EMPTY)
|
2011-12-25 13:00:47 +00:00
|
|
|
return;
|
2014-05-07 22:53:21 +00:00
|
|
|
|
2014-05-08 13:42:20 +00:00
|
|
|
CCharacter *Target = m_Target;
|
2014-05-07 22:53:21 +00:00
|
|
|
|
|
|
|
for (int i = 0; i < MAX_CLIENTS; i++)
|
2010-07-29 05:21:18 +00:00
|
|
|
{
|
2014-05-07 22:53:21 +00:00
|
|
|
if (m_SoloIDs[i] == -1)
|
|
|
|
break;
|
2010-07-29 05:21:18 +00:00
|
|
|
|
2014-05-07 22:53:21 +00:00
|
|
|
Server()->SnapFreeID(m_SoloIDs[i]);
|
|
|
|
m_SoloIDs[i] = -1;
|
|
|
|
}
|
2014-01-13 16:00:49 +00:00
|
|
|
|
2014-05-07 22:53:21 +00:00
|
|
|
int pos = 0;
|
2014-01-13 16:00:49 +00:00
|
|
|
|
2014-05-07 22:53:21 +00:00
|
|
|
for (int i = -1; i < MAX_CLIENTS; i++)
|
2011-08-27 10:58:09 +00:00
|
|
|
{
|
2014-05-07 22:53:21 +00:00
|
|
|
if (i >= 0)
|
2014-05-08 13:42:20 +00:00
|
|
|
{
|
2014-05-07 22:53:21 +00:00
|
|
|
Target = m_SoloEnts[i];
|
|
|
|
|
2014-05-08 13:42:20 +00:00
|
|
|
if (!Target)
|
|
|
|
continue;
|
|
|
|
}
|
2014-05-07 22:53:21 +00:00
|
|
|
|
|
|
|
if (Target)
|
|
|
|
{
|
|
|
|
if (NetworkClipped(SnappingClient, m_Pos)
|
|
|
|
&& NetworkClipped(SnappingClient, Target->m_Pos))
|
2014-05-08 13:42:20 +00:00
|
|
|
continue;
|
2014-05-07 22:53:21 +00:00
|
|
|
}
|
|
|
|
else if (NetworkClipped(SnappingClient, m_Pos))
|
2014-05-08 13:42:20 +00:00
|
|
|
continue;
|
2014-05-07 22:53:21 +00:00
|
|
|
|
|
|
|
CCharacter * Char = GameServer()->GetPlayerChar(SnappingClient);
|
|
|
|
|
2014-09-26 01:20:47 +00:00
|
|
|
if(SnappingClient > -1 && (GameServer()->m_apPlayers[SnappingClient]->GetTeam() == -1
|
2014-05-07 22:53:21 +00:00
|
|
|
|| GameServer()->m_apPlayers[SnappingClient]->m_Paused)
|
|
|
|
&& GameServer()->m_apPlayers[SnappingClient]->m_SpectatorID != SPEC_FREEVIEW)
|
|
|
|
Char = GameServer()->GetPlayerChar(GameServer()->m_apPlayers[SnappingClient]->m_SpectatorID);
|
|
|
|
|
|
|
|
int Tick = (Server()->Tick() % Server()->TickSpeed()) % 11;
|
|
|
|
if (Char && Char->IsAlive()
|
|
|
|
&& (m_Layer == LAYER_SWITCH
|
|
|
|
&& !GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[Char->Team()]
|
|
|
|
&& (!Tick)))
|
2014-05-08 13:42:20 +00:00
|
|
|
continue;
|
2014-05-07 22:53:21 +00:00
|
|
|
if (Char && Char->IsAlive())
|
|
|
|
{
|
|
|
|
if (Char->Team() != m_CatchedTeam)
|
2014-05-08 13:42:20 +00:00
|
|
|
continue;
|
2014-05-07 22:53:21 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// send to spectators only active draggers and some inactive from team 0
|
|
|
|
if (!((Target && Target->IsAlive()) || m_CatchedTeam == 0))
|
2014-05-08 13:42:20 +00:00
|
|
|
continue;
|
2014-05-07 22:53:21 +00:00
|
|
|
}
|
2010-09-08 16:22:11 +00:00
|
|
|
|
2014-10-26 01:14:12 +00:00
|
|
|
if (Char && Char->IsAlive() && Target && Target->IsAlive() && Target->GetPlayer()->GetCID() != Char->GetPlayer()->GetCID() && !Char->GetPlayer()->m_ShowOthers &&
|
2014-06-15 18:51:30 +00:00
|
|
|
(Char->Teams()->m_Core.GetSolo(SnappingClient) || Char->Teams()->m_Core.GetSolo(Target->GetPlayer()->GetCID())))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-05-07 22:53:21 +00:00
|
|
|
CNetObj_Laser *obj;
|
|
|
|
|
|
|
|
if (i == -1)
|
|
|
|
{
|
|
|
|
obj = static_cast<CNetObj_Laser *>(Server()->SnapNewItem(
|
|
|
|
NETOBJTYPE_LASER, m_ID, sizeof(CNetObj_Laser)));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_SoloIDs[pos] = Server()->SnapNewID();
|
|
|
|
obj = static_cast<CNetObj_Laser *>(Server()->SnapNewItem( // TODO: Have to free IDs again?
|
|
|
|
NETOBJTYPE_LASER, m_SoloIDs[pos], sizeof(CNetObj_Laser)));
|
|
|
|
pos++;
|
|
|
|
}
|
2010-07-29 05:21:18 +00:00
|
|
|
|
2014-05-07 22:53:21 +00:00
|
|
|
if (!obj)
|
2014-05-08 13:42:20 +00:00
|
|
|
continue;
|
2014-05-07 22:53:21 +00:00
|
|
|
obj->m_X = (int) m_Pos.x;
|
|
|
|
obj->m_Y = (int) m_Pos.y;
|
|
|
|
if (Target)
|
|
|
|
{
|
|
|
|
obj->m_FromX = (int) Target->m_Pos.x;
|
|
|
|
obj->m_FromY = (int) Target->m_Pos.y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
obj->m_FromX = (int) m_Pos.x;
|
|
|
|
obj->m_FromY = (int) m_Pos.y;
|
|
|
|
}
|
|
|
|
|
|
|
|
int StartTick = m_EvalTick;
|
|
|
|
if (StartTick < Server()->Tick() - 4)
|
|
|
|
StartTick = Server()->Tick() - 4;
|
|
|
|
else if (StartTick > Server()->Tick())
|
|
|
|
StartTick = Server()->Tick();
|
|
|
|
obj->m_StartTick = StartTick;
|
|
|
|
}
|
2010-07-29 05:21:18 +00:00
|
|
|
}
|
2010-09-22 10:43:59 +00:00
|
|
|
|
2011-12-25 13:51:04 +00:00
|
|
|
CDraggerTeam::CDraggerTeam(CGameWorld *pGameWorld, vec2 Pos, float Strength,
|
|
|
|
bool NW, int Layer, int Number)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < MAX_CLIENTS; ++i)
|
|
|
|
{
|
|
|
|
m_Draggers[i] = new CDragger(pGameWorld, Pos, Strength, NW, i, Layer,
|
|
|
|
Number);
|
2010-09-22 10:43:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-22 10:49:48 +00:00
|
|
|
//CDraggerTeam::~CDraggerTeam() {
|
2011-12-25 13:51:04 +00:00
|
|
|
//for(int i = 0; i < MAX_CLIENTS; ++i) {
|
|
|
|
// delete m_Draggers[i];
|
|
|
|
//}
|
2010-09-22 10:49:48 +00:00
|
|
|
//}
|