mirror of
https://github.com/halpz/re3.git
synced 2025-06-30 00:16:22 +00:00
Merge remote-tracking branch 'upstream/miami' into miami
This commit is contained in:
@ -257,7 +257,7 @@ CCopPed::ArrestPlayer(void)
|
||||
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_ARREST_GUN, 4.0f);
|
||||
|
||||
CVector suspMidPos;
|
||||
suspect->m_pedIK.GetComponentPosition((RwV3d*)suspMidPos, PED_MID);
|
||||
suspect->m_pedIK.GetComponentPosition((RwV3d)suspMidPos, PED_MID);
|
||||
m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(suspMidPos.x, suspMidPos.y,
|
||||
GetPosition().x, GetPosition().y);
|
||||
|
||||
|
@ -231,8 +231,8 @@ CEmergencyPed::MedicAI(void)
|
||||
if (nearestAccident) {
|
||||
m_pRevivedPed = nearestAccident->m_pVictim;
|
||||
m_pRevivedPed->RegisterReference((CEntity**)&m_pRevivedPed);
|
||||
m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d*)&midPos, PED_MID);
|
||||
m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d*)&headPos, PED_HEAD);
|
||||
m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d)midPos, PED_MID);
|
||||
m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d)headPos, PED_HEAD);
|
||||
SetSeek((headPos + midPos) * 0.5f, 1.0f);
|
||||
SetObjective(OBJECTIVE_NONE);
|
||||
bIsRunning = true;
|
||||
@ -271,8 +271,8 @@ CEmergencyPed::MedicAI(void)
|
||||
m_nEmergencyPedState = EMERGENCY_PED_STOP;
|
||||
break;
|
||||
}
|
||||
m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d*)&midPos, PED_MID);
|
||||
m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d*)&headPos, PED_HEAD);
|
||||
m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d)midPos, PED_MID);
|
||||
m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d)headPos, PED_HEAD);
|
||||
SetSeek((headPos + midPos) * 0.5f, nearestAccident->m_nMedicsPerformingCPR * 0.5f + 1.0f);
|
||||
SetObjective(OBJECTIVE_NONE);
|
||||
bIsRunning = true;
|
||||
@ -326,8 +326,8 @@ CEmergencyPed::MedicAI(void)
|
||||
if (!m_pRevivedPed || m_pRevivedPed->m_fHealth > 0.0f)
|
||||
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
|
||||
else {
|
||||
m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d*)&midPos, PED_MID);
|
||||
m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d*)&headPos, PED_HEAD);
|
||||
m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d)midPos, PED_MID);
|
||||
m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d)headPos, PED_HEAD);
|
||||
midPos = (headPos + midPos) * 0.5f;
|
||||
m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(
|
||||
midPos.x, midPos.y,
|
||||
@ -348,8 +348,8 @@ CEmergencyPed::MedicAI(void)
|
||||
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
|
||||
break;
|
||||
}
|
||||
m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d*)&midPos, PED_MID);
|
||||
m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d*)&headPos, PED_HEAD);
|
||||
m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d)midPos, PED_MID);
|
||||
m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d)headPos, PED_HEAD);
|
||||
midPos = (headPos + midPos) * 0.5f;
|
||||
m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(
|
||||
midPos.x, midPos.y,
|
||||
|
100
src/peds/Ped.cpp
100
src/peds/Ped.cpp
@ -386,6 +386,8 @@ CPed::~CPed(void)
|
||||
}
|
||||
if (m_pFire)
|
||||
m_pFire->Extinguish();
|
||||
|
||||
ClearWeapons();
|
||||
if (bCarPassenger)
|
||||
CPopulation::ms_nTotalCarPassengerPeds--;
|
||||
if (bMiamiViceCop)
|
||||
@ -409,10 +411,11 @@ CPed::FlagToDestroyWhenNextProcessed(void)
|
||||
}
|
||||
bInVehicle = false;
|
||||
m_pMyVehicle = nil;
|
||||
|
||||
if (CharCreatedBy == MISSION_CHAR)
|
||||
m_nPedState = PED_DEAD;
|
||||
SetPedState(PED_DEAD);
|
||||
else
|
||||
m_nPedState = PED_NONE;
|
||||
SetPedState(PED_NONE);
|
||||
m_pVehicleAnim = nil;
|
||||
}
|
||||
|
||||
@ -686,7 +689,7 @@ CPed::GiveWeapon(eWeaponType weaponType, uint32 ammo, bool unused)
|
||||
|
||||
if (m_weapons[slot].m_eWeaponType == weaponType) {
|
||||
GetWeapon(slot).m_nAmmoTotal += ammo;
|
||||
if (weaponType < WEAPONTYPE_LAST_WEAPONTYPE && weaponType > WEAPONTYPE_UNARMED && CWeaponInfo::ms_aMaxAmmoForWeapon[weaponType] >= 0) {
|
||||
if (weaponType < WEAPONTYPE_TOTALWEAPONS && weaponType > WEAPONTYPE_UNARMED && CWeaponInfo::ms_aMaxAmmoForWeapon[weaponType] >= 0) {
|
||||
|
||||
// Looks like abandoned idea. This block never runs, ms_aMaxAmmoForWeapon is always -1.
|
||||
GetWeapon(slot).m_nAmmoTotal = Min(CWeaponInfo::ms_aMaxAmmoForWeapon[weaponType], GetWeapon(slot).m_nAmmoTotal);
|
||||
@ -885,9 +888,8 @@ CPed::AddWeaponModel(int id)
|
||||
CModelInfo::GetModelInfo(id)->AddRef();
|
||||
m_wepModelID = id;
|
||||
|
||||
// TODO(Miami)
|
||||
// if (IsPlayer() && id == MI_MINIGUN)
|
||||
// ((CPlayerPed*)this)->m_pMinigunTopAtomic = (RpAtomic*)CModelInfo::GetModelInfo(MI_MINIGUN2)->CreateInstance();
|
||||
if (IsPlayer() && id == MI_MINIGUN)
|
||||
((CPlayerPed*)this)->m_pMinigunTopAtomic = (RpAtomic*)CModelInfo::GetModelInfo(MI_MINIGUN2)->CreateInstance();
|
||||
}
|
||||
}
|
||||
|
||||
@ -899,7 +901,7 @@ CPed::AimGun(void)
|
||||
|
||||
if (m_pSeekTarget) {
|
||||
if (m_pSeekTarget->IsPed()) {
|
||||
((CPed*)m_pSeekTarget)->m_pedIK.GetComponentPosition(&pos, PED_MID);
|
||||
((CPed*)m_pSeekTarget)->m_pedIK.GetComponentPosition(pos, PED_MID);
|
||||
vector = pos;
|
||||
} else {
|
||||
vector = m_pSeekTarget->GetPosition();
|
||||
@ -1508,9 +1510,8 @@ CPed::Attack(void)
|
||||
|
||||
GetWeapon()->Fire(this, &firePos);
|
||||
|
||||
// TODO(Miami): Teargas
|
||||
if (ourWeaponType == WEAPONTYPE_MOLOTOV || ourWeaponType == WEAPONTYPE_GRENADE || ourWeaponType == WEAPONTYPE_DETONATOR_GRENADE
|
||||
/* ourWeaponType == WEAPONTYPE_TEARGAS*/) {
|
||||
if (ourWeaponType == WEAPONTYPE_MOLOTOV || ourWeaponType == WEAPONTYPE_GRENADE || ourWeaponType == WEAPONTYPE_DETONATOR_GRENADE ||
|
||||
ourWeaponType == WEAPONTYPE_TEARGAS) {
|
||||
RemoveWeaponModel(ourWeapon->m_nModelId);
|
||||
}
|
||||
if (!GetWeapon()->m_nAmmoTotal && ourWeaponFire != WEAPON_FIRE_MELEE && FindPlayerPed() != this) {
|
||||
@ -1650,10 +1651,10 @@ CPed::Attack(void)
|
||||
case WEAPONTYPE_MP5:
|
||||
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_UZI_BULLET_ECHO, 0.0f);
|
||||
break;
|
||||
case WEAPONTYPE_AK47:
|
||||
case WEAPONTYPE_RUGER:
|
||||
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, 0.0f);
|
||||
break;
|
||||
case WEAPONTYPE_M16:
|
||||
case WEAPONTYPE_M4:
|
||||
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_M16_BULLET_ECHO, 0.0f);
|
||||
break;
|
||||
default:
|
||||
@ -1668,7 +1669,7 @@ CPed::Attack(void)
|
||||
if (weaponAnimTime - 2.0f * weaponAnimAssoc->timeStep <= animLoopEnd
|
||||
&& (bIsAttacking || CTimer::GetTimeInMilliseconds() < m_shootTimer)
|
||||
&& (GetWeapon()->m_eWeaponState != WEAPONSTATE_RELOADING
|
||||
/* || GetWeapon()->m_nWeaponType == WEAPONTYPE_MINIGUN */)) { // TODO(Miami): Minigun
|
||||
|| GetWeapon()->m_eWeaponType == WEAPONTYPE_MINIGUN)) {
|
||||
|
||||
PedOnGroundState pedOnGroundState;
|
||||
if (ourWeapon->m_eWeaponFire == WEAPON_FIRE_MELEE &&
|
||||
@ -1716,10 +1717,10 @@ CPed::Attack(void)
|
||||
case WEAPONTYPE_MP5:
|
||||
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_UZI_BULLET_ECHO, 0.0f);
|
||||
break;
|
||||
case WEAPONTYPE_AK47:
|
||||
case WEAPONTYPE_RUGER:
|
||||
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, 0.0f);
|
||||
break;
|
||||
case WEAPONTYPE_M16:
|
||||
case WEAPONTYPE_M4:
|
||||
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_M16_BULLET_ECHO, 0.0f);
|
||||
break;
|
||||
default:
|
||||
@ -1765,8 +1766,7 @@ CPed::RemoveWeaponModel(int modelId)
|
||||
#endif
|
||||
RwFrameForAllObjects(m_pFrames[PED_HANDR]->frame,RemoveAllModelCB,nil);
|
||||
|
||||
// TODO(Miami): Minigun
|
||||
if (IsPlayer() && (modelId == -1 /* || modelId == MI_MINIGUN)*/)) {
|
||||
if (IsPlayer() && (modelId == -1 || modelId == MI_MINIGUN)) {
|
||||
RpAtomic* &atm = ((CPlayerPed*)this)->m_pMinigunTopAtomic;
|
||||
if (atm) {
|
||||
RwFrame *frm = RpAtomicGetFrame(atm);
|
||||
@ -1819,7 +1819,7 @@ CPed::SelectGunIfArmed(void)
|
||||
|
||||
// First condition checks for Pistol, Python and Shotguns
|
||||
if ((weaponType >= WEAPONTYPE_COLT45 && weaponType < WEAPONTYPE_TEC9) ||
|
||||
weaponType == WEAPONTYPE_UZI || weaponType == WEAPONTYPE_M16 || weaponType == WEAPONTYPE_MP5 ||
|
||||
weaponType == WEAPONTYPE_UZI || weaponType == WEAPONTYPE_M4 || weaponType == WEAPONTYPE_MP5 ||
|
||||
weaponType == WEAPONTYPE_ROCKETLAUNCHER || weaponType == WEAPONTYPE_FLAMETHROWER || weaponType == WEAPONTYPE_SNIPERRIFLE) {
|
||||
SetCurrentWeapon(i);
|
||||
return true;
|
||||
@ -1888,10 +1888,7 @@ CPed::ClearPointGunAt(void)
|
||||
ClearAimFlag();
|
||||
bIsPointingGunAt = false;
|
||||
if (m_nPedState == PED_AIM_GUN || m_nPedState == PED_ATTACK) {
|
||||
|
||||
if (m_nPedState == PED_FOLLOW_PATH)
|
||||
ClearFollowPath();
|
||||
m_nPedState = PED_IDLE;
|
||||
SetPedState(PED_IDLE);
|
||||
RestorePreviousState();
|
||||
}
|
||||
weaponInfo = CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType);
|
||||
@ -4279,16 +4276,19 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
|
||||
break;
|
||||
case WEAPONTYPE_COLT45:
|
||||
case WEAPONTYPE_SHOTGUN:
|
||||
// TODO(Miami): Shotguns
|
||||
case WEAPONTYPE_STUBBY_SHOTGUN:
|
||||
case WEAPONTYPE_SPAS12_SHOTGUN:
|
||||
case WEAPONTYPE_TEC9:
|
||||
case WEAPONTYPE_UZI:
|
||||
case WEAPONTYPE_SILENCED_INGRAM:
|
||||
case WEAPONTYPE_MP5:
|
||||
case WEAPONTYPE_M16:
|
||||
case WEAPONTYPE_AK47:
|
||||
case WEAPONTYPE_M4:
|
||||
case WEAPONTYPE_RUGER:
|
||||
case WEAPONTYPE_SNIPERRIFLE:
|
||||
case WEAPONTYPE_LASERSCOPE:
|
||||
case WEAPONTYPE_M60:
|
||||
case WEAPONTYPE_MINIGUN:
|
||||
case WEAPONTYPE_UZI_DRIVEBY:
|
||||
// TODO(Miami): Laserscope, M60, Minigun
|
||||
|
||||
if (bBulletProof)
|
||||
return false;
|
||||
@ -4296,8 +4296,8 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
|
||||
bool dontRemoveLimb;
|
||||
if (IsPlayer() || bNoCriticalHits)
|
||||
dontRemoveLimb = true;
|
||||
else if (method != WEAPONTYPE_M16 && method != WEAPONTYPE_AK47 && method != WEAPONTYPE_SNIPERRIFLE
|
||||
/* method != WEAPONTYPE_LASERSCOPE */) { // TODO(Miami): Laserscope
|
||||
else if (method != WEAPONTYPE_M4 && method != WEAPONTYPE_RUGER && method != WEAPONTYPE_SNIPERRIFLE &&
|
||||
method != WEAPONTYPE_LASERSCOPE) {
|
||||
if (method == WEAPONTYPE_SHOTGUN)
|
||||
dontRemoveLimb = CGeneral::GetRandomNumber() & 7;
|
||||
else
|
||||
@ -4651,10 +4651,7 @@ CPed::SetGetUp(void)
|
||||
}
|
||||
if (m_nPedState != PED_GETUP) {
|
||||
SetStoredState();
|
||||
if (m_nPedState == PED_FOLLOW_PATH)
|
||||
ClearFollowPath();
|
||||
|
||||
m_nPedState = PED_GETUP;
|
||||
SetPedState(PED_GETUP);
|
||||
}
|
||||
|
||||
CVehicle *collidingVeh = (CVehicle*)m_pCollidingEntity;
|
||||
@ -4971,10 +4968,7 @@ CPed::SetPointGunAt(CEntity *to)
|
||||
if (m_nPedState != PED_ATTACK)
|
||||
SetStoredState();
|
||||
|
||||
if (m_nPedState == PED_FOLLOW_PATH)
|
||||
ClearFollowPath();
|
||||
|
||||
m_nPedState = PED_AIM_GUN;
|
||||
SetPedState(PED_AIM_GUN);
|
||||
bIsPointingGunAt = true;
|
||||
SetMoveState(PEDMOVE_NONE);
|
||||
|
||||
@ -5013,7 +5007,7 @@ CPed::SetAmmo(eWeaponType weaponType, uint32 ammo)
|
||||
return;
|
||||
|
||||
GetWeapon(slot).m_nAmmoTotal = ammo;
|
||||
if (weaponType < WEAPONTYPE_LAST_WEAPONTYPE && weaponType > WEAPONTYPE_UNARMED && CWeaponInfo::ms_aMaxAmmoForWeapon[weaponType] >= 0) {
|
||||
if (weaponType < WEAPONTYPE_TOTALWEAPONS && weaponType > WEAPONTYPE_UNARMED && CWeaponInfo::ms_aMaxAmmoForWeapon[weaponType] >= 0) {
|
||||
|
||||
// Looks like abandoned idea. This block never runs, ms_aMaxAmmoForWeapon is always -1.
|
||||
GetWeapon(slot).m_nAmmoTotal = Min(CWeaponInfo::ms_aMaxAmmoForWeapon[weaponType], GetWeapon(slot).m_nAmmoTotal);
|
||||
@ -5038,7 +5032,7 @@ CPed::GrantAmmo(eWeaponType weaponType, uint32 ammo)
|
||||
return;
|
||||
|
||||
GetWeapon(slot).m_nAmmoTotal += ammo;
|
||||
if (weaponType < WEAPONTYPE_LAST_WEAPONTYPE && weaponType > WEAPONTYPE_UNARMED && CWeaponInfo::ms_aMaxAmmoForWeapon[weaponType] >= 0) {
|
||||
if (weaponType < WEAPONTYPE_TOTALWEAPONS && weaponType > WEAPONTYPE_UNARMED && CWeaponInfo::ms_aMaxAmmoForWeapon[weaponType] >= 0) {
|
||||
|
||||
// Looks like abandoned idea. This block never runs, ms_aMaxAmmoForWeapon is always -1.
|
||||
GetWeapon(slot).m_nAmmoTotal = Min(CWeaponInfo::ms_aMaxAmmoForWeapon[weaponType], GetWeapon(slot).m_nAmmoTotal);
|
||||
@ -5268,10 +5262,7 @@ CPed::SetAttack(CEntity *victim)
|
||||
&& !(m_pedStats->m_flags & STAT_SHOPPING_BAGS) && curWeapon->m_bPartialAttack)) {
|
||||
|
||||
if (m_nPedState != PED_ATTACK) {
|
||||
if (m_nPedState == PED_FOLLOW_PATH)
|
||||
ClearFollowPath();
|
||||
|
||||
m_nPedState = PED_ATTACK;
|
||||
SetPedState(PED_ATTACK);
|
||||
bIsAttacking = false;
|
||||
|
||||
CAnimBlendAssociation *animAssoc = CAnimManager::BlendAnimation(GetClump(), curWeapon->m_AnimToPlay, ANIM_MELEE_ATTACK_START, 8.0f);
|
||||
@ -5292,10 +5283,7 @@ CPed::SetAttack(CEntity *victim)
|
||||
m_nMoveState == PEDMOVE_WALK || m_nMoveState == PEDMOVE_RUN)) {
|
||||
|
||||
if (m_nPedState != PED_ATTACK) {
|
||||
if (m_nPedState == PED_FOLLOW_PATH)
|
||||
ClearFollowPath();
|
||||
|
||||
m_nPedState = PED_ATTACK;
|
||||
SetPedState(PED_ATTACK);
|
||||
bIsAttacking = false;
|
||||
CAnimBlendAssociation* animAssoc = CAnimManager::BlendAnimation(GetClump(), curWeapon->m_AnimToPlay, ANIM_MELEE_ATTACK_START, 8.0f);
|
||||
animAssoc->SetRun();
|
||||
@ -5372,10 +5360,7 @@ CPed::SetAttack(CEntity *victim)
|
||||
if (m_nPedState != PED_AIM_GUN)
|
||||
SetStoredState();
|
||||
|
||||
if (m_nPedState == PED_FOLLOW_PATH)
|
||||
ClearFollowPath();
|
||||
|
||||
m_nPedState = PED_ATTACK;
|
||||
SetPedState(PED_ATTACK);
|
||||
SetMoveState(PEDMOVE_NONE);
|
||||
if (bCrouchWhenShooting && bIsDucking && !!curWeapon->m_bCrouchFire) {
|
||||
CAnimBlendAssociation* curMoveAssoc = RpAnimBlendClumpGetAssociation(GetClump(), GetCrouchFireAnim(curWeapon));
|
||||
@ -6658,10 +6643,7 @@ CPed::SetDead(void)
|
||||
if (m_nPedState == PED_DRIVING)
|
||||
bIsVisible = false;
|
||||
|
||||
if (m_nPedState == PED_FOLLOW_PATH)
|
||||
ClearFollowPath();
|
||||
|
||||
m_nPedState = PED_DEAD;
|
||||
SetPedState(PED_DEAD);
|
||||
m_pVehicleAnim = nil;
|
||||
m_pCollidingEntity = nil;
|
||||
|
||||
@ -6712,11 +6694,7 @@ CPed::SetSeek(CVector pos, float distanceToCountDone)
|
||||
|| (m_nPedState == PED_SEEK_POS && m_vecSeekPos.x == pos.x && m_vecSeekPos.y == pos.y))
|
||||
return;
|
||||
|
||||
if (GetWeapon()->m_eWeaponType == WEAPONTYPE_M16
|
||||
|| GetWeapon()->m_eWeaponType == WEAPONTYPE_AK47
|
||||
|| GetWeapon()->m_eWeaponType == WEAPONTYPE_SNIPERRIFLE
|
||||
|| GetWeapon()->m_eWeaponType == WEAPONTYPE_ROCKETLAUNCHER
|
||||
|| GetWeapon()->m_eWeaponType == WEAPONTYPE_SHOTGUN) {
|
||||
if (!CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bCanAimWithArm) {
|
||||
ClearPointGunAt();
|
||||
}
|
||||
|
||||
@ -9735,7 +9713,7 @@ CPed::MoveHeadToLook(void)
|
||||
}
|
||||
|
||||
if (m_pLookTarget->IsPed()) {
|
||||
((CPed*)m_pLookTarget)->m_pedIK.GetComponentPosition((RwV3d*) &lookPos, PED_MID);
|
||||
((CPed*)m_pLookTarget)->m_pedIK.GetComponentPosition((RwV3d)lookPos, PED_MID);
|
||||
} else {
|
||||
lookPos = m_pLookTarget->GetPosition();
|
||||
}
|
||||
@ -13697,7 +13675,7 @@ CPed::ProcessObjective(void)
|
||||
CVector target;
|
||||
CVector ourHead = GetMatrix() * CVector(0.5f, 0.0f, 0.6f);
|
||||
if (m_pedInObjective->IsPed())
|
||||
m_pedInObjective->m_pedIK.GetComponentPosition((RwV3d*)&target, PED_MID);
|
||||
m_pedInObjective->m_pedIK.GetComponentPosition((RwV3d)target, PED_MID);
|
||||
else
|
||||
target = m_pedInObjective->GetPosition();
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "General.h"
|
||||
#include "RwHelper.h"
|
||||
|
||||
//--MIAMI: file almost done (only some special weapon cases left)
|
||||
//--MIAMI: file done
|
||||
|
||||
LimbMovementInfo CPedIK::ms_torsoInfo = { DEGTORAD(50.0f), DEGTORAD(-50.0f), DEGTORAD(8.0f), DEGTORAD(45.0f), DEGTORAD(-45.0f), DEGTORAD(5.0f) };
|
||||
LimbMovementInfo CPedIK::ms_headInfo = { DEGTORAD(90.0f), DEGTORAD(-90.0f), DEGTORAD(15.0f), DEGTORAD(45.0f), DEGTORAD(-45.0f), DEGTORAD(8.0f) };
|
||||
@ -57,9 +57,9 @@ CPedIK::RotateTorso(AnimBlendFrameData *node, LimbOrientation *limb, bool change
|
||||
}
|
||||
|
||||
void
|
||||
CPedIK::GetComponentPosition(RwV3d *pos, uint32 node)
|
||||
CPedIK::GetComponentPosition(RwV3d &pos, uint32 node)
|
||||
{
|
||||
*pos = GetComponentMatrix(m_ped, node)->pos;
|
||||
pos = GetComponentMatrix(m_ped, node)->pos;
|
||||
}
|
||||
|
||||
LimbMoveStatus
|
||||
@ -292,13 +292,20 @@ CPedIK::PointGunInDirectionUsingArm(float targetYaw, float targetPitch)
|
||||
bool
|
||||
CPedIK::PointGunAtPosition(CVector const& position)
|
||||
{
|
||||
// TODO(MIAMI): special cases for some weapons
|
||||
CVector startPoint;
|
||||
if (m_ped->GetWeapon()->m_eWeaponType == WEAPONTYPE_SPAS12_SHOTGUN || m_ped->GetWeapon()->m_eWeaponType == WEAPONTYPE_STUBBY_SHOTGUN)
|
||||
startPoint = m_ped->GetPosition();
|
||||
else {
|
||||
RwV3d armPos;
|
||||
GetComponentPosition(armPos, PED_UPPERARMR);
|
||||
startPoint.x = m_ped->GetPosition().x;
|
||||
startPoint.y = m_ped->GetPosition().y;
|
||||
startPoint.z = armPos.z;
|
||||
}
|
||||
|
||||
RwV3d armPos;
|
||||
GetComponentPosition(&armPos, PED_UPPERARMR);
|
||||
return PointGunInDirection(
|
||||
CGeneral::GetRadianAngleBetweenPoints(position.x, position.y, m_ped->GetPosition().x, m_ped->GetPosition().y),
|
||||
CGeneral::GetRadianAngleBetweenPoints(position.z, Distance2D(m_ped->GetPosition(), position.x, position.y), armPos.z, 0.0f));
|
||||
CGeneral::GetRadianAngleBetweenPoints(position.x, position.y, startPoint.x, startPoint.y),
|
||||
CGeneral::GetRadianAngleBetweenPoints(position.z, Distance2D(m_ped->GetPosition(), position.x, position.y), startPoint.z, 0.0f));
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
bool PointGunInDirection(float targetYaw, float targetPitch);
|
||||
bool PointGunInDirectionUsingArm(float targetYaw, float targetPitch);
|
||||
bool PointGunAtPosition(CVector const& position);
|
||||
void GetComponentPosition(RwV3d *pos, uint32 node);
|
||||
void GetComponentPosition(RwV3d &pos, uint32 node);
|
||||
void RotateTorso(AnimBlendFrameData* animBlend, LimbOrientation* limb, bool changeRoll);
|
||||
void ExtractYawAndPitchLocal(RwMatrix *mat, float *yaw, float *pitch);
|
||||
void ExtractYawAndPitchLocalSkinned(AnimBlendFrameData *node, float *yaw, float *pitch);
|
||||
|
@ -47,19 +47,12 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
|
||||
m_nSpeedTimer = 0;
|
||||
m_bSpeedTimerFlag = false;
|
||||
|
||||
// This should be something inlined
|
||||
// TODO(Miami)
|
||||
|
||||
// if (pPointGunAt)
|
||||
// m_pPointGunAt->CleanUpOldReference(&m_pPointGunAt);
|
||||
|
||||
m_pPointGunAt = nil;
|
||||
if (m_nPedState == PED_FOLLOW_PATH)
|
||||
ClearFollowPath();
|
||||
|
||||
// TODO(Miami)
|
||||
// This should be something inlined
|
||||
|
||||
m_nPedState = PED_IDLE;
|
||||
SetPedState(PED_IDLE);
|
||||
m_fMaxStamina = 150.0f;
|
||||
m_fCurrentStamina = m_fMaxStamina;
|
||||
m_fStaminaProgress = 0.0f;
|
||||
@ -290,10 +283,7 @@ CPlayerPed::SetInitialState(void)
|
||||
m_pFire->Extinguish();
|
||||
|
||||
RpAnimBlendClumpRemoveAllAssociations(GetClump());
|
||||
if (m_nPedState == PED_FOLLOW_PATH)
|
||||
ClearFollowPath();
|
||||
|
||||
m_nPedState = PED_IDLE;
|
||||
SetPedState(PED_IDLE);
|
||||
SetMoveState(PEDMOVE_STILL);
|
||||
m_nLastPedState = PED_NONE;
|
||||
m_animGroup = ASSOCGRP_PLAYER;
|
||||
@ -546,6 +536,8 @@ CPlayerPed::RestoreSprintEnergy(float restoreSpeed)
|
||||
m_fCurrentStamina += restoreSpeed * CTimer::GetTimeStep() * 0.5f;
|
||||
}
|
||||
|
||||
|
||||
// TODO(Miami)
|
||||
bool
|
||||
CPlayerPed::DoWeaponSmoothSpray(void)
|
||||
{
|
||||
@ -553,7 +545,7 @@ CPlayerPed::DoWeaponSmoothSpray(void)
|
||||
eWeaponType weapon = GetWeapon()->m_eWeaponType;
|
||||
if (weapon == WEAPONTYPE_FLAMETHROWER || weapon == WEAPONTYPE_COLT45 || weapon == WEAPONTYPE_UZI ||
|
||||
weapon == WEAPONTYPE_TEC9 || weapon == WEAPONTYPE_SILENCED_INGRAM || weapon == WEAPONTYPE_MP5 ||
|
||||
weapon == WEAPONTYPE_SHOTGUN || weapon == WEAPONTYPE_AK47 || weapon == WEAPONTYPE_M16 || weapon == WEAPONTYPE_HELICANNON)
|
||||
weapon == WEAPONTYPE_SHOTGUN || weapon == WEAPONTYPE_RUGER || weapon == WEAPONTYPE_M4 || weapon == WEAPONTYPE_HELICANNON)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -574,7 +566,7 @@ CPlayerPed::DoesTargetHaveToBeBroken(CVector target, CWeapon *weaponUsed)
|
||||
if (distVec.Magnitude() > CWeaponInfo::GetWeaponInfo(weaponUsed->m_eWeaponType)->m_fRange)
|
||||
return true;
|
||||
|
||||
if (weaponUsed->m_eWeaponType != WEAPONTYPE_SHOTGUN && weaponUsed->m_eWeaponType != WEAPONTYPE_AK47)
|
||||
if (weaponUsed->m_eWeaponType != WEAPONTYPE_SHOTGUN && weaponUsed->m_eWeaponType != WEAPONTYPE_RUGER)
|
||||
return false;
|
||||
|
||||
distVec.Normalise();
|
||||
@ -1099,8 +1091,8 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
|
||||
}
|
||||
if (!m_pFire) {
|
||||
if (GetWeapon()->m_eWeaponType == WEAPONTYPE_ROCKETLAUNCHER ||
|
||||
GetWeapon()->m_eWeaponType == WEAPONTYPE_SNIPERRIFLE || GetWeapon()->m_eWeaponType == WEAPONTYPE_M16 ||
|
||||
GetWeapon()->m_eWeaponType == WEAPONTYPE_AK47) {
|
||||
GetWeapon()->m_eWeaponType == WEAPONTYPE_SNIPERRIFLE || GetWeapon()->m_eWeaponType == WEAPONTYPE_M4 ||
|
||||
GetWeapon()->m_eWeaponType == WEAPONTYPE_RUGER) {
|
||||
if (padUsed->TargetJustDown() || TheCamera.m_bJustJumpedOutOf1stPersonBecauseOfTarget) {
|
||||
SetStoredState();
|
||||
m_nPedState = PED_SNIPER_MODE;
|
||||
@ -1261,7 +1253,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
|
||||
#else
|
||||
CVector markPos;
|
||||
if (m_pPointGunAt->IsPed()) {
|
||||
((CPed*)m_pPointGunAt)->m_pedIK.GetComponentPosition((RwV3d*)markPos, PED_MID);
|
||||
((CPed*)m_pPointGunAt)->m_pedIK.GetComponentPosition((RwV3d)markPos, PED_MID);
|
||||
} else {
|
||||
markPos = m_pPointGunAt->GetPosition();
|
||||
}
|
||||
@ -1514,7 +1506,7 @@ CPlayerPed::ProcessControl(void)
|
||||
}
|
||||
break;
|
||||
case PED_SNIPER_MODE:
|
||||
if (FindPlayerPed()->GetWeapon()->m_eWeaponType == WEAPONTYPE_M16) {
|
||||
if (FindPlayerPed()->GetWeapon()->m_eWeaponType == WEAPONTYPE_M4) {
|
||||
if (padUsed)
|
||||
PlayerControlM16(padUsed);
|
||||
} else if (padUsed) {
|
||||
@ -1624,6 +1616,21 @@ CPlayerPed::ProcessControl(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
CPlayerPed::DoesPlayerWantNewWeapon(eWeaponType weapon, bool onlyIfSlotIsEmpty)
|
||||
{
|
||||
uint32 slot = CWeaponInfo::GetWeaponInfo(weapon)->m_nWeaponSlot;
|
||||
|
||||
if (!HasWeaponSlot(slot) || GetWeapon(slot).m_eWeaponType == weapon)
|
||||
return true;
|
||||
|
||||
if (onlyIfSlotIsEmpty)
|
||||
return false;
|
||||
|
||||
// Check if he's using that slot right now.
|
||||
return m_nPedState != PED_ATTACK && m_nPedState != PED_AIM_GUN || slot != m_currentWeapon;
|
||||
}
|
||||
|
||||
#ifdef COMPATIBLE_SAVES
|
||||
#define CopyFromBuf(buf, data) memcpy(&data, buf, sizeof(data)); SkipSaveBuf(buf, sizeof(data));
|
||||
#define CopyToBuf(buf, data) memcpy(buf, &data, sizeof(data)); SkipSaveBuf(buf, sizeof(data));
|
||||
|
@ -82,6 +82,7 @@ public:
|
||||
void ProcessAnimGroups(void);
|
||||
void ProcessPlayerWeapon(CPad*);
|
||||
void PlayerControlZelda(CPad*);
|
||||
bool DoesPlayerWantNewWeapon(eWeaponType, bool);
|
||||
|
||||
static void SetupPlayerPed(int32);
|
||||
static void DeactivatePlayerPed(int32);
|
||||
|
Reference in New Issue
Block a user