Move all global indices into scr_globals.hpp. (#2018)

This commit is contained in:
gir489 2023-08-24 16:06:50 -04:00 committed by GitHub
parent 04405eb9ae
commit afa79d8600
10 changed files with 71 additions and 56 deletions

View File

@ -33,11 +33,11 @@ namespace big
}
else if (scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[id].SimpleInteriorData.Index != eSimpleInteriorIndex::SIMPLE_INTERIOR_INVALID)
{
*script_global(1950844).at(3347).as<Player*>() =
*scr_globals::interiors.at(3347).as<Player*>() =
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[id].SimpleInteriorData.Owner;
*script_global(1950844).at(3684).as<eSimpleInteriorIndex*>() =
*scr_globals::interiors.at(3684).as<eSimpleInteriorIndex*>() =
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[id].SimpleInteriorData.Index;
*script_global(1950844).at(3683).as<bool*>() = true;
*scr_globals::interiors.at(3683).as<bool*>() = true;
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].SimpleInteriorData.InteriorSubtype =
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[id].SimpleInteriorData.InteriorSubtype;
}

View File

@ -60,7 +60,7 @@ namespace big
if (g.self.dance_mode && g.m_dance_thread->m_handler)
{
*script_global(1950837).as<bool*>() = true;
*scr_globals::dance_state.as<PINT>() = TRUE; //Never once do the scripts read this as a boolean. It seems to be some kind of state the player is in. Runs from 4 to 35.
scr_functions::dance_loop.call(g.m_dance_thread, g.m_dance_program, {});
}
}

View File

@ -14,15 +14,15 @@ namespace big
virtual void on_tick() override
{
if (g.self.ghost_org)
MISC::SET_BIT(script_global(2794162).at(4667).as<int*>(), 2);
MISC::SET_BIT(scr_globals::freemode_global.at(4667).as<int*>(), 2);
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].OffRadarActive = true;
*scr_globals::offradar_time.at(57).as<int*>() = NETWORK::GET_NETWORK_TIME() + 1;
*scr_globals::freemode_properties.at(57).as<int*>() = NETWORK::GET_NETWORK_TIME() + 1;
}
virtual void on_disable() override
{
if (!g.self.ghost_org)
MISC::CLEAR_BIT(script_global(2794162).at(4667).as<int*>(), 2);
MISC::CLEAR_BIT(scr_globals::freemode_global.at(4667).as<int*>(), 2);
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].OffRadarActive = false;
}
};

View File

@ -10,12 +10,12 @@ namespace big
virtual void on_tick() override
{
*script_global(20483).as<bool*>() = true;
*scr_globals::mobile.as<PBOOL>() = TRUE;
}
virtual void on_disable() override
{
*script_global(20483).as<bool*>() = false;
*scr_globals::mobile.as<PBOOL>() = FALSE;
}
};

View File

@ -14,6 +14,7 @@ namespace big::scr_globals
static inline const script_global globalplayer_bd(2657704);
static inline const script_global gpbd_fm_3(1895156);
static inline const script_global gpbd_fm_1(1853988);
static inline const script_global interiors(1950844);
static inline const script_global launcher_global(2756336);
@ -32,15 +33,32 @@ namespace big::scr_globals
static inline const script_global sctv_spectator(2695969); // pausemenu_multiplayer function 0xE49C42EC
static inline const script_global vehicle_global(1586488);
static inline const script_global mechanic_global(2794162);
static inline const script_global freemode_properties(2672524);
static inline const script_global freemode_global(2794162);
static inline const script_global spawn_global(2694613);
static inline const script_global offradar_time(2672524);
static inline const script_global session_info(1654054);
static inline const script_global tuneables(262145);
static inline const script_global dance_state(1950837);
static inline const script_global mobile(20483);
static inline const script_global transaction_overlimit(20483);
static inline const script_global stats(2359296);
static inline const script_global session(1574589);
static inline const script_global session2(1575020);
static inline const script_global session3(32284);
static inline const script_global session4(1574934);
static inline const script_global session5(1574995);
static inline const script_global session6(2694534);
static inline const script_global gooch(1890378);
}
namespace big::scr_locals

View File

@ -1,6 +1,6 @@
#pragma once
#include "native_hooks.hpp"
#include "script_global.hpp"
#include "core/scr_globals.hpp"
namespace big
{
@ -15,7 +15,7 @@ namespace big
if (g.notifications.transaction_rate_limit.notify)
g_notification_service->push_warning("Transaction Rate Limit", "You're receiving transaction rate limits, whatever you're doing do it less.");
*script_global(4536677).as<int*>() = 0;
*scr_globals::transaction_overlimit.as<PBOOL>() = FALSE;
return;
}

View File

@ -7,14 +7,12 @@
#include "natives.hpp"
#include "notify.hpp"
#include "script.hpp"
#include "script_global.hpp"
#include "core/scr_globals.hpp"
#include "script_local.hpp"
#include "vehicle.hpp"
namespace big::mobile
{
inline auto player_global = script_global(2657704);
namespace util
{
int get_current_personal_vehicle(); // forward declare
@ -25,7 +23,7 @@ namespace big::mobile
inline int get_current_personal_vehicle()
{
return *script_global(2359296).at(0, 5568).at(681).at(2).as<int*>();
return *scr_globals::stats.at(0, 5568).at(681).at(2).as<int*>();
}
}
@ -33,27 +31,27 @@ namespace big::mobile
{
inline void request_ammo_drop()
{
*script_global(scr_globals::mechanic_global).at(891).as<int*>() = 1;
*scr_globals::freemode_global.at(891).as<int*>() = 1;
}
inline void request_boat_pickup()
{
*script_global(scr_globals::mechanic_global).at(892).as<int*>() = 1;
*scr_globals::freemode_global.at(892).as<int*>() = 1;
}
inline void request_helicopter_pickup()
{
*script_global(scr_globals::mechanic_global).at(893).as<int*>() = 1;
*scr_globals::freemode_global.at(893).as<int*>() = 1;
}
inline void request_backup_helicopter()
{
*script_global(scr_globals::mechanic_global).at(4491).as<int*>() = 1;
*scr_globals::freemode_global.at(4491).as<int*>() = 1;
}
inline void request_airstrike()
{
*script_global(scr_globals::mechanic_global).at(4492).as<int*>() = 1;
*scr_globals::freemode_global.at(4492).as<int*>() = 1;
}
}
@ -92,12 +90,12 @@ namespace big::mobile
{
inline void request_bullshark_testosterone()
{
*script_global(2672524).at(3690).as<int*>() = 1;
*scr_globals::freemode_properties.at(3690).as<int*>() = 1;
}
inline void request_ballistic_armor() //i think this is a ceo ability atleast?
{
*script_global(scr_globals::mechanic_global).at(896).as<int*>() = 1;
*scr_globals::freemode_global.at(896).as<int*>() = 1;
}
}
@ -105,32 +103,32 @@ namespace big::mobile
{
inline void request_avenger()
{
*script_global(scr_globals::mechanic_global).at(938).as<int*>() = 1;
*scr_globals::freemode_global.at(938).as<int*>() = 1;
}
inline void request_kosatka()
{
*script_global(scr_globals::mechanic_global).at(960).as<int*>() = 1;
*scr_globals::freemode_global.at(960).as<int*>() = 1;
}
inline void request_mobile_operations_center()
{
*script_global(scr_globals::mechanic_global).at(930).as<int*>() = 1;
*scr_globals::freemode_global.at(930).as<int*>() = 1;
}
inline void request_terrorbyte()
{
*script_global(scr_globals::mechanic_global).at(943).as<int*>() = 1;
*scr_globals::freemode_global.at(943).as<int*>() = 1;
}
inline void request_acidlab()
{
*script_global(scr_globals::mechanic_global).at(944).as<int*>() = 1;
*scr_globals::freemode_global.at(944).as<int*>() = 1;
}
inline void request_acidlab_bike()
{
*script_global(scr_globals::mechanic_global).at(994).as<int*>() = 1;
*scr_globals::freemode_global.at(994).as<int*>() = 1;
}
}
@ -138,12 +136,12 @@ namespace big::mobile
{
inline Vehicle get_personal_vehicle()
{
return *scr_globals::mechanic_global.at(299).as<Vehicle*>();
return *scr_globals::freemode_global.at(299).as<Vehicle*>();
}
inline void summon_vehicle_by_index(int veh_idx)
{
if (*scr_globals::mechanic_global.at(985).as<int*>() != -1)
if (*scr_globals::freemode_global.at(985).as<int*>() != -1)
return g_notification_service->push_warning("Vehicle", "Mechanic is not ready to deliver a vehicle right now.");
if (g.clone_pv.spawn_inside && self::veh)
@ -158,11 +156,11 @@ namespace big::mobile
// only do this when spawn inside is enabled otherwise the vehicle will spawn relatively far away from players
if (g.clone_pv.spawn_inside)
{
*scr_globals::mechanic_global.at(942).as<int*>() = 1; // disable vehicle node distance check
*scr_globals::freemode_global.at(942).as<int*>() = 1; // disable vehicle node distance check
}
*scr_globals::mechanic_global.at(928).as<int*>() = 1; // tell freemode to spawn our vehicle
*scr_globals::mechanic_global.at(988).as<int*>() = 0; // required
*scr_globals::mechanic_global.at(985).as<int*>() = veh_idx;
*scr_globals::freemode_global.at(928).as<int*>() = 1; // tell freemode to spawn our vehicle
*scr_globals::freemode_global.at(988).as<int*>() = 0; // required
*scr_globals::freemode_global.at(985).as<int*>() = veh_idx;
script::get_current()->yield(100ms);
@ -177,7 +175,7 @@ namespace big::mobile
}
// blocking call till vehicle is delivered
notify::busy_spinner("Delivering vehicle...", scr_globals::mechanic_global.at(985).as<int*>(), -1);
notify::busy_spinner("Delivering vehicle...", scr_globals::freemode_global.at(985).as<int*>(), -1);
if (g.clone_pv.spawn_inside)
{
@ -190,7 +188,7 @@ namespace big::mobile
{
inline void request_taxi()
{
*script_global(scr_globals::mechanic_global).at(853).as<int*>() = 1;
*scr_globals::freemode_global.at(853).as<int*>() = 1;
}
}
}

View File

@ -1,5 +1,5 @@
#pragma once
#include "script_global.hpp"
#include "core/scr_globals.hpp"
namespace big::outfit
{
@ -60,26 +60,26 @@ namespace big::outfit
inline char* get_slot_name_address(int slot)
{
return script_global(2359296).at(0, 5568).at(681).at(2460).at(slot, 8).as<char*>();
return scr_globals::stats.at(0, 5568).at(681).at(2460).at(slot, 8).as<char*>();
}
inline int* get_component_drawable_id_address(int slot, int id)
{
return script_global(2359296).at(0, 5568).at(681).at(1336).at(slot, 13).at(id, 1).as<int*>();
return scr_globals::stats.at(0, 5568).at(681).at(1336).at(slot, 13).at(id, 1).as<int*>();
}
inline int* get_component_texture_id_address(int slot, int id)
{
return script_global(2359296).at(0, 5568).at(681).at(1610).at(slot, 13).at(id, 1).as<int*>();
return scr_globals::stats.at(0, 5568).at(681).at(1610).at(slot, 13).at(id, 1).as<int*>();
}
inline int* get_prop_drawable_id_address(int slot, int id)
{
return script_global(2359296).at(0, 5568).at(681).at(1884).at(slot, 10).at(id, 1).as<int*>();
return scr_globals::stats.at(0, 5568).at(681).at(1884).at(slot, 10).at(id, 1).as<int*>();
}
inline int* get_prop_texture_id_address(int slot, int id)
{
return script_global(2359296).at(0, 5568).at(681).at(2095).at(slot, 10).at(id, 1).as<int*>();
return scr_globals::stats.at(0, 5568).at(681).at(2095).at(slot, 10).at(id, 1).as<int*>();
}
}

View File

@ -9,7 +9,6 @@
#include "rage/rlSessionByGamerTaskResult.hpp"
#include "script.hpp"
#include "script_function.hpp"
#include "script_global.hpp"
#include "services/api/api_service.hpp"
#include "services/player_database/player_database_service.hpp"
#include "services/players/player_service.hpp"
@ -45,14 +44,14 @@ namespace big::session
*scr_globals::sctv_spectator.as<int*>() = (session == eSessionType::SC_TV ? 1 : 0); // If SCTV then enable spectator mode
if (session == eSessionType::LEAVE_ONLINE)
*script_global(1574589).at(2).as<int*>() = -1;
*scr_globals::session.at(2).as<int*>() = -1;
else
{
*script_global(1574589).at(2).as<int*>() = 0;
*script_global(1575020).as<int*>() = (int)session;
*scr_globals::session.at(2).as<int*>() = 0;
*scr_globals::session2.as<int*>() = (int)session;
}
*script_global(1574589).as<int*>() = 1;
*scr_globals::session.as<int*>() = 1;
if (*g_pointers->m_gta.m_is_session_started && session != eSessionType::LEAVE_ONLINE)
{
@ -64,15 +63,15 @@ namespace big::session
}
scr_functions::reset_session_data({true, true});
*script_global(32284).as<int*>() = 0;
*script_global(1574934).as<int*>() = 1;
*script_global(1574995).as<int*>() = 32;
*scr_globals::session3.as<int*>() = 0;
*scr_globals::session4.as<int*>() = 1;
*scr_globals::session5.as<int*>() = 32;
if (SCRIPT::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(RAGE_JOAAT("maintransition")) == 0)
{
*script_global(2694534).as<int*>() = 1;
*scr_globals::session6.as<int*>() = 1;
script::get_current()->yield(200ms);
*script_global(1574589).as<int*>() = 0;
*scr_globals::session.as<int*>() = 0;
}
SCRIPT::SET_SCRIPT_WITH_NAME_HASH_AS_NO_LONGER_NEEDED(RAGE_JOAAT("pausemenu_multiplayer"));

View File

@ -20,7 +20,7 @@ namespace big
components::player_command_button<"ceokick">(g_player_service->get_selected(), {});
ImGui::SameLine();
components::button("Gooch Test", [] {
*script_global(1890378).at(289).at(1).as<Player*>() = g_player_service->get_selected()->id();
*scr_globals::gooch.at(289).at(1).as<Player*>() = g_player_service->get_selected()->id();
scripts::start_launcher_script(171);
});