- [+] bug: training never going up!
- [+] new listen code - [+] nov: approx. dist - [+] beg: distance + direction + detect if 1 away - [+] adp: listen at stairs, detect if 2 away - [+] sk: detect if 3 away - [+] exp: ident monsters - [+] exp: detect if 4 - [+] mas: detect anywhere - [+] remove f_nosmell from snakes. - [+] sixth sense - don't kill the spell after it has activated.
This commit is contained in:
parent
435b374c25
commit
6764a20443
24
data.c
24
data.c
|
@ -3313,7 +3313,7 @@ void initobjects(void) {
|
|||
addflag(lastot->flags, F_SPELLLEVEL, 1, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_LOSLOF, B_TRUE, LOF_DONTNEED, NA, NULL);
|
||||
addflag(lastot->flags, F_VARPOWER, B_TRUE, NA, NA, NULL);
|
||||
addot(OT_S_MIST, "pea soup", "Envelops an area in front of the caster with a thick cloud of mist.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
|
||||
addot(OT_S_MIST, "pea soup", "Envelops an area adjacent to the caster with a thick cloud of mist.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
|
||||
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "Spell power determines how long the mist will last.");
|
||||
addflag(lastot->flags, F_SPELLSCHOOL, SS_AIR, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_SPELLSCHOOL, SS_NATURE, NA, NA, NULL);
|
||||
|
@ -14392,8 +14392,8 @@ void initrace(void) {
|
|||
addflag(lastrace->flags, F_RARITY, H_SEWER, NA, RR_FREQUENT, NULL);
|
||||
addflag(lastrace->flags, F_HITDICE, 1, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_TR, 1, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_HASATTACK, OT_TEETH, 2, NA, NULL);
|
||||
addflag(lastrace->flags, F_HASATTACK, OT_CLAWS, 3, NA, NULL);
|
||||
addflag(lastrace->flags, F_HASATTACK, OT_TEETH, 1, NA, NULL);
|
||||
addflag(lastrace->flags, F_HASATTACK, OT_CLAWS, 1, NA, NULL);
|
||||
addflag(lastrace->flags, F_MAXATTACKS, 1, 1, NA, NULL);
|
||||
addflag(lastrace->flags, F_NOSPELLS, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_WANTSOBFLAG, F_EDIBLE, B_COVETS, NA, NULL);
|
||||
|
@ -14422,7 +14422,7 @@ void initrace(void) {
|
|||
addflag(lastrace->flags, F_RARITY, H_ANTNEST, NA, RR_RARE, NULL);
|
||||
addflag(lastrace->flags, F_HITDICE, 3, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_TR, 3, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_HASATTACK, OT_TEETH, 8, NA, NULL);
|
||||
addflag(lastrace->flags, F_HASATTACK, OT_TEETH, 4, NA, NULL);
|
||||
addflag(lastrace->flags, F_MAXATTACKS, 1, 1, NA, NULL);
|
||||
addflag(lastrace->flags, F_NOSPELLS, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_CARNIVORE, B_TRUE, NA, NA, NULL);
|
||||
|
@ -14573,7 +14573,6 @@ void initrace(void) {
|
|||
addflag(lastrace->flags, F_RARITY, H_DUNGEON, NA, RR_COMMON, NULL);
|
||||
addflag(lastrace->flags, F_COLDBLOOD, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_NOSTAIRS, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_NOSMELL, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_HOSTILE, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_STARTATT, A_STR, AT_LOW, NA, NULL);
|
||||
addflag(lastrace->flags, F_STARTATT, A_IQ, IQ_ANIMAL, NA, NULL);
|
||||
|
@ -14604,7 +14603,6 @@ void initrace(void) {
|
|||
addrace(R_SNAKECARPET, "carpet snake", 3, 's', C_GREY, MT_FLESH, RC_ANIMAL, "Non-venemous (but not quite harmless) snakes.");
|
||||
setbodytype(lastrace, BT_SNAKE);
|
||||
addflag(lastrace->flags, F_RARITY, H_DUNGEON, NA, RR_COMMON, NULL);
|
||||
addflag(lastrace->flags, F_NOSMELL, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_COLDBLOOD, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_NOSTAIRS, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_HOSTILE, B_TRUE, NA, NA, NULL);
|
||||
|
@ -14635,7 +14633,6 @@ void initrace(void) {
|
|||
addflag(lastrace->flags, F_RARITY, H_DUNGEON, NA, RR_UNCOMMON, NULL);
|
||||
addflag(lastrace->flags, F_COLDBLOOD, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_NOSTAIRS, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_NOSMELL, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_HOSTILE, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_STARTATT, A_STR, AT_LOW, NA, NULL);
|
||||
addflag(lastrace->flags, F_STARTATT, A_IQ, IQ_ANIMAL, NA, NULL);
|
||||
|
@ -14666,7 +14663,6 @@ void initrace(void) {
|
|||
addflag(lastrace->flags, F_RARITY, H_DUNGEON, NA, RR_UNCOMMON, NULL);
|
||||
addflag(lastrace->flags, F_COLDBLOOD, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_NOSTAIRS, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_NOSMELL, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_HOSTILE, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_STARTATT, A_STR, AT_LOW, NA, NULL);
|
||||
addflag(lastrace->flags, F_STARTATT, A_IQ, IQ_ANIMAL, NA, NULL);
|
||||
|
@ -14699,7 +14695,6 @@ void initrace(void) {
|
|||
addflag(lastrace->flags, F_RARITY, H_DUNGEON, NA, RR_RARE, NULL);
|
||||
addflag(lastrace->flags, F_COLDBLOOD, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_NOSTAIRS, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_NOSMELL, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_HOSTILE, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_STARTATT, A_STR, AT_LOW, NA, NULL);
|
||||
addflag(lastrace->flags, F_STARTATT, A_IQ, IQ_ANIMAL, NA, NULL);
|
||||
|
@ -14733,7 +14728,6 @@ void initrace(void) {
|
|||
addflag(lastrace->flags, F_RARITY, H_DUNGEON, NA, RR_UNCOMMON, NULL);
|
||||
addflag(lastrace->flags, F_COLDBLOOD, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_NOSTAIRS, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_NOSMELL, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_HOSTILE, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_STARTATT, A_STR, AT_HIGH, NA, NULL);
|
||||
addflag(lastrace->flags, F_STARTATT, A_IQ, IQ_ANIMAL, NA, NULL);
|
||||
|
@ -14766,7 +14760,6 @@ void initrace(void) {
|
|||
addflag(lastrace->flags, F_RARITY, H_SEWER, NA, RR_COMMON, NULL);
|
||||
addflag(lastrace->flags, F_NOSTAIRS, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_AQUATIC, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_NOSMELL, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_NEEDSWATER, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_BREATHWATER, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastrace->flags, F_COLDBLOOD, B_TRUE, NA, NA, NULL);
|
||||
|
@ -17289,11 +17282,14 @@ void initskills(void) {
|
|||
addskilldesc(SK_FIRSTAID, PR_MASTER, "+12 hit points per level.", B_FALSE);
|
||||
addskill(SK_LISTEN, "Listen", "How good you are at hearing and interpreting sounds.", 200);
|
||||
addskilldesc(SK_LISTEN, PR_NOVICE, "^gYou now gauge the distance of sounds.^n", B_TRUE);
|
||||
addskilldesc(SK_LISTEN, PR_BEGINNER, "^gYou now more accurately gauge the distance of sounds.^n", B_TRUE);
|
||||
addskilldesc(SK_LISTEN, PR_ADEPT, "^gYou can now determine the direction sounds are coming from.^n", B_TRUE);
|
||||
addskilldesc(SK_LISTEN, PR_BEGINNER, "^gYou can now determine the direction sounds are coming from.^n", B_TRUE);
|
||||
addskilldesc(SK_LISTEN, PR_BEGINNER, "^gYou can now pinpoint sound sources right next to you.^n", B_TRUE);
|
||||
addskilldesc(SK_LISTEN, PR_ADEPT, "^gYou can now listen at staircases before descending.^n", B_TRUE);
|
||||
addskilldesc(SK_LISTEN, PR_ADEPT, "^gYou can now pinpoint sound sources up to 2 cells away.^n", B_TRUE);
|
||||
addskilldesc(SK_LISTEN, PR_SKILLED, "^gYou can now pinpoint sound sources up to 3 cells away.^n", B_TRUE);
|
||||
addskilldesc(SK_LISTEN, PR_EXPERT, "^gYou can now identify monsters based on sound.^n", B_TRUE);
|
||||
addskilldesc(SK_LISTEN, PR_MASTER, "^gYou can now locate monsters based on sound.^n", B_TRUE);
|
||||
addskilldesc(SK_LISTEN, PR_EXPERT, "^gYou can now pinpoint sound sources up to 4 cells away.^n", B_TRUE);
|
||||
addskilldesc(SK_LISTEN, PR_MASTER, "^gYou can now pinpoint sound sources up to 6 cells away.^n", B_TRUE);
|
||||
addskill(SK_LOCKPICKING, "Lockpicking", "Enhances your ability to pick locks.", 50);
|
||||
addskilldesc(SK_LOCKPICKING, PR_NOVICE, "^gYou gain the 'pick locks' ability.^n", B_FALSE);
|
||||
addskill(SK_METALWORK, "Metalwork", "Lets you repair metal objects.", 25);
|
||||
|
|
BIN
data/hiscores.db
BIN
data/hiscores.db
Binary file not shown.
50
defs.h
50
defs.h
|
@ -2446,7 +2446,7 @@ enum FLAG {
|
|||
F_MAPTO, // this object is a map to a regionlink.:
|
||||
// v0=region containing entrance
|
||||
// v1=depth of entrance
|
||||
// v2=regionthing ID of RT_REGIONLINK thing
|
||||
// v2=regionthing ID of RT_BRANCHLINK thing
|
||||
// text = what this is a map to ie. "the goblin caves"
|
||||
F_ORIGMAP, // for amulet of the traveller - v0 = original map id
|
||||
// where the amulet was put on. v1/v2 is x/y coords.
|
||||
|
@ -3446,8 +3446,16 @@ enum FLAG {
|
|||
F_CANEATRAW, // lf can eat raw food with no issues
|
||||
F_CANCAST, // can cast the spell val0 (need MP)
|
||||
F_CASTWITHOUTIQ, // can cast spells even eith low iq.
|
||||
F_CANHEARLF, // you can hear lifeform id v0 (show their glyph)
|
||||
F_CANHEARLF, // you can hear lifeform id v0
|
||||
|
||||
// if v1 is TRUE:
|
||||
// show their glyph on the map
|
||||
// when cursor is over them, desc is their name.
|
||||
// if v1 is _NOT_ TRUE:
|
||||
// show a generic 'noise' symbol on the map
|
||||
// when cursor is over them, use f->text
|
||||
// this flag does not get announced.
|
||||
|
||||
F_LOWHPABIL, // will automatically use the ability v0 when
|
||||
// this lf starts bleeding.
|
||||
F_NOBREATH, // this lf doesn't need to breath.
|
||||
|
@ -4026,17 +4034,17 @@ typedef struct option_s {
|
|||
struct option_s *next, *prev;
|
||||
} option_t;
|
||||
|
||||
enum REGIONTYPE {
|
||||
RG_CAVE,
|
||||
RG_WORLDMAP,
|
||||
RG_MAINDUNGEON,
|
||||
RG_HEAVEN,
|
||||
RG_PIT,
|
||||
RG_SEWER,
|
||||
RG_STOMACH,
|
||||
RG_WOODS,
|
||||
RG_BABAYAGAHUT,
|
||||
RG_MASTERVAULTS,
|
||||
enum BRANCH {
|
||||
BH_CAVE,
|
||||
BH_WORLDMAP,
|
||||
BH_MAINDUNGEON,
|
||||
BH_HEAVEN,
|
||||
BH_PIT,
|
||||
BH_SEWER,
|
||||
BH_STOMACH,
|
||||
BH_WOODS,
|
||||
BH_BABAYAGAHUT,
|
||||
BH_MASTERVAULTS,
|
||||
};
|
||||
|
||||
enum HABITAT {
|
||||
|
@ -4055,8 +4063,8 @@ enum HABITAT {
|
|||
H_ALL = 999
|
||||
};
|
||||
|
||||
typedef struct regiontype_s {
|
||||
enum REGIONTYPE id;
|
||||
typedef struct branch_s {
|
||||
enum BRANCH id;
|
||||
enum HABITAT defaulthabitat;
|
||||
char *name;
|
||||
int pluralname;
|
||||
|
@ -4066,8 +4074,8 @@ typedef struct regiontype_s {
|
|||
int majorbranch;
|
||||
int depthmod;
|
||||
int addparentdepth;
|
||||
struct regiontype_s *next, *prev;
|
||||
} regiontype_t;
|
||||
struct branch_s *next, *prev;
|
||||
} branch_t;
|
||||
|
||||
enum REGIONTHING {
|
||||
RT_NONE = 0,
|
||||
|
@ -4075,7 +4083,7 @@ enum REGIONTHING {
|
|||
RT_LF, // text is a mosnter definition
|
||||
// val is how many to place.
|
||||
RT_OBJECT, // what is object name
|
||||
RT_REGIONLINK, // val is enum regiontype to link to.
|
||||
RT_BRANCHLINK, // val is enum branch to link to.
|
||||
// what is stair object type
|
||||
RT_VAULT, // what is vaultname
|
||||
RT_RNDVAULTWITHFLAG, // val is wantedflag
|
||||
|
@ -4095,16 +4103,16 @@ typedef struct regionthing_s {
|
|||
#define MAXOUTLINETHINGS 60
|
||||
typedef struct regionoutline_s {
|
||||
int id;
|
||||
regiontype_t *rtype;
|
||||
branch_t *rtype;
|
||||
regionthing_t thing[MAXOUTLINETHINGS];
|
||||
int nthings;
|
||||
struct regionoutline_s *next, *prev;
|
||||
} regionoutline_t;
|
||||
|
||||
// a region is a link of a regiontype and an outline
|
||||
// a region is a link of a branch and an outline
|
||||
typedef struct region_s {
|
||||
int id;
|
||||
regiontype_t *rtype;
|
||||
branch_t *rtype;
|
||||
regionoutline_t *outline;
|
||||
struct region_s *parentregion;
|
||||
int nthings; // is this used???
|
||||
|
|
13
io.c
13
io.c
|
@ -1201,8 +1201,8 @@ char *askstring(char *prompt, char punc, char *retbuf, int retBUFLEN, char *def)
|
|||
|
||||
void announcearrival(lifeform_t *lf, map_t *newmap) {
|
||||
if (isplayer(lf)) {
|
||||
if (newmap->region->rtype->id == RG_WORLDMAP) {
|
||||
if (lf->cell->map->region->rtype->id == RG_WORLDMAP) {
|
||||
if (newmap->region->rtype->id == BH_WORLDMAP) {
|
||||
if (lf->cell->map->region->rtype->id == BH_WORLDMAP) {
|
||||
msg("You arrive in a new area.");
|
||||
} else {
|
||||
msg("You arrive at the surface.");
|
||||
|
@ -7311,7 +7311,7 @@ char *makedesc_race(enum RACE rid, char *retbuf, int showextra, int forplayersel
|
|||
}
|
||||
|
||||
if (curidx == 0) {
|
||||
strncat(retbuf, "^n@None.\n", HUGEBUFLEN);
|
||||
strncat(retbuf, "^n@None known.\n", HUGEBUFLEN);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////
|
||||
|
@ -7382,6 +7382,7 @@ char *makedesc_race(enum RACE rid, char *retbuf, int showextra, int forplayersel
|
|||
break;
|
||||
case F_MPMOD: if (f->val[0] < 0) sprintf(buf, "%d Mana", f->val[0]); break;
|
||||
case F_NEEDSWATER: if (lorelev >= PR_NOVICE) sprintf(buf, "Will suffocate without water"); break;
|
||||
case F_NOSMELL: if ((lorelev >= PR_NOVICE) ) sprintf(buf, "No sense of smell."); break;
|
||||
case F_NOCTURNAL: if ((lorelev >= PR_BEGINNER) && !forplayersel) sprintf(buf, "Sleeps during the day."); break;
|
||||
case F_NOSPELLS: if (lorelev >= PR_NOVICE) sprintf(buf, "Cannot use magic."); break;
|
||||
case F_NOPACK: sprintf(buf, "Cannot carry objects."); break;
|
||||
|
@ -7418,7 +7419,7 @@ char *makedesc_race(enum RACE rid, char *retbuf, int showextra, int forplayersel
|
|||
}
|
||||
|
||||
if (curidx == 0) {
|
||||
strncat(retbuf, "^n@None.\n", HUGEBUFLEN);
|
||||
strncat(retbuf, "^n@None known.\n", HUGEBUFLEN);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11299,6 +11300,8 @@ void showlfstats(lifeform_t *lf, int showall) {
|
|||
centre(mainwin, C_WHITE, 0, "MONSTER DETAILS");
|
||||
}
|
||||
x = 0;
|
||||
centre(mainwin, C_MAGENTA, 1, "[Press ? for a full description]");
|
||||
|
||||
y = 2;
|
||||
y2 = 2;
|
||||
|
||||
|
@ -11805,6 +11808,8 @@ void showlfstats(lifeform_t *lf, int showall) {
|
|||
getyx(mainwin, y, x);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// knowledge?
|
||||
if (lf != player) {
|
||||
char knowstring[BUFLEN];
|
||||
|
|
88
lf.c
88
lf.c
|
@ -3477,7 +3477,7 @@ void die(lifeform_t *lf) {
|
|||
|
||||
if (corpse->type->id == OT_BABAYAGAHUT) {
|
||||
// link the hut to the new region.
|
||||
createregionlink(corpsecell->map, corpsecell, corpse, NULL, RG_BABAYAGAHUT, corpsecell->map->region);
|
||||
createbranchlink(corpsecell->map, corpsecell, corpse, NULL, BH_BABAYAGAHUT, corpsecell->map->region);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3692,7 +3692,7 @@ void die(lifeform_t *lf) {
|
|||
// - the player died in a major dungeon branch, which wasn't the realm of gods
|
||||
if (thisisplayer && (where->room) &&
|
||||
(where->map->region->rtype->majorbranch) &&
|
||||
(where->map->region->rtype->id != RG_HEAVEN)) {
|
||||
(where->map->region->rtype->id != BH_HEAVEN)) {
|
||||
// If all of the above are true, the below will trigger a bones file:
|
||||
// Player reanimating as some kind of monster
|
||||
// Being killed by stoning
|
||||
|
@ -4066,7 +4066,7 @@ int digup(lifeform_t *lf, object_t *o) {
|
|||
getlfname(lf, lfname);
|
||||
|
||||
// no roof?
|
||||
if (lf->cell->map->region->rtype->id == RG_WORLDMAP) {
|
||||
if (lf->cell->map->region->rtype->id == BH_WORLDMAP) {
|
||||
if (isplayer(lf)) {
|
||||
msg("There is no roof above you to dig into!");
|
||||
}
|
||||
|
@ -6233,8 +6233,8 @@ void gainxp(lifeform_t *lf, long amt) {
|
|||
if (((lf->skillxp + amt) / amtneeded) >= 3) {
|
||||
raise(SIGINT);
|
||||
}
|
||||
lf->skillxp += amt;
|
||||
*/
|
||||
lf->skillxp += amt;
|
||||
|
||||
assert(lf->skillxp >= 0);
|
||||
while (lf->skillxp >= amtneeded) {
|
||||
|
@ -7900,6 +7900,27 @@ enum LFCONDITION getlfcondition(lifeform_t *lf) {
|
|||
return C_DEAD;
|
||||
}
|
||||
|
||||
int getlistendetectrange(lifeform_t *lf) {
|
||||
switch (getskill(lf, SK_LISTEN)) {
|
||||
default:
|
||||
case PR_INEPT:
|
||||
return 0;
|
||||
case PR_NOVICE:
|
||||
return 0;
|
||||
case PR_BEGINNER:
|
||||
return 1;
|
||||
case PR_ADEPT:
|
||||
return 2;
|
||||
case PR_SKILLED:
|
||||
return 3;
|
||||
case PR_EXPERT:
|
||||
return 4;
|
||||
case PR_MASTER:
|
||||
return 6;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// how much taller are you due to your flight?
|
||||
int getflightsizemod(lifeform_t *lf) {
|
||||
int howmuch = 0;
|
||||
|
@ -9249,7 +9270,7 @@ char *getplayernamefull(char *buf) {
|
|||
return buf;
|
||||
}
|
||||
|
||||
int getraceclass(lifeform_t *lf) {
|
||||
enum RACECLASS getraceclass(lifeform_t *lf) {
|
||||
return lf->race->raceclass->id;
|
||||
}
|
||||
|
||||
|
@ -15568,6 +15589,26 @@ void makefriendly(lifeform_t *who, int howlong) {
|
|||
|
||||
}
|
||||
|
||||
void makeheard(lifeform_t *listener, lifeform_t *noisemaker, int showglyph, char *noisetext, int howlong) {
|
||||
flag_t *f;
|
||||
f = lfhasflagval(listener, F_CANHEARLF, noisemaker->id, NA, NA, NULL);
|
||||
if (f) {
|
||||
if (f->lifetime > 0) f->lifetime = howlong;
|
||||
if (showglyph) {
|
||||
f->val[1] = B_TRUE;
|
||||
} else {
|
||||
f->val[1] = B_FALSE;
|
||||
}
|
||||
if (noisetext) {
|
||||
free(f->text);
|
||||
f->text = strdup(noisetext);
|
||||
}
|
||||
} else {
|
||||
f = addtempflag(listener->flags, F_CANHEARLF, noisemaker->id, showglyph, NA, noisetext, howlong);
|
||||
}
|
||||
if (isplayer(listener)) needredraw = B_TRUE;
|
||||
}
|
||||
|
||||
// make lf be able to learn the given skill
|
||||
// returns TRUE if we did something.
|
||||
int makelearnable(lifeform_t *lf, enum SKILL skid) {
|
||||
|
@ -16277,11 +16318,13 @@ int noise(cell_t *c, lifeform_t *noisemaker, enum NOISECLASS nclass, int volume,
|
|||
char lfname[BUFLEN];
|
||||
char distbuf[BUFLEN],distbufbad[BUFLEN];
|
||||
char dirbuf[BUFLEN];
|
||||
int detectdist = 0;
|
||||
|
||||
real_getlfnamea(noisemaker, lfname, NULL, B_NOSHOWALL, B_CURRACE);
|
||||
getdisttext(l->cell, c, distbuf, distbufbad, dirbuf);
|
||||
|
||||
slev = getskill(l, SK_LISTEN);
|
||||
detectdist = getlistendetectrange(l);
|
||||
//
|
||||
// high listen skill lets you know more info.
|
||||
//
|
||||
|
@ -16289,22 +16332,21 @@ int noise(cell_t *c, lifeform_t *noisemaker, enum NOISECLASS nclass, int volume,
|
|||
// adept = distance and direction
|
||||
// expert = monstername and distance and direction
|
||||
// master = temporary scan of where they are!
|
||||
if (slev >= PR_MASTER) {
|
||||
flag_t *f;
|
||||
f = lfhasflagval(l, F_CANHEARLF, noisemaker->id, NA, NA, NULL);
|
||||
if (f) {
|
||||
if (f->lifetime > 0) f->lifetime = 2;
|
||||
if (dist <= detectdist) {
|
||||
if (slev >= PR_EXPERT) {
|
||||
// fully id
|
||||
makeheard(l, noisemaker, B_TRUE, NULL, 2);
|
||||
} else {
|
||||
addtempflag(l->flags, F_CANHEARLF, noisemaker->id, NA, NA, NULL, 2);
|
||||
// show that you heard a sound
|
||||
makeheard(l, noisemaker, B_FALSE, textnopunc, 2);
|
||||
}
|
||||
} else if (slev >= PR_EXPERT) {
|
||||
}
|
||||
// now announce it.
|
||||
if (slev >= PR_EXPERT) {
|
||||
msg("You hear %s%s to the %s%c", lfname, distbuf, dirbuf, punc);
|
||||
rv = B_TRUE;
|
||||
} else if (slev >= PR_ADEPT) {
|
||||
msg("You hear %s%s to the %s%c", textnopunc, distbuf, dirbuf, punc);
|
||||
rv = B_TRUE;
|
||||
} else if (slev >= PR_BEGINNER) {
|
||||
msg("You hear %s%s%c", textnopunc, distbuf, punc);
|
||||
msg("You hear %s%s to the %s%c", textnopunc, distbuf, dirbuf, punc);
|
||||
rv = B_TRUE;
|
||||
} else if (slev >= PR_NOVICE) {
|
||||
msg("You hear %s%s%c", textnopunc, distbufbad, punc);
|
||||
|
@ -19453,7 +19495,7 @@ void startlfturn(lifeform_t *lf) {
|
|||
}
|
||||
|
||||
// float up into space?
|
||||
if (lf->cell->map->region->rtype->id == RG_WORLDMAP) {
|
||||
if (lf->cell->map->region->rtype->id == BH_WORLDMAP) {
|
||||
if (lfhasflag(lf, F_LEVITATING)) {
|
||||
if (isplayer(lf)) {
|
||||
msg("You float up into the sky!");
|
||||
|
@ -19682,7 +19724,7 @@ void startlfturn(lifeform_t *lf) {
|
|||
more();
|
||||
}
|
||||
}
|
||||
killflag(f);
|
||||
//killflag(f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -21928,7 +21970,7 @@ int usestairs(lifeform_t *lf, object_t *o, int onpurpose, int climb) {
|
|||
curmap = obcell->map;
|
||||
|
||||
if ((o->type->id == OT_GRATINGFLOOR) && !hasflag(o->flags, F_MAPLINK)) {
|
||||
createregionlink(curmap, obcell, o, NULL, RG_SEWER, curmap->region);
|
||||
createbranchlink(curmap, obcell, o, NULL, BH_SEWER, curmap->region);
|
||||
}
|
||||
|
||||
f = hasflag(o->flags, F_CLIMBABLE);
|
||||
|
@ -22114,7 +22156,7 @@ int usestairs(lifeform_t *lf, object_t *o, int onpurpose, int climb) {
|
|||
return B_TRUE;
|
||||
}
|
||||
|
||||
if (falling && (dir == D_DOWN) && madenewmap && (newcell->map->region->rtype->id == RG_PIT)) {
|
||||
if (falling && (dir == D_DOWN) && madenewmap && (newcell->map->region->rtype->id == BH_PIT)) {
|
||||
// you just dug downwards and made a big hole, so you
|
||||
// didn't actually fall.
|
||||
falling = B_FALSE;
|
||||
|
@ -22169,7 +22211,7 @@ int usestairs(lifeform_t *lf, object_t *o, int onpurpose, int climb) {
|
|||
} else {
|
||||
addflag(lf->flags, F_FALLDISTANCE, 1, NA, NA, NULL);
|
||||
}
|
||||
} else if (newcell->map->region->rtype->id != RG_WORLDMAP) {
|
||||
} else if (newcell->map->region->rtype->id != BH_WORLDMAP) {
|
||||
int howfar;
|
||||
if (isplayer(lf)) {
|
||||
msg("^bYou slam into the roof!");
|
||||
|
@ -23271,12 +23313,12 @@ int wear(lifeform_t *lf, object_t *o) {
|
|||
} else {
|
||||
int mindepth,maxdepth,newdepth;
|
||||
region_t *newregion;
|
||||
// TODO: add other planes here. they must be from regiontypes which ALWAYS
|
||||
// TODO: add other planes here. they must be from branchs which ALWAYS
|
||||
// exist (ie. which are created at the start of the game).
|
||||
switch (rnd(0,1)) {
|
||||
case 0:
|
||||
case 1:
|
||||
newregion = findregionbytype(RG_MAINDUNGEON);
|
||||
newregion = findregionbytype(BH_MAINDUNGEON);
|
||||
break;
|
||||
}
|
||||
// pick a new map at least 10 levels below
|
||||
|
|
4
lf.h
4
lf.h
|
@ -185,6 +185,7 @@ int getleftrightwalls(lifeform_t *lf);
|
|||
int getlfaccuracy(lifeform_t *lf, object_t *wep);
|
||||
char getlfcol(lifeform_t *lf, enum MSGCHARCOL cc);
|
||||
enum LFCONDITION getlfcondition(lifeform_t *lf);
|
||||
int getlistendetectrange(lifeform_t *lf);
|
||||
int getflightsizemod(lifeform_t *lf);
|
||||
enum SKILLLEVEL getmaxskilllevel(lifeform_t *lf, enum SKILL skid);
|
||||
int getminions(lifeform_t *lf, lifeform_t **minion, int *nminions);
|
||||
|
@ -244,7 +245,7 @@ char *getpoisondesc(enum POISONTYPE ptype);
|
|||
char *getpoisonname(enum POISONTYPE ptype);
|
||||
enum POISONSEVERITY getpoisonseverity(enum POISONTYPE ptype);
|
||||
*/
|
||||
int getraceclass(lifeform_t *lf);
|
||||
enum RACECLASS getraceclass(lifeform_t *lf);
|
||||
int getracerarity(map_t *map, enum RACE rid, enum RARITY *rr);
|
||||
object_t *getrandomarmour(lifeform_t *lf, lifeform_t *attacker);
|
||||
enum BEHAVIOUR getrandombehaviour(void);
|
||||
|
@ -380,6 +381,7 @@ int losehp_real(lifeform_t *lf, int amt, enum DAMTYPE damtype, lifeform_t *froml
|
|||
void losehpeffects(lifeform_t *lf, int dam, enum DAMTYPE damtype, lifeform_t *fromlf, object_t *fromob, int retaliate, int ko, int *waskod, int prelowhp);
|
||||
void losemp(lifeform_t *lf, int amt);
|
||||
void makefriendly(lifeform_t *lf, int howlong);
|
||||
void makeheard(lifeform_t *listener, lifeform_t *noisemaker, int showglyph, char *noisetext, int howlong);
|
||||
int makelearnable(lifeform_t *lf, enum SKILL skid);
|
||||
int makenauseated(lifeform_t *lf, int amt, int howlong);
|
||||
void makenoise(lifeform_t *lf, enum NOISETYPE nid);
|
||||
|
|
180
map.c
180
map.c
|
@ -26,7 +26,7 @@ extern map_t *firstmap,*lastmap;
|
|||
extern behaviour_t *firstbehaviour,*lastbehaviour;
|
||||
extern region_t *firstregion,*lastregion;
|
||||
extern regionoutline_t *firstregionoutline,*lastregionoutline;
|
||||
extern regiontype_t *firstregiontype,*lastregiontype;
|
||||
extern branch_t *firstbranch,*lastbranch;
|
||||
extern celltype_t *firstcelltype, *lastcelltype;
|
||||
extern objecttype_t *objecttype,*lastobjecttype;
|
||||
extern race_t *firstrace;
|
||||
|
@ -788,14 +788,14 @@ void getroomedge(map_t *map, int roomid, int minx, int miny, int maxx, int maxy,
|
|||
}
|
||||
|
||||
// if outlineid is -1, it's automatically assigned
|
||||
region_t *addregion(enum REGIONTYPE rtype, region_t *parent, int outlineid, int depthmod, int createdby) {
|
||||
region_t *addregion(enum BRANCH rtype, region_t *parent, int outlineid, int depthmod, int createdby) {
|
||||
region_t *a;
|
||||
regionoutline_t *ro,*poss[MAXCANDIDATES];
|
||||
int nposs = 0;
|
||||
int id;
|
||||
regiontype_t *rt;
|
||||
branch_t *rt;
|
||||
|
||||
rt = findregiontype(rtype);
|
||||
rt = findbranch(rtype);
|
||||
if (rt->majorbranch) {
|
||||
// check for dupes
|
||||
if (findregionbytype(rtype)) {
|
||||
|
@ -830,7 +830,7 @@ region_t *addregion(enum REGIONTYPE rtype, region_t *parent, int outlineid, int
|
|||
|
||||
// props
|
||||
a->id = id;
|
||||
a->rtype = findregiontype(rtype);
|
||||
a->rtype = findbranch(rtype);
|
||||
a->parentregion = parent;
|
||||
a->depthmod = depthmod;
|
||||
a->createdbymapid = createdby;
|
||||
|
@ -855,7 +855,7 @@ region_t *addregion(enum REGIONTYPE rtype, region_t *parent, int outlineid, int
|
|||
return a;
|
||||
}
|
||||
|
||||
regionoutline_t *addregionoutline(enum REGIONTYPE rtype) {
|
||||
regionoutline_t *addregionoutline(enum BRANCH rtype) {
|
||||
regionoutline_t *a;
|
||||
int nextid;
|
||||
|
||||
|
@ -883,7 +883,7 @@ regionoutline_t *addregionoutline(enum REGIONTYPE rtype) {
|
|||
|
||||
// props
|
||||
a->id = nextid;
|
||||
a->rtype = findregiontype(rtype);
|
||||
a->rtype = findbranch(rtype);
|
||||
a->nthings = 0;
|
||||
return a;
|
||||
}
|
||||
|
@ -915,22 +915,22 @@ regionthing_t *addregionthing(regionoutline_t *ro, int depth, int x, int y, enum
|
|||
return rt;
|
||||
}
|
||||
|
||||
regiontype_t *addregiontype(enum REGIONTYPE id, char *name, int pluralname, enum HABITAT defaulthabitat, int maxdepth, int stairsperlev, int deeperdir, int major, int depthmod, int addparentdepth) {
|
||||
regiontype_t *a;
|
||||
branch_t *addbranch(enum BRANCH id, char *name, int pluralname, enum HABITAT defaulthabitat, int maxdepth, int stairsperlev, int deeperdir, int major, int depthmod, int addparentdepth) {
|
||||
branch_t *a;
|
||||
|
||||
// add to the end of the list
|
||||
if (firstregiontype == NULL) {
|
||||
firstregiontype = malloc(sizeof(regiontype_t));
|
||||
a = firstregiontype;
|
||||
if (firstbranch == NULL) {
|
||||
firstbranch = malloc(sizeof(branch_t));
|
||||
a = firstbranch;
|
||||
a->prev = NULL;
|
||||
} else {
|
||||
// go to end of list
|
||||
a = lastregiontype;
|
||||
a->next = malloc(sizeof(regiontype_t));
|
||||
a = lastbranch;
|
||||
a->next = malloc(sizeof(branch_t));
|
||||
a->next->prev = a;
|
||||
a = a->next;
|
||||
}
|
||||
lastregiontype = a;
|
||||
lastbranch = a;
|
||||
a->next = NULL;
|
||||
|
||||
// props
|
||||
|
@ -2064,7 +2064,7 @@ void floodfill(cell_t *startcell) {
|
|||
}
|
||||
|
||||
// populates thing & nthings with all "regionthings" with:
|
||||
// whatkind == RT_REGIONLINK.
|
||||
// whatkind == RT_BRANCHLINK.
|
||||
// OR
|
||||
// whatkind = RT_HABITAT
|
||||
// ie. links to all the map branches.
|
||||
|
@ -2091,7 +2091,7 @@ int getbranchlinks(regionthing_t **thing, int *nthings, ...) {
|
|||
if (!r->outline) continue;
|
||||
for (i = 0; i < r->outline->nthings; i++ ){
|
||||
int n,ok = B_FALSE;
|
||||
// pick a random regionlink thing.
|
||||
// pick a random branchlink thing.
|
||||
temp = &r->outline->thing[i];
|
||||
|
||||
// valid ?
|
||||
|
@ -2102,11 +2102,11 @@ int getbranchlinks(regionthing_t **thing, int *nthings, ...) {
|
|||
}
|
||||
|
||||
if (ok) {
|
||||
if (temp->whatkind == RT_REGIONLINK) {
|
||||
regiontype_t *rtype;
|
||||
rtype = findregiontype(temp->value);
|
||||
if ( (rtype->id != RG_MAINDUNGEON) &&
|
||||
(rtype->id != RG_WORLDMAP)) {
|
||||
if (temp->whatkind == RT_BRANCHLINK) {
|
||||
branch_t *rtype;
|
||||
rtype = findbranch(temp->value);
|
||||
if ( (rtype->id != BH_MAINDUNGEON) &&
|
||||
(rtype->id != BH_WORLDMAP)) {
|
||||
thing[(*nthings)++] = temp;
|
||||
}
|
||||
} else if (temp->whatkind == RT_HABITAT) {
|
||||
|
@ -3819,7 +3819,7 @@ void createmap(map_t *map, int depth, region_t *region, map_t *parentmap, int ex
|
|||
habitat = region->rtype->defaulthabitat;
|
||||
|
||||
/*
|
||||
if ((region->rtype->id == RG_WORLDMAP) && (depth == 1)) {
|
||||
if ((region->rtype->id == BH_WORLDMAP) && (depth == 1)) {
|
||||
firstworldmap = B_TRUE;
|
||||
}
|
||||
*/
|
||||
|
@ -3879,7 +3879,7 @@ void createmap(map_t *map, int depth, region_t *region, map_t *parentmap, int ex
|
|||
//if (gamemode == GM_GAMESTARTED) checkallflags(player->cell->map); // debugging
|
||||
|
||||
/*
|
||||
if (map->region->rtype->id == RG_WORLDMAP) {
|
||||
if (map->region->rtype->id == BH_WORLDMAP) {
|
||||
map_t *adjmap;
|
||||
for (i = D_N; i <= D_W; i++) {
|
||||
// is there a map this dir from us???
|
||||
|
@ -3939,7 +3939,7 @@ void createmap(map_t *map, int depth, region_t *region, map_t *parentmap, int ex
|
|||
if (db) dblog(" setting map coords to %d,%d (based on parent map)",x,y);
|
||||
} else {
|
||||
// set it based on something else...
|
||||
if (region->rtype->id == RG_WORLDMAP) {
|
||||
if (region->rtype->id == BH_WORLDMAP) {
|
||||
// TODO: is this right???????????
|
||||
// find another map of this region and set it.
|
||||
for (m = firstmap ; m ; m = m->next) {
|
||||
|
@ -3987,7 +3987,7 @@ void createmap(map_t *map, int depth, region_t *region, map_t *parentmap, int ex
|
|||
);
|
||||
}
|
||||
|
||||
if ((region->rtype->id == RG_WORLDMAP) &&
|
||||
if ((region->rtype->id == BH_WORLDMAP) &&
|
||||
(region->outline->thing[i].depth == NA)) { // match on x/y coords
|
||||
if ((region->outline->thing[i].x == x) && (region->outline->thing[i].y == y)) {
|
||||
matched = B_TRUE;
|
||||
|
@ -4147,9 +4147,9 @@ void createmap(map_t *map, int depth, region_t *region, map_t *parentmap, int ex
|
|||
c = real_getrandomadjcell(c, WE_WALKABLE, B_ALLOWEXPAND, LOF_DONTNEED, NULL, NULL, NULL);
|
||||
addmonster(c, R_SPECIFIED, thing[i]->what, B_FALSE, thing[i]->value, B_TRUE, NULL);
|
||||
break;
|
||||
case RT_REGIONLINK:
|
||||
if (db) dblog(" adding regionlink");
|
||||
createregionlink(map, NULL, NULL, thing[i]->what, thing[i]->value, map->region);
|
||||
case RT_BRANCHLINK:
|
||||
if (db) dblog(" adding branchlink");
|
||||
createbranchlink(map, NULL, NULL, thing[i]->what, thing[i]->value, map->region);
|
||||
// ... don't need to do this since we know there won't be anywhere to link to.
|
||||
//linkstairs(o);
|
||||
break;
|
||||
|
@ -5542,17 +5542,17 @@ void createpit(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *e
|
|||
}
|
||||
|
||||
// only need to provide either obname _OR_ o
|
||||
void createregionlink(map_t *m, cell_t *c, object_t *o, char *obname, enum REGIONTYPE newregiontype, region_t *parent) {
|
||||
void createbranchlink(map_t *m, cell_t *c, object_t *o, char *obname, enum BRANCH newbranch, region_t *parent) {
|
||||
flag_t *f;
|
||||
region_t *r;
|
||||
int basedepth = 0;
|
||||
regiontype_t *nrt;
|
||||
nrt = findregiontype(newregiontype);
|
||||
branch_t *nrt;
|
||||
nrt = findbranch(newbranch);
|
||||
if (nrt->addparentdepth) {
|
||||
basedepth = getmapdifficulty(m);
|
||||
}
|
||||
// create a new region.
|
||||
r = addregion(newregiontype, m->region, -1, basedepth, m->id);
|
||||
r = addregion(newbranch, m->region, -1, basedepth, m->id);
|
||||
// add stairs going to the new region, if required
|
||||
if (!c) {
|
||||
c = NULL;
|
||||
|
@ -5841,9 +5841,9 @@ void dumpoutlines(void) {
|
|||
} else {
|
||||
snprintf(loctext, BUFLEN, "depth %d",rt->depth);
|
||||
}
|
||||
if (rt->whatkind == RT_REGIONLINK) {
|
||||
regiontype_t *rtype;
|
||||
rtype = findregiontype(rt->value);
|
||||
if (rt->whatkind == RT_BRANCHLINK) {
|
||||
branch_t *rtype;
|
||||
rtype = findbranch(rt->value);
|
||||
dblog(" at %s: link to %s (%s)",loctext, rtype->name, rt->what);
|
||||
} else if (rt->whatkind == RT_HABITAT) {
|
||||
habitat_t *h;
|
||||
|
@ -6018,7 +6018,7 @@ void finalisemap(map_t *map, object_t *entryob, int exitdir) {
|
|||
}
|
||||
|
||||
// special case: first dungeon level has barriers over the exit stairs
|
||||
if (map->region->rtype->id == RG_MAINDUNGEON) {
|
||||
if (map->region->rtype->id == BH_MAINDUNGEON) {
|
||||
if (c->lf) killlf(c->lf);
|
||||
addobfast(c->obpile, OT_MAGICBARRIER);
|
||||
// also clear all the cells around it to prevent reachability errors
|
||||
|
@ -6051,7 +6051,7 @@ void finalisemap(map_t *map, object_t *entryob, int exitdir) {
|
|||
}
|
||||
}
|
||||
// make sure we have at least one up stairs
|
||||
if (map->region->rtype->id != RG_WORLDMAP) {
|
||||
if (map->region->rtype->id != BH_WORLDMAP) {
|
||||
assert(findobinmap(map, upstairtype));
|
||||
}
|
||||
}
|
||||
|
@ -6521,11 +6521,11 @@ regionoutline_t *findoutline(int id) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
regiontype_t *findrandomregiontypewithname(char *name) {
|
||||
regiontype_t *rt,*poss[MAXCANDIDATES];
|
||||
branch_t *findrandombranchwithname(char *name) {
|
||||
branch_t *rt,*poss[MAXCANDIDATES];
|
||||
int nposs = 0;
|
||||
char buf[BUFLEN];
|
||||
for (rt = firstregiontype ; rt ; rt = rt->next) {
|
||||
for (rt = firstbranch ; rt ; rt = rt->next) {
|
||||
if (streq(buf, rt->name)) {
|
||||
poss[nposs++] = rt;
|
||||
}
|
||||
|
@ -6544,9 +6544,9 @@ region_t *findregion(int regionid) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// this will objviously only work for unique regiontypes like
|
||||
// this will objviously only work for unique branchs like
|
||||
// rg_worldmap and rg_firstdungeon
|
||||
region_t *findregionbytype(enum REGIONTYPE rtid) {
|
||||
region_t *findregionbytype(enum BRANCH rtid) {
|
||||
region_t *r;
|
||||
for (r = firstregion ; r ; r = r->next) {
|
||||
if (r->rtype->id == rtid) return r;
|
||||
|
@ -6562,8 +6562,8 @@ map_t *findregionmap(int regionid, int depth) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// returns the RT_REGIONLINK regionthing which links to region type rtid (eg. RG_CAVE)
|
||||
regionthing_t *findregionlink(enum REGIONTYPE rtid) {
|
||||
// returns the RT_BRANCHLINK regionthing which links to region type rtid (eg. BH_CAVE)
|
||||
regionthing_t *findbranchlink(enum BRANCH rtid) {
|
||||
region_t *r;
|
||||
regionthing_t *rt;
|
||||
int i;
|
||||
|
@ -6571,7 +6571,7 @@ regionthing_t *findregionlink(enum REGIONTYPE rtid) {
|
|||
if (!r->outline) continue;
|
||||
for (i = 0; i < r->outline->nthings; i++ ){
|
||||
rt = &r->outline->thing[i];
|
||||
if ((rt->whatkind == RT_REGIONLINK) && (rt->value == rtid)) {
|
||||
if ((rt->whatkind == RT_BRANCHLINK) && (rt->value == rtid)) {
|
||||
return rt;
|
||||
}
|
||||
}
|
||||
|
@ -6598,17 +6598,17 @@ regionthing_t *findregionthing(int id, region_t **retregion) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
regiontype_t *findregiontype(enum REGIONTYPE rtype) {
|
||||
regiontype_t *rt;
|
||||
for (rt = firstregiontype ; rt ; rt = rt->next) {
|
||||
branch_t *findbranch(enum BRANCH rtype) {
|
||||
branch_t *rt;
|
||||
for (rt = firstbranch ; rt ; rt = rt->next) {
|
||||
if (rt->id == rtype) return rt;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
regiontype_t *findregiontypebyname(char *name) {
|
||||
regiontype_t *rt;
|
||||
for (rt = firstregiontype ; rt ; rt = rt->next) {
|
||||
branch_t *findbranchbyname(char *name) {
|
||||
branch_t *rt;
|
||||
for (rt = firstbranch ; rt ; rt = rt->next) {
|
||||
if (!strcasecmp(rt->name, name)) return rt;
|
||||
}
|
||||
return NULL;
|
||||
|
@ -7283,19 +7283,19 @@ void initmap(void) {
|
|||
// name, pluralname?, defaulthab, maxdepth stairs stair major? depthmod inherit_parent_depth?
|
||||
// perlev dir
|
||||
|
||||
addregiontype(RG_BABAYAGAHUT, "Baba Yaga's Hut", B_FALSE, H_BYHUT, 0, 0, D_NONE, B_FALSE, 0, B_FALSE);
|
||||
addbranch(BH_BABAYAGAHUT, "Baba Yaga's Hut", B_FALSE, H_BYHUT, 0, 0, D_NONE, B_FALSE, 0, B_FALSE);
|
||||
|
||||
addregiontype(RG_WORLDMAP, "The Surface", B_FALSE, H_FOREST, 10, 0, D_NONE, B_TRUE, 0, B_FALSE);
|
||||
addregiontype(RG_HEAVEN, "The Realm of Gods", B_FALSE, H_HEAVEN, 1, 0, D_NONE, B_FALSE, 0, B_FALSE);
|
||||
addbranch(BH_WORLDMAP, "The Surface", B_FALSE, H_FOREST, 10, 0, D_NONE, B_TRUE, 0, B_FALSE);
|
||||
addbranch(BH_HEAVEN, "The Realm of Gods", B_FALSE, H_HEAVEN, 1, 0, D_NONE, B_FALSE, 0, B_FALSE);
|
||||
// main branches
|
||||
addregiontype(RG_MAINDUNGEON, "The Main Dungeon", B_FALSE, H_DUNGEON, 25, 3, D_DOWN, B_TRUE, 0, B_FALSE);
|
||||
addregiontype(RG_CAVE, "The Goblin Caves", B_TRUE, H_CAVE, 5, 1, D_DOWN, B_TRUE, 2, B_FALSE);
|
||||
addregiontype(RG_WOODS, "The Sylvan Woods", B_TRUE, H_FOREST, 5, 3, D_DOWN, B_TRUE, 1, B_FALSE);
|
||||
addregiontype(RG_MASTERVAULTS, "The Master Vaults", B_TRUE, H_MASTERVAULTS, 3, 1, D_DOWN, B_TRUE, 5, B_TRUE);
|
||||
addbranch(BH_MAINDUNGEON, "The Main Dungeon", B_FALSE, H_DUNGEON, 25, 3, D_DOWN, B_TRUE, 0, B_FALSE);
|
||||
addbranch(BH_CAVE, "The Goblin Caves", B_TRUE, H_CAVE, 5, 1, D_DOWN, B_TRUE, 2, B_FALSE);
|
||||
addbranch(BH_WOODS, "The Sylvan Woods", B_TRUE, H_FOREST, 5, 3, D_DOWN, B_TRUE, 1, B_FALSE);
|
||||
addbranch(BH_MASTERVAULTS, "The Master Vaults", B_TRUE, H_MASTERVAULTS, 3, 1, D_DOWN, B_TRUE, 5, B_TRUE);
|
||||
// minor branches
|
||||
addregiontype(RG_PIT, "A Pit", B_FALSE, H_PIT, 1, 1, D_DOWN, B_FALSE, 0, B_TRUE);
|
||||
addregiontype(RG_SEWER, "A Sewer", B_FALSE, H_SEWER, 1, 0, D_NONE, B_FALSE, 2, B_TRUE);
|
||||
addregiontype(RG_STOMACH, "A Stomach", B_FALSE, H_STOMACH, 1, 0, D_NONE, B_FALSE, 0, B_FALSE);
|
||||
addbranch(BH_PIT, "A Pit", B_FALSE, H_PIT, 1, 1, D_DOWN, B_FALSE, 0, B_TRUE);
|
||||
addbranch(BH_SEWER, "A Sewer", B_FALSE, H_SEWER, 1, 0, D_NONE, B_FALSE, 2, B_TRUE);
|
||||
addbranch(BH_STOMACH, "A Stomach", B_FALSE, H_STOMACH, 1, 0, D_NONE, B_FALSE, 0, B_FALSE);
|
||||
// special
|
||||
|
||||
}
|
||||
|
@ -7305,15 +7305,15 @@ void initmaplayout(void) {
|
|||
//int vx[4],vy[4];
|
||||
int i;
|
||||
int lastlevel;
|
||||
regiontype_t *rt;
|
||||
branch_t *rt;
|
||||
// MAPMAPMAPMAP
|
||||
|
||||
rt = findregiontype(RG_MAINDUNGEON);
|
||||
rt = findbranch(BH_MAINDUNGEON);
|
||||
lastlevel = rt->maxdepth;
|
||||
// region definitions (outlines)
|
||||
addregionoutline(RG_WORLDMAP);
|
||||
addregionoutline(BH_WORLDMAP);
|
||||
// link to first dungeon
|
||||
addregionthing(lastregionoutline, NA, 0, 0, RT_REGIONLINK, RG_MAINDUNGEON, "staircase going down");
|
||||
addregionthing(lastregionoutline, NA, 0, 0, RT_BRANCHLINK, BH_MAINDUNGEON, "staircase going down");
|
||||
/*
|
||||
// four villages
|
||||
for (i = 0; i < 4; i++) {
|
||||
|
@ -7341,12 +7341,12 @@ void initmaplayout(void) {
|
|||
//vx = 0; vy = -1;
|
||||
*/
|
||||
|
||||
addregionoutline(RG_MAINDUNGEON);
|
||||
addregionoutline(BH_MAINDUNGEON);
|
||||
addregionthing(lastregionoutline, 1, NA, NA, RT_RNDVAULTWITHFLAG, F_VAULTISPLAYERSTART, NULL);
|
||||
// l2-4: sylvan woods
|
||||
addregionthing(lastregionoutline, rnd(2,4), NA, NA, RT_REGIONLINK, RG_WOODS, "hollow tree leading down");
|
||||
addregionthing(lastregionoutline, rnd(2,4), NA, NA, RT_BRANCHLINK, BH_WOODS, "hollow tree leading down");
|
||||
// l2-5: goblin caves
|
||||
addregionthing(lastregionoutline, rnd(2,4), NA, NA, RT_REGIONLINK, RG_CAVE, "tunnel leading down");
|
||||
addregionthing(lastregionoutline, rnd(2,4), NA, NA, RT_BRANCHLINK, BH_CAVE, "tunnel leading down");
|
||||
// l6: jimbo's lair
|
||||
addregionthing(lastregionoutline, 6, NA, NA, RT_VAULT, NA, "jimbos_lair");
|
||||
// l7 - 10: ants nest
|
||||
|
@ -7357,13 +7357,13 @@ void initmaplayout(void) {
|
|||
addregionthing(lastregionoutline, rnd(11,14), NA, NA, RT_HABITAT, H_SWAMP, NULL);
|
||||
|
||||
// l25: last level
|
||||
addregionthing(lastregionoutline, lastlevel, NA, NA, RT_REGIONLINK, RG_MASTERVAULTS, "metal hatch leading down");
|
||||
addregionthing(lastregionoutline, lastlevel, NA, NA, RT_BRANCHLINK, BH_MASTERVAULTS, "metal hatch leading down");
|
||||
|
||||
// 1-3 fixed sewers
|
||||
addregionthing(lastregionoutline, rnd(1,25), NA, NA, RT_REGIONLINK, RG_SEWER, "drainage grate");
|
||||
addregionthing(lastregionoutline, rnd(1,25), NA, NA, RT_BRANCHLINK, BH_SEWER, "drainage grate");
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (onein(2)) {
|
||||
addregionthing(lastregionoutline, rnd(1,25), NA, NA, RT_REGIONLINK, RG_SEWER, "drainage grate");
|
||||
addregionthing(lastregionoutline, rnd(1,25), NA, NA, RT_BRANCHLINK, BH_SEWER, "drainage grate");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7378,19 +7378,19 @@ void initmaplayout(void) {
|
|||
addregionthing(lastregionoutline, rnd(20,22), NA, NA, RT_OBJECT, NA, "random building");
|
||||
addregionthing(lastregionoutline, rnd(23,25), NA, NA, RT_OBJECT, NA, "random building");
|
||||
|
||||
addregionoutline(RG_CAVE);
|
||||
addregionoutline(BH_CAVE);
|
||||
addregionthing(lastregionoutline, 5, NA, NA, RT_RNDVAULTWITHTAG, NA, "caveboss");
|
||||
|
||||
addregionoutline(RG_WOODS);
|
||||
addregionoutline(BH_WOODS);
|
||||
addregionthing(lastregionoutline, 5, NA, NA, RT_RNDVAULTWITHTAG, NA, "forestboss");
|
||||
|
||||
addregionoutline(RG_MASTERVAULTS);
|
||||
rt = findregiontype(RG_MASTERVAULTS);
|
||||
addregionoutline(BH_MASTERVAULTS);
|
||||
rt = findbranch(BH_MASTERVAULTS);
|
||||
addregionthing(lastregionoutline, rt->maxdepth, NA, NA, RT_RNDVAULTWITHTAG, NA, "shrine"); // godstone on last floor of master vaults.
|
||||
|
||||
// add initial regions
|
||||
addregion(RG_WORLDMAP, NULL, -1, 0, -1);
|
||||
addregion(RG_HEAVEN, NULL, -1, 0, -1);
|
||||
addregion(BH_WORLDMAP, NULL, -1, 0, -1);
|
||||
addregion(BH_HEAVEN, NULL, -1, 0, -1);
|
||||
}
|
||||
|
||||
int isadjacent(cell_t *src, cell_t *dst) {
|
||||
|
@ -7499,9 +7499,19 @@ int isinscanrange(cell_t *c, void **thing, char *desc, glyph_t *glyph) {
|
|||
return TT_MONSTER;
|
||||
}
|
||||
}
|
||||
if (lfhasflagval(player, F_CANHEARLF, c->lf->id, NA, NA, NULL)) {
|
||||
// can hear them using master level listen skill?
|
||||
f = lfhasflagval(player, F_CANHEARLF, c->lf->id, NA, NA, NULL);
|
||||
if (f) {
|
||||
// can hear them using listen skill?
|
||||
if (f->val[1] == B_TRUE) {
|
||||
set_scanned_glyph(TT_MONSTER, c->lf, " (heard)", desc, glyph);
|
||||
} else {
|
||||
//set_scanned_glyph(TT_MONSTER, c->lf, NULL, NULL, glyph);
|
||||
if (glyph) {
|
||||
glyph->ch = 'X';
|
||||
glyph->colour = C_GREY;
|
||||
}
|
||||
if (desc) sprintf(desc, "heard: %s", f->text);
|
||||
}
|
||||
*thing = c->lf;
|
||||
return TT_MONSTER;
|
||||
}
|
||||
|
@ -7676,7 +7686,7 @@ int isonmap(map_t *map, int x, int y) {
|
|||
}
|
||||
|
||||
int isoutdoors(map_t *m) {
|
||||
if (m->region && m->region->rtype->id == RG_WORLDMAP) {
|
||||
if (m->region && m->region->rtype->id == BH_WORLDMAP) {
|
||||
return B_TRUE;
|
||||
}
|
||||
return B_FALSE;
|
||||
|
@ -8632,7 +8642,7 @@ void unmakemap(map_t *map) {
|
|||
killflagsofid(map->flags, F_ROOMEXIT);
|
||||
// unlink stairs on adjacent maps
|
||||
unlinkstairsto(map);
|
||||
// remove regions created by regionlinks in this map.
|
||||
// remove regions created by branchlinks in this map.
|
||||
for (r = firstregion ; r ; r = nextr ){
|
||||
nextr = r->next;
|
||||
if (r->createdbymapid == map->id) {
|
||||
|
@ -8715,9 +8725,9 @@ int validateregionthing(regionthing_t *thing) {
|
|||
goterrors = B_TRUE;
|
||||
}
|
||||
break;
|
||||
case RT_REGIONLINK:
|
||||
if (!findregiontype(thing->value)) {
|
||||
dblog("Invalid regionlink to regiontype %d specified in regionthing.", thing->value);
|
||||
case RT_BRANCHLINK:
|
||||
if (!findbranch(thing->value)) {
|
||||
dblog("Invalid branchlink to branch %d specified in regionthing.", thing->value);
|
||||
goterrors = B_TRUE;
|
||||
}
|
||||
break;
|
||||
|
|
18
map.h
18
map.h
|
@ -7,10 +7,10 @@ map_t *addmap(void);
|
|||
lifeform_t *addmonster(cell_t *c, enum RACE rid, char *racename, int randomjobok, int amt, int autogen, int *nadded);
|
||||
object_t *addrandomob(cell_t *c);
|
||||
int addrandomthing(cell_t *c, int obchance, int *nadded);
|
||||
region_t *addregion(enum REGIONTYPE rtype, region_t *parent, int outlineid, int depthmod, int createdby);
|
||||
regionoutline_t *addregionoutline(enum REGIONTYPE rtype);
|
||||
region_t *addregion(enum BRANCH rtype, region_t *parent, int outlineid, int depthmod, int createdby);
|
||||
regionoutline_t *addregionoutline(enum BRANCH rtype);
|
||||
regionthing_t *addregionthing(regionoutline_t *ro, int depth, int x, int y, enum REGIONTHING whatkind, int value, char *what);
|
||||
regiontype_t *addregiontype(enum REGIONTYPE id, char *name, int pluralname, enum HABITAT defaulthabitat, int maxdepth, int stairsperlev, int deeperdir, int major, int depthmod, int addparentdepth);
|
||||
branch_t *addbranch(enum BRANCH id, char *name, int pluralname, enum HABITAT defaulthabitat, int maxdepth, int stairsperlev, int deeperdir, int major, int depthmod, int addparentdepth);
|
||||
void adjustcellglyphforlight(cell_t *c, glyph_t *col);
|
||||
int autodoors(map_t *map, int roomid, int minx, int miny, int maxx, int maxy, int doorpct, int dooropenchance);
|
||||
void breakwall(cell_t *c);
|
||||
|
@ -83,7 +83,7 @@ void createheaven(map_t *map, int depth, map_t *parentmap, int exitdir, object_t
|
|||
void createmap(map_t *map, int depth, region_t *region, map_t *parentmap, int exitdir, object_t *entryob);
|
||||
void createmastervaults(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *entryob);
|
||||
void createpit(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *entryob);
|
||||
void createregionlink(map_t *m, cell_t *c, object_t *o, char *obname, enum REGIONTYPE newregiontype, region_t *parent);
|
||||
void createbranchlink(map_t *m, cell_t *c, object_t *o, char *obname, enum BRANCH newbranch, region_t *parent);
|
||||
void createregionthing(map_t *map, regionthing_t *rt);
|
||||
void createriver(map_t *m);
|
||||
void createroom(map_t *map, int roomid, int x1, int y1, int x2, int y2, int forcewalls);
|
||||
|
@ -112,14 +112,14 @@ cell_t *findmapentrypoint(map_t *m, int side, lifeform_t *lf);
|
|||
object_t *findobidinmap(map_t *m, long id);
|
||||
cell_t *findobinmap(map_t *m, enum OBTYPE oid);
|
||||
regionoutline_t *findoutline(int id);
|
||||
regiontype_t *findrandomregiontypewithname(char *name);
|
||||
branch_t *findrandombranchwithname(char *name);
|
||||
region_t *findregion(int regionid);
|
||||
region_t *findregionbytype(enum REGIONTYPE rtid);
|
||||
regionthing_t *findregionlink(enum REGIONTYPE rtid);
|
||||
region_t *findregionbytype(enum BRANCH rtid);
|
||||
regionthing_t *findbranchlink(enum BRANCH rtid);
|
||||
map_t *findregionmap(int regionid, int depth);
|
||||
regionthing_t *findregionthing(int id, region_t **retregion);
|
||||
regiontype_t *findregiontype(enum REGIONTYPE rtype);
|
||||
regiontype_t *findregiontypebyname(char *name);
|
||||
branch_t *findbranch(enum BRANCH rtype);
|
||||
branch_t *findbranchbyname(char *name);
|
||||
room_t *findroom(map_t *m, int roomid);
|
||||
map_t *findsurfaceexitmap(map_t *m);
|
||||
void forgetcells(map_t *map, int amt);
|
||||
|
|
6
move.c
6
move.c
|
@ -70,7 +70,7 @@ int ispossiblemove(lifeform_t *lf, int dir) {
|
|||
object_t *inway = NULL;
|
||||
switch (error) {
|
||||
case E_OFFMAP:
|
||||
if (lf->cell->map->region->id == RG_WORLDMAP) {
|
||||
if (lf->cell->map->region->id == BH_WORLDMAP) {
|
||||
return B_TRUE;
|
||||
}
|
||||
break;
|
||||
|
@ -911,7 +911,7 @@ int knockback(lifeform_t *lf, int dir, int howfar, lifeform_t *pusher, int fallc
|
|||
// failed to move
|
||||
switch (reason) {
|
||||
case E_OFFMAP:
|
||||
if (lf->cell->map->region->id == RG_WORLDMAP) {
|
||||
if (lf->cell->map->region->id == BH_WORLDMAP) {
|
||||
if (!walkoffmap(lf, dir, B_FALSE)) {
|
||||
// successful
|
||||
break;
|
||||
|
@ -3046,7 +3046,7 @@ int trymove(lifeform_t *lf, int dir, int onpurpose, int strafe) {
|
|||
if (isplayer(lf)) msg("You can't climb in that direction.");
|
||||
break;
|
||||
case E_OFFMAP:
|
||||
if (lf->cell->map->region->rtype->id == RG_WORLDMAP) {
|
||||
if (lf->cell->map->region->rtype->id == BH_WORLDMAP) {
|
||||
// cope with nonorthogonal!
|
||||
// ie. ne counts as n if we are at the top.
|
||||
if (!isorthogonal(dir)) {
|
||||
|
|
10
nexus.c
10
nexus.c
|
@ -42,7 +42,7 @@ map_t *firstmap = NULL,*lastmap = NULL;
|
|||
map_t *heaven = NULL;
|
||||
region_t *firstregion = NULL,*lastregion = NULL;
|
||||
regionoutline_t *firstregionoutline = NULL,*lastregionoutline = NULL;
|
||||
regiontype_t *firstregiontype = NULL,*lastregiontype = NULL;
|
||||
branch_t *firstbranch = NULL,*lastbranch = NULL;
|
||||
knowledge_t *knowledge = NULL, *lastknowledge = NULL;
|
||||
hiddenname_t *firsthiddenname = NULL, *lasthiddenname = NULL;
|
||||
npcname_t *npcname;
|
||||
|
@ -168,7 +168,7 @@ int main(int argc, char **argv) {
|
|||
map_t *m;
|
||||
lifeform_t *l;
|
||||
// fill in gods
|
||||
r = findregionbytype(RG_HEAVEN);
|
||||
r = findregionbytype(BH_HEAVEN);
|
||||
m = findregionmap(r->id, 1);
|
||||
ngodlfs = 0;
|
||||
for (l = m->lf ; l ; l = l->next) {
|
||||
|
@ -288,20 +288,20 @@ int main(int argc, char **argv) {
|
|||
newworld = B_TRUE;
|
||||
|
||||
// create world map.
|
||||
wregion = findregionbytype(RG_WORLDMAP);
|
||||
wregion = findregionbytype(BH_WORLDMAP);
|
||||
assert(wregion);
|
||||
surfmap = addmap();
|
||||
createmap(firstmap, 1, wregion, NULL, D_NONE, NULL);
|
||||
|
||||
// create realm of gods - must do this first, so that
|
||||
// gods get created because any temples.
|
||||
hregion = findregionbytype(RG_HEAVEN);
|
||||
hregion = findregionbytype(BH_HEAVEN);
|
||||
assert(hregion);
|
||||
heaven = addmap();
|
||||
createmap(heaven, 1, hregion, NULL, D_NONE, NULL);
|
||||
|
||||
// create main dungeon
|
||||
dregion = findregionbytype(RG_MAINDUNGEON);
|
||||
dregion = findregionbytype(BH_MAINDUNGEON);
|
||||
assert(dregion);
|
||||
dmap = addmap();
|
||||
createmap(dmap, 1, dregion, firstmap, D_DOWN, NULL);
|
||||
|
|
42
objects.c
42
objects.c
|
@ -915,19 +915,19 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum
|
|||
corpserace = findracebyname(racename);
|
||||
ot = findot(OT_CORPSE);
|
||||
} else if (strstr(p, "map to ")) {
|
||||
regiontype_t *rt;
|
||||
branch_t *rt;
|
||||
char regionname[BUFLEN];
|
||||
p2 = strstr(p, "map to ");
|
||||
p2 += strlen("map to");
|
||||
p2++; // go past the space
|
||||
// grab name of region this map leads to
|
||||
strcpy(regionname, p2);
|
||||
// find the regiontype which matches this.
|
||||
// find the branch which matches this.
|
||||
// if not found, it'll be randoml selected later.
|
||||
rt = findregiontypebyname(regionname);
|
||||
rt = findbranchbyname(regionname);
|
||||
if (rt) {
|
||||
// find the regionthing ID of the RT_REGIONLINK entrance
|
||||
wantregionthing = findregionlink(rt->id);
|
||||
// find the regionthing ID of the RT_BRANCHLINK entrance
|
||||
wantregionthing = findbranchlink(rt->id);
|
||||
}
|
||||
ot = findot(OT_MAP);
|
||||
} else if (strstr(p, "statue of ")) {
|
||||
|
@ -1755,10 +1755,10 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum
|
|||
|
||||
c = getoblocation(o);
|
||||
adjmap = getmapindir(c->map, f->val[0]);
|
||||
if ((c->map->region->rtype->id == RG_WORLDMAP) && !adjmap) {
|
||||
if ((c->map->region->rtype->id == BH_WORLDMAP) && !adjmap) {
|
||||
// ie. going down from the surface, and no dungeon below.
|
||||
// ( MUST be down because holes going up make no sense! )
|
||||
createregionlink(c->map, c, o, NULL, RG_PIT, c->map->region);
|
||||
createbranchlink(c->map, c, o, NULL, BH_PIT, c->map->region);
|
||||
} else {
|
||||
// create linked holes on the map at the other end of this one.
|
||||
if (adjmap) {
|
||||
|
@ -1801,14 +1801,14 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum
|
|||
copyflag(o->flags, corpserace->flags, F_FELINE);
|
||||
} else if (o->type->id == OT_MAP) {
|
||||
region_t *srcregion;
|
||||
regiontype_t *dstrt = NULL;
|
||||
branch_t *dstrt = NULL;
|
||||
int srcdepth;
|
||||
char buf[BUFLEN];
|
||||
regionthing_t *poss[MAXCANDIDATES];
|
||||
int nposs = 0;
|
||||
// fill in map destination.
|
||||
if (!wantregionthing) {
|
||||
getbranchlinks(poss, &nposs, RT_REGIONLINK, RT_NONE);
|
||||
getbranchlinks(poss, &nposs, RT_BRANCHLINK, RT_NONE);
|
||||
|
||||
if (nposs) {
|
||||
wantregionthing = poss[rnd(0,nposs-1)];
|
||||
|
@ -1816,13 +1816,13 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum
|
|||
}
|
||||
if (dolinks) {
|
||||
if (wantregionthing) {
|
||||
// we now have the destination regionlink thing which the
|
||||
// we now have the destination branchlink thing which the
|
||||
// map will lead to.
|
||||
|
||||
// just using this to fill in srcregion
|
||||
findregionthing(wantregionthing->id, &srcregion);
|
||||
srcdepth = wantregionthing->depth;
|
||||
dstrt = findregiontype(wantregionthing->value);
|
||||
dstrt = findbranch(wantregionthing->value);
|
||||
|
||||
strcpy(buf, dstrt->name);
|
||||
makelowercase(buf);
|
||||
|
@ -6088,7 +6088,7 @@ objecttype_t *real_getrandomob(map_t *map, char *buf, int forcedepth, int forceh
|
|||
int amt;
|
||||
flag_t *f;
|
||||
int db = B_FALSE;
|
||||
int partdb = B_FALSE;
|
||||
int partdb = B_TRUE;
|
||||
char *pluralname;
|
||||
char brandname[BUFLEN];
|
||||
char cursestr[BUFLEN];
|
||||
|
@ -6350,18 +6350,18 @@ objecttype_t *real_getrandomob(map_t *map, char *buf, int forcedepth, int forceh
|
|||
if (rrmoddir == -1) {
|
||||
if (wantrr > RR_FREQUENT) {
|
||||
wantrr--;
|
||||
if (db) dblog("rarity at min/max and no obs. lowering wantrr to %d.",wantrr);
|
||||
if (db || partdb) dblog("rarity at min/max and no obs. lowering wantrr to %d.",wantrr);
|
||||
} else {
|
||||
// wantrr is already at rr_frequent
|
||||
// start increasing it now.
|
||||
wantrr = origwantrr + 1;
|
||||
rrmoddir = 1;
|
||||
if (db) dblog("rarity got below frequent. raising to original rr + 1 (%d)",wantrr);
|
||||
if (db || partdb) dblog("rarity got below frequent. raising to original rr + 1 (%d)",wantrr);
|
||||
}
|
||||
} else {
|
||||
if (wantrr < RR_VERYRARE) {
|
||||
wantrr++;
|
||||
if (db) dblog("rarity at min/max and no obs. raising wantrr to %d.",wantrr);
|
||||
if (db || partdb) dblog("rarity at min/max and no obs. raising wantrr to %d.",wantrr);
|
||||
} else {
|
||||
// give up
|
||||
strcpy(buf, "");
|
||||
|
@ -6373,7 +6373,7 @@ objecttype_t *real_getrandomob(map_t *map, char *buf, int forcedepth, int forceh
|
|||
// expand range and try again
|
||||
raritymax += 10; if (raritymax > 100) raritymax = 100;
|
||||
raritymin -= 10; if (raritymin < 0) raritymin = 0;
|
||||
if (db) dblog("no possible objects like this. trying again with rarity %d-%d\n",raritymin,raritymax);
|
||||
if (db || partdb) dblog("no possible objects like this. trying again with rarity %d-%d\n",raritymin,raritymax);
|
||||
}
|
||||
} else {
|
||||
// something found
|
||||
|
@ -6381,7 +6381,7 @@ objecttype_t *real_getrandomob(map_t *map, char *buf, int forcedepth, int forceh
|
|||
}
|
||||
} // end while !done
|
||||
|
||||
if (db) dblog("got %d possibilities.", nposs);
|
||||
if (db || partdb) dblog("got %d possibilities.", nposs);
|
||||
|
||||
// pick a random object from our possiblities
|
||||
selidx = rnd(0,nposs-1);
|
||||
|
@ -10005,7 +10005,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) {
|
|||
} else if (o->type->id == OT_ORBDUNGEONEXIT) {
|
||||
map_t *m;
|
||||
m = lf->cell->map;
|
||||
if ((m->region->rtype->id == RG_MAINDUNGEON) && (m->depth == 1)) {
|
||||
if ((m->region->rtype->id == BH_MAINDUNGEON) && (m->depth == 1)) {
|
||||
cell_t *cell[MAXCANDIDATES];
|
||||
int ncells,i;
|
||||
getradiuscells(lf->cell, 1, DT_COMPASS, B_FALSE, LOF_DONTNEED, B_TRUE, cell, &ncells, B_FALSE);
|
||||
|
@ -11445,7 +11445,7 @@ int readsomething(lifeform_t *lf, object_t *o) {
|
|||
if (isplayer(lf)) {
|
||||
region_t *srcregion = NULL;
|
||||
regionthing_t *destthing = NULL;
|
||||
regiontype_t *destregiontype = NULL;
|
||||
branch_t *destbranch = NULL;
|
||||
int srcdepth = -1, plural = B_FALSE;
|
||||
char isare[BUFLENSMALL];
|
||||
f = hasflag(o->flags, F_MAPTO);
|
||||
|
@ -11453,8 +11453,8 @@ int readsomething(lifeform_t *lf, object_t *o) {
|
|||
srcregion = findregion(f->val[0]);
|
||||
srcdepth = f->val[1];
|
||||
destthing = findregionthing(f->val[2], NULL);
|
||||
destregiontype = findregiontype(destthing->value);
|
||||
plural = destregiontype->pluralname;
|
||||
destbranch = findbranch(destthing->value);
|
||||
plural = destbranch->pluralname;
|
||||
if (plural) {
|
||||
strcpy(isare, "are");
|
||||
} else {
|
||||
|
|
4
save.c
4
save.c
|
@ -43,7 +43,7 @@ int loadall(void) {
|
|||
|
||||
if (loadsavegame()) {
|
||||
// update fixed region pointers
|
||||
heavenregion = findregionbytype(RG_HEAVEN);
|
||||
heavenregion = findregionbytype(BH_HEAVEN);
|
||||
heaven = findregionmap(heavenregion->id, 1);
|
||||
foundsavegame = B_TRUE;
|
||||
}
|
||||
|
@ -674,7 +674,7 @@ int loadregions(FILE *f) {
|
|||
if (db) dblog("Found %d regions.\n",numregions);
|
||||
for (n = 0; n < numregions; n++) {
|
||||
region_t *r;
|
||||
enum REGIONTYPE rtid;
|
||||
enum BRANCH rtid;
|
||||
int rid;
|
||||
int outlineid,parentid,nthings,createdby;
|
||||
fscanf(f, "startregion\n");
|
||||
|
|
35
spell.c
35
spell.c
|
@ -2091,9 +2091,9 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef
|
|||
region_t *r;
|
||||
// create and move to new "worm" map.
|
||||
// this map will be destroyed when you leave it.
|
||||
r = findregionbytype(RG_STOMACH);
|
||||
r = findregionbytype(BH_STOMACH);
|
||||
if (!r) {
|
||||
r = addregion(RG_STOMACH, NULL, -1, 0, user->cell->map->id);
|
||||
r = addregion(BH_STOMACH, NULL, -1, 0, user->cell->map->id);
|
||||
}
|
||||
// create stomach map
|
||||
newmap = addmap();
|
||||
|
@ -4189,12 +4189,20 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
strcpy(damstr, "a blight spell.");
|
||||
}
|
||||
losehp(targcell->lf, dam, DT_DECAY, caster, damstr);
|
||||
if (isplayer(targcell->lf)) {
|
||||
msg("A blight courses through your veins!");
|
||||
} else if (cansee(player, targcell->lf)) {
|
||||
char tname[BUFLEN];
|
||||
getlfname(targcell->lf, tname);
|
||||
msg("%s looks unwell.", tname);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
op = targcell->obpile;
|
||||
}
|
||||
// taint all objects here
|
||||
for (o = op->first ; o ; o = nexto) {
|
||||
nexto = o->next;
|
||||
if (isedible(o)) {
|
||||
if (!targcell->lf && haslos(player, targcell)) {
|
||||
char obname[BUFLEN];
|
||||
|
@ -6259,7 +6267,10 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
criticalhit(caster, target, getrandomcorebp(target, NULL), NULL, rnd(1,6), DT_SLASH);
|
||||
} else if (spellid == OT_S_GLYPHWARDING) {
|
||||
char buf[BUFLEN];
|
||||
sprintf(buf, "^g*WARD%d*^n", power/2);
|
||||
int gpower;
|
||||
gpower = power / 2;
|
||||
limit(&gpower, 1, NA);
|
||||
sprintf(buf, "^g*WARD%d*^n", gpower);
|
||||
writetextonground(caster, caster->cell, buf, power*5);
|
||||
} else if (spellid == OT_S_FLOATINGDISC) {
|
||||
lifeform_t *newlf;
|
||||
|
@ -8271,7 +8282,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
cell_t *dstcell = NULL;
|
||||
if (!isplayer(caster)) return B_TRUE;
|
||||
// ask which region to go to
|
||||
getbranchlinks(poss, &nposs, RT_REGIONLINK, RT_HABITAT, RT_NONE);
|
||||
getbranchlinks(poss, &nposs, RT_BRANCHLINK, RT_HABITAT, RT_NONE);
|
||||
if (!nposs) {
|
||||
fizzle(caster);
|
||||
return B_TRUE;
|
||||
|
@ -8281,10 +8292,10 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
|
||||
for (i = 0; i < nposs; i++) {
|
||||
char choicetext[BUFLEN];
|
||||
regiontype_t *destregiontype;
|
||||
if (poss[i]->whatkind == RT_REGIONLINK) {
|
||||
destregiontype = findregiontype(poss[i]->value);
|
||||
strcpy(choicetext, destregiontype->name);
|
||||
branch_t *destbranch;
|
||||
if (poss[i]->whatkind == RT_BRANCHLINK) {
|
||||
destbranch = findbranch(poss[i]->value);
|
||||
strcpy(choicetext, destbranch->name);
|
||||
} else if (poss[i]->whatkind == RT_HABITAT) {
|
||||
habitat_t *h;
|
||||
h = findhabitat(poss[i]->value);
|
||||
|
@ -8321,10 +8332,10 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
createmap(srcmap, depth, srcregion, NULL, D_NONE, NULL);
|
||||
}
|
||||
|
||||
if (rt->whatkind == RT_REGIONLINK) {
|
||||
if (rt->whatkind == RT_BRANCHLINK) {
|
||||
object_t *dstob = NULL;
|
||||
region_t *destregion = NULL;
|
||||
// find the regionlink object. ie. the stairs/portal which goes to
|
||||
// find the branchlink object. ie. the stairs/portal which goes to
|
||||
// the given region.
|
||||
destregion = findregionbytype(rt->value);
|
||||
dstob = findmapobwithflagval(srcmap, F_CLIMBABLE, NA, destregion->id, NA, NULL);
|
||||
|
@ -8364,7 +8375,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
prompt.maycancel = B_TRUE;
|
||||
|
||||
for (r = firstregion ; r ; r = r->next) {
|
||||
regiontype_t *rt;
|
||||
branch_t *rt;
|
||||
rt = r->rtype;
|
||||
addchoice(&prompt, ch++, rt->name, NULL, r, NULL);
|
||||
}
|
||||
|
@ -13780,7 +13791,7 @@ int spellresisted(lifeform_t *target, lifeform_t *caster, int spellid, int power
|
|||
|
||||
// cannot resist spells from gods when they are on their home plane
|
||||
if (caster && (caster->race->raceclass->id == RC_GOD)) {
|
||||
if (caster->cell && (caster->cell->map->region->rtype->id == RG_HEAVEN)) {
|
||||
if (caster->cell && (caster->cell->map->region->rtype->id == BH_HEAVEN)) {
|
||||
return B_FALSE;
|
||||
}
|
||||
}
|
||||
|
|
62
text.c
62
text.c
|
@ -975,7 +975,7 @@ void getdisttext(cell_t *src, cell_t *dst,char *distbuf, char *distbufapprox, ch
|
|||
int dist;
|
||||
int dir;
|
||||
dist = getcelldist(src, dst);
|
||||
dir = getdirtowards(src, dst, NULL, B_FALSE, DT_COMPASS);
|
||||
dir = getdirtowards(src, dst, NULL, B_FALSE, DT_ORTH);
|
||||
|
||||
if (dirbuf) {
|
||||
strcpy(dirbuf, getdirname(dir));
|
||||
|
@ -1406,19 +1406,19 @@ char *getregionname(char *buf, map_t *m, region_t *r, enum REGIONNAMEFORMAT how)
|
|||
|
||||
if ((how == RF_WITHLEVEL) && m) {
|
||||
switch (r->rtype->id) {
|
||||
case RG_CAVE:
|
||||
case BH_CAVE:
|
||||
snprintf(buf, BUFLEN, "goblin caves L%d", m->depth);
|
||||
break;
|
||||
case RG_WOODS:
|
||||
case BH_WOODS:
|
||||
snprintf(buf, BUFLEN, "sylvan woods L%d", m->depth);
|
||||
break;
|
||||
case RG_WORLDMAP:
|
||||
case BH_WORLDMAP:
|
||||
snprintf(buf, BUFLEN, "the surface(%d,%d)",x,y);
|
||||
break;
|
||||
case RG_MAINDUNGEON:
|
||||
case BH_MAINDUNGEON:
|
||||
snprintf(buf, BUFLEN, "dungeon L%d", m->depth);
|
||||
break;
|
||||
case RG_MASTERVAULTS:
|
||||
case BH_MASTERVAULTS:
|
||||
if (m->depth == 1) {
|
||||
snprintf(buf, BUFLEN, "outer vault");
|
||||
} if (m->depth == 2) {
|
||||
|
@ -1427,37 +1427,37 @@ char *getregionname(char *buf, map_t *m, region_t *r, enum REGIONNAMEFORMAT how)
|
|||
snprintf(buf, BUFLEN, "master vault");
|
||||
}
|
||||
break;
|
||||
case RG_HEAVEN:
|
||||
case BH_HEAVEN:
|
||||
snprintf(buf, BUFLEN, "the realm of gods");
|
||||
break;
|
||||
case RG_PIT:
|
||||
case BH_PIT:
|
||||
snprintf(buf, BUFLEN, "a pit L%d", m->depth);
|
||||
break;
|
||||
case RG_SEWER:
|
||||
case BH_SEWER:
|
||||
snprintf(buf, BUFLEN, "a sewer L%d", m->depth);
|
||||
break;
|
||||
case RG_STOMACH:
|
||||
case BH_STOMACH:
|
||||
snprintf(buf, BUFLEN, "a stomach");
|
||||
break;
|
||||
case RG_BABAYAGAHUT:
|
||||
case BH_BABAYAGAHUT:
|
||||
snprintf(buf, BUFLEN, "baba yaga's hut");
|
||||
break;
|
||||
}
|
||||
} else if ((how == RF_LONG) && m) {
|
||||
switch (r->rtype->id) {
|
||||
case RG_CAVE:
|
||||
case BH_CAVE:
|
||||
snprintf(buf, BUFLEN, "on level %d of the goblin caves", m->depth);
|
||||
break;
|
||||
case RG_WOODS:
|
||||
case BH_WOODS:
|
||||
snprintf(buf, BUFLEN, "on level %d of the sylvan woods", m->depth);
|
||||
break;
|
||||
case RG_WORLDMAP:
|
||||
case BH_WORLDMAP:
|
||||
snprintf(buf, BUFLEN, "on the surface(%d,%d)",x,y);
|
||||
break;
|
||||
case RG_MAINDUNGEON:
|
||||
case BH_MAINDUNGEON:
|
||||
snprintf(buf, BUFLEN, "on level %d of the dungeon", m->depth);
|
||||
break;
|
||||
case RG_MASTERVAULTS:
|
||||
case BH_MASTERVAULTS:
|
||||
if (m->depth == 1) {
|
||||
snprintf(buf, BUFLEN, "in the outer vault");
|
||||
} if (m->depth == 2) {
|
||||
|
@ -1466,52 +1466,52 @@ char *getregionname(char *buf, map_t *m, region_t *r, enum REGIONNAMEFORMAT how)
|
|||
snprintf(buf, BUFLEN, "in the master vault");
|
||||
}
|
||||
break;
|
||||
case RG_HEAVEN:
|
||||
case BH_HEAVEN:
|
||||
snprintf(buf, BUFLEN, "in the realm of gods");
|
||||
break;
|
||||
case RG_PIT:
|
||||
case BH_PIT:
|
||||
snprintf(buf, BUFLEN, "in a pit");
|
||||
break;
|
||||
case RG_SEWER:
|
||||
case BH_SEWER:
|
||||
snprintf(buf, BUFLEN, "in a sewer");
|
||||
break;
|
||||
case RG_STOMACH:
|
||||
case BH_STOMACH:
|
||||
snprintf(buf, BUFLEN, "inside a worm's stomach"); // TODO: " in a stomach of of xxx"
|
||||
break;
|
||||
case RG_BABAYAGAHUT:
|
||||
case BH_BABAYAGAHUT:
|
||||
snprintf(buf, BUFLEN, "in baba yaga's hut");
|
||||
break;
|
||||
}
|
||||
} else { // ie. RF_SHORT
|
||||
switch (r->rtype->id) {
|
||||
case RG_CAVE:
|
||||
case BH_CAVE:
|
||||
strcpy(buf, "the goblin caves");
|
||||
break;
|
||||
case RG_WOODS:
|
||||
case BH_WOODS:
|
||||
strcpy(buf, "the sylvan woods");
|
||||
break;
|
||||
case RG_WORLDMAP:
|
||||
case BH_WORLDMAP:
|
||||
strcpy(buf, "the surface");
|
||||
break;
|
||||
case RG_MAINDUNGEON:
|
||||
case BH_MAINDUNGEON:
|
||||
strcpy(buf, "the dungeon");
|
||||
break;
|
||||
case RG_MASTERVAULTS:
|
||||
case BH_MASTERVAULTS:
|
||||
snprintf(buf, BUFLEN, "the master vaults");
|
||||
break;
|
||||
case RG_HEAVEN:
|
||||
case BH_HEAVEN:
|
||||
snprintf(buf, BUFLEN, "the realm of gods");
|
||||
break;
|
||||
case RG_PIT:
|
||||
case BH_PIT:
|
||||
snprintf(buf, BUFLEN, "a pit");
|
||||
break;
|
||||
case RG_SEWER:
|
||||
case BH_SEWER:
|
||||
snprintf(buf, BUFLEN, "a sewer");
|
||||
break;
|
||||
case RG_STOMACH:
|
||||
case BH_STOMACH:
|
||||
snprintf(buf, BUFLEN, "a stomach");
|
||||
break;
|
||||
case RG_BABAYAGAHUT:
|
||||
case BH_BABAYAGAHUT:
|
||||
snprintf(buf, BUFLEN, "baba yaga's hut");
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue