Skip to content

Commit

Permalink
bug: secret doors in ascii mode flash too fast when the mouse is moving
Browse files Browse the repository at this point in the history
  • Loading branch information
goblinhack committed Jul 10, 2023
1 parent 63493ab commit 06b8751
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 52 deletions.
16 changes: 5 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<!-- Bugs -->
<!-- ------ -->
<!-- secret doors in ascii mode flash too fast when the mouse is moving -->
<!-- ------ -->
<!-- -->
<!-- Performance -->
Expand Down Expand Up @@ -28,7 +27,6 @@
<!-- MVP plan -->
<!-- ------ -->
<!-- - wort food ? fungus foods and some poisonous? -->
<!-- - pressure plate, that monsters avoid -->
<!-- - stealth -->
<!-- - cracked walls -->
<!-- - paralysis dart -->
Expand All @@ -43,7 +41,6 @@
<!-- - luck trap -->
<!-- - runics on weapons, like vampirism, force, quietus, lightning -->
<!-- - ogre totems? -->
<!-- - swamp level -->
<!-- - boss 1 Mummy mummy, ankh of life -->
<!-- - boss 2 slime boss, spawns slimes, tries to jump splat the player -->
<!-- swamp tiles that allow 50% movement -->
Expand All @@ -63,15 +60,13 @@
<!-- - different sound for bosses -->
<!-- - crystal collection -->
<!-- - 4 bosses and final zorb boss -->
<!-- - char selection -->
<!-- - level fall through to special level ? -->
<!-- - hub shop levels -->
<!-- - basecamp level? -->
<!-- ------ -->
<!-- -->
<!-- UI -->
<!-- ------ -->
<!-- - monst head should be on top of armor -->
<!-- - rest until better -->
<!-- - auto explore -->
<!-- ------ -->
Expand All @@ -94,7 +89,7 @@
<!-- -->
<!-- Poison -->
<!-- ------ -->
<!-- - chocolote frog cures poison? -->
<!-- - chocolate frog cures poison? -->
<!-- ------ -->
<!-- -->
<!-- Doors -->
Expand All @@ -115,7 +110,7 @@
<!-- Staffs -->
<!-- ------ -->
<!-- - staves that recharge -->
<!-- - staff of death should stop regenerating monst -->
<!-- - staff of death should stop regenerating monst -->
<!-- ------ -->
<!-- -->
<!-- Potions -->
Expand All @@ -141,7 +136,7 @@
<!-- -->
<!-- Monsts -->
<!-- ------ -->
<!-- - chccolate golem fires chocolate -->
<!-- - chocolate golem fires chocolate -->
<!-- - chickens - battle chickens - lay eggs as food - and they get names -->
<!-- - acid jellies should damage weapons -->
<!-- - mold growth / floor puddings -->
Expand All @@ -150,15 +145,14 @@
<!-- - rat pack and king rat / cranium rat -->
<!-- - zombie camel? -->
<!-- - sewer wolf? -->
<!-- - invisible monst? -->
<!-- - monster that runs from light ? -->
<!-- - tentacles out of the ground that try to surround you -->
<!-- - dungeon walrus; long headed walrus with many tusks -->
<!-- ------ -->
<!-- -->
<!-- Gods -->
<!-- ------ -->
<!-- - runes lean more torwards old gods -->
<!-- - runes lean more towards old gods -->
<!-- ------ -->
<!-- -->
<!-- Gfx -->
Expand All @@ -169,7 +163,7 @@
<!-- Player -->
<!-- ------ -->
<!-- - weight factors into jumping -->
<!-- - carry eat slime mold and gain acid resis? -->
<!-- - carry eat slime mold and gain acid resist? -->
<!-- ------ -->
<!-- -->
<!-- Spells -->
Expand Down
61 changes: 20 additions & 41 deletions src/thing_display_ascii.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,21 @@ void Thing::blit_ascii_at(point p, bool lit, bool left_bar)
return;
}

static uint8_t alpha = 128;
static int step = 10;
static int dir = 1;
static uint32_t ts;

if (time_have_x_hundredths_passed_since(2, ts)) {
alpha += dir * step;
if (alpha > 240) {
dir = -1;
} else if (alpha < 100) {
dir = 1;
}
ts = time_ms_cached();
}

//
// This is for walls that can be composed of multiple tiles.
//
Expand Down Expand Up @@ -465,71 +480,35 @@ void Thing::blit_ascii_at(point p, bool lit, bool left_bar)
//
// Allow secret doors a chance to be seen
//
if (is_secret_door() && discovered()) {
static uint8_t a = 128;
static int step = 10;
static int dir = 1;
a += dir * step;
if (a > 250) {
dir = -1;
} else if (a < 100) {
dir = 1;
}
if (is_secret_door() /* && discovered() */) {
color outline_color = ORANGE;
outline_color.a = a;
outline_color.a = alpha;
ascii_set(TILE_LAYER_BG_0, p.x, p.y, outline_color);
ascii_set(TILE_LAYER_FG_0, p.x, p.y, WHITE);
}

if (gfx_pixelart_show_highlighted() && ! immediate_owner()) {
if ((this == game->current_wid_thing_info) || (level->cursor && (this->curr_at == level->cursor->curr_at))) {
static uint8_t a = 128;
static int step = 10;
static int dir = 1;
a += dir * step;
if (a > 250) {
dir = -1;
} else if (a < 100) {
dir = 1;
}
color outline_color = ORANGE;
outline_color.a = a;
outline_color.a = alpha;
ascii_set(TILE_LAYER_BG_0, p.x, p.y, outline_color);
ascii_set(TILE_LAYER_FG_0, p.x, p.y, WHITE);
}
}

if (! is_dead) {
if (is_currently_invisible && is_player()) {
static uint8_t a = 128;
static int step = 10;
static int dir = 1;
a += dir * step;
if (a > 250) {
dir = -1;
} else if (a < 100) {
dir = 1;
}
color outline_color = WHITE;
outline_color.a = a;
outline_color.a = alpha;
ascii_set(TILE_LAYER_BG_0, p.x, p.y, outline_color);
ascii_set(TILE_LAYER_FG_0, p.x, p.y, WHITE);
}

if (! is_currently_invisible || is_player()) {
if (is_raging()) {
if ((this == game->current_wid_thing_info) || (level->cursor && (this->curr_at == level->cursor->curr_at))) {
static uint8_t a = 128;
static int step = 30;
static int dir = 1;
a += dir * step;
if (a > 250) {
dir = -1;
} else if (a < 100) {
dir = 1;
}
color outline_color = ORANGE;
outline_color.a = a;
outline_color.a = alpha;
ascii_set(TILE_LAYER_BG_0, p.x, p.y, outline_color);
ascii_set(TILE_LAYER_FG_0, p.x, p.y, WHITE);
}
Expand Down

0 comments on commit 06b8751

Please sign in to comment.