#include "q_shared.h"#include "bg_public.h"#include "bg_strap.h"#include "../cgame/cg_local.h"#include "../namespace_begin.h"#include "../namespace_end.h"Go to the source code of this file.
Defines | |
| #define | MAX_POOL_SIZE 512000 |
Functions | |
| qboolean | BG_FileExists (const char *fileName) |
| char * | CG_NewString (const char *string) |
| void | BG_ParseField (BG_field_t *l_fields, const char *key, const char *value, byte *ent) |
| qboolean | BG_LegalizedForcePowers (char *powerOut, int maxRank, qboolean freeSaber, int teamForce, int gametype, int fpDisabled) |
| float | vectoyaw (const vec3_t vec) |
| qboolean | BG_HasYsalamiri (int gametype, playerState_t *ps) |
| qboolean | BG_CanUseFPNow (int gametype, playerState_t *ps, int time, forcePowers_t power) |
| gitem_t * | BG_FindItemForPowerup (powerup_t pw) |
| gitem_t * | BG_FindItemForHoldable (holdable_t pw) |
| gitem_t * | BG_FindItemForWeapon (weapon_t weapon) |
| gitem_t * | BG_FindItemForAmmo (ammo_t ammo) |
| gitem_t * | BG_FindItem (const char *classname) |
| qboolean | BG_PlayerTouchesItem (playerState_t *ps, entityState_t *item, int atTime) |
| int | BG_ProperForceIndex (int power) |
| void | BG_CycleForce (playerState_t *ps, int direction) |
| int | BG_GetItemIndexByTag (int tag, int type) |
| qboolean | BG_IsItemSelectable (playerState_t *ps, int item) |
| void | BG_CycleInven (playerState_t *ps, int direction) |
| qboolean | BG_CanItemBeGrabbed (int gametype, const entityState_t *ent, const playerState_t *ps) |
| void | BG_EvaluateTrajectory (const trajectory_t *tr, int atTime, vec3_t result) |
| void | BG_EvaluateTrajectoryDelta (const trajectory_t *tr, int atTime, vec3_t result) |
| void | BG_AddPredictableEventToPlayerstate (int newEvent, int eventParm, playerState_t *ps) |
| void | BG_TouchJumpPad (playerState_t *ps, entityState_t *jumppad) |
| int | BG_EmplacedView (vec3_t baseAngles, vec3_t angles, float *newYaw, float constraint) |
| qboolean | BG_IsValidCharacterModel (const char *modelName, const char *skinName) |
| qboolean | BG_ValidateSkinForTeam (const char *modelName, char *skinName, int team, float *colors) |
| void | BG_PlayerStateToEntityState (playerState_t *ps, entityState_t *s, qboolean snap) |
| void | BG_PlayerStateToEntityStateExtraPolate (playerState_t *ps, entityState_t *s, int time, qboolean snap) |
| qhandle_t | trap_R_RegisterModel (const char *name) |
| qhandle_t | trap_R_RegisterSkin (const char *name) |
| int | BG_ModelCache (const char *modelName, const char *skinName) |
| void * | BG_Alloc (int size) |
| void * | BG_AllocUnaligned (int size) |
| void * | BG_TempAlloc (int size) |
| void | BG_TempFree (int size) |
| char * | BG_StringAlloc (const char *source) |
| qboolean | BG_OutOfMemory (void) |
Variables | |
| const char * | bgToggleableSurfaces [BG_NUM_TOGGLEABLE_SURFACES] |
| const int | bgToggleableSurfaceDebris [BG_NUM_TOGGLEABLE_SURFACES] |
| const char * | bg_customSiegeSoundNames [MAX_CUSTOM_SIEGE_SOUNDS] |
| char * | forceMasteryLevels [NUM_FORCE_MASTERY_LEVELS] |
| int | forceMasteryPoints [NUM_FORCE_MASTERY_LEVELS] |
| int | bgForcePowerCost [NUM_FORCE_POWERS][NUM_FORCE_POWER_LEVELS] |
| int | forcePowerSorted [NUM_FORCE_POWERS] |
| int | forcePowerDarkLight [NUM_FORCE_POWERS] |
| int | WeaponReadyAnim [WP_NUM_WEAPONS] |
| int | WeaponReadyLegsAnim [WP_NUM_WEAPONS] |
| int | WeaponAttackAnim [WP_NUM_WEAPONS] |
| gitem_t | bg_itemlist [] |
| int | bg_numItems = sizeof(bg_itemlist) / sizeof(bg_itemlist[0]) - 1 |
| char * | eventnames [] |
|
|
Definition at line 3316 of file bg_misc.c. Referenced by BG_OutOfMemory(), and BG_TempFree(). |
|
||||||||||||||||
|
Definition at line 2635 of file bg_misc.c. References Com_Printf(), eventnames, playerState_s::eventParms, playerState_s::events, playerState_s::eventSequence, vmCvar_t::integer, MAX_PS_EVENTS, playerState_t, playerState_s::pmove_framecount, qboolean, qfalse, qtrue, and trap_Cvar_Register(). Referenced by G_AddPredictableEvent(), PM_AddEvent(), PM_AddEventWithParm(), PM_SaberLockBreak(), PM_SaberLocked(), PM_SetSaberMove(), and Touch_Item().
02635 {
02636
02637 #ifdef _DEBUG
02638 {
02639 static vmCvar_t showEvents;
02640 static qboolean isRegistered = qfalse;
02641
02642 if (!isRegistered)
02643 {
02644 trap_Cvar_Register(&showEvents, "showevents", "0", 0);
02645 isRegistered = qtrue;
02646 }
02647
02648 if ( showEvents.integer != 0 ) {
02649 #ifdef QAGAME
02650 Com_Printf(" game event svt %5d -> %5d: num = %20s parm %d\n", ps->pmove_framecount/*ps->commandTime*/, ps->eventSequence, eventnames[newEvent], eventParm);
02651 #else
02652 Com_Printf("Cgame event svt %5d -> %5d: num = %20s parm %d\n", ps->pmove_framecount/*ps->commandTime*/, ps->eventSequence, eventnames[newEvent], eventParm);
02653 #endif
02654 }
02655 }
02656 #endif
02657 ps->events[ps->eventSequence & (MAX_PS_EVENTS-1)] = newEvent;
02658 ps->eventParms[ps->eventSequence & (MAX_PS_EVENTS-1)] = eventParm;
02659 ps->eventSequence++;
02660 }
|
|
|
Definition at line 3328 of file bg_misc.c. References Com_Error(), and ERR_DROP. Referenced by B_Alloc(), BG_AnimsetAlloc(), BG_StringAlloc(), CG_CreateNPCClient(), G_CreateAnimalNPC(), G_CreateFakeClient(), G_CreateFighterNPC(), G_CreateSpeederNPC(), G_CreateWalkerNPC(), New_NPC_t(), ParseAnimationEvtBlock(), UI_AnimsetAlloc(), and UI_InsertG2Pointer().
03329 {
03330 bg_poolSize = ((bg_poolSize + 0x00000003) & 0xfffffffc);
03331
03332 if (bg_poolSize + size > bg_poolTail)
03333 {
03334 Com_Error( ERR_DROP, "BG_Alloc: buffer exceeded tail (%d > %d)", bg_poolSize + size, bg_poolTail);
03335 return 0;
03336 }
03337
03338 bg_poolSize += size;
03339
03340 return &bg_pool[bg_poolSize-size];
03341 }
|
|
|
Definition at line 3343 of file bg_misc.c. References Com_Error(), and ERR_DROP.
03344 {
03345 if (bg_poolSize + size > bg_poolTail)
03346 {
03347 Com_Error( ERR_DROP, "BG_AllocUnaligned: buffer exceeded tail (%d > %d)", bg_poolSize + size, bg_poolTail);
03348 return 0;
03349 }
03350
03351 bg_poolSize += size;
03352
03353 return &bg_pool[bg_poolSize-size];
03354 }
|
|
||||||||||||||||
|
Definition at line 2192 of file bg_misc.c. References playerState_s::ammo, ammoData, bg_itemlist, bg_numItems, playerState_s::clientNum, Com_Error(), Com_Printf(), playerState_s::duelInProgress, EF_DROPPEDWEAPON, entityState_s::eFlags, entityState_t, ERR_DROP, playerState_s::fd, forcedata_s::forcePowersActive, FP_RAGE, entityState_s::generic1, gitem_s::giTag, gitem_t, gitem_s::giType, GT_CTF, GT_CTY, HI_SEEKER, playerState_s::isJediMaster, IT_AMMO, IT_ARMOR, IT_BAD, IT_HEALTH, IT_HOLDABLE, IT_POWERUP, IT_TEAM, IT_WEAPON, ammoData_s::max, entityState_s::modelindex, entityState_s::modelindex2, PERS_TEAM, playerState_s::persistant, playerState_t, entityState_s::powerups, playerState_s::powerups, PW_BLUEFLAG, PW_REDFLAG, PW_YSALAMIRI, qboolean, qfalse, qtrue, gitem_s::quantity, STAT_ARMOR, STAT_HEALTH, STAT_HOLDABLE_ITEMS, STAT_MAX_HEALTH, STAT_WEAPONS, playerState_s::stats, TEAM_BLUE, TEAM_RED, playerState_s::trueJedi, playerState_s::trueNonJedi, weaponData, WP_DET_PACK, WP_SABER, WP_THERMAL, and WP_TRIP_MINE. Referenced by Touch_Item().
02192 {
02193 gitem_t *item;
02194
02195 if ( ent->modelindex < 1 || ent->modelindex >= bg_numItems ) {
02196 Com_Error( ERR_DROP, "BG_CanItemBeGrabbed: index out of range" );
02197 }
02198
02199 item = &bg_itemlist[ent->modelindex];
02200
02201 if ( ps )
02202 {
02203 if ( ps->trueJedi )
02204 {//force powers and saber only
02205 if ( item->giType != IT_TEAM //not a flag
02206 && item->giType != IT_ARMOR//not shields
02207 && (item->giType != IT_WEAPON || item->giTag != WP_SABER)//not a saber
02208 && (item->giType != IT_HOLDABLE || item->giTag != HI_SEEKER)//not a seeker
02209 && (item->giType != IT_POWERUP || item->giTag == PW_YSALAMIRI) )//not a force pick-up
02210 {
02211 return qfalse;
02212 }
02213 }
02214 else if ( ps->trueNonJedi )
02215 {//can't pick up force powerups
02216 if ( (item->giType == IT_POWERUP && item->giTag != PW_YSALAMIRI) //if a powerup, can only can pick up ysalamiri
02217 || (item->giType == IT_HOLDABLE && item->giTag == HI_SEEKER)//if holdable, cannot pick up seeker
02218 || (item->giType == IT_WEAPON && item->giTag == WP_SABER ) )//or if it's a saber
02219 {
02220 return qfalse;
02221 }
02222 }
02223 if ( ps->isJediMaster && item && (item->giType == IT_WEAPON || item->giType == IT_AMMO))
02224 {//jedi master cannot pick up weapons
02225 return qfalse;
02226 }
02227 if ( ps->duelInProgress )
02228 { //no picking stuff up while in a duel, no matter what the type is
02229 return qfalse;
02230 }
02231 }
02232 else
02233 {//safety return since below code assumes a non-null ps
02234 return qfalse;
02235 }
02236
02237 switch( item->giType ) {
02238 case IT_WEAPON:
02239 if (ent->generic1 == ps->clientNum && ent->powerups)
02240 {
02241 return qfalse;
02242 }
02243 if (!(ent->eFlags & EF_DROPPEDWEAPON) && (ps->stats[STAT_WEAPONS] & (1 << item->giTag)) &&
02244 item->giTag != WP_THERMAL && item->giTag != WP_TRIP_MINE && item->giTag != WP_DET_PACK)
02245 { //weaponstay stuff.. if this isn't dropped, and you already have it, you don't get it.
02246 return qfalse;
02247 }
02248 if (item->giTag == WP_THERMAL || item->giTag == WP_TRIP_MINE || item->giTag == WP_DET_PACK)
02249 { //check to see if full on ammo for this, if so, then..
02250 int ammoIndex = weaponData[item->giTag].ammoIndex;
02251 if (ps->ammo[ammoIndex] >= ammoData[ammoIndex].max)
02252 { //don't need it
02253 return qfalse;
02254 }
02255 }
02256 return qtrue; // weapons are always picked up
02257
02258 case IT_AMMO:
02259 if (item->giTag == -1)
02260 { //special case for "all ammo" packs
02261 return qtrue;
02262 }
02263 if ( ps->ammo[item->giTag] >= ammoData[item->giTag].max) {
02264 return qfalse; // can't hold any more
02265 }
02266 return qtrue;
02267
02268 case IT_ARMOR:
02269 if ( ps->stats[STAT_ARMOR] >= ps->stats[STAT_MAX_HEALTH]/* * item->giTag*/ ) {
02270 return qfalse;
02271 }
02272 return qtrue;
02273
02274 case IT_HEALTH:
02275 // small and mega healths will go over the max, otherwise
02276 // don't pick up if already at max
02277 if ((ps->fd.forcePowersActive & (1 << FP_RAGE)))
02278 {
02279 return qfalse;
02280 }
02281
02282 if ( item->quantity == 5 || item->quantity == 100 ) {
02283 if ( ps->stats[STAT_HEALTH] >= ps->stats[STAT_MAX_HEALTH] * 2 ) {
02284 return qfalse;
02285 }
02286 return qtrue;
02287 }
02288
02289 if ( ps->stats[STAT_HEALTH] >= ps->stats[STAT_MAX_HEALTH] ) {
02290 return qfalse;
02291 }
02292 return qtrue;
02293
02294 case IT_POWERUP:
02295 if (ps && (ps->powerups[PW_YSALAMIRI]))
02296 {
02297 if (item->giTag != PW_YSALAMIRI)
02298 {
02299 return qfalse;
02300 }
02301 }
02302 return qtrue; // powerups are always picked up
02303
02304 case IT_TEAM: // team items, such as flags
02305 if( gametype == GT_CTF || gametype == GT_CTY ) {
02306 // ent->modelindex2 is non-zero on items if they are dropped
02307 // we need to know this because we can pick up our dropped flag (and return it)
02308 // but we can't pick up our flag at base
02309 if (ps->persistant[PERS_TEAM] == TEAM_RED) {
02310 if (item->giTag == PW_BLUEFLAG ||
02311 (item->giTag == PW_REDFLAG && ent->modelindex2) ||
02312 (item->giTag == PW_REDFLAG && ps->powerups[PW_BLUEFLAG]) )
02313 return qtrue;
02314 } else if (ps->persistant[PERS_TEAM] == TEAM_BLUE) {
02315 if (item->giTag == PW_REDFLAG ||
02316 (item->giTag == PW_BLUEFLAG && ent->modelindex2) ||
02317 (item->giTag == PW_BLUEFLAG && ps->powerups[PW_REDFLAG]) )
02318 return qtrue;
02319 }
02320 }
02321
02322 return qfalse;
02323
02324 case IT_HOLDABLE:
02325 if ( ps->stats[STAT_HOLDABLE_ITEMS] & (1 << item->giTag))
02326 {
02327 return qfalse;
02328 }
02329 return qtrue;
02330
02331 case IT_BAD:
02332 Com_Error( ERR_DROP, "BG_CanItemBeGrabbed: IT_BAD" );
02333 default:
02334 #ifndef Q3_VM
02335 #ifndef NDEBUG // bk0001204
02336 Com_Printf("BG_CanItemBeGrabbed: unknown enum %d\n", item->giType );
02337 #endif
02338 #endif
02339 break;
02340 }
02341
02342 return qfalse;
02343 }
|
|
||||||||||||||||||||
|
Definition at line 1810 of file bg_misc.c. References BG_HasYsalamiri(), BROKENLIMB_LARM, BROKENLIMB_RARM, playerState_s::brokenLimbs, playerState_s::duelInProgress, playerState_s::fallingToDeath, forcePowers_t, playerState_s::forceRestricted, FP_DRAIN, FP_GRIP, FP_LEVITATION, FP_LIGHTNING, FP_PULL, FP_PUSH, FP_SABER_DEFENSE, FP_SABER_OFFENSE, playerState_s::m_iVehicleNum, playerState_t, qboolean, qfalse, qtrue, playerState_s::saberLockFrame, playerState_s::saberLockTime, playerState_s::trueNonJedi, playerState_s::weapon, and WP_EMPLACED_GUN. Referenced by ForcePowerUsableOn(), PM_ForceJumpingUp(), PM_WeaponLightsaber(), saberFirstThrown(), WP_ForcePowersUpdate(), and WP_ForcePowerUsable().
01811 {
01812 if (BG_HasYsalamiri(gametype, ps))
01813 {
01814 return qfalse;
01815 }
01816
01817 if ( ps->forceRestricted || ps->trueNonJedi )
01818 {
01819 return qfalse;
01820 }
01821
01822 if (ps->weapon == WP_EMPLACED_GUN)
01823 { //can't use any of your powers while on an emplaced weapon
01824 return qfalse;
01825 }
01826
01827 if (ps->m_iVehicleNum)
01828 { //can't use powers while riding a vehicle (this may change, I don't know)
01829 return qfalse;
01830 }
01831
01832 if (ps->duelInProgress)
01833 {
01834 if (power != FP_SABER_OFFENSE && power != FP_SABER_DEFENSE && /*power != FP_SABERTHROW &&*/
01835 power != FP_LEVITATION)
01836 {
01837 if (!ps->saberLockFrame || power != FP_PUSH)
01838 {
01839 return qfalse;
01840 }
01841 }
01842 }
01843
01844 if (ps->saberLockFrame || ps->saberLockTime > time)
01845 {
01846 if (power != FP_PUSH)
01847 {
01848 return qfalse;
01849 }
01850 }
01851
01852 if (ps->fallingToDeath)
01853 {
01854 return qfalse;
01855 }
01856
01857 if ((ps->brokenLimbs & (1 << BROKENLIMB_RARM)) ||
01858 (ps->brokenLimbs & (1 << BROKENLIMB_LARM)))
01859 { //powers we can't use with a broken arm
01860 switch (power)
01861 {
01862 case FP_PUSH:
01863 case FP_PULL:
01864 case FP_GRIP:
01865 case FP_LIGHTNING:
01866 case FP_DRAIN:
01867 return qfalse;
01868 default:
01869 break;
01870 }
01871 }
01872
01873 return qtrue;
01874 }
|
|
||||||||||||
|
Definition at line 2014 of file bg_misc.c. References BG_ProperForceIndex(), playerState_s::fd, forcedata_s::forcePowerSelected, forcedata_s::forcePowersKnown, forcePowerSorted, FP_LEVITATION, FP_SABER_DEFENSE, FP_SABER_OFFENSE, FP_SABERTHROW, NUM_FORCE_POWERS, and playerState_t. Referenced by CG_NextForcePower_f(), and CG_PrevForcePower_f().
02015 {
02016 int i = ps->fd.forcePowerSelected;
02017 int x = i;
02018 int presel = i;
02019 int foundnext = -1;
02020
02021 if (!ps->fd.forcePowersKnown & (1 << x) ||
02022 x >= NUM_FORCE_POWERS ||
02023 x == -1)
02024 { //apparently we have no valid force powers
02025 return;
02026 }
02027
02028 x = BG_ProperForceIndex(x);
02029 presel = x;
02030
02031 if (direction == 1)
02032 { //get the next power
02033 x++;
02034 }
02035 else
02036 { //get the previous power
02037 x--;
02038 }
02039
02040 if (x >= NUM_FORCE_POWERS)
02041 { //cycled off the end.. cycle around to the first
02042 x = 0;
02043 }
02044 if (x < 0)
02045 { //cycled off the beginning.. cycle around to the last
02046 x = NUM_FORCE_POWERS-1;
02047 }
02048
02049 i = forcePowerSorted[x]; //the "sorted" value of this power
02050
02051 while (x != presel)
02052 { //loop around to the current force power
02053 if (ps->fd.forcePowersKnown & (1 << i) && i != ps->fd.forcePowerSelected)
02054 { //we have the force power
02055 if (i != FP_LEVITATION &&
02056 i != FP_SABER_OFFENSE &&
02057 i != FP_SABER_DEFENSE &&
02058 i != FP_SABERTHROW)
02059 { //it's selectable
02060 foundnext = i;
02061 break;
02062 }
02063 }
02064
02065 if (direction == 1)
02066 { //next
02067 x++;
02068 }
02069 else
02070 { //previous
02071 x--;
02072 }
02073
02074 if (x >= NUM_FORCE_POWERS)
02075 { //loop around
02076 x = 0;
02077 }
02078 if (x < 0)
02079 { //loop around
02080 x = NUM_FORCE_POWERS-1;
02081 }
02082
02083 i = forcePowerSorted[x]; //set to the sorted value again
02084 }
02085
02086 if (foundnext != -1)
02087 { //found one, select it
02088 ps->fd.forcePowerSelected = foundnext;
02089 }
02090 }
|
|
||||||||||||
|
Definition at line 2121 of file bg_misc.c. References BG_GetItemIndexByTag(), BG_IsItemSelectable(), bg_itemlist, HI_NUM_HOLDABLE, IT_HOLDABLE, playerState_t, STAT_HOLDABLE_ITEM, STAT_HOLDABLE_ITEMS, and playerState_s::stats. Referenced by CG_NextInventory_f(), CG_PrevInventory_f(), and EWebDie().
02122 {
02123 int i;
02124 int dontFreeze = 0;
02125 int original;
02126
02127 i = bg_itemlist[ps->stats[STAT_HOLDABLE_ITEM]].giTag;
02128 original = i;
02129
02130 if (direction == 1)
02131 { //next
02132 i++;
02133 if (i == HI_NUM_HOLDABLE)
02134 {
02135 i = 1;
02136 }
02137 }
02138 else
02139 { //previous
02140 i--;
02141 if (i == 0)
02142 {
02143 i = HI_NUM_HOLDABLE-1;
02144 }
02145 }
02146
02147 while (i != original)
02148 { //go in a full loop until hitting something, if hit nothing then select nothing
02149 if (ps->stats[STAT_HOLDABLE_ITEMS] & (1 << i))
02150 { //we have it, select it.
02151 if (BG_IsItemSelectable(ps, i))
02152 {
02153 ps->stats[STAT_HOLDABLE_ITEM] = BG_GetItemIndexByTag(i, IT_HOLDABLE);
02154 break;
02155 }
02156 }
02157
02158 if (direction == 1)
02159 { //next
02160 i++;
02161 }
02162 else
02163 { //previous
02164 i--;
02165 }
02166
02167 if (i <= 0)
02168 { //wrap around to the last
02169 i = HI_NUM_HOLDABLE-1;
02170 }
02171 else if (i >= HI_NUM_HOLDABLE)
02172 { //wrap around to the first
02173 i = 1;
02174 }
02175
02176 dontFreeze++;
02177 if (dontFreeze >= 32)
02178 { //yeah, sure, whatever (it's 2 am and I'm paranoid and can't frickin think)
02179 break;
02180 }
02181 }
02182 }
|
|
||||||||||||||||||||
|
Definition at line 2703 of file bg_misc.c. References AngleSubtract(), vec3_t, and YAW. Referenced by CG_EmplacedView(), CG_Player(), EWebThink(), and FireWeapon().
02704 {
02705 float dif = AngleSubtract(baseAngles[YAW], angles[YAW]);
02706
02707 if (dif > constraint ||
02708 dif < -constraint)
02709 {
02710 float amt;
02711
02712 if (dif > constraint)
02713 {
02714 amt = (dif-constraint);
02715 dif = constraint;
02716 }
02717 else if (dif < -constraint)
02718 {
02719 amt = (dif+constraint);
02720 dif = -constraint;
02721 }
02722 else
02723 {
02724 amt = 0.0f;
02725 }
02726
02727 *newYaw = AngleSubtract(angles[YAW], -dif);
02728
02729 if (amt > 1.0f || amt < -1.0f)
02730 { //significant, force the view
02731 return 2;
02732 }
02733 else
02734 { //just a little out of range
02735 return 1;
02736 }
02737 }
02738
02739 return 0;
02740 }
|
|
||||||||||||||||
|
Definition at line 2353 of file bg_misc.c. References Com_Error(), cos(), DEFAULT_GRAVITY, DEG2RAD, ERR_DROP, M_PI, sin(), TR_GRAVITY, TR_INTERPOLATE, TR_LINEAR, TR_LINEAR_STOP, TR_NONLINEAR_STOP, TR_SINE, TR_STATIONARY, trajectory_t::trBase, trajectory_t::trDelta, trajectory_t::trDuration, trajectory_t::trTime, trajectory_t::trType, vec3_t, VectorCopy, and VectorMA. Referenced by BG_PlayerTouchesItem(), CG_AddFragment(), CG_AdjustPositionForMover(), CG_BloodTrail(), CG_CalcEntityLerpPositions(), CG_CheckEvents(), CG_DrawRadar(), CG_ResetPlayerEntity(), fx_runner_think(), G_ExplodeMissile(), G_MoverTeam(), G_RunItem(), G_RunMissile(), G_RunObject(), SetMoverState(), thermalDetonatorExplode(), WP_LobFire(), and WP_SaberPositionUpdate().
02353 {
02354 float deltaTime;
02355 float phase;
02356
02357 switch( tr->trType ) {
02358 case TR_STATIONARY:
02359 case TR_INTERPOLATE:
02360 VectorCopy( tr->trBase, result );
02361 break;
02362 case TR_LINEAR:
02363 deltaTime = ( atTime - tr->trTime ) * 0.001; // milliseconds to seconds
02364 VectorMA( tr->trBase, deltaTime, tr->trDelta, result );
02365 break;
02366 case TR_SINE:
02367 deltaTime = ( atTime - tr->trTime ) / (float) tr->trDuration;
02368 phase = sin( deltaTime * M_PI * 2 );
02369 VectorMA( tr->trBase, phase, tr->trDelta, result );
02370 break;
02371 case TR_LINEAR_STOP:
02372 if ( atTime > tr->trTime + tr->trDuration ) {
02373 atTime = tr->trTime + tr->trDuration;
02374 }
02375 deltaTime = ( atTime - tr->trTime ) * 0.001; // milliseconds to seconds
02376 if ( deltaTime < 0 ) {
02377 deltaTime = 0;
02378 }
02379 VectorMA( tr->trBase, deltaTime, tr->trDelta, result );
02380 break;
02381 case TR_NONLINEAR_STOP:
02382 if ( atTime > tr->trTime + tr->trDuration )
02383 {
02384 atTime = tr->trTime + tr->trDuration;
02385 }
02386 //new slow-down at end
02387 if ( atTime - tr->trTime > tr->trDuration || atTime - tr->trTime <= 0 )
02388 {
02389 deltaTime = 0;
02390 }
02391 else
02392 {//FIXME: maybe scale this somehow? So that it starts out faster and stops faster?
02393 deltaTime = tr->trDuration*0.001f*((float)cos( DEG2RAD(90.0f - (90.0f*((float)atTime-tr->trTime)/(float)tr->trDuration)) ));
02394 }
02395 VectorMA( tr->trBase, deltaTime, tr->trDelta, result );
02396 break;
02397 case TR_GRAVITY:
02398 deltaTime = ( atTime - tr->trTime ) * 0.001; // milliseconds to seconds
02399 VectorMA( tr->trBase, deltaTime, tr->trDelta, result );
02400 result[2] -= 0.5 * DEFAULT_GRAVITY * deltaTime * deltaTime; // FIXME: local gravity...
02401 break;
02402 default:
02403 #ifdef QAGAME
02404 Com_Error( ERR_DROP, "BG_EvaluateTrajectory: [GAME SIDE] unknown trType: %i", tr->trType );
02405 #else
02406 Com_Error( ERR_DROP, "BG_EvaluateTrajectory: [CLIENTGAME SIDE] unknown trType: %i", tr->trType );
02407 #endif
02408 break;
02409 }
02410 }
|
|
||||||||||||||||
|
Definition at line 2419 of file bg_misc.c. References Com_Error(), cos(), DEFAULT_GRAVITY, DEG2RAD, ERR_DROP, M_PI, TR_GRAVITY, TR_INTERPOLATE, TR_LINEAR, TR_LINEAR_STOP, TR_NONLINEAR_STOP, TR_SINE, TR_STATIONARY, trajectory_t::trDelta, trajectory_t::trDuration, trajectory_t::trTime, trajectory_t::trType, vec3_t, VectorClear, VectorCopy, and VectorScale. Referenced by CG_ReflectVelocity(), G_BounceItem(), G_BounceMissile(), G_BounceObject(), and G_MissileImpact().
02419 {
02420 float deltaTime;
02421 float phase;
02422
02423 switch( tr->trType ) {
02424 case TR_STATIONARY:
02425 case TR_INTERPOLATE:
02426 VectorClear( result );
02427 break;
02428 case TR_LINEAR:
02429 VectorCopy( tr->trDelta, result );
02430 break;
02431 case TR_SINE:
02432 deltaTime = ( atTime - tr->trTime ) / (float) tr->trDuration;
02433 phase = cos( deltaTime * M_PI * 2 ); // derivative of sin = cos
02434 phase *= 0.5;
02435 VectorScale( tr->trDelta, phase, result );
02436 break;
02437 case TR_LINEAR_STOP:
02438 if ( atTime > tr->trTime + tr->trDuration ) {
02439 VectorClear( result );
02440 return;
02441 }
02442 VectorCopy( tr->trDelta, result );
02443 break;
02444 case TR_NONLINEAR_STOP:
02445 if ( atTime - tr->trTime > tr->trDuration || atTime - tr->trTime <= 0 )
02446 {
02447 VectorClear( result );
02448 return;
02449 }
02450 deltaTime = tr->trDuration*0.001f*((float)cos( DEG2RAD(90.0f - (90.0f*((float)atTime-tr->trTime)/(float)tr->trDuration)) ));
02451 VectorScale( tr->trDelta, deltaTime, result );
02452 break;
02453 case TR_GRAVITY:
02454 deltaTime = ( atTime - tr->trTime ) * 0.001; // milliseconds to seconds
02455 VectorCopy( tr->trDelta, result );
02456 result[2] -= DEFAULT_GRAVITY * deltaTime; // FIXME: local gravity...
02457 break;
02458 default:
02459 Com_Error( ERR_DROP, "BG_EvaluateTrajectoryDelta: unknown trType: %i", tr->trTime );
02460 break;
02461 }
02462 }
|
|
|
Definition at line 319 of file bg_misc.c. References FS_READ, qboolean, qfalse, qtrue, trap_FS_FCloseFile(), and trap_FS_FOpenFile(). Referenced by BG_ValidateSkinForTeam().
00320 {
00321 if (fileName && fileName[0])
00322 {
00323 int fh = 0;
00324 trap_FS_FOpenFile(fileName, &fh, FS_READ);
00325 if (fh > 0)
00326 {
00327 trap_FS_FCloseFile(fh);
00328 return qtrue;
00329 }
00330 }
00331
00332 return qfalse;
00333 }
|
|
|
Definition at line 1960 of file bg_misc.c. References bg_itemlist, gitem_s::classname, gitem_t, NULL, and Q_stricmp(). Referenced by Cmd_Give_f(), G_CheckTeamItems(), G_PrecacheDispensers(), ItemUse_UseDisp(), and SP_gametype_item().
|
|
|
Definition at line 1941 of file bg_misc.c. References bg_itemlist, gitem_s::classname, Com_Error(), ERR_DROP, gitem_s::giTag, gitem_t, gitem_s::giType, IT_AMMO, and NULL. Referenced by NPC_Mark1_Precache(), NPC_Mark2_Precache(), NPC_Probe_Precache(), NPC_Sentry_Precache(), and NPC_ShadowTrooper_Precache().
|
|
|
Definition at line 1901 of file bg_misc.c. References bg_itemlist, bg_numItems, Com_Error(), ERR_DROP, gitem_s::giTag, gitem_t, gitem_s::giType, holdable_t, IT_HOLDABLE, and NULL. Referenced by G_SiegeRegisterWeaponsAndHoldables(), PlaceShield(), and UI_SiegeSetCvarsForClass().
01901 {
01902 int i;
01903
01904 for ( i = 0 ; i < bg_numItems ; i++ ) {
01905 if ( bg_itemlist[i].giType == IT_HOLDABLE && bg_itemlist[i].giTag == pw ) {
01906 return &bg_itemlist[i];
01907 }
01908 }
01909
01910 Com_Error( ERR_DROP, "HoldableItem not found" );
01911
01912 return NULL;
01913 }
|
|
|
Definition at line 1881 of file bg_misc.c. References bg_itemlist, bg_numItems, gitem_s::giTag, gitem_t, gitem_s::giType, IT_POWERUP, IT_TEAM, NULL, and powerup_t. Referenced by CG_DrawFlagModel(), CG_DrawNewTeamInfo(), and TossClientItems().
01881 {
01882 int i;
01883
01884 for ( i = 0 ; i < bg_numItems ; i++ ) {
01885 if ( (bg_itemlist[i].giType == IT_POWERUP ||
01886 bg_itemlist[i].giType == IT_TEAM) &&
01887 bg_itemlist[i].giTag == pw ) {
01888 return &bg_itemlist[i];
01889 }
01890 }
01891
01892 return NULL;
01893 }
|
|
|
||||||||||||
|
Definition at line 2092 of file bg_misc.c. References bg_itemlist, bg_numItems, gitem_s::giTag, and gitem_s::giType. Referenced by BG_CycleInven(), BotUseInventoryItem(), CG_DrawInvenSelect(), CG_NextInventory_f(), CG_PrevInventory_f(), PmoveSingle(), TossClientWeapon(), and vmMain().
02093 { //Get the itemlist index from the tag and type
02094 int i = 0;
02095
02096 while (i < bg_numItems)
02097 {
02098 if (bg_itemlist[i].giTag == tag &&
02099 bg_itemlist[i].giType == type)
02100 {
02101 return i;
02102 }
02103
02104 i++;
02105 }
02106
02107 return 0;
02108 }
|
|
||||||||||||
|
Definition at line 1794 of file bg_misc.c. References GT_CTY, playerState_t, playerState_s::powerups, PW_BLUEFLAG, PW_REDFLAG, PW_YSALAMIRI, qboolean, qfalse, and qtrue. Referenced by BG_CanUseFPNow(), ForcePowerUsableOn(), PM_ForceJumpingUp(), PM_WeaponLightsaber(), saberFirstThrown(), WP_ForcePowersUpdate(), and WP_ForcePowerUsable().
01795 {
01796 if (gametype == GT_CTY &&
01797 (ps->powerups[PW_REDFLAG] || ps->powerups[PW_BLUEFLAG]))
01798 {
01799 return qtrue;
01800 }
01801
01802 if (ps->powerups[PW_YSALAMIRI])
01803 {
01804 return qtrue;
01805 }
01806
01807 return qfalse;
01808 }
|
|
||||||||||||
|
Definition at line 2111 of file bg_misc.c. References HI_AMMODISP, HI_HEALTHDISP, HI_JETPACK, playerState_t, qboolean, qfalse, and qtrue. Referenced by BG_CycleInven(), CG_DrawInvenSelect(), G_ItemUsable(), and PM_ItemUsable().
02112 {
02113 if (item == HI_HEALTHDISP || item == HI_AMMODISP ||
02114 item == HI_JETPACK)
02115 {
02116 return qfalse;
02117 }
02118 return qtrue;
02119 }
|
|
||||||||||||
|
Definition at line 2744 of file bg_misc.c. References Q_stricmp(), qboolean, qfalse, and qtrue. Referenced by BG_ValidateSkinForTeam(), and SetupGameGhoul2Model().
02745 {
02746 if (!Q_stricmp(skinName, "menu"))
02747 {
02748 return qfalse;
02749 }
02750 else if (!Q_stricmp(modelName, "kyle"))
02751 {
02752 if (!Q_stricmp(skinName, "fpls"))
02753 {
02754 return qfalse;
02755 }
02756 else if (!Q_stricmp(skinName, "fpls2"))
02757 {
02758 return qfalse;
02759 }
02760 else if (!Q_stricmp(skinName, "fpls3"))
02761 {
02762 return qfalse;
02763 }
02764 }
02765 return qtrue;
02766 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 439 of file bg_misc.c. References atoi(), bgForcePowerCost, FORCE_DARKSIDE, FORCE_LEVEL_3, FORCE_LIGHTSIDE, forceMasteryPoints, forcePowerDarkLight, FP_LEVITATION, FP_SABER_DEFENSE, FP_SABER_OFFENSE, FP_SABERTHROW, FP_TEAM_FORCE, FP_TEAM_HEAL, GT_TEAM, NUM_FORCE_POWERS, Q_strcat(), qboolean, qfalse, qtrue, strcpy(), strlen(), and va(). Referenced by UI_ForceConfigHandle(), UI_ReadLegalForce(), and WP_InitForcePowers().
00440 {
00441 char powerBuf[128];
00442 char readBuf[128];
00443 qboolean maintainsValidity = qtrue;
00444 int powerLen = strlen(powerOut);
00445 int i = 0;
00446 int c = 0;
00447 int allowedPoints = 0;
00448 int usedPoints = 0;
00449 int countDown = 0;
00450
00451 int final_Side;
00452 int final_Powers[NUM_FORCE_POWERS];
00453
00454 if (powerLen >= 128)
00455 { //This should not happen. If it does, this is obviously a bogus string.
00456 //They can have this string. Because I said so.
00457 strcpy(powerBuf, "7-1-032330000000001333");
00458 maintainsValidity = qfalse;
00459 }
00460 else
00461 {
00462 strcpy(powerBuf, powerOut); //copy it as the original
00463 }
00464
00465 //first of all, print the max rank into the string as the rank
00466 strcpy(powerOut, va("%i-", maxRank));
00467
00468 while (i < 128 && powerBuf[i] && powerBuf[i] != '-')
00469 {
00470 i++;
00471 }
00472 i++;
00473 while (i < 128 && powerBuf[i] && powerBuf[i] != '-')
00474 {
00475 readBuf[c] = powerBuf[i];
00476 c++;
00477 i++;
00478 }
00479 readBuf[c] = 0;
00480 i++;
00481 //at this point, readBuf contains the intended side
00482 final_Side = atoi(readBuf);
00483
00484 if (final_Side != FORCE_LIGHTSIDE &&
00485 final_Side != FORCE_DARKSIDE)
00486 { //Not a valid side. You will be dark. Because I said so. (this is something that should never actually happen unless you purposely feed in an invalid config)
00487 final_Side = FORCE_DARKSIDE;
00488 maintainsValidity = qfalse;
00489 }
00490
00491 if (teamForce)
00492 { //If we are under force-aligned teams, make sure we're on the right side.
00493 if (final_Side != teamForce)
00494 {
00495 final_Side = teamForce;
00496 //maintainsValidity = qfalse;
00497 //Not doing this, for now. Let them join the team with their filtered powers.
00498 }
00499 }
00500
00501 //Now we have established a valid rank, and a valid side.
00502 //Read the force powers in, and cut them down based on the various rules supplied.
00503 c = 0;
00504 while (i < 128 && powerBuf[i] && powerBuf[i] != '\n' && c < NUM_FORCE_POWERS)
00505 {
00506 readBuf[0] = powerBuf[i];
00507 readBuf[1] = 0;
00508 final_Powers[c] = atoi(readBuf);
00509 c++;
00510 i++;
00511 }
00512
00513 //final_Powers now contains all the stuff from the string
00514 //Set the maximum allowed points used based on the max rank level, and count the points actually used.
00515 allowedPoints = forceMasteryPoints[maxRank];
00516
00517 i = 0;
00518 while (i < NUM_FORCE_POWERS)
00519 { //if this power doesn't match the side we're on, then 0 it now.
00520 if (final_Powers[i] &&
00521 forcePowerDarkLight[i] &&
00522 forcePowerDarkLight[i] != final_Side)
00523 {
00524 final_Powers[i] = 0;
00525 //This is only likely to happen with g_forceBasedTeams. Let it slide.
00526 }
00527
00528 if ( final_Powers[i] &&
00529 (fpDisabled & (1 << i)) )
00530 { //if this power is disabled on the server via said server option, then we don't get it.
00531 final_Powers[i] = 0;
00532 }
00533
00534 i++;
00535 }
00536
00537 if (gametype < GT_TEAM)
00538 { //don't bother with team powers then
00539 final_Powers[FP_TEAM_HEAL] = 0;
00540 final_Powers[FP_TEAM_FORCE] = 0;
00541 }
00542
00543 usedPoints = 0;
00544 i = 0;
00545 while (i < NUM_FORCE_POWERS)
00546 {
00547 countDown = 0;
00548
00549 countDown = final_Powers[i];
00550
00551 while (countDown > 0)
00552 {
00553 usedPoints += bgForcePowerCost[i][countDown]; //[fp index][fp level]
00554 //if this is jump, or we have a free saber and it's offense or defense, take the level back down on level 1
00555 if ( countDown == 1 &&
00556 ((i == FP_LEVITATION) ||
00557 (i == FP_SABER_OFFENSE && freeSaber) ||
00558 (i == FP_SABER_DEFENSE && freeSaber)) )
00559 {
00560 usedPoints -= bgForcePowerCost[i][countDown];
00561 }
00562 countDown--;
00563 }
00564
00565 i++;
00566 }
00567
00568 if (usedPoints > allowedPoints)
00569 { //Time to do the fancy stuff. (meaning, slowly cut parts off while taking a guess at what is most or least important in the config)
00570 int attemptedCycles = 0;
00571 int powerCycle = 2;
00572 int minPow = 0;
00573
00574 if (freeSaber)
00575 {
00576 minPow = 1;
00577 }
00578
00579 maintainsValidity = qfalse;
00580
00581 while (usedPoints > allowedPoints)
00582 {
00583 c = 0;
00584
00585 while (c < NUM_FORCE_POWERS && usedPoints > allowedPoints)
00586 {
00587 if (final_Powers[c] && final_Powers[c] < powerCycle)
00588 { //kill in order of lowest powers, because the higher powers are probably more important
00589 if (c == FP_SABER_OFFENSE &&
00590 (final_Powers[FP_SABER_DEFENSE] > minPow || final_Powers[FP_SABERTHROW] > 0))
00591 { //if we're on saber attack, only suck it down if we have no def or throw either
00592 int whichOne = FP_SABERTHROW; //first try throw
00593
00594 if (!final_Powers[whichOne])
00595 {
00596 whichOne = FP_SABER_DEFENSE; //if no throw, drain defense
00597 }
00598
00599 while (final_Powers[whichOne] > 0 && usedPoints > allowedPoints)
00600 {
00601 if ( final_Powers[whichOne] > 1 ||
00602 ( (whichOne != FP_SABER_OFFENSE || !freeSaber) &&
00603 (whichOne != FP_SABER_DEFENSE || !freeSaber) ) )
00604 { //don't take attack or defend down on level 1 still, if it's free
00605 usedPoints -= bgForcePowerCost[whichOne][final_Powers[whichOne]];
00606 final_Powers[whichOne]--;
00607 }
00608 else
00609 {
00610 break;
00611 }
00612 }
00613 }
00614 else
00615 {
00616 while (final_Powers[c] > 0 && usedPoints > allowedPoints)
00617 {
00618 if ( final_Powers[c] > 1 ||
00619 ((c != FP_LEVITATION) &&
00620 (c != FP_SABER_OFFENSE || !freeSaber) &&
00621 (c != FP_SABER_DEFENSE || !freeSaber)) )
00622 {
00623 usedPoints -= bgForcePowerCost[c][final_Powers[c]];
00624 final_Powers[c]--;
00625 }
00626 else
00627 {
00628 break;
00629 }
00630 }
00631 }
00632 }
00633
00634 c++;
00635 }
00636
00637 powerCycle++;
00638 attemptedCycles++;
00639
00640 if (attemptedCycles > NUM_FORCE_POWERS)
00641 { //I think this should be impossible. But just in case.
00642 break;
00643 }
00644 }
00645
00646 if (usedPoints > allowedPoints)
00647 { //Still? Fine then.. we will kill all of your powers, except the freebies.
00648 i = 0;
00649
00650 while (i < NUM_FORCE_POWERS)
00651 {
00652 final_Powers[i] = 0;
00653 if (i == FP_LEVITATION ||
00654 (i == FP_SABER_OFFENSE && freeSaber) ||
00655 (i == FP_SABER_DEFENSE && freeSaber))
00656 {
00657 final_Powers[i] = 1;
00658 }
00659 i++;
00660 }
00661 usedPoints = 0;
00662 }
00663 }
00664
00665 if (freeSaber)
00666 {
00667 if (final_Powers[FP_SABER_OFFENSE] < 1)
00668 {
00669 final_Powers[FP_SABER_OFFENSE] = 1;
00670 }
00671 if (final_Powers[FP_SABER_DEFENSE] < 1)
00672 {
00673 final_Powers[FP_SABER_DEFENSE] = 1;
00674 }
00675 }
00676 if (final_Powers[FP_LEVITATION] < 1)
00677 {
00678 final_Powers[FP_LEVITATION] = 1;
00679 }
00680
00681 i = 0;
00682 while (i < NUM_FORCE_POWERS)
00683 {
00684 if (final_Powers[i] > FORCE_LEVEL_3)
00685 {
00686 final_Powers[i] = FORCE_LEVEL_3;
00687 }
00688 i++;
00689 }
00690
00691 if (fpDisabled)
00692 { //If we specifically have attack or def disabled, force them up to level 3. It's the way
00693 //things work for the case of all powers disabled.
00694 //If jump is disabled, down-cap it to level 1. Otherwise don't do a thing.
00695 if (fpDisabled & (1 << FP_LEVITATION))
00696 {
00697 final_Powers[FP_LEVITATION] = 1;
00698 }
00699 if (fpDisabled & (1 << FP_SABER_OFFENSE))
00700 {
00701 final_Powers[FP_SABER_OFFENSE] = 3;
00702 }
00703 if (fpDisabled & (1 << FP_SABER_DEFENSE))
00704 {
00705 final_Powers[FP_SABER_DEFENSE] = 3;
00706 }
00707 }
00708
00709 if (final_Powers[FP_SABER_OFFENSE] < 1)
00710 {
00711 final_Powers[FP_SABER_DEFENSE] = 0;
00712 final_Powers[FP_SABERTHROW] = 0;
00713 }
00714
00715 //We finally have all the force powers legalized and stored locally.
00716 //Put them all into the string and return the result. We already have
00717 //the rank there, so print the side and the powers now.
00718 Q_strcat(powerOut, 128, va("%i-", final_Side));
00719
00720 i = strlen(powerOut);
00721 c = 0;
00722 while (c < NUM_FORCE_POWERS)
00723 {
00724 strcpy(readBuf, va("%i", final_Powers[c]));
00725 powerOut[i] = readBuf[0];
00726 c++;
00727 i++;
00728 }
00729 powerOut[i] = 0;
00730
00731 return maintainsValidity;
00732 }
|
|
||||||||||||
|
Definition at line 3200 of file bg_misc.c. References NULL, trap_G2API_CleanGhoul2Models(), trap_G2API_InitGhoul2Model(), trap_R_RegisterModel(), and trap_R_RegisterSkin(). Referenced by BG_PrecacheSabersForSiegeTeam().
03201 {
03202 #ifdef QAGAME
03203 void *g2 = NULL;
03204
03205 if (skinName && skinName[0])
03206 {
03207 trap_R_RegisterSkin(skinName);
03208 }
03209
03210 //I could hook up a precache ghoul2 function, but oh well, this works
03211 trap_G2API_InitGhoul2Model(&g2, modelName, 0, 0, 0, 0, 0);
03212 if (g2)
03213 { //now get rid of it
03214 trap_G2API_CleanGhoul2Models(&g2);
03215 }
03216 return 0;
03217 #else
03218 if (skinName && skinName[0])
03219 {
03220 trap_R_RegisterSkin(skinName);
03221 }
03222 return trap_R_RegisterModel(modelName);
03223 #endif
03224 }
|
|
|
Definition at line 3392 of file bg_misc.c. References MAX_POOL_SIZE, and qboolean.
03393 {
03394 return bg_poolSize >= MAX_POOL_SIZE;
03395 }
|
|
||||||||||||||||||||
|
Definition at line 358 of file bg_misc.c. References atof(), atoi(), byte, CG_NewString(), G_NewString(), gentity_t, Q3_SetParm(), Q_stricmp(), sscanf(), and vec3_t. Referenced by CG_SpawnCGameEntFromVars(), G_SpawnGEntityFromSpawnVars(), and SP_worldspawn().
00359 {
00360 BG_field_t *f;
00361 byte *b;
00362 float v;
00363 vec3_t vec;
00364
00365 for ( f=l_fields ; f->name ; f++ ) {
00366 if ( !Q_stricmp(f->name, key) ) {
00367 // found it
00368 b = (byte *)ent;
00369
00370 switch( f->type ) {
00371 case F_LSTRING:
00372 #ifdef QAGAME
00373 *(char **)(b+f->ofs) = G_NewString (value);
00374 #else
00375 *(char **)(b+f->ofs) = CG_NewString (value);
00376 #endif
00377 break;
00378 case F_VECTOR:
00379 sscanf (value, "%f %f %f", &vec[0], &vec[1], &vec[2]);
00380 ((float *)(b+f->ofs))[0] = vec[0];
00381 ((float *)(b+f->ofs))[1] = vec[1];
00382 ((float *)(b+f->ofs))[2] = vec[2];
00383 break;
00384 case F_INT:
00385 *(int *)(b+f->ofs) = atoi(value);
00386 break;
00387 case F_FLOAT:
00388 *(float *)(b+f->ofs) = atof(value);
00389 break;
00390 case F_ANGLEHACK:
00391 v = atof(value);
00392 ((float *)(b+f->ofs))[0] = 0;
00393 ((float *)(b+f->ofs))[1] = v;
00394 ((float *)(b+f->ofs))[2] = 0;
00395 break;
00396 #ifdef QAGAME
00397 case F_PARM1:
00398 case F_PARM2:
00399 case F_PARM3:
00400 case F_PARM4:
00401 case F_PARM5:
00402 case F_PARM6:
00403 case F_PARM7:
00404 case F_PARM8:
00405 case F_PARM9:
00406 case F_PARM10:
00407 case F_PARM11:
00408 case F_PARM12:
00409 case F_PARM13:
00410 case F_PARM14:
00411 case F_PARM15:
00412 case F_PARM16:
00413 Q3_SetParm( ((gentity_t *)(ent))->s.number, (f->type - F_PARM1), (char *) value );
00414 break;
00415 #endif
00416 default:
00417 case F_IGNORE:
00418 break;
00419 }
00420 return;
00421 }
00422 }
00423 }
|
|
||||||||||||||||
|
||||||||||||||||||||
|
||||||||||||||||
|
Definition at line 1979 of file bg_misc.c. References BG_EvaluateTrajectory(), entityState_t, playerState_s::origin, playerState_t, entityState_s::pos, qboolean, qfalse, qtrue, and vec3_t. Referenced by G_TouchTriggers().
01979 {
01980 vec3_t origin;
01981
01982 BG_EvaluateTrajectory( &item->pos, atTime, origin );
01983
01984 // we are ignoring ducked differences here
01985 if ( ps->origin[0] - origin[0] > 44
01986 || ps->origin[0] - origin[0] < -50
01987 || ps->origin[1] - origin[1] > 36
01988 || ps->origin[1] - origin[1] < -36
01989 || ps->origin[2] - origin[2] > 36
01990 || ps->origin[2] - origin[2] < -36 ) {
01991 return qfalse;
01992 }
01993
01994 return qtrue;
01995 }
|
|
|
Definition at line 1997 of file bg_misc.c. References forcePowerSorted, and NUM_FORCE_POWERS. Referenced by BG_CycleForce(), and CG_DrawForceSelect().
01998 {
01999 int i = 0;
02000
02001 while (i < NUM_FORCE_POWERS)
02002 {
02003 if (forcePowerSorted[i] == power)
02004 {
02005 return i;
02006 }
02007
02008 i++;
02009 }
02010
02011 return -1;
02012 }
|
|
|
Definition at line 3383 of file bg_misc.c. References BG_Alloc(), strcpy(), and strlen().
|
|
|
Definition at line 3356 of file bg_misc.c. References Com_Error(), and ERR_DROP. Referenced by B_TempAlloc(), BG_VehicleLoadParms(), BG_VehWeaponLoadParms(), and NPC_ParseParms().
03357 {
03358 size = ((size + 0x00000003) & 0xfffffffc);
03359
03360 if (bg_poolTail - size < bg_poolSize)
03361 {
03362 Com_Error( ERR_DROP, "BG_TempAlloc: buffer exceeded head (%d > %d)", bg_poolTail - size, bg_poolSize);
03363 return 0;
03364 }
03365
03366 bg_poolTail -= size;
03367
03368 return &bg_pool[bg_poolTail];
03369 }
|
|
|
Definition at line 3371 of file bg_misc.c. References Com_Error(), ERR_DROP, and MAX_POOL_SIZE. Referenced by B_TempFree(), BG_VehicleLoadParms(), BG_VehWeaponLoadParms(), and NPC_ParseParms().
03372 {
03373 size = ((size + 0x00000003) & 0xfffffffc);
03374
03375 if (bg_poolTail+size > MAX_POOL_SIZE)
03376 {
03377 Com_Error( ERR_DROP, "BG_TempFree: tail greater than size (%d > %d)", bg_poolTail+size, MAX_POOL_SIZE );
03378 }
03379
03380 bg_poolTail += size;
03381 }
|
|
||||||||||||
|
Definition at line 2667 of file bg_misc.c. References AngleNormalize180(), entityState_t, fabs(), playerState_s::jumppad_ent, playerState_s::jumppad_frame, entityState_s::number, entityState_s::origin2, PITCH, playerState_t, PM_FLOAT, PM_JETPACK, PM_NORMAL, playerState_s::pm_type, playerState_s::pmove_framecount, vec3_t, vectoangles(), VectorCopy, and playerState_s::velocity. Referenced by trigger_push_touch().
02667 {
02668 vec3_t angles;
02669 float p;
02670 int effectNum;
02671
02672 // spectators don't use jump pads
02673 if ( ps->pm_type != PM_NORMAL && ps->pm_type != PM_JETPACK && ps->pm_type != PM_FLOAT ) {
02674 return;
02675 }
02676
02677 // if we didn't hit this same jumppad the previous frame
02678 // then don't play the event sound again if we are in a fat trigger
02679 if ( ps->jumppad_ent != jumppad->number ) {
02680
02681 vectoangles( jumppad->origin2, angles);
02682 p = fabs( AngleNormalize180( angles[PITCH] ) );
02683 if( p < 45 ) {
02684 effectNum = 0;
02685 } else {
02686 effectNum = 1;
02687 }
02688 }
02689 // remember hitting this jumppad this frame
02690 ps->jumppad_ent = jumppad->number;
02691 ps->jumppad_frame = ps->pmove_framecount;
02692 // give the player the velocity from the jumppad
02693 VectorCopy( jumppad->origin2, ps->velocity );
02694 }
|
|
||||||||||||||||||||
|
Definition at line 2768 of file bg_misc.c. References BG_FileExists(), BG_IsValidCharacterModel(), MAX_QPATH, Q_strcat(), Q_stricmp(), Q_stricmpn(), Q_strncmp(), Q_strncpyz(), qboolean, qfalse, qtrue, strchr(), strlen(), TEAM_BLUE, TEAM_RED, and va(). Referenced by CG_NewClientInfo(), and SetupGameGhoul2Model().
02769 {
02770 if (!Q_stricmpn(modelName, "jedi_",5))
02771 { //argh, it's a custom player skin!
02772 if (team == TEAM_RED && colors)
02773 {
02774 colors[0] = 1.0f;
02775 colors[1] = 0.0f;
02776 colors[2] = 0.0f;
02777 }
02778 else if (team == TEAM_BLUE && colors)
02779 {
02780 colors[0] = 0.0f;
02781 colors[1] = 0.0f;
02782 colors[2] = 1.0f;
02783 }
02784 return qtrue;
02785 }
02786
02787 if (team == TEAM_RED)
02788 {
02789 if ( Q_stricmp( "red", skinName ) != 0 )
02790 {//not "red"
02791 if ( Q_stricmp( "blue", skinName ) == 0
02792 || Q_stricmp( "default", skinName ) == 0
02793 || strchr(skinName, '|')//a multi-skin playerModel
02794 || !BG_IsValidCharacterModel(modelName, skinName) )
02795 {
02796 Q_strncpyz(skinName, "red", MAX_QPATH);
02797 return qfalse;
02798 }
02799 else
02800 {//need to set it to red
02801 int len = strlen( skinName );
02802 if ( len < 3 )
02803 {//too short to be "red"
02804 Q_strcat(skinName, MAX_QPATH, "_red");
02805 }
02806 else
02807 {
02808 char *start = &skinName[len-3];
02809 if ( Q_strncmp( "red", start, 3 ) != 0 )
02810 {//doesn't already end in "red"
02811 if ( len+4 >= MAX_QPATH )
02812 {//too big to append "_red"
02813 Q_strncpyz(skinName, "red", MAX_QPATH);
02814 return qfalse;
02815 }
02816 else
02817 {
02818 Q_strcat(skinName, MAX_QPATH, "_red");
02819 }
02820 }
02821 }
02822 //if file does not exist, set to "red"
02823 if ( !BG_FileExists( va( "models/players/%s/model_%s.skin", modelName, skinName ) ) )
02824 {
02825 Q_strncpyz(skinName, "red", MAX_QPATH);
02826 }
02827 return qfalse;
02828 }
02829 }
02830
02831 }
02832 else if (team == TEAM_BLUE)
02833 {
02834 if ( Q_stricmp( "blue", skinName ) != 0 )
02835 {
02836 if ( Q_stricmp( "red", skinName ) == 0
02837 || Q_stricmp( "default", skinName ) == 0
02838 || strchr(skinName, '|')//a multi-skin playerModel
02839 || !BG_IsValidCharacterModel(modelName, skinName) )
02840 {
02841 Q_strncpyz(skinName, "blue", MAX_QPATH);
02842 return qfalse;
02843 }
02844 else
02845 {//need to set it to blue
02846 int len = strlen( skinName );
02847 if ( len < 4 )
02848 {//too short to be "blue"
02849 Q_strcat(skinName, MAX_QPATH, "_blue");
02850 }
02851 else
02852 {
02853 char *start = &skinName[len-4];
02854 if ( Q_strncmp( "blue", start, 4 ) != 0 )
02855 {//doesn't already end in "blue"
02856 if ( len+5 >= MAX_QPATH )
02857 {//too big to append "_blue"
02858 Q_strncpyz(skinName, "blue", MAX_QPATH);
02859 return qfalse;
02860 }
02861 else
02862 {
02863 Q_strcat(skinName, MAX_QPATH, "_blue");
02864 }
02865 }
02866 }
02867 //if file does not exist, set to "blue"
02868 if ( !BG_FileExists( va( "models/players/%s/model_%s.skin", modelName, skinName ) ) )
02869 {
02870 Q_strncpyz(skinName, "blue", MAX_QPATH);
02871 }
02872 return qfalse;
02873 }
02874 }
02875 }
02876 return qtrue;
02877 }
|
|
|
Definition at line 3344 of file cg_main.c. References CG_StrPool_Alloc(), and strlen(). Referenced by BG_ParseField().
03345 {
03346 char *newb, *new_p;
03347 int i,l;
03348
03349 l = strlen(string) + 1;
03350
03351 newb = CG_StrPool_Alloc( l );
03352
03353 new_p = newb;
03354
03355 // turn \n into a real linefeed
03356 for ( i=0 ; i< l ; i++ ) {
03357 if (string[i] == '\\' && i < l-1) {
03358 i++;
03359 if (string[i] == 'n') {
03360 *new_p++ = '\n';
03361 } else {
03362 *new_p++ = '\\';
03363 }
03364 } else {
03365 *new_p++ = string[i];
03366 }
03367 }
03368
03369 return newb;
03370 }
|
|
|
Definition at line 266 of file cg_syscalls.c.
00266 {
00267 return syscall( CG_R_REGISTERMODEL, name );
00268 }
|
|
|
Definition at line 270 of file cg_syscalls.c.
00270 {
00271 return syscall( CG_R_REGISTERSKIN, name );
00272 }
|
|
|
Definition at line 1773 of file bg_misc.c. References atan2(), M_PI, PITCH, vec3_t, and YAW. Referenced by ClientCommand(), ClientThink_real(), LookAtKiller(), NAV_Bypass(), NAVNEW_SidestepBlocker(), NPC_BSFlee(), NPC_BSSearch(), NPC_BSWander(), PM_AdjustAngleForWallJump(), PM_AdjustAngleForWallRun(), and PM_AdjustAngleForWallRunUp().
01773 {
01774 float yaw;
01775
01776 if (vec[YAW] == 0 && vec[PITCH] == 0) {
01777 yaw = 0;
01778 } else {
01779 if (vec[PITCH]) {
01780 yaw = ( atan2( vec[YAW], vec[PITCH]) * 180 / M_PI );
01781 } else if (vec[YAW] > 0) {
01782 yaw = 90;
01783 } else {
01784 yaw = 270;
01785 }
01786 if (yaw < 0) {
01787 yaw += 360;
01788 }
01789 }
01790
01791 return yaw;
01792 }
|
|
|
Definition at line 113 of file bg_misc.c. Referenced by CG_CustomSound(), CG_GetStringForVoiceSound(), CG_LoadCISounds(), and G_InitGame(). |
|
|
|
Definition at line 1771 of file bg_misc.c. Referenced by BG_CanItemBeGrabbed(), BG_FindItemForHoldable(), BG_FindItemForPowerup(), BG_GetItemIndexByTag(), CG_EntityEvent(), CG_Init(), CG_RegisterItemVisuals(), and SaveRegisteredItems(). |
|
|
Initial value:
{
{ 0, 2, 4, 6 },
{ 0, 0, 2, 6 },
{ 0, 2, 4, 6 },
{ 0, 1, 3, 6 },
{ 0, 1, 3, 6 },
{ 0, 4, 6, 8 },
{ 0, 1, 3, 6 },
{ 0, 2, 5, 8 },
{ 0, 4, 6, 8 },
{ 0, 2, 5, 8 },
{ 0, 1, 3, 6 },
{ 0, 1, 3, 6 },
{ 0, 1, 3, 6 },
{ 0, 2, 4, 6 },
{ 0, 2, 5, 8 },
{ 0, 1, 5, 8 },
{ 0, 1, 5, 8 },
{ 0, 4, 6, 8 }
}
Definition at line 174 of file bg_misc.c. Referenced by _UI_Refresh(), BG_LegalizedForcePowers(), UI_DrawForceStars(), UI_ForceConfigHandle(), UI_ForcePowerRank_HandleKey(), UI_ReadLegalForce(), and UpdateForceUsed(). |
|
|
Definition at line 78 of file bg_misc.c. Referenced by CG_G2Animated(). |
|
|
Definition at line 34 of file bg_misc.c. Referenced by CG_G2Animated(), and NPC_SetSurfaceOnOff(). |
|
|
Definition at line 2464 of file bg_misc.c. Referenced by BG_AddPredictableEventToPlayerstate(). |
|
|
Initial value:
{
"MASTERY0",
"MASTERY1",
"MASTERY2",
"MASTERY3",
"MASTERY4",
"MASTERY5",
"MASTERY6",
"MASTERY7",
}
Definition at line 150 of file bg_misc.c. Referenced by CG_DrawInformation(). |
|
|
Initial value:
{
0,
5,
10,
20,
30,
50,
75,
100
}
Definition at line 162 of file bg_misc.c. Referenced by BG_LegalizedForcePowers(), UI_ForceConfigHandle(), UI_ReadLegalForce(), and UpdateForceUsed(). |
|
|
Initial value:
{
FORCE_LIGHTSIDE,
0,
0,
0,
0,
FORCE_LIGHTSIDE,
FORCE_DARKSIDE,
FORCE_DARKSIDE,
FORCE_DARKSIDE,
FORCE_LIGHTSIDE,
FORCE_LIGHTSIDE,
FORCE_LIGHTSIDE,
FORCE_DARKSIDE,
FORCE_DARKSIDE,
0,
0,
0,
0
}
Definition at line 219 of file bg_misc.c. Referenced by BG_LegalizedForcePowers(), CG_Player(), SP_misc_holocron(), and WP_ForcePowersUpdate(). |
|
|
Initial value:
{
FP_TELEPATHY,
FP_HEAL,
FP_ABSORB,
FP_PROTECT,
FP_TEAM_HEAL,
FP_LEVITATION,
FP_SPEED,
FP_PUSH,
FP_PULL,
FP_SEE,
FP_LIGHTNING,
FP_DRAIN,
FP_RAGE,
FP_GRIP,
FP_TEAM_FORCE,
FP_SABER_OFFENSE,
FP_SABER_DEFENSE,
FP_SABERTHROW
}
Definition at line 197 of file bg_misc.c. Referenced by BG_CycleForce(), BG_ProperForceIndex(), CG_DrawForceSelect(), and vmMain(). |
|
|
Initial value: |
|
|
Initial value:
{
TORSO_DROPWEAP1,
TORSO_WEAPONREADY3,
TORSO_WEAPONREADY3,
BOTH_STAND2,
TORSO_WEAPONREADY2,
TORSO_WEAPONREADY3,
TORSO_WEAPONREADY3,
TORSO_WEAPONREADY3,
TORSO_WEAPONREADY3,
TORSO_WEAPONREADY3,
TORSO_WEAPONREADY3,
TORSO_WEAPONREADY3,
TORSO_WEAPONREADY10,
TORSO_WEAPONREADY10,
TORSO_WEAPONREADY10,
TORSO_WEAPONREADY3,
TORSO_WEAPONREADY2,
BOTH_STAND1,
TORSO_WEAPONREADY1
}
Definition at line 242 of file bg_misc.c. Referenced by BG_G2PlayerAngles(), and ClientSpawn(). |
|
|
Initial value: |