Fix extended characters in font

Implement palette manipulation

svn-id: r26637
This commit is contained in:
Vincent Hamm 2007-04-28 00:26:57 +00:00
parent ff42c7f01b
commit b563363911
5 changed files with 48 additions and 18 deletions

View file

@ -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;

View file

@ -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) {

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;