Skip to content

Commit

Permalink
Small bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tirlititi committed Sep 18, 2023
1 parent 935e207 commit acf64fd
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 113 deletions.
147 changes: 41 additions & 106 deletions Assembly-CSharp/Global/Dialog/Dialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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)
Expand Down Expand Up @@ -1781,14 +1770,11 @@ private String OverwritePrerenderText(String text)

[SerializeField]
private Int32 chooseMask;

private List<GameObject> choiceList;

private List<GameObject> maskChoiceList;

[SerializeField]
private List<Int32> disableIndexes;

private List<Int32> activeIndexes;

public static String DialogGroupButton;
Expand All @@ -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,
Expand All @@ -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;

Expand All @@ -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]
Expand All @@ -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;
Expand All @@ -1957,14 +1908,12 @@ private String OverwritePrerenderText(String text)

[SerializeField]
private String phrase = String.Empty;

private String phraseMessageValue = String.Empty;

[SerializeField]
private List<String> subPage = new List<String>();

private String caption = String.Empty;

private Dialog.CaptionType capType;

[SerializeField]
Expand All @@ -1979,7 +1928,6 @@ private String OverwritePrerenderText(String text)
private Boolean isNeedResetChoice = true;

private Single dialogShowTime;

private Single dialogHideTime;

[NonSerialized]
Expand All @@ -1990,7 +1938,6 @@ private String OverwritePrerenderText(String text)
private Boolean typeAnimationEffect = true;

private Dictionary<Int32, Single> messageSpeed = new Dictionary<Int32, Single>();

private Dictionary<Int32, Single> messageWait = new Dictionary<Int32, Single>();

[SerializeField]
Expand All @@ -2014,7 +1961,6 @@ private String OverwritePrerenderText(String text)
private Boolean focusToActor = true;

private Int32 signalNumber;

private Int32 signalMode;

private Dictionary<Int32, Int32> messageValues = new Dictionary<Int32, Int32>();
Expand All @@ -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;
}

Expand Down Expand Up @@ -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);
}
7 changes: 4 additions & 3 deletions Assembly-CSharp/Global/Recycle/RecycleListPopulator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,16 +265,17 @@ 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<UIManager>.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<UIManager>.Instance.State == UIManager.UIState.BattleHUD ? -this.panel.width / 2f : 0f;
Vector2 pivotOffset = new Vector2(0.5f, 0.5f);
foreach (KeyValuePair<Int32, Int32> kvp in this.dataTracker)
{
Int32 lineNo = kvp.Key / this.Column;
Int32 columnNo = kvp.Key % this.Column;
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<UIWidget>().width + columnNo * (2 * this.table.padding.x + poolObj.GetComponent<UIWidget>().width);
Single posX = this.table.padding.x + pivotOffset.x * poolObj.GetComponent<UIWidget>().width + columnNo * (2 * this.table.padding.x + poolObj.GetComponent<UIWidget>().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);
}
Expand Down
6 changes: 5 additions & 1 deletion Assembly-CSharp/Memoria/Assets/Text/EmbadedSentenseLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]" };
Expand Down
2 changes: 1 addition & 1 deletion Assembly-CSharp/Memoria/Configuration/Memoria.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Memoria.Launcher/Ini/Memoria.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit acf64fd

Please sign in to comment.