mirror of
https://github.com/GTAmodding/re3.git
synced 2025-07-18 20:04:09 +00:00
Ped & fixes, including peds dive into danger fix
This commit is contained in:
parent
3bb607f9cb
commit
8fd63e5ca6
10 changed files with 876 additions and 137 deletions
|
@ -3,6 +3,8 @@
|
|||
#include "Weapon.h"
|
||||
#include "Timer.h"
|
||||
#include "WeaponInfo.h"
|
||||
#include "Ped.h"
|
||||
#include "World.h"
|
||||
|
||||
WRAPPER bool CWeapon::Fire(CEntity*, CVector*) { EAXJMP(0x55C380); }
|
||||
WRAPPER void CWeapon::FireFromCar(CAutomobile *car, bool left) { EAXJMP(0x55C940); }
|
||||
|
@ -50,7 +52,42 @@ CWeapon::IsTypeMelee(void)
|
|||
return m_eWeaponType == WEAPONTYPE_UNARMED || m_eWeaponType == WEAPONTYPE_BASEBALLBAT;
|
||||
}
|
||||
|
||||
bool
|
||||
CWeapon::HitsGround(CEntity *holder, CVector *firePos, CEntity *aimingTo)
|
||||
{
|
||||
if (!holder->IsPed() || !((CPed*)holder)->m_pSeekTarget)
|
||||
return false;
|
||||
|
||||
CWeaponInfo *ourType = CWeaponInfo::GetWeaponInfo(m_eWeaponType);
|
||||
CVector adjustedOffset = ourType->m_vecFireOffset;
|
||||
adjustedOffset.z += 0.6f;
|
||||
|
||||
CVector point1, point2;
|
||||
CEntity *foundEnt = nil;
|
||||
CColPoint foundCol;
|
||||
|
||||
if (firePos)
|
||||
point1 = *firePos;
|
||||
else
|
||||
point1 = holder->GetMatrix() * adjustedOffset;
|
||||
|
||||
CEntity *aimEntity = aimingTo ? aimingTo : ((CPed*)holder)->m_pSeekTarget;
|
||||
point2 = aimEntity->GetPosition();
|
||||
point2.z += 0.6f;
|
||||
|
||||
CWorld::ProcessLineOfSight(point1, point2, foundCol, foundEnt, true, false, false, false, false, false, false);
|
||||
if (foundEnt && foundEnt->IsBuilding()) {
|
||||
// That was supposed to be Magnitude, according to leftover code in assembly
|
||||
float diff = (foundCol.point.z - point1.z);
|
||||
if (diff < 0.0f && diff > -3.0f)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x55C330, &CWeapon::Initialise, PATCH_JUMP);
|
||||
InjectHook(0x5639D0, &CWeapon::Reload, PATCH_JUMP);
|
||||
InjectHook(0x564890, &CWeapon::HitsGround, PATCH_JUMP);
|
||||
ENDPATCHES
|
Loading…
Add table
Add a link
Reference in a new issue