mirror of
https://github.com/pret/pmd-red.git
synced 2026-04-24 23:17:03 -05:00
create random.h
This commit is contained in:
parent
fdf832bec1
commit
66219cd4af
11
include/random.h
Normal file
11
include/random.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef GUARD_RANDOM_H
|
||||
#define GUARD_RANDOM_H
|
||||
|
||||
void SeedRng(u8 *seed);
|
||||
s32 Random(void);
|
||||
s32 RandomCapped(s32 cap);
|
||||
s32 RandomRange(s32 a, s32 b);
|
||||
s32 GetRngState(void);
|
||||
void SetRngState(s32 state);
|
||||
|
||||
#endif // GUARD_RANDOM_H
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
#include "global.h"
|
||||
#include "random.h"
|
||||
|
||||
extern char ewram_start[];
|
||||
|
||||
|
|
@ -26,7 +27,6 @@ extern char unk_code[];
|
|||
extern void sub_800CDA8(int);
|
||||
extern void sub_800B540(void);
|
||||
extern void sub_800CF0C(void);
|
||||
extern void SeedRng(u8 *);
|
||||
extern void sub_8004D78(void);
|
||||
extern void nullsub_9(void);
|
||||
extern void nullsub_6(void);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include "global.h"
|
||||
#include "random.h"
|
||||
|
||||
extern s32 gRngState;
|
||||
|
||||
|
|
@ -26,6 +27,7 @@ s32 RandomCapped(s32 cap)
|
|||
return (((Random() & 0xFFFF) * cap) >> 16) & 0xFFFF;
|
||||
}
|
||||
|
||||
// Returns a random number between a and b.
|
||||
s32 RandomRange(s32 a, s32 b)
|
||||
{
|
||||
if (a == b)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user