1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-01-12 02:10:34 +00:00

simplified cellgroups

This commit is contained in:
Zeno Rogue 2017-12-22 21:37:30 +01:00
parent 8a97571cb4
commit 5a2ae1a865
4 changed files with 27 additions and 21 deletions

View File

@ -3517,7 +3517,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
} }
#if CAP_EDIT #if CAP_EDIT
if(mapeditor::drawUserShape(V * applyPatterndir(c, si), mapeditor::cellShapeGroup(), si.id, if(mapeditor::drawUserShape(V * applyPatterndir(c, si), 3, si.id,
darkena(fcol, fd, (cmode & sm::DRAW) ? 0xC0 : 0xFF), c)); darkena(fcol, fd, (cmode & sm::DRAW) ? 0xC0 : 0xFF), c));
else if(patterns::whichShape == '7') { else if(patterns::whichShape == '7') {

View File

@ -14,9 +14,9 @@
#define NOLICENSE #define NOLICENSE
#endif #endif
#define VER "10.2e" #define VER "10.3"
#define VERNUM 10205 #define VERNUM 10300
#define VERNUM_HEX 0xA095 #define VERNUM_HEX 0xA0A0
#define GEN_M 0 #define GEN_M 0
#define GEN_F 1 #define GEN_F 1

View File

@ -480,20 +480,11 @@ namespace mapeditor {
return 1; return 1;
} }
int cellShapeGroup() {
using namespace patterns;
if(whichPattern == 'f') return 4;
if(whichPattern == 'p') return 5;
if(whichPattern == 'z') return 6;
if(whichPattern == 'H') return 7;
return 3;
}
int drawcellShapeGroup() { int drawcellShapeGroup() {
if(drawcell == cwt.c && drawplayer) return 0; if(drawcell == cwt.c && drawplayer) return 0;
if(drawcell->monst) return 1; if(drawcell->monst) return 1;
if(drawcell->item) return 2; if(drawcell->item) return 2;
return cellShapeGroup(); return 3;
} }
int drawcellShapeID() { int drawcellShapeID() {
@ -505,10 +496,7 @@ namespace mapeditor {
bool editingShape(int group, int id) { bool editingShape(int group, int id) {
if(group != mapeditor::drawcellShapeGroup()) return false; if(group != mapeditor::drawcellShapeGroup()) return false;
if(group < 3) return id == drawcellShapeID();
// todo fix this
return id == drawcellShapeID(); return id == drawcellShapeID();
// return patterns::getpatterninfo0(id).id == patterns::getpatterninfo0(drawcell).id;
} }
void editCell(const pair<cellwalker, cellwalker>& where) { void editCell(const pair<cellwalker, cellwalker>& where) {
@ -1226,11 +1214,27 @@ namespace mapeditor {
} }
int vernum; err = fscanf(f, "%x", &vernum); int vernum; err = fscanf(f, "%x", &vernum);
printf("vernum = %x\n", vernum); printf("vernum = %x\n", vernum);
if(vernum >= 0xA0A0) {
int tg, nt, wp;
fscanf(f, "%d%d%d%d\n", &tg, &nt, &wp, &patterns::subpattern_flags);
patterns::whichPattern = wp;
if(tg != geometry) { targetgeometry = eGeometry(tg); restartGame('g', 0, true); }
if(nt != nontruncated) { restartGame('7', 0, true); }
}
while(true) { while(true) {
int i, j, l, sym, rots, color, siz; int i, j, l, sym, rots, color, siz;
err = fscanf(f, "%d%d%d%d%d%x%d", &i, &j, &l, &sym, &rots, &color, &siz); err = fscanf(f, "%d%d%d%d%d%x%d", &i, &j, &l, &sym, &rots, &color, &siz);
if(i == -1 || err < 6) break; if(i == -1 || err < 6) break;
if(siz < 0 || siz > 1000) break; if(siz < 0 || siz > 1000) break;
if(i >= 4) {
if(i < 8) patterns::whichPattern = "xxxxfpzH"[i];
patterns::subpattern_flags = 0;
i = 3;
}
initShape(i, j); initShape(i, j);
usershapelayer& ds(usershapes[i][j]->d[l]); usershapelayer& ds(usershapes[i][j]->d[l]);
ds.shift = readHyperpoint(f); ds.shift = readHyperpoint(f);
@ -1259,6 +1263,8 @@ namespace mapeditor {
} }
fprintf(f, "HyperRogue saved picture\n"); fprintf(f, "HyperRogue saved picture\n");
fprintf(f, "%x\n", VERNUM_HEX); fprintf(f, "%x\n", VERNUM_HEX);
if(VERNUM_HEX >= 0xA0A0)
fprintf(f, "%d %d %d %d\n", geometry, nontruncated, patterns::whichPattern, patterns::subpattern_flags);
for(int i=0; i<USERSHAPEGROUPS; i++) for(int j=0; j<USERSHAPEIDS; j++) { for(int i=0; i<USERSHAPEGROUPS; i++) for(int j=0; j<USERSHAPEIDS; j++) {
usershape *us = usershapes[i][j]; usershape *us = usershapes[i][j];
if(!us) continue; if(!us) continue;

View File

@ -1061,7 +1061,7 @@ hpcshape
shDodeca; shDodeca;
#define USERLAYERS 32 #define USERLAYERS 32
#define USERSHAPEGROUPS 8 #define USERSHAPEGROUPS 4
#define USERSHAPEIDS 4096 #define USERSHAPEIDS 4096
struct usershapelayer { struct usershapelayer {