1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-02 23:07:36 +02:00

* small changes

This commit is contained in:
mateuszb 2008-08-07 12:29:53 +00:00
parent 9ec606a40b
commit b75161788e
3 changed files with 18 additions and 29 deletions

View File

@ -303,20 +303,12 @@ void CBattleInterface::show(SDL_Surface * to)
//printing amount //printing amount
if(stacks[stackDeadByHex[b][v]].amount > 0) //don't print if stack is not alive if(stacks[stackDeadByHex[b][v]].amount > 0) //don't print if stack is not alive
{ {
if(stacks[stackDeadByHex[b][v]].attackerOwned) int xAdd = stacks[stackDeadByHex[b][v]].attackerOwned ? 220 : 202;
{
CSDL_Ext::blit8bppAlphaTo24bpp(amountNormal, NULL, to, &genRect(amountNormal->h, amountNormal->w, creAnims[stackDeadByHex[b][v]]->pos.x + 220, creAnims[stackDeadByHex[b][v]]->pos.y + 260)); CSDL_Ext::blit8bppAlphaTo24bpp(amountNormal, NULL, to, &genRect(amountNormal->h, amountNormal->w, creAnims[stackDeadByHex[b][v]]->pos.x + xAdd, creAnims[stackDeadByHex[b][v]]->pos.y + 260));
std::stringstream ss; std::stringstream ss;
ss<<stacks[stackDeadByHex[b][v]].amount; ss<<stacks[stackDeadByHex[b][v]].amount;
CSDL_Ext::printAtMiddleWB(ss.str(), creAnims[stackDeadByHex[b][v]]->pos.x + 220 + 14, creAnims[stackDeadByHex[b][v]]->pos.y + 260 + 4, GEOR13, 20, zwykly, to); CSDL_Ext::printAtMiddleWB(ss.str(), creAnims[stackDeadByHex[b][v]]->pos.x + xAdd + 14, creAnims[stackDeadByHex[b][v]]->pos.y + 260 + 4, GEOR13, 20, zwykly, to);
}
else
{
CSDL_Ext::blit8bppAlphaTo24bpp(amountNormal, NULL, to, &genRect(amountNormal->h, amountNormal->w, creAnims[stackDeadByHex[b][v]]->pos.x + 202, creAnims[stackDeadByHex[b][v]]->pos.y + 260));
std::stringstream ss;
ss<<stacks[stackDeadByHex[b][v]].amount;
CSDL_Ext::printAtMiddleWB(ss.str(), creAnims[stackDeadByHex[b][v]]->pos.x + 202 + 14, creAnims[stackDeadByHex[b][v]]->pos.y + 260 + 4, GEOR13, 20, zwykly, to);
}
} }
} }
} }
@ -328,20 +320,12 @@ void CBattleInterface::show(SDL_Surface * to)
//printing amount //printing amount
if(stacks[stackAliveByHex[b][v]].amount > 0) //don't print if stack is not alive if(stacks[stackAliveByHex[b][v]].amount > 0) //don't print if stack is not alive
{ {
if(stacks[stackAliveByHex[b][v]].attackerOwned) int xAdd = stacks[stackAliveByHex[b][v]].attackerOwned ? 220 : 202;
{
CSDL_Ext::blit8bppAlphaTo24bpp(amountNormal, NULL, to, &genRect(amountNormal->h, amountNormal->w, creAnims[stackAliveByHex[b][v]]->pos.x + 220, creAnims[stackAliveByHex[b][v]]->pos.y + 260)); CSDL_Ext::blit8bppAlphaTo24bpp(amountNormal, NULL, to, &genRect(amountNormal->h, amountNormal->w, creAnims[stackAliveByHex[b][v]]->pos.x + xAdd, creAnims[stackAliveByHex[b][v]]->pos.y + 260));
std::stringstream ss; std::stringstream ss;
ss<<stacks[stackAliveByHex[b][v]].amount; ss<<stacks[stackAliveByHex[b][v]].amount;
CSDL_Ext::printAtMiddleWB(ss.str(), creAnims[stackAliveByHex[b][v]]->pos.x + 220 + 14, creAnims[stackAliveByHex[b][v]]->pos.y + 260 + 4, GEOR13, 20, zwykly, to); CSDL_Ext::printAtMiddleWB(ss.str(), creAnims[stackAliveByHex[b][v]]->pos.x + xAdd + 14, creAnims[stackAliveByHex[b][v]]->pos.y + 260 + 4, GEOR13, 20, zwykly, to);
}
else
{
CSDL_Ext::blit8bppAlphaTo24bpp(amountNormal, NULL, to, &genRect(amountNormal->h, amountNormal->w, creAnims[stackAliveByHex[b][v]]->pos.x + 202, creAnims[stackAliveByHex[b][v]]->pos.y + 260));
std::stringstream ss;
ss<<stacks[stackAliveByHex[b][v]].amount;
CSDL_Ext::printAtMiddleWB(ss.str(), creAnims[stackAliveByHex[b][v]]->pos.x + 202 + 14, creAnims[stackAliveByHex[b][v]]->pos.y + 260 + 4, GEOR13, 20, zwykly, to);
}
} }
} }
} }
@ -398,6 +382,7 @@ void CBattleInterface::bSurrenderf()
void CBattleInterface::bFleef() void CBattleInterface::bFleef()
{ {
giveCommand(4,0,0); giveCommand(4,0,0);
CGI->curh->changeGraphic(0, 0);
} }
void CBattleInterface::bAutofightf() void CBattleInterface::bAutofightf()

View File

@ -595,6 +595,9 @@ int CSDL_Ext::blit8bppAlphaTo24bpp(SDL_Surface * src, SDL_Rect * srcRect, SDL_Su
sr.w = dstRect->w = w; sr.w = dstRect->w = w;
sr.h = dstRect->h = h; sr.h = dstRect->h = h;
if(SDL_LockSurface(dst))
return -1; //if we cannot lock the surface
if(dst->format->Rshift==0) //like in most surfaces if(dst->format->Rshift==0) //like in most surfaces
{ {
for(int y=0; y<sr.h; ++y) for(int y=0; y<sr.h; ++y)
@ -679,6 +682,7 @@ int CSDL_Ext::blit8bppAlphaTo24bpp(SDL_Surface * src, SDL_Rect * srcRect, SDL_Su
} }
} }
} }
SDL_UnlockSurface(dst);
} }
} }
return 0; return 0;

View File

@ -5,7 +5,7 @@
9 SMBALX.DEF 1 9 SMBALX.DEF 1
18 PELFX.DEF 0 18 PELFX.DEF 0
19 PELFX.DEF 0 19 PELFX.DEF 0
29 CPGRE.DEF 1 29 CPRGRE.DEF 1
34 PMAGX.DEF 1 34 PMAGX.DEF 1
35 PMAGX.DEF 1 35 PMAGX.DEF 1
41 SMBALX.DEF 0 41 SMBALX.DEF 0