If you feel it was inappropriate to post this here, please
let me know and accept my apologies.  I also apologize for
the length of this post.  I am looking for comments and
constructive criticism on the code I've written.

Since most of the user variables in entvars_t, playermove_s
and other structures that exist were already being used, I
decided to implement a method for adding "user" variables
that would behave in the same way - that is, they would be
associated with a particular entity and would also be
available from within the physics code.  The basic idea was
that I added a structure (user_variables_t) to CBaseEntity
and then used pev->iuser4 to hold a pointer to the
structure.  This way, the pointer was passed in any
structure that holds iuser4, including playermove_s.  Then I
created a user message to send the data during each call to
UpdateClientData in client.cpp.  On the client, I caught the
user data message and held the data until the next client
update came in (since the user data message got sent just
before the client update) and then associated the
user_variables_t struct with the network update that came
in.  Between updates, a dynamically allocated linked list of
user_variables_t structures was maintained so that
client-side prediction would work.  I think I've got it
debugged (I've been using it for several weeks without
obvious problems), but I wanted to get input from
programmers of higher caliber than me about side-effects I
may have overlooked.  I have written the changes up in the
form of a tutorial, but have not released it yet since I
wanted to make *absolutely* sure it was bug free first,
considering the potential for total havoc with the use of
dynamic memory allocation.  The tutorial is located at:
http://personal.atl.bellsouth.net/bhm/j/m/jmhunter/Files/use
rvars.htm
I would appreciate any comments you might have.

Thanks

Jim

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to