1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

More endianess checking / minor

This commit is contained in:
Michał W. Urbańczyk 2008-07-16 22:40:16 +00:00
parent 6f7b29afcc
commit d371f14ad2

View File

@ -200,9 +200,15 @@ SDL_Surface * CPCXConv::getSurface()
}
else
{
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
int bmask = 0xff0000;
int gmask = 0x00ff00;
int rmask = 0x0000ff;
#else
int bmask = 0x0000ff;
int gmask = 0x00ff00;
int rmask = 0xff0000;
#endif
ret = SDL_CreateRGBSurface(SDL_SWSURFACE, bh.x+add, bh.y, 24, rmask, gmask, bmask, 0);
}
if (format==PCX8B)
@ -211,9 +217,15 @@ SDL_Surface * CPCXConv::getSurface()
for (int i=0;i<256;i++)
{
SDL_Color tp;
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
tp.b = pcx[it++];
tp.g = pcx[it++];
tp.r = pcx[it++];
#else
tp.r = pcx[it++];
tp.g = pcx[it++];
tp.b = pcx[it++];
#endif
tp.unused = 0;
*(ret->format->palette->colors+i) = tp;
}
@ -680,7 +692,7 @@ void CLodHandler::extract(std::string FName)
for (int i=0;i<totalFiles;i++)
{
fseek(FLOD, entries[i].offset, 0);
std::string bufff = (/*DATADIR + */FName.substr(0, FName.size()-4) + PATHSEPARATOR + (char*)entries[i].name);
std::string bufff = (DATADIR + FName.substr(0, FName.size()-4) + PATHSEPARATOR + (char*)entries[i].name);
unsigned char * outp;
if (entries[i].size==0) //file is not compressed
{