Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/oxce-plus' into oxce-plus
Browse files Browse the repository at this point in the history
  • Loading branch information
Xilmi committed Nov 5, 2024
2 parents 45e1ee7 + 0f8616d commit 4db6e9a
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 25 deletions.
2 changes: 1 addition & 1 deletion bin/common/dont-touch.me
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version: 7.14.4
version: 7.15.0
2 changes: 1 addition & 1 deletion bin/standard/xcom1/metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# metadata.yaml for XCOM1

name: "UFO: Enemy Unknown / X-Com: UFO Defense"
version: 7.14.4
version: 7.15.0
description: "The original UFO: Enemy Unknown / X-Com: UFO Defense"
author: Microprose
id: xcom1
Expand Down
2 changes: 1 addition & 1 deletion bin/standard/xcom2/metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# metadata.yaml for XCOM2

name: "X-Com: Terror From the Deep"
version: 7.14.4
version: 7.15.0
description: "The original X-Com: Terror From the Deep"
author: Microprose
id: xcom2
Expand Down
2 changes: 1 addition & 1 deletion install/win/installer.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
;Defines

!define GAME_NAME "OpenXcom Extended"
!define GAME_VERSION "7.14.4"
!define GAME_VERSION "7.15.0"
!define GAME_AUTHOR "OpenXcom Developers"
!include "version.nsh"

Expand Down
14 changes: 13 additions & 1 deletion src/Battlescape/PrimeGrenadeState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ namespace OpenXcom
* @param inInventoryView Called from inventory?
* @param grenadeInInventory Pointer to associated grenade.
*/
PrimeGrenadeState::PrimeGrenadeState(BattleAction *action, bool inInventoryView, BattleItem *grenadeInInventory) : _action(action), _inInventoryView(inInventoryView), _grenadeInInventory(grenadeInInventory)
PrimeGrenadeState::PrimeGrenadeState(BattleAction *action, bool inInventoryView, BattleItem *grenadeInInventory) :
_action(action), _inInventoryView(inInventoryView), _grenadeInInventory(grenadeInInventory)
{
_screen = false;

Expand Down Expand Up @@ -110,6 +111,12 @@ PrimeGrenadeState::PrimeGrenadeState(BattleAction *action, bool inInventoryView,
_number[i]->setVerticalAlign(ALIGN_MIDDLE);
}

_button[0]->onKeyboardPress((ActionHandler)&PrimeGrenadeState::btnClick, SDLK_q);
_button[0]->onKeyboardPress((ActionHandler)&PrimeGrenadeState::btnClick, SDLK_0);
_button[1]->onKeyboardPress((ActionHandler)&PrimeGrenadeState::btnClick, SDLK_1);
_button[2]->onKeyboardPress((ActionHandler)&PrimeGrenadeState::btnClick, SDLK_2);
_button[3]->onKeyboardPress((ActionHandler)&PrimeGrenadeState::btnClick, SDLK_3);

centerAllSurfaces();
lowerAllSurfaces();
}
Expand All @@ -134,6 +141,11 @@ void PrimeGrenadeState::handle(Action *action)
if (!_inInventoryView) _action->value = -1;
_game->popState();
}
else if (action->getDetails()->type == SDL_KEYDOWN && action->getDetails()->key.keysym.sym == Options::keyCancel)
{
if (!_inInventoryView) _action->value = -1;
_game->popState();
}
}


Expand Down
44 changes: 32 additions & 12 deletions src/Battlescape/SkillMenuState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ SkillMenuState::SkillMenuState(BattleAction *action, int x, int y) : ActionMenuS
_action->type = skill->getTargetMode();

// Attention: we are modifying _action->weapon inside!
chooseWeaponForSkill(_action, skill->getCompatibleWeapons(), skill->getCompatibleBattleType(), skill->checkHandsOnly());
chooseWeaponForSkill(_action, skill);

// Attention: here the modified values are consumed
addItem(skill, &id, hotkeys.back());
Expand Down Expand Up @@ -207,7 +207,7 @@ void SkillMenuState::btnActionMenuItemClick(Action *action)
const RuleSkill *selectedSkill = _actionMenu[btnID]->getSkill();
_action->skillRules = selectedSkill;
_action->type = _actionMenu[btnID]->getAction();
chooseWeaponForSkill(_action, selectedSkill->getCompatibleWeapons(), selectedSkill->getCompatibleBattleType(), selectedSkill->checkHandsOnly());
chooseWeaponForSkill(_action, selectedSkill);
_action->updateTU();

bool continueAction = tileEngine->skillUse(_action, selectedSkill);
Expand Down Expand Up @@ -252,7 +252,7 @@ void SkillMenuState::btnActionMenuItemClick(Action *action)
}
}

void SkillMenuState::chooseWeaponForSkill(BattleAction* action, const std::vector<const RuleItem*> &compatibleWeaponTypes, BattleType compatibleBattleType, bool checkHandsOnly)
void SkillMenuState::chooseWeaponForSkill(BattleAction* action, const RuleSkill* skillRules)
{
auto unit = action->actor;
action->weapon = nullptr;
Expand All @@ -263,9 +263,9 @@ void SkillMenuState::chooseWeaponForSkill(BattleAction* action, const std::vecto
}

// 1. choose by weapon's name
if (!compatibleWeaponTypes.empty())
if (!skillRules->getCompatibleWeapons().empty())
{
for (auto itemRule : compatibleWeaponTypes)
for (auto* itemRule : skillRules->getCompatibleWeapons())
{
// check both hands, right first
if (unit->getRightHandWeapon() && unit->getRightHandWeapon()->getRules() == itemRule)
Expand All @@ -278,7 +278,7 @@ void SkillMenuState::chooseWeaponForSkill(BattleAction* action, const std::vecto
action->weapon = unit->getLeftHandWeapon();
return;
}
if (!checkHandsOnly)
if (!skillRules->checkHandsOnly())
{
// check special weapons
BattleItem *item = unit->getSpecialWeapon(itemRule);
Expand All @@ -301,17 +301,37 @@ void SkillMenuState::chooseWeaponForSkill(BattleAction* action, const std::vecto
}

// 2. if not found, try by weapon's battle type
if (compatibleBattleType != BT_NONE)
if (skillRules->getCompatibleBattleType() != BT_NONE)
{
// check inventory
for (auto invItem : *unit->getInventory())
// check both hands, right first
if (unit->getRightHandWeapon() && unit->getRightHandWeapon()->getRules()->getBattleType() == skillRules->getCompatibleBattleType())
{
// Note: checkHandsOnly is not considered here
if (invItem->getRules()->getBattleType() == compatibleBattleType)
action->weapon = unit->getRightHandWeapon();
return;
}
else if (unit->getLeftHandWeapon() && unit->getLeftHandWeapon()->getRules()->getBattleType() == skillRules->getCompatibleBattleType())
{
action->weapon = unit->getLeftHandWeapon();
return;
}
if (!skillRules->checkHandsOnly2())
{
// check special weapons
BattleItem* item = unit->getSpecialWeapon(skillRules->getCompatibleBattleType());
if (item)
{
action->weapon = invItem;
action->weapon = item;
return;
}
// check inventory
for (auto* invItem : *unit->getInventory())
{
if (invItem->getRules()->getBattleType() == skillRules->getCompatibleBattleType())
{
action->weapon = invItem;
return;
}
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Battlescape/SkillMenuState.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SkillMenuState : public ActionMenuState
/// Adds a new menu item for an action.
void addItem(const RuleSkill* skill, int *id, SDLKey key);
/// Choose an action weapon based on given parameters.
void chooseWeaponForSkill(BattleAction* action, const std::vector<const RuleItem*> &compatibleWeaponTypes, BattleType compatibleWeaponType, bool checkHandsOnly);
void chooseWeaponForSkill(BattleAction* action, const RuleSkill* skillRules);
public:
/// Creates the Skill Menu state.
SkillMenuState(BattleAction *action, int x, int y);
Expand Down
3 changes: 2 additions & 1 deletion src/Mod/RuleSkill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace OpenXcom
{

RuleSkill::RuleSkill(const std::string& type) : _type(type),
_targetMode(BA_NONE), _compatibleBattleType(BT_NONE), _isPsiRequired(false), _checkHandsOnly(true)
_targetMode(BA_NONE), _compatibleBattleType(BT_NONE), _isPsiRequired(false), _checkHandsOnly(true), _checkHandsOnly2(false)
{
}

Expand Down Expand Up @@ -53,6 +53,7 @@ void RuleSkill::load(const YAML::Node& node, Mod *mod, const ModScript& parsers)

_isPsiRequired = node["isPsiRequired"].as<bool>(_isPsiRequired);
_checkHandsOnly = node["checkHandsOnly"].as<bool>(_checkHandsOnly);
_checkHandsOnly2 = node["checkHandsOnly2"].as<bool>(_checkHandsOnly2);

_cost.loadCost(node, "Use");
_flat.loadPercent(node, "Use");
Expand Down
3 changes: 3 additions & 0 deletions src/Mod/RuleSkill.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class RuleSkill
BattleType _compatibleBattleType;
bool _isPsiRequired;
bool _checkHandsOnly;
bool _checkHandsOnly2;
RuleItemUseCost _cost;
RuleItemUseCost _flat;
std::vector<std::string> _compatibleWeaponNames;
Expand Down Expand Up @@ -66,6 +67,8 @@ class RuleSkill
bool isPsiRequired() const { return _isPsiRequired; }
/// Should the check for compatible items only consider the hands (or also the inventory and specialweapon)?
bool checkHandsOnly() const { return _checkHandsOnly; }
/// Should the check for compatible items (by battle type) only consider the hands (or also the inventory and specialweapon)?
bool checkHandsOnly2() const { return _checkHandsOnly2; }
/// Gets the use cost for this skill.
const RuleItemUseCost& getCost() const { return _cost; }
/// Gets the flat vs. percentage cost flags for the use cost of this skill.
Expand Down
2 changes: 1 addition & 1 deletion src/OpenXcom.2010.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_XP|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)..\deps\include;$(ProjectDir)..\deps\include\SDL;$(ProjectDir)..\deps\include\yaml-cpp;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;YAML_CPP_DLL;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;YAML_CPP_DLL;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0501;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level1</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
Expand Down
10 changes: 5 additions & 5 deletions src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
* along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
*/

#define MIN_REQUIRED_RULESET_VERSION_NUMBER 7,14,4,0
#define MIN_REQUIRED_RULESET_VERSION_NUMBER 7,15,0,0

#define OPENXCOM_VERSION_ENGINE "Extended"
#define OPENXCOM_VERSION_SHORT "Extended Brutal 7.14.4 9.2.0"
#define OPENXCOM_VERSION_LONG "7.14.4.0"
#define OPENXCOM_VERSION_NUMBER 7,14,4,0
#define OPENXCOM_VERSION_SHORT "Extended Brutal 7.15.0 9.2.1"
#define OPENXCOM_VERSION_LONG "7.15.0.0"
#define OPENXCOM_VERSION_NUMBER 7,15,0,0

#ifndef OPENXCOM_VERSION_GIT
#define OPENXCOM_VERSION_GIT " (v2024-10-26)"
#define OPENXCOM_VERSION_GIT " (v2024-11-05)"
#endif

0 comments on commit 4db6e9a

Please sign in to comment.