This commit is contained in:
Learath2 2019-05-21 10:51:43 +02:00
parent 131a0e370d
commit c7d8ca129a
5 changed files with 8 additions and 15 deletions

View file

@ -1879,10 +1879,7 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket)
// for antiping: if the projectile netobjects from the server contains extra data, this is removed and the original content restored before recording demo
unsigned char aExtraInfoRemoved[CSnapshot::MAX_SIZE];
mem_copy(aExtraInfoRemoved, pTmpBuffer3, SnapSize);
CServerInfo Info;
GetServerInfo(&Info);
if(IsDDNet(&Info))
SnapshotRemoveExtraInfo(aExtraInfoRemoved);
SnapshotRemoveExtraInfo(aExtraInfoRemoved);
// add snapshot to demo
for(int i = 0; i < RECORDER_MAX; i++)

View file

@ -17,8 +17,6 @@
#include "items.h"
#include <stdio.h>
#include <engine/serverbrowser.h>
void CItems::OnReset()
{
m_NumExtraProjectiles = 0;
@ -65,9 +63,7 @@ void CItems::RenderProjectile(const CNetObj_Projectile *pCurrent, int ItemID)
vec2 StartPos;
vec2 StartVel;
CServerInfo Info;
Client()->GetServerInfo(&Info);
ExtractInfo(pCurrent, &StartPos, &StartVel, IsDDNet(&Info));
ExtractInfo(pCurrent, &StartPos, &StartVel);
vec2 Pos = CalcPos(StartPos, StartVel, Curvature, Speed, Ct);
vec2 PrevPos = CalcPos(StartPos, StartVel, Curvature, Speed, Ct-0.001f);
@ -476,7 +472,7 @@ void CItems::ReconstructSmokeTrail(const CNetObj_Projectile *pCurrent, int ItemI
vec2 StartPos;
vec2 StartVel;
ExtractInfo(pCurrent, &StartPos, &StartVel, true);
ExtractInfo(pCurrent, &StartPos, &StartVel);
float T = Pt;
if(DestroyTick >= 0)

View file

@ -158,7 +158,7 @@ void CProjectile::SetBouncing(int Value)
CProjectile::CProjectile(CGameWorld *pGameWorld, int ID, CNetObj_Projectile *pProj)
: CEntity(pGameWorld, CGameWorld::ENTTYPE_PROJECTILE)
{
ExtractInfo(pProj, &m_Pos, &m_Direction, true);
ExtractInfo(pProj, &m_Pos, &m_Direction);
if(UseExtraInfo(pProj))
ExtractExtraInfo(pProj, &m_Owner, &m_Explosive, &m_Bouncing, &m_Freeze);
else

View file

@ -12,9 +12,9 @@ bool UseExtraInfo(const CNetObj_Projectile *pProj)
return ExtraInfoFlag;
}
void ExtractInfo(const CNetObj_Projectile *pProj, vec2 *StartPos, vec2 *StartVel, bool IsDDNet)
void ExtractInfo(const CNetObj_Projectile *pProj, vec2 *StartPos, vec2 *StartVel)
{
if(!UseExtraInfo(pProj) || !IsDDNet)
if(!UseExtraInfo(pProj))
{
StartPos->x = pProj->m_X;
StartPos->y = pProj->m_Y;
@ -61,7 +61,7 @@ void SnapshotRemoveExtraInfo(unsigned char *pData)
{
vec2 Pos;
vec2 Vel;
ExtractInfo(pProj, &Pos, &Vel, true);
ExtractInfo(pProj, &Pos, &Vel);
pProj->m_X = Pos.x;
pProj->m_Y = Pos.y;
pProj->m_VelX = (int)(Vel.x*100.0f);

View file

@ -6,7 +6,7 @@
#include <base/vmath.h>
bool UseExtraInfo(const CNetObj_Projectile *pProj);
void ExtractInfo(const CNetObj_Projectile *pProj, vec2 *StartPos, vec2 *StartVel, bool IsDDNet);
void ExtractInfo(const CNetObj_Projectile *pProj, vec2 *StartPos, vec2 *StartVel);
void ExtractExtraInfo(const CNetObj_Projectile *pProj, int *Owner, bool *Explosive, int *Bouncing, bool *Freeze);
void SnapshotRemoveExtraInfo(unsigned char *pData);