#include "SDL/SDL.h"
#include "SDL/SDL_image.h"
#include "../functions/surfaces.hpp"
#include "../functions/collision.hpp"

#include <fstream>

#ifndef MAP_HPP_
#define MAP_HPP_

const int tree_normal = 0;
const int tree_normal2 = 1;
const int tree2_normal = 2;
const int tree_scary = 3;
const int tree_crowe = 4;
const int tree_deadman = 5;
const int tree2_leaves = 6;
const int tree2_leaves2 = 7;
const int tree2_scary = 8;
const int bush1 = 9;
const int bush2 = 10;
const int bush3 = 11;
const int ground = 12;
const int house = 13;

typedef struct{
	int x, y;
}coord;

class map{

	private:

		SDL_Surface* Images[ 14 ];

		int LevelCounter;

		int GroundX, GroundY;

		int ObjectMap[ 3 ][ 50 ][ 50 ];
		coord ObjectCoords[ 3 ][ 50 ][ 50 ];
		SDL_Rect ObjectHitbox[ 3 ][ 50 ][ 50 ];

		bool Collision;
		bool BigFogCollision;

		bool end, housechange;

	public:

		map();

		~map();

		void loadlevel( int );

		void show( SDL_Surface* & screen, SDL_Surface*, SDL_Rect, SDL_Surface*, SDL_Rect*, SDL_Rect*, int*, SDL_Surface* CandleSheet, SDL_Rect* Coords, bool* isOut, SDL_Rect* Offsets, int & CFrame, SDL_Surface* AppleSheet, bool* appleIsOut, SDL_Rect* AppleCoords,
				   SDL_Surface* &, SDL_Surface* &, SDL_Surface* &, int, int, int, int, int, int, SDL_Surface*&, SDL_Surface* &, SDL_Surface* &, SDL_Surface* &, SDL_Surface* & );

		void move( int, int, int& );

		void shift_boxes();

		int getX();
		int getY();

		bool isCollision();
		bool isEnd();
		bool isBigFogCollision();

};

#endif /* MAP_HPP_ */
