diff options
Diffstat (limited to 'src/peds/CopPed.cpp')
-rw-r--r-- | src/peds/CopPed.cpp | 74 |
1 files changed, 42 insertions, 32 deletions
diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp index 99e8c1ae..d2daea42 100644 --- a/src/peds/CopPed.cpp +++ b/src/peds/CopPed.cpp @@ -17,13 +17,14 @@ #include "Renderer.h" #include "Camera.h" -CCopPed::CCopPed(eCopType copType) : CPed(PEDTYPE_COP) +CCopPed::CCopPed(eCopType copType, int32 modifier) : CPed(PEDTYPE_COP) { m_nCopType = copType; switch (copType) { case COP_STREET: SetModelIndex(MI_COP); - GiveWeapon(WEAPONTYPE_COLT45, 1000); + GiveWeapon(WEAPONTYPE_NIGHTSTICK, 1000, true); + GiveDelayedWeapon(WEAPONTYPE_COLT45, 1000); m_currentWeapon = WEAPONTYPE_UNARMED; m_fArmour = 0.0f; m_wepSkills = 208; /* TODO: what is this? seems unused */ @@ -31,17 +32,15 @@ CCopPed::CCopPed(eCopType copType) : CPed(PEDTYPE_COP) break; case COP_FBI: SetModelIndex(MI_FBI); - GiveWeapon(WEAPONTYPE_COLT45, 1000); - GiveWeapon(WEAPONTYPE_AK47, 1000); - SetCurrentWeapon(WEAPONTYPE_AK47); + GiveDelayedWeapon(WEAPONTYPE_MP5, 1000); + SetCurrentWeapon(WEAPONTYPE_MP5); m_fArmour = 100.0f; m_wepSkills = 176; /* TODO: what is this? seems unused */ m_wepAccuracy = 76; break; case COP_SWAT: SetModelIndex(MI_SWAT); - GiveWeapon(WEAPONTYPE_COLT45, 1000); - GiveWeapon(WEAPONTYPE_UZI, 1000); + GiveDelayedWeapon(WEAPONTYPE_UZI, 1000); SetCurrentWeapon(WEAPONTYPE_UZI); m_fArmour = 50.0f; m_wepSkills = 32; /* TODO: what is this? seems unused */ @@ -49,32 +48,44 @@ CCopPed::CCopPed(eCopType copType) : CPed(PEDTYPE_COP) break; case COP_ARMY: SetModelIndex(MI_ARMY); - GiveWeapon(WEAPONTYPE_COLT45, 1000); - GiveWeapon(WEAPONTYPE_M16, 1000); - GiveWeapon(WEAPONTYPE_GRENADE, 10); - SetCurrentWeapon(WEAPONTYPE_M16); + GiveDelayedWeapon(WEAPONTYPE_MP5, 1000); + SetCurrentWeapon(WEAPONTYPE_MP5); m_fArmour = 100.0f; m_wepSkills = 32; /* TODO: what is this? seems unused */ m_wepAccuracy = 84; break; - default: + case COP_MIAMIVICE: + switch (modifier) { + case 0: SetModelIndex(MI_VICE1); break; + case 1: SetModelIndex(MI_VICE2); break; + case 2: SetModelIndex(MI_VICE3); break; + case 3: SetModelIndex(MI_VICE4); break; + case 4: SetModelIndex(MI_VICE5); break; + case 5: SetModelIndex(MI_VICE6); break; + case 6: SetModelIndex(MI_VICE7); break; + case 7: SetModelIndex(MI_VICE8); break; + default: assert(0); break; + } + GiveDelayedWeapon(WEAPONTYPE_UZI, 1000); + SetCurrentWeapon(WEAPONTYPE_UZI); + m_fArmour = 100.0f; + m_wepSkills = 176; + m_wepAccuracy = 76; break; } m_bIsInPursuit = false; - field_1350 = 1; + field_5FE = 1; m_bIsDisabledCop = false; - m_fAbseilPos = 0.0f; m_attackTimer = 0; - m_bBeatingSuspect = false; m_bStopAndShootDisabledZone = false; + field_601 = false; m_bZoneDisabled = false; - field_1364 = -1; + field_628 = -1; + m_nRoadblockNode = -1; // TODO(Miami): this will be nil + field_5FF = 0; + m_fAbseilPos = 0.0f; + m_bBeatingSuspect = false; m_pPointGunAt = nil; - - // VC also initializes in here, but as nil -#ifdef FIX_BUGS - m_nRoadblockNode = -1; -#endif } CCopPed::~CCopPed() @@ -88,7 +99,7 @@ CCopPed::SetArrestPlayer(CPed *player) { if (!IsPedInControl() || !player) return; - + /* switch (m_nCopType) { case COP_FBI: Say(SOUND_PED_ARREST_FBI); @@ -99,7 +110,7 @@ CCopPed::SetArrestPlayer(CPed *player) default: Say(SOUND_PED_ARREST_COP); break; - } + } */ if (player->EnteringCar()) { if (CTimer::GetTimeInMilliseconds() > m_nPedStateTimer) return; @@ -244,7 +255,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); @@ -425,8 +436,9 @@ CCopPed::CopAI(void) #ifdef VC_PED_PORTS float dotProd; if (m_nRoadblockNode != -1) { - CTreadable *roadBlockRoad = ThePaths.m_mapObjects[CRoadBlocks::RoadBlockObjects[m_nRoadblockNode]]; - dotProd = DotProduct2D(playerOrHisVeh->GetPosition() - roadBlockRoad->GetPosition(), GetPosition() - roadBlockRoad->GetPosition()); + // TODO(MIAMI): check this, i'm only getting this compile here.... + CPathNode *roadBlockNode = &ThePaths.m_pathNodes[CRoadBlocks::RoadBlockNodes[m_nRoadblockNode]]; + dotProd = DotProduct2D(playerOrHisVeh->GetPosition() - roadBlockNode->GetPosition(), GetPosition() - roadBlockNode->GetPosition()); } else dotProd = -1.0f; @@ -559,9 +571,6 @@ CCopPed::CopAI(void) void CCopPed::ProcessControl(void) { - if (m_nZoneLevel > LEVEL_NONE && m_nZoneLevel != CCollision::ms_collisionInMemory) - return; - CPed::ProcessControl(); if (bWasPostponed) return; @@ -578,7 +587,7 @@ CCopPed::ProcessControl(void) ArrestPlayer(); return; } - GetWeapon()->Update(m_audioEntityId); + GetWeapon()->Update(m_audioEntityId, nil); if (m_moved.Magnitude() > 0.0f) Avoid(); @@ -594,6 +603,7 @@ CCopPed::ProcessControl(void) if (IsPedInControl()) SetIdle(); } + /* if (m_bIsInPursuit) { if (player->m_nPedState != PED_ARRESTED && !player->DyingOrDead()) { switch (m_nCopType) { @@ -611,7 +621,7 @@ CCopPed::ProcessControl(void) break; } } - } + } */ if (IsPedInControl()) { CopAI(); @@ -709,7 +719,7 @@ CCopPed::ProcessControl(void) return; bool dontShoot = false; - if (GetIsOnScreen() && CRenderer::IsEntityCullZoneVisible(this)) { + if (GetIsOnScreen()) { if (((CTimer::GetFrameCounter() + m_randomSeed) & 0x1F) == 17) { CEntity *foundBuilding = nil; CColPoint foundCol; |