View previous topic :: View next topic |
Author |
Message |
Baker

Joined: 14 Mar 2006 Posts: 1538
|
Posted: Fri Aug 22, 2008 4:59 am Post subject: Global vars in QuakeC, not possible right? |
|
|
It is my understanding that global variables aren't possible in QuakeC, only global constants.
In particular, when the level changes all information is lost except player info (parm10, etc.)
Am I right about the above?
And if so, I should use extraneous cvars like scratch1, scratch2, saved1, saved2, etc.) to preserve information? (Unless I want to add extra fields to entities and I've read that uses a lot of memory because each edict used has that field?).
[add: btw, I'm not referring to storing player specific information. I just referring to general global variables not related to the player.) |
|
Back to top |
|
 |
Urre

Joined: 05 Nov 2004 Posts: 1073 Location: Sweden
|
Posted: Fri Aug 22, 2008 8:40 am Post subject: |
|
|
There you go. Note the lack of assigning a value to it, which would make it a constant. _________________ Look out for Twigboy |
|
Back to top |
|
 |
FrikaC Site Admin

Joined: 08 Oct 2004 Posts: 947
|
Posted: Fri Aug 22, 2008 4:15 pm Post subject: |
|
|
if you want persistence across level changes, a standard global won't work, all globals are reset (actually the progs are completely unloaded then reloaded) on level change. The only global variable kept across level changes is serverflags. If you want others, yes, then using cvars is not a bad solution. |
|
Back to top |
|
 |
Baker

Joined: 14 Mar 2006 Posts: 1538
|
Posted: Sat Aug 23, 2008 3:36 am Post subject: |
|
|
FrikaC wrote: | actually the progs are completely unloaded then reloaded) on level change. The only global variable kept across level changes is serverflags. |
Thanks for making that clear. Had no idea the progs is actually unloaded/reloaded. |
|
Back to top |
|
 |
|