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
Looks Like It 
 
HIP_FireLaser () 
Yes, its where you commented. I went a little further and made a .vector vwep_pos , that merely points to that org vector in each of the weapon firing functions...so now its easy to know where a missile originated from with respect to the player.Its a little but weird because the Quake guy dont really hold the weapon up to his eye level like other games do, but alot of the tracelines in Quake start at eye position, and there is a difference depending on what knd of calc you wanna do.

Also, I have tried to make the starting point of the missile or the beam for the LG look just as good from the first person view , as from the outside of the model when firing. Its tough, and I dont think there is really a way to make it look exactly right...bleh. 
 
@Daya
Little known hack for explosion particles without sound:
particle(pos, '0 0 0', 0, 255);
(direction and colour will be ignored, count must be exactly 255, pos is the middle, obviously) 
Blood Redscreen 
Is there a way to disable or control the frequency of the red screen flash when the player takes damage? Apparently the QC is not doing a bf stuffcmd, so I guess this is done engineside? It sould be neat to setup the intensity based on the amount of damage taken...right now using Darkplaces, I cant find a setting for this and the effect seems the same no matter what the damage taken is. 
 
Dunno but sounds like the sort of thing that would trigger Smabler so go for it. 
 
Dmg_take controls red tint, dmg_save armour tint. Dmg_inflictor I think controls how the screen tilts. 
Quake 1 .bsp Lightmaps 
Does anyone have some documentation they could link me on how lightmaps are stored inside the .bsp?

I'm trying to create a Quake 1 map renderer in Unity and lightmaps are sort of my final frontier.

I've found some conflicting documentation, most of which is vague. From what I gather the lightmaps themselves are simple arrays of values 0-255. I assume it's just a big lump of bytes, and the faces point into it to the start of their lightmap, but I do not know how to determine the size of any given face's lightmap. bspfile.h defines it as [numstyles*surfsize], but I'm not sure where to find or how to calculate a faces surfsize for this purpose.

Can anyone toss me a pointer? 
 
Yeah, it's convoluted because they're not stored, you have to compute the lightmap sizes.

For each vertex on the face, you get the X and Y texture coordinates like this:

texcoord_x = (vert_x, very_y, vert_z, 1) dot (tex->vecs[0])
texcoord_y = (vert_x, very_y, vert_z, 1) dot (tex->vecs[1])

tex->vecs[0] and tex->vecs[1] are both vectors of 4 floats, tex is the texinfo_t* that has that's face texture alignment info.

Then, to get how many bytes wide/tall the lightmap is:
lightmap_width = ceil(max(texcoord_x) / 16.0) - floor(min(texcoord_x) / 16.0) + 1
lightmap_height = ceil(max(texcoord_y) / 16.0) - floor(min(texcoord_y) / 16.0) + 1

max(texcoord_x) is the maximum texcoord_x across all verts on the face. Hopefully I didn't mess anything up and the notation makes sense.

For reference this is the light tool code:
https://github.com/ericwa/tyrutils-ericw/blob/master/light/ltface.c#L355 
 
the engine source is probably the best documentation since it has code that reads, converts, and renders the lightmaps. 
 
Once you know, https://quakewiki.org/ would be a great host for that kind of information. 
 
I assume the notation above is dealing directly in the x/y coords of worldspace? I've already tamed the textures and mapping, if what I'm understanding is right, I should be able to use my existing code for decoding the texture UVs to do the lightmaps as well, with a little tweaking.

It was confusing because a lot of scraps I was finding were saying that lightmapping information/decoding was totally unrelated to texture UVs/composition, but it looks like that's not entirely true.

I'll give it a shot when I get off work.

Glad to see this place is still active. It was a huge help last time I worked on this project. It's the reason I've made it this far. 
 
I assume the notation above is dealing directly in the x/y coords of worldspace?
Yeah, the vert_x, very_y, vert_z are worldspace.

texcoord_x/y are in texture space, and dividing these by the texture width/height gives the texture U/V coordinates normalized to [0,1] (except they go outside that range for repeating.) So yeah you should be able to reuse some of the texturing code for this :-)

btw as a sanity check, the lightmap_width/height values you get should be between 1 and 18. 
Hipnotic's Bullet Hole Sprite 
Going further into properly integrating Scourge of Armagon's code into my mod, this time its sprites can't be properly compiled.
FTEqcc says "line9 - Unknown frame macro $spritename"

Here's the hipspr.qc file: http://pastebin.com/t0VypXAU

And yes, I made sure I also copy pasted the sprite files in the progs directory. 
 
that reminds me, i love that Jim Dose called it "QuickC" 
 
Daya, skip that file (delete it or something), its not qc code.
(note how its not included in hipnotic's progs.src either) 
That Was The Solution, Yup 
Gotta thank CZG for that 
Actually, 
When the compilation went with no errors this time, bullet hole sprites still don't appear on brushes.
Even though I made sure to place the bullethole code in weapons.qc as well, so I really don't know what's wrong here.
In the end I can overlook that while developping the mod, but it's still annoying. 
Issues With Fteqcc 
Ok so i'm trying to compile a hexen 2 and csqc project with fteqcc.
So, i can compile a standard hexen2 code normally, but if i try to put some csqc in it and link it with

#pragma sourcefile csprogs.src

in 'global.hc' the compiler complains with the following error:
": werror Q208: progs CRC not recognised from quake nor clones"
The thing is that if i compile the CSQC separately its all good, but i really dont wanna to have to do two compiles each time i want to compile the whole project.
Btw i'm using the command line fteqcc (same happens with GUI)
my compilation command:

>.fteqcc -src hc -Thexen2

And also, i'm using Hammer of Thyrion's HCode since i couldn't find anything better or updated... 
 
put this in your hexen2 code (before any functions are processed):
#pragma target h2 //or fteh2, if you're going fteqw-only.
#pragma keyword enable thinktime
#pragma keyword enable loop
#pragma keyword enable until
and then remove -Thexen2 from your commandline.

alternatively, you can use
#pragma target id //or fte, because you might as well
in your csprogs.src, again before any statements are execed (keep the -Th2 bit if you're leaving the progs.dat code alone).

Alternatively, as you're not using fteqccgui anyway, you might as well just run fteqcc twice, with a batchfile or whatever.
fteqccgui is good for debugging though (which pragma sourcefile was implemented to simplify). 
Great! 
I appended

#pragma target id

to the beginning of csdefs and it all went fine.
Thanks man! 
Darkplaces Water Twist/Movement 
I can't for the life of me figure out how to enable the correct software quake style of rendering water with all its twisting and writhing in the Darkplaces engine. All the water does is scroll back and forth. I'm trying to dig through the engine code to find it. Its got to be somewhere...just disabled or commented out, right?

Anyone know where it is? 
 
gl_subdividesize to 16 maybe? 
Something I'll Do In The Near Future 
...cause right now I'm working on that BFG, but:
I'm planning on doing a Berserk power-up where attack speed is increased by 3 (weapon animation would speed up to reflect that) and ammo consumption divided by 2.
The question is, would such a thing be possible with something similar to SuperDamage? Especially with guns who are tied with their model animations (nailgun, super nailgun, thunderbolt)? 
Combining Shotgun Blasts? 
Was just reviewing the old Qc src here: http://www.gamers.org/dEngine/quake/Qc/combat.htm
the part where it mentions combining shotgun blasts (in T_damage ()), seems to be related to the dmg_take field I was working on earlier. I know there is a multidamage work around on another forum.....but what was the original intent of multidamage? Its spawning an ent that basicly collects the damage and distributes it? 
 
the whole code is designed to reduce the amount of data being sent from clients and servers. instead of sending 50~ damage messages for small amounts, it sends 1 damage message with a large amount. if a shotgun blast hits multiple entities, then multiple damage messages are needed, but they still wanted to collect everything up as much as possible.

as a side effect, it basically lets shotguns gib monsters. 
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.