mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-20 15:40:26 +00:00
tortoise flags are now editable with Shift+G and saved into saved levels
This commit is contained in:
parent
78adac4e10
commit
35043b5528
@ -2301,7 +2301,7 @@ void livecaves() {
|
||||
/* evolver */
|
||||
|
||||
namespace tortoise {
|
||||
map<cell*, cell*> emap;
|
||||
map<cell*, int> emap;
|
||||
map<cell*, int> babymap;
|
||||
int last;
|
||||
|
||||
@ -2318,13 +2318,11 @@ namespace tortoise {
|
||||
const int numbits = (int) tfCOUNT;
|
||||
const int mask = (1<<numbits)-1;
|
||||
|
||||
cell *get(cell *where) {
|
||||
int getb(cell *where) {
|
||||
if(emap.count(where)) return emap[where];
|
||||
return where;
|
||||
return getBits(where);
|
||||
}
|
||||
|
||||
int getb(cell *where) { return getBits(get(where)); }
|
||||
|
||||
int countBits(int c) {
|
||||
int bi = 0;
|
||||
for(int i=0; i<numbits; i++) if((c >> i)&1) bi++;
|
||||
|
13
debug.cpp
13
debug.cpp
@ -366,6 +366,19 @@ struct debugScreen {
|
||||
});
|
||||
dialog::addSelItem("barrier left", dnameof2(what->barleft), 0);
|
||||
dialog::addSelItem("barrier right", dnameof2(what->barright), 0);
|
||||
if(what->item == itBabyTortoise) {
|
||||
dialog::addSelItem("baby Tortoise flags", itsh(tortoise::babymap[what]), 'B');
|
||||
dialog::add_action([what] () {
|
||||
dialog::editNumber(tortoise::babymap[what], 0, (1<<21)-1, 1, getBits(what), "", "");
|
||||
});
|
||||
}
|
||||
if(what->monst == moTortoise) {
|
||||
dialog::addSelItem("adult Tortoise flags", itsh(tortoise::emap[what]), 'A');
|
||||
dialog::add_action([what] () {
|
||||
tortoise::emap[what] = tortoise::getb(what);
|
||||
dialog::editNumber(tortoise::emap[what], 0, (1<<21)-1, 1, getBits(what), "", "");
|
||||
});
|
||||
}
|
||||
dialog::addBreak(50);
|
||||
|
||||
if(show_debug_data) {
|
||||
|
2
game.cpp
2
game.cpp
@ -3294,7 +3294,7 @@ void moveEffect(cell *ct, cell *cf, eMonster m, int direction_hint) {
|
||||
if(cf && isPrincess(m)) princess::move(ct, cf);
|
||||
|
||||
if(cf && m == moTortoise) {
|
||||
tortoise::emap[ct] = tortoise::get(cf);
|
||||
tortoise::emap[ct] = tortoise::getb(cf);
|
||||
tortoise::emap.erase(cf);
|
||||
}
|
||||
|
||||
|
@ -160,10 +160,14 @@ namespace mapstream {
|
||||
f.write_char(c->land);
|
||||
f.write_char(c->mondir);
|
||||
f.write_char(c->monst);
|
||||
if(c->monst == moTortoise)
|
||||
f.write(tortoise::emap[c] = tortoise::getb(c));
|
||||
f.write_char(c->wall);
|
||||
// f.write_char(c->barleft);
|
||||
// f.write_char(c->barright);
|
||||
f.write_char(c->item);
|
||||
if(c->item == itBabyTortoise)
|
||||
f.write(tortoise::babymap[c]);
|
||||
f.write_char(c->mpdist);
|
||||
// f.write_char(c->bardir);
|
||||
f.write(c->wparam); f.write(c->landparam);
|
||||
@ -324,10 +328,14 @@ namespace mapstream {
|
||||
c->land = (eLand) f.read_char();
|
||||
c->mondir = fixspin(rspin, f.read_char(), c->type);
|
||||
c->monst = (eMonster) f.read_char();
|
||||
if(c->monst == moTortoise && vernum >= 11001)
|
||||
f.read(tortoise::emap[c]);
|
||||
c->wall = (eWall) f.read_char();
|
||||
// c->barleft = (eLand) f.read_char();
|
||||
// c->barright = (eLand) f.read_char();
|
||||
c->item = (eItem) f.read_char();
|
||||
if(c->item == itBabyTortoise && vernum >= 11001)
|
||||
f.read(tortoise::babymap[c]);
|
||||
c->mpdist = f.read_char();
|
||||
c->bardir = NOBARRIERS;
|
||||
// fixspin(rspin, f.read_char(), c->type);
|
||||
@ -625,7 +633,7 @@ namespace mapeditor {
|
||||
if(c->monst ==moTortoise && last == moTortoise) {
|
||||
cell *c1 = c;
|
||||
for(int i=0; i<100; i++) c1 = c1->cmove(hrand(c1->type));
|
||||
tortoise::emap[c] = c1;
|
||||
tortoise::emap[c] = tortoise::getRandomBits();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
2
orbs.cpp
2
orbs.cpp
@ -801,7 +801,7 @@ void summonAt(cell *dest) {
|
||||
if(dest->monst == moFireElemental && isFire(dest))
|
||||
dest->wall = waNone;
|
||||
if(dest->monst == moTortoise)
|
||||
tortoise::emap[dest] = dest, dest->hitpoints = 3;
|
||||
tortoise::emap[dest] = getBits(dest), dest->hitpoints = 3;
|
||||
addMessage(XLAT("You summon %the1!", dest->monst));
|
||||
moveEffect(dest, dest, dest->monst, -1);
|
||||
if(dest->wall == waClosePlate || dest->wall == waOpenPlate)
|
||||
|
@ -3340,7 +3340,7 @@ bool drawMonster(const transmatrix& V, cell *c, const transmatrix*& Vboat, trans
|
||||
c->stuntime = 1 + (m->stunoff - curtime-1)/300;
|
||||
if(hasHitpoints(m->type))
|
||||
c->hitpoints = m->hitpoints;
|
||||
if(m->type == moTortoise) tortoise::emap[c] = m->torigin;
|
||||
if(m->type == moTortoise) tortoise::emap[c] = getBits(m->torigin);
|
||||
drawMonsterType(m->type, c, view, col, m->footphase);
|
||||
if(m->type == moTortoise) tortoise::emap.erase(c);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user