Skip to content

Commit 83774bc

Browse files
authored
Merge branch 'master' into feature/testSphereAgainstWorld
2 parents 84d281e + aa20c7d commit 83774bc

File tree

77 files changed

+913
-246
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+913
-246
lines changed

Client/cefweb/CWebView.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -936,10 +936,10 @@ void CWebView::OnBeforeClose(CefRefPtr<CefBrowser> browser)
936936
// //
937937
// //
938938
////////////////////////////////////////////////////////////////////
939-
bool CWebView::OnBeforePopup(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, const CefString& target_url, const CefString& target_frame_name,
940-
CefLifeSpanHandler::WindowOpenDisposition target_disposition, bool user_gesture, const CefPopupFeatures& popupFeatures,
941-
CefWindowInfo& windowInfo, CefRefPtr<CefClient>& client, CefBrowserSettings& settings, CefRefPtr<CefDictionaryValue>& extra_info,
942-
bool* no_javascript_access)
939+
bool CWebView::OnBeforePopup(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, int popup_id, const CefString& target_url,
940+
const CefString& target_frame_name, CefLifeSpanHandler::WindowOpenDisposition target_disposition, bool user_gesture,
941+
const CefPopupFeatures& popupFeatures, CefWindowInfo& windowInfo, CefRefPtr<CefClient>& client, CefBrowserSettings& settings,
942+
CefRefPtr<CefDictionaryValue>& extra_info, bool* no_javascript_access)
943943
{
944944
// ATTENTION: This method is called on the IO thread
945945

Client/cefweb/CWebView.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,10 @@ class CWebView : public CWebViewInterface,
152152

153153
// CefLifeSpawnHandler methods
154154
virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) override;
155-
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, const CefString& target_url, const CefString& target_frame_name,
156-
CefLifeSpanHandler::WindowOpenDisposition target_disposition, bool user_gesture, const CefPopupFeatures& popupFeatures,
157-
CefWindowInfo& windowInfo, CefRefPtr<CefClient>& client, CefBrowserSettings& settings, CefRefPtr<CefDictionaryValue>& extra_info,
158-
bool* no_javascript_access) override;
155+
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, int popup_id, const CefString& target_url,
156+
const CefString& target_frame_name, CefLifeSpanHandler::WindowOpenDisposition target_disposition, bool user_gesture,
157+
const CefPopupFeatures& popupFeatures, CefWindowInfo& windowInfo, CefRefPtr<CefClient>& client, CefBrowserSettings& settings,
158+
CefRefPtr<CefDictionaryValue>& extra_info, bool* no_javascript_access) override;
159159
virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser) override;
160160

161161
// CefJSDialogHandler methods

Client/core/CConsole.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ class CConsole : public CConsoleInterface
4141
bool IsInputActive();
4242
void ActivateInput();
4343

44-
void HandleTextAccepted(bool bHandled);
4544
void GetCommandInfo(const std::string& strIn, std::string& strCmdOut, std::string& strCmdLineOut);
4645

4746
void ResetHistoryChanges();

Client/core/CNickGen.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
*****************************************************************************/
99

1010
#include "StdInc.h"
11-
#include "time.h"
11+
#include <random>
1212

1313
// These words are of a maximum length of 10 characters, capitalized, and stripped of whitespace
14-
const char* const CNickGen::m_szAdjectives[] = {
14+
const char* const szAdjectives[] = {
1515
"Aback", "Abaft", "Abandoned", "Abashed", "Aberrant", "Abhorrent", "Abiding", "Abject", "Ablaze", "Able", "Abnormal",
1616
"Aboard", "Aboriginal", "Abortive", "Abounding", "Abrasive", "Abrupt", "Absent", "Absorbed", "Absorbing", "Abstracted", "Absurd",
1717
"Abundant", "Abusive", "Acceptable", "Accessible", "Accidental", "Accurate", "Acid", "Acidic", "Acoustic", "Acrid", "Actually",
@@ -109,7 +109,7 @@ const char* const CNickGen::m_szAdjectives[] = {
109109
"Worried", "Worthless", "Wrathful", "Wretched", "Wrong", "Wry",
110110
};
111111

112-
const char* const CNickGen::m_szNouns[] = {
112+
const char* const szNouns[] = {
113113
"Aardvark", "Buffalo", "Alligator", "Ant", "Anteater", "Antelope", "Ape", "Armadillo", "Donkey", "Baboon", "Badger",
114114
"Barracuda", "Bat", "Bear", "Beaver", "Bee", "Bison", "Boar", "Bush", "Butterfly", "Camel", "Calf",
115115
"Cat", "Kitten", "Cattle", "Chamois", "Cheetah", "Chicken", "Chick", "Chimpanzee", "Infant", "Empress", "Troop",
@@ -196,10 +196,18 @@ const char* const CNickGen::m_szNouns[] = {
196196
"Vampire", "Parasite", "Tramp", "Bum", "Hobo", "Hitchhiker", "Deadbeat", "Acrobat",
197197
};
198198

199+
constexpr auto numAdjectives = std::size(szAdjectives);
200+
constexpr auto numNouns = std::size(szNouns);
201+
constexpr auto maxNum = 100;
202+
199203
SString CNickGen::GetRandomNickname()
200204
{
201-
srand((unsigned int)time(NULL));
202-
int iAdjective = rand() % NICKGEN_NUM_ADJECTIVES;
203-
int iNoun = rand() % NICKGEN_NUM_NOUNS;
204-
return SString("%s%s%i", m_szAdjectives[iAdjective], m_szNouns[iNoun], rand() % 100);
205+
std::random_device rd;
206+
std::mt19937 gen(rd());
207+
208+
std::uniform_int_distribution<int> adjectiveDist(0, numAdjectives - 1);
209+
std::uniform_int_distribution<int> nounDist(0, numNouns - 1);
210+
std::uniform_int_distribution<int> numDist(0, maxNum);
211+
212+
return SString("%s%s%i", szAdjectives[adjectiveDist(gen)], szNouns[nounDist(gen)], numDist(gen));
205213
}

Client/core/CNickGen.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,8 @@
99

1010
#pragma once
1111

12-
#define NICKGEN_NUM_ADJECTIVES 1048
13-
#define NICKGEN_NUM_NOUNS 934
14-
1512
class CNickGen
1613
{
1714
public:
18-
static const char* const m_szAdjectives[NICKGEN_NUM_ADJECTIVES];
19-
static const char* const m_szNouns[NICKGEN_NUM_NOUNS];
2015
static SString GetRandomNickname();
2116
};

Client/core/CQueryReceiver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ SQueryInfo CQueryReceiver::GetServerResponse()
183183

184184
// Recover server ping status if present
185185
const SString strPingStatus = strBuildNumber.Right(strBuildNumber.length() - strlen(strBuildNumber) - 1);
186-
CCore::GetSingleton().GetNetwork()->UpdatePingStatus(*strPingStatus, info.players, info.isStatusVerified);
186+
CCore::GetSingleton().GetNetwork()->UpdatePingStatus(strPingStatus.c_str(), strPingStatus.length(), info.players, info.isStatusVerified);
187187

188188
// Recover server http port if present
189189
const SString strNetRoute = strPingStatus.Right(strPingStatus.length() - strlen(strPingStatus) - 1);

Client/game_sa/CBuildingsPoolSA.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ CBuilding* CBuildingsPoolSA::AddBuilding(CClientBuilding* pClientBuilding, uint1
5353
if (!HasFreeBuildingSlot())
5454
return nullptr;
5555

56+
auto modelInfo = pGame->GetModelInfo(modelId);
57+
58+
// Change the properties group to force dynamic models to be created as buildings instead of dummies
59+
auto prevGroup = modelInfo->GetObjectPropertiesGroup();
60+
if (prevGroup != MODEL_PROPERTIES_GROUP_STATIC)
61+
modelInfo->SetObjectPropertiesGroup(MODEL_PROPERTIES_GROUP_STATIC);
62+
5663
// Load building
5764
SFileObjectInstance instance;
5865
instance.modelID = modelId;
@@ -70,9 +77,12 @@ CBuilding* CBuildingsPoolSA::AddBuilding(CClientBuilding* pClientBuilding, uint1
7077
pBuilding->m_pLod = nullptr;
7178
pBuilding->m_iplIndex = 0;
7279

80+
// Restore changed properties group
81+
if (prevGroup != MODEL_PROPERTIES_GROUP_STATIC)
82+
modelInfo->SetObjectPropertiesGroup(prevGroup);
83+
7384
// Always stream model collosion
7485
// TODO We can setup collison bounding box and use GTA streamer for it
75-
auto modelInfo = pGame->GetModelInfo(modelId);
7686
modelInfo->AddColRef();
7787

7888
// Add building in world

Client/game_sa/CGameSA.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,34 @@ void CGameSA::SetRoadSignsTextEnabled(bool isEnabled)
848848
m_isRoadSignsTextEnabled = isEnabled;
849849
}
850850

851+
void CGameSA::SetIgnoreFireStateEnabled(bool isEnabled)
852+
{
853+
if (isEnabled == m_isIgnoreFireStateEnabled)
854+
return;
855+
856+
if (isEnabled)
857+
{
858+
MemSet((void*)0x6511B9, 0x90, 10); // CCarEnterExit::IsVehicleStealable
859+
MemSet((void*)0x643A95, 0x90, 14); // CTaskComplexEnterCar::CreateFirstSubTask
860+
MemSet((void*)0x6900B5, 0x90, 14); // CTaskComplexCopInCar::ControlSubTask
861+
MemSet((void*)0x64F3DB, 0x90, 14); // CCarEnterExit::IsPlayerToQuitCarEnter
862+
863+
MemSet((void*)0x685A7F, 0x90, 14); // CTaskSimplePlayerOnFoot::ProcessPlayerWeapon
864+
}
865+
else
866+
{
867+
// Restore original bytes
868+
MemCpy((void*)0x6511B9, "\x88\x86\x90\x04\x00\x00\x85\xC0\x75\x3E", 10);
869+
MemCpy((void*)0x643A95, "\x8B\x88\x90\x04\x00\x00\x85\xC9\x0F\x85\x99\x01\x00\x00", 14);
870+
MemCpy((void*)0x6900B5, "\x8B\x81\x90\x04\x00\x00\x85\xC0\x0F\x85\x1A\x01\x00\x00", 14);
871+
MemCpy((void*)0x64F3DB, "\x8B\x85\x90\x04\x00\x00\x85\xC0\x0F\x85\x1B\x01\x00\x00", 14);
872+
873+
MemCpy((void*)0x685A7F, "\x8B\x86\x30\x07\x00\x00\x85\xC0\x0F\x85\x1D\x01\x00\x00", 14);
874+
}
875+
876+
m_isIgnoreFireStateEnabled = isEnabled;
877+
}
878+
851879
bool CGameSA::PerformChecks()
852880
{
853881
std::map<std::string, SCheatSA*>::iterator it;

Client/game_sa/CGameSA.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ class CGameSA : public CGame
249249
bool IsTunnelWeatherBlendEnabled() const noexcept override { return m_isTunnelWeatherBlendEnabled; }
250250
void SetTunnelWeatherBlendEnabled(bool isEnabled) override;
251251

252+
bool IsIgnoreFireStateEnabled() const noexcept override { return m_isIgnoreFireStateEnabled; }
253+
void SetIgnoreFireStateEnabled(bool isEnabled) override;
252254

253255
unsigned long GetMinuteDuration();
254256
void SetMinuteDuration(unsigned long ulTime);
@@ -378,6 +380,7 @@ class CGameSA : public CGame
378380
bool m_isRoadSignsTextEnabled{true};
379381
bool m_isBuildingsRemoved{false};
380382
bool m_isExtendedWaterCannonsEnabled{false};
383+
bool m_isIgnoreFireStateEnabled{false};
381384

382385
static unsigned int& ClumpOffset;
383386

Client/game_sa/CModelInfoSA.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ class CModelInfoSA : public CModelInfo
466466
// Vehicle towing functions
467467
bool IsTowableBy(CModelInfo* towingModel) override;
468468

469-
bool IsDynamic() { return m_pInterface ? m_pInterface->usDynamicIndex != 0xffff : false; };
469+
bool IsDynamic() { return m_pInterface ? m_pInterface->usDynamicIndex != MODEL_PROPERTIES_GROUP_STATIC : false; };
470470

471471
private:
472472
void CopyStreamingInfoFromModel(ushort usCopyFromModelID);

0 commit comments

Comments
 (0)