diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2022-12-02 22:25:58 -0800 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2022-12-02 22:25:58 -0800 |
commit | 5cf1d72cef303cc71a6a2295ff0074a8e40b5cd6 (patch) | |
tree | 5075e39b9877c8838e84141f1a45b49c7db5c31f /src/game.c | |
parent | 50117369a991b01137b9cd783927fcb842dc7e35 (diff) |
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.
Diffstat (limited to 'src/game.c')
-rw-r--r-- | src/game.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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; |