Fixed doors and lasers not affect more than 1 player, but there is something wrong, i need sleep, this sometimes compiles and runs perfectly and some times it compiles but runs buggy, need to correct CLight::HitCharacter and CDoor::HitCharacter

also did some refactoring

Signed-off-by: GreYFoXGTi <GreYFoXGTi@GMaiL.CoM>
This commit is contained in:
GreYFoXGTi 2010-08-31 01:45:42 +02:00
parent 8901057944
commit 15542a6c20
15 changed files with 318 additions and 174 deletions

View file

@ -30,14 +30,42 @@ void CDoor::Close()
bool CDoor::HitCharacter()
{
vec2 Points[36];
vec2 At;
CCharacter *Hit = GameServer()->m_World.IntersectCharacter(m_Pos, m_To, 1.f, At, 0);
if(!Hit)
return false;
for(int i=1;i<=36;i++)
{
Points[i-1].x = m_Pos.x * (1 - i/38.0) + m_To.x * i / 38.0;
Points[i-1].y = m_Pos.y * (1 - i/38.0) + m_To.y * i / 38.0;
}
CCharacter *Hit = GameServer()->m_World.IntersectCharacter(m_Pos, Points[0], 1.f, At, 0);
if(Hit)
Hit->m_Doored = true;
Hit = 0;
Hit = GameServer()->m_World.IntersectCharacter(Points[0], m_Pos, 1.f, At, 0);
if(Hit)
Hit->m_Doored = true;
Hit = 0;
for(int i = 0; i < 36; i++)
{
Hit = GameServer()->m_World.IntersectCharacter(Points[i], Points[i+1], 1.f, At, 0);
if(Hit)
Hit->m_Doored = true;
Hit = 0;
Hit = GameServer()->m_World.IntersectCharacter(Points[i+1], Points[i], 1.f, At, 0);
if(Hit)
Hit->m_Doored = true;
Hit = 0;
}
Hit = GameServer()->m_World.IntersectCharacter(Points[35], m_To, 1.f, At, 0);
if(Hit)
Hit->m_Doored = true;
Hit = 0;
Hit = GameServer()->m_World.IntersectCharacter(m_To, Points[35], 1.f, At, 0);
if(Hit)
Hit->m_Doored = true;
Hit = 0;
//hit->reset_pos();
return true;
}
void CDoor::Reset()

View file

@ -11,72 +11,73 @@
const int LENGTH=700;
CDragger::CDragger(CGameWorld *pGameWorld, vec2 pos, float strength, bool nw)
CDragger::CDragger(CGameWorld *pGameWorld, vec2 Pos, float Strength, bool NW)
: CEntity(pGameWorld, NETOBJTYPE_LASER)
{
this->m_Pos = pos;
this->strength = strength;
this->eval_tick=Server()->Tick();
this->nw=nw;
m_Pos = Pos;
m_Strength = Strength;
m_EvalTick = Server()->Tick();
m_NW = NW;
GameWorld()->InsertEntity(this);
}
void CDragger::move()
void CDragger::Move()
{
if (target)
if (m_Target)
return;
CCharacter *ents[16];
int num = -1;
num = GameServer()->m_World.FindEntities(m_Pos,LENGTH, (CEntity**)ents, 16, NETOBJTYPE_CHARACTER);
int id=-1;
int minlen=0;
for (int i = 0; i < num; i++)
CCharacter *Ents[16];
int Num = -1;
Num = GameServer()->m_World.FindEntities(m_Pos,LENGTH, (CEntity**)Ents, 16, NETOBJTYPE_CHARACTER);
int Id=-1;
int MinLen=0;
for (int i = 0; i < Num; i++)
{
target = ents[i];
int res=0;
if (!nw)
res = GameServer()->Collision()->IntersectNoLaser(m_Pos, target->m_Pos, 0, 0);
m_Target = Ents[i];
int Res=0;
if (!m_NW)
Res = GameServer()->Collision()->IntersectNoLaser(m_Pos, m_Target->m_Pos, 0, 0);
else
res = GameServer()->Collision()->IntersectNoLaserNW(m_Pos, target->m_Pos, 0, 0);
Res = GameServer()->Collision()->IntersectNoLaserNW(m_Pos, m_Target->m_Pos, 0, 0);
if (res==0)
if (Res==0)
{
int len=length(ents[i]->m_Pos - m_Pos);
if (minlen==0 || minlen>len)
int Len=length(Ents[i]->m_Pos - m_Pos);
if (MinLen==0 || MinLen>Len)
{
minlen=len;
id=i;
MinLen=Len;
Id=i;
}
}
}
if (id!=-1)
if (Id!=-1)
{
target = ents[id];
m_Target = Ents[Id];
}
else
{
target=0;
m_Target=0;
}
}
void CDragger::drag()
void CDragger::Drag()
{
if (target)
if (m_Target)
{
int res = 0;
if (!nw)
res = GameServer()->Collision()->IntersectNoLaser(m_Pos, target->m_Pos, 0, 0);
int Res = 0;
if (!m_NW)
Res = GameServer()->Collision()->IntersectNoLaser(m_Pos, m_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)
Res = GameServer()->Collision()->IntersectNoLaserNW(m_Pos, m_Target->m_Pos, 0, 0);
if (Res || length(m_Pos-m_Target->m_Pos)>700)
{
target=0;
m_Target=0;
}
else
if (length(m_Pos-target->m_Pos)>28)
if(!((target->m_CurrentTile >= TILE_STOPL && target->m_CurrentTile <= TILE_STOPT) || (target->m_CurrentFTile >= TILE_STOPL && target->m_CurrentFTile <= TILE_STOPT)))
target->m_Core.m_Vel+=normalize(m_Pos-target->m_Pos)*strength;
if (length(m_Pos-m_Target->m_Pos)>28)
if(!((m_Target->m_CurrentTile >= TILE_STOPL && m_Target->m_CurrentTile <= TILE_STOPT) || (m_Target->m_CurrentFTile >= TILE_STOPL && m_Target->m_CurrentFTile <= TILE_STOPT)))
m_Target->m_Core.m_Vel+=normalize(m_Pos-m_Target->m_Pos)*m_Strength;
}
}
@ -89,40 +90,40 @@ void CDragger::Tick()
{
if (Server()->Tick()%int(Server()->TickSpeed()*0.15f)==0)
{
eval_tick=Server()->Tick();
int index = GameServer()->Collision()->IsCp(m_Pos.x, m_Pos.y);
if (index)
m_EvalTick=Server()->Tick();
int Index = GameServer()->Collision()->IsCp(m_Pos.x, m_Pos.y);
if (Index)
{
core=GameServer()->Collision()->CpSpeed(index);
m_Core=GameServer()->Collision()->CpSpeed(Index);
}
m_Pos+=core;
move();
m_Pos+=m_Core;
Move();
}
drag();
Drag();
return;
}
void CDragger::Snap(int snapping_client)
void CDragger::Snap(int SnappingClient)
{
if (target)
if (m_Target)
{
if(NetworkClipped(snapping_client, m_Pos) && NetworkClipped(snapping_client,target->m_Pos))
if(NetworkClipped(SnappingClient, m_Pos) && NetworkClipped(SnappingClient,m_Target->m_Pos))
return;
}
else
if(NetworkClipped(snapping_client,m_Pos))
if(NetworkClipped(SnappingClient,m_Pos))
return;
CNetObj_Laser *obj = static_cast<CNetObj_Laser *>(Server()->SnapNewItem(NETOBJTYPE_LASER, m_Id, sizeof(CNetObj_Laser)));
obj->m_X = (int)m_Pos.x;
obj->m_Y = (int)m_Pos.y;
if (target)
if (m_Target)
{
obj->m_FromX = (int)target->m_Pos.x;
obj->m_FromY = (int)target->m_Pos.y;
obj->m_FromX = (int)m_Target->m_Pos.x;
obj->m_FromY = (int)m_Target->m_Pos.y;
}
else
{
@ -131,12 +132,12 @@ void CDragger::Snap(int snapping_client)
}
int start_tick = eval_tick;
if (start_tick<Server()->Tick()-4)
start_tick=Server()->Tick()-4;
else if (start_tick>Server()->Tick())
start_tick=Server()->Tick();
obj->m_StartTick = start_tick;
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;
}
//ÿ òóò áûë
//ÿ òîæå

View file

@ -9,17 +9,17 @@ class CCharacter;
class CDragger : public CEntity
{
vec2 core;
float strength;
int eval_tick;
void move();
void drag();
CCharacter *target;
bool nw;
vec2 m_Core;
float m_Strength;
int m_EvalTick;
void Move();
void Drag();
CCharacter * m_Target;
bool m_NW;
public:
CDragger(CGameWorld *pGameWorld, vec2 pos, float strength, bool nw=false);
CDragger(CGameWorld *pGameWorld, vec2 Pos, float Strength, bool NW=false);
virtual void Reset();
virtual void Tick();

View file

@ -55,8 +55,7 @@ void CGun::Fire()
}
if (Id!=-1)
{
CCharacter *Target = Ents[Id];
vec2 Fdir = normalize(Target->m_Pos - m_Pos);
vec2 Fdir = normalize(Ents[Id]->m_Pos - m_Pos);
new CPlasma(&GameServer()->m_World, m_Pos, Fdir, m_Freeze, m_Explosive);
}

View file

@ -4,7 +4,7 @@
#include <engine/shared/config.h>
#include "laser.h"
CLaser::CLaser(CGameWorld *pGameWorld, vec2 Pos, vec2 Direction, float StartEnergy, int Owner, int type)
CLaser::CLaser(CGameWorld *pGameWorld, vec2 Pos, vec2 Direction, float StartEnergy, int Owner, int Type)
: CEntity(pGameWorld, NETOBJTYPE_LASER)
{
m_Pos = Pos;
@ -13,7 +13,7 @@ CLaser::CLaser(CGameWorld *pGameWorld, vec2 Pos, vec2 Direction, float StartEner
m_Dir = Direction;
m_Bounces = 0;
m_EvalTick = 0;
m_Type = type;
m_Type = Type;
GameWorld()->InsertEntity(this);
DoBounce();
}

View file

@ -6,7 +6,7 @@
class CLaser : public CEntity
{
public:
CLaser(CGameWorld *pGameWorld, vec2 Pos, vec2 Direction, float StartEnergy, int Owner, int type);
CLaser(CGameWorld *pGameWorld, vec2 Pos, vec2 Direction, float StartEnergy, int Owner, int Type);
virtual void Reset();
virtual void Tick();

View file

@ -12,63 +12,93 @@
CLight::CLight(CGameWorld *pGameWorld, vec2 pos, float rotation, int length)
CLight::CLight(CGameWorld *pGameWorld, vec2 Pos, float Rotation, int Length)
: CEntity(pGameWorld, NETOBJTYPE_LASER)
{
TICK=(Server()->TickSpeed()*0.15f);
this->m_Pos = pos;
this->rotation = rotation;
this->length = length;
this->eval_tick=Server()->Tick();
m_Tick=(Server()->TickSpeed()*0.15f);
m_Pos = Pos;
m_Rotation = Rotation;
m_Length = Length;
m_EvalTick = Server()->Tick();
GameWorld()->InsertEntity(this);
step();
Step();
}
bool CLight::hit_character()
bool CLight::HitCharacter()
{
vec2 nothing;
CCharacter *hit = GameServer()->m_World.IntersectCharacter(m_Pos, to, 0.0f, nothing, 0);
if(!hit)
return false;
hit->Freeze(Server()->TickSpeed()*3);
vec2 At;
vec2 Points[36];
for(int i=1;i<37;i++)
{
Points[i-1].x = m_Pos.x * (1 - i/38.0) + m_To.x * i / 38.0;
Points[i-1].y = m_Pos.y * (1 - i/38.0) + m_To.y * i / 38.0;
}
CCharacter *Hit = GameServer()->m_World.IntersectCharacter(m_Pos, Points[0], 1.f, At, 0);
if(Hit)
Hit->Freeze(Server()->TickSpeed()*3);
Hit = 0;
Hit = GameServer()->m_World.IntersectCharacter(Points[0], m_Pos, 1.f, At, 0);
if(Hit)
Hit->Freeze(Server()->TickSpeed()*3);
Hit = 0;
for(int i = 0; i < 36; i++)
{
Hit = GameServer()->m_World.IntersectCharacter(Points[i], Points[i+1], 1.f, At, 0);
if(Hit)
Hit->Freeze(Server()->TickSpeed()*3);
Hit = 0;
Hit = GameServer()->m_World.IntersectCharacter(Points[i+1], Points[i], 1.f, At, 0);
if(Hit)
Hit->Freeze(Server()->TickSpeed()*3);
Hit = 0;
}
Hit = GameServer()->m_World.IntersectCharacter(Points[35], m_To, 1.f, At, 0);
if(Hit)
Hit->Freeze(Server()->TickSpeed()*3);
Hit = 0;
Hit = GameServer()->m_World.IntersectCharacter(m_To, Points[35], 1.f, At, 0);
if(Hit)
Hit->Freeze(Server()->TickSpeed()*3);
Hit = 0;
return true;
}
void CLight::move()
void CLight::Move()
{
if (speed != 0)
if (m_Speed != 0)
{
if ((cur_length>=length && speed>0) || (cur_length<=0 && speed<0))
speed=-speed;
cur_length+=speed*TICK + length_l;
length_l=0;
if (cur_length>length)
if ((m_CurveLength>=m_Length && m_Speed>0) || (m_CurveLength<=0 && m_Speed<0))
m_Speed=-m_Speed;
m_CurveLength+=m_Speed*m_Tick + m_LengthL;
m_LengthL=0;
if (m_CurveLength>m_Length)
{
length_l=cur_length-length;
cur_length=length;
m_LengthL=m_CurveLength-m_Length;
m_CurveLength=m_Length;
}
else if(cur_length<0)
else if(m_CurveLength<0)
{
length_l=0+cur_length;
cur_length=0;
m_LengthL=0+m_CurveLength;
m_CurveLength=0;
}
}
rotation+=ang_speed*TICK;
if (rotation>pi*2)
rotation-=pi*2;
else if(rotation<0)
rotation+=pi*2;
m_Rotation+=m_AngularSpeed*m_Tick;
if (m_Rotation>pi*2)
m_Rotation-=pi*2;
else if(m_Rotation<0)
m_Rotation+=pi*2;
}
void CLight::step()
void CLight::Step()
{
move();
vec2 dir(sin(rotation), cos(rotation));
vec2 to2 = m_Pos + normalize(dir)*cur_length;
GameServer()->Collision()->IntersectNoLaser(m_Pos, to2, &to,0 );
Move();
vec2 dir(sin(m_Rotation), cos(m_Rotation));
vec2 to2 = m_Pos + normalize(dir)*m_CurveLength;
GameServer()->Collision()->IntersectNoLaser(m_Pos, to2, &m_To,0 );
}
void CLight::Reset()
@ -81,17 +111,17 @@ void CLight::Tick()
if (Server()->Tick()%int(Server()->TickSpeed()*0.15f)==0)
{
eval_tick=Server()->Tick();
m_EvalTick=Server()->Tick();
int index = GameServer()->Collision()->IsCp(m_Pos.x,m_Pos.y);
if (index)
{
core=GameServer()->Collision()->CpSpeed(index);
m_Core=GameServer()->Collision()->CpSpeed(index);
}
m_Pos+=core;
step();
m_Pos+=m_Core;
Step();
}
hit_character();
HitCharacter();
return;
@ -99,18 +129,18 @@ void CLight::Tick()
void CLight::Snap(int snapping_client)
{
if(NetworkClipped(snapping_client,m_Pos) && NetworkClipped(snapping_client,to))
if(NetworkClipped(snapping_client,m_Pos) && NetworkClipped(snapping_client,m_To))
return;
CNetObj_Laser *pObj = static_cast<CNetObj_Laser *>(Server()->SnapNewItem(NETOBJTYPE_LASER, m_Id, sizeof(CNetObj_Laser)));
pObj->m_X = (int)m_Pos.x;
pObj->m_Y = (int)m_Pos.y;
pObj->m_FromX = (int)to.x;
pObj->m_FromY = (int)to.y;
pObj->m_FromX = (int)m_To.x;
pObj->m_FromY = (int)m_To.y;
int start_tick = eval_tick;
int start_tick = m_EvalTick;
if (start_tick<Server()->Tick()-4)
start_tick=Server()->Tick()-4;
else if (start_tick>Server()->Tick())

View file

@ -7,26 +7,26 @@
class CLight : public CEntity
{
float rotation;
vec2 to;
vec2 core;
float m_Rotation;
vec2 m_To;
vec2 m_Core;
int eval_tick;
int m_EvalTick;
int TICK;
int m_Tick;
bool hit_character();
void move();
void step();
bool HitCharacter();
void Move();
void Step();
public:
int cur_length;
int length_l;
float ang_speed;
int speed;
int length;
int m_CurveLength;
int m_LengthL;
float m_AngularSpeed;
int m_Speed;
int m_Length;
CLight(CGameWorld *pGameWorld, vec2 pos, float rotation, int length);
CLight(CGameWorld *pGameWorld, vec2 Pos, float Rotation, int Length);
virtual void Reset();
virtual void Tick();

View file

@ -56,6 +56,7 @@ void CPickup::Tick()
}*/
// Check if a player intersected us
CCharacter *pChr = GameServer()->m_World.ClosestCharacter(m_Pos, 20.0f, 0);
CCharacter *pChr2=pChr;
if(pChr && pChr->IsAlive())
{
bool sound = false;
@ -134,6 +135,77 @@ void CPickup::Tick()
m_SpawnTick = Server()->Tick() + Server()->TickSpeed() * RespawnTime;
}*/
}
pChr=0;
pChr = GameServer()->m_World.ClosestCharacter(m_Pos, 20.0f, pChr2);
if(pChr && pChr->IsAlive())
{
bool sound = false;
// player picked us up, is someone was hooking us, let them go
int RespawnTime = -1;
switch (m_Type)
{
case POWERUP_HEALTH:
if(pChr->Freeze()) GameServer()->CreateSound(m_Pos, SOUND_PICKUP_HEALTH);
break;
case POWERUP_ARMOR:
for(int i=WEAPON_SHOTGUN;i<NUM_WEAPONS;i++)
{
if (pChr->m_aWeapons[i].m_Got)
{
if(!(pChr->m_FreezeTime && i == WEAPON_NINJA))
{
pChr->m_aWeapons[i].m_Got = false;
pChr->m_aWeapons[i].m_Ammo = 0;
sound = true;
}
}
}
pChr->m_Ninja.m_ActivationDir=vec2(0,0);
pChr->m_Ninja.m_ActivationTick=-500;
pChr->m_Ninja.m_CurrentMoveTime=0;
if (sound)
{
pChr->m_LastWeapon = WEAPON_GUN;
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_ARMOR);
}
if(!pChr->m_FreezeTime) pChr->m_ActiveWeapon = WEAPON_HAMMER;
break;
case POWERUP_WEAPON:
if(m_Subtype >= 0 && m_Subtype < NUM_WEAPONS && (!pChr->m_aWeapons[m_Subtype].m_Got || (pChr->m_aWeapons[m_Subtype].m_Ammo != -1 && !pChr->m_FreezeTime)))
{
if(pChr->GiveWeapon(m_Subtype, -1))
{
//RespawnTime = g_pData->m_aPickups[m_Type].m_Respawntime;
if(m_Subtype == WEAPON_GRENADE)
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_GRENADE);
else if(m_Subtype == WEAPON_SHOTGUN)
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_SHOTGUN);
else if(m_Subtype == WEAPON_RIFLE)
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_SHOTGUN);
if(pChr->GetPlayer())
GameServer()->SendWeaponPickup(pChr->GetPlayer()->GetCID(), m_Subtype);
}
}
break;
case POWERUP_NINJA:
{
// activate ninja on target player
if(!pChr->m_FreezeTime) pChr->GiveNinja();
//RespawnTime = g_pData->m_aPickups[m_Type].m_Respawntime;
break;
}
default:
break;
};
}
}
void CPickup::Snap(int SnappingClient)

View file

@ -70,9 +70,9 @@ void CPlasma::Tick()
}
void CPlasma::Snap(int snapping_client)
void CPlasma::Snap(int SnappingClient)
{
if(NetworkClipped(snapping_client))
if(NetworkClipped(SnappingClient))
return;
CNetObj_Laser *pObj = static_cast<CNetObj_Laser *>(Server()->SnapNewItem(NETOBJTYPE_LASER, m_Id, sizeof(CNetObj_Laser)));

View file

@ -21,7 +21,7 @@ public:
virtual void Reset();
virtual void Tick();
virtual void Snap(int snapping_client);
virtual void Snap(int SnappingClient);
};

View file

@ -3,7 +3,8 @@
#include <engine/shared/config.h>
#include "projectile.h"
CProjectile::CProjectile(
CProjectile::CProjectile
(
CGameWorld *pGameWorld,
int Type,
int Owner,
@ -14,7 +15,8 @@ CProjectile::CProjectile(
bool Explosive,
float Force,
int SoundImpact,
int Weapon)
int Weapon
)
: CEntity(pGameWorld, NETOBJTYPE_PROJECTILE)
{
m_Type = Type;
@ -79,6 +81,12 @@ void CProjectile::SetBouncing(int Value)
void CProjectile::Tick()
{
if(g_Config.m_SvShotgunReset > m_LastRestart && m_Owner == -1)
{
m_Pos = m_StartPos;
m_Direction = m_StartDir;
m_StartTick = Server()->Tick();
}
float Pt = (Server()->Tick()-m_StartTick-1)/(float)Server()->TickSpeed();
float Ct = (Server()->Tick()-m_StartTick)/(float)Server()->TickSpeed();
vec2 PrevPos = GetPos(Pt);
@ -112,12 +120,6 @@ void CProjectile::Tick()
{
m_StartTick = Server()->Tick();
m_Pos = NewPos;
if(g_Config.m_SvShotgunReset > m_LastRestart)
{
m_Pos = m_StartPos;
m_Direction = m_StartDir;
m_StartTick = Server()->Tick();
}
if (m_Bouncing == 1)
{
m_PrevLastBounce.x = m_LastBounce.x;

View file

@ -4,8 +4,20 @@
class CProjectile : public CEntity
{
public:
CProjectile(CGameWorld *pGameWorld, int Type, int Owner, vec2 Pos, vec2 Dir, int Span,
bool Freeeze, bool Explosive, float Force, int SoundImpact, int Weapon);
CProjectile
(
CGameWorld *pGameWorld,
int Type,
int Owner,
vec2 Pos,
vec2 Dir,
int Span,
bool Freeeze,
bool Explosive,
float Force,
int SoundImpact,
int Weapon
);
vec2 GetPos(float Time);
void FillInfo(CNetObj_Projectile *pProj);

View file

@ -25,8 +25,8 @@ bool CTrigger::HitCharacter()
void CTrigger::OpenDoor(int Tick)
{
CDoor *connectedDoor = (CDoor*) m_Target;
connectedDoor->Open(Tick);
CDoor *ConnectedDoor = (CDoor*) m_Target;
ConnectedDoor->Open(Tick);
}
void CTrigger::Reset()

View file

@ -237,48 +237,48 @@ bool IGameController::OnEntity(int Index, vec2 Pos, bool Front)
sides2[6]=GameServer()->Collision()->Entity(x-2,y, Front);
sides2[7]=GameServer()->Collision()->Entity(x-2,y+2, Front);
float ang_speed;
int ind=Index-ENTITY_LASER_STOP;
int m;
if (ind<0)
float AngularSpeed;
int Ind=Index-ENTITY_LASER_STOP;
int M;
if (Ind<0)
{
ind=-ind;
m=1;
Ind=-Ind;
M=1;
}
else if(ind==0)
m=0;
else if(Ind==0)
M=0;
else
m=-1;
M=-1;
if (ind==0)
ang_speed=0.0f;
else if (ind==1)
ang_speed=pi/360;
else if (ind==2)
ang_speed=pi/180;
else if (ind==3)
ang_speed=pi/90;
ang_speed*=m;
if (Ind==0)
AngularSpeed=0.0f;
else if (Ind==1)
AngularSpeed=pi/360;
else if (Ind==2)
AngularSpeed=pi/180;
else if (Ind==3)
AngularSpeed=pi/90;
AngularSpeed*=M;
for(int i=0; i<8;i++)
{
if (sides[i] >= ENTITY_LASER_SHORT && sides[i] <= ENTITY_LASER_LONG)
{
CLight *lgt = new CLight(&GameServer()->m_World, Pos, pi/4*i,32*3 + 32*(sides[i] - ENTITY_LASER_SHORT)*3);
lgt->ang_speed=ang_speed;
CLight *Lgt = new CLight(&GameServer()->m_World, Pos, pi/4*i,32*3 + 32*(sides[i] - ENTITY_LASER_SHORT)*3);
Lgt->m_AngularSpeed=AngularSpeed;
if (sides2[i]>=ENTITY_LASER_C_SLOW && sides2[i]<=ENTITY_LASER_C_FAST)
{
lgt->speed=1+(sides2[i]-ENTITY_LASER_C_SLOW)*2;
lgt->cur_length=lgt->length;
Lgt->m_Speed=1+(sides2[i]-ENTITY_LASER_C_SLOW)*2;
Lgt->m_CurveLength=Lgt->m_Length;
}
else if(sides2[i]>=ENTITY_LASER_O_SLOW && sides2[i]<=ENTITY_LASER_O_FAST)
{
lgt->speed=1+(sides2[i]-ENTITY_LASER_O_SLOW)*2;
lgt->cur_length=0;
Lgt->m_Speed=1+(sides2[i]-ENTITY_LASER_O_SLOW)*2;
Lgt->m_CurveLength=0;
}
else
lgt->cur_length=lgt->length;
Lgt->m_CurveLength=Lgt->m_Length;
}
}