232 lines
13 KiB
C
Executable File
232 lines
13 KiB
C
Executable File
#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, int stairsinrooms, enum TEMPERATURE temp);
|
|
void addhomeobs(lifeform_t *lf, int dolevelobs);
|
|
map_t *addmap(void);
|
|
lifeform_t *addmonster(cell_t *c, enum RACE rid, char *racename, int randomjobok, int amt, int autogen, int allowextras, int *nadded);
|
|
object_t *addrandomob(cell_t *c);
|
|
int addrandomthing(cell_t *c, int obchance, int *nadded);
|
|
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);
|
|
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 adjustcellglyph(cell_t *c, glyph_t *g, enum CELLADJUSTTYPE how);
|
|
int autodoors(map_t *map, int roomid, int minx, int miny, int maxx, int maxy, int doorpct, int dooropenchance);
|
|
void breakwall(cell_t *c, char *why, ...);
|
|
int cellhaslos(cell_t *c1, cell_t *dest);
|
|
int cellisfixedvaultwall(cell_t *c);
|
|
//int cellmatchescondition(cell_t *c, int wecond);
|
|
int cellmeetscondition(cell_t *c, enum CELLCONDITION cond, int arg, int value);
|
|
int cellmeets(cell_t *c, condset_t *cs);
|
|
int cellokforreachability(cell_t *startcell, cell_t *c, int srcroomid, int dir, int wantfilled, int *insameroom, char *why);
|
|
enum CELLTYPE celltypefromvault(cell_t *c);
|
|
void clearcellstrings(cell_t *c);
|
|
void clearcell(cell_t *c);
|
|
void clearcell_exceptflags(cell_t *c, ...);
|
|
int delve(map_t *map, int neighbourmin, int neighbourmax, int connchance, int chancepct, int newneighbourmin, int newneighbourmax, int newconnchance, enum CELLTYPE empty, enum CELLTYPE solid);
|
|
int delve_countadjgroups(cell_t *centre, enum CELLTYPE ct);
|
|
int delve_cuberoot(int num);
|
|
int delve_digcell(cellstore_t *cs, cell_t *centre, enum CELLTYPE empty, enum CELLTYPE solid);
|
|
cellstore_t *delve_makecellstore(int maxsize);
|
|
void delve_killcellstore(cellstore_t *cs);
|
|
cell_t *delve_rndpull(cellstore_t *cs, cell_t **c);
|
|
void delve_storecell(cellstore_t *cs, cell_t *c);
|
|
int damagecell(cell_t *c, int amt, enum DAMTYPE damtype, lifeform_t *fromlf);
|
|
int doelementspread(cell_t *c);
|
|
int dodoorfill(cell_t *c);
|
|
void doorfill_r(cell_t *startcell, cell_t *c, int *nfilled);
|
|
int fix_reachability(map_t *m);
|
|
int fix_unreach_via_doors(map_t *m);
|
|
void floodfill(cell_t *startcell);
|
|
int getbranchlinks(regionthing_t **thing, int *nthings, ...);
|
|
cell_t *getcell_cond(map_t *map, condset_t *cs );
|
|
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);
|
|
int getmidtemp(enum TEMPERATURE temp);
|
|
enum DEPTH getcellwaterdepth(cell_t *c, lifeform_t *lf);
|
|
int getconnectedwatercells(cell_t *c, cell_t **retcell, int *ncells);
|
|
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, int includefixed);
|
|
cell_t *getroommidcell(map_t *m, int roomid);
|
|
void gettemprange(enum TEMPERATURE temp, int *min, int *max);
|
|
enum TEMPERATURE gettempbracket(int temp);
|
|
enum TIMEPHASE gettimephase(void);
|
|
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 stayclose);
|
|
int compassdir(int orthdir);
|
|
int countadjcellsoftype(cell_t *cell, enum CELLTYPE id, int dirtype);
|
|
int countadjrooms(cell_t *cell, int dirtype);
|
|
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 createantnest(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *entryob);
|
|
void createborder(map_t *map, enum CELLTYPE solidtype);
|
|
void createbyhut(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *entryob);
|
|
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 createicecave(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 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);
|
|
int createportallink(cell_t *c1, cell_t *c2, enum OBTYPE portalid);
|
|
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);
|
|
int calcposandmakeroom(map_t *map, int roomid, int overrideminw, int overrideminh, int overridemaxw, int overridemaxh, int xmargin, int ymargin, int *retx, int *rety, int *retw, int *reth, int doorpct, int dooropenchance, int forcewalls, int stayclose);
|
|
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);
|
|
int doorisvalid(object_t *o);
|
|
void dumpmap(map_t *map, int showrooms, char *reasontext);
|
|
void expand_cave(map_t *map, int numpasses);
|
|
void explodesinglecell(cell_t *c, int dam, int killwalls, object_t *o, cell_t *centre, lifeform_t *fromwho, int doknockback);
|
|
void explodecells(cell_t *c, int dam, int killwalls, object_t *o, int range, int dirtype, int wantannounce, lifeform_t *fromwho);
|
|
void explosion_knockback(cell_t *c, int radius, int dirtype, int dam, lifeform_t *fromwho);
|
|
int finalisemap(map_t *map, object_t *entryob, int exitdir);
|
|
void finalisemonster(lifeform_t *lf, lifeform_t *leader, flagpile_t *wantflags, enum BEHAVIOUR wantbehaviour, 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);
|
|
regionoutline_t *findoutlineforbranch(enum BRANCH bid);
|
|
branch_t *findrandombranchwithname(char *name);
|
|
region_t *findregion(int regionid);
|
|
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);
|
|
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);
|
|
cell_t *getcellindir(cell_t *cell, int dir);
|
|
enum TEMPERATURE getcelltemp(cell_t *c, int *actualtemp);
|
|
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, condset_t *cs, int allowexpand);
|
|
cell_t *real_getrandomadjcell(cell_t *c, condset_t *cs, int allowexpand, enum LOFTYPE needlof, cell_t *dontwantcell, lifeform_t *preferlos);
|
|
cell_t *getrandomcell(map_t *map);
|
|
cell_t *getrandomcell_forteleport(map_t *map, lifeform_t *lf);
|
|
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, int wantempty);
|
|
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 *hasdoor(cell_t *c);
|
|
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);
|
|
vault_t *maphasvault(map_t *m, char *id);
|
|
object_t *hastrailof(obpile_t *op, lifeform_t *lf, int 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, enum OBTYPE withwhat);
|
|
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 isdaytime(void);
|
|
int isnighttime(void);
|
|
int isonmap(map_t *map, int x, int y);
|
|
int isoutdoors(map_t *m);
|
|
int isroom(cell_t *c);
|
|
int issolid(cell_t *c);
|
|
int iswallindir(cell_t *cell, int dir);
|
|
void killbranch(branch_t *b);
|
|
void killcell(cell_t **c);
|
|
void killcelltype(celltype_t *ct);
|
|
void killfakes(map_t *map, cell_t *cell);
|
|
void killhabitat(habitat_t *h);
|
|
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 *linkportaltodepth(object_t *srcportal, int wantdepth);
|
|
int linkportals(object_t *srcportal, object_t *dstportal);
|
|
int linkstairs(object_t *o, object_t *o2);
|
|
void makedoor(cell_t *cell, int openchance);
|
|
void makelit(cell_t *c, enum OBTYPE how, int howlong, int power);
|
|
void makelitradius(cell_t *c, int radius, enum OBTYPE how, int howlong, int power);
|
|
void markroomwalls(map_t *m, room_t *r);
|
|
void mapentereffects(map_t *m);
|
|
void modcelltemp(cell_t *c, int howmuch);
|
|
void modillumination(map_t *m, int dir);
|
|
void moveobtoclearcell(object_t *o);
|
|
int orthdir(int compassdir);
|
|
enum RACE parserace(char *name, flagpile_t *wantflags, condset_t *cs, enum JOB *wantjob, enum BEHAVIOUR *wantbehaviour);
|
|
int remove_deadends(map_t *m, int howmuch);
|
|
int remove_baddoors(map_t *m);
|
|
int remove_smallrooms(map_t *m);
|
|
void selectcelltypes(map_t *map, int solchance, int empchance, enum CELLTYPE *sol, enum CELLTYPE *emp);
|
|
void set_scanned_glyph(int targettype, void *what, char *descappend, char *desc, glyph_t *glyph);
|
|
void setcellknown_fake(cell_t *cell, enum CELLTYPE ctid);
|
|
void setcellknown(cell_t *cell, int forcelev);
|
|
void setcellknownradius(cell_t *centre, int forcelev, int radius, int dirtype);
|
|
void setcelllocked(cell_t *c, char *why, ...);
|
|
void setcellreason(cell_t *c, char *why, ...);
|
|
void setcelltype(cell_t *cell, enum CELLTYPE id);
|
|
int shattercell(cell_t *c, lifeform_t *fromlf, char *damstring);
|
|
int shuffledown(map_t *map);
|
|
int smallroomat(cell_t *where);
|
|
int unlinkstairsto(map_t *unlinkmap);
|
|
void unmakemap(map_t *map);
|
|
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);
|