Removed errant waypoint icons in get_objective_location. (#3509)

This commit is contained in:
gir489 2024-08-03 12:19:43 -04:00 committed by GitHub
parent d93fb733ca
commit 0ea9fabf69
7 changed files with 1121 additions and 700 deletions

View File

@ -1,18 +1,18 @@
#include "backend/looped_command.hpp"
#include "natives.hpp"
#include "util/teleport.hpp"
namespace big
{
class auto_tp_to_waypoint : looped_command
{
using looped_command::looped_command;
virtual void on_tick() override
{
teleport::to_blip((int)BlipIcons::Waypoint);
}
};
auto_tp_to_waypoint g_auto_tp_to_waypoint("autotptowp", "BACKEND_LOOPED_AUTO_TP_TO_WAYPOINT", "BACKEND_LOOPED_AUTO_TP_TO_WAYPOINT_DESC", g.self.auto_tp);
}
#include "backend/looped_command.hpp"
#include "natives.hpp"
#include "util/teleport.hpp"
namespace big
{
class auto_tp_to_waypoint : looped_command
{
using looped_command::looped_command;
virtual void on_tick() override
{
teleport::to_blip((int)BlipIcons::RADAR_WAYPOINT);
}
};
auto_tp_to_waypoint g_auto_tp_to_waypoint("autotptowp", "BACKEND_LOOPED_AUTO_TP_TO_WAYPOINT", "BACKEND_LOOPED_AUTO_TP_TO_WAYPOINT_DESC", g.self.auto_tp);
}

View File

@ -1,109 +1,109 @@
#include "backend/looped/looped.hpp"
#include "gta/enums.hpp"
#include "natives.hpp"
#include "util/blip.hpp"
#include "util/entity.hpp"
#include "util/vehicle.hpp"
namespace big
{
void looped::vehicle_auto_drive()
{
static std::unordered_map<AutoDriveStyle, int> driving_style_flags = {{AutoDriveStyle::LAW_ABIDING, 443}, {AutoDriveStyle::THE_ROAD_IS_YOURS, 787004}};
static int changing_driving_styles = false;
static AutoDriveDestination current_destination = AutoDriveDestination::STOPPED;
static int current_driving_flag = driving_style_flags[AutoDriveStyle::LAW_ABIDING];
static float current_speed = 8;
static bool started = false;
static Vector3 waypoint;
if (g.vehicle.auto_drive_destination != AutoDriveDestination::STOPPED)
{
current_destination = g.vehicle.auto_drive_destination;
g.vehicle.auto_drive_destination = AutoDriveDestination::STOPPED;
changing_driving_styles = true;
}
if (!self::veh && current_destination != AutoDriveDestination::STOPPED)
{
current_destination = AutoDriveDestination::STOPPED;
changing_driving_styles = false;
g_notification_service.push_warning("AUTO_DRIVE"_T.data(), "PLAYER_INFO_NO_VEHICLE"_T.data());
}
else if (current_driving_flag != driving_style_flags[g.vehicle.auto_drive_style] || current_speed != g.vehicle.auto_drive_speed)
{
current_driving_flag = driving_style_flags[g.vehicle.auto_drive_style];
current_speed = g.vehicle.auto_drive_speed;
changing_driving_styles = true;
}
if (current_destination != AutoDriveDestination::STOPPED)
{
Vector3 last_waypoint = waypoint;
bool does_waypoint_exist = false;
bool to_waypoint = false;
if (current_destination == AutoDriveDestination::OBJECTITVE)
{
to_waypoint = true;
does_waypoint_exist = blip::get_objective_location(waypoint);
}
else if (current_destination == AutoDriveDestination::WAYPOINT)
{
to_waypoint = true;
does_waypoint_exist = blip::get_blip_location(waypoint, (int)BlipIcons::Waypoint);
}
if (does_waypoint_exist
&& (last_waypoint.x != waypoint.x || last_waypoint.y != waypoint.y || last_waypoint.z != waypoint.z))
{
changing_driving_styles = true;
}
bool interupted = (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_LEFT_ONLY) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_RIGHT_ONLY) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_ACCELERATE) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_BRAKE) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_EXIT) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HANDBRAKE));
if (current_destination == AutoDriveDestination::EMERGENCY_STOP || (to_waypoint && !does_waypoint_exist) || interupted)
{
TASK::CLEAR_PRIMARY_VEHICLE_TASK(self::veh);
TASK::CLEAR_PED_TASKS(self::ped);
if (!interupted && started)
{
VEHICLE::SET_VEHICLE_FORWARD_SPEED(self::veh, 0);
}
current_destination = AutoDriveDestination::STOPPED;
if (to_waypoint && !does_waypoint_exist)
{
g_notification_service.push_warning("AUTO_DRIVE"_T.data(), "TELEPORT_NO_WAYPOINT_SET"_T.data());
}
else
{
g_notification_service.push_warning("AUTO_DRIVE"_T.data(), "BACKEND_LOOPED_VEHICLE_AUTO_DRIVE_STOPPED"_T.data());
}
started = false;
}
else if (changing_driving_styles)
{
changing_driving_styles = false;
TASK::CLEAR_PRIMARY_VEHICLE_TASK(self::veh);
TASK::CLEAR_PED_TASKS(self::ped);
if (to_waypoint)
{
TASK::TASK_VEHICLE_DRIVE_TO_COORD_LONGRANGE(self::ped, self::veh, waypoint.x, waypoint.y, waypoint.z, current_speed, current_driving_flag, 20);
}
else
{
TASK::TASK_VEHICLE_DRIVE_WANDER(self::ped, self::veh, current_speed, current_driving_flag);
}
started = true;
}
}
}
}
#include "backend/looped/looped.hpp"
#include "gta/enums.hpp"
#include "natives.hpp"
#include "util/blip.hpp"
#include "util/entity.hpp"
#include "util/vehicle.hpp"
namespace big
{
void looped::vehicle_auto_drive()
{
static std::unordered_map<AutoDriveStyle, int> driving_style_flags = {{AutoDriveStyle::LAW_ABIDING, 443}, {AutoDriveStyle::THE_ROAD_IS_YOURS, 787004}};
static int changing_driving_styles = false;
static AutoDriveDestination current_destination = AutoDriveDestination::STOPPED;
static int current_driving_flag = driving_style_flags[AutoDriveStyle::LAW_ABIDING];
static float current_speed = 8;
static bool started = false;
static Vector3 waypoint;
if (g.vehicle.auto_drive_destination != AutoDriveDestination::STOPPED)
{
current_destination = g.vehicle.auto_drive_destination;
g.vehicle.auto_drive_destination = AutoDriveDestination::STOPPED;
changing_driving_styles = true;
}
if (!self::veh && current_destination != AutoDriveDestination::STOPPED)
{
current_destination = AutoDriveDestination::STOPPED;
changing_driving_styles = false;
g_notification_service.push_warning("AUTO_DRIVE"_T.data(), "PLAYER_INFO_NO_VEHICLE"_T.data());
}
else if (current_driving_flag != driving_style_flags[g.vehicle.auto_drive_style] || current_speed != g.vehicle.auto_drive_speed)
{
current_driving_flag = driving_style_flags[g.vehicle.auto_drive_style];
current_speed = g.vehicle.auto_drive_speed;
changing_driving_styles = true;
}
if (current_destination != AutoDriveDestination::STOPPED)
{
Vector3 last_waypoint = waypoint;
bool does_waypoint_exist = false;
bool to_waypoint = false;
if (current_destination == AutoDriveDestination::OBJECTITVE)
{
to_waypoint = true;
does_waypoint_exist = blip::get_objective_location(waypoint);
}
else if (current_destination == AutoDriveDestination::WAYPOINT)
{
to_waypoint = true;
does_waypoint_exist = blip::get_blip_location(waypoint, (int)BlipIcons::RADAR_WAYPOINT);
}
if (does_waypoint_exist
&& (last_waypoint.x != waypoint.x || last_waypoint.y != waypoint.y || last_waypoint.z != waypoint.z))
{
changing_driving_styles = true;
}
bool interupted = (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_LEFT_ONLY) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_RIGHT_ONLY) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_ACCELERATE) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_BRAKE) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_EXIT) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HANDBRAKE));
if (current_destination == AutoDriveDestination::EMERGENCY_STOP || (to_waypoint && !does_waypoint_exist) || interupted)
{
TASK::CLEAR_PRIMARY_VEHICLE_TASK(self::veh);
TASK::CLEAR_PED_TASKS(self::ped);
if (!interupted && started)
{
VEHICLE::SET_VEHICLE_FORWARD_SPEED(self::veh, 0);
}
current_destination = AutoDriveDestination::STOPPED;
if (to_waypoint && !does_waypoint_exist)
{
g_notification_service.push_warning("AUTO_DRIVE"_T.data(), "TELEPORT_NO_WAYPOINT_SET"_T.data());
}
else
{
g_notification_service.push_warning("AUTO_DRIVE"_T.data(), "BACKEND_LOOPED_VEHICLE_AUTO_DRIVE_STOPPED"_T.data());
}
started = false;
}
else if (changing_driving_styles)
{
changing_driving_styles = false;
TASK::CLEAR_PRIMARY_VEHICLE_TASK(self::veh);
TASK::CLEAR_PED_TASKS(self::ped);
if (to_waypoint)
{
TASK::TASK_VEHICLE_DRIVE_TO_COORD_LONGRANGE(self::ped, self::veh, waypoint.x, waypoint.y, waypoint.z, current_speed, current_driving_flag, 20);
}
else
{
TASK::TASK_VEHICLE_DRIVE_WANDER(self::ped, self::veh, current_speed, current_driving_flag);
}
started = true;
}
}
}
}

View File

@ -1,106 +1,106 @@
#include "backend/looped_command.hpp"
#include "natives.hpp"
#include "script.hpp"
#include "util/blip.hpp"
namespace big
{
class waypoint_beacon : looped_command
{
using looped_command::looped_command;
virtual void on_tick() override
{
Vector3 location;
if (blip::get_blip_location(location, (int)BlipIcons::Waypoint))
{
int color[3] = {0, 0, 0};
for (int i = 0; i < 3; i++)
color[i] = (int)(255 * g.world.waypoint_n_objective.waypoint_beacon_color[i]);
// no need to bool check this, z-coord just have to be under/on the ground it doesn't really matter
MISC::GET_GROUND_Z_FOR_3D_COORD(location.x, location.y, location.z, &location.z, 1, 0);
GRAPHICS::DRAW_MARKER_EX(1,
location.x,
location.y,
location.z,
0.f,
0.f,
0.f,
0.f,
0.f,
0.f,
7.5f,
7.f,
location.z + 1500.f, // the beam's end
color[0],
color[1],
color[2],
180,
0,
0,
2,
0,
0,
0,
0,
1,
1);
}
}
};
class objective_beacon : looped_command
{
using looped_command::looped_command;
virtual void on_tick() override
{
Vector3 location;
if (blip::get_objective_location(location))
{
int color[3] = {0, 0, 0};
for (int i = 0; i < 3; i++)
color[i] = (int)(255 * g.world.waypoint_n_objective.objective_beacon_color[i]);
// no need to bool check this, z-coord just have to be under/on the ground it doesn't really matter
MISC::GET_GROUND_Z_FOR_3D_COORD(location.x, location.y, location.z, &location.z, 1, 0);
GRAPHICS::DRAW_MARKER_EX(1,
location.x,
location.y,
location.z,
0.f,
0.f,
0.f,
0.f,
0.f,
0.f,
7.5f,
7.f,
location.z + 1500.f, // the beam's end
color[0],
color[1],
color[2],
180,
0,
0,
2,
0,
0,
0,
0,
1,
1);
}
}
};
waypoint_beacon g_waypoint_beacon("waypointbeacon", "BACKEND_LOOPED_WORLD_BEACON_WAYPOINT", "BACKEND_LOOPED_WORLD_BEACON_WAYPOINT_DESC", g.world.waypoint_n_objective.waypoint_beacon);
objective_beacon g_objective_beacon("objectivebeacon", "BACKEND_LOOPED_WORLD_BEACON_OBJECTIVE", "BACKEND_LOOPED_WORLD_BEACON_OBJECTIVE_DESC", g.world.waypoint_n_objective.objective_beacon);
#include "backend/looped_command.hpp"
#include "natives.hpp"
#include "script.hpp"
#include "util/blip.hpp"
namespace big
{
class waypoint_beacon : looped_command
{
using looped_command::looped_command;
virtual void on_tick() override
{
Vector3 location;
if (blip::get_blip_location(location, (int)BlipIcons::RADAR_WAYPOINT))
{
int color[3] = {0, 0, 0};
for (int i = 0; i < 3; i++)
color[i] = (int)(255 * g.world.waypoint_n_objective.waypoint_beacon_color[i]);
// no need to bool check this, z-coord just have to be under/on the ground it doesn't really matter
MISC::GET_GROUND_Z_FOR_3D_COORD(location.x, location.y, location.z, &location.z, 1, 0);
GRAPHICS::DRAW_MARKER_EX(1,
location.x,
location.y,
location.z,
0.f,
0.f,
0.f,
0.f,
0.f,
0.f,
7.5f,
7.f,
location.z + 1500.f, // the beam's end
color[0],
color[1],
color[2],
180,
0,
0,
2,
0,
0,
0,
0,
1,
1);
}
}
};
class objective_beacon : looped_command
{
using looped_command::looped_command;
virtual void on_tick() override
{
Vector3 location;
if (blip::get_objective_location(location))
{
int color[3] = {0, 0, 0};
for (int i = 0; i < 3; i++)
color[i] = (int)(255 * g.world.waypoint_n_objective.objective_beacon_color[i]);
// no need to bool check this, z-coord just have to be under/on the ground it doesn't really matter
MISC::GET_GROUND_Z_FOR_3D_COORD(location.x, location.y, location.z, &location.z, 1, 0);
GRAPHICS::DRAW_MARKER_EX(1,
location.x,
location.y,
location.z,
0.f,
0.f,
0.f,
0.f,
0.f,
0.f,
7.5f,
7.f,
location.z + 1500.f, // the beam's end
color[0],
color[1],
color[2],
180,
0,
0,
2,
0,
0,
0,
0,
1,
1);
}
}
};
waypoint_beacon g_waypoint_beacon("waypointbeacon", "BACKEND_LOOPED_WORLD_BEACON_WAYPOINT", "BACKEND_LOOPED_WORLD_BEACON_WAYPOINT_DESC", g.world.waypoint_n_objective.waypoint_beacon);
objective_beacon g_objective_beacon("objectivebeacon", "BACKEND_LOOPED_WORLD_BEACON_OBJECTIVE", "BACKEND_LOOPED_WORLD_BEACON_OBJECTIVE_DESC", g.world.waypoint_n_objective.objective_beacon);
}

File diff suppressed because it is too large Load Diff

View File

@ -50,19 +50,17 @@ namespace big::blip
bool get_objective_location(Vector3& location)
{
if (get_objective_location_iteration(location, {BlipIcons::Circle}, {BlipColors::YellowMission, BlipColors::YellowMission2, BlipColors::Mission}))
if (get_objective_location_iteration(location, {BlipIcons::RADAR_LEVEL}, {BlipColors::YellowMission, BlipColors::YellowMission2, BlipColors::Mission}))
return true;
if (get_objective_location_iteration(location, {BlipIcons::RaceFinish}, {BlipColors::None}))
if (get_objective_location_iteration(location, {BlipIcons::RADAR_RACEFLAG}, {BlipColors::None}))
return true;
if (get_objective_location_iteration(location, {BlipIcons::Circle}, {BlipColors::Green, BlipColors::Blue}))
return true;
if (get_objective_location_iteration(location, {BlipIcons::CrateDrop}))
if (get_objective_location_iteration(location, {BlipIcons::RADAR_LEVEL}, {BlipColors::Green, BlipColors::Blue}))
return true;
auto blip_icons = {0, 1, 2, 143, 144, 145, 146, 280, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 535, 536, 537, 538, 539, 540, 541, 542};
for (const auto& icon : blip_icons)
static const auto blip_icons = {BlipIcons::RADAR_OBJECTIVE_BLUE, BlipIcons::RADAR_OBJECTIVE_GREEN, BlipIcons::RADAR_OBJECTIVE_RED, BlipIcons::RADAR_OBJECTIVE_YELLOW, BlipIcons::RADAR_CRATEDROP, BlipIcons::RADAR_TARGET_A, BlipIcons::RADAR_TARGET_B, BlipIcons::RADAR_TARGET_C, BlipIcons::RADAR_TARGET_D, BlipIcons::RADAR_TARGET_E, BlipIcons::RADAR_TARGET_F, BlipIcons::RADAR_TARGET_G, BlipIcons::RADAR_TARGET_H, BlipIcons::RADAR_SM_CARGO, BlipIcons::RADAR_BAT_CARGO, BlipIcons::RADAR_DEAD_DROP_PACKAGE};
for (const auto icon : blip_icons)
{
if (get_blip_location_from_offset(location, icon))
if (get_blip_location_from_offset(location, (int)icon))
return true;
}

View File

@ -169,7 +169,7 @@ namespace big::teleport
if (!blip::get_blip_location(location, sprite, color))
return false;
if (sprite == (int)BlipIcons::Waypoint)
if (sprite == (int)BlipIcons::RADAR_WAYPOINT)
entity::load_ground_at_3dcoord(location);
to_coords(location);
@ -193,7 +193,7 @@ namespace big::teleport
inline bool to_waypoint()
{
if (!to_blip((int)BlipIcons::Waypoint))
if (!to_blip((int)BlipIcons::RADAR_WAYPOINT))
{
g_notification_service.push_warning("TELEPORT"_T.data(), "TELEPORT_NO_WAYPOINT_SET"_T.data());

View File

@ -18,7 +18,7 @@ namespace big
ImGui::SameLine();
components::button("VIEW_PLAYER_TELEPORT_YOUR_WAYPOINT"_T, [] {
Vector3 location;
if (blip::get_blip_location(location, (int)BlipIcons::Waypoint))
if (blip::get_blip_location(location, (int)BlipIcons::RADAR_WAYPOINT))
entity::load_ground_at_3dcoord(location), teleport::teleport_player_to_coords(g_player_service->get_selected(), location);
});