diff --git a/config/AcediaGameModes.ini b/config/AcediaGameModes.ini index 951715e..90d43f6 100644 --- a/config/AcediaGameModes.ini +++ b/config/AcediaGameModes.ini @@ -1,7 +1,9 @@ [hard GameMode] title={$green Hard difficulty} difficulty=hard +mapList=defaultHard [hell GameMode] title={$crimson Hell On Earth} difficulty=hoe +mapList=defaultHOE diff --git a/config/AcediaLauncher.ini b/config/AcediaLauncher.ini index f347ad6..31c1bc4 100644 --- a/config/AcediaLauncher.ini +++ b/config/AcediaLauncher.ini @@ -1,2 +1,2 @@ [AcediaLauncher.Packages] -useGameModes=false \ No newline at end of file +useGameModes=true \ No newline at end of file diff --git a/config/AcediaMaps.ini b/config/AcediaMaps.ini new file mode 100644 index 0000000..c0ed975 --- /dev/null +++ b/config/AcediaMaps.ini @@ -0,0 +1,7 @@ +[default MapList] +autoEnable=true +map="KF-BioticsLab" +map="KF-Farm" +map="KF-Manor" +map="KF-Offices" +map="KF-WestLondon" diff --git a/sources/AcediaLauncherMut.uc b/sources/AcediaLauncherMut.uc index 82ee6ca..194e34d 100644 --- a/sources/AcediaLauncherMut.uc +++ b/sources/AcediaLauncherMut.uc @@ -45,6 +45,7 @@ simulated function PreBeginPlay() } if (votingAdapter != none) { votingAdapter.InjectIntoVotingHandler(); + votingAdapter.TrySetupMapList(); } SetupMutatorSignals(); } diff --git a/sources/GameModes/GameMode.uc b/sources/GameModes/GameMode.uc index 13589bd..5eeff6e 100644 --- a/sources/GameModes/GameMode.uc +++ b/sources/GameModes/GameMode.uc @@ -77,6 +77,7 @@ protected function HashTable ToData() result.SetString(P("gameTypeClass"), gameTypeClass); result.SetString(P("acronym"), acronym); result.SetString(P("mapPrefix"), mapPrefix); + nextArray = _.collections.EmptyArrayList(); for (i = 0; i < option.length; i += 1) { @@ -103,9 +104,10 @@ protected function FromData(HashTable source) return; } gameTypeClass = source.GetString(P("gameTypeClass")); - acronym = source.GetString(P("acronym")); - mapPrefix = source.GetString(P("mapPrefix")); - nextArray = source.GetArrayList(P("option")); + acronym = source.GetString(P("acronym")); + mapPrefix = source.GetString(P("mapPrefix")); + + nextArray = source.GetArrayList(P("option")); if (nextArray == none) { return; } @@ -271,6 +273,8 @@ defaultproperties hardSynonyms(0) = "harder" // "hard" is prefix of this, so it will count hardSynonyms(1) = "difficult" suicidalSynonyms(0) = "suicidal" + // DONE! + suicidalSynonyms(1) = "sui" hoeSynonyms(0) = "hellonearth" hoeSynonyms(1) = "hellon earth" hoeSynonyms(2) = "hell onearth" diff --git a/sources/MapList/MapList.uc b/sources/MapList/MapList.uc new file mode 100644 index 0000000..ea4bf6e --- /dev/null +++ b/sources/MapList/MapList.uc @@ -0,0 +1,55 @@ +class MapList extends FeatureConfig + perObjectConfig + config(AcediaMaps); + +var public config array map; + +protected function HashTable ToData() { + local int i; + local ArrayList mapArray; + local HashTable result; + + result = _.collections.EmptyHashTable(); + mapArray = _.collections.EmptyArrayList(); + + for (i = 0; i < map.length; i += 1) { + mapArray.AddString(map[i]); + } + + result.SetItem(P("maps"), mapArray); + _.memory.Free(mapArray); + + return result; +} + +protected function FromData(HashTable source) { + local int i; + local ArrayList mapArray; + + if (source == none) { + return; + } + + mapArray = source.GetArrayList(P("maps")); + if (mapArray == none) { + return; + } + + map.length = 0; + for (i = 0; i < mapArray.GetLength(); i += 1) { + map[map.length] = mapArray.GetString(i); + } + _.memory.Free(mapArray); +} + +protected function DefaultIt() { + map[0] = "KF-BioticsLab"; + map[1] = "KF-Farm"; + map[2] = "KF-Manor"; + map[3] = "KF-Offices"; + map[4] = "KF-WestLondon"; +} + +defaultproperties { + configName = "AcediaMaps" +} \ No newline at end of file diff --git a/sources/MapList/MapList_Feature.uc b/sources/MapList/MapList_Feature.uc new file mode 100644 index 0000000..c36057e --- /dev/null +++ b/sources/MapList/MapList_Feature.uc @@ -0,0 +1,7 @@ +class MapList_Feature extends Feature; + + + +defaultproperties { + configClass = class'MapList' +} \ No newline at end of file diff --git a/sources/StartUp.uc b/sources/StartUp.uc index 478883d..4556c35 100644 --- a/sources/StartUp.uc +++ b/sources/StartUp.uc @@ -125,6 +125,9 @@ public function array GetAutoConfigurationInfo() local array result; availableFeatures = _.environment.GetAvailableFeatures(); + // We only have a single feature, so instead of adding our own manifest, simply add it here + class'MapList_Feature'.static.LoadConfigs(); + availableFeatures[availableFeatures.length] = class'MapList_Feature'; for (i = 0; i < availableFeatures.length; i += 1) { autoConfig = availableFeatures[i].static.GetAutoEnabledConfig(); diff --git a/sources/VotingHandlerAdapter.uc b/sources/VotingHandlerAdapter.uc index d0538d1..c852f90 100644 --- a/sources/VotingHandlerAdapter.uc +++ b/sources/VotingHandlerAdapter.uc @@ -102,6 +102,7 @@ protected function Finalizer() * Backup of replaced configs is made internally, so that they can be restored * on map change. */ +// TODO ADD ME! public final function InjectIntoVotingHandler() { local int i; @@ -138,6 +139,48 @@ public final function InjectIntoVotingHandler() votingHandler.gameConfig = newVotingHandlerConfig; } +public function TrySetupMapList() { + local MapList_Feature mapListFeature; + local Text currentConfigName; + local MapList currentConfig; + + warn(">>>>>>>> START!"); + mapListFeature = MapList_Feature(class'MapList_Feature'.static.GetEnabledInstance()); + currentConfigName = mapListFeature.GetCurrentConfig(); + currentConfig = MapList(class'MapList'.static.GetConfigInstance(currentConfigName)); + + ReplaceHandlerMaps(XVotingHandler(votingHandlerReference.Get()), currentConfig.map); +} + +public function ReplaceHandlerMaps(XVotingHandler votingHandler, array maps) { + local int i; + local VotingHandler.MapVoteMapList nextRecord; + local array recordArray; + + if (votingHandler == none) { + warn("votingHandler is none!"); + return; + } + if (maps.length == 0) { + warn("maps.length is 0!"); + return; + } + + recordArray = votingHandler.mapList; + warn(">>> recordArray.length =" $ recordArray.length); + + recordArray.length = maps.length; + votingHandler.mapCount = maps.length; + nextRecord.bEnabled = true; + + for (i = 0; i < maps.length; i += 1) { + nextRecord.mapName = maps[i]; + recordArray[i] = nextRecord; + } + + votingHandler.mapList = recordArray; +} + private function VotingHandler.MapVoteGameConfig BuildVotingHandlerConfig( GameMode gameMode) {