Why not use a prototype for _GameMain() in the .h file and define it in the .cpp file? That might be a problem considering that the program can only enter that code block once in the .h file because of the _game_functions_h being defined.
Try this. If it doesn't work, it's still better practice.
game_functions.h
#ifndef _game_functions_h_
#define _game_functions_h_
void GameSetup();
void GameMenu();
void GameStart();
void GamePlaying();
void GameEnd();
void GameCleanup();
enum eGameModes {
eGameSetup,
eGameMenu,
eGameStart,
eGamePlaying,
eGameEnd,
eGameCleanup
};
void _GameMain(eGameModes modes);
#endif
game_functions.cpp
#include "DarkGDK.h"
#include "game_functions.h"
void GameSetup()
{
dbSetDir("media");
dbMakeVector4(1);
dbLoadObject("H-AK47-Static.x", 1);
dbLockObjectOn(1);
}
void GameMenu()
{
}
void GameStart()
{
}
void GamePlaying()
{
dbPositionObject(1, dbCameraPositionX(), dbCameraPositionY(), dbCameraPositionZ());
dbControlCameraUsingArrowKeys(0, 2, 3);
}
void GameEnd()
{
}
void GameCleanup()
{
}
void _GameMain(eGameModes modes)
{
switch(modes)
{
case eGameSetup:
GameSetup();
modes = eGameMenu;
case eGameMenu:
GameMenu();
modes = eGameStart;
case eGameStart:
GameStart();
modes = eGamePlaying;
case eGamePlaying:
GamePlaying();
modes = eGameEnd;
case eGameEnd:
GameEnd();
modes = eGameCleanup;
case eGameCleanup:
GameCleanup();
}
}
By the way, in your switch block, you don't need to keep on changing the value of modes. When one case statement is met, everything under it is executed until it runs into a break statement.
For example, switching a char:
switch(myChar)
{
case 'r':
case 'R':
//do stuff here
break; //Breaks the execution until another case statement is met.
case 'k':
//do other stuff here
break;
}
If the char was an 'r' OR an 'R' the "do stuff here" block would be executed and then cut off by the break statement. The "do other stuff here" block would only be executed if the char was 'k'. Basically it's the same thing that you're doing, but it's faster.
#ifdef _DEBUG
FixBugs(All);
#endif