private void HandlePlayerTurnKeys(ResultSet resultSet) { // Check if we should block all player input until all keys are up // This is useful to block player input when exiting menus if (mBlockMoveUntilKeyUp) { if (!AnyPlayerKeyDown()) { mBlockMoveUntilKeyUp = false; } else { return; } } if (RB.ButtonPressed(RB.BTN_SYSTEM)) { resultSet.AddExit(); return; } if (RB.KeyPressed(KeyCode.I)) { resultSet.AddShowInventory(); } if (RB.KeyPressed(KeyCode.O)) { resultSet.AddDropInventory(); } if (RB.KeyPressed(KeyCode.P)) { resultSet.AddShowCharacterScreen(); } if (RB.KeyPressed(KeyCode.Return) || RB.KeyPressed(KeyCode.KeypadEnter)) { resultSet.AddTakeStairs(); } if (RB.KeyPressed(KeyCode.H)) { resultSet.AddShowHelp(); } Vector2i delta = Vector2i.zero; if (RB.KeyDown(KeyCode.W) || RB.KeyDown(KeyCode.Keypad8)) { delta.y--; } else if (RB.KeyDown(KeyCode.S) || RB.KeyDown(KeyCode.Keypad2)) { delta.y++; } else if (RB.KeyDown(KeyCode.A) || RB.KeyDown(KeyCode.Keypad4)) { delta.x--; } else if (RB.KeyDown(KeyCode.D) || RB.KeyDown(KeyCode.Keypad6)) { delta.x++; } else if (RB.KeyDown(KeyCode.Q) || RB.KeyDown(KeyCode.Keypad7)) { delta.x--; delta.y--; } else if (RB.KeyDown(KeyCode.E) || RB.KeyDown(KeyCode.Keypad9)) { delta.x++; delta.y--; } else if (RB.KeyDown(KeyCode.Z) || RB.KeyDown(KeyCode.Keypad1)) { delta.x--; delta.y++; } else if (RB.KeyDown(KeyCode.C) || RB.KeyDown(KeyCode.Keypad3)) { delta.x++; delta.y++; } if (delta.x > 1) { delta.x = 1; } else if (delta.x < -1) { delta.x = -1; } if (delta.y > 1) { delta.y = 1; } else if (delta.y < -1) { delta.y = -1; } if (delta.x == 0 && delta.y == 0) { mKeyRepeatStage = 0; } else { var ticksDelta = RB.Ticks - mLastMoveTimestamp; if (mKeyRepeatStage == 0 || (mKeyRepeatStage == 1 && ticksDelta > C.KEY_REPEAT_SPEED_STAGE1) || (mKeyRepeatStage > 1 && ticksDelta > C.KEY_REPEAT_SPEED_STAGE2)) { if (delta.x != 0 || delta.y != 0) { mKeyRepeatStage++; mLastMoveTimestamp = RB.Ticks; resultSet.AddMove(delta); } } } // Wait if (RB.KeyPressed(KeyCode.X) || RB.KeyPressed(KeyCode.Keypad5)) { resultSet.AddMove(Vector2i.zero); } if (RB.KeyPressed(KeyCode.G) || RB.KeyPressed(KeyCode.Keypad0)) { resultSet.AddPickup(mPlayer); } if (RB.KeyPressed(KeyCode.F)) { var ranged = mPlayer.e.equipment.equipment[(int)EquipmentSlot.Ranged]; var arrow = mPlayer.e.inventory.GetArrow(); if (!ranged.isEmpty && !arrow.isEmpty) { resultSet.AddTargeting(ranged); } else { if (ranged.isEmpty) { resultSet.AddMessage(C.FSTR.Set("You do not have a ranged weapon equipped.")); } else if (arrow.isEmpty) { resultSet.AddMessage(C.FSTR.Set("You do not have an arrow to shoot.")); } } } }