Make Client_InIntermission() a shared (Client/Server) function, add method 'InIntermission()' to CGameRules.

Tone down the intermission view movement, also tweak Spawn_SelectRandom() to find more points.
This commit is contained in:
Marco Cawthorne 2022-03-29 15:20:52 -07:00
parent dd26664ac4
commit 8c3804a1bc
Signed by: eukara
GPG Key ID: C196CD8BA993248A
7 changed files with 29 additions and 11 deletions

View File

@ -335,7 +335,7 @@ CSQC_UpdateView(float w, float h, float focus)
if (Client_InIntermission()) {
view_angles = pSeat->m_vecCameraAngle;
view_angles += [sin(time), sin(time * 2)];
view_angles += [sin(time), sin(time * 1.5f)] * 0.1f;
setproperty(VF_ORIGIN, pSeat->m_vecCameraOrigin);
setproperty(VF_CL_VIEWANGLES, view_angles);
}

View File

@ -30,11 +30,4 @@ float
Client_IsPlayer(base_client cl)
{
return (cl.classname == "player") ? TRUE : FALSE;
}
float
Client_InIntermission(void)
{
return g_iIntermission;
}
}

View File

@ -53,6 +53,7 @@ class CGameRules
virtual void(void) IntermissionStart;
virtual void(void) IntermissionCycle;
virtual void(void) IntermissionEnd;
virtual int(void) InIntermission;
virtual float(void) IsTeamPlay;

View File

@ -173,6 +173,12 @@ CGameRules::IntermissionCycle(void)
}
int
CGameRules::InIntermission(void)
{
return (m_iIntermission) ? 1 : 0;
}
int
CGameRules::MonstersSpawn(void)
{

View File

@ -90,7 +90,14 @@ entity Spawn_SelectRandom(string cname)
static entity lastspot;
entity spot = lastspot;
for (int i = random(1, 5); i > 0; i--) {
float max = 0;
/* count our max count */
for (entity e = world;(e = find(e, ::classname, cname));) {
max++;
}
for (int i = random(1, max); i > 0; i--) {
spot = find(spot, classname, cname);
}

View File

@ -47,3 +47,14 @@ base_client::base_client(void)
{
}
float
Client_InIntermission(void)
{
#ifdef CLIENT
return g_iIntermission;
#else
return (float)g_grMode.InIntermission();
#endif
}

View File

@ -88,7 +88,7 @@ base_player::PostFrame(void)
void
base_player::ClientInput(void)
{
if (IsFakeSpectator()) {
if (!Client_InIntermission() && IsFakeSpectator()) {
spectator::ClientInput();
SpectatorTrackPlayer();
return;