NetBSD/games/hack/hack.pri.c

759 lines
14 KiB
C
Raw Normal View History

/* $NetBSD: hack.pri.c,v 1.6 2001/03/25 20:44:02 jsm Exp $ */
1997-10-19 20:56:41 +04:00
/*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
*/
1997-10-19 20:56:41 +04:00
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: hack.pri.c,v 1.6 2001/03/25 20:44:02 jsm Exp $");
1997-10-19 20:56:41 +04:00
#endif /* not lint */
1993-03-21 12:45:37 +03:00
#include "hack.h"
1997-10-19 20:56:41 +04:00
#include "extern.h"
xchar scrlx, scrhx, scrly, scrhy; /* corners of new area on
* screen */
1993-03-21 12:45:37 +03:00
1997-10-19 20:56:41 +04:00
void
1993-03-21 12:45:37 +03:00
swallowed()
{
1997-10-19 20:56:41 +04:00
char ulook[] = "|@|";
1993-03-21 12:45:37 +03:00
ulook[1] = u.usym;
cls();
1997-10-19 20:56:41 +04:00
curs(u.ux - 1, u.uy + 1);
1993-03-21 12:45:37 +03:00
fputs("/-\\", stdout);
1997-10-19 20:56:41 +04:00
curx = u.ux + 2;
curs(u.ux - 1, u.uy + 2);
1993-03-21 12:45:37 +03:00
fputs(ulook, stdout);
1997-10-19 20:56:41 +04:00
curx = u.ux + 2;
curs(u.ux - 1, u.uy + 3);
1993-03-21 12:45:37 +03:00
fputs("\\-/", stdout);
1997-10-19 20:56:41 +04:00
curx = u.ux + 2;
1993-03-21 12:45:37 +03:00
u.udispl = 1;
u.udisx = u.ux;
u.udisy = u.uy;
}
1997-10-19 20:56:41 +04:00
/* VARARGS1 */
boolean panicking;
1993-03-21 12:45:37 +03:00
1997-10-19 20:56:41 +04:00
void
#ifdef __STDC__
panic(const char *fmt, ...)
#else
panic(va_alist)
va_dcl
#endif
1993-03-21 12:45:37 +03:00
{
1997-10-19 20:56:41 +04:00
va_list ap;
#ifndef __STDC__
const char *fmt;
va_start(ap);
fmt = va_arg(ap, const char *);
#else
va_start(ap, fmt);
#endif
if (panicking++)
exit(1); /* avoid loops - this should never happen */
1993-03-21 12:45:37 +03:00
home();
puts(" Suddenly, the dungeon collapses.");
fputs(" ERROR: ", stdout);
1997-10-19 20:56:41 +04:00
vprintf(fmt, ap);
va_end(ap);
1993-03-21 12:45:37 +03:00
#ifdef DEBUG
#ifdef UNIX
1997-10-19 20:56:41 +04:00
if (!fork())
1993-03-21 12:45:37 +03:00
abort(); /* generate core dump */
1997-10-19 20:56:41 +04:00
#endif /* UNIX */
#endif /* DEBUG */
1993-03-21 12:45:37 +03:00
more(); /* contains a fflush() */
done("panicked");
}
1997-10-19 20:56:41 +04:00
void
atl(x, y, ch)
int x, y, ch;
1993-03-21 12:45:37 +03:00
{
1997-10-19 20:56:41 +04:00
struct rm *crm = &levl[x][y];
1993-03-21 12:45:37 +03:00
1997-10-19 20:56:41 +04:00
if (x < 0 || x > COLNO - 1 || y < 0 || y > ROWNO - 1) {
impossible("atl(%d,%d,%c)", x, y, ch);
1993-03-21 12:45:37 +03:00
return;
}
1997-10-19 20:56:41 +04:00
if (crm->seen && crm->scrsym == ch)
return;
1993-03-21 12:45:37 +03:00
crm->scrsym = ch;
crm->new = 1;
1997-10-19 20:56:41 +04:00
on_scr(x, y);
1993-03-21 12:45:37 +03:00
}
1997-10-19 20:56:41 +04:00
void
on_scr(x, y)
int x, y;
1993-03-21 12:45:37 +03:00
{
1997-10-19 20:56:41 +04:00
if (x < scrlx)
scrlx = x;
if (x > scrhx)
scrhx = x;
if (y < scrly)
scrly = y;
if (y > scrhy)
scrhy = y;
1993-03-21 12:45:37 +03:00
}
1997-10-19 20:56:41 +04:00
/*
* call: (x,y) - display (-1,0) - close (leave last symbol) (-1,-1)- close
* (undo last symbol) (-1,let)-open: initialize symbol (-2,let)-change let
*/
1993-03-21 12:45:37 +03:00
1997-10-19 20:56:41 +04:00
void
tmp_at(x, y)
schar x, y;
{
static schar prevx, prevy;
static char let;
if ((int) x == -2) { /* change let call */
1993-03-21 12:45:37 +03:00
let = y;
return;
}
1997-10-19 20:56:41 +04:00
if ((int) x == -1 && (int) y >= 0) { /* open or close call */
1993-03-21 12:45:37 +03:00
let = y;
prevx = -1;
return;
}
1997-10-19 20:56:41 +04:00
if (prevx >= 0 && cansee(prevx, prevy)) {
1993-03-21 12:45:37 +03:00
delay_output();
prl(prevx, prevy); /* in case there was a monster */
at(prevx, prevy, levl[prevx][prevy].scrsym);
}
1997-10-19 20:56:41 +04:00
if (x >= 0) { /* normal call */
if (cansee(x, y))
at(x, y, let);
1993-03-21 12:45:37 +03:00
prevx = x;
prevy = y;
1997-10-19 20:56:41 +04:00
} else { /* close call */
1993-03-21 12:45:37 +03:00
let = 0;
prevx = -1;
}
}
/* like the previous, but the symbols are first erased on completion */
1997-10-19 20:56:41 +04:00
void
Tmp_at(x, y)
schar x, y;
{
static char let;
static xchar cnt;
static coord tc[COLNO]; /* but watch reflecting beams! */
int xx, yy;
if ((int) x == -1) {
if (y > 0) { /* open call */
1993-03-21 12:45:37 +03:00
let = y;
cnt = 0;
return;
}
/* close call (do not distinguish y==0 and y==-1) */
1997-10-19 20:56:41 +04:00
while (cnt--) {
1993-03-21 12:45:37 +03:00
xx = tc[cnt].x;
yy = tc[cnt].y;
prl(xx, yy);
at(xx, yy, levl[xx][yy].scrsym);
}
cnt = let = 0; /* superfluous */
return;
}
1997-10-19 20:56:41 +04:00
if ((int) x == -2) { /* change let call */
1993-03-21 12:45:37 +03:00
let = y;
return;
}
/* normal call */
1997-10-19 20:56:41 +04:00
if (cansee(x, y)) {
if (cnt)
delay_output();
at(x, y, let);
1993-03-21 12:45:37 +03:00
tc[cnt].x = x;
tc[cnt].y = y;
1997-10-19 20:56:41 +04:00
if (++cnt >= COLNO)
panic("Tmp_at overflow?");
1993-03-21 12:45:37 +03:00
levl[x][y].new = 0; /* prevent pline-nscr erasing --- */
}
}
1997-10-19 20:56:41 +04:00
void
setclipped()
{
1993-03-21 12:45:37 +03:00
error("Hack needs a screen of size at least %d by %d.\n",
1997-10-19 20:56:41 +04:00
ROWNO + 2, COLNO);
1993-03-21 12:45:37 +03:00
}
1997-10-19 20:56:41 +04:00
void
at(x, y, ch)
xchar x, y;
char ch;
1993-03-21 12:45:37 +03:00
{
#ifndef lint
/* if xchar is unsigned, lint will complain about if(x < 0) */
1997-10-19 20:56:41 +04:00
if (x < 0 || x > COLNO - 1 || y < 0 || y > ROWNO - 1) {
1993-03-21 12:45:37 +03:00
impossible("At gets 0%o at %d %d.", ch, x, y);
return;
}
1997-10-19 20:56:41 +04:00
#endif /* lint */
if (!ch) {
1993-03-21 12:45:37 +03:00
impossible("At gets null at %d %d.", x, y);
return;
}
y += 2;
1997-10-19 20:56:41 +04:00
curs(x, y);
1993-03-21 12:45:37 +03:00
(void) putchar(ch);
curx++;
}
1997-10-19 20:56:41 +04:00
void
prme()
{
if (!Invisible)
at(u.ux, u.uy, u.usym);
1993-03-21 12:45:37 +03:00
}
1997-10-19 20:56:41 +04:00
int
1993-03-21 12:45:37 +03:00
doredraw()
{
docrt();
1997-10-19 20:56:41 +04:00
return (0);
1993-03-21 12:45:37 +03:00
}
1997-10-19 20:56:41 +04:00
void
1993-03-21 12:45:37 +03:00
docrt()
{
1997-10-19 20:56:41 +04:00
int x, y;
struct rm *room;
struct monst *mtmp;
1993-03-21 12:45:37 +03:00
1997-10-19 20:56:41 +04:00
if (u.uswallow) {
1993-03-21 12:45:37 +03:00
swallowed();
return;
}
cls();
1997-10-19 20:56:41 +04:00
/*
* Some ridiculous code to get display of @ and monsters (almost)
* right
*/
if (!Invisible) {
1993-03-21 12:45:37 +03:00
levl[(u.udisx = u.ux)][(u.udisy = u.uy)].scrsym = u.usym;
levl[u.udisx][u.udisy].seen = 1;
u.udispl = 1;
1997-10-19 20:56:41 +04:00
} else
u.udispl = 0;
1993-03-21 12:45:37 +03:00
1997-10-19 20:56:41 +04:00
seemons(); /* reset old positions */
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
1993-03-21 12:45:37 +03:00
mtmp->mdispl = 0;
1997-10-19 20:56:41 +04:00
seemons(); /* force new positions to be shown */
/*
* This nonsense should disappear soon
* ---------------------------------
*/
for (y = 0; y < ROWNO; y++)
for (x = 0; x < COLNO; x++)
if ((room = &levl[x][y])->new) {
1993-03-21 12:45:37 +03:00
room->new = 0;
1997-10-19 20:56:41 +04:00
at(x, y, room->scrsym);
} else if (room->seen)
at(x, y, room->scrsym);
1993-03-21 12:45:37 +03:00
scrlx = COLNO;
scrly = ROWNO;
scrhx = scrhy = 0;
flags.botlx = 1;
bot();
}
1997-10-19 20:56:41 +04:00
void
docorner(xmin, ymax)
int xmin, ymax;
{
int x, y;
struct rm *room;
struct monst *mtmp;
1993-03-21 12:45:37 +03:00
1997-10-19 20:56:41 +04:00
if (u.uswallow) { /* Can be done more efficiently */
1993-03-21 12:45:37 +03:00
swallowed();
return;
}
1997-10-19 20:56:41 +04:00
seemons(); /* reset old positions */
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
if (mtmp->mx >= xmin && mtmp->my < ymax)
mtmp->mdispl = 0;
seemons(); /* force new positions to be shown */
1993-03-21 12:45:37 +03:00
1997-10-19 20:56:41 +04:00
for (y = 0; y < ymax; y++) {
if (y > ROWNO && CD)
break;
curs(xmin, y + 2);
1993-03-21 12:45:37 +03:00
cl_end();
1997-10-19 20:56:41 +04:00
if (y < ROWNO) {
for (x = xmin; x < COLNO; x++) {
if ((room = &levl[x][y])->new) {
room->new = 0;
at(x, y, room->scrsym);
} else if (room->seen)
at(x, y, room->scrsym);
}
1993-03-21 12:45:37 +03:00
}
}
1997-10-19 20:56:41 +04:00
if (ymax > ROWNO) {
cornbot(xmin - 1);
if (ymax > ROWNO + 1 && CD) {
curs(1, ROWNO + 3);
1993-03-21 12:45:37 +03:00
cl_eos();
}
}
}
1997-10-19 20:56:41 +04:00
void
curs_on_u()
{
curs(u.ux, u.uy + 2);
1993-03-21 12:45:37 +03:00
}
1997-10-19 20:56:41 +04:00
void
1993-03-21 12:45:37 +03:00
pru()
{
1997-10-19 20:56:41 +04:00
if (u.udispl && (Invisible || u.udisx != u.ux || u.udisy != u.uy))
1993-03-21 12:45:37 +03:00
/* if(! levl[u.udisx][u.udisy].new) */
1997-10-19 20:56:41 +04:00
if (!vism_at(u.udisx, u.udisy))
newsym(u.udisx, u.udisy);
if (Invisible) {
1993-03-21 12:45:37 +03:00
u.udispl = 0;
1997-10-19 20:56:41 +04:00
prl(u.ux, u.uy);
} else if (!u.udispl || u.udisx != u.ux || u.udisy != u.uy) {
1993-03-21 12:45:37 +03:00
atl(u.ux, u.uy, u.usym);
u.udispl = 1;
u.udisx = u.ux;
u.udisy = u.uy;
}
levl[u.ux][u.uy].seen = 1;
}
#ifndef NOWORM
#include "def.wseg.h"
1997-10-19 20:56:41 +04:00
#endif /* NOWORM */
1993-03-21 12:45:37 +03:00
/* print a position that is visible for @ */
1997-10-19 20:56:41 +04:00
void
prl(int x, int y)
1993-03-21 12:45:37 +03:00
{
1997-10-19 20:56:41 +04:00
struct rm *room;
struct monst *mtmp;
struct obj *otmp;
1993-03-21 12:45:37 +03:00
1997-10-19 20:56:41 +04:00
if (x == u.ux && y == u.uy && (!Invisible)) {
1993-03-21 12:45:37 +03:00
pru();
return;
}
1997-10-19 20:56:41 +04:00
if (!isok(x, y))
return;
1993-03-21 12:45:37 +03:00
room = &levl[x][y];
1997-10-19 20:56:41 +04:00
if ((!room->typ) ||
(IS_ROCK(room->typ) && levl[u.ux][u.uy].typ == CORR))
1993-03-21 12:45:37 +03:00
return;
1997-10-19 20:56:41 +04:00
if ((mtmp = m_at(x, y)) && !mtmp->mhide &&
(!mtmp->minvis || See_invisible)) {
1993-03-21 12:45:37 +03:00
#ifndef NOWORM
1997-10-19 20:56:41 +04:00
if (m_atseg)
1993-03-21 12:45:37 +03:00
pwseg(m_atseg);
else
1997-10-19 20:56:41 +04:00
#endif /* NOWORM */
pmon(mtmp);
} else if ((otmp = o_at(x, y)) && room->typ != POOL)
atl(x, y, otmp->olet);
else if (mtmp && (!mtmp->minvis || See_invisible)) {
1993-03-21 12:45:37 +03:00
/* must be a hiding monster, but not hiding right now */
/* assume for the moment that long worms do not hide */
pmon(mtmp);
1997-10-19 20:56:41 +04:00
} else if (g_at(x, y) && room->typ != POOL)
atl(x, y, '$');
else if (!room->seen || room->scrsym == ' ') {
1993-03-21 12:45:37 +03:00
room->new = room->seen = 1;
1997-10-19 20:56:41 +04:00
newsym(x, y);
on_scr(x, y);
1993-03-21 12:45:37 +03:00
}
room->seen = 1;
}
char
1997-10-19 20:56:41 +04:00
news0(x, y)
xchar x, y;
1993-03-21 12:45:37 +03:00
{
1997-10-19 20:56:41 +04:00
struct obj *otmp;
struct trap *ttmp;
struct rm *room;
char tmp;
1993-03-21 12:45:37 +03:00
room = &levl[x][y];
1997-10-19 20:56:41 +04:00
if (!room->seen)
tmp = ' ';
else if (room->typ == POOL)
1993-03-21 12:45:37 +03:00
tmp = POOL_SYM;
1997-10-19 20:56:41 +04:00
else if (!Blind && (otmp = o_at(x, y)))
tmp = otmp->olet;
else if (!Blind && g_at(x, y))
tmp = '$';
else if (x == xupstair && y == yupstair)
tmp = '<';
else if (x == xdnstair && y == ydnstair)
tmp = '>';
else if ((ttmp = t_at(x, y)) && ttmp->tseen)
tmp = '^';
else
switch (room->typ) {
case SCORR:
case SDOOR:
tmp = room->scrsym; /* %% wrong after killing
* mimic ! */
break;
case HWALL:
tmp = '-';
break;
case VWALL:
tmp = '|';
break;
case LDOOR:
case DOOR:
tmp = '+';
break;
case CORR:
tmp = CORR_SYM;
break;
case ROOM:
if (room->lit || cansee(x, y) || Blind)
tmp = '.';
else
tmp = ' ';
break;
/*
case POOL:
tmp = POOL_SYM;
break;
*/
default:
tmp = ERRCHAR;
}
return (tmp);
1993-03-21 12:45:37 +03:00
}
1997-10-19 20:56:41 +04:00
void
newsym(x, y)
int x, y;
1993-03-21 12:45:37 +03:00
{
1997-10-19 20:56:41 +04:00
atl(x, y, news0(x, y));
1993-03-21 12:45:37 +03:00
}
/* used with wand of digging (or pick-axe): fill scrsym and force display */
/* also when a POOL evaporates */
1997-10-19 20:56:41 +04:00
void
mnewsym(x, y)
int x, y;
1993-03-21 12:45:37 +03:00
{
1997-10-19 20:56:41 +04:00
struct rm *room;
char newscrsym;
1993-03-21 12:45:37 +03:00
1997-10-19 20:56:41 +04:00
if (!vism_at(x, y)) {
1993-03-21 12:45:37 +03:00
room = &levl[x][y];
1997-10-19 20:56:41 +04:00
newscrsym = news0(x, y);
if (room->scrsym != newscrsym) {
1993-03-21 12:45:37 +03:00
room->scrsym = newscrsym;
room->seen = 0;
}
}
}
1997-10-19 20:56:41 +04:00
void
nosee(x, y)
int x, y;
1993-03-21 12:45:37 +03:00
{
1997-10-19 20:56:41 +04:00
struct rm *room;
1993-03-21 12:45:37 +03:00
1997-10-19 20:56:41 +04:00
if (!isok(x, y))
return;
1993-03-21 12:45:37 +03:00
room = &levl[x][y];
1997-10-19 20:56:41 +04:00
if (room->scrsym == '.' && !room->lit && !Blind) {
1993-03-21 12:45:37 +03:00
room->scrsym = ' ';
room->new = 1;
1997-10-19 20:56:41 +04:00
on_scr(x, y);
1993-03-21 12:45:37 +03:00
}
}
#ifndef QUEST
1997-10-19 20:56:41 +04:00
void
prl1(x, y)
int x, y;
{
if (u.dx) {
if (u.dy) {
prl(x - (2 * u.dx), y);
prl(x - u.dx, y);
prl(x, y);
prl(x, y - u.dy);
prl(x, y - (2 * u.dy));
1993-03-21 12:45:37 +03:00
} else {
1997-10-19 20:56:41 +04:00
prl(x, y - 1);
prl(x, y);
prl(x, y + 1);
1993-03-21 12:45:37 +03:00
}
} else {
1997-10-19 20:56:41 +04:00
prl(x - 1, y);
prl(x, y);
prl(x + 1, y);
1993-03-21 12:45:37 +03:00
}
}
1997-10-19 20:56:41 +04:00
void
nose1(x, y)
int x, y;
1993-03-21 12:45:37 +03:00
{
1997-10-19 20:56:41 +04:00
if (u.dx) {
if (u.dy) {
nosee(x, u.uy);
nosee(x, u.uy - u.dy);
nosee(x, y);
nosee(u.ux - u.dx, y);
nosee(u.ux, y);
1993-03-21 12:45:37 +03:00
} else {
1997-10-19 20:56:41 +04:00
nosee(x, y - 1);
nosee(x, y);
nosee(x, y + 1);
1993-03-21 12:45:37 +03:00
}
} else {
1997-10-19 20:56:41 +04:00
nosee(x - 1, y);
nosee(x, y);
nosee(x + 1, y);
1993-03-21 12:45:37 +03:00
}
}
1997-10-19 20:56:41 +04:00
#endif /* QUEST */
1993-03-21 12:45:37 +03:00
1997-10-19 20:56:41 +04:00
int
vism_at(x, y)
int x, y;
1993-03-21 12:45:37 +03:00
{
1997-10-19 20:56:41 +04:00
struct monst *mtmp;
1993-03-21 12:45:37 +03:00
1997-10-19 20:56:41 +04:00
return ((x == u.ux && y == u.uy && !Invisible)
? 1 :
(mtmp = m_at(x, y))
? ((Blind && Telepat) || canseemon(mtmp)) :
1993-03-21 12:45:37 +03:00
0);
}
#ifdef NEWSCR
1997-10-19 20:56:41 +04:00
void
pobj(obj)
struct obj *obj;
{
int show = (!obj->oinvis || See_invisible) &&
cansee(obj->ox, obj->oy);
if (obj->odispl) {
if (obj->odx != obj->ox || obj->ody != obj->oy || !show)
if (!vism_at(obj->odx, obj->ody)) {
newsym(obj->odx, obj->ody);
obj->odispl = 0;
}
1993-03-21 12:45:37 +03:00
}
1997-10-19 20:56:41 +04:00
if (show && !vism_at(obj->ox, obj->oy)) {
atl(obj->ox, obj->oy, obj->olet);
1993-03-21 12:45:37 +03:00
obj->odispl = 1;
obj->odx = obj->ox;
obj->ody = obj->oy;
}
}
1997-10-19 20:56:41 +04:00
#endif /* NEWSCR */
1993-03-21 12:45:37 +03:00
1997-10-19 20:56:41 +04:00
void
unpobj(obj)
struct obj *obj;
{
/*
* if(obj->odispl){ if(!vism_at(obj->odx, obj->ody)) newsym(obj->odx,
* obj->ody); obj->odispl = 0; }
*/
if (!vism_at(obj->ox, obj->oy))
newsym(obj->ox, obj->oy);
1993-03-21 12:45:37 +03:00
}
1997-10-19 20:56:41 +04:00
void
seeobjs()
{
struct obj *obj, *obj2;
for (obj = fobj; obj; obj = obj2) {
1993-03-21 12:45:37 +03:00
obj2 = obj->nobj;
1997-10-19 20:56:41 +04:00
if (obj->olet == FOOD_SYM && obj->otyp >= CORPSE
&& obj->age + 250 < moves)
delobj(obj);
1993-03-21 12:45:37 +03:00
}
1997-10-19 20:56:41 +04:00
for (obj = invent; obj; obj = obj2) {
1993-03-21 12:45:37 +03:00
obj2 = obj->nobj;
1997-10-19 20:56:41 +04:00
if (obj->olet == FOOD_SYM && obj->otyp >= CORPSE
&& obj->age + 250 < moves)
useup(obj);
1993-03-21 12:45:37 +03:00
}
}
1997-10-19 20:56:41 +04:00
void
seemons()
{
struct monst *mtmp;
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (mtmp->data->mlet == ';')
1993-03-21 12:45:37 +03:00
mtmp->minvis = (u.ustuck != mtmp &&
1997-10-19 20:56:41 +04:00
levl[mtmp->mx][mtmp->my].typ == POOL);
1993-03-21 12:45:37 +03:00
pmon(mtmp);
#ifndef NOWORM
1997-10-19 20:56:41 +04:00
if (mtmp->wormno)
wormsee(mtmp->wormno);
#endif /* NOWORM */
1993-03-21 12:45:37 +03:00
}
}
1997-10-19 20:56:41 +04:00
void
pmon(mon)
struct monst *mon;
{
int show = (Blind && Telepat) || canseemon(mon);
if (mon->mdispl) {
if (mon->mdx != mon->mx || mon->mdy != mon->my || !show)
1993-03-21 12:45:37 +03:00
unpmon(mon);
}
1997-10-19 20:56:41 +04:00
if (show && !mon->mdispl) {
atl(mon->mx, mon->my,
(!mon->mappearance
|| u.uprops[PROP(RIN_PROTECTION_FROM_SHAPE_CHANGERS)].p_flgs
) ? mon->data->mlet : mon->mappearance);
1993-03-21 12:45:37 +03:00
mon->mdispl = 1;
mon->mdx = mon->mx;
mon->mdy = mon->my;
}
}
1997-10-19 20:56:41 +04:00
void
unpmon(mon)
struct monst *mon;
{
if (mon->mdispl) {
1993-03-21 12:45:37 +03:00
newsym(mon->mdx, mon->mdy);
mon->mdispl = 0;
}
}
1997-10-19 20:56:41 +04:00
void
1993-03-21 12:45:37 +03:00
nscr()
{
1997-10-19 20:56:41 +04:00
int x, y;
struct rm *room;
1993-03-21 12:45:37 +03:00
1997-10-19 20:56:41 +04:00
if (u.uswallow || u.ux == FAR || flags.nscrinh)
return;
1993-03-21 12:45:37 +03:00
pru();
1997-10-19 20:56:41 +04:00
for (y = scrly; y <= scrhy; y++)
for (x = scrlx; x <= scrhx; x++)
if ((room = &levl[x][y])->new) {
1993-03-21 12:45:37 +03:00
room->new = 0;
1997-10-19 20:56:41 +04:00
at(x, y, room->scrsym);
1993-03-21 12:45:37 +03:00
}
scrhx = scrhy = 0;
scrlx = COLNO;
scrly = ROWNO;
}
/* 100 suffices for bot(); no relation with COLNO */
1997-10-19 20:56:41 +04:00
char oldbot[100], newbot[100];
void
1993-03-21 12:45:37 +03:00
cornbot(lth)
1997-10-19 20:56:41 +04:00
int lth;
1993-03-21 12:45:37 +03:00
{
1997-10-19 20:56:41 +04:00
if (lth < sizeof(oldbot)) {
1993-03-21 12:45:37 +03:00
oldbot[lth] = 0;
flags.botl = 1;
}
}
1997-10-19 20:56:41 +04:00
void
1993-03-21 12:45:37 +03:00
bot()
{
1997-10-19 20:56:41 +04:00
char *ob = oldbot, *nb = newbot;
int i;
if (flags.botlx)
*ob = 0;
1993-03-21 12:45:37 +03:00
flags.botl = flags.botlx = 0;
#ifdef GOLD_ON_BOTL
(void) sprintf(newbot,
1997-10-19 20:56:41 +04:00
"Level %-2d Gold %-5lu Hp %3d(%d) Ac %-2d Str ",
dlevel, u.ugold, u.uhp, u.uhpmax, u.uac);
1993-03-21 12:45:37 +03:00
#else
(void) sprintf(newbot,
1997-10-19 20:56:41 +04:00
"Level %-2d Hp %3d(%d) Ac %-2d Str ",
dlevel, u.uhp, u.uhpmax, u.uac);
#endif /* GOLD_ON_BOTL */
if (u.ustr > 18) {
if (u.ustr > 117)
(void) strcat(newbot, "18/**");
else
(void) sprintf(eos(newbot), "18/%02d", u.ustr - 18);
1993-03-21 12:45:37 +03:00
} else
1997-10-19 20:56:41 +04:00
(void) sprintf(eos(newbot), "%-2d ", u.ustr);
1993-03-21 12:45:37 +03:00
#ifdef EXP_ON_BOTL
1997-10-19 20:56:41 +04:00
(void) sprintf(eos(newbot), " Exp %2d/%-5lu ", u.ulevel, u.uexp);
1993-03-21 12:45:37 +03:00
#else
(void) sprintf(eos(newbot), " Exp %2u ", u.ulevel);
1997-10-19 20:56:41 +04:00
#endif /* EXP_ON_BOTL */
1993-03-21 12:45:37 +03:00
(void) strcat(newbot, hu_stat[u.uhs]);
1997-10-19 20:56:41 +04:00
if (flags.time)
(void) sprintf(eos(newbot), " %ld", moves);
if (strlen(newbot) >= COLNO) {
char *bp0, *bp1;
1993-03-21 12:45:37 +03:00
bp0 = bp1 = newbot;
do {
1997-10-19 20:56:41 +04:00
if (*bp0 != ' ' || bp0[1] != ' ' || bp0[2] != ' ')
1993-03-21 12:45:37 +03:00
*bp1++ = *bp0;
1997-10-19 20:56:41 +04:00
} while (*bp0++);
1993-03-21 12:45:37 +03:00
}
1997-10-19 20:56:41 +04:00
for (i = 1; i < COLNO; i++) {
if (*ob != *nb) {
curs(i, ROWNO + 2);
1993-03-21 12:45:37 +03:00
(void) putchar(*nb ? *nb : ' ');
curx++;
}
1997-10-19 20:56:41 +04:00
if (*ob)
ob++;
if (*nb)
nb++;
1993-03-21 12:45:37 +03:00
}
(void) strcpy(oldbot, newbot);
}
#ifdef WAN_PROBING
1997-10-19 20:56:41 +04:00
void
mstatusline(mtmp)
struct monst *mtmp;
{
1993-03-21 12:45:37 +03:00
pline("Status of %s: ", monnam(mtmp));
pline("Level %-2d Gold %-5lu Hp %3d(%d) Ac %-2d Dam %d",
1997-10-19 20:56:41 +04:00
mtmp->data->mlevel, mtmp->mgold, mtmp->mhp, mtmp->mhpmax,
mtmp->data->ac, (mtmp->data->damn + 1) * (mtmp->data->damd + 1));
1993-03-21 12:45:37 +03:00
}
1997-10-19 20:56:41 +04:00
#endif /* WAN_PROBING */
1993-03-21 12:45:37 +03:00
1997-10-19 20:56:41 +04:00
void
cls()
{
if (flags.toplin == 1)
1993-03-21 12:45:37 +03:00
more();
flags.toplin = 0;
clear_screen();
flags.botlx = 1;
}