Can someone tell me how SC loads images from the mpq files? Does it use one of the functions from Storm.dll? Which address is function to load the image is at?
None.
Do you mean pcx or images.dat/grp images? Pcx images are loaded using storm function #321, SBmpDecodeImage.
Images.dat iscript.bin, and any .lo, and .grp files are loaded to the memory by function located at 004D7180 (1.16.1 address, no arguments, returns nothing), which is called once during the loading screen before main menu. The .grps are not decoded there though, decoding is done every time an image has to be drawn on the screen.
None.
Oh i just realized i wasn't clear on my first post. I meant the pcx graphics. I don't think I'm looking for the decoding function, something more like loading the file into memory like Load(data.mpq, "Dir1/Dir2/file.pcx)
Well, all of the files (maybe not .smks) are opened through combination of SFileOpenFileEx and SFileReadFile, is that what you need?
There is an function located at 004D2D10 which does the tedious work and returns a pointer to the file, but it's not used for all pcx files while being used for other unrelated data files:
004D2D10 = ReadMpqFile(), arg 1 char *chk_path, arg 2 unk, arg 3 unk, arg 4 char *source_file, arg 5 source_line, ecx open_mode, eax dword *out_filesize (Returns void *file)
Some of the pcx files (at least ofire.pcx and other remapping palettes) are just read with the function above and decoded with SBmpDecodeImage, but there is also Storm function #323 SBmpLoadImage, which is used at least when loading the player color pcx.
Can't really tell how it differs - it seems to do both mpq reading and decoding at once, but requires a buffer large enought to fit the uncompressed image, so it is only used when engine knows the image size beforehand?
Also menu images use function #325 SBmpAllocLoadImage, which seems to be the "best" pcx loading function, doing mpq access, memory allocation and and decoding - can't tell what parameters to pass there though.
All of those ways call SFile functions internally though to read from mpqs, if you wish to specify the mpq to read from you'll need to call SFileOpenFileEx by yourself, as the functions mentioned search all of the mpqs that have been loaded with SFileOpenArchive.
..was this even close to what you wished to know?
None.
Yes thank you, I'll look into all of those
None.