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

ru:: a few more levels

This commit is contained in:
Zeno Rogue 2025-04-19 22:12:26 +02:00
parent 7629b89245
commit 4aa1b971a6
8 changed files with 445 additions and 65 deletions

View File

@ -1,11 +1,13 @@
namespace rogue_unlike {
/** a helper structure to mass to powerfun */
struct data {
int keystate;
double d;
ld modv;
ld moda;
int dx;
struct power *p;
};
using powerfun = hr::function<void(data&)>;
@ -13,12 +15,15 @@ using powerfun = hr::function<void(data&)>;
struct power {
int key;
string name;
string xname;
string desc;
string glyph;
color_t color;
flagtype flags;
powerfun pf;
int id_status;
power(int key, string name, string desc, string glyph, color_t color, flagtype f, powerfun pf) : key(key), name(name), desc(desc), glyph(glyph), color(color), flags(f), pf(pf) {
id_status = 0;
}
};
@ -132,9 +137,7 @@ struct entity {
virtual double grav() { return 0.1; }
bool on_floor;
bool fallthru;
bool on_ice;
bool on_floor, fallthru, on_ice, wallhug, on_bounce;
bool destroyed;
void kino();
@ -156,6 +159,11 @@ struct man : public entity {
int facing;
int attack_facing;
int attack_when;
int on_floor_when;
int jump_control, next_jump_control;
int coyote_time, next_coyote_time;
man() { facing = 1; attack_facing = 1; }
double sx() override { return 12; }
double sy() override { return 12; }
@ -176,13 +184,15 @@ struct sage : public entity {
struct item : public entity {
int id;
string pickup_message;
double sx() override { return 12; }
double sy() override { return 12; }
string glyph() override { return powers[id].glyph; }
color_t color() override { return powers[id].color; }
void act() override {
kino();
if(intersect(get_pixel_bbox(), m.get_pixel_bbox())) {
addMessage("You pick up the " + powers[id].name + ".");
addMessage(pickup_message);
destroyed = true;
}
}

View File

@ -30,6 +30,8 @@ void entity::apply_grav() {
void entity::kino() {
on_floor = false;
on_ice = false;
wallhug = false;
on_bounce = false;
// ld modv = 60. / game_fps;
@ -45,8 +47,9 @@ void entity::kino() {
for(int x = obb.minx; x < obb.maxx; x++) for(int y = obb.maxy; y < jbb.maxy; y++) {
eWall b = current_room->at(x, y);
if(walls[b].flags & blocking) {
if(walls[b].flags & W_BOUNCY) { vel_y = -vel_y; on_bounce = true; goto again; }
on_floor = true;
if(b == wFrozen) on_ice = true;
if(walls[b].flags & W_FROZEN) on_ice = true;
vel_y /= 2;
if(abs(vel_y) < 1e-6) vel_y = 0;
if(freezing()) {
@ -85,6 +88,7 @@ void entity::kino() {
if(walls[b].flags & W_BLOCK) {
if(freezing()) { hit_wall(); }
vel_x = (vel_x - max<ld>(vel_y, 0)/10) / 2;
wallhug = true;
goto again;
}
}
@ -98,6 +102,7 @@ void entity::kino() {
if(walls[b].flags & W_BLOCK) {
if(freezing()) { hit_wall(); }
vel_x = (vel_x + max<ld>(vel_y, 0)/10) / 2;
wallhug = true;
goto again;
}
}

View File

@ -58,16 +58,18 @@ flagtype W_TRANS = 2;
flagtype W_PLATFORM = 4;
flagtype W_STAIRCASE = 8;
flagtype W_PAIN = 16;
flagtype W_BOUNCY = 32;
flagtype W_FROZEN = 64;
constexpr int qwall = 14;
ruwall walls[qwall] = {
{"air", ".", 0x40404080, W_TRANS},
{"wall", "#", 0xFFFFFFFF, W_BLOCK},
{"bouncy wall", "#", 0x80FF80FF, W_BLOCK},
{"bouncy wall", "#", 0x80FF80FF, W_BLOCK | W_BOUNCY},
{"spike", "^", 0xC08080FF, W_BLOCK | W_TRANS},
{"water", "~", 0x0000FFFF, W_BLOCK | W_TRANS},
{"frozen water", "#", 0xC0C0FFFF, W_BLOCK},
{"frozen water", "#", 0xC0C0FFFF, W_BLOCK | W_FROZEN},
{"door", "+", 0xC06000FF, W_BLOCK},
{"smashed door", "'", 0xC06000FF, W_TRANS},
{"magic fountain", "!", 0x8080C0FF, W_TRANS},

View File

@ -11,15 +11,21 @@ void man::act() {
dat.moda = dat.modv * dat.modv;
dat.dx = 0;
coyote_time = next_coyote_time; next_coyote_time = 0;
jump_control = next_jump_control; next_jump_control = 0;
if(on_floor) on_floor_when = gframeid;
fallthru = false;
handle_powers(dat);
if(on_floor && !on_ice) {
if((on_floor || jump_control || wallhug) && !on_ice) {
vel_x = dat.dx * dat.d * dat.modv * 2.5;
}
else {
vel_x += dat.dx * dat.d * .05 * dat.moda;
if(on_bounce) {
vel_x += dat.dx * dat.d * dat.modv * 0.02;
}
if(dat.dx) facing = dat.dx;

View File

@ -2,43 +2,43 @@ ROOM Red Rooster Inn
# wall
+ door
- platform
s staircase
A staircase
. air
MAP
...................##.............................+-...-+..---...##.............
...................##.............................+-....+..---...##.............
..................##################################----############............
.................##.....................#.............s.......#....##...........
................##......................#............s........#.....##..........
...............##.......................#...........s.........#......##.........
..............##........................#..........s..........#.......##........
.............##.........................#.........s...........#........##.......
............##..........................+........s............+.........##......
...........##...........................+.......s.............+..........##.....
..........############################################----##################....
.........###........................................##.s............##....##....
..........#b........................................#b..s...........#b....#b....
..........##........................................##...s..........##....##....
..........#b....---------..----------..----------...#b....s.........#b....#b....
..........##........................................##.....s........##....##....
..........#b........................................#b......s.......#b....#b....
..........##........................................##.......s......##....##....
..........#b....---------..----------..----------...#b........s.....#b....#b....
..........##........................................##.........s....##....##....
..........#b........................................#b..........s...#b....#b....
..........##........................................##...........s..+.....##....
..........#b........................................#b............s.+.....#b....
..........##....---------..----------..----------...##...........s##########....
..........#b........................................#b..........s...#b....#b....
..........##........................................##.........s....##....##....
..........#b........................................#b........s.....#b....#b....
..........##....---------..----------..----------...##.......s......##....##....
..........#b........................................#b......s.......#b....#b....
..........##........................................##.....s........##....##....
..........#b........................................#b....s.........#b....#b....
..........++....---------..----------..----------...++...s..........##....##....
..........+b........................................+b..s...........#b....#b....
..........++........................................++.s............++....##....
..........+b........................................+bs.............+b....#b....
.................##.....................#..............A......#....##...........
................##......................#.............A.......#.....##..........
...............##.......................#............A........#......##.........
..............##........................#...........A.........#.......##........
.............##.........................#..........A..........#........##.......
............##..........................+.........A...........+.........##......
...........##...........................+........A............+..........##.....
..........############################################------################....
.........###........................................##.A..................##....
--........#b........................................#b..A.................#b....
..........##........................................##...A................##....
..........#b.....--------...--------...--------.....#b....A...............#b....
..........##........................................##.....A..............##....
..........#b........................................#b......A.............#b....
..........##........................................##.......A............##....
--........#b....---------...--------...---------....#b........A...........#b....
..........##........................................##.........A..........##....
..........#b........................................#b..........A.........#b....
..........##........................................##...........A........##....
..........#b....---------...--------...---------....#b............A.......#b....
..........##........................................##.............#------##....
..........#b........................................#b...................A#b....
..........##........................................##..................A.##....
..........#b...----------..----------..----------...#b.................A..#b....
..........##........................................##................A...##....
..........#b........................................#b...............A....#b....
..........##........................................##..............A.....##....
..........#b...----------..----------..----------...#b.............A......#b....
..........++........................................++............A.......##....
..........+b........................................+b...........A........#b....
..........++........................................++..........A.........##....
..........+b........................................+b.........A..........#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
################################################################################
@ -90,13 +90,14 @@ 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......................
START 344 274
ITEM 382 287
dagger
You collect your trusty dagger from the drawer.
OK
MOVE 1 Red Rooster Inn
@ -144,6 +145,9 @@ 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
ITEM 484 123
steel ring
You notice a crow nest. There is a shiny ring inside!
OK
MOVE 2 Red Rooster Inn
@ -194,6 +198,9 @@ 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
ITEM 279 65
furry ring
Someone lost a small, weird ring here. Hopefully it will be useful to you.
OK
MOVE 2 Forest Path
@ -387,6 +394,9 @@ 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
ITEM 380 131
strange blue crystal ball
What a shiny crystal ball!
OK
MOVE 2 Dungeon Entrance
@ -436,3 +446,254 @@ 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
OK
MOVE 3 Dungeons of Doom
ROOM First Magic Fountain Cave
! magic fountain
# wall
- staircase
. air
A platform
MAP
###################.-###########################################################
###################.-###########################################################
###################.-###########################################################
###################.-###########################################################
###################.-###########################################################
################....-.........##############################.......#############
##############......-...........#########################............###########
############........-.............######################..............##########
###########.........-................################..................#########
##########..........-..................###########.....................#########
##########..........-.....................######.......................#########
#########...........-..................................................#########
#########...........-..................................................#########
##########..........-..................................................#########
##########..........-..................................................#########
##########..........-..................................................#########
###########.........-.................................................##########
############..........................................................##########
##############.......................................................###########
################....###..............................................###########
##########################..........................................############
###############################..-..................................############
################################.-.................................#############
#################################-................................##############
#################################-..............................################
###############################..-.............................#################
##############################...-........!!.................###################
###############################..-........!b...............#####################
################################........######...........#######################
###################################.....#b#b#b....##AAAA########################
####################################################----########################
####################################################-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#b#b#b#b#b-b-b#b#b#b#b#b#b#b#b#b#b#b#b
OK
MOVE 3 First Magic Fountain Cave
ROOM Watery Death
# wall
- staircase
. air
A platform
^ spike
~ water
MAP
#################################################################--#############
#################################################################--#############
#################################################################AA#############
#################################################################--#############
.................................................................--.........####
.................................................................--..........###
.................................................................--..........###
.............................................................................###
.............................................................................###
..##################################################################.........###
..######################........................###################..........###
..#####################..........................#################...........###
.######################............................#####.....................###
.######################.............................####.....................###
.######################..............................###.....................###
#######################....############.....##........##........##...........###
#######################....#############..............##.......####..........###
#######################....#####......##...............#.......####..........###
#######################....#####......##......##.......#......######.........###
#######################....#####......##...............#......######.........###
#######################.....####--##..##...............#......######.........###
#######################.......##-b##..##...............#......######.........###
#######################........#--##..##......##..............######.........###
#######################........#-b##..##......................######.........###
#######################........#--##..##......................######~~~~~~~~~###
#######################....#####-b##..###.....................######^^^^^^^^^###
#######################....#####--##..####AA####################################
#######################....#####-b##...###..####################################
#######################....#####--##....##AA####################################
#######################....#####-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#b#b#b#b#b#b
OK
MOVE 2 Watery Death
ROOM Jumping Course
# wall
- platform
. air
A bouncy wall
^ spike
MAP
################################################################################
################################################################################
################################################################################
################################################################################
...............################.....#####################.......................
................########.............#..........................................
.....................................#..........................................
.....................................#..........................................
###########....---------.............#..........................................
###########................####......#........................................##
###########...................###....#^.......................................##
###########..........................#........................................##
###########..........................#^......................................###
###########................--------..#.......................................###
###########..................................................................###
###########...............................-------...........................####
###########....----.........................................................####
###########.................................................................####
###########.........................................-......................#####
###########.......-........................................................#####
###########................................................................#####
###########............................................######.............######
###########..........AAAAAA..####....#....................................######
###########...............................................................######
###########..............................................................#######
###########..................................................##..........#######
###########..............................................................#######
############............................................................########
############...................................###.............##.......########
#############.............................#########.....................########
###############......................##################.................########
###############AAAAAAAAAAAAAAAAAAAAAA#####################.............#########
################################################################################
################################################################################
################################################################################
#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#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b
OK
MOVE 2 Jumping Course
ROOM Treasure Cave
# wall
- staircase
. 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#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b
ITEM 324 198
Golden Shoelaces
Hopefully these golden shoelaces are valuable.
OK
MOVE 3 Watery Death
ROOM Second Magic Fountain
! magic fountain
# wall
- staircase
. 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#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b
OK

View File

@ -2,6 +2,9 @@ namespace rogue_unlike {
flagtype STARTING = Flag(1);
flagtype WHILE_PAUSED = Flag(2);
flagtype TOGGLEABLE = Flag(4);
flagtype ACTIVE = Flag(8);
flagtype NEEDS_IDENTIFY = Flag(16);
vector<power> powers = {
power('1', "Potion of Extra Life",
@ -30,7 +33,12 @@ vector<power> powers = {
"you expect to find some ways to make it more powerful.",
"^", 0xFF0000FF, STARTING,
[] (data& d) {
if((d.keystate & 1) && m.on_floor) m.vel_y = -(non_hyperbolic ? 3 : 5) * d.d * d.modv;
if(d.keystate & 1) {
bool can_jump = m.on_floor;
println(hlog, "on_floor_when = ", m.on_floor_when, " gframeid = ", gframeid, " coyote_time = ", m.coyote_time);
if(gframeid <= m.on_floor_when + m.coyote_time) can_jump = true;
if(can_jump) m.vel_y = -(non_hyperbolic ? 3 : 5) * d.d * d.modv, m.on_floor_when = -1000;
}
}
),
@ -67,28 +75,113 @@ vector<power> powers = {
}
}),
power('o', "Poincaré's Crystal Ball",
power('o', "strange blue crystal ball", "You feel an urge to look into it.",
"o", 0x00FF00FF, WHILE_PAUSED | NEEDS_IDENTIFY,
[] (data& d) {
if(!(d.p->flags & NEEDS_IDENTIFY))
d.p->name = "Poincaré's Crystal Ball",
d.p->desc =
"This crystal ball will not let you predict the future or see things elsewhere, but will let you easily map the "
"parts of the world you have seen so far. This artifact is rumored to have been actually created by Beltrami, but "
"it was bought and presented to people by the famous wizard Poincaré, and people thought it was Poincaré's creation.",
"o", 0x00FF00FF, WHILE_PAUSED,
[] (data& d) {
"it was bought and presented to people by the famous wizard Poincaré, and people thought it was Poincaré's creation.";
if(d.keystate != 1) return;
d.p->flags &=~ NEEDS_IDENTIFY;
switch_mapmode_to(cmapmode == mapmode::poincare ? mapmode::standard : mapmode::poincare);
}
),
power('b', "Beltrami's Crystal Ball",
power('b', "strange cyan crystal ball", "You feel an urge to look into it.",
"o", 0x00FFFFFF, WHILE_PAUSED | NEEDS_IDENTIFY,
[] (data& d) {
if(!(d.p->flags & NEEDS_IDENTIFY))
d.p->name = "Beltrami's Crystal Ball",
d.p->desc =
"Created by the ancient wizard Beltrami, this crystal ball will not let you predict the future or see things elsewhere, "
"but will let you easily map the parts of the world you have seen so far. Contrary to Poincaré's ball, straight lines are "
"mapped faithfully.",
"o", 0x00FFFFFF, WHILE_PAUSED,
[] (data& d) {
"mapped faithfully.";
if(d.keystate != 1) return;
d.p->flags &=~ NEEDS_IDENTIFY;
switch_mapmode_to(cmapmode == mapmode::klein ? mapmode::standard : mapmode::klein);
}
),
power('c', "furry ring",
"This strange ring is too small to put on your finger, but maybe you could put it on your small toe?",
"=", 0xe1cbbeFF, TOGGLEABLE | NEEDS_IDENTIFY,
[] (data& d) {
if(!(d.p->flags & NEEDS_IDENTIFY))
d.p->name = "Toe Ring of the Coyote",
d.p->desc =
"This ring, worn on a toe, will let you still jump after running off a platform. Just make sure that you run off with the foot that you are wearing this ring on!";
if(d.keystate == 1) {
d.p->flags ^= ACTIVE;
if(d.p->flags & ACTIVE) addMessage("You put the " + d.p->name + " on your toe.");
else addMessage("You remove the " + d.p->name + " from your toe.");
}
if(d.p->flags & ACTIVE) m.next_coyote_time += 30;
if((d.p->flags & NEEDS_IDENTIFY) && (gframeid <= m.on_floor_when + m.coyote_time) && !m.on_floor) {
d.p->flags &=~ NEEDS_IDENTIFY;
addMessage("You feel a strange magical force wanting to hold your foot from below.");
}
}
),
power('g', "Golden Shoelaces",
"These shoelaces might bind you into place or give you freedom... or they could just be mundane shoelaces for rich people... one way to tell.",
"=", 0xFFD500FF, TOGGLEABLE,
[] (data& d) {
if(!(d.p->flags & NEEDS_IDENTIFY))
d.p->desc =
"Normally you cannot control your jumps while you are flying. These shoelaces allow you some control over your jumps.";
if(d.keystate == 1) {
d.p->flags ^= ACTIVE;
if(d.p->flags & ACTIVE) addMessage("You put the Golden Shoelaces on your boots.");
else addMessage("You remove the Golden Shoelaces from your boots.");
}
if(d.p->flags & ACTIVE) {
m.next_jump_control++;
auto& ids = d.p->id_status;
bool id_up = (!!m.on_floor) == !!(ids & 1);
if(id_up) {
ids++;
if(ids == 2) {
addMessage("Something felt strange during this jump.");
}
if(ids == 4) {
addMessage("This jump was strange too.");
}
if(ids == 6) {
addMessage("You feel in control of the laws of physics.");
}
if(ids == 8) {
addMessage("You feel able to control your jumps while flying.");
}
if(ids == 10) {
d.p->flags |= NEEDS_IDENTIFY;
addMessage("This control originates from your golden shoelaces.");
}
}
}
}
),
power('r', "steel ring",
"Is it safe to put this ring on?",
"=", 0xC04040FF, TOGGLEABLE | NEEDS_IDENTIFY,
[] (data& d) {
if(!(d.p->flags & NEEDS_IDENTIFY))
d.p->name = "Ring of Strength",
d.p->desc =
"This will raise your strength!";
if(d.keystate == 1) {
d.p->flags ^= ACTIVE;
d.p->flags &=~ NEEDS_IDENTIFY;
if(d.p->flags & ACTIVE) addMessage("You put the Ring of Strength on your finger.");
else addMessage("You remove the Ring of Strength from your finger.");
}
}
),
};
void handle_powers(data& d) {
@ -97,6 +190,7 @@ void handle_powers(data& d) {
d.keystate = 0;
if(keyheld(p.key)) d.keystate |= 1;
if(keywasheld(p.key)) d.keystate |= 2;
d.p = &p;
p.pf(d);
}
}

View File

@ -80,6 +80,7 @@ void editmap_frame() {
dialog::display();
});
if(keypressed('f')) floodfill(mousepx / block_x, mousepy / block_y);
if(keypressed('t')) { m.where_x = mousepx; m.where_y = mousepy; m.vel_x = 0; m.vel_y = 0; }
}
void playing_frame() {
@ -198,7 +199,7 @@ void run() {
if(cmode == mode::playing) sync_map();
render_the_map();
if(cmode == mode::editmap) dialog::add_key_action('p', [] { println(hlog, "p pressed"); switch_mapmode_to(mapmode::poincare); });
if(cmode == mode::editmap) mouseovers = format("coordinates: %d %d", mousepx, mousepy);
if(cmode == mode::editmap) mouseovers = format("coordinates: %d %d (%.2lf)", mousepx, mousepy, double(get_scale_at(mousepy)));
break;
case mode::inventory:

View File

@ -115,6 +115,7 @@ void load_room(fhstream& f, cell *c) {
b->id = -1;
for(int i=0; i<isize(powers); i++) if(powers[i].name == s) b->id = i;
if(b->id == -1) println(hlog, "error: unknown item name ", s), b->id = 0;
b->pickup_message = scanline_noblank(f);
r.entities.emplace_back(std::move(b));
}
else println(hlog, "unknown mapline ", s);