Inside3D!
     

3 moderate QuakeC questions

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
Baker



Joined: 14 Mar 2006
Posts: 1538

PostPosted: Thu Aug 21, 2008 4:30 am    Post subject: 3 moderate QuakeC questions Reply with quote

1. How can you set some background music in QuakeC? (Not the cd track or a DarkPlaces .ogg).

2. How can you read information set in the worldspawn in a map? I want to be able to set a flag or variable in a map to specify the availability of a couple of custom QuakeC features?

3. Finally, the starship mod had a low gravity area that was rather hacky in the sense that it set sv_gravity. Is there a good way to have custom gravity per player?
Back to top
View user's profile Send private message
CocoT



Joined: 14 Dec 2004
Posts: 599
Location: Belly-Gum

PostPosted: Thu Aug 21, 2008 5:22 am    Post subject: Reply with quote

Okay, I'm a pretty goofy coder and my ways are often not the most direct ones and/or the ones more experienced coders would recommend, but here is still my two cents...

1 - You coul have a .wav file (it'll have to be shortish and not of the highest quality, otherwise it's going to be too big to precache, though) be played either in replacement of a environment sound or (the way I usually do it), just create a new, invisible entity which will play it throughout the level (something like "sound (self, CHAN_VOICE, "misc/yoursound.wav", 1, ATTN_NONE);" - I think) in loops of a time you'll preset (through nextthink). That way your music could also be heard in engines others than DP. This is how I did it in Quakability Bot Arena (and its first public, infamous "dance tracks" version Smile)

2 -Here, too, there might be less roundabout way to do it, but what I usually do is create a "dummy" entity in the level to which I assign various values in the map editor, then, in QuakeC, I add something like "if (self.tempyourvalue == 1) yourvalue = 1" if I want to make these values global. Again, this is maybe a ridiculous way to do it, but it works Razz

3 - Can't help you there...
_________________
http://www.planetcocot.net/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Lardarse



Joined: 05 Nov 2005
Posts: 243
Location: Bristol, UK

PostPosted: Thu Aug 21, 2008 8:44 am    Post subject: Reply with quote

3: .gravity

Originally added to the engine in 1.07 (for the hipnotic missionpack), it allows an entity to feel gravity at a modified level. setting it to 2 will mean twice the gravity (1600), between 0 and 1 will make it be low gravity (0.125 for a mini Ziggurat Vertigo), below 0 may make it float upwards (untested). 0 acts as being 1, so it's impossible to make something not affected by gravity at all, but this allows you ignore it completely if you don't need to set it for some (or all) entities. Just add .float gravity; at the bottom of defs.qc

All custom engines support this, as they are all derived from the original engine source release (which I beleive was 1.10)

2: create a field for it

Say you want to check for a keypair... something like "price_of_beer" "200". What you need to do is add the declaration .float price_of_beer; in the usual place, and then in worldspawn() have something like if(self.price_of_beer > 250) bprint("Prices here are exhorbitant.\n");

A minor caveat is that if the keypair isn't defined, it will be set to 0, so you will need to find another way to let the QC know that it's happy hour...
Back to top
View user's profile Send private message
Baker



Joined: 14 Mar 2006
Posts: 1538

PostPosted: Thu Aug 21, 2008 9:28 am    Post subject: Reply with quote

Thanks Very Happy

Lardarse wrote:
3: .gravity

Originally added to the engine in 1.07 (for the hipnotic missionpack), it allows an entity to feel gravity at a modified level. setting it to 2 will mean twice the gravity (1600), between 0 and 1 will make it be low gravity (0.125 for a mini Ziggurat Vertigo), below 0 may make it float upwards (untested). 0 acts as being 1, so it's impossible to make something not affected by gravity at all, but this allows you ignore it completely if you don't need to set it for some (or all) entities. Just add .float gravity; at the bottom of defs.qc


Do you happen to know if there is a low gravity area in mission pack 1 somewhere? I've played that one through a couple of times but I don't recall a low gravity area, but it's been a while.
Back to top
View user's profile Send private message
negke



Joined: 16 Apr 2008
Posts: 56

PostPosted: Thu Aug 21, 2008 12:44 pm    Post subject: Reply with quote

Afaik it's only used in the start map and in that one base map where you fly through that dimensional portal (with the lightning beams and all).
Back to top
View user's profile Send private message Visit poster's website
CocoT



Joined: 14 Dec 2004
Posts: 599
Location: Belly-Gum

PostPosted: Thu Aug 21, 2008 2:13 pm    Post subject: Reply with quote

Now I realize my answer to question 2 was totally beside the point Razz
_________________
http://www.planetcocot.net/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
frag.machine



Joined: 25 Nov 2006
Posts: 728

PostPosted: Fri Aug 22, 2008 2:36 am    Post subject: Reply with quote

You can play sounds in loop just having a cue mark in the .wav file. Play it through an entity sound channel and any stock Quake engine will recognize it and assume the cue mark as the point to restart the sound. It also can be stopped as a regular sound. SoundForge can add such cue marks in the .wav file, but surely people can point you to another tools (maybe some freeware or GPL'd program) to do that, since it's a fairy common feature in commercial sound editors.
_________________
frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group