MCPcopy Create free account
hub / github.com/ddnet/ddnet / ExtractProjectileInfoDDNet

Function ExtractProjectileInfoDDNet

src/game/client/projectile_data.cpp:72–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72CProjectileData ExtractProjectileInfoDDNet(const CNetObj_DDNetProjectile *pProj)
73{
74 CProjectileData Result = {vec2(0, 0)};
75
76 Result.m_StartPos = vec2(pProj->m_X / 100.0f, pProj->m_Y / 100.0f);
77 Result.m_StartVel = pProj->m_Owner < 0 ? vec2(pProj->m_VelX, pProj->m_VelY) / 1e6f : vec2(pProj->m_VelX, pProj->m_VelY);
78
79 if(pProj->m_Flags & PROJECTILEFLAG_NORMALIZE_VEL)
80 {
81 Result.m_StartVel = normalize(Result.m_StartVel);
82 }
83
84 Result.m_Type = pProj->m_Type;
85 Result.m_StartTick = pProj->m_StartTick;
86
87 Result.m_ExtraInfo = true;
88 Result.m_Owner = pProj->m_Owner;
89 Result.m_SwitchNumber = pProj->m_SwitchNumber;
90 Result.m_TuneZone = pProj->m_TuneZone;
91
92 Result.m_Bouncing = 0;
93 if(pProj->m_Flags & PROJECTILEFLAG_BOUNCE_HORIZONTAL)
94 {
95 Result.m_Bouncing |= 1;
96 }
97 if(pProj->m_Flags & PROJECTILEFLAG_BOUNCE_VERTICAL)
98 {
99 Result.m_Bouncing |= 2;
100 }
101
102 Result.m_Explosive = pProj->m_Flags & PROJECTILEFLAG_EXPLOSIVE;
103 Result.m_Freeze = pProj->m_Flags & PROJECTILEFLAG_FREEZE;
104
105 return Result;
106}
107
108void DemoObjectRemoveExtraProjectileInfo(CNetObj_Projectile *pProj)
109{

Callers 1

ExtractProjectileInfoFunction · 0.85

Calls 1

normalizeFunction · 0.85

Tested by

no test coverage detected