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

drawing tool and shape editor can now be used with texture mode enabled

This commit is contained in:
Zeno Rogue 2021-02-01 11:45:52 +01:00
parent 9065011437
commit b921a5a81b
4 changed files with 17 additions and 13 deletions

View File

@ -2542,7 +2542,7 @@ void celldrawer::draw() {
return; return;
} }
if((cmode & sm::DRAW) && texture::config.tstate == texture::tsActive && !mouseout() && c) if((cmode & sm::DRAW) && mapeditor::intexture && !mouseout() && c)
mapeditor::draw_texture_ghosts(c, V); mapeditor::draw_texture_ghosts(c, V);
#endif #endif

View File

@ -11,6 +11,7 @@ namespace hr {
EX namespace mapeditor { EX namespace mapeditor {
EX bool drawing_tool; EX bool drawing_tool;
EX bool intexture;
#if HDR #if HDR
enum eShapegroup { sgPlayer, sgMonster, sgItem, sgFloor, sgWall }; enum eShapegroup { sgPlayer, sgMonster, sgItem, sgFloor, sgWall };
@ -1755,18 +1756,20 @@ EX namespace mapeditor {
usershape *us = NULL; usershape *us = NULL;
bool intexture = false; #if CAP_TEXTURE
(void) intexture; if(texture::config.tstate != texture::tsActive && intexture) {
intexture = false; drawing_tool = true;
}
#endif
bool freedraw = drawing_tool; bool freedraw = drawing_tool || intexture;
#if CAP_TEXTURE #if CAP_TEXTURE
if(texture::config.tstate == texture::tsActive) { if(intexture) {
sg = 16; sg = 16;
line1 = "texture"; line1 = "texture";
line2 = ""; line2 = "";
texture::config.data.update(); texture::config.data.update();
intexture = true;
freedraw = true; freedraw = true;
drawing_tool = false; drawing_tool = false;
} }
@ -2430,11 +2433,7 @@ EX namespace mapeditor {
(void)clickused; (void)clickused;
bool freedraw = drawing_tool; bool freedraw = drawing_tool || intexture;
#if CAP_TEXTURE
bool intexture = texture::config.tstate == texture::tsActive;
freedraw |= intexture;
#endif
if(freedraw) { if(freedraw) {
if(lstartcell) lstart = ggmatrix(lstartcell) * lstart_rel; if(lstartcell) lstart = ggmatrix(lstartcell) * lstart_rel;

View File

@ -423,6 +423,7 @@ EX void showCreative() {
dialog::addItem(XLAT("shape editor"), 'g'); dialog::addItem(XLAT("shape editor"), 'g');
dialog::add_action([] { dialog::add_action([] {
mapeditor::drawing_tool = false; mapeditor::drawing_tool = false;
mapeditor::intexture = false;
pushScreen(mapeditor::showDrawEditor); pushScreen(mapeditor::showDrawEditor);
mapeditor::initdraw(cwt.at); mapeditor::initdraw(cwt.at);
}); });
@ -433,6 +434,7 @@ EX void showCreative() {
dialog::add_action([] { dialog::add_action([] {
dialog::cheat_if_confirmed([] { dialog::cheat_if_confirmed([] {
mapeditor::drawing_tool = true; mapeditor::drawing_tool = true;
mapeditor::intexture = false;
pushScreen(mapeditor::showDrawEditor); pushScreen(mapeditor::showDrawEditor);
mapeditor::initdraw(cwt.at); mapeditor::initdraw(cwt.at);
}); });

View File

@ -1243,12 +1243,13 @@ string texturehelp =
#if CAP_EDIT #if CAP_EDIT
EX void start_editor() { EX void start_editor() {
addMessage("white");
if(config.data.whitetexture() && config.data.loadTextureGL()) { if(config.data.whitetexture() && config.data.loadTextureGL()) {
config.tstate = config.tstate_max = tsActive; config.tstate = config.tstate_max = tsActive;
config.perform_mapping(); config.perform_mapping();
config.finish_mapping(); config.finish_mapping();
mapeditor::initdraw(cwt.at); mapeditor::initdraw(cwt.at);
mapeditor::intexture = true;
mapeditor::drawing_tool = false;
pushScreen(mapeditor::showDrawEditor); pushScreen(mapeditor::showDrawEditor);
} }
} }
@ -1393,6 +1394,8 @@ EX void showMenu() {
if(GDIM == 2) { if(GDIM == 2) {
dialog::addItem(XLAT("edit the texture"), 'e'); dialog::addItem(XLAT("edit the texture"), 'e');
dialog::add_action([] { dialog::add_action([] {
mapeditor::intexture = true;
mapeditor::drawing_tool = false;
mapeditor::initdraw(cwt.at); mapeditor::initdraw(cwt.at);
pushScreen(mapeditor::showDrawEditor); pushScreen(mapeditor::showDrawEditor);
}); });