scripted_sentence: add support for `refire` key.

Add some more icons. Also NSPointTriggers should be SOLID_NOT now as to not
travel across levels.
This commit is contained in:
Marco Cawthorne 2024-03-05 22:48:00 -08:00
parent 09839aa198
commit 3a1a5d66f5
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
53 changed files with 229 additions and 18 deletions

View File

@ -0,0 +1,8 @@
{
diffusemap textures/editor/env_explosion.tga
{
map $diffuse
alphaFunc GE128
}
}

View File

@ -0,0 +1,8 @@
{
diffusemap textures/editor/env_global.tga
{
map $diffuse
alphaFunc GE128
}
}

View File

@ -0,0 +1,8 @@
{
diffusemap textures/editor/env_shake.tga
{
map $diffuse
alphaFunc GE128
}
}

View File

@ -0,0 +1,8 @@
{
diffusemap textures/editor/game_counter.tga
{
map $diffuse
alphaFunc GE128
}
}

View File

@ -0,0 +1,8 @@
{
diffusemap textures/editor/info_notnull.tga
{
map $diffuse
alphaFunc GE128
}
}

View File

@ -0,0 +1,8 @@
{
diffusemap textures/editor/info_null.tga
{
map $diffuse
alphaFunc GE128
}
}

View File

@ -0,0 +1,8 @@
{
diffusemap textures/editor/info_player_deathmatch.tga
{
map $diffuse
alphaFunc GE128
}
}

View File

@ -0,0 +1,8 @@
{
diffusemap textures/editor/info_player_spectator.tga
{
map $diffuse
alphaFunc GE128
}
}

View File

@ -0,0 +1,8 @@
{
diffusemap textures/editor/info_player_start.tga
{
map $diffuse
alphaFunc GE128
}
}

View File

@ -0,0 +1,8 @@
{
diffusemap textures/editor/info_target.tga
{
map $diffuse
alphaFunc GE128
}
}

View File

@ -0,0 +1,9 @@
{
diffusemap textures/editor/light.tga
{
map $diffuse
rgbGen vertex
alphaFunc GE128
}
}

View File

@ -0,0 +1,9 @@
{
diffusemap textures/editor/light.tga
{
map $diffuse
rgbGen vertex
alphaFunc GE128
}
}

View File

@ -0,0 +1,8 @@
{
diffusemap textures/editor/multi_manager.tga
{
map $diffuse
alphaFunc GE128
}
}

View File

@ -0,0 +1,8 @@
{
diffusemap textures/editor/multisource.tga
{
map $diffuse
alphaFunc GE128
}
}

View File

@ -0,0 +1,8 @@
{
diffusemap textures/editor/point_message.tga
{
map $diffuse
alphaFunc GE128
}
}

View File

@ -0,0 +1,8 @@
{
diffusemap textures/editor/trigger_auto.tga
{
map $diffuse
alphaFunc GE128
}
}

View File

@ -0,0 +1,8 @@
{
diffusemap textures/editor/trigger_changetarget.tga
{
map $diffuse
alphaFunc GE128
}
}

View File

@ -0,0 +1,8 @@
{
diffusemap textures/editor/trigger_relay.tga
{
map $diffuse
alphaFunc GE128
}
}

View File

@ -186,7 +186,7 @@ func_plat::MoverFinishesMoving(void)
{
/* cancel out any moving sfx */
if (m_strSndMove) {
StopSound(CHAN_VOICE, 0, true);
StopSound(CHAN_VOICE, true);
}
if (m_strSndStop) {

View File

@ -451,7 +451,7 @@ func_tracktrain::Restore(string strKey, string strValue)
m_iInputLevel = ReadInt(strValue);
break;
case "m_timerAngled":
m_timerAngled = ReadEntity(strValue);
m_timerAngled = (NSTimer)ReadEntity(strValue);
break;
case "m_flTrainLength":
m_flTrainLength = ReadFloat(strValue);

View File

@ -149,6 +149,8 @@ monstermaker::SpawnKey(string strKey, string strValue)
void
monstermaker::Respawn(void)
{
InitPointTrigger();
if (HasSpawnFlags(MMF_STARTON)) {
TurnOn();
} else {

View File

@ -286,6 +286,8 @@ multi_manager::Spawned(void)
void
multi_manager::Respawn(void)
{
InitPointTrigger();
m_iValue = FALSE;
/* Mark them inactive */

View File

@ -50,6 +50,8 @@ multisource::multisource(void)
void
multisource::Respawn(void)
{
InitPointTrigger();
m_iValue = FALSE;
}

View File

@ -209,6 +209,8 @@ path_corner::SpawnKey(string strKey, string strValue)
void
path_corner::Respawn(void)
{
InitPointTrigger();
#ifdef DEVELOPER
if (autocvar_dev_cornerspeed != 0) {
m_flSpeed = autocvar_dev_cornerspeed;

View File

@ -96,10 +96,10 @@ path_track::DebugDraw(void)
vector pos = GetOrigin();
pos[2] += 32;
R_BeginPolygon("textures/editor/path_track", 0, 0);
R_PolygonVertex(pos + v_right * 24 - v_up * 24, [1,1], [1,1,1], 1.0f);
R_PolygonVertex(pos - v_right * 24 - v_up * 24, [0,1], [1,1,1], 1.0f);
R_PolygonVertex(pos - v_right * 24 + v_up * 24, [0,0], [1,1,1], 1.0f);
R_PolygonVertex(pos + v_right * 24 + v_up * 24, [1,0], [1,1,1], 1.0f);
R_PolygonVertex(pos + v_right * 16 - v_up * 16, [1,1], [1,1,1], 1.0f);
R_PolygonVertex(pos - v_right * 16 - v_up * 16, [0,1], [1,1,1], 1.0f);
R_PolygonVertex(pos - v_right * 16 + v_up * 16, [0,0], [1,1,1], 1.0f);
R_PolygonVertex(pos + v_right * 16 + v_up * 16, [1,0], [1,1,1], 1.0f);
R_EndPolygon();
R_BeginPolygon("", 0, 0);

View File

@ -26,9 +26,10 @@ world. It'll enable mouth flapping and all sorts of other cool effects.
- "entity" : Name of the entity that'll speak the sentence.
- "sentence" : Name of sentence from titles.txt.
- "pitch" : Desired sound pitch. May be overridden in the titles.txt entry.
- "delay" : Delay before it'll be triggered? UNUSED RIGHT NOW.
- "delay" : Delay before it'll be triggered.
- "wait" : Delay before it can be triggered again? UNUSED RIGHT NOW.
- "listener" : The name of the entity we'll look at when speaking. Can be "player".
- "refire" : Additional time in seconds before the entity can be triggered again.
# INPUTS
- "BeginSentence" : Starts the sentence.
@ -54,6 +55,7 @@ public:
virtual void Trigger(entity, triggermode_t);
virtual void Input(entity, string, string);
nonvirtual void AllowRefire(void);
nonvirtual void SentenceEnded(void);
private:
@ -67,6 +69,7 @@ private:
string m_strListener;
string m_strOnBeginSentence;
string m_strOnEndSentence;
float m_flRefire;
};
void
@ -82,6 +85,7 @@ scripted_sentence::scripted_sentence(void)
m_strOnBeginSentence = __NULL__;
m_strOnEndSentence = __NULL__;
m_iSentenceID = 0i;
m_flRefire = 0.0f;
}
void
@ -111,6 +115,7 @@ scripted_sentence::Save(float handle)
SaveString(handle, "m_strOnBeginSentence", m_strOnBeginSentence);
SaveString(handle, "m_strOnEndSentence", m_strOnEndSentence);
SaveInt(handle, "m_iSentenceID", m_iSentenceID);
SaveFloat(handle, "m_flRefire", m_flRefire);
}
void
@ -147,6 +152,9 @@ scripted_sentence::Restore(string strKey, string strValue)
case "m_iSentenceID":
m_iSentenceID = ReadInt(strValue);
break;
case "m_flRefire":
m_flRefire = ReadFloat(strValue);
break;
default:
super::Restore(strKey, strValue);
}
@ -174,6 +182,12 @@ scripted_sentence::SpawnKey(string keyName, string setValue)
case "listener":
m_strListener = ReadString(setValue);
break;
case "delay":
m_flDelay = ReadFloat(setValue);
break;
case "refire":
m_flRefire = ReadFloat(setValue);
break;
case "OnBeginSentence":
m_strOnBeginSentence = ReadString(setValue);
break;
@ -197,10 +211,24 @@ scripted_sentence::Input(entity entityActivator, string inputName, string dataFi
}
}
void
scripted_sentence::AllowRefire(void)
{
m_iValue = 0;
}
void
scripted_sentence::SentenceEnded(void)
{
StopSound(CHAN_VOICE, true);
UseOutput(this, m_strOnEndSentence);
if (m_flRefire > 0.0f) {
ScheduleThink(AllowRefire, m_flRefire);
} else {
AllowRefire();
}
}
void
@ -209,6 +237,10 @@ scripted_sentence::Trigger(entity act, triggermode_t unused)
entity spe;
spe = find(world, ::targetname, m_strSpeaker);
if (m_iValue == 1) {
return;
}
if (!spe) {
/* time to look for a classname instead */
float closest = 9999999;
@ -239,13 +271,14 @@ scripted_sentence::Trigger(entity act, triggermode_t unused)
WriteInt(MSG_MULTICAST, m_iSentenceID);
msg_entity = npc;
multicast(npc.origin, MULTICAST_PVS);
npc.m_flNextSentence = time + m_flDuration;
npc.m_flNextSentence = time + m_flDuration + m_flRefire;
UseTargets(act, TRIG_TOGGLE, m_flDelay);
/* I/O */
/* Uncertain: Are we triggering the output on behalf of someone maybe? */
UseOutput(this, m_strOnBeginSentence);
ScheduleThink(SentenceEnded, m_flDuration);
m_iValue = 1;
if (m_strListener) {
if (m_strListener == "player") {

View File

@ -136,10 +136,10 @@ scripted_sequence::DebugDraw(void)
pos[2] += 32;
R_BeginPolygon("textures/editor/scripted_sequence", 0, 0);
R_PolygonVertex(pos + v_right * 24 - v_up * 24, [1,1], [1,1,1], 1.0f);
R_PolygonVertex(pos - v_right * 24 - v_up * 24, [0,1], [1,1,1], 1.0f);
R_PolygonVertex(pos - v_right * 24 + v_up * 24, [0,0], [1,1,1], 1.0f);
R_PolygonVertex(pos + v_right * 24 + v_up * 24, [1,0], [1,1,1], 1.0f);
R_PolygonVertex(pos + v_right * 16 - v_up * 16, [1,1], [1,1,1], 1.0f);
R_PolygonVertex(pos - v_right * 16 - v_up * 16, [0,1], [1,1,1], 1.0f);
R_PolygonVertex(pos - v_right * 16 + v_up * 16, [0,0], [1,1,1], 1.0f);
R_PolygonVertex(pos + v_right * 16 + v_up * 16, [1,0], [1,1,1], 1.0f);
R_EndPolygon();
R_BeginPolygon("", 0, 0);

View File

@ -78,6 +78,7 @@ public:
virtual void UseNormal(entity,triggermode_t);
virtual void UseLoop(entity, triggermode_t);
virtual void Input(entity, string, string);
virtual void DebugDraw(void);
#else
virtual void ReceiveEntity(float,float);
virtual float predraw(void);
@ -270,6 +271,17 @@ ambient_generic::Respawn(void)
}
}
void
ambient_generic::DebugDraw(void)
{
R_BeginPolygon("textures/editor/ambient_generic", 0, 0);
R_PolygonVertex(GetOrigin() + v_right * 16 - v_up * 16, [1,1], [1,1,1], 1.0f);
R_PolygonVertex(GetOrigin() - v_right * 16 - v_up * 16, [0,1], [1,1,1], 1.0f);
R_PolygonVertex(GetOrigin() - v_right * 16 + v_up * 16, [0,0], [1,1,1], 1.0f);
R_PolygonVertex(GetOrigin() + v_right * 16 + v_up * 16, [1,0], [1,1,1], 1.0f);
R_EndPolygon();
}
void
ambient_generic::UseNormal(entity act, triggermode_t state)
{

View File

@ -451,11 +451,14 @@ EntityDef_PrepareEntity(entity target, int id)
}
targetEnt.m_strModelEventCB = g_entDefTable[id].eventList; /* pass over the event listing */
/* now we rename the classname for better visibility,
but also because some classes need to know. */
targetEnt.classname = g_entDefTable[id].entClass;
targetEnt.Spawned();
targetEnt.Respawn();
/* now we rename the classname for better visibility */
targetEnt.classname = g_entDefTable[id].entClass;
g_lastSpawnData = "";
return targetEnt;
}

View File

@ -25,11 +25,13 @@ class NSPointTrigger:NSEntity
public:
void NSPointTrigger(void);
/* overrides */
virtual void Respawn(void);
virtual void DebugDraw(void);
/** Sets up a point entity trigger with no size. */
nonvirtual void InitPointTrigger(void);
virtual void DebugDraw(void);
#ifdef SERVER
private:
string m_strDebugTexture;

View File

@ -22,11 +22,17 @@ NSPointTrigger::NSPointTrigger(void)
#endif
}
void
NSPointTrigger::Respawn(void)
{
InitPointTrigger();
}
void
NSPointTrigger::InitPointTrigger(void)
{
SetSize(VEC_HULL_MIN, VEC_HULL_MAX);
SetSolid(SOLID_TRIGGER);
SetSolid(SOLID_NOT);
#ifdef SERVER
m_bEnabled = (m_bStartDisabled) ? false : true;

View File

@ -84,7 +84,7 @@ NSTrigger::CanBeTriggeredBy(entity testEnt)
void
NSTrigger::Trigger(entity act, triggermode_t state)
{
EntWarning("Triggered by %S with no consequence", act.classname);
EntWarning("%S triggered by %S with no consequence", targetname, act.classname);
}
void

View File

@ -114,6 +114,7 @@ VGUI3DView::Draw(void)
setproperty(VF_AFOV, 90);
setproperty(VF_ORIGIN, m_vec3DPos);
setproperty(VF_ANGLES, m_vec3DAngles);
setproperty(VF_DRAWWORLD, false);
tmpVGUI3DView1();
renderscene();
}