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

more rearrangement

This commit is contained in:
Zeno Rogue 2017-10-29 12:46:57 +01:00
parent 8639a5b5e9
commit 00c9238bd6
11 changed files with 139 additions and 118 deletions

View File

@ -77,7 +77,7 @@ void upload_score(int id, int v);
string achievementMessage[3];
int achievementTimer;
// vector<string> achievementsReceived;
vector<string> achievementsReceived;
bool wrongMode(char flags) {
if(cheater) return true;

View File

@ -15,26 +15,6 @@ int dirdiff(int dd, int t) {
return dd;
}
struct cell : gcell {
char type; // 6 for hexagons, 7 for heptagons
// wall parameter, used for remaining power of Bonfires and Thumpers
char wparam;
// 'tmp' is used for:
// pathfinding algorithm used by monsters with atypical movement (which do not use pathdist)
// bugs' pathfinding algorithm
short aitmp;
uint32_t spintable;
int spin(int d) { return tspin(spintable, d); }
int spn(int d) { return tspin(spintable, d); }
int mirror(int d) { return tmirror(spintable, d); }
heptagon *master;
cell *mov[MAX_EDGE]; // meaning very similar to heptagon::move
};
int fixdir(int a, cell *c) { a %= c->type; if(a<0) a += c->type; return a; }
int cellcount = 0;

View File

@ -208,3 +208,5 @@ static const int SEE_ALL = 15;
static const int FORBIDDEN = -1;
extern eGeometry geometry;
extern geometryinfo ginf[gGUARD];

View File

@ -11,6 +11,8 @@
*/
const char* COLORBAR = "###";
namespace dialog {
namespace zoom {

View File

@ -1072,6 +1072,9 @@ bool outlawNearby(cell *c, int dist) {
// int monstersnear(cell *c, cell *nocount = NULL, eMonster who = moPlayer, cell *pushto = NULL) {
namespace stalemate {
vector<stalemate1> moves;
bool nextturn;
bool anyKilled() {
for(int i=0; i<size(moves); i++) if(moves[i].killed) return true;
return false;

View File

@ -16,14 +16,6 @@ cell *newCell(int type, heptagon *master);
// spintable functions
int tspin(uint32_t& t, int d) {
return (t >> (d<<2)) & 7;
}
int tmirror(uint32_t& t, int d) {
return (t >> ((d<<2)+3)) & 1;
}
void tsetspin(uint32_t& t, int d, int spin) {
t &= ~(15 << (d<<2));
t |= spin << (d<<2);

View File

@ -15,22 +15,6 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifdef MAC
#define ISMAC 1
#endif
#ifdef LINUX
#define ISLINUX 1
#endif
#ifdef WINDOWS
#define ISWINDOWS 1
#endif
#if ISSTEAM
#define NOLICENSE
#endif
#include "init.cpp"
#if ISLINUX
@ -473,6 +457,7 @@ hookset<int()> *hooks_args;
namespace arg {
int argc; char **argv;
int curphase;
auto ah = addHook(hooks_args, 0, readCommon);

94
hyper.h
View File

@ -94,8 +94,32 @@ struct gcell {
#define NOBARRIERS 9
struct heptagon;
struct heptspin;
struct cell;
inline int tspin(uint32_t& t, int d) { return (t >> (d<<2)) & 7; }
inline int tmirror(uint32_t& t, int d) { return (t >> ((d<<2)+3)) & 1; }
struct cell : gcell {
char type; // 6 for hexagons, 7 for heptagons
// wall parameter, used for remaining power of Bonfires and Thumpers
char wparam;
// 'tmp' is used for:
// pathfinding algorithm used by monsters with atypical movement (which do not use pathdist)
// bugs' pathfinding algorithm
short aitmp;
uint32_t spintable;
int spin(int d) { return tspin(spintable, d); }
int spn(int d) { return tspin(spintable, d); }
int mirror(int d) { return tmirror(spintable, d); }
heptagon *master;
cell *mov[MAX_EDGE]; // meaning very similar to heptagon::move
};
struct cellwalker;
// automaton state
@ -129,6 +153,7 @@ enum hstate { hsOrigin, hsA, hsB, hsError, hsA0, hsA1, hsB0, hsB1, hsC };
string XLAT(string x);
string cts(char c);
string its(int i);
int hrand(int i);
template<class T> int size(const T& x) {return int(x.size()); }
@ -172,7 +197,7 @@ void achievement_display();
void achievement_pump();
// achievements received this game
vector<string> achievementsReceived;
extern vector<string> achievementsReceived;
// game forward declarations
typedef unsigned long long flagtype;
@ -314,7 +339,7 @@ namespace multi {
void loadConfig(FILE *f);
void initConfig();
charstyle scs[MAXPLAYER];
extern charstyle scs[MAXPLAYER];
bool playerActive(int p);
int activePlayers();
@ -877,8 +902,8 @@ struct stalemate1 {
};
namespace stalemate {
vector<stalemate1> moves;
bool nextturn;
extern vector<stalemate1> moves;
extern bool nextturn;
bool isKilled(cell *c);
@ -1251,7 +1276,7 @@ namespace arg {
inline void init(int _argc, char **_argv) { argc=_argc-1; argv=_argv+1; }
int curphase;
extern int curphase;
inline void phaseerror(int x) {
printf("Command line error: cannot read command '%s' from phase %d in phase %d\n", args(), x, curphase);
@ -1523,7 +1548,8 @@ void setAppropriateOverview();
bool quitsaves();
extern bool sidescreen;
static const char* COLORBAR = "###";
extern const char* COLORBAR;
int textwidth(int siz, const string &str);
#define GLERR(call) glError(call, __FILE__, __LINE__)
@ -1664,7 +1690,7 @@ void selectLanguageScreen();
bool inscreenrange(cell *c);
bool allowIncreasedSight();
static bool orbProtection(eItem it) { return false; } // not implemented
static inline bool orbProtection(eItem it) { return false; } // not implemented
namespace windmap {
void create();
@ -1729,3 +1755,55 @@ int ctof(cell *c);
void modalDebug(cell *c);
int getDistLimit();
void drawqueue();
#ifndef GL
typedef float GLfloat;
#endif
struct qpoly {
transmatrix V;
GLfloat *tab;
int curveindex;
int cnt;
int outline;
double minwidth;
};
struct qline {
hyperpoint H1, H2;
int prf;
double width;
};
#define MAXQCHR 40
struct qchr {
char str[MAXQCHR];
int x, y, shift, size, frame;
int align;
};
struct qcir {
int x, y, size;
};
enum eKind { pkPoly, pkLine, pkString, pkCircle, pkShape, pkResetModel };
struct polytodraw {
eKind kind;
int prio, col;
union {
qpoly poly;
qline line;
qchr chr;
qcir cir;
double dvalue;
} u;
#if CAP_ROGUEVIZ
string* info;
polytodraw() { info = NULL; }
#endif
};

View File

@ -1,3 +1,19 @@
#ifdef MAC
#define ISMAC 1
#endif
#ifdef LINUX
#define ISLINUX 1
#endif
#ifdef WINDOWS
#define ISWINDOWS 1
#endif
#if ISSTEAM
#define NOLICENSE
#endif
#define VER "10.1h"
#define VERNUM 10108
#define VERNUM_HEX 0xA088
@ -179,7 +195,7 @@
#define CAP_SHMUP_GOOD (!ISMOBWEB)
#endif
int fontscale = 100;
extern int fontscale;
#if ISMOBILE
#define EXTRALICENSE "\n\nHyperRogue soundtrack by Shawn Parrotte (http://www.shawnparrotte.com), under the Creative Commons BY-SA 3.0 license, http://creativecommons.org/licenses/by-sa/3.0/"
@ -306,9 +322,31 @@ inline Uint8 *SDL_GetKeyState(void *v) { static Uint8 tab[1024]; return tab; }
using namespace std;
string s0;
void addMessage(string s, char spamtype = 0);
#define S7 ginf[geometry].sides
#define S3 ginf[geometry].vertex
#define weirdhyperbolic (S7 > 7 || S3 > 3)
#define S6 (S3*2)
#define S42 (S7*S6)
#define S12 (S6*2)
#define S14 (S7*2)
#define S21 (S7*S3)
#define S28 (S7*4)
#define S36 (S6*6)
#define S84 (S7*S6*2)
#define MAX_EDGE 8
#define MAX_S3 4
#define MAX_S84 240
#ifdef ONE_CU
#include "classes.h"
#include "hyper.h"
#else
int fontscale = 100;
#if ISANDROID
FILE *debfile;
#endif
@ -325,20 +363,7 @@ const char *musicfile = "";
const char *loadlevel = NULL;
#endif
#define S7 ginf[geometry].sides
#define S3 ginf[geometry].vertex
#define weirdhyperbolic (S7 > 7 || S3 > 3)
#define S6 (S3*2)
#define S42 (S7*S6)
#define S12 (S6*2)
#define S14 (S7*2)
#define S21 (S7*S3)
#define S28 (S7*4)
#define S36 (S6*6)
#define S84 (S7*S6*2)
#define MAX_EDGE 8
#define MAX_S3 4
#define MAX_S84 240
string s0;
#include "classes.cpp"
#include "hyper.h"
@ -788,3 +813,4 @@ void mobile_draw(MOBPAR_FORMAL) {
void playSound(cell*, const string &s, int vol) { printf("play sound: %s vol %d\n", s.c_str(), vol); }
#endif
#endif

View File

@ -28,55 +28,6 @@ struct hpcshape {
hpcshape *last = NULL;
#ifndef GL
typedef float GLfloat;
#endif
struct qpoly {
transmatrix V;
GLfloat *tab;
int curveindex;
int cnt;
int outline;
double minwidth;
};
struct qline {
hyperpoint H1, H2;
int prf;
double width;
};
#define MAXQCHR 40
struct qchr {
char str[MAXQCHR];
int x, y, shift, size, frame;
int align;
};
struct qcir {
int x, y, size;
};
enum eKind { pkPoly, pkLine, pkString, pkCircle, pkShape, pkResetModel };
struct polytodraw {
eKind kind;
int prio, col;
union {
qpoly poly;
qline line;
qchr chr;
qcir cir;
double dvalue;
} u;
#if CAP_ROGUEVIZ
string* info;
polytodraw() { info = NULL; }
#endif
};
vector<polytodraw> ptds;
polytodraw& lastptd() { return ptds[size(ptds)-1]; }

View File

@ -21,6 +21,8 @@ namespace shmupballs {
namespace multi {
charstyle scs[MAXPLAYER];
int players = 1;
cellwalker player[MAXPLAYER];
vector<int> revive_queue; // queue for revival