Ignore "no jump" areas and improve jump logic

This commit is contained in:
BenCat07 2020-05-18 11:04:05 +02:00 committed by LightCat
parent 058ac540a3
commit 4ce150518a

View File

@ -678,7 +678,10 @@ static void cm()
// Detect when jumping is necessary // Detect when jumping is necessary
if ((!(g_pLocalPlayer->holding_sniper_rifle && g_pLocalPlayer->bZoomed) && crumb_vec->z - g_pLocalPlayer->v_Origin.z > 18 && last_jump.test_and_set(200)) || (last_jump.test_and_set(200) && inactivity.check(*stuck_time / 2))) if ((!(g_pLocalPlayer->holding_sniper_rifle && g_pLocalPlayer->bZoomed) && crumb_vec->z - g_pLocalPlayer->v_Origin.z > 18 && last_jump.test_and_set(200)) || (last_jump.test_and_set(200) && inactivity.check(*stuck_time / 2)))
{ {
current_user_cmd->buttons |= IN_JUMP; auto local = findClosestNavSquare(g_pLocalPlayer->v_Origin);
// Check if current area allows jumping
if (!local || !(local->m_attributeFlags & NAV_MESH_NO_JUMP))
current_user_cmd->buttons |= (IN_JUMP | IN_DUCK);
} }
// Walk to next crumb // Walk to next crumb
WalkTo(*crumb_vec); WalkTo(*crumb_vec);