2023-07-16 12:24:40 -04:00
# include "backend/looped/looped.hpp"
# include "util/vehicle.hpp"
# include <vehicle/CVehicleModelInfo.hpp>
# include <vehicle/CVehicleSeatMetadataMgr.hpp>
# include <vehicle/CVehicleDriveByMetadataMgr.hpp>
2023-12-19 11:15:52 -05:00
# include <vehicle/CGetPedSeatReturnClass.hpp>
2023-07-16 12:24:40 -04:00
# include "gta/weapons.hpp"
namespace big
{
void looped : : vehicle_allow_all_weapons ( )
{
2023-12-19 11:15:52 -05:00
if ( self : : veh = = 0 | | g_local_player = = nullptr )
2023-07-16 12:24:40 -04:00
return ;
2023-12-19 11:15:52 -05:00
auto seat_info = g_pointers - > m_gta . m_get_ped_seat ( g_local_player - > m_seat_info , g_local_player ) ;
if ( seat_info = = nullptr )
return ;
2023-07-16 12:24:40 -04:00
if ( g . vehicle . unlimited_weapons = = false )
{
2023-12-19 11:15:52 -05:00
if ( seat_info - > anim_info )
2023-07-16 12:24:40 -04:00
{
2023-12-19 11:15:52 -05:00
for ( auto drive_by_anim_info : seat_info - > anim_info - > m_drive_by_anim_infos )
{
if ( drive_by_anim_info - > m_weapon_groups - > m_groups . size ( ) = = 7 & & drive_by_anim_info - > m_weapon_groups - > m_groups . contains ( GROUP_PISTOL ) )
{
drive_by_anim_info - > m_weapon_groups - > m_groups . clear ( ) ;
drive_by_anim_info - > m_weapon_groups - > m_groups . append ( { GROUP_PISTOL } ) ;
}
}
2023-07-16 12:24:40 -04:00
}
return ;
}
2023-12-19 11:15:52 -05:00
if ( seat_info - > anim_info = = nullptr ) //Should only occur in the R-88 and similar formula cars, so assume the user is in the driver's seat. Fix later, if other edge cases occur.
{
seat_info - > anim_info = g_pointers - > m_gta . m_vehicle_layout_metadata_mgr - > m_drive_by_seat_defaults - > m_driveby_standard_front_left ;
}
2023-07-16 12:24:40 -04:00
2023-12-19 11:15:52 -05:00
for ( auto drive_by_anim_info : seat_info - > anim_info - > m_drive_by_anim_infos )
{
if ( drive_by_anim_info - > m_weapon_groups - > m_groups . size ( ) ! = 7 & & drive_by_anim_info - > m_weapon_groups - > m_groups . contains ( GROUP_PISTOL ) )
{
drive_by_anim_info - > m_weapon_groups - > m_groups . clear ( ) ;
drive_by_anim_info - > m_weapon_groups - > m_groups . append ( { GROUP_PISTOL , GROUP_MG , GROUP_RIFLE , GROUP_SHOTGUN , GROUP_HEAVY , GROUP_SNIPER , GROUP_SMG } ) ;
}
}
2023-07-16 12:24:40 -04:00
2023-12-19 11:15:52 -05:00
CVehicleModelInfo * vehicle_model_info = static_cast < CVehicleModelInfo * > ( g_local_player - > m_vehicle - > m_model_info ) ;
2023-12-13 17:43:18 -05:00
vehicle_model_info - > set_vehicle_model_flag ( CVehicleModelInfoFlags : : DRIVER_NO_DRIVE_BY , false ) ;
if ( PAD : : IS_CONTROL_PRESSED ( 0 , ( int ) ControllerInputs : : INPUT_AIM ) )
{
PAD : : DISABLE_CONTROL_ACTION ( 0 , ( int ) ControllerInputs : : INPUT_VEH_FLY_MOUSE_CONTROL_OVERRIDE , 1 ) ;
}
2023-07-16 12:24:40 -04:00
}
}