mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-05-23 06:34:18 -04:00
link m_pause.c
This commit is contained in:
@@ -62,6 +62,8 @@ m_needlework.c:
|
||||
.text: [0x803C98EC, 0x803C9F7C]
|
||||
.data: [0x8065ABC0, 0x8065AE30]
|
||||
.bss: [0x81298F60, 0x81299180]
|
||||
m_pause.c:
|
||||
.text: [0x803D8A34, 0x803D8AEC]
|
||||
m_police_box.c:
|
||||
.text: [0x803DE8A0, 0x803DEE38]
|
||||
.rodata: [0x806431C8, 0x806431D8]
|
||||
|
||||
@@ -26,6 +26,8 @@ extern "C" {
|
||||
#define BUTTON_B 0x4000
|
||||
#define BUTTON_A 0x8000
|
||||
|
||||
#define CHECK_BTN_ALL(state, combo) (~((state) | ~(combo)) == 0)
|
||||
|
||||
/* sizeof(struct controller_s) == 0x38 */
|
||||
typedef struct controller_s {
|
||||
/* 0x00 */ f32 move_pX;
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef M_PAUSE_H
|
||||
#define M_PAUSE_H
|
||||
|
||||
#include "types.h"
|
||||
#include "libu64/pad.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct pause_t{
|
||||
int enabled;
|
||||
int timer;
|
||||
}pause_t; // size = 0x8
|
||||
|
||||
|
||||
void Pause_ct(pause_t* pause);
|
||||
int Pause_proc(pause_t* pause, pad_t* pad);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,21 @@
|
||||
#include "m_pause.h"
|
||||
#include "m_controller.h"
|
||||
void Pause_ct(pause_t* pause){
|
||||
pause->timer = 0;
|
||||
pause->enabled = 0;
|
||||
}
|
||||
|
||||
int Pause_proc(pause_t* pause, pad_t* pad){
|
||||
|
||||
if(CHECK_BTN_ALL(pad->now.button, BUTTON_R) && CHECK_BTN_ALL(pad->on.button, BUTTON_DDOWN)){
|
||||
pause->enabled = !pause->enabled;
|
||||
}
|
||||
|
||||
if((!pause->enabled) || (CHECK_BTN_ALL(pad->now.button, BUTTON_Z) &&
|
||||
(CHECK_BTN_ALL(pad->on.button, BUTTON_R) || (CHECK_BTN_ALL(pad->now.button, BUTTON_R)
|
||||
&& (++pause->timer > 8))))){
|
||||
pause->timer = 0;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user