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
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "glk/agt/agility.h"
#include "glk/agt/interp.h"
#include "glk/agt/exec.h"
namespace Glk {
namespace AGT {
static void d_moveobj(int obj, int dest)
/* 1=the player, -1=unknown: ask */
{
if (obj == -1) {
writestr("Which object? ");
obj = read_number();
if (obj != 1 && !tnoun(obj) && !tcreat(obj)) {
writeln("Invalid object");
return;
}
}
if (dest == -1) {
writestr("To where? ");
dest = read_number();
if (dest != 1 && dest != 0 && !tnoun(dest) && !tcreat(dest) && !troom(dest)) {
writeln("Invalid object");
return;
}
}
if (obj != 1)
it_move(obj, dest);
else {
if (!troom(dest)) {
writeln("Player can only be moved to a room");
return;
}
goto_room(dest - first_room);
}
}
static int print_objid(int obj) {
char buff[10];
char *s;
int n;
sprintf(buff, "%4d: ", obj);
writestr(buff);
s = objname(obj);
for (n = 0; s[n] != 0; n++)
if (s[n] <= 8 || (uchar)s[n] == 0xFF) s[n] = ' '; /* Strip out format codes */
writestr(s);
n = strlen(s);
rfree(s);
return n;
}
static void d_listroom() {
int i;
writeln(" ROOM");
writeln(" ------");
writeln("");
for (i = 0; i <= maxroom - first_room; i++) {
print_objid(i + first_room);
writeln("");
}
}
#define SEPLENG 27 /* Width between beginning of object column and
location column */
static void d_listnoun() {
int i;
int len;
writestr(" NOUN ");
padout(SEPLENG - 6);
writeln(" LOCATION ");
writestr(" ------");
padout(SEPLENG - 6);
writeln(" ----------");
writeln("");
len = SEPLENG - print_objid(1);
padout(len);
writestr("[");
print_objid(loc);
writeln("]");
nounloop(i) {
len = print_objid(i + first_noun);
len = SEPLENG - len;
if (len > 0) padout(len);
writestr("[");
print_objid(noun[i].location);
writeln("]");
}
}
static void d_listcreat() {
int i;
int len;
writestr(" CREATURE ");
padout(SEPLENG - 11);
writeln(" LOCATION ");
writestr(" ----------");
padout(SEPLENG - 11);
writeln(" ----------");
writeln("");
creatloop(i) {
len = print_objid(i + first_creat);
len = SEPLENG - len;
if (len > 0) padout(len);
writestr(" [");
print_objid(creature[i].location);
writeln("]");
}
}
static void writetbl(const char *s, int width)
/* This writes out s and then prints out any additional spaces needed
to make the output string *width* wide. */
{
writestr(s);
width = width - strlen(s);
if (width > 0) padout(width);
}
static void var_edit(int vtype)
/* vtype=0 for variable, 1 for counter, 2 for flag */
{
long n;
int i;
int imax;
char sbuff[30];
switch (vtype) {
case 0:
imax = VAR_NUM;
break;
case 1:
imax = CNT_NUM;
break;
case 2:
imax = FLAG_NUM;
break;
default:
writeln("INTERNAL ERROR: Invalid vtype.");
return;
}
for (;;) {
agt_clrscr();
writeln("");
switch (vtype) {
case 0:
writeln("Variables");
break;
case 1:
writeln("Counters (-1 means the counter is off)");
break;
case 2:
writeln("Flags ( f=false [OFF] and t=true [ON] )");
break;
default:
break;
}
writeln("");
for (i = 0; i <= imax; i++) {
switch (vtype) {
case 0:
sprintf(sbuff, "[Var%3d]=%4ld", i, (long)agt_var[i]);
break;
case 1:
sprintf(sbuff, "[Cnt%3d]=%4ld", i, (long)agt_counter[i]);
break;
case 2:
sprintf(sbuff, "%3d%c", i, flag[i] ? 't' : 'f');
break;
default:
break;
}
writetbl(sbuff, (vtype == 2) ? 5 : 20);
}
writeln("");
writeln("");
for (;;) {
switch (vtype) {
case 0:
writestr("Variable to change");
break;
case 1:
writestr("Counter to change");
break;
case 2:
writestr("Flag to toggle");
break;
default:
break;
}
writestr(" (-1 to quit): ");
i = read_number();
if (i < 0) return;
if (i <= imax) {
if (vtype != 2) {
if (vtype == 0)
sprintf(sbuff, "[Var%d]=%ld", i, (long)agt_var[i]);
else sprintf(sbuff, "[Cnt%d]=%ld (-1 means it's off)",
i, (long)agt_counter[i]);
writestr(sbuff);
writestr("; new value = ");
n = read_number();
if (vtype == 0)
agt_var[i] = n;
else if (n < -1 || n > (((long)1) << 15) - 1)
writeln("Invalid value for a counter.");
else agt_counter[i] = n;
} else flag[i] = !flag[i];
break;
} else
writeln("Invalid index.");
}
}
}
/* Routines to edit user strings */
static void edit_str() {
int i, j;
char buff[10];
char *tmpstr;
if (MAX_USTR == 0 || userstr == NULL) {
writeln("This game doesn't contain any user strings");
return;
}
for (;;) {
agt_clrscr();
writeln("User Definable Strings");
writeln("");
for (i = 0; i < MAX_USTR; i++) {
sprintf(buff, "%2d:", i + 1);
writestr(buff);
writeln(userstr[i]);
}
writestr(" (0 to quit): ");
i = read_number();
if (i == 0) return;
if (i > 0 && i <= MAX_USTR) {
writeln("Enter new string:");
tmpstr = agt_readline(3);
j = strlen(tmpstr) - 1;
if (j > 0 && tmpstr[j] == '\n') tmpstr[j] = 0;
strncpy(userstr[i - 1], tmpstr, 80);
} else writeln("Invalid string number");
}
}
static uchar attrcol; /* Determines which column the attribute is put in */
static uchar attrwidth; /* Number of attribute columns */
static void next_col() {
if (++attrcol == attrwidth) {
writeln("");
attrcol = 0;
} else
padout(10);
}
static void writeattr(const char *attrname, rbool attrval) {
writestr(attrname);
padout(15 - strlen(attrname));
if (attrval) writestr("yes");
else writestr("no ");
next_col();
}
static void writegender(const char *gendername, uchar genderval) {
writestr(gendername);
padout(15 - strlen(gendername) - 3);
switch (genderval) {
case 2:
writestr("Male ");
break;
case 1:
writestr("Female");
break;
case 0:
writestr("Thing");
break;
default:
break;
}
next_col();
}
static void writeprop(const char *propname, int obj) {
writestr(propname);
writestr(" [");
print_objid(obj);
writeln("]");
}
static int writedir(int index, int dir, int obj) {
char sbuff[40];
sprintf(sbuff, "%2d.%-2s %d", index, exitname[dir], obj);
writestr(sbuff);
return strlen(sbuff);
}
void writenum(const char *propname, int n) {
char sbuff[20];
writestr(propname);
sprintf(sbuff, "%4d", n);
writeln(sbuff);
}
static void writeflags(const char *flagname, int32 flags) {
int i;
char sbuff[5];
writestr(flagname);
for (i = 0; i < 32; i++) {
if (flags & 1) {
sprintf(sbuff, "%2d ", i);
writestr(sbuff);
} else
writestr(" ");
flags >>= 1;
if (i % 12 == 11) {
writeln("");
padout(strlen(flagname));
}
}
writeln("");
}
static void readflags(int32 *flags) {
long n;
writestr("Room flag to toggle (0-31)? ");
n = read_number();
if (n <= 31 && n >= 0)
*flags ^= (((long)1) << n);
}
static long readval(const char *prompt, int type) {
long val;
for (;;) {
writestr(prompt);
writestr(" ");
val = read_number();
if (argvalid(type, val)) return val;
writeln("Invalid value.");
}
}
static uchar readgender() {
char c;
writestr("Gender (M/F/N): ");
for (;;) {
c = tolower(agt_getchar());
switch (c) {
case 'm':
return 2;
case 'w':
case 'f':
return 1;
case 'n':
case 't':
return 0;
default: ;/* Do nothing */
}
}
}
static void edit_objattr(int obj) {
int i, k, kprop, n;
long v;
for (;;) {
k = 1;
agt_clrscr();
print_objid(obj);
writeln("");
if (oflag_cnt > 0) {
writeln("ObjFlags:");
for (i = 0; i < oflag_cnt; i++)
if (have_objattr(0, obj, i)) {
v = op_objflag(2, obj, i);
rprintf("%2d. ObjProp%2d:%c %-40s\n", k++, i, (v ? '+' : '-'),
get_objattr_str(AGT_OBJFLAG, i, v));
}
writeln("");
}
kprop = k;
if (oprop_cnt > 0) {
writeln("ObjProps:");
for (i = 0; i < oprop_cnt; i++)
if (have_objattr(1, obj, i)) {
v = op_objprop(2, obj, i, 0);
rprintf("%2d. ObjFlag%2d: [%3ld] %-40s\n", k++, i, v,
get_objattr_str(AGT_OBJPROP, i, v));
}
writeln("");
}
writestr("Field to change (0 to return to main view)? ");
n = read_number();
if (n == 0) return;
if (n < 1 || n >= k) continue;
k = 0;
if (n < kprop) { /* Attribute */
for (i = 0; i < oflag_cnt; i++)
if (have_objattr(0, obj, i))
if (n == ++k) break;
if (n == k && have_objattr(0, obj, i))
op_objflag(3, obj, i); /* Toggle it */
} else { /* Property */
for (i = 0; i < oprop_cnt; i++)
if (have_objattr(1, obj, i))
if (n == ++k) break;
if (n == k && have_objattr(1, obj, i))
op_objprop(1, obj, i, readval("New value:", AGT_NUM));
}
}
}
static void room_edit(int i) {
int n, j;
for (;;) {
agt_clrscr();
writestr("ROOM ");
print_objid(i + first_room);
writeln("");
writeln("");
attrcol = 0;
attrwidth = 2;
writeattr("1.*WinGame:", room[i].win);
writeattr("4. Seen:", room[i].seen);
writeattr("2.*EndGame:", room[i].end);
writeattr("5. LockedDoor:", room[i].locked_door);
writeattr("3.*Die:", room[i].killplayer);
writeln("");
writeln("");
writeprop("6.*Key =", room[i].key);
writeprop("7. Light =", room[i].light);
writenum("8. Points =", room[i].points);
writeprop("9. Class = ", room[i].oclass);
writeln("");
writeln("EXITS:");
for (j = 0; j < 12; j++) {
n = writedir(j + 10, j, room[i].path[j]);
if (j % 4 == 3) writeln("");
else padout(15 - n);
}
writeprop("22. SPECIAL:", room[i].path[12]);
writeflags("23. Room Flags:", room[i].flag_noun_bits);
writeln("24. Object properties and attributes.");
writeln("");
writeln("(Fields marked with an * are not saved or restored.)");
/* writeln(""); */
writestr("Field to change (0 to exit)? ");
n = read_number();
if (n == 0) return;
switch (n) {
case 1:
room[i].win = !room[i].win;
break;
case 2:
room[i].end = !room[i].end;
break;
case 3:
room[i].killplayer = !room[i].killplayer;
break;
case 4:
room[i].seen = !room[i].seen;
break;
case 5:
room[i].locked_door = !room[i].locked_door;
break;
case 6:
room[i].key = readval("Key = ", AGT_ITEM | AGT_NONE);
break;
case 7:
room[i].light = readval("Light = ", AGT_ITEM | AGT_NONE | AGT_SELF);
break;
case 8:
room[i].points = readval("Points = ", AGT_NUM);
break;
case 9:
room[i].oclass = readval("Class = ", AGT_ROOM | AGT_NONE);
break;
case 22:
room[i].path[12] = readval("SPECIAL: ", AGT_NUM);
break;
case 23:
readflags(&room[i].flag_noun_bits);
break;
case 24:
edit_objattr(i + first_room);
break;
default:
if (n >= 10 && n < 22) { /* Direction */
room[i].path[n - 10] = readval(exitname[n - 10], AGT_NUM);
} else writeln("Invalid field");
}
}
}
#define tog(x) {x=!x;break;}
static void noun_edit(int i) {
int n;
for (;;) {
agt_clrscr();
/* writeln("");*/
writestr("NOUN ");
print_objid(i + first_noun);
/* writeln("");*/
/* writeln("");*/
writeprop(" Location=", noun[i].location);
writeln("");
attrcol = 0;
attrwidth = 3;
writeattr(" 1.*Pushable:", noun[i].pushable);
writeattr(" 8.*Lockable:", noun[i].lockable);
writeattr("15.*Drinkable:", noun[i].drinkable);
writeattr(" 2.*Pullable:", noun[i].pullable);
writeattr(" 9.*Light:", noun[i].light);
writeattr("16.*Poisonous:", noun[i].poisonous);
writeattr(" 3.*Turnable:", noun[i].turnable);
writeattr("10.*Plural:", noun[i].plural);
writeattr("17. Open:", noun[i].open);
writeattr(" 4.*Playable:", noun[i].playable);
writeattr("11. Movable:", noun[i].movable);
writeattr("18. Locked:", noun[i].locked);
writeattr(" 5.*Readable:", noun[i].readable);
writeattr("12.*Shootable:", noun[i].shootable);
writeattr("19.*Win Game:", noun[i].win);
writeattr(" 6.*Wearable:", noun[i].wearable);
writeattr("13. On:", noun[i].on);
writeattr("20.*Global:", noun[i].isglobal);
writeattr(" 7.*Closable:", noun[i].closable);
writeattr("14.*Edible:", noun[i].edible);
writeattr("21.*Proper:", noun[i].proper);
writeln("");
writenum("22. Shots =", noun[i].num_shots);
writenum("23. Points =", noun[i].points);
writenum("24. Weight =", noun[i].weight);
writenum("25. Size =", noun[i].size);
writeprop("26.*Key =", noun[i].key);
writeprop("27. Class =", noun[i].oclass);
writenum("28. Flag =", noun[i].flagnum);
writeln("");
/* writeln(""); */
writeln("29. Object properties and attributes.");
writeln("");
writeln("(Fields marked with an * are not saved or restored.)");
writestr("Field to change (0 to exit)? ");
n = read_number();
if (n == 0) return;
switch (n) {
case 1:
tog(noun[i].pushable); /* tog() macro includes break */
case 2:
tog(noun[i].pullable);
case 3:
tog(noun[i].turnable);
case 4:
tog(noun[i].playable);
case 5:
tog(noun[i].readable);
case 6:
tog(noun[i].wearable);
case 7:
tog(noun[i].closable);
case 8:
tog(noun[i].lockable);
case 9:
tog(noun[i].light);
case 10:
tog(noun[i].plural);
case 11:
tog(noun[i].movable);
case 12:
tog(noun[i].shootable);
case 13:
tog(noun[i].on);
case 14:
tog(noun[i].edible);
case 15:
tog(noun[i].drinkable);
case 16:
tog(noun[i].poisonous);
case 17:
tog(noun[i].open);
case 18:
tog(noun[i].locked);
case 19:
tog(noun[i].win);
case 20:
tog(noun[i].isglobal);
case 21:
tog(noun[i].proper);
case 22:
noun[i].num_shots = readval("Shots =", AGT_NUM);
break;
case 23:
noun[i].points = readval("Points =", AGT_NUM);
break;
case 24:
noun[i].weight = readval("Weight =", AGT_NUM);
break;
case 25:
noun[i].size = readval("Size =", AGT_NUM);
break;
case 26:
noun[i].key = readval("Key =", AGT_ITEM | AGT_NONE);
break;
case 27:
noun[i].oclass = readval("Class =", AGT_ITEM | AGT_NONE);
break;
case 28:
noun[i].flagnum = readval("Flag Number=", AGT_ROOMFLAG);
break;
case 29:
edit_objattr(i + first_noun);
break;
default:
writeln("Invalid field");
}
}
}
static void creat_edit(int i) {
int n;
for (;;) {
agt_clrscr();
writestr("CREATURE ");
print_objid(i + first_creat);
writeln("");
writeln("");
writeprop("Location =", creature[i].location);
writeln("");
attrcol = 0;
attrwidth = 2;
writeattr(" 1. Hostile:", creature[i].hostile);
writeattr(" 4. Global:", creature[i].isglobal);
writeattr(" 2. Grp member:", creature[i].groupmemb);
writeattr(" 5.*Proper:", creature[i].proper);
writegender(" 3.*Gender:", creature[i].gender);
writeln("");
writeln("");
writeprop(" 6.*Weapon = ", creature[i].weapon);
writenum(" 7. Points = ", creature[i].points);
writenum(" 8.*Attack Threshold = ", creature[i].threshold);
writenum(" 9. Attack counter = ", creature[i].counter);
writenum("10.*Attack Time Limit = ", creature[i].timethresh);
writenum("11. Attack timer = ", creature[i].timecounter);
writeprop("12. Class = ", creature[i].oclass);
writenum("13. Flag = ", creature[i].flagnum);
writeln("");
writeln("14. Object properties and attributes.");
writeln("");
writeln("(Fields marked with an * are not saved or restored.)");
writeln("");
writestr("Field to change (0 to exit)? ");
n = read_number();
if (n == 0) return;
switch (n) {
case 1:
tog(creature[i].hostile);
case 2:
tog(creature[i].groupmemb);
case 3:
tog(creature[i].isglobal);
case 4:
tog(creature[i].proper);
case 5:
creature[i].gender = readgender();
break;
case 6:
creature[i].weapon = readval("Weapon =", AGT_ITEM | AGT_NONE);
break;
case 7:
creature[i].points = readval("Points =", AGT_NUM);
break;
case 8:
creature[i].threshold = readval("Threshold =", AGT_NUM);
break;
case 9:
creature[i].counter = readval("Attack counter =", AGT_NUM);
break;
case 10:
creature[i].timethresh = readval("Time limit =", AGT_NUM);
break;
case 11:
creature[i].timecounter = readval("Timer =", AGT_NUM);
break;
case 12:
creature[i].oclass = readval("Class =", AGT_ITEM | AGT_NONE);
break;
case 13:
noun[i].flagnum = readval("Flag Number=", AGT_ROOMFLAG);
break;
case 14:
edit_objattr(i + first_creat);
break;
default:
writeln("Invalid field");
}
}
}
#undef tog
static void obj_edit() {
int n;
for (;;) {
writeln("");
do {
writestr("Enter object number (0 to exit)? ");
n = read_number();
if (n <= 0) return;
} while (!troom(n) && !tnoun(n) && !tcreat(n));
if (troom(n)) room_edit(n - first_room);
else if (tnoun(n)) noun_edit(n - first_noun);
else if (tcreat(n)) creat_edit(n - first_creat);
else writeln("[Not yet implemented]");
}
}
static const char *yesnostr[] = { "No", "Yes" };
static void set_debug_options() {
char buff[80];
int n;
for (;;) {
agt_clrscr();
writeln("DEBUGGING OPTIONS:");
writeln("");
sprintf(buff, " 1. Trace metacommands: %s", yesnostr[DEBUG_AGT_CMD]);
writeln(buff);
sprintf(buff, " 2. Trace ANY metacommands: %s", yesnostr[debug_any]);
writeln(buff);
sprintf(buff, " 3. Trace during disambiguation: %s",
yesnostr[debug_disambig]);
writeln(buff);
writeln("");
writeln("(<2> and <3> are ignored if <1> is not set; option <1> can"
" also be changed from the main debugging menu)");
writeln("");
writestr("Option to toggle (0 to exit): ");
n = read_number();
switch (n) {
case 0:
return;
case 1:
DEBUG_AGT_CMD = !DEBUG_AGT_CMD;
break;
case 2:
debug_any = !debug_any;
break;
case 3:
debug_disambig = !debug_disambig;
break;
default:
writeln("Not a valid option");
}
}
}
void get_debugcmd() {
int n;
for (;;) {
writeln("DEBUGGING COMMANDS");
writeln("");
writeln("1. Move player 8. List Rooms");
writeln("2. Get Noun 9. List Nouns");
writeln("3. Move object 10. List Creatures");
writeln("4. View/Edit object 11. List/Set Flags");
writeln("5. Toggle Trace 12. List/Set Variables");
writeln("6. Set Debug Options 13. List/Set Counters");
writeln("7. Edit User Strings");
writeln("");
writestr("Enter choice (0 to exit): ");
n = read_number();
switch (n) {
case -1:
case 0:
return;
case 1:
d_moveobj(1, -1);
break;
case 2:
d_moveobj(-1, 1);
break;
case 3:
d_moveobj(-1, -1);
break;
case 4:
obj_edit();
break;
case 5:
DEBUG_AGT_CMD = !DEBUG_AGT_CMD;
break;
case 6:
set_debug_options();
break;
case 7:
edit_str();
break;
case 8:
d_listroom();
break;
case 9:
d_listnoun();
break;
case 10:
d_listcreat();
break;
case 11:
var_edit(2);
break;
case 12:
var_edit(0);
break;
case 13:
var_edit(1);
break;
default:
writeln("Not a valid option");
}
writeln("");
};
}
} // End of namespace AGT
} // End of namespace Glk
|