Revert "Reworked laser rotation. Opens #59."

This reverts commit be122406ef.
This commit is contained in:
GreYFoXGTi 2010-10-07 15:28:29 +02:00
parent cf08ccb597
commit 5f0cf76e4f
3 changed files with 37 additions and 18 deletions

View file

@ -55,10 +55,8 @@ void CLight::Move()
m_CurveLength=0;
}
}
if(m_RotationSpeed < 0)
m_Rotation += (pi/360);
else if(m_RotationSpeed)
m_Rotation -= (pi/360);
m_Rotation+=m_AngularSpeed*m_Tick;
if (m_Rotation>pi*2)
m_Rotation-=pi*2;
else if(m_Rotation<0)
@ -81,7 +79,7 @@ void CLight::Reset()
void CLight::Tick()
{
if (Server()->Tick()%int(m_Tick)==0)
if (Server()->Tick()%int(Server()->TickSpeed()*0.15f)==0)
{
m_EvalTick=Server()->Tick();
int index = GameServer()->Collision()->IsCp(m_Pos.x,m_Pos.y);
@ -90,13 +88,9 @@ void CLight::Tick()
m_Core=GameServer()->Collision()->CpSpeed(index);
}
m_Pos+=m_Core;
if(!m_RotationSpeed) Step();
}
for (int i = 0; i < absolute(m_RotationSpeed); ++i)
{
Step();
HitCharacter();
}
HitCharacter();
return;
@ -116,10 +110,10 @@ void CLight::Snap(int snapping_client)
pObj->m_FromY = (int)m_To.y;
int StartTick = m_EvalTick;
if (StartTick<Server()->Tick()-4)
StartTick=Server()->Tick()-4;
else if (StartTick>Server()->Tick())
StartTick=Server()->Tick();
pObj->m_StartTick = StartTick;
int start_tick = m_EvalTick;
if (start_tick<Server()->Tick()-4)
start_tick=Server()->Tick()-4;
else if (start_tick>Server()->Tick())
start_tick=Server()->Tick();
pObj->m_StartTick = start_tick;
}

View file

@ -21,9 +21,10 @@ class CLight : public CEntity
public:
int m_CurveLength;
int m_LengthL;
float m_AngularSpeed;
int m_Speed;
int m_Length;
int m_RotationSpeed;
CLight(CGameWorld *pGameWorld, vec2 Pos, float Rotation, int Length);

View file

@ -241,12 +241,36 @@ 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 AngularSpeed;
int Ind=Index-ENTITY_LASER_STOP;
int M;
if (Ind<0)
{
Ind=-Ind;
M=1;
}
else if(Ind==0)
M=0;
else
M=-1;
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->m_RotationSpeed = Index - ENTITY_LASER_STOP;
Lgt->m_AngularSpeed=AngularSpeed;
if (sides2[i]>=ENTITY_LASER_C_SLOW && sides2[i]<=ENTITY_LASER_C_FAST)
{
Lgt->m_Speed=1+(sides2[i]-ENTITY_LASER_C_SLOW)*2;