From b05fa7f20414d6a7571a9ba52f542e527f598c62 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 11 Dec 2012 02:56:48 +0200 Subject: TINSEL: Add resource handling of the BE resources in DW1 Mac This is the second attempt. All the BE resources of DW1 Mac are handled correctly now. Added READ_16, READ_32, FROM_16, FROM_32 and TO_32 to handle all of the different cases where endianess is already handled. Note that the game scripts are LE, so these haven't been changed --- engines/tinsel/palette.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'engines/tinsel/palette.cpp') diff --git a/engines/tinsel/palette.cpp b/engines/tinsel/palette.cpp index e6c9467fab..9155386bbc 100644 --- a/engines/tinsel/palette.cpp +++ b/engines/tinsel/palette.cpp @@ -102,7 +102,7 @@ void psxPaletteMapper(PALQ *originalPal, uint8 *psxClut, byte *mapperTable) { memset(mapperTable, 0, 16); for (int j = 1; j < 16; j++) { - clutEntry = READ_LE_UINT16(psxClut + (sizeof(uint16) * j)); + clutEntry = READ_16(psxClut + (sizeof(uint16) * j)); if (clutEntry) { if (clutEntry == 0x7EC0) { // This is an already known value, used by the in-game text mapperTable[j] = 232; @@ -110,7 +110,7 @@ void psxPaletteMapper(PALQ *originalPal, uint8 *psxClut, byte *mapperTable) { } // Check for correspondent color - for (uint i = 0; (i < FROM_LE_32(pal->numColors)) && !colorFound; i++) { + for (uint i = 0; (i < FROM_32(pal->numColors)) && !colorFound; i++) { // get R G B values in the same way as psx format converters uint16 psxEquivalent = TINSEL_PSX_RGB(TINSEL_GetRValue(pal->palRGB[i]) >> 3, TINSEL_GetGValue(pal->palRGB[i]) >> 3, TINSEL_GetBValue(pal->palRGB[i]) >> 3); @@ -152,7 +152,7 @@ void PalettesToVideoDAC() { // we are using a palette handle // get hardware palette pointer - pPalette = (const PALETTE *)LockMem(pDACtail->pal.hRGBarray); + pPalette = (const PALETTE *)LockMem(FROM_32(pDACtail->pal.hRGBarray)); // get RGB pointer pColors = pPalette->palRGB; @@ -318,7 +318,7 @@ PALQ *AllocPalette(SCNHANDLE hNewPal) { p->objCount = 1; // init number of objects using palette p->posInDAC = iDAC; // set palettes start pos in video DAC p->hPal = hNewPal; // set hardware palette data - p->numColors = FROM_LE_32(pNewPal->numColors); // set number of colors in palette + p->numColors = FROM_32(pNewPal->numColors); // set number of colors in palette if (TinselV2) // Copy all the colors @@ -430,24 +430,24 @@ void SwapPalette(PALQ *pPalQ, SCNHANDLE hNewPal) { // validate palette Q pointer assert(pPalQ >= g_palAllocData && pPalQ <= g_palAllocData + NUM_PALETTES - 1); - if (pPalQ->numColors >= (int)FROM_LE_32(pNewPal->numColors)) { + if (pPalQ->numColors >= (int)FROM_32(pNewPal->numColors)) { // new palette will fit the slot // install new palette pPalQ->hPal = hNewPal; if (TinselV2) { - pPalQ->numColors = FROM_LE_32(pNewPal->numColors); + pPalQ->numColors = FROM_32(pNewPal->numColors); // Copy all the colors - memcpy(pPalQ->palRGB, pNewPal->palRGB, FROM_LE_32(pNewPal->numColors) * sizeof(COLORREF)); + memcpy(pPalQ->palRGB, pNewPal->palRGB, FROM_32(pNewPal->numColors) * sizeof(COLORREF)); if (!pPalQ->bFading) // Q the change to the video DAC - UpdateDACqueue(pPalQ->posInDAC, FROM_LE_32(pNewPal->numColors), pPalQ->palRGB); + UpdateDACqueue(pPalQ->posInDAC, FROM_32(pNewPal->numColors), pPalQ->palRGB); } else { // Q the change to the video DAC - UpdateDACqueueHandle(pPalQ->posInDAC, FROM_LE_32(pNewPal->numColors), hNewPal); + UpdateDACqueueHandle(pPalQ->posInDAC, FROM_32(pNewPal->numColors), hNewPal); } } else { // # colors are different - will have to update all following palette entries @@ -546,7 +546,7 @@ void CreateTranslucentPalette(SCNHANDLE hPalette) { // leave background color alone g_transPalette[0] = 0; - for (uint i = 0; i < FROM_LE_32(pPal->numColors); i++) { + for (uint i = 0; i < FROM_32(pPal->numColors); i++) { // get the RGB color model values uint8 red = TINSEL_GetRValue(pPal->palRGB[i]); uint8 green = TINSEL_GetGValue(pPal->palRGB[i]); @@ -574,7 +574,7 @@ void CreateGhostPalette(SCNHANDLE hPalette) { // leave background color alone g_ghostPalette[0] = 0; - for (i = 0; i < (int)FROM_LE_32(pPal->numColors); i++) { + for (i = 0; i < (int)FROM_32(pPal->numColors); i++) { // get the RGB color model values uint8 red = TINSEL_GetRValue(pPal->palRGB[i]); uint8 green = TINSEL_GetGValue(pPal->palRGB[i]); -- cgit v1.2.3