codemp/game/bg_saber.c File Reference

#include "q_shared.h"
#include "bg_public.h"
#include "bg_local.h"
#include "w_saber.h"
#include "../namespace_begin.h"
#include "../namespace_end.h"

Go to the source code of this file.

Defines

#define AFLAG_IDLE   (SETANIM_FLAG_NORMAL)
#define AFLAG_ACTIVE   (SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD | SETANIM_FLAG_HOLDLESS)
#define AFLAG_WAIT   (SETANIM_FLAG_HOLD | SETANIM_FLAG_HOLDLESS)
#define AFLAG_FINISH   (SETANIM_FLAG_HOLD)
#define BACK_STAB_DISTANCE   128
#define FLIPHACK_DISTANCE   200
#define SABER_ALT_ATTACK_POWER   50
#define SABER_ALT_ATTACK_POWER_LR   10
#define SABER_ALT_ATTACK_POWER_FB   25

Functions

qboolean BG_SabersOff (playerState_t *ps)
saberInfo_tBG_MySaber (int clientNum, int saberNum)
int PM_irand_timesync (int val1, int val2)
void BG_ForcePowerDrain (playerState_t *ps, forcePowers_t forcePower, int overrideAmt)
qboolean BG_EnoughForcePowerForMove (int cost)
saberMoveName_t PM_AttackMoveForQuad (int quad)
qboolean PM_SaberKataDone (int curmove, int newmove)
int PM_SaberAnimTransitionAnim (int curmove, int newmove)
qboolean BG_InKnockDown (int anim)
saberMoveName_t PM_CheckStabDown (void)
int PM_SaberMoveQuadrantForMovement (usercmd_t *ucmd)
qboolean PM_SaberInBounce (int move)
qboolean PM_SaberInTransition (int move)
int PM_SaberAttackChainAngle (int move1, int move2)
void PM_SetAnimFrame (playerState_t *gent, int frame, qboolean torso, qboolean legs)
int PM_SaberLockWinAnim (qboolean victory, qboolean superBreak)
int PM_SaberLockLoseAnim (playerState_t *genemy, qboolean victory, qboolean superBreak)
int PM_SaberLockResultAnim (playerState_t *duelist, qboolean superBreak, qboolean won)
void PM_SaberLockBreak (playerState_t *genemy, qboolean victory, int strength)
qboolean BG_CheckIncrementLockAnim (int anim, int winOrLose)
qboolean ValidAnimFileIndex (int index)
void PM_SaberLocked (void)
qboolean PM_SaberInBrokenParry (int move)
int PM_BrokenParryForParry (int move)
qboolean PM_CanBackstab (void)
saberMoveName_t PM_SaberFlipOverAttackMove (void)
int PM_SaberBackflipAttackMove (void)
int PM_SaberDualJumpAttackMove (void)
qboolean PM_SomeoneInFront (trace_t *tr)
saberMoveName_t PM_SaberLungeAttackMove (qboolean noSpecials)
saberMoveName_t PM_SaberJumpAttackMove2 (void)
saberMoveName_t PM_SaberJumpAttackMove (void)
float PM_GroundDistance (void)
float PM_WalkableGroundDistance (void)
qboolean BG_SaberInTransitionAny (int move)
qboolean PM_SaberInReturn (int move)
saberMoveName_t PM_CheckPullAttack (void)
qboolean PM_InSecondaryStyle (void)
saberMoveName_t PM_SaberAttackForMovement (saberMoveName_t curmove)
int PM_KickMoveForConditions (void)
qboolean BG_InSlopeAnim (int anim)
qboolean PM_RunningAnim (int anim)
qboolean PM_SaberMoveOkayForKata (void)
qboolean PM_CanDoKata (void)
qboolean PM_CheckAltKickAttack (void)
qboolean PM_SaberPowerCheck (void)
qboolean PM_CanDoRollStab (void)
qboolean PM_WalkingAnim (int anim)
qboolean PM_SwimmingAnim (int anim)
int PM_SaberBounceForAttack (int move)
qboolean BG_SuperBreakLoseAnim (int anim)
qboolean BG_SuperBreakWinAnim (int anim)
void PM_WeaponLightsaber (void)
void PM_SetSaberMove (short newMove)

Variables

saberMoveData_t saberMoveData [LS_MOVE_MAX]
int transitionMove [Q_NUM_QUADS][Q_NUM_QUADS]
int saberMoveTransitionAngle [Q_NUM_QUADS][Q_NUM_QUADS]
int bg_parryDebounce [NUM_FORCE_POWER_LEVELS]


Define Documentation

#define AFLAG_ACTIVE   (SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD | SETANIM_FLAG_HOLDLESS)
 

Definition at line 115 of file bg_saber.c.

#define AFLAG_FINISH   (SETANIM_FLAG_HOLD)
 

Definition at line 117 of file bg_saber.c.

#define AFLAG_IDLE   (SETANIM_FLAG_NORMAL)
 

Definition at line 114 of file bg_saber.c.

#define AFLAG_WAIT   (SETANIM_FLAG_HOLD | SETANIM_FLAG_HOLDLESS)
 

Definition at line 116 of file bg_saber.c.

#define BACK_STAB_DISTANCE   128
 

Definition at line 1620 of file bg_saber.c.

Referenced by PM_CanBackstab().

#define FLIPHACK_DISTANCE   200
 

Definition at line 1799 of file bg_saber.c.

Referenced by PM_SomeoneInFront().

#define SABER_ALT_ATTACK_POWER   50
 

Definition at line 2109 of file bg_saber.c.

Referenced by PM_CanDoKata(), and PM_WeaponLightsaber().

#define SABER_ALT_ATTACK_POWER_FB   25
 

Definition at line 2111 of file bg_saber.c.

Referenced by PM_CheckPullAttack(), PM_SaberAttackForMovement(), and PM_WeaponLightsaber().

#define SABER_ALT_ATTACK_POWER_LR   10
 

Definition at line 2110 of file bg_saber.c.

Referenced by PM_SaberAttackForMovement().


Function Documentation

qboolean BG_CheckIncrementLockAnim int  anim,
int  winOrLose
 

Definition at line 1339 of file bg_saber.c.

References BOTH_LK_DL_DL_S_L_1, BOTH_LK_DL_DL_S_L_2, BOTH_LK_DL_DL_T_L_1, BOTH_LK_DL_DL_T_L_2, BOTH_LK_DL_S_S_L_1, BOTH_LK_DL_S_T_L_1, BOTH_LK_DL_ST_S_L_1, BOTH_LK_DL_ST_T_L_1, BOTH_LK_S_DL_S_L_1, BOTH_LK_S_DL_T_L_1, BOTH_LK_S_S_S_L_1, BOTH_LK_S_S_S_L_2, BOTH_LK_S_S_T_L_1, BOTH_LK_S_S_T_L_2, BOTH_LK_S_ST_S_L_1, BOTH_LK_S_ST_T_L_1, BOTH_LK_ST_DL_S_L_1, BOTH_LK_ST_DL_T_L_1, BOTH_LK_ST_S_S_L_1, BOTH_LK_ST_S_T_L_1, BOTH_LK_ST_ST_S_L_1, BOTH_LK_ST_ST_S_L_2, BOTH_LK_ST_ST_T_L_1, BOTH_LK_ST_ST_T_L_2, qboolean, qfalse, qtrue, and SABERLOCK_WIN.

Referenced by PM_SaberLocked().

01340 {
01341         qboolean increment = qfalse;//???
01342         //RULE: if you are the first style in the lock anim, you advance from LOSING position to WINNING position
01343         //              if you are the second style in the lock anim, you advance from WINNING position to LOSING position
01344         switch ( anim )
01345         {
01346         //increment to win:
01347         case BOTH_LK_DL_DL_S_L_1:       //lock if I'm using dual vs. dual and I initiated
01348         case BOTH_LK_DL_DL_S_L_2:       //lock if I'm using dual vs. dual and other initiated
01349         case BOTH_LK_DL_DL_T_L_1:       //lock if I'm using dual vs. dual and I initiated
01350         case BOTH_LK_DL_DL_T_L_2:       //lock if I'm using dual vs. dual and other initiated
01351         case BOTH_LK_DL_S_S_L_1:                //lock if I'm using dual vs. a single
01352         case BOTH_LK_DL_S_T_L_1:                //lock if I'm using dual vs. a single
01353         case BOTH_LK_DL_ST_S_L_1:       //lock if I'm using dual vs. a staff
01354         case BOTH_LK_DL_ST_T_L_1:       //lock if I'm using dual vs. a staff
01355         case BOTH_LK_S_S_S_L_1:         //lock if I'm using single vs. a single and I initiated
01356         case BOTH_LK_S_S_T_L_2:         //lock if I'm using single vs. a single and other initiated
01357         case BOTH_LK_ST_S_S_L_1:                //lock if I'm using staff vs. a single
01358         case BOTH_LK_ST_S_T_L_1:                //lock if I'm using staff vs. a single
01359         case BOTH_LK_ST_ST_T_L_1:       //lock if I'm using staff vs. a staff and I initiated
01360         case BOTH_LK_ST_ST_T_L_2:       //lock if I'm using staff vs. a staff and other initiated
01361                 if ( winOrLose == SABERLOCK_WIN )
01362                 {
01363                         increment = qtrue;
01364                 }
01365                 else
01366                 {
01367                         increment = qfalse;
01368                 }
01369                 break;
01370 
01371         //decrement to win:
01372         case BOTH_LK_S_DL_S_L_1:                //lock if I'm using single vs. a dual
01373         case BOTH_LK_S_DL_T_L_1:                //lock if I'm using single vs. a dual
01374         case BOTH_LK_S_S_S_L_2:         //lock if I'm using single vs. a single and other intitiated
01375         case BOTH_LK_S_S_T_L_1:         //lock if I'm using single vs. a single and I initiated
01376         case BOTH_LK_S_ST_S_L_1:                //lock if I'm using single vs. a staff
01377         case BOTH_LK_S_ST_T_L_1:                //lock if I'm using single vs. a staff
01378         case BOTH_LK_ST_DL_S_L_1:       //lock if I'm using staff vs. dual
01379         case BOTH_LK_ST_DL_T_L_1:       //lock if I'm using staff vs. dual
01380         case BOTH_LK_ST_ST_S_L_1:       //lock if I'm using staff vs. a staff and I initiated
01381         case BOTH_LK_ST_ST_S_L_2:       //lock if I'm using staff vs. a staff and other initiated
01382                 if ( winOrLose == SABERLOCK_WIN )
01383                 {
01384                         increment = qfalse;
01385                 }
01386                 else
01387                 {
01388                         increment = qtrue;
01389                 }
01390                 break;
01391         default:
01392                 break;
01393         }
01394         return increment;
01395 }

qboolean BG_EnoughForcePowerForMove int  cost  ) 
 

Definition at line 102 of file bg_saber.c.

References EV_NOAMMO, playerState_s::fd, forcedata_s::forcePower, pm, PM_AddEvent(), pmove_t::ps, qboolean, qfalse, and qtrue.

Referenced by PM_CanDoKata(), PM_CheckPullAttack(), PM_SaberAttackForMovement(), PM_SaberPowerCheck(), and PM_WeaponLightsaber().

00103 {
00104         if ( pm->ps->fd.forcePower < cost )
00105         {
00106                 PM_AddEvent( EV_NOAMMO );
00107                 return qfalse;
00108         }
00109 
00110         return qtrue;
00111 }

void BG_ForcePowerDrain playerState_t ps,
forcePowers_t  forcePower,
int  overrideAmt
 

Definition at line 27 of file bg_saber.c.

References playerState_s::fd, forcedata_s::forcePower, forcedata_s::forcePowerLevel, forcePowerNeeded, forcePowers_t, FP_LEVITATION, playerState_t, and playerState_s::velocity.

Referenced by ForceHeal(), ForceShootDrain(), ForceTeamForceReplenish(), ForceTeamHeal(), PM_AdjustAngleForWallJump(), PM_CheckPullAttack(), PM_SaberAttackForMovement(), PM_WeaponLightsaber(), WP_DoSpecificPower(), and WP_ForcePowerStart().

00028 {
00029         //take away the power
00030         int     drain = overrideAmt;
00031 
00032         /*
00033         if (ps->powerups[PW_FORCE_BOON])
00034         {
00035                 return;
00036         }
00037         */
00038         //No longer grant infinite force with boon.
00039 
00040         if ( !drain )
00041         {
00042                 drain = forcePowerNeeded[ps->fd.forcePowerLevel[forcePower]][forcePower];
00043         }
00044         if ( !drain )
00045         {
00046                 return;
00047         }
00048 
00049         if (forcePower == FP_LEVITATION)
00050         { //special case
00051                 int jumpDrain = 0;
00052 
00053                 if (ps->velocity[2] > 250)
00054                 {
00055                         jumpDrain = 20;
00056                 }
00057                 else if (ps->velocity[2] > 200)
00058                 {
00059                         jumpDrain = 16;
00060                 }
00061                 else if (ps->velocity[2] > 150)
00062                 {
00063                         jumpDrain = 12;
00064                 }
00065                 else if (ps->velocity[2] > 100)
00066                 {
00067                         jumpDrain = 8;
00068                 }
00069                 else if (ps->velocity[2] > 50)
00070                 {
00071                         jumpDrain = 6;
00072                 }
00073                 else if (ps->velocity[2] > 0)
00074                 {
00075                         jumpDrain = 4;
00076                 }
00077 
00078                 if (jumpDrain)
00079                 {
00080                         if (ps->fd.forcePowerLevel[FP_LEVITATION])
00081                         { //don't divide by 0!
00082                                 jumpDrain /= ps->fd.forcePowerLevel[FP_LEVITATION];
00083                         }
00084                 }
00085 
00086                 ps->fd.forcePower -= jumpDrain;
00087                 if ( ps->fd.forcePower < 0 )
00088                 {
00089                         ps->fd.forcePower = 0;
00090                 }
00091 
00092                 return;
00093         }
00094 
00095         ps->fd.forcePower -= drain;
00096         if ( ps->fd.forcePower < 0 )
00097         {
00098                 ps->fd.forcePower = 0;
00099         }
00100 }

qboolean BG_InKnockDown int  anim  ) 
 

Definition at line 8526 of file bg_pmove.c.

08527 {
08528         switch ( (anim) )
08529         {
08530         case BOTH_KNOCKDOWN1:
08531         case BOTH_KNOCKDOWN2:
08532         case BOTH_KNOCKDOWN3:
08533         case BOTH_KNOCKDOWN4:
08534         case BOTH_KNOCKDOWN5:
08535                 return qtrue;
08536                 break;
08537         case BOTH_GETUP1:
08538         case BOTH_GETUP2:
08539         case BOTH_GETUP3:
08540         case BOTH_GETUP4:
08541         case BOTH_GETUP5:
08542         case BOTH_FORCE_GETUP_F1:
08543         case BOTH_FORCE_GETUP_F2:
08544         case BOTH_FORCE_GETUP_B1:
08545         case BOTH_FORCE_GETUP_B2:
08546         case BOTH_FORCE_GETUP_B3:
08547         case BOTH_FORCE_GETUP_B4:
08548         case BOTH_FORCE_GETUP_B5:
08549         case BOTH_GETUP_BROLL_B:
08550         case BOTH_GETUP_BROLL_F:
08551         case BOTH_GETUP_BROLL_L:
08552         case BOTH_GETUP_BROLL_R:
08553         case BOTH_GETUP_FROLL_B:
08554         case BOTH_GETUP_FROLL_F:
08555         case BOTH_GETUP_FROLL_L:
08556         case BOTH_GETUP_FROLL_R:
08557                 return qtrue;
08558                 break;
08559         }
08560         return qfalse;
08561 }

qboolean BG_InSlopeAnim int  anim  ) 
 

Definition at line 4743 of file bg_pmove.c.

References LEGS_LEFTUP1, LEGS_LEFTUP2, LEGS_LEFTUP3, LEGS_LEFTUP4, LEGS_LEFTUP5, LEGS_RIGHTUP1, LEGS_RIGHTUP2, LEGS_RIGHTUP3, LEGS_RIGHTUP4, LEGS_RIGHTUP5, LEGS_S1_LUP1, LEGS_S1_LUP2, LEGS_S1_LUP3, LEGS_S1_LUP4, LEGS_S1_LUP5, LEGS_S1_RUP1, LEGS_S1_RUP2, LEGS_S1_RUP3, LEGS_S1_RUP4, LEGS_S1_RUP5, LEGS_S3_LUP1, LEGS_S3_LUP2, LEGS_S3_LUP3, LEGS_S3_LUP4, LEGS_S3_LUP5, LEGS_S3_RUP1, LEGS_S3_RUP2, LEGS_S3_RUP3, LEGS_S3_RUP4, LEGS_S3_RUP5, LEGS_S4_LUP1, LEGS_S4_LUP2, LEGS_S4_LUP3, LEGS_S4_LUP4, LEGS_S4_LUP5, LEGS_S4_RUP1, LEGS_S4_RUP2, LEGS_S4_RUP3, LEGS_S4_RUP4, LEGS_S4_RUP5, LEGS_S5_LUP1, LEGS_S5_LUP2, LEGS_S5_LUP3, LEGS_S5_LUP4, LEGS_S5_LUP5, LEGS_S5_RUP1, LEGS_S5_RUP2, LEGS_S5_RUP3, LEGS_S5_RUP4, LEGS_S5_RUP5, qboolean, qfalse, and qtrue.

Referenced by PM_SetSaberMove(), and PM_WeaponLightsaber().

04744 {
04745         switch ( anim )
04746         {
04747         case LEGS_LEFTUP1:                      //# On a slope with left foot 4 higher than right
04748         case LEGS_LEFTUP2:                      //# On a slope with left foot 8 higher than right
04749         case LEGS_LEFTUP3:                      //# On a slope with left foot 12 higher than right
04750         case LEGS_LEFTUP4:                      //# On a slope with left foot 16 higher than right
04751         case LEGS_LEFTUP5:                      //# On a slope with left foot 20 higher than right
04752         case LEGS_RIGHTUP1:                     //# On a slope with RIGHT foot 4 higher than left
04753         case LEGS_RIGHTUP2:                     //# On a slope with RIGHT foot 8 higher than left
04754         case LEGS_RIGHTUP3:                     //# On a slope with RIGHT foot 12 higher than left
04755         case LEGS_RIGHTUP4:                     //# On a slope with RIGHT foot 16 higher than left
04756         case LEGS_RIGHTUP5:                     //# On a slope with RIGHT foot 20 higher than left
04757         case LEGS_S1_LUP1:
04758         case LEGS_S1_LUP2:
04759         case LEGS_S1_LUP3:
04760         case LEGS_S1_LUP4:
04761         case LEGS_S1_LUP5:
04762         case LEGS_S1_RUP1:
04763         case LEGS_S1_RUP2:
04764         case LEGS_S1_RUP3:
04765         case LEGS_S1_RUP4:
04766         case LEGS_S1_RUP5:
04767         case LEGS_S3_LUP1:
04768         case LEGS_S3_LUP2:
04769         case LEGS_S3_LUP3:
04770         case LEGS_S3_LUP4:
04771         case LEGS_S3_LUP5:
04772         case LEGS_S3_RUP1:
04773         case LEGS_S3_RUP2:
04774         case LEGS_S3_RUP3:
04775         case LEGS_S3_RUP4:
04776         case LEGS_S3_RUP5:
04777         case LEGS_S4_LUP1:
04778         case LEGS_S4_LUP2:
04779         case LEGS_S4_LUP3:
04780         case LEGS_S4_LUP4:
04781         case LEGS_S4_LUP5:
04782         case LEGS_S4_RUP1:
04783         case LEGS_S4_RUP2:
04784         case LEGS_S4_RUP3:
04785         case LEGS_S4_RUP4:
04786         case LEGS_S4_RUP5:
04787         case LEGS_S5_LUP1:
04788         case LEGS_S5_LUP2:
04789         case LEGS_S5_LUP3:
04790         case LEGS_S5_LUP4:
04791         case LEGS_S5_LUP5:
04792         case LEGS_S5_RUP1:
04793         case LEGS_S5_RUP2:
04794         case LEGS_S5_RUP3:
04795         case LEGS_S5_RUP4:
04796         case LEGS_S5_RUP5:
04797                 return qtrue;
04798                 break;
04799         }
04800         return qfalse;
04801 }

saberInfo_t* BG_MySaber int  clientNum,
int  saberNum
 

Referenced by BG_AdjustClientSpeed(), BG_SaberStartTransAnim(), PM_CanDoKata(), PM_CanDoRollStab(), PM_CheckAltKickAttack(), PM_CheckStabDown(), PM_GetSaberStance(), PM_SaberAttackForMovement(), PM_SaberBackflipAttackMove(), PM_SaberFlipOverAttackMove(), PM_SaberJumpAttackMove(), PM_SaberJumpAttackMove2(), PM_SaberLungeAttackMove(), PM_SetSaberMove(), and PM_WeaponLightsaber().

qboolean BG_SaberInTransitionAny int  move  ) 
 

Definition at line 1619 of file bg_panimate.c.

01620 {
01621         if ( PM_SaberInStart( move ) )
01622         {
01623                 return qtrue;
01624         }
01625         else if ( PM_SaberInTransition( move ) )
01626         {
01627                 return qtrue;
01628         }
01629         else if ( PM_SaberInReturn( move ) )
01630         {
01631                 return qtrue;
01632         }
01633         return qfalse;
01634 }

qboolean BG_SabersOff playerState_t ps  ) 
 

Definition at line 201 of file bg_pmove.c.

00202 {
00203         if ( !ps->saberHolstered )
00204         {
00205                 return qfalse;
00206         }
00207         if ( ps->fd.saberAnimLevelBase == SS_DUAL
00208                 || ps->fd.saberAnimLevelBase == SS_STAFF )
00209         {
00210                 if ( ps->saberHolstered < 2 )
00211                 {
00212                         return qfalse;
00213                 }
00214         }
00215         return qtrue;
00216 }

qboolean BG_SuperBreakLoseAnim int  anim  ) 
 

Definition at line 1430 of file bg_panimate.c.

01431 {
01432         switch ( anim )
01433         {
01434         case BOTH_LK_S_DL_S_SB_1_L:     //super break I lost
01435         case BOTH_LK_S_DL_T_SB_1_L:     //super break I lost
01436         case BOTH_LK_S_ST_S_SB_1_L:     //super break I lost
01437         case BOTH_LK_S_ST_T_SB_1_L:     //super break I lost
01438         case BOTH_LK_S_S_S_SB_1_L:      //super break I lost
01439         case BOTH_LK_S_S_T_SB_1_L:      //super break I lost
01440         case BOTH_LK_DL_DL_S_SB_1_L:    //super break I lost
01441         case BOTH_LK_DL_DL_T_SB_1_L:    //super break I lost
01442         case BOTH_LK_DL_ST_S_SB_1_L:    //super break I lost
01443         case BOTH_LK_DL_ST_T_SB_1_L:    //super break I lost
01444         case BOTH_LK_DL_S_S_SB_1_L:     //super break I lost
01445         case BOTH_LK_DL_S_T_SB_1_L:     //super break I lost
01446         case BOTH_LK_ST_DL_S_SB_1_L:    //super break I lost
01447         case BOTH_LK_ST_DL_T_SB_1_L:    //super break I lost
01448         case BOTH_LK_ST_ST_S_SB_1_L:    //super break I lost
01449         case BOTH_LK_ST_ST_T_SB_1_L:    //super break I lost
01450         case BOTH_LK_ST_S_S_SB_1_L:     //super break I lost
01451         case BOTH_LK_ST_S_T_SB_1_L:     //super break I lost
01452                 return qtrue;
01453                 break;
01454         }
01455         return qfalse;
01456 }

qboolean BG_SuperBreakWinAnim int  anim  ) 
 

Definition at line 1458 of file bg_panimate.c.

01459 {
01460         switch ( anim )
01461         {
01462         case BOTH_LK_S_DL_S_SB_1_W:     //super break I won
01463         case BOTH_LK_S_DL_T_SB_1_W:     //super break I won
01464         case BOTH_LK_S_ST_S_SB_1_W:     //super break I won
01465         case BOTH_LK_S_ST_T_SB_1_W:     //super break I won
01466         case BOTH_LK_S_S_S_SB_1_W:      //super break I won
01467         case BOTH_LK_S_S_T_SB_1_W:      //super break I won
01468         case BOTH_LK_DL_DL_S_SB_1_W:    //super break I won
01469         case BOTH_LK_DL_DL_T_SB_1_W:    //super break I won
01470         case BOTH_LK_DL_ST_S_SB_1_W:    //super break I won
01471         case BOTH_LK_DL_ST_T_SB_1_W:    //super break I won
01472         case BOTH_LK_DL_S_S_SB_1_W:     //super break I won
01473         case BOTH_LK_DL_S_T_SB_1_W:     //super break I won
01474         case BOTH_LK_ST_DL_S_SB_1_W:    //super break I won
01475         case BOTH_LK_ST_DL_T_SB_1_W:    //super break I won
01476         case BOTH_LK_ST_ST_S_SB_1_W:    //super break I won
01477         case BOTH_LK_ST_ST_T_SB_1_W:    //super break I won
01478         case BOTH_LK_ST_S_S_SB_1_W:     //super break I won
01479         case BOTH_LK_ST_S_T_SB_1_W:     //super break I won
01480                 return qtrue;
01481                 break;
01482         }
01483         return qfalse;
01484 }

saberMoveName_t PM_AttackMoveForQuad int  quad  ) 
 

Definition at line 392 of file bg_saber.c.

References LS_A_BL2TR, LS_A_BR2TL, LS_A_L2R, LS_A_R2L, LS_A_T2B, LS_A_TL2BR, LS_A_TR2BL, LS_NONE, Q_B, Q_BL, Q_BR, Q_L, Q_R, Q_T, Q_TL, Q_TR, and saberMoveName_t.

00393 {
00394         switch ( quad )
00395         {
00396         case Q_B:
00397         case Q_BR:
00398                 return LS_A_BR2TL;
00399                 break;
00400         case Q_R:
00401                 return LS_A_R2L;
00402                 break;
00403         case Q_TR:
00404                 return LS_A_TR2BL;
00405                 break;
00406         case Q_T:
00407                 return LS_A_T2B;
00408                 break;
00409         case Q_TL:
00410                 return LS_A_TL2BR;
00411                 break;
00412         case Q_L:
00413                 return LS_A_L2R;
00414                 break;
00415         case Q_BL:
00416                 return LS_A_BL2TR;
00417                 break;
00418         }
00419         return LS_NONE;
00420 }

int PM_BrokenParryForParry int  move  ) 
 

Definition at line 1594 of file bg_saber.c.

References LS_H1_B_, LS_H1_BL, LS_H1_BR, LS_H1_T_, LS_H1_TL, LS_H1_TR, LS_NONE, LS_PARRY_LL, LS_PARRY_LR, LS_PARRY_UL, LS_PARRY_UP, LS_PARRY_UR, and LS_READY.

Referenced by PM_WeaponLightsaber().

01595 {
01596         switch ( move )
01597         {
01598         case LS_PARRY_UP:
01599                 return LS_H1_T_;
01600                 break;
01601         case LS_PARRY_UR:
01602                 return LS_H1_TR;
01603                 break;
01604         case LS_PARRY_UL:
01605                 return LS_H1_TL;
01606                 break;
01607         case LS_PARRY_LR:
01608                 return LS_H1_BL;
01609                 break;
01610         case LS_PARRY_LL:
01611                 return LS_H1_BR;
01612                 break;
01613         case LS_READY:
01614                 return LS_H1_B_;
01615                 break;
01616         }
01617         return LS_NONE;
01618 }

qboolean PM_CanBackstab void   ) 
 

Definition at line 1622 of file bg_saber.c.

References AngleVectors(), BACK_STAB_DISTANCE, bgEntity_t, playerState_s::clientNum, trace_t::entityNum, ENTITYNUM_NONE, ET_NPC, ET_PLAYER, entityState_s::eType, trace_t::fraction, MASK_PLAYERSOLID, playerState_s::origin, PITCH, pm, PM_BGEntForNum(), pmove_t::ps, qboolean, qfalse, qtrue, bgEntity_s::s, pmove_t::trace, vec3_t, VectorCopy, and playerState_s::viewangles.

Referenced by PM_SaberAttackForMovement().

01623 {
01624         trace_t tr;
01625         vec3_t flatAng;
01626         vec3_t fwd, back;
01627         vec3_t trmins = {-15, -15, -8};
01628         vec3_t trmaxs = {15, 15, 8};
01629 
01630         VectorCopy(pm->ps->viewangles, flatAng);
01631         flatAng[PITCH] = 0;
01632 
01633         AngleVectors(flatAng, fwd, 0, 0);
01634 
01635         back[0] = pm->ps->origin[0] - fwd[0]*BACK_STAB_DISTANCE;
01636         back[1] = pm->ps->origin[1] - fwd[1]*BACK_STAB_DISTANCE;
01637         back[2] = pm->ps->origin[2] - fwd[2]*BACK_STAB_DISTANCE;
01638 
01639         pm->trace(&tr, pm->ps->origin, trmins, trmaxs, back, pm->ps->clientNum, MASK_PLAYERSOLID);
01640 
01641         if (tr.fraction != 1.0 && tr.entityNum >= 0 && tr.entityNum < ENTITYNUM_NONE)
01642         {
01643                 bgEntity_t *bgEnt = PM_BGEntForNum(tr.entityNum);
01644 
01645                 if (bgEnt && (bgEnt->s.eType == ET_PLAYER || bgEnt->s.eType == ET_NPC))
01646                 {
01647                         return qtrue;
01648                 }
01649         }
01650 
01651         return qfalse;
01652 }

qboolean PM_CanDoKata void   ) 
 

Definition at line 2706 of file bg_saber.c.

References BG_EnoughForcePowerForMove(), BG_InKataAnim(), BG_MySaber(), BG_SaberInKata(), BUTTON_ALT_ATTACK, BUTTON_ATTACK, usercmd_s::buttons, playerState_s::clientNum, pmove_t::cmd, ENTITYNUM_NONE, usercmd_s::forwardmove, playerState_s::groundEntityNum, saberInfo_t::kataMove, playerState_s::legsAnim, LS_NONE, pm, PM_InSecondaryStyle(), PM_SaberMoveOkayForKata(), pmove_t::ps, qboolean, qfalse, qtrue, usercmd_s::rightmove, SABER_ALT_ATTACK_POWER, playerState_s::saberInFlight, playerState_s::saberMove, playerState_s::torsoAnim, and usercmd_s::upmove.

Referenced by PM_WeaponLightsaber().

02707 {
02708         if ( PM_InSecondaryStyle() )
02709         {
02710                 return qfalse;
02711         }
02712 
02713         if ( !pm->ps->saberInFlight//not throwing saber
02714                 && PM_SaberMoveOkayForKata()
02715                 && !BG_SaberInKata(pm->ps->saberMove)
02716                 && !BG_InKataAnim(pm->ps->legsAnim)
02717                 && !BG_InKataAnim(pm->ps->torsoAnim)
02718                 /*
02719                 && pm->ps->saberAnimLevel >= SS_FAST//fast, med or strong style
02720                 && pm->ps->saberAnimLevel <= SS_STRONG//FIXME: Tavion, too?
02721                 */
02722                 && pm->ps->groundEntityNum != ENTITYNUM_NONE//not in the air
02723                 && (pm->cmd.buttons&BUTTON_ATTACK)//pressing attack
02724                 && (pm->cmd.buttons&BUTTON_ALT_ATTACK)//pressing alt attack
02725                 && !pm->cmd.forwardmove//not moving f/b
02726                 && !pm->cmd.rightmove//not moving r/l
02727                 && pm->cmd.upmove <= 0//not jumping...?
02728                 && BG_EnoughForcePowerForMove(SABER_ALT_ATTACK_POWER) )// have enough power
02729         {//FIXME: check rage, etc...
02730                 saberInfo_t *saber = BG_MySaber( pm->ps->clientNum, 0 );
02731                 if ( saber
02732                         && saber->kataMove == LS_NONE )
02733                 {//kata move has been overridden in a way that should stop you from doing it at all
02734                         return qfalse;
02735                 }
02736                 saber = BG_MySaber( pm->ps->clientNum, 1 );
02737                 if ( saber
02738                         && saber->kataMove == LS_NONE )
02739                 {//kata move has been overridden in a way that should stop you from doing it at all
02740                         return qfalse;
02741                 }
02742                 return qtrue;
02743         }
02744         return qfalse;
02745 }

qboolean PM_CanDoRollStab void   ) 
 

Definition at line 2799 of file bg_saber.c.

References BG_MySaber(), playerState_s::clientNum, pm, pmove_t::ps, qboolean, qfalse, qtrue, saberInfo_t::saberFlags, SFL_NO_ROLL_STAB, playerState_s::weapon, and WP_SABER.

Referenced by PM_WeaponLightsaber().

02800 {
02801         if ( pm->ps->weapon == WP_SABER )
02802         {
02803                 saberInfo_t *saber = BG_MySaber( pm->ps->clientNum, 0 );
02804                 if ( saber
02805                         && (saber->saberFlags&SFL_NO_ROLL_STAB) )
02806                 {
02807                         return qfalse;
02808                 }
02809                 saber = BG_MySaber( pm->ps->clientNum, 1 );
02810                 if ( saber
02811                         && (saber->saberFlags&SFL_NO_ROLL_STAB) )
02812                 {
02813                         return qfalse;
02814                 }
02815         }
02816         return qtrue;
02817 }

qboolean PM_CheckAltKickAttack void   ) 
 

Definition at line 2747 of file bg_saber.c.

References BG_FlippingAnim(), BG_MySaber(), BUTTON_ALT_ATTACK, usercmd_s::buttons, playerState_s::clientNum, pmove_t::cmd, playerState_s::fd, playerState_s::legsAnim, playerState_s::legsTimer, pm, pmove_t::ps, qboolean, qfalse, qtrue, forcedata_s::saberAnimLevel, saberInfo_t::saberFlags, playerState_s::saberHolstered, SFL_NO_KICKS, SS_STAFF, playerState_s::weapon, and WP_SABER.

Referenced by PM_WeaponLightsaber().

02748 {
02749         if ( pm->ps->weapon == WP_SABER )
02750         {
02751                 saberInfo_t *saber = BG_MySaber( pm->ps->clientNum, 0 );
02752                 if ( saber
02753                         && (saber->saberFlags&SFL_NO_KICKS) )
02754                 {
02755                         return qfalse;
02756                 }
02757                 saber = BG_MySaber( pm->ps->clientNum, 1 );
02758                 if ( saber
02759                         && (saber->saberFlags&SFL_NO_KICKS) )
02760                 {
02761                         return qfalse;
02762                 }
02763         }
02764         if ( (pm->cmd.buttons&BUTTON_ALT_ATTACK) 
02765                 //&& (!(pm->ps->pm_flags&PMF_ALT_ATTACK_HELD)||PM_SaberInReturn(pm->ps->saberMove))
02766                 && (!BG_FlippingAnim(pm->ps->legsAnim)||pm->ps->legsTimer<=250)
02767                 && (pm->ps->fd.saberAnimLevel == SS_STAFF/*||!pm->ps->saber[0].throwable*/) && !pm->ps->saberHolstered )
02768         {
02769                 return qtrue;
02770         }
02771         return qfalse;
02772 }

saberMoveName_t PM_CheckPullAttack void   ) 
 

Definition at line 2114 of file bg_saber.c.

References BG_EnoughForcePowerForMove(), BG_ForcePowerDrain(), BUTTON_ATTACK, usercmd_s::buttons, pmove_t::cmd, playerState_s::fd, forcedata_s::forcePowersActive, FP_GRIP, LS_NONE, LS_PULL_ATTACK_STAB, LS_PULL_ATTACK_SWING, LS_READY, pm, PM_SaberInReflect(), PM_SaberInReturn(), playerState_s::powerups, pmove_t::ps, PW_DISINT_4, PW_PULL, qboolean, qtrue, SABER_ALT_ATTACK_POWER_FB, forcedata_s::saberAnimLevel, playerState_s::saberMove, saberMoveName_t, usercmd_s::serverTime, SS_FAST, and SS_STRONG.

Referenced by PM_WeaponLightsaber().

02115 {
02116 #if 0 //disabling these for MP, they aren't useful
02117         if (!(pm->cmd.buttons & BUTTON_ATTACK))
02118         {
02119                 return LS_NONE;
02120         }
02121 
02122         if ( (pm->ps->saberMove == LS_READY||PM_SaberInReturn(pm->ps->saberMove)||PM_SaberInReflect(pm->ps->saberMove))//ready
02123                 //&& (pm->ps->clientNum < MAX_CLIENTS||PM_ControlledByPlayer())//PLAYER ONLY
02124                 && pm->ps->fd.saberAnimLevel >= SS_FAST//single saber styles - FIXME: Tavion?
02125                 && pm->ps->fd.saberAnimLevel <= SS_STRONG//single saber styles - FIXME: Tavion?
02126                 //&& G_TryingPullAttack( pm->gent, &pm->cmd, qfalse )
02127                 //&& pm->ps->fd.forcePowerLevel[FP_PULL] 
02128                 //rwwFIXMEFIXME: rick has the damn msg.cpp file checked out exclusively so I can't update the bloody psf to send this for prediction
02129                 && pm->ps->powerups[PW_DISINT_4] > pm->cmd.serverTime
02130                 && !(pm->ps->fd.forcePowersActive & (1<<FP_GRIP))
02131                 && pm->ps->powerups[PW_PULL] > pm->cmd.serverTime
02132                 //&& pm->cmd.forwardmove<0//pulling back
02133                 && (pm->cmd.buttons&BUTTON_ATTACK)//attacking
02134                 && BG_EnoughForcePowerForMove( SABER_ALT_ATTACK_POWER_FB ) )//pm->ps->forcePower >= SABER_ALT_ATTACK_POWER_FB//have enough power
02135         {//FIXME: some NPC logic to do this?
02136                 qboolean doMove = qtrue;
02137 //              if ( g_saberNewControlScheme->integer
02138 //                      || g_crosshairEntNum < ENTITYNUM_WORLD )//in old control scheme, there has to be someone there
02139                 {       
02140                         saberMoveName_t pullAttackMove = LS_NONE;
02141                         if ( pm->ps->fd.saberAnimLevel == SS_FAST )
02142                         {
02143                                 pullAttackMove = LS_PULL_ATTACK_STAB;
02144                         }
02145                         else
02146                         {
02147                                 pullAttackMove = LS_PULL_ATTACK_SWING;
02148                         }
02149 
02150                         /*
02151                         if ( g_crosshairEntNum < ENTITYNUM_WORLD 
02152                                 && pm->gent && pm->gent->client )
02153                         {
02154                                 gentity_t *targEnt = &g_entities[g_crosshairEntNum];
02155                                 if ( targEnt->client
02156                                         && targEnt->health > 0
02157                                         //FIXME: check other things like in knockdown, saberlock, uninterruptable anims, etc.
02158                                         && !PM_InOnGroundAnim( &targEnt->client->ps )
02159                                         && !PM_LockedAnim( targEnt->client->ps.legsAnim ) 
02160                                         && !PM_SuperBreakLoseAnim( targEnt->client->ps.legsAnim )
02161                                         && !PM_SuperBreakWinAnim( targEnt->client->ps.legsAnim )
02162                                         && targEnt->client->ps.saberLockTime <= 0
02163                                         && WP_ForceThrowable( targEnt, targEnt, pm->gent, qtrue, 1.0f, 0.0f, NULL ) )
02164                                 {
02165                                         if ( !g_saberNewControlScheme->integer )
02166                                         {//in old control scheme, make sure they're close or far enough away for the move we'll be doing
02167                                                 float targDist = Distance( targEnt->currentOrigin, pm->ps->origin );
02168                                                 if ( pullAttackMove == LS_PULL_ATTACK_STAB )
02169                                                 {//must be closer than 512
02170                                                         if ( targDist > 384.0f )
02171                                                         {
02172                                                                 return LS_NONE;
02173                                                         }
02174                                                 }
02175                                                 else//if ( pullAttackMove == LS_PULL_ATTACK_SWING )
02176                                                 {//must be farther than 256
02177                                                         if ( targDist > 512.0f )
02178                                                         {
02179                                                                 return LS_NONE;
02180                                                         }
02181                                                         if ( targDist < 192.0f )
02182                                                         {
02183                                                                 return LS_NONE;
02184                                                         }
02185                                                 }
02186                                         }
02187 
02188                                         vec3_t targAngles = {0,targEnt->client->ps.viewangles[YAW],0};
02189                                         if ( InFront( pm->ps->origin, targEnt->currentOrigin, targAngles ) )
02190                                         {
02191                                                 NPC_SetAnim( targEnt, SETANIM_BOTH, BOTH_PULLED_INAIR_F, SETANIM_FLAG_OVERRIDE, SETANIM_FLAG_HOLD );
02192                                         }
02193                                         else
02194                                         {
02195                                                 NPC_SetAnim( targEnt, SETANIM_BOTH, BOTH_PULLED_INAIR_B, SETANIM_FLAG_OVERRIDE, SETANIM_FLAG_HOLD );
02196                                         }
02197                                         //hold the anim until I'm with done pull anim
02198                                         targEnt->client->ps.legsAnimTimer = targEnt->client->ps.torsoAnimTimer = PM_AnimLength( pm->gent->client->clientInfo.animFileIndex, (animNumber_t)saberMoveData[pullAttackMove].animToUse );
02199                                         //set pullAttackTime
02200                                         pm->gent->client->ps.pullAttackTime = targEnt->client->ps.pullAttackTime = level.time+targEnt->client->ps.legsAnimTimer;
02201                                         //make us know about each other
02202                                         pm->gent->client->ps.pullAttackEntNum = g_crosshairEntNum;
02203                                         targEnt->client->ps.pullAttackEntNum = pm->ps->clientNum;
02204                                         //do effect and sound on me
02205                                         pm->ps->powerups[PW_FORCE_PUSH] = level.time + 1000;
02206                                         if ( pm->gent )
02207                                         {
02208                                                 G_Sound( pm->gent, G_SoundIndex( "sound/weapons/force/pull.wav" ) );
02209                                         }
02210                                         doMove = qtrue;
02211                                 }
02212                         }
02213                         */
02214                         if ( doMove )
02215                         {
02216                                 BG_ForcePowerDrain(pm->ps, FP_GRI