Jump to content

GEMRB on Android


Guest Chas Grady

Recommended Posts

lynx, can I change some code to set font color manualy? In what file?

If i'm not wrong, this color is in the .chu file coming with the game.

Specifically: guiinv.chu.

Window ID:5, control ID (textarea): 5

My rgb values are: 220,170,110

Hmm, this is not a dark brown. This color is similar to the one that I get. But in original game color is dark brown.

Well, what about function wich dispay the text? Can I modify it to override color?

Link to comment

Actually, there are 3 rgb values.

I think the font color ranges from (50,10,0) to (220,170,110) and the background is (220,170,110)

 

50,10,0 is a very dark brown.

 

Maybe there is some bug that prevents the font palette to be properly scaled?

Link to comment
Actually, there are 3 rgb values.

I think the font color ranges from (50,10,0) to (220,170,110) and the background is (220,170,110)

 

50,10,0 is a very dark brown.

 

Maybe there is some bug that prevents the font palette to be properly scaled?

 

I think that palettes not properly created... For items descriptions, and tooltips using some font and the same palette? I found a place in interface.cpp where setting palette for the tooltips. Where is the place that sets font and palette for descriptions?

If you can, put please this font as image in this thread, so I can understand how it works. Or tell me how to get it out of resources to look at.

 

P.S. thanks for the help

Link to comment
The actual palette color is set in TextArea, but it calls a core function in Interface.

 

core->CreatePalette(hitextcolor, lowtextcolor)

 

TextArea includes 4 palettes:

Palette* palette;

Palette* initpalette;

Palette* selected;

Palette* lineselpal;

What do they mean?

Link to comment
they are: normal palette, drop capital palette, and 2 selected line highlight colors

 

I guess you want to see the first.

 

Avenger, I find an issue in source code. I don't understand thats works properly on linux systems.

Look at the CreatePalette function:

 

Palette* Interface::CreatePalette(const Color &color, const Color &back)

{

Palette* pal = new Palette();

pal->col[0].r = 0;

pal->col[0].g = 0xff;

pal->col[0].b = 0;

pal->col[0].a = 0;

for (int i = 1; i < 256; i++) {

pal->col.r = back.r +

( unsigned char ) ( ( ( color.r - back.r ) * ( i ) ) / 255.0 );

pal->col.g = back.g +

( unsigned char ) ( ( ( color.g - back.g ) * ( i ) ) / 255.0 );

pal->col.b = back.b +

( unsigned char ) ( ( ( color.b - back.b ) * ( i ) ) / 255.0 );

pal->col.a = back.a +

( unsigned char ) ( ( ( color.a - back.a ) * ( i ) ) / 255.0 );

}

return pal;

}

 

If color component values in "back" variable is greater than values in "color" variable result of expression ( ( ( color.a - back.a ) * ( i ) ) / 255.0 ) always negative. Casting negative value to unsigned char returns 0. In this case all color members on palette is "back". And font color is "back". This is the reason for unreadable font.

 

I think it would be correct as follows:

............

pal->col.r = ( unsigned char )(back.r + ( ( color.r - back.r ) * ( i ) ) / 255.0 );

pal->col.g = ( unsigned char )(back.g + ( ( color.g - back.g ) * ( i ) ) / 255.0 );

pal->col.b = ( unsigned char )(back.b + ( ( color.b - back.b ) * ( i ) ) / 255.0 );

pal->col.a = ( unsigned char )(back.a + ( ( color.a - back.a ) * ( i ) ) / 255.0 );

............

 

This code works properly.

Link to comment
Casting negative value to unsigned char returns 0.

 

That is why it works for us: this isn't the case for x86/powerpc machines. I would guess it is caused by some floating-point emulation code your toolchain is using for Android.

 

Hopefully we can just get rid of the floating-point use in this code..

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...