| 78 | } |
| 79 | |
| 80 | S32 xGroupEventCB(xBase* to, xBase* from, U32 toEvent, const F32* toParam, |
| 81 | xBase* toParamWidget) |
| 82 | { |
| 83 | xGroup* g = (xGroup*)from; |
| 84 | switch (toEvent) |
| 85 | { |
| 86 | case eEventReset: |
| 87 | xGroupReset(g); |
| 88 | break; |
| 89 | case eEventDisableGroupContents: |
| 90 | toEvent = eEventDisable; |
| 91 | break; |
| 92 | } |
| 93 | S32 index = -1; |
| 94 | if (g->asset->groupFlags & 1) |
| 95 | { |
| 96 | U32 rand = xrand(); |
| 97 | index = rand % g->asset->itemCount; |
| 98 | } |
| 99 | else if (g->asset->groupFlags & 2) |
| 100 | { |
| 101 | index = g->last_index; |
| 102 | g->last_index = (g->last_index + 1) % g->asset->itemCount; |
| 103 | } |
| 104 | |
| 105 | switch (toEvent) |
| 106 | { |
| 107 | case eEventFastVisible: |
| 108 | for (S32 i = 0; i < g->asset->itemCount; i++) |
| 109 | { |
| 110 | if (!(index == -1 || index == i)) |
| 111 | { |
| 112 | continue; |
| 113 | } |
| 114 | |
| 115 | xBase* b = g->item[i]; |
| 116 | if (!b) |
| 117 | { |
| 118 | continue; |
| 119 | } |
| 120 | |
| 121 | if (b->baseFlags & 0x20) |
| 122 | { |
| 123 | xEntShow((xEnt*)b); |
| 124 | } |
| 125 | else |
| 126 | { |
| 127 | zEntEvent(b, toEvent, toParam, toParamWidget); |
| 128 | } |
| 129 | } |
| 130 | return 1; |
| 131 | case eEventFastInvisible: |
| 132 | for (S32 i = 0; i < g->asset->itemCount; i++) |
| 133 | { |
| 134 | if (!(index == -1 || index == i)) |
| 135 | { |
| 136 | continue; |
| 137 | } |
nothing calls this directly
no test coverage detected