diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2021-01-07 16:38:40 +0100 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2021-01-07 16:38:40 +0100 |
commit | 5e10f1fe6ae08fe1b6ec2f52f8d097d54c4b8ab3 (patch) | |
tree | 435e3b7d8d0c9b0a8e75bd97a34bbf446c0d9730 /src/peds/PlayerPed.cpp | |
parent | some lcs stuff (diff) | |
parent | fail (diff) | |
download | re3-5e10f1fe6ae08fe1b6ec2f52f8d097d54c4b8ab3.tar re3-5e10f1fe6ae08fe1b6ec2f52f8d097d54c4b8ab3.tar.gz re3-5e10f1fe6ae08fe1b6ec2f52f8d097d54c4b8ab3.tar.bz2 re3-5e10f1fe6ae08fe1b6ec2f52f8d097d54c4b8ab3.tar.lz re3-5e10f1fe6ae08fe1b6ec2f52f8d097d54c4b8ab3.tar.xz re3-5e10f1fe6ae08fe1b6ec2f52f8d097d54c4b8ab3.tar.zst re3-5e10f1fe6ae08fe1b6ec2f52f8d097d54c4b8ab3.zip |
Diffstat (limited to 'src/peds/PlayerPed.cpp')
-rw-r--r-- | src/peds/PlayerPed.cpp | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp index 8220b370..f07d1ac7 100644 --- a/src/peds/PlayerPed.cpp +++ b/src/peds/PlayerPed.cpp @@ -22,10 +22,14 @@ #include "Script.h" #include "Replay.h" #include "PedPlacement.h" +#include "VarConsole.h" #define PAD_MOVE_TO_GAME_WORLD_MOVE 60.0f bool CPlayerPed::bDontAllowWeaponChange; +#ifndef MASTER +bool CPlayerPed::bDebugPlayerInfo; +#endif const uint32 CPlayerPed::nSaveStructSize = #ifdef COMPATIBLE_SAVES @@ -61,7 +65,7 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1) m_pWanted->Initialise(); m_pArrestingCop = nil; m_currentWeapon = WEAPONTYPE_UNARMED; - m_nSelectedWepSlot = 0; + m_nSelectedWepSlot = WEAPONSLOT_UNARMED; m_nSpeedTimer = 0; m_bSpeedTimerFlag = false; SetWeaponLockOnTarget(nil); @@ -182,6 +186,11 @@ CPlayerPed::SetupPlayerPed(int32 index) CWorld::Add(player); player->m_wepAccuracy = 100; + +#ifndef MASTER + VarConsole.Add("Debug PlayerPed", &CPlayerPed::bDebugPlayerInfo, true); + VarConsole.Add("Tweak Vehicle Handling", &CVehicle::m_bDisplayHandlingInfo, true); +#endif } // --MIAMI: Done @@ -300,7 +309,7 @@ CPlayerPed::SetInitialState(void) m_nLastPedState = PED_NONE; m_animGroup = ASSOCGRP_PLAYER; m_fMoveSpeed = 0.0f; - m_nSelectedWepSlot = WEAPONTYPE_UNARMED; + m_nSelectedWepSlot = WEAPONSLOT_UNARMED; m_nEvadeAmount = 0; m_pEvadingFrom = nil; bIsPedDieAnimPlaying = false; @@ -748,17 +757,20 @@ CPlayerPed::ProcessWeaponSwitch(CPad *padUsed) && TheCamera.PlayerWeaponMode.Mode != CCam::MODE_ROCKETLAUNCHER && TheCamera.PlayerWeaponMode.Mode != CCam::MODE_CAMERA) { - for (m_nSelectedWepSlot = m_currentWeapon - 1; ; --m_nSelectedWepSlot) { + // I don't know what kind of loop that was + m_nSelectedWepSlot = m_currentWeapon - 1; + do { if (m_nSelectedWepSlot < 0) m_nSelectedWepSlot = TOTAL_WEAPON_SLOTS - 1; - if (m_nSelectedWepSlot == 0) + if (m_nSelectedWepSlot == WEAPONSLOT_UNARMED) break; - if (HasWeaponSlot(m_nSelectedWepSlot) && GetWeapon(m_nSelectedWepSlot).HasWeaponAmmoToBeUsed()) { + if (HasWeaponSlot(m_nSelectedWepSlot) && GetWeapon(m_nSelectedWepSlot).HasWeaponAmmoToBeUsed()) break; - } - } + + --m_nSelectedWepSlot; + } while (m_nSelectedWepSlot != WEAPONSLOT_UNARMED); } } } @@ -772,17 +784,17 @@ spentAmmoCheck: || TheCamera.PlayerWeaponMode.Mode == CCam::MODE_ROCKETLAUNCHER) return; - if (GetWeapon()->m_eWeaponType != WEAPONTYPE_DETONATOR - || GetWeapon(2).m_eWeaponType != WEAPONTYPE_DETONATOR_GRENADE) - m_nSelectedWepSlot = m_currentWeapon - 1; + if (GetWeapon()->m_eWeaponType == WEAPONTYPE_DETONATOR + && GetWeapon(WEAPONSLOT_PROJECTILE).m_eWeaponType == WEAPONTYPE_DETONATOR_GRENADE) + m_nSelectedWepSlot = WEAPONSLOT_PROJECTILE; else - m_nSelectedWepSlot = 2; + m_nSelectedWepSlot = m_currentWeapon - 1; - for (; m_nSelectedWepSlot >= 0; --m_nSelectedWepSlot) { + for (; m_nSelectedWepSlot >= WEAPONSLOT_UNARMED; --m_nSelectedWepSlot) { // BUG: m_nSelectedWepSlot and GetWeapon(..) takes slot in VC but they compared them against weapon types in whole condition! jeez #ifdef FIX_BUGS - if (m_nSelectedWepSlot == 1 || GetWeapon(m_nSelectedWepSlot).m_nAmmoTotal > 0 && m_nSelectedWepSlot != 2) { + if (m_nSelectedWepSlot == WEAPONSLOT_MELEE || GetWeapon(m_nSelectedWepSlot).m_nAmmoTotal > 0 && m_nSelectedWepSlot != WEAPONSLOT_PROJECTILE) { #else if (m_nSelectedWepSlot == WEAPONTYPE_BASEBALLBAT && GetWeapon(WEAPONTYPE_BASEBALLBAT).m_eWeaponType == WEAPONTYPE_BASEBALLBAT || GetWeapon(m_nSelectedWepSlot).m_nAmmoTotal > 0 @@ -791,15 +803,16 @@ spentAmmoCheck: goto switchDetectDone; } } - m_nSelectedWepSlot = 0; + m_nSelectedWepSlot = WEAPONSLOT_UNARMED; } } switchDetectDone: if (m_nSelectedWepSlot != m_currentWeapon) { - if (m_nPedState != PED_ATTACK && m_nPedState != PED_AIM_GUN && m_nPedState != PED_FIGHT) + if (m_nPedState != PED_ATTACK && m_nPedState != PED_AIM_GUN && m_nPedState != PED_FIGHT) { RemoveWeaponAnims(m_currentWeapon, -1000.0f); MakeChangesForNewWeapon(m_nSelectedWepSlot); + } } } @@ -1775,7 +1788,7 @@ CPlayerPed::ProcessControl(void) if (!RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_BLOCK) && !m_attachedTo) { if (TheCamera.Using1stPersonWeaponMode()) { if (padUsed) - PlayerControlFighter(padUsed); + PlayerControlSniper(padUsed); } else if (TheCamera.Cams[0].Using3rdPersonMouseCam() #ifdef FREE_CAM |