diff --git a/debug.cpp b/debug.cpp index d6d7626e..19ce0547 100644 --- a/debug.cpp +++ b/debug.cpp @@ -5,6 +5,7 @@ namespace hr { EX int steplimit = 0; EX int cstep; +EX bool buggyGeneration = false; EX vector buggycells; @@ -34,8 +35,6 @@ cell *pathTowards(cell *pf, cell *pt) { return NULL; } -bool buggyGeneration = false; - bool errorReported = false; void describeCell(cell *c) { @@ -575,7 +574,7 @@ void test_distances(int max) { println(hlog, "ok=", ok, " bad=", bad); } -void raiseBuggyGeneration(cell *c, const char *s) { +EX void raiseBuggyGeneration(cell *c, const char *s) { printf("procgen error (%p): %s\n", c, s); diff --git a/flags.cpp b/flags.cpp index a9bff975..fa2bd094 100644 --- a/flags.cpp +++ b/flags.cpp @@ -315,13 +315,13 @@ bool survivesFall(eMonster m) { return isBird(m) || m == moAirElemental || m == moSkeleton || isDragon(m) || m == moShadow || isGhostAether(m); } -bool checkOrb(eMonster m1, eItem orb) { +EX bool checkOrb(eMonster m1, eItem orb) { if(m1 == moPlayer) return markOrb(orb); if(isFriendly(m1)) return markEmpathy(orb); return false; } -bool checkOrb2(eMonster m1, eItem orb) { +EX bool checkOrb2(eMonster m1, eItem orb) { if(m1 == moPlayer) return markOrb2(orb); if(isFriendly(m1)) return markEmpathy2(orb); return false; diff --git a/game.cpp b/game.cpp index 0553457f..1375b9a8 100644 --- a/game.cpp +++ b/game.cpp @@ -87,7 +87,8 @@ int safetyseed; int showid = 0; -bool invismove = false, invisfish = false; // last move was invisible [due to Fish] +EX bool invismove = false; +EX bool invisfish = false; // last move was invisible [due to Fish] int noiseuntil; // noise until the given turn @@ -107,8 +108,8 @@ bool eq(short a, short b) { return a==b; } EX array items; EX array kills; -int explore[10], exploreland[10][landtypes], landcount[landtypes]; -map > hiitems; +EX int explore[10], exploreland[10][landtypes], landcount[landtypes]; +EX map > hiitems; bool orbused[ittypes], lastorbused[ittypes]; EX bool playermoved = true; // center on the PC? bool flipplayer = true; // flip the player image after move, do not flip after attack @@ -142,7 +143,7 @@ vector movesofgood[MAX_EDGE+1]; int first7; // the position of the first monster at distance 7 in dcal -cellwalker cwt; // single player character position +EX cellwalker cwt; // single player character position EX inline cell*& singlepos() { return cwt.at; } EX inline bool singleused() { return !(shmup::on || multi::players > 1); } @@ -311,6 +312,13 @@ EX void countLocalTreasure() { } } +#if HDR +static const int NO_TREASURE = 1; +static const int NO_YENDOR = 2; +static const int NO_GRAIL = 4; +static const int NO_LOVE = 8; +#endif + EX int gold(int no IS(0)) { int i = 0; if(!(no & NO_YENDOR)) i += items[itOrbYendor] * 50; @@ -565,6 +573,44 @@ EX bool anti_alchemy(cell *w, cell *from) { return alch1; } +#if HDR +#define P_MONSTER Flag(0) // can move through monsters +#define P_MIRROR Flag(1) // can move through mirrors +#define P_REVDIR Flag(2) // reverse direction movement +#define P_WIND Flag(3) // can move against the wind +#define P_GRAVITY Flag(4) // can move against the gravity +#define P_ISPLAYER Flag(5) // player-only moves (like the Round Table jump) +#define P_ONPLAYER Flag(6) // always can step on the player +#define P_FLYING Flag(7) // is flying +#define P_BULLET Flag(8) // bullet can fly through more things +#define P_MIRRORWALL Flag(9) // mirror images go through mirror walls +#define P_JUMP1 Flag(10) // first part of a jump +#define P_JUMP2 Flag(11) // second part of a jump +#define P_TELE Flag(12) // teleport onto +#define P_BLOW Flag(13) // Orb of Air -- blow, or push +#define P_AETHER Flag(14) // aethereal +#define P_FISH Flag(15) // swimming +#define P_WINTER Flag(16) // fire resistant +#define P_USEBOAT Flag(17) // can use boat +#define P_NOAETHER Flag(18) // disable AETHER +#define P_FRIENDSWAP Flag(19) // can move on friends (to swap with tem) +#define P_ISFRIEND Flag(20) // is a friend (can use Empathy + Winter/Aether/Fish combo) +#define P_LEADER Flag(21) // can push statues and use boats +#define P_MARKWATER Flag(22) // mark Orb of Water as used +#define P_EARTHELEM Flag(23) // Earth Elemental +#define P_WATERELEM Flag(24) // Water Elemental +#define P_IGNORE37 Flag(25) // ignore the triheptagonal board +#define P_CHAIN Flag(26) // for chaining moves with boats +#define P_DEADLY Flag(27) // suicide moves allowed +#define P_ROSE Flag(28) // rose smell +#define P_CLIMBUP Flag(29) // allow climbing up +#define P_CLIMBDOWN Flag(30) // allow climbing down +#define P_REPTILE Flag(31) // is reptile +#define P_VOID Flag(32) // void beast +#define P_PHASE Flag(33) // phasing movement +#define P_PULLMAGNET Flag(34) // pull the other part of the magnet +#endif + EX bool passable(cell *w, cell *from, flagtype flags) { bool revdir = (flags&P_REVDIR); bool vrevdir = revdir ^ bool(flags&P_VOID); @@ -2514,7 +2560,7 @@ EX void fightmessage(eMonster victim, eMonster attacker, bool stun, flagtype fla } } -EX void fallMonster(cell *c, flagtype flags) { +EX void fallMonster(cell *c, flagtype flags IS(0)) { attackMonster(c, flags, moNone); } diff --git a/graph.cpp b/graph.cpp index f6a67505..ebacba85 100644 --- a/graph.cpp +++ b/graph.cpp @@ -10,9 +10,9 @@ int last_firelimit, firelimit; EX int inmirrorcount = 0; -bool spatial_graphics; -bool wmspatial, wmescher, wmplain, wmblack, wmascii; -bool mmspatial, mmhigh, mmmon, mmitem; +EX bool spatial_graphics; +EX bool wmspatial, wmescher, wmplain, wmblack, wmascii; +EX bool mmspatial, mmhigh, mmmon, mmitem; EX int detaillevel = 0; @@ -620,7 +620,7 @@ void animallegs(const transmatrix& V, eMonster mo, color_t col, double footphase EX bool noshadow; #if CAP_SHAPES -void ShadowV(const transmatrix& V, const hpcshape& bp, PPR prio) { +EX void ShadowV(const transmatrix& V, const hpcshape& bp, PPR prio IS(PPR::MONSTER_SHADOW)) { if(WDIM == 2 && GDIM == 3 && bp.shs != bp.she) { auto& p = queuepolyat(V, bp, 0x18, PPR::TRANSPARENT_SHADOW); p.outline = 0; diff --git a/hud.cpp b/hud.cpp index 6487d2ca..3080fc1e 100644 --- a/hud.cpp +++ b/hud.cpp @@ -58,7 +58,16 @@ EX int subclass(int i) { #define GLYPH_TARGET 512 #define GLYPH_INSQUARE 1024 -eGlyphsortorder glyphsortorder; +#if HDR +enum eGlyphsortorder { + gsoFirstTop, gsoFirstBottom, + gsoLastTop, gsoLastBottom, + gsoLand, gsoValue, + gsoMAX + }; +#endif + +EX eGlyphsortorder glyphsortorder; int zero = 0; diff --git a/hyper.h b/hyper.h index 0f2fae18..326ea4e8 100644 --- a/hyper.h +++ b/hyper.h @@ -1165,64 +1165,6 @@ namespace polygonal { // passable flags -#define P_MONSTER Flag(0) // can move through monsters -#define P_MIRROR Flag(1) // can move through mirrors -#define P_REVDIR Flag(2) // reverse direction movement -#define P_WIND Flag(3) // can move against the wind -#define P_GRAVITY Flag(4) // can move against the gravity -#define P_ISPLAYER Flag(5) // player-only moves (like the Round Table jump) -#define P_ONPLAYER Flag(6) // always can step on the player -#define P_FLYING Flag(7) // is flying -#define P_BULLET Flag(8) // bullet can fly through more things -#define P_MIRRORWALL Flag(9) // mirror images go through mirror walls -#define P_JUMP1 Flag(10) // first part of a jump -#define P_JUMP2 Flag(11) // second part of a jump -#define P_TELE Flag(12) // teleport onto -#define P_BLOW Flag(13) // Orb of Air -- blow, or push -#define P_AETHER Flag(14) // aethereal -#define P_FISH Flag(15) // swimming -#define P_WINTER Flag(16) // fire resistant -#define P_USEBOAT Flag(17) // can use boat -#define P_NOAETHER Flag(18) // disable AETHER -#define P_FRIENDSWAP Flag(19) // can move on friends (to swap with tem) -#define P_ISFRIEND Flag(20) // is a friend (can use Empathy + Winter/Aether/Fish combo) -#define P_LEADER Flag(21) // can push statues and use boats -#define P_MARKWATER Flag(22) // mark Orb of Water as used -#define P_EARTHELEM Flag(23) // Earth Elemental -#define P_WATERELEM Flag(24) // Water Elemental -#define P_IGNORE37 Flag(25) // ignore the triheptagonal board -#define P_CHAIN Flag(26) // for chaining moves with boats -#define P_DEADLY Flag(27) // suicide moves allowed -#define P_ROSE Flag(28) // rose smell -#define P_CLIMBUP Flag(29) // allow climbing up -#define P_CLIMBDOWN Flag(30) // allow climbing down -#define P_REPTILE Flag(31) // is reptile -#define P_VOID Flag(32) // void beast -#define P_PHASE Flag(33) // phasing movement -#define P_PULLMAGNET Flag(34) // pull the other part of the magnet - -bool passable(cell *w, cell *from, flagtype flags); - -bool anti_alchemy(cell *w, cell *from); -bool isElemental(eLand l); -int coastval(cell *c, eLand base); -int getHauntedDepth(cell *c); -eLand randomElementalLand(); -bool notDippingForExtra(eItem i, eItem x); -void placePrizeOrb(cell *c); -void wandering(); -bool isSealand(eLand l); -int newRoundTableRadius(); -bool grailWasFound(cell *c); -extern bool buggyGeneration; -int buildIvy(cell *c, int children, int minleaf); -int celldistAltRelative(cell *c); -int roundTableRadius(cell *c); -eLand pickLandRPM(eLand old); -bool bearsCamelot(eLand l); - -extern bool safety; - #define SAGEMELT .1 #define TEMPLE_EACH (among(geometry, gHoroRec, gHoroHex, gKiteDart3) ? 3 : (sol && binarytiling) ? 6 : (WDIM == 3 && binarytiling) ? 2 : geometry == gSpace435 ? 4 : (WDIM == 3 && hyperbolic) ? 3 : 6) #define PT(x, y) ((tactic::on || quotient == 2 || daily::on) ? (y) : inv::on ? min(2*(y),x) : (x)) @@ -1240,58 +1182,10 @@ extern bool safety; #define BUGLEV 15 // #define BARLEV 9 -bool isKillable(cell *c); -bool isKillableSomehow(cell *c); - -bool isAlchAny(eWall w); -bool isAlchAny(cell *c); - #define YDIST 101 #define MODECODES (1ll<<61) -extern cellwalker cwt; // player character position - -extern array items; -extern array kills; - -extern int explore[10], exploreland[10][landtypes], landcount[landtypes]; - typedef flagtype modecode_t; -extern map > hiitems; - -extern eLand firstland, specialland; -bool pseudohept(cell *c); -bool pureHardcore(); -extern int cheater; -int airdist(cell *c); -bool eq(short a, short b); -extern vector dcal; // queue for cpdist -bool isPlayerOn(cell *c); -bool isFriendly(eMonster m); -bool isFriendly(cell *c); -bool isChild(cell *w, cell *killed); // is w killed if killed is killed? - -static const int NO_TREASURE = 1; -static const int NO_YENDOR = 2; -static const int NO_GRAIL = 4; -static const int NO_LOVE = 8; - -bool markOrb(eItem it); // mark the orb as 'used', return true if exists -bool markEmpathy(eItem it); // mark both the given orb and Empathy as 'used', return true if exists -bool markEmpathy2(eItem it); // as above, but next turn - -bool isMimic(eMonster m); -bool isMimic(cell *c); - -void fallMonster(cell *c, flagtype flags = 0); // kill monster due to terrain - -bool attackMonster(cell *c, flagtype flags, eMonster killer); - -bool isWorm(eMonster m); -bool isWorm(cell *c); -void empathyMove(cell *c, cell *cto, int dir); -bool isIvy(eMonster m); -bool isIvy(cell *c); #define GUNRANGE 3 @@ -1301,41 +1195,6 @@ bool isIvy(cell *c); #define IC_ORB 2 #define IC_NAI 3 -bool playerInPower(); -void activateFlash(); -void activateLightning(); -bool markOrb(eItem it); -bool markOrb2(eItem it); -void drainOrb(eItem it, int target = 0); -void useupOrb(eItem it, int qty); - -void initgame(); -bool haveRangedTarget(); -eItem targetRangedOrb(cell *c, orbAction a); -void reduceOrbPowers(); -int realstuntime(cell *c); - -extern bool invismove, invisfish; -bool attackingForbidden(cell *c, cell *c2); -void killOrStunMonster(cell *c2, eMonster who_killed); - -void useup(cell *c); // useup thumpers/bonfires -cell *playerpos(int i); - -bool makeflame(cell *c, int timeout, bool checkonly); -bool isPlayerInBoatOn(cell *c); -bool isPlayerInBoatOn(cell *c, int i); -void destroyBoats(cell *c, cell *cf, bool strandedToo); -extern int lastexplore; -extern int asteroids_generated, asteroid_orbs_generated; -extern eLand lastland; -bool againstRose(cell *cfrom, cell *cto); -bool withRose(cell *cfrom, cell *cto); - -extern ld bounded_mine_percentage; -extern int bounded_mine_quantity, bounded_mine_max; -void generate_mines(); - // loops #define fakecellloop(ct) for(cell *ct = (cell*)1; ct; ct=NULL) @@ -1387,17 +1246,6 @@ void generate_mines(); #define AF_SIDE Flag(30) // side attack #define AF_CRUSH Flag(31) // Crusher's delayed attack -bool canAttack(cell *c1, eMonster m1, cell *c2, eMonster m2, flagtype flags); - -extern int chaosmode; -extern bool chaosUnlocked; -extern bool chaosAchieved; -bool isTechnicalLand(eLand l); -int getGhostcount(); - -void raiseBuggyGeneration(cell *c, const char *s); -void verifyMutantAround(cell *c); - #if CAP_SDL #if CAP_PNG @@ -1411,28 +1259,12 @@ void IMAGESAVE(SDL_Surface *s, const char *fname); #endif -void drawscreen(); - -void buildAirmap(); - -// currently works for worms only -bool sameMonster(cell *c1, cell *c2); -cell *wormhead(cell *c); -eMonster getMount(int player_id); -eMonster haveMount(); - -bool isDragon(eMonster m); - // for some reason I need this to compile under OSX #if ISMAC extern "C" { void *_Unwind_Resume = 0; } #endif -void mountmove(cell *c, int spin, bool fp); -void mountmove(cell *c, int spin, bool fp, cell *ppos); -void mountswap(cell *c1, int spin1, bool fp1, cell *c2, int spin2, bool fp2); - template struct dynamicval { T& where; T backup; @@ -1463,11 +1295,6 @@ namespace stalemate { bool isPushto(cell *c); }; -extern int turncount; - -bool reduceOrbPower(eItem it, int cap); -bool checkOrb(eMonster m1, eItem orb); - namespace tortoise { extern int seekbits; int getRandomBits(); @@ -1613,10 +1440,6 @@ namespace mapeditor { bool drawUserShape(const transmatrix& V, eShapegroup group, int id, color_t color, cell *c, PPR prio = PPR::DEFAULT); } -#if CAP_SHAPES -void ShadowV(const transmatrix& V, const struct hpcshape& bp, PPR prio = PPR::MONSTER_SHADOW); -#endif - #define OUTLINE_NONE 0x000000FF #define OUTLINE_FRIEND 0x00FF00FF #define OUTLINE_ENEMY 0xFF0000FF @@ -1629,46 +1452,15 @@ void ShadowV(const transmatrix& V, const struct hpcshape& bp, PPR prio = PPR::MO #define OUTLINE_FORE ((forecolor << 8) + 0xFF) #define OUTLINE_BACK ((backcolor << 8) + 0xFF) -extern bool audio; -extern string musiclicense; -extern string musfname[landtypes]; -extern int musicvolume, effvolume; -void initAudio(); -bool loadMusicInfo(); -void handlemusic(); -void playSeenSound(cell *c); -void playSound(cell *c, const string& fname, int vol = 100); - inline string pick123() { return cts('1' + rand() % 3); } inline string pick12() { return cts('1' + rand() % 2); } -bool playerInBoat(int i); - extern int lowfar; -extern bool wmspatial, wmescher, wmplain, wmblack, wmascii; -extern bool mmspatial, mmhigh, mmmon, mmitem; -extern bool spatial_graphics; extern int maxreclevel, reclevel; -string explain3D(ld *param); - extern int detaillevel; extern bool quitmainloop; -enum eGlyphsortorder { - gsoFirstTop, gsoFirstBottom, - gsoLastTop, gsoLastBottom, - gsoLand, gsoValue, - gsoMAX - }; - -extern eGlyphsortorder glyphsortorder; - -void explodeMine(cell *c); -bool mayExplodeMine(cell *c, eMonster who); -void explosion(cell *c, int power, int central); -void explodeBarrel(cell *c); - enum eGravity { gsNormal, gsLevitation, gsAnti }; extern eGravity gravity_state, last_gravity_state; @@ -2269,6 +2061,8 @@ namespace princess { #define GRAIL_FOUND 0x4000 #define GRAIL_RADIUS_MASK 0x3FFF +extern vector dcal; + struct hrmap { virtual heptagon *getOrigin() { return NULL; } virtual cell *gamestart() { return getOrigin()->c7; } @@ -2680,6 +2474,8 @@ template<> struct saver : dsaver { #if CAP_SHAPES struct floorshape; +struct hpcshape; + struct qfloorinfo { transmatrix spin; const hpcshape *shape; diff --git a/landgen.cpp b/landgen.cpp index c1ec413f..a9873ab4 100644 --- a/landgen.cpp +++ b/landgen.cpp @@ -8,9 +8,9 @@ namespace hr { EX bool safety = false; -eLand lastland; +EX eLand lastland; -int lastexplore; +EX int lastexplore; EX bool randomPatternsMode = false; EX int randompattern[landtypes]; @@ -34,7 +34,7 @@ EX bool notDippingFor(eItem i) { return v >= hrand(10) + 10; } -bool notDippingForExtra(eItem i, eItem x) { +EX bool notDippingForExtra(eItem i, eItem x) { if(peace::on) return false; if(chaosmode > 1) return true; int v = items[i] - min(items[x], currentLocalTreasure); diff --git a/landlock.cpp b/landlock.cpp index 2938edde..5fe01999 100644 --- a/landlock.cpp +++ b/landlock.cpp @@ -69,7 +69,8 @@ EX eLand oppositeElement(eLand l, eLand l2) { // land unlocking -EX eLand firstland = laIce, specialland = laIce; +EX eLand firstland = laIce; +EX eLand specialland = laIce; EX int chaosmode = 0; diff --git a/monstergen.cpp b/monstergen.cpp index 366efa14..a8830a97 100644 --- a/monstergen.cpp +++ b/monstergen.cpp @@ -229,7 +229,7 @@ EX int getGhostTimer() { return shmup::on ? (shmup::curtime - lastexplore) / 350 : turncount - lastexplore; } -int getGhostcount() { +EX int getGhostcount() { if(peace::on) return 0; int t = getGhostTimer(); int ghostcount = 0; diff --git a/orbs.cpp b/orbs.cpp index 4c4af43c..909cab92 100644 --- a/orbs.cpp +++ b/orbs.cpp @@ -43,7 +43,7 @@ EX void useupOrb(eItem it, int qty) { if(items[it] < 0) items[it] = 0; } -EX void drainOrb(eItem it, int target) { +EX void drainOrb(eItem it, int target IS(0)) { if(items[it] > target) useupOrb(it, items[it] - target); } diff --git a/pattern2.cpp b/pattern2.cpp index 9d44cd75..db979425 100644 --- a/pattern2.cpp +++ b/pattern2.cpp @@ -1335,7 +1335,7 @@ int pattern_threecolor(cell *c) { // returns ishept in the normal tiling; // in the 'pure heptagonal' tiling, returns true for a set of cells // which roughly corresponds to the heptagons in the normal tiling -bool pseudohept(cell *c) { +EX bool pseudohept(cell *c) { #if CAP_IRR if(IRREGULAR) return irr::pseudohept(c); #endif diff --git a/sound.cpp b/sound.cpp index 1c833f4b..66570c87 100644 --- a/sound.cpp +++ b/sound.cpp @@ -3,11 +3,12 @@ namespace hr { -const char *musicfile = ""; -bool audio; -string musiclicense; -string musfname[landtypes]; -EX int musicvolume = 60, effvolume = 60; +EX const char *musicfile = ""; +EX bool audio; +EX string musiclicense; +EX string musfname[landtypes]; +EX int musicvolume = 60; +EX int effvolume = 60; EX eLand getCurrentLandForMusic() { eLand id = ((anims::center_music()) && centerover.at) ? centerover.at->land : cwt.at->land; @@ -206,7 +207,7 @@ string wheresounds = HYPERPATH "sounds/"; hookset *hooks_sound; -EX void playSound(cell *c, const string& fname, int vol) { +EX void playSound(cell *c, const string& fname, int vol IS(100)) { if(effvolume == 0) return; if(callhandlers(false, hooks_sound, fname, vol)) return; // printf("Play sound: %s\n", fname.c_str());