OldUnreal / UnrealTournamentPatches

Other
999 stars 29 forks source link

[469b] Nali WarCow skin broken for usage as Atomic Cow #362

Closed SeriousBuggie closed 7 months ago

SeriousBuggie commented 3 years ago

Skin can be two types:

  1. Pawn.bIsMultiSkinned = False In this case used Pawn.Skin for player skin.
  2. Pawn.bIsMultiSkinned = True In this case used Pawn.MultiSkins[0-3] for player skin. Postlogin in GameInfo: https://github.com/Slipyx/UT99/blob/f2ebd703845075a2d667e8e3f2f71a5e7f187610/Engine/GameInfo.uc#L1010
                if ( P.bIsMultiSkinned )
                    NewPlayer.ClientReplicateSkins(P.MultiSkins[0], P.MultiSkins[1], P.MultiSkins[2], P.MultiSkins[3]);
                else
                    NewPlayer.ClientReplicateSkins(P.Skin);

    Field Pawn.bIsMultiSkinned is not an object of replication. So if it is not set explicit client use default value.

Now look at TCow:

defaultproperties
{
    bIsMultiSkinned=false

and

simulated function SetMyMesh()
{
    Super.SetMyMesh();
    bIsMultiSkinned = true;
}

but in parent class CustomPlayer on GetMultiSkin checked explicit default value:

static function GetMultiSkin( Actor SkinActor, out string SkinName, out string FaceName )
{
    local string FullSkinName, ShortSkinName;

    if ( default.bisMultiSkinned
        || (SkinActor.Mesh == Default.FallBackMesh) )
    {
        Super.GetMultiSkin(SkinActor,SkinName,FaceName);
        return;
    }

    // only one skin
    FaceName = "";

    FullSkinName  = String(SkinActor.Skin);
    ShortSkinName = SkinActor.GetItemName(FullSkinName);
    SkinName = Left(FullSkinName, Len(FullSkinName) - Len(ShortSkinName)) $ Left(ShortSkinName, 4);
}

if ( default.bisMultiSkinned, not if ( bisMultiSkinned. So if used GetMultiSkin/SetMultiSkin NaliCow switch to Skin whic is Yellow cow and Atomic cow (or anything else) will not work.

IDK why used such weird way for cow: default.bisMultiSkinned = False, but bisMultiSkinned = true.

SeriousBuggie commented 3 years ago

For fix need set

defaultproperties
{
    bIsMultiSkinned=true
stijn-volckaert commented 1 year ago

I have just reverted this fix because it broke the warcow skins in the player setup menu