StaticReturn wrote:
Did that. No errors were reported.
Wait. Did it at least print the text "SDL_SetColors" when you had the problem?
I have seen cases when the actual error message (as returned by SDL_GetError()) was an empty string. (But that happened with SDL_RemoveTimer().)
If this is the case then it should print a line containing only "SDL_SetColors: " and nothing else. Did that appear?
David wrote:
Maybe they are loaded as RGB images and this is why SDL_SetColors() can't set their palette?
This could be checked by inserting the following statement, just before sdlperror("SDL_SetColors");
Code: Select all
fprintf(stderr, "i=%d, BitsPerPixel=%d, palette=%p\n", i, chtab->pointers[i]->format->BitsPerPixel, chtab->pointers[i]->format->palette);
Please try that and show me what does it output. (Go to the guard and make sure it does not have the correct colors.)
(If you have the GUARD.DAT file in the folder, delete or rename it. I want to see what happens if the PNG images are used.)
StaticReturn wrote:
• When I copy G*.DATA into the my working directory of SDLPoP, that solves the palette issue.
Right, so we found a solution (or workaround).
StaticReturn wrote:
• load_from_opendats_metadata():: At about line 1490, just above the fp = NULL; I put in some debugging code which printed "i=62, res_count=62".
62 is the number of resources in PRINCE.DAT (the file, not the folder).
That part is executed when a resource is not found in a DAT file. (But it might exist in another DAT file.)
StaticReturn wrote:
When loading from a folder with only .DAT Files
• I get the message "Can't load sprites from resource 1000."
I think you deleted the data/font folder. You shouldn't delete it, it is needed for displaying text.
(I think I should add a default font inside the exe, as the original PoP does it. So SDLPoP would start without data/font.)
StaticReturn wrote:
• After line 1493 ("// If it's a directory:") I put the following debug statement: "fprintf( stderr, "%s, %lu, %s, %d, %s\n", image_filename, sizeof(image_filename), pointer->filename, resource_id, extension );". The results are in the attached file.
Did you get this at the same time as you got the error "Can't load sprites from resource 1000."?
Because in with.txt, I see that the font images 1032..1131 *could* be loaded, because these IDs are *not* searched in PRINCE.DAT. But 1001..1031 and 1132..1255 are searched in PRINCE.DAT.
(SDLPoP searches each ID in all currently open DAT files until it finds it. When the font is loaded, "font" and "PRINCE.DAT" are open.
So it first searches in "font", and if it's not there, it searches in "PRINCE.DAT".)
StaticReturn wrote:
• open_dat() tries to open a file named "font", then before the next call to open_dat(), load_from_opendats_metadata() gets a call to open a filename called "data/font/res1000.pal".
This is just SDLPoP trying to find its font.