Getting the value of current fog (Darkplaces)

Discuss programming in the QuakeC language.
Post Reply
Alex
Posts: 24
Joined: Sun Feb 13, 2011 6:24 pm

Getting the value of current fog (Darkplaces)

Post by Alex »

Hey guys, hopefully someone can help me out here.

In short, I'm messing with the AI range function to vary with the level of fog intensity present in a given map. Lots of fog = less sight range. I could set this map by map, but I've also made a neat function where fog intensity varies/pulses within a map (i.e. blizzard white out effect, transient fog).

What I need to do is...
1. "Get" the value of fog.
2. Isolate only the intensity portion into a float (I don't care about red, green, blue, and all of the other values associated with "fog").

Any suggestions? Can this be done?

I've been messing around with DP builtin #448 cvar_string but no luck.

Thanks,
Alex
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: Getting the value of current fog (Darkplaces)

Post by Spike »

fog is a command. it is not a cvar. it cannot be got.
it is also clientside, not serverside.
Cobalt
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA
Contact:

Re: Getting the value of current fog (Darkplaces)

Post by Cobalt »

Unless you code a seperate QC float for the fog before you pass it to the server console via QC, yea what Spike says.

Otherwise if you floated the last known fog value , it would be a string, then all you need to do is stof (string to float) and either do a localcmd if its single player, or stuffcmd to each playerslot that is active with a player. Its frowned on to stuffcmd in multiplayer, but it can be done and not use alot of resources depending on the engine being used, resources available and hardware power etc.
Alex
Posts: 24
Joined: Sun Feb 13, 2011 6:24 pm

Re: Getting the value of current fog (Darkplaces)

Post by Alex »

Ah, thanks guys, that helped me figure it out.

I actually do have a qc float for the fog intensity which I then ftos into a stuffcmd (this is for single player at the moment, so maybe it should be localcmd, I get fuzzy about the whole server/client distinction) so that I can create the varying fog effect in the first place. In short I think I was already set up for what I wanted without knowing it, though admittedly this is probably a hacky/sloppy way of doing things....

Thanks again,
Alex
Post Reply