Fixes
This commit is contained in:
parent
895062a09d
commit
d409f64980
@ -86,6 +86,7 @@ enum Config {
|
|||||||
NUM_ACCIDENTS = 20,
|
NUM_ACCIDENTS = 20,
|
||||||
NUM_FIRES = 40,
|
NUM_FIRES = 40,
|
||||||
NUM_GARAGES = 32,
|
NUM_GARAGES = 32,
|
||||||
|
NUM_PROJECTILES = 32,
|
||||||
|
|
||||||
NUMPEDROUTES = 200,
|
NUMPEDROUTES = 200,
|
||||||
NUMPHONES = 50,
|
NUMPHONES = 50,
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
#include "Weapon.h"
|
#include "Weapon.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
CProjectileInfo (&gaProjectileInfo)[32] = *(CProjectileInfo(*)[32])*(uintptr*)0x64ED50;
|
CProjectileInfo (&gaProjectileInfo)[NUM_PROJECTILES] = *(CProjectileInfo(*)[NUM_PROJECTILES])*(uintptr*)0x64ED50;
|
||||||
CProjectile* (&CProjectileInfo::ms_apProjectile)[32] = *(CProjectile*(*)[32])*(uintptr*)0x87C748;
|
CProjectile* (&CProjectileInfo::ms_apProjectile)[NUM_PROJECTILES] = *(CProjectile*(*)[NUM_PROJECTILES])*(uintptr*)0x87C748;
|
||||||
|
|
||||||
void
|
void
|
||||||
CProjectileInfo::Initialise()
|
CProjectileInfo::Initialise()
|
||||||
@ -69,7 +69,7 @@ CProjectileInfo::AddProjectile(CEntity *entity, eWeaponType weapon, CVector pos,
|
|||||||
matrix.GetPosition() = pos;
|
matrix.GetPosition() = pos;
|
||||||
} else if (ped->m_pSeekTarget != nil) {
|
} else if (ped->m_pSeekTarget != nil) {
|
||||||
float ry = CGeneral::GetRadianAngleBetweenPoints(1.0f, ped->m_pSeekTarget->GetPosition().z, 1.0f, pos.z);
|
float ry = CGeneral::GetRadianAngleBetweenPoints(1.0f, ped->m_pSeekTarget->GetPosition().z, 1.0f, pos.z);
|
||||||
float rz = atan2(-ped->GetForward().x, ped->GetForward().y);
|
float rz = Atan2(-ped->GetForward().x, ped->GetForward().y);
|
||||||
vy = 0.35f * speed + 0.15f;
|
vy = 0.35f * speed + 0.15f;
|
||||||
matrix.SetTranslate(0.0f, 1.0f, 1.0f);
|
matrix.SetTranslate(0.0f, 1.0f, 1.0f);
|
||||||
matrix.Rotate(0.0f, ry, rz);
|
matrix.Rotate(0.0f, ry, rz);
|
||||||
@ -90,7 +90,7 @@ CProjectileInfo::AddProjectile(CEntity *entity, eWeaponType weapon, CVector pos,
|
|||||||
float scale = 0.22f * speed + 0.15f;
|
float scale = 0.22f * speed + 0.15f;
|
||||||
if (scale >= 0.2f)
|
if (scale >= 0.2f)
|
||||||
scale = 0.2f;
|
scale = 0.2f;
|
||||||
float angle = atan2(-ped->GetForward().x, ped->GetForward().y);
|
float angle = Atan2(-ped->GetForward().x, ped->GetForward().y);
|
||||||
matrix.SetTranslate(0.0f, 0.0f, 0.0f);
|
matrix.SetTranslate(0.0f, 0.0f, 0.0f);
|
||||||
matrix.RotateZ(angle);
|
matrix.RotateZ(angle);
|
||||||
matrix.GetPosition() += pos;
|
matrix.GetPosition() += pos;
|
||||||
@ -105,7 +105,7 @@ CProjectileInfo::AddProjectile(CEntity *entity, eWeaponType weapon, CVector pos,
|
|||||||
float scale = 0.0f;
|
float scale = 0.0f;
|
||||||
if (speed != 0.0f)
|
if (speed != 0.0f)
|
||||||
scale = 0.22f * speed + 0.15f;
|
scale = 0.22f * speed + 0.15f;
|
||||||
float angle = atan2(-ped->GetForward().x, ped->GetForward().y);;
|
float angle = Atan2(-ped->GetForward().x, ped->GetForward().y);
|
||||||
matrix.SetTranslate(0.0f, 0.0f, 0.0f);
|
matrix.SetTranslate(0.0f, 0.0f, 0.0f);
|
||||||
matrix.RotateZ(angle);
|
matrix.RotateZ(angle);
|
||||||
matrix.GetPosition() += pos;
|
matrix.GetPosition() += pos;
|
||||||
@ -170,7 +170,7 @@ CProjectileInfo::RemoveProjectile(CProjectileInfo *info, CProjectile *projectile
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CProjectileInfo::RemoveNotAdd(CEntity* entity, eWeaponType weaponType, CVector pos)
|
CProjectileInfo::RemoveNotAdd(CEntity *entity, eWeaponType weaponType, CVector pos)
|
||||||
{
|
{
|
||||||
switch (weaponType)
|
switch (weaponType)
|
||||||
{
|
{
|
||||||
@ -213,6 +213,9 @@ CProjectileInfo::Update()
|
|||||||
|| !CWorld::GetIsLineOfSightClear(gaProjectileInfo[i].m_vecPos, pos, true, true, true, true, false, false)
|
|| !CWorld::GetIsLineOfSightClear(gaProjectileInfo[i].m_vecPos, pos, true, true, true, true, false, false)
|
||||||
|| gaProjectileInfo[i].m_eWeaponType == WEAPONTYPE_ROCKETLAUNCHER && (CHeli::TestRocketCollision(&pos) || CPlane::TestRocketCollision(&pos))) {
|
|| gaProjectileInfo[i].m_eWeaponType == WEAPONTYPE_ROCKETLAUNCHER && (CHeli::TestRocketCollision(&pos) || CPlane::TestRocketCollision(&pos))) {
|
||||||
RemoveProjectile(&gaProjectileInfo[i], ms_apProjectile[i]);
|
RemoveProjectile(&gaProjectileInfo[i], ms_apProjectile[i]);
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
ms_apProjectile[i] = nil;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
CWorld::pIgnoreEntity = nil;
|
CWorld::pIgnoreEntity = nil;
|
||||||
} else if (gaProjectileInfo[i].m_eWeaponType == WEAPONTYPE_MOLOTOV) {
|
} else if (gaProjectileInfo[i].m_eWeaponType == WEAPONTYPE_MOLOTOV) {
|
||||||
@ -226,12 +229,18 @@ CProjectileInfo::Update()
|
|||||||
|| !CWorld::GetIsLineOfSightClear(gaProjectileInfo[i].m_vecPos, pos, true, true, true, true, false, false)
|
|| !CWorld::GetIsLineOfSightClear(gaProjectileInfo[i].m_vecPos, pos, true, true, true, true, false, false)
|
||||||
|| gaProjectileInfo[i].m_eWeaponType == WEAPONTYPE_ROCKETLAUNCHER && (CHeli::TestRocketCollision(&pos) || CPlane::TestRocketCollision(&pos))) {
|
|| gaProjectileInfo[i].m_eWeaponType == WEAPONTYPE_ROCKETLAUNCHER && (CHeli::TestRocketCollision(&pos) || CPlane::TestRocketCollision(&pos))) {
|
||||||
RemoveProjectile(&gaProjectileInfo[i], ms_apProjectile[i]);
|
RemoveProjectile(&gaProjectileInfo[i], ms_apProjectile[i]);
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
ms_apProjectile[i] = nil;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CWorld::pIgnoreEntity = nil;
|
CWorld::pIgnoreEntity = nil;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
RemoveProjectile(&gaProjectileInfo[i], ms_apProjectile[i]);
|
RemoveProjectile(&gaProjectileInfo[i], ms_apProjectile[i]);
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
ms_apProjectile[i] = nil;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
gaProjectileInfo[i].m_vecPos = ms_apProjectile[i]->GetPosition();
|
gaProjectileInfo[i].m_vecPos = ms_apProjectile[i]->GetPosition();
|
||||||
@ -252,6 +261,9 @@ CProjectileInfo::IsProjectileInRange(float x1, float x2, float y1, float y2, flo
|
|||||||
gaProjectileInfo[i].m_bInUse = false;
|
gaProjectileInfo[i].m_bInUse = false;
|
||||||
CWorld::Remove(ms_apProjectile[i]);
|
CWorld::Remove(ms_apProjectile[i]);
|
||||||
delete ms_apProjectile[i];
|
delete ms_apProjectile[i];
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
ms_apProjectile[i] = nil;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -268,12 +280,15 @@ CProjectileInfo::RemoveAllProjectiles()
|
|||||||
gaProjectileInfo[i].m_bInUse = false;
|
gaProjectileInfo[i].m_bInUse = false;
|
||||||
CWorld::Remove(ms_apProjectile[i]);
|
CWorld::Remove(ms_apProjectile[i]);
|
||||||
delete ms_apProjectile[i];
|
delete ms_apProjectile[i];
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
ms_apProjectile[i] = nil;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CProjectileInfo::RemoveIfThisIsAProjectile(CObject* object)
|
CProjectileInfo::RemoveIfThisIsAProjectile(CObject *object)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (ms_apProjectile[i++] != object) {
|
while (ms_apProjectile[i++] != object) {
|
||||||
|
@ -16,17 +16,17 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
static CProjectileInfo* GetProjectileInfo(int32 id);
|
static CProjectileInfo* GetProjectileInfo(int32 id);
|
||||||
static CProjectile* (&ms_apProjectile)[32];
|
static CProjectile* (&ms_apProjectile)[NUM_PROJECTILES];
|
||||||
|
|
||||||
static void Initialise();
|
static void Initialise();
|
||||||
static void Shutdown();
|
static void Shutdown();
|
||||||
static bool AddProjectile(CEntity *ped, eWeaponType weapon, CVector pos, float a4);
|
static bool AddProjectile(CEntity *ped, eWeaponType weapon, CVector pos, float speed);
|
||||||
static void RemoveProjectile(CProjectileInfo*, CProjectile*);
|
static void RemoveProjectile(CProjectileInfo *info, CProjectile *projectile);
|
||||||
static void RemoveNotAdd(CEntity *entity, eWeaponType weaponType, CVector pos);
|
static void RemoveNotAdd(CEntity *entity, eWeaponType weaponType, CVector pos);
|
||||||
static bool RemoveIfThisIsAProjectile(CObject *pObject);
|
static bool RemoveIfThisIsAProjectile(CObject *pObject);
|
||||||
static void RemoveAllProjectiles(void);
|
static void RemoveAllProjectiles();
|
||||||
static void Update();
|
static void Update();
|
||||||
static bool IsProjectileInRange(float x1, float x2, float y1, float y2, float z1, float z2, bool remove);
|
static bool IsProjectileInRange(float x1, float x2, float y1, float y2, float z1, float z2, bool remove);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern CProjectileInfo (&gaProjectileInfo)[32];
|
extern CProjectileInfo (&gaProjectileInfo)[NUM_PROJECTILES];
|
Loading…
Reference in New Issue
Block a user