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:
@@ -2202,7 +2202,7 @@ ui8 CGTownInstance::getPassableness() const
|
|||||||
if ( tempOwner == 255 )//neutral guarded - noone can visit
|
if ( tempOwner == 255 )//neutral guarded - noone can visit
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ui8 mask;
|
ui8 mask = 0;
|
||||||
TeamState * ts = cb->gameState()->getPlayerTeam(tempOwner);
|
TeamState * ts = cb->gameState()->getPlayerTeam(tempOwner);
|
||||||
BOOST_FOREACH(ui8 it, ts->players)
|
BOOST_FOREACH(ui8 it, ts->players)
|
||||||
mask |= 1<<it;//allies - add to possible visitors
|
mask |= 1<<it;//allies - add to possible visitors
|
||||||
@@ -5287,7 +5287,7 @@ ui8 CGGarrison::getPassableness() const
|
|||||||
if ( tempOwner == 255 )//neutral guarded - noone can visit
|
if ( tempOwner == 255 )//neutral guarded - noone can visit
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ui8 mask;
|
ui8 mask = 0;
|
||||||
TeamState * ts = cb->gameState()->getPlayerTeam(tempOwner);
|
TeamState * ts = cb->gameState()->getPlayerTeam(tempOwner);
|
||||||
BOOST_FOREACH(ui8 it, ts->players)
|
BOOST_FOREACH(ui8 it, ts->players)
|
||||||
mask |= 1<<it;//allies - add to possible visitors
|
mask |= 1<<it;//allies - add to possible visitors
|
||||||
|
@@ -188,6 +188,9 @@ void CBIKHandler::show( int x, int y, SDL_Surface *dst, bool update )
|
|||||||
|
|
||||||
switch(Bpp)
|
switch(Bpp)
|
||||||
{
|
{
|
||||||
|
case 2:
|
||||||
|
mode = 3; //565, mode 2 is 555 probably
|
||||||
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
mode = 0;
|
mode = 0;
|
||||||
break;
|
break;
|
||||||
@@ -351,18 +354,38 @@ void CSmackPlayer::redraw( int x, int y, SDL_Surface *dst, bool update )
|
|||||||
|
|
||||||
// draw the frame
|
// draw the frame
|
||||||
Uint16* addr = (Uint16*) (buffer+w*(h-1)*2-2);
|
Uint16* addr = (Uint16*) (buffer+w*(h-1)*2-2);
|
||||||
for( int j=0; j<h-1; j++) // why -1 ?
|
if(dst->format->BytesPerPixel >= 3)
|
||||||
{
|
{
|
||||||
for ( int i=w-1; i>=0; i--)
|
for( int j=0; j<h-1; j++) // why -1 ?
|
||||||
{
|
{
|
||||||
Uint16 pixel = *addr;
|
for ( int i=w-1; i>=0; i--)
|
||||||
|
{
|
||||||
|
Uint16 pixel = *addr;
|
||||||
|
|
||||||
Uint8 *p = (Uint8 *)dst->pixels + (j+y) * dst->pitch + (i + x) * dst->format->BytesPerPixel;
|
Uint8 *p = (Uint8 *)dst->pixels + (j+y) * dst->pitch + (i + x) * dst->format->BytesPerPixel;
|
||||||
p[2] = ((pixel & 0x7c00) >> 10) * 8;
|
p[2] = ((pixel & 0x7c00) >> 10) * 8;
|
||||||
p[1] = ((pixel & 0x3e0) >> 5) * 8;
|
p[1] = ((pixel & 0x3e0) >> 5) * 8;
|
||||||
p[0] = ((pixel & 0x1F)) * 8;
|
p[0] = ((pixel & 0x1F)) * 8;
|
||||||
|
|
||||||
addr--;
|
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--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user