Update types in FlyText

This commit is contained in:
Raymond 2021-08-15 15:02:16 -04:00
parent 3683ae148e
commit de0b933869
2 changed files with 18 additions and 18 deletions

View file

@ -70,7 +70,7 @@ namespace Dalamud.Game.Gui.FlyText
/// </summary> /// </summary>
private delegate IntPtr CreateFlyTextDelegate( private delegate IntPtr CreateFlyTextDelegate(
IntPtr addonFlyText, IntPtr addonFlyText,
int kind, FlyTextKind kind,
int val1, int val1,
int val2, int val2,
IntPtr text2, IntPtr text2,
@ -126,10 +126,10 @@ namespace Dalamud.Game.Gui.FlyText
public unsafe void AddFlyText(FlyTextKind kind, uint actorIndex, uint val1, uint val2, SeString text1, SeString text2, uint color, uint icon) public unsafe void AddFlyText(FlyTextKind kind, uint actorIndex, uint val1, uint val2, SeString text1, SeString text2, uint color, uint icon)
{ {
// Known valid flytext region within the atk arrays // Known valid flytext region within the atk arrays
int numIndex = 28; var numIndex = 28;
int strIndex = 25; var strIndex = 25;
uint numOffset = 147; var numOffset = 147u;
uint strOffset = 28; var strOffset = 28u;
// Get the UI module and flytext addon pointers // Get the UI module and flytext addon pointers
var ui = (UIModule*)this.Dalamud.Framework.Gui.GetUIModule(); var ui = (UIModule*)this.Dalamud.Framework.Gui.GetUIModule();
@ -195,7 +195,7 @@ namespace Dalamud.Game.Gui.FlyText
private IntPtr CreateFlyTextDetour( private IntPtr CreateFlyTextDetour(
IntPtr addonFlyText, IntPtr addonFlyText,
int kind, FlyTextKind kind,
int val1, int val1,
int val2, int val2,
IntPtr text2, IntPtr text2,
@ -211,7 +211,7 @@ namespace Dalamud.Game.Gui.FlyText
var handled = false; var handled = false;
var tmpKind = (FlyTextKind)kind; var tmpKind = kind;
var tmpVal1 = val1; var tmpVal1 = val1;
var tmpVal2 = val2; var tmpVal2 = val2;
var tmpText1 = MemoryHelper.ReadSeStringNullTerminated(text1); var tmpText1 = MemoryHelper.ReadSeStringNullTerminated(text1);
@ -224,7 +224,7 @@ namespace Dalamud.Game.Gui.FlyText
var cmpText2 = tmpText2.ToString(); var cmpText2 = tmpText2.ToString();
Log.Verbose($"[FlyText] Called with addonFlyText({addonFlyText.ToInt64():X}) " + Log.Verbose($"[FlyText] Called with addonFlyText({addonFlyText.ToInt64():X}) " +
$"kind({((FlyTextKind)kind).ToString()}) val1({val1}) val2({val2}) " + $"kind({kind}) val1({val1}) val2({val2}) " +
$"text1({text1.ToInt64():X}, \"{tmpText1}\") text2({text2.ToInt64():X}, \"{tmpText2}\") " + $"text1({text1.ToInt64():X}, \"{tmpText1}\") text2({text2.ToInt64():X}, \"{tmpText2}\") " +
$"color({color:X}) icon({icon}) yOffset({yOffset})"); $"color({color:X}) icon({icon}) yOffset({yOffset})");
Log.Verbose("[FlyText] Calling flytext events!"); Log.Verbose("[FlyText] Calling flytext events!");
@ -250,14 +250,14 @@ namespace Dalamud.Game.Gui.FlyText
} }
// Check if any values have changed // Check if any values have changed
var dirty = tmpKind != (FlyTextKind)kind || var dirty = tmpKind != kind ||
tmpVal1 != val1 || tmpVal1 != val1 ||
tmpVal2 != val2 || tmpVal2 != val2 ||
tmpText1.ToString() != cmpText1 || tmpText1.ToString() != cmpText1 ||
tmpText2.ToString() != cmpText2 || tmpText2.ToString() != cmpText2 ||
tmpColor != color || tmpColor != color ||
tmpIcon != icon || tmpIcon != icon ||
Math.Abs(tmpYOffset - yOffset) > float.Epsilon; Math.Abs(tmpYOffset - yOffset) > float.Epsilon;
// If not dirty, make the original call // If not dirty, make the original call
if (!dirty) if (!dirty)
@ -276,7 +276,7 @@ namespace Dalamud.Game.Gui.FlyText
retVal = this.createFlyTextHook.Original( retVal = this.createFlyTextHook.Original(
addonFlyText, addonFlyText,
(int)tmpKind, tmpKind,
tmpVal1, tmpVal1,
tmpVal2, tmpVal2,
pText2, pText2,

View file

@ -4,7 +4,7 @@ namespace Dalamud.Game.Gui.FlyText
/// Enum of FlyTextKind values. Members suffixed with /// Enum of FlyTextKind values. Members suffixed with
/// a number seem to be a duplicate, or perform duplicate behavior. /// a number seem to be a duplicate, or perform duplicate behavior.
/// </summary> /// </summary>
public enum FlyTextKind public enum FlyTextKind : int
{ {
/// <summary> /// <summary>
/// Val1 in serif font, Text2 in sans-serif as subtitle. /// Val1 in serif font, Text2 in sans-serif as subtitle.