2004-02-20 02:39:34 +00:00
|
|
|
/*
|
2005-06-09 03:07:13 +00:00
|
|
|
server.h
|
2004-02-20 02:39:34 +00:00
|
|
|
|
2005-06-09 03:07:13 +00:00
|
|
|
quakeworld server processing
|
2004-02-20 02:39:34 +00:00
|
|
|
|
2005-06-09 03:07:13 +00:00
|
|
|
Copyright (C) 2004 Bill Currie <bill@taniwha.org>
|
2004-02-20 02:39:34 +00:00
|
|
|
|
2005-06-09 03:07:13 +00:00
|
|
|
Author: Bill Currie
|
|
|
|
Date: 2004/02/20
|
2004-02-20 02:39:34 +00:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __server_h
|
|
|
|
#define __server_h
|
|
|
|
|
|
|
|
#include "netchan.h"
|
2010-08-24 00:53:54 +00:00
|
|
|
#include "qw/bothdefs.h"
|
2005-05-02 04:09:15 +00:00
|
|
|
#include "qw/pmove.h"
|
2004-02-20 02:39:34 +00:00
|
|
|
|
2005-05-07 13:57:07 +00:00
|
|
|
struct client_s;
|
|
|
|
|
2005-05-07 05:13:37 +00:00
|
|
|
typedef struct player_s {
|
|
|
|
struct player_s *next; // for multicast messages
|
2005-05-06 08:19:26 +00:00
|
|
|
struct info_s *info;
|
2005-05-07 05:13:37 +00:00
|
|
|
int stats[MAX_CL_STATS];
|
|
|
|
int uid;
|
|
|
|
int ping;
|
|
|
|
int pl;
|
|
|
|
int frags;
|
2005-05-09 14:49:54 +00:00
|
|
|
int time;
|
2005-05-06 08:19:26 +00:00
|
|
|
|
2005-05-07 05:13:37 +00:00
|
|
|
plent_state_t ent;
|
|
|
|
} player_t;
|
|
|
|
|
|
|
|
typedef struct frame_s {
|
|
|
|
int delta_sequence;
|
2023-06-13 09:06:11 +00:00
|
|
|
bool invalid;
|
2005-05-07 05:13:37 +00:00
|
|
|
packet_players_t players;
|
|
|
|
packet_entities_t entities;
|
|
|
|
} frame_t;
|
|
|
|
|
2012-07-01 00:00:01 +00:00
|
|
|
typedef struct qtv_leaf_s {
|
|
|
|
struct qtv_leaf_s *next;
|
|
|
|
int num;
|
|
|
|
} qtv_leaf_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
entity_state_t e;
|
2021-12-27 10:39:34 +00:00
|
|
|
int model_index; // 1-based
|
|
|
|
struct model_s *model;
|
2012-07-01 00:00:01 +00:00
|
|
|
qtv_leaf_t *leafs;
|
|
|
|
} qtv_entity_t;
|
|
|
|
|
2005-05-07 05:13:37 +00:00
|
|
|
#define MAX_SV_PLAYERS 32
|
|
|
|
#define MAX_SV_ENTITIES 512
|
2005-05-08 09:10:43 +00:00
|
|
|
#define MAX_SIGNON_BUFFERS 8
|
2005-05-06 08:19:26 +00:00
|
|
|
|
2004-02-20 02:39:34 +00:00
|
|
|
typedef struct server_s {
|
2005-05-02 04:09:15 +00:00
|
|
|
struct server_s *next;
|
2004-02-20 02:39:34 +00:00
|
|
|
const char *name;
|
|
|
|
const char *address;
|
2004-02-21 02:31:22 +00:00
|
|
|
int qport;
|
2004-02-27 00:10:46 +00:00
|
|
|
int connected;
|
2005-05-08 09:10:43 +00:00
|
|
|
int signon;
|
2004-02-21 02:31:22 +00:00
|
|
|
struct connection_s *con;
|
|
|
|
netadr_t adr;
|
2004-02-20 02:39:34 +00:00
|
|
|
netchan_t netchan;
|
2005-05-02 04:09:15 +00:00
|
|
|
double next_run;
|
|
|
|
|
|
|
|
int ver;
|
|
|
|
int spawncount;
|
|
|
|
const char *gamedir;
|
|
|
|
const char *message;
|
|
|
|
movevars_t movevars;
|
|
|
|
int cdtrack;
|
|
|
|
int sounds;
|
|
|
|
struct info_s *info;
|
2005-05-08 00:48:21 +00:00
|
|
|
char *soundlist[MAX_SOUNDS + 1];
|
|
|
|
char *modellist[MAX_MODELS + 1];
|
2005-05-08 08:04:50 +00:00
|
|
|
char *lightstyles[MAX_LIGHTSTYLES];
|
2010-08-24 01:00:56 +00:00
|
|
|
struct model_s *worldmodel;
|
2021-12-26 05:45:32 +00:00
|
|
|
struct set_s *fatpvs;
|
2005-05-08 06:35:46 +00:00
|
|
|
int playermodel;
|
2005-05-08 09:10:43 +00:00
|
|
|
int num_signon_buffers;
|
|
|
|
int signon_buffer_size[MAX_SIGNON_BUFFERS];
|
|
|
|
byte signon_buffers[MAX_SIGNON_BUFFERS][MAX_DATAGRAM];
|
2005-05-05 07:31:31 +00:00
|
|
|
|
2005-05-07 13:57:07 +00:00
|
|
|
struct client_s *clients;
|
|
|
|
|
2005-05-05 07:31:31 +00:00
|
|
|
int delta;
|
2005-05-10 02:39:54 +00:00
|
|
|
int validsequence;
|
2005-05-06 08:19:26 +00:00
|
|
|
|
2005-05-07 05:13:37 +00:00
|
|
|
frame_t frames[UPDATE_BACKUP];
|
2012-07-01 00:00:01 +00:00
|
|
|
qtv_entity_t entities[MAX_SV_ENTITIES];
|
2005-05-08 13:24:00 +00:00
|
|
|
byte ent_valid[MAX_SV_ENTITIES];
|
2005-05-07 05:13:37 +00:00
|
|
|
entity_state_t baselines[MAX_SV_ENTITIES];
|
|
|
|
player_t players[MAX_SV_PLAYERS];
|
|
|
|
player_t *player_list; // list of players for multicast
|
|
|
|
unsigned player_mask; // which players are in the list
|
|
|
|
plent_state_t player_states[UPDATE_BACKUP][MAX_SV_PLAYERS];
|
|
|
|
entity_state_t entity_states[UPDATE_BACKUP][MAX_DEMO_PACKET_ENTITIES];
|
2004-02-20 02:39:34 +00:00
|
|
|
} server_t;
|
|
|
|
|
|
|
|
void Server_Init (void);
|
2005-05-02 04:09:15 +00:00
|
|
|
void Server_Frame (void);
|
2005-05-07 13:57:07 +00:00
|
|
|
void Server_List (void);
|
|
|
|
void Server_Connect (const char *name, struct client_s *client);
|
|
|
|
void Server_Disconnect (struct client_s *client);
|
2010-01-13 06:52:15 +00:00
|
|
|
void Server_Broadcast (server_t *sv, int reliable, int all, const byte *msg,
|
|
|
|
int len);
|
|
|
|
void Server_BroadcastCommand (server_t *sv, const char *cmd);
|
2004-02-20 02:39:34 +00:00
|
|
|
|
2005-05-06 07:24:30 +00:00
|
|
|
struct qmsg_s;
|
|
|
|
void sv_parse (server_t *sv, struct msg_s *msg, int reliable);
|
|
|
|
void sv_stringcmd (server_t *sv, struct msg_s *msg);
|
|
|
|
|
2010-12-21 09:15:31 +00:00
|
|
|
extern int server_count;
|
|
|
|
|
2004-02-20 02:39:34 +00:00
|
|
|
#endif//__server_h
|