diff options
Diffstat (limited to 'engines/cruise')
-rw-r--r-- | engines/cruise/cell.h | 2 | ||||
-rw-r--r-- | engines/cruise/font.cpp | 4 | ||||
-rw-r--r-- | engines/cruise/function.cpp | 53 | ||||
-rw-r--r-- | engines/cruise/mainDraw.cpp | 4 | ||||
-rw-r--r-- | engines/cruise/various.cpp | 3 |
5 files changed, 48 insertions, 18 deletions
diff --git a/engines/cruise/cell.h b/engines/cruise/cell.h index 3f7b947e75..305df76561 100644 --- a/engines/cruise/cell.h +++ b/engines/cruise/cell.h @@ -41,7 +41,7 @@ struct cellStruct { int16 field_A; int16 field_C; int16 spriteIdx; - int16 field_10; + int16 color; int16 backgroundPlane; int16 freeze; int16 field_16; diff --git a/engines/cruise/font.cpp b/engines/cruise/font.cpp index a5758db361..22f358033e 100644 --- a/engines/cruise/font.cpp +++ b/engines/cruise/font.cpp @@ -598,7 +598,7 @@ gfxEntryStruct *renderText(int inRightBorder_X, uint8 *string) { do { int spacesCount = 0; // si - char character = *string; + unsigned char character = *string; short int strPixelLength; // var_16 uint8 *ptrStringEnd; // var_4 //ok int drawPosPixel_X; // di @@ -628,7 +628,7 @@ gfxEntryStruct *renderText(int inRightBorder_X, uint8 *string) { do { character = *(string++); - short int charData = fontCharacterTable[(int)character]; // get character position + short int charData = fontCharacterTable[character]; // get character position if (character) { if (character == ' ' || character == 0x7C) { diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp index e8e86d82b6..f2d3ab0003 100644 --- a/engines/cruise/function.cpp +++ b/engines/cruise/function.cpp @@ -703,7 +703,7 @@ int16 Op_AddMessage(void) { if (color == -1) { color = 0; - //ASSERT(0); + ASSERT(0); //color = calcTabSomething(); } else { if (CVTLoaded) { @@ -939,17 +939,46 @@ int16 Op_removeBackgroundIncrust(void) { return 0; } -int16 Op_SetColor(void) { // TODO: palette manipulation - //var_4 = popVar(); - //var_6 = popVar(); - //var_8 = popVar(); - //int si = popVar(); - //int di = popVar(); - popVar(); - popVar(); - popVar(); - popVar(); - popVar(); +int16 Op_SetColor(void) { + int colorB = popVar(); + int colorG = popVar(); + int colorR = popVar(); + int endIdx = popVar(); + int startIdx = popVar(); + + int i; + + int R,G,B; + +#define convertRatio 36.571428571428571428571428571429 + + for(i=startIdx; i<=endIdx; i++) + { + R = (int)(colorR*convertRatio); + G = (int)(colorG*convertRatio); + B = (int)(colorB*convertRatio); + + if (R > 0xFF) + R = 0xFF; + if (G > 0xFF) + G = 0xFF; + if (B > 0xFF) + B = 0xFF; + + if (CVTLoaded) { + int colorIdx = cvtPalette[i]; + + lpalette[colorIdx].R = R; + lpalette[colorIdx].G = G; + lpalette[colorIdx].B = B; + } + else + { + lpalette[i].R = R; + lpalette[i].G = G; + lpalette[i].B = B; + } + } return 0; } diff --git a/engines/cruise/mainDraw.cpp b/engines/cruise/mainDraw.cpp index 6804075a07..241905e56d 100644 --- a/engines/cruise/mainDraw.cpp +++ b/engines/cruise/mainDraw.cpp @@ -1085,7 +1085,7 @@ void mainDraw(int16 param) { mainDraw6(); var20 = 0; - //-------------------------------------------------- DRAW OBJECTS TYPE 5 -----------------------------------------// + //-------------------------------------------------- DRAW OBJECTS TYPE 5 (MSG)-----------------------------------------// currentObjPtr = cellHead.next; @@ -1093,7 +1093,7 @@ void mainDraw(int16 param) { if (currentObjPtr->type == 5 && currentObjPtr->freeze == 0) { mainSprite(currentObjPtr->field_A, currentObjPtr->field_C, currentObjPtr->gfxPtr, - gfxModuleData.pPage10, currentObjPtr->field_10, + gfxModuleData.pPage10, currentObjPtr->color, currentObjPtr->spriteIdx); var20 = 1; } diff --git a/engines/cruise/various.cpp b/engines/cruise/various.cpp index 52b204dbf5..e6a659c5ec 100644 --- a/engines/cruise/various.cpp +++ b/engines/cruise/various.cpp @@ -117,6 +117,7 @@ char *getText(int textIndex, int overlayIndex) { void createTextObject(int overlayIdx, int oldVar8, cellStruct *pObject, int scriptNumber, int scriptOverlayNumber, int backgroundPlane, int16 color, int oldVar2, int oldVar4, int oldVar6) { + char *ax; cellStruct *savePObject = pObject; cellStruct *cx; @@ -144,7 +145,7 @@ void createTextObject(int overlayIdx, int oldVar8, cellStruct *pObject, pNewElement->field_A = oldVar6; pNewElement->field_C = oldVar4; pNewElement->spriteIdx = oldVar2; - pNewElement->field_10 = color; + pNewElement->color = color; pNewElement->freeze = 0; pNewElement->field_16 = scriptNumber; pNewElement->field_18 = scriptOverlayNumber; |