FS#5886 - [Allegro] Messed up colors when switching to zBase and back to OpenGFX

Attached to Project: OpenTTD
Opened by fonsinchen (fonsinchen) - Wednesday, 29 January 2014, 21:52 GMT
Last edited by fonsinchen (fonsinchen) - Sunday, 16 February 2014, 16:31 GMT
Type Bug
Category Core
Status Confirmed
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


The screenshot pretty much says it all. This is what I get when I start the game with OpenGFX, then switch to zBase, then switch back to OpenGFX. NightGFX looks fine, but even if I subsequently switch to NightGFX and then again back to OpenGFX it still looks bad with OpenGFX.
This task depends upon

Comment by fonsinchen (fonsinchen) - Wednesday, 29 January 2014, 21:57 GMT
It doesn't even matter which other baseset I use. I consistently get that effect whenever I switch to OpenGFX from the options menu, but I don't get it if I start the game with OpenGFX.
Comment by fonsinchen (fonsinchen) - Friday, 31 January 2014, 21:01 GMT
This is specific to the allegro video driver which I was accidentally using instead of SDL.

Apparently it happens when switching from a 32bit blitter to an 8bit one. In this case it's switching from 32bpp-sse4 to 8bpp-optimized. If I specify a 32bit blitter on the command line everything is fine.
Comment by frosch (frosch) - Saturday, 01 February 2014, 14:52 GMT
I tried to call set_palette_range and set_palette every tick. But it does not seem to have any effect whatsoever.

Looks like switching video modes breaks allegro. Besided the palette animation not working, also the OS mouse pointer shows up.
* Starting with -b 32bpp-optimized, everything works
* Already starting with zbase and not forcing a 32bpp blitter breaks the OS pointer, since OTTD automatically switches to a 32bpp blitter (which involves changing the video mode).
Comment by MJP (MJP) - Monday, 03 February 2014, 14:21 GMT
On my system, the mouse pointer problem is solved by removing "select_mouse_cursor(MOUSE_CURSOR_ARROW);" in allegro_v.cpp.
The documentation says: "This function allows you to use the operating system's native mouse cursors rather than some custom cursor."