mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-06-01 09:02:08 +00:00
- move the MAX_PROJECTILES def from cl_ents.c to bothdefs.h
- convert svc_nails
This commit is contained in:
parent
6af08f0468
commit
32fbdba399
4 changed files with 47 additions and 13 deletions
|
@ -62,6 +62,7 @@
|
||||||
#define MAX_LIGHTSTYLES 64
|
#define MAX_LIGHTSTYLES 64
|
||||||
#define MAX_MODELS 256 // these are sent over the net as bytes
|
#define MAX_MODELS 256 // these are sent over the net as bytes
|
||||||
#define MAX_SOUNDS 256 // so they cannot be blindly increased
|
#define MAX_SOUNDS 256 // so they cannot be blindly increased
|
||||||
|
#define MAX_PROJECTILES 32
|
||||||
|
|
||||||
#define SAVEGAME_COMMENT_LENGTH 39
|
#define SAVEGAME_COMMENT_LENGTH 39
|
||||||
|
|
||||||
|
|
|
@ -131,6 +131,15 @@ typedef struct net_svc_playerinfo_s
|
||||||
byte weaponframe;
|
byte weaponframe;
|
||||||
} net_svc_playerinfo_t;
|
} 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_soundlist_s
|
typedef struct net_svc_soundlist_s
|
||||||
{
|
{
|
||||||
byte startsound;
|
byte startsound;
|
||||||
|
@ -158,6 +167,7 @@ qboolean NET_SVC_SetInfo_Parse (net_svc_setinfo_t *block, msg_t *msg);
|
||||||
qboolean NET_SVC_ServerInfo_Parse (net_svc_serverinfo_t *block, msg_t *msg);
|
qboolean NET_SVC_ServerInfo_Parse (net_svc_serverinfo_t *block, msg_t *msg);
|
||||||
qboolean NET_SVC_Download_Parse (net_svc_download_t *block, msg_t *msg);
|
qboolean NET_SVC_Download_Parse (net_svc_download_t *block, msg_t *msg);
|
||||||
qboolean NET_SVC_Playerinfo_Parse (net_svc_playerinfo_t *block, msg_t *msg);
|
qboolean NET_SVC_Playerinfo_Parse (net_svc_playerinfo_t *block, msg_t *msg);
|
||||||
|
qboolean NET_SVC_Nails_Parse (net_svc_nails_t *block, msg_t *msg);
|
||||||
qboolean NET_SVC_Soundlist_Parse (net_svc_soundlist_t *block, msg_t *msg);
|
qboolean NET_SVC_Soundlist_Parse (net_svc_soundlist_t *block, msg_t *msg);
|
||||||
qboolean NET_SVC_Modellist_Parse (net_svc_modellist_t *block, msg_t *msg);
|
qboolean NET_SVC_Modellist_Parse (net_svc_modellist_t *block, msg_t *msg);
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ static const char rcsid[] =
|
||||||
#include "QF/render.h"
|
#include "QF/render.h"
|
||||||
#include "QF/skin.h"
|
#include "QF/skin.h"
|
||||||
|
|
||||||
|
#include "bothdefs.h"
|
||||||
#include "cl_cam.h"
|
#include "cl_cam.h"
|
||||||
#include "cl_ents.h"
|
#include "cl_ents.h"
|
||||||
#include "cl_main.h"
|
#include "cl_main.h"
|
||||||
|
@ -550,7 +551,6 @@ typedef struct {
|
||||||
entity_t ent;
|
entity_t ent;
|
||||||
} projectile_t;
|
} projectile_t;
|
||||||
|
|
||||||
#define MAX_PROJECTILES 32
|
|
||||||
projectile_t cl_projectiles[MAX_PROJECTILES];
|
projectile_t cl_projectiles[MAX_PROJECTILES];
|
||||||
int cl_num_projectiles;
|
int cl_num_projectiles;
|
||||||
extern int cl_spikeindex;
|
extern int cl_spikeindex;
|
||||||
|
@ -569,27 +569,22 @@ CL_ClearProjectiles (void)
|
||||||
void
|
void
|
||||||
CL_ParseProjectiles (void)
|
CL_ParseProjectiles (void)
|
||||||
{
|
{
|
||||||
byte bits[6];
|
int i;
|
||||||
int i, c, j;
|
|
||||||
projectile_t *pr;
|
projectile_t *pr;
|
||||||
|
net_svc_nails_t block;
|
||||||
|
|
||||||
c = MSG_ReadByte (net_message);
|
NET_SVC_Nails_Parse (&block, net_message);
|
||||||
for (i = 0; i < c; i++) {
|
|
||||||
for (j = 0; j < 6; j++)
|
|
||||||
bits[j] = MSG_ReadByte (net_message);
|
|
||||||
|
|
||||||
|
for (i = 0; i < block.numnails; i++) {
|
||||||
if (cl_num_projectiles == MAX_PROJECTILES)
|
if (cl_num_projectiles == MAX_PROJECTILES)
|
||||||
continue;
|
break;
|
||||||
|
|
||||||
pr = &cl_projectiles[cl_num_projectiles];
|
pr = &cl_projectiles[cl_num_projectiles];
|
||||||
cl_num_projectiles++;
|
cl_num_projectiles++;
|
||||||
|
|
||||||
pr->modelindex = cl_spikeindex;
|
pr->modelindex = cl_spikeindex;
|
||||||
pr->ent.origin[0] = ((bits[0] + ((bits[1] & 15) << 8)) << 1) - 4096;
|
VectorCopy (block.nails[i].origin, pr->ent.origin);
|
||||||
pr->ent.origin[1] = (((bits[1] >> 4) + (bits[2] << 4)) << 1) - 4096;
|
VectorCopy (block.nails[i].angles, pr->ent.angles);
|
||||||
pr->ent.origin[2] = ((bits[3] + ((bits[4] & 15) << 8)) << 1) - 4096;
|
|
||||||
pr->ent.angles[0] = 360 * (bits[4] >> 4) / 16;
|
|
||||||
pr->ent.angles[1] = 360 * bits[5] / 256;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -293,6 +293,34 @@ NET_SVC_Playerinfo_Parse (net_svc_playerinfo_t *block, msg_t *msg)
|
||||||
return msg->badread;
|
return msg->badread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qboolean
|
||||||
|
NET_SVC_Nails_Parse (net_svc_nails_t *block, msg_t *msg)
|
||||||
|
{
|
||||||
|
int i, j;
|
||||||
|
byte bits[6];
|
||||||
|
|
||||||
|
block->numnails = MSG_ReadByte (msg);
|
||||||
|
for (i = 0; i < block->numnails; i++) {
|
||||||
|
for (j = 0; j < 6; j++)
|
||||||
|
bits[j] = MSG_ReadByte (msg);
|
||||||
|
|
||||||
|
if (i >= MAX_PROJECTILES)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// [48 bits] xyzpy 12 12 12 4 8
|
||||||
|
// format is 12 bits per origin coord, 4 for angles[0],
|
||||||
|
// 8 for angles[1], and 0 for angles[2]
|
||||||
|
block->nails[i].origin[0] = ((bits[0] + ((bits[1] & 15) << 8)) << 1) - 4096;
|
||||||
|
block->nails[i].origin[1] = (((bits[1] >> 4) + (bits[2] << 4)) << 1) - 4096;
|
||||||
|
block->nails[i].origin[2] = ((bits[3] + ((bits[4] & 15) << 8)) << 1) - 4096;
|
||||||
|
block->nails[i].angles[0] = 360 * (bits[4] >> 4) / 16;
|
||||||
|
block->nails[i].angles[1] = 360 * bits[5] / 256;
|
||||||
|
block->nails[i].angles[2] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return msg->badread;
|
||||||
|
}
|
||||||
|
|
||||||
qboolean
|
qboolean
|
||||||
NET_SVC_Soundlist_Parse (net_svc_soundlist_t *block, msg_t *msg)
|
NET_SVC_Soundlist_Parse (net_svc_soundlist_t *block, msg_t *msg)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue