mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-07-01 01:12:52 +00:00
further cleanup
This commit is contained in:
parent
65c4e6a31c
commit
a76a5dd265
@ -128,7 +128,7 @@ int textwidth(int siz, const string &str) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int darkenedby(int c, int lev) {
|
EX int darkenedby(int c, int lev) {
|
||||||
for(int i=0; i<lev; i++)
|
for(int i=0; i<lev; i++)
|
||||||
c = ((c & 0xFEFEFE) >> 1);
|
c = ((c & 0xFEFEFE) >> 1);
|
||||||
return c;
|
return c;
|
||||||
|
@ -13,15 +13,19 @@ EX bool leftclick, rightclick, targetclick, hiliteclick, anyshiftclick, wheelcli
|
|||||||
EX bool forcetarget, lshiftclick, lctrlclick, numlock_on;
|
EX bool forcetarget, lshiftclick, lctrlclick, numlock_on;
|
||||||
EX bool gtouched;
|
EX bool gtouched;
|
||||||
|
|
||||||
bool holdmouse;
|
EX bool holdmouse;
|
||||||
|
|
||||||
EX int getcstat, lgetcstat;
|
EX int getcstat, lgetcstat;
|
||||||
ld getcshift;
|
EX ld getcshift;
|
||||||
EX bool inslider;
|
EX bool inslider;
|
||||||
|
|
||||||
EX function <void(int sym, int uni)> keyhandler = [] (int sym, int uni) {};
|
EX function <void(int sym, int uni)> keyhandler = [] (int sym, int uni) {};
|
||||||
EX function <bool(SDL_Event &ev)> joyhandler = [] (SDL_Event &ev) {return false;};
|
EX function <bool(SDL_Event &ev)> joyhandler = [] (SDL_Event &ev) {return false;};
|
||||||
|
|
||||||
|
#if HDR
|
||||||
|
// what part of the compass does 'skip turn'
|
||||||
|
static const auto SKIPFAC = .4;
|
||||||
|
#endif
|
||||||
|
|
||||||
// is the player using mouse? (used for auto-cross)
|
// is the player using mouse? (used for auto-cross)
|
||||||
EX bool mousing = true;
|
EX bool mousing = true;
|
||||||
|
@ -86,7 +86,7 @@ eItem randomTreasure2(int cv) {
|
|||||||
return best;
|
return best;
|
||||||
}
|
}
|
||||||
|
|
||||||
eLand cheatdest;
|
EX eLand cheatdest;
|
||||||
|
|
||||||
void cheatMoveTo(eLand l) {
|
void cheatMoveTo(eLand l) {
|
||||||
cheatdest = l;
|
cheatdest = l;
|
||||||
@ -212,7 +212,6 @@ bool applyCheat(char u, cell *c = NULL) {
|
|||||||
cwt++;
|
cwt++;
|
||||||
mirror::act(1, mirror::SPINSINGLE);
|
mirror::act(1, mirror::SPINSINGLE);
|
||||||
|
|
||||||
wavephase = (1+wavephase) & 7;
|
|
||||||
if(shmup::on) shmup::pc[0]->at = Id;
|
if(shmup::on) shmup::pc[0]->at = Id;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
2
game.cpp
2
game.cpp
@ -6489,7 +6489,7 @@ EX void placeItems(int qty, eItem it) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cellwalker recallCell;
|
EX cellwalker recallCell;
|
||||||
|
|
||||||
EX bool activateRecall() {
|
EX bool activateRecall() {
|
||||||
if(!recallCell.at) {
|
if(!recallCell.at) {
|
||||||
|
@ -2365,7 +2365,7 @@ bool chainAnimation(cell *c, transmatrix& V, cell *c2, int i, ld bonus, const tr
|
|||||||
// based on cell c and transmatrix V
|
// based on cell c and transmatrix V
|
||||||
// do change the zoom factor? do change the priorities?
|
// do change the zoom factor? do change the priorities?
|
||||||
|
|
||||||
int cellcolor(cell *c) {
|
EX int cellcolor(cell *c) {
|
||||||
if(isPlayerOn(c) || isFriendly(c)) return OUTLINE_FRIEND;
|
if(isPlayerOn(c) || isFriendly(c)) return OUTLINE_FRIEND;
|
||||||
if(noHighlight(c->monst)) return OUTLINE_NONE;
|
if(noHighlight(c->monst)) return OUTLINE_NONE;
|
||||||
if(c->monst) return OUTLINE_ENEMY;
|
if(c->monst) return OUTLINE_ENEMY;
|
||||||
@ -3886,8 +3886,6 @@ EX bool use_swapped_duals() {
|
|||||||
return (masterless && !a4) || GOLDBERG;
|
return (masterless && !a4) || GOLDBERG;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wavephase;
|
|
||||||
|
|
||||||
#if CAP_SHAPES
|
#if CAP_SHAPES
|
||||||
void floorShadow(cell *c, const transmatrix& V, color_t col) {
|
void floorShadow(cell *c, const transmatrix& V, color_t col) {
|
||||||
if(model_needs_depth() || noshadow)
|
if(model_needs_depth() || noshadow)
|
||||||
@ -3993,7 +3991,7 @@ bool openorsafe(cell *c) {
|
|||||||
|
|
||||||
#define Dark(x) darkena(x,0,0xFF)
|
#define Dark(x) darkena(x,0,0xFF)
|
||||||
|
|
||||||
color_t stdgridcolor = 0x202020FF;
|
EX color_t stdgridcolor = 0x202020FF;
|
||||||
|
|
||||||
int gridcolor(cell *c1, cell *c2) {
|
int gridcolor(cell *c1, cell *c2) {
|
||||||
if(cmode & sm::DRAW) return Dark(forecolor);
|
if(cmode & sm::DRAW) return Dark(forecolor);
|
||||||
@ -7241,8 +7239,6 @@ EX void drawthemap() {
|
|||||||
noclipped = 0;
|
noclipped = 0;
|
||||||
first_cell_to_draw = true;
|
first_cell_to_draw = true;
|
||||||
|
|
||||||
wavephase = (-(ticks / 100)) & 7;
|
|
||||||
|
|
||||||
if(sightrange_bonus > 0 && !allowIncreasedSight())
|
if(sightrange_bonus > 0 && !allowIncreasedSight())
|
||||||
sightrange_bonus = 0;
|
sightrange_bonus = 0;
|
||||||
|
|
||||||
|
2
help.cpp
2
help.cpp
@ -280,7 +280,7 @@ string forbidden_unmarked() {
|
|||||||
return XLAT("When the 'mark heptagons' option (hotkey '7') is on, moves between unmarked cells are forbidden.");
|
return XLAT("When the 'mark heptagons' option (hotkey '7') is on, moves between unmarked cells are forbidden.");
|
||||||
}
|
}
|
||||||
|
|
||||||
string generateHelpForItem(eItem it) {
|
EX string generateHelpForItem(eItem it) {
|
||||||
|
|
||||||
string help = helptitle(XLATN(iinf[it].name), iinf[it].color);
|
string help = helptitle(XLATN(iinf[it].name), iinf[it].color);
|
||||||
|
|
||||||
|
2
hud.cpp
2
hud.cpp
@ -185,7 +185,7 @@ int glyphflags(int gid) {
|
|||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool graphglyph() {
|
EX bool graphglyph() {
|
||||||
// if(DIM == 3) return false;
|
// if(DIM == 3) return false;
|
||||||
return vid.graphglyph == 2 || (vid.graphglyph == 1 && vid.monmode);
|
return vid.graphglyph == 2 || (vid.graphglyph == 1 && vid.monmode);
|
||||||
}
|
}
|
||||||
|
97
hyper.h
97
hyper.h
@ -1455,39 +1455,14 @@ namespace mapeditor {
|
|||||||
inline string pick123() { return cts('1' + rand() % 3); }
|
inline string pick123() { return cts('1' + rand() % 3); }
|
||||||
inline string pick12() { return cts('1' + rand() % 2); }
|
inline string pick12() { return cts('1' + rand() % 2); }
|
||||||
|
|
||||||
extern int lowfar;
|
|
||||||
extern int maxreclevel, reclevel;
|
|
||||||
|
|
||||||
extern int detaillevel;
|
extern int detaillevel;
|
||||||
extern bool quitmainloop;
|
extern bool quitmainloop;
|
||||||
|
|
||||||
enum eGravity { gsNormal, gsLevitation, gsAnti };
|
enum eGravity { gsNormal, gsLevitation, gsAnti };
|
||||||
extern eGravity gravity_state, last_gravity_state;
|
extern eGravity gravity_state, last_gravity_state;
|
||||||
|
|
||||||
int gravityLevel(cell *c);
|
|
||||||
int gravityLevelDiff(cell *c, cell *f);
|
|
||||||
void fullcenter();
|
|
||||||
void movecost(cell* from, cell *to, int phase); // 1 = pre-collect, 2 = post-collect, 3 = both
|
|
||||||
void checkmove();
|
|
||||||
|
|
||||||
transmatrix eumove(ld x, ld y);
|
|
||||||
transmatrix eumove(int vec);
|
|
||||||
transmatrix eumovedir(int d);
|
|
||||||
|
|
||||||
int reptilemax();
|
|
||||||
|
|
||||||
extern bool mousing;
|
|
||||||
#define IFM(x) (mousing?"":x)
|
#define IFM(x) (mousing?"":x)
|
||||||
|
|
||||||
extern cellwalker recallCell;
|
|
||||||
|
|
||||||
extern eLand cheatdest;
|
|
||||||
void cheatMoveTo(eLand l);
|
|
||||||
|
|
||||||
void doOvergenerate();
|
|
||||||
|
|
||||||
void collectMessage(cell *c2, eItem which);
|
|
||||||
|
|
||||||
namespace quotientspace {
|
namespace quotientspace {
|
||||||
void build();
|
void build();
|
||||||
void clear();
|
void clear();
|
||||||
@ -1717,10 +1692,6 @@ namespace linepatterns {
|
|||||||
|
|
||||||
static const int DISTANCE_UNKNOWN = 127;
|
static const int DISTANCE_UNKNOWN = 127;
|
||||||
|
|
||||||
transmatrix atscreenpos(ld x, ld y, ld size);
|
|
||||||
|
|
||||||
hyperpoint mirrorif(const hyperpoint& V, bool b);
|
|
||||||
|
|
||||||
#define SETMOUSEKEY 5000
|
#define SETMOUSEKEY 5000
|
||||||
extern char mousekey;
|
extern char mousekey;
|
||||||
extern char newmousekey;
|
extern char newmousekey;
|
||||||
@ -1728,14 +1699,6 @@ void displaymm(char c, int x, int y, int rad, int size, const string& title, int
|
|||||||
|
|
||||||
template<class T, class... U> T pick(T x, U... u) { std::initializer_list<T> i = {x,u...}; return *(i.begin() + hrand(1+sizeof...(u))); }
|
template<class T, class... U> T pick(T x, U... u) { std::initializer_list<T> i = {x,u...}; return *(i.begin() + hrand(1+sizeof...(u))); }
|
||||||
|
|
||||||
int darkenedby(int c, int lev);
|
|
||||||
extern ld mouseaim_sensitivity;
|
|
||||||
string generateHelpForItem(eItem it);
|
|
||||||
bool graphglyph();
|
|
||||||
extern bool hiliteclick;
|
|
||||||
extern int antialiaslines;
|
|
||||||
extern color_t ringcolor, periodcolor, modelcolor, stdgridcolor;
|
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
template<class T, class U> int addHook(hookset<T>*& m, int prio, const U& hook) {
|
template<class T, class U> int addHook(hookset<T>*& m, int prio, const U& hook) {
|
||||||
@ -1840,8 +1803,6 @@ namespace windmap {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int wavephase;
|
|
||||||
|
|
||||||
int getgametime();
|
int getgametime();
|
||||||
string getgametime_s(int timespent = getgametime());
|
string getgametime_s(int timespent = getgametime());
|
||||||
extern int stampbase;
|
extern int stampbase;
|
||||||
@ -2206,68 +2167,10 @@ struct land_validity_t {
|
|||||||
string msg;
|
string msg;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern vector<eLand> landlist;
|
|
||||||
template<class T> void generateLandList(T t);
|
|
||||||
land_validity_t& land_validity(eLand l);
|
|
||||||
bool isLandIngame(eLand l);
|
|
||||||
|
|
||||||
bool inmirrororwall(eLand l);
|
|
||||||
extern bool holdmouse;
|
|
||||||
|
|
||||||
// what part of the compass does 'skip turn'
|
|
||||||
static const auto SKIPFAC = .4;
|
|
||||||
|
|
||||||
bool haveMobileCompass();
|
|
||||||
bool handleCompass();
|
|
||||||
|
|
||||||
inline bool sphereflipped() { return sphere && vid.alpha > 1.1 && DIM == 3; }
|
|
||||||
int cellcolor(cell *c);
|
|
||||||
extern ld backbrightness;
|
|
||||||
|
|
||||||
void initcells();
|
|
||||||
extern const hyperpoint C02, C03;
|
extern const hyperpoint C02, C03;
|
||||||
|
|
||||||
#define C0 (DIM == 2 ? C02 : C03)
|
#define C0 (DIM == 2 ? C02 : C03)
|
||||||
|
|
||||||
extern long long circlesize[100], disksize[100];
|
|
||||||
extern ld circlesizeD[10000];
|
|
||||||
void computeSizes();
|
|
||||||
|
|
||||||
#if CAP_FILES
|
|
||||||
extern const char *scorefile;
|
|
||||||
extern const char *conffile;
|
|
||||||
extern string levelfile;
|
|
||||||
extern string picfile;
|
|
||||||
extern const char *musicfile;
|
|
||||||
extern const char *loadlevel;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern bool fixseed;
|
|
||||||
extern eLand firstland0;
|
|
||||||
extern int startseed;
|
|
||||||
|
|
||||||
// heptspin hsstep(const heptspin &hs, int spin);
|
|
||||||
|
|
||||||
ld hdist0(const hyperpoint& mh);
|
|
||||||
|
|
||||||
extern bool fading;
|
|
||||||
extern ld fadeout;
|
|
||||||
int itemclass(eItem i);
|
|
||||||
int monsterclass(eMonster m);
|
|
||||||
|
|
||||||
extern purehookset hooks_drawmap;
|
|
||||||
extern hookset<bool(eLand&)> *hooks_music;
|
|
||||||
extern hookset<bool()> *hooks_prestats;
|
|
||||||
extern purehookset hooks_fixticks;
|
|
||||||
|
|
||||||
void sdltogl(SDL_Surface *txt, struct glfont_t& f, int ch);
|
|
||||||
|
|
||||||
void showStartMenu();
|
|
||||||
|
|
||||||
bool polara50(int x);
|
|
||||||
bool polara50(cell *c);
|
|
||||||
int fiftyval049(cell *c);
|
|
||||||
|
|
||||||
namespace fieldpattern {
|
namespace fieldpattern {
|
||||||
pair<int, bool> fieldval(cell *c);
|
pair<int, bool> fieldval(cell *c);
|
||||||
}
|
}
|
||||||
|
20
hypgraph.cpp
20
hypgraph.cpp
@ -6,6 +6,10 @@ namespace hr {
|
|||||||
ld ghx, ghy, ghgx, ghgy;
|
ld ghx, ghy, ghgx, ghgy;
|
||||||
hyperpoint ghpm = C0;
|
hyperpoint ghpm = C0;
|
||||||
|
|
||||||
|
#if HDR
|
||||||
|
inline bool sphereflipped() { return sphere && vid.alpha > 1.1 && DIM == 3; }
|
||||||
|
#endif
|
||||||
|
|
||||||
void ghcheck(hyperpoint &ret, const hyperpoint &H) {
|
void ghcheck(hyperpoint &ret, const hyperpoint &H) {
|
||||||
if(hypot(ret[0]-ghx, ret[1]-ghy) < hypot(ghgx-ghx, ghgy-ghy)) {
|
if(hypot(ret[0]-ghx, ret[1]-ghy) < hypot(ghgx-ghx, ghgy-ghy)) {
|
||||||
ghpm = H; ghgx = ret[0]; ghgy = ret[1];
|
ghpm = H; ghgx = ret[0]; ghgy = ret[1];
|
||||||
@ -780,12 +784,12 @@ EX bool outofmap(hyperpoint h) {
|
|||||||
return h[2] < .5;
|
return h[2] < .5;
|
||||||
}
|
}
|
||||||
|
|
||||||
hyperpoint mirrorif(const hyperpoint& V, bool b) {
|
EX hyperpoint mirrorif(const hyperpoint& V, bool b) {
|
||||||
if(b) return Mirror*V;
|
if(b) return Mirror*V;
|
||||||
else return V;
|
else return V;
|
||||||
}
|
}
|
||||||
|
|
||||||
transmatrix mirrorif(const transmatrix& V, bool b) {
|
EX transmatrix mirrorif(const transmatrix& V, bool b) {
|
||||||
if(b) return V*Mirror;
|
if(b) return V*Mirror;
|
||||||
else return V;
|
else return V;
|
||||||
}
|
}
|
||||||
@ -1120,7 +1124,7 @@ void hrmap_standard::draw() {
|
|||||||
|
|
||||||
int mindx=-7, mindy=-7, maxdx=7, maxdy=7;
|
int mindx=-7, mindy=-7, maxdx=7, maxdy=7;
|
||||||
|
|
||||||
transmatrix eumove(ld x, ld y) {
|
EX transmatrix eumove(ld x, ld y) {
|
||||||
transmatrix Mat = Id;
|
transmatrix Mat = Id;
|
||||||
Mat[DIM][DIM] = 1;
|
Mat[DIM][DIM] = 1;
|
||||||
|
|
||||||
@ -1144,13 +1148,13 @@ transmatrix eumove(ld x, ld y) {
|
|||||||
return Mat;
|
return Mat;
|
||||||
}
|
}
|
||||||
|
|
||||||
transmatrix eumove(int vec) {
|
EX transmatrix eumove(int vec) {
|
||||||
int x, y;
|
int x, y;
|
||||||
tie(x,y) = vec_to_pair(vec);
|
tie(x,y) = vec_to_pair(vec);
|
||||||
return eumove(x, y);
|
return eumove(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
transmatrix eumovedir(int d) {
|
EX transmatrix eumovedir(int d) {
|
||||||
if(a4) {
|
if(a4) {
|
||||||
d = d & 3;
|
d = d & 3;
|
||||||
switch(d) {
|
switch(d) {
|
||||||
@ -1474,9 +1478,9 @@ void circle_around_center(ld radius, color_t linecol, color_t fillcol, PPR prio)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
color_t periodcolor = 0x00FF0080;
|
EX color_t periodcolor = 0x00FF0080;
|
||||||
color_t ringcolor = darkena(0xFF, 0, 0xFF);
|
EX color_t ringcolor = darkena(0xFF, 0, 0xFF);
|
||||||
color_t modelcolor = 0;
|
EX color_t modelcolor = 0;
|
||||||
|
|
||||||
#if CAP_QUEUE
|
#if CAP_QUEUE
|
||||||
EX void draw_model_elements() {
|
EX void draw_model_elements() {
|
||||||
|
2
init.cpp
2
init.cpp
@ -15,7 +15,7 @@ EX string s0;
|
|||||||
EX bool fixseed = false;
|
EX bool fixseed = false;
|
||||||
EX int startseed = 0;
|
EX int startseed = 0;
|
||||||
|
|
||||||
eLand firstland0;
|
EX eLand firstland0;
|
||||||
|
|
||||||
EX void initAll() {
|
EX void initAll() {
|
||||||
init_floorcolors();
|
init_floorcolors();
|
||||||
|
@ -530,7 +530,7 @@ EX eLand getNewLand(eLand old) {
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<eLand> land_over = {
|
EX vector<eLand> land_over = {
|
||||||
laIce, laCaves, laDesert, laHunting, laMotion, laJungle, laAlchemist,
|
laIce, laCaves, laDesert, laHunting, laMotion, laJungle, laAlchemist,
|
||||||
laCrossroads,
|
laCrossroads,
|
||||||
laMirror, laMirrorOld, laMinefield, laPalace, laPrincessQuest, laZebra, laSwitch, laReptile,
|
laMirror, laMirrorOld, laMinefield, laPalace, laPrincessQuest, laZebra, laSwitch, laReptile,
|
||||||
@ -551,12 +551,14 @@ vector<eLand> land_over = {
|
|||||||
laWildWest, laHalloween, laDual, laSnakeNest, laMagnetic, laCA, laAsteroids
|
laWildWest, laHalloween, laDual, laSnakeNest, laMagnetic, laCA, laAsteroids
|
||||||
};
|
};
|
||||||
|
|
||||||
vector<eLand> landlist;
|
EX vector<eLand> landlist;
|
||||||
|
|
||||||
|
#if HDR
|
||||||
template<class T> void generateLandList(T t) {
|
template<class T> void generateLandList(T t) {
|
||||||
landlist.clear();
|
landlist.clear();
|
||||||
for(auto l: land_over) if(t(l)) landlist.push_back(l);
|
for(auto l: land_over) if(t(l)) landlist.push_back(l);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
EX eLand getLandForList(cell *c) {
|
EX eLand getLandForList(cell *c) {
|
||||||
eLand l = c->land;
|
eLand l = c->land;
|
||||||
|
@ -2244,9 +2244,9 @@ namespace mapeditor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if CAP_EDIT
|
#if CAP_EDIT
|
||||||
string levelfile = "hyperrogue.lev";
|
EX string levelfile = "hyperrogue.lev";
|
||||||
const char *loadlevel = NULL;
|
EX const char *loadlevel = NULL;
|
||||||
string picfile = "hyperrogue.pic";
|
EX string picfile = "hyperrogue.pic";
|
||||||
|
|
||||||
#if CAP_COMMANDLINE
|
#if CAP_COMMANDLINE
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user