// Hyperbolic Rogue // Copyright (C) 2011 Zeno Rogue // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // disable for the Android version #define ISANDROID 0 #define ISMOBILE 0 #define ISIOS 0 #define VER "7.4h" #define VERNUM 7480 #define VERNUM_HEX 0x7480 #include #ifndef MAC #undef main #endif #include #include #include #include #include #include using namespace std; const char *scorefile = "hyperrogue.log"; const char *conffile = "hyperrogue.ini"; string levelfile = "hyperrogue.lev"; string picfile = "hyperrogue.pic"; const char *loadlevel = NULL; const char *musicfile = ""; typedef long double ld; template int size(T& x) {return x.size(); } string its(int i) { char buf[64]; sprintf(buf, "%d", i); return buf; } string cts(char c) { char buf[8]; buf[0] = c; buf[1] = 0; return buf; } string llts(long long i) { // sprintf does not work on Windows IIRC if(i < 0) return "-" + llts(-i); if(i < 10) return its(i); return llts(i/10) + its(i%10); } string fts(float x) { char buf[64]; sprintf(buf, "%4.2f", x); return buf; } string fts4(float x) { char buf[64]; sprintf(buf, "%6.4f", x); return buf; } string itsh(int i) {static char buf[16]; sprintf(buf, "%03X", i); return buf; } #undef DEBT void DEBT(const char *buf) { printf("%4d %s\n", SDL_GetTicks(), buf); } string s0; void addMessage(string s, char spamtype = 0); int clWidth, clHeight, clFont; string commandline; #include "hyperpoint.cpp" #include "patterns.cpp" #include "heptagon.cpp" #include "classes.cpp" #include "language.cpp" #ifdef STEAM #define NOLICENSE #endif #include "hyper.h" #include "cell.cpp" #include "game.cpp" // #include "patterngen.cpp" #include "geometry.cpp" #include "polygons.cpp" #ifndef MOBILE #include "mapeditor.cpp" #endif #include "graph.cpp" #include "achievement.cpp" #include int main(int argc, char **argv) { printf("HyperRogue by Zeno Rogue , version "VER"\n"); #ifndef NOLICENSE printf("released under GNU General Public License version 2 and thus\n"); printf("comes with absolutely no warranty; see COPYING for details\n"); #endif achievement_init(); // printf("cell size = %d\n", int(sizeof(cell))); srand(time(NULL)); shrand(time(NULL)); #ifdef FHS char sbuf[640], cbuf[640]; if(getenv("HOME")) { snprintf(sbuf, 640, "%s/.%s", getenv("HOME"), scorefile); scorefile = sbuf; snprintf(cbuf, 640, "%s/.%s", getenv("HOME"), conffile); conffile = cbuf; } #endif for(int i=1; i= 0; uu--) { printf("uu=%d\n", uu); initgame(uu); restartGame(); } */ #ifdef BUILDZEBRA firstland = laCanvas; shmup::on = false; #endif initgame(); #ifdef BUILDZEBRA zebraPattern(); #endif if(!shmup::on) { restoreGolems(items[itOrbLife], moGolem); items[itOrbLife] = 0; restoreGolems(items[itOrbFriend], moTameBomberbird); items[itOrbFriend] = 0; restoreGolems(kills[moPrincessMoved], moPrincess, princess::saveHP); kills[moPrincessMoved] = 0; restoreGolems(kills[moPrincessArmedMoved], moPrincessArmed, princess::saveArmedHP); kills[moPrincessArmedMoved] = 0; } firstland = f; // verifyHell(); // exit(1); int t1 = SDL_GetTicks(); // if(switchEuclid) restartGame('e'); if(loadlevel) mapstream::loadMap(loadlevel); mainloop(); achievement_final(!items[itOrbSafety]); saveStats(); int msec = SDL_GetTicks() - t1; printf("frame : %f ms (%f fps)\n", 1.*msec/frames, 1000.*frames/msec); offscreen.clear(); clearMemory(); cleargraph(); achievement_close(); return 0; }