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
 
oh... btw, warning F304: unary-not applies to non-unary expression
I liked the warning in the old version where it just told you warning: You may wish to add brackets after that ! operator
 
seems that warning only got a code in revision in july, hence why its not present in the warning message you gave.
you'll need to update your copy of fteqcc if you want to blanket-disable that warning.
alternatively, because the warning is generated regardless of whether setmodel is a builtin or a qc wrapper, you can just do:
#define setmodel setmodel_spanishinquisition
#define precache_model precache_model_omgninja
before your builtin/wrapper definitions.

of course, that hack won't stop you from ever having the problem, and implies that you'll be lazy and forget the cases where it won't work as expected - ie: outside of initial spawn functions.
even fte+dp will display a warning if you setmodel without precaching first, despite them both supporting precaches any time (there may be some edge cases in dp regarding bsp models, iiuc).
either way, triggering auto-downloads mid-map is bad. hurrah for PREcaching. 
 
regarding unary-not, !a&b always looked wrong to me, as a C programmer. The brackets don't change anything, but they do clarify things for people more familiar with C operator precendence. :P 
Cache Miss 
of course, that hack won't stop you from ever having the problem, and implies that you'll be lazy and forget the cases where it won't work as expected - ie: outside of initial spawn functions.

If you've forgotten to precache a model you need, you're screwed either way. What it does is threefold:

1) Allows for external model files in e.g. func_wall (and since you can't know from the QC if the model will be "*10" or "progs/cog_lrg1.bsp", precaching everything that comes through just in case is the only safe way).

2) Permits you to reuse a spawn function which you've already called at the start of the map to create a fresh instance of e.g. a monster mid-game. This is a Don't Repeat Yourself principle thing.

3) Makes spawn function code a little bit shorter and tidier

The part 3 on the end there is more of a bonus, not the point of the code. 
 
thanks, spike! just picked up the most recent version (feb 11 2016)! 
 
note: suppressed 262 more warnings about unreferenced variables, as you clearly don't care about the first 10.

too funny. i need to go clean up this code... 
 
@preach
1) yes, it avoids going through each func+trigger spawn function to ensure that there's a precache_model(self.model) line. I guess it depends how lazy you are.
it'd be nice if engines supported precaches any time, but this implies mid-game downloads and possible reliable-vs-datagram races and things (which would crash vanilla before any illegible server messages), both of which are nasty enough that the qcc(+maybe engine) should still warn if something isn't explicitly precached.

2) by all means wrap precache_model so that it doesn't crash outside spawn functions. wrapping setmodel will just hide things so that compilers cannot reliably detect it.
Ideally the server would only error if the precache is actually new... but considering how many people use crippleware engines, this ideal is admittedly laughable.

3) it would be better to make a 'presetmodel' function that does both, or something. at least then the compiler won't see either the precache or the set.
you'd still need a precache_model if you do an explicit setmodel elsewhere.

4) qcc trying to detect missing precaches is a nice idea, but also still a hack that can only see immediates, with hardcoded function names.
I fully admit that I'm biased towards one of those hacks. :P

@necros
you can use the verbose(aka: -v) option if you want a list of all of them instead of just the first ten.
or you can use #pragma noref 1 and #pragma noref 0 around them if you want the qcc to (mostly) ignore any unimportant defs, like unused builtins etc that you might find in dpextensions.qc (note that this is the mechanism used by fteextensions.qc to silence warnings about all that unused stuff).
Of course, you should only really use this if its meant to be maintained by someone else. 
 
thanks spike! yeah, i was doing them 10 at a time... this is much faster.

also, thanks for the noref pragma... where is the documentation for all these little tricks? the wiki i linked to earlier doesn't seem to have any other pages? 
 
Is there some good article describing how Quake's Lightmapping works? I tried to understand it from BSP format docs, but it looks like some black magic. 
 
lightmaps are basically just textures.

there are 64 'styles'

each face in a map can have at most 4 styles on it.

typically there's only one style, style 0 which is always on.

then there are 11 other styles that flicker and pulse and such. these are the ones you can select in the editor.

each time you make a target/targetname switchable light, the light utility reserves a new style number.
qc then changes the style via lightstyle function. these numbers start at 12.

it's important to note that the target/targetname has nothing to do with anything other than letter the QC pick up the style value that light.exe has added to the entity after compiling. 
I Think He Means Lightmapping 
not light styles.

e.g. the lightmap visualization of dm2 for instance:
http://scampie.net/etc/lit2compare/dm2_1_lit_lm.jpg

This article maybe? http://latchup.blogspot.com/2015/06/quake-lightmaps.html?m=1 
 
I believe, switchable light styles start at 32 
Lightmap On In Dedicated Server Mode? 
Is this hard to do from the engine? Could an extension be made so it can be done in QC ? 
Sound Isn't Looped 
A static entity, with a precached sound runs a 11000hz wav in the right order.
Another setup with the same statements remarks the sound wav isn't looped.

I can't remember I looped the first sound. I start Cool, load the sample, save it as looped. Same outcome, not looped.
Audacity the same, saved looped, same error.

What is the cause of this well or not looped sound? 
@Madfox 
I seem to remember once if the sound was in the /ambience folder, it always seemed to loop no matter the type. Try that and repost here. 
No It Doesn't 
 
Integrate 
I had this earlier, but then Cool-150 adjusted the loop function.
Now I even can save the wav. 
Back To Gibs That Stick.... 
Revised the code and got them sticking to ceilings, with occasional bloodshowers, however if the ceiling is sloped, we need to probably check its angle and apply gravity in a "reverse" direction in some cases possibly. How to get the engine to do that, id say is a challenge.

But I went with MOVETYPE_NOCLIP to get it to slide straight down on the wall, and checkbottom works well to break it out of noclip so far. Im using Darkplaces with setmodelrealbox, so the model actually has what I refer to as a "mass" m basicly its not point size anymore...so you can set larger gibs so slide faster for realism. I updated the code here if anyone wants to take a peek or collaborate / add a tweak:

http://collabedit.com/phw6e 
 
Trying to get a brutal quake going? 
Experiment 
yea, Brutal Doom was maybe where I first saw this back when I tried it. Curious how it looks in Quake. So far that code seems to work kinda well, but sloping surfaces need to be addressed. 
Modified 
Updated the code again. Hopefully now it will know when its not in contact with the surface if its moved to a corner while traveling down, which does not rest on a floor. It ought to detach now and become a regular gib. Still need to test it though...yea all this for a Giblet, right ? :) 
 
i'm pretty out of it right now...... but can someone confirm this..?

basically, whenever there's a collision, in your .touch, you will have a normal of whatever the collision was??

i think with maths, you can generate a downward vector with that normal and gravity and set the movement that way with a MOVETYPE_FLY instead of noclip. 
Correct 
I experimented with that a couple of years ago, thought it made sense and it does seem to return the right normal....at least in Darkplaces engine , not sure about others.

When you think of it, the collision code has to be ran to confirm a collision, and since the eng is likely using some kind of tracelines to determine collisions, makes sense they applied the results to trace_plane_normal somehow.

I ran it by Spike a couple years ago, he said he believes traceline is the best way to get the normal , and in some cases I guess so..but so far in my experiments for what I am crudely doing seems to work ok. 
Stick Gibs Update 
Well, my new modified EntitiesTouching() code did not work too well to detect if the gib was no longer in contact with the surface it was sliding down, so I created a new function which seems to do the trick, and updated the code here [
http://collabedit.com/phw6e ]

For now I commented out the .pusher reference as maybe later we can account for moving BSP objects and handle those cases.

Right now seems to mostly work ok except perhaps the sticking ought not rely solely on its velocity , but also its vectoangles of (gib.velocity) with respect to the surface its hitting? So I suppose we could formulate a tolerance where if the angle is perhaps within +/- 15% of the angle the surface normal is at, then we can have it stick, otherwise make it bounce normally.

Anyone have an idea how to start on this ? Feel free to edit the code, the site lets you collaborate. 
Serious Engine Open Source 
The Serious Engine (Serious Sam 1) is on Github https://github.com/Croteam-official/Serious-Engine 
First | Previous | Next | Last
You must be logged in to post in this thread.
Website copyright © 2002-2024 John Fitzgibbons. All posts are copyright their respective authors.