Dunno, GIMP for example shows letter keys with capital letters, whether they need Shift or not...
SDLPoP; David's open-source port of PoP
Re: SDLPoP; David's open-source port of PoP
(I wanted to post this a week ago, but the forum kept timing out then...)
Re: SDLPoP; David's open-source port of PoP
Can anyone tell me how the program knows that PRINCE/ has a collection of res151-173.png images that are part of a certain chtab that goes from 0-22 (and not e.g. 23)?
Time and time again, I try to modify SDLPoP to create custom stuff, but I simply cannot grasp how everything works. It's too complex for me. Every time I see a function, e.g. load_sprites_from_file(), it uses another function, e.g. load_from_opendats_alloc(), that uses another function, e.g. load_from_opendats_metadata(), and then I just lose track of things, and feel sad about how powerless I am when it comes to tweaking things.
Sometimes I then try to work around everything, by using my own image loading function and then drawing stuff to the screen, but the game loop is so intricate and tight that there's no way I can just dump something in there and have it show up in-game.
Damn.
Time and time again, I try to modify SDLPoP to create custom stuff, but I simply cannot grasp how everything works. It's too complex for me. Every time I see a function, e.g. load_sprites_from_file(), it uses another function, e.g. load_from_opendats_alloc(), that uses another function, e.g. load_from_opendats_metadata(), and then I just lose track of things, and feel sad about how powerless I am when it comes to tweaking things.
Sometimes I then try to work around everything, by using my own image loading function and then drawing stuff to the screen, but the game loop is so intricate and tight that there's no way I can just dump something in there and have it show up in-game.
Damn.

Re: SDLPoP; David's open-source port of PoP
The number of images is in the first byte of the palette, res150.pal in your example.
0x17 = 23 means that image IDs go from 150+1 = 151 to 150+23 = 173.
This code tells which set is loaded into which chtab:
(seg000.c)
Code: Select all
dathandle = open_dat("PRINCE.DAT", 'G');
[...]
// PRINCE.DAT: sword
chtab_addrs[id_chtab_0_sword] = load_sprites_from_file(700, 1<<2, 1);
// PRINCE.DAT: flame, sword on floor, potion
chtab_addrs[id_chtab_1_flameswordpotion] = load_sprites_from_file(150, 1<<3, 1);
This code loads the palette, which also contains the number of images:
(seg009.c)
Code: Select all
dat_shpl_type* shpl = (dat_shpl_type*) load_from_opendats_alloc(resource, "pal", NULL, NULL);
[...]
int n_images = shpl->n_images;
[...]
for (int i = 1; i <= n_images; i++) {
SDL_Surface* image = load_image(resource + i, pal_ptr);
[...]
chtab->images[i-1] = image;
}
(types.h)
Code: Select all
typedef struct dat_shpl_type {
byte n_images;
dat_pal_type palette;
} dat_shpl_type;
Re: SDLPoP; David's open-source port of PoP
My plan was to add collectable rotating coins, using floors with modifier 0x04, for a coins-mod. I tried that for 1 day (14th), then gave up and converted the plan into this basic tile idea instead. Next, I created Puny Prince from scratch, and included the previously planned coins-mod in it as "Coins of Persia".