diff --git a/BigBaseV2/src/backend/looped/weapons/ammo_special_type.cpp b/BigBaseV2/src/backend/looped/weapons/ammo_special_type.cpp index 21526feb..ff90a69e 100644 --- a/BigBaseV2/src/backend/looped/weapons/ammo_special_type.cpp +++ b/BigBaseV2/src/backend/looped/weapons/ammo_special_type.cpp @@ -2,20 +2,65 @@ namespace big { - static bool bLastState = false; + static CWeaponInfo* pModifiedWeapon = nullptr; + static eDamageType modifiedWeaponDamageType = eDamageType::None; + static eImpactType modifiedWeaponImpactType = eImpactType::DEFAULT_BULLETS; + static eAmmoSpecialType modifiedWeaponAmmoType = eAmmoSpecialType::None; + void looped::weapons_ammo_special_type() { - if (g_local_player == nullptr || + if ( + g_local_player == nullptr || g_local_player->m_weapon_manager == nullptr || g_local_player->m_weapon_manager->m_weapon_info == nullptr || - g_local_player->m_weapon_manager->m_weapon_info->m_ammo_info == nullptr) + g_local_player->m_weapon_manager->m_weapon_info->m_ammo_info == nullptr + ) { return; + } - if (g->weapons.ammo_special.toggle) - g_local_player->m_weapon_manager->m_weapon_info->m_ammo_info->m_ammo_special_type = g->weapons.ammo_special.type; - else if (bLastState) - g_local_player->m_weapon_manager->m_weapon_info->m_ammo_info->m_ammo_special_type = eAmmoSpecialType::None; + if (g->weapons.ammo_special.toggle) { + CWeaponInfo* pWeapon = g_local_player->m_weapon_manager->m_weapon_info; - bLastState = g->weapons.ammo_special.toggle; + // check if the player changed their weapon + if (pModifiedWeapon != pWeapon) { + // apply the original bullet and impact type to the old weapon + if (pModifiedWeapon != nullptr) { + pModifiedWeapon->m_damage_type = modifiedWeaponDamageType; + pModifiedWeapon->m_impact_type = modifiedWeaponImpactType; + pModifiedWeapon->m_ammo_info->m_ammo_special_type = modifiedWeaponAmmoType; + } + + // backup the bullet and impact type of the new weapon + pModifiedWeapon = pWeapon; + modifiedWeaponDamageType = pWeapon->m_damage_type; + modifiedWeaponImpactType = pWeapon->m_impact_type; + modifiedWeaponAmmoType = pWeapon->m_ammo_info->m_ammo_special_type; + } + + // apply ammo type changes to the current weapon + eDamageType damageType = eDamageType::None; + eImpactType impactType = g->weapons.ammo_special.impactType; + eAmmoSpecialType ammoType = eAmmoSpecialType::None; + + if (impactType == eImpactType::DEFAULT_BULLETS) { + damageType = modifiedWeaponDamageType; + ammoType = g->weapons.ammo_special.type; + } + else { + damageType = eDamageType::Explosive; + ammoType = modifiedWeaponAmmoType; + } + + pWeapon->m_damage_type = damageType; + pWeapon->m_impact_type = impactType; + pWeapon->m_ammo_info->m_ammo_special_type = ammoType; + } else if (pModifiedWeapon != nullptr) { + // apply the original bullet and impact type to the weapon + // when the ammo type feature is off + pModifiedWeapon->m_damage_type = modifiedWeaponDamageType; + pModifiedWeapon->m_impact_type = modifiedWeaponImpactType; + pModifiedWeapon->m_ammo_info->m_ammo_special_type = modifiedWeaponAmmoType; + pModifiedWeapon = nullptr; + } } } \ No newline at end of file diff --git a/BigBaseV2/src/core/data/bullet_impact_types.hpp b/BigBaseV2/src/core/data/bullet_impact_types.hpp new file mode 100644 index 00000000..8076e07f --- /dev/null +++ b/BigBaseV2/src/core/data/bullet_impact_types.hpp @@ -0,0 +1,91 @@ +#pragma once +#include "CAmmoInfo.hpp" + +std::map BULLET_IMPACTS = { + { eImpactType::DEFAULT_BULLETS, "DEFAULT_BULLETS" }, + { eImpactType::GRENADE, "GRENADE" }, + { eImpactType::GRENADELAUNCHER, "GRENADELAUNCHER" }, + { eImpactType::STICKYBOMB, "STICKYBOMB" }, + { eImpactType::MOLOTOV, "MOLOTOV" }, + { eImpactType::ROCKET, "ROCKET" }, + { eImpactType::TANKSHELL, "TANKSHELL" }, + { eImpactType::HI_OCTANE, "HI_OCTANE" }, + { eImpactType::CAR, "CAR" }, + { eImpactType::PLANE, "PLANE" }, + { eImpactType::PETROL_PUMP, "PETROL_PUMP" }, + { eImpactType::BIKE, "BIKE" }, + { eImpactType::DIR_STEAM, "DIR_STEAM" }, + { eImpactType::DIR_FLAME, "DIR_FLAME" }, + { eImpactType::DIR_WATER_HYDRANT, "DIR_WATER_HYDRANT" }, + { eImpactType::DIR_GAS_CANISTER, "DIR_GAS_CANISTER" }, + { eImpactType::BOAT, "BOAT" }, + { eImpactType::SHIP_DESTROY, "SHIP_DESTROY" }, + { eImpactType::TRUCK, "TRUCK" }, + { eImpactType::MK2_EXPLOSIVE_BULLETS, "MK2_EXPLOSIVE_BULLETS" }, + { eImpactType::SMOKEGRENADELAUNCHER, "SMOKEGRENADELAUNCHER" }, + { eImpactType::SMOKEGRENADE, "SMOKEGRENADE" }, + { eImpactType::BZGAS, "BZGAS" }, + { eImpactType::FLARE, "FLARE" }, + { eImpactType::GAS_CANISTER, "GAS_CANISTER" }, + { eImpactType::EXTINGUISHER_1, "EXTINGUISHER_1" }, + { eImpactType::PROGRAMMABLEAR, "PROGRAMMABLEAR" }, + { eImpactType::TRAIN, "TRAIN" }, + { eImpactType::BARREL, "BARREL" }, + { eImpactType::PROPANE, "PROPANE" }, + { eImpactType::BLIMP, "BLIMP" }, + { eImpactType::DIR_FLAME_EXPLODE, "DIR_FLAME_EXPLODE" }, + { eImpactType::TANKER, "TANKER" }, + { eImpactType::PLANE_ROCKET, "PLANE_ROCKET" }, + { eImpactType::VEHICLE_BULLET, "VEHICLE_BULLET" }, + { eImpactType::GAS_TANK, "GAS_TANK" }, + { eImpactType::BIRD_CRAP, "BIRD_CRAP" }, + { eImpactType::RAILGUN, "RAILGUN" }, + { eImpactType::BLIMP2, "BLIMP2" }, + { eImpactType::FIREWORK, "FIREWORK" }, + { eImpactType::SNOWBALL, "SNOWBALL" }, + { eImpactType::PROXMINE, "PROXMINE" }, + { eImpactType::VALKYRIE_CANNON, "VALKYRIE_CANNON" }, + { eImpactType::AIR_DEFENCE, "AIR_DEFENCE" }, + { eImpactType::PIPEBOMB, "PIPEBOMB" }, + { eImpactType::VEHICLEMINE, "VEHICLEMINE" }, + { eImpactType::EXPLOSIVEAMMO, "EXPLOSIVEAMMO" }, + { eImpactType::APCSHELL, "APCSHELL" }, + { eImpactType::BOMB_CLUSTER, "BOMB_CLUSTER" }, + { eImpactType::BOMB_GAS, "BOMB_GAS" }, + { eImpactType::BOMB_INCENDIARY, "BOMB_INCENDIARY" }, + { eImpactType::BOMB_STANDARD, "BOMB_STANDARD" }, + { eImpactType::TORPEDO, "TORPEDO" }, + { eImpactType::TORPEDO_UNDERWATER, "TORPEDO_UNDERWATER" }, + { eImpactType::BOMBUSHKA_CANNON, "BOMBUSHKA_CANNON" }, + { eImpactType::BOMB_CLUSTER_SECONDARY, "BOMB_CLUSTER_SECONDARY" }, + { eImpactType::HUNTER_BARRAGE, "HUNTER_BARRAGE" }, + { eImpactType::HUNTER_CANNON, "HUNTER_CANNON" }, + { eImpactType::ROGUE_CANNON, "ROGUE_CANNON" }, + { eImpactType::MINE_UNDERWATER, "MINE_UNDERWATER" }, + { eImpactType::ORBITAL_CANNON, "ORBITAL_CANNON" }, + { eImpactType::BOMB_STANDARD_WIDE, "BOMB_STANDARD_WIDE" }, + { eImpactType::EXPLOSIVEAMMO_SHOTGUN, "EXPLOSIVEAMMO_SHOTGUN" }, + { eImpactType::OPPRESSOR2_CANNON, "OPPRESSOR2_CANNON" }, + { eImpactType::MORTAR_KINETIC, "MORTAR_KINETIC" }, + { eImpactType::VEHICLEMINE_KINETIC, "VEHICLEMINE_KINETIC" }, + { eImpactType::VEHICLEMINE_EMP, "VEHICLEMINE_EMP" }, + { eImpactType::VEHICLEMINE_SPIKE, "VEHICLEMINE_SPIKE" }, + { eImpactType::VEHICLEMINE_SLICK, "VEHICLEMINE_SLICK" }, + { eImpactType::VEHICLEMINE_TAR, "VEHICLEMINE_TAR" }, + { eImpactType::SCRIPT_DRONE, "SCRIPT_DRONE" }, + { eImpactType::RAYGUN, "RAYGUN" }, + { eImpactType::BURIEDMINE, "BURIEDMINE" }, + { eImpactType::SCRIPT_MISSILE, "SCRIPT_MISSILE" }, + { eImpactType::RCTANK_ROCKET, "RCTANK_ROCKET" }, + { eImpactType::BOMB_WATER, "BOMB_WATER" }, + { eImpactType::BOMB_WATER_SECONDARY, "BOMB_WATER_SECONDARY" }, + { eImpactType::EXTINGUISHER_2, "EXTINGUISHER_2" }, + { eImpactType::EXTINGUISHER_3, "EXTINGUISHER_3" }, + { eImpactType::EXTINGUISHER_4, "EXTINGUISHER_4" }, + { eImpactType::EXTINGUISHER_5, "EXTINGUISHER_5" }, + { eImpactType::EXTINGUISHER_6, "EXTINGUISHER_6" }, + { eImpactType::SCRIPT_MISSILE_LARGE, "SCRIPT_MISSILE_LARGE" }, + { eImpactType::SUBMARINE_BIG, "SUBMARINE_BIG" }, + { eImpactType::EMPLAUNCHER_EMP, "EMPLAUNCHER_EMP" }, + { eImpactType::SPOOF_EXPLOSION, "SPOOF_EXPLOSION" } +}; \ No newline at end of file diff --git a/BigBaseV2/src/core/globals.hpp b/BigBaseV2/src/core/globals.hpp index ba60aaa2..a74b8965 100644 --- a/BigBaseV2/src/core/globals.hpp +++ b/BigBaseV2/src/core/globals.hpp @@ -1,5 +1,6 @@ #pragma once #include "CAmmoInfo.hpp" +#include "CWeaponInfo.hpp" #include "enums.hpp" #include "file_manager.hpp" #include "imgui.h" @@ -244,6 +245,7 @@ namespace big { bool toggle = false; eAmmoSpecialType type = eAmmoSpecialType::None; + eImpactType impactType = eImpactType::DEFAULT_BULLETS; } ammo_special; CustomWeapon custom_weapon = CustomWeapon::NONE; diff --git a/BigBaseV2/src/views/self/view_weapons.cpp b/BigBaseV2/src/views/self/view_weapons.cpp index f56adc42..95c774d4 100644 --- a/BigBaseV2/src/views/self/view_weapons.cpp +++ b/BigBaseV2/src/views/self/view_weapons.cpp @@ -3,6 +3,7 @@ #include "natives.hpp" #include "gta/Weapons.h" #include "core/data/special_ammo_types.hpp" +#include "core/data/bullet_impact_types.hpp" #include "views/view.hpp" namespace big @@ -18,6 +19,7 @@ namespace big ImGui::Checkbox("Enable Special Ammo", &g->weapons.ammo_special.toggle); eAmmoSpecialType selected_ammo = g->weapons.ammo_special.type; + eImpactType selected_impact = g->weapons.ammo_special.impactType; if (ImGui::BeginCombo("Special Ammo", SPECIAL_AMMOS[(int)selected_ammo].name)) { @@ -33,6 +35,20 @@ namespace big ImGui::EndCombo(); } + if (ImGui::BeginCombo("Bullet Impact", BULLET_IMPACTS[selected_impact])) + { + for (const auto& [type, name] : BULLET_IMPACTS) + { + if (ImGui::Selectable(name, type == selected_impact)) + g->weapons.ammo_special.impactType = type; + + if (type == selected_impact) + ImGui::SetItemDefaultFocus(); + } + + ImGui::EndCombo(); + } + ImGui::Separator(); components::small_text("Misc");