1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-09-10 06:16:00 +00:00

fixes to make the Emscripten web version compile correctly

This commit is contained in:
Zeno Rogue
2017-08-13 20:49:38 +02:00
parent 6fb608bb2b
commit 7c82c3e5a3
10 changed files with 287 additions and 348 deletions

View File

@@ -1,11 +1,11 @@
#define ISWEB 1
#define MINI
#define NOAUDIO
#define NOGFX
#define NOPNG
#define DEMO
#define TOUR
#define ISMINI 1
#define CAP_AUDIO 0
#define CAP_SDLGFX 0
#define CAP_PNG 0
#define CAP_TOUR 1
#define CAP_SDLTTF 0
#define CAP_SHMUP 0
#ifdef FAKEWEB
void mainloopiter();
@@ -22,10 +22,90 @@ const char *wheresounds;
#include "hyper.cpp"
void playSound(cell *c, const string& fname, int vol) { }
// -- demo --
bool demoanim;
void toggleanim(bool v) {
demoanim = v;
if(v) {
sightrange = 4;
vid.wallmode = 5;
vid.particles = true;
vid.sspeed = -1;
vid.mspeed = -1;
geom3::highdetail = geom3::middetail = 5;
}
else {
sightrange = 7;
vid.sspeed = 5;
vid.mspeed = 5;
vid.particles = false;
vid.wallmode = 3;
geom3::highdetail = geom3::middetail = -1;
}
}
void showDemo() {
gamescreen(2);
getcstat = ' ';
dialog::init(XLAT("HyperRogue %1: online demo", VER), 0xC00000, 200, 100);
dialog::addBreak(50);
dialog::addItem(XLAT("play"), 'f');
dialog::addItem(XLAT("tutorial"), 'T');
dialog::addItem(XLAT("help"), 'h'); dialog::lastItem().keycaption += " / F1";
dialog::addItem(XLAT("toggle high detail"), 'a');
dialog::addBreak(100);
dialog::addTitle("highlights", 0xC00000, 120);
dialog::addItem(XLAT("Temple of Cthulhu"), 't');
dialog::addItem(XLAT("Land of Storms"), 'l');
dialog::addItem(XLAT("Burial Grounds"), 'b');
dialog::display();
keyhandler = [] (int sym, int uni) {
dialog::handleNavigation(sym, uni);
if(sym == SDLK_F1 || sym == 'h') gotoHelp(help);
else if(sym == 'a') {
toggleanim(!demoanim);
popScreen();
}
else if(sym == 'f') {
firstland = laIce;
if(tactic::on) restartGame('t');
else restartGame();
}
#if CAP_TOUR
else if(sym == 'T') {
firstland = laIce;
if(!tour::on) tour::start();
}
#endif
else if(sym == 't') {
firstland = laTemple;
if(!tactic::on) restartGame('t');
else restartGame();
}
else if(sym == 'l') {
firstland = laStorms;
if(!tactic::on) restartGame('t');
else restartGame();
}
else if(sym == 'b') {
firstland = laBurial;
if(!tactic::on) restartGame('t');
else restartGame();
items[itOrbSword] = 60;
}
};
}
void initweb() {
toggleanim(false);
cmode = emMenu;
// pushScreen(showDemo);
}