Halflife: [CS 1.6][Bug] Throw grenades through the ceiling

Created on 22 Apr 2019  路  3Comments  路  Source: ValveSoftware/halflife

You can throw a grenade through the ceiling
If you hold +duck in jump and throw a grenade in front of the ceiling
Example: https://youtu.be/s5QwPoEpSy0?t=32

Fix proposed

All 3 comments

This all comes to mappers

This all comes to mappers

right, not the game beign old, at all.

A simple fix would be to perform a trace from player view origin in the throw direction and clamping the grenade spawn position so it doesn't end up on the other side of walls.

The position seems to be this:

Vector vecStart = gpGlobals->v_forward * 16.0 + m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs;

The simple solution would be to replace 16 with 16 * trace.flFraction, which clamps the position to the original position or closer if something is blocking the throw. To avoid spawning grenades in walls you could subtract a little if fraction is not 1:

Vector vecSubtract = g_vecZero;

if( trace.flFraction != 1 && trace.flFraction != 0 )
{
    vecSubtract  = gpGlobals->v_forward * 0.1;
}

Vector vecStart = gpGlobals->v_forward * ( 16.0 * trace.flFraction) - vecSubtract + m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs;

Subtracting a fixed amount of units produces consistent results. Substracting should probably not be done if fraction is 0 (player stuck in wall/floor/ceiling?), maybe cancelling the throw would be better in this case.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

twisterniq picture twisterniq  路  4Comments

Yetoo1 picture Yetoo1  路  3Comments

Maxi605 picture Maxi605  路  4Comments

BlackShadow picture BlackShadow  路  3Comments

perforatorRU picture perforatorRU  路  3Comments