Forum

remembering floats

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

remembering floats

Postby behind_you » Tue Apr 19, 2011 8:37 am

hey its been a while. finally got back online. ugh

anywho. every time the client is put into a level, his floats get reset to their initial variables. how do i make the float "survive" the loading times?

it drives me bonkers lolz
User avatar
behind_you
 
Posts: 237
Joined: Sat Feb 05, 2011 6:57 am
Location: Tripoli, Libya

Postby leileilol » Tue Apr 19, 2011 11:11 am

use the parms! They get transferred in memory
i should not be here
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Postby ajay » Tue Apr 19, 2011 4:46 pm

Are floats saved in savegames? My mod is basically one level with goals to be acheived, so a float would be set to 1, 2, 3 etc depending on what goal the player was on. Therefore if the player died and went back to a previous save or just saved and had a break, would that float need to be saved to a parm to survive that?
User avatar
ajay
 
Posts: 559
Joined: Fri Oct 29, 2004 6:44 am
Location: Swindon, UK

Re: remembering floats

Postby Nahuel » Tue Apr 19, 2011 5:09 pm

behind_you wrote:hey its been a while. finally got back online. ugh

anywho. every time the client is put into a level, his floats get reset to their initial variables. how do i make the float "survive" the loading times?

it drives me bonkers lolz

also you can try with the frik_file to save the parms if you are using darkplaces.
the best beginning is reading the code of the great mod "conquest" of wazat.
The use of the frik-file is very good documented for the parms.

http://www.moddb.com/mods/conquest
hi, I am nahuel, I love quake and qc.
User avatar
Nahuel
 
Posts: 492
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Postby mh » Tue Apr 19, 2011 6:07 pm

You've got 16 "spawn parms" in the globals table which are intended to be used for this; should be called parm1..parm16. They survive save/load transitions so they seem ideal. ID Quake uses something like the first 9; that leaves 7 for your own use.

If you need more than 7 floats then you'll need to find something else, but I strongly advise always using the built-in functionality until such a time as you've definitely determined that it's not sufficient for your requirements.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby behind_you » Sat Apr 23, 2011 7:01 am

oh i c. thanks everyone!
User avatar
behind_you
 
Posts: 237
Joined: Sat Feb 05, 2011 6:57 am
Location: Tripoli, Libya

Postby frag.machine » Sun Apr 24, 2011 12:09 am

There's also the scratch1...scratch4 cvars to abuse. IIRC they're not used in standard QuakeC, so you can mess with them without breaking anything.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2090
Joined: Sat Nov 25, 2006 1:49 pm

Postby mankrip » Sun Apr 24, 2011 2:42 am

However, unlike the parms, those cvars aren't cleared when starting a new game. Making them behave like the parms would require a little more code.
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
Dev blog / Twitter / YouTube
User avatar
mankrip
 
Posts: 915
Joined: Fri Jul 04, 2008 3:02 am

Postby mh » Sun Apr 24, 2011 9:39 am

saved1..saved4 also exist in stock ID Quake don't they? Again you need to reset them for new games, but they do get saved to you config if you need that. (checks - yes, they do exist, and are actually defined in pr_edict.c which makes it explicit that this is their intended use).
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby leileilol » Sun Apr 24, 2011 3:11 pm

mh wrote:saved1..saved4 also exist in stock ID Quake don't they?

They are 1.07 additions I believe (Along with scratch as well)

1.06->1.07 has a lot of weird differences that most players believe are de facto standard now. If we could only get Carmack to put out any of the 1.00-1.06 engine sources... a Chocolate Quake could be accurately possible (basically a port that tries to be DOSQuake without any feature creep, but through SDL output, be very portable and able to call on specific quake versions by parameter)
i should not be here
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest