1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-07-23 11:12:50 +00:00

ru:: swinging rope room

This commit is contained in:
Zeno Rogue 2025-05-17 11:10:40 +02:00
parent 9359f58f77
commit 069bec4247
4 changed files with 124 additions and 0 deletions

View File

@ -332,6 +332,16 @@ struct pendulum_platform : public moving_platform {
string get_help() override { return "These pendulum platforms go back and forth between two locations, taking the shortest path possible."; }
};
struct rope_platform : public moving_platform {
ld period, shift, dist, max_swing;
xy location_at(ld t) override;
int width() override { return 1; }
eWall platform_type() override { return wStaircase; }
string glyph() override { return "-"; }
string get_name() override { return "Swinging rope"; }
string get_help() override { return "A part of a swinging rope."; }
};
struct timed_orb : public entity {
int duration;
xy siz() override { return {18, 18}; }

View File

@ -442,6 +442,10 @@ xy ferris_platform::location_at(ld t) {
return from_hyper(rgpushxto0(to_hyper(ctr)) * xspinpush0(t / game_fps + shift, radius));
}
xy rope_platform::location_at(ld t) {
return from_hyper(eupush(to_hyper(ctr)) * xspinpush0(sin(t / game_fps / period * TAU + shift) * max_swing, dist));
}
xy pendulum_platform::location_at(ld t) {
auto h1 = to_hyper(a);
auto h2 = to_hyper(b);

View File

@ -1508,3 +1508,102 @@ Jack the trader
Do you want to buy anthing?\n\nSorry for the traps, last week a thief stole my stuff and escaped through some secret door. So I installed some for protection.\n\nNo idea where it is...
OK
MOVE 4 Timed Passage
ROOM Swinging Rope Room
# wall
- platform
. air
^ spike
MAP
##################################.......#######################################
################################...........#####################################
####........................................................................####
####..............................................^.........................####
####..............^.........................................................####
####........................................................................####
########...........................................................#############
####........................................................................####
..##........................................................................####
..##........................................................................####
..##........................................................................####
..##........................................................................####
--##..................................................................^^....####
-b.................................................................#############
................................................................................
................................................................................
####............................................................................
####................................................................############
####........................................................................####
####........................................................................####
####................^.......................................................####
####........................................................................####
####........................................................................####
####........................................................................####
####........................................................................####
####........................................................................####
####..................................................^.....................####
####........................................................................####
####........................................................................####
####......--.......................................................--.......####
####........................................................................####
####........................................................................####
####........................................................................####
####........................................................................####
####........................................................................####
#b#b........................................................................#b#b
################################################################################
#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b
################################################################################
#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b
ROPE 300 0 0.7 50 5 0 60
OK
MOVE 1 Swinging Rope Room
ROOM Above the Rope
! magic fountain
# wall
- platform
. air
MAP
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
##################################################################........######
##################################################################........######
##################################################################........######
##################################################################!!......######
##################################################################!b......######
##################################################################--------######
#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b-b-b-b-b#b#b#b
##################################################################..............
#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b..............
##############################################################..................
#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b..................
ROPE 584 288 0.7 50 5 0 60
OK

View File

@ -234,6 +234,17 @@ void load_room(fhstream& f, cell *c) {
r.entities.emplace_back(std::move(b));
}
}
else if(cap == "ROPE") {
ld cx, cy, radius, period, shift, max_swing; int qty;
sscanf(param.c_str(), "%lf%lf%lf%d%lf%lf%lf", &cx, &cy, &radius, &qty, &period, &shift, &max_swing);
for(int i=0; i<qty; i++) {
auto b = std::make_unique<rope_platform>();
b->ctr = {cx, cy}; b->radius = radius; b->period = period; b->max_swing = max_swing * 1._deg; b->shift = shift;
b->dist = radius * (i+0.5) / qty;
r.entities.emplace_back(std::move(b));
}
}
else if(cap == "PENDULUM") {
auto b = std::make_unique<pendulum_platform>();
sscanf(param.c_str(), "%lf%lf%lf%lf%lf%lf", &b->a.x, &b->a.y, &b->b.x, &b->b.y, &b->period, &b->shift);