]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Fix compatibility with DP's own server with NEHAHRABJP2 and 3 protocols.
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 16 Oct 2020 22:46:06 +0000 (22:46 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 16 Oct 2020 22:46:06 +0000 (22:46 +0000)
Actually adhere to the protocols with regards to modelindex and
soundindex widths.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13021 d7cf8633-e32d-0410-b094-e92efae38249

cl_parse.c
sv_main.c
sv_send.c
svvm_cmds.c

index 4f1a07e2ac4bfa606a778918c7daab0e9fff68c0..30b2d3cc7e0408281e5dfb8cd16aabc10cf8de02 100644 (file)
@@ -2300,7 +2300,7 @@ static void CL_ParseStaticSound (int large)
        int                     sound_num, vol, atten;
 
        MSG_ReadVector(&cl_message, org, cls.protocol);
-       if (large || cls.protocol == PROTOCOL_NEHAHRABJP2)
+       if (large)
                sound_num = (unsigned short) MSG_ReadShort(&cl_message);
        else
                sound_num = MSG_ReadByte(&cl_message);
@@ -3976,7 +3976,7 @@ void CL_ParseServerMessage(void)
                                break;
 
                        case svc_sound:
-                               CL_ParseStartSoundPacket(false);
+                               CL_ParseStartSoundPacket(cls.protocol == PROTOCOL_NEHAHRABJP2 || cls.protocol == PROTOCOL_NEHAHRABJP3 ? true : false);
                                break;
 
                        case svc_precache:
@@ -4125,7 +4125,7 @@ void CL_ParseServerMessage(void)
                                break;
 
                        case svc_spawnstaticsound:
-                               CL_ParseStaticSound (false);
+                               CL_ParseStaticSound (cls.protocol == PROTOCOL_NEHAHRABJP2 || cls.protocol == PROTOCOL_NEHAHRABJP3 ? true : false);
                                break;
 
                        case svc_spawnstaticsound2:
index 05134680cb1e4473a666aa3b4a45dd3fcd4fb1bc..d60e98e6b516a914e1452175ea0ffeb51161793d 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -1377,7 +1377,7 @@ SV_ModelIndex
 */
 int SV_ModelIndex(const char *s, int precachemode)
 {
-       int i, limit = ((sv.protocol == PROTOCOL_QUAKE || sv.protocol == PROTOCOL_QUAKEDP || sv.protocol == PROTOCOL_NEHAHRAMOVIE || sv.protocol == PROTOCOL_NEHAHRABJP || sv.protocol == PROTOCOL_NEHAHRABJP2 || sv.protocol == PROTOCOL_NEHAHRABJP3) ? 256 : MAX_MODELS);
+       int i, limit = ((sv.protocol == PROTOCOL_QUAKE || sv.protocol == PROTOCOL_QUAKEDP || sv.protocol == PROTOCOL_NEHAHRAMOVIE) ? 256 : MAX_MODELS);
        char filename[MAX_QPATH];
        if (!s || !*s)
                return 0;
@@ -1440,7 +1440,7 @@ SV_SoundIndex
 */
 int SV_SoundIndex(const char *s, int precachemode)
 {
-       int i, limit = ((sv.protocol == PROTOCOL_QUAKE || sv.protocol == PROTOCOL_QUAKEDP || sv.protocol == PROTOCOL_NEHAHRAMOVIE || sv.protocol == PROTOCOL_NEHAHRABJP || sv.protocol == PROTOCOL_NEHAHRABJP2 || sv.protocol == PROTOCOL_NEHAHRABJP3) ? 256 : MAX_SOUNDS);
+       int i, limit = ((sv.protocol == PROTOCOL_QUAKE || sv.protocol == PROTOCOL_QUAKEDP || sv.protocol == PROTOCOL_NEHAHRAMOVIE || sv.protocol == PROTOCOL_NEHAHRABJP) ? 256 : MAX_SOUNDS);
        char filename[MAX_QPATH];
        if (!s || !*s)
                return 0;
index a9aec2b93282d3cf78f90c4fbc2dbc272d52c757..984f9635ac4494afe78410e2d937510be2cccde2 100644 (file)
--- a/sv_send.c
+++ b/sv_send.c
@@ -291,7 +291,7 @@ void SV_StartSound (prvm_edict_t *entity, int channel, const char *sample, int n
        }
        else
                MSG_WriteShort (dest, (ent<<3) | channel);
-       if ((field_mask & SND_LARGESOUND) || sv.protocol == PROTOCOL_NEHAHRABJP2)
+       if ((field_mask & SND_LARGESOUND) || sv.protocol == PROTOCOL_NEHAHRABJP2 || sv.protocol == PROTOCOL_NEHAHRABJP3)
                MSG_WriteShort (dest, sound_num);
        else
                MSG_WriteByte (dest, sound_num);
index ac391a3e26aff1457e852bf7fd6446e24c6adf9f..d2ad2d817ef653450ee483a5541cb6dd95f7d672 100644 (file)
@@ -488,6 +488,9 @@ static void VM_SV_ambientsound(prvm_prog_t *prog)
        if (soundnum >= 256)
                large = true;
 
+       if(sv.protocol == PROTOCOL_NEHAHRABJP)
+               large = false;
+
        // add an svc_spawnambient command to the level signon packet
 
        if (large)
@@ -497,7 +500,7 @@ static void VM_SV_ambientsound(prvm_prog_t *prog)
 
        MSG_WriteVector(&sv.signon, pos, sv.protocol);
 
-       if (large || sv.protocol == PROTOCOL_NEHAHRABJP || sv.protocol == PROTOCOL_NEHAHRABJP2 || sv.protocol == PROTOCOL_NEHAHRABJP3)
+       if (large || sv.protocol == PROTOCOL_NEHAHRABJP2 || sv.protocol == PROTOCOL_NEHAHRABJP3)
                MSG_WriteShort (&sv.signon, soundnum);
        else
                MSG_WriteByte (&sv.signon, soundnum);
@@ -1542,17 +1545,17 @@ static void VM_SV_makestatic(prvm_prog_t *prog)
        if (PRVM_serveredictfloat(ent, modelindex) >= 256 || PRVM_serveredictfloat(ent, frame) >= 256)
                large = true;
 
-       if (large)
+       if (sv.protocol == PROTOCOL_NEHAHRABJP || sv.protocol == PROTOCOL_NEHAHRABJP2 || sv.protocol == PROTOCOL_NEHAHRABJP3)
        {
-               MSG_WriteByte (&sv.signon,svc_spawnstatic2);
+               MSG_WriteByte (&sv.signon,svc_spawnstatic);
                MSG_WriteShort (&sv.signon, (int)PRVM_serveredictfloat(ent, modelindex));
-               MSG_WriteShort (&sv.signon, (int)PRVM_serveredictfloat(ent, frame));
+               MSG_WriteByte (&sv.signon, (int)PRVM_serveredictfloat(ent, frame));
        }
-       else if (sv.protocol == PROTOCOL_NEHAHRABJP || sv.protocol == PROTOCOL_NEHAHRABJP2 || sv.protocol == PROTOCOL_NEHAHRABJP3)
+       else if (large)
        {
-               MSG_WriteByte (&sv.signon,svc_spawnstatic);
+               MSG_WriteByte (&sv.signon,svc_spawnstatic2);
                MSG_WriteShort (&sv.signon, (int)PRVM_serveredictfloat(ent, modelindex));
-               MSG_WriteByte (&sv.signon, (int)PRVM_serveredictfloat(ent, frame));
+               MSG_WriteShort (&sv.signon, (int)PRVM_serveredictfloat(ent, frame));
        }
        else
        {