Skip to content

Commit

Permalink
Merge branch 'master' into v3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
profezzorn committed Jan 25, 2020
2 parents 7a10340 + b7676c1 commit 3a497b8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
6 changes: 5 additions & 1 deletion props/prop_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,11 @@ class PropBase : CommandParser, Looper, protected SaberBase {
if (!current_style()) return;
if (SaberBase::GetColorChangeMode() == SaberBase::COLOR_CHANGE_MODE_NONE) {
current_tick_angle_ = fusor.angle2();
if (!current_style()->HandlesColorChange()) {
bool handles_color_change = false;
#define CHECK_SUPPORTS_COLOR_CHANGE(N) \
handles_color_change |= current_config->blade##N->current_style() && current_config->blade##N->current_style()->HandlesColorChange();
ONCEPERBLADE(CHECK_SUPPORTS_COLOR_CHANGE)
if (!handles_color_change) {
STDOUT << "Entering smooth color change mode.\n";
current_tick_angle_ -= SaberBase::GetCurrentVariation() * M_PI * 2 / 32768;
current_tick_angle_ = fmod(current_tick_angle_, M_PI * 2);
Expand Down
10 changes: 7 additions & 3 deletions sound/hybrid_font.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class FontConfigFile : public ConfigFile {
CONFIG_VARIABLE(ProffieOSSwingOverlap, 0.5f);
CONFIG_VARIABLE(ProffieOSSmoothSwingDucking, 0.2f);
CONFIG_VARIABLE(ProffieOSSwingLowerThreshold, 200.0f);
CONFIG_VARIABLE(ProffieOSSlashAccelerationThreshold, 260.0f);
CONFIG_VARIABLE(ProffieOSSlashAccelerationThreshold, 130.0f);
CONFIG_VARIABLE(ProffieOSAnimationFrameRate, 0.0f);
}
// Igniter compat
Expand Down Expand Up @@ -48,7 +48,7 @@ class FontConfigFile : public ConfigFile {
// Specifies how agressive a swing has to be to be considered
// a slash. Once we reach, ProffieOSSwingSpeedThreshold, rate of
// swing speed change is used to determine if it's a swing or a
// slash. Defaults to 260 (degrees per second per second)
// slash. Defaults to 130 (degrees per second per second)
float ProffieOSSlashAccelerationThreshold;
// For OLED displays, this specifies the frame rate of animations.
float ProffieOSAnimationFrameRate;
Expand All @@ -72,7 +72,11 @@ class HybridFont : public SaberBase {
font_config.ReadInCurrentDir("config.ini");
STDOUT.print("Activating ");
// TODO: Find more reliable way to figure out if it's a monophonic or polyphonic font!!!!
monophonic_hum_ = SFX_poweron || SFX_poweroff || SFX_pwroff || SFX_blast;
if (SFX_in || SFX_out) {
monophonic_hum_ = false;
} else {
monophonic_hum_ = SFX_poweron || SFX_poweroff || SFX_pwroff || SFX_blast;
}
guess_monophonic_ = false;
if (monophonic_hum_) {
if (SFX_clash || SFX_blaster || SFX_swing) {
Expand Down
2 changes: 1 addition & 1 deletion styles/clash.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class SimpleClash {
BladeEffect *e = effect_.Detect(blade);
if (e) {
clash_ = true;
stab_ = EFFECT == EFFECT_CLASH && e->type == EFFECT_STAB;
stab_ = EFFECT == EFFECT_CLASH && e->type == EFFECT_STAB && blade->num_leds() > 1;
}
}
OverDriveColor getColor(int led) {
Expand Down
11 changes: 7 additions & 4 deletions styles/lockup.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
// Also handles "Drag" effect.
template<class BASE,
class LOCKUP, class DRAG_COLOR = LOCKUP,
class LOCKUP_SHAPE = Int<32768>, class DRAG_SHAPE = SmoothStep<Int<32000>, Int<8000>> >
class LOCKUP_SHAPE = Int<32768>, class DRAG_SHAPE = SmoothStep<Int<28671>, Int<4096>> >
class Lockup {
public:
void run(BladeBase* blade) {
single_pixel_ = blade->num_leds() == 1;
base_.run(blade);
lockup_.run(blade);
if (!is_same_type<DRAG_COLOR, LOCKUP>::value)
Expand All @@ -26,12 +27,14 @@ class Lockup {
OverDriveColor ret = base_.getColor(led);
switch (SaberBase::Lockup()) {
case SaberBase::LOCKUP_DRAG: {
int blend = single_pixel_ ? 32768 : drag_shape_.getInteger(led) >> 1;
if (!is_same_type<DRAG_COLOR, LOCKUP>::value) {
ret.c = ret.c.mix2(drag_.getColor(led).c, drag_shape_.getInteger(led)>>1);
ret.c = ret.c.mix2(drag_.getColor(led).c, blend);
} else {
ret.c = ret.c.mix2(lockup_.getColor(led).c, drag_shape_.getInteger(led)>>1);
ret.c = ret.c.mix2(lockup_.getColor(led).c, blend);
}
break;
}
case SaberBase::LOCKUP_NORMAL:
case SaberBase::LOCKUP_ARMED:
case SaberBase::LOCKUP_AUTOFIRE:
Expand All @@ -42,11 +45,11 @@ class Lockup {
}
case SaberBase::LOCKUP_NONE:
break;
}
}
return ret;
}
private:
bool single_pixel_;
BASE base_;
LOCKUP lockup_;
DRAG_COLOR drag_;
Expand Down

0 comments on commit 3a497b8

Please sign in to comment.