Fixed TextMsg message crashes.

This commit is contained in:
Julian
2020-06-01 03:53:12 -03:00
parent 8f899d2c6d
commit b4ec347170
2 changed files with 7 additions and 6 deletions

View File

@@ -1485,8 +1485,6 @@ void CTestHull :: Spawn( entvars_t *pevMasterNode )
//=========================================================
void CTestHull::DropDelay ( void )
{
// Do NOT uncomment or you'll get a "Tried to create a message with a bogus message type ( 0 )" crash!
// Left here only because it's on the original HLSDK, and for comedy purposes. -Giegue
//UTIL_CenterPrintAll( "Node Graph out of Date. Rebuilding..." );
UTIL_SetOrigin ( VARS(pev), WorldGraph.m_pNodes[ 0 ].m_vecOrigin );

View File

@@ -757,7 +757,7 @@ int gmsgSayText = 0;
void UTIL_ClientPrintAll( int msg_dest, const char *msg_name, const char *param1, const char *param2, const char *param3, const char *param4 )
{
if (gmsgTextMsg)
if (gmsgTextMsg == 0)
gmsgTextMsg = REG_USER_MSG( "TextMsg", -1 );
MESSAGE_BEGIN( MSG_ALL, gmsgTextMsg );
@@ -778,7 +778,7 @@ void UTIL_ClientPrintAll( int msg_dest, const char *msg_name, const char *param1
void ClientPrint( entvars_t *client, int msg_dest, const char *msg_name, const char *param1, const char *param2, const char *param3, const char *param4 )
{
if (gmsgTextMsg)
if (gmsgTextMsg == 0)
gmsgTextMsg = REG_USER_MSG( "TextMsg", -1 );
MESSAGE_BEGIN( MSG_ONE, gmsgTextMsg, NULL, client );
@@ -1755,6 +1755,9 @@ int UTIL_TakeDamage( edict_t *pEdict, entvars_t *pevInflictor, entvars_t *pevAtt
// do the damage
pEdict->v.health -= flTake;
// store entity that hurt this player
pEdict->v.dmg_inflictor = ENT(pevAttacker);
if ( pEdict->v.health <= 0 )
{
pEdict->v.health = 1; // can't suicide if already dead!