an option to disable wandering monsters; settings (reptilecheat, autocheat, safety etc) configurable in map editor; save items/kills and some other settings

This commit is contained in:
Zeno Rogue 2018-12-24 15:10:52 +01:00
parent f58de16a2e
commit 78adac4e10
4 changed files with 90 additions and 5 deletions

View File

@ -2,9 +2,9 @@
// It is quite chaotic.
// version numbers
#define VER "10.5d"
#define VERNUM 10504
#define VERNUM_HEX 0xA504
#define VER "10.5e"
#define VERNUM 10505
#define VERNUM_HEX 0xA505
#include <stdarg.h>
@ -1205,6 +1205,7 @@ namespace mapeditor {
bool haveUserShape(eShapegroup group, int id);
void draw_texture_ghosts(cell *c, const transmatrix& V);
void map_settings();
}
struct renderbuffer;
@ -1739,6 +1740,7 @@ bool needConfirmationEvenIfSaved();
#define DEFAULTNOR(sym) (DEFAULTCONTROL || multi::notremapped(sym))
extern bool timerghost;
extern bool gen_wandering;
#define CAP_MENUSCALING (ISPANDORA || ISMOBILE)

View File

@ -123,6 +123,27 @@ namespace mapstream {
f.write(ginf[gCrystal].vertex);
}
if(geometry == gArchimedean) f.write(arcm::current.symbol);
// game settings
f.write(safety);
f.write(autocheat);
f.write(gen_wandering);
f.write(reptilecheat);
f.write(timerghost);
f.write(patterns::canvasback);
f.write(patterns::whichShape);
f.write(patterns::subpattern_flags);
f.write(patterns::whichCanvas);
f.write(patterns::displaycodes);
f.write(mapeditor::drawplayer);
{
int i = ittypes; f.write(i);
for(int k=0; k<i; k++) f.write(items[k]);
i = motypes; f.write(i);
for(int k=0; k<i; k++) f.write(kills[k]);
}
addToQueue((bounded || euclid) ? currentmap->gamestart() : cwt.at->master->c7);
for(int i=0; i<isize(cellbyid); i++) {
cell *c = cellbyid[i];
@ -248,11 +269,33 @@ namespace mapstream {
}
}
}
need_reset_geometry = true;
initcells();
if(shmup::on) shmup::init();
if(vernum >= 10505) {
// game settings
f.read(safety);
bool b;
f.read(b); if(b) autocheat = true;
f.read(gen_wandering);
f.read(reptilecheat);
f.read(timerghost);
f.read(patterns::canvasback);
f.read(patterns::whichShape);
f.read(patterns::subpattern_flags);
f.read(patterns::whichCanvas);
f.read(patterns::displaycodes);
f.read(mapeditor::drawplayer);
int i;
f.read(i); if(i > ittypes || i < 0) throw hstream_exception();
for(int k=0; k<i; k++) f.read(items[k]);
f.read(i); if(i > motypes || i < 0) throw hstream_exception();
for(int k=0; k<i; k++) f.read(kills[k]);
}
while(true) {
cell *c;
@ -526,6 +569,7 @@ namespace mapeditor {
displayButton(8, 8+fs*14, XLAT("p = paint"), 'p', 0);
displayFunctionKeys();
displayButton(8, vid.yres-8-fs*4, XLAT("F8 = settings"), SDLK_F8, 0);
keyhandler = handleKeyMap;
}
@ -854,6 +898,9 @@ namespace mapeditor {
else if(sym == SDLK_F7) {
drawplayer = !drawplayer;
}
else if(sym == SDLK_F8) {
pushScreen(map_settings);
}
else if(uni == 'c') {
copysource = mouseover_cw(true);
painttype = 4;
@ -1840,6 +1887,36 @@ namespace mapeditor {
#endif
}
void map_settings() {
cmode = sm::SIDE | sm::MAYDARK;
gamescreen(1);
dialog::init(XLAT("Map settings"));
dialog::addBoolItem("disable wandering monsters", !gen_wandering, 'w');
dialog::add_action([] () { gen_wandering = !gen_wandering; });
if(gen_wandering) {
dialog::addBoolItem("disable ghost timer", !timerghost, 'g');
dialog::add_action([] () { timerghost = !timerghost; });
}
else dialog::addBreak(100);
dialog::addBoolItem("simple pattern generation", reptilecheat, 'p');
dialog::add_action([] () { reptilecheat = !reptilecheat; });
dialog::addInfo("(e.g. pure Reptile pattern)");
dialog::addBoolItem("safety generation", safety, 's');
dialog::add_action([] () { safety = !safety; });
dialog::addInfo("(no treasure, no dangers)");
dialog::addBoolItem("god mode", autocheat, 'G');
dialog::add_action([] () { autocheat = true; });
dialog::addInfo("(unlock all, allow cheats, normal character display)");
dialog::addBack();
dialog::display();
}
}
#if CAP_EDIT

View File

@ -7,6 +7,7 @@
namespace hr {
bool timerghost = true;
bool gen_wandering = true;
int buildIvy(cell *c, int children, int minleaf) {
if(c->monst) return 0;
@ -303,6 +304,8 @@ eItem wanderingTreasure(cell *c) {
void wandering() {
if(!canmove) return;
if(!gen_wandering) return;
pathdata pd(moYeti);
int seepcount = getSeepcount();
int ghostcount = getGhostcount();

View File

@ -268,7 +268,10 @@ void initgame() {
cheater = 0;
if(autocheat) cheater = 1;
hauntedWarning = false;
timerghost = true;
if(!autocheat) {
timerghost = true;
gen_wandering = true;
}
truelotus = 0;
survivalist = true;
crystal::used_compass_inside = false;