1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-10-26 03:17:39 +00:00

nilrider:: collecting triangles

This commit is contained in:
Zeno Rogue
2022-04-30 12:01:18 +02:00
parent a234a76d20
commit 59b11a74ad
4 changed files with 63 additions and 11 deletions

View File

@@ -70,8 +70,28 @@ void timestamp::draw_unilcycle(const shiftmatrix& V) {
bool tick_debug = false;
bool timestamp::collect(level *lev) {
int tY = isize(lev->map_tiles);
int tX = isize(lev->map_tiles[0]);
// println(hlog, where, tie(lev->minx, lev->miny), tie(lev->maxx, lev->maxy));
int x = floor(ilerp(lev->minx, lev->maxx, where[0]) * tX);
int y = floor(ilerp(lev->miny, lev->maxy, where[1]) * tY);
if(x < 0 || y < 0 || x >= tX || y >= tY)
return false;
char ch = lev->map_tiles[y][x];
if(ch == 'r' || ch == '!') return false;
if(ch == '*') {
for(int i=0; i<isize(lev->triangles); i++) {
auto& t = lev->triangles[i];
if(t.x == x && t.y == y) collected_triangles |= (1<<i);
}
}
return true;
}
bool timestamp::tick(level *lev) {
if(!collect(lev)) return false;
const ld eps = slope_eps;
hyperpoint wnext = where;