summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2022-12-05 18:00:37 -0800
committerVito Caputo <vcaputo@pengaru.com>2022-12-05 18:27:22 -0800
commitf8c50c92441ac82d8f1c38f57b9fa0b56f4bb432 (patch)
treee1e8b6b77c180c92919dae02aa9d9eb5b67bea54
parent48d296bdfcb0e7592e5d97a1588bc478f727f462 (diff)
sfx,game: introduce adult_armsfull.wav sound effect
This plays whenever the adult attempts to pickup TP while holding a baby.
-rw-r--r--src/game.c17
-rw-r--r--src/sfx.c1
-rw-r--r--src/sfx.h1
3 files changed, 14 insertions, 5 deletions
diff --git a/src/game.c b/src/game.c
index 2ea29ae..2ecff27 100644
--- a/src/game.c
+++ b/src/game.c
@@ -402,15 +402,20 @@ static void mask_adult(game_t *game, adult_t *adult, mask_t *mask)
}
-static void flash_entity(game_t *game, entity_any_t *any, unsigned count)
+/* returns 1 if entity started flashing, 0 if already flashing */
+static int flash_entity(game_t *game, entity_any_t *any, unsigned count)
{
+ any->flashes_remaining = count;
+
if (!any->flashing) {
any->flashing = 1;
any->flashers_next = game->flashers_on_head;
game->flashers_on_head = any;
+
+ return 1;
}
- any->flashes_remaining = count;
+ return 0;
}
@@ -419,8 +424,9 @@ static void more_teepee(game_t *game, teepee_t *teepee)
if (game->adult->holding) {
/* disallow picking up teepee if holding something, flash what's held and the teepee we missed */
- flash_entity(game, &teepee->entity, 5);
- flash_entity(game, &game->adult->holding->any, 5);
+ if (flash_entity(game, &teepee->entity, 5))
+ sfx_play(sfx.adult_armsfull);
+ (void) flash_entity(game, &game->adult->holding->any, 5);
return;
}
@@ -652,7 +658,7 @@ static ix2_search_status_t virus_search(void *cb_context, ix2_object_t *ix2_obje
if (!--entity->adult.masked)
(void) adult_node_new(&(stage_conf_t){ .stage = search->game->adult->entity.node, .replace = 1, .name = "adult-masked", .active = 1, .alpha = 1.f }, &search->game->sars->projection_x, &search->game->adult->entity.model_x);
- flash_entity(search->game, &entity->any, 4);
+ (void) flash_entity(search->game, &entity->any, 4);
return IX2_SEARCH_STOP_MISS;
}
@@ -844,6 +850,7 @@ static ix2_search_status_t adult_search(void *cb_context, ix2_object_t *ix2_obje
if (!--game->adult->masked)
(void) adult_node_new(&(stage_conf_t){ .stage = game->adult->entity.node, .replace = 1, .name = "adult-masked", .active = 1, .alpha = 1.f }, &game->sars->projection_x, &game->adult->entity.model_x);
flash_entity(game, &game->adult->entity, 4);
+ (void) flash_entity(game, &game->adult->entity, 4);
reset_virus(&entity->virus);
return IX2_SEARCH_MORE_MISS;
diff --git a/src/sfx.c b/src/sfx.c
index 9644f84..cae80dc 100644
--- a/src/sfx.c
+++ b/src/sfx.c
@@ -26,6 +26,7 @@ void sfx_init(void)
sfx.baby_infected = Mix_LoadWAV("assets/baby-infected.wav");
sfx.baby_held = Mix_LoadWAV("assets/baby-held.wav");
sfx.baby_rescued = Mix_LoadWAV("assets/baby-rescued.wav");
+ sfx.adult_armsfull = Mix_LoadWAV("assets/adult-armsfull.wav");
sfx.adult_infected = Mix_LoadWAV("assets/adult-infected.wav");
sfx.adult_captivated = Mix_LoadWAV("assets/adult-captivated.wav");
sfx.adult_mine = Mix_LoadWAV("assets/adult-mine.wav");
diff --git a/src/sfx.h b/src/sfx.h
index b612c52..daf6ce1 100644
--- a/src/sfx.h
+++ b/src/sfx.h
@@ -23,6 +23,7 @@ typedef struct sfx_t {
Mix_Chunk *baby_infected;
Mix_Chunk *baby_held;
Mix_Chunk *baby_rescued;
+ Mix_Chunk *adult_armsfull;
Mix_Chunk *adult_infected;
Mix_Chunk *adult_captivated;
Mix_Chunk *adult_mine;
© All Rights Reserved