What I am trying to do is to read a value from the QC, and load it into the cl.stats array for future use. It won't seem to work however.
This is what I have so far. I don't know if I'm on the right track or not.
in Progdefs.h, in entvars_s, I added:
Code: Select all
float experience;
Then in sv_main.c in the function SV_WriteClientdataToMessage, I added:if (cls.protocol == PROTOCOL_DARKPLACES5)
{
cl.stats[STAT_WEAPONFRAME] = (bits & SU_WEAPONFRAME) ? MSG_ReadShort() : 0;
cl.stats[STAT_ARMOR] = (bits & SU_ARMOR) ? MSG_ReadShort() : 0;
cl.stats[STAT_WEAPON] = (bits & SU_WEAPON) ? MSG_ReadShort() : 0;
cl.stats[STAT_HEALTH] = MSG_ReadShort();
cl.stats[STAT_AMMO] = MSG_ReadShort();
cl.stats[STAT_EXP] = MSG_ReadShort();
cl.stats[STAT_SHELLS] = MSG_ReadShort();
cl.stats[STAT_NAILS] = MSG_ReadShort();
cl.stats[STAT_ROCKETS] = MSG_ReadShort();
cl.stats[STAT_CELLS] = MSG_ReadShort();
cl.stats[STAT_ACTIVEWEAPON] = (unsigned short) MSG_ReadShort ();
}
else if (cls.protocol == PROTOCOL_QUAKE || cls.protocol == PROTOCOL_QUAKEDP || cls.protocol == PROTOCOL_NEHAHRAMOVIE || cls.protocol == PROTOCOL_NEHAHRABJP || cls.protocol == PROTOCOL_NEHAHRABJP2 || cls.protocol == PROTOCOL_NEHAHRABJP3 || cls.protocol == PROTOCOL_NEHAHRABJP || cls.protocol == PROTOCOL_NEHAHRABJP2 || cls.protocol == PROTOCOL_NEHAHRABJP3 || cls.protocol == PROTOCOL_DARKPLACES1 || cls.protocol == PROTOCOL_DARKPLACES2 || cls.protocol == PROTOCOL_DARKPLACES3 || cls.protocol == PROTOCOL_DARKPLACES4)
{
cl.stats[STAT_WEAPONFRAME] = (bits & SU_WEAPONFRAME) ? MSG_ReadByte() : 0;
cl.stats[STAT_ARMOR] = (bits & SU_ARMOR) ? MSG_ReadByte() : 0;
if (cls.protocol == PROTOCOL_NEHAHRABJP || cls.protocol == PROTOCOL_NEHAHRABJP2 || cls.protocol == PROTOCOL_NEHAHRABJP3)
cl.stats[STAT_WEAPON] = (bits & SU_WEAPON) ? (unsigned short)MSG_ReadShort() : 0;
else
cl.stats[STAT_WEAPON] = (bits & SU_WEAPON) ? MSG_ReadByte() : 0;
cl.stats[STAT_HEALTH] = MSG_ReadShort();
cl.stats[STAT_AMMO] = MSG_ReadByte();
cl.stats[STAT_EXP] = MSG_ReadByte();
cl.stats[STAT_SHELLS] = MSG_ReadByte();
cl.stats[STAT_NAILS] = MSG_ReadByte();
cl.stats[STAT_ROCKETS] = MSG_ReadByte();
cl.stats[STAT_CELLS] = MSG_ReadByte();
if (gamemode == GAME_HIPNOTIC || gamemode == GAME_ROGUE || gamemode == GAME_NEXUIZ)
cl.stats[STAT_ACTIVEWEAPON] = (1<<MSG_ReadByte ());
else
cl.stats[STAT_ACTIVEWEAPON] = MSG_ReadByte ();
}
Code: Select all
stats[STAT_EXP] = (int)ent->fields.server->experience;
Then in QC, I have:
Code: Select all
.float experience;
Help would be greatly appreciated