MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / pickTaskFunc

Function pickTaskFunc

TheForceEngine/TFE_DarkForces/pickup.cpp:355–384  ·  view source on GitHub ↗

The current pickup being processed is stored in Message::s_msgTarget The object "picking up" the item is stored in Message::s_msgEntity

Source from the content-addressed store, hash-verified

353 // The current pickup being processed is stored in Message::s_msgTarget
354 // The object "picking up" the item is stored in Message::s_msgEntity
355 void pickTaskFunc(MessageType msg)
356 {
357 struct LocalContext
358 {
359 SecObject* pickupObj;
360 SecObject* entity;
361 Pickup* pickup;
362 JBool pickedUpItem;
363 };
364 task_begin_ctx;
365 while (msg != MSG_FREE_TASK)
366 {
367 // Sleep until called.
368 task_yield(TASK_SLEEP);
369 if (msg == MSG_RUN_TASK)
370 {
371 freeItems();
372 }
373
374 if (msg == MSG_FREE)
375 {
376 pickup_cleanupFunc((Logic*)s_msgTarget);
377 }
378 else if (msg == MSG_PICKUP)
379 {
380 pickupItem(msg);
381 } // if (id == PICKUP_ACQUIRE)
382 } // while (id != -1)
383 task_end;
384 }
385
386 // TFE: Pickups are set from external data instead of hardcoded as in vanilla DF
387 void setPickup(Pickup*& pickup, SecObject* obj, ItemId itemId, TFE_ExternalData::ExternalPickup* externalPickups)

Callers

nothing calls this directly

Calls 3

freeItemsFunction · 0.85
pickup_cleanupFuncFunction · 0.85
pickupItemFunction · 0.85

Tested by

no test coverage detected