mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-25 01:20:37 +00:00
improvements in documentation
This commit is contained in:
parent
8b1c7bffe4
commit
50e4990a76
@ -1,6 +1,12 @@
|
|||||||
// Hyperbolic Rogue -- items, monsters, walls, lands, descriptions, etc.
|
// Hyperbolic Rogue -- items, monsters, walls, lands, descriptions, etc.
|
||||||
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
|
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
|
||||||
|
|
||||||
|
/** \file classes.cpp
|
||||||
|
* \brief items, monsters, walls, lands, descriptions, etc.
|
||||||
|
*
|
||||||
|
* See content.cpp for actual items, monsters, walls and lands.
|
||||||
|
*/
|
||||||
|
|
||||||
namespace hr {
|
namespace hr {
|
||||||
|
|
||||||
// --- help ---
|
// --- help ---
|
||||||
@ -509,6 +515,7 @@ static const flagtype qsSMALLBF = qsSMALLB | qsFIELD;
|
|||||||
static const flagtype qsSMALLBE = qsSMALLB | qELLIPTIC;
|
static const flagtype qsSMALLBE = qsSMALLB | qELLIPTIC;
|
||||||
static const flagtype qsBP = qBINARY | qPENROSE;
|
static const flagtype qsBP = qBINARY | qPENROSE;
|
||||||
|
|
||||||
|
/** list of available geometries */
|
||||||
vector<geometryinfo> ginf = {
|
vector<geometryinfo> ginf = {
|
||||||
{"{7,3}", "none", "{7,3} (standard HyperRogue map)", "HR", 7, 3, 0, gcHyperbolic, 0, {{7, 5}}, eVariation::bitruncated},
|
{"{7,3}", "none", "{7,3} (standard HyperRogue map)", "HR", 7, 3, 0, gcHyperbolic, 0, {{7, 5}}, eVariation::bitruncated},
|
||||||
{"{6,3}", "none", "{6,3} (euclidean Hex grid)", "euclid", 6, 3, 0, gcEuclid, 0, {{7, FORBIDDEN}}, eVariation::bitruncated},
|
{"{6,3}", "none", "{6,3} (euclidean Hex grid)", "euclid", 6, 3, 0, gcEuclid, 0, {{7, FORBIDDEN}}, eVariation::bitruncated},
|
||||||
@ -574,6 +581,7 @@ vector<geometryinfo> ginf = {
|
|||||||
|
|
||||||
#define X3(x) x, x, x
|
#define X3(x) x, x, x
|
||||||
|
|
||||||
|
/** list of available models (i.e., projections) */
|
||||||
const modelinfo mdinf[int(mdPolynomial)+1] = {
|
const modelinfo mdinf[int(mdPolynomial)+1] = {
|
||||||
{"disk/Gans", "general perspective", "general perspective", mf::azimuthal | mf::conformal},
|
{"disk/Gans", "general perspective", "general perspective", mf::azimuthal | mf::conformal},
|
||||||
{"half-plane", "inversion", "half-plane", mf::conformal},
|
{"half-plane", "inversion", "half-plane", mf::conformal},
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
// 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 {
|
namespace hr {
|
||||||
|
|
||||||
typedef unsigned color_t;
|
typedef unsigned color_t;
|
||||||
|
13
content.cpp
13
content.cpp
@ -1,9 +1,14 @@
|
|||||||
// Hyperbolic Rogue
|
// Hyperbolic Rogue -- items, monsters, walls, and lands
|
||||||
// X-macros for items, monsters, walls, and lands
|
|
||||||
// add new content at 'add new content here' so that constants do not change
|
|
||||||
// old things are sorted according to type, but this is not necessary for new content
|
|
||||||
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
|
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
|
||||||
|
|
||||||
|
/** \file content.cpp
|
||||||
|
* \brief X-macros for items, monsters, walls, and lands
|
||||||
|
*
|
||||||
|
* Add new content at 'add new content here' so that constants do not change.
|
||||||
|
* Old things are sorted according to type, but this is not necessary for new content.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef MONSTER
|
#ifndef MONSTER
|
||||||
#define MONSTER(a,b,c,d,e,f,g,h)
|
#define MONSTER(a,b,c,d,e,f,g,h)
|
||||||
#endif
|
#endif
|
||||||
|
26
game.cpp
26
game.cpp
@ -165,27 +165,27 @@ EX cellwalker cwt;
|
|||||||
EX inline cell*& singlepos() { return cwt.at; }
|
EX inline cell*& singlepos() { return cwt.at; }
|
||||||
EX inline bool singleused() { return !(shmup::on || multi::players > 1); }
|
EX inline bool singleused() { return !(shmup::on || multi::players > 1); }
|
||||||
|
|
||||||
/** the main random number generator for the game
|
/** the main random number generator for the game.
|
||||||
* all the random calls related to the game mechanics (land generation, AI...) should use hrngen
|
*
|
||||||
* random calls not related to the game mechanics (graphical effects) should not use hrngen
|
* All the random calls related to the game mechanics (land generation, AI...) should use hrngen.
|
||||||
* this ensures that the game should unfold exactly the same if given the same seed and the same input
|
*
|
||||||
|
* Random calls not related to the game mechanics (graphical effects) should not use hrngen.
|
||||||
|
*
|
||||||
|
* This ensures that the game should unfold exactly the same if given the same seed and the same input.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
std::mt19937 hrngen;
|
std::mt19937 hrngen;
|
||||||
|
|
||||||
/** initialize hrngen @see hrngen */
|
/** initialize \link hrngen \endlink */
|
||||||
EX void shrand(int i) {
|
EX void shrand(int i) {
|
||||||
hrngen.seed(i);
|
hrngen.seed(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** generate a large number with hrngen */
|
/** generate a large number with \link hrngen \endlink */
|
||||||
EX int hrandpos() { return hrngen() & HRANDMAX; }
|
EX int hrandpos() { return hrngen() & HRANDMAX; }
|
||||||
|
|
||||||
/** A random integer from [0..i), generated from hrngen.
|
/** A random integer from [0..i), generated from \link hrngen \endlink.
|
||||||
* We are using our own implementations rather than ones from <random>,
|
* We are using our own implementations rather than ones from <random>,
|
||||||
* to make sure that they return the same values on different compilers.
|
* to make sure that they return the same values on different compilers.
|
||||||
m *
|
|
||||||
* @see hrngen
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
EX int hrand(int i) {
|
EX int hrand(int i) {
|
||||||
@ -202,16 +202,14 @@ template<class T, class... U> T pick(T x, U... u) { std::initializer_list<T> i =
|
|||||||
template<class T> void hrandom_shuffle(T* x, int n) { for(int k=1; k<n; k++) swap(x[k], x[hrand(k+1)]); }
|
template<class T> void hrandom_shuffle(T* x, int n) { for(int k=1; k<n; k++) swap(x[k], x[hrand(k+1)]); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** Use hrngen to generate a floating point number between 0 and 1.
|
/** Use \link hrngen \endlink to generate a floating point number between 0 and 1.
|
||||||
* @see hrngen
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EX ld hrandf() {
|
EX ld hrandf() {
|
||||||
return (hrngen() - hrngen.min()) / (hrngen.max() + 1.0 - hrngen.min());
|
return (hrngen() - hrngen.min()) / (hrngen.max() + 1.0 - hrngen.min());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns an integer corresponding to the current state of hrngen.
|
/** Returns an integer corresponding to the current state of \link hrngen \endlink.
|
||||||
* @see hrngen
|
|
||||||
*/
|
*/
|
||||||
EX int hrandstate() {
|
EX int hrandstate() {
|
||||||
std::mt19937 r2 = hrngen;
|
std::mt19937 r2 = hrngen;
|
||||||
|
2
hyper.h
2
hyper.h
@ -1,7 +1,7 @@
|
|||||||
// Hyperbolic Rogue -- main header file
|
// Hyperbolic Rogue -- main header file
|
||||||
// Copyright (C) 2011-2019 Zeno Rogue, see 'hyper.cpp' for details
|
// Copyright (C) 2011-2019 Zeno Rogue, see 'hyper.cpp' for details
|
||||||
|
|
||||||
/** \file Hyper.h
|
/** \file hyper.h
|
||||||
* \brief The main header file of HyperRogue
|
* \brief The main header file of HyperRogue
|
||||||
*
|
*
|
||||||
* Contains general utility macros, various value macros, using clauses for standard library functions,
|
* Contains general utility macros, various value macros, using clauses for standard library functions,
|
||||||
|
@ -190,7 +190,7 @@ template<class T> T* tailored_alloc(int degree) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Counterpart to @see tailored_alloc. */
|
/** Counterpart to tailored_alloc(). */
|
||||||
template<class T> void tailored_delete(T* x) {
|
template<class T> void tailored_delete(T* x) {
|
||||||
x->~T();
|
x->~T();
|
||||||
delete[] ((char*) (x));
|
delete[] ((char*) (x));
|
||||||
@ -206,7 +206,7 @@ extern int hrand(int);
|
|||||||
/** reverse directions are currently not implemented for heptagons */
|
/** reverse directions are currently not implemented for heptagons */
|
||||||
inline vector<int> reverse_directions(struct heptagon *c, int i) { throw "unimplemented"; }
|
inline vector<int> reverse_directions(struct heptagon *c, int i) { throw "unimplemented"; }
|
||||||
|
|
||||||
/** the walker structure is used for walking on surfaces defined via @see connection_table. @connection_table */
|
/** the walker structure is used for walking on surfaces defined via \ref connection_table. */
|
||||||
template<class T> struct walker {
|
template<class T> struct walker {
|
||||||
/** where we are at */
|
/** where we are at */
|
||||||
T *at;
|
T *at;
|
||||||
|
Loading…
Reference in New Issue
Block a user