Merge pull request #8578 from Robyt3/Gamecore-Cleanup

Minor cleanup of `gamecore.cpp/h`
This commit is contained in:
Dennis Felsing 2024-07-11 19:51:15 +00:00 committed by GitHub
commit a21ff5b72e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 15 deletions

View file

@ -332,8 +332,6 @@ void CCharacterCore::Tick(bool UseInput, bool DoDeferredTick)
int teleNr = 0;
int Hit = m_pCollision->IntersectLineTeleHook(m_HookPos, NewPos, &NewPos, 0, &teleNr);
// m_NewHook = false;
if(Hit)
{
if(Hit == TILE_NOHOOK)
@ -346,7 +344,7 @@ void CCharacterCore::Tick(bool UseInput, bool DoDeferredTick)
}
// Check against other players first
if(!this->m_HookHitDisabled && m_pWorld && m_Tuning.m_PlayerHooking && (m_HookState == HOOK_FLYING || !m_NewHook))
if(!m_HookHitDisabled && m_pWorld && m_Tuning.m_PlayerHooking && (m_HookState == HOOK_FLYING || !m_NewHook))
{
float Distance = 0.0f;
for(int i = 0; i < MAX_CLIENTS; i++)
@ -418,10 +416,6 @@ void CCharacterCore::Tick(bool UseInput, bool DoDeferredTick)
m_HookState = HOOK_RETRACTED;
m_HookPos = m_Pos;
}
// keep players hooked for a max of 1.5sec
// if(Server()->Tick() > hook_tick+(Server()->TickSpeed()*3)/2)
// release_hooked();
}
// don't do this hook routine when we are already hooked to a player
@ -443,7 +437,8 @@ void CCharacterCore::Tick(bool UseInput, bool DoDeferredTick)
vec2 NewVel = m_Vel + HookVel;
// check if we are under the legal limit for the hook
if(length(NewVel) < m_Tuning.m_HookDragSpeed || length(NewVel) < length(m_Vel))
const float NewVelLength = length(NewVel);
if(NewVelLength < m_Tuning.m_HookDragSpeed || NewVelLength < length(m_Vel))
m_Vel = NewVel; // no problem. apply
}
@ -471,9 +466,6 @@ void CCharacterCore::TickDeferred()
if(!pCharCore)
continue;
// player *p = (player*)ent;
// if(pCharCore == this) // || !(p->flags&FLAG_ALIVE)
if(pCharCore == this || (m_Id != -1 && !m_pTeams->CanCollide(m_Id, i)))
continue; // make sure that we don't nudge our self
@ -488,7 +480,7 @@ void CCharacterCore::TickDeferred()
bool CanCollide = (m_Super || pCharCore->m_Super) || (!m_CollisionDisabled && !pCharCore->m_CollisionDisabled && m_Tuning.m_PlayerCollision);
if(CanCollide && Distance < PhysicalSize() * 1.25f && Distance > 0.0f)
if(CanCollide && Distance < PhysicalSize() * 1.25f)
{
float a = (PhysicalSize() * 1.45f - Distance);
float Velocity = 0.5f;
@ -505,7 +497,7 @@ void CCharacterCore::TickDeferred()
// handle hook influence
if(!m_HookHitDisabled && m_HookedPlayer == i && m_Tuning.m_PlayerHooking)
{
if(Distance > PhysicalSize() * 1.50f) // TODO: fix tweakable variable
if(Distance > PhysicalSize() * 1.50f)
{
float HookAccel = m_Tuning.m_HookDragAccel * (Distance / m_Tuning.m_HookLength);
float DragSpeed = m_Tuning.m_HookDragSpeed;
@ -589,7 +581,7 @@ void CCharacterCore::Move()
if((!(pCharCore->m_Super || m_Super) && (m_Solo || pCharCore->m_Solo || pCharCore->m_CollisionDisabled || (m_Id != -1 && !m_pTeams->CanCollide(m_Id, p)))))
continue;
float D = distance(Pos, pCharCore->m_Pos);
if(D < PhysicalSize() && D >= 0.0f)
if(D < PhysicalSize())
{
if(a > 0.0f)
m_Pos = LastPos;

View file

@ -120,7 +120,6 @@ enum
COREEVENT_HOOK_ATTACH_GROUND = 0x10,
COREEVENT_HOOK_HIT_NOHOOK = 0x20,
COREEVENT_HOOK_RETRACT = 0x40,
// COREEVENT_HOOK_TELE=0x80,
};
// show others values - do not change them