Jo Engine  9
Jo Sega Saturn Engine
map.h
Go to the documentation of this file.
1 /*
2 ** Jo Sega Saturn Engine
3 ** Copyright (c) 2012-2017, Johannes Fetz (johannesfetz@gmail.com)
4 ** All rights reserved.
5 **
6 ** Redistribution and use in source and binary forms, with or without
7 ** modification, are permitted provided that the following conditions are met:
8 ** * Redistributions of source code must retain the above copyright
9 ** notice, this list of conditions and the following disclaimer.
10 ** * Redistributions in binary form must reproduce the above copyright
11 ** notice, this list of conditions and the following disclaimer in the
12 ** documentation and/or other materials provided with the distribution.
13 ** * Neither the name of the Johannes Fetz nor the
14 ** names of its contributors may be used to endorse or promote products
15 ** derived from this software without specific prior written permission.
16 **
17 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 ** DISCLAIMED. IN NO EVENT SHALL Johannes Fetz BE LIABLE FOR ANY
21 ** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 ** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
35 #ifndef __JO_MAP_H__
36 # define __JO_MAP_H__
37 
41 # define JO_MAP_NO_COLLISION (-2147483647)
42 
59 int jo_map_per_pixel_vertical_collision(const unsigned int layer, int x, int y, unsigned char *attribute);
60 
69 int jo_map_hitbox_detection_custom_boundaries(const unsigned int layer, const int x, const int y, const int w, const int h);
70 
71 #ifdef JO_COMPILE_WITH_FS_SUPPORT
72 
87 bool jo_map_load_from_file(const unsigned int layer, const short depth, const char * const sub_dir, const char * const filename);
88 
89 #endif /* !JO_COMPILE_WITH_FS_SUPPORT */
90 
97 bool jo_map_create(const unsigned int layer, const unsigned short max_tile_count, const short depth);
98 
106 void jo_map_add_tile(const unsigned int layer, const short x, const short y,
107 #if JO_MAX_SPRITE > 255
108  const unsigned short sprite_id,
109 #else
110  const unsigned char sprite_id,
111 #endif
112  const unsigned char attribute);
113 
121 void jo_map_add_animated_tile(const unsigned int layer, const short x, const short y, const unsigned char anim_id, const unsigned char attribute);
122 
126 void jo_map_free(const unsigned int layer);
127 
133 void jo_map_draw(const unsigned int layer, const short screen_x, const short screen_y);
134 
140 void jo_map_draw_background(const unsigned int layer, const short x, const short y);
141 
148 void jo_map_move_tiles_by_attribute(const unsigned int layer, const unsigned char attribute_filter, const short incr_x, const short incr_y);
149 
150 #ifdef JO_COMPILE_WITH_3D_SUPPORT
151 void jo_map_3d_draw(const unsigned int layer, const int x, const int y, const int z);
152 #endif // JO_COMPILE_WITH_3D_SUPPORT
153 
154 #endif /* !__JO_MAP_H__ */
155 
156 /*
157 ** END OF FILE
158 */
void jo_map_add_tile(const unsigned int layer, const short x, const short y, const unsigned char sprite_id, const unsigned char attribute)
Add a tile on the specific layer.
int jo_map_hitbox_detection_custom_boundaries(const unsigned int layer, const int x, const int y, const int w, const int h)
Fast method to get if a square intersects with the map (HitBox processing) based on screen coord...
void jo_map_3d_draw(const unsigned int layer, const int x, const int y, const int z)
int jo_map_per_pixel_vertical_collision(const unsigned int layer, int x, int y, unsigned char *attribute)
Method to get vertical distance between our point (x, y) and the surface of the map (example: hill) ...
void jo_map_add_animated_tile(const unsigned int layer, const short x, const short y, const unsigned char anim_id, const unsigned char attribute)
Add an animated tile on the specific layer.
void jo_map_move_tiles_by_attribute(const unsigned int layer, const unsigned char attribute_filter, const short incr_x, const short incr_y)
Move specific tiles by their attributes.
void jo_map_free(const unsigned int layer)
Destroy the specific layer.
bool jo_map_create(const unsigned int layer, const unsigned short max_tile_count, const short depth)
Create a new sprite map.
void jo_map_draw(const unsigned int layer, const short screen_x, const short screen_y)
Display the specific layer.
void jo_map_draw_background(const unsigned int layer, const short x, const short y)
Draw the specific layer on the background.