Friday, 15 March 2019

Advanced Rogue

I was reading the source code of Nethack one day and noticed that I can also read source code better these days, mirroring my increased skills in programming. So I downloaded the source code of Advanced Rogue which I think was last updated in 1985. Rogue had quite a number of variants just like Angband later, but I've never played any of them.

The source code of ARogue seems to be quite small, but it's also old school C which means that weird way of writing function definitions and declarations. The plan is to rewrite the source code to C++ (not OOP, but keeping the procedural style) just for fun reasons and I've already on the way. Another "problem" I guess is curses which is an external library used in ARogue and it's not included, but can be replaced with SDL2 gui. It's possible that curses has also changed during all these years, so it's probably not going to work just like that. However I could even keep the old function names so in theory it's possible to replace SDL2 gui with curses, or whatever.

As a small mystery some functions are defined, but not declared in any of header files. Or in this case rogue.h which is I think one of the two header files the project has. Creating header files for functions defined in a .cpp file is another task in the list.

Other than that I think the majority of old C code should run in a modern C++ compiler, but we'll see it later. There are lots of pointer stuff in ARogue's source which can be a problem and also I'm going to replace memory management routines with C++ code.

No comments: