MCPcopy Create free account
hub / github.com/EasyRPG/Player / CheckInput

Method CheckInput

src/game_interpreter.cpp:3162–3229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3160}
3161
3162int Game_Interpreter::KeyInputState::CheckInput() const {
3163 auto check = wait ? Input::IsTriggered : Input::IsPressed;
3164
3165 // Mouse buttons checked first (Maniac checks them last) to prevent conflict
3166 // when DECISION is mapped to MOUSE_LEFT
3167 // The order of checking matches the Maniac behaviour
3168 if (keys[Keys::eMouseScrollDown] && check(Input::SCROLL_DOWN)) {
3169 return 1001;
3170 }
3171
3172 if (keys[Keys::eMouseScrollUp] && check(Input::SCROLL_UP)) {
3173 return 1004;
3174 }
3175
3176 if (keys[Keys::eMouseMiddle] && check(Input::MOUSE_MIDDLE)) {
3177 return 1007;
3178 }
3179
3180 if (keys[Keys::eMouseRight] && check(Input::MOUSE_RIGHT)) {
3181 return 1006;
3182 }
3183
3184 if (keys[Keys::eMouseLeft] && check(Input::MOUSE_LEFT)) {
3185 return 1005;
3186 }
3187
3188 // RPG processes keys from highest variable value to lowest.
3189 if (keys[Keys::eOperators]) {
3190 for (int i = 5; i > 0;) {
3191 --i;
3192 if (check((Input::InputButton)(Input::PLUS + i))) {
3193 return 20 + i;
3194 }
3195 }
3196 }
3197 if (keys[Keys::eNumbers]) {
3198 for (int i = 10; i > 0;) {
3199 --i;
3200 if (check((Input::InputButton)(Input::N0 + i))) {
3201 return 10 + i;
3202 }
3203 }
3204 }
3205
3206 if (keys[Keys::eShift] && check(Input::SHIFT)) {
3207 return 7;
3208 }
3209 if (keys[Keys::eCancel] && check(Input::CANCEL)) {
3210 return 6;
3211 }
3212 if (keys[Keys::eDecision] && check(Input::DECISION)) {
3213 return 5;
3214 }
3215 if (keys[Keys::eUp] && check(Input::UP)) {
3216 return 4;
3217 }
3218 if (keys[Keys::eRight] && check(Input::RIGHT)) {
3219 return 3;

Callers 2

UpdateMethod · 0.80
CommandKeyInputProcMethod · 0.80

Calls 1

checkClass · 0.85

Tested by

no test coverage detected