2019-06-30 12:59:55 +02:00
|
|
|
#include "common.h"
|
|
|
|
#include "patcher.h"
|
|
|
|
#include "CivilianPed.h"
|
2019-07-15 14:11:40 +02:00
|
|
|
#include "Phones.h"
|
2019-06-30 12:59:55 +02:00
|
|
|
|
2019-06-30 23:50:40 +02:00
|
|
|
WRAPPER void CCivilianPed::ProcessControl(void) { EAXJMP(0x4BFFE0); }
|
|
|
|
|
|
|
|
CCivilianPed::CCivilianPed(int pedtype, int mi) : CPed(pedtype)
|
2019-06-30 12:59:55 +02:00
|
|
|
{
|
2019-07-14 11:49:03 +02:00
|
|
|
SetModelIndex(mi);
|
2019-06-30 23:50:40 +02:00
|
|
|
for (int i = 0; i < 10; i++)
|
|
|
|
{
|
|
|
|
m_nearPeds[i] = nil;
|
|
|
|
}
|
2019-06-30 12:59:55 +02:00
|
|
|
}
|
|
|
|
|
2019-07-15 14:11:40 +02:00
|
|
|
bool
|
|
|
|
CCivilianPed::ProcessNearestFreePhone(int unused)
|
|
|
|
{
|
|
|
|
if (m_nPedState == PED_SEEK_POS)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
int phoneId = gPhoneInfo.FindNearestFreePhone(&GetPosition());
|
|
|
|
|
|
|
|
if (phoneId == -1)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (gPhoneInfo.m_aPhones[phoneId].m_nState != PHONE_STATE_FREE)
|
|
|
|
return false;
|
|
|
|
|
2019-07-29 14:01:44 +02:00
|
|
|
bRunningToPhone = true;
|
2019-07-15 14:11:40 +02:00
|
|
|
SetMoveState(PEDMOVE_RUN);
|
|
|
|
SetSeek(gPhoneInfo.m_aPhones[phoneId].m_vecPos, 0.3f);
|
|
|
|
m_phoneId = phoneId;
|
|
|
|
m_lookingForPhone = unused;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-07-08 08:46:42 +02:00
|
|
|
class CCivilianPed_ : public CCivilianPed
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CCivilianPed *ctor(int pedtype, int mi) { return ::new (this) CCivilianPed(pedtype, mi); };
|
|
|
|
void dtor(void) { CCivilianPed::~CCivilianPed(); }
|
|
|
|
};
|
|
|
|
|
2019-06-30 12:59:55 +02:00
|
|
|
STARTPATCHES
|
2019-07-08 08:46:42 +02:00
|
|
|
InjectHook(0x4BFF30, &CCivilianPed_::ctor, PATCH_JUMP);
|
|
|
|
InjectHook(0x4BFFC0, &CCivilianPed_::dtor, PATCH_JUMP);
|
2019-07-15 14:11:40 +02:00
|
|
|
InjectHook(0x4C10C0, &CCivilianPed::ProcessNearestFreePhone, PATCH_JUMP);
|
2019-07-08 08:46:42 +02:00
|
|
|
ENDPATCHES
|