mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
kaios: Hack out everything that needs dialogue boxes
They're proving to be a right nuisance and will probably require a substantial overhaul to how they work across the entire JavaScript front-end. I don't think any of the functionality provided by the dialogue boxes is critical, so in the interests of getting a minimum viable product actually released I've disabled those features. In most cases, this just involves commenting out bits of HTML. The "Custom..." menu item is added by C code, though, so there I've fallen back to the standard Puzzles way to implement a nasty hack: an environment variable.
This commit is contained in:
10
emcc.c
10
emcc.c
@ -975,13 +975,21 @@ int main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
struct preset_menu *menu = midend_get_presets(me, &npresets);
|
struct preset_menu *menu = midend_get_presets(me, &npresets);
|
||||||
|
char *env;
|
||||||
presets = snewn(npresets, game_params *);
|
presets = snewn(npresets, game_params *);
|
||||||
for (i = 0; i < npresets; i++)
|
for (i = 0; i < npresets; i++)
|
||||||
presets[i] = NULL;
|
presets[i] = NULL;
|
||||||
|
|
||||||
populate_js_preset_menu(0, menu);
|
populate_js_preset_menu(0, menu);
|
||||||
|
|
||||||
if (thegame.can_configure)
|
/*
|
||||||
|
* Crude hack to allow the "Custom..." item to be hidden on
|
||||||
|
* KaiOS, where dialogs don't yet work.
|
||||||
|
*/
|
||||||
|
env = getenv("PUZZLES_ALLOW_CUSTOM");
|
||||||
|
|
||||||
|
if (thegame.can_configure &&
|
||||||
|
(!env || env[0] == 'y' || env[0] == 'Y'))
|
||||||
js_add_preset(0, "Custom...", -1);
|
js_add_preset(0, "Custom...", -1);
|
||||||
|
|
||||||
have_presets_dropdown = npresets > 0 || thegame.can_configure;
|
have_presets_dropdown = npresets > 0 || thegame.can_configure;
|
||||||
|
@ -16,7 +16,8 @@ print <<EOF;
|
|||||||
<script defer type="text/javascript" src="${name}.js"></script>
|
<script defer type="text/javascript" src="${name}.js"></script>
|
||||||
<!-- Override some defaults for small screens -->
|
<!-- Override some defaults for small screens -->
|
||||||
<script id="environment" type="application/json">
|
<script id="environment" type="application/json">
|
||||||
{ "PATTERN_DEFAULT": "10x10" }
|
{ "PATTERN_DEFAULT": "10x10",
|
||||||
|
"PUZZLES_ALLOW_CUSTOM": "N" }
|
||||||
</script>
|
</script>
|
||||||
<style class="text/css">
|
<style class="text/css">
|
||||||
body {
|
body {
|
||||||
@ -299,12 +300,14 @@ body {
|
|||||||
</div>
|
</div>
|
||||||
<form id="gamemenu" class="transient">
|
<form id="gamemenu" class="transient">
|
||||||
<ul>
|
<ul>
|
||||||
|
<!--
|
||||||
<li><div tabindex="0">Game<ul class="transient">
|
<li><div tabindex="0">Game<ul class="transient">
|
||||||
<li><button type="button" id="specific">Enter game ID...</button></li>
|
<li><button type="button" id="specific">Enter game ID...</button></li>
|
||||||
<li><button type="button" id="random">Enter random seed...</button></li>
|
<li><button type="button" id="random">Enter random seed...</button></li>
|
||||||
<li><button type="button" id="save">Download save file...</button></li>
|
<li><button type="button" id="save">Download save file...</button></li>
|
||||||
<li><button type="button" id="load">Upload save file...</button></li>
|
<li><button type="button" id="load">Upload save file...</button></li>
|
||||||
</ul></div></li>
|
</ul></div></li>
|
||||||
|
-->
|
||||||
<li><div tabindex="0">Type<ul id="gametype" class="transient"></ul></div></li>
|
<li><div tabindex="0">Type<ul id="gametype" class="transient"></ul></div></li>
|
||||||
<li role="separator"></li>
|
<li role="separator"></li>
|
||||||
<li><button type="button" id="new">
|
<li><button type="button" id="new">
|
||||||
|
Reference in New Issue
Block a user