removed the extra projectile. #1381

Conflicts:
	src/game/client/gameclient.cpp
	src/game/server/entities/character.cpp
This commit is contained in:
oy 2015-08-25 17:07:11 +02:00
parent 7f78915171
commit 329e6261f3
4 changed files with 1 additions and 87 deletions

View file

@ -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++;
}
}

View file

@ -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

View file

@ -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

View file

@ -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;