| 2751 | |
| 2752 | extern int AM_terrain, AM_realign, AM_center_on_player, AM_current_marker; |
| 2753 | void TelComHandleKeyPress(int key, bool click, int screen_id) { |
| 2754 | int bit = 0x01; |
| 2755 | bit = (bit << key); |
| 2756 | if (!(Telcom_system.TelComSysKeyEnable & bit)) |
| 2757 | return; |
| 2758 | |
| 2759 | switch (key) { |
| 2760 | case TCSYS_REVERSETAB: { |
| 2761 | if (!click) |
| 2762 | break; |
| 2763 | |
| 2764 | int first = -1, curr_focus = -1; |
| 2765 | int i = Screen_roots[screen_id]; |
| 2766 | |
| 2767 | while (i != -1) { |
| 2768 | if (TCEffects[i].tab_stop) { |
| 2769 | // this is effect is a tab stop |
| 2770 | if (first == -1) |
| 2771 | first = i; |
| 2772 | if (TCEffects[i].has_focus) { |
| 2773 | // this effect is the one with focus |
| 2774 | curr_focus = i; |
| 2775 | break; |
| 2776 | } |
| 2777 | } |
| 2778 | i = TCEffects[i].next; |
| 2779 | } |
| 2780 | |
| 2781 | if (curr_focus == -1) { |
| 2782 | // none currently have focus!, make the effect we found (if any) have focus |
| 2783 | if (first != -1) { |
| 2784 | SendEventToEffect(first, TEVT_GAINFOCUS); |
| 2785 | TCEffects[first].has_focus = true; |
| 2786 | } |
| 2787 | break; // our work is done here |
| 2788 | } |
| 2789 | |
| 2790 | bool done = false; |
| 2791 | int end_node = Screen_roots[screen_id]; |
| 2792 | int t = end_node; |
| 2793 | if (t == -1) { |
| 2794 | Int3(); |
| 2795 | break; |
| 2796 | } |
| 2797 | |
| 2798 | while (!done) { |
| 2799 | if (TCEffects[t].next == -1) { |
| 2800 | done = true; |
| 2801 | end_node = t; |
| 2802 | } else { |
| 2803 | t = TCEffects[t].next; |
| 2804 | } |
| 2805 | } |
| 2806 | |
| 2807 | done = false; |
| 2808 | int new_focus = -1; |
| 2809 | while (!done) { |
| 2810 | if (i == -1) { |
no test coverage detected