summaryrefslogtreecommitdiff
path: root/src/code/m_pause.c
blob: 0b598569796b76d522ed4263e21493c171dd9cad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "m_pause.h"
#include "m_controller.h"
#include "libc/stdbool.h"

void Pause_ct(Pause* pause) {
    pause->timer = 0;
    pause->enabled = 0;
}

s32 Pause_proc(Pause* pause, Input* input) {
    if (CHECK_BTN_ALL(input->cur.button, R_TRIG) && CHECK_BTN_ALL(input->press.button, D_JPAD)) {
        pause->enabled = !pause->enabled;
    }

    if ((!pause->enabled) || (CHECK_BTN_ALL(input->cur.button, Z_TRIG) &&
                              (CHECK_BTN_ALL(input->press.button, R_TRIG) ||
                               (CHECK_BTN_ALL(input->cur.button, R_TRIG) && (++pause->timer >= 9))))) {
        pause->timer = 0;
        return true;
    }
    return false;
}