From 74da0008b94e970df9fc25299cc46e20b6931c07 Mon Sep 17 00:00:00 2001 From: Andrei Drexler Date: Wed, 29 May 2002 19:49:21 +0000 Subject: [PATCH] Option to disable spectator triggers for doors --- reaction/game/g_mover.c | 104 +++++++++++++++++++++------------------- reaction/game/game.plg | 12 ++--- 2 files changed, 60 insertions(+), 56 deletions(-) diff --git a/reaction/game/g_mover.c b/reaction/game/g_mover.c index 6ef7d4e8..dc9f3568 100644 --- a/reaction/game/g_mover.c +++ b/reaction/game/g_mover.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.42 2002/05/29 19:49:21 makro +// Option to disable spectator triggers for doors +// // Revision 1.41 2002/05/29 13:49:25 makro // Elevators/doors // @@ -1345,33 +1348,35 @@ void Think_SpawnNewDoorTrigger( gentity_t *ent ) { trap_LinkEntity (other); } - // NiceAss: This trigger will be for spectators - // NiceAss: Undo the stretched box size - // expand - maxs[best] -= 60; - mins[best] += 60; - // NiceAss: AQ2 Style. Above is Q3 style. - if (best != 0) { - maxs[0] -= 60; - mins[0] += 60; + //Makro - some doors shouldn't have triggers for spectators + if (!ent->unbreakable) { + // NiceAss: This trigger will be for spectators + // NiceAss: Undo the stretched box size + // expand + maxs[best] -= 60; + mins[best] += 60; + // NiceAss: AQ2 Style. Above is Q3 style. + if (best != 0) { + maxs[0] -= 60; + mins[0] += 60; + } + if (best != 1) { + maxs[1] -= 60; + mins[1] += 60; + } + + + other = G_Spawn (); + other->classname = "door_trigger_spectator"; + VectorCopy (mins, other->r.mins); + VectorCopy (maxs, other->r.maxs); + other->parent = ent; + other->r.contents = CONTENTS_TRIGGER; + other->touch = Touch_DoorTriggerSpectator; + // remember the thinnest axis + other->count = best; + trap_LinkEntity (other); } - if (best != 1) { - maxs[1] -= 60; - mins[1] += 60; - } - - - other = G_Spawn (); - other->classname = "door_trigger_spectator"; - VectorCopy (mins, other->r.mins); - VectorCopy (maxs, other->r.maxs); - other->parent = ent; - other->r.contents = CONTENTS_TRIGGER; - other->touch = Touch_DoorTriggerSpectator; - // remember the thinnest axis - other->count = best; - trap_LinkEntity (other); - MatchTeam( ent, ent->moverState, level.time ); } @@ -1504,25 +1509,21 @@ void SP_func_door (gentity_t *ent) { InitMover( ent ); - ent->nextthink = level.time + FRAMETIME; - if ( ! (ent->flags & FL_TEAMSLAVE ) ) { int health; - int makeTrigger = 1; + int noSpecs = 0; G_SpawnInt( "health", "0", &health ); if ( health ) { ent->takedamage = qtrue; } - if ( ent->targetname || health ) { - //Makro - some doors don't need spectator triggers - G_SpawnInt( "nospectators", "0", &makeTrigger ); - } - if (makeTrigger) { - ent->think = Think_SpawnNewDoorTrigger; - } else { - ent->think = Think_MatchTeam; - } + + //Makro - some doors don't need spectator triggers + G_SpawnInt( "nospectators", "0", &noSpecs ); + //hijacking unbreakable field + ent->unbreakable = noSpecs; + ent->think = Think_SpawnNewDoorTrigger; + ent->nextthink = level.time + FRAMETIME; } //Elder: open areaportals for start_open doors @@ -1654,26 +1655,29 @@ void SP_func_door_rotating ( gentity_t *ent ) { InitRotator( ent ); - ent->nextthink = level.time + FRAMETIME; - if ( ! (ent->flags & FL_TEAMSLAVE ) ) { int health; - int makeTrigger = 1; + int noSpecs = 0; G_SpawnInt( "health", "0", &health ); if ( health ) { ent->takedamage = qtrue; } - if ( ent->targetname || health ) { - //Makro - some doors don't need spectator triggers - G_SpawnInt( "nospectators", "0", &makeTrigger ); - } - if (makeTrigger) { - ent->think = Think_SpawnNewDoorTrigger; - } else { - ent->think = Think_MatchTeam; - } + + //Makro - some doors don't need spectator triggers + G_SpawnInt( "nospectators", "0", &noSpecs ); + //hijacking unbreakable field + ent->unbreakable = noSpecs; + ent->think = Think_SpawnNewDoorTrigger; + ent->nextthink = level.time + FRAMETIME; } + + //Makro - copied from func_door + //Elder: open areaportals for start_open doors + if ( (ent->spawnflags & 1) == 1 && (ent->teammaster == ent || !ent->teammaster) ) { + trap_AdjustAreaPortalState( ent, qtrue ); + } + } /* diff --git a/reaction/game/game.plg b/reaction/game/game.plg index bf1a57d0..8bbb0a70 100644 --- a/reaction/game/game.plg +++ b/reaction/game/game.plg @@ -6,13 +6,13 @@ --------------------Configuration: game - Win32 Release--------------------

Command Lines

-Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP81.tmp" with contents +Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPB1.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 -"C:\Games\Quake3\rq3source\reaction\game\g_misc.c" +"C:\Games\Quake3\rq3source\reaction\game\g_mover.c" ] -Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP81.tmp" -Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP82.tmp" with contents +Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPB1.tmp" +Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPB2.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" \reactionoutput\ai_chat.obj @@ -55,10 +55,10 @@ kernel32.lib user32.lib winmm.lib /nologo /base:"0x20000000" /subsystem:windows \reactionoutput\zcam.obj \reactionoutput\zcam_target.obj ] -Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP82.tmp" +Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPB2.tmp"

Output Window

Compiling... -g_misc.c +g_mover.c Linking... Creating library c:\reactionoutput/qagamex86.lib and object c:\reactionoutput/qagamex86.exp