feat: Fast Respawn, Rapid Fire, removed static offsets (#649)

Closes #495
Fixes #635
This commit is contained in:
Aure7138
2022-11-30 03:16:07 +08:00
committed by GitHub
parent a17aed317e
commit df1c459089
10 changed files with 67 additions and 73 deletions

View File

@ -32,6 +32,7 @@ namespace big
static void self_unlimited_oxygen();
static void self_no_water_collision();
static void self_mobile_radio();
static void self_fast_respawn();
static void session_local_time();
@ -72,5 +73,6 @@ namespace big
static void weapons_repair_gun();
static void weapons_steal_vehicle_gun();
static void weapons_vehicle_gun();
static void weapons_rapid_fire();
};
}

View File

@ -0,0 +1,17 @@
#include "backend/looped/looped.hpp"
#include "natives.hpp"
namespace big
{
void looped::self_fast_respawn()
{
if (g->self.fast_respawn)
{
if(PED::IS_PED_DEAD_OR_DYING(self::ped, true))
{
PED::RESURRECT_PED(self::ped);
ENTITY::SET_ENTITY_COORDS_NO_OFFSET(self::ped, self::pos.x, self::pos.y, self::pos.z, 0, 0, 0);
}
}
}
}

View File

@ -1,5 +1,4 @@
#include "backend/looped/looped.hpp"
#include "util/water.hpp"
namespace big
{
@ -13,12 +12,6 @@ namespace big
return;
}
float* water_collision_ptr = nullptr;
if (g_local_player->m_navigation != nullptr)
{
water_collision_ptr = water::get_water_collision_ptr(g_local_player->m_navigation);
}
uint32_t bits = g->self.proof_mask;
uint32_t changed_bits = bits ^ last_bits;
uint32_t changed_or_enabled_bits = bits | changed_bits;
@ -28,26 +21,6 @@ namespace big
uint32_t unchanged_bits = g_local_player->m_damage_bits & ~changed_or_enabled_bits;
g_local_player->m_damage_bits = unchanged_bits | bits;
last_bits = bits;
if (changed_or_enabled_bits & (uint32_t)eEntityProofs::WATER)
{
water::reset_ped_oxygen_time(g_local_player);
if (water_collision_ptr != nullptr && *water_collision_ptr != 0.f)
{
last_water_collistion_strength = *water_collision_ptr;
*water_collision_ptr = 0;
}
return;
}
}
if (last_water_collistion_strength != 0 && water_collision_ptr != nullptr)
{
*water_collision_ptr = last_water_collistion_strength;
last_water_collistion_strength = 0;
}
}
}

View File

@ -1,6 +1,5 @@
#include "backend/looped/looped.hpp"
#include "util/misc.hpp"
#include "util/water.hpp"
namespace big
{
@ -25,12 +24,6 @@ namespace big
g_local_player->m_vehicle->m_deform_god = 0x9C;
}
float* water_collision_ptr = nullptr;
if (g_local_player->m_vehicle->m_navigation != nullptr)
{
water_collision_ptr = water::get_water_collision_ptr(g_local_player->m_vehicle->m_navigation);
}
uint32_t bits = g->vehicle.proof_mask;
uint32_t changed_bits = bits ^ last_bits;
uint32_t changed_or_enabled_bits = bits | changed_bits;
@ -40,25 +33,6 @@ namespace big
uint32_t unchanged_bits = g_local_player->m_vehicle->m_damage_bits & ~changed_or_enabled_bits;
g_local_player->m_vehicle->m_damage_bits = unchanged_bits | bits;
last_bits = bits;
if (changed_or_enabled_bits & (uint32_t)eEntityProofs::WATER)
{
water::reset_ped_oxygen_time(g_local_player);
if (water_collision_ptr != nullptr && *water_collision_ptr != 0.f)
{
last_water_collistion_strength = *water_collision_ptr;
*water_collision_ptr = 0;
}
return;
}
}
if (last_water_collistion_strength != 0 && water_collision_ptr != nullptr)
{
*water_collision_ptr = last_water_collistion_strength;
last_water_collistion_strength = 0;
}
}
}

View File

@ -0,0 +1,26 @@
#include "backend/looped/looped.hpp"
#include "natives.hpp"
#include "gta/enums.hpp"
#include "util/math.hpp"
namespace big
{
void looped::weapons_rapid_fire()
{
if (g->weapons.rapid_fire)
{
if(!HUD::IS_PAUSE_MENU_ACTIVE())
{
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_ATTACK))
{
Vector3 direction = math::rotation_to_direction(CAM::GET_GAMEPLAY_CAM_ROT(0));
Vector3 start = CAM::GET_GAMEPLAY_CAM_COORD() + direction;
Vector3 end = start + direction * 200.0;
Hash weapon_hash;
WEAPON::GET_CURRENT_PED_WEAPON(self::ped, &weapon_hash, false);
MISC::SHOOT_SINGLE_BULLET_BETWEEN_COORDS(start.x, start.y, start.z, end.x, end.y, end.z, WEAPON::GET_WEAPON_DAMAGE(weapon_hash, 0), true, weapon_hash, self::ped, true, false, -1.0);
}
}
}
}
}