1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-24 03:00:01 +00:00

Compatibility with VC weapon.dat + new shotguns

This commit is contained in:
eray orçunus 2020-05-23 16:53:20 +03:00
parent 9313bfa155
commit 5357957fe1
21 changed files with 433 additions and 233 deletions

View file

@ -3478,7 +3478,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
else else
noReflection = true; noReflection = true;
break; break;
case WEAPONTYPE_AK47: case WEAPONTYPE_RUGER:
m_sQueueSample.m_nSampleIndex = SFX_AK47_LEFT; m_sQueueSample.m_nSampleIndex = SFX_AK47_LEFT;
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nCounter = iSound++; m_sQueueSample.m_nCounter = iSound++;
@ -3497,7 +3497,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_bReleasingSoundFlag = true; m_sQueueSample.m_bReleasingSoundFlag = true;
break; break;
case WEAPONTYPE_M16: case WEAPONTYPE_M4:
m_sQueueSample.m_nSampleIndex = SFX_M16_LEFT; m_sQueueSample.m_nSampleIndex = SFX_M16_LEFT;
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nCounter = iSound++; m_sQueueSample.m_nCounter = iSound++;
@ -3604,11 +3604,11 @@ cAudioManager::ProcessPedOneShots(cPedParams *params)
m_sQueueSample.m_nSampleIndex = SFX_AK47_RELOAD; m_sQueueSample.m_nSampleIndex = SFX_AK47_RELOAD;
m_sQueueSample.m_nFrequency = 30290; m_sQueueSample.m_nFrequency = 30290;
break; break;
case WEAPONTYPE_AK47: case WEAPONTYPE_RUGER:
m_sQueueSample.m_nSampleIndex = SFX_AK47_RELOAD; m_sQueueSample.m_nSampleIndex = SFX_AK47_RELOAD;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_AK47_RELOAD); m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_AK47_RELOAD);
break; break;
case WEAPONTYPE_M16: case WEAPONTYPE_M4:
m_sQueueSample.m_nSampleIndex = SFX_M16_RELOAD; m_sQueueSample.m_nSampleIndex = SFX_M16_RELOAD;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_M16_RELOAD); m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_M16_RELOAD);
break; break;

View file

@ -46,55 +46,32 @@ tPickupMessage CPickups::aMessages[NUMPICKUPMESSAGES];
// TODO(Miami) // 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 }; 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] = { uint16 AmmoForWeapon_OnStreet[WEAPONTYPE_TOTALWEAPONS] = {
0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 34,
1, 12, 16, 14, 10, 100, 60, 60, 60, 60, 60, 20, 14,
1, 4, 150, 100, 500, 1, 400, 36, 0,
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,
}; };
uint16 CostOfWeapon[20] = { 0, 10, 250, 800, 1500, 3000, 5000, 10000, 25000, 25000, 2000, 2000, 0, 50000, 0, 3000, 0, 0, 0, 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!! // TODO(Miami): Those are all placeholders!!
uint8 aWeaponReds[] = { 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 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, 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 }; 255, 128, 0, 255, 0 };
uint8 aWeaponGreens[] = { 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, uint8 aWeaponGreens[] = { 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
0, 255, 128, 255, 0, 255, 128, 255, 0, 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 }; 0, 255, 0, 255, 0 };
uint8 aWeaponBlues[] = { 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, uint8 aWeaponBlues[] = { 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
0, 0, 255, 0, 255, 255, 0, 128, 255, 0, 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 }; 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, 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, 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 }; 1.0f, 1.0f, 1.0f, 1.0f };
void void
@ -722,13 +699,13 @@ CPickups::DoPickUpEffects(CEntity *entity)
int16 colorId; int16 colorId;
if (entity->GetModelIndex() == MI_PICKUP_ADRENALINE || entity->GetModelIndex() == MI_PICKUP_CAMERA) 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) 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) 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) else if (entity->GetModelIndex() == MI_PICKUP_HEALTH || entity->GetModelIndex() == MI_PICKUP_BONUS)
colorId = WEAPONTYPE_LAST_WEAPONTYPE + 3; colorId = WEAPONTYPE_TOTALWEAPONS + 3;
else else
colorId = WeaponForModel(entity->GetModelIndex()); colorId = WeaponForModel(entity->GetModelIndex());

View file

@ -6545,7 +6545,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
printf("HAS_CHAR_BEEN_DAMAGED_BY_WEAPON - Character doesn't exist\n"); printf("HAS_CHAR_BEEN_DAMAGED_BY_WEAPON - Character doesn't exist\n");
else { else {
if (ScriptParams[1] == WEAPONTYPE_ANYMELEE || ScriptParams[1] == WEAPONTYPE_ANYWEAPON) if (ScriptParams[1] == WEAPONTYPE_ANYMELEE || ScriptParams[1] == WEAPONTYPE_ANYWEAPON)
result = CheckDamagedWeaponType(ScriptParams[1], pPed->m_lastWepDam); result = CheckDamagedWeaponType(pPed->m_lastWepDam, ScriptParams[1]);
else else
result = ScriptParams[1] == pPed->m_lastWepDam; 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"); printf("HAS_CAR_BEEN_DAMAGED_BY_WEAPON - Vehicle doesn't exist\n");
else { else {
if (ScriptParams[1] == WEAPONTYPE_ANYMELEE || ScriptParams[1] == WEAPONTYPE_ANYWEAPON) if (ScriptParams[1] == WEAPONTYPE_ANYMELEE || ScriptParams[1] == WEAPONTYPE_ANYWEAPON)
result = CheckDamagedWeaponType(ScriptParams[1], pVehicle->m_nLastWeaponDamage); result = CheckDamagedWeaponType(pVehicle->m_nLastWeaponDamage, ScriptParams[1]);
else else
result = ScriptParams[1] == pVehicle->m_nLastWeaponDamage; result = ScriptParams[1] == pVehicle->m_nLastWeaponDamage;
} }
@ -11989,12 +11989,23 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
return -1; return -1;
} }
bool CRunningScript::CheckDamagedWeaponType(int32 type, int32 actual) bool CRunningScript::CheckDamagedWeaponType(int32 actual, int32 type)
{ {
if (actual == -1) if (actual == -1)
return false; return false;
if (type == WEAPONTYPE_ANYMELEE) { 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_UNARMED:
case WEAPONTYPE_BRASSKNUCKLE: case WEAPONTYPE_BRASSKNUCKLE:
case WEAPONTYPE_SCREWDRIVER: case WEAPONTYPE_SCREWDRIVER:
@ -12007,16 +12018,44 @@ bool CRunningScript::CheckDamagedWeaponType(int32 type, int32 actual)
case WEAPONTYPE_MACHETE: case WEAPONTYPE_MACHETE:
case WEAPONTYPE_KATANA: case WEAPONTYPE_KATANA:
case WEAPONTYPE_CHAINSAW: 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; 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; 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; return false;
} }

View file

@ -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); static bool ThisIsAValidRandomCop(int32 mi, bool cop, bool swat, bool fbi, bool army, bool miami);
}; };

View file

@ -2429,7 +2429,7 @@ CCam::Process_Rocket(const CVector &CameraTarget, float, float, float)
ResetStatics = false; ResetStatics = false;
} }
((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(&HeadPos, PED_HEAD); ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(HeadPos, PED_HEAD);
Source = HeadPos; Source = HeadPos;
Source.z += 0.1f; Source.z += 0.1f;
Source.x -= 0.19f*Cos(m_fInitialPlayerOrientation); 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.x = 0.0f;
HeadPos.y = 0.0f; HeadPos.y = 0.0f;
HeadPos.z = 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 = HeadPos;
Source.z += 0.1f; Source.z += 0.1f;
Source.x -= 0.19f * Cos(m_fInitialPlayerOrientation); Source.x -= 0.19f * Cos(m_fInitialPlayerOrientation);
@ -2657,7 +2657,7 @@ CCam::Process_1stPerson(const CVector &CameraTarget, float TargetOrientation, fl
ResetStatics = false; ResetStatics = false;
} }
((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(&HeadPos, PED_HEAD); ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(HeadPos, PED_HEAD);
Source = HeadPos; Source = HeadPos;
Source.z += 0.1f; Source.z += 0.1f;
Source.x -= 0.19f*Cos(m_fInitialPlayerOrientation); Source.x -= 0.19f*Cos(m_fInitialPlayerOrientation);
@ -2925,7 +2925,7 @@ CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float
ResetStatics = false; ResetStatics = false;
} }
((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(&HeadPos, PED_HEAD); ((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(HeadPos, PED_HEAD);
Source = HeadPos; Source = HeadPos;
Source.z += 0.1f; Source.z += 0.1f;
Source.x -= 0.19f*Cos(m_fInitialPlayerOrientation); Source.x -= 0.19f*Cos(m_fInitialPlayerOrientation);

View file

@ -2241,7 +2241,7 @@ CMenuManager::DrawBackground()
m_menuTransitionProgress = 255; 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(); SetFrontEndRenderStates();
@ -2264,7 +2264,7 @@ CMenuManager::DrawBackground()
if (m_menuTransitionProgress == 255) { 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)); 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 { } 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) { if (m_bShowMouse) {
@ -2693,11 +2693,6 @@ CMenuManager::DrawPlayerSetupScreen()
int int
CMenuManager::FadeIn(int alpha) 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); return Min(m_nMenuFadeAlpha, alpha);
} }
@ -3242,7 +3237,7 @@ CMenuManager::Process(void)
ProcessFileActions(); ProcessFileActions();
DMAudio.Service(); DMAudio.Service();
// TODO(Miami): What are the functions in here? // Game calls some texture pool cleanup functions in here
} }
SwitchMenuOnAndOff(); SwitchMenuOnAndOff();

View file

@ -538,7 +538,7 @@ public:
int32 m_nPrevScreen; int32 m_nPrevScreen;
int32 m_nCurrSaveSlot; int32 m_nCurrSaveSlot;
int32 m_LastScreenSwitch; int32 m_LastScreenSwitch;
uint32 m_nMenuFadeAlpha; int32 m_nMenuFadeAlpha;
int32 bOptionHighlightTransitionBlend; int32 bOptionHighlightTransitionBlend;
bool bMenuChangeOngoing; bool bMenuChangeOngoing;
int32 MouseButtonJustClicked; int32 MouseButtonJustClicked;

View file

@ -68,32 +68,32 @@ void WeaponCheat()
CStreaming::RequestModel(MI_GRENADE, STREAMFLAGS_DONT_REMOVE); CStreaming::RequestModel(MI_GRENADE, STREAMFLAGS_DONT_REMOVE);
CStreaming::RequestModel(MI_BOMB, 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_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_ROCKETLAUNCHER, STREAMFLAGS_DONT_REMOVE);
CStreaming::RequestModel(MI_SHOTGUN, STREAMFLAGS_DONT_REMOVE); CStreaming::RequestModel(MI_SPAS12_SHOTGUN, STREAMFLAGS_DONT_REMOVE);
CStreaming::RequestModel(MI_SNIPER, STREAMFLAGS_DONT_REMOVE); CStreaming::RequestModel(MI_SNIPERRIFLE, STREAMFLAGS_DONT_REMOVE);
CStreaming::RequestModel(MI_MP5, STREAMFLAGS_DONT_REMOVE); CStreaming::RequestModel(MI_MP5, STREAMFLAGS_DONT_REMOVE);
CStreaming::LoadAllRequestedModels(false); CStreaming::LoadAllRequestedModels(false);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_BASEBALLBAT, 0); FindPlayerPed()->GiveWeapon(WEAPONTYPE_BASEBALLBAT, 0);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_COLT45, 100); FindPlayerPed()->GiveWeapon(WEAPONTYPE_COLT45, 100);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_MP5, 100); FindPlayerPed()->GiveWeapon(WEAPONTYPE_MP5, 100);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_SHOTGUN, 20); FindPlayerPed()->GiveWeapon(WEAPONTYPE_SPAS12_SHOTGUN, 20);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_AK47, 200); FindPlayerPed()->GiveWeapon(WEAPONTYPE_RUGER, 200);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_SNIPERRIFLE, 5); FindPlayerPed()->GiveWeapon(WEAPONTYPE_SNIPERRIFLE, 5);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_ROCKETLAUNCHER, 5); FindPlayerPed()->GiveWeapon(WEAPONTYPE_ROCKETLAUNCHER, 5);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_DETONATOR_GRENADE, 5); FindPlayerPed()->GiveWeapon(WEAPONTYPE_DETONATOR_GRENADE, 5);
CStreaming::SetModelIsDeletable(MI_GRENADE); CStreaming::SetModelIsDeletable(MI_GRENADE);
CStreaming::SetModelIsDeletable(MI_BOMB); CStreaming::SetModelIsDeletable(MI_BOMB);
CStreaming::SetModelIsDeletable(MI_AK47); CStreaming::SetModelIsDeletable(MI_RUGER);
CStreaming::SetModelIsDeletable(MI_BASEBALL_BAT); CStreaming::SetModelIsDeletable(MI_BASEBALL_BAT);
CStreaming::SetModelIsDeletable(MI_COLT); CStreaming::SetModelIsDeletable(MI_COLT45);
CStreaming::SetModelIsDeletable(MI_ROCKETLAUNCHER); CStreaming::SetModelIsDeletable(MI_ROCKETLAUNCHER);
CStreaming::SetModelIsDeletable(MI_SHOTGUN); CStreaming::SetModelIsDeletable(MI_SPAS12_SHOTGUN);
CStreaming::SetModelIsDeletable(MI_SNIPER); CStreaming::SetModelIsDeletable(MI_SNIPERRIFLE);
CStreaming::SetModelIsDeletable(MI_MP5); CStreaming::SetModelIsDeletable(MI_MP5);
} }

View file

@ -303,23 +303,33 @@ enum
MI_DODO = -2, MI_DODO = -2,
MI_NIGHTSTICK = 262, MI_NIGHTSTICK = 262,
MI_BASEBALL_BAT = 264, MI_KNIFE,
MI_BASEBALL_BAT,
MI_GRENADE = 270, MI_GRENADE = 270,
MI_MOLOTOV = 272, MI_TEARGAS,
MI_MISSILE = 273, MI_MOLOTOV,
MI_COLT = 274, MI_MISSILE,
MI_AK47 = 276, MI_COLT45,
MI_SHOTGUN = 279, MI_PYTHON,
MI_M16 = 280, MI_RUGER,
MI_TEC9 = 281, MI_SHOTGUN,
MI_UZI = 282, MI_SPAS12_SHOTGUN,
MI_SILENCEDINGRAM = 283, MI_STUBBY_SHOTGUN,
MI_MP5 = 284, MI_M4,
MI_SNIPER = 285, MI_TEC9,
MI_ROCKETLAUNCHER = 287, MI_UZI,
MI_FLAMETHROWER = 288, MI_SILENCEDINGRAM,
MI_BOMB = 291, MI_MP5,
MI_FINGERS = 293, MI_SNIPERRIFLE,
MI_LASERSCOPE,
MI_ROCKETLAUNCHER,
MI_FLAMETHROWER,
MI_M60,
MI_MINIGUN,
MI_BOMB,
MI_CAMERA,
MI_FINGERS,
MI_MINIGUN2,
MI_CUTOBJ01 = 295, MI_CUTOBJ01 = 295,
MI_CUTOBJ02, MI_CUTOBJ02,

View file

@ -257,7 +257,7 @@ CCopPed::ArrestPlayer(void)
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_ARREST_GUN, 4.0f); CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_ARREST_GUN, 4.0f);
CVector suspMidPos; 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, m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(suspMidPos.x, suspMidPos.y,
GetPosition().x, GetPosition().y); GetPosition().x, GetPosition().y);

View file

@ -231,8 +231,8 @@ CEmergencyPed::MedicAI(void)
if (nearestAccident) { if (nearestAccident) {
m_pRevivedPed = nearestAccident->m_pVictim; m_pRevivedPed = nearestAccident->m_pVictim;
m_pRevivedPed->RegisterReference((CEntity**)&m_pRevivedPed); m_pRevivedPed->RegisterReference((CEntity**)&m_pRevivedPed);
m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d*)&midPos, PED_MID); m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d)midPos, PED_MID);
m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d*)&headPos, PED_HEAD); m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d)headPos, PED_HEAD);
SetSeek((headPos + midPos) * 0.5f, 1.0f); SetSeek((headPos + midPos) * 0.5f, 1.0f);
SetObjective(OBJECTIVE_NONE); SetObjective(OBJECTIVE_NONE);
bIsRunning = true; bIsRunning = true;
@ -271,8 +271,8 @@ CEmergencyPed::MedicAI(void)
m_nEmergencyPedState = EMERGENCY_PED_STOP; m_nEmergencyPedState = EMERGENCY_PED_STOP;
break; break;
} }
m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d*)&midPos, PED_MID); m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d)midPos, PED_MID);
m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d*)&headPos, PED_HEAD); m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d)headPos, PED_HEAD);
SetSeek((headPos + midPos) * 0.5f, nearestAccident->m_nMedicsPerformingCPR * 0.5f + 1.0f); SetSeek((headPos + midPos) * 0.5f, nearestAccident->m_nMedicsPerformingCPR * 0.5f + 1.0f);
SetObjective(OBJECTIVE_NONE); SetObjective(OBJECTIVE_NONE);
bIsRunning = true; bIsRunning = true;
@ -326,8 +326,8 @@ CEmergencyPed::MedicAI(void)
if (!m_pRevivedPed || m_pRevivedPed->m_fHealth > 0.0f) if (!m_pRevivedPed || m_pRevivedPed->m_fHealth > 0.0f)
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE; m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
else { else {
m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d*)&midPos, PED_MID); m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d)midPos, PED_MID);
m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d*)&headPos, PED_HEAD); m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d)headPos, PED_HEAD);
midPos = (headPos + midPos) * 0.5f; midPos = (headPos + midPos) * 0.5f;
m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints( m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(
midPos.x, midPos.y, midPos.x, midPos.y,
@ -348,8 +348,8 @@ CEmergencyPed::MedicAI(void)
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE; m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
break; break;
} }
m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d*)&midPos, PED_MID); m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d)midPos, PED_MID);
m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d*)&headPos, PED_HEAD); m_pRevivedPed->m_pedIK.GetComponentPosition((RwV3d)headPos, PED_HEAD);
midPos = (headPos + midPos) * 0.5f; midPos = (headPos + midPos) * 0.5f;
m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints( m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(
midPos.x, midPos.y, midPos.x, midPos.y,

View file

@ -685,7 +685,7 @@ CPed::GiveWeapon(eWeaponType weaponType, uint32 ammo, bool unused)
if (m_weapons[slot].m_eWeaponType == weaponType) { if (m_weapons[slot].m_eWeaponType == weaponType) {
GetWeapon(slot).m_nAmmoTotal += ammo; 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. // 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); 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(); CModelInfo::GetModelInfo(id)->AddRef();
m_wepModelID = id; m_wepModelID = id;
// TODO(Miami) if (IsPlayer() && id == MI_MINIGUN)
// if (IsPlayer() && id == MI_MINIGUN) ((CPlayerPed*)this)->m_pMinigunTopAtomic = (RpAtomic*)CModelInfo::GetModelInfo(MI_MINIGUN2)->CreateInstance();
// ((CPlayerPed*)this)->m_pMinigunTopAtomic = (RpAtomic*)CModelInfo::GetModelInfo(MI_MINIGUN2)->CreateInstance();
} }
} }
@ -898,7 +897,7 @@ CPed::AimGun(void)
if (m_pSeekTarget) { if (m_pSeekTarget) {
if (m_pSeekTarget->IsPed()) { if (m_pSeekTarget->IsPed()) {
((CPed*)m_pSeekTarget)->m_pedIK.GetComponentPosition(&pos, PED_MID); ((CPed*)m_pSeekTarget)->m_pedIK.GetComponentPosition(pos, PED_MID);
vector = pos; vector = pos;
} else { } else {
vector = m_pSeekTarget->GetPosition(); vector = m_pSeekTarget->GetPosition();
@ -1507,9 +1506,8 @@ CPed::Attack(void)
GetWeapon()->Fire(this, &firePos); GetWeapon()->Fire(this, &firePos);
// TODO(Miami): Teargas if (ourWeaponType == WEAPONTYPE_MOLOTOV || ourWeaponType == WEAPONTYPE_GRENADE || ourWeaponType == WEAPONTYPE_DETONATOR_GRENADE ||
if (ourWeaponType == WEAPONTYPE_MOLOTOV || ourWeaponType == WEAPONTYPE_GRENADE || ourWeaponType == WEAPONTYPE_DETONATOR_GRENADE ourWeaponType == WEAPONTYPE_TEARGAS) {
/* ourWeaponType == WEAPONTYPE_TEARGAS*/) {
RemoveWeaponModel(ourWeapon->m_nModelId); RemoveWeaponModel(ourWeapon->m_nModelId);
} }
if (!GetWeapon()->m_nAmmoTotal && ourWeaponFire != WEAPON_FIRE_MELEE && FindPlayerPed() != this) { if (!GetWeapon()->m_nAmmoTotal && ourWeaponFire != WEAPON_FIRE_MELEE && FindPlayerPed() != this) {
@ -1649,10 +1647,10 @@ CPed::Attack(void)
case WEAPONTYPE_MP5: case WEAPONTYPE_MP5:
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_UZI_BULLET_ECHO, 0.0f); DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_UZI_BULLET_ECHO, 0.0f);
break; break;
case WEAPONTYPE_AK47: case WEAPONTYPE_RUGER:
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, 0.0f); DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, 0.0f);
break; break;
case WEAPONTYPE_M16: case WEAPONTYPE_M4:
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_M16_BULLET_ECHO, 0.0f); DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_M16_BULLET_ECHO, 0.0f);
break; break;
default: default:
@ -1667,7 +1665,7 @@ CPed::Attack(void)
if (weaponAnimTime - 2.0f * weaponAnimAssoc->timeStep <= animLoopEnd if (weaponAnimTime - 2.0f * weaponAnimAssoc->timeStep <= animLoopEnd
&& (bIsAttacking || CTimer::GetTimeInMilliseconds() < m_shootTimer) && (bIsAttacking || CTimer::GetTimeInMilliseconds() < m_shootTimer)
&& (GetWeapon()->m_eWeaponState != WEAPONSTATE_RELOADING && (GetWeapon()->m_eWeaponState != WEAPONSTATE_RELOADING
/* || GetWeapon()->m_nWeaponType == WEAPONTYPE_MINIGUN */)) { // TODO(Miami): Minigun || GetWeapon()->m_eWeaponType == WEAPONTYPE_MINIGUN)) {
PedOnGroundState pedOnGroundState; PedOnGroundState pedOnGroundState;
if (ourWeapon->m_eWeaponFire == WEAPON_FIRE_MELEE && if (ourWeapon->m_eWeaponFire == WEAPON_FIRE_MELEE &&
@ -1715,10 +1713,10 @@ CPed::Attack(void)
case WEAPONTYPE_MP5: case WEAPONTYPE_MP5:
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_UZI_BULLET_ECHO, 0.0f); DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_UZI_BULLET_ECHO, 0.0f);
break; break;
case WEAPONTYPE_AK47: case WEAPONTYPE_RUGER:
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, 0.0f); DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, 0.0f);
break; break;
case WEAPONTYPE_M16: case WEAPONTYPE_M4:
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_M16_BULLET_ECHO, 0.0f); DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_M16_BULLET_ECHO, 0.0f);
break; break;
default: default:
@ -1764,8 +1762,7 @@ CPed::RemoveWeaponModel(int modelId)
#endif #endif
RwFrameForAllObjects(m_pFrames[PED_HANDR]->frame,RemoveAllModelCB,nil); 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; RpAtomic* &atm = ((CPlayerPed*)this)->m_pMinigunTopAtomic;
if (atm) { if (atm) {
RwFrame *frm = RpAtomicGetFrame(atm); RwFrame *frm = RpAtomicGetFrame(atm);
@ -1818,7 +1815,7 @@ CPed::SelectGunIfArmed(void)
// First condition checks for Pistol, Python and Shotguns // First condition checks for Pistol, Python and Shotguns
if ((weaponType >= WEAPONTYPE_COLT45 && weaponType < WEAPONTYPE_TEC9) || 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) { weaponType == WEAPONTYPE_ROCKETLAUNCHER || weaponType == WEAPONTYPE_FLAMETHROWER || weaponType == WEAPONTYPE_SNIPERRIFLE) {
SetCurrentWeapon(i); SetCurrentWeapon(i);
return true; return true;
@ -4278,16 +4275,19 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
break; break;
case WEAPONTYPE_COLT45: case WEAPONTYPE_COLT45:
case WEAPONTYPE_SHOTGUN: case WEAPONTYPE_SHOTGUN:
// TODO(Miami): Shotguns case WEAPONTYPE_STUBBY_SHOTGUN:
case WEAPONTYPE_SPAS12_SHOTGUN:
case WEAPONTYPE_TEC9: case WEAPONTYPE_TEC9:
case WEAPONTYPE_UZI: case WEAPONTYPE_UZI:
case WEAPONTYPE_SILENCED_INGRAM: case WEAPONTYPE_SILENCED_INGRAM:
case WEAPONTYPE_MP5: case WEAPONTYPE_MP5:
case WEAPONTYPE_M16: case WEAPONTYPE_M4:
case WEAPONTYPE_AK47: case WEAPONTYPE_RUGER:
case WEAPONTYPE_SNIPERRIFLE: case WEAPONTYPE_SNIPERRIFLE:
case WEAPONTYPE_LASERSCOPE:
case WEAPONTYPE_M60:
case WEAPONTYPE_MINIGUN:
case WEAPONTYPE_UZI_DRIVEBY: case WEAPONTYPE_UZI_DRIVEBY:
// TODO(Miami): Laserscope, M60, Minigun
if (bBulletProof) if (bBulletProof)
return false; return false;
@ -4295,8 +4295,8 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
bool dontRemoveLimb; bool dontRemoveLimb;
if (IsPlayer() || bNoCriticalHits) if (IsPlayer() || bNoCriticalHits)
dontRemoveLimb = true; dontRemoveLimb = true;
else if (method != WEAPONTYPE_M16 && method != WEAPONTYPE_AK47 && method != WEAPONTYPE_SNIPERRIFLE else if (method != WEAPONTYPE_M4 && method != WEAPONTYPE_RUGER && method != WEAPONTYPE_SNIPERRIFLE &&
/* method != WEAPONTYPE_LASERSCOPE */) { // TODO(Miami): Laserscope method != WEAPONTYPE_LASERSCOPE) {
if (method == WEAPONTYPE_SHOTGUN) if (method == WEAPONTYPE_SHOTGUN)
dontRemoveLimb = CGeneral::GetRandomNumber() & 7; dontRemoveLimb = CGeneral::GetRandomNumber() & 7;
else else
@ -5012,7 +5012,7 @@ CPed::SetAmmo(eWeaponType weaponType, uint32 ammo)
return; return;
GetWeapon(slot).m_nAmmoTotal = ammo; 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. // 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); GetWeapon(slot).m_nAmmoTotal = Min(CWeaponInfo::ms_aMaxAmmoForWeapon[weaponType], GetWeapon(slot).m_nAmmoTotal);
@ -5037,7 +5037,7 @@ CPed::GrantAmmo(eWeaponType weaponType, uint32 ammo)
return; return;
GetWeapon(slot).m_nAmmoTotal += ammo; 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. // 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); 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)) || (m_nPedState == PED_SEEK_POS && m_vecSeekPos.x == pos.x && m_vecSeekPos.y == pos.y))
return; return;
if (GetWeapon()->m_eWeaponType == WEAPONTYPE_M16 if (!CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bCanAimWithArm) {
|| GetWeapon()->m_eWeaponType == WEAPONTYPE_AK47
|| GetWeapon()->m_eWeaponType == WEAPONTYPE_SNIPERRIFLE
|| GetWeapon()->m_eWeaponType == WEAPONTYPE_ROCKETLAUNCHER
|| GetWeapon()->m_eWeaponType == WEAPONTYPE_SHOTGUN) {
ClearPointGunAt(); ClearPointGunAt();
} }
@ -9734,7 +9730,7 @@ CPed::MoveHeadToLook(void)
} }
if (m_pLookTarget->IsPed()) { 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 { } else {
lookPos = m_pLookTarget->GetPosition(); lookPos = m_pLookTarget->GetPosition();
} }
@ -13696,7 +13692,7 @@ CPed::ProcessObjective(void)
CVector target; CVector target;
CVector ourHead = GetMatrix() * CVector(0.5f, 0.0f, 0.6f); CVector ourHead = GetMatrix() * CVector(0.5f, 0.0f, 0.6f);
if (m_pedInObjective->IsPed()) if (m_pedInObjective->IsPed())
m_pedInObjective->m_pedIK.GetComponentPosition((RwV3d*)&target, PED_MID); m_pedInObjective->m_pedIK.GetComponentPosition((RwV3d)target, PED_MID);
else else
target = m_pedInObjective->GetPosition(); target = m_pedInObjective->GetPosition();

View file

@ -7,7 +7,7 @@
#include "General.h" #include "General.h"
#include "RwHelper.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_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) }; 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 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 LimbMoveStatus
@ -292,13 +292,20 @@ CPedIK::PointGunInDirectionUsingArm(float targetYaw, float targetPitch)
bool bool
CPedIK::PointGunAtPosition(CVector const& position) 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( return PointGunInDirection(
CGeneral::GetRadianAngleBetweenPoints(position.x, position.y, m_ped->GetPosition().x, m_ped->GetPosition().y), CGeneral::GetRadianAngleBetweenPoints(position.x, position.y, startPoint.x, startPoint.y),
CGeneral::GetRadianAngleBetweenPoints(position.z, Distance2D(m_ped->GetPosition(), position.x, position.y), armPos.z, 0.0f)); CGeneral::GetRadianAngleBetweenPoints(position.z, Distance2D(m_ped->GetPosition(), position.x, position.y), startPoint.z, 0.0f));
} }
bool bool

View file

@ -51,7 +51,7 @@ public:
bool PointGunInDirection(float targetYaw, float targetPitch); bool PointGunInDirection(float targetYaw, float targetPitch);
bool PointGunInDirectionUsingArm(float targetYaw, float targetPitch); bool PointGunInDirectionUsingArm(float targetYaw, float targetPitch);
bool PointGunAtPosition(CVector const& position); 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 RotateTorso(AnimBlendFrameData* animBlend, LimbOrientation* limb, bool changeRoll);
void ExtractYawAndPitchLocal(RwMatrix *mat, float *yaw, float *pitch); void ExtractYawAndPitchLocal(RwMatrix *mat, float *yaw, float *pitch);
void ExtractYawAndPitchLocalSkinned(AnimBlendFrameData *node, float *yaw, float *pitch); void ExtractYawAndPitchLocalSkinned(AnimBlendFrameData *node, float *yaw, float *pitch);

View file

@ -546,6 +546,8 @@ CPlayerPed::RestoreSprintEnergy(float restoreSpeed)
m_fCurrentStamina += restoreSpeed * CTimer::GetTimeStep() * 0.5f; m_fCurrentStamina += restoreSpeed * CTimer::GetTimeStep() * 0.5f;
} }
// TODO(Miami)
bool bool
CPlayerPed::DoWeaponSmoothSpray(void) CPlayerPed::DoWeaponSmoothSpray(void)
{ {
@ -553,7 +555,7 @@ CPlayerPed::DoWeaponSmoothSpray(void)
eWeaponType weapon = GetWeapon()->m_eWeaponType; eWeaponType weapon = GetWeapon()->m_eWeaponType;
if (weapon == WEAPONTYPE_FLAMETHROWER || weapon == WEAPONTYPE_COLT45 || weapon == WEAPONTYPE_UZI || if (weapon == WEAPONTYPE_FLAMETHROWER || weapon == WEAPONTYPE_COLT45 || weapon == WEAPONTYPE_UZI ||
weapon == WEAPONTYPE_TEC9 || weapon == WEAPONTYPE_SILENCED_INGRAM || weapon == WEAPONTYPE_MP5 || 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 true;
} }
return false; return false;
@ -574,7 +576,7 @@ CPlayerPed::DoesTargetHaveToBeBroken(CVector target, CWeapon *weaponUsed)
if (distVec.Magnitude() > CWeaponInfo::GetWeaponInfo(weaponUsed->m_eWeaponType)->m_fRange) if (distVec.Magnitude() > CWeaponInfo::GetWeaponInfo(weaponUsed->m_eWeaponType)->m_fRange)
return true; 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; return false;
distVec.Normalise(); distVec.Normalise();
@ -1099,8 +1101,8 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
} }
if (!m_pFire) { if (!m_pFire) {
if (GetWeapon()->m_eWeaponType == WEAPONTYPE_ROCKETLAUNCHER || if (GetWeapon()->m_eWeaponType == WEAPONTYPE_ROCKETLAUNCHER ||
GetWeapon()->m_eWeaponType == WEAPONTYPE_SNIPERRIFLE || GetWeapon()->m_eWeaponType == WEAPONTYPE_M16 || GetWeapon()->m_eWeaponType == WEAPONTYPE_SNIPERRIFLE || GetWeapon()->m_eWeaponType == WEAPONTYPE_M4 ||
GetWeapon()->m_eWeaponType == WEAPONTYPE_AK47) { GetWeapon()->m_eWeaponType == WEAPONTYPE_RUGER) {
if (padUsed->TargetJustDown() || TheCamera.m_bJustJumpedOutOf1stPersonBecauseOfTarget) { if (padUsed->TargetJustDown() || TheCamera.m_bJustJumpedOutOf1stPersonBecauseOfTarget) {
SetStoredState(); SetStoredState();
m_nPedState = PED_SNIPER_MODE; m_nPedState = PED_SNIPER_MODE;
@ -1261,7 +1263,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
#else #else
CVector markPos; CVector markPos;
if (m_pPointGunAt->IsPed()) { 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 { } else {
markPos = m_pPointGunAt->GetPosition(); markPos = m_pPointGunAt->GetPosition();
} }
@ -1514,7 +1516,7 @@ CPlayerPed::ProcessControl(void)
} }
break; break;
case PED_SNIPER_MODE: case PED_SNIPER_MODE:
if (FindPlayerPed()->GetWeapon()->m_eWeaponType == WEAPONTYPE_M16) { if (FindPlayerPed()->GetWeapon()->m_eWeaponType == WEAPONTYPE_M4) {
if (padUsed) if (padUsed)
PlayerControlM16(padUsed); PlayerControlM16(padUsed);
} else if (padUsed) { } else if (padUsed) {

View file

@ -172,9 +172,8 @@ void CHud::Draw()
if (playerPed) { if (playerPed) {
if (playerPed->m_nPedState != PED_ENTER_CAR && playerPed->m_nPedState != PED_CARJACK) { if (playerPed->m_nPedState != PED_ENTER_CAR && playerPed->m_nPedState != PED_CARJACK) {
// TODO(Miami): Uncomment if (WeaponType >= WEAPONTYPE_COLT45 && WeaponType <= WEAPONTYPE_RUGER
if (WeaponType >= WEAPONTYPE_COLT45 && WeaponType <= WEAPONTYPE_AK47 || WeaponType == WEAPONTYPE_M60 || WeaponType == WEAPONTYPE_MINIGUN
/*|| WeaponType == WEAPONTYPE_M60 || || WeaponType == WEAPONTYPE_MINIGUN */
|| WeaponType == WEAPONTYPE_FLAMETHROWER) { || WeaponType == WEAPONTYPE_FLAMETHROWER) {
DrawCrossHairPC = 1; DrawCrossHairPC = 1;
} }
@ -198,8 +197,7 @@ void CHud::Draw()
#ifdef ASPECT_RATIO_SCALE #ifdef ASPECT_RATIO_SCALE
f3rdY -= SCREEN_SCALE_Y(2.0f); f3rdY -= SCREEN_SCALE_Y(2.0f);
#endif #endif
// TODO(Miami): M60 if (playerPed && (WeaponType == WEAPONTYPE_M4 || WeaponType == WEAPONTYPE_RUGER || WeaponType == WEAPONTYPE_M60)) {
if (playerPed && (WeaponType == WEAPONTYPE_M16 || WeaponType == WEAPONTYPE_AK47/* || WeaponType == WEAPONTYPE_M60*/)) {
rect.left = f3rdX - SCREEN_SCALE_X(32.0f * 0.6f); rect.left = f3rdX - SCREEN_SCALE_X(32.0f * 0.6f);
rect.top = f3rdY - SCREEN_SCALE_Y(32.0f * 0.6f); rect.top = f3rdY - SCREEN_SCALE_Y(32.0f * 0.6f);
rect.right = f3rdX + SCREEN_SCALE_X(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; MONEY_COLOR.a = alpha;
CFont::SetColor(MONEY_COLOR); CFont::SetColor(MONEY_COLOR);
// TODO(Miami): m_nHudMode if (FrontEndMenuManager.m_PrefsShowHud) {
//if (CMenuManager.m_nHudMode)
{
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(43.0f), sPrint); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(43.0f), sPrint);
} }
} }
@ -505,20 +501,21 @@ void CHud::Draw()
AsciiToUnicode("]", sPrintIcon); AsciiToUnicode("]", sPrintIcon);
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
if (playerPed->m_pWanted->m_nWantedLevel > i if (FrontEndMenuManager.m_PrefsShowHud) {
&& (CTimer::GetTimeInMilliseconds() > playerPed->m_pWanted->m_nLastWantedLevelChange if (playerPed->m_pWanted->m_nWantedLevel > i
+ 2000 || CTimer::GetFrameCounter() & 4)) { && (CTimer::GetTimeInMilliseconds() > playerPed->m_pWanted->m_nLastWantedLevelChange
+ 2000 || CTimer::GetFrameCounter() & 4)) {
WANTED_COLOR.a = alpha; WANTED_COLOR.a = alpha;
CFont::SetColor(WANTED_COLOR); CFont::SetColor(WANTED_COLOR);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f + 23.0f * i), SCREEN_SCALE_Y(87.0f), sPrintIcon); 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 // TODO(Miami): There is one more condition in here
} } else if (playerPed->m_pWanted->m_nWantedLevel <= i) {
else if (playerPed->m_pWanted->m_nWantedLevel <= i) { NOTWANTED_COLOR.a = alpha;
NOTWANTED_COLOR.a = alpha; CFont::SetColor(NOTWANTED_COLOR);
CFont::SetColor(NOTWANTED_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f + 23.0f * i), SCREEN_SCALE_Y(87.0f), sPrintIcon);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f + 23.0f * i), SCREEN_SCALE_Y(87.0f), sPrintIcon); }
} }
} }

View file

@ -623,8 +623,10 @@ CVehicle::InflictDamage(CEntity* damagedBy, eWeaponType weaponType, float damage
case WEAPONTYPE_SILENCED_INGRAM: case WEAPONTYPE_SILENCED_INGRAM:
case WEAPONTYPE_MP5: case WEAPONTYPE_MP5:
case WEAPONTYPE_SHOTGUN: case WEAPONTYPE_SHOTGUN:
case WEAPONTYPE_AK47: case WEAPONTYPE_SPAS12_SHOTGUN:
case WEAPONTYPE_M16: case WEAPONTYPE_STUBBY_SHOTGUN:
case WEAPONTYPE_RUGER:
case WEAPONTYPE_M4:
case WEAPONTYPE_SNIPERRIFLE: case WEAPONTYPE_SNIPERRIFLE:
case WEAPONTYPE_HELICANNON: case WEAPONTYPE_HELICANNON:
case WEAPONTYPE_UZI_DRIVEBY: case WEAPONTYPE_UZI_DRIVEBY:

View file

@ -29,11 +29,13 @@
#include "WaterLevel.h" #include "WaterLevel.h"
#include "WeaponInfo.h" #include "WeaponInfo.h"
#include "World.h" #include "World.h"
#include "SurfaceTable.h"
// TODO(Miami) // TODO(Miami)
#define AUDIO_NOT_READY #define AUDIO_NOT_READY
uint16 gReloadSampleTime[WEAPONTYPE_LAST_WEAPONTYPE] = // TODO(Miami): Those are mostly placeholders!!!
uint16 gReloadSampleTime[] =
{ {
0, // UNARMED 0, // UNARMED
0, 0,
@ -49,10 +51,14 @@ uint16 gReloadSampleTime[WEAPONTYPE_LAST_WEAPONTYPE] =
0, 0,
0, // GRENADE 0, // GRENADE
0, // DETONATEGRENADE 0, // DETONATEGRENADE
0, // TEARGAS
0, // MOLOTOV 0, // MOLOTOV
0, // ROCKET 0, // ROCKET
250, // COLT45 250, // COLT45
250, // PYTHON
650, // SHOTGUN 650, // SHOTGUN
650, // SPAS12 SHOTGUN
650, // STUBBY SHOTGUN
400, // TEC9 400, // TEC9
400, // UZIhec 400, // UZIhec
400, // SILENCED_INGRAM 400, // SILENCED_INGRAM
@ -60,10 +66,14 @@ uint16 gReloadSampleTime[WEAPONTYPE_LAST_WEAPONTYPE] =
300, // M16 300, // M16
300, // AK47 300, // AK47
423, // SNIPERRIFLE 423, // SNIPERRIFLE
423, // LASERSCOPE
400, // ROCKETLAUNCHER 400, // ROCKETLAUNCHER
0, // FLAMETHROWER 0, // FLAMETHROWER
0, // M60
0, // MINIGUN
0, // DETONATOR 0, // DETONATOR
0 // HELICANNON 0, // HELICANNON
0 // CAMERA
}; };
CWeaponInfo * CWeaponInfo *
@ -176,6 +186,8 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource)
switch ( m_eWeaponType ) switch ( m_eWeaponType )
{ {
case WEAPONTYPE_SHOTGUN: case WEAPONTYPE_SHOTGUN:
case WEAPONTYPE_SPAS12_SHOTGUN:
case WEAPONTYPE_STUBBY_SHOTGUN:
{ {
addFireRateAsDelay = true; addFireRateAsDelay = true;
fired = FireShotgun(shooter, source); fired = FireShotgun(shooter, source);
@ -184,12 +196,15 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource)
} }
case WEAPONTYPE_COLT45: case WEAPONTYPE_COLT45:
case WEAPONTYPE_PYTHON:
case WEAPONTYPE_UZI: case WEAPONTYPE_UZI:
case WEAPONTYPE_TEC9: case WEAPONTYPE_TEC9:
case WEAPONTYPE_SILENCED_INGRAM: case WEAPONTYPE_SILENCED_INGRAM:
case WEAPONTYPE_MP5: case WEAPONTYPE_MP5:
case WEAPONTYPE_AK47: case WEAPONTYPE_M4:
case WEAPONTYPE_M16: case WEAPONTYPE_RUGER:
case WEAPONTYPE_M60:
case WEAPONTYPE_MINIGUN:
case WEAPONTYPE_HELICANNON: case WEAPONTYPE_HELICANNON:
{ {
if ((TheCamera.PlayerWeaponMode.Mode == CCam::MODE_HELICANNON_1STPERSON || TheCamera.PlayerWeaponMode.Mode == CCam::MODE_M16_1STPERSON) 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_SNIPERRIFLE:
case WEAPONTYPE_LASERSCOPE:
{ {
fired = FireSniper(shooter); fired = FireSniper(shooter);
@ -230,6 +246,7 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource)
case WEAPONTYPE_MOLOTOV: case WEAPONTYPE_MOLOTOV:
case WEAPONTYPE_GRENADE: case WEAPONTYPE_GRENADE:
case WEAPONTYPE_DETONATOR_GRENADE: case WEAPONTYPE_DETONATOR_GRENADE:
case WEAPONTYPE_TEARGAS:
{ {
if ( shooter == FindPlayerPed() ) if ( shooter == FindPlayerPed() )
{ {
@ -800,7 +817,7 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
CPed *threatAttack = (CPed*)shooterPed->m_pPointGunAt; CPed *threatAttack = (CPed*)shooterPed->m_pPointGunAt;
if ( threatAttack->IsPed() ) if ( threatAttack->IsPed() )
{ {
threatAttack->m_pedIK.GetComponentPosition(target, PED_MID); threatAttack->m_pedIK.GetComponentPosition((RwV3d)target, PED_MID);
threatAttack->ReactToPointGun(shooter); threatAttack->ReactToPointGun(shooter);
} }
else else
@ -842,7 +859,7 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
CWorld::bIncludeDeadPeds = false; CWorld::bIncludeDeadPeds = false;
int32 rotSpeed = 1; int32 rotSpeed = 1;
if ( m_eWeaponType == WEAPONTYPE_M16 ) if ( m_eWeaponType == WEAPONTYPE_M4 )
rotSpeed = 4; rotSpeed = 4;
CVector bulletPos; 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); ProcessLineOfSight(*fireSource, target, point, victim, m_eWeaponType, shooter, true, true, true, true, true, true, false);
int32 rotSpeed = 1; int32 rotSpeed = 1;
if ( m_eWeaponType == WEAPONTYPE_M16 ) if ( m_eWeaponType == WEAPONTYPE_M4 )
rotSpeed = 4; rotSpeed = 4;
CVector bulletPos; CVector bulletPos;
@ -895,10 +912,10 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
switch ( m_eWeaponType ) switch ( m_eWeaponType )
{ {
case WEAPONTYPE_M16: case WEAPONTYPE_M4:
case WEAPONTYPE_AK47: case WEAPONTYPE_RUGER:
// case WEAPONTYPE_M60: case WEAPONTYPE_M60:
// case WEAPONTYPE_MINIGUN: case WEAPONTYPE_MINIGUN:
case WEAPONTYPE_HELICANNON: case WEAPONTYPE_HELICANNON:
{ {
static uint8 counter = 0; static uint8 counter = 0;
@ -1011,6 +1028,9 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
} }
case WEAPONTYPE_COLT45: case WEAPONTYPE_COLT45:
case WEAPONTYPE_PYTHON:
case WEAPONTYPE_SNIPERRIFLE:
case WEAPONTYPE_LASERSCOPE:
{ {
CPointLights::AddLight(CPointLights::LIGHT_POINT, CPointLights::AddLight(CPointLights::LIGHT_POINT,
*fireSource, CVector(0.0f, 0.0f, 0.0f), 5.0f, *fireSource, CVector(0.0f, 0.0f, 0.0f), 5.0f,
@ -1124,7 +1144,8 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
} }
else 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(); posOffset.Normalise();
victimPed->bIsStanding = false; victimPed->bIsStanding = false;
@ -1149,7 +1170,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
asoc->blendAmount = 0.0f; asoc->blendAmount = 0.0f;
asoc->blendDelta = 8.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; victimPlayer->m_nHitAnimDelayTimer = CTimer::GetTimeInMilliseconds() + 2500;
else else
victimPlayer->m_nHitAnimDelayTimer = CTimer::GetTimeInMilliseconds() + 1000; victimPlayer->m_nHitAnimDelayTimer = CTimer::GetTimeInMilliseconds() + 1000;
@ -1178,7 +1199,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
if ( CGame::nastyGame ) if ( CGame::nastyGame )
{ {
uint8 bloodAmount = 8; uint8 bloodAmount = 8;
if ( m_eWeaponType == WEAPONTYPE_SHOTGUN || m_eWeaponType == WEAPONTYPE_HELICANNON ) if ( IsShotgun(m_eWeaponType) || m_eWeaponType == WEAPONTYPE_HELICANNON )
bloodAmount = 32; bloodAmount = 32;
CVector dir = (point->point - victim->GetPosition()) * 0.01f; CVector dir = (point->point - victim->GetPosition()) * 0.01f;
@ -1394,10 +1415,35 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
else else
shooterAngle = RADTODEG(shooter->GetForward().Heading()); 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)); CVector2D shootRot(-Sin(shootAngle), Cos(shootAngle));
CVector source, target; CVector source, target;
@ -1409,12 +1455,17 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
TheCamera.Find3rdPersonCamTargetVector(1.0f, *fireSource, source, target); TheCamera.Find3rdPersonCamTargetVector(1.0f, *fireSource, source, target);
CVector Left = CrossProduct(TheCamera.Cams[TheCamera.ActiveCam].Front, TheCamera.Cams[TheCamera.ActiveCam].Up); 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 = f * Left + target - source;
target *= info->m_fRange; target *= info->m_fRange;
target += source; 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 else
{ {
@ -1430,24 +1481,84 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
DoDoomAiming(shooter, fireSource, &target); DoDoomAiming(shooter, fireSource, &target);
else else
{ {
float distToTarget = (shooterPed->m_pPointGunAt->GetPosition() - (*fireSource)).Magnitude2D(); CVector pos;
target.z += info->m_fRange / distToTarget * (shooterPed->m_pPointGunAt->GetPosition().z - target.z); 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 ) if ( victim )
{ {
CGlass::WasGlassHitByBullet(victim, point.point); 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); CBulletTraces::AddTrace(fireSource, &point.point);
if ( victim->IsPed() ) if ( victim->IsPed() )
{ {
CPed *victimPed = (CPed *)victim; CPed *victimPed = (CPed *)victim;
if ( !victimPed->OnGround() && victim != shooter && victimPed->DoesLOSBulletHitPed(point) ) if ( !victimPed->DyingOrDead() && victim != shooter )
{ {
bool cantStandup = true; bool cantStandup = true;
@ -1460,7 +1571,8 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
posOffset.Normalise(); posOffset.Normalise();
if ( victimPed->m_getUpTimer > (CTimer::GetTimeInMilliseconds() - 3000) ) if ( victimPed->m_getUpTimer > (CTimer::GetTimeInMilliseconds() - 3000) ||
!victimPed->bCanBeShotInVehicle)
cantStandup = false; cantStandup = false;
if ( victimPed->bIsStanding && cantStandup ) if ( victimPed->bIsStanding && cantStandup )
@ -1485,7 +1597,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
if ( CGame::nastyGame ) if ( CGame::nastyGame )
{ {
uint8 bloodAmount = 8; 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; bloodAmount = 32;
CVector dir = (point.point - victim->GetPosition()) * 0.01f; 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); 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 else
@ -1505,21 +1647,29 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
{ {
case ENTITY_TYPE_VEHICLE: 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++ ) for (int32 i = 0; i < 4; i++)
CParticle::AddParticle(PARTICLE_SPARK, point.point, point.normal*0.05f); 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 #ifndef FIX_BUGS
CVector dist = point.point - (*fireSource); CVector dist = point.point - (*fireSource);
CVector offset = dist - Max(0.2f*dist.Magnitude(), 2.0f) * CVector(shootRot.x, shootRot.y, 0.0f); CVector offset = dist - Max(0.2f * dist.Magnitude(), 2.0f) * CVector(shootRot.x, shootRot.y, 0.0f);
CVector smokePos = *fireSource + offset; CVector smokePos = *fireSource + offset;
#else #else
CVector smokePos = point.point; CVector smokePos = point.point;
#endif #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; break;
} }
@ -1549,13 +1699,15 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
if ( !victimObject->bInfiniteMass ) 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->bIsStatic = false;
victimObject->AddToMovingList(); victimObject->AddToMovingList();
} }
if ( !victimObject->IsStatic()) notStatic = !victimObject->IsStatic();
if ( !notStatic )
{ {
CVector moveForce = point.normal*-5.0f; CVector moveForce = point.normal*-5.0f;
victimObject->ApplyMoveForce(moveForce.x, moveForce.y, moveForce.z); victimObject->ApplyMoveForce(moveForce.x, moveForce.y, moveForce.z);
@ -1578,17 +1730,29 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
} }
case ENTITY_TYPE_VEHICLE: 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); DMAudio.PlayOneShot(((CPhysical*)victim)->m_audioEntityId, SOUND_WEAPON_HIT_VEHICLE, 1.0f);
break; break;
} }
case ENTITY_TYPE_PED: 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); DMAudio.PlayOneShot(((CPhysical*)victim)->m_audioEntityId, SOUND_WEAPON_HIT_PED, 1.0f);
((CPed*)victim)->Say(SOUND_PED_BULLET_HIT); ((CPed*)victim)->Say(SOUND_PED_BULLET_HIT);
break; break;
} }
case ENTITY_TYPE_OBJECT: case ENTITY_TYPE_OBJECT:
{ {
if (!statUpdated) {
//CStats::NumBulletsHit++; // TODO(Miami): Stats
statUpdated = true;
}
PlayOneShotScriptObject(SCRIPT_SOUND_BULLET_HIT_GROUND_2, point.point); PlayOneShotScriptObject(SCRIPT_SOUND_BULLET_HIT_GROUND_2, point.point);
break; break;
} }
@ -1837,8 +2001,7 @@ CWeapon::FireM16_1stPerson(CEntity *shooter)
CVector bulletPos; 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++ ) for ( int32 i = 0; i < 16; i++ )
CParticle::AddParticle(PARTICLE_SPARK, bulletPos, CVector(0.0f, 0.0f, 0.0f)); 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); CPad::GetPad(0)->StartShake_Distance(240, 128, FindPlayerPed()->GetPosition().x, FindPlayerPed()->GetPosition().y, FindPlayerPed()->GetPosition().z);
// TODO(Miami)
float mult; float mult;
switch (m_eWeaponType) { switch (m_eWeaponType) {
case WEAPONTYPE_M16: // case WEAPONTYPE_M4: case WEAPONTYPE_M4:
case WEAPONTYPE_HELICANNON: case WEAPONTYPE_HELICANNON:
// case WEAPONTYPE_M60: case WEAPONTYPE_M60:
mult = 0.0003f; mult = 0.0003f;
break; break;
case WEAPONTYPE_AK47: // case WEAPONTYPE_RUGER: case WEAPONTYPE_RUGER:
mult = 0.00015f; mult = 0.00015f;
break; break;
default: default:
@ -2260,9 +2422,9 @@ CWeapon::Update(int32 audioEntity, CPed *pedToAdjustSound)
case WEAPONSTATE_FIRING: 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 ) if ( CTimer::GetPreviousTimeInMilliseconds() < timePassed && CTimer::GetTimeInMilliseconds() >= timePassed )
DMAudio.PlayOneShot(audioEntity, SOUND_WEAPON_RELOAD, 0.0f); DMAudio.PlayOneShot(audioEntity, SOUND_WEAPON_RELOAD, 0.0f);
} }
@ -2280,7 +2442,7 @@ CWeapon::Update(int32 audioEntity, CPed *pedToAdjustSound)
case WEAPONSTATE_RELOADING: 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; CAnimBlendAssociation *reloadAssoc = nil;
if (pedToAdjustSound) { if (pedToAdjustSound) {
@ -2461,11 +2623,9 @@ CWeapon::IsTypeMelee(void)
bool bool
CWeapon::IsType2Handed(void) CWeapon::IsType2Handed(void)
{ {
// TODO(Miami): Uncomment return m_eWeaponType == WEAPONTYPE_FLAMETHROWER || m_eWeaponType == WEAPONTYPE_HELICANNON || m_eWeaponType == WEAPONTYPE_M60 ||
return m_eWeaponType == WEAPONTYPE_FLAMETHROWER || m_eWeaponType == WEAPONTYPE_HELICANNON || /* m_eWeaponType == WEAPONTYPE_M60 */ m_eWeaponType == WEAPONTYPE_M4 || IsShotgun(m_eWeaponType) ||
m_eWeaponType == WEAPONTYPE_M16 || m_eWeaponType == WEAPONTYPE_RUGER || m_eWeaponType == WEAPONTYPE_SNIPERRIFLE || m_eWeaponType == WEAPONTYPE_LASERSCOPE;
(m_eWeaponType >= WEAPONTYPE_SHOTGUN && m_eWeaponType < WEAPONTYPE_TEC9) || // Shotguns
m_eWeaponType == WEAPONTYPE_AK47 || m_eWeaponType == WEAPONTYPE_SNIPERRIFLE /*|| m_eWeaponType == WEAPONTYPE_LASERSCOPE*/;
} }
void void

View file

@ -68,6 +68,8 @@ public:
static void BlowUpExplosiveThings(CEntity *thing); static void BlowUpExplosiveThings(CEntity *thing);
bool HasWeaponAmmoToBeUsed(void); 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); 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 #ifdef COMPATIBLE_SAVES

View file

@ -12,6 +12,7 @@
// Yeah... // Yeah...
int32 CWeaponInfo::ms_aMaxAmmoForWeapon[WEAPONTYPE_TOTALWEAPONS] = { 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, -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]; CWeaponInfo CWeaponInfo::ms_apWeaponInfos[WEAPONTYPE_TOTALWEAPONS];
@ -32,21 +33,29 @@ static char ms_aWeaponNames[][32] = {
"Chainsaw", "Chainsaw",
"Grenade", "Grenade",
"DetonateGrenade", "DetonateGrenade",
"TearGas",
"Molotov", "Molotov",
"Rocket", "Rocket",
"Colt45", "Colt45",
"Python",
"Shotgun", "Shotgun",
"Spas12Shotgun",
"StubbyShotgun",
"Tec9", "Tec9",
"Uzi", "Uzi",
"SilencedIngram", "SilencedIngram",
"Mp5", "Mp5",
"M16", "m4",
"AK47", "Ruger",
"SniperRifle", "SniperRifle",
"LaserScope",
"RocketLauncher", "RocketLauncher",
"FlameThrower", "FlameThrower",
"M60",
"Minigun",
"Detonator", "Detonator",
"HeliCannon", "HeliCannon",
"Camera",
}; };
CWeaponInfo* CWeaponInfo*
@ -223,9 +232,7 @@ CWeaponInfo::LoadWeaponData(void)
ms_apWeaponInfos[weaponType].m_nWeaponSlot = weaponSlot; ms_apWeaponInfos[weaponType].m_nWeaponSlot = weaponSlot;
// TODO(Miami): Enable once weapons are done if (animLoopEnd < 98.0f && weaponType != WEAPONTYPE_FLAMETHROWER && !CWeapon::IsShotgun(weaponType))
if (animLoopEnd < 98.0f && weaponType != WEAPONTYPE_FLAMETHROWER && weaponType != WEAPONTYPE_SHOTGUN
/*&& weaponType != 20 && weaponType != 21*/)
ms_apWeaponInfos[weaponType].m_nFiringRate = ((ms_apWeaponInfos[weaponType].m_fAnimLoopEnd - ms_apWeaponInfos[weaponType].m_fAnimLoopStart) * 900.0f); ms_apWeaponInfos[weaponType].m_nFiringRate = ((ms_apWeaponInfos[weaponType].m_fAnimLoopEnd - ms_apWeaponInfos[weaponType].m_fAnimLoopStart) * 900.0f);
if (weaponType == WEAPONTYPE_DETONATOR || weaponType == WEAPONTYPE_HELICANNON) 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, "INSTANT_HIT") == 0) return WEAPON_FIRE_INSTANT_HIT;
if (strcmp(name, "PROJECTILE") == 0) return WEAPON_FIRE_PROJECTILE; if (strcmp(name, "PROJECTILE") == 0) return WEAPON_FIRE_PROJECTILE;
if (strcmp(name, "AREA_EFFECT") == 0) return WEAPON_FIRE_AREA_EFFECT; 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"); Error("Unknown weapon fire type, WeaponInfo.cpp");
return WEAPON_FIRE_INSTANT_HIT; return WEAPON_FIRE_INSTANT_HIT;
} }

View file

@ -1,6 +1,5 @@
#pragma once #pragma once
// --MIAMI: TODO
enum eWeaponType enum eWeaponType
{ {
WEAPONTYPE_UNARMED, WEAPONTYPE_UNARMED,
@ -17,23 +16,31 @@ enum eWeaponType
WEAPONTYPE_CHAINSAW, WEAPONTYPE_CHAINSAW,
WEAPONTYPE_GRENADE, WEAPONTYPE_GRENADE,
WEAPONTYPE_DETONATOR_GRENADE, WEAPONTYPE_DETONATOR_GRENADE,
WEAPONTYPE_TEARGAS,
WEAPONTYPE_MOLOTOV, WEAPONTYPE_MOLOTOV,
WEAPONTYPE_ROCKET, WEAPONTYPE_ROCKET,
WEAPONTYPE_COLT45, WEAPONTYPE_COLT45,
WEAPONTYPE_PYTHON,
WEAPONTYPE_SHOTGUN, WEAPONTYPE_SHOTGUN,
WEAPONTYPE_SPAS12_SHOTGUN,
WEAPONTYPE_STUBBY_SHOTGUN,
WEAPONTYPE_TEC9, WEAPONTYPE_TEC9,
WEAPONTYPE_UZI, WEAPONTYPE_UZI,
WEAPONTYPE_SILENCED_INGRAM, WEAPONTYPE_SILENCED_INGRAM,
WEAPONTYPE_MP5, WEAPONTYPE_MP5,
WEAPONTYPE_M16, WEAPONTYPE_M4,
WEAPONTYPE_AK47, WEAPONTYPE_RUGER,
WEAPONTYPE_SNIPERRIFLE, WEAPONTYPE_SNIPERRIFLE,
WEAPONTYPE_LASERSCOPE,
WEAPONTYPE_ROCKETLAUNCHER, WEAPONTYPE_ROCKETLAUNCHER,
WEAPONTYPE_FLAMETHROWER, WEAPONTYPE_FLAMETHROWER,
WEAPONTYPE_M60,
WEAPONTYPE_MINIGUN,
WEAPONTYPE_DETONATOR, WEAPONTYPE_DETONATOR,
WEAPONTYPE_HELICANNON, WEAPONTYPE_HELICANNON,
WEAPONTYPE_LAST_WEAPONTYPE, WEAPONTYPE_CAMERA,
WEAPONTYPE_HEALTH, WEAPONTYPE_TOTALWEAPONS = 37,
WEAPONTYPE_HEALTH = 37,
WEAPONTYPE_ARMOUR, WEAPONTYPE_ARMOUR,
WEAPONTYPE_RAMMEDBYCAR, WEAPONTYPE_RAMMEDBYCAR,
WEAPONTYPE_RUNOVERBYCAR, WEAPONTYPE_RUNOVERBYCAR,
@ -42,10 +49,8 @@ enum eWeaponType
WEAPONTYPE_DROWNING, WEAPONTYPE_DROWNING,
WEAPONTYPE_FALL, WEAPONTYPE_FALL,
WEAPONTYPE_UNIDENTIFIED, WEAPONTYPE_UNIDENTIFIED,
WEAPONTYPE_ANYMELEE,
WEAPONTYPE_TOTALWEAPONS = WEAPONTYPE_LAST_WEAPONTYPE, WEAPONTYPE_ANYWEAPON
WEAPONTYPE_ANYMELEE = 46,
WEAPONTYPE_ANYWEAPON = 47
}; };
enum { enum {
@ -57,7 +62,7 @@ enum eWeaponFire {
WEAPON_FIRE_INSTANT_HIT, WEAPON_FIRE_INSTANT_HIT,
WEAPON_FIRE_PROJECTILE, WEAPON_FIRE_PROJECTILE,
WEAPON_FIRE_AREA_EFFECT, WEAPON_FIRE_AREA_EFFECT,
WEAPON_FIRE_USE WEAPON_FIRE_CAMERA
}; };
// Taken from MTA SA, seems it's unchanged // Taken from MTA SA, seems it's unchanged