mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-09 01:00:54 +00:00
- 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
306 lines
9.5 KiB
C
306 lines
9.5 KiB
C
/*
|
|
net_svc.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 QF_NET_SVC_H
|
|
#define QF_NET_SVC_H
|
|
|
|
#include "QF/msg.h"
|
|
#include "QF/net_packet.h"
|
|
|
|
// N means netquake, Q means quakeworld
|
|
typedef enum {
|
|
svc_bad = 0,
|
|
svc_nop = 1, // QN
|
|
svc_disconnect = 2, // QN
|
|
svc_qwupdatestat = 3, // Q [byte] [byte]
|
|
svc_nqupdatestat = 3, // N
|
|
svc_version = 4, // N
|
|
svc_setview = 5, // N [short] entity number
|
|
svc_qwsound = 6, // Q <see code>
|
|
svc_nqsound = 6, // N
|
|
svc_time = 7, // N
|
|
svc_qwprint = 8, // Q [byte] id [string] null terminated
|
|
// string
|
|
svc_nqprint = 8, // N
|
|
svc_stufftext = 9, // QN [string] stuffed into client's console
|
|
// buffer the string should be \n
|
|
// terminated
|
|
svc_setangle = 10, // QN [angle3] set the view angle to this
|
|
// absolute value
|
|
svc_serverdata = 11, // Q [long] protocol ...
|
|
svc_nqserverinfo = 11, // N
|
|
svc_lightstyle = 12, // QN [byte] [string]
|
|
svc_updatename = 13, // N
|
|
svc_updatefrags = 14, // QN [byte] [short]
|
|
svc_clientdata = 15, // N
|
|
svc_stopsound = 16, // QN <see code>
|
|
svc_updatecolors = 17, // N
|
|
svc_particle = 18, // N
|
|
svc_damage = 19, // QN
|
|
svc_spawnstatic = 20, // QN
|
|
// no 21 (obsolete)
|
|
svc_spawnbaseline = 22, // QN
|
|
svc_qwtempentity = 23, // Q variable
|
|
svc_nqtempentity = 23, // N
|
|
svc_setpause = 24, // QN [byte] on / off
|
|
svc_signonnum = 25, // N
|
|
svc_centerprint = 26, // QN [string] to put in center of the screen
|
|
svc_killedmonster = 27, // QN
|
|
svc_foundsecret = 28, // QN
|
|
svc_spawnstaticsound = 29, // QN [coord3] [byte] samp [byte] vol
|
|
// [byte] aten
|
|
svc_qwintermission = 30, // Q [vec3_t] origin [vec3_t] angle
|
|
svc_nqintermission = 30, // N
|
|
svc_finale = 31, // QN [string] text
|
|
svc_qwcdtrack = 32, // Q [byte] track
|
|
svc_nqcdtrack = 32, // N
|
|
svc_sellscreen = 33, // QN
|
|
svc_smallkick = 34, // Q set client punchangle to 2
|
|
svc_cutscene = 34, // N
|
|
svc_bigkick = 35, // Q set client punchangle to 4
|
|
svc_updateping = 36, // Q [byte] [short]
|
|
svc_updateentertime = 37, // Q [byte] [float]
|
|
svc_updatestatlong = 38, // Q [byte] [long]
|
|
svc_muzzleflash = 39, // Q [short] entity
|
|
svc_updateuserinfo = 40, // Q [byte] slot [long] uid [string]
|
|
// userinfo
|
|
svc_download = 41, // Q [short] size [size bytes]
|
|
svc_playerinfo = 42, // Q variable
|
|
svc_nails = 43, // Q [byte] num [48 bits] xyzpy 12 12 12 4 8
|
|
svc_chokecount = 44, // Q [byte] packets choked
|
|
svc_modellist = 45, // Q [strings]
|
|
svc_soundlist = 46, // Q [strings]
|
|
svc_packetentities = 47, // Q [...]
|
|
svc_deltapacketentities = 48, // Q [...]
|
|
svc_maxspeed = 49, // Q maxspeed change, for prediction
|
|
svc_entgravity = 50, // Q gravity change, for prediction
|
|
svc_setinfo = 51, // Q setinfo on a client
|
|
svc_qwserverinfo = 52, // Q serverinfo
|
|
svc_updatepl = 53, // Q [byte] [byte]
|
|
} svc_t;
|
|
|
|
|
|
typedef struct net_svc_nop_s
|
|
{
|
|
} net_svc_nop_t;
|
|
|
|
typedef struct net_svc_disconnect_s
|
|
{
|
|
} net_svc_disconnect_t;
|
|
|
|
typedef struct net_svc_centerprint_s
|
|
{
|
|
const char *message;
|
|
} net_svc_centerprint_t;
|
|
|
|
typedef struct net_svc_stufftext_s
|
|
{
|
|
const char *commands;
|
|
} net_svc_stufftext_t;
|
|
|
|
typedef struct net_svc_damage_s
|
|
{
|
|
byte armor;
|
|
byte blood;
|
|
vec3_t from;
|
|
} net_svc_damage_t;
|
|
|
|
typedef struct net_svc_setangle_s
|
|
{
|
|
vec3_t angles;
|
|
} net_svc_setangle_t;
|
|
|
|
typedef struct net_svc_lightstyle_s
|
|
{
|
|
byte stylenum;
|
|
const char *map;
|
|
} net_svc_lightstyle_t;
|
|
|
|
typedef struct net_svc_stopsound_s
|
|
{
|
|
int entity;
|
|
int channel;
|
|
} net_svc_stopsound_t;
|
|
|
|
typedef struct net_svc_updatefrags_s
|
|
{
|
|
byte player;
|
|
short frags;
|
|
} net_svc_updatefrags_t;
|
|
|
|
typedef struct net_svc_spawnbaseline_s
|
|
{
|
|
short num;
|
|
byte modelindex;
|
|
byte frame;
|
|
byte colormap;
|
|
byte skinnum;
|
|
vec3_t origin;
|
|
vec3_t angles;
|
|
} net_svc_spawnbaseline_t;
|
|
|
|
typedef struct net_svc_spawnstatic_s
|
|
{
|
|
byte modelindex;
|
|
byte frame;
|
|
byte colormap;
|
|
byte skinnum;
|
|
vec3_t origin;
|
|
vec3_t angles;
|
|
} net_svc_spawnstatic_t;
|
|
|
|
typedef struct net_svc_killedmonster_s
|
|
{
|
|
} net_svc_killedmonster_t;
|
|
|
|
typedef struct net_svc_foundsecret_s
|
|
{
|
|
} net_svc_foundsecret_t;
|
|
|
|
typedef struct net_svc_spawnstaticsound_s
|
|
{
|
|
vec3_t position;
|
|
byte sound_num;
|
|
byte volume;
|
|
byte attenuation; // FIXME: should be a float (convert usages)
|
|
} net_svc_spawnstaticsound_t;
|
|
|
|
typedef struct net_svc_updatestatlong_s
|
|
{
|
|
byte stat;
|
|
int value;
|
|
} net_svc_updatestatlong_t;
|
|
|
|
typedef struct net_svc_finale_s
|
|
{
|
|
const char *message;
|
|
} net_svc_finale_t;
|
|
|
|
typedef struct net_svc_sellscreen_s
|
|
{
|
|
} net_svc_sellscreen_t;
|
|
|
|
typedef struct net_svc_setpause_s
|
|
{
|
|
byte paused;
|
|
} net_svc_setpause_t;
|
|
|
|
typedef union net_svc_any_u
|
|
{
|
|
net_svc_nop_t nop;
|
|
net_svc_disconnect_t disconnect;
|
|
net_svc_centerprint_t centerprint;
|
|
net_svc_stufftext_t stufftext;
|
|
net_svc_damage_t damage;
|
|
net_svc_setangle_t setangle;
|
|
net_svc_lightstyle_t lightstyle;
|
|
net_svc_stopsound_t stopsound;
|
|
net_svc_updatefrags_t updatefrags;
|
|
net_svc_spawnbaseline_t spawnbaseline;
|
|
net_svc_spawnstatic_t spawnstatic;
|
|
net_svc_killedmonster_t killedmonster;
|
|
net_svc_foundsecret_t foundsecret;
|
|
net_svc_spawnstaticsound_t spawnstaticsound;
|
|
net_svc_finale_t finale;
|
|
net_svc_sellscreen_t sellscreen;
|
|
net_svc_setpause_t setpause;
|
|
} net_svc_any_t;
|
|
|
|
typedef net_status_t (*net_svc_emit_t) (net_svc_any_t *block, sizebuf_t *buf);
|
|
typedef net_status_t (*net_svc_parse_t) (net_svc_any_t *block, msg_t *msg);
|
|
|
|
extern net_svc_emit_t net_svc_common_emit_jumptable[];
|
|
extern int net_svc_common_emit_count;
|
|
extern net_svc_parse_t net_svc_common_parse_jumptable[];
|
|
extern int net_svc_common_parse_count;
|
|
|
|
extern net_svc_emit_t *net_svc_emit_jumptable;
|
|
extern int net_svc_emit_count;
|
|
extern net_svc_parse_t *net_svc_parse_jumptable;
|
|
extern int net_svc_parse_count;
|
|
|
|
|
|
const char *NET_SVC_GetString (svc_t type);
|
|
net_status_t NET_SVC_Emit (svc_t type, void *block, sizebuf_t *buf);
|
|
net_status_t NET_SVC_Parse (svc_t *type, net_svc_any_t *block, msg_t *msg);
|
|
|
|
net_status_t NET_SVC_NOP_Emit (net_svc_nop_t *block, sizebuf_t *buf);
|
|
net_status_t NET_SVC_NOP_Parse (net_svc_nop_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_Disconnect_Emit (net_svc_disconnect_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_Disconnect_Parse (net_svc_disconnect_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_Centerprint_Emit (net_svc_centerprint_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_Centerprint_Parse (net_svc_centerprint_t *block,
|
|
msg_t *msg);
|
|
net_status_t NET_SVC_Stufftext_Emit (net_svc_stufftext_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_Stufftext_Parse (net_svc_stufftext_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_Damage_Emit (net_svc_damage_t *block, sizebuf_t *buf);
|
|
net_status_t NET_SVC_Damage_Parse (net_svc_damage_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_SetAngle_Emit (net_svc_setangle_t *block, sizebuf_t *buf);
|
|
net_status_t NET_SVC_SetAngle_Parse (net_svc_setangle_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_LightStyle_Emit (net_svc_lightstyle_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_LightStyle_Parse (net_svc_lightstyle_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_StopSound_Emit (net_svc_stopsound_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_StopSound_Parse (net_svc_stopsound_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_UpdateFrags_Emit (net_svc_updatefrags_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_UpdateFrags_Parse (net_svc_updatefrags_t *block,
|
|
msg_t *msg);
|
|
net_status_t NET_SVC_SpawnBaseline_Emit (net_svc_spawnbaseline_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_SpawnBaseline_Parse (net_svc_spawnbaseline_t *block,
|
|
msg_t *msg);
|
|
net_status_t NET_SVC_SpawnStatic_Emit (net_svc_spawnstatic_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_SpawnStatic_Parse (net_svc_spawnstatic_t *block,
|
|
msg_t *msg);
|
|
net_status_t NET_SVC_KilledMonster_Emit (net_svc_killedmonster_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_KilledMonster_Parse (net_svc_killedmonster_t *block,
|
|
msg_t *msg);
|
|
net_status_t NET_SVC_FoundSecret_Emit (net_svc_foundsecret_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_FoundSecret_Parse (net_svc_foundsecret_t *block,
|
|
msg_t *msg);
|
|
net_status_t NET_SVC_SpawnStaticSound_Emit (net_svc_spawnstaticsound_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_SpawnStaticSound_Parse (net_svc_spawnstaticsound_t *block,
|
|
msg_t *msg);
|
|
net_status_t NET_SVC_Finale_Emit (net_svc_finale_t *block, sizebuf_t *buf);
|
|
net_status_t NET_SVC_Finale_Parse (net_svc_finale_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_SellScreen_Emit (net_svc_sellscreen_t *block,
|
|
sizebuf_t *buf);
|
|
net_status_t NET_SVC_SellScreen_Parse (net_svc_sellscreen_t *block, msg_t *msg);
|
|
net_status_t NET_SVC_SetPause_Emit (net_svc_setpause_t *block, sizebuf_t *buf);
|
|
net_status_t NET_SVC_SetPause_Parse (net_svc_setpause_t *block, msg_t *msg);
|
|
|
|
#endif // QF_NET_SVC_H
|