ValveSoftware / halflife

Half-Life 1 engine based games
Other
3.75k stars 630 forks source link

Tau Cannon/Gauss Gun beam colour is broken in steam release #2865

Open Skinkroot opened 4 years ago

Skinkroot commented 4 years ago

Retail Half-Life release includes a feature where the more the Tau Cannon is charged the more white the beam will get. This feature is broken in steam and instead the beam is always bright white when using secondary fire

Koterminus commented 4 years ago

It looks like this also happens in the current Steam versions of Blue Shift and Opposing Force. The version of the Tau Cannon that appears in Opposing Force's multiplayer mode also has the same bug.

kisak-valve commented 4 years ago

Gauss Gun beam effect is incorectly reading colors and brightness values

Issue transferred from https://github.com/ValveSoftware/halflife/issues/2933. @vasiavasiavasia95 posted on 2020-07-28T14:29:01:

After client prediction was introduced, gauss effect handling was moved to the client resulting in gauss's beam effect being broken. Primary attack beam's color became yellow instead of orange and secondary attack beam is always shown at full brightness instead of relying on the charge time. I did some research and found out this happens becasue beam effect requires it's color and brightness values divided by 255. This requriement was overlooked resulting in the broken behavior we got.

To fix this, this function: https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/cl_dll/ev_hldm.cpp#L922-L963

Should be modifed to look like this:


if (fFirstBeam)
        {
            if ( EV_IsLocal( idx ) )
            {
                // Add muzzle flash to current weapon model
                EV_MuzzleFlash();
            }
            fFirstBeam = 0;

            gEngfuncs.pEfxAPI->R_BeamEntPoint( 
                idx | 0x1000,
                tr.endpos,
                m_iBeam,
                0.1,
                m_fPrimaryFire ? 1.0 : 2.5,
                0.0,
                (m_fPrimaryFire ? 128.0 : flDamage) / 255.0,
                0,
                0,
                0,
                (m_fPrimaryFire ? 255 : 255) / 255.0,
                (m_fPrimaryFire ? 128 : 255) / 255.0,
                (m_fPrimaryFire ? 0 : 255) / 255.0
            );
        }
        else
        {
            gEngfuncs.pEfxAPI->R_BeamPoints( vecSrc,
                tr.endpos,
                m_iBeam,
                0.1,
                m_fPrimaryFire ? 1.0 : 2.5,
                0.0,
                (m_fPrimaryFire ? 128.0 : flDamage) / 255.0,
                0,
                0,
                0,
                (m_fPrimaryFire ? 255 : 255) / 255.0,
                (m_fPrimaryFire ? 128 : 255) / 255.0,
                (m_fPrimaryFire ? 0 : 255) / 255.0
            );
        }
BlackShadow commented 4 years ago

Ah, i didn't realize they moved this to client prediction code.

vasiavasiavasia95 commented 4 years ago

@mikela-valve This issue can be fixed.