mirror of
https://github.com/GTAmodding/re3.git
synced 2024-12-24 18:15:41 +00:00
Merge pull request #346 from Sergeanur/Radar2
Finished CRadar, a bit of CExplosion
This commit is contained in:
commit
31d16d395e
6 changed files with 1606 additions and 1436 deletions
|
@ -63,7 +63,6 @@ CMotionBlurStreaks
|
|||
CObject
|
||||
CPacManPickups
|
||||
CPedPath
|
||||
CRadar
|
||||
CRecordDataForChase
|
||||
CRoadBlocks
|
||||
CRubbish
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "Explosion.h"
|
||||
|
||||
WRAPPER void CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32) { EAXJMP(0x5591C0); }
|
||||
WRAPPER void CExplosion::RemoveAllExplosionsInArea(CVector, float) { EAXJMP(0x55AD40); }
|
||||
WRAPPER bool CExplosion::TestForExplosionInArea(eExplosionType, float, float, float, float, float, float) { EAXJMP(0x55AC80); }
|
||||
|
||||
WRAPPER
|
||||
int8 CExplosion::GetExplosionActiveCounter(uint8 id)
|
||||
{
|
||||
EAXJMP(0x559140);
|
||||
}
|
||||
|
||||
WRAPPER
|
||||
CVector *CExplosion::GetExplosionPosition(uint8 id)
|
||||
{
|
||||
EAXJMP(0x5591A0);
|
||||
}
|
||||
|
||||
WRAPPER
|
||||
uint8 CExplosion::GetExplosionType(uint8 id)
|
||||
{
|
||||
EAXJMP(0x559180);
|
||||
}
|
||||
|
||||
WRAPPER
|
||||
void CExplosion::ResetExplosionActiveCounter(uint8 id)
|
||||
{
|
||||
EAXJMP(0x559160);
|
||||
}
|
2834
src/core/Radar.cpp
2834
src/core/Radar.cpp
File diff suppressed because it is too large
Load diff
|
@ -59,7 +59,7 @@ struct CBlip
|
|||
int32 m_nEntityHandle;
|
||||
CVector2D m_vec2DPos;
|
||||
CVector m_vecPos;
|
||||
int16 m_BlipIndex;
|
||||
uint16 m_BlipIndex;
|
||||
bool m_bDim;
|
||||
bool m_bInUse;
|
||||
float m_Radius;
|
||||
|
@ -80,26 +80,26 @@ class CRadar
|
|||
public:
|
||||
static float &m_radarRange;
|
||||
static CBlip (&ms_RadarTrace)[NUMRADARBLIPS];
|
||||
static CSprite2d *AsukaSprite;
|
||||
static CSprite2d *BombSprite;
|
||||
static CSprite2d *CatSprite;
|
||||
static CSprite2d *CentreSprite;
|
||||
static CSprite2d *CopcarSprite;
|
||||
static CSprite2d *DonSprite;
|
||||
static CSprite2d *EightSprite;
|
||||
static CSprite2d *ElSprite;
|
||||
static CSprite2d *IceSprite;
|
||||
static CSprite2d *JoeySprite;
|
||||
static CSprite2d *KenjiSprite;
|
||||
static CSprite2d *LizSprite;
|
||||
static CSprite2d *LuigiSprite;
|
||||
static CSprite2d *NorthSprite;
|
||||
static CSprite2d *RaySprite;
|
||||
static CSprite2d *SalSprite;
|
||||
static CSprite2d *SaveSprite;
|
||||
static CSprite2d *SpraySprite;
|
||||
static CSprite2d *TonySprite;
|
||||
static CSprite2d *WeaponSprite;
|
||||
static CSprite2d AsukaSprite;
|
||||
static CSprite2d BombSprite;
|
||||
static CSprite2d CatSprite;
|
||||
static CSprite2d CentreSprite;
|
||||
static CSprite2d CopcarSprite;
|
||||
static CSprite2d DonSprite;
|
||||
static CSprite2d EightSprite;
|
||||
static CSprite2d ElSprite;
|
||||
static CSprite2d IceSprite;
|
||||
static CSprite2d JoeySprite;
|
||||
static CSprite2d KenjiSprite;
|
||||
static CSprite2d LizSprite;
|
||||
static CSprite2d LuigiSprite;
|
||||
static CSprite2d NorthSprite;
|
||||
static CSprite2d RaySprite;
|
||||
static CSprite2d SalSprite;
|
||||
static CSprite2d SaveSprite;
|
||||
static CSprite2d SpraySprite;
|
||||
static CSprite2d TonySprite;
|
||||
static CSprite2d WeaponSprite;
|
||||
static CSprite2d *RadarSprites[21];
|
||||
|
||||
public:
|
||||
|
@ -125,12 +125,11 @@ public:
|
|||
static uint32 GetRadarTraceColour(uint32 color, bool bright);
|
||||
static void Initialise();
|
||||
static float LimitRadarPoint(CVector2D &point);
|
||||
static void LoadAllRadarBlips(int32);
|
||||
static void LoadAllRadarBlips(uint8 *buf, uint32 size);
|
||||
static void LoadTextures();
|
||||
static void RemoveRadarSections();
|
||||
static void RemoveMapSection(int32 x, int32 y);
|
||||
static void RequestMapSection(int32 x, int32 y);
|
||||
static void SaveAllRadarBlips(uint8 *buf, uint32 *size);
|
||||
static void SaveAllRadarBlips(uint8*, uint32*);
|
||||
static void SetBlipSprite(int32 i, int32 icon);
|
||||
static int32 SetCoordBlip(eBlipType type, CVector pos, int32, eBlipDisplay);
|
||||
static int32 SetEntityBlip(eBlipType type, int32, int32, eBlipDisplay);
|
||||
|
|
111
src/weapons/Explosion.cpp
Normal file
111
src/weapons/Explosion.cpp
Normal file
|
@ -0,0 +1,111 @@
|
|||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "DMAudio.h"
|
||||
#include "Explosion.h"
|
||||
|
||||
CExplosion(&gaExplosion)[48] = *(CExplosion(*)[48])*(uintptr*)0x64E208;
|
||||
|
||||
WRAPPER void CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32) { EAXJMP(0x5591C0); }
|
||||
//WRAPPER void CExplosion::RemoveAllExplosionsInArea(CVector, float) { EAXJMP(0x55AD40); }
|
||||
//WRAPPER bool CExplosion::TestForExplosionInArea(eExplosionType, float, float, float, float, float, float) { EAXJMP(0x55AC80); }
|
||||
|
||||
int AudioHandle = AEHANDLE_NONE;
|
||||
|
||||
void
|
||||
CExplosion::Initialise()
|
||||
{
|
||||
debug("Initialising CExplosion...\n");
|
||||
for (int i = 0; i < ARRAY_SIZE(gaExplosion); i++) {
|
||||
gaExplosion[i].m_ExplosionType = EXPLOSION_GRENADE;
|
||||
gaExplosion[i].m_vecPosition.x = 0.0f;
|
||||
gaExplosion[i].m_vecPosition.y = 0.0f;
|
||||
gaExplosion[i].m_vecPosition.z = 0.0f;
|
||||
gaExplosion[i].m_fRadius = 1.0f;
|
||||
gaExplosion[i].m_fPropagationRate = 0.0f;
|
||||
gaExplosion[i].field_38 = 0;
|
||||
gaExplosion[i].m_pCreatorEntity = nil;
|
||||
gaExplosion[i].m_pVictimEntity = nil;
|
||||
gaExplosion[i].m_fStopTime = 0.0f;
|
||||
gaExplosion[i].m_bActive = false;
|
||||
gaExplosion[i].m_nStartTime = 0;
|
||||
gaExplosion[i].field_34 = 0;
|
||||
}
|
||||
AudioHandle = DMAudio.CreateEntity(AUDIOTYPE_EXPLOSION, (void*)1);
|
||||
if (AudioHandle >= 0)
|
||||
DMAudio.SetEntityStatus(AudioHandle, 1);
|
||||
debug("CExplosion ready\n");
|
||||
}
|
||||
|
||||
void CExplosion::Shutdown()
|
||||
{
|
||||
debug("Shutting down CExplosion...\n");
|
||||
if (AudioHandle >= 0) {
|
||||
DMAudio.DestroyEntity(AudioHandle);
|
||||
AudioHandle = AEHANDLE_NONE;
|
||||
}
|
||||
debug("CExplosion shut down\n");
|
||||
}
|
||||
|
||||
void
|
||||
CExplosion::RemoveAllExplosionsInArea(CVector pos, float radius)
|
||||
{
|
||||
for (int i = 0; i < ARRAY_SIZE(gaExplosion); i++) {
|
||||
if (gaExplosion[i].m_bActive) {
|
||||
if ((pos - gaExplosion[i].m_vecPosition).MagnitudeSqr() < SQR(radius))
|
||||
gaExplosion[i].m_bActive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int8
|
||||
CExplosion::GetExplosionActiveCounter(uint8 id)
|
||||
{
|
||||
return gaExplosion[id].m_bActiveCounter;
|
||||
}
|
||||
|
||||
CVector *
|
||||
CExplosion::GetExplosionPosition(uint8 id)
|
||||
{
|
||||
return &gaExplosion[id].m_vecPosition;
|
||||
}
|
||||
|
||||
uint8
|
||||
CExplosion::GetExplosionType(uint8 id)
|
||||
{
|
||||
return gaExplosion[id].m_ExplosionType;
|
||||
}
|
||||
|
||||
void
|
||||
CExplosion::ResetExplosionActiveCounter(uint8 id)
|
||||
{
|
||||
gaExplosion[id].m_bActiveCounter = 0;
|
||||
}
|
||||
|
||||
bool
|
||||
CExplosion::TestForExplosionInArea(eExplosionType a1, float x1, float x2, float y1, float y2, float z1, float z2)
|
||||
{
|
||||
for (int i = 0; i < ARRAY_SIZE(gaExplosion); i++) {
|
||||
if (gaExplosion[i].m_bActive) {
|
||||
if (a1 == gaExplosion[i].m_ExplosionType) {
|
||||
if (gaExplosion[i].m_vecPosition.x >= x1 && gaExplosion[i].m_vecPosition.x <= x2) {
|
||||
if (gaExplosion[i].m_vecPosition.y >= y1 && gaExplosion[i].m_vecPosition.y <= y2) {
|
||||
if (gaExplosion[i].m_vecPosition.z >= z1 && gaExplosion[i].m_vecPosition.z <= z2)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x559030, &CExplosion::Initialise, PATCH_JUMP);
|
||||
InjectHook(0x559100, &CExplosion::Shutdown, PATCH_JUMP);
|
||||
InjectHook(0x55AD40, &CExplosion::RemoveAllExplosionsInArea, PATCH_JUMP);
|
||||
InjectHook(0x559140, &CExplosion::GetExplosionActiveCounter, PATCH_JUMP);
|
||||
InjectHook(0x5591A0, &CExplosion::GetExplosionPosition, PATCH_JUMP);
|
||||
InjectHook(0x559180, &CExplosion::GetExplosionType, PATCH_JUMP);
|
||||
InjectHook(0x559160, &CExplosion::ResetExplosionActiveCounter, PATCH_JUMP);
|
||||
InjectHook(0x55AC80, &CExplosion::TestForExplosionInArea, PATCH_JUMP);
|
||||
ENDPATCHES
|
|
@ -19,7 +19,23 @@ enum eExplosionType
|
|||
|
||||
class CExplosion
|
||||
{
|
||||
eExplosionType m_ExplosionType;
|
||||
CVector m_vecPosition;
|
||||
float m_fRadius;
|
||||
float m_fPropagationRate;
|
||||
CEntity *m_pCreatorEntity;
|
||||
CEntity *m_pVictimEntity;
|
||||
float m_fStopTime;
|
||||
bool m_bActive;
|
||||
int8 m_bActiveCounter;
|
||||
int32 m_nStartTime;
|
||||
uint32 m_nParticlesExpireTime;
|
||||
float m_fPower;
|
||||
int32 field_34;
|
||||
int32 field_38;
|
||||
public:
|
||||
static void Initialise();
|
||||
static void Shutdown();
|
||||
static void AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type,
|
||||
const CVector &pos, uint32);
|
||||
|
||||
|
@ -30,3 +46,5 @@ public:
|
|||
static void RemoveAllExplosionsInArea(CVector, float);
|
||||
static bool TestForExplosionInArea(eExplosionType, float, float, float, float, float, float);
|
||||
};
|
||||
|
||||
extern CExplosion (&gaExplosion)[48];
|
Loading…
Reference in a new issue