Fixed mistyped monster_bullchicken classname.

Fixed ambient_music not stopping sounds during mapchange.
Fixed monster_gargantua crashing the server upon death.
Fixed GMR/GSR being prone to crashing.
Fixed monster_human_grunt melee attack not damaging non-mm entities.
Fixed monster_male_assassin doing sentence speeches.
Fixed monster_shockroach using headcrab sounds for attack.
Removed CGraph::HandleLinkEnt capabilities as they crash the server.
Increased monster_alien_voltigore lightning attack range.
This commit is contained in:
Giegue
2023-07-01 16:27:32 -03:00
parent fbe70a5691
commit 1d2a284197
11 changed files with 70 additions and 21 deletions

View File

@@ -1444,6 +1444,7 @@ public:
void AlertSound(void); void AlertSound(void);
void MonsterThink(void); void MonsterThink(void);
void StartTask(Task_t* pTask); void StartTask(Task_t* pTask);
void HandleAnimEvent(MonsterEvent_t *pEvent);
int TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ); int TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType );
static const char *pIdleSounds[]; static const char *pIdleSounds[];

View File

@@ -130,7 +130,7 @@ public:
int FIdleStare( void ); int FIdleStare( void );
int FIdleHello( void ); int FIdleHello( void );
void IdleHeadTurn( Vector &vecFriend ); void IdleHeadTurn( Vector &vecFriend );
int FOkToSpeak( void ); virtual int FOkToSpeak( void );
void TrySmellTalk( void ); void TrySmellTalk( void );
edict_t *EnumFriends( edict_t *pentPrevious, int listNumber, BOOL bTrace ); edict_t *EnumFriends( edict_t *pentPrevious, int listNumber, BOOL bTrace );
void AlertFriends( void ); void AlertFriends( void );

View File

@@ -136,7 +136,7 @@ monster_type_t monster_types[]=
"monster_apache", FALSE, "monster_apache", FALSE,
"monster_barney", FALSE, "monster_barney", FALSE,
"monster_bigmomma", FALSE, "monster_bigmomma", FALSE,
"monster_bullsquid", FALSE, "monster_bullchicken", FALSE,
"monster_alien_controller", FALSE, "monster_alien_controller", FALSE,
"monster_human_assassin", FALSE, "monster_human_assassin", FALSE,
"monster_headcrab", FALSE, "monster_headcrab", FALSE,
@@ -211,6 +211,11 @@ int GetMonsterIndex(void)
void FreeMonsterIndex(int index) void FreeMonsterIndex(int index)
{ {
/*
if (monsters[index].pMonster->m_srSoundList != NULL)
free(monsters[index].pMonster->m_srSoundList);
monsters[index].pMonster->m_srSoundList = NULL;
*/
delete monsters[index].pMonster; delete monsters[index].pMonster;
monsters[index].monster_index = 0; monsters[index].monster_index = 0;
@@ -256,6 +261,11 @@ void monster_unload(void)
{ {
monsters[index].monster_pent->v.flags |= FL_KILLME; monsters[index].monster_pent->v.flags |= FL_KILLME;
/*
if (monsters[index].pMonster->m_srSoundList != NULL)
free(monsters[index].pMonster->m_srSoundList);
monsters[index].pMonster->m_srSoundList = NULL;
*/
delete monsters[index].pMonster; delete monsters[index].pMonster;
monsters[index].monster_index = 0; monsters[index].monster_index = 0;
@@ -1260,10 +1270,10 @@ int mmDispatchSpawn( edict_t *pent )
if (monsters[index].pMonster != NULL) if (monsters[index].pMonster != NULL)
{ {
// free the soundlists first! // free the soundlists first!
if (monsters[index].pMonster->m_srSoundList != NULL) /*if (monsters[index].pMonster->m_srSoundList != NULL)
free(monsters[index].pMonster->m_srSoundList); free(monsters[index].pMonster->m_srSoundList);
monsters[index].pMonster->m_srSoundList = NULL; monsters[index].pMonster->m_srSoundList = NULL;
*/
delete monsters[index].pMonster; delete monsters[index].pMonster;
} }
} }
@@ -1604,6 +1614,16 @@ void mmClientKill_Post( edict_t *pPlayer )
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
BOOL mmClientConnect( edict_t *pPlayer, const char *pszName, const char *pszAddress, char *szRejectReason )
{
// stop any ambient_music that is playing
MESSAGE_BEGIN(MSG_ONE, SVC_STUFFTEXT, NULL, pPlayer);
WRITE_STRING("mp3 stop\n");
MESSAGE_END();
RETURN_META_VALUE( MRES_IGNORED, TRUE );
}
static DLL_FUNCTIONS gFunctionTable = static DLL_FUNCTIONS gFunctionTable =
{ {
mmGameDLLInit, //! pfnGameInit() Initialize the game (one-time call after loading of game .dll) mmGameDLLInit, //! pfnGameInit() Initialize the game (one-time call after loading of game .dll)
@@ -1624,7 +1644,7 @@ static DLL_FUNCTIONS gFunctionTable =
NULL, // pfnRestoreGlobalState NULL, // pfnRestoreGlobalState
NULL, // pfnResetGlobalState NULL, // pfnResetGlobalState
NULL, // pfnClientConnect mmClientConnect, //! pfnClientConnect
NULL, // pfnClientDisconnect NULL, // pfnClientDisconnect
NULL, // pfnClientKill NULL, // pfnClientKill
NULL, // pfnClientPutInServer NULL, // pfnClientPutInServer

View File

@@ -814,10 +814,13 @@ void CMGargantua::DeathEffect( void )
void CMGargantua::Killed( entvars_t *pevAttacker, int iGib ) void CMGargantua::Killed( entvars_t *pevAttacker, int iGib )
{
if ( m_pEyeGlow )
{ {
EyeOff(); EyeOff();
UTIL_Remove( m_pEyeGlow->edict() ); UTIL_Remove( m_pEyeGlow->edict() );
m_pEyeGlow = NULL; m_pEyeGlow = NULL;
}
CMBaseMonster::Killed( pevAttacker, GIB_NEVER ); CMBaseMonster::Killed( pevAttacker, GIB_NEVER );
} }

View File

@@ -100,7 +100,7 @@ bool AddIndividualSound(edict_t *pMonster, const char *from, const char *to)
const char* FindModelReplacement( edict_t *pMonster, const char *from ) const char* FindModelReplacement( edict_t *pMonster, const char *from )
{ {
// Individually set models takes priority! // Individually set models takes priority!
if ( pMonster && !FStringNull(pMonster->v.model)) if (UTIL_IsValidEntity(pMonster) && !FStringNull(pMonster->v.model))
return STRING(pMonster->v.model); return STRING(pMonster->v.model);
// Find the model // Find the model
@@ -120,7 +120,7 @@ const char* FindModelReplacement( edict_t *pMonster, const char *from )
const char* FindSoundReplacement( edict_t *pMonster, const char *from ) const char* FindSoundReplacement( edict_t *pMonster, const char *from )
{ {
// Individually set sounds takes priority! // Individually set sounds takes priority!
if ( pMonster ) if (UTIL_IsValidEntity(pMonster))
{ {
CMBaseMonster *castMonster = NULL; CMBaseMonster *castMonster = NULL;

View File

@@ -801,6 +801,8 @@ void CMHGrunt :: HandleAnimEvent( MonsterEvent_t *pEvent )
CMBaseMonster *pMonster = GetClassPtr((CMBaseMonster *)VARS(pHurt)); CMBaseMonster *pMonster = GetClassPtr((CMBaseMonster *)VARS(pHurt));
pMonster->TakeDamage(pev, pev, gSkillData.hgruntDmgKick, DMG_CLUB); pMonster->TakeDamage(pev, pev, gSkillData.hgruntDmgKick, DMG_CLUB);
} }
else
UTIL_TakeDamageExternal(pHurt, pev, pev, gSkillData.hgruntDmgKick, DMG_CLUB);
} }
} }
break; break;

View File

@@ -345,7 +345,7 @@ DEFINE_CUSTOM_SCHEDULES( CMMassn )
slMassnSniperAttack, slMassnSniperAttack,
}; };
IMPLEMENT_CUSTOM_SCHEDULES( CMMassn, CMBaseMonster ); IMPLEMENT_CUSTOM_SCHEDULES( CMMassn, CMHGrunt );
//========================================================= //=========================================================
// SetActivity // SetActivity

View File

@@ -212,6 +212,10 @@ entvars_t* CGraph :: LinkEntForLink ( CLink *pLink, CNode *pNode )
//========================================================= //=========================================================
int CGraph :: HandleLinkEnt ( int iNode, entvars_t *pevLinkEnt, int afCapMask, NODEQUERY queryType ) int CGraph :: HandleLinkEnt ( int iNode, entvars_t *pevLinkEnt, int afCapMask, NODEQUERY queryType )
{ {
// NULL pointers are becoming a nightmare... -Giegue
return FALSE;
#if 0
edict_t *pentWorld; edict_t *pentWorld;
CMBaseEntity *pDoor; CMBaseEntity *pDoor;
TraceResult tr; TraceResult tr;
@@ -232,9 +236,7 @@ int CGraph :: HandleLinkEnt ( int iNode, entvars_t *pevLinkEnt, int afCapMask, N
// func_door // func_door
if ( FClassnameIs( pevLinkEnt, "func_door" ) || FClassnameIs( pevLinkEnt, "func_door_rotating" ) ) if ( FClassnameIs( pevLinkEnt, "func_door" ) || FClassnameIs( pevLinkEnt, "func_door_rotating" ) )
{// ent is a door. {// ent is a door.
// Can't retrieve door info right now, assume it's a hard wall and don't let the monster go through
return FALSE;
/*
pDoor = ( CMBaseEntity::Instance( pevLinkEnt ) ); pDoor = ( CMBaseEntity::Instance( pevLinkEnt ) );
if ( ( pevLinkEnt->spawnflags & SF_DOOR_USE_ONLY ) ) if ( ( pevLinkEnt->spawnflags & SF_DOOR_USE_ONLY ) )
@@ -271,7 +273,6 @@ int CGraph :: HandleLinkEnt ( int iNode, entvars_t *pevLinkEnt, int afCapMask, N
return FALSE; return FALSE;
} }
*/
} }
// func_breakable // func_breakable
else if ( FClassnameIs( pevLinkEnt, "func_breakable" ) && queryType == NODEGRAPH_STATIC ) else if ( FClassnameIs( pevLinkEnt, "func_breakable" ) && queryType == NODEGRAPH_STATIC )
@@ -285,6 +286,7 @@ int CGraph :: HandleLinkEnt ( int iNode, entvars_t *pevLinkEnt, int afCapMask, N
} }
return FALSE; return FALSE;
#endif
} }
#if 0 #if 0

View File

@@ -26,6 +26,8 @@
#include "schedule.h" #include "schedule.h"
#include "weapons.h" #include "weapons.h"
#define SR_AE_JUMPATTACK ( 2 )
const char *CMShockRoach::pIdleSounds[] = const char *CMShockRoach::pIdleSounds[] =
{ {
"shockroach/shock_idle1.wav", "shockroach/shock_idle1.wav",
@@ -219,7 +221,26 @@ int CMShockRoach::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, f
return CMBaseMonster::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType ); return CMBaseMonster::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType );
} }
//=========================================================
// HandleAnimEvent - catches the monster-specific messages
// that occur when tagged animation frames are played.
//=========================================================
void CMShockRoach::HandleAnimEvent(MonsterEvent_t *pEvent)
{
CMHeadCrab::HandleAnimEvent(pEvent);
switch (pEvent->event)
{
case SR_AE_JUMPATTACK:
{
// Overwrite attack noise
AttackSound();
}
break;
}
}
void CMShockRoach::AttackSound() void CMShockRoach::AttackSound()
{ {
EMIT_SOUND_DYN(edict(), CHAN_WEAPON, RANDOM_SOUND_ARRAY(pAttackSounds), GetSoundVolume(), ATTN_IDLE, 0, GetVoicePitch()); EMIT_SOUND_DYN(edict(), CHAN_VOICE, RANDOM_SOUND_ARRAY(pAttackSounds), GetSoundVolume(), ATTN_IDLE, 0, GetVoicePitch());
} }

View File

@@ -395,11 +395,11 @@ BOOL CMVoltigore::CheckRangeAttack1(float flDot, float flDist)
return FALSE; return FALSE;
} }
if (flDist > 64 && flDist <= 784 && flDot >= 0.5 && gpGlobals->time >= m_flNextZapTime) if (flDist > 64 && flDist <= m_flDistTooFar && flDot >= 0.5 && gpGlobals->time >= m_flNextZapTime)
{ {
if (m_hEnemy != 0) if (m_hEnemy != 0)
{ {
if (fabs(pev->origin.z - m_hEnemy->v.origin.z) > 256) if (fabs(pev->origin.z - m_hEnemy->v.origin.z) > 512)
{ {
// don't try to spit at someone up really high or down really low. // don't try to spit at someone up really high or down really low.
return FALSE; return FALSE;