For cartographer skills, don't shade out some known cells outside of our vision range. - stairs - doors - objects

This commit is contained in:
Rob Pearce 2016-06-13 09:15:00 +10:00
parent 3dd52fa511
commit 51bdeede32
4 changed files with 33 additions and 13 deletions

2
ai.c
View File

@ -159,7 +159,7 @@ void ailoscheck(lifeform_t *lf) {
cell_t *c;
for (i = 0; i < lf->nlos; i++) {
c = lf->los[i];
if (c->known != B_TRUE) {
if (!c->known) {
if ((c->known < PR_INEPT) || (c->known > PR_MASTER)) {
ok = B_FALSE; break;
}

10
defs.h
View File

@ -442,6 +442,14 @@
#define MAXDIR_MAP 15
enum KNOWNGLYPHTYPE {
KG_UNKNOWN = 0,
KG_MISC,
KG_DFEATURE, // dungeon feature object - door, terrain, etc
KG_STAIRS,
KG_OBJECT,
};
enum CELLADJUSTTYPE {
CA_NONE = 0,
CA_CH,
@ -5130,7 +5138,7 @@ typedef struct cell_s {
// lifeform pile
struct lifeform_s *lf;
// known to player?
int known;
enum KNOWNGLYPHTYPE known;
struct glyph_s knownglyph;
int knowntime;
int isroomwall;

32
map.c
View File

@ -90,7 +90,7 @@ cell_t *addcell(map_t *m, int x, int y) {
//cell->origlittimer = 0;
cell->writing = NULL;
cell->writinglifetime = -1;
cell->known = B_FALSE;
cell->known = KG_UNKNOWN;
cell->knowntime = 0;
cell->knownglyph.ch = ' ';
cell->knownglyph.colour = C_GREY;
@ -1685,7 +1685,7 @@ void clearcellstrings(cell_t *c) {
c->lockedreason = NULL;
}
if (gamemode == GM_GAMESTARTED) {
c->known = B_FALSE;
c->known = KG_UNKNOWN;
c->knownglyph.ch = ' ';
c->knownglyph.colour = C_GREY;
}
@ -1735,7 +1735,7 @@ void clearcell_exceptflags(cell_t *c, ... ) {
}
if (gamemode == GM_GAMESTARTED) {
c->known = B_FALSE;
c->known = KG_UNKNOWN;
c->knownglyph.ch = ' ';
c->knownglyph.colour = C_GREY;
}
@ -2829,6 +2829,8 @@ int getcelldistorth(cell_t *src, cell_t *dst) { // add x/y
// if we don't have LOS to there, set g->ch to NUL.
void getcellglyph(glyph_t *g, cell_t *c, lifeform_t *viewer) {
glyph_t tempgl;
enum SKILLLEVEL slev;
slev = getskill(viewer, SK_CARTOGRAPHY);
// default
g->ch = ' ';
@ -2880,9 +2882,10 @@ void getcellglyph(glyph_t *g, cell_t *c, lifeform_t *viewer) {
adjustcellglyph(c, g, CA_BOTH);
}
} else { // can't see the cell
int tt = TT_NONE;
void *thing;
//drawscannedcell(cell, x-viewx, y-viewy);
switch (isinscanrange(c, &thing, NULL, &tempgl)) {
tt = isinscanrange(c, &thing, NULL, &tempgl);
switch (tt) {
case TT_MONSTER:
case TT_OBJECT:
*g = tempgl;
@ -2898,8 +2901,14 @@ void getcellglyph(glyph_t *g, cell_t *c, lifeform_t *viewer) {
g->ch = ' ';
}
// out of LOS - show as dark
//g->colour = C_BLUE;
g->colour = C_VDARKGREY;
// unless it's a certain kind of glyph
if ((slev >= PR_BEGINNER) && (c->known == KG_STAIRS)) {
////////// colour ??
} else if ((slev >= PR_ADEPT) && (c->known == KG_DFEATURE)) {
} else if ((slev >= PR_EXPERT) && (c->known == KG_OBJECT)) {
} else {
g->colour = C_VDARKGREY;
}
}
break;
}
@ -8136,7 +8145,7 @@ void forgetcells(map_t *map, int amt) {
int n;
int sel;
sel = rnd(0,nposs-1);
poss[sel]->known = B_FALSE;
poss[sel]->known = KG_UNKNOWN;
// shuffle down
for (n = i; n < (amtleft-1); n++) {
poss[n] = poss[n+1];
@ -10392,7 +10401,7 @@ void setcellknown_fake(cell_t *cell, enum CELLTYPE ctid) {
celltype_t *ct;
ct = findcelltype(ctid);
cell->known = B_TRUE;
cell->known = KG_MISC;
// remember a wall.
//ct = findcelltype(getmapsolid(cell->map));
cell->knownglyph = ct->glyph;
@ -10409,7 +10418,7 @@ void setcellknown(cell_t *cell, int forcelev) {
slev = getskill(player, SK_CARTOGRAPHY);
}
cell->known = B_TRUE;
cell->known = KG_MISC;
// default to remembering the cell's glyph, or a wall if there's a secret door there
o = hassecretdoor(cell->obpile);
if (o) {
@ -10427,6 +10436,7 @@ void setcellknown(cell_t *cell, int forcelev) {
o = gettopobject(cell, B_TRUE);
if (o) {
cell->knownglyph = *(getglyph(o));
cell->known = KG_OBJECT;
}
}
if (slev >= PR_ADEPT) {
@ -10434,6 +10444,7 @@ void setcellknown(cell_t *cell, int forcelev) {
if ((o->type->obclass->id == OC_DFEATURE) || (o->type->obclass->id == OC_TERRAIN)) {
if (!issecretdoor(o)) {
cell->knownglyph = *(getglyph(o));
cell->known = KG_DFEATURE;
}
}
}
@ -10442,6 +10453,7 @@ void setcellknown(cell_t *cell, int forcelev) {
o = hasobwithflag(cell->obpile, F_CLIMBABLE);
if (o) {
cell->knownglyph = *(getglyph(o));
cell->known = KG_STAIRS;
}
}

View File

@ -11489,7 +11489,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) {
cell_t *c;
c = getcellat(lf->cell->map, x, y);
if (c && c->lf) {
c->known = B_TRUE;
c->known = KG_MISC;
c->knownglyph = *(getlfglyph(c->lf));
}
}