mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-22 14:23:44 -07:00
Remove Random_Float
, and apply RandomDouble
where it was being used instead.
Add proper range notation to `RandomDouble` to denote the lack of inclusivity for the max part of the range.
This commit is contained in:
parent
c26bd6a082
commit
53c6102b8f
3 changed files with 4 additions and 12 deletions
|
@ -112,7 +112,7 @@ void GameInteractor::RawAction::FreezePlayer() {
|
|||
void GameInteractor::RawAction::BurnPlayer() {
|
||||
Player* player = GET_PLAYER(gPlayState);
|
||||
for (int i = 0; i < 18; i++) {
|
||||
player->bodyFlameTimers[i] = Rand_S16Offset(0, 200);
|
||||
player->bodyFlameTimers[i] = (uint8_t)Rand_S16Offset(0, 200);
|
||||
}
|
||||
player->bodyIsBurning = true;
|
||||
func_80837C0C(gPlayState, player, 0, 0, 0, 0, 0);
|
||||
|
@ -559,7 +559,7 @@ void GameInteractor::RawAction::SetRandomWind(bool active) {
|
|||
GameInteractor::State::RandomWindActive = 0;
|
||||
GameInteractor::State::RandomWindSecondsSinceLastDirectionChange = 0;
|
||||
player->pushedSpeed = 0.0f;
|
||||
player->pushedYaw = 0.0f;
|
||||
player->pushedYaw = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -617,7 +617,7 @@ GameInteractionEffectQueryResult GameInteractor::RawAction::SpawnEnemyWithOffset
|
|||
}
|
||||
|
||||
// Generate point in random angle with a radius.
|
||||
float angle = Random_Float(0, 2 * M_PI);
|
||||
float angle = (float)(RandomDouble() * 2 * M_PI);
|
||||
float radius = 150;
|
||||
float posXOffset = radius * cos(angle);
|
||||
float posZOffset = radius * sin(angle);
|
||||
|
|
|
@ -33,14 +33,7 @@ uint32_t Random(uint32_t min, uint32_t max) {
|
|||
return distribution(generator);
|
||||
}
|
||||
|
||||
// Returns a random float in range [min, max-1]
|
||||
float Random_Float(float min, float max) {
|
||||
Random_InitSeed();
|
||||
boost::random::uniform_real_distribution<float> distribution(min, max - 1);
|
||||
return distribution(generator);
|
||||
}
|
||||
|
||||
// Returns a random floating point number in [0.0, 1.0]
|
||||
// Returns a random floating point number in [0.0, 1.0)
|
||||
double RandomDouble() {
|
||||
boost::random::uniform_real_distribution<double> distribution(0.0, 1.0);
|
||||
return distribution(generator);
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
void Random_Init(uint32_t seed);
|
||||
uint32_t Random(uint32_t min, uint32_t max);
|
||||
float Random_Float(float min, float max);
|
||||
double RandomDouble();
|
||||
|
||||
// Get a random element from a vector or array
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue