MCPcopy Create free account
hub / github.com/JACoders/OpenJK / PM_CheckForceUseButton

Function PM_CheckForceUseButton

code/game/bg_pmove.cpp:14216–14286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14214extern void ForceAbsorb( gentity_t *self );
14215extern void ForceSeeing( gentity_t *self );
14216void PM_CheckForceUseButton( gentity_t *ent, usercmd_t *ucmd )
14217{
14218 if ( !ent )
14219 {
14220 return;
14221 }
14222 if ( ucmd->buttons & BUTTON_USE_FORCE )
14223 {
14224 if (!(ent->client->ps.pm_flags & PMF_USEFORCE_HELD))
14225 {
14226 //impulse one shot
14227 switch ( showPowers[cg.forcepowerSelect] )
14228 {
14229 case FP_HEAL:
14230 ForceHeal( ent );
14231 break;
14232 case FP_SPEED:
14233 ForceSpeed( ent );
14234 break;
14235 case FP_PUSH:
14236 ForceThrow( ent, qfalse );
14237 break;
14238 case FP_PULL:
14239 ForceThrow( ent, qtrue );
14240 break;
14241 case FP_TELEPATHY:
14242 ForceTelepathy( ent );
14243 break;
14244 // Added 01/20/03 by AReis.
14245 // New Jedi Academy powers.
14246 case FP_RAGE: //duration - speed, invincibility and extra damage for short period, drains your health and leaves you weak and slow afterwards.
14247 ForceRage( ent );
14248 break;
14249 case FP_PROTECT: //duration - protect against physical/energy (level 1 stops blaster/energy bolts, level 2 stops projectiles, level 3 protects against explosions)
14250 ForceProtect( ent );
14251 break;
14252 case FP_ABSORB: //duration - protect against dark force powers (grip, lightning, drain - maybe push/pull, too?)
14253 ForceAbsorb( ent );
14254 break;
14255 case FP_SEE: //duration - detect/see hidden enemies
14256 ForceSeeing( ent );
14257 break;
14258 }
14259 }
14260 //these stay are okay to call every frame button is down
14261 switch ( showPowers[cg.forcepowerSelect] )
14262 {
14263 case FP_LEVITATION:
14264 ucmd->upmove = 127;
14265 break;
14266 case FP_GRIP:
14267 ucmd->buttons |= BUTTON_FORCEGRIP;
14268 break;
14269 case FP_LIGHTNING:
14270 ucmd->buttons |= BUTTON_FORCE_LIGHTNING;
14271 break;
14272 case FP_DRAIN:
14273 // FIXME! Failing at WP_ForcePowerUsable(). -AReis

Callers 1

ClientThinkFunction · 0.70

Calls 8

ForceHealFunction · 0.70
ForceSpeedFunction · 0.70
ForceThrowFunction · 0.70
ForceTelepathyFunction · 0.70
ForceRageFunction · 0.70
ForceProtectFunction · 0.70
ForceAbsorbFunction · 0.70
ForceSeeingFunction · 0.70

Tested by

no test coverage detected