main.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int PlayGame (CWorld *ThisWorld)
 in-game loop
CWorldInitGame (int level)
 initialize game world with a level
int ToggleFullScreen (GameState *State)
int KillGame (CWorld *ThisWorld)
 remove a CWorld object
int ResetGame (CWorld *ThisWorld)
void initWidgets (void)
 initialize GUI widgets
void debugText (const char *text)
float DegreesToRadians (float deg)
 convert degrees to radians
float RadiansToDegrees (float rad)
 convert radians to degrees


Function Documentation

void debugText ( const char *  text  ) 

Definition at line 749 of file main.cpp.

References font_small, graphics, SCREEN_HEIGHT, and SCREEN_WIDTH.

float DegreesToRadians ( float  deg  ) 

Definition at line 767 of file main.cpp.

References PI.

Referenced by DrawCircle(), DrawDisc(), DrawStar(), GameLogicFire(), PlayGame(), and UpdateBody().

Here is the caller graph for this function:

CWorld* InitGame ( int  level  ) 

Initialize this CWorld object with level data. The 'level' parameter passed in to this function is used to form a filename. This file holds the level data which is loaded and used to initialize the game world object. This function also performs other initialization on the world object in order to prepare it for the in-game loop.

Todo:
Enhance the level file format to include initialization parameters.

Definition at line 652 of file main.cpp.

References CWorld::AddObject(), ANIMID_BROWNTANKEXPLODE, ANIMID_GREENTANKEXPLODE, ANIMID_TANKROLL, CWorld::bTakeInput, DasGame, EFFECTID_PSYSTEM, EFFECTID_TILEANIM, CObject::fAngle, CObject::fSubAngle, CWorld::fZoomBias, GameState::iBrownHandicap, CObject::iDamageSound, GameState::iGreenHandicap, CObject::iHealth, CObject::iLingerTime, CObject::iNormalAnim, CObject::iNormalAnimSpeed, CObject::iRemovalAnim, CObject::iRemovalAnimSpeed, CObject::iRemovalEffect, CObject::iRemovalEffects, CWorld::iStartingState, CObject::iTint, CWorld::LoadLevel(), CWorld::Player, CObject::Position, SOUNDID_HIT, STARTINGSTATE_IDLE, STARTINGSTATE_RUN, TINTID_ARMYBROWN, TINTID_ARMYGREEN, TYPEID_TANK, Vector::x, and Vector::y.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

void initWidgets ( void   ) 

Initialize the GUIChan widgets used in all the GUIs (main, options, etc.)

Definition at line 744 of file main.cpp.

References top.

Referenced by main(), and ToggleFullScreen().

Here is the caller graph for this function:

int KillGame ( CWorld ThisWorld  ) 

Removes a CWorld object from memory, after removing all of it's contents. This is used by the top-level loop to remove a game world after the player's game is complete, and before loading a new level.

Todo:
**IMPORTANT** Add code to delete the world data before deleting the world object! This was crashing before, so figure out why, otherwise you are sitting on a fat memory leak.

Definition at line 731 of file main.cpp.

Referenced by main().

Here is the caller graph for this function:

int PlayGame ( CWorld ThisWorld  ) 

This function comprises the 'in-game' loop, where the player is interacting with the game world, or watching the intro / victory sequence. This function gets input from the user, calls the physics engine and game logic engine, draws the game world, the GUI, and finally swaps the backbuffer to the screen. Exiting this function means that control is passed back to the top-level loop.

Todo:
re-write timing code to use higher precision timer function than SDL provides

Definition at line 200 of file main.cpp.

References CWorld::AddEffect(), ANIMID_BROWN_HOP_IN, ANIMID_GREEN_HOP_IN, CWorld::bGameOver, CWorld::bTakeInput, DasGame, DegreesToRadians(), DoCollisions(), DrawGLScene(), DrawStripe(), EFFECTID_TILEANIM, event, CObject::fAngle, font_big, font_small, graphics, CObject::iAmmo, GameState::iBrownPlayerJoystick, CWorld::iCurrentTime, GameState::iGreenPlayerJoystick, CObject::iHealth, CObject::iInput, InitStripeAlpha(), INPUT_DOWN, INPUT_FIRE, INPUT_LEFT, INPUT_RIGHT, INPUT_UP, CWorld::iRenderStyle, CWorld::iStartingState, CWorld::musicFile, MUSICID_INGAME, CObject::ParentWorld, PhysicsUpdate(), CWorld::Player, PlayLevelMusic(), PlaySound(), CObject::Position, ProcessTileCollisions(), RemoveDeadObjects(), RENDERSTYLE_FLAT, RENDERSTYLE_PERSPECTIVE, SCREEN_HEIGHT, SCREEN_WIDTH, SOUNDID_GO, SOUNDID_READY, SOUNDID_SET, SOUNDID_VICTORY, STARTINGSTATE_GO, STARTINGSTATE_IDLE, STARTINGSTATE_READY, STARTINGSTATE_RUN, STARTINGSTATE_SET, STARTINGSTATE_VICTORY, StopMusic(), CEffect::TAnim, UpdateAnimation(), CWorld::UpdateEffects(), VRotate2D(), Vector::x, Vector::y, and Vector::z.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

float RadiansToDegrees ( float  rad  ) 

Definition at line 773 of file main.cpp.

References PI.

int ResetGame ( CWorld ThisWorld  ) 

int ToggleFullScreen ( GameState State  ) 

brief toggle between windowed and full screen mode

This function, accessed from the game's option menu, allows the player to switch between a windowed or full-screen view of the game's video output. This function destroys and re-creates all neccessary objects required to perform this function.

Definition at line 784 of file main.cpp.

References GameState::bFullScreen, font_big, font_small, graphics, gui, imageLoader, InitGL(), InitTextures(), initWidgets(), screen, SCREEN_HEIGHT, SCREEN_WIDTH, and top.

Referenced by OptionsMenu().

Here is the call graph for this function:

Here is the caller graph for this function:

 

Copyright Windsor Schmidt 2006 - All rights reserved.