From b44df26d3ea5fcdaf6d954016303f358d2c64b79 Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 5 May 2020 13:02:42 +0200 Subject: implemented most of streamed collisions and big buildings --- src/core/Streaming.h | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) (limited to 'src/core/Streaming.h') diff --git a/src/core/Streaming.h b/src/core/Streaming.h index cf8790e9..d2920824 100644 --- a/src/core/Streaming.h +++ b/src/core/Streaming.h @@ -3,9 +3,13 @@ #include "Game.h" enum { - STREAM_OFFSET_MODEL = 0, - STREAM_OFFSET_TXD = STREAM_OFFSET_MODEL+MODELINFOSIZE, + STREAM_OFFSET_TXD = MODELINFOSIZE, +#ifndef MIAMI NUMSTREAMINFO = STREAM_OFFSET_TXD+TXDSTORESIZE +#else + STREAM_OFFSET_COL = STREAM_OFFSET_TXD+TXDSTORESIZE, + NUMSTREAMINFO = STREAM_OFFSET_COL+COLSTORESIZE +#endif }; enum StreamFlags @@ -15,9 +19,11 @@ enum StreamFlags STREAMFLAGS_DEPENDENCY = 0x04, // Is this right? STREAMFLAGS_PRIORITY = 0x08, STREAMFLAGS_NOFADE = 0x10, +#ifdef MIAMI + STREAMFLAGS_20 = 0x20, +#endif - // TODO: this isn't named well, maybe CANT_REMOVE? - STREAMFLAGS_NOT_IN_LIST = STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_SCRIPTOWNED, + STREAMFLAGS_CANT_REMOVE = STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_SCRIPTOWNED, STREAMFLAGS_KEEP_IN_MEMORY = STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_SCRIPTOWNED|STREAMFLAGS_DEPENDENCY, }; @@ -96,7 +102,9 @@ public: static int32 ms_lastVehicleDeleted; static CDirectory *ms_pExtraObjectsDir; static int32 ms_numPriorityRequests; +#ifndef MIAMI static bool ms_hasLoadedLODs; +#endif static int32 ms_currentPedGrp; static int32 ms_lastCullZone; static uint16 ms_loadedGangs; @@ -108,6 +116,7 @@ public: static uint32 ms_memoryAvailable; static void Init(void); + static void Init2(void); static void Shutdown(void); static void Update(void); static void LoadCdDirectory(void); @@ -115,12 +124,29 @@ public: static bool ConvertBufferToObject(int8 *buf, int32 streamId); static bool FinishLoadingLargeFile(int8 *buf, int32 streamId); static bool HasModelLoaded(int32 id) { return ms_aInfoForModel[id].m_loadState == STREAMSTATE_LOADED; } + static bool HasTxdLoaded(int32 id) { return HasModelLoaded(id+STREAM_OFFSET_TXD); } +#ifdef MIAMI + static bool HasColLoaded(int32 id) { return HasModelLoaded(id+STREAM_OFFSET_COL); } +#endif + static bool CanRemoveModel(int32 id) { return (ms_aInfoForModel[id].m_flags & STREAMFLAGS_CANT_REMOVE) == 0; } + static bool CanRemoveTxd(int32 id) { return CanRemoveModel(id+STREAM_OFFSET_TXD); } +#ifdef MIAMI + static bool CanRemoveCol(int32 id) { return CanRemoveModel(id+STREAM_OFFSET_COL); } +#endif static void RequestModel(int32 model, int32 flags); static void ReRequestModel(int32 model) { RequestModel(model, ms_aInfoForModel[model].m_flags); } static void RequestTxd(int32 txd, int32 flags) { RequestModel(txd + STREAM_OFFSET_TXD, flags); } static void ReRequestTxd(int32 txd) { ReRequestModel(txd + STREAM_OFFSET_TXD); } +#ifdef MIAMI + static void RequestCol(int32 col, int32 flags) { RequestModel(col + STREAM_OFFSET_COL, flags); } + static void ReRequestCol(int32 col) { ReRequestModel(col + STREAM_OFFSET_COL); } +#endif static void RequestSubway(void); static void RequestBigBuildings(eLevelName level); +#ifdef MIAMI + static void RequestBigBuildings(eLevelName level, const CVector &pos); + static void InstanceBigBuildings(eLevelName level, const CVector &pos); +#endif static void RequestIslands(eLevelName level); static void RequestSpecialModel(int32 modelId, const char *modelName, int32 flags); static void RequestSpecialChar(int32 charId, const char *modelName, int32 flags); @@ -129,6 +155,9 @@ public: static void DecrementRef(int32 id); static void RemoveModel(int32 id); static void RemoveTxd(int32 id) { RemoveModel(id + STREAM_OFFSET_TXD); } +#ifdef MIAMI + static void RemoveCol(int32 id) { RemoveModel(id + STREAM_OFFSET_COL); } +#endif static void RemoveUnusedBuildings(eLevelName level); static void RemoveBuildings(eLevelName level); static void RemoveUnusedBigBuildings(eLevelName level); @@ -143,7 +172,9 @@ public: static bool IsTxdUsedByRequestedModels(int32 txdId); static bool AddToLoadedVehiclesList(int32 modelId); static bool IsObjectInCdImage(int32 id); +#ifndef MIAMI static void HaveAllBigBuildingsLoaded(eLevelName level); +#endif static void SetModelIsDeletable(int32 id); static void SetModelTxdIsDeletable(int32 id); static void SetMissionDoesntRequireModel(int32 id); @@ -152,6 +183,9 @@ public: static void StreamVehiclesAndPeds(void); static void StreamZoneModels(const CVector &pos); static void RemoveCurrentZonesModels(void); +#ifdef MIAMI + static void LoadBigBuildingsWhenNeeded(void); +#endif static int32 GetCdImageOffset(int32 lastPosn); static int32 GetNextFileOnCd(int32 position, bool priority); -- cgit v1.2.3