1 // the interface the engine uses to run the gameplay module 2 #ifndef STANDALONE 3 namespace entities 4 { 5 extern int numattrs(int type); 6 extern int triggertime(extentity &e); 7 extern void editent(int i); 8 extern void readent(stream *g, int mtype, int mver, char *gid, int gver, int id); 9 extern void writeent(stream *g, int id); 10 extern void remapents(vector<int> &idxs); 11 extern void initents(int mtype, int mver, char *gid, int gver); 12 extern float dropheight(extentity &e); 13 extern void fixentity(int n, bool recurse = true, bool create = false); 14 extern bool cansee(int n); 15 extern const char *findname(int type); 16 extern int findtype(char *type); 17 extern bool maylink(int type, int ver = 0); 18 extern bool canlink(int index, int node, bool msg = false); 19 extern bool linkents(int index, int node, bool add = true, bool local = true, bool toggle = true); 20 extern extentity *newent(); 21 extern void deleteent(extentity *e); 22 extern void clearents(); 23 extern vector<extentity *> &getents(); 24 extern int lastent(int type); 25 extern void drawparticles(); 26 } 27 28 namespace client 29 { 30 extern int getcn(physent *d); 31 extern int maxmsglen(); 32 extern void gamedisconnect(int clean); 33 extern void parsepacketclient(int chan, packetbuf &p); 34 extern void gameconnect(bool _remote); 35 extern bool allowedittoggle(bool edit); 36 extern void edittoggled(bool edit); 37 extern void toserver(int flags, const char *text, const char *target = NULL); 38 extern void editvar(ident *id, bool local); 39 extern void edittrigger(const selinfo &sel, int op, int arg1 = 0, int arg2 = 0, int arg3 = 0, const VSlot *vs = NULL); 40 extern void changemap(const char *name); 41 extern int waiting(bool state = true); 42 extern void connectattempt(const char *name, int port, const char *password, const ENetAddress &address); 43 extern void connectfail(); 44 extern int state(); 45 extern int otherclients(bool self = false, bool nospec = false); 46 extern int numplayers(); 47 extern int servercompare(serverinfo *a, serverinfo *b); 48 extern const char *getname(); 49 extern bool sendcmd(int nargs, const char *cmd, const char *arg); 50 } 51 52 namespace hud 53 { 54 extern char *progresstex, *progringtex; 55 extern bool hasinput(bool pass = false, bool focus = true); 56 extern bool textinput(const char *str, int len); 57 extern bool keypress(int code, bool isdown); 58 extern void drawhud(bool noview = false); 59 extern void drawlast(); 60 extern float motionblur(float scale); 61 extern bool getcolour(vec &colour); 62 extern void gamemenus(); 63 extern void update(int w, int h); 64 extern bool needminimap(); 65 extern void drawquad(float x, float y, float w, float h, float tx1 = 0, float ty1 = 0, float tx2 = 1, float ty2 = 1, bool flipx = false, bool flipy = false); 66 extern void drawcoord(float x, float y, float w, float h, float tx = 0, float ty = 0, float tw = 1, float th = 1, bool flipx = false, bool flipy = false); 67 extern void drawtexture(float x, float y, float w, float h, bool flipx = false, bool flipy = false); 68 extern void drawsized(float x, float y, float s, bool flipx = false, bool flipy = false); 69 extern void drawblend(int x, int y, int w, int h, float r, float g, float b, bool blend = false); 70 extern void colourskew(float &r, float &g, float &b, float skew = 1); 71 } 72 73 namespace physics 74 { 75 extern int physsteps, physframetime, physinterp; 76 extern float floatspeed, stairheight, floorz, slopez, wallz, stepspeed; 77 extern float liquidmerge(physent *d, float from, float to); 78 extern bool liquidcheck(physent *d); 79 extern float gravityvel(physent *d); 80 extern bool isfloating(physent *d); 81 extern float movevelocity(physent *d, bool floating = false); 82 extern bool issolid(physent *d, physent *e = NULL, bool esc = true, bool impact = true, bool reverse = false); 83 extern bool move(physent *d, vec &dir); 84 extern void move(physent *d, int moveres = 10, bool local = true); 85 extern bool entinmap(physent *d, bool avoidplayers); 86 extern void updatephysstate(physent *d); 87 extern bool droptofloor(vec &o, int type = ENT_CAMERA, float radius = 1, float height = 1); 88 extern bool moveplayer(physent *pl, int moveres, bool local, int millis); 89 extern void interppos(physent *d); 90 extern void updatematerial(physent *pl, const vec ¢er, const vec &bottom, bool local = false); 91 extern bool xcollide(physent *d, const vec &dir, physent *o); 92 extern bool xtracecollide(physent *d, const vec &from, const vec &to, float x1, float x2, float y1, float y2, float maxdist, float &dist, physent *o); 93 extern void complexboundbox(physent *d); 94 } 95 96 namespace game 97 { 98 extern void start(); 99 extern bool clientoption(char *arg); 100 extern void preload(); 101 extern void updateworld(); 102 extern void newmap(int size, const char *mname = ""); 103 extern void resetmap(bool empty); 104 extern void savemap(bool force = false, const char *mname = ""); 105 extern void startmap(bool empty = false); 106 extern bool allowmove(physent *d); 107 extern dynent *iterdynents(int i, bool all = false); 108 extern dynent *focusedent(bool force = false); 109 extern int numdynents(bool all = false); 110 extern vec getpalette(int palette, int index); 111 extern void adddynlights(); 112 extern void particletrack(particle *p, uint type, int &ts, bool step); 113 extern bool mousemove(int dx, int dy, int x, int y, int w, int h); 114 extern void project(int w, int h); 115 extern void recomputecamera(int w, int h); 116 extern int localplayers(); 117 extern const char *gametitle(); 118 extern const char *gametext(); 119 extern int numanims(); 120 extern void findanims(const char *pattern, vector<int> &anims); 121 extern void render(); 122 extern void renderavatar(bool early = false, bool project = false); 123 extern void renderplayerpreview(int model = 0, int color = 0xA0A0A0, int team = 0, int weap = 0, const char *vanity = "", float scale = 1, float blend = 1); 124 extern bool thirdpersonview(bool viewonly = false, physent *d = NULL); 125 extern vec thirdpos(const vec &pos, float yaw, float pitch, float dist = 1, float side = 0); 126 extern vec camerapos(physent *d, bool hasfoc = false, bool hasyp = false, float yaw = 0, float pitch = 0); 127 extern void start(); 128 } 129 #endif 130 namespace server 131 { 132 extern bool updatecontrols; 133 extern void start(); 134 extern void reload(); 135 extern void shutdown(); 136 extern void ancmsgft(int cn, int snd, int conlevel, const char *s, ...); 137 extern void srvmsgft(int cn, int conlevel, const char *s, ...); 138 extern void srvmsgf(int cn, const char *s, ...); 139 extern void srvoutf(int r, const char *s, ...); 140 extern bool serveroption(char *arg); 141 extern void *newinfo(); 142 extern void deleteinfo(void *ci); 143 extern int numclients(int exclude = -1, bool nospec = false, int actortype = -1); 144 extern int reserveclients(); 145 extern int numchannels(); 146 extern int dupclients(); 147 extern void clientdisconnect(int n, bool local = false, int reason = DISC_NONE); 148 extern int clientconnect(int n, uint ip, bool local = false); 149 extern bool allowbroadcast(int n); 150 extern int peerowner(int n); 151 extern void recordpacket(int chan, void *data, int len); 152 extern void parsepacket(int sender, int chan, packetbuf &p); 153 extern bool sendpackets(bool force = false); 154 extern void queryreply(ucharbuf &req, ucharbuf &p); 155 extern void serverupdate(); 156 extern const char *gameid(); 157 extern int getver(int n = 0); 158 extern const char *pickmap(const char *suggest = NULL, int mode = -1, int muts = -1, bool notry = false); 159 extern const char *choosemap(const char *suggest = NULL, int mode = -1, int muts = -1, int force = 0, bool notry = false); 160 extern void changemap(const char *name = NULL, int mode = -1, int muts = -1); 161 extern bool canload(const char *type); 162 extern bool rewritecommand(ident *id, tagval *args, int numargs); 163 extern void processmasterinput(const char *cmd, int cmdlen, const char *args); 164 extern void masterconnected(); 165 extern void masterdisconnected(); 166 } 167