]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
detect if items2 field was declared in the quakec rather than checking
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 26 Sep 2011 20:50:29 +0000 (20:50 +0000)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 1 Oct 2011 14:12:13 +0000 (16:12 +0200)
if GAME_HIPNOTIC or GAME_ROGUE because that prevented existing quake
server mods from abusing the runes on the quake hud

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11371 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=b4b94ef8c28c401fc4164688438aac71fdf31c04

sv_main.c

index b5cd29c377c4f29592925d364ff7bb3004d08d08..6d2c9d1898e15b2ee48edea79c1f060c0dd9aff9 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -1978,7 +1978,10 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t
 
        // stuff the sigil bits into the high bits of items for sbar, or else
        // mix in items2
-       if (gamemode == GAME_HIPNOTIC || gamemode == GAME_ROGUE)
+       // LordHavoc: detecting items2 turned out to be tricky, check if the field
+       // was forcefully declared, we want to override serverflags if it was
+       // declared by the qc intentionally, but not if we added it in the engine.
+       if (prog->fieldoffsets.items2 < (int)(prog->numfielddefs - SV_REQGLOBALS))
                items = (int)PRVM_serveredictfloat(ent, items) | ((int)PRVM_serveredictfloat(ent, items2) << 23);
        else
                items = (int)PRVM_serveredictfloat(ent, items) | ((int)PRVM_serverglobalfloat(serverflags) << 28);