Add crazy shotguns. Need to test

This commit is contained in:
btd 2010-08-14 14:46:54 +04:00
parent 619f7cb268
commit 512597f729
3 changed files with 50 additions and 1 deletions

View file

@ -55,6 +55,9 @@ vec2 CProjectile::GetPos(float Time)
return CalcPos(m_Pos, m_Direction, Curvature, Speed, Time); return CalcPos(m_Pos, m_Direction, Curvature, Speed, Time);
} }
void CProjectile::SetBouncing(int Value) {
m_Bouncing = Value;
}
void CProjectile::Tick() void CProjectile::Tick()
{ {
@ -73,7 +76,7 @@ void CProjectile::Tick()
if(m_Owner >= 0) if(m_Owner >= 0)
OwnerChar = GameServer()->GetPlayerChar(m_Owner); OwnerChar = GameServer()->GetPlayerChar(m_Owner);
CCharacter *TargetChr = GameServer()->m_World.IntersectCharacter(PrevPos, ColPos, (m_Freeze) ? 1.0f : 6.0f, ColPos, OwnerChar);//TODO êàæåòñÿ òóò áàã ñ äâèæåíèåì âî ôðèçå CCharacter *TargetChr = GameServer()->m_World.IntersectCharacter(PrevPos, ColPos, (m_Freeze) ? 1.0f : 6.0f, ColPos, OwnerChar);
if(m_LifeSpan > -1) if(m_LifeSpan > -1)
m_LifeSpan--; m_LifeSpan--;

View file

@ -9,6 +9,7 @@ public:
vec2 GetPos(float Time); vec2 GetPos(float Time);
void FillInfo(CNetObj_Projectile *pProj); void FillInfo(CNetObj_Projectile *pProj);
void SetBouncing(int Value);
virtual void Reset(); virtual void Reset();
virtual void Tick(); virtual void Tick();

View file

@ -156,6 +156,51 @@ bool IGameController::OnEntity(int Index, vec2 Pos)
} }
} }
} }
else if(Index >= ENTITY_CRAZY_SHOTGUN_U_EX && Index <= ENTITY_CRAZY_SHOTGUN_L_EX)
{
for (int i = 0; i < 4; i++)
{
if (Index - ENTITY_CRAZY_SHOTGUN_U_EX == i)
{
float Deg = i*(pi/2);
CProjectile *bullet = new CProjectile(&GameServer()->m_World,
WEAPON_SHOTGUN, //Type
-1, //Owner
Pos, //Pos
vec2(sin(Deg),cos(Deg)), //Dir
-2, //Span
true, //Freeze
true, //Explosive
0,
SOUND_GRENADE_EXPLODE,
WEAPON_SHOTGUN);
bullet->SetBouncing(2 - (i % 2));
}
}
}
else if(Index >= ENTITY_CRAZY_SHOTGUN_U && Index <= ENTITY_CRAZY_SHOTGUN_L)
{
for (int i = 0; i < 4; i++)
{
if (Index - ENTITY_CRAZY_SHOTGUN_U == i)
{
float Deg = i*(pi/2);
CProjectile *bullet = new CProjectile(&GameServer()->m_World,
WEAPON_SHOTGUN, //Type
-1, //Owner
Pos, //Pos
vec2(sin(Deg),cos(Deg)), //Dir
-2, //Span
true, //Freeze
false, //Explosive
0,
SOUND_GRENADE_EXPLODE,
WEAPON_SHOTGUN);
bullet->SetBouncing(2 - (i % 2));
}
}
}
if(Index == ENTITY_ARMOR_1) if(Index == ENTITY_ARMOR_1)
Type = POWERUP_ARMOR; Type = POWERUP_ARMOR;