This is the documentation for the tilemap helper functions. © Henrik Stokseth, 1999.


Datafile helper functions...

  • char *get_object_name(DATAFILE *dat, int objnum);
  • int object_of_type_exists(DATAFILE *dat, int type);
  • int number_of_type(DATAFILE *dat, int type);
  • int get_object_number(DATAFILE *dat, int number_of_type, int type);
  • int get_max_sprite_width(DATAFILE *dat);
  • int get_max_sprite_height(DATAFILE *dat);

    most of these are for internal use only. that's why they're not documented.

    Tilemap helper functions...

  • TILEMAP *load_tilemap(char *filename);

    loads a tilemap from file.

  • TILEMAP *register_tilemap(DATAFILE *dat, int index);

    sets up a tilemap included in a datafile for use.

  • void save_tilemap(TILEMAP *map, char *filename);

    saves a tilemap to a file.

  • TILEMAP *create_tilemap(int layers, int xsize, int ysize, int xgrid, int ygrid);

    creates an empty tilemap.

  • TILEMAP *resize_tilemap(TILEMAP *map, int layers, int xsize, int ysize, int xgrid, int ygrid, int xcut, int ycut);

    resizes a tilemap, cutting off the edges specified if needed.

  • void destroy_tilemap(TILEMAP *map);

    removes a tilemap from memory.

    Drawing helper functions...

  • void draw_tilemap_layer(BITMAP *dest_bmp, DATAFILE *dat, TILEMAP *map, int layer, int dest_x, int dest_y);

    draws one of the tilemap layers to a destination bitmap at the specified coordinates.

    Tile helper functions...

  • int get_sprite_number(TILEMAP *map, int layer, int x, int y);

    gets the number of a sprite at the specified coordinates.

  • void set_sprite_number(TILEMAP *map, int layer, int x, int y);

    sets the number of a sprite at the specified coordinates.

  • int get_sprite_pos(TILEMAP *map, int layer, int x, int y);

    gets the tilemap data offset for the sprite at the specified coordiantes.

    Auto-correction helper functions...

  • void create_namelist(TILEMAP *map, DATAFILE *dat);

    creates a namelist and appends it to the tilemap. used for auto-correction.

  • void correct_tilemap(TILEMAP *map, DATAFILE *dat);

    corrects the tilemap if the datafile's contents has changed.