Skip to content

Commit 37e4bc0

Browse files
committed
implement ruleset-based MCD patches
while this class does require expansion to accommodate everything that defines a mapData object, it does provide a "good start" that should be easy to copypaste all the rest later on. for now i'm just adding in some bigWall integers to differenciate them a bit, for the improvements to the pathfinder.
1 parent 39ac659 commit 37e4bc0

11 files changed

Lines changed: 422 additions & 2 deletions

Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,8 @@ openxcom_SOURCES = \
475475
src/Ruleset/MapData.h \
476476
src/Ruleset/MapDataSet.cpp \
477477
src/Ruleset/MapDataSet.h \
478+
src/Ruleset/MCDPatch.cpp \
479+
src/Ruleset/MCDPatch.h \
478480
src/Ruleset/AlienDeployment.cpp \
479481
src/Ruleset/AlienDeployment.h \
480482
src/Ruleset/AlienRace.cpp \

bin/data/Ruleset/Xcom1Ruleset.rul

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9123,3 +9123,164 @@ alienItemLevels:
91239123
- [1, 1, 1, 2, 2, 2, 2, 2, 2, 2]
91249124
- [1, 1, 2, 2, 2, 2, 2, 2, 2, 2]
91259125
- [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
9126+
MCDPatches:
9127+
# pathFinding Hacks.
9128+
# bigWall 1 = regular bigwall, no movement allowed.
9129+
# bigWall 2 = can walk by north-east/south-west
9130+
# bigWall 3 = can walk by north-west/south-east
9131+
# bigWall 4 = acts as west wall
9132+
# bigWall 5 = acts as north wall
9133+
# bigWall 6 = acts as east wall
9134+
# bigWall 7 = acts as south wall
9135+
# bigWall 8 = acts as east and south wall
9136+
- type: XBASE1
9137+
data:
9138+
- MCDIndex: 2
9139+
bigWall: 2
9140+
- MCDIndex: 3
9141+
bigWall: 2
9142+
- MCDIndex: 4
9143+
bigWall: 3
9144+
- MCDIndex: 5
9145+
bigWall: 3
9146+
- MCDIndex: 19
9147+
bigWall: 2
9148+
- type: AVENGER
9149+
data:
9150+
- MCDIndex: 12
9151+
bigWall: 2
9152+
- MCDIndex: 14
9153+
bigWall: 3
9154+
- MCDIndex: 16
9155+
bigWall: 3
9156+
- MCDIndex: 26
9157+
bigWall: 4
9158+
- MCDIndex: 30
9159+
bigWall: 4
9160+
- MCDIndex: 31
9161+
bigWall: 4
9162+
- MCDIndex: 32
9163+
bigWall: 4
9164+
- MCDIndex: 33
9165+
bigWall: 4
9166+
- MCDIndex: 33
9167+
bigWall: 4
9168+
- MCDIndex: 43
9169+
bigWall: 6
9170+
- MCDIndex: 44
9171+
bigWall: 6
9172+
- MCDIndex: 45
9173+
bigWall: 6
9174+
- MCDIndex: 46
9175+
bigWall: 6
9176+
- MCDIndex: 48
9177+
bigWall: 2
9178+
- type: LIGHTNIN
9179+
data:
9180+
- MCDIndex: 0
9181+
bigWall: 6
9182+
- MCDIndex: 1
9183+
bigWall: 6
9184+
- MCDIndex: 2
9185+
bigWall: 2
9186+
- MCDIndex: 3
9187+
bigWall: 7
9188+
- MCDIndex: 4
9189+
bigWall: 3
9190+
- MCDIndex: 5
9191+
bigWall: 5
9192+
- MCDIndex: 6
9193+
bigWall: 5
9194+
- MCDIndex: 7
9195+
bigWall: 2
9196+
- MCDIndex: 8
9197+
bigWall: 2
9198+
- MCDIndex: 9
9199+
bigWall: 4
9200+
- MCDIndex: 10
9201+
bigWall: 4
9202+
- MCDIndex: 11
9203+
bigWall: 3
9204+
- MCDIndex: 12
9205+
bigWall: 2
9206+
- MCDIndex: 13
9207+
bigWall: 7
9208+
- type: U_EXT02
9209+
data:
9210+
- MCDIndex: 2
9211+
bigWall: 6
9212+
- MCDIndex: 3
9213+
bigWall: 7
9214+
- MCDIndex: 4
9215+
bigWall: 2
9216+
- MCDIndex: 5
9217+
bigWall: 2
9218+
- MCDIndex: 6
9219+
bigWall: 3
9220+
- MCDIndex: 7
9221+
bigWall: 3
9222+
- MCDIndex: 8
9223+
bigWall: 8
9224+
- MCDIndex: 13
9225+
bigWall: 2
9226+
- MCDIndex: 14
9227+
bigWall: 2
9228+
- MCDIndex: 15
9229+
bigWall: 2
9230+
# Mountain terrain death tile fix
9231+
- type: MOUNT
9232+
data:
9233+
- MCDIndex: 0
9234+
deathTile: 77
9235+
- MCDIndex: 1
9236+
deathTile: 77
9237+
- MCDIndex: 2
9238+
deathTile: 77
9239+
- MCDIndex: 3
9240+
deathTile: 77
9241+
- MCDIndex: 4
9242+
deathTile: 77
9243+
- MCDIndex: 5
9244+
deathTile: 77
9245+
- MCDIndex: 6
9246+
deathTile: 77
9247+
- MCDIndex: 7
9248+
deathTile: 77
9249+
- MCDIndex: 8
9250+
deathTile: 77
9251+
- MCDIndex: 9
9252+
deathTile: 77
9253+
- MCDIndex: 10
9254+
deathTile: 77
9255+
- MCDIndex: 11
9256+
deathTile: 77
9257+
- MCDIndex: 12
9258+
deathTile: 77
9259+
- MCDIndex: 13
9260+
deathTile: 77
9261+
- MCDIndex: 14
9262+
deathTile: 77
9263+
- MCDIndex: 15
9264+
deathTile: 77
9265+
- MCDIndex: 16
9266+
deathTile: 77
9267+
- MCDIndex: 17
9268+
deathTile: 77
9269+
- MCDIndex: 18
9270+
deathTile: 77
9271+
- MCDIndex: 19
9272+
deathTile: 77
9273+
- MCDIndex: 20
9274+
deathTile: 77
9275+
- MCDIndex: 21
9276+
deathTile: 77
9277+
- MCDIndex: 22
9278+
deathTile: 77
9279+
- MCDIndex: 23
9280+
deathTile: 77
9281+
- MCDIndex: 71
9282+
deathTile: 74
9283+
- MCDIndex: 72
9284+
deathTile: 75
9285+
- MCDIndex: 73
9286+
deathTile: 76

src/Battlescape/BattlescapeGenerator.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "../Ruleset/Ruleset.h"
4343
#include "../Ruleset/MapDataSet.h"
4444
#include "../Ruleset/MapData.h"
45+
#include "../Ruleset/MCDPatch.h"
4546
#include "../Ruleset/Armor.h"
4647
#include "../Ruleset/Unit.h"
4748
#include "../Ruleset/AlienRace.h"
@@ -1310,6 +1311,10 @@ void BattlescapeGenerator::generateMap()
13101311
for (std::vector<MapDataSet*>::iterator i = _terrain->getMapDataSets()->begin(); i != _terrain->getMapDataSets()->end(); ++i)
13111312
{
13121313
(*i)->loadData();
1314+
if (_game->getRuleset()->getMCDPatch((*i)->getName()))
1315+
{
1316+
_game->getRuleset()->getMCDPatch((*i)->getName())->modifyData(*i);
1317+
}
13131318
_save->getMapDataSets()->push_back(*i);
13141319
mapDataSetIDOffset++;
13151320
}
@@ -1448,6 +1453,10 @@ void BattlescapeGenerator::generateMap()
14481453
for (std::vector<MapDataSet*>::iterator i = _ufo->getRules()->getBattlescapeTerrainData()->getMapDataSets()->begin(); i != _ufo->getRules()->getBattlescapeTerrainData()->getMapDataSets()->end(); ++i)
14491454
{
14501455
(*i)->loadData();
1456+
if (_game->getRuleset()->getMCDPatch((*i)->getName()))
1457+
{
1458+
_game->getRuleset()->getMCDPatch((*i)->getName())->modifyData(*i);
1459+
}
14511460
_save->getMapDataSets()->push_back(*i);
14521461
craftDataSetIDOffset++;
14531462
}
@@ -1467,6 +1476,10 @@ void BattlescapeGenerator::generateMap()
14671476
for (std::vector<MapDataSet*>::iterator i = _craft->getRules()->getBattlescapeTerrainData()->getMapDataSets()->begin(); i != _craft->getRules()->getBattlescapeTerrainData()->getMapDataSets()->end(); ++i)
14681477
{
14691478
(*i)->loadData();
1479+
if (_game->getRuleset()->getMCDPatch((*i)->getName()))
1480+
{
1481+
_game->getRuleset()->getMCDPatch((*i)->getName())->modifyData(*i);
1482+
}
14701483
_save->getMapDataSets()->push_back(*i);
14711484
}
14721485
loadMAP(craftMap, craftX * 10, craftY * 10, _craft->getRules()->getBattlescapeTerrainData(), mapDataSetIDOffset + craftDataSetIDOffset, true);

src/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,8 @@ set ( ruleset_src
412412
Ruleset/RuleInventory.cpp
413413
Ruleset/MapBlock.h
414414
Ruleset/MapBlock.cpp
415+
Ruleset/MCDPatch.h
416+
Ruleset/MCDPatch.cpp
415417
Ruleset/RuleBaseFacility.cpp
416418
Ruleset/RuleBaseFacility.h
417419
Ruleset/SoldierNamePool.h

src/OpenXcom.2008.vcproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2298,6 +2298,14 @@
22982298
RelativePath=".\Ruleset\MapDataSet.h"
22992299
>
23002300
</File>
2301+
<File
2302+
RelativePath=".\Ruleset\MCDPatch.cpp"
2303+
>
2304+
</File>
2305+
<File
2306+
RelativePath=".\Ruleset\MCDPatch.h"
2307+
>
2308+
</File>
23012309
<File
23022310
RelativePath=".\Ruleset\RuleAlienMission.cpp"
23032311
>

src/OpenXcom.2010.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@
396396
</ClCompile>
397397
<ClCompile Include="Resource\ResourcePack.cpp" />
398398
<ClCompile Include="Resource\XcomResourcePack.cpp" />
399+
<ClCompile Include="Ruleset\MCDPatch.cpp" />
399400
<ClCompile Include="Ruleset\RuleAlienMission.cpp" />
400401
<ClCompile Include="Ruleset\ArticleDefinition.cpp" />
401402
<ClCompile Include="Ruleset\City.cpp" />
@@ -667,6 +668,7 @@
667668
<ClInclude Include="Ruleset\MapData.h" />
668669
<ClInclude Include="Ruleset\AlienDeployment.h" />
669670
<ClInclude Include="Ruleset\AlienRace.h" />
671+
<ClInclude Include="Ruleset\MCDPatch.h" />
670672
<ClInclude Include="Ruleset\Unit.h" />
671673
<ClInclude Include="Ruleset\Armor.h" />
672674
<ClInclude Include="Ruleset\RuleAlienMission.h" />

src/OpenXcom.2010.vcxproj.filters

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,9 @@
763763
<Filter>Menu</Filter>
764764
</ClCompile>
765765
<ClCompile Include="pch.cpp" />
766+
<ClCompile Include="Ruleset\MCDPatch.cpp">
767+
<Filter>Ruleset</Filter>
768+
</ClCompile>
766769
</ItemGroup>
767770
<ItemGroup>
768771
<ClInclude Include="resource.h" />
@@ -1551,6 +1554,9 @@
15511554
<Filter>Engine</Filter>
15521555
</ClInclude>
15531556
<ClInclude Include="version.h" />
1557+
<ClInclude Include="Ruleset\MCDPatch.h">
1558+
<Filter>Ruleset</Filter>
1559+
</ClInclude>
15541560
</ItemGroup>
15551561
<ItemGroup>
15561562
<ResourceCompile Include="OpenXcom.rc" />

0 commit comments

Comments
 (0)