]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - battlestar/com1.c
1 /* $NetBSD: com1.c,v 1.3 1995/03/21 15:06:51 cgd Exp $ */
4 * Copyright (c) 1983, 1993
5 * The Regents of the University of California. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by the University of
18 * California, Berkeley and its contributors.
19 * 4. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 static char sccsid
[] = "@(#)com1.c 8.1 (Berkeley) 5/31/93";
40 static char rcsid
[] = "$NetBSD: com1.c,v 1.3 1995/03/21 15:06:51 cgd Exp $";
50 if ((!notes
[CANTMOVE
] && !notes
[LAUNCHED
]) || testbit(location
[position
].objects
, LAND
) || fuel
> 0 && notes
[LAUNCHED
])
57 puts("You can't go this way.");
59 whichway(location
[position
]);
62 else if (notes
[CANTMOVE
] && !notes
[LAUNCHED
])
63 puts("You aren't able to move; you better drop something.");
65 puts("You are out of fuel; now you will rot in space forever!");
69 convert(tothis
) /* Converts day to night and vice versa. */
70 int tothis
; /* Day objects are permanent. Night objects are added*/
71 { /* at dusk, and subtracted at dawn. */
72 register struct objs
*p
;
75 if (tothis
== TONIGHT
) {
76 for (i
= 1; i
<= NUMOFROOMS
; i
++)
77 for (j
= 0; j
< NUMOFWORDS
; j
++)
78 nightfile
[i
].objects
[j
] = dayfile
[i
].objects
[j
];
79 for (p
= nightobjs
; p
->room
!= 0; p
++)
80 setbit(nightfile
[p
->room
].objects
, p
->obj
);
83 for (i
= 1; i
<= NUMOFROOMS
; i
++)
84 for (j
= 0; j
< NUMOFWORDS
; j
++)
85 dayfile
[i
].objects
[j
] = nightfile
[i
].objects
[j
];
86 for (p
= nightobjs
; p
->room
!= 0; p
++)
87 clearbit(dayfile
[p
->room
].objects
, p
->obj
);
97 if (time
> 30 && position
< 32){
98 puts("An explosion of shuddering magnitude splinters bulkheads and");
99 puts("ruptures the battlestar's hull. You are sucked out into the");
100 puts("frozen void of space and killed.");
103 if (time
> 20 && position
< 32)
104 puts("Explosions rock the battlestar.");
106 puts("You drop from exhaustion...");
109 if (time
> snooze
- 5)
110 puts("You're getting tired.");
111 if (time
> (rythmn
+ CYCLE
)) {
112 if (location
== nightfile
) {
114 if (OUTSIDE
&& time
- rythmn
- CYCLE
< 10) {
115 puts("Dew lit sunbeams stretch out from a watery sunrise and herald the dawn.");
116 puts("You awake from a misty dream-world into stark reality.");
121 clearbit(location
[POOLS
].objects
, BATHGOD
);
122 if (OUTSIDE
&& time
- rythmn
- CYCLE
< 10) {
123 puts("The dying sun sinks into the ocean, leaving a blood stained sunset.");
124 puts("The sky slowly fades from orange to violet to black. A few stars");
125 puts("flicker on, and it is night.");
126 puts("The world seems completly different at night.");
129 rythmn
= time
- time
% CYCLE
;
131 if (!wiz
&& !tempwiz
)
132 if ((testbit(inven
,TALISMAN
) || testbit(wear
,TALISMAN
)) && (testbit(inven
,MEDALION
) || testbit(wear
,MEDALION
)) && (testbit(inven
,AMULET
) || testbit(wear
,AMULET
))){
134 puts("The three amulets glow and reenforce each other in power.\nYou are now a wizard.");
136 if (testbit(location
[position
].objects
,ELF
)){
137 printf("%s\n",objdes
[ELF
]);
140 if (testbit(location
[position
].objects
,DARK
)){
141 printf("%s\n",objdes
[DARK
]);
144 if (testbit(location
[position
].objects
,WOODSMAN
)){
145 printf("%s\n",objdes
[WOODSMAN
]);
151 case 257: /* entering a cave */
157 case 216: /* leaving a cave */
164 if (testbit(location
[position
].objects
, GIRL
))
166 if (meetgirl
&& CYCLE
* 1.5 - time
< 10){
167 setbit(location
[GARDEN
].objects
,GIRLTALK
);
168 setbit(location
[GARDEN
].objects
,LAMPON
);
169 setbit(location
[GARDEN
].objects
,ROPE
);
171 if (position
== DOCK
&& (beenthere
[position
] || time
> CYCLE
)){
172 clearbit(location
[DOCK
].objects
, GIRL
);
173 clearbit(location
[DOCK
].objects
,MAN
);
175 if (meetgirl
&& time
- CYCLE
* 1.5 > 10){
176 clearbit(location
[GARDEN
].objects
,GIRLTALK
);
177 clearbit(location
[GARDEN
].objects
,LAMPON
);
178 clearbit(location
[GARDEN
].objects
,ROPE
);
181 if (testbit(location
[position
].objects
,CYLON
)){
182 puts("Oh my God, you're being shot at by an alien spacecraft!");
183 printf("The targeting computer says we have %d seconds to attack!\n",clock
);
187 hurt
= rnd(NUMOFINJURIES
);
189 puts("Laser blasts sear the cockpit, and the alien veers off in a victory roll.");
190 puts("The viper shudders under a terrible explosion.");
191 printf("I'm afraid you have suffered %s.\n", ouch
[hurt
]);
194 clearbit(location
[position
].objects
,CYLON
);
196 if (injuries
[SKULL
] && injuries
[INCISE
] && injuries
[NECK
]){
197 puts("I'm afraid you have suffered fatal injuries.");
200 for (n
=0; n
< NUMOFINJURIES
; n
++)
201 if (injuries
[n
] == 1){
208 if (injuries
[ARM
] == 2){
212 if (injuries
[RIBS
] == 2){
216 if (injuries
[SPINE
] == 2){
220 if (carrying
> WEIGHT
|| encumber
> CUMBER
)
231 if (!location
[position
].flyhere
|| (testbit(location
[position
].objects
,LAND
) && fuel
<= 0)){
232 if (!location
[position
].flyhere
)
233 puts("You're flying too low. We're going to crash!");
235 puts("You're out of fuel. We'll have to crash land!");
236 if (!location
[position
].down
){
237 puts("Your viper strikes the ground and explodes into firey fragments.");
238 puts("Thick black smoke billows up from the wreckage.");
241 position
= location
[position
].down
;
244 setbit(location
[position
].objects
,CRASH
);
245 time
+= rnd(CYCLE
/4);
246 puts("The viper explodes into the ground and you lose consciousness...");
248 hurt1
= rnd(NUMOFINJURIES
- 2) + 2;
249 hurt2
= rnd(NUMOFINJURIES
- 2) + 2;
252 injuries
[0] = 1; /* abrasions */
253 injuries
[1] = 1; /* lacerations */
254 printf("I'm afraid you have suffered %s and %s.\n",ouch
[hurt1
],ouch
[hurt2
]);