Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //In bg_saber.c
- int lockedAnim;
- int Boot_LockedDir( usercmd_t *cmd ) //Which animation to lock while holding manual block
- {
- if (g_entities->client->pers.cmd.buttons & 16384) //If you click block... (+button14)
- {
- if (!lockedAnim) //... but only if no animation has been locked yet...
- {
- if ( !abs(cmd->forwardmove) && !abs(cmd->rightmove) ) //If not moving...
- {
- lockedAnim = LS_PARRY_UP; //... parry up (default)
- }
- if ( cmd->forwardmove > 0 || //If moving forward...
- cmd->forwardmove < 0 && //... or backward...
- !abs(cmd->rightmove) ) //... and not to any sides...
- {
- lockedAnim = LS_PARRY_UP; //... parry up.
- }
- if ( cmd->rightmove > 0 && //If moving right...
- !(cmd->forwardmove < 0) ) //... and not moving backwards...
- {
- lockedAnim = LS_PARRY_UR; //... parry upper right.
- }
- if ( cmd->rightmove < 0 && //If moving left...
- !(cmd->forwardmove < 0) ) //... and not moving backwards...
- {
- lockedAnim = LS_PARRY_UL; //... parry upper left.
- }
- if (cmd->rightmove > 0 && //If moving right...
- cmd->forwardmove < 0) //... and moving backwards...
- {
- lockedAnim = LS_PARRY_LL; //... parry lower right (switched lower anims because more suitable).
- }
- if (cmd->rightmove < 0 && //If moving left...
- cmd->forwardmove < 0) //... and moving backwards...
- {
- lockedAnim = LS_PARRY_LR; //... parry lower left (switched lower anims).
- }
- } // If an animation was already locked, skip all the above and return...
- }
- else //But if you let go of block...
- {
- lockedAnim = 0; //... stop the animation and allow new directions to be locked
- }
- return lockedAnim; //Send the animation to use back to the caller.
- }
- int Boot_SetBlockDir( void )
- {
- int blockDir = Boot_LockedDir( &g_entities->client->pers.cmd);
- if (blockDir)
- PM_SetSaberMove( blockDir );
- }
- //In g_active.c for now, until I find out the best place to call from
- if (ent->client->ps.weapon == WP_SABER)
- {
- Boot_SetBlockDir();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement