Download Media Create Donate Forums

2010/12/10

Refactoring Powers

Once a system is far enough along, any refactoring is daunting. Especially when it involves temporarily breaking code that works well.

I want to define powers in config files. Ideally it should be easy to make new powers similar to existing ones. The config files might get rather long, but them's the breaks. Time to break down the plan:

  • Create a config file for Shoot
  • Create a new struct to hold power data
  • Copy ini file code to load power data
  • Rework Missile routine to use this Shoot struct
  • Create power config file for Shock
  • Generalize Missile routine to handle common missiles

That should get me pretty far. Once I see the generalization for Missiles it should be simple to adapt the same for the other types.

Harder thought will be required for a power like Vengeance. I'll figure that part out later...