Skip to content

Commit 5b5a88e

Browse files
committed
Merge branch 'bugfix/heli_rotor_speed' of https://github.com/FileEX/mtasa-blue into bugfix/heli_rotor_speed
2 parents 71d335f + 57d579b commit 5b5a88e

File tree

19 files changed

+1957
-1780
lines changed

19 files changed

+1957
-1780
lines changed

Client/core/CCore.cpp

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -894,30 +894,6 @@ void CCore::SetCenterCursor(bool bEnabled)
894894
m_pSetCursorPosHook->DisableSetCursorPos();
895895
}
896896

897-
// Changes visibility of the system mouse cursor within application window
898-
void CCore::SetSystemCursorVisible(bool bVisible)
899-
{
900-
if (m_pMultiplayer)
901-
{
902-
m_pMultiplayer->AllowWindowsCursorShowing(bVisible);
903-
ShowCursor(bVisible);
904-
}
905-
}
906-
907-
////////////////////////////////////////////////////////////////////////
908-
//
909-
// ShouldShowSystemCursorDuringLoad
910-
//
911-
// Whenever system cursor should be shown during game load.
912-
// It should be if game is being launched in windowed mode or user has multiple monitors and full screen minimize is disabled.
913-
//
914-
////////////////////////////////////////////////////////////////////////
915-
bool CCore::ShouldShowSystemCursorDuringLoad()
916-
{
917-
CVideoModeManagerInterface* pVidMan = GetVideoModeManager();
918-
return pVidMan->IsDisplayModeWindowed() || (pVidMan->IsMultiMonitor() && !pVidMan->IsMinimizeEnabled());
919-
}
920-
921897
////////////////////////////////////////////////////////////////////////
922898
//
923899
// LoadModule
@@ -1044,11 +1020,6 @@ void CCore::DeinitGUI()
10441020
void CCore::InitGUI(IDirect3DDevice9* pDevice)
10451021
{
10461022
m_pGUI = InitModule<CGUI>(m_GUIModule, "GUI", "InitGUIInterface", pDevice);
1047-
1048-
SetSystemCursorVisible(ShouldShowSystemCursorDuringLoad());
1049-
1050-
// Hide GUI mouse cursor during game startup
1051-
m_pGUI->SetCursorEnabled(false);
10521023
}
10531024

10541025
void CCore::CreateGUI()
@@ -1290,9 +1261,6 @@ void CCore::DoPostFramePulse()
12901261
{
12911262
m_bFirstFrame = false;
12921263

1293-
// Make sure system mouse cursor is not visible
1294-
CCore::GetSingletonPtr()->SetSystemCursorVisible(false);
1295-
12961264
// Disable vsync while it's all dark
12971265
m_pGame->DisableVSync();
12981266

Client/core/CCore.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,6 @@ class CCore : public CCoreInterface, public CSingleton<CCore>
143143
bool IsCursorControlsToggled() { return m_bCursorToggleControls; }
144144
void HideMainMenu();
145145
void SetCenterCursor(bool bEnabled);
146-
void SetSystemCursorVisible(bool bVisible);
147-
bool ShouldShowSystemCursorDuringLoad();
148146

149147
void ShowServerInfo(unsigned int WindowType);
150148

Client/core/CGUI.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ CLocalGUI::CLocalGUI()
4444

4545
m_LastSettingsRevision = -1;
4646
m_LocaleChangeCounter = 0;
47-
48-
m_StoredMousePosition = {-1, -1};
4947
}
5048

5149
CLocalGUI::~CLocalGUI()
@@ -713,7 +711,8 @@ bool CLocalGUI::InputGoesToGUI()
713711

714712
// Here we're supposed to check if things like menues are up, console is up or the chatbox is expecting input
715713
// If the console is visible OR the chat is expecting input OR the mainmenu is visible
716-
return (IsConsoleVisible() || IsMainMenuVisible() || IsChatBoxInputEnabled() || m_bForceCursorVisible || pGUI->GetGUIInputEnabled() || IsWebRequestGUIVisible());
714+
return (IsConsoleVisible() || IsMainMenuVisible() || IsChatBoxInputEnabled() || m_bForceCursorVisible || pGUI->GetGUIInputEnabled() ||
715+
!CCore::GetSingleton().IsFocused() || IsWebRequestGUIVisible());
717716
}
718717

719718
void CLocalGUI::ForceCursorVisible(bool bVisible)
@@ -727,18 +726,14 @@ void CLocalGUI::UpdateCursor()
727726

728727
static DWORD dwWidth = CDirect3DData::GetSingleton().GetViewportWidth();
729728
static DWORD dwHeight = CDirect3DData::GetSingleton().GetViewportHeight();
730-
static bool bFirstRun = true;
729+
static bool bFirstRun = true;
731730

732731
if (bFirstRun)
733732
{
734-
if (!CCore::GetSingleton().ShouldShowSystemCursorDuringLoad())
735-
{
736-
m_StoredMousePosition.x = dwWidth / 2;
737-
m_StoredMousePosition.y = dwHeight / 2;
738-
}
733+
m_StoredMousePosition.x = dwWidth / 2;
734+
m_StoredMousePosition.y = dwHeight / 2;
739735
bFirstRun = false;
740736
}
741-
742737
// Called in each frame to make sure the mouse is only visible when a GUI control that uses the
743738
// mouse requires it.
744739
if (InputGoesToGUI())
@@ -751,8 +746,7 @@ void CLocalGUI::UpdateCursor()
751746
CCore::GetSingleton ().GetGame ()->GetPad ()->Clear ();*/
752747

753748
// Restore the mouse cursor to its old position
754-
if (m_StoredMousePosition.x != -1 && m_StoredMousePosition.y != -1)
755-
SetCursorPos(m_StoredMousePosition.x, m_StoredMousePosition.y);
749+
SetCursorPos(m_StoredMousePosition.x, m_StoredMousePosition.y);
756750

757751
// Enable our mouse cursor
758752
CSetCursorPosHook::GetSingleton().DisableSetCursorPos();

Client/mods/deathmatch/logic/CClientGame.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5590,7 +5590,7 @@ void CClientGame::ResetMapInfo()
55905590
if (pPlayerInfo)
55915591
pPlayerInfo->SetCamDrunkLevel(static_cast<byte>(0));
55925592

5593-
RestreamWorld(true);
5593+
RestreamWorld();
55945594

55955595
ReinitMarkers();
55965596
}
@@ -6813,7 +6813,7 @@ void CClientGame::RestreamModel(unsigned short usModel)
68136813
m_pManager->GetVehicleManager()->RestreamVehicleUpgrades(usModel);
68146814
}
68156815

6816-
void CClientGame::RestreamWorld(bool removeBigBuildings)
6816+
void CClientGame::RestreamWorld()
68176817
{
68186818
unsigned int numberOfFileIDs = g_pGame->GetCountOfAllFileIDs();
68196819

@@ -6826,9 +6826,7 @@ void CClientGame::RestreamWorld(bool removeBigBuildings)
68266826
m_pManager->GetPedManager()->RestreamAllPeds();
68276827
m_pManager->GetPickupManager()->RestreamAllPickups();
68286828

6829-
if (removeBigBuildings)
6830-
g_pGame->GetStreaming()->RemoveBigBuildings();
6831-
6829+
g_pGame->GetStreaming()->RemoveBigBuildings();
68326830
g_pGame->GetStreaming()->ReinitStreaming();
68336831
}
68346832

Client/mods/deathmatch/logic/CClientGame.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ class CClientGame
441441

442442
bool TriggerBrowserRequestResultEvent(const std::unordered_set<SString>& newPages);
443443
void RestreamModel(unsigned short usModel);
444-
void RestreamWorld(bool removeBigBuildings);
444+
void RestreamWorld();
445445
void ReinitMarkers();
446446

447447
void OnWindowFocusChange(bool state);

Client/mods/deathmatch/logic/CClientIMG.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ bool CClientIMG::StreamDisable()
191191

192192
m_pImgManager->UpdateStreamerBufferSize();
193193

194-
g_pClientGame->RestreamWorld(true);
194+
g_pClientGame->RestreamWorld();
195195
return true;
196196
}
197197

Client/mods/deathmatch/logic/CScriptFile.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ long CScriptFile::Read(unsigned long ulSize, SString& outBuffer)
158158
DoResourceFileCheck();
159159

160160
// If read size is large, limit it to how many bytes can be read (avoid memory problems with over allocation)
161-
if (ulSize > 10000)
161+
// large : >10KB
162+
if (ulSize > 10240)
162163
{
163164
long lCurrentPos = m_pFile->FTell();
164165
m_pFile->FSeek(0, SEEK_END);
@@ -177,7 +178,18 @@ long CScriptFile::Read(unsigned long ulSize, SString& outBuffer)
177178
return -2;
178179
}
179180

180-
return m_pFile->FRead(outBuffer.data(), ulSize);
181+
auto bytesRead = m_pFile->FRead(outBuffer.data(), ulSize);
182+
183+
// EOF reached?
184+
// Cant check for error as binary interface
185+
// is pure virtual class with no definitions
186+
// available (CNetServer)
187+
if (m_pFile->FEof())
188+
{
189+
// if so, truncate the data to the amount of bytes read
190+
outBuffer.resize(bytesRead + 1);
191+
}
192+
return bytesRead;
181193
}
182194

183195
long CScriptFile::Write(unsigned long ulSize, const char* pData)

Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,6 +1268,11 @@ void CheckCanModifyOtherResource(CScriptArgReader& argStream, CResource* pThisRe
12681268
// No operation on the client
12691269
}
12701270

1271+
std::pair<bool, std::string> CheckCanModifyOtherResource(CResource* pThisResource, CResource* pOtherResource) noexcept
1272+
{
1273+
return {true, ""};
1274+
}
1275+
12711276
//
12721277
// Set error if pThisResource does not have permission to modify every resource in resourceList
12731278
//
@@ -1276,6 +1281,11 @@ void CheckCanModifyOtherResources(CScriptArgReader& argStream, CResource* pThisR
12761281
// No operation on the client
12771282
}
12781283

1284+
std::pair<bool, std::string> CheckCanModifyOtherResources(CResource* pThisResource, std::initializer_list<CResource*> resourceList) noexcept
1285+
{
1286+
return {true, ""};
1287+
}
1288+
12791289
//
12801290
// Set error if resource file access is blocked due to reasons
12811291
//
@@ -1284,3 +1294,8 @@ void CheckCanAccessOtherResourceFile(CScriptArgReader& argStream, CResource* pTh
12841294
{
12851295
// No operation on the client
12861296
}
1297+
1298+
std::pair<bool, std::string> CheckCanAccessOtherResourceFile(CResource* pThisResource, CResource* pOtherResource, const SString& strAbsPath, bool* pbReadOnly) noexcept
1299+
{
1300+
return {true, ""};
1301+
}

Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,9 +590,13 @@ void ReadPregFlags(CScriptArgReader& argStream, pcrecpp::RE_Options& pOptions);
590590
// Resource access helpers
591591
//
592592
void CheckCanModifyOtherResource(CScriptArgReader& argStream, CResource* pThisResource, CResource* pOtherResource);
593+
std::pair<bool, std::string> CheckCanModifyOtherResource(CResource* pThisResource, CResource* pOtherResource) noexcept;
593594
void CheckCanModifyOtherResources(CScriptArgReader& argStream, CResource* pThisResource, std::initializer_list<CResource*> resourceList);
594-
void CheckCanAccessOtherResourceFile(CScriptArgReader& argStream, CResource* pThisResource, CResource* pOtherResource, const SString& strAbsPath,
595+
std::pair<bool, std::string> CheckCanModifyOtherResources(CResource* pThisResource, std::initializer_list<CResource*> resourceList) noexcept;
596+
void CheckCanAccessOtherResourceFile(CScriptArgReader& argStream, CResource* pThisResource, CResource* pOtherResource, const SString& strAbsPath,
595597
bool* pbReadOnly = nullptr);
598+
std::pair<bool, std::string> CheckCanAccessOtherResourceFile(CResource* pThisResource, CResource* pOtherResource, const SString& strAbsPath,
599+
bool* pbReadOnly = nullptr) noexcept;
596600

597601
//
598602
// Other misc helpers

Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2428,14 +2428,9 @@ bool CLuaEngineDefs::EngineResetModelFlags(uint uiModelID)
24282428
return false;
24292429
}
24302430

2431-
bool CLuaEngineDefs::EngineRestreamWorld(lua_State* const luaVM)
2431+
bool CLuaEngineDefs::EngineRestreamWorld()
24322432
{
2433-
bool restreamLODs{};
2434-
2435-
CScriptArgReader argStream(luaVM);
2436-
argStream.ReadBool(restreamLODs, false);
2437-
2438-
g_pClientGame->RestreamWorld(restreamLODs);
2433+
g_pClientGame->RestreamWorld();
24392434
return true;
24402435
}
24412436

0 commit comments

Comments
 (0)