From d371f14ad28155f178de900c377824e67025b976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=2E=20Urba=C5=84czyk?= Date: Wed, 16 Jul 2008 22:40:16 +0000 Subject: [PATCH] More endianess checking / minor --- hch/CLodHandler.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/hch/CLodHandler.cpp b/hch/CLodHandler.cpp index bf38ab9d0..e15221b5b 100644 --- a/hch/CLodHandler.cpp +++ b/hch/CLodHandler.cpp @@ -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