mirror of
https://github.com/libretro/libretro-tyrquake.git
synced 2025-04-02 18:51:32 +00:00
protocol: Add support for BJP version 1, 2 & 3 protocols
Now pull together all that previous work and enable the BJP protocols. Each uses a different combination of bytes/shorts for models, static and dymanic sounds. Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
parent
8088798681
commit
05ee56fc9c
@ -115,7 +115,11 @@ CL_ReadSoundNum()
|
|||||||
{
|
{
|
||||||
switch (cl.protocol) {
|
switch (cl.protocol) {
|
||||||
case PROTOCOL_VERSION_NQ:
|
case PROTOCOL_VERSION_NQ:
|
||||||
|
case PROTOCOL_VERSION_BJP:
|
||||||
return MSG_ReadByte();
|
return MSG_ReadByte();
|
||||||
|
case PROTOCOL_VERSION_BJP2:
|
||||||
|
case PROTOCOL_VERSION_BJP3:
|
||||||
|
return MSG_ReadShort();
|
||||||
default:
|
default:
|
||||||
Host_Error("%s: Unknown protocol version (%d)\n", __func__,
|
Host_Error("%s: Unknown protocol version (%d)\n", __func__,
|
||||||
cl.protocol);
|
cl.protocol);
|
||||||
@ -350,6 +354,10 @@ CL_ReadModelIndex(void)
|
|||||||
switch (cl.protocol) {
|
switch (cl.protocol) {
|
||||||
case PROTOCOL_VERSION_NQ:
|
case PROTOCOL_VERSION_NQ:
|
||||||
return MSG_ReadByte();
|
return MSG_ReadByte();
|
||||||
|
case PROTOCOL_VERSION_BJP:
|
||||||
|
case PROTOCOL_VERSION_BJP2:
|
||||||
|
case PROTOCOL_VERSION_BJP3:
|
||||||
|
return MSG_ReadShort();
|
||||||
default:
|
default:
|
||||||
Host_Error("%s: Unknown protocol version (%d)\n", __func__,
|
Host_Error("%s: Unknown protocol version (%d)\n", __func__,
|
||||||
cl.protocol);
|
cl.protocol);
|
||||||
@ -722,7 +730,11 @@ CL_ReadSoundNum_Static(void)
|
|||||||
{
|
{
|
||||||
switch (cl.protocol) {
|
switch (cl.protocol) {
|
||||||
case PROTOCOL_VERSION_NQ:
|
case PROTOCOL_VERSION_NQ:
|
||||||
|
case PROTOCOL_VERSION_BJP:
|
||||||
|
case PROTOCOL_VERSION_BJP3:
|
||||||
return MSG_ReadByte();
|
return MSG_ReadByte();
|
||||||
|
case PROTOCOL_VERSION_BJP2:
|
||||||
|
return MSG_ReadShort();
|
||||||
default:
|
default:
|
||||||
Host_Error("%s: Unknown protocol version (%d)\n", __func__,
|
Host_Error("%s: Unknown protocol version (%d)\n", __func__,
|
||||||
cl.protocol);
|
cl.protocol);
|
||||||
|
@ -534,8 +534,13 @@ PF_WriteSoundNum_Static(sizebuf_t *sb, int c)
|
|||||||
{
|
{
|
||||||
switch (sv.protocol) {
|
switch (sv.protocol) {
|
||||||
case PROTOCOL_VERSION_NQ:
|
case PROTOCOL_VERSION_NQ:
|
||||||
|
case PROTOCOL_VERSION_BJP:
|
||||||
|
case PROTOCOL_VERSION_BJP3:
|
||||||
MSG_WriteByte(sb, c);
|
MSG_WriteByte(sb, c);
|
||||||
break;
|
break;
|
||||||
|
case PROTOCOL_VERSION_BJP2:
|
||||||
|
MSG_WriteShort(sb, c);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Host_Error("%s: Unknown protocol version (%d)\n", __func__,
|
Host_Error("%s: Unknown protocol version (%d)\n", __func__,
|
||||||
sv.protocol);
|
sv.protocol);
|
||||||
|
@ -25,13 +25,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||||||
|
|
||||||
#include "qtypes.h"
|
#include "qtypes.h"
|
||||||
|
|
||||||
#define PROTOCOL_VERSION_NQ 15
|
#define PROTOCOL_VERSION_NQ 15
|
||||||
|
#define PROTOCOL_VERSION_BJP 10000
|
||||||
|
#define PROTOCOL_VERSION_BJP2 10001
|
||||||
|
#define PROTOCOL_VERSION_BJP3 10002
|
||||||
|
|
||||||
static inline qboolean
|
static inline qboolean
|
||||||
Protocol_Known(int version)
|
Protocol_Known(int version)
|
||||||
{
|
{
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case PROTOCOL_VERSION_NQ:
|
case PROTOCOL_VERSION_NQ:
|
||||||
|
case PROTOCOL_VERSION_BJP:
|
||||||
|
case PROTOCOL_VERSION_BJP2:
|
||||||
|
case PROTOCOL_VERSION_BJP3:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@ -44,6 +50,10 @@ max_models(int protocol)
|
|||||||
switch (protocol) {
|
switch (protocol) {
|
||||||
case PROTOCOL_VERSION_NQ:
|
case PROTOCOL_VERSION_NQ:
|
||||||
return qmin(256, MAX_MODELS);
|
return qmin(256, MAX_MODELS);
|
||||||
|
case PROTOCOL_VERSION_BJP:
|
||||||
|
case PROTOCOL_VERSION_BJP2:
|
||||||
|
case PROTOCOL_VERSION_BJP3:
|
||||||
|
return qmin(65536, MAX_MODELS);
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -54,7 +64,11 @@ max_sounds_static(int protocol)
|
|||||||
{
|
{
|
||||||
switch (protocol) {
|
switch (protocol) {
|
||||||
case PROTOCOL_VERSION_NQ:
|
case PROTOCOL_VERSION_NQ:
|
||||||
|
case PROTOCOL_VERSION_BJP:
|
||||||
|
case PROTOCOL_VERSION_BJP3:
|
||||||
return qmin(256, MAX_SOUNDS);
|
return qmin(256, MAX_SOUNDS);
|
||||||
|
case PROTOCOL_VERSION_BJP2:
|
||||||
|
return qmin(65536, MAX_SOUNDS);
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -65,7 +79,11 @@ max_sounds_dynamic(int protocol)
|
|||||||
{
|
{
|
||||||
switch (protocol) {
|
switch (protocol) {
|
||||||
case PROTOCOL_VERSION_NQ:
|
case PROTOCOL_VERSION_NQ:
|
||||||
|
case PROTOCOL_VERSION_BJP:
|
||||||
return qmin(256, MAX_SOUNDS);
|
return qmin(256, MAX_SOUNDS);
|
||||||
|
case PROTOCOL_VERSION_BJP2:
|
||||||
|
case PROTOCOL_VERSION_BJP3:
|
||||||
|
return qmin(65536, MAX_SOUNDS);
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
13
NQ/sv_main.c
13
NQ/sv_main.c
@ -56,6 +56,9 @@ typedef struct {
|
|||||||
#define PROT(v, n, d) { .version = v, .name = n, .description = d }
|
#define PROT(v, n, d) { .version = v, .name = n, .description = d }
|
||||||
static sv_protocol_t sv_protocols[] = {
|
static sv_protocol_t sv_protocols[] = {
|
||||||
PROT(PROTOCOL_VERSION_NQ, "NQ", "Standard NetQuake protocol"),
|
PROT(PROTOCOL_VERSION_NQ, "NQ", "Standard NetQuake protocol"),
|
||||||
|
PROT(PROTOCOL_VERSION_BJP, "BJP", "BJP protocol (v1)"),
|
||||||
|
PROT(PROTOCOL_VERSION_BJP2, "BJP2", "BJP protocol (v2)"),
|
||||||
|
PROT(PROTOCOL_VERSION_BJP3, "BJP3", "BJP protocol (v3)")
|
||||||
};
|
};
|
||||||
|
|
||||||
static int sv_protocol = PROTOCOL_VERSION_NQ;
|
static int sv_protocol = PROTOCOL_VERSION_NQ;
|
||||||
@ -197,8 +200,13 @@ SV_WriteSoundNum(sizebuf_t *sb, int c)
|
|||||||
{
|
{
|
||||||
switch (sv.protocol) {
|
switch (sv.protocol) {
|
||||||
case PROTOCOL_VERSION_NQ:
|
case PROTOCOL_VERSION_NQ:
|
||||||
|
case PROTOCOL_VERSION_BJP:
|
||||||
MSG_WriteByte(sb, c);
|
MSG_WriteByte(sb, c);
|
||||||
break;
|
break;
|
||||||
|
case PROTOCOL_VERSION_BJP2:
|
||||||
|
case PROTOCOL_VERSION_BJP3:
|
||||||
|
MSG_WriteShort(sb, c);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Host_Error("%s: Unknown protocol version (%d)\n", __func__,
|
Host_Error("%s: Unknown protocol version (%d)\n", __func__,
|
||||||
sv.protocol);
|
sv.protocol);
|
||||||
@ -526,6 +534,11 @@ SV_WriteModelIndex(sizebuf_t *sb, int c)
|
|||||||
case PROTOCOL_VERSION_NQ:
|
case PROTOCOL_VERSION_NQ:
|
||||||
MSG_WriteByte(sb, c);
|
MSG_WriteByte(sb, c);
|
||||||
break;
|
break;
|
||||||
|
case PROTOCOL_VERSION_BJP:
|
||||||
|
case PROTOCOL_VERSION_BJP2:
|
||||||
|
case PROTOCOL_VERSION_BJP3:
|
||||||
|
MSG_WriteShort(sb, c);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Host_Error("%s: Unknown protocol version (%d)\n", __func__,
|
Host_Error("%s: Unknown protocol version (%d)\n", __func__,
|
||||||
sv.protocol);
|
sv.protocol);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user