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

Method TickDeferred

src/game/server/entities/character.cpp:846–955  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

844}
845
846void CCharacter::TickDeferred()
847{
848 // advance the dummy
849 {
850 CWorldCore TempWorld;
851 m_ReckoningCore.Init(&TempWorld, Collision(), &Teams()->m_Core);
852 m_ReckoningCore.m_Id = m_pPlayer->GetCid();
853 m_ReckoningCore.m_Tuning = CTuningParams();
854 m_ReckoningCore.Tick(false);
855 m_ReckoningCore.Move();
856 m_ReckoningCore.Quantize();
857 }
858
859 //lastsentcore
860 vec2 StartPos = m_Core.m_Pos;
861 vec2 StartVel = m_Core.m_Vel;
862 bool StuckBefore = Collision()->TestBox(m_Core.m_Pos, CCharacterCore::PhysicalSizeVec2());
863
864 m_Core.m_Id = m_pPlayer->GetCid();
865 m_Core.Move();
866 bool StuckAfterMove = Collision()->TestBox(m_Core.m_Pos, CCharacterCore::PhysicalSizeVec2());
867 m_Core.Quantize();
868 bool StuckAfterQuant = Collision()->TestBox(m_Core.m_Pos, CCharacterCore::PhysicalSizeVec2());
869 m_Pos = m_Core.m_Pos;
870
871 if(!StuckBefore && (StuckAfterMove || StuckAfterQuant))
872 {
873 // Hackish solution to get rid of strict-aliasing warning
874 union
875 {
876 float f;
877 unsigned u;
878 } StartPosX, StartPosY, StartVelX, StartVelY;
879
880 StartPosX.f = StartPos.x;
881 StartPosY.f = StartPos.y;
882 StartVelX.f = StartVel.x;
883 StartVelY.f = StartVel.y;
884
885 char aBuf[256];
886 str_format(aBuf, sizeof(aBuf), "STUCK!!! %d %d %d %f %f %f %f %x %x %x %x",
887 StuckBefore,
888 StuckAfterMove,
889 StuckAfterQuant,
890 StartPos.x, StartPos.y,
891 StartVel.x, StartVel.y,
892 StartPosX.u, StartPosY.u,
893 StartVelX.u, StartVelY.u);
894 GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "game", aBuf);
895 }
896
897 {
898 int Events = m_Core.m_TriggeredEvents;
899 int CID = m_pPlayer->GetCid();
900
901 // Some sounds are triggered client-side for the acting player (or for all players on Sixup)
902 // so we need to avoid duplicating them
903 CClientMask TeamMaskExceptSelfAndSixup = Teams()->TeamMask(Team(), CID, CID, CGameContext::FLAG_SIX);

Callers 1

TickMethod · 0.45

Calls 15

str_formatFunction · 0.85
mem_zeroFunction · 0.85
mem_compFunction · 0.85
QuantizeMethod · 0.80
TestBoxMethod · 0.80
CreateSoundMethod · 0.80
GetTeamMethod · 0.80
TickSpeedMethod · 0.80
CTuningParamsClass · 0.50
ServerClass · 0.50
InitMethod · 0.45
GetCidMethod · 0.45

Tested by

no test coverage detected