From 56803317f50916f9680235329b8b083c357ed055 Mon Sep 17 00:00:00 2001 From: inkoalawetrust <56005600+inkoalawetrust@users.noreply.github.com> Date: Sat, 27 Jan 2024 04:19:05 +0200 Subject: [PATCH] Added new AutomapOffsets property. This Vector2 property allows you visually offset the XY position of an actors' sprites on the automap. --- src/am_map.cpp | 5 +++-- src/common/engine/namedef.h | 4 +++- src/playsim/actor.h | 1 + src/scripting/vmthunks_actors.cpp | 1 + wadsrc/static/zscript/actors/actor.zs | 3 +++ 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index 8d6cecdc87..8414b598d0 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -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)) { diff --git a/src/common/engine/namedef.h b/src/common/engine/namedef.h index f857e93205..89ee863eab 100644 --- a/src/common/engine/namedef.h +++ b/src/common/engine/namedef.h @@ -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) diff --git a/src/playsim/actor.h b/src/playsim/actor.h index d7b51b45ac..35fc44598a 100644 --- a/src/playsim/actor.h +++ b/src/playsim/actor.h @@ -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 ViewPos; // Position offsets for cameras diff --git a/src/scripting/vmthunks_actors.cpp b/src/scripting/vmthunks_actors.cpp index 34bbe6e74d..4879d9b3a2 100644 --- a/src/scripting/vmthunks_actors.cpp +++ b/src/scripting/vmthunks_actors.cpp @@ -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); diff --git a/wadsrc/static/zscript/actors/actor.zs b/wadsrc/static/zscript/actors/actor.zs index 161a8d8920..e9f14f5647 100644 --- a/wadsrc/static/zscript/actors/actor.zs +++ b/wadsrc/static/zscript/actors/actor.zs @@ -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;