Add Garage drop-down to Spawn PV menu (#2171)

* Fixed edge case where a garage that contained only banned vehicles would show if the user was using Spawn Clone.
Refactored a large portion of the garage code to be production ready.
Formatting changes.

* Added singular garage items to the m_garage setter like the Terrorbyte.

* Fixed is_blacklisted_vehicle returning an inverted condition.
Fixed Garage drop-down not updating properly.

* Separated out m_garage's setter into a ctor function.
Replaced the 4 singular garages that use an overloaded index with a define to be able to shift them easier when new properties are added.

* Removed obsolete and incorrect player.character_slot config entry.
Removed deprecated local_player.hpp.
Added self::char_slot that is guaranteed to be correct.

* Removed extraneous semi-colon.

* Added more stuff to fillsnacks.
Removed more extraneous usages of MPPLY_LAST_MP_CHAR.

* Added the vehicle's name to player info.

* Fixed get_property_garage_size returning the incorrect size for the facility.
Fixed get_static_property_name returning the Nightclub's name instead of Nightclub Service Entrance to maintain consistency with the Mechanic.
Fixed garage_slot_iterator not starting and ending at the correct indexes.

* Shifted the singular properties down one to compensate for the new math.

* Fixed backwards math on Terrorbyte and Nightclub B1.

* Fixed garage not being updated when the player moved the vehicle.

* Fixed backwards comments.
This commit is contained in:
gir489
2023-09-22 17:16:33 -04:00
committed by GitHub
parent 92b6df7653
commit afd3a5e943
18 changed files with 388 additions and 111 deletions

View File

@ -27,7 +27,6 @@ namespace big::helper
namespace big
{
static int character_index = 0;
static int year, month, day, hour, minute, second, millisecond;
static char stat_int_read_result[256] = {};
@ -100,7 +99,7 @@ namespace big
{
auto substr = text.substr(1);
if (substr.substr(0, 3) == "mpx")
substr[2] = character_index + '0';
substr[2] = self::char_index + '0';
return rage::joaat(substr);
}
return get_text_value<Hash>(text);
@ -440,7 +439,6 @@ namespace big
}(), true);
g_fiber_pool->queue_job([] {
STATS::STAT_GET_INT(RAGE_JOAAT("MPPLY_LAST_MP_CHAR"), &character_index, -1);
CLOCK::GET_POSIX_TIME(&year, &month, &day, &hour, &minute, &second);
if (g.stat_editor.stat.int_read)
strcpy_s(stat_int_read_result, sizeof(stat_int_read_result), helper::stat_get_int(stat_int_text).c_str());
@ -471,7 +469,7 @@ namespace big
});
components::sub_title(std::format("Posix Time: {}-{}-{} {}:{}:{}", year, month, day, hour, minute, second));
components::sub_title(std::format("Character Index: {}", character_index));
components::sub_title(std::format("Character Index: {}", self::char_index));
components::sub_title("Be aware of stat limits, use with caution, modifying some stats are risky.");
if (ImGui::BeginTabBar("##stat_editor_tab_bar"))
@ -605,7 +603,7 @@ namespace big::helper
index_max = index_v[1];
int value_n = get_text_value<int>(value);
for (int i = index_min; i <= index_max; i++)
STATS::SET_PACKED_STAT_INT_CODE(i, value_n, character_index);
STATS::SET_PACKED_STAT_INT_CODE(i, value_n, self::char_index);
}
void packed_stat_set_bool(std::string index, std::string value)
@ -619,7 +617,7 @@ namespace big::helper
index_max = index_v[1];
int value_b = get_text_value<bool>(value);
for (int i = index_min; i <= index_max; i++)
STATS::SET_PACKED_STAT_BOOL_CODE(i, value_b, character_index);
STATS::SET_PACKED_STAT_BOOL_CODE(i, value_b, self::char_index);
}
std::string packed_stat_get_int(std::string index)
@ -629,7 +627,7 @@ namespace big::helper
std::stringstream ss(index);
std::getline(ss, str, ' ');
if (str != "")
result = STATS::GET_PACKED_STAT_INT_CODE(get_text_value<int>(str), character_index);
result = STATS::GET_PACKED_STAT_INT_CODE(get_text_value<int>(str), self::char_index);
return std::to_string(result);
}
@ -640,7 +638,7 @@ namespace big::helper
std::stringstream ss(index);
std::getline(ss, str, ' ');
if (str != "")
result = STATS::GET_PACKED_STAT_BOOL_CODE(get_text_value<int>(str), character_index);
result = STATS::GET_PACKED_STAT_BOOL_CODE(get_text_value<int>(str), self::char_index);
return std::to_string(result);
}
}