This commit is contained in:
Clément Le Bihan
2020-03-12 20:35:53 +01:00
4 changed files with 13 additions and 11 deletions

View File

@@ -193,7 +193,7 @@
<texture x="2" y="9" name="grass_top" />
<texture x="2" y="10" name="grass_top" />
<texture x="3" y="0" name="cobblestone" />
<texture x="3" y="0" name="cobblestone" />
<texture x="3" y="1" name="grass_top" />
<texture x="3" y="2" name="grass_top" />
<texture x="3" y="3" name="grass_top" />
@@ -205,7 +205,7 @@
<texture x="3" y="9" name="grass_top" />
<texture x="3" y="10" name="grass_top" />
<texture x="4" y="0" name="cobblestone" />
<texture x="4" y="0" name="cobblestone" />
<texture x="4" y="1" name="grass_top" />
<texture x="4" y="2" name="grass_top" />
<texture x="4" y="3" name="grass_top" />
@@ -217,7 +217,7 @@
<texture x="4" y="9" name="grass_top" />
<texture x="4" y="10" name="grass_top" />
<texture x="5" y="0" name="cobblestone" />
<texture x="5" y="0" name="cobblestone" />
<texture x="5" y="1" name="grass_top" />
<texture x="5" y="2" name="grass_top" />
<texture x="5" y="3" name="grass_top" />
@@ -229,7 +229,7 @@
<texture x="5" y="9" name="grass_top" />
<texture x="5" y="10" name="grass_top" />
<texture x="6" y="0" name="cobblestone" />
<texture x="6" y="0" name="cobblestone" />
<texture x="6" y="1" name="grass_top" />
<texture x="6" y="2" name="grass_top" />
<texture x="6" y="3" name="grass_top" />
@@ -241,7 +241,7 @@
<texture x="6" y="9" name="grass_top" />
<texture x="6" y="10" name="grass_top" />
<texture x="7" y="0" name="cobblestone" />
<texture x="7" y="0" name="cobblestone" />
<texture x="7" y="1" name="grass_top" />
<texture x="7" y="2" name="grass_top" />
<texture x="7" y="3" name="grass_top" />
@@ -253,7 +253,7 @@
<texture x="7" y="9" name="grass_top" />
<texture x="7" y="10" name="grass_top" />
<texture x="8" y="0" name="cobblestone" />
<texture x="8" y="0" name="cobblestone" />
<texture x="8" y="1" name="grass_top" />
<texture x="8" y="2" name="grass_top" />
<texture x="8" y="3" name="grass_top" />
@@ -265,7 +265,7 @@
<texture x="8" y="9" name="grass_top" />
<texture x="8" y="10" name="grass_top" />
<texture x="9" y="0" name="cobblestone" />
<texture x="9" y="0" name="cobblestone" />
<texture x="9" y="1" name="grass_top" />
<texture x="9" y="2" name="grass_top" />
<texture x="9" y="3" name="grass_top" />

View File

@@ -28,7 +28,8 @@ int orientation(gc_vector2 p, gc_vector2 q, gc_vector2 r)
return ((tmp > 0) ? 1 : 2);
}
bool gc_vector2_do_intersect(gc_vector2 p1, gc_vector2 q1, gc_vector2 p2, gc_vector2 q2)
bool gc_vector2_do_intersect(gc_vector2 p1, gc_vector2 q1, \
gc_vector2 p2, gc_vector2 q2)
{
int o1 = orientation(p1, q1, p2);
int o2 = orientation(p1, q1, q2);
@@ -74,7 +75,8 @@ bool is_pos_in_tile(gc_vector2 pos, struct tile *tile)
struct vertex **c = tile->corners;
gc_vector2 corners[4];
pos.y *= -1;
for (int i = 0; i < 4; i++)
corners[i] = get_tile_coords_to_pixels(c[i]->x, c[i]->y, c[i]->z);
corners[i] = gc_vector2_from_coords(c[i]->x, c[i]->y, c[i]->z);
return (is_point_in_polygon(corners, 4, pos));
}