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

cleanup mapeditor

This commit is contained in:
Zeno Rogue 2019-08-10 01:15:41 +02:00
parent 4422b910c0
commit 4ec7652861
3 changed files with 26 additions and 50 deletions

View File

@ -7664,7 +7664,13 @@ EX void normalscreen() {
describeMouseover();
}
vector< function<void()> > screens = { normalscreen };
EX vector< function<void()> > screens = { normalscreen };
#if HDR
template<class T> void pushScreen(const T& x) { screens.push_back(x); }
inline void popScreen() { if(isize(screens)>1) screens.pop_back(); }
inline void popScreenAll() { while(isize(screens)>1) popScreen(); }
#endif
EX int cmode;

37
hyper.h
View File

@ -880,12 +880,6 @@ typedef function<bool()> bool_reaction_t;
#define HELPFUN(x) (help_delegate = x, "HELPFUN")
extern vector< function<void()> > screens;
template<class T> void pushScreen(const T& x) { screens.push_back(x); }
inline void popScreen() { if(isize(screens)>1) screens.pop_back(); }
inline void popScreenAll() { while(isize(screens)>1) popScreen(); }
struct display_data {
transmatrix view_matrix; // current rotation, relative to viewctr
transmatrix player_matrix; // player-relative view
@ -929,29 +923,6 @@ extern display_data *current_display;
typedef function<int(cell*)> cellfunction;
namespace mapeditor {
#if CAP_EDIT
extern map<int, cell*> modelcell;
#endif
extern bool drawplayer;
void applyModelcell(cell *c);
extern cell *drawcell;
void initdraw(cell *c);
#if CAP_EDIT
void showMapEditor();
void showDrawEditor();
#endif
enum eShapegroup { sgPlayer, sgMonster, sgItem, sgFloor, sgWall };
static const int USERSHAPEGROUPS = 5;
bool haveUserShape(eShapegroup group, int id);
void draw_texture_ghosts(cell *c, const transmatrix& V);
void map_settings();
}
// passable flags
#define SAGEMELT .1
@ -1227,10 +1198,6 @@ inline PPR operator + (PPR x, int y) { return PPR(int(x) + y); }
inline PPR operator - (PPR x, int y) { return PPR(int(x) - y); }
inline int operator - (PPR x, PPR y) { return int(x) - int(y); }
namespace mapeditor {
bool drawUserShape(const transmatrix& V, eShapegroup group, int id, color_t color, cell *c, PPR prio = PPR::DEFAULT);
}
#define OUTLINE_NONE 0x000000FF
#define OUTLINE_FRIEND 0x00FF00FF
#define OUTLINE_ENEMY 0xFF0000FF
@ -2296,7 +2263,6 @@ static const int USERLAYERS = 32;
struct usershape { usershapelayer d[USERLAYERS]; };
extern array<map<int, usershape*>, mapeditor::USERSHAPEGROUPS> usershapes;
void initShape(int sg, int id);
extern int usershape_changes;
@ -2623,14 +2589,13 @@ static const color_t NOCOLOR = 0;
static const int max_vec = (1<<14);
extern bool needConfirmationEvenIfSaved();
#define EX
#define EXT(z)
}
#define IS(z) = z
#include "autohdr.h"
#undef IS
#define IS(z)
#define EX
namespace hr {
inline bool movepcto(const movedir& md) { return movepcto(md.d, md.subdir); }

View File

@ -3,7 +3,12 @@
namespace hr {
namespace mapeditor {
EX namespace mapeditor {
#if HDR
enum eShapegroup { sgPlayer, sgMonster, sgItem, sgFloor, sgWall };
static const int USERSHAPEGROUPS = 5;
#endif
hyperpoint lstart;
cell *lstartcell;
@ -53,11 +58,11 @@ namespace mapeditor {
}
#if CAP_EDIT
map<int, cell*> modelcell;
EX map<int, cell*> modelcell;
void handleKeyMap(int sym, int uni);
void applyModelcell(cell *c) {
EX void applyModelcell(cell *c) {
if(patterns::whichPattern == 'H') return;
auto si = patterns::getpatterninfo0(c);
cell *c2 = modelcell[si.id];
@ -539,9 +544,9 @@ namespace mapstream {
namespace mapeditor {
bool drawplayer = true;
EX bool drawplayer = true;
cell *drawcell;
EX cell *drawcell;
#if CAP_EDIT
int paintwhat = 0;
@ -672,7 +677,7 @@ namespace mapeditor {
displayButton(8, vid.yres-8-fs*2, XLAT("ESC = return to the game"), SDLK_ESCAPE, 0);
}
void showMapEditor() {
EX void showMapEditor() {
cmode = sm::MAP;
gamescreen(0);
@ -708,7 +713,7 @@ namespace mapeditor {
return 1;
}
eShapegroup drawcellShapeGroup() {
EX eShapegroup drawcellShapeGroup() {
if(drawcell == cwt.at && drawplayer) return sgPlayer;
if(drawcell->wall == waEditStatue) return sgWall;
if(drawcell->monst) return sgMonster;
@ -716,7 +721,7 @@ namespace mapeditor {
return sgFloor;
}
int drawcellShapeID() {
EX int drawcellShapeID() {
if(drawcell == cwt.at && drawplayer) return vid.cs.charid;
if(drawcell->wall == waEditStatue) return drawcell->wparam;
if(drawcell->monst) return drawcell->monst;
@ -1234,7 +1239,7 @@ namespace mapeditor {
#define EDITING_TRIANGLES (DIM == 3)
void showDrawEditor() {
EX void showDrawEditor() {
#if CAP_POLY
cmode = sm::DRAW;
gamescreen(0);
@ -1994,7 +1999,7 @@ namespace mapeditor {
});;;
#endif
void initdraw(cell *c) {
EX void initdraw(cell *c) {
#if CAP_EDIT
mapeditor::drawcell = c;
ew.c = c;
@ -2071,7 +2076,7 @@ namespace mapeditor {
#endif
#if CAP_POLY
bool drawUserShape(const transmatrix& V, eShapegroup group, int id, color_t color, cell *c, PPR prio) {
EX bool drawUserShape(const transmatrix& V, eShapegroup group, int id, color_t color, cell *c, PPR prio IS(PPR::DEFAULT)) {
#if !CAP_EDIT
return false;
#else
@ -2212,7 +2217,7 @@ namespace mapeditor {
}
#endif
void map_settings() {
EX void map_settings() {
cmode = sm::SIDE | sm::MAYDARK;
gamescreen(1);
@ -2241,7 +2246,7 @@ namespace mapeditor {
dialog::addBack();
dialog::display();
}
}
EX }
#if CAP_EDIT
EX string levelfile = "hyperrogue.lev";