void CLaser::Snap(int SnappingClient) { if(NetworkClipped(SnappingClient)) return; CCharacter * OwnerChar = 0; if(m_Owner >= 0) OwnerChar = GameServer()->GetPlayerChar(m_Owner); if(!OwnerChar) return; CCharacter *pOwnerChar = 0; int64_t TeamMask = -1LL; if(m_Owner >= 0) pOwnerChar = GameServer()->GetPlayerChar(m_Owner); if (pOwnerChar && pOwnerChar->IsAlive()) TeamMask = pOwnerChar->Teams()->TeamMask(pOwnerChar->Team(), -1, m_Owner); if(!CmaskIsSet(TeamMask, SnappingClient)) return; CNetObj_Laser *pObj = static_cast<CNetObj_Laser *>(Server()->SnapNewItem(NETOBJTYPE_LASER, m_ID, sizeof(CNetObj_Laser))); if(!pObj) return; pObj->m_X = (int)m_Pos.x; pObj->m_Y = (int)m_Pos.y; pObj->m_FromX = (int)m_From.x; pObj->m_FromY = (int)m_From.y; pObj->m_StartTick = m_EvalTick; }
void CEventHandler::Snap(int SnappingClient) { for(int i = 0; i < m_NumEvents; i++) { if(SnappingClient == -1 || CmaskIsSet(m_aClientMasks[i], SnappingClient)) { NETEVENT_COMMON *ev = (NETEVENT_COMMON *)&m_aData[m_aOffsets[i]]; if(SnappingClient == -1 || distance(GameServer()->m_apPlayers[SnappingClient]->m_ViewPos, vec2(ev->m_X, ev->m_Y)) < 1500.0f) { void *d = GameServer()->Server()->SnapNewItem(m_aTypes[i], i, m_aSizes[i]); mem_copy(d, &m_aData[m_aOffsets[i]], m_aSizes[i]); } } } }