From b580a8dbc632ac08427a107af3bd55a39da3474e Mon Sep 17 00:00:00 2001 From: oy Date: Sat, 13 Oct 2018 13:36:25 +0200 Subject: [PATCH] reverted hook behavior (#1488) --- datasrc/network.py | 2 ++ src/game/gamecore.cpp | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/datasrc/network.py b/datasrc/network.py index 3848842fa..161a760ab 100644 --- a/datasrc/network.py +++ b/datasrc/network.py @@ -153,6 +153,8 @@ Objects = [ NetIntAny("m_HookX"), NetIntAny("m_HookY"), + NetIntAny("m_HookDx"), + NetIntAny("m_HookDy"), ]), NetObject("Character:CharacterCore", [ diff --git a/src/game/gamecore.cpp b/src/game/gamecore.cpp index f3c6e367e..be72ac9ed 100644 --- a/src/game/gamecore.cpp +++ b/src/game/gamecore.cpp @@ -139,9 +139,7 @@ void CCharacterCore::Tick(bool UseInput) { m_HookedPlayer = -1; m_HookState = HOOK_IDLE; - m_HookPos = vec2(0,0); - m_HookDir = vec2(0,0); - m_HookTick = 0; + m_HookPos = m_Pos; } } @@ -404,6 +402,8 @@ void CCharacterCore::Write(CNetObj_CharacterCore *pObjCore) pObjCore->m_HookTick = m_HookTick; pObjCore->m_HookX = round_to_int(m_HookPos.x); pObjCore->m_HookY = round_to_int(m_HookPos.y); + pObjCore->m_HookDx = round_to_int(m_HookDir.x*256.0f); + pObjCore->m_HookDy = round_to_int(m_HookDir.y*256.0f); pObjCore->m_HookedPlayer = m_HookedPlayer; pObjCore->m_Jumped = m_Jumped; pObjCore->m_Direction = m_Direction; @@ -420,7 +420,8 @@ void CCharacterCore::Read(const CNetObj_CharacterCore *pObjCore) m_HookTick = pObjCore->m_HookTick; m_HookPos.x = pObjCore->m_HookX; m_HookPos.y = pObjCore->m_HookY; - m_HookDir = normalize(m_HookPos-m_Pos); + m_HookDir.x = pObjCore->m_HookDx/256.0f; + m_HookDir.y = pObjCore->m_HookDy/256.0f; m_HookedPlayer = pObjCore->m_HookedPlayer; m_Jumped = pObjCore->m_Jumped; m_Direction = pObjCore->m_Direction;