feat: New world options + Request Gun Van anywhere (#2393)

+ World -> Gravity Editor (with presets for ease of use)
+ World -> Waypoint Beacon
+ World -> Objective Beacon
+ World -> Time And Weather -> Ground Snow
+ Self -> Mobile -> Request Gun Van (spawns the gun van right in front of you no matter where you are)
This commit is contained in:
thehorizon84 2023-11-08 23:16:10 +01:00 committed by GitHub
parent 647e5a28d9
commit b93a072fe6
17 changed files with 324 additions and 2 deletions

View File

@ -94,6 +94,16 @@ namespace big
}
};
class request_gun_van : command
{
using command::command;
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx) override
{
mobile::mobile_misc::request_gun_van();
}
};
boat_pickup g_boat_pickup("boatpickup", "REQUEST_BOAT", "REQUEST_BOAT_DESC", 0);
ballistic_armor g_ballistic_armor("ballisticarmor", "REQUEST_BALLISTIC", "REQUEST_BALLISTIC_DESC", 0);
request_avenger g_request_avenger("avenger", "REQUEST_AVENGER", "REQUEST_AVENGER_DESC", 0);
@ -103,4 +113,5 @@ namespace big
request_acidlab g_request_acidlab("acidlab", "REQUEST_ACIDLAB", "REQUEST_ACIDLAB_DESC", 0);
request_acidlab_bike g_request_acidlab_bike("acidbike", "REQUEST_ACIDBIKE", "REQUEST_ACIDBIKE_DESC", 0);
request_taxi g_request_taxi("taxi", "REQUEST_TAXI", "REQUEST_TAXI_DESC", 0);
request_gun_van g_request_gun_van("gunvan", "REQUEST_GUN_VAN", "REQUEST_GUN_VAN_DESC", 0);
}

View File

@ -0,0 +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);
}

View File

@ -0,0 +1,26 @@
#include "backend/looped_command.hpp"
#include "fiber_pool.hpp"
#include "gta_util.hpp"
#include "script.hpp"
namespace big
{
class modify_gravity : looped_command
{
using looped_command::looped_command;
virtual void on_tick() override
{
*g_pointers->m_gta.m_gravity_level = g.world.gravity.current_gravity;
g_pointers->m_gta.m_set_gravity_level(0);
}
virtual void on_disable() override
{
*g_pointers->m_gta.m_gravity_level = 9.8f;
g_pointers->m_gta.m_set_gravity_level(0);
}
};
modify_gravity g_modify_gravity("modifygravity", "BACKEND_LOOPED_WORLD_MODIFY_GRAVITY", "BACKEND_LOOPED_WORLD_MODIFY_GRAVITY_DESC", g.world.gravity.modify_gravity);
}

View File

@ -0,0 +1,25 @@
#include "backend/looped_command.hpp"
#include "fiber_pool.hpp"
#include "gta_util.hpp"
#include "script.hpp"
#include "services/tunables/tunables_service.hpp"
namespace big
{
class ground_snow : looped_command
{
using looped_command::looped_command;
virtual void on_tick() override
{
g_tunables_service->set_tunable<bool>(RAGE_JOAAT("TURN_SNOW_ON_OFF"), true);
}
virtual void on_disable() override
{
g_tunables_service->set_tunable<bool>(RAGE_JOAAT("TURN_SNOW_ON_OFF"), false);
}
};
ground_snow g_ground_snow("groundsnow", "BACKEND_LOOPED_WORLD_GROUND_SNOW", "BACKEND_LOOPED_WORLD_GROUND_SNOW_DESC", g.world.ground_snow);
}

View File

@ -0,0 +1,34 @@
#pragma once
namespace big
{
constexpr const static auto gravity_presets = std::to_array({
"Moon",
"Sun",
"Pluto",
"Space",
"Mercury",
"Venus",
"Earth",
"Mars",
"Jupiter",
"Saturn",
"Uranus",
"Neptune"
});
constexpr const static auto gravity_preset_values = std::to_array({
1.6f,
274.f,
0.6f,
0.f,
3.7f,
8.9f,
9.8f,
3.7f,
24.8f,
10.5f,
8.7f,
11.2f
});
}

View File

@ -56,6 +56,8 @@ namespace big::scr_globals
static inline const script_global gooch(1890378);
static inline const script_global gun_van(1956855);
static inline const script_global passive(1574582);
static inline const script_global property_garage(1945123);

View File

@ -542,6 +542,14 @@ namespace big
NLOHMANN_DEFINE_TYPE_INTRUSIVE(water, part_water)
} water{};
struct gravity
{
bool modify_gravity = false;
float current_gravity = 9.8f;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(gravity, modify_gravity, current_gravity)
} gravity{};
struct ocean
{
bool modify_ocean = false;
@ -551,6 +559,16 @@ namespace big
NLOHMANN_DEFINE_TYPE_INTRUSIVE(ocean, modify_ocean, disable_ocean, ocean_opacity)
} ocean{};
struct waypoint_n_objective
{
bool waypoint_beacon = false;
bool objective_beacon = false;
float waypoint_beacon_color[3] = {1, 0, 1};
float objective_beacon_color[3] = {1, 1, 0};
NLOHMANN_DEFINE_TYPE_INTRUSIVE(waypoint_n_objective, waypoint_beacon, objective_beacon, objective_beacon_color, waypoint_beacon_color)
} waypoint_n_objective{};
struct spawn_ped
{
bool preview_ped = false;
@ -615,9 +633,10 @@ namespace big
bool override_weather = false;
int local_weather = 0;
bool blackout = false;
bool blackout = false;
bool ground_snow = false;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(world, water, spawn_ped, custom_time, blackhole, model_swapper, nearby, orbital_drone, local_weather, override_weather, blackout)
NLOHMANN_DEFINE_TYPE_INTRUSIVE(world, water, spawn_ped, custom_time, blackhole, model_swapper, nearby, orbital_drone, local_weather, override_weather, blackout, ground_snow)
} world{};
struct spoofing

View File

@ -63,6 +63,8 @@ namespace big::functions
using ptr_to_handle = Entity (*)(void*);
using handle_to_ptr = rage::CDynamicEntity* (*)(Entity);
using set_gravity_level = void(*)(int level);
using check_chat_profanity = int(__int64 chat_type, const char* input, const char** output);
using write_player_game_state_data_node = bool (*)(rage::netObject* plr, CPlayerGameStateDataNode* node);

View File

@ -93,6 +93,8 @@ namespace big
uint32_t* m_region_code;
uint64_t m_ocean_quads;
float* m_gravity_level;
functions::set_gravity_level m_set_gravity_level;
PVOID m_world_model_spawn_bypass;
PVOID m_native_return;

View File

@ -42,6 +42,24 @@ namespace big
g_pointers->m_gta.m_ocean_quads = ptr.add(5).rip().as<uint64_t>();
}
},
// Gravity Level
{
"GL",
"48 8D 0D ? ? ? ? F3 0F 10 04 81 F3 0F 11 05",
[](memory::handle ptr)
{
g_pointers->m_gta.m_gravity_level = ptr.add(3).rip().as<float*>();
}
},
// Set Gravity Level
{
"SGL",
"48 83 EC ? 83 F9 ? 77 ? 48 63 C1 48 8D 0D",
[](memory::handle ptr)
{
g_pointers->m_gta.m_set_gravity_level = ptr.as<functions::set_gravity_level>();
}
},
// Game State
{
"GS",

View File

@ -190,5 +190,28 @@ namespace big::mobile
{
*scr_globals::freemode_global.at(853).as<int*>() = 1;
}
inline void request_gun_van()
{
auto local_pos = self::pos;
auto forward_vector = ENTITY::GET_ENTITY_FORWARD_VECTOR(self::ped);
Vector3 spawn_point;
if (MISC::FIND_SPAWN_POINT_IN_DIRECTION(local_pos.x,
local_pos.y,
local_pos.z,
forward_vector.x,
forward_vector.y,
forward_vector.z,
25.f,
&spawn_point))
{
*scr_globals::gun_van.as<Vector3*>() = spawn_point;
return g_notification_service->push_success("GUI_TAB_MOBILE"_T.data(), "REQUEST_GUN_VAN_NOTIFY_SUCCESS"_T.data());
}
g_notification_service->push_warning("GUI_TAB_MOBILE"_T.data(), "REQUEST_GUN_VAN_NOTIFY_FAILED"_T.data());
}
}
}

View File

@ -53,6 +53,7 @@ namespace big
components::command_button<"taxi">();
components::command_button<"gunvan">();
ImGui::SeparatorText("MORS_MUTUAL"_T.data());

View File

@ -56,7 +56,9 @@ namespace big
static void spawn_ped();
static void squad_spawner();
static void time_and_weather();
static void gravity();
static void ocean();
static void waypoint_and_objective();
static void spoofing();
static void teleport();
static void custom_teleport();

View File

@ -0,0 +1,22 @@
#include "views/view.hpp"
#include "core/data/gravity_presets.hpp"
namespace big
{
void view::gravity()
{
components::command_checkbox<"modifygravity">();
if (g.world.gravity.modify_gravity)
{
ImGui::SliderFloat("GRAVITY_LEVEL"_T.data(), &g.world.gravity.current_gravity, 0.f, 1000.f, "%.1f");
static int selected_lunar_preset = 0;
if (ImGui::Combo("GRAVITY_LUNAR_PRESETS"_T.data(), &selected_lunar_preset, gravity_presets.data(), gravity_presets.size()))
{
g.world.gravity.current_gravity = gravity_preset_values[selected_lunar_preset];
}
}
}
}

View File

@ -40,5 +40,7 @@ namespace big
}
components::command_checkbox<"blackout">();
components::command_checkbox<"groundsnow">();
}
}

View File

@ -0,0 +1,17 @@
#include "views/view.hpp"
namespace big
{
void view::waypoint_and_objective()
{
components::command_checkbox<"waypointbeacon">();
if (g.world.waypoint_n_objective.waypoint_beacon)
ImGui::ColorPicker3("VIEW_BEACON_WAYPOINT_COLOR"_T.data(), g.world.waypoint_n_objective.waypoint_beacon_color, ImGuiColorEditFlags_NoDragDrop | ImGuiColorEditFlags_NoOptions | ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_DisplayHex);
components::command_checkbox<"objectivebeacon">();
if (g.world.waypoint_n_objective.objective_beacon)
ImGui::ColorPicker3("VIEW_BEACON_OBJECTIVE_COLOR"_T.data(), g.world.waypoint_n_objective.objective_beacon_color, ImGuiColorEditFlags_NoDragDrop | ImGuiColorEditFlags_NoOptions | ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_DisplayHex);
}
}

View File

@ -14,11 +14,21 @@ namespace big
view::time_and_weather();
}
ImGui::SeparatorText("GUI_TAB_GRAVITY"_T.data());
{
view::gravity();
}
ImGui::SeparatorText("GUI_TAB_OCEAN"_T.data());
{
view::ocean();
}
ImGui::SeparatorText("GUI_TAB_WAYPOINT_N_OBJECTIVE"_T.data());
{
view::waypoint_and_objective();
}
ImGui::SeparatorText("PED"_T.data());
components::button<ImVec2(110, 0), ImVec4(0.70196f, 0.3333f, 0.00392f, 1.f)>("VIEW_DEBUG_THREADS_KILL"_T, [] {