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

Add button shine to more buttons #9471

Merged
merged 25 commits into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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
85 changes: 23 additions & 62 deletions src/fheroes2/agg/agg_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ namespace
ICN::BUTTON_SMALL_CANCEL_EVIL,
ICN::BUTTON_SMALL_OKAY_GOOD,
ICN::BUTTON_SMALL_OKAY_EVIL,
ICN::BUTTON_SMALLER_OKAY_GOOD,
ICN::BUTTON_SMALLER_OKAY_EVIL,
ICN::BUTTON_SMALL_ACCEPT_GOOD,
ICN::BUTTON_SMALL_ACCEPT_EVIL,
ICN::BUTTON_SMALL_DECLINE_GOOD,
Expand Down Expand Up @@ -901,12 +899,10 @@ namespace
break;
}
case ICN::BUTTON_SMALL_OKAY_GOOD:
case ICN::BUTTON_SMALL_OKAY_EVIL:
case ICN::BUTTON_SMALLER_OKAY_GOOD:
case ICN::BUTTON_SMALLER_OKAY_EVIL: {
case ICN::BUTTON_SMALL_OKAY_EVIL: {
_icnVsSprite[id].resize( 2 );

const bool isEvilInterface = ( id == ICN::BUTTON_SMALL_OKAY_EVIL || id == ICN::BUTTON_SMALLER_OKAY_EVIL );
const bool isEvilInterface = ( id == ICN::BUTTON_SMALL_OKAY_EVIL );
const bool isSameResourceAsLanguage = useOriginalResources();

if ( isSameResourceAsLanguage && ( id == ICN::BUTTON_SMALL_OKAY_EVIL || id == ICN::BUTTON_SMALL_OKAY_GOOD ) ) {
Expand All @@ -918,20 +914,9 @@ namespace

break;
}
if ( isSameResourceAsLanguage && ( id == ICN::BUTTON_SMALLER_OKAY_EVIL || id == ICN::BUTTON_SMALLER_OKAY_GOOD ) ) {
_icnVsSprite[id][0] = fheroes2::AGG::GetICN( isEvilInterface ? ICN::WINCMBBE : ICN::WINCMBTB, 0 );
_icnVsSprite[id][1] = fheroes2::AGG::GetICN( isEvilInterface ? ICN::WINCMBBE : ICN::WINCMBTB, 1 );
break;
}

int32_t textWidth = 86;
const char * text = gettext_noop( "OKAY" );
if ( id == ICN::BUTTON_SMALLER_OKAY_EVIL || id == ICN::BUTTON_SMALLER_OKAY_GOOD ) {
textWidth = 70;
text = gettext_noop( "smallerButton|OKAY" );
}

createNormalButton( _icnVsSprite[id][0], _icnVsSprite[id][1], textWidth, text, isEvilInterface );
fheroes2::getTextAdaptedButton( _icnVsSprite[id][0], _icnVsSprite[id][1], gettext_noop( "OKAY" ),
isEvilInterface ? ICN::EMPTY_EVIL_BUTTON : ICN::EMPTY_GOOD_BUTTON, isEvilInterface ? ICN::STONEBAK_EVIL : ICN::STONEBAK );

break;
}
Expand Down Expand Up @@ -982,21 +967,17 @@ namespace
_icnVsSprite[id].resize( 2 );

const bool isEvilInterface = ( id == ICN::BUTTON_SMALL_LEARN_EVIL );
const int baseIcnID = isEvilInterface ? ICN::SYSTEME : ICN::SYSTEM;

if ( useOriginalResources() ) {
const int baseIcnID = isEvilInterface ? ICN::SYSTEME : ICN::SYSTEM;
_icnVsSprite[id][0] = fheroes2::AGG::GetICN( baseIcnID, 9 );
_icnVsSprite[id][1] = fheroes2::AGG::GetICN( baseIcnID, 10 );
break;
}

for ( int32_t i = 0; i < static_cast<int32_t>( _icnVsSprite[id].size() ); ++i ) {
fheroes2::Sprite & out = _icnVsSprite[id][i];
out = fheroes2::AGG::GetICN( baseIcnID, 11 + i );
}

const fheroes2::FontColor buttonFontColor = isEvilInterface ? fheroes2::FontColor::GRAY : fheroes2::FontColor::WHITE;
renderTextOnButton( _icnVsSprite[id][0], _icnVsSprite[id][1], gettext_noop( "LEARN" ), { 7, 5 }, { 5, 6 }, { 86, 16 }, buttonFontColor );
fheroes2::getTextAdaptedButton( _icnVsSprite[id][0], _icnVsSprite[id][1], gettext_noop( "LEARN" ),
isEvilInterface ? ICN::EMPTY_EVIL_BUTTON : ICN::EMPTY_GOOD_BUTTON,
isEvilInterface ? ICN::UNIFORMBAK_EVIL : ICN::UNIFORMBAK_GOOD );

break;
}
Expand All @@ -1021,45 +1002,35 @@ namespace
_icnVsSprite[id].resize( 2 );

const bool isEvilInterface = ( id == ICN::BUTTON_SMALL_YES_EVIL );
const int baseIcnID = isEvilInterface ? ICN::SYSTEME : ICN::SYSTEM;

if ( useOriginalResources() ) {
const int baseIcnID = isEvilInterface ? ICN::SYSTEME : ICN::SYSTEM;
_icnVsSprite[id][0] = fheroes2::AGG::GetICN( baseIcnID, 5 );
_icnVsSprite[id][1] = fheroes2::AGG::GetICN( baseIcnID, 6 );
break;
}

for ( int32_t i = 0; i < static_cast<int32_t>( _icnVsSprite[id].size() ); ++i ) {
fheroes2::Sprite & out = _icnVsSprite[id][i];
out = fheroes2::AGG::GetICN( baseIcnID, 11 + i );
}

const fheroes2::FontColor buttonFontColor = isEvilInterface ? fheroes2::FontColor::GRAY : fheroes2::FontColor::WHITE;
renderTextOnButton( _icnVsSprite[id][0], _icnVsSprite[id][1], gettext_noop( "YES" ), { 6, 5 }, { 5, 6 }, { 86, 16 }, buttonFontColor );

fheroes2::getTextAdaptedButton( _icnVsSprite[id][0], _icnVsSprite[id][1], gettext_noop( "YES" ),
isEvilInterface ? ICN::EMPTY_EVIL_BUTTON : ICN::EMPTY_GOOD_BUTTON,
isEvilInterface ? ICN::UNIFORMBAK_EVIL : ICN::UNIFORMBAK_GOOD );
break;
}
case ICN::BUTTON_SMALL_NO_GOOD:
case ICN::BUTTON_SMALL_NO_EVIL: {
_icnVsSprite[id].resize( 2 );

const bool isEvilInterface = ( id == ICN::BUTTON_SMALL_NO_EVIL );
const int baseIcnID = isEvilInterface ? ICN::SYSTEME : ICN::SYSTEM;

if ( useOriginalResources() ) {
const int baseIcnID = isEvilInterface ? ICN::SYSTEME : ICN::SYSTEM;
_icnVsSprite[id][0] = fheroes2::AGG::GetICN( baseIcnID, 7 );
_icnVsSprite[id][1] = fheroes2::AGG::GetICN( baseIcnID, 8 );
break;
}

for ( int32_t i = 0; i < static_cast<int32_t>( _icnVsSprite[id].size() ); ++i ) {
fheroes2::Sprite & out = _icnVsSprite[id][i];
out = fheroes2::AGG::GetICN( baseIcnID, 11 + i );
}

const fheroes2::FontColor buttonFontColor = isEvilInterface ? fheroes2::FontColor::GRAY : fheroes2::FontColor::WHITE;
renderTextOnButton( _icnVsSprite[id][0], _icnVsSprite[id][1], gettext_noop( "NO" ), { 6, 5 }, { 5, 6 }, { 86, 16 }, buttonFontColor );

fheroes2::getTextAdaptedButton( _icnVsSprite[id][0], _icnVsSprite[id][1], gettext_noop( "NO" ),
isEvilInterface ? ICN::EMPTY_EVIL_BUTTON : ICN::EMPTY_GOOD_BUTTON,
isEvilInterface ? ICN::UNIFORMBAK_EVIL : ICN::UNIFORMBAK_GOOD );
break;
}
case ICN::BUTTON_SMALL_EXIT_GOOD:
Expand Down Expand Up @@ -1636,15 +1607,10 @@ namespace
_icnVsSprite[id].resize( 2 );

const bool isEvilInterface = ( id == ICN::BTNGIFT_EVIL );
const int baseIcnId = isEvilInterface ? ICN::SYSTEME : ICN::SYSTEM;

for ( int32_t i = 0; i < static_cast<int32_t>( _icnVsSprite[id].size() ); ++i ) {
fheroes2::Sprite & out = _icnVsSprite[id][i];
out = fheroes2::AGG::GetICN( baseIcnId, 11 + i );
}

const fheroes2::FontColor buttonFontColor = isEvilInterface ? fheroes2::FontColor::GRAY : fheroes2::FontColor::WHITE;
renderTextOnButton( _icnVsSprite[id][0], _icnVsSprite[id][1], gettext_noop( "GIFT" ), { 5, 5 }, { 4, 6 }, { 88, 16 }, buttonFontColor );
fheroes2::getTextAdaptedButton( _icnVsSprite[id][0], _icnVsSprite[id][1], gettext_noop( "GIFT" ),
isEvilInterface ? ICN::EMPTY_EVIL_BUTTON : ICN::EMPTY_GOOD_BUTTON,
isEvilInterface ? ICN::UNIFORMBAK_EVIL : ICN::UNIFORMBAK_GOOD );

break;
}
Expand Down Expand Up @@ -1917,22 +1883,17 @@ namespace
_icnVsSprite[id].resize( 2 );

const bool isEvilInterface = ( id == ICN::UNIFORM_EVIL_OKAY_BUTTON );
const int baseIcnId = isEvilInterface ? ICN::SYSTEME : ICN::SYSTEM;

if ( useOriginalResources() ) {
const int baseIcnId = isEvilInterface ? ICN::SYSTEME : ICN::SYSTEM;
_icnVsSprite[id][0] = fheroes2::AGG::GetICN( baseIcnId, 1 );
_icnVsSprite[id][1] = fheroes2::AGG::GetICN( baseIcnId, 2 );
break;
}

for ( int32_t i = 0; i < static_cast<int32_t>( _icnVsSprite[id].size() ); ++i ) {
fheroes2::Sprite & out = _icnVsSprite[id][i];
out = fheroes2::AGG::GetICN( baseIcnId, 11 + i );
}

const fheroes2::FontColor buttonFontColor = isEvilInterface ? fheroes2::FontColor::GRAY : fheroes2::FontColor::WHITE;
renderTextOnButton( _icnVsSprite[id][0], _icnVsSprite[id][1], gettext_noop( "OKAY" ), { 6, 5 }, { 5, 6 }, { 86, 16 }, buttonFontColor );

fheroes2::getTextAdaptedButton( _icnVsSprite[id][0], _icnVsSprite[id][1], gettext_noop( "OKAY" ),
isEvilInterface ? ICN::EMPTY_EVIL_BUTTON : ICN::EMPTY_GOOD_BUTTON,
isEvilInterface ? ICN::UNIFORMBAK_EVIL : ICN::UNIFORMBAK_GOOD );
break;
}
case ICN::UNIFORM_GOOD_CANCEL_BUTTON:
Expand Down
2 changes: 0 additions & 2 deletions src/fheroes2/agg/icn.h
Original file line number Diff line number Diff line change
Expand Up @@ -1036,8 +1036,6 @@ namespace ICN
BUTTON_SMALL_CANCEL_EVIL,
BUTTON_SMALL_OKAY_GOOD,
BUTTON_SMALL_OKAY_EVIL,
BUTTON_SMALLER_OKAY_GOOD,
BUTTON_SMALLER_OKAY_EVIL,
BUTTON_SMALL_ACCEPT_GOOD,
BUTTON_SMALL_ACCEPT_EVIL,
BUTTON_SMALL_DECLINE_GOOD,
Expand Down
Loading
Loading