#include "g_local.h"#include "../ghoul2/G2.h"#include "ai_main.h"#include "../namespace_begin.h"#include "../namespace_end.h"Go to the source code of this file.
|
|
Definition at line 2261 of file g_misc.c. Referenced by SP_fx_runner(). |
|
|
|
|
|
Definition at line 10 of file g_misc.c. Referenced by HolocronThink(), and HolocronTouch(). |
|
|
Definition at line 11 of file g_misc.c. Referenced by shield_power_converter_use(). |
|
|
Definition at line 483 of file g_misc.c. Referenced by SP_terrain(). |
|
|
Definition at line 3345 of file g_misc.c. Referenced by G_ClientForShooter(), and G_FreeClientForShooter(). |
|
|
Definition at line 2874 of file g_misc.c. Referenced by FirstFreeTagOwner(), TAG_FindOwner(), and TAG_Init(). |
|
|
Definition at line 2873 of file g_misc.c. Referenced by FirstFreeRefTag(), TAG_Find(), and TAG_Init(). |
|
|
Definition at line 12 of file g_misc.c. Referenced by EnergyShieldStationSettings(). |
|
|
Definition at line 2868 of file g_misc.c. Referenced by TAG_Add(), and TAG_Find(). |
|
|
Referenced by G_ClientForShooter(). |
|
|
Referenced by FirstFreeRefTag(), FirstFreeTagOwner(), TAG_Add(), TAG_Find(), and TAG_FindOwner(). |
|
||||||||||||
|
Definition at line 868 of file g_spawn.c. References G_AddSpawnVarToken(), level, level_locals_t::numSpawnVars, Q_stricmp(), and level_locals_t::spawnVars.
00869 {
00870 int i;
00871
00872 for(i=0;i<level.numSpawnVars;i++)
00873 {
00874 if (Q_stricmp(level.spawnVars[i][0], field) == 0)
00875 {
00876 level.spawnVars[ i ][1] = G_AddSpawnVarToken( value );
00877 return;
00878 }
00879 }
00880
00881 level.spawnVars[ level.numSpawnVars ][0] = G_AddSpawnVarToken( field );
00882 level.spawnVars[ level.numSpawnVars ][1] = G_AddSpawnVarToken( value );
00883 level.numSpawnVars++;
00884 }
|
|
||||||||||||||||
|
Definition at line 1331 of file g_misc.c. References gentity_s::activator, playerState_s::ammo, AMMO_BLASTER, AMMO_MAX, AMMO_ROCKETS, ammoData, CHAN_AUTO, gentity_s::client, gentity_s::count, EF_DOUBLE_AMMO, playerState_s::eFlags, gentity_s::fly_sound_debounce_time, g_gametype, G_Sound(), G_SoundIndex(), gentity_s::genericValue12, gentity_s::genericValue5, gentity_s::genericValue7, gentity_t, GT_SIEGE, vmCvar_t::integer, level, entityState_s::loopIsSoundset, entityState_s::loopSound, ammoData_s::max, gclient_s::ps, qboolean, qfalse, qtrue, gentity_s::s, gentity_s::setTime, and level_locals_t::time. Referenced by SP_misc_ammo_floor_unit().
01332 {
01333 int /*dif,*/ add;
01334 //int ammoType;
01335 int stop = 1;
01336
01337 if (!activator || !activator->client)
01338 {
01339 return;
01340 }
01341
01342 if (self->setTime < level.time)
01343 {
01344 qboolean gaveSome = qfalse;
01345 /*
01346 while (i < 3)
01347 {
01348 if (!self->s.loopSound)
01349 {
01350 self->s.loopSound = G_SoundIndex("sound/interface/ammocon_run");
01351 self->s.loopIsSoundset = qfalse;
01352 }
01353 self->setTime = level.time + 100;
01354
01355 //dif = activator->client->ps.stats[STAT_MAX_HEALTH] - activator->client->ps.stats[STAT_ARMOR];
01356 switch (i)
01357 { //don't give rockets I guess
01358 case 0:
01359 ammoType = AMMO_BLASTER;
01360 break;
01361 case 1:
01362 ammoType = AMMO_POWERCELL;
01363 break;
01364 case 2:
01365 ammoType = AMMO_METAL_BOLTS;
01366 break;
01367 default:
01368 ammoType = -1;
01369 break;
01370 }
01371
01372 if (ammoType != -1)
01373 {
01374 dif = ammoData[ammoType].max - activator->client->ps.ammo[ammoType];
01375 }
01376 else
01377 {
01378 dif = 0;
01379 }
01380
01381 if (dif > 0)
01382 { //only give if not full
01383 if (dif > MAX_AMMO_GIVE)
01384 {
01385 add = MAX_AMMO_GIVE;
01386 }
01387 else
01388 {
01389 add = dif;
01390 }
01391
01392 if (self->count<add)
01393 {
01394 add = self->count;
01395 }
01396
01397 self->count -= add;
01398 if (self->count <= 0)
01399 {
01400 self->setTime = 0;
01401 break;
01402 }
01403 stop = 0;
01404
01405 self->fly_sound_debounce_time = level.time + 500;
01406 self->activator = activator;
01407
01408 activator->client->ps.ammo[ammoType] += add;
01409 }
01410
01411 i++;
01412 }
01413 */
01414 int i = AMMO_BLASTER;
01415 if (!self->s.loopSound)
01416 {
01417 self->s.loopSound = G_SoundIndex("sound/interface/ammocon_run");
01418 self->s.loopIsSoundset = qfalse;
01419 }
01420 //self->setTime = level.time + 100;
01421 self->fly_sound_debounce_time = level.time + 500;
01422 self->activator = activator;
01423 while (i < AMMO_MAX)
01424 {
01425 add = ammoData[i].max*0.05;
01426 if (add < 1)
01427 {
01428 add = 1;
01429 }
01430 if ( ( (activator->client->ps.eFlags & EF_DOUBLE_AMMO) && (activator->client->ps.ammo[i] < ammoData[i].max*2)) ||
01431 ( activator->client->ps.ammo[i] < ammoData[i].max ) )
01432 {
01433 gaveSome = qtrue;
01434 if ( g_gametype.integer == GT_SIEGE && i == AMMO_ROCKETS && activator->client->ps.ammo[i] >= 10 )
01435 { //this stuff is already a freaking mess, so..
01436 gaveSome = qfalse;
01437 }
01438 activator->client->ps.ammo[i] += add;
01439 if ( g_gametype.integer == GT_SIEGE && i == AMMO_ROCKETS && activator->client->ps.ammo[i] >= 10 )
01440 { // fixme - this should SERIOUSLY be externed.
01441 activator->client->ps.ammo[i] = 10;
01442 }
01443 else if ( activator->client->ps.eFlags & EF_DOUBLE_AMMO )
01444 {
01445 if (activator->client->ps.ammo[i] >= ammoData[i].max * 2)
01446 { // yuck.
01447 activator->client->ps.ammo[i] = ammoData[i].max * 2;
01448 }
01449 else
01450 {
01451 stop = 0;
01452 }
01453 }
01454 else
01455 {
01456 if (activator->client->ps.ammo[i] >= ammoData[i].max)
01457 {
01458 activator->client->ps.ammo[i] = ammoData[i].max;
01459 }
01460 else
01461 {
01462 stop = 0;
01463 }
01464 }
01465 }
01466 i++;
01467 if (!self->genericValue12 && gaveSome)
01468 {
01469 int sub = (add*0.2);
01470 if (sub < 1)
01471 {
01472 sub = 1;
01473 }
01474 self->count -= sub;
01475 if (self->count <= 0)
01476 {
01477 self->count = 0;
01478 stop = 1;
01479 break;
01480 }
01481 }
01482 }
01483 }
01484
01485 if (stop || self->count <= 0)
01486 {
01487 if (self->s.loopSound && self->setTime < level.time)
01488 {
01489 if (self->count <= 0)
01490 {
01491 G_Sound(self, CHAN_AUTO, G_SoundIndex("sound/interface/ammocon_empty"));
01492 }
01493 else
01494 {
01495 G_Sound(self, CHAN_AUTO, self->genericValue7);
01496 }
01497 }
01498 self->s.loopSound = 0;
01499 self->s.loopIsSoundset = qfalse;
01500 if (self->setTime < level.time)
01501 {
01502 self->setTime = level.time + self->genericValue5+100;
01503 }
01504 }
01505 }
|
|
||||||||||||||||
|
Definition at line 1753 of file g_misc.c. References gentity_s::activator, playerState_s::ammo, AMMO_BLASTER, AMMO_MAX, ammoData, gentity_s::client, gentity_s::count, gentity_s::fly_sound_debounce_time, G_SoundIndex(), gentity_s::genericValue12, gentity_t, level, entityState_s::loopIsSoundset, entityState_s::loopSound, ammoData_s::max, gclient_s::ps, qboolean, qfalse, gentity_s::s, gentity_s::setTime, and level_locals_t::time. Referenced by SP_misc_model_ammo_power_converter().
01754 {
01755 int add = 0.0f;//,highest;
01756 qboolean overcharge;
01757 // int difBlaster,difPowerCell,difMetalBolts;
01758 int stop = 1;
01759
01760 if (!activator || !activator->client)
01761 {
01762 return;
01763 }
01764
01765 if (self->setTime < level.time)
01766 {
01767 overcharge = qfalse;
01768
01769 if (!self->s.loopSound)
01770 {
01771 self->s.loopSound = G_SoundIndex("sound/player/pickupshield.wav");
01772 }
01773
01774 self->setTime = level.time + 100;
01775
01776 if (self->count) // Has it got any power left?
01777 {
01778 int i = AMMO_BLASTER;
01779 while (i < AMMO_MAX)
01780 {
01781 add = ammoData[i].max*0.1;
01782 if (add < 1)
01783 {
01784 add = 1;
01785 }
01786 if (activator->client->ps.ammo[i] < ammoData[i].max)
01787 {
01788 activator->client->ps.ammo[i] += add;
01789 if (activator->client->ps.ammo[i] > ammoData[i].max)
01790 {
01791 activator->client->ps.ammo[i] = ammoData[i].max;
01792 }
01793 }
01794 i++;
01795 }
01796 if (!self->genericValue12)
01797 {
01798 self->count -= add;
01799 }
01800 stop = 0;
01801
01802 self->fly_sound_debounce_time = level.time + 500;
01803 self->activator = activator;
01804
01805 /*
01806 if (self->count > MAX_AMMO_GIVE)
01807 {
01808 add = MAX_AMMO_GIVE;
01809 }
01810 else if (self->count<0)
01811 {
01812 add = 0;
01813 }
01814 else
01815 {
01816 add = self->count;
01817 }
01818
01819 activator->client->ps.ammo[AMMO_BLASTER] += add;
01820 activator->client->ps.ammo[AMMO_POWERCELL] += add;
01821 activator->client->ps.ammo[AMMO_METAL_BOLTS] += add;
01822
01823 self->count -= add;
01824 stop = 0;
01825
01826 self->fly_sound_debounce_time = level.time + 500;
01827 self->activator = activator;
01828
01829 difBlaster = activator->client->ps.ammo[AMMO_BLASTER] - ammoData[AMMO_BLASTER].max;
01830 difPowerCell = activator->client->ps.ammo[AMMO_POWERCELL] - ammoData[AMMO_POWERCELL].max;
01831 difMetalBolts = activator->client->ps.ammo[AMMO_METAL_BOLTS] - ammoData[AMMO_METAL_BOLTS].max;
01832
01833 // Find the highest one
01834 highest = difBlaster;
01835 if (difPowerCell>difBlaster)
01836 {
01837 highest = difPowerCell;
01838 }
01839
01840 if (difMetalBolts > highest)
01841 {
01842 highest = difMetalBolts;
01843 }
01844 */
01845 }
01846 }
01847
01848 if (stop)
01849 {
01850 self->s.loopSound = 0;
01851 self->s.loopIsSoundset = qfalse;
01852 }
01853 }
|
|
|
|
Definition at line 1743 of file g_misc.c. References gentity_s::count, G_SpawnInt(), and gentity_t. Referenced by SP_misc_model_ammo_power_converter().
01744 {
01745 G_SpawnInt( "count", "200", &ent->count );
01746 }
|
|
|
Definition at line 1911 of file g_misc.c. References gentity_s::count, G_SpawnInt(), and gentity_t. Referenced by SP_misc_model_health_power_converter().
01912 {
01913 G_SpawnInt( "count", "200", &ent->count );
01914 }
|
|
|
Definition at line 1213 of file g_misc.c. References gentity_s::count, G_SpawnInt(), gentity_s::genericValue5, gentity_t, and STATION_RECHARGE_TIME. Referenced by SP_misc_ammo_floor_unit(), SP_misc_model_shield_power_converter(), and SP_misc_shield_floor_unit().
01214 {
01215 G_SpawnInt( "count", "200", &ent->count );
01216
01217 G_SpawnInt("chargerate", "0", &ent->genericValue5);
01218
01219 if (!ent->genericValue5)
01220 {
01221 ent->genericValue5 = STATION_RECHARGE_TIME;
01222 }
01223 }
|
|
|
Definition at line 2758 of file g_misc.c. References CHAN_VOICE, gentity_s::epVelocity, G_EntitySound(), G_FreeEntity(), G_RunExPhys(), gentity_s::genericValue6, gentity_s::genericValue8, gentity_s::genericValue9, gentity_t, level, gentity_s::nextthink, NULL, entityState_s::pos, qtrue, gentity_s::s, gentity_s::think, level_locals_t::time, trajectory_t::trDelta, and VectorScale. Referenced by misc_faller_create().
02759 {
02760 float gravity = 3.0f;
02761 float mass = 0.09f;
02762 float bounce = 1.1f;
02763
02764 if (ent->genericValue6 < level.time)
02765 {
02766 ent->think = G_FreeEntity;
02767 ent->nextthink = level.time;
02768 return;
02769 }
02770
02771 if (ent->epVelocity[2] < -100)
02772 {
02773 if (!ent->genericValue8)
02774 {
02775 G_EntitySound(ent, CHAN_VOICE, ent->genericValue9);
02776 ent->genericValue8 = 1;
02777 }
02778 }
02779 else
02780 {
02781 ent->genericValue8 = 0;
02782 }
02783
02784 G_RunExPhys(ent, gravity, mass, bounce, qtrue, NULL, 0);
02785 VectorScale(ent->epVelocity, 10.0f, ent->s.pos.trDelta);
02786 ent->nextthink = level.time + 25;
02787 }
|
|
||||||||||||||||
|
Definition at line 2730 of file g_misc.c. References CHAN_AUTO, CHAN_VOICE, gentity_s::epVelocity, G_EntitySound(), G_SoundIndex(), gentity_s::genericValue10, gentity_s::genericValue11, gentity_s::genericValue6, gentity_s::genericValue7, gentity_t, level, Q_irand(), and level_locals_t::time. Referenced by misc_faller_create().
02731 {
02732 if (self->epVelocity[2] < -100 && self->genericValue7 < level.time)
02733 {
02734 int r = Q_irand(1, 3);
02735
02736 if (r == 1)
02737 {
02738 self->genericValue11 = G_SoundIndex("sound/chars/stofficer1/misc/pain25");
02739 }
02740 else if (r == 2)
02741 {
02742 self->genericValue11 = G_SoundIndex("sound/chars/stofficer1/misc/pain50");
02743 }
02744 else
02745 {
02746 self->genericValue11 = G_SoundIndex("sound/chars/stofficer1/misc/pain75");
02747 }
02748
02749 G_EntitySound(self, CHAN_VOICE, self->genericValue11);
02750 G_EntitySound(self, CHAN_AUTO, self->genericValue10);
02751
02752 self->genericValue6 = level.time + 3000;
02753
02754 self->genericValue7 = level.time + 200;
02755 }
02756 }
|
|
|
Definition at line 2905 of file g_misc.c. References Com_Printf(), reference_tag_s::inuse, MAX_TAGS, NULL, reference_tag_t, tagOwner_t, and tagOwner_s::tags. Referenced by TAG_Add().
02906 {
02907 int i = 0;
02908
02909 assert(tagOwner);
02910
02911 while (i < MAX_TAGS)
02912 {
02913 if (!tagOwner->tags[i].inuse)
02914 {
02915 return &tagOwner->tags[i];
02916 }
02917 i++;
02918 }
02919
02920 Com_Printf("WARNING: MAX_TAGS (%i) REF TAG LIMIT HIT\n", MAX_TAGS);
02921 return NULL;
02922 }
|
|
|
Definition at line 2888 of file g_misc.c. References Com_Printf(), tagOwner_s::inuse, MAX_TAG_OWNERS, NULL, refTagOwnerMap, and tagOwner_t. Referenced by TAG_Add().
02889 {
02890 int i = 0;
02891
02892 while (i < MAX_TAG_OWNERS)
02893 {
02894 if (!refTagOwnerMap[i].inuse)
02895 {
02896 return &refTagOwnerMap[i];
02897 }
02898 i++;
02899 }
02900
02901 Com_Printf("WARNING: MAX_TAG_OWNERS (%i) REF TAG LIMIT HIT\n", MAX_TAG_OWNERS);
02902 return NULL;
02903 }
|
|
|
Definition at line 2387 of file g_misc.c. References entityState_s::angles, BMS_MID, Com_Printf(), FOFS, fx_runner_think(), fx_runner_use(), G_Find(), G_SetAngles(), G_SoundSetIndex(), gentity_t, level, entityState_s::loopIsSoundset, entityState_s::loopSound, gentity_s::nextthink, NULL, entityState_s::origin, qtrue, gentity_s::s, gentity_s::soundSet, entityState_s::soundSetIndex, gentity_s::spawnflags, gentity_s::target, gentity_s::target2, gentity_s::targetname, gentity_s::think, level_locals_t::time, gentity_s::use, vec3_t, vectoangles(), VectorNormalize(), and VectorSubtract. Referenced by SP_fx_runner().
02388 {
02389 vec3_t dir;
02390
02391 if ( ent->target && ent->target[0] )
02392 {
02393 // try to use the target to override the orientation
02394 gentity_t *target = NULL;
02395
02396 target = G_Find( target, FOFS(targetname), ent->target );
02397
02398 if ( !target )
02399 {
02400 // Bah, no good, dump a warning, but continue on and use the UP vector
02401 Com_Printf( "fx_runner_link: target specified but not found: %s\n", ent->target );
02402 Com_Printf( " -assuming UP orientation.\n" );
02403 }
02404 else
02405 {
02406 // Our target is valid so let's override the default UP vector
02407 VectorSubtract( target->s.origin, ent->s.origin, dir );
02408 VectorNormalize( dir );
02409 vectoangles( dir, ent->s.angles );
02410 }
02411 }
02412
02413 // don't really do anything with this right now other than do a check to warn the designers if the target2 is bogus
02414 if ( ent->target2 && ent->target2[0] )
02415 {
02416 gentity_t *target = NULL;
02417
02418 target = G_Find( target, FOFS(targetname), ent->target2 );
02419
02420 if ( !target )
02421 {
02422 // Target2 is bogus, but we can still continue
02423 Com_Printf( "fx_runner_link: target2 was specified but is not valid: %s\n", ent->target2 );
02424 }
02425 }
02426
02427 G_SetAngles( ent, ent->s.angles );
02428
02429 if ( ent->spawnflags & 1 || ent->spawnflags & 2 ) // STARTOFF || ONESHOT
02430 {
02431 // We won't even consider thinking until we are used
02432 ent->nextthink = -1;
02433 }
02434 else
02435 {
02436 if ( ent->soundSet && ent->soundSet[0] )
02437 {
02438 ent->s.soundSetIndex = G_SoundSetIndex(ent->soundSet);
02439 ent->s.loopSound = BMS_MID;
02440 ent->s.loopIsSoundset = qtrue;
02441 }
02442
02443 // Let's get to work right now!
02444 ent->think = fx_runner_think;
02445 ent->nextthink = level.time + 200; // wait a small bit, then start working
02446 }
02447
02448 // make us useable if we can be targeted
02449 if ( ent->targetname && ent->targetname[0] )
02450 {
02451 ent->use = fx_runner_use;
02452 }
02453 }
|
|
|
Definition at line 2266 of file g_misc.c. References entityState_s::angles, entityState_s::apos, BG_EvaluateTrajectory(), BMS_MID, entityShared_t::currentAngles, entityShared_t::currentOrigin, gentity_s::delay, FX_STATE_CONTINUOUS, G_RadiusDamage(), G_SoundSetIndex(), G_UseTargets2(), gentity_t, entityState_s::isPortalEnt, level, entityState_s::loopIsSoundset, entityState_s::loopSound, MOD_UNKNOWN, entityState_s::modelindex2, gentity_s::nextthink, entityState_s::origin, entityState_s::pos, qtrue, gentity_s::r, gentity_s::random, random, gentity_s::s, gentity_s::soundSet, entityState_s::soundSetIndex, gentity_s::spawnflags, gentity_s::splashDamage, gentity_s::splashRadius, gentity_s::target2, level_locals_t::time, and VectorCopy. Referenced by fx_runner_link(), and fx_runner_use().
02267 {
02268 BG_EvaluateTrajectory( &ent->s.pos, level.time, ent->r.currentOrigin );
02269 BG_EvaluateTrajectory( &ent->s.apos, level.time, ent->r.currentAngles );
02270
02271 // call the effect with the desired position and orientation
02272 if (ent->s.isPortalEnt)
02273 {
02274 // G_AddEvent( ent, EV_PLAY_PORTAL_EFFECT_ID, ent->genericValue5 );
02275 }
02276 else
02277 {
02278 // G_AddEvent( ent, EV_PLAY_EFFECT_ID, ent->genericValue5 );
02279 }
02280
02281 // start the fx on the client (continuous)
02282 ent->s.modelindex2 = FX_STATE_CONTINUOUS;
02283
02284 VectorCopy(ent->r.currentAngles, ent->s.angles);
02285 VectorCopy(ent->r.currentOrigin, ent->s.origin);
02286
02287 ent->nextthink = level.time + ent->delay + random() * ent->random;
02288
02289 if ( ent->spawnflags & 4 ) // damage
02290 {
02291 G_RadiusDamage( ent->r.currentOrigin, ent, ent->splashDamage, ent->splashRadius, ent, ent, MOD_UNKNOWN );
02292 }
02293
02294 if ( ent->target2 && ent->target2[0] )
02295 {
02296 // let our target know that we have spawned an effect
02297 G_UseTargets2( ent, ent, ent->target2 );
02298 }
02299
02300 if ( !(ent->spawnflags & 2 ) && !ent->s.loopSound ) // NOT ONESHOT...this is an assy thing to do
02301 {
02302 if ( ent->soundSet && ent->soundSet[0] )
02303 {
02304 ent->s.soundSetIndex = G_SoundSetIndex(ent->soundSet);
02305 ent->s.loopIsSoundset = qtrue;
02306 ent->s.loopSound = BMS_MID;
02307 }
02308 }
02309
02310 }
|
|
||||||||||||||||
|
Definition at line 2313 of file g_misc.c. References BMS_END, BMS_MID, BMS_START, EV_BMODEL_SOUND, fx_runner_think(), FX_STATE_OFF, FX_STATE_ONE_SHOT, FX_STATE_ONE_SHOT_LIMIT, G_AddEvent(), G_SoundSetIndex(), G_UseTargets2(), gentity_t, entityState_s::isPortalEnt, entityState_s::loopIsSoundset, entityState_s::loopSound, entityState_s::modelindex2, gentity_s::nextthink, qfalse, qtrue, gentity_s::r, gentity_s::s, gentity_s::soundSet, entityState_s::soundSetIndex, gentity_s::spawnflags, SVF_BROADCAST, entityShared_t::svFlags, gentity_s::target2, and gentity_s::think. Referenced by fx_runner_link().
02314 {
02315 if (self->s.isPortalEnt)
02316 { //rww - mark it as broadcast upon first use if it's within the area of a skyportal
02317 self->r.svFlags |= SVF_BROADCAST;
02318 }
02319
02320 if ( self->spawnflags & 2 ) // ONESHOT
02321 {
02322 // call the effect with the desired position and orientation, as a safety thing,
02323 // make sure we aren't thinking at all.
02324 int saveState = self->s.modelindex2 + 1;
02325
02326 fx_runner_think( self );
02327 self->nextthink = -1;
02328 // one shot indicator
02329 self->s.modelindex2 = saveState;
02330 if (self->s.modelindex2 > FX_STATE_ONE_SHOT_LIMIT)
02331 {
02332 self->s.modelindex2 = FX_STATE_ONE_SHOT;
02333 }
02334
02335 if ( self->target2 )
02336 {
02337 // let our target know that we have spawned an effect
02338 G_UseTargets2( self, self, self->target2 );
02339 }
02340
02341 if ( self->soundSet && self->soundSet[0] )
02342 {
02343 self->s.soundSetIndex = G_SoundSetIndex(self->soundSet);
02344 G_AddEvent( self, EV_BMODEL_SOUND, BMS_START);
02345 }
02346 }
02347 else
02348 {
02349 // ensure we are working with the right think function
02350 self->think = fx_runner_think;
02351
02352 // toggle our state
02353 if ( self->nextthink == -1 )
02354 {
02355 // NOTE: we fire the effect immediately on use, the fx_runner_think func will set
02356 // up the nextthink time.
02357 fx_runner_think( self );
02358
02359 if ( self->soundSet && self->soundSet[0] )
02360 {
02361 self->s.soundSetIndex = G_SoundSetIndex(self->soundSet);
02362 G_AddEvent( self, EV_BMODEL_SOUND, BMS_START);
02363 self->s.loopSound = BMS_MID;
02364 self->s.loopIsSoundset = qtrue;
02365 }
02366 }
02367 else
02368 {
02369 // turn off for now
02370 self->nextthink = -1;
02371
02372 // turn off fx on client
02373 self->s.modelindex2 = FX_STATE_OFF;
02374
02375 if ( self->soundSet && self->soundSet[0] )
02376 {
02377 self->s.soundSetIndex = G_SoundSetIndex(self->soundSet);
02378 G_AddEvent( self, EV_BMODEL_SOUND, BMS_END );
02379 self->s.loopSound = 0;
02380 self->s.loopIsSoundset = qfalse;
02381 }
02382 }
02383 }
02384 }
|
|
|
Definition at line 3354 of file g_misc.c. References shooterClient_s::cl, Com_Error(), ERR_DROP, gclient_t, shooterClient_s::inuse, MAX_SHOOTERS, memset(), NULL, qtrue, and shooterClient_t. Referenced by SP_misc_weapon_shooter().
03355 {
03356 int i = 0;
03357
03358 if (!g_shooterClientInit)
03359 { //in theory it should be initialized to 0 on the stack, but just in case.
03360 memset(g_shooterClients, 0, sizeof(shooterClient_t)*MAX_SHOOTERS);
03361 g_shooterClientInit = qtrue;
03362 }
03363
03364 while (i < MAX_SHOOTERS)
03365 {
03366 if (!g_shooterClients[i].inuse)
03367 {
03368 return &g_shooterClients[i].cl;
03369 }
03370 i++;
03371 }
03372
03373 Com_Error(ERR_DROP, "No free shooter clients - hit MAX_SHOOTERS");
03374 return NULL;
03375 }
|
|
|
Definition at line 1229 of file g_mover.c. References entityShared_t::contents, CONTENTS_TRIGGER, FL_TEAMSLAVE, gentity_s::flags, FOFS, G_Find(), gentity_t, NULL, gentity_s::parent, gentity_s::r, gentity_s::targetname, and gentity_s::teammaster. Referenced by G_EntIsUnlockedDoor(), and maglock_link().
01230 {
01231 gentity_t *owner = NULL;
01232 gentity_t *door = ent;
01233 if ( door->flags & FL_TEAMSLAVE )
01234 {//not the master door, get the master door
01235 while ( door->teammaster && (door->flags&FL_TEAMSLAVE))
01236 {
01237 door = door->teammaster;
01238 }
01239 }
01240 if ( door->targetname )
01241 {//find out what is targeting it
01242 //FIXME: if ent->targetname, check what kind of trigger/ent is targetting it? If a normal trigger (active, etc), then it's okay?
01243 while ( (owner = G_Find( owner, FOFS( target ), door->targetname )) != NULL )
01244 {
01245 if ( owner && (owner->r.contents&CONTENTS_TRIGGER) )
01246 {
01247 return owner;
01248 }
01249 }
01250 owner = NULL;
01251 while ( (owner = G_Find( owner, FOFS( target2 ), door->targetname )) != NULL )
01252 {
01253 if ( owner && (owner->r.contents&CONTENTS_TRIGGER) )
01254 {
01255 return owner;
01256 }
01257 }
01258 }
01259
01260 owner = NULL;
01261 while ( (owner = G_Find( owner, FOFS( classname ), "trigger_door" )) != NULL )
01262 {
01263 if ( owner->parent == door )
01264 {
01265 return owner;
01266 }
01267 }
01268
01269 return NULL;
01270 }
|
|
|
Definition at line 3377 of file g_misc.c. References shooterClient_s::cl, gclient_t, shooterClient_s::inuse, MAX_SHOOTERS, and qfalse.
03378 {
03379 int i = 0;
03380 while (i < MAX_SHOOTERS)
03381 {
03382 if (&g_shooterClients[i].cl == cl)
03383 {
03384 g_shooterClients[i].inuse = qfalse;
03385 return;
03386 }
03387 i++;
03388 }
03389 }
|
|
|
Definition at line 638 of file g_misc.c. References gentity_s::client, CONTENTS_SOLID, entityShared_t::currentOrigin, trace_t::entityNum, ENTITYNUM_NONE, ENTITYNUM_WORLD, ET_NPC, entityState_s::eType, trace_t::fraction, g_entities, G_FreeEntity(), gentity_t, gentity_s::inuse, entityState_s::isPortalEnt, level, MAX_GENTITIES, gentity_s::nextthink, NULL, entityState_s::number, entityState_s::origin, qtrue, gentity_s::r, gentity_s::s, gentity_s::think, level_locals_t::time, trap_InPVS(), trap_Trace(), and vec3_origin. Referenced by SP_misc_skyportal().
00639 {
00640 int i = 0;
00641 gentity_t *scan = NULL;
00642
00643 while (i < MAX_GENTITIES)
00644 {
00645 scan = &g_entities[i];
00646
00647 if (scan && scan->inuse && scan->s.number != ent->s.number && trap_InPVS(ent->s.origin, scan->r.currentOrigin))
00648 {
00649 trace_t tr;
00650
00651 trap_Trace(&tr, ent->s.origin, vec3_origin, vec3_origin, scan->r.currentOrigin, ent->s.number, CONTENTS_SOLID);
00652
00653 if (tr.fraction == 1.0 || (tr.entityNum == scan->s.number && tr.entityNum != ENTITYNUM_NONE && tr.entityNum != ENTITYNUM_WORLD))
00654 {
00655 if (!scan->client || scan->s.eType == ET_NPC)
00656 { //making a client a portal entity would be bad.
00657 scan->s.isPortalEnt = qtrue; //he's flagged now
00658 }
00659 }
00660 }
00661
00662 i++;
00663 }
00664
00665 ent->think = G_FreeEntity; //the portal entity is no longer needed because its information is stored in a config string.
00666 ent->nextthink = level.time;
00667 }
|
|
||||||||||||||||
|
Definition at line 1921 of file g_misc.c. References gentity_s::activator, gentity_s::client, gentity_s::count, gentity_s::fly_sound_debounce_time, G_SoundIndex(), gentity_t, gentity_s::health, level, entityState_s::loopIsSoundset, entityState_s::loopSound, gclient_s::ps, qfalse, gentity_s::s, gentity_s::setTime, STAT_MAX_HEALTH, playerState_s::stats, and level_locals_t::time. Referenced by SP_misc_model_health_power_converter().
01922 {
01923 int dif,add;
01924 int stop = 1;
01925
01926 if (!activator || !activator->client)
01927 {
01928 return;
01929 }
01930
01931 if (self->setTime < level.time)
01932 {
01933 if (!self->s.loopSound)
01934 {
01935 self->s.loopSound = G_SoundIndex("sound/player/pickuphealth.wav");
01936 }
01937 self->setTime = level.time + 100;
01938
01939 dif = activator->client->ps.stats[STAT_MAX_HEALTH] - activator->health;
01940
01941 if (dif > 0) // Already at full armor?
01942 {
01943 if (dif >/*MAX_AMMO_GIVE*/5)
01944 {
01945 add = 5;//MAX_AMMO_GIVE;
01946 }
01947 else
01948 {
01949 add = dif;
01950 }
01951
01952 if (self->count<add)
01953 {
01954 add = self->count;
01955 }
01956
01957 //self->count -= add;
01958 stop = 0;
01959
01960 self->fly_sound_debounce_time = level.time + 500;
01961 self->activator = activator;
01962
01963 activator->health += add;
01964 }
01965 }
01966
01967 if (stop)
01968 {
01969 self->s.loopSound = 0;
01970 self->s.loopIsSoundset = qfalse;
01971 }
01972 }
|
|
|
Definition at line 765 of file g_misc.c. References gentity_t, entityState_s::pos, Q_irand(), gentity_s::s, and trajectory_t::trDelta. Referenced by HolocronThink().
00766 {
00767 if (Q_irand(1, 10) < 5)
00768 {
00769 self->s.pos.trDelta[0] = 150 + Q_irand(1, 100);
00770 }
00771 else
00772 {
00773 self->s.pos.trDelta[0] = -150 - Q_irand(1, 100);
00774 }
00775 if (Q_irand(1, 10) < 5)
00776 {
00777 self->s.pos.trDelta[1] = 150 + Q_irand(1, 100);
00778 }
00779 else
00780 {
00781 self->s.pos.trDelta[1] = -150 - Q_irand(1, 100);
00782 }
00783 self->s.pos.trDelta[2] = 150 + Q_irand(1, 100);
00784 }
|
|
|
Definition at line 760 of file g_misc.c. References gentity_s::count, gentity_t, entityState_s::modelindex, and gentity_s::s. Referenced by HolocronThink().
00761 {
00762 self->s.modelindex = (self->count - 128);
00763 }
|
|
|
Definition at line 907 of file g_misc.c. References gentity_s::client, gentity_s::count, entityShared_t::currentOrigin, gentity_s::enemy, playerState_s::fallingToDeath, G_RunObject(), gentity_t, gentity_s::health, HOLOCRON_RESPAWN_TIME, playerState_s::holocronBits, playerState_s::holocronCantTouch, playerState_s::holocronCantTouchTime, HolocronPopOut(), HolocronRespawn(), playerState_s::holocronsCarried, gentity_s::inuse, level, gentity_s::nextthink, NULL, entityState_s::number, entityState_s::origin, playerState_s::origin, entityState_s::origin2, entityState_s::pos, gentity_s::pos2, gclient_s::ps, gentity_s::r, gentity_s::s, level_locals_t::time, trap_LinkEntity(), trajectory_t::trBase, trajectory_t::trDelta, trajectory_t::trTime, and VectorCopy. Referenced by SP_misc_holocron().
00908 {
00909 if (ent->pos2[0] && (!ent->enemy || !ent->enemy->client || ent->enemy->health < 1))
00910 {
00911 if (ent->enemy && ent->enemy->client)
00912 {
00913 HolocronRespawn(ent);
00914 VectorCopy(ent->enemy->client->ps.origin, ent->s.pos.trBase);
00915 VectorCopy(ent->enemy->client->ps.origin, ent->s.origin);
00916 VectorCopy(ent->enemy->client->ps.origin, ent->r.currentOrigin);
00917 //copy to person carrying's origin before popping out of them
00918 HolocronPopOut(ent);
00919 ent->enemy->client->ps.holocronsCarried[ent->count] = 0;
00920 ent->enemy = NULL;
00921
00922 goto justthink;
00923 }
00924 }
00925 else if (ent->pos2[0] && ent->enemy && ent->enemy->client)
00926 {
00927 ent->pos2[1] = level.time + HOLOCRON_RESPAWN_TIME;
00928 }
00929
00930 if (ent->enemy && ent->enemy->client)
00931 {
00932 if (!ent->enemy->client->ps.holocronsCarried[ent->count])
00933 {
00934 ent->enemy->client->ps.holocronCantTouch = ent->s.number;
00935 ent->enemy->client->ps.holocronCantTouchTime = level.time + 5000;
00936
00937 HolocronRespawn(ent);
00938 VectorCopy(ent->enemy->client->ps.origin, ent->s.pos.trBase);
00939 VectorCopy(ent->enemy->client->ps.origin, ent->s.origin);
00940 VectorCopy(ent->enemy->client->ps.origin, ent->r.currentOrigin);
00941 //copy to person carrying's origin before popping out of them
00942 HolocronPopOut(ent);
00943 ent->enemy = NULL;
00944
00945 goto justthink;
00946 }
00947
00948 if (!ent->enemy->inuse || (ent->enemy->client && ent->enemy->client->ps.fallingToDeath))
00949 {
00950 if (ent->enemy->inuse && ent->enemy->client)
00951 {
00952 ent->enemy->client->ps.holocronBits &= ~(1 << ent->count);
00953 ent->enemy->client->ps.holocronsCarried[ent->count] = 0;
00954 }
00955 ent->enemy = NULL;
00956 HolocronRespawn(ent);
00957 VectorCopy(ent->s.origin2, ent->s.pos.trBase);
00958 VectorCopy(ent->s.origin2, ent->s.origin);
00959 VectorCopy(ent->s.origin2, ent->r.currentOrigin);
00960
00961 ent->s.pos.trTime = level.time;
00962
00963 ent->pos2[0] = 0;
00964
00965 trap_LinkEntity(ent);
00966
00967 goto justthink;
00968 }
00969 }
00970
00971 if (ent->pos2[0] && ent->pos2[1] < level.time)
00972 { //isn't in original place and has been there for (HOLOCRON_RESPAWN_TIME) seconds without being picked up, so respawn
00973 VectorCopy(ent->s.origin2, ent->s.pos.trBase);
00974 VectorCopy(ent->s.origin2, ent->s.origin);
00975 VectorCopy(ent->s.origin2, ent->r.currentOrigin);
00976
00977 ent->s.pos.trTime = level.time;
00978
00979 ent->pos2[0] = 0;
00980
00981 trap_LinkEntity(ent);
00982 }
00983
00984 justthink:
00985 ent->nextthink = level.time + 50;
00986
00987 if (ent->s.pos.trDelta[0] || ent->s.pos.trDelta[1] || ent->s.pos.trDelta[2])
00988 {
00989 G_RunObject(ent);
00990 }
00991 }
|
|
||||||||||||||||
|
Definition at line 786 of file g_misc.c. References gentity_s::client, gentity_s::count, gentity_s::enemy, trace_t::entityNum, EV_ITEM_PICKUP, EV_NOAMMO, playerState_s::fd, forcedata_s::forcePowersActive, forcedata_s::forcePowerSelected, FP_LEVITATION, FP_SABER_DEFENSE, FP_SABER_OFFENSE, FP_SABERTHROW, G_AddEvent(), g_MaxHolocronCarry, gentity_t, entityState_s::groundEntityNum, gentity_s::health, HOLOCRON_RESPAWN_TIME, playerState_s::holocronCantTouch, playerState_s::holocronCantTouchTime, playerState_s::holocronsCarried, vmCvar_t::integer, level, entityState_s::modelindex, NUM_FORCE_POWERS, entityState_s::number, gentity_s::pos2, gclient_s::ps, gentity_s::s, level_locals_t::time, and WP_NONE. Referenced by SP_misc_holocron().
00787 {
00788 int i = 0;
00789 int othercarrying = 0;
00790 float time_lowest = 0;
00791 int index_lowest = -1;
00792 int hasall = 1;
00793 int forceReselect = WP_NONE;
00794
00795 if (trace)
00796 {
00797 self->s.groundEntityNum = trace->entityNum;
00798 }
00799
00800 if (!other || !other->client || other->health < 1)
00801 {
00802 return;
00803 }
00804
00805 if (!self->s.modelindex)
00806 {
00807 return;
00808 }
00809
00810 if (self->enemy)
00811 {
00812 return;
00813 }
00814
00815 if (other->client->ps.holocronsCarried[self->count])
00816 {
00817 return;
00818 }
00819
00820 if (other->client->ps.holocronCantTouch == self->s.number && other->client->ps.holocronCantTouchTime > level.time)
00821 {
00822 return;
00823 }
00824
00825 while (i < NUM_FORCE_POWERS)
00826 {
00827 if (other->client->ps.holocronsCarried[i])
00828 {
00829 othercarrying++;
00830
00831 if (index_lowest == -1 || other->client->ps.holocronsCarried[i] < time_lowest)
00832 {
00833 index_lowest = i;
00834 time_lowest = other->client->ps.holocronsCarried[i];
00835 }
00836 }
00837 else if (i != self->count)
00838 {
00839 hasall = 0;
00840 }
00841 i++;
00842 }
00843
00844 if (hasall)
00845 { //once we pick up this holocron we'll have all of them, so give us super special best prize!
00846 //G_Printf("You deserve a pat on the back.\n");
00847 }
00848
00849 if (!(other->client->ps.fd.forcePowersActive & (1 << other->client->ps.fd.forcePowerSelected)))
00850 { //If the player isn't using his currently selected force power, select this one
00851 if (self->count != FP_SABER_OFFENSE && self->count != FP_SABER_DEFENSE && self->count != FP_SABERTHROW && self->count != FP_LEVITATION)
00852 {
00853 other->client->ps.fd.forcePowerSelected = self->count;
00854 }
00855 }
00856
00857 if (g_MaxHolocronCarry.integer && othercarrying >= g_MaxHolocronCarry.integer)
00858 { //make the oldest holocron carried by the player pop out to make room for this one
00859 other->client->ps.holocronsCarried[index_lowest] = 0;
00860
00861 /*
00862 if (index_lowest == FP_SABER_OFFENSE && !HasSetSaberOnly())
00863 { //you lost your saberattack holocron, so no more saber for you
00864 other->client->ps.stats[STAT_WEAPONS] |= (1 << WP_STUN_BATON);
00865 other->client->ps.stats[STAT_WEAPONS] &= ~(1 << WP_SABER);
00866
00867 if (other->client->ps.weapon == WP_SABER)
00868 {
00869 forceReselect = WP_SABER;
00870 }
00871 }
00872 */
00873 //NOTE: No longer valid as we are now always giving a force level 1 saber attack level in holocron
00874 }
00875
00876 //G_Sound(other, CHAN_AUTO, G_SoundIndex("sound/weapons/w_pkup.wav"));
00877 G_AddEvent( other, EV_ITEM_PICKUP, self->s.number );
00878
00879 other->client->ps.holocronsCarried[self->count] = level.time;
00880 self->s.modelindex = 0;
00881 self->enemy = other;
00882
00883 self->pos2[0] = 1;
00884 self->pos2[1] = level.time + HOLOCRON_RESPAWN_TIME;
00885
00886 /*
00887 if (self->count == FP_SABER_OFFENSE && !HasSetSaberOnly())
00888 { //player gets a saber
00889 other->client->ps.stats[STAT_WEAPONS] |= (1 << WP_SABER);
00890 other->client->ps.stats[STAT_WEAPONS] &= ~(1 << WP_STUN_BATON);
00891
00892 if (other->client->ps.weapon == WP_STUN_BATON)
00893 {
00894 forceReselect = WP_STUN_BATON;
00895 }
00896 }
00897 */
00898
00899 if (forceReselect != WP_NONE)
00900 {
00901 G_AddEvent(other, EV_NOAMMO, forceReselect);
00902 }
00903
00904 //G_Printf("DON'T TOUCH ME\n");
00905 }
|
|
||||||||||||
|
Definition at line 1148 of file g_misc.c. References entityState_s::angles, BG_FindItemForWeapon(), G_SetMovedir(), gentity_t, level, M_PI, gentity_s::movedir, gentity_s::nextthink, gentity_s::random, RegisterItem(), gentity_s::s, sin(), gentity_s::target, gentity_s::think, level_locals_t::time, trap_LinkEntity(), gentity_s::use, Use_Shooter(), and entityState_s::weapon. Referenced by SP_shooter_blaster().
01148 {
01149 ent->use = Use_Shooter;
01150 ent->s.weapon = weapon;
01151
01152 RegisterItem( BG_FindItemForWeapon( weapon ) );
01153
01154 G_SetMovedir( ent->s.angles, ent->movedir );
01155
01156 if ( !ent->random ) {
01157 ent->random = 1.0;
01158 }
01159 ent->random = sin( M_PI * ent->random / 180 );
01160 // target might be a moving object, so we can't set movedir for it
01161 if ( ent->target ) {
01162 ent->think = InitShooter_Finish;
01163 ent->nextthink = level.time + 500;
01164 }
01165 trap_LinkEntity( ent );
01166 }
|
|
|
Definition at line 305 of file g_misc.c. References entityState_s::angles, entityState_s::clientNum, DirToByte(), entityState_s::eventParm, entityState_s::frame, G_FreeEntity(), G_PickTarget(), G_Printf(), G_SetMovedir(), gentity_t, entityState_s::number, entityState_s::origin, entityState_s::origin2, entityShared_t::ownerNum, entityState_s::powerups, gentity_s::r, gentity_s::s, gentity_s::spawnflags, gentity_s::target, vec3_t, VectorCopy, VectorNormalize(), and VectorSubtract. Referenced by SP_misc_portal_surface().
00305 {
00306 vec3_t dir;
00307 gentity_t *target;
00308 gentity_t *owner;
00309
00310 owner = G_PickTarget( ent->target );
00311 if ( !owner ) {
00312 G_Printf( "Couldn't find target for misc_partal_surface\n" );
00313 G_FreeEntity( ent );
00314 return;
00315 }
00316 ent->r.ownerNum = owner->s.number;
00317
00318 // frame holds the rotate speed
00319 if ( owner->spawnflags & 1 ) {
00320 ent->s.frame = 25;
00321 } else if ( owner->spawnflags & 2 ) {
00322 ent->s.frame = 75;
00323 }
00324
00325 // swing camera ?
00326 if ( owner->spawnflags & 4 ) {
00327 // set to 0 for no rotation at all
00328 ent->s.powerups = 0;
00329 }
00330 else {
00331 ent->s.powerups = 1;
00332 }
00333
00334 // clientNum holds the rotate offset
00335 ent->s.clientNum = owner->s.clientNum;
00336
00337 VectorCopy( owner->s.origin, ent->s.origin2 );
00338
00339 // see if the portal_camera has a target
00340 target = G_PickTarget( owner->target );
00341 if ( target ) {
00342 VectorSubtract( target->s.origin, owner->s.origin, dir );
00343 VectorNormalize( dir );
00344 } else {
00345 G_SetMovedir( owner->s.angles, dir );
00346 }
00347
00348 ent->s.eventParm = DirToByte( dir );
00349 }
|
|
|
Definition at line 2233 of file g_main.c.
02233 {
02234 int i, numSorted;
02235 gclient_t *cl;
02236 // qboolean won = qtrue;
02237 G_LogPrintf( "Exit: %s\n", string );
02238
02239 level.intermissionQueued = level.time;
02240
02241 // this will keep the clients from playing any voice sounds
02242 // that will get cut off when the queued intermission starts
02243 trap_SetConfigstring( CS_INTERMISSION, "1" );
02244
02245 // don't send more than 32 scores (FIXME?)
02246 numSorted = level.numConnectedClients;
02247 if ( numSorted > 32 ) {
02248 numSorted = 32;
02249 }
02250
02251 if ( g_gametype.integer >= GT_TEAM ) {
02252 G_LogPrintf( "red:%i blue:%i\n",
02253 level.teamScores[TEAM_RED], level.teamScores[TEAM_BLUE] );
02254 }
02255
02256 for (i=0 ; i < numSorted ; i++) {
02257 int ping;
02258
02259 cl = &level.clients[level.sortedClients[i]];
02260
02261 if ( cl->sess.sessionTeam == TEAM_SPECTATOR ) {
02262 continue;
02263 }
02264 if ( cl->pers.connected == CON_CONNECTING ) {
02265 continue;
02266 }
02267
02268 ping = cl->ps.ping < 999 ? cl->ps.ping : 999;
02269
02270 G_LogPrintf( "score: %i ping: %i client: %i %s\n", cl->ps.persistant[PERS_SCORE], ping, level.sortedClients[i], cl->pers.netname );
02271 // if (g_singlePlayer.integer && (g_gametype.integer == GT_DUEL || g_gametype.integer == GT_POWERDUEL)) {
02272 // if (g_entities[cl - level.clients].r.svFlags & SVF_BOT && cl->ps.persistant[PERS_RANK] == 0) {
02273 // won = qfalse;
02274 // }
02275 // }
02276 }
02277
02278 //yeah.. how about not.
02279 /*
02280 if (g_singlePlayer.integer) {
02281 if (g_gametype.integer >= GT_CTF) {
02282 won = level.teamScores[TEAM_RED] > level.teamScores[TEAM_BLUE];
02283 }
02284 trap_SendConsoleCommand( EXEC_APPEND, (won) ? "spWin\n" : "spLose\n" );
02285 }
02286 */
02287 }
|
|
||||||||||||||||||||||||
|
Definition at line 2623 of file g_misc.c. References gentity_s::activator, FL_INACTIVE, gentity_s::flags, G_UseTargets(), gentity_t, and gentity_s::lockCount. Referenced by maglock_link().
02624 {
02625 //unlock our door if we're the last lock pointed at the door
02626 if ( self->activator )
02627 {
02628 self->activator->lockCount--;
02629 if ( !self->activator->lockCount )
02630 {
02631 self->activator->flags &= ~FL_INACTIVE;
02632 }
02633 }
02634
02635 //use targets
02636 G_UseTargets( self, attacker );
02637 //die
02638 //rwwFIXMEFIXME - weap expl func
02639 // WP_Explode( self );
02640 }
|
|
|
Definition at line 2659 of file g_misc.c. References gentity_s::activator, trace_t::allsolid, entityState_s::angles, AngleVectors(), gentity_s::classname, Com_Error(), entityShared_t::contents, CONTENTS_CORPSE, gentity_s::die, trace_t::endpos, trace_t::entityNum, ENTITYNUM_WORLD, ERR_DROP, FL_INACTIVE, FL_SHIELDED, gentity_s::flags, trace_t::fraction, g_entities, G_FindDoorTrigger(), G_FreeEntity(), G_SetAngles(), G_SetOrigin(), gentity_t, gentity_s::health, level, gentity_s::lockCount, maglock_die(), maglock_link(), MASK_SHOT, entityShared_t::maxs, entityShared_t::mins, gentity_s::nextthink, cplane_s::normal, NULL, entityState_s::number, entityState_s::origin, trace_t::plane, Q_stricmp(), qtrue, gentity_s::r, gentity_s::s, trace_t::startsolid, gentity_s::takedamage, gentity_s::think, level_locals_t::time, trap_LinkEntity(), trap_Trace(), vec3_origin, vec3_t, vectoangles(), VectorMA, VectorSet, and vtos(). Referenced by maglock_link(), and SP_misc_maglock().
02660 {
02661 //find what we're supposed to be attached to
02662 vec3_t forward, start, end;
02663 trace_t trace;
02664 gentity_t *traceEnt;
02665
02666 AngleVectors( self->s.angles, forward, NULL, NULL );
02667 VectorMA( self->s.origin, 128, forward, end );
02668 VectorMA( self->s.origin, -4, forward, start );
02669
02670 trap_Trace( &trace, start, vec3_origin, vec3_origin, end, self->s.number, MASK_SHOT );
02671
02672 if ( trace.allsolid || trace.startsolid )
02673 {
02674 Com_Error( ERR_DROP,"misc_maglock at %s in solid\n", vtos(self->s.origin) );
02675 G_FreeEntity( self );
02676 return;
02677 }
02678 if ( trace.fraction == 1.0 )
02679 {
02680 self->think = maglock_link;
02681 self->nextthink = level.time + 100;
02682 /*
02683 Com_Error( ERR_DROP,"misc_maglock at %s pointed at no surface\n", vtos(self->s.origin) );
02684 G_FreeEntity( self );
02685 */
02686 return;
02687 }
02688 traceEnt = &g_entities[trace.entityNum];
02689 if ( trace.entityNum >= ENTITYNUM_WORLD || !traceEnt || Q_stricmp( "func_door", traceEnt->classname ) )
02690 {
02691 self->think = maglock_link;
02692 self->nextthink = level.time + 100;
02693 //Com_Error( ERR_DROP,"misc_maglock at %s not pointed at a door\n", vtos(self->s.origin) );
02694 //G_FreeEntity( self );
02695 return;
02696 }
02697
02698 //check the traceEnt, make sure it's a door and give it a lockCount and deactivate it
02699 //find the trigger for the door
02700 self->activator = G_FindDoorTrigger( traceEnt );
02701 if ( !self->activator )
02702 {
02703 self->activator = traceEnt;
02704 }
02705 self->activator->lockCount++;
02706 self->activator->flags |= FL_INACTIVE;
02707
02708 //now position and orient it
02709 vectoangles( trace.plane.normal, end );
02710 G_SetOrigin( self, trace.endpos );
02711 G_SetAngles( self, end );
02712
02713 //make it hittable
02714 //FIXME: if rotated/inclined this bbox may be off... but okay if we're a ghoul model?
02715 //self->s.modelindex = G_ModelIndex( "models/map_objects/imp_detention/door_lock.md3" );
02716 VectorSet( self->r.mins, -8, -8, -8 );
02717 VectorSet( self->r.maxs, 8, 8, 8 );
02718 self->r.contents = CONTENTS_CORPSE;
02719
02720 //make it destroyable
02721 self->flags |= FL_SHIELDED;//only damagable by lightsabers
02722 self->takedamage = qtrue;
02723 self->health = 10;
02724 self->die = maglock_die;
02725 //self->fxID = G_EffectIndex( "maglock/explosion" );
02726
02727 trap_LinkEntity( self );
02728 }
|
|
||||||||||||||||
|
Definition at line 134 of file g_misc.c. References gentity_s::alt_fire, BSET_USE, G_ActivateBehavior(), and gentity_t. Referenced by SP_light().
00135 {
00136 G_ActivateBehavior(ent,BSET_USE);
00137
00138 ent->alt_fire = !ent->alt_fire; //toggle
00139 misc_lightstyle_set (ent);
00140 }
|
|
||||||||||||||||
|
|
Definition at line 2830 of file g_misc.c. References gentity_s::genericValue1, gentity_s::genericValue2, gentity_t, level, misc_faller_create(), gentity_s::nextthink, Q_irand(), and level_locals_t::time. Referenced by SP_misc_faller().
02831 {
02832 misc_faller_create(ent, ent, ent);
02833 ent->nextthink = level.time + ent->genericValue1 + Q_irand(0, ent->genericValue2);
02834 }
|
|
|
Definition at line 3417 of file g_misc.c. References gentity_s::client, entityShared_t::currentOrigin, gentity_s::enemy, FOFS, FRAMETIME, G_Find(), gentity_t, level, gentity_s::nextthink, NULL, gentity_s::pos1, gclient_s::ps, gentity_s::r, SetClientViewAngle(), gentity_s::target, level_locals_t::time, vectoangles(), VectorCopy, VectorSubtract, and playerState_s::viewangles. Referenced by SP_misc_weapon_shooter().
03418 {
03419 //update my aim
03420 if ( self->target )
03421 {
03422 gentity_t *targ = G_Find( NULL, FOFS(targetname), self->target );
03423 if ( targ )
03424 {
03425 self->enemy = targ;
03426 VectorSubtract( targ->r.currentOrigin, self->r.currentOrigin, self->pos1 );
03427 VectorCopy( targ->r.currentOrigin, self->pos1 );
03428 vectoangles( self->pos1, self->client->ps.viewangles );
03429 SetClientViewAngle( self, self->client->ps.viewangles );
03430 //FIXME: don't keep doing this unless target is a moving target?
03431 self->nextthink = level.time + FRAMETIME;
03432 }
03433 else
03434 {
03435 self->enemy = NULL;
03436 }
03437 }
03438 }
|
|
|
Definition at line 3391 of file g_misc.c. References FireWeapon(), gentity_t, level, misc_weapon_shooter_fire(), gentity_s::nextthink, gentity_s::spawnflags, gentity_s::think, level_locals_t::time, and gentity_s::wait. Referenced by misc_weapon_shooter_fire(), and misc_weapon_shooter_use().
03392 {
03393 FireWeapon( self, (self->spawnflags&1) );
03394 if ( (self->spawnflags&2) )
03395 {//repeat
03396 self->think = misc_weapon_shooter_fire;
03397 self->nextthink = level.time + self->wait;
03398 }
03399 }
|
|
||||||||||||||||
|
Definition at line 3401 of file g_misc.c. References gentity_t, misc_weapon_shooter_fire(), gentity_s::nextthink, and gentity_s::think. Referenced by SP_misc_weapon_shooter().
03402 {
03403 if ( self->think == misc_weapon_shooter_fire )
03404 {//repeating fire, stop
03405 /*
03406 G_FreeClientForShooter(self->client);
03407 self->think = G_FreeEntity;
03408 self->nextthink = level.time;
03409 */
03410 self->nextthink = 0;
03411 return;
03412 }
03413 //otherwise, fire
03414 misc_weapon_shooter_fire( self );
03415 }
|
|
|
Definition at line 3267 of file g_misc.c. References entityState_s::angles, Com_Printf(), FOFS, G_Find(), G_FreeEntity(), gentity_t, NULL, entityState_s::origin, gentity_s::ownername, reference_tag_t, gentity_s::s, S_COLOR_RED, TAG_Add(), gentity_s::target, gentity_s::targetname, vec3_t, vectoangles(), VectorNormalize(), and VectorSubtract. Referenced by SP_reference_tag().
03268 {
03269 reference_tag_t *tag;
03270
03271 if ( ent->target )
03272 {
03273 //TODO: Find the target and set our angles to that direction
03274 gentity_t *target = G_Find( NULL, FOFS(targetname), ent->target );
03275 vec3_t dir;
03276
03277 if ( target )
03278 {
03279 //Find the direction to the target
03280 VectorSubtract( target->s.origin, ent->s.origin, dir );
03281 VectorNormalize( dir );
03282 vectoangles( dir, ent->s.angles );
03283
03284 //FIXME: Does pitch get flipped?
03285 }
03286 else
03287 {
03288 Com_Printf( S_COLOR_RED"ERROR: ref_tag (%s) has invalid target (%s)", ent->targetname, ent->target );
03289 }
03290 }
03291
03292 //Add the tag
03293 tag = TAG_Add( ent->targetname, ent->ownername, ent->s.origin, ent->s.angles, 16, 0 );
03294
03295 //Delete immediately, cannot be refered to as an entity again
03296 //NOTE: this means if you wanted to link them in a chain for, say, a path, you can't
03297 G_FreeEntity( ent );
03298 }
|
|
||||||||||||||||
|
Definition at line 1230 of file g_misc.c. References gentity_s::activator, bgSiegeClasses, CHAN_AUTO, gentity_s::client, gentity_s::count, gentity_s::fly_sound_debounce_time, g_gametype, G_Sound(), G_SoundIndex(), gentity_s::genericValue12, gentity_s::genericValue5, gentity_s::genericValue7, gentity_t, GT_SIEGE, vmCvar_t::integer, level, entityState_s::loopIsSoundset, entityState_s::loopSound, MAX_AMMO_GIVE, gclient_s::ps, qfalse, gentity_s::s, gentity_s::setTime, gclient_s::siegeClass, STAT_ARMOR, STAT_MAX_HEALTH, playerState_s::stats, and level_locals_t::time. Referenced by SP_misc_model_shield_power_converter(), and SP_misc_shield_floor_unit().
01231 {
01232 int dif,add;
01233 int stop = 1;
01234
01235 if (!activator || !activator->client)
01236 {
01237 return;
01238 }
01239
01240 if ( g_gametype.integer == GT_SIEGE
01241 && other
01242 && other->client
01243 && other->client->siegeClass )
01244 {
01245 if ( !bgSiegeClasses[other->client->siegeClass].maxarmor )
01246 {//can't use it!
01247 G_Sound(self, CHAN_AUTO, G_SoundIndex("sound/interface/shieldcon_empty"));
01248 return;
01249 }
01250 }
01251
01252 if (self->setTime < level.time)
01253 {
01254 int maxArmor;
01255 if (!self->s.loopSound)
01256 {
01257 self->s.loopSound = G_SoundIndex("sound/interface/shieldcon_run");
01258 self->s.loopIsSoundset = qfalse;
01259 }
01260 self->setTime = level.time + 100;
01261
01262 if ( g_gametype.integer == GT_SIEGE
01263 && other
01264 && other->client
01265 && other->client->siegeClass != -1 )
01266 {
01267 maxArmor = bgSiegeClasses[other->client->siegeClass].maxarmor;
01268 }
01269 else
01270 {
01271 maxArmor = activator->client->ps.stats[STAT_MAX_HEALTH];
01272 }
01273 dif = maxArmor - activator->client->ps.stats[STAT_ARMOR];
01274
01275 if (dif > 0) // Already at full armor?
01276 {
01277 if (dif >MAX_AMMO_GIVE)
01278 {
01279 add = MAX_AMMO_GIVE;
01280 }
01281 else
01282 {
01283 add = dif;
01284 }
01285
01286 if (self->count<add)
01287 {
01288 add = self->count;
01289 }
01290
01291 if (!self->genericValue12)
01292 {
01293 self->count -= add;
01294 }
01295 if (self->count <= 0)
01296 {
01297 self->setTime = 0;
01298 }
01299 stop = 0;
01300
01301 self->fly_sound_debounce_time = level.time + 500;
01302 self->activator = activator;
01303
01304 activator->client->ps.stats[STAT_ARMOR] += add;
01305 }
01306 }
01307
01308 if (stop || self->count <= 0)
01309 {
01310 if (self->s.loopSound && self->setTime < level.time)
01311 {
01312 if (self->count <= 0)
01313 {
01314 G_Sound(self, CHAN_AUTO, G_SoundIndex("sound/interface/shieldcon_empty"));
01315 }
01316 else
01317 {
01318 G_Sound(self, CHAN_AUTO, self->genericValue7);
01319 }
01320 }
01321 self->s.loopSound = 0;
01322 self->s.loopIsSoundset = qfalse;
01323 if (self->setTime < level.time)
01324 {
01325 self->setTime = level.time + self->genericValue5+100;
01326 }
01327 }
01328 }
|
|
|
Definition at line 2535 of file g_misc.c. References gentity_s::count, G_EffectIndex(), gentity_t, and va().
02536 {
02537 G_EffectIndex(va("*rain init %i", ent->count));
02538 }
|
|
|
Definition at line 2522 of file g_misc.c. References G_EffectIndex(), and gentity_t.
02523 {
02524 G_EffectIndex("*snow");
02525 G_EffectIndex("*fog");
02526 G_EffectIndex("*constantwind (100 100 -100)");
02527 }
|
|
|
Definition at line 2509 of file g_misc.c. References gentity_s::count, G_EffectIndex(), gentity_t, and va().
02510 {
02511 G_EffectIndex(va("*spacedust %i", ent->count));
02512 //G_EffectIndex("*constantwind ( 10 -10 0 )");
02513 }
|
|
|
Definition at line 2456 of file g_misc.c. References entityState_s::angles, Com_Printf(), gentity_s::delay, ET_FX, entityState_s::eType, FX_ENT_RADIUS, fx_runner_link(), FX_STATE_OFF, G_EffectIndex(), G_FreeEntity(), G_SetOrigin(), G_SpawnFloat(), G_SpawnInt(), G_SpawnString(), gentity_t, level, entityShared_t::maxs, entityShared_t::mins, entityState_s::modelindex, entityState_s::modelindex2, gentity_s::nextthink, entityState_s::origin, gentity_s::r, gentity_s::random, gentity_s::s, S_COLOR_RED, entityState_s::speed, gentity_s::splashDamage, gentity_s::splashRadius, gentity_s::targetname, gentity_s::think, entityState_s::time, level_locals_t::time, trap_LinkEntity(), VectorScale, VectorSet, and vtos().
02457 {
02458 char *fxFile;
02459
02460 G_SpawnString( "fxFile", "", &fxFile );
02461 // Get our defaults
02462 G_SpawnInt( "delay", "200", &ent->delay );
02463 G_SpawnFloat( "random", "0", &ent->random );
02464 G_SpawnInt( "splashRadius", "16", &ent->splashRadius );
02465 G_SpawnInt( "splashDamage", "5", &ent->splashDamage );
02466
02467 if (!ent->s.angles[0] && !ent->s.angles[1] && !ent->s.angles[2])
02468 {
02469 // didn't have angles, so give us the default of up
02470 VectorSet( ent->s.angles, -90, 0, 0 );
02471 }
02472
02473 if ( !fxFile || !fxFile[0] )
02474 {
02475 Com_Printf( S_COLOR_RED"ERROR: fx_runner %s at %s has no fxFile specified\n", ent->targetname, vtos(ent->s.origin) );
02476 G_FreeEntity( ent );
02477 return;
02478 }
02479
02480 // Try and associate an effect file, unfortunately we won't know if this worked or not
02481 // until the CGAME trys to register it...
02482 ent->s.modelindex = G_EffectIndex( fxFile );
02483
02484 // important info transmitted
02485 ent->s.eType = ET_FX;
02486 ent->s.speed = ent->delay;
02487 ent->s.time = ent->random;
02488 ent->s.modelindex2 = FX_STATE_OFF;
02489
02490 // Give us a bit of time to spawn in the other entities, since we may have to target one of 'em
02491 ent->think = fx_runner_link;
02492 ent->nextthink = level.time + 400;
02493
02494 // Save our position and link us up!
02495 G_SetOrigin( ent, ent->s.origin );
02496
02497 VectorSet( ent->r.maxs, FX_ENT_RADIUS, FX_ENT_RADIUS, FX_ENT_RADIUS );
02498 VectorScale( ent->r.maxs, -1, ent->r.mins );
02499
02500 trap_LinkEntity( ent );
02501 }
|
|
|
Definition at line 25 of file g_misc.c. References G_SetOrigin(), gentity_t, entityState_s::origin, and gentity_s::s.
00025 {
00026 G_SetOrigin( self, self->s.origin );
00027 }
|
|
|
Definition at line 42 of file g_misc.c. References G_SetOrigin(), gentity_t, entityState_s::origin, and gentity_s::s.
00042 {
00043 G_SetOrigin( self, self->s.origin );
00044 }
|
|
|
Definition at line 33 of file g_misc.c. References G_FreeEntity(), and gentity_t.
00033 {
00034 G_FreeEntity( self );
00035 }
|
|
|
Definition at line 142 of file g_misc.c. References gentity_s::alt_fire, gentity_s::bounceCount, gentity_s::count, ET_GENERAL, entityState_s::eType, gentity_s::fly_sound_debounce_time, G_FreeEntity(), G_SetOrigin(), G_SpawnInt(), gentity_t, misc_dlight_use(), entityState_s::origin, qfalse, qtrue, gentity_s::r, gentity_s::s, gentity_s::spawnflags, SVF_NOCLIENT, entityShared_t::svFlags, gentity_s::targetname, trap_LinkEntity(), and gentity_s::use.
00142 {
00143 if (!self->targetname )
00144 {//if i don't have a light style switch, the i go away
00145 G_FreeEntity( self );
00146 return;
00147 }
00148
00149 G_SpawnInt( "style", "0", &self->count );
00150 G_SpawnInt( "switch_style", "0", &self->bounceCount );
00151 G_SpawnInt( "style_off", "0", &self->fly_sound_debounce_time );
00152 G_SetOrigin( self, self->s.origin );
00153 trap_LinkEntity( self );
00154
00155 self->use = misc_dlight_use;
00156
00157 self->s.eType = ET_GENERAL;
00158 self->alt_fire = qfalse;
00159 self->r.svFlags |= SVF_NOCLIENT;
00160
00161 if ( !(self->spawnflags & 4) )
00162 { //turn myself on now
00163 self->alt_fire = qtrue;
00164 }
00165 misc_lightstyle_set (self);
00166 }
|
|
|
|
Definition at line 390 of file g_misc.c. References entityState_s::angles, entityState_s::apos, Com_sprintf(), entityShared_t::currentAngles, entityShared_t::currentOrigin, EF_PERMANENT, entityState_s::eFlags, ET_MOVER, entityState_s::eType, G_BSPIndex(), G_SpawnEntitiesFromString(), G_SpawnFloat(), G_SpawnInt(), G_SpawnString(), gentity_t, level, MAX_QPATH, level_locals_t::mBSPInstanceDepth, level_locals_t::mNumBSPInstances, entityState_s::modelindex, level_locals_t::mOriginAdjust, level_locals_t::mRotationAdjust, level_locals_t::mTargetAdjust, level_locals_t::mTeamFilter, entityState_s::origin, entityState_s::pos, qtrue, gentity_s::r, gentity_s::s, strcpy(), entityState_s::time, entityState_s::time2, trap_LinkEntity(), trap_SetActiveSubBSP(), trap_SetBrushModel(), trajectory_t::trBase, and VectorCopy.
00391 {
00392 char temp[MAX_QPATH];
00393 char *out;
00394 float newAngle;
00395 int tempint;
00396
00397 G_SpawnFloat( "angle", "0", &newAngle );
00398 if (newAngle != 0.0)
00399 {
00400 ent->s.angles[1] = newAngle;
00401 }
00402 // don't support rotation any other way
00403 ent->s.angles[0] = 0.0;
00404 ent->s.angles[2] = 0.0;
00405
00406 G_SpawnString("bspmodel", "", &out);
00407
00408 ent->s.eFlags = EF_PERMANENT;
00409
00410 // Mainly for debugging
00411 G_SpawnInt( "spacing", "0", &tempint);
00412 ent->s.time2 = tempint;
00413 G_SpawnInt( "flatten", "0", &tempint);
00414 ent->s.time = tempint;
00415
00416 Com_sprintf(temp, MAX_QPATH, "#%s", out);
00417 trap_SetBrushModel( ent, temp ); // SV_SetBrushModel -- sets mins and maxs
00418 G_BSPIndex(temp);
00419
00420 level.mNumBSPInstances++;
00421 Com_sprintf(temp, MAX_QPATH, "%d-", level.mNumBSPInstances);
00422 VectorCopy(ent->s.origin, level.mOriginAdjust);
00423 level.mRotationAdjust = ent->s.angles[1];
00424 level.mTargetAdjust = temp;
00425 //level.hasBspInstances = qtrue; //rww - also not referenced anywhere.
00426 level.mBSPInstanceDepth++;
00427 /*
00428 G_SpawnString("filter", "", &out);
00429 strcpy(level.mFilter, out);
00430 */
00431 G_SpawnString("teamfilter", "", &out);
00432 strcpy(level.mTeamFilter, out);
00433
00434 VectorCopy( ent->s.origin, ent->s.pos.trBase );
00435 VectorCopy( ent->s.origin, ent->r.currentOrigin );
00436 VectorCopy( ent->s.angles, ent->s.apos.trBase );
00437 VectorCopy( ent->s.angles, ent->r.currentAngles );
00438
00439 ent->s.eType = ET_MOVER;
00440
00441 trap_LinkEntity (ent);
00442
00443 trap_SetActiveSubBSP(ent->s.modelindex);
00444 G_SpawnEntitiesFromString(qtrue);
00445 trap_SetActiveSubBSP(-1);
00446
00447 level.mBSPInstanceDepth--;
00448 //level.mFilter[0] = level.mTeamFilter[0] = 0;
00449 level.mTeamFilter[0] = 0;
00450
00451 /*
00452 if ( g_debugRMG.integer )
00453 {
00454 G_SpawnDebugCylinder ( ent->s.origin, ent->s.time2, &g_entities[0], 2000, COLOR_WHITE );
00455
00456 if ( ent->s.time )
00457 {
00458 G_SpawnDebugCylinder ( ent->s.origin, ent->s.time, &g_entities[0], 2000, COLOR_RED );
00459 }
00460 }
00461 */
00462 }
|
|
|
Definition at line 2844 of file g_misc.c. References G_ModelIndex(), G_SoundIndex(), G_SpawnInt(), gentity_s::genericValue1, gentity_s::genericValue2, gentity_t, level, misc_faller_create(), misc_faller_think(), gentity_s::nextthink, Q_irand(), gentity_s::targetname, gentity_s::think, level_locals_t::time, and gentity_s::use.
02845 {
02846 G_ModelIndex("models/players/stormtrooper/model.glm");
02847 G_SoundIndex("sound/chars/stofficer1/misc/pain25");
02848 G_SoundIndex("sound/chars/stofficer1/misc/pain50");
02849 G_SoundIndex("sound/chars/stofficer1/misc/pain75");
02850 G_SoundIndex("sound/chars/stofficer1/misc/falling1");
02851 G_SoundIndex("sound/player/fallsplat");
02852
02853 G_SpawnInt("interval", "500", &ent->genericValue1);
02854 G_SpawnInt("fudgefactor", "0", &ent->genericValue2);
02855
02856 if (!ent->targetname || !ent->targetname[0])
02857 {
02858 ent->think = misc_faller_think;
02859 ent->nextthink = level.time + ent->genericValue1 + Q_irand(0, ent->genericValue2);
02860 }
02861 else
02862 {
02863 ent->use = misc_faller_create;
02864 }
02865 }
|
|
|
Definition at line 285 of file g_misc.c. References entityState_s::angles, entityState_s::apos, BONE_ANIM_OVERRIDE_LOOP, G_FreeEntity(), G_ModelIndex(), G_SetOrigin(), gentity_t, level, entityState_s::origin, gentity_s::s, level_locals_t::time, trap_G2API_InitGhoul2Model(), trap_G2API_SetBoneAnim(), trap_LinkEntity(), trajectory_t::trBase, and VectorCopy.
00285 {
00286
00287 #if 0
00288 char name1[200] = "models/players/kyle/modelmp.glm";
00289 trap_G2API_InitGhoul2Model(&ent->s, name1, G_ModelIndex( name1 ), 0, 0, 0, 0);
00290 trap_G2API_SetBoneAnim(ent->s.ghoul2, 0, "model_root", 0, 12, BONE_ANIM_OVERRIDE_LOOP, 1.0f, level.time, -1, -1);
00291 ent->s.radius = 150;
00292 // VectorSet (ent->r.mins, -16, -16, -16);
00293 // VectorSet (ent->r.maxs, 16, 16, 16);
00294 trap_LinkEntity (ent);
00295
00296 G_SetOrigin( ent, ent->s.origin );
00297 VectorCopy( ent->s.angles, ent->s.apos.trBase );
00298 #else
00299 G_FreeEntity( ent );
00300 #endif
00301 }
|
|
|
Definition at line 993 of file g_misc.c. References gentity_s::clipmask, entityShared_t::contents, CONTENTS_TRIGGER, gentity_s::count, trace_t::endpos, gentity_s::enemy, ET_HOLOCRON, entityState_s::eType, FL_BOUNCE_HALF, gentity_s::flags, FORCE_DARKSIDE, FORCE_LIGHTSIDE, forcePowerDarkLight, FP_SABER_DEFENSE, FP_SABER_OFFENSE, FP_SABERTHROW, G_FreeEntity(), g_gametype, G_Printf(), G_SetOrigin(), gentity_t, GT_HOLOCRON, HasSetSaberOnly(), HolocronThink(), HolocronTouch(), vmCvar_t::integer, entityState_s::isJediMaster, level, MASK_SOLID, entityShared_t::maxs, entityShared_t::mins, entityState_s::modelindex, gentity_s::nextthink, NULL, NUM_FORCE_POWERS, entityState_s::number, entityState_s::origin, entityState_s::origin2, gentity_s::physicsObject, entityState_s::pos, qtrue, gentity_s::r, gentity_s::s, trace_t::startsolid, gentity_s::think, level_locals_t::time, gentity_s::touch, TR_GRAVITY, trap_LinkEntity(), trap_Trace(), trajectory_t::trBase, entityState_s::trickedentindex3, entityState_s::trickedentindex4, trajectory_t::trTime, trajectory_t::trType, vec3_t, VectorCopy, VectorSet, and vtos().
00994 {
00995 vec3_t dest;
00996 trace_t tr;
00997
00998 if (g_gametype.integer != GT_HOLOCRON)
00999 {
01000 G_FreeEntity(ent);
01001 return;
01002 }
01003
01004 if (HasSetSaberOnly())
01005 {
01006 if (ent->count == FP_SABER_OFFENSE ||
01007 ent->count == FP_SABER_DEFENSE ||
01008 ent->count == FP_SABERTHROW)
01009 { //having saber holocrons in saber only mode is pointless
01010 G_FreeEntity(ent);
01011 return;
01012 }
01013 }
01014
01015 ent->s.isJediMaster = qtrue;
01016
01017 VectorSet( ent->r.maxs, 8, 8, 8 );
01018 VectorSet( ent->r.mins, -8, -8, -8 );
01019
01020 ent->s.origin[2] += 0.1;
01021 ent->r.maxs[2] -= 0.1;
01022
01023 VectorSet( dest, ent->s.origin[0], ent->s.origin[1], ent->s.origin[2] - 4096 );
01024 trap_Trace( &tr, ent->s.origin, ent->r.mins, ent->r.maxs, dest, ent->s.number, MASK_SOLID );
01025 if ( tr.startsolid )
01026 {
01027 G_Printf ("SP_misc_holocron: misc_holocron startsolid at %s\n", vtos(ent->s.origin));
01028 G_FreeEntity( ent );
01029 return;
01030 }
01031
01032 //add the 0.1 back after the trace
01033 ent->r.maxs[2] += 0.1;
01034
01035 // allow to ride movers
01036 // ent->s.groundEntityNum = tr.entityNum;
01037
01038 G_SetOrigin( ent, tr.endpos );
01039
01040 if (ent->count < 0)
01041 {
01042 ent->count = 0;
01043 }
01044
01045 if (ent->count >= NUM_FORCE_POWERS)
01046 {
01047 ent->count = NUM_FORCE_POWERS-1;
01048 }
01049 /*
01050 if (g_forcePowerDisable.integer &&
01051 (g_forcePowerDisable.integer & (1 << ent->count)))
01052 {
01053 G_FreeEntity(ent);
01054 return;
01055 }
01056 */
01057 //No longer doing this, causing too many complaints about accidentally setting no force powers at all
01058 //and starting a holocron game (making it basically just FFA)
01059
01060 ent->enemy = NULL;
01061
01062 ent->flags = FL_BOUNCE_HALF;
01063
01064 ent->s.modelindex = (ent->count - 128);//G_ModelIndex(holocronTypeModels[ent->count]);
01065 ent->s.eType = ET_HOLOCRON;
01066 ent->s.pos.trType = TR_GRAVITY;
01067 ent->s.pos.trTime = level.time;
01068
01069 ent->r.contents = CONTENTS_TRIGGER;
01070 ent->clipmask = MASK_SOLID;
01071
01072 ent->s.trickedentindex4 = ent->count;
01073
01074 if (forcePowerDarkLight[ent->count] == FORCE_DARKSIDE)
01075 {
01076 ent->s.trickedentindex3 = 1;
01077 }
01078 else if (forcePowerDarkLight[ent->count] == FORCE_LIGHTSIDE)
01079 {
01080 ent->s.trickedentindex3 = 2;
01081 }
01082 else
01083 {
01084 ent->s.trickedentindex3 = 3;
01085 }
01086
01087 ent->physicsObject = qtrue;
01088
01089 VectorCopy(ent->s.pos.trBase, ent->s.origin2); //remember the spawn spot
01090
01091 ent->touch = HolocronTouch;
01092
01093 trap_LinkEntity(ent);
01094
01095 ent->think = HolocronThink;
01096 ent->nextthink = level.time + 50;
01097 }
|
|
|
Definition at line 2645 of file g_misc.c. References G_EffectIndex(), G_ModelIndex(), G_SetOrigin(), gentity_s::genericValue1, gentity_t, level, maglock_link(), entityState_s::modelindex, gentity_s::nextthink, entityState_s::origin, gentity_s::s, START_TIME_FIND_LINKS, gentity_s::think, and level_locals_t::time.
02646 {
02647 //NOTE: May have to make these only work on doors that are either untargeted
02648 // or are targeted by a trigger, not doors fired off by scripts, counters
02649 // or other such things?
02650 self->s.modelindex = G_ModelIndex( "models/map_objects/imp_detention/door_lock.md3" );
02651 self->genericValue1 = G_EffectIndex( "maglock/explosion" );
02652
02653 G_SetOrigin( self, self->s.origin );
02654
02655 self->think = maglock_link;
02656 //FIXME: for some reason, when you re-load a level, these fail to find their doors...? Random? Testing an additional 200ms after the START_TIME_FIND_LINKS
02657 self->nextthink = level.time + START_TIME_FIND_LINKS+200;//START_TIME_FIND_LINKS;//because we need to let the doors link up and spawn their triggers first!
02658 }
|
|
|
Definition at line 249 of file g_misc.c. References entityState_s::angles, entityState_s::apos, G_FreeEntity(), G_ModelIndex(), G_SetOrigin(), gentity_t, entityShared_t::maxs, entityShared_t::mins, gentity_s::model, entityState_s::modelindex, entityState_s::origin, gentity_s::r, gentity_s::s, trap_LinkEntity(), trajectory_t::trBase, VectorCopy, and VectorSet.
00249 {
00250
00251 #if 0
00252 ent->s.modelindex = G_ModelIndex( ent->model );
00253 VectorSet (ent->r.mins, -16, -16, -16);
00254 VectorSet (ent->r.maxs, 16, 16, 16);
00255 trap_LinkEntity (ent);
00256
00257 G_SetOrigin( ent, ent->s.origin );
00258 VectorCopy( ent->s.angles, ent->s.apos.trBase );
00259 #else
00260 G_FreeEntity( ent );
00261 #endif
00262 }
|
|
|
|
|
|
Definition at line 277 of file g_misc.c. References G_FreeEntity(), and gentity_t.
00278 {
00279 G_FreeEntity( ent );
00280 }
|
|
|
Definition at line 375 of file g_misc.c. References entityState_s::clientNum, G_SpawnFloat(), gentity_t, entityShared_t::maxs, entityShared_t::mins, gentity_s::r, gentity_s::s, trap_LinkEntity(), and VectorClear.
00375 {
00376 float roll;
00377
00378 VectorClear( ent->r.mins );
00379 VectorClear( ent->r.maxs );
00380 trap_LinkEntity (ent);
00381
00382 G_SpawnFloat( "roll", "0", &roll );
00383
00384 ent->s.clientNum = roll/360.0 * 256;
00385 }
|
|
|
Definition at line 355 of file g_misc.c. References ET_PORTAL, entityState_s::eType, gentity_t, level, locateCamera(), entityShared_t::maxs, entityShared_t::mins, gentity_s::nextthink, entityState_s::origin, entityState_s::origin2, gentity_s::r, gentity_s::s, SVF_PORTAL, entityShared_t::svFlags, gentity_s::target, gentity_s::think, level_locals_t::time, trap_LinkEntity(), VectorClear, and VectorCopy.
00355 {
00356 VectorClear( ent->r.mins );
00357 VectorClear( ent->r.maxs );
00358 trap_LinkEntity (ent);
00359
00360 ent->r.svFlags = SVF_PORTAL;
00361 ent->s.eType = ET_PORTAL;
00362
00363 if ( !ent->target ) {
00364 VectorCopy( ent->s.origin, ent->s.origin2 );
00365 } else {
00366 ent->think = locateCamera;
00367 ent->nextthink = level.time + 100;
00368 }
00369 }
|
|
|
|
Definition at line 694 of file g_misc.c. References atof(), CS_SKYBOXORG, G_PortalifyEntities(), G_SpawnInt(), G_SpawnString(), G_SpawnVector(), gentity_t, level, gentity_s::nextthink, entityState_s::origin, gentity_s::s, gentity_s::think, level_locals_t::time, trap_SetConfigstring(), va(), and vec3_t.
00695 {
00696 char *fov;
00697 vec3_t fogv; //----(SA)
00698 int fogn; //----(SA)
00699 int fogf; //----(SA)
00700 int isfog = 0; // (SA)
00701
00702 float fov_x;
00703
00704 G_SpawnString ("fov", "80", &fov);
00705 fov_x = atof (fov);
00706
00707 isfog += G_SpawnVector ("fogcolor", "0 0 0", fogv);
00708 isfog += G_SpawnInt ("fognear", "0", &fogn);
00709 isfog += G_SpawnInt ("fogfar", "300", &fogf);
00710
00711 trap_SetConfigstring( CS_SKYBOXORG, va("%.2f %.2f %.2f %.1f %i %.2f %.2f %.2f %i %i", ent->s.origin[0], ent->s.origin[1], ent->s.origin[2], fov_x, (int)isfog, fogv[0], fogv[1], fogv[2], fogn, fogf ) );
00712
00713 ent->think = G_PortalifyEntities;
00714 ent->nextthink = level.time + 1050; //give it some time first so that all other entities are spawned.
00715 }
|
|
|
Definition at line 675 of file g_misc.c. References G_FreeEntity(), and gentity_t.
00676 {
00677 G_FreeEntity(ent);
00678 }
|
|
|
Definition at line 239 of file g_misc.c. References gentity_t.
00239 {
00240 }
|
|
|
Definition at line 3444 of file g_misc.c. References entityState_s::angles, AngleVectors(), BG_FindItemForWeapon(), gentity_s::client, G_ClientForShooter(), G_SpawnString(), gentity_t, GetIDForString(), level, misc_weapon_shooter_aim(), misc_weapon_shooter_use(), renderInfo_s::muzzlePoint, gentity_s::nextthink, NULL, entityState_s::origin, gentity_s::pos1, gclient_s::ps, RegisterItem(), gclient_s::renderInfo, gentity_s::s, START_TIME_LINK_ENTS, gentity_s::target, gentity_s::think, level_locals_t::time, gentity_s::use, VectorCopy, playerState_s::viewangles, gentity_s::wait, entityState_s::weapon, playerState_s::weapon, WP_BLASTER, and WPTable.
03445 {
03446 char *s;
03447
03448 //alloc a client just for the weapon code to use
03449 self->client = G_ClientForShooter();//(gclient_s *)gi.Malloc(sizeof(gclient_s), TAG_G_ALLOC, qtrue);
03450
03451 G_SpawnString("weapon", "", &s);
03452
03453 //set weapon
03454 self->s.weapon = self->client->ps.weapon = WP_BLASTER;
03455 if ( s && s[0] )
03456 {//use a different weapon
03457 self->s.weapon = self->client->ps.weapon = GetIDForString( WPTable, s );
03458 }
03459
03460 RegisterItem(BG_FindItemForWeapon(self->s.weapon));
03461
03462 //set where our muzzle is
03463 VectorCopy( self->s.origin, self->client->renderInfo.muzzlePoint );
03464 //permanently updated (don't need for MP)
03465 //self->client->renderInfo.mPCalcTime = Q3_INFINITE;
03466
03467 //set up to link
03468 if ( self->target )
03469 {
03470 self->think = misc_weapon_shooter_aim;
03471 self->nextthink = level.time + START_TIME_LINK_ENTS;
03472 }
03473 else
03474 {//just set aim angles
03475 VectorCopy( self->s.angles, self->client->ps.viewangles );
03476 AngleVectors( self->s.angles, self->pos1, NULL, NULL );
03477 }
03478
03479 //set up to fire when used
03480 self->use = misc_weapon_shooter_use;
03481
03482 if ( !self->wait )
03483 {
03484 self->wait = 500;
03485 }
03486 }
|
|
|
Definition at line 3491 of file g_misc.c. References G_FreeEntity(), and gentity_t.
03492 {
03493 G_FreeEntity(ent);
03494 }
|
|
|
Definition at line 3300 of file g_misc.c. References gentity_t, level, gentity_s::nextthink, ref_link(), START_TIME_LINK_ENTS, gentity_s::target, gentity_s::think, and level_locals_t::time.
|
|
|
Definition at line 1172 of file g_misc.c. References gentity_t, InitShooter(), and WP_BLASTER.
01172 {
01173 InitShooter( ent, WP_BLASTER);
01174 }
|
|
|
Definition at line 2599 of file g_misc.c. References G_FreeEntity(), g_gametype, G_SpawnInt(), gentity_s::genericValue5, gentity_s::genericValue6, gentity_t, GT_SINGLE_PLAYER, vmCvar_t::integer, gentity_s::use, and Use_Target_Escapetrig().
02600 {
02601 if (g_gametype.integer != GT_SINGLE_PLAYER)
02602 {
02603 G_FreeEntity(ent);
02604 return;
02605 }
02606
02607 G_SpawnInt( "escapetime", "60000", &ent->genericValue5);
02608 //time given (in ms) for the escape
02609 G_SpawnInt( "escapegoal", "0", &ent->genericValue6);
02610 //if non-0, when used, will end an ongoing escape instead of start it
02611
02612 ent->use = Use_Target_Escapetrig;
02613 }
|
|
|
Definition at line 2555 of file g_misc.c. References G_SpawnFloat(), G_SpawnInt(), gentity_s::genericValue5, gentity_s::genericValue6, gentity_t, gentity_s::speed, gentity_s::use, and Use_Target_Screenshake().
02556 {
02557 G_SpawnFloat( "intensity", "10", &ent->speed );
02558 //intensity of the shake
02559 G_SpawnInt( "duration", "800", &ent->genericValue5 );
02560 //duration of the shake
02561 G_SpawnInt( "globalshake", "1", &ent->genericValue6 );
02562 //non-0 if shake should be global (all clients). Otherwise, only in the PVS.
02563
02564 ent->use = Use_Target_Screenshake;
02565 }
|
|
|
Definition at line 484 of file g_misc.c. References entityState_s::angles, atof(), atoi(), entityShared_t::contents, CONTENTS_TERRAIN, CS_TERRAINS, EF_PERMANENT, entityState_s::eFlags, ET_TERRAIN, entityState_s::eType, g_RMG, G_SpawnString(), gentity_t, Info_SetValueForKey(), vmCvar_t::integer, MAX_INFO_STRING, MAX_INSTANCE_TYPES, MAX_QPATH, entityShared_t::maxs, entityShared_t::mins, gentity_s::model, entityState_s::modelindex, gentity_s::r, gentity_s::s, strlen(), SVF_NOCLIENT, entityShared_t::svFlags, trap_CM_RegisterTerrain(), trap_Cvar_Set(), trap_Cvar_VariableStringBuffer(), trap_LinkEntity(), trap_RMG_Init(), trap_SetBrushModel(), trap_SetConfigstring(), va(), and VectorClear.
00485 {
00486 char temp[MAX_INFO_STRING];
00487 char final[MAX_QPATH];
00488 char seed[MAX_QPATH];
00489 char missionType[MAX_QPATH];
00490 //char soundSet[MAX_QPATH];
00491 int shaderNum, i;
00492 char *value;
00493 int terrainID;
00494
00495 //Force it to 1 when there is terrain on the level.
00496 trap_Cvar_Set("RMG", "1");
00497 g_RMG.integer = 1;
00498
00499 VectorClear (ent->s.angles);
00500 trap_SetBrushModel( ent, ent->model );
00501
00502 // Get the shader from the top of the brush
00503 // shaderNum = gi.CM_GetShaderNum(s.modelindex);
00504 shaderNum = 0;
00505
00506 if (g_RMG.integer)
00507 {
00508 /*
00509 // Grab the default terrain file from the RMG cvar
00510 trap_Cvar_VariableStringBuffer("RMG_terrain", temp, MAX_QPATH);
00511 Com_sprintf(final, MAX_QPATH, "%s", temp);
00512 AddSpawnField("terrainDef", temp);
00513
00514 trap_Cvar_VariableStringBuffer("RMG_instances", temp, MAX_QPATH);
00515 Com_sprintf(final, MAX_QPATH, "%s", temp);
00516 AddSpawnField("instanceDef", temp);
00517
00518 trap_Cvar_VariableStringBuffer("RMG_miscents", temp, MAX_QPATH);
00519 Com_sprintf(final, MAX_QPATH, "%s", temp);
00520 AddSpawnField("miscentDef", temp);
00521 */
00522 //rww - disabled for now, don't want cvar overrides.
00523
00524 trap_Cvar_VariableStringBuffer("RMG_seed", seed, MAX_QPATH);
00525 trap_Cvar_VariableStringBuffer("RMG_mission", missionType, MAX_QPATH);
00526
00527 //rww - May want to implement these at some point.
00528 //trap_Cvar_VariableStringBuffer("RMG_soundset", soundSet, MAX_QPATH);
00529 //trap_SetConfigstring(CS_AMBIENT_SOUNDSETS, soundSet );
00530 }
00531
00532 // Get info required for the common init
00533 temp[0] = 0;
00534 G_SpawnString("heightmap", "", &value);
00535 Info_SetValueForKey(temp, "heightMap", value);
00536
00537 G_SpawnString("numpatches", "400", &value);
00538 Info_SetValueForKey(temp, "numPatches", va("%d", atoi(value)));
00539
00540 G_SpawnString("terxels", "4", &value);
00541 Info_SetValueForKey(temp, "terxels", va("%d", atoi(value)));
00542
00543 Info_SetValueForKey(temp, "seed", seed);
00544 Info_SetValueForKey(temp, "minx", va("%f", ent->r.mins[0]));
00545 Info_SetValueForKey(temp, "miny", va("%f", ent->r.mins[1]));
00546 Info_SetValueForKey(temp, "minz", va("%f", ent->r.mins[2]));
00547 Info_SetValueForKey(temp, "maxx", va("%f", ent->r.maxs[0]));
00548 Info_SetValueForKey(temp, "maxy", va("%f", ent->r.maxs[1]));
00549 Info_SetValueForKey(temp, "maxz", va("%f", ent->r.maxs[2]));
00550
00551 Info_SetValueForKey(temp, "modelIndex", va("%d", ent->s.modelindex));
00552
00553 G_SpawnString("terraindef", "grassyhills", &value);
00554 Info_SetValueForKey(temp, "terrainDef", value);
00555
00556 G_SpawnString("instancedef", "", &value);
00557 Info_SetValueForKey(temp, "instanceDef", value);
00558
00559 G_SpawnString("miscentdef", "", &value);
00560 Info_SetValueForKey(temp, "miscentDef", value);
00561
00562 Info_SetValueForKey(temp, "missionType", missionType);
00563
00564 for(i = 0; i < MAX_INSTANCE_TYPES; i++)
00565 {
00566 trap_Cvar_VariableStringBuffer(va("RMG_instance%d", i), final, MAX_QPATH);
00567 if(strlen(final))
00568 {
00569 Info_SetValueForKey(temp, va("inst%d", i), final);
00570 }
00571 }
00572
00573 // Set additional data required on the client only
00574 G_SpawnString("densitymap", "", &value);
00575 Info_SetValueForKey(temp, "densityMap", value);
00576
00577 Info_SetValueForKey(temp, "shader", va("%d", shaderNum));
00578 G_SpawnString("texturescale", "0.005", &value);
00579 Info_SetValueForKey(temp, "texturescale", va("%f", atof(value)));
00580
00581 // Initialise the common aspects of the terrain
00582 terrainID = trap_CM_RegisterTerrain(temp);
00583 // SetCommon(common);
00584
00585 Info_SetValueForKey(temp, "terrainId", va("%d", terrainID));
00586
00587 // Let the entity know if it is random generated or not
00588 // SetIsRandom(common->GetIsRandom());
00589
00590 // Let the game remember everything
00591 //level.landScapes[terrainID] = ent; //rww - also not referenced
00592
00593 // Send all the data down to the client
00594 trap_SetConfigstring(CS_TERRAINS + terrainID, temp);
00595
00596 // Make sure the contents are properly set
00597 ent->r.contents = CONTENTS_TERRAIN;
00598 ent->r.svFlags = SVF_NOCLIENT;
00599 ent->s.eFlags = EF_PERMANENT;
00600 ent->s.eType = ET_TERRAIN;
00601
00602 // Hook into the world so physics will work
00603 trap_LinkEntity(ent);
00604
00605 // If running RMG then initialize the terrain and handle team skins
00606 if ( g_RMG.integer )
00607 {
00608 trap_RMG_Init(terrainID);
00609
00610 /*
00611 if ( level.gametypeData->teams )
00612 {
00613 char temp[MAX_QPATH];
00614
00615 // Red team change from RMG ?
00616 trap_GetConfigstring ( CS_GAMETYPE_REDTEAM, temp, MAX_QPATH );
00617 if ( Q_stricmp ( temp, level.gametypeTeam[TEAM_RED] ) )
00618 {
00619 level.gametypeTeam[TEAM_RED] = trap_VM_LocalStringAlloc ( temp );
00620 }
00621
00622 // Blue team change from RMG ?
00623 trap_GetConfigstring ( CS_GAMETYPE_BLUETEAM, temp, MAX_QPATH );
00624 if ( Q_stricmp ( temp, level.gametypeTeam[TEAM_BLUE] ) )
00625 {
00626 level.gametypeTeam[TEAM_BLUE] = trap_VM_LocalStringAlloc ( temp );
00627 }
00628 }
00629 */
00630 }
00631 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 3036 of file g_misc.c. References reference_tag_s::angles, Com_Printf(), FirstFreeRefTag(), FirstFreeTagOwner(), reference_tag_s::flags, reference_tag_s::inuse, tagOwner_s::inuse, MAX_REFNAME, reference_tag_s::name, tagOwner_s::name, name, NULL, reference_tag_s::origin, Q_strlwr(), Q_strncpyz(), qtrue, reference_tag_s::radius, reference_tag_t, S_COLOR_RED, TAG_Find(), TAG_FindOwner(), TAG_GENERIC_NAME, tagOwner_t, vec3_t, and VectorCopy. Referenced by ref_link(), SP_waypoint_navgoal(), SP_waypoint_navgoal_1(), SP_waypoint_navgoal_2(), SP_waypoint_navgoal_4(), and SP_waypoint_navgoal_8().
03037 {
03038 reference_tag_t *tag = NULL;
03039 tagOwner_t *tagOwner = NULL;
03040
03041 //Make sure this tag's name isn't alread in use
03042 if ( TAG_Find( owner, name ) )
03043 {
03044 Com_Printf(S_COLOR_RED"Duplicate tag name \"%s\"\n", name );
03045 return NULL;
03046 }
03047
03048 //Attempt to add this to the owner's list
03049 if ( !owner || !owner[0] )
03050 {
03051 //If the owner isn't found, use the generic world name
03052 owner = TAG_GENERIC_NAME;
03053 }
03054
03055 tagOwner = TAG_FindOwner( owner );
03056
03057 if (!tagOwner)
03058 {
03059 //Create a new owner list
03060 tagOwner = FirstFreeTagOwner();//new tagOwner_t;
03061
03062 if (!tagOwner)
03063 {
03064 assert(0);
03065 return 0;
03066 }
03067 }
03068
03069 //This is actually reverse order of how SP does it because of the way we're storing/allocating.
03070 //Now that we have the owner, we want to get the first free reftag on the owner itself.
03071 tag = FirstFreeRefTag(tagOwner);
03072
03073 if (!tag)
03074 {
03075 assert(0);
03076 return NULL;
03077 }
03078
03079 //Copy the information
03080 VectorCopy( origin, tag->origin );
03081 VectorCopy( angles, tag->angles );
03082 tag->radius = radius;
03083 tag->flags = flags;
03084
03085 if ( !name || !name[0] )
03086 {
03087 Com_Printf(S_COLOR_RED"ERROR: Nameless ref_tag found at (%i %i %i)\n", (int)origin[0], (int)origin[1], (int)origin[2]);
03088 return NULL;
03089 }
03090
03091
03092 //Copy the name
03093 Q_strncpyz( (char *) tagOwner->name, owner, MAX_REFNAME );
03094 Q_strlwr( (char *) tagOwner->name ); //NOTENOTE: For case insensitive searches on a map
03095
03096 //Copy the name
03097 Q_strncpyz( (char *) tag->name, name, MAX_REFNAME );
03098 Q_strlwr( (char *) tag->name ); //NOTENOTE: For case insensitive searches on a map
03099
03100 tagOwner->inuse = qtrue;
03101 tag->inuse = qtrue;
03102
03103 return tag;
03104 }
|
|
||||||||||||
|
Definition at line 2975 of file g_misc.c. References reference_tag_s::inuse, MAX_TAGS, name, reference_tag_s::name, NULL, Q_stricmp(), reference_tag_t, TAG_FindOwner(), TAG_GENERIC_NAME, tagOwner_t, and tagOwner_s::tags. Referenced by TAG_Add(), TAG_GetAngles(), TAG_GetFlags(), TAG_GetOrigin(), TAG_GetOrigin2(), and TAG_GetRadius().
02976 {
02977 tagOwner_t *tagOwner = NULL;
02978 int i = 0;
02979
02980 if (owner && owner[0])
02981 {
02982 tagOwner = TAG_FindOwner(owner);
02983 }
02984 if (!tagOwner)
02985 {
02986 tagOwner = TAG_FindOwner(TAG_GENERIC_NAME);
02987 }
02988
02989 //Not found...
02990 if (!tagOwner)
02991 {
02992 tagOwner = TAG_FindOwner( TAG_GENERIC_NAME );
02993
02994 if (!tagOwner)
02995 {
02996 return NULL;
02997 }
02998 }
02999
03000 while (i < MAX_TAGS)
03001 {
03002 if (tagOwner->tags[i].inuse && !Q_stricmp(tagOwner->tags[i].name, name))
03003 {
03004 return &tagOwner->tags[i];
03005 }
03006 i++;
03007 }
03008
03009 //Try the generic owner instead
03010 tagOwner = TAG_FindOwner( TAG_GENERIC_NAME );
03011
03012 if (!tagOwner)
03013 {
03014 return NULL;
03015 }
03016
03017 i = 0;
03018 while (i < MAX_TAGS)
03019 {
03020 if (tagOwner->tags[i].inuse && !Q_stricmp(tagOwner->tags[i].name, name))
03021 {
03022 return &tagOwner->tags[i];
03023 }
03024 i++;
03025 }
03026
03027 return NULL;
03028 }
|
|
|
Definition at line 2953 of file g_misc.c. References tagOwner_s::inuse, MAX_TAG_OWNERS, name, NULL, Q_stricmp(), refTagOwnerMap, and tagOwner_t. Referenced by TAG_Add(), and TAG_Find().
02954 {
02955 int i = 0;
02956
02957 while (i < MAX_TAG_OWNERS)
02958 {
02959 if (refTagOwnerMap[i].inuse && !Q_stricmp(refTagOwnerMap[i].name, owner))
02960 {
02961 return &refTagOwnerMap[i];
02962 }
02963 i++;
02964 }
02965
02966 return NULL;
02967 }
|
|
||||||||||||||||
|
Definition at line 3153 of file g_misc.c. References reference_tag_s::angles, name, reference_tag_t, TAG_Find(), vec3_t, and VectorCopy. Referenced by Q3_GetTag().
03154 {
03155 reference_tag_t *tag = TAG_Find( owner, name );
03156
03157 if (!tag)
03158 {
03159 assert(0);
03160 return 0;
03161 }
03162
03163 VectorCopy( tag->angles, angles );
03164
03165 return 1;
03166 }
|
|
||||||||||||
|
Definition at line 3193 of file g_misc.c. References reference_tag_s::flags, name, reference_tag_t, and TAG_Find().
03194 {
03195 reference_tag_t *tag = TAG_Find( owner, name );
03196
03197 if (!tag)
03198 {
03199 assert(0);
03200 return 0;
03201 }
03202
03203 return tag->flags;
03204 }
|
|
||||||||||||||||
|
Definition at line 3112 of file g_misc.c. References name, reference_tag_s::origin, reference_tag_t, TAG_Find(), vec3_t, VectorClear, and VectorCopy. Referenced by Q3_GetTag().
03113 {
03114 reference_tag_t *tag = TAG_Find( owner, name );
03115
03116 if (!tag)
03117 {
03118 VectorClear(origin);
03119 return 0;
03120 }
03121
03122 VectorCopy( tag->origin, origin );
03123
03124 return 1;
03125 }
|
|
||||||||||||||||
|
Definition at line 3134 of file g_misc.c. References name, NULL, reference_tag_s::origin, reference_tag_t, TAG_Find(), vec3_t, and VectorCopy.
03135 {
03136 reference_tag_t *tag = TAG_Find( owner, name );
03137
03138 if( tag == NULL )
03139 {
03140 return 0;
03141 }
03142
03143 VectorCopy( tag->origin, origin );
03144
03145 return 1;
03146 }
|
|
||||||||||||
|
Definition at line 3174 of file g_misc.c. References name, reference_tag_s::radius, reference_tag_t, and TAG_Find().
03175 {
03176 reference_tag_t *tag = TAG_Find( owner, name );
03177
03178 if (!tag)
03179 {
03180 assert(0);
03181 return 0;
03182 }
03183
03184 return tag->radius;
03185 }
|
|
|
Definition at line 2930 of file g_misc.c. References MAX_TAG_OWNERS, MAX_TAGS, memset(), and refTagOwnerMap. Referenced by G_ShutdownGame().
02931 {
02932 int i = 0;
02933 int x = 0;
02934
02935 while (i < MAX_TAG_OWNERS)
02936 {
02937 while (x < MAX_TAGS)
02938 {
02939 memset(&refTagOwnerMap[i].tags[x], 0, sizeof(refTagOwnerMap[i].tags[x]));
02940 x++;
02941 }
02942 memset(&refTagOwnerMap[i], 0, sizeof(refTagOwnerMap[i]));
02943 i++;
02944 }
02945 }
|
|
||||||||||||||||
|
Definition at line 177 of file g_misc.c. References AngleVectors(), BG_PlayerStateToEntityState(), gentity_s::client, entityState_s::clientNum, entityShared_t::currentOrigin, EF_TELEPORT_BIT, playerState_s::eFlags, ET_NPC, entityState_s::eType, EV_PLAYER_TELEPORT_IN, EV_PLAYER_TELEPORT_OUT, G_KillBox(), G_TempEntity(), gentity_t, NULL, playerState_s::origin, playerState_s::pm_flags, playerState_s::pm_time, PMF_TIME_KNOCKBACK, gclient_s::ps, qboolean, qfalse, qtrue, gentity_s::r, gentity_s::s, gclient_s::sess, clientSession_t::sessionTeam, SetClientViewAngle(), TEAM_SPECTATOR, trap_LinkEntity(), trap_UnlinkEntity(), vec3_t, VectorCopy, VectorScale, and playerState_s::velocity. Referenced by Cmd_SetViewpos_f(), hyperspace_touch(), target_teleporter_use(), and trigger_teleporter_touch().
00177 {
00178 gentity_t *tent;
00179 qboolean isNPC = qfalse;
00180 if (player->s.eType == ET_NPC)
00181 {
00182 isNPC = qtrue;
00183 }
00184
00185 // use temp events at source and destination to prevent the effect
00186 // from getting dropped by a second player event
00187 if ( player->client->sess.sessionTeam != TEAM_SPECTATOR ) {
00188 tent = G_TempEntity( player->client->ps.origin, EV_PLAYER_TELEPORT_OUT );
00189 tent->s.clientNum = player->s.clientNum;
00190
00191 tent = G_TempEntity( origin, EV_PLAYER_TELEPORT_IN );
00192 tent->s.clientNum = player->s.clientNum;
00193 }
00194
00195 // unlink to make sure it can't possibly interfere with G_KillBox
00196 trap_UnlinkEntity (player);
00197
00198 VectorCopy ( origin, player->client->ps.origin );
00199 player->client->ps.origin[2] += 1;
00200
00201 // spit the player out
00202 AngleVectors( angles, player->client->ps.velocity, NULL, NULL );
00203 VectorScale( player->client->ps.velocity, 400, player->client->ps.velocity );
00204 player->client->ps.pm_time = 160; // hold time
00205 player->client->ps.pm_flags |= PMF_TIME_KNOCKBACK;
00206
00207 // toggle the teleport bit so the client knows to not lerp
00208 player->client->ps.eFlags ^= EF_TELEPORT_BIT;
00209
00210 // set angles
00211 SetClientViewAngle( player, angles );
00212
00213 // kill anything at the destination
00214 if ( player->client->sess.sessionTeam != TEAM_SPECTATOR ) {
00215 G_KillBox (player);
00216 }
00217
00218 // save results of pmove
00219 BG_PlayerStateToEntityState( &player->client->ps, &player->s, qtrue );
00220 if (isNPC)
00221 {
00222 player->s.eType = ET_NPC;
00223 }
00224
00225 // use the precise origin for linking
00226 VectorCopy( player->client->ps.origin, player->r.currentOrigin );
00227
00228 if ( player->client->sess.sessionTeam != TEAM_SPECTATOR ) {
00229 trap_LinkEntity (player);
00230 }
00231 }
|
|
||||||||||||||||
|
Definition at line 1107 of file g_misc.c. References crandom, entityShared_t::currentOrigin, gentity_s::enemy, EV_FIRE_WEAPON, G_AddEvent(), gentity_t, gentity_s::movedir, entityState_s::origin, PerpendicularVector(), qfalse, gentity_s::r, gentity_s::random, gentity_s::s, vec3_t, VectorCopy, VectorMA, VectorNormalize(), VectorSubtract, entityState_s::weapon, WP_BLASTER, and WP_FireBlasterMissile(). Referenced by InitShooter().
01107 {
01108 vec3_t dir;
01109 float deg;
01110 vec3_t up, right;
01111
01112 // see if we have a target
01113 if ( ent->enemy ) {
01114 VectorSubtract( ent->enemy->r.currentOrigin, ent->s.origin, dir );
01115 VectorNormalize( dir );
01116 } else {
01117 VectorCopy( ent->movedir, dir );
01118 }
01119
01120 // randomize a bit
01121 PerpendicularVector( up, dir );
01122 CrossProduct( up, dir, right );
01123
01124 deg = crandom() * ent->random;
01125 VectorMA( dir, deg, up, dir );
01126
01127 deg = crandom() * ent->random;
01128 VectorMA( dir, deg, right, dir );
01129
01130 VectorNormalize( dir );
01131
01132 switch ( ent->s.weapon ) {
01133 case WP_BLASTER:
01134 WP_FireBlasterMissile( ent, ent->s.origin, dir, qfalse );
01135 break;
01136 }
01137
01138 G_AddEvent( ent, EV_FIRE_WEAPON, 0 );
01139 }
|
|
||||||||||||||||
|
||||||||||||||||
|
Definition at line 2543 of file g_misc.c. References G_ScreenShake(), gentity_s::genericValue5, gentity_s::genericValue6, gentity_t, NULL, entityState_s::origin, qboolean, qfalse, qtrue, gentity_s::s, and gentity_s::speed. Referenced by SP_target_screenshake().
02544 {
02545 qboolean bGlobal = qfalse;
02546
02547 if (ent->genericValue6)
02548 {
02549 bGlobal = qtrue;
02550 }
02551
02552 G_ScreenShake(ent->s.origin, NULL, ent->speed, ent->genericValue5, bGlobal);
02553 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 2541 of file g_misc.c. Referenced by CheckExitRules(), and Use_Target_Escapetrig(). |
|
|
Definition at line 2540 of file g_misc.c. Referenced by CheckExitRules(), Cmd_Team_f(), respawn(), and Use_Target_Escapetrig(). |
|
|
Definition at line 2886 of file g_misc.c. Referenced by FirstFreeTagOwner(), TAG_FindOwner(), and TAG_Init(). |
|
|
|