Weapon fixes and thingies

This commit is contained in:
eray orçunus
2020-05-17 20:36:48 +03:00
parent 40ee29fb99
commit 84f8312b86
35 changed files with 639 additions and 405 deletions

View File

@ -3017,11 +3017,15 @@ void
CAutomobile::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);
weapon->Update(pDriver->m_audioEntityId, nil);
bool lookingLeft = false;
bool lookingRight = false;
@ -3037,37 +3041,42 @@ CAutomobile::DoDriveByShootings(void)
lookingRight = true;
}
AnimationId rightAnim = ANIM_DRIVEBY_R;
AnimationId leftAnim = ANIM_DRIVEBY_L;
if (pDriver->m_pMyVehicle->bLowVehicle) {
rightAnim = ANIM_DRIVEBY_LOW_R;
leftAnim = ANIM_DRIVEBY_LOW_L;
}
if(lookingLeft || lookingRight){
if(lookingLeft){
anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_DRIVEBY_R);
anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), rightAnim);
if(anim)
anim->blendDelta = -1000.0f;
anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_DRIVEBY_L);
anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), leftAnim);
if(anim == nil || anim->blendDelta < 0.0f)
CAnimManager::AddAnimation(pDriver->GetClump(), ASSOCGRP_STD, ANIM_DRIVEBY_L);
else
anim->SetRun();
anim = CAnimManager::AddAnimation(pDriver->GetClump(), ASSOCGRP_STD, leftAnim);
}else if(pDriver->m_pMyVehicle->pPassengers[0] == nil || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON){
anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_DRIVEBY_L);
anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), leftAnim);
if(anim)
anim->blendDelta = -1000.0f;
anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_DRIVEBY_R);
anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), rightAnim);
if(anim == nil || anim->blendDelta < 0.0f)
CAnimManager::AddAnimation(pDriver->GetClump(), ASSOCGRP_STD, ANIM_DRIVEBY_R);
else
anim->SetRun();
anim = CAnimManager::AddAnimation(pDriver->GetClump(), ASSOCGRP_STD, rightAnim);
}
if(CPad::GetPad(0)->GetCarGunFired() && CTimer::GetTimeInMilliseconds() > weapon->m_nTimer){
weapon->FireFromCar(this, lookingLeft);
weapon->m_nTimer = CTimer::GetTimeInMilliseconds() + 70;
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);
anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), leftAnim);
if(anim)
anim->blendDelta = -1000.0f;
anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_DRIVEBY_R);
anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), rightAnim);
if(anim)
anim->blendDelta = -1000.0f;
}

View File

@ -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)

View File

@ -61,6 +61,7 @@ public:
void SetupModelNodes();
void PruneWakeTrail(void);
void AddWakePoint(CVector point);
void DoDriveByShootings(void);
static CBoat *apFrameWakeGeneratingBoats[4];

View File

@ -1045,7 +1045,7 @@ CVehicle::SetUpDriver(void)
if(VehicleCreatedBy != RANDOM_VEHICLE)
return nil;
pDriver = CPopulation::AddPedInCar(this, false);
pDriver = CPopulation::AddPedInCar(this, true);
pDriver->m_pMyVehicle = this;
pDriver->m_pMyVehicle->RegisterReference((CEntity**)&pDriver->m_pMyVehicle);
pDriver->bInVehicle = true;
@ -1061,7 +1061,7 @@ CVehicle::SetupPassenger(int n)
if(pPassengers[n])
return pPassengers[n];
pPassengers[n] = CPopulation::AddPedInCar(this, true);
pPassengers[n] = CPopulation::AddPedInCar(this, false);
pPassengers[n]->m_pMyVehicle = this;
pPassengers[n]->m_pMyVehicle->RegisterReference((CEntity**)&pPassengers[n]->m_pMyVehicle);
pPassengers[n]->bInVehicle = true;

View File

@ -300,7 +300,6 @@ public:
CVehicleModelInfo* GetModelInfo() { return (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()); }
bool IsTaxi(void) { return GetModelIndex() == MI_TAXI || GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_ZEBRA || GetModelIndex() == MI_KAUFMAN; }
bool IsRealHeli(void) { return !!(pHandling->Flags & HANDLING_IS_HELI); }
AnimationId GetDriverAnim(void) { return IsCar() && bLowVehicle ? ANIM_CAR_LSIT : (IsBoat() && GetModelIndex() != MI_SPEEDER ? ANIM_DRIVE_BOAT : ANIM_CAR_SIT); }
static bool bWheelsOnlyCheat;
static bool bAllDodosCheat;