From 5cf1d72cef303cc71a6a2295ff0074a8e40b5cd6 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Fri, 2 Dec 2022 22:25:58 -0800 Subject: game: differentiate corpse viruses tv-attracted babies that contact non-corpse viruses should reset the virus, but they never reset viruses until now. This commit introduces a corpse flag to the virus entity and sets it on infection-produced viruses. Now the tv-attracted baby<->virus infection resets the virus when the virus isn't a corpse, instead of letting the animated virus continue on unimpeded. The corpses should be allowed to propagate infections to eachother while accumulating, hence why it can't be an indiscriminate reset of the virus. --- src/game.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/game.c b/src/game.c index 5b7fbb3..1f0cf8d 100644 --- a/src/game.c +++ b/src/game.c @@ -143,6 +143,7 @@ struct baby_t { typedef struct virus_t { entity_any_t entity; + unsigned corpse:1; entity_t *new_infections_next; } virus_t; @@ -374,6 +375,7 @@ static void infect_entity(game_t *game, entity_t *entity, const char *name) (void) virus_node_new(&(stage_conf_t){ .stage = entity->any.node, .replace = 1, .name = name, .active = 1, .alpha = 1.f }, &game->sars->projection_x, &entity->any.model_x); sfx_play(sfx.baby_infected); entity->any.type = ENTITY_TYPE_VIRUS; + entity->virus.corpse = 1; /* stick entity on a new_infections list for potential propagation */ entity->virus.new_infections_next = game->new_infections; @@ -479,6 +481,10 @@ static ix2_search_status_t baby_search(void *cb_context, ix2_object_t *ix2_objec if (!stage_get_active(entity->any.node)) return IX2_SEARCH_MORE_MISS; + /* only non-corpse viruses should be reset by baby contact */ + if (!entity->virus.corpse) + reset_virus(&entity->virus); + /* baby gets infected, return positive hit count */ return IX2_SEARCH_STOP_HIT; -- cgit v1.2.3