Plan for source file cleanup

From OHRRPGCE-Wiki
Revision as of 09:44, 19 June 2007 by James Paige (talk | contribs) (long-term cleanup overview)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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
  1. Make a new source file such as gamesubs.bas
  2. Move code from menustuf, moresubs, yetmore, and yetmore2 into gamesubs.bas, and eliminate those files when empty
  3. Move non-battle-specific code from bmodsubs to gamesubs
  4. 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
  1. Make new source file such as customsubs.bas
  2. move code from menus, subs, subs2, and subs2 into customsubs.bas and eliminate those files when empty
  3. Move non-graphics drawing code out of drawing.bas
  4. Move non-map-editor code out of mapsubs.bas
  5. Move non menu handling related code out of flexmenu
    1. Evaluate whether (after some cleanup and rewriting) flexmenu is worth sharing between game and custom
  6. When we identify clear logical divisions of code, create new modules named appropriately for them, and move code out of customsubs.bas

Shared source files

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

See Also