| 588 | } |
| 589 | } |
| 590 | |
| 591 | void 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 | { |
no test coverage detected