Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
JPARandom.h
Go to the documentation of this file.
1#ifndef JPARANDOM_H
2#define JPARANDOM_H
3
4#include "dolphin/types.h"
5
10struct JPARandom {
11public:
12 JPARandom() { mSeed = 0; }
13 JPARandom(u32 seed) { mSeed = seed; }
15 void set_seed(u32 seed) { mSeed = seed; }
16
17 u32 get_rndm_u() { return mSeed = mSeed * 0x19660du + 0x3c6ef35fu; }
18
20 union {
21 u32 u;
22 f32 f;
23 } a;
24 a.u = ((get_rndm_u() >> 9) | 0x3f800000);
25 return a.f - 1.0f;
26 }
27
29 f32 f = get_rndm_f();
30 return (f + f) - 1.0f;
31 }
32
34 return get_rndm_f() - 0.5f;
35 }
36
37 s16 get_rndm_ss() { return (s16)(get_rndm_u() >> 16); }
38
39public:
41};
42
43#endif
unsigned long u32
Definition types.h:12
signed short int s16
Definition types.h:9
float f32
Definition types.h:25
double u
Definition e_pow.c:163
a
Definition k_cos.c:89
Definition JPARandom.h:10
JPARandom()
Definition JPARandom.h:12
~JPARandom()
Definition JPARandom.h:14
s16 get_rndm_ss()
Definition JPARandom.h:37
f32 get_rndm_f()
Definition JPARandom.h:19
f32 get_rndm_zh()
Definition JPARandom.h:33
JPARandom(u32 seed)
Definition JPARandom.h:13
f32 get_rndm_zp()
Definition JPARandom.h:28
u32 get_rndm_u()
Definition JPARandom.h:17
void set_seed(u32 seed)
Definition JPARandom.h:15
u32 mSeed
Definition JPARandom.h:40