Skip to content

Commit bed263a

Browse files
authored
[Minor] Make insignia respect PixelSelectionBracketDelta (#1426)
``` [AudioVisual] DrawInsignia.UsePixelSelectionBracketDelta=false ;default ```
1 parent 23ba9a3 commit bed263a

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

docs/Fixed-or-Improved-Logics.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -870,18 +870,20 @@ Image= ; name of the file that will be used as image, without exten
870870
- You can make insignias appear only on selected units using `DrawInsignia.OnlyOnSelected`.
871871
- Position for insignias can be adjusted by setting `DrawInsignia.AdjustPos.Infantry` for infantry, `DrawInsignia.AdjustPos.Buildings` for buildings, and `DrawInsignia.AdjustPos.Units` for others.
872872
- `DrawInsignia.AdjustPos.BuildingsAnchor` can be set to an anchor point to anchor the insignia position relative to the building's selection bracket. By default the insignia position is not anchored to the selection bracket.
873+
- `DrawInsignia.UsePixelSelectionBracketDelta` can be set to use techno's `PixelSelectionBracketDelta` to additionally adjust insignias vertically.
873874

874875
In `rulesmd.ini`:
875876
```ini
876877
[General]
877-
EnemyInsignia=true ; boolean
878+
EnemyInsignia=true ; boolean
878879

879880
[AudioVisual]
880-
DrawInsignia.OnlyOnSelected=false ; boolean
881-
DrawInsignia.AdjustPos.Infantry=5,2 ; X,Y, position offset from default
882-
DrawInsignia.AdjustPos.Units=10,6 ; X,Y, position offset from default
883-
DrawInsignia.AdjustPos.Buildings=10,6 ; X,Y, position offset from default
884-
DrawInsignia.AdjustPos.BuildingsAnchor= ; Hexagon vertex enumeration (top|lefttop|leftbottom|bottom|rightbottom|righttop)
881+
DrawInsignia.OnlyOnSelected=false ; boolean
882+
DrawInsignia.UsePixelSelectionBracketDelta=false ; boolean
883+
DrawInsignia.AdjustPos.Infantry=5,2 ; X,Y, position offset from default
884+
DrawInsignia.AdjustPos.Units=10,6 ; X,Y, position offset from default
885+
DrawInsignia.AdjustPos.Buildings=10,6 ; X,Y, position offset from default
886+
DrawInsignia.AdjustPos.BuildingsAnchor= ; Hexagon vertex enumeration (top|lefttop|leftbottom|bottom|rightbottom|righttop)
885887

886888
[SOMETECHNO] ; TechnoType
887889
Insignia= ; filename - excluding the .shp extension

src/Ext/Rules/Body.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ void RulesExt::ExtData::LoadBeforeTypeData(RulesClass* pThis, CCINIClass* pINI)
189189
this->DrawInsignia_AdjustPos_Buildings.Read(exINI, GameStrings::AudioVisual, "DrawInsignia.AdjustPos.Buildings");
190190
this->DrawInsignia_AdjustPos_BuildingsAnchor.Read(exINI, GameStrings::AudioVisual, "DrawInsignia.AdjustPos.BuildingsAnchor");
191191
this->DrawInsignia_AdjustPos_Units.Read(exINI, GameStrings::AudioVisual, "DrawInsignia.AdjustPos.Units");
192+
this->DrawInsignia_UsePixelSelectionBracketDelta.Read(exINI, GameStrings::AudioVisual, "DrawInsignia.UsePixelSelectionBracketDelta");
192193
this->Promote_VeteranAnimation.Read(exINI, GameStrings::AudioVisual, "Promote.VeteranAnimation");
193194
this->Promote_EliteAnimation.Read(exINI, GameStrings::AudioVisual, "Promote.EliteAnimation");
194195

@@ -431,6 +432,7 @@ void RulesExt::ExtData::Serialize(T& Stm)
431432
.Process(this->DrawInsignia_AdjustPos_Buildings)
432433
.Process(this->DrawInsignia_AdjustPos_BuildingsAnchor)
433434
.Process(this->DrawInsignia_AdjustPos_Units)
435+
.Process(this->DrawInsignia_UsePixelSelectionBracketDelta)
434436
.Process(this->Promote_VeteranAnimation)
435437
.Process(this->Promote_EliteAnimation)
436438
.Process(this->AnimRemapDefaultColorScheme)

src/Ext/Rules/Body.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ class RulesExt
162162
Valueable<Point2D> DrawInsignia_AdjustPos_Buildings;
163163
Nullable<BuildingSelectBracketPosition> DrawInsignia_AdjustPos_BuildingsAnchor;
164164
Valueable<Point2D> DrawInsignia_AdjustPos_Units;
165+
Valueable<bool> DrawInsignia_UsePixelSelectionBracketDelta;
165166
Valueable<AnimTypeClass*> Promote_VeteranAnimation;
166167
Valueable<AnimTypeClass*> Promote_EliteAnimation;
167168

@@ -324,6 +325,7 @@ class RulesExt
324325
, DrawInsignia_AdjustPos_Buildings { { 10, 6 } }
325326
, DrawInsignia_AdjustPos_BuildingsAnchor {}
326327
, DrawInsignia_AdjustPos_Units { { 10, 6 } }
328+
, DrawInsignia_UsePixelSelectionBracketDelta { { false } }
327329
, Promote_VeteranAnimation {}
328330
, Promote_EliteAnimation {}
329331
, AnimRemapDefaultColorScheme { 0 }
@@ -381,7 +383,7 @@ class RulesExt
381383
, ProneSpeed_NoCrawls { 1.5 }
382384

383385
, DamagedSpeed { 0.75 }
384-
386+
385387
, HarvesterScanAfterUnload { false }
386388
{ }
387389

src/Ext/Techno/Body.Visuals.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ void TechnoExt::DrawInsignia(TechnoClass* pThis, Point2D* pLocation, RectangleSt
212212
break;
213213
}
214214

215+
offset.Y += RulesExt::Global()->DrawInsignia_UsePixelSelectionBracketDelta ? pThis->GetTechnoType()->PixelSelectionBracketDelta : 0;
216+
215217
DSurface::Temp->DrawSHP(
216218
FileSystem::PALETTE_PAL, pShapeFile, frameIndex, &offset, pBounds, BlitterFlags(0xE00), 0, -2, ZGradient::Ground, 1000, 0, 0, 0, 0, 0);
217219
}

0 commit comments

Comments
 (0)