]> de.git.xonotic.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)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 26 Sep 2011 20:50:29 +0000 (20:50 +0000)
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

sv_main.c

index c60e15b08e97ef7298ee16cc5c879a9f0158b574..d7cee094276bcb6917f7fa7eff41b08a03bc5e4a 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);