Original Post
Hi I''ve been working on this 3D Raptor wannabe, except it''s not going to be anything as good as the original, but it might turn up kinda good. But now I have a code design problem which mainly consists of inheritance and the like. The classes involved are theese:
CNode - a linked list class
CModel - a model class for loading/displaying/animating MD2 models
CObject - member vars position, velocity, some functions for Updating/Rendering/Collision Detection etc.
CTerrain - a class for loading and displaying a terrain using either a heightmap or rand height values
Right now the inheritance looks like this:
CNode
|
CModel - this is kinda useless cause CModel don''t need CNode
|
CObject - need CModel for calculating bounding box, and CNode for game object hierarchy
|
CTerrain - needs the functions from CObject and also needs to be a CNode because the terrain is to be the game world parentobject. But it doesn''t need anything from CModel so some memory will be unused.
I also have a CPlayer/CEnemy/CBullet derived from CObject and they are all MD2 models. I know that I can inherit both CNode and CModel directly into CObject, but the problem with CTerrain still remains.
So the question is, should I go with this and just forget the memory being unused and that the code may look like sh*t? Or have you got a better way? Please come with tips/advices cause I really think this is an interesting side of programming.
My site, My work, My thrashcan.