diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2020-05-08 16:06:25 +0200 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2020-05-08 16:06:25 +0200 |
commit | 756e4dd068e27b25c651e85781871295131b7ada (patch) | |
tree | f2975fd92f2bf57b07f924ff244b5a9ffd6cd4b2 /src/core | |
parent | fix (diff) | |
parent | most of animation system done; little stuff here and there (diff) | |
download | re3-756e4dd068e27b25c651e85781871295131b7ada.tar re3-756e4dd068e27b25c651e85781871295131b7ada.tar.gz re3-756e4dd068e27b25c651e85781871295131b7ada.tar.bz2 re3-756e4dd068e27b25c651e85781871295131b7ada.tar.lz re3-756e4dd068e27b25c651e85781871295131b7ada.tar.xz re3-756e4dd068e27b25c651e85781871295131b7ada.tar.zst re3-756e4dd068e27b25c651e85781871295131b7ada.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/Camera.cpp | 9 | ||||
-rw-r--r-- | src/core/ColStore.cpp | 3 | ||||
-rw-r--r-- | src/core/ColStore.h | 2 | ||||
-rw-r--r-- | src/core/Streaming.cpp | 16 | ||||
-rw-r--r-- | src/core/Streaming.h | 10 | ||||
-rw-r--r-- | src/core/common.h | 1 | ||||
-rw-r--r-- | src/core/config.h | 3 |
7 files changed, 23 insertions, 21 deletions
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index 8579dc64..73bbd75e 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -1529,7 +1529,6 @@ CCamera::UpdateTargetEntity(void) pTargetEntity = FindPlayerVehicle(); else{ pTargetEntity = FindPlayerPed(); -#ifndef GTA_PS2_STUFF // this keeps the camera on the player while entering cars if(PLAYER->GetPedState() == PED_ENTER_CAR || PLAYER->GetPedState() == PED_CARJACK || @@ -1539,7 +1538,6 @@ CCamera::UpdateTargetEntity(void) if(!enteringCar) if(Cams[ActiveCam].CamTargetEntity != pTargetEntity) Cams[ActiveCam].CamTargetEntity = pTargetEntity; -#endif } bool cantOpen = true; @@ -1558,16 +1556,9 @@ CCamera::UpdateTargetEntity(void) if((PLAYER->GetPedState() == PED_CARJACK || PLAYER->GetPedState() == PED_OPEN_DOOR) && !cantOpen){ if(!enteringCar && CarZoomIndicator != CAM_ZOOM_1STPRS) -#ifdef GTA_PS2_STUFF -// dunno if this has any amazing effects - { -#endif pTargetEntity = PLAYER->m_pMyVehicle; if(PLAYER->m_pMyVehicle == nil) pTargetEntity = PLAYER; -#ifdef GTA_PS2_STUFF - } -#endif } if(PLAYER->GetPedState() == PED_EXIT_CAR) diff --git a/src/core/ColStore.cpp b/src/core/ColStore.cpp index d4d17056..80bbdc77 100644 --- a/src/core/ColStore.cpp +++ b/src/core/ColStore.cpp @@ -39,7 +39,7 @@ CColStore::AddColSlot(const char *name) ColDef *def = ms_pColPool->New(); assert(def); def->isLoaded = false; - def->a = 0; + def->unused = 0; def->bounds.left = 1000000.0f; def->bounds.top = 1000000.0f; def->bounds.right = -1000000.0f; @@ -133,6 +133,7 @@ CColStore::LoadAllCollision(void) for(i = 1; i < COLSTORESIZE; i++) if(GetSlot(i)) CStreaming::RequestCol(i, 0); + CStreaming::LoadAllRequestedModels(false); } diff --git a/src/core/ColStore.h b/src/core/ColStore.h index 0d686ffd..8e2a3a70 100644 --- a/src/core/ColStore.h +++ b/src/core/ColStore.h @@ -3,7 +3,7 @@ #include "templates.h" struct ColDef { // made up name - int32 a; + int32 unused; bool isLoaded; CRect bounds; char name[20]; diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index e989ad85..6620065c 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -358,7 +358,7 @@ CStreaming::LoadCdDirectory(const char *dirname, int n) *dot = '\0'; - if(!CGeneral::faststricmp(dot+1, "DFF")){ + if(strncasecmp(dot+1, "DFF", 3) == 0){ if(CModelInfo::GetModelInfo(direntry.name, &modelId)){ bAddToStreaming = true; }else{ @@ -370,13 +370,13 @@ CStreaming::LoadCdDirectory(const char *dirname, int n) #endif lastID = -1; } - }else if(!CGeneral::faststricmp(dot+1, "TXD")){ + }else if(strncasecmp(dot+1, "TXD", 3) == 0){ modelId = CTxdStore::FindTxdSlot(direntry.name); if(modelId == -1) modelId = CTxdStore::AddTxdSlot(direntry.name); modelId += STREAM_OFFSET_TXD; bAddToStreaming = true; - }else if(!CGeneral::faststricmp(dot+1, "COL")){ + }else if(strncasecmp(dot+1, "COL", 3) == 0){ modelId = CColStore::FindColSlot(direntry.name); if(modelId == -1) modelId = CColStore::AddColSlot(direntry.name); @@ -413,7 +413,7 @@ GetObjectName(int streamId) sprintf(objname, "%s.dff", CModelInfo::GetModelInfo(streamId)->GetName()); else if(streamId >= STREAM_OFFSET_TXD && streamId < STREAM_OFFSET_COL) sprintf(objname, "%s.txd", CTxdStore::GetTxdName(streamId-STREAM_OFFSET_TXD)); - else if(streamId >= STREAM_OFFSET_COL && streamId < NUMSTREAMINFO) + else if(streamId >= STREAM_OFFSET_COL && streamId < STREAM_OFFSET_ANIM) sprintf(objname, "%s.col", CColStore::GetColName(streamId-STREAM_OFFSET_COL)); // TODO(MIAMI): IFP return objname; @@ -506,7 +506,7 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId) RwStreamClose(stream, &mem); return false; } - }else if(streamId >= STREAM_OFFSET_COL && streamId < NUMSTREAMINFO){ + }else if(streamId >= STREAM_OFFSET_COL && streamId < STREAM_OFFSET_ANIM){ if(!CColStore::LoadCol(streamId-STREAM_OFFSET_COL, mem.start, mem.length)){ debug("Failed to load %s.col\n", CColStore::GetColName(streamId - STREAM_OFFSET_COL)); RemoveModel(streamId); @@ -514,6 +514,8 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId) RwStreamClose(stream, &mem); return false; } + }else if(streamId >= STREAM_OFFSET_ANIM){ + assert(streamId < NUMSTREAMINFO); // TODO(MIAMI): IFP } @@ -829,7 +831,7 @@ CStreaming::RemoveModel(int32 id) CModelInfo::GetModelInfo(id)->DeleteRwObject(); else if(id >= STREAM_OFFSET_TXD && id < STREAM_OFFSET_COL) CTxdStore::RemoveTxd(id - STREAM_OFFSET_TXD); - else if(id >= STREAM_OFFSET_COL && id < NUMSTREAMINFO) + else if(id >= STREAM_OFFSET_COL && id < STREAM_OFFSET_ANIM) CColStore::RemoveCol(id - STREAM_OFFSET_COL); // TODO(MIAMI): IFP ms_memoryUsed -= ms_aInfoForModel[id].GetCdSize()*CDSTREAM_SECTOR_SIZE; @@ -854,7 +856,7 @@ CStreaming::RemoveModel(int32 id) RpClumpGtaCancelStream(); else if(id >= STREAM_OFFSET_TXD && id < STREAM_OFFSET_COL) CTxdStore::RemoveTxd(id - STREAM_OFFSET_TXD); - else if(id >= STREAM_OFFSET_COL && id < NUMSTREAMINFO) + else if(id >= STREAM_OFFSET_COL && id < STREAM_OFFSET_ANIM) CColStore::RemoveCol(id - STREAM_OFFSET_COL); // TODO(MIAMI): IFP } diff --git a/src/core/Streaming.h b/src/core/Streaming.h index b9c7c8e0..29708250 100644 --- a/src/core/Streaming.h +++ b/src/core/Streaming.h @@ -5,7 +5,8 @@ enum { STREAM_OFFSET_TXD = MODELINFOSIZE, STREAM_OFFSET_COL = STREAM_OFFSET_TXD+TXDSTORESIZE, - NUMSTREAMINFO = STREAM_OFFSET_COL+COLSTORESIZE + STREAM_OFFSET_ANIM = STREAM_OFFSET_COL+COLSTORESIZE, + NUMSTREAMINFO = STREAM_OFFSET_ANIM+NUMANIMBLOCKS }; enum StreamFlags @@ -118,16 +119,19 @@ public: static bool HasModelLoaded(int32 id) { return ms_aInfoForModel[id].m_loadState == STREAMSTATE_LOADED; } static bool HasTxdLoaded(int32 id) { return HasModelLoaded(id+STREAM_OFFSET_TXD); } static bool HasColLoaded(int32 id) { return HasModelLoaded(id+STREAM_OFFSET_COL); } + static bool HasAnimLoaded(int32 id) { return HasModelLoaded(id+STREAM_OFFSET_ANIM); } 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); } static bool CanRemoveCol(int32 id) { return CanRemoveModel(id+STREAM_OFFSET_COL); } + static bool CanRemoveAnim(int32 id) { return CanRemoveModel(id+STREAM_OFFSET_ANIM); } 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); } static void RequestCol(int32 col, int32 flags) { RequestModel(col + STREAM_OFFSET_COL, flags); } static void ReRequestCol(int32 col) { ReRequestModel(col + STREAM_OFFSET_COL); } - static void RequestSubway(void); + static void RequestAnim(int32 col, int32 flags) { RequestModel(col + STREAM_OFFSET_ANIM, flags); } + static void ReRequestAnim(int32 col) { ReRequestModel(col + STREAM_OFFSET_ANIM); } static void RequestBigBuildings(eLevelName level); static void RequestBigBuildings(eLevelName level, const CVector &pos); static void InstanceBigBuildings(eLevelName level, const CVector &pos); @@ -140,6 +144,7 @@ public: static void RemoveModel(int32 id); static void RemoveTxd(int32 id) { RemoveModel(id + STREAM_OFFSET_TXD); } static void RemoveCol(int32 id) { RemoveModel(id + STREAM_OFFSET_COL); } + static void RemoveAnim(int32 id) { RemoveModel(id + STREAM_OFFSET_ANIM); } static void RemoveUnusedBuildings(eLevelName level); static void RemoveBuildings(eLevelName level); static void RemoveUnusedBigBuildings(eLevelName level); @@ -149,7 +154,6 @@ public: static bool RemoveLeastUsedModel(uint32 excludeMask); static void RemoveAllUnusedModels(void); static void RemoveUnusedModelsInLoadedList(void); - static bool RemoveReferencedTxds(int32 mem); static int32 GetAvailableVehicleSlot(void); static bool IsTxdUsedByRequestedModels(int32 txdId); static bool AddToLoadedVehiclesList(int32 modelId); diff --git a/src/core/common.h b/src/core/common.h index ff8580a1..8f400a46 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -187,6 +187,7 @@ public: #if (defined(_MSC_VER)) extern int strcasecmp(const char *str1, const char *str2); +extern int strncasecmp(const char *str1, const char *str2, size_t len); #endif #define clamp(v, low, high) ((v)<(low) ? (low) : (v)>(high) ? (high) : (v)) diff --git a/src/core/config.h b/src/core/config.h index 940d06db..29a73f33 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -38,6 +38,9 @@ enum Config { NUMCUTSCENEOBJECTS = 50, // does not exist in VC // TODO(MIAMI): colmodel pool + NUMANIMBLOCKS = 35, + NUMANIMATIONS = 450, + NUMTEMPOBJECTS = 30, // Path data |