Merge branch 'master' of https://github.com/edubart/otclient
This commit is contained in:
commit
45b41b88bd
|
@ -105,6 +105,7 @@ GameNewOutfitProtocol = 49
|
|||
GamePVPMode = 50
|
||||
GameWritableDate = 51
|
||||
GameAdditionalVipInfo = 52
|
||||
GameSpritesAlphaChannel = 56
|
||||
|
||||
TextColors = {
|
||||
red = '#f55e5e', --'#c83200'
|
||||
|
|
|
@ -387,6 +387,7 @@ namespace Otc
|
|||
GameBaseSkillU16 = 53,
|
||||
GameCreatureIcons = 54,
|
||||
GameHideNpcNames = 55,
|
||||
GameSpritesAlphaChannel = 56,
|
||||
|
||||
LastGameFeature = 101
|
||||
};
|
||||
|
|
|
@ -153,6 +153,8 @@ ImagePtr SpriteManager::getSpriteImage(int id)
|
|||
uint8 *pixels = image->getPixelData();
|
||||
int writePos = 0;
|
||||
int read = 0;
|
||||
bool useAlpha = g_game.getFeature(Otc::GameSpritesAlphaChannel);
|
||||
uint8 channels = useAlpha ? 4 : 3;
|
||||
|
||||
// decompress pixels
|
||||
while(read < pixelDataSize && writePos < SPRITE_DATA_SIZE) {
|
||||
|
@ -171,11 +173,11 @@ ImagePtr SpriteManager::getSpriteImage(int id)
|
|||
pixels[writePos + 0] = m_spritesFile->getU8();
|
||||
pixels[writePos + 1] = m_spritesFile->getU8();
|
||||
pixels[writePos + 2] = m_spritesFile->getU8();
|
||||
pixels[writePos + 3] = 0xFF;
|
||||
pixels[writePos + 3] = useAlpha ? m_spritesFile->getU8() : 0xFF;
|
||||
writePos += 4;
|
||||
}
|
||||
|
||||
read += 4 + (3 * coloredPixels);
|
||||
read += 4 + (channels * coloredPixels);
|
||||
}
|
||||
|
||||
// fill remaining pixels with alpha
|
||||
|
|
|
@ -110,7 +110,7 @@ void Image::blit(const Point& dest, const ImagePtr& other)
|
|||
int y = p / other->getWidth();
|
||||
int pos = ((dest.y + y) * m_size.width() + (dest.x + x)) * 4;
|
||||
|
||||
if(otherPixels[p*4+3] == 0xFF) {
|
||||
if (otherPixels[p*4+3] != 0) {
|
||||
m_pixels[pos+0] = otherPixels[p*4+0];
|
||||
m_pixels[pos+1] = otherPixels[p*4+1];
|
||||
m_pixels[pos+2] = otherPixels[p*4+2];
|
||||
|
|
Loading…
Reference in New Issue