From 8045f70339e21310b2c8ea91433f30f7d710da7e Mon Sep 17 00:00:00 2001 From: Andrei Drexler Date: Sun, 7 Sep 2003 20:02:51 +0000 Subject: [PATCH] no message --- reaction/game/g_local.h | 5 +- reaction/game/g_misc.c | 26 ++++++++--- reaction/game/g_mover.c | 100 +++++++++++++++++++++++++++++++--------- reaction/game/g_spawn.c | 4 ++ reaction/game/g_utils.c | 20 +++++--- reaction/game/game.plg | 16 +++---- 6 files changed, 125 insertions(+), 46 deletions(-) diff --git a/reaction/game/g_local.h b/reaction/game/g_local.h index fd43a6c7..a1d4c1f4 100644 --- a/reaction/game/g_local.h +++ b/reaction/game/g_local.h @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.145 2003/09/07 20:02:51 makro +// no message +// // Revision 1.144 2003/08/24 22:45:17 makro // Rotating func_trains // @@ -552,7 +555,7 @@ struct gentity_s { //Blaze: Holds the target set by a button char *pathtarget; //Makro - added - char *activatename; + char *activatename, *targetInactive; int inactive; }; diff --git a/reaction/game/g_misc.c b/reaction/game/g_misc.c index 7f21309b..6b4384a6 100644 --- a/reaction/game/g_misc.c +++ b/reaction/game/g_misc.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.75 2003/09/07 20:02:51 makro +// no message +// // Revision 1.74 2003/08/31 14:48:33 jbravo // Code not compiling under linux fixed and a warning silenced. // @@ -589,16 +592,11 @@ void SP_misc_portal_camera(gentity_t * ent) } //Makro - sky portals -void SP_misc_sky_portal(gentity_t * ent) +void Think_SetupSkyPortal(gentity_t *ent) { char info[MAX_INFO_STRING]; trap_GetConfigstring(CS_SKYPORTAL, info, sizeof(info)); - ent->r.svFlags |= SVF_PORTAL; - VectorClear(ent->r.mins); - VectorClear(ent->r.maxs); - trap_RQ3LinkEntity(ent, __LINE__, __FILE__); - if (!info[0]) { gentity_t *skyportal = G_Find(NULL, FOFS(targetname), ent->target); @@ -629,6 +627,19 @@ void SP_misc_sky_portal(gentity_t * ent) } + ent->nextthink = 0; + ent->think = 0; +} + +void SP_misc_sky_portal(gentity_t * ent) +{ + ent->r.svFlags |= SVF_PORTAL; + VectorClear(ent->r.mins); + VectorClear(ent->r.maxs); + ent->think = Think_SetupSkyPortal; + ent->nextthink = level.time + FRAMETIME; + + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); } /* @@ -1162,7 +1173,8 @@ void G_CreatePressure(vec3_t origin, vec3_t normal, gentity_t * ent) tent->s.frame = ent->bounce; // 1 = air, 2 = flame, 0 = steam tent->s.powerups = ent->mass; // speed of pressure - tent->s.constantLight = ent->tension; // 200 default. Life of steam + //Makro - changed from constantLight to generic1 + tent->s.generic1 = ent->tension; // 200 default. Life of steam } /* diff --git a/reaction/game/g_mover.c b/reaction/game/g_mover.c index b7d0d2d0..29a66b95 100644 --- a/reaction/game/g_mover.c +++ b/reaction/game/g_mover.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.63 2003/09/07 20:02:51 makro +// no message +// // Revision 1.62 2003/08/25 20:22:58 makro // Fixed a bug in old baseq3 func_train code // @@ -158,6 +161,8 @@ #include "g_local.h" void InitRotator(gentity_t * ent); +//Makro - added +void G_UseEntities(gentity_t * ent, char *target, gentity_t * activator); /* =============================================================================== @@ -863,38 +868,66 @@ void Reached_BinaryMover(gentity_t * ent) } } + +/* +================ +AdjustDoorDir + +Checks the opening direction and reverses it if necessary +(used for doors that open away from the player) + +Added by Makro +================ +*/ +void AdjustDoorDir(gentity_t *ent, gentity_t *activator) +{ + float angle, ld, lp; + vec3_t door, player, cross; + if (!ent || !activator || !activator->client) + return; + if (stricmp(ent->classname, "func_door_rotating")) + return; + if (ent->moverState != ROTATOR_POS1) + return; + + VectorAdd(ent->r.mins, ent->r.maxs, door); + VectorScale(door, 0.5f, door); + VectorSubtract(activator->r.currentOrigin, door, player); + VectorSubtract(ent->r.currentOrigin, door, door); + + + door[2] = player[2] = 0; + + CrossProduct(door, player, cross); + + if ( !(ld = VectorLength(door)) || !(lp = VectorLength(player)) ) + return; + angle = acos(DotProduct(door, player) / (ld * lp)); + + if (cross[2] * ent->distance > 0) + G_Printf("Door: no need to reverse\n"); + else + G_Printf("Door: need to reverse\n"); + +} + /* ================ Use_BinaryMover ================ */ + void Use_BinaryMover(gentity_t * ent, gentity_t * other, gentity_t * activator) { int total; int partial; + vec3_t dist; + float d; - /* Makro - trains have a custom use function now - //Blaze: Holds the train entity - gentity_t *temp; - if ( ent->pathtarget != NULL ) - { - //G_Printf("The pathtarget is %s\n",ent->pathtarget); - temp = NULL; - temp = G_Find(temp,FOFS(targetname),ent->target); - if ( !temp ) - { - G_Printf("Could not find the train %s that button points to\n", ent->target); - } - else - { - temp->nextTrain = G_Find(NULL, FOFS(targetname),ent->pathtarget); - //Blaze - //G_Printf("^2pathtarget: %s target: %s targetname: %s\n",ent->pathtarget, ent->target, ent->targetname); - //G_Printf("^2%s\n", ent->nextTrain->targetname); - } - } - */ + //Makro - temp!!! + //AdjustDoorDir(ent, activator); + // only the master should be used if (ent->flags & FL_TEAMSLAVE) { Use_BinaryMover(ent->teammaster, other, activator); @@ -907,9 +940,21 @@ void Use_BinaryMover(gentity_t * ent, gentity_t * other, gentity_t * activator) if (ent->soundInactive) { G_AddEvent(ent, EV_GENERAL_SOUND, ent->soundInactive); } + if (ent->targetInactive) + G_UseEntities(ent, ent->targetInactive, activator); return; } + if (activator) + { + //Makro - check if we're too far away + VectorSubtract(ent->r.currentOrigin, activator->r.currentOrigin, dist); + d = VectorLength(dist); + //not for doors with health + if (!ent->takedamage && ent->mass && (d > ent->mass) ) + return; + } + ent->activator = activator; if (ent->moverState == MOVER_POS1) { @@ -1470,7 +1515,8 @@ void SP_func_door(gentity_t * ent) ent->soundPos2 = G_SoundIndex(sSndStop); // NiceAss: Possible fix for ghost door problem. Maybe laggy - ent->r.svFlags |= SVF_BROADCAST; + //Makro - removed + //ent->r.svFlags |= SVF_BROADCAST; //ent->sound1to2 = ent->sound2to1 = G_SoundIndex("sound/movers/doors/dr1_strt.wav"); //ent->soundPos1 = ent->soundPos2 = G_SoundIndex("sound/movers/doors/dr1_end.wav"); @@ -1489,6 +1535,9 @@ void SP_func_door(gentity_t * ent) G_Printf("func_door is an auto-open\n"); */ + //Makro - added + G_SpawnInt("reach", "0", &ent->mass); + // default speed of 400 if (!ent->speed) ent->speed = 400; @@ -1601,10 +1650,15 @@ void SP_func_door_rotating(gentity_t * ent) //ent->soundPos1 = ent->soundPos2 = G_SoundIndex("sound/movers/doors/dr1_end.wav"); // NiceAss: Possible fix for ghost door problem. Maybe laggy - ent->r.svFlags |= SVF_BROADCAST; + //Makro - removed + //ent->r.svFlags |= SVF_BROADCAST; + //ent->r.svFlags |= SVF_BROADCAST; ent->blocked = Blocked_Door; + //Makro - added + G_SpawnInt("reach", "100", &ent->mass); + // default speed of 120 if (!ent->speed) ent->speed = 120; diff --git a/reaction/game/g_spawn.c b/reaction/game/g_spawn.c index dc226963..83cb200f 100644 --- a/reaction/game/g_spawn.c +++ b/reaction/game/g_spawn.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.46 2003/09/07 20:02:51 makro +// no message +// // Revision 1.45 2003/08/10 20:13:26 makro // no message // @@ -233,6 +236,7 @@ field_t fields[] = { {"targetShaderName", FOFS(targetShaderName), F_LSTRING}, {"targetShaderNewName", FOFS(targetShaderNewName), F_LSTRING}, {"distance", FOFS(distance), F_FLOAT}, // VALKYRIE: for rotating doors + {"targetinactive", FOFS(targetInactive), F_LSTRING}, // Makro - target to be fired when inactive {"pathtarget", FOFS(pathtarget), F_LSTRING}, // Makro - for func_trains {"inactive", FOFS(inactive), F_INT}, // Makro - added {"activatename", FOFS(activatename), F_LSTRING}, diff --git a/reaction/game/g_utils.c b/reaction/game/g_utils.c index 2613d297..4b1d37cd 100644 --- a/reaction/game/g_utils.c +++ b/reaction/game/g_utils.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.22 2003/09/07 20:02:51 makro +// no message +// // Revision 1.21 2003/04/26 22:33:07 jbravo // Wratted all calls to G_FreeEnt() to avoid crashing and provide debugging // @@ -284,11 +287,12 @@ match (string)self.target and call their .use function ============================== */ -void G_UseTargets(gentity_t * ent, gentity_t * activator) +//Makro - added +void G_UseEntities(gentity_t * ent, char *target, gentity_t * activator) { gentity_t *t; - if (!ent) { + if (!ent || !target) { return; } @@ -299,12 +303,8 @@ void G_UseTargets(gentity_t * ent, gentity_t * activator) trap_SetConfigstring(CS_SHADERSTATE, BuildShaderStateConfig()); } - if (!ent->target) { - return; - } - t = NULL; - while ((t = G_Find(t, FOFS(targetname), ent->target)) != NULL) { + while ((t = G_Find(t, FOFS(targetname), target)) != NULL) { if (t == ent) { G_Printf("WARNING: Entity used itself.\n"); } else { @@ -319,6 +319,12 @@ void G_UseTargets(gentity_t * ent, gentity_t * activator) } } +void G_UseTargets(gentity_t * ent, gentity_t * activator) +{ + //Makro - moved the code to the function above + G_UseEntities(ent, ent->target, activator); +} + /* =============== diff --git a/reaction/game/game.plg b/reaction/game/game.plg index b1029346..5cd2fc24 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\RSP15F.tmp" with contents +Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP312.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_mover.c" +"C:\Games\Quake3\rq3source\reaction\game\g_misc.c" ] -Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP15F.tmp" -Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP160.tmp" with contents +Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP312.tmp" +Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP313.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 @@ -56,13 +56,13 @@ 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\RSP160.tmp" +Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP313.tmp"

Output Window

Compiling... -g_mover.c +g_misc.c Linking... Creating library c:\reactionoutput/qagamex86.lib and object c:\reactionoutput/qagamex86.exp -Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP164.tmp" with contents +Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP317.tmp" with contents [ /nologo /o"c:\reactionoutput/game.bsc" \reactionoutput\ai_chat.sbr @@ -105,7 +105,7 @@ Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP164.tmp" with conte \reactionoutput\rxn_game.sbr \reactionoutput\zcam.sbr \reactionoutput\zcam_target.sbr] -Creating command line "bscmake.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP164.tmp" +Creating command line "bscmake.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP317.tmp" Creating browse info file...

Output Window