1663: Use freeze end tick instead of a flag. Fix #1659 r=def- a=Learath2

I used -1 for deep frozen, and 0 for not frozen. Not really sure if this is the best way.

Co-authored-by: Learath <learath2@gmail.com>
This commit is contained in:
bors[bot] 2019-04-27 08:53:38 +00:00
commit a5096c4de0
6 changed files with 11 additions and 20 deletions

View file

@ -6,8 +6,7 @@ GameFlags = ["TEAMS", "FLAGS"]
GameStateFlags = ["GAMEOVER", "SUDDENDEATH", "PAUSED", "RACETIME"]
CharacterFlags = ["SOLO", "JETPACK", "NO_COLLISION", "ENDLESS_HOOK", "ENDLESS_JUMP", "SUPER",
"NO_HAMMER_HIT", "NO_SHOTGUN_HIT", "NO_GRENADE_HIT", "NO_RIFLE_HIT", "NO_HOOK",
"TELEGUN_GUN", "TELEGUN_GRENADE", "TELEGUN_LASER",
"FROZEN", "DEEP_FROZEN", "SPECTATING"]
"TELEGUN_GUN", "TELEGUN_GRENADE", "TELEGUN_LASER"]
Emoticons = ["OOP", "EXCLAMATION", "HEARTS", "DROP", "DOTDOT", "MUSIC", "SORRY", "GHOST", "SUSHI", "SPLATTEE", "DEVILTEE", "ZOMG", "ZZZ", "WTF", "EYES", "QUESTION"]
@ -213,6 +212,7 @@ Objects = [
NetObjectEx("DDNetCharacter", "character@netobj.ddnet.tw", [
NetIntAny("m_Flags"),
NetTick("m_FreezeEnd"),
]),
## Events

View file

@ -1126,10 +1126,10 @@ void CGameClient::OnNewSnapshot()
pCharacterData->m_Flags & CHARACTERFLAG_ENDLESS_JUMP;
// Freeze
m_aClients[Item.m_ID].m_Frozen = m_aClients[Item.m_ID].m_Predicted.m_Frozen =
pCharacterData->m_Flags & CHARACTERFLAG_FROZEN;
m_aClients[Item.m_ID].m_FreezeEnd = m_aClients[Item.m_ID].m_Predicted.m_FreezeEnd =
pCharacterData->m_FreezeEnd;
m_aClients[Item.m_ID].m_DeepFrozen = m_aClients[Item.m_ID].m_Predicted.m_DeepFrozen =
pCharacterData->m_Flags & CHARACTERFLAG_DEEP_FROZEN;
pCharacterData->m_FreezeEnd == -1;
// Telegun
m_aClients[Item.m_ID].m_HasTelegunGrenade = m_aClients[Item.m_ID].m_Predicted.m_HasTelegunGrenade =
@ -1138,9 +1138,6 @@ void CGameClient::OnNewSnapshot()
pCharacterData->m_Flags & CHARACTERFLAG_TELEGUN_GUN;
m_aClients[Item.m_ID].m_HasTelegunLaser = m_aClients[Item.m_ID].m_Predicted.m_HasTelegunLaser =
pCharacterData->m_Flags & CHARACTERFLAG_TELEGUN_LASER;
// Other
m_aClients[Item.m_ID].m_Spectating = pCharacterData->m_Flags & CHARACTERFLAG_SPECTATING;
}
else if(Item.m_Type == NETOBJTYPE_SPECTATORINFO)
{
@ -1663,9 +1660,8 @@ void CGameClient::CClientData::Reset()
m_HasTelegunGun = false;
m_HasTelegunGrenade = false;
m_HasTelegunLaser = false;
m_Frozen = false;
m_FreezeEnd = 0;
m_DeepFrozen = false;
m_Spectating = false;
UpdateRenderInfo();
}

View file

@ -224,9 +224,8 @@ public:
bool m_HasTelegunGun;
bool m_HasTelegunGrenade;
bool m_HasTelegunLaser;
bool m_Frozen;
int m_FreezeEnd;
bool m_DeepFrozen;
bool m_Spectating;
CCharacterCore m_Predicted;

View file

@ -117,7 +117,7 @@ void CCharacterCore::Reset()
m_HasTelegunGun = false;
m_HasTelegunGrenade = false;
m_HasTelegunLaser = false;
m_Frozen = false;
m_FreezeEnd = 0;
m_DeepFrozen = false;
}

View file

@ -246,7 +246,7 @@ public:
bool m_HasTelegunGun;
bool m_HasTelegunGrenade;
bool m_HasTelegunLaser;
bool m_Frozen;
int m_FreezeEnd;
bool m_DeepFrozen;
void LimitForce(vec2 *Force);

View file

@ -1186,10 +1186,6 @@ void CCharacter::Snap(int SnappingClient)
pDDNetCharacter->m_Flags |= CHARACTERFLAG_ENDLESS_JUMP;
if(m_Jetpack || m_NinjaJetpack)
pDDNetCharacter->m_Flags |= CHARACTERFLAG_JETPACK;
if(m_FreezeTime > 0)
pDDNetCharacter->m_Flags |= CHARACTERFLAG_FROZEN;
if(m_DeepFreeze)
pDDNetCharacter->m_Flags |= CHARACTERFLAG_DEEP_FROZEN;
if(m_Hit&DISABLE_HIT_GRENADE)
pDDNetCharacter->m_Flags |= CHARACTERFLAG_NO_GRENADE_HIT;
if(m_Hit&DISABLE_HIT_HAMMER)
@ -1198,14 +1194,14 @@ void CCharacter::Snap(int SnappingClient)
pDDNetCharacter->m_Flags |= CHARACTERFLAG_NO_RIFLE_HIT;
if(m_Hit&DISABLE_HIT_SHOTGUN)
pDDNetCharacter->m_Flags |= CHARACTERFLAG_NO_SHOTGUN_HIT;
if(IsPaused())
pDDNetCharacter->m_Flags |= CHARACTERFLAG_SPECTATING;
if(m_HasTeleGun)
pDDNetCharacter->m_Flags |= CHARACTERFLAG_TELEGUN_GUN;
if(m_HasTeleGrenade)
pDDNetCharacter->m_Flags |= CHARACTERFLAG_TELEGUN_GRENADE;
if(m_HasTeleLaser)
pDDNetCharacter->m_Flags |= CHARACTERFLAG_TELEGUN_LASER;
pDDNetCharacter->m_FreezeEnd = m_DeepFreeze ? -1 : m_FreezeTick + m_FreezeTime;
}
int CCharacter::NetworkClipped(int SnappingClient)