Debian Codegraph @

src/cdogs/handle_game_events.c

raw symbols SCIP
1 /*
2 C-Dogs SDL
3 A port of the legendary (and fun) action/arcade cdogs.
4 Copyright (c) 2014-2023 Cong Xu
5 All rights reserved.
6
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9
10 Redistributions of source code must retain the above copyright notice, this
11 list of conditions and the following disclaimer.
12 Redistributions in binary form must reproduce the above copyright notice,
13 this list of conditions and the following disclaimer in the documentation
14 and/or other materials provided with the distribution.
15
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 POSSIBILITY OF SUCH DAMAGE.
27 */
28 #include "handle_game_events.h"
29
30 #include "actor_fire.h"
31 #include "actor_placement.h"
32 #include "actors.h"
33 #include "ai_utils.h"
34 #include "damage.h"
35 #include "events.h"
36 #include "game_events.h"
37 #include "joystick.h"
38 #include "log.h"
39 #include "net_server.h"
40 #include "particle.h"
41 #include "pickup.h"
42 #include "thing.h"
43 #include "triggers.h"
44
45 #define RELOAD_DISTANCE_PLUS 200
46
47 static void HandleGameEvent(
48 const GameEvent e, Camera *camera, PowerupSpawner *healthSpawner,
49 CArray *ammoSpawners, SoundDevice *sd);
50 void HandleGameEvents(
51 CArray *store, Camera *camera, PowerupSpawner *healthSpawner,
52 CArray *ammoSpawners, SoundDevice *sd)
53 {
54 for (int i = 0; i < (int)store->size; i++)
55 {
56 GameEvent *e = CArrayGet(store, i);
57 e->Delay--;
58 if (e->Delay >= 0)
59 {
60 continue;
61 }
62 HandleGameEvent(*e, camera, healthSpawner, ammoSpawners, sd);
63 }
64 GameEventsClear(store);
65 }
66 static void HandleGameEvent(
67 const GameEvent e, Camera *camera, PowerupSpawner *healthSpawner,
68 CArray *ammoSpawners, SoundDevice *sd)
69 {
70 switch (e.Type)
71 {
72 case GAME_EVENT_PLAYER_DATA:
73 PlayerDataAddOrUpdate(e.u.PlayerData);
74 break;
75 case GAME_EVENT_PLAYER_REMOVE:
76 PlayerRemove(e.u.PlayerRemove.UID);
77 if (gPlayerDatas.size == 0)
78 {
79 // Waiting for players to join, follow the first one
80 camera->FollowNextPlayer = true;
81 }
82 break;
83 case GAME_EVENT_TILE_SET: {
84 struct vec2i pos = Net2Vec2i(e.u.TileSet.Pos);
85 LOG(LM_MAP, LL_DEBUG, "set tile %s/%s/%s pos(%d, %d) x%d",
86 e.u.TileSet.ClassName, e.u.TileSet.DoorClassName,
87 e.u.TileSet.DoorClass2Name, pos.x, pos.y, e.u.TileSet.RunLength);
88 const TileClass *tileClass = StrTileClass(gMap.TileClasses, e.u.TileSet.ClassName);
89 const TileClass *doorClass = StrTileClass(gMap.TileClasses, e.u.TileSet.DoorClassName);
90 const TileClass *doorClass2 = StrTileClass(gMap.TileClasses, e.u.TileSet.DoorClass2Name);
91 for (int i = 0; i <= e.u.TileSet.RunLength; i++)
92 {
93 Tile *t = MapGetTile(&gMap, pos);
94 t->Class = tileClass;
95 t->Door.Class = doorClass;
96 t->Door.Class2 = doorClass2;
97 DoorStateInit(&t->Door, false);
98 pos.x++;
99 if (pos.x == gMap.Size.x)
100 {
101 pos.x = 0;
102 pos.y++;
103 }
104 }
105 }
106 break;
107 case GAME_EVENT_THING_DAMAGE:
108 ThingDamage(e.u.ThingDamage);
109 break;
110 case GAME_EVENT_MAP_OBJECT_ADD:
111 ObjAdd(e.u.MapObjectAdd);
112 break;
113 case GAME_EVENT_MAP_OBJECT_REMOVE:
114 ObjRemove(e.u.MapObjectRemove);
115 break;
116 case GAME_EVENT_CONFIG: {
117 // Temporarily set config
118 Config *c = ConfigGet(&gConfig, e.u.Config.Name);
119 switch (c->Type)
120 {
121 case CONFIG_TYPE_STRING:
122 CASSERT(false, "unimplemented");
123 break;
124 case CONFIG_TYPE_INT:
125 c->u.Int.Value = atoi(e.u.Config.Value);
126 break;
127 case CONFIG_TYPE_FLOAT:
128 c->u.Float.Value = atof(e.u.Config.Value);
129 break;
130 case CONFIG_TYPE_BOOL:
131 c->u.Bool.Value = strcmp(e.u.Config.Value, "true") == 0;
132 break;
133 case CONFIG_TYPE_ENUM:
134 c->u.Enum.Value = atoi(e.u.Config.Value);
135 break;
136 case CONFIG_TYPE_GROUP:
137 CASSERT(false, "Cannot send groups over net");
138 break;
139 default:
140 CASSERT(false, "Unknown config type");
141 break;
142 }
143 }
144 break;
145 case GAME_EVENT_SCORE:
146 // No score for dogfight
147 if (gCampaign.Entry.Mode != GAME_MODE_DOGFIGHT)
148 {
149 PlayerData *p = PlayerDataGetByUID(e.u.Score.PlayerUID);
150 PlayerScore(p, e.u.Score.Score);
151 if (camera != NULL)
152 {
153 HUDNumPopupsAdd(
154 &camera->HUD.numPopups, NUMBER_POPUP_SCORE,
155 e.u.Score.PlayerUID, e.u.Score.Score);
156 }
157 }
158 break;
159 case GAME_EVENT_SOUND_AT:
160 SoundPlayAtPlusDistance(
161 sd, StrSound(e.u.SoundAt.Sound), NetToVec2(e.u.SoundAt.Pos),
162 e.u.SoundAt.Distance);
163 break;
164 case GAME_EVENT_SCREEN_SHAKE:
165 if (e.u.Shake.CameraSubjectOnly &&
166 e.u.Shake.ActorUID != camera->FollowActorUID)
167 {
168 break;
169 }
170 camera->shake = ScreenShakeAdd(
171 camera->shake, e.u.Shake.Amount,
172 ConfigGetInt(&gConfig, "Graphics.ShakeMultiplier"));
173 // Weak rumble for all joysticks
174 CA_FOREACH(Joystick, j, gEventHandlers.joysticks)
175 JoyRumble(j->id, 0.3f, 500);
176 CA_FOREACH_END()
177 break;
178 case GAME_EVENT_SET_MESSAGE:
179 HUDDisplayMessage(
180 &camera->HUD, e.u.SetMessage.Message, e.u.SetMessage.Ticks);
181 break;
182 case GAME_EVENT_GAME_START:
183 gMission.HasStarted = true;
184 gMission.HasBegun = false;
185 break;
186 case GAME_EVENT_GAME_BEGIN:
187 MissionBegin(&gMission, e.u.GameBegin);
188 break;
189 case GAME_EVENT_ACTOR_ADD: {
190 ActorAdd(e.u.ActorAdd);
191 const TActor *a = ActorGetByUID(e.u.ActorState.UID);
192 // Spawn sound for player actors
193 if (e.u.ActorAdd.PlayerUID >= 0)
194 {
195 SoundPlayAt(sd, StrSound("spawn"), a->Pos);
196 }
197 }
198 break;
199 case GAME_EVENT_ACTOR_MOVE:
200 ActorMove(e.u.ActorMove);
201 break;
202 case GAME_EVENT_ACTOR_STATE: {
203 TActor *a = ActorGetByUID(e.u.ActorState.UID);
204 if (!a->isInUse)
205 break;
206 a->anim =
207 AnimationGetActorAnimation((ActorAnimation)e.u.ActorState.State);
208 }
209 break;
210 case GAME_EVENT_ACTOR_DIR: {
211 TActor *a = ActorGetByUID(e.u.ActorDir.UID);
212 if (!a->isInUse)
213 break;
214 a->direction = (direction_e)e.u.ActorDir.Dir;
215 }
216 break;
217 case GAME_EVENT_ACTOR_SLIDE: {
218 TActor *a = ActorGetByUID(e.u.ActorSlide.UID);
219 if (!a->isInUse)
220 break;
221 a->thing.Vel = NetToVec2(e.u.ActorSlide.Vel);
222 // Slide sound
223 if (ConfigGetBool(&gConfig, "Sound.Footsteps"))
224 {
225 SoundPlayAt(sd, StrSound("slide"), a->thing.Pos);
226 }
227 }
228 break;
229 case GAME_EVENT_ACTOR_IMPULSE: {
230 TActor *a = ActorGetByUID(e.u.ActorImpulse.UID);
231 if (!a->isInUse)
232 break;
233 a->thing.Vel =
234 svec2_add(a->thing.Vel, NetToVec2(e.u.ActorImpulse.Vel));
235 const struct vec2 pos = NetToVec2(e.u.ActorImpulse.Pos);
236 if (!svec2_is_zero(pos))
237 {
238 a->Pos = pos;
239 }
240 }
241 break;
242 case GAME_EVENT_ACTOR_SWITCH_GUN:
243 ActorSwitchGun(e.u.ActorSwitchGun);
244 break;
245 case GAME_EVENT_ACTOR_PICKUP_ALL: {
246 TActor *a = ActorGetByUID(e.u.ActorPickupAll.UID);
247 if (!a->isInUse)
248 break;
249 a->PickupAll = e.u.ActorPickupAll.PickupAll;
250 }
251 break;
252 case GAME_EVENT_ACTOR_REPLACE_GUN:
253 ActorReplaceGun(e.u.ActorReplaceGun);
254 break;
255 case GAME_EVENT_ACTOR_HEAL: {
256 TActor *a = ActorGetByUID(e.u.Heal.UID);
257 if (!a->isInUse || a->dead)
258 break;
259 ActorHeal(a, e.u.Heal.Amount, e.u.Heal.ExceedMax);
260 // Tell the spawner that we took a health so we can
261 // spawn more (but only if we're the server)
262 if (e.u.Heal.IsRandomSpawned && !gCampaign.IsClient)
263 {
264 PowerupSpawnerRemoveOne(healthSpawner);
265 }
266 if (e.u.Heal.PlayerUID >= 0)
267 {
268 GameEvent s = GameEventNew(GAME_EVENT_ADD_PARTICLE);
269 s.u.AddParticle.Class =
270 StrParticleClass(&gParticleClasses, "heal_text");
271 s.u.AddParticle.Pos = a->Pos;
272 s.u.AddParticle.Z = BULLET_Z * Z_FACTOR;
273 s.u.AddParticle.DZ = 3;
274 sprintf(s.u.AddParticle.Text, "+%d", (int)e.u.Heal.Amount);
275 GameEventsEnqueue(&gGameEvents, s);
276 }
277 }
278 break;
279 case GAME_EVENT_ACTOR_ADD_AMMO: {
280 TActor *a = ActorGetByUID(e.u.AddAmmo.UID);
281 if (!a->isInUse || a->dead)
282 break;
283 ActorAddAmmo(a, e.u.AddAmmo.Ammo.Id, e.u.AddAmmo.Ammo.Amount);
284 // Tell the spawner that we took ammo so we can
285 // spawn more (but only if we're the server)
286 if (e.u.AddAmmo.IsRandomSpawned &&
287 gCampaign.Setting.RandomPickups && !gCampaign.IsClient)
288 {
289 PowerupSpawnerRemoveOne(
290 CArrayGet(ammoSpawners, e.u.AddAmmo.Ammo.Id));
291 }
292 if (e.u.AddAmmo.PlayerUID >= 0)
293 {
294 GameEvent s = GameEventNew(GAME_EVENT_ADD_PARTICLE);
295 s.u.AddParticle.Class =
296 StrParticleClass(&gParticleClasses, "ammo_text");
297 s.u.AddParticle.Pos = a->Pos;
298 s.u.AddParticle.Z = BULLET_Z * Z_FACTOR;
299 s.u.AddParticle.DZ = 10;
300 const Ammo *ammo = AmmoGetById(&gAmmo, e.u.AddAmmo.Ammo.Id);
301 sprintf(
302 s.u.AddParticle.Text, "+%d %s", (int)e.u.AddAmmo.Ammo.Amount,
303 ammo->Name);
304 GameEventsEnqueue(&gGameEvents, s);
305 }
306 }
307 break;
308 case GAME_EVENT_ACTOR_USE_AMMO: {
309 TActor *a = ActorGetByUID(e.u.UseAmmo.UID);
310 if (!a->isInUse || a->dead)
311 break;
312 const int ammoBefore =
313 *(int *)CArrayGet(&a->ammo, e.u.UseAmmo.Ammo.Id);
314 const Ammo *ammo = AmmoGetById(&gAmmo, e.u.UseAmmo.Ammo.Id);
315 const bool wasAmmoLow = AmmoIsLow(ammo, ammoBefore);
316 ActorAddAmmo(a, e.u.UseAmmo.Ammo.Id, -(int)e.u.UseAmmo.Ammo.Amount);
317 const PlayerData *p = PlayerDataGetByUID(e.u.UseAmmo.PlayerUID);
318 if (p != NULL && p->IsLocal)
319 {
320 // Show low or no ammo notifications
321 const int ammoAfter =
322 *(int *)CArrayGet(&a->ammo, e.u.UseAmmo.Ammo.Id);
323 const bool isAmmoLow = AmmoIsLow(ammo, ammoAfter);
324 if (ammoAfter == 0)
325 {
326 // No ammo
327 SoundPlay(sd, StrSound("ammo_none"));
328 }
329 else if (!wasAmmoLow && isAmmoLow)
330 {
331 // Low ammo
332 SoundPlay(sd, StrSound("ammo_low"));
333 }
334 }
335 }
336 break;
337 case GAME_EVENT_ACTOR_DIE: {
338 TActor *a = ActorGetByUID(e.u.ActorDie.UID);
339
340 // Check if the player has lives to revive
341 PlayerData *p = PlayerDataGetByUID(a->PlayerUID);
342 if (p != NULL)
343 {
344 p->Lives--;
345 CASSERT(p->Lives >= 0, "Player has died too many times");
346 if (p->Lives > 0 && !gCampaign.IsClient)
347 {
348 // Find the closest player alive; try to spawn next to that
349 // position if no other suitable position exists
350 struct vec2 defaultSpawnPosition = svec2_zero();
351 const TActor *closestActor = AIGetClosestPlayer(a->Pos);
352 if (closestActor != NULL)
353 {
354 defaultSpawnPosition = closestActor->Pos;
355 }
356 PlacePlayer(&gMap, p, defaultSpawnPosition, false);
357 }
358 }
359
360 ActorDestroy(a);
361 }
362 break;
363 case GAME_EVENT_PLAYER_ADD_LIVES: {
364 PlayerData *p = PlayerDataGetByUID(e.u.PlayerAddLives.UID);
365 p->Lives += e.u.PlayerAddLives.Lives;
366 const TActor *a = ActorGetByUID(p->ActorUID);
367 if (a && a->isInUse && !a->dead)
368 {
369 GameEvent s = GameEventNew(GAME_EVENT_ADD_PARTICLE);
370 s.u.AddParticle.Class =
371 StrParticleClass(&gParticleClasses, "lives_text");
372 s.u.AddParticle.Pos = a->Pos;
373 s.u.AddParticle.Z = BULLET_Z * Z_FACTOR;
374 s.u.AddParticle.DZ = 4;
375 sprintf(
376 s.u.AddParticle.Text, "+%d %s", (int)e.u.PlayerAddLives.Lives,
377 e.u.PlayerAddLives.Lives > 1 ? "Lives" : "Life");
378 GameEventsEnqueue(&gGameEvents, s);
379 }
380 }
381 break;
382 case GAME_EVENT_ACTOR_MELEE:
383 DamageMelee(e.u.Melee);
384 break;
385 case GAME_EVENT_ACTOR_PILOT:
386 ActorPilot(e.u.Pilot);
387 break;
388 case GAME_EVENT_ADD_PICKUP:
389 PickupAdd(e.u.AddPickup);
390 // Play a spawn sound
391 SoundPlayAt(sd, StrSound("spawn_item"), NetToVec2(e.u.AddPickup.Pos));
392 break;
393 case GAME_EVENT_REMOVE_PICKUP:
394 PickupDestroy(e.u.RemovePickup.UID);
395 if (e.u.RemovePickup.SpawnerUID >= 0)
396 {
397 TObject *o = ObjGetByUID(e.u.RemovePickup.SpawnerUID);
398 o->counter = AMMO_SPAWNER_RESPAWN_TICKS;
399 }
400 break;
401 case GAME_EVENT_BULLET_BOUNCE:
402 BulletBounce(e.u.BulletBounce);
403 break;
404 case GAME_EVENT_REMOVE_BULLET: {
405 TMobileObject *o = MobObjGetByUID(e.u.RemoveBullet.UID);
406 if (o == NULL || !o->isInUse)
407 break;
408 BulletDestroy(o);
409 }
410 break;
411 case GAME_EVENT_PARTICLE_REMOVE:
412 ParticleDestroy(&gParticles, e.u.ParticleRemoveId);
413 break;
414 case GAME_EVENT_GUN_FIRE:
415 OnGunFire(e.u.GunFire, sd);
416 break;
417 case GAME_EVENT_GUN_RELOAD: {
418 const WeaponClass *wc = StrWeaponClass(e.u.GunReload.Gun);
419 CASSERT(wc->Type != GUNTYPE_MULTI, "unexpected gun type");
420 const struct vec2 pos = NetToVec2(e.u.GunReload.Pos);
421 SoundPlayAtPlusDistance(
422 sd, wc->u.Normal.ReloadSound, pos, RELOAD_DISTANCE_PLUS);
423 // Brass shells
424 if (wc->u.Normal.Brass && wc->u.Normal.ReloadLead != 0)
425 {
426 WeaponClassAddBrass(wc, (direction_e)e.u.GunReload.Direction, pos);
427 }
428 }
429 break;
430 case GAME_EVENT_GUN_STATE: {
431 TActor *a = ActorGetByUID(e.u.GunState.ActorUID);
432 if (!a->isInUse)
433 break;
434 WeaponBarrelSetState(
435 ACTOR_GET_WEAPON(a), e.u.GunState.Barrel,
436 (gunstate_e)e.u.GunState.State);
437 }
438 break;
439 case GAME_EVENT_ADD_BULLET:
440 BulletAdd(e.u.AddBullet);
441 break;
442 case GAME_EVENT_ADD_PARTICLE:
443 ParticleAdd(&gParticles, e.u.AddParticle);
444 break;
445 case GAME_EVENT_TRIGGER: {
446 const Tile *t = MapGetTile(&gMap, Net2Vec2i(e.u.TriggerEvent.Tile));
447 CA_FOREACH(Trigger *, tp, t->triggers)
448 if ((*tp)->id == (int)e.u.TriggerEvent.ID)
449 {
450 TriggerActivate(*tp, &gMap.triggers);
451 break;
452 }
453 CA_FOREACH_END()
454 }
455 break;
456 case GAME_EVENT_EXPLORE_TILES:
457 // Process runs of explored tiles
458 for (int i = 0; i < (int)e.u.ExploreTiles.Runs_count; i++)
459 {
460 struct vec2i tile = Net2Vec2i(e.u.ExploreTiles.Runs[i].Tile);
461 for (int j = 0; j < e.u.ExploreTiles.Runs[i].Run; j++)
462 {
463 MapMarkAsVisited(&gMap, tile);
464 tile.x++;
465 if (tile.x == gMap.Size.x)
466 {
467 tile.x = 0;
468 tile.y++;
469 }
470 }
471 }
472 break;
473 case GAME_EVENT_RESCUE_CHARACTER: {
474 TActor *a = ActorGetByUID(e.u.Rescue.UID);
475 if (!a->isInUse)
476 break;
477 a->flags &= ~FLAGS_PRISONER;
478 // If the actor isn't a follower, make them automatically run
479 // towards the exit
480 if (!(a->flags & FLAGS_FOLLOWER))
481 {
482 a->flags |= FLAGS_RESCUED;
483 }
484 SoundPlayAt(sd, StrSound("rescue"), a->Pos);
485 }
486 break;
487 case GAME_EVENT_OBJECTIVE_UPDATE: {
488 Objective *o = CArrayGet(
489 &gMission.missionData->Objectives,
490 e.u.ObjectiveUpdate.ObjectiveId);
491 o->done += e.u.ObjectiveUpdate.Count;
492 // Display a text update effect for the objective
493 if (camera != NULL)
494 {
495 HUDNumPopupsAdd(
496 &camera->HUD.numPopups, NUMBER_POPUP_OBJECTIVE,
497 e.u.ObjectiveUpdate.ObjectiveId, e.u.ObjectiveUpdate.Count);
498 }
499 MissionSetMessageIfComplete(&gMission);
500 }
501 break;
502 case GAME_EVENT_ADD_KEYS: {
503 gMission.KeyFlags |= e.u.AddKeys.KeyFlags;
504
505 const struct vec2 pos = NetToVec2(e.u.AddKeys.Pos);
506
507 if (!svec2_is_zero(pos))
508 {
509 GameEvent s = GameEventNew(GAME_EVENT_ADD_PARTICLE);
510 s.u.AddParticle.Class =
511 StrParticleClass(&gParticleClasses, "key_text");
512 s.u.AddParticle.Pos = pos;
513 s.u.AddParticle.Z = BULLET_Z * Z_FACTOR;
514 s.u.AddParticle.DZ = 10;
515 sprintf(s.u.AddParticle.Text, "+key");
516 GameEventsEnqueue(&gGameEvents, s);
517 }
518
519 // Clear cache since we may now have new paths
520 PathCacheClear(&gPathCache);
521 }
522 break;
523 case GAME_EVENT_DOOR_TOGGLE: {
524 Tile *t = MapGetTile(&gMap, Net2Vec2i(e.u.DoorToggle.Pos));
525 DoorStateInit(&t->Door, e.u.DoorToggle.IsOpen);
526 }
527 break;
528 case GAME_EVENT_MISSION_COMPLETE:
529 if (e.u.MissionComplete.ShowMsg)
530 {
531 if (!gMission.MissionCompleted)
532 {
533 SoundPlay(sd, StrSound("mission_complete"));
534 }
535 if (camera != NULL)
536 {
537 HUDDisplayMessage(&camera->HUD, "Mission complete", -1);
538 }
539 }
540 gMission.MissionCompleted = true;
541 // Don't show exit area or arrow if PVP
542 if (!IsPVP(gCampaign.Entry.Mode))
543 {
544 if (camera != NULL)
545 {
546 camera->HUD.showExit = true;
547 }
548 for (int i = 0; i < (int)gMap.exits.size; i++)
549 {
550 MapShowExitArea(&gMap, i);
551 }
552 }
553 break;
554 case GAME_EVENT_MISSION_INCOMPLETE:
555 gMission.state = MISSION_STATE_PLAY;
556 break;
557 case GAME_EVENT_MISSION_PICKUP:
558 gMission.state = MISSION_STATE_PICKUP;
559 gMission.pickupTime = gMission.time;
560 SoundPlay(sd, StrSound("whistle"));
561 break;
562 case GAME_EVENT_MISSION_END:
563 MissionDone(&gMission, e.u.MissionEnd);
564 if (e.u.MissionEnd.Msg[0] != '\0')
565 {
566 HUDDisplayMessage(&camera->HUD, e.u.MissionEnd.Msg, -1);
567 }
568 break;
569 default:
570 assert(0 && "unknown game event");
571 break;
572 }
573 }