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

View file

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