1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-09-11 06:45:59 +00:00

ru:: intxy

This commit is contained in:
Zeno Rogue
2025-08-01 17:03:27 +02:00
parent 6dfc6559b8
commit d831fa6f20
2 changed files with 13 additions and 0 deletions

View File

@@ -78,6 +78,12 @@ struct bbox {
bool intersect(bbox a, bbox b);
struct intxy {
int x, y;
intxy() {}
intxy(int x, int y) : x(x), y(y) {}
};
struct room {
// texture::texture_data *room_texture;
string roomname;
@@ -95,6 +101,8 @@ struct room {
eWall at(int x, int y) {
return eWall(block_at[y][x] >> 3);
}
eWall at(intxy xy) { return at(xy.x, xy.y); }
void clear() {
for(int y=0; y<room_y; y++) for(int x=0; x<room_x; x++) block_at[y][x] = 0;
@@ -146,6 +154,8 @@ struct room {
add_revert(fountain_revert, [this, x, y, orig] { replace_block(x, y, orig); });
}
void replace_block_frev(intxy xy, eWall w) { replace_block_frev(xy.x, xy.y, w); }
void generate();
void reveal(int cx, int cy);

View File

@@ -26,6 +26,9 @@ hyperpoint to_hyper(ld x, ld y) {
hyperpoint to_hyper(xy xy) { return to_hyper(xy.x, xy.y); }
hyperpoint block_to_hyper(intxy xy) { return to_hyper((xy.x+.5) * block_x, (xy.y+.5) * block_y); }
intxy xy_to_block(xy xy) { return intxy{ int(floor(xy.x / block_x)), int(floor(xy.y / block_y)) }; }
xy from_hyper(hyperpoint h) {
if(non_hyperbolic) return {h[0], h[1]};