From c09c87b8511b9fd8429deb381d3f7573387372d2 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 5 Dec 2025 21:07:55 +0100 Subject: [PATCH] all ru enemies are now named --- rogueviz/ru/classes.cpp | 2 +- rogueviz/ru/map.ru | 196 ++++++++++++++++++++-------------------- rogueviz/ru/save.cpp | 33 ++++--- 3 files changed, 118 insertions(+), 113 deletions(-) diff --git a/rogueviz/ru/classes.cpp b/rogueviz/ru/classes.cpp index 3411153f..f12b4e5a 100644 --- a/rogueviz/ru/classes.cpp +++ b/rogueviz/ru/classes.cpp @@ -199,6 +199,7 @@ template struct statarray : array { }; struct entity { + string name; virtual ~entity() {} virtual xy siz() = 0; xy where, vel; @@ -441,7 +442,6 @@ struct timed_orb : public entity { struct npc_or_trader : public entity { string text; - string name; int talk_on; xy siz() override { return {12, 12}; } void act() override; diff --git a/rogueviz/ru/map.ru b/rogueviz/ru/map.ru index c383996c..f62a19c7 100644 --- a/rogueviz/ru/map.ru +++ b/rogueviz/ru/map.ru @@ -229,8 +229,8 @@ 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 -BOAR 256 60 -BOAR 113 255 +BOAR Peppo 256 60 +BOAR Pempo 113 255 ITEM 279 65 furry ring Someone lost a small, weird ring here. Hopefully it will be useful to you. @@ -286,7 +286,7 @@ 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 -BOAR 348 202 +BOAR Pepf 348 202 OK MOVE 1 Climbing the Hill @@ -439,14 +439,14 @@ What a shiny crystal ball! ITEM 75 200 20 gold You found 20 gold pieces -KESTREL 85 66 15 15 -KESTREL 527 65 20 10 -KESTREL 309 211 10 20 -KESTREL 100 190 25 5 -KESTREL 561 198 25 5 -SNAKE 111 220 1 -SNAKE 549 234 1 -SNAKE 493 135 1 +KESTREL Magpie 85 66 15 15 +KESTREL Loon 527 65 20 10 +KESTREL Emu 309 211 10 20 +KESTREL Ostrich 100 190 25 5 +KESTREL Nandu 561 198 25 5 +SNAKE Ss 111 220 1 +SNAKE Sss 549 234 1 +SNAKE Ssss 493 135 1 OK MOVE 2 Dungeon Entrance @@ -1180,17 +1180,17 @@ 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 -GRIDBUG 259 138 -GRIDBUG 260 130 -GRIDBUG 260 122 -GRIDBUG 260 22 -GRIDBUG 260 30 -GRIDBUG 260 38 -SNAKE 555 51 1 -SNAKE 311 265 1 -BAT 61 83 -BAT 48 62 -BAT 94 112 +GRIDBUG Ax 259 138 +GRIDBUG Ex 260 130 +GRIDBUG Ix 260 122 +GRIDBUG Ox 260 22 +GRIDBUG Ux 260 30 +GRIDBUG Yx 260 38 +SNAKE Suss 555 51 1 +SNAKE Susss 311 265 1 +BAT Laff 61 83 +BAT Kaff 48 62 +BAT Eff 94 112 ITEM 566 60 15 gold Why is there always gold lying in these mazes... @@ -1259,21 +1259,21 @@ PENDULUM 200 208 303 235 6 0 PENDULUM 344 229 513 231 5 0 PENDULUM 551 215 554 70 6 0 PENDULUM 510 60 60 60 5 0 -BAT 100 100 -BAT 200 100 -BAT 300 100 -BAT 400 100 -BAT 500 100 -BAT 100 160 -BAT 200 160 -BAT 300 160 -BAT 400 160 -BAT 500 160 -BAT 100 220 -BAT 200 220 -BAT 300 220 -BAT 400 220 -BAT 500 220 +BAT Archi 100 100 +BAT Barchi 200 100 +BAT Carchi 300 100 +BAT Darchi 400 100 +BAT Earchi 500 100 +BAT Farchi 100 160 +BAT Garchi 200 160 +BAT Harchi 300 160 +BAT Irchi 400 160 +BAT Jarchi 500 160 +BAT Karchi 100 220 +BAT Larchi 200 220 +BAT Marchi 300 220 +BAT Narchi 400 220 +BAT Orchi 500 220 OK MOVE 2 Bat Cave @@ -1369,10 +1369,10 @@ 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 -FROG 245 154 -FROG 345 154 -FROG 445 154 -GIANTFROG 145 154 +FROG Froggie 245 154 +FROG Froggy 345 154 +FROG Froggo 445 154 +GIANTFROG Doomleap 145 154 LOOT 1 fire The giant frog extract will let you produce fire! But you need to take it to a magic fountain first. @@ -1436,21 +1436,21 @@ DEADLY TRAPS AHEAD NPC 73 252 0 @Floor Engraving Ad Aerarium -VTRAP 145 56 -VTRAP 160 56 -VTRAP 175 56 -VTRAP 200 56 -VTRAP 210 56 -VTRAP 220 56 -VTRAP 230 56 -VTRAP 280 56 -VTRAP 290 56 -VTRAP 300 56 -VTRAP 310 56 -VTRAP 400 56 -VTRAP 410 56 -VTRAP 420 56 -VTRAP 430 56 +VTRAP TA1 145 56 +VTRAP TA2 160 56 +VTRAP TA3 175 56 +VTRAP TA4 200 56 +VTRAP TA5 210 56 +VTRAP TA6 220 56 +VTRAP TA7 230 56 +VTRAP TA8 280 56 +VTRAP TB1 290 56 +VTRAP TB2 300 56 +VTRAP TB3 310 56 +VTRAP TB4 400 56 +VTRAP TB5 410 56 +VTRAP TB6 420 56 +VTRAP TB7 430 56 OK MOVE 4 Bouncy Spike Maze @@ -1557,10 +1557,10 @@ 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 ROPE 300 0 0.7 50 5 0 60 -ICICLE 60 60 -ICICLE 552 63 -ICICLE 597 118 -ICICLE 577 151 +ICICLE Ia 60 60 +ICICLE Ib 552 63 +ICICLE Ic 597 118 +ICICLE Id 577 151 OK MOVE 1 Swinging Rope Room @@ -2299,15 +2299,15 @@ 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........................ -SNAKE 258 199 -1 -SNAKE 336 204 -1 -SNAKE 405 209 -1 -SNAKE 290 199 1 -SNAKE 370 204 -1 -SNAKE 385 209 1 -BAT 380 140 -BAT 380 140 -BAT 380 140 +SNAKE Ssh 258 199 -1 +SNAKE Sssh 336 204 -1 +SNAKE Ssssh 405 209 -1 +SNAKE Sssssh 290 199 1 +SNAKE Ssssssh 370 204 -1 +SNAKE Sssssssh 385 209 1 +BAT Highfly 380 140 +BAT Farfly 380 140 +BAT Bigfly 380 140 OK MOVE 1 Long Rope II @@ -2598,22 +2598,22 @@ MAP #b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#bAb..#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b ############################################..AA################################ #b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b..Ab#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b -GUINEAPIG 190 24 .25 1 -GUINEAPIG 207 92 .25 1 -GUINEAPIG 204 164 .25 1 -GUINEAPIG 265 41 .25 1 -GUINEAPIG 275 154 .25 1 -GUINEAPIG 275 204 .25 1 -GUINEAPIG 350 24 .25 1 -GUINEAPIG 327 73 .25 1 -GUINEAPIG 332 191 .25 1 -GUINEAPIG 389 99 .25 1 -GUINEAPIG 376 165 .25 1 -GUINEAPIG 440 90 .25 1 -GUINEAPIG 487 87 .25 1 -GUINEAPIG 449 27 .25 1 -GUINEAPIG 455 186 .25 1 -GUINEAPIG 404 229 .25 1 +GUINEAPIG Bas 190 24 .25 1 +GUINEAPIG Cas 207 92 .25 1 +GUINEAPIG Das 204 164 .25 1 +GUINEAPIG Eas 265 41 .25 1 +GUINEAPIG Fas 275 154 .25 1 +GUINEAPIG Gas 275 204 .25 1 +GUINEAPIG Has 350 24 .25 1 +GUINEAPIG Ias 327 73 .25 1 +GUINEAPIG Jas 332 191 .25 1 +GUINEAPIG Kas 389 99 .25 1 +GUINEAPIG Las 376 165 .25 1 +GUINEAPIG Mas 440 90 .25 1 +GUINEAPIG Nas 487 87 .25 1 +GUINEAPIG Oas 449 27 .25 1 +GUINEAPIG Pas 455 186 .25 1 +GUINEAPIG Qas 404 229 .25 1 OK MOVE 0 Guinea Pig Pen @@ -2663,17 +2663,17 @@ 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 -GUINEAPIG 122 23 .25 1 -GUINEAPIG 143 221 .25 1 -GUINEAPIG 183 25 .25 1 -GUINEAPIG 221 169 .25 1 -GUINEAPIG 245 62 .25 1 -GUINEAPIG 310 21 .25 1 -GUINEAPIG 295 183 .25 1 -GUINEAPIG 326 100 .25 1 -GUINEAPIG 360 60 .25 1 -GUINEAPIG 395 105 .25 1 -GUINEAPIG 448 23 .25 1 -GUINEAPIG 463 104 .25 1 -GUINEAPIG 418 259 .25 1 +GUINEAPIG Buy 122 23 .25 1 +GUINEAPIG Cuy 143 221 .25 1 +GUINEAPIG Duy 183 25 .25 1 +GUINEAPIG Euy 221 169 .25 1 +GUINEAPIG Fuy 245 62 .25 1 +GUINEAPIG Guy 310 21 .25 1 +GUINEAPIG Huy 295 183 .25 1 +GUINEAPIG Juy 326 100 .25 1 +GUINEAPIG Kuy 360 60 .25 1 +GUINEAPIG Luy 395 105 .25 1 +GUINEAPIG Muy 448 23 .25 1 +GUINEAPIG Nuy 463 104 .25 1 +GUINEAPIG Puy 418 259 .25 1 OK diff --git a/rogueviz/ru/save.cpp b/rogueviz/ru/save.cpp index bcf705bf..147cbc9b 100644 --- a/rogueviz/ru/save.cpp +++ b/rogueviz/ru/save.cpp @@ -135,6 +135,11 @@ void load_room(fhstream& f, cell *c) { if(pos != string::npos) { string cap = s.substr(0, pos); string param = s.substr(pos+1); + auto nam = [&] (entity& b) { + if(param == "") { println(hlog, "got nothing"); b.name = "NOTHING"; return; } + if(param[0] >= '0' && param[0] <= '9') { println(hlog, "error: expecting a name, got ", param); b.name = "UNNAMED"; return; } + pos = param.find(" "); b.name = param.substr(0, pos); param = param.substr(pos + 1); + }; if(cap == "START") { fountain_room = current_room = &r; sscanf(param.c_str(), "%lf%lf", &m.where.x, &m.where.y); @@ -148,7 +153,7 @@ void load_room(fhstream& f, cell *c) { b->id = -1; for(int i=0; iid = i; if(b->id == -1) println(hlog, "error: unknown item name ", s), b->id = 0; - b->pickup_message = scanline_noblank(f); + b->name = b->pickup_message = scanline_noblank(f); r.entities.emplace_back(std::move(b)); } else if(cap == "LOOT") { @@ -161,7 +166,7 @@ void load_room(fhstream& f, cell *c) { b->where = xy(320, 200); for(int i=0; iid = i; if(b->id == -1) println(hlog, "error: unknown loot name ", s), b->id = 0; - b->pickup_message = scanline_noblank(f); + b->name = b->pickup_message = scanline_noblank(f); b->existing = false; b->dropped = false; r.entities.emplace_back(std::move(b)); println(hlog, "loot pushed"); @@ -174,7 +179,7 @@ void load_room(fhstream& f, cell *c) { b->id = -1; for(int i=0; iid = i; if(b->id == -1) println(hlog, "error: unknown item name ", s), b->id = 0; - b->pickup_message = scanline_noblank(f); + b->name = b->pickup_message = scanline_noblank(f); r.entities.emplace_back(std::move(b)); } else if(cap == "NPC") { @@ -194,52 +199,52 @@ void load_room(fhstream& f, cell *c) { r.entities.emplace_back(std::move(b)); } else if(cap == "BOAR") { - auto b = std::make_unique(); + auto b = std::make_unique(); nam(*b); sscanf(param.c_str(), "%lf%lf", &b->where.x, &b->where.y); b->respawn = b->where; b->postfix(); r.entities.emplace_back(std::move(b)); } else if(cap == "GIANTFROG") { - auto b = std::make_unique(); + auto b = std::make_unique(); nam(*b); sscanf(param.c_str(), "%lf%lf", &b->where.x, &b->where.y); b->respawn = b->where; b->postfix(); r.entities.emplace_back(std::move(b)); } else if(cap == "FROG") { - auto b = std::make_unique(); + auto b = std::make_unique(); nam(*b); sscanf(param.c_str(), "%lf%lf", &b->where.x, &b->where.y); b->respawn = b->where; b->postfix(); r.entities.emplace_back(std::move(b)); } else if(cap == "TIMEORB") { - auto b = std::make_unique(); + auto b = std::make_unique(); nam(*b); ld dur = 0; sscanf(param.c_str(), "%lf%lf%lf", &b->where.x, &b->where.y, &dur); b->duration = dur * game_fps; r.entities.emplace_back(std::move(b)); } else if(cap == "BAT") { - auto b = std::make_unique(); + auto b = std::make_unique(); nam(*b); sscanf(param.c_str(), "%lf%lf", &b->where.x, &b->where.y); b->respawn = b->where; b->postfix(); r.entities.emplace_back(std::move(b)); } else if(cap == "GUINEAPIG") { - auto b = std::make_unique(); + auto b = std::make_unique(); nam(*b); sscanf(param.c_str(), "%lf%lf%lf%d", &b->where.x, &b->where.y, &b->pigvel, &b->spindir); b->pigvel /= game_fps; b->falling = true; b->vel = xy{0,0}; b->respawn = b->where; b->respawn_spindir = b->spindir; b->postfix(); r.entities.emplace_back(std::move(b)); } else if(cap == "ICICLE") { - auto b = std::make_unique(); + auto b = std::make_unique(); nam(*b); sscanf(param.c_str(), "%lf%lf", &b->where.x, &b->where.y); b->state = 0; b->vel = xy{0,0}; b->respawn = b->where; b->postfix(); r.entities.emplace_back(std::move(b)); } else if(cap == "VTRAP") { - auto b = std::make_unique(); + auto b = std::make_unique(); nam(*b); sscanf(param.c_str(), "%lf%lf", &b->where.x, &b->where.y); auto dat = b->get_dat(); b->vel.x = 0; b->vel.y = 150 * 0.005 * dat.modv * dat.d; @@ -248,20 +253,20 @@ void load_room(fhstream& f, cell *c) { r.entities.emplace_back(std::move(b)); } else if(cap == "GRIDBUG") { - auto b = std::make_unique(); + auto b = std::make_unique(); nam(*b); sscanf(param.c_str(), "%lf%lf", &b->where.x, &b->where.y); b->respawn = b->where; b->postfix(); r.entities.emplace_back(std::move(b)); } else if(cap == "KESTREL") { - auto b = std::make_unique(); + auto b = std::make_unique(); nam(*b); sscanf(param.c_str(), "%lf%lf%lf%lf", &b->where.x, &b->where.y, &b->vel.x, &b->vel.y); b->vel *= xy(block_x, block_y) / game_fps; b->respawn = b->where; b->respawn_vel = b->vel; b->postfix(); r.entities.emplace_back(std::move(b)); } else if(cap == "SNAKE") { - auto b = std::make_unique(); + auto b = std::make_unique(); nam(*b); sscanf(param.c_str(), "%lf%lf%d", &b->where.x, &b->where.y, &b->dir); b->respawn = b->where; b->respawn_dir = b->dir; b->postfix(); r.entities.emplace_back(std::move(b));