From f85b5e99edfb2e1b9a4563cacc96892195eee379 Mon Sep 17 00:00:00 2001 From: erorcun Date: Sat, 16 Jan 2021 16:44:59 +0300 Subject: Includes overhaul, fix some compiler warnings --- src/core/ControllerConfig.cpp | 8 ++------ src/core/Frontend.cpp | 6 +----- src/core/Game.cpp | 5 ----- src/core/Lists.h | 2 -- src/core/Pad.cpp | 9 +-------- src/core/PlayerInfo.h | 2 +- src/core/World.cpp | 5 ----- src/core/World.h | 6 +----- src/core/Zones.h | 4 ++-- src/core/common.h | 39 ++++++++++++++++++++++++--------------- src/core/re3.cpp | 5 ++++- 11 files changed, 36 insertions(+), 55 deletions(-) (limited to 'src/core') diff --git a/src/core/ControllerConfig.cpp b/src/core/ControllerConfig.cpp index eea1f6f0..585eac4e 100644 --- a/src/core/ControllerConfig.cpp +++ b/src/core/ControllerConfig.cpp @@ -1,11 +1,7 @@ -#if defined RW_D3D9 || defined RWLIBS -#define DIRECTINPUT_VERSION 0x0800 -#include -#endif - +#define WITHDINPUT #include "common.h" #include "platform.h" -#include "crossplatform.h" // for Windows version +#include "crossplatform.h" #include "ControllerConfig.h" #include "Pad.h" #include "FileMgr.h" diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index f8945d98..086a9887 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -1,10 +1,6 @@ -#if defined RW_D3D9 || defined RWLIBS -#define DIRECTINPUT_VERSION 0x0800 -#include -#endif - #define FORCE_PC_SCALING #define WITHWINDOWS +#define WITHDINPUT #include "common.h" #ifndef PS2_MENU #include "crossplatform.h" diff --git a/src/core/Game.cpp b/src/core/Game.cpp index c407bbe8..83d30bb4 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -1,6 +1,3 @@ -#pragma warning( push ) -#pragma warning( disable : 4005) -#pragma warning( pop ) #include "common.h" #include "platform.h" @@ -10,7 +7,6 @@ #include "Accident.h" #include "Antennas.h" #include "Bridge.h" -#include "Camera.h" #include "CarCtrl.h" #include "CarGen.h" #include "CdStream.h" @@ -69,7 +65,6 @@ #include "Skidmarks.h" #include "SetPieces.h" #include "SpecialFX.h" -#include "Sprite2d.h" #include "Stats.h" #include "Streaming.h" #include "SurfaceTable.h" diff --git a/src/core/Lists.h b/src/core/Lists.h index ecf24740..7572e882 100644 --- a/src/core/Lists.h +++ b/src/core/Lists.h @@ -1,7 +1,5 @@ #pragma once -#include "common.h" - class CPtrNode { public: diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index 60ff3555..671a4552 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -1,11 +1,4 @@ -#pragma warning( push ) -#pragma warning( disable : 4005) -#if defined RW_D3D9 || defined RWLIBS -#define DIRECTINPUT_VERSION 0x0800 -#include -#endif -#pragma warning( pop ) - +#define WITHDINPUT #include "common.h" #include "crossplatform.h" #include "platform.h" diff --git a/src/core/PlayerInfo.h b/src/core/PlayerInfo.h index a3896ebb..a24185f0 100644 --- a/src/core/PlayerInfo.h +++ b/src/core/PlayerInfo.h @@ -1,6 +1,6 @@ #pragma once -#include "Collision.h" +#include "ColModel.h" enum eWastedBustedState { diff --git a/src/core/World.cpp b/src/core/World.cpp index f7d2a28b..bc698c83 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -4,7 +4,6 @@ #include "CopPed.h" #include "CutsceneMgr.h" #include "DMAudio.h" -#include "Entity.h" #include "EventList.h" #include "Explosion.h" #include "Fire.h" @@ -12,11 +11,8 @@ #include "Glass.h" #include "Messages.h" #include "ModelIndices.h" -#include "Object.h" #include "ParticleObject.h" -#include "Ped.h" #include "Pickups.h" -#include "PlayerPed.h" #include "Population.h" #include "ProjectileInfo.h" #include "Record.h" @@ -25,7 +21,6 @@ #include "RpAnimBlend.h" #include "Shadows.h" #include "TempColModels.h" -#include "Vehicle.h" #include "WaterLevel.h" #include "World.h" diff --git a/src/core/World.h b/src/core/World.h index 59bf634c..81eb5d4c 100644 --- a/src/core/World.h +++ b/src/core/World.h @@ -3,6 +3,7 @@ #include "Game.h" #include "Lists.h" #include "PlayerInfo.h" +#include "Collision.h" /* Sectors span from -2400 to 1600 in x and -2000 to 2000 y. * With 80x80 sectors, each is 50x50 units. */ @@ -48,11 +49,6 @@ public: VALIDATE_SIZE(CSector, 0x28); -class CEntity; -struct CColPoint; -struct CColLine; -struct CStoredCollPoly; - class CWorld { static CPtrList ms_bigBuildingsList[NUM_LEVELS]; diff --git a/src/core/Zones.h b/src/core/Zones.h index 5306d9f1..b987f009 100644 --- a/src/core/Zones.h +++ b/src/core/Zones.h @@ -103,8 +103,8 @@ public: static void SetPedDensity(uint16 zoneid, uint8 day, uint16 peddensity); static void SetPedGroup(uint16 zoneid, uint8 day, uint16 pedgroup); static int16 FindAudioZone(CVector *pos); - static CZone *GetPointerForZoneIndex(int32 i) { return i == -1 ? nil : &NavigationZoneArray[i]; } - static int32 GetIndexForZonePointer(CZone *zone) { return zone == nil ? -1 : zone - NavigationZoneArray; } + static CZone *GetPointerForZoneIndex(ssize_t i) { return i == -1 ? nil : &NavigationZoneArray[i]; } + static ssize_t GetIndexForZonePointer(CZone *zone) { return zone == nil ? -1 : zone - NavigationZoneArray; } static void AddZoneToAudioZoneArray(CZone *zone); static void InitialiseAudioZoneArray(void); static void SaveAllZones(uint8 *buffer, uint32 *length); diff --git a/src/core/common.h b/src/core/common.h index 2391f5fb..7fdbdf69 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -11,17 +11,34 @@ #include #include -#if defined _WIN32 && defined WITHWINDOWS -#include +#if !defined RW_D3D9 && defined LIBRW +#undef WITHD3D +#undef WITHDINPUT +#endif + +#if (defined WITHD3D && !defined LIBRW) +#define WITHWINDOWS #endif -#if defined _WIN32 && defined WITHD3D +#if defined _WIN32 && defined WITHWINDOWS && !defined _INC_WINDOWS #include -#ifndef USE_D3D9 -#include -#else -#include #endif + +#ifdef WITHD3D + #ifdef LIBRW + #define WITH_D3D // librw includes d3d9 itself via this right now + #else + #ifndef USE_D3D9 + #include + #else + #include + #endif + #endif +#endif + +#ifdef WITHDINPUT +#define DIRECTINPUT_VERSION 0x0800 +#include #endif #include @@ -52,14 +69,6 @@ #define rwVENDORID_ROCKSTAR 0x0253F2 -// Get rid of bullshit windows definitions, we're not running on an 8086 -#ifdef far -#undef far -#endif -#ifdef near -#undef near -#endif - #define Max(a,b) ((a) > (b) ? (a) : (b)) #define Min(a,b) ((a) < (b) ? (a) : (b)) diff --git a/src/core/re3.cpp b/src/core/re3.cpp index 80e8cb6b..7b3ab10c 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -1,7 +1,6 @@ #include #define WITHWINDOWS #include "common.h" -#include "crossplatform.h" #include "Renderer.h" #include "Occlusion.h" #include "Credits.h" @@ -39,6 +38,10 @@ #include "ControllerConfig.h" #endif +#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS +#include "crossplatform.h" +#endif + #ifndef _WIN32 #include "assert.h" #include -- cgit v1.2.3