RCT2RideGenerator icon indicating copy to clipboard operation
RCT2RideGenerator copied to clipboard

Share code with OpenRCT2

Open janisozaur opened this issue 8 years ago • 1 comments

With recent refactoring of our object loading code (OpenRCT2/OpenRCT2#4024), if you can stomach some C++, perhaps you could use the same object loading code as we do.

janisozaur avatar Jul 14 '16 09:07 janisozaur

Though it would seem desirable to have some consistency, I don't know or particularly like C++ so I'd rather not have parts of this code written it. If OpenRCT2 had been around when I started the project I might have made use of it, but now I have an alternative that I feel is better suited to this usage, it is unlikely I'll switch.

The OpenRCT2 object loading code copies the image table into memory as a block, and the image drawing code is responsible for decoding it. I convert all RLE bitmaps into direct style so that code which modifies them does not have to care about how they are encoded. The idea is that all decoding/encoding code should go in one place. The other difference is the way strings and images are handled - in OpenRCT2 this is an index into a global array, whereas I just use a pointer to the relevant data.

Also, I am trying to decouple my code from the specifics of RCT2 itself, both because I don't know if the object format is going to change in future and because I want to be able to reuse the renderer for my own stuff. I'm working on moving all the RCT2 code into a library which will only be called to write the final output.

I've already used the new code to implement a tool for creating land blocks, and I will refactor the ride generator to use this library as soon as ride loading is working. I'd rather stick with this plan than try to integrate code from OpenRCT2.

X123M3-256 avatar Jul 15 '16 10:07 X123M3-256