diff --git a/src/dlls/bigmomma.cpp b/src/dlls/bigmomma.cpp index 9701eb4..3911456 100644 --- a/src/dlls/bigmomma.cpp +++ b/src/dlls/bigmomma.cpp @@ -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 ); diff --git a/src/dlls/cmbasemonster.h b/src/dlls/cmbasemonster.h index 319970a..7951975 100644 --- a/src/dlls/cmbasemonster.h +++ b/src/dlls/cmbasemonster.h @@ -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[]; diff --git a/src/dlls/cmtalkmonster.h b/src/dlls/cmtalkmonster.h index 374d5ee..b718ccf 100644 --- a/src/dlls/cmtalkmonster.h +++ b/src/dlls/cmtalkmonster.h @@ -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 ); diff --git a/src/dlls/dllapi.cpp b/src/dlls/dllapi.cpp index 112426b..4f5e701 100644 --- a/src/dlls/dllapi.cpp +++ b/src/dlls/dllapi.cpp @@ -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 diff --git a/src/dlls/gargantua.cpp b/src/dlls/gargantua.cpp index a19cfa4..776cbd1 100644 --- a/src/dlls/gargantua.cpp +++ b/src/dlls/gargantua.cpp @@ -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 ); } diff --git a/src/dlls/globalreplace.cpp b/src/dlls/globalreplace.cpp index 2774d6b..ceacf3a 100644 --- a/src/dlls/globalreplace.cpp +++ b/src/dlls/globalreplace.cpp @@ -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) { diff --git a/src/dlls/hgrunt.cpp b/src/dlls/hgrunt.cpp index c4d8b56..8c534e1 100644 --- a/src/dlls/hgrunt.cpp +++ b/src/dlls/hgrunt.cpp @@ -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; diff --git a/src/dlls/massn.cpp b/src/dlls/massn.cpp index d688c86..9ced4b9 100644 --- a/src/dlls/massn.cpp +++ b/src/dlls/massn.cpp @@ -345,7 +345,7 @@ DEFINE_CUSTOM_SCHEDULES( CMMassn ) slMassnSniperAttack, }; -IMPLEMENT_CUSTOM_SCHEDULES( CMMassn, CMBaseMonster ); +IMPLEMENT_CUSTOM_SCHEDULES( CMMassn, CMHGrunt ); //========================================================= // SetActivity diff --git a/src/dlls/nodes.cpp b/src/dlls/nodes.cpp index 727750e..e52f45d 100644 --- a/src/dlls/nodes.cpp +++ b/src/dlls/nodes.cpp @@ -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 diff --git a/src/dlls/shockroach.cpp b/src/dlls/shockroach.cpp index 4dfd93e..d1968f5 100644 --- a/src/dlls/shockroach.cpp +++ b/src/dlls/shockroach.cpp @@ -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()); } diff --git a/src/dlls/voltigore.cpp b/src/dlls/voltigore.cpp index 1d04cc7..7366174 100644 --- a/src/dlls/voltigore.cpp +++ b/src/dlls/voltigore.cpp @@ -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;