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

Function NPC_ApplyScriptFlags

codeJK2/game/NPC.cpp:872–924  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

870}
871
872void NPC_ApplyScriptFlags (void)
873{
874 if ( NPCInfo->scriptFlags & SCF_CROUCHED )
875 {
876 if ( NPCInfo->charmedTime > level.time && (ucmd.forwardmove || ucmd.rightmove) )
877 {//ugh, if charmed and moving, ignore the crouched command
878 }
879 else
880 {
881 ucmd.upmove = -127;
882 }
883 }
884
885 if(NPCInfo->scriptFlags & SCF_RUNNING)
886 {
887 ucmd.buttons &= ~BUTTON_WALKING;
888 }
889 else if(NPCInfo->scriptFlags & SCF_WALKING)
890 {
891 if ( NPCInfo->charmedTime > level.time && (ucmd.forwardmove || ucmd.rightmove) )
892 {//ugh, if charmed and moving, ignore the walking command
893 }
894 else
895 {
896 ucmd.buttons |= BUTTON_WALKING;
897 }
898 }
899/*
900 if(NPCInfo->scriptFlags & SCF_CAREFUL)
901 {
902 ucmd.buttons |= BUTTON_CAREFUL;
903 }
904*/
905 if(NPCInfo->scriptFlags & SCF_LEAN_RIGHT)
906 {
907 ucmd.buttons |= BUTTON_USE;
908 ucmd.rightmove = 127;
909 ucmd.forwardmove = 0;
910 ucmd.upmove = 0;
911 }
912 else if(NPCInfo->scriptFlags & SCF_LEAN_LEFT)
913 {
914 ucmd.buttons |= BUTTON_USE;
915 ucmd.rightmove = -127;
916 ucmd.forwardmove = 0;
917 ucmd.upmove = 0;
918 }
919
920 if ( (NPCInfo->scriptFlags & SCF_ALT_FIRE) && (ucmd.buttons & BUTTON_ATTACK) )
921 {//Use altfire instead
922 ucmd.buttons |= BUTTON_ALT_ATTACK;
923 }
924}
925
926void Q3_DebugPrint( int level, const char *format, ... );
927void NPC_HandleAIFlags (void)

Callers 1

NPC_ExecuteBStateFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected