mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-23 21:07:17 +00:00
rogueviz:: made it compile with the changes elsewhere
This commit is contained in:
parent
3a5c342f47
commit
5a3114d279
1
hyper.h
1
hyper.h
@ -1683,6 +1683,7 @@ namespace arg {
|
|||||||
void shift();
|
void shift();
|
||||||
|
|
||||||
const string& args();
|
const string& args();
|
||||||
|
const char* argcs();
|
||||||
int argi();
|
int argi();
|
||||||
ld argf();
|
ld argf();
|
||||||
bool argis(const string& s);
|
bool argis(const string& s);
|
||||||
|
38
kohonen.cpp
38
kohonen.cpp
@ -69,8 +69,8 @@ double vnorm(kohvec& a, kohvec& b) {
|
|||||||
void sominit(int);
|
void sominit(int);
|
||||||
void uninit(int);
|
void uninit(int);
|
||||||
|
|
||||||
void loadsamples(const char *fname) {
|
void loadsamples(const string& fname) {
|
||||||
FILE *f = fopen(fname, "rt");
|
FILE *f = fopen(fname.c_str(), "rt");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
fprintf(stderr, "Could not load samples\n");
|
fprintf(stderr, "Could not load samples\n");
|
||||||
return;
|
return;
|
||||||
@ -747,9 +747,9 @@ namespace levelline {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ksave(const char *fname) {
|
void ksave(const string& fname) {
|
||||||
sominit(1);
|
sominit(1);
|
||||||
FILE *f = fopen(fname, "wt");
|
FILE *f = fopen(fname.c_str(), "wt");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
fprintf(stderr, "Could not save the network\n");
|
fprintf(stderr, "Could not save the network\n");
|
||||||
return;
|
return;
|
||||||
@ -763,10 +763,10 @@ void ksave(const char *fname) {
|
|||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void kload(const char *fname) {
|
void kload(const string& fname) {
|
||||||
sominit(1);
|
sominit(1);
|
||||||
int xcells;
|
int xcells;
|
||||||
FILE *f = fopen(fname, "rt");
|
FILE *f = fopen(fname.c_str(), "rt");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
fprintf(stderr, "Could not load the network\n");
|
fprintf(stderr, "Could not load the network\n");
|
||||||
return;
|
return;
|
||||||
@ -783,9 +783,9 @@ void kload(const char *fname) {
|
|||||||
analyze();
|
analyze();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ksavew(const char *fname) {
|
void ksavew(const string& fname) {
|
||||||
sominit(1);
|
sominit(1);
|
||||||
FILE *f = fopen(fname, "wt");
|
FILE *f = fopen(fname.c_str(), "wt");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
fprintf(stderr, "Could not save the weights\n");
|
fprintf(stderr, "Could not save the weights\n");
|
||||||
return;
|
return;
|
||||||
@ -795,9 +795,9 @@ void ksavew(const char *fname) {
|
|||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void kloadw(const char *fname) {
|
void kloadw(const string& fname) {
|
||||||
sominit(1);
|
sominit(1);
|
||||||
FILE *f = fopen(fname, "rt");
|
FILE *f = fopen(fname.c_str(), "rt");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
fprintf(stderr, "Could not load the weights\n");
|
fprintf(stderr, "Could not load the weights\n");
|
||||||
return;
|
return;
|
||||||
@ -840,7 +840,7 @@ void progress(string s) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void kclassify(const char *fname_classify) {
|
void kclassify(const string& fname_classify) {
|
||||||
|
|
||||||
sominit(1);
|
sominit(1);
|
||||||
vector<double> bdiffs(samples, 1e20);
|
vector<double> bdiffs(samples, 1e20);
|
||||||
@ -871,9 +871,9 @@ void kclassify(const char *fname_classify) {
|
|||||||
|
|
||||||
for(int s=0; s<samples; s++) net[bids[s]].samples++;
|
for(int s=0; s<samples; s++) net[bids[s]].samples++;
|
||||||
|
|
||||||
if(fname_classify != NULL) {
|
if(fname_classify != "") {
|
||||||
printf("Listing classification...\n");
|
printf("Listing classification...\n");
|
||||||
FILE *f = fopen(fname_classify, "wt");
|
FILE *f = fopen(fname_classify.c_str(), "wt");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
printf("Failed to open file\n");
|
printf("Failed to open file\n");
|
||||||
}
|
}
|
||||||
@ -886,10 +886,10 @@ void kclassify(const char *fname_classify) {
|
|||||||
coloring();
|
coloring();
|
||||||
}
|
}
|
||||||
|
|
||||||
void klistsamples(const char *fname_samples, bool best, bool colorformat) {
|
void klistsamples(const string& fname_samples, bool best, bool colorformat) {
|
||||||
if(fname_samples != NULL) {
|
if(fname_samples != "") {
|
||||||
printf("Listing samples...\n");
|
printf("Listing samples...\n");
|
||||||
FILE *f = fopen(fname_samples, "wt");
|
FILE *f = fopen(fname_samples.c_str(), "wt");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
printf("Failed to open file\n");
|
printf("Failed to open file\n");
|
||||||
}
|
}
|
||||||
@ -918,10 +918,10 @@ void klistsamples(const char *fname_samples, bool best, bool colorformat) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void neurondisttable(const char *fname) {
|
void neurondisttable(const string &name) {
|
||||||
FILE *f = fopen(fname, "wt");
|
FILE *f = fopen(fname.c_str(), "wt");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
printf("Could not open file: %s\n", fname);
|
printf("Could not open file: %s\n", fname.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int neurons = size(net);
|
int neurons = size(net);
|
||||||
|
38
rogueviz.cpp
38
rogueviz.cpp
@ -406,7 +406,7 @@ namespace tree {
|
|||||||
tol[at].epos = ++xpos;
|
tol[at].epos = ++xpos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void read(const char *fn) {
|
void read(string fn) {
|
||||||
fname = fn;
|
fname = fn;
|
||||||
init(); kind = kTree;
|
init(); kind = kTree;
|
||||||
printf("Reading the tree of life...\n");
|
printf("Reading the tree of life...\n");
|
||||||
@ -773,8 +773,8 @@ namespace sag {
|
|||||||
sag::cost);
|
sag::cost);
|
||||||
}
|
}
|
||||||
|
|
||||||
void savesnake(const char *fname) {
|
void savesnake(const string& fname) {
|
||||||
FILE *f = fopen(fname, "wt");
|
FILE *f = fopen(fname.c_str(), "wt");
|
||||||
for(int i=0; i<N; i++)
|
for(int i=0; i<N; i++)
|
||||||
fprintf(f, "%s;%d\n", vdata[i].name.c_str(), snakeid[i]);
|
fprintf(f, "%s;%d\n", vdata[i].name.c_str(), snakeid[i]);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
@ -849,7 +849,7 @@ namespace sag {
|
|||||||
|
|
||||||
ld edgepower=1, edgemul=1;
|
ld edgepower=1, edgemul=1;
|
||||||
|
|
||||||
void read(const char *fn) {
|
void read(string fn) {
|
||||||
fname = fn;
|
fname = fn;
|
||||||
init(); kind = kSAG;
|
init(); kind = kSAG;
|
||||||
temperature = 0; sagmode = sagOff;
|
temperature = 0; sagmode = sagOff;
|
||||||
@ -967,13 +967,13 @@ void activate(shmup::monster *m) {
|
|||||||
else ealpha = 1; */
|
else ealpha = 1; */
|
||||||
}
|
}
|
||||||
|
|
||||||
void storevertex(vector<GLfloat>& tab, const hyperpoint& h) {
|
void storevertex(vector<glvertex>& tab, const hyperpoint& h) {
|
||||||
for(int i=0; i<3; i++) tab.push_back(h[i]);
|
tab.push_back(glhr::pointtogl(h));
|
||||||
}
|
}
|
||||||
|
|
||||||
double linequality = .1;
|
double linequality = .1;
|
||||||
|
|
||||||
void storelineto(vector<GLfloat>& tab, const hyperpoint& h1, const hyperpoint& h2) {
|
void storelineto(vector<glvertex>& tab, const hyperpoint& h1, const hyperpoint& h2) {
|
||||||
if(intval(h1, h2) < linequality)
|
if(intval(h1, h2) < linequality)
|
||||||
storevertex(tab, h2);
|
storevertex(tab, h2);
|
||||||
else {
|
else {
|
||||||
@ -983,7 +983,7 @@ void storelineto(vector<GLfloat>& tab, const hyperpoint& h1, const hyperpoint& h
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void storeline(vector<GLfloat>& tab, const hyperpoint& h1, const hyperpoint& h2) {
|
void storeline(vector<glvertex>& tab, const hyperpoint& h1, const hyperpoint& h2) {
|
||||||
storevertex(tab, h1);
|
storevertex(tab, h1);
|
||||||
storelineto(tab, h1, h2);
|
storelineto(tab, h1, h2);
|
||||||
}
|
}
|
||||||
@ -1111,7 +1111,7 @@ void drawVertex(const transmatrix &V, cell *c, shmup::monster *m) {
|
|||||||
else
|
else
|
||||||
storeline(ei->prec, T*h1, T*h2);
|
storeline(ei->prec, T*h1, T*h2);
|
||||||
}
|
}
|
||||||
queuetable(shmup::ggmatrix(ei->orig), &ei->prec[0], size(ei->prec)/3, col, 0,
|
queuetable(shmup::ggmatrix(ei->orig), ei->prec, size(ei->prec), col, 0,
|
||||||
PPR_STRUCT0);
|
PPR_STRUCT0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1257,8 +1257,8 @@ void drawExtra() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void readcolor(const char *cfname) {
|
void readcolor(const string& cfname) {
|
||||||
FILE *f = fopen(cfname, "rt");
|
FILE *f = fopen(cfname.c_str(), "rt");
|
||||||
if(!f) { printf("color file missing\n"); exit(1); }
|
if(!f) { printf("color file missing\n"); exit(1); }
|
||||||
while(true) {
|
while(true) {
|
||||||
string lab = "";
|
string lab = "";
|
||||||
@ -1382,7 +1382,7 @@ void fixparam() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if CAP_SDL
|
#if CAP_SDL
|
||||||
void rvvideo(const char *fname) {
|
void rvvideo(const string &fname) {
|
||||||
if(kind == kCollatz) {
|
if(kind == kCollatz) {
|
||||||
pngformat = 2;
|
pngformat = 2;
|
||||||
sightrange_bonus = 3;
|
sightrange_bonus = 3;
|
||||||
@ -1513,7 +1513,7 @@ struct storydata { int s; int e; const char *text; } story[] = {
|
|||||||
conformal::movetophase();
|
conformal::movetophase();
|
||||||
|
|
||||||
char buf[500];
|
char buf[500];
|
||||||
snprintf(buf, 500, fname, i);
|
snprintf(buf, 500, fname.c_str(), i);
|
||||||
|
|
||||||
if(i == 0) drawthemap();
|
if(i == 0) drawthemap();
|
||||||
shmup::turn(100);
|
shmup::turn(100);
|
||||||
@ -1526,7 +1526,7 @@ struct storydata { int s; int e; const char *text; } story[] = {
|
|||||||
}
|
}
|
||||||
for(int i=0; i<1800; i++) {
|
for(int i=0; i<1800; i++) {
|
||||||
char buf[500];
|
char buf[500];
|
||||||
snprintf(buf, 500, fname, i);
|
snprintf(buf, 500, fname.c_str(), i);
|
||||||
shmup::pc[0]->base = currentmap->gamestart();
|
shmup::pc[0]->base = currentmap->gamestart();
|
||||||
shmup::pc[0]->at = spin(i * 2 * M_PI / (58*30.)) * xpush(1.7);
|
shmup::pc[0]->at = spin(i * 2 * M_PI / (58*30.)) * xpush(1.7);
|
||||||
if(i == 0) drawthemap();
|
if(i == 0) drawthemap();
|
||||||
@ -1546,7 +1546,7 @@ int readArgs() {
|
|||||||
// options before reading
|
// options before reading
|
||||||
if(0) ;
|
if(0) ;
|
||||||
else if(argis("-dftcolor")) {
|
else if(argis("-dftcolor")) {
|
||||||
shift(); dftcolor = strtol(args(), NULL, 16);
|
shift(); dftcolor = strtol(args().c_str(), NULL, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
// tree visualizer (e.g. Tree of Life)
|
// tree visualizer (e.g. Tree of Life)
|
||||||
@ -1615,7 +1615,7 @@ int readArgs() {
|
|||||||
else if(argis("-collatz")) {
|
else if(argis("-collatz")) {
|
||||||
PHASE(3);
|
PHASE(3);
|
||||||
using namespace collatz;
|
using namespace collatz;
|
||||||
shift(); sscanf(args(), "%lf,%lf,%lf,%lf", &s2, &p2, &s3, &p3);
|
shift(); sscanf(argcs(), "%lf,%lf,%lf,%lf", &s2, &p2, &s3, &p3);
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1623,7 +1623,7 @@ int readArgs() {
|
|||||||
PHASE(3);
|
PHASE(3);
|
||||||
ld mul = 2;
|
ld mul = 2;
|
||||||
int N = 1000;
|
int N = 1000;
|
||||||
shift(); sscanf(args(), LDF ",%d", &mul, &N);
|
shift(); sscanf(argcs(), LDF ",%d", &mul, &N);
|
||||||
spiral::place(N, mul);
|
spiral::place(N, mul);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1638,7 +1638,7 @@ int readArgs() {
|
|||||||
PHASE(3);
|
PHASE(3);
|
||||||
ld shft = 1;
|
ld shft = 1;
|
||||||
ld mul = 1;
|
ld mul = 1;
|
||||||
shift(); sscanf(args(), LDF "," LDF, &shft, &mul);
|
shift(); sscanf(argcs(), LDF "," LDF, &shft, &mul);
|
||||||
spiral::edge(shft, mul);
|
spiral::edge(shft, mul);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1646,7 +1646,7 @@ int readArgs() {
|
|||||||
PHASE(3);
|
PHASE(3);
|
||||||
ld period = 1;
|
ld period = 1;
|
||||||
ld start = 1;
|
ld start = 1;
|
||||||
shift(); sscanf(args(), LDF "," LDF, &period, &start);
|
shift(); sscanf(argcs(), LDF "," LDF, &period, &start);
|
||||||
start--;
|
start--;
|
||||||
shift();
|
shift();
|
||||||
spiral::color(start, period, parse(args()));
|
spiral::color(start, period, parse(args()));
|
||||||
|
Loading…
Reference in New Issue
Block a user