Paper Mario DX
Paper Mario (N64) modding
Loading...
Searching...
No Matches
rumble.c
Go to the documentation of this file.
1
#include "common.h"
2
#include "nu/nusys.h"
3
#include "
rumble.h
"
4
5
// TODO: replace nustuff with defines
6
7
u16
rumbleMaxDuration
= 0;
8
s32
rumbleButtons
= 0;
9
10
void
poll_rumble
(
void
) {
11
nuContRmbCheck(0);
12
nuContRmbModeSet(0, 2);
13
}
14
15
void
start_rumble
(s32 freq, s32 nframes) {
16
if
(
gGameStatusPtr
->
demoState
==
DEMO_STATE_NONE
) {
17
if
(
rumbleMaxDuration
!= 0) {
18
#if !VERSION_JP
19
s32 maxFrames =
rumbleMaxDuration
* 2;
20
21
if
(nframes > maxFrames) {
22
nframes = maxFrames;
23
}
24
#endif
25
26
if
(nuContRmbCheck(0) == 0) {
27
nuContRmbModeSet(0, 2);
28
nuContRmbStart(0, freq, nframes);
29
}
30
}
31
}
32
}
33
34
void
update_max_rumble_duration
(
void
) {
35
if
(
rumbleButtons
!=
gGameStatusPtr
->
curButtons
[0]) {
36
rumbleButtons
=
gGameStatusPtr
->
curButtons
[0];
37
reset_max_rumble_duration
();
38
}
39
40
if
(
rumbleMaxDuration
!= 0) {
41
rumbleMaxDuration
--;
42
}
43
}
44
45
void
reset_max_rumble_duration
(
void
) {
46
#if VERSION_JP
47
rumbleMaxDuration
= 600;
48
#else
49
rumbleMaxDuration
= 300;
50
#endif
51
}
GameStatus::curButtons
u32 curButtons[4]
Definition
common_structs.h:1381
GameStatus::demoState
s8 demoState
Definition
common_structs.h:1398
DEMO_STATE_NONE
@ DEMO_STATE_NONE
Definition
enums.h:3535
rumbleButtons
s32 rumbleButtons
Definition
rumble.c:8
rumbleMaxDuration
u16 rumbleMaxDuration
Definition
rumble.c:7
update_max_rumble_duration
void update_max_rumble_duration(void)
Definition
rumble.c:34
start_rumble
void start_rumble(s32 freq, s32 nframes)
Definition
rumble.c:15
reset_max_rumble_duration
void reset_max_rumble_duration(void)
Definition
rumble.c:45
poll_rumble
void poll_rumble(void)
Definition
rumble.c:10
rumble.h
gGameStatusPtr
GameStatus * gGameStatusPtr
Definition
main_loop.c:32
src
rumble.c
Generated by
1.10.0