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

Function xCounterEventCB

src/SB/Core/x/xCounter.cpp:84–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84int xCounterEventCB(xBase*, xBase* to, U32 toEvent, const F32*, xBase*)
85{
86 _xCounter* t = (_xCounter*)to;
87
88 switch (toEvent)
89 {
90 case eEventDecrement:
91 {
92 if (t->state != 1 && (!(t->counterFlags & 0x1) || t->count != 2))
93 {
94 t->count--;
95
96 if (t->count == 0)
97 {
98 zEntEvent(t, t, eEventExpired);
99 }
100 else if (t->count > 0 && t->count <= 20)
101 {
102 zEntEvent(t, t, t->count + (eEventCount1 - 1));
103 }
104 }
105 break;
106 }
107 case eEventIncrement:
108 {
109 if (t->state != 1)
110 {
111 t->count++;
112
113 if (t->count == 0)
114 {
115 zEntEvent(t, t, eEventExpired);
116 }
117 else if (t->count > 0 && t->count <= 20)
118 {
119 zEntEvent(t, t, t->count + (eEventCount1 - 1));
120 }
121 }
122 break;
123 }
124 case eEventReset:
125 {
126 t->state = 0;
127 t->count = t->asset->count;
128 break;
129 }
130 case eEventExpired:
131 {
132 if (!(t->counterFlags & 0x1) || t->count != 2)
133 {
134 t->count = 0;
135 t->state = 1;
136 }
137 break;
138 }
139 default:
140 {
141 if (t->state != 1 && toEvent >= eEventCount1 && toEvent <= eEventCount20)

Callers

nothing calls this directly

Calls 1

zEntEventFunction · 0.70

Tested by

no test coverage detected