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

Function ProcessNormalEvents

Descent3/gameevent.cpp:141–170  ·  view source on GitHub ↗

Processes all pending events, removing the ones that are expired

Source from the content-addressed store, hash-verified

139
140// Processes all pending events, removing the ones that are expired
141void ProcessNormalEvents() {
142 int i, count = 0;
143 bool skip_event;
144
145 for (i = 0; i < MAX_EVENTS && count < Num_events; i++) {
146 if (GameEvent[i].used) {
147 count++;
148 skip_event = false;
149
150 if (GameEvent[i].objhandle_detonator != OBJECT_HANDLE_NONE) {
151 // this object has a detonator, see if the object is still alive
152 object *obj = ObjGet(GameEvent[i].objhandle_detonator);
153 if (!obj || (obj->type == OBJ_GHOST) ||
154 (obj->type == OBJ_PLAYER && Players[obj->id].flags & (PLAYER_FLAGS_DYING | PLAYER_FLAGS_DEAD))) {
155 // the object has died, kill the event
156 FreeEvent(i);
157 skip_event = true;
158 mprintf(0, "Game Event %d cancelled\n", i);
159 }
160 }
161
162 if (GameEvent[i].type != RENDER_EVENT && GameEvent[i].end_time <= Gametime && !skip_event) {
163 HandleEvent(&GameEvent[i]);
164 FreeEvent(i);
165 }
166 }
167 }
168
169 SpewEmitAll();
170}
171
172// Goes through all events and returns the first index of the id matching the argument passed.
173// If not match found, returns -1

Callers 1

GameFrameFunction · 0.85

Calls 4

ObjGetFunction · 0.85
FreeEventFunction · 0.85
HandleEventFunction · 0.85
SpewEmitAllFunction · 0.85

Tested by

no test coverage detected