#include "g_local.h"Go to the source code of this file.
|
|
Definition at line 909 of file g_target.c. Referenced by target_activate_use(). |
|
|
Definition at line 910 of file g_target.c. Referenced by target_deactivate_use(). |
|
||||||||||||||||
|
Definition at line 275 of file g_ICARUScb.c.
00276 {
00277 va_list argptr;
00278 char text[1024];
00279
00280 //Don't print messages they don't want to see
00281 //if ( g_ICARUSDebug->integer < level )
00282 if (g_developer.integer != 2)
00283 return;
00284
00285 va_start (argptr, format);
00286 vsprintf (text, format, argptr);
00287 va_end (argptr);
00288
00289 //Add the color formatting
00290 switch ( level )
00291 {
00292 case WL_ERROR:
00293 Com_Printf ( S_COLOR_RED"ERROR: %s", text );
00294 break;
00295
00296 case WL_WARNING:
00297 Com_Printf ( S_COLOR_YELLOW"WARNING: %s", text );
00298 break;
00299
00300 case WL_DEBUG:
00301 {
00302 int entNum;
00303 char *buffer;
00304
00305 sscanf( text, "%d", &entNum );
00306
00307 //if ( ( ICARUS_entFilter >= 0 ) && ( ICARUS_entFilter != entNum ) )
00308 // return;
00309
00310 buffer = (char *) text;
00311 buffer += 5;
00312
00313 if ( ( entNum < 0 ) || ( entNum > MAX_GENTITIES ) )
00314 entNum = 0;
00315
00316 Com_Printf ( S_COLOR_BLUE"DEBUG: %s(%d): %s\n", g_entities[entNum].script_targetname, entNum, buffer );
00317 break;
00318 }
00319 default:
00320 case WL_VERBOSE:
00321 Com_Printf ( S_COLOR_GREEN"INFO: %s", text );
00322 break;
00323 }
00324 }
|
|
||||||||||||
|
Definition at line 900 of file g_target.c. References FL_INACTIVE, gentity_s::flags, FOFS, G_Find(), gentity_t, and NULL. Referenced by target_activate_use(), and target_deactivate_use().
00901 {
00902 gentity_t *target = NULL;
00903 while( NULL != (target = G_Find(target, FOFS(targetname), targetstring)) )
00904 {
00905 target->flags = actState ? (target->flags&~FL_INACTIVE) : (target->flags|FL_INACTIVE);
00906 }
00907 }
|
|
|
Definition at line 754 of file g_target.c. References gentity_s::activator, gentity_s::behaviorSet, BSET_USE, Com_Printf(), gentity_s::count, G_ActivateBehavior(), g_developer, gentity_t, vmCvar_t::integer, level, gentity_s::nextthink, NULL, entityState_s::number, numNewICARUSEnts, Q3_SCRIPT_DIR, gentity_s::s, gentity_s::script_targetname, gentity_s::spawnflags, gentity_s::targetname, level_locals_t::time, trap_ICARUS_InitEnt(), trap_ICARUS_IsInitialized(), trap_ICARUS_RunScript(), trap_ICARUS_ValidEnt(), gentity_s::use, va(), and gentity_s::wait. Referenced by G_SpawnEntitiesFromString(), and target_scriptrunner_use().
00755 {
00756 /*
00757 if (self->behaviorSet[BSET_USE])
00758 {
00759 char newname[MAX_FILENAME_LENGTH];
00760
00761 sprintf((char *) &newname, "%s/%s", Q3_SCRIPT_DIR, self->behaviorSet[BSET_USE] );
00762
00763 ICARUS_RunScript( self, newname );
00764 }
00765 */
00766
00767 if ( self->count != -1 )
00768 {
00769 if ( self->count <= 0 )
00770 {
00771 self->use = 0;
00772 self->behaviorSet[BSET_USE] = NULL;
00773 return;
00774 }
00775 else
00776 {
00777 --self->count;
00778 }
00779 }
00780
00781 if (self->behaviorSet[BSET_USE])
00782 {
00783 if ( self->spawnflags & 1 )
00784 {
00785 if ( !self->activator )
00786 {
00787 if (g_developer.integer)
00788 {
00789 Com_Printf("target_scriptrunner tried to run on invalid entity!\n");
00790 }
00791 return;
00792 }
00793
00794 //if ( !self->activator->sequencer || !self->activator->taskManager )
00795 if (!trap_ICARUS_IsInitialized(self->s.number))
00796 {//Need to be initialized through ICARUS
00797 if ( !self->activator->script_targetname || !self->activator->script_targetname[0] )
00798 {
00799 //We don't have a script_targetname, so create a new one
00800 self->activator->script_targetname = va( "newICARUSEnt%d", numNewICARUSEnts++ );
00801 }
00802
00803 if ( trap_ICARUS_ValidEnt( self->activator ) )
00804 {
00805 trap_ICARUS_InitEnt( self->activator );
00806 }
00807 else
00808 {
00809 if (g_developer.integer)
00810 {
00811 Com_Printf("target_scriptrunner tried to run on invalid ICARUS activator!\n");
00812 }
00813 return;
00814 }
00815 }
00816
00817 if (g_developer.integer)
00818 {
00819 Com_Printf( "target_scriptrunner running %s on activator %s\n", self->behaviorSet[BSET_USE], self->activator->targetname );
00820 }
00821 trap_ICARUS_RunScript( self->activator, va( "%s/%s", Q3_SCRIPT_DIR, self->behaviorSet[BSET_USE] ) );
00822 }
00823 else
00824 {
00825 if ( g_developer.integer && self->activator )
00826 {
00827 Com_Printf( "target_scriptrunner %s used by %s\n", self->targetname, self->activator->targetname );
00828 }
00829 G_ActivateBehavior( self, BSET_USE );
00830 }
00831 }
00832
00833 if ( self->wait )
00834 {
00835 self->nextthink = level.time + self->wait;
00836 }
00837 }
|
|
|
Definition at line 930 of file g_target.c. References G_SetOrigin(), gentity_t, entityState_s::origin, gentity_s::s, target_activate_use(), and gentity_s::use.
00931 {
00932 G_SetOrigin( self, self->s.origin );
00933 self->use = target_activate_use;
00934 }
|
|
|
Definition at line 660 of file g_target.c. References gentity_s::count, gentity_s::genericValue1, gentity_t, target_counter_use(), gentity_s::use, and gentity_s::wait.
00661 {
00662 self->wait = -1;
00663 if (!self->count)
00664 {
00665 self->count = 2;
00666 }
00667 //if ( self->bounceCount > 0 )//let's always set this anyway
00668 {//we will reset when we use up our count, remember our initial count
00669 self->genericValue1 = self->count;
00670 }
00671
00672 self->use = target_counter_use;
00673 }
|
|
|
Definition at line 939 of file g_target.c. References G_SetOrigin(), gentity_t, entityState_s::origin, gentity_s::s, target_deactivate_use(), and gentity_s::use.
00940 {
00941 G_SetOrigin( self, self->s.origin );
00942 self->use = target_deactivate_use;
00943 }
|
|
|
Definition at line 93 of file g_target.c. References G_SpawnFloat(), gentity_t, gentity_s::use, Use_Target_Delay(), and gentity_s::wait.
00093 {
00094 // check delay for backwards compatability
00095 if ( !G_SpawnFloat( "delay", "0", &ent->wait ) ) {
00096 G_SpawnFloat( "wait", "1", &ent->wait );
00097 }
00098
00099 if ( !ent->wait ) {
00100 ent->wait = 1;
00101 }
00102 ent->use = Use_Target_Delay;
00103 }
|
|
|
Definition at line 36 of file g_target.c. References gentity_t, gentity_s::use, and Use_Target_Give().
00036 {
00037 ent->use = Use_Target_Give;
00038 }
|
|
|
Definition at line 539 of file g_target.c. References gentity_t, target_kill_use(), and gentity_s::use.
00539 {
00540 self->use = target_kill_use;
00541 }
|
|
|
Definition at line 430 of file g_target.c. References FRAMETIME, gentity_t, level, gentity_s::nextthink, target_laser_start(), gentity_s::think, and level_locals_t::time.
|
|
|
Definition at line 955 of file g_target.c. References G_Error(), G_NewString(), G_SetOrigin(), G_SpawnString(), gentity_t, gentity_s::message, entityState_s::origin, gentity_s::s, target_level_change_use(), and gentity_s::use.
00956 {
00957 char *s;
00958
00959 G_SpawnString( "mapname", "", &s );
00960 self->message = G_NewString(s);
00961
00962 if ( !self->message || !self->message[0] )
00963 {
00964 G_Error( "target_level_change with no mapname!\n");
00965 return;
00966 }
00967
00968 G_SetOrigin( self, self->s.origin );
00969 self->use = target_level_change_use;
00970 }
|
|
|
Definition at line 592 of file g_target.c. References G_SetOrigin(), gentity_t, level, gentity_s::nextthink, entityState_s::origin, gentity_s::s, gentity_s::think, and level_locals_t::time.
|
|
|
Definition at line 989 of file g_target.c. References G_Error(), G_NewString(), G_SetOrigin(), G_SpawnString(), gentity_t, gentity_s::message, entityState_s::origin, gentity_s::s, target_play_music_use(), gentity_s::use, and vtos().
00990 {
00991 char *s;
00992
00993 G_SetOrigin( self, self->s.origin );
00994 if (!G_SpawnString( "music", "", &s ))
00995 {
00996 G_Error( "target_play_music without a music key at %s", vtos( self->s.origin ) );
00997 }
00998
00999 self->message = G_NewString(s);
01000
01001 self->use = target_play_music_use;
01002 }
|
|
|
Definition at line 546 of file g_target.c. References G_SetOrigin(), gentity_t, entityState_s::origin, and gentity_s::s.
00546 {
00547 G_SetOrigin( self, self->s.origin );
00548 /*
00549 G_SetAngles( self, self->s.angles );
00550 self->s.eType = ET_INVISIBLE;
00551 */
00552 }
|
|
|
Definition at line 239 of file g_target.c. References gentity_t, gentity_s::use, and Use_Target_Print().
00239 {
00240 ent->use = Use_Target_Print;
00241 }
|
|
|
Definition at line 748 of file g_target.c. References gentity_t, target_random_use(), and gentity_s::use.
00749 {
00750 self->use = target_random_use;
00751 }
|
|
|
Definition at line 520 of file g_target.c. References FL_INACTIVE, gentity_s::flags, gentity_t, gentity_s::spawnflags, target_relay_use(), and gentity_s::use.
00520 {
00521 self->use = target_relay_use;
00522 if ( self->spawnflags&128 )
00523 {
00524 self->flags |= FL_INACTIVE;
00525 }
00526 }
|
|
|
Definition at line 63 of file g_target.c. References gentity_t, gentity_s::use, and Use_target_remove_powerups().
00063 {
00064 ent->use = Use_target_remove_powerups;
00065 }
|
|
|
Definition at line 117 of file g_target.c. References gentity_s::count, gentity_t, gentity_s::use, and Use_Target_Score().
00117 {
00118 if ( !ent->count ) {
00119 ent->count = 1;
00120 }
00121 ent->use = Use_Target_Score;
00122 }
|
|
|
Definition at line 871 of file g_target.c. References gentity_s::count, gentity_s::delay, FL_INACTIVE, gentity_s::flags, G_SetOrigin(), G_SpawnFloat(), gentity_t, entityState_s::origin, gentity_s::s, gentity_s::spawnflags, target_scriptrunner_use(), gentity_s::use, and gentity_s::wait.
00872 {
00873 float v;
00874 if ( self->spawnflags & 128 )
00875 {
00876 self->flags |= FL_INACTIVE;
00877 }
00878
00879 if ( !self->count )
00880 {
00881 self->count = 1;//default 1 use only
00882 }
00883 /*
00884 else if ( !self->wait )
00885 {
00886 self->wait = 1;//default wait of 1 sec
00887 }
00888 */
00889 // FIXME: this is a hack... because delay is read in as an int, so I'm bypassing that because it's too late in the project to change it and I want to be able to set less than a second delays
00890 // no one should be setting a radius on a scriptrunner, if they are this would be bad, take this out for the next project
00891 v = 0.0f;
00892 G_SpawnFloat( "delay", "0", &v );
00893 self->delay = v * 1000;//sec to ms
00894 self->wait *= 1000;//sec to ms
00895
00896 G_SetOrigin( self, self->s.origin );
00897 self->use = target_scriptrunner_use;
00898 }
|
|
|
Definition at line 286 of file g_target.c. References entityState_s::clientNum, EF_PERMANENT, entityState_s::eFlags, ET_SPEAKER, entityState_s::eType, entityState_s::eventParm, entityState_s::frame, G_Error(), G_SoundIndex(), G_SoundSetIndex(), G_SpawnFloat(), G_SpawnString(), gentity_t, entityState_s::loopIsSoundset, entityState_s::loopSound, MAX_QPATH, gentity_s::noise_index, entityState_s::origin, entityState_s::pos, Q_strncpyz(), qfalse, gentity_s::r, gentity_s::random, gentity_s::s, entityState_s::soundSetIndex, gentity_s::spawnflags, SVF_BROADCAST, entityShared_t::svFlags, trap_LinkEntity(), trajectory_t::trBase, gentity_s::use, Use_Target_Speaker(), VectorCopy, vtos(), and gentity_s::wait.
00286 {
00287 char buffer[MAX_QPATH];
00288 char *s;
00289
00290 G_SpawnFloat( "wait", "0", &ent->wait );
00291 G_SpawnFloat( "random", "0", &ent->random );
00292
00293 if ( G_SpawnString ( "soundSet", "", &s ) )
00294 { // this is a sound set
00295 ent->s.soundSetIndex = G_SoundSetIndex(s);
00296 ent->s.eFlags = EF_PERMANENT;
00297 VectorCopy( ent->s.origin, ent->s.pos.trBase );
00298 trap_LinkEntity (ent);
00299 return;
00300 }
00301
00302 if ( !G_SpawnString( "noise", "NOSOUND", &s ) ) {
00303 G_Error( "target_speaker without a noise key at %s", vtos( ent->s.origin ) );
00304 }
00305
00306 // force all client reletive sounds to be "activator" speakers that
00307 // play on the entity that activates it
00308 if ( s[0] == '*' ) {
00309 ent->spawnflags |= 8;
00310 }
00311
00312 Q_strncpyz( buffer, s, sizeof(buffer) );
00313
00314 ent->noise_index = G_SoundIndex(buffer);
00315
00316 // a repeating speaker can be done completely client side
00317 ent->s.eType = ET_SPEAKER;
00318 ent->s.eventParm = ent->noise_index;
00319 ent->s.frame = ent->wait * 10;
00320 ent->s.clientNum = ent->random * 10;
00321
00322
00323 // check for prestarted looping sound
00324 if ( ent->spawnflags & 1 ) {
00325 ent->s.loopSound = ent->noise_index;
00326 ent->s.loopIsSoundset = qfalse;
00327 }
00328
00329 ent->use = Use_Target_Speaker;
00330
00331 if (ent->spawnflags & 4) {
00332 ent->r.svFlags |= SVF_BROADCAST;
00333 }
00334
00335 VectorCopy( ent->s.origin, ent->s.pos.trBase );
00336
00337 // must link the entity so we get areas and clusters so
00338 // the server can determine who to send updates to
00339 trap_LinkEntity( ent );
00340 }
|
|
|
Definition at line 460 of file g_target.c. References gentity_s::classname, G_Printf(), gentity_t, entityState_s::origin, gentity_s::s, target_teleporter_use(), gentity_s::targetname, gentity_s::use, and vtos().
00460 {
00461 if (!self->targetname)
00462 G_Printf("untargeted %s at %s\n", self->classname, vtos(self->s.origin));
00463
00464 self->use = target_teleporter_use;
00465 }
|
|
||||||||||||||||
|
Definition at line 912 of file g_target.c. References ACT_ACTIVE, BSET_USE, G_ActivateBehavior(), G_SetActiveState(), gentity_t, and gentity_s::target. Referenced by SP_target_activate().
00913 {
00914 G_ActivateBehavior(self,BSET_USE);
00915
00916 G_SetActiveState(self->target, ACT_ACTIVE);
00917 }
|
|
||||||||||||||||
|
Definition at line 611 of file g_target.c. References gentity_s::activator, gentity_s::bounceCount, BSET_USE, gentity_s::count, FL_INACTIVE, gentity_s::flags, G_ActivateBehavior(), G_DebugPrint(), G_UseTargets(), G_UseTargets2(), gentity_s::genericValue1, gentity_t, gentity_s::spawnflags, gentity_s::target2, gentity_s::targetname, and WL_VERBOSE. Referenced by SP_target_counter().
00612 {
00613 if ( self->count == 0 )
00614 {
00615 return;
00616 }
00617
00618 //gi.Printf("target_counter %s used by %s, entnum %d\n", self->targetname, activator->targetname, activator->s.number );
00619 self->count--;
00620
00621 if ( activator )
00622 {
00623 G_DebugPrint( WL_VERBOSE, "target_counter %s used by %s (%d/%d)\n", self->targetname, activator->targetname, (self->genericValue1-self->count), self->genericValue1 );
00624 }
00625
00626 if ( self->count )
00627 {
00628 if ( self->target2 )
00629 {
00630 //gi.Printf("target_counter %s firing target2 from %s, entnum %d\n", self->targetname, activator->targetname, activator->s.number );
00631 G_UseTargets2( self, activator, self->target2 );
00632 }
00633 return;
00634 }
00635
00636 G_ActivateBehavior( self,BSET_USE );
00637
00638 if ( self->spawnflags & 128 )
00639 {
00640 self->flags |= FL_INACTIVE;
00641 }
00642
00643 self->activator = activator;
00644 G_UseTargets( self, activator );
00645
00646 if ( self->count == 0 )
00647 {
00648 if ( self->bounceCount == 0 )
00649 {
00650 return;
00651 }
00652 self->count = self->genericValue1;
00653 if ( self->bounceCount > 0 )
00654 {//-1 means bounce back forever
00655 self->bounceCount--;
00656 }
00657 }
00658 }
|
|
||||||||||||||||
|
Definition at line 919 of file g_target.c. References ACT_INACTIVE, BSET_USE, G_ActivateBehavior(), G_SetActiveState(), gentity_t, and gentity_s::target. Referenced by SP_target_deactivate().
00920 {
00921 G_ActivateBehavior(self,BSET_USE);
00922
00923 G_SetActiveState(self->target, ACT_INACTIVE);
00924 }
|
|
||||||||||||||||
|
Definition at line 534 of file g_target.c. References BSET_USE, DAMAGE_NO_PROTECTION, G_ActivateBehavior(), G_Damage(), gentity_t, MOD_TELEFRAG, and NULL. Referenced by SP_target_kill().
00534 {
00535 G_ActivateBehavior(self,BSET_USE);
00536 G_Damage ( activator, NULL, NULL, NULL, NULL, 100000, DAMAGE_NO_PROTECTION, MOD_TELEFRAG);
00537 }
|
|
|
Definition at line 386 of file g_target.c. References gentity_t, gentity_s::nextthink, and trap_UnlinkEntity(). Referenced by target_laser_start(), and target_laser_use().
00387 {
00388 trap_UnlinkEntity( self );
00389 self->nextthink = 0;
00390 }
|
|
|
Definition at line 379 of file g_target.c. References gentity_s::activator, gentity_t, and target_laser_think(). Referenced by target_laser_start(), and target_laser_use().
00380 {
00381 if (!self->activator)
00382 self->activator = self;
00383 target_laser_think (self);
00384 }
|
|
|
|
Definition at line 349 of file g_target.c. References gentity_s::activator, CONTENTS_BODY, CONTENTS_CORPSE, CONTENTS_SOLID, gentity_s::damage, DAMAGE_NO_KNOCKBACK, trace_t::endpos, gentity_s::enemy, trace_t::entityNum, FRAMETIME, G_Damage(), g_entities, gentity_t, level, entityShared_t::maxs, entityShared_t::mins, MOD_TARGET_LASER, gentity_s::movedir, gentity_s::nextthink, NULL, entityState_s::number, entityState_s::origin, entityState_s::origin2, gentity_s::r, gentity_s::s, level_locals_t::time, trap_LinkEntity(), trap_Trace(), vec3_t, VectorCopy, VectorMA, VectorNormalize(), and VectorSubtract. Referenced by target_laser_on(), and target_laser_start().
00349 {
00350 vec3_t end;
00351 trace_t tr;
00352 vec3_t point;
00353
00354 // if pointed at another entity, set movedir to point at it
00355 if ( self->enemy ) {
00356 VectorMA (self->enemy->s.origin, 0.5, self->enemy->r.mins, point);
00357 VectorMA (point, 0.5, self->enemy->r.maxs, point);
00358 VectorSubtract (point, self->s.origin, self->movedir);
00359 VectorNormalize (self->movedir);
00360 }
00361
00362 // fire forward and see what we hit
00363 VectorMA (self->s.origin, 2048, self->movedir, end);
00364
00365 trap_Trace( &tr, self->s.origin, NULL, NULL, end, self->s.number, CONTENTS_SOLID|CONTENTS_BODY|CONTENTS_CORPSE);
00366
00367 if ( tr.entityNum ) {
00368 // hurt it if we can
00369 G_Damage ( &g_entities[tr.entityNum], self, self->activator, self->movedir,
00370 tr.endpos, self->damage, DAMAGE_NO_KNOCKBACK, MOD_TARGET_LASER);
00371 }
00372
00373 VectorCopy (tr.endpos, self->s.origin2);
00374
00375 trap_LinkEntity( self );
00376 self->nextthink = level.time + FRAMETIME;
00377 }
|
|
||||||||||||||||
|
Definition at line 392 of file g_target.c. References gentity_s::activator, gentity_t, gentity_s::nextthink, target_laser_off(), and target_laser_on(). Referenced by target_laser_start().
00393 {
00394 self->activator = activator;
00395 if ( self->nextthink > 0 )
00396 target_laser_off (self);
00397 else
00398 target_laser_on (self);
00399 }
|
|
||||||||||||||||
|
Definition at line 945 of file g_target.c. References BSET_USE, EXEC_NOW, G_ActivateBehavior(), gentity_t, gentity_s::message, trap_SendConsoleCommand(), and va(). Referenced by SP_target_level_change().
00946 {
00947 G_ActivateBehavior(self,BSET_USE);
00948
00949 trap_SendConsoleCommand(EXEC_NOW, va("map %s", self->message));
00950 }
|
|
||||||||||||||||
|
Definition at line 972 of file g_target.c. References BSET_USE, CS_MUSIC, G_ActivateBehavior(), gentity_t, gentity_s::message, and trap_SetConfigstring(). Referenced by SP_target_play_music().
00973 {
00974 G_ActivateBehavior(self,BSET_USE);
00975 trap_SetConfigstring( CS_MUSIC, self->message );
00976 }
|
|
||||||||||||||||
|
Definition at line 681 of file g_target.c. References BSET_USE, Com_Printf(), FOFS, G_ActivateBehavior(), G_Find(), G_UseTargets(), gentity_t, GlobalUse(), gentity_s::inuse, NULL, Q_irand(), gentity_s::spawnflags, gentity_s::target, and gentity_s::use. Referenced by SP_target_random().
00682 {
00683 int t_count = 0, pick;
00684 gentity_t *t = NULL;
00685
00686 //gi.Printf("target_random %s used by %s (entnum %d)\n", self->targetname, activator->targetname, activator->s.number );
00687 G_ActivateBehavior(self,BSET_USE);
00688
00689 if(self->spawnflags & 1)
00690 {
00691 self->use = 0;
00692 }
00693
00694 while ( (t = G_Find (t, FOFS(targetname), self->target)) != NULL )
00695 {
00696 if (t != self)
00697 {
00698 t_count++;
00699 }
00700 }
00701
00702 if(!t_count)
00703 {
00704 return;
00705 }
00706
00707 if(t_count == 1)
00708 {
00709 G_UseTargets (self, activator);
00710 return;
00711 }
00712
00713 //FIXME: need a seed
00714 pick = Q_irand(1, t_count);
00715 t_count = 0;
00716 while ( (t = G_Find (t, FOFS(targetname), self->target)) != NULL )
00717 {
00718 if (t != self)
00719 {
00720 t_count++;
00721 }
00722 else
00723 {
00724 continue;
00725 }
00726
00727 if (t == self)
00728 {
00729 // gi.Printf ("WARNING: Entity used itself.\n");
00730 }
00731 else if(t_count == pick)
00732 {
00733 if (t->use != NULL) // check can be omitted
00734 {
00735 GlobalUse(t, self, activator);
00736 return;
00737 }
00738 }
00739
00740 if (!self->inuse)
00741 {
00742 Com_Printf("entity was removed while using targets\n");
00743 return;
00744 }
00745 }
00746 }
|
|
||||||||||||||||
|
Definition at line 479 of file g_target.c. References BSET_USE, gentity_s::client, FL_INACTIVE, gentity_s::flags, FRAMETIME, G_ActivateBehavior(), G_FreeEntity(), G_PickTarget(), G_UseTargets(), gentity_t, GlobalUse(), level, gentity_s::nextthink, NULL, qboolean, qfalse, gclient_s::sess, clientSession_t::sessionTeam, gentity_s::spawnflags, gentity_s::target, TEAM_BLUE, TEAM_RED, gentity_s::think, level_locals_t::time, gentity_s::use, and gentity_s::wait. Referenced by SP_target_relay().
00479 {
00480 qboolean ranscript = qfalse;
00481 if ( ( self->spawnflags & 1 ) && activator->client
00482 && activator->client->sess.sessionTeam != TEAM_RED ) {
00483 return;
00484 }
00485 if ( ( self->spawnflags & 2 ) && activator->client
00486 && activator->client->sess.sessionTeam != TEAM_BLUE ) {
00487 return;
00488 }
00489
00490 if ( self->flags & FL_INACTIVE )
00491 {//set by target_deactivate
00492 return;
00493 }
00494
00495 ranscript = G_ActivateBehavior( self, BSET_USE );
00496 if ( self->wait == -1 )
00497 {//never use again
00498 if ( ranscript )
00499 {//crap, can't remove!
00500 self->use = NULL;
00501 }
00502 else
00503 {//remove
00504 self->think = G_FreeEntity;
00505 self->nextthink = level.time + FRAMETIME;
00506 }
00507 }
00508 if ( self->spawnflags & 4 ) {
00509 gentity_t *ent;
00510
00511 ent = G_PickTarget( self->target );
00512 if ( ent && ent->use ) {
00513 GlobalUse( ent, self, activator );
00514 }
00515 return;
00516 }
00517 G_UseTargets (self, activator);
00518 }
|
|
||||||||||||||||
|
Definition at line 839 of file g_target.c. References gentity_s::activator, gentity_s::delay, gentity_s::enemy, gentity_t, level, gentity_s::nextthink, scriptrunner_run(), gentity_s::think, and level_locals_t::time. Referenced by SP_target_scriptrunner().
00840 {
00841 if ( self->nextthink > level.time )
00842 {
00843 return;
00844 }
00845
00846 self->activator = activator;
00847 self->enemy = other;
00848 if ( self->delay )
00849 {//delay before firing scriptrunner
00850 self->think = scriptrunner_run;
00851 self->nextthink = level.time + self->delay;
00852 }
00853 else
00854 {
00855 scriptrunner_run (self);
00856 }
00857 }
|
|
||||||||||||||||
|
Definition at line 440 of file g_target.c. References entityState_s::angles, BSET_USE, gentity_s::client, G_ActivateBehavior(), G_PickTarget(), G_Printf(), gentity_t, entityState_s::origin, gentity_s::s, gentity_s::target, and TeleportPlayer(). Referenced by SP_target_teleporter().
00440 {
00441 gentity_t *dest;
00442
00443 if (!activator->client)
00444 return;
00445
00446 G_ActivateBehavior(self,BSET_USE);
00447
00448 dest = G_PickTarget( self->target );
00449 if (!dest) {
00450 G_Printf ("Couldn't find teleporter destination\n");
00451 return;
00452 }
00453
00454 TeleportPlayer( activator, dest->s.origin, dest->s.angles );
00455 }
|
|
|
Definition at line 78 of file g_target.c. References gentity_s::activator, G_UseTargets(), and gentity_t. Referenced by Use_Target_Delay().
00078 {
00079 G_UseTargets( ent, ent->activator );
00080 }
|
|
||||||||||||||||
|
Definition at line 82 of file g_target.c. References gentity_s::activator, BSET_USE, crandom, G_ActivateBehavior(), gentity_t, level, gentity_s::nextthink, gentity_s::random, gentity_s::spawnflags, gentity_s::think, Think_Target_Delay(), level_locals_t::time, and gentity_s::wait. Referenced by SP_target_delay().
00082 {
00083 if (ent->nextthink > level.time && (ent->spawnflags & 1))
00084 { //Leave me alone, I am thinking.
00085 return;
00086 }
00087 G_ActivateBehavior(ent,BSET_USE);
00088 ent->nextthink = level.time + ( ent->wait + ent->random * crandom() ) * 1000;
00089 ent->think = Think_Target_Delay;
00090 ent->activator = activator;
00091 }
|
|
||||||||||||||||
|
Definition at line 10 of file g_target.c. References gentity_s::client, FOFS, G_Find(), gentity_t, gentity_s::item, memset(), gentity_s::nextthink, NULL, gentity_s::target, Touch_Item(), and trap_UnlinkEntity(). Referenced by SP_target_give().
00010 {
00011 gentity_t *t;
00012 trace_t trace;
00013
00014 if ( !activator->client ) {
00015 return;
00016 }
00017
00018 if ( !ent->target ) {
00019 return;
00020 }
00021
00022 memset( &trace, 0, sizeof( trace ) );
00023 t = NULL;
00024 while ( (t = G_Find (t, FOFS(targetname), ent->target)) != NULL ) {
00025 if ( !t->item ) {
00026 continue;
00027 }
00028 Touch_Item( t, activator, &trace );
00029
00030 // make sure it isn't going to respawn or show any events
00031 t->nextthink = 0;
00032 trap_UnlinkEntity( t );
00033 }
00034 }
|
|
||||||||||||||||
|
Definition at line 132 of file g_target.c. References BSET_USE, gentity_s::classname, gentity_s::client, Com_Error(), Com_Printf(), ERR_DROP, G_ActivateBehavior(), g_entities, G_TeamCommand(), gentity_s::genericValue14, gentity_s::genericValue15, gentity_t, gentity_s::inuse, level, gentity_s::message, gentity_s::spawnflags, gentity_s::target, gentity_s::targetname, TEAM_BLUE, TEAM_RED, level_locals_t::time, trap_SendServerCommand(), va(), and gentity_s::wait. Referenced by SP_target_print().
00133 {
00134 if (!ent || !ent->inuse)
00135 {
00136 Com_Printf("ERROR: Bad ent in Use_Target_Print");
00137 return;
00138 }
00139
00140 if (ent->wait)
00141 {
00142 if (ent->genericValue14 >= level.time)
00143 {
00144 return;
00145 }
00146 ent->genericValue14 = level.time + ent->wait;
00147 }
00148
00149 #ifndef FINAL_BUILD
00150 if (!ent || !ent->inuse)
00151 {
00152 Com_Error(ERR_DROP, "Bad ent in Use_Target_Print");
00153 }
00154 else if (!activator || !activator->inuse)
00155 {
00156 Com_Error(ERR_DROP, "Bad activator in Use_Target_Print");
00157 }
00158
00159 if (ent->genericValue15 > level.time)
00160 {
00161 Com_Printf("TARGET PRINT ERRORS:\n");
00162 if (activator && activator->classname && activator->classname[0])
00163 {
00164 Com_Printf("activator classname: %s\n", activator->classname);
00165 }
00166 if (activator && activator->target && activator->target[0])
00167 {
00168 Com_Printf("activator target: %s\n", activator->target);
00169 }
00170 if (activator && activator->targetname && activator->targetname[0])
00171 {
00172 Com_Printf("activator targetname: %s\n", activator->targetname);
00173 }
00174 if (ent->targetname && ent->targetname[0])
00175 {
00176 Com_Printf("print targetname: %s\n", ent->targetname);
00177 }
00178 Com_Error(ERR_DROP, "target_print used in quick succession, fix it! See the console for details.");
00179 }
00180 ent->genericValue15 = level.time + 5000;
00181 #endif
00182
00183 G_ActivateBehavior(ent,BSET_USE);
00184 if ( ( ent->spawnflags & 4 ) )
00185 {//private, to one client only
00186 if (!activator || !activator->inuse)
00187 {
00188 Com_Printf("ERROR: Bad activator in Use_Target_Print");
00189 }
00190 if ( activator && activator->client )
00191 {//make sure there's a valid client ent to send it to
00192 if (ent->message[0] == '@' && ent->message[1] != '@')
00193 {
00194 trap_SendServerCommand( activator-g_entities, va("cps \"%s\"", ent->message ));
00195 }
00196 else
00197 {
00198 trap_SendServerCommand( activator-g_entities, va("cp \"%s\"", ent->message ));
00199 }
00200 }
00201 //NOTE: change in functionality - if there *is* no valid client ent, it won't send it to anyone at all
00202 return;
00203 }
00204
00205 if ( ent->spawnflags & 3 ) {
00206 if ( ent->spawnflags & 1 ) {
00207 if (ent->message[0] == '@' && ent->message[1] != '@')
00208 {
00209 G_TeamCommand( TEAM_RED, va("cps \"%s\"", ent->message) );
00210 }
00211 else
00212 {
00213 G_TeamCommand( TEAM_RED, va("cp \"%s\"", ent->message) );
00214 }
00215 }
00216 if ( ent->spawnflags & 2 ) {
00217 if (ent->message[0] == '@' && ent->message[1] != '@')
00218 {
00219 G_TeamCommand( TEAM_BLUE, va("cps \"%s\"", ent->message) );
00220 }
00221 else
00222 {
00223 G_TeamCommand( TEAM_BLUE, va("cp \"%s\"", ent->message) );
00224 }
00225 }
00226 return;
00227 }
00228
00229 if (ent->message[0] == '@' && ent->message[1] != '@')
00230 {
00231 trap_SendServerCommand( -1, va("cps \"%s\"", ent->message ));
00232 }
00233 else
00234 {
00235 trap_SendServerCommand( -1, va("cp \"%s\"", ent->message ));
00236 }
00237 }
|
|
||||||||||||||||
|
Definition at line 47 of file g_target.c. References gentity_s::client, gentity_t, memset(), playerState_s::powerups, gclient_s::ps, PW_BLUEFLAG, PW_NEUTRALFLAG, PW_REDFLAG, TEAM_BLUE, TEAM_FREE, TEAM_RED, and Team_ReturnFlag(). Referenced by SP_target_remove_powerups().
00047 {
00048 if( !activator->client ) {
00049 return;
00050 }
00051
00052 if( activator->client->ps.powerups[PW_REDFLAG] ) {
00053 Team_ReturnFlag( TEAM_RED );
00054 } else if( activator->client->ps.powerups[PW_BLUEFLAG] ) {
00055 Team_ReturnFlag( TEAM_BLUE );
00056 } else if( activator->client->ps.powerups[PW_NEUTRALFLAG] ) {
00057 Team_ReturnFlag( TEAM_FREE );
00058 }
00059
00060 memset( activator->client->ps.powerups, 0, sizeof( activator->client->ps.powerups ) );
00061 }
|
|
||||||||||||||||
|
Definition at line 113 of file g_target.c. References AddScore(), gentity_s::count, entityShared_t::currentOrigin, gentity_t, and gentity_s::r. Referenced by SP_target_score().
00113 {
00114 AddScore( activator, ent->r.currentOrigin, ent->count );
00115 }
|
|
||||||||||||||||
|
Definition at line 259 of file g_target.c. References BSET_USE, EV_GENERAL_SOUND, EV_GLOBAL_SOUND, G_ActivateBehavior(), G_AddEvent(), gentity_t, entityState_s::loopIsSoundset, entityState_s::loopSound, gentity_s::noise_index, qfalse, gentity_s::s, gentity_s::spawnflags, and entityState_s::trickedentindex. Referenced by SP_target_speaker().
00259 {
00260 G_ActivateBehavior(ent,BSET_USE);
00261
00262 if (ent->spawnflags & 3) { // looping sound toggles
00263 if (ent->s.loopSound)
00264 {
00265 ent->s.loopSound = 0; // turn it off
00266 ent->s.loopIsSoundset = qfalse;
00267 ent->s.trickedentindex = 1;
00268 }
00269 else
00270 {
00271 ent->s.loopSound = ent->noise_index; // start it
00272 ent->s.loopIsSoundset = qfalse;
00273 ent->s.trickedentindex = 0;
00274 }
00275 }else { // normal sound
00276 if ( ent->spawnflags & 8 ) {
00277 G_AddEvent( activator, EV_GENERAL_SOUND, ent->noise_index );
00278 } else if (ent->spawnflags & 4) {
00279 G_AddEvent( ent, EV_GLOBAL_SOUND, ent->noise_index );
00280 } else {
00281 G_AddEvent( ent, EV_GENERAL_SOUND, ent->noise_index );
00282 }
00283 }
00284 }
|
|
|
Definition at line 753 of file g_target.c. Referenced by scriptrunner_run(). |