00001
00007 #ifndef MAP_H_34ZCF
00008 #define MAP_H_34ZCF
00009
00010 #include "IsoBomb.h"
00011 struct Tile;
00012 class TileLocation;
00013 class Entity;
00014 class Drawable;
00015 class Point;
00016 class Point3D;
00017 class Powerup;
00018
00030 class Map {
00031 public:
00035 static const int CAMERA0;
00036
00040 static const int CAMERA1;
00041
00042 public:
00043
00047 Map();
00048
00052 ~Map();
00053
00060 bool load( const char *fn );
00061
00062
00074 void draw( const Point &pt, int scrWidth, int scrHeight );
00075
00091 void draw( int scrWidth, int scrHeight, int cameraFlags );
00092
00096 int getNumCameras() const;
00097
00110 void setCameraTarget( const Entity* target, int camera );
00111
00119 const Tile* getTileAt( const Point &pt ) const;
00120
00125 bool isLocationOutside( const TileLocation& loc ) const;
00126
00131 bool isLocationOutside( const Point& pt ) const;
00132
00137 bool isLocationOutside( const Point3D& pt ) const;
00138
00142 bool isLocationOutside( const Rect& r ) const;
00143
00148 int getRectHeight( const Rect& r ) const;
00149
00155 int getPointHeight( const Point& p ) const;
00156
00162 int getPointHeight( const Point3D& p ) const;
00163
00172 void addToRenderList( Drawable& obj );
00173
00178 void clearRenderList();
00179
00186 static Point getScreenTileOffset( const Point& pt, float startX, float startY );
00187
00193 int getMapLength() const;
00194
00200 int getMapWidth() const;
00201
00209 Point getStartingPoint();
00210
00214 void addPowerups();
00215
00216 private:
00217
00225 void render( const Point &pt, int scrWidth, int scrHeight, int xShift );
00226
00237 void setTileAt( int row, int col, int height, int topTex, int sideTex );
00238
00239 private:
00244 struct TileVertex {
00245 float x, y, z;
00246 float rhw;
00247 float u, v;
00248 };
00249
00257 void drawTile( int mapX, int mapY, int screenX, int screenY, int xShift );
00258
00263 void drawBoundingBox( const Rect& r, int mapX, int mapY, int screenX, int screenY );
00264
00272 void drawEntitiesOnTile( int mapX, int mapY, int screenX, int screenY, int xShift );
00273
00279 TileVertex vertex[5];
00280
00284 TileVertex sideVertex[6];
00285
00289 int mapWidth;
00290
00294 int mapLength;
00295
00299 Tile** tiles;
00300
00304 const Entity* cameraTarget[2];
00305
00309 std::vector<Point> startPoints;
00310
00314 std::list<Powerup*> powerups;
00315
00316 };
00317
00318 #endif