[*] Improved auto-cast animation
This commit is contained in:
parent
cb5b7d32bc
commit
ec7c277249
3 changed files with 15 additions and 1 deletions
|
@ -42,6 +42,7 @@ public:
|
|||
CColor() : R(0), G(0), B(0), A(0) {}
|
||||
CColor(unsigned char r, unsigned char g, unsigned char b,
|
||||
unsigned char a = 0) : R(r), G(g), B(b), A(a) {}
|
||||
CColor(const CColor &color) : R(color.R), G(color.G), B(color.B), A(color.A) {}
|
||||
|
||||
void Parse(lua_State *l, int index = -1);
|
||||
|
||||
|
|
|
@ -189,6 +189,7 @@ void CIcon::DrawUnitIcon(const ButtonStyle &style, unsigned flags,
|
|||
if (!(flags & IconSelected) && (flags & IconAutoCast)) {
|
||||
s.Default.BorderColorRGB = UI.ButtonPanel.AutoCastBorderColorRGB;
|
||||
s.Default.BorderColor = 0;
|
||||
s.Default.BorderSize = 2;
|
||||
}
|
||||
if (Preference.IconsShift) {
|
||||
// Left and top edge of Icon
|
||||
|
|
|
@ -121,7 +121,19 @@ void DrawUIButton(ButtonStyle *style, unsigned flags, int x, int y,
|
|||
// Border
|
||||
//
|
||||
if (!p->BorderColor) {
|
||||
p->BorderColor = Video.MapRGB(TheScreen->format, p->BorderColorRGB);
|
||||
CColor color(p->BorderColorRGB);
|
||||
if (p->BorderColorRGB.R > 0 || p->BorderColorRGB.G > 0 || p->BorderColorRGB.B > 0) {
|
||||
int shift = GameCycle % 0x20;
|
||||
color.R >>= shift / 2;
|
||||
color.G >>= shift / 2;
|
||||
color.B >>= shift / 2;
|
||||
if (shift >= 0x10) {
|
||||
color.R = (p->BorderColorRGB.R > 0) << ((shift - 0x10) / 2);
|
||||
color.G = (p->BorderColorRGB.G > 0) << ((shift - 0x10) / 2);
|
||||
color.B = (p->BorderColorRGB.B > 0) << ((shift - 0x10) / 2);
|
||||
}
|
||||
}
|
||||
p->BorderColor = Video.MapRGB(TheScreen->format, color);
|
||||
}
|
||||
if (p->BorderSize) {
|
||||
for (int i = 0; i < p->BorderSize; ++i) {
|
||||
|
|
Loading…
Reference in a new issue