#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include "obstacle.h"
#include "game.h"
#include "gameconfig.h"
#include "color.h"
#include "tanksprite.h"
Include dependency graph for obstacle.c:
Go to the source code of this file.
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 | |
Obstacle * | obstacles = NULL |
A pointer to an array of obstacles that are in the game enviornment. |
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.c.
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.
p | The player that might collide. | |
o | The obstacle that might run into the player. |
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.
Definition at line 35 of file obstacle.c.
References AddRenderItem(), COLOR_OBSTACLE, colorVals, RenderItem_t::data, dInfo, gameOpts, LAYER_OBSTACLES, RenderItem_t::loc, Obstacle_t::loc, DisplayInfo_t::luh, DisplayInfo_t::luw, RenderItem_t::next, obstacles, GameOptions_t::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.
Definition at line 62 of file obstacle.c.
References gameOpts, GameOptions_t::obstacles, obstacles, RemoveRenderItem(), and Obstacle_t::ri.
Referenced by UninitGameConfig().
Here is the call graph for this function:
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().