It’s been three weeks since my last blog post. The time working on the project has mostly been spent reading code with very little writing.
The first thing I’ve worked on was creating the engine’s basics and implement some detection. For now, the code looks for the Penumbra.exe file but there are plans to expand it in the future to support different versions and languages.
Next, I worked on getting the open-source engine code in the into scummvm and to get it to a state where it would compile. Fortunately, the code is well structured with most of the non-portable or library dependent code is isolated in the impl folders. Some notable exceptions to this where anonymous union members that was used in the Vector*
classes and the __super
keyword which are both msvc extensions. Speaking of anonymous union members, while trying to compile without extensions I kept getting an error related to some windows header. Now, I was sure that they had all been removed and a quick search confirmed it. I then looked for other headers surrounded by #ifdef WIN32
but still nothing. Turns out the problem was caused by the innocent looking ObjectArray header which I found out by trying to compile the engine on another platform. Another problem I encountered, was that after auto formatting the new code, some headers where reordered leading to errors for headers that didn’t include everything they were using. It’s the first time I’ve dealt with this problem and understanding what had happened took some time.
This past week I’ve been working on resource loading. I’ve started by looking at the tinyxml library present in the impl folder which is heavily used to load resources such as configuration files, information about materials and sound effects, model data, and others. The work mostly consisted of replacing the file handling functions and the string implementation. After this I’ve worked on the logging functions (Error
, Warning
and Log
) which previously wrote everything to a file but now use debugN
with an appropriate level. In the future, as I go through the code, unnecessary logging will be removed, and appropriate debug channel will be added. The last thing I did this week was to look at the management of the resource files. This is done by adding resource directories to a cFileSearcher
object which looks for all the files (optionaly matching a specific pattern, though this is rarely used) and when given a file name returns its path. This functionality can be replaced by the global search manager.
The plan for next week is to finish with resource file management, bring in the game code to start doing some testing and replace image and font loading.
Thanks for reading.