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
Alright So 
1. Me being afraid of the BFG orb doing wierd things to special brushes (mostly secret doors, doors and buttons that need to be shot) was a false scare, so we're done with it

2. There's been a talk on the BFG orb ricochetting off a enemy who's been gibbed on direct impact, while the aim was to make the shot penetrate if the target gets gibbed on direct impact, and one solution was to remove the orb and make a new one using the same angle as the first one, to make it seem the orb goes through. I'm looking for how to code [remove orb] and [create new orb with the same coordinates as the first one at the exact same frame it first appeared].

3. When the orb explodes, it should leave a custom explosion sprite, but it doesn't. Wierdly enough, the blast sprite appears.
Code: http://pastebin.com/Q479dGGb

4. I'm currently having a problem with my weapons switching code, because if you have the nailgun or super nailgun in your inventory and press 4/5, it says "no weapons". So I fiddled around while looking at scourge of armagon's code, but when you have weapons that share the same slot AND have different ammo consumption (super nailgun=2 & gatling gun=1 ; Thunderbolt=1 & BFG9500=30) I run into trouble because of scourge's code. And I got a big compilation error for that. I'm also looking for ways of isolating both the "not enough ammo" and "no weapon" code so I can play a sound for each of them.
Compilation error message:
http://pastebin.com/cFTRBHVB
Weapons.qc code:
http://pastebin.com/0G7g8h34
Scourge's w_changeweapon:
http://pastebin.com/0m9X14wP

Hope I've been clear here. 
Fixes 
2. This kind of thing is hard to diagnose without playing around with it, but something to try: After you set velocity on the orb when you first launch it, add a line

self.pos1 = self.velocity;

This saves the velocity it should have.

In the collision code, add the reverse line

self.velocity = self.pos1;

This restores the missile's velocity after a collision. Try it, and remove it again if it doesn't help.

3. Twice in that code you write:

BFG_Expl();
remove(self);

This is setting up the custom sprite, and then immediately removing it.

4. On line 1903 you have forgotten to comment out the bracket. This had made the compiler think that the function is over, so it doesn't understand why you're still talking about oldimpulse. 
Most Things Are Fixed But 
The self.pos1 thing makes the orb full-stop in thin-air when it collides with an enemy who gibs on direct impact.
Is there another thing I could try? 
Update 
That's because the first bit needs to be a bit different to what I said:

bfgsphere.pos1 = bfgsphere.velocity;

is what's needed. In the function where the orb is launched, self is the player and bfgsphere is the orb, so we need to save the value elsewhere. 
Still The Odd Ricochet 
 
# In Quake Compiling 
Hi,

Today I downloaded the Transfusion SDK in order to start up on that project where the dev team left off. The source code comes with their own custom compiler, BQCC (Blood Quake C Compiler) which seems to have some types defined which frikgui.exe does not have.

The problem is, I'm more comfortable with frikgui.exe, because it has a far more sophisticated interface, along with tools for debugging any warnings or errors. Does anyone know what this means--

"Error Q548 common.qh(95) "#" is not a type

Does anyone know how I can make frikgui.exe recognize "#", along with any other types? 
 
Code written with customizations specifically for a certain QuakeC compiler aren't going to compile except for that specific compiler.

So you'll either have to re-write the problematic lines by hand yourself to work with the target compiler or use a compiler that can compile the code unmodified. 
Baker 
Feared as much!
Ok, here I go.
Thanks Baker. 
Quakespasm Coding Help 
Ahoy, so I've been trying to implement IRC support for Quakespasm. I'm trying to get it done for QExpo so that if any streamers want to have their twitch chat in game they can. Or if people want to play and shitpost on #TF or whatever. I've been using libircclient and have had some success but have come to an impasse where I have no idea what to do.

I'm wondering if somebody could look over my code and see if I'm missing anything that could be causing my issues.

I'm running a local server to test, which receives a connection from the game, but doesn't seem to keep-alive, it just times out. I have polling code, that just doesn't get called because the connection is never established.

I'm running linux, so I haven't compiled any libircclient libs or objs for windows, however in the base directory of the archive is a libircclient.o for linux. Which can be copied into the quake (source code) directory for compilation under linux.

Here are the lib irc client docs:
http://www.ulduzsoft.com/libircclient/

And here is the github link:
https://github.com/shaoner/libircclient

Most of the code exists in irc.c, with a few other bits and pieces in other files, a quick search for "shamblernaut" in files will bring up the other files that I've modified.

The thing I most need help with at the moment is figuring out why it isn't connecting. There are other things that don't work, but I'm confident I can get those working myself.

the console commands are:
irc_channel (include #)
irc_nick
irc_server
irc_port
irc_password (default set to "")

these are reflected via cvars saved in config.cfg

the above should be set first before connecting with:

irc_connect (connects with the above settings)

irc_join (sort of moot because it isn't connecting anyway)

At the moment all debugging info is printed to the console, so run from a command line.

Here is the source to my modifications:
https://www.dropbox.com/s/fsnv4y4r0oobswe/quakespasm-0.91.0-irc.zip?dl=0

Anyways, if somebody with some C and engine knowledge could have a look, that would be amazing.

Thanks in advance.

-Snaut 
I'm Selfishly Bumping This 
for a bit more visibility. Has anybody had the chance to have a look? 
 
1) Did you run the example irctest.c and test it against your irc server? What was the result and in the case of failure, the error code or response?

2) What IDE are you are using for debugging, setting breakpoints and stepping through code to look at the values of different variables and checking function results?

The library you are using looks like it requires at least an intermediate understanding of C to be able to use it since it uses callbacks, but if you are able to run the irctest.c successfully you might be able to successfully break it into pieces as-is and put it in the appropriate places. 
Hey Baker. 
Thanks for the response.

So I was using just a text editor without using an IDE. In hindsight that was a terrible idea, so I've installed codeblocks as that is the project file that is included with quakespasm. So far the debugging tools look pretty reasonable.

Strangely the example executable doesn't work for me at all, they aren't even recognising the inputs from the console... weird.

Unfortunately the irctest application isn't ideal as it uses a loop function that freezes quake. It doesn't exit the loop once it has entered it. Instead the documentation suggests a select loop which I've added to my code.

The problem is way before that though, the select loop doesn't even get the chance to run, as it only does that once the connection is completed, whereas the app makes a connection, but refuses to keep alive. My IRC server spits back a timeout error.

I'll keep digging with the debugger, if you have any ideas I'd love to hear them. 
 
You should get the irctest example working before trying to integrate it into Quakespasm, otherwise you can't be sure you are dealing with a working model.

Btw, your code in Host_Frame will trying ro connect over and over and over again but you may know this.

Yes, the sample code isn't ideal for Quake, because of the design of the loop but the first phase of anything is making sure what you've got actually works.

Taking shortcuts in coding and not doing things proper just leads to massive headaches, so you really need to get the sample working first to verify what you have will even work. 
Shamblernaut 
Got the code compiling on OS X after a bit of fighting with the libircclient configure/makefile.

I think one issue is: if IRC_Connect_f is called with `irc_connect_bool` false, the irc_session variable will be an uninitialized pointer; then this line: "if (irc_is_connected(irc_session) == 0)" will access the bogus pointer, which should crash.

I think maybe you want irc_session to be static?

AddressSanitizer in clang/Xcode will catch this kind of thing; MSVC and recent versions of gcc also have similar functionality, I think. 
Shamblernaut 
For the record, the mainstream libircclient code
at sourceforge.net is at version 1.9, as opposed
to the old fork at github being back at 1.6:
https://sourceforge.net/projects/libircclient/ 
Changing Music Playback? 
So I've been thinking: the game's original code should mention going to the CD drives or the music, so is it possible to reroute the path from the CD drives to a custom one inside one of my mod's directory?
If yes, how can I do it?
I'd like to do that mostly so custom music can be done without dealing with engine-specific music playbacks, like Doom or UT. 
 
Quake has support for a CD --- like an actual CD that plays in a 1990s CD player stored in the CDDA format.

https://en.wikipedia.org/wiki/Compact_Disc_Digital_Audio

Think of the answer as basically no, but if you were really, really determined and had a thing for fiddling with hex editors and old software maybe you could do it, like the guy who made Windows 95 run on his Apple Watch. 
Daya 
Are you talking about tricking a quake engine into reading the "cd data" from a location that's not the cd drive, without modifying the engine?

I don't have a scooby doo how you'd do it, but just wondered if that's what you're asking. 
@szo 
thanks for the heads up, I had version 1.8, I linked the wrong version.

however, in the change notes in 1.9 from 1.8

"Fixed an error if the TCP connection to the IRC server couldn't be established under 250ms." 
Kinn 
That's it basically.
If I can't do that however I can still have a workaround but it would only works for darkplaces and quakespasm/fitzquake, and including custom music would be tricky since you can only put track numbers.
But if there's a way to make quake play properly named music tracks even if it still looks for the CD location that would be great. 
@Daya 
sorry for the mindless babble...

cd audio is handled by both engine AND the gamecode, which is not a happy combination - the engine can't use track names because the mod will somewhat stomp over it, and the mod can't use names because there's no standard way to actually do that (and would still get nuked on each map change).

so we're stuck with the server changing tracks on map changes, and maps+mods only using 0-255 values for track numbers.

despite CDs being mostly irrelevant now, dp+fte both still retain the cd command, with a distinction made between numeric and non-numeric tracks.
'cd play 5' plays track 5, but 'cd play omgwtf.ogg' plays the named file instead of a numbered one. this also works with 'cd loop foo' too, of course.
The coolest thing about this is that the following command works too:
cd remap TRACKNUMBER TRACKFILENAME
which is just great for remapping a track number to a named file (just don't expect it to change anything until the track is next changed). This can be great for config files.
the catch is that you're still fighting the svc_cdtrack that the server sends when you first connect, yay race conditions.

anyway, set world.sounds=0 inside worldspawn so that any cd tracks the server sends will be ignored and not give hideousness, and then send a 'cd loop foo' stuffcmd, or a 'music foo' stuffcmd to make quakespasm happy, while fte is happy with either (I'm too lazy to comment on other engines).
That way, you get full control over what is actually played. 
Spike 
"'cd play 5' plays track 5, but 'cd play omgwtf.ogg' plays the named file instead of a numbered one. this also works with 'cd loop foo' too, of course. "

So what you're saying is, I can have a music track named "woah.ogg" and have in worldspawn's sounds line "woah" and it would play it on both Quakespasm/Fitzquake and Darkplaces?
Or must I use the world.sounds=0 thing, but then how would darkplaces play custom tracks if the commannd is different there? 
Thanks For The Help Everyone :) 
Szo, Baker, EricW

I got it working... Now I need to polish it up :) 
On Music... 
What would be the best way to implement progressive music, whereby entering into a mob filled area, the music becomes faster or different "battle music" fades in? Vice versa after the battle.

I'm not building this myself, I'm just interested how one might achieve this. I reckon it would compliment the game quite well.

Would you quakec? modify engine? use custom ambient sounds and triggers? 
How I've Implemented Before 
Is to have two pieces of music playing at once and crossfade their volumes linked to another variable - usually something simple like player % health.

Both of the pieces of music work in theory when played at full volume together, but won't sound too good. The idea is that one piece is the 'action' music and the other the 'calm'.

Action starts at 0 volume and calm at 1 (full). As the player health drops and rises you switch the volumes - the lower their health, the higher the volume of the action music.

Never done this in Quake, although it wouldn't be difficult - could be done purely in qc, although you'd need to do some proper music editing using midis to turn off/on instruments and get the two identically sequenced but different sounding tracks. 
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.