aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCrystalwarrior <varsash@gmail.com>2020-09-11 22:17:13 +0300
committerCrystalwarrior <varsash@gmail.com>2020-09-11 22:17:13 +0300
commit8cc067dee42ede24614f1a7bccef7f8752f56a01 (patch)
tree57e9ad13444e8b4f0d30cbcd4a29785af6b432e8
parentfe5128280c4e86dbc8e6b7af284bebb9c4f570f0 (diff)
More accurate/consistent blip rate functionality inspired by https://youtu.be/Min0hkwO43g
-rw-r--r--include/courtroom.h2
-rw-r--r--src/courtroom.cpp18
2 files changed, 16 insertions, 4 deletions
diff --git a/include/courtroom.h b/include/courtroom.h
index 5b5ff6c1..31ab41c6 100644
--- a/include/courtroom.h
+++ b/include/courtroom.h
@@ -311,7 +311,7 @@ private:
int real_tick_pos = 0;
// used to determine how often blips sound
int blip_ticker = 0;
- int blip_rate = 1;
+ int blip_rate = 2;
int rainbow_counter = 0;
bool rainbow_appended = false;
bool blank_blip = false;
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index 04c625fe..3e00158e 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -2938,11 +2938,23 @@ void Courtroom::chat_tick()
ui_vp_message->ensureCursorVisible();
- // Blip player and real tick pos ticker
- if (!formatting_char && (f_character != ' ' || blank_blip)) {
- if (blip_ticker % blip_rate == 0) {
+ // We blip every "blip rate" letters.
+ // Here's an example with blank_blip being false and blip_rate being 2:
+ // I am you
+ // ! ! ! !
+ // where ! is the blip sound
+ if (blip_ticker % blip_rate == 0) {
+ // ignoring white space unless blank_blip is enabled.
+ if (!formatting_char && (f_character != ' ' || blank_blip)) {
blip_player->blip_tick();
+ ++blip_ticker;
}
+ }
+ else
+ {
+ // Don't fully ignore whitespace still, keep ticking until
+ // we reached the need to play a blip sound - we also just
+ // need to wait for a letter to play it on.
++blip_ticker;
}