@@ -101,21 +101,6 @@ void CClientDFF::UnloadDFF()
101101
102102bool CClientDFF::ReplaceModel (unsigned short usModel, bool bAlphaTransparency)
103103{
104- if (usModel >= CLOTHES_MODEL_ID_FIRST && usModel <= CLOTHES_MODEL_ID_LAST)
105- {
106- if (m_RawDataBuffer.empty () && m_bIsRawData)
107- return false ;
108-
109- if (m_RawDataBuffer.empty ())
110- {
111- if (!FileLoad (std::nothrow, m_strDffFilename, m_RawDataBuffer))
112- return false ;
113- }
114-
115- g_pGame->GetRenderWare ()->ClothesAddReplacement (m_RawDataBuffer.data (), usModel - CLOTHES_MODEL_ID_FIRST);
116- return true ;
117- }
118-
119104 // Record attempt in case it all goes wrong
120105 CArgMap argMap;
121106 argMap.Set (" id" , usModel);
@@ -154,6 +139,9 @@ bool CClientDFF::DoReplaceModel(unsigned short usModel, bool bAlphaTransparency)
154139 if (!CClientDFFManager::IsReplacableModel (usModel))
155140 return false ;
156141
142+ if (CClientPlayerClothes::IsValidModel (usModel))
143+ return ReplaceClothes (usModel);
144+
157145 // Get clump loaded for this model id
158146 RpClump* pClump = GetLoadedClump (usModel);
159147
@@ -246,7 +234,6 @@ void CClientDFF::RestoreModels()
246234
247235 // Clear the list
248236 m_Replaced.clear ();
249- g_pGame->GetRenderWare ()->ClothesRemoveReplacement (m_RawDataBuffer.data ());
250237}
251238
252239void CClientDFF::InternalRestoreModel (unsigned short usModel)
@@ -284,6 +271,12 @@ void CClientDFF::InternalRestoreModel(unsigned short usModel)
284271 m_pManager->GetObjectManager ()->RestreamObjects (usModel);
285272 g_pGame->GetModelInfo (usModel)->RestreamIPL ();
286273 }
274+ // Is This a clothe ID?
275+ else if (CClientPlayerClothes::IsValidModel (usModel))
276+ {
277+ g_pGame->GetRenderWare ()->ClothesRemoveReplacement (m_RawDataBuffer.data ());
278+ return ;
279+ }
287280 else
288281 return ;
289282
@@ -312,6 +305,22 @@ void CClientDFF::InternalRestoreModel(unsigned short usModel)
312305 }
313306}
314307
308+ bool CClientDFF::ReplaceClothes (ushort usModel)
309+ {
310+ if (m_RawDataBuffer.empty () && m_bIsRawData)
311+ return false ;
312+
313+ if (m_RawDataBuffer.empty ())
314+ {
315+ if (!FileLoad (std::nothrow, m_strDffFilename, m_RawDataBuffer))
316+ return false ;
317+ }
318+
319+ m_Replaced.push_back (usModel);
320+ g_pGame->GetRenderWare ()->ClothesAddReplacement (m_RawDataBuffer.data (), usModel - CLOTHES_MODEL_ID_FIRST);
321+ return true ;
322+ }
323+
315324bool CClientDFF::ReplaceObjectModel (RpClump* pClump, ushort usModel, bool bAlphaTransparency)
316325{
317326 // Stream out all the object models with matching ID.
0 commit comments