Add button4.png drawing (builder icons)

modernize-cmake-1
Mateusz Przybył 2017-11-17 18:59:14 +01:00
parent d470d9e63c
commit 46bef8fd92
No known key found for this signature in database
GPG Key ID: DF2649BD3566EADF
6 changed files with 161 additions and 113 deletions

View File

@ -2309,6 +2309,7 @@ bool CEngine::LoadAllTextures()
LoadTexture("textures/interface/button1.png"); LoadTexture("textures/interface/button1.png");
LoadTexture("textures/interface/button2.png"); LoadTexture("textures/interface/button2.png");
LoadTexture("textures/interface/button3.png"); LoadTexture("textures/interface/button3.png");
LoadTexture("textures/interface/button4.png");
LoadTexture("textures/effect00.png"); LoadTexture("textures/effect00.png");
LoadTexture("textures/effect01.png"); LoadTexture("textures/effect01.png");
LoadTexture("textures/effect02.png"); LoadTexture("textures/effect02.png");

View File

@ -925,7 +925,13 @@ void CText::DrawCharAndAdjustPos(UTF8Char ch, FontType font, float size, Math::I
// For whatever reason ch.c1 is a SIGNED char, we need to fix that // For whatever reason ch.c1 is a SIGNED char, we need to fix that
unsigned char icon = static_cast<unsigned char>(ch.c1); unsigned char icon = static_cast<unsigned char>(ch.c1);
if ( icon >= 128 ) if ( icon >= 192 )
{
icon -= 192;
m_engine->SetTexture("textures/interface/button4.png");
m_engine->SetState(ENG_RSTATE_TTEXTURE_WHITE);
}
else if ( icon >= 128 )
{ {
icon -= 128; icon -= 128;
m_engine->SetTexture("textures/interface/button3.png"); m_engine->SetTexture("textures/interface/button3.png");

View File

@ -518,7 +518,13 @@ void CControl::Draw()
if ( m_state & STATE_DEAD ) return; if ( m_state & STATE_DEAD ) return;
icon = m_icon; icon = m_icon;
if ( icon >= 128 ) if (icon >= 192)
{
icon -= 192;
m_engine->SetTexture("textures/interface/button4.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
}
else if ( icon >= 128 )
{ {
icon -= 128; icon -= 128;
m_engine->SetTexture("textures/interface/button3.png"); m_engine->SetTexture("textures/interface/button3.png");

View File

@ -830,67 +830,80 @@ void CMap::DrawObjectIcon(Math::Point pos, Math::Point dim, MapColor color,
if ( bHilite ) if ( bHilite )
{ {
icon = -1; switch ( type )
if ( type == OBJECT_FACTORY ) icon = 32; {
if ( type == OBJECT_DERRICK ) icon = 33; case OBJECT_FACTORY: icon = 32; break;
if ( type == OBJECT_CONVERT ) icon = 34; case OBJECT_DERRICK: icon = 33; break;
if ( type == OBJECT_RESEARCH ) icon = 35; case OBJECT_CONVERT: icon = 34; break;
if ( type == OBJECT_STATION ) icon = 36; case OBJECT_RESEARCH: icon = 35; break;
if ( type == OBJECT_TOWER ) icon = 37; case OBJECT_STATION: icon = 36; break;
if ( type == OBJECT_LABO ) icon = 38; case OBJECT_TOWER: icon = 37; break;
if ( type == OBJECT_ENERGY ) icon = 39; case OBJECT_LABO: icon = 38; break;
if ( type == OBJECT_RADAR ) icon = 40; case OBJECT_ENERGY: icon = 39; break;
if ( type == OBJECT_INFO ) icon = 44; case OBJECT_RADAR: icon = 40; break;
if ( type == OBJECT_REPAIR ) icon = 41; case OBJECT_INFO: icon = 44; break;
if ( type == OBJECT_DESTROYER) icon = 41; case OBJECT_REPAIR: icon = 41; break;
if ( type == OBJECT_NUCLEAR ) icon = 42; case OBJECT_DESTROYER: icon = 41; break;
if ( type == OBJECT_PARA ) icon = 46; case OBJECT_NUCLEAR: icon = 42; break;
if ( type == OBJECT_SAFE ) icon = 47; case OBJECT_PARA: icon = 46; break;
if ( type == OBJECT_HUSTON ) icon = 48; case OBJECT_SAFE: icon = 47; break;
if ( type == OBJECT_TARGET1 ) icon = 45; case OBJECT_HUSTON: icon = 48; break;
if ( type == OBJECT_BASE ) icon = 43; case OBJECT_TARGET1: icon = 45; break;
if ( type == OBJECT_HUMAN ) icon = 8; case OBJECT_BASE: icon = 43; break;
if ( type == OBJECT_MOBILEfa ) icon = 11; case OBJECT_HUMAN: icon = 8; break;
if ( type == OBJECT_MOBILEta ) icon = 10; case OBJECT_MOBILEfa: icon = 11; break;
if ( type == OBJECT_MOBILEwa ) icon = 9; case OBJECT_MOBILEta: icon = 10; break;
if ( type == OBJECT_MOBILEia ) icon = 22; case OBJECT_MOBILEwa: icon = 9; break;
if ( type == OBJECT_MOBILEfb ) icon = 32; //placeholder icon case OBJECT_MOBILEia: icon = 22; break;
if ( type == OBJECT_MOBILEtb ) icon = 32; case OBJECT_MOBILEfb: icon = 2; break; // button4
if ( type == OBJECT_MOBILEwb ) icon = 32; case OBJECT_MOBILEtb: icon = 1; break;
if ( type == OBJECT_MOBILEib ) icon = 32; case OBJECT_MOBILEwb: icon = 0; break;
if ( type == OBJECT_MOBILEfc ) icon = 17; case OBJECT_MOBILEib: icon = 3; break;
if ( type == OBJECT_MOBILEtc ) icon = 16; case OBJECT_MOBILEfc: icon = 17; break;
if ( type == OBJECT_MOBILEwc ) icon = 15; case OBJECT_MOBILEtc: icon = 16; break;
if ( type == OBJECT_MOBILEic ) icon = 23; case OBJECT_MOBILEwc: icon = 15; break;
if ( type == OBJECT_MOBILEfi ) icon = 27; case OBJECT_MOBILEic: icon = 23; break;
if ( type == OBJECT_MOBILEti ) icon = 26; case OBJECT_MOBILEfi: icon = 27; break;
if ( type == OBJECT_MOBILEwi ) icon = 25; case OBJECT_MOBILEti: icon = 26; break;
if ( type == OBJECT_MOBILEii ) icon = 28; case OBJECT_MOBILEwi: icon = 25; break;
if ( type == OBJECT_MOBILEfs ) icon = 14; case OBJECT_MOBILEii: icon = 28; break;
if ( type == OBJECT_MOBILEts ) icon = 13; case OBJECT_MOBILEfs: icon = 14; break;
if ( type == OBJECT_MOBILEws ) icon = 12; case OBJECT_MOBILEts: icon = 13; break;
if ( type == OBJECT_MOBILEis ) icon = 24; case OBJECT_MOBILEws: icon = 12; break;
if ( type == OBJECT_MOBILErt ) icon = 18; case OBJECT_MOBILEis: icon = 24; break;
if ( type == OBJECT_MOBILErc ) icon = 19; case OBJECT_MOBILErt: icon = 18; break;
if ( type == OBJECT_MOBILErr ) icon = 20; case OBJECT_MOBILErc: icon = 19; break;
if ( type == OBJECT_MOBILErs ) icon = 29; case OBJECT_MOBILErr: icon = 20; break;
if ( type == OBJECT_MOBILEsa ) icon = 21; case OBJECT_MOBILErs: icon = 29; break;
if ( type == OBJECT_MOBILEft ) icon = 30; case OBJECT_MOBILEsa: icon = 21; break;
if ( type == OBJECT_MOBILEtt ) icon = 30; case OBJECT_MOBILEft: icon = 30; break;
if ( type == OBJECT_MOBILEwt ) icon = 30; case OBJECT_MOBILEtt: icon = 30; break;
if ( type == OBJECT_MOBILEit ) icon = 30; case OBJECT_MOBILEwt: icon = 30; break;
if ( type == OBJECT_MOBILEtg ) icon = 45; case OBJECT_MOBILEit: icon = 30; break;
if ( type == OBJECT_MOBILEdr ) icon = 48; case OBJECT_MOBILEtg: icon = 45; break;
if ( type == OBJECT_APOLLO2 ) icon = 49; case OBJECT_MOBILEdr: icon = 48; break;
if ( type == OBJECT_MOTHER ) icon = 31; case OBJECT_APOLLO2: icon = 49; break;
if ( type == OBJECT_ANT ) icon = 31; case OBJECT_MOTHER: icon = 31; break;
if ( type == OBJECT_SPIDER ) icon = 31; case OBJECT_ANT: icon = 31; break;
if ( type == OBJECT_BEE ) icon = 31; case OBJECT_SPIDER: icon = 31; break;
if ( type == OBJECT_WORM ) icon = 31; case OBJECT_BEE: icon = 31; break;
if ( type == OBJECT_TEEN28 ) icon = 48; // bottle case OBJECT_WORM: icon = 31; break;
if ( type == OBJECT_TEEN34 ) icon = 48; // stone case OBJECT_TEEN28: icon = 48; break; // bottle
case OBJECT_TEEN34: icon = 48; break; // stone
default: icon = -1;
}
if ( icon == -1 ) return; if ( icon == -1 ) return;
switch ( type )
{
case OBJECT_MOBILEfb:
case OBJECT_MOBILEtb:
case OBJECT_MOBILEwb:
case OBJECT_MOBILEib:
m_engine->SetTexture("textures/interface/button4.png"); break;
default: ; // button3.png
}
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
uv1.x = (32.0f/256.0f)*(icon%8); uv1.x = (32.0f/256.0f)*(icon%8);
uv1.y = (32.0f/256.0f)*(icon/8); uv1.y = (32.0f/256.0f)*(icon/8);

View File

@ -124,7 +124,12 @@ void CShortcut::Draw()
} }
icon = m_icon; icon = m_icon;
if ( icon >= 128 ) if ( icon >= 192 )
{
icon -= 192;
m_engine->SetTexture("textures/interface/button4.png");
}
else if ( icon >= 128 )
{ {
icon -= 128; icon -= 128;
m_engine->SetTexture("textures/interface/button3.png"); m_engine->SetTexture("textures/interface/button3.png");

View File

@ -182,61 +182,78 @@ int CMainShort::GetShortcutIcon(ObjectType type)
int icon = -1; int icon = -1;
if ( m_bBuilding ) if ( m_bBuilding )
{ {
if ( type == OBJECT_FACTORY ) icon = 32; switch ( type )
if ( type == OBJECT_DERRICK ) icon = 33; {
if ( type == OBJECT_CONVERT ) icon = 34; case OBJECT_FACTORY: icon = 32; break;
if ( type == OBJECT_RESEARCH ) icon = 35; case OBJECT_DERRICK: icon = 33; break;
if ( type == OBJECT_STATION ) icon = 36; case OBJECT_CONVERT: icon = 34; break;
if ( type == OBJECT_TOWER ) icon = 37; case OBJECT_RESEARCH: icon = 35; break;
if ( type == OBJECT_LABO ) icon = 38; case OBJECT_STATION: icon = 36; break;
if ( type == OBJECT_ENERGY ) icon = 39; case OBJECT_TOWER: icon = 37; break;
if ( type == OBJECT_RADAR ) icon = 40; case OBJECT_LABO: icon = 38; break;
if ( type == OBJECT_INFO ) icon = 44; case OBJECT_ENERGY: icon = 39; break;
if ( type == OBJECT_REPAIR ) icon = 41; case OBJECT_RADAR: icon = 40; break;
if ( type == OBJECT_DESTROYER) icon = 41; case OBJECT_INFO: icon = 44; break;
if ( type == OBJECT_NUCLEAR ) icon = 42; case OBJECT_REPAIR: icon = 41; break;
if ( type == OBJECT_PARA ) icon = 46; case OBJECT_DESTROYER: icon = 41; break;
if ( type == OBJECT_SAFE ) icon = 47; case OBJECT_NUCLEAR: icon = 42; break;
if ( type == OBJECT_HUSTON ) icon = 48; case OBJECT_PARA: icon = 46; break;
if ( type == OBJECT_BASE ) icon = 43; case OBJECT_SAFE: icon = 47; break;
case OBJECT_HUSTON: icon = 48; break;
case OBJECT_BASE: icon = 43; break;
default: return -1;
}
} }
else else
{ {
if ( type == OBJECT_HUMAN ) icon = 8; switch ( type )
if ( type == OBJECT_MOBILEfa ) icon = 11; {
if ( type == OBJECT_MOBILEta ) icon = 10; case OBJECT_HUMAN: icon = 8; break;
if ( type == OBJECT_MOBILEwa ) icon = 9; case OBJECT_MOBILEfa: icon = 11; break;
if ( type == OBJECT_MOBILEia ) icon = 22; case OBJECT_MOBILEta: icon = 10; break;
if ( type == OBJECT_MOBILEfb ) icon = 32; case OBJECT_MOBILEwa: icon = 9; break;
if ( type == OBJECT_MOBILEtb ) icon = 32; case OBJECT_MOBILEia: icon = 22; break;
if ( type == OBJECT_MOBILEwb ) icon = 32; case OBJECT_MOBILEfb: icon = 2; break; // button4
if ( type == OBJECT_MOBILEib ) icon = 32; case OBJECT_MOBILEtb: icon = 1; break;
if ( type == OBJECT_MOBILEfc ) icon = 17; case OBJECT_MOBILEwb: icon = 0; break;
if ( type == OBJECT_MOBILEtc ) icon = 16; case OBJECT_MOBILEib: icon = 3; break;
if ( type == OBJECT_MOBILEwc ) icon = 15; case OBJECT_MOBILEfc: icon = 17; break;
if ( type == OBJECT_MOBILEic ) icon = 23; case OBJECT_MOBILEtc: icon = 16; break;
if ( type == OBJECT_MOBILEfi ) icon = 27; case OBJECT_MOBILEwc: icon = 15; break;
if ( type == OBJECT_MOBILEti ) icon = 26; case OBJECT_MOBILEic: icon = 23; break;
if ( type == OBJECT_MOBILEwi ) icon = 25; case OBJECT_MOBILEfi: icon = 27; break;
if ( type == OBJECT_MOBILEii ) icon = 28; case OBJECT_MOBILEti: icon = 26; break;
if ( type == OBJECT_MOBILEfs ) icon = 14; case OBJECT_MOBILEwi: icon = 25; break;
if ( type == OBJECT_MOBILEts ) icon = 13; case OBJECT_MOBILEii: icon = 28; break;
if ( type == OBJECT_MOBILEws ) icon = 12; case OBJECT_MOBILEfs: icon = 14; break;
if ( type == OBJECT_MOBILEis ) icon = 24; case OBJECT_MOBILEts: icon = 13; break;
if ( type == OBJECT_MOBILErt ) icon = 18; case OBJECT_MOBILEws: icon = 12; break;
if ( type == OBJECT_MOBILErc ) icon = 19; case OBJECT_MOBILEis: icon = 24; break;
if ( type == OBJECT_MOBILErr ) icon = 20; case OBJECT_MOBILErt: icon = 18; break;
if ( type == OBJECT_MOBILErs ) icon = 29; case OBJECT_MOBILErc: icon = 19; break;
if ( type == OBJECT_MOBILEsa ) icon = 21; case OBJECT_MOBILErr: icon = 20; break;
if ( type == OBJECT_MOBILEft ) icon = 30; case OBJECT_MOBILErs: icon = 29; break;
if ( type == OBJECT_MOBILEtt ) icon = 30; case OBJECT_MOBILEsa: icon = 21; break;
if ( type == OBJECT_MOBILEwt ) icon = 30; case OBJECT_MOBILEft: icon = 30; break;
if ( type == OBJECT_MOBILEit ) icon = 30; case OBJECT_MOBILEtt: icon = 30; break;
if ( type == OBJECT_MOBILEdr ) icon = 48; case OBJECT_MOBILEwt: icon = 30; break;
if ( type == OBJECT_APOLLO2 ) icon = 49; case OBJECT_MOBILEit: icon = 30; break;
case OBJECT_MOBILEdr: icon = 48; break;
case OBJECT_APOLLO2: icon = 49; break;
default: return -1;
}
}
switch ( type )
{
case OBJECT_MOBILEfb:
case OBJECT_MOBILEtb:
case OBJECT_MOBILEwb:
case OBJECT_MOBILEib:
return 192+icon;
default:
return 128+icon;
} }
if ( icon == -1 ) return -1;
return 128+icon;
} }
// Updates the interface shortcuts to the units. // Updates the interface shortcuts to the units.