blob: dbc38b9dbbc18701a1898b8ce29a60ee97b31862 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#include "common.h"
#include "patcher.h"
#include "Pools.h"
#include "Radar.h"
#include "Object.h"
WRAPPER void CObject::ObjectDamage(float amount) { EAXJMP(0x4BB240); }
int16 &CObject::nNoTempObjects = *(int16*)0x95CCA2;
void *CObject::operator new(size_t sz) { return CPools::GetObjectPool()->New(); }
void CObject::operator delete(void *p, size_t sz) { CPools::GetObjectPool()->Delete((CObject*)p); }
CObject::CObject(void)
{
m_type = ENTITY_TYPE_OBJECT;
m_fUprootLimit = 0.0f;
m_nCollisionDamageEffect = 0;
m_nSpecialCollisionResponseCases = COLLRESPONSE_NONE;
m_bCameraToAvoidThisObject = false;
ObjectCreatedBy = 0;
m_nEndOfLifeTime = 0;
// m_nRefModelIndex = -1; // duplicate
// bUseVehicleColours = false; // duplicate
m_colour2 = 0;
m_colour1 = m_colour2;
field_172 = 0;
bIsPickup = false;
m_obj_flag2 = false;
m_obj_flag4 = false;
m_obj_flag8 = false;
m_obj_flag10 = false;
bHasBeenDamaged = false;
m_nRefModelIndex = -1;
bUseVehicleColours = false;
m_pCurSurface = nil;
m_pCollidingEntity = nil;
}
CObject::~CObject(void)
{
CRadar::ClearBlipForEntity(BLIP_OBJECT, CPools::GetObjectPool()->GetIndex(this));
if(m_nRefModelIndex != -1)
CModelInfo::GetModelInfo(m_nRefModelIndex)->RemoveRef();
if(ObjectCreatedBy == TEMP_OBJECT && nNoTempObjects != 0)
nNoTempObjects--;
}
void
CObject::Render(void)
{
if(m_flagD80)
return;
if(m_nRefModelIndex != -1 && ObjectCreatedBy == TEMP_OBJECT && bUseVehicleColours){
CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(m_nRefModelIndex);
assert(mi->m_type == MITYPE_VEHICLE);
mi->SetVehicleColour(m_colour1, m_colour2);
}
CEntity::Render();
}
WRAPPER void CObject::DeleteAllTempObjectInArea(CVector, float) { EAXJMP(0x4BBED0); }
STARTPATCHES
InjectHook(0x4BAE00, &CObject::dtor, PATCH_JUMP);
InjectHook(0x4BB1E0, &CObject::Render_, PATCH_JUMP);
ENDPATCHES
|