1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 17:40:36 +00:00

saving the geometry correctly in map editor

This commit is contained in:
Zeno Rogue 2017-11-07 14:08:50 +01:00
parent 800a37f646
commit 8c39251b6a
2 changed files with 43 additions and 6 deletions

View File

@ -14,9 +14,9 @@
#define NOLICENSE #define NOLICENSE
#endif #endif
#define VER "10.2b" #define VER "10.23"
#define VERNUM 10202 #define VERNUM 10203
#define VERNUM_HEX 0xA092 #define VERNUM_HEX 0xA093
#define GEN_M 0 #define GEN_M 0
#define GEN_F 1 #define GEN_F 1

View File

@ -86,7 +86,22 @@ namespace mapstream {
if(!f) return false; if(!f) return false;
int32_t i = VERNUM; save(i); int32_t i = VERNUM; save(i);
save(mapeditor::whichPattern); save(mapeditor::whichPattern);
addToQueue(cwt.c->master->c7); save(geometry);
save(nontruncated);
if(geometry == gTorus) {
save(torusconfig::qty);
save(torusconfig::dx);
save(torusconfig::dy);
}
if(geometry == gQuotient2) {
using namespace fieldpattern;
save(quotient_field_changed);
if(quotient_field_changed) {
save(current_extra);
save(fgeomextras[current_extra].current_prime_id);
}
}
addToQueue(bounded ? currentmap->gamestart() : cwt.c->master->c7);
for(int i=0; i<size(cellbyid); i++) { for(int i=0; i<size(cellbyid); i++) {
cell *c = cellbyid[i]; cell *c = cellbyid[i];
if(i) { if(i) {
@ -115,6 +130,7 @@ namespace mapstream {
if(c2 && c2->land != laNone) addToQueue(c2); if(c2 && c2->land != laNone) addToQueue(c2);
} }
} }
printf("cells saved = %d\n", size(cellbyid));
int32_t n = -1; save(n); int32_t n = -1; save(n);
int32_t id = cellids.count(cwt.c) ? cellids[cwt.c] : -1; int32_t id = cellids.count(cwt.c) ? cellids[cwt.c] : -1;
save(id); save(id);
@ -154,6 +170,27 @@ namespace mapstream {
printf("vernum = %d\n", vernum); printf("vernum = %d\n", vernum);
if(vernum >= 7400) load(mapeditor::whichPattern); if(vernum >= 7400) load(mapeditor::whichPattern);
if(vernum >= 10203) {
load(geometry);
load(nontruncated);
if(geometry == gTorus) {
load(torusconfig::qty);
load(torusconfig::dx);
load(torusconfig::dy);
}
if(geometry == gQuotient2) {
using namespace fieldpattern;
load(quotient_field_changed);
if(quotient_field_changed) {
load(current_extra);
load(fgeomextras[current_extra].current_prime_id);
enableFieldChange();
}
}
}
resetGeometry();
clearMemory(); clearMemory();
initcells(); initcells();
if(shmup::on) shmup::init(); if(shmup::on) shmup::init();
@ -174,10 +211,10 @@ namespace mapstream {
cell *c2 = cellbyid[parent]; cell *c2 = cellbyid[parent];
dir = fixspin(dir, relspin[parent], c2->type); dir = fixspin(dir, relspin[parent], c2->type);
c = createMov(c2, dir); c = createMov(c2, dir);
// printf("%p:%d,%d -> %p\n", c2, dir, c); // printf("%p:%d,%d -> %p\n", c2, relspin[parent], dir, c);
// spinval becomes xspinval // spinval becomes xspinval
rspin = (c2->spn(dir) - loadChar() + 42) % c->type; rspin = (c2->spn(dir) - loadChar() + MODFIXER) % c->type;
} }
cellbyid.push_back(c); cellbyid.push_back(c);