My points of interest in CS:GO source code

Introduction

I started to have fun with mechanics of Counter Strike Global Offensive, especially physics of grenades. Here I point out specific functions, lines, and comments from CSGO source code leaks.

sv_grenade_trajectory line is actually a set of boxes

Defined in /game/shared/physics_main_shared.cpp, function void CBaseEntity::PhysicsToss( void ). Also this whole function is great point of interest.

/game/shared/physics_main_shared.cpp#L1686

if ( debugoverlay && sv_grenade_trajectory.GetInt() && (GetFlags() & FL_GRENADE) )
	{
		QAngle angGrTrajAngles;
		Vector vec3tempOrientation = (trace.endpos - trace.startpos);
		VectorAngles( vec3tempOrientation, angGrTrajAngles );

		float flGrTraThickness = sv_grenade_trajectory_thickness.GetFloat();
		Vector vec3_GrTrajMin = Vector( 0, -flGrTraThickness, -flGrTraThickness );
		Vector vec3_GrTrajMax = Vector( vec3tempOrientation.Length(), flGrTraThickness, flGrTraThickness );
		bool bDotted = ( sv_grenade_trajectory_dash.GetInt() && (fmod( gpGlobals->curtime, 0.1f ) < 0.05f) );
		
		//extruded "line" is really a box for more visible thickness
		debugoverlay->AddBoxOverlay( trace.startpos, vec3_GrTrajMin, vec3_GrTrajMax, angGrTrajAngles, 0, (bDotted ? 20 : 200), 0, 255, sv_grenade_trajectory_time.GetFloat() );

		//per-bounce box
		if (trace.fraction != 1.0f)
			debugoverlay->AddBoxOverlay( trace.endpos, Vector( -GRENADE_DEFAULT_SIZE, -GRENADE_DEFAULT_SIZE, -GRENADE_DEFAULT_SIZE ), Vector( GRENADE_DEFAULT_SIZE, GRENADE_DEFAULT_SIZE, GRENADE_DEFAULT_SIZE ), QAngle( 0, 0, 0 ), 220, 0, 0, 190, sv_grenade_trajectory_time.GetFloat( ) );
	}
    

Here are screenshots showing boxes, with sv_grenade_trajectory_thickness set to 1


AddBoxOverlay definition

Drawing function reference AddBoxOverlay function, but include "/engine/ivdebugoverlay.h" which is not present. Other function that is defined however is in "/engine/debugoverlay.h". Maybe some engine changes were made while leak happened?

/engine/debugoverlay.cpp#L642