From 14755a4ff4668e2cf2fa580797321141770e3b36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Sun, 24 May 2020 16:41:29 +0300 Subject: [PATCH] all my fixes live in exes --- src/core/main.cpp | 10 ++++++++- src/peds/PlayerPed.cpp | 2 +- src/weapons/Weapon.cpp | 48 ++++++++++++++++++++-------------------- src/weapons/Weapon.h | 4 ++-- src/weapons/WeaponInfo.h | 4 ++-- 5 files changed, 38 insertions(+), 30 deletions(-) diff --git a/src/core/main.cpp b/src/core/main.cpp index acdf6f4e..666758c8 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -137,9 +137,13 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR CRGBA TopColor(TopRed, TopGreen, TopBlue, Alpha); CRGBA BottomColor(BottomRed, BottomGreen, BottomBlue, Alpha); +#ifndef ASPECT_RATIO_SCALE + CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, (CMenuManager::m_PrefsUseWideScreen ? 16.f / 9.f : 4.f / 3.f)); +#else CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO); +#endif CVisibilityPlugins::SetRenderWareCamera(Scene.camera); - RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ); + RwCameraClear(Scene.camera, &TopColor.rwRGBA, rwCAMERACLEARZ); if(!RsCameraBeginUpdate(Scene.camera)) return false; @@ -155,7 +159,11 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR bool DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha) { +#ifndef ASPECT_RATIO_SCALE + CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, (CMenuManager::m_PrefsUseWideScreen ? 16.f/9.f : 4.f/3.f)); +#else CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO); +#endif CVisibilityPlugins::SetRenderWareCamera(Scene.camera); RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ); diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp index 3c6fad57..eb4ac09e 100644 --- a/src/peds/PlayerPed.cpp +++ b/src/peds/PlayerPed.cpp @@ -227,7 +227,7 @@ CPlayerPed::SetInitialState(void) { m_bAdrenalineActive = false; m_nAdrenalineTime = 0; - CTimer::SetTimeStep(1.0f); + CTimer::SetTimeScale(1.0f); m_pSeekTarget = nil; m_vecSeekPos = { 0.0f, 0.0f, 0.0f }; m_fleeFromPosX = 0.0f; diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp index 88c4788c..93481105 100644 --- a/src/weapons/Weapon.cpp +++ b/src/weapons/Weapon.cpp @@ -241,51 +241,51 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource) } } - if ( fired ) + if (fired) { bool isPlayer = false; - if ( shooter->IsPed() ) + if (shooter->IsPed()) { - CPed *shooterPed = (CPed*)shooter; + CPed* shooterPed = (CPed*)shooter; shooterPed->bIsShooting = true; - if ( shooterPed->IsPlayer() ) + if (shooterPed->IsPlayer()) isPlayer = true; DMAudio.PlayOneShot(shooterPed->m_audioEntityId, SOUND_WEAPON_SHOT_FIRED, 0.0f); } - if ( m_nAmmoInClip > 0 ) m_nAmmoInClip--; - if ( m_nAmmoTotal > 0 && (m_nAmmoTotal < 25000 || isPlayer) ) m_nAmmoTotal--; + if (m_nAmmoInClip > 0) m_nAmmoInClip--; + if (m_nAmmoTotal > 0 && (m_nAmmoTotal < 25000 || isPlayer)) m_nAmmoTotal--; - if ( m_eWeaponState == WEAPONSTATE_READY && m_eWeaponType == WEAPONTYPE_FLAMETHROWER ) + if (m_eWeaponState == WEAPONSTATE_READY && m_eWeaponType == WEAPONTYPE_FLAMETHROWER) DMAudio.PlayOneShot(((CPhysical*)shooter)->m_audioEntityId, SOUND_WEAPON_FLAMETHROWER_FIRE, 0.0f); m_eWeaponState = WEAPONSTATE_FIRING; - } - if ( m_nAmmoInClip == 0 ) - { - if ( m_nAmmoTotal == 0 ) - return true; - - m_eWeaponState = WEAPONSTATE_RELOADING; - m_nTimer = CTimer::GetTimeInMilliseconds() + GetInfo()->m_nReload; - - if ( shooter == FindPlayerPed() ) + if (m_nAmmoInClip == 0) { - if ( CWorld::Players[CWorld::PlayerInFocus].m_bFastReload ) - m_nTimer = CTimer::GetTimeInMilliseconds() + GetInfo()->m_nReload / 4; + if (m_nAmmoTotal == 0) + return true; + + m_eWeaponState = WEAPONSTATE_RELOADING; + m_nTimer = CTimer::GetTimeInMilliseconds() + GetInfo()->m_nReload; + + if (shooter == FindPlayerPed()) + { + if (CWorld::Players[CWorld::PlayerInFocus].m_bFastReload) + m_nTimer = CTimer::GetTimeInMilliseconds() + GetInfo()->m_nReload / 4; + } + + return true; } - return true; + m_nTimer = CTimer::GetTimeInMilliseconds() + 1000; + if (shooter == FindPlayerPed()) + CStats::RoundsFiredByPlayer++; } - - m_nTimer = CTimer::GetTimeInMilliseconds() + 1000; - if ( shooter == FindPlayerPed() ) - CStats::RoundsFiredByPlayer++; } else { diff --git a/src/weapons/Weapon.h b/src/weapons/Weapon.h index 1b2c0320..c7685e0d 100644 --- a/src/weapons/Weapon.h +++ b/src/weapons/Weapon.h @@ -16,8 +16,8 @@ class CWeapon public: eWeaponType m_eWeaponType; eWeaponState m_eWeaponState; - uint32 m_nAmmoInClip; - uint32 m_nAmmoTotal; + int32 m_nAmmoInClip; + int32 m_nAmmoTotal; uint32 m_nTimer; bool m_bAddRotOffset; diff --git a/src/weapons/WeaponInfo.h b/src/weapons/WeaponInfo.h index b5882082..c89dd482 100644 --- a/src/weapons/WeaponInfo.h +++ b/src/weapons/WeaponInfo.h @@ -5,13 +5,13 @@ class CWeaponInfo { // static CWeaponInfo(&ms_apWeaponInfos)[14]; - static CWeaponInfo ms_apWeaponInfos[14]; + static CWeaponInfo ms_apWeaponInfos[WEAPONTYPE_LAST_WEAPONTYPE]; public: eWeaponFire m_eWeaponFire; float m_fRange; uint32 m_nFiringRate; uint32 m_nReload; - uint32 m_nAmountofAmmunition; + int32 m_nAmountofAmmunition; uint32 m_nDamage; float m_fSpeed; float m_fRadius;