Simplify and fix HookBase calculation

Saw this while implementing TwGame. Increase teehistorian version_minor
to make replaying teehistorian files easier.
This commit is contained in:
Zwelf 2024-04-01 12:58:41 +02:00
parent 9122080514
commit 467a3187dc
3 changed files with 10 additions and 5 deletions

View file

@ -308,11 +308,16 @@ void CCharacterCore::Tick(bool UseInput, bool DoDeferredTick)
}
else if(m_HookState == HOOK_FLYING)
{
vec2 HookBase = m_Pos;
if(m_NewHook)
{
HookBase = m_HookTeleBase;
}
vec2 NewPos = m_HookPos + m_HookDir * m_Tuning.m_HookFireSpeed;
if((!m_NewHook && distance(m_Pos, NewPos) > m_Tuning.m_HookLength) || (m_NewHook && distance(m_HookTeleBase, NewPos) > m_Tuning.m_HookLength))
if(distance(HookBase, NewPos) > m_Tuning.m_HookLength)
{
m_HookState = HOOK_RETRACT_START;
NewPos = m_Pos + normalize(NewPos - m_Pos) * m_Tuning.m_HookLength;
NewPos = HookBase + normalize(NewPos - HookBase) * m_Tuning.m_HookLength;
m_Reset = true;
}
@ -337,7 +342,7 @@ void CCharacterCore::Tick(bool UseInput, bool DoDeferredTick)
}
// Check against other players first
if(!this->m_HookHitDisabled && m_pWorld && m_Tuning.m_PlayerHooking)
if(!this->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++)

View file

@ -10,7 +10,7 @@
static const char TEEHISTORIAN_NAME[] = "teehistorian@ddnet.tw";
static const CUuid TEEHISTORIAN_UUID = CalculateUuid(TEEHISTORIAN_NAME);
static const char TEEHISTORIAN_VERSION[] = "2";
static const char TEEHISTORIAN_VERSION_MINOR[] = "6";
static const char TEEHISTORIAN_VERSION_MINOR[] = "7";
#define UUID(id, name) static const CUuid UUID_##id = CalculateUuid(name);
#include <engine/shared/teehistorian_ex_chunks.h>

View file

@ -105,7 +105,7 @@ protected:
void Expect(const unsigned char *pOutput, size_t OutputSize)
{
static CUuid TEEHISTORIAN_UUID = CalculateUuid("teehistorian@ddnet.tw");
static const char PREFIX1[] = "{\"comment\":\"teehistorian@ddnet.tw\",\"version\":\"2\",\"version_minor\":\"6\",\"game_uuid\":\"a1eb7182-796e-3b3e-941d-38ca71b2a4a8\",\"server_version\":\"DDNet test\",\"start_time\":\"";
static const char PREFIX1[] = "{\"comment\":\"teehistorian@ddnet.tw\",\"version\":\"2\",\"version_minor\":\"7\",\"game_uuid\":\"a1eb7182-796e-3b3e-941d-38ca71b2a4a8\",\"server_version\":\"DDNet test\",\"start_time\":\"";
static const char PREFIX2[] = "\",\"server_name\":\"server name\",\"server_port\":\"8303\",\"game_type\":\"game type\",\"map_name\":\"Kobra 3 Solo\",\"map_size\":\"903514\",\"map_sha256\":\"0123456789012345678901234567890123456789012345678901234567890123\",\"map_crc\":\"eceaf25c\",\"prng_description\":\"test-prng:02468ace\",\"config\":{},\"tuning\":{},\"uuids\":[";
static const char PREFIX3[] = "]}";