@textadventures/quest-viva-wasmplayer 6.0.4 → 6.1.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/_framework/Common.wasm +0 -0
  2. package/_framework/Engine.wasm +0 -0
  3. package/_framework/ExtendedNumerics.BigDecimal.wasm +0 -0
  4. package/_framework/Legacy.wasm +0 -0
  5. package/_framework/Microsoft.Extensions.Logging.Abstractions.wasm +0 -0
  6. package/_framework/Microsoft.VisualBasic.Core.wasm +0 -0
  7. package/_framework/NCalc.Core.wasm +0 -0
  8. package/_framework/NCalc.Domain.wasm +0 -0
  9. package/_framework/NCalc.Parser.wasm +0 -0
  10. package/_framework/Parlot.wasm +0 -0
  11. package/_framework/PlayerCore.wasm +0 -0
  12. package/_framework/System.Collections.Immutable.wasm +0 -0
  13. package/_framework/System.Collections.NonGeneric.wasm +0 -0
  14. package/_framework/System.Collections.Specialized.wasm +0 -0
  15. package/_framework/System.Collections.wasm +0 -0
  16. package/_framework/System.ComponentModel.Annotations.wasm +0 -0
  17. package/_framework/System.ComponentModel.Primitives.wasm +0 -0
  18. package/_framework/System.ComponentModel.TypeConverter.wasm +0 -0
  19. package/_framework/System.ComponentModel.wasm +0 -0
  20. package/_framework/System.IO.Compression.wasm +0 -0
  21. package/_framework/System.IO.Pipelines.wasm +0 -0
  22. package/_framework/System.Linq.Expressions.wasm +0 -0
  23. package/_framework/System.Linq.wasm +0 -0
  24. package/_framework/System.Memory.wasm +0 -0
  25. package/_framework/System.Net.Http.wasm +0 -0
  26. package/_framework/System.Net.Primitives.wasm +0 -0
  27. package/_framework/System.ObjectModel.wasm +0 -0
  28. package/_framework/System.Private.CoreLib.wasm +0 -0
  29. package/_framework/System.Private.Uri.wasm +0 -0
  30. package/_framework/System.Private.Xml.Linq.wasm +0 -0
  31. package/_framework/System.Private.Xml.wasm +0 -0
  32. package/_framework/System.Runtime.InteropServices.JavaScript.wasm +0 -0
  33. package/_framework/System.Runtime.Numerics.wasm +0 -0
  34. package/_framework/System.Security.Cryptography.wasm +0 -0
  35. package/_framework/System.Text.Encoding.CodePages.wasm +0 -0
  36. package/_framework/System.Text.Encodings.Web.wasm +0 -0
  37. package/_framework/System.Text.Json.wasm +0 -0
  38. package/_framework/System.Text.RegularExpressions.wasm +0 -0
  39. package/_framework/System.Xml.Linq.wasm +0 -0
  40. package/_framework/System.wasm +0 -0
  41. package/_framework/WasmPlayer.wasm +0 -0
  42. package/_framework/dotnet.js +328 -2
  43. package/_framework/dotnet.native.js +1919 -2049
  44. package/_framework/dotnet.native.wasm +0 -0
  45. package/_framework/dotnet.runtime.js +1 -1
  46. package/_framework/icudt_CJK.dat +0 -0
  47. package/_framework/icudt_EFIGS.dat +0 -0
  48. package/_framework/icudt_no_CJK.dat +0 -0
  49. package/chrome.css +20 -2
  50. package/export-manifest.json +1 -1
  51. package/fonts/courier-prime/LICENSE.txt +93 -0
  52. package/fonts/courier-prime/latin-400-italic.woff2 +0 -0
  53. package/fonts/courier-prime/latin-400-normal.woff2 +0 -0
  54. package/fonts/courier-prime/latin-700-italic.woff2 +0 -0
  55. package/fonts/courier-prime/latin-700-normal.woff2 +0 -0
  56. package/fonts/courier-prime/latin-ext-400-italic.woff2 +0 -0
  57. package/fonts/courier-prime/latin-ext-400-normal.woff2 +0 -0
  58. package/fonts/courier-prime/latin-ext-700-italic.woff2 +0 -0
  59. package/fonts/courier-prime/latin-ext-700-normal.woff2 +0 -0
  60. package/fonts/fonts.css +500 -0
  61. package/fonts/literata/LICENSE.txt +93 -0
  62. package/fonts/literata/cyrillic-400-italic.woff2 +0 -0
  63. package/fonts/literata/cyrillic-400-normal.woff2 +0 -0
  64. package/fonts/literata/cyrillic-700-italic.woff2 +0 -0
  65. package/fonts/literata/cyrillic-700-normal.woff2 +0 -0
  66. package/fonts/literata/cyrillic-ext-400-italic.woff2 +0 -0
  67. package/fonts/literata/cyrillic-ext-400-normal.woff2 +0 -0
  68. package/fonts/literata/cyrillic-ext-700-italic.woff2 +0 -0
  69. package/fonts/literata/cyrillic-ext-700-normal.woff2 +0 -0
  70. package/fonts/literata/greek-400-italic.woff2 +0 -0
  71. package/fonts/literata/greek-400-normal.woff2 +0 -0
  72. package/fonts/literata/greek-700-italic.woff2 +0 -0
  73. package/fonts/literata/greek-700-normal.woff2 +0 -0
  74. package/fonts/literata/greek-ext-400-italic.woff2 +0 -0
  75. package/fonts/literata/greek-ext-400-normal.woff2 +0 -0
  76. package/fonts/literata/greek-ext-700-italic.woff2 +0 -0
  77. package/fonts/literata/greek-ext-700-normal.woff2 +0 -0
  78. package/fonts/literata/latin-400-italic.woff2 +0 -0
  79. package/fonts/literata/latin-400-normal.woff2 +0 -0
  80. package/fonts/literata/latin-700-italic.woff2 +0 -0
  81. package/fonts/literata/latin-700-normal.woff2 +0 -0
  82. package/fonts/literata/latin-ext-400-italic.woff2 +0 -0
  83. package/fonts/literata/latin-ext-400-normal.woff2 +0 -0
  84. package/fonts/literata/latin-ext-700-italic.woff2 +0 -0
  85. package/fonts/literata/latin-ext-700-normal.woff2 +0 -0
  86. package/fonts/literata/vietnamese-400-italic.woff2 +0 -0
  87. package/fonts/literata/vietnamese-400-normal.woff2 +0 -0
  88. package/fonts/literata/vietnamese-700-italic.woff2 +0 -0
  89. package/fonts/literata/vietnamese-700-normal.woff2 +0 -0
  90. package/fonts/nunito/LICENSE.txt +93 -0
  91. package/fonts/nunito/cyrillic-400-italic.woff2 +0 -0
  92. package/fonts/nunito/cyrillic-400-normal.woff2 +0 -0
  93. package/fonts/nunito/cyrillic-700-italic.woff2 +0 -0
  94. package/fonts/nunito/cyrillic-700-normal.woff2 +0 -0
  95. package/fonts/nunito/cyrillic-ext-400-italic.woff2 +0 -0
  96. package/fonts/nunito/cyrillic-ext-400-normal.woff2 +0 -0
  97. package/fonts/nunito/cyrillic-ext-700-italic.woff2 +0 -0
  98. package/fonts/nunito/cyrillic-ext-700-normal.woff2 +0 -0
  99. package/fonts/nunito/latin-400-italic.woff2 +0 -0
  100. package/fonts/nunito/latin-400-normal.woff2 +0 -0
  101. package/fonts/nunito/latin-700-italic.woff2 +0 -0
  102. package/fonts/nunito/latin-700-normal.woff2 +0 -0
  103. package/fonts/nunito/latin-ext-400-italic.woff2 +0 -0
  104. package/fonts/nunito/latin-ext-400-normal.woff2 +0 -0
  105. package/fonts/nunito/latin-ext-700-italic.woff2 +0 -0
  106. package/fonts/nunito/latin-ext-700-normal.woff2 +0 -0
  107. package/fonts/nunito/vietnamese-400-italic.woff2 +0 -0
  108. package/fonts/nunito/vietnamese-400-normal.woff2 +0 -0
  109. package/fonts/nunito/vietnamese-700-italic.woff2 +0 -0
  110. package/fonts/nunito/vietnamese-700-normal.woff2 +0 -0
  111. package/fonts/special-elite/LICENSE.txt +201 -0
  112. package/fonts/special-elite/latin-400-normal.woff2 +0 -0
  113. package/fonts/special-elite/latin-ext-400-normal.woff2 +0 -0
  114. package/fonts/vt323/LICENSE.txt +93 -0
  115. package/fonts/vt323/latin-400-normal.woff2 +0 -0
  116. package/fonts/vt323/latin-ext-400-normal.woff2 +0 -0
  117. package/fonts/vt323/vietnamese-400-normal.woff2 +0 -0
  118. package/game-saver.js +211 -0
  119. package/index.html +140 -52
  120. package/legacy/adapter.js +107 -0
  121. package/{grid.js → legacy/grid.js} +3 -0
  122. package/{player.js → legacy/player.js} +37 -62
  123. package/{playercore.css → legacy/playercore.css} +115 -0
  124. package/{playercore.htm → legacy/playercore.htm} +14 -13
  125. package/{playercore.js → legacy/playercore.js} +188 -252
  126. package/legacy/questui.js +515 -0
  127. package/package.json +1 -1
  128. package/v2/map.js +1 -0
  129. package/v2/player.htm +59 -0
  130. package/v2/v2.css +1 -0
  131. package/v2/v2.js +1 -0
  132. package/wasm-player.js +1359 -284
  133. package/.stamp +0 -0
  134. package/WasmPlayer.runtimeconfig.json +0 -46
  135. package/_framework/System.Collections.Concurrent.wasm +0 -0
  136. package/_framework/dotnet.boot.js +0 -284
  137. /package/{lib → legacy/lib}/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  138. /package/{lib → legacy/lib}/images/ui-bg_flat_55_fbec88_40x100.png +0 -0
  139. /package/{lib → legacy/lib}/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
  140. /package/{lib → legacy/lib}/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
  141. /package/{lib → legacy/lib}/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  142. /package/{lib → legacy/lib}/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
  143. /package/{lib → legacy/lib}/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
  144. /package/{lib → legacy/lib}/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
  145. /package/{lib → legacy/lib}/images/ui-icons_217bc0_256x240.png +0 -0
  146. /package/{lib → legacy/lib}/images/ui-icons_2e83ff_256x240.png +0 -0
  147. /package/{lib → legacy/lib}/images/ui-icons_469bdd_256x240.png +0 -0
  148. /package/{lib → legacy/lib}/images/ui-icons_6da8d5_256x240.png +0 -0
  149. /package/{lib → legacy/lib}/images/ui-icons_cd0a0a_256x240.png +0 -0
  150. /package/{lib → legacy/lib}/images/ui-icons_d8e7f3_256x240.png +0 -0
  151. /package/{lib → legacy/lib}/images/ui-icons_f9bd01_256x240.png +0 -0
  152. /package/{lib → legacy/lib}/jquery-2.1.1.min.js +0 -0
  153. /package/{lib → legacy/lib}/jquery-ui.min.css +0 -0
  154. /package/{lib → legacy/lib}/jquery-ui.min.js +0 -0
  155. /package/{lib → legacy/lib}/jquery.multi-open-accordion-1.5.3.js +0 -0
  156. /package/{lib → legacy/lib}/paper.js +0 -0
package/index.html CHANGED
@@ -4,7 +4,16 @@
4
4
  <meta charset="utf-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Quest Viva</title>
7
- <link rel="icon" type="image/svg+xml" href="favicon.svg?v=6.0.4" />
7
+ <link rel="icon" type="image/svg+xml" href="favicon.svg?v=6.1.0-beta.2" />
8
+ <!-- Site-level link-preview tags. This page is static and only learns which game
9
+ it's playing after boot, so a shared ?id= link can't name the game — keep the
10
+ card small and generic: no og:image, and no og:url or canonical, which would
11
+ tell scrapers every game link *is* one page. -->
12
+ <meta name="description" content="Play and create text adventure games in your browser." />
13
+ <meta property="og:type" content="website" />
14
+ <meta property="og:site_name" content="Quest Viva" />
15
+ <meta property="og:title" content="Quest Viva" />
16
+ <meta property="og:description" content="Play and create text adventure games in your browser." />
8
17
  <!-- Lets the preload scanner start the runtime loader before the parser has
9
18
  even reached wasm-player.js, which as the last script in this head only
10
19
  executes once jQuery/jQuery UI/paper.js have all downloaded *and* run.
@@ -14,8 +23,8 @@
14
23
  here (scripts/inject-version.mjs), which is also what makes the
15
24
  preload and wasm-player.js's own import() agree on one URL and share a
16
25
  single fetch. -->
17
- <link rel="modulepreload" href="_framework/dotnet.js?v=6.0.4" />
18
- <script type="text/javascript" src="quest-config.js?v=6.0.4"></script>
26
+ <link rel="modulepreload" href="_framework/dotnet.js?v=6.1.0-beta.2" />
27
+ <script type="text/javascript" src="quest-config.js?v=6.1.0-beta.2"></script>
19
28
  <script type="text/javascript">
20
29
  // Runs before the start screen is parsed, so when a game is specified via the
21
30
  // URL (or a defaultGameUrl is configured) we paint straight into the loading
@@ -24,7 +33,8 @@
24
33
  (function () {
25
34
  var params = new URLSearchParams(location.search);
26
35
  if (params.get('id') || params.get('url') || params.get('source') === 'editor'
27
- || params.get('source') === 'local' || window.QuestVivaConfig?.defaultGameUrl) {
36
+ || params.get('source') === 'local' || params.get('source') === 'qv'
37
+ || window.QuestVivaConfig?.defaultGameUrl) {
28
38
  document.documentElement.classList.add('qv-booting');
29
39
  }
30
40
  })();
@@ -33,32 +43,40 @@
33
43
  html.qv-booting #qv-pickers { display: none; }
34
44
  html.qv-booting #qv-loading-msg { display: flex; }
35
45
  </style>
36
- <script type="text/javascript" src="lib/jquery-2.1.1.min.js?v=6.0.4"></script>
37
- <script type="text/javascript" src="lib/jquery-ui.min.js?v=6.0.4"></script>
38
- <script type="text/javascript" src="lib/jquery.multi-open-accordion-1.5.3.js?v=6.0.4"></script>
39
- <link rel="stylesheet" type="text/css" href="lib/jquery-ui.min.css?v=6.0.4" />
40
- <link rel="stylesheet" type="text/css" href="playercore.css?v=6.0.4" />
46
+ <!-- The player UI a game plays on (legacy/ or v2/) isn't loaded here: wasm-player.js loads
47
+ just the one the game gets, once it's known (see preparePlayerUi), and puts its
48
+ stylesheets before this one. -->
41
49
  <!-- App-chrome styles (start screen, debugger, save-slot manager). Built from
42
50
  styles/chrome.css via `npm run build` — see WasmPlayer/package.json. All of
43
51
  its rules are contained to `.qv-chrome` subtrees so they can't affect the
44
- game UI above (playercore.css / jQuery UI). -->
45
- <link rel="stylesheet" type="text/css" href="chrome.css?v=6.0.4" />
46
- <script type="text/javascript" src="playercore.js?v=6.0.4"></script>
47
- <script type="text/javascript" src="player.js?v=6.0.4"></script>
48
- <script type="text/javascript" src="lib/paper.js?v=6.0.4"></script>
49
- <script>window.QuestVivaVersion = "6.0.4";</script>
50
- <script type="text/javascript" src="wasm-player.js?v=6.0.4"></script>
52
+ game UI. -->
53
+ <link rel="stylesheet" type="text/css" href="chrome.css?v=6.1.0-beta.2" />
54
+ <!-- The fonts built into the player (the themes' fonts), which any game can name. A font's
55
+ files are only downloaded once something uses it. See scripts/fetch-builtin-fonts.mjs. -->
56
+ <link rel="stylesheet" type="text/css" href="fonts/fonts.css?v=6.1.0-beta.2" />
57
+ <script type="text/javascript" src="game-saver.js?v=6.1.0-beta.2"></script>
58
+ <script>window.QuestVivaVersion = "6.1.0-beta.2";</script>
59
+ <script type="text/javascript" src="wasm-player.js?v=6.1.0-beta.2"></script>
51
60
  </head>
52
61
  <body>
53
62
  <div id="qv-start" class="qv-chrome">
54
63
  <div class="card preset-filled-surface-100-900 w-full max-w-md p-8 space-y-6" data-theme="wintry">
55
- <div>
64
+ <div id="qv-brand">
56
65
  <h1 class="h2 flex items-center gap-4">
57
- <img src="logo.svg?v=6.0.4" alt="" class="h-7" />
66
+ <img src="logo.svg?v=6.1.0-beta.2" alt="" class="h-7" />
58
67
  Quest Viva
59
68
  </h1>
60
69
  </div>
61
70
 
71
+ <!-- The game being loaded, once its name is known: from textadventures.co.uk's
72
+ api/Game for ?id=, or from the game itself once it has loaded (showGameInfo in
73
+ wasm-player.js). Replaces the big Quest Viva heading with a small one below. -->
74
+ <div id="qv-game-info" class="hidden flex-col items-center gap-3 text-center">
75
+ <img id="qv-game-cover" alt="" class="hidden w-40 max-h-60 object-contain rounded-lg" />
76
+ <h1 id="qv-game-name" class="h2 break-words"></h1>
77
+ <p id="qv-game-author" class="hidden text-surface-500"></p>
78
+ </div>
79
+
62
80
  <div id="qv-error" class="hidden card preset-tonal-error p-4 text-sm"></div>
63
81
 
64
82
  <div id="qv-pickers" class="space-y-4">
@@ -68,7 +86,8 @@
68
86
  <svg class="qv-icon" aria-hidden="true"><use href="#folder-open"></use></svg>
69
87
  Choose file (.quest, .aslx, .asl, .cas)
70
88
  </button>
71
- <input type="file" id="qv-file-input" class="hidden" accept=".quest,.aslx,.asl,.cas">
89
+ <input type="file" id="qv-file-input" class="hidden" accept=".quest,.aslx,.asl,.cas" multiple>
90
+ <p class="text-xs text-surface-500 mt-2">If an .aslx game uses library files of its own, choose them together with the game.</p>
72
91
  </div>
73
92
 
74
93
  <div class="flex items-center gap-3 text-surface-500 text-xs">
@@ -92,7 +111,12 @@
92
111
  </div>
93
112
 
94
113
  <div id="qv-clicktobegin" class="hidden flex-col items-center gap-3 text-surface-500 text-sm text-center">
95
- <button id="qv-clicktobegin-btn" type="button" class="btn preset-filled-primary-500">Begin</button>
114
+ <button id="qv-clicktobegin-btn" type="button" class="btn btn-lg preset-filled-primary-500 min-w-40 min-h-12">Begin</button>
115
+ </div>
116
+
117
+ <div id="qv-brand-small" class="hidden items-center justify-center gap-2 text-xs text-surface-500">
118
+ <img src="logo.svg?v=6.1.0-beta.2" alt="" class="h-3" />
119
+ Quest Viva
96
120
  </div>
97
121
  </div>
98
122
  </div>
@@ -140,60 +164,124 @@
140
164
  <path d="M18 6 6 18" />
141
165
  <path d="m6 6 12 12" />
142
166
  </symbol>
143
- <symbol id="trash-2" viewBox="0 0 24 24">
144
- <path d="M10 11v6" />
145
- <path d="M14 11v6" />
146
- <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" />
147
- <path d="M3 6h18" />
148
- <path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />
149
- </symbol>
150
167
  <symbol id="folder-open" viewBox="0 0 24 24">
151
168
  <path d="m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2" />
152
169
  </symbol>
153
170
  <symbol id="square" viewBox="0 0 24 24">
154
171
  <rect width="18" height="18" x="3" y="3" rx="2" />
155
172
  </symbol>
173
+ <symbol id="ellipsis" viewBox="0 0 24 24">
174
+ <circle cx="12" cy="12" r="1" />
175
+ <circle cx="19" cy="12" r="1" />
176
+ <circle cx="5" cy="12" r="1" />
177
+ </symbol>
178
+ <symbol id="save" viewBox="0 0 24 24">
179
+ <path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z" />
180
+ <path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7" />
181
+ <path d="M7 3v4a1 1 0 0 0 1 1h7" />
182
+ </symbol>
183
+ <symbol id="pencil" viewBox="0 0 24 24">
184
+ <path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" />
185
+ <path d="m15 5 4 4" />
186
+ </symbol>
187
+ <symbol id="download" viewBox="0 0 24 24">
188
+ <path d="M12 15V3" />
189
+ <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
190
+ <path d="m7 10 5 5 5-5" />
191
+ </symbol>
192
+ <symbol id="upload" viewBox="0 0 24 24">
193
+ <path d="M12 3v12" />
194
+ <path d="m17 8-5-5-5 5" />
195
+ <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
196
+ </symbol>
197
+ <symbol id="rotate-ccw" viewBox="0 0 24 24">
198
+ <path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" />
199
+ <path d="M3 3v5h5" />
200
+ </symbol>
201
+ <symbol id="bug" viewBox="0 0 24 24">
202
+ <path d="M12 20v-9" />
203
+ <path d="M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z" />
204
+ <path d="M14.12 3.88 16 2" />
205
+ <path d="M21 21a4 4 0 0 0-3.81-4" />
206
+ <path d="M21 5a4 4 0 0 1-3.55 3.97" />
207
+ <path d="M22 13h-4" />
208
+ <path d="M3 21a4 4 0 0 1 3.81-4" />
209
+ <path d="M3 5a4 4 0 0 0 3.55 3.97" />
210
+ <path d="M6 13H2" />
211
+ <path d="m8 2 1.88 1.88" />
212
+ <path d="M9 7.13V6a3 3 0 1 1 6 0v1.13" />
213
+ </symbol>
214
+ <symbol id="trash" viewBox="0 0 24 24">
215
+ <path d="M10 11v6" />
216
+ <path d="M14 11v6" />
217
+ <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" />
218
+ <path d="M3 6h18" />
219
+ <path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />
220
+ </symbol>
156
221
  </defs>
157
222
  </svg>
158
- <div class="card preset-filled-surface-100-900 w-full p-6 space-y-4" data-theme="wintry">
159
- <div class="flex items-start justify-between gap-4">
160
- <h2 class="h3" id="qv-saves-heading-boot" data-mode-text="boot" data-chrome-key="ContinueYourGamePrompt">Continue your game?</h2>
161
- <h2 class="h3 qv-manage-only" id="qv-saves-heading-manage" data-mode-text="manage" data-chrome-key="SaveLoadTitle">Save / Load</h2>
162
- <button id="qv-saves-close" type="button" class="qv-manage-only btn-icon preset-tonal-surface" aria-label="Close" data-chrome-key-aria-label="CloseDialog">
223
+ <div class="card preset-filled-surface-100-900 w-full p-5 space-y-4" data-theme="wintry">
224
+ <div class="flex items-center justify-between gap-4">
225
+ <h2 class="h4" id="qv-saves-heading-boot" data-mode-text="boot" data-chrome-key="ContinueYourGamePrompt">Continue your game?</h2>
226
+ <h2 class="h4 qv-manage-only" id="qv-saves-heading-manage" data-mode-text="manage" data-chrome-key="SavedGamesHeading">Saved games</h2>
227
+ <button id="qv-saves-close" type="button" class="qv-manage-only btn-icon btn-icon-sm hover:preset-tonal" aria-label="Close" data-chrome-key-aria-label="CloseDialog">
163
228
  <svg class="qv-icon" aria-hidden="true"><use href="#x"></use></svg>
164
229
  </button>
165
230
  </div>
166
231
 
167
232
  <div id="qv-saves-error" class="hidden card preset-tonal-error p-3 text-sm"></div>
168
233
 
169
- <button id="qv-saves-start-new" type="button" class="btn preset-tonal-primary w-full justify-start" data-chrome-key="StartFromBeginning">
170
- Start from the beginning
171
- </button>
234
+ <!-- Manage: save the game as it is now, into a new slot. The name is optional: an unnamed
235
+ save is shown by where the player was and when (renderSavesList in wasm-player.js). -->
236
+ <form id="qv-saves-save-form" class="qv-manage-only flex gap-2">
237
+ <input id="qv-saves-name-input" class="input min-w-0" type="text" placeholder="Name (optional)" aria-label="Name (optional)" autocomplete="off" data-chrome-key-placeholder="SaveNameOptional" data-chrome-key-aria-label="SaveNameOptional">
238
+ <button id="qv-saves-save-new" type="submit" class="btn preset-filled-primary-700-300 min-w-20" autofocus data-chrome-key="SaveButton">Save</button>
239
+ </form>
172
240
 
173
- <ul id="qv-saves-list" class="space-y-2"></ul>
241
+ <!-- Boot: carry on from the newest save, or start again. Older saves are listed below. -->
242
+ <div class="qv-boot-only space-y-2">
243
+ <button id="qv-saves-continue" type="button" class="btn preset-filled-primary-700-300 w-full flex-col items-start gap-0 text-left py-2" aria-describedby="qv-saves-continue-detail">
244
+ <span data-chrome-key="ContinueGame">Continue</span>
245
+ <span id="qv-saves-continue-detail" class="qv-saves-continue-detail text-sm font-normal"></span>
246
+ </button>
247
+ <button id="qv-saves-start-new" type="button" class="btn preset-tonal w-full" data-chrome-key="StartFromBeginning">Start from the beginning</button>
248
+ </div>
174
249
 
175
- <div class="qv-manage-only space-y-3">
176
- <hr class="hr">
177
- <div class="flex gap-2">
178
- <input id="qv-saves-name-input" class="input" type="text" placeholder="Save name" aria-label="Save name" autocomplete="off" data-chrome-key-placeholder="SaveNamePlaceholder" data-chrome-key-aria-label="SaveNamePlaceholder">
179
- <button id="qv-saves-save-new" type="button" class="btn preset-filled-primary-500" data-chrome-key="SaveNew">Save new</button>
180
- </div>
181
- <div class="flex gap-2">
182
- <button id="qv-saves-download" type="button" class="btn preset-tonal-primary flex-1" data-chrome-key="SaveToFile">Save to file</button>
183
- <button id="qv-saves-upload-btn" type="button" class="btn preset-tonal-primary flex-1" data-chrome-key="LoadFromFile">Load from file</button>
184
- <input type="file" id="qv-saves-file-input" class="hidden" accept=".quest-save">
185
- </div>
250
+ <h3 id="qv-saves-other-heading" class="qv-boot-only text-sm font-semibold" data-chrome-key="OtherSaves">Other saves</h3>
251
+ <ul id="qv-saves-list" class="qv-save-rows"></ul>
252
+
253
+ <!-- The chrome keys are on the labels' spans: applyChromeStrings replaces an element's text,
254
+ which would take the icon with it. -->
255
+ <div class="qv-manage-only qv-saves-footer flex flex-wrap gap-x-5 gap-y-2 pt-3">
256
+ <button id="qv-saves-download" type="button" class="anchor qv-saves-link"><svg class="qv-icon qv-icon-sm" aria-hidden="true"><use href="#download"></use></svg><span data-chrome-key="SaveToFile">Save to file</span></button>
257
+ <button id="qv-saves-upload-btn" type="button" class="anchor qv-saves-link"><svg class="qv-icon qv-icon-sm" aria-hidden="true"><use href="#upload"></use></svg><span data-chrome-key="LoadFromFile">Load from file</span></button>
258
+ <input type="file" id="qv-saves-file-input" class="hidden" accept=".quest-save">
259
+ <button id="qv-saves-restart" type="button" class="anchor qv-saves-link"><svg class="qv-icon qv-icon-sm" aria-hidden="true"><use href="#rotate-ccw"></use></svg><span data-chrome-key="StartAgain">Start again</span></button>
260
+ <button id="qv-saves-bug-report" type="button" class="anchor qv-saves-link"><svg class="qv-icon qv-icon-sm" aria-hidden="true"><use href="#bug"></use></svg><span data-chrome-key="CopyBugReport">Copy for a bug report</span></button>
261
+ </div>
262
+ <div id="qv-saves-footer-confirm" class="qv-manage-only"></div>
263
+ <p id="qv-saves-bug-report-status" class="hidden text-sm" role="status" aria-live="polite"></p>
264
+ <textarea id="qv-saves-bug-report-text" class="hidden textarea text-xs font-mono" rows="8" readonly aria-labelledby="qv-saves-bug-report-status"></textarea>
265
+
266
+ <!-- A save's options menu, opened by its ⋯ button and placed beside it by openSaveMenu in
267
+ wasm-player.js. A popover, so it sits above the dialog and closes on Escape or a click
268
+ elsewhere. -->
269
+ <div id="qv-saves-menu" class="qv-saves-menu" popover role="menu">
270
+ <button type="button" role="menuitem" data-menu-action="overwrite"><svg class="qv-icon qv-icon-sm" aria-hidden="true"><use href="#save"></use></svg><span data-chrome-key="OverwriteSave">Overwrite</span></button>
271
+ <button type="button" role="menuitem" data-menu-action="rename"><svg class="qv-icon qv-icon-sm" aria-hidden="true"><use href="#pencil"></use></svg><span data-chrome-key="RenameSave">Rename</span></button>
272
+ <button type="button" role="menuitem" data-menu-action="download"><svg class="qv-icon qv-icon-sm" aria-hidden="true"><use href="#download"></use></svg><span data-chrome-key="SaveToFile">Save to file</span></button>
273
+ <button type="button" role="menuitem" data-menu-action="delete" class="qv-saves-menu-danger"><svg class="qv-icon qv-icon-sm" aria-hidden="true"><use href="#trash"></use></svg><span data-chrome-key="DeleteSave">Delete</span></button>
186
274
  </div>
187
275
  </div>
188
276
  </dialog>
189
277
 
190
278
  <!-- Debugger — only ever shown in editor-preview sessions (see wasm-player.js's
191
279
  WebPlayer.setCanDebug call in initWasmPlayer). #cmdDebug (in playercore.htm,
192
- part of the shared WebPlayer/WasmPlayer chrome) already opens this dialog
193
- by id via showModal() — see playercore.js's initPlayerUI.
280
+ part of the shared player chrome) opens it non-modally — see
281
+ wasm-player.js's wireDebuggerButton.
194
282
 
195
- Position/size are entirely JS-driven (wireDebuggerMoveResize in
196
- wasm-player.js applies them right after every showModal(), before the
283
+ Position/size are entirely JS-driven (applyDebuggerRect in
284
+ wasm-player.js applies them right after every open, before the
197
285
  first paint) rather than left to the browser's default dialog centering,
198
286
  so the whole card is a flex column filling exactly the applied
199
287
  width/height — #qv-debugger-panes (and List/Detail inside it) flex-fill
@@ -216,7 +304,7 @@
216
304
  </div>
217
305
  <div id="qv-debugger-splitter" role="separator" aria-orientation="vertical" aria-label="Resize object list"></div>
218
306
  <div id="qv-debugger-detail" class="flex-1 overflow-y-auto text-sm">
219
- <p class="text-surface-500">Select an item to view details.</p>
307
+ <p class="text-surface-700-300">Select an item to view details.</p>
220
308
  </div>
221
309
  </div>
222
310
 
@@ -0,0 +1,107 @@
1
+ // The legacy UI's side of the player-UI adapter: everything wasm-player.js (the host) asks of
2
+ // whichever UI a game is playing on, typed as PlayerUiAdapter in ../../ui-v2/src/adapter.ts. The
3
+ // host loads this bundle only for games that get the legacy UI (see preparePlayerUi in
4
+ // wasm-player.js) and calls the UI only through this object.
5
+ //
6
+ // Each engine call is passed straight to the legacy global of the same name, looked up when it's
7
+ // called, so anything that wraps or replaces those globals (questui.js, or a game's own
8
+ // JavaScript) still sees it, exactly as when the host called them directly.
9
+
10
+ window.QuestPlayerUis = window.QuestPlayerUis || {};
11
+
12
+ window.QuestPlayerUis.legacy = {
13
+ // Engine calls (WasmPlayerBridge's JSImports).
14
+ addTextAndScroll: (html) => addTextAndScroll(html),
15
+ createNewDiv: (alignment) => createNewDiv(alignment),
16
+ bindMenu: (linkId, verbs, text, elementId) => bindMenu(linkId, verbs, text, elementId),
17
+ showMenu: (caption, options, allowCancel) => showMenu(caption, options, allowCancel),
18
+ showQuestion: (caption) => showQuestion(caption),
19
+ beginWait: () => beginWait(),
20
+ setTurnPending: (pending) => setTurnPending(pending),
21
+ beginPause: (ms) => beginPause(ms),
22
+ updateLocation: (location) => updateLocation(location),
23
+ setGameName: (name) => setGameName(name),
24
+ clearScreen: () => clearScreen(),
25
+ panesVisible: (visible) => panesVisible(visible),
26
+ updateStatus: (text) => updateStatus(text),
27
+ setBackground: (colour) => setBackground(colour),
28
+ setForeground: (colour) => setForeground(colour),
29
+ updateList: (listName, items) => updateList(listName, items),
30
+ updateCompass: (data) => updateCompass(data),
31
+ updateObjectLinks: (verbs) => updateObjectLinks(verbs),
32
+ gameFinished: () => gameFinished(),
33
+ requestNextTimerTick: (seconds) => requestNextTimerTick(seconds),
34
+ uiShow: (element) => uiShow(element),
35
+ uiHide: (element) => uiHide(element),
36
+ setCompassDirections: (directions) => setCompassDirections(directions),
37
+ setInterfaceString: (name, text) => setInterfaceString(name, text),
38
+ setPanelContents: (html) => setPanelContents(html),
39
+ loadHtml: (html) => loadHtml(html),
40
+ markScrollPosition: () => markScrollPosition(),
41
+ scrollToEnd: () => scrollToEnd(),
42
+ requestSave: () => saveGame(),
43
+
44
+ // Lifecycle.
45
+ async start() {
46
+ await setupPaperJs();
47
+ initPlayerUI();
48
+ },
49
+ resetOutput: () => resetGameOutput(),
50
+ // Stops player.js's 1-second interval from ever starting.
51
+ useManualClock() {
52
+ window.startTimer = () => {};
53
+ },
54
+
55
+ // Saving.
56
+ getOutputHtml: () => $("#divOutput").html(),
57
+ getLocation: () => $("#location").text().trim(),
58
+ gameSaved() {
59
+ addText(`${window.WebPlayer?.chromeStrings?.GameSaved ?? "Game saved."}<br>`);
60
+ clearUnsavedProgress();
61
+ },
62
+ clearUnsavedProgress: () => clearUnsavedProgress(),
63
+ setCanSave(value) {
64
+ canSave = value;
65
+ if (!value) window.saveGame = () => addText("Disabled");
66
+ },
67
+
68
+ // The host's wait, pause and sound plumbing.
69
+ waitEnded: () => waitEnded(),
70
+ pauseEnded: () => pauseEnded(),
71
+ // A synchronous sound holds the turn like a wait: hide the command bar until it ends.
72
+ // Returns whether to show it again afterwards. Counts a pause whose restore is still pending
73
+ // as visible - see _pauseRestorePending - or the bar would stay hidden for good.
74
+ beginSoundWait() {
75
+ const showCommandBar = isElementVisible("#txtCommandDiv") || _pauseRestorePending;
76
+ _waitingForSoundToFinish = true;
77
+ $("#txtCommandDiv").hide();
78
+ return showCommandBar;
79
+ },
80
+ endSoundWait(showCommandBar) {
81
+ _waitingForSoundToFinish = false;
82
+ window.setTimeout(async function () {
83
+ if (showCommandBar) $("#txtCommandDiv").show();
84
+ await WebPlayer.uiEndWait();
85
+ }, 100);
86
+ },
87
+
88
+ rememberImageSize: (url, width, height) => rememberImageSize(url, width, height),
89
+ setAnimateScroll(value) {
90
+ _animateScroll = value;
91
+ },
92
+ };
93
+
94
+ // The map: paper.js on a canvas, running grid.js as PaperScript. Set up afresh for each game and
95
+ // restart, since each one swaps in new markup.
96
+ async function setupPaperJs() {
97
+ if (!window.paper) return;
98
+ const canvas = document.createElement('canvas');
99
+ canvas.id = 'gridCanvas';
100
+ canvas.width = 700;
101
+ canvas.height = 300;
102
+ canvas.style.display = 'none';
103
+ document.body.appendChild(canvas);
104
+ paper.setup(canvas);
105
+ const code = await fetch(versioned('legacy/grid.js')).then(r => r.text());
106
+ paper.PaperScript.evaluate(code, paper);
107
+ }
@@ -54,6 +54,8 @@ gridApi.setZoom = function (zoom) {
54
54
  };
55
55
 
56
56
  gridApi.zoomIn = function (amount) {
57
+ // QuestUI.setMapInteractive(false) (questui.js)
58
+ if (window._qvMapInteractive === false) return;
57
59
  zoom = paper.view.zoom * (Math.pow(1.1, amount));
58
60
  if (zoom > 0.0001) {
59
61
  paper.view.zoom = zoom;
@@ -61,6 +63,7 @@ gridApi.zoomIn = function (amount) {
61
63
  };
62
64
 
63
65
  function onMouseDrag(event) {
66
+ if (window._qvMapInteractive === false) return;
64
67
  updateOffset(event.delta);
65
68
  }
66
69
 
@@ -1,4 +1,6 @@
1
1
  var $_GET = {};
2
+ // Unused by the player itself. Kept because Quest 5 games' own JavaScript may
3
+ // test it (Quest 5's WebPlayer set it to true), and removing it would throw.
2
4
  var webPlayer = false;
3
5
  var tmrTick = null;
4
6
  var tickCount = 0;
@@ -28,12 +30,37 @@ function setUpSessionLog() {
28
30
 
29
31
  var _waitingForSoundToFinish = false;
30
32
 
33
+ // Whether a menu or question is waiting for the player, from when its dialog opens until the
34
+ // turn its answer resumes has finished. The answer reaches the engine 100ms after the dialog
35
+ // closes, so its closing can paint first. A command sent in that gap would reach the engine
36
+ // first, and if it asked something of its own, the delayed answer would be taken as the reply
37
+ // to that instead. canSendCommand can't do this job: the engine finishes the command that opened
38
+ // the dialog while the dialog is still waiting, and that sets canSendCommand back to true.
39
+ var _dialogPending = false;
40
+ // Counts the dialogs opened, so an answer whose turn opens the next dialog (two Asks in a row)
41
+ // doesn't clear the flag for that one when it finishes.
42
+ var _dialogCount = 0;
43
+
44
+ function dialogOpened() {
45
+ _dialogCount++;
46
+ _dialogPending = true;
47
+ }
48
+
49
+ function sendDialogAnswer(send) {
50
+ var answering = _dialogCount;
51
+ window.setTimeout(async function () {
52
+ try {
53
+ await send();
54
+ } finally {
55
+ if (_dialogCount === answering) _dialogPending = false;
56
+ }
57
+ }, 100);
58
+ }
59
+
31
60
  function msgboxSubmit(response) {
32
61
  markUnsavedProgress();
33
62
  $("#msgbox").dialog("close");
34
- window.setTimeout(async function () {
35
- await WebPlayer.uiSetQuestionResponse(response);
36
- }, 100);
63
+ sendDialogAnswer(function () { return WebPlayer.uiSetQuestionResponse(response); });
37
64
  }
38
65
 
39
66
  var _menuSelection = "";
@@ -95,6 +122,7 @@ function showMenu(title, options, allowCancel) {
95
122
  }
96
123
 
97
124
  _menuSelection = "";
125
+ dialogOpened();
98
126
  $("#dialog").dialog(dialogOptions);
99
127
 
100
128
  $("#dialog").dialog("open");
@@ -105,9 +133,8 @@ function dialogSelect() {
105
133
  if (_menuSelection.length > 0) {
106
134
  markUnsavedProgress();
107
135
  $("#dialog").dialog("close");
108
- window.setTimeout(function () {
109
- WebPlayer.uiChoice(_menuSelection);
110
- }, 100);
136
+ var selection = _menuSelection;
137
+ sendDialogAnswer(function () { return WebPlayer.uiChoice(selection); });
111
138
  }
112
139
  }
113
140
 
@@ -122,13 +149,11 @@ function dialogClose() {
122
149
  }
123
150
 
124
151
  function dialogSendCancel() {
125
- window.setTimeout(async function () {
126
- await WebPlayer.uiChoiceCancel();
127
- }, 100);
152
+ sendDialogAnswer(function () { return WebPlayer.uiChoiceCancel(); });
128
153
  }
129
154
 
130
155
  function sendCommand(text, metadata) {
131
- if (_pauseMode || _waitingForSoundToFinish || _waitMode || !canSendCommand) return;
156
+ if (_pauseMode || _waitingForSoundToFinish || _waitMode || _dialogPending || !canSendCommand) return;
132
157
  canSendCommand = false;
133
158
  markScrollPosition();
134
159
  markUnsavedProgress();
@@ -194,46 +219,6 @@ function saveGame() {
194
219
  }, 100);
195
220
  }
196
221
 
197
- // Initialise() unconditionally re-registers the game's external scripts every
198
- // time it runs, including on a mid-session restart (Start from the beginning
199
- // / Load) — but a real <script src> only ever runs once per document, so
200
- // re-adding the same URL against the *same* live DOM would re-execute the
201
- // game's setup code against elements it already set up on the previous run
202
- // (e.g. a custom sidebar pane), producing duplicates. Dedupe by URL so each
203
- // script tag still only truly executes once per document, same as normal
204
- // page-load semantics.
205
- //
206
- // A restart also wipes and rebuilds the whole player chrome first (see
207
- // WasmPlayer's swapInPlayerUi() / WebPlayer's resetPlayerUi()), so by the
208
- // time Initialise() re-registers scripts against that fresh DOM, the
209
- // "already set up on the previous run" premise above no longer holds — the
210
- // old elements are gone, and the dedupe would wrongly skip re-running setup
211
- // code against the new ones, silently dropping anything the script injects
212
- // (confirmed via a real game's custom sidebar pane vanishing after restart).
213
- // Both chrome-reset call sites clear the set via clearLoadedExternalScripts()
214
- // so a restart's re-registration is treated as a genuinely fresh page load.
215
- var _loadedExternalScripts = new Set();
216
-
217
- function clearLoadedExternalScripts() {
218
- _loadedExternalScripts.clear();
219
- }
220
-
221
- function addExternalScript(url) {
222
- if (_loadedExternalScripts.has(url)) return Promise.resolve();
223
- _loadedExternalScripts.add(url);
224
-
225
- return new Promise((resolve, reject) => {
226
- const script = document.createElement("script");
227
- script.src = url;
228
- script.onload = () => resolve();
229
- script.onerror = () => {
230
- _loadedExternalScripts.delete(url);
231
- reject(new Error(`Failed to load script: ${url}`));
232
- };
233
- document.head.appendChild(script);
234
- });
235
- }
236
-
237
222
  // The "write log to file" feature itself was removed from Core.aslx (#1924) - a game authored
238
223
  // since then has no way to call this. But an already-published game's own inlined Log function
239
224
  // may still call JS.WriteToLog(text) when its game.writelogtofile flag is set, and that has to
@@ -253,22 +238,12 @@ function WriteToTranscript(data) {
253
238
  tName = data.split("___SCRIPTDATA___")[0].trim() || tName;
254
239
  data = data.split("___SCRIPTDATA___")[1];
255
240
  }
256
- // Electron: file storage under userData rather than localStorage, since
257
- // this window's origin (a local loopback port) isn't guaranteed to stay
258
- // the same across restarts — see transcript-store.ts. window.electronTranscripts
259
- // is bridged by player-transcript-preload.ts for every player window.
260
- if (navigator.userAgent.includes('Electron/')) {
261
- if (window.electronTranscripts) void window.electronTranscripts.append(tName, data);
262
- return;
263
- }
264
- if (!isLocalStorageAvailable()) {
241
+ // The host keeps the transcripts, for both UIs (wasm-player.js).
242
+ if (!WebPlayer.appendToTranscript(tName, data)) {
265
243
  console.error("There is no localStorage. Disabling transcript functionality.");
266
244
  noTranscript = true;
267
245
  savingTranscript = false;
268
- return;
269
246
  }
270
- var oldData = localStorage.getItem("questtranscript-" + tName) || "";
271
- localStorage.setItem("questtranscript-" + tName, oldData + data);
272
247
  }
273
248
 
274
249
  // Make sure localStorage is available, hopefully without throwing any errors!