env_hudhint: Initial basic implementation, plus a way for the game-logic to send hints.
This commit is contained in:
parent
b31ab5761a
commit
00a8ee2a00
4 changed files with 90 additions and 0 deletions
|
@ -546,6 +546,12 @@ CSQC_Parse_Event(void)
|
|||
case EV_SENTENCE:
|
||||
CBaseEntity_ParseSentence();
|
||||
break;
|
||||
case EV_HUDHINT:
|
||||
string hint;
|
||||
hint = readstring();
|
||||
/* TODO: Handle the event properly */
|
||||
Chat_Parse(sprintf("Hint: %s", hint));
|
||||
break;
|
||||
case EV_FADE:
|
||||
Fade_Parse();
|
||||
break;
|
||||
|
|
|
@ -22,6 +22,7 @@ server/cycler.cpp
|
|||
server/cycler_sprite.cpp
|
||||
server/env_beam.cpp
|
||||
server/env_fade.cpp
|
||||
server/env_hudhint.cpp
|
||||
server/env_sprite.cpp
|
||||
server/env_spark.cpp
|
||||
server/env_explosion.cpp
|
||||
|
|
82
src/gs-entbase/server/env_hudhint.cpp
Normal file
82
src/gs-entbase/server/env_hudhint.cpp
Normal file
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*QUAKED env_hudhint (0 0 0) (-8 -8 -8) (8 8 8) EVF_FADEDROM EVF_MODULATE EVF_ONLYUSER
|
||||
"targetname" Name
|
||||
"target" Target when triggered.
|
||||
"killtarget" Target to kill when triggered.
|
||||
"rendercolor" RGB8 Color of the fade effect.
|
||||
"renderamt" A8 alpha value we'll hit at max.
|
||||
"duration" Duration of the effect in seconds.
|
||||
"holdtime" How long we'll hold on the max color/alpha.
|
||||
|
||||
When triggered, creates a colored overlay that blinds all players, or just
|
||||
the one who triggered it if EVF_ONLYUSER is set.
|
||||
*/
|
||||
|
||||
void env_hudhint_send(entity eActivator, string strMessage, int iFlags);
|
||||
|
||||
enumflags
|
||||
{
|
||||
EHH_ALLPLAYERS
|
||||
};
|
||||
|
||||
class env_hudhint:CBaseTrigger
|
||||
{
|
||||
string m_strMessage;
|
||||
|
||||
void(void) env_hudhint;
|
||||
virtual void(entity, int) Trigger;
|
||||
virtual void(string, string) SpawnKey;
|
||||
};
|
||||
|
||||
void
|
||||
env_hudhint::Trigger(entity act, int state)
|
||||
{
|
||||
env_hudhint_send(act, m_strMessage, spawnflags);
|
||||
}
|
||||
|
||||
void
|
||||
env_hudhint::SpawnKey(string strKey, string strValue)
|
||||
{
|
||||
switch (strKey) {
|
||||
case "message":
|
||||
m_strMessage = strValue;
|
||||
break;
|
||||
default:
|
||||
CBaseTrigger::SpawnKey(strKey, strValue);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
env_hudhint::env_hudhint(void)
|
||||
{
|
||||
CBaseTrigger::CBaseTrigger();
|
||||
}
|
||||
|
||||
void
|
||||
env_hudhint_send(entity eActivator, string strMessage, int iFlags)
|
||||
{
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_HUDHINT);
|
||||
WriteString(MSG_MULTICAST, strMessage);
|
||||
msg_entity = eActivator;
|
||||
|
||||
if (iFlags & EHH_ALLPLAYERS)
|
||||
multicast([0,0,0], MULTICAST_ALL);
|
||||
else
|
||||
multicast([0,0,0], MULTICAST_ONE_R);
|
||||
}
|
|
@ -32,6 +32,7 @@ enum
|
|||
EV_EXPLOSION,
|
||||
EV_SPARK,
|
||||
EV_SHAKE,
|
||||
EV_HUDHINT,
|
||||
EV_FADE,
|
||||
EV_TEXT,
|
||||
EV_MESSAGE,
|
||||
|
|
Loading…
Reference in a new issue