1. getting penetration power and max penetration distance
int iPenetrationPower = 0; float flPenetrationDistance = 0.0f; float fPenetrationPower = 0.0f; DWORD dwGetBulletTypeParameters = 0x241CE4B0; _asm { LEA ECX, flPenetrationDistance PUSH ECX LEA EDX, fPenetrationPower PUSH EDX PUSH iBulletType CALL dwGetBulletTypeParameters } iPenetrationPower = (int)fPenetrationPower;
int iMaterial = pSurfaceData->game.material; DWORD dwGetTextureInformation = 0x241CE670; _asm { LEA EAX, flDamageModifier LEA ECX, flPenetrationPowerModifier MOV EDX, iMaterial CALL dwGetTextureInformation } iPenetrationPower *= flPenetrationPowerModifier;
the game first traces using tracray and actually checks if we hit anything (tr.fraction != 1.0f).
then they are using UTIL_ClipRayToPlayers to get the playerentity we are aiming at.
they are using CTraceFilterSkipTwoEntities for those tracings. the first try they init the tracefilter to skip the local entity, if we are going to cause damage to a players the game starts a second try and inits the filter with the current target and the local player.
if you want to know more simply look into FireBullets3(called by FX_FireBullets)
so far hope that helps
Comment