thobbsinteractive / magic-carpet-2-hd

Recode Binary code of game Magic Carpet2 to C/C++ language(remake MC2 for any platform)
GNU General Public License v3.0
29 stars 5 forks source link

possible refactoring: Use Bullfrog Library as separate static lib #65

Open mefistotelis opened 2 years ago

mefistotelis commented 2 years ago

For some time now, I'm working on re-creating Bullfrog library as a static lib for my RE projects: https://github.com/mefistotelis/swars/tree/master/bflibrary

If matching functions can be recognized within Magic Carpet, it should be easy to switch to that library - I'm trying to keep compatibility with Bullfrog API from 1994-1997.

I'm using symbols and structs from Genewars - for that game we've got a beta version with most debug info.

The library contains RNC compression, sprites support, wrappers for file access, video and mouse. For sound, network, joystick, and routines making a base for GUI, Bullfrog had separate static libs - I will probably look into remaking them at some point as well.

So, this is a heads up, for a possible way to give this project better structure.

Currently I'm developing the lib within swars project, but it's also present in genewars, and older reimplementation is within keeperfx (it is not a separate static lib there though).

thobbsinteractive commented 2 years ago

That is good to read. I would be interested in seeing the results. I actually wanted to separate the RNC stuff off to a library in the hope of making a simple universal compression/decompression tool for Magic Carpet (as some of the up-scaled sprites seem to be missing). Tom did manage this with this source code (as he up-scaled the sprites) but it is not clear from the source how he did it.

mefistotelis commented 2 years ago

A simple RNC tool was made many years ago by Jon Skeet. Later I expanded that into my tools: http://syndicate.lubiki.pl/synd/rework/synd_rework_rnc.php

If you're interested into DAT/TAB sprites format, look at the tools around KeeperFX project - there I made tools which generate DAT/TABs from a series of PNG images. In fact, I made tools for all GFX and SFX formats used by DK.

For the bflibrary - I couldn't find many of the original function names in remc2. So first step would be to give related functions proper names. If you didn't replaced the API, switching to the static lib should then be easy. Not sure how you've solved higher resolutions - bflibrary is going to allow registering custom video modes, and then those modes can be used through standard bullfrog API.