1 /* 2 This program is free software; you can redistribute it and/or 3 modify it under the terms of the GNU General Public License 4 as published by the Free Software Foundation; either version 2 5 of the License, or (at your option) any later version. 6 7 This program is distributed in the hope that it will be useful, 8 but WITHOUT ANY WARRANTY; without even the implied warranty of 9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 11 See the GNU General Public License for more details. 12 13 You should have received a copy of the GNU General Public License 14 along with this program; if not, write to the Free Software 15 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 17 $Id$ 18 */ 19 20 #ifndef __WORLD_H__ 21 #define __WORLD_H__ 22 23 // player_state_t is the information needed by a player entity 24 // to do move prediction and to generate a drawable entity 25 typedef struct 26 { 27 int messagenum; // all player's won't be updated each frame 28 29 usercmd_t command; // last command for prediction 30 31 vec3_t origin; 32 vec3_t viewangles; // only for demos, not from server 33 vec3_t velocity; 34 int weaponframe; 35 36 int modelindex; 37 int frame; 38 int skinnum; 39 int effects; 40 41 int flags; // dead, gib, etc 42 int msec; 43 } player_state_t; 44 45 46 #define MAX_SCOREBOARDNAME 16 47 typedef struct player_info_s 48 { 49 char userinfo[MAX_EXT_INFO_STRING]; 50 char name[MAX_SCOREBOARDNAME]; 51 int stats[MAX_CL_STATS]; // health, etc 52 qbool spectator; 53 int lastsource; 54 } player_info_t; 55 56 typedef struct 57 { 58 vec3_t origin; 59 vec3_t angles; 60 int weaponframe; 61 int skinnum; 62 int model; 63 int effects; 64 int parsecount; 65 } demoinfo_t; 66 67 typedef struct 68 { 69 int modelindex; 70 vec3_t origin; 71 vec3_t angles; 72 int num; 73 } projectile_t; 74 75 #define MAX_PROJECTILES 32 76 77 typedef struct 78 { 79 // generated on client side 80 usercmd_t cmd; // cmd that generated the frame 81 double senttime; // time cmd was sent off 82 int delta_sequence; // sequence number to delta from, -1 = full update 83 84 // received from server 85 double receivedtime; // time message was received, or -1 86 player_state_t playerstate[MAX_CLIENTS]; // message received that reflects performing 87 qbool fixangle[MAX_CLIENTS]; 88 // the usercmd 89 packet_entities_t packet_entities; 90 qbool invalid; // true if the packet_entities delta was invalid 91 sizebuf_t buf; 92 projectile_t projectiles[MAX_PROJECTILES]; 93 int num_projectiles; 94 int parsecount; 95 float latency; 96 float time; 97 } frame_t; 98 99 100 typedef struct 101 { 102 int length; 103 char map[MAX_STYLESTRING]; 104 } lightstyle_t; 105 106 #define MAX_EFRAGS 512 107 108 #define MAX_DEMOS 8 109 #define MAX_DEMONAME 16 110 111 typedef struct 112 { 113 qbool interpolate; 114 vec3_t origin; 115 vec3_t angles; 116 int oldindex; 117 } interpolate_t; 118 119 typedef struct 120 { 121 FILE *file; 122 char path[MAX_OSPATH]; 123 char name[MAX_OSPATH]; 124 long filesize; 125 } file_t; 126 127 typedef struct 128 { 129 FILE *file; 130 char name[MAX_OSPATH]; 131 132 int frags[MAX_CLIENTS]; 133 int total_clients; 134 int total_spectators; 135 int teamfrags[MAX_CLIENTS]; 136 int deathmach; 137 int teamplay; 138 char *povs[MAX_CLIENTS]; 139 int timelimit; 140 int fraglimit; 141 float demotime; 142 int demofps; 143 } analyse_t; 144 145 typedef struct 146 { 147 int servercount; // server identification for prespawns 148 char mapname[64]; // full map name 149 char serverinfo[MAX_SERVERINFO_STRING]; 150 int parsecount; // server message counter 151 int delta_sequence; 152 int validsequence; // this is the sequence number of the last good 153 // packetentity_t we got. If this is 0, we can't 154 // render a frame yet 155 int lastwritten; 156 frame_t frames[UPDATE_BACKUP]; 157 158 player_info_t players[MAX_CLIENTS]; 159 qbool signonloaded; 160 161 demoinfo_t demoinfo[MAX_CLIENTS]; 162 float time; 163 long oldftell; 164 int percentage; 165 long demossize; 166 int running; 167 sizebuf_t messages; 168 byte buffer[45*MAX_MSGLEN]; 169 int lastmarged; 170 qbool signonstats; 171 } world_state_t; 172 173 typedef struct 174 { 175 int options; // QWDTools options 176 int fps; 177 int msglevel; 178 file_t debug; 179 file_t log; 180 file_t from[MAX_CLIENTS]; 181 file_t demo; 182 analyse_t analyse; 183 int sources; 184 int count; 185 int fromcount; 186 flist_t filelist[50]; 187 int range; 188 } static_world_state_t; 189 190 extern char qizmoDir[MAX_OSPATH]; 191 extern char outputDir[MAX_OSPATH]; 192 extern world_state_t world; 193 extern static_world_state_t sworld; 194 extern lightstyle_t lightstyle[MAX_LIGHTSTYLES]; 195 extern entity_state_t baselines[MAX_EDICTS]; 196 197 #endif /* !__WORLD_H__ */ 198