| 973 | } |
| 974 | |
| 975 | void NPC_ApplyScriptFlags (void) |
| 976 | { |
| 977 | if ( NPCInfo->scriptFlags & SCF_CROUCHED ) |
| 978 | { |
| 979 | if ( NPCInfo->charmedTime > level.time && (ucmd.forwardmove || ucmd.rightmove) ) |
| 980 | {//ugh, if charmed and moving, ignore the crouched command |
| 981 | } |
| 982 | else |
| 983 | { |
| 984 | ucmd.upmove = -127; |
| 985 | } |
| 986 | } |
| 987 | |
| 988 | if(NPCInfo->scriptFlags & SCF_RUNNING) |
| 989 | { |
| 990 | ucmd.buttons &= ~BUTTON_WALKING; |
| 991 | } |
| 992 | else if(NPCInfo->scriptFlags & SCF_WALKING) |
| 993 | { |
| 994 | if ( NPCInfo->charmedTime > level.time && (ucmd.forwardmove || ucmd.rightmove) ) |
| 995 | {//ugh, if charmed and moving, ignore the walking command |
| 996 | } |
| 997 | else |
| 998 | { |
| 999 | ucmd.buttons |= BUTTON_WALKING; |
| 1000 | } |
| 1001 | } |
| 1002 | /* |
| 1003 | if(NPCInfo->scriptFlags & SCF_CAREFUL) |
| 1004 | { |
| 1005 | ucmd.buttons |= BUTTON_CAREFUL; |
| 1006 | } |
| 1007 | */ |
| 1008 | if(NPCInfo->scriptFlags & SCF_LEAN_RIGHT) |
| 1009 | { |
| 1010 | ucmd.buttons |= BUTTON_USE; |
| 1011 | ucmd.rightmove = 127; |
| 1012 | ucmd.forwardmove = 0; |
| 1013 | ucmd.upmove = 0; |
| 1014 | } |
| 1015 | else if(NPCInfo->scriptFlags & SCF_LEAN_LEFT) |
| 1016 | { |
| 1017 | ucmd.buttons |= BUTTON_USE; |
| 1018 | ucmd.rightmove = -127; |
| 1019 | ucmd.forwardmove = 0; |
| 1020 | ucmd.upmove = 0; |
| 1021 | } |
| 1022 | |
| 1023 | if ( (NPCInfo->scriptFlags & SCF_ALT_FIRE) && (ucmd.buttons & BUTTON_ATTACK) ) |
| 1024 | {//Use altfire instead |
| 1025 | ucmd.buttons |= BUTTON_ALT_ATTACK; |
| 1026 | } |
| 1027 | |
| 1028 | // only removes NPC when it's safe too (Player is out of PVS) |
| 1029 | if( NPCInfo->scriptFlags & SCF_SAFE_REMOVE ) |
| 1030 | { |
| 1031 | // take from BSRemove |
| 1032 | if( !gi.inPVS( NPC->currentOrigin, g_entities[0].currentOrigin ) )//FIXME: use cg.vieworg? |
no test coverage detected