HyperRogue  11.3d
game/visualization engine based on non-Euclidean geometry
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions | Variables
hyper.h File Reference

The main header file of HyperRogue. More...

#include "sysconfig.h"
#include <stdarg.h>
#include "hyper_function.h"
#include "savepng.h"
#include <functional>
#include "autohdr.h"

Classes

struct  hr::always_false
 
struct  hr::hr_exception
 
struct  hr::hr_shortest_path_exception
 
struct  hr::charstyle
 
struct  hr::videopar
 
struct  hr::grow_vector< T >
 
struct  hr::movedir
 
class  hr::hookset< T >
 
struct  hr::dynamicval< T >
 
struct  hr::colortable
 

Namespaces

 hr
 

Macros

#define VER   "11.3d"
 
#define VERNUM_HEX   0xA824
 
#define GEN_M   0
 
#define GEN_F   1
 
#define GEN_N   2
 
#define GEN_O   3
 
#define cginf   ginf[geometry]
 
#define S7   cginf.sides
 
#define S3   cginf.vertex
 
#define hyperbolic_37   (S7 == 7 && S3 == 3 && !bt::in() && !arcm::in())
 
#define hyperbolic_not37   ((S7 > 7 || S3 > 3 || bt::in() || arcm::in()) && hyperbolic)
 
#define weirdhyperbolic   ((S7 > 7 || S3 > 3 || !STDVAR || bt::in() || arcm::in()) && hyperbolic)
 
#define stdhyperbolic   (S7 == 7 && S3 == 3 && STDVAR && !bt::in() && !arcm::in())
 
#define cgflags   cginf.flags
 
#define cryst   (cgflags & qCRYSTAL)
 
#define experimental   (cgflags & qEXPERIMENTAL)
 
#define eubinary   (euclid || bt::in() || cryst || nil)
 
#define cgclass   (cginf.cclass)
 
#define euclid   (cgclass == gcEuclid)
 
#define sphere   (cgclass == gcSphere)
 
#define sol   (cgflags & qSOL)
 
#define nih   (cgflags & qNIH)
 
#define nil   (cgclass == gcNil)
 
#define sl2   (cgclass == gcSL2)
 
#define prod   (cgclass == gcProduct)
 
#define hybri   (cgflags & qHYBRID)
 
#define hyperbolic   (cgclass == gcHyperbolic)
 
#define nonisotropic   (among(cgclass, gcSolNIH, gcNil, gcSL2))
 
#define translatable   (euclid || nonisotropic)
 
#define nonorientable   (cgflags & qNONORIENTABLE)
 
#define elliptic   (cgflags & qELLIPTIC)
 
#define quotient   (cgflags & qANYQ)
 
#define smallbounded   (cgflags & qSMALL)
 
#define bounded   (cgflags & qBOUNDED)
 
#define doall   (bounded)
 
#define sphere_narcm   (sphere && !arcm::in())
 
#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   (S3 == 3 && S7 == 8)
 
#define sphere4   (sphere && S7 == 4)
 
#define stdeuc   (geometry == gNormal || geometry == gEuclid || geometry == gEuclidSquare)
 
#define smallsphere   (sphere_narcm && S7 < 5)
 
#define bigsphere   (sphere_narcm && S7 == 5)
 
#define S6   (S3*2)
 
#define MAX_S3   4
 
#define SG6   (S3==3?6:4)
 
#define SG3   (S3==3?3:2)
 
#define SG2   (S3==3?2:1)
 
#define GOLDBERG   (variation == eVariation::goldberg)
 
#define IRREGULAR   (variation == eVariation::irregular)
 
#define PURE   (variation == eVariation::pure)
 
#define BITRUNCATED   (variation == eVariation::bitruncated)
 
#define DUAL   (variation == eVariation::dual)
 
#define DUALMUL   (DUAL ? 2 : 1)
 
#define CHANGED_VARIATION   (variation != cginf.default_variation)
 
#define STDVAR   (PURE || BITRUNCATED)
 
#define NONSTDVAR   (!STDVAR)
 
#define VALENCE   (BITRUNCATED ? 3 : arcm::in() ? arcm::valence() : S3)
 
#define NUMWITCH   7
 
#define LB_YENDOR_CHALLENGE   40
 
#define LB_PURE_TACTICS   41
 
#define NUMLEADER   85
 
#define LB_PURE_TACTICS_SHMUP   49
 
#define LB_PURE_TACTICS_COOP   50
 
#define LB_RACING   81
 
#define LDF   "%lf"
 
#define PLDF   "lf"
 
#define AA_NOGL   1
 
#define AA_VERSION   2
 
#define AA_LINES   4
 
#define AA_POLY   8
 
#define AA_LINEWIDTH   16
 
#define AA_FONT   32
 
#define AA_MULTI   64
 
#define AA_MULTI16   128
 
#define WDIM   cginf.g.gameplay_dimension
 
#define GDIM   cginf.g.graphical_dimension
 
#define MDIM   cginf.g.homogeneous_dimension
 
#define LDIM   (MDIM-1)
 
#define cclass   g.kind
 
#define self   (*this)
 
#define BUGCOLORS   3
 
#define big_unlock   (inv::on && !chaosmode)
 
#define U5   (big_unlock ? 10 : 5)
 
#define U10   (big_unlock ? 25 : 10)
 
#define R10   (big_unlock ? 50 : 10)
 
#define R30   (big_unlock ? 100 : 30)
 
#define R60   (big_unlock ? 200 : 60)
 
#define R90   (big_unlock ? 300 : 90)
 
#define R200   (big_unlock ? 800 : 200)
 
#define R300   (big_unlock ? 1200 : 300)
 
#define R20   (big_unlock ? 30 : 20)
 
#define R100   (big_unlock ? 500 : 100)
 
#define HRANDMAX   0x7FFFFFFF
 
#define MD_WAIT   (-1)
 
#define MD_DROP   (-2)
 
#define MD_UNDECIDED   (-3)
 
#define MD_USE_ORB   (-4)
 
#define HELPFUN(x)   (help_delegate = x, "HELPFUN")
 
#define SAGEMELT   .1
 
#define PT(x, y)   ((tactic::on || quotient == 2 || daily::on) ? (y) : inv::on ? min(2*(y),x) : (x))
 
#define ROCKSNAKELENGTH   50
 
#define WORMLENGTH   15
 
#define PRIZEMUL   7
 
#define INF   9999
 
#define INFD   60
 
#define PINFD   125
 
#define BARLEV   ((ISANDROID||ISIOS||ISFAKEMOBILE||getDistLimit()<7)?(getDistLimit()<4?8:9):10)
 
#define BUGLEV   15
 
#define YDIST   101
 
#define MODECODES   (1ll<<61)
 
#define GUNRANGE   3
 
#define fakecellloop(ct)   for(cell *ct = (cell*)1; ct; ct=NULL)
 
#define forCellIdAll(ct, i, cf)   fakecellloop(ct) for(int i=0; i<(cf)->type && (ct=(cf)->move(i),true); i++)
 
#define forCellIdCM(ct, i, cf)   fakecellloop(ct) for(int i=0; i<(cf)->type && (ct=createMov((cf),i),true); i++)
 
#define forCellIdEx(ct, i, cf)   forCellIdAll(ct,i,cf) if(ct)
 
#define forCellEx(ct, cf)   forCellIdEx(ct,forCellEx ## __LINE__,cf)
 
#define forCellCM(ct, cf)   forCellIdCM(ct,forCellCM ## __LINE__,cf)
 
#define forCellAll(ct, cf)   forCellIdCM(ct,forCellAll ## __LINE__,cf)
 
#define AF_NORMAL   0
 
#define AF_TOUGH   Flag(0)
 
#define AF_MAGIC   Flag(1)
 
#define AF_STAB   Flag(2)
 
#define AF_LANCE   Flag(3)
 
#define AF_ONLY_ENEMY   Flag(4)
 
#define AF_ONLY_FRIEND   Flag(5)
 
#define AF_ONLY_FBUG   Flag(6)
 
#define AF_BACK   Flag(7)
 
#define AF_APPROACH   Flag(8)
 
#define AF_IGNORE_UNARMED   Flag(9)
 
#define AF_NOSHIELD   Flag(10)
 
#define AF_GETPLAYER   Flag(11)
 
#define AF_GUN   Flag(12)
 
#define AF_FAST   Flag(13)
 
#define AF_EAT   Flag(17)
 
#define MF_NOATTACKS   Flag(14)
 
#define MF_PATHDIST   Flag(15)
 
#define MF_ONLYEAGLE   Flag(16)
 
#define MF_MOUNT   Flag(18)
 
#define MF_NOFRIEND   Flag(19)
 
#define AF_SWORD   Flag(20)
 
#define AF_SWORD_INTO   Flag(21)
 
#define AF_MSG   Flag(22)
 
#define AF_MUSTKILL   Flag(23)
 
#define AF_NEXTTURN   Flag(24)
 
#define AF_FALL   Flag(25)
 
#define MF_STUNNED   Flag(26)
 
#define MF_IVY   Flag(27)
 
#define AF_HORNS   Flag(28)
 
#define AF_BULL   Flag(29)
 
#define AF_SIDE   Flag(30)
 
#define AF_CRUSH   Flag(31)
 
#define AF_PLAGUE   Flag(32)
 
#define AF_PSI   Flag(33)
 
#define IMAGEEXT   ".png"
 
#define DEFAULTCONTROL   (multi::players == 1 && !shmup::on && !multi::alwaysuse && !(rug::rugged && rug::renderonce))
 
#define DEFAULTNOR(sym)   (DEFAULTCONTROL || multi::notremapped(sym))
 
#define CAP_MENUSCALING   (ISPANDORA || ISMOBILE)
 
#define displayfrZ   displayfr
 
#define displayfrZH   dialog::zoom::displayfr_highlight
 
#define ORBBASE   0
 
#define mmscale(V, x)   (mmspatial ? (ivoryz ? mzscale(V,x) : mscale(V, x)) : (V))
 
#define SHADOW_WALL   0x60
 
#define SHADOW_SL   0x18
 
#define SHADOW_MON   0x30
 
#define OUTLINE_NONE   0x000000FF
 
#define OUTLINE_FRIEND   0x00FF00FF
 
#define OUTLINE_ENEMY   0xFF0000FF
 
#define OUTLINE_TREASURE   0xFFFF00FF
 
#define OUTLINE_ORB   0xFF8000FF
 
#define OUTLINE_OTHER   0xFFFFFFFF
 
#define OUTLINE_DEAD   0x800000FF
 
#define OUTLINE_TRANS   0
 
#define OUTLINE_DEFAULT   ((bordcolor << 8) + 0xFF)
 
#define OUTLINE_FORE   ((forecolor << 8) + 0xFF)
 
#define OUTLINE_BACK   ((backcolor << 8) + 0xFF)
 
#define MODELCOUNT   ((int) mdGUARD)
 
#define pmodel   (vid.vpmodel)
 
#define GLERR(call)   glError(call, __FILE__, __LINE__)
 
#define SHMUPTITLE   "shoot'em up mode"
 
#define NUMBERKEY   (interpret_as_direction(sym, uni) ? 0 : uni)
 
#define DKEY   (get_direction_key(sym, uni))
 
#define DIRECTIONKEY   (interpret_as_direction(sym, uni) ? uni : 0)
 
#define SHDIM   4
 
#define HAUNTED_RADIUS   getDistLimit()
 
#define UNKNOWN   65535
 
#define GRAIL_FOUND   0x4000
 
#define GRAIL_RADIUS_MASK   0x3FFF
 
#define BEHIND_LIMIT   1e-6
 
#define RING(i)   for(double i=0; i<=cgi.S84+1e-6; i+=SD3 * pow(.5, vid.linequality))
 
#define REVRING(i)   for(double i=cgi.S84; i>=-1e-6; i-=SD3 * pow(.5, vid.linequality))
 
#define PRING(i)   for(double i=0; i<=cgi.S84+1e-6; i+= pow(.5, vid.linequality))
 
#define REVPRING(i)   for(double i=cgi.S84; i>=-1e-6; i-=pow(.5, vid.linequality))
 
#define ONEMPTY   if(d == 7 && passable(c, NULL, 0) && !safety && !reptilecheat)
 
#define Flag(i)   (flagtype(1ull<<i))
 
#define LATE(x)   if(changes.on) { changes.at_commit([=] { x; }); return; }
 
#define hassert(condition)   if(condition) println(hlog, __FILE__, ":", __LINE__, ":", __func__, ": assertion failed: ", condition)
 
#define IS(z)   = z
 
#define IS(z)
 
#define EX
 

Typedefs

typedef double hr::ld
 
typedef complex< ld > hr::cld
 
typedef unsigned hr::color_t
 
typedef hookset< void()> * hr::purehookset
 
typedef function< void()> hr::reaction_t
 
typedef function< bool()> hr::bool_reaction_t
 
typedef function< int(struct cell *)> hr::cellfunction
 
typedef float hr::GLfloat
 
typedef array< GLfloat, 2 > hr::glvec2
 
typedef array< GLfloat, 3 > hr::glvec3
 
typedef array< GLfloat, 4 > hr::glvec4
 
typedef glvec4 hr::glvertex
 
typedef unsigned long long hr::flagtype
 

Enumerations

enum  eStereo { sOFF, sAnaglyph, sLR, sODS }
 
enum  PPR {
  ZERO, EUCLIDEAN_SKY, OUTCIRCLE, MOVESTAR,
  MINUSINF, BELOWBOTTOMm, BELOWBOTTOM, BELOWBOTTOMp,
  BELOWBOTTOM_FALLANIM, LAKEBOTTOM, HELLSPIKE, INLAKEWALLm,
  INLAKEWALL, INLAKEWALLp, INLAKEWALL_FALLANIM, BSHALLOW,
  SHALLOW, ASHALLOW, SUBLAKELEV, LAKELEV,
  BOATLEV, BOATLEV2, BOATLEV3, LAKEWALLm,
  LAKEWALL, LAKEWALLp, LAKEWALL_FALLANIM, FLOOR_TOWER,
  FLOOR, FLOOR_DRAGON, FLOORa, FLOORb,
  FLOORc, FLOORd, LIZEYE, BFLOOR,
  GFLOORa, GFLOORb, GFLOORc, WALLSHADOW,
  STRUCT0, STRUCT1, STRUCT2, STRUCT3,
  THORNS, WALL, REDWALLm, REDWALLs,
  REDWALLp, REDWALL, REDWALLm2, REDWALLs2,
  REDWALLp2, REDWALLt2, REDWALLm3, REDWALLs3,
  REDWALLp3, REDWALLt3, HEPTAMARK, ITEM_BELOW,
  ITEM, ITEMa, ITEMb, BIGSTATUE,
  WALL3m, WALL3s, WALL3p, WALL3,
  WALL3A, HIDDEN, GIANTSHADOW, TENTACLE0,
  TENTACLE1, ONTENTACLE, ONTENTACLE_EYES, ONTENTACLE_EYES2,
  MONSTER_SHADOW, MONSTER_FOOT, MONSTER_LEG, MONSTER_GROIN,
  MONSTER_SUBWPN, MONSTER_WPN, MONSTER_BODY, MONSTER_ARMOR0,
  MONSTER_ARMOR1, MONSTER_CLOAK, MONSTER_NECK, MONSTER_HEAD,
  MONSTER_FACE, MONSTER_EYE0, MONSTER_EYE1, MONSTER_HAIR,
  MONSTER_HAT0, MONSTER_HAT1, MONSTER_HOODCLOAK1, MONSTER_HOODCLOAK2,
  STUNSTARS, CARRIED, CARRIEDa, CARRIEDb,
  PARTICLE, SWORDMARK, MAGICSWORD, MISSILE,
  SKY, MINEMARK, ARROW, MOBILE_ARROW,
  LINE, TRANSPARENT_LAKE, TRANSPARENT_SHADOW, TRANSPARENT_WALL,
  SUPERLINE, TEXT, CIRCLE, MAX,
  DEFAULT = -1
}
 
enum  orbAction {
  roMouse, roKeyboard, roCheck, roMouseForce,
  roMultiCheck, roMultiGo
}
 

Functions

template<class T >
void hr::ignore (T &&)
 
template<class T , class V , class... U>
bool hr::among (T x, V y)
 
template<class T , class V , class... U>
bool hr::among (T x, V y, U... u)
 
EX void hr::addMessage (string s, char spamtype)
 
template<class T >
int hr::isize (const T &x)
 
void hr::IMAGESAVE (SDL_Surface *s, const char *fname)
 
PPR hr::operator+ (PPR x, int y)
 
PPR hr::operator- (PPR x, int y)
 
int hr::operator- (PPR x, PPR y)
 
EX color_t hr::darkena (color_t c, int lev, int a)
 
template<class T , class U >
int hr::addHook (hookset< T > *&m, int prio, const U &hook)
 
template<class T , class... U>
void hr::callhooks (hookset< T > *h, U... args)
 
template<class T , class V , class... U>
hr::callhandlers (V zero, hookset< T > *h, U &... args)
 
string hr::XLAT (string)
 
void hr::scores::load ()
 
int hr::textwidth (int siz, const string &str)
 
int hr::gl_width (int size, const char *s)
 
template<class T , class U >
void hr::eliminate_if (vector< T > &data, U pred)
 
template<class T >
array< T, 4 > hr::make_array (T a, T b, T c, T d)
 
template<class T >
array< T, 3 > hr::make_array (T a, T b, T c)
 
template<class T >
array< T, 2 > hr::make_array (T a, T b)
 
void hr::daily::setup ()
 
void hr::daily::split ()
 
void hr::daily::gifts ()
 
void hr::daily::turnoff ()
 
void hr::daily::showMenu ()
 
int hr::daily::find_daily_lbid (int id)
 
bool hr::daily::prevent_spawn_treasure_on (cell *c)
 
void hr::daily::handleQuit (int sev)
 
void hr::daily::uploadscore (bool really_final)
 
template<class T >
void hr::texture_order (const T &f)
 
bool hr::needConfirmationEvenIfSaved ()
 

Variables

bool hr::anticheat::tampered
 
int hr::andmode
 
bool hr::longclick
 
bool hr::useRangedOrb
 
int hr::emeraldtable [100][7]
 
int hr::daily::daily_id
 

Detailed Description

The main header file of HyperRogue.

Contains general utility macros, various value macros, using clauses for standard library functions, implementation of the basic connection_table, walker, cell and heptagon classes, and general routines which did not fit elsewhere

Macro Definition Documentation

◆ experimental

#define experimental   (cgflags & qEXPERIMENTAL)

convenience flag for geometries with major aspects missing

◆ LATE

#define LATE (   x)    if(changes.on) { changes.at_commit([=] { x; }); return; }

this macro is used to delay performing the action in case if everything is rolled back