mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-04-21 10:13:14 +00:00
debug cleanup
This commit is contained in:
parent
402b6aa0ad
commit
df3e21b310
@ -768,9 +768,7 @@ void adjust_eye(hpcshape& eye, hpcshape head, ld shift_eye, ld shift_head, int q
|
||||
qtyall++;
|
||||
}
|
||||
|
||||
if(&eye == &shSkullEyes) println(hlog, "skull pos = ", pos);
|
||||
if(&eye == &shSkullEyes)
|
||||
pos = zc(eyepos) - 0.06 * SH * 0.05;
|
||||
if(&eye == &shSkullEyes) pos = zc(eyepos) - 0.06 * SH * 0.05;
|
||||
|
||||
make_ball(eye, rad, 0);
|
||||
transmatrix T = zpush(-shift_eye) * rgpushxto0(center) * zpush(pos);
|
||||
@ -832,6 +830,7 @@ void queueball(const transmatrix& V, ld rad, color_t col, eItem what) {
|
||||
|
||||
void make_3d_models() {
|
||||
if(DIM == 2) return;
|
||||
DEBBI(DF_POLY, ("make_3d_models"));
|
||||
shcenter = C0;
|
||||
|
||||
if(floor_textures) {
|
||||
@ -840,6 +839,7 @@ void make_3d_models() {
|
||||
utt.texture_id = floor_textures->renderedTexture;
|
||||
}
|
||||
|
||||
DEBB(DF_POLY, ("humanoids"));
|
||||
make_humanoid_3d(shPBody);
|
||||
make_humanoid_3d(shYeti);
|
||||
make_humanoid_3d(shFemaleBody);
|
||||
@ -854,6 +854,7 @@ void make_3d_models() {
|
||||
// shRaiderBody = shPBody;
|
||||
// shJiangShi = shPBody;
|
||||
|
||||
DEBB(DF_POLY, ("heads"));
|
||||
make_head_3d(shFemaleHair);
|
||||
make_head_3d(shPHead);
|
||||
make_head_3d(shTurban1);
|
||||
@ -879,6 +880,7 @@ void make_3d_models() {
|
||||
make_head_3d(shJiangShiCap2);
|
||||
make_head_3d(shTerraHead);
|
||||
|
||||
DEBB(DF_POLY, ("armors"));
|
||||
make_armor_3d(shKnightArmor);
|
||||
make_armor_3d(shKnightCloak, 2);
|
||||
make_armor_3d(shPrinceDress);
|
||||
@ -897,6 +899,7 @@ void make_3d_models() {
|
||||
|
||||
make_armor_3d(shHood, 2);
|
||||
|
||||
DEBB(DF_POLY, ("feet and paws"));
|
||||
make_foot_3d(shHumanFoot);
|
||||
make_foot_3d(shYetiFoot);
|
||||
make_skeletal(shSkeletalFoot, WDIM == 2 ? zc(0.5) + geom3::human_height/40 - geom3::FLOOR : 0);
|
||||
@ -906,6 +909,7 @@ void make_3d_models() {
|
||||
make_paw_3d(shDogFrontPaw, shDogFrontLeg);
|
||||
make_paw_3d(shDogRearPaw, shDogRearLeg);
|
||||
|
||||
DEBB(DF_POLY, ("revolution"));
|
||||
// make_abody_3d(shWolfBody, 0.01);
|
||||
// make_ahead_3d(shWolfHead);
|
||||
// make_ahead_3d(shFamiliarHead);
|
||||
@ -1009,6 +1013,7 @@ void make_3d_models() {
|
||||
|
||||
make_head_only();
|
||||
|
||||
DEBB(DF_POLY, ("balls"));
|
||||
make_ball(shDisk, orbsize*.2, 2);
|
||||
make_ball(shHeptaMarker, zhexf*.2, 1);
|
||||
make_ball(shSnowball, zhexf*.1, 0);
|
||||
@ -1043,6 +1048,7 @@ void make_3d_models() {
|
||||
shift_shape(shThorns, geom3::FLOOR - geom3::human_height * 1/40);
|
||||
shift_shape(shRose, geom3::FLOOR - geom3::human_height * 1/20);
|
||||
|
||||
DEBB(DF_POLY, ("slime"));
|
||||
bshape(shSlime, PPR::MONSTER_BODY);
|
||||
hyperpoint tip = xpush0(1);
|
||||
hyperpoint atip = xpush0(-1);
|
||||
@ -1066,6 +1072,7 @@ void make_3d_models() {
|
||||
shift_shape(shMagicSword, geom3::ABODY);
|
||||
shift_shape(shMagicShovel, geom3::ABODY);
|
||||
|
||||
DEBB(DF_POLY, ("eyes"));
|
||||
adjust_eye(shSlimeEyes, shSlime, geom3::FLATEYE, 0, 2, 2);
|
||||
adjust_eye(shGhostEyes, shGhost, geom3::GHOST, geom3::GHOST, 2, WDIM == 2 ? 2 : 4);
|
||||
adjust_eye(shMiniEyes, shMiniGhost, geom3::GHOST, geom3::GHOST, 2, 2);
|
||||
|
@ -714,7 +714,7 @@ void check_total_victory() {
|
||||
}
|
||||
|
||||
void achievement_victory(bool hyper) {
|
||||
DEBB(DF_STEAM, (debugfile,"achievement_victory\n"))
|
||||
DEBBI(DF_STEAM, ("achievement_victory"))
|
||||
if(offlineMode) return;
|
||||
#ifdef HAVE_ACHIEVEMENTS
|
||||
if(cheater) return;
|
||||
@ -726,7 +726,7 @@ void achievement_victory(bool hyper) {
|
||||
if(peace::on) return;
|
||||
if(tactic::on) return;
|
||||
if(chaosmode) return;
|
||||
DEBB(DF_STEAM, (debugfile,"after checks\n"))
|
||||
DEBB(DF_STEAM, ("after checks"))
|
||||
|
||||
int t = getgametime();
|
||||
|
||||
@ -777,7 +777,7 @@ void achievement_victory(bool hyper) {
|
||||
}
|
||||
}
|
||||
|
||||
DEBB(DF_STEAM, (debugfile, "uploading scores\n"))
|
||||
DEBB(DF_STEAM, ("uploading scores"))
|
||||
upload_score(ih1, t);
|
||||
upload_score(ih2, turncount);
|
||||
#endif
|
||||
|
@ -7,7 +7,6 @@ namespace hr {
|
||||
namespace arcm {
|
||||
|
||||
#if CAP_ARCM
|
||||
#define SDEBUG(x) if(debug_geometry) { x; fflush(stdout); }
|
||||
|
||||
static const int sfPH = 1;
|
||||
static const int sfLINE = 2;
|
||||
@ -42,7 +41,7 @@ int gcd(int x, int y) { return x ? gcd(y%x, x) : y < 0 ? -y : y; }
|
||||
|
||||
void archimedean_tiling::make_match(int a, int i, int b, int j) {
|
||||
if(isize(adjacent[a]) != isize(adjacent[b])) {
|
||||
SDEBUG(printf("(error here)"));
|
||||
DEBB(DF_GEOM, ("(error here)"));
|
||||
errormsg = XLAT("polygons match incorrectly");
|
||||
errors++;
|
||||
}
|
||||
@ -122,9 +121,9 @@ void archimedean_tiling::prepare() {
|
||||
for(int oi=0; oi<1; oi++) {
|
||||
int at = (i+oi)%N;
|
||||
int inv = oi;
|
||||
SDEBUG(printf("vertex ");)
|
||||
DEBB0(DF_GEOM, ("vertex "));
|
||||
for(int z=0; z<faces[i]; z++) {
|
||||
SDEBUG(printf("[%d %d] " , at, inv);)
|
||||
DEBB0(DF_GEOM, (format("[%d %d] " , at, inv)));
|
||||
adjacent[2*i+oi].emplace_back(2*N+int(inv), inv ? (2*at+2*N-2) % (2*N) : 2*at);
|
||||
if(invert[at]) inv ^= 1;
|
||||
at = adj[at];
|
||||
@ -132,7 +131,7 @@ void archimedean_tiling::prepare() {
|
||||
else at = (at+N-1) % N;
|
||||
}
|
||||
if(!inv) make_match(2*i, 0, inv ? (2*at+2*N-1) % 2*N : 2*at, 0);
|
||||
SDEBUG(printf("-> [%d %d]\n", at, inv);)
|
||||
DEBB(DF_GEOM, (format("-> [%d %d]\n", at, inv)));
|
||||
}
|
||||
}
|
||||
for(int i=0; i<N; i++) {
|
||||
@ -156,15 +155,16 @@ void archimedean_tiling::prepare() {
|
||||
}
|
||||
}
|
||||
|
||||
SDEBUG(
|
||||
for(int i=0; i<M; i++) {
|
||||
printf("adjacent %2d:", i);
|
||||
for(int j=0; j<isize(adjacent[i]); j++) {
|
||||
auto p = adjacent[i][j];
|
||||
printf(" (%d,%d)", p.first, p.second);
|
||||
if(debugflags & DF_GEOM) {
|
||||
for(int i=0; i<M; i++) {
|
||||
DEBB0(DF_GEOM, ("adjacent ", i, ":"));
|
||||
for(int j=0; j<isize(adjacent[i]); j++) {
|
||||
auto p = adjacent[i][j];
|
||||
DEBB0(DF_GEOM, (" ", p));
|
||||
}
|
||||
DEBB(DF_GEOM, ("\n"));
|
||||
}
|
||||
printf("\n");
|
||||
} )
|
||||
}
|
||||
|
||||
for(int i=0; i<M; i++) {
|
||||
for(int j=0; j<isize(adjacent[i]); j++) {
|
||||
@ -178,13 +178,13 @@ void archimedean_tiling::prepare() {
|
||||
for(int i=0; i<M; i++) {
|
||||
for(int j=0; j<isize(adjacent[i]); j++) {
|
||||
int ai = i, aj = j;
|
||||
SDEBUG( printf("triangle "); )
|
||||
DEBB0(DF_GEOM, ("triangle "));
|
||||
for(int s=0; s<3; s++) {
|
||||
SDEBUG( printf("[%d %d] ", ai, aj); fflush(stdout); )
|
||||
DEBB0(DF_GEOM, (format("[%d %d] ", ai, aj)));
|
||||
tie(ai, aj) = adjacent[ai][aj];
|
||||
aj++; if(aj >= isize(adjacent[ai])) aj = 0;
|
||||
}
|
||||
SDEBUG( printf("-> [%d %d]\n", ai, aj); )
|
||||
DEBB(DF_GEOM, (format("-> [%d %d]\n", ai, aj)));
|
||||
make_match(i, j, ai, aj);
|
||||
}
|
||||
}
|
||||
@ -234,10 +234,11 @@ void archimedean_tiling::regroup() {
|
||||
for(int i=0; i<M; i++) if(tilegroup[i] == 0) flags[i] |= sfPH;
|
||||
}
|
||||
|
||||
SDEBUG( for(int i=0; i<M; i+=(have_symmetry?1:2)) {
|
||||
printf("tiling group of %2d: [%2d]%2d+Z%2d\n", i, tilegroup[i], groupoffset[i], periods[i]);
|
||||
printf("\n");
|
||||
} )
|
||||
if(debugflags & DF_GEOM) {
|
||||
for(int i=0; i<M; i+=(have_symmetry?1:2)) {
|
||||
DEBB(DF_GEOM, (format("tiling group of %2d: [%2d]%2d+Z%2d\n", i, tilegroup[i], groupoffset[i], periods[i])));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
eGeometryClass archimedean_tiling::get_class() {
|
||||
@ -250,7 +251,7 @@ void archimedean_tiling::compute_geometry() {
|
||||
ginf[gArchimedean].cclass = get_class();
|
||||
set_flag(ginf[gArchimedean].flags, qBOUNDED, get_class() == gcSphere);
|
||||
|
||||
SDEBUG( printf("euclidean_angle_sum = %f\n", float(euclidean_angle_sum)); )
|
||||
DEBB(DF_GEOM, (format("euclidean_angle_sum = %f\n", float(euclidean_angle_sum))));
|
||||
|
||||
dynamicval<eGeometry> dv(geometry, gArchimedean);
|
||||
|
||||
@ -313,7 +314,7 @@ void archimedean_tiling::compute_geometry() {
|
||||
if(euclid) break;
|
||||
}
|
||||
|
||||
SDEBUG( printf("computed edgelength = %f\n", float(edgelength)); )
|
||||
DEBB(DF_GEOM, (format("computed edgelength = %f\n", float(edgelength))));
|
||||
|
||||
triangles.clear();
|
||||
triangles.resize(2*N+2);
|
||||
@ -334,11 +335,11 @@ void archimedean_tiling::compute_geometry() {
|
||||
// printf("total = %lf\n", double(total));
|
||||
}
|
||||
|
||||
SDEBUG( for(auto& ts: triangles) {
|
||||
printf("T");
|
||||
for(auto& t: ts) printf(" %f@%f", float(t.first), float(t.second));
|
||||
printf("\n");
|
||||
} )
|
||||
if(debugflags & DF_GEOM) for(auto& ts: triangles) {
|
||||
DEBB0(DF_GEOM, ("T"));
|
||||
for(auto& t: ts) DEBB0(DF_GEOM, (format(" %f@%f", float(t.first), float(t.second))));
|
||||
DEBB(DF_GEOM, ());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -454,7 +455,7 @@ struct hrmap_archimedean : hrmap {
|
||||
|
||||
heptagon *create_step(heptagon *h, int d) {
|
||||
|
||||
SDEBUG( printf("%p.%d ~ ?\n", h, d); )
|
||||
DEBB(DF_GEOM, (format("%p.%d ~ ?\n", h, d)));
|
||||
|
||||
heptspin hi(h, d);
|
||||
|
||||
@ -482,16 +483,15 @@ struct hrmap_archimedean : hrmap {
|
||||
if(euclid)
|
||||
alt = encodeId(pair_to_vec(int(T[0][GDIM]), int(T[1][GDIM])));
|
||||
|
||||
SDEBUG( println(hlog, "look for: ", alt, " / ", T * C0); )
|
||||
DEBB(DF_GEOM, ("look for: ", alt, " / ", T * C0));
|
||||
|
||||
for(auto& p2: altmap[alt]) if(intval(p2.second * C0, T * C0) < 1e-4) {
|
||||
SDEBUG( println(hlog, "cell found: ", p2.first); )
|
||||
DEBB(DF_GEOM, ("cell found: ", p2.first));
|
||||
for(int d2=0; d2<p2.first->degree(); d2++) {
|
||||
heptspin hs(p2.first, d2);
|
||||
auto& t2 = current.get_triangle(p2.first, d2);
|
||||
transmatrix T1 = T * spin(M_PI + t2.first);
|
||||
SDEBUG( print(hlog, "compare: ", T1 * xpush0(1)); )
|
||||
SDEBUG( println(hlog, ":: ", p2.second * xpush0(1)); )
|
||||
DEBB(DF_GEOM, ("compare: ", T1 * xpush0(1), ":: ", p2.second * xpush0(1)));
|
||||
if(intval(T1 * xpush0(1), p2.second * xpush0(1)) < 1e-4) {
|
||||
|
||||
// T1 = p2.second
|
||||
@ -510,7 +510,7 @@ struct hrmap_archimedean : hrmap {
|
||||
return h->move(d);
|
||||
}
|
||||
}
|
||||
SDEBUG( println(hlog, "but rotation not found"));
|
||||
DEBB(DF_GEOM, ("but rotation not found"));
|
||||
}
|
||||
|
||||
auto& t2 = current.get_triangle(current.get_adj(hi));
|
||||
@ -584,7 +584,7 @@ hrmap *new_map() { return new hrmap_archimedean; }
|
||||
heptagon *build_child(heptspin p, pair<int, int> adj) {
|
||||
indenter ind;
|
||||
auto h = buildHeptagon1(tailored_alloc<heptagon> (isize(current.adjacent[adj.first])), p.at, p.spin, hstate(1), 0);
|
||||
SDEBUG( printf("NEW %p.%d ~ %p.0\n", p.at, p.spin, h); )
|
||||
DEBB(DF_GEOM, (format("NEW %p.%d ~ %p.0\n", p.at, p.spin, h)));
|
||||
id_of(h) = adj.first;
|
||||
parent_index_of(h) = adj.second;
|
||||
int nei = neighbors_of(h);
|
||||
@ -628,23 +628,23 @@ void connect_digons_too(heptspin h1, heptspin h2) {
|
||||
// no need to specify archimedean_gmatrix and altmap
|
||||
hnew->c.connect(1, h2);
|
||||
h1--, h2++;
|
||||
SDEBUG( printf("OL2 %p.%d ~ %p.%d\n", h1.at, h1.spin, h2.at, h2.spin); )
|
||||
DEBB(DF_GEOM, (format("OL2 %p.%d ~ %p.%d\n", h1.at, h1.spin, h2.at, h2.spin)));
|
||||
h1.at->c.connect(h1.spin, h2);
|
||||
}
|
||||
}
|
||||
|
||||
void connectHeptagons(heptspin hi, heptspin hs) {
|
||||
SDEBUG( printf("OLD %p.%d ~ %p.%d\n", hi.at, hi.spin, hs.at, hs.spin); )
|
||||
DEBB(DF_GEOM, (format("OLD %p.%d ~ %p.%d\n", hi.at, hi.spin, hs.at, hs.spin)));
|
||||
if(hi.at->move(hi.spin) == hs.at && hi.at->c.spin(hi.spin) == hs.spin) {
|
||||
SDEBUG( printf("WARNING: already connected\n"); )
|
||||
DEBB(DF_GEOM, (format("WARNING: already connected\n")));
|
||||
return;
|
||||
}
|
||||
if(hi.peek()) {
|
||||
SDEBUG( printf("ERROR: already connected left\n"); )
|
||||
DEBB(DF_GEOM, (format("ERROR: already connected left\n")));
|
||||
exit(1);
|
||||
}
|
||||
if(hs.peek()) {
|
||||
SDEBUG( printf("ERROR: already connected right\n"); )
|
||||
DEBB(DF_GEOM, (format("ERROR: already connected right\n")));
|
||||
exit(1);
|
||||
}
|
||||
hi.at->c.connect(hi.spin, hs);
|
||||
@ -781,7 +781,7 @@ int readArgs() {
|
||||
archimedean_tiling at;
|
||||
shift(); at.parse(args());
|
||||
if(at.errors) {
|
||||
println(hlog, "error: ", at.errormsg);
|
||||
DEBB(DF_ERROR | DF_GEOM, ("error: ", at.errormsg));
|
||||
}
|
||||
else {
|
||||
set_geometry(gArchimedean);
|
||||
@ -790,7 +790,6 @@ int readArgs() {
|
||||
showstartmenu = false;
|
||||
}
|
||||
}
|
||||
else if(argis("-dgeom")) debug_geometry = true;
|
||||
else if(argis("-dual")) { PHASEFROM(2); set_variation(eVariation::dual); }
|
||||
else if(argis("-d:arcm"))
|
||||
launch_dialog(show);
|
||||
@ -1035,7 +1034,7 @@ void show() {
|
||||
archimedean_tiling tested;
|
||||
tested.parse(s);
|
||||
if(tested.errors) {
|
||||
println(hlog, "WARNING: ", tested.errors, " errors on ", s, " '", tested.errormsg, "'");
|
||||
DEBB(DF_GEOM | DF_WARN, ("WARNING: ", tested.errors, " errors on ", s, " '", tested.errormsg, "'"));
|
||||
}
|
||||
else {
|
||||
tested.coloring = col;
|
||||
|
@ -212,7 +212,7 @@ void display_data::set_all(int ed) {
|
||||
}
|
||||
|
||||
void display_data::set_projection(int ed) {
|
||||
DEBB(DF_GRAPH, (debugfile,"current_display->set_projection\n"));
|
||||
DEBBI(DF_GRAPH, ("current_display->set_projection"));
|
||||
|
||||
bool pers3 = false;
|
||||
bool apply_models = !among(pmodel, mdUnchanged, mdFlatten, mdRug);
|
||||
@ -367,7 +367,7 @@ bool model_needs_depth() {
|
||||
}
|
||||
|
||||
void setGLProjection(color_t col) {
|
||||
DEBB(DF_GRAPH, (debugfile,"setGLProjection\n"));
|
||||
DEBBI(DF_GRAPH, ("setGLProjection"));
|
||||
GLERR("pre_setGLProjection");
|
||||
|
||||
glClearColor(part(col, 2) / 255.0, part(col, 1) / 255.0, part(col, 0) / 255.0, 1);
|
||||
@ -483,7 +483,7 @@ void sdltogl(SDL_Surface *txt, glfont_t& f, int ch) {
|
||||
|
||||
void init_glfont(int size) {
|
||||
if(glfont[size]) return;
|
||||
DEBB(DF_INIT, (debugfile,"init GL font: %d\n", size));
|
||||
DEBBI(DF_GRAPH, ("init GL font: ", size));
|
||||
|
||||
#if !CAP_TABFONT
|
||||
loadfont(size);
|
||||
@ -680,7 +680,7 @@ bool gl_print(int x, int y, int shift, int size, const char *s, color_t color, i
|
||||
purehookset hooks_resetGL;
|
||||
|
||||
void resetGL() {
|
||||
DEBB(DF_INIT, (debugfile,"reset GL\n"));
|
||||
DEBBI(DF_INIT | DF_GRAPH, ("reset GL"))
|
||||
callhooks(hooks_resetGL);
|
||||
#if CAP_GLFONT
|
||||
for(int i=0; i<128; i++) if(glfont[i]) {
|
||||
@ -903,7 +903,7 @@ void addMessageToLog(msginfo& m, vector<msginfo>& log) {
|
||||
void clearMessages() { msgs.clear(); }
|
||||
|
||||
void addMessage(string s, char spamtype) {
|
||||
DEBB(DF_MSG, (debugfile,"addMessage: %s\n", s.c_str()));
|
||||
DEBB(DF_MSG, ("addMessage: ", s));
|
||||
|
||||
msginfo m;
|
||||
m.msg = s; m.spamtype = spamtype; m.flashout = false; m.stamp = ticks;
|
||||
@ -973,7 +973,7 @@ void drawmessage(const string& s, int& y, color_t col) {
|
||||
}
|
||||
|
||||
void drawmessages() {
|
||||
DEBB(DF_GRAPH, (debugfile,"draw messages\n"));
|
||||
DEBBI(DF_GRAPH, ("draw messages"));
|
||||
int i = 0;
|
||||
int t = ticks;
|
||||
for(int j=0; j<isize(msgs); j++) {
|
||||
@ -1124,7 +1124,7 @@ void disable_vsync() {
|
||||
#if CAP_SDL
|
||||
void setvideomode() {
|
||||
|
||||
DEBB(DF_INIT, (debugfile,"setvideomode\n"));
|
||||
DEBBI(DF_INIT | DF_GRAPH, ("setvideomode"));
|
||||
|
||||
if(!vid.full) {
|
||||
if(vid.xres > vid.xscr) vid.xres = vid.xscr * 9/10, setfsize = true;
|
||||
@ -1191,7 +1191,7 @@ bool noGUI = false;
|
||||
|
||||
void initgraph() {
|
||||
|
||||
DEBB(DF_INIT, (debugfile,"initgraph\n"));
|
||||
DEBBI(DF_INIT | DF_GRAPH, ("initgraph"));
|
||||
|
||||
initConfig();
|
||||
|
||||
@ -1270,7 +1270,7 @@ void initgraph() {
|
||||
}
|
||||
|
||||
void cleargraph() {
|
||||
DEBB(DF_INIT, (debugfile,"clear graph\n"));
|
||||
DEBBI(DF_INIT, ("clear graph"));
|
||||
#if CAP_SDLTTF
|
||||
for(int i=0; i<256; i++) if(font[i]) TTF_CloseFont(font[i]);
|
||||
#endif
|
||||
|
19
cell.cpp
19
cell.cpp
@ -214,7 +214,7 @@ hookset<hrmap*()> *hooks_newmap;
|
||||
|
||||
// initializer (also inits origin from heptagon.cpp)
|
||||
void initcells() {
|
||||
DEBB(DF_INIT, (debugfile,"initcells\n"));
|
||||
DEBB(DF_INIT, ("initcells"));
|
||||
|
||||
hrmap* res = callhandlers((hrmap*)nullptr, hooks_newmap);
|
||||
if(res) currentmap = res;
|
||||
@ -250,18 +250,17 @@ void initcells() {
|
||||
|
||||
void clearcell(cell *c) {
|
||||
if(!c) return;
|
||||
DEBMEM ( printf("c%d %p\n", c->type, c); )
|
||||
DEBB(DF_MEMORY, (format("c%d %p\n", c->type, c)));
|
||||
for(int t=0; t<c->type; t++) if(c->move(t)) {
|
||||
DEBMEM ( printf("mov %p [%p] S%d\n", c->move(t), c->move(t)->move(c->c.spin(t)), c->c.spin(t)); )
|
||||
DEBB(DF_MEMORY, (format("mov %p [%p] S%d\n", c->move(t), c->move(t)->move(c->c.spin(t)), c->c.spin(t))));
|
||||
if(c->move(t)->move(c->c.spin(t)) != NULL &&
|
||||
c->move(t)->move(c->c.spin(t)) != c) {
|
||||
printf("type = %d %d -> %d\n", c->type, t, c->c.spin(t));
|
||||
printf("cell error\n");
|
||||
DEBB(DF_MEMORY | DF_ERROR, (format("cell error: type = %d %d -> %d\n", c->type, t, c->c.spin(t))));
|
||||
exit(1);
|
||||
}
|
||||
c->move(t)->move(c->c.spin(t)) = NULL;
|
||||
}
|
||||
DEBMEM ( printf("DEL %p\n", c); )
|
||||
DEBB(DF_MEMORY, (format("DEL %p\n", c)));
|
||||
tailored_delete(c);
|
||||
}
|
||||
|
||||
@ -308,11 +307,11 @@ void clearfrom(heptagon *at) {
|
||||
at = q.front();
|
||||
// if(q.size() > maxq) maxq = q.size();
|
||||
q.pop();
|
||||
DEBMEM ( printf("from %p\n", at); )
|
||||
DEBB(DF_MEMORY, ("from %p", at));
|
||||
if(!at->c7) {
|
||||
heptagon *h = (heptagon*) at->cdata;
|
||||
if(h) {
|
||||
if(h->alt != at) printf("alt error :: h->alt = %p\n", h->alt);
|
||||
if(h->alt != at) { DEBB(DF_MEMORY | DF_ERROR, ("alt error :: h->alt = ", h->alt)); }
|
||||
cell *c = h->c7;
|
||||
subcell(c, destroycellcontents);
|
||||
h->alt = NULL;
|
||||
@ -326,10 +325,10 @@ void clearfrom(heptagon *at) {
|
||||
q.push(at->move(i));
|
||||
unlink_cdata(at->move(i));
|
||||
at->move(i)->alt = &deletion_marker;
|
||||
DEBMEM ( printf("!mov %p [%p]\n", at->move(i), at->move(i)->move[at->c.spin(i)]); )
|
||||
DEBB(DF_MEMORY, ("!mov ", at->move(i), " [", at->move(i)->move(at->c.spin(i)), "]"));
|
||||
if(at->move(i)->move(at->c.spin(i)) != NULL &&
|
||||
at->move(i)->move(at->c.spin(i)) != at) {
|
||||
printf("hept error\n");
|
||||
DEBB(DF_MEMORY | DF_ERROR, ("hept error"));
|
||||
exit(1);
|
||||
}
|
||||
at->move(i)->move(at->c.spin(i)) = NULL;
|
||||
|
@ -112,13 +112,15 @@ int arg::readCommon() {
|
||||
PHASE(1);
|
||||
offlineMode = true;
|
||||
}
|
||||
else if(argis("-debugf")) {
|
||||
debugfile = fopen("hyperrogue-debug.txt", "w");
|
||||
shift(); debugflags = argi();
|
||||
}
|
||||
else if(argis("-debuge")) {
|
||||
debugfile = stderr;
|
||||
shift(); debugflags = argi();
|
||||
else if(argis("-debf")) {
|
||||
shift();
|
||||
string s = args();
|
||||
for(char c: s) {
|
||||
for(int i=0; i<int(strlen(DF_KEYS)); i++) {
|
||||
if(DF_KEYS[i] == c) debugflags |= (1<<i);
|
||||
if(DF_KEYS[i] == (c ^ 32)) debugflags &= ~(1<<i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(argis("-run")) {
|
||||
PHASE(3);
|
||||
|
@ -3189,9 +3189,9 @@ auto ccm = addHook(clearmemory, 0, [] () {
|
||||
eliminate_if(heat::offscreen_fire, is_cell_removed);
|
||||
eliminate_if(princess::infos, [] (princess::info*& i) {
|
||||
if(is_cell_removed(i->princess) || is_cell_removed(i->prison)) {
|
||||
DEBSM(printf("removing a princess\n");)
|
||||
DEBB(DF_MEMORY, ("removing a princess"))
|
||||
if(i->princess && !is_cell_removed(i->princess)) {
|
||||
DEBSM(printf("faking a princess\n");)
|
||||
DEBB(DF_MEMORY, ("faking a princess"))
|
||||
princess::newFakeInfo(i->princess);
|
||||
}
|
||||
delete i;
|
||||
|
@ -527,7 +527,7 @@ void resetConfig() {
|
||||
|
||||
#if CAP_CONFIG
|
||||
void saveConfig() {
|
||||
DEBB(DF_INIT, (debugfile,"save config\n"));
|
||||
DEBB(DF_INIT, ("save config\n"));
|
||||
FILE *f = fopen(conffile, "wt");
|
||||
if(!f) {
|
||||
addMessage(s0 + "Could not open the config file: " + conffile);
|
||||
@ -599,7 +599,7 @@ void loadNewConfig(FILE *f) {
|
||||
|
||||
void loadConfig() {
|
||||
|
||||
DEBB(DF_INIT, (debugfile,"load config\n"));
|
||||
DEBB(DF_INIT, ("load config"));
|
||||
vid.xres = 9999; vid.yres = 9999; vid.framelimit = 300;
|
||||
FILE *f = fopen(conffile, "rt");
|
||||
if(f) {
|
||||
@ -616,7 +616,7 @@ void loadConfig() {
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
DEBB(DF_INIT, (debugfile,"Loaded configuration: %s\n", conffile));
|
||||
DEBB(DF_INIT, ("Loaded configuration: %s\n", conffile));
|
||||
}
|
||||
|
||||
polygonal::solve();
|
||||
|
14
control.cpp
14
control.cpp
@ -101,7 +101,7 @@ hyperpoint move_destination_vec(int d) {
|
||||
}
|
||||
|
||||
void movepckeydir(int d) {
|
||||
DEBB(DF_GRAPH, (debugfile,"movepckeydir\n"));
|
||||
DEBB(DF_GRAPH, ("movepckeydir\n"));
|
||||
// EUCLIDEAN
|
||||
|
||||
movedir md = vectodir(move_destination_vec(d));
|
||||
@ -162,7 +162,7 @@ SDL_Joystick* sticks[8];
|
||||
int numsticks;
|
||||
|
||||
void initJoysticks() {
|
||||
DEBB(DF_INIT, (debugfile,"init joysticks\n"));
|
||||
DEBB(DF_INIT, ("init joysticks"));
|
||||
numsticks = SDL_NumJoysticks();
|
||||
if(numsticks > 8) numsticks = 8;
|
||||
for(int i=0; i<numsticks; i++) {
|
||||
@ -177,7 +177,7 @@ void initJoysticks() {
|
||||
}
|
||||
|
||||
void closeJoysticks() {
|
||||
DEBB(DF_INIT, (debugfile,"close joysticks\n"));
|
||||
DEBB(DF_INIT, ("close joysticks"));
|
||||
for(int i=0; i<numsticks; i++) {
|
||||
SDL_JoystickClose(sticks[i]), sticks[i] = NULL;
|
||||
}
|
||||
@ -185,7 +185,7 @@ void closeJoysticks() {
|
||||
}
|
||||
|
||||
void checkjoy() {
|
||||
DEBB(DF_GRAPH, (debugfile,"check joy\n"));
|
||||
DEBB(DF_GRAPH, ("check joy"));
|
||||
if(!DEFAULTCONTROL) return;
|
||||
ld joyvalue1 = sqr(vid.joyvalue);
|
||||
ld joyvalue2 = sqr(vid.joyvalue2);
|
||||
@ -513,7 +513,7 @@ ld mouseaim_sensitivity = 0.01;
|
||||
|
||||
void mainloopiter() {
|
||||
|
||||
DEBB(DF_GRAPH, (debugfile,"main loop\n"));
|
||||
DEBB(DF_GRAPH, ("main loop\n"));
|
||||
|
||||
#if !CAP_SDLGFX && !CAP_GL
|
||||
vid.wallmode = 0;
|
||||
@ -614,7 +614,7 @@ void mainloopiter() {
|
||||
if(audio) handlemusic();
|
||||
#endif
|
||||
SDL_Event ev;
|
||||
DEBB(DF_GRAPH, (debugfile,"polling for events\n"));
|
||||
DEBB(DF_GRAPH, ("polling for events\n"));
|
||||
|
||||
if(DIM == 3 && !shmup::on && !rug::rugged) {
|
||||
View = cspin(0, 2, -mouseaim_x) * cspin(1, 2, -mouseaim_y) * View;
|
||||
@ -661,7 +661,7 @@ void handle_event(SDL_Event& ev) {
|
||||
bool normal = cmode & sm::NORMAL;
|
||||
Uint8 *keystate = SDL_GetKeyState(NULL);
|
||||
|
||||
DEBB(DF_GRAPH, (debugfile,"got event type #%d\n", ev.type));
|
||||
DEBB(DF_GRAPH, ("got event type #%d\n", ev.type));
|
||||
int sym = 0;
|
||||
int uni = 0;
|
||||
shiftmul = 1;
|
||||
|
@ -1160,7 +1160,7 @@ ld matrixnorm(const transmatrix& Mat) {
|
||||
}
|
||||
|
||||
void hrmap_euclid_any::draw() {
|
||||
DEBB(DF_GRAPH, (debugfile,"drawEuclidean\n"));
|
||||
DEBB(DF_GRAPH, ("drawEuclidean\n"));
|
||||
sphereflip = Id;
|
||||
if(!centerover.at) centerover = cwt;
|
||||
// printf("centerover = %p player = %p [%d,%d]-[%d,%d]\n", lcenterover, cwt.c,
|
||||
|
@ -329,10 +329,10 @@ struct fpattern {
|
||||
connections.push_back(matcode[PM]);
|
||||
}
|
||||
|
||||
DEBB(DF_FIELD, (debugfile, "Computing inverses...\n"));
|
||||
DEBB(DF_FIELD, ("Computing inverses...\n"));
|
||||
int N = isize(matrices);
|
||||
|
||||
DEBB(DF_FIELD, (debugfile, "Number of heptagons: %d\n", N));
|
||||
DEBB(DF_FIELD, ("Number of heptagons: %d\n", N));
|
||||
|
||||
if(WDIM == 3) return;
|
||||
|
||||
@ -361,7 +361,7 @@ struct fpattern {
|
||||
if(i%S7 == S7-1) printf("\n");
|
||||
}
|
||||
|
||||
DEBB(DF_FIELD, (debugfile, "Built.\n"));
|
||||
DEBB(DF_FIELD, ("Built.\n"));
|
||||
}
|
||||
|
||||
static const int MAXDIST = 120;
|
||||
@ -427,7 +427,7 @@ struct fpattern {
|
||||
|
||||
if(WDIM == 3) return;
|
||||
|
||||
DEBB(DF_FIELD, (debugfile, "variation = %d\n", int(variation)));
|
||||
DEBB(DF_FIELD, ("variation = %d\n", int(variation)));
|
||||
int N = connections.size();
|
||||
|
||||
markers.resize(N);
|
||||
@ -473,7 +473,7 @@ struct fpattern {
|
||||
if(disthep[connections[i]] < disthep[i] && disthep[connections[btspin(i,u)]] < disthep[i])
|
||||
circrad = disthep[i];
|
||||
|
||||
DEBB(DF_FIELD, (debugfile, "maxdist = %d otherpole = %d circrad = %d\n", maxdist, otherpole, circrad));
|
||||
DEBB(DF_FIELD, ("maxdist = %d otherpole = %d circrad = %d\n", maxdist, otherpole, circrad));
|
||||
|
||||
matrix PRRR = strtomatrix("PRRR");
|
||||
matrix PRRPRRRRR = strtomatrix("PRRPRRRRR");
|
||||
@ -485,7 +485,7 @@ struct fpattern {
|
||||
wallorder = order(Wall);
|
||||
wallid = matcode[Wall];
|
||||
|
||||
DEBB(DF_FIELD, (debugfile, "wall order = %d\n", wallorder));
|
||||
DEBB(DF_FIELD, ("wall order = %d\n", wallorder));
|
||||
|
||||
#define SETDIST(X, d, it) {int c = matcode[X]; indist[d].push_back(c); if(it == itNone) ; else if(markers[c] && markers[c] != it) markers[c] = itBuggy; else markers[c] = it; }
|
||||
|
||||
@ -501,7 +501,7 @@ struct fpattern {
|
||||
}
|
||||
|
||||
int walldist = dijkstra(distwall, indist);
|
||||
DEBB(DF_FIELD, (debugfile, "wall dist = %d\n", walldist));
|
||||
DEBB(DF_FIELD, ("wall dist = %d\n", walldist));
|
||||
|
||||
|
||||
W = strtomatrix("RRRRPR");
|
||||
@ -523,7 +523,7 @@ struct fpattern {
|
||||
int ipush = gmul(rpushid, i);
|
||||
for(int k=0; k<wallorder; k++) {
|
||||
if(ipush == j) {
|
||||
DEBB(DF_FIELD, (debugfile, "River found at %d:%d\n", i, k));
|
||||
DEBB(DF_FIELD, ("River found at %d:%d\n", i, k));
|
||||
riverid = i;
|
||||
goto riveridfound;
|
||||
}
|
||||
@ -565,7 +565,7 @@ struct fpattern {
|
||||
W = mmul(W, Wall);
|
||||
}
|
||||
int riverdist = dijkstra(PURE ? distflower : distriver, indist);
|
||||
DEBB(DF_FIELD, (debugfile, "river dist = %d\n", riverdist));
|
||||
DEBB(DF_FIELD, ("river dist = %d\n", riverdist));
|
||||
|
||||
for(int i=0; i<isize(currfp.matrices); i++)
|
||||
if(currfp.distflower[i] == 0) {
|
||||
@ -628,8 +628,8 @@ struct fpattern {
|
||||
dijkstra(distriverright, indist);
|
||||
}
|
||||
|
||||
DEBB(DF_FIELD, (debugfile, "wall-river distance = %d\n", distwall[riverid]));
|
||||
DEBB(DF_FIELD, (debugfile, "river-wall distance = %d\n", distriver[0]));
|
||||
DEBB(DF_FIELD, ("wall-river distance = %d\n", distwall[riverid]));
|
||||
DEBB(DF_FIELD, ("river-wall distance = %d\n", distriver[0]));
|
||||
}
|
||||
|
||||
bool easy(int i) {
|
||||
@ -660,7 +660,7 @@ struct fpattern {
|
||||
if(gpow(i, Prime) == 0) {
|
||||
subpathid = i;
|
||||
subpathorder = Prime;
|
||||
DEBB(DF_FIELD, (debugfile, "Subpath found: %s\n", decodepath(i).c_str()));
|
||||
DEBB(DF_FIELD, ("Subpath found: %s\n", decodepath(i).c_str()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -273,6 +273,7 @@ template<class T> void sizeto(T& t, int n) {
|
||||
// !siid equals pseudohept(c)
|
||||
|
||||
void generate_floorshapes_for(int id, cell *c, int siid, int sidir) {
|
||||
DEBBI(DF_POLY, ("generate_floorshapes_for ", id));
|
||||
|
||||
for(auto pfsh: all_plain_floorshapes) {
|
||||
auto& fsh = *pfsh;
|
||||
@ -565,11 +566,12 @@ void generate_floorshapes_for(int id, cell *c, int siid, int sidir) {
|
||||
|
||||
void generate_floorshapes() {
|
||||
|
||||
DEBBI(DF_POLY, ("generate_floorshapes"));
|
||||
if(WDIM == 3) ;
|
||||
|
||||
#if CAP_IRR
|
||||
else if(IRREGULAR) {
|
||||
printf("generating irregular floorshapes...\n");
|
||||
DEBBI(DF_POLY, ("generate_floorshapes: irregular"));
|
||||
cell model;
|
||||
|
||||
int cc = isize(irr::cells);
|
||||
@ -640,8 +642,7 @@ namespace gp {
|
||||
bool master = !(li.relative.first||li.relative.second);
|
||||
int cor = master ? S7 : SG6;
|
||||
if(master) li.last_dir = -1;
|
||||
if(debug_geometry)
|
||||
printf("last=%d at=%d,%d tot=%d siid=%d sidir=%d cor=%d id=%d\n", li.last_dir, li.relative.first, li.relative.second, li.total_dir, siid, sidir, cor, id);
|
||||
DEBB(DF_GP, (format("last=%d at=%d,%d tot=%d siid=%d sidir=%d cor=%d id=%d\n", li.last_dir, li.relative.first, li.relative.second, li.total_dir, siid, sidir, cor, id)));
|
||||
|
||||
generate_floorshapes_for(id, c0, siid, sidir);
|
||||
|
||||
@ -870,6 +871,7 @@ const int FLOORTEXTURESIZE = 4096;
|
||||
|
||||
void make_floor_textures() {
|
||||
if(1) {
|
||||
DEBBI(DF_POLY, ("make_floor_textures"));
|
||||
dynamicval<eGeometry> g(geometry, gEuclidSquare);
|
||||
dynamicval<eModel> gm(pmodel, mdDisk);
|
||||
dynamicval<eVariation> va(variation, eVariation::pure);
|
||||
|
92
game.cpp
92
game.cpp
@ -93,10 +93,6 @@ int currentLocalTreasure;
|
||||
|
||||
bool landvisited[landtypes];
|
||||
|
||||
extern void DEBT(const char *buf);
|
||||
|
||||
#define DEBT(x) DEBB(DF_TURN, (debugfile,"%s\n", x))
|
||||
|
||||
bool eq(short a, short b) { return a==b; }
|
||||
|
||||
// game state
|
||||
@ -2063,7 +2059,7 @@ void killMutantIvy(cell *c, eMonster who) {
|
||||
|
||||
void killMonster(cell *c, eMonster who, flagtype deathflags) {
|
||||
eMonster m = c->monst;
|
||||
DEBB(DF_TURN, (debugfile,"killmonster %s", dnameof(m)));
|
||||
DEBBI(DF_TURN, ("killmonster ", dnameof(m)));
|
||||
|
||||
if(!m) return;
|
||||
|
||||
@ -5513,10 +5509,10 @@ void movegolems(flagtype flags) {
|
||||
bool recorduse[ittypes];
|
||||
for(int i=0; i<ittypes; i++) recorduse[i] = orbused[i];
|
||||
|
||||
DEBT("stayval");
|
||||
DEBB(DF_TURN, ("stayval"));
|
||||
int bestv = stayvalue(m, c), bq = 0, bdirs[MAX_EDGE];
|
||||
|
||||
DEBT("moveval");
|
||||
DEBB(DF_TURN, ("moveval"));
|
||||
for(int k=0; k<c->type; k++) if(c->move(k)) {
|
||||
cell *c2 = c->move(k);
|
||||
int val = movevalue(m, c, c2, flags);
|
||||
@ -5565,7 +5561,7 @@ void movegolems(flagtype flags) {
|
||||
}
|
||||
else {
|
||||
passable_for(m, c2, c, P_DEADLY);
|
||||
DEBT("move");
|
||||
DEBB(DF_TURN, ("move"));
|
||||
moveMonster(c2, c, dir);
|
||||
if(m != moTameBomberbird && m != moFriendlyGhost)
|
||||
moveBoatIfUsingOne(c2, c, dir);
|
||||
@ -5582,7 +5578,7 @@ void movegolems(flagtype flags) {
|
||||
|
||||
empathyMove(c, c2, dir);
|
||||
}
|
||||
DEBT("other");
|
||||
DEBB(DF_TURN, ("other"));
|
||||
}
|
||||
}
|
||||
achievement_count("GOLEM", qg, 0);
|
||||
@ -6122,7 +6118,7 @@ void movehex_all() {
|
||||
void movemonsters() {
|
||||
ambush_distance = 0;
|
||||
|
||||
DEBT("lava1");
|
||||
DEBB(DF_TURN, ("lava1"));
|
||||
orboflava(1);
|
||||
|
||||
checkAmbushState();
|
||||
@ -6132,70 +6128,70 @@ void movemonsters() {
|
||||
|
||||
specialMoves();
|
||||
|
||||
DEBT("ghosts");
|
||||
DEBB(DF_TURN, ("ghosts"));
|
||||
moveghosts();
|
||||
|
||||
DEBT("butterflies");
|
||||
DEBB(DF_TURN, ("butterflies"));
|
||||
moveButterflies();
|
||||
|
||||
DEBT("normal");
|
||||
DEBB(DF_TURN, ("normal"));
|
||||
moveNormals(moYeti);
|
||||
|
||||
DEBT("slow");
|
||||
DEBB(DF_TURN, ("slow"));
|
||||
if(havewhat & HF_SLOW) moveNormals(moTortoise);
|
||||
|
||||
if(sagefresh) sagephase = 0;
|
||||
|
||||
DEBT("ivy");
|
||||
DEBB(DF_TURN, ("ivy"));
|
||||
moveivy();
|
||||
DEBT("slimes");
|
||||
DEBB(DF_TURN, ("slimes"));
|
||||
groupmove(moSlime, 0);
|
||||
DEBT("sharks");
|
||||
DEBB(DF_TURN, ("sharks"));
|
||||
if(havewhat & HF_SHARK) groupmove(moShark, 0);
|
||||
DEBT("eagles");
|
||||
DEBB(DF_TURN, ("eagles"));
|
||||
if(havewhat & HF_BIRD) groupmove(moEagle, 0);
|
||||
if(havewhat & HF_EAGLES) groupmove(moEagle, MF_NOATTACKS | MF_ONLYEAGLE);
|
||||
DEBT("eagles");
|
||||
DEBB(DF_TURN, ("eagles"));
|
||||
if(havewhat & HF_REPTILE) groupmove(moReptile, 0);
|
||||
DEBT("air");
|
||||
DEBB(DF_TURN, ("air"));
|
||||
if(havewhat & HF_AIR) {
|
||||
airmap.clear();
|
||||
groupmove(moAirElemental, 0);
|
||||
buildAirmap();
|
||||
}
|
||||
DEBT("earth");
|
||||
DEBB(DF_TURN, ("earth"));
|
||||
if(havewhat & HF_EARTH) groupmove(moEarthElemental, 0);
|
||||
DEBT("water");
|
||||
DEBB(DF_TURN, ("water"));
|
||||
if(havewhat & HF_WATER) groupmove(moWaterElemental, 0);
|
||||
DEBT("void");
|
||||
DEBB(DF_TURN, ("void"));
|
||||
if(havewhat & HF_VOID) groupmove(moVoidBeast, 0);
|
||||
DEBT("leader");
|
||||
DEBB(DF_TURN, ("leader"));
|
||||
if(havewhat & HF_LEADER) groupmove(moPirate, 0);
|
||||
DEBT("mutant");
|
||||
DEBB(DF_TURN, ("mutant"));
|
||||
if((havewhat & HF_MUTANT) || (bounded && among(specialland, laOvergrown, laClearing))) movemutant();
|
||||
DEBT("bugs");
|
||||
DEBB(DF_TURN, ("bugs"));
|
||||
if(havewhat & HF_BUG) hive::movebugs();
|
||||
DEBT("whirlpool");
|
||||
DEBB(DF_TURN, ("whirlpool"));
|
||||
if(havewhat & HF_WHIRLPOOL) whirlpool::move();
|
||||
DEBT("whirlwind");
|
||||
DEBB(DF_TURN, ("whirlwind"));
|
||||
if(havewhat & HF_WHIRLWIND) whirlwind::move();
|
||||
#if CAP_COMPLEX2
|
||||
DEBT("westwall");
|
||||
DEBB(DF_TURN, ("westwall"));
|
||||
if(havewhat & HF_WESTWALL) westwall::move();
|
||||
#endif
|
||||
for(int i=0; i<numplayers(); i++) if(playerpos(i)->item == itOrbSafety) return;
|
||||
DEBT("river");
|
||||
DEBB(DF_TURN, ("river"));
|
||||
if(havewhat & HF_RIVER) prairie::move();
|
||||
/* DEBT("magnet");
|
||||
/* DEBB(DF_TURN, ("magnet"));
|
||||
if(havewhat & HF_MAGNET)
|
||||
groupmove(moSouthPole, 0),
|
||||
groupmove(moNorthPole, 0); */
|
||||
DEBT("bugs");
|
||||
DEBB(DF_TURN, ("bugs"));
|
||||
if(havewhat & HF_HEXD) groupmove(moHexDemon, 0);
|
||||
if(havewhat & HF_ALT) groupmove(moAltDemon, 0);
|
||||
if(havewhat & HF_MONK) groupmove(moMonk, 0);
|
||||
|
||||
DEBT("worm");
|
||||
DEBB(DF_TURN, ("worm"));
|
||||
cell *savepos[MAXPLAYER];
|
||||
|
||||
for(int i=0; i<numplayers(); i++)
|
||||
@ -6209,22 +6205,22 @@ void movemonsters() {
|
||||
if(havewhat & HF_DRAGON) groupmove(moDragonHead, MF_NOFRIEND);
|
||||
if(haveMount()) groupmove(moDragonHead, MF_MOUNT);
|
||||
|
||||
DEBT("golems");
|
||||
DEBB(DF_TURN, ("golems"));
|
||||
movegolems(0);
|
||||
|
||||
DEBT("fresh");
|
||||
DEBB(DF_TURN, ("fresh"));
|
||||
moverefresh();
|
||||
|
||||
DEBT("lava2");
|
||||
DEBB(DF_TURN, ("lava2"));
|
||||
orboflava(2);
|
||||
|
||||
DEBT("shadow");
|
||||
DEBB(DF_TURN, ("shadow"));
|
||||
moveshadow();
|
||||
|
||||
DEBT("wandering");
|
||||
DEBB(DF_TURN, ("wandering"));
|
||||
wandering();
|
||||
|
||||
DEBT("rosemap");
|
||||
DEBB(DF_TURN, ("rosemap"));
|
||||
if(havewhat & HF_ROSE) buildRosemap();
|
||||
|
||||
for(int i=0; i<numplayers(); i++)
|
||||
@ -7551,11 +7547,11 @@ void checkSwitch() {
|
||||
void monstersTurn() {
|
||||
checkSwitch();
|
||||
mirror::breakAll();
|
||||
DEBT("bfs");
|
||||
DEBB(DF_TURN, ("bfs"));
|
||||
bfs();
|
||||
DEBT("charge");
|
||||
DEBB(DF_TURN, ("charge"));
|
||||
if(elec::havecharge) elec::act();
|
||||
DEBT("mmo");
|
||||
DEBB(DF_TURN, ("mmo"));
|
||||
int phase2 = (1 & items[itOrbSpeed]);
|
||||
if(!phase2) movemonsters();
|
||||
for(int i=0; i<numplayers(); i++) if(playerpos(i)->item == itOrbSafety) {
|
||||
@ -7575,10 +7571,10 @@ void monstersTurn() {
|
||||
refreshFriend(dcal[i]);
|
||||
}
|
||||
}
|
||||
DEBT("rop");
|
||||
DEBB(DF_TURN, ("rop"));
|
||||
reduceOrbPowers();
|
||||
int phase1 = (1 & items[itOrbSpeed]);
|
||||
DEBT("lc");
|
||||
DEBB(DF_TURN, ("lc"));
|
||||
if(!phase1) livecaves();
|
||||
if(!phase1) ca::simulate();
|
||||
if(!phase1) heat::processfires();
|
||||
@ -7596,7 +7592,7 @@ void monstersTurn() {
|
||||
crush_now = move(crush_next);
|
||||
crush_next.clear();
|
||||
|
||||
DEBT("heat");
|
||||
DEBB(DF_TURN, ("heat"));
|
||||
heat::processheat();
|
||||
// if(elec::havecharge) elec::drawcharges();
|
||||
|
||||
@ -7609,7 +7605,7 @@ void monstersTurn() {
|
||||
if(multi::playerActive(i))
|
||||
checkFreedom(playerpos(i));
|
||||
|
||||
DEBT("check");
|
||||
DEBB(DF_TURN, ("check"));
|
||||
checkmove();
|
||||
if(canmove) elec::checklightningfast();
|
||||
|
||||
@ -7797,7 +7793,7 @@ bool movepcto(int d, int subdir, bool checkonly) {
|
||||
flipplayer = false;
|
||||
if(multi::players > 1) multi::flipped[multi::cpid] = false;
|
||||
}
|
||||
if(!checkonly) { DEBB(DF_TURN, (debugfile,"movepc\n")); }
|
||||
DEBBI(checkonly ? 0 : DF_TURN, ("movepc"));
|
||||
int origd = d;
|
||||
if(d >= 0) {
|
||||
cwt += d;
|
||||
@ -8390,7 +8386,7 @@ bool movepcto(int d, int subdir, bool checkonly) {
|
||||
achievement_gain("SEVENMINE");
|
||||
}
|
||||
|
||||
DEBT("done");
|
||||
DEBB(DF_TURN, ("done"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
11
geometry.cpp
11
geometry.cpp
@ -5,8 +5,6 @@
|
||||
|
||||
namespace hr {
|
||||
|
||||
bool debug_geometry = false;
|
||||
|
||||
ld tessf, crossf, hexf, hcrossf, hexhexdist, hexvdist, hepvdist, rhexf;
|
||||
|
||||
// tessf: distance from heptagon center to another heptagon center
|
||||
@ -44,7 +42,7 @@ ld scalefactor, orbsize, floorrad0, floorrad1, zhexf;
|
||||
|
||||
void precalc() {
|
||||
|
||||
DEBB(DF_INIT, (debugfile,"precalc\n"));
|
||||
DEBBI(DF_INIT | DF_POLY | DF_GEOM, ("precalc"));
|
||||
|
||||
hexshift = 0;
|
||||
|
||||
@ -140,9 +138,9 @@ void precalc() {
|
||||
|
||||
hexvdist = hdist(xpush0(hexf), xspinpush0(ALPHA/2, hcrossf));
|
||||
|
||||
if(debug_geometry)
|
||||
printf("S7=%d S6=%d hexf = " LDF" hcross = " LDF" tessf = " LDF" hexshift = " LDF " hexhex = " LDF " hexv = " LDF "\n", S7, S6, hexf, hcrossf, tessf, hexshift,
|
||||
hexhexdist, hexvdist);
|
||||
DEBB(DF_GEOM | DF_POLY,
|
||||
(format("S7=%d S6=%d hexf = " LDF" hcross = " LDF" tessf = " LDF" hexshift = " LDF " hexhex = " LDF " hexv = " LDF "\n", S7, S6, hexf, hcrossf, tessf, hexshift,
|
||||
hexhexdist, hexvdist)));
|
||||
|
||||
base_distlimit = ginf[geometry].distlimit[!BITRUNCATED];
|
||||
|
||||
@ -282,6 +280,7 @@ namespace geom3 {
|
||||
}
|
||||
|
||||
void compute() {
|
||||
DEBBI(DF_INIT | DF_POLY | DF_GEOM, ("geom3::compute"));
|
||||
// tanh(depth) / tanh(camera) == vid.alpha
|
||||
invalid = "";
|
||||
|
||||
|
45
goldberg.cpp
45
goldberg.cpp
@ -58,8 +58,6 @@ namespace hr { namespace gp {
|
||||
|
||||
int fixg6(int x) { return (x + MODFIXER) % SG6; }
|
||||
|
||||
#define WHD(x) // x
|
||||
|
||||
int get_code(const local_info& li) {
|
||||
return
|
||||
((li.relative.first & 15) << 0) +
|
||||
@ -158,7 +156,7 @@ namespace hr { namespace gp {
|
||||
if(peek(wcw)) {
|
||||
auto wcw1 = get_localwalk(wc1, dir1);
|
||||
if(wcw + wstep != wcw1) {
|
||||
WHD( println(hlog, at1, " : ", (wcw+wstep), " / ", wcw1, " (pull error from ", at, " :: ", wcw, ")") );
|
||||
DEBB(DF_GP, (at1, " : ", (wcw+wstep), " / ", wcw1, " (pull error from ", at, " :: ", wcw, ")") );
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@ -166,7 +164,7 @@ namespace hr { namespace gp {
|
||||
}
|
||||
if(peek(wcw)) {
|
||||
set_localwalk(wc1, dir1, wcw + wstep);
|
||||
WHD( println(hlog, at1, " :", wcw+wstep, " (pulled from ", at, " :: ", wcw, ")"));
|
||||
DEBB(DF_GP, (at1, " :", wcw+wstep, " (pulled from ", at, " :: ", wcw, ")"));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -176,12 +174,12 @@ namespace hr { namespace gp {
|
||||
auto& wc = get_mapping(at);
|
||||
auto wcw = get_localwalk(wc, dir);
|
||||
auto& wc1 = get_mapping(at + eudir(dir));
|
||||
WHD( print(hlog, format(" md:%02d s:%d", wc.mindir, wc.cw.spin)); )
|
||||
WHD( print(hlog, " connection ", at, "/", dir, " ", wc.cw+dir, "=", wcw, " ~ ", at+eudir(dir), "/", dir1); )
|
||||
DEBB0(DF_GP, (format(" md:%02d s:%d", wc.mindir, wc.cw.spin)); )
|
||||
DEBB0(DF_GP, (" connection ", at, "/", dir, " ", wc.cw+dir, "=", wcw, " ~ ", at+eudir(dir), "/", dir1); )
|
||||
if(!wc1.cw.at) {
|
||||
wc1.start = wc.start;
|
||||
if(peek(wcw)) {
|
||||
WHD( print(hlog, "(pulled) "); )
|
||||
DEBB0(DF_GP, ("(pulled) "); )
|
||||
set_localwalk(wc1, dir1, wcw + wstep);
|
||||
}
|
||||
else {
|
||||
@ -189,25 +187,25 @@ namespace hr { namespace gp {
|
||||
wcw.at->c.setspin(wcw.spin, 0, false);
|
||||
set_localwalk(wc1, dir1, wcw + wstep);
|
||||
spawn++;
|
||||
WHD( print(hlog, "(created) "); )
|
||||
DEBB0(DF_GP, ("(created) "); )
|
||||
}
|
||||
}
|
||||
WHD( Xprintf("%s ", dcw(wc1.cw+dir1)); )
|
||||
DEBB0(DF_GP, (wc1.cw+dir1, " "));
|
||||
auto wcw1 = get_localwalk(wc1, dir1);
|
||||
if(peek(wcw)) {
|
||||
if(wcw+wstep != wcw1) {
|
||||
WHD( println(hlog, "FAIL: ", wcw, " / ", wcw1); exit(1); )
|
||||
DEBB(DF_GP, ("FAIL: ", wcw, " / ", wcw1); exit(1); )
|
||||
}
|
||||
else {
|
||||
WHD( println(hlog, "(was there)\n");)
|
||||
DEBB(DF_GP, ("(was there)"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
WHD(Xprintf("ok\n"); )
|
||||
DEBB(DF_GP, ("ok"));
|
||||
peek(wcw) = wcw1.at;
|
||||
wcw.at->c.setspin(wcw.spin, wcw1.spin, wcw.mirrored != wcw1.mirrored);
|
||||
if(wcw+wstep != wcw1) {
|
||||
println(hlog, "assertion failed");
|
||||
DEBB(DF_GP | DF_ERROR, ("assertion failed"));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@ -222,15 +220,15 @@ namespace hr { namespace gp {
|
||||
auto& ac0 = get_mapping(at);
|
||||
ac0.cw = cellwalker(hs.at->c7, hs.spin, hs.mirrored);
|
||||
ac0.start = at;
|
||||
WHD( println(hlog, at, " : ", dcw(ac0.cw)); )
|
||||
DEBB(DF_GP, (at, " : ", ac0.cw));
|
||||
return ac0;
|
||||
}
|
||||
|
||||
void extend_map(cell *c, int d) {
|
||||
WHD( Xprintf("EXTEND %p %d\n", c, d); )
|
||||
DEBB(DF_GP, ("EXTEND ",c, " ", d));
|
||||
if(c->master->c7 != c) {
|
||||
while(c->master->c7 != c) {
|
||||
WHD( println(hlog, c, " direction 0 corresponds to ", c->move(0), " direction ", c->c.spinm(0)); )
|
||||
DEBB(DF_GP, (c, " direction 0 corresponds to ", c->move(0), " direction ", c->c.spin(0)); )
|
||||
d = c->c.spin(0);
|
||||
c = c->move(0);
|
||||
}
|
||||
@ -316,11 +314,11 @@ namespace hr { namespace gp {
|
||||
for(int i=0; i<S3; i++) {
|
||||
loc start = vc[i];
|
||||
loc end = vc[(i+1)%S3];
|
||||
WHD( println(hlog, "from ", start, " to ", end); )
|
||||
DEBB(DF_GP, ("from ", start, " to ", end); )
|
||||
loc rel = param;
|
||||
auto build = [&] (loc& at, int dx, bool forward) {
|
||||
int dx1 = dx + SG2*i;
|
||||
WHD( println(make_pair(hlog, at), " .. ", make_pair(at + eudir(dx1), fixg6(dx1+SG3))); )
|
||||
DEBB(DF_GP, (at, " .. ", make_pair(at + eudir(dx1), fixg6(dx1+SG3))));
|
||||
conn(at, dx1);
|
||||
if(forward) get_mapping(at).rdir = fixg6(dx1);
|
||||
else get_mapping(at+eudir(dx1)).rdir = fixg6(dx1+SG3);
|
||||
@ -364,19 +362,19 @@ namespace hr { namespace gp {
|
||||
for(int k=0; k<SG6; k++)
|
||||
if(start + eudir(k+SG2*i) == end)
|
||||
build(start, k, true);
|
||||
if(start != end) { println(hlog, "assertion failed: start ", start, " == end ", end); exit(1); }
|
||||
if(start != end) { DEBB(DF_GP | DF_ERROR, ("assertion failed: start ", start, " == end ", end)); exit(1); }
|
||||
}
|
||||
|
||||
// now we can fill the interior of our big equilateral triangle
|
||||
loc at = vc[0];
|
||||
int maxstep = 3000;
|
||||
while(true) {
|
||||
maxstep--; if(maxstep < 0) { printf("maxstep exceeded\n"); exit(1); }
|
||||
maxstep--; if(maxstep < 0) { DEBB(DF_GP | DF_ERROR, ("maxstep exceeded")); exit(1); }
|
||||
auto& wc = get_mapping(at);
|
||||
int dx = wc.rdir;
|
||||
auto at1 = at + eudir(dx);
|
||||
auto& wc1 = get_mapping(at1);
|
||||
WHD( println(make_pair(at, dx), " ", make_pair(at1, wc1.rdir)); )
|
||||
DEBB(DF_GP, (make_pair(at, dx), " ", make_pair(at1, wc1.rdir)));
|
||||
int df = wc1.rdir - dx;
|
||||
if(df < 0) df += SG6;
|
||||
if(df == SG3) break;
|
||||
@ -450,7 +448,7 @@ namespace hr { namespace gp {
|
||||
}
|
||||
}
|
||||
|
||||
WHD( println(hlog, "DONE"); println(hlog); )
|
||||
DEBB(DF_GP, ("DONE"))
|
||||
}
|
||||
|
||||
hyperpoint loctoh_ort(loc at) {
|
||||
@ -583,8 +581,7 @@ namespace hr { namespace gp {
|
||||
if(base_distlimit > SEE_ALL)
|
||||
base_distlimit = SEE_ALL;
|
||||
prepare_matrices();
|
||||
if(debug_geometry)
|
||||
println(hlog, "scale = ", scale);
|
||||
DEBB(DF_GEOM | DF_POLY, ("scale = ", scale));
|
||||
}
|
||||
else {
|
||||
alpha = 0;
|
||||
|
21
graph.cpp
21
graph.cpp
@ -6423,6 +6423,8 @@ void precise_mouseover() {
|
||||
}
|
||||
|
||||
void drawthemap() {
|
||||
DEBBI(DF_GRAPH, ("draw the map"));
|
||||
|
||||
last_firelimit = firelimit;
|
||||
firelimit = 0;
|
||||
|
||||
@ -6468,8 +6470,6 @@ void drawthemap() {
|
||||
if(!spatial_graphics) wmspatial = mmspatial = false;
|
||||
if(DIM == 3) wmspatial = mmspatial = true;
|
||||
|
||||
DEBB(DF_GRAPH, (debugfile,"draw the map\n"));
|
||||
|
||||
for(int m=0; m<motypes; m++) if(isPrincess(eMonster(m)))
|
||||
minf[m].name = princessgender() ? "Princess" : "Prince";
|
||||
|
||||
@ -6587,10 +6587,10 @@ void drawthemap() {
|
||||
|
||||
void drawmovestar(double dx, double dy) {
|
||||
|
||||
DEBBI(DF_GRAPH, ("draw movestar"));
|
||||
if(viewdists) return;
|
||||
if(DIM == 3) return;
|
||||
|
||||
DEBB(DF_GRAPH, (debugfile,"draw movestar\n"));
|
||||
if(!playerfound) return;
|
||||
|
||||
if(shmup::on) return;
|
||||
@ -6647,9 +6647,9 @@ purehookset hooks_calcparam;
|
||||
|
||||
void calcparam() {
|
||||
|
||||
DEBBI(DF_GRAPH, ("calc param"));
|
||||
auto cd = current_display;
|
||||
|
||||
DEBB(DF_GRAPH, (debugfile,"calc param\n"));
|
||||
cd->xtop = vid.xres * cd->xmin;
|
||||
cd->ytop = vid.yres * cd->ymin;
|
||||
|
||||
@ -6707,7 +6707,7 @@ bool force_sphere_outline = false;
|
||||
|
||||
void drawfullmap() {
|
||||
|
||||
DEBB(DF_GRAPH, (debugfile,"draw full map\n"));
|
||||
DEBBI(DF_GRAPH, ("draw full map"));
|
||||
|
||||
ptds.clear();
|
||||
|
||||
@ -6869,9 +6869,9 @@ int cmode;
|
||||
|
||||
void drawscreen() {
|
||||
|
||||
if(vid.xres == 0 || vid.yres == 0) return;
|
||||
DEBBI(DF_GRAPH, ("drawscreen"));
|
||||
|
||||
DEBB(DF_GRAPH, (debugfile,"drawscreen\n"));
|
||||
if(vid.xres == 0 || vid.yres == 0) return;
|
||||
|
||||
calcparam();
|
||||
// rug::setVidParam();
|
||||
@ -6962,7 +6962,7 @@ void drawscreen() {
|
||||
// SDL_UnlockSurface(s);
|
||||
|
||||
glflush();
|
||||
DEBT("swapbuffers");
|
||||
DEBB(DF_GRAPH, ("swapbuffers"));
|
||||
#if CAP_SDL
|
||||
#if CAP_GL
|
||||
if(vid.usingGL) SDL_GL_SwapBuffers(); else
|
||||
@ -6974,7 +6974,7 @@ void drawscreen() {
|
||||
}
|
||||
|
||||
void restartGraph() {
|
||||
DEBB(DF_INIT, (debugfile,"restartGraph\n"));
|
||||
DEBBI(DF_INIT, ("restartGraph"));
|
||||
|
||||
View = Id;
|
||||
if(!autocheat) linepatterns::clearAll();
|
||||
@ -6998,13 +6998,14 @@ void clearAnimations() {
|
||||
}
|
||||
|
||||
auto graphcm = addHook(clearmemory, 0, [] () {
|
||||
DEBB(DF_INIT, (debugfile,"clear graph memory\n"));
|
||||
DEBBI(DF_MEMORY, ("clear graph memory"));
|
||||
mouseover = centerover.at = lmouseover = NULL;
|
||||
gmatrix.clear(); gmatrix0.clear();
|
||||
clearAnimations();
|
||||
});
|
||||
|
||||
void resetGeometry() {
|
||||
DEBBI(DF_POLY | DF_GRAPH, ("resetGeometry"));
|
||||
#if MAXMDIM >= 4
|
||||
if(DIM == 3 && !floor_textures)
|
||||
make_floor_textures();
|
||||
|
4
help.cpp
4
help.cpp
@ -48,7 +48,7 @@ vector<string> extra_keys = {
|
||||
};
|
||||
|
||||
void buildHelpText() {
|
||||
DEBB(DF_GRAPH, (debugfile,"buildHelpText\n"));
|
||||
DEBBI(DF_GRAPH, ("buildHelpText"));
|
||||
|
||||
help = XLAT("Welcome to HyperRogue");
|
||||
#if ISANDROID
|
||||
@ -729,7 +729,7 @@ int windtotal;
|
||||
hookset<void(cell*)> *hooks_mouseover;
|
||||
|
||||
void describeMouseover() {
|
||||
DEBB(DF_GRAPH, (debugfile,"describeMouseover\n"));
|
||||
DEBBI(DF_GRAPH, ("describeMouseover"));
|
||||
|
||||
cell *c = mousing ? mouseover : playermoved ? NULL : centerover.at;
|
||||
string& out = mouseovers;
|
||||
|
46
hyper.h
46
hyper.h
@ -191,10 +191,6 @@ typedef long double ld;
|
||||
|
||||
typedef complex<ld> cld;
|
||||
|
||||
#define DEBMEM(x) // { x fflush(stdout); }
|
||||
|
||||
#define DEBSM(x)
|
||||
|
||||
#if MAXMDIM == 3
|
||||
#define WDIM 2
|
||||
#else
|
||||
@ -3157,7 +3153,7 @@ struct hrmap_hyperbolic : hrmap_standard {
|
||||
hrmap_hyperbolic(heptagon *origin);
|
||||
heptagon *getOrigin() override { return origin; }
|
||||
~hrmap_hyperbolic() {
|
||||
DEBMEM ( verifycells(origin); )
|
||||
// verifycells(origin);
|
||||
// printf("Deleting hyperbolic map: %p\n", this);
|
||||
dynamicval<eVariation> ph(variation, mvar);
|
||||
clearfrom(origin);
|
||||
@ -3665,20 +3661,31 @@ transmatrix cpush(int cid, ld alpha);
|
||||
bool eqmatrix(transmatrix A, transmatrix B, ld eps = 1e-2);
|
||||
void set_column(transmatrix& T, int i, const hyperpoint& H);
|
||||
|
||||
#define DF_INIT 0 // always display these
|
||||
#define DF_MSG 0 // always display these
|
||||
#define DF_STEAM 1
|
||||
#define DF_GRAPH 2
|
||||
#define DF_TURN 4
|
||||
#define DF_FIELD 8
|
||||
#define DF_INIT 1 // always display these
|
||||
#define DF_MSG 2 // always display these
|
||||
#define DF_WARN 4 // always display these
|
||||
#define DF_ERROR 8 // always display these
|
||||
#define DF_STEAM 16
|
||||
#define DF_GRAPH 32
|
||||
#define DF_TURN 64
|
||||
#define DF_FIELD 128
|
||||
#define DF_GEOM 256
|
||||
#define DF_MEMORY 512
|
||||
#define DF_TIME 1024 // a flag to display timestamps
|
||||
#define DF_GP 2048
|
||||
#define DF_POLY 4096
|
||||
#define DF_KEYS "imwesxufgbtop"
|
||||
|
||||
#if ISANDROID
|
||||
#define DEBB(r,x)
|
||||
#define DEBB0(r,x)
|
||||
#define DEBBI(r,x)
|
||||
#else
|
||||
#define DEBB(r,x) { if(debugfile && (!(r) || (debugflags & (r)))) { fprintf x; fflush(debugfile); } }
|
||||
#define DEBB(r,x) { if(debugflags & (r)) { println_log x; } }
|
||||
#define DEBB0(r,x) { if(debugflags & (r)) { print_log x; } }
|
||||
#define DEBBI(r,x) { if(debugflags & (r)) { println_log x; } } indenter_finish _debbi(debugflags & (r));
|
||||
#endif
|
||||
|
||||
extern FILE *debugfile;
|
||||
extern int debugflags;
|
||||
int gmod(int i, int j);
|
||||
int gdiv(int i, int j);
|
||||
@ -4190,8 +4197,6 @@ namespace gp {
|
||||
plainshape& get_plainshape();
|
||||
}
|
||||
|
||||
extern bool debug_geometry;
|
||||
|
||||
#if CAP_SHAPES
|
||||
dqi_poly& queuepoly(const transmatrix& V, const hpcshape& h, color_t col);
|
||||
dqi_poly& queuepolyat(const transmatrix& V, const hpcshape& h, color_t col, PPR prio);
|
||||
@ -4705,11 +4710,15 @@ struct logger : hstream {
|
||||
int indentation;
|
||||
bool doindent;
|
||||
logger() { doindent = false; }
|
||||
virtual void write_char(char c) { if(doindent) { doindent = false; for(int i=0; i<indentation; i++) special_log(' '); } special_log(c); if(c == 10) doindent = true; }
|
||||
virtual void write_char(char c) { if(doindent) { doindent = false;
|
||||
if(debugflags & DF_TIME) { int t = SDL_GetTicks(); if(t < 0) t = 999999; t %= 1000000; string s = its(t); while(isize(s) < 6) s = "0" + s; for(char c: s) special_log(c); special_log(' '); }
|
||||
for(int i=0; i<indentation; i++) special_log(' '); } special_log(c); if(c == 10) doindent = true; }
|
||||
virtual char read_char() { throw hstream_exception(); }
|
||||
};
|
||||
|
||||
extern logger hlog;
|
||||
template<class... T> void println_log(T... t) { println(hlog, t...); }
|
||||
template<class... T> void print_log(T... t) { print(hlog, t...); }
|
||||
|
||||
#ifdef __GNUC__
|
||||
__attribute__((__format__ (__printf__, 1, 2)))
|
||||
@ -4737,6 +4746,11 @@ struct indenter {
|
||||
indenter(int i = 2) : ind(hlog.indentation, hlog.indentation + (i)) {}
|
||||
};
|
||||
|
||||
struct indenter_finish : indenter {
|
||||
indenter_finish(bool b): indenter(b ? 2:0) {}
|
||||
~indenter_finish() { if(hlog.indentation != ind.backup) println(hlog, "(done)"); }
|
||||
};
|
||||
|
||||
void appendHelp(string s);
|
||||
|
||||
transmatrix rspintox(const hyperpoint& H);
|
||||
|
@ -1112,7 +1112,7 @@ void centerpc(ld aspd) {
|
||||
|
||||
if(ors::mode == 2 && vid.sspeed < 5) return;
|
||||
if(vid.sspeed >= 4.99) aspd = 1000;
|
||||
DEBB(DF_GRAPH, (debugfile,"center pc\n"));
|
||||
DEBBI(DF_GRAPH, ("center pc"));
|
||||
|
||||
ors::unrotate(cwtV); ors::unrotate(View);
|
||||
|
||||
@ -1172,7 +1172,7 @@ void optimizeview() {
|
||||
}
|
||||
#endif
|
||||
|
||||
DEBB(DF_GRAPH, (debugfile,"optimize view\n"));
|
||||
DEBBI(DF_GRAPH, ("optimize view"));
|
||||
int turn = 0;
|
||||
ld best = INF;
|
||||
|
||||
@ -1246,7 +1246,7 @@ void ballgeometry() {
|
||||
}
|
||||
|
||||
void resetview() {
|
||||
DEBB(DF_GRAPH, (debugfile,"reset view\n"));
|
||||
DEBBI(DF_GRAPH, ("reset view"));
|
||||
View = Id;
|
||||
// EUCLIDEAN
|
||||
if(!masterless)
|
||||
|
8
init.cpp
8
init.cpp
@ -8,12 +8,7 @@ namespace hr {
|
||||
#if CU_INIT
|
||||
int fontscale = 100;
|
||||
|
||||
#if ISANDROID
|
||||
FILE *debfile;
|
||||
#endif
|
||||
|
||||
FILE *debugfile;
|
||||
int debugflags;
|
||||
int debugflags = DF_INIT | DF_ERROR | DF_WARN | DF_MSG | DF_TIME;
|
||||
|
||||
string s0;
|
||||
|
||||
@ -297,7 +292,6 @@ void mobile_draw(MOBPAR_FORMAL) {
|
||||
if(!inmenu && vid.stereo_mode == sLR && ors::mode)
|
||||
mousex = vid.xres/2, mousey = vid.yres/2, mouseh = sphereflip * C0;
|
||||
|
||||
// if(debfile) fprintf(debfile, "d1\n"), fflush(debfile);
|
||||
frames++;
|
||||
conformal::configure();
|
||||
|
||||
|
@ -18,7 +18,7 @@ int PREC(ld x) {
|
||||
|
||||
void showOverview() {
|
||||
cmode = sm::ZOOMABLE | sm::OVERVIEW;
|
||||
DEBB(DF_GRAPH, (debugfile,"show overview\n"));
|
||||
DEBBI(DF_GRAPH, ("show overview"));
|
||||
|
||||
if(dialog::infix != "")
|
||||
mouseovers = dialog::infix;
|
||||
@ -905,7 +905,7 @@ string gettimestamp(msginfo& m) {
|
||||
}
|
||||
|
||||
void showMessageLog() {
|
||||
DEBB(DF_GRAPH, (debugfile,"show message log\n"));
|
||||
DEBBI(DF_GRAPH, ("show message log"));
|
||||
|
||||
int lines = vid.yres / vid.fsize - 2;
|
||||
int maxpos = isize(gamelog) - lines;
|
||||
|
15
polygons.cpp
15
polygons.cpp
@ -2732,7 +2732,7 @@ void buildpolys() {
|
||||
#if CAP_GP
|
||||
gp::clear_plainshapes();
|
||||
#endif
|
||||
DEBB(DF_INIT, (debugfile,"buildpolys\n"));
|
||||
DEBBI(DF_POLY, ("buildpolys"));
|
||||
|
||||
if(WDIM == 3) {
|
||||
if(sphere) SD3 = 3, SD7 = 5;
|
||||
@ -3176,7 +3176,7 @@ void buildpolys() {
|
||||
bshapeend();
|
||||
|
||||
prehpc = isize(hpc);
|
||||
DEBB(DF_INIT, (debugfile,"hpc = %d\n", prehpc));
|
||||
DEBB(DF_POLY, ("hpc = ", prehpc));
|
||||
|
||||
user_triangles_texture.tvertices.clear();
|
||||
|
||||
@ -3192,9 +3192,9 @@ void buildpolys() {
|
||||
|
||||
static int qhpc0;
|
||||
int qhpc = isize(hpc);
|
||||
if(qhpc != qhpc0 && debug_geometry) {
|
||||
printf("qhpc = %d (%d+%d)\n", qhpc0 = qhpc, prehpc, qhpc-prehpc);
|
||||
printf("shapes = %d\n", isize(allshapes));
|
||||
if(qhpc != qhpc0 && (debugflags & (DF_GEOM | DF_POLY))) {
|
||||
println(hlog, "qhpc = ", qhpc0=qhpc, " (", prehpc, "+", qhpc-prehpc, ")");
|
||||
println(hlog, "shapes = ", isize(allshapes));
|
||||
int inve=0, issi=0, vcon=0, ccon=0;
|
||||
for(auto sh: allshapes) {
|
||||
if(sh->flags & POLY_INVERSE) inve++;
|
||||
@ -3202,10 +3202,7 @@ void buildpolys() {
|
||||
if(sh->flags & POLY_VCONVEX) vcon++;
|
||||
if(sh->flags & POLY_CCONVEX) ccon++;
|
||||
}
|
||||
printf("triangle flags = %x\n", shTriangle.flags);
|
||||
printf("plain floor flags = %x\n", shFloor.b[0].flags);
|
||||
printf("ball flags = %x\n", shDisk.flags);
|
||||
printf("inverse = %d isside = %d vcon = %d ccon = %d\n", inve, issi, vcon, ccon);
|
||||
println(hlog, format("inverse = %d isside = %d vcon = %d ccon = %d", inve, issi, vcon, ccon));
|
||||
}
|
||||
|
||||
initPolyForGL();
|
||||
|
@ -94,7 +94,7 @@ renderbuffer::renderbuffer(int x, int y, bool gl) : x(x), y(y) {
|
||||
else
|
||||
valid = true;
|
||||
|
||||
printf("Framebuffer remains = %d (%d)\n", FramebufferName, valid);
|
||||
DEBB(DF_GRAPH, ("Framebuffer remains = ", int(FramebufferName), " (", int(valid), ")"));
|
||||
GLERR("initialization");
|
||||
|
||||
rb.reset();
|
||||
|
@ -58,13 +58,13 @@ void recursive_delete(heptagon *h, int i) {
|
||||
if(h2->move(i) && h2->move(i)->move(0) == h2)
|
||||
recursive_delete(h2, i); }
|
||||
if(h2->alt && h2->alt->alt == h2->alt) {
|
||||
DEBSM(printf("destroying alternate map %p\n", h2->alt);)
|
||||
DEBB(DF_MEMORY, ("destroying alternate map ", h2->alt));
|
||||
for(hrmap *& hm: allmaps) {
|
||||
if(hm->getOrigin() == h2->alt) {
|
||||
delete hm;
|
||||
hm = allmaps.back();
|
||||
allmaps.pop_back();
|
||||
DEBSM(printf("map found (%d altmaps total)\n", isize(allmaps));)
|
||||
DEBB(DF_MEMORY, ("map found (", isize(allmaps), " altmaps total)"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -140,7 +140,7 @@ void save_memory() {
|
||||
if(last_cleared && celldist(at->c7) < celldist(last_cleared->c7))
|
||||
return;
|
||||
|
||||
DEBSM(printf("celldist = %d, %d\n", celldist(cwt.at), celldist(at->c7));)
|
||||
DEBB(DF_MEMORY, ("celldist = ", make_pair(celldist(cwt.at), celldist(at->c7))));
|
||||
|
||||
heptagon *at1 = at;
|
||||
while(at != last_cleared && at != orig) {
|
||||
@ -153,7 +153,7 @@ void save_memory() {
|
||||
}
|
||||
|
||||
last_cleared = at1;
|
||||
DEBSM(printf("current cellcount = %d\n", cellcount);)
|
||||
DEBB(DF_MEMORY, ("current cellcount = ", cellcount));
|
||||
|
||||
sort(removed_cells.begin(), removed_cells.end());
|
||||
callhooks(hooks_removecells);
|
||||
|
@ -74,7 +74,7 @@ eLand cid = laNone;
|
||||
hookset<bool(eLand&)> *hooks_music;
|
||||
|
||||
void handlemusic() {
|
||||
DEBB(DF_GRAPH, (debugfile,"handle music\n"));
|
||||
DEBBI(DF_GRAPH, ("handle music"));
|
||||
if(audio && musicvolume) {
|
||||
eLand id = getCurrentLandForMusic();
|
||||
if(callhandlers(false, hooks_music, id)) return;
|
||||
@ -120,7 +120,7 @@ void resetmusic() {
|
||||
}
|
||||
|
||||
bool loadMusicInfo(string dir) {
|
||||
DEBB(DF_INIT, (debugfile,"load music info\n"));
|
||||
DEBBI(DF_INIT, ("load music info"));
|
||||
if(dir == "") return false;
|
||||
FILE *f = fopen(dir.c_str(), "rt");
|
||||
if(f) {
|
||||
|
14
system.cpp
14
system.cpp
@ -102,7 +102,7 @@ hookset<void()> *hooks_initgame;
|
||||
|
||||
// initialize the game
|
||||
void initgame() {
|
||||
DEBB(DF_INIT, (debugfile,"initGame\n"));
|
||||
DEBBI(DF_INIT, ("initGame"));
|
||||
callhooks(hooks_initgame);
|
||||
|
||||
if(multi::players < 1 || multi::players > MAXPLAYER)
|
||||
@ -826,7 +826,7 @@ void remove_emergency_save() {
|
||||
}
|
||||
|
||||
void saveStats(bool emergency = false) {
|
||||
DEBB(DF_INIT, (debugfile,"saveStats [%s]\n", scorefile));
|
||||
DEBBI(DF_INIT, ("saveStats [%s]", scorefile));
|
||||
|
||||
if(autocheat) return;
|
||||
#if CAP_TOUR
|
||||
@ -940,7 +940,7 @@ void saveStats(bool emergency = false) {
|
||||
fprintf(f, "\n\n\n");
|
||||
|
||||
#if ISMOBILE==0
|
||||
DEBB(DF_INIT, (debugfile, "Game statistics saved to %s\n", scorefile));
|
||||
DEBB(DF_INIT, ("Game statistics saved to ", scorefile));
|
||||
if(!tactic::trailer)
|
||||
addMessage(XLAT("Game statistics saved to %1", scorefile));
|
||||
#endif
|
||||
@ -953,7 +953,7 @@ void loadsave() {
|
||||
#if CAP_TOUR
|
||||
if(tour::on) return;
|
||||
#endif
|
||||
DEBB(DF_INIT, (debugfile,"loadSave\n"));
|
||||
DEBBI(DF_INIT, ("loadSave"));
|
||||
|
||||
gamecount = 0;
|
||||
|
||||
@ -1139,7 +1139,7 @@ void popAllGames() {
|
||||
|
||||
void stop_game() {
|
||||
if(!game_active) return;
|
||||
DEBB(DF_INIT, (debugfile,"stop_game\n"));
|
||||
DEBBI(DF_INIT, ("stop_game"));
|
||||
achievement_final(true);
|
||||
#if CAP_SAVE
|
||||
saveStats();
|
||||
@ -1232,7 +1232,7 @@ void set_variation(eVariation target) {
|
||||
}
|
||||
|
||||
void switch_game_mode(char switchWhat) {
|
||||
DEBB(DF_INIT, (debugfile,"switch_game_mode\n"));
|
||||
DEBBI(DF_INIT, ("switch_game_mode ", switchWhat));
|
||||
switch(switchWhat) {
|
||||
case rg::peace:
|
||||
peace::on = !peace::on;
|
||||
@ -1351,7 +1351,7 @@ void switch_game_mode(char switchWhat) {
|
||||
|
||||
void start_game() {
|
||||
if(game_active) return;
|
||||
DEBB(DF_INIT, (debugfile,"start_game\n"));
|
||||
DEBBI(DF_INIT, ("start_game"));
|
||||
restart:
|
||||
game_active = true;
|
||||
gamegen_failure = false;
|
||||
|
@ -720,7 +720,7 @@ namespace yendor {
|
||||
}) + addHook(hooks_removecells, 0, [] () {
|
||||
eliminate_if(yendor::yi, [] (yendorinfo& i) {
|
||||
for(int j=0; j<YDIST; j++) if(is_cell_removed(i.path[j])) {
|
||||
DEBSM(printf("removing a Yendor\n");)
|
||||
DEBB(DF_MEMORY, ("removing a Yendor"));
|
||||
if(&yi[yii] == &i) yii = NOYENDOR;
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user