Initial sauer
[SauerbratenRemote.git] / src / shared / igame.h
blob0ce0d27b2cdd037e3b4ebb3ae07f537ab4678996
1 // the interface the engine uses to run the gameplay module
3 struct icliententities
5 virtual ~icliententities() {}
7 virtual void editent(int i) = 0;
8 virtual const char *entnameinfo(entity &e) = 0;
9 virtual const char *entname(int i) = 0;
10 virtual int extraentinfosize() = 0;
11 virtual void writeent(entity &e, char *buf) = 0;
12 virtual void readent(entity &e, char *buf) = 0;
13 virtual float dropheight(entity &e) = 0;
14 virtual void rumble(const extentity &e) = 0;
15 virtual void trigger(extentity &e) = 0;
16 virtual void fixentity(extentity &e) = 0;
17 virtual void entradius(extentity &e, float &radius, float &angle, vec &dir) {}
18 virtual bool mayattach(extentity &e) { return false; }
19 virtual bool attachent(extentity &e, extentity &a) { return false; }
20 virtual extentity *newentity() = 0;
21 virtual vector<extentity *> &getents() = 0;
24 struct iclientcom
26 virtual ~iclientcom() {}
28 virtual void gamedisconnect() = 0;
29 virtual void parsepacketclient(int chan, ucharbuf &p) = 0;
30 virtual int sendpacketclient(ucharbuf &p, bool &reliable, dynent *d) = 0;
31 virtual void gameconnect(bool _remote) = 0;
32 virtual bool allowedittoggle() = 0;
33 virtual void edittoggled(bool on) {}
34 virtual void writeclientinfo(FILE *f) = 0;
35 virtual void toserver(char *text) = 0;
36 virtual void changemap(const char *name) = 0;
37 virtual int numchannels() { return 1; }
40 struct igameclient
42 virtual ~igameclient() {}
44 virtual const char *gameident() = 0;
45 virtual const char *defaultmap() = 0;
46 virtual const char *savedconfig() = 0;
47 virtual const char *defaultconfig() = 0;
48 virtual const char *autoexec() = 0;
49 virtual const char *savedservers() { return NULL; }
51 virtual icliententities *getents() = 0;
52 virtual iclientcom *getcom() = 0;
54 virtual bool clientoption(char *arg) { return false; }
55 virtual void updateworld(vec &pos, int curtime, int lm) = 0;
56 virtual void initclient() = 0;
57 virtual void physicstrigger(physent *d, bool local, int floorlevel, int waterlevel) = 0;
58 virtual void edittrigger(const selinfo &sel, int op, int arg1 = 0, int arg2 = 0, int arg3 = 0) = 0;
59 virtual char *getclientmap() = 0;
60 virtual void resetgamestate() = 0;
61 virtual void suicide(physent *d) = 0;
62 virtual void newmap(int size) = 0;
63 virtual void startmap(const char *name) = 0;
64 virtual void preload() {}
65 virtual void gameplayhud(int w, int h) = 0;
66 virtual void drawhudgun() = 0;
67 virtual bool canjump() = 0;
68 virtual bool allowmove(physent *d) { return true; }
69 virtual void doattack(bool on) = 0;
70 virtual dynent *iterdynents(int i) = 0;
71 virtual int numdynents() = 0;
72 virtual void rendergame() = 0;
73 virtual void writegamedata(vector<char> &extras) = 0;
74 virtual void readgamedata(vector<char> &extras) = 0;
75 virtual void g3d_gamemenus() = 0;
76 virtual void crosshaircolor(float &r, float &g, float &b) {}
77 virtual void lighteffects(dynent *d, vec &color, vec &dir) {}
78 virtual void setupcamera() {}
79 virtual void adddynlights() {}
80 virtual void particletrack(physent *owner, vec &o, vec &d) {}
81 };
83 struct igameserver
85 virtual ~igameserver() {}
87 virtual bool serveroption(char *arg) { return false; }
88 virtual void *newinfo() = 0;
89 virtual void deleteinfo(void *ci) = 0;
90 virtual void serverinit() = 0;
91 virtual void clientdisconnect(int n) = 0;
92 virtual int clientconnect(int n, uint ip) = 0;
93 virtual void localdisconnect(int n) = 0;
94 virtual void localconnect(int n) = 0;
95 virtual const char *servername() = 0;
96 virtual void recordpacket(int chan, void *data, int len) {}
97 virtual void parsepacket(int sender, int chan, bool reliable, ucharbuf &p) = 0;
98 virtual bool sendpackets() = 0;
99 virtual int welcomepacket(ucharbuf &p, int n) = 0;
100 virtual void serverinforeply(ucharbuf &p) = 0;
101 virtual void serverupdate(int lastmillis, int totalmillis) = 0;
102 virtual bool servercompatible(char *name, char *sdec, char *map, int ping, const vector<int> &attr, int np) = 0;
103 virtual void serverinfostr(char *buf, const char *name, const char *desc, const char *map, int ping, const vector<int> &attr, int np) = 0;
104 virtual int serverinfoport() = 0;
105 virtual int serverport() = 0;
106 virtual const char *getdefaultmaster() = 0;
107 virtual void sendservmsg(const char *s) = 0;
110 struct igame
112 virtual ~igame() {}
114 virtual igameclient *newclient() = 0;
115 virtual igameserver *newserver() = 0;