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
{
static CWeaponInfo* pModifiedWeapon = nullptr;
static eDamageType modifiedWeaponDamageType = eDamageType::None;
static eImpactType modifiedWeaponImpactType = eImpactType::DEFAULT_BULLETS;
static eAmmoSpecialType modifiedWeaponAmmoType = eAmmoSpecialType::None;
static CWeaponInfo* p_modified_weapon = nullptr;
static eDamageType modified_weapon_damage_type = eDamageType::None;
static CWeaponInfo::sExplosion modified_weapon_explosion{};
static eAmmoSpecialType modified_weapon_ammo_type = eAmmoSpecialType::None;
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->m_weapon_info == nullptr ||
g_local_player->m_weapon_manager->m_weapon_info->m_ammo_info == nullptr
) {
) {
return;
}
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
if (pModifiedWeapon != pWeapon) {
if (p_modified_weapon != weapon_info) {
// 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;
if (p_modified_weapon != nullptr) {
p_modified_weapon->m_damage_type = modified_weapon_damage_type;
p_modified_weapon->m_explosion = modified_weapon_explosion;
p_modified_weapon->m_ammo_info->m_ammo_special_type = modified_weapon_ammo_type;
}
// 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;
p_modified_weapon = weapon_info;
modified_weapon_damage_type = weapon_info->m_damage_type;
modified_weapon_explosion = weapon_info->m_explosion;
modified_weapon_ammo_type = weapon_info->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;
eDamageType damage_type = eDamageType::None;
eExplosionTag explosion_tag = g->weapons.ammo_special.explosion_tag;
eAmmoSpecialType ammo_type = eAmmoSpecialType::None;
if (impactType == eImpactType::DEFAULT_BULLETS) {
damageType = modifiedWeaponDamageType;
ammoType = g->weapons.ammo_special.type;
if (explosion_tag == eExplosionTag::DONTCARE) {
damage_type = modified_weapon_damage_type;
ammo_type = g->weapons.ammo_special.type;
}
else {
damageType = eDamageType::Explosive;
ammoType = modifiedWeaponAmmoType;
damage_type = eDamageType::Explosive;
ammo_type = modified_weapon_ammo_type;
}
pWeapon->m_damage_type = damageType;
pWeapon->m_impact_type = impactType;
pWeapon->m_ammo_info->m_ammo_special_type = ammoType;
} else if (pModifiedWeapon != nullptr) {
weapon_info->m_damage_type = damage_type;
CWeaponInfo::sExplosion explosion;
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
// 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;
p_modified_weapon->m_damage_type = modified_weapon_damage_type;
p_modified_weapon->m_explosion = modified_weapon_explosion;
p_modified_weapon->m_ammo_info->m_ammo_special_type = modified_weapon_ammo_type;
p_modified_weapon = nullptr;
}
}
}
}

View File

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

View File

@ -269,7 +269,7 @@ namespace big
{
bool toggle = false;
eAmmoSpecialType type = eAmmoSpecialType::None;
eImpactType impactType = eImpactType::DEFAULT_BULLETS;
eExplosionTag explosion_tag = eExplosionTag::DONTCARE;
} ammo_special;
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);
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))
{
@ -40,16 +40,16 @@ namespace big
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)
{
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();
}
@ -80,7 +80,7 @@ namespace big
constexpr auto parachute_hash = RAGE_JOAAT("GADGET_PARACHUTE");
WEAPON::GIVE_DELAYED_WEAPON_TO_PED(self::ped, parachute_hash, 0, true);
});
});
ImGui::SameLine();
components::button("Remove Current Weapon", [] {
Hash weaponHash;
@ -89,7 +89,7 @@ namespace big
{
WEAPON::REMOVE_WEAPON_FROM_PED(self::ped, weaponHash);
}
});
});
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