From 512597f7296bf07e484c45bd1f640f48264e431c Mon Sep 17 00:00:00 2001 From: btd Date: Sat, 14 Aug 2010 14:46:54 +0400 Subject: [PATCH] Add crazy shotguns. Need to test --- src/game/server/entities/projectile.cpp | 5 ++- src/game/server/entities/projectile.h | 1 + src/game/server/gamecontroller.cpp | 45 +++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/src/game/server/entities/projectile.cpp b/src/game/server/entities/projectile.cpp index 342534f56..5e9b54990 100644 --- a/src/game/server/entities/projectile.cpp +++ b/src/game/server/entities/projectile.cpp @@ -55,6 +55,9 @@ vec2 CProjectile::GetPos(float Time) return CalcPos(m_Pos, m_Direction, Curvature, Speed, Time); } +void CProjectile::SetBouncing(int Value) { + m_Bouncing = Value; +} void CProjectile::Tick() { @@ -73,7 +76,7 @@ void CProjectile::Tick() if(m_Owner >= 0) 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) m_LifeSpan--; diff --git a/src/game/server/entities/projectile.h b/src/game/server/entities/projectile.h index d3ecc541e..149122467 100644 --- a/src/game/server/entities/projectile.h +++ b/src/game/server/entities/projectile.h @@ -9,6 +9,7 @@ public: vec2 GetPos(float Time); void FillInfo(CNetObj_Projectile *pProj); + void SetBouncing(int Value); virtual void Reset(); virtual void Tick(); diff --git a/src/game/server/gamecontroller.cpp b/src/game/server/gamecontroller.cpp index 6d8120d2c..19110c7a0 100644 --- a/src/game/server/gamecontroller.cpp +++ b/src/game/server/gamecontroller.cpp @@ -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) Type = POWERUP_ARMOR;