1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 21:07:17 +00:00

moved hyper.cpp to hyper-main.cpp and compileunits.h to hyper.cpp

This commit is contained in:
Zeno Rogue 2019-09-05 09:05:50 +02:00
parent 98ddecc63e
commit fbe32b0459
3 changed files with 222 additions and 225 deletions

View File

@ -1,134 +0,0 @@
// Usage:
// * compile hyper.cpp with CU == 0
// * compile init.cpp with CU == 1
// * link them.
// Only the parts defined in #if IN_CU(1) will be included in the second compiling.
#ifndef CU
#define IN_CU(x) 1
#else
#define IN_CU(x) (CU == x)
#endif
#include "sysconfig.h"
#include "classes.h"
#include "hyper.h"
#define CU_INIT IN_CU(0)
#define CU_HYPER IN_CU(0)
#if IN_CU(0)
#include "classes.cpp"
#endif
#if IN_CU(0)
#include "shaders.cpp"
#include "hprint.cpp"
#include "util.cpp"
#include "hyperpoint.cpp"
#include "patterns.cpp"
#include "fieldpattern.cpp"
#include "heptagon.cpp"
#include "binary-tiling.cpp"
#include "nonisotropic.cpp"
#include "penrose.cpp"
#include "archimedean.cpp"
#include "euclid.cpp"
#include "sphere.cpp"
#include "quotient.cpp"
#include "crystal.cpp"
// #include "product.cpp"
#include "reg3.cpp"
#include "language.cpp"
#include "cell.cpp"
#include "expansion.cpp"
#include "goldberg.cpp"
#include "irregular.cpp"
#include "pattern2.cpp"
#include "flags.cpp"
#include "yendor.cpp"
#include "complex.cpp"
#if CAP_COMPLEX2
#include "complex2.cpp"
#endif
#include "savemem.cpp"
#include "game.cpp"
#include "orbgen.cpp"
#include "monstergen.cpp"
#include "landlock.cpp"
#include "landgen.cpp"
#include "orbs.cpp"
#if CAP_INV
#include "inventory.cpp"
#else
namespace hr { namespace inv { bool on, activating; } }
#endif
#include "system.cpp"
#include "debug.cpp"
#include "geometry.cpp"
#include "geometry2.cpp"
#include "polygons.cpp"
#include "3d-models.cpp"
#include "floorshapes.cpp"
#include "usershapes.cpp"
#include "drawing.cpp"
#include "mapeditor.cpp"
#if CAP_MODEL
#include "netgen.cpp"
#endif
#if CAP_TABFONT || CAP_CREATEFONT
#include "nofont.cpp"
#endif
#include "basegraph.cpp"
#include "screenshot.cpp"
#include "renderbuffer.cpp"
#include "help.cpp"
#include "legacy.cpp"
#include "config.cpp"
#include "scores.cpp"
#include "dialogs.cpp"
#include "menus.cpp"
#include "geom-exp.cpp"
#include "quit.cpp"
#include "multi.cpp"
#include "shmup.cpp"
#if CAP_RACING
#include "racing.cpp"
#endif
#include "models.cpp"
#include "history.cpp"
#include "rug.cpp"
#include "control.cpp"
#include "hud.cpp"
#include "hypgraph.cpp"
#include "textures.cpp"
#include "graph.cpp"
#include "blizzard.cpp"
#include "sound.cpp"
#include "achievement.cpp"
#include "barriers.cpp"
#include "surface.cpp"
#if CAP_TOUR
#include "tour.cpp"
#endif
#include "commandline.cpp"
#include "bigstuff.cpp"
#include "multigame.cpp"
#if CAP_ROGUEVIZ
#include "rogueviz.cpp"
#endif
#if CAP_DAILY
#include "private/daily.cpp"
#else
namespace hr { namespace daily { bool on; } }
#endif
#endif
#if IN_CU(1)
#endif

89
hyper-main.cpp Normal file
View File

@ -0,0 +1,89 @@
// Hyperbolic Rogue
// Copyright (C) 2011-2019 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.
/** \file hyper.cpp
* \brief the hyper_main function
*/
#if CU_HYPER
#if ISLINUX
#include <sys/resource.h>
void moreStack() {
const rlim_t kStackSize = 1 << 28; // 28;
struct rlimit rl;
int result;
result = getrlimit(RLIMIT_STACK, &rl);
if(result == 0) {
if(rl.rlim_cur < kStackSize) {
// rl.rlim_cur = 1 << 19; // kStackSize;
result = setrlimit(RLIMIT_STACK, &rl);
if (result != 0) {
fprintf(stderr, "setrlimit returned result = %d\n", result);
}
}
}
}
#endif
namespace hr {
EX hookset<bool(int argc, char** argv)> *hooks_main;
EX int hyper_main(int argc, char **argv) {
using namespace hr;
#if ISWEB
emscripten_get_commandline();
#else
arg::init(argc, argv);
#endif
if(callhandlers(false, hooks_main, argc, argv)) return 0;
#if !ISWEB
#if ISLINUX
moreStack();
#endif
#endif
#if CAP_COMMANDLINE
initializeCLI();
#endif
initAll();
#if CAP_COMMANDLINE
arg::read(3);
start_game();
#endif
#if !ISWEB
if(showstartmenu && !vid.skipstart) {
#if CAP_STARTANIM
startanims::pick();
#endif
pushScreen(showStartMenu);
}
#endif
mainloop();
finishAll();
profile_info();
return 0;
}
}
#ifndef NOMAIN
int main(int argc, char **argv) {
return hr::hyper_main(argc, argv);
}
#endif
#endif

224
hyper.cpp
View File

@ -1,91 +1,133 @@
// Hyperbolic Rogue // Usage:
// Copyright (C) 2011-2019 Zeno Rogue // * compile hyper.cpp with CU == 0
// * compile init.cpp with CU == 1
// This program is free software; you can redistribute it and/or // * link them.
// modify it under the terms of the GNU General Public License // Only the parts defined in #if IN_CU(1) will be included in the second compiling.
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
#ifndef CU
// This program is distributed in the hope that it will be useful, #define IN_CU(x) 1
// but WITHOUT ANY WARRANTY; without even the implied warranty of #else
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #define IN_CU(x) (CU == x)
// GNU General Public License for more details. #endif
// You should have received a copy of the GNU General Public License #include "sysconfig.h"
// along with this program; if not, write to the Free Software #include "classes.h"
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "hyper.h"
/** \file hyper.cpp #define CU_INIT IN_CU(0)
* \brief the hyper_main function #define CU_HYPER IN_CU(0)
*/
#if IN_CU(0)
#include "compileunits.h" #include "classes.cpp"
#endif
#if CU_HYPER
#if IN_CU(0)
#if ISLINUX #include "shaders.cpp"
#include <sys/resource.h> #include "hprint.cpp"
#include "util.cpp"
void moreStack() { #include "hyperpoint.cpp"
const rlim_t kStackSize = 1 << 28; // 28; #include "patterns.cpp"
struct rlimit rl; #include "fieldpattern.cpp"
int result; #include "heptagon.cpp"
#include "binary-tiling.cpp"
result = getrlimit(RLIMIT_STACK, &rl); #include "nonisotropic.cpp"
if(result == 0) { #include "penrose.cpp"
if(rl.rlim_cur < kStackSize) { #include "archimedean.cpp"
// rl.rlim_cur = 1 << 19; // kStackSize; #include "euclid.cpp"
result = setrlimit(RLIMIT_STACK, &rl); #include "sphere.cpp"
if (result != 0) { #include "quotient.cpp"
fprintf(stderr, "setrlimit returned result = %d\n", result); #include "crystal.cpp"
} // #include "product.cpp"
} #include "reg3.cpp"
} #include "language.cpp"
} #include "cell.cpp"
#endif #include "expansion.cpp"
#include "goldberg.cpp"
namespace hr { #include "irregular.cpp"
EX hookset<bool(int argc, char** argv)> *hooks_main; #include "pattern2.cpp"
#include "flags.cpp"
EX int hyper_main(int argc, char **argv) { #include "yendor.cpp"
using namespace hr; #include "complex.cpp"
#if ISWEB #if CAP_COMPLEX2
emscripten_get_commandline(); #include "complex2.cpp"
#else #endif
arg::init(argc, argv); #include "savemem.cpp"
#endif #include "game.cpp"
if(callhandlers(false, hooks_main, argc, argv)) return 0; #include "orbgen.cpp"
#if !ISWEB #include "monstergen.cpp"
#if ISLINUX #include "landlock.cpp"
moreStack(); #include "landgen.cpp"
#endif #include "orbs.cpp"
#endif #if CAP_INV
#if CAP_COMMANDLINE #include "inventory.cpp"
initializeCLI(); #else
#endif namespace hr { namespace inv { bool on, activating; } }
initAll(); #endif
#if CAP_COMMANDLINE #include "system.cpp"
arg::read(3); #include "debug.cpp"
start_game(); #include "geometry.cpp"
#endif #include "geometry2.cpp"
#if !ISWEB #include "polygons.cpp"
if(showstartmenu && !vid.skipstart) { #include "3d-models.cpp"
#if CAP_STARTANIM #include "floorshapes.cpp"
startanims::pick(); #include "usershapes.cpp"
#endif #include "drawing.cpp"
pushScreen(showStartMenu); #include "mapeditor.cpp"
} #if CAP_MODEL
#endif #include "netgen.cpp"
mainloop(); #endif
finishAll(); #if CAP_TABFONT || CAP_CREATEFONT
profile_info(); #include "nofont.cpp"
return 0; #endif
} #include "basegraph.cpp"
} #include "screenshot.cpp"
#include "renderbuffer.cpp"
#ifndef NOMAIN #include "help.cpp"
int main(int argc, char **argv) { #include "legacy.cpp"
return hr::hyper_main(argc, argv); #include "config.cpp"
} #include "scores.cpp"
#endif #include "dialogs.cpp"
#endif #include "menus.cpp"
#include "geom-exp.cpp"
#include "quit.cpp"
#include "multi.cpp"
#include "shmup.cpp"
#if CAP_RACING
#include "racing.cpp"
#endif
#include "models.cpp"
#include "history.cpp"
#include "rug.cpp"
#include "control.cpp"
#include "hud.cpp"
#include "hypgraph.cpp"
#include "textures.cpp"
#include "graph.cpp"
#include "blizzard.cpp"
#include "sound.cpp"
#include "achievement.cpp"
#include "barriers.cpp"
#include "surface.cpp"
#if CAP_TOUR
#include "tour.cpp"
#endif
#include "commandline.cpp"
#include "bigstuff.cpp"
#include "multigame.cpp"
#if CAP_ROGUEVIZ
#include "rogueviz.cpp"
#endif
#if CAP_DAILY
#include "private/daily.cpp"
#else
namespace hr { namespace daily { bool on; } }
#endif
#endif
#include "hyper-main.cpp"