Interrupt / systemshock

Shockolate - A minimalist and cross platform System Shock source port.
GNU General Public License v3.0
802 stars 62 forks source link

Rewrite low-level Draw4x4 routines in more portable C++ (64-bit compatibility) #314

Closed icosahedral-dragon closed 4 years ago

icosahedral-dragon commented 4 years ago

The previous code was adapted directly from the object code and very much x86-register based. It used 32-bit integers and pointers interchangeably and made the 64-bit compiler very unhappy. I've updated it to be 64-bit friendly.

Note that although the code is more portable, it's still not exactly readable. I could do a complete rewrite if people think it's worth it; however, although Terri Brosius has a wonderful voice, I'm not sure how many more times I can listen to her say "New Atlanta. Sector 11. Building 71-G" without going round the twist :)

donnierussellii commented 4 years ago

I found this info that might make rewrite easier: https://github.com/inkyblackness/ss-specs/blob/master/media/moviResources.md

icosahedral-dragon commented 4 years ago

That sounded like a vote for a complete rewrite to me. I'll see what I can do.

donnierussellii commented 4 years ago

I was looking at Underworld Exporter's source code, and it seemed they had some functions to deal with the decoding of SS1 movies that we could appropriate. But the code only seems to handle RLE'd data, and is shared with UW's bitmap decoding. I finally realized this is for playing back "low resolution" movies.

With all that info on high resolution video decoding, I'm surprised there isn't already a C implementation in some project somewhere.

donnierussellii commented 4 years ago

I really should google around a bit more before posting :(

There's a go implementation in hacked: https://github.com/inkyblackness/hacked/blob/master/ss1/content/movie/internal/compression/FrameDecoder.go

Thanks for your hard work, by the way! :)

icosahedral-dragon commented 4 years ago

OK, having finally got the right files committed (I shouldn't git in the morning before I've had my tea): Thanks for the research @donnierussellii . I've reworked my original nasty 'portable assembler' code in to actual C++ with comments derived from ss-specs. This looks much nicer and works in 32 and 64-bit code. I'm not planning on taking this any further unless somebody has specific comments to be addressed.