Skip to content

Commit 06b8751

Browse files
committed
bug: secret doors in ascii mode flash too fast when the mouse is moving
1 parent 63493ab commit 06b8751

File tree

2 files changed

+25
-52
lines changed

2 files changed

+25
-52
lines changed

README.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<!-- Bugs -->
22
<!-- ------ -->
3-
<!-- secret doors in ascii mode flash too fast when the mouse is moving -->
43
<!-- ------ -->
54
<!-- -->
65
<!-- Performance -->
@@ -28,7 +27,6 @@
2827
<!-- MVP plan -->
2928
<!-- ------ -->
3029
<!-- - wort food ? fungus foods and some poisonous? -->
31-
<!-- - pressure plate, that monsters avoid -->
3230
<!-- - stealth -->
3331
<!-- - cracked walls -->
3432
<!-- - paralysis dart -->
@@ -43,7 +41,6 @@
4341
<!-- - luck trap -->
4442
<!-- - runics on weapons, like vampirism, force, quietus, lightning -->
4543
<!-- - ogre totems? -->
46-
<!-- - swamp level -->
4744
<!-- - boss 1 Mummy mummy, ankh of life -->
4845
<!-- - boss 2 slime boss, spawns slimes, tries to jump splat the player -->
4946
<!-- swamp tiles that allow 50% movement -->
@@ -63,15 +60,13 @@
6360
<!-- - different sound for bosses -->
6461
<!-- - crystal collection -->
6562
<!-- - 4 bosses and final zorb boss -->
66-
<!-- - char selection -->
6763
<!-- - level fall through to special level ? -->
6864
<!-- - hub shop levels -->
6965
<!-- - basecamp level? -->
7066
<!-- ------ -->
7167
<!-- -->
7268
<!-- UI -->
7369
<!-- ------ -->
74-
<!-- - monst head should be on top of armor -->
7570
<!-- - rest until better -->
7671
<!-- - auto explore -->
7772
<!-- ------ -->
@@ -94,7 +89,7 @@
9489
<!-- -->
9590
<!-- Poison -->
9691
<!-- ------ -->
97-
<!-- - chocolote frog cures poison? -->
92+
<!-- - chocolate frog cures poison? -->
9893
<!-- ------ -->
9994
<!-- -->
10095
<!-- Doors -->
@@ -115,7 +110,7 @@
115110
<!-- Staffs -->
116111
<!-- ------ -->
117112
<!-- - staves that recharge -->
118-
<!-- - staff of death should stop regenerating monst -->
113+
<!-- - staff of death should stop regenerating monst -->
119114
<!-- ------ -->
120115
<!-- -->
121116
<!-- Potions -->
@@ -141,7 +136,7 @@
141136
<!-- -->
142137
<!-- Monsts -->
143138
<!-- ------ -->
144-
<!-- - chccolate golem fires chocolate -->
139+
<!-- - chocolate golem fires chocolate -->
145140
<!-- - chickens - battle chickens - lay eggs as food - and they get names -->
146141
<!-- - acid jellies should damage weapons -->
147142
<!-- - mold growth / floor puddings -->
@@ -150,15 +145,14 @@
150145
<!-- - rat pack and king rat / cranium rat -->
151146
<!-- - zombie camel? -->
152147
<!-- - sewer wolf? -->
153-
<!-- - invisible monst? -->
154148
<!-- - monster that runs from light ? -->
155149
<!-- - tentacles out of the ground that try to surround you -->
156150
<!-- - dungeon walrus; long headed walrus with many tusks -->
157151
<!-- ------ -->
158152
<!-- -->
159153
<!-- Gods -->
160154
<!-- ------ -->
161-
<!-- - runes lean more torwards old gods -->
155+
<!-- - runes lean more towards old gods -->
162156
<!-- ------ -->
163157
<!-- -->
164158
<!-- Gfx -->
@@ -169,7 +163,7 @@
169163
<!-- Player -->
170164
<!-- ------ -->
171165
<!-- - weight factors into jumping -->
172-
<!-- - carry eat slime mold and gain acid resis? -->
166+
<!-- - carry eat slime mold and gain acid resist? -->
173167
<!-- ------ -->
174168
<!-- -->
175169
<!-- Spells -->

src/thing_display_ascii.cpp

Lines changed: 20 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,21 @@ void Thing::blit_ascii_at(point p, bool lit, bool left_bar)
321321
return;
322322
}
323323

324+
static uint8_t alpha = 128;
325+
static int step = 10;
326+
static int dir = 1;
327+
static uint32_t ts;
328+
329+
if (time_have_x_hundredths_passed_since(2, ts)) {
330+
alpha += dir * step;
331+
if (alpha > 240) {
332+
dir = -1;
333+
} else if (alpha < 100) {
334+
dir = 1;
335+
}
336+
ts = time_ms_cached();
337+
}
338+
324339
//
325340
// This is for walls that can be composed of multiple tiles.
326341
//
@@ -465,71 +480,35 @@ void Thing::blit_ascii_at(point p, bool lit, bool left_bar)
465480
//
466481
// Allow secret doors a chance to be seen
467482
//
468-
if (is_secret_door() && discovered()) {
469-
static uint8_t a = 128;
470-
static int step = 10;
471-
static int dir = 1;
472-
a += dir * step;
473-
if (a > 250) {
474-
dir = -1;
475-
} else if (a < 100) {
476-
dir = 1;
477-
}
483+
if (is_secret_door() /* && discovered() */) {
478484
color outline_color = ORANGE;
479-
outline_color.a = a;
485+
outline_color.a = alpha;
480486
ascii_set(TILE_LAYER_BG_0, p.x, p.y, outline_color);
481487
ascii_set(TILE_LAYER_FG_0, p.x, p.y, WHITE);
482488
}
483489

484490
if (gfx_pixelart_show_highlighted() && ! immediate_owner()) {
485491
if ((this == game->current_wid_thing_info) || (level->cursor && (this->curr_at == level->cursor->curr_at))) {
486-
static uint8_t a = 128;
487-
static int step = 10;
488-
static int dir = 1;
489-
a += dir * step;
490-
if (a > 250) {
491-
dir = -1;
492-
} else if (a < 100) {
493-
dir = 1;
494-
}
495492
color outline_color = ORANGE;
496-
outline_color.a = a;
493+
outline_color.a = alpha;
497494
ascii_set(TILE_LAYER_BG_0, p.x, p.y, outline_color);
498495
ascii_set(TILE_LAYER_FG_0, p.x, p.y, WHITE);
499496
}
500497
}
501498

502499
if (! is_dead) {
503500
if (is_currently_invisible && is_player()) {
504-
static uint8_t a = 128;
505-
static int step = 10;
506-
static int dir = 1;
507-
a += dir * step;
508-
if (a > 250) {
509-
dir = -1;
510-
} else if (a < 100) {
511-
dir = 1;
512-
}
513501
color outline_color = WHITE;
514-
outline_color.a = a;
502+
outline_color.a = alpha;
515503
ascii_set(TILE_LAYER_BG_0, p.x, p.y, outline_color);
516504
ascii_set(TILE_LAYER_FG_0, p.x, p.y, WHITE);
517505
}
518506

519507
if (! is_currently_invisible || is_player()) {
520508
if (is_raging()) {
521509
if ((this == game->current_wid_thing_info) || (level->cursor && (this->curr_at == level->cursor->curr_at))) {
522-
static uint8_t a = 128;
523-
static int step = 30;
524-
static int dir = 1;
525-
a += dir * step;
526-
if (a > 250) {
527-
dir = -1;
528-
} else if (a < 100) {
529-
dir = 1;
530-
}
531510
color outline_color = ORANGE;
532-
outline_color.a = a;
511+
outline_color.a = alpha;
533512
ascii_set(TILE_LAYER_BG_0, p.x, p.y, outline_color);
534513
ascii_set(TILE_LAYER_FG_0, p.x, p.y, WHITE);
535514
}

0 commit comments

Comments
 (0)