MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / SetFace

Method SetFace

engine/Poseidon/World/Entities/Infantry/Head.cpp:590–681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

588 }
589}
590
591void Head::SetFace(const HeadType& type, bool women, LODShape* lShape, RString name, RString player)
592{
593 const ParamEntry* cls = (Pars >> "CfgFaces").FindEntry(name);
594 if (!cls)
595 {
596 cls = (Pars >> "CfgFaces").FindEntry("Default");
597 if (!cls)
598 {
599 return;
600 }
601 }
602
603 bool faceWoman = false;
604 if (cls->FindEntry("woman"))
605 {
606 faceWoman = *cls >> "woman";
607 }
608 // do not use women face to man head and vice versa
609 if (faceWoman != women)
610 {
611 return;
612 }
613
614 RString textName = GetPictureName(*cls >> "texture");
615 Ref<Texture> text = GlobLoadTexture(textName);
616 if (text)
617 {
618 _texture = text;
619 }
620 else
621 {
622 LOG_ERROR(Physics, "Cannot find texture: {}", (const char*)textName);
623 }
624
625 if (stricmp(name, "custom") == 0)
626 {
627 if (player.GetLength() > 0)
628 {
629 RString relativeFace = Poseidon::BuildNetworkPlayerAssetTmpPath(player, RString("face.paa"));
630 RString face = relativeFace.GetLength() > 0 ? Poseidon::GetUserDirectory() + relativeFace : RString();
631 if (face.GetLength() > 0 && QIFStream::FileExists(face))
632 {
633 Ref<Texture> text = GlobLoadTexture(face);
634 if (text)
635 {
636 _texture = text;
637 }
638 }
639 else
640 {
641 relativeFace = Poseidon::BuildNetworkPlayerAssetTmpPath(player, RString("face.jpg"));
642 face = relativeFace.GetLength() > 0 ? Poseidon::GetUserDirectory() + relativeFace : RString();
643 if (face.GetLength() > 0 && QIFStream::FileExists(face))
644 {
645 Ref<Texture> text = GlobLoadTexture(face);
646 if (text)
647 {

Callers 1

ProcessGroupRespawnFunction · 0.45

Calls 12

GetPictureNameFunction · 0.85
GlobLoadTextureFunction · 0.85
GetUserDirectoryFunction · 0.85
GetDefaultNameFunction · 0.85
stricmpFunction · 0.50
RStringClass · 0.50
FileExistsFunction · 0.50
FindEntryMethod · 0.45
GetLengthMethod · 0.45
GetSizeMethod · 0.45
GetNameMethod · 0.45
RegisterTextureMethod · 0.45

Tested by

no test coverage detected