eImpactType -> eExplosionTag (#462)

This commit is contained in:
Quentin E. / iDeath 2022-09-30 22:38:56 +02:00 committed by GitHub
parent 0e2e142c32
commit 0b6eb27bf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1798 additions and 1878 deletions

View File

@ -2,10 +2,10 @@
namespace big namespace big
{ {
static CWeaponInfo* pModifiedWeapon = nullptr; static CWeaponInfo* p_modified_weapon = nullptr;
static eDamageType modifiedWeaponDamageType = eDamageType::None; static eDamageType modified_weapon_damage_type = eDamageType::None;
static eImpactType modifiedWeaponImpactType = eImpactType::DEFAULT_BULLETS; static CWeaponInfo::sExplosion modified_weapon_explosion{};
static eAmmoSpecialType modifiedWeaponAmmoType = eAmmoSpecialType::None; static eAmmoSpecialType modified_weapon_ammo_type = eAmmoSpecialType::None;
void looped::weapons_ammo_special_type() void looped::weapons_ammo_special_type()
{ {
@ -14,53 +14,63 @@ namespace big
g_local_player->m_weapon_manager == 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 == 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; return;
} }
if (g->weapons.ammo_special.toggle) { if (g->weapons.ammo_special.toggle) {
CWeaponInfo* pWeapon = g_local_player->m_weapon_manager->m_weapon_info; CWeaponInfo* weapon_info = g_local_player->m_weapon_manager->m_weapon_info;
// check if the player changed their weapon // check if the player changed their weapon
if (pModifiedWeapon != pWeapon) { if (p_modified_weapon != weapon_info) {
// apply the original bullet and impact type to the old weapon // apply the original bullet and impact type to the old weapon
if (pModifiedWeapon != nullptr) { if (p_modified_weapon != nullptr) {
pModifiedWeapon->m_damage_type = modifiedWeaponDamageType; p_modified_weapon->m_damage_type = modified_weapon_damage_type;
pModifiedWeapon->m_impact_type = modifiedWeaponImpactType; p_modified_weapon->m_explosion = modified_weapon_explosion;
pModifiedWeapon->m_ammo_info->m_ammo_special_type = modifiedWeaponAmmoType; p_modified_weapon->m_ammo_info->m_ammo_special_type = modified_weapon_ammo_type;
} }
// backup the bullet and impact type of the new weapon // backup the bullet and impact type of the new weapon
pModifiedWeapon = pWeapon; p_modified_weapon = weapon_info;
modifiedWeaponDamageType = pWeapon->m_damage_type; modified_weapon_damage_type = weapon_info->m_damage_type;
modifiedWeaponImpactType = pWeapon->m_impact_type; modified_weapon_explosion = weapon_info->m_explosion;
modifiedWeaponAmmoType = pWeapon->m_ammo_info->m_ammo_special_type; modified_weapon_ammo_type = weapon_info->m_ammo_info->m_ammo_special_type;
} }
// apply ammo type changes to the current weapon // apply ammo type changes to the current weapon
eDamageType damageType = eDamageType::None; eDamageType damage_type = eDamageType::None;
eImpactType impactType = g->weapons.ammo_special.impactType; eExplosionTag explosion_tag = g->weapons.ammo_special.explosion_tag;
eAmmoSpecialType ammoType = eAmmoSpecialType::None; eAmmoSpecialType ammo_type = eAmmoSpecialType::None;
if (impactType == eImpactType::DEFAULT_BULLETS) { if (explosion_tag == eExplosionTag::DONTCARE) {
damageType = modifiedWeaponDamageType; damage_type = modified_weapon_damage_type;
ammoType = g->weapons.ammo_special.type; ammo_type = g->weapons.ammo_special.type;
} }
else { else {
damageType = eDamageType::Explosive; damage_type = eDamageType::Explosive;
ammoType = modifiedWeaponAmmoType; ammo_type = modified_weapon_ammo_type;
} }
pWeapon->m_damage_type = damageType; weapon_info->m_damage_type = damage_type;
pWeapon->m_impact_type = impactType;
pWeapon->m_ammo_info->m_ammo_special_type = ammoType; CWeaponInfo::sExplosion explosion;
} else if (pModifiedWeapon != nullptr) { explosion.m_default = explosion_tag;
explosion.m_hit_bike = explosion_tag;
explosion.m_hit_boat = explosion_tag;
explosion.m_hit_car = explosion_tag;
explosion.m_hit_plane = explosion_tag;
explosion.m_hit_truck = explosion_tag;
weapon_info->m_explosion = explosion;
weapon_info->m_ammo_info->m_ammo_special_type = ammo_type;
}
else if (p_modified_weapon != nullptr) {
// apply the original bullet and impact type to the weapon // apply the original bullet and impact type to the weapon
// when the ammo type feature is off // when the ammo type feature is off
pModifiedWeapon->m_damage_type = modifiedWeaponDamageType; p_modified_weapon->m_damage_type = modified_weapon_damage_type;
pModifiedWeapon->m_impact_type = modifiedWeaponImpactType; p_modified_weapon->m_explosion = modified_weapon_explosion;
pModifiedWeapon->m_ammo_info->m_ammo_special_type = modifiedWeaponAmmoType; p_modified_weapon->m_ammo_info->m_ammo_special_type = modified_weapon_ammo_type;
pModifiedWeapon = nullptr; p_modified_weapon = nullptr;
} }
} }
} }

View File

@ -1,90 +1,89 @@
#pragma once #pragma once
std::map<eImpactType, const char*> BULLET_IMPACTS = { std::map<eExplosionTag, const char*> BULLET_IMPACTS = {
{ eImpactType::DEFAULT_BULLETS, "DEFAULT_BULLETS" }, { eExplosionTag::DONTCARE, "DEFAULT_BULLETS" },
{ eImpactType::GRENADE, "GRENADE" }, { eExplosionTag::GRENADE, "GRENADE" },
{ eImpactType::GRENADELAUNCHER, "GRENADELAUNCHER" }, { eExplosionTag::GRENADELAUNCHER, "GRENADELAUNCHER" },
{ eImpactType::STICKYBOMB, "STICKYBOMB" }, { eExplosionTag::STICKYBOMB, "STICKYBOMB" },
{ eImpactType::MOLOTOV, "MOLOTOV" }, { eExplosionTag::MOLOTOV, "MOLOTOV" },
{ eImpactType::ROCKET, "ROCKET" }, { eExplosionTag::ROCKET, "ROCKET" },
{ eImpactType::TANKSHELL, "TANKSHELL" }, { eExplosionTag::TANKSHELL, "TANKSHELL" },
{ eImpactType::HI_OCTANE, "HI_OCTANE" }, { eExplosionTag::HI_OCTANE, "HI_OCTANE" },
{ eImpactType::CAR, "CAR" }, { eExplosionTag::CAR, "CAR" },
{ eImpactType::PLANE, "PLANE" }, { eExplosionTag::PLANE, "PLANE" },
{ eImpactType::PETROL_PUMP, "PETROL_PUMP" }, { eExplosionTag::PETROL_PUMP, "PETROL_PUMP" },
{ eImpactType::BIKE, "BIKE" }, { eExplosionTag::BIKE, "BIKE" },
{ eImpactType::DIR_STEAM, "DIR_STEAM" }, { eExplosionTag::DIR_STEAM, "DIR_STEAM" },
{ eImpactType::DIR_FLAME, "DIR_FLAME" }, { eExplosionTag::DIR_FLAME, "DIR_FLAME" },
{ eImpactType::DIR_WATER_HYDRANT, "DIR_WATER_HYDRANT" }, { eExplosionTag::DIR_WATER_HYDRANT, "DIR_WATER_HYDRANT" },
{ eImpactType::DIR_GAS_CANISTER, "DIR_GAS_CANISTER" }, { eExplosionTag::DIR_GAS_CANISTER, "DIR_GAS_CANISTER" },
{ eImpactType::BOAT, "BOAT" }, { eExplosionTag::BOAT, "BOAT" },
{ eImpactType::SHIP_DESTROY, "SHIP_DESTROY" }, { eExplosionTag::SHIP_DESTROY, "SHIP_DESTROY" },
{ eImpactType::TRUCK, "TRUCK" }, { eExplosionTag::TRUCK, "TRUCK" },
{ eImpactType::MK2_EXPLOSIVE_BULLETS, "MK2_EXPLOSIVE_BULLETS" }, { eExplosionTag::BULLET, "MK2_EXPLOSIVE_BULLETS" },
{ eImpactType::SMOKEGRENADELAUNCHER, "SMOKEGRENADELAUNCHER" }, { eExplosionTag::SMOKEGRENADELAUNCHER, "SMOKEGRENADELAUNCHER" },
{ eImpactType::SMOKEGRENADE, "SMOKEGRENADE" }, { eExplosionTag::SMOKEGRENADE, "SMOKEGRENADE" },
{ eImpactType::BZGAS, "BZGAS" }, { eExplosionTag::BZGAS, "BZGAS" },
{ eImpactType::FLARE, "FLARE" }, { eExplosionTag::FLARE, "FLARE" },
{ eImpactType::GAS_CANISTER, "GAS_CANISTER" }, { eExplosionTag::GAS_CANISTER, "GAS_CANISTER" },
{ eImpactType::EXTINGUISHER, "EXTINGUISHER_1" }, { eExplosionTag::EXTINGUISHER, "EXTINGUISHER_1" },
{ eImpactType::PROGRAMMABLEAR, "PROGRAMMABLEAR" }, { eExplosionTag::_0x988620B8, "PROGRAMMABLEAR" },
{ eImpactType::TRAIN, "TRAIN" }, { eExplosionTag::EXP_TAG_TRAIN, "TRAIN" },
{ eImpactType::BARREL, "BARREL" }, { eExplosionTag::EXP_TAG_BARREL, "BARREL" },
{ eImpactType::PROPANE, "PROPANE" }, { eExplosionTag::EXP_TAG_PROPANE, "PROPANE" },
{ eImpactType::BLIMP, "BLIMP" }, { eExplosionTag::EXP_TAG_BLIMP, "BLIMP" },
{ eImpactType::DIR_FLAME_EXPLODE, "DIR_FLAME_EXPLODE" }, { eExplosionTag::EXP_TAG_DIR_FLAME_EXPLODE, "DIR_FLAME_EXPLODE" },
{ eImpactType::TANKER, "TANKER" }, { eExplosionTag::EXP_TAG_TANKER, "TANKER" },
{ eImpactType::PLANE_ROCKET, "PLANE_ROCKET" }, { eExplosionTag::PLANE_ROCKET, "PLANE_ROCKET" },
{ eImpactType::VEHICLE_BULLET, "VEHICLE_BULLET" }, { eExplosionTag::EXP_TAG_VEHICLE_BULLET, "VEHICLE_BULLET" },
{ eImpactType::GAS_TANK, "GAS_TANK" }, { eExplosionTag::EXP_TAG_GAS_TANK, "GAS_TANK" },
{ eImpactType::BIRD_CRAP, "BIRD_CRAP" }, { eExplosionTag::EXP_TAG_BIRD_CRAP, "BIRD_CRAP" },
{ eImpactType::RAILGUN, "RAILGUN" }, { eExplosionTag::EXP_TAG_RAILGUN, "RAILGUN" },
{ eImpactType::BLIMP2, "BLIMP2" }, { eExplosionTag::EXP_TAG_BLIMP2, "BLIMP2" },
{ eImpactType::FIREWORK, "FIREWORK" }, { eExplosionTag::EXP_TAG_FIREWORK, "FIREWORK" },
{ eImpactType::SNOWBALL, "SNOWBALL" }, { eExplosionTag::EXP_TAG_SNOWBALL, "SNOWBALL" },
{ eImpactType::PROXMINE, "PROXMINE" }, { eExplosionTag::EXP_TAG_PROXMINE, "PROXMINE" },
{ eImpactType::VALKYRIE_CANNON, "VALKYRIE_CANNON" }, { eExplosionTag::EXP_TAG_VALKYRIE_CANNON, "VALKYRIE_CANNON" },
{ eImpactType::AIR_DEFENCE, "AIR_DEFENCE" }, { eExplosionTag::EXP_TAG_AIR_DEFENCE, "AIR_DEFENCE" },
{ eImpactType::PIPEBOMB, "PIPEBOMB" }, { eExplosionTag::EXP_TAG_PIPEBOMB, "PIPEBOMB" },
{ eImpactType::VEHICLEMINE, "VEHICLEMINE" }, { eExplosionTag::EXP_TAG_VEHICLEMINE, "VEHICLEMINE" },
{ eImpactType::EXPLOSIVEAMMO, "EXPLOSIVEAMMO" }, { eExplosionTag::EXP_TAG_EXPLOSIVEAMMO, "EXPLOSIVEAMMO" },
{ eImpactType::APCSHELL, "APCSHELL" }, { eExplosionTag::EXP_TAG_APCSHELL, "APCSHELL" },
{ eImpactType::BOMB_CLUSTER, "BOMB_CLUSTER" }, { eExplosionTag::EXP_TAG_BOMB_CLUSTER, "BOMB_CLUSTER" },
{ eImpactType::BOMB_GAS, "BOMB_GAS" }, { eExplosionTag::EXP_TAG_BOMB_GAS, "BOMB_GAS" },
{ eImpactType::BOMB_INCENDIARY, "BOMB_INCENDIARY" }, { eExplosionTag::EXP_TAG_BOMB_INCENDIARY, "BOMB_INCENDIARY" },
{ eImpactType::BOMB_STANDARD, "BOMB_STANDARD" }, { eExplosionTag::EXP_TAG_BOMB_STANDARD, "BOMB_STANDARD" },
{ eImpactType::TORPEDO, "TORPEDO" }, { eExplosionTag::EXP_TAG_TORPEDO, "TORPEDO" },
{ eImpactType::TORPEDO_UNDERWATER, "TORPEDO_UNDERWATER" }, { eExplosionTag::EXP_TAG_TORPEDO_UNDERWATER, "TORPEDO_UNDERWATER" },
{ eImpactType::BOMBUSHKA_CANNON, "BOMBUSHKA_CANNON" }, { eExplosionTag::EXP_TAG_BOMBUSHKA_CANNON, "BOMBUSHKA_CANNON" },
{ eImpactType::BOMB_CLUSTER_SECONDARY, "BOMB_CLUSTER_SECONDARY" }, { eExplosionTag::EXP_TAG_BOMB_CLUSTER_SECONDARY, "BOMB_CLUSTER_SECONDARY" },
{ eImpactType::HUNTER_BARRAGE, "HUNTER_BARRAGE" }, { eExplosionTag::EXP_TAG_HUNTER_BARRAGE, "HUNTER_BARRAGE" },
{ eImpactType::HUNTER_CANNON, "HUNTER_CANNON" }, { eExplosionTag::EXP_TAG_HUNTER_CANNON, "HUNTER_CANNON" },
{ eImpactType::ROGUE_CANNON, "ROGUE_CANNON" }, { eExplosionTag::EXP_TAG_ROGUE_CANNON, "ROGUE_CANNON" },
{ eImpactType::MINE_UNDERWATER, "MINE_UNDERWATER" }, { eExplosionTag::EXP_TAG_MINE_UNDERWATER, "MINE_UNDERWATER" },
{ eImpactType::ORBITAL_CANNON, "ORBITAL_CANNON" }, { eExplosionTag::EXP_TAG_ORBITAL_CANNON, "ORBITAL_CANNON" },
{ eImpactType::BOMB_STANDARD_WIDE, "BOMB_STANDARD_WIDE" }, { eExplosionTag::EXP_TAG_BOMB_STANDARD_WIDE, "BOMB_STANDARD_WIDE" },
{ eImpactType::EXPLOSIVEAMMO_SHOTGUN, "EXPLOSIVEAMMO_SHOTGUN" }, { eExplosionTag::EXP_TAG_EXPLOSIVEAMMO_SHOTGUN, "EXPLOSIVEAMMO_SHOTGUN" },
{ eImpactType::OPPRESSOR2_CANNON, "OPPRESSOR2_CANNON" }, { eExplosionTag::EXP_TAG_OPPRESSOR2_CANNON, "OPPRESSOR2_CANNON" },
{ eImpactType::MORTAR_KINETIC, "MORTAR_KINETIC" }, { eExplosionTag::EXP_TAG_MORTAR_KINETIC, "MORTAR_KINETIC" },
{ eImpactType::VEHICLEMINE_KINETIC, "VEHICLEMINE_KINETIC" }, { eExplosionTag::EXP_TAG_VEHICLEMINE_KINETIC, "VEHICLEMINE_KINETIC" },
{ eImpactType::VEHICLEMINE_EMP, "VEHICLEMINE_EMP" }, { eExplosionTag::EXP_TAG_VEHICLEMINE_EMP, "VEHICLEMINE_EMP" },
{ eImpactType::VEHICLEMINE_SPIKE, "VEHICLEMINE_SPIKE" }, { eExplosionTag::EXP_TAG_VEHICLEMINE_SPIKE, "VEHICLEMINE_SPIKE" },
{ eImpactType::VEHICLEMINE_SLICK, "VEHICLEMINE_SLICK" }, { eExplosionTag::EXP_TAG_VEHICLEMINE_SLICK, "VEHICLEMINE_SLICK" },
{ eImpactType::VEHICLEMINE_TAR, "VEHICLEMINE_TAR" }, { eExplosionTag::EXP_TAG_VEHICLEMINE_TAR, "VEHICLEMINE_TAR" },
{ eImpactType::SCRIPT_DRONE, "SCRIPT_DRONE" }, { eExplosionTag::EXP_TAG_SCRIPT_DRONE, "SCRIPT_DRONE" },
{ eImpactType::RAYGUN, "RAYGUN" }, { eExplosionTag::EXP_TAG_RAYGUN, "RAYGUN" },
{ eImpactType::BURIEDMINE, "BURIEDMINE" }, { eExplosionTag::EXP_TAG_BURIEDMINE, "BURIEDMINE" },
{ eImpactType::SCRIPT_MISSILE, "SCRIPT_MISSILE" }, { eExplosionTag::EXP_TAG_SCRIPT_MISSILE, "SCRIPT_MISSILE" },
{ eImpactType::RCTANK_ROCKET, "RCTANK_ROCKET" }, { eExplosionTag::EXP_TAG_RCTANK_ROCKET, "RCTANK_ROCKET" },
{ eImpactType::BOMB_WATER, "BOMB_WATER" }, { eExplosionTag::EXP_TAG_BOMB_WATER, "BOMB_WATER" },
{ eImpactType::BOMB_WATER_SECONDARY, "BOMB_WATER_SECONDARY" }, { eExplosionTag::EXP_TAG_BOMB_WATER_SECONDARY, "BOMB_WATER_SECONDARY" },
{ eImpactType::UNK76, "UNK76" }, { eExplosionTag::_0xF728C4A9, "_0xF728C4A9" },
{ eImpactType::UNK77, "UNK77" }, { eExplosionTag::_0xBAEC056F, "_0xBAEC056F" },
{ eImpactType::FLASH_GRENADE, "FLASH_GRENADE" }, { eExplosionTag::EXP_TAG_FLASHGRENADE, "FLASH_GRENADE" },
{ eImpactType::STUN_GRENADE, "STUN_GRENADE" }, { eExplosionTag::EXP_TAG_STUNGRENADE, "STUN_GRENADE" },
{ eImpactType::Unk80, "UNK80" }, { eExplosionTag::_0x763D3B3B, "_0x763D3B3B" },
{ eImpactType::SCRIPT_MISSILE_LARGE, "SCRIPT_MISSILE_LARGE" }, { eExplosionTag::EXP_TAG_SCRIPT_MISSILE_LARGE, "SCRIPT_MISSILE_LARGE" },
{ eImpactType::SUBMARINE_BIG, "SUBMARINE_BIG" }, { eExplosionTag::EXP_TAG_SUBMARINE_BIG, "SUBMARINE_BIG" },
{ eImpactType::EMPLAUNCHER_EMP, "EMPLAUNCHER_EMP" }, { eExplosionTag::EXP_TAG_EMPLAUNCHER_EMP, "EMPLAUNCHER_EMP" },
{ eImpactType::SPOOF_EXPLOSION, "SPOOF_EXPLOSION" } };
};

View File

@ -269,7 +269,7 @@ namespace big
{ {
bool toggle = false; bool toggle = false;
eAmmoSpecialType type = eAmmoSpecialType::None; eAmmoSpecialType type = eAmmoSpecialType::None;
eImpactType impactType = eImpactType::DEFAULT_BULLETS; eExplosionTag explosion_tag = eExplosionTag::DONTCARE;
} ammo_special; } ammo_special;
CustomWeapon custom_weapon = CustomWeapon::NONE; CustomWeapon custom_weapon = CustomWeapon::NONE;

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@ namespace big
ImGui::Checkbox("Enable Special Ammo", &g->weapons.ammo_special.toggle); ImGui::Checkbox("Enable Special Ammo", &g->weapons.ammo_special.toggle);
eAmmoSpecialType selected_ammo = g->weapons.ammo_special.type; eAmmoSpecialType selected_ammo = g->weapons.ammo_special.type;
eImpactType selected_impact = g->weapons.ammo_special.impactType; eExplosionTag selected_explosion = g->weapons.ammo_special.explosion_tag;
if (ImGui::BeginCombo("Special Ammo", SPECIAL_AMMOS[(int)selected_ammo].name)) if (ImGui::BeginCombo("Special Ammo", SPECIAL_AMMOS[(int)selected_ammo].name))
{ {
@ -40,16 +40,16 @@ namespace big
ImGui::EndCombo(); ImGui::EndCombo();
} }
if (ImGui::BeginCombo("Bullet Impact", BULLET_IMPACTS[selected_impact])) if (ImGui::BeginCombo("Bullet Impact", BULLET_IMPACTS[selected_explosion]))
{ {
for (const auto& [type, name] : BULLET_IMPACTS) for (const auto& [type, name] : BULLET_IMPACTS)
{ {
if (ImGui::Selectable(name, type == selected_impact)) if (ImGui::Selectable(name, type == selected_explosion))
{ {
g->weapons.ammo_special.impactType = type; g->weapons.ammo_special.explosion_tag = type;
} }
if (type == selected_impact) if (type == selected_explosion)
{ {
ImGui::SetItemDefaultFocus(); ImGui::SetItemDefaultFocus();
} }
@ -80,7 +80,7 @@ namespace big
constexpr auto parachute_hash = RAGE_JOAAT("GADGET_PARACHUTE"); constexpr auto parachute_hash = RAGE_JOAAT("GADGET_PARACHUTE");
WEAPON::GIVE_DELAYED_WEAPON_TO_PED(self::ped, parachute_hash, 0, true); WEAPON::GIVE_DELAYED_WEAPON_TO_PED(self::ped, parachute_hash, 0, true);
}); });
ImGui::SameLine(); ImGui::SameLine();
components::button("Remove Current Weapon", [] { components::button("Remove Current Weapon", [] {
Hash weaponHash; Hash weaponHash;
@ -89,7 +89,7 @@ namespace big
{ {
WEAPON::REMOVE_WEAPON_FROM_PED(self::ped, weaponHash); WEAPON::REMOVE_WEAPON_FROM_PED(self::ped, weaponHash);
} }
}); });
ImGui::SliderFloat("Damage Multiplier", &g->weapons.increased_damage, 1.f, 10.f, "%.1f"); ImGui::SliderFloat("Damage Multiplier", &g->weapons.increased_damage, 1.f, 10.f, "%.1f");

2
vendor/GTAV-Classes vendored

@ -1 +1 @@
Subproject commit 87dadd8f5d7d73d46aa28e574c9ee44934a9a6a7 Subproject commit 268dc5d523ab539bfc93b19da5d4be47ead1bd49