trigger_multiple - new spawnflag, 3 new keys

This commit is contained in:
Andrei Drexler 2003-09-16 23:25:32 +00:00
parent 9b945b11ed
commit b5bd3563cc
5 changed files with 59 additions and 19 deletions

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.189 2003/09/16 23:25:32 makro
// trigger_multiple - new spawnflag, 3 new keys
//
// Revision 1.188 2003/04/26 22:33:06 jbravo // Revision 1.188 2003/04/26 22:33:06 jbravo
// Wratted all calls to G_FreeEnt() to avoid crashing and provide debugging // Wratted all calls to G_FreeEnt() to avoid crashing and provide debugging
// //
@ -2471,6 +2474,8 @@ void Cmd_OpenDoor(gentity_t * ent)
if (ent->client->ps.stats[STAT_HEALTH] <= 0 || ent->client->ps.pm_type == PM_SPECTATOR) if (ent->client->ps.stats[STAT_HEALTH] <= 0 || ent->client->ps.pm_type == PM_SPECTATOR)
return; return;
//Makro - doesn't look right to me. Doing it one single time should be enough
/*
while ((door = findradius(door, ent->r.currentOrigin, 100)) != NULL) { while ((door = findradius(door, ent->r.currentOrigin, 100)) != NULL) {
if (Q_stricmp(door->classname, "func_door_rotating") == 0) { if (Q_stricmp(door->classname, "func_door_rotating") == 0) {
ent->client->openDoor = qtrue; ent->client->openDoor = qtrue;
@ -2480,6 +2485,9 @@ void Cmd_OpenDoor(gentity_t * ent)
ent->client->openDoorTime = level.time; ent->client->openDoorTime = level.time;
} }
} }
*/
ent->client->openDoor = qtrue;
ent->client->openDoorTime = level.time;
} }
/* Hawkins. Reaction weapon command */ /* Hawkins. Reaction weapon command */

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.147 2003/09/16 23:25:32 makro
// trigger_multiple - new spawnflag, 3 new keys
//
// Revision 1.146 2003/09/08 19:19:19 makro // Revision 1.146 2003/09/08 19:19:19 makro
// New code for respawning entities in TP // New code for respawning entities in TP
// //
@ -1061,6 +1064,7 @@ void SanitizeString(char *in, char *out);
//Makro - added //Makro - added
gentity_t *G_Find2(gentity_t * from, int fieldofs, const char *match, int fieldofs2, const char *match2); gentity_t *G_Find2(gentity_t * from, int fieldofs, const char *match, int fieldofs2, const char *match2);
gentity_t *G_PickTarget(char *targetname); gentity_t *G_PickTarget(char *targetname);
void G_UseEntities(gentity_t * ent, char *target, gentity_t * activator);
void G_UseTargets(gentity_t * ent, gentity_t * activator); void G_UseTargets(gentity_t * ent, gentity_t * activator);
void G_SetMovedir(vec3_t angles, vec3_t movedir); void G_SetMovedir(vec3_t angles, vec3_t movedir);

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.66 2003/09/16 23:25:32 makro
// trigger_multiple - new spawnflag, 3 new keys
//
// Revision 1.65 2003/09/08 21:43:36 makro // Revision 1.65 2003/09/08 21:43:36 makro
// Doors don't reset by default in TP // Doors don't reset by default in TP
// //
@ -167,8 +170,6 @@
#include "g_local.h" #include "g_local.h"
void InitRotator(gentity_t * ent); void InitRotator(gentity_t * ent);
//Makro - added
void G_UseEntities(gentity_t * ent, char *target, gentity_t * activator);
/* /*
=============================================================================== ===============================================================================

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.29 2003/09/16 23:25:32 makro
// trigger_multiple - new spawnflag, 3 new keys
//
// Revision 1.28 2003/09/08 19:19:20 makro // Revision 1.28 2003/09/08 19:19:20 makro
// New code for respawning entities in TP // New code for respawning entities in TP
// //
@ -93,6 +96,18 @@ void InitTrigger(gentity_t * self)
self->r.svFlags = SVF_NOCLIENT; self->r.svFlags = SVF_NOCLIENT;
} }
/*QUAKED trigger_multiple (.5 .5 .5) ? DOOR
"wait" : Seconds between triggerings, 0.5 default, -1 = one time only.
"random" wait variance, default is 0
Variable sized repeatable trigger. Must be targeted at one or more entities.
so, the basic time between firing is a random time between
(wait - random) and (wait + random)
*/
#define SF_TRIGGER_MULTIPLE_RED 1
#define SF_TRIGGER_MULTIPLE_BLUE 2
#define SF_TRIGGER_MULTIPLE_DOOR 4
// the wait time has passed, so set back up for another activation // the wait time has passed, so set back up for another activation
void multi_wait(gentity_t * ent) void multi_wait(gentity_t * ent)
{ {
@ -110,21 +125,30 @@ void multi_trigger(gentity_t * ent, gentity_t * activator)
} }
//Makro - inactive trigger ? //Makro - inactive trigger ?
if (ent->inactive) { if (ent->inactive) {
if (ent->soundInactive)
G_AddEvent(ent, EV_GENERAL_SOUND, ent->soundInactive);
if (ent->targetInactive)
G_UseEntities(ent, ent->targetInactive, activator);
return; return;
} }
if (ent->spawnflags & SF_TRIGGER_MULTIPLE_DOOR)
if (!activator || !activator->client || !activator->client->openDoor)
return;
//Makro - added check; Q3 crashed in archives when playing //Makro - added check; Q3 crashed in archives when playing
//with .dll's and shooting one of the barrels //with .dll's and shooting one of the barrels
if (activator != NULL) { if (activator != NULL) {
if (activator->client) { if (activator->client) {
if ((ent->spawnflags & 1) && activator->client->sess.sessionTeam != TEAM_RED) { if ((ent->spawnflags & SF_TRIGGER_MULTIPLE_RED) && activator->client->sess.sessionTeam != TEAM_RED) {
return; return;
} }
if ((ent->spawnflags & 2) && activator->client->sess.sessionTeam != TEAM_BLUE) { if ((ent->spawnflags & SF_TRIGGER_MULTIPLE_BLUE) && activator->client->sess.sessionTeam != TEAM_BLUE) {
return; return;
} }
} }
} }
if (ent->sound1to2)
G_AddEvent(ent, EV_GENERAL_SOUND, ent->sound1to2);
G_UseTargets(ent, ent->activator); G_UseTargets(ent, ent->activator);
if (ent->wait > 0) { if (ent->wait > 0) {
@ -165,15 +189,10 @@ void Reset_Multi(gentity_t *ent)
ent->nextthink = 0; ent->nextthink = 0;
} }
/*QUAKED trigger_multiple (.5 .5 .5) ?
"wait" : Seconds between triggerings, 0.5 default, -1 = one time only.
"random" wait variance, default is 0
Variable sized repeatable trigger. Must be targeted at one or more entities.
so, the basic time between firing is a random time between
(wait - random) and (wait + random)
*/
void SP_trigger_multiple(gentity_t * ent) void SP_trigger_multiple(gentity_t * ent)
{ {
char *s;
G_SpawnFloat("wait", "0.5", &ent->wait); G_SpawnFloat("wait", "0.5", &ent->wait);
G_SpawnFloat("random", "0", &ent->random); G_SpawnFloat("random", "0", &ent->random);
@ -181,6 +200,14 @@ void SP_trigger_multiple(gentity_t * ent)
ent->random = ent->wait - FRAMETIME; ent->random = ent->wait - FRAMETIME;
G_Printf("trigger_multiple has random >= wait\n"); G_Printf("trigger_multiple has random >= wait\n");
} }
//Makro - added
if (G_SpawnString("soundInactive", "", &s))
ent->soundInactive = G_SoundIndex(s);
if (G_SpawnString("noise", "", &s))
ent->sound1to2 = G_SoundIndex(s);
else if (G_SpawnString("sound", "", &s))
ent->sound1to2 = G_SoundIndex(s);
ent->touch = Touch_Multi; ent->touch = Touch_Multi;
ent->use = Use_Multi; ent->use = Use_Multi;

View file

@ -6,13 +6,13 @@
--------------------Configuration: game - Win32 Release-------------------- --------------------Configuration: game - Win32 Release--------------------
</h3> </h3>
<h3>Command Lines</h3> <h3>Command Lines</h3>
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP19D.tmp" with contents Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP53.tmp" with contents
[ [
/nologo /G6 /ML /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR"c:\reactionoutput/" /Fp"c:\reactionoutput/game.pch" /YX /Fo"c:\reactionoutput/" /Fd"c:\reactionoutput/" /FD /c /nologo /G6 /ML /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR"c:\reactionoutput/" /Fp"c:\reactionoutput/game.pch" /YX /Fo"c:\reactionoutput/" /Fd"c:\reactionoutput/" /FD /c
"C:\Games\Quake3\rq3source\reaction\game\bg_pmove.c" "C:\Games\Quake3\rq3source\reaction\game\g_trigger.c"
] ]
Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP19D.tmp" Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP53.tmp"
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP19E.tmp" with contents Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP54.tmp" with contents
[ [
kernel32.lib user32.lib winmm.lib /nologo /base:"0x20000000" /subsystem:windows /dll /incremental:no /pdb:"c:\reactionoutput/qagamex86.pdb" /map:"c:\reactionoutput/qagamex86.map" /machine:I386 /def:".\game.def" /out:"..\Release/qagamex86.dll" /implib:"c:\reactionoutput/qagamex86.lib" kernel32.lib user32.lib winmm.lib /nologo /base:"0x20000000" /subsystem:windows /dll /incremental:no /pdb:"c:\reactionoutput/qagamex86.pdb" /map:"c:\reactionoutput/qagamex86.map" /machine:I386 /def:".\game.def" /out:"..\Release/qagamex86.dll" /implib:"c:\reactionoutput/qagamex86.lib"
\reactionoutput\ai_chat.obj \reactionoutput\ai_chat.obj
@ -56,13 +56,13 @@ kernel32.lib user32.lib winmm.lib /nologo /base:"0x20000000" /subsystem:windows
\reactionoutput\zcam.obj \reactionoutput\zcam.obj
\reactionoutput\zcam_target.obj \reactionoutput\zcam_target.obj
] ]
Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP19E.tmp" Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP54.tmp"
<h3>Output Window</h3> <h3>Output Window</h3>
Compiling... Compiling...
bg_pmove.c g_trigger.c
Linking... Linking...
Creating library c:\reactionoutput/qagamex86.lib and object c:\reactionoutput/qagamex86.exp Creating library c:\reactionoutput/qagamex86.lib and object c:\reactionoutput/qagamex86.exp
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP1A2.tmp" with contents Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP58.tmp" with contents
[ [
/nologo /o"c:\reactionoutput/game.bsc" /nologo /o"c:\reactionoutput/game.bsc"
\reactionoutput\ai_chat.sbr \reactionoutput\ai_chat.sbr
@ -105,7 +105,7 @@ Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP1A2.tmp" with conte
\reactionoutput\rxn_game.sbr \reactionoutput\rxn_game.sbr
\reactionoutput\zcam.sbr \reactionoutput\zcam.sbr
\reactionoutput\zcam_target.sbr] \reactionoutput\zcam_target.sbr]
Creating command line "bscmake.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP1A2.tmp" Creating command line "bscmake.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP58.tmp"
Creating browse info file... Creating browse info file...
<h3>Output Window</h3> <h3>Output Window</h3>