mirror of
https://github.com/GTAmodding/re3.git
synced 2024-12-25 18:55:40 +00:00
Fixing Projectile code
This commit is contained in:
parent
f9316d9cc3
commit
f7e962beaa
8 changed files with 47 additions and 34 deletions
|
@ -8,7 +8,6 @@
|
||||||
#include "Automobile.h"
|
#include "Automobile.h"
|
||||||
#include "Boat.h"
|
#include "Boat.h"
|
||||||
#include "Bridge.h"
|
#include "Bridge.h"
|
||||||
#include "CProjectileInfo.h"
|
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "DMAudio.h"
|
#include "DMAudio.h"
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
|
@ -25,6 +24,8 @@
|
||||||
#include "Plane.h"
|
#include "Plane.h"
|
||||||
#include "PlayerPed.h"
|
#include "PlayerPed.h"
|
||||||
#include "Pools.h"
|
#include "Pools.h"
|
||||||
|
#include "Projectile.h"
|
||||||
|
#include "ProjectileInfo.h"
|
||||||
#include "Replay.h"
|
#include "Replay.h"
|
||||||
#include "Stats.h"
|
#include "Stats.h"
|
||||||
#include "SurfaceTable.h"
|
#include "SurfaceTable.h"
|
||||||
|
@ -6954,7 +6955,7 @@ cAudioManager::ProcessProjectiles()
|
||||||
}
|
}
|
||||||
m_sQueueSample.field_48 = 4.0;
|
m_sQueueSample.field_48 = 4.0;
|
||||||
m_sQueueSample.field_76 = 3;
|
m_sQueueSample.field_76 = 3;
|
||||||
m_sQueueSample.m_vecPos = CProjectileInfo::ms_apProjectile[i].GetPosition();
|
m_sQueueSample.m_vecPos = CProjectileInfo::ms_apProjectile[i]->GetPosition();
|
||||||
float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos);
|
float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos);
|
||||||
if(distSquared < maxDist) {
|
if(distSquared < maxDist) {
|
||||||
m_sQueueSample.m_fDistance = Sqrt(distSquared);
|
m_sQueueSample.m_fDistance = Sqrt(distSquared);
|
||||||
|
|
|
@ -57,7 +57,7 @@ CObjectData::Initialise(const char *filename)
|
||||||
&ms_aObjectInfo[id].m_fCollisionDamageMultiplier,
|
&ms_aObjectInfo[id].m_fCollisionDamageMultiplier,
|
||||||
&damageEffect, &responseCase, &camAvoid);
|
&damageEffect, &responseCase, &camAvoid);
|
||||||
|
|
||||||
ms_aObjectInfo[id].m_fBuoyancy = 100.0f/percentSubmerged * 0.008*ms_aObjectInfo[id].m_fMass;
|
ms_aObjectInfo[id].m_fBuoyancy = 100.0f/percentSubmerged * GRAVITY *ms_aObjectInfo[id].m_fMass;
|
||||||
ms_aObjectInfo[id].m_nCollisionDamageEffect = damageEffect;
|
ms_aObjectInfo[id].m_nCollisionDamageEffect = damageEffect;
|
||||||
ms_aObjectInfo[id].m_nSpecialCollisionResponseCases = responseCase;
|
ms_aObjectInfo[id].m_nSpecialCollisionResponseCases = responseCase;
|
||||||
ms_aObjectInfo[id].m_bCameraToAvoidThisObject = camAvoid;
|
ms_aObjectInfo[id].m_bCameraToAvoidThisObject = camAvoid;
|
||||||
|
|
|
@ -2,12 +2,26 @@
|
||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
#include "Projectile.h"
|
#include "Projectile.h"
|
||||||
|
|
||||||
|
CProjectile::CProjectile(int32 model) : CObject()
|
||||||
|
{
|
||||||
|
m_fMass = 1.0f;
|
||||||
|
m_fTurnMass = 1.0f;
|
||||||
|
m_fAirResistance = 0.99f;
|
||||||
|
m_fElasticity = 0.75f;
|
||||||
|
m_fBuoyancy = GRAVITY * m_fMass * 0.1f;
|
||||||
|
bExplosionProof = true;
|
||||||
|
SetModelIndex(model);
|
||||||
|
ObjectCreatedBy = MISSION_OBJECT;
|
||||||
|
}
|
||||||
|
|
||||||
class CProjectile_ : public CProjectile
|
class CProjectile_ : public CProjectile
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
CProjectile* ctor(int32 model) { return ::new (this) CProjectile(model); }
|
||||||
void dtor(void) { CProjectile::~CProjectile(); }
|
void dtor(void) { CProjectile::~CProjectile(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
STARTPATCHES
|
STARTPATCHES
|
||||||
|
InjectHook(0x4BFE30, &CProjectile_::ctor, PATCH_JUMP);
|
||||||
InjectHook(0x4BFED0, &CProjectile_::dtor, PATCH_JUMP);
|
InjectHook(0x4BFED0, &CProjectile_::dtor, PATCH_JUMP);
|
||||||
ENDPATCHES
|
ENDPATCHES
|
||||||
|
|
|
@ -7,4 +7,5 @@
|
||||||
class CProjectile : public CObject
|
class CProjectile : public CObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
CProjectile(int32);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
#include "CProjectileInfo.h"
|
|
||||||
|
|
||||||
CProjectileInfo *gaProjectileInfo = (CProjectileInfo *)0x64ED50;
|
|
||||||
CProjectileInfo *CProjectileInfo::ms_apProjectile = (CProjectileInfo *)0x87C748;
|
|
||||||
|
|
||||||
CProjectileInfo *
|
|
||||||
CProjectileInfo::GetProjectileInfo(int32 id)
|
|
||||||
{
|
|
||||||
return &gaProjectileInfo[id];
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Object.h"
|
|
||||||
#include "Weapon.h"
|
|
||||||
|
|
||||||
struct CProjectileInfo : public CObject {
|
|
||||||
eWeaponType m_eWeaponType;
|
|
||||||
CEntity *m_pSource;
|
|
||||||
int m_nExplosionTime;
|
|
||||||
char m_bInUse;
|
|
||||||
char field_13;
|
|
||||||
char field_14;
|
|
||||||
char field_15;
|
|
||||||
CVector m_vecPos;
|
|
||||||
|
|
||||||
static CProjectileInfo *GetProjectileInfo(int32 id);
|
|
||||||
static CProjectileInfo *ms_apProjectile;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern CProjectileInfo *gaProjectileInfo;
|
|
|
@ -3,6 +3,15 @@
|
||||||
#include "ProjectileInfo.h"
|
#include "ProjectileInfo.h"
|
||||||
#include "Projectile.h"
|
#include "Projectile.h"
|
||||||
|
|
||||||
|
CProjectileInfo* gaProjectileInfo = (CProjectileInfo*)0x64ED50;
|
||||||
|
CProjectile* (&CProjectileInfo::ms_apProjectile)[32] = *(CProjectile*(*)[32])*(uintptr*)0x87C748;
|
||||||
|
|
||||||
WRAPPER void CProjectileInfo::RemoveAllProjectiles(void) { EAXJMP(0x55BB80); }
|
WRAPPER void CProjectileInfo::RemoveAllProjectiles(void) { EAXJMP(0x55BB80); }
|
||||||
WRAPPER bool CProjectileInfo::RemoveIfThisIsAProjectile(CObject *pObject) { EAXJMP(0x55BBD0); }
|
WRAPPER bool CProjectileInfo::RemoveIfThisIsAProjectile(CObject *pObject) { EAXJMP(0x55BBD0); }
|
||||||
WRAPPER bool CProjectileInfo::IsProjectileInRange(float x1, float x2, float y1, float y2, float z1, float z2, bool remove) { EAXJMP(0x55BA50); }
|
WRAPPER bool CProjectileInfo::IsProjectileInRange(float x1, float x2, float y1, float y2, float z1, float z2, bool remove) { EAXJMP(0x55BA50); }
|
||||||
|
|
||||||
|
CProjectileInfo*
|
||||||
|
CProjectileInfo::GetProjectileInfo(int32 id)
|
||||||
|
{
|
||||||
|
return &gaProjectileInfo[id];
|
||||||
|
}
|
||||||
|
|
|
@ -1,11 +1,29 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
class CEntity;
|
||||||
class CObject;
|
class CObject;
|
||||||
|
class CProjectile;
|
||||||
|
enum eWeaponType;
|
||||||
|
|
||||||
class CProjectileInfo
|
class CProjectileInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
eWeaponType m_eWeaponType;
|
||||||
|
CEntity* m_pSource;
|
||||||
|
int m_nExplosionTime;
|
||||||
|
char m_bInUse;
|
||||||
|
char field_13;
|
||||||
|
char field_14;
|
||||||
|
char field_15;
|
||||||
|
CVector m_vecPos;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static CProjectileInfo* GetProjectileInfo(int32 id);
|
||||||
|
static CProjectile* (&ms_apProjectile)[32];
|
||||||
|
|
||||||
static bool RemoveIfThisIsAProjectile(CObject *pObject);
|
static bool RemoveIfThisIsAProjectile(CObject *pObject);
|
||||||
static void RemoveAllProjectiles(void);
|
static void RemoveAllProjectiles(void);
|
||||||
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;
|
Loading…
Reference in a new issue