Added new AutomapOffsets property.

This Vector2 property allows you visually offset the XY position of an actors' sprites on the automap.
This commit is contained in:
inkoalawetrust 2024-01-27 04:19:05 +02:00 committed by Rachael Alexanderson
parent b3fabb0a7e
commit 56803317f5
5 changed files with 11 additions and 3 deletions

View file

@ -2952,7 +2952,8 @@ void DAutomap::drawThings ()
if (am_cheat > 0 || !(t->flags6 & MF6_NOTONAUTOMAP)
|| (am_thingrenderstyles && !(t->renderflags & RF_INVISIBLE) && !(t->flags6 & MF6_NOTONAUTOMAP)))
{
DVector3 pos = t->InterpolatedPosition(r_viewpoint.TicFrac) + t->Level->Displacements.getOffset(sec.PortalGroup, MapPortalGroup);
DVector3 fracPos = t->InterpolatedPosition(r_viewpoint.TicFrac);
FVector2 pos = FVector2(float(fracPos.X),float(fracPos.Y)) + FVector2(t->Level->Displacements.getOffset(sec.PortalGroup, MapPortalGroup)) + FVector2(t->AutomapOffsets);
p.x = pos.X;
p.y = pos.Y;
@ -2969,7 +2970,7 @@ void DAutomap::drawThings ()
const size_t spriteIndex = sprite.spriteframes + (show > 1 ? t->frame : 0);
frame = &SpriteFrames[spriteIndex];
DAngle angle = DAngle::fromDeg(270. + 22.5) - t->InterpolatedAngles(r_viewpoint.TicFrac).Yaw - t->SpriteRotation;
DAngle angle = DAngle::fromDeg(270.) - t->InterpolatedAngles(r_viewpoint.TicFrac).Yaw - t->SpriteRotation;
if (frame->Texture[0] != frame->Texture[1]) angle += DAngle::fromDeg(180. / 16);
if (am_rotate == 1 || (am_rotate == 2 && viewactive))
{

View file

@ -80,7 +80,6 @@ xx(__decorate_internal_float__)
// Per-actor sound channels (for deprecated PlaySoundEx function) Do not separate this block!!!
xx(Auto)
xx(Weapon)
xx(BobPivot3D)
xx(Voice)
xx(Item)
xx(Body)
@ -88,6 +87,9 @@ xx(SoundSlot5)
xx(SoundSlot6)
xx(SoundSlot7)
// Actor properties
xx(BobPivot3D)
xx(LevelLocals)
xx(Level)

View file

@ -1103,6 +1103,7 @@ public:
DAngle SpriteAngle;
DAngle SpriteRotation;
DVector2 AutomapOffsets; // Offset the actors' sprite view on the automap by these coordinates.
DRotator Angles;
DRotator ViewAngles; // Angle offsets for cameras
TObjPtr<DViewPosition*> ViewPos; // Position offsets for cameras

View file

@ -2141,6 +2141,7 @@ DEFINE_FIELD_NAMED(AActor, ViewAngles.Roll, viewroll)
DEFINE_FIELD(AActor, LightLevel)
DEFINE_FIELD(AActor, ShadowAimFactor)
DEFINE_FIELD(AActor, ShadowPenaltyFactor)
DEFINE_FIELD(AActor, AutomapOffsets)
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, thing);
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, pos);

View file

@ -260,6 +260,7 @@ class Actor : Thinker native
native readonly int SpawnTime;
private native int InventoryID; // internal counter.
native uint freezetics;
native Vector2 AutomapOffsets;
meta String Obituary; // Player was killed by this actor
meta String HitObituary; // Player was killed by this actor in melee
@ -364,6 +365,7 @@ class Actor : Thinker native
property LightLevel: LightLevel;
property ShadowAimFactor: ShadowAimFactor;
property ShadowPenaltyFactor: ShadowPenaltyFactor;
property AutomapOffsets : AutomapOffsets;
// need some definition work first
//FRenderStyle RenderStyle;
@ -443,6 +445,7 @@ class Actor : Thinker native
SelfDamageFactor 1;
ShadowAimFactor 1;
ShadowPenaltyFactor 1;
AutomapOffsets (0,0);
StealthAlpha 0;
WoundHealth 6;
GibHealth int.min;