Skip to content

Commit

Permalink
"fix" charm display with widecamera
Browse files Browse the repository at this point in the history
up version number
  • Loading branch information
SFGrenade committed Sep 21, 2023
1 parent 6d32869 commit 21e0a4e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 23 deletions.
39 changes: 18 additions & 21 deletions CharmHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,10 @@ private static void Init()
bbT2 = backboardsGo.Find($"BB {bbPrefabNum - 20}"); // "BB 1" - "BB 20"
bbPrefab = Object.Instantiate(bbT1, backboardsGo.transform, true);
AddToCharmFadeGroup(bbPrefab, backboardsGo.transform.parent.gameObject);
AddToCharmFadeGroup(bbPrefab.Find("New Item Orb"), backboardsGo.transform.parent.gameObject);
//AddToCharmFadeGroup(bbPrefab.Find("New Item Orb"), backboardsGo.transform.parent.gameObject);
bbPrefab.transform.localPosition = bbT1.transform.localPosition + ((bbT1.transform.localPosition - bbT2.transform.localPosition) * (((i / 10f) - (bbPrefabNum / 10f)) / 2f));
bbPrefab.name = $"BB {i}";
bbPrefab.SetActive(true);
bbPrefab.SetActive(bbT1.activeSelf);

var icb = bbPrefab.GetComponent<InvCharmBackboard>();
icb.charmNum = i;
Expand Down Expand Up @@ -416,6 +416,7 @@ private static void Init()
ccPrefab = Object.Instantiate(ccT1.gameObject, collectedCharmsGo.transform, true);
ccPrefab.SetActive(false);
AddToCharmFadeGroup(ccPrefab.Find("Sprite"), collectedCharmsGo.transform.parent.gameObject);
AddToCharmFadeGroup(ccPrefab.Find("Glow"), collectedCharmsGo.transform.parent.gameObject);
ccT1.gameObject.SetActive(tmp);
ccPrefab.name = i.ToString();

Expand All @@ -426,14 +427,16 @@ private static void Init()
ccFsmVars.GetFsmString("PD Bool Name").Value = "gotCharm_" + i;
ccFsmVars.GetFsmGameObject("Charm Sprite").Value = ccPrefab.Find("Sprite");
ccFsmVars.GetFsmGameObject("Glow").Value = ccPrefab.Find("Glow");
ccPrefab.SetActive(true);
ccPrefab.SetActive(ccT1.gameObject.activeSelf);
}
else if (collectedCharmsGo.Find(i.ToString()) != null)
{
// Use already existing one and just change stuff
ccPrefab = collectedCharmsGo.Find(i.ToString());
bool tmpActive = ccPrefab.activeSelf;
ccPrefab.SetActive(false);
AddToCharmFadeGroup(ccPrefab.Find("Sprite"), collectedCharmsGo.transform.parent.gameObject);
AddToCharmFadeGroup(ccPrefab.Find("Glow"), collectedCharmsGo.transform.parent.gameObject);
ccPrefab.name = i.ToString();

charmShowFsm = ccPrefab.LocateMyFSM("charm_show_if_collected");
Expand All @@ -443,7 +446,7 @@ private static void Init()
ccFsmVars.GetFsmString("PD Bool Name").Value = "gotCharm_" + i;
ccFsmVars.GetFsmGameObject("Charm Sprite").Value = ccPrefab.Find("Sprite");
ccFsmVars.GetFsmGameObject("Glow").Value = ccPrefab.Find("Glow");
ccPrefab.SetActive(true);
ccPrefab.SetActive(tmpActive);
}
}

Expand Down Expand Up @@ -531,25 +534,19 @@ private static void InitBuildEquippedCharms(BuildEquippedCharms self)
if (i < self.gameObjectList.Count)
tmplist.Add(self.gameObjectList[i]);
else
tmplist.Add(default(GameObject));
}
#endregion

#region Fill nulls in tmplist with copies of tmplist[0], but adjusted Charm IDs
for (int i = 41; i <= 40 + CustomSprites.Count; i++)
{
var equippedCharmPrefab = Object.Instantiate(tmplist[0]);

SetInactive(equippedCharmPrefab);

equippedCharmPrefab.name = $"{i}";

var ci = equippedCharmPrefab.GetComponent<CharmItem>();
{
var equippedCharmPrefab = Object.Instantiate(tmplist[0]);

var cd = equippedCharmPrefab.GetComponent<CharmDisplay>();
cd.id = i;
SetInactive(equippedCharmPrefab);
equippedCharmPrefab.transform.position = new Vector3(-20000.0f, -20000.0f, -20000.0f);
equippedCharmPrefab.SetActive(tmplist[0].activeSelf);
equippedCharmPrefab.name = $"{i + 1}";
var ci = equippedCharmPrefab.GetComponent<CharmItem>();
var cd = equippedCharmPrefab.GetComponent<CharmDisplay>();
cd.id = i + 1;

tmplist[i - 1] = equippedCharmPrefab;
tmplist.Add(equippedCharmPrefab);
}
}
#endregion

Expand Down
4 changes: 2 additions & 2 deletions SFCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<Product>SFCore</Product>
<Description>A Hollow Knight Mod Library</Description>
<Copyright>Copyright © SFGrenade 2019-2021</Copyright>
<AssemblyVersion>1.5.9.0</AssemblyVersion>
<FileVersion>1.5.9.0</FileVersion>
<AssemblyVersion>1.5.9.1</AssemblyVersion>
<FileVersion>1.5.9.1</FileVersion>
<OutputPath>bin/$(Configuration)/</OutputPath>
<LangVersion>latest</LangVersion>
<HollowKnightRefs Condition="$([MSBuild]::IsOSPlatform('Linux'))">/home/sfg/Games/gog/hollow-knight/game/Hollow Knight_Data/Managed/</HollowKnightRefs>
Expand Down

0 comments on commit 21e0a4e

Please sign in to comment.