MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / PlayerIsStaring

Method PlayerIsStaring

src/SB/Game/zNPCTypeVillager.cpp:843–887  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

841}
842
843S32 zNPCVillager::PlayerIsStaring()
844{
845 xVec3 vec;
846
847 if (globals.player.ControlOff != 0)
848 {
849 return 0;
850 }
851
852 if ((U8)this->npcset.allowDetect == 0)
853 {
854 return 0;
855 }
856
857 F32 dy = 0.0f;
858 F32 dSq = this->XZDstSqToPlayer(&vec, &dy);
859
860 if (dy > 5.0f)
861 {
862 return 0;
863 }
864
865 if (dy < -2.0f)
866 {
867 return 0;
868 }
869
870 xEntNPCAsset* npcass = this->npcass;
871 if (npcass->taskWidgetPrime != 0 || npcass->taskWidgetSecond != 0)
872 {
873 if (dSq > g_vilg_ds2_playernear * 4.0f)
874 {
875 return 0;
876 }
877 }
878 else
879 {
880 if (dSq > g_vilg_ds2_playernear)
881 {
882 return 0;
883 }
884 }
885
886 return 1;
887}
888
889void zNPCVillager::AddTalking(xPsyche* psy,
890 S32 (*eval_plyrnear)(xGoal*, void*, en_trantype*, F32, void*),

Callers 3

FOLK_grul_goAlertFunction · 0.80
MERC_grul_goAlertFunction · 0.80
ProcessMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected