diff options
Diffstat (limited to 'src/weapons/Weapon.cpp')
-rw-r--r-- | src/weapons/Weapon.cpp | 68 |
1 files changed, 47 insertions, 21 deletions
diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp index a3d52f69..aef53094 100644 --- a/src/weapons/Weapon.cpp +++ b/src/weapons/Weapon.cpp @@ -973,7 +973,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim, if ( victimPed->Dead() ) { CAnimBlendAssociation *asoc; - if ( RpAnimBlendClumpGetFirstAssociation(victimPed->GetClump(), ASSOC_FLAG800) ) + if ( RpAnimBlendClumpGetFirstAssociation(victimPed->GetClump(), ASSOC_FRONTAL) ) asoc = CAnimManager::BlendAnimation(victimPed->GetClump(), ASSOCGRP_STD, ANIM_FLOOR_HIT_F, 8.0f); else asoc = CAnimManager::BlendAnimation(victimPed->GetClump(), ASSOCGRP_STD, ANIM_FLOOR_HIT, 8.0f); @@ -990,7 +990,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim, } else { - switch ( victim->m_type ) + switch ( victim->GetType() ) { case ENTITY_TYPE_BUILDING: { @@ -1047,13 +1047,13 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim, if ( !victimObject->bInfiniteMass ) { - if ( victimObject->bIsStatic && victimObject->m_fUprootLimit <= 0.0f ) + if ( victimObject->IsStatic() && victimObject->m_fUprootLimit <= 0.0f ) { victimObject->bIsStatic = false; victimObject->AddToMovingList(); } - if ( !victimObject->bIsStatic ) + if ( !victimObject->IsStatic()) { CVector moveForce = point->normal*-4.0f; victimObject->ApplyMoveForce(moveForce.x, moveForce.y, moveForce.z); @@ -1065,7 +1065,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim, } } - switch ( victim->m_type ) + switch ( victim->GetType() ) { case ENTITY_TYPE_BUILDING: { @@ -1256,7 +1256,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource) } else { - switch ( victim->m_type ) + switch ( victim->GetType() ) { case ENTITY_TYPE_VEHICLE: { @@ -1296,13 +1296,13 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource) if ( !victimObject->bInfiniteMass ) { - if ( victimObject->bIsStatic && victimObject->m_fUprootLimit <= 0.0f ) + if ( victimObject->IsStatic() && victimObject->m_fUprootLimit <= 0.0f ) { victimObject->bIsStatic = false; victimObject->AddToMovingList(); } - if ( !victimObject->bIsStatic ) + if ( !victimObject->IsStatic()) { CVector moveForce = point.normal*-5.0f; victimObject->ApplyMoveForce(moveForce.x, moveForce.y, moveForce.z); @@ -1315,7 +1315,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource) } } - switch ( victim->m_type ) + switch ( victim->GetType() ) { case ENTITY_TYPE_BUILDING: { @@ -1724,7 +1724,7 @@ CWeapon::FireInstantHitFromCar(CAutomobile *shooter, bool left) else CGlass::WasGlassHitByBullet(victim, point.point); - switch ( victim->m_type ) + switch ( victim->GetType() ) { case ENTITY_TYPE_BUILDING: { @@ -1796,10 +1796,10 @@ CWeapon::DoDoomAiming(CEntity *shooter, CVector *source, CVector *target) if ( (CEntity*)shooterPed != victim && shooterPed->CanSeeEntity(victim, DEGTORAD(22.5f)) ) { - if ( !(victim->m_status == STATUS_TRAIN_MOVING - || victim->m_status == STATUS_TRAIN_NOT_MOVING - || victim->m_status == STATUS_HELI - || victim->m_status == STATUS_PLANE) ) + if ( !(victim->GetStatus() == STATUS_TRAIN_MOVING + || victim->GetStatus() == STATUS_TRAIN_NOT_MOVING + || victim->GetStatus() == STATUS_HELI + || victim->GetStatus() == STATUS_PLANE) ) { float distToVictim = (shooterPed->GetPosition()-victim->GetPosition()).Magnitude2D(); float distToVictimZ = Abs(shooterPed->GetPosition().z-victim->GetPosition().z); @@ -1866,10 +1866,10 @@ CWeapon::DoTankDoomAiming(CEntity *shooter, CEntity *driver, CVector *source, CV if ( shooter != victim && driver != victim ) { - if ( !(victim->m_status == STATUS_TRAIN_MOVING - || victim->m_status == STATUS_TRAIN_NOT_MOVING - || victim->m_status == STATUS_HELI - || victim->m_status == STATUS_PLANE) ) + if ( !(victim->GetStatus() == STATUS_TRAIN_MOVING + || victim->GetStatus() == STATUS_TRAIN_NOT_MOVING + || victim->GetStatus() == STATUS_HELI + || victim->GetStatus() == STATUS_PLANE) ) { if ( !(victim->IsVehicle() && victim->bRenderScorched) ) { @@ -2086,7 +2086,7 @@ FireOneInstantHitRound(CVector *source, CVector *target, int32 damage) ((CVehicle *)victim)->InflictDamage(nil, WEAPONTYPE_UZI, damage); //BUG ? no CGlass::WasGlassHitByBullet - switch ( victim->m_type ) + switch ( victim->GetType() ) { case ENTITY_TYPE_BUILDING: { @@ -2232,7 +2232,7 @@ CWeapon::BlowUpExplosiveThings(CEntity *thing) object->m_vecMoveSpeed.x += float((CGeneral::GetRandomNumber()&255) - 128) * 0.0002f; object->m_vecMoveSpeed.y += float((CGeneral::GetRandomNumber()&255) - 128) * 0.0002f; - if ( object->bIsStatic ) + if ( object->IsStatic()) { object->bIsStatic = false; object->AddToMovingList(); @@ -2257,4 +2257,30 @@ bool CWeapon::ProcessLineOfSight(CVector const &point1, CVector const &point2, CColPoint &point, CEntity *&entity, eWeaponType type, CEntity *shooter, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects) { return CWorld::ProcessLineOfSight(point1, point2, point, entity, checkBuildings, checkVehicles, checkPeds, checkObjects, checkDummies, ignoreSeeThrough, ignoreSomeObjects); -}
\ No newline at end of file +} + +#ifdef COMPATIBLE_SAVES +void +CWeapon::Save(uint8*& buf) +{ + WriteSaveBuf<uint32>(buf, m_eWeaponType); + WriteSaveBuf<uint32>(buf, m_eWeaponState); + WriteSaveBuf<uint32>(buf, m_nAmmoInClip); + WriteSaveBuf<uint32>(buf, m_nAmmoTotal); + WriteSaveBuf<uint32>(buf, m_nTimer); + WriteSaveBuf<bool>(buf, m_bAddRotOffset); + SkipSaveBuf(buf, 3); +} + +void +CWeapon::Load(uint8*& buf) +{ + m_eWeaponType = (eWeaponType)ReadSaveBuf<uint32>(buf); + m_eWeaponState = (eWeaponState)ReadSaveBuf<uint32>(buf); + m_nAmmoInClip = ReadSaveBuf<uint32>(buf); + m_nAmmoTotal = ReadSaveBuf<uint32>(buf); + m_nTimer = ReadSaveBuf<uint32>(buf); + m_bAddRotOffset = ReadSaveBuf<bool>(buf); + SkipSaveBuf(buf, 3); +} +#endif |