U7 .shp files and bitmaps

NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Forum rules
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Locked
James

U7 .shp files and bitmaps

Post by James »

Hi all,

I have a weird problem. I've been working on a tool to convert u7 .shp files to windows .bmp. When I open up the newly generated bitmap file with paint the image is all screwed up, but when I load the same bitmap into a program I wrote it comes out fine (except for images that are screwed up anyways due to offsets being wrong, I believe). Any help would be greatly appreciated. Thanks.

-Beholder
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: U7 .shp files and bitmaps

Post by Dominus »

hm, it might be useful to look at the code of Exult as Exult Studio already has the option to export frames from the shp files (frames might even be what makes Paint screw up) as png files.

Or even look at the code of shp2pcx in /tools of the exult code
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
James

Re: U7 .shp files and bitmaps

Post by James »

I'll take a looksie, thanks.

-Beholder
wjp
Site Admin
Posts: 1708
Joined: Thu May 14, 2020 1:34 pm

Re: U7 .shp files and bitmaps

Post by wjp »

From what you say it seems as if you're writting invalid bitmaps.
Nuclear Loser

Re: U7 .shp files and bitmaps

Post by Nuclear Loser »

does the program you wrote show other bitmap files fine??? Also.. try your bitmaps with another viewer as well.
James

Re: U7 .shp files and bitmaps

Post by James »

It would seem that I'm writing the bitmaps incorrectly. I don't understand what's wrong with it though. It's just the image buffer I think, because all of the header fields and the palette seem fine.

I calloc() the appropriate size of memory and double check to make sure it's right and then just set all of the bytes to 255. After writing it to file it still comes out weird. Can I post the parts of the code that seem to be the trouble? (it's not very big)
Kristoph

Re: U7 .shp files and bitmaps

Post by Kristoph »

Go read the bitmap specification. That format is evil, I know about it myself :)

The biggest problem I got is that all lines must be have a length multiple of 4 bytes. So add padding at the end of your lines.
James

Re: U7 .shp files and bitmaps

Post by James »

Wow, it is evil...That was it the whole time. Thanks!!!!! =)

(Beholder invented a few new swearing combos because of this)

-Beholder
Locked