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

Method Process

src/SB/Game/zNPCGoalVillager.cpp:179–317  ·  view source on GitHub ↗

Equivalent: regalloc

Source from the content-addressed store, hash-verified

177
178// Equivalent: regalloc
179S32 zNPCGoalPlayerNear::Process(en_trantype* trantype, F32 dt, void* updCtxt, xScene* scene)
180{
181 S32 nextgoal = 0;
182 zNPCVillager* npc = (zNPCVillager*)(psyche->clt_owner);
183 NPCConfig* cfg = npc->cfg_npc;
184 xVec3 dir_plyr = { 0.0f, 0.0f, 0.0f };
185 F32 rad_taskshow;
186 F32 rad_taskhide;
187 S32 cheats = zGameExtras_CheatFlags();
188
189 if (flg_plyrnear & 1)
190 {
191 flg_plyrnear &= ~1;
192 nextgoal = NPC_GOAL_TALK;
193 *trantype = GOAL_TRAN_PUSH;
194 }
195 else if (npc->SomethingWonderful() || !npc->PlayerIsStaring())
196 {
197 nextgoal = NPC_GOAL_IDLE;
198 *trantype = GOAL_TRAN_SET;
199 }
200 else if (cheats & 0x400000)
201 {
202 ChkCheatDogTrix(&nextgoal, trantype);
203 }
204
205 if (*trantype != GOAL_TRAN_NONE)
206 {
207 return nextgoal;
208 }
209
210 rad_taskshow = 4.0f;
211 rad_taskhide = 5.0f;
212
213 if (globals.sceneCur->sceneID == 'HB02')
214 {
215 if (npc->SelfType() == NPC_TYPE_GARY)
216 {
217 rad_taskshow = 2.75f;
218 rad_taskhide = 3.25f;
219 }
220 }
221
222 xVec3 vex;
223 F32 y_height = 0.0f;
224 F32 dist_sq = npc->XZDstSqToPlayer(&vex, &y_height);
225
226 if (talk_font != NULL)
227 {
228 if (dist_sq > SQ(rad_taskhide))
229 {
230 talk_font->Off(npc, 0);
231 }
232 else if (dist_sq < SQ(rad_taskshow))
233 {
234 talk_font->On(npc, 0);
235 }
236 }

Callers

nothing calls this directly

Calls 15

zGameExtras_CheatFlagsFunction · 0.85
ChkCheatDogTrixFunction · 0.85
xVec3CopyFunction · 0.85
xurandFunction · 0.85
DoAutoAnimFunction · 0.85
xEntGetPosFunction · 0.85
xVec3SubFunction · 0.85
xVec3Length2Function · 0.85
xVec3SMulByFunction · 0.85
xsqrtFunction · 0.85
xrandFunction · 0.85
xVec3LengthFunction · 0.85

Tested by

no test coverage detected