#include "defs.h" cell_t *addcell(map_t *map, int x, int y); habitat_t *addhabitat(enum HABITAT id, char *name, enum CELLTYPE emptycell, enum CELLTYPE solidcell, int thingchance, int obchance, int vaultchance, int maxvisrange, enum OBTYPE upstairtype, enum OBTYPE downstairtype); void addhomeobs(lifeform_t *lf); 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); 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); 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); int cellhaslos(cell_t *c1, cell_t *dest); int cellisfixedvaultwall(cell_t *c); int cellokforreachability(cell_t *startcell, cell_t *c, int srcroomid, int dir, int wantfilled, int *insameroom); void clearcell(cell_t *c); void clearcell_exceptflags(cell_t *c, ...); int damagecell(cell_t *c, int amt, enum DAMTYPE damtype); int doelementspread(cell_t *c); int fix_reachability(map_t *m); int fix_unreachable_cell(cell_t *badcell); void floodfill(cell_t *startcell); cell_t *getcellat(map_t *map, int x, int y); int getcellclimbdifficulty(cell_t *c); int getcellclimbdifficultyavg(cell_t *c); int getcelldist(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); 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); cell_t *get_closest_adjcell(cell_t *src, cell_t *dst); int getdoorlockdiff(int depth); int getdoorsecretdiff(int depth); flag_t *getmapcoords(map_t *m, int *x, int *y); int getmapdifficulty(map_t *m); map_t *getmapindir(map_t *src, int dir); int getmapmaxvisrange(map_t *m); void getradiuscells(cell_t *centre, int radius, int dirtype, int outsideonly, enum LOFTYPE needlof, int wantcentre, cell_t **retcell, int *ncells, int scatterdensity); int getroomid(cell_t *c); void getroomedge(map_t *m, int roomid, int minx, int miny, int maxx, int maxy, int whichside, cell_t **retcell, int *ncells, int onlywantsolid); object_t *gettopobject(cell_t *where, int forglyph); void calclight(map_t *map); int calcroompos(map_t *map, int w, int h, int xmargin, int ymargin, int *bx, int *by, int force); int compassdir(int orthdir); int countadjcellsoftype(cell_t *cell, int id); int countadjrooms(cell_t *cell); int countadjcellswithflag(cell_t *cell, enum FLAG fid, int dirtype); int countadjdoors(cell_t *cell); int countadjwalls(cell_t *cell); int countcellexits(cell_t *cell, int dirtype); int countcellexitsfor(lifeform_t *lf); int countmapobs(map_t *m, enum OBTYPE oid); int countmapobswithflag(map_t *m, enum FLAG flagid); int countmapobswithflagval(map_t *m, enum FLAG flagid, int val0, int val1, int val2, char *text); int countstairs(map_t *m, int dir); void createcave(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *entryob); void createdungeon(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *entryob); void createfakes(map_t *map, cell_t *cell); void createforest(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *entryob, int nclearings); void createhabitat(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *entryob); void createheaven(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *entryob); void createmap(map_t *map, int depth, region_t *region, 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 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); int calcposandmakeroom(map_t *map, int roomid, int overrideminw, int overrideminh, int xmargin, int ymargin, int *retx, int *rety, int *retw, int *reth, int doorpct, int forcewalls); void createsewer(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *entryob); void createstomach(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *entryob); void createswamp(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *entryob); int createvault(map_t *map, int roomid, vault_t *v, int *retw, int *reth, int *retx, int *rety); int dirtox(int dt, int dir); int dirtoy(int dt, int dir); void dumpmap(map_t *map, int showrooms); void expand_cave(map_t *map, int numpasses); void explodesinglecell(cell_t *c, int dam, int killwalls, object_t *o, cell_t *centre); void explodecells(cell_t *c, int dam, int killwalls, object_t *o, int range, int dirtype, int wantannounce); void finalisemap(map_t *map, object_t *entryob); void finalisemonster(lifeform_t *lf, lifeform_t *leader, flagpile_t *wantflags, int idx); celltype_t *findcelltype(enum CELLTYPE cid); celltype_t *findcelltypebyname(char *name); habitat_t *findhabitat(enum HABITAT id); habitat_t *findhabitatbyname(char *name); map_t *findmap(int mid); map_t *findmapofdepth(int depth); object_t *findmapobwithflag(map_t *m, enum FLAG flagid); object_t *findmapobwithflagval(map_t *m, enum FLAG flagid, int val0, int val1, int val2, char *text); 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); region_t *findregion(int regionid); region_t *findregionbytype(enum REGIONTYPE rtid); regionthing_t *findregionlink(enum REGIONTYPE 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); room_t *findroom(map_t *m, int roomid); map_t *findsurfaceexitmap(map_t *m); void forgetcells(map_t *map, int amt); cell_t *getcellindir(cell_t *cell, int dir); vault_t *getcellvault(cell_t *c); cell_t *getclosestroomcell(lifeform_t *lf, int roomid); int getnewdigdir(cell_t *cell, int lastdir, int turnpct, int *moved); int getobchance(int habitat); int getthingchance(int habitat); cell_t *getrandomadjcell(cell_t *c, int wantempty, int allowexpand); cell_t *real_getrandomadjcell(cell_t *c, int wantempty, int allowexpand, enum LOFTYPE needlof, enum OBTYPE *dontwantob, lifeform_t *preferlos); cell_t *getrandomcell(map_t *map); cell_t *getrandomcelloftype(map_t *map, enum CELLTYPE id); int getrandomdir(int dirtype); int getrandomdirexcept(int dirtype, int exception); cell_t *getrandomroomcell(map_t *map, int roomid); void getroomcells(map_t *m, int roomid, cell_t **retcell, int *ncells); int getslipperyness(cell_t *c, object_t **slipob); cell_t *getstairdestination(object_t *o, int *madenewmap); object_t *hasenterableobject(cell_t *c); object_t *hascloseddoor(cell_t *c); int hascrushableob(cell_t *c, lifeform_t *lf); lifeform_t *haslf(cell_t *c); int hasknownobject(cell_t *c); int hasobject(cell_t *c); object_t *hastrailof(obpile_t *op, lifeform_t *lf, enum OBTYPE oid, flag_t **tflag, lifeform_t *viewer); void initmap(void); void initmaplayout(void); int isadjacent(cell_t *src, cell_t *dst); int isdark(cell_t *c); int isdiggable(cell_t *c); int isdoor(object_t *o, int *isopen); int isempty(cell_t *c); int isinscanrange(cell_t *c, void **thing, char *desc, glyph_t *glyph); int islit(cell_t *c); int isloopdirok(cell_t *cell, int dir); int isnewcellok(cell_t *cell, char *err); int isnighttime(void); int isonmap(map_t *map, int x, int y); int isoutdoors(map_t *m); int isroom(cell_t *c); int iswallindir(cell_t *cell, int dir); void killcell(cell_t *c); void killcelltype(celltype_t *ct); void killfakes(map_t *map, cell_t *cell); void killmap(map_t *m); void killregion(region_t *r); int linkexit(cell_t *c, int wantfilled, int *ncellsadded); int linkexits(map_t *m, int roomid); int linkholes(map_t *map); object_t *linkportal(object_t *srcportal, int wantdepth); int linkstairs(object_t *o, object_t *o2); void makedoor(cell_t *cell, int openchance); void makelit(cell_t *c, enum LIGHTLEV how, int howlong); void makelitradius(cell_t *c, int radius, enum LIGHTLEV how, int howlong); void markroomwalls(map_t *m, room_t *r); void mapentereffects(map_t *m); void moveobtoclearcell(object_t *o); int orthdir(int compassdir); enum RACE parserace(char *name, flagpile_t *wantflags, enum JOB *wantjob, enum SUBJOB *wantsubjob); int remove_deadends(map_t *m, int howmuch); void set_scanned_glyph(int targettype, void *what, char *descappend, char *desc, glyph_t *glyph); void setcellknown(cell_t *cell, int forcelev); void setcellknownradius(cell_t *centre, int forcelev, int radius, int dirtype); void setcelltype(cell_t *cell, enum CELLTYPE id); int shattercell(cell_t *c, lifeform_t *fromlf, char *damstring); int unlinkstairsto(map_t *unlinkmap); void updateknowncells(void); int validateregions(void); int validateregionthing(regionthing_t *thing); int wallstoleftright(cell_t *c, int dir); void writetextonground(lifeform_t *lf, cell_t *c, char *buf, int howlong);