tile.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef TILE_H
00023 #define TILE_H
00024
00025 #include <SDL/SDL.h>
00026 #include "xalloc.h"
00027 #include "mobs.h"
00028 #include "sequence.h"
00029
00030
00031 #define BLOCK_LEFT 0x4
00032 #define BLOCK_RIGHT 0x8
00033 #define BLOCK_UP 0x10
00034 #define BLOCK_DOWN 0x20
00035 #define BLOCK_ALL BLOCK_LEFT | BLOCK_RIGHT | BLOCK_UP | BLOCK_DOWN
00036 #define BLOCK_NONE 0x0
00037
00038 typedef struct
00039 {
00040 int tilesheetindex;
00041 SDL_Rect sheetclippinginfo;
00042 char blocking;
00043 mob* occupant;
00044 } tile;
00045
00046 typedef struct
00047 {
00048 int index;
00049 int count;
00050 } imagecounter;
00051
00052 typedef struct
00053 {
00054 tile** tilegrid;
00055 int height;
00056 int width;
00057 SDL_Surface* imagebuffer;
00058 sequence imagecounts;
00059 } tilelayer;
00060
00061 extern sequence tile_layers;
00062 extern int maingrid_index;
00063
00064 #define MAIN_GRID ((tilelayer*)tile_layers.data[maingrid_index].data)
00065
00066 void init_tiles();
00067 tile make_tile(unsigned int tilesheet, SDL_Rect clipping, char blocking);
00068 tile** init_tilegrid(unsigned int width, unsigned int height);
00069 tile** set_all_tiles(int gridid,tile replacement);
00070 tile** set_tile(int gridid,unsigned int x, unsigned int y, tile replacement);
00071 char occupied(int tilex, int tiley,int grid);
00072 void set_occupant(int tilex, int tiley, int grid, mob* new_occupant);
00073 mob* get_occupant(int tilex, int tiley, int grid);
00074 void reset_occupant(int tilex, int tiley,int grid);
00075 int add_tilegrid(tilelayer grid);
00076 void remove_grid_at(int index);
00077 void set_maingrid_index(int ind);
00078
00079
00080 #include "video.h"
00081 #endif