diff --git a/src/ariadne.c b/src/ariadne.c index d09e60fe7e..5c0e10a88f 100644 --- a/src/ariadne.c +++ b/src/ariadne.c @@ -4458,7 +4458,7 @@ long triangle_area1(long tri_idx) return llabs(area1+area2); } -static void brute_fill_rectangle(long start_x, long start_y, long end_x, long end_y, unsigned short ntree_alt) +static void brute_fill_rectangle(long start_x, long start_y, long end_x, long end_y, NavColour ntree_alt) { // Replace start and end if they are switched if (end_x < start_x) diff --git a/src/ariadne.h b/src/ariadne.h index aa78d89e64..f37c00500b 100644 --- a/src/ariadne.h +++ b/src/ariadne.h @@ -83,7 +83,7 @@ enum NavigationStateValues { #define NAVMAP_FLOORHEIGHT_MASK 0x0f #define NAVMAP_UNSAFE_SURFACE 0x10 #define NAVMAP_OWNERSELECT_BIT 6 -#define NAVMAP_OWNERSELECT_MASK 0x7E0 +#define NAVMAP_OWNERSELECT_MASK 0x3FE0 struct Ariadne { // sizeof = 102 /** Position where the journey stated. */ @@ -223,7 +223,7 @@ TbBool edge_lock_f(long ptend_x, long ptend_y, long ptstart_x, long ptstart_y, c TbBool edge_unlock_record_and_regions_f(long ptend_x, long ptend_y, long ptstart_x, long ptstart_y, const char *func_name); void border_internal_points_delete(long a1, long a2, long a3, long a4); TbBool tri_set_rectangle(long start_x, long start_y, long end_x, long end_y, NavColour nav_colour); -long fringe_get_rectangle(long *outfri_x1, long *outfri_y1, long *outfri_x2, long *outfri_y2, unsigned short *oval); +long fringe_get_rectangle(long *outfri_x1, long *outfri_y1, long *outfri_x2, long *outfri_y2, NavColour *oval); long delaunay_seeded(long a1, long a2, long a3, long a4); void border_unlock(long a1, long a2, long a3, long a4); TbBool triangulation_border_start(long *a1, long *a2); diff --git a/src/ariadne_navitree.c b/src/ariadne_navitree.c index eb54227d51..13668d33e9 100644 --- a/src/ariadne_navitree.c +++ b/src/ariadne_navitree.c @@ -24,6 +24,7 @@ #include "bflib_memory.h" #include "bflib_math.h" +#include "ariadne.h" #include "ariadne_tringls.h" #include "ariadne_points.h" #include "ariadne_findcache.h" @@ -212,7 +213,7 @@ TbBool delaunay_add_triangle(long tri_idx) { if (!is_current_tag(tri_idx)) { - if ((i & 0x0F) != 15) + if ((i & NAVMAP_FLOORHEIGHT_MASK) != NAVMAP_FLOORHEIGHT_MAX) { return delaunay_add(tri_idx); } diff --git a/src/ariadne_regions.c b/src/ariadne_regions.c index 728ac8235e..94e15ddf19 100644 --- a/src/ariadne_regions.c +++ b/src/ariadne_regions.c @@ -18,6 +18,7 @@ /******************************************************************************/ #include "pre_inc.h" #include "ariadne_regions.h" +#include "ariadne.h" #include "globals.h" #include "bflib_basics.h" @@ -106,7 +107,7 @@ void region_lnk(int nreg) TbBool notfound; while (1) { - if ((Triangles[ctri_id].tree_alt & 0xF) == 15) + if ((Triangles[ctri_id].tree_alt & NAVMAP_FLOORHEIGHT_MASK) == NAVMAP_FLOORHEIGHT_MAX) { notfound = 1; break; @@ -176,7 +177,7 @@ static void region_connect(unsigned long tree_reg) int ntri_id = Triangles[creg_id].tags[ncor1]; if (ntri_id != -1) { - if ((Triangles[ntri_id].tree_alt & 0xF) != 15) + if ((Triangles[ntri_id].tree_alt & NAVMAP_FLOORHEIGHT_MASK) != NAVMAP_FLOORHEIGHT_MAX) { long preg_id = get_triangle_region_id(ntri_id); if (preg_id != nreg_id) @@ -215,8 +216,8 @@ TbBool regions_connected(long tree_reg1, long tree_reg2) return false; if ((tree_reg2 < 0) || (tree_reg2 >= TRIANLGLES_COUNT)) return false; - if (((get_triangle_tree_alt(tree_reg1) & 0x0F) == 0x0F) - || ((get_triangle_tree_alt(tree_reg2) & 0x0F) == 0x0F)) + if (((get_triangle_tree_alt(tree_reg1) & NAVMAP_FLOORHEIGHT_MASK) == NAVMAP_FLOORHEIGHT_MAX) + || ((get_triangle_tree_alt(tree_reg2) & NAVMAP_FLOORHEIGHT_MASK) == NAVMAP_FLOORHEIGHT_MAX)) return false; long reg_id1 = get_triangle_region_id(tree_reg1); long reg_id2 = get_triangle_region_id(tree_reg2); diff --git a/src/ariadne_tringls.c b/src/ariadne_tringls.c index 5d5e2d3c3b..d1aa6e628e 100644 --- a/src/ariadne_tringls.c +++ b/src/ariadne_tringls.c @@ -384,9 +384,9 @@ void triangulation_init_triangles(long pt_id1, long pt_id2, long pt_id3, long pt Triangles[1].points[1] = 3; Triangles[0].tags[1] = -1; Triangles[0].tags[2] = -1; - Triangles[0].tree_alt = 15; + Triangles[0].tree_alt = NAVMAP_FLOORHEIGHT_MAX; Triangles[1].tags[0] = 0; - Triangles[1].tree_alt = 15; + Triangles[1].tree_alt = NAVMAP_FLOORHEIGHT_MAX; Triangles[1].tags[1] = -1; Triangles[1].tags[2] = -1; Triangles[0].field_D = 7; diff --git a/src/globals.h b/src/globals.h index 2403546fd0..3bda7a7ef2 100644 --- a/src/globals.h +++ b/src/globals.h @@ -285,7 +285,7 @@ typedef unsigned short SpDiggerTaskType; /** Flags for tracing route for creature movement. */ typedef unsigned char NaviRouteFlags; /** data used for navigating contains floor height, locked doors per player, unsafe surfaces */ -typedef unsigned short NavColour; +typedef unsigned short NavColour; //this one should become a long, as it can't fit orange, but changing it fucks things up /** Either North (0), East (1), South (2), or West (3). */ typedef signed char SmallAroundIndex; /** a player state as defined in config_players*/ diff --git a/src/map_data.c b/src/map_data.c index ce6830dce9..1982580513 100644 --- a/src/map_data.c +++ b/src/map_data.c @@ -92,7 +92,7 @@ TbBool map_block_invalid(const struct Map *map) return (map < &game.map[0]); } -unsigned long get_navigation_map(MapSubtlCoord stl_x, MapSubtlCoord stl_y) +NavColour get_navigation_map(MapSubtlCoord stl_x, MapSubtlCoord stl_y) { if ((stl_x < 0) || (stl_x > gameadd.map_subtiles_x)) return 0; @@ -101,7 +101,7 @@ unsigned long get_navigation_map(MapSubtlCoord stl_x, MapSubtlCoord stl_y) return game.navigation_map[navmap_tile_number(stl_x,stl_y)]; } -void set_navigation_map(MapSubtlCoord stl_x, MapSubtlCoord stl_y, unsigned long navcolour) +void set_navigation_map(MapSubtlCoord stl_x, MapSubtlCoord stl_y, NavColour navcolour) { if ((stl_x < 0) || (stl_x > gameadd.map_subtiles_x)) return; @@ -575,7 +575,7 @@ void clear_mapmap(void) for (unsigned long x = 0; x < (gameadd.map_subtiles_x + 1); x++) { struct Map* mapblk = get_map_block_at(x, y); - unsigned short* flg = &game.navigation_map[get_subtile_number(x, y)]; + NavColour* flg = &game.navigation_map[get_subtile_number(x, y)]; LbMemorySet(mapblk, 0, sizeof(struct Map)); *flg = 0; } diff --git a/src/map_data.h b/src/map_data.h index 02786ac771..c693771be8 100644 --- a/src/map_data.h +++ b/src/map_data.h @@ -101,8 +101,8 @@ void set_mapblk_filled_subtiles(struct Map *map, long height); long get_mapblk_wibble_value(const struct Map *mapblk); void set_mapblk_wibble_value(struct Map *mapblk, long wib); -unsigned long get_navigation_map(MapSubtlCoord stl_x, MapSubtlCoord stl_y); -void set_navigation_map(MapSubtlCoord stl_x, MapSubtlCoord stl_y, unsigned long navcolour); +NavColour get_navigation_map(MapSubtlCoord stl_x, MapSubtlCoord stl_y); +void set_navigation_map(MapSubtlCoord stl_x, MapSubtlCoord stl_y, NavColour navcolour); unsigned long get_navigation_map_floor_height(MapSubtlCoord stl_x, MapSubtlCoord stl_y); TbBool set_coords_with_clip(struct Coord3d *pos, MapCoord cor_x, MapCoord cor_y, MapCoord cor_z);