2018-01-09 21:59:05 +01:00
|
|
|
#pragma once
|
2017-09-21 22:17:06 +02:00
|
|
|
|
|
|
|
#include "vec2i.h"
|
2017-12-27 14:35:45 +01:00
|
|
|
#include "Tilemap.h"
|
2018-01-09 21:59:05 +01:00
|
|
|
#include <vector>
|
2017-09-21 22:17:06 +02:00
|
|
|
|
|
|
|
class FieldOfView {
|
|
|
|
Tilemap* map;
|
2018-01-09 21:59:05 +01:00
|
|
|
unsigned int counter = 0;
|
|
|
|
std::vector<unsigned int> seen;
|
2017-09-21 22:17:06 +02:00
|
|
|
|
|
|
|
void cast_light(int row, float start, float end, int xx, int xy, int yx, int yy, int startX, int startY, float radius);
|
|
|
|
public:
|
2018-01-09 21:59:05 +01:00
|
|
|
unsigned int seen_cutoff = 0;
|
2017-12-27 12:43:38 +01:00
|
|
|
FieldOfView();
|
|
|
|
FieldOfView(Tilemap* map);
|
2017-09-21 22:17:06 +02:00
|
|
|
void calc(vec2i pos, float range);
|
|
|
|
bool can_see(vec2i pos);
|
|
|
|
bool has_seen(vec2i pos);
|
|
|
|
};
|
|
|
|
bool line_of_sight(Tilemap* map, vec2i start, vec2i end);
|