From b6f9298f0a024fe2c17fd9cf264c02039ab979e1 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Mon, 23 Dec 2019 22:21:04 +0100 Subject: [PATCH] removed classes.h --- classes.cpp | 364 ++++++++++++++++++++++++++++++++++++++++++++++++++- classes.h | 361 -------------------------------------------------- hyper.h | 17 ++- pattern2.cpp | 6 + 4 files changed, 374 insertions(+), 374 deletions(-) delete mode 100644 classes.h diff --git a/classes.cpp b/classes.cpp index 0d8d226e..437f99a7 100644 --- a/classes.cpp +++ b/classes.cpp @@ -419,12 +419,96 @@ const char *ruindesc = const char *rock_description = "Shoot the Space Rocks for score. Large Rocks will split into two smaller rocks."; - -monstertype minf[motypes] = { + +#if HDR +enum eSlimegroup { sgNone, sgCave, sgWater, sgFloorA, sgFloorB, sgVine, sgTree }; +#endif + +#if HDR +// we use CF not MF to avoid confusion with MF_ movement flags +static const flagtype CF_NOGHOST = Flag(0); +static const flagtype CF_RAIDER = Flag(1); +static const flagtype CF_PRINCESS = Flag(2); +static const flagtype CF_MIMIC = Flag(3); +static const flagtype CF_GOK = Flag(4); +static const flagtype CF_NONLIVING = Flag(5); +static const flagtype CF_METAL = Flag(6); +static const flagtype CF_STUNNABLE = Flag(7); +static const flagtype CF_HP = Flag(8); +static const flagtype CF_MOUNTABLE = Flag(9); +static const flagtype CF_FRIENDLY = Flag(10); +static const flagtype CF_PLAYER = Flag(11); +static const flagtype CF_BUG = Flag(12); +static const flagtype CF_IVY = Flag(13); +static const flagtype CF_PART = Flag(14); +static const flagtype CF_MUTANTIVY = Flag(15); +static const flagtype CF_ANYIVY = Flag(16); +static const flagtype CF_BULLET = Flag(17); +static const flagtype CF_DEMON = Flag(18); +static const flagtype CF_WORM = Flag(19); +static const flagtype CF_WITCH = Flag(20); +static const flagtype CF_BIRD = Flag(21); +static const flagtype CF_SLOWMOVER = Flag(22); +static const flagtype CF_MAGNETIC = Flag(23); +static const flagtype CF_SWITCH = Flag(24); +static const flagtype CF_GHOST = Flag(25); +static const flagtype CF_SHARK = Flag(26); +static const flagtype CF_SLIME = Flag(27); +static const flagtype CF_DRAGON = Flag(28); +static const flagtype CF_KRAKEN = Flag(29); +static const flagtype CF_NOBLOW = Flag(30); +static const flagtype CF_MULTITILE = Flag(31); +static const flagtype CF_LEADER = Flag(32); +static const flagtype CF_FLYING = Flag(33); +static const flagtype CF_ATTACK_THRU_VINE = Flag(34); +static const flagtype CF_ATTACK_NONADJACENT = Flag(35); +static const flagtype CF_NOHIGHLIGHT = Flag(36); +static const flagtype CF_INACTIVE = Flag(37); +static const flagtype CF_UNARMED = Flag(38); +static const flagtype CF_IGNORE_PLATE = Flag(39); +static const flagtype CF_BULL = Flag(40); +static const flagtype CF_TROLL = Flag(41); +static const flagtype CF_IGNORE_SMELL = Flag(42); +static const flagtype CF_RATLING = Flag(43); +static const flagtype CF_POWER = Flag(44); +static const flagtype CF_GHOSTMOVER = Flag(45); +static const flagtype CF_TECHNICAL = Flag(46); +static const flagtype CF_MOVED = Flag(47); +static const flagtype CF_FACING = Flag(48); +static const flagtype CF_FACE_UP = Flag(49); +static const flagtype CF_FACE_SIDE = Flag(50); + +enum eMonster { + #define MONSTER(a,b,c,d,e,f,g,h) d, + #include "content.cpp" + motypes + }; + +struct monstertype { + char glyph; + color_t color; + const char *name; + flagtype flags; + enum eMonster mgroup; + const char *help; + }; +#endif + +EX monstertype minf[motypes] = { #define MONSTER(a,b,c,d,e,f,g,h) {a,b,c,e,g,h}, #include "content.cpp" }; +#if HDR +#define NUM_GS 6 +struct genderswitch_t { + int gender; + eMonster m; + const char *name; + const char *desc; + }; +#endif + EX genderswitch_t genderswitch[NUM_GS] = { { GEN_F, moFalsePrincess, "False Princess", "Don't be fooled by this red-haired girl, or you will be stabbed if you come too close!"}, @@ -443,23 +527,139 @@ EX genderswitch_t genderswitch[NUM_GS] = { // --- items --- -itemtype iinf[ittypes] = { +#if HDR +enum eOrbshape { osNone, osLove, osRanged, osOffensive, osFriend, osUtility, osDirectional, osWarping }; + +static const flagtype ZERO = 0; + +static const flagtype IF_SHARD = Flag(0); +static const flagtype IF_FIREPROOF = Flag(1); +static const flagtype IF_PROTECTION = Flag(2); +static const flagtype IF_EMPATHY = Flag(3); +static const flagtype IF_RANGED = Flag(4); +static const flagtype IF_SHMUPLIFE = Flag(5); +static const flagtype IF_REVIVAL = Flag(6); + +// 0 = basic treasure, 1 = other item, 2 = power orb, 3 = not an item +#define IC_TREASURE 0 +#define IC_OTHER 1 +#define IC_ORB 2 +#define IC_NAI 3 + +struct itemtype { + char glyph; + color_t color; + const char *name; + int itemclass; + flagtype flags; + eOrbshape orbshape; + const char *help; + }; + +enum eItem { + #define ITEM(a,b,c,d,e,f,g,h,i) d, + #include "content.cpp" + ittypes + }; +#endif + +EX itemtype iinf[ittypes] = { #define ITEM(a,b,c,d,e,f,g,h,i) {a,b,c,e,f,h,i}, #include "content.cpp" }; // --- wall types --- -walltype winf[walltypes] = { +#if HDR +static const flagtype WF_WATER = Flag(0); +static const flagtype WF_BOAT = Flag(1); +static const flagtype WF_CHASM = Flag(2); +static const flagtype WF_NOFLIGHT = Flag(3); +static const flagtype WF_FIRE = Flag(4); +static const flagtype WF_THUMPER = Flag(5); +static const flagtype WF_ACTIVABLE = Flag(6); +static const flagtype WF_ALCHEMY = Flag(7); +static const flagtype WF_RED = Flag(8); +static const flagtype WF_WALL = Flag(9); +static const flagtype WF_PUSHABLE = Flag(10); +static const flagtype WF_CONE = Flag(11); +static const flagtype WF_STDTREE = Flag(12); +static const flagtype WF_GRAVE = Flag(13); +static const flagtype WF_REPTILE = Flag(14); +static const flagtype WF_HEATCOLOR = Flag(15); +static const flagtype WF_HIGHWALL = Flag(16); +static const flagtype WF_THORNY = Flag(17); +static const flagtype WF_TIMEOUT = Flag(18); +static const flagtype WF_CISLAND = Flag(19); +static const flagtype WF_SULPHURIC = Flag(20); +static const flagtype WF_HALFVINE = Flag(21); + +struct walltype { + char glyph; + color_t color; + const char *name; + flagtype flags; + int snakelevel; + eSlimegroup sg; + const char *help; + }; + +enum eWall { + #define WALL(a,b,c,d,e,f,g,h,i) d, + #include "content.cpp" + walltypes + }; +#endif + +EX walltype winf[walltypes] = { #define WALL(a,b,c,d,e,f,g,h,i) {a,b,c,e,g,h,i}, #include "content.cpp" }; -const landtype linf[landtypes] = { +// -- land types --- + +#if HDR +static const flagtype LF_GENERATE_ALL = Flag(0); +static const flagtype LF_ICY = Flag(1); +static const flagtype LF_GRAVITY = Flag(2); +static const flagtype LF_EQUI = Flag(3); +static const flagtype LF_WARPED = Flag(4); +static const flagtype LF_CYCLIC = Flag(5); +static const flagtype LF_TECHNICAL = Flag(6); +static const flagtype LF_MIRROR = Flag(7); +static const flagtype LF_SEA = Flag(8); +static const flagtype LF_COASTAL = Flag(9); +static const flagtype LF_PURESEA = Flag(10); +static const flagtype LF_ELEMENTAL = Flag(11); +static const flagtype LF_HAUNTED = Flag(12); +static const flagtype LF_TROLL = Flag(13); +static const flagtype LF_INMIRROR = Flag(14); +static const flagtype LF_INMIRRORORWALL = Flag(15); + +struct landtype { + color_t color; + const char *name; + flagtype flags; + eItem treasure; + const char *help; + }; + +enum eLand { + #define LAND(a,b,c,d,e,f,g) c, + #include "content.cpp" + landtypes + }; +#endif + +EX const landtype linf[landtypes] = { #define LAND(a,b,c,d,e,f,g) {a,b,d,e,g}, #include "content.cpp" }; +#if HDR +struct landtacinfo { eLand l; int tries, multiplier; }; +#endif + EX vector land_tac = { {laIce, 10, 1}, {laDesert, 10, 1}, {laHunting, 5, 2}, @@ -503,6 +703,94 @@ EX vector randlands = { laOvergrown, laWildWest, laWarpCoast, laRuins, laBull, laDragon, laReptile, laDocks }; +#if HDR +enum eGeometry { + gNormal, gEuclid, gSphere, gElliptic, gZebraQuotient, gFieldQuotient, gTorus, gOctagon, g45, g46, g47, gSmallSphere, gTinySphere, gEuclidSquare, gSmallElliptic, + gKleinQuartic, gBolza, gBolza2, gMinimal, gBinaryTiling, gArchimedean, + gMacbeath, gBring, gSchmutzM2, gSchmutzM3, gCrystal, gOctahedron, + gBinary3, gCubeTiling, gCell120, gECell120, gRhombic3, gBitrunc3, + gSpace534, gSpace435, + gCell5, + gCell8, gECell8, + gCell16, gECell16, + gCell24, gECell24, + gCell600, gECell600, + gHoroTris, gHoroRec, gHoroHex, + gField435, gField534, + gBinary4, gSol, + gKiteDart2, gKiteDart3, gNil, gProduct, gRotSpace, + gTernary, gNIH, gSolN, gInfOrder, gSpace336, gSpace344, gCrystal344, + gArnoldCat, gArbitrary, + gGUARD}; + +enum eGeometryClass { gcHyperbolic, gcEuclid, gcSphere, gcSolNIH, gcNil, gcProduct, gcSL2 }; + +enum class eVariation { bitruncated, pure, goldberg, irregular, dual }; + +typedef flagtype modecode_t; + +/** only the actual geometry */ +struct geometryinfo1 { + /** geometry class */ + eGeometryClass kind; + /** dimension of the gameplay (2 for crystal) */ + int gameplay_dimension; + /** dimension of the graphics, may be greater than gameplay_dimension with vid.always3 on */ + int graphical_dimension; + /** dimension of the homogeneous vector space used, usually graphical_dimension+1, but 3 in product */ + int homogeneous_dimension; + /** signature of the scalar product used */ + int sig[4]; + }; + +struct geometryinfo { + std::string tiling_name; + std::string quotient_name; + const char* menu_displayed_name; + const char* shortname; + int sides; + int vertex; + flagtype flags; + geometryinfo1 g; + modecode_t xcode; + std::array distlimit; // bitrunc, non-bitrunc + eVariation default_variation; + }; + +static const flagtype qBOUNDED = 1; +static const flagtype qANYQ = 2; +static const flagtype qNONORIENTABLE = 4; +static const flagtype qSMALL = 8; + +static const flagtype qFIELD = 16; +static const flagtype qDOCKS = 32; +static const flagtype qZEBRA = 64; + +static const flagtype qELLIPTIC = 128; + +static const flagtype qBINARY = 256; +static const flagtype qKITE = 512; + +static const flagtype qREGULAR = 1024; /* not set! */ +static const flagtype qARCHI = 2048; +static const flagtype qHYBRID = 4096; +static const flagtype qCRYSTAL = 8192; +static const flagtype qSOL = 16384; +static const flagtype qEXPERIMENTAL = 32768; +static const flagtype qNIH = 65536; + +static const flagtype qIDEAL = 131072; +static const flagtype qHUGE_BOUNDED = 262144; +static const flagtype qOPTQ = Flag(19); + +// note: dnext assumes that x&7 equals 7 +static const int SEE_ALL = 50; +static const int OINF = 100; + +extern eGeometry geometry; +extern eVariation variation; +#endif + static const flagtype qsNONOR = qANYQ | qSMALL | qBOUNDED | qNONORIENTABLE; static const flagtype qsNONORE = qsNONOR | qELLIPTIC; static const flagtype qsBQ = qANYQ | qSMALL | qBOUNDED; @@ -529,8 +817,9 @@ EX geometryinfo1 giNil = { gcNil, 3, 3, 4, {1,1, 1,0 } }; EX geometryinfo1 giProduct = { gcSL2, 3, 3, 4, {1,1, 1,0 } /* will be filled in product::configure() */ }; EX geometryinfo1 giSL2 = { gcSL2, 3, 3, 4, {1,1,-1,-1} }; + /** list of available geometries */ -vector ginf = { +EX vector ginf = { {"{7,3}", "none", "{7,3} (standard HyperRogue map)", "HR", 7, 3, 0, giHyperb2, 0, {{7, 5}}, eVariation::bitruncated}, {"{6,3}", "none", "{6,3} (euclidean Hex grid)", "euclid", 6, 3, qOPTQ, giEuclid2, 0, {{7, 7}}, eVariation::bitruncated}, {"{5,3}", "none", "{5,3} (dodecahedron)", "sphere", 5, 3, qsSMALLB, giSphere2, 0, {{SEE_ALL, SEE_ALL}}, eVariation::bitruncated}, @@ -599,13 +888,67 @@ vector ginf = { }; // bits: 9, 10, 15, 16, (reserved for later) 17, 18 +#if HDR +namespace mf { + static const flagtype azimuthal = 1; + static const flagtype cylindrical = 2; + static const flagtype equiarea = 4; + static const flagtype equidistant = 8; + static const flagtype conformal = 16; + static const flagtype euc_boring = 32; + static const flagtype space = 64; + static const flagtype hyper_only = 128; + static const flagtype hyper_or_torus = 256; + static const flagtype pseudocylindrical = 512; /* includes cylindrical */ + static const flagtype equivolume = 1024; + static const flagtype twopoint = 2048; + static const flagtype uses_bandshift = 4096; + + static const flagtype band = (cylindrical | pseudocylindrical | uses_bandshift); + static const flagtype pseudoband = (pseudocylindrical | uses_bandshift); + }; + +struct modelinfo { + const char *name_hyperbolic; + const char *name_euclidean; + const char *name_spherical; + + flagtype flags; + + int is_azimuthal; + int is_band; + int is_equiarea; + int is_equidistant; + int is_conformal; + const char* name; + }; + +enum eModel : int { + mdDisk, mdHalfplane, mdBand, mdPolygonal, mdFormula, + // 5..8. + mdEquidistant, mdEquiarea, mdBall, mdHyperboloid, + // 9..13 + mdHemisphere, mdBandEquidistant, mdBandEquiarea, mdSinusoidal, mdTwoPoint, + // 14..16 + mdFisheye, mdJoukowsky, mdJoukowskyInverted, + // 17..19 + mdRotatedHyperboles, mdSpiral, mdPerspective, + // 20..24 + mdEquivolume, mdCentralInversion, mdSimulatedPerspective, mdTwoHybrid, mdGeodesic, + // 25 + mdMollweide, mdCentralCyl, mdCollignon, mdHorocyclic, + // 29.. + mdGUARD, mdPixel, mdHyperboloidFlat, mdPolynomial, mdManual + }; +#endif + // remember to match the following mask when specifying codes for extra geometries: 0x78600 // (other bits are used for other information) #define X3(x) x, x, x /** list of available models (i.e., projections) */ -vector mdinf = { +EX vector mdinf = { {"disk/Gans", "general perspective", "general perspective", mf::azimuthal | mf::conformal}, {"half-plane", "inversion", "half-plane", mf::conformal}, {"band", "band", "Mercator", mf::band | mf::conformal}, @@ -641,4 +984,11 @@ vector mdinf = { #undef X3 +#if HDR +static inline bool orbProtection(eItem it) { return false; } // not implemented + +const eLand NOWALLSEP = laNone; +const eLand NOWALLSEP_USED = laWhirlpool; +#endif + } diff --git a/classes.h b/classes.h deleted file mode 100644 index 90897952..00000000 --- a/classes.h +++ /dev/null @@ -1,361 +0,0 @@ -// Hyperbolic Rogue -- items, monsters, walls, lands, descriptions, etc. -// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details - -/** \file classes.h - * \brief header file for content - */ - -namespace hr { - -typedef unsigned color_t; - -typedef unsigned long long flagtype; -#define Flag(i) (flagtype(1ull< distlimit; // bitrunc, non-bitrunc - eVariation default_variation; - }; - -static const flagtype qBOUNDED = 1; -static const flagtype qANYQ = 2; -static const flagtype qNONORIENTABLE = 4; -static const flagtype qSMALL = 8; - -static const flagtype qFIELD = 16; -static const flagtype qDOCKS = 32; -static const flagtype qZEBRA = 64; - -static const flagtype qELLIPTIC = 128; - -static const flagtype qBINARY = 256; -static const flagtype qKITE = 512; - -static const flagtype qREGULAR = 1024; /* not set! */ -static const flagtype qARCHI = 2048; -static const flagtype qHYBRID = 4096; -static const flagtype qCRYSTAL = 8192; -static const flagtype qSOL = 16384; -static const flagtype qEXPERIMENTAL = 32768; -static const flagtype qNIH = 65536; - -static const flagtype qIDEAL = 131072; -static const flagtype qHUGE_BOUNDED = 262144; -static const flagtype qOPTQ = Flag(19); - -// note: dnext assumes that x&7 equals 7 -static const int SEE_ALL = 50; - -extern eGeometry geometry; -extern eVariation variation; - -extern std::vector ginf; - -extern monstertype minf[motypes]; -extern itemtype iinf[ittypes]; - -extern const landtype linf[landtypes]; -extern color_t floorcolors[landtypes]; -extern walltype winf[walltypes]; - -enum cpatterntype { - cpFootball, cpThree, cpChess, cpSingle, cpSingleSym, cpOddEven, cpLarge, cpZebra, cpUnknown - }; - -struct landtacinfo { eLand l; int tries, multiplier; }; - -enum eModel { - mdDisk, mdHalfplane, mdBand, mdPolygonal, mdFormula, - // 5..8. - mdEquidistant, mdEquiarea, mdBall, mdHyperboloid, - // 9..13 - mdHemisphere, mdBandEquidistant, mdBandEquiarea, mdSinusoidal, mdTwoPoint, - // 14..16 - mdFisheye, mdJoukowsky, mdJoukowskyInverted, - // 17..19 - mdRotatedHyperboles, mdSpiral, mdPerspective, - // 20..24 - mdEquivolume, mdCentralInversion, mdSimulatedPerspective, mdTwoHybrid, mdGeodesic, - // 25 - mdMollweide, mdCentralCyl, mdCollignon, mdHorocyclic, - // 29.. - mdGUARD, mdPixel, mdHyperboloidFlat, mdPolynomial, mdManual - }; - -typedef unsigned long long flagtype; - -namespace mf { - static const flagtype azimuthal = 1; - static const flagtype cylindrical = 2; - static const flagtype equiarea = 4; - static const flagtype equidistant = 8; - static const flagtype conformal = 16; - static const flagtype euc_boring = 32; - static const flagtype space = 64; - static const flagtype hyper_only = 128; - static const flagtype hyper_or_torus = 256; - static const flagtype pseudocylindrical = 512; /* includes cylindrical */ - static const flagtype equivolume = 1024; - static const flagtype twopoint = 2048; - static const flagtype uses_bandshift = 4096; - - static const flagtype band = (cylindrical | pseudocylindrical | uses_bandshift); - static const flagtype pseudoband = (pseudocylindrical | uses_bandshift); - }; - -struct modelinfo { - const char *name_hyperbolic; - const char *name_euclidean; - const char *name_spherical; - - flagtype flags; - - int is_azimuthal; - int is_band; - int is_equiarea; - int is_equidistant; - int is_conformal; - const char* name; - }; - -extern std::vector mdinf; - -static const int OINF = 100; - -} diff --git a/hyper.h b/hyper.h index a665e026..ee808260 100644 --- a/hyper.h +++ b/hyper.h @@ -17,7 +17,6 @@ #define VERNUM_HEX 0xA80F #include "sysconfig.h" -#include "classes.h" #include #include "hyper_function.h" @@ -209,6 +208,8 @@ typedef long double ld; typedef complex cld; +typedef unsigned color_t; + struct charstyle { int charid; color_t skincolor, haircolor, dresscolor, swordcolor, dresscolor2, uicolor, eyecolor; @@ -217,6 +218,8 @@ struct charstyle { enum eStereo { sOFF, sAnaglyph, sLR, sODS }; +enum eModel : int; + struct videopar { ld scale, alpha, sspeed, mspeed, yshift, camera_angle; ld ballangle, ballproj, euclid_to_sphere, twopoint_param, fisheye_param, stretch, binary_width, fixed_facing_dir; @@ -665,8 +668,6 @@ extern bool longclick; extern bool useRangedOrb; #endif -static inline bool orbProtection(eItem it) { return false; } // not implemented - #ifndef GL typedef float GLfloat; #endif @@ -687,9 +688,6 @@ extern int emeraldtable[100][7]; // extern cell *cwpeek(cellwalker cw, int dir); -const eLand NOWALLSEP = laNone; -const eLand NOWALLSEP_USED = laWhirlpool; - #define HAUNTED_RADIUS getDistLimit() #define UNKNOWN 65535 @@ -756,6 +754,13 @@ static const color_t NOCOLOR = 0; static const int max_vec = (1<<14); extern bool needConfirmationEvenIfSaved(); +typedef unsigned long long flagtype; +#define Flag(i) (flagtype(1ull<