Forum

Adding a new variable to entity_state_t?

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Adding a new variable to entity_state_t?

Postby Mexicouger » Fri Jul 01, 2011 3:52 am

I want to add a 'team' flag for the entity_state_t struct that can be read by the Qc. It seems to only be for prvm_edict_t struct.

Can someone point me in the direction of doing this?

So far, I have gone to the Struct and created a new team variable, and then gone and created this:

protocol.h
Code: Select all
#define U_GLOWTRAIL      (1<<24) // leaves a trail of particles (of color .glowcolor, or black if it is a negative glowsize)
#define U_VIEWMODEL      (1<<25) // attachs the model to the view (origin and angles become relative to it), only shown to owner, a more powerful alternative to .weaponmodel and such
#define U_FRAME2      (1<<26) // 1 byte, this is .frame & 0xFF00 (second byte)
#define U_MODEL2      (1<<27) // 1 byte, this is .modelindex & 0xFF00 (second byte)
#define U_EXTERIORMODEL   (1<<28) // causes this model to not be drawn when using a first person view (third person will draw it, first person will not)

#define U_TEAM         (1<<29) // future expansion


I have then gone to protocol.c, and in the function called, EntityFrameQuake_ReadEntity();, I added this:

Code: Select all
if (bits & U_TEAM)      s.team = MSG_ReadByte();


I am unsure of my direction and would appreciate some guidance.

Thanks.
User avatar
Mexicouger
 
Posts: 514
Joined: Sat May 01, 2010 10:12 pm

Postby Spike » Fri Jul 01, 2011 10:12 am

?

ssqc?

entity_state_t is for server->client entities, and ents on the client. its fields are never readable from ssqc.
adding a team field is useless.

if you're using csqc then use the playerkey builtin to read a player's bottomcolor/topcolor setting (note: QW mods should use "team" instead). If your ent is not a player, you can use the colormap field to match it to a player, assuming you're using the non-dp-compatible engine deltaing extension - the regular csqc protocol which dp does actually support totally bypasses entity_state_t.

thus for both csqc and ssqc, it is useless to add a team field to entity_state_t.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest