From 8f4fe90486b974d0a15c8e4c5e6e9c357521351a Mon Sep 17 00:00:00 2001 From: audino <2676737+audinowho@users.noreply.github.com> Date: Thu, 29 Feb 2024 12:19:02 -0800 Subject: [PATCH 01/16] RogueElements update --- RogueElements | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RogueElements b/RogueElements index 2bf07f04..c50be141 160000 --- a/RogueElements +++ b/RogueElements @@ -1 +1 @@ -Subproject commit 2bf07f04d6634f2e569747621c8e1fc781009569 +Subproject commit c50be1419f4e5681288f46156688b223b8a9033b From d2b43944135aba7eb0b70654d4dfa0990e372292 Mon Sep 17 00:00:00 2001 From: Kace <41309226+DoubleTrio@users.noreply.github.com> Date: Sat, 2 Mar 2024 16:17:35 -0500 Subject: [PATCH 02/16] Fix storage score --- RogueEssence/Dungeon/Team.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RogueEssence/Dungeon/Team.cs b/RogueEssence/Dungeon/Team.cs index 51ae2152..66d9c37a 100644 --- a/RogueEssence/Dungeon/Team.cs +++ b/RogueEssence/Dungeon/Team.cs @@ -565,7 +565,7 @@ public int GetStorageValue() if (Storage.GetValueOrDefault(key, 0) > 0) { if (DataManager.Instance.DataIndices[DataManager.DataType.Item].ContainsKey(key)) - invValue += DataManager.Instance.GetItem(key).Price; + invValue += DataManager.Instance.GetItem(key).Price * Storage[key]; } } return invValue; From 6ff496befe9cfee2314f115bb69222ed496f86f1 Mon Sep 17 00:00:00 2001 From: MistressNebula Date: Tue, 5 Mar 2024 23:30:05 +0100 Subject: [PATCH 03/16] Made arrow height editable --- RogueEssence/Menu/SideScrollMenu.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/RogueEssence/Menu/SideScrollMenu.cs b/RogueEssence/Menu/SideScrollMenu.cs index 0922b51a..f16d2f24 100644 --- a/RogueEssence/Menu/SideScrollMenu.cs +++ b/RogueEssence/Menu/SideScrollMenu.cs @@ -9,10 +9,16 @@ public abstract class SideScrollMenu : InteractableMenu protected const int CURSOR_FLASH_TIME = 24; public ulong PrevTick; + public int arrowHeight; public void Initialize() + { + Initialize(GraphicsManager.ScreenHeight / 2); + } + public void Initialize(int arrowH) { PrevTick = GraphicsManager.TotalFrameTick % (ulong)FrameTick.FrameToTick(CURSOR_FLASH_TIME); + arrowHeight = arrowH; } public override void Draw(SpriteBatch spriteBatch) @@ -24,8 +30,8 @@ public override void Draw(SpriteBatch spriteBatch) //draw cursor if (((GraphicsManager.TotalFrameTick - PrevTick) / (ulong)FrameTick.FrameToTick(CURSOR_FLASH_TIME / 2)) % 2 == 0 || Inactive) { - GraphicsManager.Cursor.DrawTile(spriteBatch, new Vector2(Bounds.X - GraphicsManager.Cursor.TileWidth, GraphicsManager.ScreenHeight / 2), 0, 0, Color.White, SpriteEffects.FlipHorizontally); - GraphicsManager.Cursor.DrawTile(spriteBatch, new Vector2(Bounds.End.X, GraphicsManager.ScreenHeight / 2), 0, 0); + GraphicsManager.Cursor.DrawTile(spriteBatch, new Vector2(Bounds.X - GraphicsManager.Cursor.TileWidth, arrowHeight), 0, 0, Color.White, SpriteEffects.FlipHorizontally); + GraphicsManager.Cursor.DrawTile(spriteBatch, new Vector2(Bounds.End.X, arrowHeight), 0, 0); } } From 3d6cfb5d46c9bc78f2c5fd57894c185c5a2e68f9 Mon Sep 17 00:00:00 2001 From: MistressNebula Date: Tue, 5 Mar 2024 23:59:26 +0100 Subject: [PATCH 04/16] TeachWhomMenu implemented Press left or right inside TeachInfoMenu to access it --- RogueEssence/Menu/Items/TeachInfoMenu.cs | 24 ++- RogueEssence/Menu/Items/TeachWhomMenu.cs | 194 +++++++++++++++++++++++ 2 files changed, 216 insertions(+), 2 deletions(-) create mode 100644 RogueEssence/Menu/Items/TeachWhomMenu.cs diff --git a/RogueEssence/Menu/Items/TeachInfoMenu.cs b/RogueEssence/Menu/Items/TeachInfoMenu.cs index b38e0dec..ef03bb63 100644 --- a/RogueEssence/Menu/Items/TeachInfoMenu.cs +++ b/RogueEssence/Menu/Items/TeachInfoMenu.cs @@ -7,8 +7,10 @@ namespace RogueEssence.Menu { - public class TeachInfoMenu : InteractableMenu + public class TeachInfoMenu : SideScrollMenu { + public string itemId { get; private set; } + MenuText SkillName; MenuText SkillCharges; @@ -22,6 +24,7 @@ public class TeachInfoMenu : InteractableMenu public TeachInfoMenu(string itemNum) { + itemId = itemNum; Bounds = Rect.FromPoints(new Loc(16, 24), new Loc(GraphicsManager.ScreenWidth - 16, GraphicsManager.ScreenHeight - 72)); ItemData itemData = DataManager.Instance.GetItem(itemNum); @@ -32,7 +35,7 @@ public TeachInfoMenu(string itemNum) SkillName = new MenuText(skillEntry.GetColoredName(), new Loc(GraphicsManager.MenuBG.TileWidth * 2, GraphicsManager.MenuBG.TileHeight)); SkillCharges = new MenuText(Text.FormatKey("MENU_SKILLS_TOTAL_CHARGES", skillEntry.BaseCharges), new Loc(Bounds.Width / 2, GraphicsManager.MenuBG.TileHeight)); - + SkillElement = new MenuText(Text.FormatKey("MENU_SKILLS_ELEMENT", elementEntry.GetIconName()), new Loc(GraphicsManager.MenuBG.TileWidth * 2, GraphicsManager.MenuBG.TileHeight + VERT_SPACE)); SkillCategory = new MenuText(Text.FormatKey("MENU_SKILLS_CATEGORY", skillEntry.Data.Category.ToLocal()), new Loc(GraphicsManager.MenuBG.TileWidth * 2, GraphicsManager.MenuBG.TileHeight + VERT_SPACE * 2)); @@ -48,6 +51,8 @@ public TeachInfoMenu(string itemNum) MenuDiv = new MenuDivider(new Loc(GraphicsManager.MenuBG.TileWidth, GraphicsManager.MenuBG.TileHeight + VERT_SPACE * 3 + LINE_HEIGHT), Bounds.Width - GraphicsManager.MenuBG.TileWidth * 2); + + base.Initialize(Bounds.Top + (Bounds.Height) / 2); } public override IEnumerable GetElements() @@ -79,6 +84,21 @@ public override void Update(InputManager input) GameManager.Instance.SE("Menu/Cancel"); MenuManager.Instance.RemoveMenu(); } + else if (DirPressed(input, Dir8.Right)) + { + GameManager.Instance.SE("Menu/Skip"); + MenuManager.Instance.ReplaceMenu(new TeachWhomMenu(itemId, 0)); + } + else if (DirPressed(input, Dir8.Left)) + { + GameManager.Instance.SE("Menu/Skip"); + MenuManager.Instance.ReplaceMenu(new TeachWhomMenu(itemId, (int)Math.Ceiling((double)DataManager.Instance.Save.ActiveTeam.Players.Count / 4) - 1)); + } + } + + private bool DirPressed(InputManager input, Dir8 dir) + { + return input.Direction == dir && input.PrevDirection != dir; } } } diff --git a/RogueEssence/Menu/Items/TeachWhomMenu.cs b/RogueEssence/Menu/Items/TeachWhomMenu.cs new file mode 100644 index 00000000..a376df1f --- /dev/null +++ b/RogueEssence/Menu/Items/TeachWhomMenu.cs @@ -0,0 +1,194 @@ +using System; +using System.Collections.Generic; +using RogueElements; +using RogueEssence.Content; +using RogueEssence.Data; +using RogueEssence.Dungeon; + +namespace RogueEssence.Menu +{ + public class TeachWhomMenu : SideScrollMenu + { + public enum TeachState + { + CanLearn = 0, + CannotLearn = 1, + Learned = 2 + } + + public string itemId {get; private set;} + public string skillId {get; private set;} + + int page; + + MenuText SkillName; + MenuText SkillCharges; + + MenuDivider MenuDiv; + MenuText SkillElement; + MenuText SkillCategory; + MenuText SkillPower; + MenuText SkillHitRate; + MenuText SkillTargets; + + MenuText MemberListTitle; + + List MemberNames; + List MemberTeachState; + + public TeachWhomMenu(string itemNum, int startPage) + { + page = startPage; + itemId = itemNum; + Bounds = Rect.FromPoints(new Loc(16, 24), new Loc(GraphicsManager.ScreenWidth - 16, GraphicsManager.ScreenHeight - 72)); + + ItemData itemData = DataManager.Instance.GetItem(itemNum); + ItemIDState effect = itemData.ItemStates.GetWithDefault(); + skillId = effect.ID; + + SkillData skillEntry = DataManager.Instance.GetSkill(effect.ID); + ElementData elementEntry = DataManager.Instance.GetElement(skillEntry.Data.Element); + + SkillName = new MenuText(skillEntry.GetColoredName(), new Loc(GraphicsManager.MenuBG.TileWidth * 2, GraphicsManager.MenuBG.TileHeight)); + SkillCharges = new MenuText(Text.FormatKey("MENU_SKILLS_TOTAL_CHARGES", skillEntry.BaseCharges), new Loc(Bounds.Width / 2, GraphicsManager.MenuBG.TileHeight)); + + SkillElement = new MenuText(Text.FormatKey("MENU_SKILLS_ELEMENT", elementEntry.GetIconName()), new Loc(GraphicsManager.MenuBG.TileWidth * 2, GraphicsManager.MenuBG.TileHeight + VERT_SPACE)); + SkillCategory = new MenuText(Text.FormatKey("MENU_SKILLS_CATEGORY", skillEntry.Data.Category.ToLocal()), new Loc(GraphicsManager.MenuBG.TileWidth * 2, GraphicsManager.MenuBG.TileHeight + VERT_SPACE * 2)); + + BasePowerState powerState = skillEntry.Data.SkillStates.GetWithDefault(); + SkillPower = new MenuText(Text.FormatKey("MENU_SKILLS_POWER", (powerState != null ? powerState.Power.ToString() : "---")), new Loc(Bounds.Width / 2, GraphicsManager.MenuBG.TileHeight + VERT_SPACE)); + SkillHitRate = new MenuText(Text.FormatKey("MENU_SKILLS_HIT_RATE", (skillEntry.Data.HitRate > -1 ? skillEntry.Data.HitRate + "%" : "---")), new Loc(Bounds.Width / 2, GraphicsManager.MenuBG.TileHeight + VERT_SPACE * 2)); + + SkillTargets = new MenuText(Text.FormatKey("MENU_SKILLS_RANGE", skillEntry.HitboxAction.GetDescription()), new Loc(GraphicsManager.MenuBG.TileWidth * 2, GraphicsManager.MenuBG.TileHeight + VERT_SPACE * 3)); + + MenuDiv = new MenuDivider(new Loc(GraphicsManager.MenuBG.TileWidth, GraphicsManager.MenuBG.TileHeight + VERT_SPACE * 3 + LINE_HEIGHT), + Bounds.Width - GraphicsManager.MenuBG.TileWidth * 2); + + MemberListTitle = new MenuText(Text.FormatKey("MENU_SKILLS_LEARN_LIST_TITLE", skillEntry.BaseCharges) + ":", new Loc(GraphicsManager.MenuBG.TileWidth * 2, GraphicsManager.MenuBG.TileHeight + VERT_SPACE * 4)); + + MemberNames = new List(); + MemberTeachState = new List(); + for (int i=0; i<4; i++) + { + int y = GraphicsManager.MenuBG.TileHeight + VERT_SPACE * (5 + i); + MemberNames.Add(new MenuText("", new Loc(GraphicsManager.MenuBG.TileWidth * 2, y))); + MemberTeachState.Add(new MenuText("", new Loc(Bounds.Width / 2, y))); + } + UpdateMembers(); + base.Initialize(Bounds.Top + (Bounds.Height) / 2); + } + + private void UpdateMembers() + { + int startPos = page * 4; + EventedList team = DataManager.Instance.Save.ActiveTeam.Players; + for(int i=0; i < MemberNames.Count; i++) + { + int index = startPos + i; + if(index < team.Count) + { + MemberNames[i].SetText(team[index].GetDisplayName(true)); + + string stateText = ""; + TeachState state = GetTeachState(team[index]); + switch (state) + { + case TeachState.CanLearn: + stateText = "MENU_SKILLS_CAN_LEARN"; + break; + case TeachState.CannotLearn: + stateText = "MENU_SKILLS_CANNOT_LEARN"; + break; + case TeachState.Learned: + stateText = "MENU_SKILLS_LEARNED"; + break; + } + + MemberTeachState[i].SetText(Text.FormatKey(stateText)); + } + else + { + MemberNames[i].SetText(""); + MemberTeachState[i].SetText(""); + } + } + } + + public TeachState GetTeachState(Character character) + { + BaseMonsterForm entry = DataManager.Instance.GetMonster(character.BaseForm.Species).Forms[character.BaseForm.Form]; + + //check for already knowing the skill + for (int ii = 0; ii < character.BaseSkills.Count; ii++) + { + if (character.BaseSkills[ii].SkillNum == skillId) + return TeachState.Learned; + } + + if (!DataManager.Instance.DataIndices[DataManager.DataType.Skill].Get(skillId).Released) + return TeachState.CannotLearn; + + if (entry.CanLearnSkill(skillId)) + return TeachState.CanLearn; + return TeachState.CannotLearn; + } + + public override IEnumerable GetElements() + { + yield return SkillName; + yield return SkillCharges; + + yield return SkillElement; + yield return SkillCategory; + yield return SkillPower; + yield return SkillHitRate; + yield return SkillTargets; + + yield return MenuDiv; + + yield return MemberListTitle; + + for (int i = 0; i < MemberNames.Count; i++) + { + yield return MemberNames[i]; + yield return MemberTeachState[i]; + } + } + + public override void Update(InputManager input) + { + Visible = true; + if (input.JustPressed(FrameInput.InputType.Menu)) + { + GameManager.Instance.SE("Menu/Cancel"); + MenuManager.Instance.ClearMenus(); + } + else if (input.JustPressed(FrameInput.InputType.Cancel)) + { + GameManager.Instance.SE("Menu/Cancel"); + MenuManager.Instance.RemoveMenu(); + } + else if (DirPressed(input, Dir8.Right)) + { + GameManager.Instance.SE("Menu/Skip"); + if (page == (int)Math.Ceiling((double)DataManager.Instance.Save.ActiveTeam.Players.Count / 4) - 1) + MenuManager.Instance.ReplaceMenu(new TeachInfoMenu(itemId)); + else + MenuManager.Instance.ReplaceMenu(new TeachWhomMenu(itemId, page + 1)); + } + else if (DirPressed(input, Dir8.Left)) + { + GameManager.Instance.SE("Menu/Skip"); + if(page == 0) + MenuManager.Instance.ReplaceMenu(new TeachInfoMenu(itemId)); + else + MenuManager.Instance.ReplaceMenu(new TeachWhomMenu(itemId, page - 1)); + } + } + + private bool DirPressed(InputManager input, Dir8 dir) + { + return input.Direction == dir && input.PrevDirection != dir; + } + } +} \ No newline at end of file From 7747dc782b91b53c4100d9d13c3c3efa5213ab54 Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 21 Mar 2024 23:33:18 +0100 Subject: [PATCH 05/16] Adjust skill menu width for longer texts --- RogueEssence/Menu/Skills/SkillMenu.cs | 54 +++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/RogueEssence/Menu/Skills/SkillMenu.cs b/RogueEssence/Menu/Skills/SkillMenu.cs index 8dbbc047..710cb78c 100644 --- a/RogueEssence/Menu/Skills/SkillMenu.cs +++ b/RogueEssence/Menu/Skills/SkillMenu.cs @@ -19,12 +19,16 @@ public class SkillMenu : MultiPageMenu public SkillMenu(int teamIndex) : this(teamIndex, -1) { } public SkillMenu(int teamIndex, int skillSlot) { - int menuWidth = 168; - List openPlayers = new List(); foreach (Character character in DataManager.Instance.Save.ActiveTeam.Players) openPlayers.Add(character); + string menuTitleText = Text.FormatKey("MENU_SKILLS_TITLE", DataManager.Instance.Save.ActiveTeam.Players[CurrentPage].GetDisplayName(true)); + + int menuWidthMin = 168; + int menuWidthMax = GraphicsManager.ScreenWidth - 32; + int menuWidth = getMenuWidth(menuWidthMin, menuWidthMax, menuTitleText, openPlayers); + MenuChoice[][] skills = new MenuChoice[openPlayers.Count][]; for (int ii = 0; ii < openPlayers.Count; ii++) { @@ -62,7 +66,7 @@ public SkillMenu(int teamIndex, int skillSlot) GraphicsManager.ScreenHeight - 8 - GraphicsManager.MenuBG.TileHeight * 2 - LINE_HEIGHT * 2 - VERT_SPACE * 4), new Loc(GraphicsManager.ScreenWidth - 16, GraphicsManager.ScreenHeight - 8))); - Initialize(new Loc(16, 16), menuWidth, Text.FormatKey("MENU_SKILLS_TITLE", DataManager.Instance.Save.ActiveTeam.Players[CurrentPage].GetDisplayName(true)), skills, skillSlot, teamIndex, CharData.MAX_SKILL_SLOTS); + Initialize(new Loc(16, 16), menuWidth, menuTitleText, skills, skillSlot, teamIndex, CharData.MAX_SKILL_SLOTS); } @@ -106,6 +110,50 @@ private void choose(int choice) MenuManager.Instance.AddMenu(new SkillChosenMenu(CurrentPage, choice), true); } + private int getMenuWidth(int min, int max, string title, List openPlayers) + { + int menuWidth = min; + int extraSpaceWidth = 32; // seperation between skill/titel and charges/teamIndex + + // check for all skills if they exceed min + int chkTextLength = 8; + int chargesTextLength = 8 * 4; + int skillIndentation = chargesTextLength; + foreach (Character character in openPlayers) + { + foreach (BackReference skillRef in character.Skills) + { + Skill skill = skillRef.Element; + if (!String.IsNullOrEmpty(skill.SkillNum)) + { + string skillName = DataManager.Instance.GetSkill(skill.SkillNum).GetColoredName(); + int skillNameLength = new MenuText(skillName, new Loc(0, 0)).GetTextLength(); + int skillRowLength = chkTextLength + chargesTextLength + skillIndentation + skillNameLength + extraSpaceWidth; + if (skillRowLength > menuWidth) + { + menuWidth = skillRowLength; + } + } + } + } + + // check if title exceeds min + int titleTextLength = new MenuText(title, new Loc(0, 0)).GetTextLength(); + int teamIndexLength = 8 * 4; + int titleLength = titleTextLength + teamIndexLength + extraSpaceWidth; + if (titleLength > menuWidth) + { + menuWidth = titleLength; + } + + if (menuWidth > max) + { + return max; + } + + return menuWidth; + } + protected override void ChoiceChanged() { defaultChoice = CurrentChoice; From ea418f91e2bf0dd20dbf303e25bf9eeef0c3474f Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 26 Mar 2024 22:13:35 +0100 Subject: [PATCH 06/16] Refactor - make use of Math Max Min --- RogueEssence/Menu/Skills/SkillMenu.cs | 41 +++++++++------------------ 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/RogueEssence/Menu/Skills/SkillMenu.cs b/RogueEssence/Menu/Skills/SkillMenu.cs index 710cb78c..ce74bf83 100644 --- a/RogueEssence/Menu/Skills/SkillMenu.cs +++ b/RogueEssence/Menu/Skills/SkillMenu.cs @@ -27,7 +27,10 @@ public SkillMenu(int teamIndex, int skillSlot) int menuWidthMin = 168; int menuWidthMax = GraphicsManager.ScreenWidth - 32; - int menuWidth = getMenuWidth(menuWidthMin, menuWidthMax, menuTitleText, openPlayers); + int chkWidth = 8; + int chargesWidth = 8 * 4; + int skillIndentWidth = 8 * 4; + int menuWidth = getMenuWidth(menuWidthMin, menuWidthMax, chkWidth, chargesWidth, skillIndentWidth, menuTitleText, openPlayers); MenuChoice[][] skills = new MenuChoice[openPlayers.Count][]; for (int ii = 0; ii < openPlayers.Count; ii++) @@ -45,11 +48,11 @@ public SkillMenu(int teamIndex, int skillSlot) bool disabled = (skill.Sealed || skill.Charges <= 0); int index = jj; MenuText chkText = new MenuText(chkString, new Loc(0, 1), disabled ? Color.Red : Color.White); - MenuText menuText = new MenuText(skillString, new Loc(8, 1), disabled ? Color.Red : Color.White); - MenuText menuCharges = new MenuText(skillCharges, new Loc(menuWidth - 8 * 4, 1), DirV.Up, DirH.Right, disabled ? Color.Red : Color.White); + MenuText menuText = new MenuText(skillString, new Loc(chkWidth, 1), disabled ? Color.Red : Color.White); + MenuText menuCharges = new MenuText(skillCharges, new Loc(menuWidth - chargesWidth, 1), DirV.Up, DirH.Right, disabled ? Color.Red : Color.White); if (jj < Character.MAX_SKILL_SLOTS-1) { - MenuDivider div = new MenuDivider(new Loc(0, LINE_HEIGHT), menuWidth - 8 * 4); + MenuDivider div = new MenuDivider(new Loc(0, LINE_HEIGHT), menuWidth - skillIndentWidth); char_skills.Add(new MenuElementChoice(() => { choose(index); }, true, chkText, menuText, menuCharges, div)); } else @@ -110,15 +113,12 @@ private void choose(int choice) MenuManager.Instance.AddMenu(new SkillChosenMenu(CurrentPage, choice), true); } - private int getMenuWidth(int min, int max, string title, List openPlayers) + private int getMenuWidth(int min, int max, int chkWidth, int chargesWidth, int skillIndent, string title, List openPlayers) { int menuWidth = min; - int extraSpaceWidth = 32; // seperation between skill/titel and charges/teamIndex + int extraSpace = 32; // seperation between skill/titel and charges/teamIndex // check for all skills if they exceed min - int chkTextLength = 8; - int chargesTextLength = 8 * 4; - int skillIndentation = chargesTextLength; foreach (Character character in openPlayers) { foreach (BackReference skillRef in character.Skills) @@ -127,12 +127,9 @@ private int getMenuWidth(int min, int max, string title, List openPla if (!String.IsNullOrEmpty(skill.SkillNum)) { string skillName = DataManager.Instance.GetSkill(skill.SkillNum).GetColoredName(); - int skillNameLength = new MenuText(skillName, new Loc(0, 0)).GetTextLength(); - int skillRowLength = chkTextLength + chargesTextLength + skillIndentation + skillNameLength + extraSpaceWidth; - if (skillRowLength > menuWidth) - { - menuWidth = skillRowLength; - } + int skillTextLength = new MenuText(skillName, new Loc(0, 0)).GetTextLength(); + int skillRowLength = skillIndent + chkWidth + skillTextLength + extraSpace + chargesWidth; + menuWidth = Math.Max(skillRowLength, menuWidth); } } } @@ -140,18 +137,8 @@ private int getMenuWidth(int min, int max, string title, List openPla // check if title exceeds min int titleTextLength = new MenuText(title, new Loc(0, 0)).GetTextLength(); int teamIndexLength = 8 * 4; - int titleLength = titleTextLength + teamIndexLength + extraSpaceWidth; - if (titleLength > menuWidth) - { - menuWidth = titleLength; - } - - if (menuWidth > max) - { - return max; - } - - return menuWidth; + int titleLength = titleTextLength + teamIndexLength + extraSpace; + return Math.Min(max, Math.Max(titleLength, menuWidth)); } protected override void ChoiceChanged() From c62c24dae48478ffa15eacb9d55f11cca7a00eef Mon Sep 17 00:00:00 2001 From: audino <2676737+audinowho@users.noreply.github.com> Date: Sat, 30 Mar 2024 19:52:11 -0800 Subject: [PATCH 07/16] fix mail version check --- RogueEssence/Data/DataManager.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/RogueEssence/Data/DataManager.cs b/RogueEssence/Data/DataManager.cs index f37e1b06..5396628a 100644 --- a/RogueEssence/Data/DataManager.cs +++ b/RogueEssence/Data/DataManager.cs @@ -2096,8 +2096,10 @@ public static BaseRescueMail LoadRescueMail(string filename) int build = reader.ReadInt32(); int rev = reader.ReadInt32(); Version version; - if (build > -1) + if (rev > -1) version = new Version(major, minor, build, rev); + else if (build > -1) + version = new Version(major, minor, build); else version = new Version(major, minor); } From bcebcb84cc9670e5ea6d7633178580416a6a4827 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 1 Apr 2024 21:47:25 +0200 Subject: [PATCH 08/16] Add color to dialogue text --- RogueEssence/Menu/MenuElements/DialogueText.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/RogueEssence/Menu/MenuElements/DialogueText.cs b/RogueEssence/Menu/MenuElements/DialogueText.cs index 2f9a1b94..0e3b57b3 100644 --- a/RogueEssence/Menu/MenuElements/DialogueText.cs +++ b/RogueEssence/Menu/MenuElements/DialogueText.cs @@ -16,6 +16,7 @@ public class DialogueText : IMenuElement public bool CenterH; public bool CenterV; public float TextOpacity; + public Color Color; public bool Finished { get { return CurrentCharIndex < 0 || CurrentCharIndex >= formattedTextLength; } } /// @@ -38,7 +39,7 @@ public class DialogueText : IMenuElement /// private int formattedTextLength; - public DialogueText(string text, Rect rect, int lineHeight, bool centerH, bool centerV, int startIndex) + public DialogueText(string text, Rect rect, int lineHeight, bool centerH, bool centerV, int startIndex, Color color) { Rect = rect; LineHeight = lineHeight; @@ -46,10 +47,17 @@ public DialogueText(string text, Rect rect, int lineHeight, bool centerH, bool c CenterV = centerV; TextOpacity = 1f; CurrentCharIndex = startIndex; + Color = color; textColor = new List<(int idx, Color color)>(); SetAndFormatText(text); } - public DialogueText(string text, Rect rect, int lineHeight) : this(text, rect, lineHeight, false, false, -1) + + public DialogueText(string text, Rect rect, int lineHeight, bool centerH, bool centerV, int startIndex) + : this(text, rect, lineHeight, centerH, centerV, startIndex, Color.White) + {} + + public DialogueText(string text, Rect rect, int lineHeight) + : this(text, rect, lineHeight, false, false, -1, Color.White) { } private static void formatText(List<(int idx, Color color)> colors, ref string text) @@ -287,7 +295,7 @@ public void Draw(SpriteBatch spriteBatch, Loc offset) GraphicsManager.TextFont.DrawText(spriteBatch, startWidth + offset.X, startHeight + offset.Y + LineHeight * ii, fullLines[ii], null, DirV.Up, CenterH ? DirH.None : DirH.Left, - colorStack.Peek() * TextOpacity, curChar, nextColorIdx - curChar); + Color == Color.White ? colorStack.Peek() * TextOpacity : Color * TextOpacity, curChar, nextColorIdx - curChar); curChar = nextColorIdx; if (curChar + lineChars >= endIndex) From 3d05352cc4b12f1b6cf9c175e8ad3b0609f6596f Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 1 Apr 2024 22:10:54 +0200 Subject: [PATCH 09/16] Fix member menu promote text overlap --- RogueEssence/Menu/Team/MemberInfoMenu.cs | 25 +++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/RogueEssence/Menu/Team/MemberInfoMenu.cs b/RogueEssence/Menu/Team/MemberInfoMenu.cs index 4199cb0a..b335ceae 100644 --- a/RogueEssence/Menu/Team/MemberInfoMenu.cs +++ b/RogueEssence/Menu/Team/MemberInfoMenu.cs @@ -25,7 +25,7 @@ public class MemberInfoMenu : InteractableMenu public MenuDivider MainDiv; public MenuText Promotions; - public MenuText[] PromoteMethods; + public DialogueText[] PromoteMethods; public MemberInfoMenu(int teamSlot, bool assembly, bool allowAssembly) @@ -68,17 +68,21 @@ public MemberInfoMenu(int teamSlot, bool assembly, bool allowAssembly) MainDiv = new MenuDivider(new Loc(GraphicsManager.MenuBG.TileWidth, GraphicsManager.MenuBG.TileHeight + VERT_SPACE * 5), Bounds.Width - GraphicsManager.MenuBG.TileWidth * 2); Promotions = new MenuText(Text.FormatKey("MENU_TEAM_PROMOTION"), new Loc(GraphicsManager.MenuBG.TileWidth * 2, GraphicsManager.MenuBG.TileHeight + VERT_SPACE * 4 + TitledStripMenu.TITLE_OFFSET)); - List validPromotions = new List(); + List validPromotions = new List(); + int lineCount = 1; bool inDungeon = (GameManager.Instance.CurrentScene == DungeonScene.Instance); for (int ii = 0; ii < dexEntry.Promotions.Count; ii++) { + DialogueText promoteReqText = new DialogueText(DataManager.Instance.GetMonster(dexEntry.Promotions[ii].Result).GetColoredName() + ": " + dexEntry.Promotions[ii].GetReqString(), new Rect( + new Loc(GraphicsManager.MenuBG.TileWidth * 3, GraphicsManager.MenuBG.TileHeight + VERT_SPACE * (lineCount * validPromotions.Count + 5) + TitledStripMenu.TITLE_OFFSET), + new Loc(Bounds.Width - GraphicsManager.MenuBG.TileWidth * 4, 0)), LINE_HEIGHT); if (!DataManager.Instance.DataIndices[DataManager.DataType.Monster].Get(dexEntry.Promotions[ii].Result).Released) continue; if (dexEntry.Promotions[ii].IsQualified(player, inDungeon)) { - validPromotions.Add(new MenuText(DataManager.Instance.GetMonster(dexEntry.Promotions[ii].Result).GetColoredName() + ": " + dexEntry.Promotions[ii].GetReqString(), - new Loc(GraphicsManager.MenuBG.TileWidth * 2 + 8, GraphicsManager.MenuBG.TileHeight + VERT_SPACE * (validPromotions.Count + 5) + TitledStripMenu.TITLE_OFFSET))); + validPromotions.Add(promoteReqText); + lineCount = promoteReqText.GetLineCount(); } else { @@ -93,8 +97,9 @@ public MemberInfoMenu(int teamSlot, bool assembly, bool allowAssembly) } if (!hardReq) { - validPromotions.Add(new MenuText(DataManager.Instance.GetMonster(dexEntry.Promotions[ii].Result).GetColoredName() + ": " + dexEntry.Promotions[ii].GetReqString(), - new Loc(GraphicsManager.MenuBG.TileWidth * 2 + 8, GraphicsManager.MenuBG.TileHeight + VERT_SPACE * (validPromotions.Count + 5) + TitledStripMenu.TITLE_OFFSET), Color.Red)); + promoteReqText.Color = Color.Red; + validPromotions.Add(promoteReqText); + lineCount = promoteReqText.GetLineCount(); } } } @@ -102,8 +107,10 @@ public MemberInfoMenu(int teamSlot, bool assembly, bool allowAssembly) PromoteMethods = validPromotions.ToArray(); else { - PromoteMethods = new MenuText[1]; - PromoteMethods[0] = new MenuText(Text.FormatKey("MENU_TEAM_PROMOTE_NONE"), new Loc(GraphicsManager.MenuBG.TileWidth * 2, GraphicsManager.MenuBG.TileHeight + VERT_SPACE * 5 + TitledStripMenu.TITLE_OFFSET)); + PromoteMethods = new DialogueText[1]; + PromoteMethods[0] = new DialogueText(Text.FormatKey("MENU_TEAM_PROMOTE_NONE"), new Rect( + new Loc(GraphicsManager.MenuBG.TileWidth * 2, GraphicsManager.MenuBG.TileHeight + VERT_SPACE * 5 + TitledStripMenu.TITLE_OFFSET), + new Loc(Bounds.Width - GraphicsManager.MenuBG.TileWidth * 4, 0)), LINE_HEIGHT); } } @@ -121,7 +128,7 @@ public override IEnumerable GetElements() yield return MainDiv; yield return Promotions; - foreach (MenuText method in PromoteMethods) + foreach (DialogueText method in PromoteMethods) yield return method; } From efe0d8cbf4acd05e2258c32a79f6a988cbb8bc04 Mon Sep 17 00:00:00 2001 From: audino <2676737+audinowho@users.noreply.github.com> Date: Sun, 21 Apr 2024 09:35:53 -0800 Subject: [PATCH 10/16] optimize withdraw menu load time --- RogueEssence/Data/ItemData.cs | 19 +++++++++++++++++-- RogueEssence/Menu/Items/SwapGiveMenu.cs | 2 +- RogueEssence/Menu/Items/TradeItemMenu.cs | 2 +- RogueEssence/Menu/Items/TradeSummary.cs | 4 ++-- RogueEssence/Menu/Items/WithdrawMenu.cs | 2 +- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/RogueEssence/Data/ItemData.cs b/RogueEssence/Data/ItemData.cs index 46f984b5..63318f2f 100644 --- a/RogueEssence/Data/ItemData.cs +++ b/RogueEssence/Data/ItemData.cs @@ -63,7 +63,7 @@ public enum UseType public EntrySummary GenerateEntrySummary() { - ItemEntrySummary summary = new ItemEntrySummary(Name, Released, Comment, SortCategory, UsageType); + ItemEntrySummary summary = new ItemEntrySummary(Name, Released, Comment, SortCategory, Icon, UsageType); foreach (ItemState state in ItemStates) summary.States.Add(new FlagType(state.GetType())); return summary; @@ -199,6 +199,7 @@ public string GetIconName() [Serializable] public class ItemEntrySummary : EntrySummary { + public int Icon; public ItemData.UseType UsageType; public List States; @@ -207,8 +208,9 @@ public ItemEntrySummary() : base() States = new List(); } - public ItemEntrySummary(LocalText name, bool released, string comment, int sort, ItemData.UseType useType) : base(name, released, comment, sort) + public ItemEntrySummary(LocalText name, bool released, string comment, int sort, int icon, ItemData.UseType useType) : base(name, released, comment, sort) { + Icon = icon; UsageType = useType; States = new List(); } @@ -221,6 +223,19 @@ public override string GetColoredName() return String.Format("[color=#FFCEFF]{0}[color]", Name.ToLocal()); } + /// + /// Gets the colored text string of the item, with icon included + /// + /// + public string GetIconName() + { + string prefix = ""; + if (Icon > -1) + prefix += ((char)(Icon + 0xE0A0)).ToString(); + + return String.Format("{0}{1}", prefix, GetColoredName()); + } + public bool ContainsState() where T : ItemState { return ContainsState(typeof(T)); diff --git a/RogueEssence/Menu/Items/SwapGiveMenu.cs b/RogueEssence/Menu/Items/SwapGiveMenu.cs index 946328fc..15833577 100644 --- a/RogueEssence/Menu/Items/SwapGiveMenu.cs +++ b/RogueEssence/Menu/Items/SwapGiveMenu.cs @@ -49,7 +49,7 @@ public SwapGiveMenu(int defaultChoice, int openSpaces, OnMultiChoice chooseSlots { AllowedGoods.Add(key); - MenuText menuText = new MenuText(DataManager.Instance.GetItem(key).GetIconName(), new Loc(2, 1)); + MenuText menuText = new MenuText(itemEntry.GetIconName(), new Loc(2, 1)); MenuText menuCount = new MenuText("(" + itemPresence[key] + ")", new Loc(ItemMenu.ITEM_MENU_WIDTH - 8 * 4, 1), DirV.Up, DirH.Right, Color.White); flatChoices.Add(new MenuElementChoice(() => { }, true, menuText, menuCount)); } diff --git a/RogueEssence/Menu/Items/TradeItemMenu.cs b/RogueEssence/Menu/Items/TradeItemMenu.cs index fac52835..6679231a 100644 --- a/RogueEssence/Menu/Items/TradeItemMenu.cs +++ b/RogueEssence/Menu/Items/TradeItemMenu.cs @@ -50,7 +50,7 @@ public TradeItemMenu(int defaultChoice) AllowedGoods.Add(key); int slot = flatChoices.Count; - MenuText menuText = new MenuText(DataManager.Instance.GetItem(key).GetIconName(), new Loc(2, 1)); + MenuText menuText = new MenuText(itemEntry.GetIconName(), new Loc(2, 1)); MenuText menuCount = new MenuText("(" + itemPresence[key] + ")", new Loc(menuWidth - 8 * 4, 1), DirV.Up, DirH.Right, Color.White); flatChoices.Add(new MenuElementChoice(() => { choose(slot); }, true, menuText, menuCount)); } diff --git a/RogueEssence/Menu/Items/TradeSummary.cs b/RogueEssence/Menu/Items/TradeSummary.cs index 0f76905b..4a49a0ce 100644 --- a/RogueEssence/Menu/Items/TradeSummary.cs +++ b/RogueEssence/Menu/Items/TradeSummary.cs @@ -37,8 +37,8 @@ public void SetTrade(string[] tradeIns, int price, HashSet itemPresence, wildcards++; else { - ItemData entry = DataManager.Instance.GetItem(reqItem); - reqs.Add(new MenuText(entry.GetIconName(), Loc.Zero, itemPresence.Contains(reqItem) ? Color.White : Color.Red)); + ItemEntrySummary itemEntry = DataManager.Instance.DataIndices[DataManager.DataType.Item].Get(reqItem) as ItemEntrySummary; + reqs.Add(new MenuText(itemEntry.GetIconName(), Loc.Zero, itemPresence.Contains(reqItem) ? Color.White : Color.Red)); } } if (wildcards > 0) diff --git a/RogueEssence/Menu/Items/WithdrawMenu.cs b/RogueEssence/Menu/Items/WithdrawMenu.cs index a03fc2a2..a73e44cc 100644 --- a/RogueEssence/Menu/Items/WithdrawMenu.cs +++ b/RogueEssence/Menu/Items/WithdrawMenu.cs @@ -36,7 +36,7 @@ public WithdrawMenu(int defaultChoice, bool continueOnChoose, OnWithdrawChoice s { WithdrawSlot slot = new WithdrawSlot(false, key, 0); availableItems.Add(slot); - MenuText menuText = new MenuText(DataManager.Instance.GetItem(key).GetIconName(), new Loc(2, 1)); + MenuText menuText = new MenuText(((ItemEntrySummary)DataManager.Instance.DataIndices[DataManager.DataType.Item].Get(key)).GetIconName(), new Loc(2, 1)); MenuText menuCount = new MenuText("(" + qty + ")", new Loc(ItemMenu.ITEM_MENU_WIDTH - 8 * 4, 1), DirV.Up, DirH.Right, Color.White); flatChoices.Add(new MenuElementChoice(() => { choose(slot); }, true, menuText, menuCount)); } From 6c6157bbdffad226789172ac04e4369163acbbc4 Mon Sep 17 00:00:00 2001 From: audino <2676737+audinowho@users.noreply.github.com> Date: Mon, 22 Apr 2024 18:26:34 -0800 Subject: [PATCH 11/16] fix edge case when the song is short --- RogueEssence/Content/LoopedSong.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/RogueEssence/Content/LoopedSong.cs b/RogueEssence/Content/LoopedSong.cs index 68dba3c1..13ccabd2 100644 --- a/RogueEssence/Content/LoopedSong.cs +++ b/RogueEssence/Content/LoopedSong.cs @@ -197,6 +197,7 @@ internal void BufferNeeded(object sender, EventArgs args) private void queueBuffer() { + long origPosition = pcmPosition; int framesRead = FAudio.stb_vorbis_get_samples_float_interleaved(stbVorbisData, Channels, chunk, chunkSize); framesRead = (int)Math.Min(framesRead, loopEnd-pcmPosition); @@ -206,11 +207,13 @@ private void queueBuffer() pcmPosition += framesRead; } - if (loopEnd == pcmPosition) + if (pcmPosition == loopEnd) { FAudio.stb_vorbis_seek_frame(stbVorbisData, (uint)loopStart); pcmPosition = loopStart; - queueBuffer(); + + if (origPosition > loopStart) + queueBuffer(); } } From 76d407ef82f02340537e162e3d79cf13ce1a3c42 Mon Sep 17 00:00:00 2001 From: audino <2676737+audinowho@users.noreply.github.com> Date: Fri, 26 Apr 2024 09:07:59 -0800 Subject: [PATCH 12/16] swap menu fix --- RogueEssence/Menu/Items/SwapGiveMenu.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RogueEssence/Menu/Items/SwapGiveMenu.cs b/RogueEssence/Menu/Items/SwapGiveMenu.cs index 15833577..8ed05957 100644 --- a/RogueEssence/Menu/Items/SwapGiveMenu.cs +++ b/RogueEssence/Menu/Items/SwapGiveMenu.cs @@ -33,7 +33,7 @@ public SwapGiveMenu(int defaultChoice, int openSpaces, OnMultiChoice chooseSlots { Character activeChar = DataManager.Instance.Save.ActiveTeam.Players[ii]; if (!String.IsNullOrEmpty(activeChar.EquippedItem.ID)) - itemPresence[activeChar.EquippedItem.ID]++; + itemPresence[activeChar.EquippedItem.ID] = itemPresence.GetValueOrDefault(activeChar.EquippedItem.ID, 0) + 1; } List flatChoices = new List(); From 07156107ef0a1e4da4dcc59d601c3b4f1e459ae2 Mon Sep 17 00:00:00 2001 From: audino <2676737+audinowho@users.noreply.github.com> Date: Mon, 29 Apr 2024 15:18:25 -0800 Subject: [PATCH 13/16] SpreadRoomZoneStep obeys filters --- RogueEssence/LevelGen/Zones/ZoneSteps/SpreadRoomZoneStep.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RogueEssence/LevelGen/Zones/ZoneSteps/SpreadRoomZoneStep.cs b/RogueEssence/LevelGen/Zones/ZoneSteps/SpreadRoomZoneStep.cs index 6c0c6f9e..4709f9d5 100644 --- a/RogueEssence/LevelGen/Zones/ZoneSteps/SpreadRoomZoneStep.cs +++ b/RogueEssence/LevelGen/Zones/ZoneSteps/SpreadRoomZoneStep.cs @@ -60,12 +60,14 @@ protected override bool ApplyToFloor(ZoneGenContext zoneContext, IGenContext con if (specialStep.CanApply(context)) { specialStep.Rooms = new PresetPicker>(genDuo.GridOption); + specialStep.Filters = genDuo.Filters; specialStep.RoomComponents.Set(new ImmutableRoom()); queue.Enqueue(PriorityGrid, specialStep); } else if (listSpecialStep.CanApply(context)) { listSpecialStep.Rooms = new PresetPicker>(genDuo.ListOption); + listSpecialStep.Filters = genDuo.Filters; listSpecialStep.RoomComponents.Set(new ImmutableRoom()); PresetPicker> picker = new PresetPicker>(); picker.ToSpawn = new RoomGenAngledHall(0); From de59b1ef3ef49346320c67c79402af503a5334fb Mon Sep 17 00:00:00 2001 From: audino <2676737+audinowho@users.noreply.github.com> Date: Fri, 3 May 2024 14:20:26 -0800 Subject: [PATCH 14/16] Remove old conversion code --- RogueEssence/Data/DataManager.cs | 11 +--- RogueEssence/Dev/DevHelper.cs | 81 +----------------------------- RogueEssence/LevelGen/IFloorGen.cs | 46 ----------------- 3 files changed, 3 insertions(+), 135 deletions(-) diff --git a/RogueEssence/Data/DataManager.cs b/RogueEssence/Data/DataManager.cs index 5396628a..953419e4 100644 --- a/RogueEssence/Data/DataManager.cs +++ b/RogueEssence/Data/DataManager.cs @@ -333,16 +333,7 @@ public void InitBase() Version oldVersion = DevHelper.GetVersion(PathMod.ModPath(DATA_PATH + "Universal" + DATA_EXT)); - //TODO: Created v0.7.14, delete on v1.1 - if (oldVersion < new Version(0, 7, 14)) - { - object data = DataManager.LoadData(PathMod.ModPath(DataManager.DATA_PATH + "Universal" + DataManager.DATA_EXT)); - UniversalActiveEffect universalActiveEffect = new UniversalActiveEffect(); - universalActiveEffect.AddOther((ActiveEffect)data); - UniversalEvent = universalActiveEffect; - } - else - UniversalEvent = LoadData(PathMod.ModPath(DATA_PATH + "Universal" + DATA_EXT)); + UniversalEvent = LoadData(PathMod.ModPath(DATA_PATH + "Universal" + DATA_EXT)); UniversalData = LoadData>(PathMod.ModPath(MISC_PATH + "Index" + DATA_EXT)); LoadStartParams(); diff --git a/RogueEssence/Dev/DevHelper.cs b/RogueEssence/Dev/DevHelper.cs index 4bf7b3da..650be97f 100644 --- a/RogueEssence/Dev/DevHelper.cs +++ b/RogueEssence/Dev/DevHelper.cs @@ -392,56 +392,14 @@ public static string ReverseEndian(string str) public static void ReserializeBase() { { - //TODO: Created v0.5.20, delete on v1.1 - string dir = PathMod.HardMod(DataManager.DATA_PATH + "Universal.bin"); - if (File.Exists(dir)) - { - object data = DataManager.LoadData(PathMod.ModPath(DataManager.DATA_PATH + "Universal" + DataManager.DATA_EXT)); - DataManager.SaveData(PathMod.HardMod(DataManager.DATA_PATH + "Universal" + DataManager.DATA_EXT), data); - - File.Delete(dir); - } - } - - { - //TODO: Created v0.5.20, delete on v1.1 string dir = PathMod.HardMod(DataManager.DATA_PATH + "Universal" + DataManager.DATA_EXT); if (File.Exists(dir)) { - - Version oldVersion = GetVersion(dir); - //TODO: Created v0.7.14, delete on v1.1 - if (oldVersion < new Version(0, 7, 14)) - { - object data = DataManager.LoadData(PathMod.HardMod(DataManager.DATA_PATH + "Universal" + DataManager.DATA_EXT)); - UniversalActiveEffect universalActiveEffect = new UniversalActiveEffect(); - universalActiveEffect.AddOther((ActiveEffect)data); - DataManager.SaveData(PathMod.HardMod(DataManager.DATA_PATH + "Universal" + DataManager.DATA_EXT), universalActiveEffect); - } - else - { - object data = DataManager.LoadData(dir); - DataManager.SaveData(dir, data); - } - + object data = DataManager.LoadData(dir); + DataManager.SaveData(dir, data); } } - //TODO: Created v0.5.20, delete on v1.1 - foreach (string dir in PathMod.GetHardModFiles(DataManager.FX_PATH, "*.fx")) - { - object data; - if (Path.GetFileName(dir) == "NoCharge.fx") - data = DataManager.LoadData(dir); - else - data = DataManager.LoadData(dir); - - string fileName = Path.GetFileNameWithoutExtension(dir); - DataManager.SaveData(PathMod.HardMod(Path.Join(DataManager.FX_PATH, fileName + DataManager.DATA_EXT)), data); - - File.Delete(PathMod.HardMod(Path.Join(DataManager.FX_PATH, fileName + ".fx"))); - } - foreach (string dir in PathMod.GetModFiles(DataManager.FX_PATH, "*" + DataManager.DATA_EXT)) { object data; @@ -466,36 +424,7 @@ public static void Reserialize(DataManager.DataType conversionFlags) foreach (DataManager.DataType type in Enum.GetValues(typeof(DataManager.DataType))) { if (type != DataManager.DataType.All && (conversionFlags & type) != DataManager.DataType.None) - { - //TODO: Created v0.5.20, delete on v1.1 - foreach (string dir in PathMod.GetHardModFiles(DataManager.DATA_PATH + type.ToString() + "/", "*.bin")) - { - object data = DataManager.LoadData(dir, type.GetClassType()); - if (data != null) - { - string fileName = Path.GetFileNameWithoutExtension(dir); - if (data is MonsterData) - { - MonsterData monData = data as MonsterData; - int dexNum = 0; - foreach (string key in DataManager.Instance.Conversions[DataManager.DataType.Monster].Keys) - { - if (DataManager.Instance.Conversions[DataManager.DataType.Monster][key] == fileName) - { - Int32.TryParse(key, out dexNum); - break; - } - } - monData.IndexNum = dexNum; - } - DataManager.SaveData(PathMod.HardMod(Path.Join(DataManager.DATA_PATH + type.ToString() + "/", fileName + DataManager.DATA_EXT)), data); - - File.Delete(PathMod.HardMod(Path.Join(DataManager.DATA_PATH + type.ToString() + "/", fileName + ".bin"))); - } - } - ReserializeData(DataManager.DATA_PATH + type.ToString() + "/", DataManager.DATA_EXT, type.GetClassType()); - } } } @@ -536,15 +465,9 @@ public static void RunExtraIndexing(DataManager.DataType conversionFlags) { baseData.ReIndex(); DataManager.SaveData(PathMod.HardMod(DataManager.MISC_PATH + baseData.FileName + DataManager.DATA_EXT), baseData); - - //TODO: Created v0.5.20, delete on v1.1 - File.Delete(PathMod.HardMod(DataManager.MISC_PATH + baseData.FileName + ".bin")); } } DataManager.SaveData(PathMod.ModPath(DataManager.MISC_PATH + "Index" + DataManager.DATA_EXT), DataManager.Instance.UniversalData); - - //TODO: Created v0.5.20, delete on v1.1 - File.Delete(PathMod.HardMod(DataManager.MISC_PATH + "Index.bin")); } diff --git a/RogueEssence/LevelGen/IFloorGen.cs b/RogueEssence/LevelGen/IFloorGen.cs index 3eaddbd7..17d6bbb9 100644 --- a/RogueEssence/LevelGen/IFloorGen.cs +++ b/RogueEssence/LevelGen/IFloorGen.cs @@ -35,18 +35,6 @@ public override string ToString() } return String.Format("{0}: {1}", this.GetType().GetFormattedTypeName(), startInfo); } - - //TODO: Created v0.5.11, delete on v1.0.0 - [OnDeserialized] - internal void OnDeserializedMethod(StreamingContext context) - { - foreach (GenStep step in this.GenSteps.EnumerateInOrder()) - { - WaterStep waterStep = step as WaterStep; - if (waterStep != null && waterStep.TerrainStencil == null) - waterStep.TerrainStencil = new MapTerrainStencil(false, true, false, false); - } - } } /// @@ -78,18 +66,6 @@ public override string ToString() } return String.Format("{0}: {1}", this.GetType().GetFormattedTypeName(), startInfo); } - - //TODO: Created v0.5.11, delete on v1.0.0 - [OnDeserialized] - internal void OnDeserializedMethod(StreamingContext context) - { - foreach (GenStep step in this.GenSteps.EnumerateInOrder()) - { - WaterStep waterStep = step as WaterStep; - if (waterStep != null && waterStep.TerrainStencil == null) - waterStep.TerrainStencil = new MapTerrainStencil(false, true, false, false); - } - } } /// @@ -120,17 +96,6 @@ public override string ToString() return String.Format("{0}: {1}", this.GetType().GetFormattedTypeName(), startInfo); } - //TODO: Created v0.5.11, delete on v1.0.0 - [OnDeserialized] - internal void OnDeserializedMethod(StreamingContext context) - { - foreach (GenStep step in this.GenSteps.EnumerateInOrder()) - { - WaterStep waterStep = step as WaterStep; - if (waterStep != null && waterStep.TerrainStencil == null) - waterStep.TerrainStencil = new MapTerrainStencil(false, true, false, false); - } - } } /// @@ -161,17 +126,6 @@ public override string ToString() return String.Format("{0}: {1}", this.GetType().GetFormattedTypeName(), startInfo); } - //TODO: Created v0.5.11, delete on v1.0.0 - [OnDeserialized] - internal void OnDeserializedMethod(StreamingContext context) - { - foreach (GenStep step in this.GenSteps.EnumerateInOrder()) - { - WaterStep waterStep = step as WaterStep; - if (waterStep != null && waterStep.TerrainStencil == null) - waterStep.TerrainStencil = new MapTerrainStencil(false, true, false, false); - } - } } [Serializable] From 49812e1b6930f8d572b2abdb414085343681d1d0 Mon Sep 17 00:00:00 2001 From: audino <2676737+audinowho@users.noreply.github.com> Date: Fri, 3 May 2024 18:12:45 -0800 Subject: [PATCH 15/16] MoveShotUntilBlocked --- RogueEssence/Dungeon/DSceneMap.cs | 32 ++++++++++++------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/RogueEssence/Dungeon/DSceneMap.cs b/RogueEssence/Dungeon/DSceneMap.cs index a9971518..b8322283 100644 --- a/RogueEssence/Dungeon/DSceneMap.cs +++ b/RogueEssence/Dungeon/DSceneMap.cs @@ -1367,16 +1367,7 @@ public IEnumerator KnockBack(Character character, Dir8 dir, in //face direction character.CharDir = dir.Reverse(); - Loc endLoc = character.CharLoc; - - //move to the point at range. - for (int ii = 0; ii < range; ii++) - { - //if the next location is blocked, stop. - if (ShotBlocked(character, endLoc, dir, Alignment.None, true, true)) - break; - endLoc = endLoc + dir.GetLoc(); - } + Loc endLoc = DungeonScene.Instance.MoveShotUntilBlocked(character, character.CharLoc, dir, range, Alignment.None, true, true); yield return CoroutineManager.Instance.StartCoroutine(DungeonScene.Instance.ProcessBattleFX(character, character, DataManager.Instance.KnockbackFX)); @@ -1409,16 +1400,7 @@ public IEnumerator KnockBack(Character character, Dir8 dir, in public IEnumerator JumpTo(Character character, Dir8 dir, int range) { - Loc endLoc = character.CharLoc; - - //move to the point at range. - for (int ii = 0; ii < range; ii++) - { - //if the next location is blocked, stop. - if (ShotBlocked(character, endLoc, dir, Alignment.None, true, true)) - break; - endLoc = endLoc + dir.GetLoc(); - } + Loc endLoc = DungeonScene.Instance.MoveShotUntilBlocked(character, character.CharLoc, dir, range, Alignment.None, true, true); //if the location is occupied, keep moving while (ZoneManager.Instance.CurrentMap.GetCharAtLoc(endLoc) != null) @@ -1552,6 +1534,16 @@ public bool CanTeamSeeCharLoc(Team team, Loc loc) return false; } + public Loc MoveShotUntilBlocked(Character character, Loc loc, Dir8 dir, int range, Alignment blockedAlignments, bool useMobility, bool blockedByWall) + { + Loc endLoc = loc; + for (int ii = 0; ii < range; ii++) + { + if (!DungeonScene.Instance.ShotBlocked(character, endLoc, dir, blockedAlignments, useMobility, blockedByWall)) + endLoc = endLoc + dir.GetLoc(); + } + return endLoc; + } public bool ShotBlocked(Character character, Loc loc, Dir8 dir, Alignment blockedAlignments, bool useMobility, bool blockedByWall) { From f2b4087f23c6889f1aca2e686c9efb263b50e0a7 Mon Sep 17 00:00:00 2001 From: audino <2676737+audinowho@users.noreply.github.com> Date: Fri, 3 May 2024 18:32:21 -0800 Subject: [PATCH 16/16] fix TeamResultsMenu indexing --- RogueEssence/Menu/Records/TeamResultsMenu.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RogueEssence/Menu/Records/TeamResultsMenu.cs b/RogueEssence/Menu/Records/TeamResultsMenu.cs index 9907a7d7..efcb2083 100644 --- a/RogueEssence/Menu/Records/TeamResultsMenu.cs +++ b/RogueEssence/Menu/Records/TeamResultsMenu.cs @@ -152,7 +152,7 @@ protected override EventedList GetChars() { if (!Ending.ActiveTeam.Assembly[ii].Absentee) { - if (Page * 4 <= ii && ii < (Page + 1) * 4) + if (Page * 4 <= trueIdx && trueIdx < (Page + 1) * 4) { characters.Add(Ending.ActiveTeam.Assembly[ii]); if (characters.Count == 4)