From 8eea89d3b1dc54752bfd75b27114a4ccfb8c41c0 Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Thu, 13 Jun 2019 11:12:42 +0200 Subject: CI add debug mode --- .appveyor.yml | 7 +++++-- README.md | 8 ++++++-- premake5.lua | 11 +++++------ 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 6e9b3867..d3f57374 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,5 +1,7 @@ image: Visual Studio 2017 -configuration: ReleaseCI +configuration: + - DebugCI + - ReleaseCI platform: - Win32 environment: @@ -14,4 +16,5 @@ build: project: c:\projects\re3\build\re3.sln verbosity: minimal artifacts: - - path: bin/ReleaseCI/re3.dll + path: bin/%CONFIGURATION%/re3.dll + diff --git a/README.md b/README.md index 19a9ae08..e6aa8d07 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,12 @@ The aim of this project is to reverse GTA III for PC by replacing parts of the game [one by one](https://en.wikipedia.org/wiki/Ship_of_Theseus) such that we have a working game at all times. -Apparently you can download a binary of the latest version -[here](https://ci.appveyor.com/api/projects/aap/re3/artifacts/bin%2FReleaseCI%2Fre3.dll?branch=master). +Apparently you can download a binary of the latest version here: +[Debug](https://ci.appveyor.com/api/projects/app/re3/artifacts/bin/DebugCI/re3.dll?branch=master&job=Configuration%3A+DebugCI), +[Release](https://ci.appveyor.com/api/projects/app/re3/artifacts/bin/ReleaseCI/re3.dll?branch=master&job=Configuration%3A+ReleaseCI). + +Build status: +[![Build status](https://ci.appveyor.com/api/projects/status/hyiwgegks122h8jg?svg=true)](https://ci.appveyor.com/project/aap/re3/branch/master) Re3 starts the script main_freeroam.scm by default. Make sure you copy it to your data directory. diff --git a/premake5.lua b/premake5.lua index 68a08a1a..49d0d502 100644 --- a/premake5.lua +++ b/premake5.lua @@ -1,5 +1,5 @@ workspace "re3" - configurations { "ReleaseCI", "Release", "ReleaseFH", "Debug" } + configurations { "DebugCI", "ReleaseCI", "Release", "ReleaseFH", "Debug" } location "build" files { "src/*.*" } @@ -62,12 +62,11 @@ project "re3" debugcommand "F:/Rockstar Games/GTAIII/gta3.exe" targetextension ".asi" targetdir "F:/Rockstar Games/GTAIII/scripts" + filter "configurations:DebugCI" + defines { "DEBUG" } + symbols "On" + staticruntime "on" filter "configurations:ReleaseCI" defines { "NDEBUG" } optimize "On" staticruntime "on" - filter "configurations:DebugCI" - defines { "DEBUG" } - staticruntime "on" - symbols "On" - -- cgit v1.2.3 From f407c9829fb5eac2c00867d2b31b2766dfe70540 Mon Sep 17 00:00:00 2001 From: aap Date: Thu, 13 Jun 2019 12:25:55 +0200 Subject: finished some classes --- src/CullZones.cpp | 23 ++++++++++++++++++ src/CullZones.h | 1 + src/RwHelper.h | 3 +++ src/TxdStore.cpp | 51 +++++++++++++++++++++++++++++++++++----- src/TxdStore.h | 4 ++++ src/render/VisibilityPlugins.cpp | 8 +++++++ src/render/VisibilityPlugins.h | 1 + 7 files changed, 85 insertions(+), 6 deletions(-) diff --git a/src/CullZones.cpp b/src/CullZones.cpp index dc30790b..76052351 100644 --- a/src/CullZones.cpp +++ b/src/CullZones.cpp @@ -6,6 +6,7 @@ #include "Timer.h" #include "Camera.h" #include "World.h" +#include "FileMgr.h" #include "CullZones.h" int32 &CCullZones::NumCullZones = *(int*)0x8F2564; @@ -45,6 +46,27 @@ CCullZones::Init(void) aPointersToBigBuildingsForTreadables[i] = -1; } +void +CCullZones::ResolveVisibilities(void) +{ + int fd; + + CFileMgr::SetDir(""); + fd = CFileMgr::OpenFile("DATA\\cullzone.dat", "rb"); + if(fd > 0){ + CFileMgr::Read(fd, (char*)&NumCullZones, 4); + CFileMgr::Read(fd, (char*)aZones, NUMCULLZONES*sizeof(CCullZone)); + CFileMgr::Read(fd, (char*)&NumAttributeZones, 4); + CFileMgr::Read(fd, (char*)aAttributeZones, NUMATTRIBZONES*sizeof(CAttributeZone)); + CFileMgr::Read(fd, (char*)aIndices, NUMZONEINDICES*2); + CFileMgr::Read(fd, (char*)aPointersToBigBuildingsForBuildings, NUMBUILDINGS*2); + CFileMgr::Read(fd, (char*)aPointersToBigBuildingsForTreadables, NUMTREADABLES*2); + CFileMgr::CloseFile(fd); + }else{ + // TODO: implement code from mobile to generate data here + } +} + void CCullZones::Update(void) { @@ -311,6 +333,7 @@ CCullZone::DoStuffEnteringZone_OneTreadable(uint16 i) STARTPATCHES InjectHook(0x524BC0, &CCullZones::Init, PATCH_JUMP); + InjectHook(0x524EC0, &CCullZones::ResolveVisibilities, PATCH_JUMP); InjectHook(0x524F80, &CCullZones::Update, PATCH_JUMP); InjectHook(0x525370, &CCullZones::AddCullZone, PATCH_JUMP); InjectHook(0x5250D0, &CCullZones::ForceCullZoneCoors, PATCH_JUMP); diff --git a/src/CullZones.h b/src/CullZones.h index 4641f6ad..5b04b4f9 100644 --- a/src/CullZones.h +++ b/src/CullZones.h @@ -71,6 +71,7 @@ public: static bool &bCullZonesDisabled; static void Init(void); + static void ResolveVisibilities(void); static void Update(void); static void ForceCullZoneCoors(CVector coors); static int32 FindCullZoneForCoors(CVector coors); diff --git a/src/RwHelper.h b/src/RwHelper.h index b65a53ad..2dbfd3ce 100644 --- a/src/RwHelper.h +++ b/src/RwHelper.h @@ -6,6 +6,9 @@ RwObject *GetFirstObject(RwFrame *frame); RpAtomic *GetFirstAtomic(RpClump *clump); RwTexDictionary *RwTexDictionaryGtaStreamRead(RwStream *stream); +RwTexDictionary *RwTexDictionaryGtaStreamRead1(RwStream *stream); +RwTexDictionary *RwTexDictionaryGtaStreamRead2(RwStream *stream, RwTexDictionary *texDict); + bool RpClumpGtaStreamRead1(RwStream *stream); RpClump *RpClumpGtaStreamRead2(RwStream *stream); void RpClumpGtaCancelStream(void); diff --git a/src/TxdStore.cpp b/src/TxdStore.cpp index 10d6e1f5..291feb2f 100644 --- a/src/TxdStore.cpp +++ b/src/TxdStore.cpp @@ -22,6 +22,18 @@ CTxdStore::Shutdown(void) delete ms_pTxdPool; } +void +CTxdStore::GameShutdown(void) +{ + int i; + + for(i = 0; i < TXDSTORESIZE; i++){ + TxdDef *def = GetSlot(i); + if(def && GetNumRefs(i)) + RemoveTxdSlot(i); + } +} + int CTxdStore::AddTxdSlot(const char *name) { @@ -89,6 +101,12 @@ CTxdStore::Create(int slot) GetSlot(slot)->texDict = RwTexDictionaryCreate(); } +int +CTxdStore::GetNumRefs(int slot) +{ + return GetSlot(slot)->refCount; +} + void CTxdStore::AddRef(int slot) { @@ -137,6 +155,27 @@ CTxdStore::LoadTxd(int slot, const char *filename) return ret; } +bool +CTxdStore::StartLoadTxd(int slot, RwStream *stream) +{ + TxdDef *def = GetSlot(slot); + if(RwStreamFindChunk(stream, rwID_TEXDICTIONARY, nil, nil)){ + def->texDict = RwTexDictionaryGtaStreamRead1(stream); + return def->texDict != nil; + }else{ + printf("Failed to load TXD\n"); + return nil; + } +} + +bool +CTxdStore::FinishLoadTxd(int slot, RwStream *stream) +{ + TxdDef *def = GetSlot(slot); + def->texDict = RwTexDictionaryGtaStreamRead2(stream, def->texDict); + return def->texDict != nil; +} + void CTxdStore::RemoveTxd(int slot) { @@ -146,15 +185,10 @@ CTxdStore::RemoveTxd(int slot) def->texDict = nil; } -//bool -//CTxdStore::isTxdLoaded(int slot) -//{ -// return GetSlot(slot)->texDict != nil; -//} - STARTPATCHES InjectHook(0x527440, CTxdStore::Initialize, PATCH_JUMP); InjectHook(0x527470, CTxdStore::Shutdown, PATCH_JUMP); + InjectHook(0x527490, CTxdStore::GameShutdown, PATCH_JUMP); InjectHook(0x5274E0, CTxdStore::AddTxdSlot, PATCH_JUMP); InjectHook(0x5275D0, CTxdStore::FindTxdSlot, PATCH_JUMP); InjectHook(0x527590, CTxdStore::GetTxdName, PATCH_JUMP); @@ -162,8 +196,13 @@ STARTPATCHES InjectHook(0x527910, CTxdStore::PopCurrentTxd, PATCH_JUMP); InjectHook(0x5278C0, CTxdStore::SetCurrentTxd, PATCH_JUMP); InjectHook(0x527830, CTxdStore::Create, PATCH_JUMP); + InjectHook(0x527A00, CTxdStore::GetNumRefs, PATCH_JUMP); InjectHook(0x527930, CTxdStore::AddRef, PATCH_JUMP); InjectHook(0x527970, CTxdStore::RemoveRef, PATCH_JUMP); InjectHook(0x5279C0, CTxdStore::RemoveRefWithoutDelete, PATCH_JUMP); + InjectHook(0x527700, (bool (*)(int, RwStream*))CTxdStore::LoadTxd, PATCH_JUMP); + InjectHook(0x5276B0, (bool (*)(int, const char*))CTxdStore::LoadTxd, PATCH_JUMP); + InjectHook(0x527770, CTxdStore::StartLoadTxd, PATCH_JUMP); + InjectHook(0x5277E0, CTxdStore::FinishLoadTxd, PATCH_JUMP); InjectHook(0x527870, CTxdStore::RemoveTxd, PATCH_JUMP); ENDPATCHES diff --git a/src/TxdStore.h b/src/TxdStore.h index a9526cf2..50a94a75 100644 --- a/src/TxdStore.h +++ b/src/TxdStore.h @@ -15,6 +15,7 @@ class CTxdStore public: static void Initialize(void); static void Shutdown(void); + static void GameShutdown(void); static int AddTxdSlot(const char *name); static void RemoveTxdSlot(int slot); static int FindTxdSlot(const char *name); @@ -23,11 +24,14 @@ public: static void PopCurrentTxd(void); static void SetCurrentTxd(int slot); static void Create(int slot); + static int GetNumRefs(int slot); static void AddRef(int slot); static void RemoveRef(int slot); static void RemoveRefWithoutDelete(int slot); static bool LoadTxd(int slot, RwStream *stream); static bool LoadTxd(int slot, const char *filename); + static bool StartLoadTxd(int slot, RwStream *stream); + static bool FinishLoadTxd(int slot, RwStream *stream); static void RemoveTxd(int slot); static TxdDef *GetSlot(int slot) { return ms_pTxdPool->GetSlot(slot); } diff --git a/src/render/VisibilityPlugins.cpp b/src/render/VisibilityPlugins.cpp index 5608c933..316a397c 100644 --- a/src/render/VisibilityPlugins.cpp +++ b/src/render/VisibilityPlugins.cpp @@ -48,6 +48,13 @@ CVisibilityPlugins::Initialise(void) m_alphaEntityList.tail.item.sort = 100000000.0f; } +void +CVisibilityPlugins::Shutdown(void) +{ + m_alphaList.Shutdown(); + m_alphaEntityList.Shutdown(); +} + void CVisibilityPlugins::InitAlphaEntityList(void) { @@ -822,6 +829,7 @@ CVisibilityPlugins::GetClumpAlpha(RpClump *clump) STARTPATCHES InjectHook(0x527E50, CVisibilityPlugins::Initialise, PATCH_JUMP); + InjectHook(0x527EA0, CVisibilityPlugins::Shutdown, PATCH_JUMP); InjectHook(0x528F90, CVisibilityPlugins::InitAlphaEntityList, PATCH_JUMP); InjectHook(0x528FF0, CVisibilityPlugins::InsertEntityIntoSortedList, PATCH_JUMP); InjectHook(0x528F80, CVisibilityPlugins::InitAlphaAtomicList, PATCH_JUMP); diff --git a/src/render/VisibilityPlugins.h b/src/render/VisibilityPlugins.h index 89222dce..65d2675a 100644 --- a/src/render/VisibilityPlugins.h +++ b/src/render/VisibilityPlugins.h @@ -35,6 +35,7 @@ public: static float &ms_pedFadeDist; static void Initialise(void); + static void Shutdown(void); static void InitAlphaEntityList(void); static bool InsertEntityIntoSortedList(CEntity *e, float dist); static void InitAlphaAtomicList(void); -- cgit v1.2.3 From e476c52aa3acfc391e5fe0bd6fb5ba2dedbb0d6b Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Thu, 13 Jun 2019 13:58:34 +0200 Subject: Fix typo in link to appveyor's account --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e6aa8d07..0d6fe00a 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ parts of the game [one by one](https://en.wikipedia.org/wiki/Ship_of_Theseus) such that we have a working game at all times. Apparently you can download a binary of the latest version here: -[Debug](https://ci.appveyor.com/api/projects/app/re3/artifacts/bin/DebugCI/re3.dll?branch=master&job=Configuration%3A+DebugCI), -[Release](https://ci.appveyor.com/api/projects/app/re3/artifacts/bin/ReleaseCI/re3.dll?branch=master&job=Configuration%3A+ReleaseCI). +[Debug](https://ci.appveyor.com/api/projects/aap/re3/artifacts/bin/DebugCI/re3.dll?branch=master&job=Configuration%3A+DebugCI), +[Release](https://ci.appveyor.com/api/projects/aap/re3/artifacts/bin/ReleaseCI/re3.dll?branch=master&job=Configuration%3A+ReleaseCI). Build status: [![Build status](https://ci.appveyor.com/api/projects/status/hyiwgegks122h8jg?svg=true)](https://ci.appveyor.com/project/aap/re3/branch/master) -- cgit v1.2.3 From d08912e905003fcb76958450e4c990bcf5b3d0ab Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Thu, 13 Jun 2019 14:27:29 +0200 Subject: Fix value of CReplay mode --- src/control/Replay.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/control/Replay.h b/src/control/Replay.h index 331cc44f..5d63db1f 100644 --- a/src/control/Replay.h +++ b/src/control/Replay.h @@ -5,7 +5,7 @@ class CReplay public: static void Display(void); enum { - MODE_1 + MODE_1 = 1 }; static uint8 &Mode; -- cgit v1.2.3 From ed69be36cc30609100f0c75ac18aa5b4c15b22b4 Mon Sep 17 00:00:00 2001 From: erorcun Date: Fri, 14 Jun 2019 15:33:08 +0300 Subject: Some CPed functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: eray orçunus --- src/entities/Ped.cpp | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/entities/Ped.h | 47 ++++++++++++++++++++++++++++++++++++++---- src/entities/PedIK.cpp | 7 +++++++ src/entities/PedIK.h | 26 ++++++++++++++++++++++++ 4 files changed, 131 insertions(+), 4 deletions(-) create mode 100644 src/entities/PedIK.cpp create mode 100644 src/entities/PedIK.h diff --git a/src/entities/Ped.cpp b/src/entities/Ped.cpp index 55e33a2d..b4b980e5 100644 --- a/src/entities/Ped.cpp +++ b/src/entities/Ped.cpp @@ -11,6 +11,8 @@ void *CPed::operator new(size_t sz) { return CPools::GetPedPool()->New(); } void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); } WRAPPER void CPed::KillPedWithCar(CVehicle *veh, float impulse) { EAXJMP(0x4EC430); } +WRAPPER void CPed::Say(uint16 audio) { EAXJMP(0x4E5A10); } +WRAPPER void CPed::SetLookFlag(CEntity* to, bool set) { EAXJMP(0x4C6460); } static char ObjectiveText[34][28] = { "No Obj", @@ -175,3 +177,56 @@ CPed::UseGroundColModel(void) m_nPedState == PED_DIE || m_nPedState == PED_DEAD; } + +void +CPed::AddWeaponModel(int id) +{ + RpAtomic* atm; + + if (id != -1) { + atm = (RpAtomic*)CModelInfo::GetModelInfo(id)->CreateInstance(); + RwFrameDestroy(RpAtomicGetFrame(atm)); + RpAtomicSetFrame(atm, m_pFrames[PED_HANDR]->frame); + RpClumpAddAtomic((RpClump*)m_rwObject, atm); + m_wepModelID = id; + } +} + +void +CPed::AimGun() +{ + RwV3d pos; + CVector vector; + uint8 newFlag; + + if (m_pSeekTarget) { + if (m_pSeekTarget->m_status == STATUS_PHYSICS) { + m_pSeekTarget->m_pedIK.GetComponentPosition(&pos, 1); + vector.x = pos.x; + vector.y = pos.y; + vector.z = pos.z; + } else { + vector = *(m_pSeekTarget->GetMatrix().GetPosition()); + } + CPed::Say(0x74); + + m_ped_flagB40 = m_pedIK.PointGunAtPosition(&vector); + if (m_pPedFight != m_pSeekTarget) { + CPed::SetLookFlag(m_pSeekTarget, 1); + } + + } else { + if (CPed::IsPlayer()) { + newFlag = m_pedIK.PointGunInDirection(m_fLookDirection, m_vecMoveSpeedAvg.y); + } else { + newFlag = m_pedIK.PointGunInDirection(m_fLookDirection, 0.0); + } + + m_ped_flagB40 = newFlag; + } +} + +STARTPATCHES + InjectHook(0x4CF8F0, &CPed::AddWeaponModel, PATCH_JUMP); + InjectHook(0x4C6AA0, &CPed::AimGun, PATCH_JUMP); +ENDPATCHES \ No newline at end of file diff --git a/src/entities/Ped.h b/src/entities/Ped.h index adf24c88..4a616e22 100644 --- a/src/entities/Ped.h +++ b/src/entities/Ped.h @@ -2,6 +2,8 @@ #include "Physical.h" #include "Weapon.h" +#include "PedIK.h" +#include enum { PED_MAX_WEAPONS = 13 @@ -79,6 +81,22 @@ enum { PEDMOVE_SPRINT, }; +enum PedNode { + PED_WAIST = 0, + PED_TORSO, // Smid on PS2/PC, Storso on mobile/xbox. We follow mobile/xbox (makes kicking on ground look better) + PED_HEAD, + PED_UPPERARML, + PED_UPPERARMR, + PED_HANDL, + PED_HANDR, + PED_UPPERLEGL, + PED_UPPERLEGR, + PED_FOOTL, + PED_FOOTR, + PED_NODE_11, + PED_NODE_MAX +}; + class CVehicle; class CPed : public CPhysical @@ -159,7 +177,16 @@ public: uint8 m_ped_flagI20 : 1; uint8 m_ped_flagI40 : 1; uint8 m_ped_flagI80 : 1; - uint8 stuff1[199]; + uint8 stuff10[60]; + int32 m_pEventEntity; + int32 m_fAngleToEvent; + AnimBlendFrameData *m_pFrames[PED_FRAME_MAX]; + int32 m_animGroup; + int32 m_pVehicleAnim; + CVector2D m_vecAnimMoveDelta; + CVector m_vecOffsetSeek; + CPedIK m_pedIK; + uint8 stuff1[12]; int32 m_nPedState; int32 m_nLastPedState; int32 m_nMoveState; @@ -167,7 +194,8 @@ public: CEntity *m_pCurrentPhysSurface; CVector m_vecOffsetFromPhysSurface; CEntity *m_pCurSurface; - uint8 stuff3[16]; + uint8 stuff3[12]; + CPed* m_pSeekTarget; CVehicle *m_pMyVehicle; bool bInVehicle; uint8 stuff4[23]; @@ -179,14 +207,25 @@ public: CWeapon m_weapons[PED_MAX_WEAPONS]; int32 stuff7; uint8 m_currentWeapon; - uint8 stuff[163]; + uint8 stuff[3]; + int32 m_pPointGunAt; + CVector m_vecHitLastPos; + uint8 stuff8[12]; + CPed *m_pPedFight; + float m_fLookDirection; + int32 m_wepModelID; + uint8 stuff9[120]; static void *operator new(size_t); static void operator delete(void*, size_t); bool IsPlayer(void) { return m_nPedType == 0 || m_nPedType== 1 || m_nPedType == 2 || m_nPedType == 3; } bool UseGroundColModel(void); + void AddWeaponModel(int id); + void AimGun(); void KillPedWithCar(CVehicle *veh, float impulse); + void Say(uint16 audio); + void SetLookFlag(CEntity *to, bool set); CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; } static Bool &bNastyLimbsCheat; @@ -200,4 +239,4 @@ static_assert(offsetof(CPed, m_nPedType) == 0x32C, "CPed: error"); static_assert(offsetof(CPed, m_pCollidingEntity) == 0x34C, "CPed: error"); static_assert(offsetof(CPed, m_weapons) == 0x35C, "CPed: error"); static_assert(offsetof(CPed, m_currentWeapon) == 0x498, "CPed: error"); -static_assert(sizeof(CPed) == 0x53C, "CPed: error"); +static_assert(sizeof(CPed) == 0x53C, "CPed: error"); \ No newline at end of file diff --git a/src/entities/PedIK.cpp b/src/entities/PedIK.cpp new file mode 100644 index 00000000..f262fab5 --- /dev/null +++ b/src/entities/PedIK.cpp @@ -0,0 +1,7 @@ +#include "common.h" +#include "patcher.h" +#include "Ped.h" + +WRAPPER void CPedIK::GetComponentPosition(RwV3d* pos, int id) { EAXJMP(0x4ED0F0); } +WRAPPER bool CPedIK::PointGunInDirection(float phi, float theta) { EAXJMP(0x4ED9B0); } +WRAPPER bool CPedIK::PointGunAtPosition(CVector* position) { EAXJMP(0x4ED920); } \ No newline at end of file diff --git a/src/entities/PedIK.h b/src/entities/PedIK.h new file mode 100644 index 00000000..5e873bf5 --- /dev/null +++ b/src/entities/PedIK.h @@ -0,0 +1,26 @@ +#pragma once +#include + +struct LimbOrientation +{ + float phi; + float theta; +}; + +class CPed; + +class CPedIK +{ +public: + CPed* m_ped; + LimbOrientation m_headOrient; + LimbOrientation m_torsoOrient; + LimbOrientation m_upperArmOrient; + LimbOrientation m_lowerArmOrient; + int32 m_flags; + + void GetComponentPosition(RwV3d* pos, int id); + bool PointGunInDirection(float phi, float theta); + bool PointGunAtPosition(CVector* position); +}; +static_assert(sizeof(CPedIK) == 0x28, "CPedIK: error"); -- cgit v1.2.3 From 8db50cea6c5e7d93d7e7fe102ca465a615ab86de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Fri, 14 Jun 2019 17:14:22 +0300 Subject: Fix duplicate code for PedNode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: eray orçunus --- src/entities/Ped.h | 18 +----------------- src/modelinfo/PedModelInfo.h | 3 +-- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/src/entities/Ped.h b/src/entities/Ped.h index 4a616e22..b7db77dc 100644 --- a/src/entities/Ped.h +++ b/src/entities/Ped.h @@ -81,22 +81,6 @@ enum { PEDMOVE_SPRINT, }; -enum PedNode { - PED_WAIST = 0, - PED_TORSO, // Smid on PS2/PC, Storso on mobile/xbox. We follow mobile/xbox (makes kicking on ground look better) - PED_HEAD, - PED_UPPERARML, - PED_UPPERARMR, - PED_HANDL, - PED_HANDR, - PED_UPPERLEGL, - PED_UPPERLEGR, - PED_FOOTL, - PED_FOOTR, - PED_NODE_11, - PED_NODE_MAX -}; - class CVehicle; class CPed : public CPhysical @@ -180,7 +164,7 @@ public: uint8 stuff10[60]; int32 m_pEventEntity; int32 m_fAngleToEvent; - AnimBlendFrameData *m_pFrames[PED_FRAME_MAX]; + AnimBlendFrameData *m_pFrames[PED_NODE_MAX]; int32 m_animGroup; int32 m_pVehicleAnim; CVector2D m_vecAnimMoveDelta; diff --git a/src/modelinfo/PedModelInfo.h b/src/modelinfo/PedModelInfo.h index e917b6b2..95d49090 100644 --- a/src/modelinfo/PedModelInfo.h +++ b/src/modelinfo/PedModelInfo.h @@ -15,8 +15,7 @@ enum PedNode { PED_FOOTL, PED_FOOTR, PED_LOWERLEGR, - // This is not valid apparently - PED_LOWERLEGL, + PED_NODE_MAX// Not valid: PED_LOWERLEGL }; class CPedModelInfo : public CClumpModelInfo -- cgit v1.2.3 From 92cc1cf3af5c5454eddd464e42c495d3739a1cce Mon Sep 17 00:00:00 2001 From: _AG Date: Sat, 15 Jun 2019 01:34:19 +0200 Subject: New updates for Hud.cpp and more. --- src/Camera.cpp | 11 +- src/Camera.h | 3 +- src/Frontend.cpp | 45 +- src/Frontend.h | 92 ++- src/Messages.cpp | 9 + src/Messages.h | 38 +- src/Radar.cpp | 42 ++ src/Radar.h | 10 + src/Timer.h | 1 + src/Wanted.cpp | 3 + src/Wanted.h | 83 +++ src/World.cpp | 5 + src/World.h | 5 + src/audio/DMAudio.h | 171 ++++++ src/common.h | 2 +- src/control/Darkel.cpp | 6 + src/control/Darkel.h | 4 + src/control/Replay.h | 3 +- src/control/Script.cpp | 3 + src/control/Script.h | 35 ++ src/entities/Ped.cpp | 2 +- src/entities/Ped.h | 24 +- src/entities/PlayerInfo.cpp | 3 + src/entities/PlayerInfo.h | 71 +++ src/entities/PlayerPed.h | 39 +- src/render/Draw.cpp | 3 + src/render/Hud.cpp | 1296 ++++++++++++++++++++++++++++++++++++++++++- src/render/Hud.h | 89 ++- 28 files changed, 2061 insertions(+), 37 deletions(-) create mode 100644 src/Wanted.cpp create mode 100644 src/Wanted.h create mode 100644 src/entities/PlayerInfo.cpp create mode 100644 src/entities/PlayerInfo.h diff --git a/src/Camera.cpp b/src/Camera.cpp index 6054f1fc..ebe08f09 100644 --- a/src/Camera.cpp +++ b/src/Camera.cpp @@ -14,8 +14,7 @@ const float DefaultFOV = 80.0f; // actually 70.0f CCamera &TheCamera = *(CCamera*)0x6FACF8; - -WRAPPER Bool CCam::Using3rdPersonMouseCam() { EAXJMP(0x457460); } +Bool &CCamera::m_bUseMouse3rdPerson = *(Bool *)0x5F03D8; WRAPPER void CCamera::DrawBordersForWideScreen(void) { EAXJMP(0x46B430); } @@ -1250,6 +1249,14 @@ CCam::FixCamWhenObscuredByVehicle(const CVector &TargetCoors) Source.z += HeightFixerCarsObscuring; } +bool CCam::Using3rdPersonMouseCam() { + return CCamera::m_bUseMouse3rdPerson && + (Mode == MODE_FOLLOWPED || + TheCamera.m_bPlayerIsInGarage && + FindPlayerPed() && FindPlayerPed()->m_nPedState != PED_DRIVING && + Mode != MODE_TOPDOWN1 && this->CamTargetEntity == FindPlayerPed()); +} + STARTPATCHES InjectHook(0x42C760, &CCamera::IsSphereVisible, PATCH_JUMP); InjectHook(0x46FD00, &CCamera::SetFadeColour, PATCH_JUMP); diff --git a/src/Camera.h b/src/Camera.h index 73fce616..0f3a1128 100644 --- a/src/Camera.h +++ b/src/Camera.h @@ -161,7 +161,6 @@ struct CCam CPed *m_pLastPedLookedAt;// So interpolation works bool m_bFirstPersonRunAboutActive; - Bool Using3rdPersonMouseCam(); void GetVectorsReadyForRW(void); CVector DoAverageOnVector(const CVector &vec); @@ -172,6 +171,7 @@ struct CCam bool FixCamIfObscured(CVector &TargetCoors, float TargetHeight, float TargetOrientation); void Cam_On_A_String_Unobscured(const CVector &TargetCoors, float BaseDist); void FixCamWhenObscuredByVehicle(const CVector &TargetCoors); + bool Using3rdPersonMouseCam(); void Process_Debug(float *vec, float a, float b, float c); void Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, float, float); @@ -439,6 +439,7 @@ int m_iModeObbeCamIsInForCar; uint32 m_uiFadeTimeStarted; uint32 m_uiFadeTimeStartedMusic; + static Bool &m_bUseMouse3rdPerson; CMatrix &GetCameraMatrix(void) { return m_cameraMatrix; } CVector &GetGameCamPosition(void) { return m_vecGameCamPos; } diff --git a/src/Frontend.cpp b/src/Frontend.cpp index 35e48065..22e28cab 100644 --- a/src/Frontend.cpp +++ b/src/Frontend.cpp @@ -2,15 +2,30 @@ #include "patcher.h" #include "Frontend.h" -int &CMenuManager::OS_Language = *(int*)0x5F2F78; -int &CMenuManager::m_PrefsBrightness = *(int*)0x5F2E50; -int &CMenuManager::m_PrefsLanguage = *(int*)0x941238; -bool &CMenuManager::m_PrefsUseWideScreen = *(bool*)0x95CD23; -Bool &CMenuManager::m_PrefsVsync = *(Bool*)0x5F2E58; +int32 &CMenuManager::OS_Language = *(int32*)0x5F2F78; +int8 &CMenuManager::m_PrefsUseVibration = *(int8*)0x95CD92; +int8 &CMenuManager::m_DisplayControllerOnFoot = *(int8*)0x95CD8D; +int8 &CMenuManager::m_PrefsVsync = *(int8*)0x5F2E58; +int8 &CMenuManager::m_PrefsVsyncDisp = *(int8*)0x5F2E5C; +int8 &CMenuManager::m_PrefsFrameLimiter = *(int8*)0x5F2E60; +int8 &CMenuManager::BlurOn = *(int8*)0x95CDAD; +int8 &CMenuManager::m_PrefsShowSubtitles = *(int8*)0x5F2E54; +int8 &CMenuManager::m_PrefsSpeakers = *(int8*)0x95CD7E; +int8 &CMenuManager::m_ControlMethod = *(int8*)0x8F5F7C; +int8 &CMenuManager::m_PrefsDMA = *(int8*)0x5F2F74; +int8 &CMenuManager::m_PrefsLanguage = *(int8*)0x941238; + Bool &CMenuManager::m_PrefsAllowNastyGame = *(Bool*)0x5F2E64; Bool &CMenuManager::m_bStartUpFrontEndRequested = *(Bool*)0x95CCF4; -Bool &CMenuManager::m_PrefsFrameLimiter = *(Bool*)0x5F2E60; -Bool &CMenuManager::m_PrefsUseVibration = *(Bool*)0x95CD92; + +int8 &CMenuManager::m_PrefsUseWideScreen = *(int8*)0x95CD23; +int8 &CMenuManager::m_PrefsRadioStation = *(int8*)0x95CDA4; +int8 &CMenuManager::m_bDisableMouseSteering = *(int8*)0x60252C; +int32 &CMenuManager::m_PrefsBrightness = *(int32*)0x5F2E50; +Float &CMenuManager::m_PrefsLOD = *(Float*)0x8F42C4; +int8 &CMenuManager::m_bFrontEnd_ReloadObrTxtGxt = *(int8*)0x628CFC; +int32 &CMenuManager::m_PrefsMusicVolume = *(int32*)0x5F2E4C; +int32 &CMenuManager::m_PrefsSfxVolume = *(int32*)0x5F2E48; CMenuManager &FrontEndMenuManager = *(CMenuManager*)0x8F59D8; @@ -20,3 +35,19 @@ WRAPPER void CMenuManager::UnloadTextures(void) { EAXJMP(0x47A440); } WRAPPER void CMenuManager::LoadAllTextures(void) { EAXJMP(0x47A230); } WRAPPER void CMenuManager::LoadSettings(void) { EAXJMP(0x488EE0); } WRAPPER void CMenuManager::WaitForUserCD(void) { EAXJMP(0x48ADD0); } + +int CMenuManager::FadeIn(int alpha) { + if (FrontEndMenuManager.m_nCurrScreen == MENU_LOADING_IN_PROGRESS || + FrontEndMenuManager.m_nCurrScreen == MENU_SAVING_IN_PROGRESS || + FrontEndMenuManager.m_nCurrScreen == MENU_DELETING) + return alpha; + + if (FrontEndMenuManager.m_nMenuFadeAlpha >= alpha) + return alpha; + + return FrontEndMenuManager.m_nMenuFadeAlpha; +} + +STARTPATCHES + InjectHook(0x48AC60, &CMenuManager::FadeIn, PATCH_JUMP); +ENDPATCHES \ No newline at end of file diff --git a/src/Frontend.h b/src/Frontend.h index 65b8c29a..6e781834 100644 --- a/src/Frontend.h +++ b/src/Frontend.h @@ -10,6 +10,68 @@ enum { LANGUAGE_SPANISH, }; +enum eMenuScreen { + MENU_NONE = 0, + MENU_STATS = 1, + MENU_NEW_GAME = 2, + MENU_BRIEFS = 3, + MENU_CONTROLLER_SETTINGS = 4, + MENU_SOUND_SETTINGS = 5, + MENU_GRAPHICS_SETTINGS = 6, + MENU_LANGUAGE_SETTINGS = 7, + MENU_CHOOSE_LOAD_SLOT = 8, + MENU_CHOOSE_DELETE_SLOT = 9, + MENU_NEW_GAME_RELOAD = 10, + MENU_LOAD_SLOT_CONFIRM = 11, + MENU_DELETE_SLOT_CONFIRM = 12, + MENU_13 = 13, + MENU_LOADING_IN_PROGRESS = 14, + MENU_DELETING_IN_PROGRESS = 15, + MENU_16 = 16, + MENU_DELETE_FAILED = 17, + MENU_DEBUG_MENU = 18, + MENU_MEMORY_CARD_1 = 19, + MENU_MEMORY_CARD_2 = 20, + MENU_MULTIPLAYER_MAIN = 21, + MENU_SAVE_FAILED_1 = 22, + MENU_SAVE_FAILED_2 = 23, + MENU_SAVE = 24, + MENU_NO_MEMORY_CARD = 25, + MENU_CHOOSE_SAVE_SLOT = 26, + MENU_SAVE_OVERWRITE_CONFIRM = 27, + MENU_MULTIPLAYER_MAP = 28, + MENU_MULTIPLAYER_CONNECTION = 29, + MENU_MULTIPLAYER_FIND_GAME = 30, + MENU_MULTIPLAYER_MODE = 31, + MENU_MULTIPLAYER_CREATE = 32, + MENU_MULTIPLAYER_START = 33, + MENU_SKIN_SELECT_OLD = 34, + MENU_CONTROLLER_PC = 35, + MENU_CONTROLLER_PC_OLD1 = 36, + MENU_CONTROLLER_PC_OLD2 = 37, + MENU_CONTROLLER_PC_OLD3 = 38, + MENU_CONTROLLER_PC_OLD4 = 39, + MENU_CONTROLLER_DEBUG = 40, + MENU_OPTIONS = 41, + MENU_EXIT = 42, + MENU_SAVING_IN_PROGRESS = 43, + MENU_SAVE_SUCCESSFUL = 44, + MENU_DELETING = 45, + MENU_DELETE_SUCCESS = 46, + MENU_SAVE_FAILED = 47, + MENU_LOAD_FAILED = 48, + MENU_LOAD_FAILED_2 = 49, + MENU_FILTER_GAME = 50, + MENU_START_MENU = 51, + MENU_PAUSE_MENU = 52, + MENU_CHOOSE_MODE = 53, + MENU_SKIN_SELECT = 54, + MENU_KEYBOARD_CONTROLS = 55, + MENU_MOUSE_CONTROLS = 56, + MENU_57 = 57, + MENU_58 = 58, +}; + struct tSkinInfo { int field_0; @@ -83,15 +145,29 @@ public: int m_nCurrSaveSlot; int m_nScreenChangeDelayTimer; - static int &OS_Language; - static int &m_PrefsBrightness; - static int &m_PrefsLanguage; - static bool &m_PrefsUseWideScreen; - static Bool &m_PrefsVsync; + static int32 &OS_Language; + static int8 &m_PrefsUseVibration; + static int8 &m_DisplayControllerOnFoot; + static int8 &m_PrefsUseWideScreen; + static int8 &m_PrefsRadioStation; + static int8 &m_PrefsVsync; + static int8 &m_PrefsVsyncDisp; + static int8 &m_PrefsFrameLimiter; + static int8 &BlurOn; + static int8 &m_PrefsShowSubtitles; + static int8 &m_PrefsSpeakers; + static int8 &m_ControlMethod; + static int8 &m_PrefsDMA; + static int8 &m_PrefsLanguage; + static int8 &m_bDisableMouseSteering; + static int32 &m_PrefsBrightness; + static Float &m_PrefsLOD; + static int8 &m_bFrontEnd_ReloadObrTxtGxt; + static int32 &m_PrefsMusicVolume; + static int32 &m_PrefsSfxVolume; + static Bool &m_PrefsAllowNastyGame; static Bool &m_bStartUpFrontEndRequested; - static Bool &m_PrefsFrameLimiter; - static Bool &m_PrefsUseVibration; void Process(void); void DrawFrontEnd(void); @@ -99,7 +175,9 @@ public: void LoadAllTextures(void); void LoadSettings(void); void WaitForUserCD(void); + int FadeIn(int alpha); }; + static_assert(sizeof(CMenuManager) == 0x564, "CMenuManager: error"); extern CMenuManager &FrontEndMenuManager; diff --git a/src/Messages.cpp b/src/Messages.cpp index e29300f4..7fc23593 100644 --- a/src/Messages.cpp +++ b/src/Messages.cpp @@ -4,3 +4,12 @@ WRAPPER void CMessages::Display(void) { EAXJMP(0x529800); } WRAPPER void CMessages::ClearAllMessagesDisplayedByGame(void) { EAXJMP(0x52B670); } +WRAPPER int CMessages::WideStringCopy(wchar* dst, wchar* src, unsigned short size) { EAXJMP(0x5294B0); } +WRAPPER char CMessages::WideStringCompare(wchar* str1, wchar* str2, unsigned short size) { EAXJMP(0x529510); } +WRAPPER void CMessages::InsertNumberInString(wchar* src, int n1, int n2, int n3, int n4, int n5, int n6, wchar* dst) { EAXJMP(0x52A1A0); } +WRAPPER void CMessages::InsertPlayerControlKeysInString(wchar* src) { EAXJMP(0x52A490); } +WRAPPER int CMessages::GetWideStringLength(wchar* src) { EAXJMP(0x529490); } + +tPreviousBrief *CMessages::PreviousBriefs = (tPreviousBrief *)0x713C08; +tMessage *CMessages::BriefMessages = (tMessage *)0x8786E0; +tBigMessage *CMessages::BIGMessages = (tBigMessage *)0x773628; diff --git a/src/Messages.h b/src/Messages.h index 711427f1..69cf117c 100644 --- a/src/Messages.h +++ b/src/Messages.h @@ -1,8 +1,44 @@ #pragma once -class CMessages +struct tMessage { + wchar *m_pText; + uint16 m_nFlag; +private: + int8 _pad6[2]; +public: + uint32 m_nTime; + uint32 m_nStartTime; + int32 m_nNumber[6]; + wchar *m_pString; +}; + +struct tBigMessage +{ + tMessage m_Current; + tMessage m_Stack[3]; +}; + +struct tPreviousBrief +{ + wchar *m_pText; + int32 m_nNumber[6]; + wchar *m_pString; +}; + +class CMessages +{ +public: + static tPreviousBrief *PreviousBriefs; + static tMessage *BriefMessages; + static tBigMessage *BIGMessages; + public: static void Display(void); static void ClearAllMessagesDisplayedByGame(void); + static int WideStringCopy(wchar* dst, wchar* src, unsigned short size); + static char WideStringCompare(wchar* str1, wchar* str2, unsigned short size); + static void InsertNumberInString(wchar* src, int n1, int n2, int n3, int n4, int n5, int n6, wchar* dst); + static void InsertPlayerControlKeysInString(wchar* src); + static int GetWideStringLength(wchar *src); }; diff --git a/src/Radar.cpp b/src/Radar.cpp index a84d5b91..3b2d6b26 100644 --- a/src/Radar.cpp +++ b/src/Radar.cpp @@ -1,5 +1,47 @@ #include "common.h" #include "patcher.h" #include "Radar.h" +#include "Camera.h" +#include "Hud.h" +#include "World.h" +#include "Frontend.h" WRAPPER void CRadar::ClearBlipForEntity(eBlipType type, int32 id) { EAXJMP(0x4A56C0); } +WRAPPER void CRadar::Draw3dMarkers() { EAXJMP(0x4A4C70); } +//WRAPPER void CRadar::DrawMap () { EAXJMP(0x4A4200); } +WRAPPER void CRadar::DrawBlips() { EAXJMP(0x4A42F0); } +WRAPPER void CRadar::DrawRadarMap() { EAXJMP(0x4A6C20); } + +Float &CRadar::m_RadarRange = *(Float*)0x8E281C; +CVector2D &CRadar::vec2DRadarOrigin = *(CVector2D*)0x6299B8; + +void CRadar::DrawMap() { + if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) { + if (FindPlayerVehicle()) { + if (FindPlayerVehicle()->GetSpeed().Magnitude() > 0.3f) { + if (FindPlayerVehicle()->GetSpeed().Magnitude() > 0.9f) + CRadar::m_RadarRange = 350.0f; + else + CRadar::m_RadarRange = (FindPlayerVehicle()->GetSpeed().Magnitude() + 0.3f) * 200.0f; + } + else { + CRadar::m_RadarRange = 120.0f; + } + } + else { + CRadar::m_RadarRange = 120.0f; + } + vec2DRadarOrigin.x = FindPlayerCentreOfWorld_NoSniperShift().x; + vec2DRadarOrigin.y = FindPlayerCentreOfWorld_NoSniperShift().y; + CRadar::DrawRadarMap(); + } +} + +void CRadar::TransformRadarPointToScreenSpace(CVector2D *out, CVector2D *in) { + out->x = in->x * SCREEN_STRETCH_X(47.0f) + SCREEN_STRETCH_X(47.0f + 20.0f); + out->y = (SCREEN_STRETCH_Y(76.0f)) * 0.5f + RsGlobal.height - (SCREEN_STRETCH_Y(123.0f)) - in->y * (SCREEN_STRETCH_Y(76.0f)) * 0.5f; +} + +STARTPATCHES + InjectHook(0x4A5040, CRadar::TransformRadarPointToScreenSpace, PATCH_JUMP); +ENDPATCHES \ No newline at end of file diff --git a/src/Radar.h b/src/Radar.h index 123cffb1..f5afcd6e 100644 --- a/src/Radar.h +++ b/src/Radar.h @@ -1,4 +1,5 @@ #pragma once +#include "Sprite2d.h" enum eBlipType { @@ -12,6 +13,15 @@ enum eBlipType class CRadar { +public: + static Float &m_RadarRange; + static CVector2D &vec2DRadarOrigin; + public: static void ClearBlipForEntity(eBlipType type, int32 id); + static void Draw3dMarkers(); + static void DrawMap(); + static void TransformRadarPointToScreenSpace(CVector2D * out, CVector2D * in); + static void DrawBlips(); + static void DrawRadarMap(); }; diff --git a/src/Timer.h b/src/Timer.h index fa93a65e..c369777a 100644 --- a/src/Timer.h +++ b/src/Timer.h @@ -20,6 +20,7 @@ public: static uint32 GetTimeInMilliseconds(void) { return m_snTimeInMilliseconds; } static inline Bool GetIsPaused() { return m_UserPause || m_CodePause; } + static inline Bool GetIsUserPaused() { return m_UserPause; } static inline void SetTimeScale(Float ts) { ms_fTimeScale = ts; } static void Initialise(void); diff --git a/src/Wanted.cpp b/src/Wanted.cpp new file mode 100644 index 00000000..36bc4f03 --- /dev/null +++ b/src/Wanted.cpp @@ -0,0 +1,3 @@ +#include "common.h" +#include "patcher.h" +#include "Wanted.h" diff --git a/src/Wanted.h b/src/Wanted.h new file mode 100644 index 00000000..cf24d5a5 --- /dev/null +++ b/src/Wanted.h @@ -0,0 +1,83 @@ +#pragma once +#include "Entity.h" +#include "math/Vector.h" + +enum eCrimeType { + CRIME_NONE, + CRIME_SHOT_FIRED, + CRIME_PED_FIGHT, + CRIME_COP_FIGHT, + CRIME_DAMAGED_PED, + CRIME_DAMAGED_COP, + CRIME_CAR_THEFT, + CRIME_CRIME7, + CRIME_COP_EVASIVE_DIVE, + CRIME_COP_EVASIVE_DIVE2, + CRIME_PED_RUN_OVER, + CRIME_COP_RUN_OVER, + CRIME_DESTROYED_HELI, + CRIME_PED_BURNED, + CRIME_COP_BURNED, + CRIME_VEHICLE_BURNED, + CRIME_DESTROYED_CESSNA, +}; + +enum eCopType { + COP_STREET = 0, + COP_FBI = 1, + COP_SWAT = 2, + COP_ARMY = 3, +}; + +class CCrime { +public: + eCrimeType m_eCrimeType; + CEntity *m_pVictim; + int32 m_nCrimeTime; + CVector m_vecCrimePos; + int8 m_bReported; + int8 m_bMultiplier; + int8 pad_20[2]; +}; + +class CCopPed { +public: + int16 m_wRoadblockNode; + int8 field_1342; + int8 field_1343; + Float m_fDistanceToTarget; + int8 m_bIsInPursuit; + int8 m_bIsDisabledCop; + int8 field_1350; + int8 field_1351; + int8 m_bZoneDisabledButClose; + int8 m_bZoneDisabled; + int8 field_1354; + int8 field_1355; + int32 field_1356; + eCopType m_nCopType; + int8 field_1364; + int8 field_1365; + int8 field_1366; + int8 field_1367; +}; + +class CWanted { +public: + int32 m_nChaos; + int32 m_nLastUpdateTime; + int32 m_nLastWantedLevelChange; + Float m_fCrimeSensitivity; + uint8 m_bCurrentCops; + uint8 m_bMaxCops; + uint8 m_bMaximumLawEnforcerVehicles; + int8 field_19; + int16 m_wRoadblockDensity; + uint8 m_bFlags; + int8 field_23; + int32 m_nWantedLevel; + CCrime m_sCrimes[16]; + CCopPed *m_pCops[10]; +}; + +static_assert(sizeof(CWanted) == 0x204, "CWanted: error"); diff --git a/src/World.cpp b/src/World.cpp index 7e408091..1d45dcc8 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -12,6 +12,8 @@ CPtrList &CWorld::ms_listMovingEntityPtrs = *(CPtrList*)0x8F433C; CSector (*CWorld::ms_aSectors)[NUMSECTORS_X] = (CSector (*)[NUMSECTORS_Y])0x665608; uint16 &CWorld::ms_nCurrentScanCode = *(uint16*)0x95CC64; +uint8 &CWorld::PlayerInFocus = *(uint8 *)0x95CD61; +CPlayerInfo *CWorld::Players = (CPlayerInfo *)0x9412F0; bool &CWorld::bNoMoreCollisionTorque = *(bool*)0x95CDCC; CEntity *&CWorld::pIgnoreEntity = *(CEntity**)0x8F6494; bool &CWorld::bIncludeDeadPeds = *(bool*)0x95CD8F; @@ -588,3 +590,6 @@ WRAPPER CPed *FindPlayerPed(void) { EAXJMP(0x4A1150); } WRAPPER CVector &FindPlayerCoors(CVector &v) { EAXJMP(0x4A1030); } WRAPPER CVehicle *FindPlayerVehicle(void) { EAXJMP(0x4A10C0); } WRAPPER CVehicle *FindPlayerTrain(void) { EAXJMP(0x4A1120); } +WRAPPER CVector FindPlayerSpeed(void) { EAXJMP(0x4A1090); } +WRAPPER CVector FindPlayerCentreOfWorld_NoSniperShift(void) { EAXJMP(0x4A11C0); } + diff --git a/src/World.h b/src/World.h index 2440906c..77e0fd99 100644 --- a/src/World.h +++ b/src/World.h @@ -2,6 +2,7 @@ #include "Game.h" #include "Lists.h" +#include "PlayerInfo.h" /* Sectors span from -2000 to 2000 in x and y. * With 100x100 sectors, each is 40x40 units. */ @@ -45,6 +46,8 @@ class CWorld static uint16 &ms_nCurrentScanCode; public: + static uint8 &PlayerInFocus; + static CPlayerInfo *Players; static CEntity *&pIgnoreEntity; static bool &bIncludeDeadPeds; static bool &bNoMoreCollisionTorque; @@ -95,3 +98,5 @@ CPed *FindPlayerPed(void); CVector &FindPlayerCoors(CVector &v); CVehicle *FindPlayerVehicle(void); CVehicle *FindPlayerTrain(void); +CVector FindPlayerSpeed(void); +CVector FindPlayerCentreOfWorld_NoSniperShift(void); \ No newline at end of file diff --git a/src/audio/DMAudio.h b/src/audio/DMAudio.h index 91a3ff0f..1b18c28c 100644 --- a/src/audio/DMAudio.h +++ b/src/audio/DMAudio.h @@ -1,5 +1,176 @@ #pragma once +enum eSound { + SOUND_CAR_DOOR_CLOSE_BONNET = 0, + SOUND_CAR_DOOR_CLOSE_BUMPER = 1, + SOUND_CAR_DOOR_CLOSE_FRONT_LEFT = 2, + SOUND_CAR_DOOR_CLOSE_FRONT_RIGHT = 3, + SOUND_CAR_DOOR_CLOSE_BACK_LEFT = 4, + SOUND_CAR_DOOR_CLOSE_BACK_RIGHT = 5, + SOUND_CAR_DOOR_OPEN_BONNET = 6, + SOUND_CAR_DOOR_OPEN_BUMPER = 7, + SOUND_CAR_DOOR_OPEN_FRONT_LEFT = 8, + SOUND_CAR_DOOR_OPEN_FRONT_RIGHT = 9, + SOUND_CAR_DOOR_OPEN_BACK_LEFT = 10, + SOUND_CAR_DOOR_OPEN_BACK_RIGHT = 11, + SOUND_CAR_WINDSHIELD_CRACK = 12, + SOUND_CAR_JUMP = 13, + SOUND_E = 14, + SOUND_F = 15, + SOUND_CAR_ENGINE_START = 16, + SOUND_CAR_LIGHT_BREAK = 17, + SOUND_CAR_HYDRALIC_1 = 18, + SOUND_CAR_HYDRALIC_2 = 19, + SOUND_CAR_HYDRALIC_3 = 20, + SOUND_CAR_JERK = 21, + SOUND_CAR_SPLASH = 22, + SOUND_17 = 23, + SOUND_18 = 24, + SOUND_19 = 25, + SOUND_CAR_TANK_TURRET_ROTATE = 26, + SOUND_CAR_BOMB_TICK = 27, + SOUND_PLANE_ON_GROUND = 28, + SOUND_STEP_START = 29, + SOUND_STEP_END = 30, + SOUND_FALL_LAND = 31, + SOUND_FALL_COLLAPSE = 32, + SOUND_21 = 33, + SOUND_22 = 34, + SOUND_23 = 35, + SOUND_24 = 36, + SOUND_25 = 37, + SOUND_26 = 38, + SOUND_WEAPON_PUNCH_ATTACK = 39, + SOUND_28 = 40, + SOUND_29 = 41, + SOUND_2A = 42, + SOUND_2B = 43, + SOUND_2C = 44, + SOUND_2D = 45, + SOUND_WEAPON_BAT_ATTACK = 46, + SOUND_WEAPON_SHOT_FIRED = 47, + SOUND_WEAPON_RELOAD = 48, + SOUND_31 = 49, + SOUND_32 = 50, + SOUND_33 = 51, + SOUND_WEAPON_FLAMETHROWER_FIRE = 52, + SOUND_WEAPON_SNIPER_SHOT_NO_ZOOM = 53, + SOUND_WEAPON_ROCKET_SHOT_NO_ZOOM = 54, + SOUND_WEAPON_HIT_PED = 55, + SOUND_WEAPON_HIT_VEHICLE = 56, + SOUND_GARAGE_NO_MONEY = 57, + SOUND_GARAGE_BAD_VEHICLE = 58, + SOUND_GARAGE_OPENING = 59, + SOUND_3C = 60, + SOUND_GARAGE_BOMB1_SET = 61, + SOUND_GARAGE_BOMB2_SET = 62, + SOUND_GARAGE_BOMB3_SET = 63, + SOUND_40 = 64, + SOUND_41 = 65, + SOUND_GARAGE_VEHICLE_DECLINED = 66, + SOUND_GARAGE_VEHICLE_ACCEPTED = 67, + SOUND_GARAGE_DOOR_CLOSED = 68, + SOUND_GARAGE_DOOR_OPENED = 69, + SOUND_CRANE_PICKUP = 70, + SOUND_PICKUP_WEAPON_BOUGHT = 71, + SOUND_PICKUP_WEAPON = 72, + SOUND_PICKUP_HEALTH = 73, + SOUND_4A = 74, + SOUND_4B = 75, + SOUND_PICKUP_ADRENALINE = 76, + SOUND_PICKUP_ARMOUR = 77, + SOUND_PICKUP_BONUS = 78, + SOUND_PICKUP_MONEY = 79, + SOUND_PICKUP_HIDDEN_PACKAGE = 80, + SOUND_PICKUP_PACMAN_PILL = 81, + SOUND_PICKUP_PACMAN_PACKAGE = 82, + SOUND_PICKUP_FLOAT_PACKAGE = 83, + SOUND_BOMB_TIMED_ACTIVATED = 84, + SOUND_55 = 85, + SOUND_BOMB_ONIGNITION_ACTIVATED = 86, + SOUND_BOMB_TICK = 87, + SOUND_RAMPAGE_START = 88, + SOUND_RAMPAGE_ONGOING = 89, + SOUND_RAMPAGE_PASSED = 90, + SOUND_RAMPAGE_FAILED = 91, + SOUND_RAMPAGE_KILL = 92, + SOUND_RAMPAGE_CAR_BLOWN = 93, + SOUND_EVIDENCE_PICKUP = 94, + SOUND_UNLOAD_GOLD = 95, + SOUND_PAGER = 96, + SOUND_PED_DEATH = 97, + SOUND_PED_DAMAGE = 98, + SOUND_PED_63 = 99, + SOUND_PED_LAND = 100, + SOUND_PED_BULLET_HIT = 101, + SOUND_PED_BOMBER = 102, + SOUND_PED_BURNING = 103, + SOUND_PED_ARREST_FBI = 104, + SOUND_PED_ARREST_SWAT = 105, + SOUND_PED_ARREST_COP = 106, + SOUND_PED_HELI_PLAYER_FOUND = 107, + SOUND_PED_HANDS_UP = 108, + SOUND_PED_HANDS_COWER = 109, + SOUND_PED_FLEE_SPRINT = 110, + SOUND_PED_CAR_JACKING = 111, + SOUND_PED_MUGGING = 112, + SOUND_PED_CAR_JACKED = 113, + SOUND_PED_ROBBED = 114, + SOUND_PED_TAXI_WAIT = 115, + SOUND_PED_ATTACK = 116, + SOUND_PED_DEFEND = 117, + SOUND_PED_PURSUIT_ARMY = 118, + SOUND_PED_PURSUIT_FBI = 119, + SOUND_PED_PURSUIT_SWAT = 120, + SOUND_PED_PURSUIT_COP = 121, + SOUND_PED_HEALING = 122, + SOUND_PED_7B = 123, + SOUND_PED_LEAVE_VEHICLE = 124, + SOUND_PED_EVADE = 125, + SOUND_PED_FLEE_RUN = 126, + SOUND_PED_CAR_COLLISION = 127, + SOUND_PED_SOLICIT = 128, + SOUND_PED_EXTINGUISHING_FIRE = 129, + SOUND_PED_WAIT_DOUBLEBACK = 130, + SOUND_PED_CHAT_SEXY = 131, + SOUND_PED_CHAT_EVENT = 132, + SOUND_PED_CHAT = 133, + SOUND_PED_BODYCAST_HIT = 134, + SOUND_PED_TAXI_CALL = 135, + SOUND_INJURED_PED_MALE_OUCH = 136, + SOUND_INJURED_PED_FEMALE = 137, + SOUND_8A = 138, + SOUND_RACE_START_3 = 139, + SOUND_RACE_START_2 = 140, + SOUND_RACE_START_1 = 141, + SOUND_RACE_START_GO = 142, + SOUND_SPLASH = 143, + SOUND_WATER_FALL = 144, + SOUND_SPLATTER = 145, + SOUND_CAR_PED_COLLISION = 146, + SOUND_CLOCK_TICK = 147, + SOUND_PART_MISSION_COMPLETE = 148, + SOUND_FRONTEND_MENU_STARTING = 149, + SOUND_FRONTEND_MENU_COMPLETED = 150, + SOUND_FRONTEND_MENU_DENIED = 151, + SOUND_FRONTEND_MENU_SUCCESS = 152, + SOUND_FRONTEND_EXIT = 153, + SOUND_9A = 154, + SOUND_9B = 155, + SOUND_FRONTEND_AUDIO_TEST = 156, + SOUND_FRONTEND_FAIL = 157, + SOUND_FRONTEND_NO_RADIO = 158, + SOUND_FRONTEND_RADIO_CHANGE = 159, + SOUND_A0 = 160, + SOUND_AMMUNATION_WELCOME_1 = 161, + SOUND_AMMUNATION_WELCOME_2 = 162, + SOUND_AMMUNATION_WELCOME_3 = 163, + SOUND_LIGHTNING = 164, + SOUND_A5 = 165, + SOUND_TOTAL_SOUNDS = 166, + SOUND_TOTAL_PED_SOUNDS = 167, +}; + class CEntity; class cDMAudio diff --git a/src/common.h b/src/common.h index 4187e0c3..966af022 100644 --- a/src/common.h +++ b/src/common.h @@ -67,7 +67,7 @@ extern void **rwengine; #define DEFAULT_SCREEN_HEIGHT (448) #define SCREEN_WIDTH Float(RsGlobal.width) #define SCREEN_HEIGHT Float(RsGlobal.height) -#define SCREEN_STRETCH_X(a) Float((a) * (SCREEN_WIDTH / Float(DEFAULT_SCREEN_WIDTH))) +#define SCREEN_STRETCH_X(a) Float((a) * (SCREEN_WIDTH / Float(DEFAULT_SCREEN_WIDTH))) * Float(1.33334f / (CMenuManager::m_PrefsUseWideScreen ? 16.0f / 9.0f : 4.0f / 3.0f)) #define SCREEN_STRETCH_Y(a) Float((a) * (SCREEN_HEIGHT / Float(DEFAULT_SCREEN_HEIGHT))) #define SCREEN_FROM_RIGHT(a) Float(SCREEN_WIDTH - SCREEN_STRETCH_X(a)) #define SCREEN_FROM_BOTTOM(a) Float(SCREEN_HEIGHT - SCREEN_STRETCH_Y(a)) diff --git a/src/control/Darkel.cpp b/src/control/Darkel.cpp index 95f3e176..e2d9fd72 100644 --- a/src/control/Darkel.cpp +++ b/src/control/Darkel.cpp @@ -3,3 +3,9 @@ #include "Darkel.h" WRAPPER void CDarkel::DrawMessages(void) { EAXJMP(0x420920); } + +bool CDarkel::Status = *(bool*)0x95CCB4; + +bool CDarkel::FrenzyOnGoing() { + return Status; +} \ No newline at end of file diff --git a/src/control/Darkel.h b/src/control/Darkel.h index 41cc69f8..ed78d4e1 100644 --- a/src/control/Darkel.h +++ b/src/control/Darkel.h @@ -2,6 +2,10 @@ class CDarkel { +private: + static bool Status; + public: static void DrawMessages(void); + static bool FrenzyOnGoing(); }; diff --git a/src/control/Replay.h b/src/control/Replay.h index 5d63db1f..2fe2f272 100644 --- a/src/control/Replay.h +++ b/src/control/Replay.h @@ -3,11 +3,12 @@ class CReplay { public: - static void Display(void); enum { MODE_1 = 1 }; static uint8 &Mode; static Bool &bPlayingBackFromFile; + + static void Display(void); }; diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 71fc7bcd..7cea978f 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -4,3 +4,6 @@ #include "Script.h" uint8 *CTheScripts::ScriptSpace = (uint8*)0x74B248; +CTextLine* CTheScripts::IntroTextLines = (CTextLine*)0x70EA74; +CScriptRectangle* CTheScripts::IntroRectangles = (CScriptRectangle*)0x72D109; +CSprite2d* CTheScripts::ScriptSprites = (CSprite2d*)0x72B090; diff --git a/src/control/Script.h b/src/control/Script.h index 6f329e1f..0fe35fd2 100644 --- a/src/control/Script.h +++ b/src/control/Script.h @@ -1,7 +1,42 @@ #pragma once +#include "Sprite2d.h" + +struct CScriptRectangle +{ + Bool m_bIsUsed; + Bool m_bIsAntialiased; + uint16 m_wTextureId; + CRect m_sRect; + CRGBA m_sColor; +}; + +struct CTextLine +{ + Float m_fScaleX; + Float m_fScaleY; + CRGBA m_sColor; + Bool m_bJustify; + Bool m_bCentered; + Bool m_bBackground; + Bool m_bBackgroundOnly; + Float m_fWrapX; + Float m_fCenterSize; + CRGBA m_sBackgroundColor; + Bool m_bTextProportional; + int32 field_29; + Bool m_bRightJustify; + int32 field_31; + int32 m_nFont; + Float field_36; + Float field_40; + wchar m_awText[500]; +}; class CTheScripts { public: static uint8 *ScriptSpace;//[160*1024] + static CTextLine* IntroTextLines; + static CScriptRectangle* IntroRectangles; + static CSprite2d* ScriptSprites; }; diff --git a/src/entities/Ped.cpp b/src/entities/Ped.cpp index 55e33a2d..90ee54be 100644 --- a/src/entities/Ped.cpp +++ b/src/entities/Ped.cpp @@ -6,7 +6,7 @@ Bool &CPed::bNastyLimbsCheat = *(Bool*)0x95CD44; Bool &CPed::bPedCheat2 = *(Bool*)0x95CD5A; Bool &CPed::bPedCheat3 = *(Bool*)0x95CD59; - + void *CPed::operator new(size_t sz) { return CPools::GetPedPool()->New(); } void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); } diff --git a/src/entities/Ped.h b/src/entities/Ped.h index adf24c88..28ad6624 100644 --- a/src/entities/Ped.h +++ b/src/entities/Ped.h @@ -2,6 +2,7 @@ #include "Physical.h" #include "Weapon.h" +#include "PathFind.h" enum { PED_MAX_WEAPONS = 13 @@ -163,13 +164,30 @@ public: int32 m_nPedState; int32 m_nLastPedState; int32 m_nMoveState; - uint8 stuff2[188]; + int32 m_nStoredActionState; + int32 m_nPrevActionState; + int32 m_nWaitState; + int32 m_nWaitTimer; +private: + uint32 stuff0[28]; +public: + uint16 m_nPathNodes; + uint8 m_nCurPathNode; + int8 m_nPathState; +private: + int8 _pad2B5[3]; +public: + CPathNode *m_pNextPathNode; + CPathNode *m_pLastPathNode; + Float m_fHealth; + Float m_fArmour; + uint8 stuff2[34]; CEntity *m_pCurrentPhysSurface; CVector m_vecOffsetFromPhysSurface; CEntity *m_pCurSurface; uint8 stuff3[16]; CVehicle *m_pMyVehicle; - bool bInVehicle; + Bool bInVehicle; uint8 stuff4[23]; int32 m_nPedType; @@ -188,7 +206,7 @@ public: bool UseGroundColModel(void); void KillPedWithCar(CVehicle *veh, float impulse); CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; } - + static Bool &bNastyLimbsCheat; static Bool &bPedCheat2; static Bool &bPedCheat3; diff --git a/src/entities/PlayerInfo.cpp b/src/entities/PlayerInfo.cpp new file mode 100644 index 00000000..796481a4 --- /dev/null +++ b/src/entities/PlayerInfo.cpp @@ -0,0 +1,3 @@ +#include "common.h" +#include "patcher.h" +#include "PlayerInfo.h" diff --git a/src/entities/PlayerInfo.h b/src/entities/PlayerInfo.h new file mode 100644 index 00000000..eb15f53f --- /dev/null +++ b/src/entities/PlayerInfo.h @@ -0,0 +1,71 @@ +#pragma once +#include "Automobile.h" +#include "PlayerPed.h" + +enum eWastedBustedState { + WBSTATE_PLAYING = 0x0, + WBSTATE_WASTED = 0x1, + WBSTATE_BUSTED = 0x2, + WBSTATE_FAILED_CRITICAL_MISSION = 0x3, +}; + +struct CCivilianPed { + +}; + +class CPlayerInfo { +public: + CPlayerPed *m_pPed; + CVehicle *m_pRemoteVehicle; + CColModel m_ColModel; + CVehicle *m_pVehicleEx; + char m_aszPlayerName[70]; +private: + int8 _pad0[2]; +public: + int32 m_nMoney; + int32 m_nVisibleMoney; + int32 m_nCollectedPackages; + int32 m_nTotalPackages; + int32 field_188; + int32 m_nSwitchTaxiTime; + Bool m_bSwitchTaxi; + int8 field_197; + int8 field_198; + int8 field_199; + int32 m_nNextSexFrequencyUpdateTime; + int32 m_nNextSexMoneyUpdateTime; + int32 m_nSexFrequency; + CCivilianPed *m_pHooker; + int8 m_bWBState; // eWastedBustedState + int8 field_217; + int8 field_218; + int8 field_219; + int32 m_nWBTime; + Bool m_bInRemoteMode; + int8 field_225; + int8 field_226; + int8 field_227; + int32 m_nTimeLostRemoteCar; + int32 m_nTimeLastHealthLoss; + int32 m_nTimeLastArmourLoss; + int32 field_240; + int32 m_nUpsideDownCounter; + int32 field_248; + int16 m_nTrafficMultiplier; + int8 field_254; + int8 field_255; + Float m_fRoadDensity; + int32 m_nPreviousTimeRewardedForExplosion; + int32 m_nExplosionsSinceLastReward; + int32 field_268; + int32 field_272; + Bool m_bInfiniteSprint; + Bool m_bFastReload; + Bool m_bGetOutOfJailFree; + Bool m_bGetOutOfHospitalFree; + uint8 m_aSkinName[32]; + RwTexture *m_pSkinTexture; +}; + +static_assert(sizeof(CPlayerInfo) == 0x13C, "CPlayerPed: error"); diff --git a/src/entities/PlayerPed.h b/src/entities/PlayerPed.h index 35128f46..6721f975 100644 --- a/src/entities/PlayerPed.h +++ b/src/entities/PlayerPed.h @@ -1,11 +1,42 @@ #pragma once #include "Ped.h" +#include "Wanted.h" -class CPlayerPed : public CPed -{ +class CPlayerPed : public CPed { public: - // 0x53C - uint8 stuff[180]; + CWanted *m_pWanted; + CCopPed *m_pArrestingCop; + Float m_fMoveSpeed; + Float m_fCurrentStamina; + Float m_fMaxStamina; + Float m_fStaminaProgress; + Bool m_bWeaponSlot; + Bool m_bSpeedTimerFlag; + Bool m_bShouldEvade; + int8 field_1367; + int32 m_nSpeedTimer; + int32 m_nShotDelay; + Float field_1376; + int8 field_1380; + int8 field_1381; + int8 field_1382; + int8 field_1383; + CEntity *m_pEvadingFrom; + int32 m_nTargettableObjects[4]; + Bool m_bAdrenalineActive; + Bool m_bHasLockOnTarget; + int8 field_1406; + int8 field_1407; + Bool m_bAdrenalineTime; + Bool m_bCanBeDamaged; + int8 field_1413; + int8 field_1414; + int8 field_1415; + CVector field_1416[6]; + int32 field_1488[6]; + Float field_1512; + Float m_fFPSMoveHeading; }; + static_assert(sizeof(CPlayerPed) == 0x5F0, "CPlayerPed: error"); diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp index 7c5a48ad..fd9a2d7e 100644 --- a/src/render/Draw.cpp +++ b/src/render/Draw.cpp @@ -36,4 +36,7 @@ CDraw::SetFOV(float fov) STARTPATCHES InjectHook(0x4FE7B0, CDraw::SetFOV, PATCH_JUMP); + + Nop(0x46B618, 2); + Patch(0x5F0A64, 1.3333334f); ENDPATCHES diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 0de5f5b0..8ff20e5a 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -1,8 +1,1298 @@ #include "common.h" #include "patcher.h" +#include "Camera.h" +#include "DMAudio.h" +#include "Clock.h" +#include "Darkel.h" #include "Hud.h" +#include "Messages.h" +#include "Frontend.h" +#include "Font.h" +#include "Pad.h" +#include "Radar.h" +#include "Replay.h" +#include "Sprite.h" +#include "Sprite2d.h" +#include "Text.h" +#include "Timer.h" +#include "Script.h" +#include "TxdStore.h" +#include "User.h" +#include "World.h" -bool &CHud::m_Wants_To_Draw_Hud = *(bool*)0x95CD89; +//WRAPPER void CHud::Draw(void) { EAXJMP(0x5052A0); } +//WRAPPER void CHud::DrawAfterFade(void) { EAXJMP(0x509030); } +WRAPPER void CHud::ReInitialise(void) { EAXJMP(0x504CC0); } +WRAPPER void CHud::GetRidOfAllHudMessages(void) { EAXJMP(0x504F90); } +WRAPPER void CHud::SetHelpMessage(wchar* message, bool quick) { EAXJMP(0x5051E0); } +WRAPPER void CHud::SetMessage(wchar* message) { EAXJMP(0x50A210); } +WRAPPER void CHud::SetBigMessage(wchar* message, int16 style) { EAXJMP(0x50A250); } +WRAPPER void CHud::SetPagerMessage(wchar* message) { EAXJMP(0x50A320); } -WRAPPER void CHud::Draw(void) { EAXJMP(0x5052A0); } -WRAPPER void CHud::DrawAfterFade(void) { EAXJMP(0x509030); } +wchar *CHud::m_HelpMessage = (wchar*)0x86B888; +wchar *CHud::m_LastHelpMessage = (wchar*)0x6E8F28; +int32 &CHud::m_HelpMessageState = *(int32*)0x880E1C; +int32 &CHud::m_HelpMessageTimer = *(int32*)0x880FA4; +int32 &CHud::m_HelpMessageFadeTimer = *(int32*)0x8F6258; +wchar *CHud::m_HelpMessageToPrint = (wchar*)0x664480; +Float &CHud::m_HelpMessageDisplayTime = *(Float*)0x8E2C28; +Float &CHud::m_fTextBoxNumLines = *(Float*)0x8E2C28; +Float &CHud::m_fHelpMessageTime = *(Float *)0x8E2C28; +Bool &CHud::m_bHelpMessageQuick = *(Bool *)0x95CCF7; +int32 CHud::m_ZoneState = *(int32*)0x8F29AC; +int32 CHud::m_ZoneFadeTimer; +int32 CHud::m_ZoneNameTimer = *(int32*)0x8F1A50; +wchar* &CHud::m_pZoneName = *(wchar **)0x8E2C2C; +wchar* CHud::m_pLastZoneName = (wchar*)0x8F432C; +wchar* CHud::m_ZoneToPrint; +int32 CHud::m_VehicleState = *(int32*)0x940560; +int32 CHud::m_VehicleFadeTimer; +int32 CHud::m_VehicleNameTimer = *(int32*)0x8F2A14; +wchar* &CHud::m_pVehicleName = *(wchar **)0x942FB4; +wchar* CHud::m_pLastVehicleName = *(wchar **)0x8E2DD8; +wchar* CHud::m_pVehicleNameToPrint; +wchar* CHud::m_Message = (wchar*)0x72E318; +wchar* CHud::m_PagerMessage = (wchar*)0x878840; +Bool &CHud::m_bRetuneInProgress = *(Bool*)0x650B80; +Bool &CHud::m_Wants_To_Draw_Hud = *(Bool*)0x95CD89; +Bool &CHud::m_Wants_To_Draw_3dMarkers = *(Bool*)0x95CD62; +wchar(*CHud::m_BigMessage)[128] = (wchar(*)[128])0x664CE0; +Float *CHud::BigMessageInUse = (Float*)0x862140; +Float *CHud::BigMessageAlpha = (Float*)0x862108; +Float *CHud::BigMessageX = (Float*)0x773248; + +Float &CHud::OddJob2OffTimer = *(Float*)0x942FA0; +int8 &CHud::CounterOnLastFrame = *(int8*)0x95CD67; +Float &CHud::OddJob2XOffset = *(Float*)0x8F1B5C; +int16 &CHud::CounterFlashTimer = *(int16*)0x95CC20; +int16 &CHud::OddJob2Timer = *(int16*)0x95CC52; +int8 &CHud::TimerOnLastFrame = *(int8*)0x95CDA7; +int16 &CHud::OddJob2On = *(int16*)0x95CC78; +int16 &CHud::TimerFlashTimer = *(int16*)0x95CC6C; +int16 &CHud::PagerSoundPlayed = *(int16*)0x95CC4A; +int32 &CHud::SpriteBrightness = *(int32*)0x95CC54; +Float &CHud::PagerXOffset = *(Float*)0x941590; +int32 CHud::m_ItemToFlash = *(int32*)0x95CC82; +int16 &CHud::PagerTimer = *(int16*)0x95CC3A; +int16 &CHud::PagerOn = *(int16*)0x95CCA0; + +CSprite2d *CHud::Sprites = (CSprite2d*)0x95CB9C; +char *HudNames[] = { "fist", + "fistm", + "bat", + "batm", + "pistol", + "pistolm", + "uzi", + "uzim", + "shotgun", + "shotgunm", + "ak47", + "ak47m", + "m16", + "m16m", + "sniper", + "sniperm", + "rocket", + "rocketm", + "flame", + "flamem", + "molotov", + "molotovm", + "grenade", + "grenadem", + "detonator", + "detonator_mask", + "", + "", + "", + "", + "radardisc", + "radardiscm", + "pager", + "pagerm", + "", + "", + "", + "", + "bleeder", + "", + "sitesniper", + "sitesniperm", + "siteM16", + "siteM16m", + "siterocket", + "siterocketm" + }; + +RwTexture* gpSniperSightTex = (RwTexture*)0x8F5834; +RwTexture* gpRocketSightTex = (RwTexture*)0x8E2C20; + +void CHud::Initialise() { + ReInitialise(); + + int HudTXD = CTxdStore::AddTxdSlot("hud"); + CTxdStore::LoadTxd(HudTXD, "MODELS/HUD.TXD"); + CTxdStore::AddRef(HudTXD); + CTxdStore::PopCurrentTxd(); + CTxdStore::SetCurrentTxd(HudTXD); + + for (int i = 0; i < 23; i++) { + Sprites[i].SetTexture(HudNames[i * 2]); + } + + gpSniperSightTex = RwTextureRead("sitesniper", 0); + gpRocketSightTex = RwTextureRead("siterocket", 0); + + CTxdStore::PopCurrentTxd(); +} + +void CHud::Shutdown() { + for (int i = 0; i < 23; ++i) { + Sprites[i].Delete(); + } + + RwTextureDestroy(gpSniperSightTex); + gpSniperSightTex = 0; + + RwTextureDestroy(gpRocketSightTex); + gpRocketSightTex = 0; + + int HudTXD = CTxdStore::FindTxdSlot("hud"); + CTxdStore::RemoveTxdSlot(HudTXD); +} + +void CHud::SetVehicleName(wchar* name) { + m_pVehicleName = name; +} + +void CHud::SetZoneName(wchar* name) { + m_pZoneName = name; +} + +void CHud::Draw() { + RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE); + RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); + RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); + RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); + RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSMIRROR); + RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)FALSE); + RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT); + RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR); + + if (CReplay::Mode != 1) { + if (m_Wants_To_Draw_Hud && !TheCamera.m_WideScreenOn) { + Bool Mode_RunAround = 0; + Bool Mode_FirstPerson = 0; + + int32 WeaponType = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_eWeaponType; + int32 Mode = TheCamera.Cams[TheCamera.ActiveCam].Mode; + + if (Mode == CCam::CamMode::MODE_SNIPER || Mode == CCam::CamMode::MODE_ROCKET || Mode == CCam::CamMode::MODE_M16FIRSTPERSON_34 || Mode == CCam::CamMode::MODE_EDITOR) + Mode_FirstPerson = 1; + if (Mode == CCam::CamMode::MODE_FIRSTPERSONPEDONPC_41 || Mode == CCam::CamMode::MODE_SNIPER_RUN_AROUND) + Mode_RunAround = 1; + + /* + Draw Crosshairs + */ + if (TheCamera.Cams->Using3rdPersonMouseCam() && (!CPad::GetPad(0)->GetLookBehindForPed() || TheCamera.m_bPlayerIsInGarage) || Mode == 40) { + if (CWorld::Players[CWorld::PlayerInFocus].m_pPed) { + int32 State = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_nPedState; + if (State != PED_ENTER_CAR && State != PED_CARJACK) { + if ((WeaponType >= WEAPONTYPE_COLT45 && WeaponType <= WEAPONTYPE_M16) || WeaponType == WEAPONTYPE_FLAMETHROWER) + Mode_RunAround = 1; + } + } + } + + if (Mode_FirstPerson || Mode_RunAround) { + RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void *)rwFILTERLINEAR); + + int32 SpriteBrightLikeADiamond = CHud::SpriteBrightness + 1; + if (SpriteBrightLikeADiamond > 30) + SpriteBrightLikeADiamond = 30; + + CHud::SpriteBrightness = SpriteBrightLikeADiamond; + + RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); + + Float fStep = sin((CTimer::GetTimeInMilliseconds() & 1023) * 0.0061328127); + Float fMultBright = CHud::SpriteBrightness * 0.033333335f * (0.25f * fStep + 0.75f); + CRect rect; + + float fWidescreenOffset[2] = { 0.0f, 0.0f }; + + if (CMenuManager::m_PrefsUseWideScreen) { + fWidescreenOffset[0] = 0.0f; + fWidescreenOffset[1] = SCREEN_STRETCH_Y(18.0f); + } + + if (Mode_RunAround && TheCamera.Cams->Using3rdPersonMouseCam()) { + Float f3rdX = RsGlobal.maximumWidth * TheCamera.m_f3rdPersonCHairMultX + fWidescreenOffset[0]; + Float f3rdY = RsGlobal.maximumHeight * TheCamera.m_f3rdPersonCHairMultY - fWidescreenOffset[1]; + + if (CWorld::Players[CWorld::PlayerInFocus].m_pPed && WeaponType == WEAPONTYPE_M16) { + rect.left = f3rdX - SCREEN_STRETCH_X(32.0f * 0.6f); + rect.top = f3rdY - SCREEN_STRETCH_Y(32.0f * 0.6f); + rect.right = f3rdX + SCREEN_STRETCH_X(32.0f * 0.6f); + rect.bottom = f3rdY + SCREEN_STRETCH_Y(32.0f * 0.6f); + + CHud::Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); + } + else { + rect.left = f3rdX - SCREEN_STRETCH_X(32.0f * 0.4f); + rect.top = f3rdY - SCREEN_STRETCH_Y(32.0f * 0.4f); + rect.right = f3rdX + SCREEN_STRETCH_X(32.0f * 0.4f); + rect.bottom = f3rdY + SCREEN_STRETCH_Y(32.0f * 0.4f); + + CHud::Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); + } + } + else { + if (Mode != CCam::CamMode::MODE_M16FIRSTPERSON_34 && Mode != CCam::CamMode::MODE_FIRSTPERSONPEDONPC_41 && Mode != CCam::CamMode::MODE_EDITOR) { + if (Mode == CCam::CamMode::MODE_ROCKET_RUN_AROUND) { + rect.left = (SCREEN_WIDTH / 2) - SCREEN_STRETCH_X(32.0f * 0.7f); + rect.top = (SCREEN_HEIGHT / 2) - SCREEN_STRETCH_Y(32.0f * 0.7f); + rect.right = (SCREEN_WIDTH / 2) + SCREEN_STRETCH_X(32.0f * 0.7f); + rect.bottom = (SCREEN_HEIGHT / 2) + SCREEN_STRETCH_Y(32.0f * 0.7f); + + CHud::Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); + } + else if (Mode != CCam::CamMode::MODE_ROCKET && Mode != CCam::CamMode::MODE_SNIPER_RUN_AROUND) { + rect.left = (SCREEN_WIDTH / 2) - SCREEN_STRETCH_X(210.0f); + rect.top = (SCREEN_HEIGHT / 2) - SCREEN_STRETCH_Y(210.0f); + rect.right = SCREEN_WIDTH / 2; + rect.bottom = SCREEN_HEIGHT / 2; + CHud::Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); + + rect.right = (SCREEN_WIDTH / 2); + rect.top = (SCREEN_HEIGHT / 2) - SCREEN_STRETCH_Y(210.0f); + rect.left = SCREEN_STRETCH_X(210.0f) + (SCREEN_WIDTH / 2); + rect.bottom = SCREEN_HEIGHT / 2; + CHud::Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); + + rect.left = (SCREEN_WIDTH / 2) - SCREEN_STRETCH_X(210.0f); + rect.bottom = (SCREEN_HEIGHT / 2); + rect.right = (SCREEN_WIDTH / 2); + rect.top = SCREEN_STRETCH_Y(210.0f) + (SCREEN_HEIGHT / 2); + CHud::Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); + + rect.right = (SCREEN_WIDTH / 2); + rect.bottom = (SCREEN_HEIGHT / 2); + rect.left = SCREEN_STRETCH_X(210.0f) + (SCREEN_WIDTH / 2); + rect.top = SCREEN_STRETCH_Y(210.0f) + (SCREEN_HEIGHT / 2); + CHud::Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); + } + else { + RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE); + RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDONE); + RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDONE); + RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); + RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE); + RwRenderStateSet(rwRENDERSTATETEXTURERASTER, gpRocketSightTex->raster); + + CSprite::RenderOneXLUSprite(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 1.0f, SCREEN_STRETCH_X(40.0f), SCREEN_STRETCH_Y(40.0f), (100.0f * fMultBright), (200.0f * fMultBright), (100.0f * fMultBright), 255, 1.0f, 255); + } + } + else { + rect.left = (SCREEN_WIDTH / 2) - SCREEN_STRETCH_X(32.0f); + rect.top = (SCREEN_HEIGHT / 2) - SCREEN_STRETCH_Y(32.0f); + rect.right = (SCREEN_WIDTH / 2) + SCREEN_STRETCH_X(32.0f); + rect.bottom = (SCREEN_HEIGHT / 2) + SCREEN_STRETCH_Y(32.0f); + CHud::Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); + } + } + RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void *)rwFILTERLINEAR); + RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDSRCALPHA); + RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDINVSRCALPHA); + } + else { + CHud::SpriteBrightness = 0; + } + + /* + DrawMoneyCounter + */ + wchar sPrint[16]; + wchar sPrintIcon[16]; + char sTemp[16]; + + sprintf(sTemp, "$%08d", CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney); + AsciiToUnicode(sTemp, sPrint); + + CFont::SetPropOff(); + CFont::SetBackgroundOff(); + CFont::SetScale(SCREEN_STRETCH_X(0.8f), SCREEN_STRETCH_Y(1.35f)); + CFont::SetCentreOff(); + CFont::SetRightJustifyOn(); + CFont::SetRightJustifyWrap(0.0f); + CFont::SetBackGroundOnlyTextOff(); + CFont::SetFontStyle(FONT_HEADING); + CFont::SetPropOff(); + CFont::SetColor(CRGBA(0, 0, 0, 255)); + + CFont::PrintString(SCREEN_FROM_RIGHT(110.0f - 2.0f), SCREEN_STRETCH_Y(43.0f + 2.0f), sPrint); + + CFont::SetColor(CRGBA(89, 115, 150, 255)); + CFont::PrintString(SCREEN_FROM_RIGHT(110.0f), SCREEN_STRETCH_Y(43.0f), sPrint); + + /* + DrawClock + */ + sprintf(sTemp, "%02d:%02d", CClock::GetHours(), CClock::GetMinutes()); + AsciiToUnicode(sTemp, sPrint); + + CFont::SetColor(CRGBA(0, 0, 0, 255)); + + CFont::PrintString(SCREEN_FROM_RIGHT(111.0f - 2.0f), SCREEN_STRETCH_Y(22.0f + 2.0f), sPrint); + + CFont::SetColor(CRGBA(194, 165, 120, 255)); + CFont::PrintString(SCREEN_FROM_RIGHT(111.0f), SCREEN_STRETCH_Y(22.0f), sPrint); + + /* + DrawAmmo + */ + int32 AmmoInClip = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoInClip; + int32 TotalAmmo = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoTotal; + + if (AmmoInClip <= 1 || AmmoInClip >= 1000) { + sprintf(sTemp, "%d", TotalAmmo); + } + else { + if (WeaponType == WEAPONTYPE_FLAMETHROWER) { + int tot_min_clip_div_10 = (TotalAmmo - AmmoInClip) / 10; + if (tot_min_clip_div_10 > 9999) + tot_min_clip_div_10 = 9999; + + sprintf(sTemp, "%d-%d", tot_min_clip_div_10, AmmoInClip / 10); + } + else { + if (AmmoInClip > 9999) + AmmoInClip = 9999; + sprintf(sTemp, "%d-%d", (TotalAmmo - AmmoInClip), AmmoInClip); + } + } + + AsciiToUnicode(sTemp, sPrint); + + CFont::SetBackgroundOff(); + CFont::SetScale(SCREEN_STRETCH_X(0.4f), SCREEN_STRETCH_Y(0.6f)); + CFont::SetJustifyOff(); + CFont::SetCentreOn(); + CFont::SetCentreSize(SCREEN_STRETCH_X(640.0f)); + CFont::SetPropOn(); + CFont::SetFontStyle(FONT_BANK); + + if (!CDarkel::FrenzyOnGoing()) { + if (WeaponType) { + if (WeaponType != 1) { + CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::PrintString(SCREEN_FROM_RIGHT(66.0f), SCREEN_STRETCH_Y(73.0f), sPrint); + } + } + } + + /* + DrawWeaponIcon + */ + CHud::Sprites[WeaponType].Draw( + CRect(SCREEN_FROM_RIGHT(99.0f), SCREEN_STRETCH_Y(27.0f), SCREEN_FROM_RIGHT(35.0f), SCREEN_STRETCH_Y(91.0f)), + CRGBA(255, 255, 255, 255), + 0.015f, + 0.015f, + 1.0f, + 0.0f, + 0.015f, + 1.0f, + 1.0f, + 1.0f); + + /* + DrawHealth + */ + CFont::SetBackgroundOff(); + CFont::SetScale(SCREEN_STRETCH_X(0.8f), SCREEN_STRETCH_Y(1.35f)); + CFont::SetJustifyOff(); + CFont::SetCentreOff(); + CFont::SetRightJustifyWrap(0.0f); + CFont::SetRightJustifyOn(); + CFont::SetPropOff(); + CFont::SetFontStyle(FONT_HEADING); + + if (CHud::m_ItemToFlash == 4 && CTimer::GetFrameCounter() & 8 + || CHud::m_ItemToFlash != 4 + || CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fHealth < 10 + && CTimer::GetFrameCounter() & 8) { + if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fHealth >= 10 + || CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fHealth < 10 && CTimer::GetFrameCounter() & 8) { + + AsciiToUnicode("[", sPrintIcon); + sprintf(sTemp, "%03d", (int32)CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fHealth); + AsciiToUnicode(sTemp, sPrint); + + CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::PrintString(SCREEN_FROM_RIGHT(110.0f - 2.0f), SCREEN_STRETCH_Y(65.0f + 2.0f), sPrint); + + if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) { + CFont::PrintString(SCREEN_FROM_RIGHT(164.0f - 2.0f), SCREEN_STRETCH_Y(65.0f + 2.0f), sPrintIcon); + } + CFont::SetColor(CRGBA(186, 101, 50, 255)); + + CFont::PrintString(SCREEN_FROM_RIGHT(110.0f), SCREEN_STRETCH_Y(65.0f), sPrint); + + if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) { + CFont::PrintString(SCREEN_FROM_RIGHT(164.0f), SCREEN_STRETCH_Y(65.0f), sPrintIcon); + } + } + } + + /* + DrawArmour + */ + if (CHud::m_ItemToFlash == 3 && CTimer::GetFrameCounter() & 8 || CHud::m_ItemToFlash != 3) { + CFont::SetScale(SCREEN_STRETCH_X(0.8f), SCREEN_STRETCH_Y(1.35f)); + if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fArmour > 1.0f) { + AsciiToUnicode("[", sPrintIcon); + sprintf(sTemp, "%03d", (int32)CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fArmour); + AsciiToUnicode(sTemp, sPrint); + + CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::PrintString(SCREEN_FROM_RIGHT(182.0f - 2.0f), SCREEN_STRETCH_Y(65.0f + 2.0f), sPrint); + + if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 4) { + CFont::PrintString(SCREEN_FROM_RIGHT(234.0f - 2.0f), SCREEN_STRETCH_Y(65.0f + 2.0f), sPrintIcon); + } + + CFont::SetColor(CRGBA(124, 140, 95, 255)); + + CFont::PrintString(SCREEN_FROM_RIGHT(182.0f), SCREEN_STRETCH_Y(65.0f), sPrint); + + if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 1) { + CFont::PrintString(SCREEN_FROM_RIGHT(234.0f), SCREEN_STRETCH_Y(65.0f), sPrintIcon); + } + } + } + + /* + DrawWantedLevel + */ + CFont::SetBackgroundOff(); + CFont::SetScale(SCREEN_STRETCH_X(0.8f), SCREEN_STRETCH_Y(1.35f)); + CFont::SetJustifyOff(); + CFont::SetCentreOff(); + CFont::SetRightJustifyOff(); + CFont::SetPropOn(); + CFont::SetFontStyle(FONT_HEADING); + + AsciiToUnicode("]", sPrintIcon); + + for (int i = 0; i < 6; i++) { + CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::PrintString(2.0f + SCREEN_FROM_RIGHT(60.0f - 2.0f + 23.0f * i), SCREEN_STRETCH_Y(87.0f + 2.0f), sPrintIcon); + if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel > i + && (CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nLastWantedLevelChange + + 2000 || CTimer::GetFrameCounter() & 4)) { + + CFont::SetColor(CRGBA(193, 164, 120, 255)); + CFont::PrintString(SCREEN_FROM_RIGHT(60.0f + 23.0f * i), SCREEN_STRETCH_Y(87.0f), sPrintIcon); + } + } + + /* + DrawZoneName + */ + if (CHud::m_pZoneName) { + Float fZoneAlpha = 0.0f; + + if (CHud::m_pZoneName != CHud::m_pLastZoneName) { + switch (CHud::m_ZoneState) { + case 0: + CHud::m_ZoneState = 2; + CHud::m_ZoneToPrint = CHud::m_pZoneName; + CHud::m_ZoneNameTimer = 0; + CHud::m_ZoneFadeTimer = 0; + break; + case 1: + case 2: + case 3: + case 4: + CHud::m_ZoneNameTimer = 0; + CHud::m_ZoneState = 4; + break; + default: + break; + } + CHud::m_pLastZoneName = CHud::m_pZoneName; + } + + if (CHud::m_ZoneState) { + switch (CHud::m_ZoneState) { + case 1: + if (CHud::m_ZoneNameTimer > 10000) { + CHud::m_ZoneFadeTimer = 1000; + CHud::m_ZoneState = 3; + } + fZoneAlpha = 255.0f; + break; + case 2: + CHud::m_ZoneFadeTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f); + if (CHud::m_ZoneFadeTimer > 1000) { + CHud::m_ZoneState = 1; + CHud::m_ZoneFadeTimer = 1000; + } + fZoneAlpha = CHud::m_ZoneFadeTimer * 0.001f * 255.0f; + break; + case 3: + CHud::m_ZoneFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f); + if (CHud::m_ZoneFadeTimer < 0) { + CHud::m_ZoneState = 0; + CHud::m_ZoneFadeTimer = 0; + } + fZoneAlpha = CHud::m_ZoneFadeTimer * 0.001f * 255.0f; + break; + case 4: + CHud::m_ZoneFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f); + if (CHud::m_ZoneFadeTimer < 0) { + CHud::m_ZoneFadeTimer = 0; + CHud::m_ZoneToPrint = CHud::m_pLastZoneName; + CHud::m_ZoneNameTimer = 0; + CHud::m_ZoneState = 2; + } + fZoneAlpha = CHud::m_ZoneFadeTimer * 0.001f * 255.0f; + break; + default: + break; + + } + if (!CHud::m_Message[0]) { + CHud::m_ZoneNameTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f); + CFont::SetJustifyOff(); + CFont::SetPropOn(); + CFont::SetBackgroundOff(); + + if (CMenuManager::m_PrefsLanguage == 4) + CFont::SetScale(SCREEN_STRETCH_X(1.2f * 0.8f), SCREEN_STRETCH_Y(1.2f)); + else + CFont::SetScale(SCREEN_STRETCH_X(1.2f), SCREEN_STRETCH_Y(1.2f)); + + CFont::SetRightJustifyOn(); + CFont::SetRightJustifyWrap(0.0f); + CFont::SetBackGroundOnlyTextOff(); + CFont::SetFontStyle(FONT_BANK); + CFont::SetColor(CRGBA(0, 0, 0, fZoneAlpha)); + CFont::PrintString(SCREEN_FROM_RIGHT(32.0f - 1.0f), SCREEN_FROM_BOTTOM(30.0f - 1.0f), CHud::m_ZoneToPrint); + + CFont::SetColor(CRGBA(152, 154, 82, fZoneAlpha)); + CFont::PrintString(SCREEN_FROM_RIGHT(32.0f), SCREEN_FROM_BOTTOM(30.0f), CHud::m_ZoneToPrint); + } + } + } + else { + CHud::m_pLastZoneName = 0; + CHud::m_ZoneState = 0; + CHud::m_ZoneFadeTimer = 0; + CHud::m_ZoneNameTimer = 0; + } + + /* + DrawVehicleName + */ + if (CHud::m_pVehicleName) { + Float fVehicleAlpha = 0.0f; + + if (CHud::m_pVehicleName != CHud::m_pLastVehicleName) { + switch (CHud::m_VehicleState) { + case 0: + CHud::m_VehicleState = 2; + CHud::m_pVehicleNameToPrint = CHud::m_pVehicleName; + CHud::m_VehicleNameTimer = 0; + CHud::m_VehicleFadeTimer = 0; + break; + case 1: + case 2: + case 3: + case 4: + CHud::m_VehicleNameTimer = 0; + CHud::m_VehicleState = 4; + break; + default: + break; + } + CHud::m_pLastVehicleName = CHud::m_pVehicleName; + } + + if (CHud::m_VehicleState) { + switch (CHud::m_VehicleState) { + case 1: + if (CHud::m_VehicleNameTimer > 10000) { + CHud::m_VehicleFadeTimer = 1000; + CHud::m_VehicleState = 3; + } + fVehicleAlpha = 255.0f; + break; + case 2: + CHud::m_VehicleFadeTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f); + if (CHud::m_VehicleFadeTimer > 1000) { + CHud::m_VehicleState = 1; + CHud::m_VehicleFadeTimer = 1000; + } + fVehicleAlpha = CHud::m_VehicleFadeTimer * 0.001f * 255.0f; + break; + case 3: + CHud::m_VehicleFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f); + if (CHud::m_VehicleFadeTimer < 0) { + CHud::m_VehicleState = 0; + CHud::m_VehicleFadeTimer = 0; + } + fVehicleAlpha = CHud::m_VehicleFadeTimer * 0.001f * 255.0f; + break; + case 4: + CHud::m_VehicleFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f); + if (CHud::m_VehicleFadeTimer < 0) { + CHud::m_VehicleFadeTimer = 0; + CHud::m_pVehicleNameToPrint = CHud::m_pLastVehicleName; + CHud::m_VehicleNameTimer = 0; + CHud::m_VehicleState = 2; + } + fVehicleAlpha = CHud::m_VehicleFadeTimer * 0.001f * 255.0f; + break; + default: + break; + } + + if (!CHud::m_Message[0]) { + CHud::m_VehicleNameTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f); + CFont::SetJustifyOff(); + CFont::SetPropOn(); + CFont::SetBackgroundOff(); + + if (CMenuManager::m_PrefsLanguage != 3 && CMenuManager::m_PrefsLanguage != 4) + CFont::SetScale(SCREEN_STRETCH_X(1.2f), SCREEN_STRETCH_Y(1.2f)); + else + CFont::SetScale(SCREEN_STRETCH_X(1.2f * 0.85f), SCREEN_STRETCH_Y(1.2f)); + + CFont::SetRightJustifyOn(); + CFont::SetRightJustifyWrap(0.0f); + CFont::SetBackGroundOnlyTextOff(); + CFont::SetFontStyle(FONT_BANK); + CFont::SetColor(CRGBA(0, 0, 0, fVehicleAlpha)); + CFont::PrintString(SCREEN_FROM_RIGHT(32.0f - 1.0f), SCREEN_FROM_BOTTOM(55.0f - 1.0f), CHud::m_pVehicleNameToPrint); + + CFont::SetColor(CRGBA(194, 165, 120, fVehicleAlpha)); + CFont::PrintString(SCREEN_FROM_RIGHT(32.0f), SCREEN_FROM_BOTTOM(55.0f), CHud::m_pVehicleNameToPrint); + } + } + } + else { + CHud::m_pLastVehicleName = 0; + CHud::m_VehicleState = 0; + CHud::m_VehicleFadeTimer = 0; + CHud::m_VehicleNameTimer = 0; + } + + /* + DrawOnScreenTimer + */ + wchar sTimer[16]; + if (!CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerProcessed) + TimerOnLastFrame = 0; + if (!CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterProcessed) + CounterOnLastFrame = 0; + + if (CUserDisplay::OnscnTimer.m_bProcessed == 1) { + if (CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerProcessed == 1) { + if (!TimerOnLastFrame) + TimerFlashTimer = 1; + + TimerOnLastFrame = 1; + + if (TimerFlashTimer) { + if (++TimerFlashTimer > 50) + TimerFlashTimer = 0; + } + + if (CTimer::GetFrameCounter() & 4 || !TimerFlashTimer) { + AsciiToUnicode(CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerBuffer, sTimer); + CFont::SetPropOn(); + CFont::SetBackgroundOff(); + CFont::SetScale(SCREEN_STRETCH_X(0.8f), SCREEN_STRETCH_Y(1.35f)); + CFont::SetRightJustifyOn(); + CFont::SetRightJustifyWrap(0.0f); + CFont::SetFontStyle(FONT_HEADING); + CFont::SetPropOff(); + CFont::SetBackGroundOnlyTextOn(); + CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::PrintString(SCREEN_FROM_RIGHT(27.0f - 2.0f), SCREEN_STRETCH_Y(110.0f + 2.0f), sTimer); + + CFont::SetScale(SCREEN_STRETCH_X(0.8f), SCREEN_STRETCH_Y(1.35f)); + CFont::SetColor(CRGBA(186, 101, 50, 255)); + CFont::PrintString(SCREEN_FROM_RIGHT(27.0f), SCREEN_STRETCH_Y(110.0f), sTimer); + + if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText[0]) { + CFont::SetPropOn(); + CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::SetScale(SCREEN_STRETCH_X(0.8f), SCREEN_STRETCH_Y(1.35f)); + CFont::PrintString(SCREEN_FROM_RIGHT(27.0f + 78.0f), SCREEN_STRETCH_Y(110.0f + 2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); + + CFont::SetColor(CRGBA(186, 101, 50, 255)); + CFont::PrintString(SCREEN_FROM_RIGHT(27.0f + 80.0f), SCREEN_STRETCH_Y(110.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); + } + } + } + if (CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterProcessed == 1) { + if (!CounterOnLastFrame) + CounterFlashTimer = 1; + + CounterOnLastFrame = 1; + + if (CounterFlashTimer) { + if (++CounterFlashTimer > 50) + CounterFlashTimer = 0; + } + + if (CTimer::GetFrameCounter() & 4 || !CounterFlashTimer) { + if (CUserDisplay::OnscnTimer.m_sEntries[0].m_nType) { + CSprite2d::DrawRect(CRect(SCREEN_FROM_RIGHT(127.0f - 4.0f), SCREEN_STRETCH_Y(132.0 + 8.0f), SCREEN_FROM_RIGHT(23.0f), SCREEN_STRETCH_Y(11.0f + 132.0f + 8.0f)), CRGBA(0, 106, 164, 80)); + CSprite2d::DrawRect(CRect(SCREEN_FROM_RIGHT(127.0f + 4.0f), SCREEN_STRETCH_Y(132.0 + 8.0f), SCREEN_FROM_RIGHT(atoi(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer) + 27.0f + 100.0f + 4.0f), SCREEN_STRETCH_Y(11.0f + 132.0f + 8.0f)), CRGBA(0, 106, 164, 255)); + } + else { + AsciiToUnicode(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer, sTimer); + + CFont::SetPropOn(); + CFont::SetBackgroundOff(); + CFont::SetScale(SCREEN_STRETCH_X(0.8f), SCREEN_STRETCH_Y(1.35f)); + CFont::SetCentreOff(); + CFont::SetRightJustifyOn(); + CFont::SetRightJustifyWrap(0.0f); + CFont::SetFontStyle(FONT_HEADING); + CFont::SetColor(CRGBA(244, 20, 20, 255)); + CFont::SetWrapx(SCREEN_STRETCH_X(640.0f)); + CFont::SetPropOff(); + CFont::SetBackGroundOnlyTextOn(); + CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::PrintString(SCREEN_FROM_RIGHT(27.0f - 2.0f), SCREEN_STRETCH_Y(132.0f + 2.0f), sTimer); + + CFont::SetColor(CRGBA(0, 106, 164, 255)); + CFont::PrintString(SCREEN_FROM_RIGHT(27.0f), SCREEN_STRETCH_Y(132.0f), sTimer); + } + + if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText[0]) { + CFont::SetPropOn(); + CFont::SetScale(SCREEN_STRETCH_X(0.8f), SCREEN_STRETCH_Y(1.35f)); + + CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::PrintString(SCREEN_FROM_RIGHT(27.0f + 59.0f), SCREEN_STRETCH_Y(132.0f + 2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); + + CFont::SetColor(CRGBA(0, 106, 164, 255)); + CFont::PrintString(SCREEN_FROM_RIGHT(27.0f + 61.0f), SCREEN_STRETCH_Y(132.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); + } + } + } + } + + /* + DrawPager + */ + if (!m_PagerMessage[0]) { + if (PagerOn == 1) { + PagerSoundPlayed = false; + PagerOn = 2; + } + } + if (m_PagerMessage[0] || PagerOn == 2) { + if (!PagerOn) { + PagerOn = 1; + PagerXOffset = 150.0f; + } + if (PagerOn == 1) { + if (PagerXOffset > 0.0f) { + Float fStep = PagerXOffset * 0.05f; + if (fStep > 10.0f) + fStep = 10.0f; + PagerXOffset -= fStep * CTimer::GetTimeStep(); + } + if (!PagerSoundPlayed) { + DMAudio.PlayFrontEndSound(96, 0); + PagerSoundPlayed = 1; + } + } + else if (PagerOn == 2) { + Float fStep = PagerXOffset * 0.05f; + if (fStep < 2.0f) + fStep = 2.0f; + PagerXOffset += fStep * CTimer::GetTimeStep(); + if (PagerXOffset > 150.0f) { + PagerXOffset = 150.0; + PagerOn = 0; + } + } + + CHud::Sprites[HUD_PAGER].Draw(CRect(SCREEN_STRETCH_X(26.0f - PagerXOffset), SCREEN_STRETCH_Y(27.0f), SCREEN_STRETCH_X(160.0 + 26.0f - PagerXOffset), SCREEN_STRETCH_Y(80.0f + 27.0f)), CRGBA(255, 255, 255, 255)); + + CFont::SetBackgroundOff(); + CFont::SetScale(SCREEN_STRETCH_X(0.84f), SCREEN_STRETCH_Y(1.0f)); + CFont::SetColor(CRGBA(32, 162, 66, 205)); + CFont::SetRightJustifyOff(); + CFont::SetBackgroundOff(); + CFont::SetCentreOff(); + CFont::SetJustifyOff(); + CFont::SetPropOff(); + CFont::SetFontStyle(FONT_PAGER); + CFont::PrintString(SCREEN_STRETCH_X(52.0f - PagerXOffset), SCREEN_STRETCH_Y(54.0f), CHud::m_PagerMessage); + } + + /* + DrawRadar + */ + if (CHud::m_ItemToFlash == 8 && CTimer::GetFrameCounter() & 8 || CHud::m_ItemToFlash != 8) { + CRadar::DrawMap(); + CHud::Sprites[HUD_RADARDISC].Draw(CRect(SCREEN_STRETCH_X(16.0f), SCREEN_FROM_BOTTOM(123.0f + 4.0f), SCREEN_STRETCH_X(94.0f + 20.0f + 5.0f), SCREEN_FROM_BOTTOM(-76.0f + 123.0f - 6.0f)), CRGBA(0, 0, 0, 255)); + CRadar::DrawBlips(); + } + } + + /* + Draw3dMarkers + */ + if (CHud::m_Wants_To_Draw_3dMarkers && !TheCamera.m_WideScreenOn && !CHud::m_BigMessage[0][0] && !CHud::m_BigMessage[2][0]) { + CRadar::Draw3dMarkers(); + } + + /* + DrawScriptText + */ + if (!CTimer::GetIsUserPaused()) { + uint16 CounterA = 0; + uint16 CounterB = 0; + CTextLine* IntroText = CTheScripts::IntroTextLines; + + do { + if (CTheScripts::IntroTextLines[CounterB].m_awText[0] && CTheScripts::IntroTextLines[CounterB].field_29) { + CFont::SetScale(SCREEN_STRETCH_X(CTheScripts::IntroTextLines[CounterB].m_fScaleX), SCREEN_STRETCH_Y(CTheScripts::IntroTextLines[CounterB].m_fScaleY * 0.5f)); + CFont::SetColor(CTheScripts::IntroTextLines[CounterB].m_sColor); + + if (CTheScripts::IntroTextLines[CounterB].m_bJustify) + CFont::SetJustifyOn(); + else + CFont::SetJustifyOff(); + + if (CTheScripts::IntroTextLines[CounterB].m_bRightJustify) + CFont::SetRightJustifyOn(); + else + CFont::SetRightJustifyOff(); + + if (CTheScripts::IntroTextLines[CounterB].m_bCentered) + CFont::SetCentreOn(); + else + CFont::SetCentreOff(); + + CFont::SetWrapx(SCREEN_STRETCH_X(CTheScripts::IntroTextLines[CounterB].m_fWrapX)); + CFont::SetCentreSize(SCREEN_STRETCH_X(CTheScripts::IntroTextLines[CounterB].m_fCenterSize)); + + if (CTheScripts::IntroTextLines[CounterB].m_bBackground) + CFont::SetBackgroundOn(); + else + CFont::SetBackgroundOff(); + + CFont::SetBackgroundColor(CTheScripts::IntroTextLines[CounterB].m_sBackgroundColor); + + if (CTheScripts::IntroTextLines[CounterB].m_bBackgroundOnly) + CFont::SetBackGroundOnlyTextOn(); + else + CFont::SetBackGroundOnlyTextOff(); + + if (CTheScripts::IntroTextLines[CounterB].m_bTextProportional) + CFont::SetPropOn(); + else + CFont::SetPropOff(); + + CFont::SetFontStyle(CTheScripts::IntroTextLines[CounterB].m_nFont); + CFont::PrintString(SCREEN_STRETCH_X(640.0f - CTheScripts::IntroTextLines[CounterB].field_36), SCREEN_STRETCH_Y(448.0f - CTheScripts::IntroTextLines[CounterB].field_40), IntroText->m_awText); + } + ++CounterA; + ++CounterB; + ++IntroText; + } while (CounterA < 2); + + uint16 CounterC = 0; + uint16 CounterD = 0; + CScriptRectangle* IntroRect = CTheScripts::IntroRectangles; + + do { + if (CTheScripts::IntroRectangles[CounterD].m_bIsUsed && CTheScripts::IntroRectangles[CounterD].m_bIsAntialiased) { + if (CTheScripts::IntroRectangles[CounterD].m_wTextureId >= 0) { + CRect rect = { + CTheScripts::IntroRectangles[CounterD].m_sRect.left, + CTheScripts::IntroRectangles[CounterD].m_sRect.bottom, + CTheScripts::IntroRectangles[CounterD].m_sRect.right, + CTheScripts::IntroRectangles[CounterD].m_sRect.bottom }; + + CTheScripts::ScriptSprites[CTheScripts::IntroRectangles[CounterD].m_wTextureId].Draw(rect, IntroRect->m_sColor); + } + else { + CRect rect = { + CTheScripts::IntroRectangles[CounterD].m_sRect.left, + CTheScripts::IntroRectangles[CounterD].m_sRect.bottom, + CTheScripts::IntroRectangles[CounterD].m_sRect.right, + CTheScripts::IntroRectangles[CounterD].m_sRect.bottom }; + + CSprite2d::DrawRect(rect, IntroRect->m_sColor); + } + } + ++CounterC; + ++CounterD; + ++IntroRect; + } while (CounterC < 16); + + /* + DrawSubtitles + */ + if (CHud::m_Message[0] && !CHud::m_BigMessage[2][0] && (FrontEndMenuManager.m_PrefsShowSubtitles == 1 || !TheCamera.m_WideScreenOn)) { + CFont::SetJustifyOff(); + CFont::SetBackgroundOff(); + CFont::SetBackgroundColor(CRGBA(0, 0, 0, 128)); + CFont::SetScale(SCREEN_STRETCH_X(0.48f), SCREEN_STRETCH_Y(1.120f)); + CFont::SetCentreOn(); + CFont::SetPropOn(); + CFont::SetFontStyle(FONT_BANK); + + if (TheCamera.m_WideScreenOn) + CFont::SetCentreSize(SCREEN_FROM_RIGHT(120.0f)); + else + CFont::SetCentreSize(SCREEN_FROM_RIGHT(280.0f)); + + CFont::SetDropShadowPosition(1); + CFont::SetDropColor(CRGBA(0, 0, 0, 255)); + CFont::SetColor(CRGBA(235, 235, 235, 255)); + CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_FROM_BOTTOM(64.0f), CHud::m_Message); + CFont::SetDropShadowPosition(0); + } + + /* + DrawBigMessage + */ + if (CHud::m_BigMessage[0][0]) { + if (0.0f == BigMessageInUse[0]) { + CFont::SetJustifyOff(); + CFont::SetBackgroundOff(); + CFont::SetBackGroundOnlyTextOff(); + CFont::SetScale(SCREEN_STRETCH_X(1.8f), SCREEN_STRETCH_Y(1.8f)); + CFont::SetPropOn(); + CFont::SetCentreOn(); + CFont::SetCentreSize(SCREEN_STRETCH_X(615.0f)); + CFont::SetColor(CRGBA(255, 255, 0, 255)); + CFont::SetFontStyle(FONT_HEADING); + if ((RsGlobal.maximumWidth - 20) <= BigMessageX[0]) { + BigMessageInUse[0] = BigMessageInUse[0] + CTimer::GetTimeStep(); + if (BigMessageInUse[0] >= 120.0f) { + BigMessageInUse[0] = 120.0; + BigMessageAlpha[0] = BigMessageAlpha[0] - (CTimer::GetTimeStep() * 0.02f * 1000.0f) * 0.30000001f; + } + if (BigMessageAlpha[0] <= 0.0f) { + CHud::m_BigMessage[0][0] = 0; + BigMessageAlpha[0] = 0.0; + } + } + else { + Float fStep = (CTimer::GetTimeStep() + * 0.02f + * 1000.0f) + * 0.30000001f; + BigMessageX[0] = BigMessageX[0] + fStep; + BigMessageAlpha[0] = BigMessageAlpha[0] + fStep; + + if (BigMessageAlpha[0] > 255.0f) + BigMessageAlpha[0] = 255.0; + } + CFont::SetColor(CRGBA(0, 0, 0, BigMessageAlpha[0])); + CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - SCREEN_STRETCH_Y(20.0f - 2.0f), m_BigMessage[0]); + + CFont::SetColor(CRGBA(85, 119, 133, BigMessageAlpha[0])); + CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - SCREEN_STRETCH_Y(20.0f), m_BigMessage[0]); + } + else { + BigMessageAlpha[0] = 0.0; + BigMessageX[0] = -60.0; + BigMessageInUse[0] = 1.0; + } + } + else { + BigMessageInUse[0] = 0.0; + } + + // WastedBustedText + if (CHud::m_BigMessage[2][0]) { + if (0 == BigMessageInUse[2]) { + BigMessageAlpha[2] = (CTimer::GetTimeStep() + * 0.02f + * 1000.0f) + * 0.40000001 + + BigMessageAlpha[2]; + if (BigMessageAlpha[2] > 255.0f) + BigMessageAlpha[2] = 255.0; + CFont::SetBackgroundOff(); + + if (CGame::frenchGame || CGame::germanGame) + CFont::SetScale(SCREEN_STRETCH_X(1.4f), SCREEN_STRETCH_Y(1.4f)); + else + CFont::SetScale(SCREEN_STRETCH_X(2.0f), SCREEN_STRETCH_Y(2.0f)); + + CFont::SetPropOn(); + CFont::SetRightJustifyOn(); + CFont::SetFontStyle(FONT_HEADING); + CFont::SetColor(CRGBA(0, 0, 0, 0.75f * BigMessageAlpha[2])); + + CFont::PrintString(SCREEN_FROM_RIGHT(20.0f + 4.0f), SCREEN_FROM_BOTTOM(78.0f), CHud::m_BigMessage[2]); + + CFont::SetColor(CRGBA(170, 123, 87, BigMessageAlpha[2])); + CFont::PrintString(SCREEN_FROM_RIGHT(20.0f), SCREEN_FROM_BOTTOM(82.0f), CHud::m_BigMessage[2]); + } + else { + BigMessageAlpha[2] = 0.0; + BigMessageInUse[2] = 1.0; + } + } + else { + BigMessageInUse[2] = 0.0; + } + } + } +} + +void CHud::DrawAfterFade() { + if (CTimer::GetIsUserPaused() || CReplay::Mode == 1) + return; + + if (m_HelpMessage[0]) { + if (!CMessages::WideStringCompare(m_HelpMessage, m_LastHelpMessage, 256)) { + switch (m_HelpMessageState) { + case 0: + m_HelpMessageFadeTimer = 0; + m_HelpMessageState = 2; + m_HelpMessageTimer = 0; + CMessages::WideStringCopy(m_HelpMessageToPrint, m_HelpMessage, 256); + m_HelpMessageDisplayTime = CMessages::GetWideStringLength(m_HelpMessage) * 0.05f + 3.0f; + + if (TheCamera.m_ScreenReductionPercentage == 0.0f) + DMAudio.PlayFrontEndSound(SOUND_A0, 0); + break; + case 1: + case 2: + case 3: + case 4: + m_HelpMessageTimer = 5; + m_HelpMessageState = 4; + break; + default: + break; + } + CMessages::WideStringCopy(m_LastHelpMessage, m_HelpMessage, 256); + } + + float fAlpha = 255.0f; + + if (m_HelpMessageState) { + switch (m_HelpMessageState) { + case 1: + fAlpha = 255.0f; + m_HelpMessageFadeTimer = 600; + if (m_HelpMessageTimer > m_fHelpMessageTime * 1000 || m_bHelpMessageQuick && m_HelpMessageTimer > 1500) { + m_HelpMessageFadeTimer = 600; + m_HelpMessageState = 3; + } + break; + case 2: + m_HelpMessageFadeTimer += 2 * (CTimer::GetTimeStep() * 0.02f * 1000.0f); + if (m_HelpMessageFadeTimer > 0) { + m_HelpMessageState = 1; + m_HelpMessageFadeTimer = 0; + } + fAlpha = m_HelpMessageFadeTimer * 0.001f * 255.0f; + break; + case 3: + m_HelpMessageFadeTimer -= 2 * (CTimer::GetTimeStep() * 0.02f * 1000.0f); + if (m_HelpMessageFadeTimer >= 0) { + m_HelpMessageState = 0; + m_HelpMessageFadeTimer = 0; + } + fAlpha = m_HelpMessageFadeTimer * 0.001f * 255.0f; + break; + case 4: + m_HelpMessageFadeTimer -= 2 * (CTimer::GetTimeStep() * 0.02f * 1000.0f); + if (m_HelpMessageFadeTimer >= 0) { + m_HelpMessageState = 2; + m_HelpMessageFadeTimer = 0; + CMessages::WideStringCopy(m_HelpMessageToPrint, m_LastHelpMessage, 400); + } + fAlpha = m_HelpMessageFadeTimer * 0.001f * 255.0f; + break; + default: + break; + } + + m_HelpMessageTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f); + + CFont::SetAlphaFade(fAlpha); + CFont::SetCentreOff(); + CFont::SetPropOn(); + + if (CGame::germanGame) + CFont::SetScale(SCREEN_STRETCH_X(0.52f * 0.85f), SCREEN_STRETCH_Y(1.1f * 0.85f)); + else + CFont::SetScale(SCREEN_STRETCH_X(0.52f), SCREEN_STRETCH_Y(1.1f)); + + CFont::SetColor(CRGBA(175, 175, 175, 255)); + CFont::SetJustifyOff(); + CFont::SetWrapx(SCREEN_STRETCH_X(200.0f + 26.0f - 4.0f)); + CFont::SetFontStyle(FONT_BANK); + CFont::SetBackgroundOn(); + CFont::SetBackGroundOnlyTextOff(); + CRGBA BackColor = { 0, 0, 0, (uint8)(0.9f * fAlpha) }; + CFont::SetBackgroundColor(BackColor); + CFont::SetColor(CRGBA(175, 175, 175, 255)); + CFont::PrintString(SCREEN_STRETCH_X(26.0f), SCREEN_STRETCH_Y(28.0f + (150.0f - PagerXOffset) * 0.6f), CHud::m_HelpMessageToPrint); + CFont::SetAlphaFade(255.0f); + CFont::DrawFonts(); + } + } + else + m_HelpMessageState = 0; + + /* + DrawBigMessage2 + */ + // Oddjob + if (m_BigMessage[4][0]) { + CFont::SetJustifyOff(); + CFont::SetBackgroundOff(); + CFont::SetScale(SCREEN_STRETCH_X(1.2f), SCREEN_STRETCH_Y(1.5f)); + CFont::SetCentreOn(); + CFont::SetPropOn(); + CFont::SetCentreSize(SCREEN_STRETCH_X(600.0f)); + CFont::SetFontStyle(FONT_BANK); + + CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::PrintString(SCREEN_STRETCH_X(2.0f) + (SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_STRETCH_Y(84.0f), m_BigMessage[4]); + + CFont::SetColor(CRGBA(89, 115, 150, 255)); + CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_STRETCH_Y(84.0f), m_BigMessage[4]); + } + + + // Oddjob result + if (OddJob2OffTimer > 0) + OddJob2OffTimer = OddJob2OffTimer - (CTimer::GetTimeStep() * 0.02f * 1000.0f); + + static float fStep; + if (!m_BigMessage[1][0] && m_BigMessage[4][0] && m_BigMessage[5][0] && OddJob2OffTimer <= 0.0f) { + switch (OddJob2On) { + case 0: + OddJob2On = 1; + OddJob2XOffset = 380.0; + break; + case 1: + if (OddJob2XOffset <= 2.0f) { + OddJob2Timer = 0; + OddJob2On = 2; + } + else { + fStep = 40.0; + if ((OddJob2XOffset * 0.16667) <= 40.0) + fStep = OddJob2XOffset * 0.16667; + OddJob2XOffset = OddJob2XOffset - fStep; + } + break; + case 2: + OddJob2Timer += (20.0 * CTimer::GetTimeStep()); + if (OddJob2Timer > 1500) { + OddJob2On = 3; + } + break; + case 3: + fStep = 30.0; + if ((OddJob2XOffset * 0.2) >= 30.0) + fStep = OddJob2XOffset * 0.2; + + OddJob2XOffset = OddJob2XOffset - fStep; + + if (OddJob2XOffset < -380.0) { + OddJob2OffTimer = 5000.0; + OddJob2On = 0; + } + break; + default: + break; + } + + CFont::SetJustifyOff(); + CFont::SetBackgroundOff(); + CFont::SetScale(SCREEN_STRETCH_X(1.0f), SCREEN_STRETCH_Y(1.2f)); + CFont::SetCentreOn(); + CFont::SetPropOn(); + CFont::SetCentreSize(SCREEN_FROM_RIGHT(20.0f)); + CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::SetFontStyle(FONT_BANK); + CFont::PrintString(SCREEN_STRETCH_X(2.0f) + (SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_STRETCH_Y(20.0f + 2.0f), m_BigMessage[5]); + + CFont::SetColor(CRGBA(156, 91, 40, 255)); + CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_STRETCH_Y(20.0f + 2.0f), m_BigMessage[5]); + } + + /* + DrawMissionTitle + */ + if (m_BigMessage[1][0]) { + if (BigMessageInUse[1] == 0.0f) { + CFont::SetJustifyOff(); + CFont::SetBackgroundOff(); + + if (CGame::frenchGame || CMenuManager::m_PrefsLanguage == 4) + CFont::SetScale(SCREEN_STRETCH_X(0.884f), SCREEN_STRETCH_Y(1.36f)); + else + CFont::SetScale(SCREEN_STRETCH_X(1.04f), SCREEN_STRETCH_Y(1.6f)); + + CFont::SetPropOn(); + CFont::SetRightJustifyWrap(-500); + CFont::SetRightJustifyOn(); + CFont::SetFontStyle(FONT_HEADING); + if ((RsGlobal.width - 20) <= BigMessageX[1]) { + BigMessageInUse[1] = BigMessageInUse[1] + CTimer::GetTimeStep(); + if (BigMessageInUse[1] >= 120.0f) { + BigMessageInUse[1] = 120.0; + BigMessageAlpha[1] = BigMessageAlpha[1] - (CTimer::GetTimeStep() * 0.02f * 1000.0f) * 0.3f; + } + if (BigMessageAlpha[1] <= 0) { + m_BigMessage[1][0] = 0; + BigMessageAlpha[1] = 0.0; + } + } + else { + float fStep = (CTimer::GetTimeStep() * 0.02f * 1000.0f) * 0.3f; + BigMessageX[1] = BigMessageX[1] + fStep; + BigMessageAlpha[1] = BigMessageAlpha[1] + fStep; + if (BigMessageAlpha[1] > 255.0f) + BigMessageAlpha[1] = 255.0; + } + CFont::SetColor(CRGBA(40, 40, 40, BigMessageAlpha[1])); + CFont::PrintString(SCREEN_FROM_RIGHT(20.0f - 2.0f), SCREEN_FROM_BOTTOM(120.0f), m_BigMessage[1]); + + CFont::SetColor(CRGBA(220, 172, 2, BigMessageAlpha[1])); + CFont::PrintString(SCREEN_FROM_RIGHT(20.0f), SCREEN_FROM_BOTTOM(120.0f), m_BigMessage[1]); + } + else { + BigMessageAlpha[1] = 0.0; + BigMessageX[1] = -60.0; + BigMessageInUse[1] = 1.0; + } + } + else { + BigMessageInUse[1] = 0.0; + } +} + +STARTPATCHES + InjectHook(0x48BC9A, &CHud::Initialise, PATCH_CALL); + InjectHook(0x48C4F1, &CHud::ReInitialise, PATCH_CALL); + InjectHook(0x48BCBC, &CHud::Shutdown, PATCH_CALL); +ENDPATCHES diff --git a/src/render/Hud.h b/src/render/Hud.h index 242acea8..65f75241 100644 --- a/src/render/Hud.h +++ b/src/render/Hud.h @@ -1,10 +1,87 @@ #pragma once +#include "Sprite2d.h" -class CHud -{ +enum eSprites { + HUD_FIST, + HUD_BAT, + HUD_PISTOL, + HUD_UZI, + HUD_SHOTGUN, + HUD_AK47, + HUD_M16, + HUD_SNIPER, + HUD_ROCKET, + HUD_FLAME, + HUD_MOLOTOV, + HUD_GRENADE, + HUD_DETONATOR, + HUD_RADARDISC = 15, + HUD_PAGER = 16, + HUD_SITESNIPER = 20, + HUD_SITEM16 = 21 +}; + +class CHud { public: - static void Draw(void); - static void DrawAfterFade(void); + static CSprite2d *Sprites; - static bool &m_Wants_To_Draw_Hud; -}; + static wchar *m_HelpMessage; + static wchar *m_LastHelpMessage; + static int32 &m_HelpMessageState; + static int32 &m_HelpMessageTimer; + static int32 &m_HelpMessageFadeTimer; + static wchar *m_HelpMessageToPrint; + static Float &m_HelpMessageDisplayTime; + static Float &m_fTextBoxNumLines; + static Float &m_fHelpMessageTime; + static Bool &m_bHelpMessageQuick; + static int32 m_ZoneState; + static int32 m_ZoneFadeTimer; + static int32 m_ZoneNameTimer; + static wchar* &m_pZoneName; + static wchar* m_pLastZoneName; + static wchar* m_ZoneToPrint; + static wchar* &m_pVehicleName; + static wchar* m_pLastVehicleName; + static wchar* m_pVehicleNameToPrint; + static int32 m_VehicleState; + static int32 m_VehicleFadeTimer; + static int32 m_VehicleNameTimer; + static wchar* m_Message; + static wchar* m_PagerMessage; + static Bool &m_bRetuneInProgress; + static Bool &m_Wants_To_Draw_Hud; + static Bool &m_Wants_To_Draw_3dMarkers; + static wchar(*m_BigMessage)[128]; + static Float* BigMessageInUse; + static Float* BigMessageAlpha; + static Float* BigMessageX; + static Float &OddJob2OffTimer; + static int8 &CounterOnLastFrame; + static Float &OddJob2XOffset; + static int16 &CounterFlashTimer; + static int16 &OddJob2Timer; + static int8 &TimerOnLastFrame; + static int16 &OddJob2On; + static int16 &TimerFlashTimer; + static int16 &PagerSoundPlayed; + static int32 &SpriteBrightness; + static Float &PagerXOffset; + static int32 m_ItemToFlash; + static int16 &PagerTimer; + static int16 &PagerOn; + +public: + static void Initialise(); + static void Shutdown(); + static void ReInitialise(); + static void GetRidOfAllHudMessages(); + static void SetZoneName(wchar* name); + static void SetHelpMessage(wchar* message, bool quick); + static void SetVehicleName(wchar* name); + static void Draw(); + static void DrawAfterFade(); + static void SetMessage(wchar* message); + static void SetBigMessage(wchar* message, int16 style); + static void SetPagerMessage(wchar* message); +}; \ No newline at end of file -- cgit v1.2.3 From 25605045bcf04d3bf7b982e7fa582eab564dc7d1 Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 15 Jun 2019 11:41:27 +0200 Subject: silly mistake in txd store --- src/TxdStore.cpp | 2 +- src/TxdStore.h | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/TxdStore.cpp b/src/TxdStore.cpp index 291feb2f..6ff7e852 100644 --- a/src/TxdStore.cpp +++ b/src/TxdStore.cpp @@ -29,7 +29,7 @@ CTxdStore::GameShutdown(void) for(i = 0; i < TXDSTORESIZE; i++){ TxdDef *def = GetSlot(i); - if(def && GetNumRefs(i)) + if(def && GetNumRefs(i) == 0) RemoveTxdSlot(i); } } diff --git a/src/TxdStore.h b/src/TxdStore.h index 50a94a75..a9e57d31 100644 --- a/src/TxdStore.h +++ b/src/TxdStore.h @@ -34,6 +34,11 @@ public: static bool FinishLoadTxd(int slot, RwStream *stream); static void RemoveTxd(int slot); - static TxdDef *GetSlot(int slot) { return ms_pTxdPool->GetSlot(slot); } + static TxdDef *GetSlot(int slot) { + assert(slot >= 0); + assert(ms_pTxdPool); + assert(slot < ms_pTxdPool->GetSize()); + return ms_pTxdPool->GetSlot(slot); + } static bool isTxdLoaded(int slot); }; -- cgit v1.2.3 From 2f4fc5aaf07aedecf3796bae5a63734f133e19a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Sat, 15 Jun 2019 18:53:25 +0300 Subject: More CPed functions and minor fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: eray orçunus --- src/Stats.cpp | 3 +- src/Stats.h | 1 + src/entities/Ped.cpp | 180 +++++++++++++++++++++++++++++++++++++++++++++++++-- src/entities/Ped.h | 28 ++++++-- 4 files changed, 201 insertions(+), 11 deletions(-) diff --git a/src/Stats.cpp b/src/Stats.cpp index d7816f36..8537137e 100644 --- a/src/Stats.cpp +++ b/src/Stats.cpp @@ -1,4 +1,5 @@ #include "common.h" #include "Stats.h" -Int32 &CStats::DaysPassed = *(Int32*)0x8F2BB8; \ No newline at end of file +Int32 &CStats::DaysPassed = *(Int32*)0x8F2BB8; +Int32 &CStats::HeadShots = *(Int32*)0x8F647C; \ No newline at end of file diff --git a/src/Stats.h b/src/Stats.h index b82497b5..398999dc 100644 --- a/src/Stats.h +++ b/src/Stats.h @@ -4,4 +4,5 @@ class CStats { public: static Int32 &DaysPassed; + static Int32 &HeadShots; }; \ No newline at end of file diff --git a/src/entities/Ped.cpp b/src/entities/Ped.cpp index b4b980e5..00e7ecb7 100644 --- a/src/entities/Ped.cpp +++ b/src/entities/Ped.cpp @@ -2,17 +2,21 @@ #include "patcher.h" #include "Ped.h" #include "Pools.h" +#include +#include +#include Bool &CPed::bNastyLimbsCheat = *(Bool*)0x95CD44; Bool &CPed::bPedCheat2 = *(Bool*)0x95CD5A; Bool &CPed::bPedCheat3 = *(Bool*)0x95CD59; - + void *CPed::operator new(size_t sz) { return CPools::GetPedPool()->New(); } void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); } WRAPPER void CPed::KillPedWithCar(CVehicle *veh, float impulse) { EAXJMP(0x4EC430); } WRAPPER void CPed::Say(uint16 audio) { EAXJMP(0x4E5A10); } -WRAPPER void CPed::SetLookFlag(CEntity* to, bool set) { EAXJMP(0x4C6460); } +WRAPPER void CPed::SetDie(AnimationId anim, float arg1, float arg2) { EAXJMP(0x4D37D0); } +WRAPPER void CPed::SpawnFlyingComponent(int, signed char) { EAXJMP(0x4EB060); } static char ObjectiveText[34][28] = { "No Obj", @@ -186,7 +190,7 @@ CPed::AddWeaponModel(int id) if (id != -1) { atm = (RpAtomic*)CModelInfo::GetModelInfo(id)->CreateInstance(); RwFrameDestroy(RpAtomicGetFrame(atm)); - RpAtomicSetFrame(atm, m_pFrames[PED_HANDR]->frame); + RpAtomicSetFrame(atm, GetNodeFrame(PED_HANDR)); RpClumpAddAtomic((RpClump*)m_rwObject, atm); m_wepModelID = id; } @@ -210,7 +214,7 @@ CPed::AimGun() } CPed::Say(0x74); - m_ped_flagB40 = m_pedIK.PointGunAtPosition(&vector); + m_ped_flagB2 = m_pedIK.PointGunAtPosition(&vector); if (m_pPedFight != m_pSeekTarget) { CPed::SetLookFlag(m_pSeekTarget, 1); } @@ -222,11 +226,177 @@ CPed::AimGun() newFlag = m_pedIK.PointGunInDirection(m_fLookDirection, 0.0); } - m_ped_flagB40 = newFlag; + m_ped_flagB2 = newFlag; + } +} + + +// After I finished this I realized it's only for SCM opcode... +void +CPed::ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer) +{ + CVector pos2 = CVector( + pos.x, + pos.y, + pos.z + 0.1 + ); + + if (!CPed::IsPlayer() || evenOnPlayer) + { + ++CStats::HeadShots; + + // yes. decompiled by hand. + if (m_nPedState != PED_PASSENGER || m_nPedState != PED_TAXI_PASSENGER) { + CPed::SetDie(ANIM_KO_SHOT_FRONT1, 4.0, 0.0); + } + + m_ped_flagC20 = 1; + m_nPedStateTimer = CTimer::GetTimeInMilliseconds() + 150; + + CParticle::AddParticle(PARTICLE_TEST, pos2, + CVector( + 0.0, + 0.0, + 0.0 + ), NULL, 0.2f, 0, 0, 0, 0); + + if (CEntity::GetIsOnScreen()) + { + for(int i=0; i<0x20; i++) { + CParticle::AddParticle(PARTICLE_BLOOD_SMALL, + pos2, + CVector( + 0.0, + 0.0, + 0.03 + ), NULL, 0.0f, 0, 0, 0, 0); + } + + for (int i = 0; i < 0x10; i++) { + CParticle::AddParticle(PARTICLE_DEBRIS2, + pos2, + CVector( + 0.0, + 0.0, + 0.0099999998 + ), NULL, 0.0f, 0, 0, 0, 0); + } + } + } +} + +void +CPed::RemoveBodyPart(PedNode nodeId, char arg4) +{ + RwFrame *frame; + RwFrame *fp; + RwV3d zero; + + frame = GetNodeFrame(nodeId); + if (frame) + { + if (CGame::nastyGame) + { + if (nodeId != PED_HEAD) + CPed::SpawnFlyingComponent(nodeId, arg4); + + RecurseFrameChildrenVisibilityCB(frame, 0); + zero.x = 0.0; + zero.z = 0.0; + zero.y = 0.0; + for (fp = RwFrameGetParent(frame); fp; fp = RwFrameGetParent(frame)) + RwV3dTransformPoints(&zero, &zero, 1, &fp->modelling); + + if (CEntity::GetIsOnScreen()) + { + CParticle::AddParticle(PARTICLE_TEST, zero, + CVector( + 0.0, + 0.0, + 0.0 + ), NULL, 0.2f, 0, 0, 0, 0); + + for (int i = 0; i < 0x10; i++) { + CParticle::AddParticle(PARTICLE_BLOOD_SMALL, + zero, + CVector( + 0.0, + 0.0, + 0.03 + ), NULL, 0.0f, 0, 0, 0, 0); + } + } + m_ped_flagC20 = 1; + m_bodyPartBleeding = nodeId; + } + } + else + { + printf("Trying to remove ped component"); + } +} + +RwObject* +CPed::SetPedAtomicVisibilityCB(RwObject *object, void *data) +{ + RwObject *result = object; + if (!data) + object->flags = 0; + + return result; +} + +RwFrame* +CPed::RecurseFrameChildrenVisibilityCB(RwFrame *frame, void *data) +{ + RwFrameForAllObjects(frame, SetPedAtomicVisibilityCB, data); + RwFrameForAllChildren(frame, RecurseFrameChildrenVisibilityCB, 0); + return frame; +} + +void +CPed::SetLookFlag(CPed *to, bool set) +{ + if (m_lookTimer < CTimer::GetTimeInMilliseconds()) + { + m_ped_flagA10 = 1; + m_ped_flagA40 = 0; + m_pPedFight = to; + m_pPedFight->RegisterReference((CEntity**)&m_pPedFight); + m_fLookDirection = 999999; + m_lookTimer = 0; + m_ped_flagA20_look = set; + if (m_nPedState != PED_DRIVING) { + // Resets second right most bit + m_pedIK.m_flags &= 0xFFFFFFFD; + } } } +void +CPed::SetLookFlag(float angle, bool set) +{ + if (m_lookTimer < CTimer::GetTimeInMilliseconds()) + { + m_ped_flagA10 = 1; + m_ped_flagA40 = 0; + m_pPedFight = 0; + m_fLookDirection = angle; + m_lookTimer = 0; + m_ped_flagA20_look = set; + if (m_nPedState != PED_DRIVING) { + // Resets second right most bit + m_pedIK.m_flags &= 0xFFFFFFFD; + } + } +} + + STARTPATCHES InjectHook(0x4CF8F0, &CPed::AddWeaponModel, PATCH_JUMP); InjectHook(0x4C6AA0, &CPed::AimGun, PATCH_JUMP); + InjectHook(0x4EB470, &CPed::ApplyHeadShot, PATCH_JUMP); + InjectHook(0x4EAEE0, &CPed::RemoveBodyPart, PATCH_JUMP); + InjectHook(0x4C6460, (void (CPed::*)(CPed*, bool)) &CPed::SetLookFlag, PATCH_JUMP); + InjectHook(0x4C63E0, (void (CPed::*)(float, bool)) &CPed::SetLookFlag, PATCH_JUMP); ENDPATCHES \ No newline at end of file diff --git a/src/entities/Ped.h b/src/entities/Ped.h index b7db77dc..2f0f67f0 100644 --- a/src/entities/Ped.h +++ b/src/entities/Ped.h @@ -3,6 +3,7 @@ #include "Physical.h" #include "Weapon.h" #include "PedIK.h" +#include #include enum { @@ -94,7 +95,7 @@ public: uint8 m_ped_flagA4 : 1; uint8 m_ped_flagA8 : 1; uint8 m_ped_flagA10 : 1; - uint8 m_ped_flagA20 : 1; + uint8 m_ped_flagA20_look : 1; uint8 m_ped_flagA40 : 1; uint8 m_ped_flagA80 : 1; uint8 m_ped_flagB1 : 1; @@ -163,14 +164,15 @@ public: uint8 m_ped_flagI80 : 1; uint8 stuff10[60]; int32 m_pEventEntity; - int32 m_fAngleToEvent; + float m_fAngleToEvent; AnimBlendFrameData *m_pFrames[PED_NODE_MAX]; int32 m_animGroup; int32 m_pVehicleAnim; CVector2D m_vecAnimMoveDelta; CVector m_vecOffsetSeek; CPedIK m_pedIK; - uint8 stuff1[12]; + uint8 stuff1[8]; + int32 m_nPedStateTimer; int32 m_nPedState; int32 m_nLastPedState; int32 m_nMoveState; @@ -198,7 +200,12 @@ public: CPed *m_pPedFight; float m_fLookDirection; int32 m_wepModelID; - uint8 stuff9[120]; + uint32 m_leaveCarTimer; + uint32 m_getUpTimer; + uint32 m_lookTimer; + uint8 stuff9[34]; + uint8 m_bodyPartBleeding; + uint8 stuff11[73]; static void *operator new(size_t); static void operator delete(void*, size_t); @@ -209,8 +216,17 @@ public: void AimGun(); void KillPedWithCar(CVehicle *veh, float impulse); void Say(uint16 audio); - void SetLookFlag(CEntity *to, bool set); + void SetLookFlag(CPed *to, bool set); + void SetLookFlag(float angle, bool set); + void SetDie(AnimationId anim, float arg1, float arg2); + void ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer); + void RemoveBodyPart(PedNode nodeId, char arg4); + void SpawnFlyingComponent(int, signed char); + static RwObject *SetPedAtomicVisibilityCB(RwObject *object, void *data); + static RwFrame *RecurseFrameChildrenVisibilityCB(RwFrame *frame, void *data); + CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; } + RwFrame* GetNodeFrame(int nodeId) { return m_pFrames[nodeId]->frame; } static Bool &bNastyLimbsCheat; static Bool &bPedCheat2; @@ -223,4 +239,6 @@ static_assert(offsetof(CPed, m_nPedType) == 0x32C, "CPed: error"); static_assert(offsetof(CPed, m_pCollidingEntity) == 0x34C, "CPed: error"); static_assert(offsetof(CPed, m_weapons) == 0x35C, "CPed: error"); static_assert(offsetof(CPed, m_currentWeapon) == 0x498, "CPed: error"); +static_assert(offsetof(CPed, m_lookTimer) == 0x4CC, "CPed: error"); +static_assert(offsetof(CPed, m_bodyPartBleeding) == 0x4F2, "CPed: error"); static_assert(sizeof(CPed) == 0x53C, "CPed: error"); \ No newline at end of file -- cgit v1.2.3 From b83a0d469af25f9756698378e6e928abaa4ec7d0 Mon Sep 17 00:00:00 2001 From: _AG Date: Sun, 16 Jun 2019 00:20:55 +0200 Subject: Updates Draw.cpp, MusicManager.cpp. --- src/audio/MusicManager.cpp | 132 +++++++++++++++++++++- src/audio/MusicManager.h | 264 ++++++++++++++++++++++++++++++++++++++++++- src/audio/SampleManager.cpp | 9 ++ src/audio/SampleManager.h | 11 ++ src/common.h | 5 +- src/main.cpp | 14 ++- src/modelinfo/ModelIndices.h | 122 ++++++++++++++++++-- src/render/Draw.cpp | 16 +++ src/render/Draw.h | 7 ++ src/render/Hud.cpp | 1 - src/render/Hud.h | 1 - 11 files changed, 561 insertions(+), 21 deletions(-) create mode 100644 src/audio/SampleManager.cpp create mode 100644 src/audio/SampleManager.h diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index 0e6870de..d3f14b0a 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -1,7 +1,137 @@ #include "common.h" #include "patcher.h" #include "MusicManager.h" +#include "Font.h" +#include "Hud.h" +#include "Text.h" +#include "Timer.h" +#include "Camera.h" +#include "World.h" +#include "ModelIndices.h" +#include "SampleManager.h" cMusicManager &MusicManager = *(cMusicManager*)0x8F3964; +int &gNumRetunePresses = *(int*)0x650B80; +int &gRetuneCounter = *(int*)0x650B84; -WRAPPER void cMusicManager::DisplayRadioStationName(void) { EAXJMP(0x57E6D0); } +//WRAPPER void cMusicManager::DisplayRadioStationName(void) { EAXJMP(0x57E6D0); } + +bool cMusicManager::PlayerInCar() { + if (!FindPlayerVehicle()) + return false; + else { + int32 State = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_nPedState; + + if (State == PED_DRAG_FROM_CAR || State == PED_EXIT_CAR || State == PED_ARRESTED) + return false; + + int16 Model = FindPlayerVehicle()->m_modelIndex; + switch (FindPlayerVehicle()->m_modelIndex) { + case MI_FIRETRUCK: + case MI_AMBULAN: + case MI_MRWHOOP: + case MI_PREDATOR: + case MI_TRAIN: + case MI_SPEEDER: + case MI_REEFER: + case MI_GHOST: + return false; + default: + return true; + } + } +} + +void cMusicManager::DisplayRadioStationName() { + wchar* RadioName = nullptr; + uint32 RadioStation = gNumRetunePresses + MusicManager.m_nCurrentStreamedSound; + + switch (RadioStation) { + case HEAD_RADIO: + RadioName = TheText.Get("FEA_FM0"); + break; + case DOUBLE_CLEF: + RadioName = TheText.Get("FEA_FM1"); + break; + case JAH_RADIO: + RadioName = TheText.Get("FEA_FM2"); + break; + case RISE_FM: + RadioName = TheText.Get("FEA_FM3"); + break; + case LIPS_106: + RadioName = TheText.Get("FEA_FM4"); + break; + case GAME_FM: + RadioName = TheText.Get("FEA_FM5"); + break; + case MSX_FM: + RadioName = TheText.Get("FEA_FM6"); + break; + case FLASHBACK: + RadioName = TheText.Get("FEA_FM7"); + break; + case CHATTERBOX: + RadioName = TheText.Get("FEA_FM8"); + break; + case USERTRACK: + RadioName = TheText.Get("FEA_FM9"); + break; + default: + RadioName = nullptr; + break; + } + + CFont::SetJustifyOff(); + CFont::SetBackgroundOff(); + CFont::SetScale(SCREEN_STRETCH_X(0.8f), SCREEN_STRETCH_Y(1.35f)); + CFont::SetPropOn(); + CFont::SetFontStyle(FONT_HEADING); + CFont::SetCentreOn(); + CFont::SetCentreSize(SCREEN_STRETCH_X(640.0f));; + + static int32 nTime = 0; + if (!CTimer::GetIsPaused() && !TheCamera.m_WideScreenOn && MusicManager.PlayerInCar()) { + if (gNumRetunePresses || (MusicManager.m_bPlayerInCar && !MusicManager.m_bPreviousPlayerInCar)) + nTime = CTimer::GetTimeInMilliseconds() + 2000; + + if (CTimer::GetTimeInMilliseconds() < nTime) { + if (RadioStation) { + if (MusicManager.m_nCurrentStreamedSound == STREAMED_SOUND_WATER_AMBIENT || + MusicManager.m_nCurrentStreamedSound == STREAMED_SOUND_RADIO_POLICE || + MusicManager.m_nCurrentStreamedSound == STREAMED_SOUND_WATER_AMBIENT || + MusicManager.m_nCurrentStreamedSound == STREAMED_SOUND_CITY_AMBIENT) + RadioStation = RADIO_OFF; + else { + if (RadioStation > HEAD_RADIO) { + if (cSampleManager.IsMP3RadioChannelAvailable()) { + if (RadioStation > USERTRACK) + RadioStation = RADIO_OFF; + } + else { + if (RadioStation > CHATTERBOX) + RadioStation = RADIO_OFF; + } + } + else { + RadioStation = RADIO_OFF; + } + } + } + + if (RadioName) { + CFont::SetColor(CRGBA(0, 0, 0, 255)); + + CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_STRETCH_Y(23.0f), RadioName); + + if (gNumRetunePresses) + CFont::SetColor(CRGBA(102, 133, 143, 255)); + else + CFont::SetColor(CRGBA(147, 196, 211, 255)); + + CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_STRETCH_Y(22.0f), RadioName); + CFont::DrawFonts(); + } + } + } +} \ No newline at end of file diff --git a/src/audio/MusicManager.h b/src/audio/MusicManager.h index 42cc879d..7932ca31 100644 --- a/src/audio/MusicManager.h +++ b/src/audio/MusicManager.h @@ -1,8 +1,270 @@ #pragma once +enum eRadioStation { + HEAD_RADIO, + DOUBLE_CLEF, + JAH_RADIO, + RISE_FM, + LIPS_106, + GAME_FM, + MSX_FM, + FLASHBACK, + CHATTERBOX, + USERTRACK, + POLICE_RADIO, + RADIO_OFF, +}; + +enum eStreamedSounds { + STREAMED_SOUND_RADIO_HEAD = 0, + STREAMED_SOUND_RADIO_CLASSIC = 1, + STREAMED_SOUND_RADIO_KJAH = 2, + STREAMED_SOUND_RADIO_RISE = 3, + STREAMED_SOUND_RADIO_LIPS = 4, + STREAMED_SOUND_RADIO_GAME = 5, + STREAMED_SOUND_RADIO_MSX = 6, + STREAMED_SOUND_RADIO_FLASH = 7, + STREAMED_SOUND_RADIO_CHAT = 8, + STREAMED_SOUND_RADIO_MP3_PLAYER = 9, + STREAMED_SOUND_RADIO_POLICE = 10, + STREAMED_SOUND_CITY_AMBIENT = 11, + STREAMED_SOUND_WATER_AMBIENT = 12, + STREAMED_SOUND_ANNOUNCE_COMMERCIAL_OPEN = 13, + STREAMED_SOUND_ANNOUNCE_SUBURBAN_OPEN = 14, + STREAMED_SOUND_NEWS_INTRO = 15, + STREAMED_SOUND_BANK_INTRO = 16, + STREAMED_SOUND_CUTSCENE_LUIGI1_LG = 17, + STREAMED_SOUND_CUTSCENE_LUIGI2_DSB = 18, + STREAMED_SOUND_CUTSCENE_LUIGI3_DM = 19, + STREAMED_SOUND_CUTSCENE_LUIGI4_PAP = 20, + STREAMED_SOUND_CUTSCENE_LUIGI5_TFB = 21, + STREAMED_SOUND_CUTSCENE_JOEY0_DM2 = 22, + STREAMED_SOUND_CUTSCENE_JOEY1_LFL = 23, + STREAMED_SOUND_CUTSCENE_JOEY2_KCL = 24, + STREAMED_SOUND_CUTSCENE_JOEY3_VH = 25, + STREAMED_SOUND_CUTSCENE_JOEY4_ETH = 26, + STREAMED_SOUND_CUTSCENE_JOEY5_DST = 27, + STREAMED_SOUND_CUTSCENE_JOEY6_TBJ = 28, + STREAMED_SOUND_CUTSCENE_TONI1_TOL = 29, + STREAMED_SOUND_CUTSCENE_TONI2_TPU = 30, + STREAMED_SOUND_CUTSCENE_TONI3_MAS = 31, + STREAMED_SOUND_CUTSCENE_TONI4_TAT = 32, + STREAMED_SOUND_CUTSCENE_TONI5_BF = 33, + STREAMED_SOUND_CUTSCENE_SAL0_MAS = 34, + STREAMED_SOUND_CUTSCENE_SAL1_PF = 35, + STREAMED_SOUND_CUTSCENE_SAL2_CTG = 36, + STREAMED_SOUND_CUTSCENE_SAL3_RTC = 37, + STREAMED_SOUND_CUTSCENE_SAL5_LRQ = 38, + STREAMED_SOUND_CUTSCENE_SAL4_BDBA = 39, + STREAMED_SOUND_CUTSCENE_SAL4_BDBB = 40, + STREAMED_SOUND_CUTSCENE_SAL2_CTG2 = 41, + STREAMED_SOUND_CUTSCENE_SAL4_BDBD = 42, + STREAMED_SOUND_CUTSCENE_SAL5_LRQB = 43, + STREAMED_SOUND_CUTSCENE_SAL5_LRQC = 44, + STREAMED_SOUND_CUTSCENE_ASUKA_1_SSO = 45, + STREAMED_SOUND_CUTSCENE_ASUKA_2_PP = 46, + STREAMED_SOUND_CUTSCENE_ASUKA_3_SS = 47, + STREAMED_SOUND_CUTSCENE_ASUKA_4_PDR = 48, + STREAMED_SOUND_CUTSCENE_ASUKA_5_K2FT = 49, + STREAMED_SOUND_CUTSCENE_KENJI1_KBO = 50, + STREAMED_SOUND_CUTSCENE_KENJI2_GIS = 51, + STREAMED_SOUND_CUTSCENE_KENJI3_DS = 52, + STREAMED_SOUND_CUTSCENE_KENJI4_SHI = 53, + STREAMED_SOUND_CUTSCENE_KENJI5_SD = 54, + STREAMED_SOUND_CUTSCENE_RAY0_PDR2 = 55, + STREAMED_SOUND_CUTSCENE_RAY1_SW = 56, + STREAMED_SOUND_CUTSCENE_RAY2_AP = 57, + STREAMED_SOUND_CUTSCENE_RAY3_ED = 58, + STREAMED_SOUND_CUTSCENE_RAY4_GF = 59, + STREAMED_SOUND_CUTSCENE_RAY5_PB = 60, + STREAMED_SOUND_CUTSCENE_RAY6_MM = 61, + STREAMED_SOUND_CUTSCENE_DONALD1_STOG = 62, + STREAMED_SOUND_CUTSCENE_DONALD2_KK = 63, + STREAMED_SOUND_CUTSCENE_DONALD3_ADO = 64, + STREAMED_SOUND_CUTSCENE_DONALD5_ES = 65, + STREAMED_SOUND_CUTSCENE_DONALD7_MLD = 66, + STREAMED_SOUND_CUTSCENE_DONALD4_GTA = 67, + STREAMED_SOUND_CUTSCENE_DONALD4_GTA2 = 68, + STREAMED_SOUND_CUTSCENE_DONALD6_STS = 69, + STREAMED_SOUND_CUTSCENE_ASUKA6_BAIT = 70, + STREAMED_SOUND_CUTSCENE_ASUKA7_ETG = 71, + STREAMED_SOUND_CUTSCENE_ASUKA8_PS = 72, + STREAMED_SOUND_CUTSCENE_ASUKA9_ASD = 73, + STREAMED_SOUND_CUTSCENE_KENJI4_SHI2 = 74, + STREAMED_SOUND_CUTSCENE_CATALINA1_TEX = 75, + STREAMED_SOUND_CUTSCENE_ELBURRO1_PH1 = 76, + STREAMED_SOUND_CUTSCENE_ELBURRO2_PH2 = 77, + STREAMED_SOUND_CUTSCENE_ELBURRO3_PH3 = 78, + STREAMED_SOUND_CUTSCENE_ELBURRO4_PH4 = 79, + STREAMED_SOUND_CUTSCENE_YARDIE_PH1 = 80, + STREAMED_SOUND_CUTSCENE_YARDIE_PH2 = 81, + STREAMED_SOUND_CUTSCENE_YARDIE_PH3 = 82, + STREAMED_SOUND_CUTSCENE_YARDIE_PH4 = 83, + STREAMED_SOUND_CUTSCENE_HOODS_PH1 = 84, + STREAMED_SOUND_CUTSCENE_HOODS_PH2 = 85, + STREAMED_SOUND_CUTSCENE_HOODS_PH3 = 86, + STREAMED_SOUND_CUTSCENE_HOODS_PH4 = 87, + STREAMED_SOUND_CUTSCENE_HOODS_PH5 = 88, + STREAMED_SOUND_CUTSCENE_MARTY_PH1 = 89, + STREAMED_SOUND_CUTSCENE_MARTY_PH2 = 90, + STREAMED_SOUND_CUTSCENE_MARTY_PH3 = 91, + STREAMED_SOUND_CUTSCENE_MARTY_PH4 = 92, + STREAMED_SOUND_MISSION_COMPLETED = 93, + STREAMED_SOUND_GAME_COMPLETED = 94, + STREAMED_SOUND_MISSION_LIB_A1 = 95, + STREAMED_SOUND_MISSION_LIB_A2 = 96, + STREAMED_SOUND_MISSION_LIB_A = 97, + STREAMED_SOUND_MISSION_LIB_B = 98, + STREAMED_SOUND_MISSION_LIB_C = 99, + STREAMED_SOUND_MISSION_LIB_D = 100, + STREAMED_SOUND_MISSION_L2_A = 101, + STREAMED_SOUND_MISSION_J4T_1 = 102, + STREAMED_SOUND_MISSION_J4T_2 = 103, + STREAMED_SOUND_MISSION_J4T_3 = 104, + STREAMED_SOUND_MISSION_J4T_4 = 105, + STREAMED_SOUND_MISSION_J4_A = 106, + STREAMED_SOUND_MISSION_J4_B = 107, + STREAMED_SOUND_MISSION_J4_C = 108, + STREAMED_SOUND_MISSION_J4_D = 109, + STREAMED_SOUND_MISSION_J4_E = 110, + STREAMED_SOUND_MISSION_J4_F = 111, + STREAMED_SOUND_MISSION_J6_1 = 112, + STREAMED_SOUND_MISSION_J6_A = 113, + STREAMED_SOUND_MISSION_J6_B = 114, + STREAMED_SOUND_MISSION_J6_C = 115, + STREAMED_SOUND_MISSION_J6_D = 116, + STREAMED_SOUND_MISSION_T4_A = 117, + STREAMED_SOUND_MISSION_S1_A = 118, + STREAMED_SOUND_MISSION_S1_A1 = 119, + STREAMED_SOUND_MISSION_S1_B = 120, + STREAMED_SOUND_MISSION_S1_C = 121, + STREAMED_SOUND_MISSION_S1_C1 = 122, + STREAMED_SOUND_MISSION_S1_D = 123, + STREAMED_SOUND_MISSION_S1_E = 124, + STREAMED_SOUND_MISSION_S1_F = 125, + STREAMED_SOUND_MISSION_S1_G = 126, + STREAMED_SOUND_MISSION_S1_H = 127, + STREAMED_SOUND_MISSION_S1_I = 128, + STREAMED_SOUND_MISSION_S1_J = 129, + STREAMED_SOUND_MISSION_S1_K = 130, + STREAMED_SOUND_MISSION_S1_L = 131, + STREAMED_SOUND_MISSION_S3_A = 132, + STREAMED_SOUND_MISSION_S3_B = 133, + STREAMED_SOUND_MISSION_EL3_A = 134, + STREAMED_SOUND_MISSION_MF1_A = 135, + STREAMED_SOUND_MISSION_MF2_A = 136, + STREAMED_SOUND_MISSION_MF3_A = 137, + STREAMED_SOUND_MISSION_MF3_B = 138, + STREAMED_SOUND_MISSION_MF3_B1 = 139, + STREAMED_SOUND_MISSION_MF3_C = 140, + STREAMED_SOUND_MISSION_MF4_A = 141, + STREAMED_SOUND_MISSION_MF4_B = 142, + STREAMED_SOUND_MISSION_MF4_C = 143, + STREAMED_SOUND_MISSION_A1_A = 144, + STREAMED_SOUND_MISSION_A3_A = 145, + STREAMED_SOUND_MISSION_A5_A = 146, + STREAMED_SOUND_MISSION_A4_A = 147, + STREAMED_SOUND_MISSION_A4_B = 148, + STREAMED_SOUND_MISSION_A4_C = 149, + STREAMED_SOUND_MISSION_A4_D = 150, + STREAMED_SOUND_MISSION_K1_A = 151, + STREAMED_SOUND_MISSION_K3_A = 152, + STREAMED_SOUND_MISSION_R1_A = 153, + STREAMED_SOUND_MISSION_R2_A = 154, + STREAMED_SOUND_MISSION_R2_B = 155, + STREAMED_SOUND_MISSION_R2_C = 156, + STREAMED_SOUND_MISSION_R2_D = 157, + STREAMED_SOUND_MISSION_R2_E = 158, + STREAMED_SOUND_MISSION_R2_F = 159, + STREAMED_SOUND_MISSION_R2_G = 160, + STREAMED_SOUND_MISSION_R2_H = 161, + STREAMED_SOUND_MISSION_R5_A = 162, + STREAMED_SOUND_MISSION_R6_A = 163, + STREAMED_SOUND_MISSION_R6_A1 = 164, + STREAMED_SOUND_MISSION_R6_B = 165, + STREAMED_SOUND_MISSION_LO2_A = 166, + STREAMED_SOUND_MISSION_LO6_A = 167, + STREAMED_SOUND_MISSION_YD2_A = 168, + STREAMED_SOUND_MISSION_YD2_B = 169, + STREAMED_SOUND_MISSION_YD2_C = 170, + STREAMED_SOUND_MISSION_YD2_C1 = 171, + STREAMED_SOUND_MISSION_YD2_D = 172, + STREAMED_SOUND_MISSION_YD2_E = 173, + STREAMED_SOUND_MISSION_YD2_F = 174, + STREAMED_SOUND_MISSION_YD2_G = 175, + STREAMED_SOUND_MISSION_YD2_H = 176, + STREAMED_SOUND_MISSION_YD2_ASS = 177, + STREAMED_SOUND_MISSION_YD2_OK = 178, + STREAMED_SOUND_MISSION_H5_A = 179, + STREAMED_SOUND_MISSION_H5_B = 180, + STREAMED_SOUND_MISSION_H5_C = 181, + STREAMED_SOUND_MISSION_AMMU_A = 182, + STREAMED_SOUND_MISSION_AMMU_B = 183, + STREAMED_SOUND_MISSION_AMMU_C = 184, + STREAMED_SOUND_MISSION_DOOR_1 = 185, + STREAMED_SOUND_MISSION_DOOR_2 = 186, + STREAMED_SOUND_MISSION_DOOR_3 = 187, + STREAMED_SOUND_MISSION_DOOR_4 = 188, + STREAMED_SOUND_MISSION_DOOR_5 = 189, + STREAMED_SOUND_MISSION_DOOR_6 = 190, + STREAMED_SOUND_MISSION_T3_A = 191, + STREAMED_SOUND_MISSION_T3_B = 192, + STREAMED_SOUND_MISSION_T3_C = 193, + STREAMED_SOUND_MISSION_K1_B = 194, + STREAMED_SOUND_MISSION_CAT1 = 195, + TOTAL_STREAMED_SOUNDS = 196, + NO_STREAMED_SOUND = 197, +}; + +class tMP3Sample { +public: + uint32 m_nLength; + uint32 m_nPosition; + uint32 m_nLastPosCheckTimer; +}; + class cMusicManager { public: - void DisplayRadioStationName(void); + Bool m_bIsInitialised; + uint8 field_1; + uint8 m_nMusicMode; + uint8 m_nCurrentStreamedSound; + uint8 m_nPreviousStreamedSound; + uint8 field_5; + uint8 field_6; + uint8 field_7; + Bool m_bAnnouncement; + Bool m_bPreviousPlayerInCar; + Bool m_bPlayerInCar; + Bool m_bAnnouncementInProgress; + tMP3Sample m_asMP3Samples[196]; + uint8 field_2364; + uint8 field_2365; + uint8 field_2366; + uint8 field_2367; + uint32 field_2368; + uint32 field_2372; + uint32 field_2376; + uint8 field_2380; + uint8 field_2381; + uint8 field_2382; + Bool m_bRadioSetByScript; + uint8 m_nRadioStation; + uint8 field_2385; + uint8 field_2386; + uint8 field_2387; + uint32 m_nRadioPosition; + Bool m_bRadioInCar; + uint8 field_2393; + uint8 field_2394; + uint8 field_2395; + +public: + bool PlayerInCar(); + void DisplayRadioStationName(); }; + +static_assert(sizeof(cMusicManager) == 0x95C, "cMusicManager: error"); + extern cMusicManager &MusicManager; diff --git a/src/audio/SampleManager.cpp b/src/audio/SampleManager.cpp new file mode 100644 index 00000000..2319baec --- /dev/null +++ b/src/audio/SampleManager.cpp @@ -0,0 +1,9 @@ +#include "common.h" +#include "SampleManager.h" + +CSampleManager &cSampleManager = *(CSampleManager *)0x7341E0; +uint32 &CSampleManager::nNumOfMp3Files = *(uint32*)0x95CC00; + +bool CSampleManager::IsMP3RadioChannelAvailable() { + return nNumOfMp3Files != 0; +} diff --git a/src/audio/SampleManager.h b/src/audio/SampleManager.h new file mode 100644 index 00000000..b8bd2011 --- /dev/null +++ b/src/audio/SampleManager.h @@ -0,0 +1,11 @@ +#pragma once + +class CSampleManager { +public: + static uint32 &nNumOfMp3Files; + +public: + bool IsMP3RadioChannelAvailable(); +}; + +extern CSampleManager &cSampleManager; \ No newline at end of file diff --git a/src/common.h b/src/common.h index 966af022..d31ad18c 100644 --- a/src/common.h +++ b/src/common.h @@ -59,6 +59,9 @@ extern void **rwengine; #define RwEngineInstance (*rwengine) #include "skel\skeleton.h" +#include "Draw.h" + +#define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio()) #define SCREENW (RsGlobal.maximumWidth) #define SCREENH (RsGlobal.maximumHeight) @@ -67,7 +70,7 @@ extern void **rwengine; #define DEFAULT_SCREEN_HEIGHT (448) #define SCREEN_WIDTH Float(RsGlobal.width) #define SCREEN_HEIGHT Float(RsGlobal.height) -#define SCREEN_STRETCH_X(a) Float((a) * (SCREEN_WIDTH / Float(DEFAULT_SCREEN_WIDTH))) * Float(1.33334f / (CMenuManager::m_PrefsUseWideScreen ? 16.0f / 9.0f : 4.0f / 3.0f)) +#define SCREEN_STRETCH_X(a) Float((a) * (SCREEN_WIDTH / Float(DEFAULT_SCREEN_WIDTH))) * Float((1.3333334f) / (SCREEN_ASPECT_RATIO)) #define SCREEN_STRETCH_Y(a) Float((a) * (SCREEN_HEIGHT / Float(DEFAULT_SCREEN_HEIGHT))) #define SCREEN_FROM_RIGHT(a) Float(SCREEN_WIDTH - SCREEN_STRETCH_X(a)) #define SCREEN_FROM_BOTTOM(a) Float(SCREEN_HEIGHT - SCREEN_STRETCH_Y(a)) diff --git a/src/main.cpp b/src/main.cpp index 9b8fc145..38666979 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -86,6 +86,7 @@ RwRGBA gColourTop; void Idle(void *arg) { + CDraw::CalculateAspectRatio(); CTimer::Update(); CSprite2d::InitPerFrame(); CFont::InitPerFrame(); @@ -141,7 +142,7 @@ Idle(void *arg) }else{ float viewWindow = tan(DEGTORAD(CDraw::GetFOV() * 0.5f)); // ASPECT - CameraSize(Scene.camera, nil, viewWindow, 4.0f/3.0f); + CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO); CVisibilityPlugins::SetRenderWareCamera(Scene.camera); RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ); if(!RsCameraBeginUpdate(Scene.camera)) @@ -161,6 +162,7 @@ Idle(void *arg) void FrontendIdle(void) { + CDraw::CalculateAspectRatio(); CTimer::Update(); CSprite2d::SetRecipNearClip(); CSprite2d::InitPerFrame(); @@ -173,7 +175,7 @@ FrontendIdle(void) float viewWindow = tan(DEGTORAD(CDraw::GetFOV() * 0.5f)); // ASPECT - CameraSize(Scene.camera, nil, viewWindow, 4.0f/3.0f); + CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO); CVisibilityPlugins::SetRenderWareCamera(Scene.camera); RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ); if(!RsCameraBeginUpdate(Scene.camera)) @@ -190,13 +192,13 @@ FrontendIdle(void) bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha) { + CDraw::CalculateAspectRatio(); CRGBA TopColor(TopRed, TopGreen, TopBlue, Alpha); CRGBA BottomColor(BottomRed, BottomGreen, BottomBlue, Alpha); float viewWindow = tan(DEGTORAD(CDraw::GetFOV() * 0.5f)); // ASPECT - float aspectRatio = CMenuManager::m_PrefsUseWideScreen ? 16.0f/9.0f : 4.0f/3.0f; - CameraSize(Scene.camera, nil, viewWindow, aspectRatio); + CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO); CVisibilityPlugins::SetRenderWareCamera(Scene.camera); RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ); @@ -214,10 +216,10 @@ 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) { + CDraw::CalculateAspectRatio(); float viewWindow = tan(DEGTORAD(CDraw::GetFOV() * 0.5f)); // ASPECT - float aspectRatio = CMenuManager::m_PrefsUseWideScreen ? 16.0f/9.0f : 4.0f/3.0f; - CameraSize(Scene.camera, nil, viewWindow, aspectRatio); + CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO); CVisibilityPlugins::SetRenderWareCamera(Scene.camera); RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ); diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h index bbf1a58b..7567c0db 100644 --- a/src/modelinfo/ModelIndices.h +++ b/src/modelinfo/ModelIndices.h @@ -202,16 +202,118 @@ enum MI_FEMALE03, MI_FATFEMALE01, MI_FATFEMALE02, - - MI_FIRETRUCK = 97, - MI_PREDATOR = 120, - MI_RHINO = 122, - MI_TRAIN = 124, - MI_COACH = 127, - MI_RCBANDIT = 131, - MI_SPEEDER = 142, - MI_REEFER = 143, - MI_GHOST = 150, + MI_PROSTITUTE, + MI_PROSTITUTE2, + MI_P_MAN1, + MI_P_MAN2, + MI_P_WOM1, + MI_P_WOM2, + MI_CT_MAN1, + MI_CT_MAN2, + MI_CT_WOM1, + MI_CT_WOM2, + MI_LI_MAN1, + MI_LI_MAN2, + MI_LI_WOM1, + MI_LI_WOM2, + MI_DOCKER1, + MI_DOCKER2, + MI_SCUM_MAN, + MI_SCUM_WOM, + MI_WORKER1, + MI_WORKER2, + MI_B_MAN1, + MI_B_MAN2, + MI_B_MAN3, + MI_B_WOM1, + MI_B_WOM2, + MI_B_WOM3, + MI_MOD_MAN, + MI_MOD_WOM, + MI_ST_MAN, + MI_ST_WOM, + MI_FAN_MAN1, + MI_FAN_MAN2, + MI_FAN_WOM, + MI_HOS_MAN, + MI_HOS_WOM, + MI_CONST1, + MI_CONST2, + MI_SHOPPER1, + MI_SHOPPER2, + MI_SHOPPER3, + MI_STUD_MAN, + MI_STUD_WOM, + MI_CAS_MAN, + MI_CAS_WOM, + MI_BUSKER1, + MI_BUSKER2, + MI_BUSKER3, + MI_BUSKER4, + MI_PED87, + MI_PED88, + MI_PED89, + MI_LANDSTAL, + MI_IDAHO, + MI_STINGER, + MI_LINERUN, + MI_PEREN, + MI_SENTINEL, + MI_PATRIOT, + MI_FIRETRUCK, + MI_TRASH, + MI_STRETCH, + MI_MANANA, + MI_INFERNUS, + MI_BLISTA, + MI_PONY, + MI_MULE, + MI_CHEETAH, + MI_AMBULAN, + MI_FBICAR, + MI_MOONBEAM, + MI_ESPERANT, + MI_TAXI, + MI_KURUMA, + MI_BOBCAT, + MI_MRWHOOP, + MI_BFINJECT, + MI_CORPSE, + MI_POLICE, + MI_ENFORCER, + MI_SECURICA, + MI_BANSHEE, + MI_PREDATOR, + MI_BUS, + MI_RHINO, + MI_BARRACKS, + MI_TRAIN, + MI_CHOPPER, + MI_DODO, + MI_COACH, + MI_CABBIE, + MI_STALLION, + MI_RUMPO, + MI_RCBANDIT, + MI_BELLYUP, + MI_MRWONGS, + MI_MAFIA, + MI_YARDIE, + MI_YAKUZA, + MI_DIABLOS, + MI_COLUMB , + MI_HOODS, + MI_AIRTRAIN, + MI_DEADDODO, + MI_SPEEDER, + MI_REEFER, + MI_PANLANT, + MI_FLATBED, + MI_YANKEE, + MI_ESCAPE, + MI_BORGNINE, + MI_TOYZ, + MI_GHOST, MI_CAR_DOOR = 190, MI_CAR_BUMPER, diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp index fd9a2d7e..e1f79697 100644 --- a/src/render/Draw.cpp +++ b/src/render/Draw.cpp @@ -1,6 +1,10 @@ #include "common.h" #include "patcher.h" #include "Draw.h" +#include "Frontend.h" +#include "Camera.h" + +float CDraw::ms_fAspectRatio; float &CDraw::ms_fNearClipZ = *(float*)0x8E2DC4; float &CDraw::ms_fFarClipZ = *(float*)0x9434F0; @@ -11,6 +15,18 @@ uint8 &CDraw::FadeRed = *(uint8*)0x95CD90; uint8 &CDraw::FadeGreen = *(uint8*)0x95CD71; uint8 &CDraw::FadeBlue = *(uint8*)0x95CD53; +void CDraw::CalculateAspectRatio() { + if (FrontEndMenuManager.m_PrefsUseWideScreen) { + ms_fAspectRatio = 1.7777778f; + } + else if (TheCamera.m_WideScreenOn) { + ms_fAspectRatio = 1.25f; + } + else { + ms_fAspectRatio = 1.3333334f; + } +} + static float hFov2vFov(float hfov) { float w = SCREENW; diff --git a/src/render/Draw.h b/src/render/Draw.h index 408c41b0..6dd42121 100644 --- a/src/render/Draw.h +++ b/src/render/Draw.h @@ -6,6 +6,8 @@ private: static float &ms_fNearClipZ; static float &ms_fFarClipZ; static float &ms_fFOV; + static float ms_fAspectRatio; + public: static uint8 &FadeValue; static uint8 &FadeRed; @@ -16,6 +18,11 @@ public: static float GetNearClipZ(void) { return ms_fNearClipZ; } static void SetFarClipZ(float farclip) { ms_fFarClipZ = farclip; } static float GetFarClipZ(void) { return ms_fFarClipZ; } + static void SetFOV(float fov); static float GetFOV(void) { return ms_fFOV; } + + static void CalculateAspectRatio(); + static float GetAspectRatio(void) { return ms_fAspectRatio; } + }; diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 8ff20e5a..1d454d2a 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -53,7 +53,6 @@ wchar* CHud::m_pLastVehicleName = *(wchar **)0x8E2DD8; wchar* CHud::m_pVehicleNameToPrint; wchar* CHud::m_Message = (wchar*)0x72E318; wchar* CHud::m_PagerMessage = (wchar*)0x878840; -Bool &CHud::m_bRetuneInProgress = *(Bool*)0x650B80; Bool &CHud::m_Wants_To_Draw_Hud = *(Bool*)0x95CD89; Bool &CHud::m_Wants_To_Draw_3dMarkers = *(Bool*)0x95CD62; wchar(*CHud::m_BigMessage)[128] = (wchar(*)[128])0x664CE0; diff --git a/src/render/Hud.h b/src/render/Hud.h index 65f75241..04795981 100644 --- a/src/render/Hud.h +++ b/src/render/Hud.h @@ -49,7 +49,6 @@ public: static int32 m_VehicleNameTimer; static wchar* m_Message; static wchar* m_PagerMessage; - static Bool &m_bRetuneInProgress; static Bool &m_Wants_To_Draw_Hud; static Bool &m_Wants_To_Draw_3dMarkers; static wchar(*m_BigMessage)[128]; -- cgit v1.2.3 From 4c385edd0c0641cd4c081abd036fdc4ac5648eb6 Mon Sep 17 00:00:00 2001 From: _AG Date: Sun, 16 Jun 2019 18:05:02 +0200 Subject: Changes for the pull request. --- src/render/Hud.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 1d454d2a..d7529025 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -76,7 +76,7 @@ int16 &CHud::PagerTimer = *(int16*)0x95CC3A; int16 &CHud::PagerOn = *(int16*)0x95CCA0; CSprite2d *CHud::Sprites = (CSprite2d*)0x95CB9C; -char *HudNames[] = { "fist", +char *WeaponFilenames[] = { "fist", "fistm", "bat", "batm", @@ -136,8 +136,8 @@ void CHud::Initialise() { CTxdStore::PopCurrentTxd(); CTxdStore::SetCurrentTxd(HudTXD); - for (int i = 0; i < 23; i++) { - Sprites[i].SetTexture(HudNames[i * 2]); + for (int i = 0; i < ARRAY_SIZE(WeaponFilenames) / 2; i++) { + Sprites[i].SetTexture(WeaponFilenames[i * 2]); } gpSniperSightTex = RwTextureRead("sitesniper", 0); -- cgit v1.2.3 From 2a207af49a922fe65bb3e69489aa3e075b72c3e3 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 16 Jun 2019 19:06:01 +0200 Subject: some cleanup --- src/Radar.cpp | 4 +- src/common.h | 6 +- src/main.cpp | 12 +-- src/render/Draw.cpp | 17 ++- src/render/Hud.cpp | 295 ++++++++++++++++++++++++++-------------------------- 5 files changed, 167 insertions(+), 167 deletions(-) diff --git a/src/Radar.cpp b/src/Radar.cpp index 3b2d6b26..63a84680 100644 --- a/src/Radar.cpp +++ b/src/Radar.cpp @@ -38,8 +38,8 @@ void CRadar::DrawMap() { } void CRadar::TransformRadarPointToScreenSpace(CVector2D *out, CVector2D *in) { - out->x = in->x * SCREEN_STRETCH_X(47.0f) + SCREEN_STRETCH_X(47.0f + 20.0f); - out->y = (SCREEN_STRETCH_Y(76.0f)) * 0.5f + RsGlobal.height - (SCREEN_STRETCH_Y(123.0f)) - in->y * (SCREEN_STRETCH_Y(76.0f)) * 0.5f; + out->x = in->x * HUD_STRETCH_X(47.0f) + HUD_STRETCH_X(47.0f + 20.0f); + out->y = (HUD_STRETCH_Y(76.0f)) * 0.5f + SCREEN_HEIGHT - (HUD_STRETCH_Y(123.0f)) - in->y * (HUD_STRETCH_Y(76.0f)) * 0.5f; } STARTPATCHES diff --git a/src/common.h b/src/common.h index d31ad18c..9635f01e 100644 --- a/src/common.h +++ b/src/common.h @@ -70,11 +70,15 @@ extern void **rwengine; #define DEFAULT_SCREEN_HEIGHT (448) #define SCREEN_WIDTH Float(RsGlobal.width) #define SCREEN_HEIGHT Float(RsGlobal.height) -#define SCREEN_STRETCH_X(a) Float((a) * (SCREEN_WIDTH / Float(DEFAULT_SCREEN_WIDTH))) * Float((1.3333334f) / (SCREEN_ASPECT_RATIO)) +#define SCREEN_STRETCH_X(a) Float((a) * (SCREEN_WIDTH / Float(DEFAULT_SCREEN_WIDTH))) +#define SCREEN_STRETCH_X_AR(a) Float((a) * (SCREEN_WIDTH / Float(DEFAULT_SCREEN_WIDTH)) * (4.0/3.0f)/SCREEN_ASPECT_RATIO) #define SCREEN_STRETCH_Y(a) Float((a) * (SCREEN_HEIGHT / Float(DEFAULT_SCREEN_HEIGHT))) #define SCREEN_FROM_RIGHT(a) Float(SCREEN_WIDTH - SCREEN_STRETCH_X(a)) #define SCREEN_FROM_BOTTOM(a) Float(SCREEN_HEIGHT - SCREEN_STRETCH_Y(a)) +#define HUD_STRETCH_X SCREEN_STRETCH_X_AR +#define HUD_STRETCH_Y SCREEN_STRETCH_Y + struct GlobalScene { RpWorld *world; diff --git a/src/main.cpp b/src/main.cpp index 38666979..976de407 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -86,7 +86,6 @@ RwRGBA gColourTop; void Idle(void *arg) { - CDraw::CalculateAspectRatio(); CTimer::Update(); CSprite2d::InitPerFrame(); CFont::InitPerFrame(); @@ -141,7 +140,7 @@ Idle(void *arg) Render2dStuff(); }else{ float viewWindow = tan(DEGTORAD(CDraw::GetFOV() * 0.5f)); - // ASPECT + CDraw::CalculateAspectRatio(); CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO); CVisibilityPlugins::SetRenderWareCamera(Scene.camera); RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ); @@ -162,7 +161,6 @@ Idle(void *arg) void FrontendIdle(void) { - CDraw::CalculateAspectRatio(); CTimer::Update(); CSprite2d::SetRecipNearClip(); CSprite2d::InitPerFrame(); @@ -174,7 +172,7 @@ FrontendIdle(void) return; float viewWindow = tan(DEGTORAD(CDraw::GetFOV() * 0.5f)); - // ASPECT + CDraw::CalculateAspectRatio(); CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO); CVisibilityPlugins::SetRenderWareCamera(Scene.camera); RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ); @@ -192,12 +190,11 @@ FrontendIdle(void) bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha) { - CDraw::CalculateAspectRatio(); CRGBA TopColor(TopRed, TopGreen, TopBlue, Alpha); CRGBA BottomColor(BottomRed, BottomGreen, BottomBlue, Alpha); float viewWindow = tan(DEGTORAD(CDraw::GetFOV() * 0.5f)); - // ASPECT + CDraw::CalculateAspectRatio(); CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO); CVisibilityPlugins::SetRenderWareCamera(Scene.camera); RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ); @@ -216,9 +213,8 @@ 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) { - CDraw::CalculateAspectRatio(); float viewWindow = tan(DEGTORAD(CDraw::GetFOV() * 0.5f)); - // ASPECT + CDraw::CalculateAspectRatio(); CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO); CVisibilityPlugins::SetRenderWareCamera(Scene.camera); RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ); diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp index e1f79697..b411176f 100644 --- a/src/render/Draw.cpp +++ b/src/render/Draw.cpp @@ -15,16 +15,15 @@ uint8 &CDraw::FadeRed = *(uint8*)0x95CD90; uint8 &CDraw::FadeGreen = *(uint8*)0x95CD71; uint8 &CDraw::FadeBlue = *(uint8*)0x95CD53; -void CDraw::CalculateAspectRatio() { - if (FrontEndMenuManager.m_PrefsUseWideScreen) { - ms_fAspectRatio = 1.7777778f; - } - else if (TheCamera.m_WideScreenOn) { +void +CDraw::CalculateAspectRatio() +{ + if(FrontEndMenuManager.m_PrefsUseWideScreen) + ms_fAspectRatio = 16.0f/9.0f; + else if(TheCamera.m_WideScreenOn) ms_fAspectRatio = 1.25f; - } - else { - ms_fAspectRatio = 1.3333334f; - } + else + ms_fAspectRatio = 4.0f/3.0f; } static float hFov2vFov(float hfov) diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index d7529025..cb3a20bb 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -76,53 +76,54 @@ int16 &CHud::PagerTimer = *(int16*)0x95CC3A; int16 &CHud::PagerOn = *(int16*)0x95CCA0; CSprite2d *CHud::Sprites = (CSprite2d*)0x95CB9C; -char *WeaponFilenames[] = { "fist", - "fistm", - "bat", - "batm", - "pistol", - "pistolm", - "uzi", - "uzim", - "shotgun", - "shotgunm", - "ak47", - "ak47m", - "m16", - "m16m", - "sniper", - "sniperm", - "rocket", - "rocketm", - "flame", - "flamem", - "molotov", - "molotovm", - "grenade", - "grenadem", - "detonator", - "detonator_mask", - "", - "", - "", - "", - "radardisc", - "radardiscm", - "pager", - "pagerm", - "", - "", - "", - "", - "bleeder", - "", - "sitesniper", - "sitesniperm", - "siteM16", - "siteM16m", - "siterocket", - "siterocketm" - }; +char *WeaponFilenames[] = { + "fist", + "fistm", + "bat", + "batm", + "pistol", + "pistolm", + "uzi", + "uzim", + "shotgun", + "shotgunm", + "ak47", + "ak47m", + "m16", + "m16m", + "sniper", + "sniperm", + "rocket", + "rocketm", + "flame", + "flamem", + "molotov", + "molotovm", + "grenade", + "grenadem", + "detonator", + "detonator_mask", + "", + "", + "", + "", + "radardisc", + "radardiscm", + "pager", + "pagerm", + "", + "", + "", + "", + "bleeder", + "", + "sitesniper", + "sitesniperm", + "siteM16", + "siteM16m", + "siterocket", + "siterocketm" +}; RwTexture* gpSniperSightTex = (RwTexture*)0x8F5834; RwTexture* gpRocketSightTex = (RwTexture*)0x8E2C20; @@ -224,26 +225,26 @@ void CHud::Draw() { if (CMenuManager::m_PrefsUseWideScreen) { fWidescreenOffset[0] = 0.0f; - fWidescreenOffset[1] = SCREEN_STRETCH_Y(18.0f); + fWidescreenOffset[1] = HUD_STRETCH_Y(18.0f); } if (Mode_RunAround && TheCamera.Cams->Using3rdPersonMouseCam()) { - Float f3rdX = RsGlobal.maximumWidth * TheCamera.m_f3rdPersonCHairMultX + fWidescreenOffset[0]; - Float f3rdY = RsGlobal.maximumHeight * TheCamera.m_f3rdPersonCHairMultY - fWidescreenOffset[1]; + Float f3rdX = SCREENW * TheCamera.m_f3rdPersonCHairMultX + fWidescreenOffset[0]; + Float f3rdY = SCREENH * TheCamera.m_f3rdPersonCHairMultY - fWidescreenOffset[1]; if (CWorld::Players[CWorld::PlayerInFocus].m_pPed && WeaponType == WEAPONTYPE_M16) { - rect.left = f3rdX - SCREEN_STRETCH_X(32.0f * 0.6f); - rect.top = f3rdY - SCREEN_STRETCH_Y(32.0f * 0.6f); - rect.right = f3rdX + SCREEN_STRETCH_X(32.0f * 0.6f); - rect.bottom = f3rdY + SCREEN_STRETCH_Y(32.0f * 0.6f); + rect.left = f3rdX - HUD_STRETCH_X(32.0f * 0.6f); + rect.top = f3rdY - HUD_STRETCH_Y(32.0f * 0.6f); + rect.right = f3rdX + HUD_STRETCH_X(32.0f * 0.6f); + rect.bottom = f3rdY + HUD_STRETCH_Y(32.0f * 0.6f); CHud::Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); } else { - rect.left = f3rdX - SCREEN_STRETCH_X(32.0f * 0.4f); - rect.top = f3rdY - SCREEN_STRETCH_Y(32.0f * 0.4f); - rect.right = f3rdX + SCREEN_STRETCH_X(32.0f * 0.4f); - rect.bottom = f3rdY + SCREEN_STRETCH_Y(32.0f * 0.4f); + rect.left = f3rdX - HUD_STRETCH_X(32.0f * 0.4f); + rect.top = f3rdY - HUD_STRETCH_Y(32.0f * 0.4f); + rect.right = f3rdX + HUD_STRETCH_X(32.0f * 0.4f); + rect.bottom = f3rdY + HUD_STRETCH_Y(32.0f * 0.4f); CHud::Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); } @@ -251,36 +252,36 @@ void CHud::Draw() { else { if (Mode != CCam::CamMode::MODE_M16FIRSTPERSON_34 && Mode != CCam::CamMode::MODE_FIRSTPERSONPEDONPC_41 && Mode != CCam::CamMode::MODE_EDITOR) { if (Mode == CCam::CamMode::MODE_ROCKET_RUN_AROUND) { - rect.left = (SCREEN_WIDTH / 2) - SCREEN_STRETCH_X(32.0f * 0.7f); - rect.top = (SCREEN_HEIGHT / 2) - SCREEN_STRETCH_Y(32.0f * 0.7f); - rect.right = (SCREEN_WIDTH / 2) + SCREEN_STRETCH_X(32.0f * 0.7f); - rect.bottom = (SCREEN_HEIGHT / 2) + SCREEN_STRETCH_Y(32.0f * 0.7f); + rect.left = (SCREEN_WIDTH / 2) - HUD_STRETCH_X(32.0f * 0.7f); + rect.top = (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(32.0f * 0.7f); + rect.right = (SCREEN_WIDTH / 2) + HUD_STRETCH_X(32.0f * 0.7f); + rect.bottom = (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(32.0f * 0.7f); CHud::Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); } else if (Mode != CCam::CamMode::MODE_ROCKET && Mode != CCam::CamMode::MODE_SNIPER_RUN_AROUND) { - rect.left = (SCREEN_WIDTH / 2) - SCREEN_STRETCH_X(210.0f); - rect.top = (SCREEN_HEIGHT / 2) - SCREEN_STRETCH_Y(210.0f); + rect.left = (SCREEN_WIDTH / 2) - HUD_STRETCH_X(210.0f); + rect.top = (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(210.0f); rect.right = SCREEN_WIDTH / 2; rect.bottom = SCREEN_HEIGHT / 2; CHud::Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); rect.right = (SCREEN_WIDTH / 2); - rect.top = (SCREEN_HEIGHT / 2) - SCREEN_STRETCH_Y(210.0f); - rect.left = SCREEN_STRETCH_X(210.0f) + (SCREEN_WIDTH / 2); + rect.top = (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(210.0f); + rect.left = HUD_STRETCH_X(210.0f) + (SCREEN_WIDTH / 2); rect.bottom = SCREEN_HEIGHT / 2; CHud::Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); - rect.left = (SCREEN_WIDTH / 2) - SCREEN_STRETCH_X(210.0f); + rect.left = (SCREEN_WIDTH / 2) - HUD_STRETCH_X(210.0f); rect.bottom = (SCREEN_HEIGHT / 2); rect.right = (SCREEN_WIDTH / 2); - rect.top = SCREEN_STRETCH_Y(210.0f) + (SCREEN_HEIGHT / 2); + rect.top = HUD_STRETCH_Y(210.0f) + (SCREEN_HEIGHT / 2); CHud::Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); rect.right = (SCREEN_WIDTH / 2); rect.bottom = (SCREEN_HEIGHT / 2); - rect.left = SCREEN_STRETCH_X(210.0f) + (SCREEN_WIDTH / 2); - rect.top = SCREEN_STRETCH_Y(210.0f) + (SCREEN_HEIGHT / 2); + rect.left = HUD_STRETCH_X(210.0f) + (SCREEN_WIDTH / 2); + rect.top = HUD_STRETCH_Y(210.0f) + (SCREEN_HEIGHT / 2); CHud::Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); } else { @@ -291,14 +292,14 @@ void CHud::Draw() { RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATETEXTURERASTER, gpRocketSightTex->raster); - CSprite::RenderOneXLUSprite(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 1.0f, SCREEN_STRETCH_X(40.0f), SCREEN_STRETCH_Y(40.0f), (100.0f * fMultBright), (200.0f * fMultBright), (100.0f * fMultBright), 255, 1.0f, 255); + CSprite::RenderOneXLUSprite(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 1.0f, HUD_STRETCH_X(40.0f), HUD_STRETCH_Y(40.0f), (100.0f * fMultBright), (200.0f * fMultBright), (100.0f * fMultBright), 255, 1.0f, 255); } } else { - rect.left = (SCREEN_WIDTH / 2) - SCREEN_STRETCH_X(32.0f); - rect.top = (SCREEN_HEIGHT / 2) - SCREEN_STRETCH_Y(32.0f); - rect.right = (SCREEN_WIDTH / 2) + SCREEN_STRETCH_X(32.0f); - rect.bottom = (SCREEN_HEIGHT / 2) + SCREEN_STRETCH_Y(32.0f); + rect.left = (SCREEN_WIDTH / 2) - HUD_STRETCH_X(32.0f); + rect.top = (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(32.0f); + rect.right = (SCREEN_WIDTH / 2) + HUD_STRETCH_X(32.0f); + rect.bottom = (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(32.0f); CHud::Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); } } @@ -322,7 +323,7 @@ void CHud::Draw() { CFont::SetPropOff(); CFont::SetBackgroundOff(); - CFont::SetScale(SCREEN_STRETCH_X(0.8f), SCREEN_STRETCH_Y(1.35f)); + CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f)); CFont::SetCentreOff(); CFont::SetRightJustifyOn(); CFont::SetRightJustifyWrap(0.0f); @@ -331,10 +332,10 @@ void CHud::Draw() { CFont::SetPropOff(); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(110.0f - 2.0f), SCREEN_STRETCH_Y(43.0f + 2.0f), sPrint); + CFont::PrintString(SCREEN_FROM_RIGHT(110.0f - 2.0f), HUD_STRETCH_Y(43.0f + 2.0f), sPrint); CFont::SetColor(CRGBA(89, 115, 150, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(110.0f), SCREEN_STRETCH_Y(43.0f), sPrint); + CFont::PrintString(SCREEN_FROM_RIGHT(110.0f), HUD_STRETCH_Y(43.0f), sPrint); /* DrawClock @@ -344,10 +345,10 @@ void CHud::Draw() { CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(111.0f - 2.0f), SCREEN_STRETCH_Y(22.0f + 2.0f), sPrint); + CFont::PrintString(SCREEN_FROM_RIGHT(111.0f - 2.0f), HUD_STRETCH_Y(22.0f + 2.0f), sPrint); CFont::SetColor(CRGBA(194, 165, 120, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(111.0f), SCREEN_STRETCH_Y(22.0f), sPrint); + CFont::PrintString(SCREEN_FROM_RIGHT(111.0f), HUD_STRETCH_Y(22.0f), sPrint); /* DrawAmmo @@ -376,10 +377,10 @@ void CHud::Draw() { AsciiToUnicode(sTemp, sPrint); CFont::SetBackgroundOff(); - CFont::SetScale(SCREEN_STRETCH_X(0.4f), SCREEN_STRETCH_Y(0.6f)); + CFont::SetScale(HUD_STRETCH_X(0.4f), HUD_STRETCH_Y(0.6f)); CFont::SetJustifyOff(); CFont::SetCentreOn(); - CFont::SetCentreSize(SCREEN_STRETCH_X(640.0f)); + CFont::SetCentreSize(HUD_STRETCH_X(640.0f)); CFont::SetPropOn(); CFont::SetFontStyle(FONT_BANK); @@ -387,7 +388,7 @@ void CHud::Draw() { if (WeaponType) { if (WeaponType != 1) { CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(66.0f), SCREEN_STRETCH_Y(73.0f), sPrint); + CFont::PrintString(SCREEN_FROM_RIGHT(66.0f), HUD_STRETCH_Y(73.0f), sPrint); } } } @@ -396,7 +397,7 @@ void CHud::Draw() { DrawWeaponIcon */ CHud::Sprites[WeaponType].Draw( - CRect(SCREEN_FROM_RIGHT(99.0f), SCREEN_STRETCH_Y(27.0f), SCREEN_FROM_RIGHT(35.0f), SCREEN_STRETCH_Y(91.0f)), + CRect(SCREEN_FROM_RIGHT(99.0f), HUD_STRETCH_Y(27.0f), SCREEN_FROM_RIGHT(35.0f), HUD_STRETCH_Y(91.0f)), CRGBA(255, 255, 255, 255), 0.015f, 0.015f, @@ -411,7 +412,7 @@ void CHud::Draw() { DrawHealth */ CFont::SetBackgroundOff(); - CFont::SetScale(SCREEN_STRETCH_X(0.8f), SCREEN_STRETCH_Y(1.35f)); + CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f)); CFont::SetJustifyOff(); CFont::SetCentreOff(); CFont::SetRightJustifyWrap(0.0f); @@ -431,17 +432,17 @@ void CHud::Draw() { AsciiToUnicode(sTemp, sPrint); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(110.0f - 2.0f), SCREEN_STRETCH_Y(65.0f + 2.0f), sPrint); + CFont::PrintString(SCREEN_FROM_RIGHT(110.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrint); if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) { - CFont::PrintString(SCREEN_FROM_RIGHT(164.0f - 2.0f), SCREEN_STRETCH_Y(65.0f + 2.0f), sPrintIcon); + CFont::PrintString(SCREEN_FROM_RIGHT(164.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrintIcon); } CFont::SetColor(CRGBA(186, 101, 50, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(110.0f), SCREEN_STRETCH_Y(65.0f), sPrint); + CFont::PrintString(SCREEN_FROM_RIGHT(110.0f), HUD_STRETCH_Y(65.0f), sPrint); if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) { - CFont::PrintString(SCREEN_FROM_RIGHT(164.0f), SCREEN_STRETCH_Y(65.0f), sPrintIcon); + CFont::PrintString(SCREEN_FROM_RIGHT(164.0f), HUD_STRETCH_Y(65.0f), sPrintIcon); } } } @@ -450,25 +451,25 @@ void CHud::Draw() { DrawArmour */ if (CHud::m_ItemToFlash == 3 && CTimer::GetFrameCounter() & 8 || CHud::m_ItemToFlash != 3) { - CFont::SetScale(SCREEN_STRETCH_X(0.8f), SCREEN_STRETCH_Y(1.35f)); + CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f)); if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fArmour > 1.0f) { AsciiToUnicode("[", sPrintIcon); sprintf(sTemp, "%03d", (int32)CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fArmour); AsciiToUnicode(sTemp, sPrint); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(182.0f - 2.0f), SCREEN_STRETCH_Y(65.0f + 2.0f), sPrint); + CFont::PrintString(SCREEN_FROM_RIGHT(182.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrint); if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 4) { - CFont::PrintString(SCREEN_FROM_RIGHT(234.0f - 2.0f), SCREEN_STRETCH_Y(65.0f + 2.0f), sPrintIcon); + CFont::PrintString(SCREEN_FROM_RIGHT(234.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrintIcon); } CFont::SetColor(CRGBA(124, 140, 95, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(182.0f), SCREEN_STRETCH_Y(65.0f), sPrint); + CFont::PrintString(SCREEN_FROM_RIGHT(182.0f), HUD_STRETCH_Y(65.0f), sPrint); if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 1) { - CFont::PrintString(SCREEN_FROM_RIGHT(234.0f), SCREEN_STRETCH_Y(65.0f), sPrintIcon); + CFont::PrintString(SCREEN_FROM_RIGHT(234.0f), HUD_STRETCH_Y(65.0f), sPrintIcon); } } } @@ -477,7 +478,7 @@ void CHud::Draw() { DrawWantedLevel */ CFont::SetBackgroundOff(); - CFont::SetScale(SCREEN_STRETCH_X(0.8f), SCREEN_STRETCH_Y(1.35f)); + CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f)); CFont::SetJustifyOff(); CFont::SetCentreOff(); CFont::SetRightJustifyOff(); @@ -488,13 +489,13 @@ void CHud::Draw() { for (int i = 0; i < 6; i++) { CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(2.0f + SCREEN_FROM_RIGHT(60.0f - 2.0f + 23.0f * i), SCREEN_STRETCH_Y(87.0f + 2.0f), sPrintIcon); + CFont::PrintString(2.0f + SCREEN_FROM_RIGHT(60.0f - 2.0f + 23.0f * i), HUD_STRETCH_Y(87.0f + 2.0f), sPrintIcon); if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel > i && (CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nLastWantedLevelChange + 2000 || CTimer::GetFrameCounter() & 4)) { CFont::SetColor(CRGBA(193, 164, 120, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(60.0f + 23.0f * i), SCREEN_STRETCH_Y(87.0f), sPrintIcon); + CFont::PrintString(SCREEN_FROM_RIGHT(60.0f + 23.0f * i), HUD_STRETCH_Y(87.0f), sPrintIcon); } } @@ -571,9 +572,9 @@ void CHud::Draw() { CFont::SetBackgroundOff(); if (CMenuManager::m_PrefsLanguage == 4) - CFont::SetScale(SCREEN_STRETCH_X(1.2f * 0.8f), SCREEN_STRETCH_Y(1.2f)); + CFont::SetScale(HUD_STRETCH_X(1.2f * 0.8f), HUD_STRETCH_Y(1.2f)); else - CFont::SetScale(SCREEN_STRETCH_X(1.2f), SCREEN_STRETCH_Y(1.2f)); + CFont::SetScale(HUD_STRETCH_X(1.2f), HUD_STRETCH_Y(1.2f)); CFont::SetRightJustifyOn(); CFont::SetRightJustifyWrap(0.0f); @@ -667,9 +668,9 @@ void CHud::Draw() { CFont::SetBackgroundOff(); if (CMenuManager::m_PrefsLanguage != 3 && CMenuManager::m_PrefsLanguage != 4) - CFont::SetScale(SCREEN_STRETCH_X(1.2f), SCREEN_STRETCH_Y(1.2f)); + CFont::SetScale(HUD_STRETCH_X(1.2f), HUD_STRETCH_Y(1.2f)); else - CFont::SetScale(SCREEN_STRETCH_X(1.2f * 0.85f), SCREEN_STRETCH_Y(1.2f)); + CFont::SetScale(HUD_STRETCH_X(1.2f * 0.85f), HUD_STRETCH_Y(1.2f)); CFont::SetRightJustifyOn(); CFont::SetRightJustifyWrap(0.0f); @@ -715,27 +716,27 @@ void CHud::Draw() { AsciiToUnicode(CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerBuffer, sTimer); CFont::SetPropOn(); CFont::SetBackgroundOff(); - CFont::SetScale(SCREEN_STRETCH_X(0.8f), SCREEN_STRETCH_Y(1.35f)); + CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f)); CFont::SetRightJustifyOn(); CFont::SetRightJustifyWrap(0.0f); CFont::SetFontStyle(FONT_HEADING); CFont::SetPropOff(); CFont::SetBackGroundOnlyTextOn(); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(27.0f - 2.0f), SCREEN_STRETCH_Y(110.0f + 2.0f), sTimer); + CFont::PrintString(SCREEN_FROM_RIGHT(27.0f - 2.0f), HUD_STRETCH_Y(110.0f + 2.0f), sTimer); - CFont::SetScale(SCREEN_STRETCH_X(0.8f), SCREEN_STRETCH_Y(1.35f)); + CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f)); CFont::SetColor(CRGBA(186, 101, 50, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(27.0f), SCREEN_STRETCH_Y(110.0f), sTimer); + CFont::PrintString(SCREEN_FROM_RIGHT(27.0f), HUD_STRETCH_Y(110.0f), sTimer); if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText[0]) { CFont::SetPropOn(); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::SetScale(SCREEN_STRETCH_X(0.8f), SCREEN_STRETCH_Y(1.35f)); - CFont::PrintString(SCREEN_FROM_RIGHT(27.0f + 78.0f), SCREEN_STRETCH_Y(110.0f + 2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); + CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f)); + CFont::PrintString(SCREEN_FROM_RIGHT(27.0f + 78.0f), HUD_STRETCH_Y(110.0f + 2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); CFont::SetColor(CRGBA(186, 101, 50, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(27.0f + 80.0f), SCREEN_STRETCH_Y(110.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); + CFont::PrintString(SCREEN_FROM_RIGHT(27.0f + 80.0f), HUD_STRETCH_Y(110.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); } } } @@ -752,39 +753,39 @@ void CHud::Draw() { if (CTimer::GetFrameCounter() & 4 || !CounterFlashTimer) { if (CUserDisplay::OnscnTimer.m_sEntries[0].m_nType) { - CSprite2d::DrawRect(CRect(SCREEN_FROM_RIGHT(127.0f - 4.0f), SCREEN_STRETCH_Y(132.0 + 8.0f), SCREEN_FROM_RIGHT(23.0f), SCREEN_STRETCH_Y(11.0f + 132.0f + 8.0f)), CRGBA(0, 106, 164, 80)); - CSprite2d::DrawRect(CRect(SCREEN_FROM_RIGHT(127.0f + 4.0f), SCREEN_STRETCH_Y(132.0 + 8.0f), SCREEN_FROM_RIGHT(atoi(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer) + 27.0f + 100.0f + 4.0f), SCREEN_STRETCH_Y(11.0f + 132.0f + 8.0f)), CRGBA(0, 106, 164, 255)); + CSprite2d::DrawRect(CRect(SCREEN_FROM_RIGHT(127.0f - 4.0f), HUD_STRETCH_Y(132.0 + 8.0f), SCREEN_FROM_RIGHT(23.0f), HUD_STRETCH_Y(11.0f + 132.0f + 8.0f)), CRGBA(0, 106, 164, 80)); + CSprite2d::DrawRect(CRect(SCREEN_FROM_RIGHT(127.0f + 4.0f), HUD_STRETCH_Y(132.0 + 8.0f), SCREEN_FROM_RIGHT(atoi(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer) + 27.0f + 100.0f + 4.0f), HUD_STRETCH_Y(11.0f + 132.0f + 8.0f)), CRGBA(0, 106, 164, 255)); } else { AsciiToUnicode(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer, sTimer); CFont::SetPropOn(); CFont::SetBackgroundOff(); - CFont::SetScale(SCREEN_STRETCH_X(0.8f), SCREEN_STRETCH_Y(1.35f)); + CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f)); CFont::SetCentreOff(); CFont::SetRightJustifyOn(); CFont::SetRightJustifyWrap(0.0f); CFont::SetFontStyle(FONT_HEADING); CFont::SetColor(CRGBA(244, 20, 20, 255)); - CFont::SetWrapx(SCREEN_STRETCH_X(640.0f)); + CFont::SetWrapx(HUD_STRETCH_X(640.0f)); CFont::SetPropOff(); CFont::SetBackGroundOnlyTextOn(); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(27.0f - 2.0f), SCREEN_STRETCH_Y(132.0f + 2.0f), sTimer); + CFont::PrintString(SCREEN_FROM_RIGHT(27.0f - 2.0f), HUD_STRETCH_Y(132.0f + 2.0f), sTimer); CFont::SetColor(CRGBA(0, 106, 164, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(27.0f), SCREEN_STRETCH_Y(132.0f), sTimer); + CFont::PrintString(SCREEN_FROM_RIGHT(27.0f), HUD_STRETCH_Y(132.0f), sTimer); } if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText[0]) { CFont::SetPropOn(); - CFont::SetScale(SCREEN_STRETCH_X(0.8f), SCREEN_STRETCH_Y(1.35f)); + CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f)); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(27.0f + 59.0f), SCREEN_STRETCH_Y(132.0f + 2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); + CFont::PrintString(SCREEN_FROM_RIGHT(27.0f + 59.0f), HUD_STRETCH_Y(132.0f + 2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); CFont::SetColor(CRGBA(0, 106, 164, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(27.0f + 61.0f), SCREEN_STRETCH_Y(132.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); + CFont::PrintString(SCREEN_FROM_RIGHT(27.0f + 61.0f), HUD_STRETCH_Y(132.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); } } } @@ -827,10 +828,10 @@ void CHud::Draw() { } } - CHud::Sprites[HUD_PAGER].Draw(CRect(SCREEN_STRETCH_X(26.0f - PagerXOffset), SCREEN_STRETCH_Y(27.0f), SCREEN_STRETCH_X(160.0 + 26.0f - PagerXOffset), SCREEN_STRETCH_Y(80.0f + 27.0f)), CRGBA(255, 255, 255, 255)); + CHud::Sprites[HUD_PAGER].Draw(CRect(HUD_STRETCH_X(26.0f - PagerXOffset), HUD_STRETCH_Y(27.0f), HUD_STRETCH_X(160.0 + 26.0f - PagerXOffset), HUD_STRETCH_Y(80.0f + 27.0f)), CRGBA(255, 255, 255, 255)); CFont::SetBackgroundOff(); - CFont::SetScale(SCREEN_STRETCH_X(0.84f), SCREEN_STRETCH_Y(1.0f)); + CFont::SetScale(HUD_STRETCH_X(0.84f), HUD_STRETCH_Y(1.0f)); CFont::SetColor(CRGBA(32, 162, 66, 205)); CFont::SetRightJustifyOff(); CFont::SetBackgroundOff(); @@ -838,7 +839,7 @@ void CHud::Draw() { CFont::SetJustifyOff(); CFont::SetPropOff(); CFont::SetFontStyle(FONT_PAGER); - CFont::PrintString(SCREEN_STRETCH_X(52.0f - PagerXOffset), SCREEN_STRETCH_Y(54.0f), CHud::m_PagerMessage); + CFont::PrintString(HUD_STRETCH_X(52.0f - PagerXOffset), HUD_STRETCH_Y(54.0f), CHud::m_PagerMessage); } /* @@ -846,7 +847,7 @@ void CHud::Draw() { */ if (CHud::m_ItemToFlash == 8 && CTimer::GetFrameCounter() & 8 || CHud::m_ItemToFlash != 8) { CRadar::DrawMap(); - CHud::Sprites[HUD_RADARDISC].Draw(CRect(SCREEN_STRETCH_X(16.0f), SCREEN_FROM_BOTTOM(123.0f + 4.0f), SCREEN_STRETCH_X(94.0f + 20.0f + 5.0f), SCREEN_FROM_BOTTOM(-76.0f + 123.0f - 6.0f)), CRGBA(0, 0, 0, 255)); + CHud::Sprites[HUD_RADARDISC].Draw(CRect(HUD_STRETCH_X(16.0f), SCREEN_FROM_BOTTOM(123.0f + 4.0f), HUD_STRETCH_X(94.0f + 20.0f + 5.0f), SCREEN_FROM_BOTTOM(-76.0f + 123.0f - 6.0f)), CRGBA(0, 0, 0, 255)); CRadar::DrawBlips(); } } @@ -868,7 +869,7 @@ void CHud::Draw() { do { if (CTheScripts::IntroTextLines[CounterB].m_awText[0] && CTheScripts::IntroTextLines[CounterB].field_29) { - CFont::SetScale(SCREEN_STRETCH_X(CTheScripts::IntroTextLines[CounterB].m_fScaleX), SCREEN_STRETCH_Y(CTheScripts::IntroTextLines[CounterB].m_fScaleY * 0.5f)); + CFont::SetScale(HUD_STRETCH_X(CTheScripts::IntroTextLines[CounterB].m_fScaleX), HUD_STRETCH_Y(CTheScripts::IntroTextLines[CounterB].m_fScaleY * 0.5f)); CFont::SetColor(CTheScripts::IntroTextLines[CounterB].m_sColor); if (CTheScripts::IntroTextLines[CounterB].m_bJustify) @@ -886,8 +887,8 @@ void CHud::Draw() { else CFont::SetCentreOff(); - CFont::SetWrapx(SCREEN_STRETCH_X(CTheScripts::IntroTextLines[CounterB].m_fWrapX)); - CFont::SetCentreSize(SCREEN_STRETCH_X(CTheScripts::IntroTextLines[CounterB].m_fCenterSize)); + CFont::SetWrapx(HUD_STRETCH_X(CTheScripts::IntroTextLines[CounterB].m_fWrapX)); + CFont::SetCentreSize(HUD_STRETCH_X(CTheScripts::IntroTextLines[CounterB].m_fCenterSize)); if (CTheScripts::IntroTextLines[CounterB].m_bBackground) CFont::SetBackgroundOn(); @@ -907,7 +908,7 @@ void CHud::Draw() { CFont::SetPropOff(); CFont::SetFontStyle(CTheScripts::IntroTextLines[CounterB].m_nFont); - CFont::PrintString(SCREEN_STRETCH_X(640.0f - CTheScripts::IntroTextLines[CounterB].field_36), SCREEN_STRETCH_Y(448.0f - CTheScripts::IntroTextLines[CounterB].field_40), IntroText->m_awText); + CFont::PrintString(HUD_STRETCH_X(640.0f - CTheScripts::IntroTextLines[CounterB].field_36), HUD_STRETCH_Y(448.0f - CTheScripts::IntroTextLines[CounterB].field_40), IntroText->m_awText); } ++CounterA; ++CounterB; @@ -951,7 +952,7 @@ void CHud::Draw() { CFont::SetJustifyOff(); CFont::SetBackgroundOff(); CFont::SetBackgroundColor(CRGBA(0, 0, 0, 128)); - CFont::SetScale(SCREEN_STRETCH_X(0.48f), SCREEN_STRETCH_Y(1.120f)); + CFont::SetScale(HUD_STRETCH_X(0.48f), HUD_STRETCH_Y(1.120f)); CFont::SetCentreOn(); CFont::SetPropOn(); CFont::SetFontStyle(FONT_BANK); @@ -976,13 +977,13 @@ void CHud::Draw() { CFont::SetJustifyOff(); CFont::SetBackgroundOff(); CFont::SetBackGroundOnlyTextOff(); - CFont::SetScale(SCREEN_STRETCH_X(1.8f), SCREEN_STRETCH_Y(1.8f)); + CFont::SetScale(HUD_STRETCH_X(1.8f), HUD_STRETCH_Y(1.8f)); CFont::SetPropOn(); CFont::SetCentreOn(); - CFont::SetCentreSize(SCREEN_STRETCH_X(615.0f)); + CFont::SetCentreSize(HUD_STRETCH_X(615.0f)); CFont::SetColor(CRGBA(255, 255, 0, 255)); CFont::SetFontStyle(FONT_HEADING); - if ((RsGlobal.maximumWidth - 20) <= BigMessageX[0]) { + if ((SCREENW - 20) <= BigMessageX[0]) { BigMessageInUse[0] = BigMessageInUse[0] + CTimer::GetTimeStep(); if (BigMessageInUse[0] >= 120.0f) { BigMessageInUse[0] = 120.0; @@ -1005,10 +1006,10 @@ void CHud::Draw() { BigMessageAlpha[0] = 255.0; } CFont::SetColor(CRGBA(0, 0, 0, BigMessageAlpha[0])); - CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - SCREEN_STRETCH_Y(20.0f - 2.0f), m_BigMessage[0]); + CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(20.0f - 2.0f), m_BigMessage[0]); CFont::SetColor(CRGBA(85, 119, 133, BigMessageAlpha[0])); - CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - SCREEN_STRETCH_Y(20.0f), m_BigMessage[0]); + CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(20.0f), m_BigMessage[0]); } else { BigMessageAlpha[0] = 0.0; @@ -1033,9 +1034,9 @@ void CHud::Draw() { CFont::SetBackgroundOff(); if (CGame::frenchGame || CGame::germanGame) - CFont::SetScale(SCREEN_STRETCH_X(1.4f), SCREEN_STRETCH_Y(1.4f)); + CFont::SetScale(HUD_STRETCH_X(1.4f), HUD_STRETCH_Y(1.4f)); else - CFont::SetScale(SCREEN_STRETCH_X(2.0f), SCREEN_STRETCH_Y(2.0f)); + CFont::SetScale(HUD_STRETCH_X(2.0f), HUD_STRETCH_Y(2.0f)); CFont::SetPropOn(); CFont::SetRightJustifyOn(); @@ -1137,20 +1138,20 @@ void CHud::DrawAfterFade() { CFont::SetPropOn(); if (CGame::germanGame) - CFont::SetScale(SCREEN_STRETCH_X(0.52f * 0.85f), SCREEN_STRETCH_Y(1.1f * 0.85f)); + CFont::SetScale(HUD_STRETCH_X(0.52f * 0.85f), HUD_STRETCH_Y(1.1f * 0.85f)); else - CFont::SetScale(SCREEN_STRETCH_X(0.52f), SCREEN_STRETCH_Y(1.1f)); + CFont::SetScale(HUD_STRETCH_X(0.52f), HUD_STRETCH_Y(1.1f)); CFont::SetColor(CRGBA(175, 175, 175, 255)); CFont::SetJustifyOff(); - CFont::SetWrapx(SCREEN_STRETCH_X(200.0f + 26.0f - 4.0f)); + CFont::SetWrapx(HUD_STRETCH_X(200.0f + 26.0f - 4.0f)); CFont::SetFontStyle(FONT_BANK); CFont::SetBackgroundOn(); CFont::SetBackGroundOnlyTextOff(); CRGBA BackColor = { 0, 0, 0, (uint8)(0.9f * fAlpha) }; CFont::SetBackgroundColor(BackColor); CFont::SetColor(CRGBA(175, 175, 175, 255)); - CFont::PrintString(SCREEN_STRETCH_X(26.0f), SCREEN_STRETCH_Y(28.0f + (150.0f - PagerXOffset) * 0.6f), CHud::m_HelpMessageToPrint); + CFont::PrintString(HUD_STRETCH_X(26.0f), HUD_STRETCH_Y(28.0f + (150.0f - PagerXOffset) * 0.6f), CHud::m_HelpMessageToPrint); CFont::SetAlphaFade(255.0f); CFont::DrawFonts(); } @@ -1165,17 +1166,17 @@ void CHud::DrawAfterFade() { if (m_BigMessage[4][0]) { CFont::SetJustifyOff(); CFont::SetBackgroundOff(); - CFont::SetScale(SCREEN_STRETCH_X(1.2f), SCREEN_STRETCH_Y(1.5f)); + CFont::SetScale(HUD_STRETCH_X(1.2f), HUD_STRETCH_Y(1.5f)); CFont::SetCentreOn(); CFont::SetPropOn(); - CFont::SetCentreSize(SCREEN_STRETCH_X(600.0f)); + CFont::SetCentreSize(HUD_STRETCH_X(600.0f)); CFont::SetFontStyle(FONT_BANK); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_STRETCH_X(2.0f) + (SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_STRETCH_Y(84.0f), m_BigMessage[4]); + CFont::PrintString(HUD_STRETCH_X(2.0f) + (SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(84.0f), m_BigMessage[4]); CFont::SetColor(CRGBA(89, 115, 150, 255)); - CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_STRETCH_Y(84.0f), m_BigMessage[4]); + CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(84.0f), m_BigMessage[4]); } @@ -1226,16 +1227,16 @@ void CHud::DrawAfterFade() { CFont::SetJustifyOff(); CFont::SetBackgroundOff(); - CFont::SetScale(SCREEN_STRETCH_X(1.0f), SCREEN_STRETCH_Y(1.2f)); + CFont::SetScale(HUD_STRETCH_X(1.0f), HUD_STRETCH_Y(1.2f)); CFont::SetCentreOn(); CFont::SetPropOn(); CFont::SetCentreSize(SCREEN_FROM_RIGHT(20.0f)); CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetFontStyle(FONT_BANK); - CFont::PrintString(SCREEN_STRETCH_X(2.0f) + (SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_STRETCH_Y(20.0f + 2.0f), m_BigMessage[5]); + CFont::PrintString(HUD_STRETCH_X(2.0f) + (SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(20.0f + 2.0f), m_BigMessage[5]); CFont::SetColor(CRGBA(156, 91, 40, 255)); - CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_STRETCH_Y(20.0f + 2.0f), m_BigMessage[5]); + CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(20.0f + 2.0f), m_BigMessage[5]); } /* @@ -1247,15 +1248,15 @@ void CHud::DrawAfterFade() { CFont::SetBackgroundOff(); if (CGame::frenchGame || CMenuManager::m_PrefsLanguage == 4) - CFont::SetScale(SCREEN_STRETCH_X(0.884f), SCREEN_STRETCH_Y(1.36f)); + CFont::SetScale(HUD_STRETCH_X(0.884f), HUD_STRETCH_Y(1.36f)); else - CFont::SetScale(SCREEN_STRETCH_X(1.04f), SCREEN_STRETCH_Y(1.6f)); + CFont::SetScale(HUD_STRETCH_X(1.04f), HUD_STRETCH_Y(1.6f)); CFont::SetPropOn(); CFont::SetRightJustifyWrap(-500); CFont::SetRightJustifyOn(); CFont::SetFontStyle(FONT_HEADING); - if ((RsGlobal.width - 20) <= BigMessageX[1]) { + if ((SCREENW - 20) <= BigMessageX[1]) { BigMessageInUse[1] = BigMessageInUse[1] + CTimer::GetTimeStep(); if (BigMessageInUse[1] >= 120.0f) { BigMessageInUse[1] = 120.0; -- cgit v1.2.3 From c1bd90c7ddcb28c0ba5ebe66ab90319ffeee6d8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Sun, 16 Jun 2019 21:39:48 +0300 Subject: CPed fixes and needed functions for further commits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: eray orçunus --- src/PedStat.h | 20 ++++++ src/Sounds.h | 174 +++++++++++++++++++++++++++++++++++++++++++++++ src/entities/Ped.cpp | 140 ++++++++++++++++++++++---------------- src/entities/Ped.h | 29 +++++--- src/entities/PedIK.h | 2 +- src/entities/PlayerPed.h | 34 ++++++++- 6 files changed, 330 insertions(+), 69 deletions(-) create mode 100644 src/PedStat.h create mode 100644 src/Sounds.h diff --git a/src/PedStat.h b/src/PedStat.h new file mode 100644 index 00000000..23c75a2b --- /dev/null +++ b/src/PedStat.h @@ -0,0 +1,20 @@ +#pragma once +#include "common.h" + +struct PedStat { + uint32 m_id; + char m_name[24]; + int32 m_fleeDistance; + int32 m_headingChangeRate; + int8 m_fear; + int8 m_temper; + int8 m_lawfulness; + int8 m_sexiness; + int32 m_attackStrength; + int32 m_defendWeakness; + int16 m_flags; + uint8 unknown1; + uint8 unknown2; +}; + +static_assert(sizeof(PedStat) == 0x34, "PedStat: error"); \ No newline at end of file diff --git a/src/Sounds.h b/src/Sounds.h new file mode 100644 index 00000000..f4f64e0e --- /dev/null +++ b/src/Sounds.h @@ -0,0 +1,174 @@ +#pragma once +#include "common.h" + +enum eSound : int16 +{ + SOUND_CAR_DOOR_CLOSE_BONNET = 0, + SOUND_CAR_DOOR_CLOSE_BUMPER = 1, + SOUND_CAR_DOOR_CLOSE_FRONT_LEFT = 2, + SOUND_CAR_DOOR_CLOSE_FRONT_RIGHT = 3, + SOUND_CAR_DOOR_CLOSE_BACK_LEFT = 4, + SOUND_CAR_DOOR_CLOSE_BACK_RIGHT = 5, + SOUND_CAR_DOOR_OPEN_BONNET = 6, + SOUND_CAR_DOOR_OPEN_BUMPER = 7, + SOUND_CAR_DOOR_OPEN_FRONT_LEFT = 8, + SOUND_CAR_DOOR_OPEN_FRONT_RIGHT = 9, + SOUND_CAR_DOOR_OPEN_BACK_LEFT = 10, + SOUND_CAR_DOOR_OPEN_BACK_RIGHT = 11, + SOUND_CAR_WINDSHIELD_CRACK = 12, + SOUND_CAR_JUMP = 13, + SOUND_E = 14, + SOUND_F = 15, + SOUND_CAR_ENGINE_START = 16, + SOUND_CAR_LIGHT_BREAK = 17, + SOUND_CAR_HYDRAULIC_1 = 18, + SOUND_CAR_HYDRAULIC_2 = 19, + SOUND_CAR_HYDRAULIC_3 = 20, + SOUND_CAR_JERK = 21, + SOUND_CAR_SPLASH = 22, + SOUND_17 = 23, + SOUND_18 = 24, + SOUND_19 = 25, + SOUND_CAR_TANK_TURRET_ROTATE = 26, + SOUND_CAR_BOMB_TICK = 27, + SOUND_PLANE_ON_GROUND = 28, + SOUND_STEP_START = 29, + SOUND_STEP_END = 30, + SOUND_FALL_LAND = 31, + SOUND_FALL_COLLAPSE = 32, + SOUND_21 = 33, + SOUND_22 = 34, + SOUND_23 = 35, + SOUND_24 = 36, + SOUND_25 = 37, + SOUND_26 = 38, + SOUND_WEAPON_PUNCH_ATTACK = 39, + SOUND_28 = 40, + SOUND_29 = 41, + SOUND_2A = 42, + SOUND_2B = 43, + SOUND_2C = 44, + SOUND_2D = 45, + SOUND_WEAPON_BAT_ATTACK = 46, + SOUND_WEAPON_SHOT_FIRED = 47, + SOUND_WEAPON_RELOAD = 48, + SOUND_31 = 49, + SOUND_32 = 50, + SOUND_33 = 51, + SOUND_WEAPON_FLAMETHROWER_FIRE = 52, + SOUND_WEAPON_SNIPER_SHOT_NO_ZOOM = 53, + SOUND_WEAPON_ROCKET_SHOT_NO_ZOOM = 54, + SOUND_WEAPON_HIT_PED = 55, + SOUND_WEAPON_HIT_VEHICLE = 56, + SOUND_GARAGE_NO_MONEY = 57, + SOUND_GARAGE_BAD_VEHICLE = 58, + SOUND_GARAGE_OPENING = 59, + SOUND_3C = 60, + SOUND_GARAGE_BOMB1_SET = 61, + SOUND_GARAGE_BOMB2_SET = 62, + SOUND_GARAGE_BOMB3_SET = 63, + SOUND_40 = 64, + SOUND_41 = 65, + SOUND_GARAGE_VEHICLE_DECLINED = 66, + SOUND_GARAGE_VEHICLE_ACCEPTED = 67, + SOUND_GARAGE_DOOR_CLOSED = 68, + SOUND_GARAGE_DOOR_OPENED = 69, + SOUND_CRANE_PICKUP = 70, + SOUND_PICKUP_WEAPON_BOUGHT = 71, + SOUND_PICKUP_WEAPON = 72, + SOUND_PICKUP_HEALTH = 73, + SOUND_4A = 74, + SOUND_4B = 75, + SOUND_PICKUP_ADRENALINE = 76, + SOUND_PICKUP_ARMOUR = 77, + SOUND_PICKUP_BONUS = 78, + SOUND_PICKUP_MONEY = 79, + SOUND_PICKUP_HIDDEN_PACKAGE = 80, + SOUND_PICKUP_PACMAN_PILL = 81, + SOUND_PICKUP_PACMAN_PACKAGE = 82, + SOUND_PICKUP_FLOAT_PACKAGE = 83, + SOUND_BOMB_TIMED_ACTIVATED = 84, + SOUND_55 = 85, + SOUND_BOMB_ONIGNITION_ACTIVATED = 86, + SOUND_BOMB_TICK = 87, + SOUND_RAMPAGE_START = 88, + SOUND_RAMPAGE_ONGOING = 89, + SOUND_RAMPAGE_PASSED = 90, + SOUND_RAMPAGE_FAILED = 91, + SOUND_RAMPAGE_KILL = 92, + SOUND_RAMPAGE_CAR_BLOWN = 93, + SOUND_EVIDENCE_PICKUP = 94, + SOUND_UNLOAD_GOLD = 95, + SOUND_PAGER = 96, + SOUND_PED_DEATH = 97, + SOUND_PED_DAMAGE = 98, + SOUND_PED_63 = 99, + SOUND_PED_LAND = 100, + SOUND_PED_BULLET_HIT = 101, + SOUND_PED_BOMBER = 102, + SOUND_PED_BURNING = 103, + SOUND_PED_ARREST_FBI = 104, + SOUND_PED_ARREST_SWAT = 105, + SOUND_PED_ARREST_COP = 106, + SOUND_PED_HELI_PLAYER_FOUND = 107, + SOUND_PED_HANDS_UP = 108, + SOUND_PED_HANDS_COWER = 109, + SOUND_PED_FLEE_SPRINT = 110, + SOUND_PED_CAR_JACKING = 111, + SOUND_PED_MUGGING = 112, + SOUND_PED_CAR_JACKED = 113, + SOUND_PED_ROBBED = 114, + SOUND_PED_TAXI_WAIT = 115, + SOUND_PED_ATTACK = 116, + SOUND_PED_DEFEND = 117, + SOUND_PED_PURSUIT_ARMY = 118, + SOUND_PED_PURSUIT_FBI = 119, + SOUND_PED_PURSUIT_SWAT = 120, + SOUND_PED_PURSUIT_COP = 121, + SOUND_PED_HEALING = 122, + SOUND_PED_7B = 123, + SOUND_PED_LEAVE_VEHICLE = 124, + SOUND_PED_EVADE = 125, + SOUND_PED_FLEE_RUN = 126, + SOUND_PED_CAR_COLLISION = 127, + SOUND_PED_SOLICIT = 128, + SOUND_PED_EXTINGUISHING_FIRE = 129, + SOUND_PED_WAIT_DOUBLEBACK = 130, + SOUND_PED_CHAT_SEXY = 131, + SOUND_PED_CHAT_EVENT = 132, + SOUND_PED_CHAT = 133, + SOUND_PED_BODYCAST_HIT = 134, + SOUND_PED_TAXI_CALL = 135, + SOUND_INJURED_PED_MALE_OUCH = 136, + SOUND_INJURED_PED_FEMALE = 137, + SOUND_8A = 138, + SOUND_RACE_START_3 = 139, + SOUND_RACE_START_2 = 140, + SOUND_RACE_START_1 = 141, + SOUND_RACE_START_GO = 142, + SOUND_SPLASH = 143, + SOUND_WATER_FALL = 144, + SOUND_SPLATTER = 145, + SOUND_CAR_PED_COLLISION = 146, + SOUND_CLOCK_TICK = 147, + SOUND_PART_MISSION_COMPLETE = 148, + SOUND_FRONTEND_MENU_STARTING = 149, + SOUND_FRONTEND_MENU_COMPLETED = 150, + SOUND_FRONTEND_MENU_DENIED = 151, + SOUND_FRONTEND_MENU_SUCCESS = 152, + SOUND_FRONTEND_EXIT = 153, + SOUND_9A = 154, + SOUND_9B = 155, + SOUND_FRONTEND_AUDIO_TEST = 156, + SOUND_FRONTEND_FAIL = 157, + SOUND_FRONTEND_NO_RADIO = 158, + SOUND_FRONTEND_RADIO_CHANGE = 159, + SOUND_A0 = 160, + SOUND_AMMUNATION_WELCOME_1 = 161, + SOUND_AMMUNATION_WELCOME_2 = 162, + SOUND_AMMUNATION_WELCOME_3 = 163, + SOUND_LIGHTNING = 164, + SOUND_A5 = 165, + SOUND_TOTAL_SOUNDS = 166, + SOUND_TOTAL_PED_SOUNDS = 167, +}; \ No newline at end of file diff --git a/src/entities/Ped.cpp b/src/entities/Ped.cpp index 00e7ecb7..cb7d7923 100644 --- a/src/entities/Ped.cpp +++ b/src/entities/Ped.cpp @@ -2,9 +2,9 @@ #include "patcher.h" #include "Ped.h" #include "Pools.h" -#include -#include -#include +#include "Particle.h" +#include "Stats.h" +#include "World.h" Bool &CPed::bNastyLimbsCheat = *(Bool*)0x95CD44; Bool &CPed::bPedCheat2 = *(Bool*)0x95CD5A; @@ -14,7 +14,7 @@ void *CPed::operator new(size_t sz) { return CPools::GetPedPool()->New(); } void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); } WRAPPER void CPed::KillPedWithCar(CVehicle *veh, float impulse) { EAXJMP(0x4EC430); } -WRAPPER void CPed::Say(uint16 audio) { EAXJMP(0x4E5A10); } +WRAPPER void CPed::Say(eSound audio) { EAXJMP(0x4E5A10); } WRAPPER void CPed::SetDie(AnimationId anim, float arg1, float arg2) { EAXJMP(0x4D37D0); } WRAPPER void CPed::SpawnFlyingComponent(int, signed char) { EAXJMP(0x4EB060); } @@ -201,7 +201,6 @@ CPed::AimGun() { RwV3d pos; CVector vector; - uint8 newFlag; if (m_pSeekTarget) { if (m_pSeekTarget->m_status == STATUS_PHYSICS) { @@ -210,9 +209,9 @@ CPed::AimGun() vector.y = pos.y; vector.z = pos.z; } else { - vector = *(m_pSeekTarget->GetMatrix().GetPosition()); + vector = *(m_pSeekTarget->GetPosition()); } - CPed::Say(0x74); + CPed::Say(SOUND_PED_ATTACK); m_ped_flagB2 = m_pedIK.PointGunAtPosition(&vector); if (m_pPedFight != m_pSeekTarget) { @@ -221,12 +220,10 @@ CPed::AimGun() } else { if (CPed::IsPlayer()) { - newFlag = m_pedIK.PointGunInDirection(m_fLookDirection, m_vecMoveSpeedAvg.y); + m_ped_flagB2 = m_pedIK.PointGunInDirection(m_fLookDirection, ((CPlayerPed*)this)->m_fFPSMoveHeading); } else { - newFlag = m_pedIK.PointGunInDirection(m_fLookDirection, 0.0); + m_ped_flagB2 = m_pedIK.PointGunInDirection(m_fLookDirection, 0.0f); } - - m_ped_flagB2 = newFlag; } } @@ -238,16 +235,15 @@ CPed::ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer) CVector pos2 = CVector( pos.x, pos.y, - pos.z + 0.1 + pos.z + 0.1f ); - if (!CPed::IsPlayer() || evenOnPlayer) - { + if (!CPed::IsPlayer() || evenOnPlayer) { ++CStats::HeadShots; - // yes. decompiled by hand. + // BUG: This condition will always return true. if (m_nPedState != PED_PASSENGER || m_nPedState != PED_TAXI_PASSENGER) { - CPed::SetDie(ANIM_KO_SHOT_FRONT1, 4.0, 0.0); + CPed::SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f); } m_ped_flagC20 = 1; @@ -255,30 +251,29 @@ CPed::ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer) CParticle::AddParticle(PARTICLE_TEST, pos2, CVector( - 0.0, - 0.0, - 0.0 + 0.0f, + 0.0f, + 0.0f ), NULL, 0.2f, 0, 0, 0, 0); - if (CEntity::GetIsOnScreen()) - { - for(int i=0; i<0x20; i++) { + if (CEntity::GetIsOnScreen()) { + for(int i=0; i < 32; i++) { CParticle::AddParticle(PARTICLE_BLOOD_SMALL, pos2, CVector( - 0.0, - 0.0, - 0.03 + 0.0f, + 0.0f, + 0.03f ), NULL, 0.0f, 0, 0, 0, 0); } - for (int i = 0; i < 0x10; i++) { + for (int i = 0; i < 16; i++) { CParticle::AddParticle(PARTICLE_DEBRIS2, pos2, CVector( - 0.0, - 0.0, - 0.0099999998 + 0.0f, + 0.0f, + 0.01f ), NULL, 0.0f, 0, 0, 0, 0); } } @@ -293,45 +288,40 @@ CPed::RemoveBodyPart(PedNode nodeId, char arg4) RwV3d zero; frame = GetNodeFrame(nodeId); - if (frame) - { - if (CGame::nastyGame) - { + if (frame) { + if (CGame::nastyGame) { if (nodeId != PED_HEAD) CPed::SpawnFlyingComponent(nodeId, arg4); RecurseFrameChildrenVisibilityCB(frame, 0); - zero.x = 0.0; - zero.z = 0.0; - zero.y = 0.0; + zero.x = 0.0f; + zero.z = 0.0f; + zero.y = 0.0f; for (fp = RwFrameGetParent(frame); fp; fp = RwFrameGetParent(frame)) RwV3dTransformPoints(&zero, &zero, 1, &fp->modelling); - if (CEntity::GetIsOnScreen()) - { + if (CEntity::GetIsOnScreen()) { CParticle::AddParticle(PARTICLE_TEST, zero, CVector( - 0.0, - 0.0, - 0.0 + 0.0f, + 0.0f, + 0.0f ), NULL, 0.2f, 0, 0, 0, 0); - for (int i = 0; i < 0x10; i++) { + for (int i = 0; i < 16; i++) { CParticle::AddParticle(PARTICLE_BLOOD_SMALL, zero, CVector( - 0.0, - 0.0, - 0.03 + 0.0f, + 0.0f, + 0.03f ), NULL, 0.0f, 0, 0, 0, 0); } } m_ped_flagC20 = 1; m_bodyPartBleeding = nodeId; } - } - else - { + } else { printf("Trying to remove ped component"); } } @@ -341,7 +331,7 @@ CPed::SetPedAtomicVisibilityCB(RwObject *object, void *data) { RwObject *result = object; if (!data) - object->flags = 0; + RpAtomicSetFlags(object, 0); return result; } @@ -357,18 +347,16 @@ CPed::RecurseFrameChildrenVisibilityCB(RwFrame *frame, void *data) void CPed::SetLookFlag(CPed *to, bool set) { - if (m_lookTimer < CTimer::GetTimeInMilliseconds()) - { + if (m_lookTimer < CTimer::GetTimeInMilliseconds()) { m_ped_flagA10 = 1; m_ped_flagA40 = 0; m_pPedFight = to; m_pPedFight->RegisterReference((CEntity**)&m_pPedFight); - m_fLookDirection = 999999; + m_fLookDirection = 999999.0f; m_lookTimer = 0; m_ped_flagA20_look = set; if (m_nPedState != PED_DRIVING) { - // Resets second right most bit - m_pedIK.m_flags &= 0xFFFFFFFD; + m_pedIK.m_flags &= ~(1 << 2); } } } @@ -376,8 +364,7 @@ CPed::SetLookFlag(CPed *to, bool set) void CPed::SetLookFlag(float angle, bool set) { - if (m_lookTimer < CTimer::GetTimeInMilliseconds()) - { + if (m_lookTimer < CTimer::GetTimeInMilliseconds()) { m_ped_flagA10 = 1; m_ped_flagA40 = 0; m_pPedFight = 0; @@ -385,12 +372,47 @@ CPed::SetLookFlag(float angle, bool set) m_lookTimer = 0; m_ped_flagA20_look = set; if (m_nPedState != PED_DRIVING) { - // Resets second right most bit - m_pedIK.m_flags &= 0xFFFFFFFD; + m_pedIK.m_flags &= ~(1 << 2); } } } +void +CPed::SetLookTimer(int time) +{ + if (CTimer::GetTimeInMilliseconds() > m_lookTimer) { + m_lookTimer = CTimer::GetTimeInMilliseconds() + time; + } +} + +bool +CPed::OurPedCanSeeThisOne(CEntity* who) +{ + float xDiff; + float yDiff; + float distance; + CColPoint colpoint; + CEntity* ent; + CVector ourPos; + CVector itsPos; + + ourPos = this->GetPosition(); + itsPos = who->GetPosition(); + + xDiff = itsPos.x - ourPos.x; + yDiff = itsPos.y - ourPos.y; + + if ((yDiff * this->GetUp().y) + (xDiff * this->GetUp().x) < 0.0f) + return 0; + + distance = sqrt(yDiff * yDiff + xDiff * xDiff); + + if (distance < 40.0f) + return 0; + + ourPos.z += 1.0f; + return CWorld::ProcessLineOfSight(ourPos, itsPos, colpoint, ent, 1, 0, 0, 0, 0, 0, 0) == 0; +} STARTPATCHES InjectHook(0x4CF8F0, &CPed::AddWeaponModel, PATCH_JUMP); @@ -399,4 +421,6 @@ STARTPATCHES InjectHook(0x4EAEE0, &CPed::RemoveBodyPart, PATCH_JUMP); InjectHook(0x4C6460, (void (CPed::*)(CPed*, bool)) &CPed::SetLookFlag, PATCH_JUMP); InjectHook(0x4C63E0, (void (CPed::*)(float, bool)) &CPed::SetLookFlag, PATCH_JUMP); + InjectHook(0x4D12E0, &CPed::SetLookTimer, PATCH_JUMP); + InjectHook(0x4C5700, &CPed::OurPedCanSeeThisOne, PATCH_JUMP); ENDPATCHES \ No newline at end of file diff --git a/src/entities/Ped.h b/src/entities/Ped.h index 2f0f67f0..dfefeddf 100644 --- a/src/entities/Ped.h +++ b/src/entities/Ped.h @@ -2,9 +2,12 @@ #include "Physical.h" #include "Weapon.h" +#include "PathFind.h" #include "PedIK.h" -#include -#include +#include "AnimManager.h" +#include "AnimBlendClumpData.h" +#include "PedStat.h" +#include "Sounds.h" enum { PED_MAX_WEAPONS = 13 @@ -162,7 +165,9 @@ public: uint8 m_ped_flagI20 : 1; uint8 m_ped_flagI40 : 1; uint8 m_ped_flagI80 : 1; - uint8 stuff10[60]; + uint8 stuff10[15]; + int32 m_field_16C; + uint8 stuff12[44]; int32 m_pEventEntity; float m_fAngleToEvent; AnimBlendFrameData *m_pFrames[PED_NODE_MAX]; @@ -172,7 +177,7 @@ public: CVector m_vecOffsetSeek; CPedIK m_pedIK; uint8 stuff1[8]; - int32 m_nPedStateTimer; + uint32 m_nPedStateTimer; int32 m_nPedState; int32 m_nLastPedState; int32 m_nMoveState; @@ -186,8 +191,8 @@ public: bool bInVehicle; uint8 stuff4[23]; int32 m_nPedType; - - uint8 stuff5[28]; + PedStat *m_pedStats; + uint8 stuff5[24]; CEntity *m_pCollidingEntity; uint8 stuff6[12]; CWeapon m_weapons[PED_MAX_WEAPONS]; @@ -205,7 +210,9 @@ public: uint32 m_lookTimer; uint8 stuff9[34]; uint8 m_bodyPartBleeding; - uint8 stuff11[73]; + uint8 m_field_4F3; + CPed *m_nearPeds[10]; + uint8 stuff11[32]; static void *operator new(size_t); static void operator delete(void*, size_t); @@ -215,19 +222,21 @@ public: void AddWeaponModel(int id); void AimGun(); void KillPedWithCar(CVehicle *veh, float impulse); - void Say(uint16 audio); + void Say(eSound audio); void SetLookFlag(CPed *to, bool set); void SetLookFlag(float angle, bool set); + void SetLookTimer(int time); void SetDie(AnimationId anim, float arg1, float arg2); void ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer); void RemoveBodyPart(PedNode nodeId, char arg4); void SpawnFlyingComponent(int, signed char); + bool OurPedCanSeeThisOne(CEntity* who); static RwObject *SetPedAtomicVisibilityCB(RwObject *object, void *data); static RwFrame *RecurseFrameChildrenVisibilityCB(RwFrame *frame, void *data); CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; } RwFrame* GetNodeFrame(int nodeId) { return m_pFrames[nodeId]->frame; } - + static Bool &bNastyLimbsCheat; static Bool &bPedCheat2; static Bool &bPedCheat3; @@ -241,4 +250,6 @@ static_assert(offsetof(CPed, m_weapons) == 0x35C, "CPed: error"); static_assert(offsetof(CPed, m_currentWeapon) == 0x498, "CPed: error"); static_assert(offsetof(CPed, m_lookTimer) == 0x4CC, "CPed: error"); static_assert(offsetof(CPed, m_bodyPartBleeding) == 0x4F2, "CPed: error"); +static_assert(offsetof(CPed, m_field_16C) == 0x16C, "CPed: error"); +static_assert(offsetof(CPed, m_pEventEntity) == 0x19C, "CPed: error"); static_assert(sizeof(CPed) == 0x53C, "CPed: error"); \ No newline at end of file diff --git a/src/entities/PedIK.h b/src/entities/PedIK.h index 5e873bf5..ecb17777 100644 --- a/src/entities/PedIK.h +++ b/src/entities/PedIK.h @@ -1,5 +1,5 @@ #pragma once -#include +#include "common.h" struct LimbOrientation { diff --git a/src/entities/PlayerPed.h b/src/entities/PlayerPed.h index 35128f46..08892277 100644 --- a/src/entities/PlayerPed.h +++ b/src/entities/PlayerPed.h @@ -5,7 +5,39 @@ class CPlayerPed : public CPed { public: + // All credits goes to DK22Pac // 0x53C - uint8 stuff[180]; + int *m_pWanted; // CWanted * + int *m_pArrestingCop; // CCopPed *m_pArrestingCop; + float m_fMoveSpeed; + float m_fCurrentStamina; + float m_fMaxStamina; + float m_fStaminaProgress; + char m_bWeaponSlot; + uint8 m_bSpeedTimerFlag; + bool m_bShouldEvade; + char field_1367; + uint32 m_nSpeedTimer; + uint32 m_nShotDelay; + float field_1376; + char field_1380; + char field_1381; + char field_1382; + char field_1383; + CEntity *m_pEvadingFrom; + int m_nTargettableObjects[4]; + bool m_bAdrenalineActive; + bool m_bHasLockOnTarget; + char field_1406; + char field_1407; + uint32 m_bAdrenalineTime; + bool m_bCanBeDamaged; + char field_1413; + char field_1414; + char field_1415; + CVector field_1416[6]; + int field_1488[6]; + float field_1512; + float m_fFPSMoveHeading; }; static_assert(sizeof(CPlayerPed) == 0x5F0, "CPlayerPed: error"); -- cgit v1.2.3 From 71ac32cbd7c801eb0c8f9e487faf9c547f6361ce Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 16 Jun 2019 21:41:58 +0200 Subject: fix the cleanup... --- src/common.h | 2 ++ src/render/Hud.cpp | 78 +++++++++++++++++++++++++++--------------------------- 2 files changed, 41 insertions(+), 39 deletions(-) diff --git a/src/common.h b/src/common.h index 9635f01e..a9055391 100644 --- a/src/common.h +++ b/src/common.h @@ -78,6 +78,8 @@ extern void **rwengine; #define HUD_STRETCH_X SCREEN_STRETCH_X_AR #define HUD_STRETCH_Y SCREEN_STRETCH_Y +#define HUD_FROM_RIGHT(a) (SCREEN_WIDTH - HUD_STRETCH_X(a)) +#define HUD_FROM_BOTTOM(a) (SCREEN_HEIGHT - HUD_STRETCH_Y(a)) struct GlobalScene { diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index cb3a20bb..5f39c6c6 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -332,10 +332,10 @@ void CHud::Draw() { CFont::SetPropOff(); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(110.0f - 2.0f), HUD_STRETCH_Y(43.0f + 2.0f), sPrint); + CFont::PrintString(HUD_FROM_RIGHT(110.0f - 2.0f), HUD_STRETCH_Y(43.0f + 2.0f), sPrint); CFont::SetColor(CRGBA(89, 115, 150, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(110.0f), HUD_STRETCH_Y(43.0f), sPrint); + CFont::PrintString(HUD_FROM_RIGHT(110.0f), HUD_STRETCH_Y(43.0f), sPrint); /* DrawClock @@ -345,10 +345,10 @@ void CHud::Draw() { CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(111.0f - 2.0f), HUD_STRETCH_Y(22.0f + 2.0f), sPrint); + CFont::PrintString(HUD_FROM_RIGHT(111.0f - 2.0f), HUD_STRETCH_Y(22.0f + 2.0f), sPrint); CFont::SetColor(CRGBA(194, 165, 120, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(111.0f), HUD_STRETCH_Y(22.0f), sPrint); + CFont::PrintString(HUD_FROM_RIGHT(111.0f), HUD_STRETCH_Y(22.0f), sPrint); /* DrawAmmo @@ -388,7 +388,7 @@ void CHud::Draw() { if (WeaponType) { if (WeaponType != 1) { CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(66.0f), HUD_STRETCH_Y(73.0f), sPrint); + CFont::PrintString(HUD_FROM_RIGHT(66.0f), HUD_STRETCH_Y(73.0f), sPrint); } } } @@ -397,7 +397,7 @@ void CHud::Draw() { DrawWeaponIcon */ CHud::Sprites[WeaponType].Draw( - CRect(SCREEN_FROM_RIGHT(99.0f), HUD_STRETCH_Y(27.0f), SCREEN_FROM_RIGHT(35.0f), HUD_STRETCH_Y(91.0f)), + CRect(HUD_FROM_RIGHT(99.0f), HUD_STRETCH_Y(27.0f), HUD_FROM_RIGHT(35.0f), HUD_STRETCH_Y(91.0f)), CRGBA(255, 255, 255, 255), 0.015f, 0.015f, @@ -432,17 +432,17 @@ void CHud::Draw() { AsciiToUnicode(sTemp, sPrint); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(110.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrint); + CFont::PrintString(HUD_FROM_RIGHT(110.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrint); if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) { - CFont::PrintString(SCREEN_FROM_RIGHT(164.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrintIcon); + CFont::PrintString(HUD_FROM_RIGHT(164.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrintIcon); } CFont::SetColor(CRGBA(186, 101, 50, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(110.0f), HUD_STRETCH_Y(65.0f), sPrint); + CFont::PrintString(HUD_FROM_RIGHT(110.0f), HUD_STRETCH_Y(65.0f), sPrint); if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) { - CFont::PrintString(SCREEN_FROM_RIGHT(164.0f), HUD_STRETCH_Y(65.0f), sPrintIcon); + CFont::PrintString(HUD_FROM_RIGHT(164.0f), HUD_STRETCH_Y(65.0f), sPrintIcon); } } } @@ -458,18 +458,18 @@ void CHud::Draw() { AsciiToUnicode(sTemp, sPrint); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(182.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrint); + CFont::PrintString(HUD_FROM_RIGHT(182.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrint); if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 4) { - CFont::PrintString(SCREEN_FROM_RIGHT(234.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrintIcon); + CFont::PrintString(HUD_FROM_RIGHT(234.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrintIcon); } CFont::SetColor(CRGBA(124, 140, 95, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(182.0f), HUD_STRETCH_Y(65.0f), sPrint); + CFont::PrintString(HUD_FROM_RIGHT(182.0f), HUD_STRETCH_Y(65.0f), sPrint); if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 1) { - CFont::PrintString(SCREEN_FROM_RIGHT(234.0f), HUD_STRETCH_Y(65.0f), sPrintIcon); + CFont::PrintString(HUD_FROM_RIGHT(234.0f), HUD_STRETCH_Y(65.0f), sPrintIcon); } } } @@ -489,13 +489,13 @@ void CHud::Draw() { for (int i = 0; i < 6; i++) { CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(2.0f + SCREEN_FROM_RIGHT(60.0f - 2.0f + 23.0f * i), HUD_STRETCH_Y(87.0f + 2.0f), sPrintIcon); + CFont::PrintString(2.0f + HUD_FROM_RIGHT(60.0f - 2.0f + 23.0f * i), HUD_STRETCH_Y(87.0f + 2.0f), sPrintIcon); if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel > i && (CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nLastWantedLevelChange + 2000 || CTimer::GetFrameCounter() & 4)) { CFont::SetColor(CRGBA(193, 164, 120, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(60.0f + 23.0f * i), HUD_STRETCH_Y(87.0f), sPrintIcon); + CFont::PrintString(HUD_FROM_RIGHT(60.0f + 23.0f * i), HUD_STRETCH_Y(87.0f), sPrintIcon); } } @@ -581,10 +581,10 @@ void CHud::Draw() { CFont::SetBackGroundOnlyTextOff(); CFont::SetFontStyle(FONT_BANK); CFont::SetColor(CRGBA(0, 0, 0, fZoneAlpha)); - CFont::PrintString(SCREEN_FROM_RIGHT(32.0f - 1.0f), SCREEN_FROM_BOTTOM(30.0f - 1.0f), CHud::m_ZoneToPrint); + CFont::PrintString(HUD_FROM_RIGHT(32.0f - 1.0f), HUD_FROM_BOTTOM(30.0f - 1.0f), CHud::m_ZoneToPrint); CFont::SetColor(CRGBA(152, 154, 82, fZoneAlpha)); - CFont::PrintString(SCREEN_FROM_RIGHT(32.0f), SCREEN_FROM_BOTTOM(30.0f), CHud::m_ZoneToPrint); + CFont::PrintString(HUD_FROM_RIGHT(32.0f), HUD_FROM_BOTTOM(30.0f), CHud::m_ZoneToPrint); } } } @@ -677,10 +677,10 @@ void CHud::Draw() { CFont::SetBackGroundOnlyTextOff(); CFont::SetFontStyle(FONT_BANK); CFont::SetColor(CRGBA(0, 0, 0, fVehicleAlpha)); - CFont::PrintString(SCREEN_FROM_RIGHT(32.0f - 1.0f), SCREEN_FROM_BOTTOM(55.0f - 1.0f), CHud::m_pVehicleNameToPrint); + CFont::PrintString(HUD_FROM_RIGHT(32.0f - 1.0f), HUD_FROM_BOTTOM(55.0f - 1.0f), CHud::m_pVehicleNameToPrint); CFont::SetColor(CRGBA(194, 165, 120, fVehicleAlpha)); - CFont::PrintString(SCREEN_FROM_RIGHT(32.0f), SCREEN_FROM_BOTTOM(55.0f), CHud::m_pVehicleNameToPrint); + CFont::PrintString(HUD_FROM_RIGHT(32.0f), HUD_FROM_BOTTOM(55.0f), CHud::m_pVehicleNameToPrint); } } } @@ -723,20 +723,20 @@ void CHud::Draw() { CFont::SetPropOff(); CFont::SetBackGroundOnlyTextOn(); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(27.0f - 2.0f), HUD_STRETCH_Y(110.0f + 2.0f), sTimer); + CFont::PrintString(HUD_FROM_RIGHT(27.0f - 2.0f), HUD_STRETCH_Y(110.0f + 2.0f), sTimer); CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f)); CFont::SetColor(CRGBA(186, 101, 50, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(27.0f), HUD_STRETCH_Y(110.0f), sTimer); + CFont::PrintString(HUD_FROM_RIGHT(27.0f), HUD_STRETCH_Y(110.0f), sTimer); if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText[0]) { CFont::SetPropOn(); CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f)); - CFont::PrintString(SCREEN_FROM_RIGHT(27.0f + 78.0f), HUD_STRETCH_Y(110.0f + 2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); + CFont::PrintString(HUD_FROM_RIGHT(27.0f + 78.0f), HUD_STRETCH_Y(110.0f + 2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); CFont::SetColor(CRGBA(186, 101, 50, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(27.0f + 80.0f), HUD_STRETCH_Y(110.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); + CFont::PrintString(HUD_FROM_RIGHT(27.0f + 80.0f), HUD_STRETCH_Y(110.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); } } } @@ -753,8 +753,8 @@ void CHud::Draw() { if (CTimer::GetFrameCounter() & 4 || !CounterFlashTimer) { if (CUserDisplay::OnscnTimer.m_sEntries[0].m_nType) { - CSprite2d::DrawRect(CRect(SCREEN_FROM_RIGHT(127.0f - 4.0f), HUD_STRETCH_Y(132.0 + 8.0f), SCREEN_FROM_RIGHT(23.0f), HUD_STRETCH_Y(11.0f + 132.0f + 8.0f)), CRGBA(0, 106, 164, 80)); - CSprite2d::DrawRect(CRect(SCREEN_FROM_RIGHT(127.0f + 4.0f), HUD_STRETCH_Y(132.0 + 8.0f), SCREEN_FROM_RIGHT(atoi(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer) + 27.0f + 100.0f + 4.0f), HUD_STRETCH_Y(11.0f + 132.0f + 8.0f)), CRGBA(0, 106, 164, 255)); + CSprite2d::DrawRect(CRect(HUD_FROM_RIGHT(127.0f - 4.0f), HUD_STRETCH_Y(132.0 + 8.0f), HUD_FROM_RIGHT(23.0f), HUD_STRETCH_Y(11.0f + 132.0f + 8.0f)), CRGBA(0, 106, 164, 80)); + CSprite2d::DrawRect(CRect(HUD_FROM_RIGHT(127.0f + 4.0f), HUD_STRETCH_Y(132.0 + 8.0f), HUD_FROM_RIGHT(atoi(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer) + 27.0f + 100.0f + 4.0f), HUD_STRETCH_Y(11.0f + 132.0f + 8.0f)), CRGBA(0, 106, 164, 255)); } else { AsciiToUnicode(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer, sTimer); @@ -771,10 +771,10 @@ void CHud::Draw() { CFont::SetPropOff(); CFont::SetBackGroundOnlyTextOn(); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(27.0f - 2.0f), HUD_STRETCH_Y(132.0f + 2.0f), sTimer); + CFont::PrintString(HUD_FROM_RIGHT(27.0f - 2.0f), HUD_STRETCH_Y(132.0f + 2.0f), sTimer); CFont::SetColor(CRGBA(0, 106, 164, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(27.0f), HUD_STRETCH_Y(132.0f), sTimer); + CFont::PrintString(HUD_FROM_RIGHT(27.0f), HUD_STRETCH_Y(132.0f), sTimer); } if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText[0]) { @@ -782,10 +782,10 @@ void CHud::Draw() { CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f)); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(27.0f + 59.0f), HUD_STRETCH_Y(132.0f + 2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); + CFont::PrintString(HUD_FROM_RIGHT(27.0f + 59.0f), HUD_STRETCH_Y(132.0f + 2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); CFont::SetColor(CRGBA(0, 106, 164, 255)); - CFont::PrintString(SCREEN_FROM_RIGHT(27.0f + 61.0f), HUD_STRETCH_Y(132.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); + CFont::PrintString(HUD_FROM_RIGHT(27.0f + 61.0f), HUD_STRETCH_Y(132.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); } } } @@ -847,7 +847,7 @@ void CHud::Draw() { */ if (CHud::m_ItemToFlash == 8 && CTimer::GetFrameCounter() & 8 || CHud::m_ItemToFlash != 8) { CRadar::DrawMap(); - CHud::Sprites[HUD_RADARDISC].Draw(CRect(HUD_STRETCH_X(16.0f), SCREEN_FROM_BOTTOM(123.0f + 4.0f), HUD_STRETCH_X(94.0f + 20.0f + 5.0f), SCREEN_FROM_BOTTOM(-76.0f + 123.0f - 6.0f)), CRGBA(0, 0, 0, 255)); + CHud::Sprites[HUD_RADARDISC].Draw(CRect(HUD_STRETCH_X(16.0f), HUD_FROM_BOTTOM(123.0f + 4.0f), HUD_STRETCH_X(94.0f + 20.0f + 5.0f), HUD_FROM_BOTTOM(-76.0f + 123.0f - 6.0f)), CRGBA(0, 0, 0, 255)); CRadar::DrawBlips(); } } @@ -958,14 +958,14 @@ void CHud::Draw() { CFont::SetFontStyle(FONT_BANK); if (TheCamera.m_WideScreenOn) - CFont::SetCentreSize(SCREEN_FROM_RIGHT(120.0f)); + CFont::SetCentreSize(HUD_FROM_RIGHT(120.0f)); else - CFont::SetCentreSize(SCREEN_FROM_RIGHT(280.0f)); + CFont::SetCentreSize(HUD_FROM_RIGHT(280.0f)); CFont::SetDropShadowPosition(1); CFont::SetDropColor(CRGBA(0, 0, 0, 255)); CFont::SetColor(CRGBA(235, 235, 235, 255)); - CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_FROM_BOTTOM(64.0f), CHud::m_Message); + CFont::PrintString(SCREEN_WIDTH / 2, HUD_FROM_BOTTOM(64.0f), CHud::m_Message); CFont::SetDropShadowPosition(0); } @@ -1043,10 +1043,10 @@ void CHud::Draw() { CFont::SetFontStyle(FONT_HEADING); CFont::SetColor(CRGBA(0, 0, 0, 0.75f * BigMessageAlpha[2])); - CFont::PrintString(SCREEN_FROM_RIGHT(20.0f + 4.0f), SCREEN_FROM_BOTTOM(78.0f), CHud::m_BigMessage[2]); + CFont::PrintString(HUD_FROM_RIGHT(20.0f + 4.0f), HUD_FROM_BOTTOM(78.0f), CHud::m_BigMessage[2]); CFont::SetColor(CRGBA(170, 123, 87, BigMessageAlpha[2])); - CFont::PrintString(SCREEN_FROM_RIGHT(20.0f), SCREEN_FROM_BOTTOM(82.0f), CHud::m_BigMessage[2]); + CFont::PrintString(HUD_FROM_RIGHT(20.0f), HUD_FROM_BOTTOM(82.0f), CHud::m_BigMessage[2]); } else { BigMessageAlpha[2] = 0.0; @@ -1230,7 +1230,7 @@ void CHud::DrawAfterFade() { CFont::SetScale(HUD_STRETCH_X(1.0f), HUD_STRETCH_Y(1.2f)); CFont::SetCentreOn(); CFont::SetPropOn(); - CFont::SetCentreSize(SCREEN_FROM_RIGHT(20.0f)); + CFont::SetCentreSize(HUD_FROM_RIGHT(20.0f)); CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetFontStyle(FONT_BANK); CFont::PrintString(HUD_STRETCH_X(2.0f) + (SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(20.0f + 2.0f), m_BigMessage[5]); @@ -1275,10 +1275,10 @@ void CHud::DrawAfterFade() { BigMessageAlpha[1] = 255.0; } CFont::SetColor(CRGBA(40, 40, 40, BigMessageAlpha[1])); - CFont::PrintString(SCREEN_FROM_RIGHT(20.0f - 2.0f), SCREEN_FROM_BOTTOM(120.0f), m_BigMessage[1]); + CFont::PrintString(HUD_FROM_RIGHT(20.0f - 2.0f), HUD_FROM_BOTTOM(120.0f), m_BigMessage[1]); CFont::SetColor(CRGBA(220, 172, 2, BigMessageAlpha[1])); - CFont::PrintString(SCREEN_FROM_RIGHT(20.0f), SCREEN_FROM_BOTTOM(120.0f), m_BigMessage[1]); + CFont::PrintString(HUD_FROM_RIGHT(20.0f), HUD_FROM_BOTTOM(120.0f), m_BigMessage[1]); } else { BigMessageAlpha[1] = 0.0; -- cgit v1.2.3 From 18cdf53723a4455c292bb32a34a52a03f26ff675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Sun, 16 Jun 2019 23:26:39 +0300 Subject: Delete duplicate enum MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: eray orçunus --- src/Sounds.h | 174 ---------------------------------------------------- src/audio/DMAudio.h | 16 ++--- src/entities/Ped.h | 2 +- 3 files changed, 9 insertions(+), 183 deletions(-) delete mode 100644 src/Sounds.h diff --git a/src/Sounds.h b/src/Sounds.h deleted file mode 100644 index f4f64e0e..00000000 --- a/src/Sounds.h +++ /dev/null @@ -1,174 +0,0 @@ -#pragma once -#include "common.h" - -enum eSound : int16 -{ - SOUND_CAR_DOOR_CLOSE_BONNET = 0, - SOUND_CAR_DOOR_CLOSE_BUMPER = 1, - SOUND_CAR_DOOR_CLOSE_FRONT_LEFT = 2, - SOUND_CAR_DOOR_CLOSE_FRONT_RIGHT = 3, - SOUND_CAR_DOOR_CLOSE_BACK_LEFT = 4, - SOUND_CAR_DOOR_CLOSE_BACK_RIGHT = 5, - SOUND_CAR_DOOR_OPEN_BONNET = 6, - SOUND_CAR_DOOR_OPEN_BUMPER = 7, - SOUND_CAR_DOOR_OPEN_FRONT_LEFT = 8, - SOUND_CAR_DOOR_OPEN_FRONT_RIGHT = 9, - SOUND_CAR_DOOR_OPEN_BACK_LEFT = 10, - SOUND_CAR_DOOR_OPEN_BACK_RIGHT = 11, - SOUND_CAR_WINDSHIELD_CRACK = 12, - SOUND_CAR_JUMP = 13, - SOUND_E = 14, - SOUND_F = 15, - SOUND_CAR_ENGINE_START = 16, - SOUND_CAR_LIGHT_BREAK = 17, - SOUND_CAR_HYDRAULIC_1 = 18, - SOUND_CAR_HYDRAULIC_2 = 19, - SOUND_CAR_HYDRAULIC_3 = 20, - SOUND_CAR_JERK = 21, - SOUND_CAR_SPLASH = 22, - SOUND_17 = 23, - SOUND_18 = 24, - SOUND_19 = 25, - SOUND_CAR_TANK_TURRET_ROTATE = 26, - SOUND_CAR_BOMB_TICK = 27, - SOUND_PLANE_ON_GROUND = 28, - SOUND_STEP_START = 29, - SOUND_STEP_END = 30, - SOUND_FALL_LAND = 31, - SOUND_FALL_COLLAPSE = 32, - SOUND_21 = 33, - SOUND_22 = 34, - SOUND_23 = 35, - SOUND_24 = 36, - SOUND_25 = 37, - SOUND_26 = 38, - SOUND_WEAPON_PUNCH_ATTACK = 39, - SOUND_28 = 40, - SOUND_29 = 41, - SOUND_2A = 42, - SOUND_2B = 43, - SOUND_2C = 44, - SOUND_2D = 45, - SOUND_WEAPON_BAT_ATTACK = 46, - SOUND_WEAPON_SHOT_FIRED = 47, - SOUND_WEAPON_RELOAD = 48, - SOUND_31 = 49, - SOUND_32 = 50, - SOUND_33 = 51, - SOUND_WEAPON_FLAMETHROWER_FIRE = 52, - SOUND_WEAPON_SNIPER_SHOT_NO_ZOOM = 53, - SOUND_WEAPON_ROCKET_SHOT_NO_ZOOM = 54, - SOUND_WEAPON_HIT_PED = 55, - SOUND_WEAPON_HIT_VEHICLE = 56, - SOUND_GARAGE_NO_MONEY = 57, - SOUND_GARAGE_BAD_VEHICLE = 58, - SOUND_GARAGE_OPENING = 59, - SOUND_3C = 60, - SOUND_GARAGE_BOMB1_SET = 61, - SOUND_GARAGE_BOMB2_SET = 62, - SOUND_GARAGE_BOMB3_SET = 63, - SOUND_40 = 64, - SOUND_41 = 65, - SOUND_GARAGE_VEHICLE_DECLINED = 66, - SOUND_GARAGE_VEHICLE_ACCEPTED = 67, - SOUND_GARAGE_DOOR_CLOSED = 68, - SOUND_GARAGE_DOOR_OPENED = 69, - SOUND_CRANE_PICKUP = 70, - SOUND_PICKUP_WEAPON_BOUGHT = 71, - SOUND_PICKUP_WEAPON = 72, - SOUND_PICKUP_HEALTH = 73, - SOUND_4A = 74, - SOUND_4B = 75, - SOUND_PICKUP_ADRENALINE = 76, - SOUND_PICKUP_ARMOUR = 77, - SOUND_PICKUP_BONUS = 78, - SOUND_PICKUP_MONEY = 79, - SOUND_PICKUP_HIDDEN_PACKAGE = 80, - SOUND_PICKUP_PACMAN_PILL = 81, - SOUND_PICKUP_PACMAN_PACKAGE = 82, - SOUND_PICKUP_FLOAT_PACKAGE = 83, - SOUND_BOMB_TIMED_ACTIVATED = 84, - SOUND_55 = 85, - SOUND_BOMB_ONIGNITION_ACTIVATED = 86, - SOUND_BOMB_TICK = 87, - SOUND_RAMPAGE_START = 88, - SOUND_RAMPAGE_ONGOING = 89, - SOUND_RAMPAGE_PASSED = 90, - SOUND_RAMPAGE_FAILED = 91, - SOUND_RAMPAGE_KILL = 92, - SOUND_RAMPAGE_CAR_BLOWN = 93, - SOUND_EVIDENCE_PICKUP = 94, - SOUND_UNLOAD_GOLD = 95, - SOUND_PAGER = 96, - SOUND_PED_DEATH = 97, - SOUND_PED_DAMAGE = 98, - SOUND_PED_63 = 99, - SOUND_PED_LAND = 100, - SOUND_PED_BULLET_HIT = 101, - SOUND_PED_BOMBER = 102, - SOUND_PED_BURNING = 103, - SOUND_PED_ARREST_FBI = 104, - SOUND_PED_ARREST_SWAT = 105, - SOUND_PED_ARREST_COP = 106, - SOUND_PED_HELI_PLAYER_FOUND = 107, - SOUND_PED_HANDS_UP = 108, - SOUND_PED_HANDS_COWER = 109, - SOUND_PED_FLEE_SPRINT = 110, - SOUND_PED_CAR_JACKING = 111, - SOUND_PED_MUGGING = 112, - SOUND_PED_CAR_JACKED = 113, - SOUND_PED_ROBBED = 114, - SOUND_PED_TAXI_WAIT = 115, - SOUND_PED_ATTACK = 116, - SOUND_PED_DEFEND = 117, - SOUND_PED_PURSUIT_ARMY = 118, - SOUND_PED_PURSUIT_FBI = 119, - SOUND_PED_PURSUIT_SWAT = 120, - SOUND_PED_PURSUIT_COP = 121, - SOUND_PED_HEALING = 122, - SOUND_PED_7B = 123, - SOUND_PED_LEAVE_VEHICLE = 124, - SOUND_PED_EVADE = 125, - SOUND_PED_FLEE_RUN = 126, - SOUND_PED_CAR_COLLISION = 127, - SOUND_PED_SOLICIT = 128, - SOUND_PED_EXTINGUISHING_FIRE = 129, - SOUND_PED_WAIT_DOUBLEBACK = 130, - SOUND_PED_CHAT_SEXY = 131, - SOUND_PED_CHAT_EVENT = 132, - SOUND_PED_CHAT = 133, - SOUND_PED_BODYCAST_HIT = 134, - SOUND_PED_TAXI_CALL = 135, - SOUND_INJURED_PED_MALE_OUCH = 136, - SOUND_INJURED_PED_FEMALE = 137, - SOUND_8A = 138, - SOUND_RACE_START_3 = 139, - SOUND_RACE_START_2 = 140, - SOUND_RACE_START_1 = 141, - SOUND_RACE_START_GO = 142, - SOUND_SPLASH = 143, - SOUND_WATER_FALL = 144, - SOUND_SPLATTER = 145, - SOUND_CAR_PED_COLLISION = 146, - SOUND_CLOCK_TICK = 147, - SOUND_PART_MISSION_COMPLETE = 148, - SOUND_FRONTEND_MENU_STARTING = 149, - SOUND_FRONTEND_MENU_COMPLETED = 150, - SOUND_FRONTEND_MENU_DENIED = 151, - SOUND_FRONTEND_MENU_SUCCESS = 152, - SOUND_FRONTEND_EXIT = 153, - SOUND_9A = 154, - SOUND_9B = 155, - SOUND_FRONTEND_AUDIO_TEST = 156, - SOUND_FRONTEND_FAIL = 157, - SOUND_FRONTEND_NO_RADIO = 158, - SOUND_FRONTEND_RADIO_CHANGE = 159, - SOUND_A0 = 160, - SOUND_AMMUNATION_WELCOME_1 = 161, - SOUND_AMMUNATION_WELCOME_2 = 162, - SOUND_AMMUNATION_WELCOME_3 = 163, - SOUND_LIGHTNING = 164, - SOUND_A5 = 165, - SOUND_TOTAL_SOUNDS = 166, - SOUND_TOTAL_PED_SOUNDS = 167, -}; \ No newline at end of file diff --git a/src/audio/DMAudio.h b/src/audio/DMAudio.h index 1b18c28c..d2e3a22e 100644 --- a/src/audio/DMAudio.h +++ b/src/audio/DMAudio.h @@ -1,6 +1,6 @@ #pragma once -enum eSound { +enum eSound : int16 { SOUND_CAR_DOOR_CLOSE_BONNET = 0, SOUND_CAR_DOOR_CLOSE_BUMPER = 1, SOUND_CAR_DOOR_CLOSE_FRONT_LEFT = 2, @@ -95,8 +95,8 @@ enum eSound { SOUND_RAMPAGE_FAILED = 91, SOUND_RAMPAGE_KILL = 92, SOUND_RAMPAGE_CAR_BLOWN = 93, - SOUND_EVIDENCE_PICKUP = 94, - SOUND_UNLOAD_GOLD = 95, + _SOUND_EVIDENCE_PICKUP = 94, + _SOUND_UNLOAD_GOLD = 95, SOUND_PAGER = 96, SOUND_PED_DEATH = 97, SOUND_PED_DAMAGE = 98, @@ -140,16 +140,16 @@ enum eSound { SOUND_INJURED_PED_MALE_OUCH = 136, SOUND_INJURED_PED_FEMALE = 137, SOUND_8A = 138, - SOUND_RACE_START_3 = 139, - SOUND_RACE_START_2 = 140, - SOUND_RACE_START_1 = 141, - SOUND_RACE_START_GO = 142, + _SOUND_RACE_START_3 = 139, + _SOUND_RACE_START_2 = 140, + _SOUND_RACE_START_1 = 141, + _SOUND_RACE_START_GO = 142, SOUND_SPLASH = 143, SOUND_WATER_FALL = 144, SOUND_SPLATTER = 145, SOUND_CAR_PED_COLLISION = 146, SOUND_CLOCK_TICK = 147, - SOUND_PART_MISSION_COMPLETE = 148, + _SOUND_PART_MISSION_COMPLETE = 148, SOUND_FRONTEND_MENU_STARTING = 149, SOUND_FRONTEND_MENU_COMPLETED = 150, SOUND_FRONTEND_MENU_DENIED = 151, diff --git a/src/entities/Ped.h b/src/entities/Ped.h index a1f14afb..2143fa93 100644 --- a/src/entities/Ped.h +++ b/src/entities/Ped.h @@ -7,7 +7,7 @@ #include "AnimManager.h" #include "AnimBlendClumpData.h" #include "PedStat.h" -#include "Sounds.h" +#include "DMAudio.h" enum { PED_MAX_WEAPONS = 13 -- cgit v1.2.3 From 93223b2baca75e53b88ca5d5a7ac7a2412368657 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 16 Jun 2019 23:12:14 +0200 Subject: some more cleanup --- src/PedStat.h | 9 +++----- src/audio/DMAudio.h | 8 +++---- src/entities/Ped.cpp | 61 +++++++++++++++++++--------------------------------- src/entities/Ped.h | 15 +++++++------ src/entities/PedIK.h | 7 ++++++ 5 files changed, 44 insertions(+), 56 deletions(-) diff --git a/src/PedStat.h b/src/PedStat.h index 23c75a2b..3045e494 100644 --- a/src/PedStat.h +++ b/src/PedStat.h @@ -1,7 +1,7 @@ #pragma once -#include "common.h" -struct PedStat { +struct PedStat +{ uint32 m_id; char m_name[24]; int32 m_fleeDistance; @@ -13,8 +13,5 @@ struct PedStat { int32 m_attackStrength; int32 m_defendWeakness; int16 m_flags; - uint8 unknown1; - uint8 unknown2; }; - -static_assert(sizeof(PedStat) == 0x34, "PedStat: error"); \ No newline at end of file +static_assert(sizeof(PedStat) == 0x34, "PedStat: error"); diff --git a/src/audio/DMAudio.h b/src/audio/DMAudio.h index d2e3a22e..b9e60b60 100644 --- a/src/audio/DMAudio.h +++ b/src/audio/DMAudio.h @@ -1,6 +1,7 @@ #pragma once -enum eSound : int16 { +enum eSound +{ SOUND_CAR_DOOR_CLOSE_BONNET = 0, SOUND_CAR_DOOR_CLOSE_BUMPER = 1, SOUND_CAR_DOOR_CLOSE_FRONT_LEFT = 2, @@ -180,8 +181,7 @@ public: void ReleaseDigitalHandle(void); void ReacquireDigitalHandle(void); void Service(void); - void ReportCollision(CEntity* A, CEntity* B, uint8 surfA, uint8 surfB, - float impulse, float speed); + void ReportCollision(CEntity* A, CEntity* B, uint8 surfA, uint8 surfB, float impulse, float speed); void ResetTimers(UInt32 timerval); Bool IsAudioInitialised(void); Char GetCDAudioDriveLetter(void); @@ -189,4 +189,4 @@ public: void ChangeMusicMode(UInt8 mode); void PlayFrontEndSound(uint32, uint32); }; -extern cDMAudio& DMAudio; +extern cDMAudio &DMAudio; diff --git a/src/entities/Ped.cpp b/src/entities/Ped.cpp index fbd59b3e..8d51c1f2 100644 --- a/src/entities/Ped.cpp +++ b/src/entities/Ped.cpp @@ -1,10 +1,12 @@ #include "common.h" #include "patcher.h" -#include "Ped.h" #include "Pools.h" #include "Particle.h" #include "Stats.h" #include "World.h" +#include "PedStat.h" +#include "DMaudio.h" +#include "Ped.h" Bool &CPed::bNastyLimbsCheat = *(Bool*)0x95CD44; Bool &CPed::bPedCheat2 = *(Bool*)0x95CD5A; @@ -14,9 +16,9 @@ void *CPed::operator new(size_t sz) { return CPools::GetPedPool()->New(); } void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); } WRAPPER void CPed::KillPedWithCar(CVehicle *veh, float impulse) { EAXJMP(0x4EC430); } -WRAPPER void CPed::Say(eSound audio) { EAXJMP(0x4E5A10); } +WRAPPER void CPed::Say(uint16 audio) { EAXJMP(0x4E5A10); } WRAPPER void CPed::SetDie(AnimationId anim, float arg1, float arg2) { EAXJMP(0x4D37D0); } -WRAPPER void CPed::SpawnFlyingComponent(int, signed char) { EAXJMP(0x4EB060); } +WRAPPER void CPed::SpawnFlyingComponent(int, int8) { EAXJMP(0x4EB060); } static char ObjectiveText[34][28] = { "No Obj", @@ -250,38 +252,27 @@ CPed::ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer) m_nPedStateTimer = CTimer::GetTimeInMilliseconds() + 150; CParticle::AddParticle(PARTICLE_TEST, pos2, - CVector( - 0.0f, - 0.0f, - 0.0f - ), NULL, 0.2f, 0, 0, 0, 0); + CVector(0.0f, 0.0f, 0.0f), nil, 0.2f, 0, 0, 0, 0); if (CEntity::GetIsOnScreen()) { for(int i=0; i < 32; i++) { CParticle::AddParticle(PARTICLE_BLOOD_SMALL, - pos2, - CVector( - 0.0f, - 0.0f, - 0.03f - ), NULL, 0.0f, 0, 0, 0, 0); + pos2, CVector(0.0f, 0.0f, 0.03f), + nil, 0.0f, 0, 0, 0, 0); } for (int i = 0; i < 16; i++) { CParticle::AddParticle(PARTICLE_DEBRIS2, - pos2, - CVector( - 0.0f, - 0.0f, - 0.01f - ), NULL, 0.0f, 0, 0, 0, 0); + pos2, + CVector(0.0f, 0.0f, 0.01f), + nil, 0.0f, 0, 0, 0, 0); } } } } void -CPed::RemoveBodyPart(PedNode nodeId, char arg4) +CPed::RemoveBodyPart(PedNode nodeId, int8 unk) { RwFrame *frame; RwFrame *fp; @@ -291,7 +282,7 @@ CPed::RemoveBodyPart(PedNode nodeId, char arg4) if (frame) { if (CGame::nastyGame) { if (nodeId != PED_HEAD) - CPed::SpawnFlyingComponent(nodeId, arg4); + CPed::SpawnFlyingComponent(nodeId, unk); RecurseFrameChildrenVisibilityCB(frame, 0); zero.x = 0.0f; @@ -302,20 +293,14 @@ CPed::RemoveBodyPart(PedNode nodeId, char arg4) if (CEntity::GetIsOnScreen()) { CParticle::AddParticle(PARTICLE_TEST, zero, - CVector( - 0.0f, - 0.0f, - 0.0f - ), NULL, 0.2f, 0, 0, 0, 0); + CVector(0.0f, 0.0f, 0.0f), + nil, 0.2f, 0, 0, 0, 0); for (int i = 0; i < 16; i++) { CParticle::AddParticle(PARTICLE_BLOOD_SMALL, zero, - CVector( - 0.0f, - 0.0f, - 0.03f - ), NULL, 0.0f, 0, 0, 0, 0); + CVector(0.0f, 0.0f, 0.03f), + nil, 0.0f, 0, 0, 0, 0); } } m_ped_flagC20 = 1; @@ -329,11 +314,9 @@ CPed::RemoveBodyPart(PedNode nodeId, char arg4) RwObject* CPed::SetPedAtomicVisibilityCB(RwObject *object, void *data) { - RwObject *result = object; - if (!data) + if (data == 0) RpAtomicSetFlags(object, 0); - - return result; + return object; } RwFrame* @@ -356,7 +339,7 @@ CPed::SetLookFlag(CPed *to, bool set) m_lookTimer = 0; m_ped_flagA20_look = set; if (m_nPedState != PED_DRIVING) { - m_pedIK.m_flags &= ~(1 << 2); + m_pedIK.m_flags &= ~CPedIK::FLAG_4; } } } @@ -372,7 +355,7 @@ CPed::SetLookFlag(float angle, bool set) m_lookTimer = 0; m_ped_flagA20_look = set; if (m_nPedState != PED_DRIVING) { - m_pedIK.m_flags &= ~(1 << 2); + m_pedIK.m_flags &= ~CPedIK::FLAG_4; } } } @@ -411,7 +394,7 @@ CPed::OurPedCanSeeThisOne(CEntity* who) return 0; ourPos.z += 1.0f; - return CWorld::ProcessLineOfSight(ourPos, itsPos, colpoint, ent, 1, 0, 0, 0, 0, 0, 0) == 0; + return !CWorld::ProcessLineOfSight(ourPos, itsPos, colpoint, ent, 1, 0, 0, 0, 0, 0, 0); } STARTPATCHES diff --git a/src/entities/Ped.h b/src/entities/Ped.h index 2143fa93..6a2f8ef1 100644 --- a/src/entities/Ped.h +++ b/src/entities/Ped.h @@ -2,12 +2,12 @@ #include "Physical.h" #include "Weapon.h" -#include "PathFind.h" #include "PedIK.h" #include "AnimManager.h" #include "AnimBlendClumpData.h" -#include "PedStat.h" -#include "DMAudio.h" + +struct PedStat; +struct CPathNode; enum { PED_MAX_WEAPONS = 13 @@ -234,25 +234,26 @@ public: static void *operator new(size_t); static void operator delete(void*, size_t); + // TODO: enum! bool IsPlayer(void) { return m_nPedType == 0 || m_nPedType== 1 || m_nPedType == 2 || m_nPedType == 3; } bool UseGroundColModel(void); void AddWeaponModel(int id); void AimGun(); void KillPedWithCar(CVehicle *veh, float impulse); - void Say(eSound audio); + void Say(uint16 audio); void SetLookFlag(CPed *to, bool set); void SetLookFlag(float angle, bool set); void SetLookTimer(int time); void SetDie(AnimationId anim, float arg1, float arg2); void ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer); - void RemoveBodyPart(PedNode nodeId, char arg4); - void SpawnFlyingComponent(int, signed char); + void RemoveBodyPart(PedNode nodeId, int8 unknown); + void SpawnFlyingComponent(int, int8 unknown); bool OurPedCanSeeThisOne(CEntity* who); static RwObject *SetPedAtomicVisibilityCB(RwObject *object, void *data); static RwFrame *RecurseFrameChildrenVisibilityCB(RwFrame *frame, void *data); CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; } - RwFrame* GetNodeFrame(int nodeId) { return m_pFrames[nodeId]->frame; } + RwFrame *GetNodeFrame(int nodeId) { return m_pFrames[nodeId]->frame; } static Bool &bNastyLimbsCheat; static Bool &bPedCheat2; diff --git a/src/entities/PedIK.h b/src/entities/PedIK.h index ecb17777..67aaa469 100644 --- a/src/entities/PedIK.h +++ b/src/entities/PedIK.h @@ -12,6 +12,13 @@ class CPed; class CPedIK { public: + // TODO + enum { + FLAG_1, + FLAG_2, + FLAG_4, + }; + CPed* m_ped; LimbOrientation m_headOrient; LimbOrientation m_torsoOrient; -- cgit v1.2.3 From e8c5f7da528ae8ddb5bf77671e3b95323fd7e975 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 16 Jun 2019 23:33:20 +0200 Subject: updated guidelines --- README.md | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0d6fe00a..66dd3e68 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ to reverse at the time, calling the original functions is acceptable. This is a list of some things that have been reversed to some non-trivial extent. Not everything is listed, check the code. +(TODO: keep this list at least a bit up to date...) ``` CPool @@ -52,6 +53,11 @@ CPathFind CCam CParticle CParticleMgr +CPointLights +CCoronas +CAntennas +CClouds +CHud ``` # Low hanging fruit @@ -79,9 +85,12 @@ functionname(args) if(a == b){ s1; s2; + }else{ + s3; + s4; } if(x != y) - s3; + s5; } type functionname(args) @@ -89,9 +98,12 @@ type functionname(args) if (a == b) { s1; s2; + } else { + s3; + s4; } if (x != y) - s3; + s5; } ``` @@ -105,14 +117,31 @@ type functionname ( args ) s1; s2; } - if ( x != y ) + else { s3; + s4; + } + if ( x != y ) + { + s5; } } ``` -Indentation is done with TABS. +i.e. + +* Put the brace on the same line as control statements + +* Put the brace on the next line after function definitions and structs/classes + +* Put an `else` on the same line with the braces + +* Don't put braces around single statements + +* Put the function return type on a separate line + +* Indent with TABS As for the less cosmetic choices, here are some guidelines how the code should look: @@ -124,6 +153,8 @@ since `4` will be used in other places and you can't easily see where else the e * Use the right types. In particular: + * use the lower case types! (unless you're Fire_Head) + * don't use types like `__int16`, we have `int16` for that * don't use `unsigned`, we have typedefs for that @@ -132,6 +163,8 @@ since `4` will be used in other places and you can't easily see where else the e * don't even think about using win32 types (`BYTE`, `WORD`, &c.) unless you're writing win32 specific code + * declare pointers like `int *ptr;`, not `int* ptr;` + * As for variable names, the original gta source code was not written in a uniform style, but here are some observations: -- cgit v1.2.3 From 0add48abf589330ae6fe11e304c111d9f52ce009 Mon Sep 17 00:00:00 2001 From: aap Date: Mon, 17 Jun 2019 00:16:38 +0200 Subject: got rid of upper case types --- README.md | 2 - src/Camera.cpp | 2 +- src/Camera.h | 2 +- src/Clock.cpp | 2 +- src/ControllerConfig.cpp | 10 +- src/ControllerConfig.h | 16 +- src/Frontend.cpp | 6 +- src/Frontend.h | 6 +- src/Game.cpp | 6 +- src/Game.h | 6 +- src/General.h | 2 +- src/PCSave.cpp | 2 +- src/PCSave.h | 2 +- src/Pad.cpp | 232 ++++++++++++------------- src/Pad.h | 368 ++++++++++++++++++++-------------------- src/Radar.cpp | 2 +- src/Radar.h | 2 +- src/Stats.cpp | 4 +- src/Stats.h | 4 +- src/Timer.cpp | 36 ++-- src/Timer.h | 12 +- src/Wanted.h | 4 +- src/audio/AudioScriptObject.cpp | 4 +- src/audio/AudioScriptObject.h | 2 +- src/audio/DMAudio.cpp | 10 +- src/audio/DMAudio.h | 10 +- src/audio/MusicManager.h | 14 +- src/common.h | 39 ++--- src/control/Population.cpp | 2 +- src/control/Population.h | 2 +- src/control/Record.cpp | 4 +- src/control/Record.h | 4 +- src/control/Replay.cpp | 2 +- src/control/Replay.h | 2 +- src/control/Script.h | 28 +-- src/entities/Ped.cpp | 6 +- src/entities/Ped.h | 12 +- src/entities/PlayerInfo.h | 14 +- src/entities/PlayerPed.h | 28 +-- src/entities/Vehicle.cpp | 10 +- src/entities/Vehicle.h | 10 +- src/render/Hud.cpp | 46 ++--- src/render/Hud.h | 24 +-- src/render/Particle.cpp | 206 +++++++++++----------- src/render/Particle.h | 54 +++--- src/render/ParticleMgr.cpp | 20 +-- src/render/ParticleMgr.h | 64 +++---- src/skel/events.cpp | 18 +- src/skel/win/win.cpp | 46 ++--- 49 files changed, 701 insertions(+), 708 deletions(-) diff --git a/README.md b/README.md index 66dd3e68..03431ef7 100644 --- a/README.md +++ b/README.md @@ -153,8 +153,6 @@ since `4` will be used in other places and you can't easily see where else the e * Use the right types. In particular: - * use the lower case types! (unless you're Fire_Head) - * don't use types like `__int16`, we have `int16` for that * don't use `unsigned`, we have typedefs for that diff --git a/src/Camera.cpp b/src/Camera.cpp index ebe08f09..7bd4aac9 100644 --- a/src/Camera.cpp +++ b/src/Camera.cpp @@ -14,7 +14,7 @@ const float DefaultFOV = 80.0f; // actually 70.0f CCamera &TheCamera = *(CCamera*)0x6FACF8; -Bool &CCamera::m_bUseMouse3rdPerson = *(Bool *)0x5F03D8; +bool &CCamera::m_bUseMouse3rdPerson = *(bool *)0x5F03D8; WRAPPER void CCamera::DrawBordersForWideScreen(void) { EAXJMP(0x46B430); } diff --git a/src/Camera.h b/src/Camera.h index 0f3a1128..1f9a287c 100644 --- a/src/Camera.h +++ b/src/Camera.h @@ -439,7 +439,7 @@ int m_iModeObbeCamIsInForCar; uint32 m_uiFadeTimeStarted; uint32 m_uiFadeTimeStartedMusic; - static Bool &m_bUseMouse3rdPerson; + static bool &m_bUseMouse3rdPerson; CMatrix &GetCameraMatrix(void) { return m_cameraMatrix; } CVector &GetGameCamPosition(void) { return m_vecGameCamPos; } diff --git a/src/Clock.cpp b/src/Clock.cpp index dd7b99fe..707b0e57 100644 --- a/src/Clock.cpp +++ b/src/Clock.cpp @@ -6,7 +6,7 @@ #include "Stats.h" _TODO("gbFastTime"); -Bool &gbFastTime = *(Bool*)0x95CDBB; +bool &gbFastTime = *(bool*)0x95CDBB; uint8 &CClock::ms_nGameClockHours = *(uint8*)0x95CDA6; uint8 &CClock::ms_nGameClockMinutes = *(uint8*)0x95CDC8; diff --git a/src/ControllerConfig.cpp b/src/ControllerConfig.cpp index cd38049e..a401e093 100644 --- a/src/ControllerConfig.cpp +++ b/src/ControllerConfig.cpp @@ -16,19 +16,19 @@ WRAPPER void CControllerConfigManager::AffectControllerStateOn_ButtonUp(int butt WRAPPER void CControllerConfigManager::MakeControllerActionsBlank() { EAXJMP(0x58B7A0); } WRAPPER void CControllerConfigManager::InitDefaultControlConfiguration() { EAXJMP(0x58B930); } WRAPPER void CControllerConfigManager::InitDefaultControlConfigMouse(CMouseControllerState const &mousestate) { EAXJMP(0x58BD00); } -WRAPPER Int32 CControllerConfigManager::GetJoyButtonJustDown() { EAXJMP(0x58B7D0); } +WRAPPER int32 CControllerConfigManager::GetJoyButtonJustDown() { EAXJMP(0x58B7D0); } WRAPPER void CControllerConfigManager::InitDefaultControlConfigJoyPad(unsigned int buttons) { EAXJMP(0x58BD90); } WRAPPER void CControllerConfigManager::ClearSimButtonPressCheckers() { EAXJMP(0x58D220); } WRAPPER void CControllerConfigManager::AffectPadFromKeyBoard() { EAXJMP(0x58D0C0); } WRAPPER void CControllerConfigManager::AffectPadFromMouse() { EAXJMP(0x58D1A0); } -void CControllerConfigManager::LoadSettings(Int32 file) +void CControllerConfigManager::LoadSettings(int32 file) { - Bool bValid = true; + bool bValid = true; if ( file ) { - Char buff[29]; + char buff[29]; CFileMgr::Read(file, buff, sizeof(buff)); if ( !strncmp(buff, "THIS FILE IS NOT VALID YET", sizeof(buff) - 3) ) @@ -45,7 +45,7 @@ void CControllerConfigManager::LoadSettings(Int32 file) { for ( int j = 0; j < 41; j++ ) { - CFileMgr::Read(file, (Char *)&ControlsManager.m_aSettings[j][i], sizeof(tControllerConfigBind)); + CFileMgr::Read(file, (char *)&ControlsManager.m_aSettings[j][i], sizeof(tControllerConfigBind)); } } } diff --git a/src/ControllerConfig.h b/src/ControllerConfig.h index 01d34b3c..00cab82e 100644 --- a/src/ControllerConfig.h +++ b/src/ControllerConfig.h @@ -19,19 +19,19 @@ public: struct tControllerConfigBind { RsKeyCodes m_Key; - Int32 m_ContSetOrder; + int32 m_ContSetOrder; }; - Bool field_0; + bool field_0; char _pad0[3]; DIJOYSTATE2 m_OldState; DIJOYSTATE2 m_NewState; - WChar m_aActionNames[41][40]; - Bool m_aButtonStates[17]; + wchar m_aActionNames[41][40]; + bool m_aButtonStates[17]; char _pad1[3]; tControllerConfigBind m_aSettings[41][4]; - UInt8 m_aSimCheckers[4][4]; - Bool m_bMouseAssociated; + uint8 m_aSimCheckers[4][4]; + bool m_bMouseAssociated; char _pad2[3]; void UpdateJoyButtonState(int padnumber); @@ -40,8 +40,8 @@ public: void UpdateJoyInConfigMenus_ButtonUp(int button, int padnumber); void AffectControllerStateOn_ButtonUp(int button, int padnumber); - Int32 GetJoyButtonJustDown(); - void LoadSettings(Int32 file); + int32 GetJoyButtonJustDown(); + void LoadSettings(int32 file); void MakeControllerActionsBlank(); void InitDefaultControlConfiguration(); void InitDefaultControlConfigMouse(CMouseControllerState const &mousestate); diff --git a/src/Frontend.cpp b/src/Frontend.cpp index 22e28cab..5613a2eb 100644 --- a/src/Frontend.cpp +++ b/src/Frontend.cpp @@ -15,14 +15,14 @@ int8 &CMenuManager::m_ControlMethod = *(int8*)0x8F5F7C; int8 &CMenuManager::m_PrefsDMA = *(int8*)0x5F2F74; int8 &CMenuManager::m_PrefsLanguage = *(int8*)0x941238; -Bool &CMenuManager::m_PrefsAllowNastyGame = *(Bool*)0x5F2E64; -Bool &CMenuManager::m_bStartUpFrontEndRequested = *(Bool*)0x95CCF4; +bool &CMenuManager::m_PrefsAllowNastyGame = *(bool*)0x5F2E64; +bool &CMenuManager::m_bStartUpFrontEndRequested = *(bool*)0x95CCF4; int8 &CMenuManager::m_PrefsUseWideScreen = *(int8*)0x95CD23; int8 &CMenuManager::m_PrefsRadioStation = *(int8*)0x95CDA4; int8 &CMenuManager::m_bDisableMouseSteering = *(int8*)0x60252C; int32 &CMenuManager::m_PrefsBrightness = *(int32*)0x5F2E50; -Float &CMenuManager::m_PrefsLOD = *(Float*)0x8F42C4; +float &CMenuManager::m_PrefsLOD = *(float*)0x8F42C4; int8 &CMenuManager::m_bFrontEnd_ReloadObrTxtGxt = *(int8*)0x628CFC; int32 &CMenuManager::m_PrefsMusicVolume = *(int32*)0x5F2E4C; int32 &CMenuManager::m_PrefsSfxVolume = *(int32*)0x5F2E48; diff --git a/src/Frontend.h b/src/Frontend.h index 6e781834..2e95d582 100644 --- a/src/Frontend.h +++ b/src/Frontend.h @@ -161,13 +161,13 @@ public: static int8 &m_PrefsLanguage; static int8 &m_bDisableMouseSteering; static int32 &m_PrefsBrightness; - static Float &m_PrefsLOD; + static float &m_PrefsLOD; static int8 &m_bFrontEnd_ReloadObrTxtGxt; static int32 &m_PrefsMusicVolume; static int32 &m_PrefsSfxVolume; - static Bool &m_PrefsAllowNastyGame; - static Bool &m_bStartUpFrontEndRequested; + static bool &m_PrefsAllowNastyGame; + static bool &m_bStartUpFrontEndRequested; void Process(void); void DrawFrontEnd(void); diff --git a/src/Game.cpp b/src/Game.cpp index 9da2dab7..5073eed1 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -11,11 +11,11 @@ bool &CGame::noProstitutes = *(bool*)0x95CDCF; bool &CGame::playingIntro = *(bool*)0x95CDC2; WRAPPER void CGame::Process(void) { EAXJMP(0x48C850); } -WRAPPER Bool CGame::InitialiseOnceBeforeRW(void) { EAXJMP(0x48BB80); } -WRAPPER Bool CGame::InitialiseRenderWare(void) { EAXJMP(0x48BBA0); } +WRAPPER bool CGame::InitialiseOnceBeforeRW(void) { EAXJMP(0x48BB80); } +WRAPPER bool CGame::InitialiseRenderWare(void) { EAXJMP(0x48BBA0); } WRAPPER void CGame::ShutdownRenderWare(void) { EAXJMP(0x48BCB0); } WRAPPER void CGame::FinalShutdown(void) { EAXJMP(0x48BEC0); } WRAPPER void CGame::ShutDown(void) { EAXJMP(0x48C3A0); } WRAPPER void CGame::ShutDownForRestart(void) { EAXJMP(0x48C6B0); } WRAPPER void CGame::InitialiseWhenRestarting(void) { EAXJMP(0x48C740); } -WRAPPER Bool CGame::InitialiseOnceAfterRW(void) { EAXJMP(0x48BD50); } +WRAPPER bool CGame::InitialiseOnceAfterRW(void) { EAXJMP(0x48BD50); } diff --git a/src/Game.h b/src/Game.h index 279c3807..ab881484 100644 --- a/src/Game.h +++ b/src/Game.h @@ -20,12 +20,12 @@ public: static bool &playingIntro; static void Process(void); - static Bool InitialiseOnceBeforeRW(void); - static Bool InitialiseRenderWare(void); + static bool InitialiseOnceBeforeRW(void); + static bool InitialiseRenderWare(void); static void ShutdownRenderWare(void); static void FinalShutdown(void); static void ShutDown(void); static void ShutDownForRestart(void); static void InitialiseWhenRestarting(void); - static Bool InitialiseOnceAfterRW(void); + static bool InitialiseOnceAfterRW(void); }; diff --git a/src/General.h b/src/General.h index f957ab2f..41bdf5d7 100644 --- a/src/General.h +++ b/src/General.h @@ -47,6 +47,6 @@ public: static float GetRandomNumberInRange(float low, float high) { return low + (high - low)*(GetRandomNumber()/float(MYRAND_MAX + 1)); } - static Int32 GetRandomNumberInRange(Int32 low, Int32 high) + static int32 GetRandomNumberInRange(int32 low, int32 high) { return low + (high - low)*(GetRandomNumber()/float(MYRAND_MAX + 1)); } }; diff --git a/src/PCSave.cpp b/src/PCSave.cpp index 8ca48437..2d49b23f 100644 --- a/src/PCSave.cpp +++ b/src/PCSave.cpp @@ -3,5 +3,5 @@ #include "Frontend.h" #include "PCSave.h" -WRAPPER void C_PcSave::SetSaveDirectory(const Char *path) { EAXJMP(0x591EA0); } +WRAPPER void C_PcSave::SetSaveDirectory(const char *path) { EAXJMP(0x591EA0); } diff --git a/src/PCSave.h b/src/PCSave.h index c653fab0..324a3421 100644 --- a/src/PCSave.h +++ b/src/PCSave.h @@ -3,5 +3,5 @@ class C_PcSave { public: - static void SetSaveDirectory(const Char *path); + static void SetSaveDirectory(const char *path); }; \ No newline at end of file diff --git a/src/Pad.cpp b/src/Pad.cpp index a9f67b5e..1615b0cd 100644 --- a/src/Pad.cpp +++ b/src/Pad.cpp @@ -28,22 +28,22 @@ CPad *Pads = (CPad*)0x6F0360; // [2] CMousePointerStateHelper &MousePointerStateHelper = *(CMousePointerStateHelper*)0x95CC8C; -Bool &CPad::bDisplayNoControllerMessage = *(Bool *)0x95CD52; -Bool &CPad::bObsoleteControllerMessage = *(Bool *)0x95CDB8; -Bool &CPad::m_bMapPadOneToPadTwo = *(Bool *)0x95CD48; +bool &CPad::bDisplayNoControllerMessage = *(bool *)0x95CD52; +bool &CPad::bObsoleteControllerMessage = *(bool *)0x95CDB8; +bool &CPad::m_bMapPadOneToPadTwo = *(bool *)0x95CD48; CKeyboardState &CPad::OldKeyState = *(CKeyboardState*)0x6F1E70; CKeyboardState &CPad::NewKeyState = *(CKeyboardState*)0x6E60D0; CKeyboardState &CPad::TempKeyState = *(CKeyboardState*)0x774DE8; -Char CPad::KeyBoardCheatString[18]; +char CPad::KeyBoardCheatString[18]; CMouseControllerState &CPad::OldMouseControllerState = *(CMouseControllerState*)0x8472A0; CMouseControllerState &CPad::NewMouseControllerState = *(CMouseControllerState*)0x8809F0; CMouseControllerState &CPad::PCTempMouseControllerState = *(CMouseControllerState*)0x6F1E60; _TODO("gbFastTime"); -extern Bool &gbFastTime; +extern bool &gbFastTime; WRAPPER void WeaponCheat() { EAXJMP(0x490D90); } WRAPPER void HealthCheat() { EAXJMP(0x490E70); } @@ -84,10 +84,10 @@ CControllerState::Clear(void) void CKeyboardState::Clear() { - for ( Int32 i = 0; i < 12; i++ ) + for ( int32 i = 0; i < 12; i++ ) F[i] = 0; - for ( Int32 i = 0; i < 256; i++ ) + for ( int32 i = 0; i < 256; i++ ) VK_KEYS[i] = 0; ESC = INS = DEL = HOME = END = PGUP = PGDN = 0; @@ -111,7 +111,7 @@ void CKeyboardState::Clear() LWIN = RWIN = APPS = 0; } -void CPad::Clear(Bool bResetPlayerControls) +void CPad::Clear(bool bResetPlayerControls) { NewState.Clear(); OldState.Clear(); @@ -138,12 +138,12 @@ void CPad::Clear(Bool bResetPlayerControls) bApplyBrakes = false; - for ( Int32 i = 0; i < _TODOCONST(5); i++ ) + for ( int32 i = 0; i < _TODOCONST(5); i++ ) bHornHistory[i] = false; iCurrHornHistory = 0; - for ( Int32 i = 0; i < _TODOCONST(12); i++ ) + for ( int32 i = 0; i < _TODOCONST(12); i++ ) _unk[i] = ' '; LastTimeTouched = CTimer::GetTimeInMilliseconds(); @@ -235,8 +235,8 @@ void CPad::UpdateMouse() if ( PSGLOBAL(mouse) != NULL && SUCCEEDED(_InputGetMouseState(&state)) ) { - Int32 signX = 1; - Int32 signy = 1; + int32 signX = 1; + int32 signy = 1; if ( !FrontEndMenuManager.m_bMenuActive ) { @@ -248,8 +248,8 @@ void CPad::UpdateMouse() PCTempMouseControllerState.Clear(); - PCTempMouseControllerState.x = (Float)(signX * state.lX); - PCTempMouseControllerState.y = (Float)(signy * state.lY); + PCTempMouseControllerState.x = (float)(signX * state.lX); + PCTempMouseControllerState.y = (float)(signy * state.lY); PCTempMouseControllerState.LMB = state.rgbButtons[0] & 128; PCTempMouseControllerState.RMB = state.rgbButtons[1] & 128; PCTempMouseControllerState.MMB = state.rgbButtons[2] & 128; @@ -329,7 +329,7 @@ CControllerState CPad::ReconcileTwoControllersInput(CControllerState const &Stat #undef _FIX_RECON_DIR } -void CPad::StartShake(Int16 nDur, UInt8 nFreq) +void CPad::StartShake(int16 nDur, uint8 nFreq) { if ( !CMenuManager::m_PrefsUseVibration ) return; @@ -351,7 +351,7 @@ void CPad::StartShake(Int16 nDur, UInt8 nFreq) } } -void CPad::StartShake_Distance(Int16 nDur, UInt8 nFreq, Float fX, Float fY, Float fZ) +void CPad::StartShake_Distance(int16 nDur, uint8 nFreq, float fX, float fY, float fZ) { if ( !CMenuManager::m_PrefsUseVibration ) return; @@ -359,7 +359,7 @@ void CPad::StartShake_Distance(Int16 nDur, UInt8 nFreq, Float fX, Float fY, Floa if ( CCutsceneMgr::IsRunning() || CGame::playingIntro ) return; - Float fDist = ( TheCamera.GetPosition() - CVector(fX, fY, fZ) ).Magnitude(); + float fDist = ( TheCamera.GetPosition() - CVector(fX, fY, fZ) ).Magnitude(); if ( fDist < 70.0f ) { @@ -378,7 +378,7 @@ void CPad::StartShake_Distance(Int16 nDur, UInt8 nFreq, Float fX, Float fY, Floa } } -void CPad::StartShake_Train(Float fX, Float fY) +void CPad::StartShake_Train(float fX, float fY) { if ( !CMenuManager::m_PrefsUseVibration ) return; @@ -389,11 +389,11 @@ void CPad::StartShake_Train(Float fX, Float fY) if (FindPlayerVehicle() != NULL && FindPlayerVehicle()->IsTrain() ) return; - Float fDist = ( TheCamera.GetPosition() - CVector(fX, fY, 0.0f) ).Magnitude2D(); + float fDist = ( TheCamera.GetPosition() - CVector(fX, fY, 0.0f) ).Magnitude2D(); if ( fDist < 70.0f ) { - Int32 freq = (Int32)((70.0f - fDist) * 70.0f / 70.0f + 30.0f); + int32 freq = (int32)((70.0f - fDist) * 70.0f / 70.0f + 30.0f); if ( ShakeDur < 100 ) { @@ -403,9 +403,9 @@ void CPad::StartShake_Train(Float fX, Float fY) } } -void CPad::AddToPCCheatString(Char c) +void CPad::AddToPCCheatString(char c) { - for ( Int32 i = ARRAY_SIZE(KeyBoardCheatString); i >= 0; i-- ) + for ( int32 i = ARRAY_SIZE(KeyBoardCheatString); i >= 0; i-- ) KeyBoardCheatString[i + 1] = KeyBoardCheatString[i]; KeyBoardCheatString[0] = c; @@ -515,7 +515,7 @@ void CPad::AddToPCCheatString(Char c) void CPad::UpdatePads(void) { - Bool bUpdate = true; + bool bUpdate = true; GetPad(0)->UpdateMouse(); CapturePad(0); @@ -545,7 +545,7 @@ void CPad::ProcessPCSpecificStuff(void) ; } -void CPad::Update(Int16 unk) +void CPad::Update(int16 unk) { OldState = NewState; @@ -573,7 +573,7 @@ void CPad::DoCheats(void) GetPad(0)->DoCheats(0); } -void CPad::DoCheats(Int16 unk) +void CPad::DoCheats(int16 unk) { #ifdef PS2 if ( GetTriangleJustDown() ) @@ -619,17 +619,17 @@ void CPad::StopPadsShaking(void) GetPad(0)->StopShaking(0); } -void CPad::StopShaking(Int16 unk) +void CPad::StopShaking(int16 unk) { ; } -CPad *CPad::GetPad(Int32 pad) +CPad *CPad::GetPad(int32 pad) { return &Pads[pad]; } -Int16 CPad::GetSteeringLeftRight(void) +int16 CPad::GetSteeringLeftRight(void) { if ( DisablePlayerControls ) return 0; @@ -639,8 +639,8 @@ Int16 CPad::GetSteeringLeftRight(void) case 0: case 2: { - Int16 axis = NewState.LeftStickX; - Int16 dpad = (NewState.DPadRight - NewState.DPadLeft) / 2; + int16 axis = NewState.LeftStickX; + int16 dpad = (NewState.DPadRight - NewState.DPadLeft) / 2; if ( abs(axis) > abs(dpad) ) return axis; @@ -662,7 +662,7 @@ Int16 CPad::GetSteeringLeftRight(void) return 0; } -Int16 CPad::GetSteeringUpDown(void) +int16 CPad::GetSteeringUpDown(void) { if ( DisablePlayerControls ) return 0; @@ -672,8 +672,8 @@ Int16 CPad::GetSteeringUpDown(void) case 0: case 2: { - Int16 axis = NewState.LeftStickY; - Int16 dpad = (NewState.DPadUp - NewState.DPadDown) / 2; + int16 axis = NewState.LeftStickY; + int16 dpad = (NewState.DPadUp - NewState.DPadDown) / 2; if ( abs(axis) > abs(dpad) ) return axis; @@ -695,7 +695,7 @@ Int16 CPad::GetSteeringUpDown(void) return 0; } -Int16 CPad::GetCarGunUpDown(void) +int16 CPad::GetCarGunUpDown(void) { if ( DisablePlayerControls ) return 0; @@ -722,7 +722,7 @@ Int16 CPad::GetCarGunUpDown(void) return 0; } -Int16 CPad::GetCarGunLeftRight(void) +int16 CPad::GetCarGunLeftRight(void) { if ( DisablePlayerControls ) return 0; @@ -749,7 +749,7 @@ Int16 CPad::GetCarGunLeftRight(void) return 0; } -Int16 CPad::GetPedWalkLeftRight(void) +int16 CPad::GetPedWalkLeftRight(void) { if ( DisablePlayerControls ) return 0; @@ -759,8 +759,8 @@ Int16 CPad::GetPedWalkLeftRight(void) case 0: case 2: { - Int16 axis = NewState.LeftStickX; - Int16 dpad = (NewState.DPadRight - NewState.DPadLeft) / 2; + int16 axis = NewState.LeftStickX; + int16 dpad = (NewState.DPadRight - NewState.DPadLeft) / 2; if ( abs(axis) > abs(dpad) ) return axis; @@ -783,7 +783,7 @@ Int16 CPad::GetPedWalkLeftRight(void) } -Int16 CPad::GetPedWalkUpDown(void) +int16 CPad::GetPedWalkUpDown(void) { if ( DisablePlayerControls ) return 0; @@ -793,8 +793,8 @@ Int16 CPad::GetPedWalkUpDown(void) case 0: case 2: { - Int16 axis = NewState.LeftStickY; - Int16 dpad = (NewState.DPadDown - NewState.DPadUp) / 2; + int16 axis = NewState.LeftStickY; + int16 dpad = (NewState.DPadDown - NewState.DPadUp) / 2; if ( abs(axis) > abs(dpad) ) return axis; @@ -816,15 +816,15 @@ Int16 CPad::GetPedWalkUpDown(void) return 0; } -Int16 CPad::GetAnalogueUpDown(void) +int16 CPad::GetAnalogueUpDown(void) { switch ( Mode ) { case 0: case 2: { - Int16 axis = NewState.LeftStickY; - Int16 dpad = (NewState.DPadDown - NewState.DPadUp) / 2; + int16 axis = NewState.LeftStickY; + int16 dpad = (NewState.DPadDown - NewState.DPadUp) / 2; if ( abs(axis) > abs(dpad) ) return axis; @@ -846,7 +846,7 @@ Int16 CPad::GetAnalogueUpDown(void) return 0; } -Bool CPad::GetLookLeft(void) +bool CPad::GetLookLeft(void) { if ( DisablePlayerControls ) return false; @@ -854,7 +854,7 @@ Bool CPad::GetLookLeft(void) return !!(NewState.LeftShoulder2 && !NewState.RightShoulder2); } -Bool CPad::GetLookRight(void) +bool CPad::GetLookRight(void) { if ( DisablePlayerControls ) return false; @@ -863,7 +863,7 @@ Bool CPad::GetLookRight(void) } -Bool CPad::GetLookBehindForCar(void) +bool CPad::GetLookBehindForCar(void) { if ( DisablePlayerControls ) return false; @@ -871,7 +871,7 @@ Bool CPad::GetLookBehindForCar(void) return !!(NewState.RightShoulder2 && NewState.LeftShoulder2); } -Bool CPad::GetLookBehindForPed(void) +bool CPad::GetLookBehindForPed(void) { if ( DisablePlayerControls ) return false; @@ -879,7 +879,7 @@ Bool CPad::GetLookBehindForPed(void) return !!NewState.RightShock; } -Bool CPad::GetHorn(void) +bool CPad::GetHorn(void) { if ( DisablePlayerControls ) return false; @@ -918,7 +918,7 @@ Bool CPad::GetHorn(void) return false; } -Bool CPad::HornJustDown(void) +bool CPad::HornJustDown(void) { if ( DisablePlayerControls ) return false; @@ -958,7 +958,7 @@ Bool CPad::HornJustDown(void) } -Bool CPad::GetCarGunFired(void) +bool CPad::GetCarGunFired(void) { if ( DisablePlayerControls ) return false; @@ -985,7 +985,7 @@ Bool CPad::GetCarGunFired(void) return false; } -Bool CPad::CarGunJustDown(void) +bool CPad::CarGunJustDown(void) { if ( DisablePlayerControls ) return false; @@ -1012,7 +1012,7 @@ Bool CPad::CarGunJustDown(void) return false; } -Int16 CPad::GetHandBrake(void) +int16 CPad::GetHandBrake(void) { if ( DisablePlayerControls ) return 0; @@ -1045,7 +1045,7 @@ Int16 CPad::GetHandBrake(void) return 0; } -Int16 CPad::GetBrake(void) +int16 CPad::GetBrake(void) { if ( DisablePlayerControls ) return 0; @@ -1069,7 +1069,7 @@ Int16 CPad::GetBrake(void) case 3: { - Int16 axis = 2 * NewState.RightStickY; + int16 axis = 2 * NewState.RightStickY; if ( axis < 0 ) return 0; @@ -1083,7 +1083,7 @@ Int16 CPad::GetBrake(void) return 0; } -Bool CPad::GetExitVehicle(void) +bool CPad::GetExitVehicle(void) { if ( DisablePlayerControls ) return false; @@ -1110,7 +1110,7 @@ Bool CPad::GetExitVehicle(void) return false; } -Bool CPad::ExitVehicleJustDown(void) +bool CPad::ExitVehicleJustDown(void) { if ( DisablePlayerControls ) return false; @@ -1137,7 +1137,7 @@ Bool CPad::ExitVehicleJustDown(void) return false; } -Int32 CPad::GetWeapon(void) +int32 CPad::GetWeapon(void) { if ( DisablePlayerControls ) return false; @@ -1170,7 +1170,7 @@ Int32 CPad::GetWeapon(void) return false; } -Bool CPad::WeaponJustDown(void) +bool CPad::WeaponJustDown(void) { if ( DisablePlayerControls ) return false; @@ -1203,7 +1203,7 @@ Bool CPad::WeaponJustDown(void) return false; } -Int16 CPad::GetAccelerate(void) +int16 CPad::GetAccelerate(void) { if ( DisablePlayerControls ) return 0; @@ -1227,7 +1227,7 @@ Int16 CPad::GetAccelerate(void) case 3: { - Int16 axis = -2 * NewState.RightStickY; + int16 axis = -2 * NewState.RightStickY; if ( axis < 0 ) return 0; @@ -1241,7 +1241,7 @@ Int16 CPad::GetAccelerate(void) return 0; } -Bool CPad::CycleCameraModeUpJustDown(void) +bool CPad::CycleCameraModeUpJustDown(void) { switch ( Mode ) { @@ -1265,7 +1265,7 @@ Bool CPad::CycleCameraModeUpJustDown(void) return false; } -Bool CPad::CycleCameraModeDownJustDown(void) +bool CPad::CycleCameraModeDownJustDown(void) { switch ( Mode ) { @@ -1289,7 +1289,7 @@ Bool CPad::CycleCameraModeDownJustDown(void) return false; } -Bool CPad::ChangeStationJustDown(void) +bool CPad::ChangeStationJustDown(void) { if ( DisablePlayerControls ) return false; @@ -1329,7 +1329,7 @@ Bool CPad::ChangeStationJustDown(void) } -Bool CPad::CycleWeaponLeftJustDown(void) +bool CPad::CycleWeaponLeftJustDown(void) { if ( DisablePlayerControls ) return false; @@ -1337,7 +1337,7 @@ Bool CPad::CycleWeaponLeftJustDown(void) return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2); } -Bool CPad::CycleWeaponRightJustDown(void) +bool CPad::CycleWeaponRightJustDown(void) { if ( DisablePlayerControls ) return false; @@ -1345,7 +1345,7 @@ Bool CPad::CycleWeaponRightJustDown(void) return !!(NewState.RightShoulder2 && !OldState.RightShoulder2); } -Bool CPad::GetTarget(void) +bool CPad::GetTarget(void) { if ( DisablePlayerControls ) return false; @@ -1372,7 +1372,7 @@ Bool CPad::GetTarget(void) return false; } -Bool CPad::TargetJustDown(void) +bool CPad::TargetJustDown(void) { if ( DisablePlayerControls ) return false; @@ -1399,7 +1399,7 @@ Bool CPad::TargetJustDown(void) return false; } -Bool CPad::JumpJustDown(void) +bool CPad::JumpJustDown(void) { if ( DisablePlayerControls ) return false; @@ -1407,7 +1407,7 @@ Bool CPad::JumpJustDown(void) return !!(NewState.Square && !OldState.Square); } -Bool CPad::GetSprint(void) +bool CPad::GetSprint(void) { if ( DisablePlayerControls ) return false; @@ -1434,7 +1434,7 @@ Bool CPad::GetSprint(void) return false; } -Bool CPad::ShiftTargetLeftJustDown(void) +bool CPad::ShiftTargetLeftJustDown(void) { if ( DisablePlayerControls ) return false; @@ -1442,7 +1442,7 @@ Bool CPad::ShiftTargetLeftJustDown(void) return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2); } -Bool CPad::ShiftTargetRightJustDown(void) +bool CPad::ShiftTargetRightJustDown(void) { if ( DisablePlayerControls ) return false; @@ -1450,11 +1450,11 @@ Bool CPad::ShiftTargetRightJustDown(void) return !!(NewState.RightShoulder2 && !OldState.RightShoulder2); } -Bool CPad::GetAnaloguePadUp(void) +bool CPad::GetAnaloguePadUp(void) { - static Int16 oldfStickY = 0; + static int16 oldfStickY = 0; - Int16 Y = CPad::GetPad(0)->GetAnalogueUpDown(); + int16 Y = CPad::GetPad(0)->GetAnalogueUpDown(); if ( Y < 0 && oldfStickY >= 0 ) { @@ -1468,11 +1468,11 @@ Bool CPad::GetAnaloguePadUp(void) } } -Bool CPad::GetAnaloguePadDown(void) +bool CPad::GetAnaloguePadDown(void) { - static Int16 oldfStickY = 0; + static int16 oldfStickY = 0; - Int16 Y = CPad::GetPad(0)->GetAnalogueUpDown(); + int16 Y = CPad::GetPad(0)->GetAnalogueUpDown(); if ( Y > 0 && oldfStickY <= 0 ) { @@ -1486,11 +1486,11 @@ Bool CPad::GetAnaloguePadDown(void) } } -Bool CPad::GetAnaloguePadLeft(void) +bool CPad::GetAnaloguePadLeft(void) { - static Int16 oldfStickX = 0; + static int16 oldfStickX = 0; - Int16 X = CPad::GetPad(0)->GetPedWalkLeftRight(); + int16 X = CPad::GetPad(0)->GetPedWalkLeftRight(); if ( X < 0 && oldfStickX >= 0 ) { @@ -1504,11 +1504,11 @@ Bool CPad::GetAnaloguePadLeft(void) } } -Bool CPad::GetAnaloguePadRight(void) +bool CPad::GetAnaloguePadRight(void) { - static Int16 oldfStickX = 0; + static int16 oldfStickX = 0; - Int16 X = CPad::GetPad(0)->GetPedWalkLeftRight(); + int16 X = CPad::GetPad(0)->GetPedWalkLeftRight(); if ( X > 0 && oldfStickX <= 0 ) { @@ -1522,11 +1522,11 @@ Bool CPad::GetAnaloguePadRight(void) } } -Bool CPad::GetAnaloguePadLeftJustUp(void) +bool CPad::GetAnaloguePadLeftJustUp(void) { - static Int16 oldfStickX = 0; + static int16 oldfStickX = 0; - Int16 X = GetPad(0)->GetPedWalkLeftRight(); + int16 X = GetPad(0)->GetPedWalkLeftRight(); if ( X == 0 && oldfStickX < 0 ) { @@ -1542,11 +1542,11 @@ Bool CPad::GetAnaloguePadLeftJustUp(void) } } -Bool CPad::GetAnaloguePadRightJustUp(void) +bool CPad::GetAnaloguePadRightJustUp(void) { - static Int16 oldfStickX = 0; + static int16 oldfStickX = 0; - Int16 X = GetPad(0)->GetPedWalkLeftRight(); + int16 X = GetPad(0)->GetPedWalkLeftRight(); if ( X == 0 && oldfStickX > 0 ) { @@ -1562,7 +1562,7 @@ Bool CPad::GetAnaloguePadRightJustUp(void) } } -Bool CPad::ForceCameraBehindPlayer(void) +bool CPad::ForceCameraBehindPlayer(void) { if ( DisablePlayerControls ) return false; @@ -1595,7 +1595,7 @@ Bool CPad::ForceCameraBehindPlayer(void) return false; } -Bool CPad::SniperZoomIn(void) +bool CPad::SniperZoomIn(void) { if ( DisablePlayerControls ) return false; @@ -1622,7 +1622,7 @@ Bool CPad::SniperZoomIn(void) return false; } -Bool CPad::SniperZoomOut(void) +bool CPad::SniperZoomOut(void) { if ( DisablePlayerControls ) return false; @@ -1650,10 +1650,10 @@ Bool CPad::SniperZoomOut(void) } -Int16 CPad::SniperModeLookLeftRight(void) +int16 CPad::SniperModeLookLeftRight(void) { - Int16 axis = NewState.LeftStickX; - Int16 dpad = (NewState.DPadRight - NewState.DPadLeft) / 2; + int16 axis = NewState.LeftStickX; + int16 dpad = (NewState.DPadRight - NewState.DPadLeft) / 2; if ( abs(axis) > abs(dpad) ) return axis; @@ -1661,10 +1661,10 @@ Int16 CPad::SniperModeLookLeftRight(void) return dpad; } -Int16 CPad::SniperModeLookUpDown(void) +int16 CPad::SniperModeLookUpDown(void) { - Int16 axis = NewState.LeftStickY; - Int16 dpad = (NewState.DPadUp - NewState.DPadDown) / 2; + int16 axis = NewState.LeftStickY; + int16 dpad = (NewState.DPadUp - NewState.DPadDown) / 2; if ( abs(axis) > abs(dpad) ) return axis; @@ -1672,31 +1672,31 @@ Int16 CPad::SniperModeLookUpDown(void) return dpad; } -Int16 CPad::LookAroundLeftRight(void) +int16 CPad::LookAroundLeftRight(void) { - Float axis = GetPad(0)->NewState.RightStickX; + float axis = GetPad(0)->NewState.RightStickX; if ( fabs(axis) > 85 && !GetLookBehindForPed() ) - return (Int16) ( (axis + ( axis > 0 ) ? -85 : 85) + return (int16) ( (axis + ( axis > 0 ) ? -85 : 85) * (127.0f / 32.0f) ); // 3.96875f else if ( TheCamera.Cams[0].Using3rdPersonMouseCam() && fabs(axis) > 10 ) - return (Int16) ( (axis + ( axis > 0 ) ? -10 : 10) + return (int16) ( (axis + ( axis > 0 ) ? -10 : 10) * (127.0f / 64.0f) ); // 1.984375f return 0; } -Int16 CPad::LookAroundUpDown(void) +int16 CPad::LookAroundUpDown(void) { - Int16 axis = GetPad(0)->NewState.RightStickY; + int16 axis = GetPad(0)->NewState.RightStickY; if ( abs(axis) > 85 && !GetLookBehindForPed() ) - return (Int16) ( (axis + ( axis > 0 ) ? -85 : 85) + return (int16) ( (axis + ( axis > 0 ) ? -85 : 85) * (127.0f / 32.0f) ); // 3.96875f else if ( TheCamera.Cams[0].Using3rdPersonMouseCam() && abs(axis) > 40 ) - return (Int16) ( (axis + ( axis > 0 ) ? -40 : 40) + return (int16) ( (axis + ( axis > 0 ) ? -40 : 40) * (127.0f / 64.0f) ); // 1.984375f return 0; @@ -1750,7 +1750,7 @@ void CPad::PrintErrorMessage(void) void LittleTest(void) { - static Int32 Cunt = 0; + static int32 Cunt = 0; Cunt++; // ??? } @@ -1775,12 +1775,12 @@ void CPad::ResetCheats(void) CTimer::SetTimeScale(1.0f); } -Char *CPad::EditString(Char *pStr, Int32 nSize) +char *CPad::EditString(char *pStr, int32 nSize) { - Int32 pos = strlen(pStr); + int32 pos = strlen(pStr); // letters - for ( Int32 i = 0; i < ('Z' - 'A' + 1); i++ ) + for ( int32 i = 0; i < ('Z' - 'A' + 1); i++ ) { if ( GetPad(0)->GetCharJustDown(i + 'A') && pos < nSize - 1 ) { @@ -1796,7 +1796,7 @@ Char *CPad::EditString(Char *pStr, Int32 nSize) } // numbers - for ( Int32 i = 0; i < ('0' - '9' + 1); i++ ) + for ( int32 i = 0; i < ('0' - '9' + 1); i++ ) { if ( GetPad(0)->GetCharJustDown(i + '0') && pos < nSize - 1 ) { @@ -1827,17 +1827,17 @@ Char *CPad::EditString(Char *pStr, Int32 nSize) return pStr; } -Int32 *CPad::EditCodesForControls(Int32 *pRsKeys, Int32 nSize) +int32 *CPad::EditCodesForControls(int32 *pRsKeys, int32 nSize) { *pRsKeys = rsNULL; - for ( Int32 i = 0; i < 255; i++ ) + for ( int32 i = 0; i < 255; i++ ) { if ( GetPad(0)->GetCharJustDown(i) ) *pRsKeys = i; } - for ( Int32 i = 0; i < 255; i++ ) + for ( int32 i = 0; i < 255; i++ ) { if ( GetPad(0)->GetFJustDown(i) ) *pRsKeys = i + rsF1; @@ -1996,7 +1996,7 @@ STARTPATCHES InjectHook(0x492C60, &CPad::ProcessPCSpecificStuff, PATCH_JUMP); InjectHook(0x492C70, &CPad::Update, PATCH_JUMP); InjectHook(0x492F00, (void (*)())CPad::DoCheats, PATCH_JUMP); - InjectHook(0x492F20, (void (CPad::*)(Int16))&CPad::DoCheats, PATCH_JUMP); + InjectHook(0x492F20, (void (CPad::*)(int16))&CPad::DoCheats, PATCH_JUMP); InjectHook(0x492F30, CPad::StopPadsShaking, PATCH_JUMP); InjectHook(0x492F50, &CPad::StopShaking, PATCH_JUMP); InjectHook(0x492F60, CPad::GetPad, PATCH_JUMP); diff --git a/src/Pad.h b/src/Pad.h index 446007c2..9180be26 100644 --- a/src/Pad.h +++ b/src/Pad.h @@ -78,16 +78,16 @@ class CMouseControllerState public: //uint32 btns; // bit 0-2 button 1-3 - Bool LMB; - Bool RMB; - Bool MMB; - Bool WHEELUP; - Bool WHEELDN; - Bool MXB1; - Bool MXB2; + bool LMB; + bool RMB; + bool MMB; + bool WHEELUP; + bool WHEELDN; + bool MXB1; + bool MXB2; char _pad0; - Float x, y; + float x, y; CMouseControllerState(); void Clear(); @@ -98,8 +98,8 @@ VALIDATE_SIZE(CMouseControllerState, 0x10); class CMousePointerStateHelper { public: - Bool bInvertHorizontally; - Bool bInvertVertically; + bool bInvertHorizontally; + bool bInvertVertically; CMouseControllerState GetMouseSetUp(); }; @@ -112,52 +112,52 @@ extern CMousePointerStateHelper &MousePointerStateHelper; class CKeyboardState { public: - Int16 F[12]; - Int16 VK_KEYS[256]; - Int16 ESC; - Int16 INS; - Int16 DEL; - Int16 HOME; - Int16 END; - Int16 PGUP; - Int16 PGDN; - Int16 UP; - Int16 DOWN; - Int16 LEFT; - Int16 RIGHT; - Int16 SCROLLLOCK; - Int16 PAUSE; - Int16 NUMLOCK; - Int16 DIV; - Int16 MUL; - Int16 SUB; - Int16 ADD; - Int16 ENTER; - Int16 DECIMAL; - Int16 NUM1; - Int16 NUM2; - Int16 NUM3; - Int16 NUM4; - Int16 NUM5; - Int16 NUM6; - Int16 NUM7; - Int16 NUM8; - Int16 NUM9; - Int16 NUM0; - Int16 BACKSP; - Int16 TAB; - Int16 CAPSLOCK; - Int16 EXTENTER; - Int16 LSHIFT; - Int16 RSHIFT; - Int16 SHIFT; - Int16 LCTRL; - Int16 RCTRL; - Int16 LALT; - Int16 RALT; - Int16 LWIN; - Int16 RWIN; - Int16 APPS; + int16 F[12]; + int16 VK_KEYS[256]; + int16 ESC; + int16 INS; + int16 DEL; + int16 HOME; + int16 END; + int16 PGUP; + int16 PGDN; + int16 UP; + int16 DOWN; + int16 LEFT; + int16 RIGHT; + int16 SCROLLLOCK; + int16 PAUSE; + int16 NUMLOCK; + int16 DIV; + int16 MUL; + int16 SUB; + int16 ADD; + int16 ENTER; + int16 DECIMAL; + int16 NUM1; + int16 NUM2; + int16 NUM3; + int16 NUM4; + int16 NUM5; + int16 NUM6; + int16 NUM7; + int16 NUM8; + int16 NUM9; + int16 NUM0; + int16 BACKSP; + int16 TAB; + int16 CAPSLOCK; + int16 EXTENTER; + int16 LSHIFT; + int16 RSHIFT; + int16 SHIFT; + int16 LCTRL; + int16 RCTRL; + int16 LALT; + int16 RALT; + int16 LWIN; + int16 RWIN; + int16 APPS; void Clear(); }; @@ -185,12 +185,12 @@ public: int16 Phase; int16 Mode; int16 ShakeDur; - UInt8 ShakeFreq; + uint8 ShakeFreq; int8 bHornHistory[5]; - UInt8 iCurrHornHistory; - Bool DisablePlayerControls; + uint8 iCurrHornHistory; + bool DisablePlayerControls; int8 bApplyBrakes; - Char _unk[12]; //int32 unk[3]; + char _unk[12]; //int32 unk[3]; char _pad0[3]; int32 LastTimeTouched; int32 AverageWeapon; @@ -199,14 +199,14 @@ public: CPad() { } ~CPad() { } - static Bool &bDisplayNoControllerMessage; - static Bool &bObsoleteControllerMessage; - static Bool &m_bMapPadOneToPadTwo; + static bool &bDisplayNoControllerMessage; + static bool &bObsoleteControllerMessage; + static bool &m_bMapPadOneToPadTwo; static CKeyboardState &OldKeyState; static CKeyboardState &NewKeyState; static CKeyboardState &TempKeyState; - static Char KeyBoardCheatString[18]; + static char KeyBoardCheatString[18]; static CMouseControllerState &OldMouseControllerState; static CMouseControllerState &NewMouseControllerState; static CMouseControllerState &PCTempMouseControllerState; @@ -214,150 +214,150 @@ public: - void Clear(Bool bResetPlayerControls); + void Clear(bool bResetPlayerControls); void ClearMouseHistory(); void UpdateMouse(); CControllerState ReconcileTwoControllersInput(CControllerState const &State1, CControllerState const &State2); - void StartShake(Int16 nDur, UInt8 nFreq); - void StartShake_Distance(Int16 nDur, UInt8 nFreq, Float fX, Float fY, Float fz); - void StartShake_Train(Float fX, Float fY); - void AddToPCCheatString(Char c); + void StartShake(int16 nDur, uint8 nFreq); + void StartShake_Distance(int16 nDur, uint8 nFreq, float fX, float fY, float fz); + void StartShake_Train(float fX, float fY); + void AddToPCCheatString(char c); static void UpdatePads(void); void ProcessPCSpecificStuff(void); - void Update(Int16 unk); + void Update(int16 unk); static void DoCheats(void); - void DoCheats(Int16 unk); + void DoCheats(int16 unk); static void StopPadsShaking(void); - void StopShaking(Int16 unk); + void StopShaking(int16 unk); - static CPad *GetPad(Int32 pad); + static CPad *GetPad(int32 pad); - Int16 GetSteeringLeftRight(void); - Int16 GetSteeringUpDown(void); - Int16 GetCarGunUpDown(void); - Int16 GetCarGunLeftRight(void); - Int16 GetPedWalkLeftRight(void); - Int16 GetPedWalkUpDown(void); - Int16 GetAnalogueUpDown(void); - Bool GetLookLeft(void); - Bool GetLookRight(void); - Bool GetLookBehindForCar(void); - Bool GetLookBehindForPed(void); - Bool GetHorn(void); - Bool HornJustDown(void); - Bool GetCarGunFired(void); - Bool CarGunJustDown(void); - Int16 GetHandBrake(void); - Int16 GetBrake(void); - Bool GetExitVehicle(void); - Bool ExitVehicleJustDown(void); - Int32 GetWeapon(void); - Bool WeaponJustDown(void); - Int16 GetAccelerate(void); - Bool CycleCameraModeUpJustDown(void); - Bool CycleCameraModeDownJustDown(void); - Bool ChangeStationJustDown(void); - Bool CycleWeaponLeftJustDown(void); - Bool CycleWeaponRightJustDown(void); - Bool GetTarget(void); - Bool TargetJustDown(void); - Bool JumpJustDown(void); - Bool GetSprint(void); - Bool ShiftTargetLeftJustDown(void); - Bool ShiftTargetRightJustDown(void); - Bool GetAnaloguePadUp(void); - Bool GetAnaloguePadDown(void); - Bool GetAnaloguePadLeft(void); - Bool GetAnaloguePadRight(void); - Bool GetAnaloguePadLeftJustUp(void); - Bool GetAnaloguePadRightJustUp(void); - Bool ForceCameraBehindPlayer(void); - Bool SniperZoomIn(void); - Bool SniperZoomOut(void); - Int16 SniperModeLookLeftRight(void); - Int16 SniperModeLookUpDown(void); - Int16 LookAroundLeftRight(void); - Int16 LookAroundUpDown(void); + int16 GetSteeringLeftRight(void); + int16 GetSteeringUpDown(void); + int16 GetCarGunUpDown(void); + int16 GetCarGunLeftRight(void); + int16 GetPedWalkLeftRight(void); + int16 GetPedWalkUpDown(void); + int16 GetAnalogueUpDown(void); + bool GetLookLeft(void); + bool GetLookRight(void); + bool GetLookBehindForCar(void); + bool GetLookBehindForPed(void); + bool GetHorn(void); + bool HornJustDown(void); + bool GetCarGunFired(void); + bool CarGunJustDown(void); + int16 GetHandBrake(void); + int16 GetBrake(void); + bool GetExitVehicle(void); + bool ExitVehicleJustDown(void); + int32 GetWeapon(void); + bool WeaponJustDown(void); + int16 GetAccelerate(void); + bool CycleCameraModeUpJustDown(void); + bool CycleCameraModeDownJustDown(void); + bool ChangeStationJustDown(void); + bool CycleWeaponLeftJustDown(void); + bool CycleWeaponRightJustDown(void); + bool GetTarget(void); + bool TargetJustDown(void); + bool JumpJustDown(void); + bool GetSprint(void); + bool ShiftTargetLeftJustDown(void); + bool ShiftTargetRightJustDown(void); + bool GetAnaloguePadUp(void); + bool GetAnaloguePadDown(void); + bool GetAnaloguePadLeft(void); + bool GetAnaloguePadRight(void); + bool GetAnaloguePadLeftJustUp(void); + bool GetAnaloguePadRightJustUp(void); + bool ForceCameraBehindPlayer(void); + bool SniperZoomIn(void); + bool SniperZoomOut(void); + int16 SniperModeLookLeftRight(void); + int16 SniperModeLookUpDown(void); + int16 LookAroundLeftRight(void); + int16 LookAroundUpDown(void); void ResetAverageWeapon(void); static void PrintErrorMessage(void); static void ResetCheats(void); - static Char *EditString(Char *pStr, Int32 nSize); - static Int32 *EditCodesForControls(Int32 *pRsKeys, Int32 nSize); + static char *EditString(char *pStr, int32 nSize); + static int32 *EditCodesForControls(int32 *pRsKeys, int32 nSize); // mouse - inline Bool GetLeftMouseJustDown() { return !!(NewMouseControllerState.LMB && !OldMouseControllerState.LMB); } + inline bool GetLeftMouseJustDown() { return !!(NewMouseControllerState.LMB && !OldMouseControllerState.LMB); } // keyboard - inline Bool GetCharJustDown(Char c) { return !!(NewKeyState.VK_KEYS[c] && !OldKeyState.VK_KEYS[c]); } - inline Bool GetFJustDown(Int32 n) { return !!(NewKeyState.F[n] && !OldKeyState.F[n]); } - inline Bool GetEscapeJustDown() { return !!(NewKeyState.ESC && !OldKeyState.ESC); } - inline Bool GetInsertJustDown() { return !!(NewKeyState.INS && !OldKeyState.INS); } - inline Bool GetDeleteJustDown() { return !!(NewKeyState.DEL && !OldKeyState.DEL); } - inline Bool GetHomeJustDown() { return !!(NewKeyState.HOME && !OldKeyState.HOME); } - inline Bool GetEndJustDown() { return !!(NewKeyState.END && !OldKeyState.END); } - inline Bool GetPageUpJustDown() { return !!(NewKeyState.PGUP && !OldKeyState.PGUP); } - inline Bool GetPageDownJustDown() { return !!(NewKeyState.PGDN && !OldKeyState.PGDN); } - inline Bool GetUpJustDown() { return !!(NewKeyState.UP && !OldKeyState.UP); } - inline Bool GetDownJustDown() { return !!(NewKeyState.DOWN && !OldKeyState.DOWN); } - inline Bool GetLeftJustDown() { return !!(NewKeyState.LEFT && !OldKeyState.LEFT); } - inline Bool GetRightJustDown() { return !!(NewKeyState.RIGHT && !OldKeyState.RIGHT); } - inline Bool GetScrollLockJustDown() { return !!(NewKeyState.SCROLLLOCK && !OldKeyState.SCROLLLOCK); } - inline Bool GetPauseJustDown() { return !!(NewKeyState.PAUSE && !OldKeyState.PAUSE); } - inline Bool GetNumLockJustDown() { return !!(NewKeyState.NUMLOCK && !OldKeyState.NUMLOCK); } - inline Bool GetDivideJustDown() { return !!(NewKeyState.DIV && !OldKeyState.DIV); } - inline Bool GetTimesJustDown() { return !!(NewKeyState.MUL && !OldKeyState.MUL); } - inline Bool GetMinusJustDown() { return !!(NewKeyState.SUB && !OldKeyState.SUB); } - inline Bool GetPlusJustDown() { return !!(NewKeyState.ADD && !OldKeyState.ADD); } - inline Bool GetPadEnterJustDown() { return !!(NewKeyState.ENTER && !OldKeyState.ENTER); } // GetEnterJustDown - inline Bool GetPadDelJustDown() { return !!(NewKeyState.DECIMAL && !OldKeyState.DECIMAL); } - inline Bool GetPad1JustDown() { return !!(NewKeyState.NUM1 && !OldKeyState.NUM1); } - inline Bool GetPad2JustDown() { return !!(NewKeyState.NUM2 && !OldKeyState.NUM2); } - inline Bool GetPad3JustDown() { return !!(NewKeyState.NUM3 && !OldKeyState.NUM3); } - inline Bool GetPad4JustDown() { return !!(NewKeyState.NUM4 && !OldKeyState.NUM4); } - inline Bool GetPad5JustDown() { return !!(NewKeyState.NUM5 && !OldKeyState.NUM5); } - inline Bool GetPad6JustDown() { return !!(NewKeyState.NUM6 && !OldKeyState.NUM6); } - inline Bool GetPad7JustDown() { return !!(NewKeyState.NUM7 && !OldKeyState.NUM7); } - inline Bool GetPad8JustDown() { return !!(NewKeyState.NUM8 && !OldKeyState.NUM8); } - inline Bool GetPad9JustDown() { return !!(NewKeyState.NUM9 && !OldKeyState.NUM9); } - inline Bool GetPad0JustDown() { return !!(NewKeyState.NUM0 && !OldKeyState.NUM0); } - inline Bool GetBackspaceJustDown() { return !!(NewKeyState.BACKSP && !OldKeyState.BACKSP); } - inline Bool GetTabJustDown() { return !!(NewKeyState.TAB && !OldKeyState.TAB); } - inline Bool GetCapsLockJustDown() { return !!(NewKeyState.CAPSLOCK && !OldKeyState.CAPSLOCK); } - inline Bool GetEnterJustDown() { return !!(NewKeyState.EXTENTER && !OldKeyState.EXTENTER); } - inline Bool GetLeftShiftJustDown() { return !!(NewKeyState.LSHIFT && !OldKeyState.LSHIFT); } - inline Bool GetShiftJustDown() { return !!(NewKeyState.SHIFT && !OldKeyState.SHIFT); } - inline Bool GetRightShiftJustDown() { return !!(NewKeyState.RSHIFT && !OldKeyState.RSHIFT); } - inline Bool GetLeftCtrlJustDown() { return !!(NewKeyState.LCTRL && !OldKeyState.LCTRL); } - inline Bool GetRightCtrlJustDown() { return !!(NewKeyState.RCTRL && !OldKeyState.RCTRL); } - inline Bool GetLeftAltJustDown() { return !!(NewKeyState.LALT && !OldKeyState.LALT); } - inline Bool GetRightAltJustDown() { return !!(NewKeyState.RALT && !OldKeyState.RALT); } - inline Bool GetLeftWinJustDown() { return !!(NewKeyState.LWIN && !OldKeyState.LWIN); } - inline Bool GetRightWinJustDown() { return !!(NewKeyState.RWIN && !OldKeyState.RWIN); } - inline Bool GetAppsJustDown() { return !!(NewKeyState.APPS && !OldKeyState.APPS); } + inline bool GetCharJustDown(char c) { return !!(NewKeyState.VK_KEYS[c] && !OldKeyState.VK_KEYS[c]); } + inline bool GetFJustDown(int32 n) { return !!(NewKeyState.F[n] && !OldKeyState.F[n]); } + inline bool GetEscapeJustDown() { return !!(NewKeyState.ESC && !OldKeyState.ESC); } + inline bool GetInsertJustDown() { return !!(NewKeyState.INS && !OldKeyState.INS); } + inline bool GetDeleteJustDown() { return !!(NewKeyState.DEL && !OldKeyState.DEL); } + inline bool GetHomeJustDown() { return !!(NewKeyState.HOME && !OldKeyState.HOME); } + inline bool GetEndJustDown() { return !!(NewKeyState.END && !OldKeyState.END); } + inline bool GetPageUpJustDown() { return !!(NewKeyState.PGUP && !OldKeyState.PGUP); } + inline bool GetPageDownJustDown() { return !!(NewKeyState.PGDN && !OldKeyState.PGDN); } + inline bool GetUpJustDown() { return !!(NewKeyState.UP && !OldKeyState.UP); } + inline bool GetDownJustDown() { return !!(NewKeyState.DOWN && !OldKeyState.DOWN); } + inline bool GetLeftJustDown() { return !!(NewKeyState.LEFT && !OldKeyState.LEFT); } + inline bool GetRightJustDown() { return !!(NewKeyState.RIGHT && !OldKeyState.RIGHT); } + inline bool GetScrollLockJustDown() { return !!(NewKeyState.SCROLLLOCK && !OldKeyState.SCROLLLOCK); } + inline bool GetPauseJustDown() { return !!(NewKeyState.PAUSE && !OldKeyState.PAUSE); } + inline bool GetNumLockJustDown() { return !!(NewKeyState.NUMLOCK && !OldKeyState.NUMLOCK); } + inline bool GetDivideJustDown() { return !!(NewKeyState.DIV && !OldKeyState.DIV); } + inline bool GetTimesJustDown() { return !!(NewKeyState.MUL && !OldKeyState.MUL); } + inline bool GetMinusJustDown() { return !!(NewKeyState.SUB && !OldKeyState.SUB); } + inline bool GetPlusJustDown() { return !!(NewKeyState.ADD && !OldKeyState.ADD); } + inline bool GetPadEnterJustDown() { return !!(NewKeyState.ENTER && !OldKeyState.ENTER); } // GetEnterJustDown + inline bool GetPadDelJustDown() { return !!(NewKeyState.DECIMAL && !OldKeyState.DECIMAL); } + inline bool GetPad1JustDown() { return !!(NewKeyState.NUM1 && !OldKeyState.NUM1); } + inline bool GetPad2JustDown() { return !!(NewKeyState.NUM2 && !OldKeyState.NUM2); } + inline bool GetPad3JustDown() { return !!(NewKeyState.NUM3 && !OldKeyState.NUM3); } + inline bool GetPad4JustDown() { return !!(NewKeyState.NUM4 && !OldKeyState.NUM4); } + inline bool GetPad5JustDown() { return !!(NewKeyState.NUM5 && !OldKeyState.NUM5); } + inline bool GetPad6JustDown() { return !!(NewKeyState.NUM6 && !OldKeyState.NUM6); } + inline bool GetPad7JustDown() { return !!(NewKeyState.NUM7 && !OldKeyState.NUM7); } + inline bool GetPad8JustDown() { return !!(NewKeyState.NUM8 && !OldKeyState.NUM8); } + inline bool GetPad9JustDown() { return !!(NewKeyState.NUM9 && !OldKeyState.NUM9); } + inline bool GetPad0JustDown() { return !!(NewKeyState.NUM0 && !OldKeyState.NUM0); } + inline bool GetBackspaceJustDown() { return !!(NewKeyState.BACKSP && !OldKeyState.BACKSP); } + inline bool GetTabJustDown() { return !!(NewKeyState.TAB && !OldKeyState.TAB); } + inline bool GetCapsLockJustDown() { return !!(NewKeyState.CAPSLOCK && !OldKeyState.CAPSLOCK); } + inline bool GetEnterJustDown() { return !!(NewKeyState.EXTENTER && !OldKeyState.EXTENTER); } + inline bool GetLeftShiftJustDown() { return !!(NewKeyState.LSHIFT && !OldKeyState.LSHIFT); } + inline bool GetShiftJustDown() { return !!(NewKeyState.SHIFT && !OldKeyState.SHIFT); } + inline bool GetRightShiftJustDown() { return !!(NewKeyState.RSHIFT && !OldKeyState.RSHIFT); } + inline bool GetLeftCtrlJustDown() { return !!(NewKeyState.LCTRL && !OldKeyState.LCTRL); } + inline bool GetRightCtrlJustDown() { return !!(NewKeyState.RCTRL && !OldKeyState.RCTRL); } + inline bool GetLeftAltJustDown() { return !!(NewKeyState.LALT && !OldKeyState.LALT); } + inline bool GetRightAltJustDown() { return !!(NewKeyState.RALT && !OldKeyState.RALT); } + inline bool GetLeftWinJustDown() { return !!(NewKeyState.LWIN && !OldKeyState.LWIN); } + inline bool GetRightWinJustDown() { return !!(NewKeyState.RWIN && !OldKeyState.RWIN); } + inline bool GetAppsJustDown() { return !!(NewKeyState.APPS && !OldKeyState.APPS); } // pad - inline Bool GetTriangleJustDown() { return !!(NewState.Triangle && !OldState.Triangle); } - inline Bool GetCircleJustDown() { return !!(NewState.Circle && !OldState.Circle); } - inline Bool GetCrossJustDown() { return !!(NewState.Cross && !OldState.Cross); } - inline Bool GetSquareJustDown() { return !!(NewState.Square && !OldState.Square); } - inline Bool GetDPadUpJustDown() { return !!(NewState.DPadUp && !OldState.DPadUp); } - inline Bool GetDPadDownJustDown() { return !!(NewState.DPadDown && !OldState.DPadDown); } - inline Bool GetDPadLeftJustDown() { return !!(NewState.DPadLeft && !OldState.DPadLeft); } - inline Bool GetDPadRightJustDown() { return !!(NewState.DPadRight && !OldState.DPadRight); } - inline Bool GetLeftShoulder1JustDown() { return !!(NewState.LeftShoulder1 && !OldState.LeftShoulder1); } - inline Bool GetLeftShoulder2JustDown() { return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2); } - inline Bool GetRightShoulder1JustDown() { return !!(NewState.RightShoulder1 && !OldState.RightShoulder1); } - inline Bool GetRightShoulder2JustDown() { return !!(NewState.RightShoulder2 && !OldState.RightShoulder2); } + inline bool GetTriangleJustDown() { return !!(NewState.Triangle && !OldState.Triangle); } + inline bool GetCircleJustDown() { return !!(NewState.Circle && !OldState.Circle); } + inline bool GetCrossJustDown() { return !!(NewState.Cross && !OldState.Cross); } + inline bool GetSquareJustDown() { return !!(NewState.Square && !OldState.Square); } + inline bool GetDPadUpJustDown() { return !!(NewState.DPadUp && !OldState.DPadUp); } + inline bool GetDPadDownJustDown() { return !!(NewState.DPadDown && !OldState.DPadDown); } + inline bool GetDPadLeftJustDown() { return !!(NewState.DPadLeft && !OldState.DPadLeft); } + inline bool GetDPadRightJustDown() { return !!(NewState.DPadRight && !OldState.DPadRight); } + inline bool GetLeftShoulder1JustDown() { return !!(NewState.LeftShoulder1 && !OldState.LeftShoulder1); } + inline bool GetLeftShoulder2JustDown() { return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2); } + inline bool GetRightShoulder1JustDown() { return !!(NewState.RightShoulder1 && !OldState.RightShoulder1); } + inline bool GetRightShoulder2JustDown() { return !!(NewState.RightShoulder2 && !OldState.RightShoulder2); } - inline Int32 GetLeftShoulder1(void) { return NewState.LeftShoulder1; } - inline Int32 GetLeftShoulder2(void) { return NewState.LeftShoulder2; } - inline Int32 GetRightShoulder1(void) { return NewState.RightShoulder1; } - inline Int32 GetRightShoulder2(void) { return NewState.RightShoulder2; } + inline int32 GetLeftShoulder1(void) { return NewState.LeftShoulder1; } + inline int32 GetLeftShoulder2(void) { return NewState.LeftShoulder2; } + inline int32 GetRightShoulder1(void) { return NewState.RightShoulder1; } + inline int32 GetRightShoulder2(void) { return NewState.RightShoulder2; } }; VALIDATE_SIZE(CPad, 0xFC); diff --git a/src/Radar.cpp b/src/Radar.cpp index 63a84680..1c0b0d65 100644 --- a/src/Radar.cpp +++ b/src/Radar.cpp @@ -12,7 +12,7 @@ WRAPPER void CRadar::Draw3dMarkers() { EAXJMP(0x4A4C70); } WRAPPER void CRadar::DrawBlips() { EAXJMP(0x4A42F0); } WRAPPER void CRadar::DrawRadarMap() { EAXJMP(0x4A6C20); } -Float &CRadar::m_RadarRange = *(Float*)0x8E281C; +float &CRadar::m_RadarRange = *(float*)0x8E281C; CVector2D &CRadar::vec2DRadarOrigin = *(CVector2D*)0x6299B8; void CRadar::DrawMap() { diff --git a/src/Radar.h b/src/Radar.h index f5afcd6e..52d8a883 100644 --- a/src/Radar.h +++ b/src/Radar.h @@ -14,7 +14,7 @@ enum eBlipType class CRadar { public: - static Float &m_RadarRange; + static float &m_RadarRange; static CVector2D &vec2DRadarOrigin; public: diff --git a/src/Stats.cpp b/src/Stats.cpp index 8537137e..5256b0cf 100644 --- a/src/Stats.cpp +++ b/src/Stats.cpp @@ -1,5 +1,5 @@ #include "common.h" #include "Stats.h" -Int32 &CStats::DaysPassed = *(Int32*)0x8F2BB8; -Int32 &CStats::HeadShots = *(Int32*)0x8F647C; \ No newline at end of file +int32 &CStats::DaysPassed = *(int32*)0x8F2BB8; +int32 &CStats::HeadShots = *(int32*)0x8F647C; \ No newline at end of file diff --git a/src/Stats.h b/src/Stats.h index 398999dc..4508e8a8 100644 --- a/src/Stats.h +++ b/src/Stats.h @@ -3,6 +3,6 @@ class CStats { public: - static Int32 &DaysPassed; - static Int32 &HeadShots; + static int32 &DaysPassed; + static int32 &HeadShots; }; \ No newline at end of file diff --git a/src/Timer.cpp b/src/Timer.cpp index 3a49d9df..62f1ed55 100644 --- a/src/Timer.cpp +++ b/src/Timer.cpp @@ -17,13 +17,13 @@ bool &CTimer::m_UserPause = *(bool*)0x95CD7C; bool &CTimer::m_CodePause = *(bool*)0x95CDB1; //UInt32 oldPcTimer; -UInt32 &oldPcTimer = *(UInt32*)0x9434F4; +uint32 &oldPcTimer = *(uint32*)0x9434F4; //UInt32 suspendPcTimer; -UInt32 &suspendPcTimer = *(UInt32*)0x62A308; +uint32 &suspendPcTimer = *(uint32*)0x62A308; //UInt32 _nCyclesPerMS = 1; -UInt32 &_nCyclesPerMS = *(UInt32*)0x5F7610; +uint32 &_nCyclesPerMS = *(uint32*)0x5F7610; //LARGE_INTEGER _oldPerfCounter; LARGE_INTEGER &_oldPerfCounter = *(LARGE_INTEGER*)0x62A310; @@ -32,7 +32,7 @@ LARGE_INTEGER &_oldPerfCounter = *(LARGE_INTEGER*)0x62A310; LARGE_INTEGER &perfSuspendCounter = *(LARGE_INTEGER*)0x62A318; //UInt32 suspendDepth; -UInt32 &suspendDepth = *(UInt32*)0x62A320; +uint32 &suspendDepth = *(uint32*)0x62A320; void CTimer::Initialise(void) { @@ -51,7 +51,7 @@ void CTimer::Initialise(void) if ( QueryPerformanceFrequency(&perfFreq) ) { OutputDebugString("Performance counter available\n"); - _nCyclesPerMS = UInt32(perfFreq.QuadPart / 1000); + _nCyclesPerMS = uint32(perfFreq.QuadPart / 1000); QueryPerformanceCounter(&_oldPerfCounter); } else @@ -82,18 +82,18 @@ void CTimer::Update(void) { m_snPreviousTimeInMilliseconds = m_snTimeInMilliseconds; - if ( (Double)_nCyclesPerMS != 0.0 ) + if ( (double)_nCyclesPerMS != 0.0 ) { LARGE_INTEGER pc; QueryPerformanceCounter(&pc); - Int32 updInCycles = (pc.LowPart - _oldPerfCounter.LowPart) & 0x7FFFFFFF; + int32 updInCycles = (pc.LowPart - _oldPerfCounter.LowPart) & 0x7FFFFFFF; _oldPerfCounter = pc; - Double updInCyclesScaled = (Double)updInCycles * ms_fTimeScale; + double updInCyclesScaled = (double)updInCycles * ms_fTimeScale; - Double upd = updInCyclesScaled / (Double)_nCyclesPerMS; + double upd = updInCyclesScaled / (double)_nCyclesPerMS; m_snTimeInMillisecondsPauseMode = (Int64)(m_snTimeInMillisecondsPauseMode + upd); @@ -103,16 +103,16 @@ void CTimer::Update(void) { m_snTimeInMilliseconds = (Int64)(m_snTimeInMilliseconds + upd); m_snTimeInMillisecondsNonClipped = (Int64)(m_snTimeInMillisecondsNonClipped + upd); - ms_fTimeStep = updInCyclesScaled / (Double)_nCyclesPerMS / 20.0; + ms_fTimeStep = updInCyclesScaled / (double)_nCyclesPerMS / 20.0; } } else { - UInt32 timer = RsTimer(); + uint32 timer = RsTimer(); - UInt32 updInMs = timer - oldPcTimer; + uint32 updInMs = timer - oldPcTimer; - Double upd = (Double)updInMs * ms_fTimeScale; + double upd = (double)updInMs * ms_fTimeScale; oldPcTimer = timer; @@ -156,7 +156,7 @@ void CTimer::Suspend(void) if ( ++suspendDepth > 1 ) return; - if ( (Double)_nCyclesPerMS != 0.0 ) + if ( (double)_nCyclesPerMS != 0.0 ) QueryPerformanceCounter(&perfSuspendCounter); else suspendPcTimer = RsTimer(); @@ -167,7 +167,7 @@ void CTimer::Resume(void) if ( --suspendDepth != 0 ) return; - if ( (Double)_nCyclesPerMS != 0.0 ) + if ( (double)_nCyclesPerMS != 0.0 ) { LARGE_INTEGER pc; QueryPerformanceCounter(&pc); @@ -178,7 +178,7 @@ void CTimer::Resume(void) oldPcTimer += RsTimer() - suspendPcTimer; } -UInt32 CTimer::GetCyclesPerMillisecond(void) +uint32 CTimer::GetCyclesPerMillisecond(void) { if (_nCyclesPerMS != 0) return _nCyclesPerMS; @@ -186,7 +186,7 @@ UInt32 CTimer::GetCyclesPerMillisecond(void) return 1; } -UInt32 CTimer::GetCurrentTimeInCycles(void) +uint32 CTimer::GetCurrentTimeInCycles(void) { if ( _nCyclesPerMS != 0 ) { @@ -198,7 +198,7 @@ UInt32 CTimer::GetCurrentTimeInCycles(void) return RsTimer() - oldPcTimer; } -Bool CTimer::GetIsSlowMotionActive(void) +bool CTimer::GetIsSlowMotionActive(void) { return ms_fTimeScale < 1.0f; } diff --git a/src/Timer.h b/src/Timer.h index c369777a..10bb5d84 100644 --- a/src/Timer.h +++ b/src/Timer.h @@ -19,18 +19,18 @@ public: static uint32 GetFrameCounter(void) { return m_FrameCounter; } static uint32 GetTimeInMilliseconds(void) { return m_snTimeInMilliseconds; } - static inline Bool GetIsPaused() { return m_UserPause || m_CodePause; } - static inline Bool GetIsUserPaused() { return m_UserPause; } - static inline void SetTimeScale(Float ts) { ms_fTimeScale = ts; } + static inline bool GetIsPaused() { return m_UserPause || m_CodePause; } + static inline bool GetIsUserPaused() { return m_UserPause; } + static inline void SetTimeScale(float ts) { ms_fTimeScale = ts; } static void Initialise(void); static void Shutdown(void); static void Update(void); static void Suspend(void); static void Resume(void); - static UInt32 GetCyclesPerMillisecond(void); - static UInt32 GetCurrentTimeInCycles(void); - static Bool GetIsSlowMotionActive(void); + static uint32 GetCyclesPerMillisecond(void); + static uint32 GetCurrentTimeInCycles(void); + static bool GetIsSlowMotionActive(void); static void Stop(void); static void StartUserPause(void); static void EndUserPause(void); diff --git a/src/Wanted.h b/src/Wanted.h index cf24d5a5..f7ea66f3 100644 --- a/src/Wanted.h +++ b/src/Wanted.h @@ -45,7 +45,7 @@ public: int16 m_wRoadblockNode; int8 field_1342; int8 field_1343; - Float m_fDistanceToTarget; + float m_fDistanceToTarget; int8 m_bIsInPursuit; int8 m_bIsDisabledCop; int8 field_1350; @@ -67,7 +67,7 @@ public: int32 m_nChaos; int32 m_nLastUpdateTime; int32 m_nLastWantedLevelChange; - Float m_fCrimeSensitivity; + float m_fCrimeSensitivity; uint8 m_bCurrentCops; uint8 m_bMaxCops; uint8 m_bMaximumLawEnforcerVehicles; diff --git a/src/audio/AudioScriptObject.cpp b/src/audio/AudioScriptObject.cpp index 7cb81f7a..a8c645d4 100644 --- a/src/audio/AudioScriptObject.cpp +++ b/src/audio/AudioScriptObject.cpp @@ -1,7 +1,7 @@ #include "common.h" #include "AudioScriptObject.h" -void PlayOneShotScriptObject(UInt8 id, CVector const &pos) +void PlayOneShotScriptObject(uint8 id, CVector const &pos) { - ((void (__cdecl *)(UInt8, CVector const &))0x57C5F0)(id, pos); + ((void (__cdecl *)(uint8, CVector const &))0x57C5F0)(id, pos); } \ No newline at end of file diff --git a/src/audio/AudioScriptObject.h b/src/audio/AudioScriptObject.h index a30af679..c325ce27 100644 --- a/src/audio/AudioScriptObject.h +++ b/src/audio/AudioScriptObject.h @@ -128,4 +128,4 @@ enum /*eSounds*/ _SOUND_BULLET_SHELL_HIT_GROUND_2 = 123, }; -extern void PlayOneShotScriptObject(UInt8 id, CVector const &pos); \ No newline at end of file +extern void PlayOneShotScriptObject(uint8 id, CVector const &pos); \ No newline at end of file diff --git a/src/audio/DMAudio.cpp b/src/audio/DMAudio.cpp index dcfdc81b..7f74fd8a 100644 --- a/src/audio/DMAudio.cpp +++ b/src/audio/DMAudio.cpp @@ -10,10 +10,10 @@ WRAPPER void cDMAudio::ReacquireDigitalHandle(void) { EAXJMP(0x57CA30); } WRAPPER void cDMAudio::Service(void) { EAXJMP(0x57C7A0); } WRAPPER void cDMAudio::ReportCollision(CEntity *A, CEntity *B, uint8 surfA, uint8 surfB, float impulse, float speed) { EAXJMP(0x57CBE0); } -WRAPPER void cDMAudio::ResetTimers(UInt32 timerval) { EAXJMP(0x57CCD0); } -WRAPPER Bool cDMAudio::IsAudioInitialised() { EAXJMP(0x57CAB0); } -WRAPPER Char cDMAudio::GetCDAudioDriveLetter() { EAXJMP(0x57CA90); } -WRAPPER Bool cDMAudio::CheckForAnAudioFileOnCD() { EAXJMP(0x57CA70); } -WRAPPER void cDMAudio::ChangeMusicMode(UInt8 mode) { EAXJMP(0x57CCF0); } +WRAPPER void cDMAudio::ResetTimers(uint32 timerval) { EAXJMP(0x57CCD0); } +WRAPPER bool cDMAudio::IsAudioInitialised() { EAXJMP(0x57CAB0); } +WRAPPER char cDMAudio::GetCDAudioDriveLetter() { EAXJMP(0x57CA90); } +WRAPPER bool cDMAudio::CheckForAnAudioFileOnCD() { EAXJMP(0x57CA70); } +WRAPPER void cDMAudio::ChangeMusicMode(uint8 mode) { EAXJMP(0x57CCF0); } WRAPPER void cDMAudio::PlayFrontEndSound(uint32, uint32) { EAXJMP(0x57CC20); } diff --git a/src/audio/DMAudio.h b/src/audio/DMAudio.h index b9e60b60..9006d248 100644 --- a/src/audio/DMAudio.h +++ b/src/audio/DMAudio.h @@ -182,11 +182,11 @@ public: void ReacquireDigitalHandle(void); void Service(void); void ReportCollision(CEntity* A, CEntity* B, uint8 surfA, uint8 surfB, float impulse, float speed); - void ResetTimers(UInt32 timerval); - Bool IsAudioInitialised(void); - Char GetCDAudioDriveLetter(void); - Bool CheckForAnAudioFileOnCD(void); - void ChangeMusicMode(UInt8 mode); + void ResetTimers(uint32 timerval); + bool IsAudioInitialised(void); + char GetCDAudioDriveLetter(void); + bool CheckForAnAudioFileOnCD(void); + void ChangeMusicMode(uint8 mode); void PlayFrontEndSound(uint32, uint32); }; extern cDMAudio &DMAudio; diff --git a/src/audio/MusicManager.h b/src/audio/MusicManager.h index 7932ca31..48df60ba 100644 --- a/src/audio/MusicManager.h +++ b/src/audio/MusicManager.h @@ -226,7 +226,7 @@ public: class cMusicManager { public: - Bool m_bIsInitialised; + bool m_bIsInitialised; uint8 field_1; uint8 m_nMusicMode; uint8 m_nCurrentStreamedSound; @@ -234,10 +234,10 @@ public: uint8 field_5; uint8 field_6; uint8 field_7; - Bool m_bAnnouncement; - Bool m_bPreviousPlayerInCar; - Bool m_bPlayerInCar; - Bool m_bAnnouncementInProgress; + bool m_bAnnouncement; + bool m_bPreviousPlayerInCar; + bool m_bPlayerInCar; + bool m_bAnnouncementInProgress; tMP3Sample m_asMP3Samples[196]; uint8 field_2364; uint8 field_2365; @@ -249,13 +249,13 @@ public: uint8 field_2380; uint8 field_2381; uint8 field_2382; - Bool m_bRadioSetByScript; + bool m_bRadioSetByScript; uint8 m_nRadioStation; uint8 field_2385; uint8 field_2386; uint8 field_2387; uint32 m_nRadioPosition; - Bool m_bRadioInCar; + bool m_bRadioInCar; uint8 field_2393; uint8 field_2394; uint8 field_2395; diff --git a/src/common.h b/src/common.h index a9055391..7d7e223c 100644 --- a/src/common.h +++ b/src/common.h @@ -31,22 +31,17 @@ #undef near #endif -typedef uint8_t uint8, UInt8; -typedef int8_t int8, Int8; -typedef uint16_t uint16, UInt16; -typedef int16_t int16, Int16; -typedef uint32_t uint32, UInt32; -typedef int32_t int32, Int32; +typedef uint8_t uint8; +typedef int8_t int8; +typedef uint16_t uint16; +typedef int16_t int16; +typedef uint32_t uint32; +typedef int32_t int32; typedef uintptr_t uintptr; -typedef uint64_t uint64, UInt64; -typedef int64_t int64, Int64; +typedef uint64_t uint64; +typedef int64_t int64; // hardcode ucs-2 -typedef uint16_t wchar, WChar; - -typedef float Float; -typedef double Double; -typedef bool Bool; -typedef char Char; +typedef uint16_t wchar; #define nil NULL @@ -68,13 +63,13 @@ extern void **rwengine; #define DEFAULT_SCREEN_WIDTH (640) #define DEFAULT_SCREEN_HEIGHT (448) -#define SCREEN_WIDTH Float(RsGlobal.width) -#define SCREEN_HEIGHT Float(RsGlobal.height) -#define SCREEN_STRETCH_X(a) Float((a) * (SCREEN_WIDTH / Float(DEFAULT_SCREEN_WIDTH))) -#define SCREEN_STRETCH_X_AR(a) Float((a) * (SCREEN_WIDTH / Float(DEFAULT_SCREEN_WIDTH)) * (4.0/3.0f)/SCREEN_ASPECT_RATIO) -#define SCREEN_STRETCH_Y(a) Float((a) * (SCREEN_HEIGHT / Float(DEFAULT_SCREEN_HEIGHT))) -#define SCREEN_FROM_RIGHT(a) Float(SCREEN_WIDTH - SCREEN_STRETCH_X(a)) -#define SCREEN_FROM_BOTTOM(a) Float(SCREEN_HEIGHT - SCREEN_STRETCH_Y(a)) +#define SCREEN_WIDTH float(RsGlobal.width) +#define SCREEN_HEIGHT float(RsGlobal.height) +#define SCREEN_STRETCH_X(a) float((a) * (SCREEN_WIDTH / float(DEFAULT_SCREEN_WIDTH))) +#define SCREEN_STRETCH_X_AR(a) float((a) * (SCREEN_WIDTH / float(DEFAULT_SCREEN_WIDTH)) * (4.0/3.0f)/SCREEN_ASPECT_RATIO) +#define SCREEN_STRETCH_Y(a) float((a) * (SCREEN_HEIGHT / float(DEFAULT_SCREEN_HEIGHT))) +#define SCREEN_FROM_RIGHT(a) float(SCREEN_WIDTH - SCREEN_STRETCH_X(a)) +#define SCREEN_FROM_BOTTOM(a) float(SCREEN_HEIGHT - SCREEN_STRETCH_Y(a)) #define HUD_STRETCH_X SCREEN_STRETCH_X_AR #define HUD_STRETCH_Y SCREEN_STRETCH_Y @@ -163,6 +158,6 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con #define VALIDATE_SIZE(struc, size) static_assert(sizeof(struc) == size, "Invalid structure size of " #struc) #define VALIDATE_OFFSET(struc, member, offset) static_assert(offsetof(struc, member) == offset, "The offset of " #member " in " #struc " is not " #offset "...") -#define PERCENT(x, p) ((Float(x) * (Float(p) / 100.0f))) +#define PERCENT(x, p) ((float(x) * (float(p) / 100.0f))) #define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) #define BIT(num) (1<<(num)) diff --git a/src/control/Population.cpp b/src/control/Population.cpp index 3626381d..9327452b 100644 --- a/src/control/Population.cpp +++ b/src/control/Population.cpp @@ -1,4 +1,4 @@ #include "common.h" #include "Population.h" -Bool &CPopulation::ms_bGivePedsWeapons = *(Bool*)0x95CCF6; \ No newline at end of file +bool &CPopulation::ms_bGivePedsWeapons = *(bool*)0x95CCF6; \ No newline at end of file diff --git a/src/control/Population.h b/src/control/Population.h index e01d2712..ce27657a 100644 --- a/src/control/Population.h +++ b/src/control/Population.h @@ -3,5 +3,5 @@ class CPopulation { public: - static Bool &ms_bGivePedsWeapons; + static bool &ms_bGivePedsWeapons; }; \ No newline at end of file diff --git a/src/control/Record.cpp b/src/control/Record.cpp index 8949da5e..4cc2dccd 100644 --- a/src/control/Record.cpp +++ b/src/control/Record.cpp @@ -1,6 +1,6 @@ #include "common.h" #include "Record.h" -UInt16 &CRecordDataForGame::RecordingState = *(UInt16*)0x95CC24; +uint16 &CRecordDataForGame::RecordingState = *(uint16*)0x95CC24; -UInt8 &CRecordDataForChase::Status = *(UInt8*)0x95CDCE; +uint8 &CRecordDataForChase::Status = *(uint8*)0x95CDCE; diff --git a/src/control/Record.h b/src/control/Record.h index 97a9663d..2b904d1d 100644 --- a/src/control/Record.h +++ b/src/control/Record.h @@ -3,11 +3,11 @@ class CRecordDataForGame { public: - static UInt16 &RecordingState; + static uint16 &RecordingState; }; class CRecordDataForChase { public: - static UInt8 &Status; + static uint8 &Status; }; diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp index b1bdc1bf..80edf097 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -3,6 +3,6 @@ #include "Replay.h" uint8 &CReplay::Mode = *(uint8*)0x95CD5B; -Bool &CReplay::bPlayingBackFromFile = *(Bool*)0x95CD58; +bool &CReplay::bPlayingBackFromFile = *(bool*)0x95CD58; WRAPPER void CReplay::Display(void) { EAXJMP(0x595EE0); } diff --git a/src/control/Replay.h b/src/control/Replay.h index 2fe2f272..70835596 100644 --- a/src/control/Replay.h +++ b/src/control/Replay.h @@ -8,7 +8,7 @@ public: }; static uint8 &Mode; - static Bool &bPlayingBackFromFile; + static bool &bPlayingBackFromFile; static void Display(void); }; diff --git a/src/control/Script.h b/src/control/Script.h index 0fe35fd2..cdc33e97 100644 --- a/src/control/Script.h +++ b/src/control/Script.h @@ -3,8 +3,8 @@ struct CScriptRectangle { - Bool m_bIsUsed; - Bool m_bIsAntialiased; + bool m_bIsUsed; + bool m_bIsAntialiased; uint16 m_wTextureId; CRect m_sRect; CRGBA m_sColor; @@ -12,23 +12,23 @@ struct CScriptRectangle struct CTextLine { - Float m_fScaleX; - Float m_fScaleY; + float m_fScaleX; + float m_fScaleY; CRGBA m_sColor; - Bool m_bJustify; - Bool m_bCentered; - Bool m_bBackground; - Bool m_bBackgroundOnly; - Float m_fWrapX; - Float m_fCenterSize; + bool m_bJustify; + bool m_bCentered; + bool m_bBackground; + bool m_bBackgroundOnly; + float m_fWrapX; + float m_fCenterSize; CRGBA m_sBackgroundColor; - Bool m_bTextProportional; + bool m_bTextProportional; int32 field_29; - Bool m_bRightJustify; + bool m_bRightJustify; int32 field_31; int32 m_nFont; - Float field_36; - Float field_40; + float field_36; + float field_40; wchar m_awText[500]; }; diff --git a/src/entities/Ped.cpp b/src/entities/Ped.cpp index 8d51c1f2..ccb07d46 100644 --- a/src/entities/Ped.cpp +++ b/src/entities/Ped.cpp @@ -8,9 +8,9 @@ #include "DMaudio.h" #include "Ped.h" -Bool &CPed::bNastyLimbsCheat = *(Bool*)0x95CD44; -Bool &CPed::bPedCheat2 = *(Bool*)0x95CD5A; -Bool &CPed::bPedCheat3 = *(Bool*)0x95CD59; +bool &CPed::bNastyLimbsCheat = *(bool*)0x95CD44; +bool &CPed::bPedCheat2 = *(bool*)0x95CD5A; +bool &CPed::bPedCheat3 = *(bool*)0x95CD59; void *CPed::operator new(size_t sz) { return CPools::GetPedPool()->New(); } void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); } diff --git a/src/entities/Ped.h b/src/entities/Ped.h index 6a2f8ef1..0b0a5562 100644 --- a/src/entities/Ped.h +++ b/src/entities/Ped.h @@ -196,8 +196,8 @@ private: public: CPathNode *m_pNextPathNode; CPathNode *m_pLastPathNode; - Float m_fHealth; - Float m_fArmour; + float m_fHealth; + float m_fArmour; uint8 stuff2[34]; CEntity *m_pCurrentPhysSurface; CVector m_vecOffsetFromPhysSurface; @@ -205,7 +205,7 @@ public: uint8 stuff3[12]; CPed* m_pSeekTarget; CVehicle *m_pMyVehicle; - Bool bInVehicle; + bool bInVehicle; uint8 stuff4[23]; int32 m_nPedType; PedStat *m_pedStats; @@ -255,9 +255,9 @@ public: CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; } RwFrame *GetNodeFrame(int nodeId) { return m_pFrames[nodeId]->frame; } - static Bool &bNastyLimbsCheat; - static Bool &bPedCheat2; - static Bool &bPedCheat3; + static bool &bNastyLimbsCheat; + static bool &bPedCheat2; + static bool &bPedCheat3; }; static_assert(offsetof(CPed, m_nPedState) == 0x224, "CPed: error"); static_assert(offsetof(CPed, m_pCurSurface) == 0x2FC, "CPed: error"); diff --git a/src/entities/PlayerInfo.h b/src/entities/PlayerInfo.h index eb15f53f..bcbaf4ac 100644 --- a/src/entities/PlayerInfo.h +++ b/src/entities/PlayerInfo.h @@ -29,7 +29,7 @@ public: int32 m_nTotalPackages; int32 field_188; int32 m_nSwitchTaxiTime; - Bool m_bSwitchTaxi; + bool m_bSwitchTaxi; int8 field_197; int8 field_198; int8 field_199; @@ -42,7 +42,7 @@ public: int8 field_218; int8 field_219; int32 m_nWBTime; - Bool m_bInRemoteMode; + bool m_bInRemoteMode; int8 field_225; int8 field_226; int8 field_227; @@ -55,15 +55,15 @@ public: int16 m_nTrafficMultiplier; int8 field_254; int8 field_255; - Float m_fRoadDensity; + float m_fRoadDensity; int32 m_nPreviousTimeRewardedForExplosion; int32 m_nExplosionsSinceLastReward; int32 field_268; int32 field_272; - Bool m_bInfiniteSprint; - Bool m_bFastReload; - Bool m_bGetOutOfJailFree; - Bool m_bGetOutOfHospitalFree; + bool m_bInfiniteSprint; + bool m_bFastReload; + bool m_bGetOutOfJailFree; + bool m_bGetOutOfHospitalFree; uint8 m_aSkinName[32]; RwTexture *m_pSkinTexture; }; diff --git a/src/entities/PlayerPed.h b/src/entities/PlayerPed.h index 6721f975..ee4f57b3 100644 --- a/src/entities/PlayerPed.h +++ b/src/entities/PlayerPed.h @@ -7,36 +7,36 @@ class CPlayerPed : public CPed { public: CWanted *m_pWanted; CCopPed *m_pArrestingCop; - Float m_fMoveSpeed; - Float m_fCurrentStamina; - Float m_fMaxStamina; - Float m_fStaminaProgress; - Bool m_bWeaponSlot; - Bool m_bSpeedTimerFlag; - Bool m_bShouldEvade; + float m_fMoveSpeed; + float m_fCurrentStamina; + float m_fMaxStamina; + float m_fStaminaProgress; + bool m_bWeaponSlot; + bool m_bSpeedTimerFlag; + bool m_bShouldEvade; int8 field_1367; int32 m_nSpeedTimer; int32 m_nShotDelay; - Float field_1376; + float field_1376; int8 field_1380; int8 field_1381; int8 field_1382; int8 field_1383; CEntity *m_pEvadingFrom; int32 m_nTargettableObjects[4]; - Bool m_bAdrenalineActive; - Bool m_bHasLockOnTarget; + bool m_bAdrenalineActive; + bool m_bHasLockOnTarget; int8 field_1406; int8 field_1407; - Bool m_bAdrenalineTime; - Bool m_bCanBeDamaged; + bool m_bAdrenalineTime; + bool m_bCanBeDamaged; int8 field_1413; int8 field_1414; int8 field_1415; CVector field_1416[6]; int32 field_1488[6]; - Float field_1512; - Float m_fFPSMoveHeading; + float field_1512; + float m_fFPSMoveHeading; }; static_assert(sizeof(CPlayerPed) == 0x5F0, "CPlayerPed: error"); diff --git a/src/entities/Vehicle.cpp b/src/entities/Vehicle.cpp index ebd7ae68..bac05f7b 100644 --- a/src/entities/Vehicle.cpp +++ b/src/entities/Vehicle.cpp @@ -3,11 +3,11 @@ #include "Vehicle.h" #include "Pools.h" -Bool &CVehicle::bWheelsOnlyCheat = *(Bool *)0x95CD78; -Bool &CVehicle::bAllDodosCheat = *(Bool *)0x95CD75; -Bool &CVehicle::bCheat3 = *(Bool *)0x95CD66; -Bool &CVehicle::bCheat4 = *(Bool *)0x95CD65; -Bool &CVehicle::bCheat5 = *(Bool *)0x95CD64; +bool &CVehicle::bWheelsOnlyCheat = *(bool *)0x95CD78; +bool &CVehicle::bAllDodosCheat = *(bool *)0x95CD75; +bool &CVehicle::bCheat3 = *(bool *)0x95CD66; +bool &CVehicle::bCheat4 = *(bool *)0x95CD65; +bool &CVehicle::bCheat5 = *(bool *)0x95CD64; void *CVehicle::operator new(size_t sz) { return CPools::GetVehiclePool()->New(); } void CVehicle::operator delete(void *p, size_t sz) { CPools::GetVehiclePool()->Delete((CVehicle*)p); } diff --git a/src/entities/Vehicle.h b/src/entities/Vehicle.h index 00126c31..e5d1cfb3 100644 --- a/src/entities/Vehicle.h +++ b/src/entities/Vehicle.h @@ -63,11 +63,11 @@ uint8 m_extra2; bool IsHeli(void) { return m_vehType == VEHICLE_TYPE_HELI; } bool IsPlane(void) { return m_vehType == VEHICLE_TYPE_PLANE; } - static Bool &bWheelsOnlyCheat; - static Bool &bAllDodosCheat; - static Bool &bCheat3; - static Bool &bCheat4; - static Bool &bCheat5; + static bool &bWheelsOnlyCheat; + static bool &bAllDodosCheat; + static bool &bCheat3; + static bool &bCheat4; + static bool &bCheat5; }; static_assert(sizeof(CVehicle) == 0x288, "CVehicle: error"); static_assert(offsetof(CVehicle, m_pCurSurface) == 0x1E0, "CVehicle: error"); diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 5f39c6c6..d9c86209 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -35,10 +35,10 @@ int32 &CHud::m_HelpMessageState = *(int32*)0x880E1C; int32 &CHud::m_HelpMessageTimer = *(int32*)0x880FA4; int32 &CHud::m_HelpMessageFadeTimer = *(int32*)0x8F6258; wchar *CHud::m_HelpMessageToPrint = (wchar*)0x664480; -Float &CHud::m_HelpMessageDisplayTime = *(Float*)0x8E2C28; -Float &CHud::m_fTextBoxNumLines = *(Float*)0x8E2C28; -Float &CHud::m_fHelpMessageTime = *(Float *)0x8E2C28; -Bool &CHud::m_bHelpMessageQuick = *(Bool *)0x95CCF7; +float &CHud::m_HelpMessageDisplayTime = *(float*)0x8E2C28; +float &CHud::m_fTextBoxNumLines = *(float*)0x8E2C28; +float &CHud::m_fHelpMessageTime = *(float *)0x8E2C28; +bool &CHud::m_bHelpMessageQuick = *(bool *)0x95CCF7; int32 CHud::m_ZoneState = *(int32*)0x8F29AC; int32 CHud::m_ZoneFadeTimer; int32 CHud::m_ZoneNameTimer = *(int32*)0x8F1A50; @@ -53,16 +53,16 @@ wchar* CHud::m_pLastVehicleName = *(wchar **)0x8E2DD8; wchar* CHud::m_pVehicleNameToPrint; wchar* CHud::m_Message = (wchar*)0x72E318; wchar* CHud::m_PagerMessage = (wchar*)0x878840; -Bool &CHud::m_Wants_To_Draw_Hud = *(Bool*)0x95CD89; -Bool &CHud::m_Wants_To_Draw_3dMarkers = *(Bool*)0x95CD62; +bool &CHud::m_Wants_To_Draw_Hud = *(bool*)0x95CD89; +bool &CHud::m_Wants_To_Draw_3dMarkers = *(bool*)0x95CD62; wchar(*CHud::m_BigMessage)[128] = (wchar(*)[128])0x664CE0; -Float *CHud::BigMessageInUse = (Float*)0x862140; -Float *CHud::BigMessageAlpha = (Float*)0x862108; -Float *CHud::BigMessageX = (Float*)0x773248; +float *CHud::BigMessageInUse = (float*)0x862140; +float *CHud::BigMessageAlpha = (float*)0x862108; +float *CHud::BigMessageX = (float*)0x773248; -Float &CHud::OddJob2OffTimer = *(Float*)0x942FA0; +float &CHud::OddJob2OffTimer = *(float*)0x942FA0; int8 &CHud::CounterOnLastFrame = *(int8*)0x95CD67; -Float &CHud::OddJob2XOffset = *(Float*)0x8F1B5C; +float &CHud::OddJob2XOffset = *(float*)0x8F1B5C; int16 &CHud::CounterFlashTimer = *(int16*)0x95CC20; int16 &CHud::OddJob2Timer = *(int16*)0x95CC52; int8 &CHud::TimerOnLastFrame = *(int8*)0x95CDA7; @@ -70,7 +70,7 @@ int16 &CHud::OddJob2On = *(int16*)0x95CC78; int16 &CHud::TimerFlashTimer = *(int16*)0x95CC6C; int16 &CHud::PagerSoundPlayed = *(int16*)0x95CC4A; int32 &CHud::SpriteBrightness = *(int32*)0x95CC54; -Float &CHud::PagerXOffset = *(Float*)0x941590; +float &CHud::PagerXOffset = *(float*)0x941590; int32 CHud::m_ItemToFlash = *(int32*)0x95CC82; int16 &CHud::PagerTimer = *(int16*)0x95CC3A; int16 &CHud::PagerOn = *(int16*)0x95CCA0; @@ -182,8 +182,8 @@ void CHud::Draw() { if (CReplay::Mode != 1) { if (m_Wants_To_Draw_Hud && !TheCamera.m_WideScreenOn) { - Bool Mode_RunAround = 0; - Bool Mode_FirstPerson = 0; + bool Mode_RunAround = 0; + bool Mode_FirstPerson = 0; int32 WeaponType = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_eWeaponType; int32 Mode = TheCamera.Cams[TheCamera.ActiveCam].Mode; @@ -217,8 +217,8 @@ void CHud::Draw() { RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); - Float fStep = sin((CTimer::GetTimeInMilliseconds() & 1023) * 0.0061328127); - Float fMultBright = CHud::SpriteBrightness * 0.033333335f * (0.25f * fStep + 0.75f); + float fStep = sin((CTimer::GetTimeInMilliseconds() & 1023) * 0.0061328127); + float fMultBright = CHud::SpriteBrightness * 0.033333335f * (0.25f * fStep + 0.75f); CRect rect; float fWidescreenOffset[2] = { 0.0f, 0.0f }; @@ -229,8 +229,8 @@ void CHud::Draw() { } if (Mode_RunAround && TheCamera.Cams->Using3rdPersonMouseCam()) { - Float f3rdX = SCREENW * TheCamera.m_f3rdPersonCHairMultX + fWidescreenOffset[0]; - Float f3rdY = SCREENH * TheCamera.m_f3rdPersonCHairMultY - fWidescreenOffset[1]; + float f3rdX = SCREENW * TheCamera.m_f3rdPersonCHairMultX + fWidescreenOffset[0]; + float f3rdY = SCREENH * TheCamera.m_f3rdPersonCHairMultY - fWidescreenOffset[1]; if (CWorld::Players[CWorld::PlayerInFocus].m_pPed && WeaponType == WEAPONTYPE_M16) { rect.left = f3rdX - HUD_STRETCH_X(32.0f * 0.6f); @@ -503,7 +503,7 @@ void CHud::Draw() { DrawZoneName */ if (CHud::m_pZoneName) { - Float fZoneAlpha = 0.0f; + float fZoneAlpha = 0.0f; if (CHud::m_pZoneName != CHud::m_pLastZoneName) { switch (CHud::m_ZoneState) { @@ -599,7 +599,7 @@ void CHud::Draw() { DrawVehicleName */ if (CHud::m_pVehicleName) { - Float fVehicleAlpha = 0.0f; + float fVehicleAlpha = 0.0f; if (CHud::m_pVehicleName != CHud::m_pLastVehicleName) { switch (CHud::m_VehicleState) { @@ -807,7 +807,7 @@ void CHud::Draw() { } if (PagerOn == 1) { if (PagerXOffset > 0.0f) { - Float fStep = PagerXOffset * 0.05f; + float fStep = PagerXOffset * 0.05f; if (fStep > 10.0f) fStep = 10.0f; PagerXOffset -= fStep * CTimer::GetTimeStep(); @@ -818,7 +818,7 @@ void CHud::Draw() { } } else if (PagerOn == 2) { - Float fStep = PagerXOffset * 0.05f; + float fStep = PagerXOffset * 0.05f; if (fStep < 2.0f) fStep = 2.0f; PagerXOffset += fStep * CTimer::GetTimeStep(); @@ -995,7 +995,7 @@ void CHud::Draw() { } } else { - Float fStep = (CTimer::GetTimeStep() + float fStep = (CTimer::GetTimeStep() * 0.02f * 1000.0f) * 0.30000001f; diff --git a/src/render/Hud.h b/src/render/Hud.h index 04795981..7c06f9e5 100644 --- a/src/render/Hud.h +++ b/src/render/Hud.h @@ -31,10 +31,10 @@ public: static int32 &m_HelpMessageTimer; static int32 &m_HelpMessageFadeTimer; static wchar *m_HelpMessageToPrint; - static Float &m_HelpMessageDisplayTime; - static Float &m_fTextBoxNumLines; - static Float &m_fHelpMessageTime; - static Bool &m_bHelpMessageQuick; + static float &m_HelpMessageDisplayTime; + static float &m_fTextBoxNumLines; + static float &m_fHelpMessageTime; + static bool &m_bHelpMessageQuick; static int32 m_ZoneState; static int32 m_ZoneFadeTimer; static int32 m_ZoneNameTimer; @@ -49,15 +49,15 @@ public: static int32 m_VehicleNameTimer; static wchar* m_Message; static wchar* m_PagerMessage; - static Bool &m_Wants_To_Draw_Hud; - static Bool &m_Wants_To_Draw_3dMarkers; + static bool &m_Wants_To_Draw_Hud; + static bool &m_Wants_To_Draw_3dMarkers; static wchar(*m_BigMessage)[128]; - static Float* BigMessageInUse; - static Float* BigMessageAlpha; - static Float* BigMessageX; - static Float &OddJob2OffTimer; + static float* BigMessageInUse; + static float* BigMessageAlpha; + static float* BigMessageX; + static float &OddJob2OffTimer; static int8 &CounterOnLastFrame; - static Float &OddJob2XOffset; + static float &OddJob2XOffset; static int16 &CounterFlashTimer; static int16 &OddJob2Timer; static int8 &TimerOnLastFrame; @@ -65,7 +65,7 @@ public: static int16 &TimerFlashTimer; static int16 &PagerSoundPlayed; static int32 &SpriteBrightness; - static Float &PagerXOffset; + static float &PagerXOffset; static int32 m_ItemToFlash; static int16 &PagerTimer; static int16 &PagerOn; diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp index b7c14f1b..1ff3bced 100644 --- a/src/render/Particle.cpp +++ b/src/render/Particle.cpp @@ -44,7 +44,7 @@ -const Char SmokeFiles[][6+1] = +const char SmokeFiles[][6+1] = { "smoke1", "smoke2", @@ -54,7 +54,7 @@ const Char SmokeFiles[][6+1] = }; -const Char Smoke2Files[][9+1] = +const char Smoke2Files[][9+1] = { "smokeII_1", "smokeII_2", @@ -63,7 +63,7 @@ const Char Smoke2Files[][9+1] = "smokeII_5" }; -const Char RubberFiles[][7+1] = +const char RubberFiles[][7+1] = { "rubber1", "rubber2", @@ -72,7 +72,7 @@ const Char RubberFiles[][7+1] = "rubber5" }; -const Char RainSplashFiles[][7+1] = +const char RainSplashFiles[][7+1] = { "splash1", "splash2", @@ -81,14 +81,14 @@ const Char RainSplashFiles[][7+1] = "splash5" }; -const Char WatersprayFiles[][11+1] = +const char WatersprayFiles[][11+1] = { "waterspray1", "waterspray2", "waterspray3" }; -const Char ExplosionMediumFiles[][7+1] = +const char ExplosionMediumFiles[][7+1] = { "explo01", "explo02", @@ -98,7 +98,7 @@ const Char ExplosionMediumFiles[][7+1] = "explo06" }; -const Char GunFlashFiles[][9+1] = +const char GunFlashFiles[][9+1] = { "gunflash1", "gunflash2", @@ -106,7 +106,7 @@ const Char GunFlashFiles[][9+1] = "gunflash4" }; -const Char RaindropFiles[][9+1] = +const char RaindropFiles[][9+1] = { "raindrop1", "raindrop2", @@ -114,13 +114,13 @@ const Char RaindropFiles[][9+1] = "raindrop4" }; -const Char RainSplashupFiles[][10+1] = +const char RainSplashupFiles[][10+1] = { "splash_up1", "splash_up2" }; -const Char BirdfrontFiles[][8+1] = +const char BirdfrontFiles[][8+1] = { "birdf_01", "birdf_02", @@ -128,7 +128,7 @@ const Char BirdfrontFiles[][8+1] = "birdf_04" }; -const Char CardebrisFiles[][12+1] = +const char CardebrisFiles[][12+1] = { "cardebris_01", "cardebris_02", @@ -136,7 +136,7 @@ const Char CardebrisFiles[][12+1] = "cardebris_04" }; -const Char CarsplashFiles[][12+1] = +const char CarsplashFiles[][12+1] = { "carsplash_01", "carsplash_02", @@ -210,7 +210,7 @@ RwTexture * (&gpRainDropTex)[MAX_RAINDROP_FILES] = *(RwTexture * (*)[MAX_RA RwRaster *gpRainDropRaster[MAX_RAINDROP_FILES]; //Float CParticle::ms_afRandTable[CParticle::RAND_TABLE_SIZE]; // -Float (&CParticle::ms_afRandTable)[CParticle::RAND_TABLE_SIZE] = *(Float (*)[CParticle::RAND_TABLE_SIZE])*(int *)0x6E98C8; +float (&CParticle::ms_afRandTable)[CParticle::RAND_TABLE_SIZE] = *(float (*)[CParticle::RAND_TABLE_SIZE])*(int *)0x6E98C8; CParticle *CParticle::m_pUnusedListHead; @@ -218,13 +218,13 @@ CParticle *CParticle::m_pUnusedListHead; //Float CParticle::m_SinTable[CParticle::SIN_COS_TABLE_SIZE]; // //Float CParticle::m_CosTable[CParticle::SIN_COS_TABLE_SIZE]; / -Float (&CParticle::m_SinTable)[CParticle::SIN_COS_TABLE_SIZE] = *(Float (*)[CParticle::SIN_COS_TABLE_SIZE])*(int *)0x877358; -Float (&CParticle::m_CosTable)[CParticle::SIN_COS_TABLE_SIZE] = *(Float (*)[CParticle::SIN_COS_TABLE_SIZE])*(int *)0x70DA18; +float (&CParticle::m_SinTable)[CParticle::SIN_COS_TABLE_SIZE] = *(float (*)[CParticle::SIN_COS_TABLE_SIZE])*(int *)0x877358; +float (&CParticle::m_CosTable)[CParticle::SIN_COS_TABLE_SIZE] = *(float (*)[CParticle::SIN_COS_TABLE_SIZE])*(int *)0x70DA18; -Int32 Randomizer; +int32 Randomizer; -Int32 nParticleCreationInterval = 1; -Float fParticleScaleLimit = 0.5f; +int32 nParticleCreationInterval = 1; +float fParticleScaleLimit = 0.5f; @@ -241,7 +241,7 @@ void CParticle::ReloadConfig() m_pUnusedListHead = gParticleArray; - for ( Int32 i = 0; i < MAX_PARTICLES_ON_SCREEN; i++ ) + for ( int32 i = 0; i < MAX_PARTICLES_ON_SCREEN; i++ ) { if ( i == MAX_PARTICLES_ON_SCREEN - 1 ) gParticleArray[i].m_pNext = NULL; @@ -292,93 +292,93 @@ void CParticle::Initialise() CParticleObject::Initialise(); - Float randVal = -1.0f; - for ( Int32 i = 0; i < RAND_TABLE_SIZE; i++ ) + float randVal = -1.0f; + for ( int32 i = 0; i < RAND_TABLE_SIZE; i++ ) { ms_afRandTable[i] = randVal; randVal += 0.1f; } - for ( Int32 i = 0; i < SIN_COS_TABLE_SIZE; i++ ) + for ( int32 i = 0; i < SIN_COS_TABLE_SIZE; i++ ) { - Float angle = DEGTORAD(Float(i) * Float(360.0f / SIN_COS_TABLE_SIZE)); + float angle = DEGTORAD(float(i) * float(360.0f / SIN_COS_TABLE_SIZE)); m_SinTable[i] = sin(angle); m_CosTable[i] = cos(angle); } - Int32 slot = CTxdStore::FindTxdSlot("particle"); + int32 slot = CTxdStore::FindTxdSlot("particle"); CTxdStore::PushCurrentTxd(); CTxdStore::SetCurrentTxd(slot); - for ( Int32 i = 0; i < MAX_SMOKE_FILES; i++ ) + for ( int32 i = 0; i < MAX_SMOKE_FILES; i++ ) { gpSmokeTex[i] = RwTextureRead(SmokeFiles[i], NULL); gpSmokeRaster[i] = RwTextureGetRaster(gpSmokeTex[i]); } - for ( Int32 i = 0; i < MAX_SMOKE2_FILES; i++ ) + for ( int32 i = 0; i < MAX_SMOKE2_FILES; i++ ) { gpSmoke2Tex[i] = RwTextureRead(Smoke2Files[i], NULL); gpSmoke2Raster[i] = RwTextureGetRaster(gpSmoke2Tex[i]); } - for ( Int32 i = 0; i < MAX_RUBBER_FILES; i++ ) + for ( int32 i = 0; i < MAX_RUBBER_FILES; i++ ) { gpRubberTex[i] = RwTextureRead(RubberFiles[i], NULL); gpRubberRaster[i] = RwTextureGetRaster(gpRubberTex[i]); } - for ( Int32 i = 0; i < MAX_RAINSPLASH_FILES; i++ ) + for ( int32 i = 0; i < MAX_RAINSPLASH_FILES; i++ ) { gpRainSplashTex[i] = RwTextureRead(RainSplashFiles[i], NULL); gpRainSplashRaster[i] = RwTextureGetRaster(gpRainSplashTex[i]); } - for ( Int32 i = 0; i < MAX_WATERSPRAY_FILES; i++ ) + for ( int32 i = 0; i < MAX_WATERSPRAY_FILES; i++ ) { gpWatersprayTex[i] = RwTextureRead(WatersprayFiles[i], NULL); gpWatersprayRaster[i] = RwTextureGetRaster(gpWatersprayTex[i]); } - for ( Int32 i = 0; i < MAX_EXPLOSIONMEDIUM_FILES; i++ ) + for ( int32 i = 0; i < MAX_EXPLOSIONMEDIUM_FILES; i++ ) { gpExplosionMediumTex[i] = RwTextureRead(ExplosionMediumFiles[i], NULL); gpExplosionMediumRaster[i] = RwTextureGetRaster(gpExplosionMediumTex[i]); } - for ( Int32 i = 0; i < MAX_GUNFLASH_FILES; i++ ) + for ( int32 i = 0; i < MAX_GUNFLASH_FILES; i++ ) { gpGunFlashTex[i] = RwTextureRead(GunFlashFiles[i], NULL); gpGunFlashRaster[i] = RwTextureGetRaster(gpGunFlashTex[i]); } - for ( Int32 i = 0; i < MAX_RAINDROP_FILES; i++ ) + for ( int32 i = 0; i < MAX_RAINDROP_FILES; i++ ) { gpRainDropTex[i] = RwTextureRead(RaindropFiles[i], NULL); gpRainDropRaster[i] = RwTextureGetRaster(gpRainDropTex[i]); } - for ( Int32 i = 0; i < MAX_RAINSPLASHUP_FILES; i++ ) + for ( int32 i = 0; i < MAX_RAINSPLASHUP_FILES; i++ ) { gpRainSplashupTex[i] = RwTextureRead(RainSplashupFiles[i], NULL); gpRainSplashupRaster[i] = RwTextureGetRaster(gpRainSplashupTex[i]); } - for ( Int32 i = 0; i < MAX_BIRDFRONT_FILES; i++ ) + for ( int32 i = 0; i < MAX_BIRDFRONT_FILES; i++ ) { gpBirdfrontTex[i] = RwTextureRead(BirdfrontFiles[i], NULL); gpBirdfrontRaster[i] = RwTextureGetRaster(gpBirdfrontTex[i]); } - for ( Int32 i = 0; i < MAX_CARDEBRIS_FILES; i++ ) + for ( int32 i = 0; i < MAX_CARDEBRIS_FILES; i++ ) { gpCarDebrisTex[i] = RwTextureRead(CardebrisFiles[i], NULL); gpCarDebrisRaster[i] = RwTextureGetRaster(gpCarDebrisTex[i]); } - for ( Int32 i = 0; i < MAX_CARSPLASH_FILES; i++ ) + for ( int32 i = 0; i < MAX_CARSPLASH_FILES; i++ ) { gpCarSplashTex[i] = RwTextureRead(CarsplashFiles[i], NULL); gpCarSplashRaster[i] = RwTextureGetRaster(gpCarSplashTex[i]); @@ -429,7 +429,7 @@ void CParticle::Initialise() CTxdStore::PopCurrentTxd(); - for ( Int32 i = 0; i < MAX_PARTICLES; i++ ) + for ( int32 i = 0; i < MAX_PARTICLES; i++ ) { tParticleSystemData *entry = &mod_ParticleSystemManager.m_aParticles[i]; @@ -584,7 +584,7 @@ void CParticle::Shutdown() { debug("Shutting down CParticle..."); - for ( Int32 i = 0; i < MAX_SMOKE_FILES; i++ ) + for ( int32 i = 0; i < MAX_SMOKE_FILES; i++ ) { RwTextureDestroy(gpSmokeTex[i]); #ifdef GTA3_1_1_PATCH @@ -592,7 +592,7 @@ void CParticle::Shutdown() #endif } - for ( Int32 i = 0; i < MAX_SMOKE2_FILES; i++ ) + for ( int32 i = 0; i < MAX_SMOKE2_FILES; i++ ) { RwTextureDestroy(gpSmoke2Tex[i]); #ifdef GTA3_1_1_PATCH @@ -600,7 +600,7 @@ void CParticle::Shutdown() #endif } - for ( Int32 i = 0; i < MAX_RUBBER_FILES; i++ ) + for ( int32 i = 0; i < MAX_RUBBER_FILES; i++ ) { RwTextureDestroy(gpRubberTex[i]); #ifdef GTA3_1_1_PATCH @@ -608,7 +608,7 @@ void CParticle::Shutdown() #endif } - for ( Int32 i = 0; i < MAX_RAINSPLASH_FILES; i++ ) + for ( int32 i = 0; i < MAX_RAINSPLASH_FILES; i++ ) { RwTextureDestroy(gpRainSplashTex[i]); #ifdef GTA3_1_1_PATCH @@ -616,7 +616,7 @@ void CParticle::Shutdown() #endif } - for ( Int32 i = 0; i < MAX_WATERSPRAY_FILES; i++ ) + for ( int32 i = 0; i < MAX_WATERSPRAY_FILES; i++ ) { RwTextureDestroy(gpWatersprayTex[i]); #ifdef GTA3_1_1_PATCH @@ -624,7 +624,7 @@ void CParticle::Shutdown() #endif } - for ( Int32 i = 0; i < MAX_EXPLOSIONMEDIUM_FILES; i++ ) + for ( int32 i = 0; i < MAX_EXPLOSIONMEDIUM_FILES; i++ ) { RwTextureDestroy(gpExplosionMediumTex[i]); #ifdef GTA3_1_1_PATCH @@ -632,7 +632,7 @@ void CParticle::Shutdown() #endif } - for ( Int32 i = 0; i < MAX_GUNFLASH_FILES; i++ ) + for ( int32 i = 0; i < MAX_GUNFLASH_FILES; i++ ) { RwTextureDestroy(gpGunFlashTex[i]); #ifdef GTA3_1_1_PATCH @@ -640,7 +640,7 @@ void CParticle::Shutdown() #endif } - for ( Int32 i = 0; i < MAX_RAINDROP_FILES; i++ ) + for ( int32 i = 0; i < MAX_RAINDROP_FILES; i++ ) { RwTextureDestroy(gpRainDropTex[i]); #ifdef GTA3_1_1_PATCH @@ -648,7 +648,7 @@ void CParticle::Shutdown() #endif } - for ( Int32 i = 0; i < MAX_RAINSPLASHUP_FILES; i++ ) + for ( int32 i = 0; i < MAX_RAINSPLASHUP_FILES; i++ ) { RwTextureDestroy(gpRainSplashupTex[i]); #ifdef GTA3_1_1_PATCH @@ -656,7 +656,7 @@ void CParticle::Shutdown() #endif } - for ( Int32 i = 0; i < MAX_BIRDFRONT_FILES; i++ ) + for ( int32 i = 0; i < MAX_BIRDFRONT_FILES; i++ ) { RwTextureDestroy(gpBirdfrontTex[i]); #ifdef GTA3_1_1_PATCH @@ -664,7 +664,7 @@ void CParticle::Shutdown() #endif } - for ( Int32 i = 0; i < MAX_CARDEBRIS_FILES; i++ ) + for ( int32 i = 0; i < MAX_CARDEBRIS_FILES; i++ ) { RwTextureDestroy(gpCarDebrisTex[i]); #ifdef GTA3_1_1_PATCH @@ -672,7 +672,7 @@ void CParticle::Shutdown() #endif } - for ( Int32 i = 0; i < MAX_CARSPLASH_FILES; i++ ) + for ( int32 i = 0; i < MAX_CARSPLASH_FILES; i++ ) { RwTextureDestroy(gpCarSplashTex[i]); #ifdef GTA3_1_1_PATCH @@ -750,7 +750,7 @@ void CParticle::Shutdown() gpPointlightTex = NULL; #endif - Int32 slot; + int32 slot; slot = CTxdStore::FindTxdSlot("particle"); CTxdStore::RemoveTxdSlot(slot); @@ -758,13 +758,13 @@ void CParticle::Shutdown() debug("CParticle shut down"); } -CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, Float fSize, Int32 nRotationSpeed, Int32 nRotation, Int32 nCurFrame, Int32 nLifeSpan) +CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, float fSize, int32 nRotationSpeed, int32 nRotation, int32 nCurFrame, int32 nLifeSpan) { CRGBA color(0, 0, 0, 0); return AddParticle(type, vecPos, vecDir, pEntity, fSize, color, nRotationSpeed, nRotation, nCurFrame, nLifeSpan); } -CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, Float fSize, RwRGBA const &color, Int32 nRotationSpeed, Int32 nRotation, Int32 nCurFrame, Int32 nLifeSpan) +CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, float fSize, RwRGBA const &color, int32 nRotationSpeed, int32 nRotation, int32 nCurFrame, int32 nLifeSpan) { if ( CTimer::GetIsPaused() ) return NULL; @@ -833,8 +833,8 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe if ( psystem->m_InitialColorVariation != 0 ) { - Int32 ColorVariation = CGeneral::GetRandomNumberInRange(-psystem->m_InitialColorVariation, psystem->m_InitialColorVariation); - //Float ColorVariation = CGeneral::GetRandomNumberInRange((Float)-psystem->m_InitialColorVariation, (Float)psystem->m_InitialColorVariation); + int32 ColorVariation = CGeneral::GetRandomNumberInRange(-psystem->m_InitialColorVariation, psystem->m_InitialColorVariation); + //Float ColorVariation = CGeneral::GetRandomNumberInRange((float)-psystem->m_InitialColorVariation, (float)psystem->m_InitialColorVariation); pParticle->m_Color.red = clamp(pParticle->m_Color.red + PERCENT(pParticle->m_Color.red, ColorVariation), @@ -893,18 +893,18 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe if ( psystem->m_nLifeSpanErrorShape != 0 ) { - Float randVal = ms_afRandTable[CGeneral::GetRandomNumber() % RAND_TABLE_SIZE]; + float randVal = ms_afRandTable[CGeneral::GetRandomNumber() % RAND_TABLE_SIZE]; if ( randVal > 0.0f ) - pParticle->m_nTimeWhenWillBeDestroyed += Int32(Float(psystem->m_nLifeSpan) * randVal * Float(psystem->m_nLifeSpanErrorShape)); + pParticle->m_nTimeWhenWillBeDestroyed += int32(float(psystem->m_nLifeSpan) * randVal * float(psystem->m_nLifeSpanErrorShape)); else - pParticle->m_nTimeWhenWillBeDestroyed += Int32(Float(psystem->m_nLifeSpan) * randVal / Float(psystem->m_nLifeSpanErrorShape)); + pParticle->m_nTimeWhenWillBeDestroyed += int32(float(psystem->m_nLifeSpan) * randVal / float(psystem->m_nLifeSpanErrorShape)); } if ( psystem->Flags & ZCHECK_FIRST ) { - static Bool bValidGroundFound = false; + static bool bValidGroundFound = false; static CVector LastTestCoors; - static Float LastTestGroundZ; + static float LastTestGroundZ; if ( bValidGroundFound && vecPos.x == LastTestCoors.x @@ -939,11 +939,11 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe if ( psystem->Flags & ZCHECK_BUMP ) { - static Float Z_Ground = 0.0f; + static float Z_Ground = 0.0f; if ( psystem->Flags & ZCHECK_BUMP_FIRST ) { - Bool bZFound = false; + bool bZFound = false; Z_Ground = CWorld::FindGroundZFor3DCoord(vecPos.x, vecPos.y, vecPos.z, (bool *)&bZFound); @@ -1000,21 +1000,21 @@ void CParticle::Update() CRGBA color(0, 0, 0, 0); - Float fFricDeccel50 = pow(0.50f, CTimer::GetTimeStep()); - Float fFricDeccel80 = pow(0.80f, CTimer::GetTimeStep()); - Float fFricDeccel90 = pow(0.90f, CTimer::GetTimeStep()); - Float fFricDeccel95 = pow(0.95f, CTimer::GetTimeStep()); - Float fFricDeccel96 = pow(0.96f, CTimer::GetTimeStep()); - Float fFricDeccel99 = pow(0.99f, CTimer::GetTimeStep()); + float fFricDeccel50 = pow(0.50f, CTimer::GetTimeStep()); + float fFricDeccel80 = pow(0.80f, CTimer::GetTimeStep()); + float fFricDeccel90 = pow(0.90f, CTimer::GetTimeStep()); + float fFricDeccel95 = pow(0.95f, CTimer::GetTimeStep()); + float fFricDeccel96 = pow(0.96f, CTimer::GetTimeStep()); + float fFricDeccel99 = pow(0.99f, CTimer::GetTimeStep()); CParticleObject::UpdateAll(); - for ( Int32 i = 0; i < MAX_PARTICLES; i++ ) + for ( int32 i = 0; i < MAX_PARTICLES; i++ ) { tParticleSystemData *psystem = &mod_ParticleSystemManager.m_aParticles[i]; CParticle *particle = psystem->m_pParticles; CParticle *prevParticle = NULL; - Bool bRemoveParticle; + bool bRemoveParticle; if ( particle == NULL ) continue; @@ -1035,18 +1035,18 @@ void CParticle::Update() { if ( particle->m_nTimeWhenColorWillBeChanged > CTimer::GetTimeInMilliseconds() ) { - Float colorMul = 1.0f - Float(particle->m_nTimeWhenColorWillBeChanged - CTimer::GetTimeInMilliseconds()) / Float(psystem->m_ColorFadeTime); + float colorMul = 1.0f - float(particle->m_nTimeWhenColorWillBeChanged - CTimer::GetTimeInMilliseconds()) / float(psystem->m_ColorFadeTime); particle->m_Color.red = clamp( - psystem->m_RenderColouring.red + Int32(Float(psystem->m_FadeDestinationColor.red - psystem->m_RenderColouring.red) * colorMul), + psystem->m_RenderColouring.red + int32(float(psystem->m_FadeDestinationColor.red - psystem->m_RenderColouring.red) * colorMul), 0, 255); particle->m_Color.green = clamp( - psystem->m_RenderColouring.green + Int32(Float(psystem->m_FadeDestinationColor.green - psystem->m_RenderColouring.green) * colorMul), + psystem->m_RenderColouring.green + int32(float(psystem->m_FadeDestinationColor.green - psystem->m_RenderColouring.green) * colorMul), 0, 255); particle->m_Color.blue = clamp( - psystem->m_RenderColouring.blue + Int32(Float(psystem->m_FadeDestinationColor.blue - psystem->m_RenderColouring.blue) * colorMul), + psystem->m_RenderColouring.blue + int32(float(psystem->m_FadeDestinationColor.blue - psystem->m_RenderColouring.blue) * colorMul), 0, 255); } else @@ -1063,7 +1063,7 @@ void CParticle::Update() } } - Float size = particle->m_fSize + particle->m_fExpansionRate; + float size = particle->m_fSize + particle->m_fExpansionRate; if ( size < 0.0f ) { @@ -1147,7 +1147,7 @@ void CParticle::Update() { bRemoveParticle = true; - Int32 randVal = Int32(CGeneral::GetRandomNumber()); + int32 randVal = int32(CGeneral::GetRandomNumber()); if ( randVal & 1 ) { @@ -1188,11 +1188,11 @@ void CParticle::Update() vecPosn.z += 1.0f; Randomizer++; - Int32 randVal = Int32(Randomizer & 7); + int32 randVal = int32(Randomizer & 7); if ( randVal == 5 ) { - Int32 randTime = Int32(CGeneral::GetRandomNumber()); + int32 randTime = int32(CGeneral::GetRandomNumber()); CShadows::AddPermanentShadow(1, gpBloodPoolTex, &vecPosn, 0.1f, 0.0f, 0.0f, -0.1f, @@ -1202,7 +1202,7 @@ void CParticle::Update() } else if ( randVal == 2 ) { - Int32 randTime = Int32(CGeneral::GetRandomNumber()); + int32 randTime = int32(CGeneral::GetRandomNumber()); CShadows::AddPermanentShadow(1, gpBloodPoolTex, &vecPosn, 0.2f, 0.0f, 0.0f, -0.2f, @@ -1414,12 +1414,12 @@ void CParticle::Update() if ( particle->m_fCurrentZRadius != 0.0f ) { - Int32 nSinCosIndex = particle->m_nCurrentZRotation % (SIN_COS_TABLE_SIZE - 1); + int32 nSinCosIndex = particle->m_nCurrentZRotation % (SIN_COS_TABLE_SIZE - 1); - Float fX = (m_CosTable[nSinCosIndex] - m_SinTable[nSinCosIndex]) + float fX = (m_CosTable[nSinCosIndex] - m_SinTable[nSinCosIndex]) * particle->m_fCurrentZRadius; - Float fY = (m_SinTable[nSinCosIndex] + m_CosTable[nSinCosIndex]) + float fY = (m_SinTable[nSinCosIndex] + m_CosTable[nSinCosIndex]) * particle->m_fCurrentZRadius; moveStep -= particle->m_vecParticleMovementOffset; @@ -1446,15 +1446,15 @@ void CParticle::Render() CSprite::InitSpriteBuffer2D(); - UInt32 flags = DRAW_OPAQUE; + uint32 flags = DRAW_OPAQUE; RwRaster *prevFrame = NULL; - for ( Int32 i = 0; i < MAX_PARTICLES; i++ ) + for ( int32 i = 0; i < MAX_PARTICLES; i++ ) { tParticleSystemData *psystem = &mod_ParticleSystemManager.m_aParticles[i]; - Bool particleBanned = false; + bool particleBanned = false; CParticle *particle = psystem->m_pParticles; @@ -1513,7 +1513,7 @@ void CParticle::Render() while ( particle != NULL ) { - Bool canDraw = true; + bool canDraw = true; if ( particle->m_nAlpha == 0 ) canDraw = false; @@ -1540,7 +1540,7 @@ void CParticle::Render() particle->m_fSize * 63.0f, particle->m_Color, particle->m_nColorIntensity, - (Float)particle->m_nRotation, + (float)particle->m_nRotation, particle->m_nAlpha); } else @@ -1561,8 +1561,8 @@ void CParticle::Render() if ( canDraw ) { CVector coors; - Float w; - Float h; + float w; + float h; if ( CSprite::CalcScreenCoors(particle->m_vecPosition, coors, &w, &h, true) ) { @@ -1578,13 +1578,13 @@ void CParticle::Render() particle->m_Color.blue, particle->m_nColorIntensity, 1.0f / coors.z, - Float(particle->m_nRotation), + float(particle->m_nRotation), particle->m_nAlpha); } else if ( psystem->Flags & SCREEN_TRAIL ) { - Float fRotation; - Float fTrailLength; + float fRotation; + float fTrailLength; if ( particle->m_vecScreenPosition.x == 0.0f ) { @@ -1599,12 +1599,12 @@ void CParticle::Render() coors.y - particle->m_vecScreenPosition.y ); - Float fDist = vecDist.Magnitude(); + float fDist = vecDist.Magnitude(); fTrailLength = fDist; //Float fRot = atan2( vecDist.x / fDist, sqrtf(1.0f - vecDist.x / fDist * (vecDist.x / fDist)) ); - Float fRot = asinf(vecDist.x / fDist); + float fRot = asinf(vecDist.x / fDist); fRotation = fRot; @@ -1616,9 +1616,9 @@ void CParticle::Render() if ( fRotation < 0.0f ) fRotation += 360.0f; - Float fSpeed = particle->m_vecVelocity.Magnitude(); + float fSpeed = particle->m_vecVelocity.Magnitude(); - Float fNewTrailLength = fSpeed * CTimer::GetTimeStep() * w * 2.0f; + float fNewTrailLength = fSpeed * CTimer::GetTimeStep() * w * 2.0f; if ( fDist > fNewTrailLength ) fTrailLength = fNewTrailLength; @@ -1640,8 +1640,8 @@ void CParticle::Render() else if ( psystem->Flags & SPEED_TRAIL ) { CVector vecPrevPos = particle->m_vecPosition - particle->m_vecVelocity; - Float fRotation; - Float fTrailLength; + float fRotation; + float fTrailLength; if ( CSprite::CalcScreenCoors(vecPrevPos, particle->m_vecScreenPosition, &fTrailLength, &fRotation, true) ) { @@ -1651,12 +1651,12 @@ void CParticle::Render() coors.y - particle->m_vecScreenPosition.y ); - Float fDist = vecDist.Magnitude(); + float fDist = vecDist.Magnitude(); fTrailLength = fDist; //Float fRot = atan2(vecDist.x / fDist, sqrt(1.0f - vecDist.x / fDist * (vecDist.x / fDist))); - Float fRot = asinf(vecDist.x / fDist); + float fRot = asinf(vecDist.x / fDist); fRotation = fRot; @@ -1687,7 +1687,7 @@ void CParticle::Render() } else if ( psystem->Flags & VERT_TRAIL ) { - Float fTrailLength = fabsf(particle->m_vecVelocity.z * 10.0f); + float fTrailLength = fabsf(particle->m_vecVelocity.z * 10.0f); CSprite::RenderBufferedOneXLUSprite(coors.x, coors.y, coors.z, particle->m_fSize * w, @@ -1772,7 +1772,7 @@ void CParticle::RemoveParticle(CParticle *pParticle, CParticle *pPrevParticle, t m_pUnusedListHead = pParticle; } -void CParticle::AddJetExplosion(CVector const &vecPos, Float fPower, Float fSize) +void CParticle::AddJetExplosion(CVector const &vecPos, float fPower, float fSize) { CRGBA color(240, 240, 240, 255); @@ -1790,7 +1790,7 @@ void CParticle::AddJetExplosion(CVector const &vecPos, Float fPower, Float fSize CVector vecStepPos = vecPos; - for ( Int32 i = 0; i < Int32(fPower * 4.0f); i++ ) + for ( int32 i = 0; i < int32(fPower * 4.0f); i++ ) { AddParticle(PARTICLE_EXPLOSION_MFAST, vecStepPos, @@ -1837,7 +1837,7 @@ void CParticle::AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatr CVector vecBasePos = matMatrix * (invMat * vecPos + CVector(0.0f, -1.0f, 0.5f)); - for ( Int32 i = 0; i < 5; i++ ) + for ( int32 i = 0; i < 5; i++ ) { CVector pos = vecBasePos; diff --git a/src/render/Particle.h b/src/render/Particle.h index 68e01879..5db91727 100644 --- a/src/render/Particle.h +++ b/src/render/Particle.h @@ -16,25 +16,25 @@ public: CVector m_vecPosition; CVector m_vecVelocity; CVector m_vecScreenPosition; - UInt32 m_nTimeWhenWillBeDestroyed; - UInt32 m_nTimeWhenColorWillBeChanged; - Float m_fZGround; + uint32 m_nTimeWhenWillBeDestroyed; + uint32 m_nTimeWhenColorWillBeChanged; + float m_fZGround; CVector m_vecParticleMovementOffset; - Int16 m_nCurrentZRotation; - UInt16 m_nZRotationTimer; - Float m_fCurrentZRadius; - UInt16 m_nZRadiusTimer; + int16 m_nCurrentZRotation; + uint16 m_nZRotationTimer; + float m_fCurrentZRadius; + uint16 m_nZRadiusTimer; char _pad0[2]; - Float m_fSize; - Float m_fExpansionRate; - UInt16 m_nFadeToBlackTimer; - UInt16 m_nFadeAlphaTimer; - UInt8 m_nColorIntensity; - UInt8 m_nAlpha; - UInt16 m_nCurrentFrame; - Int16 m_nAnimationSpeedTimer; - Int16 m_nRotationStep; - Int16 m_nRotation; + float m_fSize; + float m_fExpansionRate; + uint16 m_nFadeToBlackTimer; + uint16 m_nFadeAlphaTimer; + uint8 m_nColorIntensity; + uint8 m_nAlpha; + uint16 m_nCurrentFrame; + int16 m_nAnimationSpeedTimer; + int16 m_nRotationStep; + int16 m_nRotation; RwRGBA m_Color; char _pad1[2]; CParticle *m_pNext; @@ -49,24 +49,24 @@ public: ; } - //static Float ms_afRandTable[RAND_TABLE_SIZE]; - static Float (&ms_afRandTable)[RAND_TABLE_SIZE]; + //static float ms_afRandTable[RAND_TABLE_SIZE]; + static float (&ms_afRandTable)[RAND_TABLE_SIZE]; static CParticle *m_pUnusedListHead; /* - static Float m_SinTable[SIN_COS_TABLE_SIZE]; - static Float m_CosTable[SIN_COS_TABLE_SIZE]; + static float m_SinTable[SIN_COS_TABLE_SIZE]; + static float m_CosTable[SIN_COS_TABLE_SIZE]; */ - static Float (&m_SinTable)[SIN_COS_TABLE_SIZE]; - static Float (&m_CosTable)[SIN_COS_TABLE_SIZE]; + static float (&m_SinTable)[SIN_COS_TABLE_SIZE]; + static float (&m_CosTable)[SIN_COS_TABLE_SIZE]; static void ReloadConfig(); static void Initialise(); static void Shutdown(); - static CParticle *AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity = NULL, Float fSize = 0.0f, Int32 nRotationSpeed = 0, Int32 nRotation = 0, Int32 nCurFrame = 0, Int32 nLifeSpan = 0); - static CParticle *AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, Float fSize, RwRGBA const &color, Int32 nRotationSpeed = 0, Int32 nRotation = 0, Int32 nCurFrame = 0, Int32 nLifeSpan = 0); + static CParticle *AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity = NULL, float fSize = 0.0f, int32 nRotationSpeed = 0, int32 nRotation = 0, int32 nCurFrame = 0, int32 nLifeSpan = 0); + static CParticle *AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, float fSize, RwRGBA const &color, int32 nRotationSpeed = 0, int32 nRotation = 0, int32 nCurFrame = 0, int32 nLifeSpan = 0); static void Update(); static void Render(); @@ -74,7 +74,7 @@ public: static void RemovePSystem(tParticleType type); static void RemoveParticle(CParticle *pParticle, CParticle *pPrevParticle, tParticleSystemData *pPSystemData); - static inline void _Next(CParticle *&pParticle, CParticle *&pPrevParticle, tParticleSystemData *pPSystemData, Bool bRemoveParticle) + static inline void _Next(CParticle *&pParticle, CParticle *&pPrevParticle, tParticleSystemData *pPSystemData, bool bRemoveParticle) { if ( bRemoveParticle ) { @@ -92,7 +92,7 @@ public: } } - static void AddJetExplosion(CVector const &vecPos, Float fPower, Float fSize); + static void AddJetExplosion(CVector const &vecPos, float fPower, float fSize); static void AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatrix); }; diff --git a/src/render/ParticleMgr.cpp b/src/render/ParticleMgr.cpp index 9757a6ca..15370b47 100644 --- a/src/render/ParticleMgr.cpp +++ b/src/render/ParticleMgr.cpp @@ -5,7 +5,7 @@ cParticleSystemMgr mod_ParticleSystemManager; -const Char *ParticleFilename = "PARTICLE.CFG"; +const char *ParticleFilename = "PARTICLE.CFG"; //cParticleSystemMgr::cParticleSystemMgr() void cParticleSystemMgr::ctor() @@ -17,7 +17,7 @@ void cParticleSystemMgr::Initialise() { LoadParticleData(); - for ( Int32 i = 0; i < MAX_PARTICLES; i++ ) + for ( int32 i = 0; i < MAX_PARTICLES; i++ ) m_aParticles[i].m_pParticles = NULL; } @@ -28,13 +28,13 @@ void cParticleSystemMgr::LoadParticleData() CFileMgr::SetDir(""); tParticleSystemData *entry = NULL; - Int32 type = PARTICLE_FIRST; + int32 type = PARTICLE_FIRST; - Char *lineStart = (Char *)work_buff; - Char *lineEnd = lineStart + 1; + char *lineStart = (char *)work_buff; + char *lineEnd = lineStart + 1; - Char line[500]; - Char delims[4]; + char line[500]; + char delims[4]; while ( true ) { @@ -44,7 +44,7 @@ void cParticleSystemMgr::LoadParticleData() while ( *lineEnd != '\n' ) ++lineEnd; - Int32 lineLength = lineEnd - lineStart; + int32 lineLength = lineEnd - lineStart; ASSERT(lineLength < 500); @@ -57,11 +57,11 @@ void cParticleSystemMgr::LoadParticleData() if ( *line != ';' ) { - Int32 param = CFG_PARAM_FIRST; + int32 param = CFG_PARAM_FIRST; strcpy(delims, " \t"); - Char *value = strtok(line, delims); + char *value = strtok(line, delims); ASSERT(value != NULL); diff --git a/src/render/ParticleMgr.h b/src/render/ParticleMgr.h index a2dcbdb5..5e8da1e4 100644 --- a/src/render/ParticleMgr.h +++ b/src/render/ParticleMgr.h @@ -100,42 +100,42 @@ enum struct tParticleSystemData { tParticleType m_Type; - Char m_aName[20]; - Float m_fCreateRange; - Float m_fDefaultInitialRadius; - Float m_fExpansionRate; - UInt16 m_nZRotationInitialAngle; - Int16 m_nZRotationAngleChangeAmount; - UInt16 m_nZRotationChangeTime; - UInt16 m_nZRadiusChangeTime; - Float m_fInitialZRadius; - Float m_fZRadiusChangeAmount; - UInt16 m_nFadeToBlackTime; - Int16 m_nFadeToBlackAmount; - UInt8 m_nFadeToBlackInitialIntensity; - UInt8 m_nFadeAlphaInitialIntensity; - UInt16 m_nFadeAlphaTime; - Int16 m_nFadeAlphaAmount; - UInt16 m_nStartAnimationFrame; - UInt16 m_nFinalAnimationFrame; - UInt16 m_nAnimationSpeed; - UInt16 m_nRotationSpeed; + char m_aName[20]; + float m_fCreateRange; + float m_fDefaultInitialRadius; + float m_fExpansionRate; + uint16 m_nZRotationInitialAngle; + int16 m_nZRotationAngleChangeAmount; + uint16 m_nZRotationChangeTime; + uint16 m_nZRadiusChangeTime; + float m_fInitialZRadius; + float m_fZRadiusChangeAmount; + uint16 m_nFadeToBlackTime; + int16 m_nFadeToBlackAmount; + uint8 m_nFadeToBlackInitialIntensity; + uint8 m_nFadeAlphaInitialIntensity; + uint16 m_nFadeAlphaTime; + int16 m_nFadeAlphaAmount; + uint16 m_nStartAnimationFrame; + uint16 m_nFinalAnimationFrame; + uint16 m_nAnimationSpeed; + uint16 m_nRotationSpeed; char _pad1[2]; - Float m_fGravitationalAcceleration; - Int32 m_nFrictionDecceleration; - Int32 m_nLifeSpan; - Float m_fPositionRandomError; - Float m_fVelocityRandomError; - Float m_fExpansionRateError; - Int32 m_nRotationRateError; - UInt32 m_nLifeSpanErrorShape; - Float m_fTrailLengthMultiplier; - UInt32 Flags; + float m_fGravitationalAcceleration; + int32 m_nFrictionDecceleration; + int32 m_nLifeSpan; + float m_fPositionRandomError; + float m_fVelocityRandomError; + float m_fExpansionRateError; + int32 m_nRotationRateError; + uint32 m_nLifeSpanErrorShape; + float m_fTrailLengthMultiplier; + uint32 Flags; RwRGBA m_RenderColouring; - UInt8 m_InitialColorVariation; + uint8 m_InitialColorVariation; RwRGBA m_FadeDestinationColor; char _pad2[3]; - UInt32 m_ColorFadeTime; + uint32 m_ColorFadeTime; RwRaster **m_ppRaster; CParticle *m_pParticles; diff --git a/src/skel/events.cpp b/src/skel/events.cpp index 46488a04..877b969e 100644 --- a/src/skel/events.cpp +++ b/src/skel/events.cpp @@ -726,8 +726,8 @@ KeyboardHandler(RsEvent event, void *param) static RsEventStatus HandlePadButtonDown(RsPadButtonStatus *padButtonStatus) { - Bool bPadTwo = false; - Int32 padNumber = padButtonStatus->padID; + bool bPadTwo = false; + int32 padNumber = padButtonStatus->padID; CPad *pad = CPad::GetPad(padNumber); @@ -739,7 +739,7 @@ HandlePadButtonDown(RsPadButtonStatus *padButtonStatus) ControlsManager.UpdateJoyButtonState(padNumber); - for ( Int32 i = 0; i < _TODOCONST(16); i++ ) + for ( int32 i = 0; i < _TODOCONST(16); i++ ) { RsPadButtons btn = rsPADNULL; if ( ControlsManager.m_aButtonStates[i] == TRUE ) @@ -761,8 +761,8 @@ HandlePadButtonDown(RsPadButtonStatus *padButtonStatus) static RsEventStatus HandlePadButtonUp(RsPadButtonStatus *padButtonStatus) { - Bool bPadTwo = false; - Int32 padNumber = padButtonStatus->padID; + bool bPadTwo = false; + int32 padNumber = padButtonStatus->padID; CPad *pad = CPad::GetPad(padNumber); @@ -772,14 +772,14 @@ HandlePadButtonUp(RsPadButtonStatus *padButtonStatus) if ( padNumber == 1 ) bPadTwo = true; - Bool bCam = false; - Int16 mode = TheCamera.Cams[TheCamera.ActiveCam].Mode; + bool bCam = false; + int16 mode = TheCamera.Cams[TheCamera.ActiveCam].Mode; if ( mode == CCam::MODE_FLYBY || mode == CCam::MODE_FIXED ) - Bool bCam = true; + bool bCam = true; ControlsManager.UpdateJoyButtonState(padNumber); - for ( Int32 i = 1; i < _TODOCONST(16); i++ ) + for ( int32 i = 1; i < _TODOCONST(16); i++ ) { RsPadButtons btn = rsPADNULL; if ( ControlsManager.m_aButtonStates[i] == FALSE ) diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index 81fe109b..e1090f72 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -113,9 +113,9 @@ DWORD _dwMemAvailVideo; DWORD &_dwOperatingSystemVersion = *(DWORD*)0x70F290; RwUInt32 &gGameState = *(RwUInt32*)0x8F5838; -WRAPPER Bool InitialiseGame(void) { EAXJMP(0x48E7E0); } +WRAPPER bool InitialiseGame(void) { EAXJMP(0x48E7E0); } -WRAPPER const Char *GetLevelSplashScreen(Int32 number) { EAXJMP(0x48D750); } +WRAPPER const char *GetLevelSplashScreen(int32 number) { EAXJMP(0x48D750); } // void LoadingScreen(char const *msg1, char const *msg2, char const *screen); @@ -130,12 +130,12 @@ enum eJoypadState struct tJoy { eJoypadState m_State; - Bool m_bInitialised; - Bool m_bHasAxisZ; - Bool m_bHasAxisR; + bool m_bInitialised; + bool m_bHasAxisZ; + bool m_bHasAxisR; char _pad0; - Int32 m_nVendorID; - Int32 m_nProductID; + int32 m_nVendorID; + int32 m_nProductID; }; class CJoySticks @@ -1210,7 +1210,7 @@ MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam) PDEV_BROADCAST_VOLUME pVol = (PDEV_BROADCAST_VOLUME)pDev; if ( pVol->dbcv_flags & DBTF_MEDIA ) { - Char c = DMAudio.GetCDAudioDriveLetter(); + char c = DMAudio.GetCDAudioDriveLetter(); if ( c >= 'A' && pVol->dbcv_unitmask & (1 << (c - 'A')) ) { @@ -1578,7 +1578,7 @@ void InitialiseLanguage() || subLayout == SUBLANG_ENGLISH_AUS ) CGame::noProstitutes = true; - Int32 lang; + int32 lang; switch ( primSystemLCID ) { @@ -1910,7 +1910,7 @@ _WinMain(HINSTANCE instance, { CFileMgr::SetDirMyDocuments(); - Int32 gta3set = CFileMgr::OpenFile("gta3.set", "r"); + int32 gta3set = CFileMgr::OpenFile("gta3.set", "r"); if ( gta3set ) { @@ -2112,10 +2112,10 @@ _WinMain(HINSTANCE instance, case GS_PLAYING_GAME: { - Float ms = (Float)CTimer::GetCurrentTimeInCycles() / (Float)CTimer::GetCyclesPerMillisecond(); + float ms = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond(); if ( RwInitialised ) { - if (!CMenuManager::m_PrefsFrameLimiter || (1000.0f / (Float)RsGlobal.maxFPS) < ms) + if (!CMenuManager::m_PrefsFrameLimiter || (1000.0f / (float)RsGlobal.maxFPS) < ms) RsEventHandler(rsIDLE, (void *)TRUE); } break; @@ -2335,16 +2335,16 @@ HRESULT CapturePad(RwInt32 padID) RsPadEventHandler(rsPADBUTTONUP, (void *)&bs); - Bool deviceAvailable = pPad != NULL; + bool deviceAvailable = pPad != NULL; if ( deviceAvailable ) { - leftStickPos.x = (Float)js.lX / (Float)((DEVICE_AXIS_MAX - DEVICE_AXIS_MIN) / 2); - leftStickPos.y = (Float)js.lY / (Float)((DEVICE_AXIS_MAX - DEVICE_AXIS_MIN) / 2); + leftStickPos.x = (float)js.lX / (float)((DEVICE_AXIS_MAX - DEVICE_AXIS_MIN) / 2); + leftStickPos.y = (float)js.lY / (float)((DEVICE_AXIS_MAX - DEVICE_AXIS_MIN) / 2); if (LOWORD(js.rgdwPOV[0]) != -1) { - Float angle = DEGTORAD((Float)js.rgdwPOV[0] / 100.0f); + float angle = DEGTORAD((float)js.rgdwPOV[0] / 100.0f); leftStickPos.x = sin(angle); leftStickPos.y = -cos(angle); @@ -2352,8 +2352,8 @@ HRESULT CapturePad(RwInt32 padID) if ( AllValidWinJoys.m_aJoys[bs.padID].m_bHasAxisR && AllValidWinJoys.m_aJoys[bs.padID].m_bHasAxisZ ) { - rightStickPos.x = (Float)js.lZ / (Float)((DEVICE_AXIS_MAX - DEVICE_AXIS_MIN) / 2); - rightStickPos.y = (Float)js.lRz / (Float)((DEVICE_AXIS_MAX - DEVICE_AXIS_MIN) / 2); + rightStickPos.x = (float)js.lZ / (float)((DEVICE_AXIS_MAX - DEVICE_AXIS_MIN) / 2); + rightStickPos.y = (float)js.lRz / (float)((DEVICE_AXIS_MAX - DEVICE_AXIS_MIN) / 2); } } @@ -2372,16 +2372,16 @@ HRESULT CapturePad(RwInt32 padID) CPad *pad = CPad::GetPad(bs.padID); if ( fabs(leftStickPos.x) > 0.3f ) - pad->PCTempJoyState.LeftStickX = (Int32)(leftStickPos.x * 128.0f); + pad->PCTempJoyState.LeftStickX = (int32)(leftStickPos.x * 128.0f); if ( fabs(leftStickPos.y) > 0.3f ) - pad->PCTempJoyState.LeftStickY = (Int32)(leftStickPos.y * 128.0f); + pad->PCTempJoyState.LeftStickY = (int32)(leftStickPos.y * 128.0f); if ( fabs(rightStickPos.x) > 0.3f ) - pad->PCTempJoyState.RightStickX = (Int32)(rightStickPos.x * 128.0f); + pad->PCTempJoyState.RightStickX = (int32)(rightStickPos.x * 128.0f); if ( fabs(rightStickPos.y) > 0.3f ) - pad->PCTempJoyState.RightStickY = (Int32)(rightStickPos.y * 128.0f); + pad->PCTempJoyState.RightStickY = (int32)(rightStickPos.y * 128.0f); } return S_OK; @@ -2392,7 +2392,7 @@ void _InputInitialiseJoys() DIPROPDWORD prop; DIDEVCAPS devCaps; - for ( Int32 i = 0; i < _TODOCONST(2); i++ ) + for ( int32 i = 0; i < _TODOCONST(2); i++ ) AllValidWinJoys.ClearJoyInfo(i); _InputAddJoys(); -- cgit v1.2.3 From d92c9085dacbf35c04da05d2d8a2bc3b2fee40c6 Mon Sep 17 00:00:00 2001 From: Fire_Head Date: Mon, 17 Jun 2019 02:32:34 +0300 Subject: fixed rebind bug --- src/Pad.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Pad.cpp b/src/Pad.cpp index 1615b0cd..ab00e88f 100644 --- a/src/Pad.cpp +++ b/src/Pad.cpp @@ -1837,7 +1837,7 @@ int32 *CPad::EditCodesForControls(int32 *pRsKeys, int32 nSize) *pRsKeys = i; } - for ( int32 i = 0; i < 255; i++ ) + for ( int32 i = 0; i < 12; i++ ) { if ( GetPad(0)->GetFJustDown(i) ) *pRsKeys = i + rsF1; -- cgit v1.2.3 From f299e9ebd51cc26d30a40ee5edff7ddf2968b2ec Mon Sep 17 00:00:00 2001 From: _AG Date: Mon, 17 Jun 2019 02:10:55 +0200 Subject: Update HUD stuff, bug and format fixes. Added environment variables to premake5.lua. Update README.md --- README.md | 7 ++ premake5.lua | 14 +-- src/Camera.cpp | 3 +- src/Frontend.cpp | 10 +-- src/Radar.cpp | 17 ++-- src/Wanted.h | 6 +- src/audio/MusicManager.cpp | 30 ++++--- src/audio/MusicManager.h | 9 +- src/common.h | 1 + src/control/Darkel.cpp | 3 +- src/control/Garages.cpp | 64 +++++++++++++- src/control/Garages.h | 18 ++++ src/entities/PlayerInfo.h | 17 ++-- src/entities/PlayerPed.h | 3 +- src/main.cpp | 18 ++-- src/render/Hud.cpp | 214 +++++++++++++++++++++------------------------ src/render/Hud.h | 49 ++++++----- 17 files changed, 292 insertions(+), 191 deletions(-) diff --git a/README.md b/README.md index 03431ef7..d2dcb4ac 100644 --- a/README.md +++ b/README.md @@ -177,3 +177,10 @@ but here are some observations: * do *not* use `dw` for `DWORD` or so, we're not programming win32 * Generally, try to make the code look as if R* could have written it + +# Environment Variables +Here you can find a list of variables that you might need to set in windows: +``` +"GTA_III_RE_DIR" * path to "gta3_re" game folder usually where this plugin run. +"GTA_III_DIR)" * path to "GTAIII" game folder. +``` diff --git a/premake5.lua b/premake5.lua index 49d0d502..cbd4c7f9 100644 --- a/premake5.lua +++ b/premake5.lua @@ -42,9 +42,9 @@ project "re3" defines { "DEBUG" } staticruntime "on" symbols "On" - debugdir "C:/Users/aap/games/gta3_re" - debugcommand "C:/Users/aap/games/gta3_re/gta3.exe" - postbuildcommands "copy /y \"$(TargetPath)\" \"C:\\Users\\aap\\games\\gta3_re\\plugins\\re3.dll\"" + debugdir "$(GTA_III_RE_DIR)" + debugcommand "$(GTA_III_RE_DIR)/gta3.exe" + postbuildcommands "copy /y \"$(TargetPath)\" \"$(GTA_III_RE_DIR)\\plugins\\re3.dll\"" filter "configurations:Release" defines { "NDEBUG" } @@ -52,16 +52,16 @@ project "re3" staticruntime "on" debugdir "C:/Users/aap/games/gta3_re" debugcommand "C:/Users/aap/games/gta3_re/gta3.exe" - postbuildcommands "copy /y \"$(TargetPath)\" \"C:\\Users\\aap\\games\\gta3_re\\plugins\\re3.dll\"" + postbuildcommands "copy /y \"$(TargetPath)\" \"$(GTA_III_RE_DIR)\\plugins\\re3.dll\"" filter "configurations:ReleaseFH" defines { "NDEBUG" } symbols "Full" optimize "off" staticruntime "on" - debugdir "F:/Rockstar Games/GTAIII" - debugcommand "F:/Rockstar Games/GTAIII/gta3.exe" + debugdir "$(GTA_III_DIR)" + debugcommand "$(GTA_III_DIR)/gta3.exe" targetextension ".asi" - targetdir "F:/Rockstar Games/GTAIII/scripts" + targetdir "$(GTA_III_DIR)/scripts" filter "configurations:DebugCI" defines { "DEBUG" } symbols "On" diff --git a/src/Camera.cpp b/src/Camera.cpp index 7bd4aac9..1b4b1db6 100644 --- a/src/Camera.cpp +++ b/src/Camera.cpp @@ -1249,7 +1249,8 @@ CCam::FixCamWhenObscuredByVehicle(const CVector &TargetCoors) Source.z += HeightFixerCarsObscuring; } -bool CCam::Using3rdPersonMouseCam() { +bool CCam::Using3rdPersonMouseCam() +{ return CCamera::m_bUseMouse3rdPerson && (Mode == MODE_FOLLOWPED || TheCamera.m_bPlayerIsInGarage && diff --git a/src/Frontend.cpp b/src/Frontend.cpp index 5613a2eb..b8ee10f4 100644 --- a/src/Frontend.cpp +++ b/src/Frontend.cpp @@ -37,15 +37,15 @@ WRAPPER void CMenuManager::LoadSettings(void) { EAXJMP(0x488EE0); } WRAPPER void CMenuManager::WaitForUserCD(void) { EAXJMP(0x48ADD0); } int CMenuManager::FadeIn(int alpha) { - if (FrontEndMenuManager.m_nCurrScreen == MENU_LOADING_IN_PROGRESS || - FrontEndMenuManager.m_nCurrScreen == MENU_SAVING_IN_PROGRESS || - FrontEndMenuManager.m_nCurrScreen == MENU_DELETING) + if (m_nCurrScreen == MENU_LOADING_IN_PROGRESS || + m_nCurrScreen == MENU_SAVING_IN_PROGRESS || + m_nCurrScreen == MENU_DELETING) return alpha; - if (FrontEndMenuManager.m_nMenuFadeAlpha >= alpha) + if (m_nMenuFadeAlpha >= alpha) return alpha; - return FrontEndMenuManager.m_nMenuFadeAlpha; + return m_nMenuFadeAlpha; } STARTPATCHES diff --git a/src/Radar.cpp b/src/Radar.cpp index 1c0b0d65..93097e8f 100644 --- a/src/Radar.cpp +++ b/src/Radar.cpp @@ -15,7 +15,8 @@ WRAPPER void CRadar::DrawRadarMap() { EAXJMP(0x4A6C20); } float &CRadar::m_RadarRange = *(float*)0x8E281C; CVector2D &CRadar::vec2DRadarOrigin = *(CVector2D*)0x6299B8; -void CRadar::DrawMap() { +void CRadar::DrawMap() +{ if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) { if (FindPlayerVehicle()) { if (FindPlayerVehicle()->GetSpeed().Magnitude() > 0.3f) { @@ -24,24 +25,24 @@ void CRadar::DrawMap() { else CRadar::m_RadarRange = (FindPlayerVehicle()->GetSpeed().Magnitude() + 0.3f) * 200.0f; } - else { + else CRadar::m_RadarRange = 120.0f; - } } - else { + else CRadar::m_RadarRange = 120.0f; - } + vec2DRadarOrigin.x = FindPlayerCentreOfWorld_NoSniperShift().x; vec2DRadarOrigin.y = FindPlayerCentreOfWorld_NoSniperShift().y; CRadar::DrawRadarMap(); } } -void CRadar::TransformRadarPointToScreenSpace(CVector2D *out, CVector2D *in) { +void CRadar::TransformRadarPointToScreenSpace(CVector2D *out, CVector2D *in) +{ out->x = in->x * HUD_STRETCH_X(47.0f) + HUD_STRETCH_X(47.0f + 20.0f); - out->y = (HUD_STRETCH_Y(76.0f)) * 0.5f + SCREEN_HEIGHT - (HUD_STRETCH_Y(123.0f)) - in->y * (HUD_STRETCH_Y(76.0f)) * 0.5f; + out->y = (HUD_STRETCH_Y(76.0f)) * 0.5f + SCREEN_HEIGHT - (HUD_STRETCH_Y(123.0f)) - in->y * (HUD_STRETCH_Y(76.0f)) * 0.5f; } STARTPATCHES InjectHook(0x4A5040, CRadar::TransformRadarPointToScreenSpace, PATCH_JUMP); -ENDPATCHES \ No newline at end of file +ENDPATCHES diff --git a/src/Wanted.h b/src/Wanted.h index f7ea66f3..60af7d8b 100644 --- a/src/Wanted.h +++ b/src/Wanted.h @@ -2,7 +2,8 @@ #include "Entity.h" #include "math/Vector.h" -enum eCrimeType { +enum eCrimeType +{ CRIME_NONE, CRIME_SHOT_FIRED, CRIME_PED_FIGHT, @@ -22,7 +23,8 @@ enum eCrimeType { CRIME_DESTROYED_CESSNA, }; -enum eCopType { +enum eCopType +{ COP_STREET = 0, COP_FBI = 1, COP_SWAT = 2, diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index d3f14b0a..881f6407 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -16,7 +16,8 @@ int &gRetuneCounter = *(int*)0x650B84; //WRAPPER void cMusicManager::DisplayRadioStationName(void) { EAXJMP(0x57E6D0); } -bool cMusicManager::PlayerInCar() { +bool cMusicManager::PlayerInCar() +{ if (!FindPlayerVehicle()) return false; else { @@ -25,7 +26,6 @@ bool cMusicManager::PlayerInCar() { if (State == PED_DRAG_FROM_CAR || State == PED_EXIT_CAR || State == PED_ARRESTED) return false; - int16 Model = FindPlayerVehicle()->m_modelIndex; switch (FindPlayerVehicle()->m_modelIndex) { case MI_FIRETRUCK: case MI_AMBULAN: @@ -42,8 +42,9 @@ bool cMusicManager::PlayerInCar() { } } -void cMusicManager::DisplayRadioStationName() { - wchar* RadioName = nullptr; +void cMusicManager::DisplayRadioStationName() +{ + wchar *RadioName = nullptr; uint32 RadioStation = gNumRetunePresses + MusicManager.m_nCurrentStreamedSound; switch (RadioStation) { @@ -84,11 +85,11 @@ void cMusicManager::DisplayRadioStationName() { CFont::SetJustifyOff(); CFont::SetBackgroundOff(); - CFont::SetScale(SCREEN_STRETCH_X(0.8f), SCREEN_STRETCH_Y(1.35f)); + CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f)); CFont::SetPropOn(); CFont::SetFontStyle(FONT_HEADING); CFont::SetCentreOn(); - CFont::SetCentreSize(SCREEN_STRETCH_X(640.0f));; + CFont::SetCentreSize(HUD_STRETCH_X(640.0f));; static int32 nTime = 0; if (!CTimer::GetIsPaused() && !TheCamera.m_WideScreenOn && MusicManager.PlayerInCar()) { @@ -105,33 +106,36 @@ void cMusicManager::DisplayRadioStationName() { else { if (RadioStation > HEAD_RADIO) { if (cSampleManager.IsMP3RadioChannelAvailable()) { - if (RadioStation > USERTRACK) + if (RadioStation > USERTRACK) { RadioStation = RADIO_OFF; + return; + } } else { - if (RadioStation > CHATTERBOX) + if (RadioStation > CHATTERBOX) { RadioStation = RADIO_OFF; + return; + } } } - else { + else RadioStation = RADIO_OFF; - } } } if (RadioName) { CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_STRETCH_Y(23.0f), RadioName); + CFont::PrintString(SCREEN_WIDTH / 2, HUD_STRETCH_Y(23.0f), RadioName); if (gNumRetunePresses) CFont::SetColor(CRGBA(102, 133, 143, 255)); else CFont::SetColor(CRGBA(147, 196, 211, 255)); - CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_STRETCH_Y(22.0f), RadioName); + CFont::PrintString(SCREEN_WIDTH / 2, HUD_STRETCH_Y(22.0f), RadioName); CFont::DrawFonts(); } } } -} \ No newline at end of file +} diff --git a/src/audio/MusicManager.h b/src/audio/MusicManager.h index 48df60ba..644c3df3 100644 --- a/src/audio/MusicManager.h +++ b/src/audio/MusicManager.h @@ -1,6 +1,7 @@ #pragma once -enum eRadioStation { +enum eRadioStation +{ HEAD_RADIO, DOUBLE_CLEF, JAH_RADIO, @@ -15,7 +16,8 @@ enum eRadioStation { RADIO_OFF, }; -enum eStreamedSounds { +enum eStreamedSounds +{ STREAMED_SOUND_RADIO_HEAD = 0, STREAMED_SOUND_RADIO_CLASSIC = 1, STREAMED_SOUND_RADIO_KJAH = 2, @@ -216,7 +218,8 @@ enum eStreamedSounds { NO_STREAMED_SOUND = 197, }; -class tMP3Sample { +class tMP3Sample +{ public: uint32 m_nLength; uint32 m_nPosition; diff --git a/src/common.h b/src/common.h index 7d7e223c..ee6ceadd 100644 --- a/src/common.h +++ b/src/common.h @@ -138,6 +138,7 @@ void mysrand(unsigned int seed); extern uint8 work_buff[55000]; extern char gString[256]; +extern wchar *gUString; void re3_debug(char *format, ...); void re3_trace(const char *filename, unsigned int lineno, const char *func, char *format, ...); diff --git a/src/control/Darkel.cpp b/src/control/Darkel.cpp index e2d9fd72..aece455d 100644 --- a/src/control/Darkel.cpp +++ b/src/control/Darkel.cpp @@ -6,6 +6,7 @@ WRAPPER void CDarkel::DrawMessages(void) { EAXJMP(0x420920); } bool CDarkel::Status = *(bool*)0x95CCB4; -bool CDarkel::FrenzyOnGoing() { +bool CDarkel::FrenzyOnGoing() +{ return Status; } \ No newline at end of file diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index effc13d8..2994eb49 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -2,8 +2,29 @@ #include "patcher.h" #include "ModelIndices.h" #include "Garages.h" +#include "Timer.h" +#include "Font.h" +#include "Messages.h" +#include "Text.h" -WRAPPER void CGarages::PrintMessages(void) { EAXJMP(0x426310); } +//WRAPPER void CGarages::PrintMessages(void) { EAXJMP(0x426310); } + +int32 &CGarages::BankVansCollected = *(int32 *)0x8F1B34; +bool &CGarages::BombsAreFree = *(bool *)0x95CD7A; +bool &CGarages::RespraysAreFree = *(bool *)0x95CD1D; +int32 &CGarages::CarsCollected = *(int32 *)0x880E18; +int32 &CGarages::CarTypesCollected = *(int32 *)0x8E286C; +int32 &CGarages::CrushedCarId = *(int32 *)0x943060; +uint32 &CGarages::LastTimeHelpMessage = *(uint32 *)0x8F1B58; +int32 &CGarages::MessageNumberInString = *(int32 *)0x885BA8; +const char *CGarages::MessageIDString = (const char *)0x878358; +int32 &CGarages::MessageNumberInString2 = *(int32 *)0x8E2C14; +uint32 &CGarages::MessageStartTime = *(uint32 *)0x8F2530; +uint32 &CGarages::MessageEndTime = *(uint32 *)0x8F597C; +uint32 &CGarages::NumGarages = *(uint32 *)0x8F29F4; +bool &CGarages::PlayerInGarage = *(bool *)0x95CD83; +int32 &CGarages::PoliceCarsCollected = *(int32 *)0x941444; +uint32 &CGarages::GarageToBeTidied = *(uint32 *)0x623570; bool CGarages::IsModelIndexADoor(uint32 id) @@ -42,3 +63,44 @@ CGarages::IsModelIndexADoor(uint32 id) id == MI_CRUSHERBODY || id == MI_CRUSHERLID; } + +void CGarages::PrintMessages() +{ + if (CTimer::GetTimeInMilliseconds() > CGarages::MessageStartTime && CTimer::GetTimeInMilliseconds() < CGarages::MessageEndTime) { + CFont::SetScale(HUD_STRETCH_X(1.2f / 2), HUD_STRETCH_Y(1.5f / 2)); // BUG: game doesn't use macro here. + CFont::SetPropOn(); + CFont::SetJustifyOff(); + CFont::SetBackgroundOff(); + CFont::SetCentreSize(HUD_FROM_RIGHT(50.0f)); + CFont::SetCentreOn(); + CFont::SetFontStyle(FONT_BANK); + + if (CGarages::MessageNumberInString2 < 0) { + if (CGarages::MessageNumberInString < 0) { + CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::PrintString((SCREEN_WIDTH/ 2) + HUD_STRETCH_X(2.0f), (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(-84.0f), TheText.Get(CGarages::MessageIDString)); + + CFont::SetColor(CRGBA(89, 115, 150, 255)); + CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(-84.0f), TheText.Get(CGarages::MessageIDString)); + } + else { + CMessages::InsertNumberInString(TheText.Get(CGarages::MessageIDString), CGarages::MessageNumberInString, -1, -1, -1, -1, -1, gUString); + + CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::PrintString((SCREEN_WIDTH / 2) + HUD_STRETCH_X(2.0f), (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(-84.0f + 2.0 - 40.0f), gUString); + + CFont::SetColor(CRGBA(89, 115, 150, 255)); + CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(-84.0f - 40.0f), gUString); + } + } + else { + CMessages::InsertNumberInString(TheText.Get(CGarages::MessageIDString), CGarages::MessageNumberInString2, -1, -1, -1, -1, -1, gUString); + + CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::PrintString((SCREEN_WIDTH / 2) + HUD_STRETCH_X(2.0f), (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(-84.0f + 2.0 - 40.0f), gUString); + + CFont::SetColor(CRGBA(89, 115, 150, 255)); + CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(-84.0f - 40.0f), gUString); + } + } +} \ No newline at end of file diff --git a/src/control/Garages.h b/src/control/Garages.h index 87cf47fa..f018401c 100644 --- a/src/control/Garages.h +++ b/src/control/Garages.h @@ -2,6 +2,24 @@ class CGarages { +public: + static int32 &BankVansCollected; + static bool &BombsAreFree; + static bool &RespraysAreFree; + static int32 &CarsCollected; + static int32 &CarTypesCollected; + static int32 &CrushedCarId; + static uint32 &LastTimeHelpMessage; + static int32 &MessageNumberInString; + static const char *MessageIDString; + static int32 &MessageNumberInString2; + static uint32 &MessageStartTime; + static uint32 &MessageEndTime; + static uint32 &NumGarages; + static bool &PlayerInGarage; + static int32 &PoliceCarsCollected; + static uint32 &GarageToBeTidied; + public: static bool IsModelIndexADoor(uint32 id); static void PrintMessages(void); diff --git a/src/entities/PlayerInfo.h b/src/entities/PlayerInfo.h index bcbaf4ac..abda1b23 100644 --- a/src/entities/PlayerInfo.h +++ b/src/entities/PlayerInfo.h @@ -2,18 +2,21 @@ #include "Automobile.h" #include "PlayerPed.h" -enum eWastedBustedState { - WBSTATE_PLAYING = 0x0, - WBSTATE_WASTED = 0x1, - WBSTATE_BUSTED = 0x2, - WBSTATE_FAILED_CRITICAL_MISSION = 0x3, +enum eWastedBustedState +{ + WBSTATE_PLAYING, + WBSTATE_WASTED, + WBSTATE_BUSTED, + WBSTATE_FAILED_CRITICAL_MISSION, }; -struct CCivilianPed { +struct CCivilianPed +{ }; -class CPlayerInfo { +class CPlayerInfo +{ public: CPlayerPed *m_pPed; CVehicle *m_pRemoteVehicle; diff --git a/src/entities/PlayerPed.h b/src/entities/PlayerPed.h index ee4f57b3..a41135e9 100644 --- a/src/entities/PlayerPed.h +++ b/src/entities/PlayerPed.h @@ -3,7 +3,8 @@ #include "Ped.h" #include "Wanted.h" -class CPlayerPed : public CPed { +class CPlayerPed : public CPed +{ public: CWanted *m_pWanted; CCopPed *m_pArrestingCop; diff --git a/src/main.cpp b/src/main.cpp index 976de407..655cc106 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -57,6 +57,7 @@ uint8 work_buff[55000]; char gString[256]; +wchar *gUString = (wchar*)0x74B018; bool &b_FoundRecentSavedGameWantToLoad = *(bool*)0x95CDA8; @@ -322,15 +323,16 @@ Render2dStuff(void) CRGBA black(0, 0, 0, 255); // top and bottom strips - if(weaponType == WEAPONTYPE_ROCKETLAUNCHER){ - CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW, SCREENH/2 - SCREEN_STRETCH_Y(180)), black); - CSprite2d::DrawRect(CRect(0.0f, SCREENH/2 + SCREEN_STRETCH_Y(170), SCREENW, SCREENH), black); - }else{ - CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW, SCREENH/2 - SCREEN_STRETCH_Y(210)), black); - CSprite2d::DrawRect(CRect(0.0f, SCREENH/2 + SCREEN_STRETCH_Y(210), SCREENW, SCREENH), black); + if (weaponType == WEAPONTYPE_ROCKETLAUNCHER) { + CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW, SCREENH / 2 - HUD_STRETCH_Y(180)), black); + CSprite2d::DrawRect(CRect(0.0f, SCREENH / 2 + HUD_STRETCH_Y(170), SCREENW, SCREENH), black); + } + else { + CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW, SCREENH / 2 - HUD_STRETCH_Y(210)), black); + CSprite2d::DrawRect(CRect(0.0f, SCREENH / 2 + HUD_STRETCH_Y(210), SCREENW, SCREENH), black); } - CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW/2 - SCREEN_STRETCH_X(210), SCREENH), black); - CSprite2d::DrawRect(CRect(SCREENW/2 + SCREEN_STRETCH_X(210), 0.0f, SCREENW, SCREENH), black); + CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW / 2 - HUD_STRETCH_X(210), SCREENH), black); + CSprite2d::DrawRect(CRect(SCREENW / 2 + HUD_STRETCH_X(210), 0.0f, SCREENW, SCREENH), black); } MusicManager.DisplayRadioStationName(); diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index d9c86209..bd8cee51 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -24,10 +24,10 @@ //WRAPPER void CHud::DrawAfterFade(void) { EAXJMP(0x509030); } WRAPPER void CHud::ReInitialise(void) { EAXJMP(0x504CC0); } WRAPPER void CHud::GetRidOfAllHudMessages(void) { EAXJMP(0x504F90); } -WRAPPER void CHud::SetHelpMessage(wchar* message, bool quick) { EAXJMP(0x5051E0); } -WRAPPER void CHud::SetMessage(wchar* message) { EAXJMP(0x50A210); } -WRAPPER void CHud::SetBigMessage(wchar* message, int16 style) { EAXJMP(0x50A250); } -WRAPPER void CHud::SetPagerMessage(wchar* message) { EAXJMP(0x50A320); } +WRAPPER void CHud::SetHelpMessage(wchar *message, bool quick) { EAXJMP(0x5051E0); } +WRAPPER void CHud::SetMessage(wchar *message) { EAXJMP(0x50A210); } +WRAPPER void CHud::SetBigMessage(wchar *message, int16 style) { EAXJMP(0x50A250); } +WRAPPER void CHud::SetPagerMessage(wchar *message) { EAXJMP(0x50A320); } wchar *CHud::m_HelpMessage = (wchar*)0x86B888; wchar *CHud::m_LastHelpMessage = (wchar*)0x6E8F28; @@ -42,17 +42,17 @@ bool &CHud::m_bHelpMessageQuick = *(bool *)0x95CCF7; int32 CHud::m_ZoneState = *(int32*)0x8F29AC; int32 CHud::m_ZoneFadeTimer; int32 CHud::m_ZoneNameTimer = *(int32*)0x8F1A50; -wchar* &CHud::m_pZoneName = *(wchar **)0x8E2C2C; -wchar* CHud::m_pLastZoneName = (wchar*)0x8F432C; -wchar* CHud::m_ZoneToPrint; +wchar *&CHud::m_pZoneName = *(wchar **)0x8E2C2C; +wchar *CHud::m_pLastZoneName = (wchar*)0x8F432C; +wchar *CHud::m_ZoneToPrint; int32 CHud::m_VehicleState = *(int32*)0x940560; int32 CHud::m_VehicleFadeTimer; int32 CHud::m_VehicleNameTimer = *(int32*)0x8F2A14; -wchar* &CHud::m_pVehicleName = *(wchar **)0x942FB4; -wchar* CHud::m_pLastVehicleName = *(wchar **)0x8E2DD8; -wchar* CHud::m_pVehicleNameToPrint; -wchar* CHud::m_Message = (wchar*)0x72E318; -wchar* CHud::m_PagerMessage = (wchar*)0x878840; +wchar *&CHud::m_pVehicleName = *(wchar **)0x942FB4; +wchar *CHud::m_pLastVehicleName = *(wchar **)0x8E2DD8; +wchar *CHud::m_pVehicleNameToPrint; +wchar *CHud::m_Message = (wchar*)0x72E318; +wchar *CHud::m_PagerMessage = (wchar*)0x878840; bool &CHud::m_Wants_To_Draw_Hud = *(bool*)0x95CD89; bool &CHud::m_Wants_To_Draw_3dMarkers = *(bool*)0x95CD62; wchar(*CHud::m_BigMessage)[128] = (wchar(*)[128])0x664CE0; @@ -82,7 +82,7 @@ char *WeaponFilenames[] = { "bat", "batm", "pistol", - "pistolm", + "pistolm", "uzi", "uzim", "shotgun", @@ -100,14 +100,14 @@ char *WeaponFilenames[] = { "molotov", "molotovm", "grenade", - "grenadem", + "grenadem", "detonator", "detonator_mask", "", "", "", "", - "radardisc", + "radardisc", "radardiscm", "pager", "pagerm", @@ -122,13 +122,14 @@ char *WeaponFilenames[] = { "siteM16", "siteM16m", "siterocket", - "siterocketm" + "siterocketm" }; -RwTexture* gpSniperSightTex = (RwTexture*)0x8F5834; -RwTexture* gpRocketSightTex = (RwTexture*)0x8E2C20; +RwTexture *&gpSniperSightTex = *(RwTexture**)0x8F5834; +RwTexture *&gpRocketSightTex = *(RwTexture**)0x8E2C20; -void CHud::Initialise() { +void CHud::Initialise() +{ ReInitialise(); int HudTXD = CTxdStore::AddTxdSlot("hud"); @@ -147,8 +148,9 @@ void CHud::Initialise() { CTxdStore::PopCurrentTxd(); } -void CHud::Shutdown() { - for (int i = 0; i < 23; ++i) { +void CHud::Shutdown() +{ + for (int i = 0; i < ARRAY_SIZE(WeaponFilenames) / 2; ++i) { Sprites[i].Delete(); } @@ -162,15 +164,18 @@ void CHud::Shutdown() { CTxdStore::RemoveTxdSlot(HudTXD); } -void CHud::SetVehicleName(wchar* name) { +void CHud::SetVehicleName(wchar *name) +{ m_pVehicleName = name; } -void CHud::SetZoneName(wchar* name) { +void CHud::SetZoneName(wchar *name) +{ m_pZoneName = name; } -void CHud::Draw() { +void CHud::Draw() +{ RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); @@ -218,7 +223,7 @@ void CHud::Draw() { RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); float fStep = sin((CTimer::GetTimeInMilliseconds() & 1023) * 0.0061328127); - float fMultBright = CHud::SpriteBrightness * 0.033333335f * (0.25f * fStep + 0.75f); + float fMultBright = CHud::SpriteBrightness * 0.03f * (0.25f * fStep + 0.75f); CRect rect; float fWidescreenOffset[2] = { 0.0f, 0.0f }; @@ -420,8 +425,8 @@ void CHud::Draw() { CFont::SetPropOff(); CFont::SetFontStyle(FONT_HEADING); - if (CHud::m_ItemToFlash == 4 && CTimer::GetFrameCounter() & 8 - || CHud::m_ItemToFlash != 4 + if (CHud::m_ItemToFlash == ITEM_HEALTH && CTimer::GetFrameCounter() & 8 + || CHud::m_ItemToFlash != ITEM_HEALTH || CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fHealth < 10 && CTimer::GetFrameCounter() & 8) { if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fHealth >= 10 @@ -450,7 +455,7 @@ void CHud::Draw() { /* DrawArmour */ - if (CHud::m_ItemToFlash == 3 && CTimer::GetFrameCounter() & 8 || CHud::m_ItemToFlash != 3) { + if (CHud::m_ItemToFlash == ITEM_ARMOUR && CTimer::GetFrameCounter() & 8 || CHud::m_ItemToFlash != ITEM_ARMOUR) { CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f)); if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fArmour > 1.0f) { AsciiToUnicode("[", sPrintIcon); @@ -488,7 +493,7 @@ void CHud::Draw() { AsciiToUnicode("]", sPrintIcon); for (int i = 0; i < 6; i++) { - CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::PrintString(2.0f + HUD_FROM_RIGHT(60.0f - 2.0f + 23.0f * i), HUD_STRETCH_Y(87.0f + 2.0f), sPrintIcon); if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel > i && (CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nLastWantedLevelChange @@ -574,7 +579,7 @@ void CHud::Draw() { if (CMenuManager::m_PrefsLanguage == 4) CFont::SetScale(HUD_STRETCH_X(1.2f * 0.8f), HUD_STRETCH_Y(1.2f)); else - CFont::SetScale(HUD_STRETCH_X(1.2f), HUD_STRETCH_Y(1.2f)); + CFont::SetScale(HUD_STRETCH_X(1.2f), HUD_STRETCH_Y(1.2f)); CFont::SetRightJustifyOn(); CFont::SetRightJustifyWrap(0.0f); @@ -845,7 +850,7 @@ void CHud::Draw() { /* DrawRadar */ - if (CHud::m_ItemToFlash == 8 && CTimer::GetFrameCounter() & 8 || CHud::m_ItemToFlash != 8) { + if (CHud::m_ItemToFlash == ITEM_RADAR && CTimer::GetFrameCounter() & 8 || CHud::m_ItemToFlash != ITEM_RADAR) { CRadar::DrawMap(); CHud::Sprites[HUD_RADARDISC].Draw(CRect(HUD_STRETCH_X(16.0f), HUD_FROM_BOTTOM(123.0f + 4.0f), HUD_STRETCH_X(94.0f + 20.0f + 5.0f), HUD_FROM_BOTTOM(-76.0f + 123.0f - 6.0f)), CRGBA(0, 0, 0, 255)); CRadar::DrawBlips(); @@ -863,87 +868,77 @@ void CHud::Draw() { DrawScriptText */ if (!CTimer::GetIsUserPaused()) { - uint16 CounterA = 0; - uint16 CounterB = 0; CTextLine* IntroText = CTheScripts::IntroTextLines; - do { - if (CTheScripts::IntroTextLines[CounterB].m_awText[0] && CTheScripts::IntroTextLines[CounterB].field_29) { - CFont::SetScale(HUD_STRETCH_X(CTheScripts::IntroTextLines[CounterB].m_fScaleX), HUD_STRETCH_Y(CTheScripts::IntroTextLines[CounterB].m_fScaleY * 0.5f)); - CFont::SetColor(CTheScripts::IntroTextLines[CounterB].m_sColor); + for (int i = 0; i < 2; i++) { + if (CTheScripts::IntroTextLines[i].m_awText[0] && CTheScripts::IntroTextLines[i].field_29) { + CFont::SetScale(HUD_STRETCH_X(CTheScripts::IntroTextLines[i].m_fScaleX), HUD_STRETCH_Y(CTheScripts::IntroTextLines[i].m_fScaleY * 0.5f)); + CFont::SetColor(CTheScripts::IntroTextLines[i].m_sColor); - if (CTheScripts::IntroTextLines[CounterB].m_bJustify) + if (CTheScripts::IntroTextLines[i].m_bJustify) CFont::SetJustifyOn(); else CFont::SetJustifyOff(); - if (CTheScripts::IntroTextLines[CounterB].m_bRightJustify) + if (CTheScripts::IntroTextLines[i].m_bRightJustify) CFont::SetRightJustifyOn(); else CFont::SetRightJustifyOff(); - if (CTheScripts::IntroTextLines[CounterB].m_bCentered) + if (CTheScripts::IntroTextLines[i].m_bCentered) CFont::SetCentreOn(); else CFont::SetCentreOff(); - CFont::SetWrapx(HUD_STRETCH_X(CTheScripts::IntroTextLines[CounterB].m_fWrapX)); - CFont::SetCentreSize(HUD_STRETCH_X(CTheScripts::IntroTextLines[CounterB].m_fCenterSize)); + CFont::SetWrapx(HUD_STRETCH_X(CTheScripts::IntroTextLines[i].m_fWrapX)); + CFont::SetCentreSize(HUD_STRETCH_X(CTheScripts::IntroTextLines[i].m_fCenterSize)); - if (CTheScripts::IntroTextLines[CounterB].m_bBackground) + if (CTheScripts::IntroTextLines[i].m_bBackground) CFont::SetBackgroundOn(); else CFont::SetBackgroundOff(); - CFont::SetBackgroundColor(CTheScripts::IntroTextLines[CounterB].m_sBackgroundColor); + CFont::SetBackgroundColor(CTheScripts::IntroTextLines[i].m_sBackgroundColor); - if (CTheScripts::IntroTextLines[CounterB].m_bBackgroundOnly) + if (CTheScripts::IntroTextLines[i].m_bBackgroundOnly) CFont::SetBackGroundOnlyTextOn(); else CFont::SetBackGroundOnlyTextOff(); - if (CTheScripts::IntroTextLines[CounterB].m_bTextProportional) + if (CTheScripts::IntroTextLines[i].m_bTextProportional) CFont::SetPropOn(); else CFont::SetPropOff(); - CFont::SetFontStyle(CTheScripts::IntroTextLines[CounterB].m_nFont); - CFont::PrintString(HUD_STRETCH_X(640.0f - CTheScripts::IntroTextLines[CounterB].field_36), HUD_STRETCH_Y(448.0f - CTheScripts::IntroTextLines[CounterB].field_40), IntroText->m_awText); + CFont::SetFontStyle(CTheScripts::IntroTextLines[i].m_nFont); + CFont::PrintString(HUD_STRETCH_X(640.0f - CTheScripts::IntroTextLines[i].field_36), HUD_STRETCH_Y(448.0f - CTheScripts::IntroTextLines[i].field_40), IntroText->m_awText); } - ++CounterA; - ++CounterB; - ++IntroText; - } while (CounterA < 2); + } - uint16 CounterC = 0; - uint16 CounterD = 0; CScriptRectangle* IntroRect = CTheScripts::IntroRectangles; - do { - if (CTheScripts::IntroRectangles[CounterD].m_bIsUsed && CTheScripts::IntroRectangles[CounterD].m_bIsAntialiased) { - if (CTheScripts::IntroRectangles[CounterD].m_wTextureId >= 0) { + for (int i = 0; i < 16; i++) { + if (CTheScripts::IntroRectangles[i].m_bIsUsed && CTheScripts::IntroRectangles[i].m_bIsAntialiased) { + if (CTheScripts::IntroRectangles[i].m_wTextureId >= 0) { CRect rect = { - CTheScripts::IntroRectangles[CounterD].m_sRect.left, - CTheScripts::IntroRectangles[CounterD].m_sRect.bottom, - CTheScripts::IntroRectangles[CounterD].m_sRect.right, - CTheScripts::IntroRectangles[CounterD].m_sRect.bottom }; + CTheScripts::IntroRectangles[i].m_sRect.left, + CTheScripts::IntroRectangles[i].m_sRect.bottom, + CTheScripts::IntroRectangles[i].m_sRect.right, + CTheScripts::IntroRectangles[i].m_sRect.bottom }; - CTheScripts::ScriptSprites[CTheScripts::IntroRectangles[CounterD].m_wTextureId].Draw(rect, IntroRect->m_sColor); + CTheScripts::ScriptSprites[CTheScripts::IntroRectangles[i].m_wTextureId].Draw(rect, IntroRect->m_sColor); } else { CRect rect = { - CTheScripts::IntroRectangles[CounterD].m_sRect.left, - CTheScripts::IntroRectangles[CounterD].m_sRect.bottom, - CTheScripts::IntroRectangles[CounterD].m_sRect.right, - CTheScripts::IntroRectangles[CounterD].m_sRect.bottom }; + CTheScripts::IntroRectangles[i].m_sRect.left, + CTheScripts::IntroRectangles[i].m_sRect.bottom, + CTheScripts::IntroRectangles[i].m_sRect.right, + CTheScripts::IntroRectangles[i].m_sRect.bottom }; CSprite2d::DrawRect(rect, IntroRect->m_sColor); } } - ++CounterC; - ++CounterD; - ++IntroRect; - } while (CounterC < 16); + } /* DrawSubtitles @@ -972,8 +967,9 @@ void CHud::Draw() { /* DrawBigMessage */ + // MissionCompleteFailedText if (CHud::m_BigMessage[0][0]) { - if (0.0f == BigMessageInUse[0]) { + if (BigMessageInUse[0] == 0.0f) { CFont::SetJustifyOff(); CFont::SetBackgroundOff(); CFont::SetBackGroundOnlyTextOff(); @@ -983,28 +979,23 @@ void CHud::Draw() { CFont::SetCentreSize(HUD_STRETCH_X(615.0f)); CFont::SetColor(CRGBA(255, 255, 0, 255)); CFont::SetFontStyle(FONT_HEADING); - if ((SCREENW - 20) <= BigMessageX[0]) { - BigMessageInUse[0] = BigMessageInUse[0] + CTimer::GetTimeStep(); - if (BigMessageInUse[0] >= 120.0f) { - BigMessageInUse[0] = 120.0; - BigMessageAlpha[0] = BigMessageAlpha[0] - (CTimer::GetTimeStep() * 0.02f * 1000.0f) * 0.30000001f; - } + + if (BigMessageX[0] >= (SCREENW - 20)) { + BigMessageAlpha[0] += (CTimer::GetTimeStep() * 0.02f * -255.0f); + if (BigMessageAlpha[0] <= 0.0f) { - CHud::m_BigMessage[0][0] = 0; - BigMessageAlpha[0] = 0.0; + BigMessageAlpha[0] = 0.0f; + BigMessageInUse[0] = 1.0f; } } else { - float fStep = (CTimer::GetTimeStep() - * 0.02f - * 1000.0f) - * 0.30000001f; - BigMessageX[0] = BigMessageX[0] + fStep; - BigMessageAlpha[0] = BigMessageAlpha[0] + fStep; - - if (BigMessageAlpha[0] > 255.0f) - BigMessageAlpha[0] = 255.0; + BigMessageX[0] += (CTimer::GetTimeStep() * 0.02f * 255.0f); + BigMessageAlpha[0] += (CTimer::GetTimeStep() * 0.02f * 255.0f); + + if (BigMessageAlpha[0] >= 255.0f) + BigMessageAlpha[0] = 255.0f; } + CFont::SetColor(CRGBA(0, 0, 0, BigMessageAlpha[0])); CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(20.0f - 2.0f), m_BigMessage[0]); @@ -1023,14 +1014,12 @@ void CHud::Draw() { // WastedBustedText if (CHud::m_BigMessage[2][0]) { - if (0 == BigMessageInUse[2]) { - BigMessageAlpha[2] = (CTimer::GetTimeStep() - * 0.02f - * 1000.0f) - * 0.40000001 - + BigMessageAlpha[2]; + if (BigMessageInUse[2] == 0.0f) { + BigMessageAlpha[2] += (CTimer::GetTimeStep() * 0.02f * 1000.0f) * 0.4f; + if (BigMessageAlpha[2] > 255.0f) BigMessageAlpha[2] = 255.0; + CFont::SetBackgroundOff(); if (CGame::frenchGame || CGame::germanGame) @@ -1060,7 +1049,8 @@ void CHud::Draw() { } } -void CHud::DrawAfterFade() { +void CHud::DrawAfterFade() +{ if (CTimer::GetIsUserPaused() || CReplay::Mode == 1) return; @@ -1179,7 +1169,6 @@ void CHud::DrawAfterFade() { CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(84.0f), m_BigMessage[4]); } - // Oddjob result if (OddJob2OffTimer > 0) OddJob2OffTimer = OddJob2OffTimer - (CTimer::GetTimeStep() * 0.02f * 1000.0f); @@ -1256,23 +1245,20 @@ void CHud::DrawAfterFade() { CFont::SetRightJustifyWrap(-500); CFont::SetRightJustifyOn(); CFont::SetFontStyle(FONT_HEADING); - if ((SCREENW - 20) <= BigMessageX[1]) { - BigMessageInUse[1] = BigMessageInUse[1] + CTimer::GetTimeStep(); - if (BigMessageInUse[1] >= 120.0f) { - BigMessageInUse[1] = 120.0; - BigMessageAlpha[1] = BigMessageAlpha[1] - (CTimer::GetTimeStep() * 0.02f * 1000.0f) * 0.3f; - } - if (BigMessageAlpha[1] <= 0) { - m_BigMessage[1][0] = 0; - BigMessageAlpha[1] = 0.0; + if (BigMessageX[1] >= (SCREENW - 20)) { + BigMessageAlpha[1] += (CTimer::GetTimeStep() * 0.02f * -255.0f); + + if (BigMessageAlpha[1] <= 0.0f) { + BigMessageAlpha[1] = 0.0f; + BigMessageInUse[1] = 1.0f; } } else { - float fStep = (CTimer::GetTimeStep() * 0.02f * 1000.0f) * 0.3f; - BigMessageX[1] = BigMessageX[1] + fStep; - BigMessageAlpha[1] = BigMessageAlpha[1] + fStep; - if (BigMessageAlpha[1] > 255.0f) - BigMessageAlpha[1] = 255.0; + BigMessageX[1] += (CTimer::GetTimeStep() * 0.02f * 255.0f); + BigMessageAlpha[1] += (CTimer::GetTimeStep() * 0.02f * 255.0f); + + if (BigMessageAlpha[1] >= 255.0f) + BigMessageAlpha[1] = 255.0f; } CFont::SetColor(CRGBA(40, 40, 40, BigMessageAlpha[1])); CFont::PrintString(HUD_FROM_RIGHT(20.0f - 2.0f), HUD_FROM_BOTTOM(120.0f), m_BigMessage[1]); @@ -1281,13 +1267,13 @@ void CHud::DrawAfterFade() { CFont::PrintString(HUD_FROM_RIGHT(20.0f), HUD_FROM_BOTTOM(120.0f), m_BigMessage[1]); } else { - BigMessageAlpha[1] = 0.0; - BigMessageX[1] = -60.0; - BigMessageInUse[1] = 1.0; + BigMessageAlpha[1] = 0.0f; + BigMessageX[1] = -60.0f; + BigMessageInUse[1] = 1.0f; } } else { - BigMessageInUse[1] = 0.0; + BigMessageInUse[1] = 0.0f; } } diff --git a/src/render/Hud.h b/src/render/Hud.h index 7c06f9e5..c4c43e30 100644 --- a/src/render/Hud.h +++ b/src/render/Hud.h @@ -1,7 +1,15 @@ #pragma once #include "Sprite2d.h" -enum eSprites { +enum eItems +{ + ITEM_ARMOUR = 3, + ITEM_HEALTH = 4, + ITEM_RADAR = 8 +}; + +enum eSprites +{ HUD_FIST, HUD_BAT, HUD_PISTOL, @@ -21,7 +29,8 @@ enum eSprites { HUD_SITEM16 = 21 }; -class CHud { +class CHud +{ public: static CSprite2d *Sprites; @@ -38,23 +47,23 @@ public: static int32 m_ZoneState; static int32 m_ZoneFadeTimer; static int32 m_ZoneNameTimer; - static wchar* &m_pZoneName; - static wchar* m_pLastZoneName; - static wchar* m_ZoneToPrint; - static wchar* &m_pVehicleName; - static wchar* m_pLastVehicleName; - static wchar* m_pVehicleNameToPrint; + static wchar *&m_pZoneName; + static wchar *m_pLastZoneName; + static wchar *m_ZoneToPrint; + static wchar *&m_pVehicleName; + static wchar *m_pLastVehicleName; + static wchar *m_pVehicleNameToPrint; static int32 m_VehicleState; static int32 m_VehicleFadeTimer; static int32 m_VehicleNameTimer; - static wchar* m_Message; - static wchar* m_PagerMessage; + static wchar *m_Message; + static wchar *m_PagerMessage; static bool &m_Wants_To_Draw_Hud; static bool &m_Wants_To_Draw_3dMarkers; static wchar(*m_BigMessage)[128]; - static float* BigMessageInUse; - static float* BigMessageAlpha; - static float* BigMessageX; + static float *BigMessageInUse; + static float *BigMessageAlpha; + static float *BigMessageX; static float &OddJob2OffTimer; static int8 &CounterOnLastFrame; static float &OddJob2XOffset; @@ -75,12 +84,12 @@ public: static void Shutdown(); static void ReInitialise(); static void GetRidOfAllHudMessages(); - static void SetZoneName(wchar* name); - static void SetHelpMessage(wchar* message, bool quick); - static void SetVehicleName(wchar* name); + static void SetZoneName(wchar *name); + static void SetHelpMessage(wchar *message, bool quick); + static void SetVehicleName(wchar *name); static void Draw(); static void DrawAfterFade(); - static void SetMessage(wchar* message); - static void SetBigMessage(wchar* message, int16 style); - static void SetPagerMessage(wchar* message); -}; \ No newline at end of file + static void SetMessage(wchar *message); + static void SetBigMessage(wchar *message, int16 style); + static void SetPagerMessage(wchar *message); +}; -- cgit v1.2.3