DCDecomp
A decompilation of Dark Cloud for the PlayStation 2
Loading...
Searching...
No Matches
wind.cpp
1#include "wind.hpp"
2
3#include <cstdlib>
4
5void CWind::SetDir(float *direction) {
6 sceVu0Normalize(dir, direction);
7}
8
9void CWind::SetVelocity(float speed) {
10 velocity = speed;
11}
12
13void CWind::GetWind(float *out) {
14 sceVu0ScaleVector(out, dir, velocity);
15}
16
17void CWind::GetWindNoise(float *out) {
18 sceVu0ScaleVector(out, dir, velocity * gust);
19}
20
22 // A random walk of at most a tenth of the range per step, held inside it.
23 gust = gust + 0.2f * ((float) rand() / 2147483648.0f - 0.5f);
24
25 if (gust < 0.0f) {
26 gust = 0.0f;
27 }
28
29 if (!(gust <= 1.0f)) {
30 gust = 1.0f;
31 }
32}
33
35 velocity = 0.0f;
36 gust = (float) rand() / 2147483648.0f;
37}
float velocity
Definition wind.hpp:16
void SetVelocity(float speed)
Definition wind.cpp:9
void SetDir(float *direction)
Definition wind.cpp:5
float gust
Definition wind.hpp:14
void GetWind(float *out)
Definition wind.cpp:13
void GetWindNoise(float *out)
Definition wind.cpp:17
sceVu0FVECTOR dir
Definition wind.hpp:15
CWind()
Definition wind.cpp:34
void Step()
Definition wind.cpp:21