obstacle.h File Reference

Interface to code that handles impassible obstacles. More...

#include "player.h"

Include dependency graph for obstacle.h:

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

Go to the source code of this file.

Data Structures

struct  Obstacle_t
 The representation of impassible objects in the game world. More...

Typedefs

typedef Obstacle_t Obstacle

Functions

Bool IsCollidingObstacle (Player *p, Obstacle *o)
 Checks for a collision between a player's tank and an obstacle.
void ObstacleInit ()
 Makes all obstacles visible by setting up their internal RenderItems.
void ObstacleUninit ()
 Uninitializes the obstacles.

Variables

Obstacleobstacles
 A pointer to an array of obstacles that are in the game enviornment.


Detailed Description

Interface to code that handles impassible obstacles.

Author:
Jeff Jackowski (jeffj@ro.com)
Copyright (C) 2007 Jeff Jackowski

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Or visit their website at: http://www.gnu.org/

Definition in file obstacle.h.


Typedef Documentation

typedef struct Obstacle_t Obstacle

Definition at line 49 of file obstacle.h.


Function Documentation

Bool IsCollidingObstacle ( Player p,
Obstacle o 
)

Checks for a collision between a player's tank and an obstacle.

The algorithm first simultaneously finds the rectangular overlapping region while checking for any overlap at all. If there is some overlap, pixel collision is performed on the player's sprite. The obstacle is assumed to be a solid rectangular region.

Parameters:
p The player that might collide.
o The obstacle that might run into the player.
Returns:
True if a collision has occured.
Author:
Jeff Jackowski

Definition at line 81 of file obstacle.c.

References FALSE, Obstacle_t::loc, Player_t::rot, sprites, TRUE, Player_t::x, and Player_t::y.

void ObstacleInit (  ) 

Makes all obstacles visible by setting up their internal RenderItems.

Collision code will work without calling this function.

Precondition:
Postcondition:
Each obstacle's RenderItem is initialized and added to the render system.
Author:
Jeff Jackowski

Definition at line 35 of file obstacle.c.

References AddRenderItem(), COLOR_OBSTACLE, colorVals, RenderItem_t::data, dInfo, gameOpts, LAYER_OBSTACLES, Obstacle_t::loc, RenderItem_t::loc, DisplayInfo_t::luh, DisplayInfo_t::luw, RenderItem_t::next, GameOptions_t::obstacles, obstacles, RenderItem_t::parent, PlaceRenderItem(), RenderItem_t::prev, RenderItem_t::renderer, Obstacle_t::ri, and SolidFillRenderer().

Referenced by GameInit().

Here is the call graph for this function:

void ObstacleUninit (  ) 

Uninitializes the obstacles.

This function can be safely called when there are no obstacles.

Postcondition:
Author:
Jeff Jackowski

Definition at line 62 of file obstacle.c.

References gameOpts, obstacles, GameOptions_t::obstacles, RemoveRenderItem(), and Obstacle_t::ri.

Referenced by UninitGameConfig().

Here is the call graph for this function:


Variable Documentation

Obstacle* obstacles

A pointer to an array of obstacles that are in the game enviornment.

Definition at line 33 of file obstacle.c.

Referenced by CopyAreaData(), HandleObstacle(), MakeBuffers(), ObstacleInit(), and ObstacleUninit().


Generated on Mon May 28 04:41:40 2007 for Retro Tank Super Attack by  doxygen 1.5.2