CGameRules: Add MonstersSpawn(), now game-modes can be queried for whether

or not monster entities spawn on init.
This commit is contained in:
Marco Cawthorne 2021-09-16 21:16:37 +02:00
parent 1764677394
commit 56e07c3f06
Signed by: eukara
GPG Key ID: C196CD8BA993248A
8 changed files with 19 additions and 13 deletions

View File

@ -711,9 +711,8 @@ CBaseMonster::SendEntity(entity ePEnt, float fChanged)
void
CBaseMonster::CBaseMonster(void)
{
/* FIXME: Put this somewhere else? */
if (!(spawnflags & MSF_MULTIPLAYER))
if (!(cvar("coop") == 1 || cvar("sv_playerslots") == 1)) {
if (g_grMode.MonstersSpawn() == FALSE) {
remove(this);
return;
}

View File

@ -85,17 +85,17 @@ CBaseTrigger::GetMaster(void)
/* we couldn't find it, so let's not even bother going further */
if (!t) {
/*dprint(sprintf("^2%s::^3GetMaster^7: Invalid master, return success\n",
this.classname));*/
print(sprintf("^2%s::^3GetMaster^7: Invalid master, return success\n",
this.classname));
return (1);
}
/*if (t.GetValue() == 1)
dprint(sprintf("^2%s::^3GetMaster^7: %s learns %s ^2POSITIVE\n",
if (t.GetValue() == 1)
print(sprintf("^2%s::^3GetMaster^7: %s learns %s ^2POSITIVE\n",
this.classname, targetname, m_strMaster));
else
dprint(sprintf("^2%s::^3GetMaster^7: %s learns %s ^1NEGATIVE\n",
this.classname, targetname, m_strMaster));*/
print(sprintf("^2%s::^3GetMaster^7: %s learns %s ^1NEGATIVE\n",
this.classname, targetname, m_strMaster));
return t.GetValue();
}
@ -110,7 +110,7 @@ CBaseTrigger::InitPointTrigger(void)
void
CBaseTrigger::InitBrushTrigger(void)
{
SetModel(m_oldModel);
SetModel(GetSpawnModel());
SetMovetype(MOVETYPE_NONE);
SetSolid(SOLID_BSPTRIGGER);

View File

@ -208,7 +208,6 @@ func_breakable::Death(void)
unit.nextthink = time;
unit.real_owner = this;
setorigin(unit, absmin + (0.5 * (absmax - absmin)));
print(sprintf("breakable spawning %s\n", unit.classname));
}
/* This may seem totally absurd. That's because it is. It's very

View File

@ -490,7 +490,7 @@ CBaseEntity_ParseSentence(void)
targ = (CBaseEntity)ent;
targ.Sentence(sentence);
} else {
print(sprintf("^3CBaseNPC_ParseSentence^7: Entity %d not in PVS\n", e));
dprint(sprintf("^3CBaseNPC_ParseSentence^7: Entity %d not in PVS\n", e));
}
}
#else

View File

@ -156,7 +156,7 @@ decal::Place(vector org, string dname)
/* we never hit any wall. */
if (g_tracedDecal.fraction == 1.0f) {
print(sprintf("^1infodecal tracing failed at %v\n", org));
dprint(sprintf("^1infodecal tracing failed at %v\n", org));
if (classname != "tempdecal")
remove(this);
return;

View File

@ -43,6 +43,7 @@ class CGameRules
virtual void(base_player) LevelChangeParms;
virtual int(int) MaxItemPerSlot;
virtual int(void) MonstersSpawn;
/* end of a game */
virtual void(void) IntermissionStart;

View File

@ -107,7 +107,7 @@ CGameRules::SpectatorThink(player pl)
int
CGameRules::MaxItemPerSlot(int slot)
{
return -1;
return (-1);
}
void
@ -171,6 +171,12 @@ CGameRules::IntermissionCycle(void)
}
int
CGameRules::MonstersSpawn(void)
{
return (TRUE);
}
void
CGameRules::IntermissionEnd(void)
{

View File

@ -239,6 +239,7 @@ Sound_Precache(string shader)
g_sounds[index].volume = 1.0f;
g_sounds[index].dist_max = 1;
g_sounds[index].pitch_min = g_sounds[index].pitch_max = 100;
g_sounds[index].offset = 0;
sh = search_begin("sound/*.sndshd", TRUE, TRUE);