-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmoonmist.h
409 lines (350 loc) · 14.6 KB
/
moonmist.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
! ----------------------------------------------------------------------------
! moonmist.h
! Outsources recurring code that does not necessarily change
! per game but is considered characteristic for a Moonmist
! release. This makes the main story file less cluttered with
! static code for better focus. Grammar and subs are grouped,
! comment if a game doesn't make use of a certain feature.
!
! Copyright (c) 2023 Stefan Vogt, Moonmist Entertainment
! http://8bitgames.itch.io
! ----------------------------------------------------------------------------
! recurring messages and conversations
Constant MESS_SCENERY "It's just scenery. Don't worry about it.";
! hic sunt dracones... trigger with 'aenima' magic verb in debug mode ------------------------------------
#ifdef DEBUG;
Verb meta 'aenima' * -> Cheatmode;
[ CheatmodeSub;
! PROGRESS_LEVEL = 10;
! PlayerTo(Dovecote);
MoveFloatingObjects();
update_moved = true;
scope_modified = true;
];
#endif;
! --------------------------------------------------------------------------------------------------------
! checking known problems that may occur with Infocom interpreters
#ifdef DEBUG;
Verb meta 'terpbreaker' * -> TerpBreaker;
[ TerpBreakerSub obj prop;
print "Property array length test...^"; ! issue with Amiga / ST when properties hold 32 entries
objectloop(obj) {
@get_next_prop obj 0 -> prop; ! get first property
while(prop) {
if(obj.#prop > 63)
print "Object ", (name) obj, ", property ", (property) prop, " is length 32.^";
@get_next_prop obj prop -> prop; ! get next property
}
}
print "Test complete.^";
];
#endif;
! --------------------------------------------------------------------------------------------------------
! general grammar and enhancements
Verb meta 'continue' = 'again';
Verb meta 'credits' * -> Credits;
Verb 'xyzzy' * -> Xyzzy;
Extend 'rub' * noun 'with' held -> Rub;
Extend 'turn' * 'over' noun -> Turn;
Extend 'examine' * 'back' 'of' noun -> Turn
* 'the' 'back' 'of' noun -> Turn;
Extend 'look' * 'through'/'out' noun -> Examine;
Extend 'look' * 'out' 'of' noun -> Examine;
Extend 'look' * 'around' -> Look;
Extend 'attack' * held 'at'/'on' noun -> Attack;
Extend 'speak' replace
* noun -> Talk
* 'to'/'with' noun -> Talk;
Extend 'ask' replace
* noun -> Talk
* noun 'for' noun -> AskFor;
Verb 'grab' = 'take';
Verb 'kick' = 'attack';
Verb 'flip' = 'turn';
Verb 'consult' = 'open';
! --------------------------------------------------------------------------------------------------------
! the game's ABOUT grammar and sub
Verb meta 'about' * -> About;
[ AboutSub;
print (string)Story, " is copyright (c) 2023 by Stefan Vogt and Moonmist Entertainment.^^You may freely distribute the game, but you have to link to ";
ChangeFgColour(clr_emphasis_fg);
print "<8bitgames.itch.io>";
ChangeFgColour(clr_default_fg);
print ". This work may not be sold or included in any for-profit collection without written permission from the author.^^Please send bug reports to ";
ChangeFgColour(clr_emphasis_fg);
print "<stefan@@64";
print "8-bit.info>";
ChangeFgColour(clr_default_fg);
print ".^^For acknowledgements and credits, please type ";
ChangeFgColour(clr_emphasis_fg);
print "CREDITS";
ChangeFgColour(clr_default_fg);
".";
];
! --------------------------------------------------------------------------------------------------------
! grammar and sub for the HELP command
Verb meta 'help' * -> Help;
[ HelpSub;
print "Try to ";
ChangeFgColour(clr_emphasis_fg);
print "[examine]";
ChangeFgColour(clr_default_fg);
print " everything that is mentioned in room descriptions, otherwise you might miss important hints. Note that ";
ChangeFgColour(clr_emphasis_fg);
print "[examine]";
ChangeFgColour(clr_default_fg);
print " and ";
ChangeFgColour(clr_emphasis_fg);
print "[search]";
ChangeFgColour(clr_default_fg);
print " trigger different actions in this game.^^Your actions may also create different results based on the game's progress level. For example, why would you ";
ChangeFgColour(clr_emphasis_fg);
print "[dig]";
ChangeFgColour(clr_default_fg);
print " something if you don't know what you're looking for? If you ";
ChangeFgColour(clr_emphasis_fg);
print "[examine]";
ChangeFgColour(clr_default_fg);
print " a certain object, it could reveal new information once you found out something in the course of the game.^^The game's package contains a PlayIF card that explains basic gameplay and many synonyms will enhance what you read on it.^^Conversations are not as complex as in Infocom titles. It is sufficient to type ";
ChangeFgColour(clr_emphasis_fg);
print "[talk to NPC]";
ChangeFgColour(clr_default_fg);
print " or ";
ChangeFgColour(clr_emphasis_fg);
print "[ask NPC]";
ChangeFgColour(clr_default_fg);
print ".^^When you start the game, you will find a manor compendium in your inventory. At many places in the manor, you can ";
ChangeFgColour(clr_emphasis_fg);
print "[read compendium]";
ChangeFgColour(clr_default_fg);
print " to reveal additional information about the current location. Sometimes objects are mentioned in the compendium that cannot be found in the room description, but which can then be examined. It should be noted here that the compendium is not required to solve the game, instead it provides an additional layer of atmosphere for those who want to delve deeper into the game's plot";
ChangeFgColour(clr_default_fg);
print ".^^Use the ";
ChangeFgColour(clr_emphasis_fg);
print "[save]";
ChangeFgColour(clr_default_fg);
print " command to store your progress and ";
ChangeFgColour(clr_emphasis_fg);
print "[restore]";
ChangeFgColour(clr_default_fg);
" to load it again.";
];
! --------------------------------------------------------------------------------------------------------
! adding support for TURN AROUND as TURN YOURSELF synonym
Extend 'turn' * 'around' -> TurnAround;
[ TurnAroundSub;
<<Turn player>>;
];
! --------------------------------------------------------------------------------------------------------
! sub and grammar for the unsupported USE verb
Verb 'use' * -> Use
* noun -> Use
* noun 'with'/'on'/'in'/'at' noun -> Use;
[ UseSub;
print "This game does not support the ";
ChangeFgColour(clr_emphasis_fg);
print "[use]";
ChangeFgColour(clr_default_fg);
" verb. You need to be more specific.";
];
! --------------------------------------------------------------------------------------------------------
! extending unlock to make unlocking with a key default
Extend 'unlock' first * noun -> UnlockWithoutKey;
[ UnlockWithoutKeySub;
if (noun has lockable) print_ret "Try being more specific. You probably want to unlock ", (the) noun, " with a certain object?";
"You cannot unlock this object.";
];
! --------------------------------------------------------------------------------------------------------
! extending LOOK with LOOK UNDER
Extend 'look' * 'under' noun -> LookUnder;
[ LookUnderSub;
print "You don't have to look under any objects in this game. The only two verbs you need in this context are ";
ChangeFgColour(clr_emphasis_fg);
print "[examine]";
ChangeFgColour(clr_default_fg);
print " and ";
ChangeFgColour(clr_emphasis_fg);
print "[search]";
ChangeFgColour(clr_default_fg);
".";
];
! --------------------------------------------------------------------------------------------------------
! let's change Puny's TAKE sub since the standard behavior only allows basic replies
[ TakeSub inplayer;
if (parent(noun) in player) inplayer = true;
if(TryToTakeNoun() ~= false) rtrue;
print "You take ", (the) noun;
if (inplayer == true) print " out";
else print " with you";
".";
];
! --------------------------------------------------------------------------------------------------------
! not particularly happy with Puny's STAND behavior, so we replace it with our own grammar
Extend 'stand' replace
* -> Stand
* 'up' -> Stand
* 'on' noun -> Enter;
[ StandSub;
"You're already standing up.";
];
! --------------------------------------------------------------------------------------------------------
! replacing Puny's THROWAT an implementation loosly based on the Dialog standard lib
Verb 'toss' = 'throw';
[ ThrowAtSub;
if(ObjectIsUntouchable(second)) return;
if(ImplicitDisrobeIfWorn(noun)) rtrue;
if(second > 1) {
#IfDef DEBUG;
if(debug_flag & 1) print "(", (name) second, ").before()^";
#EndIf;
action = ##ThrownAt;
if (RunRoutines(second, before) ~= 0) { action = ##ThrowAt; rtrue; }
action = ##ThrowAt;
}
if(RunLife(second,##ThrowAt) ~= 0) rfalse;
print_ret "Throwing ", (the) noun, " at ", (the) second, " would achieve little.";
];
! --------------------------------------------------------------------------------------------------------
! replacing Puny's SMELL sub with an implementation adapted from Dialog
[ SmellSub;
if(ObjectIsUntouchable(noun)) return;
if(noun == nothing) "You sniff at the air, perceiving nothing that surprises you.";
if (~~ noun == player) print (The) noun;
else "You smell as fine as usual.";
print " smell";
if (noun hasnt pluralname) print "s";
" as expected.";
];
! --------------------------------------------------------------------------------------------------------
! replacing FILL with a custom implementation
Extend 'fill' replace
* -> FillError
* noun -> FillError
* noun 'with' noun -> Fill
* noun 'in'/'into' noun -> Fill;
Verb 'pour' = 'fill';
Verb 'spill' = 'fill';
[ FillSub;
"This object doesn't support being poured or filled.";
];
[ FillErrorSub;
print "The ";
print (verbname) verb_word;
print " command wants you to be more specific: ";
ChangeFgColour(clr_emphasis_fg);
if (verb_word == 'fill') print "[fill object with something]";
else print "[pour object in/into something]";
ChangeFgColour(clr_default_fg);
".";
];
! --------------------------------------------------------------------------------------------------------
! replacing DIG with a custom implementation
Extend 'dig' replace
* -> DigError
* noun -> DigError
* noun 'with' 'hand' -> DigWithHand
* noun 'with' 'hands' -> DigWithHand
* noun 'with' held -> Dig;
[ DigSub;
"As much as you ~dig~ the idea, it would achieve nothing.";
];
[ DigWithHandSub;
DigSub();
];
[ DigErrorSub;
print "The dig command wants you to be more specific: ";
ChangeFgColour(clr_emphasis_fg);
print "[dig something with object]";
ChangeFgColour(clr_default_fg);
".";
];
! --------------------------------------------------------------------------------------------------------
! adding BURN from extended verbset using a custom implementation
Verb 'burn'
* noun -> Burn
* noun 'with' noun -> Burn
* 'up' noun -> Burn;
Verb 'flick' = 'burn';
Verb 'ignite' = 'burn';
Verb 'light' = 'burn';
[ BurnSub;
if(ImplicitGrabIfNotHeld(second)) rtrue;
"Your pyromania will get you nowhere here.";
];
! --------------------------------------------------------------------------------------------------------
! adding KISS verb, partly inherited from Dialog
Verb 'kiss' * -> Kiss
* noun -> Kiss;
Verb 'hug' = 'kiss';
Verb 'embrace' = 'kiss';
[ KissSub;
if(noun == nothing) "What is the target of your fondness tendencies?";
if(noun == player) "Your feelings for yourself are primarily of a platonic nature.";
if(noun has animate) print_ret (The) noun, " is unmoved by your display of affection.";
print_ret "You practice some objectophilia with ", (the) noun, ".";
];
! --------------------------------------------------------------------------------------------------------
! LISTEN verb borrowed from the Dialog standard library and adapted to Inform
Extend 'listen' replace
* -> Listen
* 'to' noun -> Listen;
[ ListenSub;
if (noun == nothing) print_ret(string)MSG_LISTEN_DEFAULT;
if (noun == player) "You can hear the familiar rumble of your blood stream and the faint whine of your nervous system.";
if (noun has animate) print_ret (The) noun, " is silent.";
print_ret "You hear no particular sound coming from ", (the)noun, ".";
];
! --------------------------------------------------------------------------------------------------------
! adding WAVE from Puny's extended verbset
Verb 'wave' * -> WaveHands
* noun -> Wave;
[ WaveSub;
if(parent(noun) ~= player) { PrintMsg(MSG_WAVE_NOTHOLDING, noun); rtrue; }
print_ret "You wave ", (the) noun, " in the air, with no apparent consequences.";
];
[ WaveHandsSub;
"You wave your hands in the air.";
];
! --------------------------------------------------------------------------------------------------------
! DANCE verb borrowed form the Dialog standard library and adapted to Inform
Verb 'dance' * -> Dance
* 'with' noun -> Dance;
Verb 'jive' = 'dance';
Verb 'twirl' = 'dance';
Verb 'spin' = 'dance';
[ DanceSub;
"You practise your moves.";
];
! --------------------------------------------------------------------------------------------------------
! SING verb borrowed form the Dialog standard library and adapted to Inform
Verb 'sing' * -> Sing
* 'with' noun -> Sing;
Verb 'hum' = 'sing';
[ SingSub;
"You hum a few notes.";
];
! --------------------------------------------------------------------------------------------------------
! TIE/ATTACH verb borrowed from the Dialog standard library and adapted to Inform
[ TieSub;
if(second == nothing) "To what?";
print_ret "There's no obvious way to attach ", (the) noun, " to ", (the) second, ".";
];
! --------------------------------------------------------------------------------------------------------
! subtle change to Puny's ATTACK implementation
[ AttackSub;
if(ImplicitGrabIfNotHeld(second)) rtrue;
if (ObjectIsUntouchable(noun)) return;
if (noun has animate && RunLife(noun, ##Attack) ~= 0) rfalse;
print_ret "You consider to ", (verbname) verb_word, " ", (the) noun, ", but reject the idea.";
];
! --------------------------------------------------------------------------------------------------------
! squeeze borrowed from the Dialog standard library and adapted to Inform
Verb 'squeeze' 'squash'
* noun -> Squeeze;
[ SqueezeSub; ! Dialog standard: print_ret "You give ", (the) noun, " a bit of a squeeze.";
if (ObjectIsUntouchable(noun)) return;
if (noun has animate) print_ret "You have a dirty mind.";
print_ret "Years of practice with ketchup bottles have made you a master squeezer. \
Yet nothing happens as you give ", (the) noun, " a bit of a squeeze.";
];
! --------------------------------------------------------------------------------------------------------