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
Found It (again) 
It seems instead of
missile.effects = EF_BRIGHTFIELD;
I had to put this in friend.qc:
missile.effects = 1;

No idea why it doesn't work with the actual name, but main thing is it works. 
Tracking Down Crash Origin 
I believe I have tracked down the origin of the crashes when switching Shrak weapons.

Whenever W_ChangeWeapon or one of the two weapon cycling (impulse 10/12) functions is called, it's flashing the weapon in the HUD, something like flashWeapon (fl) or flashWeapon (self.weapon). If I comment out this line, crashes won't happen any more regardless of mousewheel scrolling speed.

The function is as follows:

void () flashWeaponBack =
{
if (!(self.owner.items & self.items))
{
self.owner.items = (self.owner.items + self.items);
}
remove (self);
};

void (float fl) flashWeapon =
{
local entity e;

e = spawn ();
e.owner = self;
e.items = fl;
e.think = flashWeaponBack;
e.nextthink = (time + 0.1);
if (self.items & fl)
self.items = (self.items - fl);
};

Can anybody see what could be wrong with this? 
It's A Complex Problem 
OK, I think I see the shape of the problem if not the exact fix, brace yourself...

The crash you posted a little while back contains the error message indicating there's an infinite loop going on. CycleWeaponCommand is built around a potentially infinite loop:

while (1)
{
...
}

The only escape from the loop is the return statement near the bottom

if ((self.items & self.weapon) && (am == DROIDMODE_GRAP))
{
flashWeapon (self.weapon);
W_SetCurrentAmmo ();
return;
}

The first run through the loop looks at your current weapon and "suggests" changing to the next weapon in the game after that. This final bit of code checks whether you have the suggested weapon and ammo to use it; if you do the code changes to it and exits the loop. If not, the next run through the loop starts from the suggested weapon, and changes the suggestion to the weapon after that.

In regular Quake, there is an implicit guarantee that this loop will terminate: the player always has the axe, and the axe is always a valid weapon to select. The loop will suggest the axe after at most 8 attempts, the axe is always possessed by the player, and there's never an ammo requirement for wielding it.

In the Shrak code, the weapon of last resort turns out to be in slot 2 (IT_SHOTGUN). This is the only weapon which doesn't have an ammo requirement. This would be OK ordinarily, and it's only when we consider the effect of flashWeapon that we get to the problem.

flashWeapon makes the icons flash on the hud in a rather dramatic fashion. It genuinely removes the weapon from the player's inventory for a fraction of a second, before putting it back. If you've followed what's going on in the description of the loop above, perhaps you can see the problem that arises...

Because the weapon is actually removed from the player inventory, however briefly, there exists a window where CycleWeaponCommand can't select that weapon and has to skip it. If you quickly flash all of the player's weapons at once (maybe cycling weapons rapidly with the scroll-wheel) all of the players weapons can be removed at once. At this point, CycleWeaponCommand has no suitable candidates to select, but it doesn't give up, it just keeps trying all the weapons in loop after loop until the game crashes. 
Haxxing 
OK, that's an explanation I understand. I expected some kind of hack here, and tricking the game into "thinking" you are picking up a weapon for the first time during weapon cycling is pretty much that.

One thing to keep in mind: Even the shotgun replacement uses ammo (cells). There is a function which sets its ammo to 1 even if the counter reaches 0, but if you use the Friend Maker which uses the same ammo type, 0 cells are still possible. Shrak in fact does not have any weapon without ammo requirement, even the tools in the axe slot can run out. This might be a problem since the general function structure from original Quake is maintained.

What could be a possible solution besides commenting out that flash function entirely? The way you describe it, only a sufficient delay while switching can bridge that gap. TBH that excessive flashing during switching looks stupid anyway, fast switching would be more important. 
 
The easiest solution would be to put a counter in that infinite loop, and exit if it reaches a high number like 100, assuming that if you reached that high you have exhausted all options. Not super elegant but I don’t see any downsides. 
 
What if you put a delay before Impulsecommand() which is higher than the nextthink delay from flashWeapon (time+0.1)? It would slow down weapon cycling, but it would make sure to avoid the situation with no weapon available. That is a poor approach however and I'd rather comment out that useless flashing thing. 
To Clarify 
By "ammo requirement", I really meant "ammo requirement within that function" - it's the only weapon which doesn't set the am flag to 1. This in effect means lack of ammo doesn't prevent you switching to the weapon, separate from any ammo requirement for actually attacking.

In theory one approach to fix the bug would be to have a second field called items_borrowed. While an item is being blinked off, you store it in items_borrowed (and remove it from there when you put it back into the regular items field). Then in all the weapon selection code you check if the weapon is in either items OR items_borrowed. Lot of effort to preserve a not particularly useful effect... 
Main Thing Is It's Done 
Indeed, it's a useless feature. Since it's only causing issues and contributing nothing to actual gameplay, I decided to just remove the entire function from the code and be done with it. In return you now have super-fast weapon switching without any risk of triggering crashes.

It's interesting that Matt Walsh had apparently been kinda aware of the problem since he implemented a delay timer in ImpulseCommands. However, he placed it in the wrong position within the code and it wasn't working very well in any case. In 1996, available hardware was probably not capable of such fast input which would allow you to send impulse commands in rapid succession, but nowadays mousewheel abuse is entirely possible.

One way or the other, thanks a lot for helping me to figure out what was going on here, guys! I am a bit proud of myself since I was at least able to find the exact location of the error. For someone without any previous QuakeC knowledge, I consider it quite an achievement. 
Another Simple Thing 
Is it possible to check whether a file exists (e.g. a certain bsp file inside a pak) - and if so, how (ofc)? 
Posts Marked As Spam At Ijazz's Request. 
I presume they'll be happy for discussion on the issue to continue so I've requoted the bulk of the post here:

So now I migrated to Rubicon Rumble Pack's code.With some of my changes.

I have some questions.Again.

1.How do I add a weapon? All the bit values upto 8388608 are used.And I tried 16777216 but it doesn't seem to work.

2.How do I do that subtraction thingy with self.items?
How does it work,anyway?

3.I checked out the Keep mod by QMaster,and it has a self.items2.What is the self.items2?
How do I add it in my mod?

I know I can just do a .float self.items2,but how can I manipulate it?
 
Lol 
 
Any Luck Extracting Qtest1's QuakeC? 
I've given a whole bunch of decompilers a try on qtest's progs.dat, and none work. I expect the underlying format/C structs to have changed. Has anyone done this successfully?

So far tried:

proqcc
deacc/reacc
frikdec
unqcc 
Hey Matt 
I'm making a new Q1Test mod for single player. The progs.dat for Q1Test differs , so far as it is only used for deat match game.

I have them ready, and I'm adding a SP with the original monsters.
Decompiling with fte would be an option. 
Here 
 
and sofar for my version..,
Q1Test_Sp 
Q1Test Progs.dat Decompiled 
Is http://home.kpn.nl/lo2kf8/quake/Q1test_src.zip a decompile of the original, or is this self-made attempt to recreate after the fact? Wow! Which version of FTE did you use to make the decompile work?

You are a true saint!

I examined the progs.dat in a hex editor, and it appears to have entries for the monsters. So it seemed we could reverse it an peer back into time. 
Checkoff 
Quaketastic can give you more info about the content and purpose of Q1test. There was never an official release of the Q1testQcc.

The breakpoint is that a compiler can't find the starting progs.scr. So it stops at that point. I recollected the bits after looking at the animation frames and comparing with the original code.

As the readme says it was only a try out to see if the internet connections were OK. So the added Sp monsters are lame as used for DM, aside they were included.

My idea was to add the monsterplay for Sp, add a qc for the Serpent, Vormit and ClassicOgre and make it compatible with the other monsters in SP. The result is Q1Test_SP. I would apreciate if you take a look at it.

Megalol also did a start with a convertion for it some years ago. 
 
Thank you for both the explanation and the attention to detail you paid in recreating/restoring this. I am really impressed with your work.

I am familiar with original QTest from the '90s and my childhood. Mostly what I was interested in was trying to ascertain a deeper understanding of what the actual single player game might have looked like from a https://tcrf.net/Proto:Quake_(PC)/Qtest1 perspective. The history and intent is really the past I am fascinated about. I recall (it's years) the original "Quake 2" comment stubs in the original QuakeC. These felt nuts in retrospect to see, "guys, you're not even done with the first game; what are you thinking?"

I was thinking about doing something to the effect of a unified diff https://en.wikipedia.org/wiki/Diff of the extracted QuakeC from QTest versus the QuakeC from the original v1.01 dump. Of course a fair bit of noise would exist due to code reflowing and comments. I don't suppose anyone ever made a automatic formatter for QuakeC á la https://blog.golang.org/gofmt? ;) 
Grenade Bounce On Downward Slopes Fix In QuakeC 
4LT posted this in discord:

Well, the grenade fix seems to be working as it should now. You can patch it into your mod now, you just need to add this file to your project, patch GrenadeTouch and OgreGrenadeTouch to call GrenadeHandlePhysics (don't forget forward declarations!), and be sure to check the source to make sure we're not trampling eachother's entity fields.

https://github.com/4LT/qc-necrotelecomnicon/blob/master/grenade_fix.qc 
1 More Thing 
Forgot to mention, you'll also need to snag the "reflect" function from math.qc

But, you'd figure that out soon enough I suppose. 
HELPLZ 
How can i use waterjump end of the ladder 
Simple Modding Help 
I want to make a Quake mod, and I just need to change a few simple things but I'm having major trouble finding any info on how this is done

I want to make a texture wad, I want to change the player's speed in game, so that when people play my map's they don't have to go into the console and slow the player down themselves, and I want to edit weapons, mainly the axe and shotgun, any good guides I should find? 
 
For making texture wads I should use progs like Texmex or Wally. Changing a player's movements are more like a qc matter. It are two different archivements. One is mapping, the other is code modding

You can find a lot of info on quakewiki. But as I think it takes some time to make the workaround your own. 
 
LB79, you can change the player's speed in your mod by just adding cl_forwardspeed [value] and cl_sidespeed [value] commands in an autoexec.cfg or quake.rc file. 
Tribal: (response From Other Thead) 
THe thing that stands out to me is this line:

parm9 = self.armortype = 0.3; //this is the green armor type

First, you should not be assigning to self.armortype here, just assign to parm9.

Second, armortype parms need to be multiplied by 100 when stored to parms, so you should do

parm9 = 30;

(they get divided by 100 in DecodeLevelParms)

Try that and see if it helps. 
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.