1 /* these are c routines to handle the pdp dungeon i/o */
2 #include <stdio.h>
3
4 /* send arguments to message printing process */
rspsb3_(arg1,arg2,arg3)5 rspsb3_(arg1,arg2,arg3)
6
7 int *arg1,*arg2,*arg3;
8 {
9 printf("n%d %d %d\n",*arg1,*arg2,*arg3);
10 fflush(stdout);
11 return;
12 }
13
14 /* print for puzzle room */
puzout_(p)15 puzout_(p)
16
17 char *p;
18 {
19
20 printf(" |%c%c %c%c %c%c|\n",p[0],p[0],p[1],p[1],p[2],p[2]);
21 printf(" WEST |%c%c .. %c%c| EAST\n",p[3],p[3],p[4],p[4]);
22 printf(" |%c%c %c%c %c%c|\n",p[5],p[5],p[6],p[6],p[7],p[7]);
23 fflush(stdout);
24 return;
25 }
26
27 /* output general string (echo room) */
outstr_(ptr,len)28 outstr_(ptr,len)
29
30 int *len;
31 char *ptr[];
32 {
33 printf("%.*s\n",*len,ptr);
34 fflush(stdout);
35 return;
36 }
37
38
39 /* print a prompt */
prompt_()40 prompt_()
41 {
42 printf(" > ~");
43 fflush(stdout);
44 return;
45 }
46
47 /* terminate the game */
exit_()48 exit_()
49 {
50 fprintf(stderr,"The game is over\n");
51 exit(0);
52 }
53
54 /* read a character */
rdchr_(cptr)55 rdchr_(cptr)
56
57 char *cptr;
58 {
59 static int ch;
60
61 if((ch = getchar()) == EOF){
62 fprintf(stderr,"EOF on input\n");
63 exit_();
64 }
65 else *cptr = ch;
66 return;
67 }
68
69 /* read a line from std input */
rdlin_(sptr,cntptr)70 rdlin_(sptr,cntptr)
71
72 int *cntptr;
73 char *sptr;
74 {
75 static int chr;
76 *cntptr = 0;
77 while ((chr = getchar()) != EOF){
78 if((chr >= 97) && (chr <= 122)) /* convert to uc */
79 chr -= 32;
80 if (chr == 10 ){ /* quit if newline */
81 *sptr++ = '\0';
82 return;
83 }
84 if ((chr == 32) && (*cntptr == 0)) /* rm lead blank */
85 continue;
86 if (*cntptr >= 78)
87 continue;
88 *sptr++ = chr;
89 (*cntptr)++;
90 }
91 fprintf(stderr,"EOF on input\n");
92 exit_();
93 }
94
95 /* print cure time */
cured_(time)96 cured_(time)
97
98 int *time;
99 {
100 printf(" You will be cured in %d moves\n",*time);
101 fflush(stdout);
102 return;
103 }
104
105 /* print the score */
pscore_(score,max,moves)106 pscore_(score,max,moves)
107
108 int *score, *max, *moves;
109 {
110 printf(" Your current score is %d out of %d points in %d moves.\n",*score, *max, *moves);
111 fflush(stdout);
112 return;
113 }
114
115 /* BUG-- REPORT FATAL SYSTEM ERROR
116 C
117 C CALLED BY--
118 C
119 C CALL BUG(NO,PAR)
120 C
121 C note: return if DBGFLG set is not implemented
122 C*/
bug_(a,b)123 bug_(a,b)
124
125 int *a,*b;
126 {
127 fprintf(stderr,"Program error %d ; Parameter %d\n",*a,*b);
128 exit(0);
129 }
130
131
132 /* send restore message */
restor_()133 restor_()
134 {
135 printf(" Restore by starting with 'dungeon r'\n");
136 return;
137 }
138
139 /* password output */
voice_(sp1,sp2)140 voice_(sp1, sp2)
141
142 char *sp1, *sp2;
143 {
144 printf(" A Hollow voice replies: %6.6s %6.6s\n", sp1, sp2);
145 return;
146 }
147
148 /* print version */
prvers_(v1,v2,v3)149 prvers_(v1, v2, v3)
150
151 int *v1, *v2;
152 char *v3;
153 {
154 printf(" V%1d.%2d%c\n", *v1, *v2, *v3);
155 return;
156 }
157
158 /* dummy stub for game debugger */
nogdt_()159 nogdt_()
160 {
161 /* debugger deleted to save room */
162 printf(" Sorry, no debugger available in this version.\n");
163 return;
164 }
165