1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 20:00:01 +00:00

Merge pull request #209 from erorcun/erorcun

Peds, a fix and a tad of VC
This commit is contained in:
Nikolay Korolev 2019-09-17 23:43:43 +03:00 committed by GitHub
commit 5d98e12b85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 827 additions and 123 deletions

View file

@ -696,7 +696,7 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
}
if (pVehicle->bExtendedRange)
threshold *= 1.5f;
if (distanceToPlayer > threshold && !CGarages::IsPointWithinHideOutGarage(&pVehicle->GetPosition())){
if (distanceToPlayer > threshold && !CGarages::IsPointWithinHideOutGarage(pVehicle->GetPosition())){
if (pVehicle->GetIsOnScreen() && CRenderer::IsEntityCullZoneVisible(pVehicle)){
pVehicle->bFadeOut = true;
}else{
@ -712,9 +712,10 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
(pVehicle->GetPosition() - vecPlayerPos).Magnitude2D() > 25.0f &&
!IsThisVehicleInteresting(pVehicle) &&
!pVehicle->bIsLocked &&
pVehicle->CanBeDeleted() &&
!CTrafficLights::ShouldCarStopForLight(pVehicle, true) &&
!CTrafficLights::ShouldCarStopForBridge(pVehicle) &&
!CGarages::IsPointWithinHideOutGarage(&pVehicle->GetPosition())){
!CGarages::IsPointWithinHideOutGarage(pVehicle->GetPosition())){
CWorld::Remove(pVehicle);
delete pVehicle;
return;
@ -724,7 +725,7 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
if (CTimer::GetTimeInMilliseconds() > pVehicle->m_nTimeOfDeath + 60000 &&
(!pVehicle->GetIsOnScreen() || !CRenderer::IsEntityCullZoneVisible(pVehicle))){
if ((pVehicle->GetPosition() - vecPlayerPos).MagnitudeSqr() > SQR(7.5f)){
if (!CGarages::IsPointWithinHideOutGarage(&pVehicle->GetPosition())){
if (!CGarages::IsPointWithinHideOutGarage(pVehicle->GetPosition())){
CWorld::Remove(pVehicle);
delete pVehicle;
}

View file

@ -69,7 +69,8 @@ bool CGarages::HasCarBeenCrushed(int32 handle)
}
WRAPPER void CGarages::TriggerMessage(const char *text, int16, uint16 time, int16) { EAXJMP(0x426B20); }
WRAPPER bool CGarages::IsPointWithinHideOutGarage(CVector*) { EAXJMP(0x428260); }
WRAPPER bool CGarages::IsPointWithinHideOutGarage(CVector&) { EAXJMP(0x428260); }
WRAPPER bool CGarages::IsPointWithinAnyGarage(CVector&) { EAXJMP(0x428320); }
#if 0
WRAPPER void CGarages::PrintMessages(void) { EAXJMP(0x426310); }

View file

@ -25,5 +25,6 @@ public:
static void TriggerMessage(const char *text, int16, uint16 time, int16);
static void PrintMessages(void);
static bool HasCarBeenCrushed(int32);
static bool IsPointWithinHideOutGarage(CVector*);
static bool IsPointWithinHideOutGarage(CVector&);
static bool IsPointWithinAnyGarage(CVector&);
};

View file

@ -54,14 +54,7 @@ public:
static float LimitRadianAngle(float angle)
{
float result;
if (angle < -25.0f)
result = -25.0f;
else if (angle > 25.0f)
result = 25.0f;
else
result = angle;
float result = clamp(angle, -25.0f, 25.0f);
while (result >= PI) {
result -= 2 * PI;

View file

@ -56,9 +56,10 @@ class CWorld
static CPtrList &ms_listMovingEntityPtrs;
static CSector (*ms_aSectors)[NUMSECTORS_X]; // [NUMSECTORS_Y][NUMSECTORS_X];
static uint16 &ms_nCurrentScanCode;
static CColPoint &ms_testSpherePoint;
public:
static CColPoint& ms_testSpherePoint;
static uint8 &PlayerInFocus;
static CPlayerInfo *Players;
static CEntity *&pIgnoreEntity;

View file

@ -8,34 +8,11 @@ WRAPPER void CCivilianPed::ProcessControl(void) { EAXJMP(0x4BFFE0); }
CCivilianPed::CCivilianPed(int pedtype, int mi) : CPed(pedtype)
{
SetModelIndex(mi);
for (int i = 0; i < 10; i++)
{
for (int i = 0; i < 10; i++) {
m_nearPeds[i] = nil;
}
}
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;
bRunningToPhone = true;
SetMoveState(PEDMOVE_RUN);
SetSeek(gPhoneInfo.m_aPhones[phoneId].m_vecPos, 0.3f);
m_phoneId = phoneId;
m_lookingForPhone = unused;
return true;
}
class CCivilianPed_ : public CCivilianPed
{
public:
@ -46,5 +23,4 @@ public:
STARTPATCHES
InjectHook(0x4BFF30, &CCivilianPed_::ctor, PATCH_JUMP);
InjectHook(0x4BFFC0, &CCivilianPed_::dtor, PATCH_JUMP);
InjectHook(0x4C10C0, &CCivilianPed::ProcessNearestFreePhone, PATCH_JUMP);
ENDPATCHES

View file

@ -9,6 +9,5 @@ public:
~CCivilianPed(void) { }
void ProcessControl(void);
bool ProcessNearestFreePhone(int);
};
static_assert(sizeof(CCivilianPed) == 0x53C, "CCivilianPed: error");

File diff suppressed because it is too large Load diff

View file

@ -14,6 +14,7 @@
#include "EventList.h"
struct CPathNode;
class CAccident;
struct CPedAudioData
{
@ -57,6 +58,7 @@ struct FightMove
};
static_assert(sizeof(FightMove) == 0x18, "FightMove: error");
// TO-DO: This is eFightState on mobile.
enum PedFightMoves
{
FIGHTMOVE_NULL,
@ -169,7 +171,7 @@ enum {
enum PedLineUpPhase {
LINE_UP_TO_CAR_START,
LINE_UP_TO_CAR_END,
LINE_UP_TO_CAR_2
LINE_UP_TO_CAR_2 // Buggy. Used for cops arresting you from passenger door
};
enum PedOnGroundState {
@ -330,7 +332,7 @@ public:
uint8 bClearObjective : 1;
uint8 m_ped_flagH10 : 1;
uint8 bCollidedWithMyVehicle : 1;
uint8 m_ped_flagH40 : 1;
uint8 bRichFromMugging : 1; // ped has lots of cash from mugging people - will drop money if someone points gun to him
uint8 m_ped_flagH80 : 1;
uint8 bShakeFist : 1; // test shake hand at look entity
@ -411,9 +413,9 @@ public:
bool bRunningToPhone;
uint8 field_31D;
int16 m_phoneId;
uint32 m_lookingForPhone; // unused
eCrimeType m_crimeToReportOnPhone;
uint32 m_phoneTalkTimer;
void *m_lastAccident;
CAccident *m_lastAccident;
int32 m_nPedType;
CPedStats *m_pedStats;
float m_fleeFromPosX;
@ -646,6 +648,8 @@ public:
void SeekCar(void);
void SeekBoatPosition(void);
bool PositionPedOutOfCollision(void);
bool RunToReportCrime(eCrimeType);
bool PlacePedOnDryLand(void);
// Static methods
static CVector GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float offset);
@ -724,6 +728,7 @@ public:
PedState GetPedState(void) { return m_nPedState; }
void SetPedState(PedState state) { m_nPedState = state; }
bool DyingOrDead(void) { return m_nPedState == PED_DIE || m_nPedState == PED_DEAD; }
void GiveWeaponBackAfterExitingCar(void);
// set by 0482:set_threat_reaction_range_multiplier opcode
static uint16 &nThreatReactionRangeMultiplier;