MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / xPadUpdate

Function xPadUpdate

src/SB/Core/x/xPad.cpp:64–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64S32 xPadUpdate(S32 idx, F32 time_passed)
65{
66 U32 new_on = 0;
67
68 if (zScene_ScreenAdjustMode())
69 {
70 xPadAnalogIsDigital(0, 0);
71 }
72 else if (zMenuRunning() || zGameIsPaused() || zGame_HackIsGallery())
73 {
74 xPadAnalogIsDigital(0, 0);
75 }
76 else
77 {
78 xPadAnalogIsDigital(0, 0);
79 }
80
81 _tagxPad* p = &mPad[idx];
82
83 if (!iPadUpdate(p, &new_on))
84 {
85 p->pressed = 0;
86 p->released = 0;
87 return 1;
88 }
89
90 if ((p->flags & 0x10) && (p->flags & 0x1))
91 {
92 U32 fake_dpad = 0;
93 if (p->analog1.x >= 50)
94 {
95 fake_dpad |= 0x20;
96 }
97 else if (p->analog1.x <= -50)
98 {
99 fake_dpad |= 0x80;
100 }
101 if (p->analog1.y >= 50)
102 {
103 fake_dpad |= 0x40;
104 }
105 else if (p->analog1.y <= -50)
106 {
107 fake_dpad |= 0x10;
108 }
109 if (fake_dpad == 0)
110 {
111 p->al2d_timer = 0.0f;
112 }
113 else
114 {
115 p->al2d_timer -= time_passed;
116 if (p->al2d_timer <= 0.0f)
117 {
118 new_on |= fake_dpad;
119 p->al2d_timer = 0.35f;
120 }
121 }

Callers 4

zSaveLoad_TickFunction · 0.50
zMenuLoopFunction · 0.50
PlayFMVFunction · 0.50

Calls 6

zScene_ScreenAdjustModeFunction · 0.85
xPadAnalogIsDigitalFunction · 0.85
zMenuRunningFunction · 0.85
zGameIsPausedFunction · 0.85
zGame_HackIsGalleryFunction · 0.85
iPadUpdateFunction · 0.50

Tested by

no test coverage detected