diff --git a/src/game/extrainfo.cpp b/src/game/extrainfo.cpp index d47879b4c..edcf13056 100644 --- a/src/game/extrainfo.cpp +++ b/src/game/extrainfo.cpp @@ -8,65 +8,65 @@ bool UseExtraInfo(const CNetObj_Projectile *pProj) { - bool ExtraInfoFlag = ((abs(pProj->m_VelY) & (1<<9)) != 0); - return ExtraInfoFlag; + bool ExtraInfoFlag = ((abs(pProj->m_VelY) & (1<<9)) != 0); + return ExtraInfoFlag; } void ExtractInfo(const CNetObj_Projectile *pProj, vec2 *StartPos, vec2 *StartVel, bool IsDDNet) { - if(!UseExtraInfo(pProj) || !IsDDNet) - { - StartPos->x = pProj->m_X; - StartPos->y = pProj->m_Y; - StartVel->x = pProj->m_VelX/100.0f; - StartVel->y = pProj->m_VelY/100.0f; - } - else - { - StartPos->x = pProj->m_X/100.0f; - StartPos->y = pProj->m_Y/100.0f; - float Angle = pProj->m_VelX/1000000.0f; - StartVel->x = sin(-Angle); - StartVel->y = cos(-Angle); - } + if(!UseExtraInfo(pProj) || !IsDDNet) + { + StartPos->x = pProj->m_X; + StartPos->y = pProj->m_Y; + StartVel->x = pProj->m_VelX/100.0f; + StartVel->y = pProj->m_VelY/100.0f; + } + else + { + StartPos->x = pProj->m_X/100.0f; + StartPos->y = pProj->m_Y/100.0f; + float Angle = pProj->m_VelX/1000000.0f; + StartVel->x = sin(-Angle); + StartVel->y = cos(-Angle); + } } void ExtractExtraInfo(const CNetObj_Projectile *pProj, int *Owner, bool *Explosive, int *Bouncing, bool *Freeze) { - int Data = pProj->m_VelY; - if(Owner) - { - *Owner = Data & 255; - if((Data>>8) & 1) - *Owner = -(*Owner); - } - if(Bouncing) - *Bouncing = (Data>>10) & 3; - if(Explosive) - *Explosive = (Data>>12) & 1; - if(Freeze) - *Freeze = (Data>>13) & 1; + int Data = pProj->m_VelY; + if(Owner) + { + *Owner = Data & 255; + if((Data>>8) & 1) + *Owner = -(*Owner); + } + if(Bouncing) + *Bouncing = (Data>>10) & 3; + if(Explosive) + *Explosive = (Data>>12) & 1; + if(Freeze) + *Freeze = (Data>>13) & 1; } void SnapshotRemoveExtraInfo(unsigned char *pData) { - CSnapshot *pSnap = (CSnapshot*) pData; - for(int Index = 0; Index < pSnap->NumItems(); Index++) - { - CSnapshotItem *pItem = pSnap->GetItem(Index); - if(pItem->Type() == NETOBJTYPE_PROJECTILE) - { - CNetObj_Projectile *pProj = (CNetObj_Projectile*) ((void*)pItem->Data()); - if(UseExtraInfo(pProj)) - { - vec2 Pos; - vec2 Vel; - ExtractInfo(pProj, &Pos, &Vel, 1); - pProj->m_X = Pos.x; - pProj->m_Y = Pos.y; - pProj->m_VelX = (int)(Vel.x*100.0f); - pProj->m_VelY = (int)(Vel.y*100.0f); - } - } - } + CSnapshot *pSnap = (CSnapshot*) pData; + for(int Index = 0; Index < pSnap->NumItems(); Index++) + { + CSnapshotItem *pItem = pSnap->GetItem(Index); + if(pItem->Type() == NETOBJTYPE_PROJECTILE) + { + CNetObj_Projectile *pProj = (CNetObj_Projectile*) ((void*)pItem->Data()); + if(UseExtraInfo(pProj)) + { + vec2 Pos; + vec2 Vel; + ExtractInfo(pProj, &Pos, &Vel, 1); + pProj->m_X = Pos.x; + pProj->m_Y = Pos.y; + pProj->m_VelX = (int)(Vel.x*100.0f); + pProj->m_VelY = (int)(Vel.y*100.0f); + } + } + } }