Plan for source file cleanup
The OHRRPGCE source code is broken up into a bunch of disorganized files. This is because the memory limitations of the old QuickBasic compiler required large modules to be split up. With a few exceptions, the code is grouped randomly with little regard for shared functionality.
Sometime after ubersetzung, we should clean up the code origanization. This will make particular subs and functions easier to find, and it will make it easier to identify redundant code. This cleanup can happen incrementally in small steps. it does not have to happen all at once (and in fact it is better if it doesn't happen all at once)
GAME source files
game.bas Main module bmod.bas Battle module bmodsubs.bas Mostly battle code menustuf.bas Unsorted code moresubs.bas Unsorted code yetmore.bas Unsorted code yetmore2.bas Unsorted code
- Make a new source file such as gamesubs.bas
- Move code from menustuf, moresubs, yetmore, and yetmore2 into gamesubs.bas, and eliminate those files when empty
- Move non-battle-specific code from bmodsubs to gamesubs
- When we identify clear logical divisions of code, create new modules named appropriately for them, and move code out of gamesubs.bas
CUSTOM source files
custom.bas Main module drawing.bas Unsorted code, including graphics drawing flexmenu.bas Unsorted code, including menu handling mapsubs.bas Unsorted code, including map editor menus.bas Unsorted code subs.bas Unsorted code subs2.bas Unsorted code subs3.bas Unsorted code
- Make new source file such as customsubs.bas
- move code from menus, subs, subs2, and subs2 into customsubs.bas and eliminate those files when empty
- Move non-graphics drawing code out of drawing.bas
- Move non-map-editor code out of mapsubs.bas
- Move non menu handling related code out of flexmenu
- Evaluate whether (after some cleanup and rewriting) flexmenu is worth sharing between game and custom
- When we identify clear logical divisions of code, create new modules named appropriately for them, and move code out of customsubs.bas
The shared code is already pretty nicely organized. There is much less cleanup work to be done here than there is in the game-specific and custom-specific code
allmodex.bas shared game library gfx_*.bas graphics backends music_*.bas music backends bam2mid.bas bam music converter common.bas shared code for both game and custom compat.bas backwards compatability code loading.bas shared code for RPG lump handling util.bas shared code that should not depend on any other code
- Fix util.bat's dependence on compat.bat (which leads to dependence on other stuff too)
- Evaluate whether or not compat.bat can be completely removed now that we have abandoned QB45
- Find other code that can be shared between game and custom and move it into common.bas
- Find places where game and custom do their own special-case handling of RPG lumps, and replace them with calls to loading.bas
- Find places where modules other than allmodex.bas depend directly on gfx_*.bas or music_*.bas and replace them with calls to wrapper functions from allmodex.bas