* Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
* San Francisco, California
* Copyright (c) 1985 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
# define CTRL(x) ('x' & 037)
* Execute a single monitor command
ch
= pp
->p_cbuf
[pp
->p_ncount
++];
(void) strcpy(pp
->p_death
, "| Quit |");
* Execute a single command
ch
= pp
->p_cbuf
[pp
->p_ncount
++];
(void) strcpy(pp
->p_death
, "| Quit |");
fire_slime(pp
, SLIMEREQ
);
fire_slime(pp
, SSLIMEREQ
);
(void) strcpy(pp
->p_death
, "| Quit |");
* Execute a move in the given direction
pickup(pp
, y
, x
, 5, Maze
[y
][x
]);
else if (opposite(dir
, pp
->p_face
))
pickup(pp
, y
, x
, 95, Maze
[y
][x
]);
pickup(pp
, y
, x
, 50, Maze
[y
][x
]);
checkdam(newp
, pp
, pp
->p_ident
, STABDAM
, KNIFE
);
if (--pp
->p_ncshot
== MAXNCSHOT
) {
cgoto(pp
, STAT_GUN_ROW
, STAT_VALUE_COL
);
fixshots(pp
->p_y
, pp
->p_x
, pp
->p_over
);
* Change the direction the player is facing
* Fire a shot of the given type in the given direction
static int req
[4] = { BULREQ
, GRENREQ
, SATREQ
, BOMBREQ
};
static int shot_type
[4] = { SHOT
, GRENADE
, SATCHEL
, BOMB
};
message(pp
, "No more charges.");
if (pp
->p_ncshot
> MAXNCSHOT
)
if (pp
->p_ncshot
++ == MAXNCSHOT
) {
cgoto(pp
, STAT_GUN_ROW
, STAT_VALUE_COL
);
message(pp
, "What you do!!!");
while (pp
->p_ammo
< req
[req_index
])
pp
->p_ammo
-= req
[req_index
];
(void) sprintf(Buf
, "%3d", pp
->p_ammo
);
cgoto(pp
, STAT_AMMO_ROW
, STAT_VALUE_COL
);
add_shot(shot_type
[req_index
], pp
->p_y
, pp
->p_x
, pp
->p_face
,
req
[req_index
], pp
, FALSE
, pp
->p_face
);
* Show the object to everyone
showexpl(pp
->p_y
, pp
->p_x
, shot_type
[req_index
]);
for (pp
= Player
; pp
< End_player
; pp
++)
for (pp
= Monitor
; pp
< End_monitor
; pp
++)
* Fire a slime shot in the given direction
message(pp
, "Not enough charges.");
if (pp
->p_ncshot
> MAXNCSHOT
)
if (pp
->p_ncshot
++ == MAXNCSHOT
) {
cgoto(pp
, STAT_GUN_ROW
, STAT_VALUE_COL
);
(void) sprintf(Buf
, "%3d", pp
->p_ammo
);
cgoto(pp
, STAT_AMMO_ROW
, STAT_VALUE_COL
);
add_shot(SLIME
, pp
->p_y
, pp
->p_x
, pp
->p_face
, req
, pp
, FALSE
,
* Show the object to everyone
showexpl(pp
->p_y
, pp
->p_x
, SLIME
);
for (pp
= Player
; pp
< End_player
; pp
++)
for (pp
= Monitor
; pp
< End_monitor
; pp
++)
* Create a shot with the given properties
add_shot(type
, y
, x
, face
, charge
, owner
, expl
, over
)
* if there are no bullets in flight, set up the alarm
bp
= create_shot(type
, y
, x
, face
, charge
, owner
,
(owner
== NULL
) ? NULL
: owner
->p_ident
, expl
, over
);
create_shot(type
, y
, x
, face
, charge
, owner
, score
, expl
, over
)
bp
= (BULLET
*) malloc(sizeof (BULLET
)); /* NOSTRICT */
message(owner
, "Out of memory");
* Turn on or increase length of a cloak
message(pp
, "No more charges");
(void) sprintf(Buf
, "%3d", --pp
->p_ammo
);
cgoto(pp
, STAT_AMMO_ROW
, STAT_VALUE_COL
);
cgoto(pp
, STAT_CLOAK_ROW
, STAT_VALUE_COL
);
cgoto(pp
, STAT_SCAN_ROW
, STAT_VALUE_COL
);
* Turn on or increase length of a scan
message(pp
, "No more charges");
(void) sprintf(Buf
, "%3d", --pp
->p_ammo
);
cgoto(pp
, STAT_AMMO_ROW
, STAT_VALUE_COL
);
cgoto(pp
, STAT_SCAN_ROW
, STAT_VALUE_COL
);
cgoto(pp
, STAT_CLOAK_ROW
, STAT_VALUE_COL
);
* check whether the object blew up or whether he picked it up
pickup(pp
, y
, x
, prob
, obj
)
if (rand_num(100) < prob
)
add_shot(obj
, y
, x
, LEFTS
, req
, (PLAYER
*) NULL
,
(void) sprintf(Buf
, "%3d", pp
->p_ammo
);
cgoto(pp
, STAT_AMMO_ROW
, STAT_VALUE_COL
);