2021-05-19 18:11:19 +02:00
# include "core/data/speedo_meters.hpp"
2021-05-21 14:09:28 +02:00
# include "fiber_pool.hpp"
2021-07-23 23:00:11 +02:00
# include "main_tabs.hpp"
2021-05-21 14:09:28 +02:00
# include "script.hpp"
# include "util/blip.hpp"
# include "util/entity.hpp"
# include "util/notify.hpp"
# include "util/vehicle.hpp"
2021-05-19 18:11:19 +02:00
namespace big
{
static char model [ 12 ] ;
void tab_main : : tab_vehicle ( )
{
if ( ImGui : : BeginTabItem ( " Vehicle " ) )
{
2021-07-25 22:24:48 +02:00
if ( ImGui : : TreeNode ( " General " ) )
2021-05-21 14:09:28 +02:00
{
2021-07-25 22:24:48 +02:00
if ( ImGui : : Button ( " Bring Personal Vehicle " ) )
2021-05-21 14:09:28 +02:00
{
2021-07-25 22:24:48 +02:00
QUEUE_JOB_BEGIN_CLAUSE ( )
{
Vector3 location ;
2021-05-21 14:09:28 +02:00
2021-08-10 23:11:45 +02:00
if ( ! blip : : get_blip_location ( location , 225 , 0 ) & & ! blip : : get_blip_location ( location , 226 , 0 ) ) return notify : : above_map ( " No personal vehicle found, was it destroyed? " ) ;
Vehicle veh = vehicle : : get_closest_to_location ( location , 2.f ) ;
2021-07-25 22:24:48 +02:00
if ( veh = = 0 ) return notify : : above_map ( " Invalid vehicle handle... " ) ;
2021-05-21 14:09:28 +02:00
2021-07-25 22:24:48 +02:00
location = ENTITY : : GET_ENTITY_COORDS ( PLAYER : : PLAYER_PED_ID ( ) , true ) ;
2021-05-21 14:09:28 +02:00
2021-07-25 22:24:48 +02:00
vehicle : : bring ( veh , location ) ;
} QUEUE_JOB_END_CLAUSE
}
2021-05-21 14:09:28 +02:00
2021-07-25 22:24:48 +02:00
if ( ImGui : : Button ( " Repair " ) )
2021-07-23 11:59:53 +02:00
{
2021-07-25 22:24:48 +02:00
QUEUE_JOB_BEGIN_CLAUSE ( )
{
Vehicle veh = PED : : GET_VEHICLE_PED_IS_IN ( PLAYER : : PLAYER_PED_ID ( ) , false ) ;
2021-07-23 11:59:53 +02:00
2021-07-25 22:24:48 +02:00
vehicle : : repair ( veh ) ;
} QUEUE_JOB_END_CLAUSE
}
2021-08-10 23:11:45 +02:00
ImGui : : SameLine ( ) ;
2021-07-25 22:24:48 +02:00
if ( ImGui : : Button ( " Handling " ) )
g . window . handling = true ;
ImGui : : TreePop ( ) ;
2021-07-23 11:59:53 +02:00
}
2021-05-19 18:11:19 +02:00
if ( ImGui : : TreeNode ( " Speedo Meter " ) )
{
2021-08-03 20:29:54 +02:00
SpeedoMeter selected = g . vehicle . speedo_meter . type ;
2021-05-19 18:11:19 +02:00
2021-08-03 20:29:54 +02:00
ImGui : : Text ( " Position " ) ;
float pos [ 2 ] ;
pos [ 0 ] = g . vehicle . speedo_meter . x ;
pos [ 1 ] = g . vehicle . speedo_meter . y ;
if ( ImGui : : SliderFloat2 ( " ###speedo_pos " , pos , .001f , .999f , " %.3f " ) )
{
g . vehicle . speedo_meter . x = pos [ 0 ] ;
g . vehicle . speedo_meter . y = pos [ 1 ] ;
}
ImGui : : Checkbox ( " Left Sided " , & g . vehicle . speedo_meter . left_side ) ;
ImGui : : Separator ( ) ;
ImGui : : Text ( " Type: " ) ;
2021-07-23 11:59:53 +02:00
if ( ImGui : : BeginCombo ( " ###speedo_type " , speedo_meters [ ( int ) selected ] . name ) )
2021-05-19 18:11:19 +02:00
{
2021-07-23 11:59:53 +02:00
for ( const speedo_meter & speedo : speedo_meters )
2021-05-19 18:11:19 +02:00
{
if ( ImGui : : Selectable ( speedo . name , speedo . id = = selected ) )
{
2021-08-03 20:29:54 +02:00
g . vehicle . speedo_meter . type = speedo . id ;
2021-05-19 18:11:19 +02:00
}
if ( speedo . id = = selected )
ImGui : : SetItemDefaultFocus ( ) ;
}
ImGui : : EndCombo ( ) ;
}
ImGui : : TreePop ( ) ;
}
2021-05-20 23:18:44 +02:00
ImGui : : Checkbox ( " Horn Boost " , & g . vehicle . horn_boost ) ;
2021-05-19 18:11:19 +02:00
ImGui : : EndTabItem ( ) ;
}
}
}