summaryrefslogtreecommitdiff
path: root/src/game.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2022-11-09 11:06:46 -0800
committerVito Caputo <vcaputo@pengaru.com>2022-11-09 11:06:46 -0800
commit474bbf1b635ba50fd2abf1cef24f352bd7916dd2 (patch)
treea9435ee57de33b543836a9ed3fd8d75b7604ecee /src/game.c
parentf8e9f5a4446fcd13f2e35b5c9e9a8166f39f553a (diff)
game: add a variety of teepee powerup quantities
In the interests of making it realistically possible to completely fill the 256 spots of teepee icons as a winning condition, there's now mega packs of rolls. There will need to be some visible indication of qty added, either numerically or with different graphics. I'm leaning towards just adding numeric quantity values like +3 or +36 over the roll which floats away when you take it.
Diffstat (limited to 'src/game.c')
-rw-r--r--src/game.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/game.c b/src/game.c
index 44c2b3a..b706b06 100644
--- a/src/game.c
+++ b/src/game.c
@@ -132,6 +132,7 @@ typedef struct adult_t {
typedef struct teepee_t {
entity_any_t entity;
+ unsigned quantity;
} teepee_t;
typedef struct tv_t {
@@ -355,7 +356,7 @@ static void mask_adult(game_t *game, adult_t *adult, mask_t *mask)
static void more_teepee(game_t *game, teepee_t *teepee)
{
- {
+ for (unsigned i = 0; i < teepee->quantity; i++) {
teepee_t *tp;
tp = pad_get(game->pad, sizeof(entity_t));
@@ -370,9 +371,9 @@ static void more_teepee(game_t *game, teepee_t *teepee)
tp->entity.node = teepee_node_new(&(stage_conf_t){ .parent = game->game_node, .name = "tp", .layer = 9, .alpha = 1.f, .active = 1 }, &game->sars->projection_x, &tp->entity.model_x);
tp->entity.model_x = m4f_translate(NULL, &(v3f_t){ .x = ((game->teepee_cnt % 16) * 0.0625f) * 1.9375f + -.9375f, .y = (.9687f - ((game->teepee_cnt / 16) * 0.0625f)) * 1.9375f + -.9375f, .z = 0.f });
tp->entity.model_x = m4f_scale(&tp->entity.model_x, &tp->entity.scale);
+ game->teepee_cnt++;
}
sfx_play(sfx.adult_mine);
- game->teepee_cnt++;
stage_set_active(teepee->entity.node, 0);
}
@@ -606,6 +607,26 @@ static void update_entities(play_t *play, game_t *game)
if (randf() > .45f && !stage_get_active(game->teepee->entity.node)) {
/* sometimes activate a teepee "powerup" */
+ static struct {
+ unsigned qty;
+ float chance;
+ } quantities[] = {
+ { .qty = 4, .chance = .5 },
+ { .qty = 6, .chance = .25 },
+ { .qty = 9, .chance = .12 },
+ { .qty = 12, .chance = .08 },
+ { .qty = 18, .chance = .06 },
+ { .qty = 24, .chance = .04 },
+ { .qty = 30, .chance = .02 },
+ { .qty = 36, .chance = .005 },
+ };
+
+ game->teepee->quantity = 1;
+ for (unsigned i = 0; i < NELEMS(quantities); i++) {
+ if (randf() * .5f + .5f <= quantities[i].chance)
+ game->teepee->quantity = quantities[i].qty;
+ }
+
game->teepee->entity.position.x = randf();
game->teepee->entity.position.y = -1.2f;
entity_update_x(game, &game->teepee->entity);
© All Rights Reserved