Jump to content

Initial soldier appearance


prune1

Recommended Posts

If anyone is interested, here is some info concerning hair spinner.

 

DefaultContent.ini contains lines like:

HairPackageInfo=(Id=11,ArchetypeName="Hair_FemHair_K.ARC_Hair_FemHair_K", Gender=eGender_Female)
HairPackageInfo=(Id=17,ArchetypeName="Hair_MaleHair_D.ARC_Hair_MaleHair_D", Gender=eGender_Male)
HairPackageInfo=(Id=200,ArchetypeName="Helmet_Kevlar0.KevlarHelmet0",bIsHelmet=true)
HairPackageInfo=(Id=303,ArchetypeName="Helmet_Kevlar1.KevlarHelmet1",bIsHelmet=true)
HairPackageInfo=(Id=403,ArchetypeName="Helmet_Kevlar2.KevlarHelmet2",bIsHelmet=true)

Note Gender definitions.

 

Those lines are added to HairPackageInfo array used by XComContentManager.

HairPackageInfo(10)=(Id=11,Gender=EGender.eGender_Female,ArchetypeName="Hair_FemHair_K.ARC_Hair_FemHair_K")
HairPackageInfo(14)=(Id=17,Gender=EGender.eGender_Male,ArchetypeName="Hair_MaleHair_D.ARC_Hair_MaleHair_D")
HairPackageInfo(32)=(Id=200,bIsHelmet=true,ArchetypeName="Helmet_Kevlar0.KevlarHelmet0")
HairPackageInfo(33)=(Id=303,bIsHelmet=true,ArchetypeName="Helmet_Kevlar1.KevlarHelmet1")
HairPackageInfo(34)=(Id=403,bIsHelmet=true,ArchetypeName="Helmet_Kevlar2.KevlarHelmet2")

---

When the game is creating UI spinners, it calls several functions. GetContentIds<snip> serves like a filter and IntersectContentIds builds the final array Hair(s). Btw I haven't see any values, that would help filtering hair by race. Another fact is males and females have the same ammount of hair options atm, otherwise the mod won't work the same for both genders.

GetContentIdsForRace(6, byte(kSoldier.kAppearance.iRace), RaceHairs,, true);
GetContentIdsForGender(6, byte(kSoldier.kAppearance.iGender), GenderHairs,, true);
GetContentIdsForCharacter(6, 2, CharacterHairs,, true);
IntersectContentIds(RaceHairs, GenderHairs, GenderRaceHairs);
IntersectContentIds(GenderRaceHairs, CharacterHairs, Hairs);

And in the end, there is one array looking like this (female example):

Hairs[0]=1      // Hair_FemHair_A
<snip>
Hairs[16]=200    // Helmet_Kevlar0
Hairs[17]=303    // Helmet_Kevlar1
Hairs[18]=403    // Helmet_Kevlar2
<snip>

This array is passed to Hair/Helmet spinner, but the spinner's UI range starts at 1. And because option 1 is no hair, the first hair from the array is listed as option 2. So there is -2 compensation needed, while setting values in XComGame.upk, XGCharacterGenerator.CreateTSoldier.

kSoldier.kAppearance.iHaircut = Hairs[21 - 2]; // 21 in the game

Code responsible for the spinner's UI string (current option) is set in XComStrategyGame.upk, XGCustomizeUI.UpdateMainMenu:

kOption.strHelp = "" $ string((GetHairIndex()) + 2);

And the spinner's true range is set in XcomStrategyGame.upk, XGCustomizeUI.AdvanceHair:

NumHairs = m_kPawn.PossibleHairs.Length;
CurIdx = GetHairIndex();
NewIdx = CurIdx + Dir;
if(NewIdx < -1) // this one
{
    NewIdx = NumHairs - 1;
}
if(NewIdx >= NumHairs)
{
    NewIdx = -1; // and this one
}
NewHair = ((NewIdx > -1) ? m_kPawn.PossibleHairs[NewIdx] : -1);
m_kPawn.SetHair(NewHair);
<snip>

-1 in this case should allow no hair option.

Edited by Drakous79
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...