quakedef.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. /*
  2. GNU General Public License version 3 notice
  3. Copyright (C) 2012 Mihawk <luiz@netdome.biz>. All rights reserved.
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see < http://www.gnu.org/licenses/ >.
  14. */
  15. #ifndef QUAKEDEF_H
  16. #define QUAKEDEF_H
  17. // for chunked downloads
  18. #define MAXBLOCKS 1024 // Must be power of 2
  19. #define DLBLOCKSIZE 1024
  20. #define DL_QWCHUNKS 2
  21. /* Needed definitions taken from EZQuake Source */
  22. typedef float vec3_t[3];
  23. typedef struct
  24. {
  25. int number; // edict index
  26. int flags; // nolerp, etc
  27. vec3_t origin;
  28. vec3_t angles;
  29. int modelindex;
  30. int frame;
  31. int colormap;
  32. int skinnum;
  33. int effects;
  34. } entityState_t;
  35. #define MAX_PACKET_ENTITIES 64
  36. typedef struct
  37. {
  38. int numentities;
  39. entityState_t entities[MAX_PACKET_ENTITIES];
  40. } packetEntities_t;
  41. #define PROTOCOL_VERSION 28
  42. #define PROTOCOL_VERSION_FTE (('F'<<0) + ('T'<<8) + ('E'<<16) + ('X' << 24)) //fte extensions.
  43. #define PROTOCOL_VERSION_FTE2 (('F'<<0) + ('T'<<8) + ('E'<<16) + ('2' << 24)) //fte extensions.
  44. #ifdef PROTOCOL_VERSION_FTE
  45. #define FTE_PEXT_TRANS 0x00000008 // .alpha support
  46. #define FTE_PEXT_HLBSP 0x00000200 //stops fte servers from complaining
  47. #define FTE_PEXT_MODELDBL 0x00001000
  48. #define FTE_PEXT_ENTITYDBL 0x00002000 //max of 1024 ents instead of 512
  49. #define FTE_PEXT_ENTITYDBL2 0x00004000 //max of 1024 ents instead of 512
  50. #define FTE_PEXT_FLOATCOORDS 0x00008000 //supports floating point origins.
  51. #define FTE_PEXT_SPAWNSTATIC2 0x00400000 //Sends an entity delta instead of a baseline.
  52. #define FTE_PEXT_256PACKETENTITIES 0x01000000 //Client can recieve 256 packet entities.
  53. #define FTE_PEXT_CHUNKEDDOWNLOADS 0x20000000 //alternate file download method. Hopefully it'll give quadroupled download speed, especially on higher pings.
  54. #endif // PROTOCOL_VERSION_FTE
  55. #ifdef PROTOCOL_VERSION_FTE2
  56. #define FTE_PEXT2_VOICECHAT 0x00000002
  57. #endif // PROTOCOL_VERSION_FTE2
  58. #ifdef PROTOCOL_VERSION_FTE
  59. #define U_FTE_EVENMORE (1<<7) //extension info follows
  60. //EVENMORE flags
  61. #ifdef FTE_PEXT_SCALE
  62. #define U_FTE_SCALE (1<<0) //scaler of alias models
  63. #endif
  64. #ifdef FTE_PEXT_TRANS
  65. #define U_FTE_TRANS (1<<1) //transparency value
  66. #endif
  67. #ifdef FTE_PEXT_TRANS
  68. #define PF_TRANS_Z (1<<17)
  69. #endif
  70. #ifdef FTE_PEXT_FATNESS
  71. #define U_FTE_FATNESS (1<<2) //byte describing how fat an alias model should be.
  72. //moves verticies along normals
  73. // Useful for vacuum chambers...
  74. #endif
  75. #ifdef FTE_PEXT_MODELDBL
  76. #define U_FTE_MODELDBL (1<<3) //extra bit for modelindexes
  77. #endif
  78. #define U_FTE_UNUSED1 (1<<4)
  79. #ifdef FTE_PEXT_ENTITYDBL
  80. #define U_FTE_ENTITYDBL (1<<5) //use an extra byte for origin parts, cos one of them is off
  81. #endif
  82. #ifdef FTE_PEXT_ENTITYDBL2
  83. #define U_FTE_ENTITYDBL2 (1<<6) //use an extra byte for origin parts, cos one of them is off
  84. #endif
  85. #define U_FTE_YETMORE (1<<7) //even more extension info stuff.
  86. #define U_FTE_DRAWFLAGS (1<<8) //use an extra qbyte for origin parts, cos one of them is off
  87. #define U_FTE_ABSLIGHT (1<<9) //Force a lightlevel
  88. #define U_FTE_COLOURMOD (1<<10) //rgb
  89. #define U_FTE_DPFLAGS (1<<11)
  90. #define U_FTE_TAGINFO (1<<12)
  91. #define U_FTE_LIGHT (1<<13)
  92. #define U_FTE_EFFECTS16 (1<<14)
  93. #define U_FTE_FARMORE (1<<15)
  94. #endif
  95. #define QW_CHECK_HASH 0x5157
  96. //=========================================
  97. #define PORT_CLIENT 27001
  98. #define PORT_MASTER 27000
  99. #define PORT_SERVER 27500
  100. // out of band message id bytes
  101. // M = master, S = server, C = client, A = any
  102. // the second character will always be \n if the message isn't a single
  103. // byte long (?? not true anymore?)
  104. #define S2C_CHALLENGE 'c'
  105. #define S2C_CONNECTION 'j'
  106. #define A2A_PING 'k' // respond with an A2A_ACK
  107. #define A2A_ACK 'l' // general acknowledgement without info
  108. #define A2A_NACK 'm' // [+ comment] general failure
  109. #define A2A_ECHO 'e' // for echoing
  110. #define A2C_PRINT 'n' // print a message on client
  111. #define S2M_HEARTBEAT 'a' // + serverinfo + userlist + fraglist
  112. #define A2C_CLIENT_COMMAND 'B' // + command line
  113. #define S2M_SHUTDOWN 'C'
  114. //
  115. // server to client
  116. //
  117. #define svc_bad 0
  118. #define svc_nop 1
  119. #define svc_disconnect 2
  120. #define svc_updatestat 3 // [byte] [byte]
  121. #define nq_svc_version 4 // [long] server version
  122. #define svc_setview 5 // [short] entity number
  123. #define svc_sound 6 // <see code>
  124. #define nq_svc_time 7 // [float] server time
  125. #define svc_print 8 // [byte] id [string] null terminated string
  126. #define svc_stufftext 9 // [string] stuffed into client's console buffer
  127. #define svc_setangle 10 // [angle3] set the view angle to this absolute value
  128. #define svc_serverdata 11 // [long] protocol ...
  129. #define svc_lightstyle 12 // [byte] [string]
  130. #define nq_svc_updatename 13 // [byte] [string]
  131. #define svc_updatefrags 14 // [byte] [short]
  132. #define nq_svc_clientdata 15 // <shortbits + data>
  133. #define svc_stopsound 16 // <see code>
  134. #define nq_svc_updatecolors 17 // [byte] [byte] [byte]
  135. #define nq_svc_particle 18 // [vec3] <variable>
  136. #define svc_damage 19
  137. #define svc_spawnstatic 20
  138. #define svc_fte_spawnstatic2 21 // @!@!@!
  139. #define svc_spawnbaseline 22
  140. #define svc_temp_entity 23 // variable
  141. #define svc_setpause 24 // [byte] on / off
  142. #define nq_svc_signonnum 25 // [byte] used for the signon sequence
  143. #define svc_centerprint 26 // [string] to put in center of the screen
  144. #define svc_killedmonster 27
  145. #define svc_foundsecret 28
  146. #define svc_spawnstaticsound 29 // [coord3] [byte] samp [byte] vol [byte] aten
  147. #define svc_intermission 30 // [vec3_t] origin [vec3_t] angle
  148. #define svc_finale 31 // [string] text
  149. #define svc_cdtrack 32 // [byte] track
  150. #define svc_sellscreen 33
  151. #define svc_smallkick 34 // set client punchangle to 2
  152. #define svc_bigkick 35 // set client punchangle to 4
  153. #define svc_updateping 36 // [byte] [short]
  154. #define svc_updateentertime 37 // [byte] [float]
  155. #define svc_updatestatlong 38 // [byte] [long]
  156. #define svc_muzzleflash 39 // [short] entity
  157. #define svc_updateuserinfo 40 // [byte] slot [long] uid
  158. #define svc_download 41 // [short] size [size bytes]
  159. #define svc_playerinfo 42 // variable
  160. #define svc_nails 43 // [byte] num [48 bits] xyzpy 12 12 12 4 8
  161. #define svc_chokecount 44 // [byte] packets choked
  162. #define svc_modellist 45 // [strings]
  163. #define svc_soundlist 46 // [strings]
  164. #define svc_packetentities 47 // [...]
  165. #define svc_deltapacketentities 48 // [...]
  166. #define svc_maxspeed 49 // maxspeed change, for prediction
  167. #define svc_entgravity 50 // gravity change, for prediction
  168. #define svc_setinfo 51 // setinfo on a client
  169. #define svc_serverinfo 52 // serverinfo
  170. #define svc_updatepl 53 // [byte] [byte]
  171. #define svc_nails2 54 // [byte] num [52 bits] nxyzpy 8 12 12 12 4 8
  172. #define svc_fte_modellistshort 60 // [strings]
  173. #define svc_fte_spawnbaseline2 66
  174. #define svc_qizmovoice 83
  175. #define svc_fte_voicechat 84
  176. //
  177. // client to server
  178. //
  179. #define clc_bad 0
  180. #define clc_nop 1
  181. #define clc_move 3 // [[usercmd_t]
  182. #define clc_stringcmd 4 // [string] message
  183. #define clc_delta 5 // [byte] sequence number, requests delta compression of message
  184. #define clc_tmove 6 // teleport request, spectator only
  185. #define clc_upload 7 // teleport request, spectator only
  186. typedef struct userCmd_s
  187. {
  188. unsigned char msec;
  189. float angles[3];
  190. short forwardmove, sidemove, upmove;
  191. unsigned char buttons;
  192. unsigned char impulse;
  193. } userCmd_t;
  194. #define PF_MSEC (1<<0)
  195. #define PF_COMMAND (1<<1)
  196. #define PF_VELOCITY1 (1<<2)
  197. #define PF_VELOCITY2 (1<<3)
  198. #define PF_VELOCITY3 (1<<4)
  199. #define PF_MODEL (1<<5)
  200. #define PF_SKINNUM (1<<6)
  201. #define PF_EFFECTS (1<<7)
  202. #define PF_WEAPONFRAME (1<<8) // only sent for view player
  203. #define PF_DEAD (1<<9) // don't block movement any more
  204. #define PF_GIB (1<<10) // offset the view height differently
  205. #define PF_NOGRAV (1<<11) // don't apply gravity for prediction
  206. #define CM_ANGLE1 (1<<0)
  207. #define CM_ANGLE3 (1<<1)
  208. #define CM_FORWARD (1<<2)
  209. #define CM_SIDE (1<<3)
  210. #define CM_UP (1<<4)
  211. #define CM_BUTTONS (1<<5)
  212. #define CM_IMPULSE (1<<6)
  213. #define CM_ANGLE2 (1<<7)
  214. #define U_ORIGIN1 (1<<9)
  215. #define U_ORIGIN2 (1<<10)
  216. #define U_ORIGIN3 (1<<11)
  217. #define U_ANGLE2 (1<<12)
  218. #define U_FRAME (1<<13)
  219. #define U_REMOVE (1<<14) // REMOVE this entity, don't add it
  220. #define U_MOREBITS (1<<15)
  221. #define U_ANGLE1 (1<<0)
  222. #define U_ANGLE3 (1<<1)
  223. #define U_MODEL (1<<2)
  224. #define U_COLORMAP (1<<3)
  225. #define U_SKIN (1<<4)
  226. #define U_EFFECTS (1<<5)
  227. #define U_SOLID (1<<6) // the entity should be solid for prediction
  228. #define SND_VOLUME (1<<15) // a byte
  229. #define SND_ATTENUATION (1<<14) // a byte
  230. #define TE_SPIKE 0
  231. #define TE_SUPERSPIKE 1
  232. #define TE_GUNSHOT 2
  233. #define TE_EXPLOSION 3
  234. #define TE_TAREXPLOSION 4
  235. #define TE_LIGHTNING1 5
  236. #define TE_LIGHTNING2 6
  237. #define TE_WIZSPIKE 7
  238. #define TE_KNIGHTSPIKE 8
  239. #define TE_LIGHTNING3 9
  240. #define TE_LAVASPLASH 10
  241. #define TE_TELEPORT 11
  242. #define TE_BLOOD 12
  243. #define TE_LIGHTNINGBLOOD 13
  244. #define BSPVERSION 29
  245. #define MAX_MAP_HULLS 4
  246. typedef struct
  247. {
  248. int fileofs, filelen;
  249. } lump_t;
  250. #define LUMP_ENTITIES 0
  251. #define LUMP_PLANES 1
  252. #define LUMP_TEXTURES 2
  253. #define LUMP_VERTEXES 3
  254. #define LUMP_VISIBILITY 4
  255. #define LUMP_NODES 5
  256. #define LUMP_TEXINFO 6
  257. #define LUMP_FACES 7
  258. #define LUMP_LIGHTING 8
  259. #define LUMP_CLIPNODES 9
  260. #define LUMP_LEAFS 10
  261. #define LUMP_MARKSURFACES 11
  262. #define LUMP_EDGES 12
  263. #define LUMP_SURFEDGES 13
  264. #define LUMP_MODELS 14
  265. #define HEADER_LUMPS 15
  266. typedef struct
  267. {
  268. float mins[3], maxs[3];
  269. float origin[3];
  270. int headnode[MAX_MAP_HULLS];
  271. int visleafs; // not including the solid leaf 0
  272. int firstface, numfaces;
  273. } dmodel_t;
  274. typedef struct
  275. {
  276. int version;
  277. lump_t lumps[HEADER_LUMPS];
  278. } dheader_t;
  279. #define MAX_MSGLEN 2048
  280. #endif // QUAKEDEF_H