MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / TelComSetFocusOnEffect

Function TelComSetFocusOnEffect

Descent3/TelCom.cpp:2500–2544  ·  view source on GitHub ↗

* Forces an effect to have focus (if is allowed to have focus) * */

Source from the content-addressed store, hash-verified

2498 *
2499 */
2500void TelComSetFocusOnEffect(int efxnum) {
2501 int screen;
2502 int effect_with_focus;
2503
2504 if (TCEffects[efxnum].type == EFX_NONE)
2505 return;
2506
2507 screen = TCEffects[efxnum].screen;
2508
2509 if (TCEffects[efxnum].has_focus)
2510 return; // already has focus
2511
2512 if (!TCEffects[efxnum].tab_stop)
2513 return; // not allowed to have focus
2514
2515 // find the effect on the screen with focus
2516 int i = Screen_roots[screen];
2517 effect_with_focus = -1;
2518
2519 while (i != -1) {
2520 if (TCEffects[i].tab_stop && TCEffects[i].has_focus) {
2521 effect_with_focus = i;
2522 break;
2523 }
2524
2525 i = TCEffects[i].next;
2526 }
2527
2528 bool send_click = false;
2529
2530 if (TCEffects[efxnum].flags & OBF_CHANGEFOCUSISCLICK)
2531 send_click = true;
2532
2533 // send out our events and process focus change
2534 if (i != -1)
2535 TCEffects[i].has_focus = false;
2536 TCEffects[efxnum].has_focus = true;
2537
2538 if (i != -1)
2539 SendEventToEffect(i, TEVT_LOSTFOCUS);
2540 SendEventToEffect(efxnum, TEVT_GAINFOCUS);
2541
2542 if (send_click)
2543 SendEventToEffect(efxnum, TEVT_MOUSECLICK);
2544}
2545
2546/*
2547 * This should be called once a frame, it will handle all events in the TelCom system and send off any system

Callers 3

TelComSingleShipSelectFunction · 0.85
TCSSButtonCallbackFunction · 0.85
RenderButtonFunction · 0.85

Calls 1

SendEventToEffectFunction · 0.85

Tested by

no test coverage detected