Skip to content

Commit 15780de

Browse files
authored
Merge branch 'master' into feature/custom_projectiles
2 parents 5883f75 + 5754c02 commit 15780de

File tree

25 files changed

+2156
-1975
lines changed

25 files changed

+2156
-1975
lines changed

.github/workflows/codeql.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ jobs:
4747
build-mode: none
4848
- language: c-cpp
4949
build-mode: autobuild
50-
- language: javascript-typescript
51-
build-mode: none
52-
- language: python
53-
build-mode: none
5450
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
5551
# Use `c-cpp` to analyze code written in C, C++ or both
5652
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both

Client/game_sa/CRenderWareSA.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,18 @@ RpClump* CRenderWareSA::ReadDFF(const SString& strFilename, const SString& buffe
285285

286286
// rockstar's collision hack: set the global particle emitter to the modelinfo pointer of this model
287287
if (bLoadEmbeddedCollisions)
288+
{
289+
// Vehicles have their collision loaded through the CollisionModel plugin, so we need to remove the current collision to prevent a memory leak.
290+
// This needs to be done here before reading the stream data, because plugins are read in RpClumpStreamRead.
291+
CModelInfo* modelInfo = pGame->GetModelInfo(usModelID);
292+
if (modelInfo)
293+
{
294+
if (auto* modelInfoInterface = modelInfo->GetInterface())
295+
((void(__thiscall*)(CBaseModelInfoSAInterface*))0x4C4C40)(modelInfoInterface); // CBaseModelInfo::DeleteCollisionModel
296+
}
297+
288298
RpPrtStdGlobalDataSetStreamEmbedded((void*)pPool[usModelID]);
299+
}
289300

290301
// read the clump with all its extensions
291302
RpClump* pClump = RpClumpStreamRead(streamModel);

Client/game_sa/TaskJumpFallSA.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class CTaskSimpleClimbSAInterface : public CTaskSimpleSAInterface
3131
bool m_bChangePosition;
3232
bool m_bForceClimb;
3333
bool m_bInvalidClimb;
34-
char m_nHeightForAnim;
35-
char m_nHeightForPos;
34+
eClimbHeights m_nHeightForAnim;
35+
eClimbHeights m_nHeightForPos;
3636
unsigned char m_nSurfaceType;
3737
char m_nFallAfterVault;
3838
float m_fHandholdHeading;
@@ -49,6 +49,8 @@ class CTaskSimpleClimbSA : public virtual CTaskSimpleSA, public virtual CTaskSim
4949
CTaskSimpleClimbSA(){};
5050
CTaskSimpleClimbSA(CEntity* pClimbEnt, const CVector& vecTarget, float fHeading, unsigned char nSurfaceType, char nHeight = CLIMB_GRAB,
5151
const bool bForceClimb = false);
52+
53+
eClimbHeights GetHeightForPos() const override { return static_cast<const CTaskSimpleClimbSAInterface*>(GetInterface())->m_nHeightForPos; }
5254
};
5355

5456
// ##############################################################################

Client/mods/deathmatch/logic/CClientPed.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ void CClientPed::Init(CClientManager* pManager, unsigned long ulModelID, bool bI
241241
m_MovementStateNames[MOVEMENTSTATE_ASCENT_JETPACK] = "ascent_jetpack";
242242
m_MovementStateNames[MOVEMENTSTATE_DESCENT_JETPACK] = "descent_jetpack";
243243
m_MovementStateNames[MOVEMENTSTATE_JETPACK] = "jetpack_flying";
244+
m_MovementStateNames[MOVEMENTSTATE_HANGING] = "hanging";
244245

245246
// Create the player model
246247
if (m_bIsLocalPlayer)
@@ -2426,7 +2427,13 @@ eMovementState CClientPed::GetMovementState()
24262427

24272428
// Check tasks
24282429
if (strcmp(szSimpleTaskName, "TASK_SIMPLE_CLIMB") == 0) // Is he climbing?
2430+
{
2431+
CTaskSimpleClimb* climbingTask = dynamic_cast<CTaskSimpleClimb*>(GetTaskManager()->GetSimplestActiveTask());
2432+
if (climbingTask && climbingTask->GetHeightForPos() == eClimbHeights::CLIMB_GRAB)
2433+
return MOVEMENTSTATE_HANGING;
2434+
24292435
return MOVEMENTSTATE_CLIMB;
2436+
}
24302437
else if (strcmp(szComplexTaskName, "TASK_COMPLEX_JUMP") == 0) // Is he jumping?
24312438
return MOVEMENTSTATE_JUMP;
24322439
else if (strcmp(szSimpleTaskName, "TASK_SIMPLE_GO_TO_POINT") == 0) // Entering vehicle (walking to the doors)?

Client/mods/deathmatch/logic/CClientPed.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ enum eMovementState
8282
MOVEMENTSTATE_ASCENT_JETPACK, // Ascending with jetpack
8383
MOVEMENTSTATE_DESCENT_JETPACK, // Descending with jetpack
8484
MOVEMENTSTATE_JETPACK, // Jetpack flying
85+
MOVEMENTSTATE_HANGING, // Hanging from the whall during climbing task
8586
};
8687

8788
enum eDeathAnims

Client/mods/deathmatch/logic/lua/CLuaFunctionDefs.Util.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ int CLuaFunctionDefs::GetKeyboardLayout(lua_State* luaVM)
238238
case 0: // Left to right (English)
239239
readingLayout = "ltr";
240240
break;
241-
case 1: // Right to left (Arabic, Hebrew)
241+
case 1: // Right to left (Arabic, Hebrew, and Persian)
242242
readingLayout = "rtl";
243243
break;
244244
case 2: // Vertical top to bottom with columns to the left and also left to right (Japanese)

Client/sdk/game/CTasks.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class CVehicle;
5252
typedef unsigned long AssocGroupId;
5353
typedef unsigned long AnimationId;
5454

55-
enum eClimbHeights
55+
enum eClimbHeights : std::int8_t
5656
{
5757
CLIMB_NOT_READY = 0,
5858
CLIMB_GRAB,

Client/sdk/game/TaskJumpFall.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@
1313

1414
#include "Task.h"
1515

16+
enum eClimbHeights : std::int8_t;
17+
1618
class CTaskSimpleClimb : public virtual CTaskSimple
1719
{
1820
public:
1921
virtual ~CTaskSimpleClimb(){};
22+
23+
virtual eClimbHeights GetHeightForPos() const = 0;
2024
};
2125

2226
class CTaskSimpleJetPack : public virtual CTaskSimple

Server/mods/deathmatch/logic/CGame.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ CGame::~CGame()
421421
SAFE_DELETE(m_pASE);
422422
SAFE_RELEASE(m_pHqComms);
423423
CSimControl::Shutdown();
424+
CThreadPool::getDefaultThreadPool().shutdown();
424425

425426
// Clear our global pointer
426427
g_pGame = NULL;

Shared/XML/CXMLNodeImpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ void CXMLNodeImpl::SetTagContent(float fContent)
328328
{
329329
// Convert to string and set it
330330
char szBuffer[40];
331-
sprintf(szBuffer, "%f", fContent);
331+
snprintf(szBuffer, sizeof(szBuffer), "%f", fContent);
332332
SetTagContent(szBuffer);
333333
}
334334

0 commit comments

Comments
 (0)