mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
removed the extra projectile. #1381
Conflicts: src/game/client/gameclient.cpp src/game/server/entities/character.cpp
This commit is contained in:
parent
7f78915171
commit
329e6261f3
|
@ -14,10 +14,6 @@
|
|||
|
||||
#include "items.h"
|
||||
|
||||
void CItems::OnReset()
|
||||
{
|
||||
m_NumExtraProjectiles = 0;
|
||||
}
|
||||
|
||||
void CItems::RenderProjectile(const CNetObj_Projectile *pCurrent, int ItemID)
|
||||
{
|
||||
|
@ -309,25 +305,5 @@ void CItems::OnRender()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// render extra projectiles
|
||||
for(int i = 0; i < m_NumExtraProjectiles; i++)
|
||||
{
|
||||
if(m_aExtraProjectiles[i].m_StartTick < Client()->GameTick())
|
||||
{
|
||||
m_aExtraProjectiles[i] = m_aExtraProjectiles[m_NumExtraProjectiles-1];
|
||||
m_NumExtraProjectiles--;
|
||||
}
|
||||
else
|
||||
RenderProjectile(&m_aExtraProjectiles[i], 0);
|
||||
}
|
||||
}
|
||||
|
||||
void CItems::AddExtraProjectile(CNetObj_Projectile *pProj)
|
||||
{
|
||||
if(m_NumExtraProjectiles != MAX_EXTRA_PROJECTILES)
|
||||
{
|
||||
m_aExtraProjectiles[m_NumExtraProjectiles] = *pProj;
|
||||
m_NumExtraProjectiles++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,24 +6,13 @@
|
|||
|
||||
class CItems : public CComponent
|
||||
{
|
||||
enum
|
||||
{
|
||||
MAX_EXTRA_PROJECTILES=32,
|
||||
};
|
||||
|
||||
CNetObj_Projectile m_aExtraProjectiles[MAX_EXTRA_PROJECTILES];
|
||||
int m_NumExtraProjectiles;
|
||||
|
||||
void RenderProjectile(const CNetObj_Projectile *pCurrent, int ItemID);
|
||||
void RenderPickup(const CNetObj_Pickup *pPrev, const CNetObj_Pickup *pCurrent);
|
||||
void RenderFlag(const CNetObj_Flag *pPrev, const CNetObj_Flag *pCurrent, const CNetObj_GameDataFlag *pPrevGameDataFlag, const CNetObj_GameDataFlag *pCurGameDataFlag);
|
||||
void RenderLaser(const struct CNetObj_Laser *pCurrent);
|
||||
|
||||
public:
|
||||
virtual void OnReset();
|
||||
virtual void OnRender();
|
||||
|
||||
void AddExtraProjectile(CNetObj_Projectile *pProj);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -481,25 +481,7 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker)
|
|||
Client()->RecordGameMessage(true);
|
||||
|
||||
// special messages
|
||||
if(MsgId == NETMSGTYPE_SV_EXTRAPROJECTILE)
|
||||
{
|
||||
int Num = pUnpacker->GetInt();
|
||||
|
||||
for(int k = 0; k < Num; k++)
|
||||
{
|
||||
CNetObj_Projectile Proj;
|
||||
for(unsigned i = 0; i < sizeof(CNetObj_Projectile)/sizeof(int); i++)
|
||||
((int *)&Proj)[i] = pUnpacker->GetInt();
|
||||
|
||||
if(pUnpacker->Error())
|
||||
return;
|
||||
|
||||
m_pItems->AddExtraProjectile(&Proj);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else if(MsgId == NETMSGTYPE_SV_TUNEPARAMS && Client()->State() != IClient::STATE_DEMOPLAYBACK)
|
||||
if(MsgId == NETMSGTYPE_SV_TUNEPARAMS && Client()->State() != IClient::STATE_DEMOPLAYBACK)
|
||||
{
|
||||
Client()->RecordGameMessage(false);
|
||||
// unpack the new tuning
|
||||
|
|
|
@ -341,17 +341,6 @@ void CCharacter::FireWeapon()
|
|||
(int)(Server()->TickSpeed()*GameServer()->Tuning()->m_GunLifetime),
|
||||
g_pData->m_Weapons.m_Gun.m_pBase->m_Damage, false, 0, -1, WEAPON_GUN);
|
||||
|
||||
// pack the Projectile and send it to the client Directly
|
||||
CNetObj_Projectile p;
|
||||
pProj->FillInfo(&p);
|
||||
|
||||
CMsgPacker Msg(NETMSGTYPE_SV_EXTRAPROJECTILE);
|
||||
Msg.AddInt(1);
|
||||
for(unsigned i = 0; i < sizeof(CNetObj_Projectile)/sizeof(int); i++)
|
||||
Msg.AddInt(((int *)&p)[i]);
|
||||
|
||||
Server()->SendMsg(&Msg, MSGFLAG_VITAL, m_pPlayer->GetCID());
|
||||
|
||||
GameServer()->CreateSound(m_Pos, SOUND_GUN_FIRE);
|
||||
} break;
|
||||
|
||||
|
@ -359,9 +348,6 @@ void CCharacter::FireWeapon()
|
|||
{
|
||||
int ShotSpread = 2;
|
||||
|
||||
CMsgPacker Msg(NETMSGTYPE_SV_EXTRAPROJECTILE);
|
||||
Msg.AddInt(ShotSpread*2+1);
|
||||
|
||||
for(int i = -ShotSpread; i <= ShotSpread; ++i)
|
||||
{
|
||||
float Spreading[] = {-0.185f, -0.070f, 0, 0.070f, 0.185f};
|
||||
|
@ -375,17 +361,8 @@ void CCharacter::FireWeapon()
|
|||
vec2(cosf(a), sinf(a))*Speed,
|
||||
(int)(Server()->TickSpeed()*GameServer()->Tuning()->m_ShotgunLifetime),
|
||||
g_pData->m_Weapons.m_Shotgun.m_pBase->m_Damage, false, 0, -1, WEAPON_SHOTGUN);
|
||||
|
||||
// pack the Projectile and send it to the client Directly
|
||||
CNetObj_Projectile p;
|
||||
pProj->FillInfo(&p);
|
||||
|
||||
for(unsigned i = 0; i < sizeof(CNetObj_Projectile)/sizeof(int); i++)
|
||||
Msg.AddInt(((int *)&p)[i]);
|
||||
}
|
||||
|
||||
Server()->SendMsg(&Msg, MSGFLAG_VITAL, m_pPlayer->GetCID());
|
||||
|
||||
GameServer()->CreateSound(m_Pos, SOUND_SHOTGUN_FIRE);
|
||||
} break;
|
||||
|
||||
|
@ -398,16 +375,6 @@ void CCharacter::FireWeapon()
|
|||
(int)(Server()->TickSpeed()*GameServer()->Tuning()->m_GrenadeLifetime),
|
||||
g_pData->m_Weapons.m_Grenade.m_pBase->m_Damage, true, 0, SOUND_GRENADE_EXPLODE, WEAPON_GRENADE);
|
||||
|
||||
// pack the Projectile and send it to the client Directly
|
||||
CNetObj_Projectile p;
|
||||
pProj->FillInfo(&p);
|
||||
|
||||
CMsgPacker Msg(NETMSGTYPE_SV_EXTRAPROJECTILE);
|
||||
Msg.AddInt(1);
|
||||
for(unsigned i = 0; i < sizeof(CNetObj_Projectile)/sizeof(int); i++)
|
||||
Msg.AddInt(((int *)&p)[i]);
|
||||
Server()->SendMsg(&Msg, MSGFLAG_VITAL, m_pPlayer->GetCID());
|
||||
|
||||
GameServer()->CreateSound(m_Pos, SOUND_GRENADE_FIRE);
|
||||
} break;
|
||||
|
||||
|
|
Loading…
Reference in a new issue