2021-12-19 00:25:54 +01:00
|
|
|
#include "backend/looped/looped.hpp"
|
2022-05-23 06:38:45 +08:00
|
|
|
#include "gta/enums.hpp"
|
2021-12-19 00:25:54 +01:00
|
|
|
#include "natives.hpp"
|
|
|
|
#include "util/math.hpp"
|
|
|
|
|
|
|
|
namespace big
|
|
|
|
{
|
|
|
|
static float run_speed = 10.f;
|
|
|
|
static float run_cap = 100.f;
|
|
|
|
static bool super_run_state = false;
|
|
|
|
|
|
|
|
void looped::self_super_run()
|
|
|
|
{
|
2022-05-23 06:38:45 +08:00
|
|
|
if (g->self.super_run && PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT))
|
2021-12-19 00:25:54 +01:00
|
|
|
{
|
|
|
|
if (run_speed < run_cap) run_speed += .5f;
|
|
|
|
|
2022-05-23 06:38:45 +08:00
|
|
|
Vector3 location = self::pos;
|
|
|
|
Ped ped = self::ped;
|
2021-12-19 00:25:54 +01:00
|
|
|
|
2021-12-21 11:03:58 +01:00
|
|
|
//Vector3 rot = CAM::GET_GAMEPLAY_CAM_ROT(2);
|
2022-05-23 06:38:45 +08:00
|
|
|
Vector3 rot = ENTITY::GET_ENTITY_ROTATION(ped, 2);
|
2021-12-19 00:25:54 +01:00
|
|
|
float yaw = math::deg_to_rad(rot.z + 90);
|
|
|
|
|
|
|
|
Vector3 offset;
|
2022-05-23 06:38:45 +08:00
|
|
|
offset.x = location.x + (run_speed * cos(yaw));
|
|
|
|
offset.y = location.y + (run_speed * sin(yaw));
|
|
|
|
offset.z = location.z + .2f;
|
2021-12-19 00:25:54 +01:00
|
|
|
|
|
|
|
float groundZ;
|
|
|
|
MISC::GET_GROUND_Z_FOR_3D_COORD(offset.x, offset.y, 1000.f, &groundZ, false, false);
|
2022-05-23 06:38:45 +08:00
|
|
|
if (groundZ < location.z)
|
2021-12-19 00:25:54 +01:00
|
|
|
offset.z = groundZ;
|
|
|
|
|
2022-05-23 06:38:45 +08:00
|
|
|
Vector3 vel = offset - location;
|
2021-12-19 00:25:54 +01:00
|
|
|
|
2022-05-23 06:38:45 +08:00
|
|
|
ENTITY::SET_ENTITY_VELOCITY(ped, vel.x, vel.y, vel.z);
|
2021-12-19 00:25:54 +01:00
|
|
|
|
|
|
|
g_local_player->m_player_info->m_run_speed = .7f;
|
|
|
|
}
|
2022-02-22 01:18:49 +01:00
|
|
|
else if (!g->self.super_run && g->self.super_run != super_run_state)
|
2021-12-19 00:25:54 +01:00
|
|
|
{
|
|
|
|
g_local_player->m_player_info->m_run_speed = 1.f;
|
|
|
|
}
|
2022-05-23 06:38:45 +08:00
|
|
|
else if (PAD::IS_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_SPRINT))
|
2021-12-19 00:25:54 +01:00
|
|
|
{
|
|
|
|
run_speed = 10.f;
|
|
|
|
g_local_player->m_player_info->m_run_speed = 1.f;
|
|
|
|
}
|
|
|
|
|
2022-02-22 01:18:49 +01:00
|
|
|
super_run_state = g->self.super_run;
|
2021-12-19 00:25:54 +01:00
|
|
|
}
|
|
|
|
}
|