mirror of
https://github.com/vcmi/vcmi.git
synced 2025-05-13 22:06:58 +02:00
* Fixed the jumping creature animation bug when a unit isn't fully display at the battle screen. The upper creature turret moved (randomly) from left to right during battle and wasn't displayed at the correct x position.
This commit is contained in:
parent
c165593896
commit
f3b5ede486
@ -155,11 +155,10 @@ void CCreatureAnimation::playOnce( CCreatureAnim::EAnimType type )
|
||||
template<int bpp>
|
||||
int CCreatureAnimation::nextFrameT(SDL_Surface * dest, int x, int y, bool attacker, unsigned char animCount, bool IncrementFrame /*= true*/, bool yellowBorder /*= false*/, bool blueBorder /*= false*/, SDL_Rect * destRect /*= NULL*/)
|
||||
{
|
||||
//increasing frame numer
|
||||
//increasing frame number
|
||||
int SIndex = curFrame;
|
||||
if (IncrementFrame)
|
||||
incrementFrame();
|
||||
//frame number increased
|
||||
|
||||
long BaseOffset,
|
||||
SpriteWidth, SpriteHeight, //sprite format
|
||||
@ -199,35 +198,19 @@ int CCreatureAnimation::nextFrameT(SDL_Surface * dest, int x, int y, bool attack
|
||||
{
|
||||
ftcp += LeftMargin;
|
||||
}
|
||||
|
||||
TotalRowLength = 0;
|
||||
|
||||
// Note: Bug fixed (Rev 2115): The implementation of omitting lines was false.
|
||||
// We've to calculate several things so not showing/putting pixels should suffice.
|
||||
|
||||
int yB = ftcp / FullWidth + y;
|
||||
|
||||
bool omitIteration = false; //if true, we shouldn't try to blit this line to screen
|
||||
|
||||
if(yB < 0 || yB >= dest->h || (destRect && (destRect->y > yB || destRect->y + destRect->h <= yB ) ) )
|
||||
{
|
||||
//update variables
|
||||
omitIteration = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
SegmentType = FDef[BaseOffset++];
|
||||
SegmentLength = FDef[BaseOffset++];
|
||||
|
||||
|
||||
if(omitIteration)
|
||||
{
|
||||
ftcp += SegmentLength+1;
|
||||
if(SegmentType == 0xFF)
|
||||
{
|
||||
BaseOffset += SegmentLength+1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
int xB = (attacker ? ftcp % FullWidth : FullWidth - ftcp % FullWidth - 1) + x;
|
||||
|
||||
|
||||
@ -235,7 +218,7 @@ int CCreatureAnimation::nextFrameT(SDL_Surface * dest, int x, int y, bool attack
|
||||
|
||||
for (int k = 0; k <= SegmentLength; k++)
|
||||
{
|
||||
if(xB>=0 && xB<dest->w)
|
||||
if(xB >= 0 && xB < dest->w && yB >= 0 && yB < dest->h)
|
||||
{
|
||||
if(!destRect || (destRect->x <= xB && destRect->x + destRect->w > xB))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user