From 84f8312b8666b2774eafbbb0e6d034ba598fd69c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Sun, 17 May 2020 20:36:48 +0300 Subject: Weapon fixes and thingies --- src/vehicles/Boat.cpp | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) (limited to 'src/vehicles/Boat.cpp') diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp index 784d859f..1e7f8ecf 100644 --- a/src/vehicles/Boat.cpp +++ b/src/vehicles/Boat.cpp @@ -19,6 +19,9 @@ #include "Pools.h" #include "Pad.h" #include "Boat.h" +#include "AnimBlendAssociation.h" +#include "RpAnimBlend.h" +#include "Record.h" #define INVALID_ORIENTATION (-9999.99f) @@ -149,6 +152,9 @@ CBoat::ProcessControl(void) ProcessControlInputs(0); if(GetModelIndex() == MI_PREDATOR) DoFixedMachineGuns(); + + if (!CRecordDataForChase::IsRecording()) + DoDriveByShootings(); break; case STATUS_SIMPLE: m_bIsAnchored = false; @@ -912,6 +918,68 @@ CBoat::AddWakePoint(CVector point) } } +void +CBoat::DoDriveByShootings(void) +{ + CAnimBlendAssociation *anim; + CPlayerInfo* playerInfo = ((CPlayerPed*)this)->GetPlayerInfoForThisPlayerPed(); + if (playerInfo && !playerInfo->m_bDriveByAllowed) + return; + + CWeapon *weapon = pDriver->GetWeapon(); + if(CWeaponInfo::GetWeaponInfo(weapon->m_eWeaponType)->m_nWeaponSlot != 5) + return; + + weapon->Update(pDriver->m_audioEntityId, nil); + + bool lookingLeft = false; + bool lookingRight = false; + if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN){ + if(CPad::GetPad(0)->GetLookLeft()) + lookingLeft = true; + if(CPad::GetPad(0)->GetLookRight()) + lookingRight = true; + }else{ + if(TheCamera.Cams[TheCamera.ActiveCam].LookingLeft) + lookingLeft = true; + if(TheCamera.Cams[TheCamera.ActiveCam].LookingRight) + lookingRight = true; + } + + if(lookingLeft || lookingRight){ + if(lookingLeft){ + anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_DRIVEBY_R); + if(anim) + anim->blendDelta = -1000.0f; + anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_DRIVEBY_L); + if(anim == nil || anim->blendDelta < 0.0f) + anim = CAnimManager::AddAnimation(pDriver->GetClump(), ASSOCGRP_STD, ANIM_DRIVEBY_L); + }else if(pDriver->m_pMyVehicle->pPassengers[0] == nil || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON){ + anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_DRIVEBY_L); + if(anim) + anim->blendDelta = -1000.0f; + anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_DRIVEBY_R); + if(anim == nil || anim->blendDelta < 0.0f) + anim = CAnimManager::AddAnimation(pDriver->GetClump(), ASSOCGRP_STD, ANIM_DRIVEBY_R); + } + + if (!anim || !anim->IsRunning()) { + if (CPad::GetPad(0)->GetCarGunFired() && CTimer::GetTimeInMilliseconds() > weapon->m_nTimer) { + weapon->FireFromCar(this, lookingLeft); + weapon->m_nTimer = CTimer::GetTimeInMilliseconds() + 70; + } + } + }else{ + weapon->Reload(); + anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_DRIVEBY_L); + if(anim) + anim->blendDelta = -1000.0f; + anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_DRIVEBY_R); + if(anim) + anim->blendDelta = -1000.0f; + } +} + #ifdef COMPATIBLE_SAVES void CBoat::Save(uint8*& buf) -- cgit v1.2.3 From 4c822e8375268ac34f92af3f1960965446d32506 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Tue, 19 May 2020 20:54:05 +0300 Subject: script revision --- src/vehicles/Boat.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/vehicles/Boat.cpp') diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp index 1e7f8ecf..c4ac94a2 100644 --- a/src/vehicles/Boat.cpp +++ b/src/vehicles/Boat.cpp @@ -273,9 +273,17 @@ CBoat::ProcessControl(void) if(0.1f * m_fMass * GRAVITY*CTimer::GetTimeStep() < buoyanceImpulse.z){ bBoatInWater = true; bIsInWater = true; + if (GetUp().z < -0.6f && Abs(GetMoveSpeed().x) < 0.05 && Abs(GetMoveSpeed().y) < 0.05) { + bIsDrowning = true; + if (pDriver) + pDriver->InflictDamage(nil, WEAPONTYPE_DROWNING, CTimer::GetTimeStep(), PEDPIECE_TORSO, 0); + } + else + bIsDrowning = false; }else{ bBoatInWater = false; bIsInWater = false; + bIsDrowning = false; } m_fVolumeUnderWater = mod_Buoyancy.m_volumeUnderWater; @@ -519,6 +527,7 @@ CBoat::ProcessControl(void) }else{ bBoatInWater = false; bIsInWater = false; + bIsDrowning = false; } if(m_bIsAnchored){ -- cgit v1.2.3 From a53ca58e566ffceb058451bc49bcc5810c26cb37 Mon Sep 17 00:00:00 2001 From: aap Date: Fri, 22 May 2020 14:27:16 +0200 Subject: CPhysical --- src/vehicles/Boat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/vehicles/Boat.cpp') diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp index c4ac94a2..483aa562 100644 --- a/src/vehicles/Boat.cpp +++ b/src/vehicles/Boat.cpp @@ -83,7 +83,7 @@ CBoat::CBoat(int mi, uint8 owner) : CVehicle(owner) bIsInWater = true; - unk1 = 0.0f; + m_phys_unused1 = 0.0f; m_bIsAnchored = true; m_fOrientation = INVALID_ORIENTATION; bTouchingWater = true; -- cgit v1.2.3 From 4870d9a31be6302037eb7ddcf0b99ea25ebccabc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Sun, 24 May 2020 02:59:30 +0300 Subject: Menu borders and weapon fixes --- src/vehicles/Boat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/vehicles/Boat.cpp') diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp index 483aa562..b9d97716 100644 --- a/src/vehicles/Boat.cpp +++ b/src/vehicles/Boat.cpp @@ -930,7 +930,7 @@ CBoat::AddWakePoint(CVector point) void CBoat::DoDriveByShootings(void) { - CAnimBlendAssociation *anim; + CAnimBlendAssociation *anim = nil; CPlayerInfo* playerInfo = ((CPlayerPed*)this)->GetPlayerInfoForThisPlayerPed(); if (playerInfo && !playerInfo->m_bDriveByAllowed) return; -- cgit v1.2.3