Skip to content

Conversation

@LegendaryGuard
Copy link

@LegendaryGuard LegendaryGuard commented Oct 16, 2024

This forgotten detail from id Software has been unfixed for years and years.
So, that means lightning gun sounds and effects don't play while the weapon number is always 0.
That can be reproduced and debugged writing these lines on cgame/cg_weapons.c in line ~1923:

	Com_Printf( "what weapon I am holding? answer: %d\n", weapon );
	Com_Printf( "WP_GAUNTLET: %d\n", WP_GAUNTLET );
	Com_Printf( "WP_MACHINEGUN: %d\n", WP_MACHINEGUN );
	Com_Printf( "WP_SHOTGUN: %d\n", WP_SHOTGUN );
	Com_Printf( "WP_GRENADE_LAUNCHER: %d\n", WP_GRENADE_LAUNCHER );
	Com_Printf( "WP_ROCKET_LAUNCHER: %d\n", WP_ROCKET_LAUNCHER );
	Com_Printf( "WP_LIGHTNING: %d\n", WP_LIGHTNING );
	Com_Printf( "WP_RAILGUN: %d\n", WP_RAILGUN );
	Com_Printf( "WP_PLASMAGUN: %d\n", WP_PLASMAGUN );
	Com_Printf( "WP_BFG: %d\n", WP_BFG );

Compile, run the game, get the lightning gun weapon, use it and shoot no matter where, it will print the log in the console.

That's what happens in the console log:

  • Before/Original:
what weapon I am holding? answer: 0
WP_GAUNTLET: 1
WP_MACHINEGUN: 2
WP_SHOTGUN: 3
WP_GRENADE_LAUNCHER: 4
WP_ROCKET_LAUNCHER: 5
WP_LIGTHNING: 6
WP_RAILGUN: 7
WP_PLASMAGUN: 8
WP_BFG: 9
  • Fixed:
what weapon I am holding? answer: 6
WP_GAUNTLET: 1
WP_MACHINEGUN: 2
WP_SHOTGUN: 3
WP_GRENADE_LAUNCHER: 4
WP_ROCKET_LAUNCHER: 5
WP_LIGTHNING: 6
WP_RAILGUN: 7
WP_PLASMAGUN: 8
WP_BFG: 9

@WofWca
Copy link

WofWca commented Jun 24, 2025

So what's the effect of this bug? It seems to me that we'd hit the default case anyway, if weapon doesn't match any other weapon?

ioq3/code/cgame/cg_weapons.c

Lines 1768 to 1796 in f717a83

switch ( weapon ) {
default:
#ifdef MISSIONPACK
case WP_NAILGUN:
if( soundType == IMPACTSOUND_FLESH ) {
sfx = cgs.media.sfx_nghitflesh;
} else if( soundType == IMPACTSOUND_METAL ) {
sfx = cgs.media.sfx_nghitmetal;
} else {
sfx = cgs.media.sfx_nghit;
}
mark = cgs.media.holeMarkShader;
radius = 12;
break;
#endif
case WP_LIGHTNING:
// no explosion at LG impact, it is added with the beam
r = rand() & 3;
if ( r < 2 ) {
sfx = cgs.media.sfx_lghit2;
} else if ( r == 2 ) {
sfx = cgs.media.sfx_lghit1;
} else {
sfx = cgs.media.sfx_lghit3;
}
mark = cgs.media.holeMarkShader;
radius = 12;
break;
#ifdef MISSIONPACK

But anyways yeah, it seems like it's a bug that the weapon is not set.

@LegendaryGuard
Copy link
Author

LegendaryGuard commented Jun 24, 2025

It happened when I was developing a mod and the hit sound couldn't be heard from this lightning gun weapon while hitting something solid like a wall, even doesn't receive an effect from the event.

Imagine modding that detail, it would give a zeroed result, no matter the situation.
It's weird leaving the event sent incorrectly and without receiving any effect of this weapon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants