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

@@ -1147,7 +1147,7 @@ CMBMortar *CMBMortar::Shoot( edict_t *pOwner, Vector vecStart, Vector vecVelocit
{
CMBMortar *pSpit = CreateClassPtr( (CMBMortar *)NULL );
if (pSpit)
{
{
pSpit->Spawn();
UTIL_SetOrigin( pSpit->pev, vecStart );

View File

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

View File

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

View File

@@ -136,7 +136,7 @@ monster_type_t monster_types[]=
"monster_apache", FALSE,
"monster_barney", FALSE,
"monster_bigmomma", FALSE,
"monster_bullsquid", FALSE,
"monster_bullchicken", FALSE,
"monster_alien_controller", FALSE,
"monster_human_assassin", FALSE,
"monster_headcrab", FALSE,
@@ -211,6 +211,11 @@ int GetMonsterIndex(void)
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;
monsters[index].monster_index = 0;
@@ -256,6 +261,11 @@ void monster_unload(void)
{
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;
monsters[index].monster_index = 0;
@@ -1260,10 +1270,10 @@ int mmDispatchSpawn( edict_t *pent )
if (monsters[index].pMonster != NULL)
{
// free the soundlists first!
if (monsters[index].pMonster->m_srSoundList != NULL)
/*if (monsters[index].pMonster->m_srSoundList != NULL)
free(monsters[index].pMonster->m_srSoundList);
monsters[index].pMonster->m_srSoundList = NULL;
*/
delete monsters[index].pMonster;
}
}
@@ -1604,6 +1614,16 @@ void mmClientKill_Post( edict_t *pPlayer )
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 =
{
mmGameDLLInit, //! pfnGameInit() Initialize the game (one-time call after loading of game .dll)
@@ -1624,7 +1644,7 @@ static DLL_FUNCTIONS gFunctionTable =
NULL, // pfnRestoreGlobalState
NULL, // pfnResetGlobalState
NULL, // pfnClientConnect
mmClientConnect, //! pfnClientConnect
NULL, // pfnClientDisconnect
NULL, // pfnClientKill
NULL, // pfnClientPutInServer

View File

@@ -815,9 +815,12 @@ void CMGargantua::DeathEffect( void )
void CMGargantua::Killed( entvars_t *pevAttacker, int iGib )
{
EyeOff();
UTIL_Remove( m_pEyeGlow->edict() );
m_pEyeGlow = NULL;
if ( m_pEyeGlow )
{
EyeOff();
UTIL_Remove( m_pEyeGlow->edict() );
m_pEyeGlow = NULL;
}
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 )
{
// Individually set models takes priority!
if ( pMonster && !FStringNull(pMonster->v.model))
if (UTIL_IsValidEntity(pMonster) && !FStringNull(pMonster->v.model))
return STRING(pMonster->v.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 )
{
// Individually set sounds takes priority!
if ( pMonster )
if (UTIL_IsValidEntity(pMonster))
{
CMBaseMonster *castMonster = NULL;
@@ -133,7 +133,7 @@ const char* FindSoundReplacement( edict_t *pMonster, const char *from )
if (!FNullEnt(pMonster->v.owner))
castMonster = GetClassPtr((CMBaseMonster *)VARS(pMonster->v.owner));
}
// If still no valid BaseMonster pointer, full stop, use GSR.
if (castMonster && castMonster->m_isrSounds)
{

View File

@@ -799,8 +799,10 @@ void CMHGrunt :: HandleAnimEvent( MonsterEvent_t *pEvent )
else if (pHurt->v.euser4 != NULL)
{
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;

View File

@@ -345,7 +345,7 @@ DEFINE_CUSTOM_SCHEDULES( CMMassn )
slMassnSniperAttack,
};
IMPLEMENT_CUSTOM_SCHEDULES( CMMassn, CMBaseMonster );
IMPLEMENT_CUSTOM_SCHEDULES( CMMassn, CMHGrunt );
//=========================================================
// 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 )
{
// NULL pointers are becoming a nightmare... -Giegue
return FALSE;
#if 0
edict_t *pentWorld;
CMBaseEntity *pDoor;
TraceResult tr;
@@ -232,9 +236,7 @@ int CGraph :: HandleLinkEnt ( int iNode, entvars_t *pevLinkEnt, int afCapMask, N
// func_door
if ( FClassnameIs( pevLinkEnt, "func_door" ) || FClassnameIs( pevLinkEnt, "func_door_rotating" ) )
{// 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 ) );
if ( ( pevLinkEnt->spawnflags & SF_DOOR_USE_ONLY ) )
@@ -271,7 +273,6 @@ int CGraph :: HandleLinkEnt ( int iNode, entvars_t *pevLinkEnt, int afCapMask, N
return FALSE;
}
*/
}
// func_breakable
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;
#endif
}
#if 0

View File

@@ -26,6 +26,8 @@
#include "schedule.h"
#include "weapons.h"
#define SR_AE_JUMPATTACK ( 2 )
const char *CMShockRoach::pIdleSounds[] =
{
"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 );
}
//=========================================================
// 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()
{
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;
}
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 (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.
return FALSE;