From 4f8f478139674185e38c267fb2486c7d15e90986 Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Thu, 19 Jan 2012 06:52:52 +0000 Subject: [PATCH] - [+] let you salt corpses (stop them from decaying, like the spell (forgot its name)) - [+] INFINITE LOOP during linkexit() on sewer map. - [+] cursed scroll of light wasn't updating view properly... - [+] when you use a tunnel, don't say "you walk down the staircase" - [+] use mandatory value of f_climbable text="tunnel" or "staircase" etc --- data.c | 20 ++++++++++---------- data/hiscores.db | Bin 13312 -> 13312 bytes defs.h | 1 + lf.c | 13 ++++++++----- map.c | 30 ++++++++++++++++++++++++++---- objects.c | 9 ++++++--- spell.c | 11 +++++++++-- 7 files changed, 60 insertions(+), 24 deletions(-) diff --git a/data.c b/data.c index 1af6d84..7638ad8 100644 --- a/data.c +++ b/data.c @@ -1379,7 +1379,7 @@ void initobjects(void) { addflag(lastot->flags, F_RARITY, H_DUNGEON, 100, RR_RARE, NULL); addflag(lastot->flags, F_MAKESNOISE, 33, 3, NA, "a slow drip."); addflag(lastot->flags, F_GLYPH, C_GREY, '#', NA, NULL); - addflag(lastot->flags, F_CLIMBABLE, D_DOWN, NA, NA, NULL); + addflag(lastot->flags, F_CLIMBABLE, D_DOWN, NA, NA, "drainage grate"); addflag(lastot->flags, F_OPPOSITESTAIRS, OT_GRATINGROOF, NA, NA, NULL); addflag(lastot->flags, F_NOPICKUP, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL); @@ -1390,7 +1390,7 @@ void initobjects(void) { addot(OT_GRATINGROOF, "drain in the roof", "An open draining grate set into the roof.", MT_NOTHING, 0, OC_DFEATURE, SZ_LARGE); addflag(lastot->flags, F_GLYPH, C_BLUE, '<', NA, NULL); - addflag(lastot->flags, F_CLIMBABLE, D_UP, NA, NA, NULL); + addflag(lastot->flags, F_CLIMBABLE, D_UP, NA, NA, "drainage grate"); addflag(lastot->flags, F_DONTSHOWDEST, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_PIT, D_UP, NA, NA, NULL); addflag(lastot->flags, F_OPPOSITESTAIRS, OT_GRATINGFLOOR, NA, NA, NULL); @@ -1402,7 +1402,7 @@ void initobjects(void) { addflag(lastot->flags, F_RARITY, H_DUNGEON, 100, RR_RARE, NULL); addflag(lastot->flags, F_RARITY, H_CAVE, 100, RR_UNCOMMON, NULL); addflag(lastot->flags, F_GLYPH, C_BLUE, '^', NA, NULL); - addflag(lastot->flags, F_CLIMBABLE, D_DOWN, NA, NA, NULL); + addflag(lastot->flags, F_CLIMBABLE, D_DOWN, NA, NA, "hole"); addflag(lastot->flags, F_DONTSHOWDEST, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_PIT, D_DOWN, NA, NA, NULL); addflag(lastot->flags, F_OPPOSITESTAIRS, OT_HOLEINROOF, NA, NA, NULL); @@ -1412,7 +1412,7 @@ void initobjects(void) { addot(OT_HOLEINROOF, "hole in the roof", "A gaping hole in the roof.", MT_NOTHING, 0, OC_DFEATURE, SZ_LARGE); addflag(lastot->flags, F_GLYPH, C_BLUE, '<', NA, NULL); - addflag(lastot->flags, F_CLIMBABLE, D_UP, NA, NA, NULL); + addflag(lastot->flags, F_CLIMBABLE, D_UP, NA, NA, "hole"); addflag(lastot->flags, F_DONTSHOWDEST, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_PIT, D_UP, NA, NA, NULL); addflag(lastot->flags, F_OPPOSITESTAIRS, OT_HOLEINGROUND, NA, NA, NULL); @@ -1423,7 +1423,7 @@ void initobjects(void) { addot(OT_TUNNELDOWN, "tunnel leading down", "A wide tunnel leading downwards.", MT_STONE, 3000, OC_DFEATURE, SZ_HUGE); addflag(lastot->flags, F_GLYPH, C_BROWN, '>', NA, NULL); - addflag(lastot->flags, F_CLIMBABLE, D_DOWN, NA, NA, NULL); + addflag(lastot->flags, F_CLIMBABLE, D_DOWN, NA, NA, "tunnel"); addflag(lastot->flags, F_OPPOSITESTAIRS, OT_TUNNELUP, NA, NA, NULL); addflag(lastot->flags, F_NOPICKUP, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL); @@ -1431,21 +1431,21 @@ void initobjects(void) { addflag(lastot->flags, F_MAKESNOISE, 33, 1, NA, "an echoing drip."); addot(OT_TUNNELUP, "tunnel leading up", "A wide tunnel leading upwards.", MT_STONE, 3000, OC_DFEATURE, SZ_HUGE); addflag(lastot->flags, F_GLYPH, C_BROWN, '<', NA, NULL); - addflag(lastot->flags, F_CLIMBABLE, D_UP, NA, NA, NULL); + addflag(lastot->flags, F_CLIMBABLE, D_UP, NA, NA, "tunnel"); addflag(lastot->flags, F_OPPOSITESTAIRS, OT_TUNNELDOWN, NA, NA, NULL); addflag(lastot->flags, F_NOPICKUP, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL); addot(OT_STAIRSDOWN, "staircase going down", "A stone staircase winding downwards.", MT_STONE, 3000, OC_DFEATURE, SZ_HUGE); addflag(lastot->flags, F_GLYPH, NA, '>', NA, NULL); - addflag(lastot->flags, F_CLIMBABLE, D_DOWN, NA, NA, NULL); + addflag(lastot->flags, F_CLIMBABLE, D_DOWN, NA, NA, "staircase"); addflag(lastot->flags, F_OPPOSITESTAIRS, OT_STAIRSUP, NA, NA, NULL); addflag(lastot->flags, F_NOPICKUP, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL); addot(OT_STAIRSUP, "staircase going up", "A stone staircase climbing upwards.", MT_STONE, 3000, OC_DFEATURE, SZ_HUGE); addflag(lastot->flags, F_GLYPH, NA, '<', NA, NULL); - addflag(lastot->flags, F_CLIMBABLE, D_UP, NA, NA, NULL); + addflag(lastot->flags, F_CLIMBABLE, D_UP, NA, NA, "staircase"); addflag(lastot->flags, F_OPPOSITESTAIRS, OT_STAIRSDOWN, NA, NA, NULL); addflag(lastot->flags, F_NOPICKUP, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL); @@ -1587,7 +1587,7 @@ void initobjects(void) { addot(OT_PORTAL, "magic portal", "A magical portal to a different place...", MT_MAGIC, 0, OC_DFEATURE, SZ_LARGE); addflag(lastot->flags, F_RARITY, H_DUNGEON, 80, RR_VERYRARE, NULL); addflag(lastot->flags, F_GLYPH, C_BOLDGREEN, '^', NA, NULL); - addflag(lastot->flags, F_CLIMBABLE, D_IN, NA, NA, NULL); + addflag(lastot->flags, F_CLIMBABLE, D_IN, NA, NA, "portal"); addflag(lastot->flags, F_NOPICKUP, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOFEEL, B_TRUE, NA, NA, NULL); @@ -1595,7 +1595,7 @@ void initobjects(void) { addot(OT_STOMACHEXIT, "gaping hole", "A gaping hole in an enormous creature.", MT_MAGIC, 0, OC_DFEATURE, SZ_LARGE); addflag(lastot->flags, F_GLYPH, C_GREY, '^', NA, NULL); addflag(lastot->flags, F_DONTSHOWDEST, B_TRUE, NA, NA, NULL); - addflag(lastot->flags, F_CLIMBABLE, D_IN, NA, NA, NULL); + addflag(lastot->flags, F_CLIMBABLE, D_IN, NA, NA, "hole"); addflag(lastot->flags, F_NOPICKUP, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOFEEL, B_TRUE, NA, NA, NULL); diff --git a/data/hiscores.db b/data/hiscores.db index df2a9fc60e959d9bb9d8775287dc50ac136d7f85..89e21b093300100425a7ce1f90c9123564981e55 100644 GIT binary patch delta 207 zcmZq3Xvml#&C9}o1U72iVV2@#KEezX<6{2J{D}Du^EKuR%paJaGoNBUvRRI088aJD zj<>OT@+tPz$%Y(@CST{=obkD0phK9Lq9h zw!CzO?EIw3r`S^&Pfyn4SUmYM$9vuj3@oh73``6^S(q6ZH=pM;W@OZx%*?IL!tBPt zw%LgL5(^{GW>$e|%#3D}=Lj3I7!m diff --git a/defs.h b/defs.h index 55a2468..34be441 100644 --- a/defs.h +++ b/defs.h @@ -2251,6 +2251,7 @@ enum FLAG { // stairs / teleporters / portals F_CLIMBABLE, // this is a stiarcase, v0 = up/down/in // also use this for portals + // text = you climb down XXXX // OPTIONAL v1 = id of region to link to. F_PIT, // this is a pit which we can fall down. // v0 = up/down diff --git a/lf.c b/lf.c index df7ae34..3beae5d 100644 --- a/lf.c +++ b/lf.c @@ -6754,6 +6754,9 @@ enum MATERIAL getlfmaterial(lifeform_t *lf) { enum SKILLLEVEL getlorelevel(lifeform_t *lf, enum RACECLASS rcid) { enum SKILLLEVEL slev = PR_INEPT; raceclass_t *rc; + if (gamemode < GM_GAMESTARTED) { + return PR_INEPT; + } rc = findraceclass(rcid); if (rc) { slev = getskill(lf, rc->skill); @@ -17870,11 +17873,11 @@ int usestairs(lifeform_t *lf, object_t *o, int onpurpose, int climb) { curs_set(1); if (isportal) { if (isplayer(lf)) { - msg("You enter %s...", obname); + msg("You enter the %s...", f->text); // move cursor to msgwindow while we create the new level... wrefresh(msgwin); } else if (cansee(player, lf)) { - msg("%s enters %s...", lfname, obname); + msg("%s enters the %s...", lfname, f->text); } } else if (hasflag(o->flags, F_PIT) || (o->type->id == OT_GRATINGFLOOR) || (o->type->id == OT_GRATINGROOF)) { //f = hasflag(o->flags, F_PIT); @@ -17886,11 +17889,11 @@ int usestairs(lifeform_t *lf, object_t *o, int onpurpose, int climb) { } } else { if (isplayer(lf)) { - msg("You %s %s the staircase...", getmoveverb(lf), getdirname(dir)); + msg("You %s %s the %s...", getmoveverb(lf), getdirname(dir), f->text); // move cursor to msgwindow while we create the new level... wrefresh(msgwin); } else if (cansee(player, lf)) { - msg("%s %s %s the staircase.", lfname, getmoveverbother(lf), getdirname(dir)); + msg("%s %s %s the %s.", lfname, getmoveverbother(lf), getdirname(dir), f->text); } } @@ -17953,7 +17956,7 @@ int usestairs(lifeform_t *lf, object_t *o, int onpurpose, int climb) { if (movelfsoutofway(newcell) || !cellwalkable(lf, newcell, NULL)) { // TODO: handle this differently - ie always allow the player // go there? - if (isplayer(lf)) msg("The stairs seem to be blocked."); + if (isplayer(lf)) msg("The %s seems to be blocked.",f->text); return B_TRUE; } // announce diff --git a/map.c b/map.c index f7faca3..a494560 100644 --- a/map.c +++ b/map.c @@ -935,6 +935,8 @@ int cellhaslos(cell_t *c1, cell_t *dest) { int x2,y2; map_t *map; + if (c1 == dest) return B_TRUE; + if (!dest) return B_FALSE; // let the player see when dead, otherwise the screen wil @@ -4357,7 +4359,9 @@ int linkexits(map_t *m, int roomid) { // no corridors? if (ncorridors == 0) { if (db) dblog(" Need to link."); - nadded += linkexit(poss[i], B_FALSE, NULL); + if (!linkexit(poss[i], B_FALSE, NULL)) { + nadded++; + } } } // end for each door @@ -6643,19 +6647,20 @@ void makelit(cell_t *c, enum LIGHTLEV how, int howlong) { c->origlittimer = c->littimer; c->littimer = howlong; } - c->lit = how; if (how != origlit) { - if ((gamemode == GM_GAMESTARTED) && (c->lit != how)) { + //if ((gamemode == GM_GAMESTARTED) && (c->lit != how)) { + if (gamemode == GM_GAMESTARTED) { lifeform_t *lf; for (lf = c->map->lf ; lf ; lf = lf->next) { //if (haslos(lf, c) || haslosdark(lf, c)) { - if (haslos(lf, c)) { + if ((lf->cell == c) || haslos(lf, c)) { setlosdirty(lf); } } } } + c->lit = how; } void makelitradius(cell_t *c, int radius, enum LIGHTLEV how, int howlong) { @@ -6681,6 +6686,23 @@ void makelitradius(cell_t *c, int radius, enum LIGHTLEV how, int howlong) { } } } + + // now setlos dirty for lfs who can see any of the cells. + // while makelit() does this as well, we need to do it + // again here because makelit also contains calls to "haslos", + // which clears lf->losdirty again. This is fine when we're only + // changing one cell's light level, but when changing multiple + // cells we need to go through again afterwards. + + if (gamemode == GM_GAMESTARTED) { + lifeform_t *lf; + for (lf = c->map->lf ; lf ; lf = lf->next) { + //if (haslos(lf, c) || haslosdark(lf, c)) { + if (distfunc(lf->cell,c) <= (radius + MAXVISRANGE)) { + setlosdirty(lf); + } + } + } } void markroomwalls(map_t *m, room_t *r) { diff --git a/objects.c b/objects.c index 194929f..0ce7356 100644 --- a/objects.c +++ b/objects.c @@ -2502,6 +2502,12 @@ int canseeob(lifeform_t *lf, object_t *o) { } } + if (isblind(player) || (o->pile->where && !haslos(player, o->pile->where)) ) { + if (hasflag(o->flags, F_NOFEEL)) { + return B_FALSE; + } + } + f = hasflag(o->flags, F_TRAIL); if (f) { if (f->val[2] == S_SIGHT) { @@ -2551,9 +2557,6 @@ int canseeob(lifeform_t *lf, object_t *o) { } } - if (isblind(player) && hasflag(o->flags, F_NOFEEL)) { - return B_FALSE; - } return B_TRUE; } diff --git a/spell.c b/spell.c index a941279..da0dad0 100644 --- a/spell.c +++ b/spell.c @@ -4915,6 +4915,10 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ makelitradius(targcell, power*2, L_PERMDARK, rnd(5,10) + power ); } calclight(targcell->map); + if (targcell->map == player->cell->map) { + needredraw = B_TRUE; + drawscreen(); + } } else if (spellid == OT_S_DETECTAURA) { if (isplayer(caster)) { object_t *o; @@ -7734,9 +7738,12 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_ addtempflag(targcell->lf->flags, F_PRODUCESLIGHT, B_TRUE, NA, NA, NULL, rnd(10,20)+(power*2) ); } } + calclight(targcell->map); - needredraw = B_TRUE; - drawscreen(); + if (targcell->map == player->cell->map) { + needredraw = B_TRUE; + drawscreen(); + } } else if (spellid == OT_S_LIGHTNINGBOLT) { cell_t *retcell[MAXRETCELLS]; int nretcells;