1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Support for videos in 16 bpp. Minor fixes.

This commit is contained in:
Michał W. Urbańczyk
2010-08-08 14:39:41 +00:00
parent bdcdc89991
commit afe84deb03
2 changed files with 33 additions and 10 deletions

View File

@@ -2202,7 +2202,7 @@ ui8 CGTownInstance::getPassableness() const
if ( tempOwner == 255 )//neutral guarded - noone can visit
return 0;
ui8 mask;
ui8 mask = 0;
TeamState * ts = cb->gameState()->getPlayerTeam(tempOwner);
BOOST_FOREACH(ui8 it, ts->players)
mask |= 1<<it;//allies - add to possible visitors
@@ -5287,7 +5287,7 @@ ui8 CGGarrison::getPassableness() const
if ( tempOwner == 255 )//neutral guarded - noone can visit
return 0;
ui8 mask;
ui8 mask = 0;
TeamState * ts = cb->gameState()->getPlayerTeam(tempOwner);
BOOST_FOREACH(ui8 it, ts->players)
mask |= 1<<it;//allies - add to possible visitors

View File

@@ -188,6 +188,9 @@ void CBIKHandler::show( int x, int y, SDL_Surface *dst, bool update )
switch(Bpp)
{
case 2:
mode = 3; //565, mode 2 is 555 probably
break;
case 3:
mode = 0;
break;
@@ -351,6 +354,8 @@ void CSmackPlayer::redraw( int x, int y, SDL_Surface *dst, bool update )
// draw the frame
Uint16* addr = (Uint16*) (buffer+w*(h-1)*2-2);
if(dst->format->BytesPerPixel >= 3)
{
for( int j=0; j<h-1; j++) // why -1 ?
{
for ( int i=w-1; i>=0; i--)
@@ -365,6 +370,24 @@ void CSmackPlayer::redraw( int x, int y, SDL_Surface *dst, bool update )
addr--;
}
}
}
else if(dst->format->BytesPerPixel == 2)
{
for( int j=0; j<h-1; j++) // why -1 ?
{
for ( int i=w-1; i>=0; i--)
{
//convert rgb 555 to 565
Uint16 pixel = *addr;
Uint16 *p = (Uint16 *)((Uint8 *)dst->pixels + (j+y) * dst->pitch + (i + x) * dst->format->BytesPerPixel);
*p = (pixel & 0x1F)
+ ((pixel & 0x3e0) << 1)
+ ((pixel & 0x7c00) << 1);
addr--;
}
}
}
if ( SDL_MUSTLOCK(dst) )
{