Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix doors pathing for purple/black #3390

Merged
merged 6 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ariadne.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/ariadne.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/ariadne_navitree.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
}
Expand Down
9 changes: 5 additions & 4 deletions src/ariadne_regions.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
/******************************************************************************/
#include "pre_inc.h"
#include "ariadne_regions.h"
#include "ariadne.h"

#include "globals.h"
#include "bflib_basics.h"
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/ariadne_tringls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -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*/
Expand Down
6 changes: 3 additions & 3 deletions src/map_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/map_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading