Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Minor] Make insignia respect PixelSelectionBracketDelta #1426

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 29 additions & 27 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -624,39 +624,41 @@ Due to technical constraints, these settings do not apply to buildings teleporte
- You can make insignias appear only on selected units using `DrawInsignia.OnlyOnSelected`.
- Position for insignias can be adjusted by setting `DrawInsignia.AdjustPos.Infantry` for infantry, `DrawInsignia.AdjustPos.Buildings` for buildings, and `DrawInsignia.AdjustPos.Units` for others.
- `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.
- `DrawInsignia.RespectPixelSelectionBracketDelta` can be set to use techno's `PixelSelectionBracketDelta` to additionally adjust insignias vertically.

In `rulesmd.ini`:
```ini
[General]
EnemyInsignia=true ; boolean
EnemyInsignia=true ; boolean

[AudioVisual]
DrawInsignia.OnlyOnSelected=false ; boolean
DrawInsignia.AdjustPos.Infantry=5,2 ; X,Y, position offset from default
DrawInsignia.AdjustPos.Units=10,6 ; X,Y, position offset from default
DrawInsignia.AdjustPos.Buildings=10,6 ; X,Y, position offset from default
DrawInsignia.AdjustPos.BuildingsAnchor= ; Hexagon vertex enumeration (top|lefttop|leftbottom|bottom|rightbottom|righttop)

[SOMETECHNO] ; TechnoType
Insignia= ; filename - excluding the .shp extension
Insignia.Rookie= ; filename - excluding the .shp extension
Insignia.Veteran= ; filename - excluding the .shp extension
Insignia.Elite= ; filename - excluding the .shp extension
InsigniaFrame=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrame.Rookie=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrame.Veteran=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrame.Elite=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrames=-1,-1,-1 ; int, frames of insignia shp (zero-based) or -1 for default
Insignia.WeaponN= ; filename - excluding the .shp extension
Insignia.WeaponN.Rookie= ; filename - excluding the .shp extension
Insignia.WeaponN.Veteran= ; filename - excluding the .shp extension
Insignia.WeaponN.Elite= ; filename - excluding the .shp extension
InsigniaFrame.WeaponN=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrame.WeaponN.Rookie=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrame.WeaponN.Veteran=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrame.WeaponN.Elite=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrames.WeaponN=-1,-1,-1 ; int, frames of insignia shp (zero-based) or -1 for default
Insignia.ShowEnemy= ; boolean
DrawInsignia.OnlyOnSelected=false ; boolean
DrawInsignia.RespectPixelSelectionBracketDelta=false ; boolean
DrawInsignia.AdjustPos.Infantry=5,2 ; X,Y, position offset from default
DrawInsignia.AdjustPos.Units=10,6 ; X,Y, position offset from default
DrawInsignia.AdjustPos.Buildings=10,6 ; X,Y, position offset from default
DrawInsignia.AdjustPos.BuildingsAnchor= ; Hexagon vertex enumeration (top|lefttop|leftbottom|bottom|rightbottom|righttop)

[SOMETECHNO] ; TechnoType
Insignia= ; filename - excluding the .shp extension
Insignia.Rookie= ; filename - excluding the .shp extension
Insignia.Veteran= ; filename - excluding the .shp extension
Insignia.Elite= ; filename - excluding the .shp extension
InsigniaFrame=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrame.Rookie=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrame.Veteran=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrame.Elite=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrames=-1,-1,-1 ; int, frames of insignia shp (zero-based) or -1 for default
Insignia.WeaponN= ; filename - excluding the .shp extension
Insignia.WeaponN.Rookie= ; filename - excluding the .shp extension
Insignia.WeaponN.Veteran= ; filename - excluding the .shp extension
Insignia.WeaponN.Elite= ; filename - excluding the .shp extension
InsigniaFrame.WeaponN=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrame.WeaponN.Rookie=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrame.WeaponN.Veteran=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrame.WeaponN.Elite=-1 ; int, frame of insignia shp (zero-based) or -1 for default
InsigniaFrames.WeaponN=-1,-1,-1 ; int, frames of insignia shp (zero-based) or -1 for default
Insignia.ShowEnemy= ; boolean
```

```{note}
Expand Down
2 changes: 2 additions & 0 deletions src/Ext/Rules/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ void RulesExt::ExtData::LoadBeforeTypeData(RulesClass* pThis, CCINIClass* pINI)
this->DrawInsignia_AdjustPos_Buildings.Read(exINI, GameStrings::AudioVisual, "DrawInsignia.AdjustPos.Buildings");
this->DrawInsignia_AdjustPos_BuildingsAnchor.Read(exINI, GameStrings::AudioVisual, "DrawInsignia.AdjustPos.BuildingsAnchor");
this->DrawInsignia_AdjustPos_Units.Read(exINI, GameStrings::AudioVisual, "DrawInsignia.AdjustPos.Units");
this->DrawInsignia_RespectPixelSelectionBracketDelta.Read(exINI, GameStrings::AudioVisual, "DrawInsignia.RespectPixelSelectionBracketDelta");
this->Promote_VeteranAnimation.Read(exINI, GameStrings::AudioVisual, "Promote.VeteranAnimation");
this->Promote_EliteAnimation.Read(exINI, GameStrings::AudioVisual, "Promote.EliteAnimation");

Expand Down Expand Up @@ -362,6 +363,7 @@ void RulesExt::ExtData::Serialize(T& Stm)
.Process(this->DrawInsignia_AdjustPos_Buildings)
.Process(this->DrawInsignia_AdjustPos_BuildingsAnchor)
.Process(this->DrawInsignia_AdjustPos_Units)
.Process(this->DrawInsignia_RespectPixelSelectionBracketDelta)
.Process(this->Promote_VeteranAnimation)
.Process(this->Promote_EliteAnimation)
.Process(this->AnimRemapDefaultColorScheme)
Expand Down
2 changes: 2 additions & 0 deletions src/Ext/Rules/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class RulesExt
Valueable<Point2D> DrawInsignia_AdjustPos_Buildings;
Nullable<BuildingSelectBracketPosition> DrawInsignia_AdjustPos_BuildingsAnchor;
Valueable<Point2D> DrawInsignia_AdjustPos_Units;
Valueable<bool> DrawInsignia_RespectPixelSelectionBracketDelta;
Valueable<AnimTypeClass*> Promote_VeteranAnimation;
Valueable<AnimTypeClass*> Promote_EliteAnimation;

Expand Down Expand Up @@ -258,6 +259,7 @@ class RulesExt
, DrawInsignia_AdjustPos_Buildings { { 10, 6 } }
, DrawInsignia_AdjustPos_BuildingsAnchor {}
, DrawInsignia_AdjustPos_Units { { 10, 6 } }
, DrawInsignia_RespectPixelSelectionBracketDelta { { false } }
, Promote_VeteranAnimation {}
, Promote_EliteAnimation {}
, AnimRemapDefaultColorScheme { 0 }
Expand Down
2 changes: 2 additions & 0 deletions src/Ext/Techno/Body.Visuals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ void TechnoExt::DrawInsignia(TechnoClass* pThis, Point2D* pLocation, RectangleSt
break;
}

offset.Y += RulesExt::Global()->DrawInsignia_RespectPixelSelectionBracketDelta ? pThis->GetTechnoType()->PixelSelectionBracketDelta : 0;

DSurface::Temp->DrawSHP(
FileSystem::PALETTE_PAL, pShapeFile, frameIndex, &offset, pBounds, BlitterFlags(0xE00), 0, -2, ZGradient::Ground, 1000, 0, 0, 0, 0, 0);
}
Expand Down
Loading