- [+] Remove or disable old code:

- [+] shopkeepers
    - [+] remove F_SHOPITEM - this was used for old shop code.
    - [+] "shop" vaults
    - [+] village map (but leave the habitat for use in bazaar vault
          etc)
- [+] vault: support for random monsters - use "random" for name
- [+] vault flag: f_monsstayinvault
- [+] vaults for goblin caves
    - [+] pool of water
    - [+] small hut
    - [+] brick wall
- [+] trapped corridor
- [+] pranksters dust (makes everyone invisible)
- [+] allow c_random for animations
- [+] random chance of different kind of wallfloor when creating
      dungeons
    - [+] brick wall (slightly weeaker, orange/red)
    - [+] metal wall
    - [+] wood ??
    - [+] instead of using map->habitat->solidcelltype, use
          getsolidcelltype(map)
        - [+] this checks map for f_solidcelltype
        - [+] if not there, uses map->habitat->solidcelltype.
    - [+] vaults should be able to inherit empty/solid types from map
        - [+] x:cell:EMPTY
This commit is contained in:
Rob Pearce 2012-02-07 23:28:48 +00:00
parent 22c316437e
commit d876d30d70
41 changed files with 268 additions and 108 deletions

4
ai.c
View File

@ -731,6 +731,7 @@ int ai_bored(lifeform_t *lf, lifeform_t *master, int icanattack) {
} }
// shopkeepers will return to their shops // shopkeepers will return to their shops
/*
if (hasjob(lf, J_SHOPKEEPER)) { if (hasjob(lf, J_SHOPKEEPER)) {
f = lfhasflag(lf, F_OWNSSHOP); f = lfhasflag(lf, F_OWNSSHOP);
if (f) { if (f) {
@ -748,6 +749,7 @@ int ai_bored(lifeform_t *lf, lifeform_t *master, int icanattack) {
} }
} }
} }
*/
if (!lfhasflag(lf, F_STUNNED)) { if (!lfhasflag(lf, F_STUNNED)) {
lifeform_t *hateposs[MAXCANDIDATES],*poss[MAXCANDIDATES]; lifeform_t *hateposs[MAXCANDIDATES],*poss[MAXCANDIDATES];
@ -1829,9 +1831,11 @@ int aipickupok(lifeform_t *lf, object_t *o) {
return B_TRUE; return B_TRUE;
} }
/*
if (hasflag(o->flags, F_SHOPITEM)) { if (hasflag(o->flags, F_SHOPITEM)) {
return B_FALSE; return B_FALSE;
} }
*/
if (isedible(o)) { if (isedible(o)) {
if (caneat(lf, o) && !isinbattle(lf, B_FALSE)) { if (caneat(lf, o) && !isinbattle(lf, B_FALSE)) {

37
data.c
View File

@ -856,6 +856,7 @@ void initjobs(void) {
addflag(lastjob->flags, F_CASTCHANCE, 30, NA, NA, NULL); addflag(lastjob->flags, F_CASTCHANCE, 30, NA, NA, NULL);
// non-player jobs // non-player jobs
/*
addjob(J_SHOPKEEPER, "Shopkeeper", "Shopkeepers make a living by selling goods to others. Always wary of thieves, most of them keep a shotgun under the counter."); addjob(J_SHOPKEEPER, "Shopkeeper", "Shopkeepers make a living by selling goods to others. Always wary of thieves, most of them keep a shotgun under the counter.");
addflag(lastjob->flags, F_NOPLAYER, B_TRUE, NA, NA, NULL); addflag(lastjob->flags, F_NOPLAYER, B_TRUE, NA, NA, NULL);
addflag(lastjob->flags, F_STARTATT, A_IQ, AT_AVERAGE, NA, NULL); addflag(lastjob->flags, F_STARTATT, A_IQ, AT_AVERAGE, NA, NULL);
@ -863,6 +864,7 @@ void initjobs(void) {
addflag(lastjob->flags, F_STARTOB, 100, NA, NA, "shotgun"); addflag(lastjob->flags, F_STARTOB, 100, NA, NA, "shotgun");
addflag(lastjob->flags, F_STARTOB, 100, NA, NA, "5-10 bullets"); addflag(lastjob->flags, F_STARTOB, 100, NA, NA, "5-10 bullets");
addflag(lastjob->flags, F_WANTS, OT_GOLD, NA, NA, NULL); addflag(lastjob->flags, F_WANTS, OT_GOLD, NA, NA, NULL);
*/
} }
void initobjects(void) { void initobjects(void) {
@ -1960,17 +1962,6 @@ void initobjects(void) {
addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_POWDER, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_POWDER, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_FEELTEXT, NA, NA, NA, "some ash"); addflag(lastot->flags, F_FEELTEXT, NA, NA, NA, "some ash");
addot(OT_ASHEXPLODE, "pile of exploding powder", "A pile of ash.", MT_STONE, 0.1, OC_ROCK, SZ_TINY);
addflag(lastot->flags, F_GLYPH, NA, ',', NA, NULL);
addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, "");
addflag(lastot->flags, F_EXPLODEONDAM, NA, NA, NA, "1d6");
addflag(lastot->flags, F_RARITY, H_DUNGEON, 70, RR_RARE, "");
addflag(lastot->flags, F_RARITY, H_CAVE, 100, RR_UNCOMMON, NULL);
addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_POWDER, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_HASHIDDENNAME, B_TRUE, NA, NA, "pile of ash");
addflag(lastot->flags, F_FEELTEXT, NA, NA, NA, "some ash");
addflag(lastot->flags, F_VALUE, 100, NA, NA, NULL);
addot(OT_ASHCONCEAL, "pile of concealing powder", "A pile of ash.", MT_STONE, 0.1, OC_ROCK, SZ_TINY); addot(OT_ASHCONCEAL, "pile of concealing powder", "A pile of ash.", MT_STONE, 0.1, OC_ROCK, SZ_TINY);
addflag(lastot->flags, F_GLYPH, NA, ',', NA, NULL); addflag(lastot->flags, F_GLYPH, NA, ',', NA, NULL);
addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, ""); addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, "");
@ -1982,6 +1973,28 @@ void initobjects(void) {
addflag(lastot->flags, F_FEELTEXT, NA, NA, NA, "some ash"); addflag(lastot->flags, F_FEELTEXT, NA, NA, NA, "some ash");
addflag(lastot->flags, F_AIFLEEITEM, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_AIFLEEITEM, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_VALUE, 80, NA, NA, NULL); addflag(lastot->flags, F_VALUE, 80, NA, NA, NULL);
addot(OT_ASHEXPLODE, "pile of exploding powder", "A pile of ash.", MT_STONE, 0.1, OC_ROCK, SZ_TINY);
addflag(lastot->flags, F_GLYPH, NA, ',', NA, NULL);
addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, "");
addflag(lastot->flags, F_EXPLODEONDAM, NA, NA, NA, "1d6");
addflag(lastot->flags, F_RARITY, H_DUNGEON, 70, RR_RARE, "");
addflag(lastot->flags, F_RARITY, H_CAVE, 100, RR_UNCOMMON, NULL);
addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_POWDER, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_HASHIDDENNAME, B_TRUE, NA, NA, "pile of ash");
addflag(lastot->flags, F_FEELTEXT, NA, NA, NA, "some ash");
addflag(lastot->flags, F_VALUE, 100, NA, NA, NULL);
addot(OT_ASHINVIS, "pile of prankster's dust", "A pile of ash.", MT_STONE, 0.1, OC_ROCK, SZ_TINY);
addflag(lastot->flags, F_GLYPH, NA, ',', NA, NULL);
addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, "");
addflag(lastot->flags, F_RARITY, H_DUNGEON, 70, RR_RARE, "");
addflag(lastot->flags, F_RARITY, H_CAVE, 70, RR_RARE, "");
addflag(lastot->flags, F_NOBLESS, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_POWDER, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_HASHIDDENNAME, B_TRUE, NA, NA, "pile of ash");
addflag(lastot->flags, F_FEELTEXT, NA, NA, NA, "some ash");
addflag(lastot->flags, F_AIFLEEITEM, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_VALUE, 100, NA, NA, NULL);
addot(OT_ASHSLEEP, "pile of sleeping powder", "A pile of ash.", MT_STONE, 0.1, OC_ROCK, SZ_TINY); addot(OT_ASHSLEEP, "pile of sleeping powder", "A pile of ash.", MT_STONE, 0.1, OC_ROCK, SZ_TINY);
addflag(lastot->flags, F_GLYPH, NA, ',', NA, NULL); addflag(lastot->flags, F_GLYPH, NA, ',', NA, NULL);
addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, ""); addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, "");
@ -5097,7 +5110,7 @@ void initobjects(void) {
addot(OT_FIREPLACE, "brazier", "A heavy iron bowl filled with fire.", MT_METAL, 200, OC_FURNITURE, SZ_LARGE); addot(OT_FIREPLACE, "brazier", "A heavy iron bowl filled with fire.", MT_METAL, 200, OC_FURNITURE, SZ_LARGE);
addflag(lastot->flags, F_RARITY, H_DUNGEON, 100, RR_COMMON, NULL); addflag(lastot->flags, F_RARITY, H_DUNGEON, 100, RR_COMMON, NULL);
addflag(lastot->flags, F_RARITY, H_CAVE, 100, RR_RARE, NULL); addflag(lastot->flags, F_RARITY, H_CAVE, 100, RR_UNCOMMON, NULL);
addflag(lastot->flags, F_GLYPH, C_RED, '\\', NA, NULL); addflag(lastot->flags, F_GLYPH, C_RED, '\\', NA, NULL);
addflag(lastot->flags, F_PRODUCESLIGHT, 6, NA, IFACTIVE, NULL); addflag(lastot->flags, F_PRODUCESLIGHT, 6, NA, IFACTIVE, NULL);
addflag(lastot->flags, F_NOPICKUP, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_NOPICKUP, B_TRUE, NA, NA, NULL);

View File

@ -10,7 +10,7 @@
@legend @legend
.:cell:carpetted floor .:cell:carpetted floor
#:cell:rock wall #:cell:SOLID
b:ob:wooden bed b:ob:wooden bed
t:ob:wooden table t:ob:wooden table
a:ob:armour rack a:ob:armour rack

View File

@ -10,7 +10,7 @@ O......B.#
@end @end
@legend @legend
#:cell:rock wall #:cell:SOLID
O:ob:boulder O:ob:boulder
O:exit O:exit
B:mon:grizzly bear B:mon:grizzly bear
@ -20,6 +20,7 @@ B:mon:grizzly bear
scatter(3,1,-4,-2) ob:random food:5-10 scatter(3,1,-4,-2) ob:random food:5-10
scatter(3,1,-4,-2) mon:bear cub:1-3:50 scatter(3,1,-4,-2) mon:bear cub:1-3:50
goesin:dungeon goesin:dungeon
goesin:cave
mayrotate mayrotate
rarity:uncommon rarity:uncommon
maintainedge maintainedge

View File

@ -12,7 +12,7 @@
@end @end
@legend @legend
#:cell:rock wall #:cell:metal wall
f:ob:wooden footstool f:ob:wooden footstool
f:mon:goblin king f:mon:goblin king
a:mon:goblin archer a:mon:goblin archer

View File

@ -14,7 +14,7 @@
@end @end
@legend @legend
#:cell:rock wall #:cell:metal wall
f:ob:wooden footstool f:ob:wooden footstool
f:mon:red wyrmling f:mon:red wyrmling
w:ob:goblin corpse w:ob:goblin corpse

View File

@ -7,7 +7,7 @@
@end @end
@legend @legend
#:cell:rock wall #:cell:SOLID
m:mon:sleeping random m:mon:sleeping random
+:ob:locked iron gate +:ob:locked iron gate
@end @end

View File

@ -12,7 +12,7 @@
@end @end
@legend @legend
#:cell:rock wall #:cell:SOLID
+:ob:wooden door +:ob:wooden door
+:exit +:exit
@end @end

View File

@ -13,7 +13,7 @@
########### ###########
@end @end
@legend @legend
#:cell:rock wall #:cell:SOLID
@end @end
@flags @flags

View File

@ -8,7 +8,7 @@ x._.x
@end @end
@legend @legend
#:cell:rock wall #:cell:SOLID
_:ob:fountain:50 _:ob:fountain:50
s:ob:statue: s:ob:statue:
x:exit x:exit

View File

@ -12,7 +12,7 @@
@end @end
@legend @legend
#:cell:rock wall #:cell:SOLID
X:exit X:exit
@end @end

View File

@ -11,7 +11,7 @@ gggwwwggg
@end @end
@legend @legend
#:cell:rock wall #:cell:SOLID
g:cell:glass wall g:cell:glass wall
w:ob:very deep water:100 w:ob:very deep water:100
@end @end

View File

@ -8,7 +8,7 @@ x.G#
@end @end
@legend @legend
#:cell:rock wall #:cell:SOLID
G:cell:glass wall G:cell:glass wall
x:exit x:exit
@end @end

View File

@ -9,7 +9,7 @@
@end @end
@legend @legend
#:cell:rock wall #:cell:SOLID
|:cell:glass wall |:cell:glass wall
@end @end

View File

@ -11,7 +11,7 @@
@end @end
@legend @legend
#:cell:rock wall #:cell:metal wall
+:ob:locked iron door +:ob:locked iron door
+:exit +:exit
g:ob:Godstone of Justice g:ob:Godstone of Justice

View File

@ -1,19 +1,17 @@
@id:island @id:island
@map @map
############ ..........
#..........# ...wwww...
#...wwww...# ..wwwwww..
#..wwwwww..# ..wwccww..
#..wwccww..# ..wwccww..
#..wwccww..# ..wwwwww..
#..wwwwww..# ...wwww...
#...wwww...# ..........
#..........#
############
@end @end
@legend @legend
#:cell:rock wall #:cell:SOLID
w:cell:low rock floor w:cell:low rock floor
w:ob:very deep water w:ob:very deep water
c:ob:chest c:ob:chest

View File

@ -12,7 +12,7 @@ X......@>|,#
@end @end
@legend @legend
#:cell:rock wall #:cell:SOLID
|:ob:locked iron gate |:ob:locked iron gate
,:ob:1-4 bones:50 ,:ob:1-4 bones:50
,:mon:prisoner:50 ,:mon:prisoner:50

View File

@ -9,7 +9,7 @@
########## ##########
@end @end
@legend @legend
#:cell:rock wall #:cell:SOLID
|:ob:iron gate |:ob:iron gate
,:ob:1-4 bones:50 ,:ob:1-4 bones:50
+:ob:wooden door +:ob:wooden door

View File

@ -11,7 +11,7 @@
###x### ###x###
@end @end
@legend @legend
#:cell:rock wall #:cell:SOLID
-:ob:iron gate -:ob:iron gate
p:ob:playerstart p:ob:playerstart
x:exit x:exit

View File

@ -11,7 +11,7 @@
######### #########
@end @end
@legend @legend
#:cell:rock wall #:cell:SOLID
I:cell:glass wall I:cell:glass wall
,:ob:4-8 pieces of broken glass ,:ob:4-8 pieces of broken glass
p:ob:playerstart p:ob:playerstart

View File

@ -11,7 +11,7 @@ x._.p._.x
####x#### ####x####
@end @end
@legend @legend
#:cell:rock wall #:cell:SOLID
w:cell:low rock floor w:cell:low rock floor
w:ob:very deep water w:ob:very deep water
_:cell:wood floor _:cell:wood floor

View File

@ -9,7 +9,7 @@
####### #######
@end @end
@legend @legend
#:cell:rock wall #:cell:SOLID
p:ob:playerstart p:ob:playerstart
x:exit x:exit
@end @end

View File

@ -11,7 +11,7 @@
###### ######
@end @end
@legend @legend
#:cell:rock wall #:cell:SOLID
p:ob:playerstart p:ob:playerstart
x:exit x:exit
@end @end

View File

@ -11,7 +11,7 @@
##+###+## ##+###+##
@end @end
@legend @legend
#:cell:rock wall #:cell:SOLID
p:ob:playerstart p:ob:playerstart
p:ob:fountain p:ob:fountain
f:ob:fountain f:ob:fountain

View File

@ -24,5 +24,6 @@ scatter(2,1,-2,-2) ob:furniture:1-4
norandom norandom
mayrotate mayrotate
margin:3,3 margin:3,3
monstersstay
@end @end

View File

@ -11,7 +11,7 @@
@end @end
@legend @legend
#:cell:rock wall #:cell:SOLID
~:cell:low rock floor ~:cell:low rock floor
~:ob:very deep water ~:ob:very deep water
@end @end

View File

@ -10,7 +10,7 @@ x.###.x
@end @end
@legend @legend
#:cell:rock wall #:cell:SOLID
x:exit x:exit
@end @end

View File

@ -8,7 +8,7 @@
@end @end
@legend @legend
#:cell:rock wall #:cell:SOLID
p:ob:tree p:ob:tree
_:ob:holy circle _:ob:holy circle
@end @end

View File

@ -6,7 +6,7 @@
@end @end
@legend @legend
#:cell:rock wall #:cell:SOLID
+:ob:wooden door +:ob:wooden door
+:exit +:exit
o:ob:random tool o:ob:random tool

View File

@ -6,7 +6,7 @@
@end @end
@legend @legend
#:cell:rock wall #:cell:SOLID
+:ob:wooden door +:ob:wooden door
+:exit +:exit
o:ob:random technology o:ob:random technology

View File

@ -7,7 +7,7 @@
@end @end
@legend @legend
#:cell:rock wall #:cell:SOLID
X:exit X:exit
@end @end

23
defs.h
View File

@ -35,7 +35,7 @@
#define DEF_SCREENH 24 #define DEF_SCREENH 24
#define DEF_RAGETIME 10 #define DEF_RAGETIME 10
#define DEF_SHOPIDENTPRICE (50) // cost to identify a just-purchased item //#define DEF_SHOPIDENTPRICE (50) // cost to identify a just-purchased item
#define DEF_VAULTMARGIN (3) #define DEF_VAULTMARGIN (3)
#define DEF_VISRANGE (9) #define DEF_VISRANGE (9)
@ -411,6 +411,7 @@ enum SHOPACTION {
// ncurses colours // ncurses colours
#define C_NONE (-1) #define C_NONE (-1)
enum COLOUR { enum COLOUR {
C_RANDOM = -1,
C_BLACK = 0, C_BLACK = 0,
C_RED = 1, C_RED = 1,
C_GREEN = 2, C_GREEN = 2,
@ -429,6 +430,10 @@ enum COLOUR {
C_BOLDGREEN = 14, C_BOLDGREEN = 14,
C_DARKGREY = 15, C_DARKGREY = 15,
}; };
#define C_FIRST C_RED
#define C_LAST C_DARKGREY
#define BLACKBG 0 #define BLACKBG 0
#define BLUEBG 16 #define BLUEBG 16
#define GREENBG 32 #define GREENBG 32
@ -719,12 +724,12 @@ enum CELLTYPE {
CT_NONE = 0, CT_NONE = 0,
// walls // walls
CT_WALL, CT_WALL,
CT_WALLBRICK,
CT_WALLDIRT, CT_WALLDIRT,
CT_WALLFLESH, CT_WALLFLESH,
CT_WALLGLASS, CT_WALLGLASS,
CT_WALLMETAL, CT_WALLMETAL,
CT_WALLWOOD, CT_WALLWOOD,
CT_ROOMWALL,
// empty // empty
CT_CORRIDOR, CT_CORRIDOR,
CT_DIRT, CT_DIRT,
@ -739,8 +744,6 @@ enum CELLTYPE {
CT_LOOPCORRIDOR, CT_LOOPCORRIDOR,
CT_LOWFLOOR, CT_LOWFLOOR,
CT_VLOWFLOOR, CT_VLOWFLOOR,
// rooms
CT_ROOM,
}; };
enum SPELLSCHOOL { enum SPELLSCHOOL {
@ -1091,7 +1094,7 @@ enum JOB {
J_PIRATE, J_PIRATE,
J_PRINCE, J_PRINCE,
J_ROGUE, J_ROGUE,
J_SHOPKEEPER, //J_SHOPKEEPER,
J_WIZARD, J_WIZARD,
}; };
#define J_RANDOM J_NONE #define J_RANDOM J_NONE
@ -1198,6 +1201,7 @@ enum OBTYPE {
OT_ASH, OT_ASH,
OT_ASHEXPLODE, OT_ASHEXPLODE,
OT_ASHCONCEAL, OT_ASHCONCEAL,
OT_ASHINVIS,
OT_ASHSLEEP, OT_ASHSLEEP,
OT_GEMOFSEEING, OT_GEMOFSEEING,
// gems // gems
@ -2071,6 +2075,8 @@ enum FLAG {
F_NEWWATERDEPTH, // temp flag for the spread of f_deepwater obs. F_NEWWATERDEPTH, // temp flag for the spread of f_deepwater obs.
// v0+1 are x/y, v2 is new depth. // v0+1 are x/y, v2 is new depth.
F_STOMACHOF, // this map is the stomach of lf id V0, name = f->text F_STOMACHOF, // this map is the stomach of lf id V0, name = f->text
F_CELLTYPESOLID, // use celltype v0 for solid cells (walls)
F_CELLTYPEEMPTY, // use celltype v0 for empty cells (corridors/rooms)
// object flags // object flags
F_BADOBJECT, // this object is dangerous. ie. potion of poison, F_BADOBJECT, // this object is dangerous. ie. potion of poison,
// potion of sleep, etc. // potion of sleep, etc.
@ -2112,7 +2118,7 @@ enum FLAG {
F_FEELTEXT, // when blind, show "you can feel"+f->text F_FEELTEXT, // when blind, show "you can feel"+f->text
// for items in shops // for items in shops
F_VENDITEM, // causes vending machine to show this item as identified F_VENDITEM, // causes vending machine to show this item as identified
F_SHOPITEM, // v0 is object value. //F_SHOPITEM, // v0 is object value.
// v1 is the shop it is from // v1 is the shop it is from
// causes shops to show (worth $xx) after the ob's name. // causes shops to show (worth $xx) after the ob's name.
// also used for detecting theft! // also used for detecting theft!
@ -2761,7 +2767,7 @@ enum FLAG {
// vanish. // vanish.
// v1 is lifetime left. this decrements each turn. // v1 is lifetime left. this decrements each turn.
// when at zero, lf vanishes. // when at zero, lf vanishes.
F_OWNSSHOP, // v0 is roomid of the shop which this shopkeeper owns. //F_OWNSSHOP, // v0 is roomid of the shop which this shopkeeper owns.
F_GUARD, // this lf is a guard, who can be called by shopkeepers F_GUARD, // this lf is a guard, who can be called by shopkeepers
F_HATESALL, // lf will attack ALL other lfs on sight F_HATESALL, // lf will attack ALL other lfs on sight
F_HATESRACE, // lf will attack lfs with race=v0 or baseid=v0 on F_HATESRACE, // lf will attack lfs with race=v0 or baseid=v0 on
@ -3147,6 +3153,7 @@ enum FLAG {
// marked as exits. // marked as exits.
F_NORANDOM, // this vault does not randomly appear F_NORANDOM, // this vault does not randomly appear
// OR this spell doesn't apear in books // OR this spell doesn't apear in books
F_MONSTERSSTAY, // monsters in this vault won't leave it
F_VAULTATOB, // v0/1=x/y, v2=pctchance, text=obname F_VAULTATOB, // v0/1=x/y, v2=pctchance, text=obname
F_VAULTATLF, // v0/1=x/y, v2=pctchance, text=lfname F_VAULTATLF, // v0/1=x/y, v2=pctchance, text=lfname
F_VAULTATCELL, // v0/1=x/y, v2=pctchance, text=cellname F_VAULTATCELL, // v0/1=x/y, v2=pctchance, text=cellname
@ -3161,7 +3168,7 @@ enum FLAG {
// can be repeated multiple times // can be repeated multiple times
// if a vault doesnt have this flag, it can go anywhere // if a vault doesnt have this flag, it can go anywhere
F_VAULTISPLAYERSTART, // player can start in this vault F_VAULTISPLAYERSTART, // player can start in this vault
F_VAULTISSHOP, // this vault is a shop, so add f_shopitem to objects //F_VAULTISSHOP, // this vault is a shop, so add f_shopitem to objects
// here. // here.
F_VAULTISSHRINE, // this vault is a godstone shrine F_VAULTISSHRINE, // this vault is a godstone shrine
F_VAULTRARITY, // v0=rr_xxx F_VAULTRARITY, // v0=rr_xxx

View File

@ -10,6 +10,8 @@ General format:
k:mon:kobold k:mon:kobold
s:ob:50:short sword s:ob:50:short sword
#:cell:stone wall #:cell:stone wall
#:cell:EMPTY
#:cell:SOLID
@end @end
@flags @flags
... ...
@ -46,7 +48,7 @@ Flags can be:
- a range (x-y) - a range (x-y)
- a pct of the total region cells (x%) - a pct of the total region cells (x%)
coords can be negative ("count back from right/bottom") coords can be negative ("count back from right/bottom")
pct is optional pct is optional (chance of this happening)
autodoors:pct // automatically add at least one door to the edges of autodoors:pct // automatically add at least one door to the edges of
// this room. // this room.
@ -89,8 +91,7 @@ Flags can be:
// outline. // outline.
shrine // } shrine // }
shop // } this vault is a shop/shrine/etc stomach // } this vault is a shrine/etc
stomach // }
tag:xxxx // add tag "xxx" to vault(for use with rndvaultwithtag) tag:xxxx // add tag "xxx" to vault(for use with rndvaultwithtag)

13
io.c
View File

@ -232,6 +232,7 @@ void anim(cell_t *src, cell_t *dst, char ch, int colour) {
updateviewfor(cell); updateviewfor(cell);
drawlevelfor(player); drawlevelfor(player);
// draw char & cursor at its current pos... // draw char & cursor at its current pos...
if (colour == C_RANDOM) gl.colour = rnd(C_FIRST, C_LAST);
drawglyph(&gl, cell->x - viewx, cell->y - viewy); drawglyph(&gl, cell->x - viewx, cell->y - viewy);
//mvwprintw(gamewin, cell->y - viewy, cell->x - viewx, "%c", gl.ch); //mvwprintw(gamewin, cell->y - viewy, cell->x - viewx, "%c", gl.ch);
wmove(gamewin, cell->y - viewy, cell->x - viewx); wmove(gamewin, cell->y - viewy, cell->x - viewx);
@ -276,6 +277,7 @@ void animcells(cell_t *src, cell_t **dst, int ndst, int gradual, char ch, char c
} else { } else {
gl.ch = ch2; gl.ch = ch2;
} }
if (colour == C_RANDOM) gl.colour = rnd(C_FIRST, C_LAST);
if (gradual) { if (gradual) {
// update screen each time // update screen each time
@ -329,6 +331,7 @@ void animline(cell_t *src, cell_t *dst, int gradual, char ch, char ch2, int colo
} else { } else {
gl.ch = ch2; gl.ch = ch2;
} }
if (colour == C_RANDOM) gl.colour = rnd(C_FIRST, C_LAST);
if (gradual) { if (gradual) {
// update screen each time // update screen each time
@ -387,6 +390,7 @@ void animradial(cell_t *src, int radius, int ch,int colour, int dirtype, char *s
if (c && haslos(player, c) && (getcelldistorth(src, c) <= i)) { if (c && haslos(player, c) && (getcelldistorth(src, c) <= i)) {
// draw char & cursor at its current pos... // draw char & cursor at its current pos...
//mvwprintw(gamewin, c->y - viewy, c->x - viewx, "%c", ch); //mvwprintw(gamewin, c->y - viewy, c->x - viewx, "%c", ch);
if (colour == C_RANDOM) gl.colour = rnd(C_FIRST, C_LAST);
drawglyph(&gl, c->x - viewx, c->y - viewy); drawglyph(&gl, c->x - viewx, c->y - viewy);
drawn = B_TRUE; drawn = B_TRUE;
nseen++; nseen++;
@ -459,6 +463,7 @@ void animsky(cell_t *src, char ch, int colour) {
// draw bolt coming down // draw bolt coming down
for (y = 0; y <= src->y - viewy; y++) { for (y = 0; y <= src->y - viewy; y++) {
if (colour == C_RANDOM) gl.colour = rnd(C_FIRST, C_LAST);
drawglyph(&gl, src->x - viewx, y); drawglyph(&gl, src->x - viewx, y);
} }
wrefresh(gamewin); wrefresh(gamewin);
@ -3821,7 +3826,7 @@ void docomms(lifeform_t *lf) {
char buf[BUFLEN]; char buf[BUFLEN];
char lfname[BUFLEN]; char lfname[BUFLEN];
char ch; char ch;
int moneyowing = 0; //int moneyowing = 0;
enum ATTRBRACKET iqb; enum ATTRBRACKET iqb;
flag_t *f; flag_t *f;
cell_t *c; cell_t *c;
@ -3908,6 +3913,7 @@ void docomms(lifeform_t *lf) {
addchoice(&prompt, 'd', "(donate an item)", NULL, NULL, NULL); addchoice(&prompt, 'd', "(donate an item)", NULL, NULL, NULL);
} }
/*
f = lfhasflag(lf, F_OWNSSHOP); f = lfhasflag(lf, F_OWNSSHOP);
if (f) { if (f) {
int shopid; int shopid;
@ -3918,6 +3924,7 @@ void docomms(lifeform_t *lf) {
addchoice(&prompt, 'p', buf, NULL, NULL, NULL); addchoice(&prompt, 'p', buf, NULL, NULL, NULL);
} }
} }
*/
addchoice(&prompt, 'y', "Yeeeeeaaaargh!", NULL, NULL, NULL); addchoice(&prompt, 'y', "Yeeeeeaaaargh!", NULL, NULL, NULL);
@ -4179,6 +4186,7 @@ void docomms(lifeform_t *lf) {
} }
} }
break; break;
/*
case 'p': case 'p':
// can we afford this? // can we afford this?
if (givemoney(player, lf, moneyowing)) { if (givemoney(player, lf, moneyowing)) {
@ -4217,6 +4225,7 @@ void docomms(lifeform_t *lf) {
sayphrase(lf, SP_PAYTHANKS, SV_TALK, NA, NULL); sayphrase(lf, SP_PAYTHANKS, SV_TALK, NA, NULL);
} }
break; break;
*/
case 'r': case 'r':
msg("You say \"Get some rest.\" to %s.", lfname); msg("You say \"Get some rest.\" to %s.", lfname);
if (lfhasflag(lf, F_RAGE) || !canhear(lf, player->cell, SV_SHOUT)) { if (lfhasflag(lf, F_RAGE) || !canhear(lf, player->cell, SV_SHOUT)) {
@ -10184,10 +10193,12 @@ void setobcolour(WINDOW *win, object_t *o, int set) {
if (!o) return; if (!o) return;
// unpaid? // unpaid?
/*
if (hasflag(o->flags, F_SHOPITEM) && o->pile->owner) { if (hasflag(o->flags, F_SHOPITEM) && o->pile->owner) {
funcptr(win, C_ORANGE); funcptr(win, C_ORANGE);
return; return;
} }
*/
if (hasflag(o->flags, F_KNOWNBAD)) { if (hasflag(o->flags, F_KNOWNBAD)) {
funcptr(win, C_RED); funcptr(win, C_RED);

10
lf.c
View File

@ -4587,6 +4587,7 @@ raceclass_t *findraceclass(enum RACECLASS id) {
return NULL; return NULL;
} }
/*
lifeform_t *findshopkeeper(map_t *m, int roomid) { lifeform_t *findshopkeeper(map_t *m, int roomid) {
lifeform_t *lf; lifeform_t *lf;
for (lf = m->lf ; lf ; lf = lf->next) { for (lf = m->lf ; lf ; lf = lf->next) {
@ -4596,6 +4597,7 @@ lifeform_t *findshopkeeper(map_t *m, int roomid) {
} }
return NULL; return NULL;
} }
*/
skill_t *findskill(enum SKILL id) { skill_t *findskill(enum SKILL id) {
skill_t *r; skill_t *r;
@ -6881,6 +6883,7 @@ object_t *getouterequippedob(lifeform_t *lf, enum BODYPART bp) {
return getequippedob(lf->pack, bp); return getequippedob(lf->pack, bp);
} }
/*
int getowing(lifeform_t *buyer, int shopid, int *retnitems) { int getowing(lifeform_t *buyer, int shopid, int *retnitems) {
object_t *o; object_t *o;
flag_t *f; flag_t *f;
@ -6899,6 +6902,7 @@ int getowing(lifeform_t *buyer, int shopid, int *retnitems) {
} }
return totcost; return totcost;
} }
*/
// return the healthiest possible hurt condition that 'lf' will // return the healthiest possible hurt condition that 'lf' will
// recognise when looking at someone else. // recognise when looking at someone else.
@ -8961,6 +8965,7 @@ void givejob(lifeform_t *lf, enum JOB jobid) {
f->val[0] = OT_HOOKHAND; f->val[0] = OT_HOOKHAND;
f->val[1] = 4; f->val[1] = 4;
} }
/*
} else if (j->id == J_SHOPKEEPER) { } else if (j->id == J_SHOPKEEPER) {
// shopkeepers are not hostile. // shopkeepers are not hostile.
killflagsofid(lf->flags, F_HOSTILE); killflagsofid(lf->flags, F_HOSTILE);
@ -8970,6 +8975,7 @@ void givejob(lifeform_t *lf, enum JOB jobid) {
addflag(lf->flags, F_OWNSSHOP, getroomid(lf->cell), NA, NA, NULL); addflag(lf->flags, F_OWNSSHOP, getroomid(lf->cell), NA, NA, NULL);
addflag(lf->flags, F_STAYINROOM, getroomid(lf->cell), NA, NA, NULL); addflag(lf->flags, F_STAYINROOM, getroomid(lf->cell), NA, NA, NULL);
} }
*/
} }
} }
@ -12293,6 +12299,7 @@ int askforinfo(lifeform_t *lf, int diffmod) {
return B_FALSE; return B_FALSE;
} }
/*
int askforpayment(lifeform_t *shk, lifeform_t *lf) { int askforpayment(lifeform_t *shk, lifeform_t *lf) {
char saybuf[BUFLEN]; char saybuf[BUFLEN];
int totcost = 0; int totcost = 0;
@ -12315,6 +12322,7 @@ int askforpayment(lifeform_t *shk, lifeform_t *lf) {
say(shk, saybuf, SV_TALK); say(shk, saybuf, SV_TALK);
return B_FALSE; return B_FALSE;
} }
*/
char *assignnpcname(lifeform_t *lf) { char *assignnpcname(lifeform_t *lf) {
npcname_t *poss,*sel; npcname_t *poss,*sel;
@ -17744,7 +17752,7 @@ int steal(lifeform_t *lf, obpile_t *op, enum FLAG wantflag) {
o = (object_t *)prompt.choice[rnd(0,prompt.nchoices-1)].data; o = (object_t *)prompt.choice[rnd(0,prompt.nchoices-1)].data;
} }
if (o) { if (o) {
killflagsofid(o->flags, F_SHOPITEM); //killflagsofid(o->flags, F_SHOPITEM);
o = moveob(o, lf->pack, 1); o = moveob(o, lf->pack, 1);
if (o) { if (o) {
char obname[BUFLEN]; char obname[BUFLEN];

6
lf.h
View File

@ -19,7 +19,7 @@ int areallies(lifeform_t *lf1, lifeform_t *lf2);
int areenemies(lifeform_t *lf1, lifeform_t *lf2); int areenemies(lifeform_t *lf1, lifeform_t *lf2);
int armourfits(lifeform_t *lf, object_t *o, enum ERROR *reason); int armourfits(lifeform_t *lf, object_t *o, enum ERROR *reason);
int askforinfo(lifeform_t *lf, int diffmod); int askforinfo(lifeform_t *lf, int diffmod);
int askforpayment(lifeform_t *shk, lifeform_t *lf); //int askforpayment(lifeform_t *shk, lifeform_t *lf);
char *assignnpcname(lifeform_t *lf); char *assignnpcname(lifeform_t *lf);
void autoshortcut(lifeform_t *lf, enum OBTYPE spellid); void autoshortcut(lifeform_t *lf, enum OBTYPE spellid);
void autoskill(lifeform_t *lf); void autoskill(lifeform_t *lf);
@ -104,7 +104,7 @@ lifeform_t *findlfunique(enum RACE rid);
race_t *findrace(enum RACE id); race_t *findrace(enum RACE id);
race_t *findracebyname(char *name); race_t *findracebyname(char *name);
raceclass_t *findraceclass(enum RACECLASS id); raceclass_t *findraceclass(enum RACECLASS id);
lifeform_t *findshopkeeper(map_t *m, int roomid); //lifeform_t *findshopkeeper(map_t *m, int roomid);
skill_t *findskill(enum SKILL id); skill_t *findskill(enum SKILL id);
skill_t *findskillbyname(char *name); skill_t *findskillbyname(char *name);
enum SKILLLEVEL findskilllevbyname(char *name); enum SKILLLEVEL findskilllevbyname(char *name);
@ -177,7 +177,7 @@ int getnightvisrange(lifeform_t *lf);
int getnoisedetails(lifeform_t *lf, enum NOISETYPE nid, char *heartext,char *seetext, int *volume); int getnoisedetails(lifeform_t *lf, enum NOISETYPE nid, char *heartext,char *seetext, int *volume);
char *getlfconditionname(enum LFCONDITION cond); char *getlfconditionname(enum LFCONDITION cond);
object_t *getouterequippedob(lifeform_t *lf, enum BODYPART bp); object_t *getouterequippedob(lifeform_t *lf, enum BODYPART bp);
int getowing(lifeform_t *buyer, int shopid, int *retnitems); //int getowing(lifeform_t *buyer, int shopid, int *retnitems);
enum LFCONDITION getseenlfconditioncutoff(lifeform_t *lf); enum LFCONDITION getseenlfconditioncutoff(lifeform_t *lf);
char *getseenlfconditionname(lifeform_t *lf, lifeform_t *viewer); char *getseenlfconditionname(lifeform_t *lf, lifeform_t *viewer);
int getsmellrange(lifeform_t *lf); int getsmellrange(lifeform_t *lf);

142
map.c
View File

@ -206,6 +206,11 @@ lifeform_t *addmonster(cell_t *c, enum RACE rid, char *racename, int jobok, int
wantflags = addflagpile(NULL, NULL); wantflags = addflagpile(NULL, NULL);
// override...
if (streq(racename, "random")) {
rid = R_RANDOM;
}
if (rid != R_SPECIFIED) { if (rid != R_SPECIFIED) {
if (rid == R_RANDOM) { if (rid == R_RANDOM) {
r = getrandomrace(c, NA); r = getrandomrace(c, NA);
@ -860,7 +865,7 @@ int autodoors(map_t *map, int roomid, int minx, int miny, int maxx, int maxy, in
if (rnd(1,100) <= doorpct) { if (rnd(1,100) <= doorpct) {
makedoor(cell[i], dooropenchance); makedoor(cell[i], dooropenchance);
} else { } else {
setcelltype(cell[i], cell[i]->habitat->emptycelltype); setcelltype(cell[i], getcellempty(cell[i]));
cell[i]->isroomwall = compassdir(d); cell[i]->isroomwall = compassdir(d);
addflag(map->flags, F_ROOMEXIT, roomid, cell[i]->x, cell[i]->y, "from autodoors, only way out"); addflag(map->flags, F_ROOMEXIT, roomid, cell[i]->x, cell[i]->y, "from autodoors, only way out");
} }
@ -882,7 +887,7 @@ int autodoors(map_t *map, int roomid, int minx, int miny, int maxx, int maxy, in
if (rnd(1,100) <= doorpct) { if (rnd(1,100) <= doorpct) {
makedoor(poss[sel], dooropenchance); makedoor(poss[sel], dooropenchance);
} else { } else {
setcelltype(poss[sel], poss[sel]->habitat->emptycelltype); setcelltype(poss[sel], getcellempty(poss[sel]));
addflag(map->flags, F_ROOMEXIT, roomid, poss[sel]->x, poss[sel]->y, "from autodoors, potential location"); addflag(map->flags, F_ROOMEXIT, roomid, poss[sel]->x, poss[sel]->y, "from autodoors, potential location");
} }
poss[sel]->isroomwall = compassdir(possdir[sel]); poss[sel]->isroomwall = compassdir(possdir[sel]);
@ -931,7 +936,7 @@ int autodoors(map_t *map, int roomid, int minx, int miny, int maxx, int maxy, in
makedoor(cell[sel], dooropenchance); makedoor(cell[sel], dooropenchance);
doorsadded++; doorsadded++;
} else { } else {
setcelltype(cell[sel], cell[sel]->habitat->emptycelltype); setcelltype(cell[sel], getcellempty(cell[sel]));
addflag(map->flags, F_ROOMEXIT, roomid, cell[sel]->x, cell[sel]->y, "from autodoors, forced at end"); addflag(map->flags, F_ROOMEXIT, roomid, cell[sel]->x, cell[sel]->y, "from autodoors, forced at end");
doorsadded++; doorsadded++;
} }
@ -950,7 +955,7 @@ void breakwall(cell_t *c) {
int roomwall; int roomwall;
origtype = c->type; origtype = c->type;
roomwall = isroom(c); roomwall = isroom(c);
setcelltype(c, c->habitat->emptycelltype); setcelltype(c, getcellempty(c));
if (origtype->solid && roomwall && onein(2)) { if (origtype->solid && roomwall && onein(2)) {
switch (origtype->material->id) { switch (origtype->material->id) {
case MT_STONE: addob(c->obpile, "1-30 stones"); break; case MT_STONE: addob(c->obpile, "1-30 stones"); break;
@ -1236,7 +1241,7 @@ int damagecell(cell_t *c, int amt, enum DAMTYPE damtype) {
sprintf(cellname, "%s %s", needan(c->type->name) ? "An" : "A", c->type->name); sprintf(cellname, "%s %s", needan(c->type->name) ? "An" : "A", c->type->name);
cellmat = c->type->material->id; cellmat = c->type->material->id;
// cell dies (have to do this before calling fragments()) // cell dies (have to do this before calling fragments())
setcelltype(c, c->map->habitat->emptycelltype); setcelltype(c, getcellempty(c));
// announce // announce
if (haslos(player, c)) { if (haslos(player, c)) {
msg("%s %s!", cellname, willshatter(cellmat) ? "shatters" : "is destroyed"); msg("%s %s!", cellname, willshatter(cellmat) ? "shatters" : "is destroyed");
@ -1595,6 +1600,37 @@ void getcellglyph(glyph_t *g, cell_t *c, lifeform_t *viewer) {
} }
} }
enum CELLTYPE getcellempty(cell_t *c) {
flag_t *f;
if (c->habitat == c->map->habitat) {
f = hasflag(c->map->flags, F_CELLTYPEEMPTY);
if (f) return f->val[0];
}
return c->habitat->emptycelltype;
}
enum CELLTYPE getcellsolid(cell_t *c) {
flag_t *f;
if (c->habitat == c->map->habitat) {
f = hasflag(c->map->flags, F_CELLTYPESOLID);
if (f) return f->val[0];
}
return c->habitat->solidcelltype;
}
enum CELLTYPE getmapempty(map_t *m) {
flag_t *f;
f = hasflag(m->flags, F_CELLTYPEEMPTY);
if (f) return f->val[0];
return m->habitat->emptycelltype;
}
enum CELLTYPE getmapsolid(map_t *m) {
flag_t *f;
f = hasflag(m->flags, F_CELLTYPESOLID);
if (f) return f->val[0];
return m->habitat->solidcelltype;
}
enum DEPTH getcellwaterdepth(cell_t *c, lifeform_t *lf) { enum DEPTH getcellwaterdepth(cell_t *c, lifeform_t *lf) {
object_t *o; object_t *o;
@ -2166,8 +2202,8 @@ void createcave(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *
} }
// what kind of cells will 'empty' ones be? // what kind of cells will 'empty' ones be?
emptycell = map->habitat->emptycelltype; emptycell = getmapempty(map);
solidcell = map->habitat->solidcelltype; solidcell = getmapsolid(map);
// pick initial random points // pick initial random points
for (i = 0; i < numstartpos; i++) { for (i = 0; i < numstartpos; i++) {
@ -2400,9 +2436,41 @@ void createdungeon(map_t *map, int depth, map_t *parentmap, int exitdir, object_
} }
} }
// random chance of different wall type
if (onein(6)) {
switch (rnd(1,3)) {
case 1:
addflag(map->flags, F_CELLTYPESOLID, CT_WALLBRICK, NA, NA, NULL);
break;
case 2:
addflag(map->flags, F_CELLTYPESOLID, CT_WALLMETAL, NA, NA, NULL);
break;
case 3:
addflag(map->flags, F_CELLTYPESOLID, CT_WALLWOOD, NA, NA, NULL);
break;
}
}
// random chance of different floor type
if (onein(6)) {
switch (rnd(1,3)) {
case 1:
addflag(map->flags, F_CELLTYPEEMPTY, CT_FLOORCARPET, NA, NA, NULL);
break;
case 2:
addflag(map->flags, F_CELLTYPEEMPTY, CT_FLOORTILE, NA, NA, NULL);
break;
case 3:
addflag(map->flags, F_CELLTYPEEMPTY, CT_FLOORWOOD, NA, NA, NULL);
break;
}
}
// what kind of cells will 'empty' ones be? // what kind of cells will 'empty' ones be?
emptycell = map->habitat->emptycelltype; emptycell = getmapempty(map);
solidcell = map->habitat->solidcelltype; //solidcell = map->habitat->solidcelltype;
solidcell = getmapsolid(map);
// pick initial random spot // pick initial random spot
if (corridortype == CDT_NORMAL) { if (corridortype == CDT_NORMAL) {
@ -2629,7 +2697,7 @@ void createdungeon(map_t *map, int depth, map_t *parentmap, int exitdir, object_
c = getrandomroomcell(map, i); c = getrandomroomcell(map, i);
if (c && isempty(c) && !countobs(c->obpile, B_TRUE)) { if (c && isempty(c) && !countobs(c->obpile, B_TRUE)) {
setcelltype(c, CT_WALL); setcelltype(c, solidcell);
} }
} }
} }
@ -2743,7 +2811,7 @@ void createforest(map_t *map, int depth, map_t *parentmap, int exitdir, object_t
//object_t *o; //object_t *o;
// fill entire maze with emptiness // fill entire maze with emptiness
emptycell = map->habitat->emptycelltype; emptycell = getmapempty(map);
for (y = 0; y < map->h; y++) { for (y = 0; y < map->h; y++) {
for (x = 0; x < map->w; x++) { for (x = 0; x < map->w; x++) {
c = addcell(map, x, y); c = addcell(map, x, y);
@ -2858,8 +2926,8 @@ void createheaven(map_t *map, int depth, map_t *parentmap, int exitdir, object_t
//object_t *o; //object_t *o;
// what kind of cells will 'empty' ones be? // what kind of cells will 'empty' ones be?
emptycell = map->habitat->emptycelltype; emptycell = getmapempty(map);
solidcell = map->habitat->solidcelltype; solidcell = getmapsolid(map);
// fill entire maze with walls // fill entire maze with walls
for (y = 0; y < map->h; y++) { for (y = 0; y < map->h; y++) {
for (x = 0; x < map->w; x++) { for (x = 0; x < map->w; x++) {
@ -3678,7 +3746,7 @@ void createsewer(map_t *map, int depth, map_t *parentmap, int exitdir, object_t
break; break;
} }
} }
if (makewalkway) setcelltype(c, c->habitat->emptycelltype); if (makewalkway) setcelltype(c, getcellempty(c));
} else if (c->type->id == CT_LOWFLOOR) { } else if (c->type->id == CT_LOWFLOOR) {
// any water cell orthogonally surrounded by water becomes very deep // any water cell orthogonally surrounded by water becomes very deep
int dir,surrounded = B_TRUE; int dir,surrounded = B_TRUE;
@ -3706,7 +3774,7 @@ void createsewer(map_t *map, int depth, map_t *parentmap, int exitdir, object_t
nexto = o->next; nexto = o->next;
if (o->type->id != OT_SLIMEPOOL) { if (o->type->id != OT_SLIMEPOOL) {
cell_t *c2; cell_t *c2;
c2 = getrandomcelloftype(map, c->habitat->emptycelltype); c2 = getrandomcelloftype(map, getcellempty(c));
moveob(o, c2->obpile, ALL); moveob(o, c2->obpile, ALL);
} }
} }
@ -3873,7 +3941,7 @@ int createvault(map_t *map, int roomid, vault_t *v, int *retw, int *reth, int *r
// set cell type // set cell type
ct = getvaultcelltype(v, x-minx,y-miny, rotation); ct = getvaultcelltype(v, x-minx,y-miny, rotation);
setcelltype(cell, ct ? ct->id : cell->habitat->emptycelltype); setcelltype(cell, ct ? ct->id : getcellempty(cell));
// set roomid // set roomid
cell->room = thisroom; cell->room = thisroom;
// add objects // add objects
@ -4605,11 +4673,11 @@ void createroom(map_t *map, int roomid, int x1, int y1, int x2, int y2, int forc
// ie. if you haven't forced walls then if this room overlaps // ie. if you haven't forced walls then if this room overlaps
// with another one, no walls will be created. // with another one, no walls will be created.
if (forcewalls || (!forcewalls && cell->type->solid)) { if (forcewalls || (!forcewalls && cell->type->solid)) {
setcelltype(cell, cell->habitat->solidcelltype); setcelltype(cell, getcellsolid(cell));
} }
//} //}
} else { } else {
setcelltype(cell, cell->habitat->emptycelltype); setcelltype(cell, getcellempty(cell));
} }
cell->room = thisroom; cell->room = thisroom;
} }
@ -4876,7 +4944,7 @@ void expand_cave(map_t *map, int numpasses) {
for (dir = DC_N; dir <= DC_NW; dir++) { for (dir = DC_N; dir <= DC_NW; dir++) {
c2 = getcellindir(c, dir); c2 = getcellindir(c, dir);
if (c2 && c2->type->solid && pctchance(chancetoclear)) { if (c2 && c2->type->solid && pctchance(chancetoclear)) {
setcelltype(c2, map->habitat->emptycelltype); setcelltype(c2, getmapempty(map));
} }
} }
// mark cell as processed // mark cell as processed
@ -4970,7 +5038,7 @@ void finalisemap(map_t *map, object_t *entryob) {
for (d = DC_N; d <= DC_NW; d++) { for (d = DC_N; d <= DC_NW; d++) {
cell_t *c2; cell_t *c2;
c2 = getcellindir(c, d); c2 = getcellindir(c, d);
if (c2) setcelltype(c2, map->habitat->emptycelltype); if (c2) setcelltype(c2, getmapempty(map));
} }
} }
} else { } else {
@ -6101,9 +6169,9 @@ object_t *hastrailof(obpile_t *op, lifeform_t *lf, enum OBTYPE oid, flag_t **tfl
void initmap(void) { void initmap(void) {
// habitats // habitats
// thingchance, obchance, vaultchance, maxvisrange, upstiartype, downstairtype // thingchance, obchance, vaultchance, maxvisrange, upstiartype, downstairtype
addhabitat(H_DUNGEON, "dungeon", CT_CORRIDOR, CT_WALL, 3, 50, 30, 6, OT_STAIRSUP, OT_STAIRSDOWN); addhabitat(H_DUNGEON, "dungeon", CT_CORRIDOR, CT_WALL, 3, 50, 30, 6, OT_STAIRSUP, OT_STAIRSDOWN);
addhabitat(H_CAVE, "cave", CT_DIRT, CT_WALLDIRT, 5, 60, 10, 6, OT_TUNNELUP, OT_TUNNELDOWN); addhabitat(H_CAVE, "cave", CT_DIRT, CT_WALLDIRT, 5, 65, 10, 6, OT_TUNNELUP, OT_TUNNELDOWN);
addhabitat(H_FOREST, "forest", CT_GRASS, CT_WALL, 3, 75, 0, MAXVISRANGE, OT_NONE, OT_NONE); addhabitat(H_FOREST, "forest", CT_GRASS, CT_WALL, 3, 75, 0, MAXVISRANGE, OT_NONE, OT_NONE);
addhabitat(H_HEAVEN, "heaven", CT_CORRIDOR, CT_WALLGLASS, 5, 0, 0, MAXVISRANGE, OT_NONE, OT_NONE); addhabitat(H_HEAVEN, "heaven", CT_CORRIDOR, CT_WALLGLASS, 5, 0, 0, MAXVISRANGE, OT_NONE, OT_NONE);
addhabitat(H_PIT, "pit", CT_CORRIDOR, CT_WALL, 0, 0, 0, 5, OT_NONE, OT_NONE); addhabitat(H_PIT, "pit", CT_CORRIDOR, CT_WALL, 0, 0, 0, 5, OT_NONE, OT_NONE);
@ -6113,10 +6181,12 @@ void initmap(void) {
addhabitat(H_SWAMP, "swamp", CT_CORRIDOR, CT_WALL, 3, 50, 0, MAXVISRANGE, OT_STAIRSUP, OT_STAIRSDOWN); addhabitat(H_SWAMP, "swamp", CT_CORRIDOR, CT_WALL, 3, 50, 0, MAXVISRANGE, OT_STAIRSUP, OT_STAIRSDOWN);
// cell types - solid // cell types - solid
// floorheight, hp
addcelltype(CT_WALL, "rock wall", UNI_SHADEDARK, C_GREY, B_SOLID, B_OPAQUE, MT_STONE, 0, 50); addcelltype(CT_WALL, "rock wall", UNI_SHADEDARK, C_GREY, B_SOLID, B_OPAQUE, MT_STONE, 0, 50);
addcelltype(CT_WALLDIRT, "dirt wall", UNI_SHADEDARK, C_BROWN, B_SOLID, B_OPAQUE, MT_STONE, 0, 25); addcelltype(CT_WALLBRICK, "brick wall", UNI_SHADEDARK, C_ORANGE, B_SOLID, B_OPAQUE, MT_STONE, 0, 40);
addcelltype(CT_WALLWOOD, "wooden wall", UNI_SOLID, C_BROWN, B_SOLID, B_OPAQUE, MT_WOOD, 0, 40); addcelltype(CT_WALLDIRT, "dirt wall", UNI_SHADEDARK, C_BROWN, B_SOLID, B_OPAQUE, MT_STONE, 0, 20);
addcelltype(CT_WALLFLESH, "flesh wall", UNI_SOLID, C_RED, B_SOLID, B_OPAQUE, MT_FLESH, 0, 30); addcelltype(CT_WALLWOOD, "wooden wall", UNI_SOLID, C_BROWN, B_SOLID, B_OPAQUE, MT_WOOD, 0, 30);
addcelltype(CT_WALLFLESH, "flesh wall", UNI_SOLID, C_RED, B_SOLID, B_OPAQUE, MT_FLESH, 0, 25);
addcelltype(CT_WALLGLASS, "glass wall", UNI_SOLID, C_CYAN, B_SOLID, B_TRANS, MT_GLASS, 0, 20); addcelltype(CT_WALLGLASS, "glass wall", UNI_SOLID, C_CYAN, B_SOLID, B_TRANS, MT_GLASS, 0, 20);
addcelltype(CT_WALLMETAL, "metal wall", UNI_SOLID, C_WHITE, B_SOLID, B_OPAQUE, MT_METAL, 0, 75); addcelltype(CT_WALLMETAL, "metal wall", UNI_SOLID, C_WHITE, B_SOLID, B_OPAQUE, MT_METAL, 0, 75);
// cell types - non-solid // cell types - non-solid
@ -6148,12 +6218,14 @@ void initmap(void) {
void initmaplayout(void) { void initmaplayout(void) {
int vx[4],vy[4],i; //int vx[4],vy[4];
int i;
// MAPMAPMAPMAP // MAPMAPMAPMAP
// region definitions (outlines) // region definitions (outlines)
addregionoutline(RG_WORLDMAP); addregionoutline(RG_WORLDMAP);
// link to first dungeon // link to first dungeon
addregionthing(lastregionoutline, NA, 0, 0, RT_REGIONLINK, RG_MAINDUNGEON, "staircase going down"); addregionthing(lastregionoutline, NA, 0, 0, RT_REGIONLINK, RG_MAINDUNGEON, "staircase going down");
/*
// four villages // four villages
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
vx[i] = 0; vy[i] = 0; vx[i] = 0; vy[i] = 0;
@ -6178,7 +6250,7 @@ void initmaplayout(void) {
addregionthing(lastregionoutline, NA, vx[i], vy[i], RT_RNDVAULTWITHFLAG, F_VAULTISSHOP, NULL); addregionthing(lastregionoutline, NA, vx[i], vy[i], RT_RNDVAULTWITHFLAG, F_VAULTISSHOP, NULL);
} }
//vx = 0; vy = -1; //vx = 0; vy = -1;
*/
addregionoutline(RG_MAINDUNGEON); addregionoutline(RG_MAINDUNGEON);
addregionthing(lastregionoutline, 1, NA, NA, RT_RNDVAULTWITHFLAG, F_VAULTISPLAYERSTART, NULL); addregionthing(lastregionoutline, 1, NA, NA, RT_RNDVAULTWITHFLAG, F_VAULTISPLAYERSTART, NULL);
@ -6563,7 +6635,7 @@ int linkholes(map_t *map) {
} }
// clear out the cell if required // clear out the cell if required
if (c2->type->solid) { if (c2->type->solid) {
setcelltype(c2, c2->habitat->emptycelltype); setcelltype(c2, getcellempty(c2));
} }
// note we specifically say DONT link the new hole, to avoid an infinite // note we specifically say DONT link the new hole, to avoid an infinite
// loop! // loop!
@ -6729,7 +6801,7 @@ void makedoor(cell_t *cell, int openchance) {
m = cell->map; m = cell->map;
setcelltype(cell, cell->habitat->emptycelltype); setcelltype(cell, getcellempty(cell));
if ((rnd(1,100) + m->depth) >= 66) { if ((rnd(1,100) + m->depth) >= 66) {
strcpy(doorbuf, "iron door"); strcpy(doorbuf, "iron door");
@ -6902,11 +6974,13 @@ void markroomwalls(map_t *m, room_t *r) {
void mapentereffects(map_t *m) { void mapentereffects(map_t *m) {
int i; int i;
cell_t *c; cell_t *c;
flag_t *f; //flag_t *f;
for (i = 0; i < m->w * m->h; i++) { for (i = 0; i < m->w * m->h; i++) {
vault_t *v; vault_t *v;
// teleport shopkeepers back to their shops
c = m->cell[i]; c = m->cell[i];
v = getcellvault(c);
/*
// teleport shopkeepers back to their shops
if (c->lf && hasjob(c->lf, J_SHOPKEEPER) && !isplayer(c->lf)) { if (c->lf && hasjob(c->lf, J_SHOPKEEPER) && !isplayer(c->lf)) {
f = lfhasflag(c->lf, F_OWNSSHOP); f = lfhasflag(c->lf, F_OWNSSHOP);
if (f) { if (f) {
@ -6920,7 +6994,6 @@ void mapentereffects(map_t *m) {
} }
} }
} }
v = getcellvault(c);
// replace people in the Inn // replace people in the Inn
if (v && streq(v->id, "inn") && c->lf && (c->lf->race->id == R_HUMAN)) { if (v && streq(v->id, "inn") && c->lf && (c->lf->race->id == R_HUMAN)) {
lifeform_t *lf; lifeform_t *lf;
@ -6928,6 +7001,7 @@ void mapentereffects(map_t *m) {
lf = addmonster(c, R_HUMAN, NULL, B_TRUE, 1, B_FALSE, NULL); lf = addmonster(c, R_HUMAN, NULL, B_TRUE, 1, B_FALSE, NULL);
addflag(lf->flags, F_STAYINROOM, getroomid(c), B_MAYCHASE, NA, NULL); addflag(lf->flags, F_STAYINROOM, getroomid(c), B_MAYCHASE, NA, NULL);
} }
*/
} }
// monsters on the new level now get a bunch of turns to simulate them moving about when the player wasn't there. // monsters on the new level now get a bunch of turns to simulate them moving about when the player wasn't there.
@ -7012,7 +7086,7 @@ int remove_deadends(map_t *m, int howmuch) {
enum CELLTYPE solidcell; enum CELLTYPE solidcell;
int i,n,count = 0; int i,n,count = 0;
solidcell = m->habitat->solidcelltype; solidcell = getmapsolid(m);
for (i = 0; i < howmuch; i++) { for (i = 0; i < howmuch; i++) {
for (n = 0; n < m->w * m->h; n++) { for (n = 0; n < m->w * m->h; n++) {
@ -7066,7 +7140,7 @@ void setcellknown(cell_t *cell, int forcelev) {
o = hassecretdoor(cell->obpile); o = hassecretdoor(cell->obpile);
if (o) { if (o) {
celltype_t *ct; celltype_t *ct;
ct = findcelltype(cell->habitat->solidcelltype); ct = findcelltype(getcellsolid(cell));
cell->knownglyph = ct->glyph; cell->knownglyph = ct->glyph;
} else { } else {
cell->knownglyph = cell->type->glyph; cell->knownglyph = cell->type->glyph;

4
map.h
View File

@ -29,6 +29,10 @@ int getcellclimbdifficulty(cell_t *c);
int getcelldist(cell_t *src, cell_t *dst); int getcelldist(cell_t *src, cell_t *dst);
int getcelldistorth(cell_t *src, cell_t *dst); int getcelldistorth(cell_t *src, cell_t *dst);
void getcellglyph(glyph_t *g, cell_t *c, lifeform_t *viewer); void getcellglyph(glyph_t *g, cell_t *c, lifeform_t *viewer);
enum CELLTYPE getcellempty(cell_t *c);
enum CELLTYPE getcellsolid(cell_t *c);
enum CELLTYPE getmapempty(map_t *m);
enum CELLTYPE getmapsolid(map_t *m);
enum DEPTH getcellwaterdepth(cell_t *c, lifeform_t *lf); enum DEPTH getcellwaterdepth(cell_t *c, lifeform_t *lf);
cell_t *get_closest_adjcell(cell_t *src, cell_t *dst); cell_t *get_closest_adjcell(cell_t *src, cell_t *dst);
int getdoorlockdiff(int depth); int getdoorlockdiff(int depth);

10
move.c
View File

@ -1110,11 +1110,11 @@ int movelf(lifeform_t *lf, cell_t *newcell) {
enum FLAG flying; enum FLAG flying;
int changedlev = B_FALSE; int changedlev = B_FALSE;
room_t *preroom = NULL, *postroom = NULL; room_t *preroom = NULL, *postroom = NULL;
int preshop = -1; //int preshop = -1;
int prespeed = B_FALSE, postspeed = B_FALSE; int prespeed = B_FALSE, postspeed = B_FALSE;
int prewater = B_FALSE; int prewater = B_FALSE;
int preseenbyplayer = B_FALSE; int preseenbyplayer = B_FALSE;
vault_t *v; //vault_t *v;
flag_t *retflag[MAXCANDIDATES]; flag_t *retflag[MAXCANDIDATES];
int nretflags,i; int nretflags,i;
@ -1163,10 +1163,12 @@ int movelf(lifeform_t *lf, cell_t *newcell) {
// remember current cell + room id // remember current cell + room id
prespeed = getmovespeed(lf); prespeed = getmovespeed(lf);
preroom = lf->cell->room; preroom = lf->cell->room;
/*
v = getcellvault(lf->cell); v = getcellvault(lf->cell);
if (v && hasflag(v->flags, F_VAULTISSHOP)) { if (v && hasflag(v->flags, F_VAULTISSHOP)) {
preshop = getroomid(lf->cell); preshop = getroomid(lf->cell);
} }
*/
// getting out of water? // getting out of water?
if (hasobwithflag(lf->cell->obpile, F_DEEPWATER)) { if (hasobwithflag(lf->cell->obpile, F_DEEPWATER)) {
prewater = B_TRUE; prewater = B_TRUE;
@ -1178,7 +1180,7 @@ int movelf(lifeform_t *lf, cell_t *newcell) {
} else { } else {
prespeed = SP_NORMAL; prespeed = SP_NORMAL;
preroom = NULL; preroom = NULL;
preshop = B_FALSE; //preshop = B_FALSE;
prewater = B_FALSE; prewater = B_FALSE;
preseenbyplayer = B_FALSE; preseenbyplayer = B_FALSE;
} }
@ -1491,6 +1493,7 @@ int movelf(lifeform_t *lf, cell_t *newcell) {
} }
} }
/*
// leaving a shop // leaving a shop
if (preshop) { if (preshop) {
// are you about to go outside a shop with stolen goods? // are you about to go outside a shop with stolen goods?
@ -1517,6 +1520,7 @@ int movelf(lifeform_t *lf, cell_t *newcell) {
} }
} }
} }
*/
if (preseenbyplayer && !cansee(player, lf) && !changedlev) { if (preseenbyplayer && !cansee(player, lf) && !changedlev) {
if (areenemies(player, lf)) { if (areenemies(player, lf)) {
real_getlfnamea(lf, lfname, B_FALSE, B_FALSE); real_getlfnamea(lf, lfname, B_FALSE, B_FALSE);

View File

@ -4794,7 +4794,7 @@ char *real_getobname(object_t *o, char *buf, int count, int wantpremods, int wan
char localbuf[BUFLEN]; char localbuf[BUFLEN];
char buf2[BUFLEN]; char buf2[BUFLEN];
char triedbuf[BUFLEN]; char triedbuf[BUFLEN];
int shopitem = B_FALSE; //int shopitem = B_FALSE;
flag_t *f; flag_t *f;
brand_t *br; brand_t *br;
int hasunknownmod = B_FALSE; int hasunknownmod = B_FALSE;
@ -4804,9 +4804,11 @@ char *real_getobname(object_t *o, char *buf, int count, int wantpremods, int wan
int nretflags = 0; int nretflags = 0;
// default to normal name // default to normal name
/*
if (hasflag(o->flags, F_SHOPITEM)) { if (hasflag(o->flags, F_SHOPITEM)) {
shopitem = B_TRUE; shopitem = B_TRUE;
} }
*/
where = getoblocation(o); where = getoblocation(o);
@ -5364,7 +5366,8 @@ char *real_getobname(object_t *o, char *buf, int count, int wantpremods, int wan
} }
// show if we've tried this // show if we've tried this
if (!shopitem && (gamemode == GM_GAMESTARTED)) { //if (!shopitem && (gamemode == GM_GAMESTARTED)) {
if (gamemode == GM_GAMESTARTED) {
knowledge_t *k; knowledge_t *k;
strcpy(triedbuf, ""); strcpy(triedbuf, "");
@ -5430,6 +5433,7 @@ char *real_getobname(object_t *o, char *buf, int count, int wantpremods, int wan
} }
} }
/*
// in a shop? // in a shop?
if (shopitem) { if (shopitem) {
char pricebuf[BUFLEN]; char pricebuf[BUFLEN];
@ -5437,6 +5441,7 @@ char *real_getobname(object_t *o, char *buf, int count, int wantpremods, int wan
snprintf(pricebuf, BUFLEN, " [$%d%s]", (int)getshopprice(o, player, NULL), o->pile->owner ? ", unpaid" : ""); snprintf(pricebuf, BUFLEN, " [$%d%s]", (int)getshopprice(o, player, NULL), o->pile->owner ? ", unpaid" : "");
strcat(localbuf, pricebuf); strcat(localbuf, pricebuf);
} }
*/
// apply prefix now! // apply prefix now!
if (count == 1) { if (count == 1) {
@ -12147,6 +12152,19 @@ int real_fireat(lifeform_t *thrower, object_t *o, int amt, cell_t *where, int sp
if (!isknown(o)) makeknown(o->type->id); if (!isknown(o)) makeknown(o->type->id);
} }
explodecells(thrower->cell, roll(diebuf), B_FALSE, o, 1, DT_COMPASS, B_FALSE); explodecells(thrower->cell, roll(diebuf), B_FALSE, o, 1, DT_COMPASS, B_FALSE);
} else if (o->type->id == OT_ASHINVIS) {
int radius;
char buf[BUFLEN];
// make everyone invisible
sprintf(buf, "%s dispers%s into twinkling light!", obname, (amt == 1) ? "es" : "e" );
if (haslos(player, srcloc)) {
if (!isknown(o)) makeknown(o->type->id);
}
radius = o->amt * 2;
if (radius > 10) radius = 10;
spellcloud(srcloc, radius, UNI_SHADELIGHT, C_RANDOM, OT_S_INVISIBILITY, radius, B_TRUE, buf, "A cloud of twinkling lights appear!");
} else if (o->type->id == OT_ASHSLEEP) { } else if (o->type->id == OT_ASHSLEEP) {
int radius; int radius;
char buf[BUFLEN]; char buf[BUFLEN];

22
vault.c
View File

@ -401,18 +401,26 @@ int addvaultthing(cell_t *c, vault_t *v, enum VAULTTHING vt, char *what) {
rv = B_TRUE; rv = B_TRUE;
} }
// first lifeform in a shop is the shopkeeper // first lifeform in a shop is the shopkeeper
/*
if (lf && hasflag(v->flags, F_VAULTISSHOP)) { if (lf && hasflag(v->flags, F_VAULTISSHOP)) {
if (!findshopkeeper(c->map, getroomid(c))) { if (!findshopkeeper(c->map, getroomid(c))) {
givejob(lf, J_SHOPKEEPER); givejob(lf, J_SHOPKEEPER);
} }
} }
if (lf && streq(v->id, "inn") ) { */
if (lf && hasflag(v->flags, F_MONSTERSSTAY)) {
addflag(lf->flags, F_STAYINROOM, getroomid(c), NA, NA, NULL); addflag(lf->flags, F_STAYINROOM, getroomid(c), NA, NA, NULL);
} }
break; break;
case VT_CELL: case VT_CELL:
ct = findcelltypebyname(what); if (streq(what, "EMPTY")) {
setcelltype(c, ct ? ct->id : c->map->habitat->emptycelltype); ct = findcelltype(getmapempty(c->map));
} else if (streq(what, "SOLID")) {
ct = findcelltype(getmapsolid(c->map));
} else {
ct = findcelltypebyname(what);
}
setcelltype(c, ct ? ct->id : getmapempty(c->map));
break; break;
default: default:
break; break;
@ -1383,6 +1391,9 @@ int handleline(vault_t *v, char *line) {
} else { } else {
dblog("vault flag mayflipy isnt valid for vaults with random maps."); dblog("vault flag mayflipy isnt valid for vaults with random maps.");
} }
} else if (streq(line, "monstersstay")) {
addflag(v->flags, F_MONSTERSSTAY, B_TRUE, NA, NA, NULL);
ok = B_TRUE;
} else if (streq(line, "nolink")) { } else if (streq(line, "nolink")) {
addflag(v->flags, F_VAULTNOLINK, B_TRUE, NA, NA, NULL); addflag(v->flags, F_VAULTNOLINK, B_TRUE, NA, NA, NULL);
ok = B_TRUE; ok = B_TRUE;
@ -1424,9 +1435,11 @@ int handleline(vault_t *v, char *line) {
} else if (streq(line, "playerstart")) { } else if (streq(line, "playerstart")) {
addflag(v->flags, F_VAULTISPLAYERSTART, B_TRUE, NA, NA, NULL); addflag(v->flags, F_VAULTISPLAYERSTART, B_TRUE, NA, NA, NULL);
ok = B_TRUE; ok = B_TRUE;
/*
} else if (streq(line, "shop")) { } else if (streq(line, "shop")) {
addflag(v->flags, F_VAULTISSHOP, B_TRUE, NA, NA, NULL); addflag(v->flags, F_VAULTISSHOP, B_TRUE, NA, NA, NULL);
ok = B_TRUE; ok = B_TRUE;
*/
} else if (strstarts(line, "tag:")) { } else if (strstarts(line, "tag:")) {
char *p; char *p;
p = line + 4; p = line + 4;
@ -1668,6 +1681,9 @@ int vaultthingok(enum VAULTTHING vt, char *what) {
} }
break; break;
case VT_CELL: case VT_CELL:
if (streq(what, "EMPTY") || streq(what, "SOLID")) {
return B_TRUE;
}
ct = findcelltypebyname(what); ct = findcelltypebyname(what);
if (ct) return B_TRUE; if (ct) return B_TRUE;
break; break;