Skip to content
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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

W3lac3
Copy link
Contributor

@W3lac3 W3lac3 commented Jan 18, 2025

This PR will allow you to replace clothing models in CJ using the engineLoadDFF and engineReplaceModel 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:

afro.dff -> 30000
afrobeard.dff -> 30001
afrotash.dff -> 30002
balaclava.dff -> 30003
bandana.dff -> 30004
bandknots.dff -> 30005
bandmask.dff -> 30006
barefeet.dff -> 30007
baseball.dff -> 30008
bask1.dff -> 30009
baskball.dff -> 30010
bbjack.dff -> 30011
beret.dff -> 30012
biker.dff -> 30013
bikerhelmet.dff -> 30014
boater.dff -> 30015
bowler.dff -> 30016
boxingcap.dff -> 30017
boxingshoe.dff -> 30018
boxingshort.dff -> 30019
cap.dff -> 30020
capandband.dff -> 30021
capback.dff -> 30022
capknit.dff -> 30023
capover.dff -> 30024
capovereye.dff -> 30025
cappolice.dff -> 30026
caprimup.dff -> 30027
capside.dff -> 30028
captruck.dff -> 30029
chinos.dff -> 30030
chinosb.dff -> 30031
chonger.dff -> 30032
chucks.dff -> 30033
coach.dff -> 30034
conv.dff -> 30035
cornrows.dff -> 30036
country.dff -> 30037
countrytr.dff -> 30038
cowboy.dff -> 30039
cs_afro.dff -> 30040
cs_afrobeard.dff -> 30041
cs_afrotash.dff -> 30042
cs_bandana.dff -> 30043
cs_bandknots.dff -> 30044
cs_bandmask.dff -> 30045
cs_bikerhelmet.dff -> 30046
cs_cornrows.dff -> 30047
cs_elvishair.dff -> 30048
cs_flatears.dff -> 30049
cs_flattop.dff -> 30050
cs_gimpmask.dff -> 30051
cs_groovecut.dff -> 30052
cs_hands.dff -> 30053
cs_head.dff -> 30054
cs_highafro.dff -> 30055
cs_jheri.dff -> 30056
cs_mohawk.dff -> 30057
cs_slope.dff -> 30058
cs_tramline.dff -> 30059
cs_wedge.dff -> 30060
cs_zorro.dff -> 30061
denim.dff -> 30062
elvishair.dff -> 30063
eyepatch.dff -> 30064
feet.dff -> 30065
field.dff -> 30066
flatears.dff -> 30067
flattop.dff -> 30068
flipflop.dff -> 30069
garagetop.dff -> 30070
garagetr.dff -> 30071
gimpfeet.dff -> 30072
gimphands.dff -> 30073
gimpleg.dff -> 30074
gimpmask.dff -> 30075
gimptorso.dff -> 30076
glasses01.dff -> 30077
glasses03.dff -> 30078
glasses04.dff -> 30079
glassesx.dff -> 30080
groovecut.dff -> 30081
grouchos.dff -> 30082
hands.dff -> 30083
hatmanc.dff -> 30084
hattiger.dff -> 30085
hawaii.dff -> 30086
head.dff -> 30087
helmet.dff -> 30088
highafro.dff -> 30089
hitop.dff -> 30090
hockeymask.dff -> 30091
hoodjack.dff -> 30092
hoodya.dff -> 30093
hoodyb.dff -> 30094
jeans.dff -> 30095
jheri.dff -> 30096
leather.dff -> 30097
leathertr.dff -> 30098
legs.dff -> 30099
legspants.dff -> 30100
medictr.dff -> 30101
mohawk.dff -> 30102
moto.dff -> 30103
neck.dff -> 30104
neck2.dff -> 30105
neck2_bb.dff -> 30106
neck2_field.dff -> 30107
neck2_hoodya.dff -> 30108
neck2_pimp.dff -> 30109
neck2_shirt.dff -> 30110
neck_bb.dff -> 30111
neck_field.dff -> 30112
neck_hoodya.dff -> 30113
neck_pimp.dff -> 30114
neck_shirt.dff -> 30115
neck_tracky.dff -> 30116
painter.dff -> 30117
pimp.dff -> 30118
pimpshoe.dff -> 30119
pimptr.dff -> 30120
policeshirt.dff -> 30121
policetr.dff -> 30122
shirta.dff -> 30123
shirtb.dff -> 30124
shoe.dff -> 30125
shorts.dff -> 30126
skullycap.dff -> 30127
sleevt.dff -> 30128
slope.dff -> 30129
sneaker.dff -> 30130
suit1.dff -> 30131
suit1tr.dff -> 30132
suit2.dff -> 30133
sweat.dff -> 30134
timber.dff -> 30135
torso.dff -> 30136
tracktr.dff -> 30137
trackytop1.dff -> 30138
tramline.dff -> 30139
trilby.dff -> 30140
tshirt.dff -> 30141
tshirt2.dff -> 30142
valet.dff -> 30143
vest.dff -> 30144
watch.dff -> 30145
watch_hoody.dff -> 30146
wcoat.dff -> 30147
wedge.dff -> 30148
worktr.dff -> 30149
worktrboot.dff -> 30150
zorromask.dff -> 30151

@tederis tederis added the enhancement New feature or request label Jan 19, 2025
@@ -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)
Copy link
Member

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

Comment on lines +104 to +118
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;
}

Copy link
Member

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());
Copy link
Member

@TheNormalnij TheNormalnij Jan 19, 2025

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;
        }

@TheNormalnij TheNormalnij linked an issue Jan 19, 2025 that may be closed by this pull request
@TheNormalnij
Copy link
Member

TheNormalnij commented Jan 19, 2025

It looks like it doesn't work unless your model is linked with ingame texture. engineImportTXD doesn't help in this situation.
This feature doesn't work with most mods.
Can you provide a test resource, please?
Crash resource: clothes_test_crash.zip

@W3lac3 W3lac3 marked this pull request as draft January 20, 2025 00:30
@W3lac3
Copy link
Contributor Author

W3lac3 commented Jan 20, 2025

It looks like it doesn't work unless your model is linked with ingame texture. engineImportTXD doesn't help in this situation. This feature doesn't work with most mods. Can you provide a test resource, please? Crash resource: clothes_test_crash.zip

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The ability to replace CJ clothing and body part models
3 participants