fix: check drawobject instead of coords for vis
This commit is contained in:
parent
062553acae
commit
34cbffb2b8
|
@ -2,6 +2,7 @@ using System.Numerics;
|
|||
using Dalamud.Game.ClientState.Objects.SubKinds;
|
||||
using Dalamud.Utility;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Housing;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Object;
|
||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Environment;
|
||||
using FFXIVClientStructs.FFXIV.Client.System.Framework;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||
|
@ -75,7 +76,13 @@ public class ScreenshotMetadata {
|
|||
var visible = plugin.ObjectTable
|
||||
.Where(obj => obj is PlayerCharacter)
|
||||
.Cast<PlayerCharacter>()
|
||||
.Where(chara => plugin.GameGui.WorldToScreen(chara.Position, out _, out var inView) && inView)
|
||||
// .Where(chara => plugin.GameGui.WorldToScreen(chara.Position, out _, out var inView) && inView)
|
||||
.Where(chara => {
|
||||
unsafe {
|
||||
var obj = (GameObject*) chara.Address;
|
||||
return obj->DrawObject->IsVisible;
|
||||
}
|
||||
})
|
||||
.Select(chara => new Character(chara, scale, offsetX, offsetY))
|
||||
.ToArray();
|
||||
|
||||
|
@ -117,34 +124,29 @@ public class Character {
|
|||
this.HomeWorldId = player.HomeWorld.Id;
|
||||
this.RawPosition = player.Position;
|
||||
this.MapPosition = new Vector3(
|
||||
ConvertRawPositionToMapCoordinate((int) player.Position.X, scale, offsetX),
|
||||
ConvertRawPositionToMapCoordinate((int) player.Position.Z, scale, offsetY),
|
||||
ConvertRawPositionToMapCoordinate((int) player.Position.Y, scale, 0)
|
||||
ConvertRawPositionToMapCoordinate(player.Position.X * 1_000, scale, offsetX),
|
||||
ConvertRawPositionToMapCoordinate(player.Position.Z * 1_000, scale, offsetY),
|
||||
player.Position.Y // TODO: how does map Z coord work
|
||||
);
|
||||
this.Level = player.Level;
|
||||
this.Job = player.ClassJob.GameData?.Name.ToDalamudString().TextValue ?? ScreenshotMetadata.Unknown;
|
||||
this.JobId = player.ClassJob.Id;
|
||||
}
|
||||
|
||||
private static float ConvertRawPositionToMapCoordinate(int pos, float scale, short offset) {
|
||||
private static float ConvertRawPositionToMapCoordinate(float pos, float scale, short offset) {
|
||||
var num1 = scale / 100f;
|
||||
var num2 = (pos / 1000f + offset) * num1;
|
||||
return (float) (41.0 / num1 * ((num2 + 1024.0) / 2048.0) + 1.0);
|
||||
}
|
||||
|
||||
private static int ConvertMapCoordinateToRawPosition(float pos, float scale, short offset) {
|
||||
var num = scale / 100f;
|
||||
return (int) ((float) ((pos - 1.0) * num / 41.0 * 2048.0 - 1024.0) / num * 1000f) - offset * 1000;
|
||||
}
|
||||
}
|
||||
|
||||
public struct EorzeaTime {
|
||||
public ulong Year;
|
||||
public ulong Month;
|
||||
public ulong Day;
|
||||
public ulong Hour;
|
||||
public ulong Minute;
|
||||
public ulong Second;
|
||||
public readonly ulong Year;
|
||||
public readonly ulong Month;
|
||||
public readonly ulong Day;
|
||||
public readonly ulong Hour;
|
||||
public readonly ulong Minute;
|
||||
public readonly ulong Second;
|
||||
|
||||
private const double EorzeaTimeConst = (double) 3600 / 175;
|
||||
private const double YearConst = 33177600;
|
||||
|
|
Loading…
Reference in New Issue