Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Merge remote-tracking branch 'upstream/lcs' into lcs
  • Loading branch information
Nick007J committed Jul 17, 2021
2 parents 81aece7 + ec5a07b commit 0a23afebb70851e4f09b335483b43aac997cb3f8
Showing with 865 additions and 390 deletions.
  1. BIN gamefiles/TEXT/ENGLISH.gxt
  2. +1 −1 src/core/Fire.cpp
  3. +7 −2 src/core/config.h
  4. +61 −50 src/core/re3.cpp
  5. +761 −0 src/extras/ini.h
  6. +0 −333 src/extras/ini_parser.hpp
  7. +1 −0 src/peds/Ped.cpp
  8. +34 −4 utils/gxt/ENGLISH.txt
BIN +388 Bytes (100%) gamefiles/TEXT/ENGLISH.gxt
Binary file not shown.
@@ -457,7 +457,7 @@ CFireManager::StartScriptFire(const CVector &pos, CEntity *target, float strengt
if (target) {
if (target->IsPed()) {
ped->m_pFire = fire;
if (target != (CVehicle *)FindPlayerPed()) {
if (target != FindPlayerPed()) {
CVector2D pos = target->GetPosition();
ped->SetFlee(pos, 10000);
ped->SetMoveAnim();
@@ -324,8 +324,8 @@ enum Config {
#define WATER_CHEATS
//#define PSP_WATERCANNON

//#define USE_CUTSCENE_SHADOW_FOR_PED
#define DISABLE_CUTSCENE_SHADOWS
//#define USE_CUTSCENE_SHADOW_FOR_PED // requires COMPATIBLE_SAVES
//#define DISABLE_CUTSCENE_SHADOWS

// Pad
#if !defined(RW_GL3) && defined(_WIN32)
@@ -457,4 +457,9 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
#undef PS2_AUDIO_CHANNELS
#endif

// if these defines are enabled saves are not vanilla compatible without COMPATIBLE_SAVES
#ifndef COMPATIBLE_SAVES
#undef USE_CUTSCENE_SHADOW_FOR_PED
#endif

#endif // VANILLA_DEFINES
@@ -189,117 +189,127 @@ CustomFrontendOptionsPopulate(void)
#endif

#ifdef LOAD_INI_SETTINGS
#include "ini_parser.hpp"
#define MINI_CASE_SENSITIVE
#include "ini.h"

mINI::INIFile ini("reLCS.ini");
mINI::INIStructure cfg;

linb::ini cfg;
bool ReadIniIfExists(const char *cat, const char *key, uint32 *out)
{
std::string strval = cfg.get(cat, key, "\xBA");
const char *value = strval.c_str();
char *endPtr;
if (value && value[0] != '\xBA') {
*out = strtoul(value, &endPtr, 0);
mINI::INIMap<std::string> section = cfg.get(cat);
if (section.has(key)) {
char *endPtr;
*out = strtoul(section.get(key).c_str(), &endPtr, 0);
return true;
}
return false;
}

bool ReadIniIfExists(const char *cat, const char *key, uint8 *out)
{
mINI::INIMap<std::string> section = cfg.get(cat);
if (section.has(key)) {
char *endPtr;
*out = strtoul(section.get(key).c_str(), &endPtr, 0);
return true;
}
return false;
}

bool ReadIniIfExists(const char *cat, const char *key, bool *out)
{
std::string strval = cfg.get(cat, key, "\xBA");
const char *value = strval.c_str();
char *endPtr;
if (value && value[0] != '\xBA') {
*out = strtoul(value, &endPtr, 0);
mINI::INIMap<std::string> section = cfg.get(cat);
if (section.has(key)) {
char *endPtr;
*out = strtoul(section.get(key).c_str(), &endPtr, 0);
return true;
}
return false;
}

bool ReadIniIfExists(const char *cat, const char *key, int32 *out)
{
std::string strval = cfg.get(cat, key, "\xBA");
const char *value = strval.c_str();
char *endPtr;
if (value && value[0] != '\xBA') {
*out = strtol(value, &endPtr, 0);
mINI::INIMap<std::string> section = cfg.get(cat);
if (section.has(key)) {
char *endPtr;
*out = strtol(section.get(key).c_str(), &endPtr, 0);
return true;
}
return false;
}

bool ReadIniIfExists(const char *cat, const char *key, int8 *out)
{
std::string strval = cfg.get(cat, key, "\xBA");
const char *value = strval.c_str();
char *endPtr;
if (value && value[0] != '\xBA') {
*out = strtol(value, &endPtr, 0);
mINI::INIMap<std::string> section = cfg.get(cat);
if (section.has(key)) {
char *endPtr;
*out = strtol(section.get(key).c_str(), &endPtr, 0);
return true;
}
return false;
}

bool ReadIniIfExists(const char *cat, const char *key, float *out)
{
std::string strval = cfg.get(cat, key, "\xBA");
const char *value = strval.c_str();
if (value && value[0] != '\xBA') {
*out = atof(value);
mINI::INIMap<std::string> section = cfg.get(cat);
if (section.has(key)) {
char *endPtr;
*out = strtof(section.get(key).c_str(), &endPtr);
return true;
}
return false;
}

bool ReadIniIfExists(const char *cat, const char *key, char *out, int size)
{
std::string strval = cfg.get(cat, key, "\xBA");
const char *value = strval.c_str();
if (value && value[0] != '\xBA') {
strncpy(out, value, size);
mINI::INIMap<std::string> section = cfg.get(cat);
if (section.has(key)) {
strncpy(out, section.get(key).c_str(), size - 1);
out[size - 1] = '\0';
return true;
}
return false;
}

void StoreIni(const char *cat, const char *key, uint32 val)
{
char temp[10];
sprintf(temp, "%u", val);
cfg.set(cat, key, temp);
char temp[11];
sprintf(temp, "%u", val);
cfg[cat][key] = temp;
}

void StoreIni(const char *cat, const char *key, uint8 val)
{
char temp[10];
sprintf(temp, "%u", (uint32)val);
cfg.set(cat, key, temp);
char temp[11];
sprintf(temp, "%u", val);
cfg[cat][key] = temp;
}

void StoreIni(const char *cat, const char *key, int32 val)
{
char temp[10];
char temp[11];
sprintf(temp, "%d", val);
cfg.set(cat, key, temp);
cfg[cat][key] = temp;
}

void StoreIni(const char *cat, const char *key, int8 val)
{
char temp[10];
sprintf(temp, "%d", (int32)val);
cfg.set(cat, key, temp);
char temp[11];
sprintf(temp, "%d", val);
cfg[cat][key] = temp;
}

void StoreIni(const char *cat, const char *key, float val)
{
char temp[10];
char temp[50];
sprintf(temp, "%f", val);
cfg.set(cat, key, temp);
cfg[cat][key] = temp;
}

void StoreIni(const char *cat, const char *key, char *val, int size)
{
cfg.set(cat, key, val);
cfg[cat][key] = val;
}

const char *iniControllerActions[] = { "PED_FIREWEAPON", "PED_CYCLE_WEAPON_RIGHT", "PED_CYCLE_WEAPON_LEFT", "GO_FORWARD", "GO_BACK", "GO_LEFT", "GO_RIGHT", "PED_SNIPER_ZOOM_IN",
@@ -361,7 +371,7 @@ void LoadINIControllerSettings()
#endif
// force to default GTA behaviour (never overwrite bindings on joy change/initialization) if user init'ed/set bindings before we introduced that
if (!ReadIniIfExists("Controller", "PadButtonsInited", &ControlsManager.ms_padButtonsInited)) {
ControlsManager.ms_padButtonsInited = cfg.category_size("Bindings") != 0 ? 16 : 0;
ControlsManager.ms_padButtonsInited = cfg.get("Bindings").size() != 0 ? 16 : 0;
}

for (int32 i = 0; i < MAX_CONTROLLERACTIONS; i++) {
@@ -463,12 +473,13 @@ void SaveINIControllerSettings()
#endif
#endif
StoreIni("Controller", "PadButtonsInited", ControlsManager.ms_padButtonsInited);
cfg.write_file("reLCS.ini");

ini.write(cfg);
}

bool LoadINISettings()
{
if (!cfg.load_file("reLCS.ini"))
if (!ini.read(cfg))
return false;

#ifdef IMPROVED_VIDEOMODE
@@ -540,7 +551,7 @@ bool LoadINISettings()
#endif

#ifdef CUSTOM_FRONTEND_OPTIONS
bool migrate = cfg.category_size("FrontendOptions") != 0;
bool migrate = cfg.get("FrontendOptions").size() != 0;
for (int i = 0; i < MENUPAGES; i++) {
for (int j = 0; j < NUM_MENUROWS; j++) {
CMenuScreenCustom::CMenuEntry &option = aScreens[i].m_aEntries[j];
@@ -553,7 +564,7 @@ bool LoadINISettings()

// Migrate from old .ini to new .ini
if (migrate && ReadIniIfExists("FrontendOptions", option.m_CFO->save, option.m_CFO->value))
cfg.remove("FrontendOptions", option.m_CFO->save);
cfg["FrontendOptions"].remove(option.m_CFO->save);
else
ReadIniIfExists(option.m_CFO->saveCat, option.m_CFO->save, option.m_CFO->value);

@@ -652,7 +663,7 @@ void SaveINISettings()
}
#endif

cfg.write_file("reLCS.ini");
ini.write(cfg);
}

#endif

0 comments on commit 0a23afe

Please sign in to comment.