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

further cleanup

This commit is contained in:
Zeno Rogue 2019-08-09 23:39:36 +02:00
parent 65c4e6a31c
commit a76a5dd265
12 changed files with 33 additions and 125 deletions

View File

@ -128,7 +128,7 @@ int textwidth(int siz, const string &str) {
}
#endif
int darkenedby(int c, int lev) {
EX int darkenedby(int c, int lev) {
for(int i=0; i<lev; i++)
c = ((c & 0xFEFEFE) >> 1);
return c;

View File

@ -13,15 +13,19 @@ EX bool leftclick, rightclick, targetclick, hiliteclick, anyshiftclick, wheelcli
EX bool forcetarget, lshiftclick, lctrlclick, numlock_on;
EX bool gtouched;
bool holdmouse;
EX bool holdmouse;
EX int getcstat, lgetcstat;
ld getcshift;
EX ld getcshift;
EX bool inslider;
EX function <void(int sym, int uni)> keyhandler = [] (int sym, int uni) {};
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)
EX bool mousing = true;

View File

@ -86,7 +86,7 @@ eItem randomTreasure2(int cv) {
return best;
}
eLand cheatdest;
EX eLand cheatdest;
void cheatMoveTo(eLand l) {
cheatdest = l;
@ -212,7 +212,6 @@ bool applyCheat(char u, cell *c = NULL) {
cwt++;
mirror::act(1, mirror::SPINSINGLE);
wavephase = (1+wavephase) & 7;
if(shmup::on) shmup::pc[0]->at = Id;
return true;
}

View File

@ -6489,7 +6489,7 @@ EX void placeItems(int qty, eItem it) {
}
}
cellwalker recallCell;
EX cellwalker recallCell;
EX bool activateRecall() {
if(!recallCell.at) {

View File

@ -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
// 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(noHighlight(c->monst)) return OUTLINE_NONE;
if(c->monst) return OUTLINE_ENEMY;
@ -3886,8 +3886,6 @@ EX bool use_swapped_duals() {
return (masterless && !a4) || GOLDBERG;
}
int wavephase;
#if CAP_SHAPES
void floorShadow(cell *c, const transmatrix& V, color_t col) {
if(model_needs_depth() || noshadow)
@ -3993,7 +3991,7 @@ bool openorsafe(cell *c) {
#define Dark(x) darkena(x,0,0xFF)
color_t stdgridcolor = 0x202020FF;
EX color_t stdgridcolor = 0x202020FF;
int gridcolor(cell *c1, cell *c2) {
if(cmode & sm::DRAW) return Dark(forecolor);
@ -7241,8 +7239,6 @@ EX void drawthemap() {
noclipped = 0;
first_cell_to_draw = true;
wavephase = (-(ticks / 100)) & 7;
if(sightrange_bonus > 0 && !allowIncreasedSight())
sightrange_bonus = 0;

View File

@ -280,7 +280,7 @@ string forbidden_unmarked() {
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);

View File

@ -185,7 +185,7 @@ int glyphflags(int gid) {
return f;
}
bool graphglyph() {
EX bool graphglyph() {
// if(DIM == 3) return false;
return vid.graphglyph == 2 || (vid.graphglyph == 1 && vid.monmode);
}

97
hyper.h
View File

@ -1455,39 +1455,14 @@ namespace mapeditor {
inline string pick123() { return cts('1' + rand() % 3); }
inline string pick12() { return cts('1' + rand() % 2); }
extern int lowfar;
extern int maxreclevel, reclevel;
extern int detaillevel;
extern bool quitmainloop;
enum eGravity { gsNormal, gsLevitation, gsAnti };
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)
extern cellwalker recallCell;
extern eLand cheatdest;
void cheatMoveTo(eLand l);
void doOvergenerate();
void collectMessage(cell *c2, eItem which);
namespace quotientspace {
void build();
void clear();
@ -1717,10 +1692,6 @@ namespace linepatterns {
static const int DISTANCE_UNKNOWN = 127;
transmatrix atscreenpos(ld x, ld y, ld size);
hyperpoint mirrorif(const hyperpoint& V, bool b);
#define SETMOUSEKEY 5000
extern char mousekey;
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))); }
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>
template<class T, class U> int addHook(hookset<T>*& m, int prio, const U& hook) {
@ -1840,8 +1803,6 @@ namespace windmap {
}
#endif
extern int wavephase;
int getgametime();
string getgametime_s(int timespent = getgametime());
extern int stampbase;
@ -2206,68 +2167,10 @@ struct land_validity_t {
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;
#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 {
pair<int, bool> fieldval(cell *c);
}

View File

@ -6,6 +6,10 @@ namespace hr {
ld ghx, ghy, ghgx, ghgy;
hyperpoint ghpm = C0;
#if HDR
inline bool sphereflipped() { return sphere && vid.alpha > 1.1 && DIM == 3; }
#endif
void ghcheck(hyperpoint &ret, const hyperpoint &H) {
if(hypot(ret[0]-ghx, ret[1]-ghy) < hypot(ghgx-ghx, ghgy-ghy)) {
ghpm = H; ghgx = ret[0]; ghgy = ret[1];
@ -780,12 +784,12 @@ EX bool outofmap(hyperpoint h) {
return h[2] < .5;
}
hyperpoint mirrorif(const hyperpoint& V, bool b) {
EX hyperpoint mirrorif(const hyperpoint& V, bool b) {
if(b) return Mirror*V;
else return V;
}
transmatrix mirrorif(const transmatrix& V, bool b) {
EX transmatrix mirrorif(const transmatrix& V, bool b) {
if(b) return V*Mirror;
else return V;
}
@ -1120,7 +1124,7 @@ void hrmap_standard::draw() {
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;
Mat[DIM][DIM] = 1;
@ -1144,13 +1148,13 @@ transmatrix eumove(ld x, ld y) {
return Mat;
}
transmatrix eumove(int vec) {
EX transmatrix eumove(int vec) {
int x, y;
tie(x,y) = vec_to_pair(vec);
return eumove(x, y);
}
transmatrix eumovedir(int d) {
EX transmatrix eumovedir(int d) {
if(a4) {
d = d & 3;
switch(d) {
@ -1474,9 +1478,9 @@ void circle_around_center(ld radius, color_t linecol, color_t fillcol, PPR prio)
#endif
}
color_t periodcolor = 0x00FF0080;
color_t ringcolor = darkena(0xFF, 0, 0xFF);
color_t modelcolor = 0;
EX color_t periodcolor = 0x00FF0080;
EX color_t ringcolor = darkena(0xFF, 0, 0xFF);
EX color_t modelcolor = 0;
#if CAP_QUEUE
EX void draw_model_elements() {

View File

@ -15,7 +15,7 @@ EX string s0;
EX bool fixseed = false;
EX int startseed = 0;
eLand firstland0;
EX eLand firstland0;
EX void initAll() {
init_floorcolors();

View File

@ -530,7 +530,7 @@ EX eLand getNewLand(eLand old) {
return n;
}
vector<eLand> land_over = {
EX vector<eLand> land_over = {
laIce, laCaves, laDesert, laHunting, laMotion, laJungle, laAlchemist,
laCrossroads,
laMirror, laMirrorOld, laMinefield, laPalace, laPrincessQuest, laZebra, laSwitch, laReptile,
@ -551,12 +551,14 @@ vector<eLand> land_over = {
laWildWest, laHalloween, laDual, laSnakeNest, laMagnetic, laCA, laAsteroids
};
vector<eLand> landlist;
EX vector<eLand> landlist;
#if HDR
template<class T> void generateLandList(T t) {
landlist.clear();
for(auto l: land_over) if(t(l)) landlist.push_back(l);
}
#endif
EX eLand getLandForList(cell *c) {
eLand l = c->land;

View File

@ -2244,9 +2244,9 @@ namespace mapeditor {
}
#if CAP_EDIT
string levelfile = "hyperrogue.lev";
const char *loadlevel = NULL;
string picfile = "hyperrogue.pic";
EX string levelfile = "hyperrogue.lev";
EX const char *loadlevel = NULL;
EX string picfile = "hyperrogue.pic";
#if CAP_COMMANDLINE