summaryrefslogtreecommitdiffstats
path: root/src/core/Streaming.cpp
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-05-08 20:58:40 +0200
committeraap <aap@papnet.eu>2020-05-08 20:58:40 +0200
commitf12e76fa135db3ca0a98c441cc3f5c0a4a14549d (patch)
tree29774d79de544892972dd8b1e31b5404353dd1ca /src/core/Streaming.cpp
parentsmall fixes (diff)
downloadre3-f12e76fa135db3ca0a98c441cc3f5c0a4a14549d.tar
re3-f12e76fa135db3ca0a98c441cc3f5c0a4a14549d.tar.gz
re3-f12e76fa135db3ca0a98c441cc3f5c0a4a14549d.tar.bz2
re3-f12e76fa135db3ca0a98c441cc3f5c0a4a14549d.tar.lz
re3-f12e76fa135db3ca0a98c441cc3f5c0a4a14549d.tar.xz
re3-f12e76fa135db3ca0a98c441cc3f5c0a4a14549d.tar.zst
re3-f12e76fa135db3ca0a98c441cc3f5c0a4a14549d.zip
Diffstat (limited to 'src/core/Streaming.cpp')
-rw-r--r--src/core/Streaming.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index 5aa419b1..f24192ef 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -1493,12 +1493,14 @@ CStreaming::GetCdImageOffset(int32 lastPosn)
}
inline bool
-TxdAvailable(int32 txdId)
+ModelNotLoaded(int32 modelId)
{
- CStreamingInfo *si = &CStreaming::ms_aInfoForModel[txdId + STREAM_OFFSET_TXD];
- return si->m_loadState == STREAMSTATE_LOADED || si->m_loadState == STREAMSTATE_READING;
+ CStreamingInfo *si = &CStreaming::ms_aInfoForModel[modelId];
+ return si->m_loadState != STREAMSTATE_LOADED && si->m_loadState != STREAMSTATE_READING;
}
+inline bool TxdNotLoaded(int32 txdId) { return ModelNotLoaded(txdId + STREAM_OFFSET_TXD); }
+
// Find stream id of next requested file in cdimage
int32
CStreaming::GetNextFileOnCd(int32 lastPosn, bool priority)
@@ -1523,10 +1525,15 @@ CStreaming::GetNextFileOnCd(int32 lastPosn, bool priority)
continue;
// request Txd if necessary
- if(streamId < STREAM_OFFSET_TXD &&
- !TxdAvailable(CModelInfo::GetModelInfo(streamId)->GetTxdSlot())){
- ReRequestTxd(CModelInfo::GetModelInfo(streamId)->GetTxdSlot());
- }else if(ms_aInfoForModel[streamId].GetCdPosnAndSize(posn, size)){
+ if(streamId < STREAM_OFFSET_TXD){
+ int txdId = CModelInfo::GetModelInfo(streamId)->GetTxdSlot();
+ if(TxdNotLoaded(txdId)){
+ ReRequestTxd(txdId);
+ continue;
+ }
+ }
+
+ if(ms_aInfoForModel[streamId].GetCdPosnAndSize(posn, size)){
if(posn < posnFirst){
// find first requested file in image
streamIdFirst = streamId;
@@ -1624,7 +1631,7 @@ CStreaming::RequestModelStream(int32 ch)
if(streamId < STREAM_OFFSET_TXD){
if (havePed && CModelInfo::GetModelInfo(streamId)->GetModelType() == MITYPE_PED ||
haveBigFile && CModelInfo::GetModelInfo(streamId)->GetModelType() == MITYPE_VEHICLE ||
- !TxdAvailable(CModelInfo::GetModelInfo(streamId)->GetTxdSlot()))
+ TxdNotLoaded(CModelInfo::GetModelInfo(streamId)->GetTxdSlot()))
break;
}else{
if(haveBigFile && size > 200)