1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 12:50:00 +00:00

Some TODOs done in Peds code

This commit is contained in:
Sergeanur 2020-11-25 19:39:57 +02:00
parent 8f5e60f787
commit 164f16c85b
4 changed files with 20 additions and 17 deletions

View file

@ -140,18 +140,12 @@ ModifyStringLabelForControlSetting(char *str)
} }
} }
inline bool
IsWeaponSlotAmmoMergeable(uint32 slot)
{
return slot == WEAPONSLOT_SHOTGUN || slot == WEAPONSLOT_SUBMACHINEGUN || slot == WEAPONSLOT_RIFLE;
}
void void
CPickup::ExtractAmmoFromPickup(CPlayerPed *player) CPickup::ExtractAmmoFromPickup(CPlayerPed *player)
{ {
eWeaponType weaponType = CPickups::WeaponForModel(m_pObject->GetModelIndex()); eWeaponType weaponType = CPickups::WeaponForModel(m_pObject->GetModelIndex());
if (m_eType == PICKUP_IN_SHOP || !IsWeaponSlotAmmoMergeable(CWeaponInfo::GetWeaponInfo(weaponType)->m_nWeaponSlot)) if (m_eType == PICKUP_IN_SHOP || !CWeaponInfo::IsWeaponSlotAmmoMergeable(CWeaponInfo::GetWeaponInfo(weaponType)->m_nWeaponSlot))
return; return;
uint32 ammo = m_nQuantity; uint32 ammo = m_nQuantity;
@ -374,14 +368,14 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
eWeaponType plrWeaponSlot = FindPlayerPed()->GetWeapon(slot).m_eWeaponType; eWeaponType plrWeaponSlot = FindPlayerPed()->GetWeapon(slot).m_eWeaponType;
if (plrWeaponSlot != weaponType) { if (plrWeaponSlot != weaponType) {
if (CStreaming::ms_aInfoForModel[m_pObject->GetModelIndex()].m_loadState == STREAMSTATE_LOADED) { if (CStreaming::ms_aInfoForModel[m_pObject->GetModelIndex()].m_loadState == STREAMSTATE_LOADED) {
if (plrWeaponSlot == WEAPONTYPE_UNARMED || (FindPlayerPed()->GetWeapon(slot).m_nAmmoTotal == 0 && !IsWeaponSlotAmmoMergeable(slot))) { if (plrWeaponSlot == WEAPONTYPE_UNARMED || (FindPlayerPed()->GetWeapon(slot).m_nAmmoTotal == 0 && !CWeaponInfo::IsWeaponSlotAmmoMergeable(slot))) {
if (CTimer::GetTimeInMilliseconds() - FindPlayerPed()->m_nPadDownPressedInMilliseconds < 1500) { if (CTimer::GetTimeInMilliseconds() - FindPlayerPed()->m_nPadDownPressedInMilliseconds < 1500) {
CPickups::PlayerOnWeaponPickup = 6; CPickups::PlayerOnWeaponPickup = 6;
isPickupTouched = false; isPickupTouched = false;
} }
} else { } else {
CPickups::PlayerOnWeaponPickup = 6; CPickups::PlayerOnWeaponPickup = 6;
if (IsWeaponSlotAmmoMergeable(slot)) { if (CWeaponInfo::IsWeaponSlotAmmoMergeable(slot)) {
if (m_eType == PICKUP_ONCE_TIMEOUT || m_eType == PICKUP_ONCE || m_eType == PICKUP_ON_STREET) { if (m_eType == PICKUP_ONCE_TIMEOUT || m_eType == PICKUP_ONCE || m_eType == PICKUP_ON_STREET) {
ExtractAmmoFromPickup(player); ExtractAmmoFromPickup(player);
FindPlayerPed()->GetWeapon(slot).Reload(); FindPlayerPed()->GetWeapon(slot).Reload();
@ -1384,7 +1378,7 @@ void
CPickups::RemoveAllPickupsOfACertainWeaponGroupWithNoAmmo(eWeaponType weaponType) CPickups::RemoveAllPickupsOfACertainWeaponGroupWithNoAmmo(eWeaponType weaponType)
{ {
uint32 weaponSlot = CWeaponInfo::GetWeaponInfo(weaponType)->m_nWeaponSlot; uint32 weaponSlot = CWeaponInfo::GetWeaponInfo(weaponType)->m_nWeaponSlot;
if (IsWeaponSlotAmmoMergeable(weaponSlot)) { if (CWeaponInfo::IsWeaponSlotAmmoMergeable(weaponSlot)) {
for (int slot = 0; slot < NUMPICKUPS; slot++) { for (int slot = 0; slot < NUMPICKUPS; slot++) {
if (aPickUps[slot].m_eType == PICKUP_ONCE || aPickUps[slot].m_eType == PICKUP_ONCE_TIMEOUT || aPickUps[slot].m_eType == PICKUP_ONCE_TIMEOUT_SLOW) { if (aPickUps[slot].m_eType == PICKUP_ONCE || aPickUps[slot].m_eType == PICKUP_ONCE_TIMEOUT || aPickUps[slot].m_eType == PICKUP_ONCE_TIMEOUT_SLOW) {
if (aPickUps[slot].m_pObject) { if (aPickUps[slot].m_pObject) {

View file

@ -4712,9 +4712,7 @@ CPed::GiveWeapon(eWeaponType weaponType, uint32 ammo, bool unused)
GetWeapon(slot).m_eWeaponState = WEAPONSTATE_READY; GetWeapon(slot).m_eWeaponState = WEAPONSTATE_READY;
} else { } else {
if (HasWeaponSlot(slot)) { if (HasWeaponSlot(slot)) {
if (CWeaponInfo::IsWeaponSlotAmmoMergeable(slot))
// TODO(Miami): Make an enum for that
if (slot == 4 || slot == 5 || slot == 6)
ammo += GetWeapon(slot).m_nAmmoTotal; ammo += GetWeapon(slot).m_nAmmoTotal;
RemoveWeaponModel(CWeaponInfo::GetWeaponInfo(GetWeapon(slot).m_eWeaponType)->m_nModelId); RemoveWeaponModel(CWeaponInfo::GetWeaponInfo(GetWeapon(slot).m_eWeaponType)->m_nModelId);

View file

@ -24,6 +24,7 @@
#include "World.h" #include "World.h"
#include "Bike.h" #include "Bike.h"
#include "Glass.h" #include "Glass.h"
#include "SpecialFX.h"
//--MIAMI: file done except TODOs //--MIAMI: file done except TODOs
@ -952,7 +953,18 @@ CPed::Attack(void)
} }
} }
// TODO(Miami): CSpecialFX::AddWeaponStreak if (IsPlayer()) {
eWeaponType weaponType = GetWeapon()->m_eWeaponType;
if (weaponType == WEAPONTYPE_BASEBALLBAT || weaponType == WEAPONTYPE_GOLFCLUB || weaponType == WEAPONTYPE_KATANA) {
float loopEndWithDelay = animLoopEnd;
if (loopEndWithDelay >= 98.0f)
loopEndWithDelay = (14.0f / 30.0f) + delayBetweenAnimAndFire;
if (weaponAnimAssoc->flags & ASSOC_RUNNING) {
if (weaponAnimAssoc->currentTime >= animLoopStart && weaponAnimAssoc->currentTime <= loopEndWithDelay)
CSpecialFX::AddWeaponStreak(weaponType);
}
}
}
// Anim breakout on running // Anim breakout on running
if (IsPlayer()) { if (IsPlayer()) {
@ -1447,9 +1459,7 @@ CPed::Fight(void)
if (tFightMoves[m_curFightMove].startFireTime - streakDelay < currentAssoc->currentTime && if (tFightMoves[m_curFightMove].startFireTime - streakDelay < currentAssoc->currentTime &&
streakDelay + tFightMoves[m_curFightMove].endFireTime > currentAssoc->currentTime) { streakDelay + tFightMoves[m_curFightMove].endFireTime > currentAssoc->currentTime) {
CSpecialFX::AddWeaponStreak(GetWeapon()->m_eWeaponType);
// TODO(Miami): AddWeaponStreak
// CSpecialFX::AddWeaponStreak(v2->m_weapons[(char)v2->m_currentWeapon].nWeaponId);
} }
} }
} }

View file

@ -68,6 +68,7 @@ public:
static eWeaponFire FindWeaponFireType(char *name); static eWeaponFire FindWeaponFireType(char *name);
static eWeaponType FindWeaponType(char *name); static eWeaponType FindWeaponType(char *name);
static void Shutdown(void); static void Shutdown(void);
static bool IsWeaponSlotAmmoMergeable(uint32 slot) { return slot == WEAPONSLOT_SHOTGUN || slot == WEAPONSLOT_SUBMACHINEGUN || slot == WEAPONSLOT_RIFLE; }
}; };
VALIDATE_SIZE(CWeaponInfo, 0x64); VALIDATE_SIZE(CWeaponInfo, 0x64);