*/
static uint8_t eval_position(uint16_t dist, uint16_t hex_i, char * fov_map,
struct yx_uint8 * test_pos,
- struct shadow_angle ** shadows)
+ struct shadow_angle ** shadows,
+ const char * symbols_obstacle)
{
int32_t left_angle_uncorrected = ((CIRCLE / 12) / dist)
- (hex_i * (CIRCLE / 6) / dist);
uint16_t pos_in_map = test_pos->y * maplength + test_pos->x;
uint8_t all_shaded = shade_hex(left_angle, right_angle_1st, middle_angle,
shadows, pos_in_map, fov_map);
- if (!all_shaded && 'X' == worldmap[pos_in_map])
+ if (!all_shaded && NULL != strchr(symbols_obstacle, worldmap[pos_in_map]))
{
if (set_shadow(left_angle, right_angle_1st, shadows))
{
/* Update field of view in "fovmap" of "worldmap_input" as seen from "y"/"x".
* Return 1 on malloc error, else 0.
*/
-extern uint8_t build_fov_map(uint8_t y, uint8_t x,
- char * fovmap, char * worldmap_input)
+extern uint8_t build_fov_map(uint8_t y, uint8_t x, char * fovmap,
+ char * worldmap_input,
+ const char * symbols_obstacle)
{
worldmap = worldmap_input;
struct shadow_angle * shadows = NULL;
}
if (mv_yx_in_dir_legal(dir_char, &test_pos))
{
- if (eval_position(circle_i, hex_i, fovmap, &test_pos, &shadows))
+ if (eval_position(circle_i, hex_i, fovmap, &test_pos, &shadows,
+ symbols_obstacle))
{
return 1;
}
}
}
-extern uint8_t set_cells_passable_on_memmap_to_65534_on_scoremap(char * mem_map)
+extern uint8_t set_cells_passable_on_memmap_to_65534_on_scoremap(char * mem_map,
+ const char * symbols_passable)
{
if (!score_map)
{
uint16_t pos;
for (pos = 0; pos < map_size; pos++)
{
- if ('.' == mem_map[pos])
+ if (NULL != strchr(symbols_passable, mem_map[pos]))
{
score_map[pos] = 65534;
}
}
return 0;
}
+
+
+extern void update_mem_and_memdepthmap_via_fovmap(char * map, char * fovmap,
+ char * memdepthmap,
+ char * memmap)
+{
+ uint32_t map_size = maplength * maplength;
+ uint16_t pos;
+ for (pos = 0; pos < map_size; pos++)
+ {
+ if ('v' == fovmap[pos])
+ {
+ memdepthmap[pos] = '0';
+ memmap[pos] = map[pos];
+ }
+ }
+}
+
+/* USEFUL FOR DEBUGGING
+#include <stdio.h>
+extern void write_score_map()
+{
+ FILE *f = fopen("score_map", "a");
+
+ fprintf(f, "\n---------------------------------------------------------\n");
+ uint32_t y, x;
+ for (y = 0; y < maplength; y++)
+ {
+ for (x = 0; x < maplength; x++)
+ {
+ fprintf(f, "%2X", score_map[y * maplength + x] % 256);
+ }
+ fprintf(f, "\n");
+ }
+ fclose(f);
+}
+*/