Skip to content

Commit

Permalink
Merge branch 'master' into TheNormalnij/fix_building_restore
Browse files Browse the repository at this point in the history
  • Loading branch information
Dutchman101 authored Jun 2, 2024
2 parents d748845 + 6702200 commit d3039d7
Show file tree
Hide file tree
Showing 310 changed files with 95,423 additions and 46,539 deletions.
22 changes: 22 additions & 0 deletions Client/game_sa/CBuildingsPoolSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ bool CBuildingsPoolSA::Resize(int size)
pGame->GetPools()->GetDummyPool().UpdateBuildingLods(oldPool, newObjects);

RemoveVehicleDamageLinks();
RemovePedsContactEnityLinks();

return true;
}
Expand Down Expand Up @@ -310,6 +311,27 @@ void CBuildingsPoolSA::RemoveVehicleDamageLinks()
}
}

void CBuildingsPoolSA::RemovePedsContactEnityLinks()
{
const int count = pGame->GetPools()->GetPedCount();
for (int i = 0; i < count; i++)
{
auto* pedLinks = pGame->GetPools()->GetPed(i);
if (pedLinks->pEntity)
{
CPedSAInterface* ped = pedLinks->pEntity->GetPedInterface();
ped->m_pCollidedEntity = nullptr;
ped->pContactEntity = nullptr;
ped->pLastContactedEntity[0] = nullptr;
ped->pLastContactedEntity[1] = nullptr;
ped->pLastContactedEntity[2] = nullptr;
ped->pLastContactedEntity[3] = nullptr;
ped->m_ucCollisionState = 0;
ped->pTargetedEntity = nullptr;
}
}
}

bool CBuildingsPoolSA::HasFreeBuildingSlot()
{
return (*m_ppBuildingPoolInterface)->GetFreeSlot() != -1;
Expand Down
1 change: 1 addition & 0 deletions Client/game_sa/CBuildingsPoolSA.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class CBuildingsPoolSA : public CBuildingsPool
void UpdateIplEntrysPointers(uint32_t offset);
void UpdateBackupLodPointers(uint32_t offset);
void RemoveVehicleDamageLinks();
void RemovePedsContactEnityLinks();

private:
SPoolData<CBuildingSA, CBuildingSAInterface, MAX_BUILDINGS> m_buildingPool;
Expand Down
2 changes: 1 addition & 1 deletion Client/game_sa/CPedSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ CVehicle* CPedSA::GetVehicle()
{
if (((CPedSAInterface*)GetInterface())->pedFlags.bInVehicle)
{
CVehicleSAInterface* vehicle = (CVehicleSAInterface*)(((CPedSAInterface*)GetInterface())->CurrentObjective);
CVehicleSAInterface* vehicle = (CVehicleSAInterface*)(((CPedSAInterface*)GetInterface())->pVehicle);
if (vehicle)
{
SClientEntity<CVehicleSA>* pVehicleClientEntity = pGame->GetPools()->GetVehicle((DWORD*)vehicle);
Expand Down
18 changes: 13 additions & 5 deletions Client/game_sa/CPedSA.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ class CPedWeaponAudioEntitySAInterface
public:
};

class CVehicleSAInterface;

class CPedSAInterface : public CPhysicalSAInterface // +1420 = current vehicle 312 first byte
{
public:
Expand Down Expand Up @@ -239,11 +241,17 @@ class CPedSAInterface : public CPhysicalSAInterface // +1420 = curre
float fCurrentRotation;
float fTargetRotation;
float fRotationSpeed;
BYTE bPad8[4];
CEntitySAInterface* pContactEntity;
BYTE bPad3[32];
CEntitySAInterface* CurrentObjective; // current vehicle 1420
BYTE bPad2[8]; // 1424
float fMoveAnim;
CPedSAInterface* unkPed;
CVector unk_56C;
CVector unk_578;

CEntitySAInterface* pContactEntity;
CVehicleSAInterface* pLastVehicle;
CVehicleSAInterface* pVehicle;

int unk_590;
int unk_594;
BYTE bPedType; // ped type? 0 = player, >1 = ped? // 1432
BYTE bPad9[7];
CWeaponSAInterface Weapons[WEAPONSLOT_MAX];
Expand Down
1 change: 1 addition & 0 deletions Client/game_sa/CPoolsSA.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class CPoolsSA : public CPools
public:
void RemovePed(CPed* ped, bool bDelete = true);
SClientEntity<CPedSA>* GetPed(DWORD* pGameInterface);
SClientEntity<CPedSA>* GetPed(size_t pos) { return &m_pedPool.arrayOfClientEntities[pos]; };
CPed* GetPedFromRef(DWORD dwGameRef);
CPedSAInterface* GetPedInterface(DWORD dwGameRef); // game_sa specific
unsigned long GetPedCount() { return m_pedPool.ulCount; }
Expand Down
8 changes: 4 additions & 4 deletions Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1959,8 +1959,8 @@ int CLuaEngineDefs::EngineGetModelPhysicalPropertiesGroup(lua_State* luaVM)
int CLuaEngineDefs::EngineSetModelPhysicalPropertiesGroup(lua_State* luaVM)
{
// bool engineSetModelPhysicalPropertiesGroup ( int modelID, int newGroup )
int iModelID;
unsigned int iNewGroup;
int iModelID;
int iNewGroup;

CScriptArgReader argStream(luaVM);
argStream.ReadNumber(iModelID);
Expand All @@ -1974,9 +1974,9 @@ int CLuaEngineDefs::EngineSetModelPhysicalPropertiesGroup(lua_State* luaVM)
return luaL_error(luaVM, argStream.GetFullErrorMessage());
}

if (iNewGroup < 0 || iNewGroup > 159)
if (iNewGroup < -1 || iNewGroup > 159)
{
argStream.SetCustomError("Expected group ID in range [0-159] at argument 1");
argStream.SetCustomError("Expected group ID in range [0-159] or -1 at argument 1");
return luaL_error(luaVM, argStream.GetFullErrorMessage());
}

Expand Down
1 change: 1 addition & 0 deletions Client/sdk/game/CPools.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class CPools
virtual void RemovePed(CPed* pPed, bool bDelete = true) = 0;

virtual SClientEntity<CPedSA>* GetPed(DWORD* pGameInterface) = 0; // not sure we really want this here
virtual SClientEntity<CPedSA>* GetPed(size_t pos) = 0;
virtual CPed* GetPedFromRef(DWORD dwGameRef) = 0;
virtual unsigned long GetPedCount() = 0;

Expand Down
5 changes: 0 additions & 5 deletions vendor/mbedtls/3rdparty/everest/README.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
*
* This file is part of Mbed TLS (https://tls.mbed.org)
*/
#ifndef _BSD_SOURCE
/* Required to get htole64() from gcc/glibc's endian.h (older systems)
* when we compile with -std=c99 */
#define _BSD_SOURCE
#endif
#ifndef _DEFAULT_SOURCE
/* (modern version of _BSD_SOURCE) */
#define _DEFAULT_SOURCE
#endif

#include "common.h"

Expand Down
Loading

0 comments on commit d3039d7

Please sign in to comment.