Lens flares. Opendoor trigger_multiple fixes

This commit is contained in:
Andrei Drexler 2003-09-18 00:05:06 +00:00
parent 1f5ee75ddc
commit 0d5f00a159
6 changed files with 129 additions and 32 deletions

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.78 2003/09/18 00:05:05 makro
// Lens flares. Opendoor trigger_multiple fixes
//
// Revision 1.77 2003/09/10 22:46:05 makro // Revision 1.77 2003/09/10 22:46:05 makro
// Cooler breath puffs. Locked r_fastSky on maps with global fog. // Cooler breath puffs. Locked r_fastSky on maps with global fog.
// Some other things I can't remember. // Some other things I can't remember.
@ -415,6 +418,68 @@ void G_RunDlight(gentity_t * ent)
*/ */
/*QUAKED misc_lens_flare (0 1 0) (-8 -8 -8) (8 8 8) ?
*/
void Think_Flare_Target(gentity_t *ent)
{
char info[MAX_INFO_STRING]={0};
vec3_t dir;
ent->think = 0;
ent->nextthink = 0;
if (ent->target) {
ent->target_ent = G_PickTarget(ent->target);
if (!ent->target_ent) {
G_Printf(S_COLOR_YELLOW"Warning: misc_lens_flare with bad target at %s\n", vtos(ent->s.origin));
} else {
VectorSubtract(ent->s.origin, ent->target_ent->s.origin, dir);
}
} else {
VectorCopy(ent->s.origin2, dir);
}
trap_GetConfigstring(CS_SKYPORTAL, info, sizeof(info));
VectorNormalize(dir);
Info_SetValueForKey(info, "ln", va("%d", ent->count));
Info_SetValueForKey(info, "lx", va("%f", dir[0]));
Info_SetValueForKey(info, "ly", va("%f", dir[1]));
Info_SetValueForKey(info, "lz", va("%f", dir[2]));
Info_SetValueForKey(info, "lamin", va("%f", ent->health/1000.0f));
Info_SetValueForKey(info, "lamax", va("%f", ent->health_saved/1000.0f));
Info_SetValueForKey(info, "lsmin", va("%d", ent->damage));
Info_SetValueForKey(info, "lsmax", va("%d", ent->damage_radius));
trap_SetConfigstring(CS_SKYPORTAL, info);
G_FreeEntity(ent, __LINE__, __FILE__);
}
void SP_misc_lens_flare(gentity_t *ent)
{
float f;
if (ent->count <= 0) {
G_Printf(S_COLOR_YELLOW"Warning: misc_lens_flare with count <=0 at %s\n", vtos(ent->s.origin));
ent->count = 4;
}
G_SpawnInt("minsize", "16", &ent->damage);
G_SpawnInt("maxsize", "128", &ent->damage_radius);
G_SpawnFloat("alphamin", "0.5", &f);
ent->health = f * 1000;
G_SpawnFloat("alphamax", "1", &f);
ent->health_saved = f * 1000;
if (!ent->target) {
if (!G_SpawnVector("direction", "0 0 1", ent->s.origin2)) {
AngleVectors(ent->s.angles, ent->s.origin2, NULL, NULL);
}
}
ent->think = Think_Flare_Target;
ent->nextthink = level.time + FRAMETIME;
}
/*QUAKED func_shadow (0 1 0) (-8 -8 -8) (8 8 8) ? /*QUAKED func_shadow (0 1 0) (-8 -8 -8) (8 8 8) ?
*/ */
@ -644,7 +709,7 @@ void SP_misc_portal_camera(gentity_t * ent)
//Makro - sky portals //Makro - sky portals
void Think_SetupSkyPortal(gentity_t *ent) void Think_SetupSkyPortal(gentity_t *ent)
{ {
char info[MAX_INFO_STRING]; char info[MAX_INFO_STRING]={0};
trap_GetConfigstring(CS_SKYPORTAL, info, sizeof(info)); trap_GetConfigstring(CS_SKYPORTAL, info, sizeof(info));
if (!info[0]) { if (!info[0]) {
@ -653,7 +718,6 @@ void Think_SetupSkyPortal(gentity_t *ent)
//G_Printf("^1 SKY PORTAL !!!\n"); //G_Printf("^1 SKY PORTAL !!!\n");
if (skyportal) { if (skyportal) {
memset(info, 0, sizeof(info));
Info_SetValueForKey(info, "x", va("%f", skyportal->s.origin[0])); Info_SetValueForKey(info, "x", va("%f", skyportal->s.origin[0]));
Info_SetValueForKey(info, "y", va("%f", skyportal->s.origin[1])); Info_SetValueForKey(info, "y", va("%f", skyportal->s.origin[1]));
Info_SetValueForKey(info, "z", va("%f", skyportal->s.origin[2])); Info_SetValueForKey(info, "z", va("%f", skyportal->s.origin[2]));
@ -666,7 +730,6 @@ void Think_SetupSkyPortal(gentity_t *ent)
//ent->r.svFlags |= SVF_BROADCAST; //ent->r.svFlags |= SVF_BROADCAST;
} else { } else {
G_Printf(S_COLOR_YELLOW "WARNING: misc_sky_portal entity with bad target at %s\n", vtos(ent->s.origin)); G_Printf(S_COLOR_YELLOW "WARNING: misc_sky_portal entity with bad target at %s\n", vtos(ent->s.origin));
trap_SetConfigstring(CS_SKYPORTAL, "");
G_FreeEntity(ent, __LINE__, __FILE__); G_FreeEntity(ent, __LINE__, __FILE__);
} }
} else { } else {
@ -676,7 +739,6 @@ void Think_SetupSkyPortal(gentity_t *ent)
ent->r.ownerNum = atoi(Info_ValueForKey(info, "n")); ent->r.ownerNum = atoi(Info_ValueForKey(info, "n"));
} }
ent->nextthink = 0; ent->nextthink = 0;
ent->think = 0; ent->think = 0;
} }

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.67 2003/09/18 00:05:05 makro
// Lens flares. Opendoor trigger_multiple fixes
//
// Revision 1.66 2003/09/16 23:25:32 makro // Revision 1.66 2003/09/16 23:25:32 makro
// trigger_multiple - new spawnflag, 3 new keys // trigger_multiple - new spawnflag, 3 new keys
// //
@ -1564,7 +1567,7 @@ void SP_func_door(gentity_t * ent)
*/ */
//Makro - added //Makro - added
G_SpawnInt("reach", "0", &ent->mass); G_SpawnInt("reach", "100", &ent->mass);
// default speed of 400 // default speed of 400
if (!ent->speed) if (!ent->speed)

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.49 2003/09/18 00:05:05 makro
// Lens flares. Opendoor trigger_multiple fixes
//
// Revision 1.48 2003/09/10 22:46:05 makro // Revision 1.48 2003/09/10 22:46:05 makro
// Cooler breath puffs. Locked r_fastSky on maps with global fog. // Cooler breath puffs. Locked r_fastSky on maps with global fog.
// Some other things I can't remember. // Some other things I can't remember.
@ -301,6 +304,7 @@ void SP_target_push(gentity_t * ent);
void SP_light(gentity_t * self); void SP_light(gentity_t * self);
void SP_dlight(gentity_t * self); // Elder: dlight entity void SP_dlight(gentity_t * self); // Elder: dlight entity
void SP_misc_lens_flare(gentity_t *ent); //Makro - lens flare
void SP_func_shadow(gentity_t *ent); //Makro - fake shadow void SP_func_shadow(gentity_t *ent); //Makro - fake shadow
void SP_info_null(gentity_t * self); void SP_info_null(gentity_t * self);
void SP_info_notnull(gentity_t * self); void SP_info_notnull(gentity_t * self);
@ -392,6 +396,7 @@ spawn_t spawns[] = {
{"func_dlite", SP_dlight}, // Elder: dlight entity {"func_dlite", SP_dlight}, // Elder: dlight entity
{"light_d", SP_dlight}, //Makro - for compatibility with older maps {"light_d", SP_dlight}, //Makro - for compatibility with older maps
{"func_shadow", SP_func_shadow}, //Makro - fake shadow {"func_shadow", SP_func_shadow}, //Makro - fake shadow
{"misc_lens_flare", SP_misc_lens_flare}, //Makro - lens flare
{"path_corner", SP_path_corner}, {"path_corner", SP_path_corner},
{"misc_teleporter_dest", SP_misc_teleporter_dest}, {"misc_teleporter_dest", SP_misc_teleporter_dest},

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.15 2003/09/18 00:05:06 makro
// Lens flares. Opendoor trigger_multiple fixes
//
// Revision 1.14 2003/09/08 19:19:20 makro // Revision 1.14 2003/09/08 19:19:20 makro
// New code for respawning entities in TP // New code for respawning entities in TP
// //
@ -216,19 +219,27 @@ Multiple identical looping sounds will just increase volume without any speed co
"wait" : Seconds between auto triggerings, 0 = don't auto trigger "wait" : Seconds between auto triggerings, 0 = don't auto trigger
"random" wait variance, default is 0 "random" wait variance, default is 0
*/ */
#define SF_TARGET_SPEAKER_LOOPEDON 1
#define SF_TARGET_SPEAKER_LOOPEDOFF 2
#define SF_TARGET_SPEAKER_GLOBAL 4
#define SF_TARGET_SPEAKER_ACTIVATOR 8
#define SF_TARGET_SPEAKER_NOPVS 16
void reset_target_speaker(gentity_t *ent) void reset_target_speaker(gentity_t *ent)
{ {
//looped on //looped on
if (ent->spawnflags & 1) if (ent->spawnflags & SF_TARGET_SPEAKER_LOOPEDON)
ent->s.loopSound = ent->noise_index; ent->s.loopSound = ent->noise_index;
//looped off //looped off
else if (ent->spawnflags & 2) else if (ent->spawnflags & SF_TARGET_SPEAKER_LOOPEDOFF)
ent->s.loopSound = 0; ent->s.loopSound = 0;
} }
void Use_Target_Speaker(gentity_t * ent, gentity_t * other, gentity_t * activator) void Use_Target_Speaker(gentity_t * ent, gentity_t * other, gentity_t * activator)
{ {
if (ent->spawnflags & 3) { // looping sound toggles // looping sound toggles
if (ent->spawnflags & (SF_TARGET_SPEAKER_LOOPEDON | SF_TARGET_SPEAKER_LOOPEDOFF)) {
//Makro - check the pathtarget of the triggering entity //Makro - check the pathtarget of the triggering entity
if (other->pathtarget) { if (other->pathtarget) {
if (!Q_stricmp(other->pathtarget, "on")) { if (!Q_stricmp(other->pathtarget, "on")) {
@ -244,9 +255,9 @@ void Use_Target_Speaker(gentity_t * ent, gentity_t * other, gentity_t * activato
else else
ent->s.loopSound = ent->noise_index; // start it ent->s.loopSound = ent->noise_index; // start it
} else { // normal sound } else { // normal sound
if (ent->spawnflags & 8) { if (ent->spawnflags & SF_TARGET_SPEAKER_ACTIVATOR) {
G_AddEvent(activator, EV_GENERAL_SOUND, ent->noise_index); G_AddEvent(activator, EV_GENERAL_SOUND, ent->noise_index);
} else if (ent->spawnflags & 4) { } else if (ent->spawnflags & SF_TARGET_SPEAKER_GLOBAL) {
G_AddEvent(ent, EV_GLOBAL_SOUND, ent->noise_index); G_AddEvent(ent, EV_GLOBAL_SOUND, ent->noise_index);
} else { } else {
G_AddEvent(ent, EV_GENERAL_SOUND, ent->noise_index); G_AddEvent(ent, EV_GENERAL_SOUND, ent->noise_index);
@ -284,20 +295,21 @@ void SP_target_speaker(gentity_t * ent)
ent->s.frame = ent->wait * 10; ent->s.frame = ent->wait * 10;
ent->s.clientNum = ent->random * 10; ent->s.clientNum = ent->random * 10;
//Makro - added //Makro - added
if ((ent->spawnflags & 3) && (ent->spawnflags & 16)) if ((ent->spawnflags & (SF_TARGET_SPEAKER_LOOPEDON | SF_TARGET_SPEAKER_LOOPEDOFF))
&& (ent->spawnflags & SF_TARGET_SPEAKER_NOPVS))
ent->s.weapon = 1; ent->s.weapon = 1;
else else
ent->s.weapon = 0; ent->s.weapon = 0;
// check for prestarted looping sound // check for prestarted looping sound
if (ent->spawnflags & 1) { if (ent->spawnflags & SF_TARGET_SPEAKER_LOOPEDON) {
ent->s.loopSound = ent->noise_index; ent->s.loopSound = ent->noise_index;
} }
ent->reset = reset_target_speaker; ent->reset = reset_target_speaker;
ent->use = Use_Target_Speaker; ent->use = Use_Target_Speaker;
if (ent->spawnflags & 4) { if (ent->spawnflags & SF_TARGET_SPEAKER_GLOBAL) {
ent->r.svFlags |= SVF_BROADCAST; ent->r.svFlags |= SVF_BROADCAST;
} }

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.30 2003/09/18 00:05:06 makro
// Lens flares. Opendoor trigger_multiple fixes
//
// Revision 1.29 2003/09/16 23:25:32 makro // Revision 1.29 2003/09/16 23:25:32 makro
// trigger_multiple - new spawnflag, 3 new keys // trigger_multiple - new spawnflag, 3 new keys
// //
@ -123,17 +126,25 @@ void multi_trigger(gentity_t * ent, gentity_t * activator)
if (ent->nextthink) { if (ent->nextthink) {
return; // can't retrigger until the wait is over return; // can't retrigger until the wait is over
} }
//Makro - inactive trigger ? if (ent->spawnflags & SF_TRIGGER_MULTIPLE_DOOR) {
if (ent->inactive) {
if (ent->soundInactive)
G_AddEvent(ent, EV_GENERAL_SOUND, ent->soundInactive);
if (ent->targetInactive)
G_UseEntities(ent, ent->targetInactive, activator);
return;
}
if (ent->spawnflags & SF_TRIGGER_MULTIPLE_DOOR)
if (!activator || !activator->client || !activator->client->openDoor) if (!activator || !activator->client || !activator->client->openDoor)
return; return;
if (activator->client->openDoorTime <= ent->timestamp)
return;
ent->timestamp = activator->client->openDoorTime;
}
//Makro - inactive trigger ?
if (ent->inactive) {
//note - since the trigger is not sent to the clients, we cannot send the event
//either, so we'll just play the sound locally
if (ent->soundInactive)
G_AddEvent(ent->activator, EV_GENERAL_SOUND, ent->soundInactive);
if (ent->targetInactive)
G_UseEntities(ent->activator, ent->targetInactive, activator);
ent->think = multi_wait;
ent->nextthink = level.time + (ent->wait + ent->random * crandom()) * 1000;
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) {
@ -148,7 +159,7 @@ void multi_trigger(gentity_t * ent, gentity_t * activator)
} }
if (ent->sound1to2) if (ent->sound1to2)
G_AddEvent(ent, EV_GENERAL_SOUND, ent->sound1to2); G_AddEvent(ent->activator, EV_GENERAL_SOUND, ent->sound1to2);
G_UseTargets(ent, ent->activator); G_UseTargets(ent, ent->activator);
if (ent->wait > 0) { if (ent->wait > 0) {
@ -165,7 +176,10 @@ void multi_trigger(gentity_t * ent, gentity_t * activator)
ent->nextthink = level.time + FRAMETIME; ent->nextthink = level.time + FRAMETIME;
ent->think = G_RealFreeEntity; ent->think = G_RealFreeEntity;
*/ */
ent->inactive = 1; //On second thought, now that I've added those soundInactive/targetInactive keys
//I think just setting touch to 0 will do
//ent->inactive = 1;
ent->touch = 0;
} }
} }
@ -187,6 +201,7 @@ void Reset_Multi(gentity_t *ent)
ent->inactive = ent->unbreakable; ent->inactive = ent->unbreakable;
ent->think = 0; ent->think = 0;
ent->nextthink = 0; ent->nextthink = 0;
ent->touch = Touch_Multi;
} }
void SP_trigger_multiple(gentity_t * ent) void SP_trigger_multiple(gentity_t * ent)

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\RSP53.tmp" with contents Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP322.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\g_trigger.c" "C:\Games\Quake3\rq3source\reaction\game\g_misc.c"
] ]
Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP53.tmp" Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP322.tmp"
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP54.tmp" with contents Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP323.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\RSP54.tmp" Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP323.tmp"
<h3>Output Window</h3> <h3>Output Window</h3>
Compiling... Compiling...
g_trigger.c g_misc.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\RSP58.tmp" with contents Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP327.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\RSP58.tmp" with conten
\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\RSP58.tmp" Creating command line "bscmake.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP327.tmp"
Creating browse info file... Creating browse info file...
<h3>Output Window</h3> <h3>Output Window</h3>