mirror of
https://github.com/halpz/re3.git
synced 2025-06-28 15:26:19 +00:00
Try to build with mingw
This commit is contained in:
@ -232,35 +232,35 @@ bool CBulletInfo::TestForSniperBullet(float x1, float x2, float y1, float y2, fl
|
||||
#else
|
||||
float minP = 0.0f;
|
||||
float maxP = 1.0f;
|
||||
float minX = min(PlayerSniperBulletStart.x, PlayerSniperBulletEnd.x);
|
||||
float maxX = max(PlayerSniperBulletStart.x, PlayerSniperBulletEnd.x);
|
||||
float minX = Min(PlayerSniperBulletStart.x, PlayerSniperBulletEnd.x);
|
||||
float maxX = Max(PlayerSniperBulletStart.x, PlayerSniperBulletEnd.x);
|
||||
if (minX < x2 || maxX > x1) {
|
||||
if (minX < x1)
|
||||
minP = min(minP, (x1 - minX) / (maxX - minX));
|
||||
minP = Min(minP, (x1 - minX) / (maxX - minX));
|
||||
if (maxX > x2)
|
||||
maxP = max(maxP, (maxX - x2) / (maxX - minX));
|
||||
maxP = Max(maxP, (maxX - x2) / (maxX - minX));
|
||||
}
|
||||
else
|
||||
return false;
|
||||
float minY = min(PlayerSniperBulletStart.y, PlayerSniperBulletEnd.y);
|
||||
float maxY = max(PlayerSniperBulletStart.y, PlayerSniperBulletEnd.y);
|
||||
float minY = Min(PlayerSniperBulletStart.y, PlayerSniperBulletEnd.y);
|
||||
float maxY = Max(PlayerSniperBulletStart.y, PlayerSniperBulletEnd.y);
|
||||
if (minY < y2 || maxY > y1) {
|
||||
if (minY < y1)
|
||||
minP = min(minP, (y1 - minY) / (maxY - minY));
|
||||
minP = Min(minP, (y1 - minY) / (maxY - minY));
|
||||
if (maxY > y2)
|
||||
maxP = max(maxP, (maxY - y2) / (maxY - minY));
|
||||
maxP = Max(maxP, (maxY - y2) / (maxY - minY));
|
||||
}
|
||||
#ifdef FIX_BUGS
|
||||
else
|
||||
return false;
|
||||
#endif
|
||||
float minZ = min(PlayerSniperBulletStart.z, PlayerSniperBulletEnd.z);
|
||||
float maxZ = max(PlayerSniperBulletStart.z, PlayerSniperBulletEnd.z);
|
||||
float minZ = Min(PlayerSniperBulletStart.z, PlayerSniperBulletEnd.z);
|
||||
float maxZ = Max(PlayerSniperBulletStart.z, PlayerSniperBulletEnd.z);
|
||||
if (minZ < z2 || maxZ > z1) {
|
||||
if (minZ < z1)
|
||||
minP = min(minP, (z1 - minZ) / (maxZ - minZ));
|
||||
minP = Min(minP, (z1 - minZ) / (maxZ - minZ));
|
||||
if (maxZ > z2)
|
||||
maxP = max(maxP, (maxZ - z2) / (maxZ - minZ));
|
||||
maxP = Max(maxP, (maxZ - z2) / (maxZ - minZ));
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
@ -1,7 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "WeaponType.h"
|
||||
|
||||
class CEntity;
|
||||
enum eWeaponType;
|
||||
|
||||
class CBulletInfo
|
||||
{
|
||||
|
@ -1,9 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "WeaponType.h"
|
||||
|
||||
class CEntity;
|
||||
class CObject;
|
||||
class CProjectile;
|
||||
enum eWeaponType;
|
||||
|
||||
class CProjectileInfo
|
||||
{
|
||||
|
@ -109,7 +109,7 @@ CShotInfo::Update()
|
||||
if (shot.m_sourceEntity) {
|
||||
assert(shot.m_sourceEntity->IsPed());
|
||||
CPed *ped = (CPed*) shot.m_sourceEntity;
|
||||
float radius = max(1.0f, shot.m_radius);
|
||||
float radius = Max(1.0f, shot.m_radius);
|
||||
|
||||
for (int i = 0; i < ped->m_numNearPeds; ++i) {
|
||||
CPed *nearPed = ped->m_nearPeds[i];
|
||||
|
@ -1,7 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "WeaponType.h"
|
||||
|
||||
class CEntity;
|
||||
enum eWeaponType;
|
||||
|
||||
class CShotInfo
|
||||
{
|
||||
|
@ -107,9 +107,11 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource)
|
||||
CVector fireOffset(0.0f, 0.0f, 0.6f);
|
||||
CVector *source = fireSource;
|
||||
|
||||
if ( !fireSource )
|
||||
source = &(shooter->GetMatrix() * fireOffset);
|
||||
|
||||
if (!fireSource) {
|
||||
static CVector tmp;
|
||||
tmp = shooter->GetMatrix() * fireOffset;
|
||||
source = &tmp;
|
||||
}
|
||||
if ( m_bAddRotOffset )
|
||||
{
|
||||
float heading = RADTODEG(shooter->GetForward().Heading());
|
||||
@ -997,7 +999,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
|
||||
CParticle::AddParticle(PARTICLE_SPARK, point->point, point->normal*0.05f);
|
||||
|
||||
CVector dist = point->point - (*source);
|
||||
CVector offset = dist - max(0.2f*dist.Magnitude(), 2.0f) * CVector(ahead.x, ahead.y, 0.0f);
|
||||
CVector offset = dist - Max(0.2f*dist.Magnitude(), 2.0f) * CVector(ahead.x, ahead.y, 0.0f);
|
||||
CVector smokePos = *source + offset;
|
||||
|
||||
smokePos.x += CGeneral::GetRandomNumberInRange(-0.2f, 0.2f);
|
||||
@ -1016,7 +1018,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
|
||||
CParticle::AddParticle(PARTICLE_SPARK, point->point, point->normal*0.05f);
|
||||
|
||||
CVector dist = point->point - (*source);
|
||||
CVector offset = dist - max(0.2f*dist.Magnitude(), 0.5f) * CVector(ahead.x, ahead.y, 0.0f);
|
||||
CVector offset = dist - Max(0.2f*dist.Magnitude(), 0.5f) * CVector(ahead.x, ahead.y, 0.0f);
|
||||
CVector smokePos = *source + offset;
|
||||
|
||||
CParticle::AddParticle(PARTICLE_BULLETHIT_SMOKE, smokePos, CVector(0.0f, 0.0f, 0.0f));
|
||||
@ -1265,7 +1267,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
|
||||
CParticle::AddParticle(PARTICLE_SPARK, point.point, point.normal*0.05f);
|
||||
|
||||
CVector dist = point.point - (*fireSource);
|
||||
CVector offset = dist - max(0.2f*dist.Magnitude(), 2.0f) * CVector(shootRot.x, shootRot.y, 0.0f);
|
||||
CVector offset = dist - Max(0.2f*dist.Magnitude(), 2.0f) * CVector(shootRot.x, shootRot.y, 0.0f);
|
||||
CVector smokePos = *fireSource + offset;
|
||||
|
||||
CParticle::AddParticle(PARTICLE_BULLETHIT_SMOKE, smokePos, CVector(0.0f, 0.0f, 0.0f));
|
||||
@ -1280,7 +1282,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
|
||||
CParticle::AddParticle(PARTICLE_SPARK, point.point, point.normal*0.05f);
|
||||
|
||||
CVector dist = point.point - (*fireSource);
|
||||
CVector offset = dist - max(0.2f*dist.Magnitude(), 2.0f) * CVector(shootRot.x, shootRot.y, 0.0f);
|
||||
CVector offset = dist - Max(0.2f*dist.Magnitude(), 2.0f) * CVector(shootRot.x, shootRot.y, 0.0f);
|
||||
CVector smokePos = *fireSource + offset;
|
||||
|
||||
smokePos.x += CGeneral::GetRandomNumberInRange(-0.2f, 0.2f);
|
||||
@ -1347,7 +1349,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
|
||||
else
|
||||
{
|
||||
CVector traceTarget = *fireSource;
|
||||
traceTarget += (target - (*fireSource)) * min(info->m_fRange, 30.0f) / info->m_fRange;
|
||||
traceTarget += (target - (*fireSource)) * Min(info->m_fRange, 30.0f) / info->m_fRange;
|
||||
CBulletTraces::AddTrace(fireSource, &traceTarget);
|
||||
}
|
||||
}
|
||||
@ -1877,8 +1879,9 @@ CWeapon::DoTankDoomAiming(CEntity *shooter, CEntity *driver, CVector *source, CV
|
||||
|
||||
if ( 3.0f*distToVictimZ < distToVictim )
|
||||
{
|
||||
CVector tmp = CVector(victim->GetPosition().x, victim->GetPosition().y, 0.0f);
|
||||
if ( CCollision::DistToLine(source, target,
|
||||
&CVector(victim->GetPosition().x, victim->GetPosition().y, 0.0f)) < victim->GetBoundRadius()*3.0f )
|
||||
&tmp) < victim->GetBoundRadius()*3.0f )
|
||||
{
|
||||
float vehicleDist = Sqrt(SQR(distToVictim) + SQR(distToVictimZ));
|
||||
if ( vehicleDist < closestEntityDist )
|
||||
@ -2145,12 +2148,12 @@ CWeapon::MakePedsJumpAtShot(CPhysical *shooter, CVector *source, CVector *target
|
||||
ASSERT(source!=nil);
|
||||
ASSERT(target!=nil);
|
||||
|
||||
float minx = min(source->x, target->x) - 2.0f;
|
||||
float maxx = max(source->x, target->x) + 2.0f;
|
||||
float miny = min(source->y, target->y) - 2.0f;
|
||||
float maxy = max(source->y, target->y) + 2.0f;
|
||||
float minz = min(source->z, target->z) - 2.0f;
|
||||
float maxz = max(source->z, target->z) + 2.0f;
|
||||
float minx = Min(source->x, target->x) - 2.0f;
|
||||
float maxx = Max(source->x, target->x) + 2.0f;
|
||||
float miny = Min(source->y, target->y) - 2.0f;
|
||||
float maxy = Max(source->y, target->y) + 2.0f;
|
||||
float minz = Min(source->z, target->z) - 2.0f;
|
||||
float maxz = Max(source->z, target->z) + 2.0f;
|
||||
|
||||
for ( int32 i = CPools::GetPedPool()->GetSize() - 1; i >= 0; i--)
|
||||
{
|
||||
|
@ -1,56 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "WeaponType.h"
|
||||
|
||||
#define DRIVEBYAUTOAIMING_MAXDIST (2.5f)
|
||||
#define DOOMAUTOAIMING_MAXDIST (9000.0f)
|
||||
|
||||
enum eWeaponType
|
||||
{
|
||||
WEAPONTYPE_UNARMED,
|
||||
WEAPONTYPE_BASEBALLBAT,
|
||||
WEAPONTYPE_COLT45,
|
||||
WEAPONTYPE_UZI,
|
||||
WEAPONTYPE_SHOTGUN,
|
||||
WEAPONTYPE_AK47,
|
||||
WEAPONTYPE_M16,
|
||||
WEAPONTYPE_SNIPERRIFLE,
|
||||
WEAPONTYPE_ROCKETLAUNCHER,
|
||||
WEAPONTYPE_FLAMETHROWER,
|
||||
WEAPONTYPE_MOLOTOV,
|
||||
WEAPONTYPE_GRENADE,
|
||||
WEAPONTYPE_DETONATOR,
|
||||
WEAPONTYPE_HELICANNON,
|
||||
WEAPONTYPE_LAST_WEAPONTYPE,
|
||||
WEAPONTYPE_ARMOUR,
|
||||
WEAPONTYPE_RAMMEDBYCAR,
|
||||
WEAPONTYPE_RUNOVERBYCAR,
|
||||
WEAPONTYPE_EXPLOSION,
|
||||
WEAPONTYPE_UZI_DRIVEBY,
|
||||
WEAPONTYPE_DROWNING,
|
||||
WEAPONTYPE_FALL,
|
||||
WEAPONTYPE_UNIDENTIFIED,
|
||||
|
||||
WEAPONTYPE_TOTALWEAPONS = WEAPONTYPE_LAST_WEAPONTYPE,
|
||||
WEAPONTYPE_TOTAL_INVENTORY_WEAPONS = 13,
|
||||
};
|
||||
|
||||
enum eWeaponFire {
|
||||
WEAPON_FIRE_MELEE,
|
||||
WEAPON_FIRE_INSTANT_HIT,
|
||||
WEAPON_FIRE_PROJECTILE,
|
||||
WEAPON_FIRE_AREA_EFFECT,
|
||||
WEAPON_FIRE_USE
|
||||
};
|
||||
|
||||
// Taken from MTA SA, seems it's unchanged
|
||||
enum eWeaponState
|
||||
{
|
||||
WEAPONSTATE_READY,
|
||||
WEAPONSTATE_FIRING,
|
||||
WEAPONSTATE_RELOADING,
|
||||
WEAPONSTATE_OUT_OF_AMMO,
|
||||
WEAPONSTATE_MELEE_MADECONTACT
|
||||
};
|
||||
|
||||
class CEntity;
|
||||
class CPhysical;
|
||||
class CAutomobile;
|
||||
|
@ -1,8 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
enum AnimationId;
|
||||
enum eWeaponFire;
|
||||
enum eWeaponType;
|
||||
#include "AnimationId.h"
|
||||
#include "WeaponType.h"
|
||||
|
||||
class CWeaponInfo {
|
||||
// static CWeaponInfo(&ms_apWeaponInfos)[14];
|
||||
|
49
src/weapons/WeaponType.h
Normal file
49
src/weapons/WeaponType.h
Normal file
@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
enum eWeaponType
|
||||
{
|
||||
WEAPONTYPE_UNARMED,
|
||||
WEAPONTYPE_BASEBALLBAT,
|
||||
WEAPONTYPE_COLT45,
|
||||
WEAPONTYPE_UZI,
|
||||
WEAPONTYPE_SHOTGUN,
|
||||
WEAPONTYPE_AK47,
|
||||
WEAPONTYPE_M16,
|
||||
WEAPONTYPE_SNIPERRIFLE,
|
||||
WEAPONTYPE_ROCKETLAUNCHER,
|
||||
WEAPONTYPE_FLAMETHROWER,
|
||||
WEAPONTYPE_MOLOTOV,
|
||||
WEAPONTYPE_GRENADE,
|
||||
WEAPONTYPE_DETONATOR,
|
||||
WEAPONTYPE_HELICANNON,
|
||||
WEAPONTYPE_LAST_WEAPONTYPE,
|
||||
WEAPONTYPE_ARMOUR,
|
||||
WEAPONTYPE_RAMMEDBYCAR,
|
||||
WEAPONTYPE_RUNOVERBYCAR,
|
||||
WEAPONTYPE_EXPLOSION,
|
||||
WEAPONTYPE_UZI_DRIVEBY,
|
||||
WEAPONTYPE_DROWNING,
|
||||
WEAPONTYPE_FALL,
|
||||
WEAPONTYPE_UNIDENTIFIED,
|
||||
|
||||
WEAPONTYPE_TOTALWEAPONS = WEAPONTYPE_LAST_WEAPONTYPE,
|
||||
WEAPONTYPE_TOTAL_INVENTORY_WEAPONS = 13,
|
||||
};
|
||||
|
||||
enum eWeaponFire {
|
||||
WEAPON_FIRE_MELEE,
|
||||
WEAPON_FIRE_INSTANT_HIT,
|
||||
WEAPON_FIRE_PROJECTILE,
|
||||
WEAPON_FIRE_AREA_EFFECT,
|
||||
WEAPON_FIRE_USE
|
||||
};
|
||||
|
||||
// Taken from MTA SA, seems it's unchanged
|
||||
enum eWeaponState
|
||||
{
|
||||
WEAPONSTATE_READY,
|
||||
WEAPONSTATE_FIRING,
|
||||
WEAPONSTATE_RELOADING,
|
||||
WEAPONSTATE_OUT_OF_AMMO,
|
||||
WEAPONSTATE_MELEE_MADECONTACT
|
||||
};
|
Reference in New Issue
Block a user