1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-09-20 20:46:03 +08:00
Files
hl2sdk/game/server/scratchpad_gamedll_helpers.cpp
Benoist 8a6d1c6cd2 TF2 win64 + Ambuild tier1/mathlib + long=devil (#198)
* Fix compilation for windows, setup ambuild

* Add built tier1 and mathlib for win64

* Ensure compilation is working on windows and linux

* Add -fPIC

* Add compiled libs, with optimisation enabled

* Added windows lib

* Fix hl2sdk for windows

* Longs are the devil

* Fix up threadtools functions

* Add updated libs

* Rework lib naming, and package script

* Update lib directory according to new packaging

---------

Co-authored-by: Kenzzer <kenzzer@users.noreply.github.com>
2024-03-09 03:57:12 +00:00

96 lines
2.4 KiB
C++

//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#include "cbase.h"
#include "scratchpad_gamedll_helpers.h"
#include "iscratchpad3d.h"
#include "player.h"
#include "collisionproperty.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
void ScratchPad_DrawWorldToScratchPad(
IScratchPad3D *pPad,
uint32_t flags )
{
pPad->SetRenderState( IScratchPad3D::RS_FillMode, IScratchPad3D::FillMode_Wireframe );
if ( flags & SPDRAWWORLD_DRAW_WORLD )
{
engine->DrawMapToScratchPad( pPad, 0 );
}
if ( flags & (SPDRAWWORLD_DRAW_PLAYERS | SPDRAWWORLD_DRAW_ENTITIES) )
{
CBaseEntity *pCur = gEntList.FirstEnt();
while ( pCur )
{
bool bPlayer = ( dynamic_cast< CBasePlayer* >( pCur ) != 0 );
if ( (bPlayer && !( flags & SPDRAWWORLD_DRAW_PLAYERS )) ||
(!bPlayer && !( flags & SPDRAWWORLD_DRAW_ENTITIES )) )
{
pCur = gEntList.NextEnt( pCur );
continue;
}
ScratchPad_DrawEntityToScratchPad(
pPad,
flags,
pCur,
bPlayer ? Vector( 1.0, 0.5, 0 ) : Vector( 0.3, 0.3, 1.0 )
);
pCur = gEntList.NextEnt( pCur );
}
}
}
void ScratchPad_DrawEntityToScratchPad(
IScratchPad3D *pPad,
uint32_t flags,
CBaseEntity *pEnt,
const Vector &vColor )
{
// Draw the entity's bbox [todo: draw OBBs here too].
Vector mins, maxs;
pEnt->CollisionProp()->WorldSpaceAABB( &mins, &maxs );
pPad->DrawWireframeBox( mins, maxs, vColor );
// Draw the edict's index or class?
char str[512];
str[0] = 0;
if ( flags & SPDRAWWORLD_DRAW_EDICT_INDICES )
{
char tempStr[512];
Q_snprintf( tempStr, sizeof( tempStr ), "edict: %d", pEnt->entindex() );
Q_strncat( str, tempStr, sizeof( str ), COPY_ALL_CHARACTERS );
}
if ( flags & SPDRAWWORLD_DRAW_ENTITY_CLASSNAMES )
{
if ( str[0] != 0 )
Q_strncat( str, ", ", sizeof( str ), COPY_ALL_CHARACTERS );
char tempStr[512];
Q_snprintf( tempStr, sizeof( tempStr ), "class: %s", pEnt->GetClassname() );
Q_strncat( str, tempStr, sizeof( str ), COPY_ALL_CHARACTERS );
}
if ( str[0] != 0 )
{
CTextParams params;
params.m_vPos = (mins + maxs) * 0.5f;
params.m_bCentered = true;
params.m_flLetterWidth = 2;
pPad->DrawText( str, params );
}
}