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 ) 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_CenterPrintAll( "Node Graph out of Date. Rebuilding..." );
UTIL_SetOrigin ( VARS(pev), WorldGraph.m_pNodes[ 0 ].m_vecOrigin ); 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 ) 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 ); gmsgTextMsg = REG_USER_MSG( "TextMsg", -1 );
MESSAGE_BEGIN( MSG_ALL, gmsgTextMsg ); 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 ) 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 ); gmsgTextMsg = REG_USER_MSG( "TextMsg", -1 );
MESSAGE_BEGIN( MSG_ONE, gmsgTextMsg, NULL, client ); MESSAGE_BEGIN( MSG_ONE, gmsgTextMsg, NULL, client );
@@ -1754,7 +1754,10 @@ int UTIL_TakeDamage( edict_t *pEdict, entvars_t *pevInflictor, entvars_t *pevAtt
// do the damage // do the damage
pEdict->v.health -= flTake; pEdict->v.health -= flTake;
// store entity that hurt this player
pEdict->v.dmg_inflictor = ENT(pevAttacker);
if ( pEdict->v.health <= 0 ) if ( pEdict->v.health <= 0 )
{ {
pEdict->v.health = 1; // can't suicide if already dead! pEdict->v.health = 1; // can't suicide if already dead!
@@ -1800,7 +1803,7 @@ int UTIL_TakeDamage( edict_t *pEdict, entvars_t *pevInflictor, entvars_t *pevAtt
WRITE_COORD( pevInflictor->origin.z ); WRITE_COORD( pevInflictor->origin.z );
MESSAGE_END(); MESSAGE_END();
} }
return fTookDamage; return fTookDamage;
} }