News | Forum | People | FAQ | Links | Search | Register | Log in
Coding Help
This is a counterpart to the "Mapping Help" thread. If you need help with QuakeC coding, or questions about how to do some engine modification, this is the place for you! We've got a few coders here on the forum and hopefully someone knows the answer.
First | Previous | Next | Last
Cheers 
for functions to be consecutive, it is the function bodys that need to be consecutive, not their prototypes.

This sounds helpful rather than harmful, you don't need to worry that someone ahead of you in the compilation list prototypes one of your functions and mucks up the order. I hear what you say about entities being much more sensible for things with actual state, but I think there's a niche here which it could fill. Thanks for the post! 
Binary Saves And Dealing With New Versions 
non-quake question... say you are saving some data into a binary file. let's say preferences. somewhere along the line you may add in some new feature with accompanying preferences.

how do you deal with this when you need to read the old binary data and do a one time upgrade? do you just keep your old loading method and use the first byte to identify which loading method to use? is there a better way? 
 
you can create an extensible format... preferences are a list of key + value, so in theory you just want to add new key/value pairs over time. You either want a directory at the beginning of the file that first has "number of entries" and then an array of offsets to each entry, and then each entry can have a standard format, or you can have fixed size entries and just keep reading until you hit EOF, then you don't need a directory.

Either way, when reading the file, if it doesn't have all of the entries you expect you can just use the default value for the missing preferences.

Question: why do you want it to be binary? 
Sound 
What can I do to prevent a new model,
that is jumping up and down to cause the

client.qc line : 849

void() PlayerJump =

sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);

sound? 
 
Question: why do you want it to be binary?

I want it to be portable (eg: no registry keys) but I don't want the user messing with things. 
Sound() 
Actually I ment,
how do I stop the sounds h2ojump.wav / dland2.wav
for a new model playing in game? 
Necros 
Google for flatbuffers. 
Then Become FB Friends With Aardappel 
 
MadFox 
cvars...
sv_sound_watersplash ""
sv_sound_land ""
these two cvars exist in dp+fte, probably not other engines.

self.contentstransition = someemptybutnotnullfunc; can be used as an alternative for the watersplash sound, but its more awkward and probably no better supported.


@necros: just use base64 on a text file or something. key+value pairs are good for forwards compat (even if were to use key+valuelen+valuedata blocks in a binary format, embed the version of data as part of the key or something). 
Maaaaaaaaaaadfox O____O 
I replace those sounds with silent .wav files! 
...anyway 
settled on a pretty simple method. i have just assumed that the order of stored prefs will always be the same, and anything new will be added to the end.

this way, i can just go ahead and read things in with default values if we're at EoF as in metl's suggestion. but this way i don't need any kind of headers or whatever.

FlatBuffers looks cool, but I like to avoid using extra libs when possible, although that looks like it'd be very useful for more complex systems (eg: games) so thanks for the heads up! 
Necros 
Yeah, that sounds like proper YAGNI design ;-). However, I wonder why you don't want users to be able to edit the prefs? 
Also 
Of course they're still able to do so, you're just making it a bit harder for them. 
 
There's a thin layer of amusement in the concept of someone on a Quake editing message board talking about ways to prevent users from tinkering with their settings and preferences. :P 
 
What's it got to do with Quake? 
The Best Thing I've Read Once Upon A Time 
Advocating for removing console access for the player. 
 
Nothing, directly. But the openness of Quake and how it allows hacking at pretty much every level, which makes this community possible in the first place ... And then necros is determined to lock his users out.

THAT'S ALL! Just found it slightly amusing. 
 
Pfft entitled quakers thinking they should be allowed to change stuff 
 
Maybe the idea is to edit the prefs via the program interface (won't break things) instead of typing whatever in a text file? (will break things) 
Yeah, Pretty Much 
You guys should see it soon anyway. :P 
Cvars 
I searched for the use of this statement, but didn't get much further in QCman or Quakewiki.
I have no idea how to use it or where I should place it in the qc to make the two sounds silent.

It's about a dopefish, that tumbles in and out of the water, but the side effect is, that it produces the landing bounce of the demonfiend and the watersplash in quiet an anoying way throughout the level.

I could replace these sounds with silent.wav, but then other use for entities gets lost and that is not my intention. 
 
tweaking those two cvars (via the cvar_set builtin or via default.cfg) is basically equivelent to replacing the wavs with silence.
and silence works in more engines, so either go with silent wav files or just live with the noise. 
"while" Loop On A Monster Attack As Long As The Target Is On Sight 
I'm continuing on my singleplayer mod, and after the two guns I made I finished doing the assets of the Nail Infantry (now reduced to an enforcer reskin, trying to fuse the original model with another one spawns more difficulties than necessary), all I need is a tweak for the attack so that he attacks like the ChainGunner in Doom 2, as in he continues firing as long as the target is on sight.

I know for one thing it's something like "while ["target" is on sight"]=>[attack sequence]", but how should I write "while ["target" is on sight"]"? 
 
if(visible(self.enemy))

don't use while, or he'll dump all his ammo in a single frame. or, use while just to see that happen first. 
Personally 
I'd have him cycle between a few frames of animation - one which fires the projectile and one which checks to see if his target is visible. And then either some padding frames in between to make it less likely that he stops afiring s soon as the player is out of sight, or store a value and use a counter to do the same, resetting the count each time he starts firing again.

You might want to look at the scrag shooting - it has a couple of clever ideas in there, like firing at where the player was before they went out of sight.

You could get leading from chthon as well, but leading sucks. 
First | Previous | Next | Last
You must be logged in to post in this thread.
Website copyright © 2002-2025 John Fitzgibbons. All posts are copyright their respective authors.