1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Add setting to allow previous VCMI mechanics of dimension door

This commit is contained in:
Dydzio 2024-03-27 23:39:08 +01:00
parent 048fb1867d
commit 25f9e6a3e9
4 changed files with 75 additions and 58 deletions

View File

@ -37,7 +37,7 @@
#include "../CPlayerInterface.h" #include "../CPlayerInterface.h"
#include "../../CCallback.h" #include "../../CCallback.h"
#include "../../lib/CConfigHandler.h" #include "../../lib/GameSettings.h"
#include "../../lib/StartInfo.h" #include "../../lib/StartInfo.h"
#include "../../lib/CGeneralTextHandler.h" #include "../../lib/CGeneralTextHandler.h"
#include "../../lib/spells/CSpellHandler.h" #include "../../lib/spells/CSpellHandler.h"
@ -533,7 +533,12 @@ void AdventureMapInterface::onTileLeftClicked(const int3 &targetPosition)
performSpellcasting(targetPosition); performSpellcasting(targetPosition);
break; break;
case SpellID::DIMENSION_DOOR: case SpellID::DIMENSION_DOOR:
const TerrainTile *targetTile = LOCPLINT->cb->getTileForDimensionDoor(targetPosition, LOCPLINT->localState->getCurrentHero()); bool allowOnlyToUncoveredTiles = VLC->settings()->getBoolean(EGameSettings::DIMENSION_DOOR_ONLY_TO_UNCOVERED_TILES);
const TerrainTile * targetTile = allowOnlyToUncoveredTiles
? LOCPLINT->cb->getTile(targetPosition, false)
: LOCPLINT->cb->getTileForDimensionDoor(targetPosition, LOCPLINT->localState->getCurrentHero());
if(targetTile && targetTile->isClear(heroTile)) if(targetTile && targetTile->isClear(heroTile))
performSpellcasting(targetPosition); performSpellcasting(targetPosition);
break; break;
@ -663,7 +668,12 @@ void AdventureMapInterface::onTileHovered(const int3 &targetPosition)
} }
case SpellID::DIMENSION_DOOR: case SpellID::DIMENSION_DOOR:
{ {
const TerrainTile * t = LOCPLINT->cb->getTileForDimensionDoor(targetPosition, LOCPLINT->localState->getCurrentHero()); bool allowOnlyToUncoveredTiles = VLC->settings()->getBoolean(EGameSettings::DIMENSION_DOOR_ONLY_TO_UNCOVERED_TILES);
const TerrainTile * t = allowOnlyToUncoveredTiles
? LOCPLINT->cb->getTile(targetPosition, false)
: LOCPLINT->cb->getTileForDimensionDoor(targetPosition, LOCPLINT->localState->getCurrentHero());
if(t && t->isClear(LOCPLINT->cb->getTile(heroPosition))/* && isInScreenRange(hpos, mapPos)*/) if(t && t->isClear(LOCPLINT->cb->getTile(heroPosition))/* && isInScreenRange(hpos, mapPos)*/)
CCS->curh->set(Cursor::Map::TELEPORT); //TODO: something wrong with beyond east spell range border cursor on arrogance after TP-ing near underground portal on previous day CCS->curh->set(Cursor::Map::TELEPORT); //TODO: something wrong with beyond east spell range border cursor on arrogance after TP-ing near underground portal on previous day
else else

View File

@ -389,6 +389,11 @@
"originalFlyRules" : false "originalFlyRules" : false
}, },
"spells":
{
"dimensionDoorOnlyToUncoveredTiles" : false
},
"bonuses" : "bonuses" :
{ {
"global" : "global" :

View File

@ -103,6 +103,7 @@ void GameSettings::load(const JsonNode & input)
{EGameSettings::PATHFINDER_USE_MONOLITH_ONE_WAY_RANDOM, "pathfinder", "useMonolithOneWayRandom" }, {EGameSettings::PATHFINDER_USE_MONOLITH_ONE_WAY_RANDOM, "pathfinder", "useMonolithOneWayRandom" },
{EGameSettings::PATHFINDER_USE_WHIRLPOOL, "pathfinder", "useWhirlpool" }, {EGameSettings::PATHFINDER_USE_WHIRLPOOL, "pathfinder", "useWhirlpool" },
{EGameSettings::PATHFINDER_ORIGINAL_FLY_RULES, "pathfinder", "originalFlyRules" }, {EGameSettings::PATHFINDER_ORIGINAL_FLY_RULES, "pathfinder", "originalFlyRules" },
{EGameSettings::DIMENSION_DOOR_ONLY_TO_UNCOVERED_TILES, "spells", "dimensionDoorOnlyToUncoveredTiles"},
{EGameSettings::TOWNS_BUILDINGS_PER_TURN_CAP, "towns", "buildingsPerTurnCap" }, {EGameSettings::TOWNS_BUILDINGS_PER_TURN_CAP, "towns", "buildingsPerTurnCap" },
{EGameSettings::TOWNS_STARTING_DWELLING_CHANCES, "towns", "startingDwellingChances" }, {EGameSettings::TOWNS_STARTING_DWELLING_CHANCES, "towns", "startingDwellingChances" },
}; };

View File

@ -70,6 +70,7 @@ enum class EGameSettings
TOWNS_BUILDINGS_PER_TURN_CAP, TOWNS_BUILDINGS_PER_TURN_CAP,
TOWNS_STARTING_DWELLING_CHANCES, TOWNS_STARTING_DWELLING_CHANCES,
COMBAT_ONE_HEX_TRIGGERS_OBSTACLES, COMBAT_ONE_HEX_TRIGGERS_OBSTACLES,
DIMENSION_DOOR_ONLY_TO_UNCOVERED_TILES,
OPTIONS_COUNT OPTIONS_COUNT
}; };