1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 17:10:36 +00:00

moved all the HyperRogue stuff except RogueViz to namespace 'hr' -- useful when using hr as a library

This commit is contained in:
Zeno Rogue 2018-06-11 01:58:31 +02:00
parent c2e3ed54f0
commit 4c619e60dd
68 changed files with 735 additions and 539 deletions

View File

@ -1,6 +1,8 @@
// Hyperbolic Rogue -- achievements
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
#define NUMLEADER 78
bool offlineMode = false;
@ -782,3 +784,5 @@ int score_default(int i) {
int get_sync_status() { return 0; }
void set_priority_board(int) { }
#endif
}

View File

@ -2,6 +2,8 @@
// This file implements routines related to barriers (Great Walls and similar).
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
bool checkBarriersFront(cellwalker bb, int q, bool cross) {
if(!ctof(bb.c))
@ -765,3 +767,4 @@ bool buildBarrierNowall(cell *c, eLand l2, int forced_dir) {
return false;
}
}

View File

@ -1,6 +1,8 @@
// Hyperbolic Rogue -- basic graphics
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
unsigned backcolor = 0;
unsigned bordcolor = 0;
unsigned forecolor = 0xFFFFFF;
@ -1256,3 +1258,4 @@ int calcfps() {
return (1000 * CFPS) / ret;
}
}

View File

@ -7,6 +7,8 @@
// horocycles
namespace hr {
int newRoundTableRadius() {
return 28 + 2 * items[itHolyGrail];
}
@ -1351,3 +1353,5 @@ void moreBigStuff(cell *c) {
}
}
}
}

View File

@ -1,6 +1,8 @@
// Hyperbolic Rogue -- special graphical effects, such as the Blizzard
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
double randd() { return (rand() + .5) / (RAND_MAX + 1.); }
double cellgfxdist(cell *c, int i) {
@ -261,3 +263,5 @@ auto ccm_blizzard = addHook(clearmemory, 0, [] () {
addHook(hooks_removecells, 0, [] () {
eliminate_if(arrowtraps, is_cell_removed);
});
}

View File

@ -3,6 +3,8 @@
// cells the game is played on
namespace hr {
int fix6(int a) { return (a+MODFIXER)%S6; }
int fix7(int a) { return (a+MODFIXER)%S7; }
@ -1478,3 +1480,4 @@ void clearCellMemory() {
auto cellhooks = addHook(clearmemory, 500, clearCellMemory);
}

View File

@ -1,6 +1,8 @@
// Hyperbolic Rogue -- items, monsters, walls, lands, descriptions, etc.
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
// --- help ---
const char *wormdes =
@ -1674,3 +1676,4 @@ geometryinfo ginf[gGUARD] = {
{"cube/elliptic", "e3x4", 4, 3, qELLIP, gcSphere, 0x10600, {{SEE_ALL, SEE_ALL}}},
};
}

View File

@ -1,3 +1,5 @@
namespace hr {
static const int motypes = 162;
struct monstertype {
@ -206,7 +208,7 @@ struct geometryinfo {
int quotientstyle;
eGeometryClass cclass;
int xcode;
array<int,2> distlimit; // bitrunc, non-bitrunc
std::array<int,2> distlimit; // bitrunc, non-bitrunc
};
static const int qZEBRA = 1;
@ -232,3 +234,5 @@ enum cpatterntype {
};
struct landtacinfo { eLand l; int tries, multiplier; };
}

View File

@ -1,6 +1,8 @@
// Hyperbolic Rogue -- commandline options
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
#if CAP_COMMANDLINE
const char *scorefile = "hyperrogue.log";
const char *conffile = "hyperrogue.ini";
@ -628,3 +630,5 @@ namespace arg {
}
}
#endif
}

View File

@ -11,9 +11,14 @@
#define IN_CU(x) (CU == x)
#endif
#include "sysconfig.h"
#include "classes.h"
#include "hyper.h"
#if CAP_ROGUEVIZ
#include "rogueviz.h"
#endif
#define CU_INIT IN_CU(0)
#define CU_HYPER IN_CU(0)
@ -97,7 +102,7 @@ bool inv::activating;
#if CAP_DAILY
#include "private/daily.cpp"
#else
namespace daily { bool on; }
namespace hr::daily { bool on; }
#endif
#endif

View File

@ -7,6 +7,8 @@
#include <map>
namespace hr {
namespace whirlwind {
int fzebra3(cell *c) {
@ -3674,3 +3676,5 @@ namespace dungeon {
if(d == 7 && c->land == laDungeon) buildPlates(c);
}
}
}

View File

@ -2,6 +2,8 @@
// Copyright (C) 2017-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
videopar vid;
#define DEFAULT_WALLMODE (ISMOBILE ? 3 : 5)
@ -1354,3 +1356,4 @@ void selectLanguageScreen() {
}
#endif
}

View File

@ -3,6 +3,8 @@
#include <complex>
namespace hr {
#if ISMOBWEB
typedef double precise;
#else
@ -885,3 +887,5 @@ namespace conformal {
});
}
}

View File

@ -1,6 +1,8 @@
// Hyperbolic Rogue -- control
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
int frames;
bool outoffocus = false;
@ -885,3 +887,5 @@ bool handleCompass() {
return false;
}
}

View File

@ -1,6 +1,8 @@
// Hyperbolic Rogue -- debugging routines
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
int steplimit = 0;
int cstep;
@ -436,3 +438,5 @@ void raiseBuggyGeneration(cell *c, const char *s) {
else
c->item = itBuggy;
}
}

View File

@ -14,6 +14,8 @@
*/
namespace hr {
const char* COLORBAR = "###";
namespace dialog {
@ -1039,3 +1041,5 @@ namespace dialog {
}
};
}

View File

@ -5,17 +5,20 @@
#define MOBPAR_FORMAL int
#define MOBPAR_ACTUAL 0
#define MIX_MAX_VOLUME 128
const char *scorefile = "fakemobile_score.txt";
const char *conffile = "fakemobile_config.txt";
#include <string>
std::string levelfile = "fakemobile_level.txt";
std::string picfile = "fakemobile_pic.txt";
namespace hr {
const char *scorefile = "fakemobile_score.txt";
const char *conffile = "fakemobile_config.txt";
std::string levelfile = "fakemobile_level.txt";
std::string picfile = "fakemobile_pic.txt";
}
#include <SDL/SDL.h>
#include "init.cpp"
using namespace hr;
#include <SDL/SDL_ttf.h>
#include <SDL/SDL_gfxPrimitives.h>

View File

@ -1,6 +1,8 @@
// Hyperbolic Rogue -- implementation of the quotient geometries based on fields
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
namespace fieldpattern {
extern int subpathid;
@ -783,3 +785,4 @@ int currfp_gmul(int a, int b) { return currfp.gmul(a,b); }
int currfp_inverses(int i) { return currfp.inverses[i]; }
int currfp_distwall(int i) { return currfp.distwall[i]; }
}

View File

@ -3,6 +3,8 @@
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
bool isIcyLand(eLand l) {
return l == laIce || l == laCocytus || l == laBlizzard;
}
@ -758,3 +760,4 @@ bool isTechnicalLand(eLand l) {
l == laMirrorWall2 || l == laMercuryRiver || l == laMemory;
}
}

View File

@ -1,3 +1,5 @@
namespace hr {
vector<plain_floorshape*> all_plain_floorshapes;
vector<escher_floorshape*> all_escher_floorshapes;
@ -587,3 +589,4 @@ if(0) {
} */
}
}

View File

@ -3,6 +3,8 @@
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
int lastsafety;
int mutantphase;
int turncount;
@ -142,8 +144,6 @@ cellwalker cwt; // single player character position
inline cell*& singlepos() { return cwt.c; }
inline bool singleused() { return !(shmup::on || multi::players > 1); }
#include <random>
mt19937 r;
void shrand(int i) {
@ -8053,3 +8053,4 @@ bool warningprotection() {
return true;
}
}

View File

@ -3,6 +3,8 @@
// -- geometry menu --
namespace hr {
int eupage = 0;
int euperpage = 21;
@ -453,3 +455,4 @@ void runGeometryExperiments() {
pushScreen(showEuclideanMenu);
}
}

View File

@ -3,6 +3,8 @@
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
bool debug_geometry = false;
ld tessf, crossf, hexf, hcrossf, hexhexdist, hexvdist, hepvdist, rhexf;
@ -340,3 +342,4 @@ void initgeo() {
// printf("%Lf\n", (ld) hdist0(xpush(-1)*ypush(0.01)*xpush(1)*C0));
precalc();
}
}

View File

@ -1,4 +1,4 @@
namespace gp {
namespace hr::gp {
bool on;
loc param(1, 0);

View File

@ -4,6 +4,8 @@
// basic graphics:
namespace hr {
int inmirrorcount = 0;
bool wmspatial, wmescher, wmplain, wmblack, wmascii;
@ -5825,3 +5827,4 @@ bool inscreenrange(cell *c) {
return heptdistance(viewcenter(), c) <= 8;
}
}

View File

@ -1,6 +1,8 @@
// Hyperbolic Rogue -- help routines
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
string help;
function<void()> help_delegate;
@ -1015,3 +1017,4 @@ void gotoHelpFor(eLand l) {
}});
else listbeasts();
}
}

View File

@ -4,6 +4,8 @@
// heptagon here refers to underlying heptagonal tesselation
// (which you can see by changing the conditions in graph.cpp)
namespace hr {
#define MIRR(x) x.mirrored
int heptacount = 0;
@ -275,3 +277,4 @@ void hsshow(const heptspin& t) {
// create h->move[d] if not created yet
heptagon *createStep(heptagon *h, int d);
}

View File

@ -1,6 +1,8 @@
// Hyperbolic Rogue -- heads-up display
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
purehookset hooks_stats;
int monsterclass(eMonster m) {
@ -567,3 +569,4 @@ XLAT(
callhooks(hooks_stats);
}
}

View File

@ -40,10 +40,11 @@ void moreStack() {
}
#endif
hookset<bool(int argc, char** argv)> *hooks_main;
hr::hookset<bool(int argc, char** argv)> *hr::hooks_main;
#ifndef NOMAIN
int main(int argc, char **argv) {
using namespace hr;
#if ISWEB
emscripten_get_commandline();
#else

106
hyper.h
View File

@ -1,6 +1,71 @@
// This is the main header file of HyperRogue. Mostly everything is dumped here.
// It is quite chaotic.
// version numbers
#define VER "10.4a"
#define VERNUM 10401
#define VERNUM_HEX 0xA0B1
namespace hr {
using namespace std;
// genus (in grammar)
#define GEN_M 0
#define GEN_F 1
#define GEN_N 2
#define GEN_O 3
void addMessage(string s, char spamtype = 0);
// geometry-dependent constants
#define ALPHA (M_PI*2/S7)
#define S7 ginf[geometry].sides
#define S3 ginf[geometry].vertex
#define hyperbolic_37 (S7 == 7 && S3 == 3)
#define hyperbolic_not37 ((S7 > 7 || S3 > 3) && hyperbolic)
#define weirdhyperbolic ((S7 > 7 || S3 > 3 || gp::on) && hyperbolic)
#define stdhyperbolic (S7 == 7 && S3 == 3 && !gp::on)
#define cgclass (ginf[geometry].cclass)
#define euclid (cgclass == gcEuclid)
#define sphere (cgclass == gcSphere)
#define hyperbolic (cgclass == gcHyperbolic)
#define elliptic (ginf[geometry].quotientstyle & qELLIP)
#define quotient (ginf[geometry].quotientstyle & (qZEBRA | qFIELD))
#define torus (ginf[geometry].quotientstyle & qTORUS)
#define doall (ginf[geometry].quotientstyle)
#define smallbounded (sphere || (quotient & qZEBRA) || torus)
#define bounded (sphere || quotient || torus)
#define a4 (S3 == 4)
#define a45 (S3 == 4 && S7 == 5)
#define a46 (S3 == 4 && S7 == 6)
#define a47 (S3 == 4 && S7 == 7)
#define a457 (S3 == 4 && S7 != 6)
#define a467 (S3 == 4 && S7 >= 6)
#define a38 (S7 == 8)
#define sphere4 (sphere && S7 == 4)
#define stdeuc (geometry == gNormal || geometry == gEuclid || geometry == gEuclidSquare)
#define smallsphere (S7 < 5)
#define bigsphere (S7 == 5)
#define ap4 (a4 && nonbitrunc)
#define euclid4 (euclid && a4)
#define euclid6 (euclid && !a4)
#define S6 (S3*2)
#define S42 (S7*S6)
#define S12 (S6*2)
#define S14 (S7*2)
#define S21 (S7*S3)
#define S28 (S7*4)
#define S36 (S6*6)
#define S84 (S7*S6*2)
#define MAX_EDGE 8
#define MAX_S3 4
#define MAX_S84 240
#define NUMWITCH 7
// achievements
@ -1598,25 +1663,6 @@ enum eGlyphsortorder {
extern eGlyphsortorder glyphsortorder;
#if CAP_ROGUEVIZ
namespace rogueviz {
extern bool on;
string describe(shmup::monster *m);
void describe(cell *c);
void activate(shmup::monster *m);
void drawVertex(const transmatrix &V, cell *c, shmup::monster *m);
bool virt(shmup::monster *m);
void turn(int delta);
void drawExtra();
void fixparam();
int readArgs();
void close();
void mark(cell *c);
void showMenu();
string makehelp();
}
#endif
void explodeMine(cell *c);
bool mayExplodeMine(cell *c, eMonster who);
@ -1781,16 +1827,6 @@ namespace tour {
};
#endif
namespace rogueviz {
extern bool rog3;
extern bool rvwarp;
#if CAP_TOUR
namespace rvtour {
extern tour::slide rvslides[];
}
#endif
};
extern bool doCross;
void optimizeview();
@ -3390,10 +3426,7 @@ void set_priority_board(int id);
int get_sync_status();
bool score_loaded(int id);
int score_default(int id);
#if CAP_SDL
union SDL_Event;
void handle_event(SDL_Event& ev);
#endif
#ifndef XPRINTF
template<class...T> void Xprintf(const char *fmt, T... t) { printf(fmt, t...); }
@ -3458,3 +3491,12 @@ extern plain_floorshape
shBigTriangle, shTriheptaFloor, shBigHepta;
extern escher_floorshape shDragonFloor, shPowerFloor, shRedRockFloor[3];
#if ISMOBILE
bool buttonclicked;
void gdpush(int t);
#endif
extern int fontscale;
}

View File

@ -2,6 +2,8 @@
// This file contains hyperbolic points and matrices.
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
eGeometry geometry, targetgeometry;
// for the pure heptagonal grid
@ -597,3 +599,4 @@ transmatrix rotmatrix(double rotation, int c0, int c1) {
return t;
}
}

View File

@ -19,21 +19,23 @@
#endif
#ifdef FAKEWEB
void mainloopiter();
namespace hr { void mainloopiter(); }
template<class A, class B, class C> void emscripten_set_main_loop(A a, B b, C c) { while(true) mainloopiter(); }
#else
#include <emscripten.h>
#include <emscripten/html5.h>
#endif
void initweb();
void emscripten_get_commandline();
namespace hr {
void initweb();
void emscripten_get_commandline();
void loadCompressedChar(int &otwidth, int &otheight, int *tpix);
void loadCompressedChar(int &otwidth, int &otheight, int *tpix);
const char *wheresounds;
const char *wheresounds;
}
#include "hyper.cpp"
namespace hr {
// -- demo --
@ -192,4 +194,6 @@ void emscripten_get_commandline() {
free(str);
#endif
}
}
#include "hyper.cpp"

View File

@ -1,6 +1,8 @@
// Hyperbolic Rogue -- hyperbolic graphics
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
ld ghx, ghy, ghgx, ghgy;
hyperpoint ghpm = C0;
@ -850,3 +852,4 @@ transmatrix atscreenpos(ld x, ld y, ld size) {
return V;
}
}

440
init.cpp
View File

@ -1,445 +1,10 @@
// Hyperbolic Rogue -- initialization, and stuff related to mobiles
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
#ifdef MAC
#define ISMAC 1
#endif
#ifdef LINUX
#define ISLINUX 1
#endif
#ifdef WINDOWS
#define ISWINDOWS 1
#endif
#if ISSTEAM
#define NOLICENSE
#endif
#define VER "10.4a"
#define VERNUM 10401
#ifndef CAP_SHADER
#define CAP_SHADER CAP_GL
#endif
#define VERNUM_HEX 0xA0B1
#define GEN_M 0
#define GEN_F 1
#define GEN_N 2
#define GEN_O 3
// OS settings
#ifndef ISMAC
#define ISMAC 0
#endif
#ifndef ISLINUX
#define ISLINUX 0
#endif
#ifndef ISWINDOWS
#define ISWINDOWS 0
#endif
#ifndef ISPANDORA
#define ISPANDORA 0
#endif
#ifndef ISIOS
#define ISIOS 0
#endif
#ifndef ISANDROID
#define ISANDROID 0
#endif
#ifndef ISWEB
#define ISWEB 0
#endif
#ifndef ISFAKEMOBILE
#define ISFAKEMOBILE 0
#endif
#define ISMOBILE (ISIOS || ISANDROID || ISFAKEMOBILE)
#define ISMOBWEB (ISMOBILE || ISWEB)
#ifndef ISMINI
#define ISMINI 0
#endif
#ifndef CAP_XGD
#define CAP_XGD (ISANDROID || ISFAKEMOBILE)
#endif
#define CAP_FRAMELIMIT (!ISMOBWEB)
#if ISMOBILE==1
#define EXTERNALFONT
#endif
#ifndef CAP_FILES
#define CAP_FILES 1
#endif
#ifndef CAP_INV
#define CAP_INV 1
#endif
#ifndef CAP_ANDROIDSHARE
#define CAP_ANDROIDSHARE (ISANDROID)
#endif
#ifndef CAP_SDL
#define CAP_SDL (!ISMOBILE)
#endif
#ifdef CAP_COMPASS
#define CAP_COMPASS ISMOBILE
#endif
#ifndef CAP_SDLGFX
#define CAP_SDLGFX (CAP_SDL && !ISWEB)
#endif
#ifndef CAP_GL
#define CAP_GL (ISMOBILE || CAP_SDL)
#endif
#ifndef CAP_AUDIO
#define CAP_AUDIO ((ISMOBILE || CAP_SDL) && !ISWEB && !ISMINI)
#endif
#define CAP_GLORNOT (CAP_GL && !ISWEB && !ISIOS)
#if ISSTEAM
#define CAP_DAILY 1
#endif
#ifndef CAP_DAILY
#define CAP_DAILY 0
#endif
#ifndef CAP_CERTIFY
#define CAP_CERTIFY 0
#endif
#ifndef CAP_RUG
#define CAP_RUG (!ISMINI && CAP_GL)
#endif
#ifndef CAP_SURFACE
#define CAP_SURFACE CAP_RUG
#endif
#ifndef CAP_EDIT
#define CAP_EDIT (CAP_FILES && !ISWEB && !ISMINI)
#endif
#ifndef CAP_ODS
#define CAP_ODS 0
#endif
#ifndef CAP_TEXTURE
#define CAP_TEXTURE (CAP_GL && (CAP_PNG || CAP_SDL_IMG) && !ISMINI)
#endif
#ifndef CAP_MODEL
#define CAP_MODEL (!ISMOBWEB && !ISMINI && CAP_SDLGFX)
#endif
#ifndef CAP_SAVE
#define CAP_SAVE (CAP_FILES && !ISWEB && !ISMINI)
#endif
#ifndef CAP_CONFIG
#define CAP_CONFIG (CAP_FILES && !ISWEB && !ISMINI)
#endif
#ifndef CAP_TRANS
#define CAP_TRANS (!ISWEB && !ISMINI)
#endif
#ifndef CAP_TOUR
#define CAP_TOUR (!ISWEB && !ISMINI)
#endif
#ifndef CAP_ROGUEVIZ
#define CAP_ROGUEVIZ 0
#endif
#ifndef CAP_PROFILING
#define CAP_PROFILING 0
#endif
#define PSEUDOKEY_WHEELDOWN 2501
#define PSEUDOKEY_WHEELUP 2502
#define PSEUDOKEY_RELEASE 2503
#ifndef CAP_PNG
#define CAP_PNG (!ISMOBWEB)
#endif
#ifndef CAP_ORIENTATION
#define CAP_ORIENTATION ISMOBILE
#endif
#ifndef CAP_COMMANDLINE
#define CAP_COMMANDLINE (!ISMOBILE)
#endif
#define CAP_SDLAUDIO (CAP_SDL && CAP_AUDIO)
#ifndef CAP_SVG
#define CAP_SVG (!ISMOBILE)
#endif
#ifndef CAP_POLY
#define CAP_POLY (CAP_SDLGFX || CAP_GL || CAP_SVG)
#endif
#define CAP_QUEUE CAP_POLY
#define CAP_CURVE CAP_POLY
#ifndef CAP_SDLJOY
#define CAP_SDLJOY (CAP_SDL && !ISWEB)
#endif
#ifndef CAP_SDL_IMG
#define CAP_SDL_IMG 0
#endif
#ifndef CAP_SDLTTF
#define CAP_SDLTTF (CAP_SDL && !ISMOBILE && !ISWEB)
#endif
#define CAP_GLFONT (CAP_GL && !ISMOBILE)
#ifndef CAP_TABFONT
#define CAP_TABFONT (ISWEB)
#endif
#ifndef CAP_CREATEFONT
#define CAP_CREATEFONT 0
#endif
#ifndef CAP_FIXEDSIZE
#define CAP_FIXEDSIZE (CAP_CREATEFONT || CAP_TABFONT ? 36 : 0)
#endif
#ifndef CAP_SHMUP
#define CAP_SHMUP 1
#endif
#ifdef ISSTEAM
#define CAP_ACHIEVE 1
#endif
#ifndef CAP_BITFIELD
#define CAP_BITFIELD (!ISWEB)
#endif
#ifndef CAP_ACHIEVE
#define CAP_ACHIEVE 0
#endif
#ifndef CAP_SHMUP_GOOD
#define CAP_SHMUP_GOOD (!ISMOBWEB)
#endif
extern int fontscale;
#if ISMOBILE
#define EXTRALICENSE "\n\nHyperRogue soundtrack by Shawn Parrotte (http://www.shawnparrotte.com), under the Creative Commons BY-SA 3.0 license, http://creativecommons.org/licenses/by-sa/3.0/"
#undef XEXTRALICENSE
bool buttonclicked;
void gdpush(int t);
#endif
#ifndef HYPERPATH
#define HYPERPATH ""
#endif
#include <stdio.h>
#if CAP_SDL
#include <SDL/SDL.h>
#if !ISMAC
#undef main
#endif
#if CAP_SDLAUDIO
#include <SDL/SDL_mixer.h>
#endif
#if CAP_SDLTTF
#include <SDL/SDL_ttf.h>
#endif
#if CAP_SDLGFX
#include <SDL/SDL_gfxPrimitives.h>
#endif
#elif !ISFAKEMOBILE
#define SDLK_F1 (123001)
#define SDLK_F2 (123002)
#define SDLK_F3 (123003)
#define SDLK_F4 (123004)
#define SDLK_F5 (123005)
#define SDLK_F6 (123006)
#define SDLK_F7 (123007)
#define SDLK_F8 (123008)
#define SDLK_F9 (123009)
#define SDLK_F10 (123010)
#define SDLK_ESCAPE (123099)
#define SDLK_F12 (123012)
#define SDLK_HOME (123013)
#define SDLK_LEFT (123014)
#define SDLK_RIGHT (123015)
#define SDLK_END (123016)
#define MIX_MAX_VOLUME 128
#define SDLK_UP (123021)
#define SDLK_DOWN (123022)
#define SDLK_PAGEUP (123023)
#define SDLK_PAGEDOWN (123024)
#define SDLK_RETURN (123025)
#define SDLK_KP1 (123031)
#define SDLK_KP2 (123032)
#define SDLK_KP3 (123033)
#define SDLK_KP4 (123034)
#define SDLK_KP5 (123035)
#define SDLK_KP6 (123036)
#define SDLK_KP7 (123037)
#define SDLK_KP8 (123038)
#define SDLK_KP9 (123039)
#define SDLK_KP_PERIOD (123051)
#define SDLK_KP_MINUS (123053)
#define SDLK_DELETE (123052)
#define SDLK_DELETE (123052)
#define SDLK_KP_ENTER (123054)
#define SDLK_BACKSPACE (123055)
typedef int SDL_Event;
typedef unsigned int Uint32;
#endif
#if ISWEB
extern "C" {
Uint8 *SDL_GetKeyState(void*);
}
// inline Uint8 *SDL_GetKeyState(void *v) { static Uint8 tab[1024]; return tab; }
#endif
#ifndef CAP_GLEW
#define CAP_GLEW (CAP_GL && !ISMOBILE && !ISMAC && !ISLINUX && !ISWEB)
#endif
#if CAP_GL
#if CAP_GLEW
#include <GL/glew.h>
#else
#define GL_GLEXT_PROTOTYPES 1
#if ISMAC
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <OpenGL/glext.h>
#elif ISIOS
// already included
#elif ISANDROID
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <GLES2/gl2.h>
#include <GLES3/gl3.h>
#define GLES_ONLY
#else
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glext.h>
#endif
#endif
#endif
#include <functional>
#include <memory>
#include <cmath>
#include <time.h>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <map>
#include <queue>
#include <stdexcept>
#include <array>
#include <set>
#ifdef USE_UNORDERED_MAP
#include <unordered_map>
#else
#define unordered_map map
#endif
using namespace std;
void addMessage(string s, char spamtype = 0);
#define ALPHA (M_PI*2/S7)
#define S7 ginf[geometry].sides
#define S3 ginf[geometry].vertex
#define hyperbolic_37 (S7 == 7 && S3 == 3)
#define hyperbolic_not37 ((S7 > 7 || S3 > 3) && hyperbolic)
#define weirdhyperbolic ((S7 > 7 || S3 > 3 || gp::on) && hyperbolic)
#define stdhyperbolic (S7 == 7 && S3 == 3 && !gp::on)
#define cgclass (ginf[geometry].cclass)
#define euclid (cgclass == gcEuclid)
#define sphere (cgclass == gcSphere)
#define hyperbolic (cgclass == gcHyperbolic)
#define elliptic (ginf[geometry].quotientstyle & qELLIP)
#define quotient (ginf[geometry].quotientstyle & (qZEBRA | qFIELD))
#define torus (ginf[geometry].quotientstyle & qTORUS)
#define doall (ginf[geometry].quotientstyle)
#define smallbounded (sphere || (quotient & qZEBRA) || torus)
#define bounded (sphere || quotient || torus)
#define a4 (S3 == 4)
#define a45 (S3 == 4 && S7 == 5)
#define a46 (S3 == 4 && S7 == 6)
#define a47 (S3 == 4 && S7 == 7)
#define a457 (S3 == 4 && S7 != 6)
#define a467 (S3 == 4 && S7 >= 6)
#define a38 (S7 == 8)
#define sphere4 (sphere && S7 == 4)
#define stdeuc (geometry == gNormal || geometry == gEuclid || geometry == gEuclidSquare)
#define smallsphere (S7 < 5)
#define bigsphere (S7 == 5)
#define ap4 (a4 && nonbitrunc)
#define euclid4 (euclid && a4)
#define euclid6 (euclid && !a4)
#define S6 (S3*2)
#define S42 (S7*S6)
#define S12 (S6*2)
#define S14 (S7*2)
#define S21 (S7*S3)
#define S28 (S7*4)
#define S36 (S6*6)
#define S84 (S7*S6*2)
#define MAX_EDGE 8
#define MAX_S3 4
#define MAX_S84 240
#include "compileunits.h"
namespace hr {
#if CU_INIT
int fontscale = 100;
@ -851,3 +416,4 @@ void playSound(cell*, const string &s, int vol) { printf("play sound: %s vol %d\
#endif
#endif
}

View File

@ -1,7 +1,7 @@
// Hyperbolic Rogue -- Orb Strategy Mode
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace inv {
namespace hr::inv {
bool on;
array<int, ittypes> usedup;

View File

@ -2,6 +2,8 @@
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
// land generation routines
bool safety = false;
@ -2485,3 +2487,5 @@ void setdist(cell *c, int d, cell *from) {
mapeditor::applyModelcell(c);
#endif
}
}

View File

@ -3,6 +3,8 @@
// land statistics and flags
namespace hr {
bool nodisplay(eMonster m) {
return
m == moIvyDead ||
@ -1415,3 +1417,4 @@ int checkLands() {
auto hookcl = addHook(hooks_args, 100, checkLands); */
}

View File

@ -5,6 +5,8 @@
#define NUMLAN 7
namespace hr {
const char *dnameof(eMonster m) { return minf[m].name; }
const char *dnameof(eLand l) { return linf[l].name; }
const char *dnameof(eWall w) { return winf[w].name; }
@ -391,3 +393,4 @@ string XLAT1(string x) {
string XLATT1(stringpar p) { return XLAT1(p.v); }
}

View File

@ -11,6 +11,8 @@
#include <dirent.h>
#endif
namespace hr {
namespace mapeditor {
struct editwhat {
@ -1794,3 +1796,4 @@ namespace mapeditor {
}
}

View File

@ -6,6 +6,7 @@
#define BLACKISH 0x404040
#define REDDISH 0x400000
namespace hr {
ld whatever = 0;
int PREC(ld x) {
@ -908,3 +909,4 @@ void showMessageLog() {
else if(doexiton(sym, uni)) popScreen();
};
}
}

View File

@ -4,6 +4,8 @@
// Routines concentrating on monster generation.
namespace hr {
bool timerghost = true;
int buildIvy(cell *c, int children, int minleaf) {
@ -705,3 +707,4 @@ void generateSnake(cell *c, int i) {
}
else c2->mondir = NODIR;
}
}

View File

@ -2,7 +2,7 @@
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
#if CAP_MODEL
namespace netgen {
namespace hr::netgen {
// We need a two-dimensional vector class for this.

View File

@ -1,6 +1,8 @@
// Hyperbolic Rogue -- built-in font
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
#if CAP_TABFONT
// compile with -DCAP_CREATEFONT=1 to generate this table
// this variant has been created for non-translated HyperRogue
@ -164,3 +166,4 @@ void generateFont(int ch, SDL_Surface *txt) {
}
}
#endif
}

View File

@ -3,6 +3,7 @@
#define ORBLINES 70
namespace hr {
// orbgen flags
namespace orbgenflags {
@ -548,3 +549,4 @@ void placeOceanOrbs(cell *c) {
}
}
}

View File

@ -4,6 +4,8 @@
// Orb-related routines
namespace hr {
bool markOrb(eItem it) {
if(!items[it]) return false;
orbused[it] = true;
@ -1396,3 +1398,4 @@ void orboflava(int i) {
forCellEx(c2, c) makelava(c2, i);
}
}
}

View File

@ -2,6 +2,8 @@
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
int gp_threecolor() {
if(!gp::on) return 0;
if((gp::param.first - gp::param.second) % 3 == 0) return 2;
@ -2011,3 +2013,4 @@ int val46(cell *c) {
return si.id;
}
}

View File

@ -2,6 +2,8 @@
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
void spill50(cell *c, eWall w, int r) {
c->wall = w;
if(r) for(int i=0; i<c->type; i++) spill50(createMov(c, i), w, r-1);
@ -443,3 +445,4 @@ void buildAutomatonRule(cell *c) {
}
// #define BUILDZEBRA
}

View File

@ -2,6 +2,8 @@
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
// === EMERALD PATTERN ===
// rules for the emeraldvalues of heptagons.
@ -1141,3 +1143,4 @@ int fifty_38(int f, int d) {
+ (((c + (dockflip[dock][d2]&3)) % 3) << 1)
+ (dockflip[dock][d2]&~3);
}
}

View File

@ -4,6 +4,8 @@
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
// draw the lines
static const int POLY_DRAWLINES = 1;
// draw the area
@ -3371,3 +3373,4 @@ NEWSHAPE
#endif
}

View File

@ -1,6 +1,8 @@
// Hyperbolic Rogue -- the mission screen
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
bool quitsaves() { return (items[itOrbSafety] && havesave); }
bool needConfirmation() {
@ -540,3 +542,4 @@ void showMissionScreen() {
dialog::highlight_text = contstr();
}
}

View File

@ -5,6 +5,8 @@
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
#if CAP_GL
#if !CAP_GLEW
#if ISLINUX
@ -214,3 +216,4 @@ void resetbuffer::reset() {
#endif
}
}

View File

@ -4,7 +4,7 @@
// Kohonen's self-organizing networks.
// This is a part of RogueViz, not a part of HyperRogue.
namespace kohonen {
namespace rogueviz::kohonen {
int cols;
@ -1125,11 +1125,10 @@ auto hooks = addHook(hooks_args, 100, readArgs);
auto hooks2 = addHook(hooks_frame, 50, levelline::draw);
}
void mark(cell *c) {
void rogueviz::mark(cell *c) {
using namespace kohonen;
if(kind == kKohonen && inited >= 1) {
distfrom = getNeuronSlow(c);
coloring();
}
}

View File

@ -4,7 +4,7 @@
// Kohonen's self-organizing networks.
// This is a part of RogueViz, not a part of HyperRogue.
namespace staircase {
namespace rogueviz::staircase {
using namespace hyperpoint_vec;

View File

@ -20,10 +20,10 @@
// hyper -tess <parameter file> -- visualize a horocyclic tesselation,
#include "rogueviz.h"
namespace rogueviz {
using namespace hr;
void init();
bool showlabels = false;
@ -935,9 +935,9 @@ string describe(shmup::monster *m) {
sort(alledges.begin(), alledges.end(), edgecmp);
::help = "Edges: ";
hr::help = "Edges: ";
if(vd.info) ::help = (*vd.info) + "\n" + help;
if(vd.info) hr::help = (*vd.info) + "\n" + help;
for(int j=0; j<size(alledges); j++) {
edgeinfo *ei = alledges[j];
@ -1984,8 +1984,8 @@ auto hooks =
#endif
addHook(clearmemory, 0, close);
};
#include "rogueviz-kohonen.cpp"
#include "rogueviz-staircase.cpp"
};

View File

@ -1,10 +1,26 @@
// See: http://www.roguetemple.com/z/hyper/rogueviz.php
namespace rogueviz {
using namespace hr;
extern bool on;
string describe(shmup::monster *m);
void describe(cell *c);
void activate(shmup::monster *m);
void drawVertex(const transmatrix &V, cell *c, shmup::monster *m);
bool virt(shmup::monster *m);
void turn(int delta);
void drawExtra();
void fixparam();
int readArgs();
void close();
void mark(cell *c);
void showMenu();
string makehelp();
void init();
struct edgeinfo {
struct edgeinfo {
int i, j;
double weight, weight2;
bool visible;
@ -14,13 +30,13 @@ struct edgeinfo {
edgeinfo() { visible = true; orig = NULL; lastdraw = -1; }
};
struct colorpair {
struct colorpair {
int color1, color2;
char shade;
colorpair(int col = 0xC0C0C0FF) { shade = 0; color1 = col; }
};
struct vertexdata {
struct vertexdata {
vector<pair<int, edgeinfo*> > edges;
string name;
colorpair cp;
@ -32,7 +48,7 @@ struct vertexdata {
vertexdata() { virt = NULL; m = NULL; info = NULL; special = false; }
};
extern vector<vertexdata> vdata;
extern vector<vertexdata> vdata;
void storeall();
@ -47,4 +63,29 @@ extern vector<vertexdata> vdata;
extern ld ggamma;
extern bool showlabels;
extern bool rog3;
extern bool rvwarp;
#if CAP_TOUR
namespace rvtour {
extern tour::slide rvslides[];
}
#endif
namespace kohonen {
extern int samples;
void showsample(int id);
void showsample(string id);
void describe(cell *c);
void steps();
void showMenu();
bool handleMenu(int sym, int uni);
}
namespace staircase {
extern bool on;
void showMenu();
void make_staircase();
}
}

View File

@ -3,6 +3,7 @@
// implementation of the Hypersian Rug mode
namespace hr {
#if CAP_RUG
@ -1666,7 +1667,7 @@ hyperpoint gethyper(ld x, ld y) {
videopar svid = vid;
setVidParam();
hyperpoint h = ::gethyper(px, py);
hyperpoint h = hr::gethyper(px, py);
vid = svid;
return h;
@ -1944,3 +1945,4 @@ namespace rug {
}
#endif
}

View File

@ -1,9 +1,11 @@
// Hyperbolic Rogue -- smart memory cleaner
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
bool memory_saving_mode = true;
#define LIM 150
static const int LIM = 150;
heptagon *last_cleared;
@ -168,3 +170,5 @@ bool is_cell_removed(cell *c) {
void set_if_removed(cell*& c, cell *val) {
if(is_cell_removed(c)) c = val;
}
}

View File

@ -3,7 +3,7 @@
#if CAP_SAVE
namespace scores {
namespace hr::scores {
vector<score> scores;
score *currentgame;

View File

@ -2,6 +2,8 @@
// If CAP_SHADER is 0, OpenGL 1.0 is used.
// If CAP_SHADER is 1, GLSL is used.
namespace hr {
#ifndef DEBUG_GL
#define DEBUG_GL 0
#endif
@ -640,3 +642,4 @@ void set_depthtest(bool b) {
}
}
}
}

View File

@ -4,6 +4,8 @@
// implementation of the shoot'em up mode
namespace hr {
extern int mousex, mousey;
extern bool clicked;
@ -368,7 +370,7 @@ void handleConfig(int sym, int uni) {
shmupcfg = !shmupcfg;
#if CAP_CONFIG
else if(uni == 'c')
::saveConfig();
hr::saveConfig();
#endif
else if(uni == 'n' || uni == 'N') {
vid.scfg.players += shiftmul > 0 ? 1 : -1;
@ -2263,7 +2265,7 @@ void moveBullet(monster *m, int delta) {
bool revive = m2->type == moMirrorSpirit && !m2->dead;
killMonster(m2, m->parent ? m->parent->type : moNone);
if(revive && m2->dead) {
::kills[moMirrorSpirit]--;
hr::kills[moMirrorSpirit]--;
multi::kills[cpid]--;
mirrorspirits++;
}
@ -3576,3 +3578,4 @@ auto hooks = addHook(clearmemory, 0, shmup::clearMemory) +
});
}
}

View File

@ -1,6 +1,8 @@
// Hyperbolic Rogue -- routines related to sounds
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr {
bool audio;
string musiclicense;
string musfname[landtypes];
@ -216,3 +218,4 @@ void playSound(cell *c, const string& fname, int vol) {
void resetmusic() {}
#endif
}

View File

@ -4,7 +4,7 @@
// See http://webmath2.unito.it/paginepersonali/sergio.console/CurveSuperfici/AG15.pdf for a nice reference
#if CAP_SURFACE
namespace surface {
namespace hr::surface {
using namespace hyperpoint_vec;

378
sysconfig.h Normal file
View File

@ -0,0 +1,378 @@
// Hyperbolic Rogue -- set compiler flags, and include all the required system headers
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
#ifdef MAC
#define ISMAC 1
#endif
#ifdef LINUX
#define ISLINUX 1
#endif
#ifdef WINDOWS
#define ISWINDOWS 1
#endif
#if ISSTEAM
#define NOLICENSE
#endif
#ifndef CAP_SHADER
#define CAP_SHADER CAP_GL
#endif
// OS settings
#ifndef ISMAC
#define ISMAC 0
#endif
#ifndef ISLINUX
#define ISLINUX 0
#endif
#ifndef ISWINDOWS
#define ISWINDOWS 0
#endif
#ifndef ISPANDORA
#define ISPANDORA 0
#endif
#ifndef ISIOS
#define ISIOS 0
#endif
#ifndef ISANDROID
#define ISANDROID 0
#endif
#ifndef ISWEB
#define ISWEB 0
#endif
#ifndef ISFAKEMOBILE
#define ISFAKEMOBILE 0
#endif
#define ISMOBILE (ISIOS || ISANDROID || ISFAKEMOBILE)
#define ISMOBWEB (ISMOBILE || ISWEB)
#ifndef ISMINI
#define ISMINI 0
#endif
#ifndef CAP_XGD
#define CAP_XGD (ISANDROID || ISFAKEMOBILE)
#endif
#define CAP_FRAMELIMIT (!ISMOBWEB)
#if ISMOBILE==1
#define EXTERNALFONT
#endif
#ifndef CAP_FILES
#define CAP_FILES 1
#endif
#ifndef CAP_INV
#define CAP_INV 1
#endif
#ifndef CAP_ANDROIDSHARE
#define CAP_ANDROIDSHARE (ISANDROID)
#endif
#ifndef CAP_SDL
#define CAP_SDL (!ISMOBILE)
#endif
#ifdef CAP_COMPASS
#define CAP_COMPASS ISMOBILE
#endif
#ifndef CAP_SDLGFX
#define CAP_SDLGFX (CAP_SDL && !ISWEB)
#endif
#ifndef CAP_GL
#define CAP_GL (ISMOBILE || CAP_SDL)
#endif
#ifndef CAP_AUDIO
#define CAP_AUDIO ((ISMOBILE || CAP_SDL) && !ISWEB && !ISMINI)
#endif
#define CAP_GLORNOT (CAP_GL && !ISWEB && !ISIOS)
#if ISSTEAM
#define CAP_DAILY 1
#endif
#ifndef CAP_DAILY
#define CAP_DAILY 0
#endif
#ifndef CAP_CERTIFY
#define CAP_CERTIFY 0
#endif
#ifndef CAP_RUG
#define CAP_RUG (!ISMINI && CAP_GL)
#endif
#ifndef CAP_SURFACE
#define CAP_SURFACE CAP_RUG
#endif
#ifndef CAP_EDIT
#define CAP_EDIT (CAP_FILES && !ISWEB && !ISMINI)
#endif
#ifndef CAP_ODS
#define CAP_ODS 0
#endif
#ifndef CAP_TEXTURE
#define CAP_TEXTURE (CAP_GL && (CAP_PNG || CAP_SDL_IMG) && !ISMINI)
#endif
#ifndef CAP_MODEL
#define CAP_MODEL (!ISMOBWEB && !ISMINI && CAP_SDLGFX)
#endif
#ifndef CAP_SAVE
#define CAP_SAVE (CAP_FILES && !ISWEB && !ISMINI)
#endif
#ifndef CAP_CONFIG
#define CAP_CONFIG (CAP_FILES && !ISWEB && !ISMINI)
#endif
#ifndef CAP_TRANS
#define CAP_TRANS (!ISWEB && !ISMINI)
#endif
#ifndef CAP_TOUR
#define CAP_TOUR (!ISWEB && !ISMINI)
#endif
#ifndef CAP_ROGUEVIZ
#define CAP_ROGUEVIZ 0
#endif
#ifndef CAP_PROFILING
#define CAP_PROFILING 0
#endif
#define PSEUDOKEY_WHEELDOWN 2501
#define PSEUDOKEY_WHEELUP 2502
#define PSEUDOKEY_RELEASE 2503
#ifndef CAP_PNG
#define CAP_PNG (!ISMOBWEB)
#endif
#ifndef CAP_ORIENTATION
#define CAP_ORIENTATION ISMOBILE
#endif
#ifndef CAP_COMMANDLINE
#define CAP_COMMANDLINE (!ISMOBILE)
#endif
#define CAP_SDLAUDIO (CAP_SDL && CAP_AUDIO)
#ifndef CAP_SVG
#define CAP_SVG (!ISMOBILE)
#endif
#ifndef CAP_POLY
#define CAP_POLY (CAP_SDLGFX || CAP_GL || CAP_SVG)
#endif
#define CAP_QUEUE CAP_POLY
#define CAP_CURVE CAP_POLY
#ifndef CAP_SDLJOY
#define CAP_SDLJOY (CAP_SDL && !ISWEB)
#endif
#ifndef CAP_SDL_IMG
#define CAP_SDL_IMG 0
#endif
#ifndef CAP_SDLTTF
#define CAP_SDLTTF (CAP_SDL && !ISMOBILE && !ISWEB)
#endif
#define CAP_GLFONT (CAP_GL && !ISMOBILE)
#ifndef CAP_TABFONT
#define CAP_TABFONT (ISWEB)
#endif
#ifndef CAP_CREATEFONT
#define CAP_CREATEFONT 0
#endif
#ifndef CAP_FIXEDSIZE
#define CAP_FIXEDSIZE (CAP_CREATEFONT || CAP_TABFONT ? 36 : 0)
#endif
#ifndef CAP_SHMUP
#define CAP_SHMUP 1
#endif
#ifdef ISSTEAM
#define CAP_ACHIEVE 1
#endif
#ifndef CAP_BITFIELD
#define CAP_BITFIELD (!ISWEB)
#endif
#ifndef CAP_ACHIEVE
#define CAP_ACHIEVE 0
#endif
#ifndef CAP_SHMUP_GOOD
#define CAP_SHMUP_GOOD (!ISMOBWEB)
#endif
#if ISMOBILE
#define EXTRALICENSE "\n\nHyperRogue soundtrack by Shawn Parrotte (http://www.shawnparrotte.com), under the Creative Commons BY-SA 3.0 license, http://creativecommons.org/licenses/by-sa/3.0/"
#undef XEXTRALICENSE
#endif
#ifndef HYPERPATH
#define HYPERPATH ""
#endif
#include <stdio.h>
#if CAP_SDL
#include <SDL/SDL.h>
#if !ISMAC
#undef main
#endif
#if CAP_SDLAUDIO
#include <SDL/SDL_mixer.h>
#endif
#if CAP_SDLTTF
#include <SDL/SDL_ttf.h>
#endif
#if CAP_SDLGFX
#include <SDL/SDL_gfxPrimitives.h>
#endif
#elif !ISFAKEMOBILE
#define SDLK_F1 (123001)
#define SDLK_F2 (123002)
#define SDLK_F3 (123003)
#define SDLK_F4 (123004)
#define SDLK_F5 (123005)
#define SDLK_F6 (123006)
#define SDLK_F7 (123007)
#define SDLK_F8 (123008)
#define SDLK_F9 (123009)
#define SDLK_F10 (123010)
#define SDLK_ESCAPE (123099)
#define SDLK_F12 (123012)
#define SDLK_HOME (123013)
#define SDLK_LEFT (123014)
#define SDLK_RIGHT (123015)
#define SDLK_END (123016)
#define MIX_MAX_VOLUME 128
#define SDLK_UP (123021)
#define SDLK_DOWN (123022)
#define SDLK_PAGEUP (123023)
#define SDLK_PAGEDOWN (123024)
#define SDLK_RETURN (123025)
#define SDLK_KP1 (123031)
#define SDLK_KP2 (123032)
#define SDLK_KP3 (123033)
#define SDLK_KP4 (123034)
#define SDLK_KP5 (123035)
#define SDLK_KP6 (123036)
#define SDLK_KP7 (123037)
#define SDLK_KP8 (123038)
#define SDLK_KP9 (123039)
#define SDLK_KP_PERIOD (123051)
#define SDLK_KP_MINUS (123053)
#define SDLK_DELETE (123052)
#define SDLK_DELETE (123052)
#define SDLK_KP_ENTER (123054)
#define SDLK_BACKSPACE (123055)
typedef int SDL_Event;
typedef unsigned int Uint32;
#endif
#if ISWEB
extern "C" {
Uint8 *SDL_GetKeyState(void*);
}
// inline Uint8 *SDL_GetKeyState(void *v) { static Uint8 tab[1024]; return tab; }
#endif
#ifndef CAP_GLEW
#define CAP_GLEW (CAP_GL && !ISMOBILE && !ISMAC && !ISLINUX && !ISWEB)
#endif
#if CAP_GL
#if CAP_GLEW
#include <GL/glew.h>
#else
#define GL_GLEXT_PROTOTYPES 1
#if ISMAC
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <OpenGL/glext.h>
#elif ISIOS
// already included
#elif ISANDROID
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <GLES2/gl2.h>
#include <GLES3/gl3.h>
#define GLES_ONLY
#else
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glext.h>
#endif
#endif
#endif
#include <functional>
#include <memory>
#include <cmath>
#include <time.h>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <map>
#include <queue>
#include <stdexcept>
#include <array>
#include <set>
#include <random>
#ifdef USE_UNORDERED_MAP
#include <unordered_map>
#else
#define unordered_map map
#endif
#if CAP_SDL
union SDL_Event;
#endif

View File

@ -4,6 +4,8 @@
// routines for: initializing/closing, loading/saving, and cheating
namespace hr {
bool need_reset_geometry = true;
bool game_active;
@ -1308,3 +1310,4 @@ addHook(hooks_removecells, 0, [] () {
for(int i=0; i<SHSIZE; i++) for(int p=0; p<MAXPLAYER; p++)
set_if_removed(shpos[p][i], NULL);
});;
}

View File

@ -8,7 +8,7 @@
#endif
#if CAP_TEXTURE
namespace texture {
namespace hr::texture {
cpatterntype cgroup;

View File

@ -1,7 +1,7 @@
// Hyperbolic Rogue -- the Tutorial/presentation
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace tour {
namespace hr::tour {
bool on;
@ -111,7 +111,7 @@ bool handleKeyTour(int sym, int uni) {
if(inhelp) slidehelp();
return true;
}
if(sym == '1' || sym == '2') { // || sym == '3') {
if(sym == '1' || sym == '2') { // || sym == '3')
int legal = slides[currentslide].flags & 7;
if(legal == LEGAL_NONE || legal == LEGAL_HYPERBOLIC) {

View File

@ -3,6 +3,8 @@
// basic utility functions
namespace hr {
long double sqr(long double x) { return x*x; }
string its(int i) { char buf[64]; sprintf(buf, "%d", i); return buf; }
string fts(float x) { char buf[64]; sprintf(buf, "%4.2f", x); return buf; }
@ -114,3 +116,4 @@ void profile_info() {
int whateveri, whateveri2;
purehookset hooks_tests;
}

View File

@ -5,6 +5,8 @@
// Yendor Quest, together with the Yendor Challenge
// also, the Pure Tactics Mode and the Peace Mode
namespace hr {
namespace peace { extern bool on; }
int hiitemsMax(eItem it) {
@ -1100,3 +1102,4 @@ namespace peace {
auto aNext = addHook(hooks_nextland, 100, getNext);
};
}