]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - warp/us.c
1 /* Header: us.c,v 7.0.1.3 87/01/13 17:13:21 lwall Exp */
4 * Revision 7.0.1.3 87/01/13 17:13:21 lwall
5 * Partially fixed ^S behavior. It now just ignores ^S.
7 * Revision 7.0.1.2 86/12/12 17:06:09 lwall
8 * Baseline for net release.
10 * Revision 7.0.1.1 86/10/16 10:53:50 lwall
11 * Added Damage. Fixed random bugs.
13 * Revision 7.0 86/10/08 15:14:21 lwall
14 * Split into separate files. Added amoebas and pirates.
48 ch
= (ent
->energy
>= 500?'E':'e');
49 if (ch
!= ent
->image
) {
53 decr
= 5+abs(evely
)+abs(evelx
)+tractor
*tractor
;
54 if (ent
->energy
>= decr
) {
57 if (!damage
|| !damflag
[NOTRACTORS
]) {
60 damflag
[NOTRACTORS
] = rand_mod(smarts
+10)+2;
62 if (tract(ent
,dy
,dx
,tractor
)) {
69 (!entmode
&& !damflag
[NOIMPULSE
]) ||
70 (entmode
&& !damflag
[NOWARP
]) ) {
71 if (!rand_mod(30+500/(abs(evely
)+abs(evelx
)+1))) {
73 damflag
[entmode
?NOWARP
:NOIMPULSE
] = rand_mod(smarts
+10)+2;
79 (obj
=occupant
[(ent
->posy
+evely
+YSIZE00
)%YSIZE
]
80 [(ent
->posx
+evelx
+XSIZE00
)%XSIZE
] ) &&
85 else if (status
== 2) {
86 decr
= 500+abs(bvely
)*5+abs(bvelx
)*5+tractor
*tractor
*100;
87 if (base
->energy
>= decr
) {
90 if (tract(base
,dy
,dx
,tractor
)) {
100 (obj
=occupant
[(base
->posy
+bvely
+YSIZE00
)%YSIZE
]
101 [(base
->posx
+bvelx
+XSIZE00
)%XSIZE
] ) &&
110 ctrl_direction(dy
,dx
)
118 ch
= (ent
->energy
>= 500?'E':'e');
119 if (ch
!= ent
->image
) {
123 if (!damage
|| !damflag
[NOPHASERS
]) {
124 if (!rand_mod(200)) {
126 damflag
[NOPHASERS
] = rand_mod(smarts
+10)+2;
128 fire_phaser(ent
, dy
, dx
);
131 else if (status
== 2)
132 fire_phaser(base
, dy
, dx
);
136 shift_direction(dy
,dx
)
144 ch
= (ent
->energy
>= 500?'E':'e');
145 if (ch
!= ent
->image
) {
149 if (!damage
|| !damflag
[NOTORPS
]) {
150 if (!rand_mod(300)) {
152 damflag
[NOTORPS
] = rand_mod(smarts
+10)+2;
154 fire_torp(ent
, dy
, dx
);
157 else if (status
== 2)
158 fire_torp(base
, dy
, dx
);
168 Reg3
bool ctrla
= FALSE
;
169 char numdestructs
= 0, numzaps
= 0;
172 while (count
= read_nd(ch
,(sizeof ch
))) {
173 for (i
=0; i
<count
; i
++) {
180 if (ch
[i
] == 'q' || ch
[i
] == BREAKCH
|| ch
[i
] == INTRCH
) {
182 static char quest
[] = "Do you wish to escape from reality? ";
184 if (timer
>= whenok
) {
185 mvaddstr(12,22,quest
);
188 } while (ch
[i
] != 'y' && ch
[i
] != 'n');
195 for (x
=11; x
<=28; x
++) {
198 ? occupant
[11][x
]->image
215 for (i
=0; i
<count
; i
++) {
219 ctrl_direction(1, -1);
222 ctrl_direction(1, 0);
225 ctrl_direction(1, 1);
228 ctrl_direction(0, -1);
231 ctrl_direction(0, 1);
234 ctrl_direction(-1, -1);
237 ctrl_direction(-1, 0);
240 ctrl_direction(-1, 1);
249 while (!input_pending())
276 if (ent
&& (!damage
|| !damflag
[NOIMPULSE
])) {
282 if (ent
&& (!damage
|| !damflag
[NOWARP
])) {
297 else if (status
== 2) {
312 if (ent
->energy
>= 250)
317 if (ent
&& (!damage
|| !damflag
[NOZAPPER
])) {
319 if (!rand_mod(100/numzaps
)) {
321 damflag
[NOZAPPER
] = rand_mod(smarts
+10)+2;
323 if (nxtbang
&& bangm
[nxtbang
-1] < 0)
324 --nxtbang
; /* consolidate zaps */
325 make_blast(evely
*2+ent
->posy
,evelx
*2+ent
->posx
,
326 -5000000L, 3*numzaps
);
331 if (status
< 2 && (!damage
|| !damflag
[NODESTRUCT
])) {
332 if (ent
&& !rand_mod(10)) {
334 damflag
[NODESTRUCT
] = rand_mod(smarts
+10)+2;
336 if (++numdestructs
<= 2)
337 make_blast(evely
*2+ent
->posy
,evelx
*2+ent
->posx
,
341 else if (status
== 2) {
343 base
->energy
= base
->energy
/ 2;
344 if (++numdestructs
<= 2)
345 make_blast(base
->posy
, base
->posx
, 15000L, 5);
349 if ((!damage
|| !damflag
[NODESTRUCT
]) && (base
||ent
)) {
353 if (ent
&& !rand_mod(200)) {
355 damflag
[NODESTRUCT
] = rand_mod(smarts
+10)+2;
357 for (obj
= root
.prev
;
360 if (obj
->image
== '+') {
361 blast
[y
=(obj
->posy
+obj
->vely
+YSIZE00
)%YSIZE
]
362 [x
=(obj
->posx
+obj
->velx
+XSIZE00
)%XSIZE
]
367 obj
->mass
= (massacre
?3000:4000);
373 if ((!damage
|| !damflag
[NODESTRUCT
]) && (base
||ent
)) {
375 if (ent
&& !rand_mod(200)) {
377 damflag
[NODESTRUCT
] = rand_mod(smarts
+10)+2;
379 for (obj
= root
.prev
;
380 obj
->type
== Torp
|| obj
->type
== Web
||
383 if (obj
->image
== '+')
384 obj
->vely
= obj
->velx
= 0;
460 if (status
< 2 && ent
->energy
>= 10) {
466 case '%': case '\177': case '_':
467 shift_direction(0, -1);
468 shift_direction(0, 1);
469 shift_direction(-1, 0);
470 shift_direction(1, 0);
471 shift_direction(-1, -1);
472 shift_direction(-1, 1);
473 shift_direction(1, -1);
474 shift_direction(1, 1);
477 shift_direction(1, -1);
480 shift_direction(1, 0);
483 shift_direction(1, 1);
486 shift_direction(0, -1);
489 shift_direction(0, 1);
492 shift_direction(-1, -1);
495 shift_direction(-1, 0);
498 shift_direction(-1, 1);