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; cell_t *c;
for (i = 0; i < lf->nlos; i++) { for (i = 0; i < lf->nlos; i++) {
c = lf->los[i]; c = lf->los[i];
if (c->known != B_TRUE) { if (!c->known) {
if ((c->known < PR_INEPT) || (c->known > PR_MASTER)) { if ((c->known < PR_INEPT) || (c->known > PR_MASTER)) {
ok = B_FALSE; break; ok = B_FALSE; break;
} }

10
defs.h
View File

@ -442,6 +442,14 @@
#define MAXDIR_MAP 15 #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 { enum CELLADJUSTTYPE {
CA_NONE = 0, CA_NONE = 0,
CA_CH, CA_CH,
@ -5130,7 +5138,7 @@ typedef struct cell_s {
// lifeform pile // lifeform pile
struct lifeform_s *lf; struct lifeform_s *lf;
// known to player? // known to player?
int known; enum KNOWNGLYPHTYPE known;
struct glyph_s knownglyph; struct glyph_s knownglyph;
int knowntime; int knowntime;
int isroomwall; int isroomwall;

30
map.c
View File

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