1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-19 11:44:48 +00:00

introduced new CAP, CAP_PORTALS

This commit is contained in:
Zeno Rogue 2023-04-15 01:27:35 +02:00
parent 0410f54d43
commit 3f1dc8a4c4
6 changed files with 16 additions and 12 deletions

View File

@ -1518,7 +1518,7 @@ EX vector<cell*> build_shortest_path(cell *c1, cell *c2) {
}
EX void clearCellMemory() {
#if MAXMDIM >= 4 && CAP_RAY
#if CAP_PORTALS
if(intra::in) {
intra::erase_all_maps();
return;

View File

@ -1316,7 +1316,7 @@ EX string cgi_string() {
return s;
}
#if MAXMDIM >= 4 && CAP_RAY
#if CAP_PORTALS
#define IFINTRA(x,y) x
#else
#define IFINTRA(x,y) y

View File

@ -3460,7 +3460,7 @@ EX void shift_view(hyperpoint H, eShiftMethod sm IS(shift_method(smaManualCamera
static bool recursive = false;
if(!recursive && intra::in) {
dynamicval<bool> r(recursive, true);
#if MAXMDIM >= 4 && CAP_RAY
#if CAP_PORTALS
intra::shift_view_portal(H);
#endif
return;

View File

@ -6,7 +6,7 @@ EX namespace intra {
EX bool in;
#if CAP_RAY && MAXMDIM >= 4
#if CAP_PORTALS
#if HDR
/** information per every space connected with intra-portals */
struct intra_data {

View File

@ -724,7 +724,7 @@ EX namespace mapstream {
}
addToQueue(save_start());
#if MAXMDIM >= 4 && CAP_RAY
#if CAP_PORTALS
if(intra::in) intra::prepare_need_to_save();
#endif
for(int i=0; i<isize(cellbyid); i++) {
@ -771,7 +771,7 @@ EX namespace mapstream {
f.write(c->wparam); f.write(c->landparam);
f.write_char(c->stuntime); f.write_char(c->hitpoints);
bool blocked = false;
#if MAXMDIM >= 4 && CAP_RAY
#if CAP_PORTALS
if(intra::in && isWall3(c) && !intra::need_to_save.count(c)) blocked = true;
#endif
if(!blocked)
@ -805,7 +805,7 @@ EX namespace mapstream {
for(int i=0; i<multi::players; i++)
f.write(cellids[multi::player[i].at]);
#if MAXMDIM >= 4 && CAP_RAY
#if CAP_PORTALS
if(intra::in) {
for(int i=0; i<isize(intra::portals_to_save); i++) {
auto& p = intra::portals_to_save[i];
@ -1069,7 +1069,7 @@ EX namespace mapstream {
}
}
#if MAXMDIM >= 4 && CAP_RAY
#if CAP_PORTALS
if(intra::in) {
while(true) {
char k = f.get<char>();
@ -1153,14 +1153,14 @@ EX namespace mapstream {
EX void saveMap(hstream& f) {
f.write(f.get_vernum());
f.write(dual::state);
#if MAXMDIM >= 4 && CAP_RAY
#if CAP_PORTALS
int q = intra::in ? isize(intra::data) : 0;
f.write(q);
#else
int q = 0;
#endif
if(q) {
#if MAXMDIM >= 4 && CAP_RAY
#if CAP_PORTALS
intra::prepare_to_save();
int qp = isize(intra::portals_to_save);
f.write(qp);
@ -1204,7 +1204,7 @@ EX namespace mapstream {
if(q) {
int qp;
f.read(qp);
#if MAXMDIM >= 4 && CAP_RAY
#if CAP_PORTALS
intra::portals_to_save.resize(qp);
for(auto& ps: intra::portals_to_save) {
f.read(ps.spin);
@ -3262,7 +3262,7 @@ EX namespace mapeditor {
add_edit(game_keys_scroll);
dialog::addInfo(XLAT("hint: shift+A to enter the map editor"));
#if CAP_RAY && MAXMDIM >= 4
#if CAP_PORTALS
if(WDIM == 3 && !intra::in) {
dialog::addBoolItem(XLAT("become a portal map"), intra::in, 'm');
dialog::add_action_push(intra::become_menu);

View File

@ -654,6 +654,10 @@ union SDL_Event;
#define CAP_RAY (MAXMDIM >= 4 && CAP_GL && !ISMOBILE && !ISWEB)
#endif
#ifndef CAP_PORTALS
#define CAP_PORTALS CAP_RAY
#endif
#ifndef CAP_MEMORY_RESERVE
#define CAP_MEMORY_RESERVE (!ISMOBILE && !ISWEB)
#endif