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
@Izhido 
Quick search indicates that it's happening in V_CalcRefdef() and V_CalcIntermissionRefdef(), both in view.c.

It may or may not be obvious but this represents weapon from the POV of the player and is set based on the client state structure (cl.stats).

The reason "find references" (which you probably used) didn't show you any results is that a pointer to cl.viewent is taken in the V_CalcRefdef() body (view = &cl.viewent;) and later assignments are done on the temporary pointer (e.g. view->model = cl.model_precache[cl.stats[STAT_WEAPON]];
mentioned above).

Hope this is the answer you were looking for. Non-vanilla engines perform some additional operations on cl.viewent but I haven't seen any other model assignment logic in QS so I assume these are the only two places where it happens.

HTH 
@Thulsa - Thank You! 
It *did* help. Looks like I need to be way more careful about variable assignments in there for future changes. 
Hey 
I made a monster.A copy of RMQ's flayn monster code,but edited heavily to fit in with regular quake.
I removed the reanimation code,torso splitting code and some functions that weren't in the file.

Now the thing is,I precached the models and I even have them in my progs folder for the mod.
In the requiem engine, "create monster_flayn" works,but and invisible monster spawns.

QSS and MarkV don't even start the e1m1 ENT file with the monster_flayn that replaced all monster_army.

Should I rewrite the code?

Am using progs_dump_devkit_v110, vanilla dump works fine but my mod doesn't load e1m1.ent with the new monster 
 
Hello, In the Chasm thread, Madfox said he had some trouble getting infighting between Chasm monsters to work. Can somebody with experience in that area help?

The thread is here:
http://www.celephais.net/board/view_thread.php?id=61776&start=4 
Walk_monster_start 
The main factor is that I used most qc from the quake entities. I have no trouble with the infight, as quake entities usual have that in commen.

When I try to target a monster to a path_corner the game stops with a walk_monster_start error.
A bit strange as the spider just follows its path without problem, and it is the same kind of imported entity.

Also I used a subroutine into the stand function.
This is a hack I found to interfere with the stand function. The Mong soldier looks around, and while he is watching aside it won't attack.
For some reason Faust, who has the same stand function, ony uses half of the frames. It is as if some arithmic cuts out the other half.

void() faust_stand11 =[ $stand11, faust_stand12 ] {ai_stand();};

//CLIP HERE
//HERE IS THE ROUND CODE:

void() faust_round1 =[ $round1, faust_round2 ] {};

void() faust_round24 =[ $round24, faust_stand13 ] {};

//END ROUND CODE

void() faust_stand12 =[ $stand12, faust_check ] {ai_stand();};

// faust_check IS CALLED IN faust_stand12, TO DETERMINE IF HE'LL STAND OR ROUND.
void() faust_check =
{
ai_stand();
if (random() <0.25)
faust_stand12 ();
else
faust_round1 ();
};
//end strat_check
// CLIP HERE...


In game it uses only untill frame round12, and then switches back to stand13. 
Donkey 
Chasm monsters only have a stand and run function.
So asking them to walk is like asking for a high Q.
Fetched a walk pose and all is well. 
That Is.., 
what is it when one entity starts an infight with another one
and the attacked one doesn't respond? 
 
why do you need to ask Chasm monsters to walk? just have them run Patrol. 
Walk_monster_start 
They need the order of th_stand, th_walk and th_run, otherwide the error walk_monster_start occurs in monster.qc. 
 
so the Chasm monsters can still Patrol, but they use their run function? 
Animated Poses 
As soon as they end their walk function they use run for chasing.
Most chasm entities have no walk function, spider even has no stand function. In Chasm it waits aside in walk pose. 
Compiling Progs.dat - Very Strange Bug In-game 
Hello everybody

Here it the strange thing...

If compiling an original, unchanged Source Code from Abyss of Pandemonium v2.0 using FTEQCCGUI.exe
there is an ammo counter bug occurs while switching weapons after shhoting.

For example if type "impulse 9" and start shooting from Nailgun, for instance from 200 nails to 188 and then switch to Super Nailgun you will see 189 nails in ammo instead of 188!

If you shoot from Super Nailgun from 188 nails to 182 for example and then switch to Nailgun, you will see 184 nails in your ammo counter instead of 182!

So cycling forward after shooting adds 1 piece of ammo to the weapons which share the same ammo type with the previous one and cycling backwards adds 2 pieces of ammo to the weapons which share the same ammo type with the previous one.

Same problem goes to shotgun weapons, lightning, and rocket/grenade launchers.

Could you guys tell me what may cause this proble and how to eliminate it? 
 
no idea, but some things to check:

does the big ammo counter on the HUD match the values of the 4 small ammo counts? if not, it may be a problem with setting self.currentammo

otherwise, there are very few places where things like self.nails, self.shells, etc. are set, at least in vanilla code -- but maybe AOP adds some weird new code that has a bug. In that case, search for something like ".ammo_nails =" and see what you can find that looks suspicious 
It's Fixed 
As Seven from QuakeOne.com said

"It happened during decompilation of the original source.
As you know, the AoP progs.dat was reverse engineered !
FrikQCC´s decompiler made some bad decisions, so..."

He provided me with the "cleaned" source code and now I'm making the patch for AOP v2.0 to make it more enjoyable (like vanilla) Quake.

Thinking of releasing it here, when I'm finished with this. 
Talking Player... 
Hey everyone! Sorry for the dumb question but is this the right place to post regarding QC coding help?

If it is, here's my question:

I've been trying to work out what might be the best way to add more vocalization for the player. Like adding some smack talk (i.e. Duke Nukem). One way I was thinking might be an inverted obituary function? But not entirely sure tbh, is there a better way of doing this? Point in the right direction? 
Pre-Recorded Obituary 
Hi MrC. I'd say you were along the right lines with looking at the obituary function. In my view the place to start is the function which calls the obituary function, which is a function called Killed in combat.qc.

If you look at the function, there's a block which starts

if (self.flags & FL_MONSTER)

I'd add a bit of code inside that block:

if (attacker.classname == "player")
    PlayerRemarkOnKill(attacker, self);

Then your PlayerRemarkOnKill function looks like:

void(entity player, entity monster) PlayerRemarkOnKill =
{

};

I'll leave you to play around with what you actually want to do with the remarks. Because the monster entity is passed to the function, you have the option of playing lines that are specific to a particular enemy type. 
 
Whoa, thanks Preach! Just got it all added and it works perfectly. And good call with checking classnames for specific commentary :) 
QC Frame Function Generator 
Ok, so onto my next conquest... I was curious about frame functions and if there were any little tools out there for generating QC frame functions? I mean, not to sound lazy or anything.

I know there are alternative methods like framegroups but how about calling sounds etc... at specific frames when using this method?

Thanks again and sorry if this is such a basic question, still learning my way around. 
FTE Particles On Sky Boxes... 
(NOTE: Posting here because "getsurfacenearpoint" and "surface" keywords show up in this thread more than anywhere else on the web)

Goal: Specify FTE particles when entity touches the sky on any quake 1 maps inlcuding mission packs.

Background: As we know, the vanilla "pointcontents(self.origin) == CONTENT_SKY" code doesn't work as intended on many original maps. Fortunately, getsurfacenearpoint in FTE works great for getting surface texture names. I've used it for coding quakec entities (bullets, missles, etc) to fly through the sky without exploding or leaving decals. However, I can greatly simplify the code if someone could tell me how to use FTEQW's "clippeddecal" particle parameter.

Question: The help for clippeddecal states, "The two extra args allow you to spawn these decals ONLY on surfaces with matching surfaceflags." What surfaceflags are recognised, and where are they called from? Any examples? FWIW, using getsurfacenearpoint & getsurfacetexture gives "sky1" on original mission maps. 
FTE Particles On Sky Boxes... Exemplar Video 
Here's an exemplar video showing the Lava Nails flying across the sky, from my question above. All effects are FTE particles, except for the bullets through the sky which I had to code in quakec. So, to eliminate the QuakeC coding, I would really like to know if FTE's clippeddecal surfaceflags can be used instead??? 
Why Is There Not A Defrag Mod In Quake 1? 
What are the major differences between the Q1 engine and the Q3 engine?

Are there any differences in physics between vanilla quake 3 and the defrag mod?

Are the certain limitations in the quake 1 engine? 
 
the QdQstats mod is kind of like that, it has built in timers for speedrunners. I don't know enough about the dfrag mod to answer more. 
How To Do Func_door From Scratch 
Unfortuantely all qc documentation there is, is spread all over the net. Any leads?

btw, long time no see ^^ 
Reimplementation Query 
Hi wakey. I haven't seen a re-implementation of func_door before, and I can think of a few reasons why. Firstly, the code for the func_door is one of the more complex parts of standard Quake, it's certainly a longer .qc file than any of the other brush objects (in fact, it's longer than misc.qc which contains definitions of dozens of different classes). Aside from doing lots of stuff, the bits about e.g. linking doors are complex in themselves.

Often when writing a mod, a good degree of compatibility with existing maps is desirable. It would be tough to ensure the rewritten code had that compatibility - remember that the func_door is a really flexible entity, often used to create platforms and other moving objects. Trying to remain compatible with the core function is one thing, staying compatible with all the unusual use cases is harder.

Lastly, it's worth pointing out that some of the standard functionality of a func_door depends on "library functions" like SUB_CalcMove and SUB_UseTargets. Can a re-implementation assume those still exist, or should it also code those functions from scratch?

Given all of that, I hope you don't mind me asking first why you want to write func_door from scratch? If it was for a Total Conversion where you create a 2D platformer in Quake, then a lot of the concerns above go away, your mod only runs on the maps you make for it, so compatibility isn't an issue. If it's for a more standard Quake mod I worry that it's a lot of writing and testing code for a benefit I can't yet see... 
Clarification: 
Yes, total conversion.(though, not a 2D platformer).

Everything else is already coded from scratch, more or less.(roughly following Ender's "quake from scratch" tutorials, to get basic functionality up and running)

The standard door.qc files all have dependencies that are not implemented yet, thus I can't just drop them in like that.

Lastly, as stated by my colleague, the documentation of the DarkPlaces engine is severely lacking(fragmented at best), when compared to the engines I'm used to (e.g. Unity, Godot, or eaven UE4). 
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.