-
-
Notifications
You must be signed in to change notification settings - Fork 446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds replacement CJ clothing models #3967
base: master
Are you sure you want to change the base?
Adds replacement CJ clothing models #3967
Conversation
@@ -101,6 +101,21 @@ void CClientDFF::UnloadDFF() | |||
|
|||
bool CClientDFF::ReplaceModel(unsigned short usModel, bool bAlphaTransparency) | |||
{ | |||
if (usModel >= CLOTHES_MODEL_ID_FIRST && usModel <= CLOTHES_MODEL_ID_LAST) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add CPlayerClothes::IsValidClothingModelId
for this check
if (usModel >= CLOTHES_MODEL_ID_FIRST && usModel <= CLOTHES_MODEL_ID_LAST) | ||
{ | ||
if (m_RawDataBuffer.empty() && m_bIsRawData) | ||
return false; | ||
|
||
if (m_RawDataBuffer.empty()) | ||
{ | ||
if (!FileLoad(std::nothrow, m_strDffFilename, m_RawDataBuffer)) | ||
return false; | ||
} | ||
|
||
g_pGame->GetRenderWare()->ClothesAddReplacement(m_RawDataBuffer.data(), usModel - CLOTHES_MODEL_ID_FIRST); | ||
return true; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract this method as ReplaceClothes(uint32_t model)
Call it in DoReplaceModel
if (CPlayerClothes::IsValidClothingModelId(usModel))
{
return ReplaceClothes(usModel);
}
@@ -231,6 +246,7 @@ void CClientDFF::RestoreModels() | |||
|
|||
// Clear the list | |||
m_Replaced.clear(); | |||
g_pGame->GetRenderWare()->ClothesRemoveReplacement(m_RawDataBuffer.data()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move it into InternalRestoreModel
as
else if (CPlayerClothes::IsValidClothingModelId(usModel))
{
g_pGame->GetRenderWare()->ClothesRemoveReplacement(m_RawDataBuffer.data());
return;
}
It looks like it doesn't work unless your model is linked with ingame texture. engineImportTXD doesn't help in this situation. |
From the tests I've done, I've noticed that if the clothe is bigger than the original clothe in the game, it crashes. I was testing with a model of mine, this model is light and wasn't giving me this problem, so I couldn't notice it. At the moment I still have no idea how to solve it, so I've left the PR as a draft until I find a way to solve it. |
This PR will allow you to replace clothing models in CJ using the
engineLoadDFF
andengineReplaceModel
functions. The clothing models should be made in the same way as in the original game, with 3 clumps, ripped, normal and fat,List of model ids: