hqtrilogy log nr. 42


It was a sunny day and I thought, hey, you know what? I'll just fix the footstep sounds real quick for each Halfquake part.

This is where this week's journey started. :D

I simply made a new function PLAYER_PATH() (well, it's really a definition, or whatever) that links to "sound/player/hq1" (or 2 or 3), and that should fix it. Right?

Nope! Turns out, footstep sounds get precached in client.cpp, but the actual sound call is in pm_shared.c and this doesn't have access to util.h where my PLAYER_PATH() function lies.

Trying to get it to work by including util.h didn't turn out well (HL crashed), so I thought okay, better not touch this.

I took a step back and thought about fixing it by setting material textures. You can define a specific set of footstep sounds in materials.txt, so that the engine knows if you step on a metal texture to play the metal footstep sounds. It would have meant going through each and every map, checking which textures the player could step on and putting those in the materials text file.

It sounded doable, but the problem was: Halfquake 1 uses the default footstep sounds from Half-Life, i.e. dirt, normal, vents, and so on, and I'd like to preserve that.

Then I remembered that there's an entity in Spirit of Half-Life called "env_footsteps", but when I tried using it in Sunrise 8 years ago (for the white room before Somos), the problem was that once you activate it and you load a different map, the footstep setting would carry over. And it was a bit buggy overall as well, sometimes not triggering correctly when jumping.

So, I decided to simply look at the code for env_footsteps and noticed that Laurie (Spirit's creator) simply set a "physics key", which could be read by pm_shared.c, and played custom footstep sounds that way.

I tried to set a physics key depending on the current Halfquake part, just when the player spawned, and set a footstep value accordingly.

And...

It worked :D Albeit with only one sound. There are three variations for each step, i.e. step1.wav, step2.wav, step3.wav, so I still had to implement the randomizer (copied from the original code). Also, I needed (wanted) to preserve the default sounds for HQ1, and there was a silent room in HQ3 to think about as well, but that should be solved quickly.

I also made new drums for the next song (bass should be next), and changed more stuff in the mod settings in the steamworks backend.

With footsteps more or less solved, and the start map being more or less complete, I can fully focus on finishing the remaining song samples. Let's do this!

To be continued... (<