mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
fix swap does not swap no collision and no hook
- remove duplicated variable for no collision and no hook
This commit is contained in:
parent
cfdb97a422
commit
5065bab8b5
|
@ -829,23 +829,23 @@ void CCharacter::HandleTiles(int Index)
|
|||
}
|
||||
|
||||
// collide with others
|
||||
if(((m_TileIndex == TILE_NPC_DISABLE) || (m_TileFIndex == TILE_NPC_DISABLE)) && m_Core.m_Collision)
|
||||
if(((m_TileIndex == TILE_NPC_DISABLE) || (m_TileFIndex == TILE_NPC_DISABLE)) && !m_Core.m_NoCollision)
|
||||
{
|
||||
m_Core.m_Collision = false;
|
||||
m_Core.m_NoCollision = true;
|
||||
}
|
||||
else if(((m_TileIndex == TILE_NPC_ENABLE) || (m_TileFIndex == TILE_NPC_ENABLE)) && !m_Core.m_Collision)
|
||||
else if(((m_TileIndex == TILE_NPC_ENABLE) || (m_TileFIndex == TILE_NPC_ENABLE)) && m_Core.m_NoCollision)
|
||||
{
|
||||
m_Core.m_Collision = true;
|
||||
m_Core.m_NoCollision = false;
|
||||
}
|
||||
|
||||
// hook others
|
||||
if(((m_TileIndex == TILE_NPH_DISABLE) || (m_TileFIndex == TILE_NPH_DISABLE)) && m_Core.m_Hook)
|
||||
if(((m_TileIndex == TILE_NPH_DISABLE) || (m_TileFIndex == TILE_NPH_DISABLE)) && !m_Core.m_NoHookHit)
|
||||
{
|
||||
m_Core.m_Hook = false;
|
||||
m_Core.m_NoHookHit = true;
|
||||
}
|
||||
else if(((m_TileIndex == TILE_NPH_ENABLE) || (m_TileFIndex == TILE_NPH_ENABLE)) && !m_Core.m_Hook)
|
||||
else if(((m_TileIndex == TILE_NPH_ENABLE) || (m_TileFIndex == TILE_NPH_ENABLE)) && m_Core.m_NoHookHit)
|
||||
{
|
||||
m_Core.m_Hook = true;
|
||||
m_Core.m_NoHookHit = false;
|
||||
}
|
||||
|
||||
// unlimited air jumps
|
||||
|
@ -1131,8 +1131,8 @@ void CCharacter::ResetPrediction()
|
|||
m_Jetpack = false;
|
||||
m_NinjaJetpack = false;
|
||||
m_Core.m_Jumps = 2;
|
||||
m_Core.m_Hook = true;
|
||||
m_Core.m_Collision = true;
|
||||
m_Core.m_NoHookHit = false;
|
||||
m_Core.m_NoCollision = false;
|
||||
m_NumInputs = 0;
|
||||
m_FreezeTime = 0;
|
||||
m_Core.m_FreezeTick = 0;
|
||||
|
@ -1268,8 +1268,8 @@ void CCharacter::Read(CNetObj_Character *pChar, CNetObj_DDNetCharacter *pExtende
|
|||
|
||||
// set player collision
|
||||
SetSolo(!Tuning()->m_PlayerCollision && !Tuning()->m_PlayerHooking);
|
||||
m_Core.m_Collision = Tuning()->m_PlayerCollision;
|
||||
m_Core.m_Hook = Tuning()->m_PlayerHooking;
|
||||
m_Core.m_NoCollision = !Tuning()->m_PlayerCollision;
|
||||
m_Core.m_NoHookHit = !Tuning()->m_PlayerHooking;
|
||||
|
||||
if(m_Core.m_HookTick != 0)
|
||||
m_EndlessHook = false;
|
||||
|
|
|
@ -86,8 +86,6 @@ void CCharacterCore::Reset()
|
|||
m_JumpedTotal = 0;
|
||||
m_Jumps = 2;
|
||||
m_TriggeredEvents = 0;
|
||||
m_Hook = true;
|
||||
m_Collision = true;
|
||||
|
||||
// DDNet Character
|
||||
m_Solo = false;
|
||||
|
@ -275,7 +273,7 @@ void CCharacterCore::Tick(bool UseInput)
|
|||
}
|
||||
|
||||
// Check against other players first
|
||||
if(this->m_Hook && m_pWorld && m_Tuning.m_PlayerHooking)
|
||||
if(!this->m_NoHookHit && m_pWorld && m_Tuning.m_PlayerHooking)
|
||||
{
|
||||
float Distance = 0.0f;
|
||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||
|
@ -409,7 +407,7 @@ void CCharacterCore::Tick(bool UseInput)
|
|||
{
|
||||
vec2 Dir = normalize(m_Pos - pCharCore->m_Pos);
|
||||
|
||||
bool CanCollide = (m_Super || pCharCore->m_Super) || (pCharCore->m_Collision && m_Collision && !m_NoCollision && !pCharCore->m_NoCollision && m_Tuning.m_PlayerCollision);
|
||||
bool CanCollide = (m_Super || pCharCore->m_Super) || (!m_NoCollision && !pCharCore->m_NoCollision && m_Tuning.m_PlayerCollision);
|
||||
|
||||
if(CanCollide && Distance < PhysicalSize() * 1.25f && Distance > 0.0f)
|
||||
{
|
||||
|
@ -426,7 +424,7 @@ void CCharacterCore::Tick(bool UseInput)
|
|||
}
|
||||
|
||||
// handle hook influence
|
||||
if(m_Hook && m_HookedPlayer == i && m_Tuning.m_PlayerHooking)
|
||||
if(!m_NoHookHit && m_HookedPlayer == i && m_Tuning.m_PlayerHooking)
|
||||
{
|
||||
if(Distance > PhysicalSize() * 1.50f) // TODO: fix tweakable variable
|
||||
{
|
||||
|
@ -482,7 +480,7 @@ void CCharacterCore::Move()
|
|||
|
||||
m_Vel.x = m_Vel.x * (1.0f / RampValue);
|
||||
|
||||
if(m_pWorld && (m_Super || (m_Tuning.m_PlayerCollision && m_Collision && !m_NoCollision && !m_Solo)))
|
||||
if(m_pWorld && (m_Super || (m_Tuning.m_PlayerCollision && !m_NoCollision && !m_Solo)))
|
||||
{
|
||||
// check player collision
|
||||
float Distance = distance(m_Pos, NewPos);
|
||||
|
@ -499,7 +497,7 @@ void CCharacterCore::Move()
|
|||
CCharacterCore *pCharCore = m_pWorld->m_apCharacters[p];
|
||||
if(!pCharCore || pCharCore == this)
|
||||
continue;
|
||||
if((!(pCharCore->m_Super || m_Super) && (m_Solo || pCharCore->m_Solo || !pCharCore->m_Collision || pCharCore->m_NoCollision || (m_Id != -1 && !m_pTeams->CanCollide(m_Id, p)))))
|
||||
if((!(pCharCore->m_Super || m_Super) && (m_Solo || pCharCore->m_Solo || pCharCore->m_NoCollision || (m_Id != -1 && !m_pTeams->CanCollide(m_Id, p)))))
|
||||
continue;
|
||||
float D = distance(Pos, pCharCore->m_Pos);
|
||||
if(D < PhysicalSize() && D >= 0.0f)
|
||||
|
@ -574,9 +572,6 @@ void CCharacterCore::ReadDDNet(const CNetObj_DDNetCharacter *pObjDDNet)
|
|||
m_NoHookHit = pObjDDNet->m_Flags & CHARACTERFLAG_NO_HOOK;
|
||||
m_Super = pObjDDNet->m_Flags & CHARACTERFLAG_SUPER;
|
||||
|
||||
m_Hook = !m_NoHookHit;
|
||||
m_Collision = !m_NoCollision;
|
||||
|
||||
// Endless
|
||||
m_EndlessHook = pObjDDNet->m_Flags & CHARACTERFLAG_ENDLESS_HOOK;
|
||||
m_EndlessJump = pObjDDNet->m_Flags & CHARACTERFLAG_ENDLESS_JUMP;
|
||||
|
|
|
@ -212,8 +212,6 @@ public:
|
|||
static constexpr vec2 PhysicalSizeVec2() { return vec2(28.0f, 28.0f); };
|
||||
vec2 m_Pos;
|
||||
vec2 m_Vel;
|
||||
bool m_Hook;
|
||||
bool m_Collision;
|
||||
|
||||
vec2 m_HookPos;
|
||||
vec2 m_HookDir;
|
||||
|
|
|
@ -1231,9 +1231,9 @@ void CCharacter::Snap(int SnappingClient)
|
|||
pDDNetCharacter->m_Flags |= CHARACTERFLAG_SUPER;
|
||||
if(m_EndlessHook)
|
||||
pDDNetCharacter->m_Flags |= CHARACTERFLAG_ENDLESS_HOOK;
|
||||
if(!m_Core.m_Collision || !GameServer()->Tuning()->m_PlayerCollision)
|
||||
if(m_Core.m_NoCollision || !GameServer()->Tuning()->m_PlayerCollision)
|
||||
pDDNetCharacter->m_Flags |= CHARACTERFLAG_NO_COLLISION;
|
||||
if(!m_Core.m_Hook || !GameServer()->Tuning()->m_PlayerHooking)
|
||||
if(m_Core.m_NoHookHit || !GameServer()->Tuning()->m_PlayerHooking)
|
||||
pDDNetCharacter->m_Flags |= CHARACTERFLAG_NO_HOOK;
|
||||
if(m_SuperJump)
|
||||
pDDNetCharacter->m_Flags |= CHARACTERFLAG_ENDLESS_JUMP;
|
||||
|
@ -1577,36 +1577,32 @@ void CCharacter::HandleTiles(int Index)
|
|||
}
|
||||
|
||||
// collide with others
|
||||
if(((m_TileIndex == TILE_NPC_DISABLE) || (m_TileFIndex == TILE_NPC_DISABLE)) && m_Core.m_Collision)
|
||||
if(((m_TileIndex == TILE_NPC_DISABLE) || (m_TileFIndex == TILE_NPC_DISABLE)) && !m_Core.m_NoCollision)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can't collide with others");
|
||||
m_Core.m_Collision = false;
|
||||
m_Core.m_NoCollision = true;
|
||||
m_NeededFaketuning |= FAKETUNE_NOCOLL;
|
||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings
|
||||
}
|
||||
else if(((m_TileIndex == TILE_NPC_ENABLE) || (m_TileFIndex == TILE_NPC_ENABLE)) && !m_Core.m_Collision)
|
||||
else if(((m_TileIndex == TILE_NPC_ENABLE) || (m_TileFIndex == TILE_NPC_ENABLE)) && m_Core.m_NoCollision)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can collide with others");
|
||||
m_Core.m_Collision = true;
|
||||
m_Core.m_NoCollision = false;
|
||||
m_NeededFaketuning &= ~FAKETUNE_NOCOLL;
|
||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings
|
||||
}
|
||||
|
||||
// hook others
|
||||
if(((m_TileIndex == TILE_NPH_DISABLE) || (m_TileFIndex == TILE_NPH_DISABLE)) && m_Core.m_Hook)
|
||||
if(((m_TileIndex == TILE_NPH_DISABLE) || (m_TileFIndex == TILE_NPH_DISABLE)) && !m_Core.m_NoHookHit)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can't hook others");
|
||||
m_Core.m_Hook = false;
|
||||
m_Core.m_NoHookHit = true;
|
||||
m_NeededFaketuning |= FAKETUNE_NOHOOK;
|
||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings
|
||||
}
|
||||
else if(((m_TileIndex == TILE_NPH_ENABLE) || (m_TileFIndex == TILE_NPH_ENABLE)) && !m_Core.m_Hook)
|
||||
else if(((m_TileIndex == TILE_NPH_ENABLE) || (m_TileFIndex == TILE_NPH_ENABLE)) && m_Core.m_NoHookHit)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can hook others");
|
||||
m_Core.m_Hook = true;
|
||||
m_Core.m_NoHookHit = false;
|
||||
m_NeededFaketuning &= ~FAKETUNE_NOHOOK;
|
||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings
|
||||
|
|
|
@ -77,8 +77,8 @@ void CSaveTee::Save(CCharacter *pChr)
|
|||
// Core
|
||||
m_CorePos = pChr->m_Core.m_Pos;
|
||||
m_Vel = pChr->m_Core.m_Vel;
|
||||
m_Hook = pChr->m_Core.m_Hook;
|
||||
m_Collision = pChr->m_Core.m_Collision;
|
||||
m_Hook = !pChr->m_Core.m_NoHookHit;
|
||||
m_Collision = !pChr->m_Core.m_NoCollision;
|
||||
m_ActiveWeapon = pChr->m_Core.m_ActiveWeapon;
|
||||
m_Jumped = pChr->m_Core.m_Jumped;
|
||||
m_JumpedTotal = pChr->m_Core.m_JumpedTotal;
|
||||
|
@ -170,8 +170,8 @@ void CSaveTee::Load(CCharacter *pChr, int Team, bool IsSwap)
|
|||
// Core
|
||||
pChr->m_Core.m_Pos = m_CorePos;
|
||||
pChr->m_Core.m_Vel = m_Vel;
|
||||
pChr->m_Core.m_Hook = m_Hook;
|
||||
pChr->m_Core.m_Collision = m_Collision;
|
||||
pChr->m_Core.m_NoHookHit = !m_Hook;
|
||||
pChr->m_Core.m_NoCollision = !m_Collision;
|
||||
pChr->m_Core.m_ActiveWeapon = m_ActiveWeapon;
|
||||
pChr->m_Core.m_Jumped = m_Jumped;
|
||||
pChr->m_Core.m_JumpedTotal = m_JumpedTotal;
|
||||
|
|
Loading…
Reference in a new issue