Skip to content

Commit

Permalink
fixed some minor bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ironbell committed Jun 20, 2018
1 parent 487ac15 commit 9a5aa58
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 45 deletions.
8 changes: 8 additions & 0 deletions include/Enums/EnumNames.h
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,14 @@ class EnumNames final {
return "LT";
case GamepadAxis::RightTrigger:
return "RT";
case GamepadAxis::LeftButton1:
return "L1";
case GamepadAxis::RightButton1:
return "R1";
case GamepadAxis::LeftButton2:
return "L2";
case GamepadAxis::RightButton2:
return "R2";
case GamepadAxis::Square:
// ¾
return getUtf8(0xbe);
Expand Down
4 changes: 4 additions & 0 deletions include/Enums/GamepadAxis.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ enum class GamepadAxis {
RightStickRight,
LeftTrigger,
RightTrigger,
LeftButton1,
RightButton1,
LeftButton2,
RightButton2,
Square,
Circle,
Triangle,
Expand Down
4 changes: 2 additions & 2 deletions include/Global/global_definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// #define STEAM

// versioning
#define CENDRIC_VERSION_NR_RAW "1.1.0beta1"
#define CENDRIC_VERSION_NR_RAW "1.1.0beta2"
#define ENVIRONMENT "64bit"
#ifdef STEAM
#define CENDRIC_VERSION_NR CENDRIC_VERSION_NR_RAW " " ENVIRONMENT
Expand All @@ -26,7 +26,7 @@
#endif

// Debug version
//#define DEBUG
#define DEBUG

/* Create savegame and screenshot folders outside of the Cendric directory at locations determined by the operating system.
Usually set via cmake.
Expand Down
1 change: 1 addition & 0 deletions include/Screens/LevelScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class LevelScreen final : public WorldScreen {
Button* m_backToMenuButton = nullptr;
Button* m_backToMapButton = nullptr;
Button* m_resumeButton = nullptr;
ButtonGroup* m_buttonGroup = nullptr;

ScreenOverlay* m_gamePausedOverlay = nullptr;

Expand Down
4 changes: 1 addition & 3 deletions src/Controller/GamepadController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,7 @@ void GamepadController::notifyGamepadConnected() {
g_resourceManager->getConfiguration().reloadGamepadMapping(productId);
}

// TODO: should only be info.
g_logger->logError("GamepadController", "Gamepad Product ID: " + std::to_string(static_cast<int>(productId)));

g_logger->logInfo("GamepadController", "Gamepad Product ID: " + std::to_string(static_cast<int>(productId)));
break;
}
}
Expand Down
59 changes: 27 additions & 32 deletions src/Controller/GamepadMappings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ std::map<Key, GamepadInput> GamepadMappings::getUnknownMappings() {
{ Key::Move_Down, GamepadInput::Axis_Y_Positive },
{ Key::Move_Right, GamepadInput::Axis_X_Positive },
{ Key::Move_Left, GamepadInput::Axis_X_Positive },
{ Key::Move_Up2, GamepadInput::Axis_PovX_Positive },
{ Key::Move_Down2, GamepadInput::Axis_PovX_Negative },
{ Key::Move_Right2, GamepadInput::Axis_PovY_Positive },
{ Key::Move_Left2, GamepadInput::Axis_PovY_Negative },
{ Key::Move_Up2, GamepadInput::Axis_PovY_Negative },
{ Key::Move_Down2, GamepadInput::Axis_PovY_Positive },
{ Key::Move_Right2, GamepadInput::Axis_PovX_Positive },
{ Key::Move_Left2, GamepadInput::Axis_PovX_Negative },
{ Key::Aim_Up, GamepadInput::Axis_V_Negative },
{ Key::Aim_Down, GamepadInput::Axis_V_Positive },
{ Key::Aim_Right, GamepadInput::Axis_U_Positive },
Expand Down Expand Up @@ -143,10 +143,10 @@ const key_map GamepadMappings::XboxOneKeyMap =

const input_map GamepadMappings::XboxOneInputMap =
{
{ GamepadInput::Axis_PovX_Negative, GamepadAxis::DPadDown },
{ GamepadInput::Axis_PovX_Positive, GamepadAxis::DPadUp },
{ GamepadInput::Axis_PovY_Negative, GamepadAxis::DPadLeft },
{ GamepadInput::Axis_PovY_Positive, GamepadAxis::DPadRight },
{ GamepadInput::Axis_PovX_Negative, GamepadAxis::DPadLeft },
{ GamepadInput::Axis_PovX_Positive, GamepadAxis::DPadRight },
{ GamepadInput::Axis_PovY_Negative, GamepadAxis::DPadDown },
{ GamepadInput::Axis_PovY_Positive, GamepadAxis::DPadUp },
{ GamepadInput::Axis_X_Negative, GamepadAxis::LeftStickLeft },
{ GamepadInput::Axis_X_Positive, GamepadAxis::LeftStickRight },
{ GamepadInput::Axis_Y_Negative, GamepadAxis::LeftStickUp },
Expand All @@ -171,30 +171,26 @@ const input_map GamepadMappings::XboxOneInputMap =

const input_map GamepadMappings::Ds4InputMap =
{
{ GamepadInput::Axis_PovX_Negative, GamepadAxis::DPadDown },
{ GamepadInput::Axis_PovX_Positive, GamepadAxis::DPadUp },
{ GamepadInput::Axis_PovY_Negative, GamepadAxis::DPadLeft },
{ GamepadInput::Axis_PovY_Positive, GamepadAxis::DPadRight },
{ GamepadInput::Axis_PovX_Negative, GamepadAxis::DPadLeft },
{ GamepadInput::Axis_PovX_Positive, GamepadAxis::DPadRight },
{ GamepadInput::Axis_PovY_Negative, GamepadAxis::DPadDown },
{ GamepadInput::Axis_PovY_Positive, GamepadAxis::DPadUp },
{ GamepadInput::Axis_X_Negative, GamepadAxis::LeftStickLeft },
{ GamepadInput::Axis_X_Positive, GamepadAxis::LeftStickRight },
{ GamepadInput::Axis_Y_Negative, GamepadAxis::LeftStickUp },
{ GamepadInput::Axis_Y_Positive, GamepadAxis::LeftStickDown },
{ GamepadInput::Axis_Z_Negative, GamepadAxis::RightStickLeft },
{ GamepadInput::Axis_Z_Positive, GamepadAxis::RightStickRight },
{ GamepadInput::Axis_R_Negative, GamepadAxis::RightStickDown },
{ GamepadInput::Axis_R_Positive, GamepadAxis::RightStickUp },
{ GamepadInput::Axis_V_Negative, GamepadAxis::LeftTrigger },
{ GamepadInput::Axis_V_Positive, GamepadAxis::LeftTrigger },
{ GamepadInput::Axis_U_Negative, GamepadAxis::RightTrigger },
{ GamepadInput::Axis_U_Positive, GamepadAxis::RightTrigger },
{ GamepadInput::Axis_R_Negative, GamepadAxis::RightStickUp },
{ GamepadInput::Axis_R_Positive, GamepadAxis::RightStickDown },
{ GamepadInput::Button_0, GamepadAxis::Square },
{ GamepadInput::Button_1, GamepadAxis::X },
{ GamepadInput::Button_2, GamepadAxis::Circle },
{ GamepadInput::Button_3, GamepadAxis::Triangle },
{ GamepadInput::Button_4, GamepadAxis::LeftShoulder },
{ GamepadInput::Button_5, GamepadAxis::RightShoulder },
{ GamepadInput::Button_6, GamepadAxis::LeftTrigger },
{ GamepadInput::Button_7, GamepadAxis::RightTrigger },
{ GamepadInput::Button_4, GamepadAxis::LeftButton1 },
{ GamepadInput::Button_5, GamepadAxis::RightButton1 },
{ GamepadInput::Button_6, GamepadAxis::LeftButton2 },
{ GamepadInput::Button_7, GamepadAxis::RightButton2 },
{ GamepadInput::Button_8, GamepadAxis::Share },
{ GamepadInput::Button_9, GamepadAxis::Options },
{ GamepadInput::Button_10, GamepadAxis::LeftStickPush },
Expand All @@ -203,7 +199,6 @@ const input_map GamepadMappings::Ds4InputMap =
{ GamepadInput::Button_13, GamepadAxis::Touchpad },
};


const std::map<Key, GamepadAxis> GamepadMappings::Ds4KeyMap =
{
{ Key::Move_Up, GamepadAxis::LeftStickUp },
Expand All @@ -219,13 +214,13 @@ const std::map<Key, GamepadAxis> GamepadMappings::Ds4KeyMap =
{ Key::Aim_Right, GamepadAxis::RightStickRight },
{ Key::Aim_Left, GamepadAxis::RightStickLeft },
{ Key::Escape, GamepadAxis::Triangle },
{ Key::Interact, GamepadAxis::Circle },
{ Key::Confirm, GamepadAxis::Circle },
{ Key::Jump, GamepadAxis::Square },
{ Key::Attack, GamepadAxis::X },
{ Key::PreviousSpell, GamepadAxis::LeftShoulder },
{ Key::NextSpell, GamepadAxis::RightShoulder },
{ Key::QuickSlot1, GamepadAxis::LeftTrigger },
{ Key::QuickSlot2, GamepadAxis::RightTrigger },
{ Key::Menu, GamepadAxis::PSButton },
{ Key::Interact, GamepadAxis::Square },
{ Key::Confirm, GamepadAxis::Square },
{ Key::Jump, GamepadAxis::X },
{ Key::Attack, GamepadAxis::Circle },
{ Key::PreviousSpell, GamepadAxis::LeftButton1 },
{ Key::NextSpell, GamepadAxis::RightButton1 },
{ Key::QuickSlot1, GamepadAxis::LeftButton2 },
{ Key::QuickSlot2, GamepadAxis::RightButton2 },
{ Key::Menu, GamepadAxis::Options },
};
4 changes: 2 additions & 2 deletions src/GUI/ItemDescriptionWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ std::string ItemDescriptionWindow::getInteractionTextGamepad(const Item& item, c
}
else if (type == ItemType::Consumable) {
interactionText =
(info.isInLevel ?
"\n" + getGamepadText("ToConsume", Key::Interact) : "") +
"\n" + (info.isInLevel ?
getGamepadText("ToConsume", Key::Interact) + "\n" : "") +
getGamepadText("ToEquipSlot1", Key::Attack) + "\n" +
getGamepadText("ToEquipSlot2", Key::Jump);
}
Expand Down
17 changes: 11 additions & 6 deletions src/Screens/LevelScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,34 +41,34 @@ void LevelScreen::loadAsync() {
m_progressLog = new ProgressLog(getCharacterCore());
m_progressLog->setYOffset(150.f);

auto buttonGroup = new ButtonGroup();
m_buttonGroup = new ButtonGroup();

// load screen
m_resumeButton = new Button(sf::FloatRect(0, 0, 50, 50), GUIOrnamentStyle::MEDIUM);
m_resumeButton->setText("Resume");
m_resumeButton->setVisible(false);
m_resumeButton->setOnClick(std::bind(&LevelScreen::onResume, this));
buttonGroup->addButton(m_resumeButton);
m_buttonGroup->addButton(m_resumeButton);

m_backToMenuButton = new Button(sf::FloatRect(0, 0, 50, 50), GUIOrnamentStyle::MEDIUM);
m_backToMenuButton->setText("BackToMenu");
m_backToMenuButton->setVisible(false);
m_backToMenuButton->setOnClick(std::bind(&LevelScreen::onBackToMenu, this));
buttonGroup->addButton(m_backToMenuButton);
m_buttonGroup->addButton(m_backToMenuButton);

m_retryButton = new Button(sf::FloatRect(0, 0, 50, 50), GUIOrnamentStyle::MEDIUM);
m_retryButton->setText("BackToCheckpoint");
m_retryButton->setVisible(false);
m_retryButton->setOnClick(std::bind(&LevelScreen::onBackToCheckpoint, this));
buttonGroup->addButton(m_retryButton);
m_buttonGroup->addButton(m_retryButton);

m_backToMapButton = new Button(sf::FloatRect(0, 0, 50, 50), GUIOrnamentStyle::MEDIUM);
m_backToMapButton->setText("BackToMap");
m_backToMapButton->setVisible(false);
m_backToMapButton->setOnClick(std::bind(&LevelScreen::onBackToMap, this));
buttonGroup->addButton(m_backToMapButton);
m_buttonGroup->addButton(m_backToMapButton);

addObject(buttonGroup);
addObject(m_buttonGroup);

// synchronize and center buttons
sf::Vector2f buttonSize(0.f, 50.f);
Expand Down Expand Up @@ -359,7 +359,12 @@ void LevelScreen::execUpdate(const sf::Time& frameTime) {
m_backToMenuButton->setVisible(m_isPaused);
m_backToMapButton->setVisible(m_isPaused && !m_currentLevel.getWorldData()->isBossLevel);
m_retryButton->setVisible(m_isPaused && !m_currentLevel.getWorldData()->isBossLevel);

g_inputController->lockAction();

if (m_isPaused) {
m_buttonGroup->selectButton(0);
}
}
}

Expand Down
12 changes: 12 additions & 0 deletions src/Structs/ConfigurationData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ void ConfigurationData::resetToDefault() {
alternativeKeyMap = ALTERNATIVE_KEYMAP;
gamepadProductId = GamepadController::getCurrentGamepadProductId();
gamepadKeyMap = GamepadMappings::getDefaultMappings(gamepadProductId);
#ifdef DEBUG
displayMode = DisplayMode::Window;
#else
displayMode = DisplayMode::Fullscreen;
#endif
isQuickcast = true;
isAutotarget = true;
isPauseInventory = false;
Expand All @@ -27,11 +31,19 @@ void ConfigurationData::resetToDefault() {
isDisplayQuestMarkers = true;
isMultithreading = true;
isGodmode = false;
#ifdef DEBUG
isDebugRendering = true;
#else
isDebugRendering = false;
#endif
isDebugRenderingOn = false;
isWindowReload = false;
isDisplayTime = false;
#ifdef DEBUG
logLevel = LogLevel::Info;
#else
logLevel = LogLevel::Error;
#endif
}

void ConfigurationData::reloadGamepadMapping(GamepadProductID id) {
Expand Down

0 comments on commit 9a5aa58

Please sign in to comment.