[q2x] cvars

Nick Trout nicktrout at shaw.ca
Thu Dec 18 23:40:25 EST 2003


> What I was going to say about cvars before was that the main exe, be
it client or server, is responsible for managing the cvars in use by
any subsystems, like the renderer or game logic.  This is what that
ri.cvar_get() stuff is all about.

Ah yes, I figured that out. I assumed it was all statically linked initially
because the DLLs point to cvars in the main exe, but of course it's not,
there is an export mechanism (which I added a few more functions to).

This is part of the slight untidyness. Instead of cvar_t pointers I'm using
references to Lua tables. Some functions use strings to get cvar values and
some use references, ie. Cvar_VariableValue("my_cvar") vs. my_cvar->value. I
made all of cvar_t private (so just about every file in the project has been
touched) so my_cvar->value is now Cvar_GetValue(my_cvar) (where my_cvar is a
Lua reference).

Using references like this should be slightly faster than using strings to
access vars but it would be nice to have a more homogenous interface, i.e.
everything uses strings or everything uses references. I don't know if it's
worth tidying this up right now as significant other portions of code may
change.

> Good job on the transition, let me know when it's done =)

Righto.

I'm off on holiday for 3 weeks on monday so I'll try and get as much done
before then. No laptop I'm afraid.

> You're using Lua 5 I assume?

Yip.

Nick





More information about the q2x mailing list