diff --git a/src/dlls/cmbasemonster.h b/src/dlls/cmbasemonster.h index b9606c5..81240d7 100644 --- a/src/dlls/cmbasemonster.h +++ b/src/dlls/cmbasemonster.h @@ -632,6 +632,7 @@ public: void IdleSound( void ); void Killed( entvars_t *pevAttacker, int iGib ); + void UpdateOnRemove(); void StartTask ( Task_t *pTask ); Schedule_t *GetSchedule( void ); diff --git a/src/dlls/dllapi.cpp b/src/dlls/dllapi.cpp index 96de25e..27df3b1 100644 --- a/src/dlls/dllapi.cpp +++ b/src/dlls/dllapi.cpp @@ -715,6 +715,7 @@ edict_t* spawn_monster(int monster_type, Vector origin, Vector angles, int spawn case 33: monsters[monster_index].pMonster = CreateClassPtr((CMAmbientMusic *)NULL); break; case 34: monsters[monster_index].pMonster = CreateClassPtr((CMXenMaker *)NULL); break; case 35: monsters[monster_index].pMonster = CreateClassPtr((CMSetCVar *)NULL); break; + default: LOG_MESSAGE(PLID, "ERROR: Invalid monster type! (%i)", monster_type); return NULL; } if (monsters[monster_index].pMonster == NULL) @@ -734,7 +735,7 @@ edict_t* spawn_monster(int monster_type, Vector origin, Vector angles, int spawn // Pass spawnflags first if no keyvalue data exists for it monster_pent->v.spawnflags = spawnflags; - + // Keyvalue data if (keyvalue != NULL) { @@ -1243,6 +1244,28 @@ void SpawnViewerCommand(void) LOG_MESSAGE(PLID, "spawns a node viewer at the player's location"); } +void DebugGetEntities(void) +{ + LOG_MESSAGE(PLID, "count: %i ents of max %i\n", monster_ents_used, MAX_MONSTER_ENTS); + for (int index = 0; index < MAX_MONSTER_ENTS; index++) + { + if (monsters[index].monster_index) + { + LOG_MESSAGE(PLID, "SLOT #%i:", index); + edict_t *pent = (*g_engfuncs.pfnPEntityOfEntIndex)(monsters[index].monster_index); + + if (pent) + { + LOG_MESSAGE(PLID, "Class is \"%s\"\n", STRING(pent->v.classname)); + } + else + { + LOG_MESSAGE(PLID, "NULL entity\n"); + } + } + } +} + void mmGameDLLInit( void ) { // one time initialization stuff here... @@ -1446,6 +1469,7 @@ void mmServerActivate( edict_t *pEdictList, int edictCount, int clientMax ) (g_engfuncs.pfnAddServerCommand)("monster", MonsterCommand); (g_engfuncs.pfnAddServerCommand)("node_viewer", SpawnViewerCommand); + (g_engfuncs.pfnAddServerCommand)("get_edicts", DebugGetEntities); (g_engfuncs.pfnAddServerCommand)("_use", mmDispatchUse); for (index = 0; monster_types[index].name[0]; index++) diff --git a/src/dlls/explode.cpp b/src/dlls/explode.cpp index 3160e02..d38ac92 100644 --- a/src/dlls/explode.cpp +++ b/src/dlls/explode.cpp @@ -97,6 +97,7 @@ void CSmoker::Spawn( void ) UTIL_SetSize(pev, g_vecZero, g_vecZero ); pev->effects |= EF_NODRAW; pev->angles = g_vecZero; + pev->classname = MAKE_STRING("env_smoker"); } void CSmoker::Think( void ) diff --git a/src/dlls/islave.cpp b/src/dlls/islave.cpp index 518afca..054af05 100644 --- a/src/dlls/islave.cpp +++ b/src/dlls/islave.cpp @@ -168,6 +168,12 @@ void CMISlave::Killed( entvars_t *pevAttacker, int iGib ) CMBaseMonster::Killed( pevAttacker, iGib ); } +void CMISlave::UpdateOnRemove() +{ + CMBaseMonster::UpdateOnRemove(); + ClearBeams(); +} + //========================================================= // SetYawSpeed - allows each sequence to have a different // turn rate associated with it. diff --git a/src/dlls/monster_config.cpp b/src/dlls/monster_config.cpp index c0dbacd..385dc7e 100644 --- a/src/dlls/monster_config.cpp +++ b/src/dlls/monster_config.cpp @@ -133,7 +133,6 @@ void process_monster_sound(edict_t *pMonster, char *fileName) // SC soundlist path starts from sound/MAPNAME sprintf(srPath, "%s/sound/%s/%s", game_dir, STRING(gpGlobals->mapname), fileName); - if (access(srPath, 0) == 0) { if ((fp = fopen(srPath, "r")) != NULL) @@ -450,11 +449,11 @@ void scan_monster_cfg(FILE *fp) { // precache the sound here PRECACHE_GENERIC(data[i].value); - - // the entity will need the keyvalue - strcpy(monster_spawnpoint[monster_spawn_count].keyvalue[i].key, data[i].key); - strcpy(monster_spawnpoint[monster_spawn_count].keyvalue[i].value, data[i].value); } + + // common pev-field, an entity might need it + strcpy(monster_spawnpoint[monster_spawn_count].keyvalue[i].key, data[i].key); + strcpy(monster_spawnpoint[monster_spawn_count].keyvalue[i].value, data[i].value); } } else @@ -828,11 +827,11 @@ void scan_monster_bsp(void) { // precache the sound here PRECACHE_GENERIC(data[i].value); - - // the entity will need the keyvalue - strcpy(monster_spawnpoint[monster_spawn_count].keyvalue[i].key, data[i].key); - strcpy(monster_spawnpoint[monster_spawn_count].keyvalue[i].value, data[i].value); } + + // common pev-field, an entity might need it + strcpy(monster_spawnpoint[monster_spawn_count].keyvalue[i].key, data[i].key); + strcpy(monster_spawnpoint[monster_spawn_count].keyvalue[i].value, data[i].value); } } else diff --git a/src/dlls/monster_plugin.h b/src/dlls/monster_plugin.h index 58d5177..6b20888 100644 --- a/src/dlls/monster_plugin.h +++ b/src/dlls/monster_plugin.h @@ -30,7 +30,7 @@ typedef struct CMBaseMonster *pMonster; } monster_t; -#define MAX_MONSTER_ENTS 512 +#define MAX_MONSTER_ENTS 768 extern monster_t monsters[MAX_MONSTER_ENTS]; @@ -43,7 +43,7 @@ typedef struct { bool need_to_respawn; } monster_spawnpoint_t; -#define MAX_MONSTERS 256 +#define MAX_MONSTERS 384 extern monster_spawnpoint_t monster_spawnpoint[MAX_MONSTERS]; // this is here to store if a node we want to spawn is an ordinary one, or a flying one diff --git a/src/dlls/monstermaker.cpp b/src/dlls/monstermaker.cpp index 4573582..fd4488d 100644 --- a/src/dlls/monstermaker.cpp +++ b/src/dlls/monstermaker.cpp @@ -25,9 +25,10 @@ #include "monsters.h" // Monstermaker spawnflags -#define SF_MONSTERMAKER_START_ON 1 // start active ( if has targetname ) -#define SF_MONSTERMAKER_CYCLIC 4 // drop one monster every time fired. -#define SF_MONSTERMAKER_MONSTERCLIP 8 // Children are blocked by monsterclip +#define SF_MONSTERMAKER_START_ON 1 // start active ( if has targetname ) +#define SF_MONSTERMAKER_CYCLIC 4 // drop one monster every time fired. +#define SF_MONSTERMAKER_MONSTERCLIP 8 // Children are blocked by monsterclip +#define SF_MONSTERMAKER_PRISONER 16 // children won't attack or be attacked extern monster_type_t monster_types[]; extern edict_t* spawn_monster(int monster_type, Vector origin, Vector angles, int spawnflags, pKVD *keyvalue); @@ -171,7 +172,7 @@ void CMMonsterMaker::MakeMonster( void ) } edict_t *pent; - pKVD keyvalue[MAX_KEYVALUES]; // sometimes, i don't know what am i doing. -Giegue + pKVD keyvalue[MAX_KEYVALUES]; int createSF = SF_MONSTER_FALL_TO_GROUND; if ( m_iMaxLiveChildren > 0 && m_cLiveChildren >= m_iMaxLiveChildren ) @@ -205,6 +206,10 @@ void CMMonsterMaker::MakeMonster( void ) if ( pev->spawnflags & SF_MONSTERMAKER_MONSTERCLIP ) createSF |= SF_MONSTER_HITMONSTERCLIP; + // Should children be prisoner entities? + if (pev->spawnflags & SF_MONSTERMAKER_PRISONER) + createSF |= SF_MONSTER_PRISONER; + /* KEYVALUES */ // Monster is to have a custom model? if ( !FStringNull( m_iszCustomModel ) ) @@ -284,13 +289,13 @@ void CMMonsterMaker::MakeMonster( void ) pent->v.rendercolor = pev->rendercolor; // Soundlist isn't "exactly" a keyvalue so pass it here - if ( m_srSoundList != NULL ) + if (m_srSoundList != NULL) { // it needs to be allocated first CMBaseMonster *pChild = GetClassPtr((CMBaseMonster *)VARS(pent)); pChild->m_srSoundList = (REPLACER::REPLACER*)calloc(MAX_REPLACEMENTS, sizeof(*pChild->m_srSoundList)); - memcpy(pChild->m_srSoundList, m_srSoundList, sizeof(REPLACER::REPLACER)); + memcpy(pChild->m_srSoundList, m_srSoundList, m_isrSounds * sizeof(*pChild->m_srSoundList)); pChild->m_isrSounds = m_isrSounds; } diff --git a/src/dlls/sporegrenade.cpp b/src/dlls/sporegrenade.cpp index 6dca0fb..1e93bd6 100644 --- a/src/dlls/sporegrenade.cpp +++ b/src/dlls/sporegrenade.cpp @@ -107,7 +107,7 @@ void CMSporeGrenade::Explode(TraceResult *pTrace) pev->owner = NULL; // can't traceline attack owner if this is set - RadiusDamage(pev, pevOwner, pev->dmg, CLASS_NONE, DMG_BLAST); + RadiusDamage(pev, pevOwner, pev->dmg, CLASS_NONE, DMG_BLAST | DMG_POISON); // Place a decal on the surface that was hit. UTIL_DecalTrace(pTrace, DECAL_SPIT1 + RANDOM_LONG(0, 1));