186d7f5d3SJohn Marino /*-
286d7f5d3SJohn Marino * Copyright (c) 1983-2003, Regents of the University of California.
386d7f5d3SJohn Marino * All rights reserved.
486d7f5d3SJohn Marino *
586d7f5d3SJohn Marino * Redistribution and use in source and binary forms, with or without
686d7f5d3SJohn Marino * modification, are permitted provided that the following conditions are
786d7f5d3SJohn Marino * met:
886d7f5d3SJohn Marino *
986d7f5d3SJohn Marino * 1. Redistributions of source code must retain the above copyright
1086d7f5d3SJohn Marino * notice, this list of conditions and the following disclaimer.
1186d7f5d3SJohn Marino * 2. Redistributions in binary form must reproduce the above copyright
1286d7f5d3SJohn Marino * notice, this list of conditions and the following disclaimer in the
1386d7f5d3SJohn Marino * documentation and/or other materials provided with the distribution.
1486d7f5d3SJohn Marino * 3. Neither the name of the University of California, San Francisco nor
1586d7f5d3SJohn Marino * the names of its contributors may be used to endorse or promote
1686d7f5d3SJohn Marino * products derived from this software without specific prior written
1786d7f5d3SJohn Marino * permission.
1886d7f5d3SJohn Marino *
1986d7f5d3SJohn Marino * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
2086d7f5d3SJohn Marino * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2186d7f5d3SJohn Marino * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
2286d7f5d3SJohn Marino * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2386d7f5d3SJohn Marino * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2486d7f5d3SJohn Marino * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2586d7f5d3SJohn Marino * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2686d7f5d3SJohn Marino * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2786d7f5d3SJohn Marino * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2886d7f5d3SJohn Marino * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2986d7f5d3SJohn Marino * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3086d7f5d3SJohn Marino *
3186d7f5d3SJohn Marino * $OpenBSD: draw.c,v 1.7 2003/06/11 08:45:33 pjanzen Exp $
3286d7f5d3SJohn Marino * $NetBSD: draw.c,v 1.2 1997/10/10 16:33:04 lukem Exp $
3386d7f5d3SJohn Marino * $DragonFly: src/games/hunt/huntd/draw.c,v 1.2 2008/09/04 16:12:51 swildner Exp $
3486d7f5d3SJohn Marino */
3586d7f5d3SJohn Marino
3686d7f5d3SJohn Marino #include <string.h>
3786d7f5d3SJohn Marino
3886d7f5d3SJohn Marino #include "hunt.h"
3986d7f5d3SJohn Marino #include "server.h"
4086d7f5d3SJohn Marino #include "conf.h"
4186d7f5d3SJohn Marino
4286d7f5d3SJohn Marino static char translate(char);
4386d7f5d3SJohn Marino static int player_sym(PLAYER *, int, int);
4486d7f5d3SJohn Marino static void drawstatus(PLAYER *);
4586d7f5d3SJohn Marino static void see(PLAYER *, int);
4686d7f5d3SJohn Marino
4786d7f5d3SJohn Marino /*
4886d7f5d3SJohn Marino * drawmaze:
4986d7f5d3SJohn Marino * Draw the entire maze on a player's screen.
5086d7f5d3SJohn Marino */
5186d7f5d3SJohn Marino void
drawmaze(PLAYER * pp)5286d7f5d3SJohn Marino drawmaze(PLAYER *pp)
5386d7f5d3SJohn Marino {
5486d7f5d3SJohn Marino int x;
5586d7f5d3SJohn Marino char *sp;
5686d7f5d3SJohn Marino int y;
5786d7f5d3SJohn Marino char *endp;
5886d7f5d3SJohn Marino
5986d7f5d3SJohn Marino /* Clear the client's screen: */
6086d7f5d3SJohn Marino clrscr(pp);
6186d7f5d3SJohn Marino /* Draw the top row of the maze: */
6286d7f5d3SJohn Marino outstr(pp, pp->p_maze[0], WIDTH);
6386d7f5d3SJohn Marino for (y = 1; y < HEIGHT - 1; y++) {
6486d7f5d3SJohn Marino endp = &pp->p_maze[y][WIDTH];
6586d7f5d3SJohn Marino for (x = 0, sp = pp->p_maze[y]; sp < endp; x++, sp++)
6686d7f5d3SJohn Marino if (*sp != SPACE) {
6786d7f5d3SJohn Marino cgoto(pp, y, x);
6886d7f5d3SJohn Marino /* Draw the player as themselves */
6986d7f5d3SJohn Marino if (pp->p_x == x && pp->p_y == y)
7086d7f5d3SJohn Marino outch(pp, translate(*sp));
7186d7f5d3SJohn Marino /* Possibly draw other players as team nrs */
7286d7f5d3SJohn Marino else if (is_player(*sp))
7386d7f5d3SJohn Marino outch(pp, player_sym(pp, y, x));
7486d7f5d3SJohn Marino else
7586d7f5d3SJohn Marino outch(pp, *sp);
7686d7f5d3SJohn Marino }
7786d7f5d3SJohn Marino }
7886d7f5d3SJohn Marino /* Draw the last row of the maze: */
7986d7f5d3SJohn Marino cgoto(pp, HEIGHT - 1, 0);
8086d7f5d3SJohn Marino outstr(pp, pp->p_maze[HEIGHT - 1], WIDTH);
8186d7f5d3SJohn Marino drawstatus(pp);
8286d7f5d3SJohn Marino }
8386d7f5d3SJohn Marino
8486d7f5d3SJohn Marino /*
8586d7f5d3SJohn Marino * drawstatus - put up the status lines (this assumes the screen
8686d7f5d3SJohn Marino * size is 80x24 with the maze being 64x24)
8786d7f5d3SJohn Marino */
8886d7f5d3SJohn Marino static void
drawstatus(PLAYER * pp)8986d7f5d3SJohn Marino drawstatus(PLAYER *pp)
9086d7f5d3SJohn Marino {
9186d7f5d3SJohn Marino int i;
9286d7f5d3SJohn Marino PLAYER *np;
9386d7f5d3SJohn Marino
9486d7f5d3SJohn Marino outyx(pp, STAT_AMMO_ROW, STAT_LABEL_COL, "Ammo:");
9586d7f5d3SJohn Marino ammo_update(pp);
9686d7f5d3SJohn Marino
9786d7f5d3SJohn Marino outyx(pp, STAT_GUN_ROW, STAT_LABEL_COL, "Gun:");
9886d7f5d3SJohn Marino outyx(pp, STAT_GUN_ROW, STAT_VALUE_COL, "%3s",
9986d7f5d3SJohn Marino (pp->p_ncshot < conf_maxncshot) ? "ok" : "");
10086d7f5d3SJohn Marino
10186d7f5d3SJohn Marino outyx(pp, STAT_DAM_ROW, STAT_LABEL_COL, "Damage:");
10286d7f5d3SJohn Marino outyx(pp, STAT_DAM_ROW, STAT_VALUE_COL, "%2d/%2d",
10386d7f5d3SJohn Marino pp->p_damage, pp->p_damcap);
10486d7f5d3SJohn Marino
10586d7f5d3SJohn Marino outyx(pp, STAT_KILL_ROW, STAT_LABEL_COL, "Kills:");
10686d7f5d3SJohn Marino outyx(pp, STAT_KILL_ROW, STAT_VALUE_COL, "%3d",
10786d7f5d3SJohn Marino (pp->p_damcap - conf_maxdam) / 2);
10886d7f5d3SJohn Marino
10986d7f5d3SJohn Marino outyx(pp, STAT_PLAY_ROW, STAT_LABEL_COL, "Player:");
11086d7f5d3SJohn Marino for (i = STAT_PLAY_ROW + 1, np = Player; np < End_player; np++, i++) {
11186d7f5d3SJohn Marino outyx(pp, i, STAT_NAME_COL, "%5.2f%c%-10.10s %c",
11286d7f5d3SJohn Marino np->p_ident->i_score, stat_char(np),
11386d7f5d3SJohn Marino np->p_ident->i_name, np->p_ident->i_team);
11486d7f5d3SJohn Marino }
11586d7f5d3SJohn Marino
11686d7f5d3SJohn Marino outyx(pp, STAT_MON_ROW, STAT_LABEL_COL, "Monitor:");
11786d7f5d3SJohn Marino for (i = STAT_MON_ROW + 1, np = Monitor; np < End_monitor; np++, i++) {
11886d7f5d3SJohn Marino outyx(pp, i++, STAT_NAME_COL, "%5.5s %-10.10s %c",
11986d7f5d3SJohn Marino " ", np->p_ident->i_name, np->p_ident->i_team);
12086d7f5d3SJohn Marino }
12186d7f5d3SJohn Marino }
12286d7f5d3SJohn Marino
12386d7f5d3SJohn Marino /*
12486d7f5d3SJohn Marino * look
12586d7f5d3SJohn Marino * check and update the visible area around the player
12686d7f5d3SJohn Marino */
12786d7f5d3SJohn Marino void
look(PLAYER * pp)12886d7f5d3SJohn Marino look(PLAYER *pp)
12986d7f5d3SJohn Marino {
13086d7f5d3SJohn Marino int x, y;
13186d7f5d3SJohn Marino
13286d7f5d3SJohn Marino x = pp->p_x;
13386d7f5d3SJohn Marino y = pp->p_y;
13486d7f5d3SJohn Marino
13586d7f5d3SJohn Marino /*
13686d7f5d3SJohn Marino * The player is aware of all objects immediately adjacent to
13786d7f5d3SJohn Marino * their position:
13886d7f5d3SJohn Marino */
13986d7f5d3SJohn Marino check(pp, y - 1, x - 1);
14086d7f5d3SJohn Marino check(pp, y - 1, x );
14186d7f5d3SJohn Marino check(pp, y - 1, x + 1);
14286d7f5d3SJohn Marino check(pp, y , x - 1);
14386d7f5d3SJohn Marino check(pp, y , x );
14486d7f5d3SJohn Marino check(pp, y , x + 1);
14586d7f5d3SJohn Marino check(pp, y + 1, x - 1);
14686d7f5d3SJohn Marino check(pp, y + 1, x );
14786d7f5d3SJohn Marino check(pp, y + 1, x + 1);
14886d7f5d3SJohn Marino
14986d7f5d3SJohn Marino switch (pp->p_face) {
15086d7f5d3SJohn Marino /* The player can see down corridors in directions except behind: */
15186d7f5d3SJohn Marino case LEFTS:
15286d7f5d3SJohn Marino see(pp, LEFTS);
15386d7f5d3SJohn Marino see(pp, ABOVE);
15486d7f5d3SJohn Marino see(pp, BELOW);
15586d7f5d3SJohn Marino break;
15686d7f5d3SJohn Marino case RIGHT:
15786d7f5d3SJohn Marino see(pp, RIGHT);
15886d7f5d3SJohn Marino see(pp, ABOVE);
15986d7f5d3SJohn Marino see(pp, BELOW);
16086d7f5d3SJohn Marino break;
16186d7f5d3SJohn Marino case ABOVE:
16286d7f5d3SJohn Marino see(pp, ABOVE);
16386d7f5d3SJohn Marino see(pp, LEFTS);
16486d7f5d3SJohn Marino see(pp, RIGHT);
16586d7f5d3SJohn Marino break;
16686d7f5d3SJohn Marino case BELOW:
16786d7f5d3SJohn Marino see(pp, BELOW);
16886d7f5d3SJohn Marino see(pp, LEFTS);
16986d7f5d3SJohn Marino see(pp, RIGHT);
17086d7f5d3SJohn Marino break;
17186d7f5d3SJohn Marino /* But they don't see too far when they are flying about: */
17286d7f5d3SJohn Marino case FLYER:
17386d7f5d3SJohn Marino break;
17486d7f5d3SJohn Marino }
17586d7f5d3SJohn Marino
17686d7f5d3SJohn Marino /* Move the cursor back over the player: */
17786d7f5d3SJohn Marino cgoto(pp, y, x);
17886d7f5d3SJohn Marino }
17986d7f5d3SJohn Marino
18086d7f5d3SJohn Marino /*
18186d7f5d3SJohn Marino * see
18286d7f5d3SJohn Marino * Look down a corridor, or towards an open space. This
18386d7f5d3SJohn Marino * is a simulation of visibility from the player's perspective.
18486d7f5d3SJohn Marino */
18586d7f5d3SJohn Marino static void
see(PLAYER * pp,int face)18686d7f5d3SJohn Marino see(PLAYER *pp, int face)
18786d7f5d3SJohn Marino {
18886d7f5d3SJohn Marino char *sp;
18986d7f5d3SJohn Marino int y, x;
19086d7f5d3SJohn Marino
19186d7f5d3SJohn Marino /* Start from the player's position: */
19286d7f5d3SJohn Marino x = pp->p_x;
19386d7f5d3SJohn Marino y = pp->p_y;
19486d7f5d3SJohn Marino
19586d7f5d3SJohn Marino #define seewalk(dx, dy) \
19686d7f5d3SJohn Marino x += (dx); \
19786d7f5d3SJohn Marino y += (dy); \
19886d7f5d3SJohn Marino sp = &Maze[y][x]; \
19986d7f5d3SJohn Marino while (See_over[(int)*sp]) { \
20086d7f5d3SJohn Marino x += (dx); \
20186d7f5d3SJohn Marino y += (dy); \
20286d7f5d3SJohn Marino sp += ((dx) + (dy) * sizeof Maze[0]); \
20386d7f5d3SJohn Marino check(pp, y + dx, x + dy); \
20486d7f5d3SJohn Marino check(pp, y, x); \
20586d7f5d3SJohn Marino check(pp, y - dx, x - dy); \
20686d7f5d3SJohn Marino }
20786d7f5d3SJohn Marino
20886d7f5d3SJohn Marino switch (face) {
20986d7f5d3SJohn Marino case LEFTS:
21086d7f5d3SJohn Marino seewalk(-1, 0); break;
21186d7f5d3SJohn Marino case RIGHT:
21286d7f5d3SJohn Marino seewalk(1, 0); break;
21386d7f5d3SJohn Marino case ABOVE:
21486d7f5d3SJohn Marino seewalk(0, -1); break;
21586d7f5d3SJohn Marino case BELOW:
21686d7f5d3SJohn Marino seewalk(0, 1); break;
21786d7f5d3SJohn Marino }
21886d7f5d3SJohn Marino }
21986d7f5d3SJohn Marino
22086d7f5d3SJohn Marino /*
22186d7f5d3SJohn Marino * check
22286d7f5d3SJohn Marino * The player is aware of a cell in the maze.
22386d7f5d3SJohn Marino * Ensure it is shown properly on their screen.
22486d7f5d3SJohn Marino */
22586d7f5d3SJohn Marino void
check(PLAYER * pp,int y,int x)22686d7f5d3SJohn Marino check(PLAYER *pp, int y, int x)
22786d7f5d3SJohn Marino {
22886d7f5d3SJohn Marino int i;
22986d7f5d3SJohn Marino int ch;
23086d7f5d3SJohn Marino PLAYER *rpp;
23186d7f5d3SJohn Marino
23286d7f5d3SJohn Marino if (pp == ALL_PLAYERS) {
23386d7f5d3SJohn Marino for (pp = Player; pp < End_player; pp++)
23486d7f5d3SJohn Marino check(pp, y, x);
23586d7f5d3SJohn Marino for (pp = Monitor; pp < End_monitor; pp++)
23686d7f5d3SJohn Marino check(pp, y, x);
23786d7f5d3SJohn Marino return;
23886d7f5d3SJohn Marino }
23986d7f5d3SJohn Marino
24086d7f5d3SJohn Marino i = y * sizeof Maze[0] + x;
24186d7f5d3SJohn Marino ch = ((char *) Maze)[i];
24286d7f5d3SJohn Marino if (ch != ((char *) pp->p_maze)[i]) {
24386d7f5d3SJohn Marino rpp = pp;
24486d7f5d3SJohn Marino cgoto(rpp, y, x);
24586d7f5d3SJohn Marino if (x == rpp->p_x && y == rpp->p_y)
24686d7f5d3SJohn Marino outch(rpp, translate(ch));
24786d7f5d3SJohn Marino else if (is_player(ch))
24886d7f5d3SJohn Marino outch(rpp, player_sym(rpp, y, x));
24986d7f5d3SJohn Marino else
25086d7f5d3SJohn Marino outch(rpp, ch);
25186d7f5d3SJohn Marino ((char *) rpp->p_maze)[i] = ch;
25286d7f5d3SJohn Marino }
25386d7f5d3SJohn Marino }
25486d7f5d3SJohn Marino
25586d7f5d3SJohn Marino /*
25686d7f5d3SJohn Marino * showstat
25786d7f5d3SJohn Marino * Update the status of a player on everyone's screen
25886d7f5d3SJohn Marino */
25986d7f5d3SJohn Marino void
showstat(PLAYER * pp)26086d7f5d3SJohn Marino showstat(PLAYER *pp)
26186d7f5d3SJohn Marino {
26286d7f5d3SJohn Marino
26386d7f5d3SJohn Marino outyx(ALL_PLAYERS,
26486d7f5d3SJohn Marino STAT_PLAY_ROW + 1 + (pp - Player), STAT_SCAN_COL,
26586d7f5d3SJohn Marino "%c", stat_char(pp));
26686d7f5d3SJohn Marino }
26786d7f5d3SJohn Marino
26886d7f5d3SJohn Marino /*
26986d7f5d3SJohn Marino * drawplayer:
27086d7f5d3SJohn Marino * Draw the player on the screen and show him to everyone who's scanning
27186d7f5d3SJohn Marino * unless he is cloaked.
27286d7f5d3SJohn Marino * The 'draw' flag when false, causes the 'saved under' character to
27386d7f5d3SJohn Marino * be drawn instead of the player; effectively un-drawing the player.
27486d7f5d3SJohn Marino */
27586d7f5d3SJohn Marino void
drawplayer(PLAYER * pp,FLAG draw)27686d7f5d3SJohn Marino drawplayer(PLAYER *pp, FLAG draw)
27786d7f5d3SJohn Marino {
27886d7f5d3SJohn Marino PLAYER *newp;
27986d7f5d3SJohn Marino int x, y;
28086d7f5d3SJohn Marino
28186d7f5d3SJohn Marino x = pp->p_x;
28286d7f5d3SJohn Marino y = pp->p_y;
28386d7f5d3SJohn Marino
28486d7f5d3SJohn Marino /* Draw or un-draw the player into the master map: */
28586d7f5d3SJohn Marino Maze[y][x] = draw ? pp->p_face : pp->p_over;
28686d7f5d3SJohn Marino
28786d7f5d3SJohn Marino /* The monitors can always see this player: */
28886d7f5d3SJohn Marino for (newp = Monitor; newp < End_monitor; newp++)
28986d7f5d3SJohn Marino check(newp, y, x);
29086d7f5d3SJohn Marino
29186d7f5d3SJohn Marino /* Check if other players can see this player: */
29286d7f5d3SJohn Marino for (newp = Player; newp < End_player; newp++) {
29386d7f5d3SJohn Marino if (!draw) {
29486d7f5d3SJohn Marino /* When un-drawing, show everyone what was under */
29586d7f5d3SJohn Marino check(newp, y, x);
29686d7f5d3SJohn Marino continue;
29786d7f5d3SJohn Marino }
29886d7f5d3SJohn Marino if (newp == pp) {
29986d7f5d3SJohn Marino /* The player can always see themselves: */
30086d7f5d3SJohn Marino check(newp, y, x);
30186d7f5d3SJohn Marino continue;
30286d7f5d3SJohn Marino }
30386d7f5d3SJohn Marino /* Check if the other player just run out of scans */
30486d7f5d3SJohn Marino if (newp->p_scan == 0) {
30586d7f5d3SJohn Marino /* The other player is no longer scanning: */
30686d7f5d3SJohn Marino newp->p_scan--;
30786d7f5d3SJohn Marino showstat(newp);
30886d7f5d3SJohn Marino /* Check if the other play is scannning */
30986d7f5d3SJohn Marino } else if (newp->p_scan > 0) {
31086d7f5d3SJohn Marino /* If this player's not cloacked, draw him: */
31186d7f5d3SJohn Marino if (pp->p_cloak < 0)
31286d7f5d3SJohn Marino check(newp, y, x);
31386d7f5d3SJohn Marino /* And this uses up a scan. */
31486d7f5d3SJohn Marino newp->p_scan--;
31586d7f5d3SJohn Marino }
31686d7f5d3SJohn Marino }
31786d7f5d3SJohn Marino
31886d7f5d3SJohn Marino /* Use up one point of cloak time when drawing: */
31986d7f5d3SJohn Marino if (draw && pp->p_cloak >= 0) {
32086d7f5d3SJohn Marino pp->p_cloak--;
32186d7f5d3SJohn Marino /* Check if we ran out of cloak: */
32286d7f5d3SJohn Marino if (pp->p_cloak < 0)
32386d7f5d3SJohn Marino showstat(pp);
32486d7f5d3SJohn Marino }
32586d7f5d3SJohn Marino }
32686d7f5d3SJohn Marino
32786d7f5d3SJohn Marino /*
32886d7f5d3SJohn Marino * message:
32986d7f5d3SJohn Marino * Write a message at the bottom of the screen.
33086d7f5d3SJohn Marino */
33186d7f5d3SJohn Marino void
message(PLAYER * pp,const char * s)33286d7f5d3SJohn Marino message(PLAYER *pp, const char *s)
33386d7f5d3SJohn Marino {
33486d7f5d3SJohn Marino cgoto(pp, HEIGHT, 0);
33586d7f5d3SJohn Marino outstr(pp, s, strlen(s));
33686d7f5d3SJohn Marino ce(pp);
33786d7f5d3SJohn Marino }
33886d7f5d3SJohn Marino
33986d7f5d3SJohn Marino /*
34086d7f5d3SJohn Marino * translate:
34186d7f5d3SJohn Marino * Turn a player character into a more personal player character.
34286d7f5d3SJohn Marino * ie: {,},!,i becomes <,>,v,^
34386d7f5d3SJohn Marino */
34486d7f5d3SJohn Marino static char
translate(char ch)34586d7f5d3SJohn Marino translate(char ch)
34686d7f5d3SJohn Marino {
34786d7f5d3SJohn Marino switch (ch) {
34886d7f5d3SJohn Marino case LEFTS:
34986d7f5d3SJohn Marino return '<';
35086d7f5d3SJohn Marino case RIGHT:
35186d7f5d3SJohn Marino return '>';
35286d7f5d3SJohn Marino case ABOVE:
35386d7f5d3SJohn Marino return '^';
35486d7f5d3SJohn Marino case BELOW:
35586d7f5d3SJohn Marino return 'v';
35686d7f5d3SJohn Marino }
35786d7f5d3SJohn Marino return ch;
35886d7f5d3SJohn Marino }
35986d7f5d3SJohn Marino
36086d7f5d3SJohn Marino /*
36186d7f5d3SJohn Marino * player_sym:
36286d7f5d3SJohn Marino * Return the symbol for the player at (y,x) when viewed by player 'pp'.
36386d7f5d3SJohn Marino * ie: - unteamed players appear as {,},!,i
36486d7f5d3SJohn Marino * - unteamed monitors see all players as team digits
36586d7f5d3SJohn Marino * - teamed players see other players on their team, as a digit
36686d7f5d3SJohn Marino */
36786d7f5d3SJohn Marino static int
player_sym(PLAYER * pp,int y,int x)36886d7f5d3SJohn Marino player_sym(PLAYER *pp, int y, int x)
36986d7f5d3SJohn Marino {
37086d7f5d3SJohn Marino PLAYER *npp;
37186d7f5d3SJohn Marino
37286d7f5d3SJohn Marino npp = play_at(y, x);
37386d7f5d3SJohn Marino if (npp->p_ident->i_team == ' ')
37486d7f5d3SJohn Marino return Maze[y][x];
37586d7f5d3SJohn Marino if (pp->p_ident->i_team == '*')
37686d7f5d3SJohn Marino return npp->p_ident->i_team;
37786d7f5d3SJohn Marino if (pp->p_ident->i_team != npp->p_ident->i_team)
37886d7f5d3SJohn Marino return Maze[y][x];
37986d7f5d3SJohn Marino return pp->p_ident->i_team;
38086d7f5d3SJohn Marino }
381