summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-05-23 15:53:20 +0200
committereray orçunus <erayorcunus@gmail.com>2020-05-23 15:53:20 +0200
commit5357957fe124afb8e9a5f737510fe4c96a7dc327 (patch)
treeb76392c3addab639379e02b1ba893a5ebf260170
parentskeleton typos (diff)
downloadre3-5357957fe124afb8e9a5f737510fe4c96a7dc327.tar
re3-5357957fe124afb8e9a5f737510fe4c96a7dc327.tar.gz
re3-5357957fe124afb8e9a5f737510fe4c96a7dc327.tar.bz2
re3-5357957fe124afb8e9a5f737510fe4c96a7dc327.tar.lz
re3-5357957fe124afb8e9a5f737510fe4c96a7dc327.tar.xz
re3-5357957fe124afb8e9a5f737510fe4c96a7dc327.tar.zst
re3-5357957fe124afb8e9a5f737510fe4c96a7dc327.zip
Diffstat (limited to '')
-rw-r--r--src/audio/AudioLogic.cpp8
-rw-r--r--src/control/Pickups.cpp51
-rw-r--r--src/control/Script.cpp61
-rw-r--r--src/control/Script.h2
-rw-r--r--src/core/Cam.cpp8
-rw-r--r--src/core/Frontend.cpp11
-rw-r--r--src/core/Frontend.h2
-rw-r--r--src/core/Pad.cpp20
-rw-r--r--src/modelinfo/ModelIndices.h42
-rw-r--r--src/peds/CopPed.cpp2
-rw-r--r--src/peds/EmergencyPed.cpp16
-rw-r--r--src/peds/Ped.cpp58
-rw-r--r--src/peds/PedIK.cpp23
-rw-r--r--src/peds/PedIK.h2
-rw-r--r--src/peds/PlayerPed.cpp14
-rw-r--r--src/render/Hud.cpp41
-rw-r--r--src/vehicles/Vehicle.cpp6
-rw-r--r--src/weapons/Weapon.cpp258
-rw-r--r--src/weapons/Weapon.h2
-rw-r--r--src/weapons/WeaponInfo.cpp18
-rw-r--r--src/weapons/WeaponType.h25
21 files changed, 435 insertions, 235 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp
index cc157389..03cf391c 100644
--- a/src/audio/AudioLogic.cpp
+++ b/src/audio/AudioLogic.cpp
@@ -3478,7 +3478,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
else
noReflection = true;
break;
- case WEAPONTYPE_AK47:
+ case WEAPONTYPE_RUGER:
m_sQueueSample.m_nSampleIndex = SFX_AK47_LEFT;
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nCounter = iSound++;
@@ -3497,7 +3497,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_bReleasingSoundFlag = true;
break;
- case WEAPONTYPE_M16:
+ case WEAPONTYPE_M4:
m_sQueueSample.m_nSampleIndex = SFX_M16_LEFT;
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nCounter = iSound++;
@@ -3604,11 +3604,11 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
m_sQueueSample.m_nSampleIndex = SFX_AK47_RELOAD;
m_sQueueSample.m_nFrequency = 30290;
break;
- case WEAPONTYPE_AK47:
+ case WEAPONTYPE_RUGER:
m_sQueueSample.m_nSampleIndex = SFX_AK47_RELOAD;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_AK47_RELOAD);
break;
- case WEAPONTYPE_M16:
+ case WEAPONTYPE_M4:
m_sQueueSample.m_nSampleIndex = SFX_M16_RELOAD;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_M16_RELOAD);
break;
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp
index 4e4c02ab..1d2d06f7 100644
--- a/src/control/Pickups.cpp
+++ b/src/control/Pickups.cpp
@@ -46,55 +46,32 @@ tPickupMessage CPickups::aMessages[NUMPICKUPMESSAGES];
// TODO(Miami)
uint16 AmmoForWeapon[20] = { 0, 1, 45, 125, 25, 150, 300, 25, 5, 250, 5, 5, 0, 500, 0, 100, 0, 0, 0, 0 };
+
+// --MIAMI: Done
uint16 AmmoForWeapon_OnStreet[WEAPONTYPE_TOTALWEAPONS] = {
- 0,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 1,
- 4,
- 4,
- 4,
- 4,
- 34,
- 16,
- 100,
- 60,
- 60,
- 60,
- 60,
- 60,
- 20,
- 4,
- 14,
- 1,
- 400,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 34,
+ 12, 16, 14, 10, 100, 60, 60, 60, 60, 60, 20, 14,
+ 4, 150, 100, 500, 1, 400, 36, 0,
};
uint16 CostOfWeapon[20] = { 0, 10, 250, 800, 1500, 3000, 5000, 10000, 25000, 25000, 2000, 2000, 0, 50000, 0, 3000, 0, 0, 0, 0 };
// TODO(Miami): Those are all placeholders!!
uint8 aWeaponReds[] = { 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 0, 128, 255, 255, 0, 255, 0, 128, 128, 255,
-255, 255, 255, 255, 255, 255, 255, 255,
+255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 128, 0, 255, 0 };
uint8 aWeaponGreens[] = { 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
0, 255, 128, 255, 0, 255, 128, 255, 0, 255, 255,
-255, 255, 255, 255, 255, 255, 255, 255,
+255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
0, 255, 0, 255, 0 };
uint8 aWeaponBlues[] = { 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
0, 0, 255, 0, 255, 255, 0, 128, 255, 0, 255,
-255, 255, 255, 255, 255, 255, 255, 255,
+255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
0, 128, 255, 0, 0 };
+
float aWeaponScale[] = { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
2.0f, 1.5f, 1.0f, 1.0f, 1.5f, 1.0f, 2.0f, 1.0f, 2.0f, 2.5f, 1.0f,
-1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
+1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f };
void
@@ -722,13 +699,13 @@ CPickups::DoPickUpEffects(CEntity *entity)
int16 colorId;
if (entity->GetModelIndex() == MI_PICKUP_ADRENALINE || entity->GetModelIndex() == MI_PICKUP_CAMERA)
- colorId = WEAPONTYPE_LAST_WEAPONTYPE;
+ colorId = WEAPONTYPE_TOTALWEAPONS;
else if (entity->GetModelIndex() == MI_PICKUP_BODYARMOUR || entity->GetModelIndex() == MI_PICKUP_BRIBE)
- colorId = WEAPONTYPE_LAST_WEAPONTYPE + 1;
+ colorId = WEAPONTYPE_TOTALWEAPONS + 1;
else if (entity->GetModelIndex() == MI_PICKUP_INFO || entity->GetModelIndex() == MI_PICKUP_KILLFRENZY)
- colorId = WEAPONTYPE_LAST_WEAPONTYPE + 2;
+ colorId = WEAPONTYPE_TOTALWEAPONS + 2;
else if (entity->GetModelIndex() == MI_PICKUP_HEALTH || entity->GetModelIndex() == MI_PICKUP_BONUS)
- colorId = WEAPONTYPE_LAST_WEAPONTYPE + 3;
+ colorId = WEAPONTYPE_TOTALWEAPONS + 3;
else
colorId = WeaponForModel(entity->GetModelIndex());
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 85098cca..4350d08b 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -6545,7 +6545,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
printf("HAS_CHAR_BEEN_DAMAGED_BY_WEAPON - Character doesn't exist\n");
else {
if (ScriptParams[1] == WEAPONTYPE_ANYMELEE || ScriptParams[1] == WEAPONTYPE_ANYWEAPON)
- result = CheckDamagedWeaponType(ScriptParams[1], pPed->m_lastWepDam);
+ result = CheckDamagedWeaponType(pPed->m_lastWepDam, ScriptParams[1]);
else
result = ScriptParams[1] == pPed->m_lastWepDam;
}
@@ -6561,7 +6561,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
printf("HAS_CAR_BEEN_DAMAGED_BY_WEAPON - Vehicle doesn't exist\n");
else {
if (ScriptParams[1] == WEAPONTYPE_ANYMELEE || ScriptParams[1] == WEAPONTYPE_ANYWEAPON)
- result = CheckDamagedWeaponType(ScriptParams[1], pVehicle->m_nLastWeaponDamage);
+ result = CheckDamagedWeaponType(pVehicle->m_nLastWeaponDamage, ScriptParams[1]);
else
result = ScriptParams[1] == pVehicle->m_nLastWeaponDamage;
}
@@ -11989,12 +11989,23 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
return -1;
}
-bool CRunningScript::CheckDamagedWeaponType(int32 type, int32 actual)
+bool CRunningScript::CheckDamagedWeaponType(int32 actual, int32 type)
{
if (actual == -1)
return false;
+
if (type == WEAPONTYPE_ANYMELEE) {
- switch (actual) {
+ if (actual <= WEAPONTYPE_CHAINSAW)
+ return true;
+ if (actual - WEAPONTYPE_GRENADE <= WEAPONTYPE_MINIGUN)
+ return false;
+ return false;
+ }
+
+ if (type != WEAPONTYPE_ANYWEAPON)
+ return false;
+
+ switch (actual) {
case WEAPONTYPE_UNARMED:
case WEAPONTYPE_BRASSKNUCKLE:
case WEAPONTYPE_SCREWDRIVER:
@@ -12007,16 +12018,44 @@ bool CRunningScript::CheckDamagedWeaponType(int32 type, int32 actual)
case WEAPONTYPE_MACHETE:
case WEAPONTYPE_KATANA:
case WEAPONTYPE_CHAINSAW:
+ case WEAPONTYPE_GRENADE:
+ case WEAPONTYPE_DETONATOR_GRENADE:
+ case WEAPONTYPE_TEARGAS:
+ case WEAPONTYPE_MOLOTOV:
+ case WEAPONTYPE_ROCKET:
+ case WEAPONTYPE_COLT45:
+ case WEAPONTYPE_PYTHON:
+ case WEAPONTYPE_SHOTGUN:
+ case WEAPONTYPE_SPAS12_SHOTGUN:
+ case WEAPONTYPE_STUBBY_SHOTGUN:
+ case WEAPONTYPE_TEC9:
+ case WEAPONTYPE_UZI:
+ case WEAPONTYPE_SILENCED_INGRAM:
+ case WEAPONTYPE_MP5:
+ case WEAPONTYPE_M4:
+ case WEAPONTYPE_RUGER:
+ case WEAPONTYPE_SNIPERRIFLE:
+ case WEAPONTYPE_LASERSCOPE:
+ case WEAPONTYPE_ROCKETLAUNCHER:
+ case WEAPONTYPE_FLAMETHROWER:
+ case WEAPONTYPE_M60:
+ case WEAPONTYPE_MINIGUN:
+ case WEAPONTYPE_DETONATOR:
+ case WEAPONTYPE_HELICANNON:
+ case WEAPONTYPE_CAMERA:
+ case WEAPONTYPE_EXPLOSION:
+ case WEAPONTYPE_UZI_DRIVEBY:
return true;
- default:
+ case WEAPONTYPE_HEALTH:
+ case WEAPONTYPE_ARMOUR:
+ case WEAPONTYPE_RAMMEDBYCAR:
+ case WEAPONTYPE_RUNOVERBYCAR:
+ case WEAPONTYPE_DROWNING:
+ case WEAPONTYPE_FALL:
+ case WEAPONTYPE_UNIDENTIFIED:
return false;
- }
- }
- if (type == WEAPONTYPE_ANYWEAPON) {
- // TODO(MIAMI)!
- return actual != WEAPONTYPE_UNIDENTIFIED && actual != WEAPONTYPE_RAMMEDBYCAR &&
- actual != WEAPONTYPE_RUNOVERBYCAR && actual != WEAPONTYPE_FALL && actual != WEAPONTYPE_DROWNING;
}
+
return false;
}
diff --git a/src/control/Script.h b/src/control/Script.h
index 75a2c1e0..57b997b1 100644
--- a/src/control/Script.h
+++ b/src/control/Script.h
@@ -516,7 +516,7 @@ private:
}
}
- bool CheckDamagedWeaponType(int32 type, int32 actual);
+ bool CheckDamagedWeaponType(int32 actual, int32 type);
static bool ThisIsAValidRandomCop(int32 mi, bool cop, bool swat, bool fbi, bool army, bool miami);
};
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index 0daecad1..24d32511 100644
--- a/src/core/Cam.cpp
+++ b/src/core/Cam.cpp
@@ -2429,7 +2429,7 @@ CCam::Process_Rocket(const CVector &CameraTarget, float, float, float)
ResetStatics = false;
}
- ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(&HeadPos, PED_HEAD);
+ ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(HeadPos, PED_HEAD);
Source = HeadPos;
Source.z += 0.1f;
Source.x -= 0.19f*Cos(m_fInitialPlayerOrientation);
@@ -2568,7 +2568,7 @@ CCam::Process_M16_1stPerson(const CVector &CameraTarget, float, float, float)
HeadPos.x = 0.0f;
HeadPos.y = 0.0f;
HeadPos.z = 0.0f;
- ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(&HeadPos, PED_HEAD);
+ ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(HeadPos, PED_HEAD);
Source = HeadPos;
Source.z += 0.1f;
Source.x -= 0.19f * Cos(m_fInitialPlayerOrientation);
@@ -2657,7 +2657,7 @@ CCam::Process_1stPerson(const CVector &CameraTarget, float TargetOrientation, fl
ResetStatics = false;
}
- ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(&HeadPos, PED_HEAD);
+ ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(HeadPos, PED_HEAD);
Source = HeadPos;
Source.z += 0.1f;
Source.x -= 0.19f*Cos(m_fInitialPlayerOrientation);
@@ -2925,7 +2925,7 @@ CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float
ResetStatics = false;
}
- ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(&HeadPos, PED_HEAD);
+ ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(HeadPos, PED_HEAD);
Source = HeadPos;
Source.z += 0.1f;
Source.x -= 0.19f*Cos(m_fInitialPlayerOrientation);
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index c5e0d6ad..a9229c1c 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -2241,7 +2241,7 @@ CMenuManager::DrawBackground()
m_menuTransitionProgress = 255;
}
- m_aFrontEndSprites[MENUSPRITE_BACKGROUND].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, Min(255, m_nMenuFadeAlpha)));
+ m_aFrontEndSprites[MENUSPRITE_BACKGROUND].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, FadeIn(255)));
SetFrontEndRenderStates();
@@ -2264,7 +2264,7 @@ CMenuManager::DrawBackground()
if (m_menuTransitionProgress == 255) {
m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(MENU_X(27.0f), MENU_Y(8.0f), MENU_X(157.0f), MENU_Y(138.0f)), CRGBA(255, 255, 255, 255));
} else {
- m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(MENU_X(27.0f), MENU_Y(8.0f), MENU_X(157.0f), MENU_Y(138.0f)), CRGBA(255, 255, 255, Min(m_nMenuFadeAlpha, 255)));
+ m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(MENU_X(27.0f), MENU_Y(8.0f), MENU_X(157.0f), MENU_Y(138.0f)), CRGBA(255, 255, 255, FadeIn(255)));
}
if (m_bShowMouse) {
@@ -2693,11 +2693,6 @@ CMenuManager::DrawPlayerSetupScreen()
int
CMenuManager::FadeIn(int alpha)
{
- if (m_nCurrScreen == MENUPAGE_LOADING_IN_PROGRESS ||
- m_nCurrScreen == MENUPAGE_SAVING_IN_PROGRESS ||
- m_nCurrScreen == MENUPAGE_DELETING)
- return alpha;
-
return Min(m_nMenuFadeAlpha, alpha);
}
@@ -3242,7 +3237,7 @@ CMenuManager::Process(void)
ProcessFileActions();
DMAudio.Service();
- // TODO(Miami): What are the functions in here?
+ // Game calls some texture pool cleanup functions in here
}
SwitchMenuOnAndOff();
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index 4e1d0edf..ca77d448 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -538,7 +538,7 @@ public:
int32 m_nPrevScreen;
int32 m_nCurrSaveSlot;
int32 m_LastScreenSwitch;
- uint32 m_nMenuFadeAlpha;
+ int32 m_nMenuFadeAlpha;
int32 bOptionHighlightTransitionBlend;
bool bMenuChangeOngoing;
int32 MouseButtonJustClicked;
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index dc849a46..69f340dd 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -68,32 +68,32 @@ void WeaponCheat()
CStreaming::RequestModel(MI_GRENADE, STREAMFLAGS_DONT_REMOVE);
CStreaming::RequestModel(MI_BOMB, STREAMFLAGS_DONT_REMOVE);
- CStreaming::RequestModel(MI_AK47, STREAMFLAGS_DONT_REMOVE);
+ CStreaming::RequestModel(MI_RUGER, STREAMFLAGS_DONT_REMOVE);
CStreaming::RequestModel(MI_BASEBALL_BAT, STREAMFLAGS_DONT_REMOVE);
- CStreaming::RequestModel(MI_COLT, STREAMFLAGS_DONT_REMOVE);
+ CStreaming::RequestModel(MI_COLT45, STREAMFLAGS_DONT_REMOVE);
CStreaming::RequestModel(MI_ROCKETLAUNCHER, STREAMFLAGS_DONT_REMOVE);
- CStreaming::RequestModel(MI_SHOTGUN, STREAMFLAGS_DONT_REMOVE);
- CStreaming::RequestModel(MI_SNIPER, STREAMFLAGS_DONT_REMOVE);
+ CStreaming::RequestModel(MI_SPAS12_SHOTGUN, STREAMFLAGS_DONT_REMOVE);
+ CStreaming::RequestModel(MI_SNIPERRIFLE, STREAMFLAGS_DONT_REMOVE);
CStreaming::RequestModel(MI_MP5, STREAMFLAGS_DONT_REMOVE);
CStreaming::LoadAllRequestedModels(false);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_BASEBALLBAT, 0);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_COLT45, 100);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_MP5, 100);
- FindPlayerPed()->GiveWeapon(WEAPONTYPE_SHOTGUN, 20);
- FindPlayerPed()->GiveWeapon(WEAPONTYPE_AK47, 200);
+ FindPlayerPed()->GiveWeapon(WEAPONTYPE_SPAS12_SHOTGUN, 20);
+ FindPlayerPed()->GiveWeapon(WEAPONTYPE_RUGER, 200);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_SNIPERRIFLE, 5);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_ROCKETLAUNCHER, 5);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_DETONATOR_GRENADE, 5);
CStreaming::SetModelIsDeletable(MI_GRENADE);
CStreaming::SetModelIsDeletable(MI_BOMB);
- CStreaming::SetModelIsDeletable(MI_AK47);
+ CStreaming::SetModelIsDeletable(MI_RUGER);
CStreaming::SetModelIsDeletable(MI_BASEBALL_BAT);
- CStreaming::SetModelIsDeletable(MI_COLT);
+ CStreaming::SetModelIsDeletable(MI_COLT45);
CStreaming::SetModelIsDeletable(MI_ROCKETLAUNCHER);
- CStreaming::SetModelIsDeletable(MI_SHOTGUN);
- CStreaming::SetModelIsDeletable(MI_SNIPER);
+ CStreaming::SetModelIsDeletable(MI_SPAS12_SHOTGUN);
+ CStreaming::SetModelIsDeletable(MI_SNIPERRIFLE);
CStreaming::SetModelIsDeletable(MI_MP5);
}
diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h
index dd37b57d..91ba650e 100644
--- a/src/modelinfo/ModelIndices.h
+++ b/src/modelinfo/ModelIndices.h
@@ -303,23 +303,33 @@ enum
MI_DODO = -2,
MI_NIGHTSTICK = 262,
- MI_BASEBALL_BAT = 264,
+ MI_KNIFE,
+ MI_BASEBALL_BAT,
MI_GRENADE = 270,
- MI_MOLOTOV = 272,
- MI_MISSILE = 273,
- MI_COLT = 274,
- MI_AK47 = 276,
- MI_SHOTGUN = 279,
- MI_M16 = 280,
- MI_TEC9 = 281,
- MI_UZI = 282,
- MI_SILENCEDINGRAM = 283,
- MI_MP5 = 284,
- MI_SNIPER = 285,
- MI_ROCKETLAUNCHER = 287,
- MI_FLAMETHROWER = 288,
- MI_BOMB = 291,
- MI_FINGERS = 293,
+ MI_TEARGAS,
+ MI_MOLOTOV,
+ MI_MISSILE,
+ MI_COLT45,
+ MI_PYTHON,
+ MI_RUGER,
+ MI_SHOTGUN,
+ MI_SPAS12_SHOTGUN,
+ MI_STUBBY_SHOTGUN,
+ MI_M4,
+ MI_TEC9,
+ MI_UZI,
+ MI_SILENCEDINGRAM,
+ MI_MP5,
+ MI_SNIPERRIFLE,
+ MI_LASERSCOPE,
+ MI_ROCKETLAUNCHER,
+ MI_FLAMETHROWER,
+ MI_M60,
+ MI_MINIGUN,
+ MI_BOMB,
+ MI_CAMERA,
+ MI_FINGERS,
+ MI_MINIGUN2,
MI_CUTOBJ01 = 295,
MI_CUTOBJ02,
diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp
index b84dcf14..c24be62f 100644
--- a/src/peds/CopPed.cpp
+++ b/src/peds/CopPed.cpp
@@ -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);
diff --git a/src/peds/EmergencyPed.cpp b/src/peds/EmergencyPed.cpp
index a62ac76d..95811dab 100644
--- a/src/peds/EmergencyPed.cpp
+++ b/src/peds/EmergencyPed.cpp
@@ -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,
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 278e5bef..7ab60faa 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -685,7 +685,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);
@@ -884,9 +884,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();
}
}
@@ -898,7 +897,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();
@@ -1507,9 +1506,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) {
@@ -1649,10 +1647,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:
@@ -1667,7 +1665,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 &&
@@ -1715,10 +1713,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:
@@ -1764,8 +1762,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);
@@ -1818,7 +1815,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;
@@ -4278,16 +4275,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;
@@ -4295,8 +4295,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
@@ -5012,7 +5012,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);
@@ -5037,7 +5037,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);
@@ -6711,11 +6711,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();
}
@@ -9734,7 +9730,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();
}
@@ -13696,7 +13692,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();
diff --git a/src/peds/PedIK.cpp b/src/peds/PedIK.cpp
index 6543e9a3..2925667a 100644
--- a/src/peds/PedIK.cpp
+++ b/src/peds/PedIK.cpp
@@ -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
diff --git a/src/peds/PedIK.h b/src/peds/PedIK.h
index b5f895cd..ee719fea 100644
--- a/src/peds/PedIK.h
+++ b/src/peds/PedIK.h
@@ -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);
diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp
index f6f1cf05..69369ea4 100644
--- a/src/peds/PlayerPed.cpp
+++ b/src/peds/PlayerPed.cpp
@@ -546,6 +546,8 @@ CPlayerPed::RestoreSprintEnergy(float restoreSpeed)
m_fCurrentStamina += restoreSpeed * CTimer::GetTimeStep() * 0.5f;
}
+
+// TODO(Miami)
bool
CPlayerPed::DoWeaponSmoothSpray(void)
{
@@ -553,7 +555,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 +576,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 +1101,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 +1263,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 +1516,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) {
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index 00d5b5c7..5d1542ef 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -172,9 +172,8 @@ void CHud::Draw()
if (playerPed) {
if (playerPed->m_nPedState != PED_ENTER_CAR && playerPed->m_nPedState != PED_CARJACK) {
- // TODO(Miami): Uncomment
- if (WeaponType >= WEAPONTYPE_COLT45 && WeaponType <= WEAPONTYPE_AK47
- /*|| WeaponType == WEAPONTYPE_M60 || || WeaponType == WEAPONTYPE_MINIGUN */
+ if (WeaponType >= WEAPONTYPE_COLT45 && WeaponType <= WEAPONTYPE_RUGER
+ || WeaponType == WEAPONTYPE_M60 || WeaponType == WEAPONTYPE_MINIGUN
|| WeaponType == WEAPONTYPE_FLAMETHROWER) {
DrawCrossHairPC = 1;
}
@@ -198,8 +197,7 @@ void CHud::Draw()
#ifdef ASPECT_RATIO_SCALE
f3rdY -= SCREEN_SCALE_Y(2.0f);
#endif
- // TODO(Miami): M60
- if (playerPed && (WeaponType == WEAPONTYPE_M16 || WeaponType == WEAPONTYPE_AK47/* || WeaponType == WEAPONTYPE_M60*/)) {
+ if (playerPed && (WeaponType == WEAPONTYPE_M4 || WeaponType == WEAPONTYPE_RUGER || WeaponType == WEAPONTYPE_M60)) {
rect.left = f3rdX - SCREEN_SCALE_X(32.0f * 0.6f);
rect.top = f3rdY - SCREEN_SCALE_Y(32.0f * 0.6f);
rect.right = f3rdX + SCREEN_SCALE_X(32.0f * 0.6f);
@@ -314,9 +312,7 @@ void CHud::Draw()
MONEY_COLOR.a = alpha;
CFont::SetColor(MONEY_COLOR);
- // TODO(Miami): m_nHudMode
- //if (CMenuManager.m_nHudMode)
- {
+ if (FrontEndMenuManager.m_PrefsShowHud) {
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(43.0f), sPrint);
}
}
@@ -505,20 +501,21 @@ void CHud::Draw()
AsciiToUnicode("]", sPrintIcon);
for (int i = 0; i < 6; i++) {
- if (playerPed->m_pWanted->m_nWantedLevel > i
- && (CTimer::GetTimeInMilliseconds() > playerPed->m_pWanted->m_nLastWantedLevelChange
- + 2000 || CTimer::GetFrameCounter() & 4)) {
-
- WANTED_COLOR.a = alpha;
- CFont::SetColor(WANTED_COLOR);
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f + 23.0f * i), SCREEN_SCALE_Y(87.0f), sPrintIcon);
-
- // TODO(Miami): There is one more condition in here
- }
- else if (playerPed->m_pWanted->m_nWantedLevel <= i) {
- NOTWANTED_COLOR.a = alpha;
- CFont::SetColor(NOTWANTED_COLOR);
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f + 23.0f * i), SCREEN_SCALE_Y(87.0f), sPrintIcon);
+ if (FrontEndMenuManager.m_PrefsShowHud) {
+ if (playerPed->m_pWanted->m_nWantedLevel > i
+ && (CTimer::GetTimeInMilliseconds() > playerPed->m_pWanted->m_nLastWantedLevelChange
+ + 2000 || CTimer::GetFrameCounter() & 4)) {
+
+ WANTED_COLOR.a = alpha;
+ CFont::SetColor(WANTED_COLOR);
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f + 23.0f * i), SCREEN_SCALE_Y(87.0f), sPrintIcon);
+
+ // TODO(Miami): There is one more condition in here
+ } else if (playerPed->m_pWanted->m_nWantedLevel <= i) {
+ NOTWANTED_COLOR.a = alpha;
+ CFont::SetColor(NOTWANTED_COLOR);
+ CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f + 23.0f * i), SCREEN_SCALE_Y(87.0f), sPrintIcon);
+ }
}
}
diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp
index 8d763300..5ac69905 100644
--- a/src/vehicles/Vehicle.cpp
+++ b/src/vehicles/Vehicle.cpp
@@ -623,8 +623,10 @@ CVehicle::InflictDamage(CEntity* damagedBy, eWeaponType weaponType, float damage
case WEAPONTYPE_SILENCED_INGRAM:
case WEAPONTYPE_MP5:
case WEAPONTYPE_SHOTGUN:
- case WEAPONTYPE_AK47:
- case WEAPONTYPE_M16:
+ case WEAPONTYPE_SPAS12_SHOTGUN:
+ case WEAPONTYPE_STUBBY_SHOTGUN:
+ case WEAPONTYPE_RUGER:
+ case WEAPONTYPE_M4:
case WEAPONTYPE_SNIPERRIFLE:
case WEAPONTYPE_HELICANNON:
case WEAPONTYPE_UZI_DRIVEBY:
diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp
index 4c1f1c52..17cee83a 100644
--- a/src/weapons/Weapon.cpp
+++ b/src/weapons/Weapon.cpp
@@ -29,11 +29,13 @@
#include "WaterLevel.h"
#include "WeaponInfo.h"
#include "World.h"
+#include "SurfaceTable.h"
// TODO(Miami)
#define AUDIO_NOT_READY
-uint16 gReloadSampleTime[WEAPONTYPE_LAST_WEAPONTYPE] =
+// TODO(Miami): Those are mostly placeholders!!!
+uint16 gReloadSampleTime[] =
{
0, // UNARMED
0,
@@ -49,10 +51,14 @@ uint16 gReloadSampleTime[WEAPONTYPE_LAST_WEAPONTYPE] =
0,
0, // GRENADE
0, // DETONATEGRENADE
+ 0, // TEARGAS
0, // MOLOTOV
0, // ROCKET
250, // COLT45
+ 250, // PYTHON
650, // SHOTGUN
+ 650, // SPAS12 SHOTGUN
+ 650, // STUBBY SHOTGUN
400, // TEC9
400, // UZIhec
400, // SILENCED_INGRAM
@@ -60,10 +66,14 @@ uint16 gReloadSampleTime[WEAPONTYPE_LAST_WEAPONTYPE] =
300, // M16
300, // AK47
423, // SNIPERRIFLE
+ 423, // LASERSCOPE
400, // ROCKETLAUNCHER
0, // FLAMETHROWER
+ 0, // M60
+ 0, // MINIGUN
0, // DETONATOR
- 0 // HELICANNON
+ 0, // HELICANNON
+ 0 // CAMERA
};
CWeaponInfo *
@@ -176,6 +186,8 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource)
switch ( m_eWeaponType )
{
case WEAPONTYPE_SHOTGUN:
+ case WEAPONTYPE_SPAS12_SHOTGUN:
+ case WEAPONTYPE_STUBBY_SHOTGUN:
{
addFireRateAsDelay = true;
fired = FireShotgun(shooter, source);
@@ -184,12 +196,15 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource)
}
case WEAPONTYPE_COLT45:
+ case WEAPONTYPE_PYTHON:
case WEAPONTYPE_UZI:
case WEAPONTYPE_TEC9:
case WEAPONTYPE_SILENCED_INGRAM:
case WEAPONTYPE_MP5:
- case WEAPONTYPE_AK47:
- case WEAPONTYPE_M16:
+ case WEAPONTYPE_M4:
+ case WEAPONTYPE_RUGER:
+ case WEAPONTYPE_M60:
+ case WEAPONTYPE_MINIGUN:
case WEAPONTYPE_HELICANNON:
{
if ((TheCamera.PlayerWeaponMode.Mode == CCam::MODE_HELICANNON_1STPERSON || TheCamera.PlayerWeaponMode.Mode == CCam::MODE_M16_1STPERSON)
@@ -204,6 +219,7 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource)
}
case WEAPONTYPE_SNIPERRIFLE:
+ case WEAPONTYPE_LASERSCOPE:
{
fired = FireSniper(shooter);
@@ -230,6 +246,7 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource)
case WEAPONTYPE_MOLOTOV:
case WEAPONTYPE_GRENADE:
case WEAPONTYPE_DETONATOR_GRENADE:
+ case WEAPONTYPE_TEARGAS:
{
if ( shooter == FindPlayerPed() )
{
@@ -800,7 +817,7 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
CPed *threatAttack = (CPed*)shooterPed->m_pPointGunAt;
if ( threatAttack->IsPed() )
{
- threatAttack->m_pedIK.GetComponentPosition(target, PED_MID);
+ threatAttack->m_pedIK.GetComponentPosition((RwV3d)target, PED_MID);
threatAttack->ReactToPointGun(shooter);
}
else
@@ -842,7 +859,7 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
CWorld::bIncludeDeadPeds = false;
int32 rotSpeed = 1;
- if ( m_eWeaponType == WEAPONTYPE_M16 )
+ if ( m_eWeaponType == WEAPONTYPE_M4 )
rotSpeed = 4;
CVector bulletPos;
@@ -870,7 +887,7 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
ProcessLineOfSight(*fireSource, target, point, victim, m_eWeaponType, shooter, true, true, true, true, true, true, false);
int32 rotSpeed = 1;
- if ( m_eWeaponType == WEAPONTYPE_M16 )
+ if ( m_eWeaponType == WEAPONTYPE_M4 )
rotSpeed = 4;
CVector bulletPos;
@@ -895,10 +912,10 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
switch ( m_eWeaponType )
{
- case WEAPONTYPE_M16:
- case WEAPONTYPE_AK47:
- // case WEAPONTYPE_M60:
- // case WEAPONTYPE_MINIGUN:
+ case WEAPONTYPE_M4:
+ case WEAPONTYPE_RUGER:
+ case WEAPONTYPE_M60:
+ case WEAPONTYPE_MINIGUN:
case WEAPONTYPE_HELICANNON:
{
static uint8 counter = 0;
@@ -1011,6 +1028,9 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
}
case WEAPONTYPE_COLT45:
+ case WEAPONTYPE_PYTHON:
+ case WEAPONTYPE_SNIPERRIFLE:
+ case WEAPONTYPE_LASERSCOPE:
{
CPointLights::AddLight(CPointLights::LIGHT_POINT,
*fireSource, CVector(0.0f, 0.0f, 0.0f), 5.0f,
@@ -1124,7 +1144,8 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
}
else
{
- if ( m_eWeaponType == WEAPONTYPE_SHOTGUN || m_eWeaponType == WEAPONTYPE_HELICANNON )
+ if ( IsShotgun(m_eWeaponType) || m_eWeaponType == WEAPONTYPE_HELICANNON
+ || m_eWeaponType == WEAPONTYPE_M60 || m_eWeaponType == WEAPONTYPE_PYTHON)
{
posOffset.Normalise();
victimPed->bIsStanding = false;
@@ -1149,7 +1170,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
asoc->blendAmount = 0.0f;
asoc->blendDelta = 8.0f;
- if ( m_eWeaponType == WEAPONTYPE_AK47 || m_eWeaponType == WEAPONTYPE_M16 )
+ if ( m_eWeaponType == WEAPONTYPE_M4 )
victimPlayer->m_nHitAnimDelayTimer = CTimer::GetTimeInMilliseconds() + 2500;
else
victimPlayer->m_nHitAnimDelayTimer = CTimer::GetTimeInMilliseconds() + 1000;
@@ -1178,7 +1199,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
if ( CGame::nastyGame )
{
uint8 bloodAmount = 8;
- if ( m_eWeaponType == WEAPONTYPE_SHOTGUN || m_eWeaponType == WEAPONTYPE_HELICANNON )
+ if ( IsShotgun(m_eWeaponType) || m_eWeaponType == WEAPONTYPE_HELICANNON )
bloodAmount = 32;
CVector dir = (point->point - victim->GetPosition()) * 0.01f;
@@ -1394,10 +1415,35 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
else
shooterAngle = RADTODEG(shooter->GetForward().Heading());
+ int shootsAtOnce;
+ int checkObstacleOnShootNo;
+ float angleRange;
+ switch (m_eWeaponType) {
+ case WEAPONTYPE_SHOTGUN:
+ angleRange = DEGTORAD(9.0f);
+ checkObstacleOnShootNo = 1;
+ shootsAtOnce = 3;
+ break;
+ case WEAPONTYPE_SPAS12_SHOTGUN:
+ angleRange = DEGTORAD(6.0f);
+ checkObstacleOnShootNo = 1;
+ shootsAtOnce = 3;
+ break;
+ case WEAPONTYPE_STUBBY_SHOTGUN:
+ angleRange = DEGTORAD(18.0f);
+ checkObstacleOnShootNo = 2;
+ shootsAtOnce = 5;
+ break;
+ default:
+ break;
+ }
+ bool statUpdated = false;
+ float halfAngleRange = angleRange / 2.f;
+ float angleBetweenTwoShot = angleRange / (shootsAtOnce - 1.f);
- for ( int32 i = 0; i < 5; i++ ) // five shoots at once
+ for ( int32 i = 0; i < shootsAtOnce; i++ )
{
- float shootAngle = DEGTORAD(7.5f*i + shooterAngle - 15.0f);
+ float shootAngle = DEGTORAD(RADTODEG(halfAngleRange - angleBetweenTwoShot * i) + shooterAngle);
CVector2D shootRot(-Sin(shootAngle), Cos(shootAngle));
CVector source, target;
@@ -1409,12 +1455,17 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
TheCamera.Find3rdPersonCamTargetVector(1.0f, *fireSource, source, target);
CVector Left = CrossProduct(TheCamera.Cams[TheCamera.ActiveCam].Front, TheCamera.Cams[TheCamera.ActiveCam].Up);
- float f = float(i - 2) * (DEGTORAD(7.5f) / 2);
+ float f = (i - (shootsAtOnce / 2)) * angleBetweenTwoShot;
target = f * Left + target - source;
target *= info->m_fRange;
target += source;
+ CWorld::bIncludeDeadPeds = true;
+ //bProcessVehicleWheels = true; // TODO(Miami): bProcessVehicleWheels
+ //bProcessPedsOnBoatsAndBikes = true; // TODO(Miami): bProcessPedsOnBoatsAndBikes
- ProcessLineOfSight(source, target, point, victim, m_eWeaponType, shooter, true, true, true, true, true, true, false);
+ ProcessLineOfSight(source, target, point, victim, m_eWeaponType, shooter, true, true, true, true, true, false, false); // TODO(Miami): New parameter: ,true);
+ CWorld::bIncludeDeadPeds = false;
+ //bProcessVehicleWheels = false; // TODO(Miami): bProcessVehicleWheels
}
else
{
@@ -1430,24 +1481,84 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
DoDoomAiming(shooter, fireSource, &target);
else
{
- float distToTarget = (shooterPed->m_pPointGunAt->GetPosition() - (*fireSource)).Magnitude2D();
- target.z += info->m_fRange / distToTarget * (shooterPed->m_pPointGunAt->GetPosition().z - target.z);
+ CVector pos;
+ if (shooterPed->m_pPointGunAt->IsPed()) {
+ ((CPed*)shooterPed->m_pPointGunAt)->m_pedIK.GetComponentPosition((RwV3d)pos, PED_MID);
+ } else {
+ pos = ((CPed*)shooterPed->m_pPointGunAt)->GetPosition();
+ }
+
+ float distToTarget = (pos - (*fireSource)).Magnitude2D();
+ target.z += info->m_fRange / distToTarget * (pos.z - target.z);
}
}
+ if (shooter == FindPlayerPed())
+ CWorld::bIncludeDeadPeds = true;
- ProcessLineOfSight(*fireSource, target, point, victim, m_eWeaponType, shooter, true, true, true, true, true, true, false);
+ //bProcessPedsOnBoatsAndBikes = true; // TODO(Miami): bProcessPedsOnBoatsAndBikes
+ ProcessLineOfSight(*fireSource, target, point, victim, m_eWeaponType, shooter, true, true, true, true, true, false, false); // TODO(Miami): New parameter: ,true);
+ CWorld::bIncludeDeadPeds = false;
}
+ //bProcessPedsOnBoatsAndBikes = false; // TODO(Miami): bProcessPedsOnBoatsAndBikes
if ( victim )
{
CGlass::WasGlassHitByBullet(victim, point.point);
+ CWeapon::BlowUpExplosiveThings(victim);
+ if (i == checkObstacleOnShootNo)
+ {
+ if (shooter)
+ {
+ if (shooter->IsPed() && !((CPed*)shooter)->IsPlayer())
+ {
+ CPed *shooterPed = (CPed*)shooter;
+ CEntity *guyWePointGun = shooterPed->m_pPointGunAt;
+ if (guyWePointGun)
+ {
+ if (victim != guyWePointGun)
+ {
+ float distWithAim = (guyWePointGun->GetPosition() - shooter->GetPosition()).Magnitude();
+ float distWithBullet = (point.point - shooter->GetPosition()).Magnitude();
+ if (distWithAim > 0.1f && distWithBullet > 0.1f)
+ {
+ // Normalize
+ CVector aimDir = (guyWePointGun->GetPosition() - shooter->GetPosition()) * (1.0f / distWithAim);
+ CVector bulletDir = (point.point - shooter->GetPosition()) * (1.0f / distWithBullet);
+
+ float dotProd = DotProduct(aimDir, bulletDir);
+ float aimAndBulletAngle;
+ if (dotProd <= 0.35f)
+ aimAndBulletAngle = PI;
+ else
+ aimAndBulletAngle = Acos(dotProd);
+ if (aimAndBulletAngle <= DEGTORAD(45.0f) && (aimAndBulletAngle <= DEGTORAD(15.0f) || distWithBullet / distWithAim >= 0.75f) && distWithBullet / distWithAim >= 0.99f)
+ {
+ shooterPed->bObstacleShowedUpDuringKillObjective = false;
+ shooterPed->m_shotTime = 0;
+ }
+ else
+ {
+ shooterPed->bObstacleShowedUpDuringKillObjective = true;
+ shooterPed->m_shootTimer = 0;
+ shooterPed->m_shotTime = CTimer::GetTimeInMilliseconds();
+ if (distWithAim >= 10.0f)
+ shooterPed->SetAttackTimer(3000);
+ else
+ shooterPed->SetAttackTimer(1500);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
CBulletTraces::AddTrace(fireSource, &point.point);
if ( victim->IsPed() )
{
CPed *victimPed = (CPed *)victim;
- if ( !victimPed->OnGround() && victim != shooter && victimPed->DoesLOSBulletHitPed(point) )
+ if ( !victimPed->DyingOrDead() && victim != shooter )
{
bool cantStandup = true;
@@ -1460,7 +1571,8 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
posOffset.Normalise();
- if ( victimPed->m_getUpTimer > (CTimer::GetTimeInMilliseconds() - 3000) )
+ if ( victimPed->m_getUpTimer > (CTimer::GetTimeInMilliseconds() - 3000) ||
+ !victimPed->bCanBeShotInVehicle)
cantStandup = false;
if ( victimPed->bIsStanding && cantStandup )
@@ -1485,7 +1597,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
if ( CGame::nastyGame )
{
uint8 bloodAmount = 8;
- if ( m_eWeaponType == WEAPONTYPE_SHOTGUN )
+ if ( m_eWeaponType == WEAPONTYPE_SHOTGUN || m_eWeaponType == WEAPONTYPE_SPAS12_SHOTGUN || m_eWeaponType == WEAPONTYPE_STUBBY_SHOTGUN)
bloodAmount = 32;
CVector dir = (point.point - victim->GetPosition()) * 0.01f;
@@ -1497,6 +1609,36 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
CParticle::AddParticle(PARTICLE_BLOOD_SMALL, point.point, dir);
}
}
+ } else {
+ if (CGame::nastyGame)
+ {
+ CVector dir = (point.point - victim->GetPosition()) * 0.01f;
+ dir.z = 0.01f;
+
+ if (victimPed->GetIsOnScreen())
+ {
+ for (uint8 i = 0; i < 8; i++)
+ CParticle::AddParticle(PARTICLE_BLOOD_SMALL, point.point + CVector(0.0f, 0.0f, 0.15f), dir);
+ }
+ if (victimPed->Dead())
+ {
+ CAnimBlendAssociation *hitAssoc;
+ if (RpAnimBlendClumpGetFirstAssociation(victimPed->GetClump(), ASSOC_FRONTAL))
+ {
+ hitAssoc = CAnimManager::BlendAnimation(victimPed->GetClump(), ASSOCGRP_STD, ANIM_FLOOR_HIT_F, 8.0f);
+ }
+ else
+ {
+ hitAssoc = CAnimManager::BlendAnimation(victimPed->GetClump(), ASSOCGRP_STD, ANIM_FLOOR_HIT, 8.0f);
+ }
+ if (hitAssoc)
+ {
+ hitAssoc->SetCurrentTime(0.0f);
+ hitAssoc->SetRun();
+ hitAssoc->flags &= ~ASSOC_DELETEFADEDOUT;
+ }
+ }
+ }
}
}
else
@@ -1505,21 +1647,29 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
{
case ENTITY_TYPE_VEHICLE:
{
- ((CVehicle *)victim)->InflictDamage(shooter, m_eWeaponType, info->m_nDamage);
+ if (point.pieceB >= SURFACE_STREET_LIGHT && point.pieceB <= SURFACE_METAL_FENCE) {
+ ((CVehicle*)victim)->BurstTyre(point.pieceB); // TODO(Miami): New parameter: ,true);
- for ( int32 i = 0; i < 16; i++ )
- CParticle::AddParticle(PARTICLE_SPARK, point.point, point.normal*0.05f);
+ for (int32 i = 0; i < 4; i++)
+ CParticle::AddParticle(PARTICLE_BULLETHIT_SMOKE, point.point, point.normal * 0.05f);
+ }
+ else
+ {
+ ((CVehicle*)victim)->InflictDamage(shooter, m_eWeaponType, info->m_nDamage);
+
+ for (int32 i = 0; i < 16; i++)
+ CParticle::AddParticle(PARTICLE_SPARK, point.point, point.normal * 0.05f);
#ifndef FIX_BUGS
- CVector dist = point.point - (*fireSource);
- CVector offset = dist - Max(0.2f*dist.Magnitude(), 2.0f) * CVector(shootRot.x, shootRot.y, 0.0f);
- CVector smokePos = *fireSource + offset;
+ CVector dist = point.point - (*fireSource);
+ CVector offset = dist - Max(0.2f * dist.Magnitude(), 2.0f) * CVector(shootRot.x, shootRot.y, 0.0f);
+ CVector smokePos = *fireSource + offset;
#else
- CVector smokePos = point.point;
+ CVector smokePos = point.point;
#endif
- CParticle::AddParticle(PARTICLE_BULLETHIT_SMOKE, smokePos, CVector(0.0f, 0.0f, 0.0f));
-
+ CParticle::AddParticle(PARTICLE_BULLETHIT_SMOKE, smokePos, CVector(0.0f, 0.0f, 0.0f));
+ }
break;
}
@@ -1549,13 +1699,15 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
if ( !victimObject->bInfiniteMass )
{
- if ( victimObject->IsStatic() && victimObject->m_fUprootLimit <= 0.0f )
+ bool notStatic = !victimObject->IsStatic();
+ if ( notStatic && victimObject->m_fUprootLimit <= 0.0f )
{
victimObject->bIsStatic = false;
victimObject->AddToMovingList();
}
- if ( !victimObject->IsStatic())
+ notStatic = !victimObject->IsStatic();
+ if ( !notStatic )
{
CVector moveForce = point.normal*-5.0f;
victimObject->ApplyMoveForce(moveForce.x, moveForce.y, moveForce.z);
@@ -1578,17 +1730,29 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
}
case ENTITY_TYPE_VEHICLE:
{
+ if (!statUpdated) {
+ //CStats::NumBulletsHit++; // TODO(Miami): Stats
+ statUpdated = true;
+ }
DMAudio.PlayOneShot(((CPhysical*)victim)->m_audioEntityId, SOUND_WEAPON_HIT_VEHICLE, 1.0f);
break;
}
case ENTITY_TYPE_PED:
{
+ if (!statUpdated) {
+ //CStats::NumBulletsHit++; // TODO(Miami): Stats
+ statUpdated = true;
+ }
DMAudio.PlayOneShot(((CPhysical*)victim)->m_audioEntityId, SOUND_WEAPON_HIT_PED, 1.0f);
((CPed*)victim)->Say(SOUND_PED_BULLET_HIT);
break;
}
case ENTITY_TYPE_OBJECT:
{
+ if (!statUpdated) {
+ //CStats::NumBulletsHit++; // TODO(Miami): Stats
+ statUpdated = true;
+ }
PlayOneShotScriptObject(SCRIPT_SOUND_BULLET_HIT_GROUND_2, point.point);
break;
}
@@ -1837,8 +2001,7 @@ CWeapon::FireM16_1stPerson(CEntity *shooter)
CVector bulletPos;
- // TODO(Miami): M60
- if ( CHeli::TestBulletCollision(&source, &target, &bulletPos, (/*m_eWeaponType == WEAPONTYPE_M60 || */ m_eWeaponType == WEAPONTYPE_HELICANNON ? 20 : 4)) )
+ if ( CHeli::TestBulletCollision(&source, &target, &bulletPos, (m_eWeaponType == WEAPONTYPE_M60 || m_eWeaponType == WEAPONTYPE_HELICANNON ? 20 : 4)) )
{
for ( int32 i = 0; i < 16; i++ )
CParticle::AddParticle(PARTICLE_SPARK, bulletPos, CVector(0.0f, 0.0f, 0.0f));
@@ -1848,15 +2011,14 @@ CWeapon::FireM16_1stPerson(CEntity *shooter)
{
CPad::GetPad(0)->StartShake_Distance(240, 128, FindPlayerPed()->GetPosition().x, FindPlayerPed()->GetPosition().y, FindPlayerPed()->GetPosition().z);
- // TODO(Miami)
float mult;
switch (m_eWeaponType) {
- case WEAPONTYPE_M16: // case WEAPONTYPE_M4:
+ case WEAPONTYPE_M4:
case WEAPONTYPE_HELICANNON:
- // case WEAPONTYPE_M60:
+ case WEAPONTYPE_M60:
mult = 0.0003f;
break;
- case WEAPONTYPE_AK47: // case WEAPONTYPE_RUGER:
+ case WEAPONTYPE_RUGER:
mult = 0.00015f;
break;
default:
@@ -2260,9 +2422,9 @@ CWeapon::Update(int32 audioEntity, CPed *pedToAdjustSound)
case WEAPONSTATE_FIRING:
{
- if ( m_eWeaponType == WEAPONTYPE_SHOTGUN && AEHANDLE_IS_OK(audioEntity) )
+ if ( IsShotgun(m_eWeaponType) && AEHANDLE_IS_OK(audioEntity) )
{
- uint32 timePassed = m_nTimer - gReloadSampleTime[WEAPONTYPE_SHOTGUN];
+ uint32 timePassed = m_nTimer - gReloadSampleTime[m_eWeaponType];
if ( CTimer::GetPreviousTimeInMilliseconds() < timePassed && CTimer::GetTimeInMilliseconds() >= timePassed )
DMAudio.PlayOneShot(audioEntity, SOUND_WEAPON_RELOAD, 0.0f);
}
@@ -2280,7 +2442,7 @@ CWeapon::Update(int32 audioEntity, CPed *pedToAdjustSound)
case WEAPONSTATE_RELOADING:
{
- if ( AEHANDLE_IS_OK(audioEntity) && m_eWeaponType < WEAPONTYPE_LAST_WEAPONTYPE )
+ if ( AEHANDLE_IS_OK(audioEntity) && m_eWeaponType < WEAPONTYPE_TOTALWEAPONS)
{
CAnimBlendAssociation *reloadAssoc = nil;
if (pedToAdjustSound) {
@@ -2461,11 +2623,9 @@ CWeapon::IsTypeMelee(void)
bool
CWeapon::IsType2Handed(void)
{
- // TODO(Miami): Uncomment
- return m_eWeaponType == WEAPONTYPE_FLAMETHROWER || m_eWeaponType == WEAPONTYPE_HELICANNON || /* m_eWeaponType == WEAPONTYPE_M60 */
- m_eWeaponType == WEAPONTYPE_M16 ||
- (m_eWeaponType >= WEAPONTYPE_SHOTGUN && m_eWeaponType < WEAPONTYPE_TEC9) || // Shotguns
- m_eWeaponType == WEAPONTYPE_AK47 || m_eWeaponType == WEAPONTYPE_SNIPERRIFLE /*|| m_eWeaponType == WEAPONTYPE_LASERSCOPE*/;
+ return m_eWeaponType == WEAPONTYPE_FLAMETHROWER || m_eWeaponType == WEAPONTYPE_HELICANNON || m_eWeaponType == WEAPONTYPE_M60 ||
+ m_eWeaponType == WEAPONTYPE_M4 || IsShotgun(m_eWeaponType) ||
+ m_eWeaponType == WEAPONTYPE_RUGER || m_eWeaponType == WEAPONTYPE_SNIPERRIFLE || m_eWeaponType == WEAPONTYPE_LASERSCOPE;
}
void
diff --git a/src/weapons/Weapon.h b/src/weapons/Weapon.h
index f6228b32..b4ed93c3 100644
--- a/src/weapons/Weapon.h
+++ b/src/weapons/Weapon.h
@@ -68,6 +68,8 @@ public:
static void BlowUpExplosiveThings(CEntity *thing);
bool HasWeaponAmmoToBeUsed(void);
+ static bool IsShotgun(int weapon) { return weapon == WEAPONTYPE_SHOTGUN || weapon == WEAPONTYPE_SPAS12_SHOTGUN || weapon == WEAPONTYPE_STUBBY_SHOTGUN; }
+
static bool 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);
#ifdef COMPATIBLE_SAVES
diff --git a/src/weapons/WeaponInfo.cpp b/src/weapons/WeaponInfo.cpp
index d5e759b9..104fa2ec 100644
--- a/src/weapons/WeaponInfo.cpp
+++ b/src/weapons/WeaponInfo.cpp
@@ -12,6 +12,7 @@
// Yeah...
int32 CWeaponInfo::ms_aMaxAmmoForWeapon[WEAPONTYPE_TOTALWEAPONS] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1
};
CWeaponInfo CWeaponInfo::ms_apWeaponInfos[WEAPONTYPE_TOTALWEAPONS];
@@ -32,21 +33,29 @@ static char ms_aWeaponNames[][32] = {
"Chainsaw",
"Grenade",
"DetonateGrenade",
+ "TearGas",
"Molotov",
"Rocket",
"Colt45",
+ "Python",
"Shotgun",
+ "Spas12Shotgun",
+ "StubbyShotgun",
"Tec9",
"Uzi",
"SilencedIngram",
"Mp5",
- "M16",
- "AK47",
+ "m4",
+ "Ruger",
"SniperRifle",
+ "LaserScope",
"RocketLauncher",
"FlameThrower",
+ "M60",
+ "Minigun",
"Detonator",
"HeliCannon",
+ "Camera",
};
CWeaponInfo*
@@ -223,9 +232,7 @@ CWeaponInfo::LoadWeaponData(void)
ms_apWeaponInfos[weaponType].m_nWeaponSlot = weaponSlot;
- // TODO(Miami): Enable once weapons are done
- if (animLoopEnd < 98.0f && weaponType != WEAPONTYPE_FLAMETHROWER && weaponType != WEAPONTYPE_SHOTGUN
- /*&& weaponType != 20 && weaponType != 21*/)
+ if (animLoopEnd < 98.0f && weaponType != WEAPONTYPE_FLAMETHROWER && !CWeapon::IsShotgun(weaponType))
ms_apWeaponInfos[weaponType].m_nFiringRate = ((ms_apWeaponInfos[weaponType].m_fAnimLoopEnd - ms_apWeaponInfos[weaponType].m_fAnimLoopStart) * 900.0f);
if (weaponType == WEAPONTYPE_DETONATOR || weaponType == WEAPONTYPE_HELICANNON)
@@ -263,6 +270,7 @@ CWeaponInfo::FindWeaponFireType(char *name)
if (strcmp(name, "INSTANT_HIT") == 0) return WEAPON_FIRE_INSTANT_HIT;
if (strcmp(name, "PROJECTILE") == 0) return WEAPON_FIRE_PROJECTILE;
if (strcmp(name, "AREA_EFFECT") == 0) return WEAPON_FIRE_AREA_EFFECT;
+ if (strcmp(name, "CAMERA") == 0) return WEAPON_FIRE_CAMERA;
Error("Unknown weapon fire type, WeaponInfo.cpp");
return WEAPON_FIRE_INSTANT_HIT;
}
diff --git a/src/weapons/WeaponType.h b/src/weapons/WeaponType.h
index 4b8be40f..65d715ec 100644
--- a/src/weapons/WeaponType.h
+++ b/src/weapons/WeaponType.h
@@ -1,6 +1,5 @@
#pragma once
-// --MIAMI: TODO
enum eWeaponType
{
WEAPONTYPE_UNARMED,
@@ -17,23 +16,31 @@ enum eWeaponType
WEAPONTYPE_CHAINSAW,
WEAPONTYPE_GRENADE,
WEAPONTYPE_DETONATOR_GRENADE,
+ WEAPONTYPE_TEARGAS,
WEAPONTYPE_MOLOTOV,
WEAPONTYPE_ROCKET,
WEAPONTYPE_COLT45,
+ WEAPONTYPE_PYTHON,
WEAPONTYPE_SHOTGUN,
+ WEAPONTYPE_SPAS12_SHOTGUN,
+ WEAPONTYPE_STUBBY_SHOTGUN,
WEAPONTYPE_TEC9,
WEAPONTYPE_UZI,
WEAPONTYPE_SILENCED_INGRAM,
WEAPONTYPE_MP5,
- WEAPONTYPE_M16,
- WEAPONTYPE_AK47,
+ WEAPONTYPE_M4,
+ WEAPONTYPE_RUGER,
WEAPONTYPE_SNIPERRIFLE,
+ WEAPONTYPE_LASERSCOPE,
WEAPONTYPE_ROCKETLAUNCHER,
WEAPONTYPE_FLAMETHROWER,
+ WEAPONTYPE_M60,
+ WEAPONTYPE_MINIGUN,
WEAPONTYPE_DETONATOR,
WEAPONTYPE_HELICANNON,
- WEAPONTYPE_LAST_WEAPONTYPE,
- WEAPONTYPE_HEALTH,
+ WEAPONTYPE_CAMERA,
+ WEAPONTYPE_TOTALWEAPONS = 37,
+ WEAPONTYPE_HEALTH = 37,
WEAPONTYPE_ARMOUR,
WEAPONTYPE_RAMMEDBYCAR,
WEAPONTYPE_RUNOVERBYCAR,
@@ -42,10 +49,8 @@ enum eWeaponType
WEAPONTYPE_DROWNING,
WEAPONTYPE_FALL,
WEAPONTYPE_UNIDENTIFIED,
-
- WEAPONTYPE_TOTALWEAPONS = WEAPONTYPE_LAST_WEAPONTYPE,
- WEAPONTYPE_ANYMELEE = 46,
- WEAPONTYPE_ANYWEAPON = 47
+ WEAPONTYPE_ANYMELEE,
+ WEAPONTYPE_ANYWEAPON
};
enum {
@@ -57,7 +62,7 @@ enum eWeaponFire {
WEAPON_FIRE_INSTANT_HIT,
WEAPON_FIRE_PROJECTILE,
WEAPON_FIRE_AREA_EFFECT,
- WEAPON_FIRE_USE
+ WEAPON_FIRE_CAMERA
};
// Taken from MTA SA, seems it's unchanged