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
Qdefmake 
Download: https://mega.nz/#!B2wTVa6A!RmkzKaD4VHhOX0zpz9QJjqKtwtKiRxEixT0AUMOtBLk

This is a command line based tool which will read a QuakeC progs.src and all .qc source files listed within, and output a .DEF file compatible with a map editor such as TrenchBroom. http://kristianduske.com/trenchbroom/

This assumes your QuakeC source files contain /*QUAKED*/ style definitions such as those found in the original id software QuakeC sources, as used by the original QuakeEd. For example, from items.qc in the original source:

/*QUAKED item_armor1 (0 .5 .8) (-16 -16 0) (16 16 32)
*/

This makes the laborious task of hand creating a .DEF file a thing of the past, as long as you include the relevant entries in your QuakeC sources when adding or amending entities. While not as powerful as .FGD files, .DEF files have a place and can be a quick way to add map editor support for your new mod!

Source code is included as a simple .c file, which should build on any C99 compiler. 
 
Oh!! That's what those hideous comment blocks are. I figured it was just a way for someone to copy and paste it over into some wierd editor definition in case they lost it. It sounds cool but I still don't understand the use case.

What other formats are there other than .def and .fgd? 
 
The use case is that the original QuakeEd (that id developed and used on NextSTEP to make the original maps) parsed the .qc files and used those definitions to display what entities were available.

The modern use is that all the entries can be stuffed in a .def file and trenchboom (etc) can use them to populate the entity list.

I'm not aware of anything other than .def and .fgd, but maybe there are other formats in use in some of the more esoteric editors. 
Not Convinced 
This makes the laborious task of hand creating a .DEF file a thing of the past, as long as you include the relevant entries in your QuakeC sources when adding or amending entities. While not as powerful as .FGD files, .DEF files have a place and can be a quick way to add map editor support for your new mod!

This is a bit of a tautology - the reason those comment blocks were there was so that ID could write the .def file inline, and then extract it into a single file using a command line tool. The comments don't do anything for the QuakeC processing of the file. You're basically saying you can take all the effort out of writing the .def file, so long as you've already written the .def file. 
 
Thats true however I think the original QuakeEd read the QC files directly at launch and there never was a tool to pull the definitions out into a .DEF. I may be wrong though. 
That's True 
quakeEd already supported cleanly ignoring anything that wasn't contained in a /*QUAKED */ comment block, and when I discovered I could just point qe3 at lunsp2/src/*.qc instead of maintaining a separate .def file an angel got its wings

(the other clue to this is that the comment blocks start with /*QUAKED in the first place ...) 
Would Be Nice If 
There could be a utility that generates a list of all functions in the qc like so:
Function(float arg1, vector arg2),called 0 times, precache Yes
W_Attack(),called 1 times,
weapon_blaster(), called 0 times, precache Yes
Etc.
Etc. 
SUB_Remove Edicts Piling Up 
I have a problem with edicts piling up that have no information other than Think = SUB_Remove and Time = -1. I'm not sure where to look in the qc to find what's causing it. Do TE_STREAM_* ents look like this in the edicts dump? 
Code Request 
Hi Shanjaq. TE_STREAM_ things aren't using up your entity slots, "temporary entity" is just a bad name for them. So the problem must be elsewhere.

Think = SUB_Remove and Time = -1

Can you post the full lines of code that these quoted parts come from? It's hard to tell if they're right or wrong from what you posted. 
 
ent.nextthink <= 0 means the entity will never think, and thus never get removed. use 0.1 instead, or something.


note that the remove builtin will also set nextthink=-1, clear classname+model, but not clear the remove builtin.
those removed ents will be reused later (no sooner than 0.5 secs). so if you're spawning+removing within the same frame then you're going to have at least 0.5 seconds worth of them building up.
qc can still read+write removed ents (unfortunately), but nextent+find+findradius won't find them, and saved games shouldn't list them so I've no idea if this is what's causing them or what - how are you seeing this list of useless ents? 
Edicts Anonymous 
Thanks all for your insights! I'm wondering if there's a leak somewhere in the edict de-allocation, as I sometimes see models/sprites frozen in mid-animation which have no clipping and findradius can't see them. Here is a snippet from edicts.txt after a crash. note the last two, which I'm seeing in the hundreds:

Num.,Time,Class,Name,Model,Think,Touch,Use
1,131.97,player,models/paladin.mdl,player_frames,obj_push,
2,132.16,,,models/flesh2.mdl,ChunkShrink,
...
561,131.96,tsunami,,models/cloud.mdl,ChunkShrink,,
562,131.96,bloodspot,,models/bloodspot.mdl,blood_fall_timer,blood_drop_timer,
563,-1.00,,,,SUB_Remove,,
564,-1.00,,,,SUB_Remove,, 
Fte Quake C Dev 
While changing from ftcq to fte dev compiler I found some small errors. And before get passed with an unknown punctuation, I see for all monsters:

warning F307 type mismatch void entity_pain to void (entity_attacker, float dammage) self.th_pain

What is the statement to catch this error? 
 
You need to pass inflictor as well:

void (entity attacker, entity inflictor, float damage) th_pain; 
 
Usually just self. This is used to differentiate between the projectile inflictor (e.g. the rocket, self) and the attacker (self.owner). 
 
Just add "(entity attacker, entity inflicter, float damage)" to each monster's pain functuon. Example:
void () ogre_pain = {

becomes
void (entity attacker, entity inflicter, float damage) ogre_pain = {



WAIT WAIT...just attacker and damage. AD adds inflictor. 
Yes, Thanks! 
Most errors are fading, when I changed it in an addon monster, but it still keeps errors.
They're not major but when I try to change athe Vore's pain it loops back to the self.th_pain string. And for Shub's error I can't find a pain function, but SUB_Null.

The error starts in client.qc (line 552) PutClientIntoServerclient.qc at the statement for
self.th_pain = player_pain; 
Argh 
I had changed my defs.qc into .void(entity attacker, float damage) th.pain!
Me donkey. 
Nope 
It needs to be that way, so it's the other way around.
I think fte looks for more loose ends than I thought, while it still passes the progs.dat.
Strange that doors.qc with its self_pain error. 
Qcc_pain 
if you just want to silence the warning, you can do:
self.th_pain = (void(entity,float)) foo_notquitepain;
Such casts are generally not recommended as they'll not catch any future changes to your 'foo_notquitepain' function, and you should only ever ADD arguments to the rhs when casting functions (removing/changing args results in the function getting gibberish for the args that were not passed, or passed as the wrong type).
Such explicit casts should always be seen as a claim by the programmer that they know that the result will be safe despite its inconsistencies.

The vanilla qcc just saw function types, and didn't bother to validate the return types nor parameters. whereas fteqcc is somewhat annoying and warns about any inconsistent code that it sees.
Its worth noting that the vanilla qc code is inconsistent but not otherwise buggy. You could fix it purely using casts if you wanted to, but its cleaner to just add the extra args.
And yes, there is some door or trigger or something entity that mixes up touch functions and pain. You can fix that occurrence with a wrapper, but a cast will perform better - not that its significant enough to matter at all. 
@Spike 
Thanks for the info, that keeps me going! 
New Monster Qc 
I'm trying to make a new monster, that shots nails and launches rockets. When I run the qc the monster shoot nails and launches rockets at a low angle, half from bottom.
Also the two actions bump at the same time and I have no idea where to look.

Where is the statement that give more time between the actions? 
Rabbid Fire 
As long as the player is running the relation between missiles and nails is almost even, but when it is tricked into a corner the thing blasts missiles every 0.5 second.

That's no way of surviving, I know it is called Terminator, but unlimited charge is no fight. 
 
...half from bottom... try changing the offset amount from '0 0 10' in TermMissile to higher amount such as missile.origin = self.origin + '0 0 24'; or try copying the value you used for org in LaunchZhaser if you want the missiles to fore from the same place as zhasers do.

missiles every 0.5 seconds you have melee set to fire missiles. If you stay back away then he will only shoot zhasers.

Maybe if you want more delay add more frames or add an attack_finished check. 
2 posts not shown on this page because they were spam
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.