mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Remove switch state from prediction, initialize m_Layer
This commit is contained in:
parent
2107e1679c
commit
48a84aef46
|
@ -674,9 +674,7 @@ void CCharacter::HandleSkippableTiles(int Index)
|
|||
|
||||
bool CCharacter::IsSwitchActiveCb(int Number, void *pUser)
|
||||
{
|
||||
CCharacter *pThis = (CCharacter *)pUser;
|
||||
CCollision *pCollision = pThis->Collision();
|
||||
return pCollision->m_pSwitchers && pCollision->m_pSwitchers[Number].m_Status[pThis->Team()] && pThis->Team() != TEAM_SUPER;
|
||||
return false; //switch state is not implemented in prediction yet
|
||||
}
|
||||
|
||||
void CCharacter::HandleTiles(int Index)
|
||||
|
@ -813,40 +811,15 @@ void CCharacter::HandleTiles(int Index)
|
|||
}
|
||||
|
||||
// handle switch tiles
|
||||
if(Collision()->IsSwitch(MapIndex) == TILE_SWITCHOPEN && Team() != TEAM_SUPER && Collision()->GetSwitchNumber(MapIndex) > 0)
|
||||
if(Collision()->IsSwitch(MapIndex) == TILE_FREEZE && Team() != TEAM_SUPER && Collision()->GetSwitchNumber(MapIndex) == 0)
|
||||
{
|
||||
Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()] = true;
|
||||
Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_EndTick[Team()] = 0;
|
||||
Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Type[Team()] = TILE_SWITCHOPEN;
|
||||
}
|
||||
else if(Collision()->IsSwitch(MapIndex) == TILE_SWITCHTIMEDOPEN && Team() != TEAM_SUPER && Collision()->GetSwitchNumber(MapIndex) > 0)
|
||||
{
|
||||
Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()] = true;
|
||||
Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_EndTick[Team()] = GameWorld()->GameTick() + 1 + Collision()->GetSwitchDelay(MapIndex) * GameWorld()->GameTickSpeed();
|
||||
Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Type[Team()] = TILE_SWITCHTIMEDOPEN;
|
||||
}
|
||||
else if(Collision()->IsSwitch(MapIndex) == TILE_SWITCHTIMEDCLOSE && Team() != TEAM_SUPER && Collision()->GetSwitchNumber(MapIndex) > 0)
|
||||
{
|
||||
Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()] = false;
|
||||
Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_EndTick[Team()] = GameWorld()->GameTick() + 1 + Collision()->GetSwitchDelay(MapIndex) * GameWorld()->GameTickSpeed();
|
||||
Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Type[Team()] = TILE_SWITCHTIMEDCLOSE;
|
||||
}
|
||||
else if(Collision()->IsSwitch(MapIndex) == TILE_SWITCHCLOSE && Team() != TEAM_SUPER && Collision()->GetSwitchNumber(MapIndex) > 0)
|
||||
{
|
||||
Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()] = false;
|
||||
Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_EndTick[Team()] = 0;
|
||||
Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Type[Team()] = TILE_SWITCHCLOSE;
|
||||
}
|
||||
else if(Collision()->IsSwitch(MapIndex) == TILE_FREEZE && Team() != TEAM_SUPER)
|
||||
{
|
||||
if(Collision()->GetSwitchNumber(MapIndex) == 0 || Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()])
|
||||
Freeze(Collision()->GetSwitchDelay(MapIndex));
|
||||
}
|
||||
else if(Collision()->IsSwitch(MapIndex) == TILE_DFREEZE && Team() != TEAM_SUPER && (Collision()->GetSwitchNumber(MapIndex) == 0 || Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()]))
|
||||
else if(Collision()->IsSwitch(MapIndex) == TILE_DFREEZE && Team() != TEAM_SUPER && Collision()->GetSwitchNumber(MapIndex) == 0)
|
||||
{
|
||||
m_DeepFreeze = true;
|
||||
}
|
||||
else if(Collision()->IsSwitch(MapIndex) == TILE_DUNFREEZE && Team() != TEAM_SUPER && (Collision()->GetSwitchNumber(MapIndex) == 0 || Collision()->m_pSwitchers[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()]))
|
||||
else if(Collision()->IsSwitch(MapIndex) == TILE_DUNFREEZE && Team() != TEAM_SUPER && Collision()->GetSwitchNumber(MapIndex) == 0)
|
||||
{
|
||||
m_DeepFreeze = false;
|
||||
}
|
||||
|
|
|
@ -17,8 +17,6 @@ void CPickup::Tick()
|
|||
{
|
||||
if(GameWorld()->m_WorldConfig.m_IsVanilla && distance(m_Pos, pChr->m_Pos) >= 20.0f * 2) // pickup distance is shorter on vanilla due to using ClosestEntity
|
||||
continue;
|
||||
if(m_Layer == LAYER_SWITCH && m_Number > 0 && !Collision()->m_pSwitchers[m_Number].m_Status[pChr->Team()])
|
||||
continue;
|
||||
bool sound = false;
|
||||
// player picked us up, is someone was hooking us, let them go
|
||||
switch(m_Type)
|
||||
|
|
|
@ -105,7 +105,7 @@ void CProjectile::Tick()
|
|||
GameWorld()->CreateExplosion(ColPos, m_Owner, m_Type, m_Owner == -1, (!pTargetChr ? -1 : pTargetChr->Team()),
|
||||
(m_Owner != -1) ? TeamMask : -1LL);
|
||||
}
|
||||
else if(pTargetChr && m_Freeze && ((m_Layer == LAYER_SWITCH && m_Number > 0 && Collision()->m_pSwitchers[m_Number].m_Status[pTargetChr->Team()]) || m_Layer != LAYER_SWITCH))
|
||||
else if(pTargetChr && m_Freeze)
|
||||
pTargetChr->Freeze();
|
||||
if(Collide && m_Bouncing != 0)
|
||||
{
|
||||
|
@ -187,6 +187,8 @@ CProjectile::CProjectile(CGameWorld *pGameWorld, int ID, CProjectileData *pProj)
|
|||
Lifetime = GetTuning(m_TuneZone)->m_ShotgunLifetime * GameWorld()->GameTickSpeed();
|
||||
m_LifeSpan = Lifetime - (pGameWorld->GameTick() - m_StartTick);
|
||||
m_ID = ID;
|
||||
m_Layer = LAYER_GAME;
|
||||
m_Number = 0;
|
||||
}
|
||||
|
||||
CProjectileData CProjectile::GetData() const
|
||||
|
|
Loading…
Reference in a new issue