mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-02 13:52:37 +00:00
7f10b0f237
- move clc_t into net_clc.h from net_protocol.h - split packet processing stuff from net.h into net_packet.h - add a is_server arg to Log_{Incoming,Outgoing}_Packet, so libs/net is oblivious to if we're running a server or not (except with the arg, obviously) - remove the long obsolete (even in original quake) svc_spawnbinary stuff - make nq use QF/net_svc.h - make nq link to libQFnet too - make qw's cl_parse.c use net_svc_qw_any_t instead of net_svc_any_t
355 lines
10 KiB
C
355 lines
10 KiB
C
/*
|
|
net_svc_qw.h
|
|
|
|
(description)
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
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
|
|
|
|
$Id$
|
|
*/
|
|
|
|
#ifndef NET_SVC_QW_H
|
|
#define NET_SVC_QW_H
|
|
|
|
#include "QF/net_protocol.h"
|
|
#include "QF/net_svc.h"
|
|
|
|
|
|
// FIXME: duplicate definition from pmove.h
|
|
typedef struct {
|
|
float gravity;
|
|
float stopspeed;
|
|
float maxspeed;
|
|
float spectatormaxspeed;
|
|
float accelerate;
|
|
float airaccelerate;
|
|
float wateraccelerate;
|
|
float friction;
|
|
float waterfriction;
|
|
float entgravity;
|
|
} movevars_t;
|
|
|
|
|
|
typedef struct net_svc_qwupdatestat_s
|
|
{
|
|
byte stat;
|
|
int value;
|
|
} net_svc_qwupdatestat_t;
|
|
|
|
typedef struct net_svc_qwsound_s
|
|
{
|
|
short channel;
|
|
float volume;
|
|
float attenuation;
|
|
byte sound_num;
|
|
vec3_t position;
|
|
int entity;
|
|
} net_svc_qwsound_t;
|
|
|
|
typedef struct net_svc_qwprint_s
|
|
{
|
|
byte level;
|
|
const char *message;
|
|
} net_svc_qwprint_t;
|
|
|
|
typedef struct net_svc_serverdata_s
|
|
{
|
|
int protocolversion;
|
|
int servercount; // FIXME: rename this
|
|
const char *gamedir;
|
|
byte playernum;
|
|
qboolean spectator;
|
|
const char *levelname;
|
|
movevars_t movevars;
|
|
} net_svc_serverdata_t;
|
|
|
|
typedef struct net_svc_qwtempentity_s
|
|
{
|
|
byte type;
|
|
vec3_t position;
|
|
int gunshotcount; // gunshot sparks
|
|
byte colorstart; // palette start (I think?)
|
|
byte colorlength; // palette length
|
|
vec3_t beamend; // beam endpos
|
|
short beamentity; // beam entity
|
|
} net_svc_qwtempentity_t;
|
|
|
|
typedef struct net_svc_qwintermission_s
|
|
{
|
|
vec3_t origin;
|
|
vec3_t angles;
|
|
} net_svc_qwintermission_t;
|
|
|
|
typedef struct net_svc_qwcdtrack_s
|
|
{
|
|
byte cdtrack;
|
|
} net_svc_qwcdtrack_t;
|
|
|
|
typedef struct net_svc_smallkick_s
|
|
{
|
|
} net_svc_smallkick_t;
|
|
|
|
typedef struct net_svc_bigkick_s
|
|
{
|
|
} net_svc_bigkick_t;
|
|
|
|
typedef struct net_svc_updateping_s
|
|
{
|
|
byte player;
|
|
short ping;
|
|
} net_svc_updateping_t;
|
|
|
|
typedef struct net_svc_updateentertime_s
|
|
{
|
|
byte player;
|
|
float secondsago;
|
|
} net_svc_updateentertime_t;
|
|
|
|
typedef struct net_svc_muzzleflash_s
|
|
{
|
|
short player;
|
|
} net_svc_muzzleflash_t;
|
|
|
|
typedef struct net_svc_updateuserinfo_s
|
|
{
|
|
byte slot; // FIXME: rename to player
|
|
int userid;
|
|
const char *userinfo;
|
|
} net_svc_updateuserinfo_t;
|
|
|
|
typedef struct net_svc_download_s
|
|
{
|
|
short size;
|
|
byte percent;
|
|
const char *name; // only one of name or data will be set
|
|
const byte *data;
|
|
} net_svc_download_t;
|
|
|
|
typedef struct net_svc_playerinfo_s
|
|
{
|
|
byte playernum;
|
|
int flags;
|
|
vec3_t origin;
|
|
byte frame;
|
|
byte msec;
|
|
usercmd_t usercmd;
|
|
vec3_t velocity;
|
|
byte modelindex;
|
|
byte skinnum;
|
|
byte effects;
|
|
byte weaponframe;
|
|
} net_svc_playerinfo_t;
|
|
|
|
typedef struct net_svc_nails_s
|
|
{
|
|
byte numnails;
|
|
struct {
|
|
vec3_t origin;
|
|
vec3_t angles;
|
|
} nails[MAX_PROJECTILES];
|
|
} net_svc_nails_t;
|
|
|
|
typedef struct net_svc_chokecount_s
|
|
{
|
|
byte count;
|
|
} net_svc_chokecount_t;
|
|
|
|
typedef struct net_svc_modellist_s
|
|
{
|
|
byte startmodel;
|
|
const char *models[MAX_MODELS + 1]; // space left for terminating
|
|
// empty string
|
|
byte nextmodel;
|
|
} net_svc_modellist_t;
|
|
|
|
typedef struct net_svc_soundlist_s
|
|
{
|
|
byte startsound;
|
|
const char *sounds[MAX_SOUNDS + 1]; // space left for terminating
|
|
// empty string
|
|
byte nextsound;
|
|
} net_svc_soundlist_t;
|
|
|
|
typedef struct net_svc_packetentities_s
|
|
{
|
|
int numwords, numdeltas;
|
|
unsigned int words[MAX_PACKET_ENTITIES * 2 + 1];
|
|
entity_state_t deltas[MAX_PACKET_ENTITIES];
|
|
} net_svc_packetentities_t;
|
|
|
|
typedef struct net_svc_deltapacketentities_s
|
|
{
|
|
int numwords, numdeltas;
|
|
byte from;
|
|
unsigned int words[MAX_PACKET_ENTITIES * 2 + 1];
|
|
entity_state_t deltas[MAX_PACKET_ENTITIES];
|
|
} net_svc_deltapacketentities_t;
|
|
|
|
typedef struct net_svc_maxspeed_s
|
|
{
|
|
float maxspeed;
|
|
} net_svc_maxspeed_t;
|
|
|
|
typedef struct net_svc_entgravity_s
|
|
{
|
|
float gravity;
|
|
} net_svc_entgravity_t;
|
|
|
|
typedef struct net_svc_setinfo_s
|
|
{
|
|
byte slot;
|
|
const char *key;
|
|
const char *value;
|
|
} net_svc_setinfo_t;
|
|
|
|
typedef struct net_svc_qwserverinfo_s
|
|
{
|
|
const char *key;
|
|
const char *value;
|
|
} net_svc_qwserverinfo_t;
|
|
|
|
typedef struct net_svc_updatepl_s
|
|
{
|
|
byte player;
|
|
byte packetloss;
|
|
} net_svc_updatepl_t;
|
|
|
|
typedef union net_svc_qw_any_u
|
|
{
|
|
net_svc_any_t common;
|
|
net_svc_qwupdatestat_t qwupdatestat;
|
|
net_svc_qwsound_t qwsound;
|
|
net_svc_qwprint_t qwprint;
|
|
net_svc_serverdata_t serverdata;
|
|
net_svc_qwtempentity_t qwtempentity;
|
|
net_svc_qwintermission_t qwintermission;
|
|
net_svc_qwcdtrack_t qwcdtrack;
|
|
net_svc_smallkick_t smallkick;
|
|
net_svc_bigkick_t bigkick;
|
|
net_svc_updateping_t updateping;
|
|
net_svc_updateentertime_t updateentertime;
|
|
net_svc_updatestatlong_t updatestatlong;
|
|
net_svc_muzzleflash_t muzzleflash;
|
|
net_svc_updateuserinfo_t updateuserinfo;
|
|
net_svc_download_t download;
|
|
net_svc_playerinfo_t playerinfo;
|
|
net_svc_nails_t nails;
|
|
net_svc_chokecount_t chokecount;
|
|
net_svc_modellist_t modellist;
|
|
net_svc_soundlist_t soundlist;
|
|
net_svc_packetentities_t packetentities;
|
|
net_svc_deltapacketentities_t deltapacketentities;
|
|
net_svc_maxspeed_t maxspeed;
|
|
net_svc_entgravity_t entgravity;
|
|
net_svc_setinfo_t setinfo;
|
|
net_svc_qwserverinfo_t qwserverinfo;
|
|
net_svc_updatepl_t updatepl;
|
|
} net_svc_qw_any_t;
|
|
|
|
extern net_svc_emit_t net_svc_qw_emit_jumptable[];
|
|
extern int net_svc_qw_emit_count;
|
|
extern net_svc_parse_t net_svc_qw_parse_jumptable[];
|
|
extern int net_svc_qw_parse_count;
|
|
|
|
|
|
net_status_t NET_SVC_QWUpdateStat_Emit (net_svc_qwupdatestat_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_QWUpdateStat_Parse (net_svc_qwupdatestat_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_QWSound_Emit (net_svc_qwsound_t *block, sizebuf_t *buf);
|
|
net_status_t NET_SVC_QWSound_Parse (net_svc_qwsound_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_QWPrint_Emit (net_svc_qwprint_t *block, sizebuf_t *buf);
|
|
net_status_t NET_SVC_QWPrint_Parse (net_svc_qwprint_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_ServerData_Emit (net_svc_serverdata_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_ServerData_Parse (net_svc_serverdata_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_QWTempEntity_Emit (net_svc_qwtempentity_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_QWTempEntity_Parse (net_svc_qwtempentity_t *block,
|
|
msg_t *msg);
|
|
net_status_t NET_SVC_QWIntermission_Emit (net_svc_qwintermission_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_QWIntermission_Parse (net_svc_qwintermission_t *block,
|
|
msg_t *msg);
|
|
net_status_t NET_SVC_QWCDTrack_Emit (net_svc_qwcdtrack_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_QWCDTrack_Parse (net_svc_qwcdtrack_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_SmallKick_Emit (net_svc_smallkick_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_SmallKick_Parse (net_svc_smallkick_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_BigKick_Emit (net_svc_bigkick_t *block, sizebuf_t *buf);
|
|
net_status_t NET_SVC_BigKick_Parse (net_svc_bigkick_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_UpdatePing_Emit (net_svc_updateping_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_UpdatePing_Parse (net_svc_updateping_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_UpdateEnterTime_Emit (net_svc_updateentertime_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_UpdateEnterTime_Parse (net_svc_updateentertime_t *block,
|
|
msg_t *msg);
|
|
net_status_t NET_SVC_UpdateStatLong_Emit (net_svc_updatestatlong_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_UpdateStatLong_Parse (net_svc_updatestatlong_t *block,
|
|
msg_t *msg);
|
|
net_status_t NET_SVC_MuzzleFlash_Emit (net_svc_muzzleflash_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_MuzzleFlash_Parse (net_svc_muzzleflash_t *block,
|
|
msg_t *msg);
|
|
net_status_t NET_SVC_UpdateUserInfo_Emit (net_svc_updateuserinfo_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_UpdateUserInfo_Parse (net_svc_updateuserinfo_t *block,
|
|
msg_t *msg);
|
|
net_status_t NET_SVC_Download_Emit (net_svc_download_t *block, sizebuf_t *buf);
|
|
net_status_t NET_SVC_Download_Parse (net_svc_download_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_Playerinfo_Emit (net_svc_playerinfo_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_Playerinfo_Parse (net_svc_playerinfo_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_Nails_Emit (net_svc_nails_t *block, sizebuf_t *buf);
|
|
net_status_t NET_SVC_Nails_Parse (net_svc_nails_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_ChokeCount_Emit (net_svc_chokecount_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_ChokeCount_Parse (net_svc_chokecount_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_Modellist_Emit (net_svc_modellist_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_Modellist_Parse (net_svc_modellist_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_Soundlist_Emit (net_svc_soundlist_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_Soundlist_Parse (net_svc_soundlist_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_PacketEntities_Emit (net_svc_packetentities_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_PacketEntities_Parse (net_svc_packetentities_t *block,
|
|
msg_t *msg);
|
|
net_status_t NET_SVC_DeltaPacketEntities_Emit (net_svc_deltapacketentities_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_DeltaPacketEntities_Parse (net_svc_deltapacketentities_t *block,
|
|
msg_t *msg);
|
|
net_status_t NET_SVC_MaxSpeed_Emit (net_svc_maxspeed_t *block, sizebuf_t *buf);
|
|
net_status_t NET_SVC_MaxSpeed_Parse (net_svc_maxspeed_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_EntGravity_Emit (net_svc_entgravity_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_EntGravity_Parse (net_svc_entgravity_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_SetInfo_Emit (net_svc_setinfo_t *block, sizebuf_t *buf);
|
|
net_status_t NET_SVC_SetInfo_Parse (net_svc_setinfo_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_QWServerInfo_Emit (net_svc_qwserverinfo_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_QWServerInfo_Parse (net_svc_qwserverinfo_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_UpdatePL_Emit (net_svc_updatepl_t *block, sizebuf_t *buf);
|
|
net_status_t NET_SVC_UpdatePL_Parse (net_svc_updatepl_t *block, msg_t *msg);
|
|
|
|
#endif // NET_SVC_QW_H
|