mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-12-27 02:01:48 +01:00
PlayBackThisFrameInterpolation and all it required...
This commit is contained in:
parent
b2b750bc90
commit
e2bd3573b4
@ -1,3 +1,7 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "BulletTraces.h"
|
||||
|
||||
CBulletTrace (&CBulletTraces::aTraces)[16] = *(CBulletTrace(*)[16])*(uintptr*)0x72B1B8;
|
||||
|
||||
WRAPPER void CBulletTraces::Init(void) { EAXJMP(0x518DE0); }
|
||||
|
@ -6,4 +6,6 @@ class CBulletTraces
|
||||
{
|
||||
public:
|
||||
static CBulletTrace(&aTraces)[16];
|
||||
|
||||
static void Init(void);
|
||||
};
|
||||
|
@ -1282,4 +1282,6 @@ STARTPATCHES
|
||||
InjectHook(0x45E3A0, &CCam::Process_FollowPed, PATCH_JUMP);
|
||||
InjectHook(0x45BE60, &CCam::Process_BehindCar, PATCH_JUMP);
|
||||
InjectHook(0x45C090, &CCam::Process_Cam_On_A_String, PATCH_JUMP);
|
||||
|
||||
InjectHook(0x473250, &CCamera::dtor, PATCH_JUMP);
|
||||
ENDPATCHES
|
||||
|
@ -459,6 +459,8 @@ int m_iModeObbeCamIsInForCar;
|
||||
void RenderMotionBlur(void);
|
||||
|
||||
void DrawBordersForWideScreen(void);
|
||||
|
||||
void dtor(void) { this->CCamera::~CCamera(); }
|
||||
};
|
||||
static_assert(offsetof(CCamera, m_WideScreenOn) == 0x70, "CCamera: error");
|
||||
static_assert(offsetof(CCamera, WorldViewerBeingUsed) == 0x75, "CCamera: error");
|
||||
|
7
src/EmergencyPed.cpp
Normal file
7
src/EmergencyPed.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "EmergencyPed.h"
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x4C2EF0, &CEmergencyPed::dtor, PATCH_JUMP);
|
||||
ENDPATCHES
|
5
src/Fire.cpp
Normal file
5
src/Fire.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "Fire.h"
|
||||
|
||||
WRAPPER void CFire::Extinguish(void) { EAXJMP(0x479D40); }
|
23
src/Fire.h
Normal file
23
src/Fire.h
Normal file
@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
#include "common.h"
|
||||
#include "Entity.h"
|
||||
|
||||
class CFire
|
||||
{
|
||||
char m_bIsOngoing;
|
||||
char m_bExists;
|
||||
char m_bPropogationFlag;
|
||||
char m_bAudioSet;
|
||||
CVector m_vecPos;
|
||||
CEntity *m_pEntity;
|
||||
CEntity *m_pSource;
|
||||
int m_nExtinguishTime;
|
||||
int m_nStartTime;
|
||||
int field_20;
|
||||
int field_24;
|
||||
int field_28;
|
||||
float field_2C;
|
||||
|
||||
public:
|
||||
void Extinguish(void);
|
||||
};
|
7
src/MloInstance.cpp
Normal file
7
src/MloInstance.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "MloInstance.h"
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x50BE90, &CMloInstance::dtor, PATCH_JUMP);
|
||||
ENDPATCHES
|
9
src/MloInstance.h
Normal file
9
src/MloInstance.h
Normal file
@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "Placeable.h"
|
||||
|
||||
class CMloInstance : CPlaceable
|
||||
{
|
||||
public:
|
||||
void dtor() { this->CMloInstance::~CMloInstance(); }
|
||||
};
|
@ -4,7 +4,6 @@
|
||||
|
||||
WRAPPER void CParticleObject::AddObject(uint16, const CVector &pos, bool remove) { EAXJMP(0x4BC4D0); }
|
||||
|
||||
|
||||
// Converted from static void __cdecl CParticleObject::Initialise() 0x42C760
|
||||
void CParticleObject::Initialise()
|
||||
{
|
||||
@ -15,4 +14,8 @@ void CParticleObject::Initialise()
|
||||
void CParticleObject::UpdateAll()
|
||||
{
|
||||
((void (__cdecl *)())0x4BCA30)();
|
||||
}
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x4BC420, &CParticleObject::dtor, PATCH_JUMP);
|
||||
ENDPATCHES
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "Placeable.h"
|
||||
|
||||
enum eParticleObjectType
|
||||
{
|
||||
POBJECT_PAVEMENT_STEAM,
|
||||
@ -24,10 +26,12 @@ enum eParticleObjectType
|
||||
POBJECT_CATALINAS_SHOTGUNFLASH,
|
||||
};
|
||||
|
||||
class CParticleObject
|
||||
class CParticleObject : CPlaceable
|
||||
{
|
||||
public:
|
||||
static void AddObject(uint16, const CVector &pos, bool remove);
|
||||
static void Initialise();
|
||||
static void UpdateAll();
|
||||
|
||||
void dtor() { this->CParticleObject::~CParticleObject(); }
|
||||
};
|
||||
|
@ -27,3 +27,4 @@ WRAPPER void cDMAudio::SetMusicFadeVol(uint8) { EAXJMP(0x57C920); }
|
||||
WRAPPER int32 cDMAudio::CreateEntity(int, void*) { EAXJMP(0x57C7C0); }
|
||||
WRAPPER void cDMAudio::SetEntityStatus(int32 id, uint8 enable) { EAXJMP(0x57C810); }
|
||||
WRAPPER void cDMAudio::SetRadioInCar(int32) { EAXJMP(0x57CE60); }
|
||||
WRAPPER void cDMAudio::DestroyEntity(int32) { EAXJMP(0x57C7F0); }
|
||||
|
@ -196,6 +196,6 @@ public:
|
||||
void SetEntityStatus(int32 id, uint8 enable);
|
||||
void SetRadioInCar(int32);
|
||||
uint8 IsMP3RadioChannelAvailable();
|
||||
|
||||
void DestroyEntity(int32);
|
||||
};
|
||||
extern cDMAudio &DMAudio;
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include "CarCtrl.h"
|
||||
|
||||
int &CCarCtrl::NumLawEnforcerCars = *(int*)0x8F1B38;
|
||||
int &CCarCtrl::NumAmbulancesOnDuty = *(int*)0x885BB0;
|
||||
int &CCarCtrl::NumFiretrucksOnDuty = *(int*)0x9411F0;
|
||||
bool &CCarCtrl::bCarsGeneratedAroundCamera = *(bool*)0x95CD8A;
|
||||
|
||||
WRAPPER void CCarCtrl::SwitchVehicleToRealPhysics(CVehicle*) { EAXJMP(0x41F7F0); }
|
||||
|
@ -11,5 +11,7 @@ public:
|
||||
static int32 ChooseCarModel(int32 vehclass);
|
||||
|
||||
static int32 &NumLawEnforcerCars;
|
||||
static int32 &NumAmbulancesOnDuty;
|
||||
static int32 &NumFiretrucksOnDuty;
|
||||
static bool &bCarsGeneratedAroundCamera;
|
||||
};
|
||||
|
@ -4,9 +4,11 @@
|
||||
#include "Boat.h"
|
||||
#include "BulletTraces.h"
|
||||
#include "CarCtrl.h"
|
||||
#include "CivilianPed.h"
|
||||
#include "Clock.h"
|
||||
#include "DMAudio.h"
|
||||
#include "Draw.h"
|
||||
#include "Heli.h"
|
||||
#include "math/Matrix.h"
|
||||
#include "ModelIndices.h"
|
||||
#include "ModelInfo.h"
|
||||
@ -14,6 +16,7 @@
|
||||
#include "Pad.h"
|
||||
#include "PhoneInfo.h"
|
||||
#include "Pickups.h"
|
||||
#include "Plane.h"
|
||||
#include "Pools.h"
|
||||
#include "Population.h"
|
||||
#include "Replay.h"
|
||||
@ -23,6 +26,7 @@
|
||||
#include "render/Skidmarks.h"
|
||||
#include "Streaming.h"
|
||||
#include "Timer.h"
|
||||
#include "Train.h"
|
||||
#include "Weather.h"
|
||||
#include "Zones.h"
|
||||
#include "Font.h"
|
||||
@ -83,6 +87,10 @@ bool &CReplay::bAllowLookAroundCam = *(bool*)0x95CDCD;
|
||||
float &CReplay::LoadSceneX = *(float*)0x880F9C;
|
||||
float &CReplay::LoadSceneY = *(float*)0x880F98;
|
||||
float &CReplay::LoadSceneZ = *(float*)0x880F94;
|
||||
float &CReplay::CameraFocusX = *(float*)0x942F5C;
|
||||
float &CReplay::CameraFocusY = *(float*)0x942F74;
|
||||
float &CReplay::CameraFocusZ = *(float*)0x942F58;
|
||||
bool &CReplay::bPlayerInRCBuggy = *(bool*)0x95CDC3;
|
||||
|
||||
static void(*(&CBArray)[30])(CAnimBlendAssociation*, void*) = *(void(*(*)[30])(CAnimBlendAssociation*, void*))*(uintptr*)0x61052C;
|
||||
static void(*CBArray_RE3[])(CAnimBlendAssociation*, void*) =
|
||||
@ -680,9 +688,250 @@ void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressI
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
WRAPPER bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, float interpolation, uint32 *pTimer) { EAXJMP(0x595240); }
|
||||
#else
|
||||
bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, float interpolation, uint32 *pTimer){
|
||||
/* Mistake. Not even sure what this is even doing here...
|
||||
* PlayerWanted is a backup to restore at the end of replay.
|
||||
* Setting current wanted pointer to it makes it useless.
|
||||
* Causes picking up bribes in replays reducing wanted level bug.
|
||||
* Obviously fact of picking them up is a bug on its own,
|
||||
* but it doesn't cancel this one.
|
||||
*/
|
||||
FindPlayerPed()->m_pWanted = &PlayerWanted;
|
||||
|
||||
CBulletTraces::Init();
|
||||
float split = 1.0f - interpolation;
|
||||
int ped_min_index = 0; /* Optimization due to peds and vehicles placed in buffer sequentially. */
|
||||
int vehicle_min_index = 0; /* So next ped can't have pool index less than current. */
|
||||
for(;;){
|
||||
uint8* ptr = buffer->m_pBase;
|
||||
uint32 offset = buffer->m_nOffset;
|
||||
uint8 type = ptr[offset];
|
||||
if (type == REPLAYPACKET_ENDOFFRAME)
|
||||
break;
|
||||
switch (type) {
|
||||
case REPLAYPACKET_END:
|
||||
{
|
||||
int slot = buffer->m_bSlot;
|
||||
if (BufferStatus[slot] == REPLAYBUFFER_RECORD) {
|
||||
FinishPlayback();
|
||||
return true;
|
||||
}
|
||||
buffer->m_bSlot = (slot + 1) % 8;
|
||||
buffer->m_nOffset = 0;
|
||||
buffer->m_pBase = Buffers[buffer->m_bSlot];
|
||||
ped_min_index = 0;
|
||||
vehicle_min_index = 0;
|
||||
break;
|
||||
}
|
||||
case REPLAYPACKET_VEHICLE:
|
||||
{
|
||||
tVehicleUpdatePacket* vp = (tVehicleUpdatePacket*)&ptr[offset];
|
||||
for (int i = vehicle_min_index; i < vp->index; i++) {
|
||||
CVehicle* v = CPools::GetVehiclePool()->GetSlot(i);
|
||||
if (!v)
|
||||
continue;
|
||||
/* Removing vehicles not present in this frame. */
|
||||
CWorld::Remove(v);
|
||||
delete v;
|
||||
}
|
||||
vehicle_min_index = vp->index + 1;
|
||||
CVehicle* v = CPools::GetVehiclePool()->GetSlot(vp->index);
|
||||
CVehicle* new_v;
|
||||
if (!v) {
|
||||
int mi = vp->mi;
|
||||
if (CStreaming::ms_aInfoForModel[mi].m_loadState != 1) {
|
||||
CStreaming::RequestModel(mi, 0);
|
||||
}
|
||||
else {
|
||||
if (mi == MI_DEADDODO || mi == MI_AIRTRAIN) {
|
||||
new_v = new(vp->index << 8) CPlane(mi, 2);
|
||||
}
|
||||
else if (mi == MI_TRAIN) {
|
||||
new_v = new(vp->index << 8) CTrain(mi, 2);
|
||||
}
|
||||
else if (mi == MI_CHOPPER || mi == MI_ESCAPE) {
|
||||
new_v = new(vp->index << 8) CHeli(mi, 2);
|
||||
}
|
||||
else if (CModelInfo::IsBoatModel(mi)){
|
||||
new_v = new(vp->index << 8) CBoat(mi, 2);
|
||||
}
|
||||
else{
|
||||
new_v = new(vp->index << 8) CAutomobile(mi, 2);
|
||||
}
|
||||
new_v->m_status = STATUS_PLAYER_PLAYBACKFROMBUFFER;
|
||||
vp->matrix.DecompressIntoFullMatrix(new_v->GetMatrix());
|
||||
new_v->m_currentColour1 = vp->primary_color;
|
||||
new_v->m_currentColour2 = vp->secondary_color;
|
||||
CWorld::Add(new_v);
|
||||
}
|
||||
}
|
||||
ProcessCarUpdate(CPools::GetVehiclePool()->GetSlot(vp->index), interpolation, buffer);
|
||||
buffer->m_nOffset += sizeof(tVehicleUpdatePacket);
|
||||
break;
|
||||
}
|
||||
case REPLAYPACKET_PED_HEADER:
|
||||
{
|
||||
tPedHeaderPacket* ph = (tPedHeaderPacket*)&ptr[offset];
|
||||
if (!CPools::GetPedPool()->GetSlot(ph->index)) {
|
||||
if (CStreaming::ms_aInfoForModel[ph->mi].m_loadState != 1) {
|
||||
CStreaming::RequestModel(ph->mi, 0);
|
||||
}
|
||||
else {
|
||||
CPed* new_p = new(ph->index << 8) CCivilianPed(ph->pedtype, ph->mi);
|
||||
new_p->m_status = STATUS_PLAYER_PLAYBACKFROMBUFFER;
|
||||
new_p->GetMatrix().SetUnity();
|
||||
CWorld::Add(new_p);
|
||||
}
|
||||
}
|
||||
buffer->m_nOffset += sizeof(tPedHeaderPacket);
|
||||
break;
|
||||
}
|
||||
case REPLAYPACKET_PED_UPDATE:
|
||||
{
|
||||
tPedUpdatePacket* pu = (tPedUpdatePacket*)&ptr[offset];
|
||||
for (int i = ped_min_index; i < pu->index; i++) {
|
||||
CPed* p = CPools::GetPedPool()->GetSlot(i);
|
||||
if (!p)
|
||||
continue;
|
||||
/* Removing peds not present in this frame. */
|
||||
CWorld::Remove(p);
|
||||
delete p;
|
||||
}
|
||||
ped_min_index = pu->index + 1;
|
||||
ProcessPedUpdate(CPools::GetPedPool()->GetSlot(pu->index), interpolation, buffer);
|
||||
break;
|
||||
}
|
||||
case REPLAYPACKET_GENERAL:
|
||||
{
|
||||
tGeneralPacket* pg = (tGeneralPacket*)&ptr[offset];
|
||||
TheCamera.GetMatrix() = TheCamera.GetMatrix() * CMatrix(split);
|
||||
*TheCamera.GetMatrix().GetPosition() *= split;
|
||||
TheCamera.GetMatrix() += CMatrix(interpolation) * pg->camera_pos;
|
||||
RwMatrix* pm = &RpAtomicGetFrame(&TheCamera.m_pRwCamera->object.object)->modelling;
|
||||
pm->pos = *(RwV3d*)TheCamera.GetMatrix().GetPosition();
|
||||
pm->at = *(RwV3d*)TheCamera.GetMatrix().GetForward();
|
||||
pm->up = *(RwV3d*)TheCamera.GetMatrix().GetUp();
|
||||
pm->right = *(RwV3d*)TheCamera.GetMatrix().GetRight();
|
||||
CameraFocusX = split * CameraFocusX + interpolation * pg->player_pos.x;
|
||||
CameraFocusY = split * CameraFocusY + interpolation * pg->player_pos.y;
|
||||
CameraFocusZ = split * CameraFocusZ + interpolation * pg->player_pos.z;
|
||||
bPlayerInRCBuggy = pg->in_rcvehicle;
|
||||
buffer->m_nOffset += sizeof(tGeneralPacket);
|
||||
break;
|
||||
}
|
||||
case REPLAYPACKET_CLOCK:
|
||||
{
|
||||
tClockPacket* pc = (tClockPacket*)&ptr[offset];
|
||||
CClock::SetGameClock(pc->hours, pc->minutes);
|
||||
buffer->m_nOffset += sizeof(tClockPacket);
|
||||
break;
|
||||
}
|
||||
case REPLAYPACKET_WEATHER:
|
||||
{
|
||||
tWeatherPacket* pw = (tWeatherPacket*)&ptr[offset];
|
||||
CWeather::OldWeatherType = pw->old_weather;
|
||||
CWeather::NewWeatherType = pw->new_weather;
|
||||
CWeather::InterpolationValue = pw->interpolation;
|
||||
buffer->m_nOffset += sizeof(tWeatherPacket);
|
||||
break;
|
||||
}
|
||||
case REPLAYPACKET_ENDOFFRAME:
|
||||
{
|
||||
/* Not supposed to be here. */
|
||||
buffer->m_nOffset++;
|
||||
break;
|
||||
}
|
||||
case REPLAYPACKET_TIMER:
|
||||
{
|
||||
tTimerPacket* pt = (tTimerPacket*)&ptr[offset];
|
||||
if (pTimer)
|
||||
*pTimer = pt->timer;
|
||||
CTimer::SetTimeInMilliseconds(pt->timer);
|
||||
buffer->m_nOffset += sizeof(tTimerPacket);
|
||||
break;
|
||||
}
|
||||
case REPLAYPACKET_BULLET_TRACES:
|
||||
{
|
||||
tBulletTracePacket* pb = (tBulletTracePacket*)&ptr[offset];
|
||||
CBulletTraces::aTraces[pb->index].m_bInUse = true;
|
||||
CBulletTraces::aTraces[pb->index].m_bFramesInUse = pb->frames;
|
||||
CBulletTraces::aTraces[pb->index].m_bLifeTime = pb->lifetime;
|
||||
CBulletTraces::aTraces[pb->index].m_vecInf = pb->inf;
|
||||
CBulletTraces::aTraces[pb->index].m_vecSup = pb->sup;
|
||||
buffer->m_nOffset += sizeof(tBulletTracePacket);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
buffer->m_nOffset += 4;
|
||||
for (int i = vehicle_min_index; i < CPools::GetVehiclePool()->GetSize(); i++) {
|
||||
CVehicle* v = CPools::GetVehiclePool()->GetSlot(i);
|
||||
if (!v)
|
||||
continue;
|
||||
/* Removing vehicles not present in this frame. */
|
||||
CWorld::Remove(v);
|
||||
delete v;
|
||||
}
|
||||
for (int i = ped_min_index; i < CPools::GetPedPool()->GetSize(); i++) {
|
||||
CPed* p = CPools::GetPedPool()->GetSlot(i);
|
||||
if (!p)
|
||||
continue;
|
||||
/* Removing peds not present in this frame. */
|
||||
CWorld::Remove(p);
|
||||
delete p;
|
||||
}
|
||||
ProcessReplayCamera();
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
WRAPPER void CReplay::FinishPlayback(void) { EAXJMP(0x595B20); }
|
||||
#else
|
||||
void CReplay::FinishPlayback(void)
|
||||
{
|
||||
if (Mode != MODE_PLAYBACK)
|
||||
return;
|
||||
EmptyAllPools();
|
||||
RestoreStuffFromMem();
|
||||
Mode = MODE_RECORD;
|
||||
if (bDoLoadSceneWhenDone){
|
||||
CVector v_ls(LoadSceneX, LoadSceneY, LoadSceneZ);
|
||||
CGame::currLevel = CTheZones::GetLevelFromPosition(v_ls);
|
||||
CCollision::SortOutCollisionAfterLoad();
|
||||
CStreaming::LoadScene(v_ls);
|
||||
}
|
||||
bDoLoadSceneWhenDone = false;
|
||||
if (bPlayingBackFromFile){
|
||||
Init();
|
||||
MarkEverythingAsNew();
|
||||
}
|
||||
DMAudio.SetEffectsFadeVol(127);
|
||||
DMAudio.SetMusicFadeVol(127);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
WRAPPER void CReplay::EmptyReplayBuffer(void) { EAXJMP(0x595BD0); }
|
||||
#else
|
||||
void CReplay::EmptyReplayBuffer(void)
|
||||
{
|
||||
if (Mode == MODE_PLAYBACK)
|
||||
return;
|
||||
for (int i = 0; i < 8; i++){
|
||||
BufferStatus[i] = REPLAYBUFFER_UNUSED;
|
||||
}
|
||||
Record.m_bSlot = 0;
|
||||
Record.m_pBase = Buffers[0];
|
||||
BufferStatus[0] = REPLAYBUFFER_RECORD;
|
||||
Record.m_pBase[Record.m_nOffset] = 0;
|
||||
MarkEverythingAsNew();
|
||||
}
|
||||
#endif
|
||||
|
||||
WRAPPER void CReplay::ProcessReplayCamera(void) { EAXJMP(0x595C40); }
|
||||
|
||||
#if 0
|
||||
|
@ -241,6 +241,10 @@ private:
|
||||
static float &LoadSceneX;
|
||||
static float &LoadSceneY;
|
||||
static float &LoadSceneZ;
|
||||
static float &CameraFocusX;
|
||||
static float &CameraFocusY;
|
||||
static float &CameraFocusZ;
|
||||
static bool &bPlayerInRCBuggy;
|
||||
|
||||
public:
|
||||
static void Init(void);
|
||||
|
@ -2,4 +2,15 @@
|
||||
#include "patcher.h"
|
||||
#include "Automobile.h"
|
||||
|
||||
WRAPPER void CAutomobile::SetDoorDamage(int32, uint32, bool) { EAXJMP(0x530200); }
|
||||
CAutomobile::CAutomobile(int mi, uint8 owner)
|
||||
{
|
||||
ctor(mi, owner);
|
||||
}
|
||||
|
||||
WRAPPER CAutomobile* CAutomobile::ctor(int, uint8) { EAXJMP(0x52C6B0); }
|
||||
|
||||
WRAPPER void CAutomobile::SetDoorDamage(int32, uint32, bool) { EAXJMP(0x530200); }
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x52D170, &CAutomobile::dtor, PATCH_JUMP);
|
||||
ENDPATCHES
|
@ -22,7 +22,10 @@ public:
|
||||
uint8 m_nDriveWheelsOnGround;
|
||||
uint8 stuff5[22];
|
||||
|
||||
CAutomobile(int, uint8);
|
||||
CAutomobile* ctor(int, uint8);
|
||||
void SetDoorDamage(int32, uint32, bool); /* TODO: eDoors */
|
||||
void dtor() { this->CAutomobile::~CAutomobile(); }
|
||||
};
|
||||
static_assert(sizeof(CAutomobile) == 0x5A8, "CAutomobile: error");
|
||||
static_assert(offsetof(CAutomobile, m_afWheelSuspDist) == 0x46C, "CAutomobile: error");
|
||||
|
14
src/entities/Boat.cpp
Normal file
14
src/entities/Boat.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "Boat.h"
|
||||
|
||||
CBoat::CBoat(int mi, uint8 owner)
|
||||
{
|
||||
ctor(mi, owner);
|
||||
}
|
||||
|
||||
WRAPPER CBoat* CBoat::ctor(int, uint8) { EAXJMP(0x53E3E0); }
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x53E790, &CBoat::dtor, PATCH_JUMP);
|
||||
ENDPATCHES
|
@ -9,5 +9,9 @@ public:
|
||||
uint8 stuff1[57];
|
||||
bool m_bIsAnchored;
|
||||
uint8 stuff[450];
|
||||
|
||||
CBoat(int, uint8);
|
||||
CBoat* ctor(int, uint8);
|
||||
void dtor() { this->CBoat::~CBoat(); };
|
||||
};
|
||||
static_assert(sizeof(CBoat) == 0x484, "CBoat: error");
|
||||
|
@ -23,5 +23,6 @@ CBuilding::ReplaceWithNewModel(int32 id)
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x4057D0, &CBuilding::ctor, PATCH_JUMP);
|
||||
InjectHook(0x405800, &CBuilding::dtor, PATCH_JUMP);
|
||||
InjectHook(0x405850, &CBuilding::ReplaceWithNewModel, PATCH_JUMP);
|
||||
ENDPATCHES
|
||||
|
@ -17,5 +17,6 @@ public:
|
||||
virtual bool GetIsATreadable(void) { return false; }
|
||||
|
||||
CBuilding *ctor(void) { return ::new (this) CBuilding(); }
|
||||
void dtor(void) { this->CBuilding::~CBuilding(); }
|
||||
};
|
||||
static_assert(sizeof(CBuilding) == 0x64, "CBuilding: error");
|
||||
|
14
src/entities/CivilianPed.cpp
Normal file
14
src/entities/CivilianPed.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "CivilianPed.h"
|
||||
|
||||
CCivilianPed::CCivilianPed(int pedtype, int mi)
|
||||
{
|
||||
ctor(pedtype, mi);
|
||||
}
|
||||
|
||||
WRAPPER CCivilianPed* CCivilianPed::ctor(int pedtype, int mi) { EAXJMP(0x4BFF30); }
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x4BFFC0, &CCivilianPed::dtor, PATCH_JUMP);
|
||||
ENDPATCHES
|
@ -5,5 +5,8 @@
|
||||
class CCivilianPed : public CPed
|
||||
{
|
||||
public:
|
||||
CCivilianPed(int, int);
|
||||
CCivilianPed* ctor(int, int);
|
||||
void dtor(void) { this->CCivilianPed::~CCivilianPed(); }
|
||||
};
|
||||
static_assert(sizeof(CCivilianPed) == 0x53C, "CCivilianPed: error");
|
||||
|
14
src/entities/CopPed.cpp
Normal file
14
src/entities/CopPed.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "CopPed.h"
|
||||
|
||||
CCopPed::~CCopPed()
|
||||
{
|
||||
ClearPursuit();
|
||||
}
|
||||
|
||||
WRAPPER void CCopPed::ClearPursuit(void) { EAXJMP(0x4C28C0); }
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x4C13E0, &CCopPed::dtor, PATCH_JUMP);
|
||||
ENDPATCHES
|
@ -63,6 +63,11 @@ public:
|
||||
int8 field_1365;
|
||||
int8 field_1366;
|
||||
int8 field_1367;
|
||||
|
||||
~CCopPed();
|
||||
void dtor(void) { this->CCopPed::~CCopPed(); }
|
||||
|
||||
void ClearPursuit(void);
|
||||
};
|
||||
|
||||
static_assert(sizeof(CCopPed) == 0x558, "CCopPed: error");
|
||||
|
@ -90,6 +90,7 @@ CCutsceneObject::RemoveLighting(bool reset)
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x4BA960, &CCutsceneObject::dtor, PATCH_JUMP);
|
||||
InjectHook(0x4BA980, &CCutsceneObject::SetModelIndex_, PATCH_JUMP);
|
||||
InjectHook(0x4BA9C0, &CCutsceneObject::ProcessControl_, PATCH_JUMP);
|
||||
InjectHook(0x4BAA40, &CCutsceneObject::PreRender_, PATCH_JUMP);
|
||||
|
@ -14,7 +14,7 @@ public:
|
||||
bool SetupLighting(void);
|
||||
void RemoveLighting(bool reset);
|
||||
|
||||
|
||||
void dtor(void) { this->CCutsceneObject::~CCutsceneObject(); }
|
||||
void SetModelIndex_(uint32 id) { CCutsceneObject::SetModelIndex(id); }
|
||||
void ProcessControl_(void) { CCutsceneObject::ProcessControl(); }
|
||||
void PreRender_(void) { CCutsceneObject::PreRender(); }
|
||||
|
@ -52,6 +52,7 @@ CDummy::Remove(void)
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x473810, &CDummy::dtor, PATCH_JUMP);
|
||||
InjectHook(0x473860, &CDummy::Add_, PATCH_JUMP);
|
||||
InjectHook(0x473AD0, &CDummy::Remove_, PATCH_JUMP);
|
||||
ENDPATCHES
|
||||
|
@ -18,5 +18,6 @@ public:
|
||||
// to make patching virtual functions possible
|
||||
void Add_(void) { CDummy::Add(); }
|
||||
void Remove_(void) { CDummy::Remove(); }
|
||||
void dtor(void) { this->CDummy::~CDummy(); }
|
||||
};
|
||||
static_assert(sizeof(CDummy) == 0x68, "CDummy: error");
|
||||
|
@ -11,3 +11,7 @@ CDummyObject::CDummyObject(CObject *obj)
|
||||
obj->DetachFromRwObject();
|
||||
m_level = obj->m_level;
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x4BAB70, &CDummyObject::dtor, PATCH_JUMP);
|
||||
ENDPATCHES
|
@ -9,5 +9,6 @@ class CDummyObject : public CDummy
|
||||
public:
|
||||
CDummyObject(void) {}
|
||||
CDummyObject(CObject *obj);
|
||||
void dtor(void) { this->CDummyObject::~CDummyObject(); }
|
||||
};
|
||||
static_assert(sizeof(CDummyObject) == 0x68, "CDummyObject: error");
|
||||
|
@ -7,5 +7,7 @@ class CEmergencyPed : public CPed
|
||||
public:
|
||||
// 0x53C
|
||||
uint8 stuff[24];
|
||||
|
||||
void dtor(void) { this->CEmergencyPed::~CEmergencyPed(); }
|
||||
};
|
||||
static_assert(sizeof(CEmergencyPed) == 0x554, "CEmergencyPed: error");
|
||||
|
@ -449,6 +449,8 @@ CEntity::PruneReferences(void)
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x473C30, &CEntity::ctor, PATCH_JUMP);
|
||||
InjectHook(0x473E40, &CEntity::dtor, PATCH_JUMP);
|
||||
InjectHook(0x473E70, &CEntity::SetModelIndex_, PATCH_JUMP);
|
||||
InjectHook(0x4742C0, (void (CEntity::*)(CVector&))&CEntity::GetBoundCentre, PATCH_JUMP);
|
||||
InjectHook(0x474310, &CEntity::GetBoundRadius, PATCH_JUMP);
|
||||
InjectHook(0x474C10, &CEntity::GetIsTouching, PATCH_JUMP);
|
||||
|
@ -156,8 +156,10 @@ public:
|
||||
|
||||
// to make patching virtual functions possible
|
||||
CEntity *ctor(void) { return ::new (this) CEntity(); }
|
||||
void dtor(void) { this->CEntity::~CEntity(); }
|
||||
void Add_(void) { CEntity::Add(); }
|
||||
void Remove_(void) { CEntity::Remove(); }
|
||||
void SetModelIndex_(uint32 i) { CEntity::SetModelIndex(i); }
|
||||
void CreateRwObject_(void) { CEntity::CreateRwObject(); }
|
||||
void DeleteRwObject_(void) { CEntity::DeleteRwObject(); }
|
||||
CRect GetBoundRect_(void) { return CEntity::GetBoundRect(); }
|
||||
|
@ -2,4 +2,14 @@
|
||||
#include "patcher.h"
|
||||
#include "Heli.h"
|
||||
|
||||
CHeli::CHeli(int mi, uint8 owner)
|
||||
{
|
||||
ctor(mi, owner);
|
||||
}
|
||||
|
||||
WRAPPER CHeli* CHeli::ctor(int, uint8) { EAXJMP(0x547220); }
|
||||
WRAPPER void CHeli::SpecialHeliPreRender(void) { EAXJMP(0x54AE10); }
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x5474A0, &CHeli::dtor, PATCH_JUMP);
|
||||
ENDPATCHES
|
||||
|
@ -8,6 +8,10 @@ public:
|
||||
// 0x288
|
||||
uint8 stuff[180];
|
||||
|
||||
CHeli(int, uint8);
|
||||
CHeli* ctor(int, uint8);
|
||||
void dtor(void) { this->CHeli::~CHeli(); }
|
||||
|
||||
static void SpecialHeliPreRender(void);
|
||||
};
|
||||
static_assert(sizeof(CHeli) == 0x33C, "CHeli: error");
|
||||
|
@ -66,5 +66,6 @@ CObject::Render(void)
|
||||
WRAPPER void CObject::DeleteAllTempObjectInArea(CVector, float) { EAXJMP(0x4BBED0); }
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x4BAE00, &CObject::dtor, PATCH_JUMP);
|
||||
InjectHook(0x4BB1E0, &CObject::Render_, PATCH_JUMP);
|
||||
ENDPATCHES
|
||||
|
@ -73,6 +73,7 @@ public:
|
||||
|
||||
static void DeleteAllTempObjectInArea(CVector, float);
|
||||
|
||||
void dtor(void) { this->CObject::~CObject(); }
|
||||
void Render_(void) { CObject::Render(); }
|
||||
};
|
||||
static_assert(sizeof(CObject) == 0x198, "CObject: error");
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "Shadows.h"
|
||||
#include "Weather.h"
|
||||
#include "CullZones.h"
|
||||
#include "Population.h"
|
||||
|
||||
bool &CPed::bNastyLimbsCheat = *(bool*)0x95CD44;
|
||||
bool &CPed::bPedCheat2 = *(bool*)0x95CD5A;
|
||||
@ -27,8 +28,65 @@ CVector &CPed::offsetToOpenLowCarDoor = *(CVector*)0x62E03C;
|
||||
CVector &CPed::offsetToOpenVanDoor = *(CVector*)0x62E048;
|
||||
|
||||
void *CPed::operator new(size_t sz) { return CPools::GetPedPool()->New(); }
|
||||
void *CPed::operator new(size_t sz, int handle) { return CPools::GetPedPool()->New(handle); }
|
||||
void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); }
|
||||
|
||||
CPed::~CPed(void)
|
||||
{
|
||||
CWorld::Remove(this);
|
||||
CRadar::ClearBlipForEntity(BLIP_CHAR, CPools::GetPedPool()->GetIndex(this));
|
||||
if (bInVehicle && m_pMyVehicle){
|
||||
uint8 door_flag = 0;
|
||||
switch (m_vehEnterType) {
|
||||
case VEHICLE_ENTER_FRONT_LEFT: door_flag = 1; break;
|
||||
case VEHICLE_ENTER_REAR_LEFT: door_flag = 2; break;
|
||||
case VEHICLE_ENTER_FRONT_RIGHT: door_flag = 4; break;
|
||||
case VEHICLE_ENTER_REAR_RIGHT: door_flag = 8; break;
|
||||
default: break;
|
||||
}
|
||||
if (m_pMyVehicle->pDriver == this)
|
||||
m_pMyVehicle->pDriver = nil;
|
||||
else {
|
||||
for (int i = 0; i < m_pMyVehicle->m_nNumMaxPassengers; i++) {
|
||||
if (m_pMyVehicle->pPassengers[i] == this)
|
||||
m_pMyVehicle->pPassengers[i] = nil;
|
||||
}
|
||||
}
|
||||
if (m_nPedState == PED_EXIT_CAR || m_nPedState == PED_DRAG_FROM_CAR)
|
||||
m_pMyVehicle->m_nGettingOutFlags &= ~door_flag;
|
||||
bInVehicle = false;
|
||||
m_pMyVehicle = nil;
|
||||
}else if (m_nPedState == PED_ENTER_CAR || m_nPedState == PED_CARJACK){
|
||||
QuitEnteringCar();
|
||||
}
|
||||
if (m_pFire)
|
||||
m_pFire->Extinguish();
|
||||
CPopulation::UpdatePedCount(m_nPedType, true);
|
||||
DMAudio.DestroyEntity(m_audioEntityId);
|
||||
}
|
||||
|
||||
void CPed::FlagToDestroyWhenNextProcessed(void)
|
||||
{
|
||||
bRemoveFromWorld = true;
|
||||
if (!bInVehicle || !m_pMyVehicle)
|
||||
return;
|
||||
if (m_pMyVehicle->pDriver == this){
|
||||
m_pMyVehicle->pDriver = nil;
|
||||
if (IsPlayer() && m_pMyVehicle->m_status != STATUS_WRECKED)
|
||||
m_pMyVehicle->m_status = STATUS_ABANDONED;
|
||||
}else{
|
||||
m_pMyVehicle->RemovePassenger(this);
|
||||
}
|
||||
bInVehicle = false;
|
||||
m_pMyVehicle = nil;
|
||||
if (m_nCreatedBy == 2) /* TODO: enum (MISSION) */
|
||||
m_nPedState = PED_DEAD;
|
||||
else
|
||||
m_nPedState = PED_NONE;
|
||||
m_pVehicleAnim = nil;
|
||||
}
|
||||
|
||||
WRAPPER void CPed::QuitEnteringCar() { EAXJMP(0x4E0E00); }
|
||||
WRAPPER void CPed::KillPedWithCar(CVehicle *veh, float impulse) { EAXJMP(0x4EC430); }
|
||||
WRAPPER void CPed::Say(uint16 audio) { EAXJMP(0x4E5A10); }
|
||||
WRAPPER void CPed::SetDie(AnimationId anim, float arg1, float arg2) { EAXJMP(0x4D37D0); }
|
||||
@ -1625,6 +1683,7 @@ WRAPPER void FinishFuckUCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4
|
||||
WRAPPER void CPed::RestoreHeadingRateCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4D6550); }
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x4C50D0, &CPed::dtor, PATCH_JUMP);
|
||||
InjectHook(0x4CF8F0, &CPed::AddWeaponModel, PATCH_JUMP);
|
||||
InjectHook(0x4C6AA0, &CPed::AimGun, PATCH_JUMP);
|
||||
InjectHook(0x4EB470, &CPed::ApplyHeadShot, PATCH_JUMP);
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "AnimBlendClumpData.h"
|
||||
#include "AnimBlendAssociation.h"
|
||||
#include "WeaponInfo.h"
|
||||
#include "Fire.h"
|
||||
|
||||
struct CPathNode;
|
||||
|
||||
@ -184,7 +185,9 @@ public:
|
||||
uint8 m_ped_flagI20 : 1;
|
||||
uint8 m_ped_flagI40 : 1;
|
||||
uint8 m_ped_flagI80 : 1;
|
||||
uint8 stuff10[15];
|
||||
uint8 stuff10[3];
|
||||
uint8 m_nCreatedBy;
|
||||
uint8 stuff14[11];
|
||||
CPed *m_field_16C;
|
||||
uint8 stuff12[44];
|
||||
int32 m_pEventEntity;
|
||||
@ -243,7 +246,8 @@ public:
|
||||
uint8 stuff[2];
|
||||
int32 m_pPointGunAt;
|
||||
CVector m_vecHitLastPos;
|
||||
uint8 stuff8[12];
|
||||
uint8 stuff8[8];
|
||||
CFire* m_pFire;
|
||||
CEntity *m_pLookTarget;
|
||||
float m_fLookDirection;
|
||||
int32 m_wepModelID;
|
||||
@ -266,8 +270,14 @@ public:
|
||||
uint8 stuff11[30];
|
||||
|
||||
static void *operator new(size_t);
|
||||
static void *operator new(size_t, int);
|
||||
static void operator delete(void*, size_t);
|
||||
|
||||
~CPed(void);
|
||||
void FlagToDestroyWhenNextProcessed(void);
|
||||
|
||||
void dtor(void) { this->CPed::~CPed(); }
|
||||
|
||||
bool IsPlayer(void);
|
||||
bool UseGroundColModel(void);
|
||||
bool CanSetPedState(void);
|
||||
@ -301,6 +311,7 @@ public:
|
||||
void LineUpPedWithCar(PedLineUpPhase phase);
|
||||
void SetPedPositionInCar(void);
|
||||
void PlayFootSteps(void);
|
||||
void QuitEnteringCar(void);
|
||||
static void GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float offset);
|
||||
static void GetPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float seatPosMult);
|
||||
static void GetPositionToOpenCarDoor(CVector* output, CVehicle* veh, uint32 enterType);
|
||||
|
@ -1895,6 +1895,7 @@ CPhysical::ProcessCollision(void)
|
||||
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x495130, &CPhysical::dtor, PATCH_JUMP);
|
||||
InjectHook(0x4951F0, &CPhysical::Add_, PATCH_JUMP);
|
||||
InjectHook(0x4954B0, &CPhysical::Remove_, PATCH_JUMP);
|
||||
InjectHook(0x495540, &CPhysical::RemoveAndAdd, PATCH_JUMP);
|
||||
|
@ -134,6 +134,7 @@ public:
|
||||
void ProcessCollision(void);
|
||||
|
||||
// to make patching virtual functions possible
|
||||
void dtor(void) { this->CPhysical::~CPhysical(); }
|
||||
void Add_(void) { CPhysical::Add(); }
|
||||
void Remove_(void) { CPhysical::Remove(); }
|
||||
CRect GetBoundRect_(void) { return CPhysical::GetBoundRect(); }
|
||||
|
19
src/entities/Plane.cpp
Normal file
19
src/entities/Plane.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "Plane.h"
|
||||
|
||||
CPlane::CPlane(int mi, uint8 owner)
|
||||
{
|
||||
ctor(mi, owner);
|
||||
}
|
||||
|
||||
WRAPPER CPlane* CPlane::ctor(int, uint8) { EAXJMP(0x54B170); }
|
||||
|
||||
CPlane::~CPlane()
|
||||
{
|
||||
DeleteRwObject();
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x54B270, &CPlane::dtor, PATCH_JUMP);
|
||||
ENDPATCHES
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "common.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
class CPlane : public CVehicle
|
||||
@ -7,5 +8,11 @@ class CPlane : public CVehicle
|
||||
public:
|
||||
// 0x288
|
||||
uint8 stuff[20];
|
||||
|
||||
CPlane(int, uint8);
|
||||
~CPlane(void);
|
||||
CPlane* ctor(int, uint8);
|
||||
void dtor(void) { this->CPlane::~CPlane(); }
|
||||
void FlagToDestroyWhenNextProcessed() { bRemoveFromWorld = true; }
|
||||
};
|
||||
static_assert(sizeof(CPlane) == 0x29C, "CPlane: error");
|
||||
|
@ -2,4 +2,13 @@
|
||||
#include "patcher.h"
|
||||
#include "PlayerPed.h"
|
||||
|
||||
CPlayerPed::~CPlayerPed()
|
||||
{
|
||||
delete m_pWanted;
|
||||
}
|
||||
|
||||
WRAPPER void CPlayerPed::ReApplyMoveAnims(void) { EAXJMP(0x4F07C0); }
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x4EFB30, &CPlayerPed::dtor, PATCH_JUMP);
|
||||
ENDPATCHES
|
@ -39,6 +39,9 @@ public:
|
||||
float field_1512;
|
||||
float m_fFPSMoveHeading;
|
||||
|
||||
~CPlayerPed();
|
||||
|
||||
void dtor(void) { this->CPlayerPed::~CPlayerPed(); }
|
||||
void ReApplyMoveAnims(void);
|
||||
};
|
||||
|
||||
|
7
src/entities/Projectile.cpp
Normal file
7
src/entities/Projectile.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "Projectile.h"
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x4BFED0, &CProjectile::dtor, PATCH_JUMP);
|
||||
ENDPATCHES
|
11
src/entities/Projectile.h
Normal file
11
src/entities/Projectile.h
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Object.h"
|
||||
|
||||
class CProjectile : public CObject
|
||||
{
|
||||
public:
|
||||
void dtor(void) { this->CProjectile::~CProjectile(); }
|
||||
};
|
14
src/entities/Train.cpp
Normal file
14
src/entities/Train.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "Train.h"
|
||||
|
||||
CTrain::CTrain(int mi, uint8 owner)
|
||||
{
|
||||
ctor(mi, owner);
|
||||
}
|
||||
|
||||
WRAPPER CTrain* CTrain::ctor(int, uint8) { EAXJMP(0x54E2A0); }
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x54E450, &CTrain::dtor, PATCH_JUMP);
|
||||
ENDPATCHES
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
enum
|
||||
@ -16,5 +18,9 @@ public:
|
||||
uint8 stuff2[7];
|
||||
int16 m_doorState;
|
||||
uint8 stuff3[62];
|
||||
|
||||
CTrain(int, uint8);
|
||||
CTrain* ctor(int, uint8);
|
||||
void dtor(void) { this->CTrain::~CTrain(); }
|
||||
};
|
||||
static_assert(sizeof(CTrain) == 0x2E4, "CTrain: error");
|
||||
|
@ -1,7 +1,12 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "rpworld.h"
|
||||
#include "Treadable.h"
|
||||
#include "Pools.h"
|
||||
|
||||
void *CTreadable::operator new(size_t sz) { return CPools::GetTreadablePool()->New(); }
|
||||
void CTreadable::operator delete(void *p, size_t sz) { CPools::GetTreadablePool()->Delete((CTreadable*)p); }
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x405A10, &CTreadable::dtor, PATCH_JUMP);
|
||||
ENDPATCHES
|
@ -12,5 +12,6 @@ public:
|
||||
int16 m_nodeIndicesPeds[12];
|
||||
|
||||
virtual bool GetIsATreadable(void) { return true; }
|
||||
void dtor(void) { this->CTreadable::~CTreadable(); }
|
||||
};
|
||||
static_assert(sizeof(CTreadable) == 0x94, "CTreadable: error");
|
||||
|
@ -4,6 +4,8 @@
|
||||
#include "Pools.h"
|
||||
#include "CarCtrl.h"
|
||||
#include "ModelIndices.h"
|
||||
#include "DMAudio.h"
|
||||
#include "Radar.h"
|
||||
|
||||
bool &CVehicle::bWheelsOnlyCheat = *(bool *)0x95CD78;
|
||||
bool &CVehicle::bAllDodosCheat = *(bool *)0x95CD75;
|
||||
@ -12,8 +14,34 @@ bool &CVehicle::bCheat4 = *(bool *)0x95CD65;
|
||||
bool &CVehicle::bCheat5 = *(bool *)0x95CD64;
|
||||
|
||||
void *CVehicle::operator new(size_t sz) { return CPools::GetVehiclePool()->New(); }
|
||||
void *CVehicle::operator new(size_t sz, int handle) { return CPools::GetVehiclePool()->New(handle); }
|
||||
void CVehicle::operator delete(void *p, size_t sz) { CPools::GetVehiclePool()->Delete((CVehicle*)p); }
|
||||
|
||||
CVehicle::~CVehicle()
|
||||
{
|
||||
m_nAlarmState = 0;
|
||||
if (m_audioEntityId >= 0){
|
||||
DMAudio.DestroyEntity(m_audioEntityId);
|
||||
m_audioEntityId = -5;
|
||||
}
|
||||
CRadar::ClearBlipForEntity(BLIP_CAR, CPools::GetVehiclePool()->GetIndex(this));
|
||||
for (int i = 0; i < m_nNumMaxPassengers; i++){
|
||||
if (pPassengers[i])
|
||||
pPassengers[i]->FlagToDestroyWhenNextProcessed();
|
||||
}
|
||||
if (m_pCarFire)
|
||||
m_pCarFire->Extinguish();
|
||||
CCarCtrl::UpdateCarCount(this, true);
|
||||
if (bIsAmbulanceOnDuty){
|
||||
CCarCtrl::NumAmbulancesOnDuty--;
|
||||
bIsAmbulanceOnDuty = false;
|
||||
}
|
||||
if (bIsFiretruckOnDuty){
|
||||
CCarCtrl::NumFiretrucksOnDuty--;
|
||||
bIsFiretruckOnDuty = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
CVehicle::IsLawEnforcementVehicle(void)
|
||||
{
|
||||
@ -46,6 +74,28 @@ CVehicle::ChangeLawEnforcerState(bool enable)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CVehicle::RemovePassenger(CPed *p)
|
||||
{
|
||||
if (IsTrain()){
|
||||
for (int i = 0; i < 8; i++){
|
||||
if (pPassengers[i] == p) {
|
||||
pPassengers[i] = nil;
|
||||
m_nNumPassengers--;
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < m_nNumMaxPassengers; i++){
|
||||
if (pPassengers[i] == p){
|
||||
pPassengers[i] = nil;
|
||||
m_nNumPassengers--;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CVehicle::RemoveDriver(void)
|
||||
{
|
||||
|
@ -50,8 +50,8 @@ public:
|
||||
float m_fBreakPedal;
|
||||
uint8 m_nCreatedBy; // eVehicleCreatedBy
|
||||
uint8 bIsLawEnforcer : 1;
|
||||
uint8 m_veh_flagA2 : 1;
|
||||
uint8 m_veh_flagA4 : 1;
|
||||
uint8 bIsAmbulanceOnDuty : 1;
|
||||
uint8 bIsFiretruckOnDuty : 1;
|
||||
uint8 m_veh_flagA8 : 1;
|
||||
uint8 m_veh_flagA10 : 1;
|
||||
uint8 m_veh_flagA20 : 1;
|
||||
@ -111,8 +111,13 @@ public:
|
||||
eVehicleType m_vehType;
|
||||
|
||||
static void *operator new(size_t);
|
||||
static void *operator new(size_t sz, int slot);
|
||||
static void operator delete(void*, size_t);
|
||||
|
||||
~CVehicle(void);
|
||||
|
||||
void dtor(void) { this->CVehicle::~CVehicle(); }
|
||||
|
||||
bool IsCar(void) { return m_vehType == VEHICLE_TYPE_CAR; }
|
||||
bool IsBoat(void) { return m_vehType == VEHICLE_TYPE_BOAT; }
|
||||
bool IsTrain(void) { return m_vehType == VEHICLE_TYPE_TRAIN; }
|
||||
@ -120,6 +125,7 @@ public:
|
||||
bool IsPlane(void) { return m_vehType == VEHICLE_TYPE_PLANE; }
|
||||
bool IsLawEnforcementVehicle(void);
|
||||
void ChangeLawEnforcerState(bool enable);
|
||||
void RemovePassenger(CPed *);
|
||||
void RemoveDriver(void);
|
||||
bool IsUpsideDown(void);
|
||||
|
||||
|
@ -202,6 +202,21 @@ public:
|
||||
void CopyOnlyMatrix(CMatrix *other){
|
||||
m_matrix = other->m_matrix;
|
||||
}
|
||||
void SetUnity(void) {
|
||||
m_matrix.right.x = 1.0f;
|
||||
m_matrix.right.y = 0.0f;
|
||||
m_matrix.right.z = 0.0f;
|
||||
m_matrix.up.x = 0.0f;
|
||||
m_matrix.up.y = 1.0f;
|
||||
m_matrix.up.z = 0.0f;
|
||||
m_matrix.at.x = 0.0f;
|
||||
m_matrix.at.y = 0.0f;
|
||||
m_matrix.at.z = 1.0f;
|
||||
m_matrix.pos.x = 0.0f;
|
||||
m_matrix.pos.x = 0.0f;
|
||||
m_matrix.pos.y = 0.0f;
|
||||
m_matrix.pos.z = 0.0f;
|
||||
}
|
||||
};
|
||||
|
||||
inline CMatrix&
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
return (T*)&m_entries[m_allocPtr];
|
||||
}
|
||||
T *New(int handle){
|
||||
T *entry = (T*)m_entries[handle>>8];
|
||||
T *entry = (T*)&m_entries[handle>>8];
|
||||
SetNotFreeAt(handle);
|
||||
return entry;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user