2022-12-17 13:32:43 +01:00
|
|
|
/***
|
2013-08-30 13:34:05 -07:00
|
|
|
*
|
|
|
|
* Copyright (c) 1996-2001, Valve LLC. All rights reserved.
|
|
|
|
*
|
|
|
|
* This product contains software technology licensed from Id
|
|
|
|
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* This source code contains proprietary and confidential information of
|
|
|
|
* Valve LLC and its suppliers. Access to this code is restricted to
|
|
|
|
* persons who have executed a written SDK license with Valve. Any access,
|
|
|
|
* use or distribution of this code by or to any unlicensed person is illegal.
|
|
|
|
*
|
|
|
|
****/
|
|
|
|
/*
|
|
|
|
|
|
|
|
===== h_cine.cpp ========================================================
|
|
|
|
|
|
|
|
The Halflife hard coded "scripted sequence".
|
|
|
|
|
|
|
|
I'm pretty sure all this code is obsolete
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2021-11-28 16:54:48 +01:00
|
|
|
#include "extdll.h"
|
|
|
|
#include "util.h"
|
|
|
|
#include "cbase.h"
|
|
|
|
#include "monsters.h"
|
|
|
|
#include "decals.h"
|
2013-08-30 13:34:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
class CLegacyCineMonster : public CBaseMonster
|
|
|
|
{
|
|
|
|
public:
|
2021-11-28 16:54:48 +01:00
|
|
|
void CineSpawn(const char* szModel);
|
|
|
|
void Use(CBaseEntity* pActivator, CBaseEntity* pCaller, USE_TYPE useType, float value) override;
|
2021-03-05 20:54:33 +01:00
|
|
|
void EXPORT CineThink();
|
|
|
|
void Pain();
|
|
|
|
void Die();
|
2013-08-30 13:34:05 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class CCineScientist : public CLegacyCineMonster
|
|
|
|
{
|
|
|
|
public:
|
2021-03-05 23:07:22 +01:00
|
|
|
void Spawn() override { CineSpawn("models/cine-scientist.mdl"); }
|
2013-08-30 13:34:05 -07:00
|
|
|
};
|
|
|
|
class CCine2Scientist : public CLegacyCineMonster
|
|
|
|
{
|
|
|
|
public:
|
2021-03-05 23:07:22 +01:00
|
|
|
void Spawn() override { CineSpawn("models/cine2-scientist.mdl"); }
|
2013-08-30 13:34:05 -07:00
|
|
|
};
|
|
|
|
class CCinePanther : public CLegacyCineMonster
|
|
|
|
{
|
|
|
|
public:
|
2021-03-05 23:07:22 +01:00
|
|
|
void Spawn() override { CineSpawn("models/cine-panther.mdl"); }
|
2013-08-30 13:34:05 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class CCineBarney : public CLegacyCineMonster
|
|
|
|
{
|
|
|
|
public:
|
2021-03-05 23:07:22 +01:00
|
|
|
void Spawn() override { CineSpawn("models/cine-barney.mdl"); }
|
2013-08-30 13:34:05 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class CCine2HeavyWeapons : public CLegacyCineMonster
|
|
|
|
{
|
|
|
|
public:
|
2021-03-05 23:07:22 +01:00
|
|
|
void Spawn() override { CineSpawn("models/cine2_hvyweapons.mdl"); }
|
2013-08-30 13:34:05 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class CCine2Slave : public CLegacyCineMonster
|
|
|
|
{
|
|
|
|
public:
|
2021-03-05 23:07:22 +01:00
|
|
|
void Spawn() override { CineSpawn("models/cine2_slave.mdl"); }
|
2013-08-30 13:34:05 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class CCine3Scientist : public CLegacyCineMonster
|
|
|
|
{
|
|
|
|
public:
|
2021-03-05 23:07:22 +01:00
|
|
|
void Spawn() override { CineSpawn("models/cine3-scientist.mdl"); }
|
2013-08-30 13:34:05 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class CCine3Barney : public CLegacyCineMonster
|
|
|
|
{
|
|
|
|
public:
|
2021-03-05 23:07:22 +01:00
|
|
|
void Spawn() override { CineSpawn("models/cine3-barney.mdl"); }
|
2013-08-30 13:34:05 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
//
|
|
|
|
// ********** Scientist SPAWN **********
|
|
|
|
//
|
|
|
|
|
2021-11-28 16:54:48 +01:00
|
|
|
LINK_ENTITY_TO_CLASS(monster_cine_scientist, CCineScientist);
|
|
|
|
LINK_ENTITY_TO_CLASS(monster_cine_panther, CCinePanther);
|
|
|
|
LINK_ENTITY_TO_CLASS(monster_cine_barney, CCineBarney);
|
|
|
|
LINK_ENTITY_TO_CLASS(monster_cine2_scientist, CCine2Scientist);
|
|
|
|
LINK_ENTITY_TO_CLASS(monster_cine2_hvyweapons, CCine2HeavyWeapons);
|
|
|
|
LINK_ENTITY_TO_CLASS(monster_cine2_slave, CCine2Slave);
|
|
|
|
LINK_ENTITY_TO_CLASS(monster_cine3_scientist, CCine3Scientist);
|
|
|
|
LINK_ENTITY_TO_CLASS(monster_cine3_barney, CCine3Barney);
|
2013-08-30 13:34:05 -07:00
|
|
|
|
|
|
|
//
|
|
|
|
// ********** Scientist SPAWN **********
|
|
|
|
//
|
|
|
|
|
2021-11-29 20:31:17 +01:00
|
|
|
void CLegacyCineMonster::CineSpawn(const char* szModel)
|
2013-08-30 13:34:05 -07:00
|
|
|
{
|
|
|
|
PRECACHE_MODEL(szModel);
|
|
|
|
SET_MODEL(ENT(pev), szModel);
|
|
|
|
UTIL_SetSize(pev, Vector(-16, -16, 0), Vector(16, 16, 64));
|
|
|
|
|
2021-11-28 16:54:48 +01:00
|
|
|
pev->solid = SOLID_SLIDEBOX;
|
|
|
|
pev->movetype = MOVETYPE_STEP;
|
|
|
|
pev->effects = 0;
|
|
|
|
pev->health = 1;
|
|
|
|
pev->yaw_speed = 10;
|
|
|
|
|
|
|
|
// ugly alpha hack, can't set ints from the bsp.
|
|
|
|
pev->sequence = (int)pev->impulse;
|
|
|
|
ResetSequenceInfo();
|
2013-08-30 13:34:05 -07:00
|
|
|
pev->framerate = 0.0;
|
|
|
|
|
|
|
|
m_bloodColor = BLOOD_COLOR_RED;
|
|
|
|
|
|
|
|
// if no targetname, start now
|
2021-11-28 16:54:48 +01:00
|
|
|
if (FStringNull(pev->targetname))
|
2013-08-30 13:34:05 -07:00
|
|
|
{
|
2021-11-28 16:54:48 +01:00
|
|
|
SetThink(&CLegacyCineMonster::CineThink);
|
2013-08-30 13:34:05 -07:00
|
|
|
pev->nextthink += 1.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// CineStart
|
|
|
|
//
|
2021-11-29 20:31:17 +01:00
|
|
|
void CLegacyCineMonster::Use(CBaseEntity* pActivator, CBaseEntity* pCaller, USE_TYPE useType, float value)
|
2013-08-30 13:34:05 -07:00
|
|
|
{
|
2021-11-28 16:54:48 +01:00
|
|
|
pev->animtime = 0; // reset the sequence
|
|
|
|
SetThink(&CLegacyCineMonster::CineThink);
|
2013-08-30 13:34:05 -07:00
|
|
|
pev->nextthink = gpGlobals->time;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// ********** Scientist DIE **********
|
|
|
|
//
|
2021-11-29 20:31:17 +01:00
|
|
|
void CLegacyCineMonster::Die()
|
2013-08-30 13:34:05 -07:00
|
|
|
{
|
2021-11-28 16:54:48 +01:00
|
|
|
SetThink(&CLegacyCineMonster::SUB_Remove);
|
2013-08-30 13:34:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// ********** Scientist PAIN **********
|
|
|
|
//
|
2021-11-29 20:31:17 +01:00
|
|
|
void CLegacyCineMonster::Pain()
|
2013-08-30 13:34:05 -07:00
|
|
|
{
|
|
|
|
EMIT_SOUND(ENT(pev), CHAN_VOICE, "player/pain3.wav", 1, ATTN_NORM);
|
|
|
|
}
|
|
|
|
|
2021-11-29 20:31:17 +01:00
|
|
|
void CLegacyCineMonster::CineThink()
|
2013-08-30 13:34:05 -07:00
|
|
|
{
|
|
|
|
// DBG_CheckMonsterData(pev);
|
2021-11-28 16:54:48 +01:00
|
|
|
|
2013-08-30 13:34:05 -07:00
|
|
|
// Emit particles from origin (double check animator's placement of model)
|
|
|
|
// THIS is a test feature
|
|
|
|
//UTIL_ParticleEffect(pev->origin, g_vecZero, 255, 20);
|
|
|
|
|
2021-11-28 15:32:26 +01:00
|
|
|
if (0 == pev->animtime)
|
2021-11-28 16:54:48 +01:00
|
|
|
ResetSequenceInfo();
|
2013-08-30 13:34:05 -07:00
|
|
|
|
|
|
|
pev->nextthink = gpGlobals->time + 1.0;
|
|
|
|
|
|
|
|
if (pev->spawnflags != 0 && m_fSequenceFinished)
|
|
|
|
{
|
|
|
|
Die();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-11-28 16:54:48 +01:00
|
|
|
StudioFrameAdvance();
|
2013-08-30 13:34:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// cine_blood
|
|
|
|
//
|
2021-11-28 16:54:48 +01:00
|
|
|
// e3/prealpha only.
|
2013-08-30 13:34:05 -07:00
|
|
|
class CCineBlood : public CBaseEntity
|
|
|
|
{
|
|
|
|
public:
|
2021-03-05 23:07:22 +01:00
|
|
|
void Spawn() override;
|
2021-11-28 16:54:48 +01:00
|
|
|
void EXPORT BloodStart(CBaseEntity* pActivator, CBaseEntity* pCaller, USE_TYPE useType, float value);
|
|
|
|
void EXPORT BloodGush();
|
2013-08-30 13:34:05 -07:00
|
|
|
};
|
|
|
|
|
2021-11-28 16:54:48 +01:00
|
|
|
LINK_ENTITY_TO_CLASS(cine_blood, CCineBlood);
|
2013-08-30 13:34:05 -07:00
|
|
|
|
|
|
|
|
2021-11-29 20:31:17 +01:00
|
|
|
void CCineBlood::BloodGush()
|
2013-08-30 13:34:05 -07:00
|
|
|
{
|
2021-11-28 16:54:48 +01:00
|
|
|
Vector vecSplatDir;
|
|
|
|
TraceResult tr;
|
2013-08-30 13:34:05 -07:00
|
|
|
pev->nextthink = gpGlobals->time + 0.1;
|
|
|
|
|
|
|
|
UTIL_MakeVectors(pev->angles);
|
2021-11-28 16:54:48 +01:00
|
|
|
if (pev->health-- < 0)
|
2013-08-30 13:34:05 -07:00
|
|
|
REMOVE_ENTITY(ENT(pev));
|
2021-11-28 16:54:48 +01:00
|
|
|
// CHANGE_METHOD ( ENT(pev), em_think, SUB_Remove );
|
2013-08-30 13:34:05 -07:00
|
|
|
|
2021-11-28 16:54:48 +01:00
|
|
|
if (RANDOM_FLOAT(0, 1) < 0.7) // larger chance of globs
|
2013-08-30 13:34:05 -07:00
|
|
|
{
|
2021-11-28 16:54:48 +01:00
|
|
|
UTIL_BloodDrips(pev->origin, UTIL_RandomBloodVector(), BLOOD_COLOR_RED, 10);
|
2013-08-30 13:34:05 -07:00
|
|
|
}
|
2021-11-28 16:54:48 +01:00
|
|
|
else // slim chance of geyser
|
2013-08-30 13:34:05 -07:00
|
|
|
{
|
2021-11-28 16:54:48 +01:00
|
|
|
UTIL_BloodStream(pev->origin, UTIL_RandomBloodVector(), BLOOD_COLOR_RED, RANDOM_LONG(50, 150));
|
2013-08-30 13:34:05 -07:00
|
|
|
}
|
|
|
|
|
2021-11-28 16:54:48 +01:00
|
|
|
if (RANDOM_FLOAT(0, 1) < 0.75)
|
|
|
|
{ // decals the floor with blood.
|
|
|
|
vecSplatDir = Vector(0, 0, -1);
|
|
|
|
vecSplatDir = vecSplatDir + (RANDOM_FLOAT(-1, 1) * 0.6 * gpGlobals->v_right) + (RANDOM_FLOAT(-1, 1) * 0.6 * gpGlobals->v_forward); // randomize a bit
|
|
|
|
UTIL_TraceLine(pev->origin + Vector(0, 0, 64), pev->origin + vecSplatDir * 256, ignore_monsters, ENT(pev), &tr);
|
|
|
|
if (tr.flFraction != 1.0)
|
2013-08-30 13:34:05 -07:00
|
|
|
{
|
|
|
|
// Decal with a bloodsplat
|
2021-11-28 16:54:48 +01:00
|
|
|
UTIL_BloodDecalTrace(&tr, BLOOD_COLOR_RED);
|
2013-08-30 13:34:05 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-29 20:31:17 +01:00
|
|
|
void CCineBlood::BloodStart(CBaseEntity* pActivator, CBaseEntity* pCaller, USE_TYPE useType, float value)
|
2013-08-30 13:34:05 -07:00
|
|
|
{
|
2021-11-28 16:54:48 +01:00
|
|
|
SetThink(&CCineBlood::BloodGush);
|
|
|
|
pev->nextthink = gpGlobals->time; // now!
|
2013-08-30 13:34:05 -07:00
|
|
|
}
|
|
|
|
|
2021-11-29 20:31:17 +01:00
|
|
|
void CCineBlood::Spawn()
|
2013-08-30 13:34:05 -07:00
|
|
|
{
|
|
|
|
pev->solid = SOLID_NOT;
|
2021-11-28 16:54:48 +01:00
|
|
|
SetUse(&CCineBlood::BloodStart);
|
|
|
|
pev->health = 20; //hacked health to count iterations
|
2013-08-30 13:34:05 -07:00
|
|
|
}
|