mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-10-25 10:57:59 +00:00
ru:: detect cross
This commit is contained in:
@@ -297,7 +297,7 @@ struct entity {
|
|||||||
struct statdata {
|
struct statdata {
|
||||||
statarray<ld> stats;
|
statarray<ld> stats;
|
||||||
int jump_control, coyote_time, hallucinating;
|
int jump_control, coyote_time, hallucinating;
|
||||||
ld detect_area;
|
ld detect_area, detect_cross;
|
||||||
void reset();
|
void reset();
|
||||||
vector<tuple<power*, mod, int>> mods;
|
vector<tuple<power*, mod, int>> mods;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ void statdata::reset() {
|
|||||||
coyote_time = 0;
|
coyote_time = 0;
|
||||||
jump_control = 0;
|
jump_control = 0;
|
||||||
detect_area = 0;
|
detect_area = 0;
|
||||||
|
detect_cross = 0;
|
||||||
hallucinating = false;
|
hallucinating = false;
|
||||||
mods.clear();
|
mods.clear();
|
||||||
}
|
}
|
||||||
@@ -87,8 +88,23 @@ void man::act() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool man::can_see(entity& e) {
|
bool man::can_see(entity& e) {
|
||||||
ld d = hdist(to_hyper(m.where), to_hyper(e.where));
|
if(m.current.detect_area) {
|
||||||
return d < inverse_wvolarea_auto(m.current.detect_area);
|
ld d = hdist(to_hyper(m.where), to_hyper(e.where));
|
||||||
|
if(d < inverse_wvolarea_auto(m.current.detect_area)) return true;
|
||||||
|
}
|
||||||
|
if(m.current.detect_cross) {
|
||||||
|
array<int, 4> ar;
|
||||||
|
transmatrix T = iso_inverse(eupush(to_hyper(m.where)));
|
||||||
|
auto bb = e.get_pixel_bbox();
|
||||||
|
for(int u=0; u<4; u++) {
|
||||||
|
xy vertex = { ld((u&1) ? bb.minx : bb.maxx), ld((u&2) ? bb.miny : bb.maxy) };
|
||||||
|
hyperpoint h = T * to_hyper(vertex);
|
||||||
|
ar[u] = (h[0] > 0 ? 1 : 0) + (h[1] > 0 ? 2 : 0);
|
||||||
|
if(hdist0(h) > m.next.detect_cross) ar[u] = 4;
|
||||||
|
}
|
||||||
|
if(ar[0] != ar[1] || ar[0] != ar[2] || ar[0] != ar[3]) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void man::on_kill() {
|
void man::on_kill() {
|
||||||
|
|||||||
@@ -45,6 +45,10 @@ randeff trap_detect("Detect traps", "Lets you see traps and secret passages in a
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
randeff trap_detect_cross("Detect cross", "Lets you see traps and secret passages in a cross around you.", "You see things you could not see before!", [] (data &d) {
|
||||||
|
m.next.detect_cross = m.current.detect_cross + 0.01 / game_fps * m.current.stats[stat::wis];
|
||||||
|
});
|
||||||
|
|
||||||
randeff trap_snake("Snake Hair", "Lets you create snakes that can be used to disarm traps and secret passages.", "You grow snakes on your head!", [] (data &d) { });
|
randeff trap_snake("Snake Hair", "Lets you create snakes that can be used to disarm traps and secret passages.", "You grow snakes on your head!", [] (data &d) { });
|
||||||
randeff trap_disarm("Disarm traps", "Lets you see all traps on the level for a short time, and to attack them with your [weapon] to destroy them.", "You suddenly feel able to disarm traps with your [weapon]!", [] (data &d) { });
|
randeff trap_disarm("Disarm traps", "Lets you see all traps on the level for a short time, and to attack them with your [weapon] to destroy them.", "You suddenly feel able to disarm traps with your [weapon]!", [] (data &d) { });
|
||||||
|
|
||||||
|
|||||||
@@ -272,6 +272,21 @@ void man::draw() {
|
|||||||
}
|
}
|
||||||
queuecurve(scrm, 0x800080, 0, PPR::LINE);
|
queuecurve(scrm, 0x800080, 0, PPR::LINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(m.current.detect_cross > 0) for(int d: {0, 1, 2, 3}) {
|
||||||
|
transmatrix T = eupush(to_hyper(m.where)) * spin(90._deg * d);
|
||||||
|
ld dist = 0;
|
||||||
|
while(dist < m.current.detect_cross) {
|
||||||
|
dist += 0.01;
|
||||||
|
auto h = from_hyper(T * xpush0(dist));
|
||||||
|
curvepoint(eupush(h.x, h.y) * C0);
|
||||||
|
int cx = int(h.x / block_x);
|
||||||
|
int cy = int(h.y / block_y);
|
||||||
|
if(cx < 0 || cy < 0 || cx >= room_x || cy >= room_y) break;
|
||||||
|
if(!(walls[current_room->at(cx, cy)].flags & W_TRANS)) break;
|
||||||
|
}
|
||||||
|
queuecurve(scrm, 0x800080, 0, PPR::LINE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void render_room_objects(room *r) {
|
void render_room_objects(room *r) {
|
||||||
|
|||||||
Reference in New Issue
Block a user