From acf64fdd76e4864e870efc48c504729f2c2c76d4 Mon Sep 17 00:00:00 2001 From: Tirlititi Date: Mon, 18 Sep 2023 21:12:20 +0200 Subject: [PATCH] Small bug fixes --- Assembly-CSharp/Global/Dialog/Dialog.cs | 147 +++++------------- .../Global/Recycle/RecycleListPopulator.cs | 7 +- .../Assets/Text/EmbadedSentenseLoader.cs | 6 +- .../Memoria/Configuration/Memoria.ini | 2 +- .../Configuration/Structure/CheatsSection.cs | 2 +- Memoria.Launcher/Ini/Memoria.ini | 2 +- 6 files changed, 53 insertions(+), 113 deletions(-) diff --git a/Assembly-CSharp/Global/Dialog/Dialog.cs b/Assembly-CSharp/Global/Dialog/Dialog.cs index 9ab7684e3..39c6c67b9 100644 --- a/Assembly-CSharp/Global/Dialog/Dialog.cs +++ b/Assembly-CSharp/Global/Dialog/Dialog.cs @@ -988,20 +988,16 @@ private Single CalculateYPositionAfterHideTail(Single currentY, Boolean isTailUp private void FollowTarget() { - Single num; - Single num2; - ETb.GetMesPos(this.Po, out num, out num2); - Single num3 = num + Dialog.PosXOffset; - Single num4 = num2 + Dialog.PosYOffset; - Boolean flag = ((TailPosition)((Int32)this.tailPosition >> 1) & Dialog.TailPosition.LowerLeft) == Dialog.TailPosition.LowerLeft; - Boolean flag2 = (this.tailPosition & Dialog.TailPosition.LowerLeft) == Dialog.TailPosition.LowerLeft; - num3 = this.setPositionX(num3, this.size.x, flag2, true); - num4 = this.forceSetPositionY(num4, this.size.y, flag); - Dialog.CalculateDialogCenter(ref num3, ref num4, this.ClipSize); - this.tailMargin -= num3; - this.tailPosition = (Dialog.TailPosition)(Convert.ToInt32(flag) << 1 | Convert.ToInt32(flag2)); - num4 = this.CalculateYPositionAfterHideTail(num4, flag); - this.setAutoPosition(num3, num4); + ETb.GetMesPos(this.Po, out Single poPosX, out Single poPosY); + Single posX = poPosX + Dialog.PosXOffset; + Single posY = poPosY + Dialog.PosYOffset; + posX = this.setPositionX(posX, this.size.x, (this.tailPosition & TailPosition.LowerLeft) != 0, true); + posY = this.forceSetPositionY(posY, this.size.y, (this.tailPosition & TailPosition.UpperRight) != 0); + Dialog.CalculateDialogCenter(ref posX, ref posY, this.ClipSize); + this.tailMargin -= posX; + this.tailPosition &= TailPosition.LowerLeft | TailPosition.UpperRight; + posY = this.CalculateYPositionAfterHideTail(posY, (this.tailPosition & TailPosition.UpperRight) != 0); + this.setAutoPosition(posX, posY); this.setTailAutoPosition(this.tailPosition, true); } @@ -1019,47 +1015,40 @@ private static void CalculateDialogCenter(ref Single x0, ref Single y0, Vector2 private Single setPositionX(Single posX, Single width, Boolean isLeft, Boolean isUpdate) { - Single num; - Single num2; - Single num3; - if (isLeft) + Single tailX; + Single minX; + Single maxX; + if (isUpdate) { - num = posX - (Single)Dialog.DialogTailLeftRightOffset; - if (num < (Single)Dialog.DialogLimitLeft + Dialog.TailMagicNumber1) + if (isLeft && posX - Dialog.DialogTailLeftRightOffset <= Dialog.DialogLimitLeft + Dialog.TailMagicNumber1) { - num = (Single)Dialog.DialogLimitLeft + Dialog.TailMagicNumber1; + isLeft = false; + this.tailPosition = this.tailPosition & TailPosition.UpperRight; + this.setTailPosition(this.tailPosition); } - if (num > (Single)Dialog.DialogLimitRight - Dialog.TailMagicNumber2) + else if (!isLeft && posX + Dialog.DialogTailLeftRightOffset >= Dialog.DialogLimitRight - Dialog.TailMagicNumber1) { - num = (Single)Dialog.DialogLimitRight - Dialog.TailMagicNumber2; + isLeft = true; + this.tailPosition = (this.tailPosition & TailPosition.UpperRight) | TailPosition.LowerLeft; + this.setTailPosition(this.tailPosition); } - num2 = num + Dialog.TailMagicNumber2 - width; - num3 = num - Dialog.TailMagicNumber1; } - else - { - num = posX + (Single)Dialog.DialogTailLeftRightOffset; - if (num > (Single)Dialog.DialogLimitRight - Dialog.TailMagicNumber1) - { - num = (Single)Dialog.DialogLimitRight - Dialog.TailMagicNumber1; - } - if (num < (Single)Dialog.DialogLimitLeft + Dialog.TailMagicNumber2) - { - num = (Single)Dialog.DialogLimitLeft + Dialog.TailMagicNumber2; - } - num2 = num + Dialog.TailMagicNumber1 - width; - num3 = num - Dialog.TailMagicNumber2; - } - this.tailMargin = num; - if (num2 < (Single)Dialog.DialogLimitLeft) + if (isLeft) { - num2 = (Single)Dialog.DialogLimitLeft; + tailX = Mathf.Clamp(posX - Dialog.DialogTailLeftRightOffset, Dialog.DialogLimitLeft + Dialog.TailMagicNumber1, Dialog.DialogLimitRight - Dialog.TailMagicNumber2); + minX = tailX + Dialog.TailMagicNumber2 - width; + maxX = tailX - Dialog.TailMagicNumber1; } - if (num3 > (Single)Dialog.DialogLimitRight - width) + else { - num3 = (Single)Dialog.DialogLimitRight - width; + tailX = Mathf.Clamp(posX + Dialog.DialogTailLeftRightOffset, Dialog.DialogLimitLeft + Dialog.TailMagicNumber2, Dialog.DialogLimitRight - Dialog.TailMagicNumber1); + minX = tailX + Dialog.TailMagicNumber1 - width; + maxX = tailX - Dialog.TailMagicNumber2; } - return (num2 + num3) / 2f; + this.tailMargin = tailX; + minX = Math.Max(minX, Dialog.DialogLimitLeft); + maxX = Math.Min(maxX, Dialog.DialogLimitRight - width); + return (minX + maxX) / 2f; } private Single setPositionY(Single posY, Single height, ref Boolean isUpper) @@ -1781,14 +1770,11 @@ private String OverwritePrerenderText(String text) [SerializeField] private Int32 chooseMask; - private List choiceList; - private List maskChoiceList; [SerializeField] private List disableIndexes; - private List activeIndexes; public static String DialogGroupButton; @@ -1801,11 +1787,11 @@ private String OverwritePrerenderText(String text) private Boolean isChoiceReady; public static Byte DialogMaximumDepth = 68; - public static Byte DialogAdditionalRaiseDepth = 22; private static Byte[] DialogTextAnimationTick = new Byte[] { + // The "Field Message" speed (eg. the slowest is the same as defaulting message speeds to [SPED=4]) 4, 7, 10, @@ -1817,67 +1803,47 @@ private String OverwritePrerenderText(String text) }; public Dialog.DialogIntDelegate AfterDialogHidden; - public Dialog.DialogIntDelegate AfterDialogShown; - public Dialog.DialogVoidDelegate AfterDialogSentenseShown; [NonSerialized] public Dialog.OnSelectedOptionChangeDelegate OnOptionChange = null; public GameObject BodyGameObject; - public GameObject BorderGameObject; - public GameObject CaptionGameObject; - public GameObject PhraseGameObject; - public GameObject TailGameObject; - public GameObject ChooseContainerGameObject; - public UIPanel phrasePanel; public static readonly Int32 WindowMinWidth = (Int32)(UIManager.ResourceXMultipier * 32f); - public static readonly Int32 AdjustWidth = (Int32)(UIManager.ResourceXMultipier * 3f); public static readonly Int32 DialogOffsetY = (Int32)(UIManager.ResourceYMultipier * 20f); public static readonly Int32 DialogLimitLeft = (Int32)(UIManager.ResourceXMultipier * 8f); - - public static readonly Int32 DialogLimitRight = (Int32)(UIManager.ResourceXMultipier * 312f); - + public static readonly Int32 DialogLimitRight = (Int32)(UIManager.ResourceXMultipier * (FieldMap.PsxScreenWidth - 8f)); public static readonly Int32 DialogLimitTop = (Int32)(UIManager.ResourceYMultipier * 8f); - public static readonly Int32 DialogLimitBottom = (Int32)(UIManager.ResourceYMultipier * 208f); public static readonly Int32 DialogTailLeftRightOffset = (Int32)(UIManager.ResourceXMultipier * 6f); - public static readonly Int32 DialogTailTopOffset = (Int32)(UIManager.ResourceYMultipier * 16f); - public static readonly Int32 DialogTailBottomOffset = (Int32)(UIManager.ResourceYMultipier * 32f); public static readonly Int32 kCenterX = (Int32)(UIManager.ResourceXMultipier * FieldMap.HalfScreenWidth); - public static readonly Int32 kCenterY = (Int32)(UIManager.ResourceYMultipier * FieldMap.HalfScreenHeight); - public static readonly Int32 kDialogY = (Int32)(UIManager.ResourceYMultipier * 150f); - public static readonly Single TailMagicNumber1 = (Single)((Int32)(24f * UIManager.ResourceXMultipier)); - - public static readonly Single TailMagicNumber2 = (Single)((Int32)(8f * UIManager.ResourceXMultipier)); + public static readonly Single TailMagicNumber1 = (Int32)(24f * UIManager.ResourceXMultipier); + public static readonly Single TailMagicNumber2 = (Int32)(8f * UIManager.ResourceXMultipier); public static readonly Single PosXOffset = -2f; - public static readonly Single kUpperOffset = (Single)Dialog.DialogTailTopOffset; - + public static readonly Single kUpperOffset = Dialog.DialogTailTopOffset; public static readonly Single kLimitTop = 24f; - - public static readonly Single kLowerOffset = (Single)(Dialog.DialogTailBottomOffset * 3 / 4); - - public static readonly Single kLimitBottom = (Single)(Dialog.DialogLimitBottom - 4); + public static readonly Single kLowerOffset = Dialog.DialogTailBottomOffset * 3 / 4; + public static readonly Single kLimitBottom = Dialog.DialogLimitBottom - 4; public static readonly Single kMargin = UIManager.ResourceXMultipier * 5f; @@ -1888,37 +1854,25 @@ private String OverwritePrerenderText(String text) public static readonly Single DialogLineHeight = 68f; public static readonly Single DialogYPadding = 80f; - public static readonly Single DialogXPadding = 18f; - public static readonly Single BorderPadding = 18f; public static readonly Single DialogPhraseXPadding = 16f; - public static readonly Single DialogPhraseYPadding = 20f; public static readonly Int32 FF9TextSpeedRatio = 2; private Transform bodyTransform; - private Transform tailTransform; private UISprite bodySprite; - private UISprite borderSprite; - private UISprite tailSprite; - private UIPanel clipPanel; - private UIWidget phraseWidget; - private UILabel phraseLabel; - private UILabel captionLabel; - private TypewriterEffect phraseEffect; - private DialogAnimator dialogAnimator; [SerializeField] @@ -1940,11 +1894,8 @@ private String OverwritePrerenderText(String text) private Dialog.State currentState; private Boolean isForceTailPosition; - private Single tailMargin; - private Single originalWidth; - private Int32 lineNumber; private Vector2 size = Vector2.zero; @@ -1957,14 +1908,12 @@ private String OverwritePrerenderText(String text) [SerializeField] private String phrase = String.Empty; - private String phraseMessageValue = String.Empty; [SerializeField] private List subPage = new List(); private String caption = String.Empty; - private Dialog.CaptionType capType; [SerializeField] @@ -1979,7 +1928,6 @@ private String OverwritePrerenderText(String text) private Boolean isNeedResetChoice = true; private Single dialogShowTime; - private Single dialogHideTime; [NonSerialized] @@ -1990,7 +1938,6 @@ private String OverwritePrerenderText(String text) private Boolean typeAnimationEffect = true; private Dictionary messageSpeed = new Dictionary(); - private Dictionary messageWait = new Dictionary(); [SerializeField] @@ -2014,7 +1961,6 @@ private String OverwritePrerenderText(String text) private Boolean focusToActor = true; private Int32 signalNumber; - private Int32 signalMode; private Dictionary messageValues = new Dictionary(); @@ -2038,23 +1984,14 @@ private String OverwritePrerenderText(String text) public class DialogImage { public Int32 Id; - public Vector2 Size; - public Int32 TextPosition; - public Int32 PrintedLine; - public Vector3 LocalPosition; - public Vector3 Offset; - public Boolean IsShown; - public Boolean checkFromConfig = true; - public Boolean IsButton = true; - public String tag = String.Empty; } @@ -2116,8 +2053,6 @@ public enum WindowID } public delegate void DialogVoidDelegate(); - public delegate void DialogIntDelegate(Int32 choice); - public delegate void OnSelectedOptionChangeDelegate(Int32 msg, Int32 optionIndex); } diff --git a/Assembly-CSharp/Global/Recycle/RecycleListPopulator.cs b/Assembly-CSharp/Global/Recycle/RecycleListPopulator.cs index 0f336087c..24b83b458 100644 --- a/Assembly-CSharp/Global/Recycle/RecycleListPopulator.cs +++ b/Assembly-CSharp/Global/Recycle/RecycleListPopulator.cs @@ -265,8 +265,9 @@ private void RepositionList() { this.table.Reposition(); this.draggablePanel.SetDragAmount(0f, 0f, false); - // The "pivotOffset" pick is a bit hacky there... not sure on what it should be based instead - Vector2 pivotOffset = PersistenSingleton.Instance.State == UIManager.UIState.BattleHUD ? new Vector2(0f, 0.5f) : new Vector2(0.5f, 0.5f); + // A bit hacky there... not sure on what it should be based instead + Single extraOffset = PersistenSingleton.Instance.State == UIManager.UIState.BattleHUD ? -this.panel.width / 2f : 0f; + Vector2 pivotOffset = new Vector2(0.5f, 0.5f); foreach (KeyValuePair kvp in this.dataTracker) { Int32 lineNo = kvp.Key / this.Column; @@ -274,7 +275,7 @@ private void RepositionList() Transform poolObj = this.itemsPool[kvp.Value]; if (this.startNumber > 0) lineNo -= this.startNumber / this.Column; - Single posX = this.table.padding.x + pivotOffset.x * poolObj.GetComponent().width + columnNo * (2 * this.table.padding.x + poolObj.GetComponent().width); + Single posX = this.table.padding.x + pivotOffset.x * poolObj.GetComponent().width + columnNo * (2 * this.table.padding.x + poolObj.GetComponent().width) + extraOffset; Single posY = this.table.padding.y + pivotOffset.y * this.cellHeight + lineNo * (2 * this.table.padding.y + this.cellHeight); poolObj.localPosition = new Vector3(posX, -posY, poolObj.localPosition.z); } diff --git a/Assembly-CSharp/Memoria/Assets/Text/EmbadedSentenseLoader.cs b/Assembly-CSharp/Memoria/Assets/Text/EmbadedSentenseLoader.cs index 7a2f4eca9..7c117684c 100644 --- a/Assembly-CSharp/Memoria/Assets/Text/EmbadedSentenseLoader.cs +++ b/Assembly-CSharp/Memoria/Assets/Text/EmbadedSentenseLoader.cs @@ -17,7 +17,11 @@ public static String LoadText(String path) public static String[] ExtractSentenseEnd(String text) { - return text.Split(DELIM, StringSplitOptions.None); + String[] split = text.Split(DELIM, StringSplitOptions.None); + int oldsize = split.Length; + if (split.Length > 0 && text.EndsWith(DELIM[0])) + Array.Resize(ref split, split.Length - 1); + return split; } private static readonly String[] DELIM = new[] { "[ENDN]" }; diff --git a/Assembly-CSharp/Memoria/Configuration/Memoria.ini b/Assembly-CSharp/Memoria/Configuration/Memoria.ini index d23b806da..9c48adb45 100644 --- a/Assembly-CSharp/Memoria/Configuration/Memoria.ini +++ b/Assembly-CSharp/Memoria/Configuration/Memoria.ini @@ -145,7 +145,7 @@ HideSteam = 0 ; Rotation (default 1) ? ; Perspective (default 1) ? ; SpeedMode (default 1) F1 - Speed mode - ; SpeedFactor (default 1) Speed mode multiplier + ; SpeedFactor (default 3) Speed mode multiplier ; SpeedTimer (default 0) Speed up Hot & Cold and other timed mini-games when Speed mode is activate ; BattleAssistance (default 0) F2 - Gives transe to your characters ; Attack9999 (default 0) F3 - All your attacks inflict 9999 diff --git a/Assembly-CSharp/Memoria/Configuration/Structure/CheatsSection.cs b/Assembly-CSharp/Memoria/Configuration/Structure/CheatsSection.cs index 42d6c5ece..44af2cad0 100644 --- a/Assembly-CSharp/Memoria/Configuration/Structure/CheatsSection.cs +++ b/Assembly-CSharp/Memoria/Configuration/Structure/CheatsSection.cs @@ -28,7 +28,7 @@ public CheatsSection() : base(nameof(CheatsSection), false) Perspective = BindBoolean(nameof(Perspective), false); SpeedMode = BindBoolean(nameof(SpeedMode), false); - SpeedFactor = BindInt32(nameof(SpeedFactor), 5); + SpeedFactor = BindInt32(nameof(SpeedFactor), 3); SpeedTimer = BindBoolean(nameof(SpeedTimer), false); BattleAssistance = BindBoolean(nameof(BattleAssistance), false); diff --git a/Memoria.Launcher/Ini/Memoria.ini b/Memoria.Launcher/Ini/Memoria.ini index d23b806da..9c48adb45 100644 --- a/Memoria.Launcher/Ini/Memoria.ini +++ b/Memoria.Launcher/Ini/Memoria.ini @@ -145,7 +145,7 @@ HideSteam = 0 ; Rotation (default 1) ? ; Perspective (default 1) ? ; SpeedMode (default 1) F1 - Speed mode - ; SpeedFactor (default 1) Speed mode multiplier + ; SpeedFactor (default 3) Speed mode multiplier ; SpeedTimer (default 0) Speed up Hot & Cold and other timed mini-games when Speed mode is activate ; BattleAssistance (default 0) F2 - Gives transe to your characters ; Attack9999 (default 0) F3 - All your attacks inflict 9999