Skip to content

Commit 39565d3

Browse files
authored
Merge pull request #6325 from Goober5000/probability-curves-followup
follow-up to probability curves
2 parents b98b8f2 + c8aa28b commit 39565d3

File tree

7 files changed

+11
-12
lines changed

7 files changed

+11
-12
lines changed

code/gamesnd/gamesnd.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -845,10 +845,10 @@ void parse_gamesnd_soundset(game_snd* gs, bool no_create) {
845845
}
846846

847847
if (optional_string("+Pitch:")) {
848-
gs->pitch_range = util::UniformFloatRange(0.0001f);
848+
gs->pitch_range = util::ParsedRandomFloatRange::parseRandomRange(0.0001f);
849849
} else if (!no_create) {
850850
// Default pitch is 1.0
851-
gs->pitch_range = util::ParsedRandomFloatRange::parseRandomRange(1.0f);
851+
gs->pitch_range = util::UniformFloatRange(1.0f);
852852
}
853853
}
854854

code/math/curve.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ float Curve::GetValue(float x_val) const {
235235
return kframe->pos.y + out * (next_pos->y - kframe->pos.y);
236236
case CurveInterpFunction::Curve:
237237
// add 0.5 to ensure this behaves like rounding
238-
out = Curves[(int)(kframe->param1 + 0.5f)].GetValue(t);
238+
out = Curves[fl2i(kframe->param1 + 0.5f)].GetValue(t);
239239
return kframe->pos.y + out * (next_pos->y - kframe->pos.y);
240240
default:
241241
UNREACHABLE("Unrecognized curve function");
@@ -286,7 +286,7 @@ float Curve::GetValueIntegrated(float x_val) const
286286
break;
287287
case CurveInterpFunction::Curve:
288288
// add 0.5 to ensure this behaves like rounding
289-
integrated_value += m * (Curves[(int)(kframe->param1 + 0.5f)].GetValueIntegrated(t) - Curves[(int)(kframe->param1 + 0.5f)].GetValueIntegrated(0.f));
289+
integrated_value += m * (Curves[fl2i(kframe->param1 + 0.5f)].GetValueIntegrated(t) - Curves[fl2i(kframe->param1 + 0.5f)].GetValueIntegrated(0.f));
290290
break;
291291
default:
292292
UNREACHABLE("Unrecognized curve function");
@@ -298,4 +298,4 @@ float Curve::GetValueIntegrated(float x_val) const
298298
}
299299

300300
return integrated_value;
301-
}
301+
}

code/math/curve.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,5 @@ public :
4949
extern SCP_vector<Curve> Curves;
5050

5151
extern int curve_get_by_name(const SCP_string& in_name);
52-
extern int pdf_to_cdf(int curve);
5352
extern void curves_init();
5453

code/nebula/neb.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ typedef struct poof_info {
8282
float fade_multiplier; // the current multiplier for a poof's alpha transparency used to render the poofs of this type
8383

8484
poof_info() :
85-
scale(::util::UniformFloatRange(175.f, 175.f)),
85+
scale(::util::UniformFloatRange(175.f)),
8686
rotation(::util::UniformFloatRange(-3.7f, 3.7f)),
87-
alpha(::util::UniformFloatRange(0.8f, 0.8f))
87+
alpha(::util::UniformFloatRange(0.8f))
8888
{
8989
bitmap_filename[0] = '\0';
9090
generic_anim_init(&bitmap);

code/particle/effects/GenericShapeEffect.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class GenericShapeEffect : public ParticleEffect {
3434

3535
ConeDirection m_direction = ConeDirection::Incoming;
3636
::util::ParsedRandomFloatRange m_velocity;
37-
::util::ParsedRandomRange<uint> m_particleNum;
37+
::util::ParsedRandomUintRange m_particleNum;
3838
float m_particleChance = 1.0f;
3939
::util::ParsedRandomFloatRange m_particleRoll;
4040
ParticleEffectHandle m_particleTrail = ParticleEffectHandle::invalid();
@@ -179,7 +179,7 @@ class GenericShapeEffect : public ParticleEffect {
179179
}
180180

181181
if (internal::required_string_if_new("+Number:", nocreate)) {
182-
m_particleNum = ::util::ParsedRandomRange<uint>::parseRandomRange();
182+
m_particleNum = ::util::ParsedRandomUintRange::parseRandomRange();
183183
}
184184
if (!nocreate) {
185185
m_particleChance = 1.0f;

code/particle/effects/VolumeEffect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ namespace particle {
100100
}
101101

102102
if (internal::required_string_if_new("+Number:", nocreate)) {
103-
m_particleNum = ::util::ParsedRandomRange<uint>::parseRandomRange();
103+
m_particleNum = ::util::ParsedRandomUintRange::parseRandomRange();
104104
}
105105

106106
if (!nocreate) {

code/particle/effects/VolumeEffect.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace particle {
2323
float m_stretch = 1.0f;
2424
util::EffectTiming m_timing;
2525

26-
::util::ParsedRandomRange<uint> m_particleNum;
26+
::util::ParsedRandomUintRange m_particleNum;
2727
float m_particleChance = 1.0f;
2828
::util::ParsedRandomFloatRange m_particleRoll;
2929

0 commit comments

Comments
 (0)